@tenphi/tasty 0.0.0-snapshot.db103fd → 0.0.0-snapshot.db2ef70

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 (376) hide show
  1. package/README.md +441 -362
  2. package/dist/babel-types-Dc5zghyE.d.ts +18 -0
  3. package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
  4. package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
  5. package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
  6. package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
  7. package/dist/chunks/collector-Cb8ah2JF.js +210 -0
  8. package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
  9. package/dist/chunks/config-engine-CMYFZYQh.js +272 -0
  10. package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
  11. package/dist/chunks/config-file-DlZXJMj8.js +25 -0
  12. package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
  13. package/dist/chunks/css-definitions-B4aWBkH3.js +910 -0
  14. package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
  15. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  16. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  17. package/dist/{debug.js → chunks/debug-D2Pu7Xhy.js} +196 -147
  18. package/dist/chunks/debug-D2Pu7Xhy.js.map +1 -0
  19. package/dist/chunks/dsl-CsFl9LGn.js +1458 -0
  20. package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
  21. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  22. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  23. package/dist/chunks/react-runtime-DHiopXCu.js +691 -0
  24. package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
  25. package/dist/chunks/runtime-engine-NGCofNXy.js +2435 -0
  26. package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
  27. package/dist/chunks/runtime-state-lZjMbvwV.js +152 -0
  28. package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +60 -56
  30. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  31. package/dist/chunks/style-engine-DnkV_4Jg.js +5602 -0
  32. package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
  33. package/dist/chunks/zero-engine-DcwaCvFs.js +310 -0
  34. package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
  35. package/dist/collector-D2OT6I2G.d.ts +164 -0
  36. package/dist/config-C4ftFxgI.d.ts +1367 -0
  37. package/dist/core/index.d.ts +5 -33
  38. package/dist/core/index.js +9 -26
  39. package/dist/hydrate-CRyjjAyl.d.ts +22 -0
  40. package/dist/index-DxQNRj50.d.ts +1964 -0
  41. package/dist/index.d.ts +5 -50
  42. package/dist/index.js +11 -35
  43. package/dist/{utils/merge-styles.d.ts → merge-styles-D39qBtox.d.ts} +3 -4
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +6 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  51. package/dist/ssr/astro-middleware-extract.js +9 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  54. package/dist/ssr/astro-middleware-static.js +7 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +18 -0
  57. package/dist/ssr/astro-middleware.js +7 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -12
  60. package/dist/ssr/astro.js +205 -48
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +2 -0
  64. package/dist/ssr/index.d.ts +17 -5
  65. package/dist/ssr/index.js +6 -7
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +64 -0
  68. package/dist/ssr/next-config.js +123 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +13 -12
  71. package/dist/ssr/next.js +38 -47
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +90 -5
  74. package/dist/static/index.js +31 -3
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +1 -2
  77. package/dist/static/inject.js.map +1 -1
  78. package/dist/types-CYQIhUg1.d.ts +1569 -0
  79. package/dist/zero/babel.d.ts +12 -121
  80. package/dist/zero/babel.js +126 -149
  81. package/dist/zero/babel.js.map +1 -1
  82. package/dist/zero/index.d.ts +136 -3
  83. package/dist/zero/index.js +25 -3
  84. package/dist/zero/index.js.map +1 -0
  85. package/dist/zero/next.d.ts +4 -5
  86. package/dist/zero/next.js +3 -38
  87. package/dist/zero/next.js.map +1 -1
  88. package/docs/README.md +23 -12
  89. package/docs/adoption.md +72 -37
  90. package/docs/ai-agents.md +259 -0
  91. package/docs/comparison.md +83 -54
  92. package/docs/configuration.md +712 -81
  93. package/docs/debug.md +39 -24
  94. package/docs/design-system.md +174 -41
  95. package/docs/dsl.md +733 -195
  96. package/docs/getting-started.md +132 -52
  97. package/docs/injector.md +197 -90
  98. package/docs/methodology.md +154 -48
  99. package/docs/migration-v3.md +285 -0
  100. package/docs/pipeline.md +768 -0
  101. package/docs/plugins.md +333 -0
  102. package/docs/react-api.md +746 -0
  103. package/docs/runtime-benchmarks.md +388 -0
  104. package/docs/ssr.md +403 -151
  105. package/docs/styles.md +248 -49
  106. package/docs/tasty-static.md +298 -118
  107. package/package.json +152 -40
  108. package/tasty.config.ts +7 -0
  109. package/dist/_virtual/_rolldown/runtime.js +0 -7
  110. package/dist/chunks/cacheKey.d.ts +0 -1
  111. package/dist/chunks/cacheKey.js +0 -77
  112. package/dist/chunks/cacheKey.js.map +0 -1
  113. package/dist/chunks/definitions.d.ts +0 -37
  114. package/dist/chunks/definitions.js +0 -258
  115. package/dist/chunks/definitions.js.map +0 -1
  116. package/dist/chunks/index.d.ts +0 -1
  117. package/dist/chunks/renderChunk.d.ts +0 -1
  118. package/dist/chunks/renderChunk.js +0 -59
  119. package/dist/chunks/renderChunk.js.map +0 -1
  120. package/dist/config.d.ts +0 -366
  121. package/dist/config.js +0 -503
  122. package/dist/config.js.map +0 -1
  123. package/dist/counter-style/index.js +0 -51
  124. package/dist/counter-style/index.js.map +0 -1
  125. package/dist/debug.d.ts +0 -89
  126. package/dist/debug.js.map +0 -1
  127. package/dist/font-face/index.js +0 -63
  128. package/dist/font-face/index.js.map +0 -1
  129. package/dist/hooks/index.d.ts +0 -7
  130. package/dist/hooks/resolve-ssr-collector.js +0 -14
  131. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  132. package/dist/hooks/useCounterStyle.d.ts +0 -50
  133. package/dist/hooks/useCounterStyle.js +0 -46
  134. package/dist/hooks/useCounterStyle.js.map +0 -1
  135. package/dist/hooks/useFontFace.d.ts +0 -43
  136. package/dist/hooks/useFontFace.js +0 -70
  137. package/dist/hooks/useFontFace.js.map +0 -1
  138. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  139. package/dist/hooks/useGlobalStyles.js +0 -78
  140. package/dist/hooks/useGlobalStyles.js.map +0 -1
  141. package/dist/hooks/useKeyframes.d.ts +0 -56
  142. package/dist/hooks/useKeyframes.js +0 -64
  143. package/dist/hooks/useKeyframes.js.map +0 -1
  144. package/dist/hooks/useProperty.d.ts +0 -79
  145. package/dist/hooks/useProperty.js +0 -109
  146. package/dist/hooks/useProperty.js.map +0 -1
  147. package/dist/hooks/useRawCSS.d.ts +0 -53
  148. package/dist/hooks/useRawCSS.js +0 -35
  149. package/dist/hooks/useRawCSS.js.map +0 -1
  150. package/dist/hooks/useStyles.d.ts +0 -45
  151. package/dist/hooks/useStyles.js +0 -237
  152. package/dist/hooks/useStyles.js.map +0 -1
  153. package/dist/injector/index.d.ts +0 -183
  154. package/dist/injector/index.js +0 -179
  155. package/dist/injector/index.js.map +0 -1
  156. package/dist/injector/injector.d.ts +0 -166
  157. package/dist/injector/injector.js +0 -464
  158. package/dist/injector/injector.js.map +0 -1
  159. package/dist/injector/sheet-manager.d.ts +0 -136
  160. package/dist/injector/sheet-manager.js +0 -733
  161. package/dist/injector/sheet-manager.js.map +0 -1
  162. package/dist/injector/types.d.ts +0 -204
  163. package/dist/keyframes/index.js +0 -206
  164. package/dist/keyframes/index.js.map +0 -1
  165. package/dist/parser/classify.js +0 -319
  166. package/dist/parser/classify.js.map +0 -1
  167. package/dist/parser/const.js +0 -49
  168. package/dist/parser/const.js.map +0 -1
  169. package/dist/parser/lru.js +0 -109
  170. package/dist/parser/lru.js.map +0 -1
  171. package/dist/parser/parser.d.ts +0 -25
  172. package/dist/parser/parser.js +0 -115
  173. package/dist/parser/parser.js.map +0 -1
  174. package/dist/parser/tokenizer.js +0 -69
  175. package/dist/parser/tokenizer.js.map +0 -1
  176. package/dist/parser/types.d.ts +0 -51
  177. package/dist/parser/types.js +0 -46
  178. package/dist/parser/types.js.map +0 -1
  179. package/dist/pipeline/conditions.d.ts +0 -134
  180. package/dist/pipeline/conditions.js +0 -406
  181. package/dist/pipeline/conditions.js.map +0 -1
  182. package/dist/pipeline/exclusive.js +0 -230
  183. package/dist/pipeline/exclusive.js.map +0 -1
  184. package/dist/pipeline/index.d.ts +0 -55
  185. package/dist/pipeline/index.js +0 -708
  186. package/dist/pipeline/index.js.map +0 -1
  187. package/dist/pipeline/materialize.js +0 -1103
  188. package/dist/pipeline/materialize.js.map +0 -1
  189. package/dist/pipeline/parseStateKey.d.ts +0 -15
  190. package/dist/pipeline/parseStateKey.js +0 -446
  191. package/dist/pipeline/parseStateKey.js.map +0 -1
  192. package/dist/pipeline/simplify.js +0 -515
  193. package/dist/pipeline/simplify.js.map +0 -1
  194. package/dist/pipeline/warnings.js +0 -18
  195. package/dist/pipeline/warnings.js.map +0 -1
  196. package/dist/plugins/index.d.ts +0 -2
  197. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  198. package/dist/plugins/okhsl-plugin.js +0 -97
  199. package/dist/plugins/okhsl-plugin.js.map +0 -1
  200. package/dist/plugins/types.d.ts +0 -76
  201. package/dist/properties/index.js +0 -222
  202. package/dist/properties/index.js.map +0 -1
  203. package/dist/properties/property-type-resolver.d.ts +0 -24
  204. package/dist/properties/property-type-resolver.js +0 -90
  205. package/dist/properties/property-type-resolver.js.map +0 -1
  206. package/dist/ssr/async-storage.d.ts +0 -17
  207. package/dist/ssr/async-storage.js +0 -34
  208. package/dist/ssr/async-storage.js.map +0 -1
  209. package/dist/ssr/collect-auto-properties.js +0 -39
  210. package/dist/ssr/collect-auto-properties.js.map +0 -1
  211. package/dist/ssr/collector.d.ts +0 -102
  212. package/dist/ssr/collector.js +0 -226
  213. package/dist/ssr/collector.js.map +0 -1
  214. package/dist/ssr/context.d.ts +0 -8
  215. package/dist/ssr/context.js +0 -13
  216. package/dist/ssr/context.js.map +0 -1
  217. package/dist/ssr/format-global-rules.js +0 -22
  218. package/dist/ssr/format-global-rules.js.map +0 -1
  219. package/dist/ssr/format-keyframes.js +0 -69
  220. package/dist/ssr/format-keyframes.js.map +0 -1
  221. package/dist/ssr/format-property.js +0 -49
  222. package/dist/ssr/format-property.js.map +0 -1
  223. package/dist/ssr/format-rules.js +0 -73
  224. package/dist/ssr/format-rules.js.map +0 -1
  225. package/dist/ssr/hydrate.d.ts +0 -22
  226. package/dist/ssr/hydrate.js +0 -49
  227. package/dist/ssr/hydrate.js.map +0 -1
  228. package/dist/ssr/ssr-collector-ref.js +0 -12
  229. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  230. package/dist/states/index.d.ts +0 -49
  231. package/dist/states/index.js +0 -170
  232. package/dist/states/index.js.map +0 -1
  233. package/dist/static/tastyStatic.d.ts +0 -46
  234. package/dist/static/tastyStatic.js +0 -30
  235. package/dist/static/tastyStatic.js.map +0 -1
  236. package/dist/static/types.d.ts +0 -49
  237. package/dist/static/types.js +0 -24
  238. package/dist/static/types.js.map +0 -1
  239. package/dist/styles/align.d.ts +0 -15
  240. package/dist/styles/align.js +0 -14
  241. package/dist/styles/align.js.map +0 -1
  242. package/dist/styles/border.d.ts +0 -25
  243. package/dist/styles/border.js +0 -113
  244. package/dist/styles/border.js.map +0 -1
  245. package/dist/styles/color.d.ts +0 -14
  246. package/dist/styles/color.js +0 -26
  247. package/dist/styles/color.js.map +0 -1
  248. package/dist/styles/createStyle.js +0 -79
  249. package/dist/styles/createStyle.js.map +0 -1
  250. package/dist/styles/dimension.js +0 -96
  251. package/dist/styles/dimension.js.map +0 -1
  252. package/dist/styles/display.d.ts +0 -37
  253. package/dist/styles/display.js +0 -66
  254. package/dist/styles/display.js.map +0 -1
  255. package/dist/styles/fade.d.ts +0 -15
  256. package/dist/styles/fade.js +0 -57
  257. package/dist/styles/fade.js.map +0 -1
  258. package/dist/styles/fill.d.ts +0 -42
  259. package/dist/styles/fill.js +0 -51
  260. package/dist/styles/fill.js.map +0 -1
  261. package/dist/styles/flow.d.ts +0 -16
  262. package/dist/styles/flow.js +0 -12
  263. package/dist/styles/flow.js.map +0 -1
  264. package/dist/styles/gap.d.ts +0 -31
  265. package/dist/styles/gap.js +0 -36
  266. package/dist/styles/gap.js.map +0 -1
  267. package/dist/styles/height.d.ts +0 -17
  268. package/dist/styles/height.js +0 -19
  269. package/dist/styles/height.js.map +0 -1
  270. package/dist/styles/index.d.ts +0 -1
  271. package/dist/styles/index.js +0 -8
  272. package/dist/styles/index.js.map +0 -1
  273. package/dist/styles/inset.d.ts +0 -52
  274. package/dist/styles/inset.js +0 -149
  275. package/dist/styles/inset.js.map +0 -1
  276. package/dist/styles/justify.d.ts +0 -15
  277. package/dist/styles/justify.js +0 -14
  278. package/dist/styles/justify.js.map +0 -1
  279. package/dist/styles/list.d.ts +0 -16
  280. package/dist/styles/list.js +0 -98
  281. package/dist/styles/list.js.map +0 -1
  282. package/dist/styles/margin.d.ts +0 -24
  283. package/dist/styles/margin.js +0 -103
  284. package/dist/styles/margin.js.map +0 -1
  285. package/dist/styles/outline.d.ts +0 -29
  286. package/dist/styles/outline.js +0 -64
  287. package/dist/styles/outline.js.map +0 -1
  288. package/dist/styles/padding.d.ts +0 -24
  289. package/dist/styles/padding.js +0 -103
  290. package/dist/styles/padding.js.map +0 -1
  291. package/dist/styles/predefined.d.ts +0 -71
  292. package/dist/styles/predefined.js +0 -237
  293. package/dist/styles/predefined.js.map +0 -1
  294. package/dist/styles/preset.d.ts +0 -52
  295. package/dist/styles/preset.js +0 -126
  296. package/dist/styles/preset.js.map +0 -1
  297. package/dist/styles/radius.d.ts +0 -12
  298. package/dist/styles/radius.js +0 -71
  299. package/dist/styles/radius.js.map +0 -1
  300. package/dist/styles/scrollbar.d.ts +0 -25
  301. package/dist/styles/scrollbar.js +0 -46
  302. package/dist/styles/scrollbar.js.map +0 -1
  303. package/dist/styles/shadow.d.ts +0 -14
  304. package/dist/styles/shadow.js +0 -23
  305. package/dist/styles/shadow.js.map +0 -1
  306. package/dist/styles/transition.d.ts +0 -14
  307. package/dist/styles/transition.js +0 -157
  308. package/dist/styles/transition.js.map +0 -1
  309. package/dist/styles/types.d.ts +0 -549
  310. package/dist/styles/width.d.ts +0 -17
  311. package/dist/styles/width.js +0 -19
  312. package/dist/styles/width.js.map +0 -1
  313. package/dist/tasty.d.ts +0 -119
  314. package/dist/tasty.js +0 -231
  315. package/dist/tasty.js.map +0 -1
  316. package/dist/types.d.ts +0 -184
  317. package/dist/utils/cache-wrapper.js +0 -21
  318. package/dist/utils/cache-wrapper.js.map +0 -1
  319. package/dist/utils/case-converter.js +0 -8
  320. package/dist/utils/case-converter.js.map +0 -1
  321. package/dist/utils/color-math.d.ts +0 -46
  322. package/dist/utils/color-math.js +0 -749
  323. package/dist/utils/color-math.js.map +0 -1
  324. package/dist/utils/color-space.d.ts +0 -5
  325. package/dist/utils/color-space.js +0 -228
  326. package/dist/utils/color-space.js.map +0 -1
  327. package/dist/utils/colors.d.ts +0 -5
  328. package/dist/utils/colors.js +0 -10
  329. package/dist/utils/colors.js.map +0 -1
  330. package/dist/utils/css-types.d.ts +0 -7
  331. package/dist/utils/dotize.d.ts +0 -26
  332. package/dist/utils/dotize.js +0 -122
  333. package/dist/utils/dotize.js.map +0 -1
  334. package/dist/utils/filter-base-props.d.ts +0 -15
  335. package/dist/utils/filter-base-props.js +0 -45
  336. package/dist/utils/filter-base-props.js.map +0 -1
  337. package/dist/utils/get-display-name.d.ts +0 -7
  338. package/dist/utils/get-display-name.js +0 -10
  339. package/dist/utils/get-display-name.js.map +0 -1
  340. package/dist/utils/has-keys.js +0 -13
  341. package/dist/utils/has-keys.js.map +0 -1
  342. package/dist/utils/is-dev-env.js +0 -19
  343. package/dist/utils/is-dev-env.js.map +0 -1
  344. package/dist/utils/is-valid-element-type.js +0 -15
  345. package/dist/utils/is-valid-element-type.js.map +0 -1
  346. package/dist/utils/merge-styles.js.map +0 -1
  347. package/dist/utils/mod-attrs.d.ts +0 -6
  348. package/dist/utils/mod-attrs.js +0 -20
  349. package/dist/utils/mod-attrs.js.map +0 -1
  350. package/dist/utils/process-tokens.d.ts +0 -21
  351. package/dist/utils/process-tokens.js +0 -90
  352. package/dist/utils/process-tokens.js.map +0 -1
  353. package/dist/utils/resolve-recipes.d.ts +0 -17
  354. package/dist/utils/resolve-recipes.js +0 -146
  355. package/dist/utils/resolve-recipes.js.map +0 -1
  356. package/dist/utils/selector-transform.js +0 -32
  357. package/dist/utils/selector-transform.js.map +0 -1
  358. package/dist/utils/string.js +0 -8
  359. package/dist/utils/string.js.map +0 -1
  360. package/dist/utils/styles.d.ts +0 -99
  361. package/dist/utils/styles.js +0 -220
  362. package/dist/utils/styles.js.map +0 -1
  363. package/dist/utils/typography.d.ts +0 -47
  364. package/dist/utils/typography.js +0 -51
  365. package/dist/utils/typography.js.map +0 -1
  366. package/dist/utils/warnings.d.ts +0 -16
  367. package/dist/utils/warnings.js +0 -16
  368. package/dist/utils/warnings.js.map +0 -1
  369. package/dist/zero/css-writer.d.ts +0 -45
  370. package/dist/zero/css-writer.js +0 -73
  371. package/dist/zero/css-writer.js.map +0 -1
  372. package/dist/zero/extractor.d.ts +0 -24
  373. package/dist/zero/extractor.js +0 -266
  374. package/dist/zero/extractor.js.map +0 -1
  375. package/docs/PIPELINE.md +0 -519
  376. package/docs/runtime.md +0 -485
@@ -0,0 +1,152 @@
1
+ import { P as DEFAULT_PROPERTIES, R as indexPropertiesByName } from "./css-definitions-B4aWBkH3.js";
2
+ //#region src/config-resources.ts
3
+ let runtimeConfig = null;
4
+ let globalFontFace = null;
5
+ let globalCounterStyle = null;
6
+ let globalFunction = null;
7
+ let globalProperties = null;
8
+ let globalConfigTokens = null;
9
+ let globalStyles = null;
10
+ let globalKeyframes = null;
11
+ const GTKEY_TOKENS = "__tasty_cfg_tokens__";
12
+ const GTKEY_FONT_FACE = "__tasty_cfg_font_face__";
13
+ const GTKEY_COUNTER_STYLE = "__tasty_cfg_counter_style__";
14
+ const GTKEY_FUNCTION = "__tasty_cfg_function__";
15
+ const GTKEY_PROPERTIES = "__tasty_cfg_properties__";
16
+ const GTKEY_GLOBAL_STYLES = "__tasty_cfg_global_styles__";
17
+ const GTKEY_KEYFRAMES = "__tasty_cfg_keyframes__";
18
+ function setOnGlobalThis(key, value) {
19
+ globalThis[key] = value;
20
+ }
21
+ function getFromGlobalThis(key) {
22
+ return globalThis[key];
23
+ }
24
+ function getRuntimeConfigState() {
25
+ return runtimeConfig;
26
+ }
27
+ function setRuntimeConfigState(config) {
28
+ runtimeConfig = config;
29
+ }
30
+ function getEffectiveProperties() {
31
+ const properties = globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES);
32
+ return properties ? {
33
+ ...DEFAULT_PROPERTIES,
34
+ ...properties
35
+ } : DEFAULT_PROPERTIES;
36
+ }
37
+ let effectivePropertyIndex = null;
38
+ function getEffectivePropertiesByName() {
39
+ const source = globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES);
40
+ if (effectivePropertyIndex && effectivePropertyIndex.source === source) return effectivePropertyIndex.index;
41
+ const index = indexPropertiesByName(getEffectiveProperties());
42
+ effectivePropertyIndex = {
43
+ source,
44
+ index
45
+ };
46
+ return index;
47
+ }
48
+ function getGlobalFontFaces() {
49
+ return globalFontFace ?? getFromGlobalThis(GTKEY_FONT_FACE) ?? null;
50
+ }
51
+ function getGlobalCounterStyles() {
52
+ return globalCounterStyle ?? getFromGlobalThis(GTKEY_COUNTER_STYLE) ?? null;
53
+ }
54
+ function getGlobalFunctions() {
55
+ return globalFunction ?? getFromGlobalThis(GTKEY_FUNCTION) ?? null;
56
+ }
57
+ function getGlobalConfigTokens() {
58
+ return globalConfigTokens ?? getFromGlobalThis(GTKEY_TOKENS) ?? null;
59
+ }
60
+ function getGlobalStyles() {
61
+ return globalStyles ?? getFromGlobalThis(GTKEY_GLOBAL_STYLES) ?? null;
62
+ }
63
+ function getGlobalKeyframes() {
64
+ return globalKeyframes ?? getFromGlobalThis(GTKEY_KEYFRAMES) ?? null;
65
+ }
66
+ function mergeGlobalProperties(properties) {
67
+ globalProperties = {
68
+ ...globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES) ?? {},
69
+ ...properties
70
+ };
71
+ setOnGlobalThis(GTKEY_PROPERTIES, globalProperties);
72
+ }
73
+ function mergeGlobalFontFaces(fontFaces) {
74
+ globalFontFace = {
75
+ ...getGlobalFontFaces() ?? {},
76
+ ...fontFaces
77
+ };
78
+ setOnGlobalThis(GTKEY_FONT_FACE, globalFontFace);
79
+ }
80
+ function mergeGlobalCounterStyles(counterStyles) {
81
+ globalCounterStyle = {
82
+ ...getGlobalCounterStyles() ?? {},
83
+ ...counterStyles
84
+ };
85
+ setOnGlobalThis(GTKEY_COUNTER_STYLE, globalCounterStyle);
86
+ }
87
+ function mergeGlobalFunctions(functions) {
88
+ globalFunction = {
89
+ ...getGlobalFunctions() ?? {},
90
+ ...functions
91
+ };
92
+ setOnGlobalThis(GTKEY_FUNCTION, globalFunction);
93
+ }
94
+ function mergeGlobalConfigTokens(styles) {
95
+ globalConfigTokens = globalConfigTokens ? {
96
+ ...globalConfigTokens,
97
+ ...styles
98
+ } : styles;
99
+ setOnGlobalThis(GTKEY_TOKENS, globalConfigTokens);
100
+ }
101
+ function mergeGlobalStyles(styles) {
102
+ if (globalStyles) for (const [selector, selectorStyles] of Object.entries(styles)) globalStyles[selector] = globalStyles[selector] ? {
103
+ ...globalStyles[selector],
104
+ ...selectorStyles
105
+ } : selectorStyles;
106
+ else globalStyles = { ...styles };
107
+ setOnGlobalThis(GTKEY_GLOBAL_STYLES, globalStyles);
108
+ }
109
+ function mergeGlobalKeyframes(keyframes) {
110
+ globalKeyframes = {
111
+ ...getGlobalKeyframes() ?? {},
112
+ ...keyframes
113
+ };
114
+ setOnGlobalThis(GTKEY_KEYFRAMES, globalKeyframes);
115
+ }
116
+ function resetConfigResources() {
117
+ runtimeConfig = null;
118
+ globalProperties = null;
119
+ globalFontFace = null;
120
+ globalCounterStyle = null;
121
+ globalFunction = null;
122
+ globalConfigTokens = null;
123
+ globalStyles = null;
124
+ globalKeyframes = null;
125
+ const globalState = globalThis;
126
+ delete globalState[GTKEY_TOKENS];
127
+ delete globalState[GTKEY_FONT_FACE];
128
+ delete globalState[GTKEY_COUNTER_STYLE];
129
+ delete globalState[GTKEY_FUNCTION];
130
+ delete globalState[GTKEY_PROPERTIES];
131
+ delete globalState[GTKEY_GLOBAL_STYLES];
132
+ delete globalState[GTKEY_KEYFRAMES];
133
+ }
134
+ //#endregion
135
+ //#region src/ssr/ssr-collector-ref.ts
136
+ const GETTER_KEY = "__tasty_ssr_collector_getter__";
137
+ let _getSSRCollector = null;
138
+ function registerSSRCollectorGetter(fn) {
139
+ _getSSRCollector = fn;
140
+ }
141
+ function registerSSRCollectorGetterGlobal(fn) {
142
+ globalThis[GETTER_KEY] = fn;
143
+ }
144
+ function getRegisteredSSRCollector() {
145
+ if (_getSSRCollector) return _getSSRCollector();
146
+ const getter = globalThis[GETTER_KEY];
147
+ return getter ? getter() : null;
148
+ }
149
+ //#endregion
150
+ export { mergeGlobalKeyframes as _, getEffectivePropertiesByName as a, resetConfigResources as b, getGlobalFontFaces as c, getGlobalStyles as d, getRuntimeConfigState as f, mergeGlobalFunctions as g, mergeGlobalFontFaces as h, getEffectiveProperties as i, getGlobalFunctions as l, mergeGlobalCounterStyles as m, registerSSRCollectorGetter as n, getGlobalConfigTokens as o, mergeGlobalConfigTokens as p, registerSSRCollectorGetterGlobal as r, getGlobalCounterStyles as s, getRegisteredSSRCollector as t, getGlobalKeyframes as u, mergeGlobalProperties as v, setRuntimeConfigState as x, mergeGlobalStyles as y };
151
+
152
+ //# sourceMappingURL=runtime-state-lZjMbvwV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-state-lZjMbvwV.js","names":[],"sources":["../../src/config-resources.ts","../../src/ssr/ssr-collector-ref.ts"],"sourcesContent":["/**\n * DOM-free storage for configured CSS resources shared by the browser runtime\n * and server collectors.\n *\n * Astro can evaluate middleware and application code in separate module\n * graphs, so resources used by SSR are mirrored on globalThis. Keeping this\n * state outside config.ts lets server-only entrypoints read it without loading\n * StyleInjector and the rest of the browser runtime.\n */\n\nimport type {\n CounterStyleDescriptors,\n FontFaceInput,\n FunctionDefinition,\n KeyframesSteps,\n PropertyDefinition,\n} from './injector/types';\nimport type { DeclaredPropertyEntry } from './properties';\nimport { indexPropertiesByName } from './properties';\nimport { DEFAULT_PROPERTIES } from './properties/defaults';\nimport type { ConfigTokens, Styles } from './styles/types';\n\ninterface RuntimeConfigState {\n namePrefix?: string;\n nonce?: string;\n}\n\nlet runtimeConfig: RuntimeConfigState | null = null;\nlet globalFontFace: Record<string, FontFaceInput> | null = null;\nlet globalCounterStyle: Record<string, CounterStyleDescriptors> | null = null;\nlet globalFunction: Record<string, FunctionDefinition> | null = null;\nlet globalProperties: Record<string, PropertyDefinition> | null = null;\nlet globalConfigTokens: ConfigTokens | null = null;\nlet globalStyles: Record<string, Styles> | null = null;\nlet globalKeyframes: Record<string, KeyframesSteps> | null = null;\n\nconst GTKEY_TOKENS = '__tasty_cfg_tokens__';\nconst GTKEY_FONT_FACE = '__tasty_cfg_font_face__';\nconst GTKEY_COUNTER_STYLE = '__tasty_cfg_counter_style__';\nconst GTKEY_FUNCTION = '__tasty_cfg_function__';\nconst GTKEY_PROPERTIES = '__tasty_cfg_properties__';\nconst GTKEY_GLOBAL_STYLES = '__tasty_cfg_global_styles__';\nconst GTKEY_KEYFRAMES = '__tasty_cfg_keyframes__';\n\nfunction setOnGlobalThis(key: string, value: unknown): void {\n (globalThis as Record<string, unknown>)[key] = value;\n}\n\nfunction getFromGlobalThis<T>(key: string): T | undefined {\n return (globalThis as Record<string, unknown>)[key] as T | undefined;\n}\n\nexport function getRuntimeConfigState(): RuntimeConfigState | null {\n return runtimeConfig;\n}\n\nexport function setRuntimeConfigState(config: RuntimeConfigState): void {\n runtimeConfig = config;\n}\n\nexport function getEffectiveProperties(): Record<string, PropertyDefinition> {\n const properties =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n return properties\n ? { ...DEFAULT_PROPERTIES, ...properties }\n : DEFAULT_PROPERTIES;\n}\n\nlet effectivePropertyIndex: {\n source: Record<string, PropertyDefinition> | null | undefined;\n index: ReadonlyMap<string, DeclaredPropertyEntry>;\n} | null = null;\n\n/**\n * The effective properties (Tasty's defaults and `configure({ properties })`)\n * keyed by the custom property each one registers — see\n * `indexPropertiesByName()`. Rebuilt only when `configure({ properties })`\n * replaces the set.\n */\nexport function getEffectivePropertiesByName(): ReadonlyMap<\n string,\n DeclaredPropertyEntry\n> {\n const source =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n\n if (effectivePropertyIndex && effectivePropertyIndex.source === source) {\n return effectivePropertyIndex.index;\n }\n\n const index = indexPropertiesByName(getEffectiveProperties());\n effectivePropertyIndex = { source, index };\n return index;\n}\n\nexport function getGlobalFontFaces(): Record<string, FontFaceInput> | null {\n return (\n globalFontFace ??\n getFromGlobalThis<Record<string, FontFaceInput>>(GTKEY_FONT_FACE) ??\n null\n );\n}\n\nexport function getGlobalCounterStyles(): Record<\n string,\n CounterStyleDescriptors\n> | null {\n return (\n globalCounterStyle ??\n getFromGlobalThis<Record<string, CounterStyleDescriptors>>(\n GTKEY_COUNTER_STYLE,\n ) ??\n null\n );\n}\n\nexport function getGlobalFunctions(): Record<\n string,\n FunctionDefinition\n> | null {\n return (\n globalFunction ??\n getFromGlobalThis<Record<string, FunctionDefinition>>(GTKEY_FUNCTION) ??\n null\n );\n}\n\nexport function getGlobalConfigTokens(): ConfigTokens | null {\n return (\n globalConfigTokens ?? getFromGlobalThis<ConfigTokens>(GTKEY_TOKENS) ?? null\n );\n}\n\nexport function getGlobalStyles(): Record<string, Styles> | null {\n return (\n globalStyles ??\n getFromGlobalThis<Record<string, Styles>>(GTKEY_GLOBAL_STYLES) ??\n null\n );\n}\n\n/**\n * Get global keyframes configuration.\n * Returns null if no keyframes configured (fast path for zero-overhead).\n */\nexport function getGlobalKeyframes(): Record<string, KeyframesSteps> | null {\n return (\n globalKeyframes ??\n getFromGlobalThis<Record<string, KeyframesSteps>>(GTKEY_KEYFRAMES) ??\n null\n );\n}\n\nexport function mergeGlobalProperties(\n properties: Record<string, PropertyDefinition>,\n): void {\n globalProperties = {\n ...(globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES) ?? {}),\n ...properties,\n };\n setOnGlobalThis(GTKEY_PROPERTIES, globalProperties);\n}\n\nexport function mergeGlobalFontFaces(\n fontFaces: Record<string, FontFaceInput>,\n): void {\n globalFontFace = { ...(getGlobalFontFaces() ?? {}), ...fontFaces };\n setOnGlobalThis(GTKEY_FONT_FACE, globalFontFace);\n}\n\nexport function mergeGlobalCounterStyles(\n counterStyles: Record<string, CounterStyleDescriptors>,\n): void {\n globalCounterStyle = {\n ...(getGlobalCounterStyles() ?? {}),\n ...counterStyles,\n };\n setOnGlobalThis(GTKEY_COUNTER_STYLE, globalCounterStyle);\n}\n\nexport function mergeGlobalFunctions(\n functions: Record<string, FunctionDefinition>,\n): void {\n globalFunction = { ...(getGlobalFunctions() ?? {}), ...functions };\n setOnGlobalThis(GTKEY_FUNCTION, globalFunction);\n}\n\nexport function mergeGlobalConfigTokens(styles: ConfigTokens): void {\n globalConfigTokens = globalConfigTokens\n ? { ...globalConfigTokens, ...styles }\n : styles;\n setOnGlobalThis(GTKEY_TOKENS, globalConfigTokens);\n}\n\nexport function mergeGlobalStyles(styles: Record<string, Styles>): void {\n if (globalStyles) {\n for (const [selector, selectorStyles] of Object.entries(styles)) {\n globalStyles[selector] = globalStyles[selector]\n ? { ...globalStyles[selector], ...selectorStyles }\n : selectorStyles;\n }\n } else {\n globalStyles = { ...styles };\n }\n setOnGlobalThis(GTKEY_GLOBAL_STYLES, globalStyles);\n}\n\nexport function mergeGlobalKeyframes(\n keyframes: Record<string, KeyframesSteps>,\n): void {\n globalKeyframes = { ...(getGlobalKeyframes() ?? {}), ...keyframes };\n setOnGlobalThis(GTKEY_KEYFRAMES, globalKeyframes);\n}\n\nexport function resetConfigResources(): void {\n runtimeConfig = null;\n globalProperties = null;\n globalFontFace = null;\n globalCounterStyle = null;\n globalFunction = null;\n globalConfigTokens = null;\n globalStyles = null;\n globalKeyframes = null;\n\n const globalState = globalThis as Record<string, unknown>;\n delete globalState[GTKEY_TOKENS];\n delete globalState[GTKEY_FONT_FACE];\n delete globalState[GTKEY_COUNTER_STYLE];\n delete globalState[GTKEY_FUNCTION];\n delete globalState[GTKEY_PROPERTIES];\n delete globalState[GTKEY_GLOBAL_STYLES];\n delete globalState[GTKEY_KEYFRAMES];\n}\n","/**\n * Global reference to the SSR collector getter function.\n *\n * This indirection avoids importing 'node:async_hooks' in the browser bundle.\n * The SSR entry point sets this ref when loaded on the server. The useStyles\n * hook calls it if set; on the client it stays null and is never called.\n *\n * Uses a module-level variable as the primary mechanism. In Next.js App\n * Router the RSC and SSR module graphs load separate copies of this module,\n * so the getter registered by TastyRegistry (SSR layer) is invisible to\n * server components (RSC layer) — which correctly fall through to inline\n * RSC styles.\n *\n * A globalThis fallback (`registerSSRCollectorGetterGlobal`) is provided\n * for frameworks like Astro where middleware and page components live in\n * different module graphs and must share the getter across them.\n */\n\nimport type { ServerStyleCollector } from './collector';\n\ntype SSRCollectorGetter = () => ServerStyleCollector | null;\n\nconst GETTER_KEY = '__tasty_ssr_collector_getter__';\n\nlet _getSSRCollector: SSRCollectorGetter | null = null;\n\n/**\n * Register the collector getter in the current module graph only.\n * Used by Next.js TastyRegistry.\n */\nexport function registerSSRCollectorGetter(fn: SSRCollectorGetter): void {\n _getSSRCollector = fn;\n}\n\n/**\n * Register the collector getter on globalThis so it is visible across\n * separate module graphs (e.g. Astro middleware ↔ page components).\n */\nexport function registerSSRCollectorGetterGlobal(fn: SSRCollectorGetter): void {\n (globalThis as Record<string, unknown>)[GETTER_KEY] = fn;\n}\n\n/**\n * Retrieve the SSR collector: module-level first, globalThis fallback.\n */\nexport function getRegisteredSSRCollector(): ServerStyleCollector | null {\n if (_getSSRCollector) return _getSSRCollector();\n const getter = (globalThis as Record<string, unknown>)[GETTER_KEY] as\n SSRCollectorGetter | undefined;\n return getter ? getter() : null;\n}\n"],"mappings":";;AA2BA,IAAI,gBAA2C;AAC/C,IAAI,iBAAuD;AAC3D,IAAI,qBAAqE;AACzE,IAAI,iBAA4D;AAChE,IAAI,mBAA8D;AAClE,IAAI,qBAA0C;AAC9C,IAAI,eAA8C;AAClD,IAAI,kBAAyD;AAE7D,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAExB,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OAAO,SAAS,OAAO,IAAI;AAC7B"}
@@ -1,37 +1,50 @@
1
- import { isDevEnv } from "./is-dev-env.js";
2
- import { isSelector } from "../pipeline/index.js";
1
+ //#region src/utils/is-dev-env.ts
2
+ function isDevEnv() {
3
+ if (typeof window !== "undefined" && window.localStorage) try {
4
+ const forceTastyDebug = window.localStorage.getItem("TASTY_DEBUG");
5
+ if (forceTastyDebug !== null && forceTastyDebug.toLowerCase() === "true") return true;
6
+ } catch {}
7
+ if (typeof process === "undefined") return false;
8
+ const nodeEnv = process.env.NODE_ENV;
9
+ return nodeEnv !== "test" && nodeEnv !== "production";
10
+ }
11
+ //#endregion
12
+ //#region src/utils/warnings.ts
13
+ const PREFIX = "[Tasty]";
14
+ const emittedWarnings = /* @__PURE__ */ new Set();
15
+ function warn(...args) {
16
+ console.warn(PREFIX, ...args);
17
+ }
18
+ function warnOnceDev(key, message) {
19
+ if (emittedWarnings.has(key)) return;
20
+ emittedWarnings.add(key);
21
+ if (!isDevEnv()) return;
22
+ console.warn(`${PREFIX} ${message}`);
23
+ }
24
+ function resetStyleWarnings() {
25
+ emittedWarnings.clear();
26
+ }
27
+ //#endregion
28
+ //#region src/utils/is-selector.ts
29
+ function isSelector(key) {
30
+ const first = key.charCodeAt(0);
31
+ return first === 38 || first === 46 || first >= 65 && first <= 90;
32
+ }
33
+ //#endregion
3
34
  //#region src/utils/merge-styles.ts
4
35
  const devMode = isDevEnv();
5
36
  const INHERIT_VALUE = "@inherit";
6
- /**
7
- * Check if a value is a state map (object, not array).
8
- */
37
+ function warnMissingInherit(key) {
38
+ if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
39
+ }
9
40
  function isStateMap(value) {
10
41
  return typeof value === "object" && value !== null && !Array.isArray(value);
11
42
  }
12
- /**
13
- * Normalize a parent value to a state map.
14
- * - Already a state map → return as-is
15
- * - Non-null, non-false primitive → wrap as `{ '': value }`
16
- * - null / undefined / false → return null (no parent to merge with)
17
- */
18
43
  function normalizeToStateMap(value) {
19
44
  if (isStateMap(value)) return value;
20
45
  if (value != null && value !== false) return { "": value };
21
46
  return null;
22
47
  }
23
- /**
24
- * Resolve a child state map against a parent value.
25
- *
26
- * Mode is determined by whether the child contains a `''` (default) key:
27
- * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions
28
- * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent
29
- *
30
- * In both modes:
31
- * - `@inherit` value → resolve from parent state map
32
- * - `null` value → remove this state from the result
33
- * - `false` value → tombstone, persists through all layers, blocks recipe
34
- */
35
48
  function resolveStateMap(parentValue, childMap) {
36
49
  const isExtend = !("" in childMap);
37
50
  const parentMap = normalizeToStateMap(parentValue);
@@ -47,49 +60,39 @@ function resolveStateMap(parentValue, childMap) {
47
60
  if (isExtend) return resolveExtendMode(parentMap, childMap);
48
61
  return resolveReplaceMode(parentMap, childMap);
49
62
  }
50
- /**
51
- * Extend mode: parent entries are preserved, child entries add/override/reposition.
52
- */
53
63
  function resolveExtendMode(parentMap, childMap) {
54
- const inheritKeys = /* @__PURE__ */ new Set();
55
- const removeKeys = /* @__PURE__ */ new Set();
56
- const overrideKeys = /* @__PURE__ */ new Map();
57
- for (const key of Object.keys(childMap)) {
58
- const val = childMap[key];
59
- if (val === INHERIT_VALUE) {
60
- if (key in parentMap) inheritKeys.add(key);
61
- else if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
62
- } else if (val === null) removeKeys.add(key);
63
- else if (key in parentMap) overrideKeys.set(key, val);
64
- }
65
64
  const result = {};
65
+ const childKeys = Object.keys(childMap);
66
+ const childKeySet = new Set(childKeys);
66
67
  for (const key of Object.keys(parentMap)) {
67
- if (removeKeys.has(key)) continue;
68
- if (inheritKeys.has(key)) continue;
69
- if (overrideKeys.has(key)) result[key] = overrideKeys.get(key);
70
- else result[key] = parentMap[key];
68
+ if (!childKeySet.has(key)) {
69
+ result[key] = parentMap[key];
70
+ continue;
71
+ }
72
+ const childValue = childMap[key];
73
+ if (childValue === null || childValue === INHERIT_VALUE) continue;
74
+ result[key] = childValue;
75
+ }
76
+ for (const key of childKeys) {
77
+ const value = childMap[key];
78
+ if (value === INHERIT_VALUE) {
79
+ if (key in parentMap) result[key] = parentMap[key];
80
+ else warnMissingInherit(key);
81
+ } else if (value !== null && !(key in parentMap)) result[key] = value;
71
82
  }
72
- for (const key of Object.keys(childMap)) if (inheritKeys.has(key)) result[key] = parentMap[key];
73
- else if (!removeKeys.has(key) && !overrideKeys.has(key) && childMap[key] !== INHERIT_VALUE) result[key] = childMap[key];
74
83
  return result;
75
84
  }
76
- /**
77
- * Replace mode: child entries define the result, `@inherit` pulls from parent.
78
- */
79
85
  function resolveReplaceMode(parentMap, childMap) {
80
86
  const result = {};
81
87
  for (const key of Object.keys(childMap)) {
82
88
  const val = childMap[key];
83
89
  if (val === INHERIT_VALUE) {
84
90
  if (key in parentMap) result[key] = parentMap[key];
85
- else if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
91
+ else warnMissingInherit(key);
86
92
  } else if (val !== null) result[key] = val;
87
93
  }
88
94
  return result;
89
95
  }
90
- /**
91
- * Merge sub-element properties with state map / null / undefined support.
92
- */
93
96
  function mergeSubElementStyles(parentSub, childSub) {
94
97
  const parent = parentSub;
95
98
  const child = childSub;
@@ -118,7 +121,7 @@ function mergeStyles(...objects) {
118
121
  ...newStyles
119
122
  };
120
123
  const newSelectorKeys = Object.keys(newStyles).filter(isSelector);
121
- const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);
124
+ const allSelectorKeys = /* @__PURE__ */ new Set([...selectorKeys, ...newSelectorKeys]);
122
125
  for (const key of allSelectorKeys) {
123
126
  const newValue = newStyles?.[key];
124
127
  if (newValue === false || newValue === null) delete resultStyles[key];
@@ -128,9 +131,10 @@ function mergeStyles(...objects) {
128
131
  for (const key of Object.keys(newStyles)) {
129
132
  if (isSelector(key)) continue;
130
133
  const newValue = newStyles[key];
131
- if (newValue === void 0) if (key in styles) resultStyles[key] = styles[key];
132
- else delete resultStyles[key];
133
- else if (newValue === null) delete resultStyles[key];
134
+ if (newValue === void 0) {
135
+ if (key in styles) resultStyles[key] = styles[key];
136
+ else delete resultStyles[key];
137
+ } else if (newValue === null) delete resultStyles[key];
134
138
  else if (isStateMap(newValue)) resultStyles[key] = resolveStateMap(styles[key], newValue);
135
139
  }
136
140
  styles = resultStyles;
@@ -140,6 +144,6 @@ function mergeStyles(...objects) {
140
144
  return styles;
141
145
  }
142
146
  //#endregion
143
- export { mergeStyles };
147
+ export { warnOnceDev as a, warn as i, isSelector as n, isDevEnv as o, resetStyleWarnings as r, mergeStyles as t };
144
148
 
145
- //# sourceMappingURL=merge-styles.js.map
149
+ //# sourceMappingURL=shared-utils-y-HjvPN4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-utils-y-HjvPN4.js","names":[],"sources":["../../src/utils/is-dev-env.ts","../../src/utils/warnings.ts","../../src/utils/is-selector.ts","../../src/utils/merge-styles.ts"],"sourcesContent":["/**\n * Check if we're in a development environment at runtime\n * Uses bracket notation to avoid bundler compilation\n * Also checks for TASTY_DEBUG localStorage setting\n */\nexport function isDevEnv(): boolean {\n // Check localStorage for DEBUG_TASTY setting (browser environment)\n if (typeof window !== 'undefined' && window.localStorage) {\n try {\n const forceTastyDebug = window.localStorage.getItem('TASTY_DEBUG');\n if (\n forceTastyDebug !== null &&\n forceTastyDebug.toLowerCase() === 'true'\n ) {\n return true;\n }\n } catch {\n // localStorage might not be available (private browsing, etc.)\n // Continue with other checks\n }\n }\n\n // Check NODE_ENV for Node.js environments\n if (typeof process === 'undefined') return false;\n\n // Use bracket notation to avoid bundler replacement\n const nodeEnv = process.env?.['NODE_ENV'];\n return nodeEnv !== 'test' && nodeEnv !== 'production';\n}\n","import { isDevEnv } from './is-dev-env';\n\nconst PREFIX = '[Tasty]';\n\n/** Warning keys already emitted, so each distinct diagnostic warns once. */\nconst emittedWarnings = new Set<string>();\n\nexport function warn(...args: unknown[]) {\n console.warn(PREFIX, ...args);\n}\n\n/** Emit a warning at most once per key. No-op outside development mode. */\nexport function warnOnceDev(key: string, message: string): void {\n if (emittedWarnings.has(key)) return;\n emittedWarnings.add(key);\n\n if (!isDevEnv()) return;\n\n console.warn(`${PREFIX} ${message}`);\n}\n\n/** Forget emitted style warnings. Called by `resetConfig()` for test isolation. */\nexport function resetStyleWarnings(): void {\n emittedWarnings.clear();\n}\n","/** Check whether a style-object key identifies a nested CSS selector. */\nexport function isSelector(key: string): boolean {\n const first = key.charCodeAt(0);\n return (\n first === 38 || // &\n first === 46 || // .\n (first >= 65 && first <= 90) // A-Z\n );\n}\n","import type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { isSelector } from './is-selector';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\nfunction warnMissingInherit(key: string): void {\n if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n}\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n const childKeys = Object.keys(childMap);\n const childKeySet = new Set(childKeys);\n for (const key of Object.keys(parentMap)) {\n if (!childKeySet.has(key)) {\n result[key] = parentMap[key];\n continue;\n }\n const childValue = childMap[key];\n if (childValue === null || childValue === INHERIT_VALUE) continue;\n result[key] = childValue;\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of childKeys) {\n const value = childMap[key];\n if (value === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else warnMissingInherit(key);\n } else if (value !== null && !(key in parentMap)) {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else warnMissingInherit(key);\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }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