@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,1070 @@
|
|
|
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
|
+
* `Sheet` IR — the UIComponent-free types of the planning spreadsheet
|
|
7
|
+
* (`libs/east-ui/docs/proposals/Sheet Spec.md` §4).
|
|
8
|
+
*
|
|
9
|
+
* A sheet's rows are the host's structs, projected by the factory into a
|
|
10
|
+
* CLOSED wire row — an id, an `owned` flag and one cell per declared column
|
|
11
|
+
* — through the columns' reified accessors (the Table `valueFn` move, the
|
|
12
|
+
* Plan `derive` move). The host's row type `R` and the driver's row type `D`
|
|
13
|
+
* never appear here: everything the author writes over them is bridged by
|
|
14
|
+
* the factory into the closed context / cell / edit types below (§4.8), so
|
|
15
|
+
* the root `<Sheet>`'s payload carries ({@link SheetRootType}) is a closed
|
|
16
|
+
* type.
|
|
17
|
+
*
|
|
18
|
+
* This file holds only plain data and closed function types — no
|
|
19
|
+
* `UIComponentType`. The author-facing TYPED constructors (`Sheet.Types.Context(R, D)`, `Fill(T)`,
|
|
20
|
+
* `Patch(R)`, `Proposal(R)`, `CheckContext(R)`) live here too:
|
|
21
|
+
* they are type-level twins of the wire types, instantiated per row type
|
|
22
|
+
* (the `Plan.Types.Series(R)` pattern).
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
import { ArrayType, AsyncFunctionType, BooleanType, BlobType, DateTimeType, DictType, EastTypeType, FloatType, FunctionType, IntegerType, NullType, OptionType, StringType, StructType, VariantType, } from "@elaraai/east";
|
|
27
|
+
import { SheetDraftTypeFor } from "./transactions.js";
|
|
28
|
+
import { SheetDraftGroupTypeFor } from "./drafts.js";
|
|
29
|
+
import { SheetEditingType } from "./editing-types.js";
|
|
30
|
+
import { DensityType, RowSourceType, StatusValueType } from "@elaraai/east-ui";
|
|
31
|
+
import { RecordSliceChromeType, RecordSliceStateType, SliceChromeType, SliceStateType, TickFormatType } from "@elaraai/east-ui/internal";
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Links — members, the typed link value, the cell
|
|
34
|
+
// ============================================================================
|
|
35
|
+
/**
|
|
36
|
+
* One member of a link half — what the link grammar resolves a token to
|
|
37
|
+
* (B§4.1).
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* A member is never a bare string the host has to re-parse: a code that
|
|
41
|
+
* resolved against the register is `identified`, a `R2140-45` span is a
|
|
42
|
+
* `range` the register expands, a `4 × CNC router` count is `counted`, `TBC` is
|
|
43
|
+
* the dashed `placeholder`, and anything the grammar did not recognise is
|
|
44
|
+
* kept verbatim as `text` — typed entry is never blocked.
|
|
45
|
+
*
|
|
46
|
+
* @property identified - A register code (`"R2140"`)
|
|
47
|
+
* @property range - A span of codes, `from` to `to` (`"R2140-45"`, the upper bound completed)
|
|
48
|
+
* @property counted - A count of a countable member (`{ n: 4, key: "CNC router" }`)
|
|
49
|
+
* @property placeholder - The `TBC` placeholder
|
|
50
|
+
* @property text - Free text the grammar kept as typed
|
|
51
|
+
*/
|
|
52
|
+
export const SheetMemberType = VariantType({
|
|
53
|
+
identified: StructType({ key: StringType }),
|
|
54
|
+
range: StructType({ from: StringType, to: StringType }),
|
|
55
|
+
counted: StructType({ n: IntegerType, key: StringType }),
|
|
56
|
+
placeholder: NullType,
|
|
57
|
+
text: StringType,
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* The typed link value — a directed hyperedge between two sets of members
|
|
61
|
+
* (B§4).
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* A destination-only link is `from: []`; a source-only link is `to: []`, so
|
|
65
|
+
* the single-set data of B§4.2 needs no migration. The renderer's grammar is
|
|
66
|
+
* the kind's parse / print pair (`Sheet.link.parse` / `Sheet.link.print`).
|
|
67
|
+
*
|
|
68
|
+
* @property from - The source members
|
|
69
|
+
* @property to - The destination members
|
|
70
|
+
*/
|
|
71
|
+
export const SheetLinkType = StructType({
|
|
72
|
+
from: ArrayType(SheetMemberType),
|
|
73
|
+
to: ArrayType(SheetMemberType),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* One cell of the wire row — the Table's literal cell (#206) plus the
|
|
77
|
+
* typed link.
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* `Null` is the blank cell. A scalar column's cell is the field's value at
|
|
81
|
+
* the column kind's primitive; a `set` / `link` column's cell is a
|
|
82
|
+
* {@link SheetLinkType} value, never a string.
|
|
83
|
+
*
|
|
84
|
+
* @property Invalid - Unparseable draft text, retained verbatim until corrected
|
|
85
|
+
* @property Null - The blank cell
|
|
86
|
+
* @property Boolean - A boolean value
|
|
87
|
+
* @property Integer - An integer value
|
|
88
|
+
* @property Float - A float value (a `quantity` column's cell)
|
|
89
|
+
* @property String - A string value (text · lookup · reference · enum · stamped)
|
|
90
|
+
* @property DateTime - A UTC-midnight date (a `date` column's cell)
|
|
91
|
+
* @property Link - A typed link (a `set` / `link` column's cell)
|
|
92
|
+
*/
|
|
93
|
+
export const SheetCellType = VariantType({
|
|
94
|
+
Invalid: StringType,
|
|
95
|
+
Null: NullType,
|
|
96
|
+
Boolean: BooleanType,
|
|
97
|
+
Integer: IntegerType,
|
|
98
|
+
Float: FloatType,
|
|
99
|
+
String: StringType,
|
|
100
|
+
DateTime: DateTimeType,
|
|
101
|
+
Link: SheetLinkType,
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* One labelled fact of a sub row's detail (#844).
|
|
105
|
+
*
|
|
106
|
+
* @property label - What the fact is (the renderer sets it in capitals)
|
|
107
|
+
* @property value - The fact, printed
|
|
108
|
+
*/
|
|
109
|
+
export const SheetFacetType = StructType({
|
|
110
|
+
label: StringType,
|
|
111
|
+
value: StringType,
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* One SUB ROW on the wire (#844) — a read-only row under a line (or a flat
|
|
115
|
+
* row) that shares none of the sheet's columns: a lead (`code` and `name`),
|
|
116
|
+
* a detail (`chips`, then `facets`) and an `id` pinned right.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* `code` and `id` are display strings, `""` for none (the band's `sub`
|
|
120
|
+
* precedent). Build one with `Sheet.subRow({ … })`; declare where they come
|
|
121
|
+
* from with `Sheet.subRows(R, { … })`.
|
|
122
|
+
*
|
|
123
|
+
* @property code - The lead's code (`"ASM"`, or a word for what the row is); `""` for none
|
|
124
|
+
* @property name - The lead's words
|
|
125
|
+
* @property chips - The detail's parameter chips, first
|
|
126
|
+
* @property facets - The detail's labelled facts, after the chips
|
|
127
|
+
* @property id - The record the sub row traces to; `""` for none
|
|
128
|
+
*/
|
|
129
|
+
export const SheetSubRowType = StructType({
|
|
130
|
+
code: StringType,
|
|
131
|
+
name: StringType,
|
|
132
|
+
chips: ArrayType(StringType),
|
|
133
|
+
facets: ArrayType(SheetFacetType),
|
|
134
|
+
id: StringType,
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* One LINE of a group row on the wire (#740) — its cells, addressed within
|
|
138
|
+
* its group by `key`.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* A line has no id of its own: its `key` is its index in the group's lines
|
|
142
|
+
* array, printed. The line's cells are the line columns' projection, exactly
|
|
143
|
+
* a flat row's `cells`.
|
|
144
|
+
*
|
|
145
|
+
* @property key - The line's address within its group
|
|
146
|
+
* @property cells - Column key → cell, one entry per declared line column
|
|
147
|
+
* @property subRows - The line's sub rows, in declaration order (#844; empty without `subRows`)
|
|
148
|
+
*/
|
|
149
|
+
export const SheetLineType = StructType({
|
|
150
|
+
key: StringType,
|
|
151
|
+
cells: DictType(StringType, SheetCellType),
|
|
152
|
+
subRows: ArrayType(SheetSubRowType),
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* The band a group row draws above its lines (#740) — what the band shows
|
|
156
|
+
* beside its cells.
|
|
157
|
+
*
|
|
158
|
+
* @property sub - The eyebrow under the title (display only; `""` for none)
|
|
159
|
+
* @property folded - Whether the plan opens folded
|
|
160
|
+
*/
|
|
161
|
+
export const SheetBandType = StructType({
|
|
162
|
+
sub: StringType,
|
|
163
|
+
folded: BooleanType,
|
|
164
|
+
});
|
|
165
|
+
/** The cell key a group row's title rides under (#740) — never a line column's key. */
|
|
166
|
+
export const SHEET_TITLE_CELL = "$title";
|
|
167
|
+
/**
|
|
168
|
+
* The key of an UNRENDERED cell a column's rule projects into (#844) — a
|
|
169
|
+
* date column's `level` / `actual`, a column's `detail`. The `$` prefix keeps
|
|
170
|
+
* it clear of every field name, as {@link SHEET_TITLE_CELL} is.
|
|
171
|
+
*
|
|
172
|
+
* @param rule - The rule (`"level"`, `"actual"`, `"detail"`)
|
|
173
|
+
* @param column - The column key
|
|
174
|
+
* @returns The cell key (`"$level:start"`)
|
|
175
|
+
*/
|
|
176
|
+
export function sheetRuleCell(rule, column) {
|
|
177
|
+
return `$${rule}:${column}`;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* One wire row — the closed projection of a host row.
|
|
181
|
+
*
|
|
182
|
+
* @remarks
|
|
183
|
+
* `cells` carries one entry per DECLARED column, always present (a blank
|
|
184
|
+
* cell is `Null`); a field of the host's row with no column never crosses
|
|
185
|
+
* the wire — the bridge (§4.8) reads it off the real row instead. Blank
|
|
186
|
+
* padding rows are renderer state, never rows.
|
|
187
|
+
*
|
|
188
|
+
* On a GROUPED sheet (#740) a group row's `cells` hold the band's cells (the
|
|
189
|
+
* group's fields under line columns, the title under
|
|
190
|
+
* {@link SHEET_TITLE_CELL}), `lines` its lines and `band` is `some`. On a
|
|
191
|
+
* flat sheet `lines` is empty and `band` is `none` — and so on a grouped
|
|
192
|
+
* sheet with LOOSE rows between its groups (#846): a loose row is a row of
|
|
193
|
+
* the line type, its `cells` the line columns' projection, with no lines
|
|
194
|
+
* and no band.
|
|
195
|
+
*
|
|
196
|
+
* @property id - The row identity (the `id` field, or a keyed source's key)
|
|
197
|
+
* @property owned - `true` ⇒ the row belongs to the upstream system: no copilot, stamped columns read-only
|
|
198
|
+
* @property cells - Column key → cell, one entry per declared column
|
|
199
|
+
* @property lines - A group row's lines, in order (empty on a flat sheet, and for a loose row)
|
|
200
|
+
* @property band - A group row's band (`none` on a flat sheet, and for a loose row)
|
|
201
|
+
* @property subRows - A flat or loose row's sub rows (#844; empty for a group row, whose lines carry them)
|
|
202
|
+
*/
|
|
203
|
+
export const SheetRowType = StructType({
|
|
204
|
+
id: StringType,
|
|
205
|
+
owned: BooleanType,
|
|
206
|
+
cells: DictType(StringType, SheetCellType),
|
|
207
|
+
lines: ArrayType(SheetLineType),
|
|
208
|
+
band: OptionType(SheetBandType),
|
|
209
|
+
subRows: ArrayType(SheetSubRowType),
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* The sheet's own row COLLECTION — wire rows in sheet order.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* The Sheet is POSITIONAL like the Table: the planner's order is the source's
|
|
216
|
+
* order, so the collection is an `Array` (a `Dict` inline is refused at
|
|
217
|
+
* build time — a sorted map would sit rows in key order).
|
|
218
|
+
*/
|
|
219
|
+
export const SheetRowsCollectionType = ArrayType(SheetRowType);
|
|
220
|
+
/**
|
|
221
|
+
* How a sheet's rows arrive — inline, or a window at a time — the shared
|
|
222
|
+
* row-source contract (#567 / #576) at the sheet's row collection.
|
|
223
|
+
*/
|
|
224
|
+
export const SheetRowsType = RowSourceType(SheetRowsCollectionType);
|
|
225
|
+
// ============================================================================
|
|
226
|
+
// Registers and the driver
|
|
227
|
+
// ============================================================================
|
|
228
|
+
/**
|
|
229
|
+
* One register member — the grammar's vocabulary, and nothing else.
|
|
230
|
+
*
|
|
231
|
+
* @remarks
|
|
232
|
+
* There is no attribute bag: what a declaration needs from a driver row
|
|
233
|
+
* (`uom`, `sides`) is read by an accessor at build time and stored per driver
|
|
234
|
+
* key on the column that needs it ({@link SheetColumnKindType}); what a
|
|
235
|
+
* provider needs (`ctx.driver`) is the typed row, looked up by the bridge.
|
|
236
|
+
*
|
|
237
|
+
* @property key - What the grammar resolves (`"R2140"`, `"Bay 2"`, `"CNC router"`)
|
|
238
|
+
* @property label - What a chip prints
|
|
239
|
+
* @property kind - The member kind (`"machine"` · `"bay"` · `"family"` · `"activity"` · …)
|
|
240
|
+
* @property aliases - Alternative spellings the grammar also resolves (`"the 2 bay"`)
|
|
241
|
+
* @property meta - Chip meta, shown when a half holds one chip (`"CNC router"`, `"bay · 96"`)
|
|
242
|
+
* @property parent - A member's parent key — countable → identified resolution and "enumerate"
|
|
243
|
+
* @property tone - An `enum` member's valence dot
|
|
244
|
+
*/
|
|
245
|
+
export const SheetRegisterMemberType = StructType({
|
|
246
|
+
key: StringType,
|
|
247
|
+
label: StringType,
|
|
248
|
+
kind: StringType,
|
|
249
|
+
aliases: ArrayType(StringType),
|
|
250
|
+
meta: OptionType(StringType),
|
|
251
|
+
parent: OptionType(StringType),
|
|
252
|
+
tone: OptionType(StatusValueType),
|
|
253
|
+
});
|
|
254
|
+
/**
|
|
255
|
+
* One register — a list of members a column resolves against.
|
|
256
|
+
*
|
|
257
|
+
* @property members - The members, in declaration order
|
|
258
|
+
*/
|
|
259
|
+
export const SheetRegisterType = StructType({
|
|
260
|
+
members: ArrayType(SheetRegisterMemberType),
|
|
261
|
+
});
|
|
262
|
+
/**
|
|
263
|
+
* The driver — the `lookup` column whose member decides what the row does
|
|
264
|
+
* (B§1), with its members.
|
|
265
|
+
*
|
|
266
|
+
* @property column - The driver column's key
|
|
267
|
+
* @property members - The driver's register members
|
|
268
|
+
*/
|
|
269
|
+
export const SheetDriverType = StructType({
|
|
270
|
+
column: StringType,
|
|
271
|
+
members: ArrayType(SheetRegisterMemberType),
|
|
272
|
+
});
|
|
273
|
+
// ============================================================================
|
|
274
|
+
// Link-column vocabulary — halves, sides, locks, counted members
|
|
275
|
+
// ============================================================================
|
|
276
|
+
/**
|
|
277
|
+
* One half of a link.
|
|
278
|
+
*
|
|
279
|
+
* @property from - The source half
|
|
280
|
+
* @property to - The destination half
|
|
281
|
+
*/
|
|
282
|
+
export const SheetHalfType = VariantType({ from: NullType, to: NullType });
|
|
283
|
+
/**
|
|
284
|
+
* Which halves of a link column a driver member makes live (B§4.2) —
|
|
285
|
+
* `Sheet.Types.Sides`, the type a driver row's `sides` field carries.
|
|
286
|
+
*
|
|
287
|
+
* @property both - Both halves live
|
|
288
|
+
* @property from - Only the source half
|
|
289
|
+
* @property to - Only the destination half
|
|
290
|
+
* @property in - In place: the minus glyph, neither half moves anything
|
|
291
|
+
*/
|
|
292
|
+
export const SheetSidesValueType = VariantType({ both: NullType, from: NullType, to: NullType, in: NullType });
|
|
293
|
+
/**
|
|
294
|
+
* How a `String`-backed link column writes its commit back (B§4.2).
|
|
295
|
+
*
|
|
296
|
+
* @property asTyped - The planner's text, verbatim
|
|
297
|
+
* @property canonical - Rewritten to register labels (evaluated by the renderer)
|
|
298
|
+
*/
|
|
299
|
+
export const SheetStoreType = VariantType({ asTyped: NullType, canonical: NullType });
|
|
300
|
+
/**
|
|
301
|
+
* One member kind a link column accepts, and how (B§4.1).
|
|
302
|
+
*
|
|
303
|
+
* @property kind - The register member kind (`"machine"`, `"bay"`, `"family"`, `"range"`)
|
|
304
|
+
* @property identified - The kind resolves by code (bare digits try the code prefix)
|
|
305
|
+
* @property countable - The kind takes the counted form (`N x kind`)
|
|
306
|
+
* @property resolvesTo - What a counted member of this kind resolves to later (`"machine"`)
|
|
307
|
+
* @property ranged - Runs of consecutive identified codes are offered and printed as one range (`R2140-45`, #844)
|
|
308
|
+
*/
|
|
309
|
+
export const SheetMemberKindType = StructType({
|
|
310
|
+
kind: StringType,
|
|
311
|
+
identified: BooleanType,
|
|
312
|
+
countable: BooleanType,
|
|
313
|
+
resolvesTo: OptionType(StringType),
|
|
314
|
+
ranged: BooleanType,
|
|
315
|
+
});
|
|
316
|
+
/**
|
|
317
|
+
* The counted-member grammar a link column declares (B§4.1).
|
|
318
|
+
*
|
|
319
|
+
* @property forms - The accepted forms (`"N x kind"`, `"kind x N"`)
|
|
320
|
+
* @property ops - The multiplication tokens (`"x"`, `"X"`, `"*"`, `"×"`)
|
|
321
|
+
* @property appliesTo - Which member kinds may be counted (`"countable"`)
|
|
322
|
+
*/
|
|
323
|
+
export const SheetMultipleType = StructType({
|
|
324
|
+
forms: ArrayType(StringType),
|
|
325
|
+
ops: ArrayType(StringType),
|
|
326
|
+
appliesTo: StringType,
|
|
327
|
+
});
|
|
328
|
+
/**
|
|
329
|
+
* One lock rule — the tag a half shows when the driver's sides value makes
|
|
330
|
+
* it read-only (B§4.2).
|
|
331
|
+
*
|
|
332
|
+
* @property half - The locked half
|
|
333
|
+
* @property when - The driver's sides value that locks it
|
|
334
|
+
* @property label - The lock tag text (`"external"`, `"in place"`)
|
|
335
|
+
*/
|
|
336
|
+
export const SheetSideLockType = StructType({
|
|
337
|
+
half: SheetHalfType,
|
|
338
|
+
when: SheetSidesValueType,
|
|
339
|
+
label: StringType,
|
|
340
|
+
});
|
|
341
|
+
/**
|
|
342
|
+
* A link column's sides declaration — the driver's `sides` accessor APPLIED
|
|
343
|
+
* over the driver data, plus the lock rules.
|
|
344
|
+
*
|
|
345
|
+
* @remarks
|
|
346
|
+
* The accessor itself never reaches the wire: the builder reifies it against
|
|
347
|
+
* the driver's row type and the root evaluates it once per driver member, so
|
|
348
|
+
* the renderer looks a row's sides up by its driver key.
|
|
349
|
+
*
|
|
350
|
+
* @property byDriver - Driver member key → the sides value
|
|
351
|
+
* @property locks - The lock rules
|
|
352
|
+
*/
|
|
353
|
+
export const SheetSidesType = StructType({
|
|
354
|
+
byDriver: DictType(StringType, SheetSidesValueType),
|
|
355
|
+
locks: ArrayType(SheetSideLockType),
|
|
356
|
+
});
|
|
357
|
+
/**
|
|
358
|
+
* A count of a countable member — the `n × CNC router` form (B§4.5) —
|
|
359
|
+
* `Sheet.Types.Counted`, what an arity rule proposes.
|
|
360
|
+
*
|
|
361
|
+
* @property n - The count
|
|
362
|
+
* @property key - The countable member's key
|
|
363
|
+
*/
|
|
364
|
+
export const SheetCountedType = StructType({ n: IntegerType, key: StringType });
|
|
365
|
+
// ============================================================================
|
|
366
|
+
// The copilot — the WIRE context, fills, proposals, providers
|
|
367
|
+
// ============================================================================
|
|
368
|
+
/**
|
|
369
|
+
* The WIRE copilot context — what the renderer hands a bridged provider.
|
|
370
|
+
*
|
|
371
|
+
* @remarks
|
|
372
|
+
* The bridge (§4.8) rebuilds the author's typed context from it: `row` is
|
|
373
|
+
* decoded over the REAL source row (`rowById(rowId, offset)`), every entry of
|
|
374
|
+
* `rows` over its own (`rowsOffset + index`), and `driver` through the
|
|
375
|
+
* driver lookup — so a field of the host's row that has no column keeps its
|
|
376
|
+
* value in every provider, check, edit event and patch.
|
|
377
|
+
*
|
|
378
|
+
* @property drafts - Row id → its current draft, encoded
|
|
379
|
+
* @property rowIndex - The row's index in `rows` (a grouped sheet: a line's index within its group)
|
|
380
|
+
* @property rowId - The row's id — the source lookup's argument (a grouped sheet: a line's GROUP's id, a loose row's own)
|
|
381
|
+
* @property offset - The row's source offset — the paged arm's `page` lookup
|
|
382
|
+
* @property line - A grouped sheet: the line's address within its group; `none` on a flat sheet, and for a loose row (#846)
|
|
383
|
+
* @property row - The row as it would be if the open editor committed (a grouped sheet: the LINE's cells)
|
|
384
|
+
* @property rows - The resident sheet, real rows in sheet order (a grouped sheet: the resident GROUP rows and loose rows)
|
|
385
|
+
* @property rowsOffset - The source offset of `rows[0]` (`0` on the inline arm)
|
|
386
|
+
* @property partial - `true` on a paged sheet whose source is not exhausted
|
|
387
|
+
* @property driver - The resolved driver member's key
|
|
388
|
+
* @property today - UTC midnight — so providers stay pure
|
|
389
|
+
*/
|
|
390
|
+
export const SheetContextType = StructType({
|
|
391
|
+
drafts: DictType(StringType, BlobType),
|
|
392
|
+
rowIndex: IntegerType,
|
|
393
|
+
rowId: StringType,
|
|
394
|
+
offset: IntegerType,
|
|
395
|
+
line: OptionType(StringType),
|
|
396
|
+
row: DictType(StringType, SheetCellType),
|
|
397
|
+
rows: ArrayType(SheetRowType),
|
|
398
|
+
rowsOffset: IntegerType,
|
|
399
|
+
partial: BooleanType,
|
|
400
|
+
driver: OptionType(StringType),
|
|
401
|
+
today: DateTimeType,
|
|
402
|
+
});
|
|
403
|
+
/**
|
|
404
|
+
* One row check of a readiness batch ({@link SheetReadyBatchType}, #882) —
|
|
405
|
+
* where its row sits among the batch's rows, and its driver.
|
|
406
|
+
* @internal
|
|
407
|
+
*
|
|
408
|
+
* @property index - The checked row's index in the batch's `rows` (a grouped sheet: a line's GROUP's)
|
|
409
|
+
* @property line - A grouped sheet: the checked line's index within its group; `none` on a flat sheet, and for a loose row (#846)
|
|
410
|
+
* @property driver - The resolved driver member's key
|
|
411
|
+
*/
|
|
412
|
+
export const SheetReadyCheckType = StructType({
|
|
413
|
+
index: IntegerType,
|
|
414
|
+
line: OptionType(IntegerType),
|
|
415
|
+
driver: OptionType(StringType),
|
|
416
|
+
});
|
|
417
|
+
/**
|
|
418
|
+
* The WIRE readiness batch (#882) — every row check of one readiness
|
|
419
|
+
* evaluation, over the rows they share.
|
|
420
|
+
* @internal
|
|
421
|
+
*
|
|
422
|
+
* @remarks
|
|
423
|
+
* The shared fields cross the wire once, and the bridge builds the typed
|
|
424
|
+
* rows from them once. A check carries only its place and its driver: its
|
|
425
|
+
* row is the draft the bridge built at that place — the row's own cells over
|
|
426
|
+
* its own draft — so nothing is substituted into the rows, as a
|
|
427
|
+
* {@link SheetContextType}'s provisional row is.
|
|
428
|
+
*
|
|
429
|
+
* @property drafts - Row id → its current draft, encoded
|
|
430
|
+
* @property rows - The rows, in sheet order (a grouped sheet: the GROUP rows)
|
|
431
|
+
* @property rowsOffset - The source offset of `rows[0]`
|
|
432
|
+
* @property partial - `true` on a paged sheet whose source is not exhausted
|
|
433
|
+
* @property today - UTC midnight — so checks stay pure
|
|
434
|
+
* @property checks - The checks; their results return in this order
|
|
435
|
+
*/
|
|
436
|
+
export const SheetReadyBatchType = StructType({
|
|
437
|
+
drafts: DictType(StringType, BlobType),
|
|
438
|
+
rows: ArrayType(SheetRowType),
|
|
439
|
+
rowsOffset: IntegerType,
|
|
440
|
+
partial: BooleanType,
|
|
441
|
+
today: DateTimeType,
|
|
442
|
+
checks: ArrayType(SheetReadyCheckType),
|
|
443
|
+
});
|
|
444
|
+
/**
|
|
445
|
+
* The WIRE fill — one proposed cell value with its provenance (B§5.1).
|
|
446
|
+
*
|
|
447
|
+
* @property value - The proposed cell
|
|
448
|
+
* @property meta - The provenance line the strip prints
|
|
449
|
+
*/
|
|
450
|
+
export const SheetFillType = StructType({ value: SheetCellType, meta: StringType });
|
|
451
|
+
/**
|
|
452
|
+
* The WIRE proposal — one proposed row as the cells a patch set, with its
|
|
453
|
+
* provenance (B§5.2).
|
|
454
|
+
*
|
|
455
|
+
* @property cells - The set fields, encoded; a field the patch left `none` is absent
|
|
456
|
+
* @property meta - The provenance line
|
|
457
|
+
*/
|
|
458
|
+
export const SheetProposalType = StructType({ cells: DictType(StringType, SheetCellType), meta: StringType });
|
|
459
|
+
/**
|
|
460
|
+
* One fill provider on the wire — synchronous, or asynchronous (a model
|
|
461
|
+
* call). The factory picks the arm from the author's function value's East
|
|
462
|
+
* type and bridges it (§4.8).
|
|
463
|
+
*
|
|
464
|
+
* @property sync - Runs inline within the kind's latency
|
|
465
|
+
* @property async - The strip shows a pending chip; the result lands reactively, latest wins
|
|
466
|
+
*/
|
|
467
|
+
export const SheetProviderType = VariantType({
|
|
468
|
+
sync: FunctionType([SheetContextType], OptionType(SheetFillType)),
|
|
469
|
+
async: AsyncFunctionType([SheetContextType], OptionType(SheetFillType)),
|
|
470
|
+
});
|
|
471
|
+
/**
|
|
472
|
+
* One row proposer on the wire — synchronous, or asynchronous.
|
|
473
|
+
*
|
|
474
|
+
* @property sync - Runs inline
|
|
475
|
+
* @property async - Pending chip; latest wins
|
|
476
|
+
*/
|
|
477
|
+
export const SheetProposerType = VariantType({
|
|
478
|
+
sync: FunctionType([SheetContextType], ArrayType(SheetProposalType)),
|
|
479
|
+
async: AsyncFunctionType([SheetContextType], ArrayType(SheetProposalType)),
|
|
480
|
+
});
|
|
481
|
+
/**
|
|
482
|
+
* The copilot's row-proposal declaration (B§5.2).
|
|
483
|
+
*
|
|
484
|
+
* @property ahead - At most this many proposed rows below the anchor
|
|
485
|
+
* @property triggers - Column keys whose commit re-asks the proposers
|
|
486
|
+
* @property ghost - Draw proposed rows as hatched ghosts (the default)
|
|
487
|
+
* @property propose - The proposers, first that returns rows wins
|
|
488
|
+
*/
|
|
489
|
+
export const SheetSuggestType = StructType({
|
|
490
|
+
ahead: IntegerType,
|
|
491
|
+
triggers: ArrayType(StringType),
|
|
492
|
+
ghost: BooleanType,
|
|
493
|
+
propose: ArrayType(SheetProposerType),
|
|
494
|
+
});
|
|
495
|
+
// ============================================================================
|
|
496
|
+
// Checks and arity — the WIRE check context
|
|
497
|
+
// ============================================================================
|
|
498
|
+
/**
|
|
499
|
+
* The WIRE check context — what a bridged member check receives (B§2).
|
|
500
|
+
*
|
|
501
|
+
* @property drafts - Row id → its current draft, encoded
|
|
502
|
+
* @property group - A grouped sheet: the line's GROUP row; `none` on a flat sheet, and for a loose row (#846)
|
|
503
|
+
* @property rowIndex - Sheet position among real rows (a grouped sheet: a line's index within its group, a loose row's among the loose rows)
|
|
504
|
+
* @property rowId - The row's id (the source lookup's argument; a grouped sheet: a line's GROUP's id, a loose row's own)
|
|
505
|
+
* @property offset - The row's source offset
|
|
506
|
+
* @property line - A grouped sheet: the line's address within its group; `none` on a flat sheet, and for a loose row (#846)
|
|
507
|
+
* @property row - The row as it would be if the editor committed (a grouped sheet: the LINE's cells)
|
|
508
|
+
* @property half - The half being edited
|
|
509
|
+
* @property member - The resolved member under check
|
|
510
|
+
*/
|
|
511
|
+
export const SheetCheckContextType = StructType({
|
|
512
|
+
drafts: DictType(StringType, BlobType),
|
|
513
|
+
group: OptionType(SheetRowType),
|
|
514
|
+
rowIndex: IntegerType,
|
|
515
|
+
rowId: StringType,
|
|
516
|
+
offset: IntegerType,
|
|
517
|
+
line: OptionType(StringType),
|
|
518
|
+
row: DictType(StringType, SheetCellType),
|
|
519
|
+
half: SheetHalfType,
|
|
520
|
+
member: SheetMemberType,
|
|
521
|
+
});
|
|
522
|
+
/**
|
|
523
|
+
* One member check on a link column.
|
|
524
|
+
*
|
|
525
|
+
* @property exists - The grammar's own: the member must resolve in the register
|
|
526
|
+
* @property custom - An author rule — `some(message)` flags the member, `none` passes
|
|
527
|
+
*/
|
|
528
|
+
export const SheetCheckType = VariantType({
|
|
529
|
+
exists: NullType,
|
|
530
|
+
custom: FunctionType([SheetCheckContextType], OptionType(StringType)),
|
|
531
|
+
});
|
|
532
|
+
/**
|
|
533
|
+
* A link column's arity rule — how many members a half should hold, and
|
|
534
|
+
* which countable member to propose when none are named (B§4.6).
|
|
535
|
+
*
|
|
536
|
+
* @property half - The half the rule counts
|
|
537
|
+
* @property implied - The bridged rule over the wire context
|
|
538
|
+
*/
|
|
539
|
+
export const SheetArityType = StructType({
|
|
540
|
+
half: SheetHalfType,
|
|
541
|
+
implied: FunctionType([SheetContextType], OptionType(SheetCountedType)),
|
|
542
|
+
});
|
|
543
|
+
// ============================================================================
|
|
544
|
+
// Column kinds
|
|
545
|
+
// ============================================================================
|
|
546
|
+
/**
|
|
547
|
+
* How deep a date column reads and takes a row's date (#844) —
|
|
548
|
+
* `Sheet.Types.DateLevel`, what a date column's `level` rule returns.
|
|
549
|
+
*
|
|
550
|
+
* @remarks
|
|
551
|
+
* The cell is still one UTC instant; the level says how it is printed,
|
|
552
|
+
* typed and compared with an `actual`.
|
|
553
|
+
*
|
|
554
|
+
* @property week - The week the date falls in (printed as its Monday)
|
|
555
|
+
* @property day - The day
|
|
556
|
+
* @property range - One end of the days the work may run in
|
|
557
|
+
* @property time - The day and the time of day
|
|
558
|
+
*/
|
|
559
|
+
export const SheetDateLevelType = VariantType({ week: NullType, day: NullType, range: NullType, time: NullType });
|
|
560
|
+
/**
|
|
561
|
+
* A column's OPTIONS rule on the wire (#844) — the register member keys a
|
|
562
|
+
* row may be offered; `none` offers the whole register.
|
|
563
|
+
*/
|
|
564
|
+
export const SheetOptionsRuleType = FunctionType([SheetContextType], OptionType(ArrayType(StringType)));
|
|
565
|
+
/**
|
|
566
|
+
* The column kind — what a column parses, displays and proposes (§3.2).
|
|
567
|
+
*
|
|
568
|
+
* @remarks
|
|
569
|
+
* Every function stored here takes the CLOSED context / cell types; the
|
|
570
|
+
* author's typed functions are bridged into them by the factory. The
|
|
571
|
+
* accessors that read the driver's row (`uom`, `sides.value`) are not stored
|
|
572
|
+
* at all — the builder reifies them against the driver's row type, the root
|
|
573
|
+
* applies them over the driver data, and they land as dictionaries keyed by
|
|
574
|
+
* the driver member's key.
|
|
575
|
+
*
|
|
576
|
+
* A date's `level` and `actual` and an `options` rule (#844) ride here too:
|
|
577
|
+
* `level` / `actual` name the unrendered cell ({@link sheetRuleCell}) the
|
|
578
|
+
* row projection filled, `options` is the bridged rule over the wire
|
|
579
|
+
* context — the renderer offers only those members, while typed text still
|
|
580
|
+
* resolves against the whole register.
|
|
581
|
+
*
|
|
582
|
+
* @property text - Free text
|
|
583
|
+
* @property date - A UTC-midnight date; `base` names the column relative entry counts from, `format` a display pattern, `level` the cell holding the row's {@link SheetDateLevelType} tag, `actual` the cell holding when the work really happened
|
|
584
|
+
* @property quantity - A float with a unit per driver member (`uom`) and a display format
|
|
585
|
+
* @property integer - A whole number
|
|
586
|
+
* @property lookup - A scored register lookup — the driver column names the driver's register; `options` narrows what a row is offered
|
|
587
|
+
* @property reference - A lookup over a flat member list
|
|
588
|
+
* @property enum - An upper-cased register word with a valence dot; `options` narrows what a row is offered
|
|
589
|
+
* @property set - Comma members, the link grammar without an arrow
|
|
590
|
+
* @property link - `from > to` — the split cell (§3.4); `options` narrows what a row is offered
|
|
591
|
+
* @property stamped - A read-only code an upstream system owns
|
|
592
|
+
* @property custom - An author parse / print pair over the field's own payload
|
|
593
|
+
*/
|
|
594
|
+
export const SheetColumnKindType = VariantType({
|
|
595
|
+
text: NullType,
|
|
596
|
+
date: StructType({
|
|
597
|
+
base: OptionType(StringType),
|
|
598
|
+
format: OptionType(StringType),
|
|
599
|
+
level: OptionType(StringType),
|
|
600
|
+
actual: OptionType(StringType),
|
|
601
|
+
}),
|
|
602
|
+
quantity: StructType({ uom: OptionType(DictType(StringType, StringType)), format: OptionType(TickFormatType) }),
|
|
603
|
+
integer: NullType,
|
|
604
|
+
lookup: StructType({ register: StringType, options: OptionType(SheetOptionsRuleType) }),
|
|
605
|
+
reference: StructType({ register: StringType }),
|
|
606
|
+
enum: StructType({ register: StringType, options: OptionType(SheetOptionsRuleType) }),
|
|
607
|
+
set: StructType({
|
|
608
|
+
register: StringType,
|
|
609
|
+
members: ArrayType(SheetMemberKindType),
|
|
610
|
+
multiple: OptionType(SheetMultipleType),
|
|
611
|
+
store: SheetStoreType,
|
|
612
|
+
}),
|
|
613
|
+
link: StructType({
|
|
614
|
+
register: StringType,
|
|
615
|
+
members: ArrayType(SheetMemberKindType),
|
|
616
|
+
multiple: OptionType(SheetMultipleType),
|
|
617
|
+
sides: OptionType(SheetSidesType),
|
|
618
|
+
arity: OptionType(SheetArityType),
|
|
619
|
+
check: ArrayType(SheetCheckType),
|
|
620
|
+
store: SheetStoreType,
|
|
621
|
+
options: OptionType(SheetOptionsRuleType),
|
|
622
|
+
}),
|
|
623
|
+
stamped: StructType({ owner: OptionType(StringType) }),
|
|
624
|
+
custom: StructType({
|
|
625
|
+
accepts: StringType,
|
|
626
|
+
parse: FunctionType([StringType, SheetContextType], OptionType(SheetCellType)),
|
|
627
|
+
print: FunctionType([SheetCellType], StringType),
|
|
628
|
+
}),
|
|
629
|
+
});
|
|
630
|
+
/**
|
|
631
|
+
* One declared column.
|
|
632
|
+
*
|
|
633
|
+
* @remarks
|
|
634
|
+
* `dataType` is the row field's static type and `payloadType` the kind's
|
|
635
|
+
* payload (a custom kind's primitive), both as type values, so the renderer
|
|
636
|
+
* parses and prints without the host types (the Table `dataType` / `valueType`
|
|
637
|
+
* precedent). `editable` is `false` for a stamped column, a `value`-projected
|
|
638
|
+
* column, or by option.
|
|
639
|
+
*
|
|
640
|
+
* @property key - The column key — the row field it sits on
|
|
641
|
+
* @property header - The header line
|
|
642
|
+
* @property sub - The grey second header line
|
|
643
|
+
* @property width - CSS width
|
|
644
|
+
* @property kind - The column kind
|
|
645
|
+
* @property dataType - The row field's static type
|
|
646
|
+
* @property payloadType - The kind's payload type
|
|
647
|
+
* @property editable - Whether the sheet writes the column
|
|
648
|
+
* @property fill - The fill providers; the first that yields wins
|
|
649
|
+
* @property detailCell - The unrendered cell whose text is the column's detail — the hover and the strip (#844)
|
|
650
|
+
*/
|
|
651
|
+
export const SheetColumnType = StructType({
|
|
652
|
+
key: StringType,
|
|
653
|
+
header: StringType,
|
|
654
|
+
sub: OptionType(StringType),
|
|
655
|
+
width: OptionType(StringType),
|
|
656
|
+
kind: SheetColumnKindType,
|
|
657
|
+
dataType: EastTypeType,
|
|
658
|
+
payloadType: EastTypeType,
|
|
659
|
+
editable: BooleanType,
|
|
660
|
+
fill: ArrayType(SheetProviderType),
|
|
661
|
+
detailCell: OptionType(StringType),
|
|
662
|
+
});
|
|
663
|
+
// ============================================================================
|
|
664
|
+
// Grouped rows (#740) — the band's cells and the group declaration
|
|
665
|
+
// ============================================================================
|
|
666
|
+
/**
|
|
667
|
+
* One cell of a group row's band (#740) — a group field drawn under a line
|
|
668
|
+
* column (or the title), exactly a column declared over the group's row.
|
|
669
|
+
*
|
|
670
|
+
* @property key - The cell key: a line column's key, or {@link SHEET_TITLE_CELL}
|
|
671
|
+
* @property field - The group row's field the cell reads and writes
|
|
672
|
+
* @property kind - The cell's kind (the §3.2 table; no `lookup`, `set`, `link` or `custom` in a band)
|
|
673
|
+
* @property dataType - The group field's static type
|
|
674
|
+
* @property payloadType - The kind's payload type
|
|
675
|
+
* @property editable - Whether the band writes the field
|
|
676
|
+
*/
|
|
677
|
+
export const SheetGroupCellType = StructType({
|
|
678
|
+
key: StringType,
|
|
679
|
+
field: StringType,
|
|
680
|
+
kind: SheetColumnKindType,
|
|
681
|
+
dataType: EastTypeType,
|
|
682
|
+
payloadType: EastTypeType,
|
|
683
|
+
editable: BooleanType,
|
|
684
|
+
});
|
|
685
|
+
/**
|
|
686
|
+
* The host's word for a group (#844) — what fold-all, the footer count, hints
|
|
687
|
+
* and the new-group button call a group. When the declaration names none the
|
|
688
|
+
* wire carries none, and the renderer says its own word — its message
|
|
689
|
+
* table's, so a translation reaches it (#861).
|
|
690
|
+
*
|
|
691
|
+
* @property singular - One group (`"order"`)
|
|
692
|
+
* @property plural - Several (`"orders"`)
|
|
693
|
+
*/
|
|
694
|
+
export const SheetNounType = StructType({
|
|
695
|
+
singular: StringType,
|
|
696
|
+
plural: StringType,
|
|
697
|
+
});
|
|
698
|
+
/**
|
|
699
|
+
* The group declaration (#740) — how a grouped sheet's rows carry their
|
|
700
|
+
* lines, and what the band draws.
|
|
701
|
+
*
|
|
702
|
+
* @property lines - The group row's field that holds the lines — an `Array<L>`, so a line's key is its position
|
|
703
|
+
* @property cells - The band's cells, the title first under {@link SHEET_TITLE_CELL}
|
|
704
|
+
* @property noun - The host's word for a group (#844); `none` ⇒ the renderer's own (#861)
|
|
705
|
+
* @property loose - `true` ⇒ the source's entries are `Sheet.Types.Entry(P, "lines")`: a group, or a LOOSE row of the line type between the groups (#846) — a wire row with no band
|
|
706
|
+
*/
|
|
707
|
+
export const SheetGroupType = StructType({
|
|
708
|
+
lines: StringType,
|
|
709
|
+
cells: ArrayType(SheetGroupCellType),
|
|
710
|
+
noun: OptionType(SheetNounType),
|
|
711
|
+
loose: BooleanType,
|
|
712
|
+
});
|
|
713
|
+
// ============================================================================
|
|
714
|
+
// Views, edits, selection, footer, style
|
|
715
|
+
// ============================================================================
|
|
716
|
+
/**
|
|
717
|
+
* One saved view — a slice-state snapshot plus the lens's context and reveals
|
|
718
|
+
* (B§8), evaluated live.
|
|
719
|
+
*
|
|
720
|
+
* @property id - Stable identity
|
|
721
|
+
* @property name - The tab name
|
|
722
|
+
* @property narrowing - The slice state the view was made with
|
|
723
|
+
* @property context - The lens's band width (`0` · `1` · `3`)
|
|
724
|
+
* @property reveals - Revealed row indices
|
|
725
|
+
* @property folds - A grouped sheet's fold overrides (#740): group id → folded; a group not listed opens as its `folded` accessor says
|
|
726
|
+
*/
|
|
727
|
+
export const SheetViewType = StructType({
|
|
728
|
+
id: StringType,
|
|
729
|
+
name: StringType,
|
|
730
|
+
narrowing: SliceStateType,
|
|
731
|
+
context: IntegerType,
|
|
732
|
+
reveals: ArrayType(IntegerType),
|
|
733
|
+
folds: DictType(StringType, BooleanType),
|
|
734
|
+
});
|
|
735
|
+
/**
|
|
736
|
+
* A saved indexed-record view. Keeps record narrowing separate from the
|
|
737
|
+
* existing local Slice wire; folds still belong to original record keys.
|
|
738
|
+
*/
|
|
739
|
+
export const SheetRecordViewType = StructType({
|
|
740
|
+
...SheetViewType.fields,
|
|
741
|
+
narrowing: RecordSliceStateType,
|
|
742
|
+
});
|
|
743
|
+
/**
|
|
744
|
+
* Where an edit came from — provenance a host can measure copilot uptake by (B§1).
|
|
745
|
+
*
|
|
746
|
+
* @property typed - The planner typed it
|
|
747
|
+
* @property pasted - A paste
|
|
748
|
+
* @property fill - A copilot fill was taken
|
|
749
|
+
* @property row - A row fill (⌘⏎)
|
|
750
|
+
* @property pattern - A proposed row was taken
|
|
751
|
+
*/
|
|
752
|
+
export const SheetSourceType = VariantType({
|
|
753
|
+
typed: NullType,
|
|
754
|
+
pasted: NullType,
|
|
755
|
+
fill: NullType,
|
|
756
|
+
row: NullType,
|
|
757
|
+
pattern: NullType,
|
|
758
|
+
});
|
|
759
|
+
/**
|
|
760
|
+
* The WIRE edit event — a raw commit / insert / remove carrying the wire row
|
|
761
|
+
* inside a renderer gesture. These records never call an author callback;
|
|
762
|
+
* the editing session emits one complete PatchEvent after the gesture.
|
|
763
|
+
* @internal
|
|
764
|
+
*
|
|
765
|
+
* On a grouped sheet (#740) the three row arms are the GROUP's — a band
|
|
766
|
+
* cell committed, a group created, groups removed — and the line arms carry
|
|
767
|
+
* a line's address within its group; `row` is always the whole group row.
|
|
768
|
+
*
|
|
769
|
+
* @property commit - One cell committed: the row AFTER the commit, and its source offset
|
|
770
|
+
* @property insert - A row appended after `afterRowId` (`none` ⇒ at the end)
|
|
771
|
+
* @property remove - Rows removed by id
|
|
772
|
+
* @property lineCommit - A line's cell committed: the GROUP row after the commit, the line's key, the column
|
|
773
|
+
* @property lineInsert - A line inserted into a group after `after` (`none` ⇒ first), at `line`
|
|
774
|
+
* @property lineRemove - Lines removed from a group, by key
|
|
775
|
+
*/
|
|
776
|
+
export const SheetEditType = VariantType({
|
|
777
|
+
commit: StructType({ rowId: StringType, offset: IntegerType, key: StringType, row: SheetRowType, source: SheetSourceType }),
|
|
778
|
+
insert: StructType({ afterRowId: OptionType(StringType), row: SheetRowType, source: SheetSourceType }),
|
|
779
|
+
remove: StructType({ rowIds: ArrayType(StringType) }),
|
|
780
|
+
lineCommit: StructType({ rowId: StringType, offset: IntegerType, line: StringType, key: StringType, row: SheetRowType, source: SheetSourceType }),
|
|
781
|
+
lineInsert: StructType({ rowId: StringType, offset: IntegerType, after: OptionType(StringType), line: StringType, row: SheetRowType, source: SheetSourceType }),
|
|
782
|
+
lineRemove: StructType({ rowId: StringType, offset: IntegerType, lines: ArrayType(StringType), row: SheetRowType }),
|
|
783
|
+
});
|
|
784
|
+
/**
|
|
785
|
+
* The selection ring's position — `Sheet.Types.Selection`.
|
|
786
|
+
*
|
|
787
|
+
* @property rowId - The selected row (`none` ⇒ a blank padding row or nothing); a grouped sheet: the GROUP's id
|
|
788
|
+
* @property line - A grouped sheet: the selected line's key within its group (`none` on the band, a blank line, or a flat sheet)
|
|
789
|
+
* @property key - The selected column (a band: the line column the cell sits under, or `$title`)
|
|
790
|
+
*/
|
|
791
|
+
export const SheetSelectionType = StructType({
|
|
792
|
+
rowId: OptionType(StringType),
|
|
793
|
+
line: OptionType(StringType),
|
|
794
|
+
key: OptionType(StringType),
|
|
795
|
+
});
|
|
796
|
+
/**
|
|
797
|
+
* One footer item (B§9).
|
|
798
|
+
*
|
|
799
|
+
* @property text - The footer text
|
|
800
|
+
* @property tone - Optional status tint
|
|
801
|
+
*/
|
|
802
|
+
export const SheetFooterItemType = StructType({
|
|
803
|
+
text: StringType,
|
|
804
|
+
tone: OptionType(StatusValueType),
|
|
805
|
+
});
|
|
806
|
+
/**
|
|
807
|
+
* The Sheet style — the gutter width. The sheet fills the box it is given,
|
|
808
|
+
* its frame's, and scrolls its own rows there (#1216).
|
|
809
|
+
*
|
|
810
|
+
* @property gutterWidth - The row-number gutter width, a CSS px size
|
|
811
|
+
*/
|
|
812
|
+
export const SheetStyleType = StructType({
|
|
813
|
+
gutterWidth: OptionType(StringType),
|
|
814
|
+
});
|
|
815
|
+
// ============================================================================
|
|
816
|
+
// Root
|
|
817
|
+
// ============================================================================
|
|
818
|
+
/**
|
|
819
|
+
* The Sheet root IR — the whole planning spreadsheet, a CLOSED struct: the
|
|
820
|
+
* grid, its rows and its session, which `<Sheet>`'s payload carries as its
|
|
821
|
+
* `sheet`.
|
|
822
|
+
*
|
|
823
|
+
* @remarks
|
|
824
|
+
* `editing` carries the exact schemas and checked batch callbacks. The
|
|
825
|
+
* live onUpdate adapter writes once per application. `selection` present
|
|
826
|
+
* makes the selection controlled (§3.14).
|
|
827
|
+
*
|
|
828
|
+
* @property rows - The row source: inline wire rows, or a paged source of them
|
|
829
|
+
* @property columns - The declared columns, in order
|
|
830
|
+
* @property registers - Register name → register
|
|
831
|
+
* @property driver - The driver column and its members
|
|
832
|
+
* @property suggest - The row-proposal declaration
|
|
833
|
+
* @property slice - The slice chrome (search / filter / cohort); the lens reads the bound state
|
|
834
|
+
* @property views - The saved views
|
|
835
|
+
* @property activeView - The active view's id
|
|
836
|
+
* @property onViewsChange - Views changed (snapshot, rename, reorder, close)
|
|
837
|
+
* @property onSelect - The ring moved
|
|
838
|
+
* @property selection - Controlled selection when `some`
|
|
839
|
+
* @property newRowId - Overrides the renderer's id minting for inserted rows
|
|
840
|
+
* @property group - The group declaration (#740); `none` on a flat sheet
|
|
841
|
+
* @property readOnly - The whole sheet is read-only
|
|
842
|
+
* @property blanks - Padding rows below the last real one (default 18)
|
|
843
|
+
* @property density - Row rhythm
|
|
844
|
+
* @property footer - Footer items
|
|
845
|
+
* @property style - The gutter width
|
|
846
|
+
*/
|
|
847
|
+
export const SheetRootType = StructType({
|
|
848
|
+
rows: SheetRowsType,
|
|
849
|
+
editing: SheetEditingType,
|
|
850
|
+
columns: ArrayType(SheetColumnType),
|
|
851
|
+
registers: DictType(StringType, SheetRegisterType),
|
|
852
|
+
driver: OptionType(SheetDriverType),
|
|
853
|
+
suggest: OptionType(SheetSuggestType),
|
|
854
|
+
slice: OptionType(SliceChromeType),
|
|
855
|
+
views: ArrayType(SheetViewType),
|
|
856
|
+
activeView: OptionType(StringType),
|
|
857
|
+
onViewsChange: OptionType(FunctionType([ArrayType(SheetViewType)], NullType)),
|
|
858
|
+
onSelect: OptionType(FunctionType([SheetSelectionType], NullType)),
|
|
859
|
+
selection: OptionType(SheetSelectionType),
|
|
860
|
+
newRowId: OptionType(FunctionType([], StringType)),
|
|
861
|
+
group: OptionType(SheetGroupType),
|
|
862
|
+
readOnly: OptionType(BooleanType),
|
|
863
|
+
blanks: OptionType(IntegerType),
|
|
864
|
+
density: OptionType(DensityType),
|
|
865
|
+
footer: ArrayType(SheetFooterItemType),
|
|
866
|
+
style: OptionType(SheetStyleType),
|
|
867
|
+
/** Indexed record controls, separate from the local Slice wire. */
|
|
868
|
+
recordSlice: OptionType(RecordSliceChromeType),
|
|
869
|
+
/** Saved record narrowings, separate from local views. */
|
|
870
|
+
recordViews: ArrayType(SheetRecordViewType),
|
|
871
|
+
onRecordViewsChange: OptionType(FunctionType([ArrayType(SheetRecordViewType)], NullType)),
|
|
872
|
+
/** Source order is authoritative, including when drafts are overlaid. */
|
|
873
|
+
ordered: BooleanType,
|
|
874
|
+
});
|
|
875
|
+
// ============================================================================
|
|
876
|
+
// The TYPED constructors — the author's side (the `Plan.Types.Series(R)` pattern)
|
|
877
|
+
// ============================================================================
|
|
878
|
+
/**
|
|
879
|
+
* `Sheet.Types.Context(R, D)` — the copilot context as the author sees it:
|
|
880
|
+
* the host's row, the resident rows and the driver's row, all typed.
|
|
881
|
+
*
|
|
882
|
+
* @remarks
|
|
883
|
+
* A constructor rather than a generic wire type, so the row type lives
|
|
884
|
+
* structurally in a provider's signature: a provider written for one sheet
|
|
885
|
+
* is a compile error on another. Omit `D` on a sheet without a driver —
|
|
886
|
+
* `driver` is then `Option<Null>`, always `none`.
|
|
887
|
+
*
|
|
888
|
+
* @typeParam R - The host's row type
|
|
889
|
+
* @typeParam D - The driver's row type
|
|
890
|
+
* @param rowType - The row type value
|
|
891
|
+
* @param driverType - The driver's row type value (default `NullType`)
|
|
892
|
+
* @returns The concrete context `StructType`
|
|
893
|
+
*
|
|
894
|
+
* @property rowIndex - Sheet position among REAL (resident) rows
|
|
895
|
+
* @property row - The row as it would be if the open editor committed — the host's struct
|
|
896
|
+
* @property rows - The resident sheet, real rows in sheet order
|
|
897
|
+
* @property partial - `true` on a paged sheet whose source is not exhausted
|
|
898
|
+
* @property driver - The driver's row for `row` — typed, no attribute bag
|
|
899
|
+
* @property today - UTC midnight — so providers stay pure
|
|
900
|
+
*/
|
|
901
|
+
export function SheetContextTypeFor(rowType, driverType) {
|
|
902
|
+
return StructType({
|
|
903
|
+
rowIndex: IntegerType,
|
|
904
|
+
row: SheetDraftTypeFor(rowType),
|
|
905
|
+
rows: ArrayType(SheetDraftTypeFor(rowType)),
|
|
906
|
+
group: OptionType(NullType),
|
|
907
|
+
partial: BooleanType,
|
|
908
|
+
driver: OptionType((driverType ?? NullType)),
|
|
909
|
+
today: DateTimeType,
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* `Sheet.Types.Fill(T)` — one proposed value of a column's payload with its
|
|
914
|
+
* provenance, as a provider returns it.
|
|
915
|
+
*
|
|
916
|
+
* @typeParam T - The column kind's payload type (§3.2)
|
|
917
|
+
* @param payloadType - The payload type value
|
|
918
|
+
* @returns The concrete fill `StructType`
|
|
919
|
+
*
|
|
920
|
+
* @property value - The proposed value
|
|
921
|
+
* @property meta - The provenance line the strip prints
|
|
922
|
+
*/
|
|
923
|
+
export function SheetFillTypeFor(payloadType) {
|
|
924
|
+
return StructType({ value: payloadType, meta: StringType });
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* `Sheet.Types.Patch(R)` — a row patch: every field of `R` as an `Option`,
|
|
928
|
+
* `none` meaning "left blank".
|
|
929
|
+
*
|
|
930
|
+
* @remarks
|
|
931
|
+
* Built with `Sheet.patch(R, { … })`, which takes the literal-record form of
|
|
932
|
+
* `R`'s fields and fills the omitted ones with `none`. The runner encodes the
|
|
933
|
+
* set fields that have editable columns; a set field with no column, a
|
|
934
|
+
* stamped column or a `value`-projected column is ignored.
|
|
935
|
+
*
|
|
936
|
+
* @typeParam R - The host's row type
|
|
937
|
+
* @param rowType - The row type value
|
|
938
|
+
* @returns The concrete patch `StructType`
|
|
939
|
+
*/
|
|
940
|
+
export function SheetPatchTypeFor(rowType) {
|
|
941
|
+
const fields = {};
|
|
942
|
+
for (const [name, type] of Object.entries(rowType.fields)) {
|
|
943
|
+
fields[name] = OptionType(type);
|
|
944
|
+
}
|
|
945
|
+
return StructType(fields);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* `Sheet.Types.Proposal(R)` — one proposed row: a patch plus its provenance.
|
|
949
|
+
*
|
|
950
|
+
* @typeParam R - The host's row type
|
|
951
|
+
* @param rowType - The row type value
|
|
952
|
+
* @returns The concrete proposal `StructType`
|
|
953
|
+
*
|
|
954
|
+
* @property patch - The fields the proposal sets (`Sheet.patch(R, …)`)
|
|
955
|
+
* @property meta - The provenance line
|
|
956
|
+
*/
|
|
957
|
+
export function SheetProposalTypeFor(rowType) {
|
|
958
|
+
return StructType({ patch: SheetPatchTypeFor(rowType), meta: StringType });
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* `Sheet.Types.CheckContext(R)` — what an author's member check sees (§3.4):
|
|
962
|
+
* the typed row, the half and the resolved member.
|
|
963
|
+
*
|
|
964
|
+
* @typeParam R - The host's row type
|
|
965
|
+
* @param rowType - The row type value
|
|
966
|
+
* @returns The concrete check-context `StructType`
|
|
967
|
+
*
|
|
968
|
+
* @property rowIndex - Sheet position among real rows
|
|
969
|
+
* @property row - The row as it would be if the editor committed
|
|
970
|
+
* @property half - The half being edited
|
|
971
|
+
* @property member - The resolved member under check
|
|
972
|
+
*/
|
|
973
|
+
export function SheetCheckContextTypeFor(rowType) {
|
|
974
|
+
return StructType({
|
|
975
|
+
rowIndex: IntegerType,
|
|
976
|
+
row: SheetDraftTypeFor(rowType),
|
|
977
|
+
group: OptionType(NullType),
|
|
978
|
+
half: SheetHalfType,
|
|
979
|
+
member: SheetMemberType,
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* The line type a group row's lines field holds, checked at build time.
|
|
984
|
+
*
|
|
985
|
+
* @param groupType - The group's row type value
|
|
986
|
+
* @param field - The lines field
|
|
987
|
+
* @returns The line type
|
|
988
|
+
* @throws Error naming the field when it is not an `Array<Struct>`
|
|
989
|
+
*/
|
|
990
|
+
export function sheetLinesOf(groupType, field) {
|
|
991
|
+
const fields = groupType.fields;
|
|
992
|
+
const t = fields[field];
|
|
993
|
+
if (t === undefined) {
|
|
994
|
+
throw new Error(`Sheet: \`group\` names "${field}", which is not a field of the row type (${Object.keys(fields).join(", ")})`);
|
|
995
|
+
}
|
|
996
|
+
if (t.type === "Array" && t.value?.type === "Struct") {
|
|
997
|
+
return { lineType: t.value };
|
|
998
|
+
}
|
|
999
|
+
throw new Error(`Sheet: the lines field "${field}" must be an Array of row structs — got ${t.type ?? "an unknown type"}`);
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* `Sheet.Types.Context(P, "lines", D)` — the copilot context of a GROUPED
|
|
1003
|
+
* sheet: the line as it would be, its group's lines, the group, the resident
|
|
1004
|
+
* groups and the driver's row, all typed.
|
|
1005
|
+
*
|
|
1006
|
+
* @typeParam P - The group's row type
|
|
1007
|
+
* @typeParam F - The lines field
|
|
1008
|
+
* @typeParam D - The driver's row type
|
|
1009
|
+
* @param groupType - The group's row type value
|
|
1010
|
+
* @param lines - The lines field
|
|
1011
|
+
* @param driverType - The driver's row type value (default `NullType`)
|
|
1012
|
+
* @returns The concrete context `StructType`
|
|
1013
|
+
*
|
|
1014
|
+
* On a sheet with loose rows between its groups (#846), a LOOSE row's
|
|
1015
|
+
* context has no group: `rows` are the resident loose rows, `rowIndex` its
|
|
1016
|
+
* index among them.
|
|
1017
|
+
*
|
|
1018
|
+
* @property rowIndex - The line's index WITHIN its group (a loose row: its index in `rows`)
|
|
1019
|
+
* @property row - The line as it would be if the open editor committed
|
|
1020
|
+
* @property rows - The group's lines, in order (a loose row: the resident loose rows)
|
|
1021
|
+
* @property group - The group row (`none` for a loose row)
|
|
1022
|
+
* @property groups - The resident groups, in sheet order
|
|
1023
|
+
* @property partial - `true` on a paged sheet whose source is not exhausted
|
|
1024
|
+
* @property driver - The driver's row for `row`
|
|
1025
|
+
* @property today - UTC midnight
|
|
1026
|
+
*/
|
|
1027
|
+
export function SheetGroupContextTypeFor(groupType, lines, driverType) {
|
|
1028
|
+
const { lineType } = sheetLinesOf(groupType, lines);
|
|
1029
|
+
return StructType({
|
|
1030
|
+
rowIndex: IntegerType,
|
|
1031
|
+
row: SheetDraftTypeFor(lineType),
|
|
1032
|
+
rows: ArrayType(SheetDraftTypeFor(lineType)),
|
|
1033
|
+
group: OptionType(SheetDraftGroupTypeFor(groupType, lines)),
|
|
1034
|
+
groups: ArrayType(SheetDraftGroupTypeFor(groupType, lines)),
|
|
1035
|
+
partial: BooleanType,
|
|
1036
|
+
driver: OptionType((driverType ?? NullType)),
|
|
1037
|
+
today: DateTimeType,
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* `Sheet.Types.CheckContext(P, "lines")` — what an author's member check
|
|
1042
|
+
* sees on a GROUPED sheet: the typed line, its group, the half and the member.
|
|
1043
|
+
*
|
|
1044
|
+
* @typeParam P - The group's row type
|
|
1045
|
+
* @typeParam F - The lines field
|
|
1046
|
+
* @param groupType - The group's row type value
|
|
1047
|
+
* @param lines - The lines field
|
|
1048
|
+
* @returns The concrete check-context `StructType`
|
|
1049
|
+
*/
|
|
1050
|
+
export function SheetGroupCheckContextTypeFor(groupType, lines) {
|
|
1051
|
+
const { lineType } = sheetLinesOf(groupType, lines);
|
|
1052
|
+
return StructType({
|
|
1053
|
+
rowIndex: IntegerType,
|
|
1054
|
+
row: SheetDraftTypeFor(lineType),
|
|
1055
|
+
group: OptionType(SheetDraftGroupTypeFor(groupType, lines)),
|
|
1056
|
+
half: SheetHalfType,
|
|
1057
|
+
member: SheetMemberType,
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
export function sheetContextType(first, second, third) {
|
|
1061
|
+
if (typeof second === "string")
|
|
1062
|
+
return SheetGroupContextTypeFor(first, second, third);
|
|
1063
|
+
return SheetContextTypeFor(first, second);
|
|
1064
|
+
}
|
|
1065
|
+
export function sheetCheckContextType(first, second) {
|
|
1066
|
+
if (typeof second === "string")
|
|
1067
|
+
return SheetGroupCheckContextTypeFor(first, second);
|
|
1068
|
+
return SheetCheckContextTypeFor(first);
|
|
1069
|
+
}
|
|
1070
|
+
//# sourceMappingURL=types.js.map
|