@stacksjs/stx 0.2.582 → 0.2.584

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 (261) hide show
  1. package/dist/{chunk-qazn64pm.js → chunk-03qf2z4d.js} +1 -1
  2. package/dist/{chunk-yk3fbzx5.js → chunk-07869zev.js} +4 -4
  3. package/dist/chunk-08g5j4fq.js +2 -0
  4. package/dist/chunk-0hpw65yr.js +2 -0
  5. package/dist/chunk-11jmasqb.js +2 -0
  6. package/dist/chunk-2c7ysn9s.js +2 -0
  7. package/dist/chunk-2wb1w0p6.js +2 -0
  8. package/dist/chunk-2wx2aczp.js +2 -0
  9. package/dist/chunk-325dn55d.js +4 -0
  10. package/dist/chunk-34kxj258.js +2 -0
  11. package/dist/{chunk-ktyctev3.js → chunk-3y5tzxm6.js} +2 -2
  12. package/dist/{chunk-h0a2s340.js → chunk-49xtxzr8.js} +2 -2
  13. package/dist/chunk-4efqcpg5.js +2 -0
  14. package/dist/{chunk-5kh5ehfh.js → chunk-4h58as2c.js} +2 -2
  15. package/dist/chunk-4k6h00kk.js +2 -0
  16. package/dist/{chunk-y8q1n7hx.js → chunk-4myvw20e.js} +10 -10
  17. package/dist/chunk-4szz2esp.js +2 -0
  18. package/dist/chunk-4wkghwag.js +2 -0
  19. package/dist/chunk-53grq69s.js +2 -0
  20. package/dist/chunk-55n8mhq4.js +2 -0
  21. package/dist/chunk-5s229r1e.js +2 -0
  22. package/dist/chunk-5zg3xj45.js +18 -0
  23. package/dist/{chunk-hzfhn2vr.js → chunk-67m2prah.js} +2 -2
  24. package/dist/chunk-6djvj6hg.js +2 -0
  25. package/dist/chunk-6ebj7gfr.js +2 -0
  26. package/dist/{chunk-g4crr86j.js → chunk-6hgngmn0.js} +3 -3
  27. package/dist/chunk-71tnfe1n.js +2 -0
  28. package/dist/{chunk-101ekf6y.js → chunk-794v5crp.js} +2 -2
  29. package/dist/chunk-7dkwf9h5.js +2 -0
  30. package/dist/{chunk-cnknvvwm.js → chunk-7fghm9zy.js} +1 -1
  31. package/dist/{chunk-ayy9mmrw.js → chunk-7ra30crf.js} +7 -7
  32. package/dist/{chunk-117xss52.js → chunk-7xw1e8t6.js} +2 -2
  33. package/dist/{chunk-c0s3k64c.js → chunk-7ydavm3h.js} +2 -2
  34. package/dist/{chunk-qdyp2zqf.js → chunk-82bttwqm.js} +2 -2
  35. package/dist/chunk-8992smwz.js +2 -0
  36. package/dist/{chunk-0vnngvy1.js → chunk-8s7zbhdd.js} +4 -4
  37. package/dist/chunk-8zn83jfs.js +2 -0
  38. package/dist/{chunk-zz02hwec.js → chunk-96zgn94z.js} +26 -26
  39. package/dist/{chunk-43h8q2cm.js → chunk-9cpxzze0.js} +9 -9
  40. package/dist/{chunk-vx75fb0d.js → chunk-9e091vkf.js} +3 -3
  41. package/dist/chunk-9pk5jhqa.js +3 -0
  42. package/dist/{chunk-dvgvvy5b.js → chunk-9r5w6s80.js} +3 -3
  43. package/dist/{chunk-c0h2eqe0.js → chunk-a8n6mt7s.js} +2 -2
  44. package/dist/{chunk-djft0m5h.js → chunk-agy4mxn8.js} +2 -2
  45. package/dist/{chunk-ev5f79mg.js → chunk-axz1x4r9.js} +5 -5
  46. package/dist/{chunk-6w2yqtrd.js → chunk-b5van393.js} +2 -2
  47. package/dist/{chunk-w3rmepwy.js → chunk-bfbmdjh4.js} +2 -2
  48. package/dist/chunk-bqtph83n.js +2 -0
  49. package/dist/chunk-bs1bdhvp.js +2 -0
  50. package/dist/{chunk-0k5faspy.js → chunk-bsy10tz6.js} +6 -6
  51. package/dist/chunk-c1c4sh7t.js +2 -0
  52. package/dist/{chunk-zk2xk0wd.js → chunk-c6egfhy6.js} +2 -2
  53. package/dist/chunk-ce2d0hz9.js +2 -0
  54. package/dist/chunk-cjq9k1xb.js +2 -0
  55. package/dist/{chunk-k9th7hc4.js → chunk-d2jb1rkp.js} +5 -5
  56. package/dist/{chunk-yfq2v7x5.js → chunk-d4awfk42.js} +7 -7
  57. package/dist/chunk-d9vjsqs4.js +2 -0
  58. package/dist/{chunk-8v19753h.js → chunk-e26pzdxy.js} +1 -1
  59. package/dist/{chunk-nrfh7gaa.js → chunk-e556dvy4.js} +3 -3
  60. package/dist/{chunk-3qrrv6af.js → chunk-e6h7pzym.js} +1 -1
  61. package/dist/{chunk-cb2pyg5t.js → chunk-ebfpjnf3.js} +2 -2
  62. package/dist/chunk-ede39b7h.js +3 -0
  63. package/dist/chunk-f0fxyh3e.js +2 -0
  64. package/dist/{chunk-4srg0qbv.js → chunk-f29fk7dw.js} +2 -2
  65. package/dist/chunk-fjyhc41r.js +2 -0
  66. package/dist/{chunk-1v1mew46.js → chunk-fkq55rh7.js} +1 -1
  67. package/dist/chunk-fn4wwgnc.js +2 -0
  68. package/dist/{chunk-t8wpzqs4.js → chunk-g8mxprxj.js} +1 -1
  69. package/dist/chunk-h2534p6q.js +2 -0
  70. package/dist/{chunk-9jh2ake5.js → chunk-h7atbtds.js} +5 -5
  71. package/dist/{chunk-yy3ser06.js → chunk-h988fxh3.js} +5 -5
  72. package/dist/chunk-hr34x6sx.js +2 -0
  73. package/dist/{chunk-ta3wn842.js → chunk-hsy9rhct.js} +2 -2
  74. package/dist/chunk-hygxh993.js +2 -0
  75. package/dist/{chunk-s12bnv32.js → chunk-hz11wmx9.js} +2 -2
  76. package/dist/{chunk-71sdgv7e.js → chunk-j7kcjgxy.js} +215 -56
  77. package/dist/chunk-j87tntna.js +2 -0
  78. package/dist/{chunk-tszkg6sj.js → chunk-jqbk6pfk.js} +2 -2
  79. package/dist/{chunk-be2ba3hj.js → chunk-k1szsenr.js} +2 -2
  80. package/dist/{chunk-3wy8q3aq.js → chunk-k3rnpjxf.js} +5 -5
  81. package/dist/{chunk-jtbzmbzz.js → chunk-k71e38fk.js} +4 -4
  82. package/dist/chunk-kgtnfvqb.js +2 -0
  83. package/dist/chunk-krwrx9x9.js +2 -0
  84. package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
  85. package/dist/{chunk-4rkvwm6v.js → chunk-m3w67x05.js} +9 -9
  86. package/dist/chunk-m5j8hht5.js +2 -0
  87. package/dist/chunk-mc8j6dwa.js +2 -0
  88. package/dist/{chunk-vpdx7qr3.js → chunk-mmbspaqh.js} +2 -2
  89. package/dist/{chunk-pmpb34md.js → chunk-n0t938d2.js} +7 -7
  90. package/dist/{chunk-c1r7zq0q.js → chunk-n2gy2arh.js} +89 -89
  91. package/dist/chunk-n2j3pn9s.js +2 -0
  92. package/dist/{chunk-sv5nvfmb.js → chunk-np6nm4rq.js} +2 -2
  93. package/dist/chunk-ns1jqzqk.js +2 -0
  94. package/dist/chunk-p973efbe.js +2 -0
  95. package/dist/{chunk-m8tm44rq.js → chunk-pg164sdw.js} +2 -2
  96. package/dist/{chunk-yhpyqsbr.js → chunk-pxw4edw8.js} +4 -4
  97. package/dist/{chunk-1r1maqep.js → chunk-q1cvef6b.js} +3 -3
  98. package/dist/chunk-q765v7b2.js +2 -0
  99. package/dist/{chunk-620szfcp.js → chunk-qebxzf9w.js} +3 -3
  100. package/dist/{chunk-jpqkm8tm.js → chunk-qf3axv86.js} +3 -3
  101. package/dist/{chunk-7hkc96de.js → chunk-qhr1tkhj.js} +7 -7
  102. package/dist/chunk-qq59xzwc.js +2 -0
  103. package/dist/chunk-r0e743c3.js +2 -0
  104. package/dist/{chunk-qccgncp2.js → chunk-rdm5mfc5.js} +6 -6
  105. package/dist/chunk-s043hpvd.js +2 -0
  106. package/dist/{chunk-rr8a7d4q.js → chunk-s1ptn02h.js} +3 -3
  107. package/dist/{chunk-xpnpg967.js → chunk-s5vxxwg6.js} +2 -2
  108. package/dist/chunk-sckze59r.js +2 -0
  109. package/dist/chunk-sjkdpsca.js +3 -0
  110. package/dist/chunk-sr1md7vv.js +2845 -0
  111. package/dist/chunk-t431anrx.js +2 -0
  112. package/dist/chunk-t7mxbt40.js +2 -0
  113. package/dist/{chunk-r47cs92n.js → chunk-tc15vkfh.js} +2 -2
  114. package/dist/{chunk-6z3e1tyz.js → chunk-tnafnb23.js} +1 -1
  115. package/dist/{chunk-ah9xyss2.js → chunk-v8ze2q95.js} +2 -2
  116. package/dist/{chunk-t4g2fptt.js → chunk-vf15db1j.js} +6 -6
  117. package/dist/chunk-vvqxbhfx.js +2 -0
  118. package/dist/{chunk-cdgwkzms.js → chunk-w24qmxc3.js} +3 -3
  119. package/dist/chunk-w7zgftez.js +2 -0
  120. package/dist/chunk-wfp36qf4.js +2 -0
  121. package/dist/chunk-wn2gzwmv.js +2 -0
  122. package/dist/{chunk-wwj8zbzc.js → chunk-wywprjc5.js} +5 -5
  123. package/dist/chunk-x5qymgxa.js +2 -0
  124. package/dist/chunk-xfe2nzxd.js +2 -0
  125. package/dist/chunk-xjwgzp6s.js +2 -0
  126. package/dist/chunk-xyepqdjy.js +2 -0
  127. package/dist/chunk-y5ryjdpv.js +122 -0
  128. package/dist/{chunk-3e3dpp7w.js → chunk-y5x8xnnf.js} +3 -3
  129. package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
  130. package/dist/chunk-yhqaafsw.js +2 -0
  131. package/dist/chunk-yn2d8x8m.js +3 -0
  132. package/dist/{chunk-kp0hg06s.js → chunk-z2mg470f.js} +4 -4
  133. package/dist/chunk-z7trbwn3.js +2 -0
  134. package/dist/{chunk-eww6sdzz.js → chunk-zgv1h2np.js} +2 -2
  135. package/dist/{chunk-bj29pwm0.js → chunk-zrw1zf54.js} +3 -3
  136. package/dist/chunk-zxf8f71v.js +2 -0
  137. package/dist/chunk-zxt75k06.js +2 -0
  138. package/dist/cli.js +46 -46
  139. package/dist/client/signals-authoring-runtime.js +13 -6
  140. package/dist/client/signals-binding-utils-runtime.js +14 -1
  141. package/dist/client/signals-component-api-runtime.js +3 -1
  142. package/dist/client/signals-event-shorthand-runtime.js +1 -1
  143. package/dist/client/signals-expression-runtime.js +1 -1
  144. package/dist/client/signals-host-runtime.js +72 -1
  145. package/dist/client/signals-manifest-hydration-runtime.js +20 -0
  146. package/dist/client/signals-model-runtime.js +2 -0
  147. package/dist/client/signals-mount-runtime.js +5 -1
  148. package/dist/client/signals-overlay-runtime.js +29 -6
  149. package/dist/client/signals-process-element-runtime.js +22 -7
  150. package/dist/client/signals-public-api-runtime.js +2 -0
  151. package/dist/client/signals-style-runtime.js +1 -1
  152. package/dist/component-model.d.ts +1 -1
  153. package/dist/component-model.js +6 -3
  154. package/dist/component-renderer.js +26 -6
  155. package/dist/composition-api.js +3 -2
  156. package/dist/craft-entry.js +2 -2
  157. package/dist/craft.js +2 -2
  158. package/dist/native/compiler/bundle.js +8 -3
  159. package/dist/native/compiler/design-tokens.d.ts +4 -0
  160. package/dist/native/compiler/design-tokens.js +28 -0
  161. package/dist/native/compiler/headwind-to-style.d.ts +5 -4
  162. package/dist/native/compiler/headwind-to-style.js +105 -65
  163. package/dist/native/compiler/html-to-ir.d.ts +5 -1
  164. package/dist/native/compiler/html-to-ir.js +75 -244
  165. package/dist/native/compiler/inline-style.d.ts +13 -0
  166. package/dist/native/compiler/inline-style.js +285 -0
  167. package/dist/native/compiler/ir.d.ts +5 -1
  168. package/dist/native/compiler/render-screen.js +3 -1
  169. package/dist/native/compiler/style-variables.d.ts +8 -0
  170. package/dist/native/compiler/style-variables.js +142 -0
  171. package/dist/native/compiler/stylesheet-theme.d.ts +6 -0
  172. package/dist/native/compiler/stylesheet-theme.js +110 -0
  173. package/dist/native/runtime/binding-tree.js +12 -0
  174. package/dist/native/runtime/craft-bridge.js +5 -2
  175. package/dist/native/runtime/jsc-globals.d.ts +10 -3
  176. package/dist/native/runtime/jsc-globals.js +23 -4
  177. package/dist/native/runtime/native-host.d.ts +17 -2
  178. package/dist/native/runtime/native-host.js +492 -39
  179. package/dist/native/runtime/overlay-presenter.d.ts +29 -0
  180. package/dist/native/runtime/overlay-presenter.js +69 -0
  181. package/dist/native/runtime/shared-screen.js +13 -1
  182. package/dist/native/runtime/view-operations.d.ts +20 -0
  183. package/dist/native/runtime/view-operations.js +35 -0
  184. package/dist/native/testing-mutations.d.ts +4 -0
  185. package/dist/native/testing-mutations.js +64 -0
  186. package/dist/native/testing.d.ts +2 -0
  187. package/dist/native/testing.js +19 -2
  188. package/dist/pwa.js +3 -3
  189. package/dist/ssg.js +8 -8
  190. package/dist/testing.js +2 -0
  191. package/dist/types/config-types.d.ts +2 -0
  192. package/dist/utils.d.ts +1 -1
  193. package/dist/utils.js +25 -5
  194. package/package.json +5 -5
  195. package/dist/chunk-0047meje.js +0 -2
  196. package/dist/chunk-00p22wzr.js +0 -3
  197. package/dist/chunk-1cat8kdj.js +0 -2
  198. package/dist/chunk-1dwnp35v.js +0 -2
  199. package/dist/chunk-2dnr5qfk.js +0 -2
  200. package/dist/chunk-2rx9d75e.js +0 -4
  201. package/dist/chunk-2v73cjbc.js +0 -2
  202. package/dist/chunk-30rf7k4n.js +0 -122
  203. package/dist/chunk-3akgppsy.js +0 -2
  204. package/dist/chunk-3x6p9me0.js +0 -2
  205. package/dist/chunk-4t67wmcg.js +0 -2
  206. package/dist/chunk-51zn42jy.js +0 -2
  207. package/dist/chunk-5702x95v.js +0 -2
  208. package/dist/chunk-5db5sxy3.js +0 -3
  209. package/dist/chunk-5pgbsc3a.js +0 -2
  210. package/dist/chunk-60c2bsh9.js +0 -2
  211. package/dist/chunk-79v4d9qh.js +0 -2
  212. package/dist/chunk-7pp2vx1g.js +0 -2
  213. package/dist/chunk-84f9dnq5.js +0 -2
  214. package/dist/chunk-8tq5x4z8.js +0 -2
  215. package/dist/chunk-8zm6tkqb.js +0 -2
  216. package/dist/chunk-a1z36dt5.js +0 -2
  217. package/dist/chunk-atsf1fe0.js +0 -2
  218. package/dist/chunk-b8qd6h1q.js +0 -2
  219. package/dist/chunk-ccxs40xy.js +0 -2
  220. package/dist/chunk-cg8hg6cs.js +0 -3
  221. package/dist/chunk-cp442y7a.js +0 -2
  222. package/dist/chunk-d4en5d3s.js +0 -2
  223. package/dist/chunk-dh80d57p.js +0 -2
  224. package/dist/chunk-dpn1pmxj.js +0 -2
  225. package/dist/chunk-dtcc09x1.js +0 -2
  226. package/dist/chunk-dyqte1xq.js +0 -2
  227. package/dist/chunk-e4n4v022.js +0 -2
  228. package/dist/chunk-efgk2xv1.js +0 -2
  229. package/dist/chunk-faghmmrs.js +0 -2838
  230. package/dist/chunk-fj70wq7k.js +0 -2
  231. package/dist/chunk-g2fw68zm.js +0 -2
  232. package/dist/chunk-hcgm37dy.js +0 -2
  233. package/dist/chunk-hd2bn5q7.js +0 -2
  234. package/dist/chunk-j1nqnmcd.js +0 -18
  235. package/dist/chunk-k7jqkt93.js +0 -2
  236. package/dist/chunk-mhjwtkx9.js +0 -2
  237. package/dist/chunk-mqy7g74k.js +0 -2
  238. package/dist/chunk-mxe21m6q.js +0 -2
  239. package/dist/chunk-ne03tfje.js +0 -2
  240. package/dist/chunk-p2sns0bn.js +0 -2
  241. package/dist/chunk-q2a58n2a.js +0 -2
  242. package/dist/chunk-s1sycp43.js +0 -2
  243. package/dist/chunk-s932zfjz.js +0 -2
  244. package/dist/chunk-sp46w7z9.js +0 -2
  245. package/dist/chunk-sy1bk1ry.js +0 -2
  246. package/dist/chunk-t48ws5j0.js +0 -2
  247. package/dist/chunk-thbc9gtj.js +0 -2
  248. package/dist/chunk-tn9v10q2.js +0 -2
  249. package/dist/chunk-tpd5nwa3.js +0 -2
  250. package/dist/chunk-tpt4bgs5.js +0 -2
  251. package/dist/chunk-v8p5p2kp.js +0 -2
  252. package/dist/chunk-v9jd283e.js +0 -2
  253. package/dist/chunk-vq0cb1m9.js +0 -2
  254. package/dist/chunk-wg2w7zmt.js +0 -3
  255. package/dist/chunk-wgkxgsqx.js +0 -2
  256. package/dist/chunk-y1bppxgw.js +0 -2
  257. package/dist/chunk-yv5rwthv.js +0 -2
  258. package/dist/chunk-yygze2s0.js +0 -2
  259. package/dist/chunk-z1r4tdqy.js +0 -2
  260. package/dist/chunk-z732tf98.js +0 -2
  261. package/dist/chunk-zv288w4e.js +0 -2
@@ -2,6 +2,9 @@ import { NATIVE_EVENT_NAMES as EVENT_NAMES } from "../event-names.js";
2
2
  import { NATIVE_BOOLEAN_PROPS, nativePropName } from "../prop-names.js";
3
3
  import { mapToNativeComponent } from "./component-mapping.js";
4
4
  import { resolveIconName } from "./icons.js";
5
+ import { parseNativeStyle } from "./inline-style.js";
6
+ import { createStyleVariables } from "./style-variables.js";
7
+ import { extractStylesheetTheme } from "./stylesheet-theme.js";
5
8
  import { parseViewBox, SVG_DROPPED, SVG_NODE_TYPES, SVG_TYPES, svgGeometry } from "./svg.js";
6
9
  import { compileClassStyles } from "./headwind-to-style.js";
7
10
  import { createDocument, createNode } from "./ir.js";
@@ -41,153 +44,7 @@ export const NATIVE_EVENTS = new Set([
41
44
  "onSubmitEditing",
42
45
  "onValueChange"
43
46
  ]);
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([
47
+ const NATIVE_TYPES = new Set([
191
48
  "Sidebar",
192
49
  "SplitView",
193
50
  "View",
@@ -248,21 +105,8 @@ function decodeEntities(text) {
248
105
  return whole;
249
106
  });
250
107
  }
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) {
108
+ function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
109
+ let variables = styleContext.inheritedVariables;
266
110
  const props = {}, events = {}, bindings = {};
267
111
  let classes = "", inline = {};
268
112
  for (const [rawName, value] of attributes) {
@@ -272,7 +116,10 @@ function readAttributes(tag, attributes, diagnostics) {
272
116
  continue;
273
117
  }
274
118
  if (name === "style") {
275
- inline = { ...inline, ...inlineStyle(tag, value, diagnostics) };
119
+ inline = { ...inline, ...inlineStyle(tag, value, diagnostics, { ...styleContext, onVariables(value) {
120
+ variables = value;
121
+ styleContext.onVariables?.(value);
122
+ } }) };
276
123
  continue;
277
124
  }
278
125
  if (name.startsWith(":") || name.startsWith("x-") && name !== "x-cloak") {
@@ -305,92 +152,26 @@ function readAttributes(tag, attributes, diagnostics) {
305
152
  props[prop] = decoded;
306
153
  }
307
154
  }
308
- const compiledClasses = classes ? compileClassStyles(classes) : void 0;
155
+ const compiledClasses = classes ? compileClassStyles(classes, variables) : void 0;
309
156
  for (const name of new Set(compiledClasses?.unknown ?? []))
310
157
  diagnostics.push({ kind: "unknown-class", tag, name });
311
158
  const style = { ...compiledClasses?.style, ...inline };
312
159
  return { props, style, events, bindings, classes, inline };
313
160
  }
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;
161
+ function inlineStyle(tag, css, diagnostics, context) {
162
+ return parseNativeStyle(decodeEntities(css), (diagnostic) => diagnostics.push({ ...diagnostic, tag }), context);
388
163
  }
389
164
  function flattenText(node) {
390
165
  return node.children.map((child) => typeof child === "string" ? child : flattenText(child)).join("").replace(/\s+/g, " ").trim();
391
166
  }
392
167
  function settle(frame, diagnostics) {
393
168
  const node = frame.node, elements = node.children.filter((child) => typeof child !== "string"), text = node.children.filter((child) => typeof child === "string").join("").trim();
169
+ if (frame.tag === "button" && node.type === "Button" && !frame.declaredNative && elements.length > 0) {
170
+ node.type = "Pressable";
171
+ node.props.accessibilityRole ??= node.props.role ?? "button";
172
+ node.children = node.children.flatMap((child) => typeof child === "string" ? child.trim() ? [createNode("Text", {}, {}, {}, [child.trim()])] : [] : [child]);
173
+ return node;
174
+ }
394
175
  if (node.type === "Svg" || node.type === "G") {
395
176
  node.children = elements;
396
177
  return node;
@@ -411,6 +192,11 @@ function settle(frame, diagnostics) {
411
192
  return node;
412
193
  }
413
194
  if (node.type === "Text" && elements.length > 0) {
195
+ if (elements.some((child) => child.type !== "Text")) {
196
+ node.type = "View";
197
+ node.children = node.children.map((child) => typeof child === "string" ? createNode("Text", {}, {}, {}, [child]) : child);
198
+ return node;
199
+ }
414
200
  const flattened = flattenText(node);
415
201
  diagnostics.push({ kind: "flattened-text", tag: frame.tag });
416
202
  node.children = flattened ? [flattened] : [];
@@ -421,7 +207,7 @@ function settle(frame, diagnostics) {
421
207
  return node;
422
208
  }
423
209
  export async function translateHtmlToIR(html, options = {}) {
424
- const diagnostics = [], roots = [], stack = [], seenUnmapped = new Set;
210
+ 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;
425
211
  function attach(node) {
426
212
  const parent = stack[stack.length - 1];
427
213
  if (!parent)
@@ -430,11 +216,16 @@ export async function translateHtmlToIR(html, options = {}) {
430
216
  parent.node.children.push(node);
431
217
  }
432
218
  function hoist(frame) {
219
+ const preserveVariables = (node) => {
220
+ if (frame.tag !== "html" && frame.node._styleSource)
221
+ node._styleAncestors = [frame.node._styleSource, ...node._styleAncestors ?? []];
222
+ };
433
223
  if (frame.node.bindings && Object.keys(frame.node.bindings).length > 0) {
434
224
  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);
435
225
  target.bindings = { ...frame.node.bindings, ...target.bindings };
436
226
  if (target.bindingId === void 0 && frame.node.bindingId !== void 0)
437
227
  target.bindingId = frame.node.bindingId;
228
+ preserveVariables(target);
438
229
  attach(target);
439
230
  return;
440
231
  }
@@ -445,6 +236,7 @@ export async function translateHtmlToIR(html, options = {}) {
445
236
  parent.node.children.push(child);
446
237
  continue;
447
238
  }
239
+ preserveVariables(child);
448
240
  if (!parent)
449
241
  roots.push(child);
450
242
  else if (!parent.dropped)
@@ -455,13 +247,38 @@ export async function translateHtmlToIR(html, options = {}) {
455
247
  const parentFrame = stack[stack.length - 1];
456
248
  if (tag === "svg" || parentFrame?.svg)
457
249
  return openSvg(tag, attributes, parentFrame);
458
- 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"];
250
+ const dropped = DROP_SUBTREE.has(tag) && !BOX_ONLY.has(tag), inheritedDrop = stack[stack.length - 1]?.dropped ?? !1;
251
+ let variables = parentFrame?.variables ?? stylesheetVariables;
252
+ const { props, style, events, bindings, classes, inline } = dropped || inheritedDrop ? { props: {}, style: {}, events: {}, bindings: {}, classes: "", inline: {} } : readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
253
+ variables = value;
254
+ } });
255
+ if (tag === "html")
256
+ variables = stylesheetVariables;
257
+ const declared = props["data-native"];
459
258
  let type;
460
259
  if (typeof declared === "string" && NATIVE_TYPES.has(declared)) {
461
260
  type = declared;
462
261
  delete props["data-native"];
463
- } else
262
+ } else {
464
263
  type = BOX_ONLY.has(tag) ? "View" : mapToNativeComponent(tag);
264
+ if (tag === "input") {
265
+ const inputType = String(props.type ?? "text").toLowerCase();
266
+ if (inputType === "checkbox") {
267
+ type = "Checkbox";
268
+ props.formValue = props.value ?? "on";
269
+ props.checked = props.checked === "" || props.checked === !0 || props.checked === "true";
270
+ props.value = props.checked;
271
+ } else if (inputType === "hidden") {
272
+ type = "View";
273
+ style.display = "none";
274
+ inline.display = "none";
275
+ } else if (inputType === "radio") {
276
+ type = "View";
277
+ props.accessibilityRole = "radio";
278
+ diagnostics.push({ kind: "unsupported-control", tag, name: "input:radio" });
279
+ }
280
+ }
281
+ }
465
282
  if (type === tag && !NATIVE_TYPES.has(type) && !DROP_SUBTREE.has(tag) && !UNWRAP.has(tag) && !seenUnmapped.has(tag)) {
466
283
  seenUnmapped.add(tag);
467
284
  diagnostics.push({ kind: "unmapped-tag", tag });
@@ -470,6 +287,10 @@ export async function translateHtmlToIR(html, options = {}) {
470
287
  seenUnmapped.add(`drop:${tag}`);
471
288
  diagnostics.push({ kind: "dropped-subtree", tag });
472
289
  }
290
+ if (tag === "form")
291
+ props["data-stx-form"] = !0;
292
+ if (tag === "button" && props.type === void 0)
293
+ props.type = "submit";
473
294
  if (type === "Video" && props.source === void 0 && props.src !== void 0) {
474
295
  props.source = props.src;
475
296
  delete props.src;
@@ -488,6 +309,7 @@ export async function translateHtmlToIR(html, options = {}) {
488
309
  }
489
310
  const node = createNode(type, props, style, events);
490
311
  node._inlineStyle = inline;
312
+ node._styleSource = decodeEntities(attributes.find(([name]) => name === "style")?.[1] ?? "");
491
313
  const bindingId = props["data-stx-b"];
492
314
  if (typeof bindingId === "number" && Number.isInteger(bindingId))
493
315
  node.bindingId = bindingId;
@@ -503,6 +325,8 @@ export async function translateHtmlToIR(html, options = {}) {
503
325
  return {
504
326
  tag,
505
327
  node,
328
+ variables,
329
+ declaredNative: typeof declared === "string" && NATIVE_TYPES.has(declared),
506
330
  dropped: dropped || inheritedDrop || BOX_ONLY.has(tag),
507
331
  discard: dropped || inheritedDrop,
508
332
  unwrap: UNWRAP.has(tag)
@@ -517,7 +341,10 @@ export async function translateHtmlToIR(html, options = {}) {
517
341
  }
518
342
  return { tag, node: createNode("G", {}, {}, {}), svg: !0, dropped: !0, discard: !0, unwrap: !1 };
519
343
  }
520
- const { props, style, events, bindings, classes, inline } = readAttributes(tag, attributes, diagnostics);
344
+ let variables = parent?.variables ?? stylesheetVariables;
345
+ const { props, style, events, bindings, classes, inline } = readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
346
+ variables = value;
347
+ } });
521
348
  if (type === "Svg") {
522
349
  const viewBox = parseViewBox(props.viewBox);
523
350
  if (viewBox)
@@ -539,6 +366,7 @@ export async function translateHtmlToIR(html, options = {}) {
539
366
  props.geometry = geometry;
540
367
  const node = createNode(type, props, style, events);
541
368
  node._inlineStyle = inline;
369
+ node._styleSource = decodeEntities(attributes.find(([name]) => name === "style")?.[1] ?? "");
542
370
  const bindingId = props["data-stx-b"];
543
371
  if (typeof bindingId === "number" && Number.isInteger(bindingId))
544
372
  node.bindingId = bindingId;
@@ -551,7 +379,7 @@ export async function translateHtmlToIR(html, options = {}) {
551
379
  node.key = props.key;
552
380
  delete props.key;
553
381
  }
554
- return { tag, node, svg: !0, dropped: !1, discard: !1, unwrap: !1 };
382
+ return { tag, node, variables, svg: !0, dropped: !1, discard: !1, unwrap: !1 };
555
383
  }
556
384
  await new HTMLRewriter().on("*", {
557
385
  element(element) {
@@ -587,7 +415,10 @@ export async function translateHtmlToIR(html, options = {}) {
587
415
  }).transform(new Response(html)).text();
588
416
  if (roots.length === 0)
589
417
  throw Error(`No element to translate in the rendered output of ${options.source ?? "unknown"}`);
590
- return { root: roots.length === 1 ? roots[0] : createNode("View", {}, {}, {}, roots), diagnostics };
418
+ const root = roots.length === 1 ? roots[0] : createNode("View", {}, {}, {}, roots);
419
+ if (stylesheetTheme.light.length || stylesheetTheme.dark.length)
420
+ root._stylesheetTheme = stylesheetTheme;
421
+ return { root, diagnostics };
591
422
  }
592
423
  export async function translateHtmlToDocument(html, options = {}) {
593
424
  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
+ }