@mistriwork/kit 1.0.0-rc.16 → 1.0.0-rc.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/client/components/AppList.js +16 -6
  2. package/dist/client/components/CardsList.js +7 -1
  3. package/dist/client/components/Chart.css +5 -0
  4. package/dist/client/components/Chart.d.ts +17 -2
  5. package/dist/client/components/Chart.js +83 -22
  6. package/dist/client/components/ChartFigure.d.ts +3 -1
  7. package/dist/client/components/ChartFigure.js +14 -8
  8. package/dist/client/components/Content.js +3 -1
  9. package/dist/client/components/DashHead.d.ts +6 -0
  10. package/dist/client/components/DashHead.js +20 -0
  11. package/dist/client/components/Editable.js +1 -1
  12. package/dist/client/components/Export.js +8 -4
  13. package/dist/client/components/Grid.js +54 -6
  14. package/dist/client/components/JsonPreview.css +29 -0
  15. package/dist/client/components/JsonPreview.js +1 -1
  16. package/dist/client/components/JsonView.css +201 -62
  17. package/dist/client/components/JsonView.d.ts +43 -1
  18. package/dist/client/components/JsonView.js +320 -55
  19. package/dist/client/components/LayoutSwitch.d.ts +9 -0
  20. package/dist/client/components/LayoutSwitch.js +61 -0
  21. package/dist/client/components/ListEmpty.css +3 -0
  22. package/dist/client/components/LiveNotices.css +3 -0
  23. package/dist/client/components/NewRecord.d.ts +0 -2
  24. package/dist/client/components/NewRecord.js +61 -17
  25. package/dist/client/components/PageFields.js +23 -4
  26. package/dist/client/components/PageHead.js +28 -7
  27. package/dist/client/components/PageRelated.d.ts +28 -0
  28. package/dist/client/components/PageRelated.js +50 -3
  29. package/dist/client/components/PageSectionBox.d.ts +5 -1
  30. package/dist/client/components/PageSectionBox.js +5 -3
  31. package/dist/client/components/PageSections.js +26 -13
  32. package/dist/client/components/PageSkeleton.css +2 -0
  33. package/dist/client/components/PageSkeleton.js +11 -3
  34. package/dist/client/components/Palette.js +108 -10
  35. package/dist/client/components/RecordPicker.d.ts +2 -0
  36. package/dist/client/components/RecordPicker.js +34 -8
  37. package/dist/client/components/RecordSummaries.js +6 -1
  38. package/dist/client/components/Rooms.js +2 -2
  39. package/dist/client/components/SecondLine.d.ts +15 -0
  40. package/dist/client/components/SecondLine.js +18 -0
  41. package/dist/client/components/TableRoom.js +15 -5
  42. package/dist/client/components/TableView.d.ts +2 -0
  43. package/dist/client/components/Value.d.ts +1 -0
  44. package/dist/client/components/Value.js +7 -9
  45. package/dist/client/components/appListModel.d.ts +4 -0
  46. package/dist/client/components/appRooms.d.ts +2 -0
  47. package/dist/client/components/appRooms.js +2 -0
  48. package/dist/client/components/dashboardModel.d.ts +5 -0
  49. package/dist/client/components/directoryModel.d.ts +25 -0
  50. package/dist/client/components/directoryModel.js +88 -0
  51. package/dist/client/components/gridSizing.d.ts +3 -0
  52. package/dist/client/components/gridSizing.js +6 -2
  53. package/dist/client/components/jsonTree.d.ts +54 -0
  54. package/dist/client/components/jsonTree.js +190 -0
  55. package/dist/client/components/listSubtitles.d.ts +1 -0
  56. package/dist/client/components/listSubtitles.js +7 -0
  57. package/dist/client/components/newMenuModel.d.ts +14 -6
  58. package/dist/client/components/newMenuModel.js +37 -5
  59. package/dist/client/components/newRecordModel.d.ts +24 -2
  60. package/dist/client/components/newRecordModel.js +47 -4
  61. package/dist/client/components/pageContext.d.ts +2 -0
  62. package/dist/client/components/pageModel.d.ts +2 -0
  63. package/dist/client/components/sidebarModel.js +7 -3
  64. package/dist/client/components/textMeasure.d.ts +2 -0
  65. package/dist/client/components/textMeasure.js +16 -2
  66. package/dist/client/composedReads.js +3 -1
  67. package/dist/client/copy/lists/components/AppList.d.ts +1 -0
  68. package/dist/client/copy/lists/components/AppList.js +1 -0
  69. package/dist/client/copy/lists/components/LayoutSwitch.d.ts +4 -0
  70. package/dist/client/copy/lists/components/LayoutSwitch.js +6 -0
  71. package/dist/client/copy/record/components/JsonView.d.ts +22 -0
  72. package/dist/client/copy/record/components/JsonView.js +19 -0
  73. package/dist/client/copy/record/components/PageHead.d.ts +1 -0
  74. package/dist/client/copy/record/components/PageHead.js +2 -0
  75. package/dist/client/copy/shell/components/Palette.d.ts +11 -0
  76. package/dist/client/copy/shell/components/Palette.js +14 -0
  77. package/dist/client/copy/shell/components/TopNav.d.ts +2 -1
  78. package/dist/client/copy/shell/components/TopNav.js +4 -2
  79. package/dist/client/copy/shell/components/directoryModel.d.ts +4 -0
  80. package/dist/client/copy/shell/components/directoryModel.js +6 -0
  81. package/dist/client/copy/shell/components/sidebarModel.d.ts +1 -0
  82. package/dist/client/copy/shell/components/sidebarModel.js +1 -0
  83. package/dist/client/copy/workbench/components/Export.d.ts +3 -2
  84. package/dist/client/copy/workbench/components/Export.js +3 -2
  85. package/dist/client/core.d.ts +3 -3
  86. package/dist/client/core.js +6 -7
  87. package/dist/client/export.d.ts +5 -4
  88. package/dist/client/export.js +40 -19
  89. package/dist/client/features.css +67 -7
  90. package/dist/client/index.html +2 -1
  91. package/dist/client/insert.js +1 -8
  92. package/dist/client/locale.d.ts +7 -0
  93. package/dist/client/locale.js +0 -0
  94. package/dist/client/lumenLook.css +9 -12
  95. package/dist/client/page.css +63 -15
  96. package/dist/client/palette.d.ts +3 -1
  97. package/dist/client/palette.js +19 -4
  98. package/dist/client/paletteRecents.d.ts +25 -0
  99. package/dist/client/paletteRecents.js +64 -0
  100. package/dist/client/partsLook.css +6 -3
  101. package/dist/client/sageLook.css +5 -3
  102. package/dist/client/shellMode.d.ts +8 -0
  103. package/dist/client/shellMode.js +1 -0
  104. package/dist/client/structure.css +201 -1
  105. package/dist/client/style.css +59 -10
  106. package/dist/client/themeFamilies.css +37 -0
  107. package/dist/client/visualThemes.css +12 -0
  108. package/dist/client/workbenchLook.css +415 -0
  109. package/dist/client/workshopLook.css +48 -25
  110. package/package.json +4 -3
@@ -46,6 +46,8 @@ import { appListQuery, litTabFor, residueOf, searchColumn, shownTabs, visibleQue
46
46
  import { boxTail, boxesFor } from './FilterBoxes.js';
47
47
  import { onDemand } from './onDemand.js';
48
48
  import { useGridGroups } from './useGridGroups.js';
49
+ import { ListSubtitles } from './listSubtitles.js';
50
+ import { LayoutSwitch, useListLayout } from './LayoutSwitch.js';
49
51
  const DefinedBoxes = onDemand(() => import('./DefinedFields.js'), 'DefinedBoxes', { quiet: true });
50
52
  /* A list's single `per` value (`category_id = 3`), which picks the fields a row-defined column's boxes are. */
51
53
  function oneValue(tail) {
@@ -151,6 +153,11 @@ function TabCount({ counted }) {
151
153
  export function AppList({ entry, spec, navigate, embedded = false, newButton, inDashboard = false, onTotal }) {
152
154
  useMessageLanguage();
153
155
  const caption = spec.label;
156
+ /* A list whose machine has a handful of open states may be read as a board too (listInference.ts): the reader's
157
+ choice, kept in their browser per view, as a board's folds are. */
158
+ const boardable = Boolean(spec.asBoard && !spec.presentation && !embedded && !inDashboard);
159
+ const [layout, setLayout] = useListLayout(spec.id, boardable);
160
+ const presented = boardable && layout === 'board' ? spec.asBoard : spec.presentation;
154
161
  const client = useQueryClient();
155
162
  const table = findTable(entry.table);
156
163
  const tabs = shownTabs(spec);
@@ -289,7 +296,8 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
289
296
  const isDefault = canonicalize(entry.query) === canonicalize(appListQuery(spec, 0));
290
297
  const exactTab = litTab >= 0 && canonicalize(refinement) === canonicalize(tabs[litTab].query ?? '');
291
298
  const offerSave = savable && !(isDefault || exactTab || yourLit >= 0 || !refinement);
292
- const gridTab = tabs.findIndex((_, i) => squeeze(appListQuery(spec, i)) === squeeze(entry.query));
299
+ /* A board reads no total (TableRoom.tsx): its tab's badge is counted with the others. */
300
+ const gridTab = presented?.kind === 'board' ? -1 : tabs.findIndex((_, i) => squeeze(appListQuery(spec, i)) === squeeze(entry.query));
293
301
  /* The badges not already on screen: the grid's own total answers the tab
294
302
  it shows, so that one is never asked twice (and a list whose grid is
295
303
  still loading does not ask again once it lands). */
@@ -422,6 +430,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
422
430
  ...(recordLabel(table) && labelPath(table) ? [labelPath(table)] : []),
423
431
  ...(spec.order ? [spec.order] : []),
424
432
  ...subtitleColumns(entry.table, [...chosen]),
433
+ ...[...chosen].flatMap((name) => (spec.subtitles && Object.hasOwn(spec.subtitles, name) ? [spec.subtitles[name]] : [])),
425
434
  ...editedReferences(spec),
426
435
  ...(spec.opens ? [spec.opens] : []),
427
436
  ...(spec.group ? [spec.group] : []),
@@ -461,7 +470,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
461
470
  : undefined;
462
471
  /* A grouped grid's heads: one breakdown over what the conditions match, never a read per group (useGridGroups.ts). */
463
472
  const gridGroup = useGridGroups({
464
- column: spec.presentation ? undefined : spec.group,
473
+ column: presented ? undefined : spec.group,
465
474
  table,
466
475
  query: entry.query,
467
476
  totals: spec.totals,
@@ -631,14 +640,15 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
631
640
  void client.invalidateQueries({
632
641
  queryKey: ['count', connection ?? ''],
633
642
  });
634
- } }) })), _jsx(BoardNewForm.Provider, { value: offersNew ? (spec.form ?? {}) : null, children: _jsx(RowOpensContext.Provider, { value: rowOpens, children: _jsx(TableRoom, { entry: gridEntry, sizing: spec.sizing, chrome: false, summaries: true, inset: !inDashboard, embedded: inDashboard, hide: keptHide, referenceLabels: referenceLabels, totals: keptTotals, ...(gridGroup ? { group: gridGroup } : {}), density: spec.density,
635
- /* A ⋯ with nothing a reader may run is a dead control and a reserved column; the App payload already says what they may run. */
636
- rowActions: Boolean(spec.rowActions && !spec.presentation && !embedded && mayRunAny(shell().app(), entry.table, spec.actions ?? [])), editable: spec.presentation || embedded ? undefined : spec.editable, inCrumbs: inCrumbs, onResult: keptOnGrid, presentation: embedded ? undefined : spec.presentation, present: shell().present ?? undefined, empty: embedded ? undefined : narrowedPast ? (noMatches) : authoredEmpty ? (_jsx(ListEmpty, { spec: authoredEmpty })) : ((nothingYet ?? tabEmpty)), actions: embedded ? undefined : spec.actions, listLabel: caption, order: embedded ? undefined : spec.order, export: exportOff ? false : undefined, interactive: embedded ? false : undefined }) }) })] })), [
643
+ } }) })), _jsx(BoardNewForm.Provider, { value: offersNew ? (spec.form ?? {}) : null, children: _jsx(RowOpensContext.Provider, { value: rowOpens, children: _jsx(ListSubtitles.Provider, { value: spec.subtitles, children: _jsx(TableRoom, { entry: gridEntry, sizing: spec.sizing, chrome: false, summaries: true, inset: !inDashboard, embedded: inDashboard, hide: keptHide, referenceLabels: referenceLabels, totals: keptTotals, ...(gridGroup ? { group: gridGroup } : {}), density: spec.density,
644
+ /* A ⋯ with nothing a reader may run is a dead control and a reserved column; the App payload already says what they may run. */
645
+ rowActions: Boolean(spec.rowActions && !presented && !embedded && mayRunAny(shell().app(), entry.table, spec.actions ?? [])), editable: presented || embedded ? undefined : spec.editable, inCrumbs: inCrumbs, onResult: keptOnGrid, presentation: embedded ? undefined : presented, present: shell().present ?? undefined, empty: embedded ? undefined : narrowedPast ? (noMatches) : authoredEmpty ? (_jsx(ListEmpty, { spec: authoredEmpty })) : ((nothingYet ?? tabEmpty)), actions: embedded ? undefined : spec.actions, listLabel: caption, order: embedded ? undefined : spec.order, export: exportOff ? false : undefined, interactive: embedded ? false : undefined }) }) }) })] })), [
637
646
  gridPage,
638
647
  gridSize,
639
648
  embedded,
640
649
  inDashboard,
641
650
  spec,
651
+ presented,
642
652
  table,
643
653
  client,
644
654
  connection,
@@ -683,7 +693,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
683
693
  }, onSearch: () => form.current?.requestSubmit(), apply: apply, current: currentText, residue: residueChip, listLabel: caption, phone: phone, onSheet: () => setSheet(true) })), spec.sorts?.length && !beside ? (_jsx(SortMenu, { sorts: spec.sorts, sort: spec.sort, query: entry.query, onPick: (query) => {
684
694
  walk.page = 0;
685
695
  navigate(query);
686
- } })) : null, _jsxs("div", { className: "applist-actions", children: [railed && railNarrow && railProps && boxes.length > 0 && (_jsx("button", { type: "button", className: "applist-toggle", "aria-haspopup": "dialog", onClick: () => setSheet(true), children: narrowed ? say('common.filters', { narrowed }) : say('common.filtersButton') })), spec.advancedFilters === true && boxes.length > 0 && (_jsx("button", { type: "button", className: "applist-toggle", "aria-expanded": showAdvanced, onClick: () => {
696
+ } })) : null, _jsxs("div", { className: "applist-actions", children: [boardable && _jsx(LayoutSwitch, { layout: layout, onChange: setLayout, label: say('layout', { caption }) }), railed && railNarrow && railProps && boxes.length > 0 && (_jsx("button", { type: "button", className: "applist-toggle", "aria-haspopup": "dialog", onClick: () => setSheet(true), children: narrowed ? say('common.filters', { narrowed }) : say('common.filtersButton') })), spec.advancedFilters === true && boxes.length > 0 && (_jsx("button", { type: "button", className: "applist-toggle", "aria-expanded": showAdvanced, onClick: () => {
687
697
  setAdvanced(!showAdvanced);
688
698
  // Opening an inline editor must not scroll its toggle beneath
689
699
  // the sticky trail, leaving the same control impossible to close.
@@ -24,6 +24,7 @@ import { primaryKey } from '@mistriwork/engine/shared/schema.js';
24
24
  import { humanName } from '@mistriwork/engine/shared/model.js';
25
25
  import { cardsImageSort, factWord } from '@mistriwork/engine/shared/appCards.js';
26
26
  import { Value } from './Value.js';
27
+ import { Subtitled, secondLine } from './SecondLine.js';
27
28
  import { dressFor, hueOf, initialsOf, maskedText } from './valueModel.js';
28
29
  import { Icon } from './Icon.js';
29
30
  import { useListOrder } from './useListOrder.js';
@@ -136,6 +137,10 @@ export function CardsList({ table, rows, spec, interactive = true, recordNavigat
136
137
  const { column, value } = namedCell(table, name, row, referenceLabels);
137
138
  return _jsx(Value, { col: column, value: value, tableId: table.id, compact: true });
138
139
  };
140
+ /* The figure and a captioned line have room for their column's second line (`subtitle`), quiet under the value; a
141
+ summary, a foot and a badge are one line each (appListColumns.ts listSecondLineColumns). A label path's rule is
142
+ its own table's, so only the row's own columns are asked. */
143
+ const saidWithSecond = (row, name) => (_jsx(Subtitled, { tableId: table.id, column: name.includes('.') ? undefined : name, row: row, children: said(row, name) }));
139
144
  // A line or a fact may be a label path ("dealer_id.name"): its caption is the App's, else its last step's.
140
145
  const caption = (name) => columnLabel(table.id, name) ?? humanName(name.split('.').pop() ?? name);
141
146
  const present = (row, name) => row[name] !== null && row[name] !== undefined && row[name] !== '';
@@ -161,6 +166,7 @@ export function CardsList({ table, rows, spec, interactive = true, recordNavigat
161
166
  const key = keyOf(table, row);
162
167
  const id = ordering.id(row);
163
168
  const title = titleOf(row);
169
+ const titleSecond = spec.primary.includes('.') ? undefined : secondLine(table.id, spec.primary, row);
164
170
  const src = typeof image === 'string' ? cardImageAddress(row[image]) : leadOf(row);
165
171
  const avatar = spec.media === 'avatar';
166
172
  /* An icon tile leads the card in a picture's place: it is no picture, so the card keeps its text layout. */
@@ -177,7 +183,7 @@ export function CardsList({ table, rows, spec, interactive = true, recordNavigat
177
183
  ? { name: dressed.icon, label: dressed.label, tone: dressed.kind === 'tone' ? dressed.tone : undefined }
178
184
  : null;
179
185
  const badge = spec.badge && row[spec.badge] != null && row[spec.badge] !== '' ? (_jsx("span", { className: "cards-badge", children: said(row, spec.badge) })) : null;
180
- return (_jsx("li", { className: "cards-item", ...(win.windowed ? { 'data-index': win.lineOf(index), ref: win.measure } : {}), ...(id ? ordering.item(id) : {}), onKeyDown: id ? (event) => ordering.keyDown(event, id) : undefined, children: _jsxs("article", { className: `cards-card${hasMedia ? ' has-media' : ''}${avatar ? ' cards-profile' : ''}${changedRows.has(row) ? ` row-changed-${changedRows.get(row)}` : ''}`, children: [hasMedia && _jsx(CardPicture, { src: src, avatar: avatar, title: title, first: index < FIRST_ROW }), id && ordering.menu(id), _jsxs("div", { className: "cards-body", children: [tile && (_jsx("span", { className: `cards-tile${mark?.tone ? ` tone-${mark.tone}` : ''}`, children: mark && _jsx(Icon, { name: mark.name, label: mark.label, size: 22 }) })), _jsxs("h3", { className: "cards-title", children: [mark && !tile && _jsx(Icon, { name: mark.name, label: mark.label, className: "cards-icon" }), canOpen && key ? (_jsx("button", { type: "button", className: "cards-open", "data-order-focus": "", "aria-keyshortcuts": ordering.shortcuts, "data-opens": opensRecord(table.id, key), onClick: () => void openRecord(table.id, key, title, 'push', { records, list }), children: title })) : (_jsx("span", { children: title }))] }), description !== undefined && (_jsx("p", { className: "cards-description", title: description, children: description })), (!hasMedia || avatar) && badge, spec.value && row[spec.value] != null && _jsx("p", { className: "cards-value", children: said(row, spec.value) }), spec.facts?.some((name) => present(row, name)) ? (_jsx("p", { className: "cards-summary", children: spec.facts.filter((name) => present(row, name)).map((name) => fact(row, name, 'cards-summary-item')) })) : null, spec.lines?.length ? (_jsx("dl", { className: "cards-facts", children: spec.lines.map((name) => (_jsxs("div", { className: "cards-fact", children: [_jsx("dt", { children: caption(name) }), _jsx("dd", { children: said(row, name) })] }, name))) })) : null] }), spec.footer?.length ? (_jsx("p", { className: "cards-foot", children: spec.footer.some((name) => present(row, name))
186
+ return (_jsx("li", { className: "cards-item", ...(win.windowed ? { 'data-index': win.lineOf(index), ref: win.measure } : {}), ...(id ? ordering.item(id) : {}), onKeyDown: id ? (event) => ordering.keyDown(event, id) : undefined, children: _jsxs("article", { className: `cards-card${hasMedia ? ' has-media' : ''}${avatar ? ' cards-profile' : ''}${changedRows.has(row) ? ` row-changed-${changedRows.get(row)}` : ''}`, children: [hasMedia && _jsx(CardPicture, { src: src, avatar: avatar, title: title, first: index < FIRST_ROW }), id && ordering.menu(id), _jsxs("div", { className: "cards-body", children: [tile && (_jsx("span", { className: `cards-tile${mark?.tone ? ` tone-${mark.tone}` : ''}`, children: mark && _jsx(Icon, { name: mark.name, label: mark.label, size: 22 }) })), _jsxs("h3", { className: "cards-title", children: [mark && !tile && _jsx(Icon, { name: mark.name, label: mark.label, className: "cards-icon" }), canOpen && key ? (_jsx("button", { type: "button", className: "cards-open", "data-order-focus": "", "aria-keyshortcuts": ordering.shortcuts, "data-opens": opensRecord(table.id, key), onClick: () => void openRecord(table.id, key, title, 'push', { records, list }), children: title })) : (_jsx("span", { children: title }))] }), titleSecond !== undefined && _jsx("p", { className: "cards-subtitle", children: titleSecond }), description !== undefined && (_jsx("p", { className: "cards-description", title: description, children: description })), (!hasMedia || avatar) && badge, spec.value && row[spec.value] != null && _jsx("p", { className: "cards-value", children: saidWithSecond(row, spec.value) }), spec.facts?.some((name) => present(row, name)) ? (_jsx("p", { className: "cards-summary", children: spec.facts.filter((name) => present(row, name)).map((name) => fact(row, name, 'cards-summary-item')) })) : null, spec.lines?.length ? (_jsx("dl", { className: "cards-facts", children: spec.lines.map((name) => (_jsxs("div", { className: "cards-fact", children: [_jsx("dt", { children: caption(name) }), _jsx("dd", { children: saidWithSecond(row, name) })] }, name))) })) : null] }), spec.footer?.length ? (_jsx("p", { className: "cards-foot", children: spec.footer.some((name) => present(row, name))
181
187
  ? spec.footer.filter((name) => present(row, name)).map((name) => fact(row, name, 'cards-foot-item'))
182
188
  : '\u00a0' })) : null, hasMedia && !avatar && badge] }) }, key ? JSON.stringify(key) : index));
183
189
  }), win.after > 0 && _jsx("li", { className: "cards-spacer", "aria-hidden": "true", style: { height: `${win.after}px` } })] }), ordering.live] }));
@@ -16,6 +16,11 @@
16
16
  /* Stacked columns: each series its token in every column; the current column is named by its tick and its pill, not by a tint. */
17
17
  .chart-columns { display: grid; gap: var(--space-3h); min-width: 0; }
18
18
  .chart-column-part { rx: 0; }
19
+ /* A column that drills: a door over its whole band (the hit rect is clear), the pointer saying it goes somewhere, and
20
+ while it holds the keyboard the house ring round the band, as a line's point widens its stroke. */
21
+ .chart-column-door { cursor: pointer; outline: none; }
22
+ .chart-column-hit { fill: transparent; }
23
+ .chart-column-door:focus-visible .chart-column-hit { stroke: var(--focus); stroke-width: 2px; vector-effect: non-scaling-stroke; }
19
24
  .chart-columns-legend { display: flex; flex-wrap: wrap; gap: var(--space-2h) 20px; max-width: none; }
20
25
  /* A trend is its change's news where the metric says which way is good: the
21
26
  green or red its delta is said in, never a colour by position. The wash
@@ -107,10 +107,12 @@ export declare function BarChart({ rows, say, label, wide, high, target, tone, }
107
107
  * legend, which says each series' total. Every column is also a row of a
108
108
  * table assistive technology reads. Nothing moves (motion rule 8).
109
109
  */
110
- export declare function StackedColumns({ rows, series, say, wide, high, }: {
110
+ export declare function StackedColumns({ rows, series, say, wide, high, paint, legend, target, onPick, }: {
111
+ /** `raw` is the key a column goes to when it drills; a gap-filled bucket (a period nothing happened in) holds none and is no door. */
111
112
  rows: Array<{
112
113
  key: string;
113
114
  values: Record<string, number>;
115
+ raw?: unknown;
114
116
  }>;
115
117
  series: Array<{
116
118
  key: string;
@@ -119,6 +121,13 @@ export declare function StackedColumns({ rows, series, say, wide, high, }: {
119
121
  say?: Say;
120
122
  wide?: number;
121
123
  high?: number;
124
+ /** A series' own paint where it is not the palette in order (a tone, a ramp step, a lighter share): its parts' style. */
125
+ paint?: (k: number) => React.CSSProperties;
126
+ /** The legend and its totals under the figure; off where the caller draws one over it. */
127
+ legend?: boolean;
128
+ target?: number;
129
+ /** A column as a way into its rows, by its raw key. */
130
+ onPick?: ((value: unknown) => void) | null;
122
131
  }): import("react").JSX.Element;
123
132
  /**
124
133
  * The house ring round a donut's slice (design.md, Access): a shape takes no outline, so the ring is the outline of
@@ -151,6 +160,8 @@ interface StackedRow {
151
160
  series: unknown;
152
161
  value: unknown;
153
162
  }
163
+ /** A stacked chart over periods is drawn at this height, as a bar chart's figure is: a fixed figure, so its room is held before its answer. */
164
+ export declare const TIMED_HEIGHT = 180;
154
165
  /**
155
166
  * Stacked bars: each group of the first key a bar, divided by the second —
156
167
  * how each of several wholes divides, where a donut says how one does. The
@@ -185,7 +196,11 @@ export declare function StackedBars({ rows, say, label, seriesLabel, target, lim
185
196
  * corner; the stroke and the last point's dot keep their own size however
186
197
  * far it stretches (`non-scaling-stroke`, and the dot is a round cap on a
187
198
  * zero-length stroke). Under four points there is no shape to read, so
188
- * there is no spark.
199
+ * there is no spark. Four points with fewer than four of them above zero are a
200
+ * line that is flat but for a spike or two, which reads as a fall to nothing
201
+ * and a climb back: those are thin bars (one per period, the empty ones left
202
+ * bare over a baseline), kept to a short width, and an all-zero run draws none.
203
+ * The card's change, said beside the figure, is the trend's news either way.
189
204
  */
190
205
  export declare function Sparkline({ rows, say }: {
191
206
  rows: ChartRow[];
@@ -507,10 +507,15 @@ export function BarChart({ rows, say = String, label = String, wide = 600, high,
507
507
  * legend, which says each series' total. Every column is also a row of a
508
508
  * table assistive technology reads. Nothing moves (motion rule 8).
509
509
  */
510
- export function StackedColumns({ rows, series, say = String, wide = 600, high, }) {
510
+ export function StackedColumns({ rows, series, say = String, wide = 600, high, paint, legend = true, target, onPick, }) {
511
511
  const columns = rows
512
- .map((r) => ({ key: r.key, parts: series.map((s) => Math.max(0, Number(r.values[s.key]) || 0)) }))
512
+ .map((r) => ({ key: r.key, raw: r.raw, parts: series.map((s) => Math.max(0, Number(r.values[s.key]) || 0)) }))
513
513
  .map((c) => ({ ...c, total: c.parts.reduce((n, v) => n + v, 0) }));
514
+ /* Roving tabindex for the columns that drill, as a line's points have: one tab stop for the figure, the arrows
515
+ between its doors, Home and End to its ends. */
516
+ const doors = columns.map((c, i) => (onPick && c.raw != null ? i : -1)).filter((i) => i >= 0);
517
+ const [roved, setRoved] = useState(null);
518
+ const tabbable = roved !== null && doors.includes(roved) ? roved : doors[0];
514
519
  const svg = useRef(null);
515
520
  const [near, setNear] = useState(null);
516
521
  const [pointer, setPointer] = useState(null);
@@ -531,8 +536,9 @@ export function StackedColumns({ rows, series, say = String, wide = 600, high, }
531
536
  const named = columns.map((c) => (periods ? periodTick(c.key) : c.key));
532
537
  const W = measured > 0 ? measured : wide;
533
538
  const H = high ? Math.max(120, Math.round(high)) : Math.max(160, Math.min(Math.round(W / 3.5), 220));
539
+ const goal = target !== undefined && Number.isFinite(target) && target > 0 ? target : undefined;
534
540
  const max = Math.max(...columns.map((c) => c.total), 1);
535
- const scale = niceScale(0, max, 2, say.tick?.steps);
541
+ const scale = niceScale(0, Math.max(max, goal ?? 0), 2, say.tick?.steps);
536
542
  const levels = scale.levels;
537
543
  const gutter = Math.max(...levels.map((v) => tickWidth(tickSay(say)(v)))) + 6;
538
544
  const PAD = { top: 30, right: 6, bottom: 24, left: gutter };
@@ -553,6 +559,10 @@ export function StackedColumns({ rows, series, say = String, wide = 600, high, }
553
559
  const top = y(columns[active].total);
554
560
  const tipTop = pointer ? Math.min(Math.max(2, pointer.y - 30), H - PAD.bottom - 22) : Math.max(2, top - 26);
555
561
  const color = (k) => `var(--chart-${k + 1}, var(--accent))`;
562
+ const moveRoving = (to) => {
563
+ setRoved(to);
564
+ svg.current?.querySelectorAll('.chart-column-door')[doors.indexOf(to)]?.focus?.();
565
+ };
556
566
  const at = (e) => {
557
567
  // screen-px: clientX is a screen-pixel ruler too; the ratio maps it into viewBox units.
558
568
  const box = svg.current.getBoundingClientRect();
@@ -563,24 +573,52 @@ export function StackedColumns({ rows, series, say = String, wide = 600, high, }
563
573
  setNear(Math.min(columns.length - 1, Math.max(0, Math.floor((px - PAD.left) / band))));
564
574
  };
565
575
  const totals = series.map((_, k) => columns.reduce((n, c) => n + c.parts[k], 0));
566
- return (_jsxs("div", { className: "chart-columns", children: [_jsxs("svg", { ref: svg, className: "chart-bars", viewBox: `0 0 ${W} ${H}`, role: "img", "aria-label": sayCopy('barsSummary', {
576
+ return (_jsxs("div", { className: "chart-columns", children: [_jsxs("svg", { ref: svg, className: "chart-bars", viewBox: `0 0 ${W} ${H}`,
577
+ /* A picture must not hold buttons (a line's points say why): where a column drills, the figure is a group. */
578
+ role: doors.length ? 'group' : 'img', "aria-label": `${sayCopy('barsSummary', {
567
579
  count: columns.length,
568
580
  highest: say(max),
569
581
  last: named[columns.length - 1],
570
582
  value: say(columns[columns.length - 1].total),
571
- }), onPointerMove: at, onPointerLeave: () => {
583
+ })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, onPointerMove: at, onPointerLeave: () => {
572
584
  setNear(null);
573
585
  setPointer(null);
574
586
  }, children: [levels.map((v) => (_jsx("line", { className: "chart-grid", x1: PAD.left, x2: W - PAD.right, y1: f1(y(v)), y2: f1(y(v)) }, `g${v}`))), levels.map((v) => (_jsx("text", { className: "chart-tick chart-y-tick", x: f1(PAD.left - 6), y: f1(y(v) + 4), textAnchor: "end", children: tickSay(say)(v) }, `t${v}`))), _jsx("line", { className: "chart-bar-guide", x1: PAD.left, x2: W - PAD.right, y1: f1(top), y2: f1(top) }), columns.map((c, i) => {
575
587
  let base = 0;
576
- return (_jsxs("g", { className: `chart-column${i === active ? ' is-active' : ''}`, children: [_jsx("title", { children: `${named[i]}: ${parts(i)}` }), c.parts.map((v, k) => {
588
+ const column = (_jsxs(_Fragment, { children: [_jsx("title", { children: `${named[i]}: ${parts(i)}` }), c.parts.map((v, k) => {
577
589
  const from = base;
578
590
  base += v;
579
591
  if (!v)
580
592
  return null;
581
- return (_jsx("rect", { className: "chart-column-part", x: f1(x(i)), y: f1(y(base)), width: f1(colWide), height: f1(Math.max(1, y(from) - y(base))), style: { fill: color(k) } }, k));
582
- })] }, c.key));
583
- }), marks.map(({ index, text }) => (_jsx("text", { className: `chart-tick chart-x-tick${index === active ? ' is-active' : ''}`, x: f1(markAt(index, text)), y: H - 6, textAnchor: "middle", children: text }, `m${index}`))), _jsxs("g", { className: "chart-bar-tip", "aria-hidden": "true", children: [_jsx("rect", { x: f1(tipLeft), y: f1(tipTop), width: f1(tipWide), height: 20 }), _jsx("text", { x: f1(tipLeft + tipWide / 2), y: f1(tipTop + 14), textAnchor: "middle", children: tip })] })] }), _jsx("ul", { className: "chart-legend chart-columns-legend", children: series.map((s, k) => (_jsxs("li", { children: [_jsx("span", { className: "chart-swatch", style: { background: color(k) } }), _jsx("span", { className: "chart-legend-key", children: s.label }), _jsx("span", { className: "chart-legend-value", children: say(totals[k]) })] }, s.key))) }), _jsx("div", { className: "visually-hidden", children: _jsx("table", { className: "chart-data", children: _jsx("tbody", { children: columns.map((c, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: named[i] }), _jsx("td", { children: parts(i) })] }, c.key))) }) }) })] }));
593
+ return (_jsx("rect", { className: "chart-column-part", x: f1(x(i)), y: f1(y(base)), width: f1(colWide), height: f1(Math.max(1, y(from) - y(base))), style: paint ? paint(k) : { fill: color(k) } }, k));
594
+ })] }));
595
+ const className = `chart-column${i === active ? ' is-active' : ''}`;
596
+ if (!(onPick && c.raw != null))
597
+ return (_jsx("g", { className: className, children: column }, c.key));
598
+ /* A column that goes somewhere is a door over its whole band, so a short column is as easy to find as a tall
599
+ one; its focus is the house ring round the band. */
600
+ return (_jsxs("g", { className: `${className} chart-column-door`, role: "button", tabIndex: i === tabbable ? 0 : -1, "aria-label": `${named[i]}: ${parts(i)}`, onClick: () => onPick(c.raw), onKeyDown: (event) => {
601
+ const key = event.key;
602
+ if (key === 'Enter' || key === ' ') {
603
+ event.preventDefault();
604
+ onPick(c.raw);
605
+ return;
606
+ }
607
+ const to = key === 'ArrowRight'
608
+ ? doors[doors.indexOf(i) + 1]
609
+ : key === 'ArrowLeft'
610
+ ? doors[doors.indexOf(i) - 1]
611
+ : key === 'Home'
612
+ ? doors[0]
613
+ : key === 'End'
614
+ ? doors[doors.length - 1]
615
+ : undefined;
616
+ if (to !== undefined) {
617
+ event.preventDefault();
618
+ moveRoving(to);
619
+ }
620
+ }, children: [column, _jsx("rect", { className: "chart-column-hit", x: f1(PAD.left + band * i), y: PAD.top, width: f1(band), height: f1(H - PAD.top - PAD.bottom) })] }, c.key));
621
+ }), goal !== undefined && (_jsxs("g", { className: "chart-target", children: [_jsx("line", { className: "chart-target-line", x1: PAD.left, x2: W - PAD.right, y1: f1(y(goal)), y2: f1(y(goal)) }), _jsx("text", { className: "chart-target-label", x: PAD.left + 4, y: f1(y(goal) - 4), children: sayCopy('target', { goal: say(goal) }) })] })), marks.map(({ index, text }) => (_jsx("text", { className: `chart-tick chart-x-tick${index === active ? ' is-active' : ''}`, x: f1(markAt(index, text)), y: H - 6, textAnchor: "middle", children: text }, `m${index}`))), _jsxs("g", { className: "chart-bar-tip", "aria-hidden": "true", children: [_jsx("rect", { x: f1(tipLeft), y: f1(tipTop), width: f1(tipWide), height: 20 }), _jsx("text", { x: f1(tipLeft + tipWide / 2), y: f1(tipTop + 14), textAnchor: "middle", children: tip })] })] }), legend && (_jsx("ul", { className: "chart-legend chart-columns-legend", children: series.map((s, k) => (_jsxs("li", { children: [_jsx("span", { className: "chart-swatch", style: { background: color(k) } }), _jsx("span", { className: "chart-legend-key", children: s.label }), _jsx("span", { className: "chart-legend-value", children: say(totals[k]) })] }, s.key))) })), _jsx("div", { className: "visually-hidden", children: _jsx("table", { className: "chart-data", children: _jsx("tbody", { children: columns.map((c, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: named[i] }), _jsx("td", { children: parts(i) })] }, c.key))) }) }) })] }));
584
622
  }
585
623
  /**
586
624
  * The house ring round a donut's slice (design.md, Access): a shape takes no outline, so the ring is the outline of
@@ -686,6 +724,8 @@ export const TONE_INK = {
686
724
  info: 'var(--status-info)',
687
725
  neutral: 'var(--ink-subtle)',
688
726
  };
727
+ /** A stacked chart over periods is drawn at this height, as a bar chart's figure is: a fixed figure, so its room is held before its answer. */
728
+ export const TIMED_HEIGHT = 180;
689
729
  /**
690
730
  * Stacked bars: each group of the first key a bar, divided by the second —
691
731
  * how each of several wholes divides, where a donut says how one does. The
@@ -755,24 +795,34 @@ export function StackedBars({ rows, say = String, label = String, seriesLabel =
755
795
  const sayTotal = sayLegend
756
796
  ? sayLegend([...series.map((s) => s.total), ...shown.map((bar) => bar.total), ...(goal === undefined ? [] : [goal])])
757
797
  : say;
758
- return (_jsxs("div", { className: "chart-stacked", children: [_jsxs("ul", { className: "chart-legend chart-stacked-legend", children: [series.map((s, i) => (_jsxs("li", { children: [_jsx("span", { className: "chart-swatch", style: { ...ramp(i), background: color(i), opacity: opacity(i) } }), _jsx("span", { className: "chart-legend-key", children: s.label }), _jsx("span", { className: "chart-legend-value", children: sayTotal(s.total) })] }, s.key))), goal !== undefined && (_jsxs("li", { className: "chart-stacked-goal", children: [_jsx("span", { className: "chart-target-swatch", "aria-hidden": "true" }), _jsx("span", { className: "chart-legend-key", children: sayCopy('targetLabel') }), _jsx("span", { className: "chart-legend-value", children: sayTotal(goal) })] }))] }), _jsx("ul", { className: "chart-stacked-rows", "aria-label": `${sayCopy('barsBySeries', { count: shown.length, series: series.map((s) => s.label).join(', ') })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, children: shown.map((bar, at) => {
798
+ /* A bar's share of one series, the tail's folded into "others". */
799
+ const partOf = (bar, s) => s.key === 'others'
800
+ ? [...bar.parts.entries()]
801
+ .filter(([key]) => slot(key) === series.length - 1 && !kept.some((k) => k.key === key))
802
+ .reduce((n, [, v]) => n + v, 0)
803
+ : (bar.parts.get(s.key) ?? 0);
804
+ const legend = (_jsxs("ul", { className: "chart-legend chart-stacked-legend", children: [series.map((s, i) => (_jsxs("li", { children: [_jsx("span", { className: "chart-swatch", style: { ...ramp(i), background: color(i), opacity: opacity(i) } }), _jsx("span", { className: "chart-legend-key", children: s.label }), _jsx("span", { className: "chart-legend-value", children: sayTotal(s.total) })] }, s.key))), goal !== undefined && (_jsxs("li", { className: "chart-stacked-goal", children: [_jsx("span", { className: "chart-target-swatch", "aria-hidden": "true" }), _jsx("span", { className: "chart-legend-key", children: sayCopy('targetLabel') }), _jsx("span", { className: "chart-legend-value", children: sayTotal(goal) })] }))] }));
805
+ /* Time runs across the page, as it does in every other chart of a period: a column a period, at the bars' own height
806
+ and axis, its empty periods at zero, under the legend the rows have. Rows are for categories, whose order is the
807
+ reader's to scan down. */
808
+ if (timed) {
809
+ const filled = fillGaps(shown.map((bar) => ({ key: String(bar.raw), value: bar.total, bar })));
810
+ return (_jsxs("div", { className: "chart-stacked chart-stacked-timed", children: [legend, _jsx(StackedColumns, { rows: filled.map(({ key, bar }) => ({
811
+ key,
812
+ raw: bar?.raw,
813
+ values: bar ? Object.fromEntries(series.map((s) => [s.key, partOf(bar, s)])) : {},
814
+ })), series: series, say: say, high: TIMED_HEIGHT, paint: (i) => ({ ...ramp(i), fill: color(i), opacity: opacity(i) }), legend: false, target: goal, onPick: onPick })] }));
815
+ }
816
+ return (_jsxs("div", { className: "chart-stacked", children: [legend, _jsx("ul", { className: "chart-stacked-rows", "aria-label": `${sayCopy('barsBySeries', { count: shown.length, series: series.map((s) => s.label).join(', ') })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, children: shown.map((bar, at) => {
759
817
  /* Each series in legend order, so a colour sits in the same place in every bar. */
760
- const parts = series
761
- .map((s, i) => ({
762
- s,
763
- i,
764
- value: s.key === 'others'
765
- ? [...bar.parts.entries()]
766
- .filter(([key]) => slot(key) === series.length - 1 && !kept.some((k) => k.key === key))
767
- .reduce((n, [, v]) => n + v, 0)
768
- : (bar.parts.get(s.key) ?? 0),
769
- }))
770
- .filter((part) => part.value > 0);
818
+ const parts = series.map((s, i) => ({ s, i, value: partOf(bar, s) })).filter((part) => part.value > 0);
771
819
  const words = (_jsxs(_Fragment, { children: [_jsx("span", { className: "chart-stacked-label", children: barLabel(bar, at) }), _jsxs("span", { className: "chart-stacked-track", children: [_jsx("span", { className: "chart-stacked-fill", style: { width: share(bar.total) }, children: parts.map(({ s, i, value }) => (_jsx("span", { className: "chart-stacked-part", title: `${s.label}: ${say(value)}`, style: { ...ramp(i), flexGrow: value, background: color(i), opacity: opacity(i) } }, s.key))) }), goal !== undefined && _jsx("span", { className: "chart-stacked-target", style: { left: share(goal) }, "aria-hidden": "true" })] }), _jsx("span", { className: "chart-stacked-total", children: sayTotal(bar.total) }), _jsx("span", { className: "visually-hidden", children: `: ${parts.map(({ s, value }) => `${s.label} ${say(value)}`).join(', ')}` })] }));
772
820
  /* A bar that goes somewhere is a button; a null group, or no drill, stays text. */
773
821
  return (_jsx("li", { children: onPick && bar.raw != null ? (_jsx("button", { type: "button", className: "chart-stacked-row chart-stacked-drill", onClick: () => onPick(bar.raw), children: words })) : (_jsx("div", { className: "chart-stacked-row", children: words })) }, name(bar.raw)));
774
822
  }) })] }));
775
823
  }
824
+ /** A spark needs this many periods above zero to be a line; fewer are bars (Sparkline). */
825
+ const SPARK_LEAST = 4;
776
826
  /**
777
827
  * A spark: the measure's shape inside a KPI card. No axes; the card's own
778
828
  * number is the label. It spans the card's width, stretched rather than
@@ -780,7 +830,11 @@ export function StackedBars({ rows, say = String, label = String, seriesLabel =
780
830
  * corner; the stroke and the last point's dot keep their own size however
781
831
  * far it stretches (`non-scaling-stroke`, and the dot is a round cap on a
782
832
  * zero-length stroke). Under four points there is no shape to read, so
783
- * there is no spark.
833
+ * there is no spark. Four points with fewer than four of them above zero are a
834
+ * line that is flat but for a spike or two, which reads as a fall to nothing
835
+ * and a climb back: those are thin bars (one per period, the empty ones left
836
+ * bare over a baseline), kept to a short width, and an all-zero run draws none.
837
+ * The card's change, said beside the figure, is the trend's news either way.
784
838
  */
785
839
  export function Sparkline({ rows, say = String }) {
786
840
  const points = rows
@@ -795,6 +849,13 @@ export function Sparkline({ rows, say = String }) {
795
849
  const span = max - min || 1;
796
850
  const x = (i) => 1 + (i * (W - 2)) / (points.length - 1);
797
851
  const y = (v) => 3 + (1 - (v - min) / span) * (H - 6);
852
+ const filled = points.filter((p) => p.value !== 0).length;
853
+ if (filled === 0)
854
+ return null;
855
+ if (filled < SPARK_LEAST) {
856
+ const base = y(0);
857
+ return (_jsxs("svg", { className: "spark spark-sparse", viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "none", role: "img", "aria-label": `trend: ${points.map((p) => say(p.value)).join(', ')}`, children: [_jsx("title", { children: `${points[0].key} → ${points[points.length - 1].key}` }), _jsx("path", { className: "spark-base", d: `M1,${f1(base)} H${W - 1}`, vectorEffect: "non-scaling-stroke" }), points.map((p, i) => p.value ? (_jsx("path", { className: "spark-bar", d: `M${f1(x(i))},${f1(base)} V${f1(y(p.value))}`, vectorEffect: "non-scaling-stroke" }, i)) : null)] }));
858
+ }
798
859
  const d = points.map((p, i) => `${i ? 'L' : 'M'}${f1(x(i))},${f1(y(p.value))}`).join(' ');
799
860
  const last = points[points.length - 1];
800
861
  return (_jsxs("svg", { className: "spark", viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "none", role: "img", "aria-label": `trend: ${points.map((p) => say(p.value)).join(', ')}`, children: [_jsx("title", { children: `${points[0].key} → ${last.key}` }), _jsx("path", { className: "spark-area", d: `${d} L${f1(x(points.length - 1))},${H} L${f1(x(0))},${H} Z` }), _jsx("path", { className: "spark-stroke", d: d, vectorEffect: "non-scaling-stroke" }), _jsx("path", { className: "spark-dot", d: `M${f1(x(points.length - 1))},${f1(y(last.value))} h0`, vectorEffect: "non-scaling-stroke" })] }));
@@ -56,8 +56,10 @@ interface ChartFigureProps {
56
56
  arrange?: 'answer' | 'value' | 'category';
57
57
  /** A line with too few filled buckets to draw a line through keeps its shape and stands its points alone. */
58
58
  dots?: boolean;
59
+ /** Stacked bars over periods stand as columns at a fixed height (Chart.tsx), which the room is held at before the answer. */
60
+ timed?: boolean;
59
61
  }
60
- export declare function ChartFigure({ answer, shape, limit, target, height, say, label, seriesLabel, vocabulary, seriesVocabulary, scale, seriesScale, seriesTone, tone, sayLegend, onPick, empty, emptyDetail, emptyAction, curve, total, dots, arrange, }: ChartFigureProps): import("react").JSX.Element;
62
+ export declare function ChartFigure({ answer, shape, limit, target, height, say, label, seriesLabel, vocabulary, seriesVocabulary, scale, seriesScale, seriesTone, tone, sayLegend, onPick, empty, emptyDetail, emptyAction, curve, total, dots, arrange, timed, }: ChartFigureProps): import("react").JSX.Element;
61
63
  interface ChartShapeFigureProps {
62
64
  shape: ExtraShape;
63
65
  answer: Answer | undefined;
@@ -7,14 +7,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  */
8
8
  import { useLayoutEffect, useRef, useState } from 'react';
9
9
  import { viewportBox } from '../core.js';
10
- import { BarChart, DonutChart, LineChart, StackedBars } from './Chart.js';
10
+ import { BarChart, DonutChart, LineChart, StackedBars, TIMED_HEIGHT } from './Chart.js';
11
11
  import { Empty } from './Notes.js';
12
12
  import { orderDeclared } from './groupOrder.js';
13
13
  import { onDemand } from './onDemand.js';
14
14
  /* The shapes drawn by the part on demand: said beside the dashboard's preload (dashboardModel.ts), which asks for it early. */
15
15
  export { EXTRA_SHAPES } from './dashboardModel.js';
16
16
  const ChartShape = onDemand(() => import('./ChartShapes.js'), 'ChartShape');
17
- export function ChartFigure({ answer, shape, limit, target, height, say, label, seriesLabel, vocabulary, seriesVocabulary, scale, seriesScale, seriesTone, tone, sayLegend, onPick, empty, emptyDetail, emptyAction, curve, total, dots, arrange, }) {
17
+ export function ChartFigure({ answer, shape, limit, target, height, say, label, seriesLabel, vocabulary, seriesVocabulary, scale, seriesScale, seriesTone, tone, sayLegend, onPick, empty, emptyDetail, emptyAction, curve, total, dots, arrange, timed, }) {
18
18
  const stacked = shape === 'stacked';
19
19
  const donut = shape === 'donut';
20
20
  const bars = shape === 'bar';
@@ -61,7 +61,7 @@ export function ChartFigure({ answer, shape, limit, target, height, say, label,
61
61
  /* Before the answer, the chart's room at about the height it will draw at, ruled as its gridlines will be: an empty
62
62
  host was nothing tall, and the chart arriving pushed every section under it down. */
63
63
  if (!answer)
64
- return _jsx(ChartWait, { shape: stacked ? 'rows' : donut ? 'donut' : 'plot', height: height, rows: limit });
64
+ return _jsx(ChartWait, { shape: stacked ? (timed ? 'columns' : 'rows') : donut ? 'donut' : 'plot', height: height, rows: limit });
65
65
  return (_jsx("div", { className: "chart-host", ref: host, children: answer &&
66
66
  wide > 0 &&
67
67
  (donut ? (_jsx(DonutChart, { rows: rows, say: say, label: label, onPick: onPick, total: total, ordered: scale, tone: tone })) : bars ? (_jsx(BarChart, { rows: rows, say: say, label: label, wide: wide, high: height, target: target, tone: tone })) : stacked ? (_jsx(StackedBars, { rows: rows, say: say, target: target, limit: limit, label: label, seriesLabel: seriesLabel, onPick: onPick, seriesVocabulary: seriesVocabulary, seriesOrdered: seriesScale, seriesTone: seriesTone, sayLegend: sayLegend })) : (_jsx(LineChart, { rows: rows, say: say, wide: wide, high: height, target: target, smooth: curve === 'smooth', dots: dots, seriesLabel: seriesLabel, seriesVocabulary: seriesVocabulary, onPick: onPick }))) }));
@@ -87,6 +87,9 @@ export function ChartShapeFigure({ answer, empty, emptyDetail, emptyAction, heig
87
87
  return _jsx(ChartWait, { shape: "plot", height: height });
88
88
  return (_jsx("div", { className: "chart-host", ref: host, children: answer && wide > 0 && _jsx(ChartShape, { ...rest, answer: answer, wide: wide, high: height }) }));
89
89
  }
90
+ /** The legend's line (24px) and the gap under it (10px) over stacked columns, as .chart-stacked-legend draws them:
91
+ measured, so the room held while the answer is read is the height of the chart that replaces it. */
92
+ const TIMED_LEGEND = 34;
90
93
  /**
91
94
  * A chart's room while it is read: a plot at the line's own measure (a third of its width, 160px to 240px, or the
92
95
  * section's `height`), a stack at a row a group, a donut at its disc. Quiet gridlines and no sweep: a chart is a
@@ -95,10 +98,13 @@ export function ChartShapeFigure({ answer, empty, emptyDetail, emptyAction, heig
95
98
  function ChartWait({ shape, height, rows }) {
96
99
  const style = shape === 'rows'
97
100
  ? { height: `${Math.min(Math.max(rows ?? 4, 2), 8) * 30 + 32}px` }
98
- : shape === 'donut'
99
- ? { height: '200px' }
100
- : height
101
- ? { height: `${Math.max(120, Math.round(height))}px` }
102
- : undefined;
101
+ : shape === 'columns'
102
+ ? /* The legend's line over the columns' fixed figure (Chart.tsx, StackedBars). */
103
+ { height: `${TIMED_HEIGHT + TIMED_LEGEND}px` }
104
+ : shape === 'donut'
105
+ ? { height: '200px' }
106
+ : height
107
+ ? { height: `${Math.max(120, Math.round(height))}px` }
108
+ : undefined;
103
109
  return _jsx("div", { className: `chart-host chart-wait chart-wait-${shape}`, style: style, role: "status", "aria-busy": "true" });
104
110
  }
@@ -25,7 +25,7 @@ import { currentEntry, paintVersion, renderCrumbs, roomVersion } from '../core.j
25
25
  import { shell } from '../shellMode.js';
26
26
  import { syncHash } from '../url.js';
27
27
  import { appListFor } from './appListModel.js';
28
- import { ASSISTANT_PAGE, INBOX_PAGE, dashPageId, dashViewKey, formViewKey, homeRoom } from './appRooms.js';
28
+ import { ASSISTANT_PAGE, DIRECTORY_PAGE, INBOX_PAGE, dashPageId, dashViewKey, formViewKey, homeRoom } from './appRooms.js';
29
29
  import { onDemand } from './onDemand.js';
30
30
  import { crumbBarShown, Crumbs } from './Crumbs.js';
31
31
  import { LoadErrorNote, NothingGranted, WorkbenchLanding } from './Landing.js';
@@ -164,6 +164,8 @@ function Room({ entry }) {
164
164
  return rooms.Inbox ? _jsx(rooms.Inbox, {}) : null;
165
165
  if (shell().inApp() && page.pageId === ASSISTANT_PAGE)
166
166
  return rooms.Assistant ? _jsx(rooms.Assistant, { conversation: page.tab }) : null;
167
+ if (shell().inApp() && page.pageId === DIRECTORY_PAGE)
168
+ return rooms.Directory ? _jsx(rooms.Directory, {}) : null;
167
169
  return _jsx(PageRoom, { entry: page });
168
170
  }
169
171
  return _jsx(RowRoom, { entry: entry });
@@ -0,0 +1,6 @@
1
+ import type { DashboardDef } from './dashboardModel.js';
2
+ export declare function DashHead({ dashboard, star, }: {
3
+ dashboard: Pick<DashboardDef, 'id' | 'label' | 'heading' | 'headingHidden' | 'head' | 'description' | 'favorite'>;
4
+ /** The landing draws no star: its page is the App's front door, not a place one keeps. */
5
+ star?: boolean;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A dashboard's or a free-form page's head (Rooms.tsx, the App's FreePage and
4
+ * landing): its one h1, its star, its intro — in the form the page asks for.
5
+ *
6
+ * `head: 'compact'` is the title alone on one line with its verbs, at a list's
7
+ * size and with no intro: a working page whose body starts at once. `head:
8
+ * false` is a page that draws its own head; its title is kept for a screen
9
+ * reader, so the room still has the one h1 that names it, while the document
10
+ * title, the crumbs and the palette read the label as they always do.
11
+ */
12
+ import { FavoriteStar } from './FavoriteStar.js';
13
+ export function DashHead({ dashboard, star = true, }) {
14
+ const hidden = dashboard.headingHidden === true || dashboard.head === 'own';
15
+ const title = dashboard.heading ?? dashboard.label;
16
+ const favorite = star && dashboard.favorite && dashboard.head !== 'own' && (_jsx(FavoriteStar, { favorite: { kind: 'view', view: dashboard.id, label: dashboard.label }, name: dashboard.label }));
17
+ if (dashboard.head === 'compact' && !hidden)
18
+ return (_jsxs("div", { className: "applist-head applist-head-row dash-head-compact", children: [_jsx("h1", { className: "applist-title", children: title }), favorite] }));
19
+ return (_jsxs("div", { className: "applist-head dash-head", children: [_jsx("h1", { className: `applist-title${hidden ? ' visually-hidden' : ''}`, children: title }), favorite, dashboard.description && dashboard.head !== 'own' && _jsx("p", { className: "note dash-description", children: dashboard.description })] }));
20
+ }
@@ -220,7 +220,7 @@ export function Editable({ table, row, column, recordKey, onSaved, app = false,
220
220
  and stage it back over the value. JSON is read here, never edited. */
221
221
  const json = jsonValueOf(column, value);
222
222
  if (json)
223
- return _jsx(JsonView, { value: json.value });
223
+ return _jsx(JsonView, { value: json.value, label: column.name });
224
224
  const onEdit = (next) => {
225
225
  if (applying || column.writable === false || column.changesBy === 'actions' || !editorCurrent(isCurrent))
226
226
  return;
@@ -82,13 +82,17 @@ export function ExportControl({ entry, data }) {
82
82
  setOpen(false);
83
83
  // `selected` rather than what came back, so the file follows the declared order.
84
84
  saveExport(kind, data.table, selected, kind === 'csv' ? sheetAmounts(data.table, selected, rows) : rows);
85
+ /* Not streamed (a support visit): the one bounded read held whole, and the file says where it stopped. */
86
+ if (all && total > EXPORT_MAX_ROWS)
87
+ toast(say('stoppedAtTheCap', { max: formatNumber(EXPORT_MAX_ROWS) }));
85
88
  };
86
89
  /* JSON and the agent hand-off are Workbench tools; an App's list offers the columns and the CSV. */
87
90
  const workbench = !shell().inApp();
88
91
  const kinds = workbench ? ['csv', 'json'] : ['csv'];
89
92
  const pageLabel = say('thisPageRows', { count: pageRows.length });
90
- const allLabel = say('allMatchingRows', { capped: formatNumber(capped) });
91
- return (_jsxs(_Fragment, { children: [_jsxs(DropMenu, { className: "export", triggerClassName: "export-summary", triggerTitle: say('downloadThisResult'), label: _jsxs(_Fragment, { children: [_jsx("span", { className: "export-word", children: say('export') }), _jsx("span", { className: "export-more", "aria-hidden": "true", children: "\u22EF" })] }), popupClassName: "export-menu", open: open, onOpenChange: setOpen, children: [_jsx("div", { className: "export-group", children: _jsxs(DropItem, { className: "export-item export-columns-item", onClick: () => setChoosing(true), children: [_jsx("span", { children: say('chooseColumns') }), _jsx("span", { className: "export-count", children: declared.length ? say('selectedOfDeclared', { selected: selected.length, declared: declared.length }) : `${selected.length}` })] }) }), kinds.map((kind) => (_jsxs("div", { className: "export-group", children: [_jsx("span", { className: "export-kind", children: kind.toUpperCase() }), _jsx(DropItem, { className: "export-item", disabled: busy === `${kind}:false`, closeOnClick: false, onClick: () => void deliver(kind, false), children: busy === `${kind}:false` ? say('fetching') : pageLabel }), total > pageRows.length && (_jsx(DropItem, { className: "export-item", disabled: busy === `${kind}:true`, closeOnClick: false, onClick: () => void deliver(kind, true), children: busy === `${kind}:true` ? say('fetching') : allLabel }))] }, kind))), workbench && (_jsxs("div", { className: "export-group", children: [_jsx("span", { className: "export-kind", children: say('agent') }), _jsx(DropItem, { className: "export-item", title: say('theQueryTheShape'), onClick: () => void copyPosition(positionOf(state, entry, { columns: displayed, shown: pageRows.length, total }), toast), children: say('copyThisPosition') })] })), total > EXPORT_MAX_ROWS && (_jsx("p", { className: "export-note", children: say('cappedAtRowsTheSame', { max: formatNumber(EXPORT_MAX_ROWS) }) }))] }), choosing && (_jsx(ColumnChooser, { tableId: data.table, displayed: displayed, declared: declared, selected: selected, onClose: () => setChoosing(false), onDone: (picked) => {
93
+ /* Every row: the server streams the file with no ceiling (exportRoute.ts); only its fallback stops at the cap. */
94
+ const allLabel = say('allMatchingRows', { count: formatNumber(total) });
95
+ return (_jsxs(_Fragment, { children: [_jsxs(DropMenu, { className: "export", triggerClassName: "export-summary", triggerTitle: say('downloadThisResult'), label: _jsxs(_Fragment, { children: [_jsx("span", { className: "export-word", children: say('export') }), _jsx("span", { className: "export-more", "aria-hidden": "true", children: "\u22EF" })] }), popupClassName: "export-menu", open: open, onOpenChange: setOpen, children: [_jsx("div", { className: "export-group", children: _jsxs(DropItem, { className: "export-item export-columns-item", onClick: () => setChoosing(true), children: [_jsx("span", { children: say('chooseColumns') }), _jsx("span", { className: "export-count", children: declared.length ? say('selectedOfDeclared', { selected: selected.length, declared: declared.length }) : `${selected.length}` })] }) }), kinds.map((kind) => (_jsxs("div", { className: "export-group", children: [_jsx("span", { className: "export-kind", children: kind.toUpperCase() }), _jsx(DropItem, { className: "export-item", disabled: busy === `${kind}:false`, closeOnClick: false, onClick: () => void deliver(kind, false), children: busy === `${kind}:false` ? say('fetching') : pageLabel }), total > pageRows.length && (_jsx(DropItem, { className: "export-item", disabled: busy === `${kind}:true`, closeOnClick: false, onClick: () => void deliver(kind, true), children: busy === `${kind}:true` ? say('fetching') : allLabel }))] }, kind))), workbench && (_jsxs("div", { className: "export-group", children: [_jsx("span", { className: "export-kind", children: say('agent') }), _jsx(DropItem, { className: "export-item", title: say('theQueryTheShape'), onClick: () => void copyPosition(positionOf(state, entry, { columns: displayed, shown: pageRows.length, total }), toast), children: say('copyThisPosition') })] })), total > EXPORT_MAX_ROWS && _jsx("p", { className: "export-note", children: say('streamedPastTheCap') })] }), choosing && (_jsx(ColumnChooser, { tableId: data.table, displayed: displayed, declared: declared, selected: selected, onClose: () => setChoosing(false), onDone: (picked) => {
92
96
  rememberColumns(data.table, picked);
93
97
  tick((n) => n + 1);
94
98
  } }))] }));
@@ -130,8 +134,8 @@ function ColumnChooser({ tableId, displayed, declared, selected, onClose, onDone
130
134
  }
131
135
  /**
132
136
  * A CSV says money as the figure a sheet reads, as the server's streamed file
133
- * does (exportRoute.ts csvAmounts), and here where it cannot stream — a tenant
134
- * lease, a row policy, this page: a column kept in minor units, 1999, is
137
+ * does (appExport.ts csvAmounts), and here where it does not stream — a
138
+ * support visit, this page: a column kept in minor units, 1999, is
135
139
  * written 19.99 in its row's own currency.
136
140
  */
137
141
  function sheetAmounts(tableId, columns, rows) {