@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,390 @@
|
|
|
1
|
+
// src/runtime/restore.ts
|
|
2
|
+
/**
|
|
3
|
+
* THE RESTORER — the browser half of reversible transforms (server/reversible.ts). An app's server
|
|
4
|
+
* transform rendered each planned custom element (`og-h`) in scoped form: its rendered tree in the
|
|
5
|
+
* host's light DOM, Svelte's children moved into `<slot>` wrappers inside it. This puts it back into
|
|
6
|
+
* the form hydration and the component's runtime both expect:
|
|
7
|
+
*
|
|
8
|
+
* 1. stand-ins (`<og-as tag="a">`: tags the HTML parser would have restructured) become their real
|
|
9
|
+
* element, in place — a DOM operation, which no content-model rule applies to;
|
|
10
|
+
* 2. for each planned host, innermost first: an open shadow root with the host's keyed sheets, the
|
|
11
|
+
* rendered tree moved into it (its `<slot>` wrappers become real slots), Svelte's children back
|
|
12
|
+
* in the light DOM in their original order and exactly as Svelte rendered them (attributes reset,
|
|
13
|
+
* trimmed or dropped text put back), the host's attributes back to Svelte's (except `og-keep`).
|
|
14
|
+
*
|
|
15
|
+
* The page stays painted the same throughout: the scoped form and the shadow form render alike, and
|
|
16
|
+
* each host is restored in one task. It must run before anything reads the markup — before an island
|
|
17
|
+
* snapshots or hydrates, before Kit starts, before a web-component runtime upgrades a host. So the
|
|
18
|
+
* handle inlines it at the end of the document's body (`restore.toString()`: this function is
|
|
19
|
+
* self-contained, no imports, no outer names), and the runtime calls it on a hole / lake answer before
|
|
20
|
+
* insertion and on an incoming page before a router swap.
|
|
21
|
+
*
|
|
22
|
+
* A host that already has a shadow root when it is reached was upgraded first — the restore came
|
|
23
|
+
* too late. It is left as served and reported (`ogygia:restore-late` on the host), never restored into
|
|
24
|
+
* a root the component's own constructor made (that tree would render twice).
|
|
25
|
+
*/
|
|
26
|
+
function restore(root) {
|
|
27
|
+
const doc = root.ownerDocument ?? root;
|
|
28
|
+
const head = document.head;
|
|
29
|
+
const W = window;
|
|
30
|
+
const sheets = W.__og_sheets ??= /* @__PURE__ */ new Map();
|
|
31
|
+
const esc = (s) => typeof CSS !== "undefined" && CSS.escape ? CSS.escape(s) : s.split("\\").join("\\\\").split("\"").join("\\\"");
|
|
32
|
+
const live = doc === document;
|
|
33
|
+
let restored = 0;
|
|
34
|
+
/**
|
|
35
|
+
* A KIT-HYDRATED page (csr=true) is hydrated by Kit's own start, which ogygia does not run — so
|
|
36
|
+
* the island hydrate's put-back of a component's class tokens (runtime/host-classes.ts) never
|
|
37
|
+
* runs there. Instead each restored custom element is watched once: Kit's hydrate writes its
|
|
38
|
+
* `class` whole, to exactly Svelte's tokens; the first write that leaves exactly those gets back
|
|
39
|
+
* every token it dropped (the component's, the render's `sc-*`), read from the value just before
|
|
40
|
+
* that write. A component only ever adds and removes its own tokens, so no later state of the
|
|
41
|
+
* host equals Svelte's alone. One observer for all of them; a host leaves the watch at that
|
|
42
|
+
* write, and the observer goes when the last one has.
|
|
43
|
+
*/
|
|
44
|
+
const watch_classes = live && document.querySelector("meta[name=\"ogygia-csr\"][content=\"true\"]") !== null;
|
|
45
|
+
const watch = (el) => {
|
|
46
|
+
let w = W.__og_class_watch;
|
|
47
|
+
if (!w) {
|
|
48
|
+
const hosts = /* @__PURE__ */ new Set();
|
|
49
|
+
const mo = new MutationObserver((records) => {
|
|
50
|
+
for (let i = 0; i < records.length; i++) {
|
|
51
|
+
const host = records[i].target;
|
|
52
|
+
if (!hosts.has(host)) continue;
|
|
53
|
+
let now;
|
|
54
|
+
for (let j = i + 1; j < records.length && now === void 0; j++) if (records[j].target === host) now = records[j].oldValue;
|
|
55
|
+
if (now === void 0) now = host.getAttribute("class");
|
|
56
|
+
if ((now ?? "") !== host.__og_svelte_class) continue;
|
|
57
|
+
hosts.delete(host);
|
|
58
|
+
const own = new Set((now ?? "").split(" "));
|
|
59
|
+
for (const t of (records[i].oldValue ?? "").split(" ")) if (t && !own.has(t)) host.classList.add(t);
|
|
60
|
+
}
|
|
61
|
+
if (hosts.size === 0) {
|
|
62
|
+
mo.disconnect();
|
|
63
|
+
W.__og_class_watch = void 0;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
w = W.__og_class_watch = {
|
|
67
|
+
mo,
|
|
68
|
+
hosts
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
w.hosts.add(el);
|
|
72
|
+
w.mo.observe(el, {
|
|
73
|
+
attributes: true,
|
|
74
|
+
attributeFilter: ["class"],
|
|
75
|
+
attributeOldValue: true
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
if (root !== document && root.querySelectorAll) for (const el of Array.from(root.querySelectorAll("[data-og-head]"))) {
|
|
79
|
+
const key = el.getAttribute("data-og-head");
|
|
80
|
+
if (head.querySelector(`[data-og-head="${esc(key)}"]`)) el.remove();
|
|
81
|
+
else head.appendChild(el);
|
|
82
|
+
}
|
|
83
|
+
const sheet_for = (key) => {
|
|
84
|
+
const have = sheets.get(key);
|
|
85
|
+
if (have) return have;
|
|
86
|
+
const sel = `template[data-og-head="${esc(key)}"]`;
|
|
87
|
+
const tpl = doc !== document && doc.head?.querySelector(sel) || head.querySelector(sel);
|
|
88
|
+
if (!tpl) return null;
|
|
89
|
+
const css = tpl.content.textContent ?? "";
|
|
90
|
+
let sheet = null;
|
|
91
|
+
try {
|
|
92
|
+
sheet = new CSSStyleSheet();
|
|
93
|
+
sheet.replaceSync(css);
|
|
94
|
+
} catch {
|
|
95
|
+
sheet = null;
|
|
96
|
+
}
|
|
97
|
+
const made = {
|
|
98
|
+
sheet,
|
|
99
|
+
css
|
|
100
|
+
};
|
|
101
|
+
sheets.set(key, made);
|
|
102
|
+
return made;
|
|
103
|
+
};
|
|
104
|
+
/** Attributes back to Svelte's. A custom element's `class` has two owners — Svelte, and the
|
|
105
|
+
* component, which may put state on its own host — so there it becomes Svelte's tokens PLUS the
|
|
106
|
+
* ones the render added, and Svelte's are recorded on the element (`__og_svelte_class`): the
|
|
107
|
+
* island's hydrate puts the component's back after Svelte writes `class` whole
|
|
108
|
+
* (runtime/host-classes.ts). Unless the render kept `class` as its own (`og-keep`). */
|
|
109
|
+
const reset = (el) => {
|
|
110
|
+
const r = el.getAttribute("og-r");
|
|
111
|
+
const custom = el.localName.indexOf("-") !== -1 && (" " + (el.getAttribute("og-keep") ?? "") + " ").indexOf(" class ") === -1;
|
|
112
|
+
let svelte_class;
|
|
113
|
+
if (r) try {
|
|
114
|
+
const diff = JSON.parse(r);
|
|
115
|
+
for (const name in diff) {
|
|
116
|
+
const v = diff[name];
|
|
117
|
+
if (custom && name === "class") {
|
|
118
|
+
svelte_class = v;
|
|
119
|
+
const own = new Set((v ?? "").split(" "));
|
|
120
|
+
let theirs = "";
|
|
121
|
+
for (const t of Array.from(el.classList)) if (!own.has(t)) theirs += " " + t;
|
|
122
|
+
const merged = ((v ?? "") + theirs).trim();
|
|
123
|
+
if (merged) el.setAttribute("class", merged);
|
|
124
|
+
else el.removeAttribute("class");
|
|
125
|
+
} else if (v === null) el.removeAttribute(name);
|
|
126
|
+
else el.setAttribute(name, v);
|
|
127
|
+
}
|
|
128
|
+
} catch {}
|
|
129
|
+
if (custom) {
|
|
130
|
+
el.__og_svelte_class = svelte_class === void 0 ? el.getAttribute("class") ?? "" : svelte_class ?? "";
|
|
131
|
+
if (watch_classes) watch(el);
|
|
132
|
+
}
|
|
133
|
+
el.removeAttribute("og-r");
|
|
134
|
+
};
|
|
135
|
+
/** A mark's original text (`<!--og-c K.i t "…"-->`, `<!--og-t K.n "…"-->`), or undefined. */
|
|
136
|
+
const original = (data) => {
|
|
137
|
+
const q = data.indexOf(" \"");
|
|
138
|
+
if (q === -1) return void 0;
|
|
139
|
+
try {
|
|
140
|
+
return JSON.parse(data.slice(q + 1));
|
|
141
|
+
} catch {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
/** Put back the text after a text mark (trimmed, or dropped: then a new node), then drop the mark. */
|
|
146
|
+
const fix_text = (mark) => {
|
|
147
|
+
const was = original(mark.data);
|
|
148
|
+
if (was !== void 0) {
|
|
149
|
+
const next = mark.nextSibling;
|
|
150
|
+
if (next && next.nodeType === 3) next.data = was;
|
|
151
|
+
else mark.parentNode.insertBefore(doc.createTextNode(was), next);
|
|
152
|
+
}
|
|
153
|
+
const node = mark.nextSibling;
|
|
154
|
+
mark.remove();
|
|
155
|
+
return node;
|
|
156
|
+
};
|
|
157
|
+
const comments = (under, prefix) => {
|
|
158
|
+
const out = [];
|
|
159
|
+
const walk = doc.createTreeWalker(under, 128);
|
|
160
|
+
for (let n = walk.nextNode(); n; n = walk.nextNode()) if (n.data.startsWith(prefix)) out.push(n);
|
|
161
|
+
return out;
|
|
162
|
+
};
|
|
163
|
+
const swap_stand_ins = (under) => {
|
|
164
|
+
const list = Array.from(under.querySelectorAll("og-as"));
|
|
165
|
+
for (let x = list.length - 1; x >= 0; x--) {
|
|
166
|
+
const as = list[x];
|
|
167
|
+
const real = doc.createElement(as.getAttribute("tag") || "span");
|
|
168
|
+
for (const a of Array.from(as.attributes)) if (a.name !== "tag") real.setAttribute(a.name, a.value);
|
|
169
|
+
while (as.firstChild) real.appendChild(as.firstChild);
|
|
170
|
+
as.replaceWith(real);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
let check = null;
|
|
174
|
+
const check_el = root.querySelector("script[type=\"application/ogygia-restore-check\"]");
|
|
175
|
+
if (check_el) {
|
|
176
|
+
try {
|
|
177
|
+
check = JSON.parse(check_el.textContent || "{}");
|
|
178
|
+
} catch {
|
|
179
|
+
check = null;
|
|
180
|
+
}
|
|
181
|
+
check_el.remove();
|
|
182
|
+
}
|
|
183
|
+
/** The first difference between Svelte's children and the restored ones (node types, tags, text,
|
|
184
|
+
* comments, attributes — a web-component host may carry more than Svelte's: `og-keep`), or null. */
|
|
185
|
+
const differ = (want, got, path) => {
|
|
186
|
+
const a = want.childNodes;
|
|
187
|
+
const b = got.childNodes;
|
|
188
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
189
|
+
const x = a[i];
|
|
190
|
+
const y = b[i];
|
|
191
|
+
const here = `${path} > [${i}]`;
|
|
192
|
+
if (!x || !y) return `${here}: Svelte has ${x ? describe(x) : "nothing"}, the restored markup has ${y ? describe(y) : "nothing"}`;
|
|
193
|
+
if (x.nodeType !== y.nodeType || x.nodeName !== y.nodeName) return `${here}: Svelte has ${describe(x)}, the restored markup has ${describe(y)}`;
|
|
194
|
+
if (x.nodeType === 3 || x.nodeType === 8) {
|
|
195
|
+
if (x.data !== y.data) return `${here}: Svelte has ${describe(x)}, the restored markup has ${describe(y)}`;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (x.nodeType !== 1) continue;
|
|
199
|
+
const ex = x;
|
|
200
|
+
const ey = y;
|
|
201
|
+
const custom = ex.localName.indexOf("-") !== -1;
|
|
202
|
+
for (const attr of Array.from(ex.attributes)) {
|
|
203
|
+
if (custom && attr.name === "class" ? within(attr.value, ey.getAttribute("class")) : norm(attr.name, attr.value) === norm(attr.name, ey.getAttribute(attr.name))) continue;
|
|
204
|
+
return `${here} <${ex.localName}>: Svelte has ${attr.name}="${attr.value}", the restored markup has ${ey.hasAttribute(attr.name) ? `"${ey.getAttribute(attr.name)}"` : "none"}`;
|
|
205
|
+
}
|
|
206
|
+
if (!custom) {
|
|
207
|
+
for (const attr of Array.from(ey.attributes)) if (!ex.hasAttribute(attr.name) && norm(attr.name, attr.value) !== null) return `${here} <${ex.localName}>: the restored markup adds ${attr.name}="${attr.value}"`;
|
|
208
|
+
}
|
|
209
|
+
const deeper = differ(x, y, `${here} <${ex.localName}>`);
|
|
210
|
+
if (deeper) return deeper;
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
};
|
|
214
|
+
/** An attribute as it matters, not as a serializer wrote it: `class` as its set of tokens, `style`
|
|
215
|
+
* as its declarations, an empty value as absent (Svelte's hydration reads neither; a render's
|
|
216
|
+
* serializer rewrites both). */
|
|
217
|
+
const norm = (name, value) => {
|
|
218
|
+
if (value === null || value.trim() === "") return name === "class" || name === "style" ? null : value;
|
|
219
|
+
if (name === "class") return value.split(/\s+/).filter(Boolean).sort().join(" ");
|
|
220
|
+
if (name === "style") return value.split(";").map((d) => {
|
|
221
|
+
const c = d.indexOf(":");
|
|
222
|
+
return c === -1 ? d.trim() : `${d.slice(0, c).trim().toLowerCase()}:${d.slice(c + 1).trim().replace(/\s+/g, " ")}`;
|
|
223
|
+
}).filter(Boolean).join(";");
|
|
224
|
+
return value;
|
|
225
|
+
};
|
|
226
|
+
/** Every class token of `want` is in `got`. */
|
|
227
|
+
const within = (want, got) => {
|
|
228
|
+
const have = new Set((got ?? "").split(/\s+/));
|
|
229
|
+
for (const t of want.split(/\s+/)) if (t && !have.has(t)) return false;
|
|
230
|
+
return true;
|
|
231
|
+
};
|
|
232
|
+
const describe = (n) => n.nodeType === 3 ? `the text ${JSON.stringify(n.data)}` : n.nodeType === 8 ? `the comment <!--${n.data}-->` : `<${n.localName}>`;
|
|
233
|
+
const verify = (host, k) => {
|
|
234
|
+
const want = check?.[k];
|
|
235
|
+
if (want === void 0) return;
|
|
236
|
+
const tpl = doc.createElement("template");
|
|
237
|
+
tpl.innerHTML = want;
|
|
238
|
+
const diff = differ(tpl.content, host, `<${host.localName}>`);
|
|
239
|
+
if (!diff) return;
|
|
240
|
+
console.error(`[ogygia] the transform broke hydration markup: ${diff}`);
|
|
241
|
+
host.dispatchEvent(new CustomEvent("ogygia:restore-mismatch", {
|
|
242
|
+
bubbles: true,
|
|
243
|
+
detail: {
|
|
244
|
+
host: host.localName,
|
|
245
|
+
diff
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
log("mismatch", host, diff);
|
|
249
|
+
};
|
|
250
|
+
/** What went wrong, kept for whoever reads it later (the devtools, the profiler's beacon): the
|
|
251
|
+
* restorer runs while the page parses — before any listener of theirs exists. */
|
|
252
|
+
const log = (kind, host, diff) => {
|
|
253
|
+
const list = W.__og_restore_log ??= [];
|
|
254
|
+
if (list.length >= 50) return;
|
|
255
|
+
const island = host.closest("ogygia-region")?.getAttribute("data-og-fp") ?? void 0;
|
|
256
|
+
list.push({
|
|
257
|
+
kind,
|
|
258
|
+
host: host.localName,
|
|
259
|
+
t: Math.round(performance.now()),
|
|
260
|
+
...diff ? { diff: diff.slice(0, 300) } : {},
|
|
261
|
+
...island ? { island } : {}
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
const scopes = [root];
|
|
265
|
+
for (let q = 0; q < scopes.length; q++) {
|
|
266
|
+
const walk = doc.createTreeWalker(scopes[q], 1);
|
|
267
|
+
for (let n = walk.nextNode(); n; n = walk.nextNode()) {
|
|
268
|
+
const sr = n.shadowRoot;
|
|
269
|
+
if (sr && sr.mode === "open") scopes.push(sr);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
for (const scope of scopes) swap_stand_ins(scope);
|
|
273
|
+
const hosts = [];
|
|
274
|
+
for (const scope of scopes) hosts.push(...Array.from(scope.querySelectorAll("[og-h]")));
|
|
275
|
+
for (let x = hosts.length - 1; x >= 0; x--) {
|
|
276
|
+
const host = hosts[x];
|
|
277
|
+
const k = host.getAttribute("og-h");
|
|
278
|
+
const keys = (host.getAttribute("og-shadow") ?? "").split(" ").filter(Boolean);
|
|
279
|
+
if (host.shadowRoot) {
|
|
280
|
+
host.dispatchEvent(new CustomEvent("ogygia:restore-late", {
|
|
281
|
+
bubbles: true,
|
|
282
|
+
detail: { host: k }
|
|
283
|
+
}));
|
|
284
|
+
log("late", host);
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
288
|
+
if (!live) (W.__og_init ??= []).push(shadow);
|
|
289
|
+
const own = [];
|
|
290
|
+
const adoptable = Array.isArray(shadow.adoptedStyleSheets);
|
|
291
|
+
for (const key of keys) {
|
|
292
|
+
const s = sheet_for(key);
|
|
293
|
+
if (!s) continue;
|
|
294
|
+
if (s.sheet && adoptable) own.push(s.sheet);
|
|
295
|
+
else {
|
|
296
|
+
const style = doc.createElement("style");
|
|
297
|
+
style.textContent = s.css;
|
|
298
|
+
shadow.appendChild(style);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (own.length) {
|
|
302
|
+
if (live) shadow.adoptedStyleSheets = [...shadow.adoptedStyleSheets, ...own];
|
|
303
|
+
else {
|
|
304
|
+
shadow.__og_pending = own;
|
|
305
|
+
(W.__og_adopt ??= []).push({
|
|
306
|
+
shadow,
|
|
307
|
+
sheets: own
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const children = [];
|
|
312
|
+
const tag = `${k}.`;
|
|
313
|
+
for (const el of Array.from(host.querySelectorAll("[og-c]"))) {
|
|
314
|
+
const v = el.getAttribute("og-c");
|
|
315
|
+
if (v.startsWith(tag)) children.push({
|
|
316
|
+
i: Number(v.slice(tag.length)),
|
|
317
|
+
node: el
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
for (const mark of comments(host, `og-c ${tag}`)) {
|
|
321
|
+
const rest = mark.data.slice(5 + tag.length);
|
|
322
|
+
const i = Number(rest.slice(0, rest.indexOf(" ") === -1 ? rest.length : rest.indexOf(" ")));
|
|
323
|
+
const is_text = rest.indexOf(" t") !== -1;
|
|
324
|
+
const node = is_text ? fix_text(mark) : mark.nextSibling;
|
|
325
|
+
if (!is_text) mark.remove();
|
|
326
|
+
if (node) children.push({
|
|
327
|
+
i,
|
|
328
|
+
node
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
children.sort((a, b) => a.i - b.i);
|
|
332
|
+
const mine = new Set(children.map((c) => c.node));
|
|
333
|
+
for (const n of Array.from(host.childNodes)) if (!mine.has(n)) shadow.appendChild(n);
|
|
334
|
+
const made = W.__og_rendered ??= /* @__PURE__ */ new WeakSet();
|
|
335
|
+
for (const c of children) {
|
|
336
|
+
host.appendChild(c.node);
|
|
337
|
+
made.add(c.node);
|
|
338
|
+
}
|
|
339
|
+
for (const c of children) if (c.node.nodeType === 1) {
|
|
340
|
+
const el = c.node;
|
|
341
|
+
reset(el);
|
|
342
|
+
el.removeAttribute("og-c");
|
|
343
|
+
}
|
|
344
|
+
for (const mark of comments(host, `og-t ${tag}`)) fix_text(mark);
|
|
345
|
+
reset(host);
|
|
346
|
+
host.removeAttribute("og-h");
|
|
347
|
+
host.removeAttribute("og-shadow");
|
|
348
|
+
host.removeAttribute("og-keep");
|
|
349
|
+
verify(host, k);
|
|
350
|
+
restored++;
|
|
351
|
+
}
|
|
352
|
+
return restored;
|
|
353
|
+
}
|
|
354
|
+
/** Adopt the sheets of roots restored outside the page, now that their hosts are in it (after a hole
|
|
355
|
+
* answer's insertion or a router swap, in the same task: no paint in between). Each root is one of
|
|
356
|
+
* three: IN THE PAGE (adopted now); in a fragment not inserted yet (another hole's answer still
|
|
357
|
+
* waiting for its stylesheet: kept for the call after its insertion); or in ANOTHER DOCUMENT — the
|
|
358
|
+
* incoming page's parsed copy, where the swap left what it did not take (a morph kept the live
|
|
359
|
+
* host): dropped. That last one counts as connected (its document is its root), and adopting a page
|
|
360
|
+
* sheet into it throws — which stopped every root after it from getting its sheets. A fragment root
|
|
361
|
+
* still out after 30 s never goes in (a morph took a copy of it, the hole left): dropped. */
|
|
362
|
+
function restore_adopt() {
|
|
363
|
+
const W = window;
|
|
364
|
+
const now = performance.now();
|
|
365
|
+
const waiting = (root) => now - (root.__og_out ??= now) < 3e4;
|
|
366
|
+
const where = (root) => root.host.isConnected ? root.host.ownerDocument === document ? "page" : "gone" : waiting(root) ? "later" : "gone";
|
|
367
|
+
const bare = W.__og_init;
|
|
368
|
+
if (bare?.length) {
|
|
369
|
+
const left = [];
|
|
370
|
+
const ce = customElements;
|
|
371
|
+
for (const root of bare) {
|
|
372
|
+
const at = where(root);
|
|
373
|
+
if (at === "later") left.push(root);
|
|
374
|
+
else if (at === "page" && root.customElementRegistry === null) ce.initialize?.(root);
|
|
375
|
+
}
|
|
376
|
+
W.__og_init = left;
|
|
377
|
+
}
|
|
378
|
+
const list = W.__og_adopt;
|
|
379
|
+
if (!list?.length) return;
|
|
380
|
+
const left = [];
|
|
381
|
+
for (const item of list) {
|
|
382
|
+
const at = where(item.shadow);
|
|
383
|
+
if (at === "later") left.push(item);
|
|
384
|
+
else if (at === "page") try {
|
|
385
|
+
item.shadow.adoptedStyleSheets = [...item.shadow.adoptedStyleSheets, ...item.sheets];
|
|
386
|
+
} catch {}
|
|
387
|
+
}
|
|
388
|
+
W.__og_adopt = left;
|
|
389
|
+
}
|
|
390
|
+
export { restore, restore_adopt };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SpaRouter } from "./router.js";
|
|
2
|
+
/**
|
|
3
|
+
* Why a page fetch is happening — sent to the server so it can skip side effects a speculative or
|
|
4
|
+
* restorative fetch must not fire (analytics beacons, "last seen" writes, one-time banners):
|
|
5
|
+
* • `nav` — a real, user-driven navigation (default). No purpose header.
|
|
6
|
+
* • `prefetch` — warmed on hover / press / viewport, BEFORE any intent to visit. Marked so the
|
|
7
|
+
* server can treat it as a dry run (htmx's `HX-Preloaded`).
|
|
8
|
+
* • `history` — a back/forward restore, re-fetched because we snapshot no DOM (htmx's
|
|
9
|
+
* `HX-History-Restore-Request`). The visitor has seen this page already.
|
|
10
|
+
* The header is advisory: a server that ignores it still renders correctly.
|
|
11
|
+
*/
|
|
12
|
+
export type NavPurpose = "nav" | "prefetch" | "history";
|
|
13
|
+
/** The `Accept` a browser sends for a top-level document navigation (Chromium's value). */
|
|
14
|
+
export declare const DOCUMENT_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
|
|
15
|
+
/** One attribute's value in an open tag's attribute text (our own SSR: `name="value"`, no quotes
|
|
16
|
+
* inside a value). Null when absent. @internal Exported for unit tests. */
|
|
17
|
+
export declare function tag_attr(attrs: string, name: string): string | null;
|
|
18
|
+
/** Stable-ish head node identity without serializing full outerHTML when possible. */
|
|
19
|
+
export declare function head_node_key(node: Element): string;
|
|
20
|
+
/**
|
|
21
|
+
* Head nodes that must survive SPA swaps even when absent from the next SSR head.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function keep_head_node_across_spa(node: Element): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Install a `<style>` into the live document. `cloneNode` from a `DOMParser` tree
|
|
27
|
+
* often fails to register the sheet; recreate with textContent instead.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function install_head_style(source: Element, head?: HTMLHeadElement, before?: Node | null): HTMLStyleElement;
|
|
31
|
+
/** Apply STREAMED-page late chunks after an SPA body swap: move each inert
|
|
32
|
+
* `<template data-og-late>` into its `og-late-slot` (stylesheets hoisted first via the same
|
|
33
|
+
* keyed head installer, so the swap never paints unstyled). On a full load the inline boot
|
|
34
|
+
* script in the streamed head does this progressively during parse — this is the swap-path
|
|
35
|
+
* twin. Islands inside the adopted content are custom elements: they connect and wake alone. */
|
|
36
|
+
export declare function apply_late_templates(root: ParentNode): void;
|
|
37
|
+
export declare function bust_page_cache(): void;
|
|
38
|
+
export declare function page_cache_size(): number;
|
|
39
|
+
export declare function fetch_page(href: string, signal?: AbortSignal, purpose?: NavPurpose): Promise<string | null>;
|
|
40
|
+
export declare function navigate(r: SpaRouter, url: URL, from: URL, { push, pop_scroll, type, replace }?: {
|
|
41
|
+
push?: boolean;
|
|
42
|
+
pop_scroll?: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
} | null;
|
|
46
|
+
type?: string;
|
|
47
|
+
replace?: boolean;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Soft invalidate: refresh page/remote seeds for the current URL without navigation.
|
|
51
|
+
*
|
|
52
|
+
* Kit's `invalidateAll` re-runs loads in place — it is **not** a navigation (no
|
|
53
|
+
* `beforeNavigate` / `afterNavigate`). Remote `form()` always calls this on success; a
|
|
54
|
+
* full SPA navigate+VT here was wiping live island state. We bust the HTML cache,
|
|
55
|
+
* re-fetch, merge head, and refresh document seeds only — no VT, no body swap, no
|
|
56
|
+
* island remount, no live query-map clear, no auto-refresh of live queries. Islands
|
|
57
|
+
* that need query updates use `.refresh()`, or `submit().updates(q)` with server
|
|
58
|
+
* `requested(q).refreshAll()` (updates alone does not populate response `q`).
|
|
59
|
+
*
|
|
60
|
+
* Uses a separate abort/generation from hard `navigate()` so soft fetches never cancel
|
|
61
|
+
* an in-flight click navigation (and vice versa).
|
|
62
|
+
*/
|
|
63
|
+
export declare function invalidate_all(): Promise<void>;
|