@elaraai/e3-ui 1.0.97 → 1.0.98

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 (304) hide show
  1. package/dist/src/allocation/index.d.ts +258 -7
  2. package/dist/src/allocation/index.d.ts.map +1 -1
  3. package/dist/src/allocation/index.js +30 -1
  4. package/dist/src/allocation/index.js.map +1 -1
  5. package/dist/src/allocation/types.d.ts +41 -0
  6. package/dist/src/allocation/types.d.ts.map +1 -1
  7. package/dist/src/allocation/types.js +35 -0
  8. package/dist/src/allocation/types.js.map +1 -1
  9. package/dist/src/bind/data-indexed.d.ts +31 -4
  10. package/dist/src/bind/data-indexed.d.ts.map +1 -1
  11. package/dist/src/bind/data-indexed.js +54 -10
  12. package/dist/src/bind/data-indexed.js.map +1 -1
  13. package/dist/src/calendar/index.d.ts +540 -14
  14. package/dist/src/calendar/index.d.ts.map +1 -1
  15. package/dist/src/calendar/index.js +43 -7
  16. package/dist/src/calendar/index.js.map +1 -1
  17. package/dist/src/calendar/paged.d.ts +89 -0
  18. package/dist/src/calendar/paged.d.ts.map +1 -0
  19. package/dist/src/calendar/paged.js +148 -0
  20. package/dist/src/calendar/paged.js.map +1 -0
  21. package/dist/src/flowchart/payload.d.ts +156 -0
  22. package/dist/src/flowchart/payload.d.ts.map +1 -1
  23. package/dist/src/flowchart/window.d.ts +12 -0
  24. package/dist/src/flowchart/window.d.ts.map +1 -1
  25. package/dist/src/index.d.ts +11 -2
  26. package/dist/src/index.d.ts.map +1 -1
  27. package/dist/src/index.js +19 -0
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/internal.d.ts +11 -5
  30. package/dist/src/internal.d.ts.map +1 -1
  31. package/dist/src/internal.js +28 -7
  32. package/dist/src/internal.js.map +1 -1
  33. package/dist/src/plan/builders.d.ts +12 -8
  34. package/dist/src/plan/builders.d.ts.map +1 -1
  35. package/dist/src/plan/builders.js +12 -8
  36. package/dist/src/plan/builders.js.map +1 -1
  37. package/dist/src/plan/event-rows.d.ts +228 -156
  38. package/dist/src/plan/event-rows.d.ts.map +1 -1
  39. package/dist/src/plan/event-rows.js +239 -54
  40. package/dist/src/plan/event-rows.js.map +1 -1
  41. package/dist/src/plan/index.d.ts +5 -0
  42. package/dist/src/plan/index.d.ts.map +1 -1
  43. package/dist/src/plan/index.js +3 -0
  44. package/dist/src/plan/index.js.map +1 -1
  45. package/dist/src/plan/ir.d.ts +70 -0
  46. package/dist/src/plan/ir.d.ts.map +1 -1
  47. package/dist/src/plan/ordered-source.d.ts +2038 -1
  48. package/dist/src/plan/ordered-source.d.ts.map +1 -1
  49. package/dist/src/plan/ordered-source.js +19 -11
  50. package/dist/src/plan/ordered-source.js.map +1 -1
  51. package/dist/src/plan/plan.d.ts +513 -32
  52. package/dist/src/plan/plan.d.ts.map +1 -1
  53. package/dist/src/plan/plan.js +119 -32
  54. package/dist/src/plan/plan.js.map +1 -1
  55. package/dist/src/plan/root.d.ts +4 -2
  56. package/dist/src/plan/root.d.ts.map +1 -1
  57. package/dist/src/plan/root.js +6 -4
  58. package/dist/src/plan/root.js.map +1 -1
  59. package/dist/src/plan/series.d.ts +13 -0
  60. package/dist/src/plan/series.d.ts.map +1 -1
  61. package/dist/src/plan/series.js +61 -7
  62. package/dist/src/plan/series.js.map +1 -1
  63. package/dist/src/plan/types.d.ts +14 -0
  64. package/dist/src/plan/types.d.ts.map +1 -1
  65. package/dist/src/plan/types.js +8 -0
  66. package/dist/src/plan/types.js.map +1 -1
  67. package/dist/src/roster/index.d.ts +608 -20
  68. package/dist/src/roster/index.d.ts.map +1 -1
  69. package/dist/src/roster/index.js +103 -29
  70. package/dist/src/roster/index.js.map +1 -1
  71. package/dist/src/roster/library.d.ts +12 -2
  72. package/dist/src/roster/library.d.ts.map +1 -1
  73. package/dist/src/roster/library.js +8 -0
  74. package/dist/src/roster/library.js.map +1 -1
  75. package/dist/src/roster/lists.d.ts +59 -12
  76. package/dist/src/roster/lists.d.ts.map +1 -1
  77. package/dist/src/roster/lists.js +51 -58
  78. package/dist/src/roster/lists.js.map +1 -1
  79. package/dist/src/roster/times.d.ts +402 -0
  80. package/dist/src/roster/times.d.ts.map +1 -1
  81. package/dist/src/roster/types.d.ts +913 -1
  82. package/dist/src/roster/types.d.ts.map +1 -1
  83. package/dist/src/roster/types.js +43 -3
  84. package/dist/src/roster/types.js.map +1 -1
  85. package/dist/src/schedule/cell-checks.d.ts +85 -0
  86. package/dist/src/schedule/cell-checks.d.ts.map +1 -0
  87. package/dist/src/schedule/cell-checks.js +211 -0
  88. package/dist/src/schedule/cell-checks.js.map +1 -0
  89. package/dist/src/schedule/events.d.ts +42 -10
  90. package/dist/src/schedule/events.d.ts.map +1 -1
  91. package/dist/src/schedule/events.js +349 -155
  92. package/dist/src/schedule/events.js.map +1 -1
  93. package/dist/src/schedule/fields.d.ts +134 -0
  94. package/dist/src/schedule/fields.d.ts.map +1 -0
  95. package/dist/src/schedule/fields.js +207 -0
  96. package/dist/src/schedule/fields.js.map +1 -0
  97. package/dist/src/schedule/library.d.ts +11 -3
  98. package/dist/src/schedule/library.d.ts.map +1 -1
  99. package/dist/src/schedule/library.js +9 -6
  100. package/dist/src/schedule/library.js.map +1 -1
  101. package/dist/src/schedule/optimise.d.ts +124 -0
  102. package/dist/src/schedule/optimise.d.ts.map +1 -0
  103. package/dist/src/schedule/optimise.js +140 -0
  104. package/dist/src/schedule/optimise.js.map +1 -0
  105. package/dist/src/schedule/pages.d.ts +76 -0
  106. package/dist/src/schedule/pages.d.ts.map +1 -0
  107. package/dist/src/schedule/pages.js +86 -0
  108. package/dist/src/schedule/pages.js.map +1 -0
  109. package/dist/src/schedule/record-window.d.ts +119 -6
  110. package/dist/src/schedule/record-window.d.ts.map +1 -1
  111. package/dist/src/schedule/record-window.js +139 -60
  112. package/dist/src/schedule/record-window.js.map +1 -1
  113. package/dist/src/schedule/resources.d.ts +8 -4
  114. package/dist/src/schedule/resources.d.ts.map +1 -1
  115. package/dist/src/schedule/resources.js +35 -15
  116. package/dist/src/schedule/resources.js.map +1 -1
  117. package/dist/src/schedule/session.d.ts +14 -0
  118. package/dist/src/schedule/session.d.ts.map +1 -1
  119. package/dist/src/schedule/session.js +29 -17
  120. package/dist/src/schedule/session.js.map +1 -1
  121. package/dist/src/schedule/types.d.ts +426 -36
  122. package/dist/src/schedule/types.d.ts.map +1 -1
  123. package/dist/src/schedule/types.js +63 -17
  124. package/dist/src/schedule/types.js.map +1 -1
  125. package/dist/src/schedule/window.d.ts +30 -9
  126. package/dist/src/schedule/window.d.ts.map +1 -1
  127. package/dist/src/schedule/window.js +101 -49
  128. package/dist/src/schedule/window.js.map +1 -1
  129. package/dist/src/schematic/index.d.ts +277 -0
  130. package/dist/src/schematic/index.d.ts.map +1 -0
  131. package/dist/src/schematic/index.js +206 -0
  132. package/dist/src/schematic/index.js.map +1 -0
  133. package/dist/src/schematic/kinds.d.ts +501 -0
  134. package/dist/src/schematic/kinds.d.ts.map +1 -0
  135. package/dist/src/schematic/kinds.js +1027 -0
  136. package/dist/src/schematic/kinds.js.map +1 -0
  137. package/dist/src/schematic/layers.d.ts +74 -0
  138. package/dist/src/schematic/layers.d.ts.map +1 -0
  139. package/dist/src/schematic/layers.js +99 -0
  140. package/dist/src/schematic/layers.js.map +1 -0
  141. package/dist/src/schematic/library.d.ts +202 -0
  142. package/dist/src/schematic/library.d.ts.map +1 -0
  143. package/dist/src/schematic/library.js +244 -0
  144. package/dist/src/schematic/library.js.map +1 -0
  145. package/dist/src/schematic/payload.d.ts +8360 -0
  146. package/dist/src/schematic/payload.d.ts.map +1 -0
  147. package/dist/src/schematic/payload.js +446 -0
  148. package/dist/src/schematic/payload.js.map +1 -0
  149. package/dist/src/schematic/schematic.d.ts +27 -0
  150. package/dist/src/schematic/schematic.d.ts.map +1 -0
  151. package/dist/src/schematic/schematic.js +17 -0
  152. package/dist/src/schematic/schematic.js.map +1 -0
  153. package/dist/src/schematic/shapes.d.ts +150 -0
  154. package/dist/src/schematic/shapes.d.ts.map +1 -0
  155. package/dist/src/schematic/shapes.js +171 -0
  156. package/dist/src/schematic/shapes.js.map +1 -0
  157. package/dist/src/schematic/templates.d.ts +96 -0
  158. package/dist/src/schematic/templates.d.ts.map +1 -0
  159. package/dist/src/schematic/templates.js +91 -0
  160. package/dist/src/schematic/templates.js.map +1 -0
  161. package/dist/src/schematic/types.d.ts +5766 -0
  162. package/dist/src/schematic/types.d.ts.map +1 -0
  163. package/dist/src/schematic/types.js +688 -0
  164. package/dist/src/schematic/types.js.map +1 -0
  165. package/dist/src/schematic/window.d.ts +212 -0
  166. package/dist/src/schematic/window.d.ts.map +1 -0
  167. package/dist/src/schematic/window.js +337 -0
  168. package/dist/src/schematic/window.js.map +1 -0
  169. package/dist/src/sheet/editing-bridge.d.ts +4 -2
  170. package/dist/src/sheet/editing-bridge.d.ts.map +1 -1
  171. package/dist/src/sheet/editing-bridge.js +8 -2
  172. package/dist/src/sheet/editing-bridge.js.map +1 -1
  173. package/dist/src/sheet/editing-types.d.ts +9 -5
  174. package/dist/src/sheet/editing-types.d.ts.map +1 -1
  175. package/dist/src/sheet/editing-types.js +9 -5
  176. package/dist/src/sheet/editing-types.js.map +1 -1
  177. package/dist/src/sheet/index.d.ts +18 -8
  178. package/dist/src/sheet/index.d.ts.map +1 -1
  179. package/dist/src/sheet/index.js +15 -7
  180. package/dist/src/sheet/index.js.map +1 -1
  181. package/dist/src/sheet/optimise.d.ts +69 -0
  182. package/dist/src/sheet/optimise.d.ts.map +1 -0
  183. package/dist/src/sheet/optimise.js +81 -0
  184. package/dist/src/sheet/optimise.js.map +1 -0
  185. package/dist/src/sheet/registers.d.ts +5 -5
  186. package/dist/src/sheet/registers.js +5 -5
  187. package/dist/src/sheet/root.d.ts +2 -0
  188. package/dist/src/sheet/root.d.ts.map +1 -1
  189. package/dist/src/sheet/root.js +2 -2
  190. package/dist/src/sheet/root.js.map +1 -1
  191. package/dist/src/sheet/sheet.d.ts +753 -573
  192. package/dist/src/sheet/sheet.d.ts.map +1 -1
  193. package/dist/src/sheet/sheet.js +45 -13
  194. package/dist/src/sheet/sheet.js.map +1 -1
  195. package/dist/src/sheet/types.d.ts +92 -12
  196. package/dist/src/sheet/types.d.ts.map +1 -1
  197. package/dist/src/sheet/types.js +4 -8
  198. package/dist/src/sheet/types.js.map +1 -1
  199. package/dist/src/utils/keyed-rows.d.ts +41 -0
  200. package/dist/src/utils/keyed-rows.d.ts.map +1 -0
  201. package/dist/src/utils/keyed-rows.js +64 -0
  202. package/dist/src/utils/keyed-rows.js.map +1 -0
  203. package/dist/src/utils/optimise.d.ts +79 -0
  204. package/dist/src/utils/optimise.d.ts.map +1 -0
  205. package/dist/src/utils/optimise.js +46 -0
  206. package/dist/src/utils/optimise.js.map +1 -0
  207. package/dist/test/allocation/allocation.examples.d.ts +6 -18
  208. package/dist/test/allocation/allocation.examples.d.ts.map +1 -1
  209. package/dist/test/allocation/allocation.examples.js +3 -3
  210. package/dist/test/allocation/allocation.examples.js.map +1 -1
  211. package/dist/test/allocation/optimise.examples.d.ts +109 -0
  212. package/dist/test/allocation/optimise.examples.d.ts.map +1 -0
  213. package/dist/test/allocation/optimise.examples.js +223 -0
  214. package/dist/test/allocation/optimise.examples.js.map +1 -0
  215. package/dist/test/bind/data/data.examples.d.ts +540 -36
  216. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  217. package/dist/test/bind/data/data.examples.js +66 -2
  218. package/dist/test/bind/data/data.examples.js.map +1 -1
  219. package/dist/test/bind/record/record.examples.d.ts +1 -3
  220. package/dist/test/bind/record/record.examples.d.ts.map +1 -1
  221. package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -1
  222. package/dist/test/calendar/calendar-records.examples.js +3 -3
  223. package/dist/test/calendar/calendar-records.examples.js.map +1 -1
  224. package/dist/test/calendar/calendar-windows.examples.d.ts +9 -0
  225. package/dist/test/calendar/calendar-windows.examples.d.ts.map +1 -0
  226. package/dist/test/calendar/calendar-windows.examples.js +111 -0
  227. package/dist/test/calendar/calendar-windows.examples.js.map +1 -0
  228. package/dist/test/calendar/calendar.examples.d.ts +7 -21
  229. package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
  230. package/dist/test/calendar/calendar.examples.js +7 -7
  231. package/dist/test/calendar/calendar.examples.js.map +1 -1
  232. package/dist/test/calendar/optimise.examples.d.ts +132 -0
  233. package/dist/test/calendar/optimise.examples.d.ts.map +1 -0
  234. package/dist/test/calendar/optimise.examples.js +75 -0
  235. package/dist/test/calendar/optimise.examples.js.map +1 -0
  236. package/dist/test/examples-package.d.ts +46 -10
  237. package/dist/test/examples-package.d.ts.map +1 -1
  238. package/dist/test/examples-package.js +142 -32
  239. package/dist/test/examples-package.js.map +1 -1
  240. package/dist/test/flowchart/flowchart.examples.d.ts +10 -30
  241. package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
  242. package/dist/test/plan/optimise.examples.d.ts +207 -0
  243. package/dist/test/plan/optimise.examples.d.ts.map +1 -0
  244. package/dist/test/plan/optimise.examples.js +98 -0
  245. package/dist/test/plan/optimise.examples.js.map +1 -0
  246. package/dist/test/plan/plan-events.examples.d.ts +8 -24
  247. package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
  248. package/dist/test/plan/plan-events.examples.js +3 -3
  249. package/dist/test/plan/plan-events.examples.js.map +1 -1
  250. package/dist/test/plan/plan-records.examples.d.ts +200 -19
  251. package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
  252. package/dist/test/plan/plan-records.examples.js +125 -28
  253. package/dist/test/plan/plan-records.examples.js.map +1 -1
  254. package/dist/test/plan/plan-windows.examples.d.ts +853 -36
  255. package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
  256. package/dist/test/plan/plan-windows.examples.js +166 -29
  257. package/dist/test/plan/plan-windows.examples.js.map +1 -1
  258. package/dist/test/plan/plan.examples.d.ts +7 -21
  259. package/dist/test/plan/plan.examples.d.ts.map +1 -1
  260. package/dist/test/plan/plan.examples.js +11 -9
  261. package/dist/test/plan/plan.examples.js.map +1 -1
  262. package/dist/test/roster/domain.examples.d.ts +804 -0
  263. package/dist/test/roster/domain.examples.d.ts.map +1 -1
  264. package/dist/test/roster/domain.examples.js +3 -3
  265. package/dist/test/roster/domain.examples.js.map +1 -1
  266. package/dist/test/roster/optimise.examples.d.ts +485 -0
  267. package/dist/test/roster/optimise.examples.d.ts.map +1 -0
  268. package/dist/test/roster/optimise.examples.js +155 -0
  269. package/dist/test/roster/optimise.examples.js.map +1 -0
  270. package/dist/test/roster/roster-records.examples.d.ts +6 -18
  271. package/dist/test/roster/roster-records.examples.d.ts.map +1 -1
  272. package/dist/test/roster/roster-records.examples.js +1 -1
  273. package/dist/test/roster/roster-records.examples.js.map +1 -1
  274. package/dist/test/roster/roster.examples.d.ts +3391 -21
  275. package/dist/test/roster/roster.examples.d.ts.map +1 -1
  276. package/dist/test/roster/roster.examples.js +54 -7
  277. package/dist/test/roster/roster.examples.js.map +1 -1
  278. package/dist/test/roster/warehouse.d.ts +150 -7
  279. package/dist/test/roster/warehouse.d.ts.map +1 -1
  280. package/dist/test/roster/warehouse.js +36 -11
  281. package/dist/test/roster/warehouse.js.map +1 -1
  282. package/dist/test/schedule/schedule.examples.d.ts +1 -3
  283. package/dist/test/schedule/schedule.examples.d.ts.map +1 -1
  284. package/dist/test/schematic/schematic-records.examples.d.ts +444 -0
  285. package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -0
  286. package/dist/test/schematic/schematic-records.examples.js +205 -0
  287. package/dist/test/schematic/schematic-records.examples.js.map +1 -0
  288. package/dist/test/schematic/schematic.examples.d.ts +2289 -0
  289. package/dist/test/schematic/schematic.examples.d.ts.map +1 -0
  290. package/dist/test/schematic/schematic.examples.js +453 -0
  291. package/dist/test/schematic/schematic.examples.js.map +1 -0
  292. package/dist/test/sheet/optimise.examples.d.ts +177 -0
  293. package/dist/test/sheet/optimise.examples.d.ts.map +1 -0
  294. package/dist/test/sheet/optimise.examples.js +75 -0
  295. package/dist/test/sheet/optimise.examples.js.map +1 -0
  296. package/dist/test/sheet/sheet-records.examples.d.ts +95 -204
  297. package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
  298. package/dist/test/sheet/sheet-records.examples.js +42 -17
  299. package/dist/test/sheet/sheet-records.examples.js.map +1 -1
  300. package/dist/test/sheet/sheet.examples.d.ts +17 -33
  301. package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
  302. package/dist/test/sheet/sheet.examples.js +18 -15
  303. package/dist/test/sheet/sheet.examples.js.map +1 -1
  304. package/package.json +11 -11
@@ -0,0 +1,244 @@
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
+ * `Schematic.library` (#1386, #1401, `Schematic Builder Spec.md` §8): the
7
+ * library pane's tabs, which `library` lists in order, and their wire, which
8
+ * the renderer draws (#1389). Like the Calendar's, each covers every kind
9
+ * (D33).
10
+ *
11
+ * - `Schematic.library.templates()`: every kind's templates (§4.6), each
12
+ * kind's under its name, then grouped by their `group`, each card a drag
13
+ * source. Each kind's cards follow their templates' source of the slice.
14
+ * - `Schematic.library.backlog()`: every item kind's rows with no position,
15
+ * each kind's under its name, each a drag source: the Backlog tab, as the
16
+ * Calendar's is.
17
+ * - `Schematic.library.index()`: the zones, nested by containment, each
18
+ * opened listing the items inside it.
19
+ * - `Schematic.library.layers()`: each layer, with Isolate, Lock and Show or
20
+ * Hide: the viewer's view settings.
21
+ * - `Schematic.library.tab(rows, { … })`: the author's own cards, as
22
+ * `Plan.library.tab` takes them. A card's `drop` is a `Schematic.patch(R, …)`
23
+ * whose row type names the kind it lands on.
24
+ *
25
+ * Left out, or empty, the Schematic has no library pane.
26
+ *
27
+ * @packageDocumentation
28
+ */
29
+ import { ArrayType, East, NullType, VariantType, variant } from "@elaraai/east";
30
+ import { ScheduleAuthorTabType, buildScheduleTab } from "../schedule/library.js";
31
+ export { ScheduleLibraryCardType as SchematicLibraryCardType } from "../schedule/library.js";
32
+ // ============================================================================
33
+ // The wire
34
+ // ============================================================================
35
+ /**
36
+ * One tab of the library pane on the wire, in the order `library` lists them.
37
+ *
38
+ * @property templates - Every kind's templates
39
+ * @property backlog - Every item kind's rows with no position
40
+ * @property index - The zones, nested by containment
41
+ * @property layers - The layers
42
+ * @property tab - The author's own: its name, its icon, the kind its cards land on, and its cards
43
+ */
44
+ export const SchematicLibraryTabType = VariantType({
45
+ templates: NullType,
46
+ backlog: NullType,
47
+ index: NullType,
48
+ layers: NullType,
49
+ tab: ScheduleAuthorTabType,
50
+ });
51
+ /**
52
+ * Refuses a slot given to a tab that covers every kind (D33), naming the form
53
+ * to use.
54
+ *
55
+ * @param tab - The tab's factory, as the refusal names it
56
+ * @param given - What it was given
57
+ * @throws {Error} When it was given anything
58
+ */
59
+ function takesNoSlot(tab, given) {
60
+ if (given.length === 0)
61
+ return;
62
+ throw new Error(tab === "templates"
63
+ ? "Schematic.library.templates() lists every kind's templates, each kind's under its name, as the Calendar's does — leave the slot out"
64
+ : "Schematic.library.backlog() lists every item kind's rows with no position, each kind's under its name, as the Calendar's does — leave the slot out");
65
+ }
66
+ /**
67
+ * The library's Templates tab (§8, D33): every kind's templates, each kind's
68
+ * under its name, then grouped by their `group`, each card a drag source.
69
+ * Dropped on the canvas, an item template adds an item at the drop point;
70
+ * dropped on a link, a link template retypes it. Each kind's cards follow
71
+ * their templates' source of the slice, counting what they show.
72
+ *
73
+ * @param given - Nothing: a slot given, as the earlier form took, is refused
74
+ * @returns The tab
75
+ * @throws {Error} When given a slot, naming the form to use
76
+ */
77
+ export function libraryTemplates(...given) {
78
+ takesNoSlot("templates", given);
79
+ return { kind: "templates" };
80
+ }
81
+ /**
82
+ * The library's Backlog tab (§8, D33): every item kind's rows with no
83
+ * position, each kind's under its name, each a drag source a drop places, as
84
+ * the Calendar's Backlog is. An item kind whose `x` and `y` are Options of
85
+ * Float has a backlog.
86
+ *
87
+ * @param given - Nothing: a slot given is refused
88
+ * @returns The tab
89
+ * @throws {Error} When given a slot, naming the form to use
90
+ */
91
+ export function libraryBacklog(...given) {
92
+ takesNoSlot("backlog", given);
93
+ return { kind: "backlog" };
94
+ }
95
+ /**
96
+ * `Schematic.library.unplaced(slot)`, removed (D33): refused, naming the
97
+ * Backlog tab that replaces it.
98
+ *
99
+ * @returns Never
100
+ * @throws {Error} Always, naming `Schematic.library.backlog()`
101
+ */
102
+ function libraryUnplaced() {
103
+ throw new Error("Schematic.library.unplaced(slot) is gone — Schematic.library.backlog() lists every item kind's rows with no position, each kind's under its name");
104
+ }
105
+ /**
106
+ * The library's Index tab (§8): the zones, nested by containment. The zone the
107
+ * viewport is in is marked, a click flies to a zone and selects it, and an
108
+ * opened zone lists the items inside it. Hatched zones hold no items.
109
+ *
110
+ * @returns The tab
111
+ */
112
+ export function libraryIndex() {
113
+ return { kind: "index" };
114
+ }
115
+ /**
116
+ * The library's Layers tab (§8): each layer's swatch, label and count, with
117
+ * Isolate, Lock and Show or Hide, and Show all. The viewer's choices are kept
118
+ * for them; a locked layer's entities never select, and a hidden layer's never
119
+ * draw.
120
+ *
121
+ * @returns The tab
122
+ */
123
+ export function libraryLayers() {
124
+ return { kind: "layers" };
125
+ }
126
+ /**
127
+ * A tab of the author's own cards (§8): one card per row, its label and meta,
128
+ * grouped by its `group`, searched by its key, label and meta. Given a `drop`
129
+ * — `Schematic.patch(R, { … })` over one kind's row type, which names that
130
+ * kind — a card dropped on an entity of that kind sets the fields the patch
131
+ * sets. Naming a `source` of the slice, the tab follows it.
132
+ *
133
+ * @typeParam K - The rows' key type
134
+ * @typeParam R - Their row type
135
+ * @typeParam P - The patch `drop` returns
136
+ * @param rows - The rows: a `Dict<K, R>`, usually a record's `read()`
137
+ * @param config - The tab's name and icon, and the accessors over a row and its key
138
+ * @returns The tab
139
+ */
140
+ export function libraryTab(rows, config) {
141
+ return { kind: "tab", rows, config: config };
142
+ }
143
+ /**
144
+ * The library's tabs, each a factory `library` lists: `Schematic.library`.
145
+ */
146
+ export const SchematicLibraryFactories = {
147
+ /** Every kind's templates ({@link libraryTemplates}). */
148
+ templates: libraryTemplates,
149
+ /** Every item kind's rows with no position ({@link libraryBacklog}). */
150
+ backlog: libraryBacklog,
151
+ /** @deprecated Removed (#1401): every item kind's rows with no position are `Schematic.library.backlog()`. */
152
+ unplaced: libraryUnplaced,
153
+ /** The zones, nested by containment ({@link libraryIndex}). */
154
+ index: libraryIndex,
155
+ /** The layers ({@link libraryLayers}). */
156
+ layers: libraryLayers,
157
+ /** The author's own cards ({@link libraryTab}). */
158
+ tab: libraryTab,
159
+ };
160
+ /** How a tab names itself in a refusal. */
161
+ function tabName(tab) {
162
+ return tab.kind === "tab" ? `the "${tab.config.name}" tab` : `Schematic.library.${tab.kind}()`;
163
+ }
164
+ /** Whether a value is one of the library's tabs. */
165
+ function isTab(value) {
166
+ if (typeof value !== "object" || value === null)
167
+ return false;
168
+ const kind = value.kind;
169
+ return kind === "templates" || kind === "backlog" || kind === "index" || kind === "layers" || kind === "tab";
170
+ }
171
+ /**
172
+ * Builds the library pane on the wire (§8): its tabs in the order `library`
173
+ * lists them; none when it is left out.
174
+ *
175
+ * @param tabs - The tabs, each a `Schematic.library.*` call
176
+ * @param ctx - What the library is built against
177
+ * @returns The tabs on the wire
178
+ * @throws {Error} Naming the tab: a `library` that is no list of `Schematic.library.*` calls; a tab listed twice (an
179
+ * author's tab by its name); the Templates tab when no kind has templates; the Backlog tab when no item kind's `x` and
180
+ * `y` are Options; the Index tab with no zone kinds; the Layers tab with no layers; and each of an author's tab's
181
+ * refusals
182
+ * @internal
183
+ */
184
+ export function buildSchematicLibrary(tabs, ctx) {
185
+ if (tabs === undefined)
186
+ return East.value([], ArrayType(SchematicLibraryTabType));
187
+ if (!Array.isArray(tabs) || !tabs.every(isTab)) {
188
+ throw new Error("Schematic: `library` lists the library pane's tabs, in order, each a Schematic.library.* call — " +
189
+ "templates(), backlog(), index(), layers() or tab(rows, { … })");
190
+ }
191
+ const seen = new Set();
192
+ for (const tab of tabs) {
193
+ const id = tab.kind === "tab" ? `tab:${tab.config.name}` : tab.kind;
194
+ if (seen.has(id)) {
195
+ throw new Error(tab.kind === "tab"
196
+ ? `Schematic: the library lists two tabs named "${tab.config.name}" — each tab's name is its own`
197
+ : `Schematic: the library lists ${tabName(tab)} twice — each tab once`);
198
+ }
199
+ seen.add(id);
200
+ if (tab.kind === "templates" && !ctx.kinds.some((kind) => kind.templates)) {
201
+ throw new Error(`Schematic: the library lists ${tabName(tab)}, and none of its kinds has templates — give an item, link or net kind templates: ` +
202
+ "Schematic.templates(templates.read(), { name, values, source })");
203
+ }
204
+ if (tab.kind === "backlog" && !ctx.kinds.some((kind) => kind.sort === "items" && kind.backlog)) {
205
+ const items = ctx.kinds.filter((kind) => kind.sort === "items").map((kind) => `"${kind.slot}"`).join(", ");
206
+ throw new Error(`Schematic: the library lists ${tabName(tab)}, and every item kind places every row — ${items} take Float \`x\` and \`y\` fields: ` +
207
+ "make an item kind's Options of Float to give it rows with no position");
208
+ }
209
+ if (tab.kind === "index" && !ctx.kinds.some((kind) => kind.sort === "zones")) {
210
+ throw new Error("Schematic: the library lists Schematic.library.index(), and this Schematic has no zone kinds — the Index tab lists the zones (Schematic.zones), nested by containment");
211
+ }
212
+ if (tab.kind === "layers" && !ctx.layers) {
213
+ throw new Error("Schematic: the library lists Schematic.library.layers(), and this Schematic declares no layers — read them from the app's record: " +
214
+ "layers={Schematic.layers(systems.read(), { label })}");
215
+ }
216
+ }
217
+ const landsOn = ctx.kinds.map((kind) => [kind.slot, { rowType: kind.rowType }]);
218
+ const wires = tabs.map((tab) => {
219
+ switch (tab.kind) {
220
+ case "templates":
221
+ case "backlog":
222
+ case "index":
223
+ case "layers":
224
+ return East.value(variant(tab.kind, null), SchematicLibraryTabType);
225
+ case "tab":
226
+ return East.value(variant("tab", buildScheduleTab(tab, landsOn, "Schematic", ctx.sources, { kind: "kind", patch: "Schematic.patch" })), SchematicLibraryTabType);
227
+ }
228
+ });
229
+ return East.value(wires, ArrayType(SchematicLibraryTabType));
230
+ }
231
+ /**
232
+ * The sources of the slice the author's tabs name: each must be one of the
233
+ * slice's, and is one it may hold.
234
+ *
235
+ * @param tabs - The Schematic's `library`
236
+ * @returns The sources its tabs name, in order
237
+ * @internal
238
+ */
239
+ export function schematicTabSources(tabs) {
240
+ if (!Array.isArray(tabs))
241
+ return [];
242
+ return tabs.filter(isTab).flatMap((tab) => tab.kind === "tab" && tab.config.source !== undefined ? [tab.config.source] : []);
243
+ }
244
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../../src/schematic/library.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAyF,MAAM,eAAe,CAAC;AACvK,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAiC,MAAM,wBAAwB,CAAC;AAEhH,OAAO,EAAE,uBAAuB,IAAI,wBAAwB,EAA8D,MAAM,wBAAwB,CAAC;AAEzJ,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;IAC/C,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,qBAAqB;CAC7B,CAAC,CAAC;AAiBH;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,GAA4B,EAAE,KAAyB;IACxE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW;QAC/B,CAAC,CAAC,qIAAqI;QACvI,CAAC,CAAC,oJAAoJ,CAAC,CAAC;AAChK,CAAC;AAED;;;;;;;;;;GAUG;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