@ogygia/core 0.0.0 → 0.11.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 +21 -0
- package/README.md +7 -1
- package/ambient.d.ts +194 -0
- package/dist/ClientBindingStub.svelte +6 -0
- package/dist/ClientBindingStub.svelte.d.ts +26 -0
- package/dist/KeepHost.svelte +19 -0
- package/dist/KeepHost.svelte.d.ts +10 -0
- package/dist/LakeBoundary.svelte +16 -0
- package/dist/LakeBoundary.svelte.d.ts +11 -0
- package/dist/LateIsland.svelte +22 -0
- package/dist/LateIsland.svelte.d.ts +15 -0
- package/dist/LateIslandAwait.svelte +17 -0
- package/dist/LateIslandAwait.svelte.d.ts +15 -0
- package/dist/LiveHost.svelte +19 -0
- package/dist/LiveHost.svelte.d.ts +10 -0
- package/dist/NestedProvider.svelte +13 -0
- package/dist/NestedProvider.svelte.d.ts +8 -0
- package/dist/OgygiaBoundary.svelte +5 -0
- package/dist/OgygiaBoundary.svelte.d.ts +17 -0
- package/dist/PromiseRegion.svelte +40 -0
- package/dist/PromiseRegion.svelte.d.ts +15 -0
- package/dist/PromiseRegionAwait.svelte +27 -0
- package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
- package/dist/Provide.svelte +27 -0
- package/dist/Provide.svelte.d.ts +8 -0
- package/dist/RawHtml.svelte +9 -0
- package/dist/RawHtml.svelte.d.ts +6 -0
- package/dist/Region.svelte +1173 -0
- package/dist/Region.svelte.d.ts +68 -0
- package/dist/SlotBoundary.svelte +13 -0
- package/dist/SlotBoundary.svelte.d.ts +7 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +3 -0
- package/dist/boundary.d.ts +35 -0
- package/dist/boundary.js +127 -0
- package/dist/build-cache.d.ts +13 -0
- package/dist/build-cache.js +77 -0
- package/dist/compiler/blank-styles.d.ts +1 -0
- package/dist/compiler/blank-styles.js +63 -0
- package/dist/compiler/bom.d.ts +2 -0
- package/dist/compiler/bom.js +15 -0
- package/dist/compiler/browser-full.d.ts +8 -0
- package/dist/compiler/browser-full.js +8 -0
- package/dist/compiler/browser.d.ts +11 -0
- package/dist/compiler/browser.js +11 -0
- package/dist/compiler/content/transportables.d.ts +26 -0
- package/dist/compiler/content/transportables.js +219 -0
- package/dist/compiler/ctx.d.ts +180 -0
- package/dist/compiler/ctx.js +183 -0
- package/dist/compiler/debarrel/barrel.d.ts +55 -0
- package/dist/compiler/debarrel/barrel.js +248 -0
- package/dist/compiler/debarrel/options.d.ts +67 -0
- package/dist/compiler/debarrel/options.js +31 -0
- package/dist/compiler/debarrel/parse.d.ts +65 -0
- package/dist/compiler/debarrel/parse.js +256 -0
- package/dist/compiler/debarrel/plugin.d.ts +31 -0
- package/dist/compiler/debarrel/plugin.js +190 -0
- package/dist/compiler/debarrel/rewrite.d.ts +27 -0
- package/dist/compiler/debarrel/rewrite.js +118 -0
- package/dist/compiler/debarrel/svelte.d.ts +13 -0
- package/dist/compiler/debarrel/svelte.js +56 -0
- package/dist/compiler/dev/css-scope.d.ts +16 -0
- package/dist/compiler/dev/css-scope.js +38 -0
- package/dist/compiler/dev/dev-hmr.d.ts +25 -0
- package/dist/compiler/dev/dev-hmr.js +29 -0
- package/dist/compiler/dev/hmr.d.ts +34 -0
- package/dist/compiler/dev/hmr.js +57 -0
- package/dist/compiler/dev/region-bytes.d.ts +34 -0
- package/dist/compiler/dev/region-bytes.js +126 -0
- package/dist/compiler/driver.d.ts +280 -0
- package/dist/compiler/driver.js +1352 -0
- package/dist/compiler/flags.d.ts +16 -0
- package/dist/compiler/flags.js +101 -0
- package/dist/compiler/fouc-css.d.ts +97 -0
- package/dist/compiler/fouc-css.js +335 -0
- package/dist/compiler/free-vars.d.ts +20 -0
- package/dist/compiler/free-vars.js +327 -0
- package/dist/compiler/host.d.ts +65 -0
- package/dist/compiler/host.js +51 -0
- package/dist/compiler/ids.d.ts +84 -0
- package/dist/compiler/ids.js +86 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/kit.d.ts +129 -0
- package/dist/compiler/kit.js +563 -0
- package/dist/compiler/link/build-output.d.ts +44 -0
- package/dist/compiler/link/build-output.js +147 -0
- package/dist/compiler/link/caps.d.ts +48 -0
- package/dist/compiler/link/caps.js +64 -0
- package/dist/compiler/link/context-detect.d.ts +23 -0
- package/dist/compiler/link/context-detect.js +137 -0
- package/dist/compiler/link/emit-gate.d.ts +11 -0
- package/dist/compiler/link/emit-gate.js +40 -0
- package/dist/compiler/link/entry-shim.d.ts +4 -0
- package/dist/compiler/link/entry-shim.js +29 -0
- package/dist/compiler/link/island-deps.d.ts +142 -0
- package/dist/compiler/link/island-deps.js +525 -0
- package/dist/compiler/link/manifest.d.ts +5 -0
- package/dist/compiler/link/manifest.js +9 -0
- package/dist/compiler/link/page-keys.d.ts +64 -0
- package/dist/compiler/link/page-keys.js +683 -0
- package/dist/compiler/link/registry-stub.d.ts +41 -0
- package/dist/compiler/link/registry-stub.js +212 -0
- package/dist/compiler/link/router-config.d.ts +11 -0
- package/dist/compiler/link/router-config.js +15 -0
- package/dist/compiler/link/router-css.d.ts +22 -0
- package/dist/compiler/link/router-css.js +142 -0
- package/dist/compiler/link/runtime-entry.d.ts +71 -0
- package/dist/compiler/link/runtime-entry.js +132 -0
- package/dist/compiler/link/server-manifest.d.ts +12 -0
- package/dist/compiler/link/server-manifest.js +45 -0
- package/dist/compiler/link/speculation.d.ts +17 -0
- package/dist/compiler/link/speculation.js +36 -0
- package/dist/compiler/link/transport.d.ts +31 -0
- package/dist/compiler/link/transport.js +67 -0
- package/dist/compiler/macros/bake.d.ts +20 -0
- package/dist/compiler/macros/bake.js +317 -0
- package/dist/compiler/macros/browser.d.ts +11 -0
- package/dist/compiler/macros/browser.js +69 -0
- package/dist/compiler/macros/dedent.d.ts +12 -0
- package/dist/compiler/macros/dedent.js +36 -0
- package/dist/compiler/macros/dollar.d.ts +15 -0
- package/dist/compiler/macros/dollar.js +387 -0
- package/dist/compiler/macros/pipeline.d.ts +31 -0
- package/dist/compiler/macros/pipeline.js +106 -0
- package/dist/compiler/macros/source.d.ts +6 -0
- package/dist/compiler/macros/source.js +127 -0
- package/dist/compiler/macros/store.d.ts +17 -0
- package/dist/compiler/macros/store.js +244 -0
- package/dist/compiler/macros/wire.d.ts +14 -0
- package/dist/compiler/macros/wire.js +160 -0
- package/dist/compiler/ownership-stamps.d.ts +6 -0
- package/dist/compiler/ownership-stamps.js +144 -0
- package/dist/compiler/parse/oxc.d.ts +34 -0
- package/dist/compiler/parse/oxc.js +59 -0
- package/dist/compiler/parse/scan.d.ts +43 -0
- package/dist/compiler/parse/scan.js +232 -0
- package/dist/compiler/program.d.ts +140 -0
- package/dist/compiler/program.js +242 -0
- package/dist/compiler/region/emit.d.ts +169 -0
- package/dist/compiler/region/emit.js +286 -0
- package/dist/compiler/region/identity.d.ts +28 -0
- package/dist/compiler/region/identity.js +75 -0
- package/dist/compiler/region/ir.d.ts +65 -0
- package/dist/compiler/region/ir.js +0 -0
- package/dist/compiler/region/transform.d.ts +178 -0
- package/dist/compiler/region/transform.js +1933 -0
- package/dist/compiler/script-request.d.ts +1 -0
- package/dist/compiler/script-request.js +43 -0
- package/dist/context-bridge.d.ts +65 -0
- package/dist/context-bridge.js +217 -0
- package/dist/context-registry.d.ts +40 -0
- package/dist/context-registry.js +15 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +158 -0
- package/dist/current-region.d.ts +14 -0
- package/dist/current-region.js +36 -0
- package/dist/document.d.ts +41 -0
- package/dist/document.js +125 -0
- package/dist/entry-hydrate.d.ts +5 -0
- package/dist/entry-hydrate.js +42 -0
- package/dist/escape.d.ts +18 -0
- package/dist/escape.js +37 -0
- package/dist/events/bus.d.ts +33 -0
- package/dist/events/bus.js +153 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +4 -0
- package/dist/events/schema.d.ts +389 -0
- package/dist/events/schema.js +23 -0
- package/dist/events/server-registry.d.ts +7 -0
- package/dist/events/server-registry.js +13 -0
- package/dist/events/sinks.d.ts +64 -0
- package/dist/events/sinks.js +85 -0
- package/dist/fn-transport.d.ts +33 -0
- package/dist/fn-transport.js +140 -0
- package/dist/frame.d.ts +20 -0
- package/dist/frame.js +19 -0
- package/dist/holes-record.d.ts +6 -0
- package/dist/holes-record.js +8 -0
- package/dist/hooks.d.ts +43 -0
- package/dist/hooks.js +1191 -0
- package/dist/hydration-info.d.ts +1 -0
- package/dist/hydration-info.js +31 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/insights/attr-rules.d.ts +15 -0
- package/dist/insights/attr-rules.js +27 -0
- package/dist/insights/cpu.d.ts +82 -0
- package/dist/insights/cpu.js +177 -0
- package/dist/insights/fp-drift.d.ts +28 -0
- package/dist/insights/fp-drift.js +148 -0
- package/dist/insights/hole-segments.d.ts +26 -0
- package/dist/insights/hole-segments.js +50 -0
- package/dist/insights/html-diff.d.ts +25 -0
- package/dist/insights/html-diff.js +157 -0
- package/dist/insights/hydration-hazards.d.ts +36 -0
- package/dist/insights/hydration-hazards.js +136 -0
- package/dist/insights/hydration-status.d.ts +2 -0
- package/dist/insights/hydration-status.js +0 -0
- package/dist/insights/index.d.ts +14 -0
- package/dist/insights/index.js +12 -0
- package/dist/insights/page-assets.d.ts +211 -0
- package/dist/insights/page-assets.js +608 -0
- package/dist/insights/page-insights.d.ts +749 -0
- package/dist/insights/page-insights.js +2157 -0
- package/dist/insights/session-data.d.ts +108 -0
- package/dist/insights/session-data.js +0 -0
- package/dist/insights/session-insights.d.ts +121 -0
- package/dist/insights/session-insights.js +548 -0
- package/dist/insights/switch.d.ts +53 -0
- package/dist/insights/switch.js +91 -0
- package/dist/insights/testing-version.d.ts +19 -0
- package/dist/insights/testing-version.js +21 -0
- package/dist/insights/third-party.d.ts +75 -0
- package/dist/insights/third-party.js +160 -0
- package/dist/internal-instruments.d.ts +13 -0
- package/dist/internal-instruments.js +12 -0
- package/dist/internal-reconcile.d.ts +3 -0
- package/dist/internal-reconcile.js +3 -0
- package/dist/internal-register.d.ts +7 -0
- package/dist/internal-register.js +7 -0
- package/dist/internal-server.d.ts +7 -0
- package/dist/internal-server.js +7 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +13 -0
- package/dist/island-graph.d.ts +36 -0
- package/dist/island-graph.js +89 -0
- package/dist/keep-fallback-marker.d.ts +7 -0
- package/dist/keep-fallback-marker.js +9 -0
- package/dist/keep-fallback.d.ts +13 -0
- package/dist/keep-fallback.js +39 -0
- package/dist/kit-paths.d.ts +2 -0
- package/dist/kit-paths.js +39 -0
- package/dist/late-region-registry.d.ts +40 -0
- package/dist/late-region-registry.js +36 -0
- package/dist/live-transport.d.ts +57 -0
- package/dist/live-transport.js +145 -0
- package/dist/markup.d.ts +4 -0
- package/dist/markup.js +4 -0
- package/dist/own-package.d.ts +15 -0
- package/dist/own-package.js +20 -0
- package/dist/page-defer.d.ts +33 -0
- package/dist/page-defer.js +35 -0
- package/dist/page-facts-script.d.ts +7 -0
- package/dist/page-facts-script.js +9 -0
- package/dist/page-seed-registry.d.ts +72 -0
- package/dist/page-seed-registry.js +31 -0
- package/dist/plugin/capability.d.ts +14 -0
- package/dist/plugin/capability.js +44 -0
- package/dist/plugin/client.d.ts +39 -0
- package/dist/plugin/client.js +6 -0
- package/dist/plugin/css.d.ts +3 -0
- package/dist/plugin/css.js +54 -0
- package/dist/plugin/facts.d.ts +42 -0
- package/dist/plugin/facts.js +37 -0
- package/dist/plugin/hooks.d.ts +33 -0
- package/dist/plugin/hooks.js +38 -0
- package/dist/plugin/index.d.ts +127 -0
- package/dist/plugin/index.js +26 -0
- package/dist/plugin/routes.d.ts +32 -0
- package/dist/plugin/routes.js +35 -0
- package/dist/plugin/server.d.ts +27 -0
- package/dist/plugin/server.js +92 -0
- package/dist/plugin/standard-schema.d.ts +27 -0
- package/dist/plugin/standard-schema.js +0 -0
- package/dist/plugin/testing.d.ts +13 -0
- package/dist/plugin/testing.js +54 -0
- package/dist/plugin/utils.d.ts +13 -0
- package/dist/plugin/utils.js +19 -0
- package/dist/portable-form.d.ts +22 -0
- package/dist/portable-form.js +52 -0
- package/dist/preference.d.ts +35 -0
- package/dist/preference.js +84 -0
- package/dist/preload.d.ts +1 -0
- package/dist/preload.js +21 -0
- package/dist/ref-watch.d.ts +31 -0
- package/dist/ref-watch.js +66 -0
- package/dist/ref.d.ts +124 -0
- package/dist/ref.js +272 -0
- package/dist/region-brand.d.ts +8 -0
- package/dist/region-brand.js +10 -0
- package/dist/region-core.d.ts +2 -0
- package/dist/region-core.js +1 -0
- package/dist/region-snippet.d.ts +73 -0
- package/dist/region-snippet.js +351 -0
- package/dist/region.d.ts +127 -0
- package/dist/region.js +162 -0
- package/dist/request-event.d.ts +1 -0
- package/dist/request-event.js +37 -0
- package/dist/router-css.d.ts +39 -0
- package/dist/router-css.js +66 -0
- package/dist/runtime/app-transport.d.ts +2 -0
- package/dist/runtime/app-transport.js +13 -0
- package/dist/runtime/beacon.d.ts +271 -0
- package/dist/runtime/beacon.js +2190 -0
- package/dist/runtime/boot-link.d.ts +1 -0
- package/dist/runtime/boot-link.js +44 -0
- package/dist/runtime/client-hooks.d.ts +5 -0
- package/dist/runtime/client-hooks.js +22 -0
- package/dist/runtime/client-plugins.d.ts +8 -0
- package/dist/runtime/client-plugins.js +34 -0
- package/dist/runtime/concurrency.d.ts +12 -0
- package/dist/runtime/concurrency.js +29 -0
- package/dist/runtime/connected.d.ts +12 -0
- package/dist/runtime/connected.js +16 -0
- package/dist/runtime/context.d.ts +1 -0
- package/dist/runtime/context.js +19 -0
- package/dist/runtime/core.d.ts +15 -0
- package/dist/runtime/core.js +1173 -0
- package/dist/runtime/drift-watch.d.ts +9 -0
- package/dist/runtime/drift-watch.js +60 -0
- package/dist/runtime/entry-locations.d.ts +33 -0
- package/dist/runtime/entry-locations.js +119 -0
- package/dist/runtime/foreign-props.d.ts +8 -0
- package/dist/runtime/foreign-props.js +14 -0
- package/dist/runtime/form-continuity.d.ts +10 -0
- package/dist/runtime/form-continuity.js +107 -0
- package/dist/runtime/frame-nav.d.ts +36 -0
- package/dist/runtime/frame-nav.js +225 -0
- package/dist/runtime/frame-store.d.ts +62 -0
- package/dist/runtime/frame-store.js +214 -0
- package/dist/runtime/frames.d.ts +1 -0
- package/dist/runtime/frames.js +25 -0
- package/dist/runtime/full.d.ts +4 -0
- package/dist/runtime/full.js +32 -0
- package/dist/runtime/hash.d.ts +41 -0
- package/dist/runtime/hash.js +79 -0
- package/dist/runtime/hole-facts.d.ts +8 -0
- package/dist/runtime/hole-facts.js +57 -0
- package/dist/runtime/host-classes.d.ts +24 -0
- package/dist/runtime/host-classes.js +43 -0
- package/dist/runtime/hydrate-core.d.ts +101 -0
- package/dist/runtime/hydrate-core.js +605 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/interaction-replay.d.ts +11 -0
- package/dist/runtime/interaction-replay.js +70 -0
- package/dist/runtime/interaction.d.ts +33 -0
- package/dist/runtime/interaction.js +217 -0
- package/dist/runtime/island-graph-preload.d.ts +13 -0
- package/dist/runtime/island-graph-preload.js +99 -0
- package/dist/runtime/kit-boot.d.ts +29 -0
- package/dist/runtime/kit-boot.js +60 -0
- package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
- package/dist/runtime/kit-page-thread.svelte.js +116 -0
- package/dist/runtime/lake-anchors.d.ts +13 -0
- package/dist/runtime/lake-anchors.js +19 -0
- package/dist/runtime/lakes.d.ts +15 -0
- package/dist/runtime/lakes.js +212 -0
- package/dist/runtime/live.d.ts +3 -0
- package/dist/runtime/live.js +17 -0
- package/dist/runtime/load-scheduler.d.ts +53 -0
- package/dist/runtime/load-scheduler.js +317 -0
- package/dist/runtime/morph.d.ts +42 -0
- package/dist/runtime/morph.js +671 -0
- package/dist/runtime/nav-handle.d.ts +25 -0
- package/dist/runtime/nav-handle.js +71 -0
- package/dist/runtime/nav-hooks.d.ts +2 -0
- package/dist/runtime/nav-hooks.js +23 -0
- package/dist/runtime/nearest-attr.d.ts +4 -0
- package/dist/runtime/nearest-attr.js +16 -0
- package/dist/runtime/observe.d.ts +27 -0
- package/dist/runtime/observe.js +63 -0
- package/dist/runtime/own-cost.d.ts +9 -0
- package/dist/runtime/own-cost.js +35 -0
- package/dist/runtime/ownership.d.ts +101 -0
- package/dist/runtime/ownership.js +115 -0
- package/dist/runtime/page-cache.d.ts +23 -0
- package/dist/runtime/page-cache.js +74 -0
- package/dist/runtime/page-defer.d.ts +14 -0
- package/dist/runtime/page-defer.js +103 -0
- package/dist/runtime/parse-html.d.ts +40 -0
- package/dist/runtime/parse-html.js +81 -0
- package/dist/runtime/reconcile.d.ts +41 -0
- package/dist/runtime/reconcile.js +194 -0
- package/dist/runtime/region-attrs.d.ts +95 -0
- package/dist/runtime/region-attrs.js +153 -0
- package/dist/runtime/region-endpoint-url.d.ts +76 -0
- package/dist/runtime/region-endpoint-url.js +169 -0
- package/dist/runtime/region-ids.d.ts +8 -0
- package/dist/runtime/region-ids.js +33 -0
- package/dist/runtime/remote-seeds.d.ts +2 -0
- package/dist/runtime/remote-seeds.js +21 -0
- package/dist/runtime/render-blocking.d.ts +2 -0
- package/dist/runtime/render-blocking.js +30 -0
- package/dist/runtime/restore.d.ts +34 -0
- package/dist/runtime/restore.js +390 -0
- package/dist/runtime/router-nav.d.ts +63 -0
- package/dist/runtime/router-nav.js +740 -0
- package/dist/runtime/router.d.ts +201 -0
- package/dist/runtime/router.js +593 -0
- package/dist/runtime/schedule.d.ts +49 -0
- package/dist/runtime/schedule.js +256 -0
- package/dist/runtime/seeds.d.ts +50 -0
- package/dist/runtime/seeds.js +208 -0
- package/dist/runtime/session.d.ts +52 -0
- package/dist/runtime/session.js +130 -0
- package/dist/runtime/sidecar.d.ts +3 -0
- package/dist/runtime/sidecar.js +56 -0
- package/dist/runtime/slots.d.ts +183 -0
- package/dist/runtime/slots.js +44 -0
- package/dist/runtime/spa-cacheable.d.ts +7 -0
- package/dist/runtime/spa-cacheable.js +18 -0
- package/dist/runtime/speculate-hint.d.ts +1 -0
- package/dist/runtime/speculate-hint.js +35 -0
- package/dist/runtime/svelte-warnings.d.ts +28 -0
- package/dist/runtime/svelte-warnings.js +71 -0
- package/dist/runtime/wire-classes.d.ts +3 -0
- package/dist/runtime/wire-classes.js +69 -0
- package/dist/runtime/wire-format.d.ts +7 -0
- package/dist/runtime/wire-format.js +22 -0
- package/dist/script.d.ts +134 -0
- package/dist/script.js +184 -0
- package/dist/seed-refs.d.ts +105 -0
- package/dist/seed-refs.js +487 -0
- package/dist/server/capability-lifetime.d.ts +28 -0
- package/dist/server/capability-lifetime.js +31 -0
- package/dist/server/dead-kit-resolves.d.ts +1 -0
- package/dist/server/dead-kit-resolves.js +39 -0
- package/dist/server/document-assembly.d.ts +30 -0
- package/dist/server/document-assembly.js +26 -0
- package/dist/server/document-tail.d.ts +113 -0
- package/dist/server/document-tail.js +208 -0
- package/dist/server/endpoint.d.ts +51 -0
- package/dist/server/endpoint.js +90 -0
- package/dist/server/entry-location.d.ts +8 -0
- package/dist/server/entry-location.js +29 -0
- package/dist/server/fingerprint.d.ts +1 -0
- package/dist/server/fingerprint.js +25 -0
- package/dist/server/head-presence.d.ts +45 -0
- package/dist/server/head-presence.js +156 -0
- package/dist/server/hmac.d.ts +38 -0
- package/dist/server/hmac.js +89 -0
- package/dist/server/hole-graph.d.ts +7 -0
- package/dist/server/hole-graph.js +71 -0
- package/dist/server/hole-urls.d.ts +3 -0
- package/dist/server/hole-urls.js +76 -0
- package/dist/server/html-scan.d.ts +19 -0
- package/dist/server/html-scan.js +60 -0
- package/dist/server/kit-context.d.ts +78 -0
- package/dist/server/kit-context.js +110 -0
- package/dist/server/late-wire.d.ts +22 -0
- package/dist/server/late-wire.js +28 -0
- package/dist/server/page-facts.d.ts +25 -0
- package/dist/server/page-facts.js +138 -0
- package/dist/server/page-seed.d.ts +33 -0
- package/dist/server/page-seed.js +60 -0
- package/dist/server/page-stream.d.ts +55 -0
- package/dist/server/page-stream.js +121 -0
- package/dist/server/payload.d.ts +6 -0
- package/dist/server/payload.js +22 -0
- package/dist/server/personal-response.d.ts +6 -0
- package/dist/server/personal-response.js +13 -0
- package/dist/server/props-wire.d.ts +56 -0
- package/dist/server/props-wire.js +178 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +63 -0
- package/dist/server/region-css.d.ts +5 -0
- package/dist/server/region-css.js +30 -0
- package/dist/server/region-endpoint.d.ts +35 -0
- package/dist/server/region-endpoint.js +142 -0
- package/dist/server/region-props.d.ts +6 -0
- package/dist/server/region-props.js +44 -0
- package/dist/server/remote-seed-gate.d.ts +50 -0
- package/dist/server/remote-seed-gate.js +66 -0
- package/dist/server/render-cache.d.ts +26 -0
- package/dist/server/render-cache.js +51 -0
- package/dist/server/render-page.d.ts +51 -0
- package/dist/server/render-page.js +176 -0
- package/dist/server/render-region-html.d.ts +2 -0
- package/dist/server/render-region-html.js +19 -0
- package/dist/server/request-stats.d.ts +174 -0
- package/dist/server/request-stats.js +54 -0
- package/dist/server/reversible.d.ts +83 -0
- package/dist/server/reversible.js +994 -0
- package/dist/server/seed-shape.d.ts +22 -0
- package/dist/server/seed-shape.js +24 -0
- package/dist/server/shared-cache.d.ts +35 -0
- package/dist/server/shared-cache.js +104 -0
- package/dist/server/signing-key.d.ts +11 -0
- package/dist/server/signing-key.js +47 -0
- package/dist/server/sized-lru.d.ts +20 -0
- package/dist/server/sized-lru.js +68 -0
- package/dist/server/split-regions.d.ts +81 -0
- package/dist/server/split-regions.js +368 -0
- package/dist/server/stream-regions.d.ts +5 -0
- package/dist/server/stream-regions.js +36 -0
- package/dist/shared-state.d.ts +7 -0
- package/dist/shared-state.js +152 -0
- package/dist/shims/app-environment.d.ts +4 -0
- package/dist/shims/app-environment.js +6 -0
- package/dist/shims/app-navigation.d.ts +33 -0
- package/dist/shims/app-navigation.js +119 -0
- package/dist/shims/app-paths.d.ts +6 -0
- package/dist/shims/app-paths.js +18 -0
- package/dist/shims/app-state.svelte.d.ts +23 -0
- package/dist/shims/app-state.svelte.js +50 -0
- package/dist/shims/app-stores.d.ts +21 -0
- package/dist/shims/app-stores.js +54 -0
- package/dist/shims/kit-bridge.d.ts +29 -0
- package/dist/shims/kit-bridge.js +7 -0
- package/dist/shims/kit-remote/client-stub.d.ts +27 -0
- package/dist/shims/kit-remote/client-stub.js +43 -0
- package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
- package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
- package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
- package/dist/shims/kit-remote/remote-cache.js +73 -0
- package/dist/shims/kit-remote/state-stub.d.ts +8 -0
- package/dist/shims/kit-remote/state-stub.js +8 -0
- package/dist/shims/page-store.svelte.d.ts +39 -0
- package/dist/shims/page-store.svelte.js +77 -0
- package/dist/source.d.ts +29 -0
- package/dist/source.js +87 -0
- package/dist/store-transport.d.ts +86 -0
- package/dist/store-transport.js +229 -0
- package/dist/tool-fetches.d.ts +5 -0
- package/dist/tool-fetches.js +41 -0
- package/dist/transport.d.ts +48 -0
- package/dist/transport.js +181 -0
- package/dist/unscoped-css.d.ts +26 -0
- package/dist/unscoped-css.js +53 -0
- package/dist/vite/dev-maps.d.ts +33 -0
- package/dist/vite/dev-maps.js +140 -0
- package/dist/vite/index.d.ts +19 -0
- package/dist/vite/index.js +820 -0
- package/dist/vite/kit-dirs.d.ts +7 -0
- package/dist/vite/kit-dirs.js +67 -0
- package/dist/vite/late-island.d.ts +25 -0
- package/dist/vite/late-island.js +33 -0
- package/dist/vite/module-map.d.ts +8 -0
- package/dist/vite/module-map.js +144 -0
- package/dist/vite/options.d.ts +208 -0
- package/dist/vite/options.js +74 -0
- package/dist/vite/package-files.d.ts +3 -0
- package/dist/vite/package-files.js +84 -0
- package/dist/vite/paths.d.ts +45 -0
- package/dist/vite/paths.js +112 -0
- package/dist/vite/plugin-api.d.ts +166 -0
- package/dist/vite/plugin-api.js +212 -0
- package/dist/vite/profiler-maps.d.ts +23 -0
- package/dist/vite/profiler-maps.js +178 -0
- package/dist/vite/server-sourcemaps.d.ts +8 -0
- package/dist/vite/server-sourcemaps.js +80 -0
- package/dist/vite/sourcemaps.d.ts +18 -0
- package/dist/vite/sourcemaps.js +80 -0
- package/dist/vite/style-preprocess.d.ts +2 -0
- package/dist/vite/style-preprocess.js +96 -0
- package/package.json +180 -6
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { PAGE_DEFER_BOOTSTRAP, PAGE_DEFER_GLOBAL, PAGE_DEFER_KEY, PAGE_DEFER_REGISTRY_KEY, PAGE_SETTLED_KEY } from "../page-defer.js";
|
|
2
|
+
import { parse } from "devalue";
|
|
3
|
+
// src/runtime/page-defer.ts
|
|
4
|
+
/**
|
|
5
|
+
* Client side of streaming `$page.data` promises into islands (see `../page-defer.ts` for the why).
|
|
6
|
+
*
|
|
7
|
+
* The page seed carries a DEFER MARKER (`[id]`) for each pending promise; the reviver turns it into a
|
|
8
|
+
* real pending Promise, so an island's `{#await page.data.x}` renders its pending branch. As each
|
|
9
|
+
* promise settles the server streams `<script>__ogygia_page_resolve(id, ok, encoded)<\/script>`, which
|
|
10
|
+
* resolves the matching Promise — the `{#await}` flips to its resolved branch, live.
|
|
11
|
+
*
|
|
12
|
+
* Ordering is fully decoupled: an inline bootstrap (first body chunk) defines the resolve global and
|
|
13
|
+
* QUEUES calls until the runtime installs the live parser; the reviver may create a deferred before or
|
|
14
|
+
* after its resolve arrives. One registry per document via a Symbol.for handle (dev evaluates the
|
|
15
|
+
* runtime twice — a module-local map would split; PAGE-STATE-SINGLETON).
|
|
16
|
+
*/
|
|
17
|
+
function reg() {
|
|
18
|
+
const g = globalThis;
|
|
19
|
+
return g[PAGE_DEFER_REGISTRY_KEY] ??= {};
|
|
20
|
+
}
|
|
21
|
+
function to_error(value) {
|
|
22
|
+
const msg = value && typeof value === "object" && "message" in value ? String(value.message) : "ogygia: streamed promise rejected";
|
|
23
|
+
return new Error(msg);
|
|
24
|
+
}
|
|
25
|
+
/** Reviver: a defer marker `[id]` becomes a real Promise, pending until its resolve script lands (or
|
|
26
|
+
* already-resolved if the resolve raced ahead of the seed). */
|
|
27
|
+
function create_deferred(id) {
|
|
28
|
+
const r = reg();
|
|
29
|
+
const deferreds = r.deferreds ??= /* @__PURE__ */ new Map();
|
|
30
|
+
const existing = deferreds.get(id);
|
|
31
|
+
if (existing) return existing.promise;
|
|
32
|
+
const early = r.settled?.get(id);
|
|
33
|
+
if (early) {
|
|
34
|
+
r.settled.delete(id);
|
|
35
|
+
if (early.ok) return Promise.resolve(early.value);
|
|
36
|
+
const p = Promise.reject(to_error(early.value));
|
|
37
|
+
p.catch(() => {});
|
|
38
|
+
return p;
|
|
39
|
+
}
|
|
40
|
+
let resolve;
|
|
41
|
+
let reject;
|
|
42
|
+
const promise = new Promise((res, rej) => {
|
|
43
|
+
resolve = res;
|
|
44
|
+
reject = rej;
|
|
45
|
+
});
|
|
46
|
+
promise.catch(() => {});
|
|
47
|
+
deferreds.set(id, {
|
|
48
|
+
promise,
|
|
49
|
+
resolve,
|
|
50
|
+
reject
|
|
51
|
+
});
|
|
52
|
+
return promise;
|
|
53
|
+
}
|
|
54
|
+
function settle(id, ok, value) {
|
|
55
|
+
const r = reg();
|
|
56
|
+
const d = r.deferreds?.get(id);
|
|
57
|
+
if (d) {
|
|
58
|
+
r.deferreds.delete(id);
|
|
59
|
+
if (ok) d.resolve(value);
|
|
60
|
+
else d.reject(to_error(value));
|
|
61
|
+
} else (r.settled ??= /* @__PURE__ */ new Map()).set(id, {
|
|
62
|
+
ok,
|
|
63
|
+
value
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** Install the live resolver (which parses the encoded value) and drain anything the inline bootstrap
|
|
67
|
+
* queued before the runtime loaded. `extra_revivers` are the app's transport decoders (custom types in
|
|
68
|
+
* a streamed value). Idempotent — safe to call on every boot; the first call's revivers win. */
|
|
69
|
+
function install_page_defer(extra_revivers) {
|
|
70
|
+
const r = reg();
|
|
71
|
+
if (r.live) return;
|
|
72
|
+
r.revivers = page_defer_revivers(extra_revivers);
|
|
73
|
+
r.live = (id, ok, encoded) => {
|
|
74
|
+
let value = null;
|
|
75
|
+
try {
|
|
76
|
+
value = parse(encoded, r.revivers);
|
|
77
|
+
} catch {}
|
|
78
|
+
settle(id, ok, value);
|
|
79
|
+
};
|
|
80
|
+
const queued = r.q;
|
|
81
|
+
r.q = [];
|
|
82
|
+
if (queued) for (const [id, ok, encoded] of queued) r.live(id, ok, encoded);
|
|
83
|
+
const g = globalThis;
|
|
84
|
+
g[PAGE_DEFER_GLOBAL] ??= (id, ok, encoded) => r.live(id, ok, encoded);
|
|
85
|
+
}
|
|
86
|
+
/** devalue reviver map for the page seed. A DEFER marker becomes a pending Promise (streaming path); a
|
|
87
|
+
* SETTLED marker becomes an already resolved/rejected Promise (non-navigate path). Both keep
|
|
88
|
+
* `page.data.x` a Promise, so `{#await}` works identically regardless of how the page was requested.
|
|
89
|
+
* `extra` merges the app's transport decoders; ogygia's own keys always win on any name clash. */
|
|
90
|
+
function page_defer_revivers(extra) {
|
|
91
|
+
return {
|
|
92
|
+
...extra,
|
|
93
|
+
[PAGE_DEFER_KEY]: (payload) => create_deferred(payload[0]),
|
|
94
|
+
[PAGE_SETTLED_KEY]: (payload) => {
|
|
95
|
+
const [ok, value] = payload;
|
|
96
|
+
if (ok) return Promise.resolve(value);
|
|
97
|
+
const p = Promise.reject(to_error(value));
|
|
98
|
+
p.catch(() => {});
|
|
99
|
+
return p;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export { PAGE_DEFER_BOOTSTRAP, create_deferred, install_page_defer, page_defer_revivers };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE one place region / SSR HTML becomes DOM. A leaf module (no imports) so every parse site shares
|
|
3
|
+
* it: `region_fragment` (a fetched hole / live tick / held region), `repair_if_drifted` (the server
|
|
4
|
+
* copy an island hydrates against), and anything added later. Having ONE parser is the point — a second,
|
|
5
|
+
* DSD-unaware one would silently drift (see below).
|
|
6
|
+
*
|
|
7
|
+
* `<template shadowrootmode>` (declarative shadow DOM — a web STANDARD, nothing library-specific) turns
|
|
8
|
+
* into a real shadow root ONLY when a DSD-aware parser reads it. `Element.setHTMLUnsafe()` is that
|
|
9
|
+
* parser — the very algorithm the document uses on first load — so a server-painted region body arrives
|
|
10
|
+
* with its shadow roots live, exactly as the initial page paints. `createContextualFragment` /
|
|
11
|
+
* `innerHTML` / `DOMParser` are all DSD-UNAWARE by spec: they leave the `<template>` inert, so any host
|
|
12
|
+
* that renders its box from inside its shadow paints at 0 height until its own runtime upgrades it (the
|
|
13
|
+
* swap-then-blank-then-paint flicker). "Unsafe" means only "no sanitizer"; a region body is our own
|
|
14
|
+
* signed, same-origin SSR (HOLE-TRUST), so it is exactly as trusted as the page itself.
|
|
15
|
+
*
|
|
16
|
+
* NOTE the parse happens in a `<template>`'s inert content, so custom elements do NOT upgrade here
|
|
17
|
+
* (no `connectedCallback`) — attaching a declarative shadow root is a parse step, not an upgrade. That
|
|
18
|
+
* is what `repair_if_drifted` needs: the server copy stays inert, but its light-DOM sequence is now
|
|
19
|
+
* DSD-consistent with a live region whose hosts already carry shadow roots.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parse_region_html(html: string): DocumentFragment;
|
|
22
|
+
/** The spec's declarative-shadow-DOM attach step, for engines that render DSD on first parse but predate
|
|
23
|
+
* `setHTMLUnsafe`. Recurse into each shadow we attach: `querySelectorAll` stops at shadow boundaries,
|
|
24
|
+
* and a `<template shadowrootmode>` can nest inside another. First template per host wins (a host already
|
|
25
|
+
* carrying a shadow root is left as is). */
|
|
26
|
+
export declare function attach_declarative_shadows(root: DocumentFragment | ShadowRoot): void;
|
|
27
|
+
/** The app's transform reshaped this markup (server/reversible.ts): restore it before anything reads
|
|
28
|
+
* it. The restorer is the page's own (the handle inlines it only when the app has a transform), so
|
|
29
|
+
* the runtime carries none of it — without one, this is a no-op. */
|
|
30
|
+
export declare function restore_markup(root: ParentNode): void;
|
|
31
|
+
/** Adopt the keyed sheets of roots restored outside the page, right after their insertion. */
|
|
32
|
+
export declare function restore_adopt_sheets(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Shadow roots attached while the markup sat in an inert document — a declarative shadow root the
|
|
35
|
+
* parse above attached, a restored one — get no custom element registry in a browser with scoped
|
|
36
|
+
* registries, and keep none once inserted: nothing inside them upgrades (an element that calls
|
|
37
|
+
* `attachInternals` in its constructor throws). Give each the page's registry, right after the
|
|
38
|
+
* insertion. A browser without scoped registries never nulls it (and has no `initialize`): a no-op.
|
|
39
|
+
*/
|
|
40
|
+
export declare function init_shadow_registries(under: Node): void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// src/runtime/parse-html.ts
|
|
2
|
+
/**
|
|
3
|
+
* THE one place region / SSR HTML becomes DOM. A leaf module (no imports) so every parse site shares
|
|
4
|
+
* it: `region_fragment` (a fetched hole / live tick / held region), `repair_if_drifted` (the server
|
|
5
|
+
* copy an island hydrates against), and anything added later. Having ONE parser is the point — a second,
|
|
6
|
+
* DSD-unaware one would silently drift (see below).
|
|
7
|
+
*
|
|
8
|
+
* `<template shadowrootmode>` (declarative shadow DOM — a web STANDARD, nothing library-specific) turns
|
|
9
|
+
* into a real shadow root ONLY when a DSD-aware parser reads it. `Element.setHTMLUnsafe()` is that
|
|
10
|
+
* parser — the very algorithm the document uses on first load — so a server-painted region body arrives
|
|
11
|
+
* with its shadow roots live, exactly as the initial page paints. `createContextualFragment` /
|
|
12
|
+
* `innerHTML` / `DOMParser` are all DSD-UNAWARE by spec: they leave the `<template>` inert, so any host
|
|
13
|
+
* that renders its box from inside its shadow paints at 0 height until its own runtime upgrades it (the
|
|
14
|
+
* swap-then-blank-then-paint flicker). "Unsafe" means only "no sanitizer"; a region body is our own
|
|
15
|
+
* signed, same-origin SSR (HOLE-TRUST), so it is exactly as trusted as the page itself.
|
|
16
|
+
*
|
|
17
|
+
* NOTE the parse happens in a `<template>`'s inert content, so custom elements do NOT upgrade here
|
|
18
|
+
* (no `connectedCallback`) — attaching a declarative shadow root is a parse step, not an upgrade. That
|
|
19
|
+
* is what `repair_if_drifted` needs: the server copy stays inert, but its light-DOM sequence is now
|
|
20
|
+
* DSD-consistent with a live region whose hosts already carry shadow roots.
|
|
21
|
+
*/
|
|
22
|
+
function parse_region_html(html) {
|
|
23
|
+
const tpl = document.createElement("template");
|
|
24
|
+
const set_html_unsafe = tpl.setHTMLUnsafe;
|
|
25
|
+
if (typeof set_html_unsafe === "function") set_html_unsafe.call(tpl, html);
|
|
26
|
+
else {
|
|
27
|
+
tpl.innerHTML = html;
|
|
28
|
+
attach_declarative_shadows(tpl.content);
|
|
29
|
+
}
|
|
30
|
+
return tpl.content;
|
|
31
|
+
}
|
|
32
|
+
/** The spec's declarative-shadow-DOM attach step, for engines that render DSD on first parse but predate
|
|
33
|
+
* `setHTMLUnsafe`. Recurse into each shadow we attach: `querySelectorAll` stops at shadow boundaries,
|
|
34
|
+
* and a `<template shadowrootmode>` can nest inside another. First template per host wins (a host already
|
|
35
|
+
* carrying a shadow root is left as is). */
|
|
36
|
+
function attach_declarative_shadows(root) {
|
|
37
|
+
for (const node of Array.from(root.querySelectorAll("template[shadowrootmode]"))) {
|
|
38
|
+
const tpl = node;
|
|
39
|
+
const host = tpl.parentElement;
|
|
40
|
+
tpl.remove();
|
|
41
|
+
if (!host || host.shadowRoot) continue;
|
|
42
|
+
const shadow = host.attachShadow({
|
|
43
|
+
mode: tpl.getAttribute("shadowrootmode") === "closed" ? "closed" : "open",
|
|
44
|
+
delegatesFocus: tpl.hasAttribute("shadowrootdelegatesfocus")
|
|
45
|
+
});
|
|
46
|
+
shadow.append(tpl.content);
|
|
47
|
+
attach_declarative_shadows(shadow);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** The app's transform reshaped this markup (server/reversible.ts): restore it before anything reads
|
|
51
|
+
* it. The restorer is the page's own (the handle inlines it only when the app has a transform), so
|
|
52
|
+
* the runtime carries none of it — without one, this is a no-op. */
|
|
53
|
+
function restore_markup(root) {
|
|
54
|
+
globalThis.__og_restore?.(root);
|
|
55
|
+
}
|
|
56
|
+
/** Adopt the keyed sheets of roots restored outside the page, right after their insertion. */
|
|
57
|
+
function restore_adopt_sheets() {
|
|
58
|
+
globalThis.__og_restore_adopt?.();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Shadow roots attached while the markup sat in an inert document — a declarative shadow root the
|
|
62
|
+
* parse above attached, a restored one — get no custom element registry in a browser with scoped
|
|
63
|
+
* registries, and keep none once inserted: nothing inside them upgrades (an element that calls
|
|
64
|
+
* `attachInternals` in its constructor throws). Give each the page's registry, right after the
|
|
65
|
+
* insertion. A browser without scoped registries never nulls it (and has no `initialize`): a no-op.
|
|
66
|
+
*/
|
|
67
|
+
function init_shadow_registries(under) {
|
|
68
|
+
const ce = customElements;
|
|
69
|
+
if (typeof ce.initialize !== "function") return;
|
|
70
|
+
const scopes = [under];
|
|
71
|
+
for (let q = 0; q < scopes.length; q++) {
|
|
72
|
+
const walk = document.createTreeWalker(scopes[q], 1);
|
|
73
|
+
for (let n = walk.nextNode(); n; n = walk.nextNode()) {
|
|
74
|
+
const sr = n.shadowRoot;
|
|
75
|
+
if (!sr) continue;
|
|
76
|
+
if (sr.customElementRegistry === null) ce.initialize(sr);
|
|
77
|
+
scopes.push(sr);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export { attach_declarative_shadows, init_shadow_registries, parse_region_html, restore_adopt_sheets, restore_markup };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { endpoint_key, fingerprint_of, fnv1a, signature_of } from "./hash.js";
|
|
2
|
+
/** The `<script data-ogygia-props>` seed text of a region — keyed at the end of the body or the
|
|
3
|
+
* adjacent sibling (runtime/sidecar.ts) — or '' — the same lookup the hydrator uses, read-only.
|
|
4
|
+
* SSR-stable across hydration. */
|
|
5
|
+
export declare function region_props_text(el: Element): string;
|
|
6
|
+
/** Match key for a rendered region element (which slot). */
|
|
7
|
+
export declare function region_signature(el: Element): string;
|
|
8
|
+
/**
|
|
9
|
+
* THE region identity — did its inputs change / which instance is this. ONE value, not a recompute:
|
|
10
|
+
* the server already emitted it as `data-og-fp` (Region.svelte), so READ that. Only fall back to
|
|
11
|
+
* computing it when the attribute is absent (a region type that doesn't emit it). Reading the
|
|
12
|
+
* server's value makes client↔server parity EXACT by construction — no divergence between
|
|
13
|
+
* `fingerprint_of(...)` here and the server's emit is possible, which is the correctness property
|
|
14
|
+
* the server-delta skip decision rides on.
|
|
15
|
+
*/
|
|
16
|
+
export declare function region_props_fp(el: Element): string;
|
|
17
|
+
/** Stamp reconcile keys onto a root's regions + keep-chrome, without clobbering an authored key/id.
|
|
18
|
+
* A region's key is signature+fingerprint (patch on either change); keep-chrome keys by keep name. */
|
|
19
|
+
export declare function stamp_region_keys(root: ParentNode): void;
|
|
20
|
+
/**
|
|
21
|
+
* SHADOW-DOM SAFETY: reconcile (querySelectorAll + morph) does NOT pierce shadow boundaries, so a
|
|
22
|
+
* region rendered INSIDE a shadow root (a web component's own template) would be invisible to it —
|
|
23
|
+
* morph would keep the stale host and never update that region. The router decides the fallback
|
|
24
|
+
* from a count, not a walk: the runtime keeps the set of CONNECTED regions (every region connects,
|
|
25
|
+
* shadow or light), the light DOM is one `querySelectorAll`; a mismatch means a region lives in a
|
|
26
|
+
* shadow root. An author forces the fallback with `data-og-no-reconcile` — the only thing checked
|
|
27
|
+
* here, on either document.
|
|
28
|
+
*/
|
|
29
|
+
export declare const NO_RECONCILE_SELECTOR = "[data-og-no-reconcile]";
|
|
30
|
+
export declare function reconcile_body(live: Element, next: Element, morph: (parent: Element, nodes: ArrayLike<Node>) => void): void;
|
|
31
|
+
/**
|
|
32
|
+
* outerSync body swap — the FALLBACK path (reconcile off, or a region trapped in a shadow root the
|
|
33
|
+
* morph can't pierce). The old code did `document.body.replaceWith(doc.body)`, which THROWS AWAY the
|
|
34
|
+
* live `<body>` element — and with it every listener, observer, and dataset value anything (Kit,
|
|
35
|
+
* analytics, a scroll library) attached to `document.body`. htmx 4 boosts land the same way and use
|
|
36
|
+
* `outerSync` for exactly this reason: keep the element, sync its attributes, replace its children.
|
|
37
|
+
* So we do too — the live body node survives, only its guts change. Incoming children are moved out
|
|
38
|
+
* of the parsed document (insertion adopts them across documents).
|
|
39
|
+
*/
|
|
40
|
+
export declare function swap_body(live: HTMLElement, next: HTMLElement): void;
|
|
41
|
+
export { endpoint_key, fingerprint_of, fnv1a, signature_of };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { dispose_ids } from "../ref.js";
|
|
2
|
+
import { boot_link, morph_sync_attributes } from "./slots.js";
|
|
3
|
+
import { region_owned_ids } from "./region-ids.js";
|
|
4
|
+
import { emit } from "../events/bus.js";
|
|
5
|
+
import { endpoint_key, fingerprint_of, fnv1a, signature_of } from "./hash.js";
|
|
6
|
+
// src/runtime/reconcile.ts
|
|
7
|
+
/**
|
|
8
|
+
* State-delta reconciler — R0: region identity + change detection (client-side, no SSR change).
|
|
9
|
+
*
|
|
10
|
+
* A navigation should MOVE regions, not reset them. To decide keep/patch/mount/remove per region
|
|
11
|
+
* (R1), the reconciler needs two derived keys off each `<ogygia-region>` — computed purely from
|
|
12
|
+
* attributes the compiler already emits (which is untouchable), never from live-mutated innerHTML:
|
|
13
|
+
*
|
|
14
|
+
* • signature — WHICH region slot this is (the match key). entry (component chunk) + the
|
|
15
|
+
* endpoint's stable id/props part. Two regions with the same signature are
|
|
16
|
+
* candidates for the same slot; document-order position (R1's diff) disambiguates
|
|
17
|
+
* duplicate signatures.
|
|
18
|
+
* • props_fp — DID ITS INPUTS CHANGE. A hash of the SSR seed: entry + endpoint + the
|
|
19
|
+
* `<script data-ogygia-props>` text that follows the region. The seed is stable
|
|
20
|
+
* across hydration (islands read it, never rewrite it), so comparing old↔new
|
|
21
|
+
* props_fp answers "does the new page feed this region the same props?" — if yes,
|
|
22
|
+
* the live island (which may hold interaction state the SSR html lacks) is the
|
|
23
|
+
* source of truth and is KEPT; if no, the region is PATCHED.
|
|
24
|
+
*
|
|
25
|
+
* Pure and DOM-light: the hashing core takes strings so it unit-tests without a document.
|
|
26
|
+
*/
|
|
27
|
+
const DEVTOOLS = typeof __OGYGIA_DEVTOOLS__ !== "undefined" ? __OGYGIA_DEVTOOLS__ : false;
|
|
28
|
+
const props_sidecar_of = (region) => boot_link().props_sidecar_of(region);
|
|
29
|
+
/**
|
|
30
|
+
* `<body>`'s attributes have two owners (runtime/ownership.ts): the server, page by page (a theme
|
|
31
|
+
* class, a layout flag), and the scripts living on the page (a scroll lock, a consent banner's state,
|
|
32
|
+
* an analytics marker). A navigation moves the server's attributes to the new page's — and removes
|
|
33
|
+
* only those the PREVIOUS page's server sent that the new one doesn't. An attribute a script set is
|
|
34
|
+
* not the server's to take away (before this, every navigation stripped them all). The server's set
|
|
35
|
+
* starts as the body's attributes when this module loads, which the runtime does before the page's
|
|
36
|
+
* own scripts (head-presence.ts puts it first).
|
|
37
|
+
*/
|
|
38
|
+
const attr_names = (el) => new Set(Array.from(el.attributes, (a) => a.name));
|
|
39
|
+
let server_body_attrs = typeof document !== "undefined" && document.body ? attr_names(document.body) : null;
|
|
40
|
+
function sync_body_attributes(live, next) {
|
|
41
|
+
morph_sync_attributes()(live, next, true);
|
|
42
|
+
if (server_body_attrs) {
|
|
43
|
+
for (const name of server_body_attrs) if (!next.hasAttribute(name)) live.removeAttribute(name);
|
|
44
|
+
}
|
|
45
|
+
server_body_attrs = attr_names(next);
|
|
46
|
+
}
|
|
47
|
+
/** The `<script data-ogygia-props>` seed text of a region — keyed at the end of the body or the
|
|
48
|
+
* adjacent sibling (runtime/sidecar.ts) — or '' — the same lookup the hydrator uses, read-only.
|
|
49
|
+
* SSR-stable across hydration. */
|
|
50
|
+
function region_props_text(el) {
|
|
51
|
+
return props_sidecar_of(el)?.textContent ?? "";
|
|
52
|
+
}
|
|
53
|
+
/** Match key for a rendered region element (which slot). */
|
|
54
|
+
function region_signature(el) {
|
|
55
|
+
return signature_of(el.getAttribute("entry") ?? "", el.getAttribute("endpoint") ?? "");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* THE region identity — did its inputs change / which instance is this. ONE value, not a recompute:
|
|
59
|
+
* the server already emitted it as `data-og-fp` (Region.svelte), so READ that. Only fall back to
|
|
60
|
+
* computing it when the attribute is absent (a region type that doesn't emit it). Reading the
|
|
61
|
+
* server's value makes client↔server parity EXACT by construction — no divergence between
|
|
62
|
+
* `fingerprint_of(...)` here and the server's emit is possible, which is the correctness property
|
|
63
|
+
* the server-delta skip decision rides on.
|
|
64
|
+
*/
|
|
65
|
+
function region_props_fp(el) {
|
|
66
|
+
const emitted = el.getAttribute("data-og-fp");
|
|
67
|
+
if (emitted !== null && emitted !== "") return emitted;
|
|
68
|
+
return fingerprint_of(el.getAttribute("entry") ?? "", el.getAttribute("endpoint") ?? "", region_props_text(el));
|
|
69
|
+
}
|
|
70
|
+
const RECONCILE_KEY = "data-key";
|
|
71
|
+
/** Stamp reconcile keys onto a root's regions + keep-chrome, without clobbering an authored key/id.
|
|
72
|
+
* A region's key is signature+fingerprint (patch on either change); keep-chrome keys by keep name. */
|
|
73
|
+
function stamp_region_keys(root) {
|
|
74
|
+
for (const el of root.querySelectorAll("ogygia-region")) {
|
|
75
|
+
if (el.getAttribute(RECONCILE_KEY) !== null || el.id !== "") continue;
|
|
76
|
+
const keep = el.getAttribute("data-ogygia-keep");
|
|
77
|
+
if (keep !== null) el.setAttribute(RECONCILE_KEY, "k\0" + keep);
|
|
78
|
+
else if (el.hasAttribute("data-persist")) el.setAttribute(RECONCILE_KEY, "p\0" + region_signature(el));
|
|
79
|
+
else el.setAttribute(RECONCILE_KEY, "r\0" + region_props_fp(el));
|
|
80
|
+
}
|
|
81
|
+
for (const el of root.querySelectorAll("[data-ogygia-keep]")) {
|
|
82
|
+
if (el.getAttribute(RECONCILE_KEY) !== null || el.id !== "") continue;
|
|
83
|
+
el.setAttribute(RECONCILE_KEY, "k\0" + (el.getAttribute("data-ogygia-keep") ?? ""));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* SHADOW-DOM SAFETY: reconcile (querySelectorAll + morph) does NOT pierce shadow boundaries, so a
|
|
88
|
+
* region rendered INSIDE a shadow root (a web component's own template) would be invisible to it —
|
|
89
|
+
* morph would keep the stale host and never update that region. The router decides the fallback
|
|
90
|
+
* from a count, not a walk: the runtime keeps the set of CONNECTED regions (every region connects,
|
|
91
|
+
* shadow or light), the light DOM is one `querySelectorAll`; a mismatch means a region lives in a
|
|
92
|
+
* shadow root. An author forces the fallback with `data-og-no-reconcile` — the only thing checked
|
|
93
|
+
* here, on either document.
|
|
94
|
+
*/
|
|
95
|
+
const NO_RECONCILE_SELECTOR = "[data-og-no-reconcile]";
|
|
96
|
+
/** Reconcile the live body toward the parsed next body IN PLACE (no replaceWith). `morph` is the
|
|
97
|
+
* keyed morpher (slots.morph / morph_children). After this, `live` IS the reconciled tree: matched
|
|
98
|
+
* regions kept live, changed regions re-mounted, shell morphed. Region ownership of hub ids (R3)
|
|
99
|
+
* lives in ./region-ids.ts. */
|
|
100
|
+
/**
|
|
101
|
+
* DEVTOOLS (nav lab): classify each region's fate under this reconcile — keep | patch | mount |
|
|
102
|
+
* remove — and emit one `nav.reconcile` per region. Matched reconcile keys are KEPT; the rest are
|
|
103
|
+
* grouped by SIGNATURE (which slot), so a same-slot pair (props changed → different fp key) reads as
|
|
104
|
+
* a PATCH, a leftover old-only as REMOVE, a leftover new-only as MOUNT. Called only behind the gate,
|
|
105
|
+
* before morph mutates the trees. Cheap: attribute reads + set math, once per nav.
|
|
106
|
+
*/
|
|
107
|
+
function dt_emit_reconcile(live, next) {
|
|
108
|
+
const key = (el) => el.getAttribute("data-key") ?? "";
|
|
109
|
+
const rec = (el, decision) => emit({
|
|
110
|
+
domain: "nav",
|
|
111
|
+
name: "nav.reconcile",
|
|
112
|
+
key: key(el),
|
|
113
|
+
decision,
|
|
114
|
+
entry: el.getAttribute("entry") ?? void 0,
|
|
115
|
+
wake: el.getAttribute("wake") ?? void 0
|
|
116
|
+
});
|
|
117
|
+
const live_els = Array.from(live.querySelectorAll("ogygia-region"));
|
|
118
|
+
const next_els = Array.from(next.querySelectorAll("ogygia-region"));
|
|
119
|
+
const live_keys = new Set(live_els.map(key));
|
|
120
|
+
const next_key_set = new Set(next_els.map(key));
|
|
121
|
+
for (const el of next_els) if (live_keys.has(key(el))) rec(el, "keep");
|
|
122
|
+
const group = (els, only) => {
|
|
123
|
+
const m = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const el of els) {
|
|
125
|
+
if (only.has(key(el))) continue;
|
|
126
|
+
const sig = region_signature(el);
|
|
127
|
+
(m.get(sig) ?? m.set(sig, []).get(sig)).push(el);
|
|
128
|
+
}
|
|
129
|
+
return m;
|
|
130
|
+
};
|
|
131
|
+
const old_by_sig = group(live_els, next_key_set);
|
|
132
|
+
const new_by_sig = group(next_els, live_keys);
|
|
133
|
+
const sigs = /* @__PURE__ */ new Set([...old_by_sig.keys(), ...new_by_sig.keys()]);
|
|
134
|
+
for (const sig of sigs) {
|
|
135
|
+
const olds = old_by_sig.get(sig) ?? [];
|
|
136
|
+
const news = new_by_sig.get(sig) ?? [];
|
|
137
|
+
const pairs = Math.min(olds.length, news.length);
|
|
138
|
+
for (let i = 0; i < pairs; i++) rec(news[i], "patch");
|
|
139
|
+
for (let i = pairs; i < olds.length; i++) rec(olds[i], "remove");
|
|
140
|
+
for (let i = pairs; i < news.length; i++) rec(news[i], "mount");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function reconcile_body(live, next, morph) {
|
|
144
|
+
stamp_region_keys(live);
|
|
145
|
+
stamp_region_keys(next);
|
|
146
|
+
sync_body_attributes(live, next);
|
|
147
|
+
if (DEVTOOLS) dt_emit_reconcile(live, next);
|
|
148
|
+
const next_keys = /* @__PURE__ */ new Set();
|
|
149
|
+
for (const el of next.querySelectorAll("ogygia-region")) {
|
|
150
|
+
const k = el.getAttribute("data-key");
|
|
151
|
+
if (k !== null) next_keys.add(k);
|
|
152
|
+
}
|
|
153
|
+
const removed_ids = [];
|
|
154
|
+
for (const el of live.querySelectorAll("ogygia-region")) {
|
|
155
|
+
const k = el.getAttribute("data-key");
|
|
156
|
+
if (k !== null && next_keys.has(k)) continue;
|
|
157
|
+
const set = region_owned_ids(el);
|
|
158
|
+
if (set !== void 0) for (const id of set) removed_ids.push(id);
|
|
159
|
+
}
|
|
160
|
+
absorb_kept_props(live, next);
|
|
161
|
+
morph(live, next.childNodes);
|
|
162
|
+
if (removed_ids.length > 0) dispose_ids(removed_ids);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* outerSync body swap — the FALLBACK path (reconcile off, or a region trapped in a shadow root the
|
|
166
|
+
* morph can't pierce). The old code did `document.body.replaceWith(doc.body)`, which THROWS AWAY the
|
|
167
|
+
* live `<body>` element — and with it every listener, observer, and dataset value anything (Kit,
|
|
168
|
+
* analytics, a scroll library) attached to `document.body`. htmx 4 boosts land the same way and use
|
|
169
|
+
* `outerSync` for exactly this reason: keep the element, sync its attributes, replace its children.
|
|
170
|
+
* So we do too — the live body node survives, only its guts change. Incoming children are moved out
|
|
171
|
+
* of the parsed document (insertion adopts them across documents).
|
|
172
|
+
*/
|
|
173
|
+
function swap_body(live, next) {
|
|
174
|
+
sync_body_attributes(live, next);
|
|
175
|
+
live.replaceChildren();
|
|
176
|
+
while (next.firstChild) live.appendChild(next.firstChild);
|
|
177
|
+
}
|
|
178
|
+
/** For each live region whose reconcile key also appears in `next`, push the incoming region's
|
|
179
|
+
* props into the live island (kept regions only — a re-mounting region gets its props on mount). */
|
|
180
|
+
function absorb_kept_props(live, next) {
|
|
181
|
+
const incoming = /* @__PURE__ */ new Map();
|
|
182
|
+
for (const el of next.querySelectorAll("ogygia-region")) {
|
|
183
|
+
const k = el.getAttribute("data-key");
|
|
184
|
+
if (k !== null && !incoming.has(k)) incoming.set(k, el);
|
|
185
|
+
}
|
|
186
|
+
for (const el of live.querySelectorAll("ogygia-region")) {
|
|
187
|
+
const k = el.getAttribute("data-key");
|
|
188
|
+
if (k === null) continue;
|
|
189
|
+
const twin = incoming.get(k);
|
|
190
|
+
const absorb = el.absorbKeptProps;
|
|
191
|
+
if (twin !== void 0 && twin !== el && typeof absorb === "function") absorb.call(el, twin);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
export { NO_RECONCILE_SELECTOR, endpoint_key, fingerprint_of, fnv1a, reconcile_body, region_props_fp, region_props_text, region_signature, signature_of, stamp_region_keys, swap_body };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM attribute vocabulary for `<ogygia-region>` (DESIGN.md two axes).
|
|
3
|
+
*
|
|
4
|
+
* - `wake` — when JS wakes: `none` | `load` | `idle` | `visible` | `interaction` | media query
|
|
5
|
+
* - `render` — when HTML arrives: omit/`page` | `defer`
|
|
6
|
+
* - `when` — schedule for `render="defer"` OR `remount="swr"` revalidate
|
|
7
|
+
* - `hydrate-margin` — IntersectionObserver rootMargin for phase-2 `wake="visible"`
|
|
8
|
+
* - `remount` — `{#if}` re-creation of `wake="none"`: `cache` | `empty` | `swr`
|
|
9
|
+
* - `max-age` — client lake-cache TTL in ms (optional)
|
|
10
|
+
* - `on-expire` — past max-age: `empty` | `fetch` (swr default `fetch`, cache default `empty`)
|
|
11
|
+
*
|
|
12
|
+
* No "island" / "lake" attribute names — those are nicknames, not the mechanism.
|
|
13
|
+
*/
|
|
14
|
+
/** CSS selector for frozen regions (`hydrate: 'none'`). */
|
|
15
|
+
export declare const FROZEN_SELECTOR = "ogygia-region[wake=\"none\"]";
|
|
16
|
+
/** True if this region is a wake boundary (JS will / did run for its subtree). */
|
|
17
|
+
export declare function is_awake(el: Element): boolean;
|
|
18
|
+
/** True if this region freezes its subtree (SSR DOM preserved; no client module). */
|
|
19
|
+
export declare function is_frozen(el: Element): boolean;
|
|
20
|
+
/** True if this region fetches HTML later (`render="defer"`). */
|
|
21
|
+
export declare function is_deferred(el: Element): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The regions whose INSIDE Kit's hydration never walks — OPAQUE to it, adopted as one element: a lake
|
|
24
|
+
* (frozen server HTML), a hole (a fallback, then an answer fetched after load — a region found inside
|
|
25
|
+
* one on a Kit-hydrated document came with that answer: the page's own fallback renders its islands
|
|
26
|
+
* inline, as Kit's), and a BAKED live region (its first HTML is server-only, morphed in after by the
|
|
27
|
+
* runtime). Their insides are ogygia's on every page: nothing else will wake them. The server twins:
|
|
28
|
+
* `isInLake()` (context.ts — set by LakeBoundary and on every render root whose HTML lands in one) and
|
|
29
|
+
* `region_kind` (reversible.ts).
|
|
30
|
+
*/
|
|
31
|
+
export declare const OPAQUE_SELECTOR = "ogygia-region[wake=\"none\"],ogygia-region[render=\"defer\"],ogygia-region[data-og-baked]";
|
|
32
|
+
/** True if this region sits inside an {@link OPAQUE_SELECTOR opaque} region: on a Kit-hydrated
|
|
33
|
+
* document nothing but the runtime will ever wake it. */
|
|
34
|
+
export declare function inside_opaque(el: Element): boolean;
|
|
35
|
+
/** Mixed mode (a csr=true document): Kit hydrates the tree, so an island there is Kit's — EXCEPT
|
|
36
|
+
* what Kit never sees: a deferred region (its HTML is fetched after load) and anything inside an
|
|
37
|
+
* opaque region (a lake, a hole's answer, a baked region's first HTML). Those are ours. */
|
|
38
|
+
export declare function ours_on_kit_document(el: Element): boolean;
|
|
39
|
+
/** `{#if}` remount policy for `wake="none"` regions. Default `cache`. */
|
|
40
|
+
export declare function region_remount(el: Element): "cache" | "empty" | "swr";
|
|
41
|
+
/** Client lake-cache TTL in ms from `max-age`. `0` = no expiry. */
|
|
42
|
+
export declare function region_max_age_ms(el: Element): number;
|
|
43
|
+
/**
|
|
44
|
+
* Past-maxAge behavior. Defaults: `cache` → `empty`, `swr` → `fetch`.
|
|
45
|
+
* `fetch` is only meaningful with `remount="swr"` (endpoint present).
|
|
46
|
+
*/
|
|
47
|
+
export declare function region_on_expire(el: Element): "empty" | "fetch";
|
|
48
|
+
/**
|
|
49
|
+
* True when a frozen region has only Svelte placeholder anchors (comments / whitespace).
|
|
50
|
+
* Used by remount: a text-only lake is still "filled" — `querySelector('*')` would miss it and
|
|
51
|
+
* double-append the cache on reconnect (REMOUNT-VACANT).
|
|
52
|
+
*/
|
|
53
|
+
export declare function region_is_vacant(el: ParentNode): boolean;
|
|
54
|
+
/** True when this document was SERVED FROM a page store (a plugin stamps the hit/join copies with
|
|
55
|
+
* `STORED_DOCUMENT_META`). A stored copy is a cached render by definition — swr lakes read this to
|
|
56
|
+
* revalidate on FIRST mount, not only on remounts. */
|
|
57
|
+
export declare function document_is_stored(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* True when the browser's HTML parser tore this placed island's SSR content OUT of the region —
|
|
60
|
+
* the invalid-nesting hoist.
|
|
61
|
+
*
|
|
62
|
+
* A block-rendering island authored INLINE inside a `<p>` (e.g. a `<Counter/>` sitting in a markdown
|
|
63
|
+
* sentence, where the component renders `<div>…</div>`) is invalid HTML: a `<div>` start tag while a
|
|
64
|
+
* `<p>` is in button scope makes the parser CLOSE the paragraph, popping this `<ogygia-region>` with
|
|
65
|
+
* it — the region is left holding only its opening Svelte hydration anchors (`<!--[-->`), while the
|
|
66
|
+
* rendered nodes (and the closing anchors) become siblings of the paragraph. Hydrating that empty
|
|
67
|
+
* region then fresh-mounts a SECOND copy, and the hoisted server copy lingers as an orphan → the
|
|
68
|
+
* page shows the island twice.
|
|
69
|
+
*
|
|
70
|
+
* Detected as an UNBALANCED hydration envelope: strictly more `[` open anchors than `]` close anchors
|
|
71
|
+
* among the region's descendants. A validly-nested region (inline content, or block content in block
|
|
72
|
+
* context) always balances; a region that renders nothing balances (0 == 0); a not-yet-swapped
|
|
73
|
+
* deferred/live region carries no anchors at all (0 == 0). So this never false-positives on a
|
|
74
|
+
* correctly-parsed region — only the parser-truncated envelope reads open > close.
|
|
75
|
+
*/
|
|
76
|
+
export declare function region_ssr_truncated(el: ParentNode): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Schedule string for the shared scheduler.
|
|
79
|
+
* Deferred regions use `when`; waking regions use `wake`; default `load`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function region_schedule(el: Element): string;
|
|
82
|
+
/**
|
|
83
|
+
* Wake schedule from `wake`, or `null` when this region does not run JS
|
|
84
|
+
* (`wake` absent / `'none'`). Used after a deferred HTML swap for phase 2.
|
|
85
|
+
*/
|
|
86
|
+
export declare function region_hydrate_schedule(el: Element): string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Phase-2 (post-swap) hydrate schedule for a deferred client island.
|
|
89
|
+
*
|
|
90
|
+
* - Matching schedules (`load`/`load`, `idle`/`idle`, `visible`/`visible`, same media) → `'load'`
|
|
91
|
+
* (hydrate immediately; do not re-arm the same idle / IO / MQ).
|
|
92
|
+
* - `hydrate: 'load'` after any defer → `'load'` (ASAP after swap).
|
|
93
|
+
* - Otherwise arm hydrate’s own schedule only.
|
|
94
|
+
*/
|
|
95
|
+
export declare function phase2_hydrate_schedule(defer_when: string, hydrate: string): string;
|