@elaraai/e3-ui 1.0.86 → 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 (385) hide show
  1. package/dist/src/bind/data-indexed.d.ts +159 -0
  2. package/dist/src/bind/data-indexed.d.ts.map +1 -0
  3. package/dist/src/bind/data-indexed.js +105 -0
  4. package/dist/src/bind/data-indexed.js.map +1 -0
  5. package/dist/src/bind/data.d.ts +5 -3
  6. package/dist/src/bind/data.d.ts.map +1 -1
  7. package/dist/src/bind/data.js +6 -0
  8. package/dist/src/bind/data.js.map +1 -1
  9. package/dist/src/bind/record.d.ts +34 -23
  10. package/dist/src/bind/record.d.ts.map +1 -1
  11. package/dist/src/bind/record.js +46 -19
  12. package/dist/src/bind/record.js.map +1 -1
  13. package/dist/src/calendar/index.d.ts +2923 -0
  14. package/dist/src/calendar/index.d.ts.map +1 -0
  15. package/dist/src/calendar/index.js +135 -0
  16. package/dist/src/calendar/index.js.map +1 -0
  17. package/dist/src/decision/queue.d.ts +3 -3
  18. package/dist/src/decision/queue.d.ts.map +1 -1
  19. package/dist/src/decision/queue.js +2 -2
  20. package/dist/src/decision/queue.js.map +1 -1
  21. package/dist/src/decision/types.d.ts +4 -0
  22. package/dist/src/decision/types.d.ts.map +1 -1
  23. package/dist/src/decision/types.js +4 -0
  24. package/dist/src/decision/types.js.map +1 -1
  25. package/dist/src/flowchart/canvas.d.ts +114 -0
  26. package/dist/src/flowchart/canvas.d.ts.map +1 -0
  27. package/dist/src/flowchart/canvas.js +84 -0
  28. package/dist/src/flowchart/canvas.js.map +1 -0
  29. package/dist/src/flowchart/flowchart.d.ts +79 -0
  30. package/dist/src/flowchart/flowchart.d.ts.map +1 -0
  31. package/dist/src/flowchart/flowchart.js +9 -0
  32. package/dist/src/flowchart/flowchart.js.map +1 -0
  33. package/dist/src/flowchart/index.d.ts +305 -0
  34. package/dist/src/flowchart/index.d.ts.map +1 -0
  35. package/dist/src/flowchart/index.js +267 -0
  36. package/dist/src/flowchart/index.js.map +1 -0
  37. package/dist/src/flowchart/library.d.ts +720 -0
  38. package/dist/src/flowchart/library.d.ts.map +1 -0
  39. package/dist/src/flowchart/library.js +611 -0
  40. package/dist/src/flowchart/library.js.map +1 -0
  41. package/dist/src/flowchart/over.d.ts +234 -0
  42. package/dist/src/flowchart/over.d.ts.map +1 -0
  43. package/dist/src/flowchart/over.js +220 -0
  44. package/dist/src/flowchart/over.js.map +1 -0
  45. package/dist/src/flowchart/patch.d.ts +64 -0
  46. package/dist/src/flowchart/patch.d.ts.map +1 -0
  47. package/dist/src/flowchart/patch.js +67 -0
  48. package/dist/src/flowchart/patch.js.map +1 -0
  49. package/dist/src/flowchart/payload.d.ts +8220 -0
  50. package/dist/src/flowchart/payload.d.ts.map +1 -0
  51. package/dist/src/flowchart/payload.js +521 -0
  52. package/dist/src/flowchart/payload.js.map +1 -0
  53. package/dist/src/flowchart/types.d.ts +393 -0
  54. package/dist/src/flowchart/types.d.ts.map +1 -0
  55. package/dist/src/flowchart/types.js +216 -0
  56. package/dist/src/flowchart/types.js.map +1 -0
  57. package/dist/src/flowchart/values.d.ts +267 -0
  58. package/dist/src/flowchart/values.d.ts.map +1 -0
  59. package/dist/src/flowchart/values.js +216 -0
  60. package/dist/src/flowchart/values.js.map +1 -0
  61. package/dist/src/flowchart/window.d.ts +521 -0
  62. package/dist/src/flowchart/window.d.ts.map +1 -0
  63. package/dist/src/flowchart/window.js +69 -0
  64. package/dist/src/flowchart/window.js.map +1 -0
  65. package/dist/src/index.d.ts +25 -1
  66. package/dist/src/index.d.ts.map +1 -1
  67. package/dist/src/index.js +48 -1
  68. package/dist/src/index.js.map +1 -1
  69. package/dist/src/internal.d.ts +35 -3
  70. package/dist/src/internal.d.ts.map +1 -1
  71. package/dist/src/internal.js +72 -3
  72. package/dist/src/internal.js.map +1 -1
  73. package/dist/src/plan/assemble.d.ts +2224 -0
  74. package/dist/src/plan/assemble.d.ts.map +1 -0
  75. package/dist/src/plan/assemble.js +210 -0
  76. package/dist/src/plan/assemble.js.map +1 -0
  77. package/dist/src/plan/builders.d.ts +790 -0
  78. package/dist/src/plan/builders.d.ts.map +1 -0
  79. package/dist/src/plan/builders.js +749 -0
  80. package/dist/src/plan/builders.js.map +1 -0
  81. package/dist/src/plan/event-rows.d.ts +2565 -0
  82. package/dist/src/plan/event-rows.d.ts.map +1 -0
  83. package/dist/src/plan/event-rows.js +689 -0
  84. package/dist/src/plan/event-rows.js.map +1 -0
  85. package/dist/src/plan/factories.d.ts +458 -0
  86. package/dist/src/plan/factories.d.ts.map +1 -0
  87. package/dist/src/plan/factories.js +484 -0
  88. package/dist/src/plan/factories.js.map +1 -0
  89. package/dist/src/plan/index.d.ts +672 -0
  90. package/dist/src/plan/index.d.ts.map +1 -0
  91. package/dist/src/plan/index.js +532 -0
  92. package/dist/src/plan/index.js.map +1 -0
  93. package/dist/src/plan/ir.d.ts +2594 -0
  94. package/dist/src/plan/ir.d.ts.map +1 -0
  95. package/dist/src/plan/ir.js +78 -0
  96. package/dist/src/plan/ir.js.map +1 -0
  97. package/dist/src/plan/library.d.ts +772 -0
  98. package/dist/src/plan/library.d.ts.map +1 -0
  99. package/dist/src/plan/library.js +424 -0
  100. package/dist/src/plan/library.js.map +1 -0
  101. package/dist/src/plan/ordered-source.d.ts +27 -0
  102. package/dist/src/plan/ordered-source.d.ts.map +1 -0
  103. package/dist/src/plan/ordered-source.js +48 -0
  104. package/dist/src/plan/ordered-source.js.map +1 -0
  105. package/dist/src/plan/over.d.ts +247 -0
  106. package/dist/src/plan/over.d.ts.map +1 -0
  107. package/dist/src/plan/over.js +266 -0
  108. package/dist/src/plan/over.js.map +1 -0
  109. package/dist/src/plan/pick.d.ts +78 -0
  110. package/dist/src/plan/pick.d.ts.map +1 -0
  111. package/dist/src/plan/pick.js +146 -0
  112. package/dist/src/plan/pick.js.map +1 -0
  113. package/dist/src/plan/plan.d.ts +11611 -0
  114. package/dist/src/plan/plan.d.ts.map +1 -0
  115. package/dist/src/plan/plan.js +428 -0
  116. package/dist/src/plan/plan.js.map +1 -0
  117. package/dist/src/plan/refs.d.ts +218 -0
  118. package/dist/src/plan/refs.d.ts.map +1 -0
  119. package/dist/src/plan/refs.js +226 -0
  120. package/dist/src/plan/refs.js.map +1 -0
  121. package/dist/src/plan/root.d.ts +290 -0
  122. package/dist/src/plan/root.d.ts.map +1 -0
  123. package/dist/src/plan/root.js +463 -0
  124. package/dist/src/plan/root.js.map +1 -0
  125. package/dist/src/plan/series.d.ts +13554 -0
  126. package/dist/src/plan/series.d.ts.map +1 -0
  127. package/dist/src/plan/series.js +1921 -0
  128. package/dist/src/plan/series.js.map +1 -0
  129. package/dist/src/plan/types.d.ts +12400 -0
  130. package/dist/src/plan/types.d.ts.map +1 -0
  131. package/dist/src/plan/types.js +1335 -0
  132. package/dist/src/plan/types.js.map +1 -0
  133. package/dist/src/roster/coverage.d.ts +240 -0
  134. package/dist/src/roster/coverage.d.ts.map +1 -0
  135. package/dist/src/roster/coverage.js +109 -0
  136. package/dist/src/roster/coverage.js.map +1 -0
  137. package/dist/src/roster/index.d.ts +4028 -0
  138. package/dist/src/roster/index.d.ts.map +1 -0
  139. package/dist/src/roster/index.js +115 -0
  140. package/dist/src/roster/index.js.map +1 -0
  141. package/dist/src/roster/library.d.ts +106 -0
  142. package/dist/src/roster/library.d.ts.map +1 -0
  143. package/dist/src/roster/library.js +78 -0
  144. package/dist/src/roster/library.js.map +1 -0
  145. package/dist/src/roster/people.d.ts +50 -0
  146. package/dist/src/roster/people.d.ts.map +1 -0
  147. package/dist/src/roster/people.js +32 -0
  148. package/dist/src/roster/people.js.map +1 -0
  149. package/dist/src/roster/rules.d.ts +275 -0
  150. package/dist/src/roster/rules.d.ts.map +1 -0
  151. package/dist/src/roster/rules.js +162 -0
  152. package/dist/src/roster/rules.js.map +1 -0
  153. package/dist/src/roster/types.d.ts +672 -0
  154. package/dist/src/roster/types.d.ts.map +1 -0
  155. package/dist/src/roster/types.js +248 -0
  156. package/dist/src/roster/types.js.map +1 -0
  157. package/dist/src/roster/visibility.d.ts +66 -0
  158. package/dist/src/roster/visibility.d.ts.map +1 -0
  159. package/dist/src/roster/visibility.js +25 -0
  160. package/dist/src/roster/visibility.js.map +1 -0
  161. package/dist/src/schedule/days.d.ts +54 -0
  162. package/dist/src/schedule/days.d.ts.map +1 -0
  163. package/dist/src/schedule/days.js +68 -0
  164. package/dist/src/schedule/days.js.map +1 -0
  165. package/dist/src/schedule/events.d.ts +433 -0
  166. package/dist/src/schedule/events.d.ts.map +1 -0
  167. package/dist/src/schedule/events.js +851 -0
  168. package/dist/src/schedule/events.js.map +1 -0
  169. package/dist/src/schedule/index.d.ts +150 -0
  170. package/dist/src/schedule/index.d.ts.map +1 -0
  171. package/dist/src/schedule/index.js +132 -0
  172. package/dist/src/schedule/index.js.map +1 -0
  173. package/dist/src/schedule/library.d.ts +70 -0
  174. package/dist/src/schedule/library.d.ts.map +1 -0
  175. package/dist/src/schedule/library.js +102 -0
  176. package/dist/src/schedule/library.js.map +1 -0
  177. package/dist/src/schedule/patch.d.ts +74 -0
  178. package/dist/src/schedule/patch.d.ts.map +1 -0
  179. package/dist/src/schedule/patch.js +68 -0
  180. package/dist/src/schedule/patch.js.map +1 -0
  181. package/dist/src/schedule/record-window.d.ts +189 -0
  182. package/dist/src/schedule/record-window.d.ts.map +1 -0
  183. package/dist/src/schedule/record-window.js +95 -0
  184. package/dist/src/schedule/record-window.js.map +1 -0
  185. package/dist/src/schedule/resources.d.ts +165 -0
  186. package/dist/src/schedule/resources.d.ts.map +1 -0
  187. package/dist/src/schedule/resources.js +234 -0
  188. package/dist/src/schedule/resources.js.map +1 -0
  189. package/dist/src/schedule/templates.d.ts +47 -0
  190. package/dist/src/schedule/templates.d.ts.map +1 -0
  191. package/dist/src/schedule/templates.js +61 -0
  192. package/dist/src/schedule/templates.js.map +1 -0
  193. package/dist/src/schedule/types.d.ts +1677 -0
  194. package/dist/src/schedule/types.d.ts.map +1 -0
  195. package/dist/src/schedule/types.js +374 -0
  196. package/dist/src/schedule/types.js.map +1 -0
  197. package/dist/src/schedule/window.d.ts +154 -0
  198. package/dist/src/schedule/window.d.ts.map +1 -0
  199. package/dist/src/schedule/window.js +363 -0
  200. package/dist/src/schedule/window.js.map +1 -0
  201. package/dist/src/sheet/bridge.d.ts +385 -0
  202. package/dist/src/sheet/bridge.d.ts.map +1 -0
  203. package/dist/src/sheet/bridge.js +809 -0
  204. package/dist/src/sheet/bridge.js.map +1 -0
  205. package/dist/src/sheet/columns.d.ts +410 -0
  206. package/dist/src/sheet/columns.d.ts.map +1 -0
  207. package/dist/src/sheet/columns.js +99 -0
  208. package/dist/src/sheet/columns.js.map +1 -0
  209. package/dist/src/sheet/context-bridge.d.ts +48 -0
  210. package/dist/src/sheet/context-bridge.d.ts.map +1 -0
  211. package/dist/src/sheet/context-bridge.js +216 -0
  212. package/dist/src/sheet/context-bridge.js.map +1 -0
  213. package/dist/src/sheet/draft-bridge.d.ts +37 -0
  214. package/dist/src/sheet/draft-bridge.d.ts.map +1 -0
  215. package/dist/src/sheet/draft-bridge.js +153 -0
  216. package/dist/src/sheet/draft-bridge.js.map +1 -0
  217. package/dist/src/sheet/drafts.d.ts +14 -0
  218. package/dist/src/sheet/drafts.d.ts.map +1 -0
  219. package/dist/src/sheet/drafts.js +14 -0
  220. package/dist/src/sheet/drafts.js.map +1 -0
  221. package/dist/src/sheet/editing-bridge.d.ts +40 -0
  222. package/dist/src/sheet/editing-bridge.d.ts.map +1 -0
  223. package/dist/src/sheet/editing-bridge.js +231 -0
  224. package/dist/src/sheet/editing-bridge.js.map +1 -0
  225. package/dist/src/sheet/editing-types.d.ts +268 -0
  226. package/dist/src/sheet/editing-types.d.ts.map +1 -0
  227. package/dist/src/sheet/editing-types.js +34 -0
  228. package/dist/src/sheet/editing-types.js.map +1 -0
  229. package/dist/src/sheet/edits.d.ts +37 -0
  230. package/dist/src/sheet/edits.d.ts.map +1 -0
  231. package/dist/src/sheet/edits.js +31 -0
  232. package/dist/src/sheet/edits.js.map +1 -0
  233. package/dist/src/sheet/fields.d.ts +693 -0
  234. package/dist/src/sheet/fields.d.ts.map +1 -0
  235. package/dist/src/sheet/fields.js +280 -0
  236. package/dist/src/sheet/fields.js.map +1 -0
  237. package/dist/src/sheet/group.d.ts +165 -0
  238. package/dist/src/sheet/group.d.ts.map +1 -0
  239. package/dist/src/sheet/group.js +52 -0
  240. package/dist/src/sheet/group.js.map +1 -0
  241. package/dist/src/sheet/index.d.ts +542 -0
  242. package/dist/src/sheet/index.d.ts.map +1 -0
  243. package/dist/src/sheet/index.js +387 -0
  244. package/dist/src/sheet/index.js.map +1 -0
  245. package/dist/src/sheet/library.d.ts +284 -0
  246. package/dist/src/sheet/library.d.ts.map +1 -0
  247. package/dist/src/sheet/library.js +259 -0
  248. package/dist/src/sheet/library.js.map +1 -0
  249. package/dist/src/sheet/link.d.ts +398 -0
  250. package/dist/src/sheet/link.d.ts.map +1 -0
  251. package/dist/src/sheet/link.js +228 -0
  252. package/dist/src/sheet/link.js.map +1 -0
  253. package/dist/src/sheet/record.d.ts +75 -0
  254. package/dist/src/sheet/record.d.ts.map +1 -0
  255. package/dist/src/sheet/record.js +128 -0
  256. package/dist/src/sheet/record.js.map +1 -0
  257. package/dist/src/sheet/registers.d.ts +681 -0
  258. package/dist/src/sheet/registers.d.ts.map +1 -0
  259. package/dist/src/sheet/registers.js +671 -0
  260. package/dist/src/sheet/registers.js.map +1 -0
  261. package/dist/src/sheet/root.d.ts +329 -0
  262. package/dist/src/sheet/root.d.ts.map +1 -0
  263. package/dist/src/sheet/root.js +511 -0
  264. package/dist/src/sheet/root.js.map +1 -0
  265. package/dist/src/sheet/seed-bridge.d.ts +14 -0
  266. package/dist/src/sheet/seed-bridge.d.ts.map +1 -0
  267. package/dist/src/sheet/seed-bridge.js +51 -0
  268. package/dist/src/sheet/seed-bridge.js.map +1 -0
  269. package/dist/src/sheet/sheet.d.ts +11819 -0
  270. package/dist/src/sheet/sheet.d.ts.map +1 -0
  271. package/dist/src/sheet/sheet.js +236 -0
  272. package/dist/src/sheet/sheet.js.map +1 -0
  273. package/dist/src/sheet/sub-rows.d.ts +299 -0
  274. package/dist/src/sheet/sub-rows.d.ts.map +1 -0
  275. package/dist/src/sheet/sub-rows.js +272 -0
  276. package/dist/src/sheet/sub-rows.js.map +1 -0
  277. package/dist/src/sheet/templates.d.ts +161 -0
  278. package/dist/src/sheet/templates.d.ts.map +1 -0
  279. package/dist/src/sheet/templates.js +122 -0
  280. package/dist/src/sheet/templates.js.map +1 -0
  281. package/dist/src/sheet/transactions.d.ts +76 -0
  282. package/dist/src/sheet/transactions.d.ts.map +1 -0
  283. package/dist/src/sheet/transactions.js +40 -0
  284. package/dist/src/sheet/transactions.js.map +1 -0
  285. package/dist/src/sheet/types.d.ts +15226 -0
  286. package/dist/src/sheet/types.d.ts.map +1 -0
  287. package/dist/src/sheet/types.js +1070 -0
  288. package/dist/src/sheet/types.js.map +1 -0
  289. package/dist/src/sheet/views.d.ts +29 -0
  290. package/dist/src/sheet/views.d.ts.map +1 -0
  291. package/dist/src/sheet/views.js +43 -0
  292. package/dist/src/sheet/views.js.map +1 -0
  293. package/dist/src/studio/component.d.ts.map +1 -1
  294. package/dist/src/studio/component.js +11 -8
  295. package/dist/src/studio/component.js.map +1 -1
  296. package/dist/src/utils/derive.d.ts +134 -8
  297. package/dist/src/utils/derive.d.ts.map +1 -1
  298. package/dist/src/utils/derive.js +409 -7
  299. package/dist/src/utils/derive.js.map +1 -1
  300. package/dist/src/utils/ordered-source.d.ts +38 -0
  301. package/dist/src/utils/ordered-source.d.ts.map +1 -0
  302. package/dist/src/utils/ordered-source.js +45 -0
  303. package/dist/src/utils/ordered-source.js.map +1 -0
  304. package/dist/src/utils/row-inspector.d.ts +36 -0
  305. package/dist/src/utils/row-inspector.d.ts.map +1 -0
  306. package/dist/src/utils/row-inspector.js +49 -0
  307. package/dist/src/utils/row-inspector.js.map +1 -0
  308. package/dist/test/bind/data/data.examples.d.ts +21 -19
  309. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  310. package/dist/test/bind/data/data.examples.js +122 -122
  311. package/dist/test/bind/data/data.examples.js.map +1 -1
  312. package/dist/test/bind/record/record.examples.d.ts.map +1 -1
  313. package/dist/test/bind/record/record.examples.js +9 -9
  314. package/dist/test/bind/record/record.examples.js.map +1 -1
  315. package/dist/test/calendar/calendar-records.examples.d.ts +228 -0
  316. package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -0
  317. package/dist/test/calendar/calendar-records.examples.js +91 -0
  318. package/dist/test/calendar/calendar-records.examples.js.map +1 -0
  319. package/dist/test/calendar/calendar.examples.d.ts +776 -0
  320. package/dist/test/calendar/calendar.examples.d.ts.map +1 -0
  321. package/dist/test/calendar/calendar.examples.js +336 -0
  322. package/dist/test/calendar/calendar.examples.js.map +1 -0
  323. package/dist/test/decision/journal.examples.d.ts +28 -28
  324. package/dist/test/decision/journal.examples.d.ts.map +1 -1
  325. package/dist/test/decision/journal.examples.js +4 -4
  326. package/dist/test/decision/journal.examples.js.map +1 -1
  327. package/dist/test/decision/queue.examples.d.ts.map +1 -1
  328. package/dist/test/decision/queue.examples.js +5 -7
  329. package/dist/test/decision/queue.examples.js.map +1 -1
  330. package/dist/test/flowchart/flowchart.examples.d.ts +3713 -0
  331. package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -0
  332. package/dist/test/flowchart/flowchart.examples.js +465 -0
  333. package/dist/test/flowchart/flowchart.examples.js.map +1 -0
  334. package/dist/test/plan/plan-events.examples.d.ts +3666 -0
  335. package/dist/test/plan/plan-events.examples.d.ts.map +1 -0
  336. package/dist/test/plan/plan-events.examples.js +773 -0
  337. package/dist/test/plan/plan-events.examples.js.map +1 -0
  338. package/dist/test/plan/plan-records.examples.d.ts +3 -0
  339. package/dist/test/plan/plan-records.examples.d.ts.map +1 -0
  340. package/dist/test/plan/plan-records.examples.js +45 -0
  341. package/dist/test/plan/plan-records.examples.js.map +1 -0
  342. package/dist/test/plan/plan-windows.examples.d.ts +588 -0
  343. package/dist/test/plan/plan-windows.examples.d.ts.map +1 -0
  344. package/dist/test/plan/plan-windows.examples.js +170 -0
  345. package/dist/test/plan/plan-windows.examples.js.map +1 -0
  346. package/dist/test/plan/plan.examples.d.ts +8095 -0
  347. package/dist/test/plan/plan.examples.d.ts.map +1 -0
  348. package/dist/test/plan/plan.examples.js +2500 -0
  349. package/dist/test/plan/plan.examples.js.map +1 -0
  350. package/dist/test/roster/domain.examples.d.ts +367 -0
  351. package/dist/test/roster/domain.examples.d.ts.map +1 -0
  352. package/dist/test/roster/domain.examples.js +72 -0
  353. package/dist/test/roster/domain.examples.js.map +1 -0
  354. package/dist/test/roster/roster-records.examples.d.ts +729 -0
  355. package/dist/test/roster/roster-records.examples.d.ts.map +1 -0
  356. package/dist/test/roster/roster-records.examples.js +86 -0
  357. package/dist/test/roster/roster-records.examples.js.map +1 -0
  358. package/dist/test/roster/roster.examples.d.ts +750 -0
  359. package/dist/test/roster/roster.examples.d.ts.map +1 -0
  360. package/dist/test/roster/roster.examples.js +198 -0
  361. package/dist/test/roster/roster.examples.js.map +1 -0
  362. package/dist/test/roster/warehouse.d.ts +87 -0
  363. package/dist/test/roster/warehouse.d.ts.map +1 -0
  364. package/dist/test/roster/warehouse.js +883 -0
  365. package/dist/test/roster/warehouse.js.map +1 -0
  366. package/dist/test/sheet/sheet-link.examples.d.ts +7 -0
  367. package/dist/test/sheet/sheet-link.examples.d.ts.map +1 -0
  368. package/dist/test/sheet/sheet-link.examples.js +41 -0
  369. package/dist/test/sheet/sheet-link.examples.js.map +1 -0
  370. package/dist/test/sheet/sheet-records.examples.d.ts +421 -0
  371. package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -0
  372. package/dist/test/sheet/sheet-records.examples.js +79 -0
  373. package/dist/test/sheet/sheet-records.examples.js.map +1 -0
  374. package/dist/test/sheet/sheet-transactions.examples.d.ts +7 -0
  375. package/dist/test/sheet/sheet-transactions.examples.d.ts.map +1 -0
  376. package/dist/test/sheet/sheet-transactions.examples.js +58 -0
  377. package/dist/test/sheet/sheet-transactions.examples.js.map +1 -0
  378. package/dist/test/sheet/sheet.examples.d.ts +5562 -0
  379. package/dist/test/sheet/sheet.examples.d.ts.map +1 -0
  380. package/dist/test/sheet/sheet.examples.js +1178 -0
  381. package/dist/test/sheet/sheet.examples.js.map +1 -0
  382. package/dist/test/studio/studio.examples.d.ts.map +1 -1
  383. package/dist/test/studio/studio.examples.js +11 -11
  384. package/dist/test/studio/studio.examples.js.map +1 -1
  385. package/package.json +12 -9
@@ -0,0 +1,689 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Events into rows (#1192, `Plan Builder Spec.md` §9.4, PB12–PB18): the
7
+ * resources' rows a Plan of event kinds draws over a window, every kind's
8
+ * drafts in place — the payload's `blocks`.
9
+ *
10
+ * The rows are series' rows (#822), with the events joined in, so they are
11
+ * derived the way every other row of the canvas is. Each resource kind is a
12
+ * `Plan.series.views` over its resources: one member per way the event kinds
13
+ * placed on it draw (bars, tiles, chips, marks, in that order), each element
14
+ * an event in the window wearing its kind's icon, then the kind's measures,
15
+ * each applied to the resource's row (PB12, PB13). A resource that names
16
+ * another of its kind as its parent nests under it, and the parent's bars roll
17
+ * its children's up (PB14, #1219); a kind with `group` sits under its group
18
+ * strips. A row's id is its series' key and its path (PB15):
19
+ * `entry { series: "<kind>.<draw>", path: [group?, …parents, key] }`, a
20
+ * measure's its own key, a strip's `"<kind>.group"`.
21
+ *
22
+ * An event whose resource is none, or names a resource its kind does not have,
23
+ * draws on its kind's Unassigned row, after every resource kind (PB16). Every
24
+ * kind's events are read with its drafts in place, so a draft draws as Save
25
+ * would leave it (PB17).
26
+ *
27
+ * Every block is fixed: no entry of the canvas's `data` makes these rows, so a
28
+ * paged canvas serves them with every window and draws them once.
29
+ *
30
+ * What a viewer hides in the library's Series tab stays out (PB29, #1195): a
31
+ * hidden event kind is not read, so its elements draw nowhere, its Unassigned
32
+ * row included, and a row only hidden kinds draw on goes with them; a hidden
33
+ * resource kind draws no rows; a hidden measure no row under each resource. A
34
+ * resource's first row is its own, and stays while its kind shows.
35
+ *
36
+ * A resource kind given its resources as a paged read (#1199, PB55) is PAGED,
37
+ * as a paged canvas pages its blocks: its rows come a window of resources at a
38
+ * time as the canvas scrolls, through the payload's `paged`
39
+ * ({@link createEventPaged}), and the key search seeks a resource by its key. The `blocks` seam keeps its
40
+ * place among the kinds' blocks with an empty paged block (`fixed: false`,
41
+ * the one block it serves that is not fixed) and never reads its resources;
42
+ * the events placed on them are read with the rest, by way of drawing and by
43
+ * the resource's key (`placed`), and each window of its resources draws the
44
+ * ones placed on it (`rows`). An event on a paged kind is never on the
45
+ * Unassigned row: whether the kind has its resource would take every window
46
+ * to know, so an event naming a resource it has not draws nowhere.
47
+ *
48
+ * @packageDocumentation
49
+ */
50
+ import { ArrayType, BooleanType, DateTimeType, DictType, East, FunctionType, IntegerType, NullType, OptionType, SetType, StringType, StructType, none, some, variant, } from "@elaraai/east";
51
+ import { IconType, PickStateType, SeekQueryType, SeekRangeType, StatusValueType } from "@elaraai/east-ui";
52
+ import { buildPagedWindow, resolveRowSource } from "@elaraai/east-ui/internal";
53
+ import { PlanEventItemType, PlanEventKindType, ScheduleDraftsType, ScheduleEventRefType, ScheduleStatusType } from "../schedule/types.js";
54
+ import { PlanBlockType, PlanBlocksType, PlanBucketEventType, PlanChipType, PlanEventMarkKindType, PlanEventMarkType, PlanLaneType, PlanRollupType, PlanRowIdType, PlanRowsCollectionType, PlanRunType, } from "./types.js";
55
+ import { planGutter, planRow } from "./assemble.js";
56
+ import { bucketsKind, cardsKind, eventsKind, spanKind } from "./factories.js";
57
+ import { planHideId } from "./library.js";
58
+ import { applySeries, createChildren, createSeriesBuckets, createSeriesCards, createSeriesEvents, createSeriesGroup, createSeriesSpan, createSeriesViews, planSeriesFacts, } from "./series.js";
59
+ // ============================================================================
60
+ // The seam
61
+ // ============================================================================
62
+ /**
63
+ * Every event kind's drafts, by the kind's slot, then by entry id — each the
64
+ * entry's draft as bytes, as a kind's seams read them.
65
+ */
66
+ export const PlanEventDraftsType = DictType(StringType, ScheduleDraftsType);
67
+ /**
68
+ * The resources' rows over a window, every event kind's drafts in place
69
+ * (#1192): `(from, to, drafts by kind, then by entry id, the ids the viewer
70
+ * hides)` → the canvas's blocks, `none` while a kind's read is in flight. The
71
+ * hidden ids are the library's Series tab's (#1195): `resources.<slot>`,
72
+ * `events.<slot>` and `measures.<key>` stay out, and the rest are not this
73
+ * seam's. A paged resource kind's place (#1199) is an empty block that is not
74
+ * fixed, which the payload's `paged` fills a window at a time.
75
+ */
76
+ export const PlanEventBlocksType = FunctionType([DateTimeType, DateTimeType, PlanEventDraftsType, PickStateType], OptionType(PlanBlocksType));
77
+ /** The ways a kind draws, in the order a resource's rows take them (PB12). */
78
+ const DRAW_ORDER = ["span", "buckets", "cards", "marks"];
79
+ /**
80
+ * The ways the event kinds placed on a resource kind draw, in the order its
81
+ * rows take them.
82
+ *
83
+ * @param slot - The resource kind's slot
84
+ * @param events - The event kinds, by slot
85
+ * @returns The draw styles, each once
86
+ */
87
+ export function eventDrawsOf(slot, events) {
88
+ return DRAW_ORDER.filter((d) => events.some(([, k]) => k.draw === d && k.takes.includes(slot)));
89
+ }
90
+ /**
91
+ * The names of the event kinds that draw one way on a resource kind — what
92
+ * that row of each resource is labelled with, after its first.
93
+ *
94
+ * @param slot - The resource kind's slot
95
+ * @param draw - The way they draw
96
+ * @param events - The event kinds, by slot
97
+ * @returns Their names, in `events` order
98
+ */
99
+ function kindNamesOf(slot, draw, events) {
100
+ return events.filter(([, k]) => k.draw === draw && k.takes.includes(slot)).map(([, k]) => k.name).join(", ");
101
+ }
102
+ /**
103
+ * The slots of the event kinds that draw one way on a resource kind — what
104
+ * hides that row of each resource, once every one of them is hidden.
105
+ *
106
+ * @param slot - The resource kind's slot
107
+ * @param draw - The way they draw
108
+ * @param events - The event kinds, by slot
109
+ * @returns Their slots, in `events` order
110
+ */
111
+ function kindSlotsOf(slot, draw, events) {
112
+ return events.filter(([, k]) => k.draw === draw && k.takes.includes(slot)).map(([s]) => s);
113
+ }
114
+ // ============================================================================
115
+ // Elements — one event as each way of drawing shows it
116
+ // ============================================================================
117
+ /**
118
+ * One event placed on a row: the event as Plan draws it, its two times (an
119
+ * event drawn has both), and its kind's icon.
120
+ */
121
+ const PlacedType = StructType({ item: PlanEventItemType, start: DateTimeType, end: DateTimeType, icon: IconType });
122
+ /** The events placed on one row. */
123
+ const PlacedListType = ArrayType(PlacedType);
124
+ /** The events placed on one way of drawing for each resource of a kind, by the resource key's text. */
125
+ const PlacedByKeyType = DictType(StringType, PlacedListType);
126
+ /**
127
+ * The events placed on a paged resource kind's resources (#1199): by the way
128
+ * they draw (`span`, `buckets`, `cards`, `marks`), then by the resource key's
129
+ * text — each event as Plan draws it, its two times and its kind's icon. What
130
+ * each window of the kind's resources draws on its rows.
131
+ */
132
+ export const PlanEventPlacedType = DictType(StringType, PlacedByKeyType);
133
+ /**
134
+ * An element's key: its event, as East prints a `Schedule.Types.EventRef`
135
+ * (`printFor`) — unique on a row the kinds that draw alike share, and read
136
+ * back with `parseFor`.
137
+ */
138
+ const elementKey = East.function([PlanEventItemType], StringType, ($, item) => {
139
+ const ref = $.let({ kind: item.kind, key: item.key }, ScheduleEventRefType);
140
+ return East.print(ref);
141
+ });
142
+ /** The warning an element is ringed with: its status's, when the status's tone is a warning (`Plan Builder Spec.md` §4.1). */
143
+ const warningOf = East.function([OptionType(ScheduleStatusType)], OptionType(StatusValueType), ($, status) => {
144
+ const out = $.let(none, OptionType(StatusValueType));
145
+ $.match(status, {
146
+ some: ($2, s) => {
147
+ $2.if(s.tone.hasTag("warning"), ($3) => { $3.assign(out, some(variant("warning", null))); });
148
+ },
149
+ });
150
+ return out;
151
+ });
152
+ /** The events as bars. */
153
+ const placedRuns = East.function([PlacedListType], ArrayType(PlanRunType), ($, list) => {
154
+ const keyOf = $.const(elementKey);
155
+ const ring = $.const(warningOf);
156
+ return list.map(($2, p) => East.value({
157
+ key: keyOf(p.item),
158
+ start: variant("time", p.start),
159
+ end: variant("time", p.end),
160
+ label: p.item.title,
161
+ quantity: p.item.quantity,
162
+ state: p.item.state,
163
+ status: ring(p.item.status),
164
+ moved: none,
165
+ icon: some(p.icon),
166
+ }, PlanRunType));
167
+ });
168
+ /** The events as tiles in their start's bucket, each in its lane. */
169
+ const placedTiles = East.function([PlacedListType], ArrayType(PlanBucketEventType), ($, list) => {
170
+ const keyOf = $.const(elementKey);
171
+ const ring = $.const(warningOf);
172
+ return list.map(($2, p) => East.value({
173
+ key: keyOf(p.item),
174
+ at: variant("time", p.start),
175
+ lane: p.item.lane,
176
+ label: some(p.item.title),
177
+ icon: some(p.icon),
178
+ state: p.item.state,
179
+ tone: ring(p.item.status),
180
+ color: none,
181
+ colorPalette: none,
182
+ stretch: none,
183
+ content: none,
184
+ animation: none,
185
+ }, PlanBucketEventType));
186
+ });
187
+ /** The events as chips over the buckets they span. */
188
+ const placedChips = East.function([PlacedListType], ArrayType(PlanChipType), ($, list) => {
189
+ const keyOf = $.const(elementKey);
190
+ return list.map(($2, p) => East.value({
191
+ key: keyOf(p.item),
192
+ from: variant("time", p.start),
193
+ to: variant("time", p.end),
194
+ label: p.item.title,
195
+ state: p.item.state,
196
+ icon: some(p.icon),
197
+ }, PlanChipType));
198
+ });
199
+ /** The events as marks at their start: an exception where a warning rings it, else a milestone. */
200
+ const placedMarks = East.function([PlacedListType], ArrayType(PlanEventMarkType), ($, list) => {
201
+ const keyOf = $.const(elementKey);
202
+ const ring = $.const(warningOf);
203
+ return list.map(($2, p) => {
204
+ const kind = $2.let(variant("milestone", null), PlanEventMarkKindType);
205
+ $2.if(ring(p.item.status).hasTag("some"), ($3) => { $3.assign(kind, variant("exception", null)); });
206
+ return East.value({
207
+ key: keyOf(p.item),
208
+ at: variant("time", p.start),
209
+ kind,
210
+ icon: some(p.icon),
211
+ label: some(p.item.title),
212
+ }, PlanEventMarkType);
213
+ });
214
+ });
215
+ /** The lanes a row's tiles sit in: each lane an event names, once, in order. */
216
+ const placedLanes = East.function([PlacedListType], ArrayType(PlanLaneType), ($, list) => {
217
+ const lanes = $.let(new Set(), SetType(StringType));
218
+ $.for(list, ($2, p) => {
219
+ $2.match(p.item.lane, { some: ($3, lane) => { $3(lanes.tryInsert(lane)); } });
220
+ });
221
+ return lanes.toArray(($2, lane) => East.value({ key: lane, label: some(lane) }, PlanLaneType));
222
+ });
223
+ /**
224
+ * One resource kind's rows over the window: its resources as a views series
225
+ * — a member per way the kinds placed on it draw, then its measures — nested
226
+ * by parent and under group strips, each block fixed. A measure the viewer
227
+ * hides draws no row, nor does a way of drawing whose kinds they all hide,
228
+ * after a resource's first row, its own.
229
+ *
230
+ * @param $ - The blocks function's scope
231
+ * @param slot - The resource kind's slot
232
+ * @param kind - The resource kind
233
+ * @param all - Its resources, read once in this scope
234
+ * @param placed - The events placed on its resources, by way of drawing
235
+ * @param events - The event kinds, by slot
236
+ * @param hidden - The ids the viewer hides
237
+ * @param fixed - Whether its blocks are fixed: the resources whole, served with every window; or a paged kind's
238
+ * window of them (#1199), which a paged canvas pages
239
+ * @returns Its blocks
240
+ */
241
+ function resourceBlocks($, slot, kind, all, placed, events, hidden, fixed = true) {
242
+ const where = `Plan: resources.${slot}`;
243
+ const keyType = kind.keyType;
244
+ const rowType = kind.rowType;
245
+ const collection = DictType(keyType, rowType);
246
+ // A resource's key as the text a placed event and a parent name it by.
247
+ const textOf = keyType.type === "String"
248
+ ? (key) => key
249
+ : (key) => East.print(key);
250
+ const resolve = $.const(kind.planRow);
251
+ const resolved = $.let(all.map(($2, row, key) => resolve(row, key)));
252
+ const noEvents = $.const([], PlacedListType);
253
+ // A resource's own row, resolved — what its first row's gutter and its collapse read.
254
+ const own = (key) => resolved.get(key);
255
+ // ── Nesting: each resource under the one its parent names (PB14) ─────
256
+ // A parent that names a resource the kind has, unless following parents
257
+ // from it comes back round: a resource on such a cycle draws at the top,
258
+ // so every resource draws once and the walk ends.
259
+ let roots = all;
260
+ let children;
261
+ if (kind.nested) {
262
+ const byText = $.let(new Map(), DictType(StringType, keyType));
263
+ $.for(all, ($2, _row, key) => { $2(byText.insert(textOf(key), key)); });
264
+ const parentOf = $.let(new Map(), DictType(StringType, StringType));
265
+ $.for(resolved, ($2, row, key) => {
266
+ const parent = row.parent;
267
+ $2.match(parent, {
268
+ some: ($3, p) => { $3.if(byText.has(p), ($4) => { $4(parentOf.insert(textOf(key), p)); }); },
269
+ });
270
+ });
271
+ // Each walk up from a resource not yet seen: 1 while on the walk, 2 once done.
272
+ const seen = $.let(new Map(), DictType(StringType, IntegerType));
273
+ const cyclic = $.let(new Set(), SetType(StringType));
274
+ $.for(byText, ($2, _key, start) => {
275
+ $2.if(seen.has(start).not(), ($3) => {
276
+ const path = $3.let([], ArrayType(StringType));
277
+ const at = $3.let(start, StringType);
278
+ const walking = $3.let(true, BooleanType);
279
+ $3.while(walking, ($4) => {
280
+ $4(seen.insert(at, 1n));
281
+ $4(path.pushLast(at));
282
+ $4.if(parentOf.has(at), ($5) => {
283
+ const next = $5.let(parentOf.get(at), StringType);
284
+ $5.if(seen.has(next), ($6) => {
285
+ // On this walk already: from it to here is a cycle.
286
+ $6.if(seen.get(next).equal(1n), ($7) => {
287
+ const i = $7.let(path.size().subtract(1n), IntegerType);
288
+ const back = $7.let(true, BooleanType);
289
+ $7.while(back, ($8) => {
290
+ const member = $8.let(path.get(i), StringType);
291
+ $8(cyclic.tryInsert(member));
292
+ $8.if(member.equal(next), ($9) => { $9.assign(back, false); })
293
+ .else(($9) => { $9.assign(i, i.subtract(1n)); });
294
+ });
295
+ });
296
+ $6.assign(walking, false);
297
+ }).else(($6) => { $6.assign(at, next); });
298
+ }).else(($5) => { $5.assign(walking, false); });
299
+ });
300
+ $3.for(path, ($4, member) => { $4(seen.update(member, 2n)); });
301
+ });
302
+ });
303
+ const nests = East.function([keyType], BooleanType, ($2, key) => {
304
+ const text = $2.let(textOf(key), StringType);
305
+ return parentOf.has(text).and(() => cyclic.has(text).not());
306
+ });
307
+ const nested = $.const(nests);
308
+ const top = $.let(all.filter(($2, _row, key) => nested(key).not()));
309
+ roots = top;
310
+ const empty = $.const(new Map(), collection);
311
+ const under = $.let(all.filter(($2, _row, key) => nested(key)).groupReduce(($2, _row, key) => parentOf.get(textOf(key)), (_$2, _parent) => East.value(new Map(), collection), ($2, acc, row, key) => {
312
+ $2(acc.insert(key, row));
313
+ return acc;
314
+ }));
315
+ children = (_row, key) => under.get(textOf(key), () => empty);
316
+ }
317
+ // ── A member per way the kinds placed on it draw, then its measures ──
318
+ const draws = eventDrawsOf(slot, events);
319
+ const members = draws.map((draw, i) => {
320
+ const into = placed.get(draw);
321
+ const eventsOf = (key) => into.get(textOf(key), () => noEvents);
322
+ const names = kindNamesOf(slot, draw, events);
323
+ // The first row of a resource carries its gutter; the rest name the kinds that draw that way.
324
+ const gutter = i === 0
325
+ ? {
326
+ label: (_row, key) => own(key).label,
327
+ sub: (_row, key) => own(key).sub,
328
+ value: (_row, key) => own(key).value,
329
+ status: (_row, key) => own(key).status,
330
+ }
331
+ : { label: () => names };
332
+ const base = {
333
+ key: `${slot}.${draw}`,
334
+ title: `${kind.name}: ${names}`,
335
+ keyType,
336
+ ...gutter,
337
+ };
338
+ switch (draw) {
339
+ case "span":
340
+ return createSeriesSpan(rowType, {
341
+ ...base,
342
+ runs: (_row, key) => placedRuns(eventsOf(key)),
343
+ rollup: kind.rollup,
344
+ });
345
+ case "buckets":
346
+ return createSeriesBuckets(rowType, {
347
+ ...base,
348
+ lanes: (_row, key) => placedLanes(eventsOf(key)),
349
+ events: (_row, key) => placedTiles(eventsOf(key)),
350
+ });
351
+ case "cards":
352
+ return createSeriesCards(rowType, {
353
+ ...base,
354
+ chips: (_row, key) => placedChips(eventsOf(key)),
355
+ });
356
+ case "marks":
357
+ return createSeriesEvents(rowType, {
358
+ ...base,
359
+ marks: (_row, key) => placedMarks(eventsOf(key)),
360
+ });
361
+ }
362
+ });
363
+ const views = createSeriesViews(rowType, {
364
+ key: slot,
365
+ title: kind.name,
366
+ keyType,
367
+ ...(children !== undefined ? { children } : {}),
368
+ collapsed: (_row, key) => own(key).collapsed,
369
+ }, [...members, ...kind.measures]);
370
+ // ── Group strips (PB14): the kind's top resources by group, in name order ──
371
+ let blocks;
372
+ if (kind.grouped) {
373
+ const groups = $.let(roots.groupReduce(($2, _row, key) => own(key).group.unwrap("some"), (_$2, _group) => East.value(new Map(), collection), ($2, acc, row, key) => {
374
+ $2(acc.insert(key, row));
375
+ return acc;
376
+ }));
377
+ // A collapsed strip shows its members' heat when a measure paints any.
378
+ const heat = kind.measures.some((m) => planSeriesFacts(m, collection, where)?.arm === "heat");
379
+ const strips = createSeriesGroup(collection, {
380
+ key: `${slot}.group`,
381
+ title: kind.name,
382
+ label: (_group, name) => name,
383
+ children: createChildren((group) => group, [views]),
384
+ ...(heat ? { summaryAggregate: "mean" } : {}),
385
+ });
386
+ blocks = applySeries([strips], groups);
387
+ }
388
+ else {
389
+ blocks = applySeries([views], roots);
390
+ }
391
+ // ── What the viewer hides (PB29): rows by their series' key ──
392
+ // A measure's rows, and a way of drawing's after the first once all its
393
+ // kinds are hidden: each a leaf, since a resource's children nest under its
394
+ // first row.
395
+ const hiders = [
396
+ ...draws.slice(1).map((draw) => [`${slot}.${draw}`, kindSlotsOf(slot, draw, events).map(planHideId.events)]),
397
+ ...kind.measures.map((m) => {
398
+ const key = planSeriesFacts(m, collection, where).key;
399
+ return [key, [planHideId.measures(key)]];
400
+ }),
401
+ ];
402
+ if (hiders.length === 0) {
403
+ return $.let(blocks.map(($2, b) => ({ fixed, parent: b.parent, rows: b.rows })), PlanBlocksType);
404
+ }
405
+ const dropped = $.let(new Set(), SetType(StringType));
406
+ for (const [series, ids] of hiders) {
407
+ const gone = ids.reduce((every, id) => every.and(() => hidden.has(id)), East.value(true, BooleanType));
408
+ $.if(gone, ($2) => { $2(dropped.insert(series)); });
409
+ }
410
+ return $.let(blocks.map(($2, b) => ({
411
+ fixed,
412
+ parent: b.parent,
413
+ rows: b.rows.filter(($3, row) => dropped.has(row.id.match({
414
+ entry: (_$4, at) => at.series,
415
+ section: (_$4, at) => at.series,
416
+ })).not()),
417
+ })), PlanBlocksType);
418
+ }
419
+ /**
420
+ * The Unassigned rows (PB16): for each event kind with events in the window
421
+ * that no resource of the Plan holds, one row of its draw style, after every
422
+ * resource kind — a fixed block, there whether or not it holds a row.
423
+ *
424
+ * @param $ - The blocks function's scope
425
+ * @param events - The event kinds, by slot
426
+ * @param lost - Each kind's unassigned events, in `events` order
427
+ * @returns The block
428
+ */
429
+ function unassignedBlock($, events, lost) {
430
+ const rows = $.let([], PlanRowsCollectionType);
431
+ events.forEach(([slot, kind], i) => {
432
+ const list = lost[i];
433
+ $.if(list.size().greater(0n), ($2) => {
434
+ const id = $2.let(East.value(variant("entry", { series: `${slot}.unassigned`, path: [kind.draw] }), PlanRowIdType));
435
+ const rowKind = kind.draw === "span" ? spanKind({ runs: placedRuns(list) }, East.value(none, OptionType(PlanRollupType)))
436
+ : kind.draw === "buckets" ? bucketsKind({ lanes: placedLanes(list), events: placedTiles(list) })
437
+ : kind.draw === "cards" ? cardsKind(placedChips(list))
438
+ : eventsKind(placedMarks(list));
439
+ $2(rows.pushLast(planRow({
440
+ id,
441
+ parent: East.value(none, OptionType(PlanRowIdType)),
442
+ gutter: planGutter({ label: "Unassigned", sub: some(kind.name) }),
443
+ kind: rowKind,
444
+ })));
445
+ });
446
+ });
447
+ return $.let({ fixed: true, parent: none, rows }, PlanBlockType);
448
+ }
449
+ /**
450
+ * The `blocks` seam (see the module docs): `(from, to, drafts, hidden)` → the
451
+ * resources' rows over `[from, to)`, every kind's drafts in place, what the
452
+ * viewer hides left out.
453
+ *
454
+ * @remarks
455
+ * Made inside the function that assembles the payload, so `built` is the
456
+ * payload's own array of event kinds: the seam captures it, and the payload
457
+ * carries each kind once.
458
+ *
459
+ * @param resources - The resource kinds, by slot, in order
460
+ * @param events - The event kinds, by slot, in order
461
+ * @param built - The event kinds as the payload holds them, in the same order
462
+ * @returns The seam
463
+ * @internal
464
+ */
465
+ export function createEventBlocks(resources, events, built) {
466
+ return East.function([DateTimeType, DateTimeType, PlanEventDraftsType, PickStateType], OptionType(PlanBlocksType), ($, from, to, drafts, hiding) => {
467
+ const result = $.let(none, OptionType(PlanBlocksType));
468
+ const noDrafts = $.const(new Map(), ScheduleDraftsType);
469
+ const hidden = $.let(hiding.toSet(), SetType(StringType));
470
+ // Each kind's events over the window, its drafts in place (PB17). A
471
+ // hidden kind is not read: it places nothing, so nothing waits on it.
472
+ const reads = events.map(([slot], i) => {
473
+ const kind = $.let(built.get(BigInt(i)));
474
+ const kindDrafts = $.let(drafts.get(slot, () => noDrafts));
475
+ const read = $.let(some([]), OptionType(ArrayType(PlanEventItemType)));
476
+ $.if(hidden.has(planHideId.events(slot)).not(), ($2) => { $2.assign(read, kind.planItems(from, to, kindDrafts)); });
477
+ return read;
478
+ });
479
+ const ready = reads.reduce((all, read) => all.and(() => read.hasTag("some")), East.value(true, BooleanType));
480
+ // A kind whose read is in flight leaves the rows to come.
481
+ $.if(ready, ($2) => {
482
+ const items = reads.map((read) => $2.let(read.unwrap("some"), ArrayType(PlanEventItemType)));
483
+ // Each resource kind's resources, read once — but a paged kind's (#1199), which come a window at a time.
484
+ const whole = resources.filter(([, kind]) => kind.window === undefined);
485
+ const sources = new Map(whole.map(([slot, kind]) => [slot, $2.let(kind.source)]));
486
+ // The events each way of drawing places on each resource kind, by the resource's key.
487
+ const placed = new Map(whole.map(([slot]) => [slot, new Map(eventDrawsOf(slot, events).map((draw) => [draw, $2.let(new Map(), PlacedByKeyType)]))]));
488
+ const paged = new Set(resources.filter(([, kind]) => kind.window !== undefined).map(([slot]) => slot));
489
+ const lost = events.map(() => $2.let([], PlacedListType));
490
+ events.forEach(([, kind], i) => {
491
+ const icon = $2.const({ prefix: "fas", name: kind.icon, label: none, style: none }, IconType);
492
+ const unplaced = lost[i];
493
+ $2.for(items[i], ($3, item) => {
494
+ $3.match(item.start, {
495
+ some: ($4, start) => {
496
+ $4.match(item.end, {
497
+ some: ($5, end) => {
498
+ const one = $5.let({ item, start, end, icon }, PlacedType);
499
+ const held = $5.let(false, BooleanType);
500
+ $5.match(item.resource, {
501
+ some: ($6, ref) => {
502
+ // On a resource of a kind it takes, which the kind has.
503
+ for (const slot of kind.takes) {
504
+ if (paged.has(slot)) {
505
+ // A paged kind's own (#1199), drawn by the window its resource is in.
506
+ $6.if(ref.kind.equal(slot), ($7) => { $7.assign(held, true); });
507
+ continue;
508
+ }
509
+ const into = placed.get(slot).get(kind.draw);
510
+ const all = sources.get(slot);
511
+ $6.if(ref.kind.equal(slot).and(() => all.has(ref.key)), ($7) => {
512
+ $7.if(into.has(ref.key).not(), ($8) => {
513
+ $8(into.insert(ref.key, East.value([], PlacedListType)));
514
+ });
515
+ $7(into.get(ref.key).pushLast(one));
516
+ $7.assign(held, true);
517
+ });
518
+ }
519
+ },
520
+ });
521
+ $5.if(held.not(), ($6) => { $6(unplaced.pushLast(one)); });
522
+ },
523
+ });
524
+ },
525
+ });
526
+ });
527
+ });
528
+ const blocks = $2.let([], PlanBlocksType);
529
+ for (const [slot, kind] of resources) {
530
+ if (paged.has(slot)) {
531
+ // A paged kind's place (#1199): the one block that is not fixed, which the payload's
532
+ // `paged` fills a window at a time — there whether or not the viewer hides the kind.
533
+ $2(blocks.pushLast(East.value({ fixed: false, parent: none, rows: [] }, PlanBlockType)));
534
+ continue;
535
+ }
536
+ // A hidden resource kind draws no rows; its events stay its own, off the Unassigned row.
537
+ $2.if(hidden.has(planHideId.resources(slot)).not(), ($3) => {
538
+ $3(blocks.append(resourceBlocks($3, slot, kind, sources.get(slot), placed.get(slot), events, hidden)));
539
+ });
540
+ }
541
+ $2(blocks.pushLast(unassignedBlock($2, events, lost)));
542
+ $2.assign(result, some(blocks));
543
+ });
544
+ return result;
545
+ });
546
+ }
547
+ // ============================================================================
548
+ // A paged resource kind's rows (#1199)
549
+ // ============================================================================
550
+ /**
551
+ * A paged resource kind's rows (#1199, PB55): its resources a window at a
552
+ * time, as a paged canvas pages its blocks. The renderer reads `placed` over
553
+ * the range it draws with the `blocks` seam, and serves the canvas a paged
554
+ * source whose every window is the event kinds' blocks with this kind's place
555
+ * filled by `rows` over that window of its resources — so its rows come as
556
+ * the canvas scrolls, its key search seeks a resource by its key, and its
557
+ * resources are never read whole.
558
+ *
559
+ * @property kind - The paged resource kind's slot
560
+ * @property id - The identity of the kind's resources' window
561
+ * @property placed - `(from, to, drafts by kind, the ids the viewer hides)` → the events placed on the kind's resources over `[from, to)`, every kind's drafts in place, by way of drawing and by the resource key's text; `none` while a kind's read is in flight
562
+ * @property rows - `(offset, limit, placed, the ids the viewer hides)` → the kind's rows for its resources `[offset, offset + limit)` — a whole window of them — with the events given placed on them: one block, not fixed (an empty one while the viewer hides the kind); `none` while the window is in flight
563
+ * @property total - How many resources the kind has, once known
564
+ * @property seek - Where a key search lands among the kind's resources: the window's own key search
565
+ * @property revision - The snapshot of the resources the windows are read at
566
+ * @property refresh - Moves the resources' window to a snapshot, or to the one it holds now
567
+ */
568
+ export const PlanEventPagedType = StructType({
569
+ kind: StringType,
570
+ id: StringType,
571
+ placed: FunctionType([DateTimeType, DateTimeType, PlanEventDraftsType, PickStateType], OptionType(PlanEventPlacedType)),
572
+ rows: FunctionType([IntegerType, IntegerType, PlanEventPlacedType, PickStateType], OptionType(PlanBlocksType)),
573
+ total: FunctionType([], OptionType(IntegerType)),
574
+ seek: OptionType(FunctionType([SeekQueryType], OptionType(SeekRangeType))),
575
+ revision: FunctionType([], OptionType(StringType)),
576
+ refresh: FunctionType([OptionType(StringType)], NullType),
577
+ });
578
+ /**
579
+ * The paged resource kind's rows (see {@link PlanEventPagedType}), when a
580
+ * resource kind is given its resources as a paged read.
581
+ *
582
+ * @remarks
583
+ * Made inside the function that assembles the payload, as the `blocks` seam
584
+ * is, so `built` is the payload's own array of event kinds.
585
+ *
586
+ * @param resources - The resource kinds, by slot, in order — at most one of them paged (the Plan refuses more)
587
+ * @param events - The event kinds, by slot, in order
588
+ * @param built - The event kinds as the payload holds them, in the same order
589
+ * @returns The paged rows, or `undefined` when no resource kind is paged
590
+ * @throws {Error} When the kind's paged read is not a paged source of its resources
591
+ * @internal
592
+ */
593
+ export function createEventPaged(resources, events, built) {
594
+ const at = resources.find(([, kind]) => kind.window !== undefined);
595
+ if (at === undefined)
596
+ return undefined;
597
+ const [slot, kind] = at;
598
+ const where = `Plan: resources.${slot}`;
599
+ // The resources a window at a time — each window whole, a piece the source cut short read on to its end.
600
+ const resolved = resolveRowSource(kind.window, where);
601
+ if (resolved.kind === "inline") {
602
+ throw new Error(`${where}: a paged kind's resources are a paged read — Data.bindPaged(record) over the resources' record`);
603
+ }
604
+ const window = buildPagedWindow(resolved);
605
+ const handle = resolved.source;
606
+ const draws = eventDrawsOf(slot, events);
607
+ // The event kinds placed on it, with their place in `events` — the payload's array of them.
608
+ const takers = events.flatMap(([s, k], i) => (k.takes.includes(slot) ? [[s, k, i]] : []));
609
+ const placed = East.function([DateTimeType, DateTimeType, PlanEventDraftsType, PickStateType], OptionType(PlanEventPlacedType), ($, from, to, drafts, hiding) => {
610
+ const result = $.let(none, OptionType(PlanEventPlacedType));
611
+ const noDrafts = $.const(new Map(), ScheduleDraftsType);
612
+ const hidden = $.let(hiding.toSet(), SetType(StringType));
613
+ // Each kind's events over the window, its drafts in place; a hidden kind is not read.
614
+ const reads = takers.map(([s, , i]) => {
615
+ const k = $.let(built.get(BigInt(i)));
616
+ const kindDrafts = $.let(drafts.get(s, () => noDrafts));
617
+ const read = $.let(some([]), OptionType(ArrayType(PlanEventItemType)));
618
+ $.if(hidden.has(planHideId.events(s)).not(), ($2) => { $2.assign(read, k.planItems(from, to, kindDrafts)); });
619
+ return read;
620
+ });
621
+ const ready = reads.reduce((all, read) => all.and(() => read.hasTag("some")), East.value(true, BooleanType));
622
+ $.if(ready, ($2) => {
623
+ const out = $2.let(new Map(), PlanEventPlacedType);
624
+ for (const draw of draws)
625
+ $2(out.insert(draw, East.value(new Map(), PlacedByKeyType)));
626
+ takers.forEach(([, k], j) => {
627
+ const icon = $2.const({ prefix: "fas", name: k.icon, label: none, style: none }, IconType);
628
+ const into = $2.let(out.get(k.draw));
629
+ $2.for(reads[j].unwrap("some"), ($3, item) => {
630
+ $3.match(item.start, {
631
+ some: ($4, start) => {
632
+ $4.match(item.end, {
633
+ some: ($5, end) => {
634
+ $5.match(item.resource, {
635
+ some: ($6, ref) => {
636
+ // On one of this kind's resources, by its key: the window holding it draws it.
637
+ $6.if(ref.kind.equal(slot), ($7) => {
638
+ $7.if(into.has(ref.key).not(), ($8) => { $8(into.insert(ref.key, East.value([], PlacedListType))); });
639
+ $7(into.get(ref.key).pushLast(East.value({ item, start, end, icon }, PlacedType)));
640
+ });
641
+ },
642
+ });
643
+ },
644
+ });
645
+ },
646
+ });
647
+ });
648
+ });
649
+ $2.assign(result, some(out));
650
+ });
651
+ return result;
652
+ });
653
+ const rows = East.function([IntegerType, IntegerType, PlanEventPlacedType, PickStateType], OptionType(PlanBlocksType), ($, offset, limit, given, hiding) => {
654
+ const result = $.let(none, OptionType(PlanBlocksType));
655
+ const hidden = $.let(hiding.toSet(), SetType(StringType));
656
+ $.if(hidden.has(planHideId.resources(slot)), ($2) => {
657
+ // A hidden kind draws no rows: its place stands empty in every window.
658
+ $2.assign(result, some(East.value([{ fixed: false, parent: none, rows: [] }], PlanBlocksType)));
659
+ }).else(($2) => {
660
+ const read = $2.const(window);
661
+ const got = $2.let(read(offset, limit));
662
+ $2.match(got, {
663
+ some: ($3, all) => {
664
+ const onIt = new Map(draws.map((draw) => [draw, $3.let(given.get(draw, () => East.value(new Map(), PlacedByKeyType)))]));
665
+ $3.assign(result, some(resourceBlocks($3, slot, kind, all, onIt, events, hidden, false)));
666
+ },
667
+ });
668
+ });
669
+ return result;
670
+ });
671
+ // A source that names no snapshot is read at none, and moves nowhere.
672
+ const revision = resolved.pinned
673
+ ? handle.revision
674
+ : East.function([], OptionType(StringType), (_$) => East.value(none, OptionType(StringType)));
675
+ const refresh = resolved.pinned
676
+ ? handle.refresh
677
+ : East.function([OptionType(StringType)], NullType, (_$, _target) => East.value(null, NullType));
678
+ return East.value({
679
+ kind: slot,
680
+ id: handle.id,
681
+ placed,
682
+ rows,
683
+ total: handle.total,
684
+ seek: handle.seek,
685
+ revision,
686
+ refresh,
687
+ }, PlanEventPagedType);
688
+ }
689
+ //# sourceMappingURL=event-rows.js.map