@stokelp/styled-system 2.126.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/css/conditions.d.ts +7 -0
  2. package/css/conditions.js +32 -0
  3. package/css/css.d.ts +6 -6
  4. package/css/css.js +63 -0
  5. package/css/cva.d.ts +3 -4
  6. package/css/cva.js +51 -0
  7. package/css/cx.d.ts +5 -4
  8. package/css/{cx.mjs → cx.js} +5 -4
  9. package/css/first-that-works.d.ts +22 -0
  10. package/css/first-that-works.js +1 -0
  11. package/css/index.d.ts +8 -5
  12. package/css/index.js +8 -0
  13. package/css/keyframes.d.ts +5 -0
  14. package/css/keyframes.js +8 -0
  15. package/css/position-try.d.ts +5 -0
  16. package/css/position-try.js +11 -0
  17. package/css/sva.d.ts +2 -3
  18. package/css/sva.js +49 -0
  19. package/css/view-transition.d.ts +7 -0
  20. package/css/view-transition.js +18 -0
  21. package/dist/panda/buildinfo.json +20580 -0
  22. package/dist/panda/lib.json +15 -0
  23. package/dist/panda/preset.mjs +9505 -0
  24. package/helpers.d.ts +67 -0
  25. package/helpers.js +624 -0
  26. package/jsx/aspect-ratio.d.ts +5 -8
  27. package/jsx/aspect-ratio.js +11 -0
  28. package/jsx/bleed.d.ts +6 -9
  29. package/jsx/bleed.js +11 -0
  30. package/jsx/box.d.ts +6 -9
  31. package/jsx/box.js +11 -0
  32. package/jsx/center.d.ts +6 -9
  33. package/jsx/center.js +11 -0
  34. package/jsx/circle.d.ts +6 -9
  35. package/jsx/circle.js +11 -0
  36. package/jsx/container.d.ts +6 -9
  37. package/jsx/container.js +11 -0
  38. package/jsx/cq.d.ts +6 -9
  39. package/jsx/cq.js +11 -0
  40. package/jsx/create-recipe-context.d.ts +31 -0
  41. package/jsx/create-recipe-context.js +38 -0
  42. package/jsx/create-slot-recipe-context.d.ts +49 -0
  43. package/jsx/create-slot-recipe-context.js +124 -0
  44. package/jsx/divider.d.ts +6 -9
  45. package/jsx/divider.js +11 -0
  46. package/jsx/factory.d.ts +3 -3
  47. package/jsx/factory.js +91 -0
  48. package/jsx/flex.d.ts +6 -9
  49. package/jsx/flex.js +11 -0
  50. package/jsx/float.d.ts +6 -9
  51. package/jsx/float.js +11 -0
  52. package/jsx/grid-item.d.ts +6 -9
  53. package/jsx/grid-item.js +11 -0
  54. package/jsx/grid.d.ts +6 -9
  55. package/jsx/grid.js +11 -0
  56. package/jsx/helper.d.ts +34 -0
  57. package/jsx/helper.js +92 -0
  58. package/jsx/hstack.d.ts +6 -9
  59. package/jsx/hstack.js +11 -0
  60. package/jsx/index.d.ts +25 -25
  61. package/jsx/index.js +24 -0
  62. package/jsx/is-valid-prop.d.ts +5 -10
  63. package/jsx/is-valid-prop.js +12 -0
  64. package/jsx/link-overlay.d.ts +6 -9
  65. package/jsx/link-overlay.js +11 -0
  66. package/jsx/spacer.d.ts +6 -9
  67. package/jsx/spacer.js +11 -0
  68. package/jsx/square.d.ts +6 -9
  69. package/jsx/square.js +11 -0
  70. package/jsx/stack.d.ts +6 -9
  71. package/jsx/stack.js +11 -0
  72. package/jsx/visually-hidden.d.ts +6 -9
  73. package/jsx/visually-hidden.js +11 -0
  74. package/jsx/vstack.d.ts +6 -9
  75. package/jsx/vstack.js +11 -0
  76. package/jsx/wrap.d.ts +6 -9
  77. package/jsx/wrap.js +11 -0
  78. package/package.json +32 -18
  79. package/patterns/aspect-ratio.d.ts +8 -9
  80. package/patterns/aspect-ratio.js +37 -0
  81. package/patterns/bleed.d.ts +9 -10
  82. package/patterns/bleed.js +30 -0
  83. package/patterns/box.d.ts +8 -11
  84. package/patterns/box.js +16 -0
  85. package/patterns/center.d.ts +8 -9
  86. package/patterns/center.js +22 -0
  87. package/patterns/circle.d.ts +8 -9
  88. package/patterns/circle.js +26 -0
  89. package/patterns/container.d.ts +8 -11
  90. package/patterns/container.js +26 -0
  91. package/patterns/cq.d.ts +10 -10
  92. package/patterns/cq.js +24 -0
  93. package/patterns/divider.d.ts +11 -11
  94. package/patterns/divider.js +31 -0
  95. package/patterns/flex.d.ts +14 -15
  96. package/patterns/flex.js +27 -0
  97. package/patterns/float.d.ts +12 -12
  98. package/patterns/float.js +78 -0
  99. package/patterns/grid-item.d.ts +13 -14
  100. package/patterns/grid-item.js +26 -0
  101. package/patterns/grid.d.ts +13 -13
  102. package/patterns/grid.js +30 -0
  103. package/patterns/hstack.d.ts +9 -10
  104. package/patterns/hstack.js +27 -0
  105. package/patterns/index.d.ts +20 -21
  106. package/patterns/index.js +20 -0
  107. package/patterns/link-overlay.d.ts +8 -11
  108. package/patterns/link-overlay.js +25 -0
  109. package/patterns/runtime.js +25 -0
  110. package/patterns/spacer.d.ts +9 -9
  111. package/patterns/spacer.js +25 -0
  112. package/patterns/square.d.ts +8 -9
  113. package/patterns/square.js +25 -0
  114. package/patterns/stack.d.ts +11 -12
  115. package/patterns/stack.js +30 -0
  116. package/patterns/visually-hidden.d.ts +8 -11
  117. package/patterns/visually-hidden.js +19 -0
  118. package/patterns/vstack.d.ts +9 -10
  119. package/patterns/vstack.js +27 -0
  120. package/patterns/wrap.d.ts +12 -13
  121. package/patterns/wrap.js +26 -0
  122. package/recipes/accordion.d.ts +10 -26
  123. package/recipes/accordion.js +5 -0
  124. package/recipes/action-card.d.ts +9 -26
  125. package/recipes/action-card.js +5 -0
  126. package/recipes/alert.d.ts +10 -28
  127. package/recipes/alert.js +5 -0
  128. package/recipes/app-navigation-language-select.d.ts +12 -34
  129. package/recipes/app-navigation-language-select.js +5 -0
  130. package/recipes/app-navigation.d.ts +10 -28
  131. package/recipes/app-navigation.js +5 -0
  132. package/recipes/avatar-group.d.ts +8 -26
  133. package/recipes/avatar-group.js +5 -0
  134. package/recipes/avatar.d.ts +11 -30
  135. package/recipes/avatar.js +5 -0
  136. package/recipes/breadcrumb.d.ts +9 -24
  137. package/recipes/breadcrumb.js +5 -0
  138. package/recipes/button-filter.d.ts +8 -27
  139. package/recipes/button-filter.js +5 -0
  140. package/recipes/button.d.ts +10 -37
  141. package/recipes/button.js +5 -0
  142. package/recipes/chat-document-message.d.ts +8 -27
  143. package/recipes/chat-document-message.js +5 -0
  144. package/recipes/chat-message.d.ts +10 -33
  145. package/recipes/chat-message.js +5 -0
  146. package/recipes/chat-profile-avatar.d.ts +9 -29
  147. package/recipes/chat-profile-avatar.js +5 -0
  148. package/recipes/chat-text-input.d.ts +8 -27
  149. package/recipes/chat-text-input.js +5 -0
  150. package/recipes/chat.d.ts +9 -26
  151. package/recipes/chat.js +5 -0
  152. package/recipes/checkbox-card.d.ts +10 -26
  153. package/recipes/checkbox-card.js +5 -0
  154. package/recipes/checkbox-group.d.ts +7 -24
  155. package/recipes/checkbox-group.js +5 -0
  156. package/recipes/checkbox.d.ts +10 -26
  157. package/recipes/checkbox.js +5 -0
  158. package/recipes/chip.d.ts +11 -32
  159. package/recipes/chip.js +5 -0
  160. package/recipes/collapsible.d.ts +9 -24
  161. package/recipes/collapsible.js +5 -0
  162. package/recipes/combobox.d.ts +11 -27
  163. package/recipes/combobox.js +5 -0
  164. package/recipes/datepicker.d.ts +9 -24
  165. package/recipes/datepicker.js +5 -0
  166. package/recipes/dialog.d.ts +9 -24
  167. package/recipes/dialog.js +5 -0
  168. package/recipes/drawer.d.ts +10 -26
  169. package/recipes/drawer.js +5 -0
  170. package/recipes/flag.d.ts +8 -26
  171. package/recipes/flag.js +5 -0
  172. package/recipes/form-control.d.ts +8 -27
  173. package/recipes/form-control.js +5 -0
  174. package/recipes/form-helper-text.d.ts +8 -27
  175. package/recipes/form-helper-text.js +5 -0
  176. package/recipes/form-label.d.ts +10 -28
  177. package/recipes/form-label.js +5 -0
  178. package/recipes/heading.d.ts +10 -28
  179. package/recipes/heading.js +5 -0
  180. package/recipes/highlighted-input.d.ts +9 -26
  181. package/recipes/highlighted-input.js +5 -0
  182. package/recipes/icon-button.d.ts +10 -37
  183. package/recipes/icon-button.js +5 -0
  184. package/recipes/icon.d.ts +8 -26
  185. package/recipes/icon.js +5 -0
  186. package/recipes/illustration.d.ts +9 -29
  187. package/recipes/illustration.js +5 -0
  188. package/recipes/index.d.ts +62 -63
  189. package/recipes/index.js +62 -0
  190. package/recipes/input-addon.d.ts +8 -27
  191. package/recipes/input-addon.js +5 -0
  192. package/recipes/input-group.d.ts +8 -27
  193. package/recipes/input-group.js +5 -0
  194. package/recipes/input.d.ts +9 -29
  195. package/recipes/input.js +5 -0
  196. package/recipes/menu.d.ts +10 -26
  197. package/recipes/menu.js +5 -0
  198. package/recipes/mobile-navigation.d.ts +10 -28
  199. package/recipes/mobile-navigation.js +5 -0
  200. package/recipes/pagination.d.ts +9 -26
  201. package/recipes/pagination.js +5 -0
  202. package/recipes/phone-number-input.d.ts +9 -29
  203. package/recipes/phone-number-input.js +5 -0
  204. package/recipes/popover.d.ts +9 -24
  205. package/recipes/popover.js +5 -0
  206. package/recipes/price-tag.d.ts +10 -26
  207. package/recipes/price-tag.js +5 -0
  208. package/recipes/product-card-catalog.d.ts +9 -26
  209. package/recipes/product-card-catalog.js +5 -0
  210. package/recipes/radio-button-group.d.ts +10 -26
  211. package/recipes/radio-button-group.js +5 -0
  212. package/recipes/radio-card-group.d.ts +10 -26
  213. package/recipes/radio-card-group.js +5 -0
  214. package/recipes/radio-group.d.ts +10 -26
  215. package/recipes/radio-group.js +5 -0
  216. package/recipes/runtime.js +133 -0
  217. package/recipes/select-language.d.ts +10 -26
  218. package/recipes/select-language.js +5 -0
  219. package/recipes/select.d.ts +11 -27
  220. package/recipes/select.js +5 -0
  221. package/recipes/status-tag-select.d.ts +11 -30
  222. package/recipes/status-tag-select.js +5 -0
  223. package/recipes/steps.d.ts +9 -24
  224. package/recipes/steps.js +5 -0
  225. package/recipes/switch-card.d.ts +10 -26
  226. package/recipes/switch-card.js +5 -0
  227. package/recipes/switch-recipe.d.ts +10 -26
  228. package/recipes/switch-recipe.js +5 -0
  229. package/recipes/table-container.d.ts +7 -24
  230. package/recipes/table-container.js +5 -0
  231. package/recipes/table-empty-row.d.ts +7 -24
  232. package/recipes/table-empty-row.js +5 -0
  233. package/recipes/table-group-title.d.ts +8 -26
  234. package/recipes/table-group-title.js +5 -0
  235. package/recipes/table.d.ts +9 -24
  236. package/recipes/table.js +5 -0
  237. package/recipes/tabs-chip.d.ts +9 -29
  238. package/recipes/tabs-chip.js +5 -0
  239. package/recipes/tabs.d.ts +11 -30
  240. package/recipes/tabs.js +5 -0
  241. package/recipes/tag.d.ts +11 -32
  242. package/recipes/tag.js +5 -0
  243. package/recipes/text.d.ts +12 -30
  244. package/recipes/text.js +5 -0
  245. package/recipes/textarea.d.ts +7 -24
  246. package/recipes/textarea.js +5 -0
  247. package/recipes/tooltip.d.ts +9 -24
  248. package/recipes/tooltip.js +5 -0
  249. package/tokens/index.d.ts +4 -5
  250. package/tokens/index.js +18 -0
  251. package/types/index.d.ts +6 -8
  252. package/types/jsx.d.ts +37 -28
  253. package/types/pattern.d.ts +18 -70
  254. package/types/recipe.d.ts +58 -150
  255. package/types/register.d.ts +40 -0
  256. package/types/system.d.ts +1816 -0
  257. package/types/tokens.d.ts +72 -0
  258. package/css/conditions.mjs +0 -36
  259. package/css/css.mjs +0 -45
  260. package/css/cva.mjs +0 -87
  261. package/css/index.mjs +0 -4
  262. package/css/sva.mjs +0 -46
  263. package/helpers.mjs +0 -328
  264. package/jsx/aspect-ratio.mjs +0 -14
  265. package/jsx/bleed.mjs +0 -14
  266. package/jsx/box.mjs +0 -14
  267. package/jsx/center.mjs +0 -14
  268. package/jsx/circle.mjs +0 -14
  269. package/jsx/container.mjs +0 -14
  270. package/jsx/cq.mjs +0 -14
  271. package/jsx/create-style-context.d.ts +0 -54
  272. package/jsx/create-style-context.mjs +0 -118
  273. package/jsx/divider.mjs +0 -14
  274. package/jsx/factory-helper.mjs +0 -22
  275. package/jsx/factory.mjs +0 -89
  276. package/jsx/flex.mjs +0 -14
  277. package/jsx/float.mjs +0 -14
  278. package/jsx/grid-item.mjs +0 -14
  279. package/jsx/grid.mjs +0 -14
  280. package/jsx/hstack.mjs +0 -14
  281. package/jsx/index.mjs +0 -23
  282. package/jsx/is-valid-prop.mjs +0 -17
  283. package/jsx/link-overlay.mjs +0 -14
  284. package/jsx/spacer.mjs +0 -14
  285. package/jsx/square.mjs +0 -14
  286. package/jsx/stack.mjs +0 -14
  287. package/jsx/visually-hidden.mjs +0 -14
  288. package/jsx/vstack.mjs +0 -14
  289. package/jsx/wrap.mjs +0 -14
  290. package/panda.buildinfo.json +0 -471
  291. package/patterns/aspect-ratio.mjs +0 -38
  292. package/patterns/bleed.mjs +0 -24
  293. package/patterns/box.mjs +0 -15
  294. package/patterns/center.mjs +0 -21
  295. package/patterns/circle.mjs +0 -25
  296. package/patterns/container.mjs +0 -21
  297. package/patterns/cq.mjs +0 -21
  298. package/patterns/divider.mjs +0 -25
  299. package/patterns/flex.mjs +0 -26
  300. package/patterns/float.mjs +0 -52
  301. package/patterns/grid-item.mjs +0 -25
  302. package/patterns/grid.mjs +0 -27
  303. package/patterns/hstack.mjs +0 -24
  304. package/patterns/index.mjs +0 -20
  305. package/patterns/link-overlay.mjs +0 -24
  306. package/patterns/spacer.mjs +0 -25
  307. package/patterns/square.mjs +0 -24
  308. package/patterns/stack.mjs +0 -24
  309. package/patterns/visually-hidden.mjs +0 -18
  310. package/patterns/vstack.mjs +0 -24
  311. package/patterns/wrap.mjs +0 -25
  312. package/recipes/accordion.mjs +0 -57
  313. package/recipes/action-card.mjs +0 -45
  314. package/recipes/alert.mjs +0 -57
  315. package/recipes/app-navigation-language-select.mjs +0 -109
  316. package/recipes/app-navigation.mjs +0 -84
  317. package/recipes/avatar-group.mjs +0 -32
  318. package/recipes/avatar.mjs +0 -57
  319. package/recipes/breadcrumb.mjs +0 -45
  320. package/recipes/button-filter.mjs +0 -24
  321. package/recipes/button.mjs +0 -212
  322. package/recipes/chat-document-message.mjs +0 -24
  323. package/recipes/chat-message.mjs +0 -36
  324. package/recipes/chat-profile-avatar.mjs +0 -31
  325. package/recipes/chat-text-input.mjs +0 -24
  326. package/recipes/chat.mjs +0 -45
  327. package/recipes/checkbox-card.mjs +0 -73
  328. package/recipes/checkbox-group.mjs +0 -24
  329. package/recipes/checkbox.mjs +0 -57
  330. package/recipes/chip.mjs +0 -76
  331. package/recipes/collapsible.mjs +0 -45
  332. package/recipes/combobox.mjs +0 -101
  333. package/recipes/create-recipe.mjs +0 -82
  334. package/recipes/datepicker.mjs +0 -133
  335. package/recipes/dialog.mjs +0 -69
  336. package/recipes/drawer.mjs +0 -78
  337. package/recipes/flag.mjs +0 -33
  338. package/recipes/form-control.mjs +0 -24
  339. package/recipes/form-helper-text.mjs +0 -24
  340. package/recipes/form-label.mjs +0 -50
  341. package/recipes/heading.mjs +0 -41
  342. package/recipes/highlighted-input.mjs +0 -45
  343. package/recipes/icon-button.mjs +0 -233
  344. package/recipes/icon.mjs +0 -34
  345. package/recipes/illustration.mjs +0 -37
  346. package/recipes/index.mjs +0 -62
  347. package/recipes/input-addon.mjs +0 -24
  348. package/recipes/input-group.mjs +0 -24
  349. package/recipes/input.mjs +0 -30
  350. package/recipes/menu.mjs +0 -93
  351. package/recipes/mobile-navigation.mjs +0 -56
  352. package/recipes/pagination.mjs +0 -41
  353. package/recipes/phone-number-input.mjs +0 -30
  354. package/recipes/popover.mjs +0 -69
  355. package/recipes/price-tag.mjs +0 -51
  356. package/recipes/product-card-catalog.mjs +0 -73
  357. package/recipes/radio-button-group.mjs +0 -62
  358. package/recipes/radio-card-group.mjs +0 -77
  359. package/recipes/radio-group.mjs +0 -61
  360. package/recipes/select-language.mjs +0 -98
  361. package/recipes/select.mjs +0 -101
  362. package/recipes/status-tag-select.mjs +0 -108
  363. package/recipes/steps.mjs +0 -69
  364. package/recipes/switch-card.mjs +0 -69
  365. package/recipes/switch-recipe.mjs +0 -53
  366. package/recipes/table-container.mjs +0 -24
  367. package/recipes/table-empty-row.mjs +0 -24
  368. package/recipes/table-group-title.mjs +0 -32
  369. package/recipes/table.mjs +0 -61
  370. package/recipes/tabs-chip.mjs +0 -35
  371. package/recipes/tabs.mjs +0 -63
  372. package/recipes/tag.mjs +0 -57
  373. package/recipes/text.mjs +0 -41
  374. package/recipes/textarea.mjs +0 -24
  375. package/recipes/tooltip.mjs +0 -49
  376. package/tokens/index.mjs +0 -1728
  377. package/tokens/tokens.d.ts +0 -63
  378. package/types/composition.d.ts +0 -227
  379. package/types/conditions.d.ts +0 -300
  380. package/types/csstype.d.ts +0 -22570
  381. package/types/global.d.ts +0 -20
  382. package/types/parts.d.ts +0 -8
  383. package/types/prop-type.d.ts +0 -251
  384. package/types/selectors.d.ts +0 -59
  385. package/types/static-css.d.ts +0 -56
  386. package/types/style-props.d.ts +0 -8089
  387. package/types/system-types.d.ts +0 -151
@@ -0,0 +1,72 @@
1
+ import type { Registered } from './register.js';
2
+
3
+ export type AnimationToken = Registered<"AnimationToken", "backdrop-in" | "backdrop-out" | "bounce" | "collapse-in" | "collapse-out" | "dialog-in" | "dialog-out" | "drawer-in-left" | "drawer-in-right" | "drawer-out-left" | "drawer-out-right" | "fade-in" | "ping" | "pulse" | "skeleton-pulse" | "spin">
4
+
5
+ export type AspectRatioToken = Registered<"AspectRatioToken", "golden" | "landscape" | "portrait" | "square" | "ultrawide" | "wide">
6
+
7
+ export type BlurToken = Registered<"BlurToken", "2xl" | "3xl" | "base" | "lg" | "md" | "sm" | "xl">
8
+
9
+ export type BorderToken = Registered<"BorderToken", "border.none">
10
+
11
+ export type BreakpointToken = Registered<"BreakpointToken", "lg" | "md" | "sm" | "xl">
12
+
13
+ export type ColorToken = Registered<"ColorToken", "black" | "blue.100" | "blue.200" | "blue.300" | "blue.400" | "blue.500" | "blue.600" | "blue.700" | "blue.800" | "blue.900" | "colorPalette" | "colorPalette.10" | "colorPalette.100" | "colorPalette.200" | "colorPalette.300" | "colorPalette.400" | "colorPalette.50" | "colorPalette.500" | "colorPalette.600" | "colorPalette.700" | "colorPalette.800" | "colorPalette.900" | "colorPalette.aromatic.dark" | "colorPalette.aromatic.light" | "colorPalette.aromatic.mid" | "colorPalette.blue.dark" | "colorPalette.blue.light" | "colorPalette.blue.mid" | "colorPalette.brown.dark" | "colorPalette.brown.light" | "colorPalette.brown.mid" | "colorPalette.cereal.dark" | "colorPalette.cereal.light" | "colorPalette.cereal.mid" | "colorPalette.dark" | "colorPalette.disabled" | "colorPalette.fish.dark" | "colorPalette.fish.light" | "colorPalette.fish.mid" | "colorPalette.fruit.dark" | "colorPalette.fruit.light" | "colorPalette.fruit.mid" | "colorPalette.green.dark" | "colorPalette.green.light" | "colorPalette.green.mid" | "colorPalette.heading" | "colorPalette.light" | "colorPalette.meat.dark" | "colorPalette.meat.light" | "colorPalette.meat.mid" | "colorPalette.mid" | "colorPalette.oil.dark" | "colorPalette.oil.light" | "colorPalette.oil.mid" | "colorPalette.purple.dark" | "colorPalette.purple.light" | "colorPalette.purple.mid" | "colorPalette.red.dark" | "colorPalette.red.light" | "colorPalette.red.mid" | "colorPalette.vegetable.dark" | "colorPalette.vegetable.light" | "colorPalette.vegetable.mid" | "colorPalette.yellow.dark" | "colorPalette.yellow.light" | "colorPalette.yellow.mid" | "current" | "decorative.blue.dark" | "decorative.blue.light" | "decorative.blue.mid" | "decorative.brown.dark" | "decorative.brown.light" | "decorative.brown.mid" | "decorative.green.dark" | "decorative.green.light" | "decorative.green.mid" | "decorative.purple.dark" | "decorative.purple.light" | "decorative.purple.mid" | "decorative.red.dark" | "decorative.red.light" | "decorative.red.mid" | "decorative.yellow.dark" | "decorative.yellow.light" | "decorative.yellow.mid" | "error.100" | "error.200" | "error.300" | "error.400" | "error.500" | "error.600" | "error.700" | "error.800" | "error.900" | "green.100" | "green.200" | "green.300" | "green.400" | "green.500" | "green.600" | "green.700" | "green.800" | "green.900" | "grey.10" | "grey.100" | "grey.200" | "grey.300" | "grey.400" | "grey.50" | "grey.500" | "grey.600" | "grey.700" | "grey.800" | "grey.900" | "primary.100" | "primary.200" | "primary.300" | "primary.400" | "primary.500" | "primary.600" | "primary.700" | "primary.800" | "primary.900" | "purple.100" | "purple.200" | "purple.300" | "purple.400" | "purple.500" | "purple.600" | "purple.700" | "purple.800" | "purple.900" | "red.100" | "red.200" | "red.300" | "red.400" | "red.500" | "red.600" | "red.700" | "red.800" | "red.900" | "secondary.100" | "secondary.200" | "secondary.300" | "secondary.400" | "secondary.500" | "secondary.600" | "secondary.700" | "secondary.800" | "secondary.900" | "success.100" | "success.200" | "success.300" | "success.400" | "success.500" | "success.600" | "success.700" | "success.800" | "success.900" | "text" | "text.disabled" | "text.heading" | "transparent" | "typology.aromatic.dark" | "typology.aromatic.light" | "typology.aromatic.mid" | "typology.cereal.dark" | "typology.cereal.light" | "typology.cereal.mid" | "typology.fish.dark" | "typology.fish.light" | "typology.fish.mid" | "typology.fruit.dark" | "typology.fruit.light" | "typology.fruit.mid" | "typology.meat.dark" | "typology.meat.light" | "typology.meat.mid" | "typology.oil.dark" | "typology.oil.light" | "typology.oil.mid" | "typology.vegetable.dark" | "typology.vegetable.light" | "typology.vegetable.mid" | "warning.100" | "warning.200" | "warning.300" | "warning.400" | "warning.500" | "warning.600" | "warning.700" | "warning.800" | "warning.900" | "white" | "yellow.100" | "yellow.200" | "yellow.300" | "yellow.400" | "yellow.500" | "yellow.600" | "yellow.700" | "yellow.800" | "yellow.900">
14
+
15
+ export type DurationToken = Registered<"DurationToken", "fast" | "faster" | "fastest" | "normal" | "slow" | "slower" | "slowest">
16
+
17
+ export type EasingToken = Registered<"EasingToken", "default" | "ease-bounce-1" | "ease-bounce-2" | "ease-bounce-3" | "ease-bounce-4" | "ease-bounce-5" | "ease-spring-1" | "ease-spring-2" | "ease-spring-3" | "ease-spring-4" | "ease-spring-5" | "emphasized-in" | "emphasized-out" | "in" | "in-out" | "linear" | "out" | "pulse">
18
+
19
+ export type FontSizeToken = Registered<"FontSizeToken", "body.lg" | "body.md" | "body.sm" | "heading.desktop.2xl" | "heading.desktop.lg" | "heading.desktop.md" | "heading.desktop.sm" | "heading.desktop.xs" | "heading.mobile.2xl" | "heading.mobile.lg" | "heading.mobile.md" | "heading.mobile.sm" | "heading.mobile.xs">
20
+
21
+ export type FontWeightToken = Registered<"FontWeightToken", "black" | "bold" | "extrabold" | "extralight" | "light" | "medium" | "normal" | "semibold" | "thin">
22
+
23
+ export type FontToken = Registered<"FontToken", "cabinet" | "mono" | "sans" | "satoshi" | "serif">
24
+
25
+ export type GradientToken = Registered<"GradientToken", "band.night" | "band.quality" | "band.violet">
26
+
27
+ export type LetterSpacingToken = Registered<"LetterSpacingToken", "normal" | "tight" | "tighter" | "wide" | "wider" | "widest">
28
+
29
+ export type RadiusToken = Registered<"RadiusToken", "full" | "radius-0" | "radius-10" | "radius-12" | "radius-16" | "radius-2" | "radius-20" | "radius-24" | "radius-28" | "radius-32" | "radius-36" | "radius-4" | "radius-40" | "radius-44" | "radius-48" | "radius-52" | "radius-56" | "radius-6" | "radius-60" | "radius-64" | "radius-8">
30
+
31
+ export type ShadowToken = Registered<"ShadowToken", "2xl" | "inner" | "lg" | "lift.bar" | "lift.form" | "lift.mock" | "lift.mockNight" | "lift.soft" | "lift.softHover" | "md" | "sm" | "xl" | "xs">
32
+
33
+ export type SizeToken = Registered<"SizeToken", "breakpoint-lg" | "breakpoint-md" | "breakpoint-sm" | "breakpoint-xl" | "fit" | "full" | "max" | "min" | "size-0" | "size-12" | "size-14" | "size-16" | "size-18" | "size-2" | "size-20" | "size-24" | "size-28" | "size-32" | "size-36" | "size-4" | "size-40" | "size-44" | "size-48" | "size-52" | "size-56" | "size-6" | "size-60" | "size-64" | "size-68" | "size-72" | "size-76" | "size-8" | "size-80">
34
+
35
+ export type SpacingToken = Registered<"SpacingToken", "-space-10" | "-space-12" | "-space-14" | "-space-16" | "-space-18" | "-space-2" | "-space-20" | "-space-24" | "-space-28" | "-space-32" | "-space-36" | "-space-4" | "-space-40" | "-space-44" | "-space-48" | "-space-52" | "-space-56" | "-space-6" | "-space-60" | "-space-64" | "-space-68" | "-space-72" | "-space-76" | "-space-8" | "-space-80" | "space-0" | "space-10" | "space-12" | "space-14" | "space-16" | "space-18" | "space-2" | "space-20" | "space-24" | "space-28" | "space-32" | "space-36" | "space-4" | "space-40" | "space-44" | "space-48" | "space-52" | "space-56" | "space-6" | "space-60" | "space-64" | "space-68" | "space-72" | "space-76" | "space-8" | "space-80">
36
+
37
+ export type ZIndexToken = Registered<"ZIndexToken", "banner" | "base" | "docked" | "dropdown" | "hide" | "modal" | "overlay" | "popover" | "skipLink" | "sticky" | "toast" | "tooltip">
38
+
39
+ interface LocalTokens {
40
+ animations: AnimationToken
41
+ aspectRatios: AspectRatioToken
42
+ blurs: BlurToken
43
+ borders: BorderToken
44
+ breakpoints: BreakpointToken
45
+ colors: ColorToken
46
+ durations: DurationToken
47
+ easings: EasingToken
48
+ fontSizes: FontSizeToken
49
+ fontWeights: FontWeightToken
50
+ fonts: FontToken
51
+ gradients: GradientToken
52
+ letterSpacings: LetterSpacingToken
53
+ radii: RadiusToken
54
+ shadows: ShadowToken
55
+ sizes: SizeToken
56
+ spacing: SpacingToken
57
+ zIndex: ZIndexToken
58
+ }
59
+
60
+ export interface Tokens extends Registered<"Tokens", LocalTokens> {}
61
+
62
+ export type Token = Registered<"Token", `animations.${AnimationToken}` | `aspectRatios.${AspectRatioToken}` | `blurs.${BlurToken}` | `borders.${BorderToken}` | `breakpoints.${BreakpointToken}` | `colors.${ColorToken}` | `durations.${DurationToken}` | `easings.${EasingToken}` | `fontSizes.${FontSizeToken}` | `fontWeights.${FontWeightToken}` | `fonts.${FontToken}` | `gradients.${GradientToken}` | `letterSpacings.${LetterSpacingToken}` | `radii.${RadiusToken}` | `shadows.${ShadowToken}` | `sizes.${SizeToken}` | `spacing.${SpacingToken}` | `zIndex.${ZIndexToken}`>
63
+
64
+ export type ColorOpacityModifier = Registered<"ColorOpacityModifier", `${number}`>
65
+
66
+ export type ColorOpacityToken = Registered<"ColorOpacityToken", `colors.${ColorToken}/${ColorOpacityModifier}`>
67
+
68
+ export type TokenPath = Token | ColorOpacityToken
69
+
70
+ export type ColorPalette = Registered<"ColorPalette", "black" | "blue" | "current" | "decorative" | "decorative.blue" | "decorative.brown" | "decorative.green" | "decorative.purple" | "decorative.red" | "decorative.yellow" | "error" | "green" | "grey" | "primary" | "purple" | "red" | "secondary" | "success" | "text" | "transparent" | "typology" | "typology.aromatic" | "typology.cereal" | "typology.fish" | "typology.fruit" | "typology.meat" | "typology.oil" | "typology.vegetable" | "warning" | "white" | "yellow">
71
+
72
+ export type TokenValue<T extends string> = T extends keyof Tokens ? Tokens[T] : never
@@ -1,36 +0,0 @@
1
- import { withoutSpace } from '../helpers.mjs';
2
-
3
- const conditionsStr = "_liveQuoteTheme,_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,_collapsed,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,smToMd,smToLg,smToXl,mdToLg,mdToXl,lgToXl,@/2xl,@/3xl,@/4xl,@/5xl,@/6xl,@/7xl,@/8xl,@/lg,@/md,@/sm,@/xl,@/xs,base"
4
- const conditions = new Set(conditionsStr.split(','))
5
-
6
- const conditionRegex = /^@|&|&$/
7
-
8
- export function isCondition(value){
9
- return conditions.has(value) || conditionRegex.test(value)
10
- }
11
-
12
- const underscoreRegex = /^_/
13
- const conditionsSelectorRegex = /&|@/
14
-
15
- export function finalizeConditions(paths){
16
- return paths.map((path) => {
17
- if (conditions.has(path)){
18
- return path.replace(underscoreRegex, '')
19
- }
20
-
21
- if (conditionsSelectorRegex.test(path)){
22
- return `[${withoutSpace(path.trim())}]`
23
- }
24
-
25
- return path
26
- })}
27
-
28
- export function sortConditions(paths){
29
- return paths.sort((a, b) => {
30
- const aa = isCondition(a)
31
- const bb = isCondition(b)
32
- if (aa && !bb) return 1
33
- if (!aa && bb) return -1
34
- return 0
35
- })
36
- }
package/css/css.mjs DELETED
@@ -1,45 +0,0 @@
1
- import { createCss, createMergeCss, hypenateProperty, withoutSpace } from '../helpers.mjs';
2
- import { sortConditions, finalizeConditions } from './conditions.mjs';
3
-
4
- const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,backgroundLinear:bg-linear/bgLinear,backgroundRadial:bg-radial/bgRadial,backgroundConic:bg-conic/bgConic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor,textStyle:textStyle"
5
-
6
- const classNameByProp = new Map()
7
- const shorthands = new Map()
8
- utilities.split(',').forEach((utility) => {
9
- const [prop, meta] = utility.split(':')
10
- const [className, ...shorthandList] = meta.split('/')
11
- classNameByProp.set(prop, className)
12
- if (shorthandList.length) {
13
- shorthandList.forEach((shorthand) => {
14
- shorthands.set(shorthand === '1' ? className : shorthand, prop)
15
- })
16
- }
17
- })
18
-
19
- const resolveShorthand = (prop) => shorthands.get(prop) || prop
20
-
21
- const context = {
22
-
23
- conditions: {
24
- shift: sortConditions,
25
- finalize: finalizeConditions,
26
- breakpoints: { keys: ["base","sm","md","lg","xl"] }
27
- },
28
- utility: {
29
-
30
- transform: (prop, value) => {
31
- const key = resolveShorthand(prop)
32
- const propKey = classNameByProp.get(key) || hypenateProperty(key)
33
- return { className: `${propKey}_${withoutSpace(value)}` }
34
- },
35
- hasShorthand: true,
36
- toHash: (path, hashFn) => hashFn(path.join(":")),
37
- resolveShorthand: resolveShorthand,
38
- }
39
- }
40
-
41
- const cssFn = createCss(context)
42
- export const css = (...styles) => cssFn(mergeCss(...styles))
43
- css.raw = (...styles) => mergeCss(...styles)
44
-
45
- export const { mergeCss, assignCss } = createMergeCss(context)
package/css/cva.mjs DELETED
@@ -1,87 +0,0 @@
1
- import { compact, mergeProps, memo, splitProps, uniq } from '../helpers.mjs';
2
- import { css, mergeCss } from './css.mjs';
3
-
4
- const defaults = (conf) => ({
5
- base: {},
6
- variants: {},
7
- defaultVariants: {},
8
- compoundVariants: [],
9
- ...conf,
10
- })
11
-
12
- export function cva(config) {
13
- const { base, variants, defaultVariants, compoundVariants } = defaults(config)
14
- const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) })
15
-
16
- function resolve(props = {}) {
17
- const computedVariants = getVariantProps(props)
18
- let variantCss = { ...base }
19
- for (const [key, value] of Object.entries(computedVariants)) {
20
- if (variants[key]?.[value]) {
21
- variantCss = mergeCss(variantCss, variants[key][value])
22
- }
23
- }
24
- const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants)
25
- return mergeCss(variantCss, compoundVariantCss)
26
- }
27
-
28
- function merge(__cva) {
29
- const override = defaults(__cva.config)
30
- const variantKeys = uniq(__cva.variantKeys, Object.keys(variants))
31
- return cva({
32
- base: mergeCss(base, override.base),
33
- variants: Object.fromEntries(
34
- variantKeys.map((key) => [key, mergeCss(variants[key], override.variants[key])]),
35
- ),
36
- defaultVariants: mergeProps(defaultVariants, override.defaultVariants),
37
- compoundVariants: [...compoundVariants, ...override.compoundVariants],
38
- })
39
- }
40
-
41
- function cvaFn(props) {
42
- return css(resolve(props))
43
- }
44
-
45
- const variantKeys = Object.keys(variants)
46
-
47
- function splitVariantProps(props) {
48
- return splitProps(props, variantKeys)
49
- }
50
-
51
- const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
52
-
53
- return Object.assign(memo(cvaFn), {
54
- __cva__: true,
55
- variantMap,
56
- variantKeys,
57
- raw: resolve,
58
- config,
59
- merge,
60
- splitVariantProps,
61
- getVariantProps
62
- })
63
- }
64
-
65
- export function getCompoundVariantCss(compoundVariants, variantMap) {
66
- let result = {}
67
- compoundVariants.forEach((compoundVariant) => {
68
- const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
69
- if (key === 'css') return true
70
-
71
- const values = Array.isArray(value) ? value : [value]
72
- return values.some((value) => variantMap[key] === value)
73
- })
74
-
75
- if (isMatching) {
76
- result = mergeCss(result, compoundVariant.css)
77
- }
78
- })
79
-
80
- return result
81
- }
82
-
83
- export function assertCompoundVariant(name, compoundVariants, variants, prop) {
84
- if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
85
- throw new Error(`[recipe:${name}:${prop}] Conditions are not supported when using compound variants.`)
86
- }
87
- }
package/css/index.mjs DELETED
@@ -1,4 +0,0 @@
1
- export * from './css.mjs';
2
- export * from './cx.mjs';
3
- export * from './cva.mjs';
4
- export * from './sva.mjs';
package/css/sva.mjs DELETED
@@ -1,46 +0,0 @@
1
- import { compact, getSlotRecipes, memo, splitProps } from '../helpers.mjs';
2
- import { cva } from './cva.mjs';
3
- import { cx } from './cx.mjs';
4
-
5
- export function sva(config) {
6
- const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
7
- const defaultVariants = config.defaultVariants ?? {}
8
-
9
- const classNameMap = slots.reduce((acc, [slot, cvaFn]) => {
10
- if (config.className) acc[slot] = cvaFn.config.className
11
- return acc
12
- }, {})
13
-
14
- function svaFn(props) {
15
- const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), classNameMap[slot])])
16
- return Object.fromEntries(result)
17
- }
18
-
19
- function raw(props) {
20
- const result = slots.map(([slot, cvaFn]) => [slot, cvaFn.raw(props)])
21
- return Object.fromEntries(result)
22
- }
23
-
24
- const variants = config.variants ?? {};
25
- const variantKeys = Object.keys(variants);
26
-
27
- function splitVariantProps(props) {
28
- return splitProps(props, variantKeys);
29
- }
30
- const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) })
31
-
32
- const variantMap = Object.fromEntries(
33
- Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
34
- );
35
-
36
- return Object.assign(memo(svaFn), {
37
- __cva__: false,
38
- raw,
39
- config,
40
- variantMap,
41
- variantKeys,
42
- classNameMap,
43
- splitVariantProps,
44
- getVariantProps,
45
- })
46
- }
package/helpers.mjs DELETED
@@ -1,328 +0,0 @@
1
- // src/assert.ts
2
- function isObject(value) {
3
- return typeof value === "object" && value != null && !Array.isArray(value);
4
- }
5
- var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
6
-
7
- // src/compact.ts
8
- function compact(value) {
9
- return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
10
- }
11
-
12
- // src/condition.ts
13
- var isBaseCondition = (v) => v === "base";
14
- function filterBaseConditions(c) {
15
- return c.slice().filter((v) => !isBaseCondition(v));
16
- }
17
-
18
- // src/hash.ts
19
- function toChar(code) {
20
- return String.fromCharCode(code + (code > 25 ? 39 : 97));
21
- }
22
- function toName(code) {
23
- let name = "";
24
- let x;
25
- for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
26
- return toChar(x % 52) + name;
27
- }
28
- function toPhash(h, x) {
29
- let i = x.length;
30
- while (i) h = h * 33 ^ x.charCodeAt(--i);
31
- return h;
32
- }
33
- function toHash(value) {
34
- return toName(toPhash(5381, value) >>> 0);
35
- }
36
-
37
- // src/important.ts
38
- var importantRegex = /\s*!(important)?/i;
39
- function isImportant(value) {
40
- return typeof value === "string" ? importantRegex.test(value) : false;
41
- }
42
- function withoutImportant(value) {
43
- return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
44
- }
45
- function withoutSpace(str) {
46
- return typeof str === "string" ? str.replaceAll(" ", "_") : str;
47
- }
48
-
49
- // src/memo.ts
50
- var memo = (fn) => {
51
- const cache = /* @__PURE__ */ new Map();
52
- const get = (...args) => {
53
- const key = JSON.stringify(args);
54
- if (cache.has(key)) {
55
- return cache.get(key);
56
- }
57
- const result = fn(...args);
58
- cache.set(key, result);
59
- return result;
60
- };
61
- return get;
62
- };
63
-
64
- // src/merge-props.ts
65
- var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
66
- function mergeProps(...sources) {
67
- return sources.reduce((prev, obj) => {
68
- if (!obj) return prev;
69
- Object.keys(obj).forEach((key) => {
70
- if (MERGE_OMIT.has(key)) return;
71
- const prevValue = prev[key];
72
- const value = obj[key];
73
- if (isObject(prevValue) && isObject(value)) {
74
- prev[key] = mergeProps(prevValue, value);
75
- } else {
76
- prev[key] = value;
77
- }
78
- });
79
- return prev;
80
- }, {});
81
- }
82
-
83
- // src/walk-object.ts
84
- var isNotNullish = (element) => element != null;
85
- function walkObject(target, predicate, options = {}) {
86
- const { stop, getKey } = options;
87
- function inner(value, path = []) {
88
- if (isObjectOrArray(value)) {
89
- const result = {};
90
- for (const [prop, child] of Object.entries(value)) {
91
- const key = getKey?.(prop, child) ?? prop;
92
- const childPath = [...path, key];
93
- if (stop?.(value, childPath)) {
94
- return predicate(value, path);
95
- }
96
- const next = inner(child, childPath);
97
- if (isNotNullish(next)) {
98
- result[key] = next;
99
- }
100
- }
101
- return result;
102
- }
103
- return predicate(value, path);
104
- }
105
- return inner(target);
106
- }
107
- function mapObject(obj, fn) {
108
- if (Array.isArray(obj)) return obj.map((value) => fn(value));
109
- if (!isObject(obj)) return fn(obj);
110
- return walkObject(obj, (value) => fn(value));
111
- }
112
-
113
- // src/normalize-style-object.ts
114
- function toResponsiveObject(values, breakpoints) {
115
- return values.reduce(
116
- (acc, current, index) => {
117
- const key = breakpoints[index];
118
- if (current != null) {
119
- acc[key] = current;
120
- }
121
- return acc;
122
- },
123
- {}
124
- );
125
- }
126
- function normalizeStyleObject(styles, context, shorthand = true) {
127
- const { utility, conditions } = context;
128
- const { hasShorthand, resolveShorthand } = utility;
129
- return walkObject(
130
- styles,
131
- (value) => {
132
- return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;
133
- },
134
- {
135
- stop: (value) => Array.isArray(value),
136
- getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
137
- }
138
- );
139
- }
140
-
141
- // src/classname.ts
142
- var fallbackCondition = {
143
- shift: (v) => v,
144
- finalize: (v) => v,
145
- breakpoints: { keys: [] }
146
- };
147
- var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
148
- function createCss(context) {
149
- const { utility, hash, conditions: conds = fallbackCondition } = context;
150
- const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
151
- const hashFn = (conditions, className) => {
152
- let result;
153
- if (hash) {
154
- const baseArray = [...conds.finalize(conditions), className];
155
- result = formatClassName(utility.toHash(baseArray, toHash));
156
- } else {
157
- const baseArray = [...conds.finalize(conditions), formatClassName(className)];
158
- result = baseArray.join(":");
159
- }
160
- return result;
161
- };
162
- return memo(({ base, ...styles } = {}) => {
163
- const styleObject = Object.assign(styles, base);
164
- const normalizedObject = normalizeStyleObject(styleObject, context);
165
- const classNames = /* @__PURE__ */ new Set();
166
- walkObject(normalizedObject, (value, paths) => {
167
- if (value == null) return;
168
- const important = isImportant(value);
169
- const [prop, ...allConditions] = conds.shift(paths);
170
- const conditions = filterBaseConditions(allConditions);
171
- const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
172
- let className = hashFn(conditions, transformed.className);
173
- if (important) className = `${className}!`;
174
- classNames.add(className);
175
- });
176
- return Array.from(classNames).join(" ");
177
- });
178
- }
179
- function compactStyles(...styles) {
180
- return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
181
- }
182
- function createMergeCss(context) {
183
- function resolve(styles) {
184
- const allStyles = compactStyles(...styles);
185
- if (allStyles.length === 1) return allStyles;
186
- return allStyles.map((style) => normalizeStyleObject(style, context));
187
- }
188
- function mergeCss(...styles) {
189
- return mergeProps(...resolve(styles));
190
- }
191
- function assignCss(...styles) {
192
- return Object.assign({}, ...resolve(styles));
193
- }
194
- return { mergeCss: memo(mergeCss), assignCss };
195
- }
196
-
197
- // src/hypenate-property.ts
198
- var wordRegex = /([A-Z])/g;
199
- var msRegex = /^ms-/;
200
- var hypenateProperty = memo((property) => {
201
- if (property.startsWith("--")) return property;
202
- return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
203
- });
204
-
205
- // src/is-css-function.ts
206
- var fns = ["min", "max", "clamp", "calc"];
207
- var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
208
- var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
209
-
210
- // src/is-css-unit.ts
211
- var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
212
- var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
213
- var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
214
- var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
215
-
216
- // src/is-css-var.ts
217
- var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
218
-
219
- // src/pattern-fns.ts
220
- var patternFns = {
221
- map: mapObject,
222
- isCssFunction,
223
- isCssVar,
224
- isCssUnit
225
- };
226
- var getPatternStyles = (pattern, styles) => {
227
- if (!pattern?.defaultValues) return styles;
228
- const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
229
- return Object.assign({}, defaults, compact(styles));
230
- };
231
-
232
- // src/slot.ts
233
- var getSlotRecipes = (recipe = {}) => {
234
- const init = (slot) => ({
235
- className: [recipe.className, slot].filter(Boolean).join("__"),
236
- base: recipe.base?.[slot] ?? {},
237
- variants: {},
238
- defaultVariants: recipe.defaultVariants ?? {},
239
- compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
240
- });
241
- const slots = recipe.slots ?? [];
242
- const recipeParts = slots.map((slot) => [slot, init(slot)]);
243
- for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {
244
- for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {
245
- recipeParts.forEach(([slot, slotRecipe]) => {
246
- slotRecipe.variants[variantsKey] ??= {};
247
- slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
248
- });
249
- }
250
- }
251
- return Object.fromEntries(recipeParts);
252
- };
253
- var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
254
-
255
- // src/split-props.ts
256
- function splitProps(props, ...keys) {
257
- const descriptors = Object.getOwnPropertyDescriptors(props);
258
- const dKeys = Object.keys(descriptors);
259
- const split = (k) => {
260
- const clone = {};
261
- for (let i = 0; i < k.length; i++) {
262
- const key = k[i];
263
- if (descriptors[key]) {
264
- Object.defineProperty(clone, key, descriptors[key]);
265
- delete descriptors[key];
266
- }
267
- }
268
- return clone;
269
- };
270
- const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
271
- return keys.map(fn).concat(split(dKeys));
272
- }
273
-
274
- // src/uniq.ts
275
- var uniq = (...items) => {
276
- const set = items.reduce((acc, currItems) => {
277
- if (currItems) {
278
- currItems.forEach((item) => acc.add(item));
279
- }
280
- return acc;
281
- }, /* @__PURE__ */ new Set([]));
282
- return Array.from(set);
283
- };
284
- export {
285
- compact,
286
- createCss,
287
- createMergeCss,
288
- filterBaseConditions,
289
- getPatternStyles,
290
- getSlotCompoundVariant,
291
- getSlotRecipes,
292
- hypenateProperty,
293
- isBaseCondition,
294
- isObject,
295
- mapObject,
296
- memo,
297
- mergeProps,
298
- patternFns,
299
- splitProps,
300
- toHash,
301
- uniq,
302
- walkObject,
303
- withoutSpace
304
- };
305
-
306
-
307
-
308
- // src/normalize-html.ts
309
- var htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];
310
- function convert(key) {
311
- return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;
312
- }
313
- function normalizeHTMLProps(props) {
314
- return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));
315
- }
316
- normalizeHTMLProps.keys = htmlProps;
317
- export {
318
- normalizeHTMLProps
319
- };
320
-
321
-
322
- export function __spreadValues(a, b) {
323
- return { ...a, ...b }
324
- }
325
-
326
- export function __objRest(source, exclude) {
327
- return Object.fromEntries(Object.entries(source).filter(([key]) => !exclude.includes(key)))
328
- }
@@ -1,14 +0,0 @@
1
- import { createElement, forwardRef } from 'react'
2
-
3
- import { splitProps } from '../helpers.mjs';
4
- import { getAspectRatioStyle } from '../patterns/aspect-ratio.mjs';
5
- import { styled } from './factory.mjs';
6
-
7
- export const AspectRatio = /* @__PURE__ */ forwardRef(function AspectRatio(props, ref) {
8
- const [patternProps, restProps] = splitProps(props, ["ratio"])
9
-
10
- const styleProps = getAspectRatioStyle(patternProps)
11
- const mergedProps = { ref, ...styleProps, ...restProps }
12
-
13
- return createElement(styled.div, mergedProps)
14
- })