@mistriwork/kit 1.0.0-rc.32 → 1.0.0-rc.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/brandLook.css +5 -0
- package/dist/client/components/AsOfChip.d.ts +3 -0
- package/dist/client/components/AsOfChip.js +16 -0
- package/dist/client/components/Chart.css +3 -0
- package/dist/client/components/Chart.d.ts +11 -2
- package/dist/client/components/Chart.js +20 -9
- package/dist/client/components/ChartFigure.d.ts +4 -1
- package/dist/client/components/ChartFigure.js +2 -2
- package/dist/client/components/Editable.js +2 -2
- package/dist/client/components/FilterRail.js +2 -2
- package/dist/client/components/Grid.js +1 -1
- package/dist/client/components/GridCellEditor.js +2 -2
- package/dist/client/components/NewRecord.js +2 -2
- package/dist/client/components/PageFields.js +1 -1
- package/dist/client/components/PageRelated.js +1 -1
- package/dist/client/components/Peek.js +11 -2
- package/dist/client/components/Prompt.js +3 -3
- package/dist/client/components/Record.js +2 -2
- package/dist/client/components/RowActions.d.ts +3 -1
- package/dist/client/components/RowActions.js +2 -2
- package/dist/client/components/Sidebar.js +7 -0
- package/dist/client/components/Value.js +3 -0
- package/dist/client/components/WorkflowStatus.js +5 -0
- package/dist/client/components/conditionWords.js +3 -3
- package/dist/client/components/formDefaults.js +2 -2
- package/dist/client/components/newRecordModel.js +3 -1
- package/dist/client/components/valueModel.d.ts +2 -0
- package/dist/client/copy/dashboards/components/Chart.d.ts +3 -0
- package/dist/client/copy/dashboards/components/Chart.js +3 -0
- package/dist/client/copy/shell/components/AsOfChip.d.ts +4 -0
- package/dist/client/copy/shell/components/AsOfChip.js +6 -0
- package/dist/client/features.css +6 -0
- package/dist/client/locale.d.ts +9 -0
- package/dist/client/locale.js +0 -0
- package/dist/client/sessionIdentity.d.ts +5 -0
- package/dist/client/sessionIdentity.js +26 -0
- package/dist/client/shellMode.d.ts +1 -0
- package/dist/client/visualTheme.js +3 -0
- package/package.json +3 -3
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
:root[data-look-bar='dark'] .app-mode .topbar .app-issues {
|
|
42
42
|
color: color-mix(in srgb, var(--status-warning) 40%, var(--nav-ink));
|
|
43
43
|
}
|
|
44
|
+
/* The as-of chip the same way: the page's muted ink is dark on a dark ground. */
|
|
45
|
+
:root[data-look-bar='dark'] .app-mode .topbar .as-of-chip {
|
|
46
|
+
border-color: color-mix(in srgb, var(--nav-ink) 30%, transparent);
|
|
47
|
+
color: color-mix(in srgb, var(--nav-ink) 75%, var(--nav-ground, transparent));
|
|
48
|
+
}
|
|
44
49
|
/* The current room as a wash of the navigation's accent; its items stay the bar's muted ink. */
|
|
45
50
|
:root[data-look-nav='wash'] .app-mode .topbar :is(.tn-group.active > .tn-group-button, .tn-item[aria-current='true']) {
|
|
46
51
|
background: color-mix(in srgb, var(--nav-accent) 18%, transparent);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Says, in the bar, that App logic is running as of another moment
|
|
4
|
+
* (`mistri dev --as-of`, http/clock.ts): a person reading "due today" on a
|
|
5
|
+
* seeded day should not have to remember the server was started that way.
|
|
6
|
+
* Development and tests only — the server refuses the flag anywhere else, so
|
|
7
|
+
* the payload carries no offset and this draws nothing.
|
|
8
|
+
*/
|
|
9
|
+
import { formatDateTime } from '../locale.js';
|
|
10
|
+
import { say } from '../copy/shell/components/AsOfChip.js';
|
|
11
|
+
export function AsOfChip({ offset }) {
|
|
12
|
+
if (!offset)
|
|
13
|
+
return null;
|
|
14
|
+
const moment = formatDateTime(new Date(Date.now() + offset), { dateStyle: 'medium', timeStyle: 'short' });
|
|
15
|
+
return (_jsx("span", { id: "as-of-chip", className: "as-of-chip", title: say('whyAsOf'), children: say('asOf', { moment }) }));
|
|
16
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
.chart-bar { fill: color-mix(in srgb, var(--chart-1, var(--accent)) 26%, var(--surface)); rx: min(4px, var(--radius)); }
|
|
8
8
|
.chart-bar.is-active { fill: var(--chart-1, var(--accent)); }
|
|
9
9
|
/* A bar of a state wears its tone, as the state's dot does. */
|
|
10
|
+
.chart-bar.is-partial { fill-opacity: 0.55; stroke: var(--chart-1, var(--accent)); stroke-width: 1; stroke-dasharray: 3 2; }
|
|
10
11
|
.chart-bar.is-toned { fill: color-mix(in srgb, var(--bar-ink) 40%, var(--surface)); }
|
|
11
12
|
.chart-bar.is-toned.is-active { fill: var(--bar-ink); }
|
|
12
13
|
.chart-bar-guide { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
|
|
@@ -78,6 +79,8 @@
|
|
|
78
79
|
.chart-wait-donut { aspect-ratio: auto; border-bottom: 0; background: none; }
|
|
79
80
|
.chart-line { display: block; width: 100%; height: auto; }
|
|
80
81
|
.chart-stroke { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
|
|
82
|
+
.chart-stroke.is-partial { stroke-dasharray: 4 4; }
|
|
83
|
+
.chart-dot.is-partial { fill: var(--surface); stroke-dasharray: 2 2; }
|
|
81
84
|
.chart-area { fill: var(--accent); opacity: 0.08; }
|
|
82
85
|
.chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
|
|
83
86
|
.chart-dot-solid { fill: var(--accent); }
|
|
@@ -48,7 +48,7 @@ export declare function axisMarks(keys: string[], at: (i: number) => number, { c
|
|
|
48
48
|
* run through them. Every point is also a row of a table that assistive
|
|
49
49
|
* technology reads, since a picture's titles are not.
|
|
50
50
|
*/
|
|
51
|
-
export declare function LineChart({ rows, say, wide, high, target, smooth, dots, seriesLabel, seriesVocabulary, onPick, }: {
|
|
51
|
+
export declare function LineChart({ rows, say, wide, high, target, smooth, dots, seriesLabel, seriesVocabulary, onPick, partial, }: {
|
|
52
52
|
/** With `series` on its rows, a line per series (MultiLine). */
|
|
53
53
|
rows: Array<ChartRow & {
|
|
54
54
|
series?: unknown;
|
|
@@ -67,8 +67,15 @@ export declare function LineChart({ rows, say, wide, high, target, smooth, dots,
|
|
|
67
67
|
/** Where a point goes when it drills, by its raw key: single-series lines only — a multi-series line takes no
|
|
68
68
|
drill, since one pick cannot name both a series and a point. */
|
|
69
69
|
onPick?: ((value: unknown) => void) | null;
|
|
70
|
+
/** Buckets the window cuts through: drawn dashed and named partial, single-series lines only. */
|
|
71
|
+
partial?: PartialPeriods;
|
|
70
72
|
}): import("react").JSX.Element;
|
|
71
73
|
export declare function namesAtEnds(ends: readonly number[], top: number, bottom: number, gap?: number): number[];
|
|
74
|
+
/** The periods a window cuts through (shared/autoBucket.ts `partialPeriods`): a bucket drawn from only part of its days. */
|
|
75
|
+
export interface PartialPeriods {
|
|
76
|
+
keys: ReadonlySet<string>;
|
|
77
|
+
unit: 'week' | 'month' | 'quarter';
|
|
78
|
+
}
|
|
72
79
|
/**
|
|
73
80
|
* Bars: one series, a bar per group — how much each week or each stage
|
|
74
81
|
* holds, where a line says how a number moved. Over calendar buckets one bar
|
|
@@ -86,13 +93,15 @@ export declare function namesAtEnds(ends: readonly number[], top: number, bottom
|
|
|
86
93
|
* The levels are on the left, in a gutter of their own, and every bar is a
|
|
87
94
|
* row of a table assistive technology reads, as a line's points are.
|
|
88
95
|
*/
|
|
89
|
-
export declare function BarChart({ rows, say, label, wide, high, target, tone, }: {
|
|
96
|
+
export declare function BarChart({ rows, say, label, wide, high, target, tone, partial, }: {
|
|
90
97
|
rows: ChartRow[];
|
|
91
98
|
say?: Say;
|
|
92
99
|
label?: (key: unknown) => string;
|
|
93
100
|
wide?: number;
|
|
94
101
|
high?: number;
|
|
95
102
|
target?: number;
|
|
103
|
+
/** Buckets the window cuts through: drawn lighter with a dashed edge, and named partial. */
|
|
104
|
+
partial?: PartialPeriods;
|
|
96
105
|
/** A category's display tone (a state's, a status's), where its column has them: each bar wears the ink its dot and badge wear. */
|
|
97
106
|
tone?: (key: unknown) => string | undefined;
|
|
98
107
|
}): import("react").JSX.Element;
|
|
@@ -149,12 +149,12 @@ function linePath(pts, smooth = false) {
|
|
|
149
149
|
* run through them. Every point is also a row of a table that assistive
|
|
150
150
|
* technology reads, since a picture's titles are not.
|
|
151
151
|
*/
|
|
152
|
-
export function LineChart({ rows, say = String, wide = 600, high, target, smooth = false, dots = false, seriesLabel = String, seriesVocabulary, onPick, }) {
|
|
152
|
+
export function LineChart({ rows, say = String, wide = 600, high, target, smooth = false, dots = false, seriesLabel = String, seriesVocabulary, onPick, partial, }) {
|
|
153
153
|
if (rows.some((row) => row.series !== undefined))
|
|
154
154
|
return (_jsx(MultiLine, { rows: rows, say: say, wide: wide, high: high, target: target, smooth: smooth, seriesLabel: seriesLabel, vocabulary: seriesVocabulary }));
|
|
155
|
-
return _jsx(OneLine, { rows: rows, say: say, wide: wide, high: high, target: target, smooth: smooth, dots: dots, onPick: onPick });
|
|
155
|
+
return (_jsx(OneLine, { rows: rows, say: say, wide: wide, high: high, target: target, smooth: smooth, dots: dots, onPick: onPick, partial: partial }));
|
|
156
156
|
}
|
|
157
|
-
function OneLine({ rows, say, wide, high, target, smooth, dots, onPick, }) {
|
|
157
|
+
function OneLine({ rows, say, wide, high, target, smooth, dots, onPick, partial, }) {
|
|
158
158
|
const points = fillGaps(rows
|
|
159
159
|
.map((r) => ({ key: r.key == null ? '—' : String(r.key), value: Number(r.value), raw: r.key }))
|
|
160
160
|
.filter((p) => Number.isFinite(p.value)));
|
|
@@ -214,8 +214,15 @@ function OneLine({ rows, say, wide, high, target, smooth, dots, onPick, }) {
|
|
|
214
214
|
/* A point is named with its year wherever it stands alone — a dot's
|
|
215
215
|
title, the crosshair, the table — and the axis drops the year a tick
|
|
216
216
|
shares with the one before it. */
|
|
217
|
-
const named = points.map((p) => periodTick(p.key));
|
|
217
|
+
const named = points.map((p) => partialName(periodTick(p.key), p.key, partial));
|
|
218
218
|
const marks = axisMarks(points.map((p) => p.key), x);
|
|
219
|
+
/* A window cuts only its first and last bucket: the line is solid through the whole ones and dashed to and from a
|
|
220
|
+
partial one, so a week still in hand does not read as the measure falling. */
|
|
221
|
+
const cut = points.map((p) => Boolean(partial?.keys.has(p.key)));
|
|
222
|
+
const last = points.length - 1;
|
|
223
|
+
const whole = [cut[0] ? 1 : 0, cut[last] ? last - 1 : last];
|
|
224
|
+
const hasWhole = whole[1] - whole[0] >= 1;
|
|
225
|
+
const through = (from, to) => linePath(points.slice(from, to + 1).map((p, i) => [x(from + i), y(p.value)]), smooth);
|
|
219
226
|
const onMove = (e) => {
|
|
220
227
|
// screen-px: clientX is a screen-pixel ruler too; the ratio maps it into viewBox units.
|
|
221
228
|
const box = svg.current.getBoundingClientRect();
|
|
@@ -234,8 +241,8 @@ function OneLine({ rows, say, wide, high, target, smooth, dots, onPick, }) {
|
|
|
234
241
|
fails a button inside role="img", as a donut's does. Where nothing
|
|
235
242
|
drills it stays an image, as before. */
|
|
236
243
|
const anyDrillable = onPick && points.some((p) => p.raw != null);
|
|
237
|
-
return (_jsxs(_Fragment, { children: [_jsxs("svg", { ref: svg, className: "chart-line", viewBox: `0 0 ${W} ${H}`, role: anyDrillable ? 'group' : 'img', "aria-label": `${sayCopy('lineSummary', { count: points.length, from: say(points[0].value), to: say(points[points.length - 1].value), peak: say(Math.max(...points.map((p) => p.value))) })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, onPointerMove: onMove, onPointerLeave: () => setNear(null), 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}`))), 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) }) })] })), !dots && _jsx("path", { className: "chart-area", d: area }), !dots && _jsx("path", { className: "chart-stroke", d: line }), points.map((p, i) => {
|
|
238
|
-
const dot = (_jsx("circle", { className: dots && p.value !== 0 ? 'chart-dot chart-dot-solid' : 'chart-dot'
|
|
244
|
+
return (_jsxs(_Fragment, { children: [_jsxs("svg", { ref: svg, className: "chart-line", viewBox: `0 0 ${W} ${H}`, role: anyDrillable ? 'group' : 'img', "aria-label": `${sayCopy('lineSummary', { count: points.length, from: say(points[0].value), to: say(points[points.length - 1].value), peak: say(Math.max(...points.map((p) => p.value))) })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, onPointerMove: onMove, onPointerLeave: () => setNear(null), 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}`))), 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) }) })] })), !dots && _jsx("path", { className: "chart-area", d: area }), !dots && (hasWhole || !cut.some(Boolean)) && _jsx("path", { className: "chart-stroke", d: hasWhole ? through(whole[0], whole[1]) : line }), !dots && cut.some(Boolean) && !hasWhole && _jsx("path", { className: "chart-stroke is-partial", d: line }), !dots && hasWhole && whole[0] > 0 && _jsx("path", { className: "chart-stroke is-partial", d: through(0, whole[0]) }), !dots && hasWhole && whole[1] < last && _jsx("path", { className: "chart-stroke is-partial", d: through(whole[1], last) }), points.map((p, i) => {
|
|
245
|
+
const dot = (_jsx("circle", { className: `${dots && p.value !== 0 ? 'chart-dot chart-dot-solid' : 'chart-dot'}${cut[i] ? ' is-partial' : ''}`, cx: f1(x(i)), cy: f1(y(p.value)), r: dots ? 4 : 3, children: _jsx("title", { children: `${named[i]}: ${say(p.value)}` }) }));
|
|
239
246
|
/* A point drills where a door is wanted: the same raw value a
|
|
240
247
|
legend button would carry. A dot is too small a target to be
|
|
241
248
|
the button itself, so a drillable point is a group holding the
|
|
@@ -412,6 +419,10 @@ function MultiLine({ rows, say, wide, high, target, smooth, seriesLabel, vocabul
|
|
|
412
419
|
}), marks.map(({ index, text }) => (_jsx("text", { className: "chart-tick chart-x-tick", x: f1(x(index)), y: H - 6, textAnchor: index === 0 ? 'start' : index === keys.length - 1 ? 'end' : 'middle', children: text }, `m${index}`))), _jsxs("g", { className: "chart-cursor", ...(near === null ? { hidden: true } : {}), children: [_jsx("line", { className: "chart-cursor-line", x1: f1(cx), x2: f1(cx), y1: PAD.top, y2: H - PAD.bottom }), near !== null &&
|
|
413
420
|
shown.map((line) => (_jsx("circle", { className: "chart-cursor-dot", style: { fill: line.color }, cx: f1(cx), cy: f1(y(line.values[near])), r: 4 }, line.id)))] })] }), near !== null && (_jsxs("div", { className: "chart-tip-card", "aria-hidden": "true", style: right ? { right: `${((W - cx) / W) * 100}%`, marginRight: 10 } : { left: `${(cx / W) * 100}%`, marginLeft: 10 }, children: [_jsx("div", { className: "chart-tip-title", children: ticks[near] }), shown.map((line) => (_jsxs("div", { className: "chart-tip-row", children: [_jsx("span", { className: "chart-dot-key", style: { background: line.color } }), _jsx("span", { className: "chart-tip-name", children: line.label }), _jsx("span", { className: "chart-tip-value", children: say(line.values[near]) })] }, line.id)))] }))] }), _jsx("div", { className: "visually-hidden", children: _jsxs("table", { className: "chart-data", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("td", {}), shown.map((line) => (_jsx("th", { scope: "col", children: line.label }, line.id)))] }) }), _jsx("tbody", { children: keys.map((key, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: ticks[i] }), shown.map((line) => (_jsx("td", { children: say(line.values[i]) }, line.id)))] }, key))) })] }) })] }));
|
|
414
421
|
}
|
|
422
|
+
/** A bucket's name, said as partial where its window cuts it, so a short first week and a week still in hand are not read as full ones. */
|
|
423
|
+
const partialName = (label, key, partial) => partial?.keys.has(String(key))
|
|
424
|
+
? sayCopy(partial.unit === 'week' ? 'partialWeek' : partial.unit === 'month' ? 'partialMonth' : 'partialQuarter', { label })
|
|
425
|
+
: label;
|
|
415
426
|
/** Whether a key is a period the grammar buckets by ("2026-08", "2026-Q3"). */
|
|
416
427
|
const PERIOD = /^\d{4}(-\d{2}(-\d{2})?|-Q[1-4])?$/;
|
|
417
428
|
/**
|
|
@@ -431,7 +442,7 @@ const PERIOD = /^\d{4}(-\d{2}(-\d{2})?|-Q[1-4])?$/;
|
|
|
431
442
|
* The levels are on the left, in a gutter of their own, and every bar is a
|
|
432
443
|
* row of a table assistive technology reads, as a line's points are.
|
|
433
444
|
*/
|
|
434
|
-
export function BarChart({ rows, say = String, label = String, wide = 600, high, target, tone, }) {
|
|
445
|
+
export function BarChart({ rows, say = String, label = String, wide = 600, high, target, tone, partial, }) {
|
|
435
446
|
const periods = rows.length > 0 && rows.every((r) => r.key != null && PERIOD.test(String(r.key)));
|
|
436
447
|
const bars = periods
|
|
437
448
|
? 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 }))
|
|
@@ -456,7 +467,7 @@ export function BarChart({ rows, say = String, label = String, wide = 600, high,
|
|
|
456
467
|
const inks = periods || !tone ? undefined : bars.map((b) => TONE_INK[tone(b.raw) ?? '']);
|
|
457
468
|
const toned = !!inks && inks.every(Boolean);
|
|
458
469
|
const named = bars.map((b, i) => (periods ? periodTick(String(b.raw), i ? String(bars[i - 1].raw) : undefined) : label(b.raw)));
|
|
459
|
-
const whole = bars.map((b) => (periods ? periodTick(String(b.raw)) : label(b.raw)));
|
|
470
|
+
const whole = bars.map((b) => partialName(periods ? periodTick(String(b.raw)) : label(b.raw), b.raw, partial));
|
|
460
471
|
const W = measured > 0 ? measured : wide;
|
|
461
472
|
const H = high ? Math.max(120, Math.round(high)) : Math.max(160, Math.min(Math.round(W / 3), 240));
|
|
462
473
|
const goal = target !== undefined && Number.isFinite(target) ? target : undefined;
|
|
@@ -493,7 +504,7 @@ export function BarChart({ rows, say = String, label = String, wide = 600, high,
|
|
|
493
504
|
};
|
|
494
505
|
return (_jsxs(_Fragment, { children: [_jsxs("svg", { ref: svg, className: "chart-bars", viewBox: `0 0 ${W} ${H}`, role: "img", "aria-label": `${sayCopy('barsSummary', { count: bars.length, highest: say(Math.max(...bars.map((b) => b.value))), last: whole[bars.length - 1], value: say(bars[bars.length - 1].value) })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, onPointerMove: (e) => setNear(at(e)), onPointerLeave: () => setNear(null), 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}`))), active !== null && _jsx("line", { className: "chart-bar-guide", x1: PAD.left, x2: W - PAD.right, y1: f1(top), y2: f1(top) }), bars.map((b, i) => {
|
|
495
506
|
const h = Math.abs(y(b.value) - base);
|
|
496
|
-
return (_jsx("rect", { className: `chart-bar${toned ? ' is-toned' : ''}${i === active ? ' is-active' : ''}`, style: toned ? { ['--bar-ink']: inks[i] } : undefined, x: f1(x(i)), y: f1(Math.min(y(b.value), base)), width: f1(barWide), height: f1(Math.max(h, b.value ? 1 : 0)), children: _jsx("title", { children: `${whole[i]}: ${say(b.value)}` }) }, i));
|
|
507
|
+
return (_jsx("rect", { className: `chart-bar${toned ? ' is-toned' : ''}${i === active ? ' is-active' : ''}${partial?.keys.has(String(bars[i].raw)) ? ' is-partial' : ''}`, style: toned ? { ['--bar-ink']: inks[i] } : undefined, x: f1(x(i)), y: f1(Math.min(y(b.value), base)), width: f1(barWide), height: f1(Math.max(h, b.value ? 1 : 0)), children: _jsx("title", { children: `${whole[i]}: ${say(b.value)}` }) }, i));
|
|
497
508
|
}), 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, periods ? text : named[index])), y: H - 6, textAnchor: "middle", children: periods ? text : named[index] }, `m${index}`))), active !== null && (_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("div", { className: "visually-hidden", children: _jsx("table", { className: "chart-data", children: _jsx("tbody", { children: bars.map((b, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: whole[i] }), _jsx("td", { children: say(b.value) })] }, i))) }) }) })] }));
|
|
498
509
|
}
|
|
499
510
|
/**
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* the width it has, picks the shape and says what an empty answer means.
|
|
6
6
|
*/
|
|
7
7
|
import { type ReactNode } from 'react';
|
|
8
|
+
import { type PartialPeriods } from './Chart.js';
|
|
8
9
|
import type { ExtraShape } from './ChartShapes.js';
|
|
9
10
|
export type { ExtraShape };
|
|
10
11
|
export { EXTRA_SHAPES } from './dashboardModel.js';
|
|
@@ -56,10 +57,12 @@ interface ChartFigureProps {
|
|
|
56
57
|
arrange?: 'answer' | 'value' | 'category';
|
|
57
58
|
/** A line with too few filled buckets to draw a line through keeps its shape and stands its points alone. */
|
|
58
59
|
dots?: boolean;
|
|
60
|
+
/** The buckets the window cuts through, for bars and a single line to draw as partial. */
|
|
61
|
+
partial?: PartialPeriods;
|
|
59
62
|
/** Stacked bars over periods stand as columns at a fixed height (Chart.tsx), which the room is held at before the answer. */
|
|
60
63
|
timed?: boolean;
|
|
61
64
|
}
|
|
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;
|
|
65
|
+
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, partial, }: ChartFigureProps): import("react").JSX.Element;
|
|
63
66
|
interface ChartShapeFigureProps {
|
|
64
67
|
shape: ExtraShape;
|
|
65
68
|
answer: Answer | undefined;
|
|
@@ -14,7 +14,7 @@ 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, timed, }) {
|
|
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, partial, }) {
|
|
18
18
|
const stacked = shape === 'stacked';
|
|
19
19
|
const donut = shape === 'donut';
|
|
20
20
|
const bars = shape === 'bar';
|
|
@@ -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 })) : 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 }))) }));
|
|
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 }))) }));
|
|
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 }) {
|
|
@@ -22,7 +22,7 @@ import { RecordPicker } from './RecordPicker.js';
|
|
|
22
22
|
import { sessionIdentity } from '../sessionIdentity.js';
|
|
23
23
|
import { shell } from '../shellMode.js';
|
|
24
24
|
import { cancelEditInteractions, useEditInteraction } from './editInteraction.js';
|
|
25
|
-
import { formatLocale, formatTimezone } from '../locale.js';
|
|
25
|
+
import { appNow, formatLocale, formatTimezone } from '../locale.js';
|
|
26
26
|
import { DateField } from './DateField.js';
|
|
27
27
|
import { InputSlot, columnInput } from './inputRenderers.js';
|
|
28
28
|
import { say } from '../copy/record/components/Editable.js';
|
|
@@ -350,7 +350,7 @@ export function Editable({ table, row, column, recordKey, onSaved, app = false,
|
|
|
350
350
|
flight and the calendar's ownership of focus come from the same hooks as
|
|
351
351
|
the pickers above. */
|
|
352
352
|
if (app && columnKind(column.type) === 'date' && !/time/i.test(column.type)) {
|
|
353
|
-
return wrap(_jsx("div", { ref: input, inert: locked, "aria-disabled": applying || undefined, className: `cell-edit-control${statusClass}`, children: _jsx(DateField, { id: dateId, value: shown === null ? '' : String(shown), onChange: onEdit, "aria-label": label, disabled: locked, locale: formatLocale(), timezone: formatTimezone(), popupRef: interaction.popupRef, onOpenChange: interaction.onOpenChange }) }));
|
|
353
|
+
return wrap(_jsx("div", { ref: input, inert: locked, "aria-disabled": applying || undefined, className: `cell-edit-control${statusClass}`, children: _jsx(DateField, { id: dateId, value: shown === null ? '' : String(shown), onChange: onEdit, "aria-label": label, disabled: locked, locale: formatLocale(), timezone: formatTimezone(), now: appNow(), popupRef: interaction.popupRef, onOpenChange: interaction.onOpenChange }) }));
|
|
354
354
|
}
|
|
355
355
|
return wrap(_jsx("input", { ref: input, className: `cell-edit${statusClass}`, disabled: locked, readOnly: pendingWrite, "aria-disabled": applying || undefined, "aria-label": label, type: "text", value: shown === null ? '' : String(shown), "data-null": String(shown === null),
|
|
356
356
|
/* Where the database pins the vocabulary, say it — but still a text
|
|
@@ -26,7 +26,7 @@ import { Fragment, useEffect, useId, useRef, useState } from 'react';
|
|
|
26
26
|
import { keepPreviousData, useQueries, useQuery } from '@tanstack/react-query';
|
|
27
27
|
import { api, columnDisplay, findTable, labelColumn, state } from '../core.js';
|
|
28
28
|
import { batchedBreakdown } from '../breakdownBatch.js';
|
|
29
|
-
import { defaultCurrency, formatLocale, formatNumber, formatTimezone } from '../locale.js';
|
|
29
|
+
import { appNow, defaultCurrency, formatLocale, formatNumber, formatTimezone } from '../locale.js';
|
|
30
30
|
import { DateField } from './DateField.js';
|
|
31
31
|
import { Button } from '@mistriwork/ui/Button.js';
|
|
32
32
|
import { Field } from '@mistriwork/ui/Field.js';
|
|
@@ -395,7 +395,7 @@ function DateFacet({ box, tail, table, set, onEnter, more }) {
|
|
|
395
395
|
onEnter?.();
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
|
-
return (_jsxs(Facet, { box: box, tail: tail, set: set, more: more, children: [tail && !preset && !range.from && !range.to && _jsx(Unshown, { box: box, table: table, tail: tail }), _jsx("div", { className: "facet-values", children: presets.map(([label, value]) => (_jsxs("label", { className: "facet-option", children: [_jsx("input", { type: "radio", name: name, "data-value": value, checked: preset?.[1] === value, onChange: () => set(value) }), _jsx("span", { className: "facet-option-label", children: label })] }, value))) }), _jsxs("div", { className: "facet-range facet-date-range", children: [_jsxs("div", { className: "facet-range-end", children: [_jsx("label", { htmlFor: `${name}-from`, children: say('from') }), _jsx(DateField, { id: `${name}-from`, "aria-label": say('from'), className: "facet-input", value: from, max: isPickerDate(to) ? to : undefined, locale: formatLocale(), timezone: formatTimezone(), onChange: setFrom, onBlur: commit, onKeyDown: onKey })] }), _jsxs("div", { className: "facet-range-end", children: [_jsx("label", { htmlFor: `${name}-to`, children: say('to') }), _jsx(DateField, { id: `${name}-to`, "aria-label": say('to'), className: "facet-input", value: to, min: isPickerDate(from) ? from : undefined, locale: formatLocale(), timezone: formatTimezone(), onChange: setTo, onBlur: commit, onKeyDown: onKey })] })] })] }));
|
|
398
|
+
return (_jsxs(Facet, { box: box, tail: tail, set: set, more: more, children: [tail && !preset && !range.from && !range.to && _jsx(Unshown, { box: box, table: table, tail: tail }), _jsx("div", { className: "facet-values", children: presets.map(([label, value]) => (_jsxs("label", { className: "facet-option", children: [_jsx("input", { type: "radio", name: name, "data-value": value, checked: preset?.[1] === value, onChange: () => set(value) }), _jsx("span", { className: "facet-option-label", children: label })] }, value))) }), _jsxs("div", { className: "facet-range facet-date-range", children: [_jsxs("div", { className: "facet-range-end", children: [_jsx("label", { htmlFor: `${name}-from`, children: say('from') }), _jsx(DateField, { id: `${name}-from`, "aria-label": say('from'), className: "facet-input", value: from, max: isPickerDate(to) ? to : undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow(), onChange: setFrom, onBlur: commit, onKeyDown: onKey })] }), _jsxs("div", { className: "facet-range-end", children: [_jsx("label", { htmlFor: `${name}-to`, children: say('to') }), _jsx(DateField, { id: `${name}-to`, "aria-label": say('to'), className: "facet-input", value: to, min: isPickerDate(from) ? from : undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow(), onChange: setTo, onBlur: commit, onKeyDown: onKey })] })] })] }));
|
|
399
399
|
}
|
|
400
400
|
/** The shape a plain column's facet takes, judged once from its values over the view's standing rows. */
|
|
401
401
|
function useFacetShape(table, column, standing, numeric, bare = false) {
|
|
@@ -380,7 +380,7 @@ function PlatformCell({ meta, plan, value, label, display, pin, edge, photo, wra
|
|
|
380
380
|
return (_jsx("td", { className: `align-left tags-cell${pinClass}`, title: chips.map((chip) => chip.label).join(', ') || undefined, ...pinAttrs, children: chips.length ? _jsx(TagsCellList, { chips: chips }) : emptyWord() }));
|
|
381
381
|
}
|
|
382
382
|
if (value === null || value === undefined) {
|
|
383
|
-
return (_jsx("td", { className: `null align-${plan.align}${pinClass}`, title: "null", ...pinAttrs, children: emptyWord() }));
|
|
383
|
+
return (_jsx("td", { className: `null align-${plan.align}${pinClass}`, title: "null", ...pinAttrs, children: display?.empty ?? emptyWord() }));
|
|
384
384
|
}
|
|
385
385
|
const json = jsonValueOf(meta, value);
|
|
386
386
|
if (json)
|
|
@@ -39,7 +39,7 @@ import { recordKey as wireKey } from '../resourceRequests.js';
|
|
|
39
39
|
import { validateRecordEdits } from '../recordEditValidation.js';
|
|
40
40
|
import { shell } from '../shellMode.js';
|
|
41
41
|
import { sessionIdentity } from '../sessionIdentity.js';
|
|
42
|
-
import { defaultCurrency, formatLocale, formatTimezone } from '../locale.js';
|
|
42
|
+
import { appNow, defaultCurrency, formatLocale, formatTimezone } from '../locale.js';
|
|
43
43
|
import { rowCurrency } from '@mistriwork/engine/shared/money.js';
|
|
44
44
|
import { MinorMoneyInput } from './MinorMoneyInput.js';
|
|
45
45
|
import { Dropdown } from './Dropdown.js';
|
|
@@ -84,7 +84,7 @@ function PlatformControl({ table, column, value, onChange, label, id, row, onPic
|
|
|
84
84
|
return (_jsx(Dropdown, { ariaLabel: label, id: id, value: value ?? '', ariaInvalid: invalid, ariaDescribedBy: describedBy, items: [...(column.nullable ? [{ value: '', label: say('common.noValue') }] : []), ...items], onChange: change }));
|
|
85
85
|
}
|
|
86
86
|
if (columnKind(column.type) === 'date' && !/time/i.test(column.type)) {
|
|
87
|
-
return (_jsx(DateField, { id: id ?? dateId, value: value ?? '', onChange: change, "aria-label": label, "aria-invalid": invalid || undefined, "aria-describedby": describedBy, locale: formatLocale(), timezone: formatTimezone() }));
|
|
87
|
+
return (_jsx(DateField, { id: id ?? dateId, value: value ?? '', onChange: change, "aria-label": label, "aria-invalid": invalid || undefined, "aria-describedby": describedBy, locale: formatLocale(), timezone: formatTimezone(), now: appNow() }));
|
|
88
88
|
}
|
|
89
89
|
/* Money kept as minor units is typed as the figure it is ("19.99") and held as what is stored (1999). */
|
|
90
90
|
const rule = columnDisplay(table.id, column.name);
|
|
@@ -39,7 +39,7 @@ import { Dropdown, readsAsName } from './Dropdown.js';
|
|
|
39
39
|
import { RecordPicker } from './RecordPicker.js';
|
|
40
40
|
import { DateField } from './DateField.js';
|
|
41
41
|
import { isPickerDate } from '@mistriwork/ui/internal/datePickerModel.js';
|
|
42
|
-
import { formatClockZone, formatLocale, formatTimezone } from '../locale.js';
|
|
42
|
+
import { appNow, formatClockZone, formatLocale, formatTimezone } from '../locale.js';
|
|
43
43
|
import { InputSlot, columnInput } from './inputRenderers.js';
|
|
44
44
|
import { autoKey, enteredNow, isRequired, platformWritten } from '@mistriwork/engine/shared/form.js';
|
|
45
45
|
import { columnTextRule, textRuleBreak } from '@mistriwork/engine/shared/textRules.js';
|
|
@@ -680,7 +680,7 @@ export function PlatformControl({ column, app, required, assigned, spoken, targe
|
|
|
680
680
|
return (_jsx(DateField, { id: dateId, inputRef: setControl, className: "insert-input", value: value, onChange: onChange, withTime: kind === 'datetime', "aria-label": app ? spoken : `${column.name} (${column.type})`,
|
|
681
681
|
/* A day's box says the locale's pattern, as its hint does and as it reads what is typed (MM/DD/YYYY in
|
|
682
682
|
en-US; ISO is read too): the field's own (DateField.tsx). */
|
|
683
|
-
placeholder: said || (kind === 'datetime' ? say('yyyyMmDdHh') : undefined), locale: formatLocale(), timezone: formatTimezone() }));
|
|
683
|
+
placeholder: said || (kind === 'datetime' ? say('yyyyMmDdHh') : undefined), locale: formatLocale(), timezone: formatTimezone(), now: appNow() }));
|
|
684
684
|
}
|
|
685
685
|
/* Formatted text: the editor, fetched when the form first draws one. A new record has no row yet for a
|
|
686
686
|
picture to be attached to, so it takes pictures once it is saved and edited. */
|
|
@@ -281,7 +281,7 @@ export function FieldsSection({ page, section, index, base, recordKey: key, fold
|
|
|
281
281
|
/* A text a section is only about, with nothing in it, is one muted line saying so, not a dash alone in the
|
|
282
282
|
room of a paragraph. */
|
|
283
283
|
const about = Boolean(section.title) && paths.length === 1 && !rail && column?.references === undefined;
|
|
284
|
-
dd = adorned ? (_jsx("dd", { className: "page-field-adorned", children: adorned })) : about ? (_jsx("dd", { className: "page-prose-empty", children: say('noneYet', { caption: (columnLabel(base.id, path, stem) ?? path).toLowerCase() }) })) : (_jsx("dd", { className: "null", title: "null", children: emptyWord() }));
|
|
284
|
+
dd = adorned ? (_jsx("dd", { className: "page-field-adorned", children: adorned })) : about ? (_jsx("dd", { className: "page-prose-empty", children: say('noneYet', { caption: (columnLabel(base.id, path, stem) ?? path).toLowerCase() }) })) : (_jsx("dd", { className: "null", title: "null", children: columnDisplay(base.id, path)?.empty ?? emptyWord() }));
|
|
285
285
|
}
|
|
286
286
|
else if (column?.references && String(value) !== '') {
|
|
287
287
|
const labelAt = refLabels.get(path);
|
|
@@ -718,7 +718,7 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
|
|
|
718
718
|
: (row) => {
|
|
719
719
|
const record = recordForRow(row);
|
|
720
720
|
return { ...record, label: withoutParent(record.label, recordName) };
|
|
721
|
-
} })] })), _jsx("div", { className: "result-table", children: ((grid) => rowVerbs ? (_jsxs(RowTrailHosts, { children: [_jsx(RowActions, { table: table, rows: gridRows, actions: rowVerbs, onDone: () => {
|
|
721
|
+
} })] })), _jsx("div", { className: "result-table", children: ((grid) => rowVerbs ? (_jsxs(RowTrailHosts, { children: [_jsx(RowActions, { table: table, rows: gridRows, actions: rowVerbs, labelOf: (row) => recordForRow(row).label, onDone: () => {
|
|
722
722
|
refreshLists();
|
|
723
723
|
onActionDone?.();
|
|
724
724
|
} }), grid] })) : (grid))(_jsx(Grid, { table: table, sizing: section.sizing, data: { ...got, rows: gridRows, columns: [...(got.columns ?? columnsOf()), ...keyNames] }, hide: keyNames.length ? [...hidden, ...keyNames] : hidden, referenceLabels: labelColumns, totals: totals, totalsLabel: totalsLabel, interactive: false, virtual: false,
|
|
@@ -24,10 +24,15 @@ import { addHostListener, removeHostListener } from '../shellHost.js';
|
|
|
24
24
|
const SETTLE_MS = 320;
|
|
25
25
|
/** Fields shown before the card stops listing. */
|
|
26
26
|
const FIELDS = 6;
|
|
27
|
-
/**
|
|
27
|
+
/** Whether a record's name is a computed `$label` (an App's `recordLabel`): a path the card says as its heading, never as a row. */
|
|
28
|
+
const namedByLabel = (label) => label === '$label';
|
|
29
|
+
/** The key first, then the label column, then whatever else fits. A record named by its `$label` leads with that
|
|
30
|
+
instead and leaves its key out: the key is an internal the name stands in for. */
|
|
28
31
|
function fieldsFor(table) {
|
|
29
32
|
const key = table.columns.filter((c) => c.primaryKey).map((c) => c.name);
|
|
30
33
|
const label = labelPath(table);
|
|
34
|
+
if (namedByLabel(label))
|
|
35
|
+
return [label, ...table.columns.map((c) => c.name).filter((n) => !key.includes(n))].slice(0, FIELDS + 1);
|
|
31
36
|
return [
|
|
32
37
|
...key,
|
|
33
38
|
...(label && !key.includes(label) ? [label] : []),
|
|
@@ -89,6 +94,7 @@ export function PeekLayer() {
|
|
|
89
94
|
function PeekCard({ target }) {
|
|
90
95
|
const { chip, table, column, value } = target;
|
|
91
96
|
const fields = fieldsFor(table);
|
|
97
|
+
const label = labelPath(table);
|
|
92
98
|
const columns = presentationColumns(state.schema, table, fields);
|
|
93
99
|
/* The connection is part of the key: staging's employee must not show for
|
|
94
100
|
production's reference. */
|
|
@@ -154,5 +160,8 @@ function PeekCard({ target }) {
|
|
|
154
160
|
if (!row.data || !chip.isConnected)
|
|
155
161
|
return null;
|
|
156
162
|
const data = row.data;
|
|
157
|
-
|
|
163
|
+
const named = namedByLabel(label) && data[label] != null && String(data[label]) !== '';
|
|
164
|
+
return (_jsxs("div", { className: "peek", role: "tooltip", ref: card, children: [_jsxs("div", { className: "peek-head", children: [_jsx("span", { className: "peek-table", children: table.name }), _jsx("span", { className: "peek-key", children: named ? String(data[label]) : value })] }), _jsx("div", { className: "peek-body", children: fields
|
|
165
|
+
.filter((name) => !namedByLabel(name))
|
|
166
|
+
.map((name) => (_jsxs("div", { className: "peek-line", children: [_jsx("span", { className: "peek-name", title: name, children: columnLabel(table.id, name) ?? name }), data[name] === null || data[name] === undefined ? (_jsx("span", { className: "peek-value null", title: "null", children: emptyWord() })) : (_jsx("div", { className: "peek-value", children: _jsx(Value, { col: columns.get(name), value: data[name], tableId: table.id, compact: true }) }))] }, name))) }), _jsx("div", { className: "peek-foot", children: say('clickToOpen') })] }));
|
|
158
167
|
}
|
|
@@ -10,7 +10,7 @@ import { DateField } from './DateField.js';
|
|
|
10
10
|
import { Button } from '@mistriwork/ui/Button.js';
|
|
11
11
|
import { Field } from '@mistriwork/ui/Field.js';
|
|
12
12
|
import { isPickerDate, isPickerDateTime } from '@mistriwork/ui/internal/datePickerModel.js';
|
|
13
|
-
import { formatLocale, formatTimezone } from '../locale.js';
|
|
13
|
+
import { appNow, formatLocale, formatTimezone } from '../locale.js';
|
|
14
14
|
import { say } from '../copy/shell/components/Prompt.js';
|
|
15
15
|
/** A modal that resolves once, whatever path closes it — Escape included. */
|
|
16
16
|
export function PromptDialog({ title, label, value = '', hint, confirmLabel = say('common.save'), placeholder, type = 'text', multiline = false, onDone, }) {
|
|
@@ -44,7 +44,7 @@ export function PromptDialog({ title, label, value = '', hint, confirmLabel = sa
|
|
|
44
44
|
input.current = node;
|
|
45
45
|
}, className: "field-control prompt-multiline", rows: 10, defaultValue: value, placeholder: placeholder ?? '' })) : dateOnly || dateTime ? (_jsx(DateField, { id: fieldId, inputRef: (node) => {
|
|
46
46
|
input.current = node;
|
|
47
|
-
}, value: date, onChange: setDate, withTime: dateTime, className: "field-control", "aria-label": label, placeholder: dateTime ? undefined : placeholder, locale: formatLocale(), timezone: formatTimezone() })) : (_jsx("input", { ref: (node) => {
|
|
47
|
+
}, value: date, onChange: setDate, withTime: dateTime, className: "field-control", "aria-label": label, placeholder: dateTime ? undefined : placeholder, locale: formatLocale(), timezone: formatTimezone(), now: appNow() })) : (_jsx("input", { ref: (node) => {
|
|
48
48
|
input.current = node;
|
|
49
49
|
}, type: type, className: "field-control", defaultValue: value, placeholder: placeholder ?? '' })) }), hint ? _jsx("p", { className: "confirm-params", children: hint }) : null, _jsxs("div", { className: "confirm-actions", children: [_jsx(Button, { intent: "secondary", onClick: () => {
|
|
50
50
|
finish(null);
|
|
@@ -88,7 +88,7 @@ export function RangeDialog({ title, fromLabel, toLabel, hint, type = 'text', pl
|
|
|
88
88
|
return (_jsx(Modal, { className: "confirm", ref: dialog, onClose: () => finish(null), initialFocus: from, children: _jsxs("form", { onSubmit: (e) => {
|
|
89
89
|
e.preventDefault();
|
|
90
90
|
submit();
|
|
91
|
-
}, children: [_jsx("h2", { children: title }), _jsxs("div", { className: "confirm-fields", children: [_jsx(Field, { label: fromLabel, id: `${fieldId}-from`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-from`, inputRef: from, value: fromDate, onChange: setFromDate, className: "field-control", withTime: type === 'datetime-local', "aria-label": fromLabel, placeholder: type === 'date' ? placeholder : undefined, locale: formatLocale(), timezone: formatTimezone() })) : (_jsx("input", { ref: from, type: type, className: "field-control", placeholder: placeholder ?? '' })) }), _jsx(Field, { label: toLabel, id: `${fieldId}-to`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-to`, inputRef: to, value: toDate, onChange: setToDate, className: "field-control", withTime: type === 'datetime-local', "aria-label": toLabel, placeholder: type === 'date' ? placeholder : undefined, locale: formatLocale(), timezone: formatTimezone() })) : (_jsx("input", { ref: to, type: type, className: "field-control", placeholder: placeholder ?? '' })) })] }), hint ? _jsx("p", { className: "confirm-params", children: hint }) : null, _jsxs("div", { className: "confirm-actions", children: [_jsx(Button, { intent: "secondary", onClick: () => {
|
|
91
|
+
}, children: [_jsx("h2", { children: title }), _jsxs("div", { className: "confirm-fields", children: [_jsx(Field, { label: fromLabel, id: `${fieldId}-from`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-from`, inputRef: from, value: fromDate, onChange: setFromDate, className: "field-control", withTime: type === 'datetime-local', "aria-label": fromLabel, placeholder: type === 'date' ? placeholder : undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow() })) : (_jsx("input", { ref: from, type: type, className: "field-control", placeholder: placeholder ?? '' })) }), _jsx(Field, { label: toLabel, id: `${fieldId}-to`, children: calendar ? (_jsx(DateField, { id: `${fieldId}-to`, inputRef: to, value: toDate, onChange: setToDate, className: "field-control", withTime: type === 'datetime-local', "aria-label": toLabel, placeholder: type === 'date' ? placeholder : undefined, locale: formatLocale(), timezone: formatTimezone(), now: appNow() })) : (_jsx("input", { ref: to, type: type, className: "field-control", placeholder: placeholder ?? '' })) })] }), hint ? _jsx("p", { className: "confirm-params", children: hint }) : null, _jsxs("div", { className: "confirm-actions", children: [_jsx(Button, { intent: "secondary", onClick: () => {
|
|
92
92
|
finish(null);
|
|
93
93
|
dialog.current?.close();
|
|
94
94
|
}, children: say('common.cancel') }), _jsx(Button, { intent: "primary", type: "submit", children: say('common.apply') })] })] }) }));
|
|
@@ -26,7 +26,7 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
26
26
|
import { motionStill } from '../motionStill.js';
|
|
27
27
|
import { readRecordSource, shareRecordSource } from '../recordSource.js';
|
|
28
28
|
import { equalityFilter, pathEqualityFilter, recordKey } from '../resourceRequests.js';
|
|
29
|
-
import { api, beginNavigation, emptyWord, findTable, go, keyOf, labelPath, loadJson, openRecord, pageView, prefersPages, primaryKey, quote, refsTo, rowLabel, saveJson, setExplain, state, tableView, toast, } from '../core.js';
|
|
29
|
+
import { api, beginNavigation, columnDisplay, emptyWord, findTable, go, keyOf, labelPath, loadJson, openRecord, pageView, prefersPages, primaryKey, quote, refsTo, rowLabel, saveJson, setExplain, state, tableView, toast, } from '../core.js';
|
|
30
30
|
import { formatNumber } from '../locale.js';
|
|
31
31
|
import { copyPosition, positionOf } from '../handoff.js';
|
|
32
32
|
import { pagesFor } from '../page.js';
|
|
@@ -195,7 +195,7 @@ function FieldRow({ table, entry, col, value, canEdit, refresh, }) {
|
|
|
195
195
|
dd = (_jsx("dd", { children: _jsx(Editable, { table: table, row: row, column: col, recordKey: entry.key, onSaved: refresh }) }));
|
|
196
196
|
}
|
|
197
197
|
else if (isNull) {
|
|
198
|
-
dd = (_jsx("dd", { className: "null", title: "null", children: emptyWord() }));
|
|
198
|
+
dd = (_jsx("dd", { className: "null", title: "null", children: columnDisplay(table.id, col.name)?.empty ?? emptyWord() }));
|
|
199
199
|
}
|
|
200
200
|
else if (col.references && String(value) !== '') {
|
|
201
201
|
/* A foreign key is the forward walk: jump to the row it points at. */
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
2
2
|
import type { AppAction } from '@mistriwork/engine/schema/model.js';
|
|
3
|
-
export declare function RowActions({ table, rows, actions, onDone, }: {
|
|
3
|
+
export declare function RowActions({ table, rows, actions, onDone, labelOf, }: {
|
|
4
4
|
table: TableMeta;
|
|
5
5
|
rows: Array<Record<string, unknown>>;
|
|
6
6
|
actions: AppAction[];
|
|
7
7
|
onDone: () => void;
|
|
8
|
+
/** How the page names a row where the row alone cannot: a related list's rows hold the resource's `recordLabel` under a private projection, not under the table's own label path. */
|
|
9
|
+
labelOf?: (row: Record<string, unknown>) => string;
|
|
8
10
|
}): import("react").JSX.Element;
|
|
@@ -34,7 +34,7 @@ function RowMenu({ table, record, label, actions, onDone, }) {
|
|
|
34
34
|
const connection = state.activeConnection ?? undefined;
|
|
35
35
|
return (_jsx("span", { className: "row-actions", onClick: (event) => event.stopPropagation(), children: _jsx(ActionBar, { tableId: table.id, actions: actions, recordKey: record, label: label, matches: (when) => rootMatches(table, record, when, connection), canUpdate: writeAllowed(table.id), grantedCommands: shell().app()?.grantedCommands ?? [], grantedActions: grantedActionIds(shell().app(), table.id), menuOnly: { label, open, onOpenChange: setOpen }, onDone: onDone }) }));
|
|
36
36
|
}
|
|
37
|
-
export function RowActions({ table, rows, actions, onDone, }) {
|
|
37
|
+
export function RowActions({ table, rows, actions, onDone, labelOf, }) {
|
|
38
38
|
const store = useRowTrailScope();
|
|
39
39
|
if (!store)
|
|
40
40
|
return null;
|
|
@@ -43,7 +43,7 @@ export function RowActions({ table, rows, actions, onDone, }) {
|
|
|
43
43
|
if (!key)
|
|
44
44
|
return null;
|
|
45
45
|
const id = bulkKey(table, key);
|
|
46
|
-
const label = String(rowLabel(table, row) ?? say('common.untitled'));
|
|
46
|
+
const label = String((labelOf ? labelOf(row) : rowLabel(table, row)) ?? say('common.untitled'));
|
|
47
47
|
return (_jsx(RowDecoration, { rowKey: id, store: store, children: _jsx(RowMenu, { table: table, record: key, label: label, actions: actions, onDone: onDone }) }, id));
|
|
48
48
|
}) }));
|
|
49
49
|
}
|
|
@@ -154,6 +154,13 @@ export function Sidebar({ host, footerHost: suppliedFooterHost, onSelect, tabNav
|
|
|
154
154
|
useLayoutEffect(() => {
|
|
155
155
|
host.classList.toggle('skimming', skimming);
|
|
156
156
|
}, [host, skimming]);
|
|
157
|
+
/* The current row is brought clear of the foot's fade (features.css `scroll-padding-bottom`): a page you are on that
|
|
158
|
+
sits under the fade reads as greyed out, as if disabled. */
|
|
159
|
+
useLayoutEffect(() => {
|
|
160
|
+
if (current < 0)
|
|
161
|
+
return;
|
|
162
|
+
host.querySelector(':scope > li > [aria-current="true"]')?.scrollIntoView?.({ block: 'nearest' });
|
|
163
|
+
}, [host, current, dashView, formView]);
|
|
157
164
|
const rail = !tabNavigation && railed();
|
|
158
165
|
const folded = useSyncExternalStore(subscribeFold, foldedNow, () => false);
|
|
159
166
|
const hover = (label) => (rail && folded ? label : undefined);
|
|
@@ -83,6 +83,9 @@ function CopyValue({ value, label }) {
|
|
|
83
83
|
}
|
|
84
84
|
function DrawnValue(props) {
|
|
85
85
|
const { col, value, tableId, compact = false, rule } = props;
|
|
86
|
+
/* A missing value is said in the App's own word where its rule gives one ("Open", "Never"), not as a dash. */
|
|
87
|
+
if ((value === null || value === undefined) && rule?.empty)
|
|
88
|
+
return (_jsx("span", { className: "null", title: "null", children: rule.empty }));
|
|
86
89
|
/* The App's own renderer, where its display rule names one: the value drawn
|
|
87
90
|
the platform's way until it has arrived, and whenever it cannot draw. An
|
|
88
91
|
empty value is the platform's to say, as it is in a grid cell. */
|
|
@@ -10,6 +10,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
* An ordered strip reads as a way travelled: a passed step's mark is filled
|
|
11
11
|
* in the ink, the current one in the accent, the steps ahead hollow, and a
|
|
12
12
|
* hairline joins each step to the next — in the ink where it has been walked.
|
|
13
|
+
*
|
|
14
|
+
* With one or two states there is no way to show: the head's chip already says where the record is, so the strip is
|
|
15
|
+
* drawn from three states up and a shorter one is left out.
|
|
13
16
|
*/
|
|
14
17
|
import { useLayoutEffect, useRef } from 'react';
|
|
15
18
|
import { workflowLabel } from '@mistriwork/engine/shared/pageModel.js';
|
|
@@ -31,6 +34,8 @@ export function WorkflowStatus({ definition, value, reachable, }) {
|
|
|
31
34
|
ol.scrollLeft = Math.max(0, from.offsetLeft - ol.offsetLeft);
|
|
32
35
|
edges(ol);
|
|
33
36
|
}, [current]);
|
|
37
|
+
if (definition.steps.length < 3)
|
|
38
|
+
return null;
|
|
34
39
|
return (_jsxs("div", { className: "workflow-status", children: [_jsx("ol", { ref: strip, onScroll: (event) => edges(event.currentTarget), "aria-label": say('workflowStatus'), className: "workflow-steps", "data-scrolls": "", "data-ordered": definition.ordered === true || undefined, children: definition.steps.map((step, index) => {
|
|
35
40
|
const passed = definition.ordered === true && known && index < current;
|
|
36
41
|
const next = index !== current && reachable?.has(String(step.value)) === true;
|
|
@@ -23,7 +23,7 @@ import { columnKind, isFlagColumn } from '@mistriwork/engine/shared/schema.js';
|
|
|
23
23
|
import { maskQuoted, sortFields, splitConditions, splitQuery } from '../clauses.js';
|
|
24
24
|
import { andWords, joined, squeeze, ungroup, written } from './conditionText.js';
|
|
25
25
|
import { unquote } from '../filterbar.js';
|
|
26
|
-
import { defaultCurrency, formatDate, formatMoney, formatNumber, formatPercent } from '../locale.js';
|
|
26
|
+
import { appNow, defaultCurrency, formatDate, formatMoney, formatNumber, formatPercent } from '../locale.js';
|
|
27
27
|
import { messageLanguage } from '../messages.js';
|
|
28
28
|
import { say as sayCopy } from '../copy/filters/components/conditionWords.js';
|
|
29
29
|
import { withUnit, wordFor } from './valueModel.js';
|
|
@@ -98,7 +98,7 @@ function datePhrase(value) {
|
|
|
98
98
|
if (value.quoted)
|
|
99
99
|
return undefined;
|
|
100
100
|
const p = value.text.toLowerCase().trim();
|
|
101
|
-
if (!dateWindow(p,
|
|
101
|
+
if (!dateWindow(p, appNow()))
|
|
102
102
|
return undefined;
|
|
103
103
|
if (Object.hasOwn(FIXED_PHRASES, p))
|
|
104
104
|
return { words: FIXED_PHRASES[p](), span: false };
|
|
@@ -111,7 +111,7 @@ function datePhrase(value) {
|
|
|
111
111
|
}
|
|
112
112
|
const ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:[T ][\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
113
113
|
function shortDate(text) {
|
|
114
|
-
const sameYear = text.slice(0, 4) === String(
|
|
114
|
+
const sameYear = text.slice(0, 4) === String(appNow().getFullYear());
|
|
115
115
|
return formatDate(text, { month: 'short', day: 'numeric', ...(sameYear ? {} : { year: 'numeric' }) });
|
|
116
116
|
}
|
|
117
117
|
/** Whether a column is read as a masked value: nothing it is compared with is ever said. */
|
|
@@ -12,7 +12,7 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
12
12
|
import { api, state } from '../core.js';
|
|
13
13
|
import { ownedBy } from '../requestIdentity.js';
|
|
14
14
|
import { equalityFilter } from '../resourceRequests.js';
|
|
15
|
-
import { formatClockZone } from '../locale.js';
|
|
15
|
+
import { appNow, formatClockZone } from '../locale.js';
|
|
16
16
|
import { formDefaultWord } from '@mistriwork/engine/shared/formValues.js';
|
|
17
17
|
import { primaryKey } from '@mistriwork/engine/shared/schema.js';
|
|
18
18
|
import { clockDefault } from './newRecordModel.js';
|
|
@@ -61,7 +61,7 @@ export function formWords(table, form, app) {
|
|
|
61
61
|
export function resolvedForm(form, words, me = {}) {
|
|
62
62
|
if (!words.length)
|
|
63
63
|
return form;
|
|
64
|
-
const now =
|
|
64
|
+
const now = appNow();
|
|
65
65
|
const resolved = { ...(form?.defaults ?? {}) };
|
|
66
66
|
for (const { column, word } of words) {
|
|
67
67
|
if (word !== 'me')
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and what is missing or changed before the values are written.
|
|
6
6
|
*/
|
|
7
7
|
import { coerceForColumn, columnKind, isFlagColumn } from '@mistriwork/engine/shared/schema.js';
|
|
8
|
+
import { appNow } from '../locale.js';
|
|
8
9
|
import { autoKey, formShownFields, isRequired } from '@mistriwork/engine/shared/form.js';
|
|
9
10
|
import { evaluateFormCondition, typedValue } from '@mistriwork/engine/shared/formValues.js';
|
|
10
11
|
import { computedColumnMeta } from '@mistriwork/engine/shared/computed.js';
|
|
@@ -21,7 +22,8 @@ export function isFormFieldVisible(form, column, values, table) {
|
|
|
21
22
|
const computed = Object.entries(table.computed ?? {});
|
|
22
23
|
if (!computed.length)
|
|
23
24
|
return evaluateFormCondition(condition, values, table.columns) !== false;
|
|
24
|
-
const
|
|
25
|
+
const now = appNow();
|
|
26
|
+
const clock = { today: now.toISOString().slice(0, 10), now, me: null };
|
|
25
27
|
const worked = Object.fromEntries(computed.map(([name, value]) => {
|
|
26
28
|
const result = evaluateComputed(value.expr, clock, (path) => typedValue(table, path, values[path]));
|
|
27
29
|
return [
|
|
@@ -2,6 +2,8 @@ export { yesNoRule } from '../yesNoRule.js';
|
|
|
2
2
|
import { leadTonePath, subtitlePath } from '@mistriwork/engine/shared/subtitlePath.js';
|
|
3
3
|
import type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';
|
|
4
4
|
export interface DisplayRule {
|
|
5
|
+
/** What a missing value is said as where the dash would stand (`display: { resolved_at: { empty: 'Open' } }`). */
|
|
6
|
+
empty?: string;
|
|
5
7
|
/** The face the column's values are set in (`display: { vin: { face: 'code' } }`). */
|
|
6
8
|
face?: 'data' | 'ui' | 'code';
|
|
7
9
|
format?: 'money' | 'percent' | 'number' | 'relative' | 'date' | 'datetime' | string;
|
|
@@ -17,6 +17,9 @@ export declare const say: import("../../../messages.js").RoomMessage<{
|
|
|
17
17
|
};
|
|
18
18
|
readonly barsBySeries: "{count} bars by {series}";
|
|
19
19
|
readonly targetAfter: "; target {goal}";
|
|
20
|
+
readonly partialWeek: "{label} (partial week)";
|
|
21
|
+
readonly partialMonth: "{label} (partial month)";
|
|
22
|
+
readonly partialQuarter: "{label} (partial quarter)";
|
|
20
23
|
readonly showSeries: "Show";
|
|
21
24
|
readonly allSeries: "All series";
|
|
22
25
|
readonly linesSummary: {
|
|
@@ -13,6 +13,9 @@ export const say = defineMessages({
|
|
|
13
13
|
barsSummary: { one: '{count} bar; highest {highest}; {last} {value}', other: '{count} bars; highest {highest}; {last} {value}' },
|
|
14
14
|
barsBySeries: '{count} bars by {series}',
|
|
15
15
|
targetAfter: '; target {goal}',
|
|
16
|
+
partialWeek: '{label} (partial week)',
|
|
17
|
+
partialMonth: '{label} (partial month)',
|
|
18
|
+
partialQuarter: '{label} (partial quarter)',
|
|
16
19
|
showSeries: 'Show',
|
|
17
20
|
allSeries: 'All series',
|
|
18
21
|
linesSummary: { one: '{count} line over {points} points: {names}', other: '{count} lines over {points} points: {names}' },
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const say: import("../../../messages.js").RoomMessage<{
|
|
2
|
+
readonly asOf: "As of {moment}";
|
|
3
|
+
readonly whyAsOf: "This development server runs App logic as of another moment (mistri dev --as-of, or MISTRI_AS_OF): today, now and dashboard windows read it. Sign-in and sessions keep the real clock.";
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** What AsOfChip says, in the shell 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
|
+
asOf: 'As of {moment}',
|
|
5
|
+
whyAsOf: 'This development server runs App logic as of another moment (mistri dev --as-of, or MISTRI_AS_OF): today, now and dashboard windows read it. Sign-in and sessions keep the real clock.',
|
|
6
|
+
});
|
package/dist/client/features.css
CHANGED
|
@@ -1262,6 +1262,7 @@ body.app-mode .sidebar[data-density="comfortable"] #table-list li > button { pad
|
|
|
1262
1262
|
/* The fade is tied to the scroll where the browser can: there only while the list scrolls, thinning to nothing at
|
|
1263
1263
|
its end. Always drawn, it sat over the last entry of a list that fit (Payday's Reports, with room above the
|
|
1264
1264
|
footer) and, taking 24px of the list's height, made a list that fit scroll. Without scroll timelines: no fade. */
|
|
1265
|
+
body.app-mode :is(#table-list, .mobile-nav-list) { scroll-padding-bottom: 48px; }
|
|
1265
1266
|
body.app-mode :is(#table-list, .mobile-nav-list)::after {
|
|
1266
1267
|
content: ''; display: block; position: sticky; bottom: 0; height: 40px; margin-top: -40px; pointer-events: none; opacity: 0;
|
|
1267
1268
|
background: linear-gradient(to bottom, transparent, var(--menu-ground, var(--surface)));
|
|
@@ -1721,6 +1722,11 @@ body.app-mode .confirm:is(.insert-dialog, .command-form, .set-field-dialog) > h2
|
|
|
1721
1722
|
.app-issues-dialog h2 { margin: 0 0 var(--space-3h); font: 600 var(--text-md) var(--mono); }
|
|
1722
1723
|
.app-issues-list { margin: 0 0 var(--space-3h); padding-left: 1.4rem; }
|
|
1723
1724
|
.app-issues-list li { font: var(--text-sm)/1.6 var(--mono); overflow-wrap: anywhere; }
|
|
1725
|
+
/* The as-of chip (AsOfChip.tsx): a development server's other clock, said once in muted ink; no tint, since nothing is wrong. */
|
|
1726
|
+
.as-of-chip {
|
|
1727
|
+
border: 1px solid var(--line); border-radius: 999px; color: var(--ink-muted);
|
|
1728
|
+
font: var(--text-sm) var(--mono); padding: var(--space-1) var(--space-3h); white-space: nowrap;
|
|
1729
|
+
}
|
|
1724
1730
|
|
|
1725
1731
|
/* ---------- the record picker ---------- */
|
|
1726
1732
|
|
package/dist/client/locale.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ export interface FormatSettings {
|
|
|
19
19
|
timezone?: string;
|
|
20
20
|
/** The zone a zone-less timestamp is written in: the App's `ui.timezone`, else UTC (appPayload.ts servedUi). */
|
|
21
21
|
clockZone?: string;
|
|
22
|
+
/** How far App logic's clock stands from the real one, in milliseconds: set only when a development or test server
|
|
23
|
+
* runs as of another moment (`mistri dev --as-of`, the server's http/clock.ts). */
|
|
24
|
+
clockOffset?: number;
|
|
22
25
|
}
|
|
23
26
|
/** The BCP 47 tag to format with, or undefined for the browser's own. */
|
|
24
27
|
export declare function formatLocale(): string | undefined;
|
|
@@ -26,6 +29,12 @@ export declare function formatLocale(): string | undefined;
|
|
|
26
29
|
export declare function formatTimezone(): string | undefined;
|
|
27
30
|
/** The zone a new record's `now` and `today` start in: the one the server writes zone-less timestamps in, UTC when the App names none. */
|
|
28
31
|
export declare function formatClockZone(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Now as the App reads it: the real time, moved to the moment a development or test server runs as of
|
|
34
|
+
* (`mistri dev --as-of`), so "yesterday", the calendar's and the date picker's today and a dashboard's window agree
|
|
35
|
+
* with the server's. A timer, a lease or a session's expiry reads the real clock, never this.
|
|
36
|
+
*/
|
|
37
|
+
export declare function appNow(): Date;
|
|
29
38
|
/** The currency for a money rule that names none. */
|
|
30
39
|
export declare function defaultCurrency(): string;
|
|
31
40
|
/**
|
package/dist/client/locale.js
CHANGED
|
Binary file
|
|
@@ -21,6 +21,11 @@ export declare function captureTenantLease(owner?: SessionIdentitySnapshot): Ten
|
|
|
21
21
|
export declare function tenantLeaseActive(owner?: SessionIdentitySnapshot): boolean;
|
|
22
22
|
export declare function suspendTenantLease(owner?: SessionIdentitySnapshot): void;
|
|
23
23
|
export declare function acceptTenantRenewal(owner: SessionIdentitySnapshot, expectedRevision: number, reply: TenantContextReply): void;
|
|
24
|
+
/** A fresh context for the same tenant, after the server forgot `lost`: a restarted host holds no context this page
|
|
25
|
+
* entered, so it opens a new one (revision 1, a new tab and context) and the page goes on under it. The selection —
|
|
26
|
+
* the snapshot, its storage namespace, every operation it owns — stands, because the same account chose the same
|
|
27
|
+
* tenant; only the lease the requests carry is replaced. Anything else is refused, never adopted. */
|
|
28
|
+
export declare function adoptTenantReentry(owner: SessionIdentitySnapshot, lost: TenantContextReply, reply: TenantContextReply): void;
|
|
24
29
|
/** Lock once, including callbacks that captured an otherwise identical account. */
|
|
25
30
|
export declare function lockSessionIdentity(): SessionIdentitySnapshot;
|
|
26
31
|
/** Retire every captured operation/storage owner before requesting a selection.
|
|
@@ -113,6 +113,32 @@ export function acceptTenantRenewal(owner, expectedRevision, reply) {
|
|
|
113
113
|
leases.set(owner, { reply: Object.freeze({ ...reply }), suspended: reply.expiresAt <= now, observedAt: now });
|
|
114
114
|
leaseChanged();
|
|
115
115
|
}
|
|
116
|
+
/** A fresh context for the same tenant, after the server forgot `lost`: a restarted host holds no context this page
|
|
117
|
+
* entered, so it opens a new one (revision 1, a new tab and context) and the page goes on under it. The selection —
|
|
118
|
+
* the snapshot, its storage namespace, every operation it owns — stands, because the same account chose the same
|
|
119
|
+
* tenant; only the lease the requests carry is replaced. Anything else is refused, never adopted. */
|
|
120
|
+
export function adoptTenantReentry(owner, lost, reply) {
|
|
121
|
+
const state = owner === identity ? leases.get(owner) : undefined;
|
|
122
|
+
const now = Date.now();
|
|
123
|
+
if (!state ||
|
|
124
|
+
owner !== identity ||
|
|
125
|
+
!owner.tenant ||
|
|
126
|
+
state.reply.revision !== lost.revision ||
|
|
127
|
+
!ownerFields.every((key) => lost[key] === state.reply[key]) ||
|
|
128
|
+
!validLease(reply) ||
|
|
129
|
+
reply.revision !== 1 ||
|
|
130
|
+
reply.appId !== owner.tenant.appId ||
|
|
131
|
+
reply.accountId !== owner.tenant.accountId ||
|
|
132
|
+
reply.tenantId !== owner.tenant.tenantId ||
|
|
133
|
+
reply.realm !== owner.tenant.realm ||
|
|
134
|
+
(reply.tabId === lost.tabId && reply.context === lost.context) ||
|
|
135
|
+
!Number.isFinite(now) ||
|
|
136
|
+
now < state.observedAt ||
|
|
137
|
+
reply.expiresAt <= now)
|
|
138
|
+
throw new SessionIdentityError(say('theTenantSelectionCould'), 'invalid-identity');
|
|
139
|
+
leases.set(owner, { reply: Object.freeze({ ...reply }), suspended: false, observedAt: now });
|
|
140
|
+
leaseChanged();
|
|
141
|
+
}
|
|
116
142
|
function transition(mode, accountId, appId) {
|
|
117
143
|
if (identity.mode !== mode || identity.accountId !== accountId || identity.appId !== appId) {
|
|
118
144
|
identity = Object.freeze({ mode, accountId, appId, epoch: identity.epoch + 1 });
|
|
@@ -133,6 +133,7 @@ export interface ShellMode {
|
|
|
133
133
|
currency?: string;
|
|
134
134
|
timezone?: string;
|
|
135
135
|
clockZone?: string;
|
|
136
|
+
clockOffset?: number;
|
|
136
137
|
} | null | undefined;
|
|
137
138
|
/** Whether a table may be written from here, beyond the connection's own flag. */
|
|
138
139
|
writeScope(tableId: string): boolean;
|
|
@@ -346,6 +346,7 @@ const LOOK_ATTRIBUTES = [
|
|
|
346
346
|
'data-custom-theme',
|
|
347
347
|
'data-visual-theme',
|
|
348
348
|
'data-theme-style',
|
|
349
|
+
'data-theme-preset',
|
|
349
350
|
'data-theme-palette',
|
|
350
351
|
...RECIPE_PARTS.map(lookAttribute),
|
|
351
352
|
'data-look-elevation',
|
|
@@ -377,6 +378,8 @@ function apply() {
|
|
|
377
378
|
root.setAttribute('data-custom-theme', '');
|
|
378
379
|
root.dataset.visualTheme = definition.id;
|
|
379
380
|
root.dataset.themeStyle = definition.base ?? '';
|
|
381
|
+
/* The theme a derived one (a tenant's) started from, so a page can tell its look when the look's own id is `tenant`. */
|
|
382
|
+
root.dataset.themePreset = definition.startedFrom ?? definition.id;
|
|
380
383
|
root.dataset.themePalette = visualPaletteChoice();
|
|
381
384
|
const { attributes, sheets } = recipeAttributes(definition, lookNavRole(definition));
|
|
382
385
|
/* A role the worn theme leaves to the look has no attribute, so one the last theme set goes. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistriwork/kit",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.34",
|
|
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.
|
|
87
|
-
"@mistriwork/ui": "1.0.0-rc.
|
|
86
|
+
"@mistriwork/engine": "1.0.0-rc.34",
|
|
87
|
+
"@mistriwork/ui": "1.0.0-rc.34",
|
|
88
88
|
"intl-messageformat": "12.1.2",
|
|
89
89
|
"qrcode-generator": "^2.0.4"
|
|
90
90
|
},
|