@tenphi/tasty 0.0.0-snapshot.c8bdaeb → 0.0.0-snapshot.c8c7b2a

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 (318) hide show
  1. package/README.md +309 -159
  2. package/dist/_virtual/_rolldown/runtime.js +1 -2
  3. package/dist/chunks/cacheKey.d.ts +1 -0
  4. package/dist/chunks/cacheKey.js +17 -10
  5. package/dist/chunks/cacheKey.js.map +1 -1
  6. package/dist/chunks/definitions.d.ts +1 -1
  7. package/dist/chunks/definitions.js +3 -5
  8. package/dist/chunks/definitions.js.map +1 -1
  9. package/dist/chunks/index.d.ts +1 -0
  10. package/dist/chunks/renderChunk.d.ts +1 -0
  11. package/dist/chunks/renderChunk.js +32 -34
  12. package/dist/chunks/renderChunk.js.map +1 -1
  13. package/dist/compute-styles.d.ts +31 -0
  14. package/dist/compute-styles.js +322 -0
  15. package/dist/compute-styles.js.map +1 -0
  16. package/dist/config.d.ts +157 -30
  17. package/dist/config.js +233 -45
  18. package/dist/config.js.map +1 -1
  19. package/dist/core/index.d.ts +12 -11
  20. package/dist/core/index.js +12 -11
  21. package/dist/counter-style/index.js +51 -0
  22. package/dist/counter-style/index.js.map +1 -0
  23. package/dist/debug.d.ts +26 -141
  24. package/dist/debug.js +359 -639
  25. package/dist/debug.js.map +1 -1
  26. package/dist/font-face/index.js +63 -0
  27. package/dist/font-face/index.js.map +1 -0
  28. package/dist/hooks/index.d.ts +7 -0
  29. package/dist/hooks/useCounterStyle.d.ts +36 -0
  30. package/dist/hooks/useCounterStyle.js +65 -0
  31. package/dist/hooks/useCounterStyle.js.map +1 -0
  32. package/dist/hooks/useFontFace.d.ts +45 -0
  33. package/dist/hooks/useFontFace.js +66 -0
  34. package/dist/hooks/useFontFace.js.map +1 -0
  35. package/dist/hooks/useGlobalStyles.d.ts +21 -2
  36. package/dist/hooks/useGlobalStyles.js +60 -28
  37. package/dist/hooks/useGlobalStyles.js.map +1 -1
  38. package/dist/hooks/useKeyframes.d.ts +4 -2
  39. package/dist/hooks/useKeyframes.js +44 -43
  40. package/dist/hooks/useKeyframes.js.map +1 -1
  41. package/dist/hooks/useProperty.d.ts +4 -2
  42. package/dist/hooks/useProperty.js +36 -31
  43. package/dist/hooks/useProperty.js.map +1 -1
  44. package/dist/hooks/useRawCSS.d.ts +13 -44
  45. package/dist/hooks/useRawCSS.js +91 -16
  46. package/dist/hooks/useRawCSS.js.map +1 -1
  47. package/dist/hooks/useStyles.d.ts +3 -3
  48. package/dist/hooks/useStyles.js +8 -146
  49. package/dist/hooks/useStyles.js.map +1 -1
  50. package/dist/index.d.ts +15 -12
  51. package/dist/index.js +15 -12
  52. package/dist/injector/index.d.ts +36 -11
  53. package/dist/injector/index.js +43 -12
  54. package/dist/injector/index.js.map +1 -1
  55. package/dist/injector/injector.d.ts +62 -3
  56. package/dist/injector/injector.js +293 -46
  57. package/dist/injector/injector.js.map +1 -1
  58. package/dist/injector/sheet-manager.d.ts +22 -17
  59. package/dist/injector/sheet-manager.js +64 -79
  60. package/dist/injector/sheet-manager.js.map +1 -1
  61. package/dist/injector/types.d.ts +121 -21
  62. package/dist/keyframes/index.js +1 -1
  63. package/dist/parser/classify.js +6 -6
  64. package/dist/parser/classify.js.map +1 -1
  65. package/dist/parser/const.js +30 -3
  66. package/dist/parser/const.js.map +1 -1
  67. package/dist/parser/lru.js +1 -1
  68. package/dist/parser/lru.js.map +1 -1
  69. package/dist/parser/parser.js +2 -3
  70. package/dist/parser/parser.js.map +1 -1
  71. package/dist/parser/tokenizer.js +1 -1
  72. package/dist/parser/tokenizer.js.map +1 -1
  73. package/dist/parser/types.js +1 -1
  74. package/dist/parser/types.js.map +1 -1
  75. package/dist/pipeline/conditions.js +1 -1
  76. package/dist/pipeline/conditions.js.map +1 -1
  77. package/dist/pipeline/exclusive.js +58 -4
  78. package/dist/pipeline/exclusive.js.map +1 -1
  79. package/dist/pipeline/index.d.ts +3 -1
  80. package/dist/pipeline/index.js +82 -34
  81. package/dist/pipeline/index.js.map +1 -1
  82. package/dist/pipeline/materialize.js +436 -123
  83. package/dist/pipeline/materialize.js.map +1 -1
  84. package/dist/pipeline/parseStateKey.d.ts +1 -1
  85. package/dist/pipeline/parseStateKey.js +21 -13
  86. package/dist/pipeline/parseStateKey.js.map +1 -1
  87. package/dist/pipeline/simplify.js +181 -7
  88. package/dist/pipeline/simplify.js.map +1 -1
  89. package/dist/pipeline/warnings.js +1 -1
  90. package/dist/plugins/index.d.ts +2 -0
  91. package/dist/plugins/okhsl-plugin.js +3 -277
  92. package/dist/plugins/okhsl-plugin.js.map +1 -1
  93. package/dist/plugins/types.d.ts +20 -2
  94. package/dist/properties/index.js +83 -19
  95. package/dist/properties/index.js.map +1 -1
  96. package/dist/properties/property-type-resolver.d.ts +24 -0
  97. package/dist/properties/property-type-resolver.js +90 -0
  98. package/dist/properties/property-type-resolver.js.map +1 -0
  99. package/dist/rsc-cache.js +79 -0
  100. package/dist/rsc-cache.js.map +1 -0
  101. package/dist/ssr/astro-client.d.ts +1 -0
  102. package/dist/ssr/astro-client.js +19 -0
  103. package/dist/ssr/astro-client.js.map +1 -0
  104. package/dist/ssr/astro-middleware.d.ts +15 -0
  105. package/dist/ssr/astro-middleware.js +19 -0
  106. package/dist/ssr/astro-middleware.js.map +1 -0
  107. package/dist/ssr/astro.d.ts +108 -0
  108. package/dist/ssr/astro.js +149 -0
  109. package/dist/ssr/astro.js.map +1 -0
  110. package/dist/ssr/async-storage.d.ts +17 -0
  111. package/dist/ssr/async-storage.js +44 -0
  112. package/dist/ssr/async-storage.js.map +1 -0
  113. package/dist/ssr/collect-auto-properties.js +58 -0
  114. package/dist/ssr/collect-auto-properties.js.map +1 -0
  115. package/dist/ssr/collector.d.ts +98 -0
  116. package/dist/ssr/collector.js +235 -0
  117. package/dist/ssr/collector.js.map +1 -0
  118. package/dist/ssr/context.js +16 -0
  119. package/dist/ssr/context.js.map +1 -0
  120. package/dist/ssr/format-global-rules.js +22 -0
  121. package/dist/ssr/format-global-rules.js.map +1 -0
  122. package/dist/ssr/format-keyframes.js +69 -0
  123. package/dist/ssr/format-keyframes.js.map +1 -0
  124. package/dist/ssr/format-property.js +49 -0
  125. package/dist/ssr/format-property.js.map +1 -0
  126. package/dist/ssr/format-rules.js +73 -0
  127. package/dist/ssr/format-rules.js.map +1 -0
  128. package/dist/ssr/hydrate.d.ts +29 -0
  129. package/dist/ssr/hydrate.js +45 -0
  130. package/dist/ssr/hydrate.js.map +1 -0
  131. package/dist/ssr/index.d.ts +4 -0
  132. package/dist/ssr/index.js +10 -0
  133. package/dist/ssr/index.js.map +1 -0
  134. package/dist/ssr/next.d.ts +46 -0
  135. package/dist/ssr/next.js +75 -0
  136. package/dist/ssr/next.js.map +1 -0
  137. package/dist/ssr/ssr-collector-ref.js +29 -0
  138. package/dist/ssr/ssr-collector-ref.js.map +1 -0
  139. package/dist/states/index.js +13 -259
  140. package/dist/states/index.js.map +1 -1
  141. package/dist/static/index.js +1 -2
  142. package/dist/static/inject.d.ts +5 -0
  143. package/dist/static/inject.js +17 -0
  144. package/dist/static/inject.js.map +1 -0
  145. package/dist/static/tastyStatic.js +1 -2
  146. package/dist/static/tastyStatic.js.map +1 -1
  147. package/dist/static/types.js +1 -1
  148. package/dist/styles/border.d.ts +1 -1
  149. package/dist/styles/border.js +30 -24
  150. package/dist/styles/border.js.map +1 -1
  151. package/dist/styles/color.d.ts +1 -1
  152. package/dist/styles/color.js +11 -8
  153. package/dist/styles/color.js.map +1 -1
  154. package/dist/styles/const.js +17 -0
  155. package/dist/styles/const.js.map +1 -0
  156. package/dist/styles/createStyle.js +28 -26
  157. package/dist/styles/createStyle.js.map +1 -1
  158. package/dist/styles/dimension.js +15 -3
  159. package/dist/styles/dimension.js.map +1 -1
  160. package/dist/styles/directional.js +133 -0
  161. package/dist/styles/directional.js.map +1 -0
  162. package/dist/styles/display.d.ts +3 -10
  163. package/dist/styles/display.js +45 -39
  164. package/dist/styles/display.js.map +1 -1
  165. package/dist/styles/fade.d.ts +1 -1
  166. package/dist/styles/fade.js +9 -5
  167. package/dist/styles/fade.js.map +1 -1
  168. package/dist/styles/fill.d.ts +2 -2
  169. package/dist/styles/fill.js +9 -9
  170. package/dist/styles/fill.js.map +1 -1
  171. package/dist/styles/flow.js +1 -1
  172. package/dist/styles/gap.d.ts +1 -1
  173. package/dist/styles/gap.js +4 -3
  174. package/dist/styles/gap.js.map +1 -1
  175. package/dist/styles/height.d.ts +1 -1
  176. package/dist/styles/height.js +1 -2
  177. package/dist/styles/height.js.map +1 -1
  178. package/dist/styles/index.d.ts +0 -1
  179. package/dist/styles/index.js +3 -4
  180. package/dist/styles/index.js.map +1 -1
  181. package/dist/styles/inset.d.ts +1 -29
  182. package/dist/styles/inset.js +19 -135
  183. package/dist/styles/inset.js.map +1 -1
  184. package/dist/styles/list.d.ts +5 -5
  185. package/dist/styles/list.js +4 -2
  186. package/dist/styles/list.js.map +1 -1
  187. package/dist/styles/margin.d.ts +1 -1
  188. package/dist/styles/margin.js +17 -89
  189. package/dist/styles/margin.js.map +1 -1
  190. package/dist/styles/outline.d.ts +1 -1
  191. package/dist/styles/outline.js +6 -16
  192. package/dist/styles/outline.js.map +1 -1
  193. package/dist/styles/padding.d.ts +1 -1
  194. package/dist/styles/padding.js +17 -89
  195. package/dist/styles/padding.js.map +1 -1
  196. package/dist/styles/placement.d.ts +37 -0
  197. package/dist/styles/placement.js +74 -0
  198. package/dist/styles/placement.js.map +1 -0
  199. package/dist/styles/predefined.d.ts +4 -6
  200. package/dist/styles/predefined.js +9 -13
  201. package/dist/styles/predefined.js.map +1 -1
  202. package/dist/styles/preset.d.ts +6 -1
  203. package/dist/styles/preset.js +54 -53
  204. package/dist/styles/preset.js.map +1 -1
  205. package/dist/styles/radius.d.ts +1 -3
  206. package/dist/styles/radius.js +38 -6
  207. package/dist/styles/radius.js.map +1 -1
  208. package/dist/styles/scrollMargin.d.ts +24 -0
  209. package/dist/styles/scrollMargin.js +32 -0
  210. package/dist/styles/scrollMargin.js.map +1 -0
  211. package/dist/styles/scrollbar.d.ts +9 -5
  212. package/dist/styles/scrollbar.js +31 -92
  213. package/dist/styles/scrollbar.js.map +1 -1
  214. package/dist/styles/shadow.d.ts +1 -1
  215. package/dist/styles/shadow.js +4 -3
  216. package/dist/styles/shadow.js.map +1 -1
  217. package/dist/styles/shared.js +17 -0
  218. package/dist/styles/shared.js.map +1 -0
  219. package/dist/styles/transition.d.ts +1 -1
  220. package/dist/styles/transition.js +6 -5
  221. package/dist/styles/transition.js.map +1 -1
  222. package/dist/styles/types.d.ts +94 -28
  223. package/dist/styles/width.d.ts +1 -1
  224. package/dist/styles/width.js +1 -2
  225. package/dist/styles/width.js.map +1 -1
  226. package/dist/tasty.d.ts +46 -894
  227. package/dist/tasty.js +101 -59
  228. package/dist/tasty.js.map +1 -1
  229. package/dist/types.d.ts +1 -1
  230. package/dist/utils/cache-wrapper.js +4 -9
  231. package/dist/utils/cache-wrapper.js.map +1 -1
  232. package/dist/utils/case-converter.js +1 -1
  233. package/dist/utils/color-math.d.ts +46 -0
  234. package/dist/utils/color-math.js +749 -0
  235. package/dist/utils/color-math.js.map +1 -0
  236. package/dist/utils/color-space.d.ts +5 -0
  237. package/dist/utils/color-space.js +228 -0
  238. package/dist/utils/color-space.js.map +1 -0
  239. package/dist/utils/colors.js +3 -2
  240. package/dist/utils/colors.js.map +1 -1
  241. package/dist/utils/deps-equal.js +15 -0
  242. package/dist/utils/deps-equal.js.map +1 -0
  243. package/dist/utils/dotize.js +1 -1
  244. package/dist/utils/dotize.js.map +1 -1
  245. package/dist/utils/filter-base-props.d.ts +1 -1
  246. package/dist/utils/filter-base-props.js +1 -1
  247. package/dist/utils/filter-base-props.js.map +1 -1
  248. package/dist/utils/get-display-name.js +1 -1
  249. package/dist/utils/has-keys.js +13 -0
  250. package/dist/utils/has-keys.js.map +1 -0
  251. package/dist/utils/hash.js +14 -0
  252. package/dist/utils/hash.js.map +1 -0
  253. package/dist/utils/is-dev-env.js +1 -1
  254. package/dist/utils/is-dev-env.js.map +1 -1
  255. package/dist/utils/is-valid-element-type.js +1 -1
  256. package/dist/utils/merge-styles.js +1 -2
  257. package/dist/utils/merge-styles.js.map +1 -1
  258. package/dist/utils/mod-attrs.d.ts +0 -2
  259. package/dist/utils/mod-attrs.js +3 -4
  260. package/dist/utils/mod-attrs.js.map +1 -1
  261. package/dist/utils/process-tokens.d.ts +3 -17
  262. package/dist/utils/process-tokens.js +19 -107
  263. package/dist/utils/process-tokens.js.map +1 -1
  264. package/dist/utils/resolve-recipes.js +1 -2
  265. package/dist/utils/resolve-recipes.js.map +1 -1
  266. package/dist/utils/selector-transform.js +32 -0
  267. package/dist/utils/selector-transform.js.map +1 -0
  268. package/dist/utils/string.js +1 -1
  269. package/dist/utils/styles.d.ts +3 -82
  270. package/dist/utils/styles.js +29 -399
  271. package/dist/utils/styles.js.map +1 -1
  272. package/dist/utils/typography.d.ts +35 -13
  273. package/dist/utils/typography.js +16 -18
  274. package/dist/utils/typography.js.map +1 -1
  275. package/dist/utils/warnings.js +1 -1
  276. package/dist/zero/babel.d.ts +57 -84
  277. package/dist/zero/babel.js +217 -37
  278. package/dist/zero/babel.js.map +1 -1
  279. package/dist/zero/css-writer.js +1 -2
  280. package/dist/zero/css-writer.js.map +1 -1
  281. package/dist/zero/extractor.js +119 -3
  282. package/dist/zero/extractor.js.map +1 -1
  283. package/dist/zero/index.js +1 -2
  284. package/dist/zero/next.d.ts +56 -30
  285. package/dist/zero/next.js +105 -40
  286. package/dist/zero/next.js.map +1 -1
  287. package/docs/README.md +31 -0
  288. package/docs/adoption.md +298 -0
  289. package/docs/comparison.md +419 -0
  290. package/docs/configuration.md +394 -0
  291. package/docs/debug.md +320 -0
  292. package/docs/design-system.md +436 -0
  293. package/docs/dsl.md +688 -0
  294. package/docs/getting-started.md +217 -0
  295. package/docs/injector.md +544 -0
  296. package/docs/methodology.md +616 -0
  297. package/docs/pipeline.md +519 -0
  298. package/docs/react-api.md +557 -0
  299. package/docs/ssr.md +442 -0
  300. package/docs/styles.md +596 -0
  301. package/docs/tasty-static.md +532 -0
  302. package/package.json +68 -36
  303. package/dist/styles/align.d.ts +0 -15
  304. package/dist/styles/align.js +0 -14
  305. package/dist/styles/align.js.map +0 -1
  306. package/dist/styles/justify.d.ts +0 -15
  307. package/dist/styles/justify.js +0 -14
  308. package/dist/styles/justify.js.map +0 -1
  309. package/dist/styles/styledScrollbar.d.ts +0 -47
  310. package/dist/styles/styledScrollbar.js +0 -38
  311. package/dist/styles/styledScrollbar.js.map +0 -1
  312. package/dist/tokens/typography.d.ts +0 -19
  313. package/dist/tokens/typography.js +0 -237
  314. package/dist/tokens/typography.js.map +0 -1
  315. package/dist/utils/hsl-to-rgb.js +0 -38
  316. package/dist/utils/hsl-to-rgb.js.map +0 -1
  317. package/dist/utils/okhsl-to-rgb.js +0 -296
  318. package/dist/utils/okhsl-to-rgb.js.map +0 -1
@@ -1,112 +1,51 @@
1
+ import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
1
2
  import { makeEmptyDetails } from "../parser/types.js";
2
3
  import { parseStyle } from "../utils/styles.js";
3
-
4
+ import { warn } from "../utils/warnings.js";
4
5
  //#region src/styles/scrollbar.ts
5
6
  /**
6
- * Creates cross-browser compatible scrollbar styles
7
+ * Standard CSS scrollbar styling via `scrollbar-width`, `scrollbar-color`,
8
+ * and `scrollbar-gutter`.
9
+ *
10
+ * Width values: `thin` (default), `auto`, `none`
11
+ * Modifiers: `stable`, `both-edges`, `always`
7
12
  *
8
- * Supports both Firefox (scrollbar-width, scrollbar-color) and
9
- * WebKit/Chromium browsers (::-webkit-scrollbar)
13
+ * Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands
14
+ * in `values` rather than `mods`. Both locations are checked for robustness.
10
15
  */
11
16
  function scrollbarStyle({ scrollbar, overflow }) {
12
- if (!scrollbar && scrollbar !== 0) return;
13
- const value = scrollbar === true || scrollbar === "" ? "thin" : scrollbar;
14
- const { mods, colors, values } = parseStyle(String(value)).groups[0] ?? makeEmptyDetails();
15
- const style = {};
16
- function getNested(key) {
17
- const v = style[key];
18
- if (v && typeof v === "object") return v;
19
- return {};
20
- }
17
+ if (!scrollbar) return null;
18
+ if (typeof scrollbar === "string" && CSS_WIDE_KEYWORDS.has(scrollbar)) return {
19
+ "scrollbar-width": scrollbar,
20
+ "scrollbar-color": scrollbar
21
+ };
22
+ const { mods, colors, values } = parseStyle(String(scrollbar === true ? "thin" : scrollbar)).groups[0] ?? makeEmptyDetails();
21
23
  const defaultThumbColor = "var(--scrollbar-thumb-color)";
22
24
  const defaultTrackColor = "var(--scrollbar-track-color, transparent)";
23
- style["scrollbar-color"] = `${defaultThumbColor} transparent`;
24
- const sizeValue = values[0] || "8px";
25
- if (mods.includes("thin")) style["scrollbar-width"] = "thin";
26
- else if (mods.includes("none")) {
25
+ const style = {};
26
+ if (mods.includes("none")) {
27
+ const ignored = [
28
+ ...mods.filter((m) => m !== "none"),
29
+ ...values,
30
+ ...colors
31
+ ];
32
+ if (ignored.length) warn(`scrollbar="none" hides the scrollbar; other tokens are ignored: ${ignored.join(", ")}`);
27
33
  style["scrollbar-width"] = "none";
28
- delete style["scrollbar-color"];
29
- style["&::-webkit-scrollbar"] = {
30
- width: "0px",
31
- height: "0px",
32
- display: "none"
33
- };
34
34
  return style;
35
- } else if (mods.includes("auto")) style["scrollbar-width"] = "auto";
36
- if (mods.includes("stable") || mods.includes("both-edges")) style["scrollbar-gutter"] = mods.includes("both-edges") ? "stable both-edges" : "stable";
37
- if (sizeValue) style["&::-webkit-scrollbar"] = {
38
- ...getNested("&::-webkit-scrollbar"),
39
- width: sizeValue,
40
- height: sizeValue
41
- };
42
- const thumbColor = colors && colors[0] ? colors[0] : defaultThumbColor;
43
- const trackColor = colors && colors[1] ? colors[1] : defaultTrackColor;
44
- const cornerColor = colors && colors[2] ? colors[2] : trackColor;
45
- if (colors && colors.length) {
46
- style["scrollbar-color"] = `${thumbColor} ${trackColor}`;
47
- const webkitScrollbar = getNested("&::-webkit-scrollbar");
48
- webkitScrollbar["background"] = trackColor;
49
- style["&::-webkit-scrollbar"] = webkitScrollbar;
50
- style["&::-webkit-scrollbar-track"] = {
51
- ...getNested("&::-webkit-scrollbar-track"),
52
- background: trackColor
53
- };
54
- style["&::-webkit-scrollbar-thumb"] = {
55
- ...getNested("&::-webkit-scrollbar-thumb"),
56
- background: thumbColor
57
- };
58
- style["&::-webkit-scrollbar-corner"] = {
59
- ...getNested("&::-webkit-scrollbar-corner"),
60
- background: cornerColor
61
- };
62
35
  }
36
+ if (mods.includes("auto") || values.includes("auto")) style["scrollbar-width"] = "auto";
37
+ else style["scrollbar-width"] = "thin";
38
+ style["scrollbar-color"] = `${colors?.[0] || defaultThumbColor} ${colors?.[1] || defaultTrackColor}`;
39
+ if (mods.includes("stable") || mods.includes("both-edges")) style["scrollbar-gutter"] = mods.includes("both-edges") ? "stable both-edges" : "stable";
63
40
  if (mods.includes("always")) {
64
- style["overflow"] = overflow || "scroll";
65
- if (!style["scrollbar-gutter"]) style["scrollbar-gutter"] = "stable";
66
- const alwaysScrollbar = getNested("&::-webkit-scrollbar");
67
- alwaysScrollbar["display"] = "block";
68
- style["&::-webkit-scrollbar"] = alwaysScrollbar;
69
- }
70
- if (mods.includes("styled")) {
71
- const baseTransition = [
72
- "background var(--transition)",
73
- "border-radius var(--transition)",
74
- "box-shadow var(--transition)",
75
- "width var(--transition)",
76
- "height var(--transition)",
77
- "border var(--transition)"
78
- ].join(", ");
79
- style["scrollbar-width"] = style["scrollbar-width"] || "thin";
80
- style["scrollbar-color"] = style["scrollbar-color"] || `${defaultThumbColor} ${defaultTrackColor}`;
81
- style["&::-webkit-scrollbar"] = {
82
- width: sizeValue,
83
- height: sizeValue,
84
- transition: baseTransition,
85
- background: defaultTrackColor,
86
- ...getNested("&::-webkit-scrollbar")
87
- };
88
- style["&::-webkit-scrollbar-thumb"] = {
89
- "border-radius": "8px",
90
- "min-height": "24px",
91
- transition: baseTransition,
92
- background: defaultThumbColor,
93
- ...getNested("&::-webkit-scrollbar-thumb")
94
- };
95
- style["&::-webkit-scrollbar-track"] = {
96
- background: defaultTrackColor,
97
- transition: baseTransition,
98
- ...getNested("&::-webkit-scrollbar-track")
99
- };
100
- style["&::-webkit-scrollbar-corner"] = {
101
- background: defaultTrackColor,
102
- transition: baseTransition,
103
- ...getNested("&::-webkit-scrollbar-corner")
104
- };
41
+ const effectiveOverflow = overflow || "scroll";
42
+ style["overflow"] = effectiveOverflow;
43
+ if (!style["scrollbar-gutter"] && (effectiveOverflow === "scroll" || effectiveOverflow === "auto")) style["scrollbar-gutter"] = "stable";
105
44
  }
106
45
  return style;
107
46
  }
108
47
  scrollbarStyle.__lookupStyles = ["scrollbar", "overflow"];
109
-
110
48
  //#endregion
111
49
  export { scrollbarStyle };
50
+
112
51
  //# sourceMappingURL=scrollbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scrollbar.js","names":[],"sources":["../../src/styles/scrollbar.ts"],"sourcesContent":["import { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\ninterface ScrollbarStyleProps {\n scrollbar?: string | boolean | number;\n overflow?: string;\n}\n\n/**\n * Creates cross-browser compatible scrollbar styles\n *\n * Supports both Firefox (scrollbar-width, scrollbar-color) and\n * WebKit/Chromium browsers (::-webkit-scrollbar)\n */\nexport function scrollbarStyle({ scrollbar, overflow }: ScrollbarStyleProps) {\n // Check if scrollbar is defined\n if (!scrollbar && scrollbar !== 0) return;\n\n // Support true as alias for thin\n const value = scrollbar === true || scrollbar === '' ? 'thin' : scrollbar;\n const processed = parseStyle(String(value));\n const { mods, colors, values } = processed.groups[0] ?? makeEmptyDetails();\n type NestedStyle = Record<string, string>;\n type ScrollbarStyleMap = Record<string, string | NestedStyle>;\n const style: ScrollbarStyleMap = {};\n\n function getNested(key: string): NestedStyle {\n const v = style[key];\n if (v && typeof v === 'object') return v;\n return {};\n }\n\n // Default colors for scrollbar\n const defaultThumbColor = 'var(--scrollbar-thumb-color)';\n const defaultTrackColor = 'var(--scrollbar-track-color, transparent)';\n\n // Setup default Firefox scrollbar style\n style['scrollbar-color'] = `${defaultThumbColor} transparent`;\n\n // Default scrollbar size\n const defaultSize = '8px';\n const sizeValue = values[0] || defaultSize;\n\n // Process modifiers\n if (mods.includes('thin')) {\n style['scrollbar-width'] = 'thin';\n } else if (mods.includes('none')) {\n style['scrollbar-width'] = 'none';\n // Remove scrollbar-color as it's not needed when scrollbar is hidden\n delete style['scrollbar-color'];\n // Also hide WebKit scrollbars\n style['&::-webkit-scrollbar'] = {\n width: '0px',\n height: '0px',\n display: 'none',\n };\n\n return style;\n } else if (mods.includes('auto')) {\n style['scrollbar-width'] = 'auto';\n }\n\n // Handle scrollbar gutter behavior\n if (mods.includes('stable') || mods.includes('both-edges')) {\n // scrollbar-gutter is supported in newer browsers only\n style['scrollbar-gutter'] = mods.includes('both-edges')\n ? 'stable both-edges'\n : 'stable';\n }\n\n // Custom size setup for WebKit\n if (sizeValue) {\n style['&::-webkit-scrollbar'] = {\n ...getNested('&::-webkit-scrollbar'),\n width: sizeValue,\n height: sizeValue,\n };\n }\n\n // Extract colors (support up to 3: thumb, track, corner)\n // These will be used in various places throughout the function\n const thumbColor = colors && colors[0] ? colors[0] : defaultThumbColor;\n const trackColor = colors && colors[1] ? colors[1] : defaultTrackColor;\n const cornerColor = colors && colors[2] ? colors[2] : trackColor;\n\n // Apply colors if they are specified\n if (colors && colors.length) {\n // Firefox\n style['scrollbar-color'] = `${thumbColor} ${trackColor}`;\n\n // WebKit - always set these for consistency\n const webkitScrollbar = getNested('&::-webkit-scrollbar');\n webkitScrollbar['background'] = trackColor;\n style['&::-webkit-scrollbar'] = webkitScrollbar;\n\n style['&::-webkit-scrollbar-track'] = {\n ...getNested('&::-webkit-scrollbar-track'),\n background: trackColor,\n };\n\n style['&::-webkit-scrollbar-thumb'] = {\n ...getNested('&::-webkit-scrollbar-thumb'),\n background: thumbColor,\n };\n\n style['&::-webkit-scrollbar-corner'] = {\n ...getNested('&::-webkit-scrollbar-corner'),\n background: cornerColor,\n };\n }\n\n // Handle 'always' mode: force scrollbars to show\n if (mods.includes('always')) {\n style['overflow'] = overflow || 'scroll';\n\n // Use auto for WebKit browsers since they don't support 'always'\n // This is closer to the expected behavior\n if (!style['scrollbar-gutter']) {\n style['scrollbar-gutter'] = 'stable';\n }\n\n // Ensure scrollbars appear in WebKit even with little content\n const alwaysScrollbar = getNested('&::-webkit-scrollbar');\n alwaysScrollbar['display'] = 'block';\n style['&::-webkit-scrollbar'] = alwaysScrollbar;\n }\n\n // Enhanced 'styled' mode with better transitions and appearance\n if (mods.includes('styled')) {\n const baseTransition = [\n 'background var(--transition)',\n 'border-radius var(--transition)',\n 'box-shadow var(--transition)',\n 'width var(--transition)',\n 'height var(--transition)',\n 'border var(--transition)',\n ].join(', ');\n\n // Firefox\n style['scrollbar-width'] = style['scrollbar-width'] || 'thin';\n style['scrollbar-color'] =\n style['scrollbar-color'] || `${defaultThumbColor} ${defaultTrackColor}`;\n\n // WebKit\n style['&::-webkit-scrollbar'] = {\n width: sizeValue,\n height: sizeValue,\n transition: baseTransition,\n background: defaultTrackColor,\n ...getNested('&::-webkit-scrollbar'),\n };\n\n style['&::-webkit-scrollbar-thumb'] = {\n 'border-radius': '8px',\n 'min-height': '24px',\n transition: baseTransition,\n background: defaultThumbColor,\n ...getNested('&::-webkit-scrollbar-thumb'),\n };\n\n style['&::-webkit-scrollbar-track'] = {\n background: defaultTrackColor,\n transition: baseTransition,\n ...getNested('&::-webkit-scrollbar-track'),\n };\n\n style['&::-webkit-scrollbar-corner'] = {\n background: defaultTrackColor,\n transition: baseTransition,\n ...getNested('&::-webkit-scrollbar-corner'),\n };\n }\n\n return style;\n}\n\nscrollbarStyle.__lookupStyles = ['scrollbar', 'overflow'];\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,eAAe,EAAE,WAAW,YAAiC;AAE3E,KAAI,CAAC,aAAa,cAAc,EAAG;CAGnC,MAAM,QAAQ,cAAc,QAAQ,cAAc,KAAK,SAAS;CAEhE,MAAM,EAAE,MAAM,QAAQ,WADJ,WAAW,OAAO,MAAM,CAAC,CACA,OAAO,MAAM,kBAAkB;CAG1E,MAAM,QAA2B,EAAE;CAEnC,SAAS,UAAU,KAA0B;EAC3C,MAAM,IAAI,MAAM;AAChB,MAAI,KAAK,OAAO,MAAM,SAAU,QAAO;AACvC,SAAO,EAAE;;CAIX,MAAM,oBAAoB;CAC1B,MAAM,oBAAoB;AAG1B,OAAM,qBAAqB,GAAG,kBAAkB;CAIhD,MAAM,YAAY,OAAO,MADL;AAIpB,KAAI,KAAK,SAAS,OAAO,CACvB,OAAM,qBAAqB;UAClB,KAAK,SAAS,OAAO,EAAE;AAChC,QAAM,qBAAqB;AAE3B,SAAO,MAAM;AAEb,QAAM,0BAA0B;GAC9B,OAAO;GACP,QAAQ;GACR,SAAS;GACV;AAED,SAAO;YACE,KAAK,SAAS,OAAO,CAC9B,OAAM,qBAAqB;AAI7B,KAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,aAAa,CAExD,OAAM,sBAAsB,KAAK,SAAS,aAAa,GACnD,sBACA;AAIN,KAAI,UACF,OAAM,0BAA0B;EAC9B,GAAG,UAAU,uBAAuB;EACpC,OAAO;EACP,QAAQ;EACT;CAKH,MAAM,aAAa,UAAU,OAAO,KAAK,OAAO,KAAK;CACrD,MAAM,aAAa,UAAU,OAAO,KAAK,OAAO,KAAK;CACrD,MAAM,cAAc,UAAU,OAAO,KAAK,OAAO,KAAK;AAGtD,KAAI,UAAU,OAAO,QAAQ;AAE3B,QAAM,qBAAqB,GAAG,WAAW,GAAG;EAG5C,MAAM,kBAAkB,UAAU,uBAAuB;AACzD,kBAAgB,gBAAgB;AAChC,QAAM,0BAA0B;AAEhC,QAAM,gCAAgC;GACpC,GAAG,UAAU,6BAA6B;GAC1C,YAAY;GACb;AAED,QAAM,gCAAgC;GACpC,GAAG,UAAU,6BAA6B;GAC1C,YAAY;GACb;AAED,QAAM,iCAAiC;GACrC,GAAG,UAAU,8BAA8B;GAC3C,YAAY;GACb;;AAIH,KAAI,KAAK,SAAS,SAAS,EAAE;AAC3B,QAAM,cAAc,YAAY;AAIhC,MAAI,CAAC,MAAM,oBACT,OAAM,sBAAsB;EAI9B,MAAM,kBAAkB,UAAU,uBAAuB;AACzD,kBAAgB,aAAa;AAC7B,QAAM,0BAA0B;;AAIlC,KAAI,KAAK,SAAS,SAAS,EAAE;EAC3B,MAAM,iBAAiB;GACrB;GACA;GACA;GACA;GACA;GACA;GACD,CAAC,KAAK,KAAK;AAGZ,QAAM,qBAAqB,MAAM,sBAAsB;AACvD,QAAM,qBACJ,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;AAGtD,QAAM,0BAA0B;GAC9B,OAAO;GACP,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,GAAG,UAAU,uBAAuB;GACrC;AAED,QAAM,gCAAgC;GACpC,iBAAiB;GACjB,cAAc;GACd,YAAY;GACZ,YAAY;GACZ,GAAG,UAAU,6BAA6B;GAC3C;AAED,QAAM,gCAAgC;GACpC,YAAY;GACZ,YAAY;GACZ,GAAG,UAAU,6BAA6B;GAC3C;AAED,QAAM,iCAAiC;GACrC,YAAY;GACZ,YAAY;GACZ,GAAG,UAAU,8BAA8B;GAC5C;;AAGH,QAAO;;AAGT,eAAe,iBAAiB,CAAC,aAAa,WAAW"}
1
+ {"version":3,"file":"scrollbar.js","names":[],"sources":["../../src/styles/scrollbar.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\nimport { warn } from '../utils/warnings';\n\ninterface ScrollbarStyleProps {\n scrollbar?: string | boolean;\n overflow?: string;\n}\n\n/**\n * Standard CSS scrollbar styling via `scrollbar-width`, `scrollbar-color`,\n * and `scrollbar-gutter`.\n *\n * Width values: `thin` (default), `auto`, `none`\n * Modifiers: `stable`, `both-edges`, `always`\n *\n * Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands\n * in `values` rather than `mods`. Both locations are checked for robustness.\n */\nexport function scrollbarStyle({\n scrollbar,\n overflow,\n}: ScrollbarStyleProps): Record<string, string> | null {\n if (!scrollbar) return null;\n\n if (typeof scrollbar === 'string' && CSS_WIDE_KEYWORDS.has(scrollbar)) {\n return {\n 'scrollbar-width': scrollbar,\n 'scrollbar-color': scrollbar,\n };\n }\n\n // `true` is treated as `thin` (empty string is falsy, caught by the guard above)\n const value = scrollbar === true ? 'thin' : scrollbar;\n const processed = parseStyle(String(value));\n const { mods, colors, values } = processed.groups[0] ?? makeEmptyDetails();\n\n const defaultThumbColor = 'var(--scrollbar-thumb-color)';\n const defaultTrackColor = 'var(--scrollbar-track-color, transparent)';\n\n const style: Record<string, string> = {};\n\n if (mods.includes('none')) {\n const ignored = [...mods.filter((m) => m !== 'none'), ...values, ...colors];\n\n if (ignored.length) {\n warn(\n `scrollbar=\"none\" hides the scrollbar; other tokens are ignored: ${ignored.join(', ')}`,\n );\n }\n\n style['scrollbar-width'] = 'none';\n\n return style;\n }\n\n // `thin` is the default — accepted as a value for readability but always\n // the fallback when neither `auto` nor `none` is specified.\n // `auto` is a VALUE_KEYWORD in the parser, so it may land in `values`.\n if (mods.includes('auto') || values.includes('auto')) {\n style['scrollbar-width'] = 'auto';\n } else {\n style['scrollbar-width'] = 'thin';\n }\n\n const thumbColor = colors?.[0] || defaultThumbColor;\n const trackColor = colors?.[1] || defaultTrackColor;\n style['scrollbar-color'] = `${thumbColor} ${trackColor}`;\n\n if (mods.includes('stable') || mods.includes('both-edges')) {\n style['scrollbar-gutter'] = mods.includes('both-edges')\n ? 'stable both-edges'\n : 'stable';\n }\n\n if (mods.includes('always')) {\n const effectiveOverflow = overflow || 'scroll';\n style['overflow'] = effectiveOverflow;\n\n // scrollbar-gutter only applies with scroll/auto overflow\n if (\n !style['scrollbar-gutter'] &&\n (effectiveOverflow === 'scroll' || effectiveOverflow === 'auto')\n ) {\n style['scrollbar-gutter'] = 'stable';\n }\n }\n\n return style;\n}\n\nscrollbarStyle.__lookupStyles = ['scrollbar', 'overflow'];\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,SAAgB,eAAe,EAC7B,WACA,YACqD;AACrD,KAAI,CAAC,UAAW,QAAO;AAEvB,KAAI,OAAO,cAAc,YAAY,kBAAkB,IAAI,UAAU,CACnE,QAAO;EACL,mBAAmB;EACnB,mBAAmB;EACpB;CAMH,MAAM,EAAE,MAAM,QAAQ,WADJ,WAAW,OADf,cAAc,OAAO,SAAS,UACF,CAAC,CACA,OAAO,MAAM,kBAAkB;CAE1E,MAAM,oBAAoB;CAC1B,MAAM,oBAAoB;CAE1B,MAAM,QAAgC,EAAE;AAExC,KAAI,KAAK,SAAS,OAAO,EAAE;EACzB,MAAM,UAAU;GAAC,GAAG,KAAK,QAAQ,MAAM,MAAM,OAAO;GAAE,GAAG;GAAQ,GAAG;GAAO;AAE3E,MAAI,QAAQ,OACV,MACE,mEAAmE,QAAQ,KAAK,KAAK,GACtF;AAGH,QAAM,qBAAqB;AAE3B,SAAO;;AAMT,KAAI,KAAK,SAAS,OAAO,IAAI,OAAO,SAAS,OAAO,CAClD,OAAM,qBAAqB;KAE3B,OAAM,qBAAqB;AAK7B,OAAM,qBAAqB,GAFR,SAAS,MAAM,kBAEO,GADtB,SAAS,MAAM;AAGlC,KAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,aAAa,CACxD,OAAM,sBAAsB,KAAK,SAAS,aAAa,GACnD,sBACA;AAGN,KAAI,KAAK,SAAS,SAAS,EAAE;EAC3B,MAAM,oBAAoB,YAAY;AACtC,QAAM,cAAc;AAGpB,MACE,CAAC,MAAM,wBACN,sBAAsB,YAAY,sBAAsB,QAEzD,OAAM,sBAAsB;;AAIhC,QAAO;;AAGT,eAAe,iBAAiB,CAAC,aAAa,WAAW"}
@@ -5,7 +5,7 @@ declare function shadowStyle({
5
5
  shadow?: string | boolean;
6
6
  }): {
7
7
  'box-shadow': string;
8
- } | undefined;
8
+ } | null;
9
9
  declare namespace shadowStyle {
10
10
  var __lookupStyles: string[];
11
11
  }
@@ -1,6 +1,6 @@
1
+ import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
1
2
  import { makeEmptyDetails } from "../parser/types.js";
2
3
  import { parseStyle } from "../utils/styles.js";
3
-
4
4
  //#region src/styles/shadow.ts
5
5
  function toBoxShadow(shadow) {
6
6
  const { values, mods, colors } = parseStyle(shadow).groups[0] ?? makeEmptyDetails();
@@ -13,12 +13,13 @@ function toBoxShadow(shadow) {
13
13
  ].join(" ");
14
14
  }
15
15
  function shadowStyle({ shadow }) {
16
- if (!shadow) return;
16
+ if (!shadow) return null;
17
17
  if (shadow === true) shadow = "var(--shadow)";
18
+ if (CSS_WIDE_KEYWORDS.has(shadow)) return { "box-shadow": shadow };
18
19
  return { "box-shadow": shadow.split(",").map(toBoxShadow).join(",") };
19
20
  }
20
21
  shadowStyle.__lookupStyles = ["shadow"];
21
-
22
22
  //#endregion
23
23
  export { shadowStyle };
24
+
24
25
  //# sourceMappingURL=shadow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shadow.js","names":[],"sources":["../../src/styles/shadow.ts"],"sourcesContent":["import { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\nfunction toBoxShadow(shadow: string): string {\n const processed = parseStyle(shadow);\n const { values, mods, colors } = processed.groups[0] ?? makeEmptyDetails();\n const mod = mods[0] || '';\n const shadowColor = (colors && colors[0]) ?? '';\n\n return [mod, ...values, shadowColor].join(' ');\n}\n\nexport function shadowStyle({ shadow }: { shadow?: string | boolean }) {\n if (!shadow) return;\n\n if (shadow === true) shadow = 'var(--shadow)';\n\n return {\n 'box-shadow': shadow.split(',').map(toBoxShadow).join(','),\n };\n}\n\nshadowStyle.__lookupStyles = ['shadow'];\n"],"mappings":";;;;AAGA,SAAS,YAAY,QAAwB;CAE3C,MAAM,EAAE,QAAQ,MAAM,WADJ,WAAW,OAAO,CACO,OAAO,MAAM,kBAAkB;CAC1E,MAAM,MAAM,KAAK,MAAM;CACvB,MAAM,eAAe,UAAU,OAAO,OAAO;AAE7C,QAAO;EAAC;EAAK,GAAG;EAAQ;EAAY,CAAC,KAAK,IAAI;;AAGhD,SAAgB,YAAY,EAAE,UAAyC;AACrE,KAAI,CAAC,OAAQ;AAEb,KAAI,WAAW,KAAM,UAAS;AAE9B,QAAO,EACL,cAAc,OAAO,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,IAAI,EAC3D;;AAGH,YAAY,iBAAiB,CAAC,SAAS"}
1
+ {"version":3,"file":"shadow.js","names":[],"sources":["../../src/styles/shadow.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\nfunction toBoxShadow(shadow: string): string {\n const processed = parseStyle(shadow);\n const { values, mods, colors } = processed.groups[0] ?? makeEmptyDetails();\n const mod = mods[0] || '';\n const shadowColor = (colors && colors[0]) ?? '';\n\n return [mod, ...values, shadowColor].join(' ');\n}\n\nexport function shadowStyle({ shadow }: { shadow?: string | boolean }) {\n if (!shadow) return null;\n\n if (shadow === true) shadow = 'var(--shadow)';\n\n if (CSS_WIDE_KEYWORDS.has(shadow)) {\n return { 'box-shadow': shadow };\n }\n\n return {\n 'box-shadow': shadow.split(',').map(toBoxShadow).join(','),\n };\n}\n\nshadowStyle.__lookupStyles = ['shadow'];\n"],"mappings":";;;;AAIA,SAAS,YAAY,QAAwB;CAE3C,MAAM,EAAE,QAAQ,MAAM,WADJ,WAAW,OAAO,CACO,OAAO,MAAM,kBAAkB;CAC1E,MAAM,MAAM,KAAK,MAAM;CACvB,MAAM,eAAe,UAAU,OAAO,OAAO;AAE7C,QAAO;EAAC;EAAK,GAAG;EAAQ;EAAY,CAAC,KAAK,IAAI;;AAGhD,SAAgB,YAAY,EAAE,UAAyC;AACrE,KAAI,CAAC,OAAQ,QAAO;AAEpB,KAAI,WAAW,KAAM,UAAS;AAE9B,KAAI,kBAAkB,IAAI,OAAO,CAC/B,QAAO,EAAE,cAAc,QAAQ;AAGjC,QAAO,EACL,cAAc,OAAO,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,IAAI,EAC3D;;AAGH,YAAY,iBAAiB,CAAC,SAAS"}
@@ -0,0 +1,17 @@
1
+ import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
2
+ //#region src/styles/shared.ts
3
+ /**
4
+ * If the group contains exactly one value that is a CSS-wide keyword
5
+ * and no colors, return the keyword. Otherwise null.
6
+ *
7
+ * Direction mods (top/right/bottom/left) may coexist with the keyword
8
+ * for directional application like `padding="inherit top"`.
9
+ */
10
+ function extractCSSWideKeyword(group) {
11
+ if (group.values.length !== 1 || group.colors.length > 0) return null;
12
+ return CSS_WIDE_KEYWORDS.has(group.values[0]) ? group.values[0] : null;
13
+ }
14
+ //#endregion
15
+ export { extractCSSWideKeyword };
16
+
17
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../src/styles/shared.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport type { StyleDetails } from '../parser/types';\n\n/**\n * If the group contains exactly one value that is a CSS-wide keyword\n * and no colors, return the keyword. Otherwise null.\n *\n * Direction mods (top/right/bottom/left) may coexist with the keyword\n * for directional application like `padding=\"inherit top\"`.\n */\nexport function extractCSSWideKeyword(group: StyleDetails): string | null {\n if (group.values.length !== 1 || group.colors.length > 0) return null;\n return CSS_WIDE_KEYWORDS.has(group.values[0]) ? group.values[0] : null;\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,sBAAsB,OAAoC;AACxE,KAAI,MAAM,OAAO,WAAW,KAAK,MAAM,OAAO,SAAS,EAAG,QAAO;AACjE,QAAO,kBAAkB,IAAI,MAAM,OAAO,GAAG,GAAG,MAAM,OAAO,KAAK"}
@@ -5,7 +5,7 @@ declare function transitionStyle({
5
5
  transition?: string;
6
6
  }): {
7
7
  transition: string;
8
- } | undefined;
8
+ } | null;
9
9
  declare namespace transitionStyle {
10
10
  var __lookupStyles: string[];
11
11
  }
@@ -1,5 +1,5 @@
1
+ import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
1
2
  import { parseStyle } from "../utils/styles.js";
2
-
3
3
  //#region src/styles/transition.ts
4
4
  const SECOND_FILL_COLOR_PROPERTY = "--tasty-second-fill-color";
5
5
  const MAP = {
@@ -99,17 +99,18 @@ function isEasing(token) {
99
99
  return EASING_KEYWORDS.has(token) || token.startsWith("cubic-bezier(") || token.startsWith("steps(") || token.startsWith("linear(");
100
100
  }
101
101
  function getTiming(name) {
102
- return `var(--${name}-transition, var(--transition))`;
102
+ return `var(${name.startsWith("--") ? `${name}-transition` : `--${name}-transition`}, var(--transition))`;
103
103
  }
104
104
  function transitionStyle({ transition }) {
105
- if (!transition) return;
105
+ if (!transition) return null;
106
+ if (CSS_WIDE_KEYWORDS.has(transition)) return { transition };
106
107
  const processed = parseStyle(transition);
107
108
  const tokens = [];
108
109
  processed.groups.forEach((g, idx) => {
109
110
  tokens.push(...g.all);
110
111
  if (idx < processed.groups.length - 1) tokens.push(",");
111
112
  });
112
- if (tokens.length === 0) return;
113
+ if (tokens.length === 0) return null;
113
114
  let tempTransition = [];
114
115
  const transitions = [];
115
116
  tokens.forEach((token) => {
@@ -152,7 +153,7 @@ function transitionStyle({ transition }) {
152
153
  }).join(", ") };
153
154
  }
154
155
  transitionStyle.__lookupStyles = ["transition"];
155
-
156
156
  //#endregion
157
157
  export { transitionStyle };
158
+
158
159
  //# sourceMappingURL=transition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transition.js","names":[],"sources":["../../src/styles/transition.ts"],"sourcesContent":["import { parseStyle } from '../utils/styles';\n\nconst SECOND_FILL_COLOR_PROPERTY = '--tasty-second-fill-color';\n\nconst MAP: Record<string, string[]> = {\n fade: ['mask', 'mask-composite'],\n translate: ['transform', 'translate'],\n rotate: ['transform', 'rotate'],\n scale: ['transform', 'scale'],\n fill: ['background-color', 'background-image', SECOND_FILL_COLOR_PROPERTY],\n image: [\n 'background-image',\n 'background-position',\n 'background-size',\n 'background-repeat',\n 'background-attachment',\n 'background-origin',\n 'background-clip',\n SECOND_FILL_COLOR_PROPERTY,\n ],\n background: [\n 'background-color',\n 'background-image',\n 'background-position',\n 'background-size',\n 'background-repeat',\n 'background-attachment',\n 'background-origin',\n 'background-clip',\n SECOND_FILL_COLOR_PROPERTY,\n ],\n border: [\n 'border',\n 'border-top',\n 'border-right',\n 'border-bottom',\n 'border-left',\n ],\n filter: ['filter', 'backdrop-filter'],\n radius: ['border-radius'],\n shadow: ['box-shadow'],\n outline: ['outline', 'outline-offset'],\n preset: [\n 'font-size',\n 'line-height',\n 'letter-spacing',\n 'font-weight',\n 'font-style',\n ],\n text: ['font-weight', 'text-decoration-color'],\n color: ['color'],\n opacity: ['opacity'],\n theme: [\n 'color',\n 'background-color',\n 'background-image',\n 'box-shadow',\n 'border',\n 'border-radius',\n 'outline',\n 'opacity',\n SECOND_FILL_COLOR_PROPERTY,\n ],\n width: ['max-width', 'min-width', 'width'],\n height: ['max-height', 'min-height', 'height'],\n gap: ['gap', 'margin'],\n zIndex: ['z-index'],\n inset: ['inset', 'top', 'right', 'bottom', 'left'],\n};\n\nexport const DEFAULT_TIMING = 'var(--transition)';\nconst DEFAULT_EASING = 'linear';\n\nconst EASING_KEYWORDS = new Set([\n 'ease',\n 'ease-in',\n 'ease-out',\n 'ease-in-out',\n 'linear',\n 'step-start',\n 'step-end',\n]);\n\nfunction isEasing(token: string): boolean {\n return (\n EASING_KEYWORDS.has(token) ||\n token.startsWith('cubic-bezier(') ||\n token.startsWith('steps(') ||\n token.startsWith('linear(')\n );\n}\n\nfunction getTiming(name: string): string {\n return `var(--${name}-transition, var(--transition))`;\n}\n\ntype TransitionEntry = [\n name: string,\n easing: string | undefined,\n timing: string | undefined,\n delay: string | undefined,\n];\n\nexport function transitionStyle({ transition }: { transition?: string }) {\n if (!transition) return;\n\n const processed = parseStyle(transition);\n const tokens: string[] = [];\n processed.groups.forEach((g, idx) => {\n tokens.push(...g.all);\n if (idx < processed.groups.length - 1) tokens.push(',');\n });\n\n if (tokens.length === 0) return;\n\n let tempTransition: string[] = [];\n const transitions: string[][] = [];\n\n tokens.forEach((token) => {\n if (token === ',') {\n if (tempTransition.length) {\n transitions.push(tempTransition);\n tempTransition = [];\n }\n } else {\n tempTransition.push(token);\n }\n });\n\n if (tempTransition.length) {\n transitions.push(tempTransition);\n }\n\n const map: Record<string, TransitionEntry> = {};\n\n transitions.forEach((transition) => {\n const name = transition[0];\n\n let timing: string | undefined;\n let easing: string | undefined;\n let delay: string | undefined;\n\n if (transition[1] && isEasing(transition[1])) {\n easing = transition[1];\n delay = transition[2];\n } else {\n timing = transition[1];\n easing = transition[2];\n delay = transition[3];\n }\n\n const styles = MAP[name] || [name];\n\n styles.forEach((style) => {\n map[style] = [name, easing, timing, delay];\n });\n });\n\n const result = Object.entries(map)\n .map(([style, [name, easing, timing, delay]]) => {\n let value = `${style} ${timing || getTiming(name)}`;\n if (easing || delay) {\n value += ` ${easing || DEFAULT_EASING}`;\n }\n if (delay) {\n value += ` ${delay}`;\n }\n return value;\n })\n .join(', ');\n\n return { transition: result };\n}\n\ntransitionStyle.__lookupStyles = ['transition'];\n"],"mappings":"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"}
1
+ {"version":3,"file":"transition.js","names":[],"sources":["../../src/styles/transition.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { parseStyle } from '../utils/styles';\n\nconst SECOND_FILL_COLOR_PROPERTY = '--tasty-second-fill-color';\n\nconst MAP: Record<string, string[]> = {\n fade: ['mask', 'mask-composite'],\n translate: ['transform', 'translate'],\n rotate: ['transform', 'rotate'],\n scale: ['transform', 'scale'],\n fill: ['background-color', 'background-image', SECOND_FILL_COLOR_PROPERTY],\n image: [\n 'background-image',\n 'background-position',\n 'background-size',\n 'background-repeat',\n 'background-attachment',\n 'background-origin',\n 'background-clip',\n SECOND_FILL_COLOR_PROPERTY,\n ],\n background: [\n 'background-color',\n 'background-image',\n 'background-position',\n 'background-size',\n 'background-repeat',\n 'background-attachment',\n 'background-origin',\n 'background-clip',\n SECOND_FILL_COLOR_PROPERTY,\n ],\n border: [\n 'border',\n 'border-top',\n 'border-right',\n 'border-bottom',\n 'border-left',\n ],\n filter: ['filter', 'backdrop-filter'],\n radius: ['border-radius'],\n shadow: ['box-shadow'],\n outline: ['outline', 'outline-offset'],\n preset: [\n 'font-size',\n 'line-height',\n 'letter-spacing',\n 'font-weight',\n 'font-style',\n ],\n text: ['font-weight', 'text-decoration-color'],\n color: ['color'],\n opacity: ['opacity'],\n theme: [\n 'color',\n 'background-color',\n 'background-image',\n 'box-shadow',\n 'border',\n 'border-radius',\n 'outline',\n 'opacity',\n SECOND_FILL_COLOR_PROPERTY,\n ],\n width: ['max-width', 'min-width', 'width'],\n height: ['max-height', 'min-height', 'height'],\n gap: ['gap', 'margin'],\n zIndex: ['z-index'],\n inset: ['inset', 'top', 'right', 'bottom', 'left'],\n};\n\nexport const DEFAULT_TIMING = 'var(--transition)';\nconst DEFAULT_EASING = 'linear';\n\nconst EASING_KEYWORDS = new Set([\n 'ease',\n 'ease-in',\n 'ease-out',\n 'ease-in-out',\n 'linear',\n 'step-start',\n 'step-end',\n]);\n\nfunction isEasing(token: string): boolean {\n return (\n EASING_KEYWORDS.has(token) ||\n token.startsWith('cubic-bezier(') ||\n token.startsWith('steps(') ||\n token.startsWith('linear(')\n );\n}\n\nfunction getTiming(name: string): string {\n const varName = name.startsWith('--')\n ? `${name}-transition`\n : `--${name}-transition`;\n return `var(${varName}, var(--transition))`;\n}\n\ntype TransitionEntry = [\n name: string,\n easing: string | undefined,\n timing: string | undefined,\n delay: string | undefined,\n];\n\nexport function transitionStyle({ transition }: { transition?: string }) {\n if (!transition) return null;\n\n if (CSS_WIDE_KEYWORDS.has(transition)) {\n return { transition };\n }\n\n const processed = parseStyle(transition);\n const tokens: string[] = [];\n processed.groups.forEach((g, idx) => {\n tokens.push(...g.all);\n if (idx < processed.groups.length - 1) tokens.push(',');\n });\n\n if (tokens.length === 0) return null;\n\n let tempTransition: string[] = [];\n const transitions: string[][] = [];\n\n tokens.forEach((token) => {\n if (token === ',') {\n if (tempTransition.length) {\n transitions.push(tempTransition);\n tempTransition = [];\n }\n } else {\n tempTransition.push(token);\n }\n });\n\n if (tempTransition.length) {\n transitions.push(tempTransition);\n }\n\n const map: Record<string, TransitionEntry> = {};\n\n transitions.forEach((transition) => {\n const name = transition[0];\n\n let timing: string | undefined;\n let easing: string | undefined;\n let delay: string | undefined;\n\n if (transition[1] && isEasing(transition[1])) {\n easing = transition[1];\n delay = transition[2];\n } else {\n timing = transition[1];\n easing = transition[2];\n delay = transition[3];\n }\n\n const styles = MAP[name] || [name];\n\n styles.forEach((style) => {\n map[style] = [name, easing, timing, delay];\n });\n });\n\n const result = Object.entries(map)\n .map(([style, [name, easing, timing, delay]]) => {\n let value = `${style} ${timing || getTiming(name)}`;\n if (easing || delay) {\n value += ` ${easing || DEFAULT_EASING}`;\n }\n if (delay) {\n value += ` ${delay}`;\n }\n return value;\n })\n .join(', ');\n\n return { transition: result };\n}\n\ntransitionStyle.__lookupStyles = ['transition'];\n"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { KeyframesSteps, PropertyDefinition } from "../injector/types.js";
1
+ import { CounterStyleDescriptors, FontFaceInput, KeyframesSteps, PropertyDefinition } from "../injector/types.js";
2
2
  import { CSSProperties } from "../utils/css-types.js";
3
3
  import { StyleValue, StyleValueStateMap } from "../utils/styles.js";
4
4
 
@@ -40,8 +40,9 @@ type PresetNameKey = Extract<keyof TastyPresetNames, string>;
40
40
  type PresetName = [PresetNameKey] extends [never] ? string : PresetNameKey;
41
41
  type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
42
42
  type OpaquePercentage = '' | `.${Digit}` | `.${Digit}${Digit}` | '.100';
43
+ type ColorValue = `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `hsl(${string})` | `okhsl(${string})` | `oklch(${string})` | (string & {});
43
44
  type NoType = false | null | undefined;
44
- interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font' | 'outline' | 'type' | 'gap' | 'padding' | 'margin' | 'width' | 'height' | 'border' | 'transition' | 'placeContent' | 'placeItems'> {
45
+ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font' | 'outline' | 'type' | 'gap' | 'padding' | 'margin' | 'width' | 'height' | 'border' | 'transition' | 'placeContent' | 'placeItems' | 'scrollMargin' | 'scrollMarginTop' | 'scrollMarginRight' | 'scrollMarginBottom' | 'scrollMarginLeft' | 'scrollMarginBlock' | 'scrollMarginInline'> {
45
46
  /**
46
47
  * @deprecated Use `flow` style instead.
47
48
  */
@@ -57,13 +58,20 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
57
58
  /**
58
59
  * Set the background color of the element. Shortcut for `background-color` with enhanced support for Tasty color tokens and syntaxes.
59
60
  *
61
+ * Supports double-color syntax: the second color is applied as a foreground overlay via a CSS custom property.
62
+ *
60
63
  * Examples:
61
64
  * - `fill="#purple.10"` // purple background with 10% opacity
62
65
  * - `fill="#danger"` // danger theme color
63
66
  * - `fill="rgb(255 128 0)"` // custom RGB color
67
+ * - `fill="rgb(255 128 0 / 0.5)"` // RGB with opacity
68
+ * - `fill="hsl(200 100% 50%)"` // HSL color
69
+ * - `fill="okhsl(200 100% 50%)"` // perceptually uniform OKHSL color
70
+ * - `fill="oklch(0.7 0.15 200)"` // OKLCH color
71
+ * - `fill="#primary #secondary"` // double color (second as foreground overlay)
64
72
  * - `fill={true}` // default fill color
65
73
  */
66
- fill?: `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `rgba(${string})` | boolean | (string & {});
74
+ fill?: ColorValue | boolean;
67
75
  /**
68
76
  * @deprecated Use `fill` instead.
69
77
  */
@@ -92,19 +100,26 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
92
100
  * - `svgFill="#purple.10"` // purple fill with 10% opacity
93
101
  * - `svgFill="#danger"` // danger theme color
94
102
  * - `svgFill="rgb(255 128 0)"` // custom RGB color
103
+ * - `svgFill="hsl(200 100% 50%)"` // HSL color
104
+ * - `svgFill="okhsl(200 100% 50%)"` // OKHSL color
105
+ * - `svgFill="oklch(0.7 0.15 200)"` // OKLCH color
95
106
  * - `svgFill="currentColor"` // inherit from parent color
96
107
  */
97
- svgFill?: `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `rgba(${string})` | (string & {});
108
+ svgFill?: ColorValue;
98
109
  /**
99
110
  * Set the text (current) color of the element. Shortcut for `color` with enhanced support for Tasty color tokens and syntaxes.
100
111
  *
101
112
  * Examples:
102
113
  * - `color="#purple"` // purple text color
103
114
  * - `color="#danger.6"` // danger color with 60% opacity
115
+ * - `color="rgb(255 128 0)"` // custom RGB color
116
+ * - `color="hsl(200 100% 50%)"` // HSL color
117
+ * - `color="okhsl(200 100% 50%)"` // OKHSL color
118
+ * - `color="oklch(0.7 0.15 200)"` // OKLCH color
104
119
  * - `color="red"` // CSS color name
105
120
  * - `color={true}` // currentColor
106
121
  */
107
- color?: `#${NamedColor}${OpaquePercentage}` | `rgb(${string})` | `rgba(${string})` | boolean | string;
122
+ color?: ColorValue | boolean;
108
123
  /**
109
124
  * The fade style applies gradient-based fading masks to the edges of an element. Replaces complex CSS mask gradients with a simple, declarative API.
110
125
  *
@@ -128,25 +143,22 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
128
143
  */
129
144
  fade?: 'top' | 'right' | 'bottom' | 'left' | string;
130
145
  /**
131
- * @deprecated Use `scrollbar` style instead.
132
- * Whether the element has styled scrollbar.
133
- */
134
- styledScrollbar?: boolean;
135
- /**
136
- * The scrollbar style provides a powerful and flexible way to control the appearance and behavior of scrollbars across browsers. It supports custom sizing, color, visibility, and advanced modifiers for modern UI needs.
146
+ * Scrollbar styling using standard CSS properties (`scrollbar-width`, `scrollbar-color`, `scrollbar-gutter`).
137
147
  *
138
- * Syntax: `[modifiers] [size] [color1] [color2] [color3]`
148
+ * Syntax: `[width] [modifiers...] [thumb-color] [track-color]`
139
149
  *
140
- * Modifiers: `thin`, `none`, `auto`, `stable`, `both-edges`, `always`, `styled`
150
+ * Width values: `thin` (default), `auto`, `none`
151
+ * Modifiers: `stable`, `both-edges`, `always`
141
152
  *
142
153
  * Examples:
143
- * - `scrollbar={true}` // thin scrollbar, default color
144
- * - `scrollbar="thin 10px #purple.40 #dark.04"`
145
- * - `scrollbar="styled 12px #purple.40 #dark.04 #white.10"`
154
+ * - `scrollbar={true}` // thin scrollbar, default colors
155
+ * - `scrollbar="thin #purple.40 #dark.04"`
156
+ * - `scrollbar="auto #red #blue"`
146
157
  * - `scrollbar="none"`
147
- * - `scrollbar="always 8px #primary.50 #white.02"`
158
+ * - `scrollbar="always #primary.50 #white.02"`
159
+ * - `scrollbar="thin stable #red #blue"`
148
160
  */
149
- scrollbar?: string | boolean | number;
161
+ scrollbar?: string | boolean;
150
162
  /**
151
163
  * Set font weight for bold texts.
152
164
  */
@@ -265,7 +277,7 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
265
277
  *
266
278
  * Syntax: `[value] [modifiers]` | `[shape]` | `true`
267
279
  *
268
- * Shapes: `round` (fully rounded), `ellipse` (50%), `leaf`, `backleaf` (asymmetric)
280
+ * Shapes: `round` (fully rounded), `ellipse` (50%), `leaf`, `backleaf` (asymmetric), `inherit` (inherit from parent)
269
281
  * Directional modifiers: `top`, `right`, `bottom`, `left`
270
282
  *
271
283
  * Examples:
@@ -274,8 +286,10 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
274
286
  * - `radius="round"` // fully rounded (9999rem)
275
287
  * - `radius="leaf"` // asymmetric leaf shape
276
288
  * - `radius="1r top"` // round only top corners
289
+ * - `radius="inherit"` // inherit border-radius from parent
290
+ * - `radius="inherit right"` // inherit only right corners (uses longhand properties)
277
291
  */
278
- radius?: 'round' | 'ellipse' | 'leaf' | 'backleaf' | string | true;
292
+ radius?: 'round' | 'ellipse' | 'leaf' | 'backleaf' | 'inherit' | string | true;
279
293
  /**
280
294
  * The flow style is a unified shorthand for controlling layout direction and wrapping in both flex and grid containers. Replaces `flexDirection` and `gridAutoFlow`.
281
295
  *
@@ -354,11 +368,13 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
354
368
  /**
355
369
  * The preset style sets base text settings according to named presets. Affects `font-size`, `line-height`, `letter-spacing`, `font-weight`, and `text-transform`.
356
370
  *
371
+ * Syntax: `name`, `name / modifier`, or `modifier` (shorthand, name defaults to `inherit`).
357
372
  * Preset names are project-specific. Augment `TastyPresetNames` to register them for autocomplete.
358
373
  *
359
374
  * Examples:
360
375
  * - `preset="h1"` // heading 1 typography
361
- * - `preset="h2 strong"` // bold heading 2
376
+ * - `preset="h2 / strong"` // bold heading 2
377
+ * - `preset="bold"` // inherit with bold (shorthand)
362
378
  * - `preset="t3"` // text size 3
363
379
  */
364
380
  preset?: PresetName | (string & {});
@@ -381,12 +397,12 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
381
397
  */
382
398
  justify?: CSSProperties['justifyItems'] | CSSProperties['justifyContent'];
383
399
  /**
384
- * Shorthand for `place-items` and `place-content`. Sets both properties for unified alignment of both axes in grid/flex layouts.
400
+ * Shorthand for all placement properties. Sets all 4 longhands: align-items, justify-items, align-content, justify-content.
385
401
  *
386
402
  * Examples:
387
- * - `place="center"` // place-items: center; place-content: center
388
- * - `place="start end"` // place-items: start; place-content: end
389
- * - `place="stretch"` // place both to stretch
403
+ * - `place="center"` // all 4 longhands: center
404
+ * - `place="start end"` // align-*: start; justify-*: end
405
+ * - `place="stretch"` // all 4 longhands: stretch
390
406
  */
391
407
  place?: CSSProperties['placeItems'] | CSSProperties['placeContent'] | string;
392
408
  /**
@@ -405,6 +421,21 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
405
421
  * - `placeItems="start end"` // start on block axis, end on inline axis
406
422
  */
407
423
  placeItems?: CSSProperties['placeItems'];
424
+ /**
425
+ * Shorthand for scroll-margin on all sides. Supports custom units and directional modifiers.
426
+ *
427
+ * Examples:
428
+ * - `scrollMargin="2x"` // scroll-margin on all sides: 2x
429
+ * - `scrollMargin="2x top"` // only top scroll-margin: 2x
430
+ * - `scrollMargin={true}` // default scroll-margin on all sides
431
+ */
432
+ scrollMargin?: CSSProperties['scrollMargin'] | string | boolean;
433
+ scrollMarginTop?: string | number | boolean;
434
+ scrollMarginRight?: string | number | boolean;
435
+ scrollMarginBottom?: string | number | boolean;
436
+ scrollMarginLeft?: string | number | boolean;
437
+ scrollMarginBlock?: string | number | boolean;
438
+ scrollMarginInline?: string | number | boolean;
408
439
  /**
409
440
  * Shorthand for `top`, `right`, `bottom`, and `left` offsets. Supports custom units, directional modifiers, and positioning.
410
441
  *
@@ -438,6 +469,24 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
438
469
  * - `'@properties': { '#theme': { initialValue: 'purple' } }` // syntax: '<color>' is auto-set
439
470
  */
440
471
  '@properties'?: Record<string, PropertyDefinition>;
472
+ /**
473
+ * Local @font-face definitions for this component.
474
+ * Keys are font-family names, values are descriptors or arrays of descriptors
475
+ * (for multiple weights/styles of the same family).
476
+ *
477
+ * Examples:
478
+ * - `'@fontFace': { Icons: { src: 'url("/fonts/icons.woff2") format("woff2")', fontDisplay: 'block' } }`
479
+ * - `'@fontFace': { 'Brand Sans': [{ src: '...', fontWeight: 400 }, { src: '...', fontWeight: 700 }] }`
480
+ */
481
+ '@fontFace'?: Record<string, FontFaceInput>;
482
+ /**
483
+ * Local @counter-style definitions for this component.
484
+ * Keys are counter-style names, values are descriptor objects.
485
+ *
486
+ * Examples:
487
+ * - `'@counterStyle': { thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' } }`
488
+ */
489
+ '@counterStyle'?: Record<string, CounterStyleDescriptors>;
441
490
  /**
442
491
  * Apply one or more predefined style recipes by name.
443
492
  * Recipes are defined globally via `configure({ recipes: { ... } })`.
@@ -458,7 +507,7 @@ type SuffixForSelector = '&' | '.' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | '
458
507
  type Selector = `${SuffixForSelector}${string}`;
459
508
  type NotSelector = Exclude<string, Selector | keyof StylesInterface>;
460
509
  /** Special style keys that should not be wrapped in StyleValue/StyleValueStateMap */
461
- type SpecialStyleKeys = '@keyframes' | '@properties' | 'recipe';
510
+ type SpecialStyleKeys = '@keyframes' | '@properties' | '@fontFace' | '@counterStyle' | 'recipe';
462
511
  type StylesWithoutSelectors = { [key in keyof StylesInterface as key extends SpecialStyleKeys ? never : key]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]> };
463
512
  /**
464
513
  * Index signature for recipe-specific arbitrary keys.
@@ -476,16 +525,20 @@ type RecipeIndexSignature = Record<string, StyleValue<string | number | boolean
476
525
  type RecipeStyles = StylesWithoutSelectors & RecipeIndexSignature & {
477
526
  '@keyframes'?: StylesInterface['@keyframes'];
478
527
  '@properties'?: StylesInterface['@properties'];
528
+ '@fontFace'?: StylesInterface['@fontFace'];
529
+ '@counterStyle'?: StylesInterface['@counterStyle'];
479
530
  };
480
531
  /** Special properties that are not regular style values */
481
532
  interface SpecialStyleProperties {
482
533
  '@keyframes'?: StylesInterface['@keyframes'];
483
534
  '@properties'?: StylesInterface['@properties'];
535
+ '@fontFace'?: StylesInterface['@fontFace'];
536
+ '@counterStyle'?: StylesInterface['@counterStyle'];
484
537
  recipe?: StylesInterface['recipe'];
485
538
  }
486
539
  /** Index signature for arbitrary style keys (sub-elements, CSS variables, etc.) */
487
540
  interface StylesIndexSignature {
488
- [key: string]: StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined> | Styles | false | StylesInterface['@keyframes'] | StylesInterface['@properties'];
541
+ [key: string]: StyleValue<string | number | boolean | undefined> | StyleValueStateMap<string | number | boolean | undefined> | Styles | false | StylesInterface['@keyframes'] | StylesInterface['@properties'] | StylesInterface['@fontFace'] | StylesInterface['@counterStyle'];
489
542
  /**
490
543
  * Selector combinator: `undefined` (descendant, default), `'>'` (child), `'+'` (adjacent), `'~'` (sibling).
491
544
  * Can chain with capitalized names: `'> Body > Row >'`. Spaces required around combinators.
@@ -493,6 +546,19 @@ interface StylesIndexSignature {
493
546
  $?: string;
494
547
  }
495
548
  type Styles = StylesWithoutSelectors & SpecialStyleProperties & StylesIndexSignature;
549
+ /**
550
+ * Value type for design tokens passed to `configure({ tokens })`.
551
+ * Can be a direct value or a state map for responsive/theme-aware tokens.
552
+ */
553
+ type ConfigTokenValue = string | number | boolean | Record<string, string | number | boolean | undefined | null | '@inherit'>;
554
+ /**
555
+ * Design tokens injected as CSS custom properties on `:root`.
556
+ * Keys must start with `$` (value tokens) or `#` (color tokens).
557
+ *
558
+ * - `$name` keys become `--name` CSS custom properties
559
+ * - `#name` keys become `--name-color` and `--name-color-{colorSpace}` properties
560
+ */
561
+ type ConfigTokens = Record<`$${string}` | `#${string}`, ConfigTokenValue>;
496
562
  //#endregion
497
- export { NoType, NotSelector, RecipeStyles, Selector, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TastyNamedColors, TastyPresetNames };
563
+ export { ConfigTokenValue, ConfigTokens, NoType, NotSelector, RecipeStyles, Selector, Styles, StylesInterface, StylesWithoutSelectors, SuffixForSelector, TastyNamedColors, TastyPresetNames };
498
564
  //# sourceMappingURL=types.d.ts.map
@@ -8,7 +8,7 @@ declare function widthStyle({
8
8
  width,
9
9
  minWidth,
10
10
  maxWidth
11
- }: WidthStyleProps): Record<string, string | string[]> | undefined;
11
+ }: WidthStyleProps): Record<string, string | string[]> | null;
12
12
  declare namespace widthStyle {
13
13
  var __lookupStyles: string[];
14
14
  }
@@ -1,5 +1,4 @@
1
1
  import { dimensionStyle } from "./dimension.js";
2
-
3
2
  //#region src/styles/width.ts
4
3
  const dimension = dimensionStyle("width");
5
4
  function widthStyle({ width, minWidth, maxWidth }) {
@@ -14,7 +13,7 @@ widthStyle.__lookupStyles = [
14
13
  "minWidth",
15
14
  "maxWidth"
16
15
  ];
17
-
18
16
  //#endregion
19
17
  export { widthStyle };
18
+
20
19
  //# sourceMappingURL=width.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"width.js","names":[],"sources":["../../src/styles/width.ts"],"sourcesContent":["import { dimensionStyle } from './dimension';\n\nconst dimension = dimensionStyle('width');\n\ninterface WidthStyleProps {\n width?: string | number | boolean;\n minWidth?: string | number | boolean;\n maxWidth?: string | number | boolean;\n}\n\nexport function widthStyle({ width, minWidth, maxWidth }: WidthStyleProps) {\n return dimension({ value: width, min: minWidth, max: maxWidth });\n}\n\nwidthStyle.__lookupStyles = ['width', 'minWidth', 'maxWidth'];\n"],"mappings":";;;AAEA,MAAM,YAAY,eAAe,QAAQ;AAQzC,SAAgB,WAAW,EAAE,OAAO,UAAU,YAA6B;AACzE,QAAO,UAAU;EAAE,OAAO;EAAO,KAAK;EAAU,KAAK;EAAU,CAAC;;AAGlE,WAAW,iBAAiB;CAAC;CAAS;CAAY;CAAW"}
1
+ {"version":3,"file":"width.js","names":[],"sources":["../../src/styles/width.ts"],"sourcesContent":["import { dimensionStyle } from './dimension';\n\nconst dimension = dimensionStyle('width');\n\ninterface WidthStyleProps {\n width?: string | number | boolean;\n minWidth?: string | number | boolean;\n maxWidth?: string | number | boolean;\n}\n\nexport function widthStyle({ width, minWidth, maxWidth }: WidthStyleProps) {\n return dimension({ value: width, min: minWidth, max: maxWidth });\n}\n\nwidthStyle.__lookupStyles = ['width', 'minWidth', 'maxWidth'];\n"],"mappings":";;AAEA,MAAM,YAAY,eAAe,QAAQ;AAQzC,SAAgB,WAAW,EAAE,OAAO,UAAU,YAA6B;AACzE,QAAO,UAAU;EAAE,OAAO;EAAO,KAAK;EAAU,KAAK;EAAU,CAAC;;AAGlE,WAAW,iBAAiB;CAAC;CAAS;CAAY;CAAW"}