@kayjs/kay 1.107.0 → 1.109.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/dist/eslint.js +1875 -3815
- package/editors/zed/extension.toml +2 -2
- package/llms/action-protection.md +1 -1
- package/llms/actions-from-islands.md +5 -5
- package/llms/actions-refused-fields.md +4 -4
- package/llms/api-from-islands.md +6 -6
- package/llms/browser-only.md +2 -2
- package/llms/cdn-caching.md +1 -1
- package/llms/checks.md +1 -1
- package/llms/code-lints.md +1 -2
- package/llms/component-libraries.md +1 -1
- package/llms/component-library-conventions.md +1 -1
- package/llms/components.md +4 -4
- package/llms/deprecated-lints.md +1 -7
- package/llms/effects.md +1 -1
- package/llms/errors.md +2 -2
- package/llms/events.md +1 -1
- package/llms/guards.md +1 -1
- package/llms/head.md +1 -1
- package/llms/hooks.md +2 -2
- package/llms/images.md +1 -1
- package/llms/island-and-form-lints.md +2 -1
- package/llms/island-sources.md +1 -1
- package/llms/islands-state-to-ids.md +2 -2
- package/llms/islands.md +5 -3
- package/llms/lints.md +1 -1
- package/llms/live-values.md +3 -3
- package/llms/local-collections.md +1 -1
- package/llms/locales.md +1 -1
- package/llms/mcp.md +2 -2
- package/llms/metrics.md +1 -1
- package/llms/navigation-from-code.md +6 -6
- package/llms/prerendering.md +1 -0
- package/llms/production.md +2 -2
- package/llms/project-new-and-add.md +1 -1
- package/llms/project.md +4 -4
- package/llms/proxy-and-security.md +1 -1
- package/llms/queues.md +1 -1
- package/llms/rate-limits.md +4 -4
- package/llms/rendering.md +1 -1
- package/llms/server-islands.md +2 -2
- package/llms/server.md +1 -1
- package/llms/stores.md +1 -1
- package/llms/styles-and-assets.md +1 -1
- package/llms/testing-mount.md +49 -0
- package/llms/testing.md +4 -45
- package/llms/upgrading-1-105-config.md +13 -13
- package/llms/upgrading-archive.md +42 -82
- package/llms/upgrading.md +92 -58
- package/llms/whats-new-archive.md +36 -1
- package/llms/whats-new.md +18 -39
- package/llms.txt +6 -7
- package/package.json +6 -10
- package/src/build/client.ts +7 -6
- package/src/build/icon-slots.ts +140 -0
- package/src/build/libraries.ts +24 -2
- package/src/build/plugin.ts +10 -0
- package/src/build/route-sizes.ts +2 -3
- package/src/build/runtime-chunk.ts +2 -2
- package/src/build/source-files.ts +8 -3
- package/src/build/variants.ts +90 -1
- package/src/check/browser-global-reads.ts +2 -2
- package/src/check/config-objects.ts +1 -1
- package/src/check/diagnose.ts +0 -22
- package/src/check/export-homes.ts +1 -1
- package/src/check/guards.ts +3 -3
- package/src/check/index.ts +2 -7
- package/src/check/moved-keys.ts +1 -1
- package/src/check/project.ts +4 -9
- package/src/check/renamed-packages.ts +3 -63
- package/src/check/shadow-types.ts +4 -104
- package/src/commands/check.ts +2 -2
- package/src/commands/env.ts +25 -3
- package/src/compiler/ast.ts +18 -16
- package/src/compiler/browser.ts +2 -14
- package/src/compiler/class-items.ts +16 -0
- package/src/compiler/codegen.ts +8 -8
- package/src/compiler/dead-code.ts +22 -0
- package/src/compiler/deprecated-library.ts +0 -12
- package/src/compiler/deprecated-lints.ts +4 -505
- package/src/compiler/deprecated-ui-props.ts +5 -5
- package/src/compiler/dom-property.ts +23 -0
- package/src/compiler/dom.ts +15 -15
- package/src/compiler/errors.ts +2 -2
- package/src/compiler/fence-checks.ts +2 -121
- package/src/compiler/hand-parts.ts +55 -0
- package/src/compiler/helper-imports.ts +2 -2
- package/src/compiler/image-attributes.ts +1 -3
- package/src/compiler/index.ts +20 -21
- package/src/compiler/island-arguments.ts +8 -95
- package/src/compiler/island-cause.ts +7 -7
- package/src/compiler/island-declaration.ts +2 -8
- package/src/compiler/island-lints.ts +12 -0
- package/src/compiler/island-marker.ts +3 -3
- package/src/compiler/island-problems.ts +25 -0
- package/src/compiler/jsx-class.ts +1 -25
- package/src/compiler/jsx.ts +2 -2
- package/src/compiler/kay-exports.ts +0 -2
- package/src/compiler/link-flags.ts +9 -38
- package/src/compiler/lints.ts +7 -14
- package/src/compiler/markup.ts +23 -26
- package/src/compiler/module-signals.ts +2 -2
- package/src/compiler/names.ts +1 -1
- package/src/compiler/page-settings.ts +11 -0
- package/src/compiler/parser.ts +6 -8
- package/src/compiler/plan.ts +1 -3
- package/src/compiler/rewrite.ts +3 -18
- package/src/compiler/script-server.ts +8 -3
- package/src/compiler/validate.ts +3 -8
- package/src/config-loader.ts +14 -4
- package/src/config-resolve.ts +18 -142
- package/src/config-shape.ts +44 -34
- package/src/config.ts +10 -114
- package/src/dev/preload.ts +4 -1
- package/src/lsp/server.ts +4 -0
- package/src/migrate/markup.ts +4 -1
- package/src/package-names.ts +1 -1
- package/src/runtime/action-call.ts +39 -335
- package/src/runtime/action-encode.ts +26 -0
- package/src/runtime/action-error.ts +3 -11
- package/src/runtime/action-protection.ts +2 -2
- package/src/runtime/action-run.ts +332 -0
- package/src/runtime/action-shared.ts +14 -37
- package/src/runtime/action-stream.ts +0 -1
- package/src/runtime/action.ts +1 -1
- package/src/runtime/call-result.ts +2 -10
- package/src/runtime/checks.ts +11 -11
- package/src/runtime/client.ts +2 -2
- package/src/runtime/core.ts +5 -23
- package/src/runtime/dom.ts +1 -1
- package/src/runtime/html.ts +1 -1
- package/src/runtime/i18n.client.ts +1 -4
- package/src/runtime/i18n.server.ts +1 -4
- package/src/runtime/i18n.ts +3 -3
- package/src/runtime/index.ts +2 -2
- package/src/runtime/island.server.ts +18 -5
- package/src/runtime/live-resource.server.ts +0 -1
- package/src/runtime/live-value.server.ts +2 -2
- package/src/runtime/live-value.shared.ts +7 -20
- package/src/runtime/live.ts +1 -12
- package/src/runtime/local-types.ts +1 -11
- package/src/runtime/local.ts +4 -14
- package/src/runtime/navigate-api.ts +2 -5
- package/src/runtime/navigation-state.ts +0 -12
- package/src/runtime/page-swap.ts +6 -6
- package/src/runtime/persist.ts +11 -3
- package/src/runtime/persisted.ts +4 -30
- package/src/runtime/presence.ts +6 -7
- package/src/runtime/query-param.ts +20 -12
- package/src/runtime/reactive.ts +3 -1
- package/src/runtime/refuse.ts +3 -17
- package/src/runtime/store-base.ts +4 -6
- package/src/runtime/swap-fetch.ts +1 -1
- package/src/runtime/values.ts +40 -23
- package/src/runtime/with-query.ts +9 -0
- package/src/server/action-hooks.ts +8 -8
- package/src/server/actions.ts +13 -14
- package/src/server/api-modules.ts +2 -3
- package/src/server/app-stages.ts +15 -33
- package/src/server/app.ts +10 -5
- package/src/server/auth-mails.ts +0 -2
- package/src/server/env-state.ts +40 -10
- package/src/server/flash.ts +1 -1
- package/src/server/guard-requirement.ts +4 -4
- package/src/server/image.ts +2 -2
- package/src/server/index.ts +0 -2
- package/src/server/job-context.ts +3 -3
- package/src/server/jobs-page.ts +1 -1
- package/src/server/jobs.ts +5 -9
- package/src/server/kept-exports.ts +0 -2
- package/src/server/kv.ts +11 -14
- package/src/server/library.ts +1 -3
- package/src/server/live.ts +2 -2
- package/src/server/mcp.ts +3 -9
- package/src/server/metrics.ts +2 -4
- package/src/server/page-settings.ts +10 -19
- package/src/server/prerender.ts +19 -2
- package/src/server/protection.ts +15 -18
- package/src/server/queue.ts +3 -6
- package/src/server/rate-limit.ts +0 -3
- package/src/server/render-document.ts +1 -1
- package/src/server/routes.ts +7 -3
- package/src/server/scope.ts +3 -2
- package/src/server/session.ts +5 -6
- package/src/server/setup.ts +1 -1
- package/src/server/signals.ts +17 -7
- package/src/server/signed.ts +1 -3
- package/src/server/source.ts +20 -4
- package/src/server/speculation.ts +1 -1
- package/src/server/storage.ts +3 -8
- package/src/server/validate.ts +1 -1
- package/src/server/vitals.ts +1 -3
- package/src/server/work-scope.ts +2 -4
- package/src/server/work.ts +1 -1
- package/src/server/workflow.ts +1 -1
- package/src/test/index.ts +2 -1
- package/src/test/site-actions.ts +16 -6
- package/src/test/site-keys.ts +10 -15
- package/src/test/site-socket.ts +1 -2
- package/src/test/site-types.ts +0 -8
- package/types/build/client.d.ts +1 -1
- package/types/build/client.d.ts.map +1 -1
- package/types/build/icon-slots.d.ts +7 -0
- package/types/build/icon-slots.d.ts.map +1 -0
- package/types/build/libraries.d.ts +2 -0
- package/types/build/libraries.d.ts.map +1 -1
- package/types/build/plugin.d.ts +1 -0
- package/types/build/plugin.d.ts.map +1 -1
- package/types/build/route-sizes.d.ts.map +1 -1
- package/types/build/source-files.d.ts.map +1 -1
- package/types/build/variants.d.ts.map +1 -1
- package/types/check/diagnose.d.ts.map +1 -1
- package/types/check/index.d.ts +1 -2
- package/types/check/index.d.ts.map +1 -1
- package/types/check/project.d.ts.map +1 -1
- package/types/check/renamed-packages.d.ts +0 -3
- package/types/check/renamed-packages.d.ts.map +1 -1
- package/types/check/shadow-types.d.ts.map +1 -1
- package/types/commands/env.d.ts.map +1 -1
- package/types/compiler/ast.d.ts +1 -2
- package/types/compiler/ast.d.ts.map +1 -1
- package/types/compiler/browser.d.ts.map +1 -1
- package/types/compiler/class-items.d.ts +7 -0
- package/types/compiler/class-items.d.ts.map +1 -0
- package/types/compiler/dead-code.d.ts +9 -0
- package/types/compiler/dead-code.d.ts.map +1 -0
- package/types/compiler/deprecated-library.d.ts.map +1 -1
- package/types/compiler/deprecated-lints.d.ts +0 -560
- package/types/compiler/deprecated-lints.d.ts.map +1 -1
- package/types/compiler/deprecated-ui-props.d.ts +1 -8
- package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
- package/types/compiler/dom-property.d.ts +9 -0
- package/types/compiler/dom-property.d.ts.map +1 -0
- package/types/compiler/dom.d.ts +1 -0
- package/types/compiler/dom.d.ts.map +1 -1
- package/types/compiler/errors.d.ts +2 -2
- package/types/compiler/errors.d.ts.map +1 -1
- package/types/compiler/fence-checks.d.ts +0 -1
- package/types/compiler/fence-checks.d.ts.map +1 -1
- package/types/compiler/hand-parts.d.ts +7 -0
- package/types/compiler/hand-parts.d.ts.map +1 -0
- package/types/compiler/image-attributes.d.ts +0 -1
- package/types/compiler/image-attributes.d.ts.map +1 -1
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/island-arguments.d.ts +2 -11
- package/types/compiler/island-arguments.d.ts.map +1 -1
- package/types/compiler/island-cause.d.ts +1 -1
- package/types/compiler/island-cause.d.ts.map +1 -1
- package/types/compiler/island-declaration.d.ts +1 -3
- package/types/compiler/island-declaration.d.ts.map +1 -1
- package/types/compiler/island-lints.d.ts +10 -0
- package/types/compiler/island-lints.d.ts.map +1 -0
- package/types/compiler/island-problems.d.ts +7 -0
- package/types/compiler/island-problems.d.ts.map +1 -0
- package/types/compiler/jsx-class.d.ts +1 -2
- package/types/compiler/jsx-class.d.ts.map +1 -1
- package/types/compiler/kay-exports.d.ts.map +1 -1
- package/types/compiler/link-flags.d.ts +0 -6
- package/types/compiler/link-flags.d.ts.map +1 -1
- package/types/compiler/lints.d.ts +11 -572
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/markup.d.ts +1 -1
- package/types/compiler/markup.d.ts.map +1 -1
- package/types/compiler/module-signals.d.ts.map +1 -1
- package/types/compiler/names.d.ts.map +1 -1
- package/types/compiler/page-settings.d.ts +4 -0
- package/types/compiler/page-settings.d.ts.map +1 -1
- package/types/compiler/parser.d.ts.map +1 -1
- package/types/compiler/plan.d.ts.map +1 -1
- package/types/compiler/script-server.d.ts.map +1 -1
- package/types/compiler/validate.d.ts.map +1 -1
- package/types/config-loader.d.ts.map +1 -1
- package/types/config-resolve.d.ts.map +1 -1
- package/types/config-shape.d.ts +1 -1
- package/types/config-shape.d.ts.map +1 -1
- package/types/config.d.ts +5 -105
- package/types/config.d.ts.map +1 -1
- package/types/dev/preload.d.ts.map +1 -1
- package/types/lsp/server.d.ts.map +1 -1
- package/types/migrate/markup.d.ts.map +1 -1
- package/types/runtime/action-call.d.ts.map +1 -1
- package/types/runtime/action-encode.d.ts +1 -0
- package/types/runtime/action-encode.d.ts.map +1 -1
- package/types/runtime/action-error.d.ts +1 -2
- package/types/runtime/action-error.d.ts.map +1 -1
- package/types/runtime/action-run.d.ts +23 -0
- package/types/runtime/action-run.d.ts.map +1 -0
- package/types/runtime/action-shared.d.ts +1 -27
- package/types/runtime/action-shared.d.ts.map +1 -1
- package/types/runtime/action-stream.d.ts.map +1 -1
- package/types/runtime/action.d.ts +1 -1
- package/types/runtime/action.d.ts.map +1 -1
- package/types/runtime/call-result.d.ts +0 -10
- package/types/runtime/call-result.d.ts.map +1 -1
- package/types/runtime/checks.d.ts +6 -9
- package/types/runtime/checks.d.ts.map +1 -1
- package/types/runtime/core.d.ts +2 -20
- package/types/runtime/core.d.ts.map +1 -1
- package/types/runtime/dom.d.ts +1 -1
- package/types/runtime/dom.d.ts.map +1 -1
- package/types/runtime/html.d.ts +1 -1
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/i18n.client.d.ts +0 -1
- package/types/runtime/i18n.client.d.ts.map +1 -1
- package/types/runtime/i18n.d.ts +1 -1
- package/types/runtime/i18n.d.ts.map +1 -1
- package/types/runtime/i18n.server.d.ts +0 -1
- package/types/runtime/i18n.server.d.ts.map +1 -1
- package/types/runtime/index.d.ts +2 -2
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/island.server.d.ts +1 -0
- package/types/runtime/island.server.d.ts.map +1 -1
- package/types/runtime/live-resource.server.d.ts.map +1 -1
- package/types/runtime/live-value.shared.d.ts +7 -15
- package/types/runtime/live-value.shared.d.ts.map +1 -1
- package/types/runtime/live.d.ts +0 -11
- package/types/runtime/live.d.ts.map +1 -1
- package/types/runtime/local-types.d.ts +0 -14
- package/types/runtime/local-types.d.ts.map +1 -1
- package/types/runtime/navigate-api.d.ts +0 -4
- package/types/runtime/navigate-api.d.ts.map +1 -1
- package/types/runtime/navigation-state.d.ts +0 -4
- package/types/runtime/navigation-state.d.ts.map +1 -1
- package/types/runtime/page-swap.d.ts.map +1 -1
- package/types/runtime/persist.d.ts +1 -0
- package/types/runtime/persist.d.ts.map +1 -1
- package/types/runtime/persisted.d.ts +0 -15
- package/types/runtime/persisted.d.ts.map +1 -1
- package/types/runtime/presence.d.ts +0 -2
- package/types/runtime/presence.d.ts.map +1 -1
- package/types/runtime/query-param.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +2 -1
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/refuse.d.ts +0 -7
- package/types/runtime/refuse.d.ts.map +1 -1
- package/types/runtime/store-base.d.ts +1 -2
- package/types/runtime/store-base.d.ts.map +1 -1
- package/types/runtime/values.d.ts +2 -1
- package/types/runtime/values.d.ts.map +1 -1
- package/types/runtime/with-query.d.ts +2 -0
- package/types/runtime/with-query.d.ts.map +1 -1
- package/types/server/action-hooks.d.ts +4 -4
- package/types/server/action-hooks.d.ts.map +1 -1
- package/types/server/actions.d.ts.map +1 -1
- package/types/server/api-modules.d.ts +0 -1
- package/types/server/api-modules.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +5 -13
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/app.d.ts +3 -8
- package/types/server/app.d.ts.map +1 -1
- package/types/server/auth-mails.d.ts +0 -5
- package/types/server/auth-mails.d.ts.map +1 -1
- package/types/server/env-state.d.ts +1 -0
- package/types/server/env-state.d.ts.map +1 -1
- package/types/server/guard-requirement.d.ts +0 -1
- package/types/server/guard-requirement.d.ts.map +1 -1
- package/types/server/image.d.ts +0 -1
- package/types/server/image.d.ts.map +1 -1
- package/types/server/index.d.ts +0 -2
- package/types/server/index.d.ts.map +1 -1
- package/types/server/job-context.d.ts +1 -1
- package/types/server/job-context.d.ts.map +1 -1
- package/types/server/jobs.d.ts +0 -4
- package/types/server/jobs.d.ts.map +1 -1
- package/types/server/kept-exports.d.ts.map +1 -1
- package/types/server/kv.d.ts +4 -4
- package/types/server/kv.d.ts.map +1 -1
- package/types/server/library.d.ts +1 -3
- package/types/server/library.d.ts.map +1 -1
- package/types/server/mcp.d.ts +0 -1
- package/types/server/mcp.d.ts.map +1 -1
- package/types/server/metrics.d.ts +0 -5
- package/types/server/metrics.d.ts.map +1 -1
- package/types/server/page-settings.d.ts +3 -3
- package/types/server/page-settings.d.ts.map +1 -1
- package/types/server/prerender.d.ts.map +1 -1
- package/types/server/protection.d.ts +6 -6
- package/types/server/protection.d.ts.map +1 -1
- package/types/server/queue.d.ts +1 -3
- package/types/server/queue.d.ts.map +1 -1
- package/types/server/rate-limit.d.ts +0 -2
- package/types/server/rate-limit.d.ts.map +1 -1
- package/types/server/routes.d.ts +1 -1
- package/types/server/routes.d.ts.map +1 -1
- package/types/server/scope.d.ts.map +1 -1
- package/types/server/session.d.ts +1 -1
- package/types/server/session.d.ts.map +1 -1
- package/types/server/signals.d.ts.map +1 -1
- package/types/server/signed.d.ts +0 -2
- package/types/server/signed.d.ts.map +1 -1
- package/types/server/source.d.ts +1 -1
- package/types/server/source.d.ts.map +1 -1
- package/types/server/storage.d.ts +0 -4
- package/types/server/storage.d.ts.map +1 -1
- package/types/server/vitals.d.ts +0 -1
- package/types/server/vitals.d.ts.map +1 -1
- package/types/server/work-scope.d.ts +0 -2
- package/types/server/work-scope.d.ts.map +1 -1
- package/types/server/workflow.d.ts +1 -1
- package/types/server/workflow.d.ts.map +1 -1
- package/types/test/index.d.ts.map +1 -1
- package/types/test/site-actions.d.ts +1 -1
- package/types/test/site-actions.d.ts.map +1 -1
- package/types/test/site-keys.d.ts +1 -1
- package/types/test/site-keys.d.ts.map +1 -1
- package/types/test/site-socket.d.ts +1 -1
- package/types/test/site-socket.d.ts.map +1 -1
- package/types/test/site-types.d.ts +0 -8
- package/types/test/site-types.d.ts.map +1 -1
- package/llms/deprecated-lints-1-105-libraries.md +0 -32
- package/llms/deprecated-lints-1-105.md +0 -58
- package/src/check/action-readers.ts +0 -115
- package/src/check/action-type.ts +0 -44
- package/src/check/ai-language.ts +0 -56
- package/src/check/app-hooks.ts +0 -90
- package/src/check/auth-methods.ts +0 -85
- package/src/check/auth-rate-limits.ts +0 -99
- package/src/check/call-result.ts +0 -242
- package/src/check/client-keys.ts +0 -10
- package/src/check/cms-options.ts +0 -81
- package/src/check/config-groups.ts +0 -22
- package/src/check/config-switches.ts +0 -38
- package/src/check/context-import.ts +0 -51
- package/src/check/env-files.ts +0 -31
- package/src/check/format-duration.ts +0 -75
- package/src/check/guard-options.ts +0 -58
- package/src/check/handler-events.ts +0 -149
- package/src/check/hook-context.ts +0 -94
- package/src/check/hook-names.ts +0 -104
- package/src/check/i18n-keys.ts +0 -50
- package/src/check/images-keys.ts +0 -54
- package/src/check/job-shapes.ts +0 -273
- package/src/check/link-flag-tests.ts +0 -130
- package/src/check/live-api.ts +0 -137
- package/src/check/mail-api.ts +0 -67
- package/src/check/one-state-api.ts +0 -357
- package/src/check/pages-options.ts +0 -35
- package/src/check/rate-enforce.ts +0 -53
- package/src/check/refusal-calls.ts +0 -185
- package/src/check/retired-lints.ts +0 -49
- package/src/check/route-keys.ts +0 -166
- package/src/check/secret-keys.ts +0 -83
- package/src/check/socket-frames.ts +0 -102
- package/src/check/source-readers.ts +0 -257
- package/src/check/store-ms.ts +0 -72
- package/src/check/store-names.ts +0 -88
- package/src/check/test-helpers.ts +0 -98
- package/src/check/ttl-names.ts +0 -142
- package/src/compiler/deprecated-ai-labels.ts +0 -97
- package/src/compiler/deprecated-ai-links.ts +0 -63
- package/src/compiler/deprecated-allow.ts +0 -50
- package/src/compiler/deprecated-auth-lints.ts +0 -14
- package/src/compiler/deprecated-auth-signed.ts +0 -29
- package/src/compiler/deprecated-children.ts +0 -66
- package/src/compiler/deprecated-image.ts +0 -116
- package/src/compiler/deprecated-island.ts +0 -155
- package/src/compiler/deprecated-lints-1-105.ts +0 -41
- package/src/compiler/deprecated-page.ts +0 -125
- package/src/compiler/deprecated-parts.ts +0 -22
- package/src/compiler/deprecated-typed-lints.ts +0 -23
- package/src/compiler/deprecated-ui-callbacks.ts +0 -66
- package/src/compiler/deprecated-ui-input.ts +0 -97
- package/src/compiler/deprecated-ui-items.ts +0 -47
- package/src/compiler/old-parts.ts +0 -84
- package/src/runtime/mount.compat.ts +0 -8
- package/src/server/moved-exports.ts +0 -17
- package/types/check/action-readers.d.ts +0 -3
- package/types/check/action-readers.d.ts.map +0 -1
- package/types/check/action-type.d.ts +0 -3
- package/types/check/action-type.d.ts.map +0 -1
- package/types/check/ai-language.d.ts +0 -3
- package/types/check/ai-language.d.ts.map +0 -1
- package/types/check/app-hooks.d.ts +0 -3
- package/types/check/app-hooks.d.ts.map +0 -1
- package/types/check/auth-methods.d.ts +0 -3
- package/types/check/auth-methods.d.ts.map +0 -1
- package/types/check/auth-rate-limits.d.ts +0 -3
- package/types/check/auth-rate-limits.d.ts.map +0 -1
- package/types/check/call-result.d.ts +0 -7
- package/types/check/call-result.d.ts.map +0 -1
- package/types/check/client-keys.d.ts +0 -3
- package/types/check/client-keys.d.ts.map +0 -1
- package/types/check/cms-options.d.ts +0 -3
- package/types/check/cms-options.d.ts.map +0 -1
- package/types/check/config-groups.d.ts +0 -3
- package/types/check/config-groups.d.ts.map +0 -1
- package/types/check/config-switches.d.ts +0 -3
- package/types/check/config-switches.d.ts.map +0 -1
- package/types/check/context-import.d.ts +0 -3
- package/types/check/context-import.d.ts.map +0 -1
- package/types/check/env-files.d.ts +0 -3
- package/types/check/env-files.d.ts.map +0 -1
- package/types/check/format-duration.d.ts +0 -5
- package/types/check/format-duration.d.ts.map +0 -1
- package/types/check/guard-options.d.ts +0 -3
- package/types/check/guard-options.d.ts.map +0 -1
- package/types/check/handler-events.d.ts +0 -9
- package/types/check/handler-events.d.ts.map +0 -1
- package/types/check/hook-context.d.ts +0 -3
- package/types/check/hook-context.d.ts.map +0 -1
- package/types/check/hook-names.d.ts +0 -3
- package/types/check/hook-names.d.ts.map +0 -1
- package/types/check/i18n-keys.d.ts +0 -3
- package/types/check/i18n-keys.d.ts.map +0 -1
- package/types/check/images-keys.d.ts +0 -3
- package/types/check/images-keys.d.ts.map +0 -1
- package/types/check/job-shapes.d.ts +0 -6
- package/types/check/job-shapes.d.ts.map +0 -1
- package/types/check/link-flag-tests.d.ts +0 -4
- package/types/check/link-flag-tests.d.ts.map +0 -1
- package/types/check/live-api.d.ts +0 -3
- package/types/check/live-api.d.ts.map +0 -1
- package/types/check/mail-api.d.ts +0 -3
- package/types/check/mail-api.d.ts.map +0 -1
- package/types/check/one-state-api.d.ts +0 -9
- package/types/check/one-state-api.d.ts.map +0 -1
- package/types/check/pages-options.d.ts +0 -3
- package/types/check/pages-options.d.ts.map +0 -1
- package/types/check/rate-enforce.d.ts +0 -3
- package/types/check/rate-enforce.d.ts.map +0 -1
- package/types/check/refusal-calls.d.ts +0 -3
- package/types/check/refusal-calls.d.ts.map +0 -1
- package/types/check/retired-lints.d.ts +0 -3
- package/types/check/retired-lints.d.ts.map +0 -1
- package/types/check/route-keys.d.ts +0 -3
- package/types/check/route-keys.d.ts.map +0 -1
- package/types/check/secret-keys.d.ts +0 -3
- package/types/check/secret-keys.d.ts.map +0 -1
- package/types/check/socket-frames.d.ts +0 -3
- package/types/check/socket-frames.d.ts.map +0 -1
- package/types/check/source-readers.d.ts +0 -3
- package/types/check/source-readers.d.ts.map +0 -1
- package/types/check/store-ms.d.ts +0 -3
- package/types/check/store-ms.d.ts.map +0 -1
- package/types/check/store-names.d.ts +0 -3
- package/types/check/store-names.d.ts.map +0 -1
- package/types/check/test-helpers.d.ts +0 -3
- package/types/check/test-helpers.d.ts.map +0 -1
- package/types/check/ttl-names.d.ts +0 -3
- package/types/check/ttl-names.d.ts.map +0 -1
- package/types/compiler/deprecated-ai-labels.d.ts +0 -5
- package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
- package/types/compiler/deprecated-ai-links.d.ts +0 -5
- package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
- package/types/compiler/deprecated-allow.d.ts +0 -5
- package/types/compiler/deprecated-allow.d.ts.map +0 -1
- package/types/compiler/deprecated-auth-lints.d.ts +0 -12
- package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
- package/types/compiler/deprecated-auth-signed.d.ts +0 -5
- package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
- package/types/compiler/deprecated-children.d.ts +0 -4
- package/types/compiler/deprecated-children.d.ts.map +0 -1
- package/types/compiler/deprecated-image.d.ts +0 -5
- package/types/compiler/deprecated-image.d.ts.map +0 -1
- package/types/compiler/deprecated-island.d.ts +0 -9
- package/types/compiler/deprecated-island.d.ts.map +0 -1
- package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
- package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
- package/types/compiler/deprecated-page.d.ts +0 -4
- package/types/compiler/deprecated-page.d.ts.map +0 -1
- package/types/compiler/deprecated-parts.d.ts +0 -3
- package/types/compiler/deprecated-parts.d.ts.map +0 -1
- package/types/compiler/deprecated-typed-lints.d.ts +0 -21
- package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
- package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-input.d.ts +0 -5
- package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-items.d.ts +0 -5
- package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
- package/types/compiler/old-parts.d.ts +0 -9
- package/types/compiler/old-parts.d.ts.map +0 -1
- package/types/runtime/mount.compat.d.ts +0 -7
- package/types/runtime/mount.compat.d.ts.map +0 -1
- package/types/server/moved-exports.d.ts +0 -12
- package/types/server/moved-exports.d.ts.map +0 -1
package/src/runtime/client.ts
CHANGED
|
@@ -267,8 +267,8 @@ async function hydrateIsland(registry: IslandRegistry, element: HTMLElement): Pr
|
|
|
267
267
|
|
|
268
268
|
const draw = () => render(() => withIds(ids, () => component(props)), element)
|
|
269
269
|
|
|
270
|
-
// A client-only island has no server markup to claim, only the fallback it renders over.
|
|
271
|
-
if (element.dataset.client !== undefined) {
|
|
270
|
+
// A client-only island has no server markup to claim, only the fallback it renders over, and so has one the build drew at the default query when the page is opened at another.
|
|
271
|
+
if (element.dataset.client !== undefined || (element.dataset.query !== undefined && location.search !== '')) {
|
|
272
272
|
renderOver(element, id, draw, false)
|
|
273
273
|
}
|
|
274
274
|
else {
|
package/src/runtime/core.ts
CHANGED
|
@@ -216,15 +216,15 @@ export function throttled<T>(source: () => T, delay: Duration, options?: EffectO
|
|
|
216
216
|
type EventMapOf<T> = T extends Window ? WindowEventMap : T extends Document ? DocumentEventMap : T extends HTMLElement ? HTMLElementEventMap : T extends MediaQueryList ? MediaQueryListEventMap : Record<string, Event>
|
|
217
217
|
|
|
218
218
|
// Listens to `type` events on `target`, `window` or `document` for instance, while the island lives; nothing listens while the server renders.
|
|
219
|
-
// `target` is a function returning it, `listen(() => window, ...)`, so `window` is never read on the server and a signal or a `ref` it reads is followed: its new value listens as it changes.
|
|
219
|
+
// `target` is a function returning it, `listen(() => window, ...)`, so `window` is never read on the server and a signal or a `ref` it reads is followed: its new value listens as it changes.
|
|
220
220
|
// Returns what stops it before the island ends, which the `signal` of its options does too.
|
|
221
221
|
// The handler runs under the owner `listen` was called in, so a stream it starts closes with that island or block.
|
|
222
222
|
// kept: free
|
|
223
|
-
export function listen<T extends EventTarget, K extends keyof EventMapOf<T> & string>(target:
|
|
223
|
+
export function listen<T extends EventTarget, K extends keyof EventMapOf<T> & string>(target: () => T | null | undefined, type: K, handler: (event: EventMapOf<T>[K]) => void, options?: boolean | AddEventListenerOptions): () => void {
|
|
224
224
|
const owner = getOwner()
|
|
225
225
|
|
|
226
226
|
return lasting('listen', handler, () => createEffect(() => {
|
|
227
|
-
const at =
|
|
227
|
+
const at = target()
|
|
228
228
|
|
|
229
229
|
if (!at)
|
|
230
230
|
return
|
|
@@ -371,11 +371,7 @@ export interface RequestContext<Params extends Record<string, unknown> = Record<
|
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
// `ctx.deny(status, { message, errors, data })`, the one shape every refusal takes (`refuse()` throws the same).
|
|
374
|
-
export
|
|
375
|
-
<const Status extends number = number>(status?: Status & ErrorStatus<Status>, options?: DenyOptions<ErrorData>): never
|
|
376
|
-
/** @deprecated `deny(status, { message, data })`. Removed in 1.108; `deprecated-deny-call` rewrites it. */
|
|
377
|
-
(status: number, message: string, data?: ErrorData): never
|
|
378
|
-
}
|
|
374
|
+
export type Deny = <const Status extends number = number>(status?: Status & ErrorStatus<Status>, options?: DenyOptions<ErrorData>) => never
|
|
379
375
|
|
|
380
376
|
// What `ctx.deny` hands the error page as `ctx.error.data`: the `errorData` an app sets in `Register`, `unknown` otherwise.
|
|
381
377
|
export type ErrorData = Register extends { errorData: infer Data } ? Data : unknown
|
|
@@ -489,7 +485,7 @@ export function defer<T>(value: T | PromiseLike<T>): Deferred<T> {
|
|
|
489
485
|
return promise
|
|
490
486
|
}
|
|
491
487
|
|
|
492
|
-
// `export const page = { ... }` in a page's server fence; a layout takes `query` as well as `layouts`, `security`, `reload`, `
|
|
488
|
+
// `export const page = { ... }` in a page's server fence; a layout takes `query` as well as `layouts`, `security`, `reload`, `seo`, `cache`, `rateLimit`, which apply to the pages under it, and `guards`, which opens its own actions.
|
|
493
489
|
export interface PageSettings {
|
|
494
490
|
// `kay build` renders the page once: `true` for a route without params, else the params of each page to render, as a list, a function returning one, a content collection or a `paginate()` list.
|
|
495
491
|
prerender?: boolean | object
|
|
@@ -498,10 +494,6 @@ export interface PageSettings {
|
|
|
498
494
|
keep?: boolean
|
|
499
495
|
// How the prerendered page is cached. `'1h'`: the server renders it again in the background once it is older, and a public page answers `cache-control: public, max-age=0, s-maxage=3600, stale-while-revalidate=3600` so a CDN keeps it that long. `{ browser, shared, swr }` sets each part of the header, `shared` also being how long the page is served before it renders again. `'private'` sends `private`, `false` the default `public, max-age=0, must-revalidate`. A page behind a guard, or rendered for one visitor, is `private` whatever this says; a layout's applies to every page under it, the innermost winning.
|
|
500
496
|
cache?: PageCache
|
|
501
|
-
/** @deprecated Write `cache: '1h'`. Removed in 1.108.0; `deprecated-page-cache` rewrites it. */
|
|
502
|
-
ttl?: Duration
|
|
503
|
-
/** @deprecated Write `cache: { browser, shared, swr }`, or `cache: false`. Removed in 1.108.0; `deprecated-page-cache` rewrites `false`. */
|
|
504
|
-
cacheControl?: string | false
|
|
505
497
|
// `false` renders the page, or the layouts below this one, without the layouts above; `true`, the default, says nothing.
|
|
506
498
|
layouts?: boolean
|
|
507
499
|
// `false` runs none of the `_guard.ts` files above the page, nor above its actions or a layout's: a sign-in page under a guard asking for a session. A guard, a list of them or `{ load }` returning one runs after those files, before the page and its actions; on a layout, before its actions alone. `true`, the default, says nothing.
|
|
@@ -514,14 +506,6 @@ export interface PageSettings {
|
|
|
514
506
|
query?: Schema
|
|
515
507
|
// What search engines, the sitemap and social networks read of the page: the `title`, `description`, `image` and `canonical` of its head, written once here instead of in a `head` block when they do not depend on the request, and `noindex`, `sitemap`, `lastmod`, `search` and `feed` beside them. A layout's applies to every page under it, the innermost setting winning.
|
|
516
508
|
seo?: PageSeo
|
|
517
|
-
/** @deprecated Write it in `seo`. Removed in 1.108.0; `deprecated-page-seo` rewrites it. */
|
|
518
|
-
sitemap?: boolean | object
|
|
519
|
-
/** @deprecated Write it in `seo`. Removed in 1.108.0; `deprecated-page-seo` rewrites it. */
|
|
520
|
-
lastmod?: Lastmod | ((params: Record<string, string>) => Lastmod | undefined | Promise<Lastmod | undefined>)
|
|
521
|
-
/** @deprecated Write it in `seo`. Removed in 1.108.0; `deprecated-page-seo` rewrites it. */
|
|
522
|
-
feed?: false | object | readonly object[]
|
|
523
|
-
/** @deprecated Write it in `seo`. Removed in 1.108.0; `deprecated-page-seo` rewrites it. */
|
|
524
|
-
noindex?: boolean
|
|
525
509
|
// What the page's responses send over the site's security headers; a layout's applies to every page under it, the inner one merged over the outer.
|
|
526
510
|
security?: PageSecurity
|
|
527
511
|
// `true` loads the page fully from any link or form of the site, past the page swap: a page whose scripts expect a fresh document.
|
|
@@ -530,8 +514,6 @@ export interface PageSettings {
|
|
|
530
514
|
// `true` leaves the page to its live connection after a call whose handler invalidated cached keys it follows, when every key the call invalidated is followed: the call does not load the page again. For a page whose every read of what actions change is a `cached(..., { live: true })` value or a `resource()`.
|
|
531
515
|
// `false`, the default, loads the page again after every call.
|
|
532
516
|
liveRefresh?: boolean
|
|
533
|
-
/** @deprecated Write it in `seo`. Removed in 1.108.0; `deprecated-page-seo` rewrites it. */
|
|
534
|
-
search?: PageSearch | ((params: Record<string, string>) => PageSearch | undefined | Promise<PageSearch | undefined>)
|
|
535
517
|
}
|
|
536
518
|
|
|
537
519
|
export type PageSearch = false | { weight?: number }
|
package/src/runtime/dom.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare const KAY_FRENCH: true | undefined
|
|
|
21
21
|
export { holdSubmits, listenSubmit, listenSubmitWith, listenWith } from './form-hold'
|
|
22
22
|
export { renderEffect as effect, memo, untrack } from './reactive'
|
|
23
23
|
export { transition } from './transition'
|
|
24
|
-
export { checkedMarkup, componentClass, merge, omit, partClass, partHanded, partsClass, spreadAttributes, spreadWith } from './values'
|
|
24
|
+
export { checkedMarkup, componentClass, handParts, merge, omit, partClass, partHanded, partsClass, spreadAttributes, spreadWith } from './values'
|
|
25
25
|
|
|
26
26
|
// Several sibling nodes rendered as one: a block or a component returning more than one node. Its first and last nodes stay in place while what sits between changes.
|
|
27
27
|
export class Range {
|
package/src/runtime/html.ts
CHANGED
|
@@ -35,7 +35,7 @@ export { memo, untrack } from './reactive'
|
|
|
35
35
|
export { html, isRendered } from './rendered'
|
|
36
36
|
|
|
37
37
|
export type { Html } from './rendered'
|
|
38
|
-
export { checkedMarkup, componentClass, merge, omit, partClass, partHanded, partsClass, spreadWith } from './values'
|
|
38
|
+
export { checkedMarkup, componentClass, handParts, merge, omit, partClass, partHanded, partsClass, spreadWith } from './values'
|
|
39
39
|
|
|
40
40
|
// Leads the markup of a `try` block the server rendered its `catch` block for.
|
|
41
41
|
export const FAILED_MARKER = `<!--${FAILED}-->`
|
|
@@ -139,10 +139,7 @@ export function formatBytes(size: ByteSize, options?: NumberFormatOptions): stri
|
|
|
139
139
|
return formatBytesIn(translations().locale, size, options)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export function formatDuration(duration: Duration, options?: DurationFormatOptions): string
|
|
143
|
-
// Milliseconds, until 1.108: `deprecated-format-duration` rewrites a literal.
|
|
144
|
-
export function formatDuration(milliseconds: number, options?: DurationFormatOptions): string
|
|
145
|
-
export function formatDuration(duration: Duration | number, options?: DurationFormatOptions): string {
|
|
142
|
+
export function formatDuration(duration: Duration, options?: DurationFormatOptions): string {
|
|
146
143
|
return formatDurationIn(translations().locale, duration, options)
|
|
147
144
|
}
|
|
148
145
|
|
|
@@ -101,10 +101,7 @@ export function formatBytes(size: ByteSize, options?: NumberFormatOptions): stri
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// kept: free, a format by the locale, which a kept copy is stored per.
|
|
104
|
-
export function formatDuration(duration: Duration, options?: DurationFormatOptions): string
|
|
105
|
-
// Milliseconds, until 1.108: `deprecated-format-duration` rewrites a literal.
|
|
106
|
-
export function formatDuration(milliseconds: number, options?: DurationFormatOptions): string
|
|
107
|
-
export function formatDuration(duration: Duration | number, options?: DurationFormatOptions): string {
|
|
104
|
+
export function formatDuration(duration: Duration, options?: DurationFormatOptions): string {
|
|
108
105
|
return formatDurationIn(formatLocale(), duration, options)
|
|
109
106
|
}
|
|
110
107
|
|
package/src/runtime/i18n.ts
CHANGED
|
@@ -320,10 +320,10 @@ export function formatBytes(page: string, given: ByteSize, options?: NumberForma
|
|
|
320
320
|
// Each unit of a duration with its length in milliseconds.
|
|
321
321
|
const DURATION_UNITS: readonly [string, number][] = [['day', 86_400_000], ['hour', 3_600_000], ['minute', 60_000], ['second', 1000]]
|
|
322
322
|
|
|
323
|
-
// A length of time, written with its unit (`'125m'`)
|
|
324
|
-
export function formatDuration(page: string, duration: Duration
|
|
323
|
+
// A length of time, written with its unit (`'125m'`), in its largest unit and the one below, `2 hr 5 min`, the lower one left out when it is zero.
|
|
324
|
+
export function formatDuration(page: string, duration: Duration, given?: DurationFormatOptions): string {
|
|
325
325
|
const [locale, options] = withLocale(page, given)
|
|
326
|
-
const milliseconds =
|
|
326
|
+
const milliseconds = durationMs(duration)
|
|
327
327
|
const total = Number.isFinite(milliseconds) ? Math.round(Math.max(0, milliseconds) / 1000) * 1000 : 0
|
|
328
328
|
const reached = DURATION_UNITS.findIndex(([, length]) => total >= length)
|
|
329
329
|
const first = reached === -1 ? DURATION_UNITS.length - 1 : reached
|
package/src/runtime/index.ts
CHANGED
|
@@ -47,7 +47,7 @@ export { mount } from './mount'
|
|
|
47
47
|
export type { NavigateOptions, QueryChanges } from './navigate-api'
|
|
48
48
|
export { navigate, refresh } from './navigate-api'
|
|
49
49
|
export type { BeforeNavigate, NavigateEvent, NavigateFailure, NavigateStart, NavigationState } from './navigation-state'
|
|
50
|
-
export { navigation
|
|
50
|
+
export { navigation } from './navigation-state'
|
|
51
51
|
export { online } from './online'
|
|
52
52
|
export { optimistic } from './optimistic'
|
|
53
53
|
export type { PersistStorage } from './persist'
|
|
@@ -65,7 +65,7 @@ export { batch, flush, memo, onCleanup, root, untrack } from './reactive'
|
|
|
65
65
|
export { reactiveMap, reactiveSet } from './reactive-collections'
|
|
66
66
|
export type { Recipe, RecipeConfig, RecipeProps, WidenedProps } from './recipe'
|
|
67
67
|
export { recipe } from './recipe'
|
|
68
|
-
export type { DenyOptions
|
|
68
|
+
export type { DenyOptions } from './refuse'
|
|
69
69
|
export { refuse } from './refuse'
|
|
70
70
|
export type { RouteArgs, RouteOptions, RoutePattern } from './route'
|
|
71
71
|
export { route } from './route'
|
|
@@ -9,7 +9,7 @@ import { BUTTON_FORM_KEY } from './button-form'
|
|
|
9
9
|
import { escapeAttribute, quotedAttribute } from './escape'
|
|
10
10
|
import { withFieldMarks } from './fields'
|
|
11
11
|
import { headMark, setsIslandTitle } from './head'
|
|
12
|
-
import { child, omit } from './html'
|
|
12
|
+
import { child, omit, prerendering } from './html'
|
|
13
13
|
import { noteLives } from './live-value'
|
|
14
14
|
import { localeState } from './locale-state'
|
|
15
15
|
import { TITLED_ATTRIBUTE } from './markers'
|
|
@@ -105,6 +105,14 @@ export function collectIslands<T>(render: () => T, salt?: string, chunks?: Recor
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
// Whether the island being rendered, or a page outside any, read a query param.
|
|
109
|
+
let queried = false
|
|
110
|
+
|
|
111
|
+
// A query param was read: the island rendering it depends on the address, which a page rendered once at build time cannot show.
|
|
112
|
+
export function noteQuery(): void {
|
|
113
|
+
queried = true
|
|
114
|
+
}
|
|
115
|
+
|
|
108
116
|
// The keys of the components the island being rendered draws that load on their own in the browser.
|
|
109
117
|
let drawn: Set<string> | undefined
|
|
110
118
|
|
|
@@ -175,7 +183,7 @@ function ownProps<P extends object>(props: P & IslandOptions, renderClient: bool
|
|
|
175
183
|
}
|
|
176
184
|
|
|
177
185
|
// On the server an interactive component renders inside a `<slot>` the browser hydrates, its props serialized for the client.
|
|
178
|
-
// A client-only one, `client` or rendered with `
|
|
186
|
+
// A client-only one, `island({ render: 'client' })` or rendered with `render="client"`, holds only its fallback in the slot, the use's `@fallback` block else the component's own, until the browser renders into it, and inside another island renders nothing.
|
|
179
187
|
// Browsers lay a slot out as `display: contents`, so the island sits in a flex or grid parent as its own markup would, with no stylesheet to ship.
|
|
180
188
|
// `messages` are the keys its source passes `t()` as they are written, which it may only look up once in the browser. `lives` are the live values it imports, which the page proves though only the browser may read them.
|
|
181
189
|
// `cause` is only passed under `kay dev`, which writes it as the `data-why` the dev tool's Islands tab shows, so production markup is the same with or without it.
|
|
@@ -184,7 +192,7 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
184
192
|
const when = props.hydrate ?? asks?.hydrate
|
|
185
193
|
const persist = persistKey(props.persist ?? asks?.persist, id)
|
|
186
194
|
const renderClient = props.render === 'client'
|
|
187
|
-
const browserOnly = client ||
|
|
195
|
+
const browserOnly = client || renderClient
|
|
188
196
|
const waits = isWaiting(when, id)
|
|
189
197
|
const own = ownProps(props, renderClient, browserOnly)
|
|
190
198
|
|
|
@@ -241,8 +249,10 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
241
249
|
|
|
242
250
|
const keys = new Set<string>()
|
|
243
251
|
const outer = drawn
|
|
252
|
+
const outerQuery = queried
|
|
244
253
|
|
|
245
254
|
drawn = keys
|
|
255
|
+
queried = false
|
|
246
256
|
|
|
247
257
|
try {
|
|
248
258
|
// Detached, as in the browser, where an island reads nothing the page's components provide.
|
|
@@ -254,20 +264,23 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
254
264
|
const marked = waits || when === 'load' ? ` data-hydrate="${escapeAttribute(when!)}"` : ''
|
|
255
265
|
const chunk = rendered?.chunks?.[id]
|
|
256
266
|
const lazies = lazyAttribute(keys, waits)
|
|
257
|
-
|
|
267
|
+
// A page rendered once is shown at every query: the browser draws this island afresh from the address it is opened at, rather than claiming markup made for the default one.
|
|
268
|
+
const byQuery = queried && prerendering() && !browserOnly ? ' data-query' : ''
|
|
269
|
+
const markup: Html = renderedHtml(`<slot data-component="${escapeAttribute(id)}" data-props=${quotedAttribute(serialized)}${lazies}${cause === undefined ? '' : ` data-why=${quotedAttribute(cause)}`}${marked}${titled}${shipped}${browserOnly ? ' data-client' : ''}${byQuery}${count === 0 ? '' : ` data-uid="${escapeAttribute(prefix)}"`}${persist === undefined ? '' : ` data-persist="${escapeAttribute(persist)}"`}${chunk === undefined ? '' : ` data-chunk="${escapeAttribute(chunk)}"`}>${html}</slot>`)
|
|
258
270
|
|
|
259
271
|
return markup as unknown as JSX.Element
|
|
260
272
|
}
|
|
261
273
|
finally {
|
|
262
274
|
depth--
|
|
263
275
|
drawn = outer
|
|
276
|
+
queried = outerQuery || queried
|
|
264
277
|
}
|
|
265
278
|
}
|
|
266
279
|
|
|
267
280
|
return carryFailed(component, render) as IslandComponent<P>
|
|
268
281
|
}
|
|
269
282
|
|
|
270
|
-
// Whether a use of an island that follows no live value, whose `
|
|
283
|
+
// Whether a use of an island that follows no live value, whose `island()` call lists the props that make it interactive, turns none of them on: no listed prop has a value (or a default) that is on, the use asks for no hydration of its own, and none of its props is a function, which an island refuses to send and the use is told of as before.
|
|
271
284
|
function staysPlain(depth: number, client: boolean, lives: readonly unknown[], props: object, asks: IslandAsks | undefined): boolean {
|
|
272
285
|
const wants = asks?.interactive
|
|
273
286
|
|
|
@@ -248,7 +248,7 @@ function readOwn(slot: ServerSlot): unknown {
|
|
|
248
248
|
return value
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
// An island's server render notes the live values it imports, so the page proves them though the render did not read them, as when a handler or a
|
|
251
|
+
// An island's server render notes the live values it imports, so the page proves them though the render did not read them, as when a handler or a client-only component reads one later. A keyed value is left out: its key is not known before it is read.
|
|
252
252
|
export function noteLives(handles: readonly unknown[]): void {
|
|
253
253
|
for (const handle of handles) {
|
|
254
254
|
const slot = typeof handle === 'function' ? slotOfHandle.get(handle) : undefined
|
|
@@ -544,7 +544,7 @@ function datedTogether(id: string): void {
|
|
|
544
544
|
continue
|
|
545
545
|
|
|
546
546
|
try {
|
|
547
|
-
const sent = store.endAll(dated, lengthFor(
|
|
547
|
+
const sent = store.endAll(dated, lengthFor(ttl))
|
|
548
548
|
|
|
549
549
|
if (sent !== undefined)
|
|
550
550
|
void logged(sent, dated)
|
|
@@ -33,11 +33,7 @@ export interface Live<T> extends LiveSource<{ value: T }> {
|
|
|
33
33
|
// A value of each user, declared `live(initial, { user: true })`: read by calling it, which gives the signed-in visitor's own and `initial` for nobody; the server writes one user's with `set(next, { user })`, `user` being the id the library that signs them in names (`userOf` of `kay/library`, which kayjs-auth does).
|
|
34
34
|
export interface LiveOwn<T> extends LiveSource<{ value: T }> {
|
|
35
35
|
(): T
|
|
36
|
-
set: {
|
|
37
|
-
(next: Next<T>, options: { user: string }): void
|
|
38
|
-
/** @deprecated Written `set(user, next)`; `deprecated-live-api` rewrites it. Removed in 1.108. */
|
|
39
|
-
(user: string, next: Next<T>): void
|
|
40
|
-
}
|
|
36
|
+
set: (next: Next<T>, options: { user: string }) => void
|
|
41
37
|
// Puts a user's value back to `initial`, and frees what is kept for it.
|
|
42
38
|
delete: (user: string) => void
|
|
43
39
|
}
|
|
@@ -45,11 +41,7 @@ export interface LiveOwn<T> extends LiveSource<{ value: T }> {
|
|
|
45
41
|
// A live value per key, `room(id)` reading one: what the declaration gives a key nothing was set for. The event of `onData` names the key.
|
|
46
42
|
export interface LiveByKey<K extends LiveKey, T> extends LiveSource<{ value: T, key: K }> {
|
|
47
43
|
(key: K): T
|
|
48
|
-
set: {
|
|
49
|
-
(next: Next<T>, options: { key: K }): void
|
|
50
|
-
/** @deprecated Written `set(key, next)`; `deprecated-live-api` rewrites it. Removed in 1.108. */
|
|
51
|
-
(key: K, next: Next<T>): void
|
|
52
|
-
}
|
|
44
|
+
set: (next: Next<T>, options: { key: K }) => void
|
|
53
45
|
// Puts a key back to what the declaration gives it, and frees what is kept for it.
|
|
54
46
|
delete: (key: K) => void
|
|
55
47
|
}
|
|
@@ -82,9 +74,8 @@ export interface LiveStore extends StoreBase {
|
|
|
82
74
|
// Gives a value held with no end the end, leaving its text and any end it has; optional, a store without it has the value written again with the end, which can overwrite a text another process set meanwhile.
|
|
83
75
|
end?: (id: string, key: string, expiresAt: number) => void | Promise<void>
|
|
84
76
|
|
|
85
|
-
// Gives every value of an id held with no end the end of now plus `ttl`, a `Duration`
|
|
86
|
-
|
|
87
|
-
endAll?(id: string, ttl: Duration | number): void | Promise<void>
|
|
77
|
+
// Gives every value of an id held with no end the end of now plus `ttl`, a `Duration` (`lengthMs(ttl)` from `kay` reads it), in one write and one event, including a row this process did not read, which only the other processes then hear dated; optional, a store without it has `end` called for each value, and one that only keeps `set` has each written again.
|
|
78
|
+
endAll?: (id: string, ttl: Duration) => void | Promise<void>
|
|
88
79
|
// Drops a key and tells the other processes.
|
|
89
80
|
delete: (id: string, key: string) => void | Promise<void>
|
|
90
81
|
// Calls `listener` with the text now held for a key another process set, and when it ends if it has a `ttl`, or undefined once it deleted it; never for this process's own.
|
|
@@ -129,16 +120,12 @@ export function keyText(key: LiveKey): string {
|
|
|
129
120
|
return String(key)
|
|
130
121
|
}
|
|
131
122
|
|
|
132
|
-
// What `set` of a value per key or per user was given, as `set(next, { key })
|
|
133
|
-
// The options are a second argument holding only `field`, so a next value that is such an object, written in the old order, reads as options.
|
|
123
|
+
// What `set` of a value per key or per user was given, as `set(next, { key })`: the key and the next value.
|
|
134
124
|
export function writeArguments(args: unknown[], field: 'key' | 'user', what: string): [key: string, next: unknown] {
|
|
135
125
|
const [first, second] = args
|
|
136
126
|
|
|
137
|
-
if (
|
|
127
|
+
if (typeof second !== 'object' || second === null || !(field in second))
|
|
138
128
|
throw new KayError('argument-invalid', `kay: ${what} is one value for each ${field}: \`set(next, { ${field} })\``)
|
|
139
129
|
|
|
140
|
-
|
|
141
|
-
return [keyText((second as Record<string, string>)[field]!), first]
|
|
142
|
-
|
|
143
|
-
return [keyText(first as string), second]
|
|
130
|
+
return [keyText((second as Record<string, string>)[field]!), first]
|
|
144
131
|
}
|
package/src/runtime/live.ts
CHANGED
|
@@ -138,8 +138,6 @@ export interface Socket<Send, Receive> extends Reader<Receive, ConnectionStatus>
|
|
|
138
138
|
send: (message: Send) => void
|
|
139
139
|
// Called with `{ key, fields }` when the route refuses a message it was sent: it answers it as `{ error: { key, fields } }`, which is no message of the route's `reply`, so `data()` and `onData` never see it. Returns what stops it.
|
|
140
140
|
onRefused: (listener: (event: SocketRefusal) => void) => () => void
|
|
141
|
-
/** @deprecated Write `data()`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
142
|
-
last: () => Receive | undefined
|
|
143
141
|
|
|
144
142
|
// Called each time the connection opens, a reconnect included, before what was queued goes: where a client joins its rooms again, or refetches what it missed (`reconnected` is true after the first open). Returns what stops it.
|
|
145
143
|
onOpen: (listener: (event: { reconnected: boolean }) => void) => () => void
|
|
@@ -151,8 +149,6 @@ export interface Socket<Send, Receive> extends Reader<Receive, ConnectionStatus>
|
|
|
151
149
|
|
|
152
150
|
// What every stream of values an island reads shares: a `stream()`, and the stream a streaming action answers with.
|
|
153
151
|
export interface Connection<T> extends Reader<T, ConnectionStatus> {
|
|
154
|
-
/** @deprecated Write `data()`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
155
|
-
last: () => T | undefined
|
|
156
152
|
|
|
157
153
|
// Called each time the stream opens, a reconnect included (`reconnected` is true after the first open): where an island refetches what a drop may have lost, when the route sends no ids to resume from. A streaming action's answer is open before a listener can attach, so for it this runs after `retry()` only. Returns what stops it.
|
|
158
154
|
onOpen: (listener: (event: { reconnected: boolean }) => void) => () => void
|
|
@@ -238,7 +234,6 @@ export function openSocket<Send, Receive>(connect: () => WebSocket | undefined,
|
|
|
238
234
|
queued.shift()
|
|
239
235
|
},
|
|
240
236
|
data: link.last,
|
|
241
|
-
last: link.last,
|
|
242
237
|
status: link.status,
|
|
243
238
|
pending: link.pending,
|
|
244
239
|
error: link.error,
|
|
@@ -397,7 +392,6 @@ export function readEvents<T>(request: (signal: AbortSignal, lastEventId?: strin
|
|
|
397
392
|
void read(run)
|
|
398
393
|
},
|
|
399
394
|
data: link.last,
|
|
400
|
-
last: link.last,
|
|
401
395
|
status: link.status,
|
|
402
396
|
pending: link.pending,
|
|
403
397
|
error: link.error,
|
|
@@ -513,7 +507,7 @@ function iterate(source: (signal: AbortSignal) => AsyncIterable<unknown>, hooks?
|
|
|
513
507
|
onMount(start)
|
|
514
508
|
onCleanup(close)
|
|
515
509
|
|
|
516
|
-
return { data: link.last,
|
|
510
|
+
return { data: link.last, status: link.status, pending: link.pending, error: link.error, retry: () => link.retry(() => void read()), ...connectionHooks(link, opened.on, hooks), ended: ended(link), close, start }
|
|
517
511
|
}
|
|
518
512
|
|
|
519
513
|
// Reads a route of a module under `src/api` answering with `eventStream()` from an island, once it is in the page, or with `start: false` each time `start()` is called: each value typed as the route sends it, Dates, Maps and Sets included.
|
|
@@ -589,8 +583,6 @@ export interface ResourceExtras<T> {
|
|
|
589
583
|
}
|
|
590
584
|
|
|
591
585
|
export interface Resource<T> extends Reader<T, LoadStatus> {
|
|
592
|
-
/** @deprecated Write `data()`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
593
|
-
value: () => T | undefined
|
|
594
586
|
// Asks the route again with the same options, until the component that read it is gone, even when it is ready.
|
|
595
587
|
refresh: () => void
|
|
596
588
|
// Sets the value at once, for every resource sharing its key, and asks the route again to settle it: a request still in flight is dropped, so an older answer never overwrites it. `{ refresh: false }` keeps the value as set. Given a function, it gets the current value.
|
|
@@ -957,7 +949,6 @@ export function resource(module: unknown, path?: string | ResourceExtras<unknown
|
|
|
957
949
|
|
|
958
950
|
return {
|
|
959
951
|
data: value,
|
|
960
|
-
value,
|
|
961
952
|
status,
|
|
962
953
|
pending: busy,
|
|
963
954
|
error,
|
|
@@ -1045,8 +1036,6 @@ export interface TrackedApi<Module, Path> extends Reader<unknown, LoadStatus> {
|
|
|
1045
1036
|
readonly data: () => unknown
|
|
1046
1037
|
// Called with `{ value, input }` when a call succeeds, `input` the options it was given; returns what stops it. Hooks given to `call.track()` run first.
|
|
1047
1038
|
readonly onData: (listener: (event: { value: unknown, input: unknown }) => void) => () => void
|
|
1048
|
-
/** @deprecated Write `onData`, which hands `value` where this hands `data`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
1049
|
-
readonly onSuccess: (listener: (event: { data: unknown, input: unknown }) => void) => () => void
|
|
1050
1039
|
// Called with `{ error, input }` when a call fails, a refusal or no answer, not for an abort; returns what stops it.
|
|
1051
1040
|
readonly onError: (listener: (event: { error: ApiError, input: unknown }) => void) => () => void
|
|
1052
1041
|
}
|
|
@@ -29,7 +29,7 @@ export interface LocalConflict<Row> {
|
|
|
29
29
|
base: Row | undefined
|
|
30
30
|
// The queued write's row, undefined when it was a removal.
|
|
31
31
|
mine: Row | undefined
|
|
32
|
-
// The server's row now, which its action answered `ctx.
|
|
32
|
+
// The server's row now, which its action answered `ctx.deny(409, { data: row })` with.
|
|
33
33
|
theirs: Row
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -37,8 +37,6 @@ export interface LocalConflict<Row> {
|
|
|
37
37
|
export interface LocalHooks<Row> {
|
|
38
38
|
// A read of the server was taken in, or the queue was sent and the collection stands `synced`; `value` is the rows held then.
|
|
39
39
|
onData?: ((event: { value: readonly Row[] }) => void) | undefined
|
|
40
|
-
/** @deprecated Write `onData`, which hands `value` where this hands `rows`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
41
|
-
onSync?: ((event: { rows: readonly Row[] }) => void) | undefined
|
|
42
40
|
// A write the server did not take as it was: once for each new issue (it is in `issues()` then), not for those kept from an earlier visit.
|
|
43
41
|
onIssue?: ((event: { issue: LocalIssue<Row> }) => void) | undefined
|
|
44
42
|
// The server could not be read, or the browser keeps no IndexedDB: once for each failure, as `error()` is set.
|
|
@@ -71,16 +69,10 @@ export interface LocalSync {
|
|
|
71
69
|
export interface Local<Row, Key extends keyof Row> extends Reader<readonly Row[], LoadStatus> {
|
|
72
70
|
// The rows held, in key order, reactive; empty until the browser's copy is read.
|
|
73
71
|
data: () => readonly Row[]
|
|
74
|
-
/** @deprecated Write `data()`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
75
|
-
rows: () => readonly Row[]
|
|
76
72
|
get: (key: Row[Key]) => Row | undefined
|
|
77
73
|
// Both keep the change in the browser at once and resolve then; the server gets it when it can.
|
|
78
74
|
put: (row: Row) => Promise<void>
|
|
79
75
|
remove: (key: Row[Key]) => Promise<void>
|
|
80
|
-
/** @deprecated Write `sync.queued()`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
81
|
-
unsynced: () => number
|
|
82
|
-
/** @deprecated Write `sync.status()`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
83
|
-
syncStatus: () => LocalSyncStatus
|
|
84
76
|
// `loading` until the browser's copy is read, then `ready`, or `failed` while `error()` is set; `idle` is never read. Whether writes wait for the server is `sync.status()`, not a failure.
|
|
85
77
|
status: () => LoadStatus
|
|
86
78
|
// Whether the browser's copy is still being read.
|
|
@@ -91,8 +83,6 @@ export interface Local<Row, Key extends keyof Row> extends Reader<readonly Row[]
|
|
|
91
83
|
retry: () => void
|
|
92
84
|
// Called after a sync, with `{ value }` the rows held; returns what stops it.
|
|
93
85
|
onData: (listener: (event: { value: readonly Row[] }) => void) => () => void
|
|
94
|
-
/** @deprecated Write `onData`, which hands `value` where this hands `rows`. Removed in 1.108.0; `deprecated-source-readers` rewrites it. */
|
|
95
|
-
onSync: (listener: (event: { rows: readonly Row[] }) => void) => () => void
|
|
96
86
|
// Called with each new issue; returns what stops it.
|
|
97
87
|
onIssue: (listener: (event: { issue: LocalIssue<Row> }) => void) => () => void
|
|
98
88
|
// Called when a read of the server failed; returns what stops it.
|
package/src/runtime/local.ts
CHANGED
|
@@ -235,7 +235,7 @@ function inert<Row, Key extends keyof Row>(): Local<Row, Key> {
|
|
|
235
235
|
|
|
236
236
|
const stop = () => () => undefined
|
|
237
237
|
|
|
238
|
-
return { data: () => [],
|
|
238
|
+
return { data: () => [], get: () => undefined, put: refuse, remove: refuse, error: () => undefined, retry: () => undefined, onData: stop, onIssue: stop, onError: stop, pending: () => true, status: () => 'loading', issues: () => [], dismiss: nothing, sync: Object.assign(nothing, { status: () => 'loading' as const, queued: () => 0 }), clear: nothing }
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// A collection the island reads and writes at once, kept in IndexedDB so it works offline: a write is applied in the browser and queued, then replayed through the collection's action, once, when the server can be reached.
|
|
@@ -252,8 +252,7 @@ class Collection<Row extends object, Key extends keyof Row & string> {
|
|
|
252
252
|
private readonly problems = createSignal<LocalIssue<Row>[]>([])
|
|
253
253
|
private readonly state = createSignal<LocalSyncStatus>('loading')
|
|
254
254
|
private readonly failure = createSignal<ApiError | undefined>(undefined)
|
|
255
|
-
|
|
256
|
-
private readonly synced = listenerSet<{ value: readonly Row[], rows: readonly Row[] }>()
|
|
255
|
+
private readonly synced = listenerSet<{ value: readonly Row[] }>()
|
|
257
256
|
private readonly raised = listenerSet<{ issue: LocalIssue<Row> }>()
|
|
258
257
|
private readonly failed = listenerSet<{ error: ApiError }>()
|
|
259
258
|
// The issues already told, by id; undefined until the first read, which tells none of those kept from an earlier visit.
|
|
@@ -281,9 +280,6 @@ class Collection<Row extends object, Key extends keyof Row & string> {
|
|
|
281
280
|
if (options.onData)
|
|
282
281
|
this.synced.on(options.onData)
|
|
283
282
|
|
|
284
|
-
if (options.onSync)
|
|
285
|
-
this.synced.on(options.onSync)
|
|
286
|
-
|
|
287
283
|
if (options.onIssue)
|
|
288
284
|
this.raised.on(options.onIssue)
|
|
289
285
|
|
|
@@ -307,16 +303,12 @@ class Collection<Row extends object, Key extends keyof Row & string> {
|
|
|
307
303
|
api(): Local<Row, Key> {
|
|
308
304
|
return {
|
|
309
305
|
data: () => this.view[0]().list,
|
|
310
|
-
rows: () => this.view[0]().list,
|
|
311
306
|
get: key => this.view[0]().byKey.get(String(key)),
|
|
312
307
|
put: async row => this.write('put', row),
|
|
313
308
|
remove: async key => this.write('remove', { [this.options.key]: key } as Row),
|
|
314
|
-
unsynced: this.count[0],
|
|
315
|
-
syncStatus: this.state[0],
|
|
316
309
|
error: this.failure[0],
|
|
317
310
|
retry: () => this.again(),
|
|
318
311
|
onData: this.synced.on,
|
|
319
|
-
onSync: this.synced.on,
|
|
320
312
|
onIssue: this.raised.on,
|
|
321
313
|
onError: this.failed.on,
|
|
322
314
|
pending: () => this.state[0]() === 'loading',
|
|
@@ -535,7 +527,7 @@ class Collection<Row extends object, Key extends keyof Row & string> {
|
|
|
535
527
|
clearTimeout(this.timer)
|
|
536
528
|
this.paused = false
|
|
537
529
|
|
|
538
|
-
// Whether this run sent a write or took the server's rows in, so `
|
|
530
|
+
// Whether this run sent a write or took the server's rows in, so `onData` has something to tell.
|
|
539
531
|
let moved = false
|
|
540
532
|
|
|
541
533
|
await quiet(async () => locked(async () => {
|
|
@@ -552,9 +544,7 @@ class Collection<Row extends object, Key extends keyof Row & string> {
|
|
|
552
544
|
this.schedule()
|
|
553
545
|
|
|
554
546
|
if (moved && !this.ended && this.state[0]() === 'synced') {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
this.synced.emit({ value: rows, rows })
|
|
547
|
+
this.synced.emit({ value: this.view[0]().list })
|
|
558
548
|
}
|
|
559
549
|
}
|
|
560
550
|
|
|
@@ -40,15 +40,12 @@ export function mergeQuery(params: URLSearchParams, changes: QueryChanges): void
|
|
|
40
40
|
// Both resolve to `false` when a leave guard was declined, so the page stayed, and `true` otherwise.
|
|
41
41
|
// kept: free
|
|
42
42
|
interface Navigate {
|
|
43
|
-
/** @deprecated Call `navigate.query(changes)`, so one name does one job. Removed in 1.108.0; `deprecated-navigate-query` rewrites it. */
|
|
44
|
-
(to: { query: QueryChanges }, options?: NavigateOptions): Promise<boolean>
|
|
45
|
-
// Last, so a path no page serves is reported against it.
|
|
46
43
|
<const Href extends string>(href: Href & CheckedHref<Href>, options?: NavigateOptions): Promise<boolean>
|
|
47
44
|
query: (changes: QueryChanges, options?: NavigateOptions) => Promise<boolean>
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
async function visit(to: string
|
|
51
|
-
return navigateTo(
|
|
47
|
+
async function visit(to: string, options: NavigateOptions = {}): Promise<boolean> {
|
|
48
|
+
return navigateTo(navigation.localize ? navigation.localize(to) : to, options, true)
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
// kept: free
|
|
@@ -147,15 +147,3 @@ async function logged<A, T>(fn: (argument: A) => T, argument: A): Promise<Awaite
|
|
|
147
147
|
return undefined
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
// kept: free
|
|
152
|
-
/** @deprecated Call `navigation.onBeforeNavigate(fn)`, the hooks of a source being its methods. Removed in 1.108.0; `deprecated-navigation-hooks` rewrites it. */
|
|
153
|
-
export function onBeforeNavigate(fn: (event: BeforeNavigate) => boolean | void | Promise<boolean | void>): () => void {
|
|
154
|
-
return beforeNavigate(fn)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// kept: free
|
|
158
|
-
/** @deprecated Call `navigation.onNavigate(fn)`, the hooks of a source being its methods. Removed in 1.108.0; `deprecated-navigation-hooks` rewrites it. */
|
|
159
|
-
export function onNavigate(fn: (event: NavigateEvent) => unknown): () => void {
|
|
160
|
-
return afterNavigate(fn)
|
|
161
|
-
}
|
package/src/runtime/page-swap.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { mergeHead, runnable, scriptMarkup, swapRoot } from './swap-head'
|
|
|
12
12
|
import { checkKept, heldLate, holding, swapBody } from './swap-kept'
|
|
13
13
|
import { MISSING } from './swap-morph'
|
|
14
14
|
import { transitioned, viewTransitions } from './swap-transition'
|
|
15
|
-
import { addressChanged } from './with-query'
|
|
15
|
+
import { addressChanged, followAddress } from './with-query'
|
|
16
16
|
|
|
17
17
|
export { HTML, PAGE_TIMEOUT_MS, prefetch } from './swap-fetch'
|
|
18
18
|
export { CHUNK_TIMEOUT_MS } from './swap-flight'
|
|
@@ -93,13 +93,12 @@ function markPending(link: Element | undefined): void {
|
|
|
93
93
|
link?.setAttribute('data-pending', '')
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// The nearest `data-scroll` decides, `"top"` meaning a plain scroll to the top, and the nearest `data-transition`, `"false"` meaning none
|
|
96
|
+
// The nearest `data-scroll` decides, `"top"` meaning a plain scroll to the top, and the nearest `data-transition`, `"false"` meaning none.
|
|
97
97
|
function linkOptions(link: Element): Pick<Swap, 'scroll' | 'transition'> {
|
|
98
|
-
const keeper = link.closest('[data-scroll]
|
|
99
|
-
const changer = link.closest('[data-transition]
|
|
100
|
-
const kept = keeper?.getAttribute('data-scroll') ?? keeper?.getAttribute('data-keep-scroll')
|
|
98
|
+
const keeper = link.closest('[data-scroll]')
|
|
99
|
+
const changer = link.closest('[data-transition]')
|
|
101
100
|
|
|
102
|
-
return { scroll: keeper &&
|
|
101
|
+
return { scroll: keeper && keeper.getAttribute('data-scroll') !== 'top' ? 'keep' : undefined, transition: changer?.getAttribute('data-transition') !== 'false' }
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
async function swapTo(url: URL, swap: Swap): Promise<void> {
|
|
@@ -452,6 +451,7 @@ async function showPage(page: FetchedPage, hash: string, swap: Swap, isCurrent:
|
|
|
452
451
|
|
|
453
452
|
forgetPageData()
|
|
454
453
|
writeHistory(policy, target)
|
|
454
|
+
followAddress()
|
|
455
455
|
addressChanged()
|
|
456
456
|
|
|
457
457
|
if (pageKey(target) !== navigation.shown)
|