@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
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
id = "kay"
|
|
2
2
|
name = "Kay"
|
|
3
3
|
description = "Highlighting and the kay language server for .kay components"
|
|
4
|
-
version = "1.
|
|
4
|
+
version = "1.109.0"
|
|
5
5
|
schema_version = 1
|
|
6
6
|
authors = [ "Kaynooo" ]
|
|
7
7
|
repository = "https://github.com/Kayno0o/kayjs"
|
|
8
8
|
|
|
9
9
|
[grammars.kay]
|
|
10
10
|
repository = "https://github.com/Kayno0o/kayjs"
|
|
11
|
-
rev = "v1.
|
|
11
|
+
rev = "v1.109.0"
|
|
12
12
|
path = "editors/tree-sitter-kay"
|
|
13
13
|
|
|
14
14
|
[language_servers.kay]
|
|
@@ -107,7 +107,7 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
|
|
|
107
107
|
|
|
108
108
|
#### Proof of work checked in code
|
|
109
109
|
|
|
110
|
-
- `workChallenge(scope, { difficulty, ttl })`, `ttl` a day by default,
|
|
110
|
+
- `workChallenge(scope, { difficulty, ttl })` from `kay/server`, `ttl` a day by default, signs a challenge bound to `scope` rather than to an action, for code checking it itself, as kayjs-auth's CAPTCHA does: `input(type="hidden" name="proof" data-kay-work={workChallenge('contact')})` posts its solution as the field's value, kay's script solving it from the moment the form takes focus.
|
|
111
111
|
- `await verifyWork(input.proof, 'contact', { difficulty, store })` from `kay/server` answers `undefined` once for each solution, else `missing`, `expired` (past `maxAge`, another scope's, signed before a restart, or easier than `difficulty`) or `wrong`. The solutions used are kept in `store`, else the app store's `rates`, else this process's memory.
|
|
112
112
|
- The difficulty is signed into the challenge, so a scope asking more refuses one handed out before, the page then signing a harder one; `difficulty` is 100,000 by default and `ttl` a day.
|
|
113
113
|
- A prerendered page gets a fresh challenge in the field on every visit, as a stamp; `site.submit` solves the field unless the test gives its value.
|
|
@@ -36,7 +36,7 @@ A page or layout with a `--- server` fence passes an action it declares or impor
|
|
|
36
36
|
|
|
37
37
|
A production build carries the code reviving an action only when the app's own sources call `action(` (or import it as another name) or use a kay library. A page handing an island an action created only in a package outside the app fails with an error naming this; call `action(` in one of the app's files, as `export const greet = action(...)` in a route, to keep it.
|
|
38
38
|
|
|
39
|
-
Type the prop with `Action` from `kay` (`ServerAction` counts too): `Action`, with no parameters, takes any action, `NoInputAction<unknown>` any declared without a schema, and `Action<{ name: string }, string>` keeps its input and output types (
|
|
39
|
+
Type the prop with `Action` from `kay` (`ServerAction` counts too): `Action`, with no parameters, takes any action, `NoInputAction<unknown>` any declared without a schema, and `Action<{ name: string }, string>` keeps its input and output types (the output is the success one, so a handler that can `ctx.deny` fits: `Action<{ dossier: string }, AsyncGenerator<string>>`). The type is only for the types: an island typing the prop as a plain function, `(input: { name: string }) => Promise<string>`, is handed the action all the same, the code reviving it loading in the browser only for a page that passes an island one, and shipped only by an app that calls `action(` in its own sources or uses a kay library: an action declared by a package outside the app that is no kay library makes the page fail, as above. The action crosses as its URL, so it must be an export of a route module, declared in the page or imported; one no route exports fails the render. `move.with({ id })` crosses with its fields: the island's calls and its `track()` send them over the input they are given, as a form posting to it does, while its `pending()`, `error()` and every other reading are those of the action, as is its queue: `queue: 'latest'` on a call of `move.with({ id: 1 })` drops one of `move.with({ id: 2 })` still running. Typed `Action` as any other.
|
|
40
40
|
|
|
41
41
|
```kay
|
|
42
42
|
---
|
|
@@ -129,10 +129,10 @@ p {column()}
|
|
|
129
129
|
- `timeout: '5s'` aborts a post unanswered that long (counted from the post, not from the wait in a queue): the call answers a failure with status 0, `pending()` clears, `track()` records it as a failure, `.orThrow()` rejects with that `ApiError` (status 0, its `cause` the `TimeoutError`), and the page refreshes as after an abort once sent.
|
|
130
130
|
- `keepalive: true` sends the post with `fetch`'s `keepalive`, so a call made from `pagehide` or `beforeunload` outlives the page: `save(state, { keepalive: true })`. A browser caps a keepalive body at 64 KB, so a JSON body over it is sent as a plain post instead of failing, as is a call carrying files or a form. The cap is shared by every keepalive request of the page in flight, so a call that would pass it with the ones kay sent is posted plain too; kay's own error reports count against it unseen, so a save can still be refused beside them; a page holding a proof-of-work challenge loads its solver first, which an unloading page may not finish.
|
|
131
131
|
- `retry: 2` or `retry: { times, delay, when }` posts again after a 503 or a post that failed before it was sent (`delay` defaults to `'500ms'` and doubles; `when(error)` takes an `ApiError` and decides alone for the rest). A timeout, a 504 and a network failure after the send need a `when`, as the handler may have run; a redirect and an abort are never tried again, and a TypeError thrown before the post is no failure of it. Every try sends one `Idempotency-Key` header (32 hex characters, an own `headers` entry wins), read from `ctx.request`, so a handler tells a repeat from a new call.
|
|
132
|
-
- `onStart({ input })`, `onSuccess({ data })`, `onError({ error })` (an `ApiError`) and `onSettled({ data, error })` observe a call; none runs `onError` for an abort or a redirect, `onSettled` runs for every ending (an abort's `error` is the abort), `onSuccess` of a stream runs as it starts, `latest` never aborts a stream already started, and a hook that throws or rejects is logged and never fails the call.
|
|
132
|
+
- `onStart({ input })`, `onSuccess({ data })`, `onError({ error })` (an `ApiError`) and `onSettled({ data, error })` observe a call; none runs `onError` for an abort or a redirect, `onSettled` runs for every ending but a call whose code never loaded (an abort's `error` is the abort), `onSuccess` of a stream runs as it starts, `latest` never aborts a stream already started, and a hook that throws or rejects is logged and never fails the call.
|
|
133
133
|
- `refresh` also takes a `resource()` or a list of them (anything with a `refresh()`): those are refreshed in place of the page's loads, with or without the page swap.
|
|
134
134
|
- `refresh: 'cart'` names a load of the page instead, the binding of a top-level `const cart = await ...` in the page's or a layout's server fence (a destructuring names each of its bindings; a `const total = cart.total * 2` names the load it reads): the page runs as a whole, but only the elements reading that load are sent and swapped, and what shows the others stays as it is. `refresh: ['cart', wishlist]` mixes names and `resource()`s, and `refresh()` from `kay` takes the same names: [rendering](rendering.md#refreshing-some-loads).
|
|
135
|
-
- A `form(action={add})` posting in place tells an island how it goes with the hooks of the action: `add.onStart(({ input }) => ...)` before the post (`input` the fields as `FormData`), then `add.onData(({ input }) => ...)` once it went through or `add.onError(({ error, input }) => ...)` when it did not (`error` an `ApiError` with the `status` and the `errors` per field, status 0 and none for a failure with no answer), while the form is still on the page. Each returns what removes it and ends with the island; they hear the posts of every form of that action, `.with()` ones included, and not the calls of `add(...)`, which take `onStart`, `onSuccess` and `onError` as options. An island shows a change with `add.onStart` and `optimistic(change)` from `kay`, which gives `{ undo, keep }`, and calls `undo()` on the error and `keep()` on success. They are the function form of the `kay:action-start`, `kay:action-success` and `kay:action-error` events the form fires on itself (bubbling, `detail: { action, data }`, then `{ action, data }` and `{ action, status, errors, data }`), which a plain script listens to
|
|
135
|
+
- A `form(action={add})` posting in place tells an island how it goes with the hooks of the action: `add.onStart(({ input }) => ...)` before the post (`input` the fields as `FormData`), then `add.onData(({ input }) => ...)` once it went through or `add.onError(({ error, input }) => ...)` when it did not (`error` an `ApiError` with the `status` and the `errors` per field, status 0 and none for a failure with no answer), while the form is still on the page. Each returns what removes it and ends with the island; they hear the posts of every form of that action, `.with()` ones included, and not the calls of `add(...)`, which take `onStart`, `onSuccess` and `onError` as options. An island shows a change with `add.onStart` and `optimistic(change)` from `kay`, which gives `{ undo, keep }`, and calls `undo()` on the error and `keep()` on success. They are the function form of the `kay:action-start`, `kay:action-success` and `kay:action-error` events the form fires on itself (bubbling, `detail: { action, data }`, then `{ action, data }` and `{ action, status, errors, data }`), which a plain script listens to. [Events](events.md) maps each event to its hook.
|
|
136
136
|
- Once it went through, the refresh brings what the server kept, which a `linked` signal then takes.
|
|
137
137
|
- `{ signal }` aborts a call: it rejects with the signal's reason, what `optimistic` showed goes back, and the action records no outcome.
|
|
138
138
|
- `{ headers }` sends extra request headers with the call, which the handler reads from `ctx.request`; the ones kay sets itself win.
|
|
@@ -142,7 +142,7 @@ p {column()}
|
|
|
142
142
|
- `const save = add.track()` is a handle for one component, row or button: `save.pending()` reads, reactively, only the calls made through it, where `add.pending()` reads every call of the page; `save.status()` (`idle`, `loading`, `ready`, `failed`), `save.error()` (the last failure as an `ApiError`, a call that got no answer included, kept until a call succeeds) and `save.retry()` (repeats the call that failed, with the same arguments as they were, gives no result back, and ignores a redirect) read the same way ([Island sources](island-sources.md)). `add.track({ onData: ({ value, input }) => ..., onError: ({ error, input }) => ... })` takes callbacks for every call of the handle, and the handle has them as methods too (`save.onError(({ error }) => toast.error(error.message))`, returning what stops it): `onData` runs when a call succeeds, `value` what it answered (for a stream, once it is open; `onSuccess({ data })` works until 1.108), `onError` when it fails, a call that got no answer included, never for an abort or a redirect; `input` is what the call was given ([Island sources](island-sources.md#hooks)). `call.track(module, path, hooks)` takes the same two.
|
|
143
143
|
- `await save(input, options)` takes what `add` does and answers the same result, a handle's calls only counting in its own `pending()`; an action with no input is called `save()`.
|
|
144
144
|
- The same `{ ok, status, message, errors, data }` (an `ErrorShape` when not ok) is what `call(module, path)` and `call.track(module, path)` give for an API route ([API from islands](api-from-islands.md)), so one result handler serves both.
|
|
145
|
-
- `add.refused(error)` tells a refusal of a call to `add` from any other error, a redirect's included, and types its `data` as the handler passes it to `ctx.
|
|
145
|
+
- `add.refused(error)` tells a refusal of a call to `add` from any other error, a redirect's included, and types its `data` as the handler passes it to `ctx.deny`, with no cast: `if (add.refused(error)) shown = error.data?.message`.
|
|
146
146
|
- `data` is undefined for a call refused before the handler ran, by the schema or a limit.
|
|
147
147
|
- Its input, its result and that `data` cross as island props do, Dates, Maps, Sets and bigints included; a result holding a function or a class instance answers 500, logging where it sits.
|
|
148
148
|
- When the handler or a guard redirects, the browser goes there, swapping the page in as a link would (a full load for another origin or a site without the swap), and the call rejects with `ActionRedirectError` carrying `location`, so `pending()` clears, `settled()` resolves and a `finally` after the call runs while the page goes away.
|
|
@@ -159,5 +159,5 @@ p {column()}
|
|
|
159
159
|
- `close()` stops the handler's iterable, its `finally` running, as does the visitor going away; a stream called from an island's setup, an element's event handler or a `listen` callback closes with the enclosing block or component (the nearest still alive for a row playing its leave phase, or for a block the call's own result removes, as `reply = await ask()` flipping the `if` its button sits in, as long as the block goes in the task the answer arrived in), so a `persist` island's stays open across pages, and an effect running again closes the one it called; a stream called under no owner (after an `await` in a handler, or from a timer, or from a handler of an element whose whole owner chain is already disposed) closes once the visitor goes to another path, not at once. An `effect()` or `onCleanup()` called in a `listen` callback attaches to the island's owner and builds up per event, as in an element's handler, so keep them out of it; the callback is called with no `this`, so a `function` callback reads the target as `event.currentTarget`.
|
|
160
160
|
- `rateLimit` with `count: 'succeeded'` counts a stream once its first value is there, and a drained post once its iterable ended.
|
|
161
161
|
- A `pretend` bot protection answering an island's `FormData` call resolves `undefined`, not an `ActionStream`, as the handler never ran.
|
|
162
|
-
- `on()` added right after the call resolves gets every value, `
|
|
162
|
+
- `on()` added right after the call resolves gets every value, `data()` only the latest: a reply yields the text so far rather than the piece added, so `data()` is all an island reads.
|
|
163
163
|
- A plain form post, a page swap's post and an MCP tool call read the iterable to its end and get its last value, as from a handler returning it: `reply.data()`.
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
### Refused posts
|
|
30
30
|
|
|
31
|
-
- `ctx.deny(status, { message, errors, data })` is the one refusal of a guard, a page, an action and an endpoint, `refuse(status, { ... })` throws it from anywhere; `return` it so `form.failed()` types `data`.
|
|
31
|
+
- `ctx.deny(status, { message, errors, data })` is the one refusal of a guard, a page, an action and an endpoint, `refuse(status, { ... })` throws it from anywhere; `return` it so `form.failed()` types `data`.
|
|
32
32
|
- A post the schema refuses, or whose handler denies with `ctx.deny(status, { data })`, is answered with the page it came from, rendered with the failure's status, rather than with a redirect.
|
|
33
33
|
- There `add.form.failed()` returns `{ status, message, values, errors, data }`, typed from the action, or `undefined`.
|
|
34
34
|
- `values` is what the form posted (fields named like a password left out).
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
|
|
51
51
|
### Reading the outcome
|
|
52
52
|
|
|
53
|
-
- `add.form.failed()`, `add.data()`, `add.status()` and `add.form.error('title')` read the outcome from any template, layout, component or island, and from the server fence. What a form shows is read from `add.form` (`failed()`, `error(field)`, `validate(form, field)`), apart from the call state on `add` itself (`pending()`, `status()`, `data()`, `progress()`, `settled()`, `track()`); `failed()`, `error()` and `validate()` on `add`
|
|
53
|
+
- `add.form.failed()`, `add.data()`, `add.status()` and `add.form.error('title')` read the outcome from any template, layout, component or island, and from the server fence. What a form shows is read from `add.form` (`failed()`, `error(field)`, `validate(form, field)`), apart from the call state on `add` itself (`pending()`, `status()`, `data()`, `progress()`, `settled()`, `track()`); `failed()`, `error()` and `validate()` on `add` itself are gone since 1.109.
|
|
54
54
|
- `form.error()` without a field is the form-wide message, `errors['']`.
|
|
55
55
|
- The field name is typed from the schema.
|
|
56
56
|
- An island reads them in the browser too, as its server render did, but for `values`, which stay on the server, so no field the server cannot tell is a secret reaches the page's source: the fields hold what was sent.
|
|
57
57
|
- Once the page shown called the action, they read how its last call went instead, reactively, a call clearing them as it starts: an island calling `add({ title })` gets `{ ok: false }` and `add.form.error('title')` shows the message, the field marked invalid.
|
|
58
58
|
- `await add.form.validate(form, field?)` checks a form against the action's schema, writing what it refuses into `add.form.error(field)` and `add.form.failed()` in place of the last outcome (`data()` too), for every field or `field` alone; it resolves whether it is accepted, posts nothing, and accepts a form with no schema on the page (a client-only island's). kayjs-ui's `Form`, `SaveForm` and `FormDialog` take `validate="submit" | "blur"`.
|
|
59
|
-
- A post that succeeds goes back to the page with what the handler returned: `add.data()` returns it, typed from the action, or `undefined`, on that one render only; `add.status()` is `ready` then.
|
|
59
|
+
- A post that succeeds goes back to the page with what the handler returned: `add.data()` returns it, typed from the action, or `undefined`, on that one render only; `add.status()` is `ready` then.
|
|
60
60
|
- `data` travels in a cookie, sealed (AES-GCM under a key derived from [the app secret](environment.md#the-app-secret), else a key of the process, which a restart changes), so a secret shown once, such as a new API token, can be neither read nor altered in it.
|
|
61
61
|
- Data too big for it, over about 3.5 KB sealed, is left out with a warning, and `data()` returns `undefined`, as it does for a cookie that does not open, forged or sealed before a restart.
|
|
62
62
|
- A prerendered page reads both too: the request carrying that cookie renders it afresh, see [Prerendering](prerendering.md#prerendering).
|
|
63
|
-
- The cookie carrying
|
|
63
|
+
- The cookie carrying the result back is `HttpOnly`, `SameSite=Lax`, and `Secure` when the request came over https, `X-Forwarded-Proto` included, as is every request in production when `site` is https.
|
package/llms/api-from-islands.md
CHANGED
|
@@ -108,16 +108,16 @@ button(onClick={() => messages.send({ text: text() })}) Send
|
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
- `socket(module, path, options)` opens one of the module's websocket routes, the path written as the module writes it, `params` and `query` filling it in, all typed from the route.
|
|
111
|
-
- `send` takes the route's `body`, `
|
|
111
|
+
- `send` takes the route's `body`, `data()` reads the last message reactively, typed from its `response`, `onData(({ value }) => ...)` gets each one and returns what stops it, and `status()` is `connecting`, `open`, `failed` or `closed`: a server closing with a code from 4000 to 4999 (`ws.close(4403, 'Not yours')`) fails it, `error()` an `ApiError` with the code minus 4000 as `status` (403; 4000 gives 0, 4001 to 4099 give a status below 100, so refuse with 4400 and up) and the reason as `message`, and it does not reconnect.
|
|
112
112
|
- Messages travel as JSON both ways, a string, number, boolean or `null` read back as what it was. A message the route refuses is answered `{ error: { key, fields } }`, which `onRefused({ key, fields })` (a method and an option) reads: `fields` holds the words for each field, `''` the message as a whole.
|
|
113
|
-
- A route sending through `rooms()` takes `response: chats.response` to type `
|
|
113
|
+
- A route sending through `rooms()` takes `response: chats.response` to type `data()` and `onData()` as the rooms' `Message` ([Rooms](rooms.md)); without a `response` they are `unknown`, which `kay check` reports on a route with a `body` (`untyped-socket`).
|
|
114
114
|
- What is sent before the connection opens goes once it does, the last 50 messages kept while it is down; after `close()` nothing is.
|
|
115
115
|
- A connection that drops reconnects, waiting longer each time up to 30 seconds, less up to half of that at random so the clients a restart dropped come back apart, and not while the tab is hidden or offline, unless the server closed it with code 1000; a visible tab the browser calls offline still tries each minute, as `navigator.onLine` can be wrong, and the clients a network coming back wakes together reconnect up to half a second apart.
|
|
116
116
|
- `close()` closes it for good.
|
|
117
117
|
- `onOpen(listener)` is called each time the connection opens, a reconnect included, before what was queued goes; it is told `{ reconnected }`, true after the first open, so `onOpen(({ reconnected }) => reconnected && refetch())` catches up on what the drop lost. `stream()` has the same `onOpen`.
|
|
118
118
|
- A client joining rooms by message joins them there, `messages.onOpen(() => messages.send({ type: 'join', room }))`, so it is back in them after a drop.
|
|
119
119
|
- Hooks: a socket, a stream (a route or an iterable) and a streaming action's answer take `onOpen`, `onData`, `onError` and `onClose` as methods, and `socket(module, path, options)` and `stream(...)` take the same four as options (`stream(source, hooks)` for an iterable): `socket(chat, '/:room', { params, onData: ({ value }) => add(value), onError: ({ error }) => toast.error(error.message) })`. What each means is in [Island sources](island-sources.md#hooks). `onClose({ status: 'closed' })` also runs when the component ends and closes the source, even one that never started; the answer of a streaming action is open before a listener can attach, so its `onOpen` runs only after a `retry()`.
|
|
120
|
-
- `stream(module, path, options)` reads one of its routes answering with `eventStream()`, with `
|
|
120
|
+
- `stream(module, path, options)` reads one of its routes answering with `eventStream()`, with `data()`, `onData(({ value }) => ...)` (which returns what stops it) and `status()` the same way. A stream and the stream a streaming action answers with are both a `Connection` from `kay`, and `stream()` gives a `Stream`, a `Connection` with `start()`.
|
|
121
121
|
- `await feed.ended()` resolves with the last value once the stream ran to its end (undefined for none) and rejects with the `ApiError` it failed with, or an `AbortError` when `close()` came first.
|
|
122
122
|
- Its `status()` is `done` once the stream ran to its end and `failed` when a guard or the route refused it or its source threw, `error()` then an `ApiError` with the refusal's `status`, `message` and `data`.
|
|
123
123
|
- Every source an island reads, `resource`, `stream`, `socket`, `track()` and `call.track` here, shares `status()`, `pending()`, `error()` and `retry()`, and the same hooks; [Island sources](island-sources.md) describes that shape once, with each source's statuses and hooks.
|
|
@@ -125,17 +125,17 @@ button(onClick={() => messages.send({ text: text() })}) Send
|
|
|
125
125
|
- A GET stream that drops reconnects; any other ends as failed.
|
|
126
126
|
- `stream()` sends `Last-Event-ID` when it reconnects to a route whose `eventStream(source, { id })` gave ids, and has `onOpen(listener)` as `socket()` does ([resume after a drop](#resume-after-a-drop)); it takes the hooks of a socket as options too.
|
|
127
127
|
- `stream(module, path, { start: false })` stays `idle` until a handler calls `start(options)`, typed by the route; every stream has `start()`, which a stream that starts by itself ignores unless it is given options.
|
|
128
|
-
- Each start opens a run with those params, query and body, which may hold a `File` or be a `FormData`, closing the one going and forgetting its `
|
|
128
|
+
- Each start opens a run with those params, query and body, which may hold a `File` or be a `FormData`, closing the one going and forgetting its `data()`.
|
|
129
129
|
- `close()` aborts the request, which stops the route's source; a later `start()` opens it again.
|
|
130
130
|
- `resource(module, path, options)` from `kay` reads one of its GET routes answering a value, typed from the route's `response` as JSON leaves it, a Date as its ISO text.
|
|
131
131
|
- `onData({ value })` and `onError({ error })` are options of a resource and methods of it: `onData` runs each time the route answers, a quiet reload and `mutate()` included, not for `initial` or the value the server rendered, nor when a changed key joins a value another resource already holds, and `onError` each time a request fails, not for a quiet reload that keeps the value it has; a hook that throws is logged.
|
|
132
|
-
- `
|
|
132
|
+
- `data()` is the last answer, kept while the route is asked again, `status()` is `loading`, `ready` or `failed`, `error()` is the `ApiError` a route refused with, status 0 when no answer came, `refresh()` asks again even when ready, `retry()` only after a failure, and `pending()` also reads a quiet reload that keeps `ready`.
|
|
133
133
|
- Options given as a function, `() => ({ query: { prefix: search() } })`, are read reactively: a signal they read changing asks the route again, and an answer a newer request overtook is dropped.
|
|
134
134
|
- The server renders the island with the route's answer: it asks the route in process as the visitor (their cookies and headers, so the route's guards run), and the island is `ready` in the HTML and hydrates `ready` without a request. A route that refuses, throws or takes over 5 seconds leaves the island `loading` for the browser to ask, with nothing of the refusal in the page. A page that reads a cookie or an `Authorization` header with a `resource()` is not shared by a cache. A route answering `cache-control: private`/`no-store` or a `set-cookie`, or an answer over 64 KB as JSON (`SEED_LIMIT`), is not seeded and stays `loading`. `seed: false` keeps the server from asking a route at all (`loading`, the browser asks), for one whose read has an effect of its own, such as admitting an editor to a room; every resource of that route or key on the page needs it, and it applies to routes only, read from the first options. A prerendered page and a server island render `loading` as before (give a server island's resources their own `key`); an `await` block reads the page's seeds. Finding the routes takes a discarded first render, so an `await` expression runs once per render (three at most) on a page with a `resource()`.
|
|
135
135
|
- `resource()` reading one route and arguments share one request and one value; `key: 'rooms'` names another, so routes with the same key share. `initial: value` is a value the app already has, shown `ready` on the server and in the browser with no request until `refresh()` (a `load` function runs once, quietly, to follow its signals). `revalidate: 'focus' | 'reconnect' | '30s'` (or an array) asks again quietly, the value and `ready` kept, and stops with the component; with no `revalidate` a resource asks again only for `refresh()`, an invalidation of a key its route read or a changed option, never on focus or reconnect, and `stale` is 0. `stale: '30s'` counts an answer as fresh that long: `focus` and `reconnect` ask nothing inside the window (an interval, `refresh()` and an invalidation do), so a tab switched back and forth asks once per window. Identical reads in flight are one request through the shared key; an action that invalidated a tag the route's handler read refetches the resource through its live connection (see below), with nothing written. A route that reads no `cached(..., { live: true })` key names the keys itself: `resource(api, '/posts', { tags: ['posts'] })` asks again, quietly, when a call of this page invalidated `posts` (`invalidate('posts')` in the handler, a `cached('posts', ...)` key); an invalidation made elsewhere reaches only a route following live keys. The call sends the tags of the page's resources in an `x-kay-tags` header and the answer names only those the handler invalidated (a key the page never named stays out), so `invalidate(fn)` with a function names no key and reaches no tagged resource. A page with `liveRefresh: true` is left alone when every key the call invalidated is named by a resource or followed.
|
|
136
136
|
- `list.mutate(value)` (or `mutate(current => next)`) sets the value for every resource sharing the key and asks the route again to settle it, dropping a request still in flight so an older answer never overwrites it; `mutate(value, { refresh: false })` keeps the value as set.
|
|
137
137
|
- `resource(load)` reads anything else the same way, such as a WebSocket call or a `fetch` to another server: `load(signal)` returns a value or a promise, the signals it reads before its first await are tracked so it runs again when one changes, `signal` aborts when a newer run supersedes it or the component is gone, and a throw is `error()` with status 0 unless it is an `ApiError`.
|
|
138
|
-
- `stream(source)` reads an async iterable, `source(signal)` returning it, with `
|
|
138
|
+
- `stream(source)` reads an async iterable, `source(signal)` returning it, with `data()`, `onData()`, `status()` and `close()`: `done` once it ends, `failed` when it throws, and it opens once the island is in the page, and `source` stops on its `signal`.
|
|
139
139
|
- `call(module, path, options)` from `kay` calls any of its routes over HTTP from an event handler, or any code running in the browser, a module several islands share included: `const { ok, data } = await call(notes, '/', { method: 'post', body: { title } })`, or `await call(notes, '/', { method: 'post', body: { title } }).orThrow()` for the data, throwing the failure.
|
|
140
140
|
- `method` is GET unless named, and named where the path answers no GET.
|
|
141
141
|
- `params`, `query` and `body` are typed from the route, and the answer as `resource()` reads it, a number or a boolean arriving as the text Elysia sends, `null` as `null` and nothing (`undefined`, a 204) as `''`, so `run !== null` is a check the type allows.
|
package/llms/browser-only.md
CHANGED
|
@@ -30,9 +30,9 @@ onMount(() => drawMap(center))
|
|
|
30
30
|
- An island importing a package that throws on a browser-only global as it loads renders in the browser only, with nothing to write.
|
|
31
31
|
- Each package is imported once, in a Bun process of its own, and the answer is kept per package version in `.kay/cache`.
|
|
32
32
|
- The server never loads such a package: an island's server module carries none of its script.
|
|
33
|
-
- A component declaring `island({ render: 'client' })` always renders in the browser only, and is an island even without state.
|
|
33
|
+
- A component declaring `island({ render: 'client' })` always renders in the browser only, and is an island even without state.
|
|
34
34
|
- Pages, layouts and special pages render on the server, so they cannot declare it.
|
|
35
|
-
- `render="client"` renders one use of an island in the browser only: `Map(center={center} render="client")`.
|
|
35
|
+
- `render="client"` renders one use of an island in the browser only: `Map(center={center} render="client")`. `hydrate` says only when an island hydrates.
|
|
36
36
|
|
|
37
37
|
### Fallback while the browser renders
|
|
38
38
|
|
package/llms/cdn-caching.md
CHANGED
|
@@ -21,5 +21,5 @@ h1 Blog
|
|
|
21
21
|
- A page never gets the shared header when it is behind a guard, rendered for the visitor (a context, a flash cookie, the dev tool), or the lighter copy sent to a `Save-Data` visitor: those keep `private, no-cache`, `private, no-store` or `public, max-age=0, must-revalidate`. A response that sets any cookie, from the session, kayjs-auth or kayjs-cms, or from a route of the app, is made `private, no-cache` as well (`keepCookiesPrivate` from `kay/library` does it for a plugin of your own).
|
|
22
22
|
- A page that sets a `cache-control` of its own (`ctx.headers.set(...)`) keeps it, a page answering another status than 200 gets none, and a background render that stores its own header keeps it.
|
|
23
23
|
- `cache: { browser, shared, swr }` in `page` sets each part of the header (`public, max-age=<browser>, s-maxage=<shared>, stale-while-revalidate=<swr>`, a part left out left out of it, `max-age` 0), and `shared` is also how long the server serves the page before it renders it again. `'private'` sends `private`, `false` keeps `public, max-age=0, must-revalidate` whatever a layout says. A layout's `cache` applies to every page under it, the innermost winning, and a part given as no duration fails the build with `page-settings-invalid`.
|
|
24
|
-
- `ttl` and `cacheControl` are the 1.104 names
|
|
24
|
+
- `ttl` and `cacheControl` are the 1.104 names, no longer read: `ttl: '1h'` is `cache: '1h'`, a `cacheControl` text is written as the `cache` object.
|
|
25
25
|
- `kay build --static` writes the same value to `_headers`, for each such page at its path under the `base`, with and without the trailing slash (the root as `/base` and `/base/`). A path holding a `*`, a `:` or a space is left out, no `_headers` is written when it would be empty, and a `public/_headers` keeps its rules, kay's block following them without a header the file names. `headers.nginx.conf` carries no `cache-control`, as an nginx `include` cannot say a header per path.
|
package/llms/checks.md
CHANGED
|
@@ -53,7 +53,7 @@ kay lint --cache
|
|
|
53
53
|
- A name starting with `_` is unused on purpose, and so is a prop destructured beside `...rest`, which it leaves out.
|
|
54
54
|
- The editor reports them too, greyed out, and offers to remove an unread prop.
|
|
55
55
|
- A file with a compile error is not searched for them until it compiles, as the code the error stopped may read them.
|
|
56
|
-
- Literal values the server would refuse when it runs: a `ctx.
|
|
56
|
+
- Literal values the server would refuse when it runs: a `ctx.deny` status outside 400 to 599, a redirect target with a scheme other than http(s), such as `javascript:`, or with a line break, and a `cached()` ttl that is not positive. A computed one is checked when it runs.
|
|
57
57
|
- Island props a layout or a page with a `--- server` fence passes can be serialized, those of a `{...spread}` included: no functions (an action excepted, which goes as its URL), blocks with parameters or class instances.
|
|
58
58
|
- `secret-prop` reads the same props for fields named like a secret (`password`, `token`, `apiKey`, `email`...): an island's props are in the page source, so hand it the fields it shows, `user={{ name: user.name }}`, or allow a public one with `// kay-allow secret-prop`.
|
|
59
59
|
- A static component passing one is the `island-prop` error: it declares `island()` or passes the island data (see [Islands](islands.md#islands)), and children pass from anywhere.
|
package/llms/code-lints.md
CHANGED
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
| `brace-in-attribute` | deny | code | A quoted attribute of an HTML element holding `{name}`, `{user.name}` or `{count(1)}`: only text interpolates, so the braces ship as written. The quick fix writes `title={name}`, or a template literal for mixed text, and is safe for a name in scope; `\{` keeps a literal brace. A component's quoted prop is left alone. |
|
|
17
17
|
| `unknown-link-flag` | deny | code | A `data-` attribute one letter from a navigation flag of a link (`data-scroll`, `data-transition`, `data-prefetch`, `data-reload`), as `data-prefech` or `data-scrol`: it would do nothing. The fix, which is not safe, writes the flag meant. |
|
|
18
18
|
| `async-reply` | warn | code | An `async` function returning kayjs-ai's `ask()`, which awaits the reply so nothing streams; a local `const` holding the reply counts; the fix removes `async` where every returned value is the reply, a function awaiting first returns `ask(...).stream()`. |
|
|
19
|
-
| `
|
|
20
|
-
| `once-read-prop` | deny | code | A destructured prop read into a top-level `let`, a destructured `const`, one that awaits or a declaration nested in a block, that a function or the template reads later, in a component that runs in the browser: the declaration runs once, so the value keeps the prop's first value after the parent changes it. A top-level `const` naming one value is a memo and follows the prop, so it is no case. A prop read as the test of an `if` or a ternary, an argument of a call or `new`, a write target, in a class, or inside `signal(...)`, `persisted(...)` or `posted...(...)`, `id ?? uid()`, a callback prop, a prop named `initial*` or `default*` are choices made once; otherwise compute the value where it is used or in a `memo`, or allow it with `// kay-allow once-read-prop: why the first value is meant`. |
|
|
19
|
+
| `once-read-prop` | deny | code | A destructured prop read into a top-level `let`, a destructured `const`, one that awaits or a declaration nested in a block, that a function or the template reads later, in a component that runs in the browser: the declaration runs once, so the value keeps the prop's first value after the parent changes it. A top-level `const` naming one value is a memo and follows the prop, so it is no case. A prop read as the test of an `if` or a ternary, an argument of a call or `new`, a write target, in a class, or inside `signal(...)`, `persisted.cookie(...)` or `posted...(...)`, `id ?? uid()`, a callback prop, a prop named `initial*` or `default*` are choices made once; otherwise compute the value where it is used or in a `memo`, or allow it with `// kay-allow once-read-prop: why the first value is meant`. |
|
|
21
20
|
| `literal-tag` | deny | code | Template text holding an HTML tag, `p Press <kbd>Ctrl</kbd>`: text is escaped, so readers see the tag as written. Text inside `code`, `pre`, `kbd` and `samp`, an entity such as `<kbd>` and a name that is no element, as in `Array<string>`, are left alone. The quick fix writes a pair around plain text, or a void element, as `#[kbd Ctrl]`. |
|
|
22
21
|
| `unkept-page` | warn | code | A page saying `keep: true` that `kay build` does not keep prerendered, as it reads the request or the clock, imports a package, holds module state or renders differently each time: reported by `kay build` at the file and line that decided it, never by `kay check`, and no `// kay-allow` comment reaches it. |
|
|
23
22
|
| `removed-ui-token` | warn | code | A kayjs-ui theme token or utility under its old `kui-` name, such as `--color-kui-canvas` or `bg-kui-surface2`, which stopped working in 1.75: a utility builds nothing and a `var()` of it resolves to nothing. `kay check --fix` rewrites it to the app's own name where one stands for it, and the report says where to set the rest: a `--kui-border-*` knob and a `kui-` utility with no new form are reported without a fix. Names quoted in a comment are not reported |
|
|
@@ -78,7 +78,7 @@ export function auth({ prefix = '/auth' } = {}): KayExtension {
|
|
|
78
78
|
- `routes` lays a directory of the library's `.kay` pages, layouts, guards and special pages over the app's `src/routes` at `prefix`, the root by default: `routes/login.kay` serves `/auth/login`, its server fence, load and actions included, as if it were `src/routes/auth/login.kay`.
|
|
79
79
|
- A file of the app at the same path replaces the library's: `src/routes/auth/login.kay` serves `/auth/login` in its place, and the library's other pages stay.
|
|
80
80
|
- Layouts, guards, `_404.kay`, `_error.kay` and the status pages (`_403.kay`...) resolve per URL directory across both trees, the app's file winning at a level both have one: the app's root layout wraps a library page, and a library `_layout.kay` wraps its pages, an app page replacing one of them included, unless the app has its own `_layout.kay` in `src/routes/auth`. A library layout whose `page` sets `layouts: false` starts the chain afresh, as an app's does: none of the app's layouts above wraps its pages, so a library with screens of its own (kayjs-cms's admin) draws its own chrome, and it imports the stylesheet those pages need, as the app's root layout is not there to. The app's `seo`, `fonts`, security headers and `kay.config.ts` head still apply, its layouts' own head tags and imported CSS do not.
|
|
81
|
-
- Its islands and stylesheets are bundled with the app's, and `kay build --compile` and `--static` carry its pages; a static export refuses a library page taking an action, as it refuses the app's, unless the app replaces it.
|
|
81
|
+
- Its islands and stylesheets are bundled with the app's, whether the library is installed, linked from a workspace or a folder above the root, with or without a dependency on it in the app's `package.json`, and `kay build --compile` and `--static` carry its pages; a static export refuses a library page taking an action, as it refuses the app's, unless the app replaces it.
|
|
82
82
|
- `kay check` lets links point at its pages; type errors inside an installed library's files are the library's own check's.
|
|
83
83
|
- An extension listed by a path beside the app or through a link, as a library's own example or fixture app lists it, is checked as the app's own, by `kay check` and in the editor: its pages, its CMS editor and the components they reach, their route params typed, with the app's catalogs, `ctx.locals` and matchers in scope, under the `tsconfig.json` options of the extension's package when they differ from the app's; its `.ts` modules stay the library's own check's, and the dependencies its package installs itself resolve from its pages.
|
|
84
84
|
- A path an extension's routes name, a link, a redirect or a `localPath` fallback, is checked only when it goes under its own prefix, `/fr/auth/x` as `/auth/x`: `/` or any other page of the app is taken as written, and an extension mounted at the root checks none.
|
|
@@ -29,7 +29,7 @@ How kay and its libraries name the same idea, written before the renames land: a
|
|
|
29
29
|
- A component's transition callback takes one event object, however many things it reports: `onOpenChange({ open })`, `onChange({ value, option })`, `onSortChange({ sort })`. Never positional arguments, never a bare value (`onChange({ value })`). The fields are camelCase names of what they hold, the same on every component of a kind: `open`, `value`, `checked`, `selected`, `item`, `key`, `index`, `page`, `size`, `files`, `rows`, `options` and `query` for a source that answered. A native event rides as `event` (`onPage({ page, event })`), and `onError` keeps its failure shape.
|
|
30
30
|
- State a prop can hold reports through `on<Prop>Change({ <prop> })`, the field being the prop's name: `open` with `onOpenChange({ open })`, `value` with `onValueChange({ value })` (Accordion, Tabs, ThemeToggle), `collapsed` with `onCollapsedChange({ collapsed })`. What the app holds as a key but the callback reports richer (`selected` with `onSelectedChange({ keys, rows })`) reports those richer fields in place of the prop's own (Table, TreeView and Timeline `selected`, AudioPlayer `position`, MarkdownEditor `preview`), a deliberate exception listed as `ALIASED` in `tests/callbacks.test.ts`, and `bind:` does not apply to it. The press of an item with no prop behind it is `on<Verb>`: `onSelect({ item })`, `onRowClick({ row, event })`, `onCopy({ text })`. One name per meaning: never `onToggle`, `onClose`, `onPick` or `onUpdate`.
|
|
31
31
|
- A source that answers (a list, a promise or an action) reports through `onLoad({ options, query })` (`{ rows }` on a Table, `{ items }` on a VirtualList) and `onError({ error, query })`.
|
|
32
|
-
- `onChange` on Accordion, Tabs and ThemeToggle is `onValueChange`, ZoomPane's is `onPlateChange`, Table's `onSort` is `onSortChange` and a chart's `onActive` is `onActiveChange`. The old names
|
|
32
|
+
- `onChange` on Accordion, Tabs and ThemeToggle is `onValueChange`, ZoomPane's is `onPlateChange`, Table's `onSort` is `onSortChange` and a chart's `onActive` is `onActiveChange`. The old names went in 1.109.
|
|
33
33
|
|
|
34
34
|
**Hooks and switches**
|
|
35
35
|
- An `on*` hook of a server extension takes one event object, `onSave({ ... })`, and returns nothing; the `on*` prop of a component takes one event object too, holding what it reports (`onSave({ data })`, `onSend({ data })`, `onCopy({ text })`, `onError({ error })`), with no `context` ([hooks](hooks.md), Callbacks below). A callback that returns data is named for what it returns (`profileFields`, `exportData`), not `on*` (#1694).
|
package/llms/components.md
CHANGED
|
@@ -141,8 +141,8 @@ ul
|
|
|
141
141
|
|
|
142
142
|
- `---` holds the component script: imports, props, signals, functions. It runs wherever the component renders.
|
|
143
143
|
- `--- server` runs on the server for each request and never reaches the browser. A component has none: it takes its values as props, which the page or layout computes in its own `--- server`. A page that hydrates, which a handler in it makes it, runs its template in the browser without that fence, so a function the template calls and the server fence imports (`formatFileSize(share.size)`) is the error `server-import-in-island`: import it in the script fence too, or move what reads it into a component.
|
|
144
|
-
- `island({ render, hydrate, persist, interactive })` first in the script says how the component is an island: it renders in the browser only (`render: 'client'`), is an island though nothing in it needs the browser (`island()`), or is held to staying none (`render: 'static'`); see [Islands](islands.md#islands).
|
|
145
|
-
- `--- module` holds module-level code, run once per bundle rather than per render: `export const visits = signal(0)` or `export function label(n: number)` there are values other files import from the `.kay` file, typed as written (`import { label } from './counter.kay'`). It takes no props and no default export, and a
|
|
144
|
+
- `island({ render, hydrate, persist, interactive })` first in the script says how the component is an island: it renders in the browser only (`render: 'client'`), is an island though nothing in it needs the browser (`island()`), or is held to staying none (`render: 'static'`); see [Islands](islands.md#islands).
|
|
145
|
+
- `--- module` holds module-level code, run once per bundle rather than per render: `export const visits = signal(0)` or `export function label(n: number)` there are values other files import from the `.kay` file, typed as written (`import { label } from './counter.kay'`). It takes no props and no default export, and a component declaring `island({ render: 'client' })` has none. Module state is per bundle: the server's copy and the browser's are not shared. A signal exported from it is read by an importer as `visits()` and written as `visits = 1`, as one a `.ts` module exports.
|
|
146
146
|
- `--- style` holds CSS scoped to the component: kay adds a `data-k-<id>` attribute to every element the template writes and ends each selector on it (before a pseudo-element, which keeps its place), so `.card { color: red }` reaches this file's `.card` alone, and the rule weighs one attribute more. `:global(.x)` is the escape, `:global(body) .card` scoping `.card`, a list `:global(.a, .b) .card` global in each entry, and `@media`, `@supports`, `@layer` and `@container` bodies are scoped alike; a rule nested inside another is scoped on its own selector, and a `@keyframes` name is scoped to the component with the `animation` and `animation-name` values that use it (`@keyframes :global(spin)` keeps `spin` for other components to use). A component called from the template keeps its root unscoped, reached through `class` and parts, and slotted content carries its writer's attribute. The CSS joins the page stylesheet as an imported one does (Tailwind's `@apply` works, unused classes are cut).
|
|
147
147
|
- `kay check` reads the style fence for `unused-selector` (warn: a rule no element of the template can match) and `unreachable-selector` (error, `:global(...)` its offered fix: a rule ending on `:root`, `html` or `body`).
|
|
148
148
|
- A fence ends on a `---` line, or on a `--- server`, `--- script`, `--- module` or `--- style` line, which opens the next fence.
|
|
@@ -162,7 +162,7 @@ ul
|
|
|
162
162
|
- Defaults go in the destructuring. A default applies only to an `undefined` prop (`null` stays `null`), and runs only then, once per component, the first time the prop is read (a literal one is written at each read instead, as it has no identity to keep).
|
|
163
163
|
- Props stay reactive: the compiler turns each destructured name into a live read. A top-level `const` computed from a prop or a signal is live in the browser: `const last = items.length - 1` or `const twice = count() * 2` is read as a value and follows what it reads, the compiler making it a memo (a `const` built from another one too). The server renders once and keeps it plain. The test of a condition or a ternary, the arguments of a call or `new`, an `initial*` or `default*` prop, a callback prop, `id ?? uid()` and a function or class body choose or build something once, so a `const` reading only those keeps its first value; so does one under `// kay-allow once-read-prop: why`, and a `let`, a destructured `const`, one with an `await` and a declaration inside a block (`once-read-prop` says so for a prop): there write `memo(() => ...)` or compute it where it is read. Such a `const` cannot be reassigned.
|
|
164
164
|
- Props are read-only.
|
|
165
|
-
- `slot` and `slot name` type the children and the blocks a call may pass, from the template: declare no `children`, and no `name?: Snippet` for a `slot name` the template reads, and a call passing a block the component has no `slot` for is a `kay check` error. A block read with values, `slot item(row, i)`, takes a function whatever its arguments, so declare `item: Snippet<[Row, number]>` to type them. To require children or a block, declare it required: `const {} = props<{ children: Snippet }>()`, as a destructured name nothing reads is `unread-name
|
|
165
|
+
- `slot` and `slot name` type the children and the blocks a call may pass, from the template: declare no `children`, and no `name?: Snippet` for a `slot name` the template reads, and a call passing a block the component has no `slot` for is a `kay check` error. A block read with values, `slot item(row, i)`, takes a function whatever its arguments, so declare `item: Snippet<[Row, number]>` to type them. To require children or a block, declare it required: `const {} = props<{ children: Snippet }>()`, as a destructured name nothing reads is `unread-name`.
|
|
166
166
|
- A prop holding an action is typed `Action`, or `NoInputAction<unknown>` for one without input; see [Pass an action to a component](actions-from-islands.md#pass-an-action-to-a-component).
|
|
167
167
|
- A prop holding a component is typed `Component<Props>` from `kay` and drawn by its capitalised name, one holding an icon with `svg({...icon})`; see [Draw an icon or a component chosen by a value](templates.md#draw-an-icon-or-a-component-chosen-by-a-value).
|
|
168
168
|
- A page has no props: its data comes from its `--- server` fence.
|
|
@@ -183,7 +183,7 @@ ul
|
|
|
183
183
|
- Assigning writes a signal wherever it sits: one a `const`, an import, a `let` or `var` set to `signal(...)` holds, and also one in an object's property or an array element, `box.count = 1`, `list[2]++`, or in a `let` set from a function's result. The compiler cannot tell those from a plain write, so the runtime does: a signal there is written, anything else assigned, and `kay check` types the write by what the target holds, `box.count = 'x'` being a type error for a `Signal<number>`. A function assigned there, a signal included, replaces what was held. A target kay sees holds no signal, a literal or `new Map()`, is assigned as written, and so is a field of `this`, a write beside another write, a `let` written with an `await`, a compound write holding an `await`, and a `let` update whose value is read: use `.set` there. A `readonly` property or array element holding no signal, written this way, is a `kay check` error, as in plain code.
|
|
184
184
|
- `bind:name={signal}` on a component needs a signal and a prop typed `Bindable<T>` or with an `on<Name>Change` callback beside it; a child hands it on with `bind:name={name}`, through any number of levels. `bind:` on a component makes the parent an island. `...rest` and a props spread hand a `Bindable` prop on whole; a member of `rest` is a value and `bind:` refuses it. `kay check` reports a prop with neither, and a memo or a value that is no signal.
|
|
185
185
|
- A prop is always a value: a parent hands a signal's or a memo's value, `Toggle(open={open()})`, kept current through a getter, or binds the prop with `bind:`.
|
|
186
|
-
- Assign every state primitive: `persisted`, `queryParam`, `linked` and `selection` write as a `signal` does (`selected = id`). `live` writes with `.set(value)`, or `.set(
|
|
186
|
+
- Assign every state primitive: `persisted`, `queryParam`, `linked` and `selection` write as a `signal` does (`selected = id`). `live` writes with `.set(value)`, or `.set(value, { key })` for a keyed one, on the server only, and assigning it is a compile error that says so. A `resource` or a `socket` is called or read through its members.
|
|
187
187
|
- `kay check` narrows a signal or memo a template expression calls within that expression: `{error() && error().message}`, with `error` a `signal<Error>()`, checks.
|
|
188
188
|
- A write in between, as by a function the expression calls, is not seen by that narrowing.
|
|
189
189
|
- Reads inside a function the template writes, a handler or a `.map` callback, run later and are not narrowed at all: copy the value into a `const` in the script, or assert it, `sent()!`.
|
package/llms/deprecated-lints.md
CHANGED
|
@@ -14,10 +14,4 @@ The lints of the `deprecated` group, each the old form a minor replaced, reporte
|
|
|
14
14
|
| --- | --- | --- | --- |
|
|
15
15
|
| `deprecated-action-options` | warn | deprecated | The arguments of `action` before 1.107, `action(schema, handler, options)` and `action(handler, options)`: the options come first, with the input in them, as an API route's do, `action({ input: schema, ...options }, handler)` and `action(options, handler)`. `input` is a plain record of fields or any schema. The old forms work until 2.0. Found on the `action` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files; the fix moves the arguments and keeps their text. |
|
|
16
16
|
| `deprecated-schema-builders` | warn | deprecated | The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by: write `{ extra: 'strip' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says. |
|
|
17
|
-
| `deprecated-
|
|
18
|
-
| `deprecated-package-names` | warn | deprecated | A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found where a name is an `import` or `export ... from` specifier, a `require()`, `import()` or `mock.module()` argument or a config key (a quoted name keyed to anything but a package name or a version, as `librarySettings`) of the project's TypeScript and `.kay` files, in the `@import` and `@plugin` paths of its CSS, and in its package.json and tsconfig files; a name in a comment or any other string, as data a tool reads or a table of renames, is left alone. The fix writes the new name, raising a package.json range below 1.104 to it, and `kay check` loads a `kay.config.ts` that still imports an old name no longer installed as if renamed, so an app that renamed `package.json` by hand can run `kay check --fix`; a package.json that lists the new name already is reported with a fix that is not safe, and `kay upgrade` does the whole move, package.json and install included. |
|
|
19
|
-
| `deprecated-children-prop` | warn | deprecated | `children?: Snippet` in a props type beside a bare `slot`, since 1.105: the template types the children, so a component declares none. `children: Snippet` still requires them. The old declaration works until 1.108. The fix removes the member. |
|
|
20
|
-
| `deprecated-link-flags` | warn | deprecated | `data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, since 1.105 `data-scroll="keep"`, `data-transition="false"` and `data-prefetch="false"`, named as the options of `navigate()`. The old names work until 1.108. The fix writes the new attribute; a dynamic `data-no-transition` or `data-no-prefetch` has none. The app's test files (`*.test.*`, `*.spec.*`) are checked too: a selector `[data-keep-scroll]` is written `[data-scroll=keep]` by the fix, an attribute read by name (`getAttribute('data-keep-scroll')`) has a fix that is not safe, a read of `dataset.keepScroll` (and `noTransition`, `noPrefetch`) has one too, and a write of it and any other string naming an old flag have none. |
|
|
21
|
-
| `deprecated-parts-class` | warn | deprecated | The parts of a component given as its `class`, `parts` since 1.105: `Card(class={{ head: 'p-6' }})` is `Card(parts={{ head: 'p-6' }})`. The old form, an object literal of strings by part name, works until 1.108, the compiler handing it on as `parts`. The fix writes `parts` for `class`. |
|
|
22
|
-
|
|
23
|
-
The rows of the lints that came in 1.105 are in [Deprecated lints of 1.105](deprecated-lints-1-105.md).
|
|
17
|
+
| `deprecated-ui-props` | warn | deprecated | A kayjs-ui or kayjs-ai prop under its name before 1.98. `heading` on a Dialog, SidePanel or FormDialog is `title`, which takes a string or a `@title` block as a Card's does, and the string that named the dialog for screen readers is `label`. `variant` on a Stat, Chat or ChatLauncher is `layout`, `variant` naming only the frame of a control. The old names work until 2.0. The fix renames the prop or the block, and the `title` string beside a `heading` to `label`; it offers none where the new name is already written. |
|
package/llms/effects.md
CHANGED
|
@@ -95,4 +95,4 @@ p {seconds()}s on the page, last key {key()}
|
|
|
95
95
|
- `throttled(source, delay)` from `kay` is its twin for a value that must keep up while it changes: it gives `source`'s value at most once per `delay`, the first change at once and the last one when the wait ends; it is read by calling it, keeps its first value on the server and drops its timer with the island.
|
|
96
96
|
- `watch` and `debounced` run nothing while the server renders an island, as `effect` does; at a module's top level they run in the server's process too, as `effect` does there.
|
|
97
97
|
- `listen(() => window, 'keydown', event => ...)` from `kay` listens to an event of `window`, `document` or any other target while the island lives, the handler typed by the target's events and the fourth argument passed to `addEventListener`.
|
|
98
|
-
- The target is a function returning it, the one form: it is never read on the server, in a `.ts` module as in a `.kay` file, and a `ref` or a signal it reads is followed, `listen(() => panel, 'scroll', ...)` listening to its new value as it changes, none while it is undefined. A target given as a value, `listen(window, ...)`,
|
|
98
|
+
- The target is a function returning it, the one form: it is never read on the server, in a `.ts` module as in a `.kay` file, and a `ref` or a signal it reads is followed, `listen(() => panel, 'scroll', ...)` listening to its new value as it changes, none while it is undefined. A target given as a value, `listen(window, ...)`, is a type error, and in a `.kay` file a read of `window` in an island.
|
package/llms/errors.md
CHANGED
|
@@ -45,7 +45,7 @@ kay explain template-syntax
|
|
|
45
45
|
| `fence-syntax` | compile | Code in a fence that does not parse, or code the template generates that does not. | [File layout](components.md#file-layout) |
|
|
46
46
|
| `page-settings-invalid` | compile | A page setting exported under its own name instead of inside `page`, such as `export const prerender = true`, or a `guards` or `layouts` that an endpoint or an API module sets to anything but a literal `true` or `false`, or a `query` declared outside a page or a layout. | [Page settings](routing.md#page-settings) |
|
|
47
47
|
| `signal-misuse` | compile | A signal or memo written the wrong way: a memo assigned, a name declared twice, a `bind:` to a name holding no signal. | [Signals](components.md#signals) |
|
|
48
|
-
| `client-route-fence` | compile | A page, layout or special page declaring `island({ render: 'client' })
|
|
48
|
+
| `client-route-fence` | compile | A page, layout or special page declaring `island({ render: 'client' })`: they render on the server. | [Islands](islands.md#islands) |
|
|
49
49
|
| `server-import-in-island` | compile | A page whose template reads a name imported only in its `--- server` fence, where the page hydrates (a handler makes it an island): the browser runs the template without that fence, so the read throws and every island of the page stays inert. Reported by the type check, at the read; the fix, offered, imports it in the script fence too. | [File layout](components.md#file-layout) |
|
|
50
50
|
| `static-pin` | compile | A component pinned static, with `island({ render: 'static' })`, that something makes an island: an `on*`, `bind:` or `ref`, a browser value of `kay` or a live value. The error stands at that thing; a function it hands an island is `island-prop`. | [Islands](islands.md#islands) |
|
|
51
51
|
| `browser-only-read` | compile | A browser-only name such as `window` read while a component renders on the server too; reported by the type check, so a page still runs. | [Browser globals on the server](browser-only.md#browser-globals-on-the-server) |
|
|
@@ -63,7 +63,7 @@ kay explain template-syntax
|
|
|
63
63
|
| `executable-incomplete` | build | A compiled executable that lacks a part of what it needs: the build of a collection, the client build, its fonts or a share card key. | [Build one executable](build-and-start.md#build-one-executable) |
|
|
64
64
|
| `route-invalid` | build | A route file the router cannot serve: a name with characters it cannot mount, a matcher, guard, endpoint or API module that exports the wrong thing, two files exporting the same action, or two extensions each giving an editor. | [Pages and routing](routing.md#pages-and-routing) |
|
|
65
65
|
| `redirect-invalid` | build | A redirect in `redirects` that does not start with `/`, holds something other than a `:param` or a final `*`, or goes to a path using a part its source lacks. | [Redirects](routing-endpoints-and-base.md#redirects) |
|
|
66
|
-
| `locales-invalid` | build | An `i18n` config that does not hold together: no locales, a tag that is none, a default outside the locales,
|
|
66
|
+
| `locales-invalid` | build | An `i18n` config that does not hold together: no locales, a tag that is none, a default outside the locales, `paths` naming a page that does not exist, a catalog that exports no messages or not as `defineMessages`, or `writeDraftMessages` given a locale the config does not translate. | [Configuring locales](locales.md#configuring-locales) |
|
|
67
67
|
| `font-invalid` | build | A font in `fonts` that is no font file, no installed Fontsource package, or lacks the weight, style or subset asked for. | [Fonts](sitemap-search-fonts.md#fonts) |
|
|
68
68
|
| `favicon-invalid` | build | A favicon, manifest icon or SVG that is no SVG kay can draw, has no size, is not square, or a manifest path outside its scope. | [Favicon and web manifest](sitemap-search-fonts.md#favicon-and-web-manifest) |
|
|
69
69
|
| `share-card-invalid` | build | A share card drawn with no font, a logo that is missing, not square or not an image kay draws, a colour that is no #rrggbb, an empty title, or a `_card.kay` with no Chrome to draw it or a card on an image it cannot show. | [Draw a share card for a page](images.md#draw-a-share-card-for-a-page) |
|
package/llms/events.md
CHANGED
|
@@ -11,7 +11,7 @@ kay and its libraries tell an app what happened with DOM events, and keep what a
|
|
|
11
11
|
|
|
12
12
|
### Events
|
|
13
13
|
|
|
14
|
-
- A public event is `<lib>:<verb>` (`kay:`, `kai:` for kayjs-ai, `kui:` for kayjs-ui) fired on `document`, with an object `detail`. A plain script (an analytics tag, a lightbox) listens with `document.addEventListener('kay:renew', ...)`, an island with the function hook of the table below, which ends with the island and hands an object of its own where the event hands `detail
|
|
14
|
+
- A public event is `<lib>:<verb>` (`kay:`, `kai:` for kayjs-ai, `kui:` for kayjs-ui) fired on `document`, with an object `detail`. A plain script (an analytics tag, a lightbox) listens with `document.addEventListener('kay:renew', ...)`, an island with the function hook of the table below, which ends with the island and hands an object of its own where the event hands `detail`. An event with no hook in the table (`kay:renew`, the dev events, the chat's) stays a `listen(() => document, ...)` for an island too. An event an app sends to a component is dispatched on `document` too, `new CustomEvent('kai:chat-send', { detail: { text } })`.
|
|
15
15
|
- An event about one element (`kay:action-*` on a form, `kui:hold-defaults` on a form) bubbles, so `document` hears it as well.
|
|
16
16
|
|
|
17
17
|
| Event | Fires | `detail` | Hook of an island |
|
package/llms/guards.md
CHANGED
|
@@ -57,7 +57,7 @@ A `path` is one route, a `prefix` a subtree, and every `guards` option takes a g
|
|
|
57
57
|
- A route with guards of its own is covered: `unguarded-route` and `guards.default` leave it out, and `kay build --static` refuses to write it, as for one a `_guard.ts` covers.
|
|
58
58
|
- `false` is read from the source as written, as `layouts: false` is, so `kay check` and `kay dev` report a `guards` set to `(false)`, `!open`, `false || open`, a method, a getter, and a `layouts` or a spread held in a variable or an expression, rather than ignore it. A variable holding `false` is no guard: the route answers 500 when asked, naming the file. Guards the source does not show where kay reads them, in a `page` typed `: PageSettings` or an `api(options)` call holding a variable, stop the boot or answer 500 and a static export refuses them, never serve the route with none.
|
|
59
59
|
- `guards: { default }` left unset, on a site with at least one guard of its own, answers 403 for each page, endpoint or API module of the app that no guard covers (a library's routes, layouts and action modules excepted), and `kay check` reports each as an `unguarded-route` error; a site with no guard at all stays open, and `default: 'open'` keeps a site that mixes them open.
|
|
60
|
-
- `guards: { default: 'closed' }` in kay.config.ts
|
|
60
|
+
- `guards: { default: 'closed' }` in kay.config.ts fails closed everywhere, a layout's and an `_actions.kay`'s actions included: every page, action, endpoint and API module of the app that no guard covers and that does not set `guards: false` answers 403, the OpenAPI document too unless a guard covers every module not setting `guards: false`, and `kay build --static` refuses to write such a page or endpoint.
|
|
61
61
|
- A layout a library mounts asks no guard of its actions, which still run the guards above it, and the OpenAPI document is served when every module is open.
|
|
62
62
|
- `kay check` reports each one as `unguarded-route`.
|
|
63
63
|
- A library's routes keep the guards it gives them.
|
package/llms/head.md
CHANGED
|
@@ -238,6 +238,6 @@ export default defineConfig({
|
|
|
238
238
|
- The site is the one the last `pages()` or build of the process read, one site per process.
|
|
239
239
|
- `seo: { noindex: true }` in the `page` object a page's server fence exports asks search engines to leave it out, `<meta name="robots" content="noindex">` in its head, a `robots` tag of its own still winning.
|
|
240
240
|
- `seo.noindex` also leaves the page out of the sitemap, as legal pages often are.
|
|
241
|
-
- `seo` of `page` also takes `sitemap`, `lastmod`, `search` and `feed`, which were top-level keys of `page` before 1.105
|
|
241
|
+
- `seo` of `page` also takes `sitemap`, `lastmod`, `search` and `feed`, which were top-level keys of `page` before 1.105 and are no longer read there, as `ttl` and `cacheControl` are `cache`.
|
|
242
242
|
- Without `site` and `seo`, a page's head holds only the tags it and its layouts set.
|
|
243
243
|
- `kay build` reads the prerendered pages against one another and warns of shared titles and descriptions, a title over 60 characters, an orphan page, a canonical link or redirect leading to a redirect or a missing page and alternates that do not point back: the `seo` lints in [Lints](lints.md#seo-lints).
|
package/llms/hooks.md
CHANGED
|
@@ -65,7 +65,7 @@ This release ships the helpers (`dispatch()`, `decide()`, `hookContext()`, `Hook
|
|
|
65
65
|
|
|
66
66
|
### The rule
|
|
67
67
|
|
|
68
|
-
- `afterX` runs after X happened and only observes: what it returns is ignored. X is the verb of the transition in its base form: `afterSave`, `afterSend`, `afterDelete`, `afterSubscribe`. Never a participle (`afterSaved`). Before 1.105 it was `onX`, which
|
|
68
|
+
- `afterX` runs after X happened and only observes: what it returns is ignored. X is the verb of the transition in its base form: `afterSave`, `afterSend`, `afterDelete`, `afterSubscribe`. Never a participle (`afterSaved`). Before 1.105 it was `onX`, which is no longer read; `onX` is the name of a component's callback and of a lifecycle (below).
|
|
69
69
|
- `beforeX` runs before X and is the only hook that changes or refuses it.
|
|
70
70
|
- Anything with a start and an outcome (a job, a schedule run, a workflow run, an ask, an action) uses `onStart`, `onSuccess` and `onError`, plus steps of its own (`onRetry`; kayjs-ai's `afterStep` and `afterToolCall` observe the ask). It is `onError`, never `onFail` or `onFailed`.
|
|
71
71
|
- One object argument: the transition's fields plus `context`. A hook gets `{ user, context }`, not `(user, context)`.
|
|
@@ -106,7 +106,7 @@ export default defineConfig({
|
|
|
106
106
|
- `onResponse({ request, url, locals, status, duration })` is told after the answer is made, `duration` in milliseconds, up to the first byte for a streamed answer. A throw is reported with source `onResponse`.
|
|
107
107
|
- `onListen({ url })` runs when the server listens and `onStop()` when it stops, after the open requests finished and after the `onStop` hooks of the plugins and extensions; a throw is reported and the others still run.
|
|
108
108
|
- `onError({ error, request, source, code })` receives every error kay logs ([Error reporting](routing-special-pages.md#error-reporting)); it was `observe.onError` before 1.105.
|
|
109
|
-
- `actions.beforeRun({ action, file, input, context })` runs before every action's handler, once the guards and the schema let the post through; `false` or `refuse()` fails the post. It cannot change the input. `onSuccess` adds `result`, `onError` adds `status`, `message`, `errors`, `data` and `error
|
|
109
|
+
- `actions.beforeRun({ action, file, input, context })` runs before every action's handler, once the guards and the schema let the post through; `false` or `refuse()` fails the post. It cannot change the input. `onSuccess` adds `result`, `onError` adds `status`, `message`, `errors`, `data` and `error`. Every hook event carries one `context`, an action's being its own context (`request`, `locals`, `cookies`, `params`, `locale`) with `ip`, `userAgent` and `userId` beside: `({ context }) => context.locals`. `ctx` is no longer in the event; `onStart` of the config, which ran when the server listens, is `onListen`, `onStart` naming where a job, a queue or a workflow run begins.
|
|
110
110
|
- A redirect the handler throws is a success (the action did its work, as in post-redirect-get): `onSuccess` is told it with `result` undefined, and `onError` is not. `onSuccess` of a streaming action is told as the stream starts, before it is read.
|
|
111
111
|
- The app's action hooks run before the action's own (`action(schema, handler, { onSuccess })`), both observing, a throw reported and never failing the action.
|
|
112
112
|
|
package/llms/images.md
CHANGED
|
@@ -107,7 +107,7 @@ img(src={hero} sizes="(min-width: 60rem) 50vw, 100vw" alt="The workshop")
|
|
|
107
107
|
- An image with any transparency, even a corner, gets no color (it would show through), nor do an SVG, an animated GIF, an AVIF from `assets.images.dirs` or `assets.images.remote`, a stored file whose key holds none (`files.url(key)`: `files.put` keeps the colour in the key of a still, opaque image, [Stored files](files.md)) or an image `assets.images.resolve` looks up, which may be private.
|
|
108
108
|
- The color stays behind the loaded image, hidden by it, so `object-fit: contain` shows it beside the picture; an image an island creates in the browser has none, and the server's is left as it is when the island hydrates.
|
|
109
109
|
- `placeholder={false}` on an `img` (`img(src={hero} placeholder={false} alt="")`, also after a spread, where it drops a `style` the spread brings as well), `image(src, { placeholder: false })` and an `img` with a `style` of its own, which is kept alone, leave the color out; `images: { placeholder: false }` in `kay.config.ts` does for every image, reading none for its color at build, and so does a site `security.csp` or `security.reportOnly` whose `style-src` (or `style-src-attr`) lacks `'unsafe-inline'`, as the browser would drop the attribute: a page's own `security` is not read for this.
|
|
110
|
-
- An `img` takes the options of its imported or stored image as attributes: `sizes`, `aspect`, `quality` and `placeholder={false}`, written beside its `src`, `img(src={hero} sizes="50vw" aspect="1/1" quality={90} alt="")`; none is written to the page.
|
|
110
|
+
- An `img` takes the options of its imported or stored image as attributes: `sizes`, `aspect`, `quality` and `placeholder={false}`, written beside its `src`, `img(src={hero} sizes="50vw" aspect="1/1" quality={90} alt="")`; none is written to the page. `no-placeholder` and `img({...image(hero, { aspect: '1/1' })})` of before 1.105 are no longer read.
|
|
111
111
|
- `image(src, options)` from `kay/image` gives the same props to spread, for an element that is no `img` or an image kay did not import, which an `img` leaves as it is and so needs its `width` and `height` given to `image()`: `img({...image(post.photo, { width: post.photoWidth, height: post.photoHeight, sizes: '100vw' })} alt="")`.
|
|
112
112
|
- `aspect="1/1"` on an `img` (`image(hero, { aspect: '1/1' })` for a spread) cuts the image to that shape, its middle kept, each variant cut on the server so a phone loads none of the pixels cut away, instead of CSS `object-fit: cover`: `width` and `height` are the largest box of that shape inside the image, and the variants stop at its width.
|
|
113
113
|
- The ratio is two whole numbers from 1 to 100, read in lowest terms.
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
| `signal-set-call` | deny | islands | A signal written `count.set(value)`, as a statement or an arrow's body, where assigning it, `count = value`, compiles to the same call; an updater written inline, `count.set(c => c * 2)`, and a `.set` whose value an expression uses are left. `--fix` assigns it. |
|
|
23
23
|
| `server-only-import` | deny | islands | `invalidatePage` or `sqliteCache` imported from `kay/cache` by an island's script, a browser-only component, a component only islands render, or a `.ts` module they import: the browser's `kay/cache` has `cached` and `invalidate` alone, so the build fails on the import. |
|
|
24
24
|
| `missing-captcha` | warn | forms | A call of `password.register`, `password.requestReset`, `magicLink.request` or `password.signIn` on a receiver named `*auth` with no `captcha` option, where neither the file nor a module's `authCore` sets `captcha: false`: kayjs-auth's default proof of work refuses it as `{ ok: false, error: 'captcha' }`. Pass `{ captcha: input.captcha }` from a form carrying `input(type="hidden" name="captcha" data-kay-work={await auth.captcha.challenge('register')})`. In `.kay` fences and `.ts` modules alike. |
|
|
25
|
-
| `island-marker` | deny | islands | An `island()` declaration
|
|
25
|
+
| `island-marker` | deny | islands | An `island()` declaration on a page, layout or special page, which are never islands. |
|
|
26
|
+
| `page-island` | deny | islands | A page without a `--- server` fence that needs the browser (an `on*`, `bind:` or `ref`, a browser value of `kay`, a live or persisted import), which a page never does: move it into a component the page renders. |
|
|
26
27
|
| `island-prop` | deny | islands | A component that is not an island passing one a value its type says cannot be sent: a function, a block with parameters, a symbol, an object holding one. `island()` is the fix, offered, never applied by `--fix`. Found by the type check. |
|
|
27
28
|
| `hydration-mismatch` | deny | islands | An island reading the clock, `Math.random()` or a `toLocale*String` or `Intl` format with no locale (or, for dates, no `timeZone`) while it renders, which the server and the browser compute apart; `// kay-allow hydration-mismatch` allows a deliberate read. |
|
|
28
29
|
| `unowned-effect` | warn | islands | `effect`, `watch`, `every`, `listen`, `debounced`, `throttled`, `onMount` or `onCleanup` called in a timer, a promise callback or after an `await`, where no owner stops them and each call lives until the page goes, or in an inline event handler or `listen` handler, where each event adds one stopped only when the component goes. Call them in the component script, or inside `root()`. Only inline handlers are seen: a named handler, a conditional handler and an `await` inside a loop are not. |
|
package/llms/island-sources.md
CHANGED
|
@@ -71,7 +71,7 @@ A hook is an option of the source and a method of the same name, takes one objec
|
|
|
71
71
|
|
|
72
72
|
`socket(chat, '/:room', { params, onData: ({ value }) => add(value), onError: ({ error }) => toast.error(error.message) })` takes them as options; `messages.onClose(({ status }) => ...)` adds one later.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Every source reads alike: `data()`, `status()`, `pending()`, `error()` and `retry()`, and `onData({ value })` and `onError`; a collection adds `sync.queued()` and `sync.status()`.
|
|
75
75
|
|
|
76
76
|
### kayjs-ui components
|
|
77
77
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
- A page's `--- server` fence, which loads its data before the render, reads a `persisted.cookie()` signal by calling it: `open()` there is the request's value, decoded and checked against `values` as the render does, the default when the cookie is missing or refused, so the fence needs no `ctx.cookies` and no knowledge of the cookie's encoding. The page then answers with `Vary: Cookie`.
|
|
16
16
|
- A page `kay build` prerendered renders a `persisted` signal's default, in its server fence too, and the island corrects it as it hydrates.
|
|
17
17
|
- The cookie is named as it is given, so it never reuses the name of a cookie the app sets itself.
|
|
18
|
-
- `persisted` has one entry per storage, `persisted.cookie()`, `persisted.local()` and `persisted.session()`, each taking the options its storage can use, and a call always names its storage:
|
|
19
|
-
- A query param is not persisted but `queryParam`, below
|
|
18
|
+
- `persisted` has one entry per storage, `persisted.cookie()`, `persisted.local()` and `persisted.session()`, each taking the options its storage can use, and a call always names its storage: there is no bare `persisted(name, value)`.
|
|
19
|
+
- A query param is not persisted but `queryParam`, below.
|
|
20
20
|
- `queryParam<number>('page')` from `kay` is a signal holding one query param of the page, read as the page's `query` schema reads `ctx.query` (see routing): a number, a boolean, one of an enum, a list from a repeated param, the schema's `default` when the param is left out.
|
|
21
21
|
- The server writes the schema's rules for its params into the page, which the island reads them by, so an island works on any page and Elysia's `t` never reaches the browser; the server renders the same value from the first paint.
|
|
22
22
|
- A value the rules refuse reads as the default rather than throwing.
|
package/llms/islands.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Islands
|
|
2
2
|
|
|
3
|
-
A component is an island when its own code needs the browser: an `on*`, `bind:` or `ref` in its template, a browser value of `kay` in its script (a `live` or `persisted` value a module exports included, whether the component imports it from that module, from one re-exporting it or from one importing it and handing it on; a component with a `--- server` fence stays on the server; a function of that module reading the value inside does not count, only the value itself being imported), or an `island()` declaration (`island({ render: 'client' })` for one that renders in the browser only); what an island renders is part of it, and nothing a component passes makes it one. It is decided at compile time, from the file and its imports. A page of the routes directory should never be one: a handler, a `bind:`, a `ref`, a signal or a live or persisted import in a page without a `--- server` fence
|
|
3
|
+
A component is an island when its own code needs the browser: an `on*`, `bind:` or `ref` in its template, a browser value of `kay` in its script (a `live` or `persisted` value a module exports included, whether the component imports it from that module, from one re-exporting it or from one importing it and handing it on; a component with a `--- server` fence stays on the server; a function of that module reading the value inside does not count, only the value itself being imported), or an `island()` declaration (`island({ render: 'client' })` for one that renders in the browser only); what an island renders is part of it, and nothing a component passes makes it one. It is decided at compile time, from the file and its imports. A page of the routes directory should never be one: a handler, a `bind:`, a `ref`, a signal or a live or persisted import in a page without a `--- server` fence is the `kay check` error `page-island`. Move what needs the browser into a component of its own that the page renders.
|
|
4
4
|
|
|
5
5
|
## Common tasks
|
|
6
6
|
|
|
@@ -64,6 +64,8 @@ const q = queryParam('q', { default: '' })
|
|
|
64
64
|
input(type="search" bind:value={q} aria-label="Search")
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
A link or a component navigating to the same path with another query (`a(href="?tab=b")`, `Segmented(param="range")`), Back and Forward all reach every `queryParam` signal, one shared by islands included, whether its island is rendered on the server or in the browser.
|
|
68
|
+
|
|
67
69
|
### Hydrate an island later
|
|
68
70
|
|
|
69
71
|
`hydrate="visible"` waits until it scrolls near the viewport, `hydrate="idle"` until the browser is idle, `hydrate="interaction"` until the first pointer, focus, key or touch event inside it, and `hydrate="media(max-width: 40rem)"` until the media query matches, at once when it does and later when it starts to:
|
|
@@ -88,7 +90,7 @@ const { label } = props<{ label: string }>()
|
|
|
88
90
|
button {label}
|
|
89
91
|
```
|
|
90
92
|
|
|
91
|
-
`island()` alone says the component is an island though nothing in it needs the browser, and `render` says how it renders: `'island'` (the default), `'client'` for one that renders in the browser only (`island({ render: 'client' })`, see [Browser-only code](browser-only.md)), `'static'` to hold it to staying no island, so anything in it that needs the browser is the compile error `static-pin`.
|
|
93
|
+
`island()` alone says the component is an island though nothing in it needs the browser, and `render` says how it renders: `'island'` (the default), `'client'` for one that renders in the browser only (`island({ render: 'client' })`, see [Browser-only code](browser-only.md)), `'static'` to hold it to staying no island, so anything in it that needs the browser is the compile error `static-pin`. A `--- island`, `--- client` or `--- static` fence line is an unknown fence, and a `--- module` fence exports no `island`.
|
|
92
94
|
|
|
93
95
|
A component can also list the props that make a use of it an island: `island({ interactive: { selectable: false, pageSize: false } })`, each prop with whether it is on when a use leaves it out. A page or a server component whose use turns none of them on, passes no function, no promise and nothing `island` could not send, and writes no `hydrate` or `persist`, gets the component as plain markup: no island, and no script for the page when nothing else on it needs one. Its children and blocks render in the page as an island's do, and an island inside it stays an island of its own. A use inside another island is part of that island as before, and the props the use is given decide, so a spread counts. A route that is not prerendered still counts the island in `kay build`'s size estimate, an upper bound. `kay explain island` lists the props.
|
|
94
96
|
|
|
@@ -278,7 +280,7 @@ if !connected()
|
|
|
278
280
|
|
|
279
281
|
### The action caller
|
|
280
282
|
|
|
281
|
-
- The code that
|
|
283
|
+
- The code that runs an action call (its queue, timeout and retries, the post and its answer) loads with the first call, so an island that only declares or passes an action does not carry it; the action's own state (`pending()`, `data()`, `status()`, `error()`) is there from the first paint, and a call counts as pending at once, before that code is in, its `onStart` hook running when it is. A call whose code never loads rejects without running its hooks. An island holding an action caller loads it at idle, so a call made as the page goes away finds it in; a chunk a deploy dropped reloads the page as other chunks do.
|
|
282
284
|
|
|
283
285
|
### Components that load when they first draw
|
|
284
286
|
|
package/llms/lints.md
CHANGED
|
@@ -71,7 +71,7 @@ kay check --only seo
|
|
|
71
71
|
- A problem prints as `error[missing-alt]: An \`img\` needs \`alt\``, then ` --> src/routes/index.kay:4:3`, the lines at fault with the span underlined and the other places involved labelled, then `= note:` saying why when the message does not, and `= help:` saying what to write.
|
|
72
72
|
- A name in brackets is a lint's, and the project sets its level: `deny` reports it as an error, `warn` as a warning, and `allow` not at all.
|
|
73
73
|
- `kay check` prints warnings beside the errors and counts them apart, failing on them only with `--deny-warnings`, which the `check` script `kay new` writes leaves out; `kay build` and `kay dev` never fail on one.
|
|
74
|
-
- Lints are found while type checking, so a page with one still runs. A lint at `deny`, as `brace-in-attribute` and `
|
|
74
|
+
- Lints are found while type checking, so a page with one still runs. A lint at `deny`, as `brace-in-attribute` and `signal-set-call` are, fails `kay check` and `kay build`, which checks first; `kay build --no-check` skips it.
|
|
75
75
|
- Beside each open file's problems, the editor runs what `kay check` finds across the project after a save or a change on disk, never on a keystroke: the config, the collections' entries, the locales' messages, what the server refuses when it boots, the settings libraries take and what guards, API modules and matchers export, each shown at its file.
|
|
76
76
|
- `lints` in `kay.config.ts` sets levels over the defaults: `defineConfig({ lints: { 'positional-key': 'deny', 'unread-name': 'warn' } })`.
|
|
77
77
|
- Each lint is in a group, `code`, `a11y`, `forms`, `islands`, `performance`, `seo`, `security`, `i18n` or `deprecated`, and `lints` takes a group's level for every lint in it, a lint's own level winning.
|