@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.
- package/dist/{chunk-qazn64pm.js → chunk-03qf2z4d.js} +1 -1
- package/dist/{chunk-yk3fbzx5.js → chunk-07869zev.js} +4 -4
- package/dist/chunk-08g5j4fq.js +2 -0
- package/dist/chunk-0hpw65yr.js +2 -0
- package/dist/chunk-11jmasqb.js +2 -0
- package/dist/chunk-2c7ysn9s.js +2 -0
- package/dist/chunk-2wb1w0p6.js +2 -0
- package/dist/chunk-2wx2aczp.js +2 -0
- package/dist/chunk-325dn55d.js +4 -0
- package/dist/chunk-34kxj258.js +2 -0
- package/dist/{chunk-ktyctev3.js → chunk-3y5tzxm6.js} +2 -2
- package/dist/{chunk-h0a2s340.js → chunk-49xtxzr8.js} +2 -2
- package/dist/chunk-4efqcpg5.js +2 -0
- package/dist/{chunk-5kh5ehfh.js → chunk-4h58as2c.js} +2 -2
- package/dist/chunk-4k6h00kk.js +2 -0
- package/dist/{chunk-y8q1n7hx.js → chunk-4myvw20e.js} +10 -10
- package/dist/chunk-4szz2esp.js +2 -0
- package/dist/chunk-4wkghwag.js +2 -0
- package/dist/chunk-53grq69s.js +2 -0
- package/dist/chunk-55n8mhq4.js +2 -0
- package/dist/chunk-5s229r1e.js +2 -0
- package/dist/chunk-5zg3xj45.js +18 -0
- package/dist/{chunk-hzfhn2vr.js → chunk-67m2prah.js} +2 -2
- package/dist/chunk-6djvj6hg.js +2 -0
- package/dist/chunk-6ebj7gfr.js +2 -0
- package/dist/{chunk-g4crr86j.js → chunk-6hgngmn0.js} +3 -3
- package/dist/chunk-71tnfe1n.js +2 -0
- package/dist/{chunk-101ekf6y.js → chunk-794v5crp.js} +2 -2
- package/dist/chunk-7dkwf9h5.js +2 -0
- package/dist/{chunk-cnknvvwm.js → chunk-7fghm9zy.js} +1 -1
- package/dist/{chunk-ayy9mmrw.js → chunk-7ra30crf.js} +7 -7
- package/dist/{chunk-117xss52.js → chunk-7xw1e8t6.js} +2 -2
- package/dist/{chunk-c0s3k64c.js → chunk-7ydavm3h.js} +2 -2
- package/dist/{chunk-qdyp2zqf.js → chunk-82bttwqm.js} +2 -2
- package/dist/chunk-8992smwz.js +2 -0
- package/dist/{chunk-0vnngvy1.js → chunk-8s7zbhdd.js} +4 -4
- package/dist/chunk-8zn83jfs.js +2 -0
- package/dist/{chunk-zz02hwec.js → chunk-96zgn94z.js} +26 -26
- package/dist/{chunk-43h8q2cm.js → chunk-9cpxzze0.js} +9 -9
- package/dist/{chunk-vx75fb0d.js → chunk-9e091vkf.js} +3 -3
- package/dist/chunk-9pk5jhqa.js +3 -0
- package/dist/{chunk-dvgvvy5b.js → chunk-9r5w6s80.js} +3 -3
- package/dist/{chunk-c0h2eqe0.js → chunk-a8n6mt7s.js} +2 -2
- package/dist/{chunk-djft0m5h.js → chunk-agy4mxn8.js} +2 -2
- package/dist/{chunk-ev5f79mg.js → chunk-axz1x4r9.js} +5 -5
- package/dist/{chunk-6w2yqtrd.js → chunk-b5van393.js} +2 -2
- package/dist/{chunk-w3rmepwy.js → chunk-bfbmdjh4.js} +2 -2
- package/dist/chunk-bqtph83n.js +2 -0
- package/dist/chunk-bs1bdhvp.js +2 -0
- package/dist/{chunk-0k5faspy.js → chunk-bsy10tz6.js} +6 -6
- package/dist/chunk-c1c4sh7t.js +2 -0
- package/dist/{chunk-zk2xk0wd.js → chunk-c6egfhy6.js} +2 -2
- package/dist/chunk-ce2d0hz9.js +2 -0
- package/dist/chunk-cjq9k1xb.js +2 -0
- package/dist/{chunk-k9th7hc4.js → chunk-d2jb1rkp.js} +5 -5
- package/dist/{chunk-yfq2v7x5.js → chunk-d4awfk42.js} +7 -7
- package/dist/chunk-d9vjsqs4.js +2 -0
- package/dist/{chunk-8v19753h.js → chunk-e26pzdxy.js} +1 -1
- package/dist/{chunk-nrfh7gaa.js → chunk-e556dvy4.js} +3 -3
- package/dist/{chunk-3qrrv6af.js → chunk-e6h7pzym.js} +1 -1
- package/dist/{chunk-cb2pyg5t.js → chunk-ebfpjnf3.js} +2 -2
- package/dist/chunk-ede39b7h.js +3 -0
- package/dist/chunk-f0fxyh3e.js +2 -0
- package/dist/{chunk-4srg0qbv.js → chunk-f29fk7dw.js} +2 -2
- package/dist/chunk-fjyhc41r.js +2 -0
- package/dist/{chunk-1v1mew46.js → chunk-fkq55rh7.js} +1 -1
- package/dist/chunk-fn4wwgnc.js +2 -0
- package/dist/{chunk-t8wpzqs4.js → chunk-g8mxprxj.js} +1 -1
- package/dist/chunk-h2534p6q.js +2 -0
- package/dist/{chunk-9jh2ake5.js → chunk-h7atbtds.js} +5 -5
- package/dist/{chunk-yy3ser06.js → chunk-h988fxh3.js} +5 -5
- package/dist/chunk-hr34x6sx.js +2 -0
- package/dist/{chunk-ta3wn842.js → chunk-hsy9rhct.js} +2 -2
- package/dist/chunk-hygxh993.js +2 -0
- package/dist/{chunk-s12bnv32.js → chunk-hz11wmx9.js} +2 -2
- package/dist/{chunk-71sdgv7e.js → chunk-j7kcjgxy.js} +215 -56
- package/dist/chunk-j87tntna.js +2 -0
- package/dist/{chunk-tszkg6sj.js → chunk-jqbk6pfk.js} +2 -2
- package/dist/{chunk-be2ba3hj.js → chunk-k1szsenr.js} +2 -2
- package/dist/{chunk-3wy8q3aq.js → chunk-k3rnpjxf.js} +5 -5
- package/dist/{chunk-jtbzmbzz.js → chunk-k71e38fk.js} +4 -4
- package/dist/chunk-kgtnfvqb.js +2 -0
- package/dist/chunk-krwrx9x9.js +2 -0
- package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
- package/dist/{chunk-4rkvwm6v.js → chunk-m3w67x05.js} +9 -9
- package/dist/chunk-m5j8hht5.js +2 -0
- package/dist/chunk-mc8j6dwa.js +2 -0
- package/dist/{chunk-vpdx7qr3.js → chunk-mmbspaqh.js} +2 -2
- package/dist/{chunk-pmpb34md.js → chunk-n0t938d2.js} +7 -7
- package/dist/{chunk-c1r7zq0q.js → chunk-n2gy2arh.js} +89 -89
- package/dist/chunk-n2j3pn9s.js +2 -0
- package/dist/{chunk-sv5nvfmb.js → chunk-np6nm4rq.js} +2 -2
- package/dist/chunk-ns1jqzqk.js +2 -0
- package/dist/chunk-p973efbe.js +2 -0
- package/dist/{chunk-m8tm44rq.js → chunk-pg164sdw.js} +2 -2
- package/dist/{chunk-yhpyqsbr.js → chunk-pxw4edw8.js} +4 -4
- package/dist/{chunk-1r1maqep.js → chunk-q1cvef6b.js} +3 -3
- package/dist/chunk-q765v7b2.js +2 -0
- package/dist/{chunk-620szfcp.js → chunk-qebxzf9w.js} +3 -3
- package/dist/{chunk-jpqkm8tm.js → chunk-qf3axv86.js} +3 -3
- package/dist/{chunk-7hkc96de.js → chunk-qhr1tkhj.js} +7 -7
- package/dist/chunk-qq59xzwc.js +2 -0
- package/dist/chunk-r0e743c3.js +2 -0
- package/dist/{chunk-qccgncp2.js → chunk-rdm5mfc5.js} +6 -6
- package/dist/chunk-s043hpvd.js +2 -0
- package/dist/{chunk-rr8a7d4q.js → chunk-s1ptn02h.js} +3 -3
- package/dist/{chunk-xpnpg967.js → chunk-s5vxxwg6.js} +2 -2
- package/dist/chunk-sckze59r.js +2 -0
- package/dist/chunk-sjkdpsca.js +3 -0
- package/dist/chunk-sr1md7vv.js +2845 -0
- package/dist/chunk-t431anrx.js +2 -0
- package/dist/chunk-t7mxbt40.js +2 -0
- package/dist/{chunk-r47cs92n.js → chunk-tc15vkfh.js} +2 -2
- package/dist/{chunk-6z3e1tyz.js → chunk-tnafnb23.js} +1 -1
- package/dist/{chunk-ah9xyss2.js → chunk-v8ze2q95.js} +2 -2
- package/dist/{chunk-t4g2fptt.js → chunk-vf15db1j.js} +6 -6
- package/dist/chunk-vvqxbhfx.js +2 -0
- package/dist/{chunk-cdgwkzms.js → chunk-w24qmxc3.js} +3 -3
- package/dist/chunk-w7zgftez.js +2 -0
- package/dist/chunk-wfp36qf4.js +2 -0
- package/dist/chunk-wn2gzwmv.js +2 -0
- package/dist/{chunk-wwj8zbzc.js → chunk-wywprjc5.js} +5 -5
- package/dist/chunk-x5qymgxa.js +2 -0
- package/dist/chunk-xfe2nzxd.js +2 -0
- package/dist/chunk-xjwgzp6s.js +2 -0
- package/dist/chunk-xyepqdjy.js +2 -0
- package/dist/chunk-y5ryjdpv.js +122 -0
- package/dist/{chunk-3e3dpp7w.js → chunk-y5x8xnnf.js} +3 -3
- package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
- package/dist/chunk-yhqaafsw.js +2 -0
- package/dist/chunk-yn2d8x8m.js +3 -0
- package/dist/{chunk-kp0hg06s.js → chunk-z2mg470f.js} +4 -4
- package/dist/chunk-z7trbwn3.js +2 -0
- package/dist/{chunk-eww6sdzz.js → chunk-zgv1h2np.js} +2 -2
- package/dist/{chunk-bj29pwm0.js → chunk-zrw1zf54.js} +3 -3
- package/dist/chunk-zxf8f71v.js +2 -0
- package/dist/chunk-zxt75k06.js +2 -0
- package/dist/cli.js +46 -46
- package/dist/client/signals-authoring-runtime.js +13 -6
- package/dist/client/signals-binding-utils-runtime.js +14 -1
- package/dist/client/signals-component-api-runtime.js +3 -1
- package/dist/client/signals-event-shorthand-runtime.js +1 -1
- package/dist/client/signals-expression-runtime.js +1 -1
- package/dist/client/signals-host-runtime.js +72 -1
- package/dist/client/signals-manifest-hydration-runtime.js +20 -0
- package/dist/client/signals-model-runtime.js +2 -0
- package/dist/client/signals-mount-runtime.js +5 -1
- package/dist/client/signals-overlay-runtime.js +29 -6
- package/dist/client/signals-process-element-runtime.js +22 -7
- package/dist/client/signals-public-api-runtime.js +2 -0
- package/dist/client/signals-style-runtime.js +1 -1
- package/dist/component-model.d.ts +1 -1
- package/dist/component-model.js +6 -3
- package/dist/component-renderer.js +26 -6
- package/dist/composition-api.js +3 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/bundle.js +8 -3
- package/dist/native/compiler/design-tokens.d.ts +4 -0
- package/dist/native/compiler/design-tokens.js +28 -0
- package/dist/native/compiler/headwind-to-style.d.ts +5 -4
- package/dist/native/compiler/headwind-to-style.js +105 -65
- package/dist/native/compiler/html-to-ir.d.ts +5 -1
- package/dist/native/compiler/html-to-ir.js +75 -244
- package/dist/native/compiler/inline-style.d.ts +13 -0
- package/dist/native/compiler/inline-style.js +285 -0
- package/dist/native/compiler/ir.d.ts +5 -1
- package/dist/native/compiler/render-screen.js +3 -1
- package/dist/native/compiler/style-variables.d.ts +8 -0
- package/dist/native/compiler/style-variables.js +142 -0
- package/dist/native/compiler/stylesheet-theme.d.ts +6 -0
- package/dist/native/compiler/stylesheet-theme.js +110 -0
- package/dist/native/runtime/binding-tree.js +12 -0
- package/dist/native/runtime/craft-bridge.js +5 -2
- package/dist/native/runtime/jsc-globals.d.ts +10 -3
- package/dist/native/runtime/jsc-globals.js +23 -4
- package/dist/native/runtime/native-host.d.ts +17 -2
- package/dist/native/runtime/native-host.js +492 -39
- package/dist/native/runtime/overlay-presenter.d.ts +29 -0
- package/dist/native/runtime/overlay-presenter.js +69 -0
- package/dist/native/runtime/shared-screen.js +13 -1
- package/dist/native/runtime/view-operations.d.ts +20 -0
- package/dist/native/runtime/view-operations.js +35 -0
- package/dist/native/testing-mutations.d.ts +4 -0
- package/dist/native/testing-mutations.js +64 -0
- package/dist/native/testing.d.ts +2 -0
- package/dist/native/testing.js +19 -2
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +8 -8
- package/dist/testing.js +2 -0
- package/dist/types/config-types.d.ts +2 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +25 -5
- package/package.json +5 -5
- package/dist/chunk-0047meje.js +0 -2
- package/dist/chunk-00p22wzr.js +0 -3
- package/dist/chunk-1cat8kdj.js +0 -2
- package/dist/chunk-1dwnp35v.js +0 -2
- package/dist/chunk-2dnr5qfk.js +0 -2
- package/dist/chunk-2rx9d75e.js +0 -4
- package/dist/chunk-2v73cjbc.js +0 -2
- package/dist/chunk-30rf7k4n.js +0 -122
- package/dist/chunk-3akgppsy.js +0 -2
- package/dist/chunk-3x6p9me0.js +0 -2
- package/dist/chunk-4t67wmcg.js +0 -2
- package/dist/chunk-51zn42jy.js +0 -2
- package/dist/chunk-5702x95v.js +0 -2
- package/dist/chunk-5db5sxy3.js +0 -3
- package/dist/chunk-5pgbsc3a.js +0 -2
- package/dist/chunk-60c2bsh9.js +0 -2
- package/dist/chunk-79v4d9qh.js +0 -2
- package/dist/chunk-7pp2vx1g.js +0 -2
- package/dist/chunk-84f9dnq5.js +0 -2
- package/dist/chunk-8tq5x4z8.js +0 -2
- package/dist/chunk-8zm6tkqb.js +0 -2
- package/dist/chunk-a1z36dt5.js +0 -2
- package/dist/chunk-atsf1fe0.js +0 -2
- package/dist/chunk-b8qd6h1q.js +0 -2
- package/dist/chunk-ccxs40xy.js +0 -2
- package/dist/chunk-cg8hg6cs.js +0 -3
- package/dist/chunk-cp442y7a.js +0 -2
- package/dist/chunk-d4en5d3s.js +0 -2
- package/dist/chunk-dh80d57p.js +0 -2
- package/dist/chunk-dpn1pmxj.js +0 -2
- package/dist/chunk-dtcc09x1.js +0 -2
- package/dist/chunk-dyqte1xq.js +0 -2
- package/dist/chunk-e4n4v022.js +0 -2
- package/dist/chunk-efgk2xv1.js +0 -2
- package/dist/chunk-faghmmrs.js +0 -2838
- package/dist/chunk-fj70wq7k.js +0 -2
- package/dist/chunk-g2fw68zm.js +0 -2
- package/dist/chunk-hcgm37dy.js +0 -2
- package/dist/chunk-hd2bn5q7.js +0 -2
- package/dist/chunk-j1nqnmcd.js +0 -18
- package/dist/chunk-k7jqkt93.js +0 -2
- package/dist/chunk-mhjwtkx9.js +0 -2
- package/dist/chunk-mqy7g74k.js +0 -2
- package/dist/chunk-mxe21m6q.js +0 -2
- package/dist/chunk-ne03tfje.js +0 -2
- package/dist/chunk-p2sns0bn.js +0 -2
- package/dist/chunk-q2a58n2a.js +0 -2
- package/dist/chunk-s1sycp43.js +0 -2
- package/dist/chunk-s932zfjz.js +0 -2
- package/dist/chunk-sp46w7z9.js +0 -2
- package/dist/chunk-sy1bk1ry.js +0 -2
- package/dist/chunk-t48ws5j0.js +0 -2
- package/dist/chunk-thbc9gtj.js +0 -2
- package/dist/chunk-tn9v10q2.js +0 -2
- package/dist/chunk-tpd5nwa3.js +0 -2
- package/dist/chunk-tpt4bgs5.js +0 -2
- package/dist/chunk-v8p5p2kp.js +0 -2
- package/dist/chunk-v9jd283e.js +0 -2
- package/dist/chunk-vq0cb1m9.js +0 -2
- package/dist/chunk-wg2w7zmt.js +0 -3
- package/dist/chunk-wgkxgsqx.js +0 -2
- package/dist/chunk-y1bppxgw.js +0 -2
- package/dist/chunk-yv5rwthv.js +0 -2
- package/dist/chunk-yygze2s0.js +0 -2
- package/dist/chunk-z1r4tdqy.js +0 -2
- package/dist/chunk-z732tf98.js +0 -2
- package/dist/chunk-zv288w4e.js +0 -2
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { createStyleVariables } from "./style-variables.js";
|
|
2
|
+
const STYLE_KEYS = new Set([
|
|
3
|
+
"display",
|
|
4
|
+
"gridColumns",
|
|
5
|
+
"gridTemplateColumns",
|
|
6
|
+
"gridTemplateRows",
|
|
7
|
+
"gridAutoRows",
|
|
8
|
+
"flex",
|
|
9
|
+
"flexGrow",
|
|
10
|
+
"flexShrink",
|
|
11
|
+
"flexBasis",
|
|
12
|
+
"flexDirection",
|
|
13
|
+
"flexWrap",
|
|
14
|
+
"justifyContent",
|
|
15
|
+
"alignItems",
|
|
16
|
+
"alignSelf",
|
|
17
|
+
"alignContent",
|
|
18
|
+
"position",
|
|
19
|
+
"top",
|
|
20
|
+
"right",
|
|
21
|
+
"bottom",
|
|
22
|
+
"left",
|
|
23
|
+
"zIndex",
|
|
24
|
+
"width",
|
|
25
|
+
"height",
|
|
26
|
+
"minWidth",
|
|
27
|
+
"maxWidth",
|
|
28
|
+
"minHeight",
|
|
29
|
+
"maxHeight",
|
|
30
|
+
"aspectRatio",
|
|
31
|
+
"margin",
|
|
32
|
+
"marginTop",
|
|
33
|
+
"marginRight",
|
|
34
|
+
"marginBottom",
|
|
35
|
+
"marginLeft",
|
|
36
|
+
"marginHorizontal",
|
|
37
|
+
"marginVertical",
|
|
38
|
+
"padding",
|
|
39
|
+
"paddingTop",
|
|
40
|
+
"paddingRight",
|
|
41
|
+
"paddingBottom",
|
|
42
|
+
"paddingLeft",
|
|
43
|
+
"paddingHorizontal",
|
|
44
|
+
"paddingVertical",
|
|
45
|
+
"gap",
|
|
46
|
+
"rowGap",
|
|
47
|
+
"columnGap",
|
|
48
|
+
"borderWidth",
|
|
49
|
+
"borderTopWidth",
|
|
50
|
+
"borderRightWidth",
|
|
51
|
+
"borderBottomWidth",
|
|
52
|
+
"borderLeftWidth",
|
|
53
|
+
"borderColor",
|
|
54
|
+
"borderTopColor",
|
|
55
|
+
"borderRightColor",
|
|
56
|
+
"borderBottomColor",
|
|
57
|
+
"borderLeftColor",
|
|
58
|
+
"borderRadius",
|
|
59
|
+
"borderTopLeftRadius",
|
|
60
|
+
"borderTopRightRadius",
|
|
61
|
+
"borderBottomLeftRadius",
|
|
62
|
+
"borderBottomRightRadius",
|
|
63
|
+
"borderStyle",
|
|
64
|
+
"backgroundColor",
|
|
65
|
+
"backgroundImage",
|
|
66
|
+
"opacity",
|
|
67
|
+
"shadowColor",
|
|
68
|
+
"shadowOffset",
|
|
69
|
+
"shadowOpacity",
|
|
70
|
+
"shadowRadius",
|
|
71
|
+
"elevation",
|
|
72
|
+
"color",
|
|
73
|
+
"fontSize",
|
|
74
|
+
"fontWeight",
|
|
75
|
+
"fontStyle",
|
|
76
|
+
"fontFamily",
|
|
77
|
+
"lineHeight",
|
|
78
|
+
"letterSpacing",
|
|
79
|
+
"textAlign",
|
|
80
|
+
"textDecorationLine",
|
|
81
|
+
"textDecorationColor",
|
|
82
|
+
"textTransform",
|
|
83
|
+
"resizeMode",
|
|
84
|
+
"tintColor",
|
|
85
|
+
"transform",
|
|
86
|
+
"overflow",
|
|
87
|
+
"fill",
|
|
88
|
+
"stroke",
|
|
89
|
+
"strokeWidth",
|
|
90
|
+
"gradientDirection",
|
|
91
|
+
"gradientFrom",
|
|
92
|
+
"gradientVia",
|
|
93
|
+
"gradientTo"
|
|
94
|
+
]), NUMERIC_STYLE_KEYS = new Set([
|
|
95
|
+
"gridColumns",
|
|
96
|
+
"gridAutoRows",
|
|
97
|
+
"flex",
|
|
98
|
+
"flexGrow",
|
|
99
|
+
"flexShrink",
|
|
100
|
+
"zIndex",
|
|
101
|
+
"aspectRatio",
|
|
102
|
+
"gap",
|
|
103
|
+
"rowGap",
|
|
104
|
+
"columnGap",
|
|
105
|
+
"borderWidth",
|
|
106
|
+
"borderTopWidth",
|
|
107
|
+
"borderRightWidth",
|
|
108
|
+
"borderBottomWidth",
|
|
109
|
+
"borderLeftWidth",
|
|
110
|
+
"borderRadius",
|
|
111
|
+
"borderTopLeftRadius",
|
|
112
|
+
"borderTopRightRadius",
|
|
113
|
+
"borderBottomLeftRadius",
|
|
114
|
+
"borderBottomRightRadius",
|
|
115
|
+
"opacity",
|
|
116
|
+
"shadowOpacity",
|
|
117
|
+
"shadowRadius",
|
|
118
|
+
"elevation",
|
|
119
|
+
"fontSize",
|
|
120
|
+
"lineHeight",
|
|
121
|
+
"letterSpacing",
|
|
122
|
+
"strokeWidth"
|
|
123
|
+
]), DIMENSION_STYLE_KEYS = new Set([
|
|
124
|
+
"top",
|
|
125
|
+
"right",
|
|
126
|
+
"bottom",
|
|
127
|
+
"left",
|
|
128
|
+
"width",
|
|
129
|
+
"height",
|
|
130
|
+
"minWidth",
|
|
131
|
+
"maxWidth",
|
|
132
|
+
"minHeight",
|
|
133
|
+
"maxHeight",
|
|
134
|
+
"flexBasis",
|
|
135
|
+
"margin",
|
|
136
|
+
"marginTop",
|
|
137
|
+
"marginRight",
|
|
138
|
+
"marginBottom",
|
|
139
|
+
"marginLeft",
|
|
140
|
+
"marginHorizontal",
|
|
141
|
+
"marginVertical",
|
|
142
|
+
"padding",
|
|
143
|
+
"paddingTop",
|
|
144
|
+
"paddingRight",
|
|
145
|
+
"paddingBottom",
|
|
146
|
+
"paddingLeft",
|
|
147
|
+
"paddingHorizontal",
|
|
148
|
+
"paddingVertical"
|
|
149
|
+
]), NUMBER = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i, LENGTH = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px|rem|em)?$/i, ANGLE_TRANSFORMS = new Set(["rotate", "rotateX", "rotateY", "rotateZ", "skewX", "skewY"]), NUMBER_TRANSFORMS = new Set(["perspective", "scale", "scaleX", "scaleY", "translateX", "translateY"]);
|
|
150
|
+
function numericValue(value) {
|
|
151
|
+
if (typeof value !== "string")
|
|
152
|
+
return value;
|
|
153
|
+
const match = LENGTH.exec(value);
|
|
154
|
+
return match ? Number(match[1]) * (/^r?em$/i.test(match[2] || "") ? 16 : 1) : value;
|
|
155
|
+
}
|
|
156
|
+
function finite(value) {
|
|
157
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
158
|
+
}
|
|
159
|
+
function structuredStyle(property, value) {
|
|
160
|
+
if (property === "shadowOffset" && value && typeof value === "object" && !Array.isArray(value)) {
|
|
161
|
+
const { width, height } = value;
|
|
162
|
+
return finite(width) && finite(height) ? { width, height } : void 0;
|
|
163
|
+
}
|
|
164
|
+
if (property === "transform" && Array.isArray(value)) {
|
|
165
|
+
const steps = [];
|
|
166
|
+
for (const step of value) {
|
|
167
|
+
if (!step || typeof step !== "object" || Array.isArray(step) || Object.keys(step).length !== 1)
|
|
168
|
+
return;
|
|
169
|
+
const [key, raw] = Object.entries(step)[0];
|
|
170
|
+
if (NUMBER_TRANSFORMS.has(key) && finite(raw))
|
|
171
|
+
steps.push({ [key]: raw });
|
|
172
|
+
else if (ANGLE_TRANSFORMS.has(key) && typeof raw === "string" && /^[+-]?(?:\d+\.?\d*|\.\d+)(?:deg|rad)$/.test(raw))
|
|
173
|
+
steps.push({ [key]: raw });
|
|
174
|
+
else
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
return steps;
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
function declarations(css) {
|
|
182
|
+
const result = [];
|
|
183
|
+
let start = 0, depth = 0, quote = "";
|
|
184
|
+
for (let i = 0;i <= css.length; i++) {
|
|
185
|
+
const char = css[i];
|
|
186
|
+
if (char === "\\") {
|
|
187
|
+
i++;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (quote) {
|
|
191
|
+
if (char === quote)
|
|
192
|
+
quote = "";
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (char === '"' || char === "'") {
|
|
196
|
+
quote = char;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (char === "(")
|
|
200
|
+
depth++;
|
|
201
|
+
if (char === ")")
|
|
202
|
+
depth = Math.max(0, depth - 1);
|
|
203
|
+
if (i !== css.length && (char !== ";" || depth))
|
|
204
|
+
continue;
|
|
205
|
+
const declaration = css.slice(start, i), colon = declaration.indexOf(":");
|
|
206
|
+
if (colon !== -1)
|
|
207
|
+
result.push([declaration.slice(0, colon).trim(), declaration.slice(colon + 1).trim()]);
|
|
208
|
+
start = i + 1;
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
function styleEntries(input, report) {
|
|
213
|
+
let entries;
|
|
214
|
+
if (typeof input === "string") {
|
|
215
|
+
input = input.trim();
|
|
216
|
+
if (!input)
|
|
217
|
+
return [];
|
|
218
|
+
try {
|
|
219
|
+
input = JSON.parse(input);
|
|
220
|
+
} catch {}
|
|
221
|
+
}
|
|
222
|
+
if (typeof input === "string")
|
|
223
|
+
entries = declarations(input);
|
|
224
|
+
else if (input && typeof input === "object" && !Array.isArray(input))
|
|
225
|
+
entries = Object.entries(input);
|
|
226
|
+
else {
|
|
227
|
+
if (input != null && input !== !1)
|
|
228
|
+
report({ kind: "non-numeric-style", name: "style" });
|
|
229
|
+
return [];
|
|
230
|
+
}
|
|
231
|
+
return entries;
|
|
232
|
+
}
|
|
233
|
+
export function parseNativeStyle(input, report = () => {}, context = {}) {
|
|
234
|
+
const entries = styleEntries(input, report), variables = createStyleVariables(entries, context.inheritedVariables);
|
|
235
|
+
context.onVariables?.(variables.computed());
|
|
236
|
+
return parseEntries(entries, variables, report);
|
|
237
|
+
}
|
|
238
|
+
export function parseNativeStyleLayers(inputs, inheritedVariables, report) {
|
|
239
|
+
const layers = inputs.map((input) => styleEntries(input, report)), variables = createStyleVariables(layers.flat(), inheritedVariables);
|
|
240
|
+
return { variables: variables.computed(), styles: layers.map((entries) => parseEntries(entries, variables, report)) };
|
|
241
|
+
}
|
|
242
|
+
function parseEntries(entries, variables, report) {
|
|
243
|
+
const style = {}, declarationNames = [];
|
|
244
|
+
for (const [rawProperty, raw] of entries) {
|
|
245
|
+
if (rawProperty.trim().startsWith("--")) {
|
|
246
|
+
declarationNames.push(rawProperty.trim());
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
const property = STYLE_KEYS.has(rawProperty) || rawProperty.trim().startsWith("--") ? rawProperty : rawProperty.trim().toLowerCase().replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
250
|
+
if (!STYLE_KEYS.has(property)) {
|
|
251
|
+
report({ kind: "unknown-style", name: property });
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (raw == null || raw === "")
|
|
255
|
+
continue;
|
|
256
|
+
const value = typeof raw === "string" ? variables.resolve(raw.trim()) : raw;
|
|
257
|
+
if (value === void 0) {
|
|
258
|
+
report({ kind: "non-numeric-style", name: property });
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
if (value === "")
|
|
262
|
+
continue;
|
|
263
|
+
let translated;
|
|
264
|
+
if (NUMERIC_STYLE_KEYS.has(property) || DIMENSION_STYLE_KEYS.has(property)) {
|
|
265
|
+
translated = numericValue(value);
|
|
266
|
+
if (!finite(translated) && !(DIMENSION_STYLE_KEYS.has(property) && typeof translated === "string" && translated.endsWith("%") && NUMBER.test(translated.slice(0, -1)) && Number.isFinite(Number(translated.slice(0, -1)))))
|
|
267
|
+
translated = void 0;
|
|
268
|
+
} else if (property === "shadowOffset" || property === "transform")
|
|
269
|
+
translated = structuredStyle(property, value);
|
|
270
|
+
else if (property === "gridTemplateColumns" || property === "gridTemplateRows")
|
|
271
|
+
translated = finite(value) || typeof value === "string" ? value : void 0;
|
|
272
|
+
else if (property === "fontWeight" && finite(value))
|
|
273
|
+
translated = String(value);
|
|
274
|
+
else if (typeof value === "string")
|
|
275
|
+
translated = value;
|
|
276
|
+
if (translated === void 0)
|
|
277
|
+
report({ kind: "non-numeric-style", name: property });
|
|
278
|
+
else
|
|
279
|
+
style[property] = translated;
|
|
280
|
+
}
|
|
281
|
+
for (const name of declarationNames)
|
|
282
|
+
if (!variables.used.has(name))
|
|
283
|
+
report({ kind: "unknown-style", name });
|
|
284
|
+
return style;
|
|
285
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NativeStylesheetTheme } from './stylesheet-theme';
|
|
1
2
|
// ============================================================================
|
|
2
3
|
// Factory Functions
|
|
3
4
|
// ============================================================================
|
|
@@ -16,6 +17,9 @@ export declare interface STXNode {
|
|
|
16
17
|
darkStyle?: STXStyle
|
|
17
18
|
children: (STXNode | string)[]
|
|
18
19
|
_inlineStyle?: STXStyle
|
|
20
|
+
_styleSource?: string
|
|
21
|
+
_styleAncestors?: string[]
|
|
22
|
+
_stylesheetTheme?: NativeStylesheetTheme
|
|
19
23
|
_classes?: string
|
|
20
24
|
_source?: {
|
|
21
25
|
file: string
|
|
@@ -41,6 +45,7 @@ export declare interface STXStyle {
|
|
|
41
45
|
display?: 'flex' | 'none' | 'grid'
|
|
42
46
|
gridColumns?: number
|
|
43
47
|
gridTemplateColumns?: string | number
|
|
48
|
+
gridTemplateRows?: string | number
|
|
44
49
|
gridAutoRows?: number
|
|
45
50
|
flex?: number
|
|
46
51
|
flexGrow?: number
|
|
@@ -176,7 +181,6 @@ export declare interface ConditionalStyle {
|
|
|
176
181
|
condition: string
|
|
177
182
|
style: STXStyle
|
|
178
183
|
}
|
|
179
|
-
/* eslint-disable style/max-statements-per-line */
|
|
180
184
|
/**
|
|
181
185
|
* STX Native Intermediate Representation (IR)
|
|
182
186
|
*
|
|
@@ -20,10 +20,12 @@ export function nativePrimitivesDir() {
|
|
|
20
20
|
export async function compileScreenSource(source, filePath, options = {}) {
|
|
21
21
|
const root = options.root ?? path.dirname(filePath), loaded = await loadStxConfig(root), config = {
|
|
22
22
|
root,
|
|
23
|
-
componentsDir: options.componentsDir ?? path.join(root, "components"),
|
|
23
|
+
componentsDir: options.componentsDir ?? loaded.componentsDir ?? path.join(root, "components"),
|
|
24
24
|
buildMode: "serve",
|
|
25
25
|
cache: !1,
|
|
26
26
|
_targetComponentDirs: [nativePrimitivesDir()],
|
|
27
|
+
_targetComponentFallbackNames: ["Button"],
|
|
28
|
+
_nativeHostAttrs: !0,
|
|
27
29
|
_pluginComponentDirs: loaded._pluginComponentDirs ?? []
|
|
28
30
|
}, context = { ...options.context ?? {}, __stx_inject_css: !1 }, dependencies = new Set([filePath]), renderedHtml = await processDirectives(source, context, filePath, config, dependencies), { html, manifest } = extractBindingManifest(renderedHtml), { document, diagnostics } = await translateHtmlToDocument(html, {
|
|
29
31
|
source: filePath,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Inherited values are already computed at their declaring element. */
|
|
2
|
+
export declare function createStyleVariables(entries: Array<[string, unknown]>, inherited?: NativeStyleVariables): NativeStyleVariableResolver;
|
|
3
|
+
export declare interface NativeStyleVariableResolver {
|
|
4
|
+
resolve: (text: string) => string | undefined
|
|
5
|
+
used: Set<string>
|
|
6
|
+
computed: () => NativeStyleVariables
|
|
7
|
+
}
|
|
8
|
+
export type NativeStyleVariables = ReadonlyMap<string, string | undefined>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const NAME = /^--[\w\u0080-\uFFFF-]+$/u, LIMIT = 65536;
|
|
2
|
+
function substitute(input, lookup) {
|
|
3
|
+
if (!/var\(/i.test(input))
|
|
4
|
+
return input;
|
|
5
|
+
let output = "", quote = "", replaced = !1;
|
|
6
|
+
for (let i = 0;i < input.length; i++) {
|
|
7
|
+
const char = input[i];
|
|
8
|
+
if (char === "\\") {
|
|
9
|
+
output += input.slice(i, i + 2);
|
|
10
|
+
i++;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (quote) {
|
|
14
|
+
output += char;
|
|
15
|
+
if (char === quote)
|
|
16
|
+
quote = "";
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (char === '"' || char === "'") {
|
|
20
|
+
quote = char;
|
|
21
|
+
output += char;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (input.slice(i, i + 4).toLowerCase() !== "var(" || i > 0 && /[\w-]/.test(input[i - 1])) {
|
|
25
|
+
output += char;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
let depth = 1, comma = -1, innerQuote = "", end = i + 4;
|
|
29
|
+
for (;end < input.length; end++) {
|
|
30
|
+
const next = input[end];
|
|
31
|
+
if (next === "\\") {
|
|
32
|
+
end++;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (innerQuote) {
|
|
36
|
+
if (next === innerQuote)
|
|
37
|
+
innerQuote = "";
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (next === '"' || next === "'") {
|
|
41
|
+
innerQuote = next;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (next === "(")
|
|
45
|
+
depth++;
|
|
46
|
+
if (next === ")" && --depth === 0)
|
|
47
|
+
break;
|
|
48
|
+
if (next === "," && depth === 1 && comma === -1)
|
|
49
|
+
comma = end;
|
|
50
|
+
}
|
|
51
|
+
if (depth !== 0)
|
|
52
|
+
return;
|
|
53
|
+
const name = input.slice(i + 4, comma === -1 ? end : comma).trim();
|
|
54
|
+
if (!NAME.test(name))
|
|
55
|
+
return;
|
|
56
|
+
const replacement = lookup(name, comma === -1 ? void 0 : input.slice(comma + 1, end).trim());
|
|
57
|
+
if (replacement === void 0 || output.length + replacement.length > LIMIT)
|
|
58
|
+
return;
|
|
59
|
+
output += replacement;
|
|
60
|
+
replaced = !0;
|
|
61
|
+
i = end;
|
|
62
|
+
}
|
|
63
|
+
return replaced && output.length > LIMIT ? void 0 : output;
|
|
64
|
+
}
|
|
65
|
+
export function createStyleVariables(entries, inherited) {
|
|
66
|
+
const values = new Map, used = new Set;
|
|
67
|
+
for (const [rawName, value] of entries) {
|
|
68
|
+
const name = rawName.trim();
|
|
69
|
+
if (!NAME.test(name))
|
|
70
|
+
continue;
|
|
71
|
+
if (typeof value === "string" || typeof value === "number" && Number.isFinite(value))
|
|
72
|
+
values.set(name, String(value).trim());
|
|
73
|
+
}
|
|
74
|
+
const dependencies = new Map, invalid = new Set;
|
|
75
|
+
for (const [name, value] of values) {
|
|
76
|
+
const refs = new Set, inspect = (text, depth = 0) => depth > 64 ? void 0 : substitute(text, (ref, fallback) => {
|
|
77
|
+
refs.add(ref);
|
|
78
|
+
return fallback === void 0 ? "" : inspect(fallback, depth + 1);
|
|
79
|
+
});
|
|
80
|
+
if (inspect(value) === void 0)
|
|
81
|
+
invalid.add(name);
|
|
82
|
+
dependencies.set(name, refs);
|
|
83
|
+
}
|
|
84
|
+
const indices = new Map, lows = new Map, stack = [], active = new Set;
|
|
85
|
+
let index = 0;
|
|
86
|
+
function visit(name, depth = 0) {
|
|
87
|
+
if (depth > 64) {
|
|
88
|
+
invalid.add(name);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
indices.set(name, index);
|
|
92
|
+
lows.set(name, index++);
|
|
93
|
+
stack.push(name);
|
|
94
|
+
active.add(name);
|
|
95
|
+
for (const ref of dependencies.get(name) ?? []) {
|
|
96
|
+
if (!values.has(ref))
|
|
97
|
+
continue;
|
|
98
|
+
if (!indices.has(ref)) {
|
|
99
|
+
visit(ref, depth + 1);
|
|
100
|
+
if (lows.has(ref))
|
|
101
|
+
lows.set(name, Math.min(lows.get(name), lows.get(ref)));
|
|
102
|
+
} else if (active.has(ref))
|
|
103
|
+
lows.set(name, Math.min(lows.get(name), indices.get(ref)));
|
|
104
|
+
}
|
|
105
|
+
if (lows.get(name) !== indices.get(name))
|
|
106
|
+
return;
|
|
107
|
+
const group = [];
|
|
108
|
+
let member;
|
|
109
|
+
do {
|
|
110
|
+
member = stack.pop();
|
|
111
|
+
active.delete(member);
|
|
112
|
+
group.push(member);
|
|
113
|
+
} while (member !== name);
|
|
114
|
+
if (group.length > 1 || dependencies.get(name)?.has(name))
|
|
115
|
+
group.forEach((ref) => invalid.add(ref));
|
|
116
|
+
}
|
|
117
|
+
for (const name of values.keys())
|
|
118
|
+
if (!indices.has(name))
|
|
119
|
+
visit(name);
|
|
120
|
+
const cache = new Map;
|
|
121
|
+
function lookup(name, depth) {
|
|
122
|
+
used.add(name);
|
|
123
|
+
if (cache.has(name))
|
|
124
|
+
return cache.get(name);
|
|
125
|
+
const value = values.get(name), result = value === void 0 || /^(?:inherit|unset)$/i.test(value) ? inherited?.get(name) : invalid.has(name) || /^(?:initial|revert|revert-layer)$/i.test(value) ? void 0 : resolve(value, depth + 1);
|
|
126
|
+
cache.set(name, result);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
function resolve(text, depth = 0) {
|
|
130
|
+
if (depth > 64)
|
|
131
|
+
return;
|
|
132
|
+
return substitute(text, (name, fallback) => {
|
|
133
|
+
return lookup(name, depth) ?? (fallback === void 0 ? void 0 : resolve(fallback, depth + 1));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return { resolve, used, computed() {
|
|
137
|
+
const result = new Map(inherited);
|
|
138
|
+
for (const name of values.keys())
|
|
139
|
+
result.set(name, lookup(name, 0));
|
|
140
|
+
return result;
|
|
141
|
+
} };
|
|
142
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Document-level variables only. Never promote a component selector to global scope. */
|
|
2
|
+
export declare function extractStylesheetTheme(html: string, report: (name: string) => void): Promise<NativeStylesheetTheme>;
|
|
3
|
+
export declare interface NativeStylesheetTheme {
|
|
4
|
+
light: Array<[string, string]>
|
|
5
|
+
dark: Array<[string, string]>
|
|
6
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { generate, parse } from "@stacksjs/ts-css/parse";
|
|
2
|
+
export async function extractStylesheetTheme(html, report) {
|
|
3
|
+
const schemes = { light: new Map, dark: new Map }, reported = new Set, warn = (name) => {
|
|
4
|
+
if (!reported.has(name)) {
|
|
5
|
+
reported.add(name);
|
|
6
|
+
report(name);
|
|
7
|
+
}
|
|
8
|
+
}, add = (name, candidate, active) => {
|
|
9
|
+
for (const scheme of active) {
|
|
10
|
+
const previous = schemes[scheme].get(name);
|
|
11
|
+
if (!previous || Number(candidate.important) > Number(previous.important) || candidate.important === previous.important && candidate.specificity >= previous.specificity)
|
|
12
|
+
schemes[scheme].set(name, candidate);
|
|
13
|
+
}
|
|
14
|
+
}, hasVariables = (node) => {
|
|
15
|
+
if (node.type === "Declaration")
|
|
16
|
+
return node.property.startsWith("--");
|
|
17
|
+
if (node.type === "Rule" || node.type === "Atrule")
|
|
18
|
+
return !!node.block && [...node.block.children].some(hasVariables);
|
|
19
|
+
return !1;
|
|
20
|
+
}, mediaSchemes = (query) => {
|
|
21
|
+
const normalized = query.replace(/\s+/g, "").toLowerCase();
|
|
22
|
+
if (!normalized || normalized === "all" || normalized === "screen")
|
|
23
|
+
return ["light", "dark"];
|
|
24
|
+
const match = /^(?:screenand)?\(prefers-color-scheme:(light|dark)\)$/.exec(normalized);
|
|
25
|
+
return match ? [match[1]] : void 0;
|
|
26
|
+
};
|
|
27
|
+
function visit(nodes, active) {
|
|
28
|
+
for (const node of nodes) {
|
|
29
|
+
if (!hasVariables(node))
|
|
30
|
+
continue;
|
|
31
|
+
if (node.type === "Atrule") {
|
|
32
|
+
const query = node.prelude ? generate(node.prelude) : "", enabled = node.name.toLowerCase() === "media" ? mediaSchemes(query) : void 0;
|
|
33
|
+
if (!enabled) {
|
|
34
|
+
warn(`@${node.name} ${query}`.trim());
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
visit(node.block.children, active.filter((scheme) => enabled.includes(scheme)));
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (node.type !== "Rule")
|
|
41
|
+
continue;
|
|
42
|
+
const selectors = node.prelude.type === "SelectorList" ? [...node.prelude.children].map(generate) : [generate(node.prelude)];
|
|
43
|
+
for (const selector of selectors) {
|
|
44
|
+
const match = /^(html|:root)?(?:\.(dark|light))?$/.exec(selector.trim());
|
|
45
|
+
if (!match || !match[1] && !match[2]) {
|
|
46
|
+
warn(selector);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const specificity = (match[1] === ":root" ? 10 : match[1] ? 1 : 0) + (match[2] ? 10 : 0);
|
|
50
|
+
for (const declaration of node.block.children) {
|
|
51
|
+
if (declaration.type !== "Declaration") {
|
|
52
|
+
if (hasVariables(declaration))
|
|
53
|
+
warn(`nested rule in ${selector}`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (!declaration.property.startsWith("--"))
|
|
57
|
+
continue;
|
|
58
|
+
const candidate = { value: generate(declaration.value), important: !!declaration.important, specificity };
|
|
59
|
+
add(declaration.property, candidate, active.filter((scheme) => !match[2] || match[2] === scheme));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
let css = "", active;
|
|
65
|
+
await new HTMLRewriter().on("html", {
|
|
66
|
+
element(element) {
|
|
67
|
+
const inline = element.getAttribute("style");
|
|
68
|
+
if (!inline)
|
|
69
|
+
return;
|
|
70
|
+
try {
|
|
71
|
+
const declarations = parse(inline, { context: "declarationList" });
|
|
72
|
+
if (declarations.type !== "DeclarationList")
|
|
73
|
+
return;
|
|
74
|
+
for (const declaration of declarations.children)
|
|
75
|
+
if (declaration.type === "Declaration" && declaration.property.startsWith("--"))
|
|
76
|
+
add(declaration.property, { value: generate(declaration.value), important: !!declaration.important, specificity: 1000 }, ["light", "dark"]);
|
|
77
|
+
} catch {
|
|
78
|
+
warn("invalid document inline theme");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}).on("style", {
|
|
82
|
+
element(element) {
|
|
83
|
+
css = "";
|
|
84
|
+
const type = element.getAttribute("type");
|
|
85
|
+
active = !type || type.toLowerCase() === "text/css" ? mediaSchemes(element.getAttribute("media") ?? "") : void 0;
|
|
86
|
+
element.onEndTag(() => {
|
|
87
|
+
try {
|
|
88
|
+
const ast = parse(css);
|
|
89
|
+
if (ast.type !== "StyleSheet")
|
|
90
|
+
return;
|
|
91
|
+
if (!active) {
|
|
92
|
+
if ([...ast.children].some(hasVariables))
|
|
93
|
+
warn("style type/media");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
visit(ast.children, active);
|
|
97
|
+
} catch {
|
|
98
|
+
warn("invalid stylesheet");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
text(chunk) {
|
|
103
|
+
css += chunk.text;
|
|
104
|
+
}
|
|
105
|
+
}).transform(new Response(html)).text();
|
|
106
|
+
return {
|
|
107
|
+
light: [...schemes.light].map(([name, entry]) => [name, entry.value]),
|
|
108
|
+
dark: [...schemes.dark].map(([name, entry]) => [name, entry.value])
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -10,6 +10,7 @@ function createBindingNode(id, type, bindings, connected = !0, classes = "", onC
|
|
|
10
10
|
attributes.push({ name: "class", value: classes });
|
|
11
11
|
const node = {
|
|
12
12
|
__stxId: id,
|
|
13
|
+
__stxScope: void 0,
|
|
13
14
|
nodeType: 1,
|
|
14
15
|
get className() {
|
|
15
16
|
return node.getAttribute("class") ?? "";
|
|
@@ -42,6 +43,8 @@ function createBindingNode(id, type, bindings, connected = !0, classes = "", onC
|
|
|
42
43
|
return attributes.find((attribute) => attribute.name === name)?.value ?? null;
|
|
43
44
|
},
|
|
44
45
|
setAttribute(name, value) {
|
|
46
|
+
if (name === "data-stx-scope")
|
|
47
|
+
node.__stxScope = String(value);
|
|
45
48
|
const existing = attributes.find((attribute) => attribute.name === name);
|
|
46
49
|
if (existing)
|
|
47
50
|
existing.value = String(value);
|
|
@@ -51,6 +54,8 @@ function createBindingNode(id, type, bindings, connected = !0, classes = "", onC
|
|
|
51
54
|
onClassChange?.(String(value));
|
|
52
55
|
},
|
|
53
56
|
removeAttribute(name) {
|
|
57
|
+
if (name === "data-stx-scope")
|
|
58
|
+
node.__stxScope = void 0;
|
|
54
59
|
const index = attributes.findIndex((attribute) => attribute.name === name);
|
|
55
60
|
if (index !== -1)
|
|
56
61
|
attributes.splice(index, 1);
|
|
@@ -99,6 +104,13 @@ export function materializeNativeBindingTree(document, manifest, host) {
|
|
|
99
104
|
if (!runtimeBindings.some((binding) => binding.name.replace(/^[:@]/, "") === name))
|
|
100
105
|
runtimeBindings.push({ name: `:${name}`, value, kind: "attr" });
|
|
101
106
|
const node = createBindingNode(id, source.type, runtimeBindings, !0, source._classes, (value) => host.setAttribute(node, "class", value));
|
|
107
|
+
if (source.type === "Checkbox" && source.props.type === "checkbox")
|
|
108
|
+
node.tagName = "INPUT";
|
|
109
|
+
for (const [name, value] of Object.entries(source.props)) {
|
|
110
|
+
if (value === void 0 || value === null || name === "__stxId")
|
|
111
|
+
continue;
|
|
112
|
+
node.setAttribute(name, typeof value === "object" ? JSON.stringify(value) : String(value));
|
|
113
|
+
}
|
|
102
114
|
source.id = id;
|
|
103
115
|
source.props.__stxId = id;
|
|
104
116
|
node.parentNode = parent;
|
|
@@ -55,7 +55,9 @@ function capabilityFlags(capabilities) {
|
|
|
55
55
|
appleSignIn: capabilities.has("appleSignIn"),
|
|
56
56
|
background: capabilities.has("background"),
|
|
57
57
|
crashReporter: capabilities.has("crashReporter"),
|
|
58
|
-
animation: capabilities.has("animation")
|
|
58
|
+
animation: capabilities.has("animation"),
|
|
59
|
+
viewFocus: capabilities.has("viewFocus"),
|
|
60
|
+
viewMeasure: capabilities.has("viewMeasure")
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
function platformUserAgent(platform) {
|
|
@@ -184,7 +186,7 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
184
186
|
delete: (key) => request("SecureStorage", "remove", [key]),
|
|
185
187
|
clear: () => request("SecureStorage", "clear", [])
|
|
186
188
|
});
|
|
187
|
-
const sessionKey = String(craft.session?.key || nativeBridge.sessionTokenKey || "auth.token");
|
|
189
|
+
const sessionKey = String(craft.session?.key || nativeBridge.sessionTokenKey || "auth.token"), supportsSessionEvents = craft.session?.supportsEvents === !0 || typeof nativeBridge.sessionTokenKey === "string" && nativeBridge.sessionTokenKey.length > 0;
|
|
188
190
|
craft.session = Object.assign({
|
|
189
191
|
token: () => {
|
|
190
192
|
const value = craft.secureStorage.getSync(sessionKey);
|
|
@@ -192,6 +194,7 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
192
194
|
}
|
|
193
195
|
}, craft.session || {}, {
|
|
194
196
|
key: sessionKey,
|
|
197
|
+
supportsEvents: supportsSessionEvents,
|
|
195
198
|
onChange: (callback) => protocol.on("SESSION_CHANGED", ({ payload }) => {
|
|
196
199
|
if (payload?.key && payload.key !== sessionKey)
|
|
197
200
|
return;
|