@mistriwork/kit 1.0.0-rc.57 → 1.0.0-rc.59
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 +14 -2
- package/dist/client/audience.d.ts +1 -0
- package/dist/client/audience.js +10 -0
- package/dist/client/brandLook.css +49 -1
- package/dist/client/components/AppColumnMenuPopups.js +41 -11
- package/dist/client/components/AppList.d.ts +3 -1
- package/dist/client/components/AppList.js +77 -15
- package/dist/client/components/CardsList.js +14 -1
- package/dist/client/components/Chart.css +4 -0
- package/dist/client/components/Chart.d.ts +4 -4
- package/dist/client/components/Chart.js +30 -9
- package/dist/client/components/Content.js +3 -1
- package/dist/client/components/DateField.css +1 -1
- package/dist/client/components/DateField.js +1 -0
- package/dist/client/components/DefinedFields.js +2 -2
- package/dist/client/components/Diagram.css +82 -0
- package/dist/client/components/Diagram.d.ts +1 -0
- package/dist/client/components/Diagram.js +1 -0
- package/dist/client/components/Dressed.js +1 -1
- package/dist/client/components/Editable.js +7 -3
- package/dist/client/components/Export.js +1 -1
- package/dist/client/components/FilterBoxes.js +2 -2
- package/dist/client/components/FilterRail.css +1 -1
- package/dist/client/components/FilterRail.js +6 -4
- package/dist/client/components/Gallery.css +171 -0
- package/dist/client/components/Gallery.d.ts +1 -0
- package/dist/client/components/Gallery.js +1 -0
- package/dist/client/components/Grid.d.ts +2 -1
- package/dist/client/components/Grid.js +78 -24
- package/dist/client/components/GridCellEditor.js +4 -2
- package/dist/client/components/GridSelection.d.ts +4 -1
- package/dist/client/components/GridSelection.js +20 -3
- package/dist/client/components/LandingSurface.css +2 -2
- package/dist/client/components/LayoutBuilder.css +225 -0
- package/dist/client/components/LayoutBuilder.d.ts +1 -0
- package/dist/client/components/LayoutBuilder.js +1 -0
- package/dist/client/components/ListColumns.d.ts +12 -0
- package/dist/client/components/ListColumns.js +61 -0
- package/dist/client/components/ListFilterBar.css +39 -14
- package/dist/client/components/ListFilterBar.js +39 -23
- package/dist/client/components/MultiStepForm.css +22 -22
- package/dist/client/components/NewRecord.js +120 -104
- package/dist/client/components/Notes.css +9 -0
- package/dist/client/components/Notes.d.ts +6 -2
- package/dist/client/components/Notes.js +10 -6
- package/dist/client/components/OverflowMenu.js +16 -11
- package/dist/client/components/PageFields.js +19 -4
- package/dist/client/components/PageRelated.d.ts +8 -1
- package/dist/client/components/PageRelated.js +46 -33
- package/dist/client/components/PageSections.js +18 -5
- package/dist/client/components/Palette.js +1 -1
- package/dist/client/components/Prefs.d.ts +10 -0
- package/dist/client/components/Prefs.js +33 -23
- package/dist/client/components/PresentationSwitch.js +4 -0
- package/dist/client/components/Prompt.js +4 -4
- package/dist/client/components/RecordGone.js +4 -4
- package/dist/client/components/RecordPicker.js +24 -6
- package/dist/client/components/RecordSummaries.js +31 -5
- package/dist/client/components/RecordTrailNav.js +4 -0
- package/dist/client/components/RichTextEditor.css +2 -2
- package/dist/client/components/RichTextEditor.js +18 -19
- package/dist/client/components/Rooms.js +22 -4
- package/dist/client/components/SectionPeriod.css +1 -1
- package/dist/client/components/SetFieldDialog.js +1 -1
- package/dist/client/components/Sidebar.js +8 -5
- package/dist/client/components/SuggestBox.js +2 -2
- package/dist/client/components/TableRoom.d.ts +5 -1
- package/dist/client/components/TableRoom.js +29 -10
- package/dist/client/components/TableView.js +1 -1
- package/dist/client/components/ThMenu.js +26 -15
- package/dist/client/components/Tour.css +96 -0
- package/dist/client/components/Tour.d.ts +1 -0
- package/dist/client/components/Tour.js +1 -0
- package/dist/client/components/TreePicker.css +1 -1
- package/dist/client/components/TreePicker.js +27 -20
- package/dist/client/components/Value.js +4 -1
- package/dist/client/components/WorkflowStatus.js +8 -4
- package/dist/client/components/appListModel.d.ts +4 -0
- package/dist/client/components/appRooms.d.ts +2 -0
- package/dist/client/components/appRooms.js +2 -0
- package/dist/client/components/boardNew.d.ts +5 -0
- package/dist/client/components/boardNew.js +5 -0
- package/dist/client/components/conditionWords.d.ts +10 -0
- package/dist/client/components/conditionWords.js +20 -0
- package/dist/client/components/dashboardModel.d.ts +8 -0
- package/dist/client/components/dashboardModel.js +28 -1
- package/dist/client/components/editInteraction.d.ts +1 -1
- package/dist/client/components/editInteraction.js +1 -1
- package/dist/client/components/gridSizing.d.ts +14 -20
- package/dist/client/components/gridSizing.js +147 -108
- package/dist/client/components/pageContext.d.ts +3 -2
- package/dist/client/components/pageModel.d.ts +2 -0
- package/dist/client/components/pickerStaleness.d.ts +11 -1
- package/dist/client/components/pickerStaleness.js +12 -2
- package/dist/client/components/rowTitle.d.ts +2 -0
- package/dist/client/components/rowTitle.js +10 -0
- package/dist/client/components/textMeasure.js +72 -3
- package/dist/client/components/useConditionWords.d.ts +5 -0
- package/dist/client/components/useConditionWords.js +3 -1
- package/dist/client/components/useGridKeyboard.js +5 -0
- package/dist/client/components/valueModel.d.ts +1 -0
- package/dist/client/components/valueModel.js +39 -4
- package/dist/client/composer.css +2 -2
- package/dist/client/copy/es.js +3 -3
- package/dist/client/copy/filters/components/ListFilterBar.d.ts +1 -0
- package/dist/client/copy/filters/components/ListFilterBar.js +1 -0
- package/dist/client/copy/forms/components/DateField.d.ts +2 -0
- package/dist/client/copy/forms/components/DateField.js +2 -0
- package/dist/client/copy/forms/components/NewRecord.d.ts +8 -0
- package/dist/client/copy/forms/components/NewRecord.js +2 -0
- package/dist/client/copy/lists/components/AppList.d.ts +2 -0
- package/dist/client/copy/lists/components/AppList.js +2 -0
- package/dist/client/copy/lists/components/GridSelection.d.ts +1 -0
- package/dist/client/copy/lists/components/GridSelection.js +1 -0
- package/dist/client/copy/lists/components/ListColumns.d.ts +5 -0
- package/dist/client/copy/lists/components/ListColumns.js +7 -0
- package/dist/client/copy/lists/components/TableRoom.d.ts +3 -1
- package/dist/client/copy/lists/components/TableRoom.js +3 -1
- package/dist/client/copy/record/components/PageHistory.d.ts +2 -2
- package/dist/client/copy/record/components/PageHistory.js +4 -2
- package/dist/client/copy/record/components/WorkflowStatus.d.ts +1 -0
- package/dist/client/copy/record/components/WorkflowStatus.js +1 -0
- package/dist/client/copy/shell/components/MobileNavDrawer.d.ts +1 -0
- package/dist/client/copy/shell/components/MobileNavDrawer.js +2 -0
- package/dist/client/customThemes.css +3 -3
- package/dist/client/dom.js +5 -5
- package/dist/client/features.css +216 -356
- package/dist/client/fonts/Manrope-OFL.txt +93 -0
- package/dist/client/fonts/faces.css +10 -1
- package/dist/client/fonts/manrope-latin.woff2 +0 -0
- package/dist/client/formControls.css +4 -4
- package/dist/client/help.css +2 -2
- package/dist/client/ledgerLook.css +28 -0
- package/dist/client/locale.d.ts +2 -10
- package/dist/client/locale.js +0 -0
- package/dist/client/lumenLook.css +295 -105
- package/dist/client/manropeFace.css +32 -0
- package/dist/client/messages.d.ts +3 -3
- package/dist/client/messages.js +3 -3
- package/dist/client/page.css +98 -354
- package/dist/client/palette.js +31 -6
- package/dist/client/partsLook.css +60 -60
- package/dist/client/sageLook.css +101 -32
- package/dist/client/shellHost.d.ts +2 -2
- package/dist/client/shellHost.js +2 -2
- package/dist/client/shellMode.d.ts +9 -0
- package/dist/client/shellMode.js +2 -0
- package/dist/client/structure.css +281 -201
- package/dist/client/style.css +75 -224
- package/dist/client/themeFamilies.css +471 -66
- package/dist/client/tilesLook.css +502 -0
- package/dist/client/visualTheme.js +5 -2
- package/dist/client/visualThemes.css +38 -34
- package/dist/client/workbenchLook.css +12 -12
- package/dist/client/workshopLook.css +3 -8
- package/dist/vite.d.ts +1 -20
- package/dist/vite.js +33 -3
- package/package.json +8 -7
package/dist/client/app.js
CHANGED
|
@@ -42,7 +42,8 @@ import { onDemand } from './components/onDemand.js';
|
|
|
42
42
|
import { forgetPages, pagesFor, prefetchPages, recordPageId, whenPagesChange } from './page.js';
|
|
43
43
|
import { listenForRecordPresses, prefetchRecordPage } from './recordPress.js';
|
|
44
44
|
import { installShell, shell } from './shellMode.js';
|
|
45
|
-
import { onLanguagePicked, subscribeMessages } from './messages.js';
|
|
45
|
+
import { message, onLanguagePicked, subscribeMessages } from './messages.js';
|
|
46
|
+
import { SETTINGS_PAGE } from './components/appRooms.js';
|
|
46
47
|
import { applyDensity } from './density.js';
|
|
47
48
|
import { applyTypography } from './typography.js';
|
|
48
49
|
import { openPrefs } from './prefs.js';
|
|
@@ -302,7 +303,18 @@ function applyBrand() {
|
|
|
302
303
|
label: () => say('preferences'),
|
|
303
304
|
category: () => say('preferences.title'),
|
|
304
305
|
detail: () => say('appearanceAndListSettings'),
|
|
305
|
-
|
|
306
|
+
/* In an App the preferences are a section of its settings page (the App framework's SettingsRoom.tsx), which
|
|
307
|
+
has an address and room for the profile beside them. Where there is no such room, the Workbench and the
|
|
308
|
+
database browser, they stay the dialog; and for a signed-out visitor too, who has no settings to keep and
|
|
309
|
+
whose storefront page should stay under the choice being made. */
|
|
310
|
+
onSelect: () => {
|
|
311
|
+
if (!shell().inApp() || !shell().rooms.Settings || shell().publicVisitor())
|
|
312
|
+
return openPrefs();
|
|
313
|
+
const here = currentEntry();
|
|
314
|
+
if (here?.kind === 'page' && here.pageId === SETTINGS_PAGE)
|
|
315
|
+
return;
|
|
316
|
+
go({ ...pageView(SETTINGS_PAGE, undefined, undefined, message('common.settings')), tab: 'preferences' }, 'push');
|
|
317
|
+
},
|
|
306
318
|
},
|
|
307
319
|
]);
|
|
308
320
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function personFacing(): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the screen is drawn for the App's own public: a signed-out visitor, or a reader whose every role says
|
|
3
|
+
* `portal: true` (the server decides, appAudience.ts, and says it as `viewerAudience`). Such a reader came for their
|
|
4
|
+
* own things, so the parts that are the office's tools ask this before they draw: the global search, a list's
|
|
5
|
+
* view switch and column chooser, a record's pager, the look picker. One question, asked in one place each.
|
|
6
|
+
*/
|
|
7
|
+
import { shell } from './shellMode.js';
|
|
8
|
+
export function personFacing() {
|
|
9
|
+
return shell().app()?.viewerAudience === 'person';
|
|
10
|
+
}
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
lookSheetReady). They stand in `look` as every look's rules do; the rules
|
|
8
8
|
all the looks share stay in themeFamilies.css. */
|
|
9
9
|
@layer look {
|
|
10
|
+
/* A dark bar is the look's one hard edge: the pane's bar is ruled in the ink under it (structure.css). */
|
|
11
|
+
:root[data-look-bar='dark'] {
|
|
12
|
+
--pane-rule: 2px solid var(--ink);
|
|
13
|
+
}
|
|
10
14
|
/* A bar in the navigation's colour, with light text, the brand in the bar's ink. */
|
|
11
15
|
:root[data-look-bar='dark'] .topbar {
|
|
12
16
|
background: var(--nav-ground);
|
|
@@ -32,6 +36,12 @@
|
|
|
32
36
|
border-color: var(--nav-line);
|
|
33
37
|
color: var(--nav-ink);
|
|
34
38
|
box-shadow: none;
|
|
39
|
+
/* As tall as the search beside them: a key padded as the page's buttons are stood 6px over the box it is drawn
|
|
40
|
+
like, on a bar with 4px to spare. */
|
|
41
|
+
padding-block: var(--space-2);
|
|
42
|
+
}
|
|
43
|
+
:root[data-look-bar='dark'] .app-mode .topbar :is(.new-menu, .tenant-control-host) {
|
|
44
|
+
align-self: center;
|
|
35
45
|
}
|
|
36
46
|
:root[data-look-bar='dark'] .app-mode .topbar :is(.new-menu-trigger, .tenant-control-trigger):hover {
|
|
37
47
|
background: color-mix(in srgb, var(--nav-ink) 14%, transparent);
|
|
@@ -70,8 +80,46 @@
|
|
|
70
80
|
border-top: 2px solid var(--ink);
|
|
71
81
|
border-radius: 0;
|
|
72
82
|
box-shadow: none;
|
|
83
|
+
/* Open under its rule: the words start where the rule does, as a printed figure's do, and a label has the
|
|
84
|
+
card's whole width before it wraps and sets its figure a line under its neighbours'. */
|
|
85
|
+
padding-inline: 0;
|
|
73
86
|
}
|
|
74
|
-
|
|
87
|
+
/* `plain`: a figure open on the page with no box and no rule, the gap alone between it and the next. */
|
|
88
|
+
:root[data-look-stat='plain'] .dash-strip .home-card:nth-child(n) {
|
|
89
|
+
background: transparent;
|
|
90
|
+
border: 0;
|
|
91
|
+
border-radius: 0;
|
|
92
|
+
box-shadow: none;
|
|
93
|
+
padding-inline: 0;
|
|
94
|
+
}
|
|
95
|
+
/* A record's summary is the record's own row of figures: set as the dashboard's are, a size down, each under a
|
|
96
|
+
hairline (lumenLook.css does the same for `divided`). Prose in a summary is a paragraph, never a figure. */
|
|
97
|
+
:root[data-look-stat='ruled'] .page-field-summary .page-field {
|
|
98
|
+
padding-top: var(--space-3);
|
|
99
|
+
border-top: 1px solid var(--line-strong);
|
|
100
|
+
}
|
|
101
|
+
:root:is([data-look-stat='ruled'], [data-look-stat='plain']) .page-field-summary .page-field:not(.page-field-prose) > dd {
|
|
102
|
+
font-family: var(--type-figure-font, inherit);
|
|
103
|
+
font-size: var(--text-xl);
|
|
104
|
+
font-weight: var(--type-figure-weight, 600);
|
|
105
|
+
letter-spacing: var(--type-figure-tracking, -0.012em);
|
|
106
|
+
line-height: 1.2;
|
|
107
|
+
}
|
|
108
|
+
/* Open on the page there is no box to fit: the record's figures are set at the figure's own size. */
|
|
109
|
+
:root[data-look-stat='plain'] .page-field-summary .page-field:not(.page-field-prose) > dd {
|
|
110
|
+
font-size: var(--type-figure-size, var(--text-xl));
|
|
111
|
+
}
|
|
112
|
+
/* A figure with a tone is a word in a colour, on the line its neighbours stand on: as a centred inline box it sat
|
|
113
|
+
a pixel and a half under an untoned figure beside it. */
|
|
114
|
+
:root:is([data-look-stat='ruled'], [data-look-stat='plain']) .page-field-summary .page-field > dd > .tone-figure {
|
|
115
|
+
display: inline;
|
|
116
|
+
vertical-align: baseline;
|
|
117
|
+
}
|
|
118
|
+
/* An amount is set in the figures' face wherever a record says one (themeFamilies.css); here it is the figure. */
|
|
119
|
+
:root:root:is([data-look-stat='ruled'], [data-look-stat='plain']) .app-mode .page-field-summary .page-field > dd :is(.num-value, .date-value) {
|
|
120
|
+
font-family: inherit;
|
|
121
|
+
}
|
|
122
|
+
:root[data-look-table='tinted'] tbody tr:hover td:where(:not([data-slot])) {
|
|
75
123
|
background: color-mix(in srgb, var(--accent) 4%, var(--surface));
|
|
76
124
|
}
|
|
77
125
|
:root[data-look-table='tinted'] .row-host .row-select {
|
|
@@ -8,10 +8,9 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
8
8
|
* is hovered, focused or opened, and a list's first page carries only the
|
|
9
9
|
* buttons.
|
|
10
10
|
*/
|
|
11
|
-
import { Fragment, useRef } from 'react';
|
|
12
|
-
import { Menu } from '@
|
|
13
|
-
import { Popover } from '@
|
|
14
|
-
import { layoutViewport, zoomAnchor } from '@mistriwork/ui/internal/anchor.js';
|
|
11
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
12
|
+
import { createMenuController, Menu, MenuContent, MenuItem, MenuSeparator } from '@ui-sdk/react/menu';
|
|
13
|
+
import { createPopoverController, Popover, PopoverContent } from '@ui-sdk/react/popover';
|
|
15
14
|
import { columnDisplay, findTable, labelColumn } from '../core.js';
|
|
16
15
|
import { nextSort, sortDirection } from '../clauses.js';
|
|
17
16
|
import { mentionsColumn, ownedTails, withCondition } from '../filterbar.js';
|
|
@@ -22,11 +21,37 @@ import { appMenuEntries, sortWords } from './appColumnMenuModel.js';
|
|
|
22
21
|
import { facetActive } from './filterRailModel.js';
|
|
23
22
|
import { useConditionWords } from './useConditionWords.js';
|
|
24
23
|
import { say as sayCopy } from '../copy/columnMenu/components/AppColumnMenuPopups.js';
|
|
25
|
-
import { popupContainer } from '../shellHost.js';
|
|
24
|
+
import { popupContainer, portalRoot } from '../shellHost.js';
|
|
25
|
+
/* Where the menu and the filter are drawn: out of the table, by name. UI SDK draws a layer where its trigger is
|
|
26
|
+
unless it is told where, and the ⌄ is in a column's head: a form drawn there is a form inside whatever the grid
|
|
27
|
+
stands in, and every key pressed in the layer went up through the table. The dialog the grid is in keeps the
|
|
28
|
+
layer, so it stays inside that dialog's focus. */
|
|
29
|
+
const layerHost = (trigger) => trigger?.closest('dialog, [role="dialog"]') ?? popupContainer() ?? portalRoot();
|
|
26
30
|
/* How a flag's two values read where no display rule words them. */
|
|
27
31
|
const FLAG_WORDS = { true: sayCopy('common.yes'), false: sayCopy('common.no') };
|
|
28
32
|
export function AppColumnMenuPopups({ host, button, open, setOpen, handBack, name, label, kind, meta, sortable, current, columns, drawnBy, }) {
|
|
29
33
|
const popup = useRef(null);
|
|
34
|
+
/* Neither layer has a trigger of its own (the ⌄ is AppColumnMenu's, which holds the open state), so each is
|
|
35
|
+
opened and closed through a controller: a layer that is simply drawn open is given no focus, and these are
|
|
36
|
+
asked for by a press, so the keyboard has to arrive in them. */
|
|
37
|
+
const [menu] = useState(() => createMenuController());
|
|
38
|
+
const [filter] = useState(() => createPopoverController());
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (open === 'menu')
|
|
41
|
+
void menu.open({ anchor: button.current ?? undefined, focus: 'popup' });
|
|
42
|
+
else
|
|
43
|
+
menu.close();
|
|
44
|
+
if (open === 'filter')
|
|
45
|
+
void filter.open({ anchor: button.current ?? undefined });
|
|
46
|
+
else
|
|
47
|
+
filter.close();
|
|
48
|
+
}, [open, menu, filter, button]);
|
|
49
|
+
/* The keyboard goes back to the ⌄, unless what was chosen takes it on (the popover, the rail's facet). Said
|
|
50
|
+
here and not left to the menu: choosing an entry takes this whole part off the page, menu and all. */
|
|
51
|
+
const giveBack = () => {
|
|
52
|
+
if (handBack.current && button.current?.isConnected)
|
|
53
|
+
button.current.focus();
|
|
54
|
+
};
|
|
30
55
|
/* The column's own conditions, said as its chip says them, beside Clear filter. */
|
|
31
56
|
const tails = host.current ? ownedTails(host.current.refinement, name) : [];
|
|
32
57
|
const { speaker, sayTails } = useConditionWords(host.current?.table, tails.map((tail) => `${name} ${tail}`));
|
|
@@ -75,6 +100,7 @@ export function AppColumnMenuPopups({ host, button, open, setOpen, handBack, nam
|
|
|
75
100
|
return;
|
|
76
101
|
}
|
|
77
102
|
setOpen(null);
|
|
103
|
+
giveBack();
|
|
78
104
|
if ((key === 'asc' || key === 'desc') && sortPath)
|
|
79
105
|
h.navigate(nextSort(h.query, sortPath, key), name);
|
|
80
106
|
else if (key === 'clear')
|
|
@@ -82,11 +108,15 @@ export function AppColumnMenuPopups({ host, button, open, setOpen, handBack, nam
|
|
|
82
108
|
else if (key === 'pin')
|
|
83
109
|
togglePin(h.table, columns, name, h.listKey);
|
|
84
110
|
};
|
|
85
|
-
return (_jsxs(_Fragment, { children: [_jsx(Menu
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
111
|
+
return (_jsxs(_Fragment, { children: [_jsx(Menu, { controller: menu, onOpenChange: (next, details) => {
|
|
112
|
+
if (next)
|
|
113
|
+
return;
|
|
114
|
+
setOpen((was) => (was === 'menu' ? null : was));
|
|
115
|
+
/* Escape is a step back to where the reader was; a press elsewhere has already said where it is going. */
|
|
116
|
+
if (details.reason === 'escape-key')
|
|
117
|
+
giveBack();
|
|
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) => {
|
|
89
119
|
if (!next)
|
|
90
|
-
setOpen(null);
|
|
91
|
-
}, children: _jsx(
|
|
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), apply: (text) => h.apply(text, name), close: () => setOpen(null) }) })) })] }));
|
|
92
122
|
}
|
|
@@ -15,6 +15,8 @@ interface AppListProps {
|
|
|
15
15
|
inDashboard?: boolean;
|
|
16
16
|
/** Rows the list matched, once known, for a heading drawn outside the list (a dashboard section's count). */
|
|
17
17
|
onTotal?: (total: number | undefined) => void;
|
|
18
|
+
/** The list's summary strip, drawn between its heading and its tabs (Rooms.tsx, through the shell's slot). */
|
|
19
|
+
summary?: ReactNode;
|
|
18
20
|
}
|
|
19
|
-
export declare function AppList({ entry, spec, navigate, embedded, newButton, inDashboard, onTotal }: AppListProps): import("react").JSX.Element;
|
|
21
|
+
export declare function AppList({ entry, spec, navigate, embedded, newButton, inDashboard, onTotal, summary }: AppListProps): import("react").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -20,7 +20,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
20
20
|
* the list's question as text, so opening one is the ordinary list address.
|
|
21
21
|
*/
|
|
22
22
|
import { filterLabel } from '@mistriwork/engine/shared/listFilters.js';
|
|
23
|
-
import { BoardNewForm } from './boardNew.js';
|
|
23
|
+
import { BoardNewForm, BoardTotal } from './boardNew.js';
|
|
24
24
|
import { useMessageLanguage } from './useMessageLanguage.js';
|
|
25
25
|
import { createPortal } from 'react-dom';
|
|
26
26
|
import { listControlsRef, listHeadRef, useCrumbSlots } from './crumbSlot.js';
|
|
@@ -48,6 +48,8 @@ import { onDemand } from './onDemand.js';
|
|
|
48
48
|
import { useGridGroups } from './useGridGroups.js';
|
|
49
49
|
import { ListSubtitles } from './listSubtitles.js';
|
|
50
50
|
import { LayoutSwitch, useListLayout } from './LayoutSwitch.js';
|
|
51
|
+
import { ListColumns, useListColumns } from './ListColumns.js';
|
|
52
|
+
import { personFacing } from '../audience.js';
|
|
51
53
|
const DefinedBoxes = onDemand(() => import('./DefinedFields.js'), 'DefinedBoxes', { quiet: true });
|
|
52
54
|
/* A list's single `per` value (`category_id = 3`), which picks the fields a row-defined column's boxes are. */
|
|
53
55
|
function oneValue(tail) {
|
|
@@ -67,6 +69,7 @@ import { renamedView, useSavedViews, withView, withoutView, writeSavedViews } fr
|
|
|
67
69
|
import { PHONE_QUERY, RAIL_QUERY, useMediaQuery } from './useMediaQuery.js';
|
|
68
70
|
import { TableRoom } from './TableRoom.js';
|
|
69
71
|
import { RowOpensContext } from './rowOpens.js';
|
|
72
|
+
import { RowTitleContext } from './rowTitle.js';
|
|
70
73
|
import { ListEmpty } from './ListEmpty.js';
|
|
71
74
|
import { Empty } from './Notes.js';
|
|
72
75
|
import { Button } from '@mistriwork/ui/Button.js';
|
|
@@ -150,9 +153,49 @@ function TabCount({ counted }) {
|
|
|
150
153
|
/* The number in a box of its own, over the room a tab keeps for it (features.css). */
|
|
151
154
|
return _jsx("span", { className: "tab-count", children: said && _jsx("span", { children: said }) });
|
|
152
155
|
}
|
|
153
|
-
|
|
156
|
+
/* The switch's width where a list has drawn one, by the list's table: a list is made again on a change of tab, and
|
|
157
|
+
the room it held would be forgotten with it. */
|
|
158
|
+
const switchRoom = new Map();
|
|
159
|
+
/**
|
|
160
|
+
* Where a phone's Records/Table switch is drawn, at the end of the tabs' line. The list draws the switch once it has
|
|
161
|
+
* rows (TableView), so on every change of tab it left the line while the rows came and took its place again after:
|
|
162
|
+
* the strip beside it was a switch wider for those frames, and a tab came out from under More and went back. Once
|
|
163
|
+
* the switch has stood here its room is held (`data-held`, and its width) for as long as the page lives.
|
|
164
|
+
*/
|
|
165
|
+
function PresentationHost({ list }) {
|
|
166
|
+
const host = useRef(null);
|
|
167
|
+
const [room, setRoom] = useState(() => switchRoom.get(list));
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
const node = host.current;
|
|
170
|
+
if (!node)
|
|
171
|
+
return;
|
|
172
|
+
const hold = () => {
|
|
173
|
+
const drawn = node.firstElementChild;
|
|
174
|
+
// Layout pixels in, layout pixels out: nothing of the screen's is read.
|
|
175
|
+
const width = drawn?.offsetWidth;
|
|
176
|
+
if (!width)
|
|
177
|
+
return;
|
|
178
|
+
switchRoom.set(list, width);
|
|
179
|
+
setRoom(width);
|
|
180
|
+
};
|
|
181
|
+
hold();
|
|
182
|
+
const seen = new MutationObserver(hold);
|
|
183
|
+
seen.observe(node, { childList: true });
|
|
184
|
+
return () => seen.disconnect();
|
|
185
|
+
}, [list]);
|
|
186
|
+
// One function for the element's life: the slot is told of the element when it comes and when it goes, not on every draw.
|
|
187
|
+
const place = useCallback((node) => {
|
|
188
|
+
host.current = node;
|
|
189
|
+
listControlsRef(node);
|
|
190
|
+
}, []);
|
|
191
|
+
return (_jsx("span", { className: "applist-presentation", ref: place, "data-held": room ? '' : undefined, style: room ? { minWidth: room } : undefined }));
|
|
192
|
+
}
|
|
193
|
+
export function AppList({ entry, spec, navigate, embedded = false, newButton, inDashboard = false, onTotal, summary }) {
|
|
154
194
|
useMessageLanguage();
|
|
155
|
-
|
|
195
|
+
/* A refusal standing in place of the rows titles the room (TableRoom.tsx): the label made from an address that
|
|
196
|
+
names nothing the reader may see is not a name. */
|
|
197
|
+
const [refusedAs, setRefusedAs] = useState(null);
|
|
198
|
+
const caption = refusedAs ?? spec.label;
|
|
156
199
|
/* A list whose machine has a handful of open states may be read as a board too (listInference.ts): the reader's
|
|
157
200
|
choice, kept in their browser per view, as a board's folds are. */
|
|
158
201
|
const boardable = Boolean(spec.asBoard && !spec.presentation && !embedded && !inDashboard);
|
|
@@ -188,7 +231,10 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
188
231
|
const [gridResult, setGridResult] = useState();
|
|
189
232
|
const connection = state.activeConnection;
|
|
190
233
|
const gridCurrent = gridResult?.query === entry.query && gridResult.connection === connection ? gridResult : undefined;
|
|
234
|
+
/* A board reads no total; it says its lanes' sum here once they are counted (boardNew.ts). */
|
|
235
|
+
const [boardTotal, setBoardTotal] = useState(null);
|
|
191
236
|
const gridTotal = gridCurrent?.total;
|
|
237
|
+
const titleTotal = presented?.kind === 'board' ? (boardTotal ?? undefined) : gridTotal;
|
|
192
238
|
const gridCapped = gridCurrent?.capped === true;
|
|
193
239
|
const [advancedOpen, setAdvanced] = useState(false);
|
|
194
240
|
const rail = useRef(null);
|
|
@@ -292,7 +338,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
292
338
|
}
|
|
293
339
|
if (residueChip)
|
|
294
340
|
chips.push(residueChip);
|
|
295
|
-
const chipList = chips.map((c) => (_jsxs("span", { className: "applist-chip", children: [_jsx("span", { className: "applist-chip-text", children: c.text }), _jsx("button", { type: "button", className: "applist-chip-x", "aria-label": say('common.remove2', { text: c.text }), onClick: c.remove, children: "\u00D7" })] }, c.text)));
|
|
341
|
+
const chipList = chips.map((c) => (_jsxs("span", { className: "applist-chip", title: c.text, children: [_jsx("span", { className: "applist-chip-text", children: c.text }), _jsx("button", { type: "button", className: "applist-chip-x", "aria-label": say('common.remove2', { text: c.text }), onClick: c.remove, children: "\u00D7" })] }, c.text)));
|
|
296
342
|
const isDefault = canonicalize(entry.query) === canonicalize(appListQuery(spec, 0));
|
|
297
343
|
const exactTab = litTab >= 0 && canonicalize(refinement) === canonicalize(tabs[litTab].query ?? '');
|
|
298
344
|
const offerSave = savable && !(isDefault || exactTab || yourLit >= 0 || !refinement);
|
|
@@ -438,6 +484,10 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
438
484
|
]),
|
|
439
485
|
].filter((name) => !chosen.has(name))
|
|
440
486
|
: named;
|
|
487
|
+
/* The columns the reader left out (ListColumns.tsx): offered where the view names its columns and draws them as a
|
|
488
|
+
table on its own page. A choice of how to read the list, so the rows are asked for as they were. */
|
|
489
|
+
const choosable = !embedded && !inDashboard && !presented && table && (spec.show?.length ?? 0) > 2 ? spec.show : [];
|
|
490
|
+
const [leftOut, setLeftOut] = useListColumns(spec.id, choosable);
|
|
441
491
|
/* A join table's list opens what each row is about, by its name where the list shows it. */
|
|
442
492
|
const rowOpens = useMemo(() => spec.opens
|
|
443
493
|
? {
|
|
@@ -605,8 +655,8 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
605
655
|
unchanged. The search box is this room's state, so each character typed
|
|
606
656
|
redrew the room and, with it, the whole grid under the box; now a
|
|
607
657
|
keystroke redraws the box and the chips, and the rows are left alone. */
|
|
608
|
-
const hideKey = hide.join('\n');
|
|
609
|
-
const keptHide = useMemo(() => hide, [hideKey]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
658
|
+
const hideKey = [...hide, ...leftOut].join('\n');
|
|
659
|
+
const keptHide = useMemo(() => [...hide, ...leftOut], [hideKey]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
610
660
|
const totalsKey = totals ? JSON.stringify(totals) : '';
|
|
611
661
|
const keptTotals = useMemo(() => totals, [totalsKey]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
612
662
|
const onGridNow = useRef(onGrid);
|
|
@@ -640,9 +690,9 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
640
690
|
void client.invalidateQueries({
|
|
641
691
|
queryKey: ['count', connection ?? ''],
|
|
642
692
|
});
|
|
643
|
-
} }) })), _jsx(BoardNewForm.Provider, { value: offersNew ? (spec.form ?? {}) : null, children: _jsx(RowOpensContext.Provider, { value: rowOpens, children: _jsx(ListSubtitles.Provider, { value: spec.subtitles, children: _jsx(TableRoom, { entry: gridEntry, sizing: spec.sizing, chrome: false, summaries: true, inset: !inDashboard, embedded: inDashboard, hide: keptHide, referenceLabels: referenceLabels, totals: keptTotals, ...(gridGroup ? { group: gridGroup } : {}), density: spec.density,
|
|
644
|
-
|
|
645
|
-
|
|
693
|
+
} }) })), _jsx(BoardTotal.Provider, { value: ownList ? setBoardTotal : null, children: _jsx(BoardNewForm.Provider, { value: offersNew ? (spec.form ?? {}) : null, children: _jsx(RowOpensContext.Provider, { value: rowOpens, children: _jsx(RowTitleContext.Provider, { value: spec.primary, children: _jsx(ListSubtitles.Provider, { value: spec.subtitles, children: _jsx(TableRoom, { entry: gridEntry, sizing: spec.sizing, chrome: false, summaries: true, inset: !inDashboard, embedded: inDashboard, hide: keptHide, referenceLabels: referenceLabels, totals: keptTotals, ...(gridGroup ? { group: gridGroup } : {}), density: spec.density,
|
|
694
|
+
/* A ⋯ with nothing a reader may run is a dead control and a reserved column; the App payload already says what they may run. */
|
|
695
|
+
rowActions: Boolean(spec.rowActions && !presented && !embedded && mayRunAny(shell().app(), entry.table, spec.actions ?? [])), editable: presented || embedded ? undefined : spec.editable, inCrumbs: inCrumbs, onResult: keptOnGrid, onRefused: setRefusedAs, presentation: embedded ? undefined : presented, present: shell().present ?? undefined, empty: embedded ? undefined : narrowedPast ? (noMatches) : authoredEmpty ? (_jsx(ListEmpty, { spec: authoredEmpty })) : ((nothingYet ?? tabEmpty)), actions: embedded ? undefined : spec.actions, listLabel: caption, order: embedded ? undefined : spec.order, export: exportOff ? false : undefined, interactive: embedded ? false : undefined }) }) }) }) }) })] })), [
|
|
646
696
|
gridPage,
|
|
647
697
|
gridSize,
|
|
648
698
|
embedded,
|
|
@@ -669,11 +719,23 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
669
719
|
rowOpens,
|
|
670
720
|
]);
|
|
671
721
|
/* A signed-out visitor reads the storefront, not the tool (docs/design.md,
|
|
672
|
-
public pages): a
|
|
673
|
-
|
|
722
|
+
public pages): a favourites star is an operator's furniture there. How
|
|
723
|
+
many homes or cars there are is the storefront's own fact, so the count
|
|
724
|
+
stays beside the title for a visitor too. */
|
|
674
725
|
const visitor = shell().publicVisitor();
|
|
675
|
-
const
|
|
676
|
-
|
|
726
|
+
const scopeCount = narrowedPast && litTab >= 0 && yourLit === -1 ? countOf(litTab) : undefined;
|
|
727
|
+
const scopeTotal = scopeCount && !scopeCount.capped ? scopeCount.total : undefined;
|
|
728
|
+
const title = (_jsxs(_Fragment, { children: [_jsx("h1", { className: `applist-title${spec.heading === false ? ' visually-hidden' : ''}`, children: caption }), typeof titleTotal === 'number' && spec.heading !== false && (_jsxs("span", { className: "applist-count", title: say('rowsTheTabAndFilters'), children: [formatNumber(titleTotal), gridCapped ? '+' : ''] })), typeof titleTotal === 'number' && spec.heading !== false && typeof scopeTotal === 'number' && scopeTotal !== titleTotal && (_jsx("span", { className: "applist-count-of", children: say('ofTotal', { total: formatNumber(scopeTotal) }) })), spec.favorite && spec.id && !visitor && _jsx(FavoriteStar, { favorite: { kind: 'view', view: spec.id, label: caption }, name: caption })] }));
|
|
729
|
+
/* The list's kept questions and the two verbs that keep one, at the head of the page's verbs: what a reader has
|
|
730
|
+
saved, then Save and Rename. The saved ones are tabs too, after the list's own; the verbs stood at the end of
|
|
731
|
+
the filter bar, where they came and went with the question and moved the controls beside them. */
|
|
732
|
+
const viewsMenu = ownList && savable ? (_jsxs(DropMenu, { className: "applist-views", triggerClassName: "export-summary", label: _jsxs(_Fragment, { children: [_jsx("svg", { className: "applist-verb-mark", viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", children: _jsx("path", { d: "M4.5 2.5h7v11L8 11l-3.5 2.5z", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }) }), _jsx("span", { className: "export-word", children: say('views') })] }), popupClassName: "page-actions-popup", align: "end", children: [yours.length > 0 && (_jsx(DropGroup, { labelClassName: "more-group-label", label: store === 'account' ? say('myViews') : say('savedViews'), children: yours.map((view) => (_jsx(DropItem, { className: "page-actions-item", onClick: () => {
|
|
733
|
+
state.page = 0;
|
|
734
|
+
apply(view.query);
|
|
735
|
+
}, children: view.name }, view.name))) })), _jsx(DropItem, { className: "page-actions-item", disabled: !offerSave, title: store === 'account' ? say('keepThisTabIts') : say('keepThisTabItsFilters'), onClick: () => void save(), children: say('saveView') }), yourLit >= 0 && (_jsx(DropItem, { className: "page-actions-item", onClick: () => void rename(yours[yourLit]), children: say('renameView') }))] })) : null;
|
|
736
|
+
const pageVerbs = !spec.quickAdd && newButton;
|
|
737
|
+
return (_jsxs(_Fragment, { children: [boundNames.map((name) => (_jsx(DefinedBoxes, { column: name, binding: bound[name], per: bound[name].per ? oneValue(conditionTail(refinement, bound[name].per)) : undefined, onBoxes: onDefinedBoxes }, name))), inBar && createPortal(title, crumbs.note), inBar &&
|
|
738
|
+
createPortal(_jsxs(_Fragment, { children: [viewsMenu, pageVerbs] }), crumbs.tools), _jsxs("div", { className: `applist-head${inBar ? ' in-crumbs' : ''}`, children: [!inBar && !inDashboard && (_jsxs("div", { className: "applist-head-row", ref: head, children: [title, ownList ? (_jsxs("div", { className: "applist-head-tools", children: [viewsMenu, _jsx("span", { className: "applist-head-slot", ref: listHeadRef }), pageVerbs] })) : (pageVerbs)] })), !beside && !chipsInBar && _jsx("div", { className: "applist-chips", children: chipList })] }), summary, _jsxs("div", { className: "applist-controls", role: "group", "aria-label": say('listControls', { caption }), children: [(tabs.length > 1 || yours.length > 0) && (_jsxs("div", { className: "tabs folds", ref: tabStrip, children: [_jsxs("div", { className: "tabs-row", role: "tablist", children: [tabs.map((tab, i) => (_jsxs("button", { type: "button", role: "tab", className: "tab", "aria-selected": i === litTab && yourLit === -1, onClick: () => pickTab(i), ...foldMark(i), children: [_jsx("span", { children: tab.label }), _jsx(TabCount, { counted: countOf(i) })] }, tab.label))), yours.length > 0 && (_jsxs("span", { className: "tab-group", ...foldMark(tabs.length), "aria-hidden": "true", children: [tabs.length > 1 && _jsx("span", { className: "tab-divider" }), _jsx("span", { className: "tab-group-label", children: store === 'account' ? say('myViews') : say('savedViews') })] })), yours.map((f, i) => (_jsxs("span", { className: "tab-wrap", role: "presentation", ...foldMark(savedAt + i), children: [_jsxs("button", { type: "button", role: "tab", className: "tab tab-yours", "aria-selected": i === yourLit, title: `${viewWords(f.query) || say('everything')} — ${store === 'account' ? say('yourView') : say('aSavedView')}`, onClick: () => {
|
|
677
739
|
if (i !== yourLit) {
|
|
678
740
|
state.page = 0;
|
|
679
741
|
apply(f.query);
|
|
@@ -699,7 +761,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
699
761
|
// the sticky trail, leaving the same control impossible to close.
|
|
700
762
|
if (!showAdvanced)
|
|
701
763
|
setTimeout(() => filter.current?.focus({ preventScroll: true }), 0);
|
|
702
|
-
}, children: say('advanced') })),
|
|
764
|
+
}, children: say('advanced') })), choosable.length > 0 && !personFacing() && (_jsx(ListColumns, { columns: choosable.map((name) => ({ name, label: captionOf(name) })), hidden: leftOut, onChange: setLeftOut, caption: caption }))] })] }), _jsx("div", { className: "applist-advanced", hidden: !showAdvanced, children: _jsx("input", { ref: filter, type: "text", className: "applist-filter", defaultValue: refinement, placeholder: naming ? say('contains', { naming }) : say('filterRecords'), "aria-label": say('filter', { caption }),
|
|
703
765
|
/* The form has no submit button and, beside the search box, two
|
|
704
766
|
fields, so Enter submits by hand rather than by implicit submission. */
|
|
705
767
|
onKeyDown: (e) => {
|
|
@@ -707,7 +769,7 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
|
|
|
707
769
|
e.preventDefault();
|
|
708
770
|
form.current?.requestSubmit();
|
|
709
771
|
}
|
|
710
|
-
} }) })] })), inCrumbs && _jsx(
|
|
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) => {
|
|
711
773
|
walk.page = 0;
|
|
712
774
|
navigate(query);
|
|
713
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), onApply: (text) => {
|
|
@@ -153,7 +153,20 @@ export function CardsList({ table, rows, spec, interactive = true, recordNavigat
|
|
|
153
153
|
? factWord(spec.factLabels[name], row[name], columnDisplay(table.id, name))
|
|
154
154
|
: undefined;
|
|
155
155
|
const before = word !== undefined && spec.factLabels[name].position === 'before';
|
|
156
|
-
|
|
156
|
+
/* A number that says nothing of what it counts ("2", among "2 ba" and "1,240 sq ft") is said with its column's
|
|
157
|
+
own caption before it, "Beds 2": a unit, a format or a word of its own already says what a value is. */
|
|
158
|
+
const display = word === undefined
|
|
159
|
+
? columnDisplay(table.id, name)
|
|
160
|
+
: null;
|
|
161
|
+
/* On the summary line, where the facts stand together; the foot's values keep their captions for assistive
|
|
162
|
+
technology alone, as they have. */
|
|
163
|
+
const bare = className === 'cards-summary-item' &&
|
|
164
|
+
word === undefined &&
|
|
165
|
+
typeof row[name] === 'number' &&
|
|
166
|
+
!display?.unit &&
|
|
167
|
+
!display?.format &&
|
|
168
|
+
!(display?.values && Object.hasOwn(display.values, String(row[name])));
|
|
169
|
+
return (_jsxs("span", { className: className, children: [word === undefined && !bare && _jsxs("span", { className: "visually-hidden", children: [caption(name), ": "] }), bare && _jsxs("span", { className: "cards-summary-word", children: [caption(name), " "] }), before && _jsxs("span", { className: "cards-summary-word", children: [word, " "] }), said(row, name), word !== undefined && !before && _jsxs("span", { className: "cards-summary-word", children: [" ", word] })] }, name));
|
|
157
170
|
};
|
|
158
171
|
// A long page is drawn a line of cards at a time; the page itself is unchanged (useRowWindow.ts).
|
|
159
172
|
const win = useRowWindow(rows.length, {
|
|
@@ -13,10 +13,14 @@
|
|
|
13
13
|
.chart-bar-guide { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
|
|
14
14
|
.chart-bar-tip rect { fill: var(--ink); rx: min(10px, var(--radius)); }
|
|
15
15
|
.chart-bar-tip text { font: 500 var(--text-xs) var(--sans); fill: var(--ground); }
|
|
16
|
+
/* At rest the value in hand is the plot's headline, not a pill: nothing stands over a bar until the pointer names one. */
|
|
17
|
+
.chart-bar-tip.is-rest text { fill: var(--ink); }
|
|
16
18
|
.chart-x-tick.is-active { fill: var(--ink); }
|
|
17
19
|
/* Stacked columns: each series its token in every column; the current column is named by its tick and its pill, not by a tint. */
|
|
18
20
|
.chart-columns { display: grid; gap: var(--space-3h); min-width: 0; }
|
|
21
|
+
/* A column is one shape: its parts are square where they meet and its top part takes the bar's small corner. */
|
|
19
22
|
.chart-column-part { rx: 0; }
|
|
23
|
+
.chart-column-part.is-top { rx: min(3px, var(--radius)); }
|
|
20
24
|
/* A column that drills: a door over its whole band (the hit rect is clear), the pointer saying it goes somewhere, and
|
|
21
25
|
while it holds the keyboard the house ring round the band, as a line's point widens its stroke. */
|
|
22
26
|
.chart-column-door { cursor: pointer; outline: none; }
|
|
@@ -80,10 +80,10 @@ export interface PartialPeriods {
|
|
|
80
80
|
* Bars: one series, a bar per group — how much each week or each stage
|
|
81
81
|
* holds, where a line says how a number moved. Over calendar buckets one bar
|
|
82
82
|
* is the current one, drawn in the ink while the rest stay quiet: the last
|
|
83
|
-
* (the period in hand) until the pointer names another. Its value is
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
83
|
+
* (the period in hand) until the pointer names another. Its value is always
|
|
84
|
+
* said, so the reader has it without a tooltip's delay: at rest as the plot's
|
|
85
|
+
* headline in the corner over the levels, and in a pill over the bar the
|
|
86
|
+
* pointer names. A guide runs from the bar across the levels. Over categories (a
|
|
87
87
|
* stage, a source) no bar is the one in hand — the last is only last in the
|
|
88
88
|
* vocabulary — so at rest none is inked, with no pill and no guide, until the
|
|
89
89
|
* pointer names one. Nothing moves (motion rule 8).
|
|
@@ -428,14 +428,17 @@ const partialName = (label, key, partial) => partial?.keys.has(String(key))
|
|
|
428
428
|
: label;
|
|
429
429
|
/** Whether a key is a period the grammar buckets by ("2026-08", "2026-Q3"). */
|
|
430
430
|
const PERIOD = /^\d{4}(-\d{2}(-\d{2})?|-Q[1-4])?$/;
|
|
431
|
+
/** How few bars count as a handful, and the most room a handful takes. */
|
|
432
|
+
const FEW_BARS = 6;
|
|
433
|
+
const FEW_HIGH = 200;
|
|
431
434
|
/**
|
|
432
435
|
* Bars: one series, a bar per group — how much each week or each stage
|
|
433
436
|
* holds, where a line says how a number moved. Over calendar buckets one bar
|
|
434
437
|
* is the current one, drawn in the ink while the rest stay quiet: the last
|
|
435
|
-
* (the period in hand) until the pointer names another. Its value is
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
438
|
+
* (the period in hand) until the pointer names another. Its value is always
|
|
439
|
+
* said, so the reader has it without a tooltip's delay: at rest as the plot's
|
|
440
|
+
* headline in the corner over the levels, and in a pill over the bar the
|
|
441
|
+
* pointer names. A guide runs from the bar across the levels. Over categories (a
|
|
439
442
|
* stage, a source) no bar is the one in hand — the last is only last in the
|
|
440
443
|
* vocabulary — so at rest none is inked, with no pill and no guide, until the
|
|
441
444
|
* pointer names one. Nothing moves (motion rule 8).
|
|
@@ -472,7 +475,13 @@ export function BarChart({ rows, say = String, label = keyWord, wide = 600, high
|
|
|
472
475
|
const named = bars.map((b, i) => (periods ? periodTick(String(b.raw), i ? String(bars[i - 1].raw) : undefined) : label(b.raw)));
|
|
473
476
|
const whole = bars.map((b) => partialName(periods ? periodTick(String(b.raw)) : label(b.raw), b.raw, partial));
|
|
474
477
|
const W = measured > 0 ? measured : wide;
|
|
475
|
-
|
|
478
|
+
/* A handful of bars is read at a glance: it does not stand as tall as a month of them. */
|
|
479
|
+
const few = bars.length <= FEW_BARS;
|
|
480
|
+
const H = high
|
|
481
|
+
? Math.max(120, Math.min(Math.round(high), few ? FEW_HIGH : Infinity))
|
|
482
|
+
: few
|
|
483
|
+
? 160
|
|
484
|
+
: Math.max(160, Math.min(Math.round(W / 3), 240));
|
|
476
485
|
const goal = target !== undefined && Number.isFinite(target) ? target : undefined;
|
|
477
486
|
const max = Math.max(...bars.map((b) => b.value), 0, goal ?? 0);
|
|
478
487
|
const min = Math.min(...bars.map((b) => b.value), 0);
|
|
@@ -508,8 +517,11 @@ export function BarChart({ rows, say = String, label = keyWord, wide = 600, high
|
|
|
508
517
|
return (_jsxs(_Fragment, { children: [_jsxs("svg", { ref: svg, className: "chart-bars", viewBox: `0 0 ${W} ${H}`, role: "img", "aria-label": `${sayCopy('barsSummary', { count: bars.length, highest: say(Math.max(...bars.map((b) => b.value))), last: whole[bars.length - 1], value: say(bars[bars.length - 1].value) })}${goal === undefined ? '' : sayCopy('targetAfter', { goal: say(goal) })}`, onPointerMove: (e) => setNear(at(e)), onPointerLeave: () => setNear(null), children: [levels.map((v) => (_jsx("line", { className: "chart-grid", x1: PAD.left, x2: W - PAD.right, y1: f1(y(v)), y2: f1(y(v)) }, `g${v}`))), levels.map((v) => (_jsx("text", { className: "chart-tick chart-y-tick", x: f1(PAD.left - 6), y: f1(y(v) + 4), textAnchor: "end", children: tickSay(say)(v) }, `t${v}`))), active !== null && _jsx("line", { className: "chart-bar-guide", x1: PAD.left, x2: W - PAD.right, y1: f1(top), y2: f1(top) }), bars.map((b, i) => {
|
|
509
518
|
const h = Math.abs(y(b.value) - base);
|
|
510
519
|
return (_jsx("rect", { className: `chart-bar${toned ? ' is-toned' : ''}${i === active ? ' is-active' : ''}${partial?.keys.has(String(bars[i].raw)) ? ' is-partial' : ''}`, style: toned ? { ['--bar-ink']: inks[i] } : undefined, x: f1(x(i)), y: f1(Math.min(y(b.value), base)), width: f1(barWide), height: f1(Math.max(h, b.value ? 1 : 0)), children: _jsx("title", { children: `${whole[i]}: ${say(b.value)}` }) }, i));
|
|
511
|
-
}), goal !== undefined && (_jsxs("g", { className: "chart-target", children: [_jsx("line", { className: "chart-target-line", x1: PAD.left, x2: W - PAD.right, y1: f1(y(goal)), y2: f1(y(goal)) }), _jsx("text", { className: "chart-target-label", x: PAD.left + 4, y: f1(y(goal) - 4), children: sayCopy('target', { goal: say(goal) }) })] })), marks.map(({ index, text }) => (_jsx("text", { className: `chart-tick chart-x-tick${index === active ? ' is-active' : ''}`, x: f1(markAt(index, periods ? text : named[index])), y: H - 6, textAnchor: "middle", children: periods ? text : named[index] }, `m${index}`))), active !== null &&
|
|
520
|
+
}), goal !== undefined && (_jsxs("g", { className: "chart-target", children: [_jsx("line", { className: "chart-target-line", x1: PAD.left, x2: W - PAD.right, y1: f1(y(goal)), y2: f1(y(goal)) }), _jsx("text", { className: "chart-target-label", x: PAD.left + 4, y: f1(y(goal) - 4), children: sayCopy('target', { goal: say(goal) }) })] })), marks.map(({ index, text }) => (_jsx("text", { className: `chart-tick chart-x-tick${index === active ? ' is-active' : ''}`, x: f1(markAt(index, periods ? text : named[index])), y: H - 6, textAnchor: "middle", children: periods ? text : named[index] }, `m${index}`))), active !== null &&
|
|
521
|
+
(near === null ? (_jsx("g", { className: "chart-bar-tip is-rest", "aria-hidden": "true", children: _jsx("text", { x: f1(W - PAD.right), y: 14, textAnchor: "end", children: tip }) })) : (_jsxs("g", { className: "chart-bar-tip", "aria-hidden": "true", children: [_jsx("rect", { x: f1(tipLeft), y: f1(tipTop), width: f1(tipWide), height: 20 }), _jsx("text", { x: f1(tipLeft + tipWide / 2), y: f1(tipTop + 14), textAnchor: "middle", children: tip })] })))] }), _jsx("div", { className: "visually-hidden", children: _jsx("table", { className: "chart-data", children: _jsx("tbody", { children: bars.map((b, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: whole[i] }), _jsx("td", { children: say(b.value) })] }, i))) }) }) })] }));
|
|
512
522
|
}
|
|
523
|
+
/** The gap between two parts of a stacked column, in the drawing's units, which are CSS pixels (it is measured). */
|
|
524
|
+
const PART_SEAM = 2;
|
|
513
525
|
/**
|
|
514
526
|
* Stacked columns: a column per period, divided by series — how much each day
|
|
515
527
|
* held and what it was made of. The bars' grammar (Bars, above): levels on the
|
|
@@ -549,7 +561,12 @@ export function StackedColumns({ rows, series, say = String, wide = 600, high, p
|
|
|
549
561
|
const periods = columns.every((c) => PERIOD.test(c.key));
|
|
550
562
|
const named = columns.map((c) => (periods ? periodTick(c.key) : c.key));
|
|
551
563
|
const W = measured > 0 ? measured : wide;
|
|
552
|
-
const
|
|
564
|
+
const fewColumns = columns.length <= FEW_BARS;
|
|
565
|
+
const H = high
|
|
566
|
+
? Math.max(120, Math.min(Math.round(high), fewColumns ? FEW_HIGH : Infinity))
|
|
567
|
+
: fewColumns
|
|
568
|
+
? 160
|
|
569
|
+
: Math.max(160, Math.min(Math.round(W / 3.5), 220));
|
|
553
570
|
const goal = target !== undefined && Number.isFinite(target) && target > 0 ? target : undefined;
|
|
554
571
|
const max = Math.max(...columns.map((c) => c.total), 1);
|
|
555
572
|
const scale = niceScale(0, Math.max(max, goal ?? 0), 2, say.tick?.steps);
|
|
@@ -604,7 +621,11 @@ export function StackedColumns({ rows, series, say = String, wide = 600, high, p
|
|
|
604
621
|
base += v;
|
|
605
622
|
if (!v)
|
|
606
623
|
return null;
|
|
607
|
-
|
|
624
|
+
/* A part stands a hair off the one under it, so two series of near hues read as two; the column's top
|
|
625
|
+
part alone is rounded (Chart.css), so the column is one shape. */
|
|
626
|
+
const tall = y(from) - y(base);
|
|
627
|
+
const seam = from > 0 && tall > PART_SEAM + 1 ? PART_SEAM : 0;
|
|
628
|
+
return (_jsx("rect", { className: `chart-column-part${base >= c.total ? ' is-top' : ''}`, x: f1(x(i)), y: f1(y(base)), width: f1(colWide), height: f1(Math.max(1, tall - seam)), style: paint ? paint(k) : { fill: color(k) } }, k));
|
|
608
629
|
})] }));
|
|
609
630
|
const className = `chart-column${i === active ? ' is-active' : ''}`;
|
|
610
631
|
if (!(onPick && c.raw != null))
|
|
@@ -632,7 +653,7 @@ export function StackedColumns({ rows, series, say = String, wide = 600, high, p
|
|
|
632
653
|
moveRoving(to);
|
|
633
654
|
}
|
|
634
655
|
}, children: [column, _jsx("rect", { className: "chart-column-hit", x: f1(PAD.left + band * i), y: PAD.top, width: f1(band), height: f1(H - PAD.top - PAD.bottom) })] }, c.key));
|
|
635
|
-
}), goal !== undefined && (_jsxs("g", { className: "chart-target", children: [_jsx("line", { className: "chart-target-line", x1: PAD.left, x2: W - PAD.right, y1: f1(y(goal)), y2: f1(y(goal)) }), _jsx("text", { className: "chart-target-label", x: PAD.left + 4, y: f1(y(goal) - 4), children: sayCopy('target', { goal: say(goal) }) })] })), marks.map(({ index, text }) => (_jsx("text", { className: `chart-tick chart-x-tick${index === active ? ' is-active' : ''}`, x: f1(markAt(index, text)), y: H - 6, textAnchor: "middle", children: text }, `m${index}`))), _jsxs("g", { className: "chart-bar-tip", "aria-hidden": "true", children: [_jsx("rect", { x: f1(tipLeft), y: f1(tipTop), width: f1(tipWide), height: 20 }), _jsx("text", { x: f1(tipLeft + tipWide / 2), y: f1(tipTop + 14), textAnchor: "middle", children: tip })] })] }), legend && (_jsx("ul", { className: "chart-legend chart-columns-legend", children: series.map((s, k) => (_jsxs("li", { children: [_jsx("span", { className: "chart-swatch", style: { background: color(k) } }), _jsx("span", { className: "chart-legend-key", children: s.label }), _jsx("span", { className: "chart-legend-value", children: say(totals[k]) })] }, s.key))) })), _jsx("div", { className: "visually-hidden", children: _jsx("table", { className: "chart-data", children: _jsx("tbody", { children: columns.map((c, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: named[i] }), _jsx("td", { children: parts(i) })] }, c.key))) }) }) })] }));
|
|
656
|
+
}), goal !== undefined && (_jsxs("g", { className: "chart-target", children: [_jsx("line", { className: "chart-target-line", x1: PAD.left, x2: W - PAD.right, y1: f1(y(goal)), y2: f1(y(goal)) }), _jsx("text", { className: "chart-target-label", x: PAD.left + 4, y: f1(y(goal) - 4), children: sayCopy('target', { goal: say(goal) }) })] })), marks.map(({ index, text }) => (_jsx("text", { className: `chart-tick chart-x-tick${index === active ? ' is-active' : ''}`, x: f1(markAt(index, text)), y: H - 6, textAnchor: "middle", children: text }, `m${index}`))), near === null && !pointer ? (_jsx("g", { className: "chart-bar-tip is-rest", "aria-hidden": "true", children: _jsx("text", { x: f1(W - PAD.right), y: 14, textAnchor: "end", children: tip }) })) : (_jsxs("g", { className: "chart-bar-tip", "aria-hidden": "true", children: [_jsx("rect", { x: f1(tipLeft), y: f1(tipTop), width: f1(tipWide), height: 20 }), _jsx("text", { x: f1(tipLeft + tipWide / 2), y: f1(tipTop + 14), textAnchor: "middle", children: tip })] }))] }), legend && (_jsx("ul", { className: "chart-legend chart-columns-legend", children: series.map((s, k) => (_jsxs("li", { children: [_jsx("span", { className: "chart-swatch", style: { background: color(k) } }), _jsx("span", { className: "chart-legend-key", children: s.label }), _jsx("span", { className: "chart-legend-value", children: say(totals[k]) })] }, s.key))) })), _jsx("div", { className: "visually-hidden", children: _jsx("table", { className: "chart-data", children: _jsx("tbody", { children: columns.map((c, i) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: named[i] }), _jsx("td", { children: parts(i) })] }, c.key))) }) }) })] }));
|
|
636
657
|
}
|
|
637
658
|
/**
|
|
638
659
|
* The house ring round a donut's slice (design.md, Access): a shape takes no outline, so the ring is the outline of
|
|
@@ -25,7 +25,7 @@ import { currentEntry, paintVersion, renderCrumbs, roomVersion } from '../core.j
|
|
|
25
25
|
import { shell } from '../shellMode.js';
|
|
26
26
|
import { syncHash } from '../url.js';
|
|
27
27
|
import { appListFor } from './appListModel.js';
|
|
28
|
-
import { ASSISTANT_PAGE, DIRECTORY_PAGE, INBOX_PAGE, dashPageId, dashViewKey, formViewKey, homeRoom } from './appRooms.js';
|
|
28
|
+
import { ASSISTANT_PAGE, DIRECTORY_PAGE, INBOX_PAGE, SETTINGS_PAGE, dashPageId, dashViewKey, formViewKey, homeRoom } from './appRooms.js';
|
|
29
29
|
import { onDemand } from './onDemand.js';
|
|
30
30
|
import { crumbBarShown, Crumbs } from './Crumbs.js';
|
|
31
31
|
import { LoadErrorNote, NothingGranted, WorkbenchLanding } from './Landing.js';
|
|
@@ -166,6 +166,8 @@ function Room({ entry }) {
|
|
|
166
166
|
return rooms.Assistant ? _jsx(rooms.Assistant, { conversation: page.tab }) : null;
|
|
167
167
|
if (shell().inApp() && page.pageId === DIRECTORY_PAGE)
|
|
168
168
|
return rooms.Directory ? _jsx(rooms.Directory, {}) : null;
|
|
169
|
+
if (shell().inApp() && page.pageId === SETTINGS_PAGE)
|
|
170
|
+
return rooms.Settings ? _jsx(rooms.Settings, { section: page.tab }) : null;
|
|
169
171
|
return _jsx(PageRoom, { entry: page });
|
|
170
172
|
}
|
|
171
173
|
return _jsx(RowRoom, { entry: entry });
|