@elaraai/east-ui 1.0.85 → 1.0.87

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 (561) hide show
  1. package/dist/src/buttons/button/index.d.ts +4 -0
  2. package/dist/src/buttons/button/index.d.ts.map +1 -1
  3. package/dist/src/buttons/button/index.js +8 -1
  4. package/dist/src/buttons/button/index.js.map +1 -1
  5. package/dist/src/buttons/button/types.d.ts +6 -5
  6. package/dist/src/buttons/button/types.d.ts.map +1 -1
  7. package/dist/src/buttons/button/types.js.map +1 -1
  8. package/dist/src/buttons/icon-button/index.d.ts +5 -5
  9. package/dist/src/buttons/icon-button/index.d.ts.map +1 -1
  10. package/dist/src/buttons/icon-button/index.js +8 -2
  11. package/dist/src/buttons/icon-button/index.js.map +1 -1
  12. package/dist/src/buttons/icon-button/types.d.ts +8 -12
  13. package/dist/src/buttons/icon-button/types.d.ts.map +1 -1
  14. package/dist/src/buttons/icon-button/types.js +2 -2
  15. package/dist/src/buttons/icon-button/types.js.map +1 -1
  16. package/dist/src/buttons/toggle/index.d.ts +4 -0
  17. package/dist/src/buttons/toggle/index.d.ts.map +1 -1
  18. package/dist/src/buttons/toggle/index.js +6 -1
  19. package/dist/src/buttons/toggle/index.js.map +1 -1
  20. package/dist/src/buttons/toggle/types.d.ts +3 -2
  21. package/dist/src/buttons/toggle/types.d.ts.map +1 -1
  22. package/dist/src/buttons/toggle/types.js.map +1 -1
  23. package/dist/src/charts/chart/index.d.ts.map +1 -1
  24. package/dist/src/charts/chart/index.js +3 -3
  25. package/dist/src/charts/chart/index.js.map +1 -1
  26. package/dist/src/charts/spec/index.d.ts.map +1 -1
  27. package/dist/src/charts/spec/index.js +5 -2
  28. package/dist/src/charts/spec/index.js.map +1 -1
  29. package/dist/src/collections/deck/index.d.ts.map +1 -1
  30. package/dist/src/collections/deck/index.js +2 -2
  31. package/dist/src/collections/deck/index.js.map +1 -1
  32. package/dist/src/collections/index.d.ts +0 -6
  33. package/dist/src/collections/index.d.ts.map +1 -1
  34. package/dist/src/collections/index.js +0 -6
  35. package/dist/src/collections/index.js.map +1 -1
  36. package/dist/src/collections/library/index.d.ts +1 -1
  37. package/dist/src/collections/library/index.d.ts.map +1 -1
  38. package/dist/src/collections/library/index.js +2 -2
  39. package/dist/src/collections/library/index.js.map +1 -1
  40. package/dist/src/collections/schematic/index.d.ts.map +1 -1
  41. package/dist/src/collections/schematic/index.js +2 -2
  42. package/dist/src/collections/schematic/index.js.map +1 -1
  43. package/dist/src/collections/table/index.d.ts +1 -1
  44. package/dist/src/collections/table/index.d.ts.map +1 -1
  45. package/dist/src/collections/table/index.js +2 -2
  46. package/dist/src/collections/table/index.js.map +1 -1
  47. package/dist/src/collections/tree-view/index.d.ts +11 -32
  48. package/dist/src/collections/tree-view/index.d.ts.map +1 -1
  49. package/dist/src/collections/tree-view/index.js +15 -10
  50. package/dist/src/collections/tree-view/index.js.map +1 -1
  51. package/dist/src/component.d.ts +673 -9344
  52. package/dist/src/component.d.ts.map +1 -1
  53. package/dist/src/component.js +5 -259
  54. package/dist/src/component.js.map +1 -1
  55. package/dist/src/contracts/approval.d.ts +6 -8
  56. package/dist/src/contracts/approval.d.ts.map +1 -1
  57. package/dist/src/contracts/approval.js +6 -8
  58. package/dist/src/contracts/approval.js.map +1 -1
  59. package/dist/src/contracts/drag.d.ts +1 -1
  60. package/dist/src/contracts/drag.d.ts.map +1 -1
  61. package/dist/src/contracts/drag.js +4 -5
  62. package/dist/src/contracts/drag.js.map +1 -1
  63. package/dist/src/contracts/editing.d.ts +19 -19
  64. package/dist/src/contracts/editing.js +14 -14
  65. package/dist/src/contracts/fields.d.ts +471 -0
  66. package/dist/src/contracts/fields.d.ts.map +1 -0
  67. package/dist/src/contracts/fields.js +492 -0
  68. package/dist/src/contracts/fields.js.map +1 -0
  69. package/dist/src/contracts/index.d.ts +1 -0
  70. package/dist/src/contracts/index.d.ts.map +1 -1
  71. package/dist/src/contracts/index.js +1 -0
  72. package/dist/src/contracts/index.js.map +1 -1
  73. package/dist/src/contracts/indexed-source.d.ts +118 -0
  74. package/dist/src/contracts/indexed-source.d.ts.map +1 -0
  75. package/dist/src/contracts/indexed-source.js +89 -0
  76. package/dist/src/contracts/indexed-source.js.map +1 -0
  77. package/dist/src/contracts/pick.d.ts +0 -16
  78. package/dist/src/contracts/pick.d.ts.map +1 -1
  79. package/dist/src/contracts/review.d.ts +4 -6
  80. package/dist/src/contracts/review.d.ts.map +1 -1
  81. package/dist/src/contracts/review.js +4 -6
  82. package/dist/src/contracts/review.js.map +1 -1
  83. package/dist/src/contracts/source.d.ts +2 -2
  84. package/dist/src/contracts/source.d.ts.map +1 -1
  85. package/dist/src/contracts/source.js.map +1 -1
  86. package/dist/src/contracts/states.d.ts +1 -3
  87. package/dist/src/contracts/states.d.ts.map +1 -1
  88. package/dist/src/contracts/states.js +1 -3
  89. package/dist/src/contracts/states.js.map +1 -1
  90. package/dist/src/display/editable-chip/index.d.ts +2 -0
  91. package/dist/src/display/editable-chip/index.d.ts.map +1 -1
  92. package/dist/src/display/editable-chip/index.js +4 -1
  93. package/dist/src/display/editable-chip/index.js.map +1 -1
  94. package/dist/src/display/icon/index.d.ts +14 -31
  95. package/dist/src/display/icon/index.d.ts.map +1 -1
  96. package/dist/src/display/icon/index.js +15 -19
  97. package/dist/src/display/icon/index.js.map +1 -1
  98. package/dist/src/display/icon/solid.d.ts +24 -0
  99. package/dist/src/display/icon/solid.d.ts.map +1 -0
  100. package/dist/src/display/icon/solid.js +39 -0
  101. package/dist/src/display/icon/solid.js.map +1 -0
  102. package/dist/src/display/icon/types.d.ts +14 -38
  103. package/dist/src/display/icon/types.d.ts.map +1 -1
  104. package/dist/src/display/icon/types.js +6 -15
  105. package/dist/src/display/icon/types.js.map +1 -1
  106. package/dist/src/display/metric-chip/index.d.ts +2 -0
  107. package/dist/src/display/metric-chip/index.d.ts.map +1 -1
  108. package/dist/src/display/metric-chip/index.js +4 -1
  109. package/dist/src/display/metric-chip/index.js.map +1 -1
  110. package/dist/src/display/stat/index.d.ts +2 -0
  111. package/dist/src/display/stat/index.d.ts.map +1 -1
  112. package/dist/src/display/stat/index.js +4 -1
  113. package/dist/src/display/stat/index.js.map +1 -1
  114. package/dist/src/display/stat/types.d.ts +3 -5
  115. package/dist/src/display/stat/types.d.ts.map +1 -1
  116. package/dist/src/display/stat/types.js +5 -2
  117. package/dist/src/display/stat/types.js.map +1 -1
  118. package/dist/src/feedback/banner/index.d.ts +5 -3
  119. package/dist/src/feedback/banner/index.d.ts.map +1 -1
  120. package/dist/src/feedback/banner/index.js +4 -1
  121. package/dist/src/feedback/banner/index.js.map +1 -1
  122. package/dist/src/feedback/empty-state/index.d.ts +16 -19
  123. package/dist/src/feedback/empty-state/index.d.ts.map +1 -1
  124. package/dist/src/feedback/empty-state/index.js +17 -10
  125. package/dist/src/feedback/empty-state/index.js.map +1 -1
  126. package/dist/src/feedback/status/index.d.ts +5 -3
  127. package/dist/src/feedback/status/index.d.ts.map +1 -1
  128. package/dist/src/feedback/status/index.js +4 -1
  129. package/dist/src/feedback/status/index.js.map +1 -1
  130. package/dist/src/index.d.ts +5 -6
  131. package/dist/src/index.d.ts.map +1 -1
  132. package/dist/src/index.js +12 -11
  133. package/dist/src/index.js.map +1 -1
  134. package/dist/src/internal.d.ts +23 -16
  135. package/dist/src/internal.d.ts.map +1 -1
  136. package/dist/src/internal.js +29 -13
  137. package/dist/src/internal.js.map +1 -1
  138. package/dist/src/navigation/index.d.ts +0 -2
  139. package/dist/src/navigation/index.d.ts.map +1 -1
  140. package/dist/src/navigation/index.js +0 -2
  141. package/dist/src/navigation/index.js.map +1 -1
  142. package/dist/src/navigation/nav-list/index.d.ts +2 -0
  143. package/dist/src/navigation/nav-list/index.d.ts.map +1 -1
  144. package/dist/src/navigation/nav-list/index.js +4 -1
  145. package/dist/src/navigation/nav-list/index.js.map +1 -1
  146. package/dist/src/navigation/nav-list/types.d.ts +3 -14
  147. package/dist/src/navigation/nav-list/types.d.ts.map +1 -1
  148. package/dist/src/navigation/nav-list/types.js.map +1 -1
  149. package/dist/src/overlays/command-palette/index.d.ts +2 -0
  150. package/dist/src/overlays/command-palette/index.d.ts.map +1 -1
  151. package/dist/src/overlays/command-palette/index.js +5 -0
  152. package/dist/src/overlays/command-palette/index.js.map +1 -1
  153. package/dist/src/overlays/command-palette/types.d.ts +0 -8
  154. package/dist/src/overlays/command-palette/types.d.ts.map +1 -1
  155. package/dist/src/pick/index.d.ts +1 -17
  156. package/dist/src/pick/index.d.ts.map +1 -1
  157. package/dist/src/pick/index.js +1 -1
  158. package/dist/src/platform/slice/index.d.ts +1324 -2039
  159. package/dist/src/platform/slice/index.d.ts.map +1 -1
  160. package/dist/src/platform/slice/index.js +55 -74
  161. package/dist/src/platform/slice/index.js.map +1 -1
  162. package/dist/src/platform/slice/local.d.ts +743 -0
  163. package/dist/src/platform/slice/local.d.ts.map +1 -0
  164. package/dist/src/platform/slice/local.js +133 -0
  165. package/dist/src/platform/slice/local.js.map +1 -0
  166. package/dist/src/platform/slice/record-chrome.d.ts +211 -0
  167. package/dist/src/platform/slice/record-chrome.d.ts.map +1 -0
  168. package/dist/src/platform/slice/record-chrome.js +52 -0
  169. package/dist/src/platform/slice/record-chrome.js.map +1 -0
  170. package/dist/src/platform/slice/record-interval.d.ts +24 -0
  171. package/dist/src/platform/slice/record-interval.d.ts.map +1 -0
  172. package/dist/src/platform/slice/record-interval.js +61 -0
  173. package/dist/src/platform/slice/record-interval.js.map +1 -0
  174. package/dist/src/platform/slice/record-plan.d.ts +54 -0
  175. package/dist/src/platform/slice/record-plan.d.ts.map +1 -0
  176. package/dist/src/platform/slice/record-plan.js +139 -0
  177. package/dist/src/platform/slice/record-plan.js.map +1 -0
  178. package/dist/src/platform/slice/record-types.d.ts +2739 -0
  179. package/dist/src/platform/slice/record-types.d.ts.map +1 -0
  180. package/dist/src/platform/slice/record-types.js +209 -0
  181. package/dist/src/platform/slice/record-types.js.map +1 -0
  182. package/dist/src/platform/slice/record.d.ts +109 -0
  183. package/dist/src/platform/slice/record.d.ts.map +1 -0
  184. package/dist/src/platform/slice/record.js +210 -0
  185. package/dist/src/platform/slice/record.js.map +1 -0
  186. package/dist/src/reactive/match.d.ts +4 -6
  187. package/dist/src/reactive/match.d.ts.map +1 -1
  188. package/dist/src/reactive/match.js +4 -6
  189. package/dist/src/reactive/match.js.map +1 -1
  190. package/dist/src/runtime/collections/deck.d.ts.map +1 -1
  191. package/dist/src/runtime/collections/index.d.ts +0 -6
  192. package/dist/src/runtime/collections/index.d.ts.map +1 -1
  193. package/dist/src/runtime/collections/index.js +0 -6
  194. package/dist/src/runtime/collections/index.js.map +1 -1
  195. package/dist/src/runtime/display/icon.d.ts +6 -5
  196. package/dist/src/runtime/display/icon.d.ts.map +1 -1
  197. package/dist/src/runtime/display/icon.js +6 -5
  198. package/dist/src/runtime/display/icon.js.map +1 -1
  199. package/dist/src/runtime/feedback/empty-state.d.ts +5 -5
  200. package/dist/src/runtime/feedback/empty-state.js +5 -5
  201. package/dist/src/runtime/layout/dock.d.ts +2 -1
  202. package/dist/src/runtime/layout/dock.d.ts.map +1 -1
  203. package/dist/src/runtime/layout/dock.js +2 -1
  204. package/dist/src/runtime/layout/dock.js.map +1 -1
  205. package/dist/src/runtime/navigation/index.d.ts +0 -3
  206. package/dist/src/runtime/navigation/index.d.ts.map +1 -1
  207. package/dist/src/runtime/navigation/index.js +0 -3
  208. package/dist/src/runtime/navigation/index.js.map +1 -1
  209. package/dist/src/runtime/reactive/match.d.ts +2 -3
  210. package/dist/src/runtime/reactive/match.d.ts.map +1 -1
  211. package/dist/src/runtime/reactive/match.js +2 -3
  212. package/dist/src/runtime/reactive/match.js.map +1 -1
  213. package/dist/src/runtime/record-slice-source.d.ts +78 -0
  214. package/dist/src/runtime/record-slice-source.d.ts.map +1 -0
  215. package/dist/src/runtime/record-slice-source.js +201 -0
  216. package/dist/src/runtime/record-slice-source.js.map +1 -0
  217. package/dist/src/runtime/record-slice.d.ts +110 -0
  218. package/dist/src/runtime/record-slice.d.ts.map +1 -0
  219. package/dist/src/runtime/record-slice.js +374 -0
  220. package/dist/src/runtime/record-slice.js.map +1 -0
  221. package/dist/src/runtime/slice.d.ts +11 -13
  222. package/dist/src/runtime/slice.d.ts.map +1 -1
  223. package/dist/src/runtime/slice.js +41 -93
  224. package/dist/src/runtime/slice.js.map +1 -1
  225. package/dist/src/shared/plot-gutter.d.ts +1 -1
  226. package/dist/src/shared/plot-gutter.js +1 -1
  227. package/dist/src/shared/resolve-tag.d.ts +23 -0
  228. package/dist/src/shared/resolve-tag.d.ts.map +1 -0
  229. package/dist/src/shared/resolve-tag.js +26 -0
  230. package/dist/src/shared/resolve-tag.js.map +1 -0
  231. package/dist/src/shared/tree.d.ts +1 -1
  232. package/dist/src/shared/tree.js +1 -1
  233. package/dist/src/slice/breakdown/index.d.ts +1 -1
  234. package/dist/src/slice/breakdown/index.d.ts.map +1 -1
  235. package/dist/src/slice/breakdown/index.js +3 -3
  236. package/dist/src/slice/breakdown/index.js.map +1 -1
  237. package/dist/src/slice/cohort/index.d.ts +4 -5
  238. package/dist/src/slice/cohort/index.d.ts.map +1 -1
  239. package/dist/src/slice/cohort/index.js +6 -7
  240. package/dist/src/slice/cohort/index.js.map +1 -1
  241. package/dist/src/slice/filter/index.d.ts +1 -1
  242. package/dist/src/slice/filter/index.d.ts.map +1 -1
  243. package/dist/src/slice/filter/index.js +3 -3
  244. package/dist/src/slice/filter/index.js.map +1 -1
  245. package/dist/src/slice/index.d.ts +20 -2230
  246. package/dist/src/slice/index.d.ts.map +1 -1
  247. package/dist/src/slice/legend/index.d.ts +2 -2
  248. package/dist/src/slice/legend/index.d.ts.map +1 -1
  249. package/dist/src/slice/legend/index.js +4 -4
  250. package/dist/src/slice/legend/index.js.map +1 -1
  251. package/dist/src/slice/rail/index.d.ts +7 -4
  252. package/dist/src/slice/rail/index.d.ts.map +1 -1
  253. package/dist/src/slice/rail/index.js +10 -5
  254. package/dist/src/slice/rail/index.js.map +1 -1
  255. package/dist/src/slice/range/index.d.ts +1 -1
  256. package/dist/src/slice/range/index.d.ts.map +1 -1
  257. package/dist/src/slice/range/index.js +3 -3
  258. package/dist/src/slice/range/index.js.map +1 -1
  259. package/dist/src/slice/record/index.d.ts +171 -0
  260. package/dist/src/slice/record/index.d.ts.map +1 -0
  261. package/dist/src/slice/record/index.js +10 -0
  262. package/dist/src/slice/record/index.js.map +1 -0
  263. package/dist/src/slice/search/index.d.ts +6 -6
  264. package/dist/src/slice/search/index.d.ts.map +1 -1
  265. package/dist/src/slice/search/index.js +7 -7
  266. package/dist/src/slice/search/index.js.map +1 -1
  267. package/dist/src/slice/summary/index.d.ts +1 -1
  268. package/dist/src/slice/summary/index.d.ts.map +1 -1
  269. package/dist/src/slice/summary/index.js +3 -3
  270. package/dist/src/slice/summary/index.js.map +1 -1
  271. package/dist/src/typography/list/index.d.ts +2 -8
  272. package/dist/src/typography/list/index.d.ts.map +1 -1
  273. package/dist/src/typography/list/index.js +4 -1
  274. package/dist/src/typography/list/index.js.map +1 -1
  275. package/dist/src/typography/list/types.d.ts +0 -8
  276. package/dist/src/typography/list/types.d.ts.map +1 -1
  277. package/dist/test/collections/deck.examples.d.ts.map +1 -1
  278. package/dist/test/collections/deck.examples.js +6 -7
  279. package/dist/test/collections/deck.examples.js.map +1 -1
  280. package/dist/test/collections/index.d.ts +0 -1
  281. package/dist/test/collections/index.d.ts.map +1 -1
  282. package/dist/test/collections/index.js +0 -1
  283. package/dist/test/collections/index.js.map +1 -1
  284. package/dist/test/collections/library.examples.d.ts.map +1 -1
  285. package/dist/test/collections/library.examples.js +6 -7
  286. package/dist/test/collections/library.examples.js.map +1 -1
  287. package/dist/test/collections/schematic.examples.d.ts.map +1 -1
  288. package/dist/test/collections/schematic.examples.js +11 -19
  289. package/dist/test/collections/schematic.examples.js.map +1 -1
  290. package/dist/test/collections/tree-view.examples.js +2 -2
  291. package/dist/test/contracts/editing.examples.d.ts +1 -0
  292. package/dist/test/contracts/editing.examples.d.ts.map +1 -1
  293. package/dist/test/contracts/editing.examples.js +37 -6
  294. package/dist/test/contracts/editing.examples.js.map +1 -1
  295. package/dist/test/contracts/fields.examples.d.ts +7 -0
  296. package/dist/test/contracts/fields.examples.d.ts.map +1 -0
  297. package/dist/test/contracts/fields.examples.js +42 -0
  298. package/dist/test/contracts/fields.examples.js.map +1 -0
  299. package/dist/test/display/avatar.examples.d.ts.map +1 -1
  300. package/dist/test/display/avatar.examples.js +3 -3
  301. package/dist/test/display/avatar.examples.js.map +1 -1
  302. package/dist/test/display/icon.examples.d.ts.map +1 -1
  303. package/dist/test/display/icon.examples.js +12 -11
  304. package/dist/test/display/icon.examples.js.map +1 -1
  305. package/dist/test/feedback/empty-state.examples.js +9 -9
  306. package/dist/test/feedback/empty-state.examples.js.map +1 -1
  307. package/dist/test/layout/dock.examples.d.ts +0 -8
  308. package/dist/test/layout/dock.examples.d.ts.map +1 -1
  309. package/dist/test/layout/dock.examples.js +2 -42
  310. package/dist/test/layout/dock.examples.js.map +1 -1
  311. package/dist/test/layout/snap-grid.examples.d.ts.map +1 -1
  312. package/dist/test/layout/snap-grid.examples.js +18 -28
  313. package/dist/test/layout/snap-grid.examples.js.map +1 -1
  314. package/dist/test/navigation/index.d.ts +0 -2
  315. package/dist/test/navigation/index.d.ts.map +1 -1
  316. package/dist/test/navigation/index.js +0 -2
  317. package/dist/test/navigation/index.js.map +1 -1
  318. package/dist/test/navigation/nav-list.examples.js.map +1 -1
  319. package/dist/test/platform/index.d.ts +1 -0
  320. package/dist/test/platform/index.d.ts.map +1 -1
  321. package/dist/test/platform/index.js +1 -0
  322. package/dist/test/platform/index.js.map +1 -1
  323. package/dist/test/platform/slice-local.examples.d.ts +2 -0
  324. package/dist/test/platform/slice-local.examples.d.ts.map +1 -0
  325. package/dist/test/platform/slice-local.examples.js +31 -0
  326. package/dist/test/platform/slice-local.examples.js.map +1 -0
  327. package/dist/test/platform/slice.examples.js +61 -61
  328. package/dist/test/platform/slice.examples.js.map +1 -1
  329. package/dist/test/slice/slice.examples.d.ts +0 -1
  330. package/dist/test/slice/slice.examples.d.ts.map +1 -1
  331. package/dist/test/slice/slice.examples.js +67 -181
  332. package/dist/test/slice/slice.examples.js.map +1 -1
  333. package/package.json +4 -4
  334. package/dist/src/collections/board/index.d.ts +0 -855
  335. package/dist/src/collections/board/index.d.ts.map +0 -1
  336. package/dist/src/collections/board/index.js +0 -416
  337. package/dist/src/collections/board/index.js.map +0 -1
  338. package/dist/src/collections/board/types.d.ts +0 -111
  339. package/dist/src/collections/board/types.d.ts.map +0 -1
  340. package/dist/src/collections/board/types.js +0 -89
  341. package/dist/src/collections/board/types.js.map +0 -1
  342. package/dist/src/collections/calendar/index.d.ts +0 -446
  343. package/dist/src/collections/calendar/index.d.ts.map +0 -1
  344. package/dist/src/collections/calendar/index.js +0 -287
  345. package/dist/src/collections/calendar/index.js.map +0 -1
  346. package/dist/src/collections/calendar/types.d.ts +0 -338
  347. package/dist/src/collections/calendar/types.d.ts.map +0 -1
  348. package/dist/src/collections/calendar/types.js +0 -206
  349. package/dist/src/collections/calendar/types.js.map +0 -1
  350. package/dist/src/collections/flowchart/index.d.ts +0 -430
  351. package/dist/src/collections/flowchart/index.d.ts.map +0 -1
  352. package/dist/src/collections/flowchart/index.js +0 -292
  353. package/dist/src/collections/flowchart/index.js.map +0 -1
  354. package/dist/src/collections/flowchart/types.d.ts +0 -333
  355. package/dist/src/collections/flowchart/types.d.ts.map +0 -1
  356. package/dist/src/collections/flowchart/types.js +0 -263
  357. package/dist/src/collections/flowchart/types.js.map +0 -1
  358. package/dist/src/collections/plan/assemble.d.ts +0 -2274
  359. package/dist/src/collections/plan/assemble.d.ts.map +0 -1
  360. package/dist/src/collections/plan/assemble.js +0 -210
  361. package/dist/src/collections/plan/assemble.js.map +0 -1
  362. package/dist/src/collections/plan/builders.d.ts +0 -765
  363. package/dist/src/collections/plan/builders.d.ts.map +0 -1
  364. package/dist/src/collections/plan/builders.js +0 -673
  365. package/dist/src/collections/plan/builders.js.map +0 -1
  366. package/dist/src/collections/plan/factories.d.ts +0 -512
  367. package/dist/src/collections/plan/factories.d.ts.map +0 -1
  368. package/dist/src/collections/plan/factories.js +0 -539
  369. package/dist/src/collections/plan/factories.js.map +0 -1
  370. package/dist/src/collections/plan/index.d.ts +0 -324
  371. package/dist/src/collections/plan/index.d.ts.map +0 -1
  372. package/dist/src/collections/plan/index.js +0 -193
  373. package/dist/src/collections/plan/index.js.map +0 -1
  374. package/dist/src/collections/plan/ir.d.ts +0 -2490
  375. package/dist/src/collections/plan/ir.d.ts.map +0 -1
  376. package/dist/src/collections/plan/ir.js +0 -107
  377. package/dist/src/collections/plan/ir.js.map +0 -1
  378. package/dist/src/collections/plan/pick.d.ts +0 -133
  379. package/dist/src/collections/plan/pick.d.ts.map +0 -1
  380. package/dist/src/collections/plan/pick.js +0 -208
  381. package/dist/src/collections/plan/pick.js.map +0 -1
  382. package/dist/src/collections/plan/root.d.ts +0 -297
  383. package/dist/src/collections/plan/root.d.ts.map +0 -1
  384. package/dist/src/collections/plan/root.js +0 -427
  385. package/dist/src/collections/plan/root.js.map +0 -1
  386. package/dist/src/collections/plan/series.d.ts +0 -13887
  387. package/dist/src/collections/plan/series.d.ts.map +0 -1
  388. package/dist/src/collections/plan/series.js +0 -1710
  389. package/dist/src/collections/plan/series.js.map +0 -1
  390. package/dist/src/collections/plan/types.d.ts +0 -12612
  391. package/dist/src/collections/plan/types.d.ts.map +0 -1
  392. package/dist/src/collections/plan/types.js +0 -1345
  393. package/dist/src/collections/plan/types.js.map +0 -1
  394. package/dist/src/collections/roster/index.d.ts +0 -787
  395. package/dist/src/collections/roster/index.d.ts.map +0 -1
  396. package/dist/src/collections/roster/index.js +0 -325
  397. package/dist/src/collections/roster/index.js.map +0 -1
  398. package/dist/src/collections/roster/types.d.ts +0 -97
  399. package/dist/src/collections/roster/types.d.ts.map +0 -1
  400. package/dist/src/collections/roster/types.js +0 -72
  401. package/dist/src/collections/roster/types.js.map +0 -1
  402. package/dist/src/collections/sheet/bridge.d.ts +0 -376
  403. package/dist/src/collections/sheet/bridge.d.ts.map +0 -1
  404. package/dist/src/collections/sheet/bridge.js +0 -773
  405. package/dist/src/collections/sheet/bridge.js.map +0 -1
  406. package/dist/src/collections/sheet/columns.d.ts +0 -410
  407. package/dist/src/collections/sheet/columns.d.ts.map +0 -1
  408. package/dist/src/collections/sheet/columns.js +0 -99
  409. package/dist/src/collections/sheet/columns.js.map +0 -1
  410. package/dist/src/collections/sheet/context-bridge.d.ts +0 -48
  411. package/dist/src/collections/sheet/context-bridge.d.ts.map +0 -1
  412. package/dist/src/collections/sheet/context-bridge.js +0 -216
  413. package/dist/src/collections/sheet/context-bridge.js.map +0 -1
  414. package/dist/src/collections/sheet/draft-bridge.d.ts +0 -37
  415. package/dist/src/collections/sheet/draft-bridge.d.ts.map +0 -1
  416. package/dist/src/collections/sheet/draft-bridge.js +0 -153
  417. package/dist/src/collections/sheet/draft-bridge.js.map +0 -1
  418. package/dist/src/collections/sheet/drafts.d.ts +0 -14
  419. package/dist/src/collections/sheet/drafts.d.ts.map +0 -1
  420. package/dist/src/collections/sheet/drafts.js +0 -14
  421. package/dist/src/collections/sheet/drafts.js.map +0 -1
  422. package/dist/src/collections/sheet/editing-bridge.d.ts +0 -36
  423. package/dist/src/collections/sheet/editing-bridge.d.ts.map +0 -1
  424. package/dist/src/collections/sheet/editing-bridge.js +0 -196
  425. package/dist/src/collections/sheet/editing-bridge.js.map +0 -1
  426. package/dist/src/collections/sheet/editing-types.d.ts +0 -268
  427. package/dist/src/collections/sheet/editing-types.d.ts.map +0 -1
  428. package/dist/src/collections/sheet/editing-types.js +0 -34
  429. package/dist/src/collections/sheet/editing-types.js.map +0 -1
  430. package/dist/src/collections/sheet/edits.d.ts +0 -37
  431. package/dist/src/collections/sheet/edits.d.ts.map +0 -1
  432. package/dist/src/collections/sheet/edits.js +0 -31
  433. package/dist/src/collections/sheet/edits.js.map +0 -1
  434. package/dist/src/collections/sheet/group.d.ts +0 -165
  435. package/dist/src/collections/sheet/group.d.ts.map +0 -1
  436. package/dist/src/collections/sheet/group.js +0 -52
  437. package/dist/src/collections/sheet/group.js.map +0 -1
  438. package/dist/src/collections/sheet/index.d.ts +0 -351
  439. package/dist/src/collections/sheet/index.d.ts.map +0 -1
  440. package/dist/src/collections/sheet/index.js +0 -208
  441. package/dist/src/collections/sheet/index.js.map +0 -1
  442. package/dist/src/collections/sheet/link.d.ts +0 -398
  443. package/dist/src/collections/sheet/link.d.ts.map +0 -1
  444. package/dist/src/collections/sheet/link.js +0 -228
  445. package/dist/src/collections/sheet/link.js.map +0 -1
  446. package/dist/src/collections/sheet/registers.d.ts +0 -278
  447. package/dist/src/collections/sheet/registers.d.ts.map +0 -1
  448. package/dist/src/collections/sheet/registers.js +0 -268
  449. package/dist/src/collections/sheet/registers.js.map +0 -1
  450. package/dist/src/collections/sheet/root.d.ts +0 -328
  451. package/dist/src/collections/sheet/root.d.ts.map +0 -1
  452. package/dist/src/collections/sheet/root.js +0 -432
  453. package/dist/src/collections/sheet/root.js.map +0 -1
  454. package/dist/src/collections/sheet/seed-bridge.d.ts +0 -14
  455. package/dist/src/collections/sheet/seed-bridge.d.ts.map +0 -1
  456. package/dist/src/collections/sheet/seed-bridge.js +0 -51
  457. package/dist/src/collections/sheet/seed-bridge.js.map +0 -1
  458. package/dist/src/collections/sheet/sub-rows.d.ts +0 -249
  459. package/dist/src/collections/sheet/sub-rows.d.ts.map +0 -1
  460. package/dist/src/collections/sheet/sub-rows.js +0 -222
  461. package/dist/src/collections/sheet/sub-rows.js.map +0 -1
  462. package/dist/src/collections/sheet/transactions.d.ts +0 -76
  463. package/dist/src/collections/sheet/transactions.d.ts.map +0 -1
  464. package/dist/src/collections/sheet/transactions.js +0 -40
  465. package/dist/src/collections/sheet/transactions.js.map +0 -1
  466. package/dist/src/collections/sheet/types.d.ts +0 -14992
  467. package/dist/src/collections/sheet/types.d.ts.map +0 -1
  468. package/dist/src/collections/sheet/types.js +0 -1061
  469. package/dist/src/collections/sheet/types.js.map +0 -1
  470. package/dist/src/navigation/app/index.d.ts +0 -150
  471. package/dist/src/navigation/app/index.d.ts.map +0 -1
  472. package/dist/src/navigation/app/index.js +0 -191
  473. package/dist/src/navigation/app/index.js.map +0 -1
  474. package/dist/src/navigation/pages/index.d.ts +0 -165
  475. package/dist/src/navigation/pages/index.d.ts.map +0 -1
  476. package/dist/src/navigation/pages/index.js +0 -152
  477. package/dist/src/navigation/pages/index.js.map +0 -1
  478. package/dist/src/navigation/pages/types.d.ts +0 -111
  479. package/dist/src/navigation/pages/types.d.ts.map +0 -1
  480. package/dist/src/navigation/pages/types.js +0 -101
  481. package/dist/src/navigation/pages/types.js.map +0 -1
  482. package/dist/src/runtime/collections/board.d.ts +0 -73
  483. package/dist/src/runtime/collections/board.d.ts.map +0 -1
  484. package/dist/src/runtime/collections/board.js +0 -68
  485. package/dist/src/runtime/collections/board.js.map +0 -1
  486. package/dist/src/runtime/collections/calendar.d.ts +0 -54
  487. package/dist/src/runtime/collections/calendar.d.ts.map +0 -1
  488. package/dist/src/runtime/collections/calendar.js +0 -54
  489. package/dist/src/runtime/collections/calendar.js.map +0 -1
  490. package/dist/src/runtime/collections/flowchart.d.ts +0 -58
  491. package/dist/src/runtime/collections/flowchart.d.ts.map +0 -1
  492. package/dist/src/runtime/collections/flowchart.js +0 -54
  493. package/dist/src/runtime/collections/flowchart.js.map +0 -1
  494. package/dist/src/runtime/collections/plan.d.ts +0 -181
  495. package/dist/src/runtime/collections/plan.d.ts.map +0 -1
  496. package/dist/src/runtime/collections/plan.js +0 -186
  497. package/dist/src/runtime/collections/plan.js.map +0 -1
  498. package/dist/src/runtime/collections/roster.d.ts +0 -60
  499. package/dist/src/runtime/collections/roster.d.ts.map +0 -1
  500. package/dist/src/runtime/collections/roster.js +0 -59
  501. package/dist/src/runtime/collections/roster.js.map +0 -1
  502. package/dist/src/runtime/collections/sheet.d.ts +0 -122
  503. package/dist/src/runtime/collections/sheet.d.ts.map +0 -1
  504. package/dist/src/runtime/collections/sheet.js +0 -73
  505. package/dist/src/runtime/collections/sheet.js.map +0 -1
  506. package/dist/src/runtime/navigation/app.d.ts +0 -52
  507. package/dist/src/runtime/navigation/app.d.ts.map +0 -1
  508. package/dist/src/runtime/navigation/app.js +0 -53
  509. package/dist/src/runtime/navigation/app.js.map +0 -1
  510. package/dist/src/runtime/navigation/pages.d.ts +0 -50
  511. package/dist/src/runtime/navigation/pages.d.ts.map +0 -1
  512. package/dist/src/runtime/navigation/pages.js +0 -52
  513. package/dist/src/runtime/navigation/pages.js.map +0 -1
  514. package/dist/src/runtime/navigation/route.d.ts +0 -46
  515. package/dist/src/runtime/navigation/route.d.ts.map +0 -1
  516. package/dist/src/runtime/navigation/route.js +0 -47
  517. package/dist/src/runtime/navigation/route.js.map +0 -1
  518. package/dist/test/collections/board.examples.d.ts +0 -18
  519. package/dist/test/collections/board.examples.d.ts.map +0 -1
  520. package/dist/test/collections/board.examples.js +0 -297
  521. package/dist/test/collections/board.examples.js.map +0 -1
  522. package/dist/test/collections/calendar.examples.d.ts +0 -5
  523. package/dist/test/collections/calendar.examples.d.ts.map +0 -1
  524. package/dist/test/collections/calendar.examples.js +0 -147
  525. package/dist/test/collections/calendar.examples.js.map +0 -1
  526. package/dist/test/collections/flowchart.examples.d.ts +0 -17
  527. package/dist/test/collections/flowchart.examples.d.ts.map +0 -1
  528. package/dist/test/collections/flowchart.examples.js +0 -243
  529. package/dist/test/collections/flowchart.examples.js.map +0 -1
  530. package/dist/test/collections/plan.examples.d.ts +0 -200
  531. package/dist/test/collections/plan.examples.d.ts.map +0 -1
  532. package/dist/test/collections/plan.examples.js +0 -3665
  533. package/dist/test/collections/plan.examples.js.map +0 -1
  534. package/dist/test/collections/roster.examples.d.ts +0 -26
  535. package/dist/test/collections/roster.examples.d.ts.map +0 -1
  536. package/dist/test/collections/roster.examples.js +0 -237
  537. package/dist/test/collections/roster.examples.js.map +0 -1
  538. package/dist/test/collections/sheet-link.examples.d.ts +0 -7
  539. package/dist/test/collections/sheet-link.examples.d.ts.map +0 -1
  540. package/dist/test/collections/sheet-link.examples.js +0 -41
  541. package/dist/test/collections/sheet-link.examples.js.map +0 -1
  542. package/dist/test/collections/sheet-transactions.examples.d.ts +0 -7
  543. package/dist/test/collections/sheet-transactions.examples.d.ts.map +0 -1
  544. package/dist/test/collections/sheet-transactions.examples.js +0 -58
  545. package/dist/test/collections/sheet-transactions.examples.js.map +0 -1
  546. package/dist/test/collections/sheet.examples.d.ts +0 -96
  547. package/dist/test/collections/sheet.examples.d.ts.map +0 -1
  548. package/dist/test/collections/sheet.examples.js +0 -1040
  549. package/dist/test/collections/sheet.examples.js.map +0 -1
  550. package/dist/test/navigation/app.examples.d.ts +0 -22
  551. package/dist/test/navigation/app.examples.d.ts.map +0 -1
  552. package/dist/test/navigation/app.examples.js +0 -136
  553. package/dist/test/navigation/app.examples.js.map +0 -1
  554. package/dist/test/navigation/pages.examples.d.ts +0 -13
  555. package/dist/test/navigation/pages.examples.d.ts.map +0 -1
  556. package/dist/test/navigation/pages.examples.js +0 -113
  557. package/dist/test/navigation/pages.examples.js.map +0 -1
  558. package/dist/test/navigation/route.examples.d.ts +0 -13
  559. package/dist/test/navigation/route.examples.d.ts.map +0 -1
  560. package/dist/test/navigation/route.examples.js +0 -69
  561. package/dist/test/navigation/route.examples.js.map +0 -1
@@ -1,1040 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@elaraai/east-ui/jsx-runtime";
2
- /**
3
- * Copyright (c) 2025 Elara AI Pty Ltd
4
- * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
5
- */
6
- /** @jsxImportSource @elaraai/east-ui */
7
- import { East, ArrayType, BooleanType, DateTimeType, DictType, FloatType, IntegerType, NullType, OptionType, StringType, StructType, VariantType, example, none, some, variant, } from "@elaraai/east";
8
- import { Badge, Box, Configurator, Format, HStack, Input, Reactive, SegmentGroup, Sheet, Slice, State, Status, Style, Switch, Text, UIComponentType, VStack, } from "@elaraai/east-ui";
9
- // ============================================================================
10
- // The Sheet corpus — the five slots of EXAMPLES_AUTHORING.md §8 (Sheet Spec.md §8 P1):
11
- // `sheetBasic` · `sheetVariants` (THE configurator) · `sheetPlan` (the flagship)
12
- // · the behavioural isolates `sheetCopilot` / `sheetLens` / `sheetWriteBack` /
13
- // `sheetGrouped` / `sheetReadiness` / `sheetInsertion` /
14
- // `sheetSubRows` / `sheetRules` / `sheetRegisters` / `sheetLoose` · `sheetStress`. The paged
15
- // sheet is bound — `dataBindPagedSheet` in @elaraai/e3-ui. Every example is self-contained — types,
16
- // fixtures and constructors inside the body, bulk data derived East-side —
17
- // and the fixtures are the prototype's synthetic registers and rows: a
18
- // discrete manufacturing plant (machines on lines, work orders moving parts
19
- // between them), no customer, site or product names.
20
- // ============================================================================
21
- // The one thing at module scope: a platform declaration the async proposer
22
- // of `sheetCopilot` / `sheetPlan` awaits. The row and context types it is
23
- // typed over must be declared beside it, so they are declared once here and
24
- // re-declared inside the example bodies that use them (the examples rule).
25
- const PLAN_ROW_TYPE = StructType({
26
- id: StringType, start: OptionType(DateTimeType), end: OptionType(DateTimeType), activity: StringType,
27
- qty: OptionType(FloatType), notes: StringType, stations: Sheet.Types.Link, setups: OptionType(IntegerType),
28
- fromSite: StringType, toSite: StringType, orderCode: StringType, status: StringType,
29
- });
30
- const ACTIVITY_TYPE = StructType({
31
- name: StringType, uom: StringType, rate: FloatType, fte: IntegerType, days: IntegerType, sides: Sheet.Types.Sides,
32
- });
33
- /** The model behind an async proposer — an e3 function, a service, a notebook; the Sheet only needs the types. */
34
- const planRecommend = East.asyncPlatform("sheet_plan_recommend", [Sheet.Types.DraftContext(PLAN_ROW_TYPE, ACTIVITY_TYPE)], ArrayType(Sheet.Types.Proposal(PLAN_ROW_TYPE)), { optional: true });
35
- /**
36
- * The smallest sheet (§3.1) — three typed columns over the host's structs,
37
- * `onUpdate` receiving the whole collection with the edit applied (the
38
- * `ValueTree` idiom), so a `State.bind` is the entire persistence story.
39
- */
40
- export const sheetBasic = example({
41
- keywords: ["Sheet", "Root", "basic", "column", "date", "text", "quantity", "onUpdate", "State", "Reactive", "id"],
42
- description: "The smallest sheet — three typed columns over the host's structs, draft changes reviewed together and the whole collection written once on Apply",
43
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
44
- const JobType = StructType({
45
- id: StringType,
46
- start: OptionType(DateTimeType), // none = blank cell
47
- task: StringType, // "" = blank cell
48
- qty: OptionType(FloatType),
49
- });
50
- const jobs = $.let(State.bind([ArrayType(JobType)], "sheet_basic_jobs", [
51
- { id: "j1", start: none, task: "Machining", qty: none },
52
- ]));
53
- return (_jsx(Sheet, { data: jobs, id: "id", columns: {
54
- start: Sheet.column.date(JobType, { header: "Start", sub: "dd / mm / yyyy" }),
55
- task: Sheet.column.text(JobType, { header: "Task" }),
56
- qty: Sheet.column.quantity(JobType, { header: "Qty" }), // no driver on this sheet — the two-argument form
57
- }, onUpdate: jobs.write }));
58
- } }))),
59
- inputs: [],
60
- });
61
- /**
62
- * THE Sheet configurator — ONE live sheet; every axis is an expression-fed
63
- * prop on that single instance: density, the blank tail, read-only, the size
64
- * mode (auto / scroll / fill) and the copilot switch (a fill provider that
65
- * reads the switch through its captured bind handle). Selection and edits
66
- * log to the reactive aside.
67
- */
68
- export const sheetVariants = example({
69
- keywords: ["Sheet", "Root", "configurator", "density", "blanks", "readOnly", "height", "fill", "scroll", "#320", "copilot", "fill", "provider", "onSelect", "onPatch", "Configurator", "SegmentGroup", "Switch", "Input", "Reactive", "State"],
70
- description: "Sheet configurator — density, the blank tail, read-only, size mode (auto / scroll / fill) and the copilot switch all expression-fed into one live sheet; selection and edits log to the aside",
71
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
72
- const JobType = StructType({ id: StringType, start: OptionType(DateTimeType), task: StringType, qty: OptionType(FloatType), notes: StringType });
73
- const Ctx = Sheet.Types.DraftContext(JobType);
74
- const rows = $.let(State.bind([ArrayType(JobType)], "sheet_variants_rows", [
75
- { id: "j1", start: some(new Date("2026-02-16T00:00:00Z")), task: "Machining", qty: some(1200.0), notes: "Rough the P-40 blanks" },
76
- { id: "j2", start: some(new Date("2026-03-09T00:00:00Z")), task: "Painting", qty: some(250.0), notes: "" },
77
- { id: "j3", start: none, task: "Packaging", qty: none, notes: "" },
78
- ]));
79
- const densities = $.const([
80
- variant("condensed", null), variant("compact", null), variant("comfortable", null),
81
- ], ArrayType(Style.Types.Density));
82
- const sizeModes = $.const(["auto", "scroll", "fill"], ArrayType(StringType));
83
- const densityBind = $.let(State.bind([StringType], "sheet_variants_density", "compact"));
84
- const blanksBind = $.let(State.bind([IntegerType], "sheet_variants_blanks", 18n));
85
- const readOnlyBind = $.let(State.bind([BooleanType], "sheet_variants_readonly", false));
86
- const sizeBind = $.let(State.bind([StringType], "sheet_variants_size", "scroll"));
87
- const copilotBind = $.let(State.bind([BooleanType], "sheet_variants_copilot", true));
88
- const lastEventBind = $.let(State.bind([StringType], "sheet_variants_last_event", ""));
89
- const dKey = $.let(densityBind.read());
90
- const blanks = $.let(blanksBind.read());
91
- const readOnly = $.let(readOnlyBind.read());
92
- const sKey = $.let(sizeBind.read());
93
- const copilotOn = $.let(copilotBind.read());
94
- const lastEvent = $.let(lastEventBind.read());
95
- const onDensity = $.const(East.function([StringType], NullType, ($, next) => { $(densityBind.write(next)); }));
96
- const onBlanks = $.const(East.function([IntegerType], NullType, ($, next) => { $(blanksBind.write(next)); }));
97
- const onReadOnly = $.const(East.function([BooleanType], NullType, ($, next) => { $(readOnlyBind.write(next)); }));
98
- const onSize = $.const(East.function([StringType], NullType, ($, next) => { $(sizeBind.write(next)); }));
99
- const onCopilot = $.const(East.function([BooleanType], NullType, ($, next) => { $(copilotBind.write(next)); }));
100
- // The copilot axis — a fill that reads the switch through the
101
- // captured bind handle, so the one instance keeps its providers.
102
- const NoteFill = OptionType(Sheet.Types.Fill(StringType));
103
- const phrase = $.const(East.function([Ctx], NoteFill, ($, ctx) => {
104
- const noFill = $.const(none, NoteFill);
105
- return ctx.row.task.match({ value: (_$, task) => copilotBind.read().and(() => task.length().greater(0n)).ifElse(() => some({ value: East.str `${task} as planned`, meta: "phrasing from the supplied task" }), () => noFill),
106
- }, () => noFill);
107
- }));
108
- const onSelect = $.const(East.function([Sheet.Types.Selection], NullType, ($, sel) => {
109
- $(lastEventBind.write(East.str `onSelect: row ${sel.rowId.match({ some: (_$, id) => id, none: (_$) => "—" })} · ${sel.key.match({ some: (_$, k) => k, none: (_$) => "—" })}`));
110
- }));
111
- const onPatch = $.const(East.function([Sheet.Types.PatchEvent(JobType)], NullType, ($, e) => {
112
- $(lastEventBind.write(East.str `${e.origin.getTag()} · ${e.draftChanges.length()} entries · ${e.readiness.getTag()}`));
113
- }));
114
- const densitySel = $.let(densities.filter((_$, v) => v.getTag().equal(dKey)).get(0n));
115
- // Size mode — an empty height reads as unbounded, so ONE sheet
116
- // covers auto / scroll / fill; the wrapper Box bounds fill mode only.
117
- const boxHeight = $.let(sKey.equal("fill").ifElse((_$) => "320px", (_$) => ""));
118
- const sheetHeight = $.let(sKey.equal("scroll").ifElse((_$) => "360px", (_$) => sKey.equal("fill").ifElse((_$) => "fill", (_$) => "")));
119
- return (_jsx(Configurator, { controls: [
120
- Configurator.Control("Density", dKey, _jsx(SegmentGroup, { value: dKey, onChange: onDensity, size: "sm", items: densities.map((_$, v) => SegmentGroup.Item(v.getTag(), _jsx(Text, { children: v.getTag().upperCase() }))) })),
121
- Configurator.Control("Size", sKey, _jsx(SegmentGroup, { value: sKey, onChange: onSize, size: "sm", items: sizeModes.map((_$, m) => SegmentGroup.Item(m, _jsx(Text, { children: m.upperCase() }))) })),
122
- Configurator.Control("Blank tail", East.print(blanks), _jsx(Input.Integer, { value: blanks, min: 0n, max: 40n, step: 2n, size: "sm", onChange: onBlanks })),
123
- Configurator.Slot("Chrome", _jsxs(HStack, { gap: "5", align: "center", wrap: "wrap", children: [_jsx(Switch, { checked: readOnly, label: "Read-only", onChange: onReadOnly }), _jsx(Switch, { checked: copilotOn, label: "Copilot", onChange: onCopilot })] })),
124
- ], preview: _jsx(Box, { width: "100%", height: boxHeight, overflow: "hidden", children: _jsx(Sheet, { data: rows, id: "id", columns: {
125
- start: Sheet.column.date(JobType, { header: "Start", sub: "dd / mm / yyyy", width: "96px" }),
126
- task: Sheet.column.text(JobType, { header: "Task", width: "180px" }),
127
- qty: Sheet.column.quantity(JobType, { header: "Qty", sub: "1,200 · pcs", width: "112px", format: Format.Number({ maximumFractionDigits: 0n }) }),
128
- notes: Sheet.column.text(JobType, { header: "Notes", sub: "free text", fill: [phrase] }),
129
- }, density: densitySel, blanks: blanks, readOnly: readOnly, onSelect: onSelect, onPatch: onPatch, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "" })), onUpdate: rows.write, style: { height: sheetHeight } }) }), aside: {
130
- label: "Events · Reactive",
131
- body: (_jsx(Badge, { colorPalette: "brand", variant: "outline", children: East.equal(lastEvent.length(), 0n).ifElse((_$) => "Interact with the sheet", (_$) => lastEvent) })),
132
- }, spec: [
133
- Configurator.Spec("Copilot", copilotOn.ifElse((_$) => "on · notes phrase", (_$) => "off")),
134
- Configurator.Spec("Rows", East.str `${rows.read().length()} real`),
135
- ] }));
136
- } }))),
137
- inputs: [],
138
- });
139
- /**
140
- * The flagship (§3.11) — every column kind, three registers and a driver,
141
- * the copilot's fills and proposers as author functions, the slice lens with
142
- * saved views, a footer, and `onUpdate` write-back, on one sheet.
143
- */
144
- export const sheetPlan = example({
145
- keywords: ["Sheet", "Root", "plan", "flagship", "driver", "register", "lookup", "reference", "enum", "link", "stamped", "quantity", "uom", "sides", "arity", "check", "fill", "propose", "suggest", "asyncFunction", "asyncPlatform", "slice", "search", "filter", "lens", "views", "text", "Sheet.link.print", "footer", "owned", "onUpdate", "Reactive", "State"],
146
- description: "The flagship production plan — every column kind over one raw source, registers and a driver, the copilot's fills and proposers as author functions (one async), the slice lens with saved views, a footer and whole-collection write-back",
147
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
148
- const PlanRowType = StructType({
149
- id: StringType, start: OptionType(DateTimeType), end: OptionType(DateTimeType), activity: StringType,
150
- qty: OptionType(FloatType), notes: StringType, stations: Sheet.Types.Link, setups: OptionType(IntegerType),
151
- fromSite: StringType, toSite: StringType, orderCode: StringType, status: StringType,
152
- });
153
- const ActivityType = StructType({ name: StringType, uom: StringType, rate: FloatType, fte: IntegerType, days: IntegerType, sides: Sheet.Types.Sides });
154
- const MachineType = StructType({ code: StringType, family: StringType, line: StringType, site: StringType });
155
- const LineType = StructType({ code: StringType, name: StringType, machines: IntegerType, aliases: ArrayType(StringType) });
156
- const FamilyType = StructType({ name: StringType, aliases: ArrayType(StringType) });
157
- const StatusType = StructType({ word: StringType, tone: Status.Types.Value });
158
- const Ctx = Sheet.Types.DraftContext(PlanRowType, ActivityType);
159
- const Proposals = ArrayType(Sheet.Types.Proposal(PlanRowType));
160
- // The synthetic registers — a discrete manufacturing plant: machines on
161
- // lines, work orders moving parts between them.
162
- const activities = $.const([
163
- { name: "Machining", uom: "pcs", rate: 60.0, fte: 2n, days: 4n, sides: variant("both", null) },
164
- { name: "Machining - Roughing", uom: "pcs", rate: 80.0, fte: 2n, days: 4n, sides: variant("both", null) },
165
- { name: "Assembly", uom: "units", rate: 30.0, fte: 3n, days: 4n, sides: variant("both", null) },
166
- { name: "Sub-assembly", uom: "units", rate: 45.0, fte: 2n, days: 4n, sides: variant("both", null) },
167
- { name: "Painting", uom: "pcs", rate: 50.0, fte: 3n, days: 4n, sides: variant("both", null) },
168
- { name: "Painting - Primer", uom: "pcs", rate: 70.0, fte: 2n, days: 4n, sides: variant("both", null) },
169
- { name: "Packaging", uom: "cartons", rate: 120.0, fte: 1n, days: 3n, sides: variant("both", null) },
170
- { name: "Deburring", uom: "pcs", rate: 90.0, fte: 1n, days: 3n, sides: variant("both", null) },
171
- { name: "Heat treatment", uom: "pcs", rate: 40.0, fte: 2n, days: 3n, sides: variant("both", null) },
172
- { name: "Rework", uom: "pcs", rate: 20.0, fte: 2n, days: 3n, sides: variant("in", null) },
173
- { name: "Inspection", uom: "lots", rate: 4.0, fte: 2n, days: 4n, sides: variant("in", null) },
174
- { name: "Calibration", uom: "machines", rate: 2.0, fte: 2n, days: 4n, sides: variant("in", null) },
175
- { name: "Changeover", uom: "h", rate: 1.0, fte: 1n, days: 1n, sides: variant("in", null) },
176
- { name: "Receiving", uom: "pallets", rate: 20.0, fte: 1n, days: 1n, sides: variant("to", null) },
177
- { name: "Shipping", uom: "pallets", rate: 20.0, fte: 1n, days: 1n, sides: variant("from", null) },
178
- { name: "Maintenance", uom: "h", rate: 1.0, fte: 1n, days: 1n, sides: variant("in", null) },
179
- ], ArrayType(ActivityType));
180
- const machines = $.const([
181
- { code: "M1104", family: "120 t press", line: "Line 1", site: "North plant" }, { code: "M1120", family: "120 t press", line: "Line 1", site: "North plant" },
182
- { code: "M2140", family: "CNC lathe", line: "Line 2", site: "South plant" }, { code: "M2141", family: "CNC lathe", line: "Line 2", site: "South plant" },
183
- { code: "M2142", family: "CNC lathe", line: "Line 2", site: "South plant" }, { code: "M2145", family: "CNC lathe", line: "Line 2", site: "South plant" },
184
- { code: "M2150", family: "CNC lathe", line: "Line 2", site: "South plant" }, { code: "M2151", family: "CNC lathe", line: "Line 2", site: "South plant" },
185
- { code: "M2160", family: "CNC lathe", line: "Line 2", site: "South plant" }, { code: "M2162", family: "CNC lathe", line: "Line 2", site: "South plant" },
186
- { code: "M3210", family: "5-axis mill", line: "Line 3", site: "North plant" }, { code: "M3215", family: "5-axis mill", line: "Line 3", site: "North plant" },
187
- { code: "M5010", family: "gantry mill", line: "Line 5", site: "East plant" }, { code: "M5011", family: "gantry mill", line: "Line 5", site: "East plant" },
188
- { code: "M7301", family: "assembly bench", line: "Line 7", site: "North plant" }, { code: "M7302", family: "assembly bench", line: "Line 7", site: "North plant" },
189
- { code: "M7305", family: "assembly bench", line: "Line 7", site: "North plant" }, { code: "M7310", family: "assembly bench", line: "Line 7", site: "West plant" },
190
- { code: "M7311", family: "assembly bench", line: "Line 7", site: "West plant" }, { code: "M7320", family: "assembly bench", line: "Line 7", site: "West plant" },
191
- { code: "M7322", family: "assembly bench", line: "Line 7", site: "West plant" }, { code: "M8001", family: "test rig", line: "Line 8", site: "East plant" },
192
- ], ArrayType(MachineType));
193
- const lines = $.const([
194
- { code: "L2", name: "Line 2", machines: 96n, aliases: ["line 2", "l2", "the 2 line"] },
195
- { code: "L1", name: "Line 1", machines: 24n, aliases: ["line 1", "l1"] },
196
- { code: "L3", name: "Line 3", machines: 40n, aliases: ["line 3", "l3"] },
197
- { code: "L5", name: "Line 5", machines: 18n, aliases: ["line 5", "l5"] },
198
- { code: "L7", name: "Line 7", machines: 72n, aliases: ["line 7", "l7"] },
199
- { code: "L8", name: "Line 8", machines: 12n, aliases: ["line 8", "l8"] },
200
- { code: "CA", name: "Cell A", machines: 150n, aliases: ["cell a", "a cell", "the a cell"] },
201
- { code: "GIN", name: "Goods in", machines: 36n, aliases: ["goods in", "inbound"] },
202
- { code: "FH1", name: "Finishing hall", machines: 64n, aliases: ["finishing", "finishing hall"] },
203
- { code: "PKL", name: "Pack line", machines: 20n, aliases: ["pack", "packing"] },
204
- { code: "TB", name: "Test bay", machines: 9n, aliases: ["test bay", "the test bay", "bay"] },
205
- ], ArrayType(LineType));
206
- // A countable-by-attribute kind: the machine family — a count of a kind, resolved to machines later.
207
- const families = $.const([
208
- { name: "CNC lathe", aliases: ["lathe", "lathes", "cnc"] },
209
- { name: "5-axis mill", aliases: ["mill", "mills", "5 axis", "5axis"] },
210
- { name: "120 t press", aliases: ["press", "presses", "120t", "120 t"] },
211
- { name: "assembly bench", aliases: ["bench", "benches"] },
212
- { name: "gantry mill", aliases: ["gantry"] },
213
- { name: "test rig", aliases: ["rig", "rigs"] },
214
- ], ArrayType(FamilyType));
215
- const sites = $.const(["North plant", "South plant", "East plant", "West plant", "Central store", "River depot", "Harbour bay", "Hill site"], ArrayType(StringType));
216
- const statuses = $.const([
217
- { word: "PLANNED", tone: variant("neutral", null) }, { word: "RELEASED", tone: variant("info", null) },
218
- { word: "IN PROGRESS", tone: variant("warning", null) }, { word: "COMPLETE", tone: variant("success", null) },
219
- { word: "CANCELLED", tone: variant("danger", null) },
220
- ], ArrayType(StatusType));
221
- const machineSites = $.const(machines.toDict((_$, m) => m.code, (_$, m) => m.site), DictType(StringType, StringType));
222
- // The plan rows — the prototype's seed, as typed data: a Link is a value, never a string.
223
- const plan = $.let(State.bind([ArrayType(PlanRowType)], "sheet_plan_rows", [
224
- { id: "1", start: some(new Date("2026-02-16T00:00:00Z")), end: some(new Date("2026-02-20T00:00:00Z")), activity: "Machining - Roughing", qty: some(1200.0), notes: "Rough 1,200 P-40 blanks on 4 lathes for the Q3 build", stations: { from: [], to: [variant("identified", { key: "M2140" }), variant("identified", { key: "M2141" }), variant("identified", { key: "M2145" }), variant("identified", { key: "M2150" })] }, setups: some(4n), fromSite: "", toSite: "South plant", orderCode: "WO-26001", status: "RELEASED" },
225
- { id: "2", start: some(new Date("2026-02-16T00:00:00Z")), end: some(new Date("2026-02-20T00:00:00Z")), activity: "Inspection", qty: some(4.0), notes: "Inspect the 4 roughing lots at the south plant", stations: { from: [], to: [variant("counted", { n: 4n, key: "CNC lathe" })] }, setups: none, fromSite: "", toSite: "", orderCode: "WO-26002", status: "RELEASED" },
226
- { id: "3", start: some(new Date("2026-03-09T00:00:00Z")), end: some(new Date("2026-03-13T00:00:00Z")), activity: "Assembly", qty: some(280.0), notes: "Assemble 280 units on line 7", stations: { from: [variant("identified", { key: "M2151" }), variant("identified", { key: "M2160" })], to: [variant("identified", { key: "M7301" }), variant("identified", { key: "M7302" })] }, setups: none, fromSite: "South plant", toSite: "North plant", orderCode: "WO-26003", status: "RELEASED" },
227
- { id: "4", start: some(new Date("2026-04-20T00:00:00Z")), end: some(new Date("2026-04-24T00:00:00Z")), activity: "Rework", qty: some(96.0), notes: "Rework 96 rejected housings", stations: { from: [], to: [variant("placeholder", null)] }, setups: none, fromSite: "", toSite: "", orderCode: "WO-26005", status: "RELEASED" },
228
- { id: "5", start: some(new Date("2026-06-22T00:00:00Z")), end: some(new Date("2026-06-26T00:00:00Z")), activity: "Sub-assembly", qty: some(180.0), notes: "sub-assemble at cell A", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "RELEASED" },
229
- { id: "6", start: some(new Date("2026-06-29T00:00:00Z")), end: some(new Date("2026-07-03T00:00:00Z")), activity: "Sub-assembly", qty: some(180.0), notes: "Sub-assemble the second lot", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "RELEASED" },
230
- { id: "7", start: some(new Date("2026-07-06T00:00:00Z")), end: some(new Date("2026-07-10T00:00:00Z")), activity: "Machining - Roughing", qty: some(1600.0), notes: "1,600 P-40 blanks", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "RELEASED" },
231
- { id: "8", start: some(new Date("2026-07-13T00:00:00Z")), end: some(new Date("2026-07-17T00:00:00Z")), activity: "Machining", qty: some(1600.0), notes: "Finish 1,600 P-40 blanks", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "RELEASED" },
232
- { id: "9", start: some(new Date("2026-07-13T00:00:00Z")), end: some(new Date("2026-07-17T00:00:00Z")), activity: "Painting", qty: some(250.0), notes: "paint 250 P-40 housings", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "CANCELLED" },
233
- { id: "10", start: some(new Date("2026-09-07T00:00:00Z")), end: some(new Date("2026-09-11T00:00:00Z")), activity: "Painting", qty: some(180.0), notes: "paint the sub-assemblies next week", stations: { from: [variant("identified", { key: "M1104" })], to: [variant("identified", { key: "Test bay" })] }, setups: none, fromSite: "North plant", toSite: "", orderCode: "WO-26008", status: "RELEASED" },
234
- { id: "11", start: some(new Date("2026-09-07T00:00:00Z")), end: some(new Date("2026-09-11T00:00:00Z")), activity: "Painting", qty: some(140.0), notes: "paint 140 housings", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "" },
235
- ]));
236
- const views = $.let(State.bind([ArrayType(Sheet.Types.View)], "sheet_plan_views", []));
237
- const rows = $.let(plan.read());
238
- // The slice — search runs THROUGH it; the sheet draws the narrowing as a lens (§3.8).
239
- // A Link is searched by its display form (`M2140 > 4 x CNC lathe`), never its `.east` text.
240
- const cfg = $.const(Slice.config(PlanRowType, {
241
- fields: { activity: { label: "Activity" }, notes: { label: "Notes" }, status: { label: "Status" },
242
- stations: { label: "Work centres", text: r => Sheet.link.print(r.stations) } },
243
- searchFieldIds: ["activity", "notes", "stations"],
244
- }));
245
- const slice = $.let(Slice.bind([PlanRowType], "sheet_plan_slice", cfg, Slice.state(), rows, none));
246
- // The arity rule (§3.4) — how many machines the To half should hold, from the quantity.
247
- const impliedStations = $.const(East.function([Ctx], OptionType(Sheet.Types.Counted), ($, ctx) => {
248
- const noCount = $.const(none, OptionType(Sheet.Types.Counted));
249
- $.if(ctx.row.qty.hasTag("value").not(), ($) => { $.return(noCount); });
250
- const supplied = $.const(ctx.row.qty.unwrap("value"));
251
- $.if(supplied.hasTag("some").not(), ($) => { $.return(noCount); });
252
- const qty = $.const(supplied.unwrap("some"));
253
- const piecesPerMachine = $.const(300.0);
254
- // ⌈qty ÷ 300⌉ and round(qty) by hand — `toInteger` refuses a fraction.
255
- const share = $.let(qty.divide(piecesPerMachine));
256
- const frac = $.let(share.remainder(1.0));
257
- const needed = $.let(frac.equal(0.0).ifElse((_$) => share, (_$) => share.subtract(frac).add(1.0)).toInteger());
258
- const half = $.let(qty.add(0.5));
259
- const whole = $.let(half.subtract(half.remainder(1.0)).toInteger());
260
- return ctx.driver.match({
261
- none: (_$) => noCount,
262
- some: (_$, d) => d.uom.equal("lots").ifElse((_$2) => East.value(some({ n: whole, key: "CNC lathe" }), OptionType(Sheet.Types.Counted)), // one lot per machine
263
- (_$2) => d.uom.equal("pcs").or(() => d.uom.equal("units")).ifElse((_$3) => qty.greater(0.0).ifElse((_$4) => East.value(some({ n: needed, key: "CNC lathe" }), OptionType(Sheet.Types.Counted)), (_$4) => noCount), (_$3) => noCount)), // hours, cartons, pallets name no machines
264
- });
265
- }));
266
- // A member check — a machine named on a half must sit at that half's site.
267
- const CheckCtx = Sheet.Types.CheckContext(PlanRowType);
268
- const siteMatches = $.const(East.function([CheckCtx], OptionType(StringType), ($, c) => {
269
- const noFlag = $.const(none, OptionType(StringType));
270
- const site = $.let(c.half.match({ from: (_$) => c.row.fromSite, to: (_$) => c.row.toSite }));
271
- return site.hasTag("value").ifElse(() => c.member.match({
272
- identified: (_$, m) => site.unwrap("value").equal("").not()
273
- .and(() => machineSites.has(m.key))
274
- .and(() => machineSites.get(m.key).equal(site.unwrap("value")).not())
275
- .ifElse((_$2) => East.value(some(East.str `${m.key} is not at ${site.unwrap("value")}`), OptionType(StringType)), (_$2) => noFlag),
276
- }, (_$) => noFlag), () => noFlag);
277
- }));
278
- // The fills (§3.5) — derive, history, sequence, default, phrase, capacity — as author functions.
279
- const DateFill = OptionType(Sheet.Types.Fill(DateTimeType));
280
- const FloatFill = OptionType(Sheet.Types.Fill(FloatType));
281
- const TextFill = OptionType(Sheet.Types.Fill(StringType));
282
- const LinkFill = OptionType(Sheet.Types.Fill(Sheet.Types.Link));
283
- const endFromStart = $.const(East.function([Ctx], DateFill, ($, ctx) => {
284
- const noFill = $.const(none, DateFill);
285
- return ctx.row.start.match({
286
- value: (_$, supplied) => supplied.match({
287
- none: () => noFill,
288
- some: (_$, start) => ctx.driver.match({
289
- none: () => noFill,
290
- some: (_$, d) => some({ value: start.addDays(d.days), meta: East.str `+${d.days}d · ${d.name}` }),
291
- }),
292
- }),
293
- }, () => noFill);
294
- }));
295
- const lastSimilar = $.const(East.function([Ctx], OptionType(Sheet.Types.Draft(PlanRowType)), ($, ctx) => {
296
- const noRow = $.const(none, OptionType(Sheet.Types.Draft(PlanRowType)));
297
- return ctx.row.activity.match({
298
- value: ($, activity) => {
299
- const similar = $.let(ctx.rows.slice(0n, ctx.rowIndex).filter((_$, r) => r.activity.hasTag("value").and(() => r.activity.unwrap("value").equal(activity))));
300
- return similar.size().equal(0n).ifElse(() => noRow, () => some(similar.get(similar.size().subtract(1n))));
301
- },
302
- }, () => noRow);
303
- }));
304
- const lastQuantity = $.const(East.function([Ctx], FloatFill, ($, ctx) => {
305
- const noFill = $.const(none, FloatFill);
306
- return ctx.row.activity.match({
307
- value: ($, activity) => {
308
- const similar = $.let(ctx.rows.slice(0n, ctx.rowIndex).filter((_$, r) => r.activity.hasTag("value").and(() => r.activity.unwrap("value").equal(activity))
309
- .and(() => r.qty.hasTag("value")).and(() => r.qty.unwrap("value").hasTag("some"))));
310
- return similar.size().equal(0n).ifElse(() => noFill, ($) => {
311
- const row = $.let(similar.get(similar.size().subtract(1n)));
312
- return some({ value: row.qty.unwrap("value").unwrap("some"), meta: "last supplied quantity for this activity" });
313
- });
314
- },
315
- }, () => noFill);
316
- }));
317
- const lastStations = $.const(East.function([Ctx], LinkFill, ($, ctx) => {
318
- const noFill = $.const(none, LinkFill);
319
- const similar = $.const(lastSimilar);
320
- return similar(ctx).match({
321
- none: () => noFill,
322
- some: (_$, r) => r.stations.match({
323
- value: (_$, stations) => stations.from.size().add(stations.to.size()).equal(0n).ifElse(() => noFill, () => some({ value: stations, meta: "same stations as the last similar row" })),
324
- }, () => noFill),
325
- });
326
- }));
327
- const nextSlot = $.const(East.function([Ctx], DateFill, ($, ctx) => {
328
- const dated = $.let(ctx.rows.slice(0n, ctx.rowIndex).filter((_$, r) => r.start.hasTag("value").and(() => r.start.unwrap("value").hasTag("some"))));
329
- return dated.length().greater(0n).ifElse(($2) => {
330
- const last = $2.let(dated.get(dated.length().subtract(1n)));
331
- return East.value(some({ value: last.start.unwrap("value").unwrap("some").addDays(7n), meta: East.str `week after ${last.id.match({ value: (_$, id) => id }, () => "previous row")}` }), DateFill);
332
- }, ($2) => {
333
- const daysToMonday = $2.let(East.value(8n, IntegerType).subtract(ctx.today.getDayOfWeek()).remainder(7n));
334
- const monday = $2.let(ctx.today.addDays(daysToMonday.equal(0n).ifElse((_$) => 7n, (_$) => daysToMonday)));
335
- return East.value(some({ value: monday, meta: "next Monday" }), DateFill);
336
- });
337
- }));
338
- const shiftQuantity = $.const(East.function([Ctx], FloatFill, ($, ctx) => {
339
- const noFill = $.const(none, FloatFill);
340
- return ctx.driver.match({
341
- none: (_$) => noFill,
342
- some: (_$, d) => East.value(some({ value: d.rate.multiply(8.0), meta: East.str `${d.rate}/h × 8 h` }), FloatFill),
343
- });
344
- }));
345
- const phrase = $.const(East.function([Ctx], TextFill, ($, ctx) => {
346
- const noFill = $.const(none, TextFill);
347
- return ctx.row.activity.hasTag("value").and(() => ctx.row.qty.hasTag("value"))
348
- .and(() => ctx.row.qty.unwrap("value").hasTag("some")).ifElse(($) => {
349
- const activity = $.const(ctx.row.activity.unwrap("value"));
350
- const qty = $.const(ctx.row.qty.unwrap("value").unwrap("some"));
351
- return activity.startsWith("Machining").ifElse(() => some({ value: East.str `Machine ${qty} P-40 blanks`, meta: "phrasing from supplied activity and quantity" }), () => activity.startsWith("Painting").ifElse(() => some({ value: East.str `Paint ${qty} P-40 housings`, meta: "phrasing from supplied activity and quantity" }), () => noFill));
352
- }, () => noFill);
353
- }));
354
- const countedByQuantity = $.const(East.function([Ctx], LinkFill, ($, ctx) => {
355
- const noFill = $.const(none, LinkFill);
356
- const noMembers = $.const([], ArrayType(Sheet.Types.Member));
357
- const implied = $.const(impliedStations);
358
- return implied(ctx).match({
359
- none: (_$) => noFill,
360
- some: (_$, c) => East.value(some({ value: { from: noMembers, to: [variant("counted", { n: c.n, key: c.key })] }, meta: "capacity · from the quantity" }), LinkFill),
361
- });
362
- }));
363
- // The proposers (§3.6) — a domain pattern, a learned follower, and an ASYNC model call.
364
- const roughingFollowUps = $.const(East.function([Ctx], Proposals, ($, ctx) => {
365
- const empty = $.const([], Proposals);
366
- return ctx.row.activity.hasTag("value")
367
- .and(() => ctx.row.activity.unwrap("value").equal("Machining - Roughing"))
368
- .and(() => ctx.row.end.hasTag("value"))
369
- .and(() => ctx.row.end.unwrap("value").hasTag("some")).ifElse(($) => {
370
- const end = $.const(ctx.row.end.unwrap("value").unwrap("some"));
371
- return $.const([
372
- { patch: Sheet.patch(PlanRowType, { activity: "Inspection", start: some(end), end: some(end), qty: some(4.0), notes: "Inspect 4 lots" }), meta: "inspection at the supplied end" },
373
- { patch: Sheet.patch(PlanRowType, { activity: "Machining", start: some(end.addDays(3n)), end: some(end.addDays(7n)), notes: "Finish the roughed blanks" }), meta: "finishing · end +3…+7 d" },
374
- ], Proposals);
375
- }, () => empty);
376
- }));
377
- const lastFollower = $.const(East.function([Ctx], Proposals, ($, ctx) => {
378
- const empty = $.const([], Proposals);
379
- return ctx.row.activity.hasTag("value")
380
- .and(() => ctx.row.start.hasTag("value"))
381
- .and(() => ctx.row.start.unwrap("value").hasTag("some")).ifElse(($) => {
382
- const activity = $.const(ctx.row.activity.unwrap("value"));
383
- const start = $.const(ctx.row.start.unwrap("value").unwrap("some"));
384
- const dated = $.const(ctx.rows.filter((_$, r) => r.start.hasTag("value")
385
- .and(() => r.start.unwrap("value").hasTag("some"))
386
- .and(() => r.activity.hasTag("value"))));
387
- const upper = $.const(dated.size().greater(1n).ifElse(() => dated.size().subtract(1n), () => 0n));
388
- const pairs = $.const(East.Array.range(0n, upper).filter((_$, i) => dated.get(i).activity.unwrap("value").equal(activity)
389
- .and(() => dated.get(i.add(1n)).activity.unwrap("value").equal(activity).not())));
390
- return pairs.size().equal(0n).ifElse(() => empty, ($) => {
391
- const index = $.const(pairs.get(pairs.size().subtract(1n)));
392
- const from = $.const(dated.get(index));
393
- const next = $.const(dated.get(index.add(1n)));
394
- const gap = $.const(next.start.unwrap("value").unwrap("some").toEpochMilliseconds()
395
- .subtract(from.start.unwrap("value").unwrap("some").toEpochMilliseconds()));
396
- return $.const([{ patch: Sheet.patch(PlanRowType, { activity: next.activity.unwrap("value"), start: some(start.addMilliseconds(gap)) }),
397
- meta: "follower learned from supplied activities and dates" }], Proposals);
398
- });
399
- }, () => empty);
400
- }));
401
- const modelProposals = $.const(East.asyncFunction([Ctx], Proposals, ($, ctx) => {
402
- const result = $.let([], Proposals);
403
- $.try(($) => { $.assign(result, planRecommend(ctx)); }).catch(($, message) => {
404
- // The standalone showcase has no model backend. Other failures
405
- // still reach the Sheet's provider diagnostic.
406
- $.if(message.notEqual("Platform function 'sheet_plan_recommend' is not available"), ($) => { $.error(message); });
407
- });
408
- return result;
409
- }));
410
- const planned = $.let(rows.filter((_$, r) => r.activity.length().greater(0n)).length());
411
- return (_jsx(Sheet, { data: plan, id: "id", owned: r => r.orderCode.length().greater(0n).or(() => r.status.equal("CANCELLED")), driver: Sheet.driver("activity", activities, { key: a => a.name, label: a => a.name }), registers: {
412
- stations: Sheet.register.concat([
413
- Sheet.register.members(machines, { kind: "machine", key: m => m.code, label: m => m.code,
414
- meta: m => some(m.family), parent: m => some(m.line) }),
415
- Sheet.register.members(lines, { kind: "line", key: l => l.name, label: l => l.name,
416
- aliases: l => l.aliases, meta: l => some(East.str `line · ${l.machines}`) }),
417
- // The countable-by-attribute kind: a family names a count of machines, resolved to codes later.
418
- Sheet.register.members(families, { kind: "family", key: f => f.name, label: f => f.name,
419
- aliases: f => f.aliases, meta: _f => some("family") }),
420
- ]),
421
- sites: Sheet.register.members(sites, { kind: "site", key: s => s, label: s => s }),
422
- statuses: Sheet.register.members(statuses, { kind: "status", key: s => s.word, label: s => s.word, tone: s => some(s.tone) }),
423
- }, columns: {
424
- start: Sheet.column.date(PlanRowType, { header: "Start", sub: "dd / mm / yyyy", width: "96px", fill: [nextSlot] }),
425
- end: Sheet.column.date(PlanRowType, { header: "End", sub: "4d = start+4", width: "96px", base: "start", fill: [endFromStart] }),
426
- activity: Sheet.column.lookup(PlanRowType, { header: "Activity", sub: "activity register", width: "214px" }),
427
- qty: Sheet.column.quantity(PlanRowType, ActivityType, {
428
- header: "Qty", sub: "uom per activity", width: "112px", uom: d => d.uom,
429
- format: Format.Number({ maximumFractionDigits: 0n }), fill: [lastQuantity, shiftQuantity]
430
- }),
431
- notes: Sheet.column.text(PlanRowType, { header: "Notes", sub: "free text", width: "250px", fill: [phrase] }),
432
- stations: Sheet.column.link(PlanRowType, ActivityType, "stations", {
433
- header: "Work centres", sub: "from → to · 4 x lathe · machine · line", width: "352px",
434
- members: [{ kind: "machine", identified: true }, { kind: "range", identified: true },
435
- { kind: "line", countable: true, resolvesTo: "machine" },
436
- { kind: "family", countable: true, resolvesTo: "machine" }],
437
- multiple: { forms: ["N x kind", "kind x N"], ops: ["x", "X", "*", "×"], appliesTo: "countable" },
438
- sides: { value: d => d.sides, locks: { from: { to: "external", in: "in place" }, to: { from: "external" } } },
439
- arity: Sheet.link.arity("to", impliedStations),
440
- check: [Sheet.link.check.exists(), siteMatches],
441
- fill: [lastStations, countedByQuantity]
442
- }),
443
- setups: Sheet.column.integer(PlanRowType, { header: "Setups", sub: "n", width: "64px" }),
444
- fromSite: Sheet.column.reference(PlanRowType, "sites", { header: "From site", sub: "site register", width: "112px" }),
445
- toSite: Sheet.column.reference(PlanRowType, "sites", { header: "To site", sub: "site register", width: "112px" }),
446
- orderCode: Sheet.column.stamped(PlanRowType, { header: "Order code", sub: "stamped on release", owner: "ERP", width: "104px" }),
447
- status: Sheet.column.enum(PlanRowType, "statuses", { header: "Status", sub: "erp", width: "124px" }),
448
- }, suggest: { ahead: 2n, triggers: ["activity", "start", "end", "qty", "notes", "stations"],
449
- propose: [roughingFollowUps, modelProposals, lastFollower] }, slice: slice, affordances: ["search", "filter"], views: views.read(), onViewsChange: views.write, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(PlanRowType), () => Sheet.patch(PlanRowType, {
450
- notes: "", stations: { from: [], to: [] }, fromSite: "", toSite: "", orderCode: "", status: "PLANNED",
451
- })), onUpdate: plan.write, footer: [{ text: East.str `${planned} planned` }], style: { height: "fill" } }));
452
- } }))),
453
- inputs: [],
454
- });
455
- /**
456
- * The copilot in isolation (§3.5–§3.6) — the prototype's rules as author
457
- * functions: derive (End from Start + the driver's days), history (the last
458
- * similar row's quantity), sequence (a week after the last dated row), default
459
- * (eight hours at the driver's rate), a domain pattern proposer, a learned
460
- * follower, and an ASYNC proposer behind a platform function; every take
461
- * logs its provenance through `onPatch`.
462
- */
463
- export const sheetCopilot = example({
464
- keywords: ["Sheet", "Root", "copilot", "fill", "provider", "propose", "proposer", "suggest", "derive", "history", "sequence", "default", "learned", "follower", "asyncFunction", "asyncPlatform", "pending", "latest wins", "provenance", "onPatch", "source", "Context", "Fill", "Patch", "Proposal", "Reactive", "State"],
465
- description: "The copilot in isolation — derive, history, sequence and default fills, a pattern proposer, a learned follower and an async model proposer, all author East functions over the typed context; takes log their provenance",
466
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
467
- const PlanRowType = StructType({
468
- id: StringType, start: OptionType(DateTimeType), end: OptionType(DateTimeType), activity: StringType,
469
- qty: OptionType(FloatType), notes: StringType, stations: Sheet.Types.Link, setups: OptionType(IntegerType),
470
- fromSite: StringType, toSite: StringType, orderCode: StringType, status: StringType,
471
- });
472
- const ActivityType = StructType({ name: StringType, uom: StringType, rate: FloatType, fte: IntegerType, days: IntegerType, sides: Sheet.Types.Sides });
473
- const Ctx = Sheet.Types.DraftContext(PlanRowType, ActivityType);
474
- const Proposals = ArrayType(Sheet.Types.Proposal(PlanRowType));
475
- const activities = $.const([
476
- { name: "Machining", uom: "pcs", rate: 60.0, fte: 2n, days: 4n, sides: variant("both", null) },
477
- { name: "Machining - Roughing", uom: "pcs", rate: 80.0, fte: 2n, days: 4n, sides: variant("both", null) },
478
- { name: "Painting", uom: "pcs", rate: 50.0, fte: 3n, days: 4n, sides: variant("both", null) },
479
- { name: "Inspection", uom: "lots", rate: 4.0, fte: 2n, days: 4n, sides: variant("in", null) },
480
- { name: "Packaging", uom: "cartons", rate: 120.0, fte: 1n, days: 3n, sides: variant("both", null) },
481
- ], ArrayType(ActivityType));
482
- const plan = $.let(State.bind([ArrayType(PlanRowType)], "sheet_copilot_rows", [
483
- { id: "1", start: some(new Date("2026-02-16T00:00:00Z")), end: some(new Date("2026-02-20T00:00:00Z")), activity: "Machining - Roughing", qty: some(1200.0), notes: "Rough the P-40 blanks", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "PLANNED" },
484
- { id: "2", start: some(new Date("2026-02-16T00:00:00Z")), end: some(new Date("2026-02-20T00:00:00Z")), activity: "Inspection", qty: some(4.0), notes: "Inspect the 4 lots", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "PLANNED" },
485
- { id: "3", start: some(new Date("2026-03-09T00:00:00Z")), end: none, activity: "Painting", qty: some(250.0), notes: "", stations: { from: [], to: [] }, setups: none, fromSite: "", toSite: "", orderCode: "", status: "PLANNED" },
486
- ]));
487
- const log = $.let(State.bind([ArrayType(StringType)], "sheet_copilot_log", []));
488
- const DateFill = OptionType(Sheet.Types.Fill(DateTimeType));
489
- const FloatFill = OptionType(Sheet.Types.Fill(FloatType));
490
- // derive — End = Start + the driver's days.
491
- const endFromStart = $.const(East.function([Ctx], DateFill, ($, ctx) => {
492
- const noFill = $.const(none, DateFill);
493
- return ctx.row.start.match({
494
- value: (_$, supplied) => supplied.match({
495
- none: () => noFill,
496
- some: (_$, start) => ctx.driver.match({
497
- none: () => noFill,
498
- some: (_$, d) => some({ value: start.addDays(d.days), meta: East.str `+${d.days}d · ${d.name}` }),
499
- }),
500
- }),
501
- }, () => noFill);
502
- }));
503
- // history — the last row above with this activity.
504
- const lastQuantity = $.const(East.function([Ctx], FloatFill, ($, ctx) => {
505
- const noFill = $.const(none, FloatFill);
506
- return ctx.row.activity.match({
507
- value: ($, activity) => {
508
- const similar = $.let(ctx.rows.slice(0n, ctx.rowIndex).filter((_$, r) => r.activity.hasTag("value").and(() => r.activity.unwrap("value").equal(activity))
509
- .and(() => r.qty.hasTag("value")).and(() => r.qty.unwrap("value").hasTag("some"))));
510
- return similar.size().equal(0n).ifElse(() => noFill, ($) => {
511
- const row = $.let(similar.get(similar.size().subtract(1n)));
512
- return some({ value: row.qty.unwrap("value").unwrap("some"), meta: "last supplied quantity for this activity" });
513
- });
514
- },
515
- }, () => noFill);
516
- }));
517
- // sequence — a week after the nearest dated row above; else next Monday.
518
- const nextSlot = $.const(East.function([Ctx], DateFill, ($, ctx) => {
519
- const dated = $.let(ctx.rows.slice(0n, ctx.rowIndex).filter((_$, r) => r.start.hasTag("value").and(() => r.start.unwrap("value").hasTag("some"))));
520
- return dated.length().greater(0n).ifElse(($2) => {
521
- const last = $2.let(dated.get(dated.length().subtract(1n)));
522
- return East.value(some({ value: last.start.unwrap("value").unwrap("some").addDays(7n), meta: East.str `week after ${last.id.match({ value: (_$, id) => id }, () => "previous row")}` }), DateFill);
523
- }, ($2) => {
524
- const daysToMonday = $2.let(East.value(8n, IntegerType).subtract(ctx.today.getDayOfWeek()).remainder(7n));
525
- const monday = $2.let(ctx.today.addDays(daysToMonday.equal(0n).ifElse((_$) => 7n, (_$) => daysToMonday)));
526
- return East.value(some({ value: monday, meta: "next Monday" }), DateFill);
527
- });
528
- }));
529
- // default — eight hours at the driver's rate when nothing similar exists.
530
- const shiftQuantity = $.const(East.function([Ctx], FloatFill, ($, ctx) => {
531
- const noFill = $.const(none, FloatFill);
532
- return ctx.driver.match({
533
- none: (_$) => noFill,
534
- some: (_$, d) => East.value(some({ value: d.rate.multiply(8.0), meta: East.str `${d.rate}/h × 8 h` }), FloatFill),
535
- });
536
- }));
537
- // A domain pattern — a roughing run is followed by an inspection and a finishing run.
538
- const roughingFollowUps = $.const(East.function([Ctx], Proposals, ($, ctx) => {
539
- const empty = $.const([], Proposals);
540
- return ctx.row.activity.hasTag("value")
541
- .and(() => ctx.row.activity.unwrap("value").equal("Machining - Roughing"))
542
- .and(() => ctx.row.end.hasTag("value"))
543
- .and(() => ctx.row.end.unwrap("value").hasTag("some")).ifElse(($) => {
544
- const end = $.const(ctx.row.end.unwrap("value").unwrap("some"));
545
- return $.const([
546
- { patch: Sheet.patch(PlanRowType, { activity: "Inspection", start: some(end), end: some(end), qty: some(4.0), notes: "Inspect 4 lots" }), meta: "inspection at the supplied end" },
547
- { patch: Sheet.patch(PlanRowType, { activity: "Machining", start: some(end.addDays(3n)), end: some(end.addDays(7n)), notes: "Finish the roughed blanks" }), meta: "finishing · end +3…+7 d" },
548
- ], Proposals);
549
- }, () => empty);
550
- }));
551
- // Learned from the sheet — what followed this activity last time, after how long.
552
- const lastFollower = $.const(East.function([Ctx], Proposals, ($, ctx) => {
553
- const empty = $.const([], Proposals);
554
- return ctx.row.activity.hasTag("value")
555
- .and(() => ctx.row.start.hasTag("value"))
556
- .and(() => ctx.row.start.unwrap("value").hasTag("some")).ifElse(($) => {
557
- const activity = $.const(ctx.row.activity.unwrap("value"));
558
- const start = $.const(ctx.row.start.unwrap("value").unwrap("some"));
559
- const dated = $.const(ctx.rows.filter((_$, r) => r.start.hasTag("value")
560
- .and(() => r.start.unwrap("value").hasTag("some"))
561
- .and(() => r.activity.hasTag("value"))));
562
- const upper = $.const(dated.size().greater(1n).ifElse(() => dated.size().subtract(1n), () => 0n));
563
- const pairs = $.const(East.Array.range(0n, upper).filter((_$, i) => dated.get(i).activity.unwrap("value").equal(activity)
564
- .and(() => dated.get(i.add(1n)).activity.unwrap("value").equal(activity).not())));
565
- return pairs.size().equal(0n).ifElse(() => empty, ($) => {
566
- const index = $.const(pairs.get(pairs.size().subtract(1n)));
567
- const from = $.const(dated.get(index));
568
- const next = $.const(dated.get(index.add(1n)));
569
- const gap = $.const(next.start.unwrap("value").unwrap("some").toEpochMilliseconds()
570
- .subtract(from.start.unwrap("value").unwrap("some").toEpochMilliseconds()));
571
- return $.const([{ patch: Sheet.patch(PlanRowType, { activity: next.activity.unwrap("value"), start: some(start.addMilliseconds(gap)) }),
572
- meta: "follower learned from supplied activities and dates" }], Proposals);
573
- });
574
- }, () => empty);
575
- }));
576
- // A model — an ASYNC proposer; the strip shows a pending chip and a newer context cancels the wait.
577
- const modelProposals = $.const(East.asyncFunction([Ctx], Proposals, ($, ctx) => {
578
- const result = $.let([], Proposals);
579
- $.try(($) => { $.assign(result, planRecommend(ctx)); }).catch(($, message) => {
580
- // The standalone showcase has no model backend. Other failures
581
- // still reach the Sheet's provider diagnostic.
582
- $.if(message.notEqual("Platform function 'sheet_plan_recommend' is not available"), ($) => { $.error(message); });
583
- });
584
- return result;
585
- }));
586
- // Every gesture logs once, including incomplete drafts and undo.
587
- const onPatch = $.const(East.function([Sheet.Types.PatchEvent(PlanRowType)], NullType, ($, e) => {
588
- $(log.write(log.read().concat([East.str `${e.origin.getTag()} · ${e.label} · ${e.draftChanges.length()} entries`])));
589
- }));
590
- const entries = $.let(log.read());
591
- return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Sheet, { data: plan, id: "id", driver: Sheet.driver("activity", activities, { key: a => a.name, label: a => a.name }), columns: {
592
- start: Sheet.column.date(PlanRowType, { header: "Start", sub: "sequence", width: "96px", fill: [nextSlot] }),
593
- end: Sheet.column.date(PlanRowType, { header: "End", sub: "derive", width: "96px", base: "start", fill: [endFromStart] }),
594
- activity: Sheet.column.lookup(PlanRowType, { header: "Activity", sub: "activity register", width: "214px" }),
595
- qty: Sheet.column.quantity(PlanRowType, ActivityType, { header: "Qty", sub: "history · default", width: "112px", uom: d => d.uom, fill: [lastQuantity, shiftQuantity] }),
596
- notes: Sheet.column.text(PlanRowType, { header: "Notes", width: "260px" }),
597
- }, suggest: { ahead: 2n, triggers: ["activity", "start", "end", "qty"], propose: [roughingFollowUps, modelProposals, lastFollower] }, onPatch: onPatch, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(PlanRowType), () => Sheet.patch(PlanRowType, {
598
- notes: "", stations: { from: [], to: [] }, fromSite: "", toSite: "", orderCode: "", status: "PLANNED",
599
- })), onUpdate: plan.write, style: { height: "420px" } }), _jsx(Text.MonoLabel, { children: East.str `COPILOT LOG · ${entries.length()} edits · ${entries.filter((_$, l) => l.startsWith("typed").not()).length()} from the copilot` })] }));
600
- } }))),
601
- inputs: [],
602
- });
603
- /**
604
- * The lens (§3.8) — search and filter run through the bound slice; the sheet
605
- * never narrows, it draws non-matching rows as collapsed context bands
606
- * while hits keep their row numbers; a Link column is searched through its
607
- * display form (`text: r => Sheet.link.print(r.stations)`); views are
608
- * slice-state snapshots evaluated live, with their context and reveals.
609
- */
610
- export const sheetLens = example({
611
- keywords: ["Sheet", "Root", "slice", "search", "filter", "lens", "bands", "context", "reveal", "views", "onViewsChange", "activeView", "text", "Sheet.link.print", "set", "Slice", "config", "bind", "state", "Reactive", "State"],
612
- description: "The lens — search and filter through the bound slice drawn as context bands (hits keep their row numbers), a Link column searched through its display text, and saved views as slice-state snapshots with their context and reveals",
613
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
614
- const JobType = StructType({ id: StringType, start: OptionType(DateTimeType), activity: StringType, notes: StringType, stations: Sheet.Types.Link, status: StringType, qty: OptionType(FloatType) });
615
- const MachineType = StructType({ code: StringType, family: StringType });
616
- // Sixty rows derived East-side — enough for a narrowing to collapse into bands.
617
- const activities = $.const(["Machining", "Painting", "Packaging", "Changeover", "Maintenance"], ArrayType(StringType));
618
- const words = $.const(["PLANNED", "RELEASED", "COMPLETE"], ArrayType(StringType));
619
- const machines = $.const([
620
- { code: "M2140", family: "CNC lathe" }, { code: "M2141", family: "CNC lathe" }, { code: "M2145", family: "CNC lathe" },
621
- { code: "M3210", family: "5-axis mill" }, { code: "M7301", family: "assembly bench" },
622
- ], ArrayType(MachineType));
623
- const noMembers = $.const([], ArrayType(Sheet.Types.Member));
624
- const rows = $.let(East.Array.generate(60n, JobType, (_$, i) => ({
625
- id: East.str `j${i}`,
626
- start: some(East.value(new Date("2026-02-02T00:00:00Z"), DateTimeType).addDays(i.multiply(3n))),
627
- activity: activities.get(i.remainder(5n)),
628
- notes: i.remainder(7n).equal(0n).ifElse((_$2) => "urgent — inspect before shipping", (_$2) => East.str `lot ${i.add(100n)}`),
629
- // Machining runs name a count of lathes; the rest a machine by code.
630
- stations: i.remainder(5n).equal(0n).ifElse((_$2) => East.value({ from: noMembers, to: [variant("counted", { n: i.remainder(3n).add(2n), key: "CNC lathe" })] }, Sheet.Types.Link), (_$2) => East.value({ from: noMembers, to: [variant("identified", { key: machines.get(i.remainder(5n)).code })] }, Sheet.Types.Link)),
631
- status: words.get(i.remainder(3n)),
632
- qty: some(i.multiply(40n).toFloat().add(180.0)),
633
- })), ArrayType(JobType));
634
- // The Link is searched through its display form — `3 x CNC lathe`, `M7301` — not its `.east` text.
635
- const cfg = $.const(Slice.config(JobType, {
636
- fields: {
637
- activity: { label: "Activity", hints: ["Machining", "Painting", "Packaging", "Changeover", "Maintenance"] },
638
- notes: { label: "Notes" },
639
- stations: { label: "Work centres", text: r => Sheet.link.print(r.stations) },
640
- status: { label: "Status" },
641
- },
642
- searchFieldIds: ["activity", "notes", "stations"],
643
- }));
644
- const slice = $.let(Slice.bind([JobType], "sheet_lens_slice", cfg, Slice.state(), rows, none));
645
- const views = $.let(State.bind([ArrayType(Sheet.Types.View)], "sheet_lens_views", [
646
- { id: "painting", name: "PAINTING", narrowing: Slice.state({ search: some("painting") }), context: 1n, reveals: [], folds: new Map() },
647
- { id: "lathes", name: "LATHES", narrowing: Slice.state({ search: some("lathe") }), context: 0n, reveals: [], folds: new Map() },
648
- { id: "urgent", name: "URGENT", narrowing: Slice.state({ search: some("urgent") }), context: 0n, reveals: [], folds: new Map() },
649
- ]));
650
- return (_jsx(Sheet, { data: rows, id: "id", registers: {
651
- stations: Sheet.register.concat([
652
- Sheet.register.members(machines, { kind: "machine", key: m => m.code, label: m => m.code, meta: m => some(m.family) }),
653
- Sheet.register.members(machines, { kind: "family", key: m => m.family, label: m => m.family, meta: _m => some("family") }),
654
- ]),
655
- }, columns: {
656
- start: Sheet.column.date(JobType, { header: "Start", width: "96px" }),
657
- activity: Sheet.column.text(JobType, { header: "Activity", width: "160px" }),
658
- notes: Sheet.column.text(JobType, { header: "Notes", sub: "free text", width: "240px" }),
659
- stations: Sheet.column.set(JobType, "stations", { header: "Work centres", sub: "3 x lathe · machine", width: "220px",
660
- members: [{ kind: "machine", identified: true }, { kind: "family", countable: true, resolvesTo: "machine" }] }),
661
- status: Sheet.column.text(JobType, { header: "Status", width: "120px" }),
662
- qty: Sheet.column.quantity(JobType, { header: "Qty", width: "112px", format: Format.Number({ maximumFractionDigits: 0n }) }),
663
- }, slice: slice, affordances: ["search", "filter"], views: views.read(), onViewsChange: views.write, activeView: some("painting"), style: { height: "420px" } }));
664
- } }))),
665
- inputs: [],
666
- });
667
- /**
668
- * Write-back (§3.7) — onPatch journals one complete gesture, while the
669
- * live onUpdate adapter checks and applies the composed batch once. The
670
- * Sheet holds local drafts until Apply changes is pressed.
671
- */
672
- export const sheetWriteBack = example({
673
- keywords: ["Sheet", "Root", "onPatch", "onUpdate", "write-back", "commit", "insert", "remove", "source", "provenance", "PatchEvent", "staged", "newRowId", "Reactive", "State"],
674
- description: "Write-back — one onPatch event per gesture with provenance and readiness, beside onUpdate applying a checked batch to the live collection",
675
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
676
- const JobType = StructType({ id: StringType, task: StringType, qty: OptionType(FloatType), createdBy: StringType });
677
- const jobs = $.let(State.bind([ArrayType(JobType)], "sheet_writeback_rows", [
678
- { id: "j1", task: "Machining", qty: some(1200.0), createdBy: "planner" },
679
- { id: "j2", task: "Painting", qty: none, createdBy: "planner" },
680
- ]));
681
- const log = $.let(State.bind([ArrayType(StringType)], "sheet_writeback_log", []));
682
- const counter = $.let(State.bind([IntegerType], "sheet_writeback_counter", 3n));
683
- // Draft patches include hidden fields without inventing their values.
684
- // This observer journals gestures; the live adapter applies ready batches.
685
- const onPatch = $.const(East.function([Sheet.Types.PatchEvent(JobType)], NullType, ($, e) => {
686
- $(log.write(log.read().concat([East.str `${e.origin.getTag()} · ${e.label} · ${e.readiness.getTag()}`])));
687
- }));
688
- // The host mints ids for inserted rows.
689
- const newRowId = $.const(East.function([], StringType, ($) => {
690
- const n = $.let(counter.read());
691
- $(counter.write(n.add(1n)));
692
- return East.str `j${n}`;
693
- }));
694
- const entries = $.let(log.read());
695
- return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Sheet, { data: jobs, id: "id", columns: {
696
- task: Sheet.column.text(JobType, { header: "Task", width: "200px" }),
697
- qty: Sheet.column.quantity(JobType, { header: "Qty", width: "112px" }),
698
- }, onPatch: onPatch, onUpdate: jobs.write, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { createdBy: "planner" })), newRowId: newRowId, blanks: 6n }), _jsx(Text.MonoLabel, { children: East.str `EDITS · ${entries.length()}` }), entries.map((_$, l) => _jsx(Text, { textStyle: "caption", color: "fg.muted", children: l }))] }));
699
- } }))),
700
- inputs: [],
701
- });
702
- /**
703
- * Grouped editing — named work packages with ordered child rows. Explicit
704
- * constructors supply hidden metadata; the schema determines completeness.
705
- */
706
- export const sheetGrouped = example({
707
- keywords: ["Sheet", "group", "grouped", "children", "newGroup", "newRow", "Patch", "defaults", "completeness", "fold", "undo", "redo", "onUpdate", "Reactive", "State"],
708
- description: "Grouped work packages — edit names and child rows, fold groups, create drafts with explicit defaults, then apply or undo the batch",
709
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
710
- const JobType = StructType({ task: StringType, qty: OptionType(FloatType), notes: StringType, createdBy: StringType });
711
- const PackageType = StructType({ id: StringType, name: StringType, owner: StringType, jobs: ArrayType(JobType) });
712
- const packages = $.let(State.bind([ArrayType(PackageType)], "sheet_grouped_packages", [
713
- { id: "roughing", name: "P-40 · Roughing", owner: "planner", jobs: [
714
- { task: "Machine blanks", qty: some(1200.0), notes: "Four CNC lathes", createdBy: "planner" },
715
- { task: "Inspect lots", qty: some(4.0), notes: "Check before finishing", createdBy: "planner" },
716
- ] },
717
- { id: "finishing", name: "P-40 · Finishing", owner: "planner", jobs: [
718
- { task: "Finish housings", qty: some(1200.0), notes: "After inspection", createdBy: "planner" },
719
- { task: "Pack for assembly", qty: some(100.0), notes: "Twelve per carton", createdBy: "planner" },
720
- ] },
721
- ]));
722
- const applied = $.let(packages.read());
723
- return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Text, { textStyle: "caption", color: "fg.muted", children: "Edit a package name or task. Use the gutter + to insert a task, or the stacked-rows + button to create a package at a group boundary. Apply changes saves the batch; Undo and Redo retain each gesture." }), _jsx(Sheet, { data: packages, id: "id", group: Sheet.group(PackageType, "jobs", { title: "name" }), ready: { group: East.function([Sheet.Types.DraftGroup(PackageType, "jobs")], Sheet.Types.Readiness, ($, group) => {
724
- $.if(group.name.hasTag("value").and(() => group.name.unwrap("value").length().equal(0n)), $ => {
725
- $.return(East.value(variant("incomplete", [{ field: "name", message: "Name the work package" }]), Sheet.Types.Readiness));
726
- });
727
- return East.value(variant("ready", null), Sheet.Types.Readiness);
728
- }) }, columns: {
729
- task: Sheet.column.text(JobType, { header: "Task", width: "240px" }),
730
- qty: Sheet.column.quantity(JobType, { header: "Qty", width: "112px" }),
731
- notes: Sheet.column.text(JobType, { header: "Notes", width: "300px" }),
732
- }, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, {
733
- notes: "", createdBy: "planner",
734
- })), newGroup: East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(PackageType), () => Sheet.patch(PackageType, {
735
- owner: "planner", jobs: [],
736
- })), onUpdate: packages.write, style: { height: "440px" } }), _jsx(Text.MonoLabel, { children: East.str `SAVED · ${applied.length()} packages · ${applied.map((_$, p) => p.jobs.length()).sum()} tasks` })] }));
737
- } }))),
738
- inputs: [],
739
- });
740
- /**
741
- * Stress — two thousand rows, every column virtualised, the copilot's
742
- * history fill reasoning over the resident sheet.
743
- */
744
- export const sheetStress = example({
745
- keywords: ["Sheet", "Root", "stress", "virtualization", "2000", "rows", "performance", "fill", "history", "Reactive", "State"],
746
- description: "Two thousand rows in one sheet — virtualised rows, typed columns, and a history fill that reads the whole resident sheet",
747
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
748
- const JobType = StructType({ id: StringType, start: OptionType(DateTimeType), task: StringType, qty: OptionType(FloatType), notes: StringType });
749
- const Ctx = Sheet.Types.DraftContext(JobType);
750
- const tasks = $.const(["Machining", "Painting", "Packaging", "Changeover", "Maintenance", "Receiving", "Shipping"], ArrayType(StringType));
751
- const rows = $.let(State.bind([ArrayType(JobType)], "sheet_stress_rows", East.Array.generate(2000n, JobType, (_$, i) => ({
752
- id: East.str `S${i}`,
753
- start: some(East.value(new Date("2026-01-05T00:00:00Z"), DateTimeType).addDays(i.divide(4n))),
754
- task: tasks.get(i.remainder(7n)),
755
- qty: i.remainder(11n).equal(0n).ifElse((_$2) => East.value(none, OptionType(FloatType)), (_$2) => East.value(some(i.multiply(7n).toFloat().add(50.0)), OptionType(FloatType))),
756
- notes: "",
757
- }))));
758
- const FloatFill = OptionType(Sheet.Types.Fill(FloatType));
759
- const lastQty = $.const(East.function([Ctx], FloatFill, ($, ctx) => {
760
- const noFill = $.const(none, FloatFill);
761
- const similar = $.let(ctx.rows.slice(0n, ctx.rowIndex).filter((_$, r) => r.task.hasTag("value").and(() => ctx.row.task.hasTag("value")).and(() => r.task.unwrap("value").equal(ctx.row.task.unwrap("value"))).and(() => r.qty.hasTag("value")).and(() => r.qty.unwrap("value").hasTag("some"))));
762
- return similar.length().equal(0n).ifElse((_$) => noFill, ($2) => {
763
- const r = $2.let(similar.get(similar.length().subtract(1n)));
764
- return East.value(some({ value: r.qty.unwrap("value").unwrap("some"), meta: East.str `like ${r.id.match({ value: (_$, id) => id }, () => "previous row")}` }), FloatFill);
765
- });
766
- }));
767
- return (_jsx(Sheet, { data: rows, id: "id", columns: {
768
- start: Sheet.column.date(JobType, { header: "Start", width: "96px" }),
769
- task: Sheet.column.text(JobType, { header: "Task", width: "160px" }),
770
- qty: Sheet.column.quantity(JobType, { header: "Qty", width: "112px", format: Format.Number({ maximumFractionDigits: 0n }), fill: [lastQty] }),
771
- notes: Sheet.column.text(JobType, { header: "Notes", width: "240px" }),
772
- }, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "" })), onUpdate: rows.write, footer: [{ text: "2000 rows · virtualised" }], style: { height: "480px" } }));
773
- } }))),
774
- inputs: [],
775
- });
776
- /** Schema completeness plus an optional business rule, evaluated on typed drafts. */
777
- export const sheetReadiness = example({
778
- keywords: ["Sheet", "ready", "row", "Readiness", "Draft", "DraftContext", "completeness", "validation", "Apply", "onUpdate", "Reactive", "State"],
779
- description: "Draft readiness — quantities must be positive before Apply; missing required values and invalid text are checked automatically",
780
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
781
- const JobType = StructType({ id: StringType, task: StringType, qty: IntegerType, note: OptionType(StringType), createdBy: StringType });
782
- const jobs = $.const(State.bind([ArrayType(JobType)], "sheet_readiness_jobs", [
783
- { id: "inspection", task: "Inspect lots", qty: 4n, note: none, createdBy: "planner" },
784
- ]));
785
- const readyRow = $.const(East.function([Sheet.Types.Draft(JobType), Sheet.Types.DraftContext(JobType)], Sheet.Types.Readiness, ($, row) => {
786
- $.if(row.qty.hasTag("value").and(() => row.qty.unwrap("value").lessEqual(0n)), $ => {
787
- $.return(East.value(variant("incomplete", [{ field: "qty", message: "Quantity must be positive" }]), Sheet.Types.Readiness));
788
- });
789
- return East.value(variant("ready", null), Sheet.Types.Readiness);
790
- }));
791
- const saved = $.const(jobs.read());
792
- return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Text, { textStyle: "caption", color: "fg.muted", children: "Set Qty to 0: Apply stays disabled. Enter a positive quantity to save. Required fields are checked automatically; Notes may stay blank." }), _jsx(Sheet, { data: jobs, id: "id", columns: { task: Sheet.column.text(JobType), qty: Sheet.column.integer(JobType), note: Sheet.column.text(JobType) }, ready: { row: readyRow }, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { createdBy: "planner" })), onUpdate: jobs.write, blanks: 2n }), _jsx(Text.MonoLabel, { children: East.str `SAVED · ${saved.length()} rows · ${saved.map((_$, row) => row.qty).sum()} total quantity` })] }));
793
- } }))),
794
- inputs: [],
795
- });
796
- /** Row insertion and capability limits over a live collection. */
797
- export const sheetInsertion = example({
798
- keywords: ["Sheet", "edits", "insertRows", "removeRows", "insert", "newRow", "before", "after", "Undo", "State"],
799
- description: "Insert rows with the gutter buttons, selection strip or Alt+Insert; existing-row deletion is disabled while new drafts can be discarded",
800
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
801
- const RowType = StructType({ id: StringType, task: StringType, qty: IntegerType, createdBy: StringType });
802
- const jobs = $.const(State.bind([ArrayType(RowType)], "sheet_insertion_jobs", [
803
- { id: "rough", task: "Rough machining", qty: 120n, createdBy: "planner" },
804
- { id: "inspect", task: "Inspect lots", qty: 4n, createdBy: "planner" },
805
- { id: "finish", task: "Finish housings", qty: 120n, createdBy: "planner" },
806
- ]));
807
- const saved = $.const(jobs.read());
808
- return _jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Text, { textStyle: "caption", color: "fg.muted", children: "Hover or focus a gutter to insert before a row. Select a row marker for Insert above/below, or use Alt+Insert and Alt+Shift+Insert. Name the draft and Apply to save it." }), _jsx(Sheet, { data: jobs, id: "id", columns: { task: Sheet.column.text(RowType), qty: Sheet.column.integer(RowType) }, edits: { insertRows: true, removeRows: false, moveRows: "none" }, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(RowType), () => Sheet.patch(RowType, { qty: 1n, createdBy: "planner" })), onUpdate: jobs.write, blanks: 2n }), _jsx(Text.MonoLabel, { children: East.str `SAVED · ${saved.map((_$, row) => row.task).stringJoin(" → ")}` })] });
809
- } }))),
810
- inputs: [],
811
- });
812
- /**
813
- * Sub rows (#844) — read-only rows under each line that share none of its
814
- * columns. `Sheet.subRows` is keyed like `columns`: each key names an array
815
- * field of the line type and maps one element to a sub row — a struct source
816
- * with chips and labelled facets (a `none` facet drops out), and a variant
817
- * source matched arm by arm. The group's noun is the host's word.
818
- */
819
- export const sheetSubRows = example({
820
- keywords: ["Sheet", "subRows", "subRow", "sub rows", "SubRow", "Facet", "chips", "facets", "lead", "detail", "group", "noun", "variant", "match", "read-only", "Reactive", "State"],
821
- description: "Sub rows under each line — operations with chips and facets, bookings matched from a variant — declared per array field like columns, under groups the host calls orders",
822
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
823
- const OperationType = StructType({
824
- id: StringType, code: StringType, name: StringType, materials: ArrayType(StringType),
825
- station: OptionType(StringType), by: OptionType(StringType),
826
- });
827
- const BookingType = VariantType({
828
- space: StructType({ area: StringType, units: IntegerType }),
829
- labour: StructType({ team: StringType, people: IntegerType, hours: FloatType }),
830
- equipment: StructType({ resource: StringType }),
831
- });
832
- const JobType = StructType({
833
- task: StringType, qty: OptionType(FloatType), notes: StringType,
834
- operations: ArrayType(OperationType), // no column — shown as sub rows
835
- bookings: ArrayType(BookingType), // no column — shown as sub rows
836
- });
837
- const OrderType = StructType({ id: StringType, name: StringType, jobs: ArrayType(JobType) });
838
- const orders = $.let(State.bind([ArrayType(OrderType)], "sheet_subrows_orders", [
839
- { id: "wo-1042", name: "WO-1042 · Frames", jobs: [
840
- { task: "Assemble frames", qty: some(40.0), notes: "Two benches", operations: [
841
- { id: "WO-1042-1", code: "CUT", name: "Cut rails to length", materials: ["Rail stock × 80"], station: some("Saw 2"), by: none },
842
- { id: "WO-1042-2", code: "ASM", name: "Assemble frame", materials: ["M6 bolts × 12", "Frame kit"], station: some("Bench 7"), by: some("Assembly") },
843
- ], bookings: [
844
- variant("labour", { team: "Assembly", people: 2n, hours: 12.0 }),
845
- variant("equipment", { resource: "Torque driver" }),
846
- ] },
847
- { task: "Inspect frames", qty: some(40.0), notes: "", operations: [], bookings: [
848
- variant("space", { area: "Test bay", units: 2n }),
849
- ] },
850
- ] },
851
- { id: "wo-1043", name: "WO-1043 · Housings", jobs: [
852
- { task: "Paint housings", qty: some(250.0), notes: "Primer first", operations: [
853
- { id: "WO-1043-1", code: "PNT", name: "Prime and paint", materials: ["Primer", "Topcoat"], station: none, by: none },
854
- ], bookings: [] },
855
- ] },
856
- ]));
857
- return (_jsx(Sheet, { data: orders, id: "id", group: Sheet.group(OrderType, "jobs", { title: "name", noun: { singular: "order", plural: "orders" } }), columns: {
858
- task: Sheet.column.text(JobType, { header: "Task", width: "220px" }),
859
- qty: Sheet.column.quantity(JobType, { header: "Qty", width: "96px" }),
860
- notes: Sheet.column.text(JobType, { header: "Notes", width: "240px" }),
861
- }, subRows: Sheet.subRows(JobType, {
862
- operations: (op) => Sheet.subRow({
863
- code: op.code,
864
- name: op.name,
865
- chips: op.materials,
866
- facets: { station: op.station, by: op.by }, // a none drops out
867
- id: op.id,
868
- }),
869
- bookings: (b) => b.match({
870
- space: (_$2, s) => Sheet.subRow({ code: "CLAIM", name: East.str `${s.area} · ${s.units} units` }),
871
- labour: (_$2, l) => Sheet.subRow({ code: "LABOUR", name: East.str `${l.team} · ${l.people} people · ${l.hours} person-hours` }),
872
- equipment: (_$2, e) => Sheet.subRow({ code: "EQUIPMENT", name: e.resource }),
873
- }),
874
- }), newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { notes: "", operations: [], bookings: [] })), newGroup: East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(OrderType), () => Sheet.patch(OrderType, { jobs: [] })), onUpdate: orders.write, style: { height: "420px" } }));
875
- } }))),
876
- inputs: [],
877
- });
878
- /**
879
- * Column rules (#844) — what a column offers, how deep a date reads, and
880
- * what a cell says beyond its value: an `options` rule narrows the status
881
- * menu until the row has an order code; the start date reads at the row's
882
- * own `level` and prints the `actual` start once one is recorded; the status
883
- * cell's `detail` is the order code; machines are a `ranged` kind, so runs
884
- * of consecutive codes are offered and printed as one range.
885
- */
886
- export const sheetRules = example({
887
- keywords: ["Sheet", "options", "level", "actual", "detail", "ranged", "DateLevel", "week", "day", "range", "time", "enum", "date", "set", "members", "rule", "Reactive", "State"],
888
- description: "Column rules — an options rule narrowing an enum's menu, a date read at each row's level with its actual start, a status detail, and a ranged machine kind",
889
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
890
- const JobType = StructType({
891
- id: StringType, task: StringType, start: OptionType(DateTimeType), level: Sheet.Types.DateLevel,
892
- started: OptionType(DateTimeType), status: StringType, orderCode: StringType, machines: Sheet.Types.Link,
893
- });
894
- const Ctx = Sheet.Types.DraftContext(JobType);
895
- const StatusType = StructType({ word: StringType, tone: Status.Types.Value });
896
- const statuses = $.const([
897
- { word: "PLANNED", tone: variant("neutral", null) }, { word: "RELEASED", tone: variant("info", null) },
898
- { word: "IN PROGRESS", tone: variant("warning", null) }, { word: "COMPLETE", tone: variant("success", null) },
899
- ], ArrayType(StatusType));
900
- const machines = $.const(["M2140", "M2141", "M2142", "M2143", "M3210", "M3211"], ArrayType(StringType));
901
- const noMembers = $.const([], ArrayType(Sheet.Types.Member));
902
- const jobs = $.let(State.bind([ArrayType(JobType)], "sheet_rules_jobs", [
903
- { id: "j1", task: "Rough blanks", start: some(new Date("2026-02-16T00:00:00Z")), level: variant("week", null), started: none, status: "PLANNED", orderCode: "", machines: { from: [], to: [] } },
904
- { id: "j2", task: "Finish blanks", start: some(new Date("2026-02-18T00:00:00Z")), level: variant("day", null), started: some(new Date("2026-02-19T07:30:00Z")), status: "IN PROGRESS", orderCode: "WO-26001", machines: { from: [], to: [variant("range", { from: "M2140", to: "M2143" })] } },
905
- { id: "j3", task: "Changeover", start: some(new Date("2026-02-19T14:00:00Z")), level: variant("time", null), started: none, status: "RELEASED", orderCode: "WO-26002", machines: { from: [], to: [] } },
906
- ]));
907
- // Until a row has an order code it may only be planned or released.
908
- const statusOptions = $.const(East.function([Ctx], OptionType(ArrayType(StringType)), ($, ctx) => {
909
- const whole = $.const(none, OptionType(ArrayType(StringType)));
910
- const early = $.const(some(["PLANNED", "RELEASED"]), OptionType(ArrayType(StringType)));
911
- return ctx.row.orderCode.match({ value: (_$2, code) => code.length().equal(0n).ifElse(() => early, () => whole) }, () => early);
912
- }));
913
- return (_jsx(Sheet, { data: jobs, id: "id", registers: {
914
- statuses: Sheet.register.members(statuses, { kind: "status", key: s => s.word, label: s => s.word, tone: s => some(s.tone) }),
915
- machines: Sheet.register.members(machines, { kind: "machine", key: m => m, label: m => m }),
916
- }, columns: {
917
- task: Sheet.column.text(JobType, { header: "Task", width: "180px" }),
918
- start: Sheet.column.date(JobType, { header: "Start", sub: "at the row's level", width: "168px", level: r => r.level, actual: r => r.started }),
919
- status: Sheet.column.enum(JobType, "statuses", { header: "Status", width: "132px", options: statusOptions, detail: r => r.orderCode }),
920
- machines: Sheet.column.set(JobType, "machines", { header: "Machines", sub: "M2140-43 · a run", width: "220px",
921
- members: [{ kind: "machine", identified: true, ranged: true }] }),
922
- }, newRow: East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, {
923
- level: variant("day", null), started: none, orderCode: "", machines: { from: noMembers, to: noMembers },
924
- })), onUpdate: jobs.write, blanks: 4n }));
925
- } }))),
926
- inputs: [],
927
- });
928
- /**
929
- * Registers and the driver (§3.3) — a register is the grammar's vocabulary,
930
- * projected from the host's rows by accessors: machines from an Array with a
931
- * meta and a parent, lines from a Dict whose key rides as the accessors'
932
- * second argument, and the machine families read off the same machines (the
933
- * lathes fold into one member), joined into the one register the Machines
934
- * column resolves against. The driver is the `lookup` column whose member
935
- * decides what the row does: its row gives the quantity its unit and the End
936
- * fill its duration.
937
- */
938
- export const sheetRegisters = example({
939
- keywords: ["Sheet", "register", "members", "concat", "driver", "lookup", "set", "kind", "key", "label", "aliases", "meta", "parent", "Dict", "fold", "duplicate", "uom", "fill", "DraftContext", "Reactive", "State"],
940
- description: "Registers and the driver — members projected from Array and Dict rows (meta, parent, aliases, duplicate keys folded) and joined into one register a set column resolves against, beside a driver whose row gives each quantity its unit and a fill its duration",
941
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
942
- const JobType = StructType({
943
- id: StringType, activity: StringType, start: OptionType(DateTimeType), end: OptionType(DateTimeType),
944
- qty: OptionType(FloatType), machines: Sheet.Types.Link,
945
- });
946
- const ActivityType = StructType({ name: StringType, uom: StringType, days: IntegerType });
947
- const MachineType = StructType({ code: StringType, family: StringType, line: StringType });
948
- const LineType = StructType({ name: StringType, aliases: ArrayType(StringType) });
949
- const activities = $.const([
950
- { name: "Machining", uom: "pcs", days: 4n },
951
- { name: "Inspection", uom: "lots", days: 1n },
952
- ], ArrayType(ActivityType));
953
- const machines = $.const([
954
- { code: "M2140", family: "CNC lathe", line: "L2" },
955
- { code: "M2141", family: "CNC lathe", line: "L2" },
956
- { code: "M3210", family: "5-axis mill", line: "L3" },
957
- ], ArrayType(MachineType));
958
- const lines = $.const(new Map([
959
- ["L2", { name: "Line 2", aliases: ["l2", "line 2"] }],
960
- ["L3", { name: "Line 3", aliases: ["l3", "line 3"] }],
961
- ]), DictType(StringType, LineType));
962
- const jobs = $.let(State.bind([ArrayType(JobType)], "sheet_registers_jobs", [
963
- { id: "j1", activity: "Machining", start: some(new Date("2026-02-16T00:00:00Z")), end: none, qty: some(1200.0),
964
- machines: { from: [], to: [variant("counted", { n: 2n, key: "CNC lathe" })] } },
965
- ]));
966
- // The driver's row reaches a fill typed: End = Start + the activity's days.
967
- const DateFill = OptionType(Sheet.Types.Fill(DateTimeType));
968
- const endFromStart = $.const(East.function([Sheet.Types.DraftContext(JobType, ActivityType)], DateFill, ($, ctx) => {
969
- const noFill = $.const(none, DateFill);
970
- return ctx.row.start.match({
971
- value: (_$, supplied) => supplied.match({
972
- none: () => noFill,
973
- some: (_$, start) => ctx.driver.match({
974
- none: () => noFill,
975
- some: (_$, d) => some({ value: start.addDays(d.days), meta: East.str `+${d.days}d · ${d.name}` }),
976
- }),
977
- }),
978
- }, () => noFill);
979
- }));
980
- const newJob = $.const(East.function([Sheet.Types.NewRow], Sheet.Types.Patch(JobType), () => Sheet.patch(JobType, { machines: { from: [], to: [] } })));
981
- return (_jsx(Sheet, { data: jobs, id: "id", driver: Sheet.driver("activity", activities, { key: a => a.name, label: a => a.name, meta: a => some(a.uom) }), registers: {
982
- machines: Sheet.register.concat([
983
- Sheet.register.members(machines, { kind: "machine", key: m => m.code, label: m => m.code,
984
- meta: m => some(m.family), parent: m => some(m.line) }),
985
- // A Dict's key rides as the accessors' second argument.
986
- Sheet.register.members(lines, { kind: "line", key: (_l, code) => code, label: l => l.name, aliases: l => l.aliases }),
987
- // Both lathes name one family — duplicate keys fold, the first wins.
988
- Sheet.register.members(machines, { kind: "family", key: m => m.family, label: m => m.family, meta: _m => some("family") }),
989
- ]),
990
- }, columns: {
991
- activity: Sheet.column.lookup(JobType, { header: "Activity", width: "140px" }),
992
- start: Sheet.column.date(JobType, { header: "Start", width: "96px" }),
993
- end: Sheet.column.date(JobType, { header: "End", sub: "start + days", width: "96px", base: "start", fill: [endFromStart] }),
994
- qty: Sheet.column.quantity(JobType, ActivityType, { header: "Qty", sub: "uom per activity", width: "112px", uom: d => d.uom }),
995
- machines: Sheet.column.set(JobType, "machines", { header: "Machines", sub: "M2140 · 2 x lathe · line 2", width: "240px",
996
- members: [{ kind: "machine", identified: true }, { kind: "line", countable: true, resolvesTo: "machine" },
997
- { kind: "family", countable: true, resolvesTo: "machine" }] }),
998
- }, newRow: newJob, onUpdate: jobs.write }));
999
- } }))),
1000
- inputs: [],
1001
- });
1002
- /**
1003
- * Loose rows between the groups (#846) — the source holds entries
1004
- * `Sheet.Types.Entry(PackageType, "tasks")`: a work package with its tasks,
1005
- * or a task that belongs to no package. A loose task draws as a plain row,
1006
- * numbered in the packages' sequence; the seam above a package's band, or
1007
- * beside a loose task, inserts a loose task, and a task's seam inserts a task
1008
- * into its package. `id` names a field of both types: a loose task is an
1009
- * entry, identified like a package.
1010
- */
1011
- export const sheetLoose = example({
1012
- keywords: ["Sheet", "group", "grouped", "loose", "ungrouped", "Entry", "Types.Entry", "variant", "entries", "insert", "newRow", "newGroup", "noun", "onUpdate", "Reactive", "State"],
1013
- description: "Loose rows between the groups — entries of work packages and loose tasks: a loose task is a plain row numbered in the packages' sequence, inserted at the seam above a package or beside another loose task",
1014
- fn: East.function([], UIComponentType, (_$) => (_jsx(Reactive, { children: $ => {
1015
- const TaskType = StructType({ id: StringType, task: StringType, qty: OptionType(FloatType), notes: StringType });
1016
- const PackageType = StructType({ id: StringType, name: StringType, tasks: ArrayType(TaskType) });
1017
- const Entry = Sheet.Types.Entry(PackageType, "tasks");
1018
- const entries = $.let(State.bind([ArrayType(Entry)], "sheet_loose_entries", [
1019
- variant("row", { id: "brief", task: "Review the drawings", qty: none, notes: "Before any machining" }),
1020
- variant("group", { id: "roughing", name: "P-40 · Roughing", tasks: [
1021
- { id: "rough-1", task: "Machine blanks", qty: some(1200.0), notes: "Four CNC lathes" },
1022
- { id: "rough-2", task: "Inspect lots", qty: some(4.0), notes: "Check before finishing" },
1023
- ] }),
1024
- variant("row", { id: "handover", task: "Hand over to finishing", qty: none, notes: "" }),
1025
- variant("group", { id: "finishing", name: "P-40 · Finishing", tasks: [
1026
- { id: "finish-1", task: "Finish housings", qty: some(1200.0), notes: "After inspection" },
1027
- ] }),
1028
- ]));
1029
- const saved = $.let(entries.read());
1030
- const newTask = $.const(East.function([Sheet.Types.NewRow], Sheet.Types.Patch(TaskType), () => Sheet.patch(TaskType, { notes: "" })));
1031
- const newPackage = $.const(East.function([Sheet.Types.NewGroup], Sheet.Types.Patch(PackageType), () => Sheet.patch(PackageType, { tasks: [] })));
1032
- return (_jsxs(VStack, { gap: "3", align: "stretch", children: [_jsx(Text, { textStyle: "caption", color: "fg.muted", children: "Hover the seam above a package, or beside a loose task, to insert a loose task; a task's seam inserts a task into its package. Apply changes saves the batch." }), _jsx(Sheet, { data: entries, id: "id", group: Sheet.group(PackageType, "tasks", { title: "name", noun: { singular: "package", plural: "packages" } }), columns: {
1033
- task: Sheet.column.text(TaskType, { header: "Task", width: "240px" }),
1034
- qty: Sheet.column.quantity(TaskType, { header: "Qty", width: "112px" }),
1035
- notes: Sheet.column.text(TaskType, { header: "Notes", width: "280px" }),
1036
- }, newRow: newTask, newGroup: newPackage, onUpdate: entries.write, style: { height: "420px" } }), _jsx(Text.MonoLabel, { children: East.str `SAVED · ${saved.filter((_$, e) => e.hasTag("group")).length()} packages · ${saved.filter((_$, e) => e.hasTag("row")).length()} loose tasks` })] }));
1037
- } }))),
1038
- inputs: [],
1039
- });
1040
- //# sourceMappingURL=sheet.examples.js.map