@elaraai/e3-ui 1.0.96 → 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.
- package/dist/src/allocation/index.d.ts +258 -7
- package/dist/src/allocation/index.d.ts.map +1 -1
- package/dist/src/allocation/index.js +30 -1
- package/dist/src/allocation/index.js.map +1 -1
- package/dist/src/allocation/types.d.ts +41 -0
- package/dist/src/allocation/types.d.ts.map +1 -1
- package/dist/src/allocation/types.js +35 -0
- package/dist/src/allocation/types.js.map +1 -1
- package/dist/src/bind/data-indexed.d.ts +31 -4
- package/dist/src/bind/data-indexed.d.ts.map +1 -1
- package/dist/src/bind/data-indexed.js +54 -10
- package/dist/src/bind/data-indexed.js.map +1 -1
- package/dist/src/calendar/index.d.ts +540 -14
- package/dist/src/calendar/index.d.ts.map +1 -1
- package/dist/src/calendar/index.js +43 -7
- package/dist/src/calendar/index.js.map +1 -1
- package/dist/src/calendar/paged.d.ts +89 -0
- package/dist/src/calendar/paged.d.ts.map +1 -0
- package/dist/src/calendar/paged.js +148 -0
- package/dist/src/calendar/paged.js.map +1 -0
- package/dist/src/flowchart/payload.d.ts +156 -0
- package/dist/src/flowchart/payload.d.ts.map +1 -1
- package/dist/src/flowchart/window.d.ts +12 -0
- package/dist/src/flowchart/window.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +19 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +11 -5
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +28 -7
- package/dist/src/internal.js.map +1 -1
- package/dist/src/plan/builders.d.ts +12 -8
- package/dist/src/plan/builders.d.ts.map +1 -1
- package/dist/src/plan/builders.js +12 -8
- package/dist/src/plan/builders.js.map +1 -1
- package/dist/src/plan/event-rows.d.ts +228 -156
- package/dist/src/plan/event-rows.d.ts.map +1 -1
- package/dist/src/plan/event-rows.js +239 -54
- package/dist/src/plan/event-rows.js.map +1 -1
- package/dist/src/plan/index.d.ts +5 -0
- package/dist/src/plan/index.d.ts.map +1 -1
- package/dist/src/plan/index.js +3 -0
- package/dist/src/plan/index.js.map +1 -1
- package/dist/src/plan/ir.d.ts +70 -0
- package/dist/src/plan/ir.d.ts.map +1 -1
- package/dist/src/plan/ordered-source.d.ts +2038 -1
- package/dist/src/plan/ordered-source.d.ts.map +1 -1
- package/dist/src/plan/ordered-source.js +19 -11
- package/dist/src/plan/ordered-source.js.map +1 -1
- package/dist/src/plan/plan.d.ts +513 -32
- package/dist/src/plan/plan.d.ts.map +1 -1
- package/dist/src/plan/plan.js +119 -32
- package/dist/src/plan/plan.js.map +1 -1
- package/dist/src/plan/root.d.ts +4 -2
- package/dist/src/plan/root.d.ts.map +1 -1
- package/dist/src/plan/root.js +6 -4
- package/dist/src/plan/root.js.map +1 -1
- package/dist/src/plan/series.d.ts +13 -0
- package/dist/src/plan/series.d.ts.map +1 -1
- package/dist/src/plan/series.js +61 -7
- package/dist/src/plan/series.js.map +1 -1
- package/dist/src/plan/types.d.ts +14 -0
- package/dist/src/plan/types.d.ts.map +1 -1
- package/dist/src/plan/types.js +8 -0
- package/dist/src/plan/types.js.map +1 -1
- package/dist/src/roster/index.d.ts +608 -20
- package/dist/src/roster/index.d.ts.map +1 -1
- package/dist/src/roster/index.js +103 -29
- package/dist/src/roster/index.js.map +1 -1
- package/dist/src/roster/library.d.ts +12 -2
- package/dist/src/roster/library.d.ts.map +1 -1
- package/dist/src/roster/library.js +8 -0
- package/dist/src/roster/library.js.map +1 -1
- package/dist/src/roster/lists.d.ts +59 -12
- package/dist/src/roster/lists.d.ts.map +1 -1
- package/dist/src/roster/lists.js +51 -58
- package/dist/src/roster/lists.js.map +1 -1
- package/dist/src/roster/times.d.ts +402 -0
- package/dist/src/roster/times.d.ts.map +1 -1
- package/dist/src/roster/types.d.ts +913 -1
- package/dist/src/roster/types.d.ts.map +1 -1
- package/dist/src/roster/types.js +43 -3
- package/dist/src/roster/types.js.map +1 -1
- package/dist/src/schedule/cell-checks.d.ts +85 -0
- package/dist/src/schedule/cell-checks.d.ts.map +1 -0
- package/dist/src/schedule/cell-checks.js +211 -0
- package/dist/src/schedule/cell-checks.js.map +1 -0
- package/dist/src/schedule/events.d.ts +42 -10
- package/dist/src/schedule/events.d.ts.map +1 -1
- package/dist/src/schedule/events.js +349 -155
- package/dist/src/schedule/events.js.map +1 -1
- package/dist/src/schedule/fields.d.ts +134 -0
- package/dist/src/schedule/fields.d.ts.map +1 -0
- package/dist/src/schedule/fields.js +207 -0
- package/dist/src/schedule/fields.js.map +1 -0
- package/dist/src/schedule/library.d.ts +11 -3
- package/dist/src/schedule/library.d.ts.map +1 -1
- package/dist/src/schedule/library.js +9 -6
- package/dist/src/schedule/library.js.map +1 -1
- package/dist/src/schedule/optimise.d.ts +124 -0
- package/dist/src/schedule/optimise.d.ts.map +1 -0
- package/dist/src/schedule/optimise.js +140 -0
- package/dist/src/schedule/optimise.js.map +1 -0
- package/dist/src/schedule/pages.d.ts +76 -0
- package/dist/src/schedule/pages.d.ts.map +1 -0
- package/dist/src/schedule/pages.js +86 -0
- package/dist/src/schedule/pages.js.map +1 -0
- package/dist/src/schedule/record-window.d.ts +119 -6
- package/dist/src/schedule/record-window.d.ts.map +1 -1
- package/dist/src/schedule/record-window.js +139 -60
- package/dist/src/schedule/record-window.js.map +1 -1
- package/dist/src/schedule/resources.d.ts +8 -4
- package/dist/src/schedule/resources.d.ts.map +1 -1
- package/dist/src/schedule/resources.js +35 -15
- package/dist/src/schedule/resources.js.map +1 -1
- package/dist/src/schedule/session.d.ts +14 -0
- package/dist/src/schedule/session.d.ts.map +1 -1
- package/dist/src/schedule/session.js +29 -17
- package/dist/src/schedule/session.js.map +1 -1
- package/dist/src/schedule/types.d.ts +426 -36
- package/dist/src/schedule/types.d.ts.map +1 -1
- package/dist/src/schedule/types.js +63 -17
- package/dist/src/schedule/types.js.map +1 -1
- package/dist/src/schedule/window.d.ts +30 -9
- package/dist/src/schedule/window.d.ts.map +1 -1
- package/dist/src/schedule/window.js +101 -49
- package/dist/src/schedule/window.js.map +1 -1
- package/dist/src/schematic/index.d.ts +277 -0
- package/dist/src/schematic/index.d.ts.map +1 -0
- package/dist/src/schematic/index.js +206 -0
- package/dist/src/schematic/index.js.map +1 -0
- package/dist/src/schematic/kinds.d.ts +501 -0
- package/dist/src/schematic/kinds.d.ts.map +1 -0
- package/dist/src/schematic/kinds.js +1027 -0
- package/dist/src/schematic/kinds.js.map +1 -0
- package/dist/src/schematic/layers.d.ts +74 -0
- package/dist/src/schematic/layers.d.ts.map +1 -0
- package/dist/src/schematic/layers.js +99 -0
- package/dist/src/schematic/layers.js.map +1 -0
- package/dist/src/schematic/library.d.ts +202 -0
- package/dist/src/schematic/library.d.ts.map +1 -0
- package/dist/src/schematic/library.js +244 -0
- package/dist/src/schematic/library.js.map +1 -0
- package/dist/src/schematic/payload.d.ts +8360 -0
- package/dist/src/schematic/payload.d.ts.map +1 -0
- package/dist/src/schematic/payload.js +446 -0
- package/dist/src/schematic/payload.js.map +1 -0
- package/dist/src/schematic/schematic.d.ts +27 -0
- package/dist/src/schematic/schematic.d.ts.map +1 -0
- package/dist/src/schematic/schematic.js +17 -0
- package/dist/src/schematic/schematic.js.map +1 -0
- package/dist/src/schematic/shapes.d.ts +150 -0
- package/dist/src/schematic/shapes.d.ts.map +1 -0
- package/dist/src/schematic/shapes.js +171 -0
- package/dist/src/schematic/shapes.js.map +1 -0
- package/dist/src/schematic/templates.d.ts +96 -0
- package/dist/src/schematic/templates.d.ts.map +1 -0
- package/dist/src/schematic/templates.js +91 -0
- package/dist/src/schematic/templates.js.map +1 -0
- package/dist/src/schematic/types.d.ts +5766 -0
- package/dist/src/schematic/types.d.ts.map +1 -0
- package/dist/src/schematic/types.js +688 -0
- package/dist/src/schematic/types.js.map +1 -0
- package/dist/src/schematic/window.d.ts +212 -0
- package/dist/src/schematic/window.d.ts.map +1 -0
- package/dist/src/schematic/window.js +337 -0
- package/dist/src/schematic/window.js.map +1 -0
- package/dist/src/sheet/editing-bridge.d.ts +4 -2
- package/dist/src/sheet/editing-bridge.d.ts.map +1 -1
- package/dist/src/sheet/editing-bridge.js +8 -2
- package/dist/src/sheet/editing-bridge.js.map +1 -1
- package/dist/src/sheet/editing-types.d.ts +9 -5
- package/dist/src/sheet/editing-types.d.ts.map +1 -1
- package/dist/src/sheet/editing-types.js +9 -5
- package/dist/src/sheet/editing-types.js.map +1 -1
- package/dist/src/sheet/index.d.ts +18 -8
- package/dist/src/sheet/index.d.ts.map +1 -1
- package/dist/src/sheet/index.js +15 -7
- package/dist/src/sheet/index.js.map +1 -1
- package/dist/src/sheet/optimise.d.ts +69 -0
- package/dist/src/sheet/optimise.d.ts.map +1 -0
- package/dist/src/sheet/optimise.js +81 -0
- package/dist/src/sheet/optimise.js.map +1 -0
- package/dist/src/sheet/registers.d.ts +5 -5
- package/dist/src/sheet/registers.js +5 -5
- package/dist/src/sheet/root.d.ts +2 -0
- package/dist/src/sheet/root.d.ts.map +1 -1
- package/dist/src/sheet/root.js +2 -2
- package/dist/src/sheet/root.js.map +1 -1
- package/dist/src/sheet/sheet.d.ts +753 -573
- package/dist/src/sheet/sheet.d.ts.map +1 -1
- package/dist/src/sheet/sheet.js +45 -13
- package/dist/src/sheet/sheet.js.map +1 -1
- package/dist/src/sheet/types.d.ts +92 -12
- package/dist/src/sheet/types.d.ts.map +1 -1
- package/dist/src/sheet/types.js +4 -8
- package/dist/src/sheet/types.js.map +1 -1
- package/dist/src/utils/keyed-rows.d.ts +41 -0
- package/dist/src/utils/keyed-rows.d.ts.map +1 -0
- package/dist/src/utils/keyed-rows.js +64 -0
- package/dist/src/utils/keyed-rows.js.map +1 -0
- package/dist/src/utils/optimise.d.ts +79 -0
- package/dist/src/utils/optimise.d.ts.map +1 -0
- package/dist/src/utils/optimise.js +46 -0
- package/dist/src/utils/optimise.js.map +1 -0
- package/dist/test/allocation/allocation.examples.d.ts +6 -18
- package/dist/test/allocation/allocation.examples.d.ts.map +1 -1
- package/dist/test/allocation/allocation.examples.js +3 -3
- package/dist/test/allocation/allocation.examples.js.map +1 -1
- package/dist/test/allocation/optimise.examples.d.ts +109 -0
- package/dist/test/allocation/optimise.examples.d.ts.map +1 -0
- package/dist/test/allocation/optimise.examples.js +223 -0
- package/dist/test/allocation/optimise.examples.js.map +1 -0
- package/dist/test/bind/data/data.examples.d.ts +540 -36
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +66 -2
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts +1 -3
- package/dist/test/bind/record/record.examples.d.ts.map +1 -1
- package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -1
- package/dist/test/calendar/calendar-records.examples.js +3 -3
- package/dist/test/calendar/calendar-records.examples.js.map +1 -1
- package/dist/test/calendar/calendar-windows.examples.d.ts +9 -0
- package/dist/test/calendar/calendar-windows.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar-windows.examples.js +111 -0
- package/dist/test/calendar/calendar-windows.examples.js.map +1 -0
- package/dist/test/calendar/calendar.examples.d.ts +7 -21
- package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
- package/dist/test/calendar/calendar.examples.js +7 -7
- package/dist/test/calendar/calendar.examples.js.map +1 -1
- package/dist/test/calendar/optimise.examples.d.ts +132 -0
- package/dist/test/calendar/optimise.examples.d.ts.map +1 -0
- package/dist/test/calendar/optimise.examples.js +75 -0
- package/dist/test/calendar/optimise.examples.js.map +1 -0
- package/dist/test/examples-package.d.ts +46 -10
- package/dist/test/examples-package.d.ts.map +1 -1
- package/dist/test/examples-package.js +142 -32
- package/dist/test/examples-package.js.map +1 -1
- package/dist/test/flowchart/flowchart.examples.d.ts +10 -30
- package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
- package/dist/test/plan/optimise.examples.d.ts +207 -0
- package/dist/test/plan/optimise.examples.d.ts.map +1 -0
- package/dist/test/plan/optimise.examples.js +98 -0
- package/dist/test/plan/optimise.examples.js.map +1 -0
- package/dist/test/plan/plan-events.examples.d.ts +8 -24
- package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-events.examples.js +3 -3
- package/dist/test/plan/plan-events.examples.js.map +1 -1
- package/dist/test/plan/plan-records.examples.d.ts +200 -19
- package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-records.examples.js +125 -28
- package/dist/test/plan/plan-records.examples.js.map +1 -1
- package/dist/test/plan/plan-windows.examples.d.ts +853 -36
- package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-windows.examples.js +166 -29
- package/dist/test/plan/plan-windows.examples.js.map +1 -1
- package/dist/test/plan/plan.examples.d.ts +7 -21
- package/dist/test/plan/plan.examples.d.ts.map +1 -1
- package/dist/test/plan/plan.examples.js +11 -9
- package/dist/test/plan/plan.examples.js.map +1 -1
- package/dist/test/roster/domain.examples.d.ts +804 -0
- package/dist/test/roster/domain.examples.d.ts.map +1 -1
- package/dist/test/roster/domain.examples.js +3 -3
- package/dist/test/roster/domain.examples.js.map +1 -1
- package/dist/test/roster/optimise.examples.d.ts +485 -0
- package/dist/test/roster/optimise.examples.d.ts.map +1 -0
- package/dist/test/roster/optimise.examples.js +155 -0
- package/dist/test/roster/optimise.examples.js.map +1 -0
- package/dist/test/roster/roster-records.examples.d.ts +6 -18
- package/dist/test/roster/roster-records.examples.d.ts.map +1 -1
- package/dist/test/roster/roster-records.examples.js +1 -1
- package/dist/test/roster/roster-records.examples.js.map +1 -1
- package/dist/test/roster/roster.examples.d.ts +3391 -21
- package/dist/test/roster/roster.examples.d.ts.map +1 -1
- package/dist/test/roster/roster.examples.js +54 -7
- package/dist/test/roster/roster.examples.js.map +1 -1
- package/dist/test/roster/warehouse.d.ts +150 -7
- package/dist/test/roster/warehouse.d.ts.map +1 -1
- package/dist/test/roster/warehouse.js +36 -11
- package/dist/test/roster/warehouse.js.map +1 -1
- package/dist/test/schedule/schedule.examples.d.ts +1 -3
- package/dist/test/schedule/schedule.examples.d.ts.map +1 -1
- package/dist/test/schematic/schematic-records.examples.d.ts +444 -0
- package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -0
- package/dist/test/schematic/schematic-records.examples.js +205 -0
- package/dist/test/schematic/schematic-records.examples.js.map +1 -0
- package/dist/test/schematic/schematic.examples.d.ts +2289 -0
- package/dist/test/schematic/schematic.examples.d.ts.map +1 -0
- package/dist/test/schematic/schematic.examples.js +453 -0
- package/dist/test/schematic/schematic.examples.js.map +1 -0
- package/dist/test/sheet/optimise.examples.d.ts +177 -0
- package/dist/test/sheet/optimise.examples.d.ts.map +1 -0
- package/dist/test/sheet/optimise.examples.js +75 -0
- package/dist/test/sheet/optimise.examples.js.map +1 -0
- package/dist/test/sheet/sheet-records.examples.d.ts +95 -204
- package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
- package/dist/test/sheet/sheet-records.examples.js +42 -17
- package/dist/test/sheet/sheet-records.examples.js.map +1 -1
- package/dist/test/sheet/sheet.examples.d.ts +17 -33
- package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
- package/dist/test/sheet/sheet.examples.js +18 -15
- package/dist/test/sheet/sheet.examples.js.map +1 -1
- 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;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAG,KAAuB;IACvD,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,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