@mistriwork/kit 1.0.0-rc.73 → 1.0.0-rc.75

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.
@@ -150,9 +150,10 @@ export declare function sliceRing(center: number, radius: number, from: number,
150
150
  * A donut with its legend: how the whole divides, said twice — arc length
151
151
  * and a labelled figure. Past six slices the tail is gathered into "others".
152
152
  */
153
- export declare function DonutChart({ rows, say, label, onPick, total, ordered, tone, }: {
153
+ export declare function DonutChart({ rows, say, sayLegend, label, onPick, total, ordered, tone, }: {
154
154
  rows: ChartRow[];
155
155
  say?: Say;
156
+ sayLegend?: (totals: readonly number[]) => (value: unknown) => string;
156
157
  label?: (key: unknown) => string;
157
158
  /** A slice's display tone, where its column has them: slices wear the ink their dot and badge wear when every one has its own. */
158
159
  tone?: (key: unknown) => string | undefined;
@@ -685,7 +685,7 @@ export function sliceRing(center, radius, from, length, width = 7) {
685
685
  * A donut with its legend: how the whole divides, said twice — arc length
686
686
  * and a labelled figure. Past six slices the tail is gathered into "others".
687
687
  */
688
- export function DonutChart({ rows, say = String, label = keyWord, onPick, total, ordered, tone, }) {
688
+ export function DonutChart({ rows, say = String, sayLegend, label = keyWord, onPick, total, ordered, tone, }) {
689
689
  /* 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
690
690
  the keyboard, the moment its ring is drawn: a look is picked while the page is open, and a stylesheet says it. */
691
691
  const [sliceWidth, setSliceWidth] = useState(7);
@@ -700,6 +700,7 @@ export function DonutChart({ rows, say = String, label = keyWord, onPick, total,
700
700
  if (rest.length)
701
701
  slices.push({ key: `others (${rest.length})`, value: rest.reduce((n, p) => n + p.value, 0) });
702
702
  const whole = slices.reduce((n, p) => n + p.value, 0);
703
+ const sayFigure = sayLegend ? sayLegend([whole, ...slices.map((p) => p.value)]) : say;
703
704
  const R = 15.9155; /* circumference 100, so dasharray speaks percent. */
704
705
  const C = 21;
705
706
  /* A step of the ramp rides in a property of its own, which the slice and its swatch both paint with. */
@@ -721,7 +722,7 @@ export function DonutChart({ rows, say = String, label = keyWord, onPick, total,
721
722
  a drillable slice carries the button's role, name and keyboard
722
723
  behaviour, and the legend button stays as the second way in. */
723
724
  const drillable = onPick && p.raw != null && !(rest.length && i === slices.length - 1);
724
- const said = `${p.key}: ${say(p.value)} (${formatPercent(share, { maximumFractionDigits: 0 })})`;
725
+ const said = `${p.key}: ${sayFigure(p.value)} (${formatPercent(share, { maximumFractionDigits: 0 })})`;
725
726
  const arc = (_jsx("circle", { className: `chart-slice${drillable ? ' chart-slice-drill' : ''}`, cx: C, cy: C, r: R, strokeDasharray: `${drawn.toFixed(2)} ${(100 - drawn).toFixed(2)}`, strokeDashoffset: at.toFixed(2), style: { ...ramp(i), stroke: color(i), opacity: opacity(i) }, children: !drillable && _jsx("title", { children: said }) }, i));
726
727
  /* The door is the slice and its ring together: the ring is drawn (and read by grade) only while the door holds the
727
728
  keyboard's focus. The dash starts at -offset along a path that begins at 3 o'clock. */
@@ -745,8 +746,8 @@ export function DonutChart({ rows, say = String, label = keyWord, onPick, total,
745
746
  slices as the picture's unnamed parts. Where nothing drills it stays
746
747
  an image, as before. */
747
748
  const anyDrillable = onPick && slices.some((p, i) => p.raw != null && !(rest.length && i === slices.length - 1));
748
- return (_jsxs("div", { className: `chart-donut-wrap${ordered ? ' is-ordered' : ''}`, children: [_jsxs("svg", { className: "chart-donut", viewBox: `0 0 ${C * 2} ${C * 2}`, role: anyDrillable ? 'group' : 'img', "aria-label": sayCopy('inAll', { whole: say(whole), map: slices.map((p) => `${p.key} ${say(p.value)}`).join(', ') }), children: [rings, _jsx("text", { className: "chart-donut-total", x: C, y: total ? C : C + 1.5, textAnchor: "middle", children: say(whole) }), total && (_jsx("text", { className: "chart-donut-caption", x: C, y: C + 4.5, textAnchor: "middle", children: total }))] }), _jsx("ul", { className: "chart-legend", children: slices.map((p, i) => {
749
- const parts = (_jsxs(_Fragment, { children: [_jsx("span", { className: "chart-swatch", style: { ...ramp(i), background: color(i), opacity: opacity(i) } }), _jsx("span", { className: "chart-legend-key", children: p.key }), _jsx("span", { className: "chart-legend-value", children: say(p.value) }), _jsx("span", { className: "chart-legend-share", children: formatPercent((100 * p.value) / whole, { maximumFractionDigits: 0 }) })] }));
749
+ return (_jsxs("div", { className: `chart-donut-wrap${ordered ? ' is-ordered' : ''}`, children: [_jsxs("svg", { className: "chart-donut", viewBox: `0 0 ${C * 2} ${C * 2}`, role: anyDrillable ? 'group' : 'img', "aria-label": sayCopy('inAll', { whole: sayFigure(whole), map: slices.map((p) => `${p.key} ${sayFigure(p.value)}`).join(', ') }), children: [rings, _jsx("text", { className: "chart-donut-total", x: C, y: total ? C : C + 1.5, textAnchor: "middle", children: sayFigure(whole) }), total && (_jsx("text", { className: "chart-donut-caption", x: C, y: C + 4.5, textAnchor: "middle", children: total }))] }), _jsx("ul", { className: "chart-legend", children: slices.map((p, i) => {
750
+ const parts = (_jsxs(_Fragment, { children: [_jsx("span", { className: "chart-swatch", style: { ...ramp(i), background: color(i), opacity: opacity(i) } }), _jsx("span", { className: "chart-legend-key", children: p.key }), _jsx("span", { className: "chart-legend-value", children: sayFigure(p.value) }), _jsx("span", { className: "chart-legend-share", children: formatPercent((100 * p.value) / whole, { maximumFractionDigits: 0 }) })] }));
750
751
  const drillable = onPick && p.raw != null && !(rest.length && i === slices.length - 1);
751
752
  return (_jsx("li", { children: drillable ? (_jsx("button", { type: "button", className: "chart-legend-drill", onClick: () => onPick(p.raw), children: parts })) : (parts) }, i));
752
753
  }) })] }));
@@ -64,7 +64,7 @@ export function ChartFigure({ answer, shape, limit, target, height, say, label,
64
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
- (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, partial: partial })) : 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, partial: partial }))) }));
67
+ (donut ? (_jsx(DonutChart, { rows: rows, say: say, sayLegend: sayLegend, 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, partial: partial })) : 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, partial: partial }))) }));
68
68
  }
69
69
  /** One of the further shapes, measured as the others are and drawn by the part on demand. */
70
70
  export function ChartShapeFigure({ answer, empty, emptyDetail, emptyAction, height, ...rest }) {
@@ -0,0 +1,6 @@
1
+ /** The stored value to the clipboard, as stored: an id past 2^53 arrives as a string and is copied as one. */
2
+ export declare function CopyValue({ value, label, announce, }: {
3
+ value: unknown;
4
+ label: string;
5
+ announce: (text: string, tone: 'ok' | 'error') => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * A value's copy button (a display rule's `copy`), shared by the record's Value and the custom components' Value. It
4
+ * reads no global of the walk: what it says when the copy is done or refused goes to the caller's `announce` (the
5
+ * shell's toast on a record, the host's announcement in a component), so the SDK can draw it too.
6
+ */
7
+ import { Icon } from './Icon.js';
8
+ import { say } from '../copy/record/components/CopyValue.js';
9
+ /** The stored value to the clipboard, as stored: an id past 2^53 arrives as a string and is copied as one. */
10
+ export function CopyValue({ value, label, announce, }) {
11
+ const named = say('copyValue', { label });
12
+ return (_jsx("button", { type: "button", className: "value-copy", "aria-label": named, title: named, onClick: (event) => {
13
+ /* A copy is never also the click of what holds it: a table row, a link's row. */
14
+ event.stopPropagation();
15
+ const text = typeof value === 'object' ? JSON.stringify(value) : String(value);
16
+ /* No clipboard at all (an insecure origin) is a refusal too, said the same way rather than thrown. */
17
+ Promise.resolve()
18
+ .then(() => navigator.clipboard.writeText(text))
19
+ .then(() => announce(say('copiedValue', { label }), 'ok'))
20
+ /* The clipboard can be refused — an insecure origin, a permission denied; the value is on screen. */
21
+ .catch(() => announce(say('common.theBrowserRefusedClipboard'), 'error'));
22
+ }, children: _jsx(Icon, { name: "copy", size: 16 }) }));
23
+ }
@@ -53,7 +53,7 @@ import { onDemand, useArrived } from './onDemand.js';
53
53
  import { isPickerDateTime } from '@mistriwork/ui/internal/datePickerModel.js';
54
54
  import { defaultCurrency } from '../locale.js';
55
55
  import { wordFor } from './valueModel.js';
56
- import { rowCurrency } from '@mistriwork/engine/shared/money.js';
56
+ import { majorText, minorToMajor, rowCurrency } from '@mistriwork/engine/shared/money.js';
57
57
  import { MinorMoneyInput, minorProblem } from './MinorMoneyInput.js';
58
58
  import { clockDefault, fieldInput, inferredNarrowing, flagStart, formColumns, formFrame, formGroups, hasFormChanges, insertValues, isFormFieldVisible, missingFields, narrowingCondition, presetValue, SEGMENTED_WORDS, withDisplayChoices, } from './newRecordModel.js';
59
59
  import { derivedValue, formWords, resolvedForm, useMeDefaults } from './formDefaults.js';
@@ -640,21 +640,29 @@ export function PlatformControl({ id, column, app, required, assigned, spoken, t
640
640
  plain value, said as the column says it: an expression (a clock, a sequence) or a default the server keeps
641
641
  private is the database's to fill, and a field has nothing useful to say about it (a field report). */
642
642
  const literal = app ? literalDefault(column.default) : undefined;
643
+ const moneyDefault = kind === 'money' && literal !== undefined
644
+ ? (() => {
645
+ const currency = rule?.currency ?? defaultCurrency();
646
+ return rule?.minor ? minorToMajor(literal, currency) : majorText(literal, currency);
647
+ })()
648
+ : undefined;
643
649
  const hint = explicitNull
644
650
  ? app
645
651
  ? say('common.noValue')
646
652
  : 'null'
647
653
  : column.identity || column.name === assigned
648
654
  ? say('assignedByTheDatabase')
649
- : literal !== undefined
650
- ? say('defaultValue', { value: allowed?.includes(literal) ? word(literal) : (wordFor(rule, literal) ?? literal) })
651
- : column.default !== undefined || column.hasDefault === true
652
- ? app
653
- ? ''
654
- : `default: ${column.default ?? ''}`
655
- : column.references
656
- ? `→ ${column.references.table}`
657
- : '';
655
+ : moneyDefault !== undefined
656
+ ? moneyDefault
657
+ : literal !== undefined
658
+ ? say('defaultValue', { value: allowed?.includes(literal) ? word(literal) : (wordFor(rule, literal) ?? literal) })
659
+ : column.default !== undefined || column.hasDefault === true
660
+ ? app
661
+ ? ''
662
+ : `default: ${column.default ?? ''}`
663
+ : column.references
664
+ ? `→ ${column.references.table}`
665
+ : '';
658
666
  const said = placeholder ?? hint;
659
667
  /* An App's listbox with nothing chosen asks, quietly, as a command form's does; the workbench keeps its dash. */
660
668
  const unchosen = hint || (app ? (readsAsName(spoken) ? say('choosePlaceholder', { label: spoken.toLowerCase() }) : say('chooseOne')) : '—');
@@ -22,6 +22,7 @@ import { canEditRow } from '../write.js';
22
22
  import { cardStem, sharedPrefix } from '@mistriwork/engine/shared/pagePaths.js';
23
23
  import { labelColumn } from '@mistriwork/engine/shared/schema.js';
24
24
  import { Editable } from './Editable.js';
25
+ import { jsonValueOf } from './jsonModel.js';
25
26
  import { RefJump, Value } from './Value.js';
26
27
  import { defaultFieldPaths, definedThrough, fieldsColumns } from '@mistriwork/engine/shared/recordReads.js';
27
28
  import { presentationColumns } from './columnPresentation.js';
@@ -265,7 +266,7 @@ export function FieldsSection({ page, section, index, base, recordKey: key, fold
265
266
  ? adorn({ table: base.id, column: path, key, filled: value !== null && value !== undefined && value !== '' })
266
267
  : null;
267
268
  if (editing && byName.has(path) && !column?.primaryKey && column?.writable !== false) {
268
- const display = (next, referenceLabel) => column?.references && next !== null && next !== undefined && String(next) !== '' ? (_jsx(RefJump, { references: column.references, value: next, label: referenceLabel ?? (String(next) === String(value) && refLabels.get(path) ? row[refLabels.get(path)] : undefined), table: base, column: path, row: { ...row, [path]: next } })) : (_jsx(Value, { col: column, value: next, tableId: base.id, compact: true, links: true, wholeText: true }));
269
+ const display = (next, referenceLabel) => column?.references && next !== null && next !== undefined && String(next) !== '' ? (_jsx(RefJump, { references: column.references, value: next, label: referenceLabel ?? (String(next) === String(value) && refLabels.get(path) ? row[refLabels.get(path)] : undefined), table: base, column: path, row: { ...row, [path]: next } })) : (_jsx(Value, { col: column, value: next, tableId: base.id, compact: jsonValueOf(column, next) === null, links: true, wholeText: true }));
269
270
  dd = (_jsx("dd", { className: "page-field-edit", children: _jsx(Editable, { table: base, row: row, column: byName.get(path), recordKey: key, onSaved: onEdit, isCurrent: isCurrent, app: shell().inApp(), display: shell().inApp() ? display : undefined }) }));
270
271
  }
271
272
  else if (section.edit &&
@@ -311,7 +312,10 @@ export function FieldsSection({ page, section, index, base, recordKey: key, fold
311
312
  its caption in an aside, Depot's product description wrapped word by word. */
312
313
  const rule = columnDisplay(base.id, path);
313
314
  const dress = column?.references || value === null || value === undefined ? null : dressFor(rule, value);
315
+ /* A JSON document is read whole under its caption, in a rail or a grid alike. */
316
+ const isJson = !column?.references && (dress?.kind === 'json' || jsonValueOf(column, value) !== null);
314
317
  const long = rule?.format === 'richText' ||
318
+ isJson ||
315
319
  (rail && !column?.references && value != null && (dress ? dress.kind === 'richText' : sayValue(column, value).kind === 'long'));
316
320
  /* …and a long text alone under its section's title is read under that title, as a document's paragraph. */
317
321
  const lone = Boolean(section.title) && paths.length === 1 && (!rail || long);
@@ -1,6 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  export function PageHeading({ title, favorite, description, actions, back, hidden = false, level = 1, }) {
3
3
  const Title = level === 1 ? 'h1' : 'h2';
4
4
  const drawn = actions !== undefined && actions !== null && actions !== false;
5
- return (_jsxs("div", { className: `applist-head dash-head${drawn ? ' has-actions' : ''}${back ? ' has-back' : ''}`, children: [back ? _jsx("div", { className: "dash-head-back", children: back }) : null, _jsx(Title, { className: `applist-title${hidden ? ' visually-hidden' : ''}`, children: title }), favorite, drawn ? _jsx("div", { className: "applist-head-tools dash-head-actions", children: actions }) : null, description ? _jsx("p", { className: "note dash-description", children: description }) : null] }));
5
+ const heading = _jsx(Title, { className: `applist-title${hidden ? ' visually-hidden' : ''}`, children: title });
6
+ /* A page that draws its own head says its own intro; `heading: false` hides only the title. */
7
+ const intro = description ? _jsx("p", { className: "note dash-description", children: description }) : null;
8
+ return (_jsxs("div", { className: `applist-head dash-head${drawn ? ' has-actions' : ''}${back ? ' has-back' : ''}`, children: [back ? _jsx("div", { className: "dash-head-back", children: back }) : null, drawn ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "dash-head-text", children: [heading, favorite, intro] }), _jsx("div", { className: "applist-head-tools dash-head-actions", children: actions })] })) : (_jsxs(_Fragment, { children: [heading, favorite, intro] }))] }));
6
9
  }
@@ -257,5 +257,5 @@ export function ChartSection({ section, plan, base }) {
257
257
  go(tableView(plan.breakdown.base, `${plan.breakdown.base} ${where}`), 'push');
258
258
  }
259
259
  : null;
260
- return (_jsx(SectionBox, { section: section, foldable: false, body: _jsx(ChartFigure, { answer: drawn, arrange: section.sort === 'value' ? 'value' : plan.breakdown.orderBy?.[0]?.name === 'value' ? undefined : 'answer', shape: section.shape, limit: section.limit, target: section.target, curve: section.curve, total: section.total, height: section.height, say: say, label: namedGroups(got, got.columns[0], firstLabel.say), seriesLabel: namedGroups(got, second ? got.columns[1] : undefined, labelFor(second).say), vocabulary: firstLabel.allowed, onPick: drill, empty: inAppPage() ? sayCopy('nothingToDrawYet') : sayCopy('noForThisRecord', { from }) }) }));
260
+ return (_jsx(SectionBox, { section: section, foldable: false, body: _jsx(ChartFigure, { answer: drawn, arrange: section.sort === 'value' ? 'value' : plan.breakdown.orderBy?.[0]?.name === 'value' ? undefined : 'answer', shape: section.shape, limit: section.limit, target: section.target, curve: section.curve, total: section.total, height: section.height, say: say, sayLegend: section.shape === 'donut' || section.shape === 'stacked' ? (totals) => say.among(totals) : undefined, label: namedGroups(got, got.columns[0], firstLabel.say), seriesLabel: namedGroups(got, second ? got.columns[1] : undefined, labelFor(second).say), vocabulary: firstLabel.allowed, onPick: drill, empty: inAppPage() ? sayCopy('nothingToDrawYet') : sayCopy('noForThisRecord', { from }) }) }));
261
261
  }
@@ -182,10 +182,18 @@ export function TimelineSection({ section, plan, base, recordKey }) {
182
182
  })(),
183
183
  }));
184
184
  }));
185
+ const toEpoch = (when) => {
186
+ const normalized = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(when) ? `${when.replace(' ', 'T')}Z` : when;
187
+ const ms = Date.parse(normalized);
188
+ return Number.isNaN(ms) ? 0 : ms;
189
+ };
185
190
  const merged = answers
186
191
  .flat()
187
192
  .filter((r) => r.when)
188
- .sort((a, b) => (a.when < b.when ? 1 : a.when > b.when ? -1 : 0));
193
+ .sort((a, b) => {
194
+ const diff = toEpoch(b.when) - toEpoch(a.when);
195
+ return diff !== 0 ? diff : a.when < b.when ? 1 : a.when > b.when ? -1 : 0;
196
+ });
189
197
  return { rows: merged.slice(0, step * pages), more: streamMore || merged.length > step * pages };
190
198
  },
191
199
  staleTime: 0,
@@ -213,9 +221,15 @@ export function TimelineSection({ section, plan, base, recordKey }) {
213
221
  /* The box's height and its scroll are whole pixels and a face's lines are not (Barlow's start at fractions):
214
222
  floored, the edge fell up to a pixel inside the line it was meant to start. Rounded, it falls within half a
215
223
  pixel of that line's start, on either side, so a line is taken only where rounding lands no lower. */
224
+ /* A day's label stays in view at the top while its day scrolls (page.css), over the start of what is under
225
+ it: a message starts at the label's foot, not at the box's edge. A stuck label reports where it is held,
226
+ so a label is measured where its day starts. */
227
+ const label = (line) => line.matches('.timeline-day-label');
228
+ const under = (line) => label(line) ? 0 : (line.closest('.timeline-day')?.querySelector('.timeline-day-label')?.offsetHeight ?? 0);
229
+ const at = (line) => ((label(line) && line.closest('.timeline-day')) || line).getBoundingClientRect().top;
216
230
  const edge = [...box.querySelectorAll('.timeline-day-label, [data-timeline-row], .timeline-fold')]
217
231
  .filter((line) => line.offsetHeight > 0)
218
- .map((line) => line.getBoundingClientRect().top - origin)
232
+ .map((line) => at(line) - origin - under(line))
219
233
  .filter((top) => top >= over - 0.5)
220
234
  .sort((a, b) => a - b)[0];
221
235
  const height = edge === undefined ? room : Math.round(whole - edge);
@@ -301,7 +301,7 @@ function RecordPickerControl(props) {
301
301
  const subOf = (o) => (o.sub && (subline?.declared || twice.has(o.label)) ? o.sub : undefined);
302
302
  const twiceChosen = collidingNames(ids.map(shownLabel));
303
303
  const chipName = (value) => twiceChosen.has(shownLabel(value)) && subs.get(value) ? `${shownLabel(value)} · ${subs.get(value)}` : shownLabel(value);
304
- return (_jsxs("div", { className: `picker${props.multiple ? ' picker-multi' : ''}`, ref: wrap, onKeyDownCapture: (e) => {
304
+ return (_jsxs("div", { className: `picker${props.multiple ? ' picker-multi' : ''}`, "aria-disabled": props.disabled || undefined, ref: wrap, onKeyDownCapture: (e) => {
305
305
  if (editing && open && e.key === 'Escape') {
306
306
  e.preventDefault();
307
307
  e.stopPropagation();
@@ -19,7 +19,7 @@ import { itemsText, jsonValueOf, previewOf } from './jsonModel.js';
19
19
  import { TAGS_TYPE, tagChips } from '@mistriwork/engine/shared/tagLists.js';
20
20
  import { AvatarText, Dressed, Said } from './Dressed.js';
21
21
  import { ValueSlot } from './valueRenderers.js';
22
- import { Icon } from './Icon.js';
22
+ import { CopyValue } from './CopyValue.js';
23
23
  import { say } from '../copy/record/components/Value.js';
24
24
  import { shellBody } from '../shellHost.js';
25
25
  import { Subtitled } from './SecondLine.js';
@@ -70,19 +70,7 @@ function BareValue(props) {
70
70
  maskedText(rule, value) !== undefined ||
71
71
  !shellBody().classList.contains('app-mode'))
72
72
  return drawn;
73
- return (_jsxs("span", { className: "value-copyable", children: [drawn, _jsx(CopyValue, { value: value, label: columnLabel(tableId, col?.name ?? '') ?? humanName(col?.name ?? '') })] }));
74
- }
75
- /** The stored value to the clipboard, as stored: an id past 2^53 arrives as a string and is copied as one. */
76
- function CopyValue({ value, label }) {
77
- const named = say('copyValue', { label });
78
- return (_jsx("button", { type: "button", className: "value-copy", "aria-label": named, title: named, onClick: () => {
79
- const text = typeof value === 'object' ? JSON.stringify(value) : String(value);
80
- navigator.clipboard
81
- .writeText(text)
82
- .then(() => toast(say('copiedValue', { label })))
83
- /* The clipboard can be refused — an insecure origin, a permission denied; the value is on screen. */
84
- .catch(() => toast(say('common.theBrowserRefusedClipboard'), 'error'));
85
- }, children: _jsx(Icon, { name: "copy", size: 16 }) }));
73
+ return (_jsxs("span", { className: "value-copyable", children: [drawn, _jsx(CopyValue, { value: value, label: columnLabel(tableId, col?.name ?? '') ?? humanName(col?.name ?? ''), announce: (text, tone) => (tone === 'error' ? toast(text, 'error') : toast(text)) })] }));
86
74
  }
87
75
  function DrawnValue(props) {
88
76
  const { col, value, tableId, compact = false, rule } = props;
@@ -157,7 +145,7 @@ function PlatformValue({ col, value, tableId, compact = false, links = !compact,
157
145
  return _jsx(ValueLink, { link: link });
158
146
  const dress = tableId === undefined ? null : dressFor(rule, value);
159
147
  if (dress)
160
- return _jsx(Dressed, { dress: dress, compact: compact && !(wholeText && dress.kind === 'richText') });
148
+ return _jsx(Dressed, { dress: dress, compact: compact && !(wholeText && (dress.kind === 'richText' || dress.kind === 'json')) });
161
149
  /* In an App a vocabulary's value is a word, as its chip says it ("On hold"
162
150
  for `on_hold`); the Workbench shows the data exactly. */
163
151
  return _jsx(Said, { col: col, value: value, compact: compact, app: shellBody().classList.contains('app-mode') });
@@ -1,5 +1,7 @@
1
+ import { LABEL_SEGMENT } from '@mistriwork/engine/shared/recordLabel.js';
1
2
  import { TAGS_COLUMN, tagsColumnMeta } from '@mistriwork/engine/shared/tagLists.js';
2
3
  import { resolvePath } from '@mistriwork/engine/shared/view.js';
4
+ import { labelColumnMeta } from '@mistriwork/engine/shared/viewPaths.js';
3
5
  import { rollupColumnMeta } from '@mistriwork/engine/shared/rollups.js';
4
6
  import { computedColumnMeta } from '@mistriwork/engine/shared/computed.js';
5
7
  /** Dotted projections retain their source type without becoming the base row's key. */
@@ -26,6 +28,11 @@ export function presentationColumns(schema, table, paths) {
26
28
  columns.set(path, { ...tagsColumnMeta(), identifier: false });
27
29
  continue;
28
30
  }
31
+ // A templated record label (recordLabel.ts): searched and filtered as text.
32
+ if (path === LABEL_SEGMENT && table.labelTemplate && !columns.has(path)) {
33
+ columns.set(path, { ...labelColumnMeta(), identifier: false });
34
+ continue;
35
+ }
29
36
  if (columns.has(path) || !path.includes('.'))
30
37
  continue;
31
38
  try {
@@ -15,8 +15,10 @@ import { useQueries } from '@tanstack/react-query';
15
15
  import { useEffect, useState } from 'react';
16
16
  import { columnDisplay, columnLabel, findTable, state } from '../core.js';
17
17
  import { hasFilterOf } from '@mistriwork/engine/shared/listFilters.js';
18
+ import { LABEL_SEGMENT } from '@mistriwork/engine/shared/recordLabel.js';
18
19
  import { presentationColumns } from './columnPresentation.js';
19
20
  import { humanName } from '@mistriwork/engine/shared/model.js';
21
+ import { message } from '../messages.js';
20
22
  import { andWords, written } from './conditionText.js';
21
23
  import { referenceNameQuery } from './FilterBoxes.js';
22
24
  import { useMessageLanguage } from './useMessageLanguage.js';
@@ -32,7 +34,7 @@ function appSpeaker(table) {
32
34
  return null;
33
35
  return {
34
36
  column: (name) => table.columns.find((column) => column.name === name) ?? acrossColumn(table, name),
35
- label: (name) => columnLabel(table.id, name) ?? humanName(name),
37
+ label: (name) => name === LABEL_SEGMENT ? message('common.name') : (columnLabel(table.id, name) ?? humanName(name)),
36
38
  rule: (name) => columnDisplay(table.id, name),
37
39
  };
38
40
  }
@@ -42,7 +44,9 @@ function appSpeaker(table) {
42
44
  function acrossColumn(table, name) {
43
45
  const has = hasFilterOf(name);
44
46
  if (!has)
45
- return name.includes('.') ? presentationColumns(state.schema, table, [name]).get(name) : undefined;
47
+ return name.includes('.') || name === LABEL_SEGMENT
48
+ ? presentationColumns(state.schema, table, [name]).get(name)
49
+ : undefined;
46
50
  const child = (findTable(has.child) ?? state.schema?.tables.find((t) => t.name === has.child));
47
51
  if (!child)
48
52
  return undefined;
@@ -0,0 +1,4 @@
1
+ export declare const say: import("../../../messages.js").RoomMessage<{
2
+ readonly copyValue: "Copy {label}";
3
+ readonly copiedValue: "Copied {label}.";
4
+ }>;
@@ -0,0 +1,6 @@
1
+ /** What CopyValue says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */
2
+ import { defineMessages } from '../../../messages.js';
3
+ export const say = defineMessages({
4
+ copyValue: 'Copy {label}',
5
+ copiedValue: 'Copied {label}.',
6
+ });
@@ -1,7 +1,5 @@
1
1
  export declare const say: import("../../../messages.js").RoomMessage<{
2
2
  readonly openReference: "Open {label} ({table} {key})";
3
3
  readonly openTableKey: "Open {table} {key}";
4
- readonly copyValue: "Copy {label}";
5
- readonly copiedValue: "Copied {label}.";
6
4
  readonly findOnAMap: "Find on a map";
7
5
  }>;
@@ -3,7 +3,5 @@ import { defineMessages } from '../../../messages.js';
3
3
  export const say = defineMessages({
4
4
  openReference: 'Open {label} ({table} {key})',
5
5
  openTableKey: 'Open {table} {key}',
6
- copyValue: 'Copy {label}',
7
- copiedValue: 'Copied {label}.',
8
6
  findOnAMap: 'Find on a map',
9
7
  });
@@ -729,6 +729,13 @@ body.app-mode.page-bare .content { padding-inline: 0; }
729
729
  .applist-head.dash-head:is(.has-actions, .has-back) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2h); }
730
730
  .dash-head.has-back > .dash-head-back { flex-basis: 100%; margin-left: calc(var(--space-2) * -1); }
731
731
  .dash-head.has-actions > .dash-head-actions { margin-left: auto; }
732
+ /* With verbs the words are one region (PageHeading.tsx): the intro under the title, the verbs at the far end, and the
733
+ verbs under the words once the line cannot hold both, at a phone. */
734
+ .dash-head.has-actions > .dash-head-text { flex: 1 1 18rem; min-width: 0; }
735
+ .dash-head-text > .applist-title { margin: 0; }
736
+ /* A head a page draws in its own body stands in the body's gutter: its own inline padding was a second inset, the
737
+ head's words a step in from the page's first card. */
738
+ .free-page-body .dash-head { padding-inline: 0; }
732
739
  .dash-head:is(.has-actions, .has-back) > .dash-description { flex-basis: 100%; margin: 0; }
733
740
  .dash-head-compact { align-items: center; gap: var(--space-2h); width: 100%; margin-bottom: var(--space-3); }
734
741
  .dash-head-compact .applist-title { margin: 0; }
@@ -844,6 +851,9 @@ body.app-mode.page-bare .content { padding-inline: 0; }
844
851
  /* A meter: a number against its max, the bar coloured by the rule's tone. */
845
852
  .meter-wrap { display: inline-flex; align-items: center; gap: var(--space-3); }
846
853
  .meter-wrap .pct-bar { width: 64px; }
854
+ /* A fluid meter is the bar across its row (a card, a column), the figure at its end: the bar takes what is left. */
855
+ .meter-wrap.meter-fluid { display: flex; width: 100%; min-width: 0; }
856
+ .meter-wrap.meter-fluid .pct-bar { width: auto; flex: 1 1 auto; min-width: 0; }
847
857
  .meter-good .pct-fill { background: var(--status-good); }
848
858
  .meter-warn .pct-fill { background: var(--status-warning); }
849
859
  .meter-bad .pct-fill { background: var(--status-critical); }
@@ -1915,6 +1915,13 @@
1915
1915
  max-height: min(60vh, 30rem);
1916
1916
  overflow-y: auto;
1917
1917
  }
1918
+ .timeline-scroll .timeline-day-label {
1919
+ position: sticky;
1920
+ top: 0;
1921
+ z-index: 1;
1922
+ padding-block: var(--space-1);
1923
+ background: var(--surface);
1924
+ }
1918
1925
  /* A tinted message (an internal note) is a card in its column: its tone's wash, and an edge that says what it is. */
1919
1926
  .timeline-row.is-tinted {
1920
1927
  padding: var(--space-3) var(--space-3h);
@@ -3399,17 +3406,14 @@
3399
3406
  color: var(--ink-muted);
3400
3407
  font: var(--text-base)/1.45 var(--sans);
3401
3408
  }
3402
- .cards-summary-item + .cards-summary-item {
3403
- margin-inline-start: var(--space-5);
3404
- }
3405
- .cards-summary-item::before {
3406
- content: '·';
3407
- display: inline-block;
3408
- width: 15px;
3409
- margin-inline-start: -15px;
3410
- text-align: center;
3409
+ .cards-summary-item + .cards-summary-item::before {
3410
+ content: ' · ' / '';
3411
3411
  color: var(--ink-subtle);
3412
3412
  }
3413
+ .cards-summary .tone {
3414
+ max-width: 100%;
3415
+ vertical-align: bottom;
3416
+ }
3413
3417
  .cards-summary .num-value {
3414
3418
  font: inherit;
3415
3419
  }
@@ -27,12 +27,12 @@
27
27
  #table-list button[aria-current='true'],
28
28
  .mobile-nav-list button[aria-current='true']
29
29
  ) {
30
- background: var(--nav-current);
31
- color: var(--nav-on-current, var(--nav-ink));
30
+ background: var(--part-nav-current-ground, var(--nav-current));
31
+ color: var(--part-nav-current-ink, var(--nav-on-current, var(--nav-ink)));
32
32
  /* The block replaces a look's own mark, but not one the look draws beside any block (`--nav-current-mark`, the
33
33
  slot's marker in workshopLook.css), so a theme may tint the current entry and keep the accent's slot, as
34
34
  Workshop does. */
35
- box-shadow: var(--nav-current-mark, none);
35
+ box-shadow: var(--part-nav-current-lift, var(--nav-current-mark, none));
36
36
  }
37
37
  :root[data-nav-current] .app-mode .topbar :is(.tn-item[aria-current='true'], .tn-group.active > .tn-group-button)::after {
38
38
  background: transparent;
@@ -256,15 +256,16 @@
256
256
  }
257
257
  }
258
258
 
259
- /* A heading, not a crumb: the list title's step in the look's heading face (style.css tokens). */
259
+ /* A heading, not a crumb: the list title's step in the look's heading face (style.css tokens), or in the theme's
260
+ own (`page.title` part). */
260
261
  .crumbs h1.applist-title {
261
262
  margin: 0;
262
- font-family: var(--heading-font, var(--sans));
263
+ font-family: var(--part-page-title-face, var(--heading-font, var(--sans)));
263
264
  font-size: var(--type-list-title);
264
265
  line-height: 1.2;
265
- font-weight: var(--heading-weight);
266
- letter-spacing: var(--track-title);
267
- color: var(--ink);
266
+ font-weight: var(--part-page-title-weight, var(--heading-weight));
267
+ letter-spacing: var(--part-page-title-tracking, var(--track-title));
268
+ color: var(--part-page-title-ink, var(--ink));
268
269
  }
269
270
 
270
271
  .applist-head.in-crumbs {
@@ -900,9 +901,9 @@
900
901
  .pbd-drill {
901
902
  min-height: 44px;
902
903
  }
903
- /* The command form's line pickers draw at the row's 30px. */
904
+ /* The command form's line pickers draw at 44px on a coarse pointer. */
904
905
  .form-lines-grid .lines-ref:not(.has-sub) .picker-input {
905
- height: 40px;
906
+ height: 44px;
906
907
  }
907
908
  /* The chrome's own controls the same way, on ::before, since a tab's underline and a field's pencil are
908
909
  already their ::after: the brand, the header's icon buttons, a view's tabs, the buttons and a checklist
@@ -938,6 +939,7 @@
938
939
  .tn-mobile-menu,
939
940
  .tn-search,
940
941
  .presentation-seg,
942
+ .timeline-mode,
941
943
  .page-metric-value,
942
944
  .dashboard-note-action,
943
945
  .peekpanel-close,
@@ -972,6 +974,7 @@
972
974
  .tn-mobile-menu,
973
975
  .tn-search,
974
976
  .presentation-seg,
977
+ .timeline-mode,
975
978
  .page-metric-value,
976
979
  .dashboard-note-action,:is([data-slot='date-field'] > [data-slot='popover-trigger']),
977
980
  .peekpanel-close,
@@ -1427,7 +1430,11 @@
1427
1430
  /* The room is a pane standing on the menu's ground (docs/design.md, the shell): inset from the window's edge on the
1428
1431
  three sides the menu is not, a hairline round it and corners a step rounder than a control's. The menu and the
1429
1432
  room then read as two things, and the room as the one that changes. The menu's own edge would be a second
1430
- line beside the pane's. */
1433
+ line beside the pane's, unless a theme draws it (`nav` part's edge).
1434
+ A theme's part rules are in `@layer theme`, under this one: what a part may set on an element is said here
1435
+ through the part's own token (`--part-ground-ground` and the rest, appTheme.js), so a declared part wins and
1436
+ every other App draws as before (test/theme-parts-structure.test.ts). The pane's bar is the pane's head, so it
1437
+ wears the page's ground, edge and corner too. */
1431
1438
  body.app-sidebar-shell .layout {
1432
1439
  display: grid;
1433
1440
  grid-template-columns: auto minmax(0, 1fr);
@@ -1436,7 +1443,7 @@
1436
1443
  }
1437
1444
  body.app-sidebar-shell .layout > .sidebar {
1438
1445
  grid-row: 1 / -1;
1439
- border-right-color: transparent;
1446
+ border-right-color: var(--part-nav-edge, transparent);
1440
1447
  }
1441
1448
  /* The pane's bar (sidebarShell.js): where the reader is, then what is the same in every room — the search, the
1442
1449
  bell, the account — at its far end, over a rule. It is the pane's head: its corners are the pane's, the room
@@ -1452,18 +1459,19 @@
1452
1459
  height: 52px;
1453
1460
  margin: var(--space-3) var(--space-3) 0 0;
1454
1461
  padding-inline: calc(var(--space-5) + var(--room-inset)) var(--space-4);
1455
- border: 1px solid var(--line);
1462
+ border: 1px solid var(--part-ground-edge, var(--line));
1456
1463
  border-bottom: 0;
1457
- border-radius: calc(var(--radius) + 4px) calc(var(--radius) + 4px) 0 0;
1458
- background: var(--surface);
1464
+ border-radius: var(--part-ground-radius, calc(var(--radius) + 4px)) var(--part-ground-radius, calc(var(--radius) + 4px)) 0 0;
1465
+ background: var(--part-ground-ground, var(--surface));
1459
1466
  }
1460
1467
  body.app-sidebar-shell .layout > .content {
1461
1468
  grid-column: 2;
1462
1469
  margin: 0 var(--space-3) var(--space-3) 0;
1463
- border: 1px solid var(--line);
1464
- border-top: var(--pane-rule, 1px solid var(--line));
1465
- border-radius: 0 0 calc(var(--radius) + 4px) calc(var(--radius) + 4px);
1466
- background: var(--surface);
1470
+ border: 1px solid var(--part-ground-edge, var(--line));
1471
+ /* A look that rules its bar in ink keeps that rule: it is the bar's foot, not the pane's edge. */
1472
+ border-top: var(--pane-rule, 1px solid var(--part-ground-edge, var(--line)));
1473
+ border-radius: 0 0 var(--part-ground-radius, calc(var(--radius) + 4px)) var(--part-ground-radius, calc(var(--radius) + 4px));
1474
+ background: var(--part-ground-ground, var(--surface));
1467
1475
  }
1468
1476
  /* The pane's own edge is a margin already: the room keeps a step less of its gutter inside it, so what stands
1469
1477
  in it starts where it would under a bar. An App's own gutter and a bare page keep theirs (features.css). */
@@ -1477,7 +1485,7 @@
1477
1485
  body.app-sidebar-shell.page-bare .layout > .content {
1478
1486
  margin: 0;
1479
1487
  border: 0;
1480
- border-radius: 0;
1488
+ border-radius: var(--part-ground-radius, 0);
1481
1489
  }
1482
1490
  /* Where the reader is: the menu's group, then the room, said once more for the eye (the menu's current row and
1483
1491
  the room's heading say it to everyone else). The room's name gives way first. */
@@ -28,8 +28,10 @@
28
28
  picture { display: contents; }
29
29
 
30
30
  /* A plain link a free-form page writes (`<a href={useHref().page(…)}>`) is the look's link ink, as the platform's own links
31
- are, not the browser's blue. In base, so any rule the page or a component brings (a later layer) still wins. */
32
- .free-page-body a { color: var(--link); }
31
+ are, not the browser's blue. In base, so any rule the page or a component brings (a later layer) still wins. Only a
32
+ plain link: a rule written straight into base outranks every sub-layer base imports, the button part's included, so
33
+ without the :where() a `<Button href intent="primary">` wore the link ink on the primary fill (1.22:1). */
34
+ .free-page-body a:where(:not([data-slot])) { color: var(--link); }
33
35
 
34
36
  body {
35
37
  margin: 0;
@@ -210,8 +210,10 @@
210
210
  :root[data-theme-style] .app-mode .topbar :is(.tn-group.active > .tn-group-button, .tn-item[aria-current="true"]) { background: color-mix(in srgb, var(--nav-ink) 8%, transparent); color: var(--nav-ink); border-radius: var(--radius); }
211
211
  :root[data-theme-style] td:where(:not([data-slot])) { font-size: var(--text-md); }
212
212
  /* The row's name anchors it, in every look: its first column a step heavier than the rest, so the eye has somewhere
213
- to land before it reads across (a row's tick, where it has one, stands before it). */
214
- :root[data-theme-style] .app-mode td:is(:first-child:not(.row-host), .row-host + td) { font-weight: 600; }
213
+ to land before it reads across (a row's tick, where it has one, stands before it). A kit Table's cell is
214
+ not bold as a whole: its weight is its primary line's (`.kit-cell-primary-strong`, kit.css), so a secondary
215
+ line under it keeps the body's. */
216
+ :root[data-theme-style] .app-mode td:is(:first-child:not(.row-host), .row-host + td):not(.kit-cell) { font-weight: 600; }
215
217
  :root[data-theme-style] td.num { font-weight: 500; }
216
218
  /* List tabs are pills here: the current one filled in the accent. */
217
219
  :root[data-theme-style] .tabs { border-bottom: 0; gap: var(--space-2); padding-top: var(--space-4); }
@@ -1261,16 +1263,17 @@ html:root[data-theme-style] .record-presentation { margin-inline-start: auto; }
1261
1263
  :root[data-look-pane='edge'] body.app-sidebar-shell .layout > .pane-bar {
1262
1264
  margin: 0;
1263
1265
  border: 0;
1264
- border-left: 1px solid var(--line);
1266
+ border-left: 1px solid var(--part-ground-edge, var(--line));
1265
1267
  border-radius: 0;
1266
1268
  }
1269
+ /* A theme's ground part still wins here (structure.css, the pane): its edge, corner and lift through its tokens. */
1267
1270
  :root[data-look-pane='edge'] body.app-sidebar-shell .layout > .content {
1268
1271
  margin: 0;
1269
1272
  border: 0;
1270
- border-left: 1px solid var(--line);
1271
- border-top: var(--pane-rule, 1px solid var(--line));
1272
- border-radius: 0;
1273
- box-shadow: none;
1273
+ border-left: 1px solid var(--part-ground-edge, var(--line));
1274
+ border-top: var(--pane-rule, 1px solid var(--part-ground-edge, var(--line)));
1275
+ border-radius: var(--part-ground-radius, 0);
1276
+ box-shadow: var(--part-ground-lift, none);
1274
1277
  }
1275
1278
  :root[data-look-pane='edge'] body.app-sidebar-shell.page-bare .layout > .content {
1276
1279
  border: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/kit",
3
- "version": "1.0.0-rc.73",
3
+ "version": "1.0.0-rc.75",
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": {
@@ -85,8 +85,8 @@
85
85
  "./package.json": "./package.json"
86
86
  },
87
87
  "dependencies": {
88
- "@mistriwork/engine": "1.0.0-rc.73",
89
- "@mistriwork/ui": "1.0.0-rc.73",
88
+ "@mistriwork/engine": "1.0.0-rc.75",
89
+ "@mistriwork/ui": "1.0.0-rc.75",
90
90
  "intl-messageformat": "12.1.2",
91
91
  "qrcode-generator": "^2.0.4"
92
92
  },