@mistriwork/kit 1.0.0-rc.12 → 1.0.0-rc.14
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/components/Composer.js +2 -2
- package/dist/client/components/Diagram.js +1 -1
- package/dist/client/components/FieldArranger.d.ts +1 -0
- package/dist/client/components/FieldArranger.js +1 -0
- package/dist/client/components/Grid.js +27 -1
- package/dist/client/components/Summary.js +1 -1
- package/dist/client/components/gridSizing.d.ts +3 -0
- package/dist/client/components/gridSizing.js +1 -1
- package/dist/client/connectionList.d.ts +4 -1
- package/dist/client/connectionList.js +4 -1
- package/dist/client/copy/shell/visualTheme.d.ts +2 -0
- package/dist/client/copy/shell/visualTheme.js +2 -0
- package/dist/client/copy/workbench/components/Composer.d.ts +2 -2
- package/dist/client/copy/workbench/components/Composer.js +2 -2
- package/dist/client/copy/workbench/components/Diagram.d.ts +1 -1
- package/dist/client/copy/workbench/components/Diagram.js +1 -1
- package/dist/client/copy/workbench/components/Summary.d.ts +3 -3
- package/dist/client/copy/workbench/components/Summary.js +3 -3
- package/dist/client/core.d.ts +19 -4
- package/dist/client/core.js +16 -1
- package/dist/client/draftRecovery.d.ts +4 -1
- package/dist/client/features.css +6 -3
- package/dist/client/fonts/faces.css +53 -0
- package/dist/client/palette.d.ts +4 -1
- package/dist/client/palette.js +4 -1
- package/dist/client/savedPages.d.ts +16 -4
- package/dist/client/savedPages.js +13 -1
- package/dist/client/visualTheme.d.ts +29 -0
- package/dist/client/visualTheme.js +94 -17
- package/dist/client/visualThemes.css +2 -1
- package/dist/client/write.d.ts +3 -0
- package/dist/client/write.js +3 -0
- package/dist/clientFiles.js +2 -2
- package/dist/vite.d.ts +2 -2
- package/package.json +16 -3
|
@@ -115,7 +115,7 @@ function summaryLabel(fn, column, isDate) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
function SummariseMenu({ fk, child }) {
|
|
118
|
-
const items = [{ value: '', label: say('
|
|
118
|
+
const items = [{ value: '', label: say('summarize'), detail: say('aTotalAnAverage') }];
|
|
119
119
|
for (const column of child.columns) {
|
|
120
120
|
if (column.primaryKey || column.references)
|
|
121
121
|
continue;
|
|
@@ -133,7 +133,7 @@ function SummariseMenu({ fk, child }) {
|
|
|
133
133
|
}
|
|
134
134
|
if (items.length === 1)
|
|
135
135
|
return null;
|
|
136
|
-
return (_jsx("span", { className: "composer-menu", children: _jsx(Dropdown, { items: items, value: "", ariaLabel: say('
|
|
136
|
+
return (_jsx("span", { className: "composer-menu", children: _jsx(Dropdown, { items: items, value: "", ariaLabel: say('summarizeName', { name: child.name }), onChange: (value) => {
|
|
137
137
|
if (!value)
|
|
138
138
|
return;
|
|
139
139
|
const [fn, column] = value.split(':');
|
|
@@ -225,7 +225,7 @@ export function NeighbourhoodDiagram({ tableId, expandable = true }) {
|
|
|
225
225
|
return _jsx("p", { className: "note", children: say('hasNoForeignKeys', { tableId }) });
|
|
226
226
|
const { left, right, self, width, height, leftX, midX, rightX, focusTop, focusAnchor, drawn } = layout;
|
|
227
227
|
const drawing = (_jsxs(_Fragment, { children: [_jsx(Arrow, { id: "arrow", size: 7 }), left.map((node) => (_jsxs("g", { children: [_jsx(Edge, { x1: leftX + NODE_W, y1: node.top + HEAD_H / 2, x2: midX, y2: focusAnchor, label: node.columns.join(' · '), marker: "arrow" }), _jsx(Node, { tableId: node.table, x: leftX, y: node.top, role: "out", repaint: repaint })] }, node.table))), right.map((node) => (_jsxs("g", { children: [_jsx(Edge, { x1: rightX, y1: node.top + HEAD_H / 2, x2: midX + NODE_W, y2: focusAnchor, label: node.columns.join(' · '), marker: "arrow" }), _jsx(Node, { tableId: node.table, x: rightX, y: node.top, role: "in", repaint: repaint })] }, node.table))), self.length ? (_jsxs(_Fragment, { children: [_jsx("path", { className: "edge", markerEnd: "url(#arrow)", d: `M${midX + NODE_W * 0.3},${focusTop} C${midX + NODE_W * 0.1},${focusTop - 34} ${midX + NODE_W * 0.9},${focusTop - 34} ${midX + NODE_W * 0.7},${focusTop}` }), _jsx("text", { x: midX + NODE_W / 2, y: focusTop - 22, className: "edge-label", textAnchor: "middle", children: self.map((fk) => fk.from.columns.join(', ')).join(' · ') })] })) : null, _jsx(Node, { tableId: tableId, x: midX, y: focusTop, role: "focus", repaint: repaint })] }));
|
|
228
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "diagram-head", children: [_jsx("h2", { className: "diagram-title", children: say('andWhatItTouches', { name: focus.name }) }), _jsx(SchemaExportControl, { schema: schemaOf(), only: drawn, picture: () => ({ svg: svg.current ?? undefined, size: { width, height } }) })] }), _jsx(PanZoom, { size: { width, height }, focus: { x: midX + NODE_W / 2, y: focusAnchor }, svgRef: svg, label: say('
|
|
228
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "diagram-head", children: [_jsx("h2", { className: "diagram-title", children: say('andWhatItTouches', { name: focus.name }) }), _jsx(SchemaExportControl, { schema: schemaOf(), only: drawn, picture: () => ({ svg: svg.current ?? undefined, size: { width, height } }) })] }), _jsx(PanZoom, { size: { width, height }, focus: { x: midX + NODE_W / 2, y: focusAnchor }, svgRef: svg, label: say('foreignKeyNeighborhood', { tableId }), expand: expandable ? () => setFull(true) : undefined, children: drawing }), _jsxs("p", { className: "diagram-legend", children: [_jsx("span", { className: "legend-out", children: say('points') }), _jsx("span", { children: ` ${focus.name} ` }), _jsx("span", { className: "legend-in", children: say('pointed') })] }), full ? (_jsx(Fullscreen, { onClose: () => setFull(false), children: _jsx("div", { className: "diagram", children: _jsx(NeighbourhoodDiagram, { tableId: tableId, expandable: false }) }) })) : null] }));
|
|
229
229
|
}
|
|
230
230
|
/* ---------- the whole schema ---------- */
|
|
231
231
|
export function SchemaDiagram({ expandable = true }) {
|
|
@@ -19,6 +19,7 @@ interface FieldArrangerProps {
|
|
|
19
19
|
/** Redraw everything after a hand-over: two groups change and the other one may be open. */
|
|
20
20
|
onSend?: () => void;
|
|
21
21
|
}
|
|
22
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
22
23
|
export declare const carriedField: () => {
|
|
23
24
|
name: string;
|
|
24
25
|
owner: unknown;
|
|
@@ -11,6 +11,7 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
11
11
|
import { say } from '../copy/record/components/FieldArranger.js';
|
|
12
12
|
/** The field being dragged between groups, or null. */
|
|
13
13
|
let carried = null;
|
|
14
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
14
15
|
export const carriedField = () => carried;
|
|
15
16
|
export function FieldArranger({ all, chosen, columns = 1, noun = 'layout', heading = say('fields'), label = (n) => n, typeOf = () => '', onChange, owner, others = [], onSend, }) {
|
|
16
17
|
const list = useRef(null);
|
|
@@ -72,6 +72,10 @@ const FOLD_ROOM = 150;
|
|
|
72
72
|
const TAGS_SHOWN = 3;
|
|
73
73
|
/* The mark a reference's head draws after its label, and its sizing counts. */
|
|
74
74
|
const REFERENCE_MARK = '→';
|
|
75
|
+
/** A head's caret and each of its move buttons: 24px (style.css, `.th-filter`, `.th-move`). */
|
|
76
|
+
const HEAD_CONTROL = 24;
|
|
77
|
+
/** A device that cannot hover keeps a head's caret and moves in the head's flow, beside its label (style.css). */
|
|
78
|
+
const touchHeads = () => typeof matchMedia === 'function' && matchMedia('(hover: none)').matches;
|
|
75
79
|
/** Beyond a few hundred rows the DOM, not the database, is the bottleneck. */
|
|
76
80
|
const VIRTUAL_THRESHOLD = 300;
|
|
77
81
|
const OVERSCAN = 12;
|
|
@@ -571,6 +575,12 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
571
575
|
/* A reference's arrow stands beside its label in the sort (the head, below), after the sort's 4px gap:
|
|
572
576
|
uncounted, it took the room past the label that the resizer's strip is (style.css). */
|
|
573
577
|
mark: byName.get(name)?.references ? 4 + (headMeasure ? headSet(REFERENCE_MARK) : GRID_HEAD_CHAR) : undefined,
|
|
578
|
+
/* On touch the head's caret and moves stand beside its label, which gives way to them. The key's label is the
|
|
579
|
+
shortest and gave way whole: a phone drew the Workbench's "id KEY ↓" as "KEY ↓". Its column keeps their
|
|
580
|
+
room; any other head's label may still give way, as it was designed to. */
|
|
581
|
+
touchControls: byName.get(name)?.primaryKey && !shell().inApp() && touchHeads()
|
|
582
|
+
? HEAD_CONTROL * ((interactive ? 2 : 0) + (language && (!table?.filterable || table.filterable.includes(name)) ? 1 : 0))
|
|
583
|
+
: undefined,
|
|
574
584
|
showTime: plan.showTime,
|
|
575
585
|
values: rows.slice(0, GRID_SIZE_SAMPLE).map((row) => {
|
|
576
586
|
if (labelColumn && row[labelColumn] != null)
|
|
@@ -610,7 +620,23 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
|
|
|
610
620
|
(Boolean(display?.tone && !display.format && !display.bar) ||
|
|
611
621
|
(Boolean(byName.get(name)?.allowed?.length) && STATUS_NAME.test(name))),
|
|
612
622
|
};
|
|
613
|
-
}), [
|
|
623
|
+
}), [
|
|
624
|
+
asked,
|
|
625
|
+
plans,
|
|
626
|
+
referenceLabels,
|
|
627
|
+
table?.id,
|
|
628
|
+
table?.filterable,
|
|
629
|
+
labels,
|
|
630
|
+
interactive,
|
|
631
|
+
language,
|
|
632
|
+
captionLanguage,
|
|
633
|
+
byName,
|
|
634
|
+
rows,
|
|
635
|
+
titleName,
|
|
636
|
+
headFace,
|
|
637
|
+
cellChips,
|
|
638
|
+
shift,
|
|
639
|
+
]);
|
|
614
640
|
/* Column i's cell follows the expander's when there is one. */
|
|
615
641
|
const measureText = useMemo(() => cellFonts.length
|
|
616
642
|
? (text, column) => textMeasure(cellFonts[Math.min(column + (slotted ? 1 : 0), cellFonts.length - 1)])?.(text) ?? text.length * 8
|
|
@@ -89,5 +89,5 @@ export function SchemaSummary({ shape, label, id }) {
|
|
|
89
89
|
setOpen(id, !open);
|
|
90
90
|
};
|
|
91
91
|
const start = shape.start;
|
|
92
|
-
return (_jsxs("section", { className: open ? 'shape' : 'shape shape-closed', children: [_jsxs("div", { className: "shape-head", children: [_jsx("button", { type: "button", className: "shape-toggle", "aria-expanded": open, title: say('showOrHideTheSummary'), onClick: toggle, children: label }), _jsx("span", { className: "shape-counts", children: say('common.tables', { count: counts.tables }) + (counts.views ? `, ${say('views', { count: counts.views })}` : '') }), shape.hubs.length ? _jsx("span", { className: "shape-gist", children: say('
|
|
92
|
+
return (_jsxs("section", { className: open ? 'shape' : 'shape shape-closed', children: [_jsxs("div", { className: "shape-head", children: [_jsx("button", { type: "button", className: "shape-toggle", "aria-expanded": open, title: say('showOrHideTheSummary'), onClick: toggle, children: label }), _jsx("span", { className: "shape-counts", children: say('common.tables', { count: counts.tables }) + (counts.views ? `, ${say('views', { count: counts.views })}` : '') }), shape.hubs.length ? _jsx("span", { className: "shape-gist", children: say('centers', { name: shape.hubs[0].table.name }) }) : null, start ? (_jsx("button", { type: "button", className: "ghost shape-start", title: say('theTableThatConnects'), onClick: () => go(tableView(start.id), 'reset'), children: say('start', { name: start.name }) })) : null] }), _jsxs("div", { className: "shape-body", children: [_jsxs("ul", { className: "shape-lines", children: [shape.hubs.length ? (_jsxs(Line, { label: say('centersOnLabel'), children: [_jsx(Link, { table: shape.hubs[0].table }), say('referencedByOtherTables', { incoming: shape.hubs[0].incoming }), shape.hubs.length > 1 ? (_jsxs(_Fragment, { children: ['. Then ', _jsx(TableList, { tables: shape.hubs.slice(1).map((h) => h.table) })] })) : null] })) : null, shape.leaves.length ? (_jsx(Line, { label: say('recordsEvents'), children: _jsx(TableList, { tables: shape.leaves }) })) : null, shape.joins.length ? (_jsxs(Line, { label: say('connectedThrough'), children: [_jsx(TableList, { tables: shape.joins.map((j) => j.table) }), shape.joins.length === 1 ? say('aJoinTable') : say('whichAreJoinTables')] })) : null, shape.chain.length > 2 ? (_jsx(Line, { label: say('deepestWalk'), children: shape.chain.map((t, i) => (_jsxs(Fragment, { children: [i ? _jsx("span", { className: "shape-arrow", children: " \u2192 " }) : null, _jsx(Link, { table: t })] }, t.id))) })) : null, shape.islands.length ? (_jsxs(Line, { label: say('standingAlone'), children: [_jsx(TableList, { tables: shape.islands }), shape.islands.length === 1 ? say('noForeignKeys') : say('noForeignKeysAtAll')] })) : null] }), _jsx(StartingPoints, { shape: shape })] })] }));
|
|
93
93
|
}
|
|
@@ -26,6 +26,9 @@ interface GridColumnSize {
|
|
|
26
26
|
/** What the sort draws beside the label on its line, the gap before it included: a reference's arrow. A head that
|
|
27
27
|
wraps keeps it beside the label's line, so it is room on both floors. */
|
|
28
28
|
mark?: number;
|
|
29
|
+
/** What stands in the head's flow beside the sort on a device that cannot hover (its caret and move buttons,
|
|
30
|
+
style.css): room on both floors, as `mark` is. */
|
|
31
|
+
touchControls?: number;
|
|
29
32
|
showTime?: boolean;
|
|
30
33
|
/** The column that names the row: it is read whole before the others are. */
|
|
31
34
|
title?: boolean;
|
|
@@ -39,7 +39,7 @@ export function columnSizeHint(column, headChar = GRID_HEAD_CHAR, measure, squee
|
|
|
39
39
|
edge, which the sort never reaches under (style.css); a reference's arrow beside the label is room too (`mark`).
|
|
40
40
|
Its menu caret and its move buttons stand past the label's end where a pointer hovers, so they are not reserved. */
|
|
41
41
|
const counted = Math.min(column.label.length, 22) * headChar;
|
|
42
|
-
const around = (column.controls ? 34 : 28) + (column.mark ?? 0);
|
|
42
|
+
const around = (column.controls ? 34 : 28) + (column.mark ?? 0) + (column.touchControls ?? 0);
|
|
43
43
|
const header = Math.ceil(column.headWidth === undefined ? counted : Math.min(column.headWidth, counted * 1.15)) + around;
|
|
44
44
|
/* An App's head wraps before it widens its column: the floor is its two-line width, and the whole label stays
|
|
45
45
|
what the column wants, so a table with room for it still draws every head on one line. */
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
export declare function bootstrapRequestIdentity(requested: any): Promise<void>;
|
|
3
3
|
export declare function initConnections(onSwitched: any): Promise<void>;
|
|
4
4
|
export declare function refreshConnections(): Promise<void>;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @param {{ draw(picker: HTMLElement): void, retire(picker: HTMLElement): void }} next
|
|
7
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
8
|
+
*/
|
|
6
9
|
export declare function whenConnectionControls(next: {
|
|
7
10
|
draw(picker: HTMLElement): void;
|
|
8
11
|
retire(picker: HTMLElement): void;
|
|
@@ -129,7 +129,10 @@ export async function refreshConnections() {
|
|
|
129
129
|
* @type {{ draw(picker: HTMLElement): void, retire(picker: HTMLElement): void } | null}
|
|
130
130
|
*/
|
|
131
131
|
let controls = null;
|
|
132
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* @param {{ draw(picker: HTMLElement): void, retire(picker: HTMLElement): void }} next
|
|
134
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
135
|
+
*/
|
|
133
136
|
export function whenConnectionControls(next) {
|
|
134
137
|
controls = next;
|
|
135
138
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const say: import("../../messages.js").RoomMessage<{
|
|
2
2
|
readonly default: "Default";
|
|
3
3
|
readonly workbenchDefault: "Workbench default";
|
|
4
|
+
readonly hostLookId: "A host look's id is lowercase letters, digits and dashes: \"{id}\".";
|
|
5
|
+
readonly hostLookTaken: "The host look \"{id}\" has a name the picker already offers.";
|
|
4
6
|
}>;
|
|
@@ -3,4 +3,6 @@ import { defineMessages } from '../../messages.js';
|
|
|
3
3
|
export const say = defineMessages({
|
|
4
4
|
default: 'Default',
|
|
5
5
|
workbenchDefault: 'Workbench default',
|
|
6
|
+
hostLookId: 'A host look\'s id is lowercase letters, digits and dashes: "{id}".',
|
|
7
|
+
hostLookTaken: 'The host look "{id}" has a name the picker already offers.',
|
|
6
8
|
});
|
|
@@ -54,9 +54,9 @@ export declare const say: import("../../../messages.js").RoomMessage<{
|
|
|
54
54
|
readonly smallest: "Smallest {column}";
|
|
55
55
|
readonly latest: "Latest {column}";
|
|
56
56
|
readonly largest: "Largest {column}";
|
|
57
|
-
readonly
|
|
57
|
+
readonly summarize: "Summarize…";
|
|
58
58
|
readonly aTotalAnAverage: "a total, an average, a range";
|
|
59
|
-
readonly
|
|
59
|
+
readonly summarizeName: "Summarize {name}";
|
|
60
60
|
readonly aViewIsOne: "A view is one row per {name}, ";
|
|
61
61
|
readonly withAnyFieldFromAny: "with any field from any table it points at. Tick fields here; press “Add” beside a related table on the left to bring its fields into this list too.";
|
|
62
62
|
readonly baseTableGroup: "base table";
|
|
@@ -50,9 +50,9 @@ export const say = defineMessages({
|
|
|
50
50
|
smallest: 'Smallest {column}',
|
|
51
51
|
latest: 'Latest {column}',
|
|
52
52
|
largest: 'Largest {column}',
|
|
53
|
-
|
|
53
|
+
summarize: 'Summarize…',
|
|
54
54
|
aTotalAnAverage: 'a total, an average, a range',
|
|
55
|
-
|
|
55
|
+
summarizeName: 'Summarize {name}',
|
|
56
56
|
aViewIsOne: 'A view is one row per {name}, ',
|
|
57
57
|
withAnyFieldFromAny: 'with any field from any table it points at. Tick fields here; press “Add” beside a related table on the left to bring its fields into this list too.',
|
|
58
58
|
baseTableGroup: 'base table',
|
|
@@ -17,7 +17,7 @@ export declare const say: import("../../../messages.js").RoomMessage<{
|
|
|
17
17
|
readonly unknownTable: "Unknown table.";
|
|
18
18
|
readonly hasNoForeignKeys: "{tableId} has no foreign keys in either direction.";
|
|
19
19
|
readonly andWhatItTouches: "{name} and what it touches";
|
|
20
|
-
readonly
|
|
20
|
+
readonly foreignKeyNeighborhood: "Foreign key neighborhood of {tableId}";
|
|
21
21
|
readonly points: "points at →";
|
|
22
22
|
readonly pointed: "← pointed at by";
|
|
23
23
|
readonly thisDatabaseHasNoTables: "This database has no tables.";
|
|
@@ -16,7 +16,7 @@ export const say = defineMessages({
|
|
|
16
16
|
unknownTable: 'Unknown table.',
|
|
17
17
|
hasNoForeignKeys: '{tableId} has no foreign keys in either direction.',
|
|
18
18
|
andWhatItTouches: '{name} and what it touches',
|
|
19
|
-
|
|
19
|
+
foreignKeyNeighborhood: 'Foreign key neighborhood of {tableId}',
|
|
20
20
|
points: 'points at →',
|
|
21
21
|
pointed: '← pointed at by',
|
|
22
22
|
thisDatabaseHasNoTables: 'This database has no tables.',
|
|
@@ -4,10 +4,10 @@ export declare const say: import("../../../messages.js").RoomMessage<{
|
|
|
4
4
|
readonly queryLanguageParenQuestion: "Query language (?)";
|
|
5
5
|
readonly open: "Open {id}";
|
|
6
6
|
readonly showOrHideTheSummary: "Show or hide the summary";
|
|
7
|
-
readonly
|
|
8
|
-
readonly theTableThatConnects: "The table that connects to the most, with names you can
|
|
7
|
+
readonly centers: "centers on {name}";
|
|
8
|
+
readonly theTableThatConnects: "The table that connects to the most, with names you can recognize rows by";
|
|
9
9
|
readonly start: "Start at {name} →";
|
|
10
|
-
readonly
|
|
10
|
+
readonly centersOnLabel: "Centers on";
|
|
11
11
|
readonly referencedByOtherTables: ", referenced by {incoming} other tables";
|
|
12
12
|
readonly recordsEvents: "Records events in";
|
|
13
13
|
readonly connectedThrough: "Connected through";
|
|
@@ -6,10 +6,10 @@ export const say = defineMessages({
|
|
|
6
6
|
queryLanguageParenQuestion: 'Query language (?)',
|
|
7
7
|
open: 'Open {id}',
|
|
8
8
|
showOrHideTheSummary: 'Show or hide the summary',
|
|
9
|
-
|
|
10
|
-
theTableThatConnects: 'The table that connects to the most, with names you can
|
|
9
|
+
centers: 'centers on {name}',
|
|
10
|
+
theTableThatConnects: 'The table that connects to the most, with names you can recognize rows by',
|
|
11
11
|
start: 'Start at {name} →',
|
|
12
|
-
|
|
12
|
+
centersOnLabel: 'Centers on',
|
|
13
13
|
referencedByOtherTables: ', referenced by {incoming} other tables',
|
|
14
14
|
recordsEvents: 'Records events in',
|
|
15
15
|
connectedThrough: 'Connected through',
|
package/dist/client/core.d.ts
CHANGED
|
@@ -166,8 +166,14 @@ export declare function renderCrumbs(): void;
|
|
|
166
166
|
*/
|
|
167
167
|
export declare function go(entry: any, mode?: string): void;
|
|
168
168
|
export declare function backTo(index: any): void;
|
|
169
|
-
/**
|
|
170
|
-
|
|
169
|
+
/**
|
|
170
|
+
* A table view, optionally filtered. The query text is what the bar shows.
|
|
171
|
+
*
|
|
172
|
+
* @param {*} tableId
|
|
173
|
+
* @param {*} [query]
|
|
174
|
+
* @param {*} [tab]
|
|
175
|
+
*/
|
|
176
|
+
export declare function tableView(tableId: any, query?: any, tab?: any): {
|
|
171
177
|
kind: string;
|
|
172
178
|
table: any;
|
|
173
179
|
query: any;
|
|
@@ -199,8 +205,13 @@ export declare function rowView(tableId: any, key: any, label: any): {
|
|
|
199
205
|
* `table` is the page's base rather than a table being browsed, so that the
|
|
200
206
|
* sidebar highlights the right thing and a page can find its way back to a
|
|
201
207
|
* suggested layout when the id names no configured page.
|
|
208
|
+
*
|
|
209
|
+
* @param {*} pageId
|
|
210
|
+
* @param {*} [tableId]
|
|
211
|
+
* @param {*} [key]
|
|
212
|
+
* @param {*} [label]
|
|
202
213
|
*/
|
|
203
|
-
export declare function pageView(pageId: any, tableId
|
|
214
|
+
export declare function pageView(pageId: any, tableId?: any, key?: any, label?: any): {
|
|
204
215
|
kind: string;
|
|
205
216
|
pageId: any;
|
|
206
217
|
table: any;
|
|
@@ -306,7 +317,11 @@ export declare function quote(value: any): string;
|
|
|
306
317
|
* and sending them to a menu to find Undo wastes the seconds in which they
|
|
307
318
|
* still remember what they did. Anything that needs more than one verb belongs
|
|
308
319
|
* in a dialog rather than here.
|
|
320
|
+
*
|
|
321
|
+
* @param {*} message
|
|
322
|
+
* @param {string} [tone]
|
|
323
|
+
* @param {*} [action]
|
|
309
324
|
*/
|
|
310
|
-
export declare function toast(message: any, tone
|
|
325
|
+
export declare function toast(message: any, tone?: string, action?: any): void;
|
|
311
326
|
export declare function loadJson(key: any, fallback: any): any;
|
|
312
327
|
export declare function saveJson(key: any, value: any): boolean;
|
package/dist/client/core.js
CHANGED
|
@@ -656,7 +656,13 @@ export function backTo(index) {
|
|
|
656
656
|
state.navMode = 'push';
|
|
657
657
|
render();
|
|
658
658
|
}
|
|
659
|
-
/**
|
|
659
|
+
/**
|
|
660
|
+
* A table view, optionally filtered. The query text is what the bar shows.
|
|
661
|
+
*
|
|
662
|
+
* @param {*} tableId
|
|
663
|
+
* @param {*} [query]
|
|
664
|
+
* @param {*} [tab]
|
|
665
|
+
*/
|
|
660
666
|
export function tableView(tableId, query, tab) {
|
|
661
667
|
return { kind: 'table', table: tableId, query: query ?? tableId, tab: tab ?? 'rows' };
|
|
662
668
|
}
|
|
@@ -681,6 +687,11 @@ export function rowView(tableId, key, label) {
|
|
|
681
687
|
* `table` is the page's base rather than a table being browsed, so that the
|
|
682
688
|
* sidebar highlights the right thing and a page can find its way back to a
|
|
683
689
|
* suggested layout when the id names no configured page.
|
|
690
|
+
*
|
|
691
|
+
* @param {*} pageId
|
|
692
|
+
* @param {*} [tableId]
|
|
693
|
+
* @param {*} [key]
|
|
694
|
+
* @param {*} [label]
|
|
684
695
|
*/
|
|
685
696
|
export function pageView(pageId, tableId, key, label) {
|
|
686
697
|
return { kind: 'page', pageId, table: tableId, key, label };
|
|
@@ -1029,6 +1040,10 @@ export function quote(value) {
|
|
|
1029
1040
|
* and sending them to a menu to find Undo wastes the seconds in which they
|
|
1030
1041
|
* still remember what they did. Anything that needs more than one verb belongs
|
|
1031
1042
|
* in a dialog rather than here.
|
|
1043
|
+
*
|
|
1044
|
+
* @param {*} message
|
|
1045
|
+
* @param {string} [tone]
|
|
1046
|
+
* @param {*} [action]
|
|
1032
1047
|
*/
|
|
1033
1048
|
export function toast(message, tone = 'info', action) {
|
|
1034
1049
|
const host = $('toast');
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Browser recovery is a separate document from acknowledged server state.
|
|
3
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
4
|
+
*/
|
|
2
5
|
export interface RecoveredDraft<T> {
|
|
3
6
|
version: 1;
|
|
4
7
|
original: string;
|
package/dist/client/features.css
CHANGED
|
@@ -1088,14 +1088,17 @@ body.type-sans {
|
|
|
1088
1088
|
Tabular numerals keep columns of figures aligned, which is what makes
|
|
1089
1089
|
a non-mono face survivable in a data tool. */
|
|
1090
1090
|
--mono: "Inter", "IBM Plex Sans", "Segoe UI Variable Text", ui-sans-serif, system-ui, sans-serif;
|
|
1091
|
+
/* The reader's pick wins over a host look's data face (tokens.css). */
|
|
1092
|
+
--data-face: var(--mono);
|
|
1091
1093
|
font-variant-numeric: tabular-nums;
|
|
1092
1094
|
}
|
|
1093
1095
|
/* The interface is sans everywhere (appnav points --mono at it). Code keeps
|
|
1094
1096
|
the code face; in the database browser so do the short values a grid sets
|
|
1095
|
-
apart — ids, dates, codes — as a data tool reads them
|
|
1096
|
-
|
|
1097
|
+
apart — ids, dates, codes — as a data tool reads them, unless a host look
|
|
1098
|
+
names its data face (--data-face, tokens.css), which the reader's own pick
|
|
1099
|
+
overrides. An App's lists read as its theme dresses them. */
|
|
1097
1100
|
body :is(.ddl, .explain, #query, .applist-filter, pre, code, kbd) { font-family: var(--code); }
|
|
1098
|
-
body:not(.app-mode):not(.type-sans) td.mono { font-family: var(--code); font-size: var(--text-sm); }
|
|
1101
|
+
body:not(.app-mode):not(.type-sans) td.mono { font-family: var(--data-face, var(--code)); font-size: var(--text-sm); }
|
|
1099
1102
|
body.type-sans .ddl,
|
|
1100
1103
|
body.type-sans .explain,
|
|
1101
1104
|
body.type-sans #query,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* The kit's own faces, for a host product's look (`@mistriwork/kit/client/fonts/faces.css`): every font file the kit
|
|
2
|
+
ships, declared once each under the family names its looks use, so a look of the host's own can name Barlow, Barlow
|
|
3
|
+
Semi Condensed, IBM Plex Mono or Inter in a stack, as Workshop, Ledger and Lumen do. Each is under the SIL Open Font
|
|
4
|
+
License, whose text travels beside it (the *-OFL.txt files here; the kit's Vite preset copies them into the build).
|
|
5
|
+
A rule costs nothing until a line is drawn in its family, so importing this sheet fetches no font a page does not
|
|
6
|
+
set. The looks' own sheets (workshopLook.css, ledgerLook.css, lumenLook.css) keep their own rules and their cut
|
|
7
|
+
fallbacks, so a page wearing a kit look never loads this one. `swap`, as theirs: a host holds its page until its
|
|
8
|
+
look's sheet is in (visualTheme.ts registerHostLooks), so the face is mostly there by the first paint. */
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: Barlow;
|
|
11
|
+
font-style: normal;
|
|
12
|
+
font-weight: 400;
|
|
13
|
+
font-display: swap;
|
|
14
|
+
src: url('./barlow-400.woff2') format('woff2');
|
|
15
|
+
}
|
|
16
|
+
@font-face {
|
|
17
|
+
font-family: Barlow;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
font-display: swap;
|
|
21
|
+
src: url('./barlow-600.woff2') format('woff2');
|
|
22
|
+
}
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: 'Barlow Semi Condensed';
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
font-display: swap;
|
|
28
|
+
src: url('./barlow-semi-condensed-700.woff2') format('woff2');
|
|
29
|
+
}
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: 'IBM Plex Mono';
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
font-display: swap;
|
|
35
|
+
src: url('./ibm-plex-mono-400.woff2') format('woff2');
|
|
36
|
+
}
|
|
37
|
+
@font-face {
|
|
38
|
+
font-family: 'IBM Plex Mono';
|
|
39
|
+
font-style: normal;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
font-display: swap;
|
|
42
|
+
src: url('./ibm-plex-mono-500.woff2') format('woff2');
|
|
43
|
+
}
|
|
44
|
+
/* Latin, variable from 100 to 900, its `tnum` cut to the ten figures (lumenLook.css says why). */
|
|
45
|
+
@font-face {
|
|
46
|
+
font-family: Inter;
|
|
47
|
+
font-style: normal;
|
|
48
|
+
font-weight: 100 900;
|
|
49
|
+
font-display: swap;
|
|
50
|
+
src: url('./inter-latin.woff2') format('woff2');
|
|
51
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
52
|
+
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
53
|
+
}
|
package/dist/client/palette.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ export type PaletteItem = {
|
|
|
6
6
|
run: () => unknown;
|
|
7
7
|
};
|
|
8
8
|
/** @typedef {{ kind: string, label: string, search: string, detail?: string, run: () => unknown }} PaletteItem */
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @param {'places' | 'databases'} where @param {() => PaletteItem[]} source
|
|
11
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
12
|
+
*/
|
|
10
13
|
export declare function addPaletteSource(where: 'places' | 'databases', source: () => PaletteItem[]): void;
|
|
11
14
|
/** Everything the palette can take you to, before filtering. */
|
|
12
15
|
export declare function entries(): any[];
|
package/dist/client/palette.js
CHANGED
|
@@ -41,7 +41,10 @@ import { addHostListener, portalRoot, shellBody, shellQuery } from './shellHost.
|
|
|
41
41
|
*/
|
|
42
42
|
const sources = { places: [], databases: [] };
|
|
43
43
|
/** @typedef {{ kind: string, label: string, search: string, detail?: string, run: () => unknown }} PaletteItem */
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* @param {'places' | 'databases'} where @param {() => PaletteItem[]} source
|
|
46
|
+
* @public the database browser's (scripts/boundary/entries.json, "host")
|
|
47
|
+
*/
|
|
45
48
|
export function addPaletteSource(where, source) {
|
|
46
49
|
sources[where].push(source);
|
|
47
50
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/** @param {() => void} fn */
|
|
2
2
|
export declare function whenSavedPagesChange(fn: () => void): void;
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Pages saved for the connection in hand, read from the local mirror.
|
|
5
|
+
*
|
|
6
|
+
* @param {*} [tableId] only the pages based on this table
|
|
7
|
+
*/
|
|
8
|
+
export declare function savedPages(tableId?: any): import("@mistriwork/engine/shared/pageModel.js").PageDef[];
|
|
5
9
|
/**
|
|
6
10
|
* Pull this connection's saved pages from the server into the mirror.
|
|
7
11
|
*
|
|
@@ -11,5 +15,13 @@ export declare function savedPages(tableId: any): import("@mistriwork/engine/sha
|
|
|
11
15
|
* browser saved.
|
|
12
16
|
*/
|
|
13
17
|
export declare function loadSavedPages(): Promise<void>;
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param {*} page
|
|
20
|
+
* @param {string | null} [connection] the connection written to; the one in hand, unless given
|
|
21
|
+
*/
|
|
22
|
+
export declare function savePage(page: any, connection?: string | null): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* @param {*} id
|
|
25
|
+
* @param {string | null} [connection] the connection written to; the one in hand, unless given
|
|
26
|
+
*/
|
|
27
|
+
export declare function deletePage(id: any, connection?: string | null): Promise<void>;
|
|
@@ -54,7 +54,11 @@ async function writePage(id, page, connection) {
|
|
|
54
54
|
clearTimeout(timer);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Pages saved for the connection in hand, read from the local mirror.
|
|
59
|
+
*
|
|
60
|
+
* @param {*} [tableId] only the pages based on this table
|
|
61
|
+
*/
|
|
58
62
|
export function savedPages(tableId) {
|
|
59
63
|
const all = mirrorFor(state.activeConnection);
|
|
60
64
|
const pages = Object.values(all);
|
|
@@ -93,6 +97,10 @@ export async function loadSavedPages() {
|
|
|
93
97
|
/* Server-side pages unavailable; the mirror stands. */
|
|
94
98
|
}
|
|
95
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* @param {*} page
|
|
102
|
+
* @param {string | null} [connection] the connection written to; the one in hand, unless given
|
|
103
|
+
*/
|
|
96
104
|
export async function savePage(page, connection = state.activeConnection) {
|
|
97
105
|
const owner = sessionIdentity();
|
|
98
106
|
if (!connection)
|
|
@@ -108,6 +116,10 @@ export async function savePage(page, connection = state.activeConnection) {
|
|
|
108
116
|
if (state.activeConnection === connection)
|
|
109
117
|
pagesChanged?.();
|
|
110
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* @param {*} id
|
|
121
|
+
* @param {string | null} [connection] the connection written to; the one in hand, unless given
|
|
122
|
+
*/
|
|
111
123
|
export async function deletePage(id, connection = state.activeConnection) {
|
|
112
124
|
const owner = sessionIdentity();
|
|
113
125
|
if (!connection)
|
|
@@ -7,12 +7,41 @@ export declare const VISUAL_THEME_REGISTRY_EVENT = "mistri:visual-theme-registry
|
|
|
7
7
|
/** The look inside an App when neither the reader nor the App names one.
|
|
8
8
|
Workbench instead defaults to its native tokens in style.css. */
|
|
9
9
|
export declare const DEFAULT_VISUAL_THEME = "workshop";
|
|
10
|
+
/**
|
|
11
|
+
* A look a host product declares for its own screens (the database browser's Workbench): its own stylesheet, worn
|
|
12
|
+
* over the native tokens rather than over a kit look. The reader picks it in Preferences beside the native default and
|
|
13
|
+
* the built-in looks; it persists as the Workbench's other picks do (`WORKBENCH_VISUAL_THEME_KEY`, which the startup
|
|
14
|
+
* veil's signature already reads, so its first paint is cached apart from every other look's), and while it is worn
|
|
15
|
+
* the root carries `data-host-look="<id>"` and no kit look attribute. Every rule in its sheet keys on that attribute,
|
|
16
|
+
* so a sheet left on the page after the reader picks another look draws nothing. An App's screens never offer one: an
|
|
17
|
+
* App is dressed by its own theme.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export interface HostLook {
|
|
21
|
+
/** Lowercase letters, digits and dashes, starting with a letter: the attribute's value and what is stored. */
|
|
22
|
+
id: string;
|
|
23
|
+
/** What Preferences calls it, in the host's words. */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Its stylesheet: an address the page links, or a module that loads it (`() => import('./looks/blueprint.css')`). */
|
|
26
|
+
sheet: string | (() => Promise<unknown>);
|
|
27
|
+
/** Up to three colors the picker shows beside its name. */
|
|
28
|
+
swatches?: readonly string[];
|
|
29
|
+
}
|
|
10
30
|
/** The built-in looks, then the App's own themes. */
|
|
11
31
|
export declare function visualThemeOptions(): Array<{
|
|
12
32
|
value: string;
|
|
13
33
|
label: string;
|
|
14
34
|
swatches: readonly string[];
|
|
15
35
|
}>;
|
|
36
|
+
/** The host look worn, or undefined: the native default, a kit look, or an App's screen. @public */
|
|
37
|
+
export declare function hostLookChoice(): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The looks a host product offers on its own screens (`HostLook`), called once from its main before its shell boots:
|
|
40
|
+
* the stored pick is read again, since the page's look was worn before the main ran (shellStart.js), and a pick of a
|
|
41
|
+
* look the host no longer declares falls back to the native default for this page and stays stored.
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare function registerHostLooks(looks: readonly HostLook[]): void;
|
|
16
45
|
/** The look in force: the reader's pick, else the App's preset, else Workshop. */
|
|
17
46
|
export declare function visualThemeChoice(): string;
|
|
18
47
|
/** The theme the App itself wears, where this screen is an App's and the reader may pick another: what the picker marks and what a reset returns to. */
|
|
@@ -31,6 +31,10 @@ let palettePreferences = new Map();
|
|
|
31
31
|
let inApp = false;
|
|
32
32
|
let locked = false;
|
|
33
33
|
let isolated = false;
|
|
34
|
+
/** The attribute a worn host look sets on the root. */
|
|
35
|
+
const HOST_LOOK_ATTRIBUTE = 'data-host-look';
|
|
36
|
+
const LOOK_ID = /^[a-z][a-z0-9-]{0,47}$/;
|
|
37
|
+
let hostLooks = [];
|
|
34
38
|
const swatches = (theme) => [theme.light.navGround ?? theme.light.surface, theme.light.accent, theme.light.chart2 ?? theme.light.ink];
|
|
35
39
|
/** The built-in looks, then the App's own themes. */
|
|
36
40
|
export function visualThemeOptions() {
|
|
@@ -41,7 +45,52 @@ export function visualThemeOptions() {
|
|
|
41
45
|
label: theme.label,
|
|
42
46
|
swatches: swatches(effectiveThemeDefinition(theme, paletteChoiceFor(theme))),
|
|
43
47
|
}));
|
|
44
|
-
|
|
48
|
+
if (inApp)
|
|
49
|
+
return themes;
|
|
50
|
+
return [
|
|
51
|
+
{ value: 'default', label: say('workbenchDefault'), swatches: [] },
|
|
52
|
+
...hostLooks.map((look) => ({ value: look.id, label: look.label, swatches: look.swatches?.slice(0, 3) ?? [] })),
|
|
53
|
+
...themes,
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
/** The host look this screen wears, where it wears one. */
|
|
57
|
+
const wornHostLook = () => (inApp ? undefined : hostLooks.find((look) => look.id === workbenchPreferred));
|
|
58
|
+
/** Whether a kit look dresses this screen: always in an App; outside one, only the built-in look its reader picked, never
|
|
59
|
+
the native default or a host look, which are worn over the native tokens. */
|
|
60
|
+
const kitLookWorn = () => inApp || Boolean(workbenchPreferred && themePreset(workbenchPreferred));
|
|
61
|
+
/** The host look worn, or undefined: the native default, a kit look, or an App's screen. @public */
|
|
62
|
+
export function hostLookChoice() {
|
|
63
|
+
return wornHostLook()?.id;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The looks a host product offers on its own screens (`HostLook`), called once from its main before its shell boots:
|
|
67
|
+
* the stored pick is read again, since the page's look was worn before the main ran (shellStart.js), and a pick of a
|
|
68
|
+
* look the host no longer declares falls back to the native default for this page and stays stored.
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export function registerHostLooks(looks) {
|
|
72
|
+
const ids = new Set();
|
|
73
|
+
for (const look of looks) {
|
|
74
|
+
if (!LOOK_ID.test(look.id))
|
|
75
|
+
throw new Error(say('hostLookId', { id: look.id }));
|
|
76
|
+
if (look.id === 'default' || themePreset(look.id) || ids.has(look.id))
|
|
77
|
+
throw new Error(say('hostLookTaken', { id: look.id }));
|
|
78
|
+
ids.add(look.id);
|
|
79
|
+
}
|
|
80
|
+
hostLooks = [...looks];
|
|
81
|
+
workbenchPreferred = storedWorkbenchLook();
|
|
82
|
+
apply();
|
|
83
|
+
window.dispatchEvent(new Event(VISUAL_THEME_REGISTRY_EVENT));
|
|
84
|
+
}
|
|
85
|
+
/** The Workbench's stored pick, while it names a built-in look or a host look this page declares. */
|
|
86
|
+
function storedWorkbenchLook() {
|
|
87
|
+
try {
|
|
88
|
+
const value = window.localStorage.getItem(WORKBENCH_VISUAL_THEME_KEY);
|
|
89
|
+
return value && (themePreset(value) || hostLooks.some((look) => look.id === value)) ? value : undefined;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return undefined; /* Native Workbench needs no storage. */
|
|
93
|
+
}
|
|
45
94
|
}
|
|
46
95
|
const offered = (value) => typeof value === 'string' && visualThemeOptions().some((theme) => theme.value === value);
|
|
47
96
|
/** The look in force: the reader's pick, else the App's preset, else Workshop. */
|
|
@@ -101,7 +150,7 @@ export function resetVisualTheme() {
|
|
|
101
150
|
const ownColorsArePalette = (theme) => themePreset(theme.id) === theme && Boolean(theme.palettes?.some((palette) => palette.id === theme.defaultPalette));
|
|
102
151
|
/** Palette choices belong to their theme, not to an unrelated App using the same slug. */
|
|
103
152
|
export function visualPaletteOptions() {
|
|
104
|
-
if (!
|
|
153
|
+
if (!kitLookWorn())
|
|
105
154
|
return [];
|
|
106
155
|
const theme = selectedThemeBase();
|
|
107
156
|
return [
|
|
@@ -127,7 +176,7 @@ function paletteChoiceFor(theme) {
|
|
|
127
176
|
return offered(fallback) ? fallback : 'default';
|
|
128
177
|
}
|
|
129
178
|
export function visualPaletteChoice() {
|
|
130
|
-
if (!
|
|
179
|
+
if (!kitLookWorn())
|
|
131
180
|
return 'default';
|
|
132
181
|
return paletteChoiceFor(selectedThemeBase());
|
|
133
182
|
}
|
|
@@ -252,6 +301,33 @@ function themeSheet(href) {
|
|
|
252
301
|
}
|
|
253
302
|
return arriving;
|
|
254
303
|
}
|
|
304
|
+
/* A host look's sheet, fetched once: linked where it is an address, imported where it is a module. Like a kit look's,
|
|
305
|
+
one that cannot come leaves the native tokens, which read; it is not worth a failed boot. */
|
|
306
|
+
const hostSheets = new Map();
|
|
307
|
+
function hostSheet(look) {
|
|
308
|
+
let arriving = hostSheets.get(look.id);
|
|
309
|
+
if (!arriving) {
|
|
310
|
+
const failed = (error) => console.error(`The ${look.id} look's sheet did not load.`, error ?? '');
|
|
311
|
+
if (typeof look.sheet === 'function')
|
|
312
|
+
arriving = look.sheet().then(() => undefined, failed);
|
|
313
|
+
else {
|
|
314
|
+
const link = document.createElement('link');
|
|
315
|
+
link.rel = 'stylesheet';
|
|
316
|
+
link.href = look.sheet;
|
|
317
|
+
link.dataset.hostLook = look.id;
|
|
318
|
+
arriving = new Promise((settle) => {
|
|
319
|
+
link.addEventListener('load', () => settle(), { once: true });
|
|
320
|
+
link.addEventListener('error', () => {
|
|
321
|
+
failed();
|
|
322
|
+
settle();
|
|
323
|
+
}, { once: true });
|
|
324
|
+
});
|
|
325
|
+
document.head.append(link);
|
|
326
|
+
}
|
|
327
|
+
hostSheets.set(look.id, arriving);
|
|
328
|
+
}
|
|
329
|
+
return arriving;
|
|
330
|
+
}
|
|
255
331
|
function wearSheets(styles, ...also) {
|
|
256
332
|
const arriving = [...styles.map(sheet), ...also].filter((value) => value !== undefined);
|
|
257
333
|
lookSheet = arriving.length ? Promise.all(arriving).then(() => undefined) : Promise.resolve();
|
|
@@ -281,11 +357,17 @@ const LOOK_ATTRIBUTES = [
|
|
|
281
357
|
];
|
|
282
358
|
function apply() {
|
|
283
359
|
const root = shellRoot();
|
|
284
|
-
/* Native Workbench has no look attributes. Explicit picks use the
|
|
285
|
-
definitions, token owner and sheets as the App looks. */
|
|
286
|
-
|
|
360
|
+
/* Native Workbench has no look attributes, and a host look only its own. Explicit picks of a built-in look use the
|
|
361
|
+
same definitions, token owner and sheets as the App looks. */
|
|
362
|
+
const host = wornHostLook();
|
|
363
|
+
if (host)
|
|
364
|
+
root.setAttribute(HOST_LOOK_ATTRIBUTE, host.id);
|
|
365
|
+
else
|
|
366
|
+
root.removeAttribute(HOST_LOOK_ATTRIBUTE);
|
|
367
|
+
if (!kitLookWorn()) {
|
|
287
368
|
for (const name of LOOK_ATTRIBUTES)
|
|
288
369
|
root.removeAttribute(name);
|
|
370
|
+
wearSheets([], host && hostSheet(host));
|
|
289
371
|
void wearIconWeight(undefined);
|
|
290
372
|
facesStyle?.remove();
|
|
291
373
|
facesStyle = undefined;
|
|
@@ -340,13 +422,7 @@ export function initVisualTheme() {
|
|
|
340
422
|
catch {
|
|
341
423
|
preferred = null; /* The default needs no storage. */
|
|
342
424
|
}
|
|
343
|
-
|
|
344
|
-
const value = window.localStorage.getItem(WORKBENCH_VISUAL_THEME_KEY);
|
|
345
|
-
workbenchPreferred = value && themePreset(value) ? value : undefined;
|
|
346
|
-
}
|
|
347
|
-
catch {
|
|
348
|
-
workbenchPreferred = undefined; /* Native Workbench needs no storage. */
|
|
349
|
-
}
|
|
425
|
+
workbenchPreferred = storedWorkbenchLook();
|
|
350
426
|
customPreferences = new Map();
|
|
351
427
|
try {
|
|
352
428
|
const entries = JSON.parse(window.localStorage.getItem(CUSTOM_THEME_KEY) ?? '[]');
|
|
@@ -456,8 +532,9 @@ export function setVisualTheme(value) {
|
|
|
456
532
|
}
|
|
457
533
|
/** The look's own radius and data face; an App's authored values win over them in appnav. */
|
|
458
534
|
export function visualThemeOverrides() {
|
|
459
|
-
|
|
460
|
-
|
|
535
|
+
/* The native data face: a host look's `--data-face` where it sets one, else the code face (tokens.css). */
|
|
536
|
+
if (!kitLookWorn())
|
|
537
|
+
return { font: 'var(--data-face, var(--code))', square: false };
|
|
461
538
|
const definition = selectedThemeDefinition();
|
|
462
539
|
return {
|
|
463
540
|
...(definition.density ? { density: definition.density } : {}),
|
|
@@ -477,13 +554,13 @@ export function visualThemePalette(dark) {
|
|
|
477
554
|
/** The worn theme's part styles as custom properties, written where the App's accent is (appTheme.js) so a part in
|
|
478
555
|
`accent` is the App's own accent; none outside an App or for a theme without parts. */
|
|
479
556
|
export function customThemePartTokens() {
|
|
480
|
-
if (!
|
|
557
|
+
if (!kitLookWorn())
|
|
481
558
|
return {};
|
|
482
559
|
return partTokens(selectedThemeDefinition().parts);
|
|
483
560
|
}
|
|
484
561
|
/** Values only; appnav remains the sole writer of inline theme tokens. */
|
|
485
562
|
export function customThemeTokens(dark) {
|
|
486
|
-
if (!
|
|
563
|
+
if (!kitLookWorn())
|
|
487
564
|
return {};
|
|
488
565
|
const definition = selectedThemeDefinition();
|
|
489
566
|
const tokens = {};
|
|
@@ -373,7 +373,8 @@
|
|
|
373
373
|
/* Only new preference controls and explicit Mono use unscoped rules. */
|
|
374
374
|
.dd-swatches { display: inline-flex; flex: none; gap: var(--space-1h); margin-right: var(--space-2); }
|
|
375
375
|
.dd-swatches > span { display: block; width: 9px; height: 14px; border: 1px solid #80808050; border-radius: min(2px, var(--radius)); }
|
|
376
|
-
|
|
376
|
+
/* The reader's Mono wins over a host look's data face (tokens.css). */
|
|
377
|
+
body.type-mono { --mono: var(--code); --data-face: var(--code); }
|
|
377
378
|
/* Code surfaces keep the code face; a textarea of prose (a description, a reason) keeps the interface's. */
|
|
378
379
|
:root[data-visual-theme] .app-mode :is(.ddl, .explain, #query, .applist-filter, pre, .sql-input, .composer-text, .agent-json) { font-family: var(--code); }
|
|
379
380
|
/* A list's search box, in the kit with every other field (moved from ListFilterBar.css, which stands in the base). */
|
package/dist/client/write.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { booleanChoices, canEditRow } from './rowEditing.js';
|
|
|
2
2
|
export declare function initWriteMode(): void;
|
|
3
3
|
/** Mode changes must not hide pending work or interrupt an acknowledged save. */
|
|
4
4
|
export declare function prepareEditingExit(): Promise<boolean>;
|
|
5
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
5
6
|
export declare function toggleWriteMode(): Promise<void>;
|
|
6
7
|
/** Re-evaluate on connection switch, since the setting is per database. */
|
|
7
8
|
export declare function syncWriteMode(): void;
|
|
@@ -35,6 +36,7 @@ export declare const dirtyDraft: () => {
|
|
|
35
36
|
*/
|
|
36
37
|
export declare function takeTheirs(column: string, value: unknown): void;
|
|
37
38
|
export declare const draftNeedsReview: (table: any, key: any) => boolean;
|
|
39
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
38
40
|
export declare const draftRequiresManualSave: (table: any, key: any) => boolean;
|
|
39
41
|
export declare const draftSchemaChanged: (table: any) => boolean;
|
|
40
42
|
export declare const retainedValues: () => {};
|
|
@@ -81,6 +83,7 @@ export { sameRow };
|
|
|
81
83
|
export declare const applyingStaged: () => boolean;
|
|
82
84
|
/** Deferred intent only: an already dispatched write still settles normally. */
|
|
83
85
|
export declare function cancelRecordAutosave(): void;
|
|
86
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
84
87
|
export declare function recordAutosavePending(): boolean;
|
|
85
88
|
/** Capture only for a fresh user edit leaving its complete interaction surface.
|
|
86
89
|
* This predicate does not schedule or send anything. The interaction owner must
|
package/dist/client/write.js
CHANGED
|
@@ -89,6 +89,7 @@ export async function prepareEditingExit() {
|
|
|
89
89
|
discardStaged();
|
|
90
90
|
return true;
|
|
91
91
|
}
|
|
92
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
92
93
|
export async function toggleWriteMode() {
|
|
93
94
|
if (state.canWrite) {
|
|
94
95
|
if (await prepareEditingExit())
|
|
@@ -194,6 +195,7 @@ export function takeTheirs(column, value) {
|
|
|
194
195
|
tell();
|
|
195
196
|
}
|
|
196
197
|
export const draftNeedsReview = (table, key) => sameRow(table, key) && staged.needsReview;
|
|
198
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
197
199
|
export const draftRequiresManualSave = (table, key) => sameRow(table, key) && staged.manualSaveRequired;
|
|
198
200
|
export const draftSchemaChanged = (table) => staged.schemaKey !== draftSchemaKey(table);
|
|
199
201
|
export const retainedValues = () => ({ ...staged.values });
|
|
@@ -525,6 +527,7 @@ let autosaveOwner;
|
|
|
525
527
|
export function cancelRecordAutosave() {
|
|
526
528
|
autosaveCancellation++;
|
|
527
529
|
}
|
|
530
|
+
/** @public the database browser's (scripts/boundary/entries.json, "host") */
|
|
528
531
|
export function recordAutosavePending() {
|
|
529
532
|
// Ordinary uncertainty keeps the record locked, not every route. Tenant
|
|
530
533
|
// uncertainty still has its independent stronger navigation gate in core.
|
package/dist/clientFiles.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where the page every server sends comes from. The page is the kit's: its index.html, its entry (boot.js) and the
|
|
3
3
|
* shell, which start the main of the product that built it (shellStart.js, `virtual:mistri/shell-main`). Each product
|
|
4
|
-
* builds it into its own dist/client with the kit's Vite preset (`@mistriwork/kit/vite`) — the
|
|
5
|
-
* config/vite.
|
|
4
|
+
* builds it into its own dist/client with the kit's Vite preset (`@mistriwork/kit/vite`) — the App framework's with
|
|
5
|
+
* config/vite.mistri.config.ts, the database browser's with its own in its own repository — and names that build with
|
|
6
6
|
* `clientFiles`; the engine serves whichever files it is handed (clientHttp.ts, devclient.ts).
|
|
7
7
|
*
|
|
8
8
|
* From source — under tsx — Vite serves the kit's client folder with the vite.config.ts of the product's workspace,
|
package/dist/vite.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* `@mistriwork/kit/vite`: how a product bundles the kit's page, and how it serves it from source.
|
|
3
3
|
*
|
|
4
4
|
* The page is the kit's — its index.html, its entry (boot.js), the shell — and each product builds it into its own
|
|
5
|
-
* dist/client with its own main: the
|
|
6
|
-
*
|
|
5
|
+
* dist/client with its own main: the App framework's (config/vite.mistri.config.ts) and the database browser's (in
|
|
6
|
+
* its own repository, over the published kit). This is the part they share, so a product checked out on its own,
|
|
7
7
|
* over the published kit, builds the same page the same way:
|
|
8
8
|
*
|
|
9
9
|
* - the page's entry starts `virtual:mistri/shell-main`, which `shellMain` answers with the product's main: the kit
|
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.14",
|
|
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": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"./client/components/Dropdown.js": "./dist/client/components/Dropdown.js",
|
|
27
27
|
"./client/components/FieldArranger.js": "./dist/client/components/FieldArranger.js",
|
|
28
28
|
"./client/components/Grid.js": "./dist/client/components/Grid.js",
|
|
29
|
+
"./client/components/NewRecord.js": "./dist/client/components/NewRecord.js",
|
|
29
30
|
"./client/components/Page.js": "./dist/client/components/Page.js",
|
|
30
31
|
"./client/components/Prompt.js": "./dist/client/components/Prompt.js",
|
|
31
32
|
"./client/components/mount.js": "./dist/client/components/mount.js",
|
|
@@ -38,10 +39,19 @@
|
|
|
38
39
|
"./client/copy/shell/startup.js": "./dist/client/copy/shell/startup.js",
|
|
39
40
|
"./client/core.js": "./dist/client/core.js",
|
|
40
41
|
"./client/deeplink.js": "./dist/client/deeplink.js",
|
|
42
|
+
"./client/delete.js": "./dist/client/delete.js",
|
|
41
43
|
"./client/density.js": "./dist/client/density.js",
|
|
42
44
|
"./client/draftRecovery.js": "./dist/client/draftRecovery.js",
|
|
45
|
+
"./client/fonts/barlow-400.woff2": "./dist/client/fonts/barlow-400.woff2",
|
|
46
|
+
"./client/fonts/barlow-600.woff2": "./dist/client/fonts/barlow-600.woff2",
|
|
47
|
+
"./client/fonts/barlow-semi-condensed-700.woff2": "./dist/client/fonts/barlow-semi-condensed-700.woff2",
|
|
48
|
+
"./client/fonts/faces.css": "./dist/client/fonts/faces.css",
|
|
49
|
+
"./client/fonts/ibm-plex-mono-400.woff2": "./dist/client/fonts/ibm-plex-mono-400.woff2",
|
|
50
|
+
"./client/fonts/ibm-plex-mono-500.woff2": "./dist/client/fonts/ibm-plex-mono-500.woff2",
|
|
51
|
+
"./client/fonts/inter-latin.woff2": "./dist/client/fonts/inter-latin.woff2",
|
|
43
52
|
"./client/help.js": "./dist/client/help.js",
|
|
44
53
|
"./client/historyToken.js": "./dist/client/historyToken.js",
|
|
54
|
+
"./client/insert.js": "./dist/client/insert.js",
|
|
45
55
|
"./client/locale.js": "./dist/client/locale.js",
|
|
46
56
|
"./client/menu.js": "./dist/client/menu.js",
|
|
47
57
|
"./client/messages.js": "./dist/client/messages.js",
|
|
@@ -50,7 +60,9 @@
|
|
|
50
60
|
"./client/peek.js": "./dist/client/peek.js",
|
|
51
61
|
"./client/peekpanel.js": "./dist/client/peekpanel.js",
|
|
52
62
|
"./client/prompt.js": "./dist/client/prompt.js",
|
|
63
|
+
"./client/recordEditValidation.js": "./dist/client/recordEditValidation.js",
|
|
53
64
|
"./client/recordSource.js": "./dist/client/recordSource.js",
|
|
65
|
+
"./client/recordWriteRefresh.js": "./dist/client/recordWriteRefresh.js",
|
|
54
66
|
"./client/requestIdentity.js": "./dist/client/requestIdentity.js",
|
|
55
67
|
"./client/resourceRequests.js": "./dist/client/resourceRequests.js",
|
|
56
68
|
"./client/savedPages.js": "./dist/client/savedPages.js",
|
|
@@ -61,6 +73,7 @@
|
|
|
61
73
|
"./client/startup.js": "./dist/client/startup.js",
|
|
62
74
|
"./client/surfaces.js": "./dist/client/surfaces.js",
|
|
63
75
|
"./client/theme.js": "./dist/client/theme.js",
|
|
76
|
+
"./client/url.js": "./dist/client/url.js",
|
|
64
77
|
"./client/visualTheme.js": "./dist/client/visualTheme.js",
|
|
65
78
|
"./client/write.js": "./dist/client/write.js",
|
|
66
79
|
"./clientFiles.js": "./dist/clientFiles.js",
|
|
@@ -69,8 +82,8 @@
|
|
|
69
82
|
"./package.json": "./package.json"
|
|
70
83
|
},
|
|
71
84
|
"dependencies": {
|
|
72
|
-
"@mistriwork/engine": "1.0.0-rc.
|
|
73
|
-
"@mistriwork/ui": "1.0.0-rc.
|
|
85
|
+
"@mistriwork/engine": "1.0.0-rc.14",
|
|
86
|
+
"@mistriwork/ui": "1.0.0-rc.14",
|
|
74
87
|
"intl-messageformat": "12.1.2",
|
|
75
88
|
"qrcode-generator": "^2.0.4"
|
|
76
89
|
},
|