@bigpixelrocket/uiok 0.2.3 → 0.3.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/CHANGELOG.md +26 -1
- package/dist/charts/Sparkline.d.ts +20 -0
- package/dist/charts/Sparkline.js +12 -0
- package/dist/charts/Sparkline.logic.d.ts +9 -0
- package/dist/charts/Sparkline.logic.js +27 -0
- package/dist/charts/charts.css +17 -0
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +2 -0
- package/dist/dialog/ConfirmDialog.d.ts +11 -1
- package/dist/dialog/ConfirmDialog.js +3 -2
- package/dist/dialog/ModalDialog.d.ts +8 -0
- package/dist/dialog/ModalDialog.js +4 -2
- package/dist/dialog/ProgressDialog.d.ts +34 -0
- package/dist/dialog/ProgressDialog.js +40 -0
- package/dist/dialog/TypedNameDialog.d.ts +36 -0
- package/dist/dialog/TypedNameDialog.js +17 -0
- package/dist/dialog/index.d.ts +5 -2
- package/dist/dialog/index.js +4 -1
- package/dist/field/Switch.d.ts +26 -0
- package/dist/field/Switch.js +20 -0
- package/dist/field/index.d.ts +3 -2
- package/dist/field/index.js +3 -2
- package/dist/frame/AppRoot.d.ts +44 -0
- package/dist/frame/AppRoot.js +26 -0
- package/dist/frame/Dock.d.ts +88 -0
- package/dist/frame/Dock.js +129 -0
- package/dist/frame/FilterChips.d.ts +28 -0
- package/dist/frame/FilterChips.js +14 -0
- package/dist/frame/PageParts.d.ts +69 -0
- package/dist/frame/PageParts.js +60 -0
- package/dist/frame/PaneSplit.d.ts +74 -0
- package/dist/frame/PaneSplit.js +197 -0
- package/dist/frame/SidebarResizer.d.ts +35 -0
- package/dist/frame/SidebarResizer.js +43 -0
- package/dist/frame/StatusNotice.d.ts +20 -0
- package/dist/frame/StatusNotice.js +13 -0
- package/dist/frame/Tree.d.ts +140 -0
- package/dist/frame/Tree.js +141 -0
- package/dist/frame/TreeToggle.d.ts +18 -0
- package/dist/frame/TreeToggle.js +17 -0
- package/dist/frame/WindowFrame.d.ts +57 -0
- package/dist/frame/WindowFrame.js +19 -0
- package/dist/frame/frame.css +801 -0
- package/dist/frame/index.d.ts +22 -0
- package/dist/frame/index.js +22 -0
- package/dist/frame/sharedRef.d.ts +8 -0
- package/dist/frame/sharedRef.js +26 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/labels/UiokLabels.d.ts +3 -0
- package/dist/labels/UiokLabels.js +3 -1
- package/dist/labels/dialog.d.ts +12 -0
- package/dist/labels/dialog.js +7 -1
- package/dist/labels/index.d.ts +1 -0
- package/dist/labels/index.js +1 -0
- package/dist/labels/settings.d.ts +46 -0
- package/dist/labels/settings.js +29 -0
- package/dist/listing/EmptyState.d.ts +40 -0
- package/dist/listing/EmptyState.js +14 -0
- package/dist/listing/index.d.ts +3 -1
- package/dist/listing/index.js +3 -1
- package/dist/listing/listing.css +66 -2
- package/dist/log/LogWell.d.ts +34 -0
- package/dist/log/LogWell.js +39 -0
- package/dist/log/LogWell.logic.d.ts +16 -0
- package/dist/log/LogWell.logic.js +26 -0
- package/dist/log/index.d.ts +8 -0
- package/dist/log/index.js +8 -0
- package/dist/log/log.css +57 -0
- package/dist/pane/Pane.d.ts +49 -0
- package/dist/pane/Pane.js +17 -0
- package/dist/pane/PaneKeys.d.ts +10 -3
- package/dist/pane/PaneKeys.js +26 -7
- package/dist/pane/index.d.ts +4 -2
- package/dist/pane/index.js +4 -2
- package/dist/pane/usePaneKeys.js +9 -11
- package/dist/shell/AboutWindow.d.ts +21 -0
- package/dist/shell/AboutWindow.js +10 -0
- package/dist/shell/LanguageChoice.d.ts +27 -0
- package/dist/shell/LanguageChoice.js +17 -0
- package/dist/shell/LoadFailure.d.ts +22 -0
- package/dist/shell/LoadFailure.js +15 -0
- package/dist/shell/Lockup.d.ts +52 -0
- package/dist/shell/Lockup.js +30 -0
- package/dist/shell/SettingsDialog.d.ts +97 -0
- package/dist/shell/SettingsDialog.js +219 -0
- package/dist/shell/SettingsDialog.logic.d.ts +33 -0
- package/dist/shell/SettingsDialog.logic.js +42 -0
- package/dist/shell/SettingsFiles.d.ts +55 -0
- package/dist/shell/SettingsFiles.js +30 -0
- package/dist/shell/SettingsPageKeys.d.ts +42 -0
- package/dist/shell/SettingsPageKeys.js +70 -0
- package/dist/shell/SettingsSubsection.d.ts +34 -0
- package/dist/shell/SettingsSubsection.js +30 -0
- package/dist/shell/SignIn.d.ts +61 -0
- package/dist/shell/SignIn.js +36 -0
- package/dist/shell/ThemePicker.d.ts +74 -0
- package/dist/shell/ThemePicker.js +96 -0
- package/dist/shell/ThemePicker.logic.d.ts +13 -0
- package/dist/shell/ThemePicker.logic.js +26 -0
- package/dist/shell/TitleBar.d.ts +44 -0
- package/dist/shell/TitleBar.js +23 -0
- package/dist/shell/UpdatePill.d.ts +26 -0
- package/dist/shell/UpdatePill.js +17 -0
- package/dist/shell/Updates.d.ts +99 -0
- package/dist/shell/Updates.js +72 -0
- package/dist/shell/index.d.ts +27 -0
- package/dist/shell/index.js +27 -0
- package/dist/shell/shell.css +243 -4
- package/dist/styles.css +2 -0
- package/dist/themes/catalog.js +4 -0
- package/dist/themes/themes.generated.css +244 -0
- package/dist/themes/tokens.d.ts +17 -5
- package/dist/themes/tokens.js +64 -1
- package/dist/tokens.css +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.0] - 2026-11-23
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- The shell's components (`@bigpixelrocket/uiok/shell`, now an area with a module): `TitleBar`, `Lockup`, `BrandMark` (the family's plate, the app's glyph, and the check badge), `ChannelMarker`, `UpdatePill`, `AboutWindow`, `SettingsDialog` with `SettingsSubsection`, `SettingsSaveFailure`, page keys (`useSettingsPageKeys`, `settingsLegend`, `SettingsPageKeysContext`), and the scroll rules `spiedSubsection` and `subsectionScrollTop`, and the shared pages `AppearanceSettings` over `ThemeChoices` and `ThemePreview`, `LanguageChoice`, `UpdatesPage` with `UpdateChecks`, `UpdateCard`, and `UpdateNotes`, and `SettingsFiles`; the sign-in prompts `SignInDialog` and `HostKeyDialog`; `useSystemDark`, `appearanceInUse`, `steppedIndex`, `themesOf`.
|
|
14
|
+
- The window frame (`@bigpixelrocket/uiok/frame`, a new area), every part a component so an app draws its window with no class or element of its own: `AppRoot`, `SpacePanel`, `WindowFrame` (the title band, sidebar, main pane, tray, dock, and key legend in one grid, the space's listing root, with a `group` for a host's handlers and a band `trailing` part; a part given `false` draws no slot), `SidebarResizer` and `draggedWidth`; the sidebar tree's `TreePane`, `TreeList`, `TreeRow` (node, band, or group, following the pane's cursor), `TreeToggle`, `TreeTool`, `TreeFilterInput`, and `SidebarEmpty`; `FilterChips`, `PaneWarning`, `StatusNotice`; `Dock` (at the height its host keeps, its top edge dragging it, giving way to the main pane in a short window; `dockHeight`), `DockLog`, `DockLogEntry`, `DockInput`; `usePaneSplit`, `PaneSplitter`, `SplitDetail`, `cutRowDepth`, and `heldSplitHeight`; a page's `PageSlot`, `PanePage`, `Toolbar`, `ToolbarGrow`, `ToolbarGap`, `PageFilter`, `PageNote`, `EmptyAction`, `SectionHead`, `FootBar`, and `ShowSidebarButton`.
|
|
15
|
+
- `PaneBox` (with a `danger` tone) and `PaneList` (`@bigpixelrocket/uiok/pane`): a pane and its scrolling body, with `RegionHandlers`, the handlers a host hangs on a region.
|
|
16
|
+
- `EmptyState` (`@bigpixelrocket/uiok/listing`): a pane with nothing in it yet or one that could not load, with its glyph or mark, title, sentence, actions, note, detail, and numbered steps.
|
|
17
|
+
- `Switch` (`@bigpixelrocket/uiok/field`): the `.switch` look as a component, out of the Tab order in a listing row, a press never opening the row.
|
|
18
|
+
- `LoadFailure` (`@bigpixelrocket/uiok/shell`): the block a window shows in place of content that failed to load. A `SettingsPage` names its sidebar chip as `chip` (a string), drawn by the dialog.
|
|
19
|
+
- `ModalDialog` and `ConfirmDialog` take a `size` (`DialogSize`: `md`, `lg`, `xl`); `ConfirmDialog` takes an `alternative`, a second way on between leaving and confirming (Close Window and Keep Running).
|
|
20
|
+
- `LogWell` (`@bigpixelrocket/uiok/log`, a new area): a log in a well with each source's prefix in its own colour, a line's tone, and following the newest line; `logSourceIndexes`, `logSourceColour`, `logSourceWidth`.
|
|
21
|
+
- `Sparkline` and `sparklinePoints` (`@bigpixelrocket/uiok/charts`).
|
|
22
|
+
- `ProgressDialog` and `TypedNameDialog` (`@bigpixelrocket/uiok/dialog`).
|
|
23
|
+
- Theme tokens: the release channels (`--channel-latest`, `--channel-local`, their `-text`, `--channel-name`, `--channel-detail`, and `[data-channel]` blocks that set `--channel` and `--channel-text`), the brand mark (`--brand-white`, `--brand-plate`, `--brand-plate-dark`, `--brand-badge-dark`), and a log's sources (`--log-source-1` to `--log-source-6`).
|
|
24
|
+
- Scale tokens: `--font-weight-light`, `--font-weight-heavy`, `--shell-header-height`, `--traffic-light-inset`, `--sidebar-width`.
|
|
25
|
+
- The `settings` label group (`SettingsLabels`, `AppearanceLabels`, `AppearanceMode`, `DEFAULT_SETTINGS_LABELS`) and the `dialog` labels `ok`, `close`, `stop`, `tryAgain`, `runInBackground`, `typeName`.
|
|
26
|
+
- `shell.css`: the title bar (`shell-topbar`, `shell-brand`, `shell-lockup`, `shell-channel*`, `shell-trailing`), the lockup (sized by `Lockup`'s `size`) and brand mark (its glyph as `BrandMarkShape` data), the About window's drag regions and icon, `settings-restore`, `settings-count`, `settings-count-or-word`.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- `usePaneKeys` never reads a home, row, or verb inside a `hidden` element (a page held out of sight), and with no sidebar shown Tab walks the page alone instead of naming a sidebar that is not there.
|
|
31
|
+
- Breaking: uiok now defines `--channel`, `--channel-text`, `--channel-name`, `--channel-detail`, `--channel-latest`, `--channel-latest-text`, `--channel-local`, `--channel-local-text`, `--brand-white`, and `--brand-plate`, so `themeStylesheet` refuses an app token of those names. An app that wrote them as its own tokens drops them; the values are the same in every theme.
|
|
32
|
+
|
|
9
33
|
## [0.2.3] - 2026-11-22
|
|
10
34
|
|
|
11
35
|
### Added
|
|
@@ -200,7 +224,8 @@ The first published version. The package is published to npm as `@bigpixelrocket
|
|
|
200
224
|
- `lucide-react` 1.31 or later within 1.x is a peer dependency.
|
|
201
225
|
- Terminal (`@bigpixelrocket/uiok/terminal`, `docs/components/terminal.md`): `Terminal`, Ghostty's VT engine as WebAssembly drawn on a canvas, read-only without `onInput`, with a Copy and Paste menu whose chords come from `menuChords`, a visual bell, line-editing actions bound by `actionForKey`, and `TerminalScrollbackContext`. The package root does not export it, so an app without a terminal never loads its assets. Its words are the new `terminal` label group; the package now ships a `NOTICE` with the engine's, adapter's, and font's licences.
|
|
202
226
|
|
|
203
|
-
[Unreleased]: https://github.com/Bigpixelrocket/uiok/compare/v0.
|
|
227
|
+
[Unreleased]: https://github.com/Bigpixelrocket/uiok/compare/v0.3.0...HEAD
|
|
228
|
+
[0.3.0]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.3...v0.3.0
|
|
204
229
|
[0.2.3]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.2...v0.2.3
|
|
205
230
|
[0.2.2]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.1...v0.2.2
|
|
206
231
|
[0.2.1]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.0...v0.2.1
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/** Props for {@link Sparkline}. */
|
|
3
|
+
export interface SparklineProps {
|
|
4
|
+
/** The values, oldest first. */
|
|
5
|
+
readonly values: readonly number[];
|
|
6
|
+
/** What the line shows and its latest value in words ("CPU, 12% now"), its accessible name. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** Which chart series colour it wears (`seriesColour`); the first unless given. */
|
|
9
|
+
readonly series?: number;
|
|
10
|
+
/** Its size in pixels; 64 by 16 unless given, the height of a row's text. */
|
|
11
|
+
readonly width?: number;
|
|
12
|
+
readonly height?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A word-sized line of recent values beside a figure (a process's CPU over
|
|
16
|
+
* the last minutes): no axes, no grid, the line alone in a series colour,
|
|
17
|
+
* scaled to its own lowest and highest. It is an image named by `label`,
|
|
18
|
+
* which carries what a reader needs; the line only shows the trend.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Sparkline({ values, label, series, width, height }: SparklineProps): ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sparklinePoints } from './Sparkline.logic.js';
|
|
3
|
+
import { seriesColour } from './seriesColour.js';
|
|
4
|
+
/**
|
|
5
|
+
* A word-sized line of recent values beside a figure (a process's CPU over
|
|
6
|
+
* the last minutes): no axes, no grid, the line alone in a series colour,
|
|
7
|
+
* scaled to its own lowest and highest. It is an image named by `label`,
|
|
8
|
+
* which carries what a reader needs; the line only shows the trend.
|
|
9
|
+
*/
|
|
10
|
+
export function Sparkline({ values, label, series = 0, width = 64, height = 16 }) {
|
|
11
|
+
return (_jsx("svg", { "aria-label": label, className: "sparkline", height: height, role: "img", viewBox: `0 0 ${width} ${height}`, width: width, children: _jsx("polyline", { className: "sparkline-line", points: sparklinePoints(values, width, height), style: { stroke: seriesColour(series) } }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The points of a sparkline of `values` in a box `width` by `height`, as an
|
|
3
|
+
* SVG `points` list: evenly spaced from the left edge to the right, the
|
|
4
|
+
* smallest value at the foot and the largest at the head, each kept
|
|
5
|
+
* `inset` from the top and bottom edges so the stroke is never cut. A flat
|
|
6
|
+
* series runs through the middle; one value is a flat line across the box.
|
|
7
|
+
* Values that are not finite are left out. Empty for no value.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sparklinePoints(values: readonly number[], width: number, height: number, inset?: number): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The points of a sparkline of `values` in a box `width` by `height`, as an
|
|
3
|
+
* SVG `points` list: evenly spaced from the left edge to the right, the
|
|
4
|
+
* smallest value at the foot and the largest at the head, each kept
|
|
5
|
+
* `inset` from the top and bottom edges so the stroke is never cut. A flat
|
|
6
|
+
* series runs through the middle; one value is a flat line across the box.
|
|
7
|
+
* Values that are not finite are left out. Empty for no value.
|
|
8
|
+
*/
|
|
9
|
+
export function sparklinePoints(values, width, height, inset = 1) {
|
|
10
|
+
const finite = values.filter((value) => Number.isFinite(value));
|
|
11
|
+
if (finite.length === 0) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
const series = finite.length === 1 ? [finite[0], finite[0]] : finite;
|
|
15
|
+
const low = Math.min(...series);
|
|
16
|
+
const high = Math.max(...series);
|
|
17
|
+
const span = high - low;
|
|
18
|
+
const room = Math.max(0, height - 2 * inset);
|
|
19
|
+
const step = width / (series.length - 1);
|
|
20
|
+
const round = (value) => Math.round(value * 100) / 100;
|
|
21
|
+
return series
|
|
22
|
+
.map((value, index) => {
|
|
23
|
+
const y = span === 0 ? height / 2 : inset + room - ((value - low) / span) * room;
|
|
24
|
+
return `${round(index * step)},${round(y)}`;
|
|
25
|
+
})
|
|
26
|
+
.join(' ');
|
|
27
|
+
}
|
package/dist/charts/charts.css
CHANGED
|
@@ -455,3 +455,20 @@
|
|
|
455
455
|
.pie-hatch-stripe {
|
|
456
456
|
fill: var(--surface);
|
|
457
457
|
}
|
|
458
|
+
|
|
459
|
+
/* A sparkline (Sparkline): the line alone, in its series colour, its
|
|
460
|
+
stroke kept at one width however the box scales. */
|
|
461
|
+
.sparkline {
|
|
462
|
+
display: inline-block;
|
|
463
|
+
flex: none;
|
|
464
|
+
overflow: visible;
|
|
465
|
+
vertical-align: middle;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.sparkline-line {
|
|
469
|
+
fill: none;
|
|
470
|
+
stroke-width: 1.5;
|
|
471
|
+
stroke-linejoin: round;
|
|
472
|
+
stroke-linecap: round;
|
|
473
|
+
vector-effect: non-scaling-stroke;
|
|
474
|
+
}
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -14,3 +14,5 @@ export { RESULT_CHART_TYPES, STACKABLE_CHART_TYPES, type ChartSeries, type Resul
|
|
|
14
14
|
export type { ScatterAxis, ScatterAxisKind } from './Scatter.logic.js';
|
|
15
15
|
export { ScatterChart, type ScatterChartProps, type ScatterPoint } from './ScatterChart.js';
|
|
16
16
|
export { seriesColour } from './seriesColour.js';
|
|
17
|
+
export { Sparkline, type SparklineProps } from './Sparkline.js';
|
|
18
|
+
export { sparklinePoints } from './Sparkline.logic.js';
|
package/dist/charts/index.js
CHANGED
|
@@ -11,3 +11,5 @@ export { ResultChart } from './ResultChart.js';
|
|
|
11
11
|
export { RESULT_CHART_TYPES, STACKABLE_CHART_TYPES } from './ResultChart.logic.js';
|
|
12
12
|
export { ScatterChart } from './ScatterChart.js';
|
|
13
13
|
export { seriesColour } from './seriesColour.js';
|
|
14
|
+
export { Sparkline } from './Sparkline.js';
|
|
15
|
+
export { sparklinePoints } from './Sparkline.logic.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react';
|
|
2
2
|
import { type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
import type { LegendSecondary } from './DialogLegend.logic.js';
|
|
3
4
|
import { type DialogFact, type DialogItem, type DialogItemGroup, type DialogStatementsProps } from './DialogLists.js';
|
|
5
|
+
import { type DialogSize } from './ModalDialog.js';
|
|
4
6
|
/**
|
|
5
7
|
* A confirmation's tone: `danger` for a destructive action, `warning` for a
|
|
6
8
|
* question whose yes is the safe choice but still ends work, `primary` for
|
|
@@ -90,6 +92,14 @@ export interface ConfirmDialogProps {
|
|
|
90
92
|
readonly children?: ReactNode;
|
|
91
93
|
/** Extra class on the dialog box, for a body that needs its own width or layout. */
|
|
92
94
|
readonly className?: string;
|
|
95
|
+
/** Its width step (`ModalDialog`'s `size`); none keeps the confirmation's width. */
|
|
96
|
+
readonly size?: DialogSize;
|
|
97
|
+
/**
|
|
98
|
+
* A second way on between leaving and confirming, on its own chord
|
|
99
|
+
* (Close Window and Keep Running beside Quit): drawn in the legend after
|
|
100
|
+
* the leave verb.
|
|
101
|
+
*/
|
|
102
|
+
readonly alternative?: LegendSecondary;
|
|
93
103
|
/**
|
|
94
104
|
* True for a delete that cannot be undone (a volume with no Trash, a
|
|
95
105
|
* server, a database): the confirm verb stays at the right edge, lit, but
|
|
@@ -125,4 +135,4 @@ export interface ConfirmDialogProps {
|
|
|
125
135
|
* describe it. Styled by the `.confirm-dialog` rules in
|
|
126
136
|
* `@bigpixelrocket/uiok/styles.css`; reads the `dialog` labels.
|
|
127
137
|
*/
|
|
128
|
-
export declare function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone, items, itemIcon, itemCount, groups, statements, facts, paths, children, className, forGood, confirmDisabled, onConfirm, onCancel }: ConfirmDialogProps): ReactElement;
|
|
138
|
+
export declare function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone, items, itemIcon, itemCount, groups, statements, facts, paths, children, className, size, alternative, forGood, confirmDisabled, onConfirm, onCancel }: ConfirmDialogProps): ReactElement;
|
|
@@ -21,7 +21,7 @@ const DELETE_IMMEDIATELY = { key: 'Backspace', meta: true, alt: true };
|
|
|
21
21
|
* describe it. Styled by the `.confirm-dialog` rules in
|
|
22
22
|
* `@bigpixelrocket/uiok/styles.css`; reads the `dialog` labels.
|
|
23
23
|
*/
|
|
24
|
-
export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone = 'danger', items, itemIcon, itemCount, groups = [], statements, facts = [], paths, children, className, forGood = false, confirmDisabled = false, onConfirm, onCancel }) {
|
|
24
|
+
export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone = 'danger', items, itemIcon, itemCount, groups = [], statements, facts = [], paths, children, className, size, alternative, forGood = false, confirmDisabled = false, onConfirm, onCancel }) {
|
|
25
25
|
const labels = useLabels().dialog;
|
|
26
26
|
const labelId = useId();
|
|
27
27
|
const messageId = useId();
|
|
@@ -36,6 +36,7 @@ export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon,
|
|
|
36
36
|
const describedBy = described.length > 0 ? described.join(' ') : facts.length > 0 ? factsId : undefined;
|
|
37
37
|
const legend = {
|
|
38
38
|
leave: { label: cancelLabel ?? labels.cancel },
|
|
39
|
+
...(alternative === undefined ? {} : { secondary: [alternative] }),
|
|
39
40
|
primary: forGood
|
|
40
41
|
? {
|
|
41
42
|
label: confirmLabel,
|
|
@@ -47,7 +48,7 @@ export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon,
|
|
|
47
48
|
};
|
|
48
49
|
return (_jsxs(ModalDialog, { className: ['confirm-dialog', hasItems || hasStatements ? 'confirm-items' : null, className]
|
|
49
50
|
.filter(Boolean)
|
|
50
|
-
.join(' '), describedBy: describedBy, icon: icon, labelId: labelId, legend: legend, onCancel: onCancel, title: title, tone: tone === 'primary' ? 'accent' : tone, children: [hasMessage && (_jsx("p", { className: "dialog-message", id: messageId, children: message })), hasItems && (_jsxs("div", { className: "confirm-items-lists", id: itemsId, children: [list.length > 0 && _jsx(DialogItems, { count: itemCount, icon: itemIcon, items: list }), groups.map((group) => (_jsx(DialogItems, { count: group.count, icon: group.icon, items: group.items, label: group.label }, group.label)))] })), hasStatements && (_jsx(DialogStatements, { label: statements.label, lines: statements.lines, ...(statements.count === undefined ? {} : { count: statements.count }) })), facts.length > 0 && _jsx(DialogFacts, { facts: facts, id: factsId }), children] }));
|
|
51
|
+
.join(' '), describedBy: describedBy, icon: icon, labelId: labelId, legend: legend, onCancel: onCancel, size: size, title: title, tone: tone === 'primary' ? 'accent' : tone, children: [hasMessage && (_jsx("p", { className: "dialog-message", id: messageId, children: message })), hasItems && (_jsxs("div", { className: "confirm-items-lists", id: itemsId, children: [list.length > 0 && _jsx(DialogItems, { count: itemCount, icon: itemIcon, items: list }), groups.map((group) => (_jsx(DialogItems, { count: group.count, icon: group.icon, items: group.items, label: group.label }, group.label)))] })), hasStatements && (_jsx(DialogStatements, { label: statements.label, lines: statements.lines, ...(statements.count === undefined ? {} : { count: statements.count }) })), facts.length > 0 && _jsx(DialogFacts, { facts: facts, id: factsId }), children] }));
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
54
|
* A path as an item: its last part is the name, the folder that holds it
|
|
@@ -7,6 +7,12 @@ import { type DialogLegendModel } from './DialogLegend.logic.js';
|
|
|
7
7
|
* lights its primary in it), the warning colour for a warning question.
|
|
8
8
|
*/
|
|
9
9
|
export type DialogTone = 'accent' | 'danger' | 'warning';
|
|
10
|
+
/**
|
|
11
|
+
* A dialog's width step by what its body holds: `md` (480px) a form with a
|
|
12
|
+
* label column, `lg` (640px) two columns or a short list, `xl` (880px) a
|
|
13
|
+
* wide table or a log; none keeps the 360px of a question or a name field.
|
|
14
|
+
*/
|
|
15
|
+
export type DialogSize = 'md' | 'lg' | 'xl';
|
|
10
16
|
/**
|
|
11
17
|
* Keeps Tab inside `container`: Tab moves to its next control and Shift-Tab
|
|
12
18
|
* to its previous one, wrapping at either end, so keyboard focus cannot
|
|
@@ -38,6 +44,8 @@ export interface ModalDialogProps {
|
|
|
38
44
|
readonly describedBy?: string;
|
|
39
45
|
/** Extra class on the dialog box for dialog-specific layout (its width). */
|
|
40
46
|
readonly className?: string;
|
|
47
|
+
/** Its width step (`dialog-size-*`); none keeps the default width. */
|
|
48
|
+
readonly size?: DialogSize;
|
|
41
49
|
/** The verb's icon at the start of the title strip, drawn in the tone's colour. */
|
|
42
50
|
readonly icon?: LucideIcon;
|
|
43
51
|
/** The title strip's colour; `accent` unless given. */
|
|
@@ -104,7 +104,7 @@ export function ModalDialog({ container, ...frame }) {
|
|
|
104
104
|
return target === undefined ? (_jsx(DialogFrame, { ...frame })) : (createPortal(_jsx(DialogFrame, { ...frame }), target));
|
|
105
105
|
}
|
|
106
106
|
/** The dialog itself, wherever `ModalDialog` mounts it. */
|
|
107
|
-
function DialogFrame({ title, labelId, describedBy, className, icon: Icon, tone = 'accent', frosted = false, pinTop = false, legend, onCancel, onOutsidePress = onCancel, children }) {
|
|
107
|
+
function DialogFrame({ title, labelId, describedBy, className, size, icon: Icon, tone = 'accent', frosted = false, pinTop = false, legend, onCancel, onOutsidePress = onCancel, children }) {
|
|
108
108
|
const dialogRef = useRef(null);
|
|
109
109
|
const claimEnclosingFocus = useContext(NestedFocusContext);
|
|
110
110
|
// How many dialogs nested inside this one hold the focus; a count, since
|
|
@@ -156,7 +156,9 @@ function DialogFrame({ title, labelId, describedBy, className, icon: Icon, tone
|
|
|
156
156
|
containTab(event, dialogRef.current);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
return (_jsx("div", { className: frosted ? 'dialog-backdrop frosted' : 'dialog-backdrop', onMouseDown: onOutsidePress, children: _jsxs("div", { "aria-describedby": describedBy, "aria-labelledby": labelId, "aria-modal": "true", className:
|
|
159
|
+
return (_jsx("div", { className: frosted ? 'dialog-backdrop frosted' : 'dialog-backdrop', onMouseDown: onOutsidePress, children: _jsxs("div", { "aria-describedby": describedBy, "aria-labelledby": labelId, "aria-modal": "true", className: ['dialog', size === undefined ? null : `dialog-size-${size}`, className]
|
|
160
|
+
.filter(Boolean)
|
|
161
|
+
.join(' '), "data-pinned": pinned !== null || undefined, "data-tone": tone, onKeyDown: (event) => {
|
|
160
162
|
// React bubbles events through portals, so a dialog portalled from
|
|
161
163
|
// inside this one (a confirmation) must not cancel or trap here.
|
|
162
164
|
if (!event.currentTarget.contains(event.target)) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
import { type RunHeaderProps } from '../run/RunHeader.js';
|
|
4
|
+
/** Props for {@link ProgressDialog}. */
|
|
5
|
+
export interface ProgressDialogProps {
|
|
6
|
+
/** Names the page or the action ("Export", "Install PostgreSQL 18"). */
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly icon: LucideIcon;
|
|
9
|
+
/** The header: the run's state, its one-line headline, figure, bar, facts, and a failure's reason. */
|
|
10
|
+
readonly run: RunHeaderProps;
|
|
11
|
+
/** Stop was asked and the run has not settled yet: Stop dims and the headline is the caller's "Stopping…". */
|
|
12
|
+
readonly stopping?: boolean;
|
|
13
|
+
/** Ends the run; absent for a run that cannot stop. */
|
|
14
|
+
readonly onStop?: () => void;
|
|
15
|
+
/** Puts the dialog away while the run goes on; absent for a run nothing else can follow. */
|
|
16
|
+
readonly onBackground?: () => void;
|
|
17
|
+
/** OK, once the run settled; Cancel on a run that could not start. */
|
|
18
|
+
readonly onClose: () => void;
|
|
19
|
+
/** Starts the run again after it could not start (its file could not be read, say). */
|
|
20
|
+
readonly onTryAgain?: () => void;
|
|
21
|
+
/** What the body holds under the header: the run's lists, notes, or console. */
|
|
22
|
+
readonly children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The progress dialog of long work: `ModalDialog` at the medium size,
|
|
26
|
+
* opening its body with `RunHeader`, with the legend the run's state gives:
|
|
27
|
+
* while it runs, Escape is Stop (dimmed while stopping) and Return is Run in
|
|
28
|
+
* Background where the caller can follow the run elsewhere (`onBackground`);
|
|
29
|
+
* settled (done, stopped, failed), OK alone on Return and Escape; a run that
|
|
30
|
+
* could not start (`onTryAgain` with a failed run), Cancel and Try Again.
|
|
31
|
+
* The header's glyph and bar carry a failure; a press outside the box
|
|
32
|
+
* never stops the run. Verbs from `UiokLabels.dialog`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ProgressDialog({ title, icon, run, stopping, onStop, onBackground, onClose, onTryAgain, children }: ProgressDialogProps): ReactElement;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { useLabels } from '../labels/UiokProvider.js';
|
|
4
|
+
import { RunHeader } from '../run/RunHeader.js';
|
|
5
|
+
import { isSettledRun } from '../run/RunProgress.logic.js';
|
|
6
|
+
import { ModalDialog } from './ModalDialog.js';
|
|
7
|
+
/**
|
|
8
|
+
* The progress dialog of long work: `ModalDialog` at the medium size,
|
|
9
|
+
* opening its body with `RunHeader`, with the legend the run's state gives:
|
|
10
|
+
* while it runs, Escape is Stop (dimmed while stopping) and Return is Run in
|
|
11
|
+
* Background where the caller can follow the run elsewhere (`onBackground`);
|
|
12
|
+
* settled (done, stopped, failed), OK alone on Return and Escape; a run that
|
|
13
|
+
* could not start (`onTryAgain` with a failed run), Cancel and Try Again.
|
|
14
|
+
* The header's glyph and bar carry a failure; a press outside the box
|
|
15
|
+
* never stops the run. Verbs from `UiokLabels.dialog`.
|
|
16
|
+
*/
|
|
17
|
+
export function ProgressDialog({ title, icon, run, stopping = false, onStop, onBackground, onClose, onTryAgain, children }) {
|
|
18
|
+
const labels = useLabels().dialog;
|
|
19
|
+
const labelId = useId();
|
|
20
|
+
const settled = isSettledRun(run.state);
|
|
21
|
+
const couldNotStart = onTryAgain !== undefined && run.state === 'failed';
|
|
22
|
+
const legend = couldNotStart
|
|
23
|
+
? { leave: { label: labels.cancel }, primary: { label: labels.tryAgain, onRun: onTryAgain } }
|
|
24
|
+
: settled
|
|
25
|
+
? { primary: { label: labels.ok, onRun: onClose } }
|
|
26
|
+
: {
|
|
27
|
+
...(onStop === undefined ? {} : { leave: { label: labels.stop, disabled: stopping } }),
|
|
28
|
+
...(onBackground === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: {
|
|
31
|
+
primary: { label: labels.runInBackground, onRun: onBackground, disabled: stopping }
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs(ModalDialog, { className: "dialog-size-md", icon: icon, labelId: labelId, legend: legend, onCancel: () => {
|
|
35
|
+
if (settled || couldNotStart)
|
|
36
|
+
onClose();
|
|
37
|
+
else if (!stopping)
|
|
38
|
+
onStop?.();
|
|
39
|
+
}, onOutsidePress: () => undefined, title: title, children: [_jsx(RunHeader, { ...run }), children] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
import { type ConfirmDialogProps } from './ConfirmDialog.js';
|
|
4
|
+
import type { DialogFact, DialogItem } from './DialogLists.js';
|
|
5
|
+
/** Props for {@link TypedNameDialog}. */
|
|
6
|
+
export interface TypedNameDialogProps {
|
|
7
|
+
/** At most five words, Title Case ("Drop Table?"). */
|
|
8
|
+
readonly title: string;
|
|
9
|
+
/** What happens and that it cannot be undone. */
|
|
10
|
+
readonly message: ReactNode;
|
|
11
|
+
/** The verb ("Drop Table"). */
|
|
12
|
+
readonly confirmLabel: string;
|
|
13
|
+
readonly icon: LucideIcon;
|
|
14
|
+
/** The name to type, letter case included. */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** The field's label ("Table name"). */
|
|
17
|
+
readonly nameLabel: string;
|
|
18
|
+
readonly items?: readonly DialogItem[];
|
|
19
|
+
readonly itemIcon?: LucideIcon;
|
|
20
|
+
readonly itemCount?: number;
|
|
21
|
+
readonly statements?: ConfirmDialogProps['statements'];
|
|
22
|
+
/** Facts about the action (where it runs). */
|
|
23
|
+
readonly facts?: readonly DialogFact[];
|
|
24
|
+
/** What the body holds before the name field: a choice the confirmation carries, or the reasons it asks. */
|
|
25
|
+
readonly children?: ReactNode;
|
|
26
|
+
readonly onConfirm: () => void;
|
|
27
|
+
readonly onCancel: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The typed-name confirmation for work that cannot be undone where a slip
|
|
31
|
+
* costs most: `ConfirmDialog` in the for-good anatomy (the verb on ⌥⌘⌫,
|
|
32
|
+
* Return doing nothing), its verb off until the field under the lists holds
|
|
33
|
+
* `name` exactly, letter case included. The field's note comes from
|
|
34
|
+
* `UiokLabels.dialog.typeName`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function TypedNameDialog({ name, nameLabel, children, ...confirm }: TypedNameDialogProps): ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from 'react';
|
|
3
|
+
import { useLabels } from '../labels/UiokProvider.js';
|
|
4
|
+
import { ConfirmDialog } from './ConfirmDialog.js';
|
|
5
|
+
/**
|
|
6
|
+
* The typed-name confirmation for work that cannot be undone where a slip
|
|
7
|
+
* costs most: `ConfirmDialog` in the for-good anatomy (the verb on ⌥⌘⌫,
|
|
8
|
+
* Return doing nothing), its verb off until the field under the lists holds
|
|
9
|
+
* `name` exactly, letter case included. The field's note comes from
|
|
10
|
+
* `UiokLabels.dialog.typeName`.
|
|
11
|
+
*/
|
|
12
|
+
export function TypedNameDialog({ name, nameLabel, children, ...confirm }) {
|
|
13
|
+
const labels = useLabels().dialog;
|
|
14
|
+
const fieldId = useId();
|
|
15
|
+
const [typed, setTyped] = useState('');
|
|
16
|
+
return (_jsxs(ConfirmDialog, { ...confirm, confirmDisabled: typed !== name, forGood: true, tone: "danger", children: [children, _jsxs("div", { className: "field-grid", children: [_jsx("label", { className: "field-label", htmlFor: fieldId, children: nameLabel }), _jsxs("div", { className: "field-value", children: [_jsx("input", { autoComplete: "off", className: "field", id: fieldId, onChange: (event) => setTyped(event.target.value), placeholder: name, spellCheck: false, value: typed }), _jsx("p", { className: "field-note", children: labels.typeName })] })] })] }));
|
|
17
|
+
}
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
* the rules for which slot a key runs, the one `ConfirmDialog`, the compact
|
|
4
4
|
* lists a confirmation's body holds (`DialogItems` for what it acts on,
|
|
5
5
|
* `DialogStatements` for the statements it runs, `DialogFacts` for facts
|
|
6
|
-
* about the action),
|
|
6
|
+
* about the action), the `ProgressDialog` of long work, the
|
|
7
|
+
* `TypedNameDialog` for work a slip would cost most, and the
|
|
7
8
|
* `DialogLayer` a host mounts them into.
|
|
8
9
|
*/
|
|
9
10
|
export { ConfirmDialog, type ConfirmDialogProps, type ConfirmTone } from './ConfirmDialog.js';
|
|
10
11
|
export { DialogLayer, type DialogLayerProps } from './DialogLayer.js';
|
|
12
|
+
export { ProgressDialog, type ProgressDialogProps } from './ProgressDialog.js';
|
|
13
|
+
export { TypedNameDialog, type TypedNameDialogProps } from './TypedNameDialog.js';
|
|
11
14
|
export { DIALOG_ITEMS_SHOWN, DialogFacts, DialogItems, DialogStatements, shownItems, type DialogFact, type DialogFactsProps, type DialogItem, type DialogItemGroup, type DialogItemsProps, type DialogStatementsProps } from './DialogLists.js';
|
|
12
15
|
export { DialogLegend, type DialogLegendProps } from './DialogLegend.js';
|
|
13
16
|
export { filterLeaveLabel, legendKeyAction, legendSignature, type DialogLegendModel, type DialogLegendVerb, type LegendKeyAction, type LegendKeyStroke, type LegendPrimary, type LegendSecondary } from './DialogLegend.logic.js';
|
|
14
|
-
export { containTab, ModalDialog, type DialogTone, type ModalDialogProps } from './ModalDialog.js';
|
|
17
|
+
export { containTab, ModalDialog, type DialogSize, type DialogTone, type ModalDialogProps } from './ModalDialog.js';
|
package/dist/dialog/index.js
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
* the rules for which slot a key runs, the one `ConfirmDialog`, the compact
|
|
4
4
|
* lists a confirmation's body holds (`DialogItems` for what it acts on,
|
|
5
5
|
* `DialogStatements` for the statements it runs, `DialogFacts` for facts
|
|
6
|
-
* about the action),
|
|
6
|
+
* about the action), the `ProgressDialog` of long work, the
|
|
7
|
+
* `TypedNameDialog` for work a slip would cost most, and the
|
|
7
8
|
* `DialogLayer` a host mounts them into.
|
|
8
9
|
*/
|
|
9
10
|
export { ConfirmDialog } from './ConfirmDialog.js';
|
|
10
11
|
export { DialogLayer } from './DialogLayer.js';
|
|
12
|
+
export { ProgressDialog } from './ProgressDialog.js';
|
|
13
|
+
export { TypedNameDialog } from './TypedNameDialog.js';
|
|
11
14
|
export { DIALOG_ITEMS_SHOWN, DialogFacts, DialogItems, DialogStatements, shownItems } from './DialogLists.js';
|
|
12
15
|
export { DialogLegend } from './DialogLegend.js';
|
|
13
16
|
export { filterLeaveLabel, legendKeyAction, legendSignature } from './DialogLegend.logic.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { type ControlVerb } from '../pane/PaneActions.js';
|
|
3
|
+
/** Props for {@link Switch}. */
|
|
4
|
+
export interface SwitchProps {
|
|
5
|
+
/** Whether the thing it stands for is on. */
|
|
6
|
+
readonly checked: boolean;
|
|
7
|
+
/** Hears the state a press asks for. */
|
|
8
|
+
readonly onChange: (checked: boolean) => void;
|
|
9
|
+
/** Its words ("Sharing"), beside it, or its accessible name alone with `labelHidden`. */
|
|
10
|
+
readonly label: string;
|
|
11
|
+
/** Speaks the label without drawing it: a switch in a row whose name says what it turns on. */
|
|
12
|
+
readonly labelHidden?: boolean;
|
|
13
|
+
readonly disabled?: boolean;
|
|
14
|
+
/** The verb the row's keys run it for (`data-verb`), as a row's other controls carry. */
|
|
15
|
+
readonly verb?: ControlVerb;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A switch for a running thing turned on or off at once (a service,
|
|
19
|
+
* sharing), in the shared `.switch` look on a native checkbox with
|
|
20
|
+
* `role="switch"`; a setting is a check, not a switch. With its label drawn
|
|
21
|
+
* it stands in a `field-choice` label, the whole label its target. In a
|
|
22
|
+
* listing row it leaves the Tab order, as a row's other controls do, since
|
|
23
|
+
* the cursor row's keys run it, and a press toggles it without opening the
|
|
24
|
+
* row.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Switch({ checked, onChange, label, labelHidden, disabled, verb }: SwitchProps): ReactElement;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useInRow } from '../pane/PaneActions.js';
|
|
3
|
+
/** A press on the switch or its words toggles it alone, never also opening the row it stands in. */
|
|
4
|
+
const keepToSelf = (event) => event.stopPropagation();
|
|
5
|
+
/**
|
|
6
|
+
* A switch for a running thing turned on or off at once (a service,
|
|
7
|
+
* sharing), in the shared `.switch` look on a native checkbox with
|
|
8
|
+
* `role="switch"`; a setting is a check, not a switch. With its label drawn
|
|
9
|
+
* it stands in a `field-choice` label, the whole label its target. In a
|
|
10
|
+
* listing row it leaves the Tab order, as a row's other controls do, since
|
|
11
|
+
* the cursor row's keys run it, and a press toggles it without opening the
|
|
12
|
+
* row.
|
|
13
|
+
*/
|
|
14
|
+
export function Switch({ checked, onChange, label, labelHidden = false, disabled = false, verb }) {
|
|
15
|
+
const inRow = useInRow();
|
|
16
|
+
const control = (_jsx("input", { "aria-label": labelHidden ? label : undefined, checked: checked, className: "switch", "data-verb": verb, disabled: disabled, onChange: (event) => onChange(event.currentTarget.checked), onClick: keepToSelf, role: "switch", tabIndex: inRow ? -1 : undefined, type: "checkbox" }));
|
|
17
|
+
if (labelHidden)
|
|
18
|
+
return control;
|
|
19
|
+
return (_jsxs("label", { className: "field-choice", onClick: keepToSelf, children: [control, label] }));
|
|
20
|
+
}
|
package/dist/field/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `.field`, `.check`, `.switch`, `.field-label`, `.field-note`,
|
|
4
4
|
* `.field-problem`, `.field-group`, `.field-choice`, `.field-grid`), so most
|
|
5
5
|
* forms need no component; `Check` adds the mixed state a checkbox can only
|
|
6
|
-
* reach from script,
|
|
7
|
-
* tooltip.
|
|
6
|
+
* reach from script, `Switch` turns a running thing on or off, and
|
|
7
|
+
* `labelHelp` puts a control's help in its label's tooltip.
|
|
8
8
|
*/
|
|
9
9
|
export { Check, type CheckProps } from './Check.js';
|
|
10
10
|
export { labelHelp, type LabelHelp } from './labelHelp.js';
|
|
11
|
+
export { Switch, type SwitchProps } from './Switch.js';
|
package/dist/field/index.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `.field`, `.check`, `.switch`, `.field-label`, `.field-note`,
|
|
4
4
|
* `.field-problem`, `.field-group`, `.field-choice`, `.field-grid`), so most
|
|
5
5
|
* forms need no component; `Check` adds the mixed state a checkbox can only
|
|
6
|
-
* reach from script,
|
|
7
|
-
* tooltip.
|
|
6
|
+
* reach from script, `Switch` turns a running thing on or off, and
|
|
7
|
+
* `labelHelp` puts a control's help in its label's tooltip.
|
|
8
8
|
*/
|
|
9
9
|
export { Check } from './Check.js';
|
|
10
10
|
export { labelHelp } from './labelHelp.js';
|
|
11
|
+
export { Switch } from './Switch.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { RegionHandlers } from '../pane/Pane.js';
|
|
3
|
+
/** Props for {@link AppRoot}. */
|
|
4
|
+
export interface AppRootProps {
|
|
5
|
+
/**
|
|
6
|
+
* The release channel the window wears (`data-channel`), which colours
|
|
7
|
+
* its `ChannelMarker` and channel tags; none on the release.
|
|
8
|
+
*/
|
|
9
|
+
readonly channel?: string | null;
|
|
10
|
+
/** The window's content: a `SpacePanel`, or the frame itself. */
|
|
11
|
+
readonly children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The app window's root: one column the window's height holding its
|
|
15
|
+
* content, which owns the whole window, its top band included. A window
|
|
16
|
+
* that wears it sets the interface face and the body's ground and text, and
|
|
17
|
+
* keeps every dialog clear of its top band (`--dialog-inset-top`).
|
|
18
|
+
*/
|
|
19
|
+
export declare function AppRoot({ channel, children }: AppRootProps): ReactElement;
|
|
20
|
+
/** Props for {@link SpacePanel}. */
|
|
21
|
+
export interface SpacePanelProps extends RegionHandlers {
|
|
22
|
+
readonly ref?: Ref<HTMLDivElement>;
|
|
23
|
+
/** The space's frame (`WindowFrame`). */
|
|
24
|
+
readonly children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The panel the content's keyboard commands work in, inside `AppRoot`: a
|
|
28
|
+
* focus boundary the host's key handlers hang on, focusable by script and
|
|
29
|
+
* out of the Tab order, never a control, so it draws no ring.
|
|
30
|
+
*/
|
|
31
|
+
export declare function SpacePanel({ ref, children, ...handlers }: SpacePanelProps): ReactElement;
|
|
32
|
+
/** Props for {@link PageSlot}. */
|
|
33
|
+
export interface PageSlotProps {
|
|
34
|
+
/** The page is the front tab's; false keeps it mounted out of sight. */
|
|
35
|
+
readonly shown: boolean;
|
|
36
|
+
/** The page (`PanePage`). */
|
|
37
|
+
readonly children: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One page of the main pane: the front tab's page lays out as the pane's
|
|
41
|
+
* own child, and a held page (a background tab with unsaved changes) stays
|
|
42
|
+
* mounted and hidden, so it keeps its state.
|
|
43
|
+
*/
|
|
44
|
+
export declare function PageSlot({ shown, children }: PageSlotProps): ReactElement;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The app window's root: one column the window's height holding its
|
|
4
|
+
* content, which owns the whole window, its top band included. A window
|
|
5
|
+
* that wears it sets the interface face and the body's ground and text, and
|
|
6
|
+
* keeps every dialog clear of its top band (`--dialog-inset-top`).
|
|
7
|
+
*/
|
|
8
|
+
export function AppRoot({ channel = null, children }) {
|
|
9
|
+
return (_jsx("div", { className: "app-shell", "data-channel": channel ?? undefined, children: _jsx("main", { className: "shell-content", children: children }) }));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The panel the content's keyboard commands work in, inside `AppRoot`: a
|
|
13
|
+
* focus boundary the host's key handlers hang on, focusable by script and
|
|
14
|
+
* out of the Tab order, never a control, so it draws no ring.
|
|
15
|
+
*/
|
|
16
|
+
export function SpacePanel({ ref, children, ...handlers }) {
|
|
17
|
+
return (_jsx("div", { className: "space-panel", ref: ref, tabIndex: -1, ...handlers, children: children }));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One page of the main pane: the front tab's page lays out as the pane's
|
|
21
|
+
* own child, and a held page (a background tab with unsaved changes) stays
|
|
22
|
+
* mounted and hidden, so it keeps its state.
|
|
23
|
+
*/
|
|
24
|
+
export function PageSlot({ shown, children }) {
|
|
25
|
+
return (_jsx("div", { className: "page-slot", hidden: !shown, children: children }));
|
|
26
|
+
}
|