@mistriwork/kit 1.0.0-rc.37 → 1.0.0-rc.39

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.
@@ -24,6 +24,9 @@ const tickSay = (say) => say.tick ?? say;
24
24
  const f1 = (n) => n.toFixed(1);
25
25
  const MONTH = /^(\d{4})-(\d{2})$/;
26
26
  const DAY = /^(\d{4})-\d{2}-\d{2}$/;
27
+ /** A category's key as a chart says it unless told otherwise: a bucket of no value is a dash, never "null". The
28
+ caller's `label` (a column's groupLabel) says it in the field's own `empty` word where it has one. */
29
+ const keyWord = (key) => (key == null ? '—' : String(key));
27
30
  /**
28
31
  * A month bucket as a reader says it, in the App's locale: "Jan 2026" where
29
32
  * the year starts or changes from the tick before it, "Feb" after it. The
@@ -442,7 +445,7 @@ const PERIOD = /^\d{4}(-\d{2}(-\d{2})?|-Q[1-4])?$/;
442
445
  * The levels are on the left, in a gutter of their own, and every bar is a
443
446
  * row of a table assistive technology reads, as a line's points are.
444
447
  */
445
- export function BarChart({ rows, say = String, label = String, wide = 600, high, target, tone, partial, }) {
448
+ export function BarChart({ rows, say = String, label = keyWord, wide = 600, high, target, tone, partial, }) {
446
449
  const periods = rows.length > 0 && rows.every((r) => r.key != null && PERIOD.test(String(r.key)));
447
450
  const bars = periods
448
451
  ? fillGaps(rows.map((r) => ({ key: String(r.key), value: Number(r.value) })).filter((p) => Number.isFinite(p.value))).map((p) => ({ raw: p.key, value: p.value }))
@@ -661,12 +664,12 @@ export function sliceRing(center, radius, from, length, width = 7) {
661
664
  * A donut with its legend: how the whole divides, said twice — arc length
662
665
  * and a labelled figure. Past six slices the tail is gathered into "others".
663
666
  */
664
- export function DonutChart({ rows, say = String, label = String, onPick, total, ordered, tone, }) {
667
+ export function DonutChart({ rows, say = String, label = keyWord, onPick, total, ordered, tone, }) {
665
668
  /* The slice's stroke as the look draws it (.chart-slice: 7 units, 4.5 in Lumen's line charts), read as a slice takes
666
669
  the keyboard, the moment its ring is drawn: a look is picked while the page is open, and a stylesheet says it. */
667
670
  const [sliceWidth, setSliceWidth] = useState(7);
668
671
  const all = rows
669
- .map((r) => ({ key: r.key == null ? '—' : label(r.key), raw: r.key, value: Number(r.value) }))
672
+ .map((r) => ({ key: label(r.key), raw: r.key, value: Number(r.value) }))
670
673
  .filter((p) => Number.isFinite(p.value) && p.value > 0);
671
674
  if (!all.length)
672
675
  return _jsx("p", { className: "note", children: sayCopy('nothingToDivide') });
@@ -745,7 +748,7 @@ export const TIMED_HEIGHT = 180;
745
748
  * and past seven series the tail is gathered into "others", the eighth
746
749
  * token. A target is a rule across every track and a word in the legend.
747
750
  */
748
- export function StackedBars({ rows, say = String, label = String, seriesLabel = String, target, limit = 10, onPick, seriesVocabulary, seriesOrdered, seriesTone, sayLegend, }) {
751
+ export function StackedBars({ rows, say = String, label = keyWord, seriesLabel = String, target, limit = 10, onPick, seriesVocabulary, seriesOrdered, seriesTone, sayLegend, }) {
749
752
  const MAX_SERIES = 7;
750
753
  const name = (v) => (v == null ? '—' : String(v));
751
754
  const bars = new Map();
@@ -212,5 +212,5 @@ export function MultiStepForm({ steps, children, step, initialStep = 0, onStepCh
212
212
  busyLabel: last ? say('common.saving') : say('common.checking'),
213
213
  } })] }));
214
214
  }
215
- return (_jsxs("section", { ref: root, className: `multi-step-form ${className}`.trim(), ...(intake ? { 'data-style': 'intake' } : {}), "aria-labelledby": titleId, children: [aside, intake ? (_jsxs(_Fragment, { children: [note, _jsxs("div", { className: "intake-head", children: [progressRow, _jsx(StepHeader, { level: 2, id: titleId, title: heading, ...(active.lead ? { lead: active.lead } : {}) })] })] })) : (_jsxs("div", { className: "multi-step-heading", children: [progressRow, _jsx("h2", { id: titleId, children: active.label })] })), panelNode, problemNode, hostSaid, _jsxs("div", { className: "multi-step-actions form-actions", children: [leading, current > 0 && (_jsx(Button, { intent: "quiet", className: "multi-step-back", disabled: pending, onClick: () => void move('previous'), children: previousLabel })), last ? (_jsx(Button, { intent: "primary", busy: pending, busyLabel: say('common.saving'), onClick: () => void complete(), children: primaryWords })) : (_jsx(Button, { intent: "primary", busy: pending, busyLabel: say('common.checking'), onClick: () => void move('next'), children: primaryWords }))] })] }));
215
+ return (_jsxs("section", { ref: root, className: `multi-step-form ${className}`.trim(), ...(intake ? { 'data-style': 'intake' } : {}), "aria-labelledby": titleId, children: [aside, intake ? (_jsxs(_Fragment, { children: [note, _jsxs("div", { className: "intake-head", children: [progressRow, _jsx(StepHeader, { level: 2, id: titleId, title: heading, ...(active.lead ? { lead: active.lead } : {}) })] })] })) : (_jsxs("div", { className: "multi-step-heading", children: [progressRow, _jsx("h2", { id: titleId, children: heading }), active.lead && _jsx("p", { className: "multi-step-lead", children: active.lead })] })), panelNode, problemNode, hostSaid, _jsxs("div", { className: "multi-step-actions form-actions", children: [leading, current > 0 && (_jsx(Button, { intent: "quiet", className: "multi-step-back", disabled: pending, onClick: () => void move('previous'), children: previousLabel })), last ? (_jsx(Button, { intent: "primary", busy: pending, busyLabel: say('common.saving'), onClick: () => void complete(), children: primaryWords })) : (_jsx(Button, { intent: "primary", busy: pending, busyLabel: say('common.checking'), onClick: () => void move('next'), children: primaryWords }))] })] }));
216
216
  }
@@ -5,6 +5,15 @@ interface RunItem {
5
5
  section: PageSection;
6
6
  index: number;
7
7
  }
8
+ /** What a list is, for deciding: waiting to know, with rows (or broken, which it says itself), or empty. */
9
+ export type Standing = 'wait' | 'rows' | 'empty' | 'gone';
10
+ /**
11
+ * Where each list of a run stands: asked the question the list asks itself (the same query, so the answer is shared),
12
+ * and its `when` asked of the record. The run's items and their standing, by position.
13
+ */
14
+ export declare function useStandings(items: RunItem[], plans: SectionPlan[], base: TableMeta, recordKey: Record<string, unknown>,
15
+ /** The lists whose rows are asked for: a strip of tabs fetches each when opened, so it asks only for the ones it must decide on. */
16
+ decide?: (item: RunItem) => boolean): Standing[];
8
17
  export declare function EmptyRun({ items, plans, base, recordKey, draw, rescue, }: {
9
18
  items: RunItem[];
10
19
  plans: SectionPlan[];
@@ -11,7 +11,9 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
11
11
  * - a tab keeps at least one list: where a tab holds nothing but lists and they are all empty, they are said in a
12
12
  * line rather than leaving the tab blank.
13
13
  *
14
- * Inside a `listTabs` strip an empty list is neither hidden nor collapsed: its tab shows it (PageSections.tsx).
14
+ * Inside a `listTabs` strip a list is a tab, and the tab follows the same answers (`useStandings`): a list whose `when` is
15
+ * not met has no tab, and an empty one that hides has none unless the reader may add to it. One that collapses keeps its
16
+ * tab, which says the list is empty (PageSections.tsx).
15
17
  */
16
18
  import { shellRoot } from '../shellHost.js';
17
19
  import { useContext } from 'react';
@@ -32,8 +34,13 @@ function said(names) {
32
34
  return names.join(', ');
33
35
  }
34
36
  }
35
- export function EmptyRun({ items, plans, base, recordKey, draw, rescue, }) {
36
- useMessageLanguage();
37
+ /**
38
+ * Where each list of a run stands: asked the question the list asks itself (the same query, so the answer is shared),
39
+ * and its `when` asked of the record. The run's items and their standing, by position.
40
+ */
41
+ export function useStandings(items, plans, base, recordKey,
42
+ /** The lists whose rows are asked for: a strip of tabs fetches each when opened, so it asks only for the ones it must decide on. */
43
+ decide = () => true) {
37
44
  const api = usePageApi();
38
45
  const context = useContext(PageRenderContext);
39
46
  const planOf = (item) => plans.find((p) => p.index === item.index) ?? { index: item.index };
@@ -48,14 +55,14 @@ export function EmptyRun({ items, plans, base, recordKey, draw, rescue, }) {
48
55
  return {
49
56
  queryKey: ['page-list', 'groups', groups, 0],
50
57
  queryFn: () => api('/api/breakdown', groupsBody(groups, 0)),
51
- enabled: !plan.empty && !plan.error,
58
+ enabled: !plan.empty && !plan.error && decide(item),
52
59
  staleTime: 0,
53
60
  };
54
61
  }
55
62
  return {
56
63
  queryKey: ['page-list', view, 0],
57
64
  queryFn: () => api('/api/view/run', { view: view, offset: 0 }),
58
- enabled: !plan.empty && !plan.error && Boolean(view),
65
+ enabled: !plan.empty && !plan.error && Boolean(view) && decide(item),
59
66
  staleTime: 0,
60
67
  };
61
68
  }),
@@ -68,12 +75,12 @@ export function EmptyRun({ items, plans, base, recordKey, draw, rescue, }) {
68
75
  staleTime: 0,
69
76
  })),
70
77
  });
71
- const standing = (i) => {
78
+ return items.map((_, i) => {
72
79
  const { section } = items[i];
73
80
  const plan = planOf(items[i]);
74
81
  if (section.when && gates[i].data !== true)
75
82
  return gates[i].isPending ? 'wait' : 'gone';
76
- if (plan.error)
83
+ if (plan.error || !decide(items[i]))
77
84
  return 'rows';
78
85
  if (plan.empty)
79
86
  return 'empty';
@@ -86,8 +93,12 @@ export function EmptyRun({ items, plans, base, recordKey, draw, rescue, }) {
86
93
  if (grouped)
87
94
  return got && !('errors' in got) && got.rows.length === 0 ? 'empty' : 'rows';
88
95
  return got && 'view' in got && got.rows.length === 0 ? 'empty' : 'rows';
89
- };
90
- const states = items.map((_, i) => standing(i));
96
+ });
97
+ }
98
+ export function EmptyRun({ items, plans, base, recordKey, draw, rescue, }) {
99
+ useMessageLanguage();
100
+ const context = useContext(PageRenderContext);
101
+ const states = useStandings(items, plans, base, recordKey);
91
102
  /* Nothing here is drawn as a list: the run is all that stands in its tab, so it may not vanish. */
92
103
  const nothingElse = rescue && states.every((state) => state === 'empty' || state === 'gone') && states.includes('empty');
93
104
  const door = (item) => relatedDoor(item.section, base, recordKey, { preview: context.preview, actions: context.actions }).door;
@@ -9,7 +9,7 @@ import { PresentationSwitch } from './PresentationSwitch.js';
9
9
  import { useContext, useMemo, useRef, useState } from 'react';
10
10
  import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';
11
11
  import { ownedBy } from '../requestIdentity.js';
12
- import { columnLabel, recordLabel, api as coreApi, findTable, openRecord, rowLabel, state, writeAllowed } from '../core.js';
12
+ import { columnDisplay, columnLabel, recordLabel, api as coreApi, findTable, openRecord, rowLabel, state, writeAllowed } from '../core.js';
13
13
  import { relatedRows } from '../prefs.js';
14
14
  import { formatBytes, formatNumber, formatRelativeDay } from '../locale.js';
15
15
  import { columnKind, linkTarget } from '@mistriwork/engine/shared/schema.js';
@@ -34,6 +34,7 @@ import { pluralOf, recordNoun } from '@mistriwork/engine/shared/appNoun.js';
34
34
  import { canInsert, openRelatedRecord } from '../insert.js';
35
35
  import { formShownFields } from '@mistriwork/engine/shared/form.js';
36
36
  import { pinnedBy, sectionClass } from './pageModel.js';
37
+ import { groupLabel } from './valueModel.js';
37
38
  import { CurrentCard } from './PageCurrent.js';
38
39
  import { PageRenderContext, recordReadNames, spoken, usePageApi } from './pageContext.js';
39
40
  import { Loading, SectionBox } from './PageSectionBox.js';
@@ -557,6 +558,15 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
557
558
  return error.message;
558
559
  }
559
560
  };
561
+ /* A column of a file's row said as the resource dresses it — `display.values`, a vocabulary's words — for a second line
562
+ or a caption, undefined where the rule has no word for it (a date or a size has its own reading). */
563
+ const worded = (column, value) => {
564
+ if (!table)
565
+ return undefined;
566
+ const text = String(value);
567
+ const said = groupLabel(columnDisplay(table.id, column), value, table.columns.find((candidate) => candidate.name === column)?.allowed);
568
+ return said === text ? undefined : said;
569
+ };
560
570
  const lease = filesOnLease();
561
571
  const attachments = file && table
562
572
  ? rows.flatMap((row) => {
@@ -570,7 +580,9 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
570
580
  !hidden.includes(column) &&
571
581
  row[column] != null &&
572
582
  row[column] !== '')
573
- .map((column) => column === file.size ? formatBytes(Number(row[column])) : (formatRelativeDay(String(row[column])) ?? String(row[column])));
583
+ .map((column) => column === file.size
584
+ ? formatBytes(Number(row[column]))
585
+ : (worded(column, row[column]) ?? formatRelativeDay(String(row[column])) ?? String(row[column])));
574
586
  const href = served(`/api/file?${new URLSearchParams({ ...ownedBy(owner), table: table.id, key: JSON.stringify(rowKey) })}`);
575
587
  const type = file.type && typeof row[file.type] === 'string' ? row[file.type] : undefined;
576
588
  return [
@@ -614,7 +626,7 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
614
626
  row[column] != null &&
615
627
  row[column] !== '' &&
616
628
  captions(column))
617
- .map((column) => String(row[column]));
629
+ .map((column) => worded(column, row[column]) ?? String(row[column]));
618
630
  const alt = words[0] ?? String(row[file.name] ?? '');
619
631
  return [
620
632
  {
@@ -20,8 +20,8 @@ import { FieldsSection } from './PageFields.js';
20
20
  import { BreakdownSection, ChartSection, MetricSection } from './PageMetrics.js';
21
21
  import { DashboardNote } from './DashboardNote.js';
22
22
  import { TimelineSection } from './PageTimeline.js';
23
- import { ListSection, RelatedCount, useRelatedCounts } from './PageRelated.js';
24
- import { EmptyRun } from './PageEmptyRun.js';
23
+ import { ListSection, RelatedCount, relatedDoor, useRelatedCounts } from './PageRelated.js';
24
+ import { EmptyRun, useStandings } from './PageEmptyRun.js';
25
25
  import { useMessageLanguage } from './useMessageLanguage.js';
26
26
  import { useTabFold } from './useTabFold.js';
27
27
  import { DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';
@@ -208,8 +208,24 @@ export function TabStrip({ tabs, name, entry, onTab, draw, scoped, eager = [], c
208
208
  }, children: tab.label }, tab.key))) }), _jsx("div", { className: "page-tab-more", "data-fold-more": "", "data-folded": folded.size ? undefined : '', "aria-hidden": !folded.size || undefined, children: _jsx(DropMenu, { className: "page-tab-more-menu", triggerClassName: "page-tab", label: message('common.more'), popupClassName: "page-actions-popup", align: "end", children: tabs.map((tab, i) => folded.has(i) ? (_jsx(DropItem, { className: "page-actions-item", onClick: () => show(i), children: tab.label }, tab.key)) : null) }) })] }), _jsx("div", { className: "page-tabpanels", children: tabs.map((tab, i) => (_jsx("div", { className: "page-tabpanel", role: "tabpanel", id: `${id}-tabpanel-${i}`, "aria-labelledby": `${id}-tab-${i}`, tabIndex: i === active ? 0 : -1, hidden: i !== active, inert: i !== active, "aria-hidden": i !== active, children: drawn.has(i) ? draw(i) : null }, tab.key))) })] }));
209
209
  }
210
210
  /** A run of lists as tabs: the names across the top, one table under them, fetched when opened. */
211
- function ListTabs({ items, entry, onTab, draw, scoped, counting, pages, }) {
211
+ function ListTabs({ items: run, plans, base, recordKey, entry, onTab, draw, scoped, counting, pages, }) {
212
212
  useMessageLanguage();
213
+ const context = useContext(PageRenderContext);
214
+ /* A list stands in a strip as it stands outside one: its `when` unmet leaves it no tab, and one that hides while empty
215
+ has none until it has rows, unless the reader may add to it (a door is never taken away). A list the page is still
216
+ asking about is left out until it is known, so a tab arrives rather than goes. */
217
+ const hiding = (item) => item.section.kind === 'list' && item.section.emptyMode === 'hide';
218
+ const standing = useStandings(run, plans, base, recordKey, hiding);
219
+ const items = run.filter((item, i) => {
220
+ const hides = hiding(item);
221
+ if (standing[i] === 'gone')
222
+ return false;
223
+ if (standing[i] === 'wait')
224
+ return !item.section.when && !hides;
225
+ if (standing[i] === 'empty' && hides)
226
+ return Boolean(relatedDoor(item.section, base, recordKey, { preview: context.preview, actions: context.actions }).door);
227
+ return true;
228
+ });
213
229
  /* The token is the source's words (apps.ts keepAddresses), so an address names one tab in every language. */
214
230
  const named = (item) => item.section.kind === 'history'
215
231
  ? HISTORY_TAB
@@ -230,6 +246,8 @@ function ListTabs({ items, entry, onTab, draw, scoped, counting, pages, }) {
230
246
  label: (_jsxs(_Fragment, { children: [word(item), counted(item)] })),
231
247
  }));
232
248
  const strip = withPageTabs(tabs, (i) => draw(items[i]), pages);
249
+ if (!strip.tabs.length)
250
+ return null;
233
251
  return _jsx(TabStrip, { tabs: strip.tabs, name: "Related lists", entry: entry, onTab: onTab, draw: strip.draw, scoped: scoped });
234
252
  }
235
253
  /** The record's sections as tabs: a panel is sections again, laid out as the page lays them out. */
@@ -312,8 +330,8 @@ export function Sections({ page, base, recordKey: key, plans, entry, onLabel, on
312
330
  place on the page, and a tab strip spans it whole. The Workbench's
313
331
  builder gives every list it adds a width, so there a width is not a
314
332
  placement anyone chose, and its lists keep the strip. */
315
- /* A list that says what it does while empty (`empty: 'hide' | 'collapse'`) is a tab like any other: inside a strip
316
- an empty list is neither hidden nor collapsed, its tab shows it and the strip already folds it. */
333
+ /* A list that says what it does while empty (`empty: 'hide' | 'collapse'`) is a tab like any other. The strip then
334
+ follows the list's own answers (ListTabs): `hide` leaves no tab while it has no rows, `collapse` keeps the tab. */
317
335
  const tabbed = (section) => tabbedSection(section, inAppPage(), inferred);
318
336
  /* Outside a strip, such a list is left out or said in one line with its neighbours (PageEmptyRun.tsx). */
319
337
  const emptyable = (section) => section.kind === 'list' && Boolean(section.emptyMode) && (section.presentation !== 'card' || section.emptyMode === 'hide');
@@ -348,7 +366,7 @@ export function Sections({ page, base, recordKey: key, plans, entry, onLabel, on
348
366
  if (listTabs && autoTabs && listRuns.has(i) && (listRuns.get(i) ?? 0) >= (pageTabs.length ? 1 : 2)) {
349
367
  if (!strip) {
350
368
  strip = [];
351
- laid.push(_jsx(ListTabs, { items: strip, entry: entry, onTab: onTab, draw: draw, scoped: scoped, counting: inferred ? { base, recordKey: key } : undefined, pages: grouped ? undefined : takePageTabs() }, `tabs-${i}`));
369
+ laid.push(_jsx(ListTabs, { items: strip, plans: plans, base: base, recordKey: key, entry: entry, onTab: onTab, draw: draw, scoped: scoped, counting: inferred ? { base, recordKey: key } : undefined, pages: grouped ? undefined : takePageTabs() }, `tabs-${i}`));
352
370
  }
353
371
  strip.push(item);
354
372
  leave = null;
@@ -276,11 +276,11 @@ export function Sidebar({ host, footerHost: suppliedFooterHost, onSelect, tabNav
276
276
  function TableRow({ item, index, current, active, rail, quiet, title, onSelect, tabNavigation = false, }) {
277
277
  const row = useRef(null);
278
278
  const snapshot = rowCount(item, undefined);
279
- /* Named by its label alone and the count said as its description: named
280
- with the number, a row was "Website 1", which a screen reader reads as
281
- its name and a test or a voice command has to guess at. */
279
+ /* Named by its label and then its count, in the order they are drawn: the name holds the words the row shows
280
+ ("Website 1"), as WCAG 2.5.3 asks, so a voice command that reads the screen finds it. The label alone, with
281
+ the count said as a description, was "Website" under a row that reads "Website 1". */
282
282
  const labelId = useId(), countId = useId();
283
- return (_jsxs("button", { ref: row, type: "button", "data-table": item.table, "data-navq": item.navq, "data-table-index": index, tabIndex: tabNavigation ? 0 : -1, "aria-current": current ? 'true' : 'false', "aria-labelledby": labelId, "aria-describedby": countId, className: active ? 'active' : undefined, title: title, onClick: item.entry
283
+ return (_jsxs("button", { ref: row, type: "button", "data-table": item.table, "data-navq": item.navq, "data-table-index": index, tabIndex: tabNavigation ? 0 : -1, "aria-current": current ? 'true' : 'false', "aria-labelledby": `${labelId} ${countId}`, className: active ? 'active' : undefined, title: title, onClick: item.entry
284
284
  ? /* A list opens on its first tab — the app decided what matters
285
285
  most — not on the bare unfiltered table. */
286
286
  () => {
@@ -292,7 +292,7 @@ function TableRow({ item, index, current, active, rail, quiet, title, onSelect,
292
292
  () => {
293
293
  go(tableView(item.table, undefined, stickyTab()), 'reset');
294
294
  onSelect?.();
295
- }, children: [_jsx(NavGlyph, { icon: item.icon, label: item.label, railed: rail, color: item.navColor }), _jsx("span", { className: "nav-label", id: labelId, children: item.label }), item.tag === 'view' ? (_jsx("span", { className: "view-tag", id: countId, children: say('view') })) : item.counted ? (_jsx(LiveCount, { item: item, spec: item.counted, row: row, quiet: quiet, id: countId })) : snapshot != null ? (_jsx("span", { className: "rows", id: countId, children: snapshot })) : null] }));
295
+ }, children: [_jsx(NavGlyph, { icon: item.icon, label: item.label, railed: rail, color: item.navColor }), _jsx("span", { className: "nav-label", id: labelId, children: item.label }), ' ', item.tag === 'view' ? (_jsx("span", { className: "view-tag", id: countId, children: say('view') })) : item.counted ? (_jsx(LiveCount, { item: item, spec: item.counted, row: row, quiet: quiet, id: countId })) : snapshot != null ? (_jsx("span", { className: "rows", id: countId, children: snapshot })) : null] }));
296
296
  }
297
297
  /** Its own component, so only a counted row holds a query. */
298
298
  function LiveCount({ item, spec, row, quiet, id, }) {
@@ -114,6 +114,8 @@ export interface Section {
114
114
  /** find: the tables its box searches (DashboardFind.tsx), and the box's words before anything is typed. */
115
115
  searched?: string[];
116
116
  placeholder?: string;
117
+ /** integrations: the ones the settings form shows, in this order (IntegrationsForm.tsx); every one without it. */
118
+ integrations?: string[];
117
119
  }
118
120
  /** The chart shapes a part on demand draws (ChartShapes.tsx), so a dashboard of lines and bars never fetches it. */
119
121
  export declare const EXTRA_SHAPES: readonly string[];
@@ -132,6 +132,8 @@ export declare function ruleSays(rule: DisplayRule | null | undefined, value: un
132
132
  /** Vocabulary captions only: identifiers and arbitrary grouped text stay exact.
133
133
  * A toned value is a word everywhere; a value of the column's own vocabulary
134
134
  * (`allowed`) is a word in an App, where the Workbench shows the data.
135
+ * A group of no value is the field's missing value, said in the field's own
136
+ * `empty` word where it has one, as its cell says it, and a dash where not.
135
137
  * Callers keep the raw key for navigation and aggregation. */
136
138
  export declare function groupLabel(rule: DisplayRule | null | undefined, value: unknown, allowed?: readonly string[]): string;
137
139
  export { subtitlePath, leadTonePath };
@@ -94,10 +94,12 @@ export function ruleSays(rule, value) {
94
94
  /** Vocabulary captions only: identifiers and arbitrary grouped text stay exact.
95
95
  * A toned value is a word everywhere; a value of the column's own vocabulary
96
96
  * (`allowed`) is a word in an App, where the Workbench shows the data.
97
+ * A group of no value is the field's missing value, said in the field's own
98
+ * `empty` word where it has one, as its cell says it, and a dash where not.
97
99
  * Callers keep the raw key for navigation and aggregation. */
98
100
  export function groupLabel(rule, value, allowed) {
99
101
  if (value == null)
100
- return '—';
102
+ return rule?.empty ?? '—';
101
103
  const text = String(value);
102
104
  const vocabulary = allowed?.includes(text) && typeof document !== 'undefined' && shellBody()?.classList.contains('app-mode');
103
105
  return wordFor(rule, text) ?? (rule?.tone || vocabulary ? vocabularyWord(text) : text);
@@ -2166,6 +2166,10 @@ body.app-mode th .pk { display: none; }
2166
2166
  /* The stepper's step: the bar, then its name set tight, the step's one strong thing. */
2167
2167
  .multi-step-heading { display: grid; gap: var(--space-5); }
2168
2168
  .multi-step-heading h2 { margin: 0; font-size: 1.25rem; line-height: 1.15; letter-spacing: var(--track-display); text-wrap: balance; }
2169
+ .multi-step-heading .multi-step-lead { margin: calc(var(--space-2) - var(--space-5)) 0 0; max-width: 60ch; font-size: var(--text-md); line-height: 1.5; color: var(--ink-muted); text-wrap: pretty; }
2170
+ /* A row of two fields (`show: [['a', 'b']]`) in a stepper is spaced as the fields around it are: forms.css gave it a
2171
+ 16px gap both ways, so the pair stood closer than the stack above and below it. */
2172
+ .multi-step-form:not([data-style='intake']) .form-columns { column-gap: var(--space-4); row-gap: var(--field-gap); }
2169
2173
 
2170
2174
  /* A page's steps beside the form (MultiStepForm.tsx): drawn always, shown only where the page is wide enough for both
2171
2175
  (structure.css lays the column out), so a page's first frame is the same at any width. Their dress is here. */
@@ -1,5 +1,13 @@
1
1
  /** Whether files here travel on a tenant lease rather than by address. */
2
2
  export declare const filesOnLease: () => boolean;
3
+ /**
4
+ * A picture's address on the lease as it stands, for a caller that answers
5
+ * while it draws (a free-form page's `useFile`): the blob's address once it
6
+ * has been read, else undefined, with the read started and `drawn` called
7
+ * when it lands so the caller draws again. A picture that cannot be read
8
+ * stays undefined and never calls `drawn`, so a failure is not a loop.
9
+ */
10
+ export declare function pictureOnLeaseNow(table: string, key: Record<string, unknown>, variant: 'thumb' | undefined, drawn: () => void): string | undefined;
3
11
  /**
4
12
  * A picture's address, to draw in place: the file route's inline mode, or on
5
13
  * a lease the blob it was read into — undefined until it has been, and when
@@ -9,7 +9,10 @@
9
9
  * lease as base64 (`/api/file/read`), made a blob here, and drawn or saved
10
10
  * from the blob's own address, which no other page and no other tenant can
11
11
  * open. A picture read once is kept for the page's life, a few hundred at
12
- * most, so a list that scrolls back does not read it again.
12
+ * most, so a list that scrolls back does not read it again. A free-form
13
+ * page's `useFile` draws from the same blobs (pictureOnLeaseNow): a signed
14
+ * address an `<img>` could fetch would be a second way into a tenant's files,
15
+ * one that outlives the lease and travels with a copied link.
13
16
  */
14
17
  import { useEffect, useState } from 'react';
15
18
  import { api } from './core.js';
@@ -52,7 +55,7 @@ async function fileOnLease(table, key, options = {}) {
52
55
  const type = typeof reply.type === 'string' && /^image\/(png|jpeg|gif|webp|avif|bmp)$/.test(reply.type) ? reply.type : 'application/octet-stream';
53
56
  return { blob: new Blob([bytesOf(reply.data)], { type }), name: reply.name };
54
57
  }
55
- /* Pictures read on the lease, by what they were read as; the oldest is let go past the most kept. */
58
+ /* Pictures read on the lease, by what they were read as, with the address once it is known; the oldest is let go past the most kept. */
56
59
  const KEPT = 300;
57
60
  const pictures = new Map();
58
61
  /* The lease a picture was read on: another account or tenant reads its own. */
@@ -61,7 +64,7 @@ function pictureOnLease(table, key, variant) {
61
64
  const identity = captureSessionIdentity();
62
65
  if (keptFor !== identity) {
63
66
  for (const kept of pictures.values())
64
- void kept.then(URL.revokeObjectURL, () => { });
67
+ void kept.read.then(URL.revokeObjectURL, () => { });
65
68
  pictures.clear();
66
69
  keptFor = identity;
67
70
  }
@@ -69,15 +72,34 @@ function pictureOnLease(table, key, variant) {
69
72
  const kept = pictures.get(name);
70
73
  if (kept)
71
74
  return kept;
72
- const read = fileOnLease(table, key, { inline: true, ...(variant ? { variant } : {}) }).then(({ blob }) => URL.createObjectURL(blob));
73
- read.catch(() => pictures.delete(name));
74
- pictures.set(name, read);
75
+ const picture = {
76
+ read: fileOnLease(table, key, { inline: true, ...(variant ? { variant } : {}) }).then(({ blob }) => {
77
+ picture.src = URL.createObjectURL(blob);
78
+ return picture.src;
79
+ }),
80
+ };
81
+ picture.read.catch(() => pictures.get(name) === picture && pictures.delete(name));
82
+ pictures.set(name, picture);
75
83
  if (pictures.size > KEPT) {
76
84
  const [oldest, gone] = pictures.entries().next().value;
77
85
  pictures.delete(oldest);
78
- void gone.then(URL.revokeObjectURL, () => { });
86
+ void gone.read.then(URL.revokeObjectURL, () => { });
79
87
  }
80
- return read;
88
+ return picture;
89
+ }
90
+ /**
91
+ * A picture's address on the lease as it stands, for a caller that answers
92
+ * while it draws (a free-form page's `useFile`): the blob's address once it
93
+ * has been read, else undefined, with the read started and `drawn` called
94
+ * when it lands so the caller draws again. A picture that cannot be read
95
+ * stays undefined and never calls `drawn`, so a failure is not a loop.
96
+ */
97
+ export function pictureOnLeaseNow(table, key, variant, drawn) {
98
+ const picture = pictureOnLease(table, key, variant);
99
+ if (picture.src !== undefined)
100
+ return picture.src;
101
+ picture.read.then(drawn, () => { });
102
+ return undefined;
81
103
  }
82
104
  /**
83
105
  * A picture's address, to draw in place: the file route's inline mode, or on
@@ -93,7 +115,7 @@ export function usePictureAddress(table, key, connection, variant) {
93
115
  if (!lease || !table || !key)
94
116
  return;
95
117
  let current = true;
96
- pictureOnLease(table, key, variant).then((src) => current && setDrawn({ name, src }), () => current && setDrawn(undefined));
118
+ pictureOnLease(table, key, variant).read.then((src) => current && setDrawn({ name, src }), () => current && setDrawn(undefined));
97
119
  return () => {
98
120
  current = false;
99
121
  };
@@ -139,12 +139,14 @@
139
139
  <div id="startup-status" role="status"><div class="startup-skeleton" aria-hidden="true"><i class="st-band"></i><div class="st-page"><b class="st-title"></b><b class="st-line"></b><div class="st-figures"><b></b><b></b><b></b></div><b class="st-row"></b><b class="st-row"></b><b class="st-row"></b><b class="st-row"></b><b class="st-row"></b></div></div><p>Loading...</p><a href="" hidden>Reload</a></div>
140
140
  <!-- A pane the server drew (a public page, server/publicRender.ts) is the page without scripts too. -->
141
141
  <noscript><style>#startup-status { display: none !important; } #content[data-ssr] { visibility: visible !important; }</style>JavaScript is required to open this application.</noscript>
142
- <!-- The first stop on the page, so a keyboard gets past the top bar and
143
- the sidebar's list of tables in one press. app.js moves the focus
144
- itself: following the fragment would be a navigation the router
145
- hears. -->
146
- <a class="skip-link" href="#content">Skip to content</a>
147
142
  <header class="topbar">
143
+ <!-- The first stop on the page, so a keyboard gets past the top bar and
144
+ the sidebar's list of tables in one press. app.js moves the focus
145
+ itself: following the fragment would be a navigation the router
146
+ hears. It is inside the banner, not before it: a link outside every
147
+ landmark is content a screen reader's landmark list skips (axe's
148
+ "region" rule). It is fixed, so it takes no room in the bar. -->
149
+ <a class="skip-link" href="#content">Skip to content</a>
148
150
  <button type="button" class="brand" id="home-button" title="Back to the schema (h)">
149
151
  <span class="brand-mark"></span>
150
152
  <span class="brand-name">tablewalk</span>
@@ -1073,4 +1073,30 @@
1073
1073
  font-variant-caps: var(--part-chart-caps);
1074
1074
  letter-spacing: var(--part-chart-tracking);
1075
1075
  }
1076
+ :root[data-parts~="kicker:ground"] .app-mode .form-page .eyebrow {
1077
+ background: var(--part-kicker-ground);
1078
+ }
1079
+ :root[data-parts~="kicker:ink"] .app-mode .form-page .eyebrow {
1080
+ color: var(--part-kicker-ink);
1081
+ }
1082
+ :root[data-parts~="kicker:edge"] .app-mode .form-page .eyebrow {
1083
+ border-color: var(--part-kicker-edge);
1084
+ }
1085
+ :root[data-parts~="kicker:radius"] .app-mode .form-page .eyebrow {
1086
+ border-radius: var(--part-kicker-radius);
1087
+ }
1088
+ :root[data-parts~="kicker:lift"] .app-mode .form-page .eyebrow {
1089
+ box-shadow: var(--part-kicker-lift);
1090
+ }
1091
+ :root[data-parts~="kicker:face"] .app-mode .form-page .eyebrow {
1092
+ font-family: var(--part-kicker-face);
1093
+ }
1094
+ :root[data-parts~="kicker:weight"] .app-mode .form-page .eyebrow {
1095
+ font-weight: var(--part-kicker-weight);
1096
+ }
1097
+ :root[data-parts~="kicker:case"] .app-mode .form-page .eyebrow {
1098
+ text-transform: var(--part-kicker-transform);
1099
+ font-variant-caps: var(--part-kicker-caps);
1100
+ letter-spacing: var(--part-kicker-tracking);
1101
+ }
1076
1102
  }
@@ -147,6 +147,26 @@
147
147
  }
148
148
  }
149
149
 
150
+ /* Between a phone and a desk the bar's controls are not one row by rule, and a long App name beside the tenant's
151
+ control and the account ran past the window's edge: at 768px the page scrolled sideways (a field report). It wraps:
152
+ what does not fit stands on a second line at the right (the actions' own auto margin), and the name gives way
153
+ first, to an ellipsis. A bar that fits is one row as before; a phone's is always one (below). */
154
+ @media (min-width: 601px) and (max-width: 768px) {
155
+ body.app-mode .topbar {
156
+ flex-wrap: wrap;
157
+ row-gap: var(--space-1);
158
+ }
159
+ body.app-mode .topbar .brand {
160
+ min-width: 0;
161
+ max-width: 100%;
162
+ }
163
+ body.app-mode .topbar .brand-name {
164
+ overflow: hidden;
165
+ text-overflow: ellipsis;
166
+ white-space: nowrap;
167
+ }
168
+ }
169
+
150
170
  /* A phone's App bar is one row in every App, whichever shell it has on a
151
171
  desk: the menu's mark first, the brand taking the room, then search, the
152
172
  settings and the account at the right edge. A top-bar App had put its
@@ -397,6 +397,8 @@ html[data-starting] .content.nav-holding.nav-holding-focusable > :not(.nav-held)
397
397
  background: none; border: none; padding: var(--space-1) 5px;
398
398
  color: var(--link); font: inherit; font-family: var(--mono);
399
399
  cursor: pointer; border-radius: min(3px, var(--radius));
400
+ /* A step of the trail is a target (WCAG 2.5.8): at the small text sizes its line and padding came to 22px. */
401
+ min-block-size: 24px; box-sizing: border-box;
400
402
  }
401
403
  .crumbs > button:hover { background: var(--raised); }
402
404
  /* The chevron is the only separator, and it is set lighter and roomier than
@@ -2296,7 +2298,7 @@ body.app-mode .page-head.has-record + .page-body { padding-bottom: calc(132px +
2296
2298
  .command-field .field-control { width: 100%; box-sizing: border-box; }
2297
2299
  .command-field input[type="checkbox"] { width: auto; justify-self: start; }
2298
2300
  .command-field textarea { resize: vertical; }
2299
- .command-help { color: var(--ink-muted); font-size: var(--text-sm); }
2301
+ .command-help { max-width: 70ch; color: var(--ink-muted); font-size: var(--text-sm); }
2300
2302
  /* A group is a section of the form: a hairline seams it from what comes
2301
2303
  before and its label heads it, the way a record page's sections read — no
2302
2304
  box around it. A repeating group's rows are seamed the same way, each with
@@ -3214,6 +3216,7 @@ tr.expanded > td { border-bottom-color: transparent; background: var(--accent-so
3214
3216
  color: var(--ink);
3215
3217
  padding: var(--space-1) var(--space-2);
3216
3218
  border-radius: var(--radius);
3219
+ min-block-size: 24px; box-sizing: border-box;
3217
3220
  }
3218
3221
  /* Inline SVG sits on the text baseline by default and leaves descender space
3219
3222
  under it, which is the other half of the same misalignment. */
@@ -3389,6 +3392,7 @@ tr.expanded > td { border-bottom-color: transparent; background: var(--accent-so
3389
3392
  vanishes the moment somebody types into it. */
3390
3393
  .field-hint {
3391
3394
  display: block;
3395
+ max-width: 70ch;
3392
3396
  margin-top: var(--space-2);
3393
3397
  font-size: var(--text-xs);
3394
3398
  line-height: 1.45;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/kit",
3
- "version": "1.0.0-rc.37",
3
+ "version": "1.0.0-rc.39",
4
4
  "description": "The shared React client both shells are drawn with: the walk and the address, Grid, Value, the record page, lists, filters and charts.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {
@@ -83,8 +83,8 @@
83
83
  "./package.json": "./package.json"
84
84
  },
85
85
  "dependencies": {
86
- "@mistriwork/engine": "1.0.0-rc.37",
87
- "@mistriwork/ui": "1.0.0-rc.37",
86
+ "@mistriwork/engine": "1.0.0-rc.39",
87
+ "@mistriwork/ui": "1.0.0-rc.39",
88
88
  "intl-messageformat": "12.1.2",
89
89
  "qrcode-generator": "^2.0.4"
90
90
  },