@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,26 @@
|
|
|
1
|
+
import type { STXDocument } from './ir';
|
|
2
|
+
import type { TranslationDiagnostic } from './html-to-ir';
|
|
3
|
+
/**
|
|
4
|
+
* Where the native primitive components live, for an app's stx config.
|
|
5
|
+
*
|
|
6
|
+
* Resolved by looking, because the answer differs between running from source,
|
|
7
|
+
* the per-module build and the bundled CLI. A path that is merely plausible
|
|
8
|
+
* would fail only in the built binary, which is the one users run.
|
|
9
|
+
*/
|
|
10
|
+
export declare function nativePrimitivesDir(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Render a screen's source with stx and translate it to the native IR.
|
|
13
|
+
*/
|
|
14
|
+
export declare function compileScreenSource(source: string, filePath: string, options?: CompileScreenOptions): Promise<CompiledScreen>;
|
|
15
|
+
/** The same, reading the screen off disk. */
|
|
16
|
+
export declare function compileScreenFile(filePath: string, options?: CompileScreenOptions): Promise<CompiledScreen>;
|
|
17
|
+
export declare interface CompileScreenOptions {
|
|
18
|
+
componentsDir?: string
|
|
19
|
+
root?: string
|
|
20
|
+
context?: Record<string, unknown>
|
|
21
|
+
}
|
|
22
|
+
export declare interface CompiledScreen {
|
|
23
|
+
document: STXDocument
|
|
24
|
+
diagnostics: TranslationDiagnostic[]
|
|
25
|
+
html: string
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { processDirectives } from "../../process.js";
|
|
4
|
+
import { translateHtmlToDocument } from "./html-to-ir.js";
|
|
5
|
+
import { extractClientScript } from "./client-script.js";
|
|
6
|
+
export function nativePrimitivesDir() {
|
|
7
|
+
const candidates = [
|
|
8
|
+
path.join(import.meta.dir, "..", "primitives"),
|
|
9
|
+
path.join(import.meta.dir, "native", "primitives")
|
|
10
|
+
];
|
|
11
|
+
for (const candidate of candidates)
|
|
12
|
+
if (existsSync(path.join(candidate, "View.stx")))
|
|
13
|
+
return candidate;
|
|
14
|
+
return candidates[0];
|
|
15
|
+
}
|
|
16
|
+
export async function compileScreenSource(source, filePath, options = {}) {
|
|
17
|
+
const root = options.root ?? path.dirname(filePath), config = {
|
|
18
|
+
root,
|
|
19
|
+
componentsDir: options.componentsDir ?? path.join(root, "components"),
|
|
20
|
+
buildMode: "serve",
|
|
21
|
+
cache: !1,
|
|
22
|
+
_pluginComponentDirs: [nativePrimitivesDir()]
|
|
23
|
+
}, html = await processDirectives(source, options.context ?? {}, filePath, config, new Set), { document, diagnostics } = await translateHtmlToDocument(html, {
|
|
24
|
+
source: filePath,
|
|
25
|
+
script: extractClientScript(source)
|
|
26
|
+
});
|
|
27
|
+
return { document, diagnostics, html };
|
|
28
|
+
}
|
|
29
|
+
export async function compileScreenFile(filePath, options = {}) {
|
|
30
|
+
return compileScreenSource(await Bun.file(filePath).text(), filePath, options);
|
|
31
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type { STXStyle } from '../compiler/ir';
|
|
2
|
+
/** Maps STX component names to native implementations */
|
|
3
|
+
export declare const ComponentRegistry: {
|
|
4
|
+
View: 'View';
|
|
5
|
+
ScrollView: 'ScrollView';
|
|
6
|
+
SafeAreaView: 'SafeAreaView';
|
|
7
|
+
KeyboardAvoidingView: 'KeyboardAvoidingView';
|
|
8
|
+
Text: 'Text';
|
|
9
|
+
TextInput: 'TextInput';
|
|
10
|
+
Button: 'Button';
|
|
11
|
+
TouchableOpacity: 'TouchableOpacity';
|
|
12
|
+
TouchableHighlight: 'TouchableHighlight';
|
|
13
|
+
Pressable: 'Pressable';
|
|
14
|
+
Switch: 'Switch';
|
|
15
|
+
Slider: 'Slider';
|
|
16
|
+
Image: 'Image';
|
|
17
|
+
ImageBackground: 'ImageBackground';
|
|
18
|
+
FlatList: 'FlatList';
|
|
19
|
+
SectionList: 'SectionList';
|
|
20
|
+
Modal: 'Modal';
|
|
21
|
+
ActivityIndicator: 'ActivityIndicator';
|
|
22
|
+
StatusBar: 'StatusBar';
|
|
23
|
+
RefreshControl: 'RefreshControl'
|
|
24
|
+
};
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Base Types
|
|
27
|
+
// ============================================================================
|
|
28
|
+
export declare interface BaseProps {
|
|
29
|
+
key?: string
|
|
30
|
+
style?: STXStyle
|
|
31
|
+
class?: string
|
|
32
|
+
testID?: string
|
|
33
|
+
accessibilityLabel?: string
|
|
34
|
+
accessibilityHint?: string
|
|
35
|
+
accessibilityRole?: AccessibilityRole
|
|
36
|
+
}
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Layout Components
|
|
39
|
+
// ============================================================================
|
|
40
|
+
export declare interface ViewProps extends BaseProps {
|
|
41
|
+
onPress?: () => void
|
|
42
|
+
onLongPress?: () => void
|
|
43
|
+
onLayout?: (event: LayoutEvent) => void
|
|
44
|
+
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only'
|
|
45
|
+
}
|
|
46
|
+
export declare interface ScrollViewProps extends ViewProps {
|
|
47
|
+
horizontal?: boolean
|
|
48
|
+
showsHorizontalScrollIndicator?: boolean
|
|
49
|
+
showsVerticalScrollIndicator?: boolean
|
|
50
|
+
bounces?: boolean
|
|
51
|
+
onScroll?: (event: ScrollEvent) => void
|
|
52
|
+
onScrollEndDrag?: () => void
|
|
53
|
+
onMomentumScrollEnd?: () => void
|
|
54
|
+
contentContainerStyle?: STXStyle
|
|
55
|
+
keyboardDismissMode?: 'none' | 'on-drag' | 'interactive'
|
|
56
|
+
refreshControl?: RefreshControlProps
|
|
57
|
+
pagingEnabled?: boolean
|
|
58
|
+
scrollEnabled?: boolean
|
|
59
|
+
}
|
|
60
|
+
export declare interface SafeAreaViewProps extends ViewProps {
|
|
61
|
+
edges?: Array<'top' | 'right' | 'bottom' | 'left'>
|
|
62
|
+
}
|
|
63
|
+
export declare interface KeyboardAvoidingViewProps extends ViewProps {
|
|
64
|
+
behavior?: 'height' | 'position' | 'padding'
|
|
65
|
+
keyboardVerticalOffset?: number
|
|
66
|
+
}
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// Text Components
|
|
69
|
+
// ============================================================================
|
|
70
|
+
export declare interface TextProps extends BaseProps {
|
|
71
|
+
numberOfLines?: number
|
|
72
|
+
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip'
|
|
73
|
+
selectable?: boolean
|
|
74
|
+
onPress?: () => void
|
|
75
|
+
onLongPress?: () => void
|
|
76
|
+
}
|
|
77
|
+
export declare interface TextInputProps extends BaseProps {
|
|
78
|
+
value?: string
|
|
79
|
+
defaultValue?: string
|
|
80
|
+
placeholder?: string
|
|
81
|
+
placeholderTextColor?: string
|
|
82
|
+
onChangeText?: (text: string) => void
|
|
83
|
+
onFocus?: () => void
|
|
84
|
+
onBlur?: () => void
|
|
85
|
+
onSubmitEditing?: () => void
|
|
86
|
+
keyboardType?: KeyboardType
|
|
87
|
+
returnKeyType?: ReturnKeyType
|
|
88
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'
|
|
89
|
+
autoCorrect?: boolean
|
|
90
|
+
autoFocus?: boolean
|
|
91
|
+
secureTextEntry?: boolean
|
|
92
|
+
maxLength?: number
|
|
93
|
+
multiline?: boolean
|
|
94
|
+
editable?: boolean
|
|
95
|
+
selectionColor?: string
|
|
96
|
+
}
|
|
97
|
+
// ============================================================================
|
|
98
|
+
// Interactive Components
|
|
99
|
+
// ============================================================================
|
|
100
|
+
export declare interface ButtonProps extends BaseProps {
|
|
101
|
+
title?: string
|
|
102
|
+
onPress?: () => void
|
|
103
|
+
disabled?: boolean
|
|
104
|
+
color?: string
|
|
105
|
+
}
|
|
106
|
+
export declare interface TouchableOpacityProps extends ViewProps {
|
|
107
|
+
activeOpacity?: number
|
|
108
|
+
disabled?: boolean
|
|
109
|
+
}
|
|
110
|
+
export declare interface TouchableHighlightProps extends ViewProps {
|
|
111
|
+
underlayColor?: string
|
|
112
|
+
activeOpacity?: number
|
|
113
|
+
disabled?: boolean
|
|
114
|
+
onShowUnderlay?: () => void
|
|
115
|
+
onHideUnderlay?: () => void
|
|
116
|
+
}
|
|
117
|
+
export declare interface PressableProps extends ViewProps {
|
|
118
|
+
disabled?: boolean
|
|
119
|
+
onPressIn?: () => void
|
|
120
|
+
onPressOut?: () => void
|
|
121
|
+
hitSlop?: number | { top?: number; right?: number; bottom?: number; left?: number }
|
|
122
|
+
pressRetentionOffset?: number | { top?: number; right?: number; bottom?: number; left?: number }
|
|
123
|
+
android_ripple?: {
|
|
124
|
+
color?: string
|
|
125
|
+
borderless?: boolean
|
|
126
|
+
radius?: number
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export declare interface SwitchProps extends BaseProps {
|
|
130
|
+
value?: boolean
|
|
131
|
+
onValueChange?: (value: boolean) => void
|
|
132
|
+
disabled?: boolean
|
|
133
|
+
trackColor?: { false?: string; true?: string }
|
|
134
|
+
thumbColor?: string
|
|
135
|
+
ios_backgroundColor?: string
|
|
136
|
+
}
|
|
137
|
+
export declare interface SliderProps extends BaseProps {
|
|
138
|
+
value?: number
|
|
139
|
+
minimumValue?: number
|
|
140
|
+
maximumValue?: number
|
|
141
|
+
step?: number
|
|
142
|
+
onValueChange?: (value: number) => void
|
|
143
|
+
onSlidingComplete?: (value: number) => void
|
|
144
|
+
disabled?: boolean
|
|
145
|
+
minimumTrackTintColor?: string
|
|
146
|
+
maximumTrackTintColor?: string
|
|
147
|
+
thumbTintColor?: string
|
|
148
|
+
}
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// Media Components
|
|
151
|
+
// ============================================================================
|
|
152
|
+
export declare interface ImageProps extends BaseProps {
|
|
153
|
+
source: ImageSource
|
|
154
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center' | 'repeat'
|
|
155
|
+
onLoad?: () => void
|
|
156
|
+
onLoadStart?: () => void
|
|
157
|
+
onLoadEnd?: () => void
|
|
158
|
+
onError?: (error: Error) => void
|
|
159
|
+
blurRadius?: number
|
|
160
|
+
fadeDuration?: number
|
|
161
|
+
defaultSource?: ImageSource
|
|
162
|
+
}
|
|
163
|
+
export declare interface ImageBackgroundProps extends ImageProps {
|
|
164
|
+
imageStyle?: STXStyle
|
|
165
|
+
}
|
|
166
|
+
// ============================================================================
|
|
167
|
+
// List Components
|
|
168
|
+
// ============================================================================
|
|
169
|
+
export declare interface FlatListProps<T> extends ScrollViewProps {
|
|
170
|
+
data: T[]
|
|
171
|
+
renderItem: (info: { item: T; index: number }) => unknown
|
|
172
|
+
keyExtractor?: (item: T, index: number) => string
|
|
173
|
+
ItemSeparatorComponent?: () => unknown
|
|
174
|
+
ListHeaderComponent?: () => unknown
|
|
175
|
+
ListFooterComponent?: () => unknown
|
|
176
|
+
ListEmptyComponent?: () => unknown
|
|
177
|
+
numColumns?: number
|
|
178
|
+
initialNumToRender?: number
|
|
179
|
+
maxToRenderPerBatch?: number
|
|
180
|
+
windowSize?: number
|
|
181
|
+
onEndReached?: () => void
|
|
182
|
+
onEndReachedThreshold?: number
|
|
183
|
+
inverted?: boolean
|
|
184
|
+
}
|
|
185
|
+
export declare interface SectionListProps<T> extends ScrollViewProps {
|
|
186
|
+
sections: Array<{ title?: string; data: T[] }>
|
|
187
|
+
renderItem: (info: { item: T; index: number; section: { title?: string; data: T[] } }) => unknown
|
|
188
|
+
renderSectionHeader?: (info: { section: { title?: string; data: T[] } }) => unknown
|
|
189
|
+
keyExtractor?: (item: T, index: number) => string
|
|
190
|
+
}
|
|
191
|
+
// ============================================================================
|
|
192
|
+
// Overlay Components
|
|
193
|
+
// ============================================================================
|
|
194
|
+
export declare interface ModalProps extends BaseProps {
|
|
195
|
+
visible?: boolean
|
|
196
|
+
animationType?: 'none' | 'slide' | 'fade'
|
|
197
|
+
presentationStyle?: 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
|
|
198
|
+
transparent?: boolean
|
|
199
|
+
onRequestClose?: () => void
|
|
200
|
+
onShow?: () => void
|
|
201
|
+
onDismiss?: () => void
|
|
202
|
+
statusBarTranslucent?: boolean
|
|
203
|
+
}
|
|
204
|
+
export declare interface ActivityIndicatorProps extends BaseProps {
|
|
205
|
+
animating?: boolean
|
|
206
|
+
color?: string
|
|
207
|
+
size?: 'small' | 'large' | number
|
|
208
|
+
hidesWhenStopped?: boolean
|
|
209
|
+
}
|
|
210
|
+
// ============================================================================
|
|
211
|
+
// Utility Components
|
|
212
|
+
// ============================================================================
|
|
213
|
+
export declare interface StatusBarProps {
|
|
214
|
+
barStyle?: 'default' | 'light-content' | 'dark-content'
|
|
215
|
+
backgroundColor?: string
|
|
216
|
+
hidden?: boolean
|
|
217
|
+
animated?: boolean
|
|
218
|
+
translucent?: boolean
|
|
219
|
+
}
|
|
220
|
+
export declare interface RefreshControlProps {
|
|
221
|
+
refreshing: boolean
|
|
222
|
+
onRefresh: () => void
|
|
223
|
+
tintColor?: string
|
|
224
|
+
title?: string
|
|
225
|
+
titleColor?: string
|
|
226
|
+
progressBackgroundColor?: string
|
|
227
|
+
progressViewOffset?: number
|
|
228
|
+
}
|
|
229
|
+
// ============================================================================
|
|
230
|
+
// Event Types
|
|
231
|
+
// ============================================================================
|
|
232
|
+
export declare interface LayoutEvent {
|
|
233
|
+
nativeEvent: {
|
|
234
|
+
layout: {
|
|
235
|
+
x: number
|
|
236
|
+
y: number
|
|
237
|
+
width: number
|
|
238
|
+
height: number
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
export declare interface ScrollEvent {
|
|
243
|
+
nativeEvent: {
|
|
244
|
+
contentOffset: { x: number; y: number }
|
|
245
|
+
contentSize: { width: number; height: number }
|
|
246
|
+
layoutMeasurement: { width: number; height: number }
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
export type AccessibilityRole = | 'none'
|
|
250
|
+
| 'button'
|
|
251
|
+
| 'link'
|
|
252
|
+
| 'search'
|
|
253
|
+
| 'image'
|
|
254
|
+
| 'text'
|
|
255
|
+
| 'adjustable'
|
|
256
|
+
| 'header'
|
|
257
|
+
| 'summary'
|
|
258
|
+
| 'alert'
|
|
259
|
+
| 'checkbox'
|
|
260
|
+
| 'combobox'
|
|
261
|
+
| 'menu'
|
|
262
|
+
| 'menubar'
|
|
263
|
+
| 'menuitem'
|
|
264
|
+
| 'progressbar'
|
|
265
|
+
| 'radio'
|
|
266
|
+
| 'radiogroup'
|
|
267
|
+
| 'scrollbar'
|
|
268
|
+
| 'spinbutton'
|
|
269
|
+
| 'switch'
|
|
270
|
+
| 'tab'
|
|
271
|
+
| 'tablist'
|
|
272
|
+
| 'timer'
|
|
273
|
+
| 'toolbar';
|
|
274
|
+
export type KeyboardType = | 'default'
|
|
275
|
+
| 'email-address'
|
|
276
|
+
| 'numeric'
|
|
277
|
+
| 'phone-pad'
|
|
278
|
+
| 'number-pad'
|
|
279
|
+
| 'decimal-pad'
|
|
280
|
+
| 'url'
|
|
281
|
+
| 'web-search'
|
|
282
|
+
| 'visible-password';
|
|
283
|
+
export type ReturnKeyType = | 'done'
|
|
284
|
+
| 'go'
|
|
285
|
+
| 'next'
|
|
286
|
+
| 'search'
|
|
287
|
+
| 'send'
|
|
288
|
+
| 'default';
|
|
289
|
+
export type ImageSource = | { uri: string; width?: number; height?: number; headers?: Record<string, string> }
|
|
290
|
+
| number // require('./image.png');
|
|
291
|
+
export type ComponentName = keyof typeof ComponentRegistry;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const ComponentRegistry = {
|
|
2
|
+
View: "View",
|
|
3
|
+
ScrollView: "ScrollView",
|
|
4
|
+
SafeAreaView: "SafeAreaView",
|
|
5
|
+
KeyboardAvoidingView: "KeyboardAvoidingView",
|
|
6
|
+
Text: "Text",
|
|
7
|
+
TextInput: "TextInput",
|
|
8
|
+
Button: "Button",
|
|
9
|
+
TouchableOpacity: "TouchableOpacity",
|
|
10
|
+
TouchableHighlight: "TouchableHighlight",
|
|
11
|
+
Pressable: "Pressable",
|
|
12
|
+
Switch: "Switch",
|
|
13
|
+
Slider: "Slider",
|
|
14
|
+
Image: "Image",
|
|
15
|
+
ImageBackground: "ImageBackground",
|
|
16
|
+
FlatList: "FlatList",
|
|
17
|
+
SectionList: "SectionList",
|
|
18
|
+
Modal: "Modal",
|
|
19
|
+
ActivityIndicator: "ActivityIndicator",
|
|
20
|
+
StatusBar: "StatusBar",
|
|
21
|
+
RefreshControl: "RefreshControl"
|
|
22
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { STXDocument } from '../compiler/ir';
|
|
2
|
+
export type { HotReloadMessage, HotReloadState, HotReloadCallback, ErrorOverlayOptions };
|
|
3
|
+
/**
|
|
4
|
+
* Get or create the hot reload client
|
|
5
|
+
*/
|
|
6
|
+
export declare function getHotReloadClient(serverUrl?: string): HotReloadClient;
|
|
7
|
+
/**
|
|
8
|
+
* Get or create the error overlay
|
|
9
|
+
*/
|
|
10
|
+
export declare function getErrorOverlay(): ErrorOverlay;
|
|
11
|
+
/**
|
|
12
|
+
* Initialize hot reload (call this in dev mode)
|
|
13
|
+
*/
|
|
14
|
+
export declare function initHotReload(serverUrl?: string): HotReloadClient;
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Types
|
|
17
|
+
// ============================================================================
|
|
18
|
+
declare interface HotReloadMessage {
|
|
19
|
+
type: 'HOT_RELOAD' | 'FULL_RELOAD' | 'ERROR'
|
|
20
|
+
payload: {
|
|
21
|
+
changedFiles?: string[]
|
|
22
|
+
document?: STXDocument
|
|
23
|
+
preserveState?: boolean
|
|
24
|
+
error?: string
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
declare interface HotReloadState {
|
|
28
|
+
state: Record<string, unknown>
|
|
29
|
+
scrollPositions: Map<string, { x: number; y: number }>
|
|
30
|
+
focusedKey: string | null
|
|
31
|
+
inputValues: Map<string, string>
|
|
32
|
+
}
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Error Overlay
|
|
35
|
+
// ============================================================================
|
|
36
|
+
declare interface ErrorOverlayOptions {
|
|
37
|
+
error: Error | string
|
|
38
|
+
source?: string
|
|
39
|
+
line?: number
|
|
40
|
+
column?: number
|
|
41
|
+
}
|
|
42
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
43
|
+
declare type HotReloadCallback = (document: STXDocument) => void;
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Hot Reload Client
|
|
46
|
+
// ============================================================================
|
|
47
|
+
declare class HotReloadClient {
|
|
48
|
+
constructor(serverUrl?: string);
|
|
49
|
+
connect(): void;
|
|
50
|
+
disconnect(): void;
|
|
51
|
+
get connected(): boolean;
|
|
52
|
+
onReload(callback: HotReloadCallback): () => void;
|
|
53
|
+
send(type: string, payload: unknown): void;
|
|
54
|
+
}
|
|
55
|
+
declare class ErrorOverlay {
|
|
56
|
+
show(options: ErrorOverlayOptions): void;
|
|
57
|
+
hide(): void;
|
|
58
|
+
}
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// Exports
|
|
61
|
+
// ============================================================================
|
|
62
|
+
export { HotReloadClient, ErrorOverlay };
|