@kayjs/kay 1.105.0 → 1.106.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 (310) hide show
  1. package/dist/eslint.js +435 -120
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +2 -2
  5. package/llms/actions.md +22 -19
  6. package/llms/analytics.md +1 -1
  7. package/llms/api-from-islands.md +1 -1
  8. package/llms/api-routes.md +6 -6
  9. package/llms/check-and-tools.md +1 -1
  10. package/llms/code-lints.md +2 -2
  11. package/llms/compiler-api.md +1 -1
  12. package/llms/component-libraries.md +1 -0
  13. package/llms/content-cms.md +1 -1
  14. package/llms/content-markdown-to-caching.md +1 -1
  15. package/llms/content-preview.md +2 -2
  16. package/llms/content.md +21 -21
  17. package/llms/deprecated-lints-1-105-libraries.md +2 -0
  18. package/llms/deprecated-lints-1-105.md +3 -3
  19. package/llms/deprecated-lints.md +3 -2
  20. package/llms/dev-tool.md +2 -2
  21. package/llms/environment.md +22 -22
  22. package/llms/files.md +5 -5
  23. package/llms/islands-state-to-ids.md +2 -1
  24. package/llms/local-collections.md +2 -2
  25. package/llms/mcp.md +2 -1
  26. package/llms/navigation-from-code.md +1 -1
  27. package/llms/notifications.md +4 -2
  28. package/llms/project.md +1 -1
  29. package/llms/rate-limits.md +1 -1
  30. package/llms/recipes.md +16 -16
  31. package/llms/rooms.md +4 -4
  32. package/llms/routing-endpoints-and-base.md +1 -1
  33. package/llms/routing.md +5 -5
  34. package/llms/schemas.md +10 -5
  35. package/llms/server.md +7 -7
  36. package/llms/site.md +9 -9
  37. package/llms/sitemap-search-fonts.md +2 -0
  38. package/llms/styles-and-assets.md +2 -1
  39. package/llms/templates-elements-slots-snippets.md +2 -2
  40. package/llms/testing-browser.md +20 -0
  41. package/llms/testing.md +1 -1
  42. package/llms/upgrading-1-105-config.md +2 -2
  43. package/llms/upgrading.md +18 -3
  44. package/llms/whats-new-archive.md +35 -66
  45. package/llms/whats-new.md +34 -28
  46. package/llms.txt +1 -1
  47. package/package.json +15 -11
  48. package/src/add.ts +1 -1
  49. package/src/build/class-table.ts +2 -2
  50. package/src/build/client.ts +7 -6
  51. package/src/build/plugin.ts +14 -11
  52. package/src/build/styles.ts +3 -3
  53. package/src/build/transform.ts +3 -1
  54. package/src/build/ui-layers.ts +30 -0
  55. package/src/build/ui.ts +108 -11
  56. package/src/build/variants.ts +119 -43
  57. package/src/build/worker-bundle.ts +6 -0
  58. package/src/check/boot.ts +22 -1
  59. package/src/check/call-result.ts +242 -0
  60. package/src/check/config-objects.ts +17 -2
  61. package/src/check/diagnose.ts +22 -0
  62. package/src/check/handler-events.ts +149 -0
  63. package/src/check/index.ts +6 -2
  64. package/src/check/link-flag-tests.ts +130 -0
  65. package/src/check/project.ts +4 -3
  66. package/src/check/refusal-calls.ts +2 -2
  67. package/src/check/regroup.ts +5 -3
  68. package/src/check/renamed-packages.ts +58 -14
  69. package/src/check/schema-builders.ts +256 -0
  70. package/src/check/secret-keys.ts +15 -2
  71. package/src/check/shadow-types.ts +2 -0
  72. package/src/check/template-hints.ts +1 -1
  73. package/src/check/tool-labels.ts +11 -9
  74. package/src/check/ui-types.ts +4 -3
  75. package/src/check/ui.ts +14 -11
  76. package/src/commands/env-declare.ts +18 -6
  77. package/src/commands/routes.ts +1 -1
  78. package/src/compiler/a11y.ts +8 -1
  79. package/src/compiler/ast.ts +1 -1
  80. package/src/compiler/bound-props.ts +1 -1
  81. package/src/compiler/codegen.ts +6 -6
  82. package/src/compiler/deprecated-lints-1-106.ts +14 -0
  83. package/src/compiler/deprecated-lints.ts +10 -5
  84. package/src/compiler/deprecated-typed-lints.ts +23 -0
  85. package/src/compiler/dom-here.ts +72 -0
  86. package/src/compiler/dom.ts +23 -23
  87. package/src/compiler/fence-checks.ts +12 -11
  88. package/src/compiler/field-described.ts +2 -2
  89. package/src/compiler/helper-imports.ts +1 -1
  90. package/src/compiler/html-fields.ts +92 -0
  91. package/src/compiler/html-initial.ts +5 -3
  92. package/src/compiler/html.ts +14 -31
  93. package/src/compiler/index.ts +3 -1
  94. package/src/compiler/items.ts +5 -5
  95. package/src/compiler/link-flags.ts +6 -5
  96. package/src/compiler/lints.ts +12 -12
  97. package/src/compiler/rest-omits.ts +15 -0
  98. package/src/config-loader.ts +10 -2
  99. package/src/config-resolve.ts +3 -1
  100. package/src/config-shape.ts +2 -2
  101. package/src/config.ts +20 -4
  102. package/src/content/markdown.ts +2 -3
  103. package/src/generate-resource.ts +9 -9
  104. package/src/generate.ts +1 -1
  105. package/src/mcp/guards.ts +1 -1
  106. package/src/mcp/tools.ts +1 -1
  107. package/src/migrate/content.ts +61 -55
  108. package/src/runtime/action-shared.ts +2 -2
  109. package/src/runtime/action.ts +6 -2
  110. package/src/runtime/form-types.ts +99 -0
  111. package/src/runtime/form.ts +22 -7
  112. package/src/runtime/html.ts +36 -5
  113. package/src/runtime/markdown-autolink.ts +69 -0
  114. package/src/runtime/markdown-render.client.ts +39 -3
  115. package/src/runtime/markdown.client.ts +6 -3
  116. package/src/runtime/markdown.server.ts +6 -3
  117. package/src/runtime/markdown.ts +125 -1
  118. package/src/runtime/navigate-api.ts +10 -5
  119. package/src/runtime/persist.ts +7 -7
  120. package/src/runtime/query-param.ts +1 -1
  121. package/src/runtime/reactive.ts +14 -0
  122. package/src/runtime/sanitize.ts +3 -1
  123. package/src/runtime/schema-record.ts +31 -0
  124. package/src/runtime/schema.client.ts +1 -4
  125. package/src/runtime/schema.ts +321 -26
  126. package/src/runtime/swap-focus.ts +59 -11
  127. package/src/server/action-module.ts +16 -0
  128. package/src/server/actions.ts +6 -14
  129. package/src/server/api-modules.ts +1 -1
  130. package/src/server/api.ts +13 -1
  131. package/src/server/app-stages.ts +23 -18
  132. package/src/server/dev-ui.ts +2 -2
  133. package/src/server/env-state.ts +1 -1
  134. package/src/server/env.ts +11 -3
  135. package/src/server/favicon.ts +47 -1
  136. package/src/server/image-metadata-bmff.ts +1 -1
  137. package/src/server/kept-pages.ts +3 -3
  138. package/src/server/library.ts +2 -0
  139. package/src/server/mcp.ts +13 -12
  140. package/src/server/notifications.ts +4 -2
  141. package/src/server/offline.ts +24 -7
  142. package/src/server/push-settings.ts +16 -2
  143. package/src/server/push.ts +12 -4
  144. package/src/server/query.ts +13 -6
  145. package/src/server/render.ts +1 -1
  146. package/src/server/scope.ts +20 -13
  147. package/src/server/signals.ts +4 -4
  148. package/src/template-ws.ts +1 -1
  149. package/src/test/a11y-dom.ts +70 -0
  150. package/src/test/html-snapshot.ts +103 -0
  151. package/src/test/index.ts +2 -1
  152. package/src/test/mount.ts +8 -1
  153. package/src/test/page-checks.ts +12 -0
  154. package/src/test/screenshot-match.ts +2 -2
  155. package/src/test/shared-modules.ts +27 -5
  156. package/src/test/site-types.ts +5 -1
  157. package/types/build/class-table.d.ts +1 -1
  158. package/types/build/class-table.d.ts.map +1 -1
  159. package/types/build/client.d.ts.map +1 -1
  160. package/types/build/plugin.d.ts.map +1 -1
  161. package/types/build/transform.d.ts +1 -0
  162. package/types/build/transform.d.ts.map +1 -1
  163. package/types/build/ui-layers.d.ts +5 -0
  164. package/types/build/ui-layers.d.ts.map +1 -0
  165. package/types/build/ui.d.ts +7 -0
  166. package/types/build/ui.d.ts.map +1 -1
  167. package/types/build/variants.d.ts +1 -1
  168. package/types/build/variants.d.ts.map +1 -1
  169. package/types/build/worker-bundle.d.ts +1 -0
  170. package/types/build/worker-bundle.d.ts.map +1 -1
  171. package/types/check/boot.d.ts.map +1 -1
  172. package/types/check/call-result.d.ts +7 -0
  173. package/types/check/call-result.d.ts.map +1 -0
  174. package/types/check/config-objects.d.ts.map +1 -1
  175. package/types/check/diagnose.d.ts.map +1 -1
  176. package/types/check/handler-events.d.ts +9 -0
  177. package/types/check/handler-events.d.ts.map +1 -0
  178. package/types/check/index.d.ts +1 -0
  179. package/types/check/index.d.ts.map +1 -1
  180. package/types/check/link-flag-tests.d.ts +4 -0
  181. package/types/check/link-flag-tests.d.ts.map +1 -0
  182. package/types/check/project.d.ts.map +1 -1
  183. package/types/check/regroup.d.ts +1 -1
  184. package/types/check/regroup.d.ts.map +1 -1
  185. package/types/check/renamed-packages.d.ts +1 -0
  186. package/types/check/renamed-packages.d.ts.map +1 -1
  187. package/types/check/schema-builders.d.ts +3 -0
  188. package/types/check/schema-builders.d.ts.map +1 -0
  189. package/types/check/secret-keys.d.ts.map +1 -1
  190. package/types/check/shadow-types.d.ts.map +1 -1
  191. package/types/check/template-hints.d.ts +1 -0
  192. package/types/check/template-hints.d.ts.map +1 -1
  193. package/types/check/tool-labels.d.ts.map +1 -1
  194. package/types/check/ui-types.d.ts.map +1 -1
  195. package/types/check/ui.d.ts.map +1 -1
  196. package/types/commands/env-declare.d.ts.map +1 -1
  197. package/types/compiler/a11y.d.ts.map +1 -1
  198. package/types/compiler/bound-props.d.ts +1 -0
  199. package/types/compiler/bound-props.d.ts.map +1 -1
  200. package/types/compiler/codegen.d.ts +1 -0
  201. package/types/compiler/codegen.d.ts.map +1 -1
  202. package/types/compiler/deprecated-lints-1-106.d.ts +12 -0
  203. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -0
  204. package/types/compiler/deprecated-lints.d.ts +32 -5
  205. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  206. package/types/compiler/deprecated-typed-lints.d.ts +21 -0
  207. package/types/compiler/deprecated-typed-lints.d.ts.map +1 -0
  208. package/types/compiler/dom-here.d.ts +14 -0
  209. package/types/compiler/dom-here.d.ts.map +1 -0
  210. package/types/compiler/dom.d.ts +1 -0
  211. package/types/compiler/dom.d.ts.map +1 -1
  212. package/types/compiler/fence-checks.d.ts.map +1 -1
  213. package/types/compiler/field-described.d.ts +1 -1
  214. package/types/compiler/field-described.d.ts.map +1 -1
  215. package/types/compiler/html-fields.d.ts +19 -0
  216. package/types/compiler/html-fields.d.ts.map +1 -0
  217. package/types/compiler/html-initial.d.ts +3 -2
  218. package/types/compiler/html-initial.d.ts.map +1 -1
  219. package/types/compiler/html.d.ts.map +1 -1
  220. package/types/compiler/index.d.ts +1 -0
  221. package/types/compiler/index.d.ts.map +1 -1
  222. package/types/compiler/items.d.ts +4 -1
  223. package/types/compiler/items.d.ts.map +1 -1
  224. package/types/compiler/link-flags.d.ts +6 -0
  225. package/types/compiler/link-flags.d.ts.map +1 -1
  226. package/types/compiler/lints.d.ts +44 -17
  227. package/types/compiler/lints.d.ts.map +1 -1
  228. package/types/compiler/rest-omits.d.ts +4 -0
  229. package/types/compiler/rest-omits.d.ts.map +1 -0
  230. package/types/config-loader.d.ts.map +1 -1
  231. package/types/config-resolve.d.ts.map +1 -1
  232. package/types/config.d.ts +15 -2
  233. package/types/config.d.ts.map +1 -1
  234. package/types/content/markdown.d.ts.map +1 -1
  235. package/types/migrate/content.d.ts.map +1 -1
  236. package/types/runtime/action-shared.d.ts +1 -1
  237. package/types/runtime/action-shared.d.ts.map +1 -1
  238. package/types/runtime/action.d.ts +3 -0
  239. package/types/runtime/action.d.ts.map +1 -1
  240. package/types/runtime/form-types.d.ts +6 -0
  241. package/types/runtime/form-types.d.ts.map +1 -0
  242. package/types/runtime/form.d.ts +3 -1
  243. package/types/runtime/form.d.ts.map +1 -1
  244. package/types/runtime/html.d.ts +3 -0
  245. package/types/runtime/html.d.ts.map +1 -1
  246. package/types/runtime/markdown-autolink.d.ts +11 -0
  247. package/types/runtime/markdown-autolink.d.ts.map +1 -0
  248. package/types/runtime/markdown-render.client.d.ts +2 -1
  249. package/types/runtime/markdown-render.client.d.ts.map +1 -1
  250. package/types/runtime/markdown.client.d.ts +3 -1
  251. package/types/runtime/markdown.client.d.ts.map +1 -1
  252. package/types/runtime/markdown.d.ts +11 -0
  253. package/types/runtime/markdown.d.ts.map +1 -1
  254. package/types/runtime/markdown.server.d.ts +3 -1
  255. package/types/runtime/markdown.server.d.ts.map +1 -1
  256. package/types/runtime/navigate-api.d.ts +1 -1
  257. package/types/runtime/navigate-api.d.ts.map +1 -1
  258. package/types/runtime/persist.d.ts +2 -2
  259. package/types/runtime/persist.d.ts.map +1 -1
  260. package/types/runtime/reactive.d.ts +3 -0
  261. package/types/runtime/reactive.d.ts.map +1 -1
  262. package/types/runtime/sanitize.d.ts.map +1 -1
  263. package/types/runtime/schema-record.d.ts +9 -0
  264. package/types/runtime/schema-record.d.ts.map +1 -0
  265. package/types/runtime/schema.client.d.ts.map +1 -1
  266. package/types/runtime/schema.d.ts +94 -10
  267. package/types/runtime/schema.d.ts.map +1 -1
  268. package/types/runtime/swap-focus.d.ts.map +1 -1
  269. package/types/server/action-module.d.ts +2 -0
  270. package/types/server/action-module.d.ts.map +1 -0
  271. package/types/server/actions.d.ts +1 -0
  272. package/types/server/actions.d.ts.map +1 -1
  273. package/types/server/api.d.ts.map +1 -1
  274. package/types/server/app-stages.d.ts +3 -2
  275. package/types/server/app-stages.d.ts.map +1 -1
  276. package/types/server/env-state.d.ts.map +1 -1
  277. package/types/server/env.d.ts +5 -1
  278. package/types/server/env.d.ts.map +1 -1
  279. package/types/server/favicon.d.ts +3 -1
  280. package/types/server/favicon.d.ts.map +1 -1
  281. package/types/server/kept-pages.d.ts +1 -1
  282. package/types/server/kept-pages.d.ts.map +1 -1
  283. package/types/server/library.d.ts +2 -0
  284. package/types/server/library.d.ts.map +1 -1
  285. package/types/server/mcp.d.ts +1 -1
  286. package/types/server/mcp.d.ts.map +1 -1
  287. package/types/server/notifications.d.ts +2 -1
  288. package/types/server/notifications.d.ts.map +1 -1
  289. package/types/server/offline.d.ts.map +1 -1
  290. package/types/server/push-settings.d.ts +1 -1
  291. package/types/server/push-settings.d.ts.map +1 -1
  292. package/types/server/push.d.ts +1 -0
  293. package/types/server/push.d.ts.map +1 -1
  294. package/types/server/query.d.ts.map +1 -1
  295. package/types/server/scope.d.ts +1 -1
  296. package/types/server/scope.d.ts.map +1 -1
  297. package/types/test/a11y-dom.d.ts +20 -0
  298. package/types/test/a11y-dom.d.ts.map +1 -0
  299. package/types/test/html-snapshot.d.ts +4 -0
  300. package/types/test/html-snapshot.d.ts.map +1 -0
  301. package/types/test/index.d.ts.map +1 -1
  302. package/types/test/mount.d.ts +3 -0
  303. package/types/test/mount.d.ts.map +1 -1
  304. package/types/test/page-checks.d.ts +6 -0
  305. package/types/test/page-checks.d.ts.map +1 -0
  306. package/types/test/screenshot-match.d.ts +1 -1
  307. package/types/test/screenshot-match.d.ts.map +1 -1
  308. package/types/test/shared-modules.d.ts.map +1 -1
  309. package/types/test/site-types.d.ts +3 -1
  310. package/types/test/site-types.d.ts.map +1 -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.105.0"
4
+ version = "1.106.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.105.0"
11
+ rev = "v1.106.0"
12
12
  path = "editors/tree-sitter-kay"
13
13
 
14
14
  [language_servers.kay]
@@ -15,7 +15,7 @@ A third argument limits attempts and traps bots, its `protect` group holding `ra
15
15
  import { s, action } from 'kay'
16
16
 
17
17
  export const contact = action(
18
- s.Object({ message: s.String({ maxLength: 2000 }) }),
18
+ { message: s.string({ max: 2000 }) },
19
19
  async ({ message }) => message.length,
20
20
  { protect: { rateLimit: { max: 5, window: '1m' }, honeypot: 'website', minTime: '3s' } },
21
21
  )
@@ -70,7 +70,7 @@ An action whose handler is an `async function*`, or returns any async iterable,
70
70
  import { s, action } from 'kay'
71
71
  import { complete } from '../data'
72
72
 
73
- export const reply = action(s.Object({ prompt: s.String({ maxLength: 2000 }) }), async function* ({ prompt }) {
73
+ export const reply = action({ prompt: s.string({ max: 2000 }) }, async function* ({ prompt }) {
74
74
  let text = ''
75
75
 
76
76
  for await (const piece of complete(prompt))
@@ -118,7 +118,7 @@ p {column()}
118
118
  ### Calling from an island
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
- - An `s.Optional` field 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.
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
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.
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.
package/llms/actions.md CHANGED
@@ -15,7 +15,7 @@ An action is an Elysia schema and a handler a page's server fence exports, and `
15
15
  import { s, action } from 'kay'
16
16
 
17
17
  export const subscribe = action(
18
- s.Object({ email: s.String({ minLength: 3, maxLength: 200 }) }),
18
+ { email: s.string({ min: 3, max: 200 }) },
19
19
  async ({ email }) => email.toLowerCase(),
20
20
  )
21
21
  ---
@@ -33,7 +33,7 @@ An `error` line inside the form shows the message of the field, the schema's `er
33
33
  import { s, action } from 'kay'
34
34
 
35
35
  export const rename = action(
36
- s.Object({ name: s.String({ minLength: 1, maxLength: 80, error: 'Write a name' }) }),
36
+ { name: s.string({ min: 1, max: 80, error: 'Write a name' }) },
37
37
  async ({ name }, ctx) => {
38
38
  if (name === 'admin')
39
39
  return ctx.deny(409, { message: 'That name is taken' })
@@ -73,7 +73,7 @@ The handler's result comes back on the next render of the page, once, through `c
73
73
  --- server
74
74
  import { s, action } from 'kay'
75
75
 
76
- export const createToken = action(s.Object({ label: s.String({ maxLength: 80 }) }), async () => crypto.randomUUID())
76
+ export const createToken = action({ label: s.string({ max: 80 }) }, async () => crypto.randomUUID())
77
77
 
78
78
  const done = createToken.data()
79
79
  ---
@@ -92,7 +92,7 @@ form(action={createToken})
92
92
  --- server
93
93
  import { s, action } from 'kay'
94
94
 
95
- export const create = action(s.Object({ title: s.String({ maxLength: 200 }) }), async ({ title }, ctx) => {
95
+ export const create = action({ title: s.string({ max: 200 }) }, async ({ title }, ctx) => {
96
96
  const id = crypto.randomUUID()
97
97
  return ctx.redirect(`/posts/${id}`)
98
98
  })
@@ -104,14 +104,14 @@ form(action={create})
104
104
 
105
105
  ### Accept a file
106
106
 
107
- `s.File()` in the schema, `input(type="file" name="avatar")` in the form, and the handler gets a `File`:
107
+ `s.file()` in the schema, `input(type="file" name="avatar")` in the form, and the handler gets a `File`:
108
108
 
109
109
  ```kay
110
110
  --- server
111
111
  import { s, action } from 'kay'
112
112
 
113
113
  export const upload = action(
114
- s.Object({ avatar: s.File({ type: 'image/png' }) }),
114
+ { avatar: s.file({ type: 'image/png' }) },
115
115
  async ({ avatar }) => avatar.size,
116
116
  { maxSize: '10mb' },
117
117
  )
@@ -133,8 +133,8 @@ A page's or a layout's server fence exports actions: an Elysia schema and a hand
133
133
  import { s, action } from 'kay'
134
134
  import { addTodo, listTodos } from '../data'
135
135
 
136
- const newTodo = s.Object({
137
- title: s.String({ minLength: 1, maxLength: 200, error: 'Write a title' }),
136
+ const newTodo = s.object({
137
+ title: s.string({ min: 1, max: 200, error: 'Write a title' }),
138
138
  })
139
139
 
140
140
  export const add = action(newTodo, async ({ title }, ctx) => {
@@ -161,11 +161,11 @@ form(action={add})
161
161
  - An action with no input leaves the schema out: `action(async (ctx) => { ... }, protection?)`, validated as an empty object, its handler getting the context alone, called as `signOut()`, `signOut(undefined, { refresh: false })` or `site.call(signOut)`, and posted by `form(action={signOut})`.
162
162
  - An action several pages and components share lives in an `_actions.kay` of a routes directory, a `--- server` fence alone, no closing `---` needed: it is served like a layout's actions, behind the guards of its directory and above, reading the params of every page below it, and `page = { guards: false }` opens it as a layout's.
163
163
  - A page or a component imports it by its path, `import { removeTissue } from '../routes/admin/_actions.kay'`, in the server fence of a page or an island alike; no route file is imported, and `kay build`, `kay check` and `kay routes` see it as they see a layout's actions.
164
- - `s.String({ format: 'email' })` accepts one plain address, the same check in the browser, on the server, in kayjs-auth and in kayjs-mail: letters and digits of any script, `+tag`, an internationalised domain; a local part up to 64 characters, labels up to 63, no quotes, comments, IP domain, name with angle brackets, list, line break or space around it, 254 characters at most, a host typed as is (no soft hyphen, zero-width space, fullwidth letter or ideographic full stop). Non-ASCII local parts and IDN domains pass for every app field; kayjs-auth alone also refuses a Latin, Cyrillic or Greek mix. `isEmail(value)` from `kay` is that check, `normalizeAddress(value)` from `kay/library` the form to store (trimmed, lower case, punycode domain).
165
- - A string field with no `maxLength` of its own is refused past 10,000 characters, with the error of a declared `maxLength`, and carries that bound to the form's `maxlength` and to the tool's schema; whatever builder wrote it, `t.Record` values, tuples and a string in an API route's `body` included. A field with an `enum`, a `const`, or a secret name such as `password` keeps none. Declare a tighter one for a name, an email or a title, which `kay check` warns of (`unbounded-string`), and a longer one for a field that takes more.
164
+ - `s.email()` accepts one plain address, the same check in the browser, on the server, in kayjs-auth and in kayjs-mail: letters and digits of any script, `+tag`, an internationalised domain; a local part up to 64 characters, labels up to 63, no quotes, comments, IP domain, name with angle brackets, list, line break or space around it, 254 characters at most, a host typed as is (no soft hyphen, zero-width space, fullwidth letter or ideographic full stop). Non-ASCII local parts and IDN domains pass for every app field; kayjs-auth alone also refuses a Latin, Cyrillic or Greek mix. `isEmail(value)` from `kay` is that check, `normalizeAddress(value)` from `kay/library` the form to store (trimmed, lower case, punycode domain).
165
+ - A string field with no `max` (`maxLength`) of its own is refused past 10,000 characters, with the error of a declared `maxLength`, and carries that bound to the form's `maxlength` and to the tool's schema; whatever builder wrote it, `t.Record` values, tuples and a string in an API route's `body` included. A field with an `enum`, a `const`, or a secret name such as `password` keeps none. Declare a tighter one for a name, an email or a title, which `kay check` warns of (`unbounded-string`), and a longer one for a field that takes more.
166
166
  - `s` from `kay` builds the schema. A schema shared by API modules, server fences and islands, and the types an island reads off it, are in [Schemas](schemas.md).
167
167
  - The handler's second argument is the request context every route shares (see routing, "The request context"), `request`, `url`, `locale`, `params`, `cookies`, `locals`, `headers`, `redirect`, `notFound` and `deny`, with `status(code)`.
168
- - `ctx.redirect`, `ctx.notFound()` and `ctx.deny()` throw, as in a page, and a handler writes `return ctx.redirect(...)`, as a guard does; a call or a form post is answered with the redirect or a 404 as plain text, `redirect` with 303 unless given. `ctx.deny(status, { message, errors, data })` fails the post as in the next lines when it holds `data` or `errors` (400 to 599); `deny(status, { message })` alone, and `deny(status, 'text')` until 1.108, stop with plain text.
168
+ - `ctx.redirect`, `ctx.notFound()` and `ctx.deny()` throw, as in a page, and a handler writes `return ctx.redirect(...)`, as a guard does; a call or a form post is answered with the redirect or a 404 as plain text, `redirect` with 303 unless given. `ctx.deny(status, { message, errors, data })` fails the post as in the next lines when it holds a `message`, `data` or `errors` (400 to 599), a `message` alone being the form's message (`add.form.error()`, an `ActionError`'s text); `deny(status)` with nothing, and `deny(status, 'text')` until 1.108, stop with plain text. A helper given the action's `ctx`, such as `limit.check(ctx)`, fails the form with its message and keeps the `Retry-After` it set; a stream that denies before its first value fails the call, and one denying after it ends the stream in an `ActionError`.
169
169
  - Its `url` is the page's the post came from, as its guards read it, and its `locale` that page's, or the site's `lang` without `i18n`.
170
170
  - A location outside ASCII, such as `/blog/日本語`, goes out percent-encoded, from pages and guards too.
171
171
  - A location holding a control character, or a scheme other than `http:` and `https:`, such as `javascript:`, throws.
@@ -173,9 +173,12 @@ form(action={add})
173
173
  ### Forms
174
174
 
175
175
  - `form(action={add})` posts without JavaScript.
176
- - Inside it, `input(field="title")`, on an `input`, `textarea` or `select`, renders `name="title"` plus the constraints the browser checks without JavaScript that the schema gives `title`: `required` where the server would refuse the field left blank (never for a boolean, so a checkbox stays optional, nor a list), `minlength`, `maxlength`, `pattern` (matched anywhere, as the schema matches it, and left out when the browser could not read it), `min`, `max` and `type="email"`, each unless the template writes it.
177
- - `s.UnionEnum(values)` has no `default` unless the options give one: an optional enum field left out reads `undefined` and a required one is refused with a 422, where Elysia's own fills the first value in.
178
- - `s.UnionKeys(TOPICS)` is a `UnionEnum` of a record's keys, typed as their union with no cast, for a `select(field="topic")` whose options come from `Object.entries(TOPICS)`.
176
+ - Inside it, `input(field="title")`, on an `input`, `textarea` or `select`, renders `name="title"` plus the constraints the browser checks without JavaScript that the schema gives `title`: `required` where the server would refuse the field left blank (never for a boolean, so a checkbox stays optional, nor a list), `minlength`, `maxlength`, `pattern` (matched anywhere, as the schema matches it, and left out when the browser could not read it), `min` and `max`, each unless the template writes it.
177
+ - It also writes the `type` of an `input` that has none, from the schema: `email` and `url` for `s.email()` and `s.url()`, `number` for `s.int()` and `s.number()` (with `step="any"` for the latter), `date` for `s.date()`, `checkbox` for `s.boolean()` (filled as ticked when a refused post or `values` holds it) and `file` for `s.file()` and `s.files()`, with `accept` from their `type` and `multiple` for the list. A `type` the template writes wins, and takes `accept`, `multiple` and `step` with it. A component requiring the field (kayjs-ui's `Field`) sees the schema's type, so a file takes no `aria-required`; `missing-autocomplete` leaves an email `input(field=...)` and a field named like a password alone.
178
+ - `autocomplete` comes from the field's own `autocomplete` option (`s.string({ autocomplete: 'one-time-code' })`), else `email` and `url` for those formats, else the name: `firstName`, `lastName`, `username`, `phone`, `postalCode`, `currentPassword`, `newPassword`, `otp`, `birthday`.
179
+ - `select(field="topic")` with no `option` written renders one per value of `s.enum` or `s.union` of `s.literal`s (a record's texts word them; a field that may be left out starts with a blank option) and selects the one a refused post or `values` holds. A static page and a server island render them; an island's own browser render does not.
180
+ - `s.enum(values)` has no `default` unless the options give one: an optional enum field left out reads `undefined` and a required one is refused with a 422, where Elysia's own fills the first value in.
181
+ - `s.enum(TOPICS)` of a record is an enum of its keys, typed as their union with no cast, for a `select(field="topic")` whose options come from `Object.entries(TOPICS)`.
179
182
  - `field` takes written text, never both `field` and `name`, and only inside such a form.
180
183
  - `kay check` verifies every `field` and `name` against the schema.
181
184
  - Once kay's script runs it sets `novalidate` on every form posting to an action and checks the form against the schema itself, so the schema's `error` messages show rather than the browser's, then the constraints the template wrote itself. `validate` (or `validate="blur"`) on the `form` shows them as text instead, in the `data-field="<name>"` elements outside islands (a FormField's); `blur` checks each field as it loses focus too.
@@ -193,12 +196,12 @@ form(action={add})
193
196
  ### Form values
194
197
 
195
198
  - A plain form posts text, read against the schema before it validates.
196
- - An `s.Number()`, `s.Integer()` or `s.Boolean()` field becomes one, a number only from decimal text such as `-1.5` or `2e3`, never `0x10`.
199
+ - An `s.number()`, `s.int()` or `s.boolean()` field becomes one, a number only from decimal text such as `-1.5` or `2e3`, never `0x10`.
197
200
  - A ticked checkbox posts `on`, read as `true`, and an unticked one nothing, read as `false` when the field is required.
198
- - An `s.Array()` field takes a single value or none as a list.
201
+ - An `s.list()` field takes a single value or none as a list.
199
202
  - The spaces around each text are dropped, so `minLength: 10` counts what was typed and ten spaces fill nothing.
200
- - An optional field left blank counts as left out, `undefined` for `s.Optional(s.String())`.
201
- - A field named like a password or a secret keeps its spaces, as does one whose schema says so, `s.String({ trim: false })` for a code block.
203
+ - An optional field left blank counts as left out, `undefined` for `s.string({ optional: true })`.
204
+ - A field named like a password or a secret keeps its spaces, as does one whose schema says so, `s.string({ trim: false })` for a code block.
202
205
  - A call from an island with its input, not a form's fields, reaches the schema as sent.
203
206
  - An island holding a form may call the action with its fields instead, `await add(new FormData(form))`: the server reads them as it reads a plain form post, numbers, booleans and arrays coerced from their text, spaces around text dropped and a blank optional field left out, files and the honeypot included, and answers as a call, so the island shows the field errors of the `ActionError` and goes on once it resolves.
204
207
  - To check a form in the browser with rules of its own, showing their messages as text rather than the browser's bubbles, an island holding the form gives it `onSubmit` and `novalidate`.
@@ -260,4 +263,4 @@ form(action={add})
260
263
 
261
264
  ### Files
262
265
 
263
- - What an action takes of a file, `s.File()`, `s.Files()`, the form encoding and the body limit, is in [Stored files](files.md#files-posted-to-an-action).
266
+ - What an action takes of a file, `s.file()`, `s.files()`, the form encoding and the body limit, is in [Stored files](files.md#files-posted-to-an-action).
package/llms/analytics.md CHANGED
@@ -38,7 +38,7 @@ export default defineConfig({
38
38
  ```ts
39
39
  import { track } from 'kay/analytics'
40
40
 
41
- export const signup = action(s.Object({ plan: s.String() }), async ({ plan }, ctx) => {
41
+ export const signup = action({ plan: s.string() }, async ({ plan }, ctx) => {
42
42
  await track(ctx, 'signup', { plan })
43
43
  })
44
44
  ```
@@ -51,7 +51,7 @@ export default api()
51
51
  .post(
52
52
  '/answer',
53
53
  ({ body }) => eventStream(complete(body.prompt)),
54
- { body: s.Object({ prompt: s.String() }) },
54
+ { body: s.object({ prompt: s.string() }) },
55
55
  )
56
56
  ```
57
57
 
@@ -16,7 +16,7 @@ export default api()
16
16
  .post(
17
17
  '/',
18
18
  ({ body }) => addNote(body.title),
19
- { body: s.Object({ title: s.String() }) },
19
+ { body: s.object({ title: s.string() }) },
20
20
  )
21
21
  ```
22
22
 
@@ -94,7 +94,7 @@ export default defineConfig({ mcp: true })
94
94
  import { s, action } from 'kay'
95
95
 
96
96
  export const addNote = action(
97
- s.Object({ title: s.String({ minLength: 3, maxLength: 80 }) }),
97
+ { title: s.string({ min: 3, max: 80 }) },
98
98
  async ({ title }) => ({ title }),
99
99
  { tool: 'Create a note' },
100
100
  )
@@ -129,8 +129,8 @@ import { complete, listRooms } from '../data'
129
129
  export default api()
130
130
  .get('/rooms', () => listRooms())
131
131
  .ws('/:room', {
132
- body: s.Object({ text: s.String() }),
133
- response: s.Object({ from: s.String(), text: s.String() }),
132
+ body: s.object({ text: s.string() }),
133
+ response: s.object({ from: s.string(), text: s.string() }),
134
134
  message(ws, { text }) {
135
135
  ws.send({ from: ws.data.user?.name ?? 'guest', text })
136
136
  },
@@ -138,7 +138,7 @@ export default api()
138
138
  .post(
139
139
  '/answer',
140
140
  ({ body }) => eventStream(complete(body.prompt)),
141
- { body: s.Object({ prompt: s.String() }) },
141
+ { body: s.object({ prompt: s.string() }) },
142
142
  )
143
143
  ```
144
144
 
@@ -201,7 +201,7 @@ export default api()
201
201
  ### OpenAPI
202
202
 
203
203
  - `openapi: true` in kay.config.ts serves an OpenAPI 3.1 document of every module's routes at `/api/openapi.json`, read from the schemas they declare.
204
- - Path params are written in braces; `params`, `query` and `headers` are parameters; `body` is JSON, or multipart when it holds an `s.File()`; `response` is one schema or one per status.
204
+ - Path params are written in braces; `params`, `query` and `headers` are parameters; `body` is JSON, or multipart when it holds an `s.file()`; `response` is one schema or one per status.
205
205
  - A route's `detail` gives its `summary`, `description`, `tags`, the module's path by default, and `deprecated`.
206
206
  - `detail: { hide: true }` leaves a route out; websockets are left out.
207
207
  - A route behind guards is marked `x-kay-guarded: true`, with no guard file named. A document no `_guard.ts` of the API directory protects leaves the guarded routes out, as it is open to anyone; behind a guard it lists all.
@@ -83,7 +83,7 @@ kay fmt --check
83
83
  - `--since 1.46` reports and, with `--fix`, fixes the `deprecated` lints that came in that minor alone, as `kay upgrade` runs it; it does not go with `--only`.
84
84
  - `--entry` names the server entry whose `app` types `ctx.locals` and the app routes, `src/server.ts` by default, as `kay build --entry` does (see [Locals](server.md#locals)).
85
85
  - It fails on errors, and on warnings too with `--deny-warnings` (see [Lints and warnings](lints.md#lints-and-warnings)).
86
- - `--fix` first applies the quick fixes that change nothing else, removing an unread prop or writing `onclick` as `onClick`, (with `envFiles` in kay.config.ts, also the raw `process.env.X` reads `kay env` warns of: each is declared in the app's `export const env = defineEnv(s.Object({` or a new `src/env.ts`, a `?? 'default'` becoming its default, the reads `env.X`; one assigned, destructured, in a `.kay` file or beside an `env` of its own keeps its warning, a rewritten file loads the schema, which checks the environment on import, and `kay upgrade` skips it), then reports what is left; the others, such as a key or a `maxLength` to choose, stay the editor's.
86
+ - `--fix` first applies the quick fixes that change nothing else, removing an unread prop or writing `onclick` as `onClick`, (with `envFiles` in kay.config.ts, also the raw `process.env.X` reads `kay env` warns of: each is declared in the app's `export const env = defineEnv(s.object({` or a new `src/env.ts`, a `?? 'default'` becoming its default, the reads `env.X`; one assigned, destructured, in a `.kay` file or beside an `env` of its own keeps its warning, a rewritten file loads the schema, which checks the environment on import, and `kay upgrade` skips it), then reports what is left; the others, such as a key or a `maxLength` to choose, stay the editor's.
87
87
  - `--only seo` prints one group's lints alone, as an audit (see [Lints and warnings](lints.md#lints-and-warnings)).
88
88
  - `--format github` prints each problem as a workflow command, `::error file=...,line=...,col=...::message`, which GitHub and Forgejo Actions show on the diff, as the CI `kay new` writes does, its `file` relative to `GITHUB_WORKSPACE`, the repository's root, when set;
89
89
  - `--format json` prints `{ errors, warnings, problems }` on stdout, each problem's `file` relative to the current directory with its `line`, `column`, `endLine`, `endColumn`, `severity`, `code` and `message`;
@@ -22,8 +22,8 @@
22
22
  | `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
23
  | `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 |
24
24
  | `text-size-colour` | warn | code | A theme colour named like a Tailwind text size (`--color-base`, `--color-lg`) in the project's CSS while a file uses that `text-` utility: `text-base` is then the font size and the text colour at once, so the text takes the colour (the page background where `base` is the ground) and vanishes. Every use is reported. Rename the colour (`--color-background`) or write the size as `text-[1rem]` |
25
- | `unknown-tool-label` | warn | code | A key of a `toolLabels` object on `Chat` that names no tool of the project (an export in snake case, a `tool.name` or the name of a `tool()`), whose calls show the raw name. |
26
- | `public-env-outside-src` | warn | code | An `s.Public(` in a `.ts` file outside `src/` (tests left out), such as `common/env.ts`: kay finds public fields only in the modules under `src`, so an island reads it as a plain string and the browser is not sent it. Declare the field in a `defineEnv` in a module under `src`. Reported by `kay check`, set with `lints` or allowed with `// kay-allow public-env-outside-src` |
25
+ | `unknown-tool-label` | warn | code | A key of a `toolLabels` or `toolIcons` object on `Chat` that names no tool of the project (an export in snake case, a `tool.name` or the name of a `tool()`), whose calls show the raw name or no icon. |
26
+ | `public-env-outside-src` | warn | code | An `s.public(` in a `.ts` file outside `src/` (tests left out), such as `common/env.ts`: kay finds public fields only in the modules under `src`, so an island reads it as a plain string and the browser is not sent it. Declare the field in a `defineEnv` in a module under `src`. Reported by `kay check`, set with `lints` or allowed with `// kay-allow public-env-outside-src` |
27
27
  | `browser-global-at-load` | deny | code | A module a page imports reading `window` or another browser-only name as it loads ([details](browser-only.md#browser-globals-on-the-server)). |
28
28
  | `unmounted-jobs` | warn | code | A `src/jobs.ts` that no plugin under `src/plugins/` and no `src/server.ts` imports directly (not through a third module): the queues in it are mounted by nothing, so none runs. Define and mount queues in `src/jobs/*.ts`, the one home of jobs; a plugin re-exporting `src/jobs.ts` is accepted. |
29
29
  | `unused-status-page` | warn | code | A status page (`_401.kay`, `_403.kay`, `_429.kay`, `_503.kay`) in a directory with no route: it answers for the routes of its directory and below, so no page renders it. Move it beside the pages it answers for, or delete it. |
@@ -20,6 +20,6 @@ for (const diagnostic of diagnostics)
20
20
 
21
21
  - `compileKay(source, filename, options?)` returns `{ tsx, map, island?, cause?, classes, diagnostics }`, `cause` being what makes the component an island: `{ kind, name, span, line, source? }`, `span` the offsets in the source and `source` the module of a `kay` value. `why` is the same cause as a sentence, deprecated for `cause`. A problem in the source is reported in `diagnostics`. `filename` is read for its base name and, with `root`, its island id: a `_layout.kay`, `_404.kay` or `_error.kay`, like a file with a `--- server` fence, is a route file the server renders, never an island.
22
22
  - `tsx` is the generated code: TSX for type checking by default, or with `output: 'html'` or `output: 'dom'` the server's or the browser's code that runs. `map` maps it back to the source, `island` is the component's island id when it renders as one, `classes` the `.class` shorthand names a CSS scanner cannot read off the template.
23
- - Options: `root` (island ids are paths relative to it), `includeServer: false` for a browser build, `params` and `paramTypes` typing `ctx.params`, `check: true` for the type-checking output's link, form field and island prop assertions plus the lints, with `lints` setting their levels, `inspect` for `data-kay-src`, and `hydratable`, `twinBuild`, `clientOnly`, `insideIsland` and `importedSignals`, which kay's own build sets.
23
+ - Options: `root` (island ids are paths relative to it), `includeServer: false` for a browser build, `params` and `paramTypes` typing `ctx.params`, `check: true` for the type-checking output's link, form field and island prop assertions plus the lints, with `lints` setting their levels, `inspect` for `data-kay-src`, and `hydratable`, `twinBuild`, `clientOnly`, `insideIsland` and `importedSignals` and `writtenProps`, which kay's own build sets.
24
24
  - A `Diagnostic` is `{ start, end, message, label?, related?, note?, help?, code?, severity?, fixes? }`, `start` and `end` offsets into `source`, `code` a lint's name, `severity` `'warning'` for a lint at the `warn` level.
25
25
  - `formatDiagnostic(source, filename, diagnostic, paint?)` prints it as `kay check` does, with the file, line and column, the source line and its `help`; `paint` is `(styles, text) => string` for colour, plain text without it.
@@ -118,6 +118,7 @@ export function auth({ prefix = '/auth' } = {}): KayExtension {
118
118
  - `uiConfigEntries(text)` from `kay/library` reads an app's `src/ui.ts` text as `{ key, keySpan, value }` entries (spans into the text, const objects and spreads followed), for a command that rewrites it, as `kay ui eject` does; undefined when it does not parse.
119
119
  - A library keeping its own tables in the app's Postgres reads the connection and the schema like kay's `pgData`: `connectionOf(source)` (a Bun `SQL`, a pg-orm `Database` or a URL, the `PgSource` type), `relationsMissing(db, names)` (whether a table does not exist) and `privilegeRefused(error)` (a statement refused for a role that may not create tables, Postgres 42501), all from `kay/library`.
120
120
  - `references: [path]` lists stylesheets the app's own may `@apply` and read `theme()` of with no `@reference` line, as if each began with one (kayjs-ui lists its `theme.css`): added after the Tailwind import of each stylesheet of the app (or of one using `@apply`, `@variant` or a theme function without it), and it writes no rule.
121
+ - `ui: path` names a module whose default export is `defineUi({ ... })`, written as an app's `src/ui.ts` is (string and object literals only), absolute or relative to the project root: its parts and variants restyle components, the library's own or kayjs-ui's, in every app listing the extension, with no `src/ui.ts` line (see [Restyle a component from src/ui.ts](styles-and-assets.md)). The app's `src/ui.ts` wins over it, a later extension over an earlier one, each part and each variant value replacing the one under it. Keys name components as in `src/ui.ts`, resolved from the app's `src/`; one naming a component the app lacks is ignored, and `kay check` reports the file's other problems. A component a worker imports gets it too, `kay dev`'s Styles tab shows it, and the classes it writes reach the CSS from `node_modules` as well. `kay dev` rebuilds when the file changes inside the project, and picks up one elsewhere on a restart.
121
122
  - `devTool: { module }` names a browser module, `${import.meta.dir}/devTool.ts`, that adds a tab to the dev tool every dev page carries, with no declaration in the app: see [A tab for a library](dev-tool.md#a-tab-for-a-library).
122
123
 
123
124
  The conventions a library follows are in [Component libraries: conventions](component-library-conventions.md).
@@ -55,7 +55,7 @@ export const news = collection({
55
55
  })),
56
56
  ttl: '15m',
57
57
  }, {
58
- schema: s.Object({ title: s.String(), published: s.Boolean() }),
58
+ schema: s.object({ title: s.string(), published: s.boolean() }),
59
59
  draft: post => !post.data.published,
60
60
  })
61
61
  ```
@@ -9,7 +9,7 @@
9
9
  ### Markdown files
10
10
 
11
11
  - A Markdown file starts with YAML frontmatter between `---` lines.
12
- - Every entry's data is read against the schema: defaults filled in, an `s.Date()` decoded from its text. A date that names no day, `2024-02-30` or `T24:00`, or that cannot be decoded, `2024-03-10 10:00` (seconds are needed), is refused at its field's line.
12
+ - Every entry's data is read against the schema: defaults filled in, an `s.date()` decoded from its text. A date that names no day, `2024-02-30` or `T24:00`, or that cannot be decoded, `2024-03-10 10:00` (seconds are needed), is refused at its field's line.
13
13
  - An entry it refuses, or one that does not parse, fails `kay check` at the field's line, naming the field's whole path (`packs.0.price`), and fails `kay build` and the first load; a loader's refused entry is instead left out and logged ([Loaded collections](content-cms.md#loaded-collections)).
14
14
  - Defaults fill nested objects and list items too, and `migrations: [renameField(...), convertField(...), setField(...)]` on the collection carries entries over after a schema change ([Loaded collections](content-cms.md#loaded-collections)).
15
15
  - Headings get ids, unique in the entry, and link to themselves: an ASCII title keeps the lowercase words joined by `-` (`Don’t stop` is `dont-stop`), a title with letters beyond ASCII keeps them (`Été & Café` is `été-café`, `日本語` is `日本語`), a title with no letter or digit is `heading`, and a repeat takes `-1`, `-2` (`a`, `a-1`, `a-1-1`).
@@ -53,8 +53,8 @@ A CMS running in the app's server, as a kay extension, reads and edits the colle
53
53
  - `fieldInput(schema, options)` from `kay/content` tells a CMS how to enter a field (reported as `x-kay-input`): a placeholder, a prefix or suffix, rows, labels, lines, a list item's title or a `when` on a sibling; a collection's `description` is shown above its entries ([kayjs-cms](../../cms/llms/fields.md)).
54
54
  - `unique(schema)` from `kay/content` marks a field (reported as `x-kay-unique: true`) whose value no other entry of the collection, of the same locale in a localized one, may hold: `saveEntry`, a folder entry's source and a draft's check refuse a repeat with the issue `is already the code of a` at the field's path, read against every entry, drafts included. A save of a loaded entry is checked again in its turn; a folder's files cannot be, so two commits of one value pass. Nothing checks entries already stored.
55
55
  - `colorField()`, `moneyField({ currency })`, `tagsField()`, `linkField()`, `geoField()` and `iconField(iconifySet)` from `kay/content` are ready-made kinds with a control in kayjs-cms ([kayjs-cms](../../cms/llms/fields.md#ready-made-kinds)).
56
- - `blocks({ hero: s.Object({ ... }), text: s.Object({ ... }) })` from `kay/content` is a list of items of several types, each stored as an object with a `type` key naming its block (`{ type: 'hero', ... }`) and read as the union discriminated on `type`; a CMS adds an item by its type and shows its own fields ([kayjs-cms](../../cms/llms/fields.md#blocks)).
57
- - `reference`, `imageField`, `fileField`, `markdownField` and `customField` from `kay/content` give fields a CMS edits apart, `reference('authors')` say, reported in the schema as `x-kay: { kind, collection? }`: the slug of another collection's entry ([checked by `kay check`, `kay build` and every write](content.md#point-at-another-collections-entry)), the path the site serves an image or a file at (an upload's `files.url(key)` or a public file's), Markdown. `imageField({ accept, maxSize, minWidth, minHeight, alt, width, height })` and `fileField({ accept, maxSize })` also take what the editor asks of a file and, for an image, the keys of the fields beside it that hold its alt text and size (reported in `x-kay`; `FieldHint` from `kay/content` types it), which kayjs-cms fills in and leaves out of its form ([kayjs-cms](../../cms/llms/uploads.md)). `customField(kind, schema)` wraps any schema, not only a string, in a kind of the app's own, `customField('color', s.String({ pattern: '^#[0-9a-f]{6}$' }))`, which kayjs-cms edits with `src/cms/fields/<kind>.kay` ([kayjs-cms](../../cms/llms.txt)); the schema alone validates a save, and a built-in kind's name (`text`, `image`...) is refused.
56
+ - `blocks({ hero: s.object({ ... }), text: s.object({ ... }) })` from `kay/content` is a list of items of several types, each stored as an object with a `type` key naming its block (`{ type: 'hero', ... }`) and read as the union discriminated on `type`; a CMS adds an item by its type and shows its own fields ([kayjs-cms](../../cms/llms/fields.md#blocks)).
57
+ - `reference`, `imageField`, `fileField`, `markdownField` and `customField` from `kay/content` give fields a CMS edits apart, `reference('authors')` say, reported in the schema as `x-kay: { kind, collection? }`: the slug of another collection's entry ([checked by `kay check`, `kay build` and every write](content.md#point-at-another-collections-entry)), the path the site serves an image or a file at (an upload's `files.url(key)` or a public file's), Markdown. `imageField({ accept, maxSize, minWidth, minHeight, alt, width, height })` and `fileField({ accept, maxSize })` also take what the editor asks of a file and, for an image, the keys of the fields beside it that hold its alt text and size (reported in `x-kay`; `FieldHint` from `kay/content` types it), which kayjs-cms fills in and leaves out of its form ([kayjs-cms](../../cms/llms/uploads.md)). `customField(kind, schema)` wraps any schema, not only a string, in a kind of the app's own, `customField('color', s.string({ pattern: '^#[0-9a-f]{6}$' }))`, which kayjs-cms edits with `src/cms/fields/<kind>.kay` ([kayjs-cms](../../cms/llms.txt)); the schema alone validates a save, and a built-in kind's name (`text`, `image`...) is refused.
58
58
  - `await entries(name, { locale?, slug?, offset?, limit? })` from `kay/content` lists the entries as their source holds them, drafts included, those of one locale, of one slug, or a stretch of them in their order (a folder's files sorted, a loader's as it gives them) when asked, a folder reading no other file, a loader giving every entry and the filter applied after unless it has `get` (`collections()` and `collectionInfo()` from `kay/content` run a loader too, for its body and count, unless it has `count`; reads at the same moment share one run of `load`): `{ slug, locale?, path?, data, body?, draft, problem? }`.
59
59
  - `data` is an object of fields typed by `DataValue` from `kay/content` (data holding a list or a plain value comes with no `data` and its `problem`).
60
60
  - A folder entry's file is as written with its `path` relative to the repository (a file that does not parse comes with no `data` and its `problem`, a Markdown one with its `body` when the frontmatter alone fails; a folder missing, as beside a build alone, throws).
package/llms/content.md CHANGED
@@ -11,11 +11,11 @@ import { s } from 'kay'
11
11
  import { collection } from 'kay/content'
12
12
 
13
13
  export const posts = collection('content/posts', {
14
- schema: s.Object({
15
- title: s.String(),
16
- date: s.Date(),
17
- tags: s.Array(s.String(), { default: [] }),
18
- draft: s.Optional(s.Boolean()),
14
+ schema: s.object({
15
+ title: s.string(),
16
+ date: s.date(),
17
+ tags: s.list(s.string(), { default: [] }),
18
+ draft: s.boolean({ optional: true }),
19
19
  }),
20
20
  route: '/blog/:slug',
21
21
  draft: post => post.data.draft === true,
@@ -66,7 +66,7 @@ A page at the route that reads the request (`ctx.cookies`, `ctx.query`, a sessio
66
66
 
67
67
  ```ts
68
68
  export const posts = collection('content/posts', {
69
- schema: s.Object({ title: s.String(), date: s.Date() }),
69
+ schema: s.object({ title: s.string(), date: s.date() }),
70
70
  route: '/blog/:slug',
71
71
  feed: { path: '/blog/rss.xml', title: 'Blog' },
72
72
  })
@@ -75,7 +75,7 @@ export const posts = collection('content/posts', {
75
75
  - `a(href={post.url}) ...` links it; `url` is the path as `route()` writes it, so kay puts the base and the page's locale on it as on any link.
76
76
  - A localized entry's `url` has its own slug, so `(await posts.translation(post, 'fr'))?.url` is the page of its translation, on a page that read the entry with `get()`, `alternate('fr')` gives it too. A dotted slug, `v1.2`, is a page, not a file; so is an entry's `release.html` (re-read on `invalidate()`); links ending in `.png` are files. A slug the route cannot write (`..`) leaves its entry out, logged. The CMS reads the route before `url`.
77
77
  - A feed item with no `path` links the entry's `url`, absolute on the site, in the locale's feed under its prefix, as `trailingSlash` writes a page's address. A `url` function next to a `route` is overridden by the route, and a feed item's `path` is still read.
78
- - The page whose pattern is the route prerenders and lists its entries in the sitemap by itself, with the entry's head (title, description, dates, the feed's `link rel="alternate"`) and, with `modified: 'updatedAt'` naming an `s.Date()` field, a `lastmod` per URL and `article:modified_time` (`modified: 'mtime'` takes each file's time, `modified: 'git'` its last commit's date from one `git log` for the folder, kept while HEAD stays (a load then costs one `git rev-parse`), a file edited since taking its time, the file's time for a file git does not know or outside a repository; the date is also `entry.modified`, a folder's entry only, and a schema field named `mtime` or `git` is read as a field; a shallow clone dates every file at its one commit, so a `git` build wants the history); its own `prerender`, `sitemap` and `lastmod` win. `kay check` reports two collections with one route, as the page cannot tell which it lists. An optional-param page (`blog/[[page]].kay`) is never taken for it.
78
+ - The page whose pattern is the route prerenders and lists its entries in the sitemap by itself, with the entry's head (title, description, dates, the feed's `link rel="alternate"`) and, with `modified: 'updatedAt'` naming an `s.date()` field, a `lastmod` per URL and `article:modified_time` (`modified: 'mtime'` takes each file's time, `modified: 'git'` its last commit's date from one `git log` for the folder, kept while HEAD stays (a load then costs one `git rev-parse`), a file edited since taking its time, the file's time for a file git does not know or outside a repository; the date is also `entry.modified`, a folder's entry only, and a schema field named `mtime` or `git` is read as a field; a shallow clone dates every file at its one commit, so a `git` build wants the history); its own `prerender`, `sitemap` and `lastmod` win. `kay check` reports two collections with one route, as the page cannot tell which it lists. An optional-param page (`blog/[[page]].kay`) is never taken for it.
79
79
  - The route has one param, the slug: `:slug`, or `*slug` for slugs with folders, and `collection()` refuses any other.
80
80
  - `kay check` reports a route no page's pattern matches (`src/routes/blog/[slug].kay`, whatever its param is named); a page listing the entries in `prerender: posts` while another page serves the route is reported too.
81
81
  - A collection with no `route` has no `url`.
@@ -113,7 +113,7 @@ import { collection } from 'kay/content'
113
113
  import Callout from './components/callout.kay'
114
114
 
115
115
  export const posts = collection('content/posts', {
116
- schema: s.Object({ title: s.String() }),
116
+ schema: s.object({ title: s.string() }),
117
117
  components: { Callout },
118
118
  })
119
119
  ```
@@ -127,7 +127,7 @@ import { s } from 'kay'
127
127
  import { collection } from 'kay/content'
128
128
 
129
129
  export const posts = collection('content/posts', {
130
- schema: s.Object({ title: s.String(), date: s.Date() }),
130
+ schema: s.object({ title: s.string(), date: s.date() }),
131
131
  feed: {
132
132
  path: '/blog/rss.xml',
133
133
  title: 'Blog',
@@ -149,14 +149,14 @@ import { s } from 'kay'
149
149
  import { collection } from 'kay/content'
150
150
 
151
151
  export const posts = collection('content/posts', {
152
- schema: s.Object({ title: s.String() }),
152
+ schema: s.object({ title: s.string() }),
153
153
  localized: true,
154
154
  })
155
155
  ```
156
156
 
157
157
  ### Point at another collection's entry
158
158
 
159
- `reference('authors')` from `kay/content` is a field holding the slug of an entry of the collection exported as `authors`, also in a list (`s.Array(reference('authors'))`), an object or a `blocks()` item. `kay check` and `kay build` fail on a slug that collection has no entry for (any locale's, in a localized one), or on a collection the content config does not export, naming the file and the line of the field; a write through `saveEntry` and `showDraft` refuses it as an issue at the field's path. A collection with a loader is not read by the check, so a reference to it is checked only when written. The check accepts a reference to a draft, as an editor may point at one before publishing it, and `resolve` returns undefined for it until the entry is published.
159
+ `reference('authors')` from `kay/content` is a field holding the slug of an entry of the collection exported as `authors`, also in a list (`s.list(reference('authors'))`), an object or a `blocks()` item. `kay check` and `kay build` fail on a slug that collection has no entry for (any locale's, in a localized one), or on a collection the content config does not export, naming the file and the line of the field; a write through `saveEntry` and `showDraft` refuses it as an issue at the field's path. A collection with a loader is not read by the check, so a reference to it is checked only when written. The check accepts a reference to a draft, as an editor may point at one before publishing it, and `resolve` returns undefined for it until the entry is published.
160
160
 
161
161
  `resolve(slug, collection)` from `kay/content` gives the entry, or undefined for a null, undefined or hidden one (a draft in production), and an array of slugs gives the entries found, in order. In a localized collection it reads as `get` does, the request's locale with the default locale's as fallback:
162
162
 
@@ -173,7 +173,7 @@ p {author?.data.name}
173
173
 
174
174
  ### Render Markdown a user writes
175
175
 
176
- `markdownHtml(text)` from `kay/markdown` renders it as it comes, in an island too, as a `SafeHtml`, its images `loading="lazy"`. Under Tailwind's preflight such text shows unstyled: with kayjs-ui the container takes `class="kui-prose"`. In an island marked (about 15 KB gzip) loads on the first call outside hydration: the text shows as written until it arrives, then a template or effect that called it runs again formatted, and a failed load leaves the text as written. While an island hydrates, that text as written stands in for markup the server drew formatted, which `property` leaves in place, written again after hydration (by an effect running for another value, or from a `memo` that cached it) too, and marked waits for the text to change or be written again, so a page whose Markdown never changes never loads it; a component that changes the HTML before writing it returns the stand-in as it is when `isHeldMarkdown(html)` from `kay/markdown` is true, which is always false on the server. `markdownLoaded()` from `kay/markdown` tells whether marked has arrived, so a component linking words in the HTML reads them from the Markdown itself until then, as the text as written shows no code apart; a template or effect reading it runs again once marked has loaded, it loads nothing, and it is always true on the server. A call outside a template or effect, such as a click handler, awaits `markdownReady()` from `kay/markdown` first, and an island about to stream Markdown starts the load early with `void markdownReady()`, as kayjs-ai's Chat does on send.
176
+ `markdownHtml(text)` from `kay/markdown` renders it as it comes, in an island too, as a `SafeHtml`, its images `loading="lazy"` and a fence's `code` keeping its `language-*` class (no other). A bare URL or address links where Bun.markdown links it, server and island alike (`[[https://x.y/?a=1&b=2]]` links the URL without its brackets), except a URL closed by `**` or `~~` of its own emphasis, where Bun links the marks too (Bun.markdown's own bug, oven-sh/bun#43980), and a URL right after an HTML tag, a code span, an image or an escape, which an island links and Bun leaves as text. `markdownHtml(text, { inline: [{ pattern, render }] })` draws custom inline syntax, in order, outside code and links, server and island alike: `render(match)` gets the match and groups as plain text (`&`, `<`, `>`, `"` stand as entities in what `pattern` reads) and returns text (escaped), a link `{ text, href }` (sanitized like any link) or `undefined` to leave it, e.g. `{ pattern: /\[\[([^\]]+)\]\]/, render: ([, name]) => ({ text: name, href: `/notes/${name}` }) }`. Under Tailwind's preflight such text shows unstyled: with kayjs-ui the container takes `class="kui-prose"`. In an island marked (about 15 KB gzip) loads on the first call outside hydration: the text shows as written until it arrives, then a template or effect that called it runs again formatted, and a failed load leaves the text as written. While an island hydrates, that text as written stands in for markup the server drew formatted, which `property` leaves in place, written again after hydration (by an effect running for another value, or from a `memo` that cached it) too, and marked waits for the text to change or be written again, so a page whose Markdown never changes never loads it; a component that changes the HTML before writing it returns the stand-in as it is when `isHeldMarkdown(html)` from `kay/markdown` is true, which is always false on the server. `markdownLoaded()` from `kay/markdown` tells whether marked has arrived, so a component linking words in the HTML reads them from the Markdown itself until then, as the text as written shows no code apart; a template or effect reading it runs again once marked has loaded, it loads nothing, and it is always true on the server. A call outside a template or effect, such as a click handler, awaits `markdownReady()` from `kay/markdown` first, and an island about to stream Markdown starts the load early with `void markdownReady()`, as kayjs-ai's Chat does on send.
177
177
 
178
178
  ```kay
179
179
  ---
@@ -200,11 +200,11 @@ import { collection } from 'kay/content'
200
200
  import Callout from './components/callout.kay'
201
201
 
202
202
  export const posts = collection('content/posts', {
203
- schema: s.Object({
204
- title: s.String(),
205
- date: s.Date(),
206
- tags: s.Array(s.String(), { default: [] }),
207
- draft: s.Optional(s.Boolean()),
203
+ schema: s.object({
204
+ title: s.string(),
205
+ date: s.date(),
206
+ tags: s.list(s.string(), { default: [] }),
207
+ draft: s.boolean({ optional: true }),
208
208
  }),
209
209
  components: { Callout },
210
210
  draft: post => post.data.draft === true,
@@ -221,7 +221,7 @@ export const posts = collection('content/posts', {
221
221
  })
222
222
 
223
223
  export const authors = collection('content/authors', {
224
- schema: s.Object({ name: s.String() }),
224
+ schema: s.object({ name: s.string() }),
225
225
  })
226
226
  ```
227
227
 
@@ -263,9 +263,9 @@ article
263
263
  - An entry `draft` returns true for shows in development (`kay dev`, or the server's `dev` option, which wins over `NODE_ENV`) and to a visitor in preview mode only.
264
264
  - Everywhere else a draft is left out of `all()`, `get()`, prerendering, the sitemap and the feed.
265
265
  - `draft: 'draft'`, a boolean field's name, holds back the entries where it is true, which a CMS then reads and publishes by writing false.
266
- - `publishAt: 'publishAt'`, an `s.Date()` field's name, holds an entry back until that time, as a draft is, and shows it by itself then, in `all()`, `get()`, `translation()`, the pages prerendered from it, the sitemap and the feed; `kay dev` and preview mode show it at once. An entry with no date, or a date in the past, is published: a server down at that time shows it from its next boot, and one whose loader fails then logs once and reads the dates again every minute, its start waiting for the first read one second at most. A draft stays one whatever its date, so `draft: 'draft'` and `publishAt` together hold an entry until it is neither.
267
- - `unpublishAt: 'endsAt'`, another `s.Date()` field's name, takes an entry down from that time on, as a draft is, in the same places and by itself: the pages that read the collection render again, the page of an ended entry answers 410 Gone when its code calls `ctx.notFound()` after `get()` finds nothing (a draft or an entry not yet published stays 404), or what its code does otherwise (`ctx.redirect(...)`), and a redirect from the path, in `redirects` or added while the site runs, wins over the 410 (any `ctx.notFound()` of the same render answers 410 once `get()` found an ended entry, and an app's own 410 can be redirected the same way), the visit being listed on the missing pages screen, and a server down then catches up as it starts. No date never ends; `kay dev` and preview mode keep showing it; with `publishAt` an entry has a window.
268
- - The date is read as `s.Date()` reads it, never in the server's time zone: `2026-10-20` is 00:00 UTC, and `2026-10-20T08:00:00+02:00` is that instant; write the offset for an hour in your own zone, as an hour with neither `Z` nor an offset is refused. A field that is not an `s.Date()` is a type error in `kay check` and fails the boot.
266
+ - `publishAt: 'publishAt'`, an `s.date()` field's name, holds an entry back until that time, as a draft is, and shows it by itself then, in `all()`, `get()`, `translation()`, the pages prerendered from it, the sitemap and the feed; `kay dev` and preview mode show it at once. An entry with no date, or a date in the past, is published: a server down at that time shows it from its next boot, and one whose loader fails then logs once and reads the dates again every minute, its start waiting for the first read one second at most. A draft stays one whatever its date, so `draft: 'draft'` and `publishAt` together hold an entry until it is neither.
267
+ - `unpublishAt: 'endsAt'`, another `s.date()` field's name, takes an entry down from that time on, as a draft is, in the same places and by itself: the pages that read the collection render again, the page of an ended entry answers 410 Gone when its code calls `ctx.notFound()` after `get()` finds nothing (a draft or an entry not yet published stays 404), or what its code does otherwise (`ctx.redirect(...)`), and a redirect from the path, in `redirects` or added while the site runs, wins over the 410 (any `ctx.notFound()` of the same render answers 410 once `get()` found an ended entry, and an app's own 410 can be redirected the same way), the visit being listed on the missing pages screen, and a server down then catches up as it starts. No date never ends; `kay dev` and preview mode keep showing it; with `publishAt` an entry has a window.
268
+ - The date is read as `s.date()` reads it, never in the server's time zone: `2026-10-20` is 00:00 UTC, and `2026-10-20T08:00:00+02:00` is that instant; write the offset for an hour in your own zone, as an hour with neither `Z` nor an offset is refused. A field that is not an `s.date()` is a type error in `kay check` and fails the boot.
269
269
  - A server refreshes the prerendered pages that read the collection when a date passes, in each process on its own clock, so replicas sharing a store each do it and the app writes no cron, job or webhook; `live: true` pages follow too, and the sitemap is built afresh. The entry's own page, which the build did not list, renders per request until the next build. A static export (`kay build --static`) cannot change by itself: it leaves the entry out until the next build, so rebuild on a schedule in CI.
270
270
  - `order: 'position'`, a number field's name, orders the entries by it, ascending, those without a number last, unless `sort` says otherwise; kayjs-cms then lists them so and moves an entry up or down by writing the field, so the editor never types the numbers.
271
271
  - `live: true` has every open page that read the collection (`all()`, `get()`, `translation()`) in its server fence or a layout's show it afresh in each tab once `posts.invalidate()` drops it, so a kayjs-cms save or removal shows in the other open tabs; it is the collection's side of `cached(..., { live: true })` ([Following cached values](live-values.md#following-cached-values)), with the same cost, and read it directly: a read inside a `cached` load follows only when that `cached` has `live: true`; a page reading it is rendered per request and a static export of it fails with `export-server-render`.
@@ -19,6 +19,8 @@ The lints of the `deprecated` group that came in 1.105 for kayjs-ai, kayjs-ui, k
19
19
  | `deprecated-auth-signed` | warn | deprecated | kayjs-auth's `SignedIn(role=...)` and `SignedOut`, one check written three ways before 1.105: `SignedIn` takes `require` since 1.105, which is what `auth.guard({ require })` takes (a role, a list of which any one passes, a predicate), and its `@else` block holds what a visitor sees, in place of a `SignedOut` beside it. The old forms work until 1.108. Found on a component bound to the library's file in a template. The fix renames `role` to `require`; `SignedOut` and a `role` written beside a `require` are reported with no fix, since the children of a `SignedOut` join the `SignedIn` beside it by hand. |
20
20
  | `deprecated-auth-methods` | warn | deprecated | kayjs-auth's methods under the names they had before 1.105, when the verbs of a group differed and some methods sat on `auth` itself: every group lists with `list`, reads with `get`, writes with `create` and `update`, removes with `delete` and takes back with `revoke`. `organizations.members`, `invitations`, `myInvitations` and `invitation` are `listMembers`, `listInvitations`, `listMyInvitations` and `getInvitation`, `setMemberRoles` and `removeMember` are `updateMemberRoles` and `deleteMember`; `admin.roles` and `admin.auditLog` are `listRoles` and `listAuditLog`; `oauthServer.clients` is `listClients`; `passkeys.rename` is `passkeys.update`; `account.changeUsername`, `profile` and `saveProfile` are `updateUsername`, `getProfile` and `updateProfile`; `oauth.identities` and `providerToken` are `listIdentities` and `getProviderToken`; `magicLink.signInWithCode` is `email.signInWithCode`, the code being the email's. The methods on `auth` went into the group they belong to: `requireAdmin()` is `admin.require()`, `captchaRequired()` and `captchaChallenge()` are `captcha.required()` and `captcha.challenge()`, `provedLately()` and `reprove()` are `proof.recent()` and `proof.renew()`, `scopes()` and `hasScope()` are `tokens.scopes()` and `tokens.hasScope()`, and `oauthResource()`, `oauthOrigin()` and `oauthFixed()` are `oauthServer.resource()`, `origin()` and `fixed()`. The old names work until 1.108. Found on a call whose receiver is named `auth` (`ctx.locals.auth`, `locals.auth`), in the TypeScript files and `.kay` files of the project, a template expression excluded; the fix writes the new name. |
21
21
  | `deprecated-ui-callbacks` | warn | deprecated | A kayjs-ui prop under the name it had before 1.105, when its callback took positional arguments: `onChange` on an Accordion, Tabs or ThemeToggle is `onValueChange`, on a ZoomPane `onPlateChange`, `onSort` on a Table `onSortChange`, and `onActive` on a BarChart, LineChart, ScatterChart, Sparkline or ContributionGraph `onActiveChange`, each name saying what changed and its callback taking one event object (`{ value, tab }`, `{ plate }`, `{ sort }`, `{ index }`). The old names work until 1.108 with their old arguments. Found on a component bound to the library's file in a template. The fix writes the new name and, for an inline arrow function with plain parameter names, destructures the event under them; any other value is renamed by an unsafe fix, which `kay upgrade` leaves to you, since the callback has to take the event. The other callbacks that took positional arguments (`onChange` of a TextInput, `onOpenChange` of a Dialog) keep their names and take the event object with no old form to find: `kay check` reports each call. |
22
+ | `deprecated-callback-handler` | deny | deprecated | A function written for the arguments a kayjs-ui, kayjs-ai or kayjs-cms callback took before 1.105, given to a callback that takes one event object since: `onValueChange={query.set}`, `onCheckedChange={toggle}` with `toggle(on: boolean)` or `onFiles={upload}` with `upload(files: File[])`. Found where the type check refuses the function and the component comes from a `@kayjs` library; the fix writes `event => query.set(event.value)`, passing the fields the handler took, first ones first, and is applied where its parameter is no object (a parameter typed as an object may be written for the event already, so that fix is offered). A handler that is not a plain name, such as an arrow function, is reported with no fix. The old form fails the type check, and would receive the event where it took the value, so the level is `deny` until it is rewritten. |
23
+ | `deprecated-call-result` | deny | deprecated | An island's call read as its data, `const list = await call(notes, '/')` then `list.items`, or `await add(input)` then `.id`, which resolved with the data before 1.105 and answers a `CallResult`, `{ ok: true, data }` or `{ ok: false, error }`, since. Found where the type check refuses a field of a `CallResult`, in a `.kay` script or a module. The fix writes `.orThrow()` after the call, which resolves with the data and throws a refusal as the call did; it is applied where the call is written on an imported name and nothing reads `ok`, `data` or `error` of the answer, and offered otherwise. The old form fails the type check, so the level is `deny`. |
22
24
  | `deprecated-ui-items` | warn | deprecated | The prop holding the list a kayjs-ui component draws, `items` since 1.105 on every one: `tabs` on a Tabs, `avatars` on an AvatarGroup, `entries` on a CommandPalette or a Timeline, `links` on a SideNav, SiteNav or AppHeader, `steps` on Steps, `icons` on an IconPicker and `slides` on a Carousel, and the infinite source `list` of a Table, Carousel, Masonry, MediaGallery, VirtualList and LoadMore, which `items` takes as well (an array or an `infiniteList`; on a Table `items` is the infinite source and `rows` stays the array). `rows` of a Table and `options` of a choice control keep their names. The old names work until 1.108. Found on a component bound to the library's file in a template. The fix writes `items`; it offers none where `items` is already written. TabNav's `tabs` and `links` are two shapes picked by `param`, and the `links` of a SideNav group are data: both keep their names. |
23
25
  | `deprecated-ui-input` | warn | deprecated | The `id`, `title` and `data-*` attributes of a kayjs-ui Toggle, Checkbox, Slider, ColorInput, Combobox (its `id` names the list and stays) or DateInput, which reached the input before 1.105 and are on the root element now, as on every component; the input takes `inputProps`. The old form works on the root until 1.108, so a stylesheet or a script that found the input by its `id` is what changes. Found on a component bound to the library's file in a template. The fix writes them all into one `inputProps={{ ... }}`; it offers none beside an `inputProps` already written. |
24
26
  | `deprecated-ai-language` | warn | deprecated | `language` in the options of kayjs-ai's `transcribe()` and `describeImage()`, `locale` since 1.105: a BCP 47 tag such as `fr` or `pt-BR` as everywhere in kay, which `transcribe()` turns into the ISO 639-1 code its provider takes. The old name works until 1.108. Found on a call of either imported from `@kayjs/ai`, in the options object written in the call, in the TypeScript files and `.kay` files of the project. The fix renames the key, a bare `{ language }` becoming `locale: language`; an object that spreads another, or that has a `locale` already, is reported with no fix. |
@@ -24,9 +24,9 @@ The lints of the `deprecated` group that came in 1.105, each reported until 1.10
24
24
  | `deprecated-config-switch` | warn | deprecated | `proxy: 2` in kay.config.ts, `proxy: { hops: 2 }` since 1.105, where `proxy: 1` is `proxy: true`: every feature key of the config is `false` for off, `true` for its defaults or an object of options, so the number of proxies was a third form of the same switch. The number works until 1.108. Found in the object kay.config.ts exports. The fix writes `true` for 1 and `{ hops: n }` for a whole number above it; a number that is no whole number from 1 is reported with no fix. |
25
25
  | `deprecated-images-keys` | warn | deprecated | The flat keys of `images` in kay.config.ts, grouped since 1.105: `remoteMaxSize` and `remoteTimeout` are `remote: { maxSize, timeout }`, `quality`, `webp` and `avif` are `formats: { quality, webp, avif }`, `maxVariants` and `queue` are `limits: { variants, queue }`. They work until 1.108. The fix moves the keys into their group, unless the object spreads or already has it. |
26
26
  | `deprecated-client-keys` | warn | deprecated | The keys `links`, `offline` and `search` of kay.config.ts, written in `client` since 1.105 with the rest of what the browser is given: `client: { links, offline, search }`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix moves the keys into `client` as written, unless the object spreads, holds a computed key or has a `client` already. |
27
- | `deprecated-config-groups` | warn | deprecated | The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix moves the keys into their group as written, unless the object spreads, holds a computed key or has the group already. |
27
+ | `deprecated-config-groups` | warn | deprecated | The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports, in the `config` of `pages()` and `testSite()` and in the `config` of an extension a file types `KayExtension`, which takes the same keys. The fix moves the keys into their group as written, unless the object spreads, holds a computed key or has the group already. |
28
28
  | `deprecated-i18n-keys` | warn | deprecated | The keys `defaultLocale`, `prefixDefault` and `domains` of `i18n` in kay.config.ts, since 1.105 `default` and `mode`: `mode: 'always'` is `prefixDefault: true` and `mode: { domains }` is `domains`, so a config can no longer give both. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames or rewrites the key where `i18n` is written in place and `default` and `mode` are not there yet; `domains` beside `prefixDefault`, a `prefixDefault` that is no literal `true` and an `i18n` that spreads are reported with no fix. |
29
- | `deprecated-secret-keys` | warn | deprecated | The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: 'x-upstream-key' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` are reported with no fix. |
29
+ | `deprecated-secret-keys` | warn | deprecated | The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: 'x-upstream-key' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` move into its `config`, `mcpKey` always and `proxyKey` where the app's config names the header, and are reported with no fix beside a `config` already written. |
30
30
  | `deprecated-route-keys` | warn | deprecated | `serve.apiPrefix` and the `path` of `openapi`, `mcp`, `health`, `metrics` and `jobs` are `endpoints.api`, `.openapi`, `.mcp`, `.health`, `.metrics` and `.jobs` since 1.105; `openapi.referencePath` is `reference: { path }`. The fix writes a new `endpoints`, unless the object spreads, has an `endpoints` or a comment would be lost. |
31
31
  | `deprecated-app-hooks` | warn | deprecated | The hooks and log of the config under their names before 1.105, when the hooks became flat keys named by the moment they run: `onStart` is `onListen` (a job's `onStart` keeps its name), `observe.onError` is `onError` beside `observe`, and `observe.log` as `'json'` or a function is `{ format: 'json' }` or `{ sink }`. The old forms work until 1.108. Found in the object kay.config.ts exports and in the options of `pages()` and `testSite()` with their `config`. The fix renames and moves the keys; an `onListen` or `onError` already written, a comment in the way or an `observe` that is no literal is reported with no fix. |
32
32
  | `deprecated-hook-context` | warn | deprecated | `ctx` read off the event of an action's `beforeRun`, `onSuccess` and `onError`, `context` since 1.105: every hook event carries one `context`, an action's being its own context beside `ip`, `userAgent` and `userId`. The old field works until 1.108. Found in the hooks written in `actions` of kay.config.ts and in the options of an `action()` call imported from `kay`, as `{ ctx }` in the parameters or `event.ctx`. The fix writes `context: ctx` or `context`; a name given a default is reported with no fix, a hook passed by name is not found. |
@@ -37,7 +37,7 @@ The lints of the `deprecated` group that came in 1.105, each reported until 1.10
37
37
  | `deprecated-env-files` | warn | deprecated | `env: { compose, example }` in kay.config.ts, `envFiles` since 1.105: the key names the compose and example files the declared variables are compared with (or `false` for no comparison), where `env` read as the variables themselves. It works until 1.108. The fix renames the key, unless an `envFiles` is written too. |
38
38
  | `deprecated-context-import` | warn | deprecated | `defineContext` imported from `kay/library`, `kay/server` since 1.105, where `defineEnv` and the other helpers an app imports live. `kay/library` keeps it until 1.108. The fix changes the import's source, or moves the specifier to a new import when others share the line. |
39
39
  | `deprecated-rate-enforce` | warn | deprecated | `enforce(ctx)` on what `rateLimit()` returns, `check(ctx)` since 1.105: `limiter().enforce(key)` counts under a key and refuses nothing, so one name held two jobs, and `check` is the guard's call that refuses with a 429. `count(from)` now gives the window, `{ count, resetAt, wait }`, beside `hit`. The old name works until 1.108. Found on a name bound once to a call of `rateLimit` imported from `kay/server`, in the TypeScript files and `.kay` files of the project, as `kay check` reads no types: a limit reached through a property, a parameter or another file is not found. The fix renames the method. |
40
- | `deprecated-deny-call` | warn | deprecated | `deny(status, 'message', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { data, errors })` as `ctx.fail`: the page again, or an `ActionError`. The text form works until 1.108. Found on a call of `deny`, bare or read off a name, with a literal status from 400 to 599 and a text second argument, in the TypeScript files and `.kay` files of the project. The fix writes the object, unless a comment sits between the arguments or a `data` is given, which an action answers as a failure, not plain text. |
40
+ | `deprecated-deny-call` | warn | deprecated | `deny(status, 'message', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { message, data, errors })` as `ctx.fail` did, the page again or an `ActionError`, so its text form, which stopped with plain text, becomes the form's message after the fix. The text form works until 1.108. Found on a call of `deny`, bare or read off a name, with a literal status from 400 to 599 and a text second argument, in the TypeScript files and `.kay` files of the project. The fix writes the object, unless a comment sits between the arguments or a `data` is given, which an action answers as a failure, not plain text. |
41
41
  | `deprecated-ctx-fail` | warn | deprecated | `ctx.fail(status, data, errors)` of an action, `ctx.deny(status, { data, errors })` since 1.105: an action refuses as a guard and a page do, with one call and one shape, and `deny` throws, so a statement ends the handler as well and `unreturned-fail` has nothing left to report. A text `data` is the `message`: `ctx.fail(409, 'Taken')` is `ctx.deny(409, { message: 'Taken' })`, and `failed()?.data` no longer holds it. `ctx.fail` works until 1.108. Found on `ctx.fail` of an action handler's `ctx`, in the TypeScript files and `.kay` files of the project. The fix is made where the call is returned (`return ctx.fail(...)`, a branch of a conditional or an arrow's body), since a call that was not returned did nothing and `deny` would now stop; the others are reported with no fix. |
42
42
  | `deprecated-refuse-call` | warn | deprecated | `refuse(message, { status, errors, data })`, `refuse(status, { message, errors, data })` since 1.105: the status leads and the rest is the one object `ctx.deny` takes. The old form works until 1.108. Found on a call of `refuse` imported from `kay` or `kay/library` whose first argument is a text, in the TypeScript files and `.kay` files of the project. The fix writes the status (the 403 or 422 the old call chose, when `errors` names fields written in the call) and the object; options that are not an object written in the call, or an `errors` that is not, are reported with no fix. |
43
43
  | `deprecated-format-duration` | warn | deprecated | `formatDuration(ms)` with a bare number, a `Duration` since 1.105: kay's durations carry their unit everywhere, `formatDuration('125m')`, and `formatBytes` takes a `ByteSize` the same way (`formatBytes('1.5kb')`), which also still takes a number of bytes. The old form works until 1.108. Found on a call imported from `kay/i18n` whose argument is a number written as a literal or as arithmetic of literals, in the TypeScript files and `.kay` files of the project; a number held in a variable is a type error in the editor and `kay check` reads no types here. The fix writes the value in milliseconds, `'7500000ms'`. |
@@ -12,12 +12,13 @@ The lints of the `deprecated` group, each the old form a minor replaced, reporte
12
12
 
13
13
  | Lint | Default | Group | Reports |
14
14
  | --- | --- | --- | --- |
15
+ | `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 (collection frontmatter, `defineEnv`), 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. |
15
16
  | `deprecated-uncaught-await` | warn | deprecated | A `// kay-allow uncaught-await` comment or a `lints: { 'uncaught-await': ... }` entry of kay.config.ts, since 1.105: the `uncaught-await` lint is gone, as an `await` with no `catch` renders the `catch` of the `try` around it, else an alert (`data-kay-await-failed`, worded by the `kay.await.failed` message) in its place, the rejection reported either way. The fix removes the comment, or the name from a list of lints, or the config entry. |
16
17
  | `deprecated-script-fence` | warn | deprecated | `--- script` as the first fence of a file, since 1.102: `---`, the same fence, so a file has one spelling of it. `--- script` stays for a script that follows a `--- server`, `--- module` or `--- style` fence, where a bare `---` would close that fence. The old form works until 1.105. The fix drops the word, keeping the type parameters of `--- script <T>`. |
17
18
  | `deprecated-schema-type` | warn | deprecated | `TSchema` imported from `kay/library`, `Schema` since 1.103: kay's own name for what `s` builds and every schema option takes, so a signature of the app does not name TypeBox, whose type follows the Elysia kay is built on. The old name works until 1.106. Found on an import from `kay/library` in the TypeScript files and `.kay` files of the project. The fix renames the import and each use of it; a file that already has a `Schema` of its own is reported with no fix, and one that imports it aliased with only the import renamed. |
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 in the imports, config keys and stylesheet imports of the project's TypeScript, `.kay` and CSS files, and in its package.json and tsconfig files, never in a comment or a sentence of a string that names a package. 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-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
20
  | `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. |
21
+ | `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
22
  | `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
 
23
24
  The rows of the lints that came in 1.105 are in [Deprecated lints of 1.105](deprecated-lints-1-105.md).