@stacksjs/stx 0.2.572 → 0.2.573
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/a11y.d.ts +51 -111
- package/dist/animation.d.ts +131 -74
- package/dist/api-client.d.ts +11 -21
- package/dist/api-handler.d.ts +4 -4
- package/dist/appearance-bootstrap.d.ts +16 -77
- package/dist/application-layers.d.ts +11 -20
- package/dist/asset-roots.d.ts +7 -27
- package/dist/assets.d.ts +7 -9
- package/dist/async-components.d.ts +56 -78
- package/dist/auth.d.ts +0 -3
- package/dist/browser-core-imports.d.ts +2 -2
- package/dist/build-externalize-repeated.d.ts +0 -25
- package/dist/build-externalize.d.ts +18 -53
- package/dist/build-id.d.ts +40 -28
- package/dist/build-message.d.ts +20 -44
- package/dist/builtins/attrs.d.ts +0 -14
- package/dist/builtins/drawer.d.ts +3 -22
- package/dist/builtins/icon.d.ts +17 -19
- package/dist/builtins/image-alpha.d.ts +8 -8
- package/dist/builtins/image-delivery.d.ts +38 -40
- package/dist/builtins/image-placeholder.d.ts +12 -50
- package/dist/builtins/image-warmup-worker.d.ts +1 -1
- package/dist/builtins/image-worker.d.ts +6 -32
- package/dist/builtins/index.d.ts +16 -6
- package/dist/builtins/modal.d.ts +13 -23
- package/dist/builtins/safe-image.d.ts +2 -42
- package/dist/builtins/stx-image.d.ts +44 -24
- package/dist/builtins/stx-link.d.ts +5 -8
- package/dist/builtins/stx-loading-indicator.d.ts +11 -10
- package/dist/builtins/suspense.d.ts +6 -27
- package/dist/builtins/toast.d.ts +15 -16
- package/dist/builtins/transition-group.d.ts +1 -25
- package/dist/caching.d.ts +24 -21
- package/dist/{chunk-f4jh9vrj.js → chunk-0s647d0b.js} +53 -53
- package/dist/{chunk-09gtbb1w.js → chunk-1bsafdnt.js} +1 -1
- package/dist/{chunk-m6mxqepz.js → chunk-1btr5tme.js} +1 -1
- package/dist/{chunk-01mxer9s.js → chunk-2g6wcnna.js} +1 -1
- package/dist/{chunk-rrj5m9xv.js → chunk-2hg2bqtj.js} +1 -1
- package/dist/{chunk-xckzvbvn.js → chunk-4f0fh2a9.js} +1 -1
- package/dist/chunk-557wtdps.js +2 -0
- package/dist/{chunk-vr36s2en.js → chunk-58vrf6kh.js} +1 -1
- package/dist/{chunk-qzbzn1yf.js → chunk-6tsnz28m.js} +1 -1
- package/dist/{chunk-cvswrbzw.js → chunk-6x8cwscv.js} +1 -1
- package/dist/{chunk-1n64749x.js → chunk-74ew8ajw.js} +1 -1
- package/dist/{chunk-jqefcghh.js → chunk-78d6yyxz.js} +2 -2
- package/dist/{chunk-83fdt4yj.js → chunk-824cnbac.js} +1 -1
- package/dist/{chunk-ntgy4e1q.js → chunk-864xm0jy.js} +1 -1
- package/dist/{chunk-nn174xjh.js → chunk-9fbkdrm8.js} +1 -1
- package/dist/{chunk-kzjrgh0b.js → chunk-a3gvw1q2.js} +1 -1
- package/dist/{chunk-pqcvh9pp.js → chunk-amtrg7pn.js} +1 -1
- package/dist/{chunk-pw9verqx.js → chunk-b5fpsp5n.js} +1 -1
- package/dist/{chunk-5afw7z6v.js → chunk-bcjr3fw7.js} +1 -1
- package/dist/{chunk-n6qp05t9.js → chunk-bkj0j5se.js} +1 -1
- package/dist/{chunk-mzqyv7s5.js → chunk-cf97xdqa.js} +1 -1
- package/dist/{chunk-cgwyd9aq.js → chunk-cr67dpx4.js} +1 -1
- package/dist/{chunk-f1apaqfk.js → chunk-dpqvacd1.js} +1 -1
- package/dist/{chunk-ghy82tsc.js → chunk-et8726at.js} +1 -1
- package/dist/{chunk-4bgfpkwx.js → chunk-ev8t5cxk.js} +1 -1
- package/dist/{chunk-s34g3awk.js → chunk-fynh3bkq.js} +1 -1
- package/dist/{chunk-gzgc8zk5.js → chunk-g8757f97.js} +2 -2
- package/dist/{chunk-3gft8zng.js → chunk-hm4j4d8q.js} +1 -1
- package/dist/{chunk-0bt0fbs1.js → chunk-j9qy9t3t.js} +5 -5
- package/dist/{chunk-2a1q5y6r.js → chunk-jhc47xzj.js} +1 -1
- package/dist/{chunk-79vdkvhf.js → chunk-kns5m52j.js} +1 -1
- package/dist/{chunk-2cqbyb8w.js → chunk-mjpewk4r.js} +1 -1
- package/dist/{chunk-2jjff8kv.js → chunk-nj488tj2.js} +2 -2
- package/dist/{chunk-dcpf6kas.js → chunk-q9chv68c.js} +1 -1
- package/dist/{chunk-xq2ck69k.js → chunk-qm280dp3.js} +1 -1
- package/dist/{chunk-ymawe0y5.js → chunk-sjcstv33.js} +1 -1
- package/dist/{chunk-tc5r2vmw.js → chunk-t0zdz8kd.js} +1 -1
- package/dist/{chunk-jwvzvapp.js → chunk-t3dnak1j.js} +1 -1
- package/dist/{chunk-2jsnrfc8.js → chunk-t64nnmmj.js} +1 -1
- package/dist/{chunk-m2a1fxpb.js → chunk-tvb8p7c0.js} +1 -1
- package/dist/{chunk-6f4qrd0s.js → chunk-tyhgq6rw.js} +1 -1
- package/dist/{chunk-4wfr074d.js → chunk-vn7tc8hm.js} +1 -1
- package/dist/{chunk-y4ajd836.js → chunk-xy6g8zb9.js} +1 -1
- package/dist/{chunk-zddzjd60.js → chunk-ya7xks9t.js} +1 -1
- package/dist/chunk-zpz6q2fh.js +2 -0
- package/dist/chunk-zxt94g45.js +2 -0
- package/dist/{chunk-cyg9w31a.js → chunk-zz7tw07b.js} +1 -1
- package/dist/{chunk-ta8bhz27.js → chunk-zzcxacjf.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client/directive.d.ts +0 -7
- package/dist/client/index.d.ts +1 -0
- package/dist/client/signals-appearance-runtime.d.ts +1 -1
- package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
- package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
- package/dist/client/signals-class-runtime.d.ts +1 -1
- package/dist/client/signals-component-api-runtime.d.ts +1 -1
- package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-component-props-runtime.d.ts +1 -1
- package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
- package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
- package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
- package/dist/client/signals-context-runtime.d.ts +1 -1
- package/dist/client/signals-cookie-runtime.d.ts +1 -1
- package/dist/client/signals-devtools-runtime.d.ts +1 -1
- package/dist/client/signals-dialog-runtime.d.ts +1 -1
- package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
- package/dist/client/signals-drawer-runtime.d.ts +1 -1
- package/dist/client/signals-effect-runtime.d.ts +1 -1
- package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
- package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
- package/dist/client/signals-expression-runtime.d.ts +1 -1
- package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
- package/dist/client/signals-for-runtime.d.ts +1 -1
- package/dist/client/signals-globals-runtime.d.ts +1 -1
- package/dist/client/signals-handler-runtime.d.ts +1 -1
- package/dist/client/signals-head-runtime.d.ts +1 -1
- package/dist/client/signals-helpers-runtime.d.ts +1 -1
- package/dist/client/signals-host-runtime.d.ts +1 -1
- package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
- package/dist/client/signals-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-if-chain-runtime.d.ts +1 -1
- package/dist/client/signals-if-runtime.d.ts +1 -1
- package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
- package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
- package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
- package/dist/client/signals-loop-row-runtime.d.ts +1 -1
- package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-model-runtime.d.ts +1 -1
- package/dist/client/signals-mount-runtime.d.ts +1 -1
- package/dist/client/signals-navigation-runtime.d.ts +1 -1
- package/dist/client/signals-notify-runtime.d.ts +1 -1
- package/dist/client/signals-optimistic-runtime.d.ts +1 -1
- package/dist/client/signals-overlay-runtime.d.ts +1 -1
- package/dist/client/signals-pipe-runtime.d.ts +1 -1
- package/dist/client/signals-proxy-runtime.d.ts +1 -1
- package/dist/client/signals-query-runtime.d.ts +1 -1
- package/dist/client/signals-reactive-runtime.d.ts +1 -1
- package/dist/client/signals-ref-runtime.d.ts +1 -1
- package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
- package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
- package/dist/client/signals-show-runtime.d.ts +1 -1
- package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
- package/dist/client/signals-spa-load-runtime.d.ts +1 -1
- package/dist/client/signals-state-runtime.d.ts +1 -1
- package/dist/client/signals-storage-runtime.d.ts +1 -1
- package/dist/client/signals-store-registry-runtime.d.ts +1 -1
- package/dist/client/signals-style-runtime.d.ts +1 -1
- package/dist/client/signals-suspense-runtime.d.ts +1 -1
- package/dist/client/signals-timer-runtime.d.ts +1 -1
- package/dist/client/signals-toast-runtime.d.ts +1 -1
- package/dist/client/signals-tooltip-runtime.d.ts +1 -1
- package/dist/client/signals-transition-group-runtime.d.ts +1 -1
- package/dist/client/signals-websocket-runtime.d.ts +1 -1
- package/dist/client-helpers.d.ts +1 -312
- package/dist/client-module-registry.d.ts +4 -27
- package/dist/client-parameter-bindings.d.ts +1 -4
- package/dist/client-script-bundler.d.ts +55 -103
- package/dist/client-script.d.ts +69 -127
- package/dist/color-mode-boot.d.ts +21 -58
- package/dist/component-client-factories.d.ts +8 -9
- package/dist/component-contract-checks.d.ts +15 -18
- package/dist/component-contract.d.ts +6 -6
- package/dist/component-hmr.d.ts +8 -7
- package/dist/component-model.d.ts +14 -20
- package/dist/component-processing.d.ts +51 -59
- package/dist/component-registry.d.ts +28 -99
- package/dist/component-renderer.d.ts +19 -16
- package/dist/component-resolution.d.ts +8 -8
- package/dist/component-tags.d.ts +1 -1
- package/dist/composable-loader.d.ts +6 -41
- package/dist/composables/use-fetch.d.ts +45 -114
- package/dist/composables/use-form.d.ts +2 -56
- package/dist/composables/use-intersection-observer.d.ts +1 -1
- package/dist/composables.d.ts +75 -74
- package/dist/composition-api.d.ts +19 -43
- package/dist/computed.d.ts +93 -86
- package/dist/conditionals.d.ts +0 -24
- package/dist/config.d.ts +30 -24
- package/dist/config.js +3 -0
- package/dist/craft-bridge.d.ts +1 -467
- package/dist/craft-components.d.ts +234 -680
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/csp.d.ts +41 -107
- package/dist/database.d.ts +1 -1
- package/dist/defer.d.ts +0 -24
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/dev-server/ts-css.d.ts +26 -35
- package/dist/dev-server/types.d.ts +33 -29
- package/dist/directive-api.d.ts +42 -85
- package/dist/directive-arguments.d.ts +14 -39
- package/dist/document-shell.d.ts +49 -81
- package/dist/dynamic-components.d.ts +0 -9
- package/dist/engine-bindings.d.ts +1 -1
- package/dist/env.d.ts +26 -0
- package/dist/error-boundaries.d.ts +36 -43
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +43 -51
- package/dist/errors/formatter.d.ts +38 -58
- package/dist/errors/index.d.ts +61 -5
- package/dist/errors/logger.d.ts +40 -114
- package/dist/errors/sanitizer.d.ts +28 -53
- package/dist/errors/types.d.ts +31 -44
- package/dist/events.d.ts +32 -94
- package/dist/expressions.d.ts +57 -62
- package/dist/find-body-tag.d.ts +5 -34
- package/dist/first-script-tag.d.ts +0 -23
- package/dist/forms-validation.d.ts +117 -149
- package/dist/forms.d.ts +161 -120
- package/dist/framework-composables.d.ts +0 -32
- package/dist/head-injection.d.ts +30 -32
- package/dist/head-keys.d.ts +12 -15
- package/dist/head.d.ts +110 -139
- package/dist/heatmap.d.ts +76 -152
- package/dist/html-masking.d.ts +38 -62
- package/dist/hydration-runtime.d.ts +24 -20
- package/dist/hydration.d.ts +11 -10
- package/dist/i18n.d.ts +34 -95
- package/dist/image-optimization/auto-sibling.d.ts +4 -32
- package/dist/imported-signals.d.ts +0 -36
- package/dist/includes.d.ts +6 -69
- package/dist/index.d.ts +2 -1
- package/dist/init.d.ts +12 -20
- package/dist/internal-markdown.d.ts +8 -12
- package/dist/interpolation-context.d.ts +15 -15
- package/dist/island-chunking.d.ts +13 -30
- package/dist/keep-alive.d.ts +52 -72
- package/dist/layout-types.d.ts +2 -27
- package/dist/lazy-module.d.ts +0 -10
- package/dist/loading-indicator.d.ts +8 -5
- package/dist/loop-binding.d.ts +4 -7
- package/dist/loops.d.ts +25 -67
- package/dist/markdown.d.ts +1 -0
- package/dist/media/image/component.d.ts +9 -25
- package/dist/media/image/directive.d.ts +1 -15
- package/dist/media/image/placeholder.d.ts +9 -20
- package/dist/media/image/processor/cache.d.ts +18 -40
- package/dist/media/image/processor/index.d.ts +10 -1
- package/dist/media/image/processor/optimizer.d.ts +1 -12
- package/dist/media/image/processor/responsive.d.ts +6 -16
- package/dist/media/image/srcset.d.ts +49 -47
- package/dist/media/shared/cache.d.ts +31 -51
- package/dist/media/shared/hash.d.ts +0 -7
- package/dist/media/types.d.ts +754 -1235
- package/dist/media/video/directive.d.ts +1 -15
- package/dist/media/video/index.d.ts +17 -39
- package/dist/media/video/processor/cache.d.ts +19 -42
- package/dist/media/video/processor/index.d.ts +18 -1
- package/dist/media/video/processor/streaming.d.ts +10 -17
- package/dist/media/video/processor/thumbnail.d.ts +15 -21
- package/dist/media/video/processor/transcoder.d.ts +1 -11
- package/dist/meta-arguments.d.ts +14 -39
- package/dist/method-spoofing.d.ts +0 -7
- package/dist/middleware.d.ts +0 -60
- package/dist/native/bridge/protocol.d.ts +2 -1
- package/dist/native/compiler/headwind-to-style.d.ts +383 -359
- package/dist/native/compiler/icons.d.ts +249 -243
- package/dist/native/compiler/svg.d.ts +35 -24
- package/dist/native/runtime/jsc-globals.d.ts +1 -1
- package/dist/native/runtime/native-host.d.ts +1 -1
- package/dist/native/runtime/native-host.js +3 -0
- package/dist/offline/app-service-worker.d.ts +50 -114
- package/dist/offline/kept-store.d.ts +23 -37
- package/dist/offline/query-cache.d.ts +55 -126
- package/dist/owned-routes.d.ts +0 -31
- package/dist/page-response.d.ts +8 -39
- package/dist/parser/directive-parser.d.ts +45 -57
- package/dist/parser/expression-parser.d.ts +35 -33
- package/dist/parser/index.d.ts +39 -4
- package/dist/parser/tokenizer.d.ts +49 -61
- package/dist/partial-hydration.d.ts +51 -82
- package/dist/performance-utils.d.ts +115 -255
- package/dist/placeholder.d.ts +9 -18
- package/dist/plugin-system.d.ts +115 -264
- package/dist/process.d.ts +4 -9
- package/dist/process.js +6 -4
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +0 -14
- package/dist/pwa/directives.d.ts +20 -12
- package/dist/pwa/inject.d.ts +0 -10
- package/dist/pwa/precache.d.ts +16 -22
- package/dist/pwa/service-worker.d.ts +0 -12
- package/dist/pwa.js +1 -1
- package/dist/reactive-bindings.d.ts +11 -34
- package/dist/reactive-tracking.d.ts +0 -36
- package/dist/reactive.d.ts +41 -58
- package/dist/render-memo.d.ts +5 -23
- package/dist/resolve-stx-targets.d.ts +6 -44
- package/dist/route-middleware.d.ts +35 -2
- package/dist/route-rules.d.ts +10 -13
- package/dist/router.d.ts +9 -8
- package/dist/routes.d.ts +3 -1
- package/dist/runtime-config-server.d.ts +14 -17
- package/dist/runtime-config.d.ts +2 -3
- package/dist/runtime-globals.d.ts +90 -122
- package/dist/runtime-injection.d.ts +0 -8
- package/dist/scaffolding.d.ts +30 -26
- package/dist/script-emit.d.ts +0 -30
- package/dist/script-validation.d.ts +6 -12
- package/dist/seo.d.ts +75 -153
- package/dist/server-api.d.ts +9 -12
- package/dist/server-bindings.d.ts +1 -26
- package/dist/server-data.d.ts +4 -5
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +37 -53
- package/dist/signals-api.d.ts +58 -135
- package/dist/signals.d.ts +18 -24
- package/dist/site-url.d.ts +31 -28
- package/dist/slots.d.ts +20 -86
- package/dist/source-signature.d.ts +5 -28
- package/dist/ssg.d.ts +158 -337
- package/dist/ssg.js +2 -2
- package/dist/state-dir.d.ts +4 -4
- package/dist/store-loader.d.ts +0 -10
- package/dist/story/analytics.d.ts +60 -138
- package/dist/story/bookmarks.d.ts +34 -87
- package/dist/story/cli.d.ts +69 -123
- package/dist/story/collect/scanner.d.ts +0 -4
- package/dist/story/collect/tree.d.ts +1 -8
- package/dist/story/commands/build.d.ts +6 -11
- package/dist/story/commands/dev.d.ts +8 -15
- package/dist/story/commands/preview.d.ts +7 -13
- package/dist/story/config-watcher.d.ts +13 -20
- package/dist/story/config.d.ts +8 -11
- package/dist/story/context.d.ts +8 -14
- package/dist/story/hmr.d.ts +26 -24
- package/dist/story/hot-swap.d.ts +23 -34
- package/dist/story/keyboard-shortcuts.d.ts +18 -23
- package/dist/story/output.d.ts +44 -46
- package/dist/story/performance.d.ts +45 -107
- package/dist/story/presets.d.ts +41 -107
- package/dist/story/renderer.d.ts +27 -41
- package/dist/story/search.d.ts +12 -23
- package/dist/story/server.d.ts +11 -21
- package/dist/story/setup.d.ts +15 -23
- package/dist/story/testing.d.ts +40 -65
- package/dist/story/types.d.ts +160 -262
- package/dist/streaming.d.ts +57 -119
- package/dist/strip-literals.d.ts +1 -25
- package/dist/stx-module-imports.d.ts +7 -0
- package/dist/stx-virtual-ts.d.ts +102 -253
- package/dist/style-scoping.d.ts +8 -21
- package/dist/suspense.d.ts +52 -67
- package/dist/teleport.d.ts +0 -22
- package/dist/template-syntax-escape.d.ts +8 -8
- package/dist/template-tag-balance.d.ts +6 -22
- package/dist/testing.d.ts +26 -11
- package/dist/theme-tokens.d.ts +388 -134
- package/dist/transitions.d.ts +55 -66
- package/dist/ts-css-config.d.ts +12 -70
- package/dist/types/component-types.d.ts +122 -187
- package/dist/types/config-types.d.ts +341 -956
- package/dist/types/context-types.d.ts +24 -46
- package/dist/types/csp-types.d.ts +66 -70
- package/dist/types/directive-types.d.ts +156 -223
- package/dist/types/index.d.ts +110 -6
- package/dist/types/pwa-types.d.ts +148 -273
- package/dist/types.d.ts +1 -0
- package/dist/unresolved-identifiers.d.ts +22 -24
- package/dist/url-safety.d.ts +32 -32
- package/dist/utils.d.ts +21 -36
- package/dist/validator.d.ts +26 -28
- package/dist/variable-extractor.d.ts +19 -49
- package/dist/view-composers.d.ts +81 -80
- package/dist/virtual-scrolling.d.ts +82 -101
- package/dist/visual-testing.d.ts +10 -9
- package/dist/vue-template.d.ts +0 -23
- package/dist/web-components/css-scoping.d.ts +11 -21
- package/dist/web-components.d.ts +58 -81
- package/dist/x-element.d.ts +1 -0
- package/package.json +6 -6
- package/stx.d.ts +2 -2
- package/dist/app-service-worker.d.ts +0 -165
- package/dist/chunk-49gwmcrn.js +0 -2
- package/dist/chunk-6va5pe2m.js +0 -2
- package/dist/chunk-bm2q1srp.js +0 -2
- package/dist/signals-context-runtime.d.ts +0 -2
- package/dist/signals-drawer-runtime.d.ts +0 -2
- package/dist/signals-host-runtime.d.ts +0 -9
- package/dist/signals-loop-conditional-runtime.d.ts +0 -2
- package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
- package/dist/signals-notify-runtime.d.ts +0 -2
- package/dist/signals-optimistic-runtime.d.ts +0 -2
- package/dist/signals-overlay-runtime.d.ts +0 -2
- package/dist/signals-scope-disposal-runtime.d.ts +0 -2
- package/dist/signals-spa-load-control-runtime.d.ts +0 -2
- package/dist/signals-storage-runtime.d.ts +0 -2
|
@@ -32,7 +32,7 @@ export declare interface NativeHost {
|
|
|
32
32
|
remove: (node: NativeNode) => void
|
|
33
33
|
descendants: (node: NativeNode) => NativeNode[]
|
|
34
34
|
scopesIn: (node: NativeNode) => string[]
|
|
35
|
-
adopt: (node: NativeNode, type: string, owner?: NativeNode | null, descriptor?: Pick<STXNode, 'props' | 'style' | 'events' | 'children' | '_classes' | '_inlineStyle'>) => NativeNode
|
|
35
|
+
adopt: (node: NativeNode, type: string, owner?: NativeNode | null, descriptor?: Pick<STXNode, 'key' | 'props' | 'style' | 'events' | 'children' | '_classes' | '_inlineStyle'>) => NativeNode
|
|
36
36
|
flush: () => void
|
|
37
37
|
dispatch: (handlerId: string, payload?: unknown) => void
|
|
38
38
|
pending: () => number
|
|
@@ -126,6 +126,7 @@ export function createNativeHost(options) {
|
|
|
126
126
|
id: node.__stxId,
|
|
127
127
|
node: {
|
|
128
128
|
type: record.type,
|
|
129
|
+
...record.key === void 0 ? {} : { key: record.key },
|
|
129
130
|
props: { ...record.props },
|
|
130
131
|
style: { ...record.style },
|
|
131
132
|
...Object.keys(record.events).length ? { events: { ...record.events } } : {},
|
|
@@ -235,6 +236,7 @@ export function createNativeHost(options) {
|
|
|
235
236
|
counter = Math.max(counter, Number(suffix));
|
|
236
237
|
const classes = descriptor?._classes ?? "", classStyle = compileClassStyles(classes).style, baseStyle = descriptor?._inlineStyle ? { ...descriptor._inlineStyle } : Object.fromEntries(Object.entries(descriptor?.style ?? {}).filter(([key, value]) => classStyle[key] !== value)), record = {
|
|
237
238
|
type,
|
|
239
|
+
key: descriptor?.key,
|
|
238
240
|
props: { ...descriptor?.props ?? {} },
|
|
239
241
|
style: { ...descriptor?.style ?? {} },
|
|
240
242
|
baseStyle,
|
|
@@ -437,6 +439,7 @@ export function createNativeHost(options) {
|
|
|
437
439
|
};
|
|
438
440
|
records.set(copy.__stxId, {
|
|
439
441
|
type: descriptor.type,
|
|
442
|
+
key: descriptor.key,
|
|
440
443
|
props: { ...descriptor.props, __stxId: copy.__stxId },
|
|
441
444
|
style: { ...descriptor.style },
|
|
442
445
|
baseStyle: { ...descriptor.baseStyle },
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/** `/m/workout/:id` and `/m/workout/[id]` as a matcher the worker can carry. */
|
|
2
|
+
export declare function offlineRoute(path: string): OfflineRoute | null;
|
|
3
|
+
/**
|
|
4
|
+
* What the register tag runs on every page. Closure-free: it is shipped as its
|
|
5
|
+
* own source (`OFFLINE_REGISTER_SCRIPT`), and exported so it can be tested.
|
|
6
|
+
*
|
|
7
|
+
* - Registers the worker after the first frame on a return visit (a cheap
|
|
8
|
+
* update check), and only after `load` on the first one, whose install
|
|
9
|
+
* fetches every kept screen and would compete with the page's own files.
|
|
10
|
+
* It never sits in front of first paint either way.
|
|
11
|
+
* - Turns the worker's `stx:updated` messages into a window event of the same
|
|
12
|
+
* name, { url, kind, fragment }, for the router and for queries to redraw.
|
|
13
|
+
* - A new build waits (see the worker). The page says when it is safe to take
|
|
14
|
+
* over: when it is hidden, or when it loaded with nothing else of the app
|
|
15
|
+
* open; the worker checks that no page of the app is on screen. When one is
|
|
16
|
+
* waiting, `window.stxOffline.updateReady` turns true and the window hears
|
|
17
|
+
* `stx:offline-update-ready`, so an app can offer "Update" and call
|
|
18
|
+
* `window.stxOffline.applyUpdate()`, which takes over now and reloads.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerOfflineWorker(path: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* The section a fallback screen stands in for: `scope` when given, else the
|
|
23
|
+
* fallback's first path segment (`/m/today` → `/m`, `/` → `/`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function offlineFallbackScope(fallback: string | null, scope?: string): string | null;
|
|
26
|
+
/** The worker itself, for one build. */
|
|
27
|
+
export declare function generateOfflineWorker(config: OfflineAppConfig, buildId: string): string;
|
|
28
|
+
export declare const OFFLINE_WORKER_PATH: '/_stx/sw.js';
|
|
29
|
+
/** The tag every page carries so the worker is installed. */
|
|
30
|
+
export declare const OFFLINE_REGISTER_SCRIPT: string;
|
|
1
31
|
/**
|
|
2
32
|
* An app that keeps working without a network, and opens like a native one.
|
|
3
33
|
*
|
|
@@ -47,119 +77,25 @@
|
|
|
47
77
|
* a person mid-task; the page can ask for it sooner (`applyOfflineUpdate()`).
|
|
48
78
|
* The running build's kept screens stay until then.
|
|
49
79
|
*/
|
|
50
|
-
export interface OfflineAppConfig {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*/
|
|
66
|
-
staticPages?: string[];
|
|
67
|
-
/** Path prefix of the app's API, whose GET answers are kept for offline. Default '/api/'. */
|
|
68
|
-
apiPrefix?: string;
|
|
69
|
-
/**
|
|
70
|
-
* How long a screen or API read that was never kept (or one asked for
|
|
71
|
-
* network first) waits for the network before a kept stand-in is used, ms.
|
|
72
|
-
* Default 1500. A kept copy is answered at once and does not wait at all.
|
|
73
|
-
*/
|
|
74
|
-
networkTimeoutMs?: number;
|
|
75
|
-
/** Deadline for each background precache request and response body, ms. Default 10000. Does not abort foreground reads. */
|
|
76
|
-
precacheTimeoutMs?: number;
|
|
77
|
-
/**
|
|
78
|
-
* Paths (prefixes) answered network first rather than from the kept copy:
|
|
79
|
-
* the kept copy is used only when the network does not answer in
|
|
80
|
-
* `networkTimeoutMs`. For a read whose stale copy would mislead, such as a
|
|
81
|
-
* balance or a live score.
|
|
82
|
-
*/
|
|
83
|
-
networkFirst?: string[];
|
|
84
|
-
/**
|
|
85
|
-
* Whether an app started cold while a new build waits opens on the new
|
|
86
|
-
* build, going to the network for its first screen, rather than on the kept
|
|
87
|
-
* one. Off by default: the app opens at once on the build it has, the way a
|
|
88
|
-
* native app keeps running the version it has while the next downloads,
|
|
89
|
-
* and the new build takes over the next time the app is not on screen. On
|
|
90
|
-
* costs a round trip on the first launch after every deploy.
|
|
91
|
-
*/
|
|
92
|
-
updateOnColdStart?: boolean;
|
|
93
|
-
/** Where a page that was never cached goes offline (one of `pages`). Default: the first of `pages`. */
|
|
94
|
-
fallback?: string;
|
|
95
|
-
/**
|
|
96
|
-
* The paths the fallback stands in for (a prefix). Default: the fallback's
|
|
97
|
-
* own section, its first path segment, so a `/m` fallback answers only for
|
|
98
|
-
* `/m/...`. Outside it a page that was never kept fails as it would without
|
|
99
|
-
* the worker. A phone app's screen is no answer for a page of the website
|
|
100
|
-
* beside it, and a dev server restarting looks offline for a moment.
|
|
101
|
-
*/
|
|
102
|
-
fallbackScope?: string;
|
|
103
|
-
/**
|
|
104
|
-
* Dynamic screens whose page is the same for every value, drawn on the
|
|
105
|
-
* device from the API: `/m/workout/:id` or `/m/workout/[id]`. One that was
|
|
106
|
-
* never opened is answered offline with the route's kept page, its route
|
|
107
|
-
* params replaced by the ones asked for. The route's page is fetched when
|
|
108
|
-
* the worker installs (each param as `0`) and refreshed by every visit.
|
|
109
|
-
* Leave out a route whose server renders the value's own data.
|
|
110
|
-
*/
|
|
111
|
-
routes?: string[];
|
|
112
|
-
/** Paths the worker leaves alone entirely (prefixes). */
|
|
113
|
-
exclude?: string[];
|
|
114
|
-
/**
|
|
115
|
-
* Most bytes of media (videos, audio) the page may ask to keep for offline
|
|
116
|
-
* with `cacheMedia()`. The oldest are dropped past it. Default 600 MB.
|
|
117
|
-
*/
|
|
118
|
-
mediaMaxBytes?: number;
|
|
119
|
-
/**
|
|
120
|
-
* Most files other than stylesheets and scripts (images, fonts) kept in the
|
|
121
|
-
* asset cache. The least recently fetched go first when a new build takes
|
|
122
|
-
* over. Default 500.
|
|
123
|
-
*/
|
|
124
|
-
assetsMaxEntries?: number;
|
|
80
|
+
export declare interface OfflineAppConfig {
|
|
81
|
+
enabled: boolean
|
|
82
|
+
pages?: string[]
|
|
83
|
+
staticPages?: string[]
|
|
84
|
+
apiPrefix?: string
|
|
85
|
+
networkTimeoutMs?: number
|
|
86
|
+
precacheTimeoutMs?: number
|
|
87
|
+
networkFirst?: string[]
|
|
88
|
+
updateOnColdStart?: boolean
|
|
89
|
+
fallback?: string
|
|
90
|
+
fallbackScope?: string
|
|
91
|
+
routes?: string[]
|
|
92
|
+
exclude?: string[]
|
|
93
|
+
mediaMaxBytes?: number
|
|
94
|
+
assetsMaxEntries?: number
|
|
125
95
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
re: string;
|
|
132
|
-
names: string[];
|
|
133
|
-
/** The path fetched when the worker installs. */
|
|
134
|
-
sample: string;
|
|
96
|
+
declare interface OfflineRoute {
|
|
97
|
+
path: string
|
|
98
|
+
re: string
|
|
99
|
+
names: string[]
|
|
100
|
+
sample: string
|
|
135
101
|
}
|
|
136
|
-
/** `/m/workout/:id` and `/m/workout/[id]` as a matcher the worker can carry. */
|
|
137
|
-
export declare function offlineRoute(path: string): OfflineRoute | null;
|
|
138
|
-
/**
|
|
139
|
-
* What the register tag runs on every page. Closure-free: it is shipped as its
|
|
140
|
-
* own source (`OFFLINE_REGISTER_SCRIPT`), and exported so it can be tested.
|
|
141
|
-
*
|
|
142
|
-
* - Registers the worker after the first frame on a return visit (a cheap
|
|
143
|
-
* update check), and only after `load` on the first one, whose install
|
|
144
|
-
* fetches every kept screen and would compete with the page's own files.
|
|
145
|
-
* It never sits in front of first paint either way.
|
|
146
|
-
* - Turns the worker's `stx:updated` messages into a window event of the same
|
|
147
|
-
* name, { url, kind, fragment }, for the router and for queries to redraw.
|
|
148
|
-
* - A new build waits (see the worker). The page says when it is safe to take
|
|
149
|
-
* over: when it is hidden, or when it loaded with nothing else of the app
|
|
150
|
-
* open; the worker checks that no page of the app is on screen. When one is
|
|
151
|
-
* waiting, `window.stxOffline.updateReady` turns true and the window hears
|
|
152
|
-
* `stx:offline-update-ready`, so an app can offer "Update" and call
|
|
153
|
-
* `window.stxOffline.applyUpdate()`, which takes over now and reloads.
|
|
154
|
-
*/
|
|
155
|
-
export declare function registerOfflineWorker(path: string): void;
|
|
156
|
-
/**
|
|
157
|
-
* The section a fallback screen stands in for: `scope` when given, else the
|
|
158
|
-
* fallback's first path segment (`/m/today` → `/m`, `/` → `/`).
|
|
159
|
-
*/
|
|
160
|
-
export declare function offlineFallbackScope(fallback: string | null, scope?: string): string | null;
|
|
161
|
-
/** The tag every page carries so the worker is installed. */
|
|
162
|
-
export declare const OFFLINE_REGISTER_SCRIPT: string;
|
|
163
|
-
/** The worker itself, for one build. */
|
|
164
|
-
export declare function generateOfflineWorker(config: OfflineAppConfig, buildId: string): string;
|
|
165
|
-
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/** IndexedDB as a KeptBackend, or null where there is none. Closure-free. */
|
|
2
|
+
export declare function indexedDbBackend(name?: string): KeptBackend | null;
|
|
3
|
+
/**
|
|
4
|
+
* A kept store. Closure-free: embedded in the browser runtime by source, with
|
|
5
|
+
* `indexedDbBackend` passed in rather than referenced.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createKeptStore(options?: KeptStoreOptions, openBackend?: () => KeptBackend | null): KeptStore;
|
|
1
8
|
/**
|
|
2
9
|
* Where kept values live: `keptState` and persisted queries.
|
|
3
10
|
*
|
|
@@ -25,43 +32,22 @@
|
|
|
25
32
|
* (signals.ts), so it may use nothing from this module's scope.
|
|
26
33
|
*/
|
|
27
34
|
/** An asynchronous key-value store behind localStorage, for large values. */
|
|
28
|
-
export interface KeptBackend {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
removePrefix: (prefix: string) => Promise<void>;
|
|
35
|
+
export declare interface KeptBackend {
|
|
36
|
+
get: (key: string) => Promise<unknown>
|
|
37
|
+
set: (key: string, value: unknown) => Promise<void>
|
|
38
|
+
remove: (key: string) => Promise<void>
|
|
39
|
+
removePrefix: (prefix: string) => Promise<void>
|
|
34
40
|
}
|
|
35
|
-
export interface KeptStoreOptions {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/** Characters of JSON past which a value goes to the backend rather than localStorage. Default 32768. */
|
|
41
|
-
limit?: number;
|
|
42
|
-
/** Defer a backend write (default: when idle, or 200 ms at the latest). */
|
|
43
|
-
defer?: (fn: () => void) => void;
|
|
41
|
+
export declare interface KeptStoreOptions {
|
|
42
|
+
storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem' | 'key' | 'length'> | null
|
|
43
|
+
backend?: KeptBackend | null
|
|
44
|
+
limit?: number
|
|
45
|
+
defer?: (fn: () => void) => void
|
|
44
46
|
}
|
|
45
|
-
export interface KeptStore {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
load: (key: string) => Promise<{
|
|
52
|
-
value: unknown;
|
|
53
|
-
} | undefined>;
|
|
54
|
-
/** Keep a value. Readable from memory at once; stored behind. */
|
|
55
|
-
set: (key: string, value: unknown) => void;
|
|
56
|
-
/** Forget every key that starts with `prefix`. */
|
|
57
|
-
forget: (prefix: string) => Promise<void>;
|
|
58
|
-
/** Finish every write that is waiting. */
|
|
59
|
-
flush: () => Promise<void>;
|
|
47
|
+
export declare interface KeptStore {
|
|
48
|
+
peek: (key: string) => { value: unknown } | undefined
|
|
49
|
+
load: (key: string) => Promise<{ value: unknown } | undefined>
|
|
50
|
+
set: (key: string, value: unknown) => void
|
|
51
|
+
forget: (prefix: string) => Promise<void>
|
|
52
|
+
flush: () => Promise<void>
|
|
60
53
|
}
|
|
61
|
-
/** IndexedDB as a KeptBackend, or null where there is none. Closure-free. */
|
|
62
|
-
export declare function indexedDbBackend(name?: string): KeptBackend | null;
|
|
63
|
-
/**
|
|
64
|
-
* A kept store. Closure-free: embedded in the browser runtime by source, with
|
|
65
|
-
* `indexedDbBackend` passed in rather than referenced.
|
|
66
|
-
*/
|
|
67
|
-
export declare function createKeptStore(options?: KeptStoreOptions, openBackend?: () => KeptBackend | null): KeptStore;
|
|
@@ -1,137 +1,66 @@
|
|
|
1
|
+
import type { KeptStore } from './kept-store';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* The phone app's stores each did this by hand: a `keptState` for the data,
|
|
6
|
-
* a `loadedAt` to decide whether to fetch again, a flag against two screens
|
|
7
|
-
* fetching at once, and nothing to tell them when the offline worker had a
|
|
8
|
-
* newer answer or when a write waiting in the outbox should still show. A
|
|
9
|
-
* cached query is that, once:
|
|
10
|
-
*
|
|
11
|
-
* - seeded synchronously from the kept store (`keptState`'s storage, per
|
|
12
|
-
* account scope), so the first draw has data;
|
|
13
|
-
* - fetched again behind when older than `staleTime` (a copy kept from an
|
|
14
|
-
* earlier launch is always revalidated once), one request for every caller;
|
|
15
|
-
* - kept again after every answer;
|
|
16
|
-
* - refreshed when the offline worker says the API answer changed
|
|
17
|
-
* (`stx:updated` { kind: 'api', url });
|
|
18
|
-
* - shown with the outbox's waiting writes applied on top (`affects` /
|
|
19
|
-
* `apply` on an outbox entry), so a change made offline never disappears
|
|
20
|
-
* when the data is fetched again before it synced.
|
|
21
|
-
*
|
|
22
|
-
* Closure-free: the browser runtime embeds `createQueryCache` and
|
|
23
|
-
* `queryTargetMatches` by source (signals.ts), so neither may use anything
|
|
24
|
-
* from this module's scope. The signal implementation and the kept store are
|
|
25
|
-
* passed in.
|
|
3
|
+
* Whether an outbox entry's `affects` item, or a URL the worker refreshed,
|
|
4
|
+
* names this query: its key, or its URL (an item without a query string
|
|
5
|
+
* matches the URL's path with any). Closure-free.
|
|
26
6
|
*/
|
|
27
|
-
|
|
7
|
+
export declare function queryTargetMatches(item: string, target: QueryTarget): boolean;
|
|
8
|
+
/** The query layer, for one page. Closure-free. */
|
|
9
|
+
export declare function createQueryCache(env: QueryCacheEnv): QueryCache;
|
|
28
10
|
/** The part of a signal this needs. */
|
|
29
|
-
export interface QuerySignal<T> {
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
export declare interface QuerySignal<T> {
|
|
12
|
+
(): T
|
|
13
|
+
set: (value: T) => void
|
|
32
14
|
}
|
|
33
|
-
export type KeptScope = string | number | false | null | undefined;
|
|
34
15
|
/** What a query is known by: its key, and the URL it reads, when it has one. */
|
|
35
|
-
export interface QueryTarget {
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
export declare interface QueryTarget {
|
|
17
|
+
key: string
|
|
18
|
+
url?: string | null
|
|
38
19
|
}
|
|
39
|
-
export interface CachedQueryOptions<T> {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
fetch?: (url: string, init: RequestInit) => Promise<Response>;
|
|
50
|
-
/**
|
|
51
|
-
* Whose data this is, as for `keptState`: the signed-in account's id, or a
|
|
52
|
-
* function returning it (read at every load, so signing in as someone else
|
|
53
|
-
* swaps the data). `false`, `null` or `''` keeps nothing on the device.
|
|
54
|
-
* Default: the scope given to `setKeptScope`.
|
|
55
|
-
*/
|
|
56
|
-
scope?: KeptScope | (() => KeptScope);
|
|
57
|
-
/** How long an answer counts as fresh, ms: `load()` within it does not fetch. Default 0. */
|
|
58
|
-
staleTime?: number;
|
|
59
|
-
/** The value before anything was kept or fetched. Default null. */
|
|
60
|
-
initial?: T;
|
|
61
|
-
/** Shape the answer before it is kept and shown. */
|
|
62
|
-
transform?: (raw: any) => T;
|
|
63
|
-
/** Give up on a request after this long, ms (the data stays). Default 15000. */
|
|
64
|
-
timeoutMs?: number;
|
|
65
|
-
/** Fetch when created, rather than at the first `load()`. */
|
|
66
|
-
immediate?: boolean;
|
|
20
|
+
export declare interface CachedQueryOptions<T> {
|
|
21
|
+
url?: string | (() => string | null | undefined)
|
|
22
|
+
load?: (context: { force: boolean, url: string | null, signal?: AbortSignal }) => Promise<T>
|
|
23
|
+
fetch?: (url: string, init: RequestInit) => Promise<Response>
|
|
24
|
+
scope?: KeptScope | (() => KeptScope)
|
|
25
|
+
staleTime?: number
|
|
26
|
+
initial?: T
|
|
27
|
+
transform?: (raw: any) => T
|
|
28
|
+
timeoutMs?: number
|
|
29
|
+
immediate?: boolean
|
|
67
30
|
}
|
|
68
|
-
export interface CachedQuery<T> {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/** Fetch when older than `staleTime` (or always, with `force`). Every caller shares one request. */
|
|
80
|
-
load: (force?: boolean) => Promise<T>;
|
|
81
|
-
/** Fetch now, past any cache: a pull to refresh. */
|
|
82
|
-
refresh: () => Promise<T>;
|
|
83
|
-
/** Replace the data here (an edit made on this device), kept like an answer. */
|
|
84
|
-
set: (value: T | ((current: T) => T)) => void;
|
|
85
|
-
/** Count the data as stale, so the next `load()` fetches. */
|
|
86
|
-
invalidate: () => void;
|
|
87
|
-
readonly key: string;
|
|
31
|
+
export declare interface CachedQuery<T> {
|
|
32
|
+
data: QuerySignal<T>
|
|
33
|
+
loading: QuerySignal<boolean>
|
|
34
|
+
isFetching: QuerySignal<boolean>
|
|
35
|
+
error: QuerySignal<string | null>
|
|
36
|
+
updatedAt: QuerySignal<number>
|
|
37
|
+
load: (force?: boolean) => Promise<T>
|
|
38
|
+
refresh: () => Promise<T>
|
|
39
|
+
set: (value: T | ((current: T) => T)) => void
|
|
40
|
+
invalidate: () => void
|
|
41
|
+
readonly key: string
|
|
88
42
|
}
|
|
89
|
-
export interface QueryCacheEnv {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
listen?: boolean;
|
|
96
|
-
matches?: (item: string, target: QueryTarget) => boolean;
|
|
43
|
+
export declare interface QueryCacheEnv {
|
|
44
|
+
state: <T>(value: T) => QuerySignal<T>
|
|
45
|
+
kept: KeptStore
|
|
46
|
+
prefix?: string
|
|
47
|
+
listen?: boolean
|
|
48
|
+
matches?: (item: string, target: QueryTarget) => boolean
|
|
97
49
|
}
|
|
98
|
-
export interface QueryWatcher {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/** The outbox changed. `sent` is an entry that just reached the server. */
|
|
103
|
-
outbox: (sent: {
|
|
104
|
-
id: string;
|
|
105
|
-
affects?: string[];
|
|
106
|
-
} | null) => void;
|
|
50
|
+
export declare interface QueryWatcher {
|
|
51
|
+
target: () => QueryTarget
|
|
52
|
+
updated: () => void
|
|
53
|
+
outbox: (sent: { id: string, affects?: string[] } | null) => void
|
|
107
54
|
}
|
|
108
|
-
export interface QueryCache {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
at: number;
|
|
119
|
-
} | undefined;
|
|
120
|
-
/** A kept answer, from anywhere it is kept. */
|
|
121
|
-
restore: (key: string, scope?: KeptScope) => Promise<{
|
|
122
|
-
data: unknown;
|
|
123
|
-
at: number;
|
|
124
|
-
} | undefined>;
|
|
125
|
-
persist: (key: string, data: unknown, scope?: KeptScope) => void;
|
|
126
|
-
/** `data` with the outbox's waiting writes for this target applied (only entry `onlyId`, when given). */
|
|
127
|
-
overlay: <T>(target: QueryTarget, data: T, onlyId?: string) => T;
|
|
128
|
-
watch: (watcher: QueryWatcher) => () => void;
|
|
55
|
+
export declare interface QueryCache {
|
|
56
|
+
cachedQuery: <T>(key: string, options?: CachedQueryOptions<T>) => CachedQuery<T>
|
|
57
|
+
setScope: (scope: KeptScope) => void
|
|
58
|
+
scope: () => KeptScope
|
|
59
|
+
keyFor: (key: string, scope?: KeptScope) => string | null
|
|
60
|
+
seed: (key: string, scope?: KeptScope) => { data: unknown, at: number } | undefined
|
|
61
|
+
restore: (key: string, scope?: KeptScope) => Promise<{ data: unknown, at: number } | undefined>
|
|
62
|
+
persist: (key: string, data: unknown, scope?: KeptScope) => void
|
|
63
|
+
overlay: <T>(target: QueryTarget, data: T, onlyId?: string) => T
|
|
64
|
+
watch: (watcher: QueryWatcher) => () => void
|
|
129
65
|
}
|
|
130
|
-
|
|
131
|
-
* Whether an outbox entry's `affects` item, or a URL the worker refreshed,
|
|
132
|
-
* names this query: its key, or its URL (an item without a query string
|
|
133
|
-
* matches the URL's path with any). Closure-free.
|
|
134
|
-
*/
|
|
135
|
-
export declare function queryTargetMatches(item: string, target: QueryTarget): boolean;
|
|
136
|
-
/** The query layer, for one page. Closure-free. */
|
|
137
|
-
export declare function createQueryCache(env: QueryCacheEnv): QueryCache;
|
|
66
|
+
export type KeptScope = string | number | false | null | undefined;
|
package/dist/owned-routes.d.ts
CHANGED
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which same-origin paths the SPA router actually owns (stacksjs/stx#1864).
|
|
3
|
-
*
|
|
4
|
-
* With `interceptAllLinks` — hardcoded as the base default on the serve path —
|
|
5
|
-
* the router claimed EVERY same-origin relative anchor. `shouldIntercept()`
|
|
6
|
-
* filtered on protocol, target and a few opt-out attributes and had no notion
|
|
7
|
-
* of a route table, so a link to a non-page endpoint got fetched, failed to
|
|
8
|
-
* swap, and then fell back to a real navigation. The endpoint was hit twice:
|
|
9
|
-
*
|
|
10
|
-
* Fetch 503 /api/auth/github/redirect
|
|
11
|
-
* Document 503 /api/auth/github/redirect
|
|
12
|
-
*
|
|
13
|
-
* on an endpoint whose whole job is minting OAuth state. Worse, when such an
|
|
14
|
-
* endpoint returns a successful cross-origin redirect, `fetch` follows it and
|
|
15
|
-
* the router swaps a third-party document into the container.
|
|
16
|
-
*
|
|
17
|
-
* The only escape was `data-no-router`, which removes the anchor from routing
|
|
18
|
-
* entirely — one reporting app carries 17 of them, and every new link has to
|
|
19
|
-
* remember whether it needs one.
|
|
20
|
-
*
|
|
21
|
-
* The missing concept is a manifest of owned paths, which the file router
|
|
22
|
-
* already has. This ships the compiled matchers to the client so interception
|
|
23
|
-
* asks "is this a page I can render?" instead of "is this same-origin?".
|
|
24
|
-
*
|
|
25
|
-
* Regex SOURCES are shipped rather than patterns because the client runtime is
|
|
26
|
-
* a template literal (see CLAUDE.md item 41) — re-implementing the pattern
|
|
27
|
-
* compiler in there would mean maintaining a second matcher, in a file where
|
|
28
|
-
* every backslash has to be doubled, that must agree with this one forever.
|
|
29
|
-
*
|
|
30
|
-
* @module owned-routes
|
|
31
|
-
*/
|
|
32
1
|
/**
|
|
33
2
|
* Serialised matchers for every route the router can render.
|
|
34
3
|
*
|
package/dist/page-response.d.ts
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The HTTP status and headers a page decides for its own response.
|
|
3
|
-
*
|
|
4
|
-
* Three shapes reach the same place, so a host reads one key and gets all
|
|
5
|
-
* three:
|
|
6
|
-
*
|
|
7
|
-
* - `definePageMeta({ status })` — read statically out of the source, before
|
|
8
|
-
* anything runs. Right for a page that is *always* an error page.
|
|
9
|
-
* - `@status(expr)` — a template directive, evaluated where the rest of the
|
|
10
|
-
* template is. It sits inside the branch it belongs to, so a page says
|
|
11
|
-
* `@if (!feature) @status(404) @endif` next to the markup that explains it.
|
|
12
|
-
* - `setResponseStatus(code)` / `notFound()` / `setResponseHeader(n, v)` —
|
|
13
|
-
* callable from `<script server>`, for a decision that needs the lookup's
|
|
14
|
-
* result.
|
|
15
|
-
*
|
|
16
|
-
* The last two record on the render context under `__stxResponseStatus` and
|
|
17
|
-
* `__stxResponseHeaders`. Every host that renders a view — the dev/production
|
|
18
|
-
* serve in `bun-plugin`, `stx`'s own `serve`, the app dev server, the
|
|
19
|
-
* precompiled production server — reads them back with `readResponseStatus`
|
|
20
|
-
* and answers with what it finds.
|
|
21
|
-
*
|
|
22
|
-
* That read-back is the whole point. Recording without it is the failure this
|
|
23
|
-
* module exists to prevent: a page that says 404 renders its not-found body
|
|
24
|
-
* under a 200, which tells a crawler, a cache and an uptime check that the URL
|
|
25
|
-
* is a real page.
|
|
26
|
-
*
|
|
27
|
-
* @module page-response
|
|
28
|
-
*/
|
|
29
|
-
/** Context key holding the status a render asked for. */
|
|
30
|
-
export declare const RESPONSE_STATUS_KEY = "__stxResponseStatus";
|
|
31
|
-
/** Context key holding the headers a render asked for. */
|
|
32
|
-
export declare const RESPONSE_HEADERS_KEY = "__stxResponseHeaders";
|
|
33
1
|
/**
|
|
34
2
|
* Is this a status a response can actually carry?
|
|
35
3
|
*
|
|
@@ -90,9 +58,9 @@ export declare function syncRecordedResponse(from: Record<string, any> | undefin
|
|
|
90
58
|
* them through the render context, which is appended after these and wins.
|
|
91
59
|
*/
|
|
92
60
|
export declare function responseBindings(context: Record<string, any>): {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
setResponseStatus: (status: number) => void
|
|
62
|
+
setResponseHeader: (name: string, value: string) => void
|
|
63
|
+
notFound: (status?: number) => void
|
|
96
64
|
};
|
|
97
65
|
/**
|
|
98
66
|
* `@status(expr)` — the template-side spelling.
|
|
@@ -114,7 +82,8 @@ export declare function responseBindings(context: Record<string, any>): {
|
|
|
114
82
|
* runtime call this one was typed out in the template and a silent no-op there
|
|
115
83
|
* reads as the feature not existing.
|
|
116
84
|
*/
|
|
117
|
-
export declare function processStatusDirective(template: string, context: Record<string, any>, options?: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
85
|
+
export declare function processStatusDirective(template: string, context: Record<string, any>, options?: { filePath?: string, buildMode?: string }): string;
|
|
86
|
+
/** Context key holding the status a render asked for. */
|
|
87
|
+
export declare const RESPONSE_STATUS_KEY: '__stxResponseStatus';
|
|
88
|
+
/** Context key holding the headers a render asked for. */
|
|
89
|
+
export declare const RESPONSE_HEADERS_KEY: '__stxResponseHeaders';
|