@kayjs/kay 1.108.0 → 1.110.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 +2093 -3774
- 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-library-conventions.md +1 -1
- package/llms/components.md +5 -5
- package/llms/deprecated-lints.md +2 -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 +4 -2
- package/llms/island-sources.md +1 -1
- package/llms/islands-state-to-ids.md +2 -2
- package/llms/islands.md +8 -4
- package/llms/lints.md +1 -1
- package/llms/live-values.md +4 -4
- 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 +7 -7
- package/llms/navigation.md +4 -2
- 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/templates-elements-slots-snippets.md +2 -2
- 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 +64 -74
- package/llms/upgrading.md +92 -70
- package/llms/whats-new.md +24 -0
- package/llms.txt +5 -6
- package/package.json +6 -10
- package/src/build/route-sizes.ts +2 -3
- package/src/build/variants.ts +132 -18
- 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/env-types.ts +1 -1
- 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 +6 -7
- package/src/check/schema-builders.ts +125 -26
- package/src/check/shadow-types.ts +0 -86
- package/src/commands/check.ts +2 -2
- package/src/commands/env.ts +25 -3
- package/src/commands/upgrade.ts +2 -1
- package/src/compiler/allow-comments.ts +38 -2
- package/src/compiler/ast.ts +21 -19
- package/src/compiler/browser.ts +2 -14
- package/src/compiler/class-items.ts +16 -0
- package/src/compiler/codegen.ts +10 -10
- package/src/compiler/deprecated-library.ts +0 -12
- package/src/compiler/deprecated-lints-1-106.ts +2 -2
- package/src/compiler/deprecated-lints.ts +3 -495
- package/src/compiler/deprecated-ui-props.ts +5 -5
- package/src/compiler/errors.ts +2 -2
- package/src/compiler/fence-checks.ts +2 -121
- package/src/compiler/hand-parts.ts +83 -0
- package/src/compiler/helper-imports.ts +2 -2
- package/src/compiler/image-attributes.ts +1 -3
- package/src/compiler/index.ts +23 -23
- package/src/compiler/island-arguments.ts +17 -95
- package/src/compiler/island-cause.ts +7 -7
- package/src/compiler/island-declaration.ts +2 -8
- package/src/compiler/island-lints.ts +19 -0
- package/src/compiler/island-marker.ts +3 -3
- package/src/compiler/island-problems.ts +25 -0
- package/src/compiler/items.ts +12 -0
- package/src/compiler/jsx-class.ts +1 -25
- package/src/compiler/jsx.ts +7 -6
- package/src/compiler/kay-exports.ts +0 -2
- package/src/compiler/link-flags.ts +9 -38
- package/src/compiler/lints.ts +10 -18
- package/src/compiler/markup.ts +33 -41
- 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/removed-lints.ts +90 -0
- package/src/compiler/rewrite.ts +3 -18
- package/src/compiler/script-server.ts +8 -3
- package/src/compiler/signal-from-prop.ts +141 -0
- package/src/compiler/template-reads.ts +16 -0
- 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/runtime/action-call.ts +0 -8
- 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 +2 -27
- 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 +25 -13
- package/src/runtime/client.ts +7 -11
- 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/image.ts +2 -19
- package/src/runtime/index.ts +3 -3
- package/src/runtime/island.server.ts +56 -13
- 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/navigate.ts +9 -0
- package/src/runtime/navigation-state.ts +0 -12
- package/src/runtime/navigation.ts +5 -1
- package/src/runtime/page-swap.ts +8 -8
- 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/swap-flight.ts +10 -10
- package/src/runtime/swap-kept.ts +69 -29
- package/src/runtime/swap-morph.ts +49 -9
- package/src/runtime/text-hash.ts +17 -0
- package/src/runtime/uid.server.ts +6 -4
- package/src/runtime/values.ts +52 -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 +9 -7
- package/src/server/render.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/route-sizes.d.ts.map +1 -1
- package/types/build/variants.d.ts +9 -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/schema-builders.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/commands/upgrade.d.ts.map +1 -1
- package/types/compiler/allow-comments.d.ts +2 -0
- package/types/compiler/allow-comments.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/deprecated-library.d.ts.map +1 -1
- package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
- package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
- package/types/compiler/deprecated-lints.d.ts +2 -553
- 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/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 +10 -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 +7 -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 +17 -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/items.d.ts +1 -0
- package/types/compiler/items.d.ts.map +1 -1
- package/types/compiler/jsx-class.d.ts +1 -2
- package/types/compiler/jsx-class.d.ts.map +1 -1
- package/types/compiler/jsx.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 +21 -566
- 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/removed-lints.d.ts +3 -0
- package/types/compiler/removed-lints.d.ts.map +1 -0
- package/types/compiler/script-server.d.ts.map +1 -1
- package/types/compiler/signal-from-prop.d.ts +4 -0
- package/types/compiler/signal-from-prop.d.ts.map +1 -0
- package/types/compiler/template-reads.d.ts +1 -0
- package/types/compiler/template-reads.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.map +1 -1
- 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 +14 -11
- package/types/runtime/checks.d.ts.map +1 -1
- package/types/runtime/client.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/image.d.ts.map +1 -1
- package/types/runtime/index.d.ts +3 -3
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/island.server.d.ts +2 -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/navigate.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/navigation.d.ts +2 -0
- package/types/runtime/navigation.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/swap-flight.d.ts +1 -1
- package/types/runtime/swap-flight.d.ts.map +1 -1
- package/types/runtime/swap-kept.d.ts.map +1 -1
- package/types/runtime/swap-morph.d.ts.map +1 -1
- package/types/runtime/text-hash.d.ts +2 -0
- package/types/runtime/text-hash.d.ts.map +1 -0
- package/types/runtime/uid.server.d.ts.map +1 -1
- package/types/runtime/values.d.ts +6 -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/render-document.d.ts +1 -1
- package/types/server/render-document.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/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,
|
|
24
|
+
export { checkedMarkup, componentClass, handParts, merge, omit, partClass, partHanded, partProps, 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,
|
|
38
|
+
export { checkedMarkup, componentClass, handParts, merge, omit, partClass, partHanded, partProps, 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/image.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { KayError } from './kay-error'
|
|
2
2
|
import { kayLog } from './log'
|
|
3
|
+
import { textHash } from './text-hash'
|
|
3
4
|
|
|
4
5
|
declare const KAY_BROWSER: true | undefined
|
|
5
6
|
|
|
@@ -265,25 +266,7 @@ export function requestedRemoteVariants(): { src: string, name: string, variant:
|
|
|
265
266
|
|
|
266
267
|
// Named after a hash of the URL.
|
|
267
268
|
export function remoteVariantName(src: string, variant: ImageVariant): string {
|
|
268
|
-
return `remote-${
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// cyrb53, 53 bits of a string's hash in base 36.
|
|
272
|
-
function urlHash(text: string): string {
|
|
273
|
-
let h1 = 0xDEADBEEF
|
|
274
|
-
let h2 = 0x41C6CE57
|
|
275
|
-
|
|
276
|
-
for (let index = 0; index < text.length; index++) {
|
|
277
|
-
const code = text.charCodeAt(index)
|
|
278
|
-
|
|
279
|
-
h1 = Math.imul(h1 ^ code, 2654435761)
|
|
280
|
-
h2 = Math.imul(h2 ^ code, 1597334677)
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909)
|
|
284
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909)
|
|
285
|
-
|
|
286
|
-
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36)
|
|
269
|
+
return `remote-${textHash(src)}${variantSuffix(variant)}`
|
|
287
270
|
}
|
|
288
271
|
|
|
289
272
|
function currentMaxDensity(): number {
|
package/src/runtime/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { announce } from './announce'
|
|
|
9
9
|
export type { ErrorShape } from './api-error'
|
|
10
10
|
export { localPath, withBase } from './base'
|
|
11
11
|
export { byteCount } from './byte-count'
|
|
12
|
-
export type { ApiRoutesOf, AwaitProps, Bindable, BindableMark, BoundProp, BoundValue, CheckedComputedHtml, CheckedHref, CheckedHtml, Deferred, ExtensionServersOf, FunctionProp, HandedPart, HandedSignal, HandsPart, HydrateWhen, Inferred, IslandAsks, IslandBrand, IslandComponent, IslandOptions, IslandProp, Locals, LocalsOf, PartClass, PlainIslandProp, Redirect, Register, RouteParams, SafeHtml, ServerOfModule, SlotCall, TemplateHelpers, Truthy, UnkeyedRows, Unmatched, UnresolvedParameter } from './checks'
|
|
12
|
+
export type { ApiRoutesOf, AwaitProps, Bindable, BindableMark, BoundProp, BoundValue, CheckedComputedHtml, CheckedHref, CheckedHtml, Deferred, ExtensionServersOf, FunctionProp, HandedPart, HandedSignal, HandsPart, HydrateWhen, Inferred, IslandAsked, IslandAsks, IslandBrand, IslandComponent, IslandOptions, IslandProp, Locals, LocalsOf, PartClass, PlainIslandProp, Redirect, Register, RouteParams, SafeHtml, ServerOfModule, SlotCall, TemplateHelpers, Truthy, UnkeyedRows, Unmatched, UnresolvedParameter } from './checks'
|
|
13
13
|
// The names `kay` exports. What this file defines itself is in `core.ts`, so a build imports the module holding a name rather than this one, which an entry importing it would take every name's module along with.
|
|
14
14
|
export * from './core'
|
|
15
15
|
export type { DescribeOptions } from './described'
|
|
@@ -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'
|
|
@@ -22,6 +22,23 @@ import { ACTION_PREFIX, encodeValue, unsendable } from './wire'
|
|
|
22
22
|
|
|
23
23
|
// Island roots render synchronously, so a counter is enough to tell whether a component already sits inside one.
|
|
24
24
|
let depth = 0
|
|
25
|
+
// The layout file whose own markup is rendering, none inside the page or a block it fills: the islands it draws are marked with it, as a navigation keeping that layout keeps them.
|
|
26
|
+
let layout: string | undefined
|
|
27
|
+
|
|
28
|
+
// Renders `run` as the markup of `file`, a layout, or of the page for none.
|
|
29
|
+
export function inLayout<T>(file: string | undefined, run: () => T): T {
|
|
30
|
+
const outer = layout
|
|
31
|
+
|
|
32
|
+
layout = file
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
return run()
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
layout = outer
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
25
42
|
// The islands of the page being rendered: it ships the entry when it holds any, and preloads the chunks of those hydrating right away.
|
|
26
43
|
let rendered: RenderedIslands | undefined
|
|
27
44
|
|
|
@@ -105,6 +122,14 @@ export function collectIslands<T>(render: () => T, salt?: string, chunks?: Recor
|
|
|
105
122
|
}
|
|
106
123
|
}
|
|
107
124
|
|
|
125
|
+
// Whether the island being rendered, or a page outside any, read a query param.
|
|
126
|
+
let queried = false
|
|
127
|
+
|
|
128
|
+
// A query param was read: the island rendering it depends on the address, which a page rendered once at build time cannot show.
|
|
129
|
+
export function noteQuery(): void {
|
|
130
|
+
queried = true
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
// The keys of the components the island being rendered draws that load on their own in the browser.
|
|
109
134
|
let drawn: Set<string> | undefined
|
|
110
135
|
|
|
@@ -158,6 +183,18 @@ function persistKey(wanted: IslandOptions['persist'], id: string): string | unde
|
|
|
158
183
|
return wanted === false || wanted === '' ? undefined : wanted
|
|
159
184
|
}
|
|
160
185
|
|
|
186
|
+
// What tells an island from the others of its component when no `persist` does: the `key` or `id` its use gives, a string or a number, so a swap pairs it with its own copy when a sibling goes away.
|
|
187
|
+
function identityOf(persist: string | undefined, props: object): string | undefined {
|
|
188
|
+
for (const name of persist === undefined ? ['key', 'id'] as const : []) {
|
|
189
|
+
const value = (props as Record<string, unknown>)[name]
|
|
190
|
+
|
|
191
|
+
if (typeof value === 'string' || typeof value === 'number')
|
|
192
|
+
return String(value)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return undefined
|
|
196
|
+
}
|
|
197
|
+
|
|
161
198
|
// Whether a `hydrate` makes the island wait, `media(...)` needing a query to wait for.
|
|
162
199
|
function isWaiting(when: string | undefined, id: string): boolean {
|
|
163
200
|
if (when?.startsWith('media(') === true && (!when.endsWith(')') || when.slice(6, -1).trim() === ''))
|
|
@@ -175,7 +212,7 @@ function ownProps<P extends object>(props: P & IslandOptions, renderClient: bool
|
|
|
175
212
|
}
|
|
176
213
|
|
|
177
214
|
// 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 `
|
|
215
|
+
// 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
216
|
// 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
217
|
// `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
218
|
// `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 +221,7 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
184
221
|
const when = props.hydrate ?? asks?.hydrate
|
|
185
222
|
const persist = persistKey(props.persist ?? asks?.persist, id)
|
|
186
223
|
const renderClient = props.render === 'client'
|
|
187
|
-
const browserOnly = client ||
|
|
224
|
+
const browserOnly = client || renderClient
|
|
188
225
|
const waits = isWaiting(when, id)
|
|
189
226
|
const own = ownProps(props, renderClient, browserOnly)
|
|
190
227
|
|
|
@@ -209,14 +246,15 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
209
246
|
return browserOnly ? renderedHtml('') as unknown as JSX.Element : component!(own)
|
|
210
247
|
|
|
211
248
|
// Rendered here, in the parent, so an island among them is one of its own; unmarked in edit mode, as the island's own markup is.
|
|
212
|
-
//
|
|
213
|
-
const
|
|
214
|
-
const
|
|
249
|
+
// Any island may stay in the DOM across a swap, so its ids and those of its slots come from its key, a `persist` one's own else its component's (and its layout's) with its index among them, not from its place in the page, which a render adding another island would shift under the one kept.
|
|
250
|
+
const identity = identityOf(persist, own)
|
|
251
|
+
const ids = islandPrefix(persist ?? [layout, id, identity].filter(part => part !== undefined).join('\0'))
|
|
252
|
+
const slots = withFieldMarks(undefined, () => withIds(`${ids}s-`, () => withSlotIslands(`${ids}i`, () => staticSlots(own))))
|
|
215
253
|
const given = slots.length === 0 ? own : withSlots(own, slots)
|
|
216
254
|
const serialized = withFieldMarks(undefined, () => serializeProps(`${id} ${why}`, own, slots))
|
|
217
255
|
|
|
218
256
|
// The browser counts the island's ids from it again as it hydrates.
|
|
219
|
-
const prefix = ids
|
|
257
|
+
const prefix = ids
|
|
220
258
|
|
|
221
259
|
depth++
|
|
222
260
|
|
|
@@ -241,8 +279,10 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
241
279
|
|
|
242
280
|
const keys = new Set<string>()
|
|
243
281
|
const outer = drawn
|
|
282
|
+
const outerQuery = queried
|
|
244
283
|
|
|
245
284
|
drawn = keys
|
|
285
|
+
queried = false
|
|
246
286
|
|
|
247
287
|
try {
|
|
248
288
|
// Detached, as in the browser, where an island reads nothing the page's components provide.
|
|
@@ -254,20 +294,23 @@ export function island<P extends object>(id: string, component: ((props: P) => J
|
|
|
254
294
|
const marked = waits || when === 'load' ? ` data-hydrate="${escapeAttribute(when!)}"` : ''
|
|
255
295
|
const chunk = rendered?.chunks?.[id]
|
|
256
296
|
const lazies = lazyAttribute(keys, waits)
|
|
257
|
-
|
|
297
|
+
// 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.
|
|
298
|
+
const byQuery = queried && prerendering() && !browserOnly ? ' data-query' : ''
|
|
299
|
+
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)}"`}${layout === undefined ? '' : ` data-layout="${escapeAttribute(layout)}"`}${identity === undefined ? '' : ` data-key="${escapeAttribute(identity)}"`}${chunk === undefined ? '' : ` data-chunk="${escapeAttribute(chunk)}"`}>${html}</slot>`)
|
|
258
300
|
|
|
259
301
|
return markup as unknown as JSX.Element
|
|
260
302
|
}
|
|
261
303
|
finally {
|
|
262
304
|
depth--
|
|
263
305
|
drawn = outer
|
|
306
|
+
queried = outerQuery || queried
|
|
264
307
|
}
|
|
265
308
|
}
|
|
266
309
|
|
|
267
310
|
return carryFailed(component, render) as IslandComponent<P>
|
|
268
311
|
}
|
|
269
312
|
|
|
270
|
-
// Whether a use of an island that follows no live value, whose `
|
|
313
|
+
// 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 promise or markup. A function, a block taking parameters among them, does not keep a use an island: a use turning none of the listed props on renders on the server, which calls it.
|
|
271
314
|
function staysPlain(depth: number, client: boolean, lives: readonly unknown[], props: object, asks: IslandAsks | undefined): boolean {
|
|
272
315
|
const wants = asks?.interactive
|
|
273
316
|
|
|
@@ -278,8 +321,8 @@ function staysPlain(depth: number, client: boolean, lives: readonly unknown[], p
|
|
|
278
321
|
if (key === 'hydrate' || key === 'persist' || (key === 'render' && (props as { render?: unknown }).render === 'client') || key === USE_FALLBACK)
|
|
279
322
|
return false
|
|
280
323
|
|
|
281
|
-
// What an island would
|
|
282
|
-
if (!descriptor.get && (
|
|
324
|
+
// What an island would send for the browser to finish (a promise, an action) keeps the use an island.
|
|
325
|
+
if (!descriptor.get && (isThenable(descriptor.value) || holdsMarkup(descriptor.value) || isAction(descriptor.value)))
|
|
283
326
|
return false
|
|
284
327
|
}
|
|
285
328
|
|
|
@@ -294,12 +337,12 @@ function isThenable(value: unknown): boolean {
|
|
|
294
337
|
return typeof value === 'object' && value !== null && typeof Reflect.get(value, 'then') === 'function'
|
|
295
338
|
}
|
|
296
339
|
|
|
297
|
-
// Whether the props could cross to the browser, so a use that an island would refuse is still told of it.
|
|
340
|
+
// Whether the props, a function aside, could cross to the browser, so a use that an island would refuse is still told of it.
|
|
298
341
|
function sendable(props: object): boolean {
|
|
299
342
|
const plain: Record<string, unknown> = {}
|
|
300
343
|
|
|
301
344
|
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(props))) {
|
|
302
|
-
if (!descriptor.get)
|
|
345
|
+
if (!descriptor.get && typeof descriptor.value !== 'function')
|
|
303
346
|
plain[key] = descriptor.value
|
|
304
347
|
}
|
|
305
348
|
|
|
@@ -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.
|