@kayjs/kay 1.105.0 → 1.107.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 (467) hide show
  1. package/README.md +2 -2
  2. package/dist/eslint.js +777 -210
  3. package/editors/zed/extension.toml +2 -2
  4. package/llms/action-protection.md +2 -2
  5. package/llms/actions-from-islands.md +2 -2
  6. package/llms/actions-refused-fields.md +22 -0
  7. package/llms/actions.md +24 -41
  8. package/llms/analytics.md +1 -1
  9. package/llms/api-from-islands.md +1 -1
  10. package/llms/api-routes.md +6 -6
  11. package/llms/browser-only.md +1 -1
  12. package/llms/check-and-tools.md +1 -1
  13. package/llms/code-lints.md +2 -2
  14. package/llms/compiler-api.md +1 -1
  15. package/llms/component-libraries.md +1 -0
  16. package/llms/components.md +1 -1
  17. package/llms/content-cms.md +1 -1
  18. package/llms/content-markdown-to-caching.md +1 -1
  19. package/llms/content-preview.md +2 -2
  20. package/llms/content.md +21 -21
  21. package/llms/deprecated-lints-1-105-libraries.md +2 -0
  22. package/llms/deprecated-lints-1-105.md +3 -3
  23. package/llms/deprecated-lints.md +4 -4
  24. package/llms/dev-tool.md +2 -2
  25. package/llms/environment.md +22 -22
  26. package/llms/files.md +5 -5
  27. package/llms/island-and-form-lints.md +1 -0
  28. package/llms/islands-state-to-ids.md +2 -1
  29. package/llms/islands.md +10 -1
  30. package/llms/local-collections.md +2 -2
  31. package/llms/mcp.md +2 -1
  32. package/llms/navigation-from-code.md +1 -1
  33. package/llms/notifications.md +4 -2
  34. package/llms/project-new-and-add.md +1 -1
  35. package/llms/project.md +3 -3
  36. package/llms/rate-limits.md +1 -1
  37. package/llms/recipes.md +16 -16
  38. package/llms/rooms.md +4 -4
  39. package/llms/routing-endpoints-and-base.md +1 -1
  40. package/llms/routing.md +5 -5
  41. package/llms/schemas.md +14 -7
  42. package/llms/server.md +7 -7
  43. package/llms/site.md +9 -9
  44. package/llms/sitemap-search-fonts.md +2 -0
  45. package/llms/styles-and-assets.md +2 -1
  46. package/llms/templates-elements-slots-snippets.md +2 -2
  47. package/llms/testing-browser.md +20 -0
  48. package/llms/testing.md +1 -1
  49. package/llms/upgrading-1-105-config.md +2 -2
  50. package/llms/upgrading.md +37 -4
  51. package/llms/whats-new-archive.md +35 -66
  52. package/llms/whats-new.md +47 -28
  53. package/llms.txt +1 -1
  54. package/package.json +24 -11
  55. package/src/add.ts +1 -1
  56. package/src/build/class-table.ts +2 -2
  57. package/src/build/client.ts +27 -30
  58. package/src/build/entry-files.ts +19 -0
  59. package/src/build/lazy-components.ts +130 -0
  60. package/src/build/lazy-manifest.ts +56 -0
  61. package/src/build/lazy-stubs.ts +31 -0
  62. package/src/build/plugin.ts +16 -11
  63. package/src/build/runtime-chunk.ts +1 -1
  64. package/src/build/styles.ts +3 -3
  65. package/src/build/transform.ts +19 -7
  66. package/src/build/ui-layers.ts +30 -0
  67. package/src/build/ui.ts +108 -11
  68. package/src/build/variants.ts +125 -46
  69. package/src/build/worker-bundle.ts +6 -0
  70. package/src/check/action-options.ts +56 -0
  71. package/src/check/boot.ts +22 -1
  72. package/src/check/call-result.ts +242 -0
  73. package/src/check/config-objects.ts +17 -2
  74. package/src/check/diagnose.ts +22 -0
  75. package/src/check/handler-events.ts +149 -0
  76. package/src/check/index.ts +6 -2
  77. package/src/check/link-flag-tests.ts +130 -0
  78. package/src/check/project.ts +4 -3
  79. package/src/check/refusal-calls.ts +2 -2
  80. package/src/check/regroup.ts +5 -3
  81. package/src/check/renamed-packages.ts +58 -14
  82. package/src/check/schema-builders.ts +256 -0
  83. package/src/check/schema-json.ts +226 -0
  84. package/src/check/secret-keys.ts +15 -2
  85. package/src/check/shadow-types.ts +13 -9
  86. package/src/check/template-hints.ts +1 -1
  87. package/src/check/tool-labels.ts +11 -9
  88. package/src/check/ui-types.ts +4 -3
  89. package/src/check/ui.ts +14 -11
  90. package/src/commands/env-declare.ts +18 -6
  91. package/src/commands/routes.ts +1 -1
  92. package/src/compiler/a11y.ts +8 -1
  93. package/src/compiler/ast.ts +1 -1
  94. package/src/compiler/bound-props.ts +1 -1
  95. package/src/compiler/codegen.ts +13 -23
  96. package/src/compiler/deprecated-lints-1-105.ts +41 -0
  97. package/src/compiler/deprecated-lints-1-106.ts +14 -0
  98. package/src/compiler/deprecated-lints-1-107.ts +14 -0
  99. package/src/compiler/deprecated-lints.ts +17 -60
  100. package/src/compiler/deprecated-typed-lints.ts +23 -0
  101. package/src/compiler/dom-here.ts +72 -0
  102. package/src/compiler/dom.ts +23 -23
  103. package/src/compiler/fence-checks.ts +12 -11
  104. package/src/compiler/field-described.ts +2 -2
  105. package/src/compiler/helper-imports.ts +1 -1
  106. package/src/compiler/html-fields.ts +92 -0
  107. package/src/compiler/html-initial.ts +5 -3
  108. package/src/compiler/html.ts +14 -31
  109. package/src/compiler/import-edits.ts +15 -0
  110. package/src/compiler/index.ts +10 -3
  111. package/src/compiler/island-declaration.ts +15 -0
  112. package/src/compiler/items.ts +5 -5
  113. package/src/compiler/kay-exports.ts +1 -0
  114. package/src/compiler/lazy-imports.ts +357 -0
  115. package/src/compiler/link-flags.ts +6 -5
  116. package/src/compiler/lints.ts +12 -12
  117. package/src/compiler/parser.ts +2 -2
  118. package/src/compiler/rest-omits.ts +15 -0
  119. package/src/compiler/route-lints.ts +2 -0
  120. package/src/compiler/schema-lints.ts +13 -0
  121. package/src/compiler/script-server.ts +6 -3
  122. package/src/config-loader.ts +10 -2
  123. package/src/config-resolve.ts +3 -1
  124. package/src/config-shape.ts +2 -2
  125. package/src/config.ts +20 -4
  126. package/src/content/markdown.ts +2 -3
  127. package/src/content/validate.ts +1 -1
  128. package/src/generate-resource.ts +9 -9
  129. package/src/generate.ts +1 -1
  130. package/src/mcp/guards.ts +1 -1
  131. package/src/mcp/tools.ts +1 -1
  132. package/src/migrate/content.ts +61 -55
  133. package/src/new.ts +6 -2
  134. package/src/runtime/action-shared.ts +2 -2
  135. package/src/runtime/action.ts +51 -4
  136. package/src/runtime/client.ts +10 -0
  137. package/src/runtime/dom-lazy.ts +276 -0
  138. package/src/runtime/field-errors.ts +58 -0
  139. package/src/runtime/field-refusal.ts +179 -0
  140. package/src/runtime/form-types.ts +99 -0
  141. package/src/runtime/form.ts +25 -9
  142. package/src/runtime/html.ts +42 -6
  143. package/src/runtime/index.ts +2 -0
  144. package/src/runtime/island.server.ts +36 -2
  145. package/src/runtime/markdown-autolink.ts +69 -0
  146. package/src/runtime/markdown-render.client.ts +39 -3
  147. package/src/runtime/markdown.client.ts +6 -3
  148. package/src/runtime/markdown.server.ts +6 -3
  149. package/src/runtime/markdown.ts +125 -1
  150. package/src/runtime/navigate-api.ts +10 -5
  151. package/src/runtime/persist.ts +7 -7
  152. package/src/runtime/query-param.ts +1 -1
  153. package/src/runtime/reactive.ts +14 -0
  154. package/src/runtime/sanitize.ts +3 -1
  155. package/src/runtime/schema-record.ts +32 -0
  156. package/src/runtime/schema.client.ts +101 -14
  157. package/src/runtime/schema.ts +328 -26
  158. package/src/runtime/standard-schema.ts +32 -0
  159. package/src/runtime/swap-focus.ts +59 -11
  160. package/src/runtime/validate-run.client.ts +179 -0
  161. package/src/runtime/validate.client.ts +11 -0
  162. package/src/runtime/validate.ts +4 -137
  163. package/src/server/action-module.ts +16 -0
  164. package/src/server/actions.ts +54 -57
  165. package/src/server/answer.ts +102 -0
  166. package/src/server/api-input.ts +166 -0
  167. package/src/server/api-modules.ts +1 -1
  168. package/src/server/api.ts +12 -32
  169. package/src/server/app-stages.ts +38 -26
  170. package/src/server/app.ts +5 -2
  171. package/src/server/client.ts +2 -0
  172. package/src/server/dev-ui.ts +2 -2
  173. package/src/server/dev.ts +7 -9
  174. package/src/server/env-state.ts +1 -1
  175. package/src/server/env.ts +11 -3
  176. package/src/server/favicon.ts +47 -1
  177. package/src/server/file-limit.ts +7 -1
  178. package/src/server/forms.ts +1 -1
  179. package/src/server/host-allowlist.ts +7 -7
  180. package/src/server/image-metadata-bmff.ts +1 -1
  181. package/src/server/index.ts +2 -0
  182. package/src/server/kay-routes.ts +221 -0
  183. package/src/server/kay-server.ts +228 -0
  184. package/src/server/kept-exports.ts +1 -0
  185. package/src/server/kept-pages.ts +3 -3
  186. package/src/server/library.ts +2 -2
  187. package/src/server/mcp.ts +14 -13
  188. package/src/server/notifications.ts +4 -2
  189. package/src/server/offline.ts +24 -7
  190. package/src/server/openapi.ts +12 -3
  191. package/src/server/phases.ts +249 -0
  192. package/src/server/protection.ts +6 -6
  193. package/src/server/proxy-key.ts +8 -8
  194. package/src/server/push-settings.ts +16 -2
  195. package/src/server/push.ts +12 -4
  196. package/src/server/query.ts +17 -31
  197. package/src/server/receive.ts +43 -0
  198. package/src/server/render-document.ts +13 -3
  199. package/src/server/render.ts +1 -1
  200. package/src/server/request-context.ts +137 -0
  201. package/src/server/schema-check.ts +1 -1
  202. package/src/server/scope.ts +20 -13
  203. package/src/server/signals.ts +4 -4
  204. package/src/server/socket.ts +19 -47
  205. package/src/server/stream.ts +1 -1
  206. package/src/server/validate.ts +346 -0
  207. package/src/template-ws.ts +1 -1
  208. package/src/test/a11y-dom.ts +70 -0
  209. package/src/test/html-snapshot.ts +103 -0
  210. package/src/test/index.ts +2 -1
  211. package/src/test/mount.ts +14 -3
  212. package/src/test/page-checks.ts +12 -0
  213. package/src/test/screenshot-match.ts +2 -2
  214. package/src/test/shared-modules.ts +27 -5
  215. package/src/test/site-types.ts +5 -1
  216. package/types/build/class-table.d.ts +1 -1
  217. package/types/build/class-table.d.ts.map +1 -1
  218. package/types/build/client.d.ts +3 -2
  219. package/types/build/client.d.ts.map +1 -1
  220. package/types/build/entry-files.d.ts +4 -0
  221. package/types/build/entry-files.d.ts.map +1 -0
  222. package/types/build/lazy-components.d.ts +6 -0
  223. package/types/build/lazy-components.d.ts.map +1 -0
  224. package/types/build/lazy-manifest.d.ts +19 -0
  225. package/types/build/lazy-manifest.d.ts.map +1 -0
  226. package/types/build/lazy-stubs.d.ts +5 -0
  227. package/types/build/lazy-stubs.d.ts.map +1 -0
  228. package/types/build/plugin.d.ts +1 -0
  229. package/types/build/plugin.d.ts.map +1 -1
  230. package/types/build/transform.d.ts +4 -1
  231. package/types/build/transform.d.ts.map +1 -1
  232. package/types/build/ui-layers.d.ts +5 -0
  233. package/types/build/ui-layers.d.ts.map +1 -0
  234. package/types/build/ui.d.ts +7 -0
  235. package/types/build/ui.d.ts.map +1 -1
  236. package/types/build/variants.d.ts +1 -1
  237. package/types/build/variants.d.ts.map +1 -1
  238. package/types/build/worker-bundle.d.ts +1 -0
  239. package/types/build/worker-bundle.d.ts.map +1 -1
  240. package/types/check/action-options.d.ts +3 -0
  241. package/types/check/action-options.d.ts.map +1 -0
  242. package/types/check/boot.d.ts.map +1 -1
  243. package/types/check/call-result.d.ts +7 -0
  244. package/types/check/call-result.d.ts.map +1 -0
  245. package/types/check/config-objects.d.ts.map +1 -1
  246. package/types/check/diagnose.d.ts.map +1 -1
  247. package/types/check/handler-events.d.ts +9 -0
  248. package/types/check/handler-events.d.ts.map +1 -0
  249. package/types/check/index.d.ts +1 -0
  250. package/types/check/index.d.ts.map +1 -1
  251. package/types/check/link-flag-tests.d.ts +4 -0
  252. package/types/check/link-flag-tests.d.ts.map +1 -0
  253. package/types/check/project.d.ts.map +1 -1
  254. package/types/check/regroup.d.ts +1 -1
  255. package/types/check/regroup.d.ts.map +1 -1
  256. package/types/check/renamed-packages.d.ts +1 -0
  257. package/types/check/renamed-packages.d.ts.map +1 -1
  258. package/types/check/schema-builders.d.ts +3 -0
  259. package/types/check/schema-builders.d.ts.map +1 -0
  260. package/types/check/schema-json.d.ts +3 -0
  261. package/types/check/schema-json.d.ts.map +1 -0
  262. package/types/check/secret-keys.d.ts.map +1 -1
  263. package/types/check/shadow-types.d.ts.map +1 -1
  264. package/types/check/template-hints.d.ts +1 -0
  265. package/types/check/template-hints.d.ts.map +1 -1
  266. package/types/check/tool-labels.d.ts.map +1 -1
  267. package/types/check/ui-types.d.ts.map +1 -1
  268. package/types/check/ui.d.ts.map +1 -1
  269. package/types/commands/env-declare.d.ts.map +1 -1
  270. package/types/compiler/a11y.d.ts.map +1 -1
  271. package/types/compiler/bound-props.d.ts +1 -0
  272. package/types/compiler/bound-props.d.ts.map +1 -1
  273. package/types/compiler/codegen.d.ts +3 -0
  274. package/types/compiler/codegen.d.ts.map +1 -1
  275. package/types/compiler/deprecated-lints-1-105.d.ts +39 -0
  276. package/types/compiler/deprecated-lints-1-105.d.ts.map +1 -0
  277. package/types/compiler/deprecated-lints-1-106.d.ts +12 -0
  278. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -0
  279. package/types/compiler/deprecated-lints-1-107.d.ts +12 -0
  280. package/types/compiler/deprecated-lints-1-107.d.ts.map +1 -0
  281. package/types/compiler/deprecated-lints.d.ts +41 -22
  282. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  283. package/types/compiler/deprecated-typed-lints.d.ts +21 -0
  284. package/types/compiler/deprecated-typed-lints.d.ts.map +1 -0
  285. package/types/compiler/dom-here.d.ts +14 -0
  286. package/types/compiler/dom-here.d.ts.map +1 -0
  287. package/types/compiler/dom.d.ts +1 -0
  288. package/types/compiler/dom.d.ts.map +1 -1
  289. package/types/compiler/fence-checks.d.ts.map +1 -1
  290. package/types/compiler/field-described.d.ts +1 -1
  291. package/types/compiler/field-described.d.ts.map +1 -1
  292. package/types/compiler/html-fields.d.ts +19 -0
  293. package/types/compiler/html-fields.d.ts.map +1 -0
  294. package/types/compiler/html-initial.d.ts +3 -2
  295. package/types/compiler/html-initial.d.ts.map +1 -1
  296. package/types/compiler/html.d.ts.map +1 -1
  297. package/types/compiler/import-edits.d.ts +1 -0
  298. package/types/compiler/import-edits.d.ts.map +1 -1
  299. package/types/compiler/index.d.ts +3 -0
  300. package/types/compiler/index.d.ts.map +1 -1
  301. package/types/compiler/island-declaration.d.ts +5 -0
  302. package/types/compiler/island-declaration.d.ts.map +1 -1
  303. package/types/compiler/items.d.ts +4 -1
  304. package/types/compiler/items.d.ts.map +1 -1
  305. package/types/compiler/kay-exports.d.ts.map +1 -1
  306. package/types/compiler/lazy-imports.d.ts +33 -0
  307. package/types/compiler/lazy-imports.d.ts.map +1 -0
  308. package/types/compiler/link-flags.d.ts +6 -0
  309. package/types/compiler/link-flags.d.ts.map +1 -1
  310. package/types/compiler/lints.d.ts +61 -34
  311. package/types/compiler/lints.d.ts.map +1 -1
  312. package/types/compiler/rest-omits.d.ts +4 -0
  313. package/types/compiler/rest-omits.d.ts.map +1 -0
  314. package/types/compiler/route-lints.d.ts +8 -0
  315. package/types/compiler/route-lints.d.ts.map +1 -1
  316. package/types/compiler/schema-lints.d.ts +11 -0
  317. package/types/compiler/schema-lints.d.ts.map +1 -0
  318. package/types/compiler/script-server.d.ts.map +1 -1
  319. package/types/config-loader.d.ts.map +1 -1
  320. package/types/config-resolve.d.ts.map +1 -1
  321. package/types/config.d.ts +15 -2
  322. package/types/config.d.ts.map +1 -1
  323. package/types/content/markdown.d.ts.map +1 -1
  324. package/types/migrate/content.d.ts.map +1 -1
  325. package/types/new.d.ts +1 -0
  326. package/types/new.d.ts.map +1 -1
  327. package/types/runtime/action-shared.d.ts +1 -1
  328. package/types/runtime/action-shared.d.ts.map +1 -1
  329. package/types/runtime/action.d.ts +29 -1
  330. package/types/runtime/action.d.ts.map +1 -1
  331. package/types/runtime/client.d.ts.map +1 -1
  332. package/types/runtime/dom-lazy.d.ts +6 -0
  333. package/types/runtime/dom-lazy.d.ts.map +1 -0
  334. package/types/runtime/field-errors.d.ts +4 -0
  335. package/types/runtime/field-errors.d.ts.map +1 -0
  336. package/types/runtime/field-refusal.d.ts +37 -0
  337. package/types/runtime/field-refusal.d.ts.map +1 -0
  338. package/types/runtime/form-types.d.ts +6 -0
  339. package/types/runtime/form-types.d.ts.map +1 -0
  340. package/types/runtime/form.d.ts +4 -2
  341. package/types/runtime/form.d.ts.map +1 -1
  342. package/types/runtime/html.d.ts +3 -0
  343. package/types/runtime/html.d.ts.map +1 -1
  344. package/types/runtime/index.d.ts +2 -0
  345. package/types/runtime/index.d.ts.map +1 -1
  346. package/types/runtime/island.server.d.ts +2 -0
  347. package/types/runtime/island.server.d.ts.map +1 -1
  348. package/types/runtime/markdown-autolink.d.ts +11 -0
  349. package/types/runtime/markdown-autolink.d.ts.map +1 -0
  350. package/types/runtime/markdown-render.client.d.ts +2 -1
  351. package/types/runtime/markdown-render.client.d.ts.map +1 -1
  352. package/types/runtime/markdown.client.d.ts +3 -1
  353. package/types/runtime/markdown.client.d.ts.map +1 -1
  354. package/types/runtime/markdown.d.ts +11 -0
  355. package/types/runtime/markdown.d.ts.map +1 -1
  356. package/types/runtime/markdown.server.d.ts +3 -1
  357. package/types/runtime/markdown.server.d.ts.map +1 -1
  358. package/types/runtime/navigate-api.d.ts +1 -1
  359. package/types/runtime/navigate-api.d.ts.map +1 -1
  360. package/types/runtime/persist.d.ts +2 -2
  361. package/types/runtime/persist.d.ts.map +1 -1
  362. package/types/runtime/reactive.d.ts +3 -0
  363. package/types/runtime/reactive.d.ts.map +1 -1
  364. package/types/runtime/sanitize.d.ts.map +1 -1
  365. package/types/runtime/schema-record.d.ts +9 -0
  366. package/types/runtime/schema-record.d.ts.map +1 -0
  367. package/types/runtime/schema.client.d.ts.map +1 -1
  368. package/types/runtime/schema.d.ts +99 -10
  369. package/types/runtime/schema.d.ts.map +1 -1
  370. package/types/runtime/standard-schema.d.ts +37 -0
  371. package/types/runtime/standard-schema.d.ts.map +1 -0
  372. package/types/runtime/swap-focus.d.ts.map +1 -1
  373. package/types/runtime/validate-run.client.d.ts +4 -0
  374. package/types/runtime/validate-run.client.d.ts.map +1 -0
  375. package/types/runtime/validate.client.d.ts +4 -0
  376. package/types/runtime/validate.client.d.ts.map +1 -0
  377. package/types/runtime/validate.d.ts +1 -21
  378. package/types/runtime/validate.d.ts.map +1 -1
  379. package/types/server/action-module.d.ts +2 -0
  380. package/types/server/action-module.d.ts.map +1 -0
  381. package/types/server/actions.d.ts +1 -0
  382. package/types/server/actions.d.ts.map +1 -1
  383. package/types/server/answer.d.ts +6 -0
  384. package/types/server/answer.d.ts.map +1 -0
  385. package/types/server/api-input.d.ts +19 -0
  386. package/types/server/api-input.d.ts.map +1 -0
  387. package/types/server/api.d.ts.map +1 -1
  388. package/types/server/app-stages.d.ts +7 -3
  389. package/types/server/app-stages.d.ts.map +1 -1
  390. package/types/server/app.d.ts +2 -0
  391. package/types/server/app.d.ts.map +1 -1
  392. package/types/server/client.d.ts +1 -0
  393. package/types/server/client.d.ts.map +1 -1
  394. package/types/server/dev.d.ts +1 -1
  395. package/types/server/dev.d.ts.map +1 -1
  396. package/types/server/env-state.d.ts.map +1 -1
  397. package/types/server/env.d.ts +5 -1
  398. package/types/server/env.d.ts.map +1 -1
  399. package/types/server/favicon.d.ts +3 -1
  400. package/types/server/favicon.d.ts.map +1 -1
  401. package/types/server/file-limit.d.ts.map +1 -1
  402. package/types/server/host-allowlist.d.ts +3 -3
  403. package/types/server/host-allowlist.d.ts.map +1 -1
  404. package/types/server/index.d.ts +2 -0
  405. package/types/server/index.d.ts.map +1 -1
  406. package/types/server/kay-routes.d.ts +47 -0
  407. package/types/server/kay-routes.d.ts.map +1 -0
  408. package/types/server/kay-server.d.ts +25 -0
  409. package/types/server/kay-server.d.ts.map +1 -0
  410. package/types/server/kept-exports.d.ts.map +1 -1
  411. package/types/server/kept-pages.d.ts +1 -1
  412. package/types/server/kept-pages.d.ts.map +1 -1
  413. package/types/server/library.d.ts +2 -1
  414. package/types/server/library.d.ts.map +1 -1
  415. package/types/server/mcp.d.ts +1 -1
  416. package/types/server/mcp.d.ts.map +1 -1
  417. package/types/server/notifications.d.ts +2 -1
  418. package/types/server/notifications.d.ts.map +1 -1
  419. package/types/server/offline.d.ts.map +1 -1
  420. package/types/server/openapi.d.ts.map +1 -1
  421. package/types/server/phases.d.ts +36 -0
  422. package/types/server/phases.d.ts.map +1 -0
  423. package/types/server/protection.d.ts +3 -2
  424. package/types/server/protection.d.ts.map +1 -1
  425. package/types/server/proxy-key.d.ts +3 -3
  426. package/types/server/proxy-key.d.ts.map +1 -1
  427. package/types/server/push-settings.d.ts +1 -1
  428. package/types/server/push-settings.d.ts.map +1 -1
  429. package/types/server/push.d.ts +1 -0
  430. package/types/server/push.d.ts.map +1 -1
  431. package/types/server/query.d.ts.map +1 -1
  432. package/types/server/receive.d.ts +9 -0
  433. package/types/server/receive.d.ts.map +1 -0
  434. package/types/server/render-document.d.ts.map +1 -1
  435. package/types/server/request-context.d.ts +29 -0
  436. package/types/server/request-context.d.ts.map +1 -0
  437. package/types/server/schema-check.d.ts +1 -0
  438. package/types/server/schema-check.d.ts.map +1 -1
  439. package/types/server/scope.d.ts +1 -1
  440. package/types/server/scope.d.ts.map +1 -1
  441. package/types/server/socket.d.ts +3 -5
  442. package/types/server/socket.d.ts.map +1 -1
  443. package/types/server/validate.d.ts +26 -0
  444. package/types/server/validate.d.ts.map +1 -0
  445. package/types/test/a11y-dom.d.ts +20 -0
  446. package/types/test/a11y-dom.d.ts.map +1 -0
  447. package/types/test/html-snapshot.d.ts +4 -0
  448. package/types/test/html-snapshot.d.ts.map +1 -0
  449. package/types/test/index.d.ts.map +1 -1
  450. package/types/test/mount.d.ts +3 -0
  451. package/types/test/mount.d.ts.map +1 -1
  452. package/types/test/page-checks.d.ts +6 -0
  453. package/types/test/page-checks.d.ts.map +1 -0
  454. package/types/test/screenshot-match.d.ts +1 -1
  455. package/types/test/screenshot-match.d.ts.map +1 -1
  456. package/types/test/shared-modules.d.ts.map +1 -1
  457. package/types/test/site-types.d.ts +3 -1
  458. package/types/test/site-types.d.ts.map +1 -1
  459. package/src/check/schema-type.ts +0 -9
  460. package/src/compiler/deprecated-script-fence.ts +0 -26
  461. package/src/server/field-errors.ts +0 -136
  462. package/types/check/schema-type.d.ts +0 -3
  463. package/types/check/schema-type.d.ts.map +0 -1
  464. package/types/compiler/deprecated-script-fence.d.ts +0 -3
  465. package/types/compiler/deprecated-script-fence.d.ts.map +0 -1
  466. package/types/server/field-errors.d.ts +0 -6
  467. package/types/server/field-errors.d.ts.map +0 -1
@@ -2,6 +2,7 @@ import type { ClassTable } from '../runtime/class-table'
2
2
  import type { UiEntry } from '../runtime/ui'
3
3
  import type { ConstNode, ElementNode, ErrorMessages, KayFile, Node, SlotNode, Span, TemplateFacts, TemplateHelper } from './ast'
4
4
  import type { IslandCause } from './island-cause'
5
+ import type { LazyImport } from './lazy-imports'
5
6
  import type { LoadPlan } from './load-plan'
6
7
  import type { Rewrite } from './mapping'
7
8
  import type { AwaitAlert, WRITE_HELPERS } from './names'
@@ -15,16 +16,19 @@ import { domHelperImport, DomTemplate } from './dom'
15
16
  import { addIslandShorthandTitle, addShorthandChecks, addShorthandGroup, hasShorthandTitle } from './head-shorthand'
16
17
  import { emitHeadTag, emitHeadText } from './head-tags'
17
18
  import { awaitAlertTail, htmlHelperImport, HtmlTemplate } from './html'
19
+ import { withoutComma } from './import-edits'
18
20
  import { sourceLocator } from './inspect'
19
21
  import { asksOf, exportsIslandOptions, islandMessages, withAlertKeys } from './island-arguments'
20
22
  import { ambientHelpers, constDeclaration } from './items'
21
23
  import { JsxTemplate } from './jsx'
24
+ import { lazyDomImport, lazyEdits, lazyNoteImport } from './lazy-imports'
22
25
  import { planLoads } from './load-plan'
23
26
  import { CodeBuilder, DYNAMIC_TAG } from './mapping'
24
27
  import { helperName } from './markup'
25
28
  import { defaultName, LOAD, LOAD_KEY, LOAD_RUN, LOAD_TABLE, PROPS, VALUES } from './names'
26
29
  import { ownMarkupOf } from './own-markup'
27
30
  import { PAGE, PAGE_SETTINGS } from './page-settings'
31
+ import { restOmits } from './rest-omits'
28
32
  import { reactiveValue } from './script'
29
33
  import { kayCtxImport } from './script-shared'
30
34
  import { slotTypes } from './slot-types'
@@ -103,6 +107,9 @@ export interface GenerateOptions {
103
107
  ui?: UiEntry | undefined
104
108
  // Type checking's counterpart of `ui`: the variants and values `src/ui.ts` adds to the component's props.
105
109
  uiAdded?: UiEntry | undefined
110
+ lazy?: ReadonlyMap<string, LazyImport> | undefined
111
+ // Browser variant builds: the props the project's call sites write, so the rest list omits only those (the others cannot arrive); absent, every declared prop is omitted.
112
+ writtenProps?: ReadonlySet<string> | undefined
106
113
  // Final pass: rewrites from the analysis pass are applied and the props destructuring disappears.
107
114
  rewrites?: ReadonlyMap<number, Rewrite & { end: number }> | undefined
108
115
  // Type checking's final pass: the value of each signal the template reads, declared under `VALUES`.
@@ -116,8 +123,6 @@ export interface Generated {
116
123
 
117
124
  const CTX_REFERENCE = /\bctx\b/
118
125
  const IDENTIFIER = /[\p{ID_Start}$_][\p{ID_Continue}$]*/gu
119
- const IMPORT_COMMA_AFTER = /^\s*,\s*/
120
- const IMPORT_COMMA_BEFORE = /,\s*$/
121
126
  // The specifier of an import that did not parse, quoted and closed or not.
122
127
  const BROKEN_SPECIFIER = /^((?:\s*(?:\/\/.*\n|\/\*(?:[^*]|\*(?!\/))*\*\/))*\s*import\b(?:[^'"]*[^\w$'"]from)?\s*)((['"])[^'";\s]*\3?)/
123
128
  // `kay build` renders the page once when it is `true`.
@@ -293,7 +298,7 @@ class ModuleShell {
293
298
  else if (head && this.kind === 'island')
294
299
  this.emitIslandTitle(head)
295
300
 
296
- this.b.add('\nreturn ')
301
+ this.b.add(`\n${this.mode === 'dom' && this.facts.ambientForm ? `const KayHere = ${helperName('formHere')}()\n` : ''}return `)
297
302
  this.template(template, errors)
298
303
  this.exports()
299
304
 
@@ -329,7 +334,7 @@ class ModuleShell {
329
334
  if (server)
330
335
  b.add(`import type { ${this.pageContextType()} as KayPageContext, PageData as KayPageData${this.guardValues() !== undefined ? ', GuardValues as KayGuardValues' : ''}${this.declaresQuery() !== undefined ? ', QueryOf as KayQueryOf' : ''}${this.settingType(PRERENDER) !== undefined ? ', PrerenderedContext as KayPrerenderedContext' : ''}${mode === 'check' && server.page ? ', PageSettings as KayPageSettings' : ''}${this.actionsTyped ? ', ActionFor as KayActionFor' : ''} } from 'kay'\n`)
331
336
 
332
- const kayHelpers: KayHelper[] = [...facts.actionForm ? ['formAction' as const] : [], ...ambientHelpers(facts)]
337
+ const kayHelpers: KayHelper[] = [...facts.actionForm ? ['formAction' as const] : [], ...ambientHelpers(facts, mode)]
333
338
 
334
339
  if (this.rootBlocks().length > 0)
335
340
  kayHelpers.push('fill')
@@ -379,13 +384,13 @@ class ModuleShell {
379
384
  b.add(this.slotTypes().imports)
380
385
 
381
386
  if (mode === 'html')
382
- b.add(htmlHelperImport(this.options.awaitAlert, facts.await))
387
+ b.add(htmlHelperImport(this.options.awaitAlert, facts.await) + lazyNoteImport(this.options.lazy, mode))
383
388
 
384
389
  if (this.loadPlan)
385
390
  b.add(`import { loadScope as ${helperName('loadScope')} } from 'kay/html'\n`)
386
391
 
387
392
  if (mode === 'dom')
388
- b.add(domHelperImport(this.options.awaitAlert, facts.await))
393
+ b.add(domHelperImport(this.options.awaitAlert, facts.await) + lazyDomImport(this.options.lazy))
389
394
 
390
395
  // Apart from the DOM helpers, which the entry shares with every page, so only a site using it ships its code.
391
396
  if (mode === 'dom' && this.kind === 'island' && titled)
@@ -692,7 +697,7 @@ class ModuleShell {
692
697
  if (left.length > 0 && left.length === imports.filter(inside).length)
693
698
  return
694
699
 
695
- const edits: { start: number, end: number, text?: string }[] = left.map(binding => this.withoutComma(binding.span, binding.declaration))
700
+ const edits: { start: number, end: number, text?: string }[] = [...left.map(binding => withoutComma(this.src, binding.span, binding.declaration)), ...lazyEdits(imports, span, this.options.lazy, this.mode, this.options.moduleId)]
696
701
 
697
702
  for (const specifier of specifiers) {
698
703
  const quoted = this.src.slice(specifier.start, specifier.end)
@@ -727,18 +732,6 @@ class ModuleShell {
727
732
  return start === 0 || this.src[start - 1] === '\n' ? start : offset
728
733
  }
729
734
 
730
- // An import specifier with the comma that separates it from its neighbour.
731
- private withoutComma(specifier: Span, declaration: Span): Span {
732
- const after = IMPORT_COMMA_AFTER.exec(this.src.slice(specifier.end, declaration.end))
733
-
734
- if (after)
735
- return { start: specifier.start, end: specifier.end + after[0].length }
736
-
737
- const before = IMPORT_COMMA_BEFORE.exec(this.src.slice(declaration.start, specifier.start))
738
-
739
- return { start: specifier.start - (before?.[0].length ?? 0), end: specifier.end }
740
- }
741
-
742
735
  // Server exports stay at module level; the rest of the fence becomes `load(ctx)`, returning every name it declares.
743
736
  private emitLoad(server: ServerAnalysis) {
744
737
  const { b } = this
@@ -885,10 +878,7 @@ class ModuleShell {
885
878
  }
886
879
 
887
880
  if (props.rest) {
888
- const owned = this.facts.parts?.merges === true
889
- const keys = [...props.bindings.map(binding => JSON.stringify(binding.key)), ...owned ? ['"class"', '"parts"'] : [], ...owned && this.facts.recipe !== undefined ? [`...${this.facts.recipe}.variants`] : [], ...owned ? Object.keys(this.facts.ui?.variants ?? {}).map(name => JSON.stringify(name)) : []]
890
-
891
- b.add('const ').addSource(props.rest).add(` = ${helperName('omit')}(${PROPS}, ${keys.join(', ')});\n`)
881
+ b.add('const ').addSource(props.rest).add(` = ${helperName('omit')}(${PROPS}, ${restOmits(props, this.options.writtenProps, this.facts).join(', ')});\n`)
892
882
  }
893
883
 
894
884
  // The analysis pass declares the destructured names so scope analysis can find every read of them; the final pass rewrites those reads instead.
@@ -0,0 +1,41 @@
1
+ import type { Lint } from './lints'
2
+
3
+ // The lints of the `deprecated` group for how an island read its sources and actions before 1.105, with the others in `DEPRECATED_LINTS`.
4
+ export const SOURCE_READERS = {
5
+ 'deprecated-source-readers': {
6
+ level: 'warn',
7
+ group: 'deprecated',
8
+ since: '1.105',
9
+ site: true,
10
+ summary: 'The readers and hooks of an island\'s sources before 1.105, which every source reads alike since: `data()` in place of `value()` (a `resource`), `last()` (a `stream` or `socket`) and `rows()` (a `local` collection), `onData` in place of `onSuccess` (a `track()` handle) and `onSync` (a collection), whose event hands `value` where they handed `data` and `rows`, an action\'s `data()` and `status()` in place of `succeeded()`, and a collection\'s `sync.queued()` and `sync.status()` in place of `unsynced()` and `syncStatus()`. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `resource`, `stream`, `socket` or `local` from `kay` or to a `.track()` call, as `kay check` reads no types: a source reached through a property, a prop or another file is not found; `succeeded()` is found on any receiver. The fix renames the member, and the `data` or `rows` of a hook\'s inline handler to `value`; `succeeded()?.data` becomes `data()` and `succeeded() !== undefined` becomes `status() === \'ready\'`. A `succeeded()` read in any other way, a handler that is no inline function and a shorthand hook are reported with no fix.',
11
+ wrong: '---\nimport { local, resource } from \'kay\'\nimport notesApi from \'../api/notes\'\nimport { save } from \'./notes\'\n\nconst list = resource(notesApi, \'/\')\nconst notes = local({ key: \'id\', read: () => [], put: save })\n---\np {list.value()?.length} on the server, {notes.rows().length} here, {notes.unsynced()} waiting',
12
+ right: '---\nimport { local, resource } from \'kay\'\nimport notesApi from \'../api/notes\'\nimport { save } from \'./notes\'\n\nconst list = resource(notesApi, \'/\')\nconst notes = local({ key: \'id\', read: () => [], put: save })\n---\np {list.data()?.length} on the server, {notes.data().length} here, {notes.sync.queued()} waiting',
13
+ },
14
+ 'deprecated-live-api': {
15
+ level: 'warn',
16
+ group: 'deprecated',
17
+ since: '1.105',
18
+ site: true,
19
+ summary: 'The forms of `set` and `presence` before 1.105, which write every live value and every room alike since: `set(next, { key })` of a value per key and `set(next, { user })` of a value per user in place of `set(key, next)` and `set(user, next)`, and `presence({ room, member })` in place of `presence(room, member)`. The old forms work until 1.108. Found in the TypeScript files and `.kay` files of the project, on a name bound once to a `live()` call from `kay`, or imported under the name of a declaration every file of the project agrees on (a value per key is one declared with a function of the key or `key: true`, per user with `user: true`), as `kay check` reads no types: a value reached through a namespace import or a property is not found. `presence` is the one imported from `kay`. The fix reorders the arguments of `set`, and writes the arguments of `presence` as one object, its options object spread into it; a `presence` given options that are no object written there is reported with no fix.',
20
+ wrong: '// src/live.ts\nimport { live } from \'kay\'\n\nexport const room = live((id: string) => ({ id, users: 0 }))\n\nroom.set(\'lobby\', { id: \'lobby\', users: 3 })',
21
+ right: '// src/live.ts\nimport { live } from \'kay\'\n\nexport const room = live((id: string) => ({ id, users: 0 }))\n\nroom.set({ id: \'lobby\', users: 3 }, { key: \'lobby\' })',
22
+ },
23
+ 'deprecated-action-type': {
24
+ level: 'warn',
25
+ group: 'deprecated',
26
+ since: '1.105',
27
+ site: true,
28
+ summary: '`Action<never, unknown>` before 1.105, the type a prop takes to accept any action: `Action` since, whose two parameters default to it. `Action<{ name: string }, string>` keeps its input and output types, and a `.with()` action crosses into an island as any other does. The old form works until 1.108. Found on the `Action` a file imports from `kay`, under any local name, in the TypeScript files and the fences of `.kay` files. The fix drops the type arguments.',
29
+ wrong: '---\nimport type { Action } from \'kay\'\n\nconst { run } = props<{ run: Action<never, unknown> }>()\n---\nform(action={run})\n button Go',
30
+ right: '---\nimport type { Action } from \'kay\'\n\nconst { run } = props<{ run: Action }>()\n---\nform(action={run})\n button Go',
31
+ },
32
+ 'deprecated-action-readers': {
33
+ level: 'warn',
34
+ group: 'deprecated',
35
+ since: '1.105',
36
+ site: true,
37
+ summary: 'An action\'s `failed()`, `error(field)` and `validate(form, field)` before 1.105, which a form shows and now reads from `form`: `form.failed()`, `form.error(field)` and `form.validate(form, field)`, the call state (`pending()`, `status()`, `data()`) staying on the action. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `action` from `kay`, to the `.with()` of one, or imported in lowercase from a `.kay` file, as `kay check` reads no types: an action reached through a property or a prop is not found. The fix writes `form.` before the name.',
38
+ wrong: '---\nimport { add } from \'./notes.kay\'\n---\nform(action={add})\n input(name="title" aria-invalid={add.error(\'title\') ? \'true\' : undefined})\n if add.failed()\n p Not saved',
39
+ right: '---\nimport { add } from \'./notes.kay\'\n---\nform(action={add})\n input(name="title" aria-invalid={add.form.error(\'title\') ? \'true\' : undefined})\n if add.form.failed()\n p Not saved',
40
+ },
41
+ } as const satisfies Record<string, Lint>
@@ -0,0 +1,14 @@
1
+ import type { Lint } from './lints'
2
+
3
+ // The lints of the `deprecated` group that came in 1.106, with the others in `DEPRECATED_LINTS`.
4
+ export const SCHEMA_BUILDERS = {
5
+ 'deprecated-schema-builders': {
6
+ level: 'warn',
7
+ group: 'deprecated',
8
+ since: '1.106',
9
+ site: true,
10
+ summary: 'The PascalCase builders of `s` before 1.106, which kay\'s own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `\'2m\'` is `\'2mb\'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action\'s input, an API route\'s body, `defineEnv`, collection frontmatter), where `s.Object` let it by: write `{ extra: \'strip\' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.',
11
+ wrong: '--- server\nimport { action, s } from \'kay\'\n\nexport const add = action(s.Object({ title: s.String({ maxLength: 200 }), note: s.Optional(s.String()) }), ({ title }) => title)\n---\np x',
12
+ right: '--- server\nimport { action, s } from \'kay\'\n\nexport const add = action({ title: s.string({ max: 200 }), note: s.string({ optional: true }) }, ({ title }) => title)\n---\np x',
13
+ },
14
+ } as const satisfies Record<string, Lint>
@@ -0,0 +1,14 @@
1
+ import type { Lint } from './lints'
2
+
3
+ // The lints of the `deprecated` group that came in 1.107, with the others in `DEPRECATED_LINTS`.
4
+ export const ACTION_OPTIONS = {
5
+ 'deprecated-action-options': {
6
+ level: 'warn',
7
+ group: 'deprecated',
8
+ since: '1.107',
9
+ site: true,
10
+ summary: 'The arguments of `action` before 1.107, `action(schema, handler, options)` and `action(handler, options)`: the options come first, with the input in them, as an API route\'s do, `action({ input: schema, ...options }, handler)` and `action(options, handler)`. `input` is a plain record of fields or any schema. The old forms work until 2.0. Found on the `action` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files; the fix moves the arguments and keeps their text.',
11
+ wrong: '--- server\nimport { action, s } from \'kay\'\n\nexport const add = action({ title: s.string() }, ({ title }) => title, { maxSize: \'1mb\' })\n---\np x',
12
+ right: '--- server\nimport { action, s } from \'kay\'\n\nexport const add = action({ input: { title: s.string() }, maxSize: \'1mb\' }, ({ title }) => title)\n---\np x',
13
+ },
14
+ } as const satisfies Record<string, Lint>
@@ -1,44 +1,15 @@
1
1
  import type { Lint } from './lints'
2
2
  import { AUTH_LINTS } from './deprecated-auth-lints'
3
+ import { SOURCE_READERS } from './deprecated-lints-1-105'
4
+ import { SCHEMA_BUILDERS } from './deprecated-lints-1-106'
5
+ import { ACTION_OPTIONS } from './deprecated-lints-1-107'
6
+ import { TYPED_DEPRECATIONS } from './deprecated-typed-lints'
3
7
 
4
8
  // The lints of the `deprecated` group, with the other lints in `LINTS`; each stays three minors from its `since`.
5
9
  export const DEPRECATED_LINTS = {
6
- 'deprecated-source-readers': {
7
- level: 'warn',
8
- group: 'deprecated',
9
- since: '1.105',
10
- site: true,
11
- summary: 'The readers and hooks of an island\'s sources before 1.105, which every source reads alike since: `data()` in place of `value()` (a `resource`), `last()` (a `stream` or `socket`) and `rows()` (a `local` collection), `onData` in place of `onSuccess` (a `track()` handle) and `onSync` (a collection), whose event hands `value` where they handed `data` and `rows`, an action\'s `data()` and `status()` in place of `succeeded()`, and a collection\'s `sync.queued()` and `sync.status()` in place of `unsynced()` and `syncStatus()`. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `resource`, `stream`, `socket` or `local` from `kay` or to a `.track()` call, as `kay check` reads no types: a source reached through a property, a prop or another file is not found; `succeeded()` is found on any receiver. The fix renames the member, and the `data` or `rows` of a hook\'s inline handler to `value`; `succeeded()?.data` becomes `data()` and `succeeded() !== undefined` becomes `status() === \'ready\'`. A `succeeded()` read in any other way, a handler that is no inline function and a shorthand hook are reported with no fix.',
12
- wrong: '---\nimport { local, resource } from \'kay\'\nimport notesApi from \'../api/notes\'\nimport { save } from \'./notes\'\n\nconst list = resource(notesApi, \'/\')\nconst notes = local({ key: \'id\', read: () => [], put: save })\n---\np {list.value()?.length} on the server, {notes.rows().length} here, {notes.unsynced()} waiting',
13
- right: '---\nimport { local, resource } from \'kay\'\nimport notesApi from \'../api/notes\'\nimport { save } from \'./notes\'\n\nconst list = resource(notesApi, \'/\')\nconst notes = local({ key: \'id\', read: () => [], put: save })\n---\np {list.data()?.length} on the server, {notes.data().length} here, {notes.sync.queued()} waiting',
14
- },
15
- 'deprecated-live-api': {
16
- level: 'warn',
17
- group: 'deprecated',
18
- since: '1.105',
19
- site: true,
20
- summary: 'The forms of `set` and `presence` before 1.105, which write every live value and every room alike since: `set(next, { key })` of a value per key and `set(next, { user })` of a value per user in place of `set(key, next)` and `set(user, next)`, and `presence({ room, member })` in place of `presence(room, member)`. The old forms work until 1.108. Found in the TypeScript files and `.kay` files of the project, on a name bound once to a `live()` call from `kay`, or imported under the name of a declaration every file of the project agrees on (a value per key is one declared with a function of the key or `key: true`, per user with `user: true`), as `kay check` reads no types: a value reached through a namespace import or a property is not found. `presence` is the one imported from `kay`. The fix reorders the arguments of `set`, and writes the arguments of `presence` as one object, its options object spread into it; a `presence` given options that are no object written there is reported with no fix.',
21
- wrong: '// src/live.ts\nimport { live } from \'kay\'\n\nexport const room = live((id: string) => ({ id, users: 0 }))\n\nroom.set(\'lobby\', { id: \'lobby\', users: 3 })',
22
- right: '// src/live.ts\nimport { live } from \'kay\'\n\nexport const room = live((id: string) => ({ id, users: 0 }))\n\nroom.set({ id: \'lobby\', users: 3 }, { key: \'lobby\' })',
23
- },
24
- 'deprecated-action-type': {
25
- level: 'warn',
26
- group: 'deprecated',
27
- since: '1.105',
28
- site: true,
29
- summary: '`Action<never, unknown>` before 1.105, the type a prop takes to accept any action: `Action` since, whose two parameters default to it. `Action<{ name: string }, string>` keeps its input and output types, and a `.with()` action crosses into an island as any other does. The old form works until 1.108. Found on the `Action` a file imports from `kay`, under any local name, in the TypeScript files and the fences of `.kay` files. The fix drops the type arguments.',
30
- wrong: '---\nimport type { Action } from \'kay\'\n\nconst { run } = props<{ run: Action<never, unknown> }>()\n---\nform(action={run})\n button Go',
31
- right: '---\nimport type { Action } from \'kay\'\n\nconst { run } = props<{ run: Action }>()\n---\nform(action={run})\n button Go',
32
- },
33
- 'deprecated-action-readers': {
34
- level: 'warn',
35
- group: 'deprecated',
36
- since: '1.105',
37
- site: true,
38
- summary: 'An action\'s `failed()`, `error(field)` and `validate(form, field)` before 1.105, which a form shows and now reads from `form`: `form.failed()`, `form.error(field)` and `form.validate(form, field)`, the call state (`pending()`, `status()`, `data()`) staying on the action. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `action` from `kay`, to the `.with()` of one, or imported in lowercase from a `.kay` file, as `kay check` reads no types: an action reached through a property or a prop is not found. The fix writes `form.` before the name.',
39
- wrong: '---\nimport { add } from \'./notes.kay\'\n---\nform(action={add})\n input(name="title" aria-invalid={add.error(\'title\') ? \'true\' : undefined})\n if add.failed()\n p Not saved',
40
- right: '---\nimport { add } from \'./notes.kay\'\n---\nform(action={add})\n input(name="title" aria-invalid={add.form.error(\'title\') ? \'true\' : undefined})\n if add.form.failed()\n p Not saved',
41
- },
10
+ ...SCHEMA_BUILDERS,
11
+ ...ACTION_OPTIONS,
12
+ ...SOURCE_READERS,
42
13
  'deprecated-ui-props': {
43
14
  level: 'warn',
44
15
  group: 'deprecated',
@@ -63,29 +34,12 @@ export const DEPRECATED_LINTS = {
63
34
  wrong: '---\nimport Card from \'./card.kay\'\n---\nCard(class={{ head: \'p-6\' }})',
64
35
  right: '---\nimport Card from \'./card.kay\'\n---\nCard(parts={{ head: \'p-6\' }})',
65
36
  },
66
- 'deprecated-script-fence': {
67
- level: 'warn',
68
- group: 'deprecated',
69
- since: '1.102',
70
- summary: '`--- script` as the first fence of a file, `---` since 1.102: the bare line opens the component script wherever no named fence comes before it, so one fence had two spellings. `--- script` stays for a script that follows a `--- server`, `--- module` or `--- style` fence, where a bare `---` would close that fence instead, and `--- client` still replaces `---` rather than modifying it. The old form still works. The fix drops the word, keeping the type parameters of `--- script <T>` as `--- <T>`.',
71
- wrong: '--- script\nconst { title } = props<{ title: string }>()\n---\nh1 {title}',
72
- right: '---\nconst { title } = props<{ title: string }>()\n---\nh1 {title}',
73
- },
74
- 'deprecated-schema-type': {
75
- level: 'warn',
76
- group: 'deprecated',
77
- since: '1.103',
78
- site: true,
79
- summary: '`TSchema` imported from `kay/library`, `Schema` since 1.103: kay\'s own name for what `s` builds and every schema option takes, so a signature of the app does not name TypeBox, whose type follows the Elysia kay is built on. The old name works until 1.106. Found on an import from `kay/library` in the TypeScript files and `.kay` files of the project. The fix renames the import and each use of it; a file that already has a `Schema` of its own is reported with no fix, and one that imports it aliased with only the import renamed.',
80
- wrong: '---\nimport type { TSchema } from \'kay/library\'\n\nexport function check<Fields extends TSchema>(fields: Fields) {\n return fields\n}\n---\np x',
81
- right: '---\nimport type { Schema } from \'kay/library\'\n\nexport function check<Fields extends Schema>(fields: Fields) {\n return fields\n}\n---\np x',
82
- },
83
37
  'deprecated-package-names': {
84
38
  level: 'warn',
85
39
  group: 'deprecated',
86
40
  since: '1.104',
87
41
  site: true,
88
- summary: 'A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found in the imports, config keys and stylesheet imports of the project\'s TypeScript, `.kay` and CSS files, and in its package.json and tsconfig files, never in a comment or a sentence of a string that names a package. The fix writes the new name; a package.json that lists the new name already is reported with a fix that is not safe, and `kay upgrade` does the whole move, package.json and install included.',
42
+ summary: 'A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found where a name is an `import` or `export ... from` specifier, a `require()`, `import()` or `mock.module()` argument or a config key (a quoted name keyed to anything but a package name or a version, as `librarySettings`) of the project\'s TypeScript and `.kay` files, in the `@import` and `@plugin` paths of its CSS, and in its package.json and tsconfig files; a name in a comment or any other string, as data a tool reads or a table of renames, is left alone. The fix writes the new name; a package.json that lists the new name already is reported with a fix that is not safe, and `kay upgrade` does the whole move, package.json and install included.',
89
43
  wrong: '---\nimport Button from \'@kaynooo/kayjs-ui/button.kay\'\n---\nButton Save',
90
44
  right: '---\nimport Button from \'@kayjs/ui/button.kay\'\n---\nButton Save',
91
45
  },
@@ -126,7 +80,7 @@ export const DEPRECATED_LINTS = {
126
80
  level: 'warn',
127
81
  group: 'deprecated',
128
82
  since: '1.105',
129
- summary: '`data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, named as the options of `navigate()` since 1.105: `data-scroll="keep"` (`"top"` for a plain scroll), `data-transition="false"` and `data-prefetch="false"`, typed on every element. The old names work until 1.108. Found on any element and on a component call that forwards them to its link. The fix writes the new attribute, a static `data-keep-scroll="false"` becoming `data-scroll="top"` and a dynamic `data-keep-scroll` being renamed with its value; a dynamic `data-no-transition` or `data-no-prefetch` is reported with no fix, as the old name was set by being present.',
83
+ summary: '`data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, named as the options of `navigate()` since 1.105: `data-scroll="keep"` (`"top"` for a plain scroll), `data-transition="false"` and `data-prefetch="false"`, typed on every element. The old names work until 1.108. Found on any element and on a component call that forwards them to its link. The fix writes the new attribute, a static `data-keep-scroll="false"` becoming `data-scroll="top"` and a dynamic `data-keep-scroll` being renamed with its value; a dynamic `data-no-transition` or `data-no-prefetch` is reported with no fix, as the old name was set by being present. The app\'s test files (`*.test.*`, `*.spec.*`) are checked too: a selector `[data-keep-scroll]` is written `[data-scroll=keep]` by the fix, an attribute read by name (`getAttribute(\'data-keep-scroll\')`) has a fix that is not safe, a read of `dataset.keepScroll` (and `noTransition`, `noPrefetch`) has one too, and a write of it and any other string naming an old flag have none.',
130
84
  wrong: 'nav(data-keep-scroll)\n a(href="/tabs/a" data-no-prefetch) A',
131
85
  right: 'nav(data-scroll="keep")\n a(href="/tabs/a" data-prefetch="false") A',
132
86
  },
@@ -181,6 +135,7 @@ export const DEPRECATED_LINTS = {
181
135
  right: '---\nimport SignedIn from \'@kayjs/auth/components/signed-in.kay\'\n---\nSignedIn(require="admin")\n a(href="/admin") Admin',
182
136
  },
183
137
  ...AUTH_LINTS,
138
+ ...TYPED_DEPRECATIONS,
184
139
  'deprecated-ui-callbacks': {
185
140
  level: 'warn',
186
141
  group: 'deprecated',
@@ -405,7 +360,7 @@ export const DEPRECATED_LINTS = {
405
360
  group: 'deprecated',
406
361
  since: '1.105',
407
362
  site: true,
408
- summary: 'The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix moves the keys into their group as written, unless the object spreads, holds a computed key or has the group already.',
363
+ summary: 'The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports, in the `config` of `pages()` and `testSite()` and in the `config` of an extension a file types `KayExtension`, which takes the same keys. The fix moves the keys into their group as written, unless the object spreads, holds a computed key or has the group already.',
409
364
  wrong: '// kay.config.ts\nexport default { images: { widths: [640] }, health: false }',
410
365
  right: '// kay.config.ts\nexport default { assets: { images: { widths: [640] } }, ops: { health: false } }',
411
366
  },
@@ -432,7 +387,7 @@ export const DEPRECATED_LINTS = {
432
387
  group: 'deprecated',
433
388
  since: '1.105',
434
389
  site: true,
435
- summary: 'The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: \'x-upstream-key\' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` are reported with no fix.',
390
+ summary: 'The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: \'x-upstream-key\' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` move into its `config`, `mcpKey` always and `proxyKey` where the app\'s config names the header, and are reported with no fix beside a `config` already written.',
436
391
  wrong: '// kay.config.ts\nexport default { mcp: { key: true }, proxy: { key: \'x-upstream-key\' } }',
437
392
  right: '// kay.config.ts\nexport default { mcp: { token: true }, proxy: { key: { header: \'x-upstream-key\' } } }',
438
393
  },
@@ -504,7 +459,7 @@ export const DEPRECATED_LINTS = {
504
459
  group: 'deprecated',
505
460
  since: '1.105',
506
461
  site: true,
507
- summary: '`deny(status, \'message\', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { data, errors })` as `ctx.fail`: the page again, or an `ActionError`. The text form works until 1.108. Found on a call of `deny`, bare or read off a name, with a literal status from 400 to 599 and a text second argument, in the TypeScript files and `.kay` files of the project. The fix writes the object, unless a comment sits between the arguments or a `data` is given, which an action answers as a failure, not plain text.',
462
+ summary: '`deny(status, \'message\', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { message, data, errors })` as `ctx.fail` did, the page again or an `ActionError`, so its text form, which stopped with plain text, becomes the form\'s message after the fix. The text form works until 1.108. Found on a call of `deny`, bare or read off a name, with a literal status from 400 to 599 and a text second argument, in the TypeScript files and `.kay` files of the project. The fix writes the object, unless a comment sits between the arguments or a `data` is given, which an action answers as a failure, not plain text.',
508
463
  wrong: '// src/routes/_guard.ts\nimport { guard } from \'kay\'\n\nexport default guard(({ deny }) => {\n deny(403, \'Members only\')\n})',
509
464
  right: '// src/routes/_guard.ts\nimport { guard } from \'kay\'\n\nexport default guard(({ deny }) => {\n deny(403, { message: \'Members only\' })\n})',
510
465
  },
@@ -591,8 +546,10 @@ export const DEPRECATION_MINORS: readonly { since: string, removedIn?: string }[
591
546
  { since: '1.99', removedIn: '1.103' },
592
547
  { since: '1.100', removedIn: '1.104' },
593
548
  { since: '1.101', removedIn: '1.105' },
594
- { since: '1.102' },
595
- { since: '1.103' },
549
+ { since: '1.102', removedIn: '1.107' },
550
+ { since: '1.103', removedIn: '1.107' },
596
551
  { since: '1.104' },
597
552
  { since: '1.105' },
553
+ { since: '1.106' },
554
+ { since: '1.107' },
598
555
  ]
@@ -0,0 +1,23 @@
1
+ import type { Lint } from './lints'
2
+
3
+ // The deprecated lints the type check finds, apart from the others: an old form the types of 1.105 refuse, which `kay check` names with the fix instead of leaving its type error.
4
+ export const TYPED_DEPRECATIONS = {
5
+ 'deprecated-callback-handler': {
6
+ level: 'deny',
7
+ group: 'deprecated',
8
+ since: '1.105',
9
+ typed: true,
10
+ summary: 'A function written for the arguments a kayjs-ui, kayjs-ai or kayjs-cms callback took before 1.105, given to a callback that takes one event object since: `onValueChange={query.set}`, `onCheckedChange={toggle}` with `toggle(on: boolean)` or `onFiles={upload}` with `upload(files: File[])`. Found where the type check refuses the function and the component comes from a `@kayjs` library; the fix writes `event => query.set(event.value)`, passing the fields the handler took, first ones first, and is applied where its parameter is no object (a parameter typed as an object may be written for the event already, so that fix is offered). A handler that is not a plain name, such as an arrow function, is reported with no fix. The old form fails the type check, and would receive the event where it took the value, so the level is `deny` until it is rewritten.',
11
+ wrong: '---\nimport { signal } from \'kay\'\nimport Checkbox from \'@kayjs/ui/checkbox.kay\'\n\nconst on = signal(false)\n\nfunction toggle(next: boolean) {\n on.set(next)\n}\n---\nCheckbox(label="Notify" checked={on()} onChange={toggle})',
12
+ right: '---\nimport { signal } from \'kay\'\nimport Checkbox from \'@kayjs/ui/checkbox.kay\'\n\nconst on = signal(false)\n\nfunction toggle(next: boolean) {\n on.set(next)\n}\n---\nCheckbox(label="Notify" checked={on()} onChange={event => toggle(event.checked)})',
13
+ },
14
+ 'deprecated-call-result': {
15
+ level: 'deny',
16
+ group: 'deprecated',
17
+ since: '1.105',
18
+ typed: true,
19
+ summary: 'An island\'s call read as its data, `const list = await call(notes, \'/\')` then `list.items`, or `await add(input)` then `.id`, which resolved with the data before 1.105 and answers a `CallResult`, `{ ok: true, data }` or `{ ok: false, error }`, since. Found where the type check refuses a field of a `CallResult`, in a `.kay` script or a module. The fix writes `.orThrow()` after the call, which resolves with the data and throws a refusal as the call did; it is applied where the call is written on an imported name and nothing reads `ok`, `data` or `error` of the answer, and offered otherwise. The old form fails the type check, so the level is `deny`.',
20
+ wrong: '---\nimport { call, signal } from \'kay\'\nimport notes from \'../api/notes\'\n\nconst names = signal(\'\')\n\nasync function load() {\n const list = await call(notes, \'/\')\n\n names = list.items.join(\', \')\n}\n---\nbutton(onClick={load}) Load\np {names()}',
21
+ right: '---\nimport { call, signal } from \'kay\'\nimport notes from \'../api/notes\'\n\nconst names = signal(\'\')\n\nasync function load() {\n const list = await call(notes, \'/\').orThrow()\n\n names = list.items.join(\', \')\n}\n---\nbutton(onClick={load}) Load\np {names()}',
22
+ },
23
+ } as const satisfies Record<string, Lint>
@@ -0,0 +1,72 @@
1
+ import type { Node, SnippetNode, Span } from './ast'
2
+ import type { CodeBuilder } from './mapping'
3
+ import { someNode } from './ast'
4
+ import { helperName } from './markup'
5
+
6
+ const CALLED = /[a-z_$][\w$]*(?=\s*\()/gi
7
+
8
+ // The form each function of a template was called in, for the `error` and `pending` lines outside every form of their file: the template's own function and each block of content holding such a line (a snippet, the children a component is given) capture it once as it is called, as a line may be created again long after the render that knew the form.
9
+ export class FormHere {
10
+ private readonly names = ['KayHere']
11
+ private readonly snippets = new Set<string>()
12
+ private count = 0
13
+
14
+ // The name holding the form of the function being written.
15
+ get current(): string {
16
+ return this.names.at(-1)!
17
+ }
18
+
19
+ // Names a snippet, so a call of it inside a form is built in the form's scope.
20
+ declared(snippet: SnippetNode, src: string): SnippetNode {
21
+ this.snippets.add(src.slice(snippet.name.start, snippet.name.end))
22
+
23
+ return snippet
24
+ }
25
+
26
+ // The action a line follows: the form around it in the file, else the one its function was called in.
27
+ target(b: CodeBuilder, form: Span | undefined): void {
28
+ if (form)
29
+ b.add('(').addSource(form).add(')')
30
+ else
31
+ b.add(this.current)
32
+ }
33
+
34
+ // Opens the scope a component's script runs in, the action of the form around it in the file; false when it has none.
35
+ scope(b: CodeBuilder, form: Span | undefined): boolean {
36
+ if (!form)
37
+ return false
38
+
39
+ b.add(`${helperName('issueScope')}(`)
40
+ this.target(b, form)
41
+ b.add(', () => ')
42
+
43
+ return true
44
+ }
45
+
46
+ // An expression inserted: one calling a snippet in a form is built inside the form's scope, as the component called there is, for its `error` and `pending` lines to follow it.
47
+ expression(b: CodeBuilder, expression: Span, src: string, form: Span | undefined): void {
48
+ const scoped = form !== undefined && src.slice(expression.start, expression.end).match(CALLED)?.some(name => this.snippets.has(name)) === true
49
+
50
+ if (scoped)
51
+ this.scope(b, form)
52
+
53
+ b.add('(').addSource(expression).add(scoped ? '))' : ')')
54
+ }
55
+
56
+ // Writes a block of content, taking the form it is called in when it holds a line following one, falling back to the one of the function around it for a call made after the render.
57
+ within(b: CodeBuilder, nodes: Node[], forms: ReadonlyMap<Node, Span>, children: () => void): void {
58
+ if (!someNode(nodes, line => (line.kind === 'error' || line.kind === 'pending') && !forms.has(line))) {
59
+ children()
60
+
61
+ return
62
+ }
63
+
64
+ const own = `KayHere${++this.count}`
65
+
66
+ b.add(`(() => { const ${own} = ${helperName('formHere')}() ?? ${this.current}; return `)
67
+ this.names.push(own)
68
+ children()
69
+ this.names.pop()
70
+ b.add('; })()')
71
+ }
72
+ }
@@ -6,6 +6,7 @@ import type { BindingPlan, LinkPlan } from './plan'
6
6
  import { mayLeaveSite } from '../runtime/outside'
7
7
  import { marksServerIsland, modifiersOf } from './ast'
8
8
  import { fieldBindings } from './dom-fields'
9
+ import { FormHere } from './dom-here'
9
10
  import { addHandler, listenerOptions } from './event-modifiers'
10
11
  import { decodeEntities, isFunctionAt } from './expression'
11
12
  import { addKeyParameters, addRowItem, childItems, constDeclaration, contentOf, errorParagraphArguments, isDeclaration, rowKeying, slotValue, soleDynamic } from './items'
@@ -44,6 +45,7 @@ export class DomTemplate extends TemplateWriter {
44
45
  private readonly catches: string[] = []
45
46
  // Whether the code may write a link's `href`, which an app with locales localizes through `kay/i18n-links`: only a module doing so imports it.
46
47
  private writesLinks = false
48
+ private readonly here = new FormHere()
47
49
 
48
50
  // `errors`: what a refused form's fields are described by.
49
51
  // `located`, in development: the source position each element carries for `kay dev`'s inspector.
@@ -120,7 +122,9 @@ export class DomTemplate extends TemplateWriter {
120
122
 
121
123
  switch (item.kind) {
122
124
  case 'expression':
123
- b.add(`KayInsert(${at}, () => (`).addSource(item.node.expression).add('));')
125
+ b.add(`KayInsert(${at}, () => `)
126
+ this.here.expression(b, item.node.expression, this.src, this.formOf(item.line))
127
+ b.add(');')
124
128
 
125
129
  break
126
130
  case 'component':
@@ -187,27 +191,25 @@ export class DomTemplate extends TemplateWriter {
187
191
 
188
192
  break
189
193
  case 'error':
190
- if (this.formOf(item.node)) {
191
- const target = this.formOf(item.node)!
194
+ // With no form around it in the file, the message is read again when the action answers, outside any render, from the form the function was called in.
195
+ b.wrap(item.node, () => {
196
+ const target = this.formOf(item.node)
192
197
 
193
- b.wrap(item.node, () => {
194
- b.add(`KayInsert(${at}, () => ${helperName('errorParagraph')}(KayFormError((`).addSource(target).add(`), ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, this.errors?.lines.get(item.node))}));`)
195
- })
196
- }
197
- else {
198
- // The form it renders in, taken now: the message is read again when the action answers, outside any render.
199
- b.add(`{ const KayHere = ${helperName('formHere')}(); KayInsert(${at}, () => ${helperName('errorParagraph')}(${helperName('formError')}(KayHere, ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, undefined)})); }`)
200
- }
198
+ b.add(`KayInsert(${at}, () => ${helperName('errorParagraph')}(${helperName('formError')}(`)
199
+
200
+ this.here.target(b, target)
201
+ b.add(`, ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, target ? this.errors?.lines.get(item.node) : undefined)}));`)
202
+ })
201
203
 
202
204
  break
203
205
  }
204
206
  }
205
207
 
206
208
  private declaration(item: Declaration): void {
207
- if (item.kind === 'snippet')
208
- this.snippetDeclaration(item.node)
209
- else
209
+ if (item.kind === 'const')
210
210
  this.b.wrap(item.node, () => constDeclaration(this.b, item.node, this.src, helperName('memo')))
211
+ else
212
+ this.snippetDeclaration(this.here.declared(item.node, this.src))
211
213
  }
212
214
 
213
215
  private if(node: IfNode, at: string): void {
@@ -432,15 +434,14 @@ export class DomTemplate extends TemplateWriter {
432
434
  return property === 'innerHTML' && !raw && checksMarkup(this.src, expression, this.ownMarkup) ? helperName('checkedMarkup') : ''
433
435
  }
434
436
 
435
- // An island's `pending` block shows while a call of its form's action is in flight, however the handler made it; with no form around it in the file, the action of the form it renders in, taken now.
437
+ // An island's `pending` block shows while a call of its form's action is in flight, however the handler made it; with no form around it in the file, the action of the form the function was called in.
436
438
  private followCalls(pending: PendingNode, node: TemplateNode): Binding {
437
439
  const followed = this.formOf(pending)
438
440
 
439
441
  return (variable) => {
440
- if (followed)
441
- this.b.add(`KayEffect(() => ${helperName('pendingCall')}(${variable(node)}, (`).addSource(followed).add(')));')
442
- else
443
- this.b.add(`{ const KayHere = ${helperName('formHere')}(); KayEffect(() => ${helperName('pendingCall')}(${variable(node)}, KayHere)); }`)
442
+ this.b.add(`KayEffect(() => ${helperName('pendingCall')}(${variable(node)}, `)
443
+ this.here.target(this.b, followed)
444
+ this.b.add('));')
444
445
  }
445
446
  }
446
447
 
@@ -767,20 +768,19 @@ export class DomTemplate extends TemplateWriter {
767
768
  b.add(`(${helperName('holdSubmits')}(), `)
768
769
 
769
770
  // The component's script runs inside the form's scope, so the fields it draws show the form's action's messages with no prop.
770
- if (form)
771
- b.add(`${helperName(this.scoping)}((`).addSource(form).add('), () => ')
771
+ const scoped = this.here.scope(b, form)
772
772
 
773
773
  b.add(dynamic ? 'KayDynamic(' : 'KayComponent(').addSource(element.tag).add(', ')
774
774
 
775
775
  this.componentProps(element, true)
776
776
  b.add(holds ? '))' : ')')
777
777
 
778
- if (form)
778
+ if (scoped)
779
779
  b.add(')')
780
780
  }
781
781
 
782
782
  protected rendered(nodes: Node[]): void {
783
- this.block(nodes)
783
+ this.here.within(this.b, nodes, this.facts.forms, () => this.block(nodes))
784
784
  }
785
785
 
786
786
  // Inside an island a server island is a component as any other.