@bigpixelrocket/uiok 0.4.0 → 0.6.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 +63 -1
- package/dist/button/TextLink.d.ts +26 -3
- package/dist/button/TextLink.js +5 -3
- package/dist/button/button.css +7 -0
- package/dist/dialog/ModalDialog.js +8 -2
- package/dist/dialog/SectionedDialog.d.ts +37 -0
- package/dist/dialog/SectionedDialog.js +157 -0
- package/dist/dialog/dialog.css +102 -0
- package/dist/dialog/index.d.ts +4 -2
- package/dist/dialog/index.js +4 -2
- package/dist/frame/AppRoot.d.ts +1 -1
- package/dist/frame/AppRoot.js +2 -1
- package/dist/frame/Dock.d.ts +1 -1
- package/dist/frame/Dock.js +2 -1
- package/dist/frame/FilterChips.d.ts +5 -2
- package/dist/frame/FilterChips.js +35 -2
- package/dist/frame/FilterChips.logic.d.ts +24 -0
- package/dist/frame/FilterChips.logic.js +34 -0
- package/dist/frame/PageParts.d.ts +4 -3
- package/dist/frame/PageParts.js +10 -3
- package/dist/frame/SideBySide.d.ts +32 -0
- package/dist/frame/SideBySide.js +50 -0
- package/dist/frame/Tree.d.ts +9 -3
- package/dist/frame/Tree.js +8 -5
- package/dist/frame/WindowFrame.d.ts +1 -1
- package/dist/frame/WindowFrame.js +3 -1
- package/dist/frame/frame.css +74 -5
- package/dist/frame/index.d.ts +4 -2
- package/dist/frame/index.js +4 -2
- package/dist/grid/grid.css +1 -0
- package/dist/icon/ProductMark.d.ts +57 -0
- package/dist/icon/ProductMark.js +26 -0
- package/dist/icon/icon.css +53 -0
- package/dist/icon/index.d.ts +3 -1
- package/dist/icon/index.js +3 -1
- package/dist/keyboard/Keyboard.logic.js +20 -3
- package/dist/keychord/KeyChord.d.ts +17 -1
- package/dist/keychord/KeyChord.js +16 -1
- package/dist/keychord/ShortcutIndex.d.ts +49 -0
- package/dist/keychord/ShortcutIndex.js +28 -0
- package/dist/keychord/index.d.ts +8 -2
- package/dist/keychord/index.js +8 -2
- package/dist/keychord/keychord.css +101 -0
- package/dist/labels/dialog.d.ts +2 -0
- package/dist/labels/dialog.js +2 -1
- package/dist/labels/keys.d.ts +5 -0
- package/dist/labels/keys.js +2 -1
- package/dist/labels/settings.d.ts +6 -0
- package/dist/labels/settings.js +1 -0
- package/dist/listing/Listing.d.ts +95 -7
- package/dist/listing/Listing.js +57 -13
- package/dist/listing/ListingScope.d.ts +7 -0
- package/dist/listing/ListingScope.js +8 -0
- package/dist/listing/PaneMessage.d.ts +7 -4
- package/dist/listing/PaneMessage.js +11 -4
- package/dist/listing/Timeline.d.ts +51 -0
- package/dist/listing/Timeline.js +28 -0
- package/dist/listing/index.d.ts +4 -2
- package/dist/listing/index.js +3 -1
- package/dist/listing/listing.css +268 -25
- package/dist/log/Ansi.logic.d.ts +27 -0
- package/dist/log/Ansi.logic.js +203 -0
- package/dist/log/LogWell.d.ts +11 -2
- package/dist/log/LogWell.js +15 -3
- package/dist/log/index.d.ts +1 -0
- package/dist/log/index.js +1 -0
- package/dist/log/log.css +80 -0
- package/dist/menu/Menu.d.ts +133 -0
- package/dist/menu/Menu.js +351 -0
- package/dist/menu/Menu.logic.d.ts +83 -0
- package/dist/menu/Menu.logic.js +92 -0
- package/dist/menu/index.d.ts +6 -1
- package/dist/menu/index.js +6 -1
- package/dist/menu/menu.css +57 -0
- package/dist/palette/Palette.d.ts +3 -2
- package/dist/palette/Palette.js +8 -4
- package/dist/palette/PaletteRows.d.ts +138 -0
- package/dist/palette/PaletteRows.js +76 -0
- package/dist/palette/index.d.ts +5 -2
- package/dist/palette/index.js +5 -2
- package/dist/pane/Pane.d.ts +42 -6
- package/dist/pane/Pane.js +92 -5
- package/dist/pane/PaneFrame.d.ts +22 -1
- package/dist/pane/PaneFrame.js +42 -5
- package/dist/pane/PaneKeys.d.ts +5 -1
- package/dist/pane/PaneKeys.js +28 -3
- package/dist/pane/PaneKeys.logic.d.ts +25 -0
- package/dist/pane/PaneKeys.logic.js +30 -0
- package/dist/pane/index.d.ts +2 -2
- package/dist/pane/index.js +1 -1
- package/dist/pane/usePaneKeys.d.ts +8 -1
- package/dist/pane/usePaneKeys.js +32 -12
- package/dist/shell/SettingsDialog.d.ts +20 -2
- package/dist/shell/SettingsDialog.js +13 -3
- package/dist/shell/index.d.ts +1 -1
- package/dist/styles.css +18 -3
- package/dist/surface/FactList.d.ts +54 -0
- package/dist/surface/FactList.js +33 -0
- package/dist/surface/FactTable.d.ts +44 -0
- package/dist/surface/FactTable.js +33 -0
- package/dist/surface/index.d.ts +7 -2
- package/dist/surface/index.js +7 -2
- package/dist/surface/surface.css +139 -2
- package/dist/tabs/PageTabs.d.ts +6 -0
- package/dist/tabs/PageTabs.js +1 -1
- package/dist/tabs/tabs.css +14 -0
- package/dist/terminal/TerminalBox.d.ts +30 -0
- package/dist/terminal/TerminalBox.js +17 -0
- package/dist/terminal/ghostty/core.d.ts +12 -4
- package/dist/terminal/ghostty/core.js +12 -4
- package/dist/terminal/index.d.ts +6 -2
- package/dist/terminal/index.js +6 -2
- package/dist/terminal/terminal.css +29 -0
- package/dist/text/Code.d.ts +15 -0
- package/dist/text/Code.js +12 -0
- package/dist/text/index.d.ts +6 -1
- package/dist/text/index.js +6 -1
- package/dist/text/text.css +21 -0
- package/dist/themes/themes.generated.css +20 -0
- package/dist/themes/tokens.d.ts +1 -0
- package/dist/themes/tokens.js +16 -2
- package/package.json +1 -1
package/dist/listing/Listing.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
3
|
-
import { createContext, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
|
-
import { ICON_SM, Spinner } from '../icon/index.js';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown, ChevronUp, Plus } from 'lucide-react';
|
|
3
|
+
import { createContext, useContext, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
|
+
import { ICON_MD, ICON_SM, Spinner } from '../icon/index.js';
|
|
5
5
|
import { useLabels } from '../labels/UiokProvider.js';
|
|
6
|
+
import { unclaimedContextMenu } from '../pane/Pane.js';
|
|
6
7
|
import { InListingRowContext, InRowContext, RowLinkLookContext } from '../pane/PaneActions.js';
|
|
7
8
|
import { cutTooltip, describedTooltip } from '../tooltip/Tooltip.logic.js';
|
|
9
|
+
import { ListingScopeContext } from './ListingScope.js';
|
|
8
10
|
import { pathParts } from './PathParts.logic.js';
|
|
9
11
|
/**
|
|
10
12
|
* A listing column as wide as `ch` characters and the gutter before it, for
|
|
@@ -180,10 +182,17 @@ function useFittedLook(chosen, richest, listing, fitting) {
|
|
|
180
182
|
* inside its pane. A listing with no rows says so in `empty`: a quiet row
|
|
181
183
|
* under the strip instead of a table (`.pane-message.empty`, starting where
|
|
182
184
|
* a row's icon starts, in the rows' type, dim), its column labels left out, so no
|
|
183
|
-
* header stands over a row that is not one.
|
|
185
|
+
* header stands over a row that is not one. Drawn outside the listing
|
|
186
|
+
* scope (the frame, a dialog, and a palette carry it), it carries
|
|
187
|
+
* `.listing-root` itself, so a listing looks the same anywhere.
|
|
184
188
|
*/
|
|
185
189
|
export function Listing({ title, label = title, grid, columns, className, empty = null, titleSort, titleLabel, children }) {
|
|
186
|
-
|
|
190
|
+
// Outside every listing scope (a page of the app's own, a popover) the
|
|
191
|
+
// listing carries the scope itself, so its rows keep their look.
|
|
192
|
+
const scoped = useContext(ListingScopeContext);
|
|
193
|
+
const classes = ['pane-listing', scoped ? '' : 'listing-root', className ?? '']
|
|
194
|
+
.filter(Boolean)
|
|
195
|
+
.join(' ');
|
|
187
196
|
const chosen = useContext(RowLinkLookContext);
|
|
188
197
|
const listing = useRef(null);
|
|
189
198
|
const fitting = typeof grid === 'function';
|
|
@@ -200,12 +209,16 @@ export const RowCursorContext = createContext({
|
|
|
200
209
|
subscribe: () => () => undefined,
|
|
201
210
|
point: () => undefined
|
|
202
211
|
});
|
|
212
|
+
/** A press on a row's radio picks it and never opens the row. */
|
|
213
|
+
const keepRadioToSelf = (event) => event.stopPropagation();
|
|
203
214
|
/**
|
|
204
215
|
* One row of a listing: its mark, its name, then its cells. `rowKey` names
|
|
205
216
|
* it to the pane's cursor (`RowCursorContext`), which it wears as the
|
|
206
217
|
* listing's cursor row (`.cursor`, `aria-current`); the pointer moving over
|
|
207
218
|
* it or the focus entering it moves the cursor there. A row with `onOpen`
|
|
208
|
-
* opens its item on a click anywhere but its controls
|
|
219
|
+
* opens its item on a click anywhere but its controls; one with
|
|
220
|
+
* `onContextMenu` takes the cursor on a secondary click, then hands the
|
|
221
|
+
* click and its key to the app for the row's menu. Controls that say
|
|
209
222
|
* what the keys run mark it with `data-verb` (`QuietAction`,
|
|
210
223
|
* `RowIconAction`), and the app reads them off the cursor row
|
|
211
224
|
* (`verbControl`); such controls leave the Tab order, unless `tabbable`
|
|
@@ -213,24 +226,55 @@ export const RowCursorContext = createContext({
|
|
|
213
226
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
214
227
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
215
228
|
*/
|
|
216
|
-
export function Row({ rowKey, mark, name, nameClass, className, onOpen, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
229
|
+
export function Row({ rowKey, mark, radio, name, nameClass, className, dim = false, add = false, selected = false, marked = false, change = null, emphasis = false, onOpen, onContextMenu, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
217
230
|
const cursor = useContext(RowCursorContext);
|
|
218
231
|
const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
|
|
232
|
+
const nameId = useId();
|
|
219
233
|
useLayoutEffect(() => {
|
|
220
234
|
cursor.rowsChanged?.();
|
|
221
235
|
return () => cursor.rowsChanged?.();
|
|
222
236
|
}, [cursor, rowKey]);
|
|
223
|
-
return (_jsx(InListingRowContext.Provider, { value: true, children: _jsx(InRowContext.Provider, { value: !tabbable, children: _jsxs("div", { "aria-current": current ? 'true' : undefined,
|
|
237
|
+
return (_jsx(InListingRowContext.Provider, { value: true, children: _jsx(InRowContext.Provider, { value: !tabbable, children: _jsxs("div", { "aria-current": current ? 'true' : undefined, "aria-selected": selected || undefined, className: [
|
|
238
|
+
'row',
|
|
239
|
+
current ? 'cursor' : '',
|
|
240
|
+
dim ? 'row-dim' : '',
|
|
241
|
+
add ? 'pane-add' : '',
|
|
242
|
+
selected ? 'selected' : '',
|
|
243
|
+
marked ? 'marked' : '',
|
|
244
|
+
change === null ? '' : `row-${change}`,
|
|
245
|
+
emphasis ? 'row-emphasis' : '',
|
|
246
|
+
className ?? ''
|
|
247
|
+
]
|
|
248
|
+
.filter(Boolean)
|
|
249
|
+
.join(' '), "data-row-key": rowKey, "data-row-menu": onContextMenu === undefined ? undefined : '', onClick: onOpen, onContextMenu: unclaimedContextMenu(onContextMenu &&
|
|
250
|
+
((event) => {
|
|
251
|
+
// The menu acts on the row it opened over, so that row is the cursor first.
|
|
252
|
+
if (!current)
|
|
253
|
+
cursor.point(rowKey);
|
|
254
|
+
onContextMenu(event, rowKey);
|
|
255
|
+
})), onFocus: () => cursor.point(rowKey),
|
|
224
256
|
// Movement, not entry: a row scrolled under a still pointer as the
|
|
225
257
|
// keys move the cursor must not take the cursor back.
|
|
226
258
|
onPointerMove: () => {
|
|
227
259
|
if (!current)
|
|
228
260
|
cursor.point(rowKey);
|
|
229
|
-
}, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name })
|
|
261
|
+
}, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [radio === undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark === undefined && add ? _jsx(Plus, { size: ICON_MD }) : mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name })] })) : (_jsxs("span", { className: nameClass === undefined ? 'row-name row-pick' : `row-name row-pick ${nameClass}`, role: "cell", children: [_jsx("input", { "aria-labelledby": nameId, checked: radio.checked, className: "check row-radio", "data-verb": radio.verb, disabled: radio.disabled, name: radio.group, onChange: () => {
|
|
262
|
+
if (!radio.disabled)
|
|
263
|
+
radio.onPick();
|
|
264
|
+
}, onClick: keepRadioToSelf, tabIndex: tabbable ? undefined : -1, type: "radio" }), _jsx("span", { className: "row-pick-name", id: nameId, ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name })] })), children] }) }) }));
|
|
230
265
|
}
|
|
231
|
-
/**
|
|
232
|
-
|
|
233
|
-
|
|
266
|
+
/**
|
|
267
|
+
* A cell of a row after its name, in the listing's metadata look
|
|
268
|
+
* (`.row-meta`), in the row-meta tone or the `tone` given.
|
|
269
|
+
*/
|
|
270
|
+
export function Cell({ align, tone, kind, missing = false, className, tip, children }) {
|
|
271
|
+
return (_jsx("span", { "data-tone": tone, className: [
|
|
272
|
+
'row-meta',
|
|
273
|
+
align === 'right' ? 'align-right' : '',
|
|
274
|
+
kind === undefined ? '' : `pane-${kind}-cell`,
|
|
275
|
+
missing ? 'value-null' : '',
|
|
276
|
+
className ?? ''
|
|
277
|
+
]
|
|
234
278
|
.filter(Boolean)
|
|
235
279
|
.join(' '), role: "cell", ...(tip === undefined || tip === null ? {} : describedTooltip(tip)), children: children }));
|
|
236
280
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether what renders inside stands in the listing scope (`.listing-root`)
|
|
3
|
+
* already: the window frame, a dialog, and a palette provide it, so a
|
|
4
|
+
* `Listing` drawn anywhere else carries the scope itself and keeps its look.
|
|
5
|
+
* Internal; the scope's class is the public contract.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ListingScopeContext: import("react").Context<boolean>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Whether what renders inside stands in the listing scope (`.listing-root`)
|
|
4
|
+
* already: the window frame, a dialog, and a palette provide it, so a
|
|
5
|
+
* `Listing` drawn anywhere else carries the scope itself and keeps its look.
|
|
6
|
+
* Internal; the scope's class is the public contract.
|
|
7
|
+
*/
|
|
8
|
+
export const ListingScopeContext = createContext(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* A pane message's tone: `danger` a refusal or a failure, `warning` a state
|
|
4
4
|
* that needs a second look, `empty` a list with no rows; a plain hint
|
|
@@ -21,8 +21,11 @@ export interface PaneMessageProps {
|
|
|
21
21
|
* One line that says something about a listing, where its rows stand: a
|
|
22
22
|
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
23
23
|
* glyph, or the line of a list with no rows, in the interface face from the
|
|
24
|
-
* rows' inset
|
|
25
|
-
*
|
|
26
|
-
* `.
|
|
24
|
+
* rows' inset. Inside a listing, after one, or anywhere else: drawn
|
|
25
|
+
* outside every listing scope (a page of the app's own, a popover), it
|
|
26
|
+
* carries the scope itself (a `.listing-root` around it), as `Listing`
|
|
27
|
+
* does, so it keeps its look. For what `Listing`'s `empty` and `PageNote`
|
|
28
|
+
* do not cover. Draws `.pane-message` (`.danger`, `.warning`, `.empty`), its
|
|
29
|
+
* words in one `.pane-message-text`, so a `Code` inside flows with them.
|
|
27
30
|
*/
|
|
28
31
|
export declare function PaneMessage({ children, tone, live }: PaneMessageProps): ReactElement;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { ListingScopeContext } from './ListingScope.js';
|
|
2
4
|
/**
|
|
3
5
|
* One line that says something about a listing, where its rows stand: a
|
|
4
6
|
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
5
7
|
* glyph, or the line of a list with no rows, in the interface face from the
|
|
6
|
-
* rows' inset
|
|
7
|
-
*
|
|
8
|
-
* `.
|
|
8
|
+
* rows' inset. Inside a listing, after one, or anywhere else: drawn
|
|
9
|
+
* outside every listing scope (a page of the app's own, a popover), it
|
|
10
|
+
* carries the scope itself (a `.listing-root` around it), as `Listing`
|
|
11
|
+
* does, so it keeps its look. For what `Listing`'s `empty` and `PageNote`
|
|
12
|
+
* do not cover. Draws `.pane-message` (`.danger`, `.warning`, `.empty`), its
|
|
13
|
+
* words in one `.pane-message-text`, so a `Code` inside flows with them.
|
|
9
14
|
*/
|
|
10
15
|
export function PaneMessage({ children, tone, live = false }) {
|
|
11
|
-
|
|
16
|
+
const scoped = useContext(ListingScopeContext);
|
|
17
|
+
const message = (_jsx("p", { className: tone === undefined ? 'pane-message' : `pane-message ${tone}`, role: live ? 'status' : undefined, children: _jsx("span", { className: "pane-message-text", children: children }) }));
|
|
18
|
+
return scoped ? message : _jsx("div", { className: "listing-root", children: message });
|
|
12
19
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/** Props for {@link TimelineCell}. */
|
|
3
|
+
export interface TimelineCellProps {
|
|
4
|
+
/** When the item began, on the scale's units (seconds after a start). */
|
|
5
|
+
readonly start: number;
|
|
6
|
+
/** When it ended, or where it stands now; not before `start`. */
|
|
7
|
+
readonly end: number;
|
|
8
|
+
/** The scale's end, shared by every row of the listing, so the bars line up. */
|
|
9
|
+
readonly max: number;
|
|
10
|
+
/**
|
|
11
|
+
* The item is on the path that matters (the slowest path of a start): its
|
|
12
|
+
* bar in the solid accent, the others in the accent's lighter line.
|
|
13
|
+
*/
|
|
14
|
+
readonly emphasis?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Draws the wait before `start` as a hairline from the scale's start, for
|
|
17
|
+
* an item that waited on another; none for one that began at once.
|
|
18
|
+
*/
|
|
19
|
+
readonly waited?: boolean;
|
|
20
|
+
/** The span in words, its accessible name and tooltip: "began at 1.9 s, took 0.8 s". */
|
|
21
|
+
readonly label: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A row's span on a shared scale, as a cell (`Cell`'s place in a `Row`):
|
|
25
|
+
* a bar from `start` to `end` of a scale from 0 to `max`, after a hairline
|
|
26
|
+
* for the wait before it, in the solid accent on the path that matters and
|
|
27
|
+
* the accent's line otherwise. Every row of a listing passes the same
|
|
28
|
+
* `max`, and `TimelineScale` heads the column with its ticks. For a plan's
|
|
29
|
+
* startup timing or a dependency graph's, read as rows rather than drawn
|
|
30
|
+
* on a canvas. Draws `.timeline-cell` with `--timeline-start` and
|
|
31
|
+
* `--timeline-end`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function TimelineCell({ start, end, max, emphasis, waited, label }: TimelineCellProps): ReactElement;
|
|
34
|
+
/** One tick of a `TimelineScale`: where it stands and its words ("1 s"). */
|
|
35
|
+
export interface TimelineTick {
|
|
36
|
+
readonly at: number;
|
|
37
|
+
readonly label: string;
|
|
38
|
+
}
|
|
39
|
+
/** Props for {@link TimelineScale}. */
|
|
40
|
+
export interface TimelineScaleProps {
|
|
41
|
+
/** The scale's end, the `max` every `TimelineCell` under it passes. */
|
|
42
|
+
readonly max: number;
|
|
43
|
+
/** Its ticks, each at its place on the scale. */
|
|
44
|
+
readonly ticks: readonly TimelineTick[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The ticks over a column of `TimelineCell`s, for the column's `control`
|
|
48
|
+
* in a `Listing`: each tick's words start at its place on the same scale,
|
|
49
|
+
* in the strip's quiet tone. Decorative: each cell names its own span.
|
|
50
|
+
*/
|
|
51
|
+
export declare function TimelineScale({ max, ticks }: TimelineScaleProps): ReactElement;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
3
|
+
/** A share of a scale, clamped to it, as a CSS percentage. */
|
|
4
|
+
const share = (value, max) => `${max > 0 ? (Math.min(Math.max(value, 0), max) / max) * 100 : 0}%`;
|
|
5
|
+
/**
|
|
6
|
+
* A row's span on a shared scale, as a cell (`Cell`'s place in a `Row`):
|
|
7
|
+
* a bar from `start` to `end` of a scale from 0 to `max`, after a hairline
|
|
8
|
+
* for the wait before it, in the solid accent on the path that matters and
|
|
9
|
+
* the accent's line otherwise. Every row of a listing passes the same
|
|
10
|
+
* `max`, and `TimelineScale` heads the column with its ticks. For a plan's
|
|
11
|
+
* startup timing or a dependency graph's, read as rows rather than drawn
|
|
12
|
+
* on a canvas. Draws `.timeline-cell` with `--timeline-start` and
|
|
13
|
+
* `--timeline-end`.
|
|
14
|
+
*/
|
|
15
|
+
export function TimelineCell({ start, end, max, emphasis = false, waited = false, label }) {
|
|
16
|
+
return (_jsx("span", { "aria-label": label, className: "row-meta timeline-cell", "data-emphasis": emphasis || undefined, role: "cell", style: {
|
|
17
|
+
'--timeline-start': share(start, max),
|
|
18
|
+
'--timeline-end': share(Math.max(start, end), max)
|
|
19
|
+
}, ...tooltip(label), children: _jsxs("span", { "aria-hidden": true, className: "timeline-track", children: [waited ? _jsx("span", { className: "timeline-wait" }) : null, _jsx("span", { className: "timeline-bar" })] }) }));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The ticks over a column of `TimelineCell`s, for the column's `control`
|
|
23
|
+
* in a `Listing`: each tick's words start at its place on the same scale,
|
|
24
|
+
* in the strip's quiet tone. Decorative: each cell names its own span.
|
|
25
|
+
*/
|
|
26
|
+
export function TimelineScale({ max, ticks }) {
|
|
27
|
+
return (_jsx("span", { "aria-hidden": true, className: "timeline-scale", children: ticks.map((tick) => (_jsx("span", { className: "timeline-tick", style: { '--timeline-at': share(tick.at, max) }, children: tick.label }, tick.label))) }));
|
|
28
|
+
}
|
package/dist/listing/index.d.ts
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* and the state, path, and terminal-well cells; `CurrentDot` marks the
|
|
5
5
|
* current one in a list, `EmptyState` fills a pane with nothing in it
|
|
6
6
|
* yet or one that could not load, and `PaneMessage` is one line about a
|
|
7
|
-
* listing (a hint, a refusal, a warning)
|
|
7
|
+
* listing (a hint, a refusal, a warning); `TimelineCell` and
|
|
8
|
+
* `TimelineScale` draw a row's span on a shared scale.
|
|
8
9
|
*/
|
|
9
10
|
export { type SortDirection } from '../labels/listing.js';
|
|
10
11
|
export { CurrentDot, type CurrentDotProps } from './CurrentDot.js';
|
|
11
12
|
export { EmptyState, type EmptyStateProps, type EmptyStateStep } from './EmptyState.js';
|
|
12
|
-
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn, type CellProps, type ColumnSort, type ListingColumn, type ListingProps, type PathCellProps, type RowCursor, type RowProps, type StateMarkProps, type StateTone, type StripProps, type WellColumnProps } from './Listing.js';
|
|
13
|
+
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn, type CellProps, type CellTone, type ColumnSort, type ListingColumn, type ListingProps, type PathCellProps, type RowCursor, type RowProps, type RowRadio, type StateMarkProps, type StateTone, type StripProps, type WellColumnProps } from './Listing.js';
|
|
13
14
|
export { PaneMessage, type PaneMessageProps, type PaneMessageTone } from './PaneMessage.js';
|
|
14
15
|
export { pathParts, type PathParts } from './PathParts.logic.js';
|
|
16
|
+
export { TimelineCell, TimelineScale, type TimelineCellProps, type TimelineScaleProps, type TimelineTick } from './Timeline.js';
|
package/dist/listing/index.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* and the state, path, and terminal-well cells; `CurrentDot` marks the
|
|
5
5
|
* current one in a list, `EmptyState` fills a pane with nothing in it
|
|
6
6
|
* yet or one that could not load, and `PaneMessage` is one line about a
|
|
7
|
-
* listing (a hint, a refusal, a warning)
|
|
7
|
+
* listing (a hint, a refusal, a warning); `TimelineCell` and
|
|
8
|
+
* `TimelineScale` draw a row's span on a shared scale.
|
|
8
9
|
*/
|
|
9
10
|
export {} from '../labels/listing.js';
|
|
10
11
|
export { CurrentDot } from './CurrentDot.js';
|
|
@@ -12,3 +13,4 @@ export { EmptyState } from './EmptyState.js';
|
|
|
12
13
|
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn } from './Listing.js';
|
|
13
14
|
export { PaneMessage } from './PaneMessage.js';
|
|
14
15
|
export { pathParts } from './PathParts.logic.js';
|
|
16
|
+
export { TimelineCell, TimelineScale } from './Timeline.js';
|