@fluentic/style 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +409 -0
  4. package/atomic/atRule/counterStyle.ts +35 -0
  5. package/atomic/atRule/fontFace.ts +37 -0
  6. package/atomic/atRule/fontPaletteValues.ts +36 -0
  7. package/atomic/atRule/fontSrc.ts +13 -0
  8. package/atomic/atRule/keyframes.ts +43 -0
  9. package/atomic/atRule/positionTry.ts +73 -0
  10. package/atomic/atRule/property.ts +39 -0
  11. package/atomic/atRule/utils.ts +81 -0
  12. package/atomic/className.ts +93 -0
  13. package/atomic/debug/className/className.ts +33 -0
  14. package/atomic/debug/className/index.ts +1 -0
  15. package/atomic/debug/property/data.ts +59 -0
  16. package/atomic/debug/property/index.ts +1 -0
  17. package/atomic/debug/property/property.ts +59 -0
  18. package/atomic/debug/selector.ts +88 -0
  19. package/atomic/debug/value.ts +53 -0
  20. package/atomic/element.ts +29 -0
  21. package/atomic/layer/README.md +116 -0
  22. package/atomic/layer/index.ts +3 -0
  23. package/atomic/layer/layer.ts +95 -0
  24. package/atomic/layer/types.ts +37 -0
  25. package/atomic/layer/utils.ts +51 -0
  26. package/atomic/property/index.ts +2 -0
  27. package/atomic/property/presets.ts +34 -0
  28. package/atomic/property/property.ts +13 -0
  29. package/atomic/property/type_maps.ts +389 -0
  30. package/atomic/property/types.ts +7 -0
  31. package/atomic/rule.ts +116 -0
  32. package/atomic/theme.ts +48 -0
  33. package/atomic/token.ts +53 -0
  34. package/atomic/utils/css.ts +49 -0
  35. package/atomic/utils/debug.ts +37 -0
  36. package/atomic/utils/format.ts +192 -0
  37. package/atomic/utils/selector.ts +14 -0
  38. package/atomic/utils/types.ts +11 -0
  39. package/atomic/value/index.ts +2 -0
  40. package/atomic/value/unitless.ts +47 -0
  41. package/atomic/value/value.ts +17 -0
  42. package/atomic/var.ts +19 -0
  43. package/builder/data/check_selector.noop.ts +8 -0
  44. package/builder/data/check_selector.ts +30 -0
  45. package/builder/data/const.ts +25 -0
  46. package/builder/data/create.ts +96 -0
  47. package/builder/data/data.ts +63 -0
  48. package/builder/data/debug.ts +113 -0
  49. package/builder/data/index.ts +9 -0
  50. package/builder/data/is.ts +68 -0
  51. package/builder/data/merge/index.ts +2 -0
  52. package/builder/data/merge/scope.ts +300 -0
  53. package/builder/data/merge/style.ts +284 -0
  54. package/builder/data/merge/utils.ts +35 -0
  55. package/builder/data/selector.ts +11 -0
  56. package/builder/data/state.ts +134 -0
  57. package/builder/extract/index.ts +6 -0
  58. package/builder/extract/scope.ts +30 -0
  59. package/builder/extract/slot.ts +36 -0
  60. package/builder/extract/style.ts +89 -0
  61. package/builder/extract/theme.ts +16 -0
  62. package/builder/extract/token.ts +41 -0
  63. package/builder/extract/utils.ts +95 -0
  64. package/builder/extract/withTokens.ts +64 -0
  65. package/builder/index.ts +2 -0
  66. package/builder/style_builder.ts +234 -0
  67. package/builder/style_data.ts +81 -0
  68. package/builder/style_fns.ts +611 -0
  69. package/builder/types/alias.ts +83 -0
  70. package/builder/types/fns.ts +185 -0
  71. package/builder/types/index.ts +1 -0
  72. package/builder/types/types.ts +51 -0
  73. package/builder/utils.ts +19 -0
  74. package/compiler/compiler/cache.ts +155 -0
  75. package/compiler/compiler/compiler.ts +173 -0
  76. package/compiler/compiler/index.ts +3 -0
  77. package/compiler/compiler/types.ts +62 -0
  78. package/compiler/extract/collector.ts +25 -0
  79. package/compiler/extract/extract.ts +51 -0
  80. package/compiler/extract/index.ts +3 -0
  81. package/compiler/extract/types.ts +35 -0
  82. package/compiler/index.ts +2 -0
  83. package/compiler/transform/debug/index.ts +2 -0
  84. package/compiler/transform/debug/plugin.ts +1347 -0
  85. package/compiler/transform/debug/transform.ts +47 -0
  86. package/compiler/transform/debug/utils/debug_data.ts +187 -0
  87. package/compiler/transform/debug/utils/source_url.ts +29 -0
  88. package/compiler/transform/evaluator/evaluator.ts +1138 -0
  89. package/compiler/transform/evaluator/index.ts +3 -0
  90. package/compiler/transform/evaluator/tracer.ts +607 -0
  91. package/compiler/transform/evaluator/types.ts +22 -0
  92. package/compiler/transform/extract/chain/chain.ts +2343 -0
  93. package/compiler/transform/extract/chain/extract_chain.ts +89 -0
  94. package/compiler/transform/extract/chain/index.ts +3 -0
  95. package/compiler/transform/extract/chain/types.ts +37 -0
  96. package/compiler/transform/extract/index.ts +2 -0
  97. package/compiler/transform/extract/plugin.ts +665 -0
  98. package/compiler/transform/extract/transform.ts +45 -0
  99. package/compiler/transform/extract/utils/imports.ts +132 -0
  100. package/compiler/transform/extract/utils/replacement.ts +349 -0
  101. package/compiler/transform/extract/utils/slot.ts +186 -0
  102. package/compiler/transform/extract/utils/state.ts +48 -0
  103. package/compiler/transform/extract/utils/theme.ts +86 -0
  104. package/compiler/transform/extract/utils/token.ts +1 -0
  105. package/compiler/transform/index.ts +5 -0
  106. package/compiler/transform/syntax/index.ts +5 -0
  107. package/compiler/transform/syntax/isStaticStyleValue.ts +44 -0
  108. package/compiler/transform/syntax/isStyleChainCall.ts +16 -0
  109. package/compiler/transform/syntax/static_ids.ts +282 -0
  110. package/compiler/transform/syntax/types.ts +7 -0
  111. package/compiler/transform/syntax/utils.ts +31 -0
  112. package/compiler/transform/utils/babel.ts +100 -0
  113. package/compiler/transform/utils/import.ts +47 -0
  114. package/compiler/transform/utils/path.ts +13 -0
  115. package/compiler/transform/utils/selector.ts +252 -0
  116. package/compiler/utils/constants.ts +69 -0
  117. package/compiler/utils/file_resolver.ts +72 -0
  118. package/compiler/utils/import_source.ts +200 -0
  119. package/compiler/utils/imports.ts +24 -0
  120. package/compiler/utils/path.ts +40 -0
  121. package/compiler/utils/sourcemap.ts +61 -0
  122. package/config/build.ts +32 -0
  123. package/config/config/css.ts +32 -0
  124. package/config/config/css_extra.ts +22 -0
  125. package/config/config/debug.ts +26 -0
  126. package/config/config/dev.ts +145 -0
  127. package/config/config/runtime.ts +29 -0
  128. package/config/configure.ts +28 -0
  129. package/config/constants.ts +1 -0
  130. package/config/index.ts +2 -0
  131. package/config/types.ts +56 -0
  132. package/config/utils.ts +5 -0
  133. package/css/counterStyle.ts +20 -0
  134. package/css/fontFace.ts +25 -0
  135. package/css/fontPaletteValues.ts +20 -0
  136. package/css/index.ts +8 -0
  137. package/css/keyframes.ts +20 -0
  138. package/css/positionTry.ts +20 -0
  139. package/css/property.ts +32 -0
  140. package/css/utils.ts +56 -0
  141. package/dev/config.ts +16 -0
  142. package/dev/fns.ts +48 -0
  143. package/dev/index.ts +2 -0
  144. package/dev/trace.ts +413 -0
  145. package/dev/utils.ts +528 -0
  146. package/dist/assert-h_Zkqc4E.js +105 -0
  147. package/dist/assert-h_Zkqc4E.js.map +1 -0
  148. package/dist/className-C1Ht5Wvv.js +144 -0
  149. package/dist/className-C1Ht5Wvv.js.map +1 -0
  150. package/dist/className-DC2Cq8p3.js +251 -0
  151. package/dist/className-DC2Cq8p3.js.map +1 -0
  152. package/dist/compiler/index.mjs +2 -0
  153. package/dist/compiler-DweanHoB.mjs +6847 -0
  154. package/dist/compiler-DweanHoB.mjs.map +1 -0
  155. package/dist/config/index.js +3 -0
  156. package/dist/config-BryWDfQX.js +25 -0
  157. package/dist/config-BryWDfQX.js.map +1 -0
  158. package/dist/config-DKHXWhe1.js +1 -0
  159. package/dist/config-Di2VYYKV.js +6 -0
  160. package/dist/config-Di2VYYKV.js.map +1 -0
  161. package/dist/config-DloHOG6I.js +13 -0
  162. package/dist/config-DloHOG6I.js.map +1 -0
  163. package/dist/css-BowBszUt.js +243 -0
  164. package/dist/css-BowBszUt.js.map +1 -0
  165. package/dist/css-ByOrugEX.js +805 -0
  166. package/dist/css-ByOrugEX.js.map +1 -0
  167. package/dist/css-DcazYor9.js +235 -0
  168. package/dist/css-DcazYor9.js.map +1 -0
  169. package/dist/css.js +2 -0
  170. package/dist/css_extra-DlOnsnR1.js +8 -0
  171. package/dist/css_extra-DlOnsnR1.js.map +1 -0
  172. package/dist/css_extra-oIi3UEPK.js +8 -0
  173. package/dist/css_extra-oIi3UEPK.js.map +1 -0
  174. package/dist/data-_te7t0M4.js +473 -0
  175. package/dist/data-_te7t0M4.js.map +1 -0
  176. package/dist/debug-BAw63qX6.js +15 -0
  177. package/dist/debug-BAw63qX6.js.map +1 -0
  178. package/dist/debug-DGki_v7g.js +15 -0
  179. package/dist/debug-DGki_v7g.js.map +1 -0
  180. package/dist/debug-n2aZQBSa.js +172 -0
  181. package/dist/debug-n2aZQBSa.js.map +1 -0
  182. package/dist/dev/rsc.js +183 -0
  183. package/dist/dev/rsc.js.map +1 -0
  184. package/dist/dev-CcphAa3R.js +376 -0
  185. package/dist/dev-CcphAa3R.js.map +1 -0
  186. package/dist/dev-DfBbuLeE.js +71 -0
  187. package/dist/dev-DfBbuLeE.js.map +1 -0
  188. package/dist/dev.js +2 -0
  189. package/dist/elementMarker-Bu7gDAkE.js +800 -0
  190. package/dist/elementMarker-Bu7gDAkE.js.map +1 -0
  191. package/dist/entry/dev/css.js +3 -0
  192. package/dist/entry/dev/jsx-dev-runtime.js +3 -0
  193. package/dist/entry/dev/jsx-runtime.js +3 -0
  194. package/dist/entry/dev.js +10 -0
  195. package/dist/entry/prod/css.js +3 -0
  196. package/dist/entry/prod/extract.js +3 -0
  197. package/dist/entry/prod/jsx-dev-runtime.js +3 -0
  198. package/dist/entry/prod/jsx-runtime.js +3 -0
  199. package/dist/entry/prod/runtime.js +5 -0
  200. package/dist/entry/prod.js +1230 -0
  201. package/dist/entry/prod.js.map +1 -0
  202. package/dist/entry/rsc-dev/css.js +3 -0
  203. package/dist/entry/rsc-dev/dev.js +544 -0
  204. package/dist/entry/rsc-dev/dev.js.map +1 -0
  205. package/dist/entry/rsc-dev/jsx-dev-runtime.js +12 -0
  206. package/dist/entry/rsc-dev/jsx-dev-runtime.js.map +1 -0
  207. package/dist/entry/rsc-dev/jsx-runtime.js +3 -0
  208. package/dist/entry/rsc-dev.js +1429 -0
  209. package/dist/entry/rsc-dev.js.map +1 -0
  210. package/dist/entry/rsc-prod/css.js +3 -0
  211. package/dist/entry/rsc-prod/jsx-dev-runtime.js +3 -0
  212. package/dist/entry/rsc-prod/jsx-runtime.js +3 -0
  213. package/dist/entry/rsc-prod/runtime.js +5 -0
  214. package/dist/entry/rsc-prod.js +10 -0
  215. package/dist/extract-CzWJeQi8.js +121 -0
  216. package/dist/extract-CzWJeQi8.js.map +1 -0
  217. package/dist/extract-DEwSDJ9Z.js +2 -0
  218. package/dist/format-3nKBE_5t.js +144 -0
  219. package/dist/format-3nKBE_5t.js.map +1 -0
  220. package/dist/getClassName-BlvXHYuf.js +260 -0
  221. package/dist/getClassName-BlvXHYuf.js.map +1 -0
  222. package/dist/global-CvfmFLsK.js +11 -0
  223. package/dist/global-CvfmFLsK.js.map +1 -0
  224. package/dist/index.js +9 -0
  225. package/dist/jsx/jsx-dev-runtime.js +12 -0
  226. package/dist/jsx/jsx-dev-runtime.js.map +1 -0
  227. package/dist/jsx/jsx-dev-runtime.server.js +11 -0
  228. package/dist/jsx/jsx-dev-runtime.server.js.map +1 -0
  229. package/dist/jsx/jsx-runtime.js +13 -0
  230. package/dist/jsx/jsx-runtime.js.map +1 -0
  231. package/dist/jsx/jsx-runtime.server.js +12 -0
  232. package/dist/jsx/jsx-runtime.server.js.map +1 -0
  233. package/dist/jsx-CwTeyUxr.js +39 -0
  234. package/dist/jsx-CwTeyUxr.js.map +1 -0
  235. package/dist/jsx-D2BksHSv.js +38 -0
  236. package/dist/jsx-D2BksHSv.js.map +1 -0
  237. package/dist/jsx_dev_runtime-B6xs4by8.js +12 -0
  238. package/dist/jsx_dev_runtime-B6xs4by8.js.map +1 -0
  239. package/dist/jsx_runtime-04xfnsi7.js +13 -0
  240. package/dist/jsx_runtime-04xfnsi7.js.map +1 -0
  241. package/dist/jsx_runtime-iHLDwpcW.js +12 -0
  242. package/dist/jsx_runtime-iHLDwpcW.js.map +1 -0
  243. package/dist/layer-D1SaH07m.js +94 -0
  244. package/dist/layer-D1SaH07m.js.map +1 -0
  245. package/dist/loader-DS61nRqr.mjs +81 -0
  246. package/dist/loader-DS61nRqr.mjs.map +1 -0
  247. package/dist/misc-B9kqEb2N.mjs +360 -0
  248. package/dist/misc-B9kqEb2N.mjs.map +1 -0
  249. package/dist/plugin/farm/index.mjs +176 -0
  250. package/dist/plugin/farm/index.mjs.map +1 -0
  251. package/dist/plugin/nextjs/index.mjs +282 -0
  252. package/dist/plugin/nextjs/index.mjs.map +1 -0
  253. package/dist/plugin/nextjs/loader.mjs +162 -0
  254. package/dist/plugin/nextjs/loader.mjs.map +1 -0
  255. package/dist/plugin/parcel/index.cjs +9 -0
  256. package/dist/plugin/parcel/index.mjs +5 -0
  257. package/dist/plugin/parcel/optimizer.cjs +28 -0
  258. package/dist/plugin/parcel/optimizer.cjs.map +1 -0
  259. package/dist/plugin/parcel/optimizer.mjs +29 -0
  260. package/dist/plugin/parcel/optimizer.mjs.map +1 -0
  261. package/dist/plugin/parcel/resolver.cjs +17 -0
  262. package/dist/plugin/parcel/resolver.cjs.map +1 -0
  263. package/dist/plugin/parcel/resolver.mjs +18 -0
  264. package/dist/plugin/parcel/resolver.mjs.map +1 -0
  265. package/dist/plugin/parcel/runtime.cjs +17 -0
  266. package/dist/plugin/parcel/runtime.cjs.map +1 -0
  267. package/dist/plugin/parcel/runtime.mjs +17 -0
  268. package/dist/plugin/parcel/runtime.mjs.map +1 -0
  269. package/dist/plugin/parcel/transformer.cjs +41 -0
  270. package/dist/plugin/parcel/transformer.cjs.map +1 -0
  271. package/dist/plugin/parcel/transformer.mjs +41 -0
  272. package/dist/plugin/parcel/transformer.mjs.map +1 -0
  273. package/dist/plugin/rspack/index.mjs +11 -0
  274. package/dist/plugin/rspack/index.mjs.map +1 -0
  275. package/dist/plugin/vite/index.mjs +176 -0
  276. package/dist/plugin/vite/index.mjs.map +1 -0
  277. package/dist/plugin/webpack/index.mjs +2 -0
  278. package/dist/plugin/webpack/loader.mjs +19 -0
  279. package/dist/plugin/webpack/loader.mjs.map +1 -0
  280. package/dist/presets-Bye3ea2x.js +139 -0
  281. package/dist/presets-Bye3ea2x.js.map +1 -0
  282. package/dist/property-CnLFt5kx.js +406 -0
  283. package/dist/property-CnLFt5kx.js.map +1 -0
  284. package/dist/registry-CyIj8LYK.mjs +22 -0
  285. package/dist/registry-CyIj8LYK.mjs.map +1 -0
  286. package/dist/rules-9HSO1pxL.js +767 -0
  287. package/dist/rules-9HSO1pxL.js.map +1 -0
  288. package/dist/runtime-CYqNCiaM.js +53 -0
  289. package/dist/runtime-CYqNCiaM.js.map +1 -0
  290. package/dist/selector/index.js +3 -0
  291. package/dist/server.js +63 -0
  292. package/dist/server.js.map +1 -0
  293. package/dist/shared-BAL9peIw.cjs +7646 -0
  294. package/dist/shared-BAL9peIw.cjs.map +1 -0
  295. package/dist/shared-CCpq1zqA.mjs +132 -0
  296. package/dist/shared-CCpq1zqA.mjs.map +1 -0
  297. package/dist/sidecar-4u6GnlQG.mjs +236 -0
  298. package/dist/sidecar-4u6GnlQG.mjs.map +1 -0
  299. package/dist/style-4rFUy-zW.js +752 -0
  300. package/dist/style-4rFUy-zW.js.map +1 -0
  301. package/dist/style-B1UUqjj5.js +743 -0
  302. package/dist/style-B1UUqjj5.js.map +1 -0
  303. package/dist/style-Cw3NtvR0.js +5 -0
  304. package/dist/style-DNqQ6H-7.js +1255 -0
  305. package/dist/style-DNqQ6H-7.js.map +1 -0
  306. package/dist/styleStore-Dea_WVbr.js +2000 -0
  307. package/dist/styleStore-Dea_WVbr.js.map +1 -0
  308. package/dist/styleStore-DyNXBcUK.js +54 -0
  309. package/dist/styleStore-DyNXBcUK.js.map +1 -0
  310. package/dist/token-CKXUECuU.js +76 -0
  311. package/dist/token-CKXUECuU.js.map +1 -0
  312. package/dist/token-u_tM-mtg.js +204 -0
  313. package/dist/token-u_tM-mtg.js.map +1 -0
  314. package/dist/trace-Bu_qOqRy.js +245 -0
  315. package/dist/trace-Bu_qOqRy.js.map +1 -0
  316. package/dist/trace-CU0rvNYr.js +244 -0
  317. package/dist/trace-CU0rvNYr.js.map +1 -0
  318. package/dist/utils-BbehLOby.js +2415 -0
  319. package/dist/utils-BbehLOby.js.map +1 -0
  320. package/dist/utils-C7xfDxtM.mjs +97 -0
  321. package/dist/utils-C7xfDxtM.mjs.map +1 -0
  322. package/dist/utils-CWNHx4EC.js +170 -0
  323. package/dist/utils-CWNHx4EC.js.map +1 -0
  324. package/dist/utils-CdI6vZsP.js +37 -0
  325. package/dist/utils-CdI6vZsP.js.map +1 -0
  326. package/dist/utils-D7FAOyg6.js +129 -0
  327. package/dist/utils-D7FAOyg6.js.map +1 -0
  328. package/dist/utils-DMFgOOtA.mjs +49 -0
  329. package/dist/utils-DMFgOOtA.mjs.map +1 -0
  330. package/dist/utils.js +26 -0
  331. package/dist/utils.js.map +1 -0
  332. package/dist/value-BR4e2MKt.js +910 -0
  333. package/dist/value-BR4e2MKt.js.map +1 -0
  334. package/dist/value-E8rEv2Oe.js +136 -0
  335. package/dist/value-E8rEv2Oe.js.map +1 -0
  336. package/dist/valueRef-lshFk1Cs.js +16 -0
  337. package/dist/valueRef-lshFk1Cs.js.map +1 -0
  338. package/dist/webpack-CxS2FDYU.mjs +107 -0
  339. package/dist/webpack-CxS2FDYU.mjs.map +1 -0
  340. package/dist/withTokens-LRidu3Vc.js +95 -0
  341. package/dist/withTokens-LRidu3Vc.js.map +1 -0
  342. package/entry/dev/config.ts +2 -0
  343. package/entry/dev/css.ts +3 -0
  344. package/entry/dev/index.ts +3 -0
  345. package/entry/dev/jsx_dev_runtime.ts +3 -0
  346. package/entry/dev/jsx_runtime.ts +3 -0
  347. package/entry/prod/config.ts +2 -0
  348. package/entry/prod/css.ts +3 -0
  349. package/entry/prod/extract.ts +1 -0
  350. package/entry/prod/index.ts +3 -0
  351. package/entry/prod/jsx_dev_runtime.ts +3 -0
  352. package/entry/prod/jsx_runtime.ts +3 -0
  353. package/entry/prod/runtime.ts +14 -0
  354. package/entry/rsc_dev/config.ts +6 -0
  355. package/entry/rsc_dev/css.ts +3 -0
  356. package/entry/rsc_dev/dev.ts +5 -0
  357. package/entry/rsc_dev/index.ts +3 -0
  358. package/entry/rsc_dev/jsx_dev_runtime.ts +3 -0
  359. package/entry/rsc_dev/jsx_runtime.ts +3 -0
  360. package/entry/rsc_dev/server.ts +11 -0
  361. package/entry/rsc_prod/config.ts +6 -0
  362. package/entry/rsc_prod/css.ts +3 -0
  363. package/entry/rsc_prod/index.ts +3 -0
  364. package/entry/rsc_prod/jsx_dev_runtime.ts +3 -0
  365. package/entry/rsc_prod/jsx_runtime.ts +3 -0
  366. package/entry/rsc_prod/runtime.ts +12 -0
  367. package/entry/rsc_prod/server.ts +13 -0
  368. package/entry/shared/config.ts +5 -0
  369. package/entry/shared/dev.ts +19 -0
  370. package/entry/shared/prod.ts +4 -0
  371. package/index.ts +36 -0
  372. package/jsx/extracted/jsx_dev_runtime.ts +11 -0
  373. package/jsx/extracted/jsx_runtime.ts +12 -0
  374. package/jsx/rsc/jsx_dev_runtime.ts +11 -0
  375. package/jsx/rsc/jsx_runtime.ts +12 -0
  376. package/jsx/rsc_extracted/jsx_dev_runtime.ts +2 -0
  377. package/jsx/rsc_extracted/jsx_runtime.ts +2 -0
  378. package/jsx/runtime/jsx_dev_runtime.ts +11 -0
  379. package/jsx/runtime/jsx_runtime.ts +12 -0
  380. package/jsx/types.ts +8 -0
  381. package/jsx/utils.ts +59 -0
  382. package/package.json +298 -0
  383. package/plugin/bundler/farm/index.ts +1 -0
  384. package/plugin/bundler/farm/plugin.ts +320 -0
  385. package/plugin/bundler/parcel/config.json +19 -0
  386. package/plugin/bundler/parcel/index.ts +1 -0
  387. package/plugin/bundler/parcel/optimizer.ts +36 -0
  388. package/plugin/bundler/parcel/plugin.ts +4 -0
  389. package/plugin/bundler/parcel/resolver.ts +36 -0
  390. package/plugin/bundler/parcel/runtime.ts +23 -0
  391. package/plugin/bundler/parcel/shared.ts +234 -0
  392. package/plugin/bundler/parcel/transformer.ts +67 -0
  393. package/plugin/bundler/rspack/index.ts +1 -0
  394. package/plugin/bundler/rspack/plugin.ts +14 -0
  395. package/plugin/bundler/vite/index.ts +1 -0
  396. package/plugin/bundler/vite/plugin.ts +133 -0
  397. package/plugin/bundler/vite/state.ts +153 -0
  398. package/plugin/bundler/webpack/index.ts +1 -0
  399. package/plugin/bundler/webpack/loader.ts +19 -0
  400. package/plugin/bundler/webpack/plugin.ts +240 -0
  401. package/plugin/bundler/webpack/shared/index.ts +2 -0
  402. package/plugin/bundler/webpack/shared/loader.ts +155 -0
  403. package/plugin/bundler/webpack/shared/registry.ts +16 -0
  404. package/plugin/bundler/webpack/utils.ts +96 -0
  405. package/plugin/nextjs/constants.ts +7 -0
  406. package/plugin/nextjs/html.ts +62 -0
  407. package/plugin/nextjs/index.ts +2 -0
  408. package/plugin/nextjs/loader.ts +222 -0
  409. package/plugin/nextjs/plugin.ts +532 -0
  410. package/plugin/nextjs/types.ts +33 -0
  411. package/plugin/nextjs/utils.ts +210 -0
  412. package/plugin/utils/cache/css_cache.ts +146 -0
  413. package/plugin/utils/cache/file.ts +40 -0
  414. package/plugin/utils/cache/index.ts +2 -0
  415. package/plugin/utils/compiler.ts +94 -0
  416. package/plugin/utils/constants.ts +7 -0
  417. package/plugin/utils/cssMarker.ts +14 -0
  418. package/plugin/utils/cssOutput.ts +65 -0
  419. package/plugin/utils/filter.ts +98 -0
  420. package/plugin/utils/imports.ts +5 -0
  421. package/plugin/utils/index.ts +10 -0
  422. package/plugin/utils/injection.ts +28 -0
  423. package/plugin/utils/misc.ts +5 -0
  424. package/plugin/utils/runtimeEntry.ts +57 -0
  425. package/plugin/utils/sidecar/index.ts +1 -0
  426. package/plugin/utils/sidecar/server.ts +143 -0
  427. package/plugin/utils/sidecar/sidecar.ts +167 -0
  428. package/plugin/utils/sidecar/utils.ts +109 -0
  429. package/plugin/utils/sourcemap.ts +52 -0
  430. package/plugin/utils/virtual.ts +81 -0
  431. package/runtime/core/cache/combine.ts +102 -0
  432. package/runtime/core/cache/index.ts +5 -0
  433. package/runtime/core/cache/item.ts +231 -0
  434. package/runtime/core/cache/pool.ts +310 -0
  435. package/runtime/core/cache/prop.ts +283 -0
  436. package/runtime/core/cache/propCache.ts +62 -0
  437. package/runtime/core/cache/resolvedItem.ts +31 -0
  438. package/runtime/core/cache/result.ts +115 -0
  439. package/runtime/core/cache/stateItem.ts +208 -0
  440. package/runtime/core/cache/tokenValues.ts +150 -0
  441. package/runtime/core/cache/utils/tree.ts +57 -0
  442. package/runtime/core/cache/utils/walk.ts +24 -0
  443. package/runtime/core/className.ts +101 -0
  444. package/runtime/core/combinedStyle.ts +101 -0
  445. package/runtime/core/createTransformElement.ts +39 -0
  446. package/runtime/core/elementMarker.ts +189 -0
  447. package/runtime/core/elementMarkerData.ts +27 -0
  448. package/runtime/core/getClassName.ts +47 -0
  449. package/runtime/core/getSheetRules.ts +7 -0
  450. package/runtime/core/getToken.ts +14 -0
  451. package/runtime/core/index.ts +5 -0
  452. package/runtime/core/jsx.ts +4 -0
  453. package/runtime/core/resolveClassNameRuntime.ts +33 -0
  454. package/runtime/env.ts +7 -0
  455. package/runtime/extract/getClassName.ts +476 -0
  456. package/runtime/extract/index.ts +4 -0
  457. package/runtime/extract/jsx.ts +55 -0
  458. package/runtime/index.ts +12 -0
  459. package/runtime/rsc/constants.ts +6 -0
  460. package/runtime/rsc/dev.ts +38 -0
  461. package/runtime/rsc/getClassName.ts +98 -0
  462. package/runtime/rsc/index.ts +3 -0
  463. package/runtime/rsc/jsx.ts +4 -0
  464. package/runtime/rsc/observer.ts +238 -0
  465. package/runtime/rsc/styleStore.ts +82 -0
  466. package/runtime/sheet/element.ts +13 -0
  467. package/runtime/sheet/global-noop.ts +13 -0
  468. package/runtime/sheet/global-prod.ts +13 -0
  469. package/runtime/sheet/global.ts +13 -0
  470. package/runtime/sheet/index.ts +3 -0
  471. package/runtime/sheet/insert.ts +37 -0
  472. package/runtime/sheet/rule.ts +77 -0
  473. package/runtime/sheet/rules.ts +131 -0
  474. package/runtime/sheet/theme.ts +34 -0
  475. package/runtime/style/index.ts +3 -0
  476. package/runtime/style/scope.ts +65 -0
  477. package/runtime/style/style.ts +34 -0
  478. package/runtime/style/token.ts +1 -0
  479. package/runtime/types.ts +42 -0
  480. package/selector/assert.ts +131 -0
  481. package/selector/index.ts +5 -0
  482. package/selector/presets/default.ts +27 -0
  483. package/selector/presets/index.ts +3 -0
  484. package/selector/presets/minimal.ts +37 -0
  485. package/selector/presets/selectors.ts +85 -0
  486. package/selector/selector.ts +68 -0
  487. package/selector/types.ts +24 -0
  488. package/selector/validate.ts +91 -0
  489. package/sheet/dev/dev_layer.ts +151 -0
  490. package/sheet/dev/dev_sort.ts +249 -0
  491. package/sheet/dev/index.ts +129 -0
  492. package/sheet/dev/utils.ts +130 -0
  493. package/sheet/index.ts +4 -0
  494. package/sheet/prod.ts +109 -0
  495. package/sheet/sheet.ts +10 -0
  496. package/sheet/sourcemap.ts +70 -0
  497. package/sheet/types.ts +31 -0
  498. package/sheet/utils/dom.ts +71 -0
  499. package/sheet/utils/index.ts +4 -0
  500. package/sheet/utils/layer.ts +14 -0
  501. package/sheet/utils/noop.ts +11 -0
  502. package/sheet/utils/rule.ts +3 -0
  503. package/sheet/utils/sourcemap.ts +221 -0
  504. package/style/index.ts +9 -0
  505. package/style/keyframes.ts +40 -0
  506. package/style/style.ts +112 -0
  507. package/style/theme.ts +36 -0
  508. package/style/token.ts +101 -0
  509. package/style/tokens.ts +64 -0
  510. package/style/transform.ts +9 -0
  511. package/style/types.ts +32 -0
  512. package/style/utils/expose.ts +43 -0
  513. package/style/utils/index.ts +1 -0
  514. package/style/value.ts +103 -0
  515. package/style/valueRef.ts +25 -0
  516. package/utils/global.ts +44 -0
  517. package/utils/hash.ts +22 -0
  518. package/utils/id.ts +20 -0
  519. package/utils/object.ts +87 -0
  520. package/utils/trace.ts +211 -0
  521. package/utils/type.ts +22 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-C7xfDxtM.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n) {\n const values = [\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD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,IAAI,SAAS,KAAA,GACX,OAAO,OAAO,sBAAsB,IAAI;CAI5C,OAAO;AACT;AAwCA,SAAgB,gBAAgB,UAAkB;CAChD,OAAO,2CAA2C,KAAK,cAAc,QAAQ,CAAC;AAChF;AAEA,SAAgB,aAAa,QAAgB,QAAgB;CAC3D,OAAO,OAAO,SAAS,MAAM;AAC/B;AAEA,SAAgB,iBAAiB,QAAgB,QAAgB,KAAa;CAC5E,OAAO,OAAO,MAAM,MAAM,EAAE,KAAK,GAAG;AACtC;AAEA,SAAgB,WAAW,QAA8B,SAAiC;CACxF,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,IAAI,CAAC,OAAO,QAAQ,OAAO,OAAO,QAAQ,QAAQ,CAAC;CACnD,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAC7C;AAEA,SAAgB,iBAAiB,QAA8B,QAA+B;CAC5F,IAAI,CAAC,OAAO,SAAS,OAAO,UAAU,CAAC;CACvC,OAAO,QAAQ,KAAK,MAAM;AAC5B;AAEA,SAAgB,sBAAsB,MAKnC;CACD,KAAK,MAAM,SAAS,KAAK,YAAY,UAAU,GAAG;EAChD,IAAI,CAAC,MAAM,KAAK,SAAS,MAAM,GAAG;EAElC,MAAM,SAAS,MAAM,OAAO,OAAO,EAAE,SAAS;EAC9C,IAAI,CAAC,aAAa,QAAQ,KAAK,MAAM,GAAG;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
@@ -0,0 +1,170 @@
1
+ import { F as DEV_CONFIG, R as hasOwn } from "./value-BR4e2MKt.js";
2
+ import { H as createElementMarkerClassName, K as isElementMarkerRule, U as createElementMarkerRuleFromDebug, l as resolveStylePropRuntime, q as splitElementMarkerStyleProp, r as ELEMENT_CSS_DATA_ATTR, s as collectStylePropItemsSheetRulesWithThemes, t as addRscStyleRules } from "./styleStore-Dea_WVbr.js";
3
+ //#region runtime/core/className.ts
4
+ function mergeClassName(className) {
5
+ if (!className) return void 0;
6
+ if (!Array.isArray(className)) return className;
7
+ let nextClassName = "";
8
+ const stack = [className];
9
+ while (stack.length) {
10
+ const item = stack.pop();
11
+ if (!item) continue;
12
+ if (Array.isArray(item)) for (let index = item.length - 1; index >= 0; index--) stack.push(item[index]);
13
+ else nextClassName = nextClassName ? `${nextClassName} ${item}` : item;
14
+ }
15
+ return nextClassName || void 0;
16
+ }
17
+ function mergeStyle(style) {
18
+ if (!style) return void 0;
19
+ if (!Array.isArray(style)) return style;
20
+ const nextStyle = {};
21
+ const stack = [style];
22
+ while (stack.length) {
23
+ const item = stack.pop();
24
+ if (!item) continue;
25
+ if (Array.isArray(item)) for (let index = item.length - 1; index >= 0; index--) stack.push(item[index]);
26
+ else Object.assign(nextStyle, item);
27
+ }
28
+ return nextStyle;
29
+ }
30
+ function mergeResolvedClassName(result, resolvedClassName) {
31
+ if (!resolvedClassName) return;
32
+ result.className = result.className ? result.className + " " + resolvedClassName : resolvedClassName;
33
+ }
34
+ function mergeResolvedStyle(result, resolvedStyle) {
35
+ if (!resolvedStyle) return;
36
+ result.style = result.style ? Object.assign({}, resolvedStyle, result.style) : resolvedStyle;
37
+ }
38
+ function createClassNameResult(props = {}) {
39
+ return {
40
+ className: props.className ? mergeClassName(props.className) : void 0,
41
+ style: props.style ? mergeStyle(props.style) : void 0
42
+ };
43
+ }
44
+ function finishClassNameResult(result) {
45
+ return result.className || result.style ? result : {};
46
+ }
47
+ //#endregion
48
+ //#region runtime/core/resolveClassNameRuntime.ts
49
+ function resolveClassNameRuntime(styleProp, props = {}) {
50
+ const result = createClassNameResult(props);
51
+ const resolved = resolveStylePropRuntime(styleProp);
52
+ if (resolved) {
53
+ mergeResolvedClassName(result, resolved.result.className);
54
+ mergeResolvedStyle(result, resolved.result.style);
55
+ }
56
+ return {
57
+ result: finishClassNameResult(result),
58
+ items: resolved?.items ?? []
59
+ };
60
+ }
61
+ //#endregion
62
+ //#region runtime/rsc/getClassName.ts
63
+ function getClassName(styleProp, props = {}) {
64
+ const marker = splitElementMarkerStyleProp(styleProp);
65
+ const resolved = resolveClassNameRuntime(marker.styleProp, props);
66
+ return DEV_CONFIG.isDev ? getClassNameRSC(resolved.result, resolved.items, marker.debug) : resolved.result;
67
+ }
68
+ function getClassNameRSC(result, items, markerDebug) {
69
+ const rules = collectStylePropItemsSheetRulesWithThemes(items);
70
+ const marker = createElementMarkerRuleFromDebug(markerDebug);
71
+ if (!rules.length && !marker) return result;
72
+ addRscStyleRules(rules);
73
+ if (marker) result.className = result.className ? `${marker.className} ${result.className}` : marker.className;
74
+ return {
75
+ ...result,
76
+ [ELEMENT_CSS_DATA_ATTR]: createRscStylePayload(marker ? [marker.rule, ...rules] : rules)
77
+ };
78
+ }
79
+ function createRscStylePayload(rules) {
80
+ return JSON.stringify(rules.map(createRscStylePayloadRule));
81
+ }
82
+ function createRscStylePayloadRule(rule) {
83
+ return {
84
+ key: rule.key,
85
+ css: rule.css,
86
+ priority: rule.priority,
87
+ callsite: isElementMarkerRule(rule) ? rule.callsite : void 0,
88
+ debug: rule.debug ? createRscDebugPayload(rule.debug, rule.debugField) : void 0,
89
+ debugField: rule.debugField
90
+ };
91
+ }
92
+ function createRscDebugPayload(debug, debugField) {
93
+ const { code: _code, fields, ...payload } = debug;
94
+ if (!debugField || !fields?.[debugField]) return payload;
95
+ return {
96
+ ...payload,
97
+ fields: { [debugField]: fields[debugField] }
98
+ };
99
+ }
100
+ //#endregion
101
+ //#region runtime/core/createTransformElement.ts
102
+ function createTransformElement(getClassName) {
103
+ return ({ type, props }) => {
104
+ if (!props || typeof type !== "string") return {
105
+ type,
106
+ props
107
+ };
108
+ if (!hasOwn(props, "css")) return {
109
+ type,
110
+ props
111
+ };
112
+ const { css, ...rest } = props;
113
+ if (!css) return {
114
+ type,
115
+ props: rest
116
+ };
117
+ const marker = splitElementMarkerStyleProp(css);
118
+ if (marker.styleProp) Object.assign(rest, getClassName(marker.styleProp, rest));
119
+ prependClassName(rest, createElementMarkerClassName(marker.debug));
120
+ return {
121
+ type,
122
+ props: rest
123
+ };
124
+ };
125
+ }
126
+ function prependClassName(props, className) {
127
+ if (!className) return;
128
+ props.className = props.className ? `${className} ${props.className}` : className;
129
+ }
130
+ //#endregion
131
+ //#region runtime/rsc/jsx.ts
132
+ const transformElement = createTransformElement(getClassName);
133
+ //#endregion
134
+ //#region jsx/utils.ts
135
+ function wrapCreateElement(createElement, transformElement) {
136
+ const fn = (type, props, ...children) => {
137
+ const result = transformElement({
138
+ type,
139
+ props
140
+ });
141
+ return createElement(result.type, result.props, ...children);
142
+ };
143
+ return fn;
144
+ }
145
+ function wrapFragment(fragment) {
146
+ return fragment;
147
+ }
148
+ function createJsxDEV(fn, transformElement) {
149
+ return (type, props, key, isStatic, source, self) => {
150
+ const result = transformElement({
151
+ type,
152
+ props,
153
+ source
154
+ });
155
+ return fn(result.type, result.props, key, isStatic, source, self);
156
+ };
157
+ }
158
+ function createJsx(fn, transformElement) {
159
+ return (type, props, key) => {
160
+ const result = transformElement({
161
+ type,
162
+ props
163
+ });
164
+ return fn(result.type, result.props, key);
165
+ };
166
+ }
167
+ //#endregion
168
+ export { transformElement as a, wrapFragment as i, createJsxDEV as n, getClassName as o, wrapCreateElement as r, createJsx as t };
169
+
170
+ //# sourceMappingURL=utils-CWNHx4EC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-CWNHx4EC.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/rsc/getClassName.ts","../runtime/core/createTransformElement.ts","../runtime/rsc/jsx.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { LayerPriority } from '../../atomic/layer';\nimport type { DebugData } from '../../builder/data/debug';\nimport { DEV_CONFIG } from '../../config/config/dev';\nimport type { SheetRule } from '../../sheet';\nimport type { StylePropItem } from '../core/cache/prop';\nimport type { ClassNameProps, ClassNameResult } from '../core/className';\nimport {\n createElementMarkerRuleFromDebug,\n isElementMarkerRule,\n splitElementMarkerStyleProp,\n} from '../core/elementMarker';\nimport { resolveClassNameRuntime } from '../core/resolveClassNameRuntime';\nimport { collectStylePropItemsSheetRulesWithThemes } from '../sheet/rules';\nimport type { StyleProp } from '../types';\nimport { ELEMENT_CSS_DATA_ATTR } from './constants';\nimport { addRscStyleRules } from './styleStore';\n\nexport type RscStylePayloadRule = {\n key?: string | null;\n css: string;\n priority?: LayerPriority | null;\n callsite?: SheetRule['callsite'];\n debug?: DebugData | null;\n debugField?: string | null;\n};\n\nexport type ClassNameResultRSC = ClassNameResult & {\n [ELEMENT_CSS_DATA_ATTR]?: string;\n};\n\nexport function getClassName(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): ClassNameResultRSC {\n const marker = splitElementMarkerStyleProp(styleProp);\n const resolved = resolveClassNameRuntime(marker.styleProp as StyleProp, props);\n\n return DEV_CONFIG.isDev\n ? getClassNameRSC(resolved.result, resolved.items, marker.debug)\n : resolved.result;\n}\n\nexport function getClassNameRSC(\n result: ClassNameResult,\n items: readonly StylePropItem[],\n markerDebug?: ReturnType<typeof splitElementMarkerStyleProp>['debug'],\n): ClassNameResultRSC {\n const rules = collectStylePropItemsSheetRulesWithThemes(items);\n const marker = createElementMarkerRuleFromDebug(markerDebug);\n\n if (!rules.length && !marker) return result;\n\n addRscStyleRules(rules);\n\n if (marker) {\n result.className = result.className\n ? `${marker.className} ${result.className}`\n : marker.className;\n }\n\n return {\n ...result,\n [ELEMENT_CSS_DATA_ATTR]: createRscStylePayload(marker ? [marker.rule, ...rules] : rules),\n };\n}\n\nexport function createRscStylePayload(rules: readonly SheetRule[]): string {\n return JSON.stringify(rules.map(createRscStylePayloadRule));\n}\n\nfunction createRscStylePayloadRule(rule: SheetRule): RscStylePayloadRule {\n return {\n key: rule.key,\n css: rule.css,\n priority: rule.priority,\n callsite: isElementMarkerRule(rule) ? rule.callsite : undefined,\n debug: rule.debug ? createRscDebugPayload(rule.debug, rule.debugField) : undefined,\n debugField: rule.debugField,\n };\n}\n\nfunction createRscDebugPayload(\n debug: DebugData,\n debugField: string | null | undefined,\n): DebugData {\n const { code: _code, fields, ...payload } = debug;\n\n if (!debugField || !fields?.[debugField]) {\n return payload;\n }\n\n return {\n ...payload,\n fields: {\n [debugField]: fields[debugField],\n },\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import { createTransformElement } from '../core/createTransformElement';\nimport { getClassName } from './getClassName';\n\nexport const transformElement = createTransformElement(getClassName);\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,M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AAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
@@ -0,0 +1,37 @@
1
+ //#region jsx/utils.ts
2
+ function wrapCreateElement(createElement, transformElement) {
3
+ const fn = (type, props, ...children) => {
4
+ const result = transformElement({
5
+ type,
6
+ props
7
+ });
8
+ return createElement(result.type, result.props, ...children);
9
+ };
10
+ return fn;
11
+ }
12
+ function wrapFragment(fragment) {
13
+ return fragment;
14
+ }
15
+ function createJsxDEV(fn, transformElement) {
16
+ return (type, props, key, isStatic, source, self) => {
17
+ const result = transformElement({
18
+ type,
19
+ props,
20
+ source
21
+ });
22
+ return fn(result.type, result.props, key, isStatic, source, self);
23
+ };
24
+ }
25
+ function createJsx(fn, transformElement) {
26
+ return (type, props, key) => {
27
+ const result = transformElement({
28
+ type,
29
+ props
30
+ });
31
+ return fn(result.type, result.props, key);
32
+ };
33
+ }
34
+ //#endregion
35
+ export { wrapFragment as i, createJsxDEV as n, wrapCreateElement as r, createJsx as t };
36
+
37
+ //# sourceMappingURL=utils-CdI6vZsP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-CdI6vZsP.js","names":[],"sources":["../jsx/utils.ts"],"sourcesContent":["import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";AAmBA,SAAgB,kBACd,eACA,kBACiB;CACjB,MAAM,MAAM,MAAmB,OAAgB,GAAG,aAAiB;EACjE,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,cAAc,OAAO,MAAM,OAAO,OAAO,GAAG,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,UACA;CACA,OAAO;AACT;AAEA,SAAgB,aACd,IACA,kBACU;CACV,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,SAAS;EACnD,MAAM,SAAS,iBAAiB;GAAE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
@@ -0,0 +1,129 @@
1
+ import { o as hasOwn } from "./dev-DfBbuLeE.js";
2
+ import { i as resolveStylePropRuntime } from "./rules-9HSO1pxL.js";
3
+ import { c as splitElementMarkerStyleProp, n as createElementMarkerClassName } from "./elementMarker-Bu7gDAkE.js";
4
+ //#region runtime/core/className.ts
5
+ function mergeClassName(className) {
6
+ if (!className) return void 0;
7
+ if (!Array.isArray(className)) return className;
8
+ let nextClassName = "";
9
+ const stack = [className];
10
+ while (stack.length) {
11
+ const item = stack.pop();
12
+ if (!item) continue;
13
+ if (Array.isArray(item)) for (let index = item.length - 1; index >= 0; index--) stack.push(item[index]);
14
+ else nextClassName = nextClassName ? `${nextClassName} ${item}` : item;
15
+ }
16
+ return nextClassName || void 0;
17
+ }
18
+ function mergeStyle(style) {
19
+ if (!style) return void 0;
20
+ if (!Array.isArray(style)) return style;
21
+ const nextStyle = {};
22
+ const stack = [style];
23
+ while (stack.length) {
24
+ const item = stack.pop();
25
+ if (!item) continue;
26
+ if (Array.isArray(item)) for (let index = item.length - 1; index >= 0; index--) stack.push(item[index]);
27
+ else Object.assign(nextStyle, item);
28
+ }
29
+ return nextStyle;
30
+ }
31
+ function mergeResolvedClassName(result, resolvedClassName) {
32
+ if (!resolvedClassName) return;
33
+ result.className = result.className ? result.className + " " + resolvedClassName : resolvedClassName;
34
+ }
35
+ function mergeResolvedStyle(result, resolvedStyle) {
36
+ if (!resolvedStyle) return;
37
+ result.style = result.style ? Object.assign({}, resolvedStyle, result.style) : resolvedStyle;
38
+ }
39
+ function createClassNameResult(props = {}) {
40
+ return {
41
+ className: props.className ? mergeClassName(props.className) : void 0,
42
+ style: props.style ? mergeStyle(props.style) : void 0
43
+ };
44
+ }
45
+ function finishClassNameResult(result) {
46
+ return result.className || result.style ? result : {};
47
+ }
48
+ //#endregion
49
+ //#region runtime/core/resolveClassNameRuntime.ts
50
+ function resolveClassNameRuntime(styleProp, props = {}) {
51
+ const result = createClassNameResult(props);
52
+ const resolved = resolveStylePropRuntime(styleProp);
53
+ if (resolved) {
54
+ mergeResolvedClassName(result, resolved.result.className);
55
+ mergeResolvedStyle(result, resolved.result.style);
56
+ }
57
+ return {
58
+ result: finishClassNameResult(result),
59
+ items: resolved?.items ?? []
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region runtime/core/createTransformElement.ts
64
+ function createTransformElement(getClassName) {
65
+ return ({ type, props }) => {
66
+ if (!props || typeof type !== "string") return {
67
+ type,
68
+ props
69
+ };
70
+ if (!hasOwn(props, "css")) return {
71
+ type,
72
+ props
73
+ };
74
+ const { css, ...rest } = props;
75
+ if (!css) return {
76
+ type,
77
+ props: rest
78
+ };
79
+ const marker = splitElementMarkerStyleProp(css);
80
+ if (marker.styleProp) Object.assign(rest, getClassName(marker.styleProp, rest));
81
+ prependClassName(rest, createElementMarkerClassName(marker.debug));
82
+ return {
83
+ type,
84
+ props: rest
85
+ };
86
+ };
87
+ }
88
+ function prependClassName(props, className) {
89
+ if (!className) return;
90
+ props.className = props.className ? `${className} ${props.className}` : className;
91
+ }
92
+ //#endregion
93
+ //#region jsx/utils.ts
94
+ function wrapCreateElement(createElement, transformElement) {
95
+ const fn = (type, props, ...children) => {
96
+ const result = transformElement({
97
+ type,
98
+ props
99
+ });
100
+ return createElement(result.type, result.props, ...children);
101
+ };
102
+ return fn;
103
+ }
104
+ function wrapFragment(fragment) {
105
+ return fragment;
106
+ }
107
+ function createJsxDEV(fn, transformElement) {
108
+ return (type, props, key, isStatic, source, self) => {
109
+ const result = transformElement({
110
+ type,
111
+ props,
112
+ source
113
+ });
114
+ return fn(result.type, result.props, key, isStatic, source, self);
115
+ };
116
+ }
117
+ function createJsx(fn, transformElement) {
118
+ return (type, props, key) => {
119
+ const result = transformElement({
120
+ type,
121
+ props
122
+ });
123
+ return fn(result.type, result.props, key);
124
+ };
125
+ }
126
+ //#endregion
127
+ export { createTransformElement as a, wrapFragment as i, createJsxDEV as n, resolveClassNameRuntime as o, wrapCreateElement as r, createJsx as t };
128
+
129
+ //# sourceMappingURL=utils-D7FAOyg6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-D7FAOyg6.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/core/createTransformElement.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,gBAAgB,gBACZ,GAAG,cAAc,GAAG,SACpB;CAER;CAEA,OAAO,iBAAiB,KAAA;AAC1B;AAEA,SAAgB,WAAW,OAA6B;CACtD,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,MAAM,YAAY,CAAC;CAEnB,MAAM,QAAmB,CAAC,KAAK;CAE/B,OAAO,MAAM,QAAQ;EAC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1D,MAAM,EAAE,KAAK,GAAG,SAAS;EAEzB,IAAI,CAAC,KAAK,OAAO;GAAE;GAAM,OAAO;EAAK;EAErC,MAAM,SAAS,4BAA4B,GAAG;EAE9C,IAAI,OAAO,WACT,OAAO,OAAO,MAAM,aAAa,OAAO,WAAW,IAAI,CAAC;EAG1D,iBAAiB,MAAM,6BAA6B,OAAO,KAAK,CAAC;EAEjE,OAAO;GAAE;GAAM,OAAO;EAAK;CAC7B;AACF;AAEA,SAAS,iBACP,OACA,WACA;CACA,IAAI,CAAC,WAAW;CAEhB,MAAM,YAAY,MAAM,YACpB,GAAG,UAAU,GAAG,MAAM,cACtB;AACN;;;ACnBA,SAAgB,kBACd,eACA,kBACiB;CACjB,MAAM,MAAM,MAAmB,OAAgB,GAAG,aAAiB;EACjE,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,cAAc,OAAO,MAAM,OAAO,OAAO,GAAG,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,UACA;CACA,OAAO;AACT;AAEA,SAAgB,aACd,IACA,kBACU;CACV,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,SAAS;EACnD,MAAM,SAAS,iBAAiB;GAAE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
@@ -0,0 +1,49 @@
1
+ import { o as normalizePath } from "./compiler-DweanHoB.mjs";
2
+ import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-CyIj8LYK.mjs";
3
+ import { createRequire } from "node:module";
4
+ import path from "node:path";
5
+ //#region plugin/bundler/webpack/utils.ts
6
+ const webpackRegistry = createWebpackRegistry("webpack.registry");
7
+ function getTransformLoaderPath() {
8
+ return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + "/webpack/loader");
9
+ }
10
+ function getStylePackageDistPath() {
11
+ return path.resolve(path.dirname(getTransformLoaderPath()), "../..");
12
+ }
13
+ function createWebpackRuntimeModuleSource(extract, cssFilePath, options = {}) {
14
+ return [
15
+ extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,
16
+ options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,
17
+ options.sidecarUrl && `globalThis[Symbol.for(${JSON.stringify("FLUENTIC_STYLE_SIDECAR_URL")})] = ${JSON.stringify(options.sidecarUrl)};`,
18
+ ""
19
+ ].filter(Boolean).join("\n");
20
+ }
21
+ function replaceWebpackCssMarker(source, marker, css) {
22
+ return source.replace(marker, css);
23
+ }
24
+ function hasWebpackCssMarker(source, marker) {
25
+ return source.includes(marker);
26
+ }
27
+ function prependWebpackRuntimeEntry(entry, runtimeFilePath) {
28
+ if (typeof entry === "function") return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);
29
+ return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);
30
+ }
31
+ function prependWebpackRuntimeStaticEntry(entry, runtimeFilePath) {
32
+ const result = {};
33
+ for (const [key, value] of Object.entries(entry)) result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);
34
+ return result;
35
+ }
36
+ function prependWebpackRuntimeEntryDescription(entry, runtimeFilePath) {
37
+ if (!entry.import) return entry;
38
+ return {
39
+ ...entry,
40
+ import: prependEntryImport(entry.import, runtimeFilePath)
41
+ };
42
+ }
43
+ function prependEntryImport(entryImport, runtimeFilePath) {
44
+ return entryImport.includes(runtimeFilePath) ? entryImport : [runtimeFilePath, ...entryImport];
45
+ }
46
+ //#endregion
47
+ export { prependWebpackRuntimeEntry as a, hasWebpackCssMarker as i, getStylePackageDistPath as n, replaceWebpackCssMarker as o, getTransformLoaderPath as r, webpackRegistry as s, createWebpackRuntimeModuleSource as t };
48
+
49
+ //# sourceMappingURL=utils-DMFgOOtA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-DMFgOOtA.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa,kBAAkB,sBAAsB,kBAAkB;AAEvE,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,cAAc,SAAS,iBAAiB;AACxF;AAEA,SAAgB,0BAA0B;CACxC,OAAO,KAAK,QAAQ,KAAK,QAAQ,uBAAuB,CAAC,GAAG,OAAO;AACrE;AAEA,SAAgB,iCACd,SACA,aACA,UAGI,CAAC,GACL;CACA,OAAO;EACL,WAAW,eAAe,UAAU,KAAK,UAAU,cAAc,WAAW,CAAC,EAAE;EAC/E,QAAQ,cAAc,QAAQ,qBAAqB,UAAU,KAAK,UAAU,QAAQ,iBAAiB,EAAE;EACvG,QAAQ,cACR,yBAAyB,KAAK,UAAA,4BAAmC,EAAE,OAAO,KAAK,UAAU,QAAQ,UAAU,EAAE;EAC7G;CACF,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI;AAC7B;AAEA,SAAgB,wBACd,QACA,QACA,KACA;CACA,OAAO,OAAO,QAAQ,QAAQ,GAAG;AACnC;AAEA,SAAgB,oBAAoB,QAAgB,QAAgB;CAClE,OAAO,OAAO,SAAS,MAAM;AAC/B;AAEA,SAAgB,2BACd,OACA,iBACiB;CACjB,IAAI,OAAO,UAAU,YACnB,OAAO,YAAY,iCAAiC,MAAM,MAAM,GAAG,eAAe;CAGpF,OAAO,iCAAiC,OAAO,eAAe;AAChE;AAEA,SAAS,iCACP,OACA,iBACoB;CACpB,MAAM,SAA6B,CAAC;CAEpC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,OAAO,OAAO,sCAAsC,OAAO,eAAe;CAG5E,OAAO;AACT;AAEA,SAAS,sCACP,OACA,iBACyB;CACzB,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,OAAO;EACL,GAAG;EACH,QAAQ,mBAAmB,MAAM,QAAQ,eAAe;CAC1D;AACF;AAEA,SAAS,mBAAmB,aAAuB,iBAAyB;CAC1E,OAAO,YAAY,SAAS,eAAe,IACvC,cACA,CAAC,iBAAiB,GAAG,WAAW;AACtC"}
package/dist/utils.js ADDED
@@ -0,0 +1,26 @@
1
+ import { p as isStyleTokenData } from "./value-E8rEv2Oe.js";
2
+ import "./data-_te7t0M4.js";
3
+ import { d as isSlotData } from "./className-DC2Cq8p3.js";
4
+ //#region style/utils/expose.ts
5
+ function exposeStyle(styles) {
6
+ return exposeStyleObject(styles);
7
+ }
8
+ function exposeStyleObject(source) {
9
+ const result = {};
10
+ for (const key of Reflect.ownKeys(source)) {
11
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
12
+ const exposed = exposeStyleValue(source[key]);
13
+ if (exposed !== void 0) result[key] = exposed;
14
+ }
15
+ return result;
16
+ }
17
+ function exposeStyleValue(value) {
18
+ if (isStyleTokenData(value) || isSlotData(value)) return value;
19
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
20
+ const exposed = exposeStyleObject(value);
21
+ return Reflect.ownKeys(exposed).length > 0 ? exposed : void 0;
22
+ }
23
+ //#endregion
24
+ export { exposeStyle };
25
+
26
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../style/utils/expose.ts"],"sourcesContent":["import type { AnyBuilderData, SlotData } from '../../builder/data';\nimport { isSlotData } from '../../builder/data';\nimport { isStyleTokenData, type StyleTokenData } from '../token';\n\ntype ExposedStyleItem<T> = T extends StyleTokenData ? T\n : T extends SlotData ? T\n : T extends AnyBuilderData ? never\n : T extends readonly unknown[] ? never\n : T extends object ? ExposedStyle<T>\n : never;\n\nexport type ExposedStyle<T> = {\n [K in keyof T as ExposedStyleItem<T[K]> extends never ? never : K]: ExposedStyleItem<T[K]>;\n};\n\nexport function exposeStyle<T extends object>(styles: T): ExposedStyle<T> {\n return exposeStyleObject(styles) as ExposedStyle<T>;\n}\n\nfunction exposeStyleObject(source: object) {\n const result: Record<PropertyKey, unknown> = {};\n\n for (const key of Reflect.ownKeys(source)) {\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n\n const exposed = exposeStyleValue((source as Record<PropertyKey, unknown>)[key]);\n\n if (exposed !== undefined) {\n result[key] = exposed;\n }\n }\n\n return result;\n}\n\nfunction exposeStyleValue(value: unknown): unknown {\n if (isStyleTokenData(value) || isSlotData(value)) return value;\n\n if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined;\n\n const exposed = exposeStyleObject(value);\n return Reflect.ownKeys(exposed).length > 0 ? exposed : undefined;\n}\n"],"mappings":";;;;AAeA,SAAgB,YAA8B,QAA4B;CACxE,OAAO,kBAAkB,MAAM;AACjC;AAEA,SAAS,kBAAkB,QAAgB;CACzC,MAAM,SAAuC,CAAC;CAE9C,KAAK,MAAM,OAAO,QAAQ,QAAQ,MAAM,GAAG;EACzC,IAAI,CAAC,OAAO,UAAU,qBAAqB,KAAK,QAAQ,GAAG,GAAG;EAE9D,MAAM,UAAU,iBAAkB,OAAwC,IAAI;EAE9E,IAAI,YAAY,KAAA,GACd,OAAO,OAAO;CAElB;CAEA,OAAO;AACT;AAEA,SAAS,iBAAiB,OAAyB;CACjD,IAAI,iBAAiB,KAAK,KAAK,WAAW,KAAK,GAAG,OAAO;CAEzD,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAA;CAExE,MAAM,UAAU,kBAAkB,KAAK;CACvC,OAAO,QAAQ,QAAQ,OAAO,EAAE,SAAS,IAAI,UAAU,KAAA;AACzD"}