@elaraai/e3-ui 1.0.86 → 1.0.88
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/bind/data-indexed.d.ts +159 -0
- package/dist/src/bind/data-indexed.d.ts.map +1 -0
- package/dist/src/bind/data-indexed.js +105 -0
- package/dist/src/bind/data-indexed.js.map +1 -0
- package/dist/src/bind/data.d.ts +5 -3
- package/dist/src/bind/data.d.ts.map +1 -1
- package/dist/src/bind/data.js +6 -0
- package/dist/src/bind/data.js.map +1 -1
- package/dist/src/bind/record.d.ts +34 -23
- package/dist/src/bind/record.d.ts.map +1 -1
- package/dist/src/bind/record.js +46 -19
- package/dist/src/bind/record.js.map +1 -1
- package/dist/src/calendar/index.d.ts +2923 -0
- package/dist/src/calendar/index.d.ts.map +1 -0
- package/dist/src/calendar/index.js +135 -0
- package/dist/src/calendar/index.js.map +1 -0
- package/dist/src/decision/queue.d.ts +3 -3
- package/dist/src/decision/queue.d.ts.map +1 -1
- package/dist/src/decision/queue.js +2 -2
- package/dist/src/decision/queue.js.map +1 -1
- package/dist/src/decision/types.d.ts +4 -0
- package/dist/src/decision/types.d.ts.map +1 -1
- package/dist/src/decision/types.js +4 -0
- package/dist/src/decision/types.js.map +1 -1
- package/dist/src/flowchart/canvas.d.ts +114 -0
- package/dist/src/flowchart/canvas.d.ts.map +1 -0
- package/dist/src/flowchart/canvas.js +84 -0
- package/dist/src/flowchart/canvas.js.map +1 -0
- package/dist/src/flowchart/flowchart.d.ts +79 -0
- package/dist/src/flowchart/flowchart.d.ts.map +1 -0
- package/dist/src/flowchart/flowchart.js +9 -0
- package/dist/src/flowchart/flowchart.js.map +1 -0
- package/dist/src/flowchart/index.d.ts +305 -0
- package/dist/src/flowchart/index.d.ts.map +1 -0
- package/dist/src/flowchart/index.js +267 -0
- package/dist/src/flowchart/index.js.map +1 -0
- package/dist/src/flowchart/library.d.ts +720 -0
- package/dist/src/flowchart/library.d.ts.map +1 -0
- package/dist/src/flowchart/library.js +611 -0
- package/dist/src/flowchart/library.js.map +1 -0
- package/dist/src/flowchart/over.d.ts +234 -0
- package/dist/src/flowchart/over.d.ts.map +1 -0
- package/dist/src/flowchart/over.js +220 -0
- package/dist/src/flowchart/over.js.map +1 -0
- package/dist/src/flowchart/patch.d.ts +64 -0
- package/dist/src/flowchart/patch.d.ts.map +1 -0
- package/dist/src/flowchart/patch.js +67 -0
- package/dist/src/flowchart/patch.js.map +1 -0
- package/dist/src/flowchart/payload.d.ts +8220 -0
- package/dist/src/flowchart/payload.d.ts.map +1 -0
- package/dist/src/flowchart/payload.js +521 -0
- package/dist/src/flowchart/payload.js.map +1 -0
- package/dist/src/flowchart/types.d.ts +393 -0
- package/dist/src/flowchart/types.d.ts.map +1 -0
- package/dist/src/flowchart/types.js +216 -0
- package/dist/src/flowchart/types.js.map +1 -0
- package/dist/src/flowchart/values.d.ts +267 -0
- package/dist/src/flowchart/values.d.ts.map +1 -0
- package/dist/src/flowchart/values.js +216 -0
- package/dist/src/flowchart/values.js.map +1 -0
- package/dist/src/flowchart/window.d.ts +521 -0
- package/dist/src/flowchart/window.d.ts.map +1 -0
- package/dist/src/flowchart/window.js +69 -0
- package/dist/src/flowchart/window.js.map +1 -0
- package/dist/src/index.d.ts +25 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +35 -3
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +72 -3
- package/dist/src/internal.js.map +1 -1
- package/dist/src/plan/assemble.d.ts +2224 -0
- package/dist/src/plan/assemble.d.ts.map +1 -0
- package/dist/src/plan/assemble.js +210 -0
- package/dist/src/plan/assemble.js.map +1 -0
- package/dist/src/plan/builders.d.ts +790 -0
- package/dist/src/plan/builders.d.ts.map +1 -0
- package/dist/src/plan/builders.js +749 -0
- package/dist/src/plan/builders.js.map +1 -0
- package/dist/src/plan/event-rows.d.ts +2565 -0
- package/dist/src/plan/event-rows.d.ts.map +1 -0
- package/dist/src/plan/event-rows.js +689 -0
- package/dist/src/plan/event-rows.js.map +1 -0
- package/dist/src/plan/factories.d.ts +458 -0
- package/dist/src/plan/factories.d.ts.map +1 -0
- package/dist/src/plan/factories.js +484 -0
- package/dist/src/plan/factories.js.map +1 -0
- package/dist/src/plan/index.d.ts +672 -0
- package/dist/src/plan/index.d.ts.map +1 -0
- package/dist/src/plan/index.js +532 -0
- package/dist/src/plan/index.js.map +1 -0
- package/dist/src/plan/ir.d.ts +2594 -0
- package/dist/src/plan/ir.d.ts.map +1 -0
- package/dist/src/plan/ir.js +78 -0
- package/dist/src/plan/ir.js.map +1 -0
- package/dist/src/plan/library.d.ts +772 -0
- package/dist/src/plan/library.d.ts.map +1 -0
- package/dist/src/plan/library.js +424 -0
- package/dist/src/plan/library.js.map +1 -0
- package/dist/src/plan/ordered-source.d.ts +27 -0
- package/dist/src/plan/ordered-source.d.ts.map +1 -0
- package/dist/src/plan/ordered-source.js +48 -0
- package/dist/src/plan/ordered-source.js.map +1 -0
- package/dist/src/plan/over.d.ts +247 -0
- package/dist/src/plan/over.d.ts.map +1 -0
- package/dist/src/plan/over.js +266 -0
- package/dist/src/plan/over.js.map +1 -0
- package/dist/src/plan/pick.d.ts +78 -0
- package/dist/src/plan/pick.d.ts.map +1 -0
- package/dist/src/plan/pick.js +146 -0
- package/dist/src/plan/pick.js.map +1 -0
- package/dist/src/plan/plan.d.ts +11611 -0
- package/dist/src/plan/plan.d.ts.map +1 -0
- package/dist/src/plan/plan.js +428 -0
- package/dist/src/plan/plan.js.map +1 -0
- package/dist/src/plan/refs.d.ts +218 -0
- package/dist/src/plan/refs.d.ts.map +1 -0
- package/dist/src/plan/refs.js +226 -0
- package/dist/src/plan/refs.js.map +1 -0
- package/dist/src/plan/root.d.ts +290 -0
- package/dist/src/plan/root.d.ts.map +1 -0
- package/dist/src/plan/root.js +463 -0
- package/dist/src/plan/root.js.map +1 -0
- package/dist/src/plan/series.d.ts +13554 -0
- package/dist/src/plan/series.d.ts.map +1 -0
- package/dist/src/plan/series.js +1921 -0
- package/dist/src/plan/series.js.map +1 -0
- package/dist/src/plan/types.d.ts +12400 -0
- package/dist/src/plan/types.d.ts.map +1 -0
- package/dist/src/plan/types.js +1335 -0
- package/dist/src/plan/types.js.map +1 -0
- package/dist/src/roster/coverage.d.ts +240 -0
- package/dist/src/roster/coverage.d.ts.map +1 -0
- package/dist/src/roster/coverage.js +109 -0
- package/dist/src/roster/coverage.js.map +1 -0
- package/dist/src/roster/index.d.ts +4028 -0
- package/dist/src/roster/index.d.ts.map +1 -0
- package/dist/src/roster/index.js +115 -0
- package/dist/src/roster/index.js.map +1 -0
- package/dist/src/roster/library.d.ts +106 -0
- package/dist/src/roster/library.d.ts.map +1 -0
- package/dist/src/roster/library.js +78 -0
- package/dist/src/roster/library.js.map +1 -0
- package/dist/src/roster/people.d.ts +50 -0
- package/dist/src/roster/people.d.ts.map +1 -0
- package/dist/src/roster/people.js +32 -0
- package/dist/src/roster/people.js.map +1 -0
- package/dist/src/roster/rules.d.ts +275 -0
- package/dist/src/roster/rules.d.ts.map +1 -0
- package/dist/src/roster/rules.js +162 -0
- package/dist/src/roster/rules.js.map +1 -0
- package/dist/src/roster/types.d.ts +672 -0
- package/dist/src/roster/types.d.ts.map +1 -0
- package/dist/src/roster/types.js +248 -0
- package/dist/src/roster/types.js.map +1 -0
- package/dist/src/roster/visibility.d.ts +66 -0
- package/dist/src/roster/visibility.d.ts.map +1 -0
- package/dist/src/roster/visibility.js +25 -0
- package/dist/src/roster/visibility.js.map +1 -0
- package/dist/src/schedule/days.d.ts +54 -0
- package/dist/src/schedule/days.d.ts.map +1 -0
- package/dist/src/schedule/days.js +68 -0
- package/dist/src/schedule/days.js.map +1 -0
- package/dist/src/schedule/events.d.ts +433 -0
- package/dist/src/schedule/events.d.ts.map +1 -0
- package/dist/src/schedule/events.js +851 -0
- package/dist/src/schedule/events.js.map +1 -0
- package/dist/src/schedule/index.d.ts +150 -0
- package/dist/src/schedule/index.d.ts.map +1 -0
- package/dist/src/schedule/index.js +132 -0
- package/dist/src/schedule/index.js.map +1 -0
- package/dist/src/schedule/library.d.ts +70 -0
- package/dist/src/schedule/library.d.ts.map +1 -0
- package/dist/src/schedule/library.js +102 -0
- package/dist/src/schedule/library.js.map +1 -0
- package/dist/src/schedule/patch.d.ts +74 -0
- package/dist/src/schedule/patch.d.ts.map +1 -0
- package/dist/src/schedule/patch.js +68 -0
- package/dist/src/schedule/patch.js.map +1 -0
- package/dist/src/schedule/record-window.d.ts +189 -0
- package/dist/src/schedule/record-window.d.ts.map +1 -0
- package/dist/src/schedule/record-window.js +95 -0
- package/dist/src/schedule/record-window.js.map +1 -0
- package/dist/src/schedule/resources.d.ts +165 -0
- package/dist/src/schedule/resources.d.ts.map +1 -0
- package/dist/src/schedule/resources.js +234 -0
- package/dist/src/schedule/resources.js.map +1 -0
- package/dist/src/schedule/templates.d.ts +47 -0
- package/dist/src/schedule/templates.d.ts.map +1 -0
- package/dist/src/schedule/templates.js +61 -0
- package/dist/src/schedule/templates.js.map +1 -0
- package/dist/src/schedule/types.d.ts +1677 -0
- package/dist/src/schedule/types.d.ts.map +1 -0
- package/dist/src/schedule/types.js +374 -0
- package/dist/src/schedule/types.js.map +1 -0
- package/dist/src/schedule/window.d.ts +154 -0
- package/dist/src/schedule/window.d.ts.map +1 -0
- package/dist/src/schedule/window.js +363 -0
- package/dist/src/schedule/window.js.map +1 -0
- package/dist/src/sheet/bridge.d.ts +385 -0
- package/dist/src/sheet/bridge.d.ts.map +1 -0
- package/dist/src/sheet/bridge.js +809 -0
- package/dist/src/sheet/bridge.js.map +1 -0
- package/dist/src/sheet/columns.d.ts +410 -0
- package/dist/src/sheet/columns.d.ts.map +1 -0
- package/dist/src/sheet/columns.js +99 -0
- package/dist/src/sheet/columns.js.map +1 -0
- package/dist/src/sheet/context-bridge.d.ts +48 -0
- package/dist/src/sheet/context-bridge.d.ts.map +1 -0
- package/dist/src/sheet/context-bridge.js +216 -0
- package/dist/src/sheet/context-bridge.js.map +1 -0
- package/dist/src/sheet/draft-bridge.d.ts +37 -0
- package/dist/src/sheet/draft-bridge.d.ts.map +1 -0
- package/dist/src/sheet/draft-bridge.js +153 -0
- package/dist/src/sheet/draft-bridge.js.map +1 -0
- package/dist/src/sheet/drafts.d.ts +14 -0
- package/dist/src/sheet/drafts.d.ts.map +1 -0
- package/dist/src/sheet/drafts.js +14 -0
- package/dist/src/sheet/drafts.js.map +1 -0
- package/dist/src/sheet/editing-bridge.d.ts +40 -0
- package/dist/src/sheet/editing-bridge.d.ts.map +1 -0
- package/dist/src/sheet/editing-bridge.js +231 -0
- package/dist/src/sheet/editing-bridge.js.map +1 -0
- package/dist/src/sheet/editing-types.d.ts +268 -0
- package/dist/src/sheet/editing-types.d.ts.map +1 -0
- package/dist/src/sheet/editing-types.js +34 -0
- package/dist/src/sheet/editing-types.js.map +1 -0
- package/dist/src/sheet/edits.d.ts +37 -0
- package/dist/src/sheet/edits.d.ts.map +1 -0
- package/dist/src/sheet/edits.js +31 -0
- package/dist/src/sheet/edits.js.map +1 -0
- package/dist/src/sheet/fields.d.ts +693 -0
- package/dist/src/sheet/fields.d.ts.map +1 -0
- package/dist/src/sheet/fields.js +280 -0
- package/dist/src/sheet/fields.js.map +1 -0
- package/dist/src/sheet/group.d.ts +165 -0
- package/dist/src/sheet/group.d.ts.map +1 -0
- package/dist/src/sheet/group.js +52 -0
- package/dist/src/sheet/group.js.map +1 -0
- package/dist/src/sheet/index.d.ts +542 -0
- package/dist/src/sheet/index.d.ts.map +1 -0
- package/dist/src/sheet/index.js +387 -0
- package/dist/src/sheet/index.js.map +1 -0
- package/dist/src/sheet/library.d.ts +284 -0
- package/dist/src/sheet/library.d.ts.map +1 -0
- package/dist/src/sheet/library.js +259 -0
- package/dist/src/sheet/library.js.map +1 -0
- package/dist/src/sheet/link.d.ts +398 -0
- package/dist/src/sheet/link.d.ts.map +1 -0
- package/dist/src/sheet/link.js +228 -0
- package/dist/src/sheet/link.js.map +1 -0
- package/dist/src/sheet/record.d.ts +75 -0
- package/dist/src/sheet/record.d.ts.map +1 -0
- package/dist/src/sheet/record.js +128 -0
- package/dist/src/sheet/record.js.map +1 -0
- package/dist/src/sheet/registers.d.ts +681 -0
- package/dist/src/sheet/registers.d.ts.map +1 -0
- package/dist/src/sheet/registers.js +671 -0
- package/dist/src/sheet/registers.js.map +1 -0
- package/dist/src/sheet/root.d.ts +329 -0
- package/dist/src/sheet/root.d.ts.map +1 -0
- package/dist/src/sheet/root.js +511 -0
- package/dist/src/sheet/root.js.map +1 -0
- package/dist/src/sheet/seed-bridge.d.ts +14 -0
- package/dist/src/sheet/seed-bridge.d.ts.map +1 -0
- package/dist/src/sheet/seed-bridge.js +51 -0
- package/dist/src/sheet/seed-bridge.js.map +1 -0
- package/dist/src/sheet/sheet.d.ts +11819 -0
- package/dist/src/sheet/sheet.d.ts.map +1 -0
- package/dist/src/sheet/sheet.js +236 -0
- package/dist/src/sheet/sheet.js.map +1 -0
- package/dist/src/sheet/sub-rows.d.ts +299 -0
- package/dist/src/sheet/sub-rows.d.ts.map +1 -0
- package/dist/src/sheet/sub-rows.js +272 -0
- package/dist/src/sheet/sub-rows.js.map +1 -0
- package/dist/src/sheet/templates.d.ts +161 -0
- package/dist/src/sheet/templates.d.ts.map +1 -0
- package/dist/src/sheet/templates.js +122 -0
- package/dist/src/sheet/templates.js.map +1 -0
- package/dist/src/sheet/transactions.d.ts +76 -0
- package/dist/src/sheet/transactions.d.ts.map +1 -0
- package/dist/src/sheet/transactions.js +40 -0
- package/dist/src/sheet/transactions.js.map +1 -0
- package/dist/src/sheet/types.d.ts +15226 -0
- package/dist/src/sheet/types.d.ts.map +1 -0
- package/dist/src/sheet/types.js +1070 -0
- package/dist/src/sheet/types.js.map +1 -0
- package/dist/src/sheet/views.d.ts +29 -0
- package/dist/src/sheet/views.d.ts.map +1 -0
- package/dist/src/sheet/views.js +43 -0
- package/dist/src/sheet/views.js.map +1 -0
- package/dist/src/studio/component.d.ts.map +1 -1
- package/dist/src/studio/component.js +11 -8
- package/dist/src/studio/component.js.map +1 -1
- package/dist/src/utils/derive.d.ts +134 -8
- package/dist/src/utils/derive.d.ts.map +1 -1
- package/dist/src/utils/derive.js +409 -7
- package/dist/src/utils/derive.js.map +1 -1
- package/dist/src/utils/ordered-source.d.ts +38 -0
- package/dist/src/utils/ordered-source.d.ts.map +1 -0
- package/dist/src/utils/ordered-source.js +45 -0
- package/dist/src/utils/ordered-source.js.map +1 -0
- package/dist/src/utils/row-inspector.d.ts +36 -0
- package/dist/src/utils/row-inspector.d.ts.map +1 -0
- package/dist/src/utils/row-inspector.js +49 -0
- package/dist/src/utils/row-inspector.js.map +1 -0
- package/dist/test/bind/data/data.examples.d.ts +21 -19
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +122 -122
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts.map +1 -1
- package/dist/test/bind/record/record.examples.js +9 -9
- package/dist/test/bind/record/record.examples.js.map +1 -1
- package/dist/test/calendar/calendar-records.examples.d.ts +228 -0
- package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar-records.examples.js +91 -0
- package/dist/test/calendar/calendar-records.examples.js.map +1 -0
- package/dist/test/calendar/calendar.examples.d.ts +776 -0
- package/dist/test/calendar/calendar.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar.examples.js +336 -0
- package/dist/test/calendar/calendar.examples.js.map +1 -0
- package/dist/test/decision/journal.examples.d.ts +28 -28
- package/dist/test/decision/journal.examples.d.ts.map +1 -1
- package/dist/test/decision/journal.examples.js +4 -4
- package/dist/test/decision/journal.examples.js.map +1 -1
- package/dist/test/decision/queue.examples.d.ts.map +1 -1
- package/dist/test/decision/queue.examples.js +5 -7
- package/dist/test/decision/queue.examples.js.map +1 -1
- package/dist/test/flowchart/flowchart.examples.d.ts +3713 -0
- package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -0
- package/dist/test/flowchart/flowchart.examples.js +465 -0
- package/dist/test/flowchart/flowchart.examples.js.map +1 -0
- package/dist/test/plan/plan-events.examples.d.ts +3666 -0
- package/dist/test/plan/plan-events.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-events.examples.js +773 -0
- package/dist/test/plan/plan-events.examples.js.map +1 -0
- package/dist/test/plan/plan-records.examples.d.ts +3 -0
- package/dist/test/plan/plan-records.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-records.examples.js +45 -0
- package/dist/test/plan/plan-records.examples.js.map +1 -0
- package/dist/test/plan/plan-windows.examples.d.ts +588 -0
- package/dist/test/plan/plan-windows.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-windows.examples.js +170 -0
- package/dist/test/plan/plan-windows.examples.js.map +1 -0
- package/dist/test/plan/plan.examples.d.ts +8095 -0
- package/dist/test/plan/plan.examples.d.ts.map +1 -0
- package/dist/test/plan/plan.examples.js +2500 -0
- package/dist/test/plan/plan.examples.js.map +1 -0
- package/dist/test/roster/domain.examples.d.ts +367 -0
- package/dist/test/roster/domain.examples.d.ts.map +1 -0
- package/dist/test/roster/domain.examples.js +72 -0
- package/dist/test/roster/domain.examples.js.map +1 -0
- package/dist/test/roster/roster-records.examples.d.ts +729 -0
- package/dist/test/roster/roster-records.examples.d.ts.map +1 -0
- package/dist/test/roster/roster-records.examples.js +86 -0
- package/dist/test/roster/roster-records.examples.js.map +1 -0
- package/dist/test/roster/roster.examples.d.ts +750 -0
- package/dist/test/roster/roster.examples.d.ts.map +1 -0
- package/dist/test/roster/roster.examples.js +198 -0
- package/dist/test/roster/roster.examples.js.map +1 -0
- package/dist/test/roster/warehouse.d.ts +87 -0
- package/dist/test/roster/warehouse.d.ts.map +1 -0
- package/dist/test/roster/warehouse.js +883 -0
- package/dist/test/roster/warehouse.js.map +1 -0
- package/dist/test/sheet/sheet-link.examples.d.ts +7 -0
- package/dist/test/sheet/sheet-link.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-link.examples.js +41 -0
- package/dist/test/sheet/sheet-link.examples.js.map +1 -0
- package/dist/test/sheet/sheet-records.examples.d.ts +421 -0
- package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-records.examples.js +79 -0
- package/dist/test/sheet/sheet-records.examples.js.map +1 -0
- package/dist/test/sheet/sheet-transactions.examples.d.ts +7 -0
- package/dist/test/sheet/sheet-transactions.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-transactions.examples.js +58 -0
- package/dist/test/sheet/sheet-transactions.examples.js.map +1 -0
- package/dist/test/sheet/sheet.examples.d.ts +5562 -0
- package/dist/test/sheet/sheet.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet.examples.js +1178 -0
- package/dist/test/sheet/sheet.examples.js.map +1 -0
- package/dist/test/studio/studio.examples.d.ts.map +1 -1
- package/dist/test/studio/studio.examples.js +11 -11
- package/dist/test/studio/studio.examples.js.map +1 -1
- 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
|