@kayjs/kay 1.108.0 → 1.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (595) hide show
  1. package/dist/eslint.js +2093 -3774
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +5 -5
  5. package/llms/actions-refused-fields.md +4 -4
  6. package/llms/api-from-islands.md +6 -6
  7. package/llms/browser-only.md +2 -2
  8. package/llms/cdn-caching.md +1 -1
  9. package/llms/checks.md +1 -1
  10. package/llms/code-lints.md +1 -2
  11. package/llms/component-library-conventions.md +1 -1
  12. package/llms/components.md +5 -5
  13. package/llms/deprecated-lints.md +2 -7
  14. package/llms/effects.md +1 -1
  15. package/llms/errors.md +2 -2
  16. package/llms/events.md +1 -1
  17. package/llms/guards.md +1 -1
  18. package/llms/head.md +1 -1
  19. package/llms/hooks.md +2 -2
  20. package/llms/images.md +1 -1
  21. package/llms/island-and-form-lints.md +4 -2
  22. package/llms/island-sources.md +1 -1
  23. package/llms/islands-state-to-ids.md +2 -2
  24. package/llms/islands.md +8 -4
  25. package/llms/lints.md +1 -1
  26. package/llms/live-values.md +4 -4
  27. package/llms/local-collections.md +1 -1
  28. package/llms/locales.md +1 -1
  29. package/llms/mcp.md +2 -2
  30. package/llms/metrics.md +1 -1
  31. package/llms/navigation-from-code.md +7 -7
  32. package/llms/navigation.md +4 -2
  33. package/llms/prerendering.md +1 -0
  34. package/llms/production.md +2 -2
  35. package/llms/project-new-and-add.md +1 -1
  36. package/llms/project.md +4 -4
  37. package/llms/proxy-and-security.md +1 -1
  38. package/llms/queues.md +1 -1
  39. package/llms/rate-limits.md +4 -4
  40. package/llms/rendering.md +1 -1
  41. package/llms/server-islands.md +2 -2
  42. package/llms/server.md +1 -1
  43. package/llms/stores.md +1 -1
  44. package/llms/styles-and-assets.md +1 -1
  45. package/llms/templates-elements-slots-snippets.md +2 -2
  46. package/llms/testing-mount.md +49 -0
  47. package/llms/testing.md +4 -45
  48. package/llms/upgrading-1-105-config.md +13 -13
  49. package/llms/upgrading-archive.md +64 -74
  50. package/llms/upgrading.md +92 -70
  51. package/llms/whats-new.md +24 -0
  52. package/llms.txt +5 -6
  53. package/package.json +6 -10
  54. package/src/build/route-sizes.ts +2 -3
  55. package/src/build/variants.ts +132 -18
  56. package/src/check/browser-global-reads.ts +2 -2
  57. package/src/check/config-objects.ts +1 -1
  58. package/src/check/diagnose.ts +0 -22
  59. package/src/check/env-types.ts +1 -1
  60. package/src/check/export-homes.ts +1 -1
  61. package/src/check/guards.ts +3 -3
  62. package/src/check/index.ts +2 -7
  63. package/src/check/moved-keys.ts +1 -1
  64. package/src/check/project.ts +6 -7
  65. package/src/check/schema-builders.ts +125 -26
  66. package/src/check/shadow-types.ts +0 -86
  67. package/src/commands/check.ts +2 -2
  68. package/src/commands/env.ts +25 -3
  69. package/src/commands/upgrade.ts +2 -1
  70. package/src/compiler/allow-comments.ts +38 -2
  71. package/src/compiler/ast.ts +21 -19
  72. package/src/compiler/browser.ts +2 -14
  73. package/src/compiler/class-items.ts +16 -0
  74. package/src/compiler/codegen.ts +10 -10
  75. package/src/compiler/deprecated-library.ts +0 -12
  76. package/src/compiler/deprecated-lints-1-106.ts +2 -2
  77. package/src/compiler/deprecated-lints.ts +3 -495
  78. package/src/compiler/deprecated-ui-props.ts +5 -5
  79. package/src/compiler/errors.ts +2 -2
  80. package/src/compiler/fence-checks.ts +2 -121
  81. package/src/compiler/hand-parts.ts +83 -0
  82. package/src/compiler/helper-imports.ts +2 -2
  83. package/src/compiler/image-attributes.ts +1 -3
  84. package/src/compiler/index.ts +23 -23
  85. package/src/compiler/island-arguments.ts +17 -95
  86. package/src/compiler/island-cause.ts +7 -7
  87. package/src/compiler/island-declaration.ts +2 -8
  88. package/src/compiler/island-lints.ts +19 -0
  89. package/src/compiler/island-marker.ts +3 -3
  90. package/src/compiler/island-problems.ts +25 -0
  91. package/src/compiler/items.ts +12 -0
  92. package/src/compiler/jsx-class.ts +1 -25
  93. package/src/compiler/jsx.ts +7 -6
  94. package/src/compiler/kay-exports.ts +0 -2
  95. package/src/compiler/link-flags.ts +9 -38
  96. package/src/compiler/lints.ts +10 -18
  97. package/src/compiler/markup.ts +33 -41
  98. package/src/compiler/module-signals.ts +2 -2
  99. package/src/compiler/names.ts +1 -1
  100. package/src/compiler/page-settings.ts +11 -0
  101. package/src/compiler/parser.ts +6 -8
  102. package/src/compiler/plan.ts +1 -3
  103. package/src/compiler/removed-lints.ts +90 -0
  104. package/src/compiler/rewrite.ts +3 -18
  105. package/src/compiler/script-server.ts +8 -3
  106. package/src/compiler/signal-from-prop.ts +141 -0
  107. package/src/compiler/template-reads.ts +16 -0
  108. package/src/compiler/validate.ts +3 -8
  109. package/src/config-loader.ts +14 -4
  110. package/src/config-resolve.ts +18 -142
  111. package/src/config-shape.ts +44 -34
  112. package/src/config.ts +10 -114
  113. package/src/dev/preload.ts +4 -1
  114. package/src/lsp/server.ts +4 -0
  115. package/src/migrate/markup.ts +4 -1
  116. package/src/runtime/action-call.ts +0 -8
  117. package/src/runtime/action-encode.ts +26 -0
  118. package/src/runtime/action-error.ts +3 -11
  119. package/src/runtime/action-protection.ts +2 -2
  120. package/src/runtime/action-run.ts +2 -27
  121. package/src/runtime/action-shared.ts +14 -37
  122. package/src/runtime/action-stream.ts +0 -1
  123. package/src/runtime/action.ts +1 -1
  124. package/src/runtime/call-result.ts +2 -10
  125. package/src/runtime/checks.ts +25 -13
  126. package/src/runtime/client.ts +7 -11
  127. package/src/runtime/core.ts +5 -23
  128. package/src/runtime/dom.ts +1 -1
  129. package/src/runtime/html.ts +1 -1
  130. package/src/runtime/i18n.client.ts +1 -4
  131. package/src/runtime/i18n.server.ts +1 -4
  132. package/src/runtime/i18n.ts +3 -3
  133. package/src/runtime/image.ts +2 -19
  134. package/src/runtime/index.ts +3 -3
  135. package/src/runtime/island.server.ts +56 -13
  136. package/src/runtime/live-resource.server.ts +0 -1
  137. package/src/runtime/live-value.server.ts +2 -2
  138. package/src/runtime/live-value.shared.ts +7 -20
  139. package/src/runtime/live.ts +1 -12
  140. package/src/runtime/local-types.ts +1 -11
  141. package/src/runtime/local.ts +4 -14
  142. package/src/runtime/navigate-api.ts +2 -5
  143. package/src/runtime/navigate.ts +9 -0
  144. package/src/runtime/navigation-state.ts +0 -12
  145. package/src/runtime/navigation.ts +5 -1
  146. package/src/runtime/page-swap.ts +8 -8
  147. package/src/runtime/persist.ts +11 -3
  148. package/src/runtime/persisted.ts +4 -30
  149. package/src/runtime/presence.ts +6 -7
  150. package/src/runtime/query-param.ts +20 -12
  151. package/src/runtime/reactive.ts +3 -1
  152. package/src/runtime/refuse.ts +3 -17
  153. package/src/runtime/store-base.ts +4 -6
  154. package/src/runtime/swap-fetch.ts +1 -1
  155. package/src/runtime/swap-flight.ts +10 -10
  156. package/src/runtime/swap-kept.ts +69 -29
  157. package/src/runtime/swap-morph.ts +49 -9
  158. package/src/runtime/text-hash.ts +17 -0
  159. package/src/runtime/uid.server.ts +6 -4
  160. package/src/runtime/values.ts +52 -23
  161. package/src/runtime/with-query.ts +9 -0
  162. package/src/server/action-hooks.ts +8 -8
  163. package/src/server/actions.ts +13 -14
  164. package/src/server/api-modules.ts +2 -3
  165. package/src/server/app-stages.ts +15 -33
  166. package/src/server/app.ts +10 -5
  167. package/src/server/auth-mails.ts +0 -2
  168. package/src/server/env-state.ts +40 -10
  169. package/src/server/flash.ts +1 -1
  170. package/src/server/guard-requirement.ts +4 -4
  171. package/src/server/image.ts +2 -2
  172. package/src/server/index.ts +0 -2
  173. package/src/server/job-context.ts +3 -3
  174. package/src/server/jobs-page.ts +1 -1
  175. package/src/server/jobs.ts +5 -9
  176. package/src/server/kept-exports.ts +0 -2
  177. package/src/server/kv.ts +11 -14
  178. package/src/server/library.ts +1 -3
  179. package/src/server/live.ts +2 -2
  180. package/src/server/mcp.ts +3 -9
  181. package/src/server/metrics.ts +2 -4
  182. package/src/server/page-settings.ts +10 -19
  183. package/src/server/prerender.ts +19 -2
  184. package/src/server/protection.ts +15 -18
  185. package/src/server/queue.ts +3 -6
  186. package/src/server/rate-limit.ts +0 -3
  187. package/src/server/render-document.ts +9 -7
  188. package/src/server/render.ts +1 -1
  189. package/src/server/routes.ts +7 -3
  190. package/src/server/scope.ts +3 -2
  191. package/src/server/session.ts +5 -6
  192. package/src/server/setup.ts +1 -1
  193. package/src/server/signals.ts +17 -7
  194. package/src/server/signed.ts +1 -3
  195. package/src/server/source.ts +20 -4
  196. package/src/server/speculation.ts +1 -1
  197. package/src/server/storage.ts +3 -8
  198. package/src/server/validate.ts +1 -1
  199. package/src/server/vitals.ts +1 -3
  200. package/src/server/work-scope.ts +2 -4
  201. package/src/server/work.ts +1 -1
  202. package/src/server/workflow.ts +1 -1
  203. package/src/test/index.ts +2 -1
  204. package/src/test/site-actions.ts +16 -6
  205. package/src/test/site-keys.ts +10 -15
  206. package/src/test/site-socket.ts +1 -2
  207. package/src/test/site-types.ts +0 -8
  208. package/types/build/route-sizes.d.ts.map +1 -1
  209. package/types/build/variants.d.ts +9 -1
  210. package/types/build/variants.d.ts.map +1 -1
  211. package/types/check/diagnose.d.ts.map +1 -1
  212. package/types/check/index.d.ts +1 -2
  213. package/types/check/index.d.ts.map +1 -1
  214. package/types/check/project.d.ts.map +1 -1
  215. package/types/check/schema-builders.d.ts.map +1 -1
  216. package/types/check/shadow-types.d.ts.map +1 -1
  217. package/types/commands/env.d.ts.map +1 -1
  218. package/types/commands/upgrade.d.ts.map +1 -1
  219. package/types/compiler/allow-comments.d.ts +2 -0
  220. package/types/compiler/allow-comments.d.ts.map +1 -1
  221. package/types/compiler/ast.d.ts +1 -2
  222. package/types/compiler/ast.d.ts.map +1 -1
  223. package/types/compiler/browser.d.ts.map +1 -1
  224. package/types/compiler/class-items.d.ts +7 -0
  225. package/types/compiler/class-items.d.ts.map +1 -0
  226. package/types/compiler/deprecated-library.d.ts.map +1 -1
  227. package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
  228. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
  229. package/types/compiler/deprecated-lints.d.ts +2 -553
  230. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  231. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  232. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  233. package/types/compiler/errors.d.ts +2 -2
  234. package/types/compiler/errors.d.ts.map +1 -1
  235. package/types/compiler/fence-checks.d.ts +0 -1
  236. package/types/compiler/fence-checks.d.ts.map +1 -1
  237. package/types/compiler/hand-parts.d.ts +10 -0
  238. package/types/compiler/hand-parts.d.ts.map +1 -0
  239. package/types/compiler/image-attributes.d.ts +0 -1
  240. package/types/compiler/image-attributes.d.ts.map +1 -1
  241. package/types/compiler/index.d.ts.map +1 -1
  242. package/types/compiler/island-arguments.d.ts +7 -11
  243. package/types/compiler/island-arguments.d.ts.map +1 -1
  244. package/types/compiler/island-cause.d.ts +1 -1
  245. package/types/compiler/island-cause.d.ts.map +1 -1
  246. package/types/compiler/island-declaration.d.ts +1 -3
  247. package/types/compiler/island-declaration.d.ts.map +1 -1
  248. package/types/compiler/island-lints.d.ts +17 -0
  249. package/types/compiler/island-lints.d.ts.map +1 -0
  250. package/types/compiler/island-problems.d.ts +7 -0
  251. package/types/compiler/island-problems.d.ts.map +1 -0
  252. package/types/compiler/items.d.ts +1 -0
  253. package/types/compiler/items.d.ts.map +1 -1
  254. package/types/compiler/jsx-class.d.ts +1 -2
  255. package/types/compiler/jsx-class.d.ts.map +1 -1
  256. package/types/compiler/jsx.d.ts.map +1 -1
  257. package/types/compiler/kay-exports.d.ts.map +1 -1
  258. package/types/compiler/link-flags.d.ts +0 -6
  259. package/types/compiler/link-flags.d.ts.map +1 -1
  260. package/types/compiler/lints.d.ts +21 -566
  261. package/types/compiler/lints.d.ts.map +1 -1
  262. package/types/compiler/markup.d.ts +1 -1
  263. package/types/compiler/markup.d.ts.map +1 -1
  264. package/types/compiler/module-signals.d.ts.map +1 -1
  265. package/types/compiler/names.d.ts.map +1 -1
  266. package/types/compiler/page-settings.d.ts +4 -0
  267. package/types/compiler/page-settings.d.ts.map +1 -1
  268. package/types/compiler/parser.d.ts.map +1 -1
  269. package/types/compiler/plan.d.ts.map +1 -1
  270. package/types/compiler/removed-lints.d.ts +3 -0
  271. package/types/compiler/removed-lints.d.ts.map +1 -0
  272. package/types/compiler/script-server.d.ts.map +1 -1
  273. package/types/compiler/signal-from-prop.d.ts +4 -0
  274. package/types/compiler/signal-from-prop.d.ts.map +1 -0
  275. package/types/compiler/template-reads.d.ts +1 -0
  276. package/types/compiler/template-reads.d.ts.map +1 -1
  277. package/types/compiler/validate.d.ts.map +1 -1
  278. package/types/config-loader.d.ts.map +1 -1
  279. package/types/config-resolve.d.ts.map +1 -1
  280. package/types/config-shape.d.ts +1 -1
  281. package/types/config-shape.d.ts.map +1 -1
  282. package/types/config.d.ts +5 -105
  283. package/types/config.d.ts.map +1 -1
  284. package/types/dev/preload.d.ts.map +1 -1
  285. package/types/lsp/server.d.ts.map +1 -1
  286. package/types/migrate/markup.d.ts.map +1 -1
  287. package/types/runtime/action-call.d.ts.map +1 -1
  288. package/types/runtime/action-encode.d.ts +1 -0
  289. package/types/runtime/action-encode.d.ts.map +1 -1
  290. package/types/runtime/action-error.d.ts +1 -2
  291. package/types/runtime/action-error.d.ts.map +1 -1
  292. package/types/runtime/action-run.d.ts.map +1 -1
  293. package/types/runtime/action-shared.d.ts +1 -27
  294. package/types/runtime/action-shared.d.ts.map +1 -1
  295. package/types/runtime/action-stream.d.ts.map +1 -1
  296. package/types/runtime/action.d.ts +1 -1
  297. package/types/runtime/action.d.ts.map +1 -1
  298. package/types/runtime/call-result.d.ts +0 -10
  299. package/types/runtime/call-result.d.ts.map +1 -1
  300. package/types/runtime/checks.d.ts +14 -11
  301. package/types/runtime/checks.d.ts.map +1 -1
  302. package/types/runtime/client.d.ts.map +1 -1
  303. package/types/runtime/core.d.ts +2 -20
  304. package/types/runtime/core.d.ts.map +1 -1
  305. package/types/runtime/dom.d.ts +1 -1
  306. package/types/runtime/dom.d.ts.map +1 -1
  307. package/types/runtime/html.d.ts +1 -1
  308. package/types/runtime/html.d.ts.map +1 -1
  309. package/types/runtime/i18n.client.d.ts +0 -1
  310. package/types/runtime/i18n.client.d.ts.map +1 -1
  311. package/types/runtime/i18n.d.ts +1 -1
  312. package/types/runtime/i18n.d.ts.map +1 -1
  313. package/types/runtime/i18n.server.d.ts +0 -1
  314. package/types/runtime/i18n.server.d.ts.map +1 -1
  315. package/types/runtime/image.d.ts.map +1 -1
  316. package/types/runtime/index.d.ts +3 -3
  317. package/types/runtime/index.d.ts.map +1 -1
  318. package/types/runtime/island.server.d.ts +2 -0
  319. package/types/runtime/island.server.d.ts.map +1 -1
  320. package/types/runtime/live-resource.server.d.ts.map +1 -1
  321. package/types/runtime/live-value.shared.d.ts +7 -15
  322. package/types/runtime/live-value.shared.d.ts.map +1 -1
  323. package/types/runtime/live.d.ts +0 -11
  324. package/types/runtime/live.d.ts.map +1 -1
  325. package/types/runtime/local-types.d.ts +0 -14
  326. package/types/runtime/local-types.d.ts.map +1 -1
  327. package/types/runtime/navigate-api.d.ts +0 -4
  328. package/types/runtime/navigate-api.d.ts.map +1 -1
  329. package/types/runtime/navigate.d.ts.map +1 -1
  330. package/types/runtime/navigation-state.d.ts +0 -4
  331. package/types/runtime/navigation-state.d.ts.map +1 -1
  332. package/types/runtime/navigation.d.ts +2 -0
  333. package/types/runtime/navigation.d.ts.map +1 -1
  334. package/types/runtime/page-swap.d.ts.map +1 -1
  335. package/types/runtime/persist.d.ts +1 -0
  336. package/types/runtime/persist.d.ts.map +1 -1
  337. package/types/runtime/persisted.d.ts +0 -15
  338. package/types/runtime/persisted.d.ts.map +1 -1
  339. package/types/runtime/presence.d.ts +0 -2
  340. package/types/runtime/presence.d.ts.map +1 -1
  341. package/types/runtime/query-param.d.ts.map +1 -1
  342. package/types/runtime/reactive.d.ts +2 -1
  343. package/types/runtime/reactive.d.ts.map +1 -1
  344. package/types/runtime/refuse.d.ts +0 -7
  345. package/types/runtime/refuse.d.ts.map +1 -1
  346. package/types/runtime/store-base.d.ts +1 -2
  347. package/types/runtime/store-base.d.ts.map +1 -1
  348. package/types/runtime/swap-flight.d.ts +1 -1
  349. package/types/runtime/swap-flight.d.ts.map +1 -1
  350. package/types/runtime/swap-kept.d.ts.map +1 -1
  351. package/types/runtime/swap-morph.d.ts.map +1 -1
  352. package/types/runtime/text-hash.d.ts +2 -0
  353. package/types/runtime/text-hash.d.ts.map +1 -0
  354. package/types/runtime/uid.server.d.ts.map +1 -1
  355. package/types/runtime/values.d.ts +6 -1
  356. package/types/runtime/values.d.ts.map +1 -1
  357. package/types/runtime/with-query.d.ts +2 -0
  358. package/types/runtime/with-query.d.ts.map +1 -1
  359. package/types/server/action-hooks.d.ts +4 -4
  360. package/types/server/action-hooks.d.ts.map +1 -1
  361. package/types/server/actions.d.ts.map +1 -1
  362. package/types/server/api-modules.d.ts +0 -1
  363. package/types/server/api-modules.d.ts.map +1 -1
  364. package/types/server/app-stages.d.ts +5 -13
  365. package/types/server/app-stages.d.ts.map +1 -1
  366. package/types/server/app.d.ts +3 -8
  367. package/types/server/app.d.ts.map +1 -1
  368. package/types/server/auth-mails.d.ts +0 -5
  369. package/types/server/auth-mails.d.ts.map +1 -1
  370. package/types/server/env-state.d.ts +1 -0
  371. package/types/server/env-state.d.ts.map +1 -1
  372. package/types/server/guard-requirement.d.ts +0 -1
  373. package/types/server/guard-requirement.d.ts.map +1 -1
  374. package/types/server/image.d.ts +0 -1
  375. package/types/server/image.d.ts.map +1 -1
  376. package/types/server/index.d.ts +0 -2
  377. package/types/server/index.d.ts.map +1 -1
  378. package/types/server/job-context.d.ts +1 -1
  379. package/types/server/job-context.d.ts.map +1 -1
  380. package/types/server/jobs.d.ts +0 -4
  381. package/types/server/jobs.d.ts.map +1 -1
  382. package/types/server/kept-exports.d.ts.map +1 -1
  383. package/types/server/kv.d.ts +4 -4
  384. package/types/server/kv.d.ts.map +1 -1
  385. package/types/server/library.d.ts +1 -3
  386. package/types/server/library.d.ts.map +1 -1
  387. package/types/server/mcp.d.ts +0 -1
  388. package/types/server/mcp.d.ts.map +1 -1
  389. package/types/server/metrics.d.ts +0 -5
  390. package/types/server/metrics.d.ts.map +1 -1
  391. package/types/server/page-settings.d.ts +3 -3
  392. package/types/server/page-settings.d.ts.map +1 -1
  393. package/types/server/prerender.d.ts.map +1 -1
  394. package/types/server/protection.d.ts +6 -6
  395. package/types/server/protection.d.ts.map +1 -1
  396. package/types/server/queue.d.ts +1 -3
  397. package/types/server/queue.d.ts.map +1 -1
  398. package/types/server/rate-limit.d.ts +0 -2
  399. package/types/server/rate-limit.d.ts.map +1 -1
  400. package/types/server/render-document.d.ts +1 -1
  401. package/types/server/render-document.d.ts.map +1 -1
  402. package/types/server/routes.d.ts +1 -1
  403. package/types/server/routes.d.ts.map +1 -1
  404. package/types/server/scope.d.ts.map +1 -1
  405. package/types/server/session.d.ts +1 -1
  406. package/types/server/session.d.ts.map +1 -1
  407. package/types/server/signals.d.ts.map +1 -1
  408. package/types/server/signed.d.ts +0 -2
  409. package/types/server/signed.d.ts.map +1 -1
  410. package/types/server/source.d.ts +1 -1
  411. package/types/server/source.d.ts.map +1 -1
  412. package/types/server/storage.d.ts +0 -4
  413. package/types/server/storage.d.ts.map +1 -1
  414. package/types/server/vitals.d.ts +0 -1
  415. package/types/server/vitals.d.ts.map +1 -1
  416. package/types/server/work-scope.d.ts +0 -2
  417. package/types/server/work-scope.d.ts.map +1 -1
  418. package/types/server/workflow.d.ts +1 -1
  419. package/types/server/workflow.d.ts.map +1 -1
  420. package/types/test/index.d.ts.map +1 -1
  421. package/types/test/site-actions.d.ts +1 -1
  422. package/types/test/site-actions.d.ts.map +1 -1
  423. package/types/test/site-keys.d.ts +1 -1
  424. package/types/test/site-keys.d.ts.map +1 -1
  425. package/types/test/site-socket.d.ts +1 -1
  426. package/types/test/site-socket.d.ts.map +1 -1
  427. package/types/test/site-types.d.ts +0 -8
  428. package/types/test/site-types.d.ts.map +1 -1
  429. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  430. package/llms/deprecated-lints-1-105.md +0 -58
  431. package/src/check/action-readers.ts +0 -115
  432. package/src/check/action-type.ts +0 -44
  433. package/src/check/ai-language.ts +0 -56
  434. package/src/check/app-hooks.ts +0 -90
  435. package/src/check/auth-methods.ts +0 -85
  436. package/src/check/auth-rate-limits.ts +0 -99
  437. package/src/check/call-result.ts +0 -242
  438. package/src/check/client-keys.ts +0 -10
  439. package/src/check/cms-options.ts +0 -81
  440. package/src/check/config-groups.ts +0 -22
  441. package/src/check/config-switches.ts +0 -38
  442. package/src/check/context-import.ts +0 -51
  443. package/src/check/env-files.ts +0 -31
  444. package/src/check/format-duration.ts +0 -75
  445. package/src/check/guard-options.ts +0 -58
  446. package/src/check/handler-events.ts +0 -149
  447. package/src/check/hook-context.ts +0 -94
  448. package/src/check/hook-names.ts +0 -104
  449. package/src/check/i18n-keys.ts +0 -50
  450. package/src/check/images-keys.ts +0 -54
  451. package/src/check/job-shapes.ts +0 -273
  452. package/src/check/link-flag-tests.ts +0 -130
  453. package/src/check/live-api.ts +0 -137
  454. package/src/check/mail-api.ts +0 -67
  455. package/src/check/one-state-api.ts +0 -357
  456. package/src/check/pages-options.ts +0 -35
  457. package/src/check/rate-enforce.ts +0 -53
  458. package/src/check/refusal-calls.ts +0 -185
  459. package/src/check/retired-lints.ts +0 -49
  460. package/src/check/route-keys.ts +0 -166
  461. package/src/check/secret-keys.ts +0 -83
  462. package/src/check/socket-frames.ts +0 -102
  463. package/src/check/source-readers.ts +0 -257
  464. package/src/check/store-ms.ts +0 -72
  465. package/src/check/store-names.ts +0 -88
  466. package/src/check/test-helpers.ts +0 -98
  467. package/src/check/ttl-names.ts +0 -142
  468. package/src/compiler/deprecated-ai-labels.ts +0 -97
  469. package/src/compiler/deprecated-ai-links.ts +0 -63
  470. package/src/compiler/deprecated-allow.ts +0 -50
  471. package/src/compiler/deprecated-auth-lints.ts +0 -14
  472. package/src/compiler/deprecated-auth-signed.ts +0 -29
  473. package/src/compiler/deprecated-children.ts +0 -66
  474. package/src/compiler/deprecated-image.ts +0 -116
  475. package/src/compiler/deprecated-island.ts +0 -155
  476. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  477. package/src/compiler/deprecated-page.ts +0 -125
  478. package/src/compiler/deprecated-parts.ts +0 -22
  479. package/src/compiler/deprecated-typed-lints.ts +0 -23
  480. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  481. package/src/compiler/deprecated-ui-input.ts +0 -97
  482. package/src/compiler/deprecated-ui-items.ts +0 -47
  483. package/src/compiler/old-parts.ts +0 -84
  484. package/src/runtime/mount.compat.ts +0 -8
  485. package/src/server/moved-exports.ts +0 -17
  486. package/types/check/action-readers.d.ts +0 -3
  487. package/types/check/action-readers.d.ts.map +0 -1
  488. package/types/check/action-type.d.ts +0 -3
  489. package/types/check/action-type.d.ts.map +0 -1
  490. package/types/check/ai-language.d.ts +0 -3
  491. package/types/check/ai-language.d.ts.map +0 -1
  492. package/types/check/app-hooks.d.ts +0 -3
  493. package/types/check/app-hooks.d.ts.map +0 -1
  494. package/types/check/auth-methods.d.ts +0 -3
  495. package/types/check/auth-methods.d.ts.map +0 -1
  496. package/types/check/auth-rate-limits.d.ts +0 -3
  497. package/types/check/auth-rate-limits.d.ts.map +0 -1
  498. package/types/check/call-result.d.ts +0 -7
  499. package/types/check/call-result.d.ts.map +0 -1
  500. package/types/check/client-keys.d.ts +0 -3
  501. package/types/check/client-keys.d.ts.map +0 -1
  502. package/types/check/cms-options.d.ts +0 -3
  503. package/types/check/cms-options.d.ts.map +0 -1
  504. package/types/check/config-groups.d.ts +0 -3
  505. package/types/check/config-groups.d.ts.map +0 -1
  506. package/types/check/config-switches.d.ts +0 -3
  507. package/types/check/config-switches.d.ts.map +0 -1
  508. package/types/check/context-import.d.ts +0 -3
  509. package/types/check/context-import.d.ts.map +0 -1
  510. package/types/check/env-files.d.ts +0 -3
  511. package/types/check/env-files.d.ts.map +0 -1
  512. package/types/check/format-duration.d.ts +0 -5
  513. package/types/check/format-duration.d.ts.map +0 -1
  514. package/types/check/guard-options.d.ts +0 -3
  515. package/types/check/guard-options.d.ts.map +0 -1
  516. package/types/check/handler-events.d.ts +0 -9
  517. package/types/check/handler-events.d.ts.map +0 -1
  518. package/types/check/hook-context.d.ts +0 -3
  519. package/types/check/hook-context.d.ts.map +0 -1
  520. package/types/check/hook-names.d.ts +0 -3
  521. package/types/check/hook-names.d.ts.map +0 -1
  522. package/types/check/i18n-keys.d.ts +0 -3
  523. package/types/check/i18n-keys.d.ts.map +0 -1
  524. package/types/check/images-keys.d.ts +0 -3
  525. package/types/check/images-keys.d.ts.map +0 -1
  526. package/types/check/job-shapes.d.ts +0 -6
  527. package/types/check/job-shapes.d.ts.map +0 -1
  528. package/types/check/link-flag-tests.d.ts +0 -4
  529. package/types/check/link-flag-tests.d.ts.map +0 -1
  530. package/types/check/live-api.d.ts +0 -3
  531. package/types/check/live-api.d.ts.map +0 -1
  532. package/types/check/mail-api.d.ts +0 -3
  533. package/types/check/mail-api.d.ts.map +0 -1
  534. package/types/check/one-state-api.d.ts +0 -9
  535. package/types/check/one-state-api.d.ts.map +0 -1
  536. package/types/check/pages-options.d.ts +0 -3
  537. package/types/check/pages-options.d.ts.map +0 -1
  538. package/types/check/rate-enforce.d.ts +0 -3
  539. package/types/check/rate-enforce.d.ts.map +0 -1
  540. package/types/check/refusal-calls.d.ts +0 -3
  541. package/types/check/refusal-calls.d.ts.map +0 -1
  542. package/types/check/retired-lints.d.ts +0 -3
  543. package/types/check/retired-lints.d.ts.map +0 -1
  544. package/types/check/route-keys.d.ts +0 -3
  545. package/types/check/route-keys.d.ts.map +0 -1
  546. package/types/check/secret-keys.d.ts +0 -3
  547. package/types/check/secret-keys.d.ts.map +0 -1
  548. package/types/check/socket-frames.d.ts +0 -3
  549. package/types/check/socket-frames.d.ts.map +0 -1
  550. package/types/check/source-readers.d.ts +0 -3
  551. package/types/check/source-readers.d.ts.map +0 -1
  552. package/types/check/store-ms.d.ts +0 -3
  553. package/types/check/store-ms.d.ts.map +0 -1
  554. package/types/check/store-names.d.ts +0 -3
  555. package/types/check/store-names.d.ts.map +0 -1
  556. package/types/check/test-helpers.d.ts +0 -3
  557. package/types/check/test-helpers.d.ts.map +0 -1
  558. package/types/check/ttl-names.d.ts +0 -3
  559. package/types/check/ttl-names.d.ts.map +0 -1
  560. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  561. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  562. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  563. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  564. package/types/compiler/deprecated-allow.d.ts +0 -5
  565. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  566. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  567. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  568. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  569. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  570. package/types/compiler/deprecated-children.d.ts +0 -4
  571. package/types/compiler/deprecated-children.d.ts.map +0 -1
  572. package/types/compiler/deprecated-image.d.ts +0 -5
  573. package/types/compiler/deprecated-image.d.ts.map +0 -1
  574. package/types/compiler/deprecated-island.d.ts +0 -9
  575. package/types/compiler/deprecated-island.d.ts.map +0 -1
  576. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  577. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  578. package/types/compiler/deprecated-page.d.ts +0 -4
  579. package/types/compiler/deprecated-page.d.ts.map +0 -1
  580. package/types/compiler/deprecated-parts.d.ts +0 -3
  581. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  582. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  583. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  584. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  585. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  586. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  587. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  588. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  589. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  590. package/types/compiler/old-parts.d.ts +0 -9
  591. package/types/compiler/old-parts.d.ts.map +0 -1
  592. package/types/runtime/mount.compat.d.ts +0 -7
  593. package/types/runtime/mount.compat.d.ts.map +0 -1
  594. package/types/server/moved-exports.d.ts +0 -12
  595. package/types/server/moved-exports.d.ts.map +0 -1
@@ -0,0 +1,49 @@
1
+ # Testing components and helpers
2
+
3
+ Mounting a component in `bun test` and the helpers for a test of its own, for the tests in [Testing](testing.md).
4
+
5
+ ## Common tasks
6
+
7
+ ### Mount a component
8
+
9
+ - `mountComponent(Component, props)` from `kay/test` renders one component built for the browser, as an island renders, into `document`, and resolves with `{ root, unmount, setProps }` once its effects ran: for what handlers and effects do, such as a dialog opening on a click.
10
+ - `Component` is the one the test imports, whose props are typed; the browser build is made from its file.
11
+ - `await setProps({ tiles })` gives the mounted component new values for some of its props, as a parent that re-rendered would (the others keep theirs, a prop it was mounted without can be given), then settles: for a component that follows a prop.
12
+ - The mount also has `type(selector, text)`, `click(selector)` and `press(key)`, firing what a browser fires, then settling: `type` focuses an input or textarea and puts the text in it with an `input` event (a `select` takes the option whose value or label is the text, with `input` and `change`), `click` sends the pointer events and the click to the element and focuses it, a disabled one doing nothing, and `press` sends `keydown` and `keyup` to the focused element, Enter committing a text field with its `change` and submitting its form, Enter or Space (`press(' ')`) clicking a button. A text field's `change` also comes when another gesture leaves it. They work on kayjs-ui's TextInput, Select and Segmented.
13
+ - On a French site (a `lang` or locale of `fr`) it writes the non-breaking spaces an island does, once `document.documentElement.lang` is `fr`; the other client defines (`KAY_BROWSER`, `KAY_STATIC_EXPORT`) are left out.
14
+ - Props may be functions, and the component runs on the test's reactive core, so a signal the test creates reaches it as a prop (`{ read: level }`) and stays live.
15
+ - A library's settings apply as `kay.config.ts` sets them.
16
+ - A component may `call()` or `resource()` a route of an API module, the project's or an extension's: it is bundled as in the browser, knowing the module only by where it is served, so the call goes out as `fetch` (stub it in the test).
17
+ - The modules the component imports from the project and from packages are the test's own, not copies: `import { count } from '../src/store'` in the test and the component's import are one instance, a store of `signal()` or `persisted.cookie()` included, so `count.set(1)` before or after the mount is what the component shows and what it writes is what the test reads. `mock.module('../src/lazy', () => ({ ... }))` or `mock.module('ms', ...)` before the mount reaches the component's static and dynamic imports, and mutating an exported object (`Object.assign(loaders, ...)`) is seen by the component too.
18
+ - One instance means the state outlives the mount, across the mounts and tests of a file and the files one worker runs: a test resets what it mutates (`count.set(0)` in `afterEach`). `mock.module()` lasts for the whole process and `mock.restore()` does not undo it: keep the real exports first (`const real = { ...await import('../src/lazy') }`) and mock them back. A persisted signal of such a module reads storage when first read, so `writePersisted` before the first mount, then `set` it; it needs the DOM to exist when the module loads (`kay/test/dom` imported first), and an app module reading `document` or `localStorage` at load is shared too, keeping the first file's happy-dom document: read them lazily.
19
+ - A module reaching a `.kay` file (through a barrel too), an API module, a server builtin or an entry kay builds for the browser (`kay/island`), a package choosing its entry by the `browser` condition, and kay's libraries (kayjs-ui, kayjs-cms) stay in the bundle, built for the browser and run afresh by each mount, as does a component's own file: a persisted signal declared there reads storage as it is at each mount, and a library's toasts start empty.
20
+ - A test reading `document` before its first mount imports `kay/test/dom` (last, where the preset sorts it), which registers the DOM at once; listed after `kay/test/preload` under `[test] preload`, it registers it for every file.
21
+ - It shims the popover API happy-dom lacks: `showPopover`, `hidePopover` and `togglePopover` fire `toggle` as a browser does, and `matches(':popover-open')` reads whether one is shown.
22
+ - It leaves `fetch`, `Request`, `Response`, `Headers`, `Blob`, `File`, `URL`, `URLSearchParams`, `AbortController`, `AbortSignal` and `WebSocket` as Bun's, and `FormData` is Bun's class that also reads a form element (a file input keeps its file), so a test serving with `Bun.serve` and fetching it works beside the DOM.
23
+ - A test may register the DOM itself instead, such as `GlobalRegistrator.register({ url: 'http://localhost/' })` for a document whose cookies the page reads.
24
+ - A DOM left registered for the rest of the run does not reach `testSite`, whose app runs on Bun's own `Request`, `Response` and the rest, so a file mounting components and one visiting pages share one `bun test` run, as long as `kay/test/preload` comes before any preload registering a DOM.
25
+ - A function the test stubbed, such as `fetch`, stays its stub there, and a streamed page under a DOM is read through `visit`, `site.fetch` handing back a body read later.
26
+ - A `persisted.local(key, initial)` signal keeps its value encoded as island props are, not as JSON: `writePersisted(key, value)` and `readPersisted(key)` from `kay/test` set one before a mount and read one back, `undefined` when none was kept; `'session'` as their last argument does the same for a `persisted.session` signal's sessionStorage.
27
+ - After an interaction, `await settle()` lets effects land before the DOM is read.
28
+
29
+ ## Reference
30
+
31
+ ### Helpers for a test of its own
32
+
33
+ - `cookieJar()` from `kay/test` keeps a browser's cookies for a test driving an Elysia app or a handler of its own rather than `testSite`, which keeps its own as `site.cookies`.
34
+ - `jar.send(handle, request)` sends the cookies kept so far through `handle`, such as `app.handle`, keeps those the response sets and drops those it expires; `jar.header()` is the `cookie` header it sends, `''` when it holds none, and `jar.cookies` the `Bun.CookieMap`.
35
+ - `solveWork(challenge)` from `kay/test` solves a proof-of-work challenge, such as one `workChallenge()` signs, as kay's script does, for a test posting a form field by hand, or `undefined` for text that is no challenge.
36
+ - `scratchDir(prefix)` from `kay/test` makes a fresh directory under the project's `.kay/scratch` and resolves with its absolute path: inside the project, so a file written there imports the project's packages, and under `.kay`, which no build or check reads, so another test file building beside it never meets it.
37
+ - `scratchDir(prefix, root)` puts it under another project's `.kay/scratch`; the test removes the directory once done with it.
38
+ - `overrideEnv(env, { MEDIA_DIR: dir })` from `kay/test` gives a `defineEnv` value other variables, `undefined` unsetting an optional one, until `restore()` or the end of a `using`, never `process.env`; only an `env.X` read at call time sees it, not a value copied at import, a value given is not checked against the schema, restores run in reverse order, tests running at once share the one `env`, and `publicEnv` is read apart.
39
+
40
+ ```ts
41
+ import { expect } from 'bun:test'
42
+ import { cookieJar } from 'kay/test'
43
+ import { app } from './app'
44
+
45
+ const jar = cookieJar()
46
+
47
+ await jar.send(app.handle, new Request('http://localhost/sign-in', { method: 'POST' }))
48
+ expect(jar.cookies.has('kay_session')).toBe(true)
49
+ ```
package/llms/testing.md CHANGED
@@ -203,16 +203,16 @@ it('shows why a todo was refused', async () => {
203
203
  - A path as `from` is visited first, so a `workChallenge` field of the form on that page is solved as it is for a page: one extra GET per submit.
204
204
  - So `site.submit(add, fields, { from: refused })` posts again from the page a refused post answered, as a visitor fixing the form does.
205
205
  - A post to an action with `minTime` goes through as if its form had been open long enough, with a page or without, so a test of something else needs no waiting.
206
- - A page older than `maxAge` is still refused as expired.
207
- - A post or a call to an action with `proofOfWork` carries a solved challenge, unless `headers` gives its own `x-kay-work`, `''` for none.
206
+ - A page older than `maxAge` is still refused as expired. A post or a call to an action with `proofOfWork` carries a solved challenge, unless `headers` gives its own `x-kay-work`, `''` for none.
208
207
  - A test of the minimum itself says how long the form was open: `site.submit(contact, fields, { from: '/', openedFor: 0 })` posts as soon as the page loaded and `openedFor: '2d'` two days after.
209
208
  - `visit.stamp(action)` reads the stamp the visit's form for `action` rendered with, and `{ from: visit, stamp }` posts it as it is, so a test checking that the refused page keeps the stamp its form rendered with compares `refused.stamp(contact)` to `page.stamp(contact)`; a `stamp` such as `'forged'`, or a `kay_since` among the fields, is posted as given and wins over `openedFor` and the clock.
210
209
  - Both `visit` and `submit` resolve with `{ url, status, headers, html }`, which also reads the page as a crawler does (see below).
211
210
  - `site.call(action, input)` calls an action as an island does, `input` its typed input or a `FormData`, left out for an action with no input or only optional fields: `site.call(signOut)`.
212
211
  - `{ from: '/orgs/acme' }` names the page a call is made on, for an action reading its params.
212
+ - An action given fields with `with` sends them in `site.call` and `site.submit`, `from` a path or a page.
213
213
  - `site.call` resolves with the action's result, throws `ActionError` when it fails and `ActionRedirectError` with `location` when it redirects, the path under the site's `base` when it has one.
214
214
  - A handler returning an async iterable gives every value once its stream ended, `[1, 2, 3]`, and throws when the stream failed.
215
- - `site.expectRefused(action, input)` makes the same call expecting it refused: it resolves with the `ActionError`, `data` typed from the handler and `message` the `ctx.fail` text or the schema's messages, and fails the test when the call went through.
215
+ - `site.expectRefused(action, input)` makes the same call expecting it refused: it resolves with the `ActionError`, `data` typed from the handler and `message` the refusal's text or the schema's messages, and fails the test when the call went through.
216
216
  - `await site.expectRefused(add, { title: '' })` reads `{ status: 422, errors: { title: 'Write a title' } }`.
217
217
  - `site.mcp.initialize()`, `site.mcp.tools()` and `site.mcp.call(name, args)` test an app's MCP endpoint: [MCP endpoint](mcp.md).
218
218
 
@@ -231,48 +231,7 @@ it('shows why a todo was refused', async () => {
231
231
 
232
232
  Requests, jobs, sockets and sessions are in [Testing requests, jobs, sockets and sessions](testing-requests-jobs-sockets.md).
233
233
 
234
- ### Mounting a component
235
-
236
- - `mountComponent(Component, props)` from `kay/test` renders one component built for the browser, as an island renders, into `document`, and resolves with `{ root, unmount, setProps }` once its effects ran: for what handlers and effects do, such as a dialog opening on a click.
237
- - `Component` is the one the test imports, whose props are typed; the browser build is made from its file.
238
- - `await setProps({ tiles })` gives the mounted component new values for some of its props, as a parent that re-rendered would (the others keep theirs, a prop it was mounted without can be given), then settles: for a component that follows a prop.
239
- - The mount also has `type(selector, text)`, `click(selector)` and `press(key)`, firing what a browser fires, then settling: `type` focuses an input or textarea and puts the text in it with an `input` event (a `select` takes the option whose value or label is the text, with `input` and `change`), `click` sends the pointer events and the click to the element and focuses it, a disabled one doing nothing, and `press` sends `keydown` and `keyup` to the focused element, Enter committing a text field with its `change` and submitting its form, Enter or Space (`press(' ')`) clicking a button. A text field's `change` also comes when another gesture leaves it. They work on kayjs-ui's TextInput, Select and Segmented.
240
- - On a French site (a `lang` or locale of `fr`) it writes the non-breaking spaces an island does, once `document.documentElement.lang` is `fr`; the other client defines (`KAY_BROWSER`, `KAY_STATIC_EXPORT`) are left out.
241
- - Props may be functions, and the component runs on the test's reactive core, so a signal the test creates reaches it as a prop (`{ read: level }`) and stays live.
242
- - A library's settings apply as `kay.config.ts` sets them.
243
- - A component may `call()` or `resource()` a route of an API module, the project's or an extension's: it is bundled as in the browser, knowing the module only by where it is served, so the call goes out as `fetch` (stub it in the test).
244
- - The modules the component imports from the project and from packages are the test's own, not copies: `import { count } from '../src/store'` in the test and the component's import are one instance, a store of `signal()` or `persisted.cookie()` included, so `count.set(1)` before or after the mount is what the component shows and what it writes is what the test reads. `mock.module('../src/lazy', () => ({ ... }))` or `mock.module('ms', ...)` before the mount reaches the component's static and dynamic imports, and mutating an exported object (`Object.assign(loaders, ...)`) is seen by the component too.
245
- - One instance means the state outlives the mount, across the mounts and tests of a file and the files one worker runs: a test resets what it mutates (`count.set(0)` in `afterEach`). `mock.module()` lasts for the whole process and `mock.restore()` does not undo it: keep the real exports first (`const real = { ...await import('../src/lazy') }`) and mock them back. A persisted signal of such a module reads storage when first read, so `writePersisted` before the first mount, then `set` it; it needs the DOM to exist when the module loads (`kay/test/dom` imported first), and an app module reading `document` or `localStorage` at load is shared too, keeping the first file's happy-dom document: read them lazily.
246
- - A module reaching a `.kay` file (through a barrel too), an API module, a server builtin or an entry kay builds for the browser (`kay/island`), a package choosing its entry by the `browser` condition, and kay's libraries (kayjs-ui, kayjs-cms) stay in the bundle, built for the browser and run afresh by each mount, as does a component's own file: a persisted signal declared there reads storage as it is at each mount, and a library's toasts start empty.
247
- - A test reading `document` before its first mount imports `kay/test/dom` (last, where the preset sorts it), which registers the DOM at once; listed after `kay/test/preload` under `[test] preload`, it registers it for every file.
248
- - It shims the popover API happy-dom lacks: `showPopover`, `hidePopover` and `togglePopover` fire `toggle` as a browser does, and `matches(':popover-open')` reads whether one is shown.
249
- - It leaves `fetch`, `Request`, `Response`, `Headers`, `Blob`, `File`, `URL`, `URLSearchParams`, `AbortController`, `AbortSignal` and `WebSocket` as Bun's, and `FormData` is Bun's class that also reads a form element (a file input keeps its file), so a test serving with `Bun.serve` and fetching it works beside the DOM.
250
- - A test may register the DOM itself instead, such as `GlobalRegistrator.register({ url: 'http://localhost/' })` for a document whose cookies the page reads.
251
- - A DOM left registered for the rest of the run does not reach `testSite`, whose app runs on Bun's own `Request`, `Response` and the rest, so a file mounting components and one visiting pages share one `bun test` run, as long as `kay/test/preload` comes before any preload registering a DOM.
252
- - A function the test stubbed, such as `fetch`, stays its stub there, and a streamed page under a DOM is read through `visit`, `site.fetch` handing back a body read later.
253
- - A `persisted.local(key, initial)` signal keeps its value encoded as island props are, not as JSON: `writePersisted(key, value)` and `readPersisted(key)` from `kay/test` set one before a mount and read one back, `undefined` when none was kept; `'session'` as their last argument does the same for a `persisted.session` signal's sessionStorage.
254
- - After an interaction, `await settle()` lets effects land before the DOM is read.
255
-
256
- ### Helpers for a test of its own
257
-
258
- - `cookieJar()` from `kay/test` keeps a browser's cookies for a test driving an Elysia app or a handler of its own rather than `testSite`, which keeps its own as `site.cookies`.
259
- - `jar.send(handle, request)` sends the cookies kept so far through `handle`, such as `app.handle`, keeps those the response sets and drops those it expires; `jar.header()` is the `cookie` header it sends, `''` when it holds none, and `jar.cookies` the `Bun.CookieMap`.
260
- - `solveWork(challenge)` from `kay/test` solves a proof-of-work challenge, such as one `workChallenge()` signs, as kay's script does, for a test posting a form field by hand, or `undefined` for text that is no challenge.
261
- - `scratchDir(prefix)` from `kay/test` makes a fresh directory under the project's `.kay/scratch` and resolves with its absolute path: inside the project, so a file written there imports the project's packages, and under `.kay`, which no build or check reads, so another test file building beside it never meets it.
262
- - `scratchDir(prefix, root)` puts it under another project's `.kay/scratch`; the test removes the directory once done with it.
263
- - `overrideEnv(env, { MEDIA_DIR: dir })` from `kay/test` gives a `defineEnv` value other variables, `undefined` unsetting an optional one, until `restore()` or the end of a `using`, never `process.env`; only an `env.X` read at call time sees it, not a value copied at import, a value given is not checked against the schema, restores run in reverse order, tests running at once share the one `env`, and `publicEnv` is read apart.
264
-
265
- ```ts
266
- import { expect } from 'bun:test'
267
- import { cookieJar } from 'kay/test'
268
- import { app } from './app'
269
-
270
- const jar = cookieJar()
271
-
272
- await jar.send(app.handle, new Request('http://localhost/sign-in', { method: 'POST' }))
273
- expect(jar.cookies.has('kay_session')).toBe(true)
274
- ```
275
-
234
+ Mounting a component with `mountComponent`, and the helpers for a test of its own (`cookieJar`, `solveWork`, `scratchDir`, `overrideEnv`), are in [Testing components and helpers](testing-mount.md).
276
235
 
277
236
  ### Databases and setup
278
237
 
@@ -6,53 +6,53 @@ What 1.105 changed in kay.config.ts, the hooks, the stores and the guards of fea
6
6
 
7
7
  ### Secrets are one shape
8
8
 
9
- `deprecated-secret-keys` (`kay check --fix`) renames `mcp: { key }` to `mcp: { token }` and writes `proxy: { key: 'x-upstream-key' }` as `proxy: { key: { header: 'x-upstream-key' } }`; the old keys work until 1.108. The loaded `KayConfig` has `mcp.token` and `proxy.key` as `{ header, secret? }` only, so code reading `config.mcp.key` or a string `config.proxy.key` reads the new fields. A secret is a string, `{ env: 'NAME' }` or `{ file: 'path' }`. One behaviour changes with the rename: `mcp.key: { file }` read `KAY_MCP_KEY` first, and `mcp.token: { file }` reads the file alone (`token: true` still reads the environment). `testSite({ mcpKey, proxyKey })` still work until 1.108 and `kay check` reports them: `kay check --fix` moves them into `config: { mcp: { token }, proxy: { key: { header, secret } } }`, `proxyKey` where the app's config names the header and no `config` is written yet, and the rest is by hand. The `config` of a `KayExtension` takes the keys of before 1.105 (`fonts`, `favicon`, `observe`...) as `kay.config.ts` does, until 1.108 under `deprecated-config-groups`.
9
+ `mcp: { key }` is `mcp: { token }` and `proxy: { key: 'x-upstream-key' }` is `proxy: { key: { header: 'x-upstream-key' } }`; the old keys went in 1.109, with their `deprecated-secret-keys` lint. The loaded `KayConfig` has `mcp.token` and `proxy.key` as `{ header, secret? }` only, so code reading `config.mcp.key` or a string `config.proxy.key` reads the new fields. A secret is a string, `{ env: 'NAME' }` or `{ file: 'path' }`. One behaviour changes with the rename: `mcp.key: { file }` read `KAY_MCP_KEY` first, and `mcp.token: { file }` reads the file alone (`token: true` still reads the environment). `testSite({ mcpKey, proxyKey })` went in 1.109: write `config: { mcp: { token }, proxy: { key: { header, secret } } }`. The `config` of a `KayExtension` takes the keys `kay.config.ts` does, the keys of before 1.105 (`fonts`, `favicon`, `observe`...) no longer among them.
10
10
 
11
11
  ### `links`, `offline` and `search` are keys of `client`
12
12
 
13
- `deprecated-client-keys` (`kay check --fix`) moves them into `client` as written; the old keys work until 1.108, and the type of the loaded `KayConfig` no longer has them, so code reading `config.offline`, `config.search` or `config.links` reads `config.client?.offline`, `.search` and `.links`. A `client` already written is kept as it is and the key is reported with no fix.
13
+ The old top-level keys went in 1.109, with their `deprecated-client-keys` lint, and the type of the loaded `KayConfig` no longer has them, so code reading `config.offline`, `config.search` or `config.links` reads `config.client?.offline`, `.search` and `.links`. A `client` already written is kept as it is and the key is reported with no fix.
14
14
 
15
15
  ### Every route the config moves is a key of `endpoints`, and `mcp` and `metrics` are under `/_kay`
16
16
 
17
- `serve.apiPrefix` is `endpoints.api`, and the `path` of `openapi`, `mcp`, `health`, `metrics` and `jobs` is `endpoints.openapi`, `.mcp`, `.health`, `.metrics` and `.jobs`; `openapi.referencePath` is `openapi: { reference: { path } }`. `deprecated-route-keys` (`kay check --fix`) rewrites them, the old keys work until 1.108, and the loaded `KayConfig` no longer has them (read `config.endpoints?.api` for `config.serve?.apiPrefix`). The defaults move: the MCP endpoint is `/_kay/mcp` and the metrics `/_kay/metrics`, where they were `/mcp` and `/metrics`. An app that did not set the path keeps the old URL answering: `/metrics` answers as well until 1.108, and `/mcp` answers the MCP endpoint in place (not redirected) until 2.0, unless the app serves something there; point MCP clients and the metrics collector at the new path, or set `endpoints: { mcp: '/mcp', metrics: '/metrics' }` to keep them. The OAuth resource an MCP client signed in for is the endpoint's URL, so a client that registered for `/mcp` signs in again for `/_kay/mcp`.
17
+ `serve.apiPrefix` is `endpoints.api`, and the `path` of `openapi`, `mcp`, `health`, `metrics` and `jobs` is `endpoints.openapi`, `.mcp`, `.health`, `.metrics` and `.jobs`; `openapi.referencePath` is `openapi: { reference: { path } }`. The old keys went in 1.109 with their `deprecated-route-keys` lint, and the loaded `KayConfig` no longer has them (read `config.endpoints?.api` for `config.serve?.apiPrefix`). The defaults move: the MCP endpoint is `/_kay/mcp` and the metrics `/_kay/metrics`, where they were `/mcp` and `/metrics`. The old `/metrics` and `/mcp` answer 404 since 1.109; point MCP clients and the metrics collector at the new path, or set `endpoints: { mcp: '/mcp', metrics: '/metrics' }` to keep them. The OAuth resource an MCP client signed in for is the endpoint's URL, so a client that registered for `/mcp` signs in again for `/_kay/mcp`.
18
18
 
19
19
  ### `defineContext` from `kay/server`, `env` is `envFiles`
20
20
 
21
- `import { defineContext } from 'kay/server'`, as `defineEnv`; `kay/library` keeps it until 1.108. The `env: { compose, example }` of kay.config.ts is `envFiles`, which also takes `false`; `env` works until 1.108. `kay upgrade` rewrites both (`deprecated-context-import`, `deprecated-env-files`). The session cookie now takes its `SameSite` and `Secure` from `security.cookies` unless `session({ sameSite })` is set: an app that set `sameSite: 'strict'` there gets a strict session cookie, which signs a visitor out on a link from another site, so set `session({ sameSite: 'lax' })` beside it where that matters.
21
+ `import { defineContext } from 'kay/server'`, as `defineEnv`; `kay/library` dropped it in 1.109. The `env: { compose, example }` of kay.config.ts is `envFiles`, which also takes `false`; `env` went in 1.109. The session cookie now takes its `SameSite` and `Secure` from `security.cookies` unless `session({ sameSite })` is set: an app that set `sameSite: 'strict'` there gets a strict session cookie, which signs a visitor out on a link from another site, so set `session({ sameSite: 'lax' })` beside it where that matters.
22
22
 
23
23
  ### `assets`, `ops` and `i18n` group the config's keys
24
24
 
25
- `images`, `fonts`, `favicon`, `manifest` and `publicCache` are keys of `assets`, `observe`, `health`, `metrics` and `jobs` are keys of `ops`, and `i18n`'s `defaultLocale` is `default`, `prefixDefault: true` is `mode: 'always'` and `domains` is `mode: { domains }`. `deprecated-config-groups` and `deprecated-i18n-keys` (`kay check --fix`) rewrite them; the old keys work until 1.108, and the loaded `KayConfig` no longer has them, so code reading `config.images` reads `config.assets?.images`, `config.observe` reads `config.ops?.observe` and `i18n.defaultLocale` reads `i18n.default`. A group already written is kept as it is and the key is reported with no fix.
25
+ `images`, `fonts`, `favicon`, `manifest` and `publicCache` are keys of `assets`, `observe`, `health`, `metrics` and `jobs` are keys of `ops`, and `i18n`'s `defaultLocale` is `default`, `prefixDefault: true` is `mode: 'always'` and `domains` is `mode: { domains }`. The old `i18n` keys went in 1.109 with their `deprecated-i18n-keys` lint, and so did the other old keys with `deprecated-config-groups`, and the loaded `KayConfig` no longer has them, so code reading `config.images` reads `config.assets?.images`, `config.observe` reads `config.ops?.observe` and `i18n.defaultLocale` reads `i18n.default`. An old key is refused at boot, naming the new one.
26
26
 
27
27
  ### Feature keys of kay.config.ts are `false`, `true` or options
28
28
 
29
- `robots`, `sitemap`, `favicon`, `security`, `security.cookies`, `security.csp`, `health`, `preview`, `offline`, `proxy`, `images.avif`, `images.placeholder`, `images.rateLimit`, `live.rateLimit`, `mcp.rateLimit` and `env` take `false` for off, `true` for the defaults, which is the same as leaving the key out except for `preview` and `offline`, off until set, and an object of options. `deprecated-config-switch` (`kay check --fix`) rewrites `proxy: 2` as `proxy: { hops: 2 }` and `proxy: 1` as `proxy: true`; the number works until 1.108.
29
+ `robots`, `sitemap`, `favicon`, `security`, `security.cookies`, `security.csp`, `health`, `preview`, `offline`, `proxy`, `images.avif`, `images.placeholder`, `images.rateLimit`, `live.rateLimit`, `mcp.rateLimit` and `env` take `false` for off, `true` for the defaults, which is the same as leaving the key out except for `preview` and `offline`, off until set, and an object of options. `proxy: 2` is `proxy: { hops: 2 }` and `proxy: 1` is `proxy: true`; the number went in 1.109, with its `deprecated-config-switch` lint.
30
30
 
31
31
  - `defineConfig` refuses a key it does not know in every option bag, however deep (`images: { widht: 1 }`, `security: { cookies: { httpOnlee: true } }`), where it checked 11 of them and let a typo in the others through.
32
32
 
33
33
  ### `images` is grouped, and lists may come from a function
34
34
 
35
- `images: { remote: { hosts, maxSize, timeout }, formats: { quality, webp, avif }, limits: { variants, queue } }` replaces the flat `remoteMaxSize`, `remoteTimeout`, `quality`, `webp`, `avif`, `maxVariants` and `queue`; `remote: [...]` stays for hosts alone. `deprecated-images-keys` (`kay check --fix`) moves them; the flat keys work until 1.108.
35
+ `images: { remote: { hosts, maxSize, timeout }, formats: { quality, webp, avif }, limits: { variants, queue } }` replaces the flat `remoteMaxSize`, `remoteTimeout`, `quality`, `webp`, `avif`, `maxVariants` and `queue`; `remote: [...]` stays for hosts alone. The flat keys went in 1.109, with their `deprecated-images-keys` lint.
36
36
 
37
37
  ### `ttl` is how long data lives
38
38
 
39
- `signed.sign(use, value, { ttl })`, `files.url(key, { ttl })`, `workChallenge(scope, { ttl })`, kayjs-auth's `proofOfWork({ ttl })`, the `ttl` of an action's `protect.minTime` and `protect.proofOfWork`, and the `ttl: { link, code }` a kayjs-auth mail's data carries to a template replace `maxAge`, which stays for an HTTP header or a cookie. `deprecated-ttl-names` (`kay check --fix`) renames it; `maxAge` works there until 1.108 (a mail template destructuring `{ maxAge }` is changed by hand, as the lint finds `data.maxAge.link` and `data.maxAge.code` only). `window` of a rate limit and `failedTtl` of a queue keep their names: a window is a span counted in, not how long data lives, and `failedTtl` already is a `ttl`.
39
+ `signed.sign(use, value, { ttl })`, `files.url(key, { ttl })`, `workChallenge(scope, { ttl })` from `kay/server`, kayjs-auth's `proofOfWork({ ttl })`, the `ttl` of an action's `protect.minTime` and `protect.proofOfWork`, and the `ttl: { link, code }` a kayjs-auth mail's data carries to a template replace `maxAge`, which stays for an HTTP header or a cookie. `maxAge` went from them in 1.109, with the `deprecated-ttl-names` lint (a mail template destructuring `{ maxAge }` reads `{ ttl }`). `window` of a rate limit and `failedTtl` of a queue keep their names: a window is a span counted in, not how long data lives, and `failedTtl` already is a `ttl`.
40
40
 
41
- A store receives its lengths as a `Duration`: `RateStore.hit(key, window)`, `KvStore`'s `set(key, value, ttl)` and `once(key, ttl)`, `SessionStore.set(id, data, maxAge)` and `LiveStore.endAll(id, ttl)`. A store you wrote before 1.105 keeps working with no edit: kay hands milliseconds as a number to every store without `durations: true`, until 1.108. To move one over, add `durations: true` and read the length with `lengthMs(value)` from `kay`, which takes a `Duration` or a number; `kv(ns).set(key, value, 60_000)` written with milliseconds still works and `deprecated-store-ms` rewrites it as `'60000ms'`. kay's own stores take both forms. The types of a store's parameters accept both, so no store fails to type check, and no lint finds a store of your own, as its methods cannot be told from any other object's.
41
+ A store receives its lengths as a `Duration`: `RateStore.hit(key, window)`, `KvStore`'s `set(key, value, ttl)` and `once(key, ttl)`, `SessionStore.set(id, data, maxAge)` and `LiveStore.endAll(id, ttl)`. Since 1.109 kay hands every store a `Duration`, and `durations: true` is no longer a member of a store: read the length with `lengthMs(value)` from `kay`. `kv(ns).set(key, value, 60_000)` written with milliseconds is `'60000ms'`, which the `deprecated-store-ms` lint went with.
42
42
 
43
43
  ### Hooks are flat keys named by the moment they run
44
44
 
45
- `onListen` replaces the config's `onStart` (a job's, queue's and workflow's `onStart` keep theirs), `onError` is a key of the config beside `observe`, and every hook event carries one `context`: an action's `beforeRun`, `onSuccess` and `onError` read `context` where they read `ctx`, which holds the action's own context besides `ip`, `userAgent` and `userId`. `observe.log` is `false`, `true` or `{ format: 'json', requests, sink }`, replacing `'json'` and a function. `deprecated-app-hooks` and `deprecated-hook-context` (`kay check --fix`) rewrite them; the old forms work until 1.108.
45
+ `onListen` replaces the config's `onStart` (a job's, queue's and workflow's `onStart` keep theirs), `onError` is a key of the config beside `observe`, and every hook event carries one `context`: an action's `beforeRun`, `onSuccess` and `onError` read `context` where they read `ctx`, which holds the action's own context besides `ip`, `userAgent` and `userId`. `observe.log` is `false`, `true` or `{ format: 'json', requests, sink }`, replacing `'json'` and a function. The old forms went in 1.109, with the `deprecated-app-hooks` and `deprecated-hook-context` lints.
46
46
 
47
47
  - The resolved `KayConfig` (what the server reads) no longer has `onStart` or `observe.onError`: read `onListen` and `onError`.
48
48
 
49
49
  ### `pages()` and `testSite()` take `{ config }`
50
50
 
51
- The config keys written beside `root` in the options (`pages({ root, client: { navigation: false } })`) go under `config`: `pages({ root, config: { client: { navigation: false } } })`; `root`, `dev`, `prebuilt` and a test site's own options (`browser`, `headers`, `outgoing`, `mcpKey` and the rest) stay. `deprecated-pages-options` (`kay check --fix`) moves them; the old form works until 1.108.
51
+ The config keys written beside `root` in the options (`pages({ root, client: { navigation: false } })`) go under `config`: `pages({ root, config: { client: { navigation: false } } })`; `root`, `dev`, `prebuilt` and a test site's own options (`browser`, `headers`, `outgoing` and the rest) stay. A config key beside `root` is refused since 1.109, with the `deprecated-pages-options` lint.
52
52
 
53
53
  ### Library stores and tables share one naming
54
54
 
55
- Each library takes its data store as `store`, and each `/pg` and `/sqlite` entry names its helpers the same way. The old names work until 1.108, and `kay check` reports them as `deprecated-store-names`, with a fix for the imports, `ai({ conversations })` and a lone `listStore` or `suppressionStore` of `mailer()`:
55
+ Each library takes its data store as `store`, and each `/pg` and `/sqlite` entry names its helpers the same way. The old names went in 1.109, with the `deprecated-store-names` lint:
56
56
 
57
57
  - kayjs-ai: `ai({ store })` for `conversations`; `pgAi(db)`, `sqliteAi(path)`, `createAiTables(db)` and `aiTables` for `pgConversations`, `sqliteConversations`, `createConversationTable` and `conversationTable`.
58
58
  - kayjs-mail: `mailer({ store: { lists, suppressions } })` for `listStore` and `suppressionStore`, `pgMail(db)` and `sqliteMail(path)` for both at once, and `mail.list(name, { store: sqliteMail(path) })` for `mail.list(name, { file })`, which the lint does not find; `sqliteLists`, `createMailTables` and `mailTables` for `openLists`, `createMailListTables` and `mailListTableNames`.
@@ -63,7 +63,7 @@ An app with no `store` now keeps sessions, jobs and every library in one SQLite
63
63
 
64
64
  ### Every guard option is `guards`, and a feature with none is closed
65
65
 
66
- `deprecated-guard-option` (`kay check --fix`) renames `guard` to `guards` in `vitals()` and in the `jobs` and `images` of kay.config.ts, and writes `requireGuards` as `guards: { default }`; the old forms work until 1.108.
66
+ `guard` is `guards` in `vitals()` and in the `jobs` and `images` of kay.config.ts, and `requireGuards` is `guards: { default }`; the old forms and the `deprecated-guard-option` lint that rewrote them went in 1.109.
67
67
 
68
68
  - `vitals({ guard })`, `jobs: { guard }` and `images: { guard }` are `guards`, taking a guard, a list, `{ load }` or `false`, as a page's and an API module's `guards` do. `cms()` keeps `access`, which also takes a role.
69
69
  - `jobs` with no `guards` mounts the page and answers 403 instead of stopping the boot, and `jobs: { guards: false }` opens it.
@@ -1,124 +1,114 @@
1
1
  # Upgrading, older releases
2
2
 
3
- What each minor release before 1.105 broke, and what an app changed to move to it. The newer releases are in [Upgrading](upgrading.md).
3
+ What each minor release before 1.108 broke, and what an app changed to move to it. The newer releases are in [Upgrading](upgrading.md).
4
4
 
5
- ## 1.105.0 (continued)
5
+ ## 1.107.0
6
6
 
7
- ### An island declares its settings with `island()`
7
+ ### `TSchema` is gone from `kay/library`
8
8
 
9
- `island({ render, hydrate, persist, interactive })` first in a component's script replaces the `--- island`, `--- client` and `--- static` fence lines and `export const island = { ... }` in a `--- module` fence: `--- client` is `island({ render: 'client' })`, `--- island` is `island()`, `--- static` is `island({ render: 'static' })`, and the export's `persist`, `hydrate` and `interactive` move into the call. On a use, `hydrate="client"` is `render="client"` and `server="defer"` is `server defer`. `kay upgrade` rewrites them (`deprecated-island-fence`, `deprecated-island-attributes`), and they work until 1.108. kayjs-ui's `table.kay`, `site-nav.kay` and `app-header.kay` and kayjs-ai's `chat-launcher.kay` no longer export `island`: they declare it with the call, and an app reading that export reads the component's `interactive` props from its docs instead.
9
+ Import `Schema` from `kay/library` instead, kay's own name for what `s` builds; `kay upgrade` on 1.106 rewrote the import and its uses. The `deprecated-schema-type` lint is gone with it.
10
10
 
11
- ### `formatDuration` takes a duration with its unit
11
+ ### `--- script` opening a file is an error
12
12
 
13
- `formatDuration(7_500_000)` is `formatDuration('125m')` (or `'7500s'`, `'2.5h'`): a length is written with its unit everywhere in kay, as `formatBytes` already took bytes or `'1.5kb'`. A number of milliseconds still works until 1.108 and `kay upgrade` rewrites a literal one, as `'7500000ms'` (`deprecated-format-duration`); a number held in a variable is changed by hand, and the editor strikes the call through.
13
+ A file opens its script with `---`; `--- script` is only for a script that follows a `--- server`, `--- module` or `--- style` fence. The `deprecated-script-fence` lint is gone, and `--- script` first in a file is a `fence-invalid` error whose safe fix `kay check --fix` applies.
14
14
 
15
- ### An `img` takes its image options as attributes
15
+ ### `action({ input, ...options }, handler)`
16
16
 
17
- `img({...image(hero, { aspect: '1/1', sizes: '100vw' })})` is `img(src={hero} aspect="1/1" sizes="100vw")`, `quality={90}` is the same for the quality, and `no-placeholder` is `placeholder={false}`. `image()` stays for an element that is no `img` and for an image kay did not import, which needs its `width` and `height` given to it. The old forms work until 1.108 and `kay upgrade` rewrites them (`deprecated-image-options`), a spread of `image()` only when it is the only one on the `img`, its `src` and its options are written in the call and a size is not among them; any other is changed by hand.
17
+ An action takes its options first, with its input in them, as an API route does: `action({ input: { title: s.string() }, maxSize: '1mb' }, handler)`. `action(schema, handler, options)` and `action(handler, options)` work until 2.0; `kay upgrade` rewrites them (`deprecated-action-options`).
18
18
 
19
- ### A page's head, sitemap entry and cache are `seo` and `cache`
19
+ ### One validation for every input
20
20
 
21
- `noindex`, `sitemap`, `lastmod`, `search` and `feed` at the top level of `page` are the `seo` group, `export const page = { seo: { noindex: true } }`, and `ttl` and `cacheControl` are `cache`: `ttl: '1h'` is `cache: '1h'`, `cacheControl: false` is `cache: false`, and a header written out is `cache: { browser: '5m', shared: '1h', swr: '10m' }`, or `'private'`. The old keys work until 1.108 (`deprecated-page-seo`, `deprecated-page-cache`), and `kay upgrade` rewrites them where the new form is the same value: a page that has a `seo` or a `cache` already, a `ttl` beside a `cacheControl`, and a header text are left to you. `export const noindex = true` as an export of its own is a setting of `page` first (`deprecated-script-fence` does it), then of `seo`: run `kay upgrade` twice.
21
+ Actions, API routes, sockets and `defineEnv` read their input through one `validate(schema, value, { source })`. Text sources (a form, a query, path params, the environment) are read as the numbers, booleans and lists they spell, and a JSON body never is: an action called from an island, a socket message and an API route's JSON body that sent `'3'` for an int, or `'true'` for a boolean, are refused where Elysia's schemas let them by. An object refuses a key its shape lacks in JSON (`extra: 'strip'` drops it, as `s.Object` of the old builders still does); a query, the headers and the cookies of a request still drop theirs. A form post drops the fields the schema does not name (a named submit button, a widget), as a browser sends controls the app does not own. `validate` answers `{ errors: [{ path, key, params, message }], status: 422 }` worded in the request's locale and independent of `NODE_ENV`; an action's or API route's answer still carries `errors` as a `{ field: message }` map. An API route's refusal reaches an `onError` as an error with code `VALIDATION` whose `all` lists `path`, `message` and `summary`. No lint can find the app that sends such a key or such a JSON value, as it depends on what a request carries.
22
22
 
23
- `seo` also takes `title`, `description`, `image` and `canonical`, and `head(title=... description=...)` takes them as attributes, so a page whose head has no tag of its own to write needs no `head` block.
23
+ ## 1.106.0
24
24
 
25
- ### Server hooks that observe are `after<Verb>`
25
+ ### `s` is kay's own builder, in lowercase
26
26
 
27
- `deprecated-hook-names` finds the old names in the options of the call, in each collection of `cms({ collections })` and in the `hooks` of kayjs-auth's `src/auth.ts`: run `kay upgrade`. The old names work until 1.108, and the new one wins when both are written. `before<Verb>` (may refuse or change) and `onError`, `onEvent` and a queue's `onStart`, `onSuccess`, `onRetry` keep their names. Every hook already took one object with `context`.
27
+ `s.string({ min, max })`, `s.int()`, `s.enum()`, `s.object()` and the rest replace the PascalCase builders of Elysia, each taking the same field options (`optional: true`, `default`, `error`, `label`, `description`, `example`); `s.Optional(field)` is `optional: true` in the field's options, `s.UnionEnum` and `s.UnionKeys` are `s.enum`, `s.Numeric` is `s.number`, and `s.typebox` is gone: `s` builds a schema of its own, over TypeBox, and a schema built with Elysia's `t` is still taken. The old names work until 2.0, and `kay upgrade` rewrites them (`deprecated-schema-builders`, [schemas](schemas.md#schemas)). A file size of a file field is `'2mb'`, never `'2m'`. Two things differ in the new builders: `s.object` refuses a key its shape lacks, where `s.Object` let it by (`{ extra: 'strip' }` keeps the old way; see [schemas](schemas.md#schemas) for where it refuses), and `s.list` is at most 1,000 items unless `max` says more; the fix of 1.109 writes both options, the one of 1.106 to 1.108 did not. An unknown key of a query, the headers or the cookies is dropped, whatever the schema says, as a link or a proxy adds some; `s.Object` of a collection's frontmatter now refuses a key its shape lacks, so an entry with an extra key fails the build until the schema says `{ extra: 'strip' }`. An `action` takes a record of fields, which refuses a key its shape lacks: `s.object(shape, { extra: 'strip' })` keeps the old way. A `defineEnv` takes the record of fields where it took `s.Object({ ... })`, and the fix writes it, as an env reads only the names it declares.
28
+ ### `@kaynooo/eslint` 8
28
29
 
29
- - kayjs-auth: `onSignUp` is `afterSignUp`; its error source is `auth.afterSignUp`.
30
- - kayjs-mail: `onSend` and `onSuppress` of `mailer()`, `onSend` of `contactForm()` are `afterSend` and `afterSuppress`; a list's `onSubscribe`, `onConfirm`, `onUnsubscribe` and `onBroadcast` are `afterSubscribe`, `afterConfirm`, `afterUnsubscribe` and `afterBroadcast`. Sources follow (`mail.afterSend`, `mail.list.afterSubscribe`).
31
- - kayjs-cms: `onSave` and `onUpload` of `cms()` and of a collection are `afterSave` and `afterUpload` (sources `cms.afterSave`, `cms.afterUpload`).
32
- - kayjs-ai: `onStep` and `onToolCall` are `afterStep` and `afterToolCall`, and `onSuccess` is `afterRequest`, beside `beforeRequest`, in `ai()` and in the options of `ask`, `speak`, `embed`, `transcribe` and `describeImage` (sources `ai.afterStep`, `ai.afterToolCall`, `ai.afterRequest`).
33
- - A test or a log reading a hook's `source` from `observe.onError` reads the new name.
30
+ kay and `kay new` use `@kaynooo/eslint` 8, which has no formatters (Prettier, oxfmt and dprint, about 30 MB, are no longer installed): run `bun add -d @kaynooo/eslint@^8`, and drop a `formatters` option from `eslint.config.ts` if it sets one. `kay fmt` formats as before.
31
+ ### `sanitizeHtml` keeps only `language-*` classes on `code`
34
32
 
33
+ A call with `attributes: { code: ['class'] }` now keeps a `code` element's class only when it is `language-` and a language name (`language-ts`, `language-c++`); any other class is dropped. Style the element by its parent or by `[class^='language-']` instead of a class of your own on `code`.
35
34
 
36
- ### Every job takes `(input, ctx)`, and `src/jobs` mounts them
35
+ ## 1.105.0
37
36
 
38
- `deprecated-job-handler`, `deprecated-schedule-call`, `deprecated-job-options` and `deprecated-disk-files` find the old forms: run `kay upgrade` on 1.105 and it rewrites each one written inline.
37
+ The changes to kay.config.ts, the hooks, the stores and the guards of features are in [Upgrading to 1.105: kay.config.ts and library options](upgrading-1-105-config.md).
39
38
 
40
- - A handler is `(input, ctx)` with `ctx.signal`, `ctx.job` (`{ id, attempts, progress }`), `ctx.log` and `ctx.locale`. A queue's `(payload, signal, job)` still runs until 1.108, `ctx` being its signal too; a workflow's `({ id, input, step })` is `(input, { step, job: { id } })`, `job.id` the run's id, and a schedule's or `background` job's `(signal)` is `(_, { signal })`, a schedule's first argument being `{ schedule, boot }`. A handler passed by name is not rewritten and no lint finds it: TypeScript does. The `WorkflowRun` type is `WorkflowContext`, and `JobContext` is the `ctx` of every job.
41
- - `schedule('@hourly', job, options)` is `schedule({ cron: '@hourly', ...options }, job)`, `schedule('30s', job)` is `schedule({ every: '30s' }, job)`; the table form is unchanged. Both work until 1.108.
42
- - `lostAfter` on `queue()` and `workflow()` is `timeout`, as a schedule's; `lostAfter` works until 1.108. `diskFiles('dir', hooks)` is `diskFiles({ dir, ...hooks })`.
43
- - Queues, workflows and schedules move to `src/jobs/*.ts` when an app wants no `export default` and no `.use`; `src/plugins/jobs.ts` keeps working.
39
+ ### `UserMenu` links a visitor to sign in
44
40
 
45
- ### Query params, persisted state, navigation and effects have one API each
41
+ `UserMenu` now draws a sign-in link for a visitor, where it drew nothing: remove the `SignedOut` link you kept beside it, or pass `signIn={false}`. `SignOutButton` and `SignInLink` ([components](../../auth/llms/signed-in-components.md)) replace a hand-written sign-out form and sign-in link.
42
+ ### `SignedIn` takes `require` and an `@else` block
46
43
 
47
- Every old form below works until 1.108, `kay check` reports it as a `deprecated-*` warning, and `kay upgrade` rewrites it. The rewrite reads script fences and TypeScript files: a call written in a template expression, such as an `onClick` handler, stays and works.
44
+ `SignedIn(role="admin")` is `SignedIn(require="admin")`, which takes what `auth.guard({ require })` does (a role, a list of which any one passes, a predicate answering at once), and `SignedOut` is the `@else` block of a `SignedIn`: `SignedIn` holds what a user sees and `@else` what anyone else does. The old forms went in 1.109.
48
45
 
49
- - `persisted.query(name, value, options)` is `queryParam(name, { default: value, ...options })`, the one signal of a query param, which also takes `values` (`deprecated-persisted-query`).
50
- - `persisted(name, value)` is `persisted.cookie(name, value)`: a call names its storage (`deprecated-persisted-call`).
51
- - `navigate({ query: changes }, options)` is `navigate.query(changes, options)`: `navigate(href)` goes to a page, `navigate.query()` changes the query of this one (`deprecated-navigate-query`).
52
- - `onNavigate(fn)` and `onBeforeNavigate(fn)` are `navigation.onNavigate(fn)` and `navigation.onBeforeNavigate(fn)`, the hooks of the source (`deprecated-navigation-hooks`).
53
- - An island listening to `kay:navigate`, `kay:navigate-start`, `kay:navigate-error`, `kay:navigate-stall`, `kay:action-start`, `kay:action-success`, `kay:action-error`, `kay:consent` or `kay:install` with `listen` uses the function hook: `navigation.onNavigate`, `onStart`, `onError` and `onStall`, `add.onStart`, `onData` and `onError` of an action (`{ input }`, `{ error, input }`), the `consent` signal, `installPrompt.available()`. The events still fire for a plain script, and the old listener works until 1.108 (`deprecated-island-events`, which rewrites the swap's events when the handler takes no parameter; the others are reported with the hook to write).
54
- - `listen(window, ...)` is `listen(() => window, ...)`: the target is one form, a function (`deprecated-listen-target`).
55
- - `mount` and `Mounted` are imported from `kay`, not `kay/mount`; `s`, `RateLimit` and `RateLimitRefusal` from `kay`, not `kay/server`; `sqliteCache` from `kay/cache`, not `kay/server` (`deprecated-import-path`).
46
+ ### kayjs-auth's methods share one set of verbs
56
47
 
57
- ### The `storage` option of `persisted()` is gone
48
+ Every group lists with `list`, reads with `get`, writes with `create` and `update`, removes with `delete` and takes back with `revoke`, and a method that sat on `auth` itself went into its group. `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()`. On `auth`: `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 went in 1.109. `admin.deleteUser()` and `password.change()` keep their names, a verb followed by what it acts on.
58
49
 
59
- `persisted(name, value, { storage: 'local' })` is `persisted.local(name, value)`, `{ storage: 'query' }` is `queryParam(name, { default: value })` and `{ storage: 'cookie' }` is `persisted.cookie(name, value)`; `persisted.session()` keeps a value in sessionStorage. The option was deprecated in 1.101 and `deprecated-persisted-storage` goes with it: run `kay upgrade` on 1.104 first and it rewrites every one it can find. On 1.105 the types refuse the option (`PersistedOptions` is gone) and the runtime ignores it, and a call still passing it is reported by `deprecated-persisted-call` with no fix.
60
- ### cms access is one option
50
+ ### An island's call answers a result
61
51
 
62
- `cms({ access })` says who is let in: a kayjs-auth role or a list of them, `{ password }`, a function returning the person, or `false`; `guard`, `role` and `member` still work and are refused beside it. `deprecated-cms-options` (`kay check --fix`) rewrites `role` and `guard: passwordGuard(...)` and a list `uploads` to `uploads: { types }`; it works until 1.108.
52
+ `await add(input)` and `await call(api, '/path')` from an island resolved with the data and threw `ActionError` or `ApiError` for a refusal. They resolve `{ ok: true, data }` or `{ ok: false, status, message, errors, data, error }` now, and throw for no visitor's mistake: a refusal, a handler that threw, a network failure and a timeout (status 0) are results; an abort and a redirect still reject. The `deprecated-call-result` lint that reported the old use went in 1.109, so the type error on the result's field is what shows it. Write `const { ok, data } = await add(input)`, or append `.orThrow()` to keep the throwing style: `const id = await add(input).orThrow()` resolves the data and throws what the call threw (an `ActionError`, or an `ApiError` of status 0 for a call with no answer). A `try` around a call whose `catch` shows the refusal now never runs: read `result.error`, `result.message` or `add.form.error('field')`. A call awaited with its result left out (`await add(input)` in a `try` to know it failed) needs `.orThrow()` or a look at `result.ok`. `track()` handles answer the same, a call with no answer included. A call awaited with its result left out has no read to find and stays by hand. kayjs-ui's `attempt` and `toast.promise` take a call's result as they took what it threw, and `site.call` of a test site is unchanged.
63
53
 
64
- - `cms({ role: 'editor' })` is `cms({ access: 'editor' })`, and `guard: passwordGuard(pw, opts)` is `access: { password: pw, ...opts }`.
65
- - With `roles` listed and no `access`, `guard` or `role`, kayjs-auth admits their holders and refuses everyone else, edit links included, where the screens stayed closed before.
66
- - `cms({ roles })` no longer needs a guard, and `can` no longer needs `roles`; with kayjs-auth and no `access`, the holders of the roles listed are let in, where the screens stayed closed before.
67
- - A production server reads the forge from `CMS_URL` (`forgejo://TOKEN@git.example.com/owner/repo`, `github://TOKEN@owner/repo`, `gitlab://TOKEN@group/project`); `CMS_BASE_URL`, `CMS_REPO`, `CMS_TOKEN`, `CMS_BRANCH` and `CMS_HOST` still work without it, and `kay env` lists `CMS_URL`.
68
- - The no-guard error and warning name `cms({ access })`, as do the `cms.*` message defaults that named `role` or `guard`.
54
+ ### A callback of a library component takes one event object
69
55
 
70
- ### kayjs-mail: one way to send, the forms in kayjs-ui
56
+ A function handed by name to a callback of a kayjs-ui, kayjs-ai or kayjs-cms component (`onValueChange={query.set}`, `onChange={toggle}` with `toggle(on: boolean)`, `onFiles={upload}`) was called with the value and now gets `{ value }`, `{ checked }` or `{ files }`, so it fails the type check, and would be handed the event where it took the value. The `deprecated-callback-handler` lint that named it went in 1.109: write `onChange={event => toggle(event.checked)}` yourself, passing the fields the handler took.
71
57
 
72
- - A page, an action or a guard sends through `ctx.locals.mail` (`send`, `enqueue`, `list`, `suppress`...), the mailer of the site answering the request; a job or a script uses the mailer `src/mail.ts` exports. `send` and `enqueue` imported from `@kayjs/mail` use the latest site started and work until 1.108 (`deprecated-mail-send`, no fix: a call has no request to read the mailer from), and `registeredMailer()` is gone: read `ctx.locals.mail`, or the mailer you made.
73
- - `@kayjs/mail/subscribe-form.kay` is gone: import `SubscribeForm` from `@kayjs/ui/subscribe-form.kay`, which takes the same props and reads the list's `privacy` from the action. Its `kmail-subscribe*` classes are replaced by the themed form's own, and `kay upgrade` rewrites the import (`deprecated-mail-form`).
74
- - `contactForm(options)` takes no mailer and sends through `ctx.locals.mail`; `contactForm(mail, options)` still works.
75
- - `mailer()` and `mail()` take every `MAIL_*` setting as an option that wins over the variable: `url`, `smtp.insecure`, `smtp.rateLimit` and `smtp.dkim` join `from`, `to` and `events`. Nothing to change.
76
- ### kayjs-ai calls share one options type, and a chat takes `labels`
58
+ ### An action's form readers sit under `form`
77
59
 
78
- `kay upgrade` rewrites the forms it can find (`deprecated-ai-labels`, `deprecated-ai-language`, `deprecated-ai-links`); the old forms work until 1.108.
60
+ `add.failed()`, `add.error(field)` and `add.validate(form, field)` are `add.form.failed()`, `add.form.error(field)` and `add.form.validate(form, field)`: what a form shows is read apart from the call state (`pending()`, `status()`, `data()`, `track()`) the action keeps, and a `track()` handle's own `error()` (an `ApiError`) no longer shares a name with the field message. The old names went in 1.109 with the `deprecated-action-readers` lint.
79
61
 
80
- - `Chat`, `ChatLauncher` and `ChatPanel` take `labels={{ send: 'Go', stop: 'Halt' }}`, keyed as the messages are (`ai.chat.send`), in place of the `sendLabel` and `stopLabel` props; `waitingLabel` is `labels.thinking` and `failureLabel` `labels.error`. A flat prop still wins over `labels`.
81
- - `Chat` takes `newTab` (`true`, `false` or `'auto'`, as kayjs-ui's links do) in place of `links`: `links="apart"` is `newTab={true}`, `links="here"` is `newTab="auto"`; `Sources` takes `newTab` in place of `here`. `ChatLauncher` takes `newTab` too, `'auto'` by default.
82
- - The launcher's panel and button are kayjs-ui's `SidePanel` now, so a restyle of `@kayjs/ai/chat-panel.kay` changes: its parts `panel`, `button` and `glyph` are `root` and `launcher` of `'@kayjs/ui/side-panel.kay'` (the glyph is the button's icon), `head` and `title` are the same parts of `'@kayjs/ui/side-panel.kay'`, `body` is its `body`, and `actions` and `action` are gone: the header's buttons are the `new`, `expand` and `close` parts of `chat-panel.kay`. `kay check` already reports a part a component no longer has, listing the ones it has, which is why there is no lint for them. The `.kai-launcher` wrapper is no longer a fixed container and `.kai-launcher-panel` is a `dialog` that is `display: none` unless `[open]` (no `[hidden]`): a rule of an app's own on `.kai-launcher-head`, `-title`, `-actions`, `-glyph` or `.kai-launcher-panel[hidden]` moves to those parts and to `[open]`.
83
- - `transcribe()` and `describeImage()` take `locale`, a BCP 47 tag, in place of `language`.
84
- - `ask`, `describeImage`, `transcribe`, `speak` and `embed` take one `CallOptions`, so `retry`, `fallback`, `timeout`, `signal` and the `ai()` hooks reach each of them. `timeout` also takes a single duration for the whole call.
62
+ ### An auth call answers one `Result`, and a rejection's `errors` are strings
85
63
 
86
- ### kayjs-ui lists are `items`
64
+ kayjs-auth's sixty `*Result` aliases (`PasswordSignInResult`, `RevokeTokenResult`...) are one `Result<Ok, Code, Fields>`: `Result<{ redirect: string }, 'invalid' | 'limited'>` is `{ ok: true, redirect }` or a failure of those kinds. A failure is also a kay `Failure`, so an action returns `auth.password.signIn(...)` as it is and its island call reads `{ ok: false, status, data: { code, message } }`. A rejected input's `errors` holds one string per field (the code for `'taken'` or `'too-short'`, the message of a profile field's `{ message }`), so a profile page reads `errors.<field>` as the text; the old names no longer exist, write `Result<...>` or let the method's return type be inferred.
87
65
 
88
- The prop holding the list a component draws is `items` on every one: `tabs` on Tabs, `avatars` on AvatarGroup, `entries` on CommandPalette and Timeline, `links` on SideNav, SiteNav and AppHeader, `steps` on Steps, `icons` on IconPicker and `slides` on Carousel. The infinite `list` of Table, Carousel, Masonry, MediaGallery, VirtualList and LoadMore is `items` too (`items={feed}`, an `infiniteList`; on a Table `rows` stays the array and `items` the infinite source). `rows` of a Table and `options` of the choice controls keep their names, as do TabNav (its `tabs` and `links` are two shapes picked by `param`) and the `links` of a SideNav group. The old names work until 1.108, and `deprecated-ui-items` (`kay check --fix`) writes `items`; a template written under both reads `items`. Nothing else breaks: `label` on TextInput, Textarea, Select, DateInput, DateTimeInput, TimeInput, MarkdownEditor and FileDrop names the control (an `aria-label`, which still wins), Tabs takes `disabled` and TooltipHost `onOpenChange`.
66
+ ### A refusal is one call
89
67
 
90
- ### A control's `id`, `title` and `data-*` are its root's
68
+ `ctx.deny(status, { message, errors, data })` refuses in a guard, a page, an action and an endpoint, and `refuse(status, { message, errors, data })` throws the same from anywhere; `deny(403, 'text', data)`, `return ctx.fail(status, data, errors)` and `refuse('text', { status, errors, data })` went in 1.109 with the `deprecated-deny-call`, `deprecated-ctx-fail` and `deprecated-refuse-call` lints. In an action, `ctx.deny(status, { message, data, errors })` fails the post as `ctx.fail` did (the page again with the message and the fields, an `ActionError` for a call), while a deny with no options stops with plain text as `deny(status, 'text')` did; a helper called in a handler with its `ctx`, such as a guard's or `limit.check(ctx)`, therefore fails the form with its message now; a `ctx.fail('text')` text is the `message`. The argument checks of `webPush.send`, `rooms`, `signed` and notifications throw a `KayError` with code `argument-invalid`, not a `RangeError` or `TypeError`.
91
69
 
92
- Toggle, Checkbox, Slider, ColorInput, Combobox and DateInput put the attributes they are given that no control owns (`id`, `title`, `data-*`) on their root element, as every kayjs-ui component does; they reached the input before. The input takes `inputProps`, typed as an input's attributes: `Toggle(label="Alerts" inputProps={{ id: 'alerts' }})`. `name`, `disabled`, `required`, `value`, `aria-*`, `data-tooltip`, `ref` and the `on*` handlers still reach the input. `deprecated-ui-input` (`kay check --fix`) writes the `id`, `title` and `data-*` of a component in a template into `inputProps`, which keeps the old markup; a Combobox's `id`, the list's, stays. Something that reads the input through the `id` of a spread (a stylesheet, a script, a `label(for)`) needs the `inputProps` form, or the root's `id`.
70
+ ### A top-level `const` follows the prop or signal it reads
93
71
 
94
- ### SidePanel is a Dialog with a side `placement`
72
+ In the browser, `const last = items.length - 1` or `const twice = count() * 2` at the top of a script was computed once and now follows what it reads, so a `memo(() => ...)` or a function written for it can go. A `const` that meant the first value of a prop is written `// kay-allow once-read-prop: why` (`kay check` asks for it as before), and of a signal `untrack(() => count())`; it cannot be assigned. Nothing to rewrite otherwise.
95
73
 
96
- `SidePanel` draws a `Dialog` with `placement="right"`, so the head, title, body and footer are the Dialog's. Nothing changes in its props, and its `parts` still take `head`, `title`, `body` and `footer`, handed to the Dialog. A `src/ui.ts` entry for `'@kayjs/ui/side-panel.kay'` with `head`, `title`, `body` or `footer` moves to `'@kayjs/ui/dialog.kay'` (which then restyles centred dialogs too: a part restyled for one placement only is `class` on the call); `kay check` reports the entry left behind, as a part the component no longer has.
74
+ ### Eight mistakes that ship a broken page refuse
97
75
 
98
- ### A page is never an island
76
+ `unreturned-fail`, `brace-in-attribute`, `signal-set-call`, `constant-signal`, `literal-tag`, `positional-key`, `unkeyed-rows` and `once-read-prop` were warnings and are now `deny`: `kay check` reports each as an error, so the `check` script of an app fails on one it still has. `kay check --fix` applies the fixes of `unreturned-fail`, `brace-in-attribute`, `signal-set-call` and `positional-key`; for the others write what the lint's message says, or `// kay-allow <lint> -- why` where the form is meant. `lints: { 'constant-signal': 'warn' }` in kay.config.ts brings one back to a warning.
99
77
 
100
- A page without a `--- server` fence that has an `on*`, `bind:` or `ref`, a browser value of `kay` such as `signal`, or a live or persisted import used to become an island. It still does through 1.107, and `kay check` warns with `deprecated-page-island` at that line; 1.108 refuses it. Move what needs the browser into a component of its own and render it from the page: the component is the island. No `kay upgrade` fix exists, as the fix moves code into a new file.
78
+ ### An `await` with no `catch` shows an alert
101
79
 
102
- Releases before 1.105 are in the notes of their releases, at https://git.kaynooo.fr/kaynooo/kayjs/releases.
80
+ A rejected `await` block with no `catch` and no `try` around it used to remove its pending block and show nothing; it renders `<span class="kay-await-failed" role="alert" data-kay-await-failed>` now (the `kay.await.failed` message), so the `uncaught-await` lint is gone, and in 1.109 a `// kay-allow uncaught-await` comment or a `lints` entry naming it is an unknown lint. `AwaitProps` of `kay` no longer has `fallback`, the compiler's own channel for a `try`'s `catch`.
81
+
82
+ ### A `for` over rows with no `id` needs a `key` in every component
83
+
84
+ `unkeyed-rows` reported a keyless `for` in islands only; it reports one in any component, a page or a layout excepted, as a component may render in the browser whichever page imports it. Name the rows with `key={row.slug}` or give them an `id`; `key={i}` (the fix `kay check` offers) matches them by position.
85
+
86
+ ### `slot` types the children and blocks of a component
103
87
 
104
- ### Island sources read and report the same way
88
+ A component no longer declares `children?: Snippet`, nor an optional block it renders with `slot name`: its template types them, so a call passing a block the component has no `slot` for is a `kay check` error. Its lint went in 1.109; declare `children: Snippet` to require the children.
105
89
 
106
- every source (`resource`, `stream`, `socket`, `local`, a `track()` handle) has `data()`, `status()`, `pending()`, `error()` and `retry()`, and `onData({ value })` and `onError`. `value()`, `last()`, `rows()`, `unsynced()`, `syncStatus()`, `onSuccess`, `onSync` and an action's `succeeded()` work through 1.107, and `kay check` warns with `deprecated-source-readers` and `kay upgrade` rewrites them.
90
+ ### A link's flags are named as `navigate()`'s options
107
91
 
108
- An action has `data()` and `status()` too, and `succeeded()` is `data()` (what the last call returned, `status() === 'ready'` for whether there was one); an action has no `retry()`, `onData` or `onError` of its own, its `track()` handle does.
92
+ `data-keep-scroll` is `data-scroll="keep"` (`data-keep-scroll="false"` is `data-scroll="top"`), `data-no-transition` is `data-transition="false"` and `data-no-prefetch` is `data-prefetch="false"`, typed on every element, so a wrong value is a `kay check` error; a wrapper another library marks `data-scroll` now keeps its links' scroll. The old names went in 1.109. A `data-` name one letter from a flag, as `data-prefech`, is the `unknown-link-flag` error.
109
93
 
110
- Not rewritten, so by hand: `pending()` and `status()` of a `local()` collection keep their names and change meaning, so no check can tell an old read from a new one: they read a boolean and `idle|loading|ready|failed`, not the count and the sync states, and `{todos.pending()}` renders `true` or `false` now. Write `sync.queued()` and `sync.status()` for the old reads, and `ReturnType<LocalSync['status']>` where the type `LocalStatus` was used (it is gone). `rows()` of an `infiniteList()` and `last()` of the stream an action's island call returns are `data()`, with no lint, as `kay check` does not follow an import of kayjs-ui nor the receiver of an awaited call. A custom list given to `LoadMore` or `Table` takes `data()` beside `rows()` (a list with only `rows()` still works through 1.107), and a fake stream in a test needs `data`. `succeeded()` read as a whole (passed on, or `succeeded()?.data?.id`) becomes `data()` with `status() === 'ready'` where it tested for a result. An event's `data` and `rows` in a handler passed by name are `value` now.
111
- ### Live values and presence write alike
94
+ ### A component's parts are the `parts` attribute
112
95
 
113
- `set` of a live value takes the next value first and where it goes in its options: `room.set(next, { key: id })` of a value per key, `unread.set(next, { user: id })` of a value per user, and `visitors.set(next)` as before. `presence({ room, member })` takes one object, in place of `presence(room, member)`. The old forms work until 1.108, `kay check` warns with `deprecated-live-api` and `kay upgrade` rewrites them, on a value declared in the file with `live()` or imported under a name every declaration of the project agrees on; a value reached through a namespace import is not found. A `set(key, next)` whose `next` is an object holding only `key` (or `user`) reads as the new form, so write it in the new order.
96
+ `Card(class={{ head: 'p-6' }})` is `Card(parts={{ head: 'p-6' }})`: `class` keeps strings, arrays and objects of conditions, and `parts` holds an entry per part, `root` included, so a shorthand or a spread can sit beside it, and a component declaring its own `parts` prop is refused as one declaring `class` is (`Card.mt-4(parts={{ head: 'p-6' }})`). A component with parts takes both props, and `parts` leaves `...rest` as `class` does. A component with parts takes `class` as a string, an array or an object of conditions.
114
97
 
115
- ### One Action type crosses into components
98
+ ### Websocket frames are always JSON
116
99
 
117
- `Action` with no parameters takes any action as a prop, in place of `Action<never, unknown>`: the old spelling works until 1.108 and `deprecated-action-type` rewrites it. A `.with()` action now crosses into an island, its fields sent over the input of each call, where it failed the render; `NoInputAction` stays.
100
+ On an `api()` module, `ws.send(value)` now sends `JSON.stringify(value)` for a string too, and a frame a client sends must be JSON text, so a binary frame from a client is refused too, and one that is not is answered `{ error: { key: 'kay.socket.notJson', fields } }`, and a message failing `body` `{ error: { key: 'kay.socket.invalid', fields } }` where it was dropped before. `deprecated-socket-frames` (`kay check --fix`) rewrites `ws.send(JSON.stringify(x))` to `ws.send(x)`, which sends what it did; a raw `WebSocket` client of your own parses each frame with `JSON.parse` and sends `JSON.stringify(message)`, and `socket()` does both. `rooms().publish` goes out as JSON the same way, a string included.
118
101
 
119
- ### Component callbacks take one event object
102
+ ### An endpoint's declared context is checked
120
103
 
121
- Every transition callback of a kayjs-ui, kayjs-ai or kayjs-cms component takes one object holding what it reports, never positional arguments or a bare value: `onOpenChange(true)` is `onOpenChange({ open })`, `onChange(value, option)` is `onChange({ value, option })`. A handler written by hand destructures the event, `onChange={({ value }) => kind = value}` in place of `onChange={kind.set}`; `kay check` types it, so a handler reading the old arguments fails the check. The fields are in [the conventions](component-library-conventions.md) and each component's page: `open`, `value`, `checked` (Checkbox, Toggle, Menu), `rows`, `files`, `item` (`onSelect`), `page`, `size`, `sort`, `row`, `index`, `text`, `data` (`onSave`, `onSend`), `audio`, `crop`, `from` and `to`. A source reports `onLoad({ options, query })`, `{ rows }` on Table and `{ items }` on VirtualList. `onSelectedChange` is `{ keys, rows }` on Table, `{ id, node }` on TreeView and `{ key, entry }` on Timeline, so `bind:selected` no longer applies to them. `onError`, the callbacks with no argument and Chat's `onSend({ messages })` are unchanged.
104
+ An endpoint's `ctx: EndpointContext` and an `api()` module's `ctx.guard` are now typed from the file tree without a generic, so `ctx.params.x` for a param the file's name lacks, a `ctx.guard` field no guard above returns and a `ctx.query` field outside `page.query` are type errors in `kay check`.
122
105
 
123
- Four callbacks are renamed to say what they report, and the old names keep working with their positional arguments until 1.108: `onChange` of Accordion, Tabs and ThemeToggle is `onValueChange`, ZoomPane's is `onPlateChange({ plate })`, Table's `onSort` is `onSortChange({ sort })` and a chart's `onActive` is `onActiveChange({ index })`. `kay check` reports them as `deprecated-ui-callbacks` and `kay upgrade` rewrites an inline arrow function, any other value getting the new name only.
106
+ `kay check` holds the `EndpointContext<Params, Guard>` a handler declares to its file's params and the `_guard.ts` files above it: a param the file has not, or a guard field no guard returns, is a type error. Declare what the guards return, or `any` as the guard type, where a guard fills `locals` instead; a file listing `guards` of its own is not checked.
124
107
 
108
+ ### Test helpers share one shape
109
+
110
+ `aiTest`, `mailTest`, `cmsTest` and `authTest` of the libraries' `/test` entries are `test(site)` in each, taking the `TestSite` and with a `reset()`; `aiTest()` needed no site, `test(site)` takes it and works without. `site.refusal(action, ...)` is `site.expectRefused(action, ...)` and `site.socketRefusal(...)` is `site.socket.refused(...)`. The old names went in 1.109; import `test as mailTest` to keep the local name, so `bun:test`'s own `test` is not shadowed.
111
+
112
+ A call to another host with `fetch` that no `site.fetchStub` answers now fails a test once `testSite()` made a site: stub it, or give `testSite({ outgoing: 'allow' })`. Calls to loopback (a `fakeService`) are unaffected. The clock `site.advance` moved goes back to real time after each test, not only after the file.
113
+
114
+ Releases before 1.105 are in the notes of their releases, at https://git.kaynooo.fr/kaynooo/kayjs/releases.