@stacksjs/stx 0.2.583 → 0.2.585

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 (243) hide show
  1. package/dist/{chunk-ck1yca7g.js → chunk-03qf2z4d.js} +1 -1
  2. package/dist/{chunk-6m3me7yj.js → chunk-03xsf9jm.js} +9 -9
  3. package/dist/{chunk-sv5nvfmb.js → chunk-048eyjyj.js} +2 -2
  4. package/dist/{chunk-je1as16r.js → chunk-076h7nb9.js} +5 -5
  5. package/dist/{chunk-hp9nxva6.js → chunk-07869zev.js} +4 -4
  6. package/dist/chunk-0hpw65yr.js +2 -0
  7. package/dist/chunk-11jmasqb.js +2 -0
  8. package/dist/chunk-2c7ysn9s.js +2 -0
  9. package/dist/chunk-2wb1w0p6.js +2 -0
  10. package/dist/chunk-2wx2aczp.js +2 -0
  11. package/dist/{chunk-pbwk8tzz.js → chunk-33q5zka4.js} +1 -1
  12. package/dist/chunk-3qmx12d3.js +2845 -0
  13. package/dist/{chunk-ktyctev3.js → chunk-3y5tzxm6.js} +2 -2
  14. package/dist/chunk-3ybbat49.js +2 -0
  15. package/dist/{chunk-2943qhdt.js → chunk-45x4myqe.js} +2 -2
  16. package/dist/chunk-4dpab4j6.js +2 -0
  17. package/dist/{chunk-5kh5ehfh.js → chunk-4h58as2c.js} +2 -2
  18. package/dist/chunk-4vnwge6p.js +2 -0
  19. package/dist/chunk-4w37cqg9.js +2 -0
  20. package/dist/chunk-51pz8cwa.js +2 -0
  21. package/dist/chunk-65agttgm.js +2 -0
  22. package/dist/{chunk-ye66wc53.js → chunk-67m2prah.js} +2 -2
  23. package/dist/{chunk-521pe0hb.js → chunk-6cg03r93.js} +4 -4
  24. package/dist/chunk-6djvj6hg.js +2 -0
  25. package/dist/{chunk-4pmgr32a.js → chunk-6hgngmn0.js} +3 -3
  26. package/dist/{chunk-09zwhsf9.js → chunk-751b5zv9.js} +3 -3
  27. package/dist/{chunk-mjj24qpb.js → chunk-794v5crp.js} +2 -2
  28. package/dist/chunk-7ae40484.js +2 -0
  29. package/dist/chunk-7dkwf9h5.js +2 -0
  30. package/dist/chunk-7dtyf7hq.js +2 -0
  31. package/dist/chunk-7ebt9n43.js +4 -0
  32. package/dist/{chunk-cnknvvwm.js → chunk-7fghm9zy.js} +1 -1
  33. package/dist/{chunk-117xss52.js → chunk-7xw1e8t6.js} +2 -2
  34. package/dist/{chunk-w6wtxj54.js → chunk-7ydavm3h.js} +2 -2
  35. package/dist/chunk-80g8kaes.js +2 -0
  36. package/dist/{chunk-qdyp2zqf.js → chunk-82bttwqm.js} +2 -2
  37. package/dist/chunk-8992smwz.js +2 -0
  38. package/dist/{chunk-qn8gdw21.js → chunk-8s7zbhdd.js} +4 -4
  39. package/dist/{chunk-02qaqamv.js → chunk-91pdg853.js} +7 -7
  40. package/dist/chunk-9j6hk72q.js +2 -0
  41. package/dist/{chunk-96mb3brj.js → chunk-9nt3q23a.js} +3 -3
  42. package/dist/chunk-9pk5jhqa.js +3 -0
  43. package/dist/{chunk-g9zeybqh.js → chunk-9qsnq026.js} +2 -2
  44. package/dist/{chunk-m417sp42.js → chunk-a30mtx17.js} +4 -4
  45. package/dist/chunk-a3k4nfq2.js +2 -0
  46. package/dist/{chunk-c0h2eqe0.js → chunk-a8n6mt7s.js} +2 -2
  47. package/dist/{chunk-xp7fxc6p.js → chunk-awgvt956.js} +5 -5
  48. package/dist/{chunk-mt9x626h.js → chunk-axz1x4r9.js} +5 -5
  49. package/dist/{chunk-8tq83fq7.js → chunk-b217d16p.js} +57 -57
  50. package/dist/{chunk-w3rmepwy.js → chunk-bfbmdjh4.js} +2 -2
  51. package/dist/chunk-bhg4pvtn.js +2 -0
  52. package/dist/{chunk-0k5faspy.js → chunk-bsy10tz6.js} +6 -6
  53. package/dist/{chunk-dvc15djp.js → chunk-c6egfhy6.js} +2 -2
  54. package/dist/chunk-c8fdccgp.js +2 -0
  55. package/dist/chunk-ce2d0hz9.js +2 -0
  56. package/dist/{chunk-4pkpr5cg.js → chunk-cqr5cv7h.js} +4 -4
  57. package/dist/chunk-cw76edds.js +2 -0
  58. package/dist/{chunk-ky1426s1.js → chunk-cy07dhqh.js} +10 -10
  59. package/dist/chunk-czrs87r9.js +2 -0
  60. package/dist/{chunk-ycj0342k.js → chunk-d0tmc6v5.js} +2 -2
  61. package/dist/chunk-d9vjsqs4.js +2 -0
  62. package/dist/chunk-ddgyj88h.js +2 -0
  63. package/dist/chunk-dj90w48e.js +2 -0
  64. package/dist/chunk-dngzks8e.js +2 -0
  65. package/dist/chunk-e01j75cr.js +122 -0
  66. package/dist/{chunk-kfwmqacd.js → chunk-e556dvy4.js} +3 -3
  67. package/dist/chunk-ede39b7h.js +3 -0
  68. package/dist/chunk-emxa2djv.js +2 -0
  69. package/dist/chunk-esj49jvz.js +2 -0
  70. package/dist/chunk-eztvhppz.js +2 -0
  71. package/dist/{chunk-4srg0qbv.js → chunk-f29fk7dw.js} +2 -2
  72. package/dist/{chunk-vke73gts.js → chunk-fkq55rh7.js} +1 -1
  73. package/dist/chunk-h2534p6q.js +2 -0
  74. package/dist/{chunk-2nehykbm.js → chunk-h7atbtds.js} +5 -5
  75. package/dist/chunk-h9gtc6bk.js +2 -0
  76. package/dist/{chunk-h0a2s340.js → chunk-haag5n42.js} +2 -2
  77. package/dist/{chunk-cby4mkjf.js → chunk-hj8tr9g0.js} +1 -1
  78. package/dist/{chunk-en7xxgtb.js → chunk-hsy9rhct.js} +2 -2
  79. package/dist/{chunk-qccgncp2.js → chunk-htcptqtn.js} +6 -6
  80. package/dist/chunk-hwnvfke9.js +2 -0
  81. package/dist/chunk-hygxh993.js +2 -0
  82. package/dist/{chunk-s12bnv32.js → chunk-hz11wmx9.js} +2 -2
  83. package/dist/{chunk-wyn5rfzk.js → chunk-j7kcjgxy.js} +115 -26
  84. package/dist/chunk-j8v5164e.js +2 -0
  85. package/dist/chunk-jqy5q8m0.js +2 -0
  86. package/dist/{chunk-0dfgefjv.js → chunk-jtx74677.js} +2 -2
  87. package/dist/chunk-jy7yzat1.js +2 -0
  88. package/dist/{chunk-vkc51n9m.js → chunk-k1szsenr.js} +2 -2
  89. package/dist/{chunk-sv08pd66.js → chunk-k71e38fk.js} +4 -4
  90. package/dist/{chunk-ac6v3s3k.js → chunk-kfhghjh6.js} +2 -2
  91. package/dist/{chunk-ym1sb5bg.js → chunk-m7ddgrsm.js} +5 -5
  92. package/dist/{chunk-vpdx7qr3.js → chunk-mmbspaqh.js} +2 -2
  93. package/dist/{chunk-6fc8vw2v.js → chunk-mnnxa3r7.js} +7 -7
  94. package/dist/chunk-n7yk4nc1.js +2 -0
  95. package/dist/chunk-ns1jqzqk.js +2 -0
  96. package/dist/chunk-p973efbe.js +2 -0
  97. package/dist/{chunk-m8tm44rq.js → chunk-pg164sdw.js} +2 -2
  98. package/dist/{chunk-x552npae.js → chunk-pxw4edw8.js} +4 -4
  99. package/dist/chunk-q03kn4d1.js +2 -0
  100. package/dist/{chunk-1r1maqep.js → chunk-q1cvef6b.js} +3 -3
  101. package/dist/{chunk-jpqkm8tm.js → chunk-qf3axv86.js} +3 -3
  102. package/dist/{chunk-dhq80e4r.js → chunk-qhr1tkhj.js} +7 -7
  103. package/dist/chunk-qq59xzwc.js +2 -0
  104. package/dist/{chunk-h3z9b6bw.js → chunk-qx0tcsdm.js} +11 -11
  105. package/dist/chunk-r0e743c3.js +2 -0
  106. package/dist/chunk-r90v2jz6.js +2 -0
  107. package/dist/chunk-rtgf9fgc.js +2 -0
  108. package/dist/chunk-s043hpvd.js +2 -0
  109. package/dist/{chunk-hzqyfdpy.js → chunk-s2h601k7.js} +7 -7
  110. package/dist/chunk-shzesarq.js +2 -0
  111. package/dist/chunk-sjkdpsca.js +3 -0
  112. package/dist/chunk-sqpme1hg.js +2 -0
  113. package/dist/{chunk-e809x7m0.js → chunk-t212h9zm.js} +1 -1
  114. package/dist/{chunk-r47cs92n.js → chunk-tc15vkfh.js} +2 -2
  115. package/dist/chunk-thydj877.js +2 -0
  116. package/dist/{chunk-6z3e1tyz.js → chunk-tnafnb23.js} +1 -1
  117. package/dist/{chunk-ah9xyss2.js → chunk-v8ze2q95.js} +2 -2
  118. package/dist/{chunk-xytkfa48.js → chunk-vf15db1j.js} +6 -6
  119. package/dist/chunk-vv1kr9dn.js +2 -0
  120. package/dist/{chunk-dm1qh2vq.js → chunk-w24qmxc3.js} +3 -3
  121. package/dist/{chunk-nhd9m8h5.js → chunk-wkrf41se.js} +6 -6
  122. package/dist/chunk-wm9nzg76.js +2 -0
  123. package/dist/chunk-wn2gzwmv.js +2 -0
  124. package/dist/{chunk-07anexcg.js → chunk-ww28zfwt.js} +2 -2
  125. package/dist/chunk-x5qymgxa.js +2 -0
  126. package/dist/chunk-xfe2nzxd.js +2 -0
  127. package/dist/chunk-xjwgzp6s.js +2 -0
  128. package/dist/chunk-xnbkyj4g.js +2 -0
  129. package/dist/chunk-xyepqdjy.js +2 -0
  130. package/dist/{chunk-wwj8zbzc.js → chunk-y09g63k0.js} +5 -5
  131. package/dist/{chunk-3e3dpp7w.js → chunk-y5x8xnnf.js} +3 -3
  132. package/dist/chunk-y93y2qat.js +2 -0
  133. package/dist/{chunk-nh3svtvj.js → chunk-yhhfxx17.js} +5 -5
  134. package/dist/{chunk-bj29pwm0.js → chunk-zrw1zf54.js} +3 -3
  135. package/dist/cli.js +20 -20
  136. package/dist/client/signals-host-runtime.js +52 -1
  137. package/dist/client/signals-manifest-hydration-runtime.js +13 -0
  138. package/dist/client/signals-overlay-runtime.js +29 -6
  139. package/dist/client/signals-public-api-runtime.js +2 -0
  140. package/dist/client/signals-style-runtime.js +1 -1
  141. package/dist/component-renderer.js +26 -6
  142. package/dist/craft-entry.js +2 -2
  143. package/dist/craft.js +2 -2
  144. package/dist/native/accessibility.d.ts +18 -0
  145. package/dist/native/accessibility.js +89 -0
  146. package/dist/native/compiler/design-tokens.d.ts +4 -0
  147. package/dist/native/compiler/design-tokens.js +28 -0
  148. package/dist/native/compiler/headwind-to-style.d.ts +5 -4
  149. package/dist/native/compiler/headwind-to-style.js +105 -65
  150. package/dist/native/compiler/html-to-ir.d.ts +3 -1
  151. package/dist/native/compiler/html-to-ir.js +49 -243
  152. package/dist/native/compiler/inline-style.d.ts +13 -0
  153. package/dist/native/compiler/inline-style.js +285 -0
  154. package/dist/native/compiler/ir.d.ts +5 -1
  155. package/dist/native/compiler/render-screen.js +3 -1
  156. package/dist/native/compiler/style-variables.d.ts +8 -0
  157. package/dist/native/compiler/style-variables.js +142 -0
  158. package/dist/native/compiler/stylesheet-theme.d.ts +6 -0
  159. package/dist/native/compiler/stylesheet-theme.js +110 -0
  160. package/dist/native/runtime/craft-bridge.js +3 -1
  161. package/dist/native/runtime/native-host.d.ts +13 -2
  162. package/dist/native/runtime/native-host.js +242 -36
  163. package/dist/native/runtime/overlay-presenter.d.ts +29 -0
  164. package/dist/native/runtime/overlay-presenter.js +69 -0
  165. package/dist/native/runtime/shared-screen.js +12 -1
  166. package/dist/native/runtime/view-operations.d.ts +20 -0
  167. package/dist/native/runtime/view-operations.js +35 -0
  168. package/dist/native/testing-mutations.d.ts +4 -0
  169. package/dist/native/testing-mutations.js +64 -0
  170. package/dist/native/testing.d.ts +2 -0
  171. package/dist/native/testing.js +18 -1
  172. package/dist/pwa.js +3 -3
  173. package/dist/ssg.js +9 -9
  174. package/dist/testing.js +2 -0
  175. package/dist/types/config-types.d.ts +2 -0
  176. package/dist/utils.d.ts +1 -1
  177. package/dist/utils.js +25 -5
  178. package/package.json +5 -5
  179. package/dist/chunk-00p22wzr.js +0 -3
  180. package/dist/chunk-0fx3ppnt.js +0 -2
  181. package/dist/chunk-0sfexf9t.js +0 -2
  182. package/dist/chunk-2927nax9.js +0 -2
  183. package/dist/chunk-2rj0ttas.js +0 -2
  184. package/dist/chunk-2rx9d75e.js +0 -4
  185. package/dist/chunk-3ae39ttg.js +0 -2
  186. package/dist/chunk-3x6p9me0.js +0 -2
  187. package/dist/chunk-440yjsk5.js +0 -2
  188. package/dist/chunk-58z26y07.js +0 -2
  189. package/dist/chunk-5db5sxy3.js +0 -3
  190. package/dist/chunk-5r9k9s3m.js +0 -2
  191. package/dist/chunk-76vza4ve.js +0 -2
  192. package/dist/chunk-84f9dnq5.js +0 -2
  193. package/dist/chunk-8tq5x4z8.js +0 -2
  194. package/dist/chunk-8y8bbsh5.js +0 -2
  195. package/dist/chunk-9kzycb15.js +0 -2
  196. package/dist/chunk-agfhb2qd.js +0 -2
  197. package/dist/chunk-ay6dzpt4.js +0 -2
  198. package/dist/chunk-b9njk81d.js +0 -2
  199. package/dist/chunk-bfbcmfww.js +0 -2
  200. package/dist/chunk-br01jvra.js +0 -2
  201. package/dist/chunk-c12y2bet.js +0 -2
  202. package/dist/chunk-c2nwchk0.js +0 -2
  203. package/dist/chunk-cxqrwvc5.js +0 -2
  204. package/dist/chunk-czea8zr1.js +0 -2
  205. package/dist/chunk-d99kfx3k.js +0 -2
  206. package/dist/chunk-dpn1pmxj.js +0 -2
  207. package/dist/chunk-dskrwa8f.js +0 -2
  208. package/dist/chunk-e6ycqvdm.js +0 -2
  209. package/dist/chunk-efgk2xv1.js +0 -2
  210. package/dist/chunk-fj70wq7k.js +0 -2
  211. package/dist/chunk-fvx6pd66.js +0 -2
  212. package/dist/chunk-hrbjapvr.js +0 -2
  213. package/dist/chunk-jc4mxq56.js +0 -2
  214. package/dist/chunk-jdpyxt8j.js +0 -2
  215. package/dist/chunk-k0zev8wc.js +0 -2
  216. package/dist/chunk-mhjwtkx9.js +0 -2
  217. package/dist/chunk-n4e02qdz.js +0 -2838
  218. package/dist/chunk-nx8rf4qd.js +0 -2
  219. package/dist/chunk-pe5bk9ns.js +0 -2
  220. package/dist/chunk-qb2j34sp.js +0 -2
  221. package/dist/chunk-qknfceta.js +0 -2
  222. package/dist/chunk-s932zfjz.js +0 -2
  223. package/dist/chunk-sf98zgw2.js +0 -2
  224. package/dist/chunk-sgsp4dph.js +0 -2
  225. package/dist/chunk-t48ws5j0.js +0 -2
  226. package/dist/chunk-tfxmzat6.js +0 -122
  227. package/dist/chunk-thbc9gtj.js +0 -2
  228. package/dist/chunk-tms7amrb.js +0 -2
  229. package/dist/chunk-tn9v10q2.js +0 -2
  230. package/dist/chunk-v0zgarvv.js +0 -2
  231. package/dist/chunk-v9jd283e.js +0 -2
  232. package/dist/chunk-vczw73ga.js +0 -2
  233. package/dist/chunk-webrqm20.js +0 -2
  234. package/dist/chunk-wg2w7zmt.js +0 -3
  235. package/dist/chunk-wgkxgsqx.js +0 -2
  236. package/dist/chunk-wngqr949.js +0 -2
  237. package/dist/chunk-xyzy84x0.js +0 -2
  238. package/dist/chunk-y1jffvkj.js +0 -2
  239. package/dist/chunk-yas134jv.js +0 -2
  240. package/dist/chunk-yd55vynh.js +0 -2
  241. package/dist/chunk-yygze2s0.js +0 -2
  242. package/dist/chunk-z732tf98.js +0 -2
  243. package/dist/chunk-ze86h6vp.js +0 -2
@@ -1,4 +1,5 @@
1
- import { SEMANTIC_TOKENS } from "../../theme-tokens.js";
1
+ import { DENSITY_FONT_SIZES, DENSITY_SPACING, SEMANTIC_TOKENS, SHAPE_TOKENS, tokenVariable } from "../../theme-tokens.js";
2
+ import { nativeDensitySpacing, nativeDensityType, nativeShapeRadius } from "./design-tokens.js";
2
3
  const colors = {
3
4
  transparent: "transparent",
4
5
  current: "currentColor",
@@ -412,7 +413,7 @@ function resolveSpacing(value) {
412
413
  const length = inner.endsWith("rem") ? Number.parseFloat(inner) * 16 : Number.parseFloat(inner);
413
414
  return Number.isFinite(length) ? length : void 0;
414
415
  }
415
- return spacing[value];
416
+ return spacing[value] ?? nativeDensitySpacing(value);
416
417
  }
417
418
  function resolveSize(value) {
418
419
  const percent = /^\[(-?\d*\.?\d+)%\]$/.exec(value);
@@ -735,7 +736,11 @@ function parseBackgroundColor(className, style) {
735
736
  function parseTextColor(className, style) {
736
737
  if (!className.startsWith("text-"))
737
738
  return !1;
738
- const value = className.slice(5);
739
+ const value = className.slice(5), density = nativeDensityType(value);
740
+ if (density) {
741
+ Object.assign(style, density);
742
+ return !0;
743
+ }
739
744
  if (fontSizes[value]) {
740
745
  style.fontSize = fontSizes[value];
741
746
  return !0;
@@ -971,60 +976,31 @@ function parseHeight(className, style) {
971
976
  return !1;
972
977
  }
973
978
  function parseBorderRadius(className, style) {
974
- if (!className.startsWith("rounded"))
975
- return !1;
976
979
  if (className === "rounded") {
977
980
  style.borderRadius = borderRadius.DEFAULT;
978
981
  return !0;
979
982
  }
983
+ if (!className.startsWith("rounded-"))
984
+ return !1;
980
985
  const value = className.slice(8);
981
986
  if (value === "")
982
987
  return !1;
983
- const corner = /^(?:(t|b|l|r)-)?(\[[^\]]+\])$/.exec(value);
984
- if (corner) {
985
- const r = arbitraryLength(corner[2]);
986
- if (r === void 0)
987
- return !1;
988
- const corners = {
989
- t: ["borderTopLeftRadius", "borderTopRightRadius"],
990
- b: ["borderBottomLeftRadius", "borderBottomRightRadius"],
991
- l: ["borderTopLeftRadius", "borderBottomLeftRadius"],
992
- r: ["borderTopRightRadius", "borderBottomRightRadius"]
993
- };
994
- for (const key of corner[1] ? corners[corner[1]] : ["borderRadius"])
995
- style[key] = r;
996
- return !0;
997
- }
998
- if (value.startsWith("t-")) {
999
- const r = borderRadius[value.slice(2)] ?? borderRadius.DEFAULT;
1000
- style.borderTopLeftRadius = r;
1001
- style.borderTopRightRadius = r;
1002
- return !0;
1003
- }
1004
- if (value.startsWith("b-")) {
1005
- const r = borderRadius[value.slice(2)] ?? borderRadius.DEFAULT;
1006
- style.borderBottomLeftRadius = r;
1007
- style.borderBottomRightRadius = r;
1008
- return !0;
1009
- }
1010
- if (value.startsWith("l-")) {
1011
- const r = borderRadius[value.slice(2)] ?? borderRadius.DEFAULT;
1012
- style.borderTopLeftRadius = r;
1013
- style.borderBottomLeftRadius = r;
1014
- return !0;
1015
- }
1016
- if (value.startsWith("r-")) {
1017
- const r = borderRadius[value.slice(2)] ?? borderRadius.DEFAULT;
1018
- style.borderTopRightRadius = r;
1019
- style.borderBottomRightRadius = r;
1020
- return !0;
1021
- }
1022
- const radius = borderRadius[value];
1023
- if (radius !== void 0) {
1024
- style.borderRadius = radius;
1025
- return !0;
1026
- }
1027
- return !1;
988
+ const corner = /^(?:(tl|tr|bl|br|t|b|l|r)-)?(.+)$/.exec(value), radius = borderRadius[corner[2]] ?? nativeShapeRadius(corner[2]) ?? arbitraryLength(corner[2]);
989
+ if (radius === void 0)
990
+ return !1;
991
+ const corners = {
992
+ t: ["borderTopLeftRadius", "borderTopRightRadius"],
993
+ b: ["borderBottomLeftRadius", "borderBottomRightRadius"],
994
+ l: ["borderTopLeftRadius", "borderBottomLeftRadius"],
995
+ r: ["borderTopRightRadius", "borderBottomRightRadius"],
996
+ tl: ["borderTopLeftRadius"],
997
+ tr: ["borderTopRightRadius"],
998
+ bl: ["borderBottomLeftRadius"],
999
+ br: ["borderBottomRightRadius"]
1000
+ };
1001
+ for (const key of corner[1] ? corners[corner[1]] : ["borderRadius"])
1002
+ style[key] = radius;
1003
+ return !0;
1028
1004
  }
1029
1005
  function parseBorderWidth(className, style) {
1030
1006
  if (!className.startsWith("border"))
@@ -1138,6 +1114,27 @@ function parsePosition(className, style) {
1138
1114
  style[match[2]] = typeof size === "number" && match[1] ? -size : size;
1139
1115
  return !0;
1140
1116
  }
1117
+ function parseTranslation(className, style) {
1118
+ const match = /^(-?)translate-(x|y)-(.+)$/.exec(className);
1119
+ if (!match)
1120
+ return !1;
1121
+ const token = match[3];
1122
+ let value;
1123
+ if (token.startsWith("[")) {
1124
+ const length = /^\[([+-]?(?:\d+\.?\d*|\.\d+))(px|rem|em)?\]$/.exec(token);
1125
+ if (!length)
1126
+ return !1;
1127
+ value = Number(length[1]) * (length[2]?.endsWith("em") ? 16 : 1);
1128
+ } else
1129
+ value = resolveSpacing(token);
1130
+ if (value === void 0 || !Number.isFinite(value))
1131
+ return !1;
1132
+ if (match[1])
1133
+ value = -value;
1134
+ const key = match[2] === "x" ? "translateX" : "translateY", step = key === "translateX" ? { translateX: value } : { translateY: value };
1135
+ style.transform = [...(style.transform ?? []).filter((previous) => !(key in previous)), step];
1136
+ return !0;
1137
+ }
1141
1138
  function parseSpace(className, style) {
1142
1139
  const match = /^space-(x|y)-(.+)$/.exec(className);
1143
1140
  if (!match)
@@ -1189,23 +1186,63 @@ function parseShadow(className, style) {
1189
1186
  Object.assign(style, { shadowColor: "#000000", shadowOpacity: opacity, shadowRadius: radius, shadowOffset: { width: 0, height: offset }, elevation });
1190
1187
  return !0;
1191
1188
  }
1192
- export function compileClassStyles(classes) {
1193
- const plain = [], dark = [], semanticDark = [];
1194
- function roleClass(name, scheme) {
1189
+ export function compileClassStyles(classes, variables) {
1190
+ const plain = [], dark = [], semanticDark = [], unsupported = [], originals = new Map;
1191
+ function roleClasses(name, scheme) {
1195
1192
  const match = /^(text|bg|border|ring)-([a-z-]+)(\/[^\s]+)?$/.exec(name), role = match && SEMANTIC_TOKENS[match[2]];
1196
- return role ? `${match[1]}-${role[scheme]}${match[3] || ""}` : name;
1193
+ if (role) {
1194
+ const override = variables?.get(tokenVariable(match[2]));
1195
+ return [`${match[1]}-${override === void 0 ? role[scheme] : `[${override}]`}${match[3] || ""}`];
1196
+ }
1197
+ const shape = /^rounded-(?:(tl|tr|bl|br|t|b|l|r)-)?(.+)$/.exec(name);
1198
+ if (shape && SHAPE_TOKENS[shape[2]]) {
1199
+ const radius = nativeShapeRadius(shape[2], variables);
1200
+ return radius === void 0 ? void 0 : [`rounded-${shape[1] ? `${shape[1]}-` : ""}[${radius}px]`];
1201
+ }
1202
+ const type = name.startsWith("text-") ? name.slice(5) : "";
1203
+ if (DENSITY_FONT_SIZES[type]) {
1204
+ const density = nativeDensityType(type, variables);
1205
+ return density && [`text-[${density.fontSize}px]`, `leading-[${density.lineHeight}px]`];
1206
+ }
1207
+ for (const token of Object.keys(DENSITY_SPACING)) {
1208
+ if (!name.endsWith(`-${token}`))
1209
+ continue;
1210
+ const length = nativeDensitySpacing(token, variables);
1211
+ return length === void 0 ? void 0 : [`${name.slice(0, -token.length)}[${length}px]`];
1212
+ }
1213
+ return [name];
1214
+ }
1215
+ function remember(translated, original) {
1216
+ if (!originals.has(translated))
1217
+ originals.set(translated, new Set);
1218
+ originals.get(translated).add(original);
1219
+ return translated;
1197
1220
  }
1198
1221
  for (const name of classes.split(/\s+/).filter(Boolean))
1199
- if (name.startsWith("dark:"))
1200
- dark.push(roleClass(name.slice(5), "dark"));
1201
- else if (!name.includes(":") || name.startsWith("[")) {
1202
- plain.push(roleClass(name, "light"));
1203
- if (roleClass(name, "dark") !== name)
1204
- semanticDark.push(roleClass(name, "dark"));
1205
- }
1206
- const unknown = [], result = { style: compileHeadwindToStyle(plain.join(" "), unknown), unknown };
1222
+ if (name.startsWith("dark:")) {
1223
+ const translated = roleClasses(name.slice(5), "dark");
1224
+ if (!translated)
1225
+ unsupported.push(name);
1226
+ else
1227
+ dark.push(...translated.map((value) => remember(value, name)));
1228
+ } else if (!name.includes(":") || name.startsWith("[")) {
1229
+ const lightClasses = roleClasses(name, "light"), darkClasses = roleClasses(name, "dark");
1230
+ if (!lightClasses || !darkClasses) {
1231
+ unsupported.push(name);
1232
+ continue;
1233
+ }
1234
+ plain.push(...lightClasses.map((value) => remember(value, name)));
1235
+ if (darkClasses.join(" ") !== lightClasses.join(" "))
1236
+ semanticDark.push(...darkClasses.map((value) => remember(value, name)));
1237
+ } else
1238
+ unsupported.push(name);
1239
+ const unknown = [], style = compileHeadwindToStyle(plain, unknown), result = { style, unknown };
1207
1240
  if (dark.length || semanticDark.length)
1208
- result.dark = compileHeadwindToStyle([...semanticDark, ...dark].join(" "), unknown);
1241
+ result.dark = compileHeadwindToStyle([...semanticDark, ...dark], unknown);
1242
+ if (style.transform && result.dark?.transform) {
1243
+ const overridden = new Set(result.dark.transform.flatMap((step) => Object.keys(step)));
1244
+ result.dark.transform = [...style.transform.filter((step) => !Object.keys(step).some((key) => overridden.has(key))), ...result.dark.transform];
1245
+ }
1209
1246
  for (const name of plain) {
1210
1247
  if (name === "truncate")
1211
1248
  result.numberOfLines = 1;
@@ -1215,11 +1252,12 @@ export function compileClassStyles(classes) {
1215
1252
  if (!result.icon && /^i-[a-z0-9]+-[a-z0-9-]+$/.test(name))
1216
1253
  result.icon = name;
1217
1254
  }
1218
- result.unknown = unknown.filter((name) => !/^line-clamp-\d+$/.test(name));
1255
+ const authoredUnknown = unknown.flatMap((name) => [...originals.get(name) ?? [name]]);
1256
+ result.unknown = [...new Set([...authoredUnknown.filter((name) => !/^line-clamp-\d+$/.test(name)), ...unsupported])];
1219
1257
  return result;
1220
1258
  }
1221
1259
  export function compileHeadwindToStyle(classes, unknown) {
1222
- const style = {}, classNames = classes.split(/\s+/).filter(Boolean);
1260
+ const style = {}, classNames = Array.isArray(classes) ? classes : classes.split(/\s+/).filter(Boolean);
1223
1261
  for (const className of classNames) {
1224
1262
  if (/^i-[a-z0-9]+-/.test(className))
1225
1263
  continue;
@@ -1266,6 +1304,8 @@ export function compileHeadwindToStyle(classes, unknown) {
1266
1304
  continue;
1267
1305
  if (parsePosition(className, style))
1268
1306
  continue;
1307
+ if (parseTranslation(className, style))
1308
+ continue;
1269
1309
  if (parseSpace(className, style))
1270
1310
  continue;
1271
1311
  unknown?.push(className);
@@ -44,4 +44,6 @@ export type TranslationDiagnosticKind = | 'unmapped-tag'
44
44
  /** A legacy virtual-list prop has no meaning in the shared-runtime tree. */
45
45
  | 'unsupported-list-prop'
46
46
  /** A control with no supported native interaction contract. */
47
- | 'unsupported-control';
47
+ | 'unsupported-control'
48
+ /** A theme declaration cannot be evaluated faithfully on the native target. */
49
+ | 'unsupported-theme-rule';
@@ -1,7 +1,11 @@
1
1
  import { NATIVE_EVENT_NAMES as EVENT_NAMES } from "../event-names.js";
2
+ import { applyStaticAccessibility } from "../accessibility.js";
2
3
  import { NATIVE_BOOLEAN_PROPS, nativePropName } from "../prop-names.js";
3
4
  import { mapToNativeComponent } from "./component-mapping.js";
4
5
  import { resolveIconName } from "./icons.js";
6
+ import { parseNativeStyle } from "./inline-style.js";
7
+ import { createStyleVariables } from "./style-variables.js";
8
+ import { extractStylesheetTheme } from "./stylesheet-theme.js";
5
9
  import { parseViewBox, SVG_DROPPED, SVG_NODE_TYPES, SVG_TYPES, svgGeometry } from "./svg.js";
6
10
  import { compileClassStyles } from "./headwind-to-style.js";
7
11
  import { createDocument, createNode } from "./ir.js";
@@ -41,153 +45,7 @@ export const NATIVE_EVENTS = new Set([
41
45
  "onSubmitEditing",
42
46
  "onValueChange"
43
47
  ]);
44
- const STYLE_KEYS = new Set([
45
- "display",
46
- "gridColumns",
47
- "gridTemplateColumns",
48
- "gridAutoRows",
49
- "flex",
50
- "flexGrow",
51
- "flexShrink",
52
- "flexBasis",
53
- "flexDirection",
54
- "flexWrap",
55
- "justifyContent",
56
- "alignItems",
57
- "alignSelf",
58
- "alignContent",
59
- "position",
60
- "top",
61
- "right",
62
- "bottom",
63
- "left",
64
- "zIndex",
65
- "width",
66
- "height",
67
- "minWidth",
68
- "maxWidth",
69
- "minHeight",
70
- "maxHeight",
71
- "aspectRatio",
72
- "margin",
73
- "marginTop",
74
- "marginRight",
75
- "marginBottom",
76
- "marginLeft",
77
- "marginHorizontal",
78
- "marginVertical",
79
- "padding",
80
- "paddingTop",
81
- "paddingRight",
82
- "paddingBottom",
83
- "paddingLeft",
84
- "paddingHorizontal",
85
- "paddingVertical",
86
- "gap",
87
- "rowGap",
88
- "columnGap",
89
- "borderWidth",
90
- "borderTopWidth",
91
- "borderRightWidth",
92
- "borderBottomWidth",
93
- "borderLeftWidth",
94
- "borderColor",
95
- "borderTopColor",
96
- "borderRightColor",
97
- "borderBottomColor",
98
- "borderLeftColor",
99
- "borderRadius",
100
- "borderTopLeftRadius",
101
- "borderTopRightRadius",
102
- "borderBottomLeftRadius",
103
- "borderBottomRightRadius",
104
- "borderStyle",
105
- "backgroundColor",
106
- "backgroundImage",
107
- "opacity",
108
- "shadowColor",
109
- "shadowOffset",
110
- "shadowOpacity",
111
- "shadowRadius",
112
- "elevation",
113
- "color",
114
- "fontSize",
115
- "fontWeight",
116
- "fontStyle",
117
- "fontFamily",
118
- "lineHeight",
119
- "letterSpacing",
120
- "textAlign",
121
- "textDecorationLine",
122
- "textDecorationColor",
123
- "textTransform",
124
- "resizeMode",
125
- "tintColor",
126
- "transform",
127
- "overflow",
128
- "fill",
129
- "stroke",
130
- "strokeWidth",
131
- "gradientDirection",
132
- "gradientFrom",
133
- "gradientVia",
134
- "gradientTo"
135
- ]), NUMERIC_STYLE_KEYS = new Set([
136
- "gridColumns",
137
- "gridAutoRows",
138
- "flex",
139
- "flexGrow",
140
- "flexShrink",
141
- "zIndex",
142
- "aspectRatio",
143
- "gap",
144
- "rowGap",
145
- "columnGap",
146
- "borderWidth",
147
- "borderTopWidth",
148
- "borderRightWidth",
149
- "borderBottomWidth",
150
- "borderLeftWidth",
151
- "borderRadius",
152
- "borderTopLeftRadius",
153
- "borderTopRightRadius",
154
- "borderBottomLeftRadius",
155
- "borderBottomRightRadius",
156
- "opacity",
157
- "shadowOpacity",
158
- "shadowRadius",
159
- "elevation",
160
- "fontSize",
161
- "lineHeight",
162
- "letterSpacing",
163
- "strokeWidth"
164
- ]), DIMENSION_STYLE_KEYS = new Set([
165
- "top",
166
- "right",
167
- "bottom",
168
- "left",
169
- "width",
170
- "height",
171
- "minWidth",
172
- "maxWidth",
173
- "minHeight",
174
- "maxHeight",
175
- "flexBasis",
176
- "margin",
177
- "marginTop",
178
- "marginRight",
179
- "marginBottom",
180
- "marginLeft",
181
- "marginHorizontal",
182
- "marginVertical",
183
- "padding",
184
- "paddingTop",
185
- "paddingRight",
186
- "paddingBottom",
187
- "paddingLeft",
188
- "paddingHorizontal",
189
- "paddingVertical"
190
- ]), NATIVE_TYPES = new Set([
48
+ const NATIVE_TYPES = new Set([
191
49
  "Sidebar",
192
50
  "SplitView",
193
51
  "View",
@@ -248,21 +106,8 @@ function decodeEntities(text) {
248
106
  return whole;
249
107
  });
250
108
  }
251
- function camelCase(property) {
252
- return property.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
253
- }
254
- function styleValue(raw) {
255
- const pixels = /^(-?[\d.]+)px$/.exec(raw);
256
- if (pixels)
257
- return Number.parseFloat(pixels[1]);
258
- const relative = /^(-?[\d.]+)r?em$/.exec(raw);
259
- if (relative)
260
- return Number.parseFloat(relative[1]) * 16;
261
- if (/^-?[\d.]+$/.test(raw))
262
- return Number.parseFloat(raw);
263
- return raw;
264
- }
265
- function readAttributes(tag, attributes, diagnostics) {
109
+ function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
110
+ let variables = styleContext.inheritedVariables;
266
111
  const props = {}, events = {}, bindings = {};
267
112
  let classes = "", inline = {};
268
113
  for (const [rawName, value] of attributes) {
@@ -272,7 +117,10 @@ function readAttributes(tag, attributes, diagnostics) {
272
117
  continue;
273
118
  }
274
119
  if (name === "style") {
275
- inline = { ...inline, ...inlineStyle(tag, value, diagnostics) };
120
+ inline = { ...inline, ...inlineStyle(tag, value, diagnostics, { ...styleContext, onVariables(value) {
121
+ variables = value;
122
+ styleContext.onVariables?.(value);
123
+ } }) };
276
124
  continue;
277
125
  }
278
126
  if (name.startsWith(":") || name.startsWith("x-") && name !== "x-cloak") {
@@ -305,92 +153,26 @@ function readAttributes(tag, attributes, diagnostics) {
305
153
  props[prop] = decoded;
306
154
  }
307
155
  }
308
- const compiledClasses = classes ? compileClassStyles(classes) : void 0;
156
+ const compiledClasses = classes ? compileClassStyles(classes, variables) : void 0;
309
157
  for (const name of new Set(compiledClasses?.unknown ?? []))
310
158
  diagnostics.push({ kind: "unknown-class", tag, name });
311
159
  const style = { ...compiledClasses?.style, ...inline };
312
160
  return { props, style, events, bindings, classes, inline };
313
161
  }
314
- function structuredStyle(property, value) {
315
- if (property === "shadowOffset") {
316
- if (!value || typeof value !== "object" || Array.isArray(value))
317
- return;
318
- const { width, height } = value;
319
- return typeof width === "number" && typeof height === "number" ? { width, height } : void 0;
320
- }
321
- if (property === "transform") {
322
- if (!Array.isArray(value))
323
- return;
324
- const steps = value.filter((step) => Boolean(step) && typeof step === "object" && !Array.isArray(step) && Object.keys(step).length === 1).filter((step) => ["number", "string"].includes(typeof Object.values(step)[0]));
325
- return steps.length ? steps : void 0;
326
- }
327
- return;
328
- }
329
- function holdsString(property, value) {
330
- if (NUMERIC_STYLE_KEYS.has(property))
331
- return !1;
332
- if (DIMENSION_STYLE_KEYS.has(property))
333
- return /^-?[\d.]+%$/.test(value);
334
- return !0;
335
- }
336
- function inlineStyle(tag, css, diagnostics) {
337
- const style = {}, decoded = decodeEntities(css);
338
- try {
339
- const object = JSON.parse(decoded);
340
- if (object && typeof object === "object" && !Array.isArray(object)) {
341
- for (const [rawProperty, rawValue] of Object.entries(object)) {
342
- const property = STYLE_KEYS.has(rawProperty) ? rawProperty : camelCase(rawProperty.trim().toLowerCase());
343
- if (!STYLE_KEYS.has(property)) {
344
- diagnostics.push({ kind: "unknown-style", tag, name: property });
345
- continue;
346
- }
347
- if (rawValue === null || rawValue === void 0)
348
- continue;
349
- const translated = typeof rawValue === "string" ? styleValue(rawValue) : rawValue;
350
- if (typeof translated === "object") {
351
- const kept = structuredStyle(property, translated);
352
- if (kept === void 0)
353
- diagnostics.push({ kind: "non-numeric-style", tag, name: property });
354
- else
355
- style[property] = kept;
356
- continue;
357
- }
358
- if (typeof translated !== "string" && typeof translated !== "number")
359
- continue;
360
- if (typeof translated === "string" && !holdsString(property, translated)) {
361
- diagnostics.push({ kind: "non-numeric-style", tag, name: property });
362
- continue;
363
- }
364
- style[property] = translated;
365
- }
366
- return style;
367
- }
368
- } catch {}
369
- for (const declaration of decoded.split(";")) {
370
- const colon = declaration.indexOf(":");
371
- if (colon === -1)
372
- continue;
373
- const property = camelCase(declaration.slice(0, colon).trim().toLowerCase()), value = declaration.slice(colon + 1).trim();
374
- if (!property || !value)
375
- continue;
376
- if (!STYLE_KEYS.has(property)) {
377
- diagnostics.push({ kind: "unknown-style", tag, name: property });
378
- continue;
379
- }
380
- const translated = styleValue(value);
381
- if (typeof translated === "string" && !holdsString(property, translated)) {
382
- diagnostics.push({ kind: "non-numeric-style", tag, name: property });
383
- continue;
384
- }
385
- style[property] = translated;
386
- }
387
- return style;
162
+ function inlineStyle(tag, css, diagnostics, context) {
163
+ return parseNativeStyle(decodeEntities(css), (diagnostic) => diagnostics.push({ ...diagnostic, tag }), context);
388
164
  }
389
165
  function flattenText(node) {
390
166
  return node.children.map((child) => typeof child === "string" ? child : flattenText(child)).join("").replace(/\s+/g, " ").trim();
391
167
  }
392
168
  function settle(frame, diagnostics) {
393
169
  const node = frame.node, elements = node.children.filter((child) => typeof child !== "string"), text = node.children.filter((child) => typeof child === "string").join("").trim();
170
+ if (frame.tag === "button" && node.type === "Button" && !frame.declaredNative && elements.length > 0) {
171
+ node.type = "Pressable";
172
+ node.props.accessibilityRole ??= node.props.role ?? "button";
173
+ node.children = node.children.flatMap((child) => typeof child === "string" ? child.trim() ? [createNode("Text", {}, {}, {}, [child.trim()])] : [] : [child]);
174
+ return node;
175
+ }
394
176
  if (node.type === "Svg" || node.type === "G") {
395
177
  node.children = elements;
396
178
  return node;
@@ -426,7 +208,7 @@ function settle(frame, diagnostics) {
426
208
  return node;
427
209
  }
428
210
  export async function translateHtmlToIR(html, options = {}) {
429
- const diagnostics = [], roots = [], stack = [], seenUnmapped = new Set;
211
+ const diagnostics = [], stylesheetTheme = await extractStylesheetTheme(html, (name) => diagnostics.push({ kind: "unsupported-theme-rule", tag: "style", name })), stylesheetVariables = createStyleVariables(stylesheetTheme.light).computed(), roots = [], stack = [], seenUnmapped = new Set;
430
212
  function attach(node) {
431
213
  const parent = stack[stack.length - 1];
432
214
  if (!parent)
@@ -435,11 +217,16 @@ export async function translateHtmlToIR(html, options = {}) {
435
217
  parent.node.children.push(node);
436
218
  }
437
219
  function hoist(frame) {
220
+ const preserveVariables = (node) => {
221
+ if (frame.tag !== "html" && frame.node._styleSource)
222
+ node._styleAncestors = [frame.node._styleSource, ...node._styleAncestors ?? []];
223
+ };
438
224
  if (frame.node.bindings && Object.keys(frame.node.bindings).length > 0) {
439
225
  const children = frame.node.children, elements = children.filter((child) => typeof child !== "string"), target = elements.length === 1 && elements.length === children.length ? elements[0] : createNode("View", {}, {}, {}, children);
440
226
  target.bindings = { ...frame.node.bindings, ...target.bindings };
441
227
  if (target.bindingId === void 0 && frame.node.bindingId !== void 0)
442
228
  target.bindingId = frame.node.bindingId;
229
+ preserveVariables(target);
443
230
  attach(target);
444
231
  return;
445
232
  }
@@ -450,6 +237,7 @@ export async function translateHtmlToIR(html, options = {}) {
450
237
  parent.node.children.push(child);
451
238
  continue;
452
239
  }
240
+ preserveVariables(child);
453
241
  if (!parent)
454
242
  roots.push(child);
455
243
  else if (!parent.dropped)
@@ -460,7 +248,14 @@ export async function translateHtmlToIR(html, options = {}) {
460
248
  const parentFrame = stack[stack.length - 1];
461
249
  if (tag === "svg" || parentFrame?.svg)
462
250
  return openSvg(tag, attributes, parentFrame);
463
- const dropped = DROP_SUBTREE.has(tag) && !BOX_ONLY.has(tag), inheritedDrop = stack[stack.length - 1]?.dropped ?? !1, { props, style, events, bindings, classes, inline } = dropped || inheritedDrop ? { props: {}, style: {}, events: {}, bindings: {}, classes: "", inline: {} } : readAttributes(tag, attributes, diagnostics), declared = props["data-native"];
251
+ const dropped = DROP_SUBTREE.has(tag) && !BOX_ONLY.has(tag), inheritedDrop = stack[stack.length - 1]?.dropped ?? !1;
252
+ let variables = parentFrame?.variables ?? stylesheetVariables;
253
+ const { props, style, events, bindings, classes, inline } = dropped || inheritedDrop ? { props: {}, style: {}, events: {}, bindings: {}, classes: "", inline: {} } : readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
254
+ variables = value;
255
+ } });
256
+ if (tag === "html")
257
+ variables = stylesheetVariables;
258
+ const declared = props["data-native"];
464
259
  let type;
465
260
  if (typeof declared === "string" && NATIVE_TYPES.has(declared)) {
466
261
  type = declared;
@@ -513,8 +308,10 @@ export async function translateHtmlToIR(html, options = {}) {
513
308
  if (names.has(lowerName))
514
309
  diagnostics.push({ kind: "unsupported-list-prop", tag: type, name: publicName });
515
310
  }
311
+ applyStaticAccessibility(props);
516
312
  const node = createNode(type, props, style, events);
517
313
  node._inlineStyle = inline;
314
+ node._styleSource = decodeEntities(attributes.find(([name]) => name === "style")?.[1] ?? "");
518
315
  const bindingId = props["data-stx-b"];
519
316
  if (typeof bindingId === "number" && Number.isInteger(bindingId))
520
317
  node.bindingId = bindingId;
@@ -530,6 +327,8 @@ export async function translateHtmlToIR(html, options = {}) {
530
327
  return {
531
328
  tag,
532
329
  node,
330
+ variables,
331
+ declaredNative: typeof declared === "string" && NATIVE_TYPES.has(declared),
533
332
  dropped: dropped || inheritedDrop || BOX_ONLY.has(tag),
534
333
  discard: dropped || inheritedDrop,
535
334
  unwrap: UNWRAP.has(tag)
@@ -544,7 +343,10 @@ export async function translateHtmlToIR(html, options = {}) {
544
343
  }
545
344
  return { tag, node: createNode("G", {}, {}, {}), svg: !0, dropped: !0, discard: !0, unwrap: !1 };
546
345
  }
547
- const { props, style, events, bindings, classes, inline } = readAttributes(tag, attributes, diagnostics);
346
+ let variables = parent?.variables ?? stylesheetVariables;
347
+ const { props, style, events, bindings, classes, inline } = readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
348
+ variables = value;
349
+ } });
548
350
  if (type === "Svg") {
549
351
  const viewBox = parseViewBox(props.viewBox);
550
352
  if (viewBox)
@@ -566,6 +368,7 @@ export async function translateHtmlToIR(html, options = {}) {
566
368
  props.geometry = geometry;
567
369
  const node = createNode(type, props, style, events);
568
370
  node._inlineStyle = inline;
371
+ node._styleSource = decodeEntities(attributes.find(([name]) => name === "style")?.[1] ?? "");
569
372
  const bindingId = props["data-stx-b"];
570
373
  if (typeof bindingId === "number" && Number.isInteger(bindingId))
571
374
  node.bindingId = bindingId;
@@ -578,7 +381,7 @@ export async function translateHtmlToIR(html, options = {}) {
578
381
  node.key = props.key;
579
382
  delete props.key;
580
383
  }
581
- return { tag, node, svg: !0, dropped: !1, discard: !1, unwrap: !1 };
384
+ return { tag, node, variables, svg: !0, dropped: !1, discard: !1, unwrap: !1 };
582
385
  }
583
386
  await new HTMLRewriter().on("*", {
584
387
  element(element) {
@@ -614,7 +417,10 @@ export async function translateHtmlToIR(html, options = {}) {
614
417
  }).transform(new Response(html)).text();
615
418
  if (roots.length === 0)
616
419
  throw Error(`No element to translate in the rendered output of ${options.source ?? "unknown"}`);
617
- return { root: roots.length === 1 ? roots[0] : createNode("View", {}, {}, {}, roots), diagnostics };
420
+ const root = roots.length === 1 ? roots[0] : createNode("View", {}, {}, {}, roots);
421
+ if (stylesheetTheme.light.length || stylesheetTheme.dark.length)
422
+ root._stylesheetTheme = stylesheetTheme;
423
+ return { root, diagnostics };
618
424
  }
619
425
  export async function translateHtmlToDocument(html, options = {}) {
620
426
  const { root, diagnostics } = await translateHtmlToIR(html, options), script = options.script ?? { exports: {}, functions: [], code: "" };
@@ -0,0 +1,13 @@
1
+ import { type NativeStyleVariables } from './style-variables';
2
+ import type { STXStyle } from './ir';
3
+ export declare function parseNativeStyle(input: unknown, report?: (diagnostic: NativeStyleDiagnostic) => void, context?: NativeStyleContext): STXStyle;
4
+ /** Resolve all same-element variable declarations before evaluating any style layer. */
5
+ export declare function parseNativeStyleLayers(inputs: unknown[], inheritedVariables: NativeStyleVariables | undefined, report: (diagnostic: NativeStyleDiagnostic) => void): { variables: NativeStyleVariables, styles: STXStyle[] };
6
+ export declare interface NativeStyleContext {
7
+ inheritedVariables?: NativeStyleVariables
8
+ onVariables?: (variables: NativeStyleVariables) => void
9
+ }
10
+ export declare interface NativeStyleDiagnostic {
11
+ kind: 'unknown-style' | 'non-numeric-style'
12
+ name: string
13
+ }