@kayjs/kay 1.109.0 → 1.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/eslint.js +332 -52
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/actions-from-islands.md +1 -1
  4. package/llms/components.md +1 -1
  5. package/llms/deprecated-lints.md +1 -1
  6. package/llms/island-and-form-lints.md +2 -1
  7. package/llms/islands.md +4 -2
  8. package/llms/live-values.md +1 -1
  9. package/llms/navigation-from-code.md +1 -1
  10. package/llms/navigation.md +4 -2
  11. package/llms/templates-elements-slots-snippets.md +2 -2
  12. package/llms/upgrading-archive.md +31 -1
  13. package/llms/upgrading.md +26 -32
  14. package/llms/whats-new.md +15 -0
  15. package/llms.txt +1 -1
  16. package/package.json +6 -6
  17. package/src/build/variants.ts +132 -18
  18. package/src/check/env-types.ts +1 -1
  19. package/src/check/project.ts +4 -0
  20. package/src/check/schema-builders.ts +125 -26
  21. package/src/commands/upgrade.ts +2 -1
  22. package/src/compiler/allow-comments.ts +38 -2
  23. package/src/compiler/ast.ts +4 -4
  24. package/src/compiler/codegen.ts +3 -3
  25. package/src/compiler/deprecated-lints-1-106.ts +2 -2
  26. package/src/compiler/hand-parts.ts +36 -8
  27. package/src/compiler/helper-imports.ts +2 -2
  28. package/src/compiler/index.ts +4 -3
  29. package/src/compiler/island-arguments.ts +9 -0
  30. package/src/compiler/island-lints.ts +7 -0
  31. package/src/compiler/items.ts +12 -0
  32. package/src/compiler/jsx.ts +5 -4
  33. package/src/compiler/lints.ts +5 -6
  34. package/src/compiler/markup.ts +16 -21
  35. package/src/compiler/names.ts +1 -1
  36. package/src/compiler/removed-lints.ts +90 -0
  37. package/src/compiler/signal-from-prop.ts +141 -0
  38. package/src/compiler/template-reads.ts +16 -0
  39. package/src/runtime/checks.ts +14 -2
  40. package/src/runtime/client.ts +5 -9
  41. package/src/runtime/dom.ts +1 -1
  42. package/src/runtime/html.ts +1 -1
  43. package/src/runtime/image.ts +2 -19
  44. package/src/runtime/index.ts +1 -1
  45. package/src/runtime/island.server.ts +40 -10
  46. package/src/runtime/navigate.ts +9 -0
  47. package/src/runtime/navigation.ts +5 -1
  48. package/src/runtime/page-swap.ts +2 -2
  49. package/src/runtime/swap-flight.ts +10 -10
  50. package/src/runtime/swap-kept.ts +69 -29
  51. package/src/runtime/swap-morph.ts +49 -9
  52. package/src/runtime/text-hash.ts +17 -0
  53. package/src/runtime/uid.server.ts +6 -4
  54. package/src/runtime/values.ts +12 -0
  55. package/src/server/render-document.ts +8 -6
  56. package/src/server/render.ts +1 -1
  57. package/types/build/variants.d.ts +9 -1
  58. package/types/build/variants.d.ts.map +1 -1
  59. package/types/check/project.d.ts.map +1 -1
  60. package/types/check/schema-builders.d.ts.map +1 -1
  61. package/types/commands/upgrade.d.ts.map +1 -1
  62. package/types/compiler/allow-comments.d.ts +2 -0
  63. package/types/compiler/allow-comments.d.ts.map +1 -1
  64. package/types/compiler/ast.d.ts +1 -1
  65. package/types/compiler/ast.d.ts.map +1 -1
  66. package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
  67. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
  68. package/types/compiler/deprecated-lints.d.ts +2 -2
  69. package/types/compiler/hand-parts.d.ts +6 -3
  70. package/types/compiler/hand-parts.d.ts.map +1 -1
  71. package/types/compiler/index.d.ts.map +1 -1
  72. package/types/compiler/island-arguments.d.ts +5 -0
  73. package/types/compiler/island-arguments.d.ts.map +1 -1
  74. package/types/compiler/island-lints.d.ts +7 -0
  75. package/types/compiler/island-lints.d.ts.map +1 -1
  76. package/types/compiler/items.d.ts +1 -0
  77. package/types/compiler/items.d.ts.map +1 -1
  78. package/types/compiler/jsx.d.ts.map +1 -1
  79. package/types/compiler/lints.d.ts +11 -4
  80. package/types/compiler/lints.d.ts.map +1 -1
  81. package/types/compiler/markup.d.ts +1 -1
  82. package/types/compiler/markup.d.ts.map +1 -1
  83. package/types/compiler/names.d.ts.map +1 -1
  84. package/types/compiler/removed-lints.d.ts +3 -0
  85. package/types/compiler/removed-lints.d.ts.map +1 -0
  86. package/types/compiler/signal-from-prop.d.ts +4 -0
  87. package/types/compiler/signal-from-prop.d.ts.map +1 -0
  88. package/types/compiler/template-reads.d.ts +1 -0
  89. package/types/compiler/template-reads.d.ts.map +1 -1
  90. package/types/runtime/checks.d.ts +8 -2
  91. package/types/runtime/checks.d.ts.map +1 -1
  92. package/types/runtime/client.d.ts.map +1 -1
  93. package/types/runtime/dom.d.ts +1 -1
  94. package/types/runtime/dom.d.ts.map +1 -1
  95. package/types/runtime/html.d.ts +1 -1
  96. package/types/runtime/html.d.ts.map +1 -1
  97. package/types/runtime/image.d.ts.map +1 -1
  98. package/types/runtime/index.d.ts +1 -1
  99. package/types/runtime/index.d.ts.map +1 -1
  100. package/types/runtime/island.server.d.ts +1 -0
  101. package/types/runtime/island.server.d.ts.map +1 -1
  102. package/types/runtime/navigate.d.ts.map +1 -1
  103. package/types/runtime/navigation.d.ts +2 -0
  104. package/types/runtime/navigation.d.ts.map +1 -1
  105. package/types/runtime/swap-flight.d.ts +1 -1
  106. package/types/runtime/swap-flight.d.ts.map +1 -1
  107. package/types/runtime/swap-kept.d.ts.map +1 -1
  108. package/types/runtime/swap-morph.d.ts.map +1 -1
  109. package/types/runtime/text-hash.d.ts +2 -0
  110. package/types/runtime/text-hash.d.ts.map +1 -0
  111. package/types/runtime/uid.server.d.ts.map +1 -1
  112. package/types/runtime/values.d.ts +4 -0
  113. package/types/runtime/values.d.ts.map +1 -1
  114. package/types/server/render-document.d.ts +1 -1
  115. package/types/server/render-document.d.ts.map +1 -1
@@ -119,7 +119,7 @@ p {column()}
119
119
 
120
120
  - An island imports the action from the page and calls it, as in [Call an action from an island](#call-an-action-from-an-island): `const { ok, data, error } = await add({ title })`, or `const id = await add({ title }).orThrow()` to throw the failure.
121
121
  - An optional field (`optional: true`) takes `undefined` as the field left out, `exactOptionalPropertyTypes` or not: `resize({ file, width: max ?? undefined })`. A wrong field is reported at that field, not against the `FormData` form of the call.
122
- - Once a call went through, the page shows what it changed, its loads run again as `refresh()` runs them, where the page swap runs: islands whose props did not change keep their state. A page with `liveRefresh: true` in its [settings](routing.md#page-settings) is left alone when every cached key the handler invalidated (`cached(..., { live: true })`) is one the page or a `resource()` follows: its live connection, once open, shows them a moment after the answer (`x-kay-invalidated` names the keys on the answer; a streaming action's end event names them, as it goes on invalidating until the stream ends). One key not followed, more than 20 keys or a connection that is down load the page as before, and `refresh: true` always does.
122
+ - Once a call went through, the page shows what it changed, its loads run again as `refresh()` runs them, where the page swap runs: every island stays with its state and takes its new props in place, and what the visitor typed in a static field or opened in a `details` stays unless the server changed it ([navigation](navigation.md#islands-kept-across-pages)). A page with `liveRefresh: true` in its [settings](routing.md#page-settings) is left alone when every cached key the handler invalidated (`cached(..., { live: true })`) is one the page or a `resource()` follows: its live connection, once open, shows them a moment after the answer (`x-kay-invalidated` names the keys on the answer; a streaming action's end event names them, as it goes on invalidating until the stream ends). One key not followed, more than 20 keys or a connection that is down load the page as before, and `refresh: true` always does.
123
123
  - `add({ title }, { refresh: false })` leaves the page as it is, so a frequent write from an island (a vote, an undo) needs no API route to avoid the refresh; `add` answers a refusal as a result, as `await add(input, { refresh: false })` does.
124
124
  - `await add.settled()` resolves once no call to `add` is in flight, whichever way they went (a stream counts until it ends; it never rejects), so an island that fired writes without awaiting them waits for them there; `save.settled()` does the same for the calls made through a `track()` handle.
125
125
  - `add.pending()` reads, reactively, whether a call the page made is still in flight, and `add.progress()` how much of a call carrying files the browser sent, from 0 to 1: `button(disabled={add.pending()})`.
@@ -221,7 +221,7 @@ p {game.miners[0].ore}
221
221
  - `linked(() => board.tiers)` from `kay` is a writable signal that follows its source: an island edits it locally, and it takes its source's value again whenever that changes: `tiers = moved` shows the edit, and once a refresh or the next page gives a new `board`, `tiers()` reads its tiers.
222
222
  - A `linked` signal drops its edit when its source changes, even when the source comes back to the value it was edited over.
223
223
  - `linked` reads a prop of a component inside an island, or of an island marked `persist`, the ones whose props change in place, a prop given unchanged keeping its edit.
224
- - A top-level island whose props changed on a refresh renders afresh from them, its dialogs and focus lost: one whose state should outlive a refresh, such as an editor, is marked `persist`, so it stays and takes the new props.
224
+ - An island stays on a refresh and takes the new props in place, its dialogs, focus and signals kept: what it reads from `props` in its template or an effect follows them, a `signal(light)` seeded from a prop keeps the first value, and `linked(() => light)` is the form that follows. A list whose items move is kept by `persist={id}`.
225
225
  - `selection<Key>(initial?)` from `kay` holds one selected string or number key among many rows, or none. It is a signal: it reads as `selected()` and writes as `selected = id`.
226
226
  - `selected.is(row.id)` re-runs only for the rows a change selects or unselects, not every row: `tr(class={{ danger: selected.is(row.id) }})`.
227
227
 
@@ -13,5 +13,5 @@ The lints of the `deprecated` group, each the old form a minor replaced, reporte
13
13
  | Lint | Default | Group | Reports |
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
- | `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. |
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 a `defineEnv` is the record of fields alone, as an env reads only the names it declares; 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, and keeps what each did: an `s.Array` takes `max: Number.MAX_SAFE_INTEGER` (the lowercase list stops at 1,000 items) and an `s.Object` `extra: 'strip'`, a rewrite whose options are not an object literal being reported without a fix; an `s.Union` of `Object.keys(R).map(key => s.Literal(key))` is `s.enum(R)`, and any other `s.Union` of a mapped array is reported without a fix; 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, so the fix writes `{ extra: 'strip' }`. 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
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. |
@@ -20,10 +20,11 @@
20
20
  | `uncalled-signal` | deny | islands | A signal or memo the template names without calling it where its value goes, `{count}` or `if count > 1`: a signal is read by calling it, in the template as in the script, `{count()}`. Handed on whole, as a component prop or a function argument, it passes the signal itself, which a parameter typed `Signal<T>`, `Memo<T>`, a function type or a generic `T` takes; one typed `unknown` or `any` is reported too, `String(count)`. `--fix` calls the signal named where its value goes. |
21
21
  | `constant-signal` | deny | islands | A signal the component script declares and only ever reads: it never changes, so a plain `const` renders the same without the reactivity. |
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
+ | `signal-from-prop` | warn | islands | A `signal` seeded from a destructured prop at the top of an island's script, `signal(light)` or `signal(todo.title)` that the island never writes: the island stays when the page gives it new props, as after an action or a refresh, so the signal keeps the first value. `linked(() => light)` follows the prop; `--fix` writes it, adding `linked` to the `kay` import. A signal the island writes (a counter starting from a prop) is its own state and is left alone, as is a prop named `initial...` or `default...`. |
23
24
  | `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
25
  | `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
26
  | `island-marker` | deny | islands | An `island()` declaration on a page, layout or special page, which are never islands. |
26
27
  | `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. |
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. |
28
+ | `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. A function or a block with parameters is no error for an island that lists `interactive` props when the use writes none of them. `island()` is the fix, offered, never applied by `--fix`. Found by the type check. |
28
29
  | `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. |
29
30
  | `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/islands.md CHANGED
@@ -92,7 +92,7 @@ button {label}
92
92
 
93
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`.
94
94
 
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.
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 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. A function it is handed, a block taking parameters among them, is called by the server and is no `island-prop` while the use writes none of the listed props, `hydrate`, `persist` or `render` (a spread, or a function inside an object or array, still is). 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.
96
96
 
97
97
  ### Animate an element in and out
98
98
 
@@ -247,7 +247,7 @@ if !connected()
247
247
  - A button opens a popover or a dialog with no handler, so the component stays static: `button(popovertarget="menu")` toggles `ul#menu(popover)`, and `button(commandfor="settings" command="show-modal")` opens `dialog#settings`. `command` is `show-modal`, `close`, `request-close`, `show-popover`, `hide-popover`, `toggle-popover` or a `--custom` name the target hears as a `command` event, and `kay check` types it. `popovertarget` needs Chrome and Edge 114, Firefox 125, Safari 17; `commandfor` and `command` Chrome and Edge 135, Firefox 144, Safari 26.2, past the floor below, so an app keeping older browsers uses `popovertarget` or an `onClick`.
248
248
  - kay's browser code runs on Chrome and Edge 98, Firefox 104 and Safari 16.4 or later; kayjs-ui's popovers, tooltips, toasts and site nav menu need the Popover API, Chrome and Edge 114, Firefox 125, Safari 17, and its popovers, tooltips and site nav lists sit beside their trigger through CSS anchor positioning, Chrome and Edge 129, Firefox 147, Safari 26, so an older browser opens them away from their trigger; its colours use `light-dark()` and its carousel `inert`, which every browser with anchor positioning has. Bun bundles an island's code as written, newer syntax and APIs included, so an app keeping those browsers stays off what they lack, such as `Map.groupBy` or `Promise.withResolvers`.
249
249
  - `kay build` lists each island under its JavaScript with what makes it one, the first `on*`, `bind:`, `ref`, value from `kay` or `island()` declaration as `onClick, line 4`; `--format json` gives them as `why` and `cause` (`kind`, `name`, `line`) on each island of `built.sizes.islands` (a route's `islands` under `built.routes` only lists their files); `why` stays for tools reading it and `cause` is the data. `kay explain island <file>` says a component's role and cause and the rule, and `kay explain island` lists every island of the project (`--format json` for both).
250
- - `kay check` reads from the types what a static component hands an island, not from how the call looks: a value typed as a function, a symbol, a class instance or an object holding one (a `Column` with a `sortValue` function), or a block with parameters, is the error `island-prop` at the prop, and a value that is data says nothing, an action, a Date, a list a `map` built, a call returning a string, nor does one typed `any` or `unknown`. `island()` first in the component's script is the fix: `kay check --fix` writes it where the value is always a function, and only offers it where the type is a union holding one, as the component may be static on some pages. A page, layout or special page is never an island, so it passes the island data or goes through a component of its own. Rendering throws an `IslandPropsError` naming the prop and the same fix, as no component is made an island for what it passes. `island({ render: 'static' })` pins the other way: anything that makes the component an island is the compile error `static-pin`, standing at the `on*`, import or call that does it, and a function it hands an island is `island-prop`. A pin on a page, layout or special page is `island-marker`, as they are never islands, and a static pin on one says nothing. A `// kay-island` or `// kay-static` comment pins nothing: the declaration does. The editor shows a lens on a component's first line saying whether it is an island and why, and a click on it reveals the `on*`, import or declaration that decides it; under `kay dev` the Islands tab of the dev tool shows the same cause on each island, from a `data-why` attribute on its slot that a production build never writes.
250
+ - `kay check` reads from the types what a static component hands an island, not from how the call looks: a value typed as a function, a symbol, a class instance or an object holding one (a `Column` with a `sortValue` function), or a block with parameters, is the error `island-prop` at the prop (a function or a block with parameters is no error for an island listing `interactive` props, when the use writes none of them), and a value that is data says nothing, an action, a Date, a list a `map` built, a call returning a string, nor does one typed `any` or `unknown`. `island()` first in the component's script is the fix: `kay check --fix` writes it where the value is always a function, and only offers it where the type is a union holding one, as the component may be static on some pages. A page, layout or special page is never an island, so it passes the island data or goes through a component of its own. Rendering throws an `IslandPropsError` naming the prop and the same fix, as no component is made an island for what it passes. `island({ render: 'static' })` pins the other way: anything that makes the component an island is the compile error `static-pin`, standing at the `on*`, import or call that does it, and a function it hands an island is `island-prop`. A pin on a page, layout or special page is `island-marker`, as they are never islands, and a static pin on one says nothing. A `// kay-island` or `// kay-static` comment pins nothing: the declaration does. The editor shows a lens on a component's first line saying whether it is an island and why, and a click on it reveals the `on*`, import or declaration that decides it; under `kay dev` the Islands tab of the dev tool shows the same cause on each island, from a `data-why` attribute on its slot that a production build never writes.
251
251
  - A component the server renders per request inside an otherwise prerendered page, such as a form carrying a fresh token, is a server island instead: see [Server islands](server-islands.md#server-islands).
252
252
 
253
253
  ### Props to an island
@@ -291,4 +291,6 @@ if !connected()
291
291
  - A name inside a string or a whole-line comment of the file is no use of the component: only a tag or other code naming it keeps its import eager (a Table's `'Select all'` once kept its Select in every island). kayjs-ui's `Form`, `FormDialog` and `SaveForm` load the code that sends and reports a form (`forms-send`, with the toast it reports through) with the first send or blur check, tried once more when the chunk fails, so a page with a closed form-dialog does not carry it.
292
292
  - `kay/dom-lazy` is the compiler's output contract for it, not API. `kay build --analyze` lists the modules of every island, a lazy component's apart from the eager ones.
293
293
 
294
+ A refresh, or a visit keeping its layout, keeps an island and gives it the new props in place; seed from a prop with `linked(() => prop)` ([Navigation](navigation.md#islands-kept-across-pages)).
295
+
294
296
  Shared and persisted state, transitions, error fallbacks, element size, context and unique ids are in [Islands: state to unique ids](islands-state-to-ids.md).
@@ -105,7 +105,7 @@ On an `api()` chain only, a message failing `body` is answered `{ error: { key,
105
105
  ### Following cached values
106
106
 
107
107
  - `cached(key, ttl, load, { live: true })` makes every page that read the key in its render follow it: once `invalidate` drops the key, a key its `load` read (a collection, another `cached`) or a `cache()` tag it names (also when the process no longer holds the value), each open tab shows the page as its loads give it now, with no island, route or socket written. Read it in the page's or a layout's server fence; a read after the document went out (an `await` block's) or in an API route is not followed.
108
- - The server pushes no value, only that the key changed: the tab runs `refresh()`, so the page is rendered again for that visitor, and a guard, a per-visitor branch, the locale and `base` apply as for any visit. A `persist` island is given the new props and keeps its state; any other island whose props changed hydrates afresh, as after an action.
108
+ - The server pushes no value, only that the key changed: the tab runs `refresh()`, so the page is rendered again for that visitor, and a guard, a per-visitor branch, the locale and `base` apply as for any visit. An island is given the new props and keeps its state, as after an action.
109
109
  - The page carries its `data-kay-live` script with `[kay:cache, key, readAt]` per followed key, covered by the same signed proof, and the entry script loads the `live-cache` chunk only then. `POST /_kay/live` first sends the time each key was last invalidated (0 when never), then one event per invalidation, as often as it happens; a tab refreshes when that time is at or after its page's read, both from the server's clock, so an invalidation between render and connect, or during a dropped connection, is not missed. A page reading no such key opens no connection and loads no code for it.
110
110
  - A refresh waits a random 0 to 750 ms so tabs do not render together, waits while the tab is hidden and runs once it is shown, and one in flight absorbs the events meanwhile. A dropped connection reconnects with a growing delay, from half a second, not while the tab is hidden or the browser offline; a 403 (a proof an hour old, a restart without `KAY_SECRET`, or any followed key whose proof is out of date) refreshes the page and every followed route for new ones. With `navigation: false` the page reloads instead, unless a `guardLeave` holds changes.
111
111
  - Several processes sharing a `sqliteCache`, the one `store: sqliteData(path)` gives included, or the Postgres one of `pgData(db)` ([Jobs](queues.md)), follow each other's `invalidate` (heard within about half a second, up to 5 seconds on a server idle for a few seconds with no tab watching a value: the poll slows while it hears nothing and returns to full pace on a write, a use of the store or while a tab watches; a live store while no `live()` value is declared, and a Postgres cache nothing has used, are not polled); with no shared store a process hears its own only. A key expiring by `ttl` refreshes in the background without telling tabs: only `invalidate` pushes.
@@ -47,7 +47,7 @@ const dispose = mount(Panel, document.querySelector('#panel')!, { title: 'Ticket
47
47
  - `navigate('/todos/1')`, imported from `kay`, goes to a page as a link would (the mount point and the current locale's prefix put on as on any `href`, `/todos/1` on a French page going to `/fr/todos/1`, a path already prefixed or another site's URL left as written; a module that gets `navigate` through a dynamic `import('kay')` is not covered, so import it statically), `{ replace: true }` taking the current history entry's place, `{ scroll: 'keep' }` leaving the window scrolled where it is instead of going to the top, `{ transition: false }` swapping without a view transition; another site's page loads, so a `?next=` param goes through `localPath()` as a redirect's does, and a `javascript:` URL throws, as it would run in the page; `mailto:`, `tel:` and other schemes go to the browser as a link would. A link or `navigate()` that a redirect takes to another site loads that page fully rather than swapping it in.
48
48
  - `navigate.query({ sort: 'name', page: null })` goes to the current page with those params set (a list sets one param once per item, `{ tag: ['a', 'b'] }` giving `?tag=a&tag=b`) and a null, undefined or empty one dropped, the others and the path kept and the hash left out, keeping the scroll and the focus as `refresh()` does: a filter or a sort picked in place. It takes the options of `navigate()` and resolves as it does. A query that is state of the page, not a one-off change, is a `queryParam` signal ([state](islands-state-to-ids.md#shared-and-persisted-state)).
49
49
  - `withQuery({ page: 2, sort: null })` from `kay`, in a server fence, a template or an island (where it follows the address, so the link is built again after each `navigate.query()`, swap, Back and `queryParam` write), returns the path of the current page with those params set by the rule of `navigate.query()`, the other params kept and the hash left out, to link to it with one filter changed: `a(href={withQuery({ page: 2 })}) Next`. The path is the site's own, so `base`, `trailingSlash` and the locale prefix are put on by the link as on any `href`; in a fence it reads the request, so it throws in a page rendered once at build time.
50
- - `refresh()` from `kay` runs the current page's loads again and shows what they return, keeping the scroll, the focus and every island whose props did not change, as a call to an action does by itself once it went through.
50
+ - `refresh()` from `kay` runs the current page's loads again and shows what they return, keeping the scroll, the focus, every island (kept with its state and given its new props, [navigation](navigation.md#islands-kept-across-pages)), a field the visitor typed in and a `details` the visitor toggled, as a call to an action does by itself once it went through.
51
51
  - `refresh('cart')` or `refresh(['cart', 'user'])` sends and swaps only the elements of the page reading the loads of its fence that bind those names, and leaves the rest of the page as it is: [rendering](rendering.md#refreshing-some-loads).
52
52
  - An island calls `refresh()` once something else changed what the page shows, or polls with it, `every('3s', refresh, { while: () => issuing })`.
53
53
  - A `refresh()`, including the one an action's call or a live value ends in, never cancels a link, `navigate()` or Back in flight: it waits for the swap, then runs again only when the swap left the URL it was asked for, since the new page is as recent as its answer. An island polling an action needs no `{ refresh: false }` to keep links working.
@@ -63,7 +63,8 @@ A handler of your own on Enter in a text field starts with `if (composing(event)
63
63
  - The body is morphed rather than replaced: an element the next page renders again, in the same place with the same tag, `id` and `class`, stays the same element and takes the next page's attributes and children, so a layout's sidebar keeps where it was scrolled to and its links' `aria-current` moves, with nothing to mark.
64
64
  - A form field shows the value the next page renders, as on a page loaded afresh, and a popover or a dialog left open closes.
65
65
  - The element holding the new page's `h1`, such as a main column scrolling on its own, goes back to the top as the window does.
66
- - Islands are never morphed: one is kept only when marked `persist` or, on a refresh, unchanged; every other one is ended and the next page's hydrates afresh.
66
+ - Islands are never morphed: one is kept when it has its match in the next page, and takes that page's props in place (below); every other one is ended and the next page's hydrates afresh.
67
+ - The rule of every swap is to apply what the server changed and keep what the visitor changed. On a refresh (an action's, `refresh()`, a live value's) a field whose value the server's render left as it was keeps what was typed in it, in production as in `kay dev`, and a `details` the visitor toggled keeps its state, whatever the server renders for it again; a value the server changed takes the new one. A visit or a redirect to another page, and a form refused, show the next page's own.
67
68
  - Outside the body's content, one rule holds for the head's elements, the attributes of `<html>` and those of `<body>`: what the server served changes as the next page serves it, and what a script changed or added since stays as the script left it. A theme toggle's `meta[name="theme-color"]`, a tag a loader added to the head and a class a script put on `<body>` live on through every swap, a meta a script changed or added standing in for the next page's meta of that name and media, while a head tag the page left served alone goes with it. The server writes `<body>` bare, so its attributes are always a script's. A change an inline head script makes before kay's script runs counts as served. A served head tag a script removed comes back with the next page serving it, and a `<style>` an island injects itself outlives the island.
68
69
  - An element a script put in `<body>` goes with the next swap, as the next page never renders it; marked `data-kay-keep`, a direct child of `<body>` lives on through every swap, the same element left where it is, never moved, such as a live region an announcer fills: kayjs-ui's `announce()` marks its own. A server-rendered element takes no `data-kay-keep`, as the next page renders it again.
69
70
  - A swap fires `kay:navigate` on `document` once the new page is in place and its islands are hydrating, with `event.detail.url` the page's address, so a plain script (an analytics tag, a lightbox) can set itself up again; a full load fires none. `kay:navigate-start` and `kay:navigate-error` come before it, and `navigation` and `onBeforeNavigate` follow it from an island: [navigation state and hooks](navigation-from-code.md#navigation-state-and-hooks).
@@ -81,12 +82,13 @@ A handler of your own on Enter in a text field starts with `if (composing(event)
81
82
  ### Islands kept across pages
82
83
 
83
84
  - An island marked `persist` lives on from page to page, its state and its element kept, when the next page renders it too: `Player(persist)` in a layout keeps a song playing.
85
+ - An island without `persist` is kept too when the next page renders the same component in the same place, its state staying and its props given in place: on a refresh any island is paired so, by component and its `key` or `id` prop when it has a string or number one, else by order among the islands of that component, so give a list of islands an `id` or a `persist` (an island marked `persist` by its key first); on a visit, a query change, Back or a redirect only the islands a layout renders are, by layout, component and order, so a sidebar's folded group or a menu stays as it was while a page's own islands are ended. An island whose static slots changed, or with no match, is ended, and a list whose items move is kept by `persist={id}`, which also changes the island by changing it. A call or a `refresh()` has `refresh: false` to leave the page alone.
84
86
  - A browser with `Element.moveBefore` (Chrome 133, Firefox 144) moves it in place, so an iframe in it stays loaded, a video keeps playing and the focus stays in it; elsewhere it is taken out and put back, and the swap gives the focus and the selection back; a popover open in it closes either way. The scroll of every element inside it, nested ones and horizontal scroll too, is kept either way.
85
87
  - `persist` takes a static or a dynamic value, a string computed from props or state (`Graph(persist={`${repo}:${scope}`})`): another value is another island, ended and hydrated afresh, while the same value keeps it.
86
88
  - A bare `persist` matches the same component on the next page; `persist="left"` names one use, for two uses of a component to be told apart.
87
89
  - Only an island takes `persist`, and only from a static parent.
88
90
  - The props the next page gives a kept island reach it as a component inside an island gets new props: what reads them in the template or an effect shows the new values, while a value the script computed from them once keeps the old one.
89
- - The element focused inside an island a swap keeps, marked `persist` or unchanged on a refresh, stays focused, a text field, `textarea` or `contenteditable` with its caret and selection, so a field whose every key shows a draft or refreshes the page keeps taking the keys.
91
+ - The element focused inside an island a swap keeps, stays focused, a text field, `textarea` or `contenteditable` with its caret and selection, so a field whose every key shows a draft or refreshes the page keeps taking the keys.
90
92
  - A text field or `textarea` the swap replaces on a query `navigate()`, a refresh or a redirect, such as a field of an island hydrated afresh for its new `value` prop, gets the focus back with the caret and selection of the old one (kept within the new text, at its end when the caret was at the end), so a search as you type keeps taking the keys; on a query `navigate()` or a refresh, keys typed in it while the page was fetched are kept, and its `input` event fires again so the island asks for them.
91
93
  - The focused element a swap keeps holds on to the `tabindex` a script gave it when the next page's markup has none, until the focus leaves it, as the browser would otherwise move the focus to the body: a heading the swap focused, or a kayjs-cms title whose inline edit just ended, stays focused through a refresh or a draft's render.
92
94
  - A swap to a new page still moves the focus to its heading.
@@ -100,7 +100,7 @@ Card(title="Todos")
100
100
 
101
101
  A prop taking markup is typed `Snippet` from `kay`: `Snippet` for the children and a block with no parameters, `Snippet<[Item, number]>` for markup the component calls with values, once per row for instance. `@name(a, b)`, a local `snippet` passed as `name={feature}` and `slot name(a, b)` all use it, a fill with other parameters, or a `@name` written without the parameters the prop is called with, is a `kay check` error (the second names the parameters to write), and `slot name` on a prop that is no `Snippet` is reported at the name.
102
102
 
103
- No function reaches the browser, so a static component passing one to an island is the `island-prop` error, fixed with `island()`, and a layout or a page with a `--- server` fence cannot pass one.
103
+ No function reaches the browser, so a static component passing one to an island is the `island-prop` error (unless the island lists `interactive` props and the use writes none, which renders as markup), fixed with `island()`, and a layout or a page with a `--- server` fence cannot pass one.
104
104
 
105
105
  A static component that only islands render is part of them, so it can.
106
106
 
@@ -141,5 +141,5 @@ List(items={todos})
141
141
  - A name another snippet, an import, a script const, a prop or a loop variable already holds is reported at the snippet, and assigning one is refused.
142
142
  - It can hold components, a bare `slot` of the component declaring it, `if`, `for`, `await`, `match` and other snippets, and is a plain function, so `List(row={feature})` passes it where a prop takes a function, which the component renders with `slot row(item, i)`.
143
143
  - An `error` or `pending` line in a snippet follows the form the snippet is rendered in while it renders, as one in a component does, unless the form it is declared in is around it, which it keeps reading. In an island the snippet, like the children a component is given, takes the form it is called in once, as it is called, so a line inside an `await` block or an `if` shown later reads the same form, and a snippet declared outside the form works as one declared inside; call it in the form's own markup, `{note()}` or inside a larger expression. A component an `await` or an `if` of the snippet shows later reads no form: put the line in the snippet itself. `add.form.error('title')` and `add.pending()` take the action from anywhere.
144
- - A static component passing one to an island is the `island-prop` error, as it is for a `@row(item)` block.
144
+ - A static component passing one to an island is the `island-prop` error, as it is for a `@row(item)` block, unless the island lists `interactive` props and the use writes none.
145
145
  - Markup used by several files is a component; a snippet is for one file.
@@ -1,6 +1,36 @@
1
1
  # Upgrading, older releases
2
2
 
3
- What each minor release before 1.106 broke, and what an app changed to move to it. The newer releases are in [Upgrading](upgrading.md).
3
+ What each minor release before 1.108 broke, and what an app changed to move to it. The newer releases are in [Upgrading](upgrading.md).
4
+
5
+ ## 1.107.0
6
+
7
+ ### `TSchema` is gone from `kay/library`
8
+
9
+ Import `Schema` from `kay/library` instead, kay's own name for what `s` builds; `kay upgrade` on 1.106 rewrote the import and its uses. The `deprecated-schema-type` lint is gone with it.
10
+
11
+ ### `--- script` opening a file is an error
12
+
13
+ A file opens its script with `---`; `--- script` is only for a script that follows a `--- server`, `--- module` or `--- style` fence. The `deprecated-script-fence` lint is gone, and `--- script` first in a file is a `fence-invalid` error whose safe fix `kay check --fix` applies.
14
+
15
+ ### `action({ input, ...options }, handler)`
16
+
17
+ An action takes its options first, with its input in them, as an API route does: `action({ input: { title: s.string() }, maxSize: '1mb' }, handler)`. `action(schema, handler, options)` and `action(handler, options)` work until 2.0; `kay upgrade` rewrites them (`deprecated-action-options`).
18
+
19
+ ### One validation for every input
20
+
21
+ Actions, API routes, sockets and `defineEnv` read their input through one `validate(schema, value, { source })`. Text sources (a form, a query, path params, the environment) are read as the numbers, booleans and lists they spell, and a JSON body never is: an action called from an island, a socket message and an API route's JSON body that sent `'3'` for an int, or `'true'` for a boolean, are refused where Elysia's schemas let them by. An object refuses a key its shape lacks in JSON (`extra: 'strip'` drops it, as `s.Object` of the old builders still does); a query, the headers and the cookies of a request still drop theirs. A form post drops the fields the schema does not name (a named submit button, a widget), as a browser sends controls the app does not own. `validate` answers `{ errors: [{ path, key, params, message }], status: 422 }` worded in the request's locale and independent of `NODE_ENV`; an action's or API route's answer still carries `errors` as a `{ field: message }` map. An API route's refusal reaches an `onError` as an error with code `VALIDATION` whose `all` lists `path`, `message` and `summary`. No lint can find the app that sends such a key or such a JSON value, as it depends on what a request carries.
22
+
23
+ ## 1.106.0
24
+
25
+ ### `s` is kay's own builder, in lowercase
26
+
27
+ `s.string({ min, max })`, `s.int()`, `s.enum()`, `s.object()` and the rest replace the PascalCase builders of Elysia, each taking the same field options (`optional: true`, `default`, `error`, `label`, `description`, `example`); `s.Optional(field)` is `optional: true` in the field's options, `s.UnionEnum` and `s.UnionKeys` are `s.enum`, `s.Numeric` is `s.number`, and `s.typebox` is gone: `s` builds a schema of its own, over TypeBox, and a schema built with Elysia's `t` is still taken. The old names work until 2.0, and `kay upgrade` rewrites them (`deprecated-schema-builders`, [schemas](schemas.md#schemas)). A file size of a file field is `'2mb'`, never `'2m'`. Two things differ in the new builders: `s.object` refuses a key its shape lacks, where `s.Object` let it by (`{ extra: 'strip' }` keeps the old way; see [schemas](schemas.md#schemas) for where it refuses), and `s.list` is at most 1,000 items unless `max` says more; the fix of 1.109 writes both options, the one of 1.106 to 1.108 did not. An unknown key of a query, the headers or the cookies is dropped, whatever the schema says, as a link or a proxy adds some; `s.Object` of a collection's frontmatter now refuses a key its shape lacks, so an entry with an extra key fails the build until the schema says `{ extra: 'strip' }`. An `action` takes a record of fields, which refuses a key its shape lacks: `s.object(shape, { extra: 'strip' })` keeps the old way. A `defineEnv` takes the record of fields where it took `s.Object({ ... })`, and the fix writes it, as an env reads only the names it declares.
28
+ ### `@kaynooo/eslint` 8
29
+
30
+ kay and `kay new` use `@kaynooo/eslint` 8, which has no formatters (Prettier, oxfmt and dprint, about 30 MB, are no longer installed): run `bun add -d @kaynooo/eslint@^8`, and drop a `formatters` option from `eslint.config.ts` if it sets one. `kay fmt` formats as before.
31
+ ### `sanitizeHtml` keeps only `language-*` classes on `code`
32
+
33
+ A call with `attributes: { code: ['class'] }` now keeps a `code` element's class only when it is `language-` and a language name (`language-ts`, `language-c++`); any other class is dropped. Style the element by its parent or by `[class^='language-']` instead of a class of your own on `code`.
4
34
 
5
35
  ## 1.105.0
6
36
 
package/llms/upgrading.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  What each release breaks, and what an app changes to move to it. kay and its libraries share one version, so one section covers them all; a patch breaks nothing, and a version missing here broke nothing. Through 1.x a breaking change ships in a minor; from 2.0.0 it ships in a major, and a minor or a patch breaks nothing.
4
4
 
5
+ ## 1.110.0
6
+
7
+ ### A swap keeps an island whose props changed
8
+
9
+ - A refresh (an action's, `refresh()`, a live value's) used to end an island whose props changed and hydrate it afresh; it now stays, with its signals, open dialogs and focus, and takes the new props in place. A value the island seeds from a prop once, `signal(light)`, keeps the first value: write `linked(() => light)` for one that follows, or give the island a `persist={key}` that changes to start it afresh. A list whose items move keeps each island by `persist={id}`.
10
+ - A visit to a page with the same layout keeps the islands the layout renders (a menu, a folded group) with their state; the page's own islands are still ended. An island of a layout that used to start closed on every page now stays as it was left.
11
+ - A refresh keeps a field a visitor typed in and a `details` they toggled unless the server changed that value, where it used to show the server's again.
12
+ ### A Dialog's close is a plain button with a `close` part
13
+
14
+ Dialog's close button is a `button` (an `a` with `closeHref`) of the `kui-icon-btn` class drawing the `x` icon, no longer an `IconButton`. An app styling it through `part="root"` of that IconButton, or a `restyle` recipe on `IconButton` that reached it, styles the `close` part of Dialog instead (SidePanel hands it on as its own `close`); a `close` block still replaces the whole button.
15
+
5
16
  ## 1.109.0
6
17
 
7
18
  ### The 1.105 config, page, server and store forms are gone
@@ -21,6 +32,19 @@ The twenty-four lints that reported them are gone too. `kay upgrade` on 1.108 re
21
32
  - Library stores: `ai({ conversations })` is `ai({ store })`; `pgConversations`, `sqliteConversations`, `createConversationTable` and `conversationTable` are `pgAi`, `sqliteAi`, `createAiTables` and `aiTables`; `openLists`, `createMailListTables` and `mailListTableNames` are `sqliteLists`, `createMailTables` and `mailTables`; `mailer({ listStore, suppressionStore })` is `store: { lists, suppressions }`; `pgLoader` and `sqliteLoader` of kayjs-cms are `pgCms` and `sqliteCms`.
22
33
  - Jobs: a handler is `(input, ctx)`, its signal and job being `ctx.signal` and `ctx.job` and no longer the second and third arguments, and `lostAfter` is `timeout`; `schedule('@hourly', job, options)` is `schedule({ cron: '@hourly', ...options }, job)`, `schedule('30s', job)` is `schedule({ every: '30s' }, job)`; `diskFiles(dir, hooks)` is `diskFiles({ dir, ...hooks })`; `ws.send(JSON.stringify(value))` of an `api()` socket is `ws.send(value)`.
23
34
  - A page's `noindex`, `sitemap`, `lastmod`, `search` and `feed` are written in `seo`, and `ttl` and `cacheControl` are `cache`: the build refuses a top-level key of `page`, naming the new one. An `img` takes `placeholder={false}` where it took `no-placeholder`.
35
+ ### What `kay upgrade` on 1.108 did not reach
36
+
37
+ The lints only saw the forms written inline, so an app that reported nothing on 1.108 can still hold these; `kay check` on 1.109 shows each as a type error, and each is a hand edit.
38
+
39
+ - A removed lint named in `lints` (`'deprecated-package-names': 'allow'`, any `deprecated-*` of 1.105 to 1.108, `unreturned-fail`, `uncaught-await`) is accepted: `kay check` warns that the lint is gone and the entry changes nothing, so delete it when convenient; a `// kay-allow` comment naming one gets the same warning, and `kay check --fix` drops the name (the comment when it was the only one).
40
+ - `.rows()` of an `infiniteList(...)`, in a template or a script, is `.data()`, wherever the list was built; and `site.refusal(action, input)` in a test is `site.expectRefused(action, input)`.
41
+ - `ctx.deny(status, message)` with the message in a variable (`ctx.deny(503, failure.message)`) is `ctx.deny(503, { message: failure.message })`.
42
+ - `maxAge` in the options handed to `files.url(key, { maxAge: '1d' })` is `ttl`.
43
+ - `schedule(cron, job, { enabled })` with the cron held in a const or a variable is `schedule({ cron, enabled }, job)`: look for a `schedule(` whose first argument is not a literal.
44
+ - `formatDuration(ms)` of `kay/i18n` with a number held in a variable takes a `Duration`: write `` formatDuration(`${ms}ms`) ``.
45
+ - A `s.Union(Object.keys(R).map(key => s.Literal(key)))` is `s.enum(R)`: `kay check --fix` now writes it, where `s.union` of a mapped array is a type error.
46
+ - The `kay check --fix` of 1.106 to 1.108 wrote `s.list(...)` and `s.object(...)` with no options, so an app already rewritten holds lists capped at 1,000 items and objects that refuse a key their shape lacks, where the old builders did neither. Search the app for `s.list(` without a `max` and `s.object(` without `extra`, and add `max` or `extra: 'strip'` where the old limit or the old leniency is wanted; a string field already took the 10,000 characters of any action's string.
47
+
24
48
  ### The island and template forms of 1.105 are gone
25
49
 
26
50
  The `deprecated-page-island`, `deprecated-island-fence`, `deprecated-island-attributes`, `deprecated-island-events`, `deprecated-link-flags`, `deprecated-children-prop`, `deprecated-uncaught-await`, `deprecated-import-path`, `deprecated-context-import` and `deprecated-listen-target` lints are gone with the forms they reported; run `kay upgrade` on 1.108 first, which rewrote each but the page island.
@@ -29,7 +53,7 @@ The `deprecated-page-island`, `deprecated-island-fence`, `deprecated-island-attr
29
53
  - `--- island`, `--- client` and `--- static` are unknown fences, and `export const island = { ... }` in a `--- module` fence is a `fence-invalid` error: write `island({ render, hydrate, persist, interactive })` first in the component's script.
30
54
  - `hydrate="client"` on a use is `render="client"`, and `server="defer"` is `server defer`: `server="defer"` is a `server-island-invalid` error and `hydrate="client"` an `attribute-invalid` one.
31
55
  - `data-keep-scroll`, `data-no-transition` and `data-no-prefetch` are read by nothing and are an `unknown-link-flag` error: write `data-scroll="keep"`, `data-transition="false"` and `data-prefetch="false"`.
32
- - A `// kay-allow uncaught-await` comment and a `lints: { 'uncaught-await': ... }` entry are an unknown lint, and `defineConfig` types no such `lints` key: remove them.
56
+ - A `// kay-allow uncaught-await` comment and a `lints: { 'uncaught-await': ... }` entry name a removed lint: `kay check` warns, and `--fix` drops the name from the comment, which allows nothing now.
33
57
  - `listen(window, ...)` is `listen(() => window, ...)`: `listen` takes a function returning its target, and a value is a type error, and in a `.kay` file a server read of `window`.
34
58
  - Import `mount`, `Mounted`, `s`, `RateLimit` and `RateLimitRefusal` from `kay` and `sqliteCache` from `kay/cache`: `kay/mount` is no entry any more and `kay/server` no longer exports them.
35
59
  - `defineContext` is imported from `kay/server`: `kay/library` no longer exports it.
@@ -117,34 +141,4 @@ A bare `persisted(name, value)` is `persisted.cookie(name, value)`, and `persist
117
141
 
118
142
  A project still importing `@kaynooo/kayjs*` is not reported any more, and `kay check --fix` no longer rewrites it: write `@kayjs/kay` and `@kayjs/<library>` (`ui`, `auth`, `mail`, `cms`, `ai`) in the imports, config keys, stylesheets and `package.json` yourself, or run `kay upgrade`, which still moves an app off the old names, stopping at 1.107 first.
119
143
 
120
- ## 1.107.0
121
-
122
- ### `TSchema` is gone from `kay/library`
123
-
124
- Import `Schema` from `kay/library` instead, kay's own name for what `s` builds; `kay upgrade` on 1.106 rewrote the import and its uses. The `deprecated-schema-type` lint is gone with it.
125
-
126
- ### `--- script` opening a file is an error
127
-
128
- A file opens its script with `---`; `--- script` is only for a script that follows a `--- server`, `--- module` or `--- style` fence. The `deprecated-script-fence` lint is gone, and `--- script` first in a file is a `fence-invalid` error whose safe fix `kay check --fix` applies.
129
-
130
- ### `action({ input, ...options }, handler)`
131
-
132
- An action takes its options first, with its input in them, as an API route does: `action({ input: { title: s.string() }, maxSize: '1mb' }, handler)`. `action(schema, handler, options)` and `action(handler, options)` work until 2.0; `kay upgrade` rewrites them (`deprecated-action-options`).
133
-
134
- ### One validation for every input
135
-
136
- Actions, API routes, sockets and `defineEnv` read their input through one `validate(schema, value, { source })`. Text sources (a form, a query, path params, the environment) are read as the numbers, booleans and lists they spell, and a JSON body never is: an action called from an island, a socket message and an API route's JSON body that sent `'3'` for an int, or `'true'` for a boolean, are refused where Elysia's schemas let them by. An object refuses a key its shape lacks in JSON (`extra: 'strip'` drops it, as `s.Object` of the old builders still does); a query, the headers and the cookies of a request still drop theirs. A form post drops the fields the schema does not name (a named submit button, a widget), as a browser sends controls the app does not own. `validate` answers `{ errors: [{ path, key, params, message }], status: 422 }` worded in the request's locale and independent of `NODE_ENV`; an action's or API route's answer still carries `errors` as a `{ field: message }` map. An API route's refusal reaches an `onError` as an error with code `VALIDATION` whose `all` lists `path`, `message` and `summary`. No lint can find the app that sends such a key or such a JSON value, as it depends on what a request carries.
137
-
138
- ## 1.106.0
139
-
140
- ### `s` is kay's own builder, in lowercase
141
-
142
- `s.string({ min, max })`, `s.int()`, `s.enum()`, `s.object()` and the rest replace the PascalCase builders of Elysia, each taking the same field options (`optional: true`, `default`, `error`, `label`, `description`, `example`); `s.Optional(field)` is `optional: true` in the field's options, `s.UnionEnum` and `s.UnionKeys` are `s.enum`, `s.Numeric` is `s.number`, and `s.typebox` is gone: `s` builds a schema of its own, over TypeBox, and a schema built with Elysia's `t` is still taken. The old names work until 2.0, and `kay upgrade` rewrites them (`deprecated-schema-builders`, [schemas](schemas.md#schemas)). A file size of a file field is `'2mb'`, never `'2m'`. Two things differ in the new builders, which the fix does not hide: `s.object` refuses a key its shape lacks, where `s.Object` let it by (`{ extra: 'strip' }` keeps the old way; see [schemas](schemas.md#schemas) for where it refuses), and `s.list` is at most 1,000 items unless `max` says more. An unknown key of a query, the headers or the cookies is dropped, whatever the schema says, as a link or a proxy adds some; `s.Object` of a collection's frontmatter now refuses a key its shape lacks, so an entry with an extra key fails the build until the schema says `{ extra: 'strip' }`. An `action` or a `defineEnv` takes the record of fields where it took `s.Object({ ... })`, and the fix writes it.
143
- ### `@kaynooo/eslint` 8
144
-
145
- kay and `kay new` use `@kaynooo/eslint` 8, which has no formatters (Prettier, oxfmt and dprint, about 30 MB, are no longer installed): run `bun add -d @kaynooo/eslint@^8`, and drop a `formatters` option from `eslint.config.ts` if it sets one. `kay fmt` formats as before.
146
- ### `sanitizeHtml` keeps only `language-*` classes on `code`
147
-
148
- A call with `attributes: { code: ['class'] }` now keeps a `code` element's class only when it is `language-` and a language name (`language-ts`, `language-c++`); any other class is dropped. Style the element by its parent or by `[class^='language-']` instead of a class of your own on `code`.
149
-
150
- Releases before 1.106 are in [Upgrading, older releases](upgrading-archive.md).
144
+ Releases before 1.108 are in [Upgrading, older releases](upgrading-archive.md).
package/llms/whats-new.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  What each release of kay and its libraries adds, newest first, each feature with where it is documented. kay and its libraries share one version, so one section covers them all; what a release breaks is in [Upgrading](upgrading.md).
4
4
 
5
+ ## 1.110.0
6
+
7
+ - kayjs-ui's `Checkbox`, `RadioGroup` choices and `Toggle` rows are at least 24px tall, the tap target of WCAG 2.5.8, whatever the label's line height.
8
+ - kayjs-ui's `Segmented` keeps each option's label on one line and scrolls sideways inside its container when the options do not fit, and a `Badge` wraps its text between words inside its parent, instead of overflowing it.
9
+ - kayjs-ui's `BarChart` draws each shown x-axis label in a box as wide as its text, centred on its column, and no box for a column with no label, so a chart of many columns no longer has labels running past their own box.
10
+ - A task list item (`- [ ] a`) inside `.kui-prose`, such as a MarkdownEditor preview, shows no bullet and a drawn box in the accent hanging where the bullet was, not the browser's dimmed checkbox; the space skin draws it too.
11
+ - A component listing `island({ interactive })` takes a function or a block with parameters from a use turning none of those props on, so a page's `Table` with an `@cell(row, column)` block is plain markup with the block rendered by the server, and no longer an `island-prop` error ([islands](islands.md#make-a-component-interactive)).
12
+ - A Table whose `rows` is replaced by copies under the same `rowKey` keeps the nodes its `@cell` and `@detail` blocks drew, so a field in a cell keeps the focus while it is edited; the block's `row` is a view of the current row, read by its fields where it is used, so compare rows by their key, not by identity (`rows.indexOf(row)` is `-1`); Masonry, AvatarGroup, BellInbox, ChipGroup, Segmented, RadioGroup, MultiSelect, Combobox, DescriptionList, AppSwitcher and AudioPlayer draw their item blocks the same way ([Table](../../ui/llms/table.md)).
13
+ - A swap keeps what the visitor changed and applies what the server changed: an island stays on a refresh and takes its new props in place, its state kept, as do the islands a layout renders across a visit to a page with the same layout; a static `details` the visitor opened and a field they typed in keep their state through a refresh, in production as in `kay dev`, unless the server changed that value ([Navigation](navigation.md#islands-kept-across-pages), [Actions from islands](actions-from-islands.md)).
14
+ - `signal-from-prop` (a warning in the `islands` group) flags a `signal(light)` seeded from a prop and never written, which keeps the first value now that an island stays through a refresh, and `kay check --fix` writes `linked(() => light)` ([lints](island-and-form-lints.md)).
15
+ - kayjs-ui's `Dialog` closes with a plain button with a `close` part, so an island holding a Dialog no longer ships `IconButton` and the icon set for it (a plain Dialog island is 7 KB smaller in an app that has no other icon button), and it leaves out `level`, `header`, `handle`, `trigger` and `closeHref` when no call site of the project writes them; the close draws kayjs-ui's `x` icon, and a `close` block replaces it ([restyle](https://git.kaynooo.fr/kaynooo/kayjs/src/branch/main/packages/ui/llms/restyle.md)).
16
+ - A kayjs-ui component handing its `...rest` props, or a prop it takes by name, on to a component with optional features (`FormDialog`, `SidePanel` and `ConfirmHost` into `Dialog`) counts by what its own callers write, no longer as every prop, so an island leaves out the features no call site uses.
17
+ - A part handed on to a component (`Icon(part="spinner")`) writes its `class` and `parts` as one source, about 45 bytes less in each island per hand-off.
18
+ - A `lints` entry in kay.config.ts naming a lint kay has removed (`'deprecated-package-names': 'allow'`) is accepted by the config type and warned about by `kay check`, instead of refused; `kay check --fix` writes `s.Union(Object.keys(R).map(key => s.Literal(key)))` as `s.enum(R)` and leaves any other mapped `s.Union` to the app, see [Upgrading](upgrading.md). The same fix writes `max: Number.MAX_SAFE_INTEGER` on an `s.Array` and `extra: 'strip'` on an `s.Object`, so a rewritten list or object keeps the old behaviour; an app rewritten before has lists capped at 1,000 and objects that refuse extra keys, [how to check](upgrading.md#what-kay-upgrade-on-1108-did-not-reach).
19
+
5
20
  ## 1.109.0
6
21
 
7
22
  - An endpoint file (`src/routes/a.txt.ts`) no longer stops an app with a root `_guard.ts` and an extension layout that reaches files, as kayjs-auth's, from starting or passing `kay check` (`the layouts of the extensions are placed before what the pages reach was opened`): the endpoints are scanned after what the pages reach is open, as the pages are.
package/llms.txt CHANGED
@@ -117,7 +117,7 @@ To build a site, read [Build a site](llms/site.md) first, then the topics below;
117
117
  - [Proxies and security headers](llms/proxy-and-security.md): headers, CSP, compression
118
118
  - [Upgrading](llms/upgrading.md): what each recent minor breaks, what an app changes
119
119
  - [Upgrading to 1.105, config](llms/upgrading-1-105-config.md): config and hooks
120
- - [Upgrading, older](llms/upgrading-archive.md): the minors before 1.106
120
+ - [Upgrading, older](llms/upgrading-archive.md): the minors before 1.108
121
121
  - [What's new](llms/whats-new.md): what each recent release adds
122
122
  - [What's new, older](llms/whats-new-archive.md): the releases before 1.107
123
123
  - [Privacy and personal data](llms/privacy.md): what kay keeps, erasing a person
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kayjs/kay",
3
3
  "type": "module",
4
- "version": "1.109.0",
4
+ "version": "1.110.0",
5
5
  "description": "A Bun web framework: one .kay file per component, pages rendered to plain HTML on the server, interactive islands in the browser",
6
6
  "author": "Kaynooo <https://github.com/Kayno0o>",
7
7
  "license": "MIT",
@@ -304,11 +304,11 @@
304
304
  "@fontsource/inter": "^5.3.0",
305
305
  "@happy-dom/global-registrator": "^21.0.4",
306
306
  "@iconify-json/tabler": "^1.2.42",
307
- "@kayjs/ai": "1.109.0",
308
- "@kayjs/auth": "1.109.0",
309
- "@kayjs/cms": "1.109.0",
310
- "@kayjs/mail": "1.109.0",
311
- "@kayjs/ui": "1.109.0",
307
+ "@kayjs/ai": "1.110.0",
308
+ "@kayjs/auth": "1.110.0",
309
+ "@kayjs/cms": "1.110.0",
310
+ "@kayjs/mail": "1.110.0",
311
+ "@kayjs/ui": "1.110.0",
312
312
  "@kaynooo/eslint": "^8.0.3",
313
313
  "@kaynooo/pg-orm": "^8.1.4",
314
314
  "@oxc-parser/binding-wasm32-wasip1": "0.155.0",