create-foldkit-app 0.39.1 → 0.40.0-canary.1f6776fa7ece

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 (683) hide show
  1. package/README.md +3 -3
  2. package/dist/examples.js +4 -4
  3. package/dist/templates/base/.oxlintrc.effect.json +26 -0
  4. package/dist/templates/base/AGENTS.md +4 -0
  5. package/dist/templates/base/FOLDKIT.md +119 -31
  6. package/dist/templates/base/package.json +1 -1
  7. package/dist/templates/examples/api-cache/package.json +2 -2
  8. package/dist/templates/examples/api-cache/src/block.ts +22 -0
  9. package/dist/templates/examples/api-cache/src/command.ts +69 -0
  10. package/dist/templates/examples/api-cache/src/composition.ts +77 -0
  11. package/dist/templates/examples/api-cache/src/data.ts +1 -4
  12. package/dist/templates/examples/api-cache/src/definition.ts +9 -0
  13. package/dist/templates/examples/api-cache/src/entry.ts +6 -12
  14. package/dist/templates/examples/api-cache/src/init.ts +16 -0
  15. package/dist/templates/examples/api-cache/src/layer.ts +11 -0
  16. package/dist/templates/examples/api-cache/src/message.ts +23 -0
  17. package/dist/templates/examples/api-cache/src/model.fixture.ts +84 -0
  18. package/dist/templates/examples/api-cache/src/model.ts +40 -0
  19. package/dist/templates/examples/api-cache/src/scene.test.ts +11 -7
  20. package/dist/templates/examples/api-cache/src/story.test.ts +36 -24
  21. package/dist/templates/examples/api-cache/src/subscription.ts +33 -0
  22. package/dist/templates/examples/api-cache/src/update.ts +77 -0
  23. package/dist/templates/examples/api-cache/src/view/posts.ts +254 -0
  24. package/dist/templates/examples/api-cache/src/view/shared.ts +63 -0
  25. package/dist/templates/examples/api-cache/src/view/stats.ts +140 -0
  26. package/dist/templates/examples/api-cache/src/view/view.ts +73 -0
  27. package/dist/templates/examples/api-cache-query/package.json +2 -2
  28. package/dist/templates/examples/api-cache-query/src/block.ts +21 -0
  29. package/dist/templates/examples/api-cache-query/src/composition.ts +50 -0
  30. package/dist/templates/examples/api-cache-query/src/data.ts +1 -4
  31. package/dist/templates/examples/api-cache-query/src/definition.ts +9 -0
  32. package/dist/templates/examples/api-cache-query/src/entry.ts +6 -13
  33. package/dist/templates/examples/api-cache-query/src/init.ts +11 -0
  34. package/dist/templates/examples/api-cache-query/src/message.ts +13 -0
  35. package/dist/templates/examples/api-cache-query/src/{main.fixture.ts → model.fixture.ts} +20 -16
  36. package/dist/templates/examples/api-cache-query/src/model.ts +20 -0
  37. package/dist/templates/examples/api-cache-query/src/query.ts +75 -0
  38. package/dist/templates/examples/api-cache-query/src/scene.test.ts +10 -4
  39. package/dist/templates/examples/api-cache-query/src/story.test.ts +29 -10
  40. package/dist/templates/examples/api-cache-query/src/subscription.ts +35 -0
  41. package/dist/templates/examples/api-cache-query/src/update.ts +35 -0
  42. package/dist/templates/examples/api-cache-query/src/view/index.ts +1 -0
  43. package/dist/templates/examples/api-cache-query/src/view/posts.ts +239 -0
  44. package/dist/templates/examples/api-cache-query/src/view/shared.ts +70 -0
  45. package/dist/templates/examples/api-cache-query/src/view/stats.ts +132 -0
  46. package/dist/templates/examples/api-cache-query/src/view/view.ts +99 -0
  47. package/dist/templates/examples/auth/package.json +2 -2
  48. package/dist/templates/examples/auth/src/block.ts +20 -0
  49. package/dist/templates/examples/auth/src/command.ts +107 -31
  50. package/dist/templates/examples/auth/src/composition/composition.ts +7 -0
  51. package/dist/templates/examples/auth/src/composition/index.ts +3 -0
  52. package/dist/templates/examples/auth/src/composition/loggedIn.ts +31 -0
  53. package/dist/templates/examples/auth/src/composition/loggedOut.ts +31 -0
  54. package/dist/templates/examples/auth/src/definition.ts +9 -0
  55. package/dist/templates/examples/auth/src/domain/session.ts +0 -2
  56. package/dist/templates/examples/auth/src/entry.ts +10 -17
  57. package/dist/templates/examples/auth/src/flags.ts +26 -0
  58. package/dist/templates/examples/auth/src/init.ts +53 -0
  59. package/dist/templates/examples/auth/src/message.ts +3 -6
  60. package/dist/templates/examples/auth/src/model.ts +6 -6
  61. package/dist/templates/examples/auth/src/page/index.ts +2 -2
  62. package/dist/templates/examples/auth/src/page/loggedIn/block.ts +18 -0
  63. package/dist/templates/examples/auth/src/page/loggedIn/composition.ts +13 -0
  64. package/dist/templates/examples/auth/src/page/loggedIn/index.ts +1 -4
  65. package/dist/templates/examples/auth/src/page/loggedIn/init.ts +10 -0
  66. package/dist/templates/examples/auth/src/page/loggedIn/message.ts +0 -8
  67. package/dist/templates/examples/auth/src/page/loggedIn/model.ts +0 -12
  68. package/dist/templates/examples/auth/src/page/loggedIn/page/dashboard.ts +7 -8
  69. package/dist/templates/examples/auth/src/page/loggedIn/page/settings.ts +7 -5
  70. package/dist/templates/examples/auth/src/page/loggedIn/update.ts +9 -13
  71. package/dist/templates/examples/auth/src/page/loggedIn/view.ts +5 -7
  72. package/dist/templates/examples/auth/src/page/loggedOut/block.ts +18 -0
  73. package/dist/templates/examples/auth/src/page/loggedOut/composition.ts +21 -0
  74. package/dist/templates/examples/auth/src/page/loggedOut/definition.ts +10 -0
  75. package/dist/templates/examples/auth/src/page/loggedOut/index.ts +1 -4
  76. package/dist/templates/examples/auth/src/page/loggedOut/init.ts +8 -0
  77. package/dist/templates/examples/auth/src/page/loggedOut/message.ts +1 -13
  78. package/dist/templates/examples/auth/src/page/loggedOut/model.ts +1 -13
  79. package/dist/templates/examples/auth/src/page/loggedOut/page/home.ts +5 -5
  80. package/dist/templates/examples/auth/src/page/loggedOut/page/login/block.ts +18 -0
  81. package/dist/templates/examples/auth/src/page/loggedOut/page/login/composition.ts +6 -0
  82. package/dist/templates/examples/auth/src/page/loggedOut/page/login/definition.ts +30 -0
  83. package/dist/templates/examples/auth/src/page/loggedOut/page/login/index.ts +1 -0
  84. package/dist/templates/examples/auth/src/page/loggedOut/page/login/login.ts +124 -0
  85. package/dist/templates/examples/auth/src/page/loggedOut/page/{login.scene.test.ts → login/scene.test.ts} +3 -1
  86. package/dist/templates/examples/auth/src/page/loggedOut/page/{login.story.test.ts → login/story.test.ts} +2 -7
  87. package/dist/templates/examples/auth/src/page/loggedOut/page/{login.ts → login/view.ts} +11 -158
  88. package/dist/templates/examples/auth/src/page/loggedOut/update.ts +2 -25
  89. package/dist/templates/examples/auth/src/page/loggedOut/view.ts +8 -11
  90. package/dist/templates/examples/auth/src/route.ts +16 -14
  91. package/dist/templates/examples/auth/src/scene.test.ts +12 -10
  92. package/dist/templates/examples/auth/src/services.ts +3 -0
  93. package/dist/templates/examples/auth/src/update.ts +20 -109
  94. package/dist/templates/examples/auth/src/view.ts +21 -20
  95. package/dist/templates/examples/canvas-art/package.json +2 -2
  96. package/dist/templates/examples/canvas-art/src/{main.ts → application.ts} +98 -57
  97. package/dist/templates/examples/canvas-art/src/entry.ts +6 -12
  98. package/dist/templates/examples/canvas-art/src/scene.test.ts +4 -4
  99. package/dist/templates/examples/canvas-art/src/story.test.ts +4 -4
  100. package/dist/templates/examples/charting/package.json +2 -2
  101. package/dist/templates/examples/charting/src/block.ts +20 -0
  102. package/dist/templates/examples/charting/src/chartRegistry.ts +42 -0
  103. package/dist/templates/examples/charting/src/command.ts +56 -40
  104. package/dist/templates/examples/charting/src/composition.ts +122 -0
  105. package/dist/templates/examples/charting/src/definition.ts +9 -0
  106. package/dist/templates/examples/charting/src/domain.ts +21 -29
  107. package/dist/templates/examples/charting/src/echarts.ts +11 -11
  108. package/dist/templates/examples/charting/src/entry.ts +7 -15
  109. package/dist/templates/examples/charting/src/githubApi.ts +54 -31
  110. package/dist/templates/examples/charting/src/init.ts +4 -15
  111. package/dist/templates/examples/charting/src/layer.ts +10 -0
  112. package/dist/templates/examples/charting/src/message.ts +0 -8
  113. package/dist/templates/examples/charting/src/{main.fixture.ts → model.fixture.ts} +16 -43
  114. package/dist/templates/examples/charting/src/model.ts +8 -6
  115. package/dist/templates/examples/charting/src/mount.ts +130 -0
  116. package/dist/templates/examples/charting/src/npmApi.ts +3 -4
  117. package/dist/templates/examples/charting/src/radioGroups.ts +4 -3
  118. package/dist/templates/examples/charting/src/scene.test.ts +5 -4
  119. package/dist/templates/examples/charting/src/services.ts +15 -0
  120. package/dist/templates/examples/charting/src/story.test.ts +31 -11
  121. package/dist/templates/examples/charting/src/telemetry.ts +105 -82
  122. package/dist/templates/examples/charting/src/update.ts +12 -132
  123. package/dist/templates/examples/charting/src/view/chart.ts +17 -127
  124. package/dist/templates/examples/charting/src/view/layout.ts +15 -12
  125. package/dist/templates/examples/charting/src/view/sidebar.ts +120 -121
  126. package/dist/templates/examples/charting/src/view/view.ts +3 -7
  127. package/dist/templates/examples/charting/src/weeks.ts +15 -36
  128. package/dist/templates/examples/counter/package.json +2 -2
  129. package/dist/templates/examples/counter/src/{main.ts → application.ts} +35 -29
  130. package/dist/templates/examples/counter/src/entry.ts +6 -11
  131. package/dist/templates/examples/counter/src/scene.test.ts +2 -2
  132. package/dist/templates/examples/counter/src/story.test.ts +2 -2
  133. package/dist/templates/examples/counters/package.json +2 -2
  134. package/dist/templates/examples/counters/src/application.ts +173 -0
  135. package/dist/templates/examples/counters/src/counter.ts +28 -19
  136. package/dist/templates/examples/counters/src/entry.ts +6 -11
  137. package/dist/templates/examples/counters/src/scene.test.ts +13 -13
  138. package/dist/templates/examples/counters/src/story.test.ts +108 -53
  139. package/dist/templates/examples/crash-view/package.json +2 -2
  140. package/dist/templates/examples/crash-view/src/{main.ts → application.ts} +23 -23
  141. package/dist/templates/examples/crash-view/src/entry.ts +7 -13
  142. package/dist/templates/examples/crash-view/src/scene.test.ts +1 -1
  143. package/dist/templates/examples/crash-view/src/story.test.ts +1 -1
  144. package/dist/templates/examples/embedding/package.json +2 -2
  145. package/dist/templates/examples/embedding/src/{main.ts → application.ts} +59 -54
  146. package/dist/templates/examples/embedding/src/host.ts +12 -4
  147. package/dist/templates/examples/embedding/src/scene.test.ts +2 -2
  148. package/dist/templates/examples/embedding/src/story.test.ts +2 -2
  149. package/dist/templates/examples/form/package.json +2 -2
  150. package/dist/templates/examples/form/src/block.ts +20 -0
  151. package/dist/templates/examples/form/src/command.ts +71 -0
  152. package/dist/templates/examples/form/src/composition.ts +8 -0
  153. package/dist/templates/examples/form/src/definition.ts +9 -0
  154. package/dist/templates/examples/form/src/entry.ts +6 -11
  155. package/dist/templates/examples/form/src/init.ts +15 -0
  156. package/dist/templates/examples/form/src/message.ts +13 -0
  157. package/dist/templates/examples/form/src/model.ts +17 -0
  158. package/dist/templates/examples/form/src/scene.test.ts +5 -8
  159. package/dist/templates/examples/form/src/story.test.ts +8 -11
  160. package/dist/templates/examples/form/src/update.ts +78 -0
  161. package/dist/templates/examples/form/src/validation.ts +21 -0
  162. package/dist/templates/examples/form/src/{main.ts → view.ts} +23 -239
  163. package/dist/templates/examples/generative-art/package.json +2 -2
  164. package/dist/templates/examples/generative-art/src/block.ts +22 -0
  165. package/dist/templates/examples/generative-art/src/command.ts +92 -84
  166. package/dist/templates/examples/generative-art/src/composition.ts +65 -0
  167. package/dist/templates/examples/generative-art/src/definition.ts +9 -0
  168. package/dist/templates/examples/generative-art/src/entry.ts +6 -10
  169. package/dist/templates/examples/generative-art/src/init.ts +42 -0
  170. package/dist/templates/examples/generative-art/src/layer.ts +10 -0
  171. package/dist/templates/examples/generative-art/src/message.ts +0 -6
  172. package/dist/templates/examples/generative-art/src/model.ts +3 -6
  173. package/dist/templates/examples/generative-art/src/scene.test.ts +12 -8
  174. package/dist/templates/examples/generative-art/src/story.test.ts +11 -7
  175. package/dist/templates/examples/generative-art/src/subscription.ts +21 -32
  176. package/dist/templates/examples/generative-art/src/update.ts +19 -68
  177. package/dist/templates/examples/generative-art/src/view.ts +80 -62
  178. package/dist/templates/examples/interrupting-commands/package.json +2 -2
  179. package/dist/templates/examples/interrupting-commands/src/block.ts +20 -0
  180. package/dist/templates/examples/interrupting-commands/src/command.ts +33 -0
  181. package/dist/templates/examples/interrupting-commands/src/composition.ts +8 -0
  182. package/dist/templates/examples/interrupting-commands/src/definition.ts +9 -0
  183. package/dist/templates/examples/interrupting-commands/src/entry.ts +6 -11
  184. package/dist/templates/examples/interrupting-commands/src/init.ts +8 -0
  185. package/dist/templates/examples/interrupting-commands/src/message.ts +15 -0
  186. package/dist/templates/examples/interrupting-commands/src/model.ts +15 -0
  187. package/dist/templates/examples/interrupting-commands/src/scene.test.ts +7 -11
  188. package/dist/templates/examples/interrupting-commands/src/story.test.ts +10 -14
  189. package/dist/templates/examples/interrupting-commands/src/update.ts +103 -0
  190. package/dist/templates/examples/interrupting-commands/src/view.ts +175 -0
  191. package/dist/templates/examples/job-application/package.json +2 -2
  192. package/dist/templates/examples/job-application/src/block.ts +20 -0
  193. package/dist/templates/examples/job-application/src/command.ts +18 -12
  194. package/dist/templates/examples/job-application/src/composition.ts +114 -0
  195. package/dist/templates/examples/job-application/src/definition.ts +11 -0
  196. package/dist/templates/examples/job-application/src/domain/proficiencyLevel.ts +2 -2
  197. package/dist/templates/examples/job-application/src/domain/pronounOption.ts +2 -2
  198. package/dist/templates/examples/job-application/src/domain/step.ts +2 -3
  199. package/dist/templates/examples/job-application/src/entry.ts +8 -11
  200. package/dist/templates/examples/job-application/src/flags.ts +25 -0
  201. package/dist/templates/examples/job-application/src/init.ts +15 -0
  202. package/dist/templates/examples/job-application/src/message.ts +0 -21
  203. package/dist/templates/examples/job-application/src/{main.fixture.ts → model.fixture.ts} +17 -18
  204. package/dist/templates/examples/job-application/src/model.ts +15 -24
  205. package/dist/templates/examples/job-application/src/navigationComponents.ts +6 -0
  206. package/dist/templates/examples/job-application/src/scene.test.ts +4 -3
  207. package/dist/templates/examples/job-application/src/services.ts +3 -0
  208. package/dist/templates/examples/job-application/src/step/attachments/block.ts +18 -0
  209. package/dist/templates/examples/job-application/src/step/attachments/composition.ts +46 -0
  210. package/dist/templates/examples/job-application/src/step/attachments/definition.ts +22 -0
  211. package/dist/templates/examples/job-application/src/step/attachments/index.ts +1 -2
  212. package/dist/templates/examples/job-application/src/step/attachments/init.ts +10 -0
  213. package/dist/templates/examples/job-application/src/step/attachments/scene.test.ts +3 -2
  214. package/dist/templates/examples/job-application/src/step/attachments/story.test.ts +32 -10
  215. package/dist/templates/examples/job-application/src/step/attachments/update.ts +19 -0
  216. package/dist/templates/examples/job-application/src/step/attachments/view.ts +65 -62
  217. package/dist/templates/examples/job-application/src/step/coverLetter/{coverLetter.ts → block.ts} +26 -23
  218. package/dist/templates/examples/job-application/src/step/coverLetter/index.ts +1 -1
  219. package/dist/templates/examples/job-application/src/step/coverLetter/scene.test.ts +5 -5
  220. package/dist/templates/examples/job-application/src/step/coverLetter/story.test.ts +6 -4
  221. package/dist/templates/examples/job-application/src/step/education/block.ts +22 -0
  222. package/dist/templates/examples/job-application/src/step/education/command.ts +28 -0
  223. package/dist/templates/examples/job-application/src/step/education/composition.ts +36 -0
  224. package/dist/templates/examples/job-application/src/step/education/definition.ts +27 -0
  225. package/dist/templates/examples/job-application/src/step/education/entry/block.ts +20 -0
  226. package/dist/templates/examples/job-application/src/step/education/entry/composition.ts +29 -0
  227. package/dist/templates/examples/job-application/src/step/education/entry/definition.ts +38 -0
  228. package/dist/templates/examples/job-application/src/step/education/entry/index.ts +1 -11
  229. package/dist/templates/examples/job-application/src/step/education/entry/init.ts +16 -0
  230. package/dist/templates/examples/job-application/src/step/education/entry/story.test.ts +6 -4
  231. package/dist/templates/examples/job-application/src/step/education/entry/update.ts +69 -0
  232. package/dist/templates/examples/job-application/src/step/education/entry/view.ts +48 -47
  233. package/dist/templates/examples/job-application/src/step/education/index.ts +1 -12
  234. package/dist/templates/examples/job-application/src/step/education/init.ts +10 -0
  235. package/dist/templates/examples/job-application/src/step/education/scene.test.ts +3 -2
  236. package/dist/templates/examples/job-application/src/step/education/story.test.ts +41 -20
  237. package/dist/templates/examples/job-application/src/step/education/update.ts +48 -0
  238. package/dist/templates/examples/job-application/src/step/education/view.ts +19 -15
  239. package/dist/templates/examples/job-application/src/step/index.ts +9 -6
  240. package/dist/templates/examples/job-application/src/step/personalInfo/block.ts +22 -0
  241. package/dist/templates/examples/job-application/src/step/personalInfo/command.ts +46 -0
  242. package/dist/templates/examples/job-application/src/step/personalInfo/composition.ts +50 -0
  243. package/dist/templates/examples/job-application/src/step/personalInfo/definition.ts +43 -0
  244. package/dist/templates/examples/job-application/src/step/personalInfo/index.ts +1 -11
  245. package/dist/templates/examples/job-application/src/step/personalInfo/init.ts +20 -0
  246. package/dist/templates/examples/job-application/src/step/personalInfo/scene.test.ts +5 -4
  247. package/dist/templates/examples/job-application/src/step/personalInfo/story.test.ts +6 -3
  248. package/dist/templates/examples/job-application/src/step/personalInfo/update.ts +136 -0
  249. package/dist/templates/examples/job-application/src/step/personalInfo/view.ts +78 -76
  250. package/dist/templates/examples/job-application/src/step/skills/block.ts +22 -0
  251. package/dist/templates/examples/job-application/src/step/skills/command.ts +28 -0
  252. package/dist/templates/examples/job-application/src/step/skills/composition.ts +29 -0
  253. package/dist/templates/examples/job-application/src/step/skills/definition.ts +23 -0
  254. package/dist/templates/examples/job-application/src/step/skills/entry/block.ts +20 -0
  255. package/dist/templates/examples/job-application/src/step/skills/entry/composition.ts +25 -0
  256. package/dist/templates/examples/job-application/src/step/skills/entry/definition.ts +35 -0
  257. package/dist/templates/examples/job-application/src/step/skills/entry/index.ts +1 -11
  258. package/dist/templates/examples/job-application/src/step/skills/entry/init.ts +12 -0
  259. package/dist/templates/examples/job-application/src/step/skills/entry/story.test.ts +5 -3
  260. package/dist/templates/examples/job-application/src/step/skills/entry/update.ts +36 -0
  261. package/dist/templates/examples/job-application/src/step/skills/entry/view.ts +38 -37
  262. package/dist/templates/examples/job-application/src/step/skills/index.ts +1 -12
  263. package/dist/templates/examples/job-application/src/step/skills/init.ts +6 -0
  264. package/dist/templates/examples/job-application/src/step/skills/scene.test.ts +3 -2
  265. package/dist/templates/examples/job-application/src/step/skills/story.test.ts +37 -20
  266. package/dist/templates/examples/job-application/src/step/skills/update.ts +48 -0
  267. package/dist/templates/examples/job-application/src/step/skills/view.ts +10 -13
  268. package/dist/templates/examples/job-application/src/step/workHistory/block.ts +22 -0
  269. package/dist/templates/examples/job-application/src/step/workHistory/command.ts +28 -0
  270. package/dist/templates/examples/job-application/src/step/workHistory/composition.ts +32 -0
  271. package/dist/templates/examples/job-application/src/step/workHistory/definition.ts +27 -0
  272. package/dist/templates/examples/job-application/src/step/workHistory/entry/block.ts +20 -0
  273. package/dist/templates/examples/job-application/src/step/workHistory/entry/composition.ts +84 -0
  274. package/dist/templates/examples/job-application/src/step/workHistory/entry/definition.ts +45 -0
  275. package/dist/templates/examples/job-application/src/step/workHistory/entry/index.ts +1 -11
  276. package/dist/templates/examples/job-application/src/step/workHistory/entry/init.ts +20 -0
  277. package/dist/templates/examples/job-application/src/step/workHistory/entry/story.test.ts +6 -4
  278. package/dist/templates/examples/job-application/src/step/workHistory/entry/update.ts +60 -0
  279. package/dist/templates/examples/job-application/src/step/workHistory/entry/view.ts +43 -41
  280. package/dist/templates/examples/job-application/src/step/workHistory/index.ts +1 -12
  281. package/dist/templates/examples/job-application/src/step/workHistory/init.ts +10 -0
  282. package/dist/templates/examples/job-application/src/step/workHistory/scene.test.ts +3 -2
  283. package/dist/templates/examples/job-application/src/step/workHistory/story.test.ts +39 -20
  284. package/dist/templates/examples/job-application/src/step/workHistory/update.ts +51 -0
  285. package/dist/templates/examples/job-application/src/step/workHistory/view.ts +10 -16
  286. package/dist/templates/examples/job-application/src/story.test.ts +167 -70
  287. package/dist/templates/examples/job-application/src/update.ts +49 -139
  288. package/dist/templates/examples/job-application/src/view/datePicker.ts +2 -2
  289. package/dist/templates/examples/job-application/src/view/preview.ts +23 -10
  290. package/dist/templates/examples/job-application/src/view/review.ts +43 -34
  291. package/dist/templates/examples/job-application/src/view/stepNav.ts +67 -61
  292. package/dist/templates/examples/job-application/src/view/view.ts +160 -136
  293. package/dist/templates/examples/kanban/package.json +2 -2
  294. package/dist/templates/examples/kanban/src/block.ts +20 -0
  295. package/dist/templates/examples/kanban/src/command.ts +51 -33
  296. package/dist/templates/examples/kanban/src/composition/composition.ts +11 -0
  297. package/dist/templates/examples/kanban/src/composition/dragAndDrop.ts +138 -0
  298. package/dist/templates/examples/kanban/src/composition/index.ts +3 -0
  299. package/dist/templates/examples/kanban/src/definition.ts +9 -0
  300. package/dist/templates/examples/kanban/src/domain/card.ts +0 -2
  301. package/dist/templates/examples/kanban/src/domain/column.ts +17 -13
  302. package/dist/templates/examples/kanban/src/entry.ts +8 -21
  303. package/dist/templates/examples/kanban/src/flags.ts +23 -0
  304. package/dist/templates/examples/kanban/src/init.ts +23 -0
  305. package/dist/templates/examples/kanban/src/message.ts +0 -5
  306. package/dist/templates/examples/kanban/src/model.ts +2 -6
  307. package/dist/templates/examples/kanban/src/scene.test.ts +9 -5
  308. package/dist/templates/examples/kanban/src/services.ts +8 -0
  309. package/dist/templates/examples/kanban/src/story.test.ts +81 -85
  310. package/dist/templates/examples/kanban/src/update.ts +6 -138
  311. package/dist/templates/examples/kanban/src/view/card.ts +15 -21
  312. package/dist/templates/examples/kanban/src/view/column.ts +40 -55
  313. package/dist/templates/examples/kanban/src/view/view.ts +33 -19
  314. package/dist/templates/examples/managed-resource-layer/package.json +2 -2
  315. package/dist/templates/examples/managed-resource-layer/src/{main.ts → application.ts} +83 -61
  316. package/dist/templates/examples/managed-resource-layer/src/entry.ts +7 -12
  317. package/dist/templates/examples/managed-resource-layer/src/scene.test.ts +2 -2
  318. package/dist/templates/examples/managed-resource-layer/src/services.ts +3 -0
  319. package/dist/templates/examples/managed-resource-layer/src/story.test.ts +12 -6
  320. package/dist/templates/examples/map/package.json +2 -2
  321. package/dist/templates/examples/map/src/block.ts +20 -0
  322. package/dist/templates/examples/map/src/command.ts +147 -0
  323. package/dist/templates/examples/map/src/composition.ts +11 -0
  324. package/dist/templates/examples/map/src/definition.ts +9 -0
  325. package/dist/templates/examples/map/src/entry.ts +7 -11
  326. package/dist/templates/examples/map/src/init.ts +20 -0
  327. package/dist/templates/examples/map/src/layer.ts +19 -0
  328. package/dist/templates/examples/map/src/locations.ts +1 -2
  329. package/dist/templates/examples/map/src/mapRegistry.ts +42 -0
  330. package/dist/templates/examples/map/src/message.ts +25 -0
  331. package/dist/templates/examples/map/src/{main.fixture.ts → model.fixture.ts} +4 -4
  332. package/dist/templates/examples/map/src/model.ts +30 -0
  333. package/dist/templates/examples/map/src/mount.test.ts +9 -5
  334. package/dist/templates/examples/map/src/mount.ts +173 -0
  335. package/dist/templates/examples/map/src/scene.test.ts +7 -12
  336. package/dist/templates/examples/map/src/services.ts +3 -0
  337. package/dist/templates/examples/map/src/story.test.ts +5 -10
  338. package/dist/templates/examples/map/src/update.ts +107 -0
  339. package/dist/templates/examples/map/src/view.ts +346 -0
  340. package/dist/templates/examples/pixel-art/package.json +2 -2
  341. package/dist/templates/examples/pixel-art/src/{main.bench.ts → app.bench.ts} +23 -14
  342. package/dist/templates/examples/pixel-art/src/block.ts +22 -0
  343. package/dist/templates/examples/pixel-art/src/command.ts +53 -49
  344. package/dist/templates/examples/pixel-art/src/comparison.bench.test.ts +10 -7
  345. package/dist/templates/examples/pixel-art/src/components.ts +12 -0
  346. package/dist/templates/examples/pixel-art/src/composition.ts +195 -0
  347. package/dist/templates/examples/pixel-art/src/constant.ts +2 -2
  348. package/dist/templates/examples/pixel-art/src/definition.ts +9 -0
  349. package/dist/templates/examples/pixel-art/src/entry.ts +8 -21
  350. package/dist/templates/examples/pixel-art/src/flags.ts +23 -0
  351. package/dist/templates/examples/pixel-art/src/grid.ts +31 -22
  352. package/dist/templates/examples/pixel-art/src/init.ts +41 -0
  353. package/dist/templates/examples/pixel-art/src/layer.ts +10 -0
  354. package/dist/templates/examples/pixel-art/src/message.ts +0 -10
  355. package/dist/templates/examples/pixel-art/src/model.ts +16 -19
  356. package/dist/templates/examples/pixel-art/src/palette.ts +7 -3
  357. package/dist/templates/examples/pixel-art/src/scene.test.ts +72 -50
  358. package/dist/templates/examples/pixel-art/src/services.ts +3 -0
  359. package/dist/templates/examples/pixel-art/src/story.test.ts +65 -29
  360. package/dist/templates/examples/pixel-art/src/subscription.ts +49 -29
  361. package/dist/templates/examples/pixel-art/src/update.ts +30 -255
  362. package/dist/templates/examples/pixel-art/src/view/canvas.ts +10 -9
  363. package/dist/templates/examples/pixel-art/src/view/dialog.ts +147 -135
  364. package/dist/templates/examples/pixel-art/src/view/history.ts +10 -9
  365. package/dist/templates/examples/pixel-art/src/view/toolbar.ts +197 -192
  366. package/dist/templates/examples/pixel-art/src/view/view.ts +11 -11
  367. package/dist/templates/examples/query-sync/package.json +2 -2
  368. package/dist/templates/examples/query-sync/src/block.ts +20 -0
  369. package/dist/templates/examples/query-sync/src/command.ts +52 -0
  370. package/dist/templates/examples/query-sync/src/composition.ts +81 -0
  371. package/dist/templates/examples/query-sync/src/definition.ts +9 -0
  372. package/dist/templates/examples/query-sync/src/entry.ts +8 -13
  373. package/dist/templates/examples/query-sync/src/init.ts +12 -0
  374. package/dist/templates/examples/query-sync/src/message.ts +16 -0
  375. package/dist/templates/examples/query-sync/src/model.ts +16 -0
  376. package/dist/templates/examples/query-sync/src/route.ts +172 -0
  377. package/dist/templates/examples/query-sync/src/scene.test.ts +11 -10
  378. package/dist/templates/examples/query-sync/src/story.test.ts +30 -24
  379. package/dist/templates/examples/query-sync/src/update.ts +66 -0
  380. package/dist/templates/examples/query-sync/src/view.ts +531 -0
  381. package/dist/templates/examples/route-transitions/package.json +2 -2
  382. package/dist/templates/examples/route-transitions/src/block.ts +20 -0
  383. package/dist/templates/examples/route-transitions/src/command.ts +71 -0
  384. package/dist/templates/examples/route-transitions/src/composition.ts +8 -0
  385. package/dist/templates/examples/route-transitions/src/data.ts +4 -3
  386. package/dist/templates/examples/route-transitions/src/definition.ts +9 -0
  387. package/dist/templates/examples/route-transitions/src/entry.ts +8 -13
  388. package/dist/templates/examples/route-transitions/src/init.ts +21 -0
  389. package/dist/templates/examples/route-transitions/src/message.ts +15 -0
  390. package/dist/templates/examples/route-transitions/src/model.ts +27 -0
  391. package/dist/templates/examples/route-transitions/src/route.ts +7 -9
  392. package/dist/templates/examples/route-transitions/src/story.test.ts +29 -29
  393. package/dist/templates/examples/route-transitions/src/transition.ts +90 -0
  394. package/dist/templates/examples/route-transitions/src/update.ts +64 -0
  395. package/dist/templates/examples/route-transitions/src/{main.ts → view.ts} +42 -298
  396. package/dist/templates/examples/routing/package.json +2 -2
  397. package/dist/templates/examples/routing/src/block.ts +22 -0
  398. package/dist/templates/examples/routing/src/command.ts +26 -0
  399. package/dist/templates/examples/routing/src/composition.ts +19 -0
  400. package/dist/templates/examples/routing/src/definition.ts +11 -0
  401. package/dist/templates/examples/routing/src/entry.ts +8 -14
  402. package/dist/templates/examples/routing/src/fileTree.ts +1 -2
  403. package/dist/templates/examples/routing/src/init.ts +19 -0
  404. package/dist/templates/examples/routing/src/layer.ts +10 -0
  405. package/dist/templates/examples/routing/src/message.ts +14 -0
  406. package/dist/templates/examples/routing/src/model.ts +9 -0
  407. package/dist/templates/examples/routing/src/page/index.ts +1 -1
  408. package/dist/templates/examples/routing/src/page/people/block.ts +24 -0
  409. package/dist/templates/examples/routing/src/page/people/command.ts +34 -0
  410. package/dist/templates/examples/routing/src/page/people/composition.ts +6 -0
  411. package/dist/templates/examples/routing/src/page/people/definition.ts +9 -0
  412. package/dist/templates/examples/routing/src/page/people/index.ts +1 -0
  413. package/dist/templates/examples/routing/src/page/people/message.ts +16 -0
  414. package/dist/templates/examples/routing/src/page/people/model.ts +71 -0
  415. package/dist/templates/examples/routing/src/page/people/update.ts +64 -0
  416. package/dist/templates/examples/routing/src/page/people/view.ts +149 -0
  417. package/dist/templates/examples/routing/src/page/people.scene.test.ts +3 -1
  418. package/dist/templates/examples/routing/src/page/people.story.test.ts +6 -10
  419. package/dist/templates/examples/routing/src/route.ts +9 -12
  420. package/dist/templates/examples/routing/src/scene.test.ts +16 -12
  421. package/dist/templates/examples/routing/src/story.test.ts +48 -16
  422. package/dist/templates/examples/routing/src/subscription.ts +37 -0
  423. package/dist/templates/examples/routing/src/update.ts +83 -0
  424. package/dist/templates/examples/routing/src/{main.ts → view.ts} +35 -197
  425. package/dist/templates/examples/shopping-cart/package.json +2 -2
  426. package/dist/templates/examples/shopping-cart/src/block.ts +20 -0
  427. package/dist/templates/examples/shopping-cart/src/command.ts +31 -0
  428. package/dist/templates/examples/shopping-cart/src/composition.ts +36 -0
  429. package/dist/templates/examples/shopping-cart/src/data/products.ts +1 -1
  430. package/dist/templates/examples/shopping-cart/src/definition.ts +9 -0
  431. package/dist/templates/examples/shopping-cart/src/domain/cart.ts +13 -11
  432. package/dist/templates/examples/shopping-cart/src/domain/item.ts +0 -4
  433. package/dist/templates/examples/shopping-cart/src/entry.ts +8 -13
  434. package/dist/templates/examples/shopping-cart/src/init.ts +15 -0
  435. package/dist/templates/examples/shopping-cart/src/message.ts +17 -0
  436. package/dist/templates/examples/shopping-cart/src/model.ts +13 -0
  437. package/dist/templates/examples/shopping-cart/src/page/cart.ts +7 -5
  438. package/dist/templates/examples/shopping-cart/src/page/checkout.ts +5 -6
  439. package/dist/templates/examples/shopping-cart/src/page/index.ts +1 -1
  440. package/dist/templates/examples/shopping-cart/src/page/products/block.ts +18 -0
  441. package/dist/templates/examples/shopping-cart/src/page/products/composition.ts +3 -0
  442. package/dist/templates/examples/shopping-cart/src/page/products/definition.ts +30 -0
  443. package/dist/templates/examples/shopping-cart/src/page/products/index.ts +1 -0
  444. package/dist/templates/examples/shopping-cart/src/page/products/products.ts +61 -0
  445. package/dist/templates/examples/shopping-cart/src/page/{products.scene.test.ts → products/scene.test.ts} +4 -3
  446. package/dist/templates/examples/shopping-cart/src/page/{products.story.test.ts → products/story.test.ts} +7 -6
  447. package/dist/templates/examples/shopping-cart/src/page/{products.ts → products/view.ts} +7 -97
  448. package/dist/templates/examples/shopping-cart/src/route.ts +9 -8
  449. package/dist/templates/examples/shopping-cart/src/scene.test.ts +16 -12
  450. package/dist/templates/examples/shopping-cart/src/story.test.ts +25 -15
  451. package/dist/templates/examples/shopping-cart/src/update.ts +54 -0
  452. package/dist/templates/examples/shopping-cart/src/view.ts +145 -0
  453. package/dist/templates/examples/slow-warnings/package.json +2 -2
  454. package/dist/templates/examples/slow-warnings/src/block.ts +21 -0
  455. package/dist/templates/examples/slow-warnings/src/composition.ts +8 -0
  456. package/dist/templates/examples/slow-warnings/src/definition.ts +9 -0
  457. package/dist/templates/examples/slow-warnings/src/entry.ts +7 -20
  458. package/dist/templates/examples/slow-warnings/src/handleSlow.test.ts +4 -2
  459. package/dist/templates/examples/slow-warnings/src/init.ts +12 -0
  460. package/dist/templates/examples/slow-warnings/src/message.ts +12 -0
  461. package/dist/templates/examples/slow-warnings/src/model.ts +33 -0
  462. package/dist/templates/examples/slow-warnings/src/scene.test.ts +4 -2
  463. package/dist/templates/examples/slow-warnings/src/story.test.ts +4 -2
  464. package/dist/templates/examples/slow-warnings/src/subscription.ts +113 -0
  465. package/dist/templates/examples/slow-warnings/src/update.ts +61 -0
  466. package/dist/templates/examples/slow-warnings/src/{main.ts → view.ts} +31 -253
  467. package/dist/templates/examples/slow-warnings/src/workload.ts +19 -0
  468. package/dist/templates/examples/snake/package.json +2 -2
  469. package/dist/templates/examples/snake/src/{main.ts → application.ts} +109 -79
  470. package/dist/templates/examples/snake/src/domain/apple.ts +2 -2
  471. package/dist/templates/examples/snake/src/domain/direction.ts +8 -5
  472. package/dist/templates/examples/snake/src/domain/position.ts +4 -6
  473. package/dist/templates/examples/snake/src/domain/snake.ts +16 -7
  474. package/dist/templates/examples/snake/src/entry.ts +6 -12
  475. package/dist/templates/examples/snake/src/scene.test.ts +2 -2
  476. package/dist/templates/examples/snake/src/story.test.ts +9 -4
  477. package/dist/templates/examples/ssg/package.json +2 -2
  478. package/dist/templates/examples/ssg/src/{main.ts → application.ts} +60 -40
  479. package/dist/templates/examples/ssg/src/entry.server.ts +3 -2
  480. package/dist/templates/examples/ssg/src/entry.ts +8 -13
  481. package/dist/templates/examples/ssg/src/route.ts +8 -7
  482. package/dist/templates/examples/ssr/package.json +2 -2
  483. package/dist/templates/examples/ssr/src/{main.ts → application.ts} +49 -38
  484. package/dist/templates/examples/ssr/src/entry.server.ts +4 -3
  485. package/dist/templates/examples/ssr/src/entry.ts +6 -11
  486. package/dist/templates/examples/ssr/src/scene.test.ts +1 -1
  487. package/dist/templates/examples/state-machine/package.json +2 -2
  488. package/dist/templates/examples/state-machine/src/block.ts +20 -0
  489. package/dist/templates/examples/state-machine/src/command.ts +22 -0
  490. package/dist/templates/examples/state-machine/src/composition.ts +36 -0
  491. package/dist/templates/examples/state-machine/src/definition.ts +9 -0
  492. package/dist/templates/examples/state-machine/src/entry.ts +6 -12
  493. package/dist/templates/examples/state-machine/src/init.ts +13 -0
  494. package/dist/templates/examples/state-machine/src/{main.ts → machine.ts} +5 -228
  495. package/dist/templates/examples/state-machine/src/message.ts +16 -0
  496. package/dist/templates/examples/state-machine/src/model.ts +68 -0
  497. package/dist/templates/examples/state-machine/src/scene.test.ts +8 -4
  498. package/dist/templates/examples/state-machine/src/story.test.ts +11 -35
  499. package/dist/templates/examples/state-machine/src/transition.ts +51 -0
  500. package/dist/templates/examples/state-machine/src/update.ts +24 -0
  501. package/dist/templates/examples/state-machine/src/view/analysis.ts +172 -0
  502. package/dist/templates/examples/state-machine/src/view/cart.ts +213 -0
  503. package/dist/templates/examples/state-machine/src/view/checkout.ts +201 -0
  504. package/dist/templates/examples/state-machine/src/view/header.ts +193 -0
  505. package/dist/templates/examples/state-machine/src/view/payment.ts +176 -0
  506. package/dist/templates/examples/state-machine/src/view/review.ts +322 -0
  507. package/dist/templates/examples/state-machine/src/view/shared.ts +136 -0
  508. package/dist/templates/examples/state-machine/src/view/shipping.ts +179 -0
  509. package/dist/templates/examples/state-machine/src/view/status.ts +131 -0
  510. package/dist/templates/examples/state-machine/src/view.ts +7 -1621
  511. package/dist/templates/examples/stopwatch/package.json +2 -2
  512. package/dist/templates/examples/stopwatch/src/{main.ts → application.ts} +92 -51
  513. package/dist/templates/examples/stopwatch/src/entry.ts +6 -12
  514. package/dist/templates/examples/stopwatch/src/scene.test.ts +13 -3
  515. package/dist/templates/examples/stopwatch/src/story.test.ts +3 -3
  516. package/dist/templates/examples/todo/package.json +2 -2
  517. package/dist/templates/examples/todo/src/block.ts +20 -0
  518. package/dist/templates/examples/todo/src/command.ts +42 -0
  519. package/dist/templates/examples/todo/src/composition.ts +8 -0
  520. package/dist/templates/examples/todo/src/definition.ts +9 -0
  521. package/dist/templates/examples/todo/src/entry.ts +10 -11
  522. package/dist/templates/examples/todo/src/flags.ts +20 -0
  523. package/dist/templates/examples/todo/src/init.ts +16 -0
  524. package/dist/templates/examples/todo/src/message.ts +25 -0
  525. package/dist/templates/examples/todo/src/model.ts +29 -0
  526. package/dist/templates/examples/todo/src/scene.test.ts +8 -12
  527. package/dist/templates/examples/todo/src/services.ts +3 -0
  528. package/dist/templates/examples/todo/src/story.test.ts +12 -16
  529. package/dist/templates/examples/todo/src/update.ts +175 -0
  530. package/dist/templates/examples/todo/src/{main.ts → view.ts} +37 -327
  531. package/dist/templates/examples/ui-showcase/package.json +2 -2
  532. package/dist/templates/examples/ui-showcase/src/block.ts +20 -0
  533. package/dist/templates/examples/ui-showcase/src/command.ts +31 -0
  534. package/dist/templates/examples/ui-showcase/src/composition.ts +16 -0
  535. package/dist/templates/examples/ui-showcase/src/definition.ts +11 -0
  536. package/dist/templates/examples/ui-showcase/src/entry.ts +9 -23
  537. package/dist/templates/examples/ui-showcase/src/flags.ts +12 -0
  538. package/dist/templates/examples/ui-showcase/src/init.ts +14 -0
  539. package/dist/templates/examples/ui-showcase/src/message.ts +11 -0
  540. package/dist/templates/examples/ui-showcase/src/model.ts +9 -0
  541. package/dist/templates/examples/ui-showcase/src/route.ts +208 -0
  542. package/dist/templates/examples/ui-showcase/src/scene.test.ts +29 -24
  543. package/dist/templates/examples/ui-showcase/src/story.test.ts +18 -20
  544. package/dist/templates/examples/ui-showcase/src/ui/block.ts +21 -0
  545. package/dist/templates/examples/ui-showcase/src/ui/combobox.ts +6 -0
  546. package/dist/templates/examples/ui-showcase/src/ui/composition/animation.ts +22 -0
  547. package/dist/templates/examples/ui-showcase/src/ui/composition/composition.ts +556 -0
  548. package/dist/templates/examples/ui-showcase/src/ui/composition/dragAndDrop.ts +69 -0
  549. package/dist/templates/examples/ui-showcase/src/ui/composition/index.ts +42 -0
  550. package/dist/templates/examples/ui-showcase/src/ui/definition.ts +11 -0
  551. package/dist/templates/examples/ui-showcase/src/ui/domain/domain.ts +37 -0
  552. package/dist/templates/examples/ui-showcase/src/ui/domain/index.ts +8 -0
  553. package/dist/templates/examples/ui-showcase/src/ui/index.ts +1 -0
  554. package/dist/templates/examples/ui-showcase/src/ui/init.ts +5 -133
  555. package/dist/templates/examples/ui-showcase/src/ui/listbox.ts +13 -0
  556. package/dist/templates/examples/ui-showcase/src/ui/menu.ts +5 -0
  557. package/dist/templates/examples/ui-showcase/src/ui/message.ts +2 -61
  558. package/dist/templates/examples/ui-showcase/src/ui/model.ts +61 -99
  559. package/dist/templates/examples/ui-showcase/src/ui/radioGroup.ts +5 -0
  560. package/dist/templates/examples/ui-showcase/src/ui/tabs.ts +5 -0
  561. package/dist/templates/examples/ui-showcase/src/ui/toast.ts +2 -3
  562. package/dist/templates/examples/ui-showcase/src/ui/update.ts +49 -1051
  563. package/dist/templates/examples/ui-showcase/src/ui/view/animation.ts +37 -44
  564. package/dist/templates/examples/ui-showcase/src/ui/view/button.ts +51 -56
  565. package/dist/templates/examples/ui-showcase/src/ui/view/calendar.ts +36 -45
  566. package/dist/templates/examples/ui-showcase/src/ui/view/checkbox.ts +65 -69
  567. package/dist/templates/examples/ui-showcase/src/ui/view/combobox.ts +141 -141
  568. package/dist/templates/examples/ui-showcase/src/ui/view/datePicker.ts +40 -51
  569. package/dist/templates/examples/ui-showcase/src/ui/view/dialog.ts +151 -161
  570. package/dist/templates/examples/ui-showcase/src/ui/view/disclosure.ts +179 -180
  571. package/dist/templates/examples/ui-showcase/src/ui/view/dragAndDrop.ts +95 -78
  572. package/dist/templates/examples/ui-showcase/src/ui/view/fieldset.ts +40 -42
  573. package/dist/templates/examples/ui-showcase/src/ui/view/fileDrop.ts +65 -74
  574. package/dist/templates/examples/ui-showcase/src/ui/view/hoverIntent.ts +53 -62
  575. package/dist/templates/examples/ui-showcase/src/ui/view/index.ts +2 -0
  576. package/dist/templates/examples/ui-showcase/src/ui/view/input.ts +70 -73
  577. package/dist/templates/examples/ui-showcase/src/ui/view/listbox.ts +120 -124
  578. package/dist/templates/examples/ui-showcase/src/ui/view/menu.ts +60 -67
  579. package/dist/templates/examples/ui-showcase/src/ui/view/meter.ts +75 -79
  580. package/dist/templates/examples/ui-showcase/src/ui/view/mobileMenu.ts +48 -0
  581. package/dist/templates/examples/ui-showcase/src/ui/view/popover.ts +124 -135
  582. package/dist/templates/examples/ui-showcase/src/ui/view/progress.ts +77 -81
  583. package/dist/templates/examples/ui-showcase/src/ui/view/radioGroup.ts +113 -120
  584. package/dist/templates/examples/ui-showcase/src/ui/view/select.ts +88 -97
  585. package/dist/templates/examples/ui-showcase/src/ui/view/slider.ts +91 -99
  586. package/dist/templates/examples/ui-showcase/src/ui/view/switch.ts +46 -47
  587. package/dist/templates/examples/ui-showcase/src/ui/view/tabs.ts +87 -89
  588. package/dist/templates/examples/ui-showcase/src/ui/view/textarea.ts +73 -76
  589. package/dist/templates/examples/ui-showcase/src/ui/view/toast.ts +95 -98
  590. package/dist/templates/examples/ui-showcase/src/ui/view/tooltip.ts +95 -98
  591. package/dist/templates/examples/ui-showcase/src/ui/view/virtualList.ts +79 -100
  592. package/dist/templates/examples/ui-showcase/src/ui/virtualList.ts +16 -0
  593. package/dist/templates/examples/ui-showcase/src/update.ts +41 -0
  594. package/dist/templates/examples/ui-showcase/src/view.ts +412 -0
  595. package/dist/templates/examples/view-transitions/package.json +2 -2
  596. package/dist/templates/examples/view-transitions/src/{main.ts → application.ts} +88 -55
  597. package/dist/templates/examples/view-transitions/src/artwork.ts +4 -3
  598. package/dist/templates/examples/view-transitions/src/entry.ts +8 -13
  599. package/dist/templates/examples/view-transitions/src/route.ts +8 -7
  600. package/dist/templates/examples/view-transitions/src/scene.test.ts +15 -5
  601. package/dist/templates/examples/weather/package.json +2 -2
  602. package/dist/templates/examples/weather/src/block.ts +20 -0
  603. package/dist/templates/examples/weather/src/command.ts +141 -0
  604. package/dist/templates/examples/weather/src/composition.ts +8 -0
  605. package/dist/templates/examples/weather/src/definition.ts +9 -0
  606. package/dist/templates/examples/weather/src/entry.ts +7 -11
  607. package/dist/templates/examples/weather/src/init.ts +9 -0
  608. package/dist/templates/examples/weather/src/message.ts +11 -0
  609. package/dist/templates/examples/weather/src/model.fixture.ts +16 -0
  610. package/dist/templates/examples/weather/src/model.ts +19 -0
  611. package/dist/templates/examples/weather/src/scene.test.ts +6 -2
  612. package/dist/templates/examples/weather/src/services.ts +3 -0
  613. package/dist/templates/examples/weather/src/story.test.ts +4 -82
  614. package/dist/templates/examples/weather/src/update.ts +36 -0
  615. package/dist/templates/examples/weather/src/view.ts +149 -0
  616. package/dist/templates/examples/web-components/package.json +2 -2
  617. package/dist/templates/examples/web-components/src/{main.ts → application.ts} +50 -31
  618. package/dist/templates/examples/web-components/src/entry.ts +6 -11
  619. package/dist/templates/examples/web-components/src/scene.test.ts +1 -1
  620. package/dist/templates/examples/web-components/src/story.test.ts +2 -2
  621. package/dist/templates/examples/websocket-chat/package.json +2 -2
  622. package/dist/templates/examples/websocket-chat/src/block.ts +24 -0
  623. package/dist/templates/examples/websocket-chat/src/chatSocket.ts +6 -0
  624. package/dist/templates/examples/websocket-chat/src/command.ts +69 -0
  625. package/dist/templates/examples/websocket-chat/src/composition.ts +8 -0
  626. package/dist/templates/examples/websocket-chat/src/definition.ts +9 -0
  627. package/dist/templates/examples/websocket-chat/src/entry.ts +7 -21
  628. package/dist/templates/examples/websocket-chat/src/init.ts +10 -0
  629. package/dist/templates/examples/websocket-chat/src/layer.ts +17 -0
  630. package/dist/templates/examples/websocket-chat/src/managedResource.ts +75 -0
  631. package/dist/templates/examples/websocket-chat/src/message.ts +21 -0
  632. package/dist/templates/examples/websocket-chat/src/model.ts +21 -0
  633. package/dist/templates/examples/websocket-chat/src/scene.test.ts +21 -9
  634. package/dist/templates/examples/websocket-chat/src/services.ts +3 -0
  635. package/dist/templates/examples/websocket-chat/src/story.test.ts +6 -7
  636. package/dist/templates/examples/websocket-chat/src/subscription.ts +80 -0
  637. package/dist/templates/examples/websocket-chat/src/update.ts +98 -0
  638. package/dist/templates/examples/websocket-chat/src/view.ts +276 -0
  639. package/dist/templates/release.json +18 -16
  640. package/dist/templates/rendering/ssg/package.json +1 -1
  641. package/dist/templates/rendering/ssg/src/{main.ts → application.ts} +62 -40
  642. package/dist/templates/rendering/ssg/src/entry.server.ts +3 -2
  643. package/dist/templates/rendering/ssg/src/entry.ts +9 -14
  644. package/dist/templates/rendering/ssg/src/route.ts +8 -7
  645. package/dist/templates/rendering/ssg/src/scene.test.ts +6 -3
  646. package/dist/templates/rendering/ssr/package.json +1 -1
  647. package/dist/templates/rendering/ssr/src/{main.ts → application.ts} +44 -39
  648. package/dist/templates/rendering/ssr/src/entry.server.ts +4 -3
  649. package/dist/templates/rendering/ssr/src/entry.ts +6 -11
  650. package/dist/templates/rendering/ssr/src/scene.test.ts +1 -1
  651. package/dist/utils/packages.js +2 -0
  652. package/package.json +1 -1
  653. package/dist/templates/examples/api-cache/src/main.fixture.ts +0 -71
  654. package/dist/templates/examples/api-cache/src/main.ts +0 -743
  655. package/dist/templates/examples/api-cache-query/src/main.ts +0 -651
  656. package/dist/templates/examples/auth/src/main.ts +0 -76
  657. package/dist/templates/examples/charting/src/chartHost.ts +0 -19
  658. package/dist/templates/examples/charting/src/telemetry.test.ts +0 -70
  659. package/dist/templates/examples/counters/src/main.ts +0 -167
  660. package/dist/templates/examples/generative-art/src/main.ts +0 -61
  661. package/dist/templates/examples/interrupting-commands/src/main.ts +0 -358
  662. package/dist/templates/examples/job-application/src/main.ts +0 -68
  663. package/dist/templates/examples/job-application/src/step/attachments/attachments.ts +0 -106
  664. package/dist/templates/examples/job-application/src/step/education/education.ts +0 -111
  665. package/dist/templates/examples/job-application/src/step/education/entry/entry.ts +0 -160
  666. package/dist/templates/examples/job-application/src/step/personalInfo/personalInfo.ts +0 -291
  667. package/dist/templates/examples/job-application/src/step/skills/entry/entry.ts +0 -120
  668. package/dist/templates/examples/job-application/src/step/skills/skills.ts +0 -108
  669. package/dist/templates/examples/job-application/src/step/workHistory/entry/entry.ts +0 -188
  670. package/dist/templates/examples/job-application/src/step/workHistory/workHistory.ts +0 -111
  671. package/dist/templates/examples/kanban/src/main.ts +0 -55
  672. package/dist/templates/examples/kanban/src/subscription.ts +0 -17
  673. package/dist/templates/examples/map/src/main.ts +0 -788
  674. package/dist/templates/examples/map/src/mapHost.ts +0 -21
  675. package/dist/templates/examples/pixel-art/src/main.ts +0 -84
  676. package/dist/templates/examples/query-sync/src/main.ts +0 -893
  677. package/dist/templates/examples/routing/src/page/people.ts +0 -331
  678. package/dist/templates/examples/shopping-cart/src/main.ts +0 -299
  679. package/dist/templates/examples/ui-showcase/src/main.ts +0 -688
  680. package/dist/templates/examples/ui-showcase/src/ui/subscriptions.ts +0 -49
  681. package/dist/templates/examples/weather/src/main.fixture.ts +0 -59
  682. package/dist/templates/examples/weather/src/main.ts +0 -349
  683. package/dist/templates/examples/websocket-chat/src/main.ts +0 -628
package/README.md CHANGED
@@ -31,7 +31,7 @@ The starter examples apply to `spa` rendering. The `ssg` and `ssr` modes scaffol
31
31
  | Example | Description |
32
32
  | ------------------------ | ------------------------------------------------------------------------------------------------------ |
33
33
  | `counter` | Simple increment/decrement with reset |
34
- | `counters` | A dynamic list of Counter Submodels with per-instance routing via a wrapper Message |
34
+ | `counters` | A dynamic list of Counter Blocks with generated per-instance delivery |
35
35
  | `todo` | CRUD operations with localStorage persistence |
36
36
  | `stopwatch` | Timer with start/stop/reset |
37
37
  | `crash-view` | Custom crash fallback UI with crash.view and crash.report |
@@ -48,7 +48,7 @@ The starter examples apply to `spa` rendering. The `ssg` and `ssr` modes scaffol
48
48
  | `snake` | Classic game built with Subscriptions |
49
49
  | `canvas-art` | Declarative 2D canvas with shapes, animation-frame Subscriptions, and pointer events |
50
50
  | `generative-art` | Perlin-noise flow field with evolving particle trails, mouse vortex, and high-frequency Messages |
51
- | `auth` | Authentication with Submodels, OutMessage, and protected routes |
51
+ | `auth` | Authentication with Blocks, OutMessage, and protected routes |
52
52
  | `shopping-cart` | Complex state management with nested Models and routing |
53
53
  | `state-machine` | Experimental state machine checkout with guarded branches and edge Commands |
54
54
  | `pixel-art` | Pixel editor with undo/redo, UI components, and localStorage persistence |
@@ -58,7 +58,7 @@ The starter examples apply to `spa` rendering. The `ssg` and `ssr` modes scaffol
58
58
  | `map` | Interactive MapLibre GL map with Mount and Subscriptions |
59
59
  | `web-components` | QR code designer wiring third-party web components into Foldkit with CustomElement.define |
60
60
  | `embedding` | A Foldkit widget embedded in a plain TypeScript host page with Ports and dispose |
61
- | `ui-showcase` | Every Foldkit UI component with routing and Submodels |
61
+ | `ui-showcase` | Every Foldkit UI component with routing and Blocks |
62
62
 
63
63
  ## License
64
64
 
package/dist/examples.js CHANGED
@@ -40,7 +40,7 @@ export const examples = [
40
40
  {
41
41
  value: 'counters',
42
42
  title: 'counters',
43
- description: 'A dynamic list of Counter Submodels with per-instance routing via a wrapper Message',
43
+ description: 'A dynamic list of Counter Blocks with generated per-instance delivery',
44
44
  },
45
45
  {
46
46
  value: 'todo',
@@ -85,7 +85,7 @@ export const examples = [
85
85
  {
86
86
  value: 'api-cache-query',
87
87
  title: 'api-cache-query',
88
- description: 'The API Cache app rewritten with experimental Query.define. Fetching and retained entries live in Query Submodels',
88
+ description: 'The API Cache app rewritten with experimental Query.define. Fetching and retained entries live in Query Blocks',
89
89
  },
90
90
  {
91
91
  value: 'charting',
@@ -135,7 +135,7 @@ export const examples = [
135
135
  {
136
136
  value: 'auth',
137
137
  title: 'auth',
138
- description: 'Authentication with Submodels, OutMessage, and protected routes',
138
+ description: 'Authentication with Blocks, OutMessage, and protected routes',
139
139
  },
140
140
  {
141
141
  value: 'shopping-cart',
@@ -185,6 +185,6 @@ export const examples = [
185
185
  {
186
186
  value: 'ui-showcase',
187
187
  title: 'ui-showcase',
188
- description: 'Every Foldkit UI component with routing and Submodels',
188
+ description: 'Every Foldkit UI component with routing and Blocks',
189
189
  },
190
190
  ];
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
3
+ "extends": ["./node_modules/@effect/tsgo/oxlint-presets/correctness.json"],
4
+ "categories": {
5
+ "correctness": "off"
6
+ },
7
+ "rules": {
8
+ "effecttsgo/catch-unfailable-effect": "warn",
9
+ "effecttsgo/effect-fn-iife": "warn",
10
+ "effecttsgo/effect-gen-uses-adapter": "warn",
11
+ "effecttsgo/effect-in-failure": "warn",
12
+ "effecttsgo/effect-in-void-success": "warn",
13
+ "effecttsgo/layer-merge-all-with-dependencies": "warn",
14
+ "effecttsgo/lazy-promise-in-effect-sync": "warn",
15
+ "effecttsgo/leaking-requirements": "warn",
16
+ "effecttsgo/multiple-effect-provide": "warn",
17
+ "effecttsgo/prefer-typed-schema-decoder": "warn",
18
+ "effecttsgo/prefer-unsafe-constructor": "warn",
19
+ "effecttsgo/return-effect-in-gen": "warn",
20
+ "effecttsgo/schema-sync-in-effect": "warn",
21
+ "effecttsgo/scope-in-layer-effect": "warn",
22
+ "effecttsgo/try-catch-in-effect-gen": "warn",
23
+ "effecttsgo/unstable-api-usage": "off",
24
+ "effecttsgo/unknown-in-effect-catch": "warn"
25
+ }
26
+ }
@@ -2,6 +2,8 @@
2
2
 
3
3
  This is a Foldkit app. Read [`FOLDKIT.md`](./FOLDKIT.md) before writing any code in this project. It covers the architecture, the APIs, and the conventions the project is built on.
4
4
 
5
+ A root uses one of two complete layouts. A genuinely compact root keeps Model, Message, init, update, view, `ApplicationDefinition`, `ApplicationComposition`, `ApplicationBlock`, and any small local handler bundle together in `application.ts`. Once any root responsibility is extracted, split the whole root: retain `definition.ts` for `ApplicationDefinition` when authoring methods use it, or put a top-level `Block.makeDefinition('Application', ...).makeComposition()` chain in `composition.ts` when they do not; `model.ts`, `message.ts`, `init.ts`, `update.ts`, `view.ts`, and optional `flags.ts` own their named responsibilities; `composition.ts` owns Bindings, OutMessage folds, complete child/Mount registration, `ApplicationComposition`, and an optional `ApplicationViewBuilder`; and `block.ts` assembles `ApplicationBlock`. Even a graphless split root has `composition.ts`. Remove the emptied `application.ts` instead of using it as a forwarding barrel. A simple root `EffectsLayer` stays with its Command definitions in `command.ts`; use `layer.ts` only for substantial or reused Layer composition. Composition imports the Definition and child or Mount definitions, never root init, update, or view. Create every root with `Block.makeDefinition('Application', { Model, Message })`, author init, update, and the primary view through its Composition, then pass them explicitly to `ApplicationComposition.prepareBlock(...)` inside the private `prepare` producer. Put the adjacent `ApplicationBlock: Block.FromAssemblyWithView<typeof Model, typeof prepare> = Block.assemble(prepare)` export on the next line with no blank line. A split feature uses composition.ts, including for Mount-only registrations. Shared Mount definitions live in mount.ts. Parent-owned Bindings from `ApplicationDefinition.makeBinding(...)` are passive relationship configuration; including them in the Composition's `bindings` registers them. `entry.ts` imports `ApplicationBlock`, owns the browser container and startup inputs, creates the host with `Program.make` or `Program.makeElement`, calls `program.provide(ApplicationLayer)` when needed, and starts the Runtime. Keep root `ApplicationLayer` composition in `services.ts`. Tests and server entries import the passive Block without starting the browser Runtime. Name the root Route union `ApplicationRoute` and the root provider `ApplicationLayer` (`ApplicationTestLayer` for its test alternative).
6
+
5
7
  Foldkit owns `FOLDKIT.md` and replaces it whole on upgrade. This file is yours. Anything you want an agent to know about this project goes below, where an upgrade won't touch it.
6
8
 
7
9
  `FOLDKIT.md` reads the line below to decide whether it has already offered to vendor the Foldkit source. Leave it in place.
@@ -11,3 +13,5 @@ subtree_prompted: false
11
13
  ## Project Notes
12
14
 
13
15
  Domain vocabulary, deployment steps, local conventions that differ from Foldkit's defaults: write them here.
16
+
17
+ For a required direct child field, omit `init` when its initializer accepts no arguments; use `init: { contextToArgs }` for required inputs or `init: false` when the parent supplies that field. Optional, keyed, and accessor storage remains parent-owned when `init` is omitted; explicit `init.contextToArgs`, keyed `init.instances` / `init.toItem`, or a checked custom projection chooses automatic startup. An optional `ChildInitContext` Schema on the parent Definition contextually types selectors that prepare arguments for direct child initializers. Author root startup through `ApplicationComposition.makeInit`, returning parent-owned `model` fields plus optional ephemeral `childInitContext`, parent `commands`, and post-assembly `steps`. Composition initializes and places child Models and collects their Commands. Use `ApplicationComposition.makeUpdate` for parent transitions; registered Bindings route generated child envelopes before the local Message callback. Put delivery admission in `delivery.when`, derive required child update context with `delivery.toUpdateContext`, and provide `keySchema` for a custom keyed Binding. See FOLDKIT.md for optional presence, exact keyed identity and startup Steps.
@@ -12,7 +12,7 @@ If `./repos/foldkit` exists, it contains the full Foldkit repository, vendored i
12
12
 
13
13
  - `repos/foldkit/examples/`: runnable example apps spanning every complexity tier. Usually your first stop when looking for a precedent for how to write something.
14
14
  - `repos/foldkit/packages/foldkit/src/`: framework source. Ground truth for API signatures.
15
- - `repos/foldkit/packages/typing-game/client/src/` and `repos/foldkit/packages/website/src/`: production apps built with Foldkit. Highest-fidelity reference for application architecture, Submodels, and OutMessage.
15
+ - `repos/foldkit/packages/typing-game/client/src/` and `repos/foldkit/packages/website/src/`: production apps built with Foldkit. Highest-fidelity reference for application architecture, Blocks, and OutMessage.
16
16
 
17
17
  Treat the subtree as read-only reference: never import from `repos/foldkit/` in your project source. Imports must come from the `foldkit` npm package.
18
18
 
@@ -42,11 +42,12 @@ Then replace this file whole. Foldkit's conventions change with its APIs, and a
42
42
 
43
43
  ## Project Conventions
44
44
 
45
+ - Name a concrete typed Block authoring value `<BlockId>Definition`, such as `SearchDefinition = Block.makeDefinition('Search', ...)` and `ApplicationDefinition = Block.makeDefinition('Application', ...)`. Keep the runtime ID unchanged. Name the corresponding Composition `<BlockId>Composition` or `ApplicationComposition`. Export ordinary completed values as `SearchBlock` and `ApplicationBlock`; a generic factory returns an exact completed Block that its caller names locally.
45
46
  - Foldkit is tightly coupled to the Effect ecosystem. Do not suggest solutions outside of Effect-TS.
46
47
  - Model fields must be Schema types (the model is a schema). Plain TypeScript types are fine elsewhere (function return types, local variables, etc.).
47
48
  - Use full names like `Message` (not `Msg`), and `withReturnType` (not `as const` or type casting).
48
49
  - Declare every variant together: `defineMessageUnion()` for Messages, `defineTaggedUnion()` for other domain unions, and `defineRouteUnion()` for Routes.
49
- - Keep constructors on their union: `Message.ClickedSubmit()`, `FetchState.Ok({ data })`, and `AppRoute.Home()`.
50
+ - Keep constructors on their union: `Message.ClickedSubmit()`, `FetchState.Ok({ data })`, and `ApplicationRoute.Home()`.
50
51
  - Use `taggedStruct()` only when the variants cannot be declared together, such as a recursive union.
51
52
  - Push back on any direction that violates Elm Architecture principles: unidirectional data flow, messages as facts (not commands), model as single source of truth, side effects confined to commands. If a prompt suggests mutating state, imperative event handlers, or two-way bindings, flag the issue and propose the idiomatic Foldkit approach.
52
53
  - Never use `NoOp`. Every message must describe what happened. A command's result message is named from the command, not from the fact it reports, whether or not it carries a payload: `LockScroll` → `CompletedLockScroll`, `DetermineStartTime` → `CompletedDetermineStartTime` (never `DeterminedStartTime`).
@@ -55,42 +56,92 @@ Then replace this file whole. Foldkit's conventions change with its APIs, and a
55
56
 
56
57
  ### Update
57
58
 
58
- `init` and `update` both return a record with the next Model and optional Commands. Inline the return type when the matcher is its only use:
59
+ Author init and update through the same named Composition used for view and completion. Its update callback receives the locally authored Message. Registered child Bindings route generated envelopes before that callback. Contextual typing supplies Model and Message types and preserves inferred Command requirements:
59
60
 
60
61
  ```ts
61
- const update = (model: Model, message: Message) =>
62
- Message.match<Update.Return<Model, Message>>(message, {
62
+ const update = ApplicationComposition.makeUpdate((model, message) =>
63
+ Message.match(message, {
63
64
  ClickedIncrement: () => ({
64
65
  model: modifyFields(model, { count: count => count + 1 }),
65
66
  }),
66
- })
67
+ }),
68
+ )
67
69
  ```
68
70
 
69
- Create an `UpdateReturn` alias when another matcher, helper, or exported signature reuses the type. The match generic constrains the whole update, so do not repeat the return annotation on the function.
71
+ Keep purposeful parameter types for additional operation inputs and dispatch context. Avoid repeating Model, Message, or return annotations already established by owned helpers. Standalone utilities remain module functions such as `Update.combineSteps` and `Command.mapMessages`.
70
72
 
71
- Update, init, boot, and component helper producers return `{ model }` when they statically create no Commands. When they compute a Commands collection, return it directly without checking whether it is empty. Never write the literal `commands: []`; `foldkit/no-empty-commands-array` enforces this producer convention.
73
+ An authored update supports `update(model, message, ...context)` for Runtime dispatch and `update(message)(model, ...context)` as an internal Step. Put the local Message constructor directly under `operations` when its payload is the public input, such as `operations: { requestClose: Message.RequestedClose }`. Completion associates it with the Block update without constructing a Message. A constructor with payload fields takes one constructor payload object followed by the update context, with constructor defaults honored; a constructor without payload fields takes no payload placeholder. Use a tuple producer under `operations` when the public inputs need mapping, refinement, defaults, or an exact context tuple. The completed Block or Binding passes the resulting Message through update synchronously as part of the pure transition; it does not enqueue another Runtime Message. Keep standalone Steps for internal Model transformations. `Update.combineSteps` accepts unary Steps, so add an explicit unary adapter that supplies every required context argument before combining a contextual update.
72
74
 
73
- When composing one of those results, bind the whole result to a value named after the operation and access its fields through that value. Use `homeInit`, `dialogClose`, or a trailing underscore such as `init_` when the operation name collides with the function. Do not destructure or rename `model`, `commands`, or `outMessage`. Dot access does not prevent someone from ignoring `outMessage`; it keeps the operation and all of its returned fields visible together. Name a child fold's `write` parameter after the next child Model, such as `nextSettings`.
75
+ Name Binding actions as `requestCloseMenu` paired with `Message.RequestedCloseMenu`, and notifications as `informJoined` paired with `Message.InformedOfJoin`. Both enter child update; do not expose silent Model-changing helpers.
74
76
 
75
- Pass optional Commands directly to APIs that accept them: `Command.mapMessages(homeInit.commands, toParentMessage)`. Use `result.commands ?? []` only when the next operation requires a concrete array for spreading, concatenating, execution, or an assertion.
77
+ Each completed operation returns the completed update function's full return contract. If one update branch returns a Command or OutMessage, every operation carries that requirement or optional result in its type even when its own Message reaches a pure branch. Calling a pure operation does not run effects from another branch.
78
+
79
+ Update, init, Step, and component helper producers return `{ model }` when they statically create no Commands. When they compute a Commands collection, return it directly without checking whether it is empty. Never write the literal `commands: []`; `foldkit/no-empty-commands-array` enforces this producer convention.
80
+
81
+ Use `Array.filter(commands, () => condition)` for a Boolean-conditioned Command group and `Array.filter([command], () => condition)` for a singleton. Keep `Array.liftPredicate` only when its predicate meaningfully examines each Command. Do not route a Boolean condition through `Option.liftPredicate` and `Option.toArray`; actual optional absence still uses `Option`.
82
+
83
+ `FeatureComposition.makeInit(fn)` authors a startup plan. Return only parent-owned fields under `model`; registered Binding `init` policies supply their child fields. Supply ephemeral `childInitContext` only when selectors need shared context for direct child initializer arguments. Optional parent `commands` precede retained child init Commands in Binding order; `steps` run afterward against the assembled Model and append their Commands in order. These are pure transitions, not an extra Runtime phase. Give the initializer one concrete signature; optional, default and rest parameters remain exact. Completion checks Flags, routing, handler completeness and registration evidence. Declare meaningful startup operations such as `requestLoadInitialData`, `requestRestore`, or `requestOpen` as Message producers and invoke them through the Binding in the plan's `steps`. Do not manufacture a separate startup-only Message when an existing Message already records the transition.
84
+
85
+ When composing an update-like result that already contains a Model and optional Commands or OutMessage, bind the whole result to a value named after the operation and access its fields through that value. Use `homeInit`, `dialogClose`, or a trailing underscore such as `init_` when the operation name collides with the function. Do not destructure or rename `model`, `commands`, or `outMessage`. Dot access does not prevent someone from ignoring `outMessage`; it keeps the operation and all of its returned fields visible together. Name a child fold's `write` parameter after the next child Model, such as `nextSettings`.
86
+
87
+ Pass optional Commands directly to APIs that accept them: `Command.mapMessages(homeInit.commands, toMessage)`. Use `result.commands ?? []` only when the next operation requires a concrete array for spreading, concatenating, execution, or an assertion.
76
88
 
77
89
  Use `Update.Return<Model, Message>` when an update cannot emit an OutMessage. It prevents a result containing an OutMessage from entering code that would keep only its Model and Commands. A result with no `outMessage` can still be used where `Update.ReturnWithOutMessage<Model, Message, OutMessage>` is expected. The missing field means that update emitted no OutMessage.
78
90
 
79
- Use `Update.foldChildInit` for one child `init` or `boot` result. Use `Update.foldChildInits` when several child results enter one parent Model. Both lift child Commands and handle child OutMessages. Use `Update.foldChild` for a child update that receives input, or `Update.foldChildStep` for a child helper that receives only its Model. Keep route-gated initialization or Model-only child construction separate when there is no shared set of child results to fold.
91
+ Author every ordinary child through `const ChildDefinition = Block.makeDefinition('Child', { Model, Message, OutMessage? })` and create `ChildComposition = ChildDefinition.makeComposition({ bindings?, mounts? })`. Return `ChildComposition.prepareBlock(...)` from one private zero-argument `prepare` producer, then put the checked `ChildBlock: Block.FromAssemblyWith*<typeof Model, typeof prepare> = Block.assemble(prepare)` export immediately after it with no blank line. Choose the matching one of the four view and OutMessage shapes. `prepareBlock` returns an opaque draft with no Model or runtime methods; `Block.assemble` returns the completed Block accepted by Bindings, Programs, and Server rendering. This Definition → Composition → preparation → assembly sequence is passive; only the Runtime starts the resulting program. The feature barrel exports only `ChildBlock`; reusable Schemas and pure utilities use an explicit domain barrel. The parent imports the completed Block and creates `const ChildBinding = ParentDefinition.makeBinding(ChildBlock, config)`, then includes the Binding in its Composition's `bindings`. The Binding projects `init`, `fold`, the operations selected in the Block's `operations` record as direct named methods, and `embedView`, so the parent declares the relationship once. Composition carries lifecycle registrations and handler Layers without placing internal metadata on the ordinary Binding surface.
80
92
 
81
- Use `Update.combine` when a later Step should receive the Model produced by an earlier Step. It takes two or more Steps. Do not wrap one Step in `Update.combine`; call that operation directly. Name an inline Step parameter `stepModel`; it contains the Model produced by the preceding Step.
93
+ The authored parent `Message` contains only local facts. `FeatureComposition.Message` and the completed `FeatureBlock.Message` are the complete dispatch Schemas and include generated child envelopes. Query a cross-module dispatch type directly from one of those complete contracts, such as `typeof FeatureBlock.Message.Type`, instead of maintaining a second authored union or a routine alias.
82
94
 
83
- When the OutMessage is already known while constructing a new result, include it directly: `{ model, commands, outMessage }`. Use `Update.withOutMessage` when attaching an OutMessage to an existing plain return or when the value has the type `OutMessage | undefined`. Pipe an existing return into the helper: `pipe(dialogClose, Update.withOutMessage(outMessage))`. When constructing the plain return in the same expression, pass it first: `Update.withOutMessage({ model, commands }, outMessage)`.
95
+ Binding folds and Binding-projected operations are connected Steps whose Model input requires the exact registered graph. A typed call with a raw Model fails. Return or compose the opaque result intact from `Composition.makeUpdate` or `Composition.makeInit`; it has no public `.model` or `.commands` before checked execution. The raw recipe exposes only its direct channels. The owning Composition resolves registered policy into the final parent Command Message, requirements, and OutMessage channels, so derive exported parent contracts from the Composition-authored update or completed Block. A completed `ChildBlock.operations.operation(model, ...args)` dispatches its produced Message through the Block's update, accepts the raw Block Model, and returns the readable executed result. Ordinary pure Steps remain directly callable. TypeScript may accept a connected Binding function as a method returning `void`; outside the graph, that call only creates and discards passive configuration and executes no child work.
84
96
 
85
- Add `toParentOutMessage` only when at least one child OutMessage should continue to the current Submodel's parent. For partial forwarding, match every child variant and return `undefined` for the variants that stop here. Omit `toParentOutMessage` when every variant stops here. `foldOutMessage` still handles each variant locally, including variants that continue upward. Never write `toParentOutMessage: () => undefined`.
97
+ For an exact parent Struct field storing `ChildModel` or `Option<ChildModel>`, use `field`. `None` makes the child absent; folds and operations never create it. `presentWhen` gates the whole direct child without deleting stored state. `subscriptions.when` gates only Streams. The Composition generates child delivery envelopes; do not add a child wrapper to the authored parent Message or write Message mappers.
86
98
 
87
- When a `foldChildInits` entry can derive or forward an OutMessage, add `resolveOutMessage` to construct one parent OutMessage from the named OutMessages after every local fold completes. Combine their information when both results matter; choosing one discards the other. The callback also receives the final Model. If that Model alone contains everything needed, use local folds and attach a parent OutMessage afterward with `Update.withOutMessage`.
99
+ A direct array of child Models uses `field` and a string-valued `key` naming a stable child field. The child Schema must expose declared Struct fields. Init and child transitions preserve the key; parent update owns membership. Wrapped rows use `field`, `key`, and `childField`; union or opaque child Schemas without declared fields and custom parent writes retain general keyed accessors. A general keyed Binding provides `readAll`, function-valued `key`, exact `keySchema`, `read`, and `writeAt`. Tagged parent Models and writes that derive other parent state retain `read` and `write`. Put admission policy in `delivery.when` and derive required child update context with `delivery.toUpdateContext`; keyed callbacks receive the occurrence key. Placement identifies one Binding within the parent composition graph, not a DOM position or necessarily a Model field. An unkeyed direct field Binding defaults placement to `field`. Every keyed form, including direct and wrapped arrays, defaults placement to the child Block ID, as do static accessor Bindings. A keyed `key` identifies a dynamic occurrence under that placement. Optionality needs no override. Supply an explicit placement only when sibling defaults collide or a deliberate stable graph identity differs from the default.
100
+
101
+ Use `Update.combineSteps` when a later Step should receive the Model produced by an earlier Step. It takes two or more Steps. Do not wrap one Step in `Update.combineSteps`; call that operation directly. Name an inline Step parameter `stepModel`; it contains the Model produced by the preceding Step.
102
+
103
+ When the OutMessage is already known while constructing a new result, include it directly: `{ model, commands, outMessage }`. Use `Update.withOutMessage` when attaching an OutMessage to an existing plain return or when the value has the type `OutMessage | undefined`. Pipe an existing return into the helper: `pipe(dialogClose, Update.withOutMessage(outMessage))`. When constructing the plain return in the same expression, pass it first: `Update.withOutMessage({ model, commands }, outMessage)`.
104
+
105
+ Add `outMessage.forward` only when at least one child OutMessage should continue to the current Block's parent. For partial forwarding, match every child variant and return `undefined` for the variants that stop here. Omit `outMessage.forward` when every variant stops here. `outMessage.fold` still handles each variant locally, including variants that continue upward. Never write `outMessage.forward: () => undefined`.
106
+
107
+ Bind a standalone `fold<Child>OutMessage` directly to the child union's
108
+ exhaustive matcher when it needs only the OutMessage. Name every variant, even
109
+ when the union has one variant. Use the same direct matcher form for a
110
+ `outMessage.forward` mapper that needs only the OutMessage. Keep a function or
111
+ factory around the matcher when its branches consume other per-dispatch
112
+ context, including a collection key, previous Model state, an entry payload,
113
+ or `FoldContext` lifters. For a generic child with a structurally refined
114
+ OutMessage payload, pass the refined type as the matcher's second generic. Let
115
+ `FeatureDefinition.makeStep` preserve Command requirements from Command-producing
116
+ branches instead of constraining the matcher to a requirement-free
117
+ `Update.Step`.
118
+
119
+ Use `FeatureDefinition.makeFieldsStep(callback)` for an actual unary Model-only
120
+ field Step. The callback returns only field transformers. Use
121
+ `FeatureDefinition.makeNoopStep()` when a named child OutMessage intentionally
122
+ preserves the parent Model. Use `FeatureDefinition.makeCommandsStep(commands)`
123
+ when a composed Step only returns an existing Command collection. Use
124
+ `FeatureDefinition.makeOutMessageStep(outMessage)` when a Step preserves the
125
+ Model and emits one already-known declared OutMessage; this helper is available
126
+ only on Definitions that declare an OutMessage Schema. Keep
127
+ `FeatureDefinition.makeStep` for additional arguments, Model-dependent Commands
128
+ or OutMessages, connected Binding, initialization, delegated, conditional, and
129
+ composed results. `Update.combineSteps` rejects OutMessage-producing Steps;
130
+ attach an OutMessage to its result with `Update.withOutMessage`. Keep ordinary
131
+ update branches as ordinary returns instead of constructing and immediately
132
+ invoking a Step.
133
+
134
+ For a child stored in an exact required direct field, omit `init` when its initializer accepts no arguments. The Composition initializes it automatically. Use `init: { contextToArgs }` for required inputs, or `init: false` when the parent supplies that required field in the init plan's `model`. Optional, keyed, and accessor storage remains parent-owned when `init` is omitted; explicit `init.contextToArgs`, `init.instances`, or a checked custom projection chooses automatic startup. For an Option field, `contextToArgs` returns `Option<tuple>` and `None` leaves the child absent. An optional `ChildInitContext` Schema on the parent Definition contextually types selectors that share context for direct child initializer arguments, and the Composition init plan carries the decoded value as `childInitContext` when a selector uses it. It does not describe the current Block's own init arguments. Ordinary tuple literals retain the child's exact init argument types. A custom accessor can use `init: { contextToArgs, toParentFields }` to project the exact initialized child into one declared parent field. Direct and wrapped keyed arrays use `init.instances` returning ordered `{ key, args }` records and `init.toItem(occurrence, childModel)`. Preserve the planned key and the exact initialized child object; a wrapper literal can retain parent-owned metadata. General keyed accessors retain explicit occurrence creation through named parent Steps.
135
+
136
+ Composition invokes selected child initializers once, assembles their fields with parent-owned fields, then applies the plan's Steps. It filters child init Commands when their occurrence is absent or `presentWhen` is false, preserving remove-and-readd generation isolation. `subscriptions.when` gates only Subscription Streams. Runtime executes collected Commands later; their collection order does not sequence asynchronous completion. Keep `Binding.init` for deliberate creation or replacement of an occurrence during an update. It returns a passive, noncallable recipe with no `.model` or `.commands`. Return it intact from `Composition.makeInit` or `Composition.makeUpdate`, or preserve it through a Definition-owned `makeStep`. The Composition callbacks interpret it directly.
137
+
138
+ `FeatureComposition.makeUpdate(fn)` handles the locally authored Message after registered Bindings route generated child envelopes. Use `delivery.when` to reject inactive occurrences and `delivery.toUpdateContext` to derive the exact child update context from the parent Model and occurrence key. A custom keyed Binding supplies `keySchema` as its serialized identity contract. A child whose Message Schema is `Schema.Never` needs no delivery policy. Use `FeatureComposition.makeUpdate()` when the feature has no locally authored Message variants.
88
139
 
89
140
  Use `modifyFields()` from `foldkit/struct` for immutable model updates. Never spread or `Object.assign`.
90
141
 
91
142
  ### View
92
143
 
93
- Every view receives `h`, the typed Html builder, as its last parameter (`view: (model, h) => ...`; `Submodel.defineView` passes the child's own). Never construct a builder; reach for `h.div`, `h.OnClick`, etc. off the parameter, and give extracted view helpers an `h: HtmlBuilder<Message>` last parameter that callers thread through. Only where no builder is in scope, typically module scope, use `inertHtml` from `foldkit/html`, aliased `ih` so the two builders stay distinguishable. Use `h.empty` (not `null`) for conditional rendering, the union's own exhaustive `match` (`EditorMode.match(model.mode, {...})`) for discriminated unions, and `Array.match` for lists that may be empty.
144
+ Every view receives `h`, the typed Html builder, as its last parameter. Define the canonical completed view through its owning Composition's `makeView` or `makeView.withInputs`. A completed Block's `makeView` method authors only an alternate embed view against its already fixed graph. Ordinary extracted helpers are plain functions. After establishing `FeatureComposition`, declare `type FeatureViewBuilder = Block.ViewBuilderFor<typeof FeatureComposition>` on the next line with no blank line and use that alias for feature-local helpers. Export it only when another file uses it. It retains the feature Message type and registered child and Mount capabilities without constructing a runtime builder. The owner prefix is deliberate even though internal structural contracts remain `Model`, `Message`, and `OutMessage`: the completed `FeatureBlock` owns those public contracts, while the builder alias identifies one Composition's capabilities at a plain type import site. Give each helper only the Model, domain value, or context parameters it actually reads, followed by `h`; let TypeScript infer whether it returns one `Html` value or an array. Rendering genuinely shared across owners takes the framework's general `HtmlBuilder<Message>` form, with capability requirements when needed. Never annotate the primary view's inferred `h` parameter. Never construct a builder; reach for `h.div`, `h.OnClick`, and other helpers from the parameter. Only where no builder is in scope, typically module scope, use `inertHtml` from `foldkit/html`, aliased `ih`. Use `h.empty` (not `null`) for conditional rendering, the union's own exhaustive `match` for discriminated unions, and `Array.match` for lists that may be empty.
94
145
 
95
146
  Keys are for mapped list items only: key each row by a stable Model identifier (`h.keyed('li')(item.id, [], [...])`), never by array position, and never derive a key from displayed data. Never key branches; the build gives each view function's output its own identity, so branch switches replace DOM automatically. When switching an inline same-tag ternary must reset DOM state, extract each arm into its own named view function.
96
147
 
@@ -98,38 +149,76 @@ Omit the children argument when an element has none: `h.div([h.Class('divider')]
98
149
 
99
150
  ### Commands
100
151
 
101
- Define a Command with `Command.define(name, { args, messages, execute })`; omit `args` when the Command takes none. Assign definitions to PascalCase constants. Never inline in pipe chains. Name the effect `execute` performs, not the later Model transition caused when update handles its result: a timer that only waits before update starts a dismissal is `WaitBeforeDismissal`, not `DismissAfter`. Commands catch all errors via `Effect.catch(() => Effect.succeed(Message.FailedX(...)))` so side effects never crash the app. Definitions live colocated with the update function that returns them.
152
+ Define a Command with `FeatureDefinition.makeCommand(name, { args, messages, handler })`; omit `args` when it takes none. Assign definitions to PascalCase constants. Keep the handler Layer beside its definition. Name the work the handler performs, not the later Model transition caused by its result: a timer that waits before update begins dismissal is `WaitBeforeDismissal`. Convert expected failures to result Messages with `Effect.catch(() => Effect.succeed(Message.FailedX(...)))`. Defects follow the application's crash handling. Commands belong beside the update that returns them.
153
+
154
+ Define a Command's identity, args, result Messages, and handler in its config. Set `handler` to a generator constructor; Foldkit applies `Effect.gen` internally, obtains stable dependencies, and returns the operation the Runtime invokes with update's args. Include `Definition.layer` in the feature's `EffectsLayer`. Return the operation directly from the generator when construction has no work to perform. The Runtime builds handler Layers once per application start; actual requests, delays, and DOM work happen inside the returned operation. Production and ordinary execution tests use the same handler Layer and provide different external Service Layers beneath it. Omit `handler` for a contract implemented by an external host; that definition exposes `toLayer` but has no `.layer`. `toLayer` accepts the host's implementation Effect constructor. Use it for a host implementation or an intentional alternative handler. Author update with `FeatureComposition.makeUpdate` to infer its Command requirements. Pass the feature's `EffectsLayer` to `FeatureComposition.prepareBlock`; `Block.assemble` carries that checked handler graph onto the completed Block. Complete the root as `ApplicationBlock`, create the host Program in `entry.ts`, and call `program.provide(ApplicationLayer)` to supply only its remaining ordinary Services.
155
+
156
+ Compose each attached handler recipe directly in the feature's local `EffectsLayer`. Create a standalone `<DefinitionName>Layer` binding only when that provider is intentionally public or independently reused, and name alternatives `<DefinitionName>TestLayer`. A small feature composes `EffectsLayer` in `block.ts`; a substantial feature uses `layer.ts`. `EffectsLayer` supplies declared Command, Subscription, Mount, and ManagedResource handlers. `ApplicationLayer` supplies the ordinary HTTP, storage, RPC, clock, browser, and other Services those handlers or startup Effects require. Keep root `ApplicationLayer` composition in `services.ts`; `entry.ts` imports it, supplies it to the Program, and starts the Program. Reserve `Layer` for the Effect module.
157
+
158
+ Every feature is a completed Block. When it uses Definition authoring members, create `const FeatureDefinition = Block.makeDefinition('Feature', { Model, Message, OutMessage? })`. A specialized generic factory instead creates `const FeatureNamespace = Block.makeNamespace('Feature')`, then calls `FeatureNamespace.makeDefinition({ Model, Message, OutMessage? })` for each typed contract. Ordinary split features with Definition authoring establish their contracts in an early `definition.ts` without importing their completed barrel. Author Commands, operations needed by Binding policy, Subscriptions and ManagedResources through `FeatureDefinition`. Author init, update and the primary view through the named Composition. Create child Bindings through `FeatureDefinition.makeBinding(...)`, then create `FeatureComposition = FeatureDefinition.makeComposition({ mounts?, bindings? })`; both fields are independently optional and default to empty. Author the canonical graph-aware view through the Composition and derive `FeatureViewBuilder` immediately after it when helpers need that alias. In `block.ts`, return `FeatureComposition.prepareBlock({ init, ... })` from the private `prepare` producer and finish the adjacent annotated `FeatureBlock` with `Block.assemble(prepare)`. The ordinary feature barrel exports only `FeatureBlock`; reusable Schemas and pure utilities use an explicit domain barrel. Parent modules import the completed Block, bind it through their own Definition, include the Binding under `bindings`, delegate through its fold and operations, and render with `h.block(binding.embedView(...))`. A generic factory returns the exact completed Block, which its caller names locally.
159
+
160
+ Keep `FeatureDefinition` only when code uses one of its authoring members. If its only use would be `makeComposition`, write `const FeatureComposition = Block.makeDefinition('Feature', { Model, Message }).makeComposition()` at module scope. In a split feature, put that declaration and its contract imports in `composition.ts` and remove the empty `definition.ts`. The expression still passes through Definition, Composition, and assembly as three passive stages. Keep the factory at module scope so the owner identity is created once.
161
+
162
+ Author the canonical `init` once through `FeatureComposition.makeInit(...)` and pass it to `prepareBlock` by shorthand. Do not wrap a raw Model-returning initializer inside assembly. A pure Model constructor may remain separate when domain code or fixtures use it directly.
102
163
 
103
- Command args contain values already present in the Model or Message. Calling `Date.now()`, `crypto.randomUUID()`, or another source of time or randomness while preparing a Command happens before the Command executes, whether the call appears directly in the args object or its result is assigned to a local variable first. Obtain those values in `execute` and return them in the result Message.
164
+ Experimental Query and KeyedQuery values are completed viewless Blocks. Bind them with the same parent `makeBinding` method and include the Binding under `bindings`; use the Binding's `requestReset`, `requestRevalidation`, `requestRevalidationOrLoad`, and `requestLoadIfMissing` operations. The Query value itself retains direct `read` and `run` conveniences. Query preserves Fetch identity, handler completeness, host delegation, constructor errors and Service requirements, request generations, stale-response protection, and cache-key typing through standard Block composition. KeyedQuery entries are cache data inside one child Model, not keyed Block instances. A canonical Query supplies `query.EffectsLayer`; a host-owned Query omits `handler` and is completed with `query.provideHandlers(query.toLayer(...))` before binding.
104
165
 
105
- For the with-args shape, see `repos/foldkit/examples/weather/src/main.ts` or `repos/foldkit/examples/kanban/src/command.ts`. For an argless DOM-side-effect Command, the argless form in `kanban/src/command.ts` (`FocusAddCardInput`) is the canonical reference.
166
+ Create the root with `Block.makeDefinition('Application', { Model, Message })`. Retain its typed result as `ApplicationDefinition` when root Commands, Mounts, resources, Bindings, or Steps use that value; otherwise chain it directly into the module-level `ApplicationComposition`. Create root child Bindings with `ApplicationDefinition.makeBinding(...)`, then establish `const ApplicationComposition = ApplicationDefinition.makeComposition({ bindings?, mounts? })`; use `makeComposition()` for a graphless root. Author `init`, `update`, and the primary view through `ApplicationComposition`; Definition retains early effect, Step and Binding authoring. Return `ApplicationComposition.prepareBlock({ init, ... })` with explicit implementation fields from the private `prepare` producer, then put the annotated `ApplicationBlock = Block.assemble(prepare)` export immediately after it with no blank line. `ApplicationLayer` contains ordinary HTTP, storage, RPC, clock, browser, and other Services only. The entry passes the completed Block, container, and startup inputs to `Program.make` or `Program.makeElement`, then supplies the Layer with `program.provide(ApplicationLayer)`. Tests and server entries import the passive Block without booting a browser Runtime.
167
+
168
+ The `make*` names identify factories. `makeInit`, `makeUpdate`, and `makeView` return authored functions; they do not call those functions. `makeComposition` returns a configured Composition, `prepareBlock` returns an opaque draft, and `Block.assemble` returns the passive completed Block. `Program.make` and `Program.makeElement` return configured Programs. Only `Runtime.run`, `Runtime.hydrate`, or `Runtime.embed` starts execution.
169
+
170
+ Subscriptions declare `messages`, their Model projection, and `handler` in the entry config. The handler generator returns a function from dependencies to a Stream. When every owned entry has an attached handler, include `subscriptions.layer` in the feature's `EffectsLayer`. The aggregate is a passive recipe, is `Layer.empty` for an empty record, and is unavailable for mixed host ownership. The entry key `layer` is reserved. Individual entry recipes remain available for intentionally selective assembly. The Message declaration limits what that Stream can emit; use `messages: []` for silent scoped work. The generator runs once for a runtime start. Restarting the Subscription reuses that factory and its application-lifetime providers. A host-owned entry may omit `handler` and receive its implementation through `toLayer`, which accepts the implementation Effect constructor.
171
+
172
+ Mounts use the same `config.handler` generator and `.layer` convention. The returned operation receives the live element; perform DOM work there. Include the definition in its owning Composition's `mounts`. A ManagedResource entry likewise stores a handler generator in its config. The generator returns an object with required `acquire` and `release` functions. Supply cleanup explicitly. A no-op release is appropriate when scoped acquisition already registered the real finalizers, as with `Layer.build`. Foldkit finishes explicit release and scoped cleanup before clearing the handle and emitting `onReleased`.
173
+
174
+ Name the feature-local alias `FeatureViewBuilder`, derived as `Block.ViewBuilderFor<typeof FeatureComposition>`, for ordinary helpers. Keep it private unless another file uses it. The alias carries the same Message, child, and Mount evidence as the canonical view. Reusable helpers independent of an owner keep the framework's general `HtmlBuilder<Message>`.
175
+
176
+ Keep the four lifetimes distinct. Application services such as RPC clients last for one Runtime start. A Command Effect lasts for one dispatch. Subscription Streams and ManagedResource handles follow Model conditions. Mount acquisition follows one DOM element. A handler generator may capture a stable service or accessor. It must not capture current time, Command args, Subscription dependencies, a DOM element, or an active ManagedResource handle. Captured services remain fixed for the Runtime start. Contextual lookups use the merged invocation context, where invocation services win. Looking up a service retrieves a provided instance; it does not construct the provider.
177
+
178
+ Handlers and services may own mutable execution bookkeeping, such as worker availability or protocol request IDs. The Model and update own pending work shown to the user, selections, and submission rules. A `Ref` created in the constructor must not become the source of truth for workflow decisions or state read by view.
179
+
180
+ Command args contain values already present in the Model or Message. Calling `Date.now()`, `crypto.randomUUID()`, or another source of time or randomness while preparing a Command happens before the Command executes, whether the call appears directly in the args object or its result is assigned to a local variable first. Obtain those values in the returned handler and return them in the result Message.
181
+
182
+ For the with-args shape, see `repos/foldkit/examples/weather/src/command.ts` or `repos/foldkit/examples/kanban/src/command.ts`. For an argless DOM-side-effect Command, the argless form in `kanban/src/command.ts` (`FocusAddCardInput`) is the canonical reference.
106
183
 
107
184
  For DOM operations (focus, scroll, modals, scroll lock), Foldkit ships a `Dom` module. For time, randomness, UUIDs, and delays, use Effect's APIs directly (`Clock`, `Random`, `Crypto.Crypto`, `Effect.sleep`). Provide the platform Crypto layer when using `Crypto.Crypto`. Don't reach for raw `document.querySelector`, `setTimeout`, `Date.now()`, or `Math.random()`.
108
185
 
109
186
  ### File Organization
110
187
 
111
- Keep the runtime boot separate from the pure definitions. `src/entry.ts` calls `Runtime.makeApplication`, then `Runtime.run` for a client-rendered app or `Runtime.hydrate` for an SSR or SSG app. A client-rendered app references that entry from `index.html`. An SSR or SSG app names it in `ssr.clientEntry` in `vite.config.ts`, imports CSS from it, and exports `renderDocument` from `src/entry.server.ts` to produce the complete document. Its source tree has no `index.html`.
188
+ A root uses one of two complete layouts. A genuinely compact root keeps Model, Message, init, update, view, ApplicationDefinition, ApplicationComposition, ApplicationBlock, and any small local handler bundle together in application.ts. Once any root responsibility is extracted, split the whole root: definition.ts owns only ApplicationDefinition when authoring methods use that named value; otherwise composition.ts owns the top-level factory-to-Composition chain; model.ts, message.ts, init.ts, update.ts, view.ts, and optional flags.ts own their named responsibilities; composition.ts owns Bindings, OutMessage folds, complete child/Mount registration, ApplicationComposition, and an optional ApplicationViewBuilder; and block.ts assembles ApplicationBlock. Even a graphless split root has composition.ts. Remove the emptied application.ts instead of using it as an implementation bundle or forwarding barrel. Substantial root Binding policies live under composition/<child>.ts, are exposed through the explicit composition/index.ts barrel, and are imported by composition/composition.ts; external consumers never deep-import the policy or assembly implementation path. Composition imports the Definition and children or Mount definitions, never root init, update, or view. A simple root EffectsLayer stays with its Command definitions in command.ts; use layer.ts only when Layer composition is substantial or reused. entry.ts imports ApplicationBlock, owns the Program host config and startup inputs, supplies ApplicationLayer from services.ts, and starts the Runtime. Name the root Route union ApplicationRoute and a test provider ApplicationTestLayer.
189
+
190
+ Keep compact features together. A split feature uses `definition.ts` only when it needs a named `FooDefinition` for authoring methods; that file then owns early Model, Message, OutMessage, ChildInitContext, and the authoring contract. It never puts a Composition or owner-specific ViewBuilder there. Put substantial cohesive behavior in a folder-named implementation file such as `workHistory/workHistory.ts`, or retain focused init, update, and command files when they improve navigation. The view imports its Composition and Bindings from composition.ts; the small final `block.ts` imports both, completes the Block, and may compose a small local `EffectsLayer`. Extract feature `layer.ts` only when that composition is substantial or reused.
191
+
192
+ An ordinary feature barrel exports only its completed `FooBlock`. Put reusable Schemas and pure domain utilities in a separate explicit domain barrel. Split features with children or Mounts use composition.ts for Bindings, complete child/Mount registrations, Composition and an optional owner-specific ViewBuilder alias. Mount-only features use that same file; shared Mount definitions belong in mount.ts. Extract substantial policy to composition/<child>.ts with composition/composition.ts as the assembly point and composition/index.ts as a barrel. External consumers import from composition.ts or the explicit composition/index.ts barrel, never from a policy or assembly implementation path. The barrel namespaces every extracted policy module by child name, for example `export * as Home from './home'; export * as Room from './room'`; consumers can import `{ Home, Room }` from './composition`. Factories remain named within those namespaces, so consumers call `Home.bind(...)`; already constructed Binding values use PascalCase names such as `RoomBinding`. Keep flat named exports for the main Composition assembly surface and straightforward local Bindings. Internal implementation modules may use direct relative sibling imports to avoid barrel cycles. Keep straightforward Bindings there; do not create categories or duplicate child binding lists. A split graphless feature exports its named empty Composition from composition.ts, so view and block.ts import that same graph assembly value. If its Definition has no other use, composition.ts chains the top-level factory directly into makeComposition and no definition.ts is created. A compact graphless feature keeps the named Composition beside its cohesive implementation. Author the primary view through the Composition, return that Composition's opaque draft from the private producer, and complete the adjacent annotated Block with `Block.assemble`. Composition must not import the view, update matcher or completed Block; policy-dependent Steps belong beside Bindings or in independent leaf modules. `makeBinding`configures the relationship; including its result under`bindings`registers it. Runtime constructs Layers and executes effects later. Import each extracted Binding policy through its child-name namespace, such as`Home`, so its factory or Binding and parent-owned Commands remain visibly grouped. Keep extracted policy modules under their child-name namespaces even when a module exports only one value. Keep flat named imports for the main Composition assembly surface and straightforward local Bindings. Keep child feature namespaces distinct from parent-owned policy namespaces. Keep the child Block import inside the policy module so assembly can use `Home` for its composition policy.
193
+
194
+ Use direct Schema type queries in application annotations. Inside the owning feature, write `typeof Model.Type`, `typeof Message.Type`, or `typeof OutMessage.Type`; outside a child, write `typeof ChildBlock.Model.Type`, `typeof ChildBlock.Message.Type`, or `typeof ChildBlock.OutMessage.Type`. Let Definition and Composition callbacks infer owned parameters. Do not add routine colocated aliases. Keep a type alias when it deliberately publishes a contract or names a useful generic, mapped, or conditional type such as `Block.ViewBuilderFor<typeof FeatureComposition>`.
112
195
 
113
- The definitions (Model, Messages, init, update, view, Commands) never call `Runtime.run` or `Runtime.hydrate`, so tests and server entries can import them without booting a browser runtime. Keep both calls out of `main.ts`.
196
+ Start a client-rendered app with `Runtime.run` and an SSR or SSG app with `Runtime.hydrate`. A client-rendered app references its entry from `index.html`. An SSR or SSG app names the entry in `ssr.clientEntry` in `vite.config.ts`, imports CSS from it, and exports `renderDocument` from `src/entry.server.ts` to produce the complete document. Its source tree has no `index.html`.
114
197
 
115
- For a small app the definitions all fit in one `src/main.ts`. Split a unit into its own file when it has _both_ a distinct reason to change _and_ a name you'd give it unprompted: the pure domain core into `timer.ts` or `domain.ts`, the view into `view.ts` (or a `components/` directory), a Command's owned resource into its own module. Split on that revealed seam, not on line count alone. A file that has grown large is _evidence_ a seam has formed, so treat its size as a prompt to re-check for one. Two splits are forced: extract Messages to `message.ts` when Commands need the constructors (this breaks the cycle between `command.ts` and `main.ts`), and colocate Commands with the update that returns them. Exemplars: counter and stopwatch are a single `main.ts`; kanban splits `domain` / `command` / `message` / `model`; typing-game splits views by page.
198
+ The definitions (Model, Messages, init, update, view, Commands) never call `Runtime.run` or `Runtime.hydrate`, so tests and server entries can import them without booting a browser runtime. Both calls belong in `entry.ts` or `entry.server.ts`.
116
199
 
117
- Use uppercase section headers (`// MODEL`, `// MESSAGE`, `// INIT`, `// UPDATE`, `// COMMAND`, `// VIEW`) for wayfinding.
200
+ For a small app the definitions all fit in one `src/application.ts`. Split when a responsibility has a distinct reason to change and a name you would give it unprompted. Once that happens at the root, move every standard root responsibility to its named file instead of leaving a partial `application.ts`. Extract Messages to `message.ts` when Commands need the constructors; `definition.ts`, `command.ts`, and `update.ts` then import the Message contract directly. Keep Commands in the feature whose update returns them, alongside update or in a feature-local `command.ts` when several definitions or substantial handlers benefit from a separate file.
201
+
202
+ Use a short section header only when a long file has a substantial group that benefits from one. Routine architecture headings add noise in small application and example files.
118
203
 
119
204
  ### Testing
120
205
 
121
206
  Test update functions with `foldkit/test`. Since update is pure, tests run without a runtime, DOM, or side effects. Use `story` for update-level tests (send Messages, assert on Model and Commands) and `scene` for feature-level testing through the view with accessible locators.
122
207
 
208
+ For an execution test, use the production handler Layer and provide controlled external services beneath it before construction. The test then executes the real request, response mapping, or lifecycle logic with a deterministic API, storage, RPC, clock, or browser provider. Replacing a complete handler exercises the chosen result path and does not test that handler's implementation. Story and Scene tests resolve Commands without executing their handlers.
209
+
123
210
  Import the steps as named imports from `foldkit/story` or `foldkit/scene`: `import { Command, given, message, model, story } from 'foldkit/story'`. A test file needs only one of the two modules. If a single file ever tests both, import the namespaces instead (`import { Scene, Story } from 'foldkit'`) so `Story.given` and `Scene.given` stay distinguishable.
124
211
 
125
- Name each test file for its test style, beside the code under test: `story.test.ts` for the Story tests (which drive `update`) and `scene.test.ts` for the Scene tests (which drive the rendered view). The name describes how the test works, not a source file, so it stays correct whether `update` and `view` live in `main.ts` or in their own files. A test file lives in the folder that holds the code it drives, so in a multi-page app most of them sit in a page folder rather than at the root. When one folder holds more than one test of a kind (sibling pages, component variants), prefix with the subject: `login.story.test.ts`.
212
+ Name each test file for its test style, beside the code under test: `story.test.ts` for the Story tests (which drive `update`) and `scene.test.ts` for the Scene tests (which drive the rendered view). The name describes how the test works, not a source file, so it stays correct whether `update` and `view` live in `application.ts` or in their own files. A test file lives in the folder that holds the code it drives, so in a multi-page app most of them sit in a page folder rather than at the root. When one folder holds more than one test of a kind (sibling pages, component variants), prefix with the subject: `login.story.test.ts`.
126
213
 
127
214
  Scene runs at any level, since a page's own `update`/`view` pair drops into `scene` unmodified. Put a `scene.test.ts` in the page folder for behavior that page owns, which covers view states awkward to reach through the root Model, and keep a root-level `scene.test.ts` for flows that cross pages, which covers how the parent folds an OutMessage, a Command the parent lifts, a route change, and view inputs the parent computes. If the `repos/foldkit` subtree is available, study the `story.test.ts` and `scene.test.ts` files in `repos/foldkit/examples/`. `repos/foldkit/examples/auth` is the multi-page shape: a root `src/scene.test.ts` for the cross-page login flow alongside `src/page/loggedOut/page/login.scene.test.ts` and `login.story.test.ts` driving that page's own pair.
128
215
 
216
+ When a Scene emits a Subscription Message, include the owning Composition and registered `subscriptions` in its config and call `Subscription.emit(entry, message)` with the exact registered entry. Each entry's `messages` collection declares the raw Messages accepted by that step. Scene derives generated child delivery from the registered source and occurrence. Use distinct entry objects for different placements. Silent `messages: []` entries accept no emissions.
217
+
129
218
  ## Code Style
130
219
 
131
220
  - Encode state in discriminated unions, not booleans or nullable fields. `Idle | Loading | Error | Ok`, not `isLoading: boolean`. Make impossible states unrepresentable.
132
- - Use `Option` for absence in the Model and domain values instead of `null` or `undefined`. Foldkit return records are the exception: omit `commands` and `outMessage` when absent. A partial `toParentOutMessage` mapper returns `undefined` for each child variant that stops at this Submodel. Prefix Option-typed values with `maybe*`. Match with `Option.match`; don't unwrap with `Option.map(...)` + `Option.getOrElse(...)` when you can just match.
221
+ - Use `Option` for absence in the Model and domain values instead of `null` or `undefined`. Foldkit return records are the exception: omit `commands` and `outMessage` when absent. A partial `outMessage.forward` mapper returns `undefined` for each child variant that stops at this Block. Prefix Option-typed values with `maybe*`. Match with `Option.match`; don't unwrap with `Option.map(...)` + `Option.getOrElse(...)` when you can just match.
133
222
  - Use Effect modules over native methods in `pipe` chains (`Array.map`, `String.startsWith`, `Array.findFirst`). Native methods are fine when calling directly on a named variable.
134
223
  - Never cast Schema values with `as Type`. Use the callable constructor: `Message.SucceededLogin({ sessionId })`, not `{ _tag: 'SucceededLogin', sessionId } as Message`.
135
224
  - Always `Array.isArrayEmpty` / `Array.isArrayNonEmpty` (not `.length === 0` / `.length > 0`). Use `Array.match` when handling both empty and non-empty cases.
@@ -141,28 +230,27 @@ Scene runs at any level, since a page's own `update`/`view` pair drops into `sce
141
230
 
142
231
  ## Message Layout
143
232
 
144
- Declare the whole Message union with `defineMessageUnion()`, then put `type Message = typeof Message.Type` on the next line:
233
+ Declare the whole Message union with `defineMessageUnion()`:
145
234
 
146
235
  ```ts
147
236
  const Message = defineMessageUnion({
148
237
  ClickedSubmit: {},
149
238
  UpdatedEmail: { value: Schema.String },
150
239
  })
151
- type Message = typeof Message.Type
152
240
  ```
153
241
 
154
- Keep the `defineMessageUnion()` declaration and `type Message` alias adjacent. Construct values through the namespace (`Message.ClickedSubmit()`) and handle the union with `Message.match`. Never destructure constructors from `Message` or `OutMessage`; the owning namespace stays visible at every call site.
242
+ When an explicit local annotation needs the decoded union, write `typeof Message.Type` directly. Definition, Composition, and completed Block helpers infer it from the Schema value, so do not add a routine colocated alias. Construct values through the namespace (`Message.ClickedSubmit()`) and handle the union with `Message.match`. Never destructure constructors from `Message` or `OutMessage`; the owning namespace stays visible at every call site.
155
243
 
156
244
  Keep each case's payload object on one line when it fits. Let Oxfmt wrap payloads that need more space, so the declaration remains easy to scan as one variant per line.
157
245
 
158
- Messages are verb-first past-tense. Common prefixes: `Clicked*`, `Updated*` (input changes and external state updates), `Submitted*`, `Pressed*`, `Selected*`, `Succeeded*` / `Failed*` (paired async results), `Completed*` (every other Command result), `Got*` (child OutMessage in the Submodel pattern).
246
+ Messages are verb-first past-tense. Common prefixes: `Clicked*`, `Updated*` (input changes and external state updates), `Submitted*`, `Pressed*`, `Selected*`, `Succeeded*` / `Failed*` (paired async results), and `Completed*` (every other Command result). Keep the authored Message local; child delivery variants are generated by the Composition.
159
247
 
160
248
  ## Debugging
161
249
 
162
- This project ships with `@foldkit/devtools-mcp` pre-wired. When the dev server is running and the app is open in a browser, `foldkit_*` MCP tools let you inspect Model, Message history, and time-travel. Reach for them before adding `console.log` whenever the question is about state or Message flow.
250
+ This project ships with `@foldkit/devtools-mcp` pre-wired. When the dev server is running and the app is open in a browser, `foldkit_*` MCP tools let you inspect Model, Message history, and time-travel. The generated entry opts into external Message Schema discovery and dispatch with `devTools: { dispatch: true }`; Foldkit derives the Schema from the completed root Block, including generated child envelopes. Reach for those tools before adding `console.log` whenever the question is about state or Message flow.
163
251
 
164
252
  Treat those tools as privileged access to the application. They can return Models, Message payloads, and Command and Mount arguments to the agent. Keep credentials and private data out of browser state. Use Effect `Redacted` for sensitive values the browser must temporarily hold, and set `devToolsMcpPort: false` in the Foldkit Vite plugin options when an agent should not inspect the running application.
165
253
 
166
254
  ## Going Deeper
167
255
 
168
- For Submodels and OutMessage, Subscriptions, Mount / ManagedResource / CustomElement, field validation, routing, accessibility, and the full convention set, read the live Foldkit code in `repos/foldkit/`. The `examples/` directory and the production apps (`packages/typing-game/`, `packages/website/`) are the highest-fidelity references for any specific pattern. The `foldkit-skills` plugin's `generate-program` and `audit-program` skills carry written snapshot guides if you want a structured walkthrough.
256
+ For Blocks and OutMessage, Subscriptions, Mount / ManagedResource / CustomElement, field validation, routing, accessibility, and the full convention set, read the live Foldkit code in `repos/foldkit/`. The `examples/` directory and the production apps (`packages/typing-game/`, `packages/website/`) are the highest-fidelity references for any specific pattern. The `foldkit-skills` plugin's `generate-program` and `audit-program` skills carry written snapshot guides if you want a structured walkthrough.
@@ -9,6 +9,6 @@
9
9
  "typecheck": "tsc --noEmit",
10
10
  "format": "oxfmt",
11
11
  "test": "vitest run",
12
- "lint": "oxlint src"
12
+ "lint": "oxlint src && effect-tsgo patch --no-typescript --oxlint && oxlint --config .oxlintrc.effect.json --deny-warnings src"
13
13
  }
14
14
  }
@@ -20,8 +20,8 @@
20
20
  "@tailwindcss/vite": "^4.3.3",
21
21
  "happy-dom": "^20.14.5",
22
22
  "tailwindcss": "^4.3.3",
23
- "typescript": "^7.0.2",
24
- "vite": "^8.3.1",
23
+ "typescript": "7.1.0-beta",
24
+ "vite": "^8.3.3",
25
25
  "vitest": "^5.0.2"
26
26
  }
27
27
  }
@@ -0,0 +1,22 @@
1
+ import { Block } from 'foldkit'
2
+
3
+ import { ApplicationComposition } from './composition'
4
+ import { init } from './init'
5
+ import { EffectsLayer } from './layer'
6
+ import type { Model } from './model'
7
+ import { subscriptions } from './subscription'
8
+ import { update } from './update'
9
+ import { view } from './view/view'
10
+
11
+ const prepare = () =>
12
+ ApplicationComposition.prepareBlock({
13
+ init,
14
+ update,
15
+ view,
16
+ subscriptions,
17
+ EffectsLayer,
18
+ })
19
+ export const ApplicationBlock: Block.FromAssemblyWithView<
20
+ typeof Model,
21
+ typeof prepare
22
+ > = Block.assemble(prepare)
@@ -0,0 +1,69 @@
1
+ import { Clock, Effect, Schema, pipe } from 'effect'
2
+
3
+ import { fetchPostDetail, fetchPosts, fetchStats } from './data'
4
+ import { ApplicationDefinition } from './definition'
5
+ import { Message } from './message'
6
+ import { FetchedPostDetail, FetchedPosts, FetchedStats } from './model'
7
+
8
+ export const FetchPosts = ApplicationDefinition.makeCommand('FetchPosts', {
9
+ messages: [Message.CompletedFetchPosts],
10
+ handler: function* () {
11
+ const clock = yield* Clock.Clock
12
+
13
+ return () =>
14
+ pipe(
15
+ Effect.gen(function* () {
16
+ const posts = yield* fetchPosts
17
+ const fetchedAt = yield* clock.currentTimeMillis
18
+
19
+ return FetchedPosts.make({ posts, fetchedAt })
20
+ }),
21
+ Effect.result,
22
+ Effect.map(result => Message.CompletedFetchPosts({ result })),
23
+ )
24
+ },
25
+ })
26
+
27
+ export const FetchPostDetail = ApplicationDefinition.makeCommand(
28
+ 'FetchPostDetail',
29
+ {
30
+ args: { postId: Schema.String },
31
+ messages: [Message.CompletedFetchPostDetail],
32
+ handler: function* () {
33
+ const clock = yield* Clock.Clock
34
+
35
+ return ({ postId }) =>
36
+ pipe(
37
+ Effect.gen(function* () {
38
+ const detail = yield* fetchPostDetail(postId)
39
+ const fetchedAt = yield* clock.currentTimeMillis
40
+
41
+ return FetchedPostDetail.make({ detail, fetchedAt })
42
+ }),
43
+ Effect.result,
44
+ Effect.map(result =>
45
+ Message.CompletedFetchPostDetail({ postId, result }),
46
+ ),
47
+ )
48
+ },
49
+ },
50
+ )
51
+
52
+ export const FetchStats = ApplicationDefinition.makeCommand('FetchStats', {
53
+ messages: [Message.CompletedFetchStats],
54
+ handler: function* () {
55
+ const clock = yield* Clock.Clock
56
+
57
+ return () =>
58
+ pipe(
59
+ Effect.gen(function* () {
60
+ const stats = yield* fetchStats
61
+ const fetchedAt = yield* clock.currentTimeMillis
62
+
63
+ return FetchedStats.make({ stats, fetchedAt })
64
+ }),
65
+ Effect.result,
66
+ Effect.map(result => Message.CompletedFetchStats({ result })),
67
+ )
68
+ },
69
+ })