@tenphi/tasty 2.0.2 → 2.0.4

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 (321) hide show
  1. package/dist/{ssr/async-storage.js → async-storage-B7_o6FKt.js} +2 -2
  2. package/dist/async-storage-B7_o6FKt.js.map +1 -0
  3. package/dist/{ssr/collector.d.ts → collector-CkZ517g4.d.ts} +3 -3
  4. package/dist/{ssr/collector.js → collector-DXqvGOb1.js} +5 -10
  5. package/dist/collector-DXqvGOb1.js.map +1 -0
  6. package/dist/config-5jzS6k6B.js +10005 -0
  7. package/dist/config-5jzS6k6B.js.map +1 -0
  8. package/dist/config-DknGsfMo.d.ts +857 -0
  9. package/dist/{ssr/context.js → context-CkSg-kDT.js} +11 -3
  10. package/dist/context-CkSg-kDT.js.map +1 -0
  11. package/dist/core/index.d.ts +5 -34
  12. package/dist/core/index.js +5 -26
  13. package/dist/core-CtU6-9OC.js +1507 -0
  14. package/dist/core-CtU6-9OC.js.map +1 -0
  15. package/dist/{zero/extractor.js → css-writer-DHkX0JuE.js} +74 -11
  16. package/dist/css-writer-DHkX0JuE.js.map +1 -0
  17. package/dist/{ssr/format-global-rules.js → format-global-rules-Dbc_1tc3.js} +2 -2
  18. package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
  19. package/dist/format-rules-DH13ewDu.js +143 -0
  20. package/dist/format-rules-DH13ewDu.js.map +1 -0
  21. package/dist/{ssr/hydrate.js → hydrate-C1Gv-DoS.js} +3 -3
  22. package/dist/hydrate-C1Gv-DoS.js.map +1 -0
  23. package/dist/{styles/types.d.ts → index-PzENbpAq.d.ts} +701 -5
  24. package/dist/index-o7zV2yCr.d.ts +1561 -0
  25. package/dist/index.d.ts +5 -51
  26. package/dist/index.js +728 -35
  27. package/dist/index.js.map +1 -0
  28. package/dist/keyframes-b7X3UxDV.js +587 -0
  29. package/dist/keyframes-b7X3UxDV.js.map +1 -0
  30. package/dist/{utils/merge-styles.d.ts → merge-styles-C7KTy7MY.d.ts} +3 -3
  31. package/dist/{utils/merge-styles.js → merge-styles-Tgo3BbL2.js} +3 -4
  32. package/dist/merge-styles-Tgo3BbL2.js.map +1 -0
  33. package/dist/{utils/resolve-recipes.js → resolve-recipes-Ca2-5CxM.js} +4 -6
  34. package/dist/resolve-recipes-Ca2-5CxM.js.map +1 -0
  35. package/dist/ssr/astro-client.js +1 -1
  36. package/dist/ssr/astro.js +4 -4
  37. package/dist/ssr/index.d.ts +44 -4
  38. package/dist/ssr/index.js +4 -4
  39. package/dist/ssr/next.d.ts +1 -1
  40. package/dist/ssr/next.js +6 -6
  41. package/dist/ssr/next.js.map +1 -1
  42. package/dist/static/index.d.ts +91 -5
  43. package/dist/static/index.js +49 -3
  44. package/dist/static/index.js.map +1 -0
  45. package/dist/zero/babel.d.ts +1 -1
  46. package/dist/zero/babel.js +10 -6
  47. package/dist/zero/babel.js.map +1 -1
  48. package/dist/zero/index.d.ts +67 -3
  49. package/dist/zero/index.js +1 -2
  50. package/docs/pipeline.md +204 -50
  51. package/package.json +3 -3
  52. package/dist/_virtual/_rolldown/runtime.js +0 -7
  53. package/dist/chunks/cacheKey.d.ts +0 -1
  54. package/dist/chunks/cacheKey.js +0 -77
  55. package/dist/chunks/cacheKey.js.map +0 -1
  56. package/dist/chunks/definitions.d.ts +0 -37
  57. package/dist/chunks/definitions.js +0 -258
  58. package/dist/chunks/definitions.js.map +0 -1
  59. package/dist/chunks/index.d.ts +0 -1
  60. package/dist/chunks/renderChunk.d.ts +0 -1
  61. package/dist/chunks/renderChunk.js +0 -59
  62. package/dist/chunks/renderChunk.js.map +0 -1
  63. package/dist/compute-styles.d.ts +0 -31
  64. package/dist/compute-styles.js +0 -322
  65. package/dist/compute-styles.js.map +0 -1
  66. package/dist/config.d.ts +0 -407
  67. package/dist/config.js +0 -591
  68. package/dist/config.js.map +0 -1
  69. package/dist/counter-style/index.js +0 -51
  70. package/dist/counter-style/index.js.map +0 -1
  71. package/dist/debug.d.ts +0 -89
  72. package/dist/debug.js +0 -453
  73. package/dist/debug.js.map +0 -1
  74. package/dist/font-face/index.js +0 -63
  75. package/dist/font-face/index.js.map +0 -1
  76. package/dist/hooks/index.d.ts +0 -7
  77. package/dist/hooks/useCounterStyle.d.ts +0 -36
  78. package/dist/hooks/useCounterStyle.js +0 -65
  79. package/dist/hooks/useCounterStyle.js.map +0 -1
  80. package/dist/hooks/useFontFace.d.ts +0 -45
  81. package/dist/hooks/useFontFace.js +0 -66
  82. package/dist/hooks/useFontFace.js.map +0 -1
  83. package/dist/hooks/useGlobalStyles.d.ts +0 -46
  84. package/dist/hooks/useGlobalStyles.js +0 -88
  85. package/dist/hooks/useGlobalStyles.js.map +0 -1
  86. package/dist/hooks/useKeyframes.d.ts +0 -58
  87. package/dist/hooks/useKeyframes.js +0 -55
  88. package/dist/hooks/useKeyframes.js.map +0 -1
  89. package/dist/hooks/useProperty.d.ts +0 -81
  90. package/dist/hooks/useProperty.js +0 -96
  91. package/dist/hooks/useProperty.js.map +0 -1
  92. package/dist/hooks/useRawCSS.d.ts +0 -22
  93. package/dist/hooks/useRawCSS.js +0 -103
  94. package/dist/hooks/useRawCSS.js.map +0 -1
  95. package/dist/hooks/useStyles.d.ts +0 -40
  96. package/dist/hooks/useStyles.js +0 -31
  97. package/dist/hooks/useStyles.js.map +0 -1
  98. package/dist/injector/index.d.ts +0 -182
  99. package/dist/injector/index.js +0 -185
  100. package/dist/injector/index.js.map +0 -1
  101. package/dist/injector/injector.d.ts +0 -198
  102. package/dist/injector/injector.js +0 -651
  103. package/dist/injector/injector.js.map +0 -1
  104. package/dist/injector/sheet-manager.d.ts +0 -132
  105. package/dist/injector/sheet-manager.js +0 -699
  106. package/dist/injector/sheet-manager.js.map +0 -1
  107. package/dist/injector/types.d.ts +0 -235
  108. package/dist/keyframes/index.js +0 -206
  109. package/dist/keyframes/index.js.map +0 -1
  110. package/dist/parser/classify.js +0 -319
  111. package/dist/parser/classify.js.map +0 -1
  112. package/dist/parser/const.js +0 -60
  113. package/dist/parser/const.js.map +0 -1
  114. package/dist/parser/lru.js +0 -109
  115. package/dist/parser/lru.js.map +0 -1
  116. package/dist/parser/parser.d.ts +0 -25
  117. package/dist/parser/parser.js +0 -115
  118. package/dist/parser/parser.js.map +0 -1
  119. package/dist/parser/tokenizer.js +0 -69
  120. package/dist/parser/tokenizer.js.map +0 -1
  121. package/dist/parser/types.d.ts +0 -51
  122. package/dist/parser/types.js +0 -46
  123. package/dist/parser/types.js.map +0 -1
  124. package/dist/pipeline/conditions.d.ts +0 -134
  125. package/dist/pipeline/conditions.js +0 -406
  126. package/dist/pipeline/conditions.js.map +0 -1
  127. package/dist/pipeline/exclusive.js +0 -382
  128. package/dist/pipeline/exclusive.js.map +0 -1
  129. package/dist/pipeline/index.d.ts +0 -55
  130. package/dist/pipeline/index.js +0 -708
  131. package/dist/pipeline/index.js.map +0 -1
  132. package/dist/pipeline/materialize.js +0 -1157
  133. package/dist/pipeline/materialize.js.map +0 -1
  134. package/dist/pipeline/parseStateKey.d.ts +0 -15
  135. package/dist/pipeline/parseStateKey.js +0 -446
  136. package/dist/pipeline/parseStateKey.js.map +0 -1
  137. package/dist/pipeline/simplify.js +0 -690
  138. package/dist/pipeline/simplify.js.map +0 -1
  139. package/dist/pipeline/warnings.js +0 -18
  140. package/dist/pipeline/warnings.js.map +0 -1
  141. package/dist/plugins/index.d.ts +0 -2
  142. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  143. package/dist/plugins/okhsl-plugin.js +0 -97
  144. package/dist/plugins/okhsl-plugin.js.map +0 -1
  145. package/dist/plugins/types.d.ts +0 -87
  146. package/dist/properties/index.js +0 -222
  147. package/dist/properties/index.js.map +0 -1
  148. package/dist/properties/property-type-resolver.d.ts +0 -24
  149. package/dist/properties/property-type-resolver.js +0 -90
  150. package/dist/properties/property-type-resolver.js.map +0 -1
  151. package/dist/rsc-cache.js +0 -79
  152. package/dist/rsc-cache.js.map +0 -1
  153. package/dist/ssr/async-storage.d.ts +0 -17
  154. package/dist/ssr/async-storage.js.map +0 -1
  155. package/dist/ssr/collect-auto-properties.js +0 -58
  156. package/dist/ssr/collect-auto-properties.js.map +0 -1
  157. package/dist/ssr/collector.js.map +0 -1
  158. package/dist/ssr/context.js.map +0 -1
  159. package/dist/ssr/format-global-rules.js.map +0 -1
  160. package/dist/ssr/format-keyframes.js +0 -69
  161. package/dist/ssr/format-keyframes.js.map +0 -1
  162. package/dist/ssr/format-property.js +0 -49
  163. package/dist/ssr/format-property.js.map +0 -1
  164. package/dist/ssr/format-rules.js +0 -73
  165. package/dist/ssr/format-rules.js.map +0 -1
  166. package/dist/ssr/hydrate.d.ts +0 -29
  167. package/dist/ssr/hydrate.js.map +0 -1
  168. package/dist/ssr/ssr-collector-ref.js +0 -29
  169. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  170. package/dist/states/index.d.ts +0 -49
  171. package/dist/states/index.js +0 -170
  172. package/dist/states/index.js.map +0 -1
  173. package/dist/static/tastyStatic.d.ts +0 -46
  174. package/dist/static/tastyStatic.js +0 -30
  175. package/dist/static/tastyStatic.js.map +0 -1
  176. package/dist/static/types.d.ts +0 -49
  177. package/dist/static/types.js +0 -24
  178. package/dist/static/types.js.map +0 -1
  179. package/dist/styles/border.d.ts +0 -25
  180. package/dist/styles/border.js +0 -120
  181. package/dist/styles/border.js.map +0 -1
  182. package/dist/styles/color.d.ts +0 -14
  183. package/dist/styles/color.js +0 -26
  184. package/dist/styles/color.js.map +0 -1
  185. package/dist/styles/const.js +0 -17
  186. package/dist/styles/const.js.map +0 -1
  187. package/dist/styles/createStyle.js +0 -79
  188. package/dist/styles/createStyle.js.map +0 -1
  189. package/dist/styles/dimension.js +0 -109
  190. package/dist/styles/dimension.js.map +0 -1
  191. package/dist/styles/directional.js +0 -133
  192. package/dist/styles/directional.js.map +0 -1
  193. package/dist/styles/display.d.ts +0 -30
  194. package/dist/styles/display.js +0 -73
  195. package/dist/styles/display.js.map +0 -1
  196. package/dist/styles/fade.d.ts +0 -15
  197. package/dist/styles/fade.js +0 -62
  198. package/dist/styles/fade.js.map +0 -1
  199. package/dist/styles/fill.d.ts +0 -42
  200. package/dist/styles/fill.js +0 -51
  201. package/dist/styles/fill.js.map +0 -1
  202. package/dist/styles/flow.d.ts +0 -16
  203. package/dist/styles/flow.js +0 -12
  204. package/dist/styles/flow.js.map +0 -1
  205. package/dist/styles/gap.d.ts +0 -31
  206. package/dist/styles/gap.js +0 -38
  207. package/dist/styles/gap.js.map +0 -1
  208. package/dist/styles/height.d.ts +0 -17
  209. package/dist/styles/height.js +0 -19
  210. package/dist/styles/height.js.map +0 -1
  211. package/dist/styles/index.d.ts +0 -1
  212. package/dist/styles/index.js +0 -8
  213. package/dist/styles/index.js.map +0 -1
  214. package/dist/styles/inset.d.ts +0 -24
  215. package/dist/styles/inset.js +0 -34
  216. package/dist/styles/inset.js.map +0 -1
  217. package/dist/styles/list.d.ts +0 -16
  218. package/dist/styles/list.js +0 -100
  219. package/dist/styles/list.js.map +0 -1
  220. package/dist/styles/margin.d.ts +0 -24
  221. package/dist/styles/margin.js +0 -32
  222. package/dist/styles/margin.js.map +0 -1
  223. package/dist/styles/outline.d.ts +0 -29
  224. package/dist/styles/outline.js +0 -55
  225. package/dist/styles/outline.js.map +0 -1
  226. package/dist/styles/padding.d.ts +0 -24
  227. package/dist/styles/padding.js +0 -32
  228. package/dist/styles/padding.js.map +0 -1
  229. package/dist/styles/placement.d.ts +0 -37
  230. package/dist/styles/placement.js +0 -74
  231. package/dist/styles/placement.js.map +0 -1
  232. package/dist/styles/predefined.d.ts +0 -71
  233. package/dist/styles/predefined.js +0 -237
  234. package/dist/styles/predefined.js.map +0 -1
  235. package/dist/styles/preset.d.ts +0 -52
  236. package/dist/styles/preset.js +0 -127
  237. package/dist/styles/preset.js.map +0 -1
  238. package/dist/styles/radius.d.ts +0 -12
  239. package/dist/styles/radius.js +0 -83
  240. package/dist/styles/radius.js.map +0 -1
  241. package/dist/styles/scrollMargin.d.ts +0 -24
  242. package/dist/styles/scrollMargin.js +0 -32
  243. package/dist/styles/scrollMargin.js.map +0 -1
  244. package/dist/styles/scrollbar.d.ts +0 -25
  245. package/dist/styles/scrollbar.js +0 -51
  246. package/dist/styles/scrollbar.js.map +0 -1
  247. package/dist/styles/shadow.d.ts +0 -14
  248. package/dist/styles/shadow.js +0 -25
  249. package/dist/styles/shadow.js.map +0 -1
  250. package/dist/styles/shared.js +0 -17
  251. package/dist/styles/shared.js.map +0 -1
  252. package/dist/styles/transition.d.ts +0 -14
  253. package/dist/styles/transition.js +0 -159
  254. package/dist/styles/transition.js.map +0 -1
  255. package/dist/styles/width.d.ts +0 -17
  256. package/dist/styles/width.js +0 -19
  257. package/dist/styles/width.js.map +0 -1
  258. package/dist/tasty.d.ts +0 -134
  259. package/dist/tasty.js +0 -248
  260. package/dist/tasty.js.map +0 -1
  261. package/dist/types.d.ts +0 -184
  262. package/dist/utils/cache-wrapper.js +0 -21
  263. package/dist/utils/cache-wrapper.js.map +0 -1
  264. package/dist/utils/case-converter.js +0 -8
  265. package/dist/utils/case-converter.js.map +0 -1
  266. package/dist/utils/color-math.d.ts +0 -46
  267. package/dist/utils/color-math.js +0 -749
  268. package/dist/utils/color-math.js.map +0 -1
  269. package/dist/utils/color-space.d.ts +0 -5
  270. package/dist/utils/color-space.js +0 -228
  271. package/dist/utils/color-space.js.map +0 -1
  272. package/dist/utils/colors.d.ts +0 -5
  273. package/dist/utils/colors.js +0 -10
  274. package/dist/utils/colors.js.map +0 -1
  275. package/dist/utils/css-types.d.ts +0 -7
  276. package/dist/utils/deps-equal.js +0 -15
  277. package/dist/utils/deps-equal.js.map +0 -1
  278. package/dist/utils/dotize.d.ts +0 -26
  279. package/dist/utils/dotize.js +0 -122
  280. package/dist/utils/dotize.js.map +0 -1
  281. package/dist/utils/filter-base-props.d.ts +0 -15
  282. package/dist/utils/filter-base-props.js +0 -45
  283. package/dist/utils/filter-base-props.js.map +0 -1
  284. package/dist/utils/get-display-name.d.ts +0 -7
  285. package/dist/utils/get-display-name.js +0 -10
  286. package/dist/utils/get-display-name.js.map +0 -1
  287. package/dist/utils/has-keys.js +0 -13
  288. package/dist/utils/has-keys.js.map +0 -1
  289. package/dist/utils/hash.js +0 -14
  290. package/dist/utils/hash.js.map +0 -1
  291. package/dist/utils/is-dev-env.js +0 -19
  292. package/dist/utils/is-dev-env.js.map +0 -1
  293. package/dist/utils/is-valid-element-type.js +0 -15
  294. package/dist/utils/is-valid-element-type.js.map +0 -1
  295. package/dist/utils/merge-styles.js.map +0 -1
  296. package/dist/utils/mod-attrs.d.ts +0 -6
  297. package/dist/utils/mod-attrs.js +0 -20
  298. package/dist/utils/mod-attrs.js.map +0 -1
  299. package/dist/utils/process-tokens.d.ts +0 -17
  300. package/dist/utils/process-tokens.js +0 -83
  301. package/dist/utils/process-tokens.js.map +0 -1
  302. package/dist/utils/resolve-recipes.d.ts +0 -17
  303. package/dist/utils/resolve-recipes.js.map +0 -1
  304. package/dist/utils/selector-transform.js +0 -32
  305. package/dist/utils/selector-transform.js.map +0 -1
  306. package/dist/utils/string.js +0 -8
  307. package/dist/utils/string.js.map +0 -1
  308. package/dist/utils/styles.d.ts +0 -99
  309. package/dist/utils/styles.js +0 -220
  310. package/dist/utils/styles.js.map +0 -1
  311. package/dist/utils/typography.d.ts +0 -58
  312. package/dist/utils/typography.js +0 -51
  313. package/dist/utils/typography.js.map +0 -1
  314. package/dist/utils/warnings.d.ts +0 -16
  315. package/dist/utils/warnings.js +0 -16
  316. package/dist/utils/warnings.js.map +0 -1
  317. package/dist/zero/css-writer.d.ts +0 -45
  318. package/dist/zero/css-writer.js +0 -73
  319. package/dist/zero/css-writer.js.map +0 -1
  320. package/dist/zero/extractor.d.ts +0 -24
  321. package/dist/zero/extractor.js.map +0 -1
@@ -1,55 +0,0 @@
1
- import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
2
- import { filterMods, parseStyle } from "../utils/styles.js";
3
- import { BORDER_STYLES } from "./const.js";
4
- //#region src/styles/outline.ts
5
- /**
6
- * Generates CSS for outline property with optional offset.
7
- *
8
- * Syntax:
9
- * - `outline="2px solid #red"` - outline only
10
- * - `outline="2px solid #red / 4px"` - outline with offset (slash separator)
11
- * - `outline="2px / 4px"` - width with offset (simpler form)
12
- * - `outline={true}` - default 1ow solid outline
13
- * - `outlineOffset="4px"` - offset as separate prop (can be combined with outline)
14
- *
15
- * Priority: slash syntax in outline takes precedence over outlineOffset prop
16
- *
17
- * @return CSS properties for outline and optionally outline-offset
18
- */
19
- function outlineStyle({ outline, outlineOffset }) {
20
- const result = {};
21
- if (outline != null && outline !== false) if (typeof outline === "string" && CSS_WIDE_KEYWORDS.has(outline)) result["outline"] = outline;
22
- else {
23
- let outlineValue = outline;
24
- if (outline === true) outlineValue = "1ow";
25
- if (outline === 0) outlineValue = "0";
26
- const group = parseStyle(String(outlineValue)).groups[0];
27
- if (group) {
28
- const { parts } = group;
29
- const outlinePart = parts[0] ?? {
30
- values: [],
31
- mods: [],
32
- colors: []
33
- };
34
- const offsetPart = parts[1];
35
- const typeMods = filterMods(outlinePart.mods, BORDER_STYLES);
36
- result["outline"] = [
37
- outlinePart.values[0] || "var(--outline-width)",
38
- typeMods[0] || "solid",
39
- outlinePart.colors[0] || "var(--outline-color)"
40
- ].join(" ");
41
- if (offsetPart?.values[0]) result["outline-offset"] = offsetPart.values[0];
42
- }
43
- }
44
- if (outlineOffset != null && !result["outline-offset"]) {
45
- const offsetValue = typeof outlineOffset === "number" ? `${outlineOffset}px` : outlineOffset;
46
- result["outline-offset"] = parseStyle(offsetValue).groups[0]?.values[0] || offsetValue;
47
- }
48
- if (Object.keys(result).length === 0) return null;
49
- return result;
50
- }
51
- outlineStyle.__lookupStyles = ["outline", "outlineOffset"];
52
- //#endregion
53
- export { outlineStyle };
54
-
55
- //# sourceMappingURL=outline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"outline.js","names":[],"sources":["../../src/styles/outline.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { filterMods, parseStyle } from '../utils/styles';\nimport { BORDER_STYLES } from './const';\n\ninterface OutlineStyleProps {\n outline?: string | boolean | number;\n outlineOffset?: string | number;\n}\n\n/**\n * Generates CSS for outline property with optional offset.\n *\n * Syntax:\n * - `outline=\"2px solid #red\"` - outline only\n * - `outline=\"2px solid #red / 4px\"` - outline with offset (slash separator)\n * - `outline=\"2px / 4px\"` - width with offset (simpler form)\n * - `outline={true}` - default 1ow solid outline\n * - `outlineOffset=\"4px\"` - offset as separate prop (can be combined with outline)\n *\n * Priority: slash syntax in outline takes precedence over outlineOffset prop\n *\n * @return CSS properties for outline and optionally outline-offset\n */\nexport function outlineStyle({ outline, outlineOffset }: OutlineStyleProps) {\n const result: Record<string, string> = {};\n\n // Handle outline (0 is valid - means no outline)\n if (outline != null && outline !== false) {\n if (typeof outline === 'string' && CSS_WIDE_KEYWORDS.has(outline)) {\n result['outline'] = outline;\n } else {\n let outlineValue: string | boolean | number = outline;\n if (outline === true) outlineValue = '1ow';\n if (outline === 0) outlineValue = '0';\n\n const processed = parseStyle(String(outlineValue));\n const group = processed.groups[0];\n\n if (group) {\n const { parts } = group;\n const outlinePart = parts[0] ?? { values: [], mods: [], colors: [] };\n const offsetPart = parts[1];\n\n const typeMods = filterMods(\n outlinePart.mods,\n BORDER_STYLES as unknown as string[],\n );\n\n const value = outlinePart.values[0] || 'var(--outline-width)';\n const type = typeMods[0] || 'solid';\n const outlineColor = outlinePart.colors[0] || 'var(--outline-color)';\n\n result['outline'] = [value, type, outlineColor].join(' ');\n\n if (offsetPart?.values[0]) {\n result['outline-offset'] = offsetPart.values[0];\n }\n }\n }\n }\n\n // Handle outlineOffset prop (only if not already set by slash syntax)\n if (outlineOffset != null && !result['outline-offset']) {\n const offsetValue =\n typeof outlineOffset === 'number' ? `${outlineOffset}px` : outlineOffset;\n const processed = parseStyle(offsetValue);\n result['outline-offset'] = processed.groups[0]?.values[0] || offsetValue;\n }\n\n if (Object.keys(result).length === 0) {\n return null;\n }\n\n return result;\n}\n\noutlineStyle.__lookupStyles = ['outline', 'outlineOffset'];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,SAAgB,aAAa,EAAE,SAAS,iBAAoC;CAC1E,MAAM,SAAiC,EAAE;AAGzC,KAAI,WAAW,QAAQ,YAAY,MACjC,KAAI,OAAO,YAAY,YAAY,kBAAkB,IAAI,QAAQ,CAC/D,QAAO,aAAa;MACf;EACL,IAAI,eAA0C;AAC9C,MAAI,YAAY,KAAM,gBAAe;AACrC,MAAI,YAAY,EAAG,gBAAe;EAGlC,MAAM,QADY,WAAW,OAAO,aAAa,CAAC,CAC1B,OAAO;AAE/B,MAAI,OAAO;GACT,MAAM,EAAE,UAAU;GAClB,MAAM,cAAc,MAAM,MAAM;IAAE,QAAQ,EAAE;IAAE,MAAM,EAAE;IAAE,QAAQ,EAAE;IAAE;GACpE,MAAM,aAAa,MAAM;GAEzB,MAAM,WAAW,WACf,YAAY,MACZ,cACD;AAMD,UAAO,aAAa;IAJN,YAAY,OAAO,MAAM;IAC1B,SAAS,MAAM;IACP,YAAY,OAAO,MAAM;IAEC,CAAC,KAAK,IAAI;AAEzD,OAAI,YAAY,OAAO,GACrB,QAAO,oBAAoB,WAAW,OAAO;;;AAOrD,KAAI,iBAAiB,QAAQ,CAAC,OAAO,mBAAmB;EACtD,MAAM,cACJ,OAAO,kBAAkB,WAAW,GAAG,cAAc,MAAM;AAE7D,SAAO,oBADW,WAAW,YAAY,CACJ,OAAO,IAAI,OAAO,MAAM;;AAG/D,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EACjC,QAAO;AAGT,QAAO;;AAGT,aAAa,iBAAiB,CAAC,WAAW,gBAAgB"}
@@ -1,24 +0,0 @@
1
- //#region src/styles/padding.d.ts
2
- declare function paddingStyle({
3
- padding,
4
- paddingBlock,
5
- paddingInline,
6
- paddingTop,
7
- paddingRight,
8
- paddingBottom,
9
- paddingLeft
10
- }: {
11
- padding?: string | number | boolean;
12
- paddingBlock?: string | number | boolean;
13
- paddingInline?: string | number | boolean;
14
- paddingTop?: string | number | boolean;
15
- paddingRight?: string | number | boolean;
16
- paddingBottom?: string | number | boolean;
17
- paddingLeft?: string | number | boolean;
18
- }): Record<string, string> | null;
19
- declare namespace paddingStyle {
20
- var __lookupStyles: string[];
21
- }
22
- //#endregion
23
- export { paddingStyle };
24
- //# sourceMappingURL=padding.d.ts.map
@@ -1,32 +0,0 @@
1
- import { processDirectionalStyle } from "./directional.js";
2
- //#region src/styles/padding.ts
3
- const PADDING_CONFIG = {
4
- property: "padding",
5
- defaultValue: "var(--gap)",
6
- trueValue: "1x",
7
- defaultInit: "0"
8
- };
9
- function paddingStyle({ padding, paddingBlock, paddingInline, paddingTop, paddingRight, paddingBottom, paddingLeft }) {
10
- return processDirectionalStyle(PADDING_CONFIG, {
11
- main: padding,
12
- block: paddingBlock,
13
- inline: paddingInline,
14
- top: paddingTop,
15
- right: paddingRight,
16
- bottom: paddingBottom,
17
- left: paddingLeft
18
- });
19
- }
20
- paddingStyle.__lookupStyles = [
21
- "padding",
22
- "paddingTop",
23
- "paddingRight",
24
- "paddingBottom",
25
- "paddingLeft",
26
- "paddingBlock",
27
- "paddingInline"
28
- ];
29
- //#endregion
30
- export { paddingStyle };
31
-
32
- //# sourceMappingURL=padding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"padding.js","names":[],"sources":["../../src/styles/padding.ts"],"sourcesContent":["import { processDirectionalStyle } from './directional';\n\nconst PADDING_CONFIG = {\n property: 'padding',\n defaultValue: 'var(--gap)',\n trueValue: '1x',\n defaultInit: '0',\n} as const;\n\nexport function paddingStyle({\n padding,\n paddingBlock,\n paddingInline,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n}: {\n padding?: string | number | boolean;\n paddingBlock?: string | number | boolean;\n paddingInline?: string | number | boolean;\n paddingTop?: string | number | boolean;\n paddingRight?: string | number | boolean;\n paddingBottom?: string | number | boolean;\n paddingLeft?: string | number | boolean;\n}) {\n return processDirectionalStyle(PADDING_CONFIG, {\n main: padding,\n block: paddingBlock,\n inline: paddingInline,\n top: paddingTop,\n right: paddingRight,\n bottom: paddingBottom,\n left: paddingLeft,\n });\n}\n\npaddingStyle.__lookupStyles = [\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n];\n"],"mappings":";;AAEA,MAAM,iBAAiB;CACrB,UAAU;CACV,cAAc;CACd,WAAW;CACX,aAAa;CACd;AAED,SAAgB,aAAa,EAC3B,SACA,cACA,eACA,YACA,cACA,eACA,eASC;AACD,QAAO,wBAAwB,gBAAgB;EAC7C,MAAM;EACN,OAAO;EACP,QAAQ;EACR,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACP,CAAC;;AAGJ,aAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -1,37 +0,0 @@
1
- //#region src/styles/placement.d.ts
2
- interface PlacementStyleProps {
3
- place?: string | boolean;
4
- placeItems?: string | boolean;
5
- placeContent?: string | boolean;
6
- align?: string | boolean;
7
- justify?: string | boolean;
8
- alignItems?: string | boolean;
9
- alignContent?: string | boolean;
10
- justifyItems?: string | boolean;
11
- justifyContent?: string | boolean;
12
- }
13
- /**
14
- * Unified placement handler replacing align, justify, and place.
15
- *
16
- * Priority (later overrides earlier):
17
- * 1. place (lowest) — sets all 4 longhands
18
- * 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
19
- * 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
20
- */
21
- declare function placementStyle({
22
- place,
23
- placeItems,
24
- placeContent,
25
- align,
26
- justify,
27
- alignItems,
28
- alignContent,
29
- justifyItems,
30
- justifyContent
31
- }: PlacementStyleProps): Record<string, string> | null;
32
- declare namespace placementStyle {
33
- var __lookupStyles: string[];
34
- }
35
- //#endregion
36
- export { placementStyle };
37
- //# sourceMappingURL=placement.d.ts.map
@@ -1,74 +0,0 @@
1
- //#region src/styles/placement.ts
2
- function str(val) {
3
- if (val == null || val === false || val === "") return null;
4
- if (val === true) return "center";
5
- return String(val);
6
- }
7
- /**
8
- * Unified placement handler replacing align, justify, and place.
9
- *
10
- * Priority (later overrides earlier):
11
- * 1. place (lowest) — sets all 4 longhands
12
- * 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
13
- * 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
14
- */
15
- function placementStyle({ place, placeItems, placeContent, align, justify, alignItems, alignContent, justifyItems, justifyContent }) {
16
- const result = {};
17
- const placeVal = str(place);
18
- if (placeVal) {
19
- const parts = placeVal.split(/\s+/);
20
- const first = parts[0];
21
- const second = parts[1] || first;
22
- result["align-items"] = first;
23
- result["justify-items"] = second;
24
- result["align-content"] = first;
25
- result["justify-content"] = second;
26
- }
27
- const placeItemsVal = str(placeItems);
28
- if (placeItemsVal) {
29
- const parts = placeItemsVal.split(/\s+/);
30
- result["align-items"] = parts[0];
31
- result["justify-items"] = parts[1] || parts[0];
32
- }
33
- const placeContentVal = str(placeContent);
34
- if (placeContentVal) {
35
- const parts = placeContentVal.split(/\s+/);
36
- result["align-content"] = parts[0];
37
- result["justify-content"] = parts[1] || parts[0];
38
- }
39
- const alignVal = str(align);
40
- if (alignVal) {
41
- result["align-items"] = alignVal;
42
- result["align-content"] = alignVal;
43
- }
44
- const justifyVal = str(justify);
45
- if (justifyVal) {
46
- result["justify-items"] = justifyVal;
47
- result["justify-content"] = justifyVal;
48
- }
49
- const alignItemsVal = str(alignItems);
50
- if (alignItemsVal) result["align-items"] = alignItemsVal;
51
- const alignContentVal = str(alignContent);
52
- if (alignContentVal) result["align-content"] = alignContentVal;
53
- const justifyItemsVal = str(justifyItems);
54
- if (justifyItemsVal) result["justify-items"] = justifyItemsVal;
55
- const justifyContentVal = str(justifyContent);
56
- if (justifyContentVal) result["justify-content"] = justifyContentVal;
57
- if (Object.keys(result).length === 0) return null;
58
- return result;
59
- }
60
- placementStyle.__lookupStyles = [
61
- "place",
62
- "placeItems",
63
- "placeContent",
64
- "align",
65
- "justify",
66
- "alignItems",
67
- "alignContent",
68
- "justifyItems",
69
- "justifyContent"
70
- ];
71
- //#endregion
72
- export { placementStyle };
73
-
74
- //# sourceMappingURL=placement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"placement.js","names":[],"sources":["../../src/styles/placement.ts"],"sourcesContent":["interface PlacementStyleProps {\n place?: string | boolean;\n placeItems?: string | boolean;\n placeContent?: string | boolean;\n align?: string | boolean;\n justify?: string | boolean;\n alignItems?: string | boolean;\n alignContent?: string | boolean;\n justifyItems?: string | boolean;\n justifyContent?: string | boolean;\n}\n\nfunction str(val: string | boolean | undefined): string | null {\n if (val == null || val === false || val === '') return null;\n if (val === true) return 'center';\n\n return String(val);\n}\n\n/**\n * Unified placement handler replacing align, justify, and place.\n *\n * Priority (later overrides earlier):\n * 1. place (lowest) — sets all 4 longhands\n * 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands\n * 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand\n */\nexport function placementStyle({\n place,\n placeItems,\n placeContent,\n align,\n justify,\n alignItems,\n alignContent,\n justifyItems,\n justifyContent,\n}: PlacementStyleProps) {\n const result: Record<string, string> = {};\n\n const placeVal = str(place);\n\n if (placeVal) {\n const parts = placeVal.split(/\\s+/);\n const first = parts[0];\n const second = parts[1] || first;\n\n result['align-items'] = first;\n result['justify-items'] = second;\n result['align-content'] = first;\n result['justify-content'] = second;\n }\n\n const placeItemsVal = str(placeItems);\n\n if (placeItemsVal) {\n const parts = placeItemsVal.split(/\\s+/);\n\n result['align-items'] = parts[0];\n result['justify-items'] = parts[1] || parts[0];\n }\n\n const placeContentVal = str(placeContent);\n\n if (placeContentVal) {\n const parts = placeContentVal.split(/\\s+/);\n\n result['align-content'] = parts[0];\n result['justify-content'] = parts[1] || parts[0];\n }\n\n const alignVal = str(align);\n\n if (alignVal) {\n result['align-items'] = alignVal;\n result['align-content'] = alignVal;\n }\n\n const justifyVal = str(justify);\n\n if (justifyVal) {\n result['justify-items'] = justifyVal;\n result['justify-content'] = justifyVal;\n }\n\n const alignItemsVal = str(alignItems);\n\n if (alignItemsVal) result['align-items'] = alignItemsVal;\n\n const alignContentVal = str(alignContent);\n\n if (alignContentVal) result['align-content'] = alignContentVal;\n\n const justifyItemsVal = str(justifyItems);\n\n if (justifyItemsVal) result['justify-items'] = justifyItemsVal;\n\n const justifyContentVal = str(justifyContent);\n\n if (justifyContentVal) result['justify-content'] = justifyContentVal;\n\n if (Object.keys(result).length === 0) return null;\n\n return result;\n}\n\nplacementStyle.__lookupStyles = [\n 'place',\n 'placeItems',\n 'placeContent',\n 'align',\n 'justify',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n];\n"],"mappings":";AAYA,SAAS,IAAI,KAAkD;AAC7D,KAAI,OAAO,QAAQ,QAAQ,SAAS,QAAQ,GAAI,QAAO;AACvD,KAAI,QAAQ,KAAM,QAAO;AAEzB,QAAO,OAAO,IAAI;;;;;;;;;;AAWpB,SAAgB,eAAe,EAC7B,OACA,YACA,cACA,OACA,SACA,YACA,cACA,cACA,kBACsB;CACtB,MAAM,SAAiC,EAAE;CAEzC,MAAM,WAAW,IAAI,MAAM;AAE3B,KAAI,UAAU;EACZ,MAAM,QAAQ,SAAS,MAAM,MAAM;EACnC,MAAM,QAAQ,MAAM;EACpB,MAAM,SAAS,MAAM,MAAM;AAE3B,SAAO,iBAAiB;AACxB,SAAO,mBAAmB;AAC1B,SAAO,mBAAmB;AAC1B,SAAO,qBAAqB;;CAG9B,MAAM,gBAAgB,IAAI,WAAW;AAErC,KAAI,eAAe;EACjB,MAAM,QAAQ,cAAc,MAAM,MAAM;AAExC,SAAO,iBAAiB,MAAM;AAC9B,SAAO,mBAAmB,MAAM,MAAM,MAAM;;CAG9C,MAAM,kBAAkB,IAAI,aAAa;AAEzC,KAAI,iBAAiB;EACnB,MAAM,QAAQ,gBAAgB,MAAM,MAAM;AAE1C,SAAO,mBAAmB,MAAM;AAChC,SAAO,qBAAqB,MAAM,MAAM,MAAM;;CAGhD,MAAM,WAAW,IAAI,MAAM;AAE3B,KAAI,UAAU;AACZ,SAAO,iBAAiB;AACxB,SAAO,mBAAmB;;CAG5B,MAAM,aAAa,IAAI,QAAQ;AAE/B,KAAI,YAAY;AACd,SAAO,mBAAmB;AAC1B,SAAO,qBAAqB;;CAG9B,MAAM,gBAAgB,IAAI,WAAW;AAErC,KAAI,cAAe,QAAO,iBAAiB;CAE3C,MAAM,kBAAkB,IAAI,aAAa;AAEzC,KAAI,gBAAiB,QAAO,mBAAmB;CAE/C,MAAM,kBAAkB,IAAI,aAAa;AAEzC,KAAI,gBAAiB,QAAO,mBAAmB;CAE/C,MAAM,oBAAoB,IAAI,eAAe;AAE7C,KAAI,kBAAmB,QAAO,qBAAqB;AAEnD,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAAG,QAAO;AAE7C,QAAO;;AAGT,eAAe,iBAAiB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -1,71 +0,0 @@
1
- import { borderStyle } from "./border.js";
2
- import { colorStyle } from "./color.js";
3
- import { displayStyle } from "./display.js";
4
- import { fadeStyle } from "./fade.js";
5
- import { fillStyle, svgFillStyle } from "./fill.js";
6
- import { flowStyle } from "./flow.js";
7
- import { gapStyle } from "./gap.js";
8
- import { heightStyle } from "./height.js";
9
- import { insetStyle } from "./inset.js";
10
- import { marginStyle } from "./margin.js";
11
- import { outlineStyle } from "./outline.js";
12
- import { paddingStyle } from "./padding.js";
13
- import { placementStyle } from "./placement.js";
14
- import { presetStyle } from "./preset.js";
15
- import { radiusStyle } from "./radius.js";
16
- import { scrollMarginStyle } from "./scrollMargin.js";
17
- import { scrollbarStyle } from "./scrollbar.js";
18
- import { shadowStyle } from "./shadow.js";
19
- import { transitionStyle } from "./transition.js";
20
- import { widthStyle } from "./width.js";
21
-
22
- //#region src/styles/predefined.d.ts
23
- /**
24
- * Exported object containing wrapped predefined style handlers.
25
- * Users can import and call these to extend or delegate to built-in behavior.
26
- *
27
- * Internal handlers use *Style suffix for searchability.
28
- * External API uses short names for convenience.
29
- *
30
- * @example
31
- * ```ts
32
- * import { styleHandlers, configure } from '@tenphi/tasty';
33
- *
34
- * configure({
35
- * handlers: {
36
- * fill: ({ fill }) => {
37
- * if (fill?.startsWith('gradient:')) {
38
- * return { background: fill.slice(9) };
39
- * }
40
- * return styleHandlers.fill({ fill });
41
- * },
42
- * },
43
- * });
44
- * ```
45
- */
46
- declare const styleHandlers: {
47
- readonly border: typeof borderStyle;
48
- readonly color: typeof colorStyle;
49
- readonly display: typeof displayStyle;
50
- readonly fade: typeof fadeStyle;
51
- readonly fill: typeof fillStyle;
52
- readonly svgFill: typeof svgFillStyle;
53
- readonly flow: typeof flowStyle;
54
- readonly gap: typeof gapStyle;
55
- readonly height: typeof heightStyle;
56
- readonly inset: typeof insetStyle;
57
- readonly margin: typeof marginStyle;
58
- readonly outline: typeof outlineStyle;
59
- readonly padding: typeof paddingStyle;
60
- readonly placement: typeof placementStyle;
61
- readonly preset: typeof presetStyle;
62
- readonly radius: typeof radiusStyle;
63
- readonly scrollMargin: typeof scrollMarginStyle;
64
- readonly scrollbar: typeof scrollbarStyle;
65
- readonly shadow: typeof shadowStyle;
66
- readonly transition: typeof transitionStyle;
67
- readonly width: typeof widthStyle;
68
- };
69
- //#endregion
70
- export { styleHandlers };
71
- //# sourceMappingURL=predefined.d.ts.map
@@ -1,237 +0,0 @@
1
- import { isDevEnv } from "../utils/is-dev-env.js";
2
- import { borderStyle } from "./border.js";
3
- import { createStyle } from "./createStyle.js";
4
- import { colorStyle } from "./color.js";
5
- import { displayStyle } from "./display.js";
6
- import { fadeStyle } from "./fade.js";
7
- import { fillStyle, svgFillStyle } from "./fill.js";
8
- import { flowStyle } from "./flow.js";
9
- import { gapStyle } from "./gap.js";
10
- import { heightStyle } from "./height.js";
11
- import { insetStyle } from "./inset.js";
12
- import { marginStyle } from "./margin.js";
13
- import { outlineStyle } from "./outline.js";
14
- import { paddingStyle } from "./padding.js";
15
- import { placementStyle } from "./placement.js";
16
- import { presetStyle } from "./preset.js";
17
- import { radiusStyle } from "./radius.js";
18
- import { scrollMarginStyle } from "./scrollMargin.js";
19
- import { scrollbarStyle } from "./scrollbar.js";
20
- import { shadowStyle } from "./shadow.js";
21
- import { transitionStyle } from "./transition.js";
22
- import { widthStyle } from "./width.js";
23
- //#region src/styles/predefined.ts
24
- const devMode = isDevEnv();
25
- const columnsConverter = (val) => {
26
- if (typeof val === "number") return "minmax(1px, 1fr) ".repeat(val).trim();
27
- };
28
- const rowsConverter = (val) => {
29
- if (typeof val === "number") return "auto ".repeat(val).trim();
30
- };
31
- const STYLE_HANDLER_MAP = {};
32
- let initialHandlerMapSnapshot = null;
33
- /**
34
- * Capture a snapshot of the current STYLE_HANDLER_MAP.
35
- * Called after predefine() to preserve built-in handler state.
36
- */
37
- function captureInitialHandlerState() {
38
- initialHandlerMapSnapshot = {};
39
- for (const key of Object.keys(STYLE_HANDLER_MAP)) initialHandlerMapSnapshot[key] = [...STYLE_HANDLER_MAP[key]];
40
- }
41
- /**
42
- * Reset STYLE_HANDLER_MAP to the initial built-in state.
43
- * Called by resetConfig() to restore handlers after tests.
44
- */
45
- function resetHandlers() {
46
- if (!initialHandlerMapSnapshot) return;
47
- for (const key of Object.keys(STYLE_HANDLER_MAP)) delete STYLE_HANDLER_MAP[key];
48
- for (const key of Object.keys(initialHandlerMapSnapshot)) STYLE_HANDLER_MAP[key] = [...initialHandlerMapSnapshot[key]];
49
- }
50
- function defineCustomStyle(names, handler) {
51
- let handlerWithLookup;
52
- if (typeof names === "function") {
53
- handlerWithLookup = names;
54
- names = handlerWithLookup.__lookupStyles;
55
- } else if (handler) handlerWithLookup = Object.assign(handler, { __lookupStyles: names });
56
- else {
57
- console.warn("Tasty: incorrect custom style definition: ", names);
58
- return;
59
- }
60
- if (Array.isArray(names)) names.forEach((name) => {
61
- if (!STYLE_HANDLER_MAP[name]) STYLE_HANDLER_MAP[name] = [];
62
- STYLE_HANDLER_MAP[name].push(handlerWithLookup);
63
- });
64
- }
65
- function defineStyleAlias(styleName, cssStyleName, converter) {
66
- const styleHandler = createStyle(styleName, cssStyleName, converter);
67
- if (!STYLE_HANDLER_MAP[styleName]) STYLE_HANDLER_MAP[styleName] = [];
68
- STYLE_HANDLER_MAP[styleName].push(styleHandler);
69
- }
70
- function predefine() {
71
- defineStyleAlias("gridAreas", "grid-template-areas");
72
- defineStyleAlias("gridColumns", "grid-template-columns", columnsConverter);
73
- defineStyleAlias("gridRows", "grid-template-rows", rowsConverter);
74
- defineStyleAlias("gridTemplate", "grid-template", (val) => {
75
- if (typeof val !== "string") return;
76
- return val.split("/").map((s, i) => (i ? columnsConverter : rowsConverter)(s)).join("/");
77
- });
78
- [
79
- displayStyle,
80
- transitionStyle,
81
- fillStyle,
82
- svgFillStyle,
83
- widthStyle,
84
- marginStyle,
85
- gapStyle,
86
- flowStyle,
87
- colorStyle,
88
- heightStyle,
89
- radiusStyle,
90
- borderStyle,
91
- shadowStyle,
92
- paddingStyle,
93
- placementStyle,
94
- presetStyle,
95
- scrollMarginStyle,
96
- outlineStyle,
97
- scrollbarStyle,
98
- fadeStyle,
99
- insetStyle
100
- ].forEach((handler) => defineCustomStyle(handler));
101
- captureInitialHandlerState();
102
- return {
103
- STYLE_HANDLER_MAP,
104
- defineCustomStyle,
105
- defineStyleAlias
106
- };
107
- }
108
- /**
109
- * Normalize a handler definition to a StyleHandler with __lookupStyles.
110
- * - Function only: lookup styles inferred from key name
111
- * - [string, fn]: single lookup style
112
- * - [string[], fn]: multiple lookup styles
113
- */
114
- function normalizeHandlerDefinition(keyName, definition) {
115
- let handler;
116
- let lookupStyles;
117
- if (typeof definition === "function") {
118
- handler = definition;
119
- lookupStyles = [keyName];
120
- } else if (Array.isArray(definition)) {
121
- const [first, fn] = definition;
122
- if (typeof fn !== "function") throw new Error(`[Tasty] Invalid handler definition for "${keyName}". Tuple must have a function as the second element: [string, function] or [string[], function].`);
123
- handler = fn;
124
- if (typeof first === "string") lookupStyles = [first];
125
- else if (Array.isArray(first)) lookupStyles = first;
126
- else throw new Error(`[Tasty] Invalid handler definition for "${keyName}". First element must be a string or string array.`);
127
- } else throw new Error(`[Tasty] Invalid handler definition for "${keyName}". Expected function, [string, function], or [string[], function].`);
128
- validateHandler(keyName, handler, lookupStyles);
129
- const wrappedHandler = ((props) => handler(props));
130
- wrappedHandler.__lookupStyles = lookupStyles;
131
- return wrappedHandler;
132
- }
133
- /**
134
- * Validate a handler definition in development mode.
135
- */
136
- function validateHandler(name, handler, lookupStyles) {
137
- if (!devMode) return;
138
- if (typeof handler !== "function") console.warn(`[Tasty] Handler "${name}" is not a function. Handlers must be functions that return CSSMap, CSSMap[], or null.`);
139
- if (!lookupStyles || !Array.isArray(lookupStyles) || lookupStyles.length === 0) console.warn(`[Tasty] Handler "${name}" has invalid lookupStyles. Expected non-empty array of style names.`);
140
- }
141
- /**
142
- * Register a custom handler, replacing any existing handlers for the same lookup styles.
143
- * This is called by configure() to process user-defined handlers.
144
- *
145
- * When registering a handler for style X, any existing handler that processes X
146
- * is removed from ALL its lookup styles to prevent double-processing.
147
- * For example, if gapStyle handles ['display', 'flow', 'gap'] and a new handler
148
- * is registered for just ['gap'], gapStyle is removed from display and flow too.
149
- */
150
- function registerHandler(handler) {
151
- const lookupStyles = handler.__lookupStyles;
152
- if (!lookupStyles || lookupStyles.length === 0) {
153
- if (devMode) console.warn("[Tasty] Cannot register handler without __lookupStyles property.");
154
- return;
155
- }
156
- const handlersToRemove = /* @__PURE__ */ new Set();
157
- for (const styleName of lookupStyles) {
158
- const existing = STYLE_HANDLER_MAP[styleName];
159
- if (existing) for (const existingHandler of existing) handlersToRemove.add(existingHandler);
160
- }
161
- for (const oldHandler of handlersToRemove) {
162
- const oldLookupStyles = oldHandler.__lookupStyles;
163
- if (oldLookupStyles) for (const oldStyleName of oldLookupStyles) {
164
- const handlers = STYLE_HANDLER_MAP[oldStyleName];
165
- if (handlers) {
166
- const filtered = handlers.filter((h) => h !== oldHandler);
167
- if (filtered.length === 0) delete STYLE_HANDLER_MAP[oldStyleName];
168
- else STYLE_HANDLER_MAP[oldStyleName] = filtered;
169
- }
170
- }
171
- }
172
- for (const styleName of lookupStyles) {
173
- const existing = STYLE_HANDLER_MAP[styleName];
174
- if (existing) existing.push(handler);
175
- else STYLE_HANDLER_MAP[styleName] = [handler];
176
- }
177
- }
178
- /**
179
- * Create a wrapped handler that can be safely called by users.
180
- * The wrapper preserves __lookupStyles for proper registration.
181
- */
182
- function wrapHandler(handler) {
183
- const fn = handler;
184
- const wrapped = ((props) => fn(props));
185
- wrapped.__lookupStyles = handler.__lookupStyles;
186
- return wrapped;
187
- }
188
- /**
189
- * Exported object containing wrapped predefined style handlers.
190
- * Users can import and call these to extend or delegate to built-in behavior.
191
- *
192
- * Internal handlers use *Style suffix for searchability.
193
- * External API uses short names for convenience.
194
- *
195
- * @example
196
- * ```ts
197
- * import { styleHandlers, configure } from '@tenphi/tasty';
198
- *
199
- * configure({
200
- * handlers: {
201
- * fill: ({ fill }) => {
202
- * if (fill?.startsWith('gradient:')) {
203
- * return { background: fill.slice(9) };
204
- * }
205
- * return styleHandlers.fill({ fill });
206
- * },
207
- * },
208
- * });
209
- * ```
210
- */
211
- const styleHandlers = {
212
- border: wrapHandler(borderStyle),
213
- color: wrapHandler(colorStyle),
214
- display: wrapHandler(displayStyle),
215
- fade: wrapHandler(fadeStyle),
216
- fill: wrapHandler(fillStyle),
217
- svgFill: wrapHandler(svgFillStyle),
218
- flow: wrapHandler(flowStyle),
219
- gap: wrapHandler(gapStyle),
220
- height: wrapHandler(heightStyle),
221
- inset: wrapHandler(insetStyle),
222
- margin: wrapHandler(marginStyle),
223
- outline: wrapHandler(outlineStyle),
224
- padding: wrapHandler(paddingStyle),
225
- placement: wrapHandler(placementStyle),
226
- preset: wrapHandler(presetStyle),
227
- radius: wrapHandler(radiusStyle),
228
- scrollMargin: wrapHandler(scrollMarginStyle),
229
- scrollbar: wrapHandler(scrollbarStyle),
230
- shadow: wrapHandler(shadowStyle),
231
- transition: wrapHandler(transitionStyle),
232
- width: wrapHandler(widthStyle)
233
- };
234
- //#endregion
235
- export { normalizeHandlerDefinition, predefine, registerHandler, resetHandlers, styleHandlers };
236
-
237
- //# sourceMappingURL=predefined.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"predefined.js","names":[],"sources":["../../src/styles/predefined.ts"],"sourcesContent":["import { isDevEnv } from '../utils/is-dev-env';\nimport type {\n RawStyleHandler,\n StyleHandler,\n StyleHandlerDefinition,\n} from '../utils/styles';\n\nimport { borderStyle } from './border';\nimport { colorStyle } from './color';\nimport { createStyle } from './createStyle';\nimport { displayStyle } from './display';\nimport { fadeStyle } from './fade';\nimport { fillStyle, svgFillStyle } from './fill';\nimport { flowStyle } from './flow';\nimport { gapStyle } from './gap';\nimport { heightStyle } from './height';\nimport { insetStyle } from './inset';\nimport { marginStyle } from './margin';\nimport { outlineStyle } from './outline';\nimport { paddingStyle } from './padding';\nimport { placementStyle } from './placement';\nimport { presetStyle } from './preset';\nimport { radiusStyle } from './radius';\nimport { scrollMarginStyle } from './scrollMargin';\nimport { scrollbarStyle } from './scrollbar';\nimport { shadowStyle } from './shadow';\nimport { transitionStyle } from './transition';\nimport { widthStyle } from './width';\n\nconst devMode = isDevEnv();\n\nconst _numberConverter = (val: string | number | boolean | undefined) => {\n if (typeof val === 'number') {\n return `${val}px`;\n }\n\n return val;\n};\nconst columnsConverter = (val: string | number | boolean | undefined) => {\n if (typeof val === 'number') {\n return 'minmax(1px, 1fr) '.repeat(val).trim();\n }\n\n return;\n};\nconst rowsConverter = (val: string | number | boolean | undefined) => {\n if (typeof val === 'number') {\n return 'auto '.repeat(val).trim();\n }\n\n return;\n};\n\ntype StyleHandlerMap = Record<string, StyleHandler[]>;\n\nexport const STYLE_HANDLER_MAP: StyleHandlerMap = {};\n\n// Store initial handler state for reset functionality\nlet initialHandlerMapSnapshot: StyleHandlerMap | null = null;\n\n/**\n * Capture a snapshot of the current STYLE_HANDLER_MAP.\n * Called after predefine() to preserve built-in handler state.\n */\nfunction captureInitialHandlerState(): void {\n initialHandlerMapSnapshot = {};\n for (const key of Object.keys(STYLE_HANDLER_MAP)) {\n // Shallow copy the array - handlers themselves are immutable\n initialHandlerMapSnapshot[key] = [...STYLE_HANDLER_MAP[key]];\n }\n}\n\n/**\n * Reset STYLE_HANDLER_MAP to the initial built-in state.\n * Called by resetConfig() to restore handlers after tests.\n */\nexport function resetHandlers(): void {\n if (!initialHandlerMapSnapshot) {\n // predefine() hasn't been called yet, nothing to reset\n return;\n }\n\n // Clear current map\n for (const key of Object.keys(STYLE_HANDLER_MAP)) {\n delete STYLE_HANDLER_MAP[key];\n }\n\n // Restore initial state\n for (const key of Object.keys(initialHandlerMapSnapshot)) {\n STYLE_HANDLER_MAP[key] = [...initialHandlerMapSnapshot[key]];\n }\n}\n\nexport function defineCustomStyle(\n names: string[] | StyleHandler,\n handler?: RawStyleHandler,\n) {\n let handlerWithLookup: StyleHandler;\n\n if (typeof names === 'function') {\n handlerWithLookup = names;\n names = handlerWithLookup.__lookupStyles;\n } else if (handler) {\n handlerWithLookup = Object.assign(handler, { __lookupStyles: names });\n } else {\n console.warn('Tasty: incorrect custom style definition: ', names);\n return;\n }\n\n if (Array.isArray(names)) {\n // just to pass type checking\n names.forEach((name) => {\n if (!STYLE_HANDLER_MAP[name]) {\n STYLE_HANDLER_MAP[name] = [];\n }\n\n STYLE_HANDLER_MAP[name].push(handlerWithLookup);\n });\n }\n}\n\ntype ConverterHandler = (\n s: string | boolean | number | undefined,\n) => string | undefined;\n\nexport function defineStyleAlias(\n styleName: string,\n cssStyleName?: string,\n converter?: ConverterHandler,\n) {\n const styleHandler = createStyle(styleName, cssStyleName, converter);\n\n if (!STYLE_HANDLER_MAP[styleName]) {\n STYLE_HANDLER_MAP[styleName] = [];\n }\n\n STYLE_HANDLER_MAP[styleName].push(styleHandler);\n}\n\nexport function predefine() {\n // Style aliases\n defineStyleAlias('gridAreas', 'grid-template-areas');\n defineStyleAlias('gridColumns', 'grid-template-columns', columnsConverter);\n defineStyleAlias('gridRows', 'grid-template-rows', rowsConverter);\n defineStyleAlias(\n 'gridTemplate',\n 'grid-template',\n (val: string | boolean | number | undefined) => {\n if (typeof val !== 'string') return;\n\n return val\n .split('/')\n .map((s, i) => (i ? columnsConverter : rowsConverter)(s))\n .join('/');\n },\n );\n // Note: outlineOffset is now handled by outlineStyle\n\n [\n displayStyle,\n transitionStyle,\n fillStyle,\n svgFillStyle,\n widthStyle,\n marginStyle,\n gapStyle,\n flowStyle,\n colorStyle,\n heightStyle,\n radiusStyle,\n borderStyle,\n shadowStyle,\n paddingStyle,\n placementStyle,\n presetStyle,\n scrollMarginStyle,\n outlineStyle,\n scrollbarStyle,\n fadeStyle,\n insetStyle,\n ]\n // @ts-expect-error handler type varies across built-in style handlers\n .forEach((handler) => defineCustomStyle(handler));\n\n // Capture initial state after all built-in handlers are registered\n captureInitialHandlerState();\n\n return { STYLE_HANDLER_MAP, defineCustomStyle, defineStyleAlias };\n}\n\n// ============================================================================\n// Handler Registration API (for configure())\n// ============================================================================\n\n/**\n * Normalize a handler definition to a StyleHandler with __lookupStyles.\n * - Function only: lookup styles inferred from key name\n * - [string, fn]: single lookup style\n * - [string[], fn]: multiple lookup styles\n */\nexport function normalizeHandlerDefinition(\n keyName: string,\n definition: StyleHandlerDefinition,\n): StyleHandler {\n let handler: RawStyleHandler;\n let lookupStyles: string[];\n\n if (typeof definition === 'function') {\n // Function only - lookup styles inferred from key name\n handler = definition;\n lookupStyles = [keyName];\n } else if (Array.isArray(definition)) {\n const [first, fn] = definition;\n\n if (typeof fn !== 'function') {\n throw new Error(\n `[Tasty] Invalid handler definition for \"${keyName}\". ` +\n 'Tuple must have a function as the second element: [string, function] or [string[], function].',\n );\n }\n\n handler = fn;\n\n if (typeof first === 'string') {\n // [string, fn] - single lookup style\n lookupStyles = [first];\n } else if (Array.isArray(first)) {\n // [string[], fn] - multiple lookup styles\n lookupStyles = first;\n } else {\n throw new Error(\n `[Tasty] Invalid handler definition for \"${keyName}\". ` +\n 'First element must be a string or string array.',\n );\n }\n } else {\n throw new Error(\n `[Tasty] Invalid handler definition for \"${keyName}\". ` +\n 'Expected function, [string, function], or [string[], function].',\n );\n }\n\n // Validate handler in dev mode\n validateHandler(keyName, handler, lookupStyles);\n\n // Wrap the handler to avoid mutation issues when the same function\n // is reused for multiple handler definitions. Each registration\n // gets its own function identity with its own __lookupStyles.\n const wrappedHandler = ((props) => handler(props)) as StyleHandler;\n wrappedHandler.__lookupStyles = lookupStyles;\n\n return wrappedHandler;\n}\n\n/**\n * Validate a handler definition in development mode.\n */\nfunction validateHandler(\n name: string,\n handler: RawStyleHandler,\n lookupStyles: string[],\n): void {\n if (!devMode) return;\n\n if (typeof handler !== 'function') {\n console.warn(\n `[Tasty] Handler \"${name}\" is not a function. ` +\n 'Handlers must be functions that return CSSMap, CSSMap[], or null.',\n );\n }\n\n if (\n !lookupStyles ||\n !Array.isArray(lookupStyles) ||\n lookupStyles.length === 0\n ) {\n console.warn(\n `[Tasty] Handler \"${name}\" has invalid lookupStyles. ` +\n 'Expected non-empty array of style names.',\n );\n }\n}\n\n/**\n * Validate a handler result in development mode.\n * Call this after invoking a handler to check the return value.\n */\nexport function validateHandlerResult(name: string, result: unknown): void {\n if (!devMode) return;\n if (result === undefined || result === null) return; // void is valid\n\n // Check for empty string (migration from old pattern)\n if (result === '') {\n console.warn(\n `[Tasty] Handler \"${name}\" returned empty string. ` +\n 'Return null instead for no output.',\n );\n return;\n }\n\n // Check result is object (CSSMap or CSSMap[])\n if (typeof result !== 'object') {\n console.warn(\n `[Tasty] Handler \"${name}\" returned invalid type: ${typeof result}. ` +\n 'Expected CSSMap, CSSMap[], or null.',\n );\n }\n}\n\n/**\n * Register a custom handler, replacing any existing handlers for the same lookup styles.\n * This is called by configure() to process user-defined handlers.\n *\n * When registering a handler for style X, any existing handler that processes X\n * is removed from ALL its lookup styles to prevent double-processing.\n * For example, if gapStyle handles ['display', 'flow', 'gap'] and a new handler\n * is registered for just ['gap'], gapStyle is removed from display and flow too.\n */\nexport function registerHandler(handler: StyleHandler): void {\n const lookupStyles = handler.__lookupStyles;\n\n if (!lookupStyles || lookupStyles.length === 0) {\n if (devMode) {\n console.warn(\n '[Tasty] Cannot register handler without __lookupStyles property.',\n );\n }\n return;\n }\n\n // Find and remove existing handlers that would conflict\n // A handler conflicts if it handles any of the same styles as the new handler\n const handlersToRemove = new Set<StyleHandler>();\n\n for (const styleName of lookupStyles) {\n const existing = STYLE_HANDLER_MAP[styleName];\n if (existing) {\n for (const existingHandler of existing) {\n handlersToRemove.add(existingHandler);\n }\n }\n }\n\n // Remove conflicting handlers from ALL their lookup styles\n for (const oldHandler of handlersToRemove) {\n const oldLookupStyles = oldHandler.__lookupStyles;\n if (oldLookupStyles) {\n for (const oldStyleName of oldLookupStyles) {\n const handlers = STYLE_HANDLER_MAP[oldStyleName];\n if (handlers) {\n const filtered = handlers.filter((h) => h !== oldHandler);\n if (filtered.length === 0) {\n delete STYLE_HANDLER_MAP[oldStyleName];\n } else {\n STYLE_HANDLER_MAP[oldStyleName] = filtered;\n }\n }\n }\n }\n }\n\n // Register the new handler under its lookup styles\n for (const styleName of lookupStyles) {\n const existing = STYLE_HANDLER_MAP[styleName];\n if (existing) {\n existing.push(handler);\n } else {\n STYLE_HANDLER_MAP[styleName] = [handler];\n }\n }\n}\n\n// ============================================================================\n// Wrapped Style Handlers Export\n// ============================================================================\n\n/**\n * Create a wrapped handler that can be safely called by users.\n * The wrapper preserves __lookupStyles for proper registration.\n */\nfunction wrapHandler<T extends { __lookupStyles: string[] }>(handler: T): T {\n const fn = handler as unknown as (props: unknown) => unknown;\n const wrapped = ((props: unknown) => fn(props)) as unknown as T;\n wrapped.__lookupStyles = handler.__lookupStyles;\n return wrapped;\n}\n\n/**\n * Exported object containing wrapped predefined style handlers.\n * Users can import and call these to extend or delegate to built-in behavior.\n *\n * Internal handlers use *Style suffix for searchability.\n * External API uses short names for convenience.\n *\n * @example\n * ```ts\n * import { styleHandlers, configure } from '@tenphi/tasty';\n *\n * configure({\n * handlers: {\n * fill: ({ fill }) => {\n * if (fill?.startsWith('gradient:')) {\n * return { background: fill.slice(9) };\n * }\n * return styleHandlers.fill({ fill });\n * },\n * },\n * });\n * ```\n */\nexport const styleHandlers = {\n border: wrapHandler(borderStyle),\n color: wrapHandler(colorStyle),\n display: wrapHandler(displayStyle),\n fade: wrapHandler(fadeStyle),\n fill: wrapHandler(fillStyle),\n svgFill: wrapHandler(svgFillStyle),\n flow: wrapHandler(flowStyle),\n gap: wrapHandler(gapStyle),\n height: wrapHandler(heightStyle),\n inset: wrapHandler(insetStyle),\n margin: wrapHandler(marginStyle),\n outline: wrapHandler(outlineStyle),\n padding: wrapHandler(paddingStyle),\n placement: wrapHandler(placementStyle),\n preset: wrapHandler(presetStyle),\n radius: wrapHandler(radiusStyle),\n scrollMargin: wrapHandler(scrollMarginStyle),\n scrollbar: wrapHandler(scrollbarStyle),\n shadow: wrapHandler(shadowStyle),\n transition: wrapHandler(transitionStyle),\n width: wrapHandler(widthStyle),\n} as const;\n"],"mappings":"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"}
@@ -1,52 +0,0 @@
1
- import { Styles } from "./types.js";
2
-
3
- //#region src/styles/preset.d.ts
4
- interface PresetStyleProps {
5
- preset?: string | boolean;
6
- fontSize?: string | number;
7
- lineHeight?: string | number;
8
- textTransform?: string;
9
- letterSpacing?: string | number;
10
- fontWeight?: string | number;
11
- fontStyle?: string | boolean;
12
- fontFamily?: string;
13
- /** Alias for fontFamily with special handling for 'monospace' and boolean */
14
- font?: string | boolean;
15
- }
16
- /**
17
- * Handles typography preset and individual font properties.
18
- *
19
- * Preset syntax uses `/` to separate name from modifier:
20
- * - `preset="h1"` — name only
21
- * - `preset="h2 / strong"` — name + modifier
22
- * - `preset="bold"` — modifier-only shorthand (name defaults to `inherit`)
23
- *
24
- * When `preset` is defined, it sets up CSS custom properties for typography.
25
- * Individual font props can be used with or without `preset`:
26
- * - With `preset`: overrides the preset value for that property
27
- * - Without `preset`: outputs the CSS directly
28
- *
29
- * Number values are converted to pixels for fontSize, lineHeight, letterSpacing.
30
- * fontWeight accepts numbers directly (e.g., 400, 700).
31
- *
32
- * font vs fontFamily:
33
- * - `font` is the recommended prop with special handling (monospace, boolean, fallback)
34
- * - `fontFamily` is a direct value without special handling
35
- */
36
- declare function presetStyle({
37
- preset,
38
- fontSize,
39
- lineHeight,
40
- textTransform,
41
- letterSpacing,
42
- fontWeight,
43
- fontStyle,
44
- fontFamily,
45
- font
46
- }: PresetStyleProps): Styles | null;
47
- declare namespace presetStyle {
48
- var __lookupStyles: string[];
49
- }
50
- //#endregion
51
- export { presetStyle };
52
- //# sourceMappingURL=preset.d.ts.map