@tristan2828/ui-foundation 4.136.1 → 4.137.0
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/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 +293 -515
- 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 +3 -3
- 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 +1 -1
- 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/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 +3 -3
- 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 +1 -1
- package/styles/index.css +3 -3
- package/styles/theme.css +14 -20
- package/vite/pwa.js +1 -1
|
@@ -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(':');
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ export { LineChart, type LineChartMark, type LineChartPoint, type LineChartProps
|
|
|
97
97
|
export { MultiLineChart, type ChartSeries, type ChartTone, type MultiLineChartProps, } from './components/app/multi-line-chart.js';
|
|
98
98
|
export { StackedAreaChart, type StackedAreaChartProps, type StackedSeries, } from './components/app/stacked-area-chart.js';
|
|
99
99
|
export type { StackedLayout } from './lib/line-chart-layout.js';
|
|
100
|
+
export { MonthCalendar, type MonthCalendarItem, type MonthCalendarProps, type MonthCalendarTone, } from './components/app/month-calendar.js';
|
|
100
101
|
export { StepBar, type StepBarProps } from './components/app/step-bar.js';
|
|
101
102
|
export { RatingStar, type RatingStarProps, type RatingStarValue } from './components/app/rating-star.js';
|
|
102
103
|
export { RatingScore, type RatingScoreGlyph, type RatingScoreProps } from './components/app/rating-score.js';
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { KeyStats } from './components/app/key-stats.js';
|
|
|
31
31
|
export { ActionHint } from './components/app/action-hint.js';
|
|
32
32
|
export { StatusMark } from './components/app/status-mark.js';
|
|
33
33
|
export { STATUS_KINDS, STATUS_KIND_ICONS, STATUS_KIND_LABELS, STATUS_KIND_TONES, } from './lib/status-kinds.js';
|
|
34
|
-
// The record's empty value
|
|
34
|
+
// The record's empty value: a muted dash read as "Not set", for an
|
|
35
35
|
// app's own strips, summary lines and cells.
|
|
36
36
|
export { EmptyText } from './components/app/empty-value.js';
|
|
37
37
|
export { isEmptyValue } from './lib/empty-value.js';
|
|
@@ -43,7 +43,7 @@ export { usePrinting } from './components/app/print-context.js';
|
|
|
43
43
|
export { RecordDialogRoute, RecordLink, } from './components/app/record-dialog.js';
|
|
44
44
|
export { recordDialogState, useNewRecordDialog, useOpenRecord, useRecordDialog, } from './components/app/record-dialog-context.js';
|
|
45
45
|
export { FormDialog } from './components/app/form-dialog.js';
|
|
46
|
-
// The dialogs and feedback standard
|
|
46
|
+
// The dialogs and feedback standard: one delete, toasts' words, an
|
|
47
47
|
// action's error beside it, a job's progress, and the offline bar.
|
|
48
48
|
export { DeleteAction } from './components/app/delete-action.js';
|
|
49
49
|
export { notify, doneMessage, pastTense } from './components/app/notify.js';
|
|
@@ -107,6 +107,7 @@ export { ProgressRing } from './components/app/progress-ring.js';
|
|
|
107
107
|
export { LineChart, } from './components/app/line-chart.js';
|
|
108
108
|
export { MultiLineChart, } from './components/app/multi-line-chart.js';
|
|
109
109
|
export { StackedAreaChart, } from './components/app/stacked-area-chart.js';
|
|
110
|
+
export { MonthCalendar, } from './components/app/month-calendar.js';
|
|
110
111
|
export { StepBar } from './components/app/step-bar.js';
|
|
111
112
|
export { RatingStar } from './components/app/rating-star.js';
|
|
112
113
|
export { RatingScore } from './components/app/rating-score.js';
|
package/dist/lib/audio-cues.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// here is a no-op where the browser can't make the sound
|
|
9
9
|
// (docs/foundation/timed-screens.md "Sound").
|
|
10
10
|
//
|
|
11
|
-
// A chime can be booked ahead (`at
|
|
11
|
+
// A chime can be booked ahead (`at`): it's scheduled on the Web
|
|
12
12
|
// Audio clock, so it strikes on time in a background tab, whose timers
|
|
13
13
|
// and frames the browser slows or stops. cancelCues() takes back every
|
|
14
14
|
// booked strike that hasn't sounded yet (on pause, skip or leaving), so a
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// speaking, a call, the lock screen) and booked strikes go silent or late.
|
|
19
19
|
// The context is resumed as soon as it stops, and once it runs again every
|
|
20
20
|
// booking is taken back and onCuesRecovered() callbacks fire, so the screen
|
|
21
|
-
// rebooks from where its run is now
|
|
21
|
+
// rebooks from where its run is now. cuesInSync() catches the case
|
|
22
22
|
// where no statechange came, by comparing the audio clock with Date.now().
|
|
23
23
|
//
|
|
24
24
|
// createAudioCues takes the browser's APIs, so the rules are unit tested
|
package/dist/lib/connection.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Whether the app can reach its server (
|
|
1
|
+
// Whether the app can reach its server (the dialogs and feedback
|
|
2
2
|
// standard D9): what OfflineNotice reads. Offline when the browser says so
|
|
3
3
|
// (`navigator.onLine`, its `offline` event) or when a request couldn't get
|
|
4
4
|
// an answer at all (safeFetch's network failure); online again when the
|
package/dist/lib/date-filter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// A list's date filter
|
|
1
|
+
// A list's date filter: FilterDate's value, as one string, so it
|
|
2
2
|
// lives in the URL like any single-value filter (useTableUrlState) and a
|
|
3
3
|
// saved view can set it (`filters: { due: 'before-today' }`). It's either
|
|
4
4
|
// a preset, read against today when the list loads, or a range of plain
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// EntityView's tabs
|
|
1
|
+
// EntityView's tabs: the selected tab is `?tab=<slug>`, so a
|
|
2
2
|
// screen can link straight to one (`/things/3?tab=${entityViewTabSlug('Used in')}`).
|
|
3
3
|
/** A tab's name as it reads in the address: "Used in" is `used-in`. */
|
|
4
4
|
export function entityViewTabSlug(name) {
|
package/dist/lib/field-rows.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Which fields of a form share a row (
|
|
1
|
+
// Which fields of a form share a row (the form standard's F1),
|
|
2
2
|
// worked out from their order, never listed by hand. A field says how
|
|
3
3
|
// much it holds (`Field size`); consecutive short ones share a row, up to
|
|
4
4
|
// three, each as wide as its size: s 1, m 1.4, l 2.6 parts of the row.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// numbers next to each other in a row, which stay side by side
|
|
13
13
|
// (`phonePair`).
|
|
14
14
|
//
|
|
15
|
-
// A choice (
|
|
15
|
+
// A choice (record standard 9C: a Field holding ChoiceButtons, found
|
|
16
16
|
// by itself) shares its row only with another choice, two to a row, so a
|
|
17
17
|
// group of buttons has room to stay joined: three choices are two on a row
|
|
18
18
|
// and the third on the next, and a choice beside a date starts a row of
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* How many problems react-hook-form's `formState.errors` hold: one per
|
|
3
|
-
* field, one per list's own (`root`), however deep (
|
|
3
|
+
* field, one per list's own (`root`), however deep (EntityForm's
|
|
4
4
|
* "N to fix").
|
|
5
5
|
*/
|
|
6
6
|
export declare function countFormErrors(errors: unknown): number;
|
package/dist/lib/form-errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* How many problems react-hook-form's `formState.errors` hold: one per
|
|
3
|
-
* field, one per list's own (`root`), however deep (
|
|
3
|
+
* field, one per list's own (`root`), however deep (EntityForm's
|
|
4
4
|
* "N to fix").
|
|
5
5
|
*/
|
|
6
6
|
export function countFormErrors(errors) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Keeps a page's audio going with the phone locked
|
|
1
|
+
// Keeps a page's audio going with the phone locked. iOS pauses a
|
|
2
2
|
// page's sound on the lock screen unless the page is playing media, so
|
|
3
3
|
// keepAudioAlive() plays a silent looped track, which also puts the page's
|
|
4
4
|
// title and a Pause and Play on the lock screen (the Media Session). It's
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Where LineChart's points, target and mark go
|
|
2
|
-
// rules are unit tested on their own (tests/line-chart
|
|
1
|
+
// Where LineChart's points, target and mark go, React-free so the
|
|
2
|
+
// rules are unit tested on their own (tests/line-chart.test.tsx).
|
|
3
3
|
// Positions are fractions of the plot, 0…1, x from the left and y from
|
|
4
4
|
// the top, so the chart fills whatever width it's given.
|
|
5
5
|
// A point's position along x: a number as it is, a day or a timestamp as
|
|
@@ -10,7 +10,7 @@ function along(x) {
|
|
|
10
10
|
// Room above and below the values, as a share of their range, so the line
|
|
11
11
|
// never runs along the plot's edge.
|
|
12
12
|
const PAD = 0.1;
|
|
13
|
-
// `levels
|
|
13
|
+
// `levels`: the count of named steps a value is one of (a
|
|
14
14
|
// confidence, Very low to High), each value its step's index. The range is
|
|
15
15
|
// then every step, whatever the values, so a move from one step to the
|
|
16
16
|
// next looks as big as it is, not the plot's whole height.
|
|
@@ -30,7 +30,6 @@ function plain(node) {
|
|
|
30
30
|
return (node.children ?? []).map(plain).join('');
|
|
31
31
|
}
|
|
32
32
|
const hasWords = (nodes) => nodes.some((node) => plain(node).trim() !== '');
|
|
33
|
-
// Parts joined with a separator, leaving out the empty ones.
|
|
34
33
|
function join(parts, separator) {
|
|
35
34
|
const out = [];
|
|
36
35
|
for (const part of parts.filter(hasWords)) {
|
|
@@ -186,7 +185,6 @@ function blocks(nodes) {
|
|
|
186
185
|
flush();
|
|
187
186
|
return trim(out);
|
|
188
187
|
}
|
|
189
|
-
// No space at either end of the line.
|
|
190
188
|
function trim(nodes) {
|
|
191
189
|
const out = [...nodes];
|
|
192
190
|
if (out[0]?.type === 'text')
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// padded, marks it nested differently) and that `meaning` still misses is
|
|
22
22
|
// written as the editor shows it, as long as nothing in it is lost
|
|
23
23
|
// (`content`): no text, address or image. A block the editor drops part
|
|
24
|
-
// of (
|
|
24
|
+
// of (an image, say) is kept as written, and the guard refuses.
|
|
25
25
|
// - Guard: the result must mean exactly what the editor shows. If it
|
|
26
26
|
// wouldn't (two blocks fusing, say), the merge throws instead of saving
|
|
27
27
|
// something else; the draft stays on screen.
|
|
@@ -179,7 +179,7 @@ function uses(node, references = new Set(), urls = new Set()) {
|
|
|
179
179
|
}
|
|
180
180
|
// The blocks of the texts merged lately, by text: an editor merges the
|
|
181
181
|
// same original and baseline against each edit, so each is parsed once
|
|
182
|
-
// per mount, not once per merge
|
|
182
|
+
// per mount, not once per merge. A few, most recent last.
|
|
183
183
|
const PARSED = 8;
|
|
184
184
|
const parsed = new Map();
|
|
185
185
|
function blocks(markdown) {
|