@ohos-ports/stacksjs-stx 0.2.287-beta.0
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/LICENSE.md +21 -0
- package/README.md +1042 -0
- package/dist/a11y.d.ts +256 -0
- package/dist/a11y.js +671 -0
- package/dist/analytics.d.ts +40 -0
- package/dist/analytics.js +159 -0
- package/dist/analyzer.d.ts +68 -0
- package/dist/analyzer.js +240 -0
- package/dist/animation.d.ts +123 -0
- package/dist/animation.js +688 -0
- package/dist/app-shell.d.ts +76 -0
- package/dist/app-shell.js +209 -0
- package/dist/app.d.ts +65 -0
- package/dist/app.js +79 -0
- package/dist/appearance-bootstrap.d.ts +54 -0
- package/dist/appearance-bootstrap.js +92 -0
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +21 -0
- package/dist/assets.js +155 -0
- package/dist/ast.d.ts +265 -0
- package/dist/ast.js +630 -0
- package/dist/async-components.d.ts +123 -0
- package/dist/async-components.js +428 -0
- package/dist/auth.d.ts +13 -0
- package/dist/auth.js +12 -0
- package/dist/broadcasting.d.ts +77 -0
- package/dist/broadcasting.js +103 -0
- package/dist/browser-composables.d.ts +348 -0
- package/dist/browser-composables.js +606 -0
- package/dist/browser-core-imports.d.ts +12 -0
- package/dist/browser-core-imports.js +28 -0
- package/dist/build-assets.d.ts +32 -0
- package/dist/build-assets.js +29 -0
- package/dist/build-externalize-repeated.d.ts +34 -0
- package/dist/build-externalize-repeated.js +101 -0
- package/dist/build-externalize.d.ts +73 -0
- package/dist/build-externalize.js +80 -0
- package/dist/build-id.d.ts +57 -0
- package/dist/build-id.js +25 -0
- package/dist/build-message.d.ts +81 -0
- package/dist/build-message.js +65 -0
- package/dist/build-mode-detector.d.ts +26 -0
- package/dist/build-mode-detector.js +50 -0
- package/dist/build-optimizer.d.ts +101 -0
- package/dist/build-optimizer.js +433 -0
- package/dist/build-views.d.ts +56 -0
- package/dist/build-views.js +180 -0
- package/dist/build.d.ts +31 -0
- package/dist/build.js +34 -0
- package/dist/builtins/attrs.d.ts +49 -0
- package/dist/builtins/attrs.js +39 -0
- package/dist/builtins/drawer.d.ts +24 -0
- package/dist/builtins/drawer.js +37 -0
- package/dist/builtins/escape.d.ts +12 -0
- package/dist/builtins/escape.js +3 -0
- package/dist/builtins/icon.d.ts +45 -0
- package/dist/builtins/icon.js +100 -0
- package/dist/builtins/image-delivery.d.ts +16 -0
- package/dist/builtins/image-delivery.js +115 -0
- package/dist/builtins/image-placeholder.d.ts +78 -0
- package/dist/builtins/image-placeholder.js +137 -0
- package/dist/builtins/index.d.ts +26 -0
- package/dist/builtins/index.js +34 -0
- package/dist/builtins/modal.d.ts +26 -0
- package/dist/builtins/modal.js +38 -0
- package/dist/builtins/safe-image.d.ts +44 -0
- package/dist/builtins/safe-image.js +45 -0
- package/dist/builtins/stx-image.d.ts +29 -0
- package/dist/builtins/stx-image.js +222 -0
- package/dist/builtins/stx-link.d.ts +11 -0
- package/dist/builtins/stx-link.js +35 -0
- package/dist/builtins/stx-loading-indicator.d.ts +13 -0
- package/dist/builtins/stx-loading-indicator.js +35 -0
- package/dist/builtins/suspense.d.ts +30 -0
- package/dist/builtins/suspense.js +24 -0
- package/dist/builtins/toast.d.ts +19 -0
- package/dist/builtins/toast.js +42 -0
- package/dist/builtins/tooltip.d.ts +18 -0
- package/dist/builtins/tooltip.js +106 -0
- package/dist/builtins/transition-group.d.ts +27 -0
- package/dist/builtins/transition-group.js +22 -0
- package/dist/bun-shim.js +496 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/collector.js +233 -0
- package/dist/bundle-analyzer/index.d.ts +98 -0
- package/dist/bundle-analyzer/index.js +82 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/report.js +318 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer/treemap.js +594 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +69 -0
- package/dist/caching.js +135 -0
- package/dist/chunk-0y46fbkx.js +3 -0
- package/dist/chunk-122tyfre.js +2 -0
- package/dist/chunk-19nfvxfw.js +43 -0
- package/dist/chunk-1kah92n2.js +3 -0
- package/dist/chunk-1kms3b9d.js +2 -0
- package/dist/chunk-1q4y74mh.js +1194 -0
- package/dist/chunk-248e84r1.js +4 -0
- package/dist/chunk-24ps8kft.js +2 -0
- package/dist/chunk-2et5hxfv.js +2 -0
- package/dist/chunk-2r1rd8f0.js +2 -0
- package/dist/chunk-2tk1zkrz.js +2 -0
- package/dist/chunk-38ejahd9.js +3 -0
- package/dist/chunk-3zv4wz87.js +2 -0
- package/dist/chunk-4122k1bh.js +2 -0
- package/dist/chunk-45az9zht.js +2 -0
- package/dist/chunk-4qr85f07.js +2 -0
- package/dist/chunk-4ww3znrr.js +15 -0
- package/dist/chunk-54st8g2j.js +397 -0
- package/dist/chunk-58f0mthg.js +3 -0
- package/dist/chunk-5a19dhx5.js +2 -0
- package/dist/chunk-5kk8gsj2.js +3 -0
- package/dist/chunk-5w1e3yxs.js +499 -0
- package/dist/chunk-6gdycmxr.js +2 -0
- package/dist/chunk-6hmnaza7.js +4473 -0
- package/dist/chunk-71t0yan0.js +5 -0
- package/dist/chunk-74cv4ta1.js +3 -0
- package/dist/chunk-74v15e8z.js +2 -0
- package/dist/chunk-7b329e5v.js +3 -0
- package/dist/chunk-7q9mwh4v.js +84 -0
- package/dist/chunk-866y9d8b.js +8169 -0
- package/dist/chunk-8fwerspy.js +2 -0
- package/dist/chunk-8mjdpr94.js +147 -0
- package/dist/chunk-92mj1t26.js +60 -0
- package/dist/chunk-9b22663r.js +2 -0
- package/dist/chunk-9hjdgm4d.js +2 -0
- package/dist/chunk-9n0gvfrg.js +4 -0
- package/dist/chunk-9wr7zcad.js +18 -0
- package/dist/chunk-9y0g8kzt.js +358 -0
- package/dist/chunk-a0nfbmeh.js +3 -0
- package/dist/chunk-acn1b56m.js +1280 -0
- package/dist/chunk-awkq3xfx.js +2 -0
- package/dist/chunk-b6ej2fdf.js +1814 -0
- package/dist/chunk-b8rrnqry.js +2 -0
- package/dist/chunk-bfqfs07m.js +3022 -0
- package/dist/chunk-bs6kapy7.js +2 -0
- package/dist/chunk-btav940g.js +2 -0
- package/dist/chunk-bz820epz.js +3 -0
- package/dist/chunk-ccspd3mc.js +2 -0
- package/dist/chunk-csbgwaa5.js +2 -0
- package/dist/chunk-d8t4sjsp.js +2 -0
- package/dist/chunk-dap191q2.js +2 -0
- package/dist/chunk-de7fye10.js +4 -0
- package/dist/chunk-dgrt76d2.js +2 -0
- package/dist/chunk-dhh5q7qt.js +3 -0
- package/dist/chunk-dsffsqnt.js +2 -0
- package/dist/chunk-dtq7y5ym.js +2 -0
- package/dist/chunk-fed3xsp9.js +3 -0
- package/dist/chunk-ferav3bw.js +19 -0
- package/dist/chunk-fvhm8psm.js +3 -0
- package/dist/chunk-g4vpzv6b.js +2 -0
- package/dist/chunk-g9csmj0s.js +2 -0
- package/dist/chunk-gtcrpmz1.js +2 -0
- package/dist/chunk-h4xh8cms.js +4 -0
- package/dist/chunk-h8yqsz9m.js +2 -0
- package/dist/chunk-hcq5dw7a.js +2 -0
- package/dist/chunk-hm0xha6c.js +12 -0
- package/dist/chunk-hpybjwwf.js +8 -0
- package/dist/chunk-jegt35zh.js +2 -0
- package/dist/chunk-jr3jp3ev.js +8 -0
- package/dist/chunk-k56rjjc0.js +24 -0
- package/dist/chunk-kdh37tp8.js +194 -0
- package/dist/chunk-kxzb4et3.js +29 -0
- package/dist/chunk-mf4n3x1j.js +14 -0
- package/dist/chunk-mkd9kjgb.js +3 -0
- package/dist/chunk-mxfh1nxg.js +2 -0
- package/dist/chunk-n3ggrhb3.js +3 -0
- package/dist/chunk-nkb3scg6.js +8 -0
- package/dist/chunk-nnd4wq8j.js +231 -0
- package/dist/chunk-nsp1cw38.js +11 -0
- package/dist/chunk-nx5qkm8k.js +30 -0
- package/dist/chunk-p3242nck.js +2 -0
- package/dist/chunk-p98kfh94.js +2 -0
- package/dist/chunk-pkaabd8h.js +3 -0
- package/dist/chunk-pzm13sdc.js +3 -0
- package/dist/chunk-q4p5k2p3.js +2 -0
- package/dist/chunk-q9n5swx7.js +3 -0
- package/dist/chunk-qc1f74ek.js +3 -0
- package/dist/chunk-qpyjak7z.js +2 -0
- package/dist/chunk-qr82je1m.js +22 -0
- package/dist/chunk-qy73j6m4.js +288 -0
- package/dist/chunk-qzkhpsam.js +505 -0
- package/dist/chunk-r3ayvdz3.js +2 -0
- package/dist/chunk-r7r66978.js +2 -0
- package/dist/chunk-rbb7dvja.js +30 -0
- package/dist/chunk-refwkt87.js +71 -0
- package/dist/chunk-rj4kajww.js +2 -0
- package/dist/chunk-rp4rjjmf.js +2 -0
- package/dist/chunk-se0p17c2.js +898 -0
- package/dist/chunk-sj9pmene.js +2 -0
- package/dist/chunk-sscwkffs.js +2 -0
- package/dist/chunk-svpqxn2c.js +2 -0
- package/dist/chunk-t6nseeb9.js +351 -0
- package/dist/chunk-t8y1ggdy.js +2 -0
- package/dist/chunk-tndhnk9e.js +2 -0
- package/dist/chunk-v5e1gxwm.js +3 -0
- package/dist/chunk-vqxmxgaj.js +4 -0
- package/dist/chunk-vrrax298.js +2 -0
- package/dist/chunk-w3ycm4na.js +3 -0
- package/dist/chunk-wcm80anz.js +321 -0
- package/dist/chunk-wrzwgkbx.js +22 -0
- package/dist/chunk-x650vjcp.js +302 -0
- package/dist/chunk-xgnc1wy6.js +116 -0
- package/dist/chunk-xpp135ad.js +11 -0
- package/dist/chunk-xttsqmkm.js +216 -0
- package/dist/chunk-y11cxbxd.js +3757 -0
- package/dist/chunk-y7m2dpd3.js +341 -0
- package/dist/chunk-y98jsjqq.js +2 -0
- package/dist/chunk-ya386h70.js +2 -0
- package/dist/chunk-ydrz60kr.js +2 -0
- package/dist/chunk-ypmqf7tm.js +4 -0
- package/dist/chunk-z4jhj5e5.js +28 -0
- package/dist/chunk-zg75gjns.js +2 -0
- package/dist/chunk-zqqx1qaj.js +2 -0
- package/dist/cli-flags.d.ts +34 -0
- package/dist/cli-flags.js +20 -0
- package/dist/cli.js +174 -0
- package/dist/client/directive.d.ts +17 -0
- package/dist/client/directive.js +14 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +2 -0
- package/dist/client-helpers.d.ts +317 -0
- package/dist/client-helpers.js +312 -0
- package/dist/client-script-bundler.d.ts +103 -0
- package/dist/client-script-bundler.js +390 -0
- package/dist/client-script.d.ts +215 -0
- package/dist/client-script.js +865 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +73 -0
- package/dist/codemod.d.ts +33 -0
- package/dist/codemod.js +244 -0
- package/dist/color-mode-boot.d.ts +92 -0
- package/dist/color-mode-boot.js +72 -0
- package/dist/component-client-factories.d.ts +33 -0
- package/dist/component-client-factories.js +77 -0
- package/dist/component-hmr.d.ts +107 -0
- package/dist/component-hmr.js +585 -0
- package/dist/component-library.d.ts +38 -0
- package/dist/component-library.js +994 -0
- package/dist/component-processing.d.ts +198 -0
- package/dist/component-processing.js +677 -0
- package/dist/component-registry.d.ts +127 -0
- package/dist/component-registry.js +90 -0
- package/dist/component-renderer.d.ts +52 -0
- package/dist/component-renderer.js +790 -0
- package/dist/components/StxImage.stx +12 -0
- package/dist/components/StxLink.stx +18 -0
- package/dist/components.d.ts +28 -0
- package/dist/components.js +213 -0
- package/dist/composable-loader.d.ts +62 -0
- package/dist/composable-loader.js +190 -0
- package/dist/composables/index.d.ts +417 -0
- package/dist/composables/index.js +222 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-battery.js +101 -0
- package/dist/composables/use-broadcast-channel.d.ts +59 -0
- package/dist/composables/use-broadcast-channel.js +80 -0
- package/dist/composables/use-channel.d.ts +67 -0
- package/dist/composables/use-channel.js +124 -0
- package/dist/composables/use-clipboard.d.ts +30 -0
- package/dist/composables/use-clipboard.js +90 -0
- package/dist/composables/use-color-mode.d.ts +67 -0
- package/dist/composables/use-color-mode.js +152 -0
- package/dist/composables/use-cookie.d.ts +59 -0
- package/dist/composables/use-cookie.js +86 -0
- package/dist/composables/use-device-orientation.d.ts +116 -0
- package/dist/composables/use-device-orientation.js +181 -0
- package/dist/composables/use-event-listener.d.ts +35 -0
- package/dist/composables/use-event-listener.js +27 -0
- package/dist/composables/use-event-source.d.ts +90 -0
- package/dist/composables/use-event-source.js +166 -0
- package/dist/composables/use-eye-dropper.d.ts +117 -0
- package/dist/composables/use-eye-dropper.js +142 -0
- package/dist/composables/use-fetch.d.ts +59 -0
- package/dist/composables/use-fetch.js +273 -0
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-fullscreen.js +110 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-geolocation.js +101 -0
- package/dist/composables/use-idle.d.ts +102 -0
- package/dist/composables/use-idle.js +182 -0
- package/dist/composables/use-intersection-observer.d.ts +83 -0
- package/dist/composables/use-intersection-observer.js +168 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-keyboard.js +224 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-media-query.js +62 -0
- package/dist/composables/use-meta.d.ts +35 -0
- package/dist/composables/use-meta.js +48 -0
- package/dist/composables/use-mouse.d.ts +65 -0
- package/dist/composables/use-mouse.js +286 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-mutation-observer.js +129 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-network.js +85 -0
- package/dist/composables/use-notification.d.ts +98 -0
- package/dist/composables/use-notification.js +94 -0
- package/dist/composables/use-permissions.d.ts +119 -0
- package/dist/composables/use-permissions.js +132 -0
- package/dist/composables/use-query.d.ts +48 -0
- package/dist/composables/use-query.js +0 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-resize-observer.js +157 -0
- package/dist/composables/use-router.d.ts +80 -0
- package/dist/composables/use-router.js +105 -0
- package/dist/composables/use-scroll-lock.d.ts +13 -0
- package/dist/composables/use-scroll-lock.js +55 -0
- package/dist/composables/use-share.d.ts +74 -0
- package/dist/composables/use-share.js +104 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-speech.js +294 -0
- package/dist/composables/use-storage.d.ts +69 -0
- package/dist/composables/use-storage.js +196 -0
- package/dist/composables/use-text-selection.d.ts +121 -0
- package/dist/composables/use-text-selection.js +205 -0
- package/dist/composables/use-timer.d.ts +92 -0
- package/dist/composables/use-timer.js +193 -0
- package/dist/composables/use-utilities.d.ts +103 -0
- package/dist/composables/use-utilities.js +176 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-wake-lock.js +122 -0
- package/dist/composables/use-websocket.d.ts +70 -0
- package/dist/composables/use-websocket.js +165 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables/use-window.js +163 -0
- package/dist/composables.d.ts +287 -0
- package/dist/composables.js +562 -0
- package/dist/composition-api.d.ts +197 -0
- package/dist/composition-api.js +199 -0
- package/dist/compression.d.ts +30 -0
- package/dist/compression.js +107 -0
- package/dist/computed.d.ts +138 -0
- package/dist/computed.js +382 -0
- package/dist/conditionals.d.ts +48 -0
- package/dist/conditionals.js +626 -0
- package/dist/config.d.ts +77 -0
- package/dist/config.js +828 -0
- package/dist/cookie-serialize.d.ts +40 -0
- package/dist/cookie-serialize.js +18 -0
- package/dist/craft-bridge.d.ts +525 -0
- package/dist/craft-bridge.js +511 -0
- package/dist/craft-compiler.d.ts +245 -0
- package/dist/craft-compiler.js +810 -0
- package/dist/craft-components.d.ts +739 -0
- package/dist/craft-components.js +1074 -0
- package/dist/craft-entry.d.ts +6 -0
- package/dist/craft-entry.js +9 -0
- package/dist/craft-ssr.d.ts +147 -0
- package/dist/craft-ssr.js +559 -0
- package/dist/craft.js +9 -0
- package/dist/csp.d.ts +295 -0
- package/dist/csp.js +220 -0
- package/dist/csrf.d.ts +38 -0
- package/dist/csrf.js +38 -0
- package/dist/custom-directives.d.ts +5 -0
- package/dist/custom-directives.js +136 -0
- package/dist/database.d.ts +391 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +28 -0
- package/dist/defer.js +156 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/config-generators.js +214 -0
- package/dist/deploy/index.d.ts +88 -0
- package/dist/deploy/index.js +203 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/deploy/netlify.js +167 -0
- package/dist/desktop.d.ts +16 -0
- package/dist/desktop.js +1 -0
- package/dist/dev-server/index.d.ts +22 -0
- package/dist/dev-server/index.js +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/keyboard-shortcuts.js +81 -0
- package/dist/dev-server/native-window.d.ts +59 -0
- package/dist/dev-server/native-window.js +91 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/port-utils.js +40 -0
- package/dist/dev-server/serve-app.d.ts +15 -0
- package/dist/dev-server/serve-app.js +727 -0
- package/dist/dev-server/serve-file.d.ts +3 -0
- package/dist/dev-server/serve-file.js +443 -0
- package/dist/dev-server/serve-markdown.d.ts +3 -0
- package/dist/dev-server/serve-markdown.js +284 -0
- package/dist/dev-server/serve-multi.d.ts +5 -0
- package/dist/dev-server/serve-multi.js +596 -0
- package/dist/dev-server/terminal-colors.d.ts +56 -0
- package/dist/dev-server/terminal-colors.js +45 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/theme-selector.js +111 -0
- package/dist/dev-server/ts-css.d.ts +108 -0
- package/dist/dev-server/ts-css.js +438 -0
- package/dist/dev-server/types.d.ts +99 -0
- package/dist/dev-server/types.js +43 -0
- package/dist/dev-server.d.ts +6 -0
- package/dist/dev-server.js +4 -0
- package/dist/devtools.d.ts +182 -0
- package/dist/devtools.js +593 -0
- package/dist/directive-api.d.ts +154 -0
- package/dist/directive-api.js +355 -0
- package/dist/docs.d.ts +56 -0
- package/dist/docs.js +567 -0
- package/dist/doctor.d.ts +29 -0
- package/dist/doctor.js +123 -0
- package/dist/document-shell.d.ts +218 -0
- package/dist/document-shell.js +338 -0
- package/dist/dynamic-components.d.ts +23 -0
- package/dist/dynamic-components.js +197 -0
- package/dist/edge-runtime.d.ts +193 -0
- package/dist/edge-runtime.js +525 -0
- package/dist/env.d.ts +3 -0
- package/dist/env.js +9 -0
- package/dist/error-boundaries.d.ts +78 -0
- package/dist/error-boundaries.js +281 -0
- package/dist/error-handling.d.ts +14 -0
- package/dist/error-handling.js +1 -0
- package/dist/errors/codes.d.ts +92 -0
- package/dist/errors/codes.js +97 -0
- package/dist/errors/formatter.d.ts +84 -0
- package/dist/errors/formatter.js +196 -0
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.js +44 -0
- package/dist/errors/logger.d.ts +135 -0
- package/dist/errors/logger.js +250 -0
- package/dist/errors/sanitizer.d.ts +73 -0
- package/dist/errors/sanitizer.js +181 -0
- package/dist/errors/types.d.ts +92 -0
- package/dist/errors/types.js +86 -0
- package/dist/events.d.ts +145 -0
- package/dist/events.js +396 -0
- package/dist/expressions.d.ts +180 -0
- package/dist/expressions.js +719 -0
- package/dist/find-body-tag.d.ts +50 -0
- package/dist/find-body-tag.js +57 -0
- package/dist/formatter.d.ts +19 -0
- package/dist/formatter.js +265 -0
- package/dist/forms-validation.d.ts +189 -0
- package/dist/forms-validation.js +421 -0
- package/dist/forms.d.ts +224 -0
- package/dist/forms.js +729 -0
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +123 -0
- package/dist/framework-composables.d.ts +73 -0
- package/dist/framework-composables.js +126 -0
- package/dist/head-injection.d.ts +61 -0
- package/dist/head-injection.js +28 -0
- package/dist/head.d.ts +282 -0
- package/dist/head.js +231 -0
- package/dist/heatmap.d.ts +206 -0
- package/dist/heatmap.js +566 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hot-reload.js +373 -0
- package/dist/html-masking.d.ts +125 -0
- package/dist/html-masking.js +196 -0
- package/dist/hydration-runtime.d.ts +44 -0
- package/dist/hydration-runtime.js +195 -0
- package/dist/hydration.d.ts +135 -0
- package/dist/hydration.js +654 -0
- package/dist/i18n.d.ts +342 -0
- package/dist/i18n.js +678 -0
- package/dist/image-optimization/auto-sibling.d.ts +42 -0
- package/dist/image-optimization/auto-sibling.js +88 -0
- package/dist/image-optimization/build-plugin.d.ts +54 -0
- package/dist/image-optimization/build-plugin.js +241 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/component.js +244 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/directive.js +203 -0
- package/dist/image-optimization/index.d.ts +156 -0
- package/dist/image-optimization/index.js +54 -0
- package/dist/image-optimization/processor.d.ts +140 -0
- package/dist/image-optimization/processor.js +262 -0
- package/dist/image-optimization/serve.d.ts +54 -0
- package/dist/image-optimization/serve.js +102 -0
- package/dist/import-rebase.d.ts +16 -0
- package/dist/import-rebase.js +16 -0
- package/dist/imported-signals.d.ts +43 -0
- package/dist/imported-signals.js +35 -0
- package/dist/includes.d.ts +171 -0
- package/dist/includes.js +764 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +202 -0
- package/dist/init.d.ts +39 -0
- package/dist/init.js +505 -0
- package/dist/inline-assets.d.ts +28 -0
- package/dist/inline-assets.js +82 -0
- package/dist/interactive.d.ts +14 -0
- package/dist/interactive.js +383 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/internal-markdown.js +141 -0
- package/dist/island-chunking.d.ts +48 -0
- package/dist/island-chunking.js +52 -0
- package/dist/isolated-build.d.ts +12 -0
- package/dist/isolated-build.js +18 -0
- package/dist/js-ts.d.ts +10 -0
- package/dist/js-ts.js +60 -0
- package/dist/jsx-runtime.d.ts +92 -0
- package/dist/jsx-runtime.js +289 -0
- package/dist/keep-alive.d.ts +108 -0
- package/dist/keep-alive.js +421 -0
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-loader.d.ts +90 -0
- package/dist/lazy-loader.js +245 -0
- package/dist/lazy-module.d.ts +11 -0
- package/dist/lazy-module.js +18 -0
- package/dist/loading-indicator.d.ts +50 -0
- package/dist/loading-indicator.js +322 -0
- package/dist/loops.d.ts +91 -0
- package/dist/loops.js +690 -0
- package/dist/manifest.d.ts +41 -0
- package/dist/manifest.js +31 -0
- package/dist/markdown-view.d.ts +25 -0
- package/dist/markdown-view.js +39 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.js +68 -0
- package/dist/media/client/blur-up.d.ts +66 -0
- package/dist/media/client/blur-up.js +217 -0
- package/dist/media/client/index.d.ts +93 -0
- package/dist/media/client/index.js +53 -0
- package/dist/media/client/lazy-load.d.ts +74 -0
- package/dist/media/client/lazy-load.js +283 -0
- package/dist/media/client/upload-handler.d.ts +80 -0
- package/dist/media/client/upload-handler.js +354 -0
- package/dist/media/image/component.d.ts +60 -0
- package/dist/media/image/component.js +574 -0
- package/dist/media/image/directive.d.ts +23 -0
- package/dist/media/image/directive.js +160 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/editing.js +193 -0
- package/dist/media/image/index.d.ts +142 -0
- package/dist/media/image/index.js +80 -0
- package/dist/media/image/placeholder.d.ts +89 -0
- package/dist/media/image/placeholder.js +188 -0
- package/dist/media/image/processor/cache.d.ts +53 -0
- package/dist/media/image/processor/cache.js +51 -0
- package/dist/media/image/processor/index.d.ts +11 -0
- package/dist/media/image/processor/index.js +3 -0
- package/dist/media/image/processor/optimizer.d.ts +24 -0
- package/dist/media/image/processor/optimizer.js +202 -0
- package/dist/media/image/processor/responsive.d.ts +28 -0
- package/dist/media/image/processor/responsive.js +162 -0
- package/dist/media/image/srcset.d.ts +157 -0
- package/dist/media/image/srcset.js +194 -0
- package/dist/media/index.d.ts +331 -0
- package/dist/media/index.js +198 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/manager/embed.js +253 -0
- package/dist/media/protected/component.d.ts +33 -0
- package/dist/media/protected/component.js +235 -0
- package/dist/media/protected/index.d.ts +47 -0
- package/dist/media/protected/index.js +20 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/protected/signature.js +205 -0
- package/dist/media/shared/cache.d.ts +76 -0
- package/dist/media/shared/cache.js +132 -0
- package/dist/media/shared/hash.d.ts +31 -0
- package/dist/media/shared/hash.js +35 -0
- package/dist/media/shared/index.d.ts +7 -0
- package/dist/media/shared/index.js +2 -0
- package/dist/media/types.d.ts +1477 -0
- package/dist/media/types.js +0 -0
- package/dist/media/upload/component.d.ts +9 -0
- package/dist/media/upload/component.js +320 -0
- package/dist/media/upload/index.d.ts +8 -0
- package/dist/media/upload/index.js +1 -0
- package/dist/media/video/directive.d.ts +23 -0
- package/dist/media/video/directive.js +142 -0
- package/dist/media/video/index.d.ts +76 -0
- package/dist/media/video/index.js +583 -0
- package/dist/media/video/processor/cache.d.ts +55 -0
- package/dist/media/video/processor/cache.js +52 -0
- package/dist/media/video/processor/index.d.ts +12 -0
- package/dist/media/video/processor/index.js +4 -0
- package/dist/media/video/processor/streaming.d.ts +26 -0
- package/dist/media/video/processor/streaming.js +197 -0
- package/dist/media/video/processor/thumbnail.d.ts +35 -0
- package/dist/media/video/processor/thumbnail.js +134 -0
- package/dist/media/video/processor/transcoder.d.ts +19 -0
- package/dist/media/video/processor/transcoder.js +283 -0
- package/dist/menubar.d.ts +65 -0
- package/dist/menubar.js +99 -0
- package/dist/method-spoofing.d.ts +20 -0
- package/dist/method-spoofing.js +17 -0
- package/dist/middleware.d.ts +112 -0
- package/dist/middleware.js +40 -0
- package/dist/misc-directives.d.ts +55 -0
- package/dist/misc-directives.js +328 -0
- package/dist/native-build.d.ts +88 -0
- package/dist/native-build.js +575 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-action.d.ts +73 -0
- package/dist/page-action.js +91 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/page-response.d.ts +120 -0
- package/dist/page-response.js +117 -0
- package/dist/parser/directive-parser.d.ts +119 -0
- package/dist/parser/directive-parser.js +249 -0
- package/dist/parser/expression-parser.d.ts +58 -0
- package/dist/parser/expression-parser.js +358 -0
- package/dist/parser/index.d.ts +13 -0
- package/dist/parser/index.js +23 -0
- package/dist/parser/tokenizer.d.ts +77 -0
- package/dist/parser/tokenizer.js +534 -0
- package/dist/partial-hydration.d.ts +123 -0
- package/dist/partial-hydration.js +427 -0
- package/dist/performance-utils.d.ts +318 -0
- package/dist/performance-utils.js +466 -0
- package/dist/placeholder.d.ts +54 -0
- package/dist/placeholder.js +35 -0
- package/dist/plugin-system.d.ts +301 -0
- package/dist/plugin-system.js +214 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.js +174 -0
- package/dist/precompiler.d.ts +43 -0
- package/dist/precompiler.js +670 -0
- package/dist/process.d.ts +16 -0
- package/dist/process.js +879 -0
- package/dist/production-build.d.ts +163 -0
- package/dist/production-build.js +596 -0
- package/dist/production-builder.d.ts +42 -0
- package/dist/production-builder.js +146 -0
- package/dist/production-server.d.ts +19 -0
- package/dist/production-server.js +208 -0
- package/dist/prop-sentinels.d.ts +31 -0
- package/dist/prop-sentinels.js +7 -0
- package/dist/props.d.ts +216 -0
- package/dist/props.js +224 -0
- package/dist/public-env.d.ts +29 -0
- package/dist/public-env.js +19 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/audit.js +255 -0
- package/dist/pwa/directives.d.ts +38 -0
- package/dist/pwa/directives.js +332 -0
- package/dist/pwa/icons.d.ts +42 -0
- package/dist/pwa/icons.js +109 -0
- package/dist/pwa/index.d.ts +104 -0
- package/dist/pwa/index.js +47 -0
- package/dist/pwa/inject.d.ts +32 -0
- package/dist/pwa/inject.js +102 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/manifest.js +186 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/offline.js +259 -0
- package/dist/pwa/precache.d.ts +35 -0
- package/dist/pwa/precache.js +116 -0
- package/dist/pwa/service-worker.d.ts +33 -0
- package/dist/pwa/service-worker.js +860 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox-strategies.js +167 -0
- package/dist/pwa/workbox.d.ts +51 -0
- package/dist/pwa/workbox.js +382 -0
- package/dist/pwa.d.ts +52 -0
- package/dist/pwa.js +236 -0
- package/dist/reactive-bindings.d.ts +47 -0
- package/dist/reactive-bindings.js +268 -0
- package/dist/reactive-tracking.d.ts +81 -0
- package/dist/reactive-tracking.js +49 -0
- package/dist/reactive.d.ts +117 -0
- package/dist/reactive.js +593 -0
- package/dist/reactivity.d.ts +206 -0
- package/dist/reactivity.js +574 -0
- package/dist/release.d.ts +1 -0
- package/dist/release.js +1 -0
- package/dist/render-memo.d.ts +40 -0
- package/dist/render-memo.js +33 -0
- package/dist/render.d.ts +54 -0
- package/dist/render.js +153 -0
- package/dist/resolve-stx-targets.d.ts +49 -0
- package/dist/resolve-stx-targets.js +38 -0
- package/dist/route-middleware.d.ts +2 -0
- package/dist/route-middleware.js +17 -0
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +9 -0
- package/dist/router.js +9 -0
- package/dist/routes.d.ts +6 -0
- package/dist/routes.js +14 -0
- package/dist/runtime-globals.d.ts +236 -0
- package/dist/runtime-globals.js +230 -0
- package/dist/runtime-injection.d.ts +113 -0
- package/dist/runtime-injection.js +156 -0
- package/dist/runtime.d.ts +140 -0
- package/dist/runtime.js +94 -0
- package/dist/safe-evaluator.d.ts +165 -0
- package/dist/safe-evaluator.js +461 -0
- package/dist/scaffolding.d.ts +113 -0
- package/dist/scaffolding.js +897 -0
- package/dist/screenshot.d.ts +22 -0
- package/dist/screenshot.js +100 -0
- package/dist/script-classifier.d.ts +41 -0
- package/dist/script-classifier.js +51 -0
- package/dist/script-emit.d.ts +50 -0
- package/dist/script-emit.js +11 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +26 -0
- package/dist/script-validation.js +179 -0
- package/dist/seo.d.ts +225 -0
- package/dist/seo.js +486 -0
- package/dist/serve.d.ts +44 -0
- package/dist/serve.js +233 -0
- package/dist/server-bindings.d.ts +39 -0
- package/dist/server-bindings.js +171 -0
- package/dist/server-components.d.ts +138 -0
- package/dist/server-components.js +427 -0
- package/dist/sfc-template.d.ts +17 -0
- package/dist/sfc-template.js +32 -0
- package/dist/signal-processing.d.ts +222 -0
- package/dist/signal-processing.js +1081 -0
- package/dist/signals-api.d.ts +459 -0
- package/dist/signals-api.js +172 -0
- package/dist/signals.d.ts +41 -0
- package/dist/signals.js +8233 -0
- package/dist/site-builder/build.d.ts +18 -0
- package/dist/site-builder/build.js +252 -0
- package/dist/site-builder/i18n.d.ts +104 -0
- package/dist/site-builder/i18n.js +150 -0
- package/dist/site-builder/index.d.ts +27 -0
- package/dist/site-builder/index.js +16 -0
- package/dist/site-builder/robots.d.ts +2 -0
- package/dist/site-builder/robots.js +26 -0
- package/dist/site-builder/router.d.ts +10 -0
- package/dist/site-builder/router.js +27 -0
- package/dist/site-builder/seo.d.ts +8 -0
- package/dist/site-builder/seo.js +67 -0
- package/dist/site-builder/sitemap.d.ts +10 -0
- package/dist/site-builder/sitemap.js +26 -0
- package/dist/site-builder/theme.d.ts +12 -0
- package/dist/site-builder/theme.js +38 -0
- package/dist/site-builder/types.d.ts +74 -0
- package/dist/site-builder/types.js +0 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +129 -0
- package/dist/slots.js +286 -0
- package/dist/source-maps.d.ts +98 -0
- package/dist/source-maps.js +350 -0
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/spa-nav.d.ts +49 -0
- package/dist/spa-nav.js +12 -0
- package/dist/spa-shell.d.ts +21 -0
- package/dist/spa-shell.js +34 -0
- package/dist/ssg.d.ts +357 -0
- package/dist/ssg.js +94 -0
- package/dist/ssr.d.ts +116 -0
- package/dist/ssr.js +339 -0
- package/dist/state-dir.d.ts +36 -0
- package/dist/state-dir.js +22 -0
- package/dist/state-management.d.ts +299 -0
- package/dist/state-management.js +519 -0
- package/dist/store-imports.d.ts +47 -0
- package/dist/store-imports.js +16 -0
- package/dist/store-loader.d.ts +15 -0
- package/dist/store-loader.js +111 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/stores-client.js +132 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/addons.js +261 -0
- package/dist/story/analytics.d.ts +163 -0
- package/dist/story/analytics.js +235 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/auto-stories.js +158 -0
- package/dist/story/bookmarks.d.ts +102 -0
- package/dist/story/bookmarks.js +277 -0
- package/dist/story/bun-test.d.ts +45 -0
- package/dist/story/bun-test.js +102 -0
- package/dist/story/cli.d.ts +132 -0
- package/dist/story/cli.js +155 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/analyzer.js +305 -0
- package/dist/story/collect/index.d.ts +31 -0
- package/dist/story/collect/index.js +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/parser.js +129 -0
- package/dist/story/collect/scanner.d.ts +17 -0
- package/dist/story/collect/scanner.js +101 -0
- package/dist/story/collect/tree.d.ts +24 -0
- package/dist/story/collect/tree.js +110 -0
- package/dist/story/commands/build.d.ts +19 -0
- package/dist/story/commands/build.js +172 -0
- package/dist/story/commands/dev.d.ts +23 -0
- package/dist/story/commands/dev.js +78 -0
- package/dist/story/commands/index.d.ts +9 -0
- package/dist/story/commands/index.js +3 -0
- package/dist/story/commands/preview.d.ts +21 -0
- package/dist/story/commands/preview.js +56 -0
- package/dist/story/compiled-output.d.ts +27 -0
- package/dist/story/compiled-output.js +151 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/composition.js +261 -0
- package/dist/story/config-watcher.d.ts +33 -0
- package/dist/story/config-watcher.js +67 -0
- package/dist/story/config.d.ts +29 -0
- package/dist/story/config.js +64 -0
- package/dist/story/context.d.ts +27 -0
- package/dist/story/context.js +27 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/controls/index.js +320 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/desktop-preview.js +105 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/docs-generator.js +187 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/errors.js +239 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/figma-export.js +224 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/generator.js +165 -0
- package/dist/story/hmr.d.ts +62 -0
- package/dist/story/hmr.js +131 -0
- package/dist/story/hot-swap.d.ts +46 -0
- package/dist/story/hot-swap.js +207 -0
- package/dist/story/index.d.ts +99 -0
- package/dist/story/index.js +49 -0
- package/dist/story/interactions.d.ts +53 -0
- package/dist/story/interactions.js +225 -0
- package/dist/story/keyboard-shortcuts.d.ts +39 -0
- package/dist/story/keyboard-shortcuts.js +345 -0
- package/dist/story/output.d.ts +115 -0
- package/dist/story/output.js +153 -0
- package/dist/story/performance.d.ts +129 -0
- package/dist/story/performance.js +252 -0
- package/dist/story/presets.d.ts +123 -0
- package/dist/story/presets.js +289 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/props-validation.js +215 -0
- package/dist/story/renderer.d.ts +69 -0
- package/dist/story/renderer.js +209 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search-index.js +106 -0
- package/dist/story/search.d.ts +56 -0
- package/dist/story/search.js +140 -0
- package/dist/story/server.d.ts +31 -0
- package/dist/story/server.js +965 -0
- package/dist/story/setup.d.ts +56 -0
- package/dist/story/setup.js +78 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/snapshots.js +171 -0
- package/dist/story/testing.d.ts +83 -0
- package/dist/story/testing.js +164 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/theme.js +170 -0
- package/dist/story/ts-css.d.ts +29 -0
- package/dist/story/ts-css.js +189 -0
- package/dist/story/types.d.ts +342 -0
- package/dist/story/types.js +0 -0
- package/dist/story/ui/code-panel.d.ts +43 -0
- package/dist/story/ui/code-panel.js +175 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/controls-panel.js +168 -0
- package/dist/story/ui/index.d.ts +8 -0
- package/dist/story/ui/index.js +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/navigation.js +250 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/ui/preview.js +251 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/story/visual-testing.js +248 -0
- package/dist/streaming.d.ts +238 -0
- package/dist/streaming.js +537 -0
- package/dist/strict-lint.d.ts +52 -0
- package/dist/strict-lint.js +269 -0
- package/dist/strip-literals.d.ts +40 -0
- package/dist/strip-literals.js +149 -0
- package/dist/stx-virtual-ts.d.ts +358 -0
- package/dist/stx-virtual-ts.js +670 -0
- package/dist/stx.d.ts +924 -0
- package/dist/style-scoping.d.ts +42 -0
- package/dist/style-scoping.js +82 -0
- package/dist/suspense.d.ts +98 -0
- package/dist/suspense.js +398 -0
- package/dist/teleport.d.ts +31 -0
- package/dist/teleport.js +109 -0
- package/dist/template-compiler.d.ts +33 -0
- package/dist/template-compiler.js +68 -0
- package/dist/template-hydrator.d.ts +28 -0
- package/dist/template-hydrator.js +95 -0
- package/dist/template-tag-balance.d.ts +32 -0
- package/dist/template-tag-balance.js +93 -0
- package/dist/testing.d.ts +330 -0
- package/dist/testing.js +588 -0
- package/dist/theme-tokens.d.ts +88 -0
- package/dist/theme-tokens.js +71 -0
- package/dist/transitions.d.ts +99 -0
- package/dist/transitions.js +443 -0
- package/dist/ts-css-config.d.ts +71 -0
- package/dist/ts-css-config.js +44 -0
- package/dist/type-checker.d.ts +85 -0
- package/dist/type-checker.js +581 -0
- package/dist/typecheck.d.ts +70 -0
- package/dist/typecheck.js +365 -0
- package/dist/types/component-types.d.ts +248 -0
- package/dist/types/component-types.js +0 -0
- package/dist/types/config-types.d.ts +938 -0
- package/dist/types/config-types.js +0 -0
- package/dist/types/context-types.d.ts +122 -0
- package/dist/types/context-types.js +0 -0
- package/dist/types/csp-types.d.ts +83 -0
- package/dist/types/csp-types.js +0 -0
- package/dist/types/directive-types.d.ts +315 -0
- package/dist/types/directive-types.js +3 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pwa-types.d.ts +338 -0
- package/dist/types/pwa-types.js +0 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +1 -0
- package/dist/typescript-templates.d.ts +156 -0
- package/dist/typescript-templates.js +386 -0
- package/dist/unresolved-identifiers.d.ts +52 -0
- package/dist/unresolved-identifiers.js +148 -0
- package/dist/utils.d.ts +112 -0
- package/dist/utils.js +1170 -0
- package/dist/validator.d.ts +80 -0
- package/dist/validator.js +171 -0
- package/dist/variable-extractor.d.ts +142 -0
- package/dist/variable-extractor.js +1306 -0
- package/dist/view-composers.d.ts +171 -0
- package/dist/view-composers.js +29 -0
- package/dist/virtual-scrolling.d.ts +127 -0
- package/dist/virtual-scrolling.js +454 -0
- package/dist/visual-editor.d.ts +185 -0
- package/dist/visual-editor.js +735 -0
- package/dist/visual-testing.d.ts +135 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +39 -0
- package/dist/vue-template.js +476 -0
- package/dist/web-components/css-scoping.d.ts +64 -0
- package/dist/web-components/css-scoping.js +210 -0
- package/dist/web-components/index.d.ts +29 -0
- package/dist/web-components/index.js +13 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components/reactive-generator.js +484 -0
- package/dist/web-components.d.ts +253 -0
- package/dist/web-components.js +1466 -0
- package/dist/x-element.d.ts +42 -0
- package/dist/x-element.js +301 -0
- package/package.json +107 -0
- package/stx.d.ts +924 -0
package/dist/ssr.js
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { errorLogger } from "./error-handling.js";
|
|
4
|
+
import { processDirectives } from "./process.js";
|
|
5
|
+
import { extractVariables } from "./utils.js";
|
|
6
|
+
import { patternToRegex } from "stx-router";
|
|
7
|
+
import { serializeSetCookie } from "./cookie-serialize.js";
|
|
8
|
+
|
|
9
|
+
export class MemorySessionStore {
|
|
10
|
+
store = new Map;
|
|
11
|
+
async get(sessionId) {
|
|
12
|
+
const entry = this.store.get(sessionId);
|
|
13
|
+
if (!entry || entry.expires <= Date.now()) {
|
|
14
|
+
if (entry)
|
|
15
|
+
this.store.delete(sessionId);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return { ...entry.data };
|
|
19
|
+
}
|
|
20
|
+
async set(sessionId, data, ttlSeconds) {
|
|
21
|
+
this.store.set(sessionId, { data: { ...data }, expires: Date.now() + ttlSeconds * 1000 });
|
|
22
|
+
}
|
|
23
|
+
async delete(sessionId) {
|
|
24
|
+
this.store.delete(sessionId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function createSession(sessionId, ttl, store) {
|
|
28
|
+
const sessionData = {}, flashData = {}, existing = await store.get(sessionId);
|
|
29
|
+
if (existing)
|
|
30
|
+
Object.assign(sessionData, existing);
|
|
31
|
+
const session = {
|
|
32
|
+
id: sessionId,
|
|
33
|
+
data: sessionData,
|
|
34
|
+
get(key) {
|
|
35
|
+
return sessionData[key];
|
|
36
|
+
},
|
|
37
|
+
set(key, value) {
|
|
38
|
+
sessionData[key] = value;
|
|
39
|
+
saveSession();
|
|
40
|
+
},
|
|
41
|
+
delete(key) {
|
|
42
|
+
delete sessionData[key];
|
|
43
|
+
saveSession();
|
|
44
|
+
},
|
|
45
|
+
clear() {
|
|
46
|
+
Object.keys(sessionData).forEach((key) => delete sessionData[key]);
|
|
47
|
+
saveSession();
|
|
48
|
+
},
|
|
49
|
+
has(key) {
|
|
50
|
+
return key in sessionData;
|
|
51
|
+
},
|
|
52
|
+
flash(key, value) {
|
|
53
|
+
if (value !== void 0) {
|
|
54
|
+
flashData[key] = value;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const val = flashData[key];
|
|
58
|
+
delete flashData[key];
|
|
59
|
+
return val;
|
|
60
|
+
},
|
|
61
|
+
regenerate() {
|
|
62
|
+
const oldId = sessionId;
|
|
63
|
+
sessionId = generateSessionId();
|
|
64
|
+
session.id = sessionId;
|
|
65
|
+
store.delete(oldId);
|
|
66
|
+
saveSession();
|
|
67
|
+
},
|
|
68
|
+
destroy() {
|
|
69
|
+
store.delete(sessionId);
|
|
70
|
+
Object.keys(sessionData).forEach((key) => delete sessionData[key]);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function saveSession() {
|
|
74
|
+
store.set(sessionId, { ...sessionData, __flash: flashData }, ttl);
|
|
75
|
+
}
|
|
76
|
+
saveSession();
|
|
77
|
+
return session;
|
|
78
|
+
}
|
|
79
|
+
function generateSessionId() {
|
|
80
|
+
return crypto.randomBytes(32).toString("hex");
|
|
81
|
+
}
|
|
82
|
+
function parseCookies(cookieHeader) {
|
|
83
|
+
if (!cookieHeader)
|
|
84
|
+
return {};
|
|
85
|
+
return cookieHeader.split(";").reduce((cookies, cookie) => {
|
|
86
|
+
const [name, ...valueParts] = cookie.trim().split("=");
|
|
87
|
+
if (name)
|
|
88
|
+
cookies[name] = decodeURIComponent(valueParts.join("="));
|
|
89
|
+
return cookies;
|
|
90
|
+
}, {});
|
|
91
|
+
}
|
|
92
|
+
function serializeCookie(name, value, options = {}) {
|
|
93
|
+
return serializeSetCookie(name, value, options);
|
|
94
|
+
}
|
|
95
|
+
function copyContextHeaders(from, into) {
|
|
96
|
+
for (const cookie of from.getSetCookie())
|
|
97
|
+
into.append("Set-Cookie", cookie);
|
|
98
|
+
from.forEach((value, key) => {
|
|
99
|
+
if (key.toLowerCase() !== "set-cookie")
|
|
100
|
+
into.set(key, value);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function generateCsrfToken() {
|
|
104
|
+
return crypto.randomBytes(32).toString("hex");
|
|
105
|
+
}
|
|
106
|
+
function verifyCsrfToken(token, sessionToken) {
|
|
107
|
+
if (!token || !sessionToken)
|
|
108
|
+
return !1;
|
|
109
|
+
try {
|
|
110
|
+
return crypto.timingSafeEqual(Buffer.from(token), Buffer.from(sessionToken));
|
|
111
|
+
} catch {
|
|
112
|
+
return !1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export async function render(template, data = {}, options = {}) {
|
|
116
|
+
const viewsDir = options.viewsDir || "./views", layoutsDir = options.layoutsDir || "./layouts", isPath = !template.includes("<") && !template.includes("@");
|
|
117
|
+
let templateContent, templatePath;
|
|
118
|
+
if (isPath) {
|
|
119
|
+
templatePath = path.resolve(viewsDir, template);
|
|
120
|
+
if (!templatePath.endsWith(".stx"))
|
|
121
|
+
templatePath += ".stx";
|
|
122
|
+
if (!await Bun.file(templatePath).exists())
|
|
123
|
+
return new Response(`Template not found: ${template}`, { status: 500 });
|
|
124
|
+
templateContent = await Bun.file(templatePath).text();
|
|
125
|
+
} else {
|
|
126
|
+
templateContent = template;
|
|
127
|
+
templatePath = "inline-template.stx";
|
|
128
|
+
}
|
|
129
|
+
const context = {
|
|
130
|
+
...data,
|
|
131
|
+
props: data,
|
|
132
|
+
__filename: templatePath,
|
|
133
|
+
__dirname: path.dirname(templatePath)
|
|
134
|
+
};
|
|
135
|
+
if (options.ctx) {
|
|
136
|
+
context.csrf_token = options.ctx.csrfToken;
|
|
137
|
+
context.csrf_field = `<input type="hidden" name="_token" value="${options.ctx.csrfToken}">`;
|
|
138
|
+
context.old = options.ctx.old;
|
|
139
|
+
context.errors = options.ctx.errors;
|
|
140
|
+
context.session = options.ctx.session;
|
|
141
|
+
context.user = options.ctx.user();
|
|
142
|
+
context.isAuthenticated = options.ctx.isAuthenticated();
|
|
143
|
+
}
|
|
144
|
+
const serverScriptMatch = templateContent.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);
|
|
145
|
+
if (serverScriptMatch) {
|
|
146
|
+
const serverScript = serverScriptMatch[1];
|
|
147
|
+
templateContent = templateContent.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>/gi, "");
|
|
148
|
+
await extractVariables(serverScript, context, templatePath);
|
|
149
|
+
}
|
|
150
|
+
const stxOptions = {
|
|
151
|
+
layoutsDir,
|
|
152
|
+
...options.stxOptions
|
|
153
|
+
}, html = await processDirectives(templateContent, context, templatePath, stxOptions, new Set), headers = new Headers({
|
|
154
|
+
"Content-Type": "text/html; charset=utf-8"
|
|
155
|
+
});
|
|
156
|
+
if (options.ctx)
|
|
157
|
+
copyContextHeaders(options.ctx.responseHeaders, headers);
|
|
158
|
+
return new Response(html, { headers });
|
|
159
|
+
}
|
|
160
|
+
export function createApp(config = {}) {
|
|
161
|
+
const {
|
|
162
|
+
viewsDir = "./views",
|
|
163
|
+
layoutsDir = "./layouts",
|
|
164
|
+
defaultLayout,
|
|
165
|
+
sessionSecret = crypto.randomBytes(32).toString("hex"),
|
|
166
|
+
sessionCookieName = "stx_session",
|
|
167
|
+
sessionTtl = 86400,
|
|
168
|
+
stxOptions = {},
|
|
169
|
+
csrfCookieName = "csrf_token",
|
|
170
|
+
csrfEnabled = !0
|
|
171
|
+
} = config, store = config.sessionStore ?? new MemorySessionStore, routes = [], globalMiddleware = [];
|
|
172
|
+
function matchRoute(method, pathname) {
|
|
173
|
+
for (const route of routes) {
|
|
174
|
+
if (route.method !== method && route.method !== "*")
|
|
175
|
+
continue;
|
|
176
|
+
const { regex, params: paramNames } = patternToRegex(route.pattern), match = pathname.match(regex);
|
|
177
|
+
if (match) {
|
|
178
|
+
const params = {};
|
|
179
|
+
paramNames.forEach((name, i) => {
|
|
180
|
+
params[name] = match[i + 1];
|
|
181
|
+
});
|
|
182
|
+
return { route, params };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
async function createContext(request, params) {
|
|
188
|
+
const url = new URL(request.url), cookies = parseCookies(request.headers.get("Cookie")), responseHeaders = new Headers;
|
|
189
|
+
let sessionId = cookies[sessionCookieName];
|
|
190
|
+
if (!sessionId) {
|
|
191
|
+
sessionId = generateSessionId();
|
|
192
|
+
responseHeaders.append("Set-Cookie", serializeCookie(sessionCookieName, sessionId, {
|
|
193
|
+
httpOnly: !0,
|
|
194
|
+
secure: url.protocol === "https:",
|
|
195
|
+
sameSite: "Lax",
|
|
196
|
+
path: "/",
|
|
197
|
+
maxAge: sessionTtl
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
const session = await createSession(sessionId, sessionTtl, store);
|
|
201
|
+
let csrfToken = session.get("_csrf");
|
|
202
|
+
if (!csrfToken) {
|
|
203
|
+
csrfToken = generateCsrfToken();
|
|
204
|
+
session.set("_csrf", csrfToken);
|
|
205
|
+
}
|
|
206
|
+
const query = {};
|
|
207
|
+
url.searchParams.forEach((value, key) => {
|
|
208
|
+
query[key] = value;
|
|
209
|
+
});
|
|
210
|
+
const errors = session.flash("_errors") || {}, oldInput = session.flash("_old_input") || {};
|
|
211
|
+
return {
|
|
212
|
+
request,
|
|
213
|
+
url,
|
|
214
|
+
params,
|
|
215
|
+
query,
|
|
216
|
+
session,
|
|
217
|
+
csrfToken,
|
|
218
|
+
cookies,
|
|
219
|
+
responseHeaders,
|
|
220
|
+
errors,
|
|
221
|
+
async formData() {
|
|
222
|
+
const formData = await request.formData(), data = {};
|
|
223
|
+
formData.forEach((value, key) => {
|
|
224
|
+
data[key] = value;
|
|
225
|
+
});
|
|
226
|
+
return data;
|
|
227
|
+
},
|
|
228
|
+
async json() {
|
|
229
|
+
return await request.json();
|
|
230
|
+
},
|
|
231
|
+
setCookie(name, value, options = {}) {
|
|
232
|
+
responseHeaders.append("Set-Cookie", serializeCookie(name, value, options));
|
|
233
|
+
},
|
|
234
|
+
flash(key, value) {
|
|
235
|
+
session.flash(key, value);
|
|
236
|
+
},
|
|
237
|
+
getFlash(key) {
|
|
238
|
+
return session.flash(key);
|
|
239
|
+
},
|
|
240
|
+
old(key) {
|
|
241
|
+
return oldInput[key] || "";
|
|
242
|
+
},
|
|
243
|
+
isAuthenticated() {
|
|
244
|
+
return session.has("user");
|
|
245
|
+
},
|
|
246
|
+
user() {
|
|
247
|
+
return session.get("user");
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
const csrfMiddleware = async (ctx, next) => {
|
|
252
|
+
if (["GET", "HEAD", "OPTIONS"].includes(ctx.request.method))
|
|
253
|
+
return next();
|
|
254
|
+
if (!csrfEnabled)
|
|
255
|
+
return next();
|
|
256
|
+
const tokenFromForm = (await ctx.request.clone().formData().catch(() => new FormData)).get("_token"), tokenFromHeader = ctx.request.headers.get("X-CSRF-Token"), token = tokenFromForm || tokenFromHeader, sessionToken = ctx.session.get("_csrf");
|
|
257
|
+
if (!token || !sessionToken || !verifyCsrfToken(token, sessionToken))
|
|
258
|
+
return new Response("CSRF token mismatch", { status: 419 });
|
|
259
|
+
return next();
|
|
260
|
+
};
|
|
261
|
+
async function fetch(request) {
|
|
262
|
+
const url = new URL(request.url), method = request.method, match = matchRoute(method, url.pathname);
|
|
263
|
+
if (!match)
|
|
264
|
+
return new Response("Not Found", { status: 404 });
|
|
265
|
+
const ctx = await createContext(request, match.params), middleware = [...globalMiddleware, csrfMiddleware, ...match.route.middleware];
|
|
266
|
+
let index = 0;
|
|
267
|
+
const next = async () => {
|
|
268
|
+
if (index < middleware.length) {
|
|
269
|
+
const mw = middleware[index++];
|
|
270
|
+
return mw(ctx, next);
|
|
271
|
+
}
|
|
272
|
+
return match.route.handler(ctx);
|
|
273
|
+
};
|
|
274
|
+
try {
|
|
275
|
+
const response = await next();
|
|
276
|
+
copyContextHeaders(ctx.responseHeaders, response.headers);
|
|
277
|
+
return response;
|
|
278
|
+
} catch (error) {
|
|
279
|
+
errorLogger.log(error instanceof Error ? error : Error(String(error)), { handler: "request" }, "error");
|
|
280
|
+
return new Response("Internal Server Error", { status: 500 });
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function addRoute(method, pattern, handler, middleware = []) {
|
|
284
|
+
routes.push({ method, pattern, handler, middleware });
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
fetch,
|
|
288
|
+
get(pattern, handler, middleware = []) {
|
|
289
|
+
addRoute("GET", pattern, handler, middleware);
|
|
290
|
+
return this;
|
|
291
|
+
},
|
|
292
|
+
post(pattern, handler, middleware = []) {
|
|
293
|
+
addRoute("POST", pattern, handler, middleware);
|
|
294
|
+
return this;
|
|
295
|
+
},
|
|
296
|
+
put(pattern, handler, middleware = []) {
|
|
297
|
+
addRoute("PUT", pattern, handler, middleware);
|
|
298
|
+
return this;
|
|
299
|
+
},
|
|
300
|
+
delete(pattern, handler, middleware = []) {
|
|
301
|
+
addRoute("DELETE", pattern, handler, middleware);
|
|
302
|
+
return this;
|
|
303
|
+
},
|
|
304
|
+
patch(pattern, handler, middleware = []) {
|
|
305
|
+
addRoute("PATCH", pattern, handler, middleware);
|
|
306
|
+
return this;
|
|
307
|
+
},
|
|
308
|
+
use(middleware) {
|
|
309
|
+
globalMiddleware.push(middleware);
|
|
310
|
+
return this;
|
|
311
|
+
},
|
|
312
|
+
async render(template, data = {}, ctx) {
|
|
313
|
+
return render(template, data, { viewsDir, layoutsDir, stxOptions, ctx });
|
|
314
|
+
},
|
|
315
|
+
redirect(url, status = 302) {
|
|
316
|
+
return new Response(null, {
|
|
317
|
+
status,
|
|
318
|
+
headers: { Location: url }
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
back(ctx, errors, oldInput) {
|
|
322
|
+
if (errors)
|
|
323
|
+
ctx.session.flash("_errors", errors);
|
|
324
|
+
if (oldInput)
|
|
325
|
+
ctx.session.flash("_old_input", oldInput);
|
|
326
|
+
const referer = ctx.request.headers.get("Referer") || "/";
|
|
327
|
+
return new Response(null, {
|
|
328
|
+
status: 302,
|
|
329
|
+
headers: { Location: referer }
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
listen(port = 3000) {
|
|
333
|
+
return Bun.serve({
|
|
334
|
+
port,
|
|
335
|
+
fetch
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** The directory used when nothing configures one. */
|
|
2
|
+
export declare const DEFAULT_STATE_DIR = ".stx";
|
|
3
|
+
/** Environment variable that overrides both the config and the default. */
|
|
4
|
+
export declare const STATE_DIR_ENV_VAR = "STX_DIR";
|
|
5
|
+
/**
|
|
6
|
+
* Records the `stateDir` coming from `stx.config.ts`.
|
|
7
|
+
*
|
|
8
|
+
* Called by the config loader. A nullish or blank value clears it, so a config
|
|
9
|
+
* without `stateDir` cannot inherit a stale value from a previously loaded one
|
|
10
|
+
* (the dev server loads a config per app directory).
|
|
11
|
+
*/
|
|
12
|
+
export declare function setStateDir(dir?: string | null): void;
|
|
13
|
+
/**
|
|
14
|
+
* The configured state directory, as written — relative or absolute.
|
|
15
|
+
*/
|
|
16
|
+
export declare function stateDirName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Absolute path to a file or directory inside the state directory.
|
|
19
|
+
*
|
|
20
|
+
* An absolute state directory wins over `root`, so a framework can pin every
|
|
21
|
+
* cache to one place no matter which directory a given code path happens to
|
|
22
|
+
* resolve against.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stateDir(root?: string, ...segments: string[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* Rewrites a config path that still carries the default `.stx/` prefix onto the
|
|
27
|
+
* configured state directory.
|
|
28
|
+
*
|
|
29
|
+
* The path-shaped config options (`cachePath`, `build.cacheDir`,
|
|
30
|
+
* `media.cache.directory`, `story.outDir`) default to somewhere under `.stx/`.
|
|
31
|
+
* Rather than make each one separately configurable, `stateDir` moves the whole
|
|
32
|
+
* family: anything under the default prefix follows it, and a path the user
|
|
33
|
+
* pointed somewhere else entirely is left alone.
|
|
34
|
+
*/
|
|
35
|
+
export declare function rebaseOntoStateDir(value: string): string;
|
|
36
|
+
export declare function rebaseOntoStateDir(value: string | undefined): string | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export const DEFAULT_STATE_DIR = ".stx", STATE_DIR_ENV_VAR = "STX_DIR";
|
|
3
|
+
let configuredStateDir = null;
|
|
4
|
+
export function setStateDir(dir) {
|
|
5
|
+
configuredStateDir = dir?.trim() || null;
|
|
6
|
+
}
|
|
7
|
+
export function stateDirName() {
|
|
8
|
+
return process.env[STATE_DIR_ENV_VAR]?.trim() || configuredStateDir || DEFAULT_STATE_DIR;
|
|
9
|
+
}
|
|
10
|
+
export function stateDir(root = process.cwd(), ...segments) {
|
|
11
|
+
const dir = stateDirName();
|
|
12
|
+
return path.isAbsolute(dir) ? path.join(dir, ...segments) : path.join(root, dir, ...segments);
|
|
13
|
+
}
|
|
14
|
+
export function rebaseOntoStateDir(value) {
|
|
15
|
+
if (!value || path.isAbsolute(value))
|
|
16
|
+
return value;
|
|
17
|
+
const normalized = value.replace(/\\/g, "/");
|
|
18
|
+
if (normalized !== DEFAULT_STATE_DIR && !normalized.startsWith(`${DEFAULT_STATE_DIR}/`))
|
|
19
|
+
return value;
|
|
20
|
+
const suffix = normalized.slice(DEFAULT_STATE_DIR.length + 1);
|
|
21
|
+
return suffix ? path.join(stateDirName(), suffix) : stateDirName();
|
|
22
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register a store globally.
|
|
3
|
+
*/
|
|
4
|
+
export declare function registerStore<T>(name: string, store: Store<T>): void;
|
|
5
|
+
/**
|
|
6
|
+
* Get a registered store.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getStore<T>(name: string): Store<T> | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Check if a store is registered.
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasStore(name: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Get all registered store names.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getStoreNames(): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Clear all registered stores.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clearStores(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Create a reactive store.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createStore<T>(initialValue: T, options?: StoreOptions<T>): Store<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Create a readonly store from a getter function.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createReadonlyStore<T>(getter: () => T, options?: { name?: string }): Omit<Store<T>, 'set' | 'update' | 'reset'>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a computed value derived from stores.
|
|
31
|
+
*/
|
|
32
|
+
export declare function computed<T, S extends readonly Store<any>[]>(stores: S, compute: (...values: { [K in keyof S]: S[K] extends Store<infer V> ? V : never }) => T, options?: ComputedOptions): Store<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a typed action for a store.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createAction<T, P extends unknown[], R>(store: Store<T>, name: string, handler: (state: T, ...params: P) => T | Promise<T>): (...params: P) => R extends Promise<unknown> ? Promise<void> : void;
|
|
37
|
+
/**
|
|
38
|
+
* Create multiple actions for a store.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createActions<T, A extends Record<string, (state: T, ...args: any[]) => T>>(store: Store<T>, actions: A): { [K in keyof A]: A[K] extends (state: T, ...args: infer P) => T ? (...args: P) => void : never };
|
|
41
|
+
/**
|
|
42
|
+
* Create a selector that derives a value from a store.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createSelector<T, R>(store: Store<T>, selector: (state: T) => R, options?: { equals?: (a: R, b: R) => boolean }): Store<R>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a selector with memoization.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createMemoizedSelector<T, R>(store: Store<T>, selector: (state: T) => R, deps: (state: T) => unknown[]): Store<R>;
|
|
49
|
+
/**
|
|
50
|
+
* Logging middleware for debugging.
|
|
51
|
+
*/
|
|
52
|
+
export declare function loggerMiddleware<T>(name?: string): StoreMiddleware<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Validation middleware.
|
|
55
|
+
*/
|
|
56
|
+
export declare function validationMiddleware<T>(validate: (value: T) => boolean | string): StoreMiddleware<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Immer-like middleware for immutable updates.
|
|
59
|
+
*/
|
|
60
|
+
export declare function immerMiddleware<T extends object>(): StoreMiddleware<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Throttle middleware.
|
|
63
|
+
*/
|
|
64
|
+
export declare function throttleMiddleware<T>(ms: number): StoreMiddleware<T>;
|
|
65
|
+
/**
|
|
66
|
+
* Use a store in a template context.
|
|
67
|
+
* Returns a reactive reference that auto-updates.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useStore<T>(nameOrStore: string | Store<T>): T;
|
|
70
|
+
/**
|
|
71
|
+
* Create a store directive for use in templates.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createStoreDirective(storeName: string): {
|
|
74
|
+
name: string
|
|
75
|
+
hasEndTag: boolean
|
|
76
|
+
handler: () => string
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Initialize DevTools integration.
|
|
80
|
+
*/
|
|
81
|
+
export declare function initDevTools(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Define a store with state, getters, and actions.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // stores/counter.ts
|
|
88
|
+
* import { defineStore } from 'stx'
|
|
89
|
+
*
|
|
90
|
+
* export const counterStore = defineStore('counter', {
|
|
91
|
+
* state: {
|
|
92
|
+
* count: 0,
|
|
93
|
+
* name: 'Counter'
|
|
94
|
+
* },
|
|
95
|
+
* getters: {
|
|
96
|
+
* doubleCount: (state) => state.count * 2,
|
|
97
|
+
* displayName: (state) => `${state.name}: ${state.count}`
|
|
98
|
+
* },
|
|
99
|
+
* actions: {
|
|
100
|
+
* increment() { this.count++ },
|
|
101
|
+
* decrement() { this.count-- },
|
|
102
|
+
* incrementBy(amount: number) { this.count += amount },
|
|
103
|
+
* async fetchCount() {
|
|
104
|
+
* const response = await fetch('/api/count')
|
|
105
|
+
* this.count = await response.json()
|
|
106
|
+
* }
|
|
107
|
+
* },
|
|
108
|
+
* persist: true // or { storage: 'local', key: 'my-counter' }
|
|
109
|
+
* })
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* Usage in components:
|
|
113
|
+
* ```html
|
|
114
|
+
* <script client>
|
|
115
|
+
* import { counterStore } from '@stores'
|
|
116
|
+
*
|
|
117
|
+
* // Access state
|
|
118
|
+
* console.log(counterStore.count) // 0
|
|
119
|
+
*
|
|
120
|
+
* // Use getters
|
|
121
|
+
* console.log(counterStore.doubleCount) // 0
|
|
122
|
+
*
|
|
123
|
+
* // Call actions
|
|
124
|
+
* counterStore.increment()
|
|
125
|
+
* counterStore.incrementBy(5)
|
|
126
|
+
*
|
|
127
|
+
* // Subscribe to changes
|
|
128
|
+
* counterStore.$subscribe((state) => {
|
|
129
|
+
* console.log('Count changed:', state.count)
|
|
130
|
+
* })
|
|
131
|
+
*
|
|
132
|
+
* // Reset to initial state
|
|
133
|
+
* counterStore.$reset()
|
|
134
|
+
* </script>
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
* Define a store using a setup function (composition API style).
|
|
139
|
+
* The function receives no arguments and returns an object of signals,
|
|
140
|
+
* derived values, and action functions.
|
|
141
|
+
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* defineStore('auth', () => {
|
|
144
|
+
* const user = state(null)
|
|
145
|
+
* const isAuthenticated = derived(() => !!user())
|
|
146
|
+
* function login(data) { user.set(data) }
|
|
147
|
+
* return { user, isAuthenticated, login }
|
|
148
|
+
* })
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare function defineStore<T extends Record<string, any>>(id: string, setup: () => T, options?: { persist?: boolean | { pick?: string[], storage?: string, key?: string } }): T;
|
|
152
|
+
/**
|
|
153
|
+
* Define a store using an options object (options API style).
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* defineStore('counter', {
|
|
157
|
+
* state: () => ({ count: 0 }),
|
|
158
|
+
* getters: { doubled: (s) => s.count * 2 },
|
|
159
|
+
* actions: { increment() { this.count++ } },
|
|
160
|
+
* })
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export declare function defineStore<S extends object, G extends Record<string, (state: S) => any> = Record<string, never>, A extends Record<string, (...args: any[]) => any> = Record<string, never>,>(id: string, options: DefineStoreOptions<S, G, A>): DefinedStoreWithGettersAndActions<S, G, A>;
|
|
164
|
+
/**
|
|
165
|
+
* Get a defined store by name.
|
|
166
|
+
* Used internally by the @stores import transformation.
|
|
167
|
+
*/
|
|
168
|
+
export declare function getDefinedStore<S extends object = any>(name: string): DefinedStoreWithGettersAndActions<S, any, any> | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Get all defined store names.
|
|
171
|
+
*/
|
|
172
|
+
export declare function getDefinedStoreNames(): string[];
|
|
173
|
+
/**
|
|
174
|
+
* Check if a store is defined.
|
|
175
|
+
*/
|
|
176
|
+
export declare function hasDefinedStore(name: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Generate client-side runtime code for store imports.
|
|
179
|
+
* Uses the stx runtime to avoid exposing window.* to developers.
|
|
180
|
+
*/
|
|
181
|
+
export declare function generateStoreImportRuntime(): string;
|
|
182
|
+
/**
|
|
183
|
+
* Transform import statements from @stores to runtime code.
|
|
184
|
+
*
|
|
185
|
+
* Transforms:
|
|
186
|
+
* ```js
|
|
187
|
+
* import { appStore, chatStore } from '@stores'
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* Into:
|
|
191
|
+
* ```js
|
|
192
|
+
* const appStore = stx.useStore('appStore');
|
|
193
|
+
* const chatStore = stx.useStore('chatStore');
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* The stx runtime is injected automatically and abstracts away window.* access.
|
|
197
|
+
*/
|
|
198
|
+
export declare function transformStoreImports(code: string): string;
|
|
199
|
+
/**
|
|
200
|
+
* Generate store registration code for the client.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```js
|
|
204
|
+
* // In your stores file (e.g., stores/index.ts)
|
|
205
|
+
* import { defineStore, registerStoresClient } from 'stx'
|
|
206
|
+
*
|
|
207
|
+
* export const appStore = defineStore('app', { ... })
|
|
208
|
+
* export const chatStore = defineStore('chat', { ... })
|
|
209
|
+
*
|
|
210
|
+
* // Register for client-side @stores imports
|
|
211
|
+
* if (typeof window !== 'undefined') {
|
|
212
|
+
* registerStoresClient({ appStore, chatStore })
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
export declare function registerStoresClient(stores: Record<string, object>): void;
|
|
217
|
+
/** Store options */
|
|
218
|
+
export declare interface StoreOptions<T> {
|
|
219
|
+
name?: string
|
|
220
|
+
persist?: PersistOptions
|
|
221
|
+
devtools?: boolean
|
|
222
|
+
middleware?: StoreMiddleware<T>[]
|
|
223
|
+
equals?: (a: T, b: T) => boolean
|
|
224
|
+
}
|
|
225
|
+
/** Persistence options */
|
|
226
|
+
export declare interface PersistOptions {
|
|
227
|
+
storage?: 'local' | 'session' | 'memory'
|
|
228
|
+
key?: string
|
|
229
|
+
serialize?: (value: unknown) => string
|
|
230
|
+
deserialize?: (value: string) => unknown
|
|
231
|
+
paths?: string[]
|
|
232
|
+
debounce?: number
|
|
233
|
+
}
|
|
234
|
+
/** Store interface */
|
|
235
|
+
export declare interface Store<T> {
|
|
236
|
+
get: () => T
|
|
237
|
+
set: (value: T | ((prev: T) => T)) => void
|
|
238
|
+
subscribe: (subscriber: Subscriber<T>) => Unsubscribe
|
|
239
|
+
update: (updater: Partial<T> | ((prev: T) => Partial<T>)) => void
|
|
240
|
+
reset: () => void
|
|
241
|
+
name?: string
|
|
242
|
+
destroy: () => void
|
|
243
|
+
}
|
|
244
|
+
/** Computed options */
|
|
245
|
+
export declare interface ComputedOptions {
|
|
246
|
+
equals?: <T>(a: T, b: T) => boolean
|
|
247
|
+
}
|
|
248
|
+
/** Action definition */
|
|
249
|
+
export declare interface ActionDefinition<T, P extends unknown[], R> {
|
|
250
|
+
name: string
|
|
251
|
+
handler: (store: Store<T>, ...params: P) => R
|
|
252
|
+
}
|
|
253
|
+
/** Global store state */
|
|
254
|
+
export declare interface GlobalState {
|
|
255
|
+
stores: Map<string, Store<unknown>>
|
|
256
|
+
subscriptions: Map<string, Set<Subscriber<unknown>>>
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Store definition options for defineStore
|
|
260
|
+
*/
|
|
261
|
+
export declare interface DefineStoreOptions<S, G extends Record<string, (state: S) => any>, A extends Record<string, (...args: any[]) => any>> {
|
|
262
|
+
state: S | (() => S)
|
|
263
|
+
getters?: G
|
|
264
|
+
actions?: A
|
|
265
|
+
persist?: PersistOptions | boolean
|
|
266
|
+
devtools?: boolean
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Store instance returned by defineStore
|
|
270
|
+
*/
|
|
271
|
+
export declare interface DefinedStore<S, G extends Record<string, (state: S) => any>, A extends Record<string, (...args: any[]) => any>> {
|
|
272
|
+
$state: S
|
|
273
|
+
$subscribe: (callback: Subscriber<S>) => Unsubscribe
|
|
274
|
+
$reset: () => void
|
|
275
|
+
$patch: (partial: Partial<S> | ((state: S) => void)) => void
|
|
276
|
+
_store: Store<S>
|
|
277
|
+
$id: string
|
|
278
|
+
}
|
|
279
|
+
/** Subscription callback */
|
|
280
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
281
|
+
export type Subscriber<T> = (value: T, previousValue: T | undefined) => void;
|
|
282
|
+
/** Unsubscribe function */
|
|
283
|
+
export type Unsubscribe = () => void;
|
|
284
|
+
/** Store middleware */
|
|
285
|
+
export type StoreMiddleware<T> = (
|
|
286
|
+
set: (value: T) => void,
|
|
287
|
+
get: () => T,
|
|
288
|
+
store: Store<T>
|
|
289
|
+
) => (nextSet: (value: T) => void) => (value: T) => void;
|
|
290
|
+
// Type helper for getters
|
|
291
|
+
declare type StoreGetters<S, G extends Record<string, (state: S) => any>> = {
|
|
292
|
+
[K in keyof G]: ReturnType<G[K]>
|
|
293
|
+
}
|
|
294
|
+
// Type helper for actions
|
|
295
|
+
declare type StoreActions<A extends Record<string, (...args: any[]) => any>> = {
|
|
296
|
+
[K in keyof A]: A[K]
|
|
297
|
+
}
|
|
298
|
+
// Full store type combining state, getters, and actions
|
|
299
|
+
export type DefinedStoreWithGettersAndActions<S, G extends Record<string, (state: S) => any>, A extends Record<string, (...args: any[]) => any>,> = DefinedStore<S, G, A> & StoreGetters<S, G> & StoreActions<A>;
|