useLayout.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import useVars from './useVars.js'
  2. import { getClasses } from '../utils/classes.js'
  3. function useHook() { // useLayout
  4. const { pxs, percents } = useVars()
  5. const AspectRatio = {
  6. title: 'Aspect Ratio',
  7. classes: getClasses([
  8. { name: 'auto', value: 'auto' },
  9. { name: 'square', value: '1 / 1' },
  10. { name: 'video', value: '16 / 9' },
  11. ], {
  12. name: 'aspect-',
  13. value: 'aspect-ratio'
  14. })
  15. }
  16. const BoxSizing = ({
  17. title: 'Box Sizing',
  18. classes: getClasses([
  19. { name: 'border', value: 'border-box' },
  20. { name: 'content', value: 'content-box' },
  21. ], {
  22. name: 'box-',
  23. value: 'box-sizing'
  24. })
  25. })
  26. const Display = {
  27. title: 'Display',
  28. classes: getClasses('block, inline-block, inline, flex, inline-flex, flow-root, grid, inline-grid, contents, list-item, hidden: none', {
  29. name: '',
  30. value: 'display',
  31. scss: 0
  32. })
  33. }
  34. const Floats = {
  35. title: 'Floats',
  36. classes: getClasses('left, right, none', {
  37. name: 'float-',
  38. value: 'float',
  39. })
  40. }
  41. const Clear = {
  42. title: 'Clear',
  43. classes: getClasses('left, right, both, none', {
  44. name: 'clear-',
  45. value: 'clear',
  46. })
  47. }
  48. const Isolation = {
  49. title: 'Isolation',
  50. classes: getClasses('isolate ,isolation-auto', {
  51. name: '',
  52. value: 'isolation',
  53. })
  54. }
  55. const ObjectFit = {
  56. title: 'Object Fit',
  57. classes: getClasses('contain, cover, fill, none, scale-down', {
  58. name: 'object-',
  59. value: 'object-fit',
  60. })
  61. }
  62. const ObjectPosition = {
  63. title: 'Object Position',
  64. classes: getClasses('bottom, center, left, left-bottom, left-top, right, right-bottom, right-top, top', {
  65. name: 'object-',
  66. value: 'object-position',
  67. })
  68. }
  69. const Overflow = {
  70. title: 'Overflow',
  71. classes: getClasses('auto, hidden, clip, visible, scroll', {
  72. name: ['overflow-', 'overflow-x-', 'overflow-y-'],
  73. value: ['overflow', 'overflow-x', 'overflow-y'],
  74. })
  75. }
  76. const OverscrollBehavior = {
  77. title: 'Overscroll Behavior',
  78. classes: getClasses('auto, contain, none', {
  79. name: ['overscroll-', 'overscroll-x-', 'overscroll-y-'],
  80. value: ['overscroll-behavior', 'overscroll-behavior-x', 'overscroll-behavior-y'],
  81. })
  82. }
  83. const Position = {
  84. title: 'Position',
  85. classes: getClasses('static, fixed, absolute, relative, sticky', {
  86. name: '',
  87. value: 'position',
  88. })
  89. }
  90. const TopRightBottomLeft = {
  91. title: 'Top / Right / Bottom / Left',
  92. classes: getClasses(pxs, {
  93. name: ['inset-', 'inset-x-', 'inset-y-', 'start-', 'end-', 'top-', 'right-', 'bottom-', 'left-'],
  94. value: ['inset', 'left, right', 'top, bottom', 'inset-inline-start', 'inset-inline-end', 'top', 'right', 'bottom', 'left'],
  95. })
  96. }
  97. const Visibility = {
  98. title: 'Visibility',
  99. classes: getClasses('visible, invisible, collapse', {
  100. name: '',
  101. value: 'visibility',
  102. })
  103. }
  104. const ZIndex = {
  105. title: 'Z-Index',
  106. classes: getClasses('0, 10, 20, 30, 40, 50, auto', {
  107. name: 'z-',
  108. value: 'z-index',
  109. })
  110. }
  111. return {
  112. AspectRatio,
  113. BoxSizing,
  114. Display,
  115. Floats,
  116. Clear,
  117. Isolation,
  118. ObjectFit,
  119. ObjectPosition,
  120. Overflow,
  121. OverscrollBehavior,
  122. Position,
  123. TopRightBottomLeft,
  124. Visibility,
  125. ZIndex
  126. }
  127. }
  128. export default useHook