@mistriwork/kit 1.0.0-rc.59 → 1.0.0-rc.61
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/app.js +2 -1
- package/dist/client/components/AppColumnMenuPopups.js +6 -1
- package/dist/client/components/AppList.js +16 -5
- package/dist/client/components/Content.js +1 -1
- package/dist/client/components/GridSelection.d.ts +0 -6
- package/dist/client/components/GridSelection.js +30 -5
- package/dist/client/components/ListFilterBar.css +4 -2
- package/dist/client/components/ListFilterBar.js +7 -1
- package/dist/client/components/Rooms.js +5 -2
- package/dist/client/components/Sidebar.js +7 -0
- package/dist/client/components/TableView.js +5 -1
- package/dist/client/components/useMediaQuery.d.ts +2 -0
- package/dist/client/components/useMediaQuery.js +2 -0
- package/dist/client/core.d.ts +2 -1
- package/dist/client/core.js +46 -2
- package/dist/client/customThemes.css +2 -1
- package/dist/client/features.css +7 -3
- package/dist/client/navigationHold.d.ts +9 -0
- package/dist/client/navigationHold.js +46 -3
- package/dist/client/page.css +9 -3
- package/dist/client/structure.css +3 -2
- package/dist/client/style.css +4 -2
- package/package.json +3 -3
package/dist/client/app.js
CHANGED
|
@@ -25,7 +25,7 @@ import { viewLink } from './components/viewLink.js';
|
|
|
25
25
|
import { Sidebar, moveSidebar, openSidebarChoice } from './components/Sidebar.js';
|
|
26
26
|
import { setSidebarFilter } from './components/sidebarModel.js';
|
|
27
27
|
import { $, allowMutationExit, api, backTo, connectionChanged, currentEntry, el, findTable, go, invalidateNavigation, pageView, render, setPaintHold, state, toast, } from './core.js';
|
|
28
|
-
import { afterPaint, beforePaint, installNavigationHold } from './navigationHold.js';
|
|
28
|
+
import { afterPaint, beforePaint, installNavigationHold, yieldsFirst } from './navigationHold.js';
|
|
29
29
|
import { setStartupProbe } from './startupHold.js';
|
|
30
30
|
import { initWriteMode, prepareEditingExit } from './write.js';
|
|
31
31
|
import { bootstrapRequestIdentity, initConnections, refreshConnections, syncConnectionControls } from './connectionList.js';
|
|
@@ -715,6 +715,7 @@ export async function boot(me, landingAt, installed) {
|
|
|
715
715
|
setPaintHold({
|
|
716
716
|
before: (roomChanged) => beforePaint(roomChanged, currentEntry(), state.stack.length),
|
|
717
717
|
after: () => afterPaint(currentEntry(), state.stack.length),
|
|
718
|
+
yields: () => yieldsFirst(currentEntry()),
|
|
718
719
|
});
|
|
719
720
|
/* A press on a record begins reading its page, so the hold is short (recordCompose.ts). */
|
|
720
721
|
listenForRecordPresses();
|
|
@@ -118,5 +118,10 @@ export function AppColumnMenuPopups({ host, button, open, setOpen, handBack, nam
|
|
|
118
118
|
}, children: _jsx(MenuContent, { className: "th-menu th-menu-app", "aria-label": sayCopy('labelColumn', { label }), anchor: button.current, side: "bottom", align: "start", sideOffset: 4, collisionPadding: 12, container: layerHost(button.current), finalFocus: () => (handBack.current && button.current?.isConnected ? button.current : null), children: entries.map((entry, i) => (_jsxs(Fragment, { children: [entry.key === 'pin' && i > 0 ? _jsx(MenuSeparator, { className: "th-menu-sep" }) : null, _jsxs(MenuItem, { render: _jsx("button", { type: "button" }), className: `th-menu-item${entry.key === 'pin' ? ' th-menu-quiet' : ''}`, closeOnSelect: false, onSelect: () => choose(entry.key), "aria-label": entry.detail ? `${entry.label}: ${entry.detail}` : undefined, children: [_jsx("span", { className: "th-menu-label", children: entry.label }), entry.detail ? _jsx("span", { className: "th-menu-said", children: entry.detail }) : null] })] }, entry.key))) }) }), _jsx(Popover, { controller: filter, onOpenChange: (next) => {
|
|
119
119
|
if (!next)
|
|
120
120
|
setOpen((was) => (was === 'filter' ? null : was));
|
|
121
|
-
}, children: box && (_jsx(PopoverContent, { ref: popup, className: "filter-pop", "aria-label": sayCopy('filterBy', { label }), anchor: button.current, side: "bottom", align: "start", sideOffset: 6, collisionPadding: 8, container: layerHost(button.current), initialFocus: () => popup.current?.querySelector('input:not([type="hidden"]):not([aria-hidden="true"])') ?? popup.current, finalFocus: () => (button.current?.isConnected ? button.current : null), children: _jsx(h.Picker, { box: box, table: h.table, refinement: h.refinement, standing: h.standing, unit: h.unitOf(name), owned: mentionsColumn(h.tabQuery, name),
|
|
121
|
+
}, children: box && (_jsx(PopoverContent, { ref: popup, className: "filter-pop", "aria-label": sayCopy('filterBy', { label }), anchor: button.current, side: "bottom", align: "start", sideOffset: 6, collisionPadding: 8, container: layerHost(button.current), initialFocus: () => popup.current?.querySelector('input:not([type="hidden"]):not([aria-hidden="true"])') ?? popup.current, finalFocus: () => (button.current?.isConnected ? button.current : null), children: _jsx(h.Picker, { box: box, table: h.table, refinement: h.refinement, standing: h.standing, unit: h.unitOf(name), owned: mentionsColumn(h.tabQuery, name),
|
|
122
|
+
/* Closed as it applies, as a sort from the menu is: a refinement keeps the room, and the header with it. */
|
|
123
|
+
apply: (text) => {
|
|
124
|
+
setOpen(null);
|
|
125
|
+
h.apply(text, name);
|
|
126
|
+
}, close: () => setOpen(null) }) })) })] }));
|
|
122
127
|
}
|
|
@@ -253,6 +253,13 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
253
253
|
.map((box) => (box.kind === 'text' && spec.suggest?.[box.column] ? { ...box, suggest: spec.suggest[box.column] } : box))
|
|
254
254
|
: [], [table, names.join(','), spec, definedBoxes]);
|
|
255
255
|
const [edits, setEdits] = useState({});
|
|
256
|
+
/* A new question keeps the room (Rooms.tsx), so what was typed toward the last one is let go here, as a room
|
|
257
|
+
started over let it go: a chip's × must not leave its words standing in the box. */
|
|
258
|
+
const [editsAsked, setEditsAsked] = useState(entry.query);
|
|
259
|
+
if (editsAsked !== entry.query) {
|
|
260
|
+
setEditsAsked(entry.query);
|
|
261
|
+
setEdits({});
|
|
262
|
+
}
|
|
256
263
|
const editsNow = useRef(edits);
|
|
257
264
|
editsNow.current = edits;
|
|
258
265
|
const touched = (column) => column in editsNow.current;
|
|
@@ -434,7 +441,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
434
441
|
return;
|
|
435
442
|
writeViews.mutate((views) => renamedView(views, view.name, String(name)));
|
|
436
443
|
};
|
|
437
|
-
/* The paint that
|
|
444
|
+
/* The paint that answered the control this person was using: put focus back
|
|
438
445
|
on the twin of the control they used — in a rail, the very value. */
|
|
439
446
|
useEffect(() => {
|
|
440
447
|
if (!refocus)
|
|
@@ -460,7 +467,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
460
467
|
}
|
|
461
468
|
}
|
|
462
469
|
refocus = null;
|
|
463
|
-
}, []);
|
|
470
|
+
}, [entry.query]);
|
|
464
471
|
/* The grid: rows only — an entry can carry a workbench tab (diagram,
|
|
465
472
|
definition) across the mode flip, and the diagram under the app's
|
|
466
473
|
filter boxes was a surface those controls cannot filter. The keys the
|
|
@@ -769,11 +776,15 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
769
776
|
e.preventDefault();
|
|
770
777
|
form.current?.requestSubmit();
|
|
771
778
|
}
|
|
772
|
-
} }) })] })), inCrumbs && _jsx(PresentationHost, { list: viewKey })] }), beside && railProps ? (_jsxs("div", { className: "applist-body has-rail", children: [_jsx("aside", { className: "filter-rail", ref: rail, "aria-label": say('captionFilters', { caption }), children: _jsx(FilterRail, { ...railProps, clearAll: false, onChange: apply, status: matched }) }), _jsxs("div", { className: "applist-results", children: [_jsxs("div", { className: "applist-results-head", children: [_jsxs("div", { className: "applist-chips", role: "group", "aria-label": say('filtersApplied', { caption }), children: [chipList, narrowed > 0 && (_jsx("button", { type: "button", className: "applist-chips-clear", onClick: () => apply(clearFacets(refinement, boxes.map((box) => box.column), tabQuery)), children: say('list.clearAll') }))] }), spec.sorts?.length ? (_jsx(SortMenu, { sorts: spec.sorts, sort: spec.sort, query: entry.query, onPick: (query) => {
|
|
779
|
+
} }, refinement) })] })), inCrumbs && _jsx(PresentationHost, { list: viewKey })] }), beside && railProps ? (_jsxs("div", { className: "applist-body has-rail", children: [_jsx("aside", { className: "filter-rail", ref: rail, "aria-label": say('captionFilters', { caption }), children: _jsx(FilterRail, { ...railProps, clearAll: false, onChange: apply, status: matched }) }), _jsxs("div", { className: "applist-results", children: [_jsxs("div", { className: "applist-results-head", children: [_jsxs("div", { className: "applist-chips", role: "group", "aria-label": say('filtersApplied', { caption }), children: [chipList, narrowed > 0 && (_jsx("button", { type: "button", className: "applist-chips-clear", onClick: () => apply(clearFacets(refinement, boxes.map((box) => box.column), tabQuery)), children: say('list.clearAll') }))] }), spec.sorts?.length ? (_jsx(SortMenu, { sorts: spec.sorts, sort: spec.sort, query: entry.query, onPick: (query) => {
|
|
773
780
|
walk.page = 0;
|
|
774
781
|
navigate(query);
|
|
775
|
-
} })) : null] }), _jsx(AppColumnMenuContext.Provider, { value: menuHost, children: grid })] })] })) : (_jsx(AppColumnMenuContext.Provider, { value: menuHost, children: grid })), sheet && railProps && (_jsx(FilterSheet, { ...railProps, boxes: railed ? boxes : boxes.filter((box) => box !== searchBox), onClose: () => setSheet(false),
|
|
782
|
+
} })) : null] }), _jsx(AppColumnMenuContext.Provider, { value: menuHost, children: grid })] })] })) : (_jsx(AppColumnMenuContext.Provider, { value: menuHost, children: grid })), sheet && railProps && (_jsx(FilterSheet, { ...railProps, boxes: railed ? boxes : boxes.filter((box) => box !== searchBox), onClose: () => setSheet(false),
|
|
783
|
+
/* The sheet goes in the click's own frame and the list is asked after it is painted: the rows stand
|
|
784
|
+
as they were until the new answer arrives either way, and asked inside the click, the sheet stood
|
|
785
|
+
over the list while the whole list redrew under it (a phone's filter, test/built-client-vitals.mjs). */
|
|
786
|
+
onApply: (text) => {
|
|
776
787
|
setSheet(false);
|
|
777
|
-
apply(text);
|
|
788
|
+
requestAnimationFrame(() => setTimeout(() => apply(text), 0));
|
|
778
789
|
} }))] }));
|
|
779
790
|
}
|
|
@@ -122,7 +122,7 @@ function ContentBody({ onHome }) {
|
|
|
122
122
|
const loadError = shell().inApp() ? shell().loadError() : '';
|
|
123
123
|
/* Spelled apart, so a room in one mode is never taken for the same room
|
|
124
124
|
in the other when the mode changes under the same key. An App's list
|
|
125
|
-
keeps its room through a refinement too (a header's sort, a page): it
|
|
125
|
+
keeps its room through a refinement too (a tab, a filter, a search, a header's sort, a page): it
|
|
126
126
|
was keyed by the paint, so a sort threw the whole grid away and built
|
|
127
127
|
it again inside the click, the slowest interaction measured on a list
|
|
128
128
|
(test/built-client-vitals.mjs). */
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The queue's selection on a grid: a checkbox in each row's leading cell —
|
|
3
|
-
* the row host, so the grid is not told about it — one in the header row's
|
|
4
|
-
* for every row at once, and the same bulk bar, the same keys and the same
|
|
5
|
-
* per-record writes as a queue over the resource.
|
|
6
|
-
*/
|
|
7
1
|
import type { TableMeta } from '@mistriwork/engine/shared/schema.js';
|
|
8
2
|
import type { AppAction } from '@mistriwork/engine/schema/model.js';
|
|
9
3
|
import { type GridGroup } from './Grid.js';
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The queue's selection on a grid: a checkbox in each row's leading cell —
|
|
4
|
+
* the row host, so the grid is not told about it — one in the header row's
|
|
5
|
+
* for every row at once, and the same bulk bar, the same keys and the same
|
|
6
|
+
* per-record writes as a queue over the resource.
|
|
7
|
+
*/
|
|
8
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
2
9
|
import { keyOf, rowLabel } from '../core.js';
|
|
3
10
|
import { shell } from '../shellMode.js';
|
|
4
11
|
import { bulkKey } from '../bulkActions.js';
|
|
@@ -37,9 +44,27 @@ export function GridSelection({ table, rows, actions, interactive, editable = []
|
|
|
37
44
|
const ids = members.map((record) => record.id);
|
|
38
45
|
const all = ids.every((id) => chosen.has(id));
|
|
39
46
|
const some = !all && ids.some((id) => chosen.has(id));
|
|
40
|
-
return (_jsx(RowDecoration, { rowKey: host, children: _jsx(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
return (_jsx(RowDecoration, { rowKey: host, children: _jsx(RowBox, { "aria-label": say('selectGroup', { group: group.head(members[0].row[group.column]).label }), checked: all, indeterminate: some, onClick: (event) => event.stopPropagation(), onChange: () => change(all ? selection.filter((id) => !ids.includes(id)) : [...selection, ...ids.filter((id) => !chosen.has(id))]) }) }, host));
|
|
48
|
+
}), keyed.map((record) => (_jsx(RowDecoration, { rowKey: record.id, children: _jsx(RowBox, { "aria-label": say('select', { label: record.label }), checked: chosen.has(record.id), onClick: (event) => event.stopPropagation(), onChange: (event) => change(event.target.checked ? [...selection, record.id] : selection.filter((id) => id !== record.id)) }) }, record.id))), dialogs] }));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A row's box, which marks its row as chosen while it is ticked (features.css tints a marked row). The row
|
|
52
|
+
* says so itself because a rule reading the box from the row with :has() held every cell of the grid to any
|
|
53
|
+
* change inside it: a header's sort restyled them all in its click.
|
|
54
|
+
*/
|
|
55
|
+
function RowBox({ checked, indeterminate = false, ...props }) {
|
|
56
|
+
const box = useRef(null);
|
|
57
|
+
/* Mixed is a property, not an attribute: set on every paint, as the header's box sets it, since a click clears it. */
|
|
58
|
+
useLayoutEffect(() => {
|
|
59
|
+
if (box.current)
|
|
60
|
+
box.current.indeterminate = indeterminate;
|
|
61
|
+
});
|
|
62
|
+
useLayoutEffect(() => {
|
|
63
|
+
const row = box.current?.closest('tr');
|
|
64
|
+
if (!row || !checked)
|
|
65
|
+
return undefined;
|
|
66
|
+
row.setAttribute('data-chosen', '');
|
|
67
|
+
return () => row.removeAttribute('data-chosen');
|
|
68
|
+
}, [checked]);
|
|
69
|
+
return _jsx("input", { ref: box, type: "checkbox", className: "row-select", checked: checked, ...props });
|
|
45
70
|
}
|
|
@@ -89,8 +89,10 @@
|
|
|
89
89
|
@media (prefers-reduced-motion: no-preference) {
|
|
90
90
|
/* A fade and nothing else: a transform on the popup would make it the
|
|
91
91
|
containing block of the reference typeahead's fixed list, which would
|
|
92
|
-
land away from its box until the transform ended.
|
|
93
|
-
|
|
92
|
+
land away from its box until the transform ended. In, never out: a popup leaves at once (parts.css), and a
|
|
93
|
+
fade on the way out outlived a dialog opened from the list just after a filter was applied, which kept the
|
|
94
|
+
closed picker on the page. */
|
|
95
|
+
.filter-pop:not([data-ending-style]) { transition: opacity var(--t-popover) var(--ease-out); @starting-style { opacity: 0; } }
|
|
94
96
|
}
|
|
95
97
|
.filter-pop .facet { border-top: 0; padding: var(--space-4) var(--space-4h) var(--space-3h); }
|
|
96
98
|
.filter-pop .facet-clear { top: 12px; right: 14px; }
|
|
@@ -236,7 +236,13 @@ function Picker({ className, label, onKeyDown, owned, children, ...props }) {
|
|
|
236
236
|
/* Out of the bar, by name: the picker is a form and the bar is one, and UI SDK draws a popover where its
|
|
237
237
|
trigger is unless it is told where. A form in a form is not HTML, and its Show sent the page instead of
|
|
238
238
|
the filter. */
|
|
239
|
-
container: container ?? popupContainer() ?? portalRoot(), initialFocus: () => popup.current?.querySelector('input:not([type="hidden"]):not([aria-hidden="true"])'), children: _jsx(FilterPicker, { box: box, table: props.table, refinement: refinement, standing: props.standing, unit: props.unitOf(box.column), owned: owned,
|
|
239
|
+
container: container ?? popupContainer() ?? portalRoot(), initialFocus: () => popup.current?.querySelector('input:not([type="hidden"]):not([aria-hidden="true"])'), children: _jsx(FilterPicker, { box: box, table: props.table, refinement: refinement, standing: props.standing, unit: props.unitOf(box.column), owned: owned,
|
|
240
|
+
/* Closed as it applies, as a choice is: a refinement keeps the room (Rooms.tsx), so React would carry
|
|
241
|
+
an open popover from the "+" over to the chip that replaces it, drawn over the grid. */
|
|
242
|
+
apply: (text, focus) => {
|
|
243
|
+
setOpen(false);
|
|
244
|
+
props.apply(text, focus);
|
|
245
|
+
}, close: () => setOpen(false) }) })] }));
|
|
240
246
|
}
|
|
241
247
|
/** One column's picker: a reference's typeahead, or the rail's facet over a draft. */
|
|
242
248
|
export function FilterPicker(props) {
|
|
@@ -8,7 +8,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
8
8
|
*/
|
|
9
9
|
import { DashHead } from './DashHead.js';
|
|
10
10
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
-
import { allowMutationExit, api, beginNavigation, captureNavigation, currentEntry, findTable, go, humanName, keyOf, pageFor, pageView, primaryKey, refsTo, renderCrumbs, state, tableView, } from '../core.js';
|
|
11
|
+
import { allowMutationExit, api, beginNavigation, captureNavigation, currentEntry, findTable, go, humanName, keyOf, pageFor, pageView, primaryKey, refine, refsTo, renderCrumbs, state, tableView, } from '../core.js';
|
|
12
12
|
import { equalityFilter } from '../resourceRequests.js';
|
|
13
13
|
import { openNewRecord } from '../insert.js';
|
|
14
14
|
import { squeeze } from '../filterbar.js';
|
|
@@ -31,7 +31,10 @@ export function AppListRoom({ entry, spec: given, navigate }) {
|
|
|
31
31
|
query suggest: a split beside a plain list asks the same question of
|
|
32
32
|
the same rows. A key naming no view falls back to the suggestion. */
|
|
33
33
|
const spec = entry.view && given.id !== entry.view ? appListFor(entry.table, entry.query, entry.view) : given;
|
|
34
|
-
|
|
34
|
+
/* A tab, a filter, a search: a refinement of the list on screen, so the room is kept and its Query re-asks in place,
|
|
35
|
+
as a header's sort is. Painted as a new room, each threw the whole list away inside the click and held a deep copy
|
|
36
|
+
of it over the pane while the next was built — most of a tab switch's time (test/built-client-vitals.mjs). */
|
|
37
|
+
const to = navigate ?? ((query) => refine(() => go({ ...tableView(entry.table, query), view: entry.view }, 'replace')));
|
|
35
38
|
/* A bare table reached by link — `/crm/task` — is the list on its first
|
|
36
39
|
tab, the way the sidebar opens it. Rendered as it arrived it was every
|
|
37
40
|
column of the table under raw headers with no tab lit: the workbench's
|
|
@@ -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
|
+
/* Whether any room draws a mark, said on the list (structure.css, a markless room keeping the mark's place). Read
|
|
158
|
+
off the list with `#table-list:has(.nav-icon)`, the rule sat above the whole page: any change in the content
|
|
159
|
+
pane re-matched it against every button there, and a header's sort spent its click restyling them
|
|
160
|
+
(test/built-client-vitals.mjs). Read after every draw, since the marks are whatever the rows drew. */
|
|
161
|
+
useLayoutEffect(() => {
|
|
162
|
+
host.toggleAttribute('data-marks', host.querySelector('.nav-icon') !== null);
|
|
163
|
+
});
|
|
157
164
|
/* The current row is brought clear of the foot's fade (features.css `scroll-padding-bottom`): a page you are on that
|
|
158
165
|
sits under the fade reads as greyed out, as if disabled. */
|
|
159
166
|
useLayoutEffect(() => {
|
|
@@ -30,6 +30,7 @@ import { BesideDetail } from './besideDetail.js';
|
|
|
30
30
|
import { editableCells } from './gridCellModel.js';
|
|
31
31
|
import { canEditRow } from '../rowEditing.js';
|
|
32
32
|
import { RecordSummaries, tableSaysMore } from './RecordSummaries.js';
|
|
33
|
+
import { RECORDS_QUERY, useMediaQuery } from './useMediaQuery.js';
|
|
33
34
|
import { canUseDatabaseTools } from '../connectionScope.js';
|
|
34
35
|
import { shell } from '../shellMode.js';
|
|
35
36
|
import { onDemand, useArrived } from './onDemand.js';
|
|
@@ -207,6 +208,9 @@ export function TableView({ entry, data, chrome, interactive, hide, labels, refe
|
|
|
207
208
|
/* Records or table: how a narrow screen shows the rows, the reader's pick. The page's own list draws the switch at
|
|
208
209
|
the end of its control strip (AppList), beside the tabs; anywhere else, over the rows. */
|
|
209
210
|
const [layout, setLayout] = useState('records');
|
|
211
|
+
/* The records are drawn only where they can be seen. Wider, the stylesheet hides them, and a desk drew every row
|
|
212
|
+
twice for it — once as a summary nobody saw — in every sort, filter and tab (test/built-client-vitals.mjs). */
|
|
213
|
+
const narrow = useMediaQuery(RECORDS_QUERY);
|
|
210
214
|
const { controls } = useCrumbSlots();
|
|
211
215
|
const presentationSwitch = (element) => (inCrumbs && controls ? createPortal(element, controls) : element);
|
|
212
216
|
const table = findTable(data.table);
|
|
@@ -320,5 +324,5 @@ export function TableView({ entry, data, chrome, interactive, hide, labels, refe
|
|
|
320
324
|
const tableGrid = rowActions && (interactive || embedded) && table && actions?.some((action) => action.header !== false) && primaryKey(table).length ? (_jsxs(RowTrailHosts, { children: [_jsx(RowActions, { table: table, rows: data.rows, actions: actions, onDone: () => render() }), selected] })) : (selected);
|
|
321
325
|
return (_jsxs(_Fragment, { children: [_jsx(ResultHead, { entry: entry, data: data, chrome: chrome, interactive: interactive, exportOn: exportOn, at: at, headRef: head, inCrumbs: inCrumbs }), _jsxs("div", { className: hasSummaries ? `responsive-results show-${embedded || !choice ? 'records' : layout}` : undefined, children: [hasSummaries && (_jsxs(_Fragment, { children: [!embedded &&
|
|
322
326
|
choice &&
|
|
323
|
-
presentationSwitch(_jsx(PresentationSwitch, { layout: layout, onChange: setLayout, label: say('common.listPresentation'), records: say('common.records'), table: say('common.table') })), _jsx(RecordSummaries, { table: table, data: data, columns: (data.columns ?? []).filter((name) => !hide?.includes(name)), labels: labels, referenceLabels: referenceLabels, list: list, query: entry.query, ...(group ? { group } : {}), ...(adornCell ? { adornFact: (row, column) => adornCell(row, column, 'summary') } : {}) })] })), _jsx("div", { className: "result-table", "aria-busy": busy || undefined, children: tableGrid })] }), _jsx(Pager, { entry: entry, data: data, at: at, range: inCrumbs })] }));
|
|
327
|
+
presentationSwitch(_jsx(PresentationSwitch, { layout: layout, onChange: setLayout, label: say('common.listPresentation'), records: say('common.records'), table: say('common.table') })), narrow && (_jsx(RecordSummaries, { table: table, data: data, columns: (data.columns ?? []).filter((name) => !hide?.includes(name)), labels: labels, referenceLabels: referenceLabels, list: list, query: entry.query, ...(group ? { group } : {}), ...(adornCell ? { adornFact: (row, column) => adornCell(row, column, 'summary') } : {}) }))] })), _jsx("div", { className: "result-table", "aria-busy": busy || undefined, children: tableGrid })] }), _jsx(Pager, { entry: entry, data: data, at: at, range: inCrumbs })] }));
|
|
324
328
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare function useMediaQuery(query: string): boolean;
|
|
2
2
|
/** A phone: where a record's actions fold into one menu rather than wrap. */
|
|
3
3
|
export declare const PHONE_QUERY = "(max-width: 600px)";
|
|
4
|
+
/** Where a list's records stand in for its grid: style.css's `@media (max-width: 760px)`, which shows them. */
|
|
5
|
+
export declare const RECORDS_QUERY = "(max-width: 760px)";
|
|
4
6
|
/** Where a filter rail has no room to stand beside the rows. The rail is
|
|
5
7
|
12-15rem and a card grid wants 520px before it draws a second column, so
|
|
6
8
|
under about 860px the two together leave the rows a single narrow column —
|
|
@@ -36,6 +36,8 @@ export function useMediaQuery(query) {
|
|
|
36
36
|
}
|
|
37
37
|
/** A phone: where a record's actions fold into one menu rather than wrap. */
|
|
38
38
|
export const PHONE_QUERY = '(max-width: 600px)';
|
|
39
|
+
/** Where a list's records stand in for its grid: style.css's `@media (max-width: 760px)`, which shows them. */
|
|
40
|
+
export const RECORDS_QUERY = '(max-width: 760px)';
|
|
39
41
|
/** Where a filter rail has no room to stand beside the rows. The rail is
|
|
40
42
|
12-15rem and a card grid wants 520px before it draws a second column, so
|
|
41
43
|
under about 860px the two together leave the rows a single narrow column —
|
package/dist/client/core.d.ts
CHANGED
|
@@ -161,10 +161,11 @@ export declare const roomVersion: () => number;
|
|
|
161
161
|
* any paint; the room is kept when it is still the same table room.
|
|
162
162
|
*/
|
|
163
163
|
export declare function refine(fn: any): any;
|
|
164
|
-
/** @param {{ before(roomChanged: boolean): void; after(): void } | null} hold */
|
|
164
|
+
/** @param {{ before(roomChanged: boolean): void; after(): void; yields?(): boolean } | null} hold */
|
|
165
165
|
export declare function setPaintHold(hold: {
|
|
166
166
|
before(roomChanged: boolean): void;
|
|
167
167
|
after(): void;
|
|
168
|
+
yields?(): boolean;
|
|
168
169
|
} | null): void;
|
|
169
170
|
export declare function render(): void;
|
|
170
171
|
export declare function subscribeWalk(fn: any): () => boolean;
|
package/dist/client/core.js
CHANGED
|
@@ -571,23 +571,67 @@ export function refine(fn) {
|
|
|
571
571
|
being left until the new room is complete. A seam, so core stays free of
|
|
572
572
|
the DOM it holds; nothing registered, a paint is only a paint. */
|
|
573
573
|
let paintHold = null;
|
|
574
|
-
/** @param {{ before(roomChanged: boolean): void; after(): void } | null} hold */
|
|
574
|
+
/** @param {{ before(roomChanged: boolean): void; after(): void; yields?(): boolean } | null} hold */
|
|
575
575
|
export function setPaintHold(hold) {
|
|
576
576
|
paintHold = hold;
|
|
577
577
|
}
|
|
578
|
+
/* A room started over by a press is drawn after the frame the press is in,
|
|
579
|
+
when the hold says the screen being left would only stand as a picture
|
|
580
|
+
until the room is complete anyway: drawn inside the click, the picture and
|
|
581
|
+
the room's first render held the press's own frame back past the
|
|
582
|
+
interaction budget (a cards list's open, test/built-client-vitals.mjs).
|
|
583
|
+
What is on show is the same either way. A paint asked for while one waits
|
|
584
|
+
is the same navigation going on (a redirect, a label): it is drawn at
|
|
585
|
+
once, as a room started over. */
|
|
586
|
+
let waiting = null;
|
|
578
587
|
export function render() {
|
|
579
588
|
if (sessionIdentity().mode === 'locked')
|
|
580
589
|
return;
|
|
581
590
|
paintTick += 1;
|
|
582
591
|
const shape = tableRoomShape();
|
|
583
|
-
|
|
592
|
+
let roomChanged = !refining || shape === null || shape !== roomOnScreen;
|
|
584
593
|
if (roomChanged)
|
|
585
594
|
roomTick += 1;
|
|
586
595
|
roomOnScreen = shape;
|
|
596
|
+
if (waiting) {
|
|
597
|
+
waiting();
|
|
598
|
+
waiting = null;
|
|
599
|
+
roomChanged = true;
|
|
600
|
+
}
|
|
601
|
+
else if (roomChanged && paintHold?.yields?.()) {
|
|
602
|
+
waiting = afterThisFrame(() => {
|
|
603
|
+
waiting = null;
|
|
604
|
+
if (sessionIdentity().mode !== 'locked')
|
|
605
|
+
paint(true);
|
|
606
|
+
});
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
paint(roomChanged);
|
|
610
|
+
}
|
|
611
|
+
function paint(roomChanged) {
|
|
587
612
|
paintHold?.before(roomChanged);
|
|
588
613
|
flushSync(tellWalk);
|
|
589
614
|
paintHold?.after();
|
|
590
615
|
}
|
|
616
|
+
/* Runs `fn` once the frame being made now is painted; returns the way to
|
|
617
|
+
call it off. The timer stands in where frames stop (a hidden tab). */
|
|
618
|
+
function afterThisFrame(fn) {
|
|
619
|
+
let done = false;
|
|
620
|
+
const run = () => {
|
|
621
|
+
if (done)
|
|
622
|
+
return;
|
|
623
|
+
done = true;
|
|
624
|
+
clearTimeout(fallback);
|
|
625
|
+
fn();
|
|
626
|
+
};
|
|
627
|
+
const frame = requestAnimationFrame(() => setTimeout(run, 0));
|
|
628
|
+
const fallback = setTimeout(run, 100);
|
|
629
|
+
return () => {
|
|
630
|
+
done = true;
|
|
631
|
+
cancelAnimationFrame(frame);
|
|
632
|
+
clearTimeout(fallback);
|
|
633
|
+
};
|
|
634
|
+
}
|
|
591
635
|
/* The walk as something a component can watch. Every render and every
|
|
592
636
|
crumb correction is one tick; a component that subscribes re-reads the
|
|
593
637
|
stack. Kept as a counter rather than a copy of the stack, because the
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
/* Round controls (`shape.radius.control: 'round'`) are pills; a check box, a radio and a slider keep their own
|
|
6
6
|
shape, and a form's field keeps the field's corner (the rule below outranks this one). A look that corners its
|
|
7
7
|
own controls (the dashboard's window and filters, a list's search and toggles) reads --control-radius there, unset
|
|
8
|
-
in every built-in look
|
|
8
|
+
in every built-in look. An App's own <button> card is dressed in the `app` layer, which stands after this one, so
|
|
9
|
+
its rule keeps the corner it says (--radius-card is the look's card corner to read). */
|
|
9
10
|
:root[data-control-radius] :is(button, input:not([role=switch], [type=checkbox], [type=radio], [type=range]), select, .tn-search,[data-slot='select-trigger']) { border-radius: var(--control-radius); }
|
|
10
11
|
:root[data-custom-theme] :is(.applist-title, .root-current, .page-section-title) { font-family: var(--heading-font, var(--sans)); }
|
|
11
12
|
:root[data-custom-theme] .page-field-edit :is(.cell-edit, .record-picker-trigger),
|
package/dist/client/features.css
CHANGED
|
@@ -1709,7 +1709,8 @@ div.form-problems {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
div.form-problems > p { margin: 0; font-weight: 600; color: var(--ink); }
|
|
1711
1711
|
div.form-problems > ul { margin: 0; padding-inline-start: var(--space-5); }
|
|
1712
|
-
|
|
1712
|
+
/* Not `li + li`: a tag on the right of `+` is checked against every list item added anywhere (page.css, .timeline-rows). */
|
|
1713
|
+
div.form-problems li:not(:first-child) { margin-top: var(--space-1); }
|
|
1713
1714
|
div.form-problems button {
|
|
1714
1715
|
min-height: 0; height: auto; padding: 0; border: 0; border-radius: var(--radius-sm, 2px); background: none;
|
|
1715
1716
|
color: var(--status-critical); font: inherit; font-weight: 600;
|
|
@@ -1931,8 +1932,11 @@ body.session-locked > :not(#session-lock) { display: none !important; }
|
|
|
1931
1932
|
.grid-select-bar .queue-count { margin-inline-end: var(--space-3); font-weight: 600; color: var(--ink); white-space: nowrap; }
|
|
1932
1933
|
/* A line under the row's name keeps the body's weight (the name's is themeFamilies.css's). */
|
|
1933
1934
|
.app-mode tbody tr > td:is(:first-child:not(.row-host), .row-host + td) .cell-sub { font-weight: 400; }
|
|
1934
|
-
/* A chosen row is on the accent's tint: the tick alone was a mark fifteen pixels wide in a row a thousand long.
|
|
1935
|
-
|
|
1935
|
+
/* A chosen row is on the accent's tint: the tick alone was a mark fifteen pixels wide in a row a thousand long.
|
|
1936
|
+
The row carries its tick (GridSelection.tsx): read off the box with :has(), the rule put every cell of the grid
|
|
1937
|
+
under any change inside it, and a header's sort restyled all of them in its click (test/built-client-vitals.mjs).
|
|
1938
|
+
The attribute is named twice to keep the weight the :has() rule had over a hovered row's tint. */
|
|
1939
|
+
.table-wrap tbody tr[data-chosen][data-chosen] > td { background: var(--accent-soft); }
|
|
1936
1940
|
.row-host .row-select { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
|
|
1937
1941
|
/* Select all sat against the first column's sort button, a finger's 24px
|
|
1938
1942
|
round it 0.4px short of clear (WCAG 2.5.8, which a 15px box meets by its
|
|
@@ -22,6 +22,15 @@ interface HoldProbe {
|
|
|
22
22
|
* the reader's first input.
|
|
23
23
|
*/
|
|
24
24
|
export declare function installNavigationHold(host: HTMLElement, reads?: HoldProbe): void;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a paint that starts the room over can wait for the frame the press
|
|
27
|
+
* that asked for it is in (core.js `render`): a step to another place taken
|
|
28
|
+
* with the pointer, where the hold would stand a picture of the screen on show
|
|
29
|
+
* over a room hidden outright. Not a control's own press (a checkbox, a
|
|
30
|
+
* field): React puts a controlled control back as its event ends, unless what
|
|
31
|
+
* it changed is drawn inside the event.
|
|
32
|
+
*/
|
|
33
|
+
export declare function yieldsFirst(entry: Place | undefined): boolean;
|
|
25
34
|
/**
|
|
26
35
|
* Before a paint: hold the screen on show when the paint starts the room over.
|
|
27
36
|
* `room` is whether the room is new; `entry` and `depth` are the walk's top
|
|
@@ -144,6 +144,26 @@ export function installNavigationHold(host, reads) {
|
|
|
144
144
|
addHostListener(window, 'wheel', moved, { capture: true, passive: true });
|
|
145
145
|
addHostListener(window, 'touchmove', moved, { capture: true, passive: true });
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Whether a paint that starts the room over can wait for the frame the press
|
|
149
|
+
* that asked for it is in (core.js `render`): a step to another place taken
|
|
150
|
+
* with the pointer, where the hold would stand a picture of the screen on show
|
|
151
|
+
* over a room hidden outright. Not a control's own press (a checkbox, a
|
|
152
|
+
* field): React puts a controlled control back as its event ends, unless what
|
|
153
|
+
* it changed is drawn inside the event.
|
|
154
|
+
*/
|
|
155
|
+
export function yieldsFirst(entry) {
|
|
156
|
+
const pane = content;
|
|
157
|
+
if (!pane?.isConnected || !shown || hold || !pane.firstElementChild)
|
|
158
|
+
return false;
|
|
159
|
+
const now = performance.now();
|
|
160
|
+
if (now - traversedAt < TRAVERSAL_WINDOW || !lastInput.pointer || now - lastInput.at > 1000)
|
|
161
|
+
return false;
|
|
162
|
+
if (entry === shown.entry || placeOf(entry) === shown.place)
|
|
163
|
+
return false;
|
|
164
|
+
const target = lastInput.target;
|
|
165
|
+
return !(target instanceof Element && target.closest('input, select, textarea, label, [contenteditable]'));
|
|
166
|
+
}
|
|
147
167
|
/**
|
|
148
168
|
* Before a paint: hold the screen on show when the paint starts the room over.
|
|
149
169
|
* `room` is whether the room is new; `entry` and `depth` are the walk's top
|
|
@@ -450,9 +470,13 @@ function picture(pane) {
|
|
|
450
470
|
twin.removeAttribute('aria-busy');
|
|
451
471
|
twin.style.height = '100%';
|
|
452
472
|
twin.style.overflow = 'hidden';
|
|
473
|
+
/* Only what stands above the pane's bottom edge is copied: the picture is cut to the pane's height, and the
|
|
474
|
+
rows and cards below it, copied, cost a click its style and layout for nothing (a cards list's open, on the
|
|
475
|
+
vitals' slowed CPU). */
|
|
476
|
+
const fold = pane.getBoundingClientRect().bottom;
|
|
453
477
|
for (const child of Array.from(pane.children)) {
|
|
454
478
|
if (child instanceof HTMLElement && !child.classList.contains('nav-held'))
|
|
455
|
-
twin.append(still(child));
|
|
479
|
+
twin.append(still(child, fold));
|
|
456
480
|
}
|
|
457
481
|
inner.append(twin);
|
|
458
482
|
return { copy, picture: twin, scrolled: pane.scrollTop };
|
|
@@ -463,12 +487,31 @@ function picture(pane) {
|
|
|
463
487
|
* not join a group), and so does autofocus; a canvas is copied as its
|
|
464
488
|
* picture, and a field as the value typed into it.
|
|
465
489
|
*/
|
|
466
|
-
function still(node) {
|
|
467
|
-
const copy = node
|
|
490
|
+
function still(node, fold) {
|
|
491
|
+
const copy = upTo(node, fold);
|
|
468
492
|
for (const element of [copy, ...Array.from(copy.querySelectorAll('[name], [autofocus]'))]) {
|
|
469
493
|
element.removeAttribute('name');
|
|
470
494
|
element.removeAttribute('autofocus');
|
|
471
495
|
}
|
|
496
|
+
return copy;
|
|
497
|
+
}
|
|
498
|
+
/* An element whose children run past the fold is copied child by child, and a child that starts below it is left
|
|
499
|
+
out: in the flow it comes after everything on show, so nothing on show moves without it. Anything that ends
|
|
500
|
+
above the fold is copied whole, natively, as the whole pane once was. */
|
|
501
|
+
function upTo(node, fold) {
|
|
502
|
+
if (node.childElementCount < 2 || node instanceof HTMLSelectElement || node.getBoundingClientRect().bottom <= fold)
|
|
503
|
+
return whole(node);
|
|
504
|
+
const copy = node.cloneNode(false);
|
|
505
|
+
for (const child of Array.from(node.childNodes)) {
|
|
506
|
+
if (!(child instanceof HTMLElement))
|
|
507
|
+
copy.append(child.cloneNode(true));
|
|
508
|
+
else if (child.getBoundingClientRect().top <= fold)
|
|
509
|
+
copy.append(upTo(child, fold));
|
|
510
|
+
}
|
|
511
|
+
return copy;
|
|
512
|
+
}
|
|
513
|
+
function whole(node) {
|
|
514
|
+
const copy = node.cloneNode(true);
|
|
472
515
|
const from = node.querySelectorAll('canvas');
|
|
473
516
|
if (from.length) {
|
|
474
517
|
const to = copy.querySelectorAll('canvas');
|
package/dist/client/page.css
CHANGED
|
@@ -1286,8 +1286,10 @@
|
|
|
1286
1286
|
margin-inline: auto;
|
|
1287
1287
|
background: var(--surface);
|
|
1288
1288
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1289
|
+
/* Every one of these buttons is disabled while the builder is busy, and the rule says so: keyed on a bare
|
|
1290
|
+
`button`, any aria-busy anywhere (a list's table while it sorts) restyled every button under it, since the
|
|
1291
|
+
browser cannot tell which element's aria-busy a rule is about (test/built-client-vitals.mjs). */
|
|
1292
|
+
.pb[aria-busy='true'] :is(.pb-head, .pb-foot) button[disabled] {
|
|
1291
1293
|
opacity: 0.55;
|
|
1292
1294
|
cursor: wait;
|
|
1293
1295
|
}
|
|
@@ -1768,7 +1770,11 @@
|
|
|
1768
1770
|
flex: 1;
|
|
1769
1771
|
border-top: 1px solid var(--line);
|
|
1770
1772
|
}
|
|
1771
|
-
|
|
1773
|
+
/* Every row but the first, rather than `* + *` (or `li + li`): a `+` whose right side is a bare tag or `*` is a rule
|
|
1774
|
+
the browser checks against the next sibling of every such element added or removed anywhere in the page, and a
|
|
1775
|
+
list's sort restyled its whole filter row for it, a phone's every summary (test/built-client-vitals.mjs).
|
|
1776
|
+
`:first-child` is asked only of this list's own children. */
|
|
1777
|
+
.timeline-rows > :not(:first-child) {
|
|
1772
1778
|
margin-top: var(--space-4h);
|
|
1773
1779
|
}
|
|
1774
1780
|
.timeline-rows > .is-compact + .is-compact,
|
|
@@ -1509,8 +1509,9 @@
|
|
|
1509
1509
|
}
|
|
1510
1510
|
/* A room with no mark among rooms with one keeps the mark's place empty, so its words start where theirs do. Set
|
|
1511
1511
|
at the row's edge it read as a heading among the rooms (a first-time reader took "Post rent" for one). A menu
|
|
1512
|
-
in which no room has a mark is untouched: nothing is held where nothing is drawn.
|
|
1513
|
-
|
|
1512
|
+
in which no room has a mark is untouched: nothing is held where nothing is drawn. The list says it has marks
|
|
1513
|
+
(Sidebar.tsx `data-marks`) rather than this asking with :has(), which put every button on the page under it. */
|
|
1514
|
+
body.app-mode:not(.sidebar-hidden) #table-list[data-marks] button:not(.nav-group-fold):not(:has(> :is(.nav-icon, .nav-dot)))::before {
|
|
1514
1515
|
content: '';
|
|
1515
1516
|
flex: none;
|
|
1516
1517
|
width: 16px;
|
package/dist/client/style.css
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
base — the tool's own rules, and the components features.css imports;
|
|
3
3
|
components — the stylesheets a component brings with it;
|
|
4
4
|
kit — the shared dress under every look, and custom themes' token machinery;
|
|
5
|
-
look — each look;
|
|
5
|
+
look — each look; app — the stylesheets an App's own components and control kit bring, over the kit's control
|
|
6
|
+
recipes and the look's (a card an App draws as a <button> keeps the corner it gives it) and under the theme;
|
|
7
|
+
theme — what an App's own theme says beyond the menu: its
|
|
6
8
|
parts' styles, its patterns and its own stylesheet (partsLook.css,
|
|
7
9
|
surfacesLook.css, themeStylesheet.ts), over the look it extends;
|
|
8
10
|
structure — layout that no look may move (structure.css);
|
|
9
11
|
print — paper, last.
|
|
10
12
|
A later layer wins whatever its specificity: nothing here out-specifies or
|
|
11
13
|
out-loads another to win. */
|
|
12
|
-
@layer base, components, kit, look, theme, structure, print;
|
|
14
|
+
@layer base, components, kit, look, app, theme, structure, print;
|
|
13
15
|
/* The tokens are @mistriwork/ui's (packages/ui/src), and so is what the controls wear (controls.css): each control is
|
|
14
16
|
drawn over UI SDK and dressed by its `data-slot`, in layers of its own. Nested in base they stand under every rule
|
|
15
17
|
written here: a dialog this stylesheet places by its class, a menu a component dresses and a control a toolbar
|
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.61",
|
|
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": {
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"./package.json": "./package.json"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@mistriwork/engine": "1.0.0-rc.
|
|
88
|
-
"@mistriwork/ui": "1.0.0-rc.
|
|
87
|
+
"@mistriwork/engine": "1.0.0-rc.61",
|
|
88
|
+
"@mistriwork/ui": "1.0.0-rc.61",
|
|
89
89
|
"intl-messageformat": "12.1.2",
|
|
90
90
|
"qrcode-generator": "^2.0.4"
|
|
91
91
|
},
|