@mistriwork/kit 1.0.0-rc.25 → 1.0.0-rc.28
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/boot.js +1 -1
- package/dist/client/components/PageGroups.js +1 -1
- package/dist/client/components/PageRelated.js +1 -1
- package/dist/client/components/PartialNote.css +5 -0
- package/dist/client/components/PartialNote.d.ts +7 -0
- package/dist/client/components/PartialNote.js +18 -0
- package/dist/client/components/QrCode.css +5 -2
- package/dist/client/components/QrCode.js +5 -3
- package/dist/client/components/Record.js +1 -1
- package/dist/client/components/RecordSummaries.js +16 -1
- package/dist/client/components/TableRoom.js +2 -1
- package/dist/client/components/TableView.js +1 -1
- package/dist/client/components/pageContext.d.ts +1 -1
- package/dist/client/components/pageContext.js +6 -3
- package/dist/client/components/valueModel.js +26 -3
- package/dist/client/composedReads.js +6 -2
- package/dist/client/copy/lists/components/PartialNote.d.ts +3 -0
- package/dist/client/copy/lists/components/PartialNote.js +5 -0
- package/dist/client/core.d.ts +18 -0
- package/dist/client/core.js +24 -2
- package/dist/client/features.css +1 -0
- package/dist/client/locale.d.ts +2 -0
- package/dist/client/locale.js +0 -0
- package/dist/client/recordWriteRefresh.js +4 -0
- package/dist/client/rowEditing.d.ts +2 -2
- package/dist/client/rowEditing.js +18 -2
- package/dist/client/shellMode.d.ts +4 -2
- package/dist/client/startup.d.ts +3 -1
- package/dist/client/startup.js +5 -1
- package/dist/client/structure.css +14 -0
- package/dist/client/themeFamilies.css +2 -2
- package/dist/client/uiBridge.d.ts +1 -0
- package/package.json +3 -3
package/dist/client/boot.js
CHANGED
|
@@ -36,7 +36,7 @@ function groupView(view, by, key, limit) {
|
|
|
36
36
|
return { ...view, filter: { groups: held.map((group) => [...group, condition]) }, limit };
|
|
37
37
|
}
|
|
38
38
|
export function GroupedBody({ section, groups, offset, perPage, onOffset, view, labelColumns, rowsPerGroup, grid, overall, moves, }) {
|
|
39
|
-
const api = usePageApi();
|
|
39
|
+
const api = usePageApi('related');
|
|
40
40
|
const group = section.group;
|
|
41
41
|
const heading = useId();
|
|
42
42
|
const [open, setOpen] = useState({});
|
|
@@ -178,7 +178,7 @@ export function relatedDoor(section, base, recordKey, context) {
|
|
|
178
178
|
}
|
|
179
179
|
/** Rows related to the root, a page at a time — the real list, not a sample of one. */
|
|
180
180
|
function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counted }) {
|
|
181
|
-
const api = usePageApi();
|
|
181
|
+
const api = usePageApi('related');
|
|
182
182
|
const { preview, isCurrent, openRelated, connection, recordName, onActionDone, actions: recordActions } = useContext(PageRenderContext);
|
|
183
183
|
const counting = counted ? { base, recordKey } : undefined;
|
|
184
184
|
const counts = useRelatedCounts(counted ? [section] : [], counting);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* Imported by features.css: part of the tool's own rules (style.css names the order). */
|
|
2
|
+
@layer base {
|
|
3
|
+
/* One muted line on the list's inset, over the grid: no banner colour, nothing reserved while the labels are read. */
|
|
4
|
+
.grid-partial { margin: 0; padding: var(--space-2) var(--space-4h); font: var(--text-sm) var(--sans); color: var(--ink-muted); }
|
|
5
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A list whose rows were read but whose labels from another source were not
|
|
4
|
+
* (a stitched reference's target is down): one quiet line over the grid, in
|
|
5
|
+
* the muted ink, saying the cells hold the stored keys. Drawn only when the
|
|
6
|
+
* read says so, so a healthy list reserves nothing for it.
|
|
7
|
+
*/
|
|
8
|
+
import { columnLabel } from '../core.js';
|
|
9
|
+
import { say } from '../copy/lists/components/PartialNote.js';
|
|
10
|
+
/** `carrier_id` → "Carrier", where the App gives the column no caption of its own. */
|
|
11
|
+
const plain = (column) => {
|
|
12
|
+
const words = column.replace(/_id$/i, '').replace(/[_-]+/g, ' ').trim();
|
|
13
|
+
return words ? words[0].toUpperCase() + words.slice(1) : column;
|
|
14
|
+
};
|
|
15
|
+
export function PartialNote({ partial, table }) {
|
|
16
|
+
const names = [...new Set(partial.map(({ reference }) => columnLabel(table, reference) ?? plain(reference)))].join(', ');
|
|
17
|
+
return (_jsx("p", { className: "grid-partial", role: "status", children: say('partialLabels', { names }) }));
|
|
18
|
+
}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
on white in every look and mode — an inverted, light-on-dark code is one many scanners refuse — at a size a phone
|
|
3
3
|
reads from a screen. The two fixed colors are the code's, not the theme's (docs/design.md). */
|
|
4
4
|
@layer components {
|
|
5
|
-
|
|
6
|
-
.
|
|
5
|
+
/* Fits its container between a size a phone reads from a screen and one that does not crowd a record: a card's narrow
|
|
6
|
+
column gets the least, a record page's field the most. The quiet zone is inside the picture, so the ground's edge is
|
|
7
|
+
the code's and the size below is the whole of it. */
|
|
8
|
+
.qr-value { display: block; width: 100%; min-width: 128px; max-width: 208px; margin: 0; }
|
|
9
|
+
.qr-value-code { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius); }
|
|
7
10
|
.qr-value-ground { fill: #ffffff; }
|
|
8
11
|
.qr-value-ink { fill: #111111; }
|
|
9
12
|
.qr-value-code { box-shadow: 0 0 0 1px var(--line); }
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* A value as a QR code to scan — an asset tag, a link to a portal
|
|
4
|
-
*
|
|
3
|
+
* A value as a QR code to scan — an asset tag, a link to a portal. The value is
|
|
4
|
+
* the code's accessible name and its tooltip, not printed under it: a raw link
|
|
5
|
+
* beside the code is noise on a record page, and a screen reader says it.
|
|
5
6
|
*
|
|
6
7
|
* A part on demand (Dressed.tsx): the encoder is a library of its own, and
|
|
7
8
|
* only a record or a card that shows a `format: 'qr'` value fetches it. The
|
|
@@ -53,5 +54,6 @@ export const QrCode = memo(function QrCode({ text }) {
|
|
|
53
54
|
const drawn = pathOf(text);
|
|
54
55
|
if (!drawn)
|
|
55
56
|
return _jsx("span", { className: "qr-value-text", children: text });
|
|
56
|
-
|
|
57
|
+
const name = say('qrOf', { text });
|
|
58
|
+
return (_jsx("figure", { className: "qr-value", title: text, children: _jsxs("svg", { className: "qr-value-code", viewBox: `0 0 ${drawn.size} ${drawn.size}`, role: "img", "aria-label": name, shapeRendering: "crispEdges", children: [_jsx("rect", { width: drawn.size, height: drawn.size, className: "qr-value-ground" }), _jsx("path", { d: drawn.d, className: "qr-value-ink" })] }) }));
|
|
57
59
|
});
|
|
@@ -147,7 +147,7 @@ export function RecordView({ entry, table, template, onLabel, onChooseTab }) {
|
|
|
147
147
|
}
|
|
148
148
|
/* ---------- the fields ---------- */
|
|
149
149
|
function Fields({ table, entry, record, resolved, sections, }) {
|
|
150
|
-
const editing = canEditRow(table, entry.key);
|
|
150
|
+
const editing = canEditRow(table, entry.key, record);
|
|
151
151
|
const blocked = whyNotEditable(table);
|
|
152
152
|
/* Typing must not re-render the fields — that would destroy the input
|
|
153
153
|
mid-keystroke and lose the caret. The pending bar reads the staging
|
|
@@ -4,6 +4,7 @@ import { useMessageLanguage } from './useMessageLanguage.js';
|
|
|
4
4
|
import { columnLabel, keyOf, labelPath, openRecord, recordLabel, rowLabel, state } from '../core.js';
|
|
5
5
|
import { opensRecord } from '../recordIntent.js';
|
|
6
6
|
import { humanName } from '@mistriwork/engine/shared/model.js';
|
|
7
|
+
import { isLabelTemplate, parseLabelTemplate } from '@mistriwork/engine/shared/recordLabel.js';
|
|
7
8
|
import { primaryKey } from '@mistriwork/engine/shared/schema.js';
|
|
8
9
|
import { TAGS_TYPE, tagChips } from '@mistriwork/engine/shared/tagLists.js';
|
|
9
10
|
import { Value } from './Value.js';
|
|
@@ -71,9 +72,22 @@ function shownValue(row, name, referenceLabels) {
|
|
|
71
72
|
const label = referenceLabels?.[name];
|
|
72
73
|
return String((label ? row[label] : row[name]) ?? '');
|
|
73
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The columns the record's label is built from (`recordLabel: '{first_name} {last_name}'`): the title already says
|
|
77
|
+
* them, so a line under it that says "Ada · Lane" again spends a fact on nothing. A reference path
|
|
78
|
+
* (`{customer_id.name}`) names the reference column too, which is drawn as that name.
|
|
79
|
+
*/
|
|
80
|
+
function labelColumns(table) {
|
|
81
|
+
const template = recordLabel(table);
|
|
82
|
+
const parsed = isLabelTemplate(template) ? parseLabelTemplate(template) : undefined;
|
|
83
|
+
if (!parsed || 'problem' in parsed)
|
|
84
|
+
return [];
|
|
85
|
+
return parsed.paths.flatMap((path) => (path.includes('.') ? [path, path.split('.')[0]] : [path]));
|
|
86
|
+
}
|
|
74
87
|
function summaryFacts(table, columns, rows, titles, skip, referenceLabels) {
|
|
75
88
|
const echoes = (name) => rows.length > 0 && rows.every((row, i) => shownValue(row, name, referenceLabels) === titles[i]);
|
|
76
|
-
|
|
89
|
+
const named = labelColumns(table);
|
|
90
|
+
return summaryColumns(table, columns.filter((name) => !skip.includes(name) && !named.includes(name) && !echoes(name)));
|
|
77
91
|
}
|
|
78
92
|
/**
|
|
79
93
|
* Whether the table has anything the summaries leave out, which is the only reason to offer the Table beside them
|
|
@@ -88,6 +102,7 @@ export function tableSaysMore(table, columns, rows, query, referenceLabels) {
|
|
|
88
102
|
const naming = labelPath(table);
|
|
89
103
|
return columns.some((name) => !said.includes(name) &&
|
|
90
104
|
!fixed.includes(name) &&
|
|
105
|
+
!labelColumns(table).includes(name) &&
|
|
91
106
|
!keys.includes(name) &&
|
|
92
107
|
name !== naming &&
|
|
93
108
|
!rows.every((row, i) => shownValue(row, name, referenceLabels) === titles[i]));
|
|
@@ -43,6 +43,7 @@ import { batchedRun } from '../breakdownBatch.js';
|
|
|
43
43
|
import { useListHold } from '../liveState.js';
|
|
44
44
|
import { laneWindow } from '@mistriwork/engine/shared/boardLanes.js';
|
|
45
45
|
import { say } from '../copy/lists/components/TableRoom.js';
|
|
46
|
+
import { PartialNote } from './PartialNote.js';
|
|
46
47
|
/* The diagrams are a chunk of their own, loaded when the Diagram tab is first opened. */
|
|
47
48
|
/**
|
|
48
49
|
* A list this reader's catalog leaves out. Signed in, the role is the reason.
|
|
@@ -245,7 +246,7 @@ function Rows({ entry: given, chrome, interactive, hide, labels, referenceLabels
|
|
|
245
246
|
/* Not over a question that failed: its error says why there are no rows. */
|
|
246
247
|
if (empty && !run.isPlaceholderData && data.rows.length === 0 && page === 0 && !data.errors?.length)
|
|
247
248
|
return _jsx(_Fragment, { children: empty });
|
|
248
|
-
return (_jsxs(_Fragment, { children: [held.held ? _jsx(LivePill, { held: held.held, show: held.show }) : null, _jsx(TableView, { entry: entry, data: data, chrome: chrome, interactive: interactive, hide: hide, labels: labels, referenceLabels: referenceLabels, totals: totals, group: group, density: density, rowActions: rowActions, editable: editable, inCrumbs: inCrumbs, sizing: sizing, export: exportOn, summaries: summaries, embedded: embedded, presentation: presentation, present: present, actions: actions, listLabel: listLabel, order: order, recordNavigation: recordNavigation, at: askedFor.get(data) ?? { page, size }, busy: run.isPlaceholderData })] }));
|
|
249
|
+
return (_jsxs(_Fragment, { children: [held.held ? _jsx(LivePill, { held: held.held, show: held.show }) : null, 'partial' in data && data.partial?.length ? _jsx(PartialNote, { partial: data.partial, table: entry.table }) : null, _jsx(TableView, { entry: entry, data: data, chrome: chrome, interactive: interactive, hide: hide, labels: labels, referenceLabels: referenceLabels, totals: totals, group: group, density: density, rowActions: rowActions, editable: editable, inCrumbs: inCrumbs, sizing: sizing, export: exportOn, summaries: summaries, embedded: embedded, presentation: presentation, present: present, actions: actions, listLabel: listLabel, order: order, recordNavigation: recordNavigation, at: askedFor.get(data) ?? { page, size }, busy: run.isPlaceholderData })] }));
|
|
249
250
|
}
|
|
250
251
|
/** The table's definition: the statement the database keeps, or one rebuilt from its catalog. */
|
|
251
252
|
function DdlPane({ table }) {
|
|
@@ -229,7 +229,7 @@ export function TableView({ entry, data, chrome, interactive, hide, labels, refe
|
|
|
229
229
|
const key = keyOf(table, row);
|
|
230
230
|
const meta = column === undefined ? undefined : table.columns.find((c) => c.name === column);
|
|
231
231
|
// A reference drawn by name is edited only when its key rode along with the row (appListModel's showClause).
|
|
232
|
-
if (!key || !meta || !Object.hasOwn(row, meta.name) || !canEditRow(table, key))
|
|
232
|
+
if (!key || !meta || !Object.hasOwn(row, meta.name) || !canEditRow(table, key, row))
|
|
233
233
|
return undefined;
|
|
234
234
|
/* The name the cell already says — its label, or the path it draws by name — so the editor opens on it. */
|
|
235
235
|
const named = drawn !== meta.name ? row[drawn] : drawnLabel;
|
|
@@ -103,7 +103,7 @@ export declare const PageRenderContext: import("react").Context<{
|
|
|
103
103
|
/** A verb ran from a row of one of the page's lists: the record and its lists are read again. */
|
|
104
104
|
onActionDone?: () => void;
|
|
105
105
|
}>;
|
|
106
|
-
export declare function usePageApi(): typeof request;
|
|
106
|
+
export declare function usePageApi(read?: 'related'): typeof request;
|
|
107
107
|
/**
|
|
108
108
|
* What the page hands a custom section beside a section's own props: its
|
|
109
109
|
* request, whether it is a preview, and how every section says loading and a
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { createContext, useContext } from 'react';
|
|
11
11
|
import { ownedBy } from '../requestIdentity.js';
|
|
12
|
-
import { api as request, columnDisplay, findTable, labelPath, recordLabel, state } from '../core.js';
|
|
12
|
+
import { api as request, columnDisplay, relatedApi, findTable, labelPath, recordLabel, state } from '../core.js';
|
|
13
13
|
import { humanName } from '@mistriwork/engine/shared/model.js';
|
|
14
14
|
import { shell } from '../shellMode.js';
|
|
15
15
|
import { resourceOf } from './appRooms.js';
|
|
@@ -19,13 +19,16 @@ export const spoken = (name) => (shell().inApp() ? humanName(name) : name);
|
|
|
19
19
|
/** Whether the page is an App's, for a section's words; through this module, so a section needs no edge of its own to appnav. */
|
|
20
20
|
export const inAppPage = () => shell().inApp();
|
|
21
21
|
export const PageRenderContext = createContext({});
|
|
22
|
-
|
|
22
|
+
/* `read: 'related'` is a related list's rows, which a resource that audits its reads records as such (core.js relatedApi). */
|
|
23
|
+
export function usePageApi(read) {
|
|
23
24
|
const { connection } = useContext(PageRenderContext);
|
|
24
25
|
const scoped = (path, ...args) => {
|
|
25
26
|
// Add only routing identity; preserve the selected route/body tuple. No
|
|
26
27
|
// operation fields are changed and no endpoint falls back to an untyped API.
|
|
27
28
|
const owned = connection && args[0] ? [{ ...args[0], ...ownedBy(connection) }] : args;
|
|
28
|
-
return
|
|
29
|
+
return read === 'related'
|
|
30
|
+
? relatedApi(path, owned[0])
|
|
31
|
+
: request(path, ...owned);
|
|
29
32
|
};
|
|
30
33
|
return scoped;
|
|
31
34
|
}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { richTextExcerpt, richTextImageAddress } from '@mistriwork/engine/shared/richText.js';
|
|
10
10
|
import { MASK, displayWord, vocabularyWord } from '@mistriwork/engine/shared/model.js';
|
|
11
|
-
import { defaultCurrency, formatAbsolute, formatDate, formatDateTime, formatLocale, formatMoney, formatWholeMoney, formatNumber, formatPercent, formatRelativeDay, daysFromToday, NEAR_DAYS, sayNearDay, withPercentSign, } from '../locale.js';
|
|
11
|
+
import { defaultCurrency, formatAbsolute, formatDate, formatDateTime, formatLocale, formatMoney, formatWholeMoney, formatNumber, formatPercent, formatRelativeDay, appToday, daysFromToday, NEAR_DAYS, sayNearDay, withPercentSign, } from '../locale.js';
|
|
12
12
|
import { minorFigure } from '@mistriwork/engine/shared/money.js';
|
|
13
|
+
import { dateComparison, dateComparisonHolds } from '@mistriwork/engine/shared/queryDates.js';
|
|
13
14
|
export { yesNoRule } from '../yesNoRule.js';
|
|
14
15
|
import { unitWord } from '@mistriwork/engine/shared/unitWord.js';
|
|
15
16
|
import { planColumn } from '../columns.js';
|
|
@@ -130,7 +131,7 @@ function toneFor(rule, value, text) {
|
|
|
130
131
|
const rest = Object.hasOwn(rule.tone, '*') ? rule.tone['*'] : text.trim() ? 'neutral' : null;
|
|
131
132
|
const n = Number(value);
|
|
132
133
|
if (!Number.isFinite(n))
|
|
133
|
-
return rest;
|
|
134
|
+
return dateTone(rule.tone, text) ?? rest;
|
|
134
135
|
for (const [key, tone] of Object.entries(rule.tone)) {
|
|
135
136
|
const m = /^(>=|<=|>|<)\s*(-?\d+(?:\.\d+)?)$/.exec(key);
|
|
136
137
|
if (!m)
|
|
@@ -142,6 +143,22 @@ function toneFor(rule, value, text) {
|
|
|
142
143
|
}
|
|
143
144
|
return rest;
|
|
144
145
|
}
|
|
146
|
+
/** The first date comparison a day satisfies ("< today", "<= next 7 days"), by the App's today; null for a text that is no day. */
|
|
147
|
+
function dateTone(tones, text) {
|
|
148
|
+
const keys = Object.keys(tones).filter((key) => /^[<>]/.test(key));
|
|
149
|
+
if (!keys.length)
|
|
150
|
+
return null;
|
|
151
|
+
const offset = daysFromToday(text);
|
|
152
|
+
if (offset === null)
|
|
153
|
+
return null;
|
|
154
|
+
const today = appToday();
|
|
155
|
+
for (const key of keys) {
|
|
156
|
+
const cmp = dateComparison(key);
|
|
157
|
+
if (cmp && dateComparisonHolds(cmp, offset, today))
|
|
158
|
+
return tones[key];
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
145
162
|
/**
|
|
146
163
|
* The placeholder a rule draws instead of this value — `masked: true`, or a
|
|
147
164
|
* value starting with the rule's `masked.prefix`, said as that prefix and the
|
|
@@ -419,7 +436,13 @@ function ownDrawing(rule, value, text) {
|
|
|
419
436
|
if (typeof value !== 'string' || !text.trim())
|
|
420
437
|
return null;
|
|
421
438
|
const said = formatAbsolute(text, { time: rule.format === 'datetime', zone: rule.timezone });
|
|
422
|
-
|
|
439
|
+
if (said === text)
|
|
440
|
+
return null;
|
|
441
|
+
/* A day that satisfies a comparison ("<= today": overdue) wears its tone; the date is still said as itself. */
|
|
442
|
+
const tone = rule.tone ? toneFor(rule, value, text) : null;
|
|
443
|
+
if (tone && tone !== 'neutral')
|
|
444
|
+
return { kind: 'tone', tone, text, label: said };
|
|
445
|
+
return { kind: 'date', text: said, title: text };
|
|
423
446
|
}
|
|
424
447
|
/* A year is a name, not a quantity: 2026, never "2,026". */
|
|
425
448
|
case 'year':
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* The record's own row is kept whole: every reader of it (the root probe,
|
|
13
13
|
* each fields section, the header, a custom section's record fields) is
|
|
14
|
-
* answered with exactly its columns, once per set of columns.
|
|
14
|
+
* answered with exactly its columns, once per reader and set of columns.
|
|
15
15
|
*
|
|
16
16
|
* It tells the request path of itself as it loads (composedHook.ts), so
|
|
17
17
|
* the request path asks it only where a module that reads record pages is
|
|
@@ -135,7 +135,11 @@ export async function composedReply(path, body) {
|
|
|
135
135
|
const row = path === '/api/view/run' ? rowRead(given) : undefined;
|
|
136
136
|
if (row) {
|
|
137
137
|
await composeUnderway(connection);
|
|
138
|
-
|
|
138
|
+
/* Once per reader (its view's id) and set of columns: a reader asking again is refetching and goes out, but two
|
|
139
|
+
readers asking the same columns each have the answer. A page whose header and properties section show the same
|
|
140
|
+
fields in a different order (appDefaultPage's: status first in the header) asked twice, and keying on the
|
|
141
|
+
columns alone sent the second to the server, a request beside the compose that was meant to save it. */
|
|
142
|
+
const once = `${given.view.id}\u0001${row.columns.slice().sort().join('\u0000')}`;
|
|
139
143
|
for (const batch of live(connection)) {
|
|
140
144
|
const found = batch.rows.find((kept) => kept.base === row.base &&
|
|
141
145
|
kept.filter === row.filter &&
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** What PartialNote says, in the lists and grid 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
|
+
partialLabels: '{names} labels unavailable — showing the stored keys.',
|
|
5
|
+
});
|
package/dist/client/core.d.ts
CHANGED
|
@@ -82,6 +82,24 @@ export declare function api<Path extends string>(path: Path, ...args: import('@m
|
|
|
82
82
|
* @returns {Promise<any>}
|
|
83
83
|
*/
|
|
84
84
|
export declare function pageApi(page: string, path: string, body: Record<string, unknown>): Promise<any>;
|
|
85
|
+
/**
|
|
86
|
+
* A picker's read: `api`, saying it is one (`x-mistri-read`), so a resource
|
|
87
|
+
* that audits its reads records it as a choice offered rather than a list
|
|
88
|
+
* opened (readAudit.ts).
|
|
89
|
+
* @param {string} path
|
|
90
|
+
* @param {Record<string, unknown>} body
|
|
91
|
+
* @returns {Promise<any>}
|
|
92
|
+
*/
|
|
93
|
+
export declare function pickerApi(path: string, body: Record<string, unknown>): Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* A record page's related list: `api`, saying so (`x-mistri-read`), so a
|
|
96
|
+
* resource that audits its reads records its rows as read beside a record
|
|
97
|
+
* rather than as a list opened (readAudit.ts).
|
|
98
|
+
* @param {string} path
|
|
99
|
+
* @param {Record<string, unknown>} body
|
|
100
|
+
* @returns {Promise<any>}
|
|
101
|
+
*/
|
|
102
|
+
export declare function relatedApi(path: string, body: Record<string, unknown>): Promise<any>;
|
|
85
103
|
/** Register a rebuild. Returns the way to stop listening. */
|
|
86
104
|
export declare function whenConnectionChanges(run: any): () => boolean;
|
|
87
105
|
/**
|
package/dist/client/core.js
CHANGED
|
@@ -153,6 +153,28 @@ export async function api(path, ...args) {
|
|
|
153
153
|
export async function pageApi(page, path, body) {
|
|
154
154
|
return sent(path, body, { [PAGE_HEADER]: page });
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* A picker's read: `api`, saying it is one (`x-mistri-read`), so a resource
|
|
158
|
+
* that audits its reads records it as a choice offered rather than a list
|
|
159
|
+
* opened (readAudit.ts).
|
|
160
|
+
* @param {string} path
|
|
161
|
+
* @param {Record<string, unknown>} body
|
|
162
|
+
* @returns {Promise<any>}
|
|
163
|
+
*/
|
|
164
|
+
export async function pickerApi(path, body) {
|
|
165
|
+
return sent(path, body, { 'x-mistri-read': 'picker' });
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A record page's related list: `api`, saying so (`x-mistri-read`), so a
|
|
169
|
+
* resource that audits its reads records its rows as read beside a record
|
|
170
|
+
* rather than as a list opened (readAudit.ts).
|
|
171
|
+
* @param {string} path
|
|
172
|
+
* @param {Record<string, unknown>} body
|
|
173
|
+
* @returns {Promise<any>}
|
|
174
|
+
*/
|
|
175
|
+
export async function relatedApi(path, body) {
|
|
176
|
+
return sent(path, body, { 'x-mistri-read': 'related' });
|
|
177
|
+
}
|
|
156
178
|
/**
|
|
157
179
|
* @param {string} path
|
|
158
180
|
* @param {Record<string, unknown> | undefined} body
|
|
@@ -215,8 +237,8 @@ async function request(path, body, headers) {
|
|
|
215
237
|
if (!tenant)
|
|
216
238
|
throw Object.assign(new Error(say('theTenantContextIsUnavailable')), { outcome: 'not_applied' });
|
|
217
239
|
if (tenant.isMutation(parsedPath.pathname))
|
|
218
|
-
return await tenant.mutate(path, body, state.activeConnection);
|
|
219
|
-
return await tenant.read(path, body === undefined ? undefined : { ...body }, state.activeConnection);
|
|
240
|
+
return await tenant.mutate(path, body, state.activeConnection, undefined, headers);
|
|
241
|
+
return await tenant.read(path, body === undefined ? undefined : { ...body }, state.activeConnection, headers);
|
|
220
242
|
}
|
|
221
243
|
if (parsedPath.pathname === '/api/revert' &&
|
|
222
244
|
body &&
|
package/dist/client/features.css
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
@import './components/ListFilterBar.css';
|
|
10
10
|
@import './components/JsonPreview.css';
|
|
11
11
|
@import './components/ListEmpty.css';
|
|
12
|
+
@import './components/PartialNote.css';
|
|
12
13
|
@import './components/Notes.css';
|
|
13
14
|
/* The tool's own rules: the first layer (style.css names the order). */
|
|
14
15
|
@layer base {
|
package/dist/client/locale.d.ts
CHANGED
|
@@ -117,6 +117,8 @@ export declare function formatAbsolute(value: string | number | Date, { time, zo
|
|
|
117
117
|
* whose own line said Oct 8, 10:00 PM.
|
|
118
118
|
*/
|
|
119
119
|
export declare function formatRelativeDay(text: string, now?: Date): string | null;
|
|
120
|
+
/** Today's calendar day (the App's zone's, else the reader's) as a Date whose local fields read it, noon so no zone edge moves it: what `dateWindow` computes a date phrase with. */
|
|
121
|
+
export declare function appToday(now?: Date): Date;
|
|
120
122
|
/** How far from today a day is, in whole days (negative before it); null when the text is not a date. */
|
|
121
123
|
export declare function daysFromToday(text: string, now?: Date): number | null;
|
|
122
124
|
/** Inside this many days of today a day is said from today; past it, it is the date. */
|
package/dist/client/locale.js
CHANGED
|
Binary file
|
|
@@ -33,6 +33,10 @@ export function queryTouches(query, connection, table, key, primary, same = same
|
|
|
33
33
|
(query.length === 3 && typeof query[1] === 'string' && typeof query[2] === 'number'));
|
|
34
34
|
case 'count':
|
|
35
35
|
return query[1] === connection;
|
|
36
|
+
case 'mistri-page':
|
|
37
|
+
/* A free-form page's loader (CustomSection.tsx): its key names its view and place, never a table, and what it
|
|
38
|
+
reads is its own, so any write may have changed it. A command run from the page left its `data` stale. */
|
|
39
|
+
return query[1] === 'load';
|
|
36
40
|
case 'page-list':
|
|
37
41
|
return !!query[1] && typeof query[1] === 'object' && query[1].base === table;
|
|
38
42
|
case 'peek':
|
|
@@ -11,5 +11,5 @@ export declare function booleanChoices(column: any, row: any): {
|
|
|
11
11
|
yes: string;
|
|
12
12
|
no: string;
|
|
13
13
|
};
|
|
14
|
-
/** True when this row can be edited at all: write mode on, and a full key. */
|
|
15
|
-
export declare function canEditRow(table: any, key: any): any;
|
|
14
|
+
/** True when this row can be edited at all: write mode on, and a full key; a frozen row (`row`, where the caller has it) is not. */
|
|
15
|
+
export declare function canEditRow(table: any, key: any, row: any): any;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { prefersPages, state, writeAllowed } from './core.js';
|
|
9
9
|
import { planColumn } from './columns.js';
|
|
10
|
+
import { pageBridge } from './uiBridge.js';
|
|
10
11
|
const writableConnection = () => Boolean(state.connections?.find((c) => c.id === state.activeConnection)?.writable);
|
|
11
12
|
/**
|
|
12
13
|
* The two values a boolean column actually holds, or null if it is not one.
|
|
@@ -23,10 +24,25 @@ export function booleanChoices(column, row) {
|
|
|
23
24
|
return null;
|
|
24
25
|
return /bool/i.test(column?.type ?? '') ? { yes: 'true', no: 'false' } : { yes: '1', no: '0' };
|
|
25
26
|
}
|
|
26
|
-
/**
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Whether the row is in a state its machine freezes (`final: { freeze: true }`): the server refuses every write to it,
|
|
29
|
+
* so no editor is offered. Judged from the row's own state, which a row that does not carry the column cannot say.
|
|
30
|
+
*/
|
|
31
|
+
function frozenRow(tableId, row) {
|
|
32
|
+
if (!row)
|
|
33
|
+
return false;
|
|
34
|
+
const app =
|
|
35
|
+
/** @type {{ resources?: Record<string, { machine?: import('@mistriwork/engine/shared/servedApp.js').ServedMachine }> } | null} */ (pageBridge.activeApp());
|
|
36
|
+
const machine = app?.resources?.[tableId]?.machine;
|
|
37
|
+
const value = machine ? row[machine.column] : undefined;
|
|
38
|
+
return (machine !== undefined && value !== undefined && value !== null && machine.states.some((s) => s.freeze && s.value === String(value)));
|
|
39
|
+
}
|
|
40
|
+
/** True when this row can be edited at all: write mode on, and a full key; a frozen row (`row`, where the caller has it) is not. */
|
|
41
|
+
export function canEditRow(table, key, row) {
|
|
28
42
|
if (!state.canWrite || !table || table.isView)
|
|
29
43
|
return false;
|
|
44
|
+
if (frozenRow(table.id, row))
|
|
45
|
+
return false;
|
|
30
46
|
if (prefersPages() && !writableConnection())
|
|
31
47
|
return false;
|
|
32
48
|
if (!writeAllowed(table.id))
|
|
@@ -47,8 +47,10 @@ interface MutationGuard {
|
|
|
47
47
|
}
|
|
48
48
|
/** A tenant session's requests: sent through the tenant's lease (tenantTransport.ts), or none. */
|
|
49
49
|
interface TenantRequests {
|
|
50
|
-
read
|
|
51
|
-
|
|
50
|
+
/** `headers` say what the read is (a picker's, a related list's, a free-form page's), as `api`'s do. */
|
|
51
|
+
read(path: string, body: Record<string, unknown> | undefined, connection: string | null | undefined, headers?: Readonly<Record<string, string>>): Promise<unknown>;
|
|
52
|
+
/** `headers` say which page runs the command (`x-mistri-page`), as a read's do. */
|
|
53
|
+
mutate(path: string, body: unknown, connection: string | null | undefined, signal?: AbortSignal, headers?: Readonly<Record<string, string>>): Promise<unknown>;
|
|
52
54
|
isMutation(path: string): boolean;
|
|
53
55
|
/** The streamed export on the lease: the file, or the server's answer where it is not one. */
|
|
54
56
|
exportFile?(body: {
|
package/dist/client/startup.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** Reveal only after boot has selected its route, workspace and appearance. */
|
|
2
2
|
export declare function rememberStartupAppearance(): void;
|
|
3
3
|
export declare function whenStartupReady(callback: () => void): () => void;
|
|
4
|
-
|
|
4
|
+
/** `wanted` is asked after the frame: a reveal scheduled for one screen (a tenant chooser) is dropped when the
|
|
5
|
+
page has moved on to another that holds the veil itself, so the frame cannot lift it mid-load. */
|
|
6
|
+
export declare function finishStartup(wanted?: () => boolean): Promise<void>;
|
|
5
7
|
/** One failure page for every way an App does not start: its name, one line of why, one way on. It wears the
|
|
6
8
|
look tokens the page was started with (index.html's `--startup-*`), so a white-labelled tenant never sees the
|
|
7
9
|
vendor here. The App framework's own unavailable screen (appUnavailable.js) draws the same three lines in the same classes. */
|
package/dist/client/startup.js
CHANGED
|
@@ -39,8 +39,12 @@ export function whenStartupReady(callback) {
|
|
|
39
39
|
addHostListener(window, 'mistri:ready', callback, { once: true });
|
|
40
40
|
return () => removeHostListener(window, 'mistri:ready', callback);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
/** `wanted` is asked after the frame: a reveal scheduled for one screen (a tenant chooser) is dropped when the
|
|
43
|
+
page has moved on to another that holds the veil itself, so the frame cannot lift it mid-load. */
|
|
44
|
+
export async function finishStartup(wanted = () => true) {
|
|
43
45
|
await new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
46
|
+
if (!wanted())
|
|
47
|
+
return;
|
|
44
48
|
shellRoot().removeAttribute('data-starting');
|
|
45
49
|
removeHostListener(window, 'keydown', guardStartupKeys, true);
|
|
46
50
|
window.dispatchEvent(new Event('mistri:ready'));
|
|
@@ -1454,6 +1454,20 @@
|
|
|
1454
1454
|
body.app-sidebar-shell .sidebar-account :is(.inbox-trigger, .icon-button) {
|
|
1455
1455
|
color: var(--ink-muted);
|
|
1456
1456
|
}
|
|
1457
|
+
/* The workspace chooser docks here with the bar's other keys, outside the .topbar the dark bar's rule dresses
|
|
1458
|
+
(brandLook.css), so it stood on the page's surface key in the menu's ink: pale on pale under a dark nav. The
|
|
1459
|
+
sidebar's --ink and --line are the nav's (visualThemes.css), so a tint of its ink reads on any ground it wears. */
|
|
1460
|
+
body.app-sidebar-shell .sidebar-account .tenant-control-trigger {
|
|
1461
|
+
background: color-mix(in srgb, var(--ink) 8%, transparent);
|
|
1462
|
+
border-color: var(--line);
|
|
1463
|
+
color: var(--ink);
|
|
1464
|
+
box-shadow: none;
|
|
1465
|
+
}
|
|
1466
|
+
@media (hover: hover) {
|
|
1467
|
+
body.app-sidebar-shell .sidebar-account .tenant-control-trigger:hover {
|
|
1468
|
+
background: color-mix(in srgb, var(--ink) 14%, transparent);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1457
1471
|
body.app-sidebar-shell .sidebar-account + #sidebar-app-footer .sidebar-identity {
|
|
1458
1472
|
padding-top: var(--space-3);
|
|
1459
1473
|
}
|
|
@@ -713,9 +713,9 @@
|
|
|
713
713
|
}
|
|
714
714
|
/* A data column in Plex Mono, in every look and only there: the ids, codes and numbers a table's cells set apart
|
|
715
715
|
(`td.mono`, Grid.tsx) and the figures, dates and keys of a record's fields and header facts. Words, headings and
|
|
716
|
-
a stat's hero figure keep their theme's faces. A theme whose data face reaches figures says its own, above. */
|
|
716
|
+
a stat's hero figure keep their theme's faces. A theme whose data face reaches figures says its own, above; one that names a figures face (`fonts.figures`, which follows its data face when it names none) wears it as `--figures-face`. */
|
|
717
717
|
.app-mode {
|
|
718
|
-
--figures: 'IBM Plex Mono', 'IBM Plex Mono Fallback', var(--code);
|
|
718
|
+
--figures: var(--figures-face, 'IBM Plex Mono', 'IBM Plex Mono Fallback', var(--code));
|
|
719
719
|
}
|
|
720
720
|
.app-mode td.mono,
|
|
721
721
|
.app-mode :is(.page-field > dd, .page-head-facts) :is(.num-value, .date-value, .id-value) {
|
|
@@ -23,6 +23,7 @@ interface CommandHandle {
|
|
|
23
23
|
label?: string;
|
|
24
24
|
challenge?: string;
|
|
25
25
|
attempt?: string;
|
|
26
|
+
quiet?: boolean;
|
|
26
27
|
}): Promise<CommandOutcome>;
|
|
27
28
|
open(key: Readonly<Record<string, unknown>>, input?: Readonly<Record<string, unknown>>, options?: {
|
|
28
29
|
label?: string;
|
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.28",
|
|
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.28",
|
|
87
|
+
"@mistriwork/ui": "1.0.0-rc.28",
|
|
88
88
|
"intl-messageformat": "12.1.2",
|
|
89
89
|
"qrcode-generator": "^2.0.4"
|
|
90
90
|
},
|