@tristan2828/ui-foundation 4.136.1 → 4.137.1
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/README.md +7 -6
- package/bin/ui-foundation.mjs +1 -1
- package/conventions/agents/skills/new-entity/SKILL.md +5 -2
- package/conventions/agents/spec-tester.md +3 -3
- package/conventions/docs/add-an-entity.md +722 -714
- package/conventions/docs/cell-patterns.md +206 -378
- package/conventions/docs/column-options.md +6 -12
- package/conventions/docs/design-language.md +294 -516
- package/conventions/docs/entity-plan-template.md +9 -7
- package/conventions/docs/reminders.md +12 -17
- package/conventions/docs/timed-screens.md +17 -20
- package/dist/components/app/action-error.js +1 -1
- package/dist/components/app/action-hint.js +1 -1
- package/dist/components/app/app-shell-bottom-bar.js +4 -4
- package/dist/components/app/app-shell-nav.d.ts +1 -1
- package/dist/components/app/app-shell-nav.js +1 -1
- package/dist/components/app/app-shell.d.ts +1 -1
- package/dist/components/app/app-shell.js +9 -9
- package/dist/components/app/board.d.ts +13 -13
- package/dist/components/app/board.js +3 -3
- package/dist/components/app/choice-buttons.d.ts +1 -1
- package/dist/components/app/data-table-tools.d.ts +3 -3
- package/dist/components/app/data-table.d.ts +11 -13
- package/dist/components/app/data-table.js +5 -5
- package/dist/components/app/date-field.js +1 -1
- package/dist/components/app/delete-action.d.ts +1 -1
- package/dist/components/app/delete-action.js +4 -4
- package/dist/components/app/edit-caret.js +1 -1
- package/dist/components/app/edit-in-place-presets.d.ts +4 -4
- package/dist/components/app/edit-in-place-store.d.ts +3 -3
- package/dist/components/app/edit-in-place-store.js +7 -7
- package/dist/components/app/editable-list.js +2 -3
- package/dist/components/app/editable-value.d.ts +2 -2
- package/dist/components/app/editable-value.js +20 -20
- package/dist/components/app/entity-form.js +2 -2
- package/dist/components/app/entity-view-facts.d.ts +12 -12
- package/dist/components/app/entity-view-facts.js +1 -1
- package/dist/components/app/entity-view.d.ts +16 -16
- package/dist/components/app/entity-view.js +28 -33
- package/dist/components/app/equal-items.js +4 -4
- package/dist/components/app/fact-extras.js +5 -5
- package/dist/components/app/field-rows.js +5 -5
- package/dist/components/app/fill-in-queue.js +2 -3
- package/dist/components/app/filter-bar.d.ts +1 -1
- package/dist/components/app/filter-date.js +1 -1
- package/dist/components/app/filter-name.js +1 -1
- package/dist/components/app/form-dialog.js +2 -2
- package/dist/components/app/form-leave-guard.js +2 -2
- package/dist/components/app/form-section.js +1 -1
- package/dist/components/app/icon-action.d.ts +1 -1
- package/dist/components/app/icon-action.js +2 -2
- package/dist/components/app/image-field.js +0 -1
- package/dist/components/app/keep-pencil-room.js +1 -1
- package/dist/components/app/key-stats.d.ts +3 -3
- package/dist/components/app/line-chart.d.ts +1 -1
- package/dist/components/app/line-chart.js +4 -4
- package/dist/components/app/list-editor-rows.js +1 -1
- package/dist/components/app/list-editor.js +1 -1
- package/dist/components/app/list-header.d.ts +6 -6
- package/dist/components/app/list-header.js +8 -8
- package/dist/components/app/markdown.js +30 -37
- package/dist/components/app/milkdown-editor.js +37 -62
- package/dist/components/app/module-card.js +6 -7
- package/dist/components/app/month-calendar.d.ts +46 -0
- package/dist/components/app/month-calendar.js +160 -0
- package/dist/components/app/month-day-field.js +0 -1
- package/dist/components/app/multi-choice.d.ts +1 -1
- package/dist/components/app/multi-choice.js +3 -3
- package/dist/components/app/multi-line-chart.js +5 -5
- package/dist/components/app/multi-pick.js +9 -10
- package/dist/components/app/multi-reference.js +2 -2
- package/dist/components/app/notes-outline.js +0 -1
- package/dist/components/app/notify.js +2 -2
- package/dist/components/app/offline-notice.js +1 -1
- package/dist/components/app/option-icon.js +1 -1
- package/dist/components/app/option-select.d.ts +1 -1
- package/dist/components/app/overview-page.d.ts +2 -2
- package/dist/components/app/overview-page.js +1 -1
- package/dist/components/app/page-trail-context.js +1 -1
- package/dist/components/app/pill-filter.d.ts +2 -2
- package/dist/components/app/prose-look.js +1 -1
- package/dist/components/app/quick-add-input.js +1 -1
- package/dist/components/app/rating-input.js +1 -1
- package/dist/components/app/rating-score.js +1 -1
- package/dist/components/app/record-dialog.js +25 -40
- package/dist/components/app/recurrence-field.js +6 -6
- package/dist/components/app/reference-combobox.js +1 -2
- package/dist/components/app/rich-text-box-anchor.js +0 -1
- package/dist/components/app/rich-text-edges.js +2 -2
- package/dist/components/app/rich-text-editor.d.ts +2 -3
- package/dist/components/app/rich-text-editor.js +19 -32
- package/dist/components/app/rich-text-empty-paragraph.d.ts +6 -7
- package/dist/components/app/rich-text-empty-paragraph.js +6 -7
- package/dist/components/app/rich-text-floating-toolbar.js +0 -1
- package/dist/components/app/rich-text-formats.js +2 -2
- package/dist/components/app/rich-text-input-rules.js +1 -2
- package/dist/components/app/rich-text-keyboard-bar.js +6 -7
- package/dist/components/app/rich-text-node-views.js +1 -2
- package/dist/components/app/rich-text-shortcuts.js +8 -8
- package/dist/components/app/rich-text-slash-menu.js +4 -6
- package/dist/components/app/rich-text-slash.d.ts +2 -2
- package/dist/components/app/rich-text-slash.js +2 -2
- package/dist/components/app/rich-text-table-grips.d.ts +1 -1
- package/dist/components/app/rich-text-table-grips.js +1 -2
- package/dist/components/app/rich-text-tasks.d.ts +1 -1
- package/dist/components/app/rich-text-tasks.js +1 -1
- package/dist/components/app/rich-text-touch.js +1 -1
- package/dist/components/app/search-palette.js +1 -2
- package/dist/components/app/secondary-filters.js +2 -3
- package/dist/components/app/session-view.js +1 -1
- package/dist/components/app/stacked-area-chart.js +1 -1
- package/dist/components/app/step-track.d.ts +1 -1
- package/dist/components/app/step-track.js +3 -3
- package/dist/components/app/widget-card.js +26 -30
- package/dist/components/app/widget-layout-sheet.js +1 -1
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/combobox.d.ts +1 -1
- package/dist/components/ui/combobox.js +2 -2
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +6 -6
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/error-reporting/reporter.d.ts +1 -1
- package/dist/error-reporting/reporter.js +1 -1
- package/dist/hooks/table-url-changes.d.ts +2 -2
- package/dist/hooks/table-url-changes.js +5 -6
- package/dist/hooks/use-action.js +1 -1
- package/dist/hooks/use-record-update.js +1 -1
- package/dist/hooks/use-table-url-state.d.ts +1 -1
- package/dist/hooks/use-table-url-state.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -2
- package/dist/lib/audio-cues.js +2 -2
- package/dist/lib/connection.js +1 -1
- package/dist/lib/date-filter.js +1 -1
- package/dist/lib/entity-view-tab.js +1 -1
- package/dist/lib/field-rows.js +2 -2
- package/dist/lib/form-errors.d.ts +1 -1
- package/dist/lib/form-errors.js +1 -1
- package/dist/lib/keep-audio-alive.js +1 -1
- package/dist/lib/line-chart-layout.js +4 -4
- package/dist/lib/markdown-inline.js +0 -2
- package/dist/lib/markdown-merge.js +2 -2
- package/dist/lib/markdown-table-widths.js +1 -1
- package/dist/lib/markdown-table.js +1 -2
- package/dist/lib/markdown-toggle.js +1 -1
- package/dist/lib/page-leaving.js +1 -1
- package/dist/lib/recurrence-format.d.ts +2 -2
- package/dist/lib/recurrence-format.js +1 -1
- package/dist/lib/recurrence-phrase.d.ts +1 -1
- package/dist/lib/recurrence-phrase.js +2 -2
- package/dist/lib/recurrence.d.ts +1 -1
- package/dist/lib/recurrence.js +2 -2
- package/dist/lib/stale-chunk-reload.js +1 -1
- package/dist/lib/status-kinds.d.ts +1 -1
- package/dist/lib/status-kinds.js +2 -2
- package/dist/mocks/start-worker.js +2 -2
- package/dist/routes/login.js +1 -1
- package/dist/testing/index.d.ts +7 -4
- package/dist/testing/index.js +10 -13
- package/package.json +2 -2
- package/styles/index.css +4 -4
- package/styles/theme.css +14 -20
- package/vite/pwa.js +1 -1
|
@@ -4,27 +4,27 @@
|
|
|
4
4
|
// 4 tasks, 5 bullets, 6 numbers, 8 a code block), and Cmd+Option and the
|
|
5
5
|
// digit does on a Mac, as in Notion (Cmd+Shift+3 to 5 are the Mac's
|
|
6
6
|
// screenshots). Mod+Shift+S strikes through, also Notion's, and
|
|
7
|
-
// Mod+Shift+H highlights
|
|
7
|
+
// Mod+Shift+H highlights, Notion's too. Each runs the same command
|
|
8
8
|
// as its toolbar button, so it toggles the same way.
|
|
9
9
|
//
|
|
10
10
|
// Read by the key's position (`event.code`), not the character it types:
|
|
11
11
|
// Shift+5 types "%", and Option+5 "∞".
|
|
12
12
|
//
|
|
13
|
-
// And the editing keys Notion, Docs and Obsidian share (
|
|
14
|
-
//
|
|
13
|
+
// And the editing keys Notion, Docs and Obsidian share (each is
|
|
14
|
+
// taken here, before Milkdown's own keymap):
|
|
15
15
|
// - Backspace at the start of a list item's first line lifts the item out
|
|
16
16
|
// of its list (a nested one up a level), its words kept as a line; a
|
|
17
17
|
// second Backspace joins it to the line above. Milkdown's (joinBackward)
|
|
18
|
-
//
|
|
18
|
+
// would fuse a nested item into the item above as its second paragraph.
|
|
19
19
|
// - Tab and Shift+Tab in a list item indent and outdent it, and stay in
|
|
20
20
|
// the text where it can't move (a first item): Tab leaving the editor
|
|
21
|
-
// from one item and not the next
|
|
21
|
+
// from one item and not the next would be a surprise. In a code block they
|
|
22
22
|
// indent and outdent its lines by two spaces. On a plain line Tab still
|
|
23
23
|
// leaves the editor, the keyboard's way on to the rest of the page.
|
|
24
24
|
// - Undo and redo (Mod+Z; Mod+Shift+Z, and Ctrl+Y off Apple) are taken
|
|
25
|
-
// here whether or not there is a step to take
|
|
26
|
-
//
|
|
27
|
-
//
|
|
25
|
+
// here whether or not there is a step to take: ProseMirror's keymap,
|
|
26
|
+
// finding nothing to redo, would run Shift+Mod+Z's unshifted key, Mod+Z,
|
|
27
|
+
// so a redo pressed once too often would undo a step.
|
|
28
28
|
import { redo, undo } from '@milkdown/kit/prose/history';
|
|
29
29
|
import { liftListItem, sinkListItem } from '@milkdown/kit/prose/schema-list';
|
|
30
30
|
import { DEFAULT_HIGHLIGHT } from '../../lib/markdown-highlight.js';
|
|
@@ -10,13 +10,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
// Placed against the field's element like the floating toolbar, not in a
|
|
11
11
|
// portal (rich-text-floating-toolbar.tsx says why): under the caret, or
|
|
12
12
|
// over it when there's more room there, and never taller than what is
|
|
13
|
-
// visible on its side (above a phone's keyboard
|
|
13
|
+
// visible on its side (above a phone's keyboard). Visible
|
|
14
14
|
// means inside whatever clips the field too: a card's `overflow-hidden`
|
|
15
|
-
// cut a menu opened on a note's last line down to its first item.
|
|
15
|
+
// would cut a menu opened on a note's last line down to its first item.
|
|
16
16
|
import { useLayoutEffect, useState } from 'react';
|
|
17
17
|
import { cn } from 'cn';
|
|
18
18
|
import { slashOptionId } from './rich-text-slash.js';
|
|
19
|
-
// Its gap from the caret's line.
|
|
20
19
|
const GAP = 4;
|
|
21
20
|
// Its tallest: every block shows on a laptop.
|
|
22
21
|
const TALLEST = 512;
|
|
@@ -24,7 +23,7 @@ const TALLEST = 512;
|
|
|
24
23
|
const ENOUGH = 170;
|
|
25
24
|
// What is visible of the window: above a phone's keyboard
|
|
26
25
|
// (`visualViewport`), above the bar pinned to it
|
|
27
|
-
// (rich-text-keyboard-bar.tsx) when the field has one
|
|
26
|
+
// (rich-text-keyboard-bar.tsx) when the field has one, and
|
|
28
27
|
// inside every element around the field that clips what overflows it (a
|
|
29
28
|
// card, a dialog's scrolling body).
|
|
30
29
|
function visibleArea(field) {
|
|
@@ -84,7 +83,6 @@ export function RichTextSlashMenu({ id, view, at, field, items, active, onHighli
|
|
|
84
83
|
window.visualViewport?.removeEventListener('resize', update);
|
|
85
84
|
};
|
|
86
85
|
}, [view, at, field, menu, items.length]);
|
|
87
|
-
// The highlighted item stays in sight.
|
|
88
86
|
useLayoutEffect(() => {
|
|
89
87
|
menu?.querySelector(`#${CSS.escape(slashOptionId(id, active))}`)?.scrollIntoView({ block: 'nearest' });
|
|
90
88
|
}, [menu, id, active]);
|
|
@@ -97,7 +95,7 @@ export function RichTextSlashMenu({ id, view, at, field, items, active, onHighli
|
|
|
97
95
|
!placement && 'invisible'), children: items.map((item, index) => {
|
|
98
96
|
const Icon = item.icon;
|
|
99
97
|
return (_jsxs("div", { id: slashOptionId(id, index), role: "option", "aria-selected": index === active,
|
|
100
|
-
// 44px rows on a touch screen
|
|
98
|
+
// 44px rows on a touch screen.
|
|
101
99
|
className: "flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 select-none aria-selected:bg-muted pointer-coarse:min-h-11",
|
|
102
100
|
// A press never takes focus from the text.
|
|
103
101
|
onMouseDown: (event) => event.preventDefault(), onMouseMove: () => index !== active && onHighlight(index), onClick: () => onPick(item.id), children: [_jsx(Icon, { "aria-hidden": "true", className: "size-4 shrink-0" }), item.label] }, item.id));
|
|
@@ -21,8 +21,8 @@ export declare function slashOptionId(listId: string, index: number): string;
|
|
|
21
21
|
/** The plugin: opens on a typed "/", follows the text, closes once the span stops qualifying. */
|
|
22
22
|
export declare function slashPlugin(): Plugin<SlashState>;
|
|
23
23
|
/**
|
|
24
|
-
* A slash menu item: a block, an image (only with the editor's `upload
|
|
25
|
-
*
|
|
24
|
+
* A slash menu item: a block, an image (only with the editor's `upload`)
|
|
25
|
+
* or the new page (only with the app's `onCreatePage`).
|
|
26
26
|
*/
|
|
27
27
|
export type SlashItem = Omit<FormatItem, 'id'> & {
|
|
28
28
|
id: FormatId | 'image' | 'page';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// line into that block, the "/…" gone. The menu itself:
|
|
4
4
|
// rich-text-slash-menu.tsx; its keys and ARIA: milkdown-editor.tsx.
|
|
5
5
|
//
|
|
6
|
-
// Any line of text
|
|
6
|
+
// Any line of text: a top-level
|
|
7
7
|
// one or a heading, a list item's, a quote's or a callout's, a table
|
|
8
8
|
// cell's. The menu lists only what can be made there: in a cell, the
|
|
9
9
|
// highlights (a cell holds one line), not a heading or a list.
|
|
@@ -111,7 +111,7 @@ const KEYWORDS = {
|
|
|
111
111
|
// once something's typed ("/warn"), so the list "/" opens with stays short.
|
|
112
112
|
const BLOCKS = FORMAT_GROUPS.flat().filter((item) => KEYWORDS[item.id]);
|
|
113
113
|
BLOCKS.splice(BLOCKS.findIndex((item) => item.id === 'heading3') + 1, 0, ...TOGGLE_HEADING_VARIANTS);
|
|
114
|
-
// An image
|
|
114
|
+
// An image: the file picker, the image going where the "/" was.
|
|
115
115
|
// The Image button's job for an editor with no fixed toolbar
|
|
116
116
|
// (`toolbar="floating"`), and a quicker way with one.
|
|
117
117
|
const IMAGE_ITEM = { id: 'image', label: 'Image', icon: ImageIcon };
|
|
@@ -13,7 +13,7 @@ export interface TableGripsProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* The cell the caret is in when it's in this table and the text has
|
|
15
15
|
* focus, else null: all the grips draw from the editor's state, so a
|
|
16
|
-
* key that doesn't move it re-renders nothing
|
|
16
|
+
* key that doesn't move it re-renders nothing. What a menu offers
|
|
17
17
|
* is read from `view`'s state as it opens.
|
|
18
18
|
*/
|
|
19
19
|
caret: TableCell | null;
|
|
@@ -81,7 +81,6 @@ function stateAt(state, tablePos, cell) {
|
|
|
81
81
|
}
|
|
82
82
|
// How far either side of a column's right edge the pointer can be to take it.
|
|
83
83
|
const EDGE_REACH = 6;
|
|
84
|
-
// How much Narrower and Wider change a column.
|
|
85
84
|
const WIDTH_STEP = 16;
|
|
86
85
|
// The column whose right edge is nearest a point within the table, if one's in reach.
|
|
87
86
|
function edgeAt(table, box, x, y) {
|
|
@@ -323,7 +322,7 @@ export function TableGrips({ view, caret, getPos, frame, box, table, readOnly, o
|
|
|
323
322
|
const rowColor = there && tableColorEnabled(there, 'row');
|
|
324
323
|
const finalFocus = () => text() ?? true;
|
|
325
324
|
const grip = 'pointer-events-auto absolute flex items-center justify-center rounded-sm border border-border bg-muted text-muted-foreground shadow-xs outline-none hover:bg-primary hover:text-primary-foreground data-popup-open:bg-primary data-popup-open:text-primary-foreground ' +
|
|
326
|
-
// On a touch screen, an invisible 40px square round each takes the tap
|
|
325
|
+
// On a touch screen, an invisible 40px square round each takes the tap.
|
|
327
326
|
"pointer-coarse:before:absolute pointer-coarse:before:top-1/2 pointer-coarse:before:left-1/2 pointer-coarse:before:size-10 pointer-coarse:before:-translate-1/2 pointer-coarse:before:content-['']";
|
|
328
327
|
return (_jsxs(_Fragment, { children: [!phone && (_jsxs("div", { ref: edgeHandle, hidden: true, "aria-hidden": "true", "data-slot": "rich-text-table-column-edge", className: "pointer-events-auto absolute z-10 flex w-3 -translate-x-1/2 cursor-col-resize touch-none justify-center", onPointerDown: startDrag, onDoubleClick: () => edge !== null && onWidth(edge, null), children: [_jsx("span", { className: "h-full w-0.5 bg-primary" }), drag && (_jsx("span", { "data-slot": "rich-text-table-column-size", className: "absolute bottom-full mb-1 rounded-sm bg-primary px-1.5 font-mono text-xs whitespace-nowrap text-primary-foreground tabular-nums", children: drag.label }))] })), _jsxs(DropdownMenu, { open: open === 'column' || open === 'cell', onOpenChange: openMenu('column'), children: [_jsx(DropdownMenuTrigger, { tabIndex: -1, "aria-label": menuCell ? `Column: ${columnName(menuCell.column)}` : 'Column', ref: columnGrip, "data-slot": "rich-text-table-column-grip", className: cn(grip, 'h-3.5 w-6 -translate-x-1/2 -translate-y-1/2'), children: _jsx(GripHorizontalIcon, { "aria-hidden": "true", className: "size-3" }) }), _jsx(DropdownMenuContent, { className: "w-56", "data-rich-text-menu": "", finalFocus: finalFocus, children: open === 'cell' ? (_jsxs(_Fragment, { children: [menuCell && menuCell.row > 0 && (_jsxs(_Fragment, { children: [colorGroup('cell', 'Cell Colour'), _jsx(DropdownMenuSeparator, {})] })), _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Row" }), items(ROW_ITEMS)] }), _jsx(DropdownMenuSeparator, {}), columnItems(false, menuCell ? `Column: ${columnName(menuCell.column)}` : 'Column')] })) : (columnItems(true)) })] }), _jsxs(DropdownMenu, { open: open === 'row', onOpenChange: openMenu('row'), children: [_jsx(DropdownMenuTrigger, { tabIndex: -1, "aria-label": menuCell ? (menuCell.row === 0 ? 'Header Row' : `Row ${menuCell.row}`) : 'Row', ref: rowGrip, "data-slot": "rich-text-table-row-grip", className: cn(grip, 'h-6 w-3.5 -translate-x-1/2 -translate-y-1/2'), children: _jsx(GripVerticalIcon, { "aria-hidden": "true", className: "size-3" }) }), _jsxs(DropdownMenuContent, { className: "w-56", "data-rich-text-menu": "", finalFocus: finalFocus, children: [_jsx(DropdownMenuGroup, { children: items(ROW_ITEMS) }), rowColor && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), colorGroup('row', 'Colour Row')] }))] })] })] }));
|
|
329
328
|
}
|
|
@@ -7,7 +7,7 @@ export declare const taskInputRule: import("@milkdown/utils").$InputRule;
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function splitTaskItem(state: EditorState, dispatch: (tr: Transaction) => void): boolean;
|
|
9
9
|
/**
|
|
10
|
-
* A task item's box in its hit area
|
|
10
|
+
* A task item's box in its hit area: the box as drawn, in a
|
|
11
11
|
* label whose invisible 40px square, on a touch screen, takes the tap
|
|
12
12
|
* (a press on a label is its checkbox's), and the item's row 40px tall
|
|
13
13
|
* there, so two items' squares never overlap. A laptop is unchanged.
|
|
@@ -71,7 +71,7 @@ export function splitTaskItem(state, dispatch) {
|
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* A task item's box in its hit area
|
|
74
|
+
* A task item's box in its hit area: the box as drawn, in a
|
|
75
75
|
* label whose invisible 40px square, on a touch screen, takes the tap
|
|
76
76
|
* (a press on a label is its checkbox's), and the item's row 40px tall
|
|
77
77
|
* there, so two items' squares never overlap. A laptop is unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Whether the editor is on a touch screen
|
|
1
|
+
// Whether the editor is on a touch screen: where its toolbar
|
|
2
2
|
// is the bar pinned to the keyboard (rich-text-keyboard-bar.tsx), the
|
|
3
3
|
// floating bar over selected words gives way to the system's own, and the
|
|
4
4
|
// slash menu is capped to what the keyboard leaves visible.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
// Search in AppShell's bar
|
|
2
|
+
// Search in AppShell's bar: a box in the header (a button on a
|
|
3
3
|
// phone) and Ctrl K (⌘K on a Mac) open a palette that finds a page or a
|
|
4
4
|
// record by name, and Enter opens it. Before you type it lists the
|
|
5
5
|
// records you opened lately (useRecentRecord), then the first pages.
|
|
@@ -18,7 +18,6 @@ import { groupRecords, matchPages, readRecentRecords, searchPages, } from '../..
|
|
|
18
18
|
import { Button } from '../ui/button.js';
|
|
19
19
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from '../ui/dialog.js';
|
|
20
20
|
import { Spinner } from '../ui/spinner.js';
|
|
21
|
-
// How long typing pauses before findRecords is asked.
|
|
22
21
|
const SEARCH_DELAY_MS = 150;
|
|
23
22
|
const PAGES_BEFORE_TYPING = 5;
|
|
24
23
|
const PAGES_MATCHED = 6;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// A table toolbar's less-used filters behind one "Filters" button, so a
|
|
3
|
-
// table with many filters still starts near the top of the page (
|
|
4
|
-
//
|
|
5
|
-
// stay in the toolbar; this goes beside them, holding the rest:
|
|
3
|
+
// table with many filters still starts near the top of the page. The primary filters (search, status, whatever most
|
|
4
|
+
// visits use) stay in the toolbar; this goes beside them, holding the rest:
|
|
6
5
|
//
|
|
7
6
|
// - The button says how many of its filters are on ("Filters 2", named
|
|
8
7
|
// "Filters, 2 active"), and opens them in a popover, or a sheet from the
|
|
@@ -9,7 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
// fullscreen and quietly isn't there where the browser can't (iOS Safari
|
|
10
10
|
// on a phone), and keepAwake, which holds a screen wake lock while open.
|
|
11
11
|
// `dark` renders the view in the dark theme whatever the app's (the dark
|
|
12
|
-
// stage
|
|
12
|
+
// stage): the dark tokens are scoped to the view, so the page under
|
|
13
13
|
// it keeps its own. SessionStage, below, is the stage under the header.
|
|
14
14
|
// Recipes for its states in Playwright: docs/foundation/timed-screens.md.
|
|
15
15
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Parts of a whole over time
|
|
2
|
+
// Parts of a whole over time: several amounts that add up to a
|
|
3
3
|
// total, each a category (a portfolio by asset class), stacked from zero
|
|
4
4
|
// so the top edge is the total and both the growth and the mix show.
|
|
5
5
|
// MultiLineChart's sibling, plain SVG the same way: each band is its own
|
|
@@ -59,7 +59,7 @@ export declare function StepName({ step, number, title, attention, current, }: {
|
|
|
59
59
|
current?: boolean;
|
|
60
60
|
}): import("react").JSX.Element;
|
|
61
61
|
/**
|
|
62
|
-
* A read-only row of numbered steps
|
|
62
|
+
* A read-only row of numbered steps: the stepper look's marks
|
|
63
63
|
* without its panels, for showing where a sequence is (a list card's
|
|
64
64
|
* phases), with a `caption` under the current step.
|
|
65
65
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// A row of numbered steps joined by a line, each done, current or upcoming:
|
|
3
|
-
// the marks of `EqualItems look="stepper"
|
|
4
|
-
// only
|
|
3
|
+
// the marks of `EqualItems look="stepper"`, on their own and read
|
|
4
|
+
// only. For a display of where a sequence is (a list card showing a
|
|
5
5
|
// program's phases, a caption such as "Day 12" under the current one),
|
|
6
6
|
// where nothing is picked and no panel shows.
|
|
7
7
|
//
|
|
@@ -61,7 +61,7 @@ function useOverflows(rowRef) {
|
|
|
61
61
|
return overflows;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
* A read-only row of numbered steps
|
|
64
|
+
* A read-only row of numbered steps: the stepper look's marks
|
|
65
65
|
* without its panels, for showing where a sequence is (a list card's
|
|
66
66
|
* phases), with a `caption` under the current step.
|
|
67
67
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
// A small titled card on a hub page
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// A small titled card on a hub page: a few rows from one part of the app,
|
|
3
|
+
// loaded on their own. It owns the four required states the way DataTable
|
|
4
|
+
// and EntityView do, so every widget on a page skeletons, empties and
|
|
5
|
+
// fails alike:
|
|
6
6
|
//
|
|
7
7
|
// - loading: `skeletonRows` rows shaped like the list's, so the card
|
|
8
8
|
// keeps its height when the data arrives;
|
|
@@ -16,33 +16,32 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
16
16
|
// outline and its landmarks. Height follows content (`self-start` in a
|
|
17
17
|
// grid), so a short widget doesn't stretch to its tallest neighbour.
|
|
18
18
|
//
|
|
19
|
-
// `collapsible`
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
19
|
+
// `collapsible` folds a card to its header, for a hub with more widgets
|
|
20
|
+
// than a phone screen holds: a chevron button at the header's end (named
|
|
21
|
+
// by the title, `aria-expanded`, `aria-controls` the body), the header's
|
|
22
|
+
// link still there while folded. With `storageKey` the choice is
|
|
23
23
|
// remembered on this device (useRememberedFlag: localStorage, in memory
|
|
24
24
|
// where that's blocked). The body is hidden, not unmounted, so whatever
|
|
25
25
|
// the app keeps in it stays put.
|
|
26
26
|
//
|
|
27
|
-
// `summary`
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// the error in it as before. The chevron is described by it.
|
|
27
|
+
// `summary` is one short value a folded card shows in its header ("3",
|
|
28
|
+
// "Due today"). It follows the card's state: a small skeleton while
|
|
29
|
+
// loading, a muted dash ("Couldn't load" to a screen reader) on an error,
|
|
30
|
+
// `emptySummary` (or nothing) when empty. Opened, the summary goes and the
|
|
31
|
+
// body shows. The chevron is described by it.
|
|
33
32
|
//
|
|
34
|
-
// WidgetCardGroup
|
|
35
|
-
//
|
|
36
|
-
//
|
|
33
|
+
// WidgetCardGroup makes its cards an accordion: every card in it folds,
|
|
34
|
+
// opening one folds the others, and a click anywhere on a header (not on
|
|
35
|
+
// its link or another control) toggles it; the chevron stays the
|
|
37
36
|
// keyboard's way in. `accordion="mobile"` does that only below the
|
|
38
37
|
// sidebar's breakpoint (useIsMobile), so a desktop hub keeps each card's
|
|
39
38
|
// own `collapsible`. While the accordion is on it owns the folding and a
|
|
40
39
|
// card's `storageKey` is left alone.
|
|
41
40
|
//
|
|
42
41
|
// The header's link is an app route (`to`) or, for a widget about a
|
|
43
|
-
// service outside the app, its address (`href
|
|
44
|
-
//
|
|
45
|
-
//
|
|
42
|
+
// service outside the app, its address (`href`): that one opens in a new
|
|
43
|
+
// tab, with the outside-link mark and a screen reader's "(opens in a new
|
|
44
|
+
// tab)", as WidgetListItem's `href` does.
|
|
46
45
|
//
|
|
47
46
|
// WidgetList and WidgetListItem are the common body: rows with dividers,
|
|
48
47
|
// each a primary link (or plain text) truncated to one line, an optional
|
|
@@ -51,18 +50,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
51
50
|
// function and it gets the id to put in `aria-labelledby`.
|
|
52
51
|
//
|
|
53
52
|
// One card anatomy (overview standard O4), shared with OverviewPage's
|
|
54
|
-
// parts
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
// one muted line under it, and `freshness` how old the number is
|
|
53
|
+
// parts: `to` makes the title the link to everything the card sums up,
|
|
54
|
+
// with a chevron after it; `value` is its headline in the numeric type,
|
|
55
|
+
// `line` one muted line under it, and `freshness` how old the number is
|
|
58
56
|
// (Freshness) at the body's end. A folded card shows `value` as its
|
|
59
|
-
// summary when no `summary` is given. All optional
|
|
60
|
-
// is drawn as before, and its folding on a phone is unchanged.
|
|
57
|
+
// summary when no `summary` is given. All optional.
|
|
61
58
|
//
|
|
62
|
-
// Under data-density="compact"
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
// finger's target.
|
|
59
|
+
// Under data-density="compact" the card's padding drops to 12px and a
|
|
60
|
+
// row's to 4px; text stays at type-body. On a phone a compact row is 44px
|
|
61
|
+
// tall and its link fills that height, so it stays a finger's target.
|
|
66
62
|
import { createContext, useContext, useId, useState } from 'react';
|
|
67
63
|
import { Link } from 'react-router';
|
|
68
64
|
import { ChevronDownIcon, ChevronRightIcon, ExternalLinkIcon } from 'lucide-react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// A hub page's Customize sheet
|
|
2
|
+
// A hub page's Customize sheet: every card the page has, in the
|
|
3
3
|
// person's order, each row with Up and Down buttons and a Show switch,
|
|
4
4
|
// and Reset at the foot. It edits a useWidgetLayout, which keeps the
|
|
5
5
|
// order (on this device by default) and which the page renders its cards
|
|
@@ -69,11 +69,11 @@ function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
|
69
69
|
ref.current?.focus();
|
|
70
70
|
}, [modifiers.focused]);
|
|
71
71
|
return (_jsx(Button
|
|
72
|
-
// Patched (ui-foundation
|
|
72
|
+
// Patched (ui-foundation): upstream makes this ref but never
|
|
73
73
|
// passes it, so the effect above focused nothing and the arrow keys
|
|
74
74
|
// moved react-day-picker's focused day without moving focus.
|
|
75
75
|
, {
|
|
76
|
-
// Patched (ui-foundation
|
|
76
|
+
// Patched (ui-foundation): upstream makes this ref but never
|
|
77
77
|
// passes it, so the effect above focused nothing and the arrow keys
|
|
78
78
|
// moved react-day-picker's focused day without moving focus.
|
|
79
79
|
ref: ref, variant: "ghost", size: "icon", "data-day": day.date.toLocaleDateString(locale?.code), "data-selected-single": modifiers.selected &&
|
|
@@ -18,7 +18,7 @@ declare function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Se
|
|
|
18
18
|
declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props): React.JSX.Element;
|
|
19
19
|
declare function ComboboxChip({ className, children, showRemove, removeLabel, ...props }: ComboboxPrimitive.Chip.Props & {
|
|
20
20
|
showRemove?: boolean;
|
|
21
|
-
/** The chip's words, naming its remove button ("Remove <words>") when its children aren't plain text (ui-foundation
|
|
21
|
+
/** The chip's words, naming its remove button ("Remove <words>") when its children aren't plain text (ui-foundation). */
|
|
22
22
|
removeLabel?: string;
|
|
23
23
|
}): React.JSX.Element;
|
|
24
24
|
declare function ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props): React.JSX.Element;
|
|
@@ -48,12 +48,12 @@ function ComboboxChips({ className, ...props }) {
|
|
|
48
48
|
}
|
|
49
49
|
function ComboboxChip({ className, children, showRemove = true, removeLabel, ...props }) {
|
|
50
50
|
return (_jsxs(ComboboxPrimitive.Chip, { "data-slot": "combobox-chip", className: cn("flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", className), ...props, children: [children, showRemove && (_jsx(ComboboxPrimitive.ChipRemove
|
|
51
|
-
// Patched (ui-foundation
|
|
51
|
+
// Patched (ui-foundation): upstream's icon-only remove
|
|
52
52
|
// button has no accessible name — a critical axe violation. Name
|
|
53
53
|
// it after the chip ("Remove fragile") when the chip is plain text.
|
|
54
54
|
, { "aria-label": removeLabel !== undefined ? `Remove ${removeLabel}` : typeof children === "string" ? `Remove ${children}` : "Remove", render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "-ml-1 opacity-50 hover:opacity-100", "data-slot": "combobox-chip-remove", children: _jsx(XIcon, { className: "pointer-events-none" }) }))] }));
|
|
55
55
|
}
|
|
56
|
-
// Patched (ui-foundation
|
|
56
|
+
// Patched (ui-foundation): upstream's input always keeps 4rem,
|
|
57
57
|
// so chips that fit on one line still pushed it onto an empty second one
|
|
58
58
|
// and the control stood twice as tall as a Select beside it. With chips
|
|
59
59
|
// in and no focus it takes only what's left of the chips' line (none, if
|
|
@@ -23,7 +23,7 @@ declare function Field({ className, orientation, size, solo, kind, ...props }: R
|
|
|
23
23
|
* A date or a number: two of a kind stay side by side on a phone.
|
|
24
24
|
* `choice`: two to a row, side by side on a phone while both fit.
|
|
25
25
|
* Found by itself for a date or number `<input>`, DateField (which
|
|
26
|
-
* marks itself
|
|
26
|
+
* marks itself) and ChoiceButtons; say it for a control of your own.
|
|
27
27
|
*/
|
|
28
28
|
kind?: FieldKind;
|
|
29
29
|
}): import("react").JSX.Element;
|
|
@@ -5,14 +5,14 @@ import { cn } from "cn";
|
|
|
5
5
|
import { Label } from "./label.js";
|
|
6
6
|
import { Separator } from "./separator.js";
|
|
7
7
|
import { fieldRows } from "../../lib/field-rows.js";
|
|
8
|
-
// The foundation's additions to shadcn's Field (
|
|
8
|
+
// The foundation's additions to shadcn's Field (the form standard):
|
|
9
9
|
//
|
|
10
10
|
// - FieldGroup lays its fields out itself: consecutive short fields
|
|
11
11
|
// (`<Field size="s" | "m" | "l">`) share a row, up to three, each as
|
|
12
12
|
// wide as its size; `<Field solo>` keeps a short one alone
|
|
13
13
|
// (lib/field-rows.ts has the rule). Below 48rem each takes its own row
|
|
14
|
-
// but two dates or two numbers. A choice (a Field holding ChoiceButtons
|
|
15
|
-
//
|
|
14
|
+
// but two dates or two numbers. A choice (a Field holding ChoiceButtons)
|
|
15
|
+
// shares a row only with another choice, and two choices stay side
|
|
16
16
|
// by side on a phone while both fit. The rows are worked out from the DOM, so
|
|
17
17
|
// a Field inside the app's own component still counts.
|
|
18
18
|
// - Compact: 14px between fields and 32px controls (40px under 48rem or
|
|
@@ -29,11 +29,11 @@ function FieldLegend({ className, variant = "legend", ...props }) {
|
|
|
29
29
|
}
|
|
30
30
|
// What a Field holds, when it doesn't say (`kind`): a date or a number
|
|
31
31
|
// box keeps its partner on a phone.
|
|
32
|
-
// DateField marks its own box (`data-kind="date"
|
|
32
|
+
// DateField marks its own box (`data-kind="date"`).
|
|
33
33
|
const DATE_CONTROL = "input[type=date], [data-kind=date]";
|
|
34
34
|
const NUMBER_CONTROL = "input[type=number], input[inputmode=numeric], input[inputmode=decimal]";
|
|
35
|
-
// A row of choice buttons (ChoiceButtons
|
|
36
|
-
// ToggleGroup that is the field's own control
|
|
35
|
+
// A row of choice buttons (ChoiceButtons): two to a row (9C). A
|
|
36
|
+
// ToggleGroup that is the field's own control is one too; one
|
|
37
37
|
// nested deeper (a RecurrenceField's weekdays) isn't.
|
|
38
38
|
const CHOICE_CONTROL = "[data-slot=choice-buttons], :scope > [data-slot=toggle-group]";
|
|
39
39
|
function kindOf(field) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cn } from "cn";
|
|
4
|
-
// `delay` (
|
|
4
|
+
// `delay` (the dialogs and feedback standard D7): nothing shows for
|
|
5
5
|
// the first 300ms, so a fast load just appears instead of flashing grey
|
|
6
6
|
// shapes; a slow one shows its shape after that. It keeps its room while
|
|
7
7
|
// it waits (invisible, not absent), so nothing moves when it shows.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// The app's toaster (
|
|
2
|
+
// The app's toaster (the dialogs and feedback standard D5).
|
|
3
3
|
//
|
|
4
4
|
// - Each icon in its tone's `*-text` shade (a green check, a red octagon,
|
|
5
5
|
// an amber triangle, a blue i), through `--toast-icon-*` (styles/
|
|
@@ -22,7 +22,7 @@ function TabsList({ className, variant = "default", ...props }) {
|
|
|
22
22
|
function TabsTrigger({ className, ...props }) {
|
|
23
23
|
return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/75 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:rounded-b-none group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-primary/12 dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-primary/12", "data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:group-data-[variant=default]/tabs-list:data-active:text-foreground",
|
|
24
24
|
// The line look (a page's sub-navigation, a record's tabs): the open
|
|
25
|
-
// tab stands out
|
|
25
|
+
// tab stands out: its name semibold in --primary-text (the
|
|
26
26
|
// primary where it's too faint for small text), a 3px primary line,
|
|
27
27
|
// and a primary tint behind it, as a picked ChoiceButtons option
|
|
28
28
|
// (bg-primary/12). A closed one is muted and medium weight. (A closed pill is the text
|
|
@@ -16,7 +16,7 @@ export declare function scrub(text: string, limit: number): string;
|
|
|
16
16
|
/** `/widgets/7/edit` with `{ id: '7' }` → `/widgets/:id/edit`; a splat → `*`. */
|
|
17
17
|
export declare function routePattern(pathname: string, params: Readonly<Record<string, string | undefined>>): string;
|
|
18
18
|
/**
|
|
19
|
-
* Whether an uncaught error can't be the app's
|
|
19
|
+
* Whether an uncaught error can't be the app's: `Script error.` with
|
|
20
20
|
* nothing else, or every frame of its stack (else the event's file) outside
|
|
21
21
|
* the app's scripts. An error with no location at all is kept: a thrown
|
|
22
22
|
* string may well be the app's.
|
|
@@ -84,7 +84,7 @@ function outsideAppScripts(url, page) {
|
|
|
84
84
|
return parsed.origin === origin && !SCRIPT_FILE.test(parsed.pathname);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* Whether an uncaught error can't be the app's
|
|
87
|
+
* Whether an uncaught error can't be the app's: `Script error.` with
|
|
88
88
|
* nothing else, or every frame of its stack (else the event's file) outside
|
|
89
89
|
* the app's scripts. An error with no location at all is kept: a thrown
|
|
90
90
|
* string may well be the app's.
|
|
@@ -9,7 +9,7 @@ export type TableView<F extends string, M extends string> = {
|
|
|
9
9
|
filters?: Partial<Record<F, string>>;
|
|
10
10
|
multiFilters?: Partial<Record<M, string[]>>;
|
|
11
11
|
/**
|
|
12
|
-
* The part of the view the filter bar has no control for
|
|
12
|
+
* The part of the view the filter bar has no control for: a
|
|
13
13
|
* computed rule the server applies, such as `{ overdue: 'true' }`. It's
|
|
14
14
|
* in the URL like a filter and counts toward the view being on, but the
|
|
15
15
|
* reader can't see or change it, so it lasts only while the view does:
|
|
@@ -43,7 +43,7 @@ export declare function paramsToUpdate(rendered: URLSearchParams, renderedPath:
|
|
|
43
43
|
export declare function viewToUrlChanges<F extends string, M extends string>(filterNames: readonly F[], multiFilterNames: readonly M[], view: TableView<F, M>, asDefault?: boolean): UrlChanges;
|
|
44
44
|
/**
|
|
45
45
|
* The query parameter that says "no view, no filters" on a list with a
|
|
46
|
-
* `defaultView
|
|
46
|
+
* `defaultView`: `?view=none`. Without it a list's plain address
|
|
47
47
|
* is its default view, so clearing the last filter by hand writes it, or
|
|
48
48
|
* the default view's filters would come straight back.
|
|
49
49
|
*/
|
|
@@ -34,7 +34,7 @@ export function paramsToUpdate(rendered, renderedPath, addressBar) {
|
|
|
34
34
|
// A view is "this combination and nothing else": every filter and the sort
|
|
35
35
|
// are set, and any the view doesn't name are cleared. Merging over the
|
|
36
36
|
// current state instead would let a leftover filter silently show something
|
|
37
|
-
// other than the view.
|
|
37
|
+
// other than the view.
|
|
38
38
|
//
|
|
39
39
|
// The view the list opens on (`asDefault`, useTableUrlState's
|
|
40
40
|
// `defaultView`) is written as no filters at all, so the list's plain
|
|
@@ -46,7 +46,7 @@ export function viewToUrlChanges(filterNames, multiFilterNames, view, asDefault
|
|
|
46
46
|
[NO_VIEW_PARAM]: null,
|
|
47
47
|
...Object.fromEntries(filterNames.map((name) => [name, own[name] ?? ''])),
|
|
48
48
|
...Object.fromEntries(multiFilterNames.map((name) => [name, asDefault ? [] : (view.multiFilters?.[name] ?? [])])),
|
|
49
|
-
// The default view's sort is its plain address's
|
|
49
|
+
// The default view's sort is its plain address's: not written.
|
|
50
50
|
sort: view.sort && !asDefault ? serializeSort(view.sort) : null,
|
|
51
51
|
...(view.group === undefined ? {} : { group: view.group || null }),
|
|
52
52
|
page: null,
|
|
@@ -58,7 +58,7 @@ function viewFilters(view) {
|
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* The query parameter that says "no view, no filters" on a list with a
|
|
61
|
-
* `defaultView
|
|
61
|
+
* `defaultView`: `?view=none`. Without it a list's plain address
|
|
62
62
|
* is its default view, so clearing the last filter by hand writes it, or
|
|
63
63
|
* the default view's filters would come straight back.
|
|
64
64
|
*/
|
|
@@ -89,7 +89,7 @@ export function readFilterState(params, filterNames, multiFilterNames, defaultVi
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
// The URL changes for the reader changing filters by hand (setFilter,
|
|
92
|
-
// setFilters, setMultiFilter)
|
|
92
|
+
// setFilters, setMultiFilter):
|
|
93
93
|
// - every filter they didn't touch keeps the value the bar shows, even at
|
|
94
94
|
// the plain address where those come from the default view, so their
|
|
95
95
|
// change is the only change;
|
|
@@ -120,8 +120,7 @@ export function filterChanges(state, changes, ruleNames, hasDefault) {
|
|
|
120
120
|
// nothing else", so adding or changing any filter returns the table to its
|
|
121
121
|
// default columns: a view's columns are chosen for the records its filters
|
|
122
122
|
// select, and would hide a field those other records fill. Sort and page
|
|
123
|
-
// don't change which records are shown, so they don't count.
|
|
124
|
-
// the developer on 2026-10-05.
|
|
123
|
+
// don't change which records are shown, so they don't count.
|
|
125
124
|
export function activeViewOf(views, filters, multiFilters) {
|
|
126
125
|
const sameItems = (a, b) => a.length === b.length && [...a].sort().every((item, index) => item === [...b].sort()[index]);
|
|
127
126
|
const matches = (view) => Object.keys(filters).every((name) => filters[name] === (viewFilters(view)[name] ?? '')) &&
|
package/dist/hooks/use-action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// One action's run, its pending state and its error, kept beside the
|
|
2
|
-
// button that started it (
|
|
2
|
+
// button that started it (the dialogs and feedback standard D6).
|
|
3
3
|
//
|
|
4
4
|
// const markRead = useAction(markReadMutation, { failed: "Couldn't mark The Long Walk as read" })
|
|
5
5
|
// <Button onClick={() => markRead.run(book.id)} disabled={markRead.pending}>…</Button>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
// `onError` or `onSettled`, not `mutate(change, { onSuccess })`: TanStack
|
|
45
45
|
// runs a `mutate()` callback only while the calling component is still
|
|
46
46
|
// mounted, so a popover closed mid-save would skip it. These run on the
|
|
47
|
-
// mutation, after the package's own cache work, either way
|
|
47
|
+
// mutation, after the package's own cache work, either way.
|
|
48
48
|
import { hashKey, useMutation, useQueryClient, } from '@tanstack/react-query';
|
|
49
49
|
import { toast } from 'sonner';
|
|
50
50
|
import { refusalReason } from '../lib/refusal.js';
|
|
@@ -24,7 +24,7 @@ export type TableUrlStateOptions = {
|
|
|
24
24
|
/** useTableUrlState's options, with the view the list opens on. */
|
|
25
25
|
export type TableUrlStateViewOptions<V extends string> = TableUrlStateOptions & {
|
|
26
26
|
/**
|
|
27
|
-
* The view the list opens on
|
|
27
|
+
* The view the list opens on: at the list's plain address its
|
|
28
28
|
* filters fill the bar and its pill is pressed. Write that view's whole
|
|
29
29
|
* meaning in its filters (`{ status: ['active', 'paused'] }`, not `{}`
|
|
30
30
|
* with the server's default doing the rest), so the bar shows it.
|
|
@@ -18,7 +18,7 @@ const DEFAULT_PAGE_SIZES = [25, 50, 100];
|
|
|
18
18
|
// counts as active); pass that view's `columns` to DataTable. A view is
|
|
19
19
|
// pressed with applyView().
|
|
20
20
|
//
|
|
21
|
-
// Views fill the filters
|
|
21
|
+
// Views fill the filters. A view's `filters` and `multiFilters` are
|
|
22
22
|
// what the bar's controls show while it's on, so the bar says why rows are
|
|
23
23
|
// hidden; write each view's whole meaning there. `defaultView` names the
|
|
24
24
|
// view the list opens on: at the list's plain address (no filter in the
|
|
@@ -59,7 +59,7 @@ export function useTableUrlState(filterNames, multiFilterNames = [], views = {},
|
|
|
59
59
|
const state = readFilterState(params, filterNames, multiFilterNames, fallback);
|
|
60
60
|
const { filters, multiFilters } = state;
|
|
61
61
|
// The URL's sort, else the default view's at the list's plain address
|
|
62
|
-
|
|
62
|
+
//: pressing the default view writes no `?sort=`, as it writes no
|
|
63
63
|
// filters, and its sort still holds.
|
|
64
64
|
const urlSort = params.get('sort');
|
|
65
65
|
const [sortField, sortDir] = (urlSort ?? '').split(':');
|