@stacksjs/stx 0.2.413 → 0.2.415
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/appearance-bootstrap.js +1 -1
- package/dist/binding-manifest.d.ts +1 -1
- package/dist/builtins/image-delivery.js +19 -11
- package/dist/bundle-analyzer.js +20 -20
- package/dist/chunk-020xyn9q.js +3 -0
- package/dist/chunk-04jhmfbz.js +2 -0
- package/dist/chunk-0pnj3zt2.js +2 -0
- package/dist/{chunk-bwjxk1dw.js → chunk-0zaess6f.js} +29 -29
- package/dist/chunk-1098mas0.js +2 -0
- package/dist/chunk-169n1vpx.js +12 -0
- package/dist/chunk-18vmfkcc.js +2 -0
- package/dist/chunk-1b6t12hd.js +2 -0
- package/dist/chunk-1xdzcy9d.js +14 -0
- package/dist/chunk-1zs30k3y.js +2 -0
- package/dist/chunk-2ce7f416.js +2 -0
- package/dist/chunk-340a824p.js +2 -0
- package/dist/chunk-393341w7.js +2 -0
- package/dist/chunk-39g1134q.js +2 -0
- package/dist/chunk-3efw27as.js +2785 -0
- package/dist/chunk-3kthfs03.js +3 -0
- package/dist/chunk-3qn1wcdg.js +2 -0
- package/dist/chunk-3s2vnqcf.js +2 -0
- package/dist/chunk-42wbs8vq.js +17 -0
- package/dist/chunk-4bjravgk.js +2 -0
- package/dist/chunk-5gsxpaqk.js +2 -0
- package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
- package/dist/chunk-6cfa3g0r.js +2 -0
- package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
- package/dist/chunk-6hc5vz20.js +3 -0
- package/dist/chunk-6q6g76vg.js +499 -0
- package/dist/chunk-74j18qk0.js +930 -0
- package/dist/chunk-752hw7cd.js +4 -0
- package/dist/{chunk-kgd8kchy.js → chunk-765e1s44.js} +11 -76
- package/dist/chunk-7gkv67ky.js +4 -0
- package/dist/chunk-7z2ra0yf.js +2 -0
- package/dist/chunk-8eqrwj1k.js +20 -0
- package/dist/chunk-8nhshfz6.js +5 -0
- package/dist/chunk-92ps1xpk.js +2 -0
- package/dist/chunk-96k8s808.js +3 -0
- package/dist/chunk-9amp82bx.js +7 -0
- package/dist/chunk-9g27ybyr.js +3 -0
- package/dist/chunk-9p9qkbtg.js +3 -0
- package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
- package/dist/{chunk-24zher49.js → chunk-9vrja6vp.js} +4 -4
- package/dist/chunk-9xrbve19.js +2 -0
- package/dist/chunk-a688m6js.js +3 -0
- package/dist/chunk-ak1cgcah.js +5 -0
- package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
- package/dist/chunk-amtr3rmf.js +11 -0
- package/dist/chunk-atws6p5s.js +2 -0
- package/dist/chunk-b84h16er.js +61 -0
- package/dist/chunk-b98be3yp.js +32 -0
- package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
- package/dist/chunk-ce1sejr3.js +3 -0
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-4f9zyfdw.js → chunk-czxt605c.js} +4 -5
- package/dist/chunk-dd8cja4h.js +2 -0
- package/dist/chunk-dgdm3hy3.js +2 -0
- package/dist/chunk-e9hs7kk6.js +12 -0
- package/dist/chunk-eed4fwps.js +3 -0
- package/dist/chunk-ej9j6k1q.js +3 -0
- package/dist/chunk-et0rr8c7.js +3 -0
- package/dist/chunk-f1sxycmv.js +2 -0
- package/dist/chunk-f46qsp4m.js +4 -0
- package/dist/chunk-fbcv4fes.js +2 -0
- package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
- package/dist/chunk-fjs0a8h7.js +2 -0
- package/dist/chunk-fpfzm238.js +2 -0
- package/dist/chunk-fr2txj8q.js +829 -0
- package/dist/{chunk-xssw417m.js → chunk-ft4p6d28.js} +14 -14
- package/dist/chunk-fyzajkrx.js +2 -0
- package/dist/chunk-fzapbw9p.js +3 -0
- package/dist/chunk-g03s93qr.js +3 -0
- package/dist/chunk-g186znp9.js +33 -0
- package/dist/chunk-gawrg4gb.js +216 -0
- package/dist/chunk-gc1drn2p.js +2 -0
- package/dist/chunk-gea5hf0v.js +2 -0
- package/dist/chunk-gqv3ta5d.js +2 -0
- package/dist/chunk-h6kp2m9r.js +2 -0
- package/dist/chunk-h6zsqb9r.js +3 -0
- package/dist/{chunk-2snqdnk9.js → chunk-h85hrwkq.js} +13 -13
- package/dist/chunk-hbxz85wy.js +2 -0
- package/dist/chunk-hepd9qgx.js +6 -0
- package/dist/chunk-hhnw2sn3.js +2 -0
- package/dist/chunk-hjg3ndgh.js +2 -0
- package/dist/chunk-hk1mj4tz.js +2 -0
- package/dist/{chunk-smcj3442.js → chunk-hkrmcbwy.js} +79 -79
- package/dist/chunk-hn9pkyv8.js +2 -0
- package/dist/chunk-hpgr4qgp.js +2 -0
- package/dist/chunk-hrbbbtbn.js +2 -0
- package/dist/chunk-j03revz2.js +8 -0
- package/dist/chunk-j9qcrwbg.js +2 -0
- package/dist/chunk-jk4njz0w.js +2 -0
- package/dist/chunk-jmabeqfq.js +2 -0
- package/dist/chunk-jnkrn913.js +4 -0
- package/dist/chunk-jp10q90g.js +2 -0
- package/dist/chunk-jt0n43mk.js +2 -0
- package/dist/chunk-kjbv8a3m.js +2 -0
- package/dist/chunk-m1vdghnx.js +2 -0
- package/dist/chunk-m4sk62wb.js +5 -0
- package/dist/chunk-md8rqn48.js +30 -0
- package/dist/chunk-mp6hy8g4.js +2 -0
- package/dist/chunk-nc8my58s.js +2 -0
- package/dist/chunk-ngc2wke4.js +3 -0
- package/dist/chunk-nn2vstke.js +2 -0
- package/dist/chunk-nppdrf0x.js +2 -0
- package/dist/chunk-p2v2a68k.js +2 -0
- package/dist/chunk-pazfr1a1.js +2 -0
- package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
- package/dist/chunk-pdb5fw3r.js +2 -0
- package/dist/chunk-pdt69hpb.js +2 -0
- package/dist/chunk-pgzvyrv6.js +29 -0
- package/dist/chunk-px7fvbj6.js +3 -0
- package/dist/chunk-q6vrb2pe.js +2 -0
- package/dist/chunk-q7qchkvk.js +2 -0
- package/dist/chunk-q9bdh4s5.js +8 -0
- package/dist/chunk-qghxz7jm.js +194 -0
- package/dist/chunk-r3f9jcf7.js +5 -0
- package/dist/chunk-re8b5r9x.js +3 -0
- package/dist/chunk-s5xezjps.js +3 -0
- package/dist/chunk-sd321bn3.js +2 -0
- package/dist/chunk-shr559s7.js +3 -0
- package/dist/chunk-t4hzprsm.js +3 -0
- package/dist/chunk-t5pvq5mx.js +2 -0
- package/dist/{chunk-pv3d7sfn.js → chunk-t61vdbje.js} +89 -89
- package/dist/chunk-tafqyf2g.js +2033 -0
- package/dist/chunk-tfexmdkt.js +3 -0
- package/dist/chunk-thyt8ed8.js +6 -0
- package/dist/chunk-v91p6ekp.js +24 -0
- package/dist/chunk-vgvtnwxa.js +4 -0
- package/dist/chunk-w72qx0eb.js +2 -0
- package/dist/chunk-wfy1zq53.js +30 -0
- package/dist/chunk-wzx0164n.js +18 -0
- package/dist/chunk-x0q32ees.js +3 -0
- package/dist/chunk-xfp7k0v8.js +64 -0
- package/dist/chunk-xtvf6n6f.js +4 -0
- package/dist/chunk-xwzvfqcb.js +2 -0
- package/dist/chunk-y1cmjvk3.js +43 -0
- package/dist/chunk-y5310237.js +311 -0
- package/dist/chunk-ya0qecph.js +27 -0
- package/dist/chunk-yazk54jr.js +8 -0
- package/dist/chunk-ydjfar14.js +2 -0
- package/dist/chunk-ym95v4nc.js +3 -0
- package/dist/chunk-z0g9jvv0.js +40 -0
- package/dist/chunk-z23kaxq6.js +2 -0
- package/dist/chunk-z8xn5ta3.js +2 -0
- package/dist/{chunk-8sdhs0zk.js → chunk-zhxdpzga.js} +4 -4
- package/dist/cli.js +110 -110
- package/dist/craft-entry.js +7 -7
- package/dist/craft.js +7 -7
- package/dist/database.js +2 -2
- package/dist/image-optimization/component.js +4 -4
- package/dist/media/image/component.js +5 -5
- package/dist/media/protected/component.js +2 -2
- package/dist/media/video/index.js +4 -4
- package/dist/native/bridge/protocol.d.ts +325 -0
- package/dist/native/bridge/protocol.js +219 -0
- package/dist/native/cli.d.ts +24 -0
- package/dist/native/cli.js +52 -0
- package/dist/native/compiler/bundle.d.ts +41 -0
- package/dist/native/compiler/bundle.js +90 -0
- package/dist/native/compiler/client-script.d.ts +8 -0
- package/dist/native/compiler/client-script.js +31 -0
- package/dist/native/compiler/codegen.d.ts +10 -0
- package/dist/native/compiler/codegen.js +145 -0
- package/dist/native/compiler/headwind-to-style.d.ts +395 -0
- package/dist/native/compiler/headwind-to-style.js +1163 -0
- package/dist/native/compiler/html-to-ir.d.ts +41 -0
- package/dist/native/compiler/html-to-ir.js +411 -0
- package/dist/native/compiler/icons.d.ts +220 -0
- package/dist/native/compiler/icons.js +208 -0
- package/dist/native/compiler/ir.d.ts +234 -0
- package/dist/native/compiler/ir.js +15 -0
- package/dist/native/compiler/parser.d.ts +88 -0
- package/dist/native/compiler/parser.js +753 -0
- package/dist/native/compiler/render-screen.d.ts +26 -0
- package/dist/native/compiler/render-screen.js +31 -0
- package/dist/native/components/primitives.d.ts +291 -0
- package/dist/native/components/primitives.js +22 -0
- package/dist/native/hot-reload/client.d.ts +62 -0
- package/dist/native/hot-reload/client.js +324 -0
- package/dist/native/index.d.ts +90 -0
- package/dist/native/index.js +34 -0
- package/dist/native/primitives/ActivityIndicator.stx +5 -0
- package/dist/native/primitives/Button.stx +5 -0
- package/dist/native/primitives/DatePicker.stx +5 -0
- package/dist/native/primitives/FlatList.stx +5 -0
- package/dist/native/primitives/Image.stx +5 -0
- package/dist/native/primitives/ImageBackground.stx +5 -0
- package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
- package/dist/native/primitives/Modal.stx +5 -0
- package/dist/native/primitives/Picker.stx +5 -0
- package/dist/native/primitives/Pressable.stx +5 -0
- package/dist/native/primitives/RefreshControl.stx +5 -0
- package/dist/native/primitives/SafeAreaView.stx +5 -0
- package/dist/native/primitives/ScrollView.stx +5 -0
- package/dist/native/primitives/SectionList.stx +5 -0
- package/dist/native/primitives/Slider.stx +5 -0
- package/dist/native/primitives/StatusBar.stx +5 -0
- package/dist/native/primitives/Switch.stx +5 -0
- package/dist/native/primitives/Text.stx +5 -0
- package/dist/native/primitives/TextInput.stx +5 -0
- package/dist/native/primitives/TouchableHighlight.stx +5 -0
- package/dist/native/primitives/TouchableOpacity.stx +5 -0
- package/dist/native/primitives/View.stx +5 -0
- package/dist/native/runtime/craft.d.ts +75 -0
- package/dist/native/runtime/craft.js +0 -0
- package/dist/native/runtime/entry.d.ts +1 -0
- package/dist/native/runtime/entry.js +3 -0
- package/dist/native/runtime/index.d.ts +45 -0
- package/dist/native/runtime/index.js +165 -0
- package/dist/native/runtime/native-host.d.ts +33 -0
- package/dist/native/runtime/native-host.js +184 -0
- package/dist/native/runtime/screen.d.ts +43 -0
- package/dist/native/runtime/screen.js +808 -0
- package/dist/pwa/service-worker.js +1 -1
- package/dist/pwa/workbox.js +1 -1
- package/dist/pwa.js +8 -8
- package/dist/site-url.d.ts +1 -1
- package/dist/ssg.js +53 -53
- package/dist/visual-testing.js +42 -42
- package/dist/web-components/reactive-generator.js +2 -2
- package/package.json +9 -5
- package/dist/chunk-0btmm4m2.js +0 -147
- package/dist/chunk-0c2h69k2.js +0 -4
- package/dist/chunk-0d0qeqvv.js +0 -2
- package/dist/chunk-0psndabd.js +0 -2
- package/dist/chunk-0qv8yf53.js +0 -2
- package/dist/chunk-0vkxyvsd.js +0 -2
- package/dist/chunk-0we9nw1d.js +0 -3
- package/dist/chunk-0xqdmemy.js +0 -3
- package/dist/chunk-0y46fbkx.js +0 -3
- package/dist/chunk-158wqccn.js +0 -4422
- package/dist/chunk-1cyxbb8y.js +0 -16
- package/dist/chunk-1enwnh2a.js +0 -2
- package/dist/chunk-213pzm0d.js +0 -3
- package/dist/chunk-21hzqyja.js +0 -12
- package/dist/chunk-266t58b8.js +0 -5
- package/dist/chunk-27fgag95.js +0 -4
- package/dist/chunk-2a9n102n.js +0 -2
- package/dist/chunk-2eqzrczk.js +0 -2
- package/dist/chunk-2ke37m54.js +0 -14
- package/dist/chunk-35ds08e7.js +0 -3
- package/dist/chunk-3mtwkjcg.js +0 -2
- package/dist/chunk-4xr8zwkp.js +0 -2
- package/dist/chunk-58v77x2c.js +0 -2
- package/dist/chunk-5mhq8605.js +0 -2
- package/dist/chunk-5se8xt9e.js +0 -64
- package/dist/chunk-5zh0h080.js +0 -2
- package/dist/chunk-62435225.js +0 -2
- package/dist/chunk-6kdrncsx.js +0 -30
- package/dist/chunk-6n2rr3x7.js +0 -2
- package/dist/chunk-6xk87qf2.js +0 -30
- package/dist/chunk-72rwcbp6.js +0 -3
- package/dist/chunk-76w34xne.js +0 -3
- package/dist/chunk-7ekd7zj9.js +0 -2
- package/dist/chunk-7pr3wdd5.js +0 -3
- package/dist/chunk-7rxvafwc.js +0 -24
- package/dist/chunk-7tnwfa7w.js +0 -8
- package/dist/chunk-8c5je0wf.js +0 -2
- package/dist/chunk-8dz6nyvx.js +0 -2
- package/dist/chunk-98zj3fv2.js +0 -7
- package/dist/chunk-9e8t0twa.js +0 -3
- package/dist/chunk-9fqp72ze.js +0 -5
- package/dist/chunk-anydpa34.js +0 -3
- package/dist/chunk-ay6zjq8v.js +0 -3
- package/dist/chunk-az4v4ard.js +0 -3
- package/dist/chunk-ba5erggg.js +0 -2
- package/dist/chunk-bnagrdz6.js +0 -2
- package/dist/chunk-by8wghtf.js +0 -2
- package/dist/chunk-cd7h4q51.js +0 -2
- package/dist/chunk-cjmv8hgp.js +0 -33
- package/dist/chunk-cthf912y.js +0 -2
- package/dist/chunk-cxbpmwq5.js +0 -4
- package/dist/chunk-d3sy16qn.js +0 -2
- package/dist/chunk-dh6s7mrj.js +0 -1199
- package/dist/chunk-dm2nzg7a.js +0 -2
- package/dist/chunk-e2sgcnxc.js +0 -2
- package/dist/chunk-e3b7jj74.js +0 -2
- package/dist/chunk-ec4wq2sv.js +0 -6
- package/dist/chunk-ekzg97dn.js +0 -29
- package/dist/chunk-epjt342x.js +0 -2
- package/dist/chunk-eqe26g14.js +0 -18
- package/dist/chunk-ev0v1yma.js +0 -2
- package/dist/chunk-f53psr2y.js +0 -5
- package/dist/chunk-f8p69dsg.js +0 -3
- package/dist/chunk-f95drhdb.js +0 -194
- package/dist/chunk-ff5a6hvb.js +0 -17
- package/dist/chunk-fs5fy4h8.js +0 -2
- package/dist/chunk-fzsygce3.js +0 -2
- package/dist/chunk-g465x63k.js +0 -2
- package/dist/chunk-g708ekh1.js +0 -2
- package/dist/chunk-gcr9e83g.js +0 -11
- package/dist/chunk-gdmyrsr8.js +0 -4
- package/dist/chunk-gkms2ngq.js +0 -2
- package/dist/chunk-gnfywmgs.js +0 -7
- package/dist/chunk-hpf8kq7e.js +0 -2
- package/dist/chunk-j4x3faf8.js +0 -2
- package/dist/chunk-jkavtw9f.js +0 -2
- package/dist/chunk-kg1rdena.js +0 -3
- package/dist/chunk-km91wx0v.js +0 -2
- package/dist/chunk-kmsyvaex.js +0 -8
- package/dist/chunk-mrahwn5v.js +0 -8
- package/dist/chunk-nk3czvnk.js +0 -2
- package/dist/chunk-nmw4eewb.js +0 -2
- package/dist/chunk-nq5zxrk0.js +0 -4
- package/dist/chunk-ny67c03k.js +0 -3
- package/dist/chunk-p4wdxp2c.js +0 -2
- package/dist/chunk-pcxp4r9n.js +0 -3
- package/dist/chunk-pdyeaxc1.js +0 -2
- package/dist/chunk-pf06ded4.js +0 -2
- package/dist/chunk-pfs0gpzm.js +0 -2
- package/dist/chunk-pshdwq44.js +0 -2
- package/dist/chunk-pwgv84pn.js +0 -32
- package/dist/chunk-pwsnafp3.js +0 -4367
- package/dist/chunk-q9n5swx7.js +0 -3
- package/dist/chunk-qr346wnp.js +0 -2
- package/dist/chunk-r02hke04.js +0 -2
- package/dist/chunk-ranshpyc.js +0 -3
- package/dist/chunk-rn194bhp.js +0 -20
- package/dist/chunk-rn1hgyc8.js +0 -930
- package/dist/chunk-s7z5dp70.js +0 -43
- package/dist/chunk-s8jd13nb.js +0 -3
- package/dist/chunk-sn7exv0n.js +0 -2
- package/dist/chunk-t1tdjjht.js +0 -216
- package/dist/chunk-t6qx04s8.js +0 -499
- package/dist/chunk-t6y6gyps.js +0 -2
- package/dist/chunk-tjfs7cc3.js +0 -2
- package/dist/chunk-tkyrk66a.js +0 -3
- package/dist/chunk-tntv9hvq.js +0 -2
- package/dist/chunk-v3nwkveg.js +0 -12
- package/dist/chunk-vd4cb5xr.js +0 -2
- package/dist/chunk-vkhdce50.js +0 -2
- package/dist/chunk-w183av08.js +0 -2
- package/dist/chunk-w2m02njv.js +0 -2
- package/dist/chunk-wpjrcrs5.js +0 -2
- package/dist/chunk-wqmppf6b.js +0 -3
- package/dist/chunk-wtb9fxdy.js +0 -2
- package/dist/chunk-xmzygmcz.js +0 -3
- package/dist/chunk-xsng1mtq.js +0 -3
- package/dist/chunk-xxzefj4j.js +0 -2
- package/dist/chunk-yq8x8bxq.js +0 -47
- package/dist/chunk-ytma76qe.js +0 -3
- package/dist/chunk-yw1m115e.js +0 -2
- package/dist/chunk-z64a924m.js +0 -2
- package/dist/chunk-zcz9rs6p.js +0 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { generateScreenModule, RUNTIME_SPECIFIER } from "./codegen.js";
|
|
4
|
+
import { parseSTX } from "./parser.js";
|
|
5
|
+
function runtimeEntry() {
|
|
6
|
+
const candidates = [
|
|
7
|
+
path.join(import.meta.dir, "..", "runtime", "entry.ts"),
|
|
8
|
+
path.join(import.meta.dir, "..", "runtime", "entry.js"),
|
|
9
|
+
path.join(import.meta.dir, "native", "runtime", "entry.js")
|
|
10
|
+
];
|
|
11
|
+
return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
|
|
12
|
+
}
|
|
13
|
+
async function build(entry, plugins, minify) {
|
|
14
|
+
const result = await Bun.build({
|
|
15
|
+
entrypoints: [entry],
|
|
16
|
+
target: "browser",
|
|
17
|
+
format: "iife",
|
|
18
|
+
minify,
|
|
19
|
+
plugins,
|
|
20
|
+
define: { "process.env.NODE_ENV": JSON.stringify(minify ? "production" : "development") }
|
|
21
|
+
});
|
|
22
|
+
if (!result.success) {
|
|
23
|
+
const messages = result.logs.map((log) => String(log.message ?? log)).join(`
|
|
24
|
+
`);
|
|
25
|
+
throw Error(`Could not bundle ${entry}:
|
|
26
|
+
${messages}`);
|
|
27
|
+
}
|
|
28
|
+
return (await result.outputs[0].text()).trim();
|
|
29
|
+
}
|
|
30
|
+
function screenPlugin(warnings) {
|
|
31
|
+
return {
|
|
32
|
+
name: "stx-native-screen",
|
|
33
|
+
setup(builder) {
|
|
34
|
+
builder.onResolve({ filter: /^stx:native-runtime$/ }, () => ({ path: "runtime", namespace: "stx-native-runtime" }));
|
|
35
|
+
builder.onLoad({ filter: /.*/, namespace: "stx-native-runtime" }, () => ({
|
|
36
|
+
contents: "export function mount(screen) { return globalThis.__stxNative.mount(screen) }",
|
|
37
|
+
loader: "js"
|
|
38
|
+
}));
|
|
39
|
+
builder.onLoad({ filter: /\.stx$/ }, async (args) => {
|
|
40
|
+
const source = await Bun.file(args.path).text(), module = generateScreenModule(parseSTX(source, args.path));
|
|
41
|
+
warnings.push(...module.warnings);
|
|
42
|
+
return { contents: module.code, loader: "ts" };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export async function compileNativeBundle(options) {
|
|
48
|
+
const names = Object.keys(options.screens);
|
|
49
|
+
if (names.length === 0)
|
|
50
|
+
throw Error("screens must name at least one .stx file");
|
|
51
|
+
const routed = options.routed ?? !0, initialScreen = options.initialScreen ?? names[0];
|
|
52
|
+
if (!options.screens[initialScreen])
|
|
53
|
+
throw Error(`Initial screen ${initialScreen} is not in screens`);
|
|
54
|
+
const minify = options.minify ?? !1, root = path.resolve(options.root ?? process.cwd()), warnings = [], header = routed ? `(function () {
|
|
55
|
+
var names = ${JSON.stringify(names)};
|
|
56
|
+
var name = globalThis.__stxNativeRoute || ${JSON.stringify(initialScreen)};
|
|
57
|
+
if (names.indexOf(name) === -1) throw new Error(['Unknown native screen:', name].join(' '));
|
|
58
|
+
globalThis.__stxNativeRoute = name;
|
|
59
|
+
globalThis.__stxNativeRuntimeOptions = { routeName: name, routeNames: names };
|
|
60
|
+
})();` : "globalThis.__stxNativeRuntimeOptions = { routeName: 'main', routeNames: ['main'] };", runtime = await build(runtimeEntry(), [], minify), screens = [];
|
|
61
|
+
for (const name of names) {
|
|
62
|
+
const file = path.resolve(root, options.screens[name]);
|
|
63
|
+
if (!file.endsWith(".stx"))
|
|
64
|
+
throw Error(`Screen ${name} must name a .stx file`);
|
|
65
|
+
const code = await build(file, [screenPlugin(warnings)], minify), guard = routed ? `globalThis.__stxNativeRoute === ${JSON.stringify(name)} && globalThis.__stxNativeBridge` : "globalThis.__stxNativeBridge";
|
|
66
|
+
screens.push(`// Screen ${name}: ${path.basename(file)}
|
|
67
|
+
if (${guard}) {
|
|
68
|
+
${code}
|
|
69
|
+
}`);
|
|
70
|
+
}
|
|
71
|
+
const code = [
|
|
72
|
+
`// STX Native bundle (${names.join(", ")})`,
|
|
73
|
+
header,
|
|
74
|
+
runtime,
|
|
75
|
+
...screens,
|
|
76
|
+
""
|
|
77
|
+
].join(`
|
|
78
|
+
`), diagnostics = [...new Set(warnings)].map((message) => ({ level: "warning", message }));
|
|
79
|
+
if (!options.outFile)
|
|
80
|
+
return { code, diagnostics };
|
|
81
|
+
const outFile = path.resolve(root, options.outFile);
|
|
82
|
+
mkdirSync(path.dirname(outFile), { recursive: !0 });
|
|
83
|
+
await Bun.write(outFile, code);
|
|
84
|
+
return { code, outFile, diagnostics };
|
|
85
|
+
}
|
|
86
|
+
export function compileScreenBundle(file, options = {}) {
|
|
87
|
+
return compileNativeBundle({ ...options, screens: { main: file }, routed: !1 });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { RUNTIME_SPECIFIER };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { STXDocument } from './ir';
|
|
2
|
+
/**
|
|
3
|
+
* Pull the client script out of a screen's source.
|
|
4
|
+
*
|
|
5
|
+
* `functions` is what the bundle registers as event handlers, so a name that
|
|
6
|
+
* is not callable there is a handler the device cannot dispatch to.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractClientScript(source: string): STXDocument['script'];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const SCRIPT_BLOCK = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi, FUNCTION_DECLARATION = /(?:^|\n)\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([$\w]+)\s*\(/g, ARROW_DECLARATION = /(?:^|\n)\s*(?:export\s+)?(?:const|let|var)\s+([$\w]+)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[$\w]+)\s*=>/g, PRIMITIVE_EXPORT = /(?:^|\n)\s*(?:export\s+)?const\s+([$\w]+)\s*=\s*(-?[\d.]+|true|false|'[^']*'|"[^"]*")\s*(?=;|\n|$)/g;
|
|
2
|
+
export function extractClientScript(source) {
|
|
3
|
+
const parts = [];
|
|
4
|
+
SCRIPT_BLOCK.lastIndex = 0;
|
|
5
|
+
for (const match of source.matchAll(SCRIPT_BLOCK)) {
|
|
6
|
+
const attributes = match[1] ?? "";
|
|
7
|
+
if (/\bserver\b/.test(attributes))
|
|
8
|
+
continue;
|
|
9
|
+
parts.push(match[2].trim());
|
|
10
|
+
}
|
|
11
|
+
const code = parts.filter(Boolean).join(`
|
|
12
|
+
|
|
13
|
+
`), functions = [];
|
|
14
|
+
for (const pattern of [FUNCTION_DECLARATION, ARROW_DECLARATION]) {
|
|
15
|
+
pattern.lastIndex = 0;
|
|
16
|
+
for (const match of code.matchAll(pattern))
|
|
17
|
+
if (!functions.includes(match[1]))
|
|
18
|
+
functions.push(match[1]);
|
|
19
|
+
}
|
|
20
|
+
const exports = {};
|
|
21
|
+
PRIMITIVE_EXPORT.lastIndex = 0;
|
|
22
|
+
for (const match of code.matchAll(PRIMITIVE_EXPORT)) {
|
|
23
|
+
const raw = match[2];
|
|
24
|
+
try {
|
|
25
|
+
exports[match[1]] = JSON.parse(raw.replace(/^'(.*)'$/, '"$1"'));
|
|
26
|
+
} catch {
|
|
27
|
+
exports[match[1]] = raw;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return { exports, functions, code };
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { STXDocument } from './ir';
|
|
2
|
+
/** The generated module for one parsed screen. */
|
|
3
|
+
export declare function generateScreenModule(document: STXDocument): ScreenModule;
|
|
4
|
+
/** The import specifier the generated module uses for the runtime. */
|
|
5
|
+
export declare const RUNTIME_SPECIFIER: 'stx:native-runtime';
|
|
6
|
+
export declare interface ScreenModule {
|
|
7
|
+
code: string
|
|
8
|
+
template: Record<string, unknown>
|
|
9
|
+
warnings: string[]
|
|
10
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export const RUNTIME_SPECIFIER = "stx:native-runtime";
|
|
2
|
+
const REFERENCE = /^[A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*$/, transpiler = new Bun.Transpiler({ loader: "ts" });
|
|
3
|
+
function parses(code) {
|
|
4
|
+
try {
|
|
5
|
+
transpiler.transformSync(code);
|
|
6
|
+
return !0;
|
|
7
|
+
} catch {
|
|
8
|
+
return !1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function prologue(scope) {
|
|
12
|
+
const names = [...new Set(scope)];
|
|
13
|
+
return names.length ? `const { ${names.join(", ")} } = __s; ` : "";
|
|
14
|
+
}
|
|
15
|
+
function where(node) {
|
|
16
|
+
return node._source ? `<${node.type}> at ${node._source.file}:${node._source.line}` : `<${node.type}>`;
|
|
17
|
+
}
|
|
18
|
+
function addExpression(ctx, expression, scope, node, what) {
|
|
19
|
+
const code = expression.trim();
|
|
20
|
+
if (!code || !parses(`(${code}
|
|
21
|
+
)`))
|
|
22
|
+
throw Error(`Cannot compile ${what} "${expression}" on ${where(node)}`);
|
|
23
|
+
ctx.functions.push(`function (__s) { ${prologue(scope)}return (${code}
|
|
24
|
+
) }`);
|
|
25
|
+
return ctx.functions.length - 1;
|
|
26
|
+
}
|
|
27
|
+
function addHandler(ctx, expression, scope, node, event) {
|
|
28
|
+
const code = expression.trim();
|
|
29
|
+
let body;
|
|
30
|
+
if (REFERENCE.test(code))
|
|
31
|
+
body = `return typeof ${code} === 'function' ? ${code}($event) : undefined`;
|
|
32
|
+
else if (parses(`(${code}
|
|
33
|
+
)`))
|
|
34
|
+
body = `const __r = (${code}
|
|
35
|
+
); return typeof __r === 'function' ? __r($event) : __r`;
|
|
36
|
+
else if (parses(code))
|
|
37
|
+
body = code;
|
|
38
|
+
else
|
|
39
|
+
throw Error(`Cannot compile handler ${event}="${expression}" on ${where(node)}`);
|
|
40
|
+
ctx.functions.push(`function (__s, $event) { ${prologue(scope)}${body}
|
|
41
|
+
}`);
|
|
42
|
+
return ctx.functions.length - 1;
|
|
43
|
+
}
|
|
44
|
+
function segments(value) {
|
|
45
|
+
const parts = [];
|
|
46
|
+
let depth = 0, start = -1, last = 0;
|
|
47
|
+
for (let i = 0;i < value.length; i++) {
|
|
48
|
+
const char = value[i];
|
|
49
|
+
if (char === "{") {
|
|
50
|
+
if (depth === 0)
|
|
51
|
+
start = i;
|
|
52
|
+
depth++;
|
|
53
|
+
} else if (char === "}" && depth > 0) {
|
|
54
|
+
depth--;
|
|
55
|
+
if (depth === 0) {
|
|
56
|
+
if (start > last)
|
|
57
|
+
parts.push({ text: value.slice(last, start) });
|
|
58
|
+
parts.push({ expression: value.slice(start + 1, i) });
|
|
59
|
+
last = i + 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!parts.some((part) => ("expression" in part)))
|
|
64
|
+
return null;
|
|
65
|
+
if (last < value.length)
|
|
66
|
+
parts.push({ text: value.slice(last) });
|
|
67
|
+
return parts;
|
|
68
|
+
}
|
|
69
|
+
function compileValue(ctx, value, scope, node, what) {
|
|
70
|
+
if (typeof value !== "string")
|
|
71
|
+
return value;
|
|
72
|
+
const parts = segments(value);
|
|
73
|
+
if (!parts)
|
|
74
|
+
return value;
|
|
75
|
+
if (parts.length === 1 && "expression" in parts[0])
|
|
76
|
+
return { $x: addExpression(ctx, parts[0].expression, scope, node, what) };
|
|
77
|
+
const code = parts.map((part) => ("text" in part) ? JSON.stringify(part.text) : `__stxText(${part.expression.trim()}
|
|
78
|
+
)`).join(" + ");
|
|
79
|
+
return { $x: addExpression(ctx, code, scope, node, what) };
|
|
80
|
+
}
|
|
81
|
+
function compileNode(ctx, node, outer) {
|
|
82
|
+
const directives = node.directives, out = { type: node.type, props: {}, style: node.style ?? {}, events: {}, children: [] };
|
|
83
|
+
if (node.darkStyle)
|
|
84
|
+
out.darkStyle = node.darkStyle;
|
|
85
|
+
let scope = outer;
|
|
86
|
+
if (directives?.for) {
|
|
87
|
+
const loop = directives.for;
|
|
88
|
+
out.directives = { for: { source: addExpression(ctx, loop.source, outer, node, ":for"), item: loop.item, ...loop.index ? { index: loop.index } : {} } };
|
|
89
|
+
scope = [...outer, loop.item, ...loop.index ? [loop.index] : []];
|
|
90
|
+
}
|
|
91
|
+
if (directives) {
|
|
92
|
+
const compiled = out.directives ?? {};
|
|
93
|
+
if (directives.if !== void 0)
|
|
94
|
+
compiled.if = addExpression(ctx, directives.if, scope, node, ":if");
|
|
95
|
+
if (directives.elseIf !== void 0)
|
|
96
|
+
compiled.elseIf = addExpression(ctx, directives.elseIf, scope, node, ":else-if");
|
|
97
|
+
if (directives.else)
|
|
98
|
+
compiled.else = !0;
|
|
99
|
+
if (directives.show !== void 0)
|
|
100
|
+
compiled.show = addExpression(ctx, directives.show, scope, node, ":show");
|
|
101
|
+
if (Object.keys(compiled).length)
|
|
102
|
+
out.directives = compiled;
|
|
103
|
+
}
|
|
104
|
+
if (node.bindings) {
|
|
105
|
+
const bindings = {};
|
|
106
|
+
for (const [name, expression] of Object.entries(node.bindings)) {
|
|
107
|
+
if (name !== "class" && name !== "style")
|
|
108
|
+
continue;
|
|
109
|
+
bindings[name] = addExpression(ctx, expression, scope, node, `:${name}`);
|
|
110
|
+
}
|
|
111
|
+
if (Object.keys(bindings).length)
|
|
112
|
+
out.bindings = bindings;
|
|
113
|
+
}
|
|
114
|
+
if (node.key !== void 0)
|
|
115
|
+
out.key = compileValue(ctx, node.key, scope, node, "key");
|
|
116
|
+
const isDataList = node.type === "FlatList" && node.props.data !== void 0, rowScope = isDataList ? [...scope, "item", "index"] : scope, props = out.props;
|
|
117
|
+
for (const [name, value] of Object.entries(node.props))
|
|
118
|
+
props[name] = compileValue(ctx, value, name === "keyExtractor" && isDataList ? rowScope : scope, node, name);
|
|
119
|
+
const events = out.events;
|
|
120
|
+
for (const [name, expression] of Object.entries(node.events))
|
|
121
|
+
events[name] = addHandler(ctx, expression, scope, node, name);
|
|
122
|
+
out.children = node.children.map((child) => typeof child === "string" ? compileValue(ctx, child, rowScope, node, "text") : compileNode(ctx, child, rowScope));
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
export function generateScreenModule(document) {
|
|
126
|
+
const ctx = { functions: [], warnings: [...document.meta.warnings ?? []], source: document.meta.source }, template = compileNode(ctx, document.root, []), named = document.script.functions.filter((name) => /^[A-Za-z_$][\w$]*$/.test(name)).map((name) => `${JSON.stringify(name)}: typeof ${name} === 'function' ? ${name} : undefined`);
|
|
127
|
+
return { code: [
|
|
128
|
+
`import { mount as __stxMount } from ${JSON.stringify(RUNTIME_SPECIFIER)}`,
|
|
129
|
+
"",
|
|
130
|
+
document.script.code,
|
|
131
|
+
"",
|
|
132
|
+
"// Generated by stx native from the template below the script.",
|
|
133
|
+
"function __stxText(value: any): string { return value == null || value === false ? '' : String(value) }",
|
|
134
|
+
"__stxMount({",
|
|
135
|
+
` document: { root: ${JSON.stringify(template)} },`,
|
|
136
|
+
` expressions: [
|
|
137
|
+
${ctx.functions.join(`,
|
|
138
|
+
`)}
|
|
139
|
+
] as any[],`,
|
|
140
|
+
` functions: { ${named.join(", ")} },`,
|
|
141
|
+
"})",
|
|
142
|
+
""
|
|
143
|
+
].join(`
|
|
144
|
+
`), template, warnings: ctx.warnings };
|
|
145
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import type { STXStyle } from './ir';
|
|
2
|
+
/**
|
|
3
|
+
* The class list as styles, with `dark:` variants kept apart.
|
|
4
|
+
*
|
|
5
|
+
* A native view has no hover, focus or breakpoints, so every other variant is
|
|
6
|
+
* dropped. `dark:` matters, because the host knows the appearance.
|
|
7
|
+
*/
|
|
8
|
+
export declare function compileClassStyles(classes: string): ClassStyles;
|
|
9
|
+
export declare function compileHeadwindToStyle(classes: string, unknown?: string[]): STXStyle;
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Color Palette (Tailwind v3 colors)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
declare const colors: {
|
|
14
|
+
transparent: 'transparent';
|
|
15
|
+
current: 'currentColor';
|
|
16
|
+
black: '#000000';
|
|
17
|
+
white: '#ffffff';
|
|
18
|
+
slate: {
|
|
19
|
+
50: '#f8fafc';
|
|
20
|
+
100: '#f1f5f9';
|
|
21
|
+
200: '#e2e8f0';
|
|
22
|
+
300: '#cbd5e1';
|
|
23
|
+
400: '#94a3b8';
|
|
24
|
+
500: '#64748b';
|
|
25
|
+
600: '#475569';
|
|
26
|
+
700: '#334155';
|
|
27
|
+
800: '#1e293b';
|
|
28
|
+
900: '#0f172a';
|
|
29
|
+
950: '#020617'
|
|
30
|
+
};
|
|
31
|
+
gray: {
|
|
32
|
+
50: '#f9fafb';
|
|
33
|
+
100: '#f3f4f6';
|
|
34
|
+
200: '#e5e7eb';
|
|
35
|
+
300: '#d1d5db';
|
|
36
|
+
400: '#9ca3af';
|
|
37
|
+
500: '#6b7280';
|
|
38
|
+
600: '#4b5563';
|
|
39
|
+
700: '#374151';
|
|
40
|
+
800: '#1f2937';
|
|
41
|
+
900: '#111827';
|
|
42
|
+
950: '#030712'
|
|
43
|
+
};
|
|
44
|
+
zinc: {
|
|
45
|
+
50: '#fafafa';
|
|
46
|
+
100: '#f4f4f5';
|
|
47
|
+
200: '#e4e4e7';
|
|
48
|
+
300: '#d4d4d8';
|
|
49
|
+
400: '#a1a1aa';
|
|
50
|
+
500: '#71717a';
|
|
51
|
+
600: '#52525b';
|
|
52
|
+
700: '#3f3f46';
|
|
53
|
+
800: '#27272a';
|
|
54
|
+
900: '#18181b';
|
|
55
|
+
950: '#09090b'
|
|
56
|
+
};
|
|
57
|
+
red: {
|
|
58
|
+
50: '#fef2f2';
|
|
59
|
+
100: '#fee2e2';
|
|
60
|
+
200: '#fecaca';
|
|
61
|
+
300: '#fca5a5';
|
|
62
|
+
400: '#f87171';
|
|
63
|
+
500: '#ef4444';
|
|
64
|
+
600: '#dc2626';
|
|
65
|
+
700: '#b91c1c';
|
|
66
|
+
800: '#991b1b';
|
|
67
|
+
900: '#7f1d1d';
|
|
68
|
+
950: '#450a0a'
|
|
69
|
+
};
|
|
70
|
+
orange: {
|
|
71
|
+
50: '#fff7ed';
|
|
72
|
+
100: '#ffedd5';
|
|
73
|
+
200: '#fed7aa';
|
|
74
|
+
300: '#fdba74';
|
|
75
|
+
400: '#fb923c';
|
|
76
|
+
500: '#f97316';
|
|
77
|
+
600: '#ea580c';
|
|
78
|
+
700: '#c2410c';
|
|
79
|
+
800: '#9a3412';
|
|
80
|
+
900: '#7c2d12';
|
|
81
|
+
950: '#431407'
|
|
82
|
+
};
|
|
83
|
+
amber: {
|
|
84
|
+
50: '#fffbeb';
|
|
85
|
+
100: '#fef3c7';
|
|
86
|
+
200: '#fde68a';
|
|
87
|
+
300: '#fcd34d';
|
|
88
|
+
400: '#fbbf24';
|
|
89
|
+
500: '#f59e0b';
|
|
90
|
+
600: '#d97706';
|
|
91
|
+
700: '#b45309';
|
|
92
|
+
800: '#92400e';
|
|
93
|
+
900: '#78350f';
|
|
94
|
+
950: '#451a03'
|
|
95
|
+
};
|
|
96
|
+
yellow: {
|
|
97
|
+
50: '#fefce8';
|
|
98
|
+
100: '#fef9c3';
|
|
99
|
+
200: '#fef08a';
|
|
100
|
+
300: '#fde047';
|
|
101
|
+
400: '#facc15';
|
|
102
|
+
500: '#eab308';
|
|
103
|
+
600: '#ca8a04';
|
|
104
|
+
700: '#a16207';
|
|
105
|
+
800: '#854d0e';
|
|
106
|
+
900: '#713f12';
|
|
107
|
+
950: '#422006'
|
|
108
|
+
};
|
|
109
|
+
green: {
|
|
110
|
+
50: '#f0fdf4';
|
|
111
|
+
100: '#dcfce7';
|
|
112
|
+
200: '#bbf7d0';
|
|
113
|
+
300: '#86efac';
|
|
114
|
+
400: '#4ade80';
|
|
115
|
+
500: '#22c55e';
|
|
116
|
+
600: '#16a34a';
|
|
117
|
+
700: '#15803d';
|
|
118
|
+
800: '#166534';
|
|
119
|
+
900: '#14532d';
|
|
120
|
+
950: '#052e16'
|
|
121
|
+
};
|
|
122
|
+
emerald: {
|
|
123
|
+
50: '#ecfdf5';
|
|
124
|
+
100: '#d1fae5';
|
|
125
|
+
200: '#a7f3d0';
|
|
126
|
+
300: '#6ee7b7';
|
|
127
|
+
400: '#34d399';
|
|
128
|
+
500: '#10b981';
|
|
129
|
+
600: '#059669';
|
|
130
|
+
700: '#047857';
|
|
131
|
+
800: '#065f46';
|
|
132
|
+
900: '#064e3b';
|
|
133
|
+
950: '#022c22'
|
|
134
|
+
};
|
|
135
|
+
teal: {
|
|
136
|
+
50: '#f0fdfa';
|
|
137
|
+
100: '#ccfbf1';
|
|
138
|
+
200: '#99f6e4';
|
|
139
|
+
300: '#5eead4';
|
|
140
|
+
400: '#2dd4bf';
|
|
141
|
+
500: '#14b8a6';
|
|
142
|
+
600: '#0d9488';
|
|
143
|
+
700: '#0f766e';
|
|
144
|
+
800: '#115e59';
|
|
145
|
+
900: '#134e4a';
|
|
146
|
+
950: '#042f2e'
|
|
147
|
+
};
|
|
148
|
+
cyan: {
|
|
149
|
+
50: '#ecfeff';
|
|
150
|
+
100: '#cffafe';
|
|
151
|
+
200: '#a5f3fc';
|
|
152
|
+
300: '#67e8f9';
|
|
153
|
+
400: '#22d3ee';
|
|
154
|
+
500: '#06b6d4';
|
|
155
|
+
600: '#0891b2';
|
|
156
|
+
700: '#0e7490';
|
|
157
|
+
800: '#155e75';
|
|
158
|
+
900: '#164e63';
|
|
159
|
+
950: '#083344'
|
|
160
|
+
};
|
|
161
|
+
sky: {
|
|
162
|
+
50: '#f0f9ff';
|
|
163
|
+
100: '#e0f2fe';
|
|
164
|
+
200: '#bae6fd';
|
|
165
|
+
300: '#7dd3fc';
|
|
166
|
+
400: '#38bdf8';
|
|
167
|
+
500: '#0ea5e9';
|
|
168
|
+
600: '#0284c7';
|
|
169
|
+
700: '#0369a1';
|
|
170
|
+
800: '#075985';
|
|
171
|
+
900: '#0c4a6e';
|
|
172
|
+
950: '#082f49'
|
|
173
|
+
};
|
|
174
|
+
lime: {
|
|
175
|
+
50: '#f7fee7';
|
|
176
|
+
100: '#ecfccb';
|
|
177
|
+
200: '#d9f99d';
|
|
178
|
+
300: '#bef264';
|
|
179
|
+
400: '#a3e635';
|
|
180
|
+
500: '#84cc16';
|
|
181
|
+
600: '#65a30d';
|
|
182
|
+
700: '#4d7c0f';
|
|
183
|
+
800: '#3f6212';
|
|
184
|
+
900: '#365314';
|
|
185
|
+
950: '#1a2e05'
|
|
186
|
+
};
|
|
187
|
+
fuchsia: {
|
|
188
|
+
50: '#fdf4ff';
|
|
189
|
+
100: '#fae8ff';
|
|
190
|
+
200: '#f5d0fe';
|
|
191
|
+
300: '#f0abfc';
|
|
192
|
+
400: '#e879f9';
|
|
193
|
+
500: '#d946ef';
|
|
194
|
+
600: '#c026d3';
|
|
195
|
+
700: '#a21caf';
|
|
196
|
+
800: '#86198f';
|
|
197
|
+
900: '#701a75';
|
|
198
|
+
950: '#4a044e'
|
|
199
|
+
};
|
|
200
|
+
neutral: {
|
|
201
|
+
50: '#fafafa';
|
|
202
|
+
100: '#f5f5f5';
|
|
203
|
+
200: '#e5e5e5';
|
|
204
|
+
300: '#d4d4d4';
|
|
205
|
+
400: '#a3a3a3';
|
|
206
|
+
500: '#737373';
|
|
207
|
+
600: '#525252';
|
|
208
|
+
700: '#404040';
|
|
209
|
+
800: '#262626';
|
|
210
|
+
900: '#171717';
|
|
211
|
+
950: '#0a0a0a'
|
|
212
|
+
};
|
|
213
|
+
stone: {
|
|
214
|
+
50: '#fafaf9';
|
|
215
|
+
100: '#f5f5f4';
|
|
216
|
+
200: '#e7e5e4';
|
|
217
|
+
300: '#d6d3d1';
|
|
218
|
+
400: '#a8a29e';
|
|
219
|
+
500: '#78716c';
|
|
220
|
+
600: '#57534e';
|
|
221
|
+
700: '#44403c';
|
|
222
|
+
800: '#292524';
|
|
223
|
+
900: '#1c1917';
|
|
224
|
+
950: '#0c0a09'
|
|
225
|
+
};
|
|
226
|
+
blue: {
|
|
227
|
+
50: '#eff6ff';
|
|
228
|
+
100: '#dbeafe';
|
|
229
|
+
200: '#bfdbfe';
|
|
230
|
+
300: '#93c5fd';
|
|
231
|
+
400: '#60a5fa';
|
|
232
|
+
500: '#3b82f6';
|
|
233
|
+
600: '#2563eb';
|
|
234
|
+
700: '#1d4ed8';
|
|
235
|
+
800: '#1e40af';
|
|
236
|
+
900: '#1e3a8a';
|
|
237
|
+
950: '#172554'
|
|
238
|
+
};
|
|
239
|
+
indigo: {
|
|
240
|
+
50: '#eef2ff';
|
|
241
|
+
100: '#e0e7ff';
|
|
242
|
+
200: '#c7d2fe';
|
|
243
|
+
300: '#a5b4fc';
|
|
244
|
+
400: '#818cf8';
|
|
245
|
+
500: '#6366f1';
|
|
246
|
+
600: '#4f46e5';
|
|
247
|
+
700: '#4338ca';
|
|
248
|
+
800: '#3730a3';
|
|
249
|
+
900: '#312e81';
|
|
250
|
+
950: '#1e1b4b'
|
|
251
|
+
};
|
|
252
|
+
violet: {
|
|
253
|
+
50: '#f5f3ff';
|
|
254
|
+
100: '#ede9fe';
|
|
255
|
+
200: '#ddd6fe';
|
|
256
|
+
300: '#c4b5fd';
|
|
257
|
+
400: '#a78bfa';
|
|
258
|
+
500: '#8b5cf6';
|
|
259
|
+
600: '#7c3aed';
|
|
260
|
+
700: '#6d28d9';
|
|
261
|
+
800: '#5b21b6';
|
|
262
|
+
900: '#4c1d95';
|
|
263
|
+
950: '#2e1065'
|
|
264
|
+
};
|
|
265
|
+
purple: {
|
|
266
|
+
50: '#faf5ff';
|
|
267
|
+
100: '#f3e8ff';
|
|
268
|
+
200: '#e9d5ff';
|
|
269
|
+
300: '#d8b4fe';
|
|
270
|
+
400: '#c084fc';
|
|
271
|
+
500: '#a855f7';
|
|
272
|
+
600: '#9333ea';
|
|
273
|
+
700: '#7e22ce';
|
|
274
|
+
800: '#6b21a8';
|
|
275
|
+
900: '#581c87';
|
|
276
|
+
950: '#3b0764'
|
|
277
|
+
};
|
|
278
|
+
pink: {
|
|
279
|
+
50: '#fdf2f8';
|
|
280
|
+
100: '#fce7f3';
|
|
281
|
+
200: '#fbcfe8';
|
|
282
|
+
300: '#f9a8d4';
|
|
283
|
+
400: '#f472b6';
|
|
284
|
+
500: '#ec4899';
|
|
285
|
+
600: '#db2777';
|
|
286
|
+
700: '#be185d';
|
|
287
|
+
800: '#9d174d';
|
|
288
|
+
900: '#831843';
|
|
289
|
+
950: '#500724'
|
|
290
|
+
};
|
|
291
|
+
rose: {
|
|
292
|
+
50: '#fff1f2';
|
|
293
|
+
100: '#ffe4e6';
|
|
294
|
+
200: '#fecdd3';
|
|
295
|
+
300: '#fda4af';
|
|
296
|
+
400: '#fb7185';
|
|
297
|
+
500: '#f43f5e';
|
|
298
|
+
600: '#e11d48';
|
|
299
|
+
700: '#be123c';
|
|
300
|
+
800: '#9f1239';
|
|
301
|
+
900: '#881337';
|
|
302
|
+
950: '#4c0519'
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
// ============================================================================
|
|
306
|
+
// Spacing Scale
|
|
307
|
+
// ============================================================================
|
|
308
|
+
declare const spacing: {
|
|
309
|
+
px: 1;
|
|
310
|
+
0: 0;
|
|
311
|
+
0.5: 2;
|
|
312
|
+
1: 4;
|
|
313
|
+
1.5: 6;
|
|
314
|
+
2: 8;
|
|
315
|
+
2.5: 10;
|
|
316
|
+
3: 12;
|
|
317
|
+
3.5: 14;
|
|
318
|
+
4: 16;
|
|
319
|
+
5: 20;
|
|
320
|
+
6: 24;
|
|
321
|
+
7: 28;
|
|
322
|
+
8: 32;
|
|
323
|
+
9: 36;
|
|
324
|
+
10: 40;
|
|
325
|
+
11: 44;
|
|
326
|
+
12: 48;
|
|
327
|
+
14: 56;
|
|
328
|
+
16: 64;
|
|
329
|
+
20: 80;
|
|
330
|
+
24: 96;
|
|
331
|
+
28: 112;
|
|
332
|
+
32: 128;
|
|
333
|
+
36: 144;
|
|
334
|
+
40: 160;
|
|
335
|
+
44: 176;
|
|
336
|
+
48: 192;
|
|
337
|
+
52: 208;
|
|
338
|
+
56: 224;
|
|
339
|
+
60: 240;
|
|
340
|
+
64: 256;
|
|
341
|
+
72: 288;
|
|
342
|
+
80: 320;
|
|
343
|
+
96: 384
|
|
344
|
+
};
|
|
345
|
+
// ============================================================================
|
|
346
|
+
// Font Sizes
|
|
347
|
+
// ============================================================================
|
|
348
|
+
declare const fontSizes: {
|
|
349
|
+
xs: 12;
|
|
350
|
+
sm: 14;
|
|
351
|
+
base: 16;
|
|
352
|
+
lg: 18;
|
|
353
|
+
xl: 20;
|
|
354
|
+
'2xl': 24;
|
|
355
|
+
'3xl': 30;
|
|
356
|
+
'4xl': 36;
|
|
357
|
+
'5xl': 48;
|
|
358
|
+
'6xl': 60;
|
|
359
|
+
'7xl': 72;
|
|
360
|
+
'8xl': 96;
|
|
361
|
+
'9xl': 128
|
|
362
|
+
};
|
|
363
|
+
// ============================================================================
|
|
364
|
+
// Border Radius
|
|
365
|
+
// ============================================================================
|
|
366
|
+
declare const borderRadius: {
|
|
367
|
+
none: 0;
|
|
368
|
+
sm: 2;
|
|
369
|
+
DEFAULT: 4;
|
|
370
|
+
md: 6;
|
|
371
|
+
lg: 8;
|
|
372
|
+
xl: 12;
|
|
373
|
+
'2xl': 16;
|
|
374
|
+
'3xl': 24;
|
|
375
|
+
full: 9999
|
|
376
|
+
};
|
|
377
|
+
// ============================================================================
|
|
378
|
+
// Main Compiler Function
|
|
379
|
+
// ============================================================================
|
|
380
|
+
export declare interface ClassStyles {
|
|
381
|
+
style: STXStyle
|
|
382
|
+
dark?: STXStyle
|
|
383
|
+
unknown: string[]
|
|
384
|
+
numberOfLines?: number
|
|
385
|
+
icon?: string
|
|
386
|
+
}
|
|
387
|
+
// ============================================================================
|
|
388
|
+
// Class Parsers
|
|
389
|
+
// ============================================================================
|
|
390
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
391
|
+
declare type ClassParser = (value: string, style: STXStyle) => boolean;
|
|
392
|
+
// ============================================================================
|
|
393
|
+
// Exports
|
|
394
|
+
// ============================================================================
|
|
395
|
+
export { colors, spacing, fontSizes, borderRadius };
|