@bigpixelrocket/uiok 0.2.3 → 0.4.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 +48 -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 +17 -1
- package/dist/dialog/ConfirmDialog.js +4 -3
- package/dist/dialog/ModalDialog.d.ts +8 -0
- package/dist/dialog/ModalDialog.js +4 -2
- package/dist/dialog/ProgressDialog.d.ts +40 -0
- package/dist/dialog/ProgressDialog.js +40 -0
- package/dist/dialog/TypedNameDialog.d.ts +44 -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/Check.d.ts +9 -2
- package/dist/field/Check.js +5 -4
- package/dist/field/Controls.d.ts +198 -0
- package/dist/field/Controls.js +94 -0
- package/dist/field/FieldLayout.d.ts +126 -0
- package/dist/field/FieldLayout.js +89 -0
- package/dist/field/Switch.d.ts +26 -0
- package/dist/field/Switch.js +20 -0
- package/dist/field/index.d.ts +10 -6
- package/dist/field/index.js +10 -6
- 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 +147 -0
- package/dist/frame/Tree.js +164 -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 +6 -0
- package/dist/labels/UiokLabels.js +5 -1
- package/dist/labels/dialog.d.ts +12 -0
- package/dist/labels/dialog.js +7 -1
- package/dist/labels/index.d.ts +2 -0
- package/dist/labels/index.js +2 -0
- package/dist/labels/settings.d.ts +46 -0
- package/dist/labels/settings.js +29 -0
- package/dist/labels/viewer.d.ts +193 -0
- package/dist/labels/viewer.js +124 -0
- package/dist/listing/EmptyState.d.ts +40 -0
- package/dist/listing/EmptyState.js +14 -0
- package/dist/listing/PaneMessage.d.ts +28 -0
- package/dist/listing/PaneMessage.js +12 -0
- package/dist/listing/index.d.ts +5 -1
- package/dist/listing/index.js +5 -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 +5 -0
- package/dist/surface/Card.d.ts +18 -0
- package/dist/surface/Card.js +10 -0
- package/dist/surface/Notice.d.ts +45 -0
- package/dist/surface/Notice.js +27 -0
- package/dist/surface/index.d.ts +5 -3
- package/dist/surface/index.js +5 -3
- package/dist/themes/catalog.js +4 -0
- package/dist/themes/themes.generated.css +245 -0
- package/dist/themes/tokens.d.ts +17 -5
- package/dist/themes/tokens.js +67 -1
- package/dist/tokens.css +11 -0
- package/dist/viewer/AudioView.d.ts +13 -0
- package/dist/viewer/AudioView.js +25 -0
- package/dist/viewer/HexJump.logic.d.ts +16 -0
- package/dist/viewer/HexJump.logic.js +27 -0
- package/dist/viewer/HexRows.logic.d.ts +55 -0
- package/dist/viewer/HexRows.logic.js +84 -0
- package/dist/viewer/HexSelection.logic.d.ts +57 -0
- package/dist/viewer/HexSelection.logic.js +68 -0
- package/dist/viewer/HexView.d.ts +10 -0
- package/dist/viewer/HexView.js +291 -0
- package/dist/viewer/HexViewport.logic.d.ts +61 -0
- package/dist/viewer/HexViewport.logic.js +79 -0
- package/dist/viewer/ImageView.d.ts +19 -0
- package/dist/viewer/ImageView.js +230 -0
- package/dist/viewer/ImageZoom.logic.d.ts +65 -0
- package/dist/viewer/ImageZoom.logic.js +119 -0
- package/dist/viewer/LatestRead.logic.d.ts +27 -0
- package/dist/viewer/LatestRead.logic.js +55 -0
- package/dist/viewer/MediaControls.d.ts +25 -0
- package/dist/viewer/MediaControls.js +183 -0
- package/dist/viewer/MediaPlayer.logic.d.ts +53 -0
- package/dist/viewer/MediaPlayer.logic.js +68 -0
- package/dist/viewer/PdfView.d.ts +23 -0
- package/dist/viewer/PdfView.js +25 -0
- package/dist/viewer/QuietFocus.d.ts +19 -0
- package/dist/viewer/QuietFocus.js +27 -0
- package/dist/viewer/ScaledScroll.logic.d.ts +30 -0
- package/dist/viewer/ScaledScroll.logic.js +28 -0
- package/dist/viewer/ScaledScrollbar.d.ts +19 -0
- package/dist/viewer/ScaledScrollbar.js +71 -0
- package/dist/viewer/SyntaxHighlighter.d.ts +29 -0
- package/dist/viewer/SyntaxHighlighter.js +144 -0
- package/dist/viewer/SyntaxLanguage.logic.d.ts +110 -0
- package/dist/viewer/SyntaxLanguage.logic.js +283 -0
- package/dist/viewer/SyntaxService.d.ts +75 -0
- package/dist/viewer/SyntaxService.js +49 -0
- package/dist/viewer/SyntaxSession.logic.d.ts +78 -0
- package/dist/viewer/SyntaxSession.logic.js +221 -0
- package/dist/viewer/SyntaxWorker.d.ts +6 -0
- package/dist/viewer/SyntaxWorker.js +8 -0
- package/dist/viewer/TextEncoding.logic.d.ts +35 -0
- package/dist/viewer/TextEncoding.logic.js +58 -0
- package/dist/viewer/TextRows.logic.d.ts +86 -0
- package/dist/viewer/TextRows.logic.js +241 -0
- package/dist/viewer/TextSelection.logic.d.ts +97 -0
- package/dist/viewer/TextSelection.logic.js +139 -0
- package/dist/viewer/TextView.d.ts +13 -0
- package/dist/viewer/TextView.js +448 -0
- package/dist/viewer/TextViewport.logic.d.ts +70 -0
- package/dist/viewer/TextViewport.logic.js +116 -0
- package/dist/viewer/VideoView.d.ts +18 -0
- package/dist/viewer/VideoView.js +53 -0
- package/dist/viewer/ViewerClipboard.d.ts +30 -0
- package/dist/viewer/ViewerClipboard.js +70 -0
- package/dist/viewer/ViewerFrame.logic.d.ts +61 -0
- package/dist/viewer/ViewerFrame.logic.js +130 -0
- package/dist/viewer/ViewerKeys.d.ts +16 -0
- package/dist/viewer/ViewerKeys.js +14 -0
- package/dist/viewer/ViewerScope.d.ts +12 -0
- package/dist/viewer/ViewerScope.js +22 -0
- package/dist/viewer/ViewerViews.d.ts +28 -0
- package/dist/viewer/ViewerViews.js +22 -0
- package/dist/viewer/ViewerWindow.d.ts +53 -0
- package/dist/viewer/ViewerWindow.js +219 -0
- package/dist/viewer/index.d.ts +12 -0
- package/dist/viewer/index.js +12 -0
- package/dist/viewer/types.d.ts +151 -0
- package/dist/viewer/types.js +26 -0
- package/dist/viewer/useElementHeight.d.ts +6 -0
- package/dist/viewer/useElementHeight.js +22 -0
- package/dist/viewer/useElementSize.d.ts +7 -0
- package/dist/viewer/useElementSize.js +24 -0
- package/dist/viewer/useEscapeToClear.d.ts +8 -0
- package/dist/viewer/useEscapeToClear.js +26 -0
- package/dist/viewer/useHexDocument.d.ts +41 -0
- package/dist/viewer/useHexDocument.js +144 -0
- package/dist/viewer/useMediaElement.d.ts +10 -0
- package/dist/viewer/useMediaElement.js +24 -0
- package/dist/viewer/useSyntaxHighlight.d.ts +24 -0
- package/dist/viewer/useSyntaxHighlight.js +133 -0
- package/dist/viewer/useTextDocument.d.ts +66 -0
- package/dist/viewer/useTextDocument.js +245 -0
- package/dist/viewer/viewer.css +645 -0
- package/package.json +7 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
/** One step of an empty state's way in: its words and a quieter line under them. */
|
|
4
|
+
export interface EmptyStateStep {
|
|
5
|
+
/** What to do ("Pick a folder"). */
|
|
6
|
+
readonly title: string;
|
|
7
|
+
/** More about it ("any folder of this Mac"). */
|
|
8
|
+
readonly detail?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Props for {@link EmptyState}. */
|
|
11
|
+
export interface EmptyStateProps {
|
|
12
|
+
/** The glyph over the title, in the faint tone (the danger tone for a `failure`). */
|
|
13
|
+
readonly icon?: LucideIcon;
|
|
14
|
+
/** A mark of the host's own in place of the glyph (a `BrandMark`), drawn at the glyph's place. */
|
|
15
|
+
readonly mark?: ReactNode;
|
|
16
|
+
/** What the pane is waiting for, or what went wrong, as its heading. */
|
|
17
|
+
readonly title: string;
|
|
18
|
+
/** A sentence on what the pane is for or what went wrong. */
|
|
19
|
+
readonly body?: ReactNode;
|
|
20
|
+
/** Its ways on: `Button`s, one primary at most, in a row that wraps. */
|
|
21
|
+
readonly actions?: ReactNode;
|
|
22
|
+
/** A quiet line under the actions (where an import would come from). */
|
|
23
|
+
readonly note?: ReactNode;
|
|
24
|
+
/** What the system returned, last, in the code face (an error, the tools found). */
|
|
25
|
+
readonly detail?: ReactNode;
|
|
26
|
+
/** The way in as numbered steps, side by side under the rest. */
|
|
27
|
+
readonly steps?: readonly EmptyStateStep[];
|
|
28
|
+
/** The pane could not load: announced as an alert, its glyph in the danger tone. */
|
|
29
|
+
readonly failure?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A pane with nothing in it yet (no projects, nothing installed) or one
|
|
33
|
+
* that could not load: one block centred between its path bar and its
|
|
34
|
+
* status line, its glyph, its heading, a sentence, its ways on, then a note,
|
|
35
|
+
* what the system returned, and the way in as numbered steps. Its words can
|
|
36
|
+
* be selected and copied. A list that is merely empty (a folder with no
|
|
37
|
+
* entries, a filter that matches nothing) says so with a quiet `PageNote`
|
|
38
|
+
* or a listing's `empty` instead.
|
|
39
|
+
*/
|
|
40
|
+
export declare function EmptyState({ icon: Icon, mark, title, body, actions, note, detail, steps, failure }: EmptyStateProps): ReactElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ICON_XL } from '../icon/sizes.js';
|
|
3
|
+
/**
|
|
4
|
+
* A pane with nothing in it yet (no projects, nothing installed) or one
|
|
5
|
+
* that could not load: one block centred between its path bar and its
|
|
6
|
+
* status line, its glyph, its heading, a sentence, its ways on, then a note,
|
|
7
|
+
* what the system returned, and the way in as numbered steps. Its words can
|
|
8
|
+
* be selected and copied. A list that is merely empty (a folder with no
|
|
9
|
+
* entries, a filter that matches nothing) says so with a quiet `PageNote`
|
|
10
|
+
* or a listing's `empty` instead.
|
|
11
|
+
*/
|
|
12
|
+
export function EmptyState({ icon: Icon, mark, title, body, actions, note, detail, steps, failure = false }) {
|
|
13
|
+
return (_jsxs("div", { className: "pane-empty", role: failure ? 'alert' : undefined, children: [mark ?? (Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_XL })), _jsx("h2", { children: title }), body === undefined ? null : _jsx("p", { children: body }), actions === undefined ? null : _jsx("div", { className: "pane-empty-actions", children: actions }), note === undefined ? null : _jsx("p", { className: "pane-empty-note", children: note }), detail === undefined ? null : _jsx("p", { className: "pane-empty-detail", children: detail }), steps === undefined || steps.length === 0 ? null : (_jsx("ol", { className: "pane-empty-steps", children: steps.map((step, index) => (_jsxs("li", { className: "pane-empty-step", children: [_jsx("span", { "aria-hidden": true, className: "pane-empty-step-number", children: index + 1 }), _jsxs("span", { className: "pane-empty-step-text", children: [_jsx("span", { className: "pane-empty-step-title", children: step.title }), step.detail === undefined ? null : (_jsx("span", { className: "pane-empty-step-detail", children: step.detail }))] })] }, step.title))) }))] }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A pane message's tone: `danger` a refusal or a failure, `warning` a state
|
|
4
|
+
* that needs a second look, `empty` a list with no rows; a plain hint
|
|
5
|
+
* otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export type PaneMessageTone = 'danger' | 'warning' | 'empty';
|
|
8
|
+
/** Props for {@link PaneMessage}. */
|
|
9
|
+
export interface PaneMessageProps {
|
|
10
|
+
/** Its words, a sentence, which may hold `<code>` for a name or a value. */
|
|
11
|
+
readonly children: ReactNode;
|
|
12
|
+
/** Its tone; a plain hint unless given. */
|
|
13
|
+
readonly tone?: PaneMessageTone;
|
|
14
|
+
/**
|
|
15
|
+
* Makes it a live region (`status`) that assistive technology reads when
|
|
16
|
+
* it changes, for a line that comes and goes with what the user does.
|
|
17
|
+
*/
|
|
18
|
+
readonly live?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One line that says something about a listing, where its rows stand: a
|
|
22
|
+
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
23
|
+
* glyph, or the line of a list with no rows, in the interface face from the
|
|
24
|
+
* rows' inset, inside a listing root. For what `Listing`'s `empty` and
|
|
25
|
+
* `PageNote` do not cover. Draws `.pane-message` (`.danger`, `.warning`,
|
|
26
|
+
* `.empty`).
|
|
27
|
+
*/
|
|
28
|
+
export declare function PaneMessage({ children, tone, live }: PaneMessageProps): ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* One line that says something about a listing, where its rows stand: a
|
|
4
|
+
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
5
|
+
* glyph, or the line of a list with no rows, in the interface face from the
|
|
6
|
+
* rows' inset, inside a listing root. For what `Listing`'s `empty` and
|
|
7
|
+
* `PageNote` do not cover. Draws `.pane-message` (`.danger`, `.warning`,
|
|
8
|
+
* `.empty`).
|
|
9
|
+
*/
|
|
10
|
+
export function PaneMessage({ children, tone, live = false }) {
|
|
11
|
+
return (_jsx("p", { className: tone === undefined ? 'pane-message' : `pane-message ${tone}`, role: live ? 'status' : undefined, children: children }));
|
|
12
|
+
}
|
package/dist/listing/index.d.ts
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* Listings: the column strip, rows and cells in the listing look (scoped by
|
|
3
3
|
* `.listing-root`), the row cursor they share with the keys, column widths,
|
|
4
4
|
* and the state, path, and terminal-well cells; `CurrentDot` marks the
|
|
5
|
-
* current one in a list
|
|
5
|
+
* current one in a list, `EmptyState` fills a pane with nothing in it
|
|
6
|
+
* yet or one that could not load, and `PaneMessage` is one line about a
|
|
7
|
+
* listing (a hint, a refusal, a warning).
|
|
6
8
|
*/
|
|
7
9
|
export { type SortDirection } from '../labels/listing.js';
|
|
8
10
|
export { CurrentDot, type CurrentDotProps } from './CurrentDot.js';
|
|
11
|
+
export { EmptyState, type EmptyStateProps, type EmptyStateStep } from './EmptyState.js';
|
|
9
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 { PaneMessage, type PaneMessageProps, type PaneMessageTone } from './PaneMessage.js';
|
|
10
14
|
export { pathParts, type PathParts } from './PathParts.logic.js';
|
package/dist/listing/index.js
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* Listings: the column strip, rows and cells in the listing look (scoped by
|
|
3
3
|
* `.listing-root`), the row cursor they share with the keys, column widths,
|
|
4
4
|
* and the state, path, and terminal-well cells; `CurrentDot` marks the
|
|
5
|
-
* current one in a list
|
|
5
|
+
* current one in a list, `EmptyState` fills a pane with nothing in it
|
|
6
|
+
* yet or one that could not load, and `PaneMessage` is one line about a
|
|
7
|
+
* listing (a hint, a refusal, a warning).
|
|
6
8
|
*/
|
|
7
9
|
export {} from '../labels/listing.js';
|
|
8
10
|
export { CurrentDot } from './CurrentDot.js';
|
|
11
|
+
export { EmptyState } from './EmptyState.js';
|
|
9
12
|
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn } from './Listing.js';
|
|
13
|
+
export { PaneMessage } from './PaneMessage.js';
|
|
10
14
|
export { pathParts } from './PathParts.logic.js';
|
package/dist/listing/listing.css
CHANGED
|
@@ -1690,13 +1690,17 @@ button.crumb-label > .crumb-text {
|
|
|
1690
1690
|
where there is one (.pane-empty-detail). The pane keeps its path bar and
|
|
1691
1691
|
status line around it. A list that is merely empty (a folder with no
|
|
1692
1692
|
entries, a filter that matches nothing) says so with the quiet line
|
|
1693
|
-
`.pane-message.empty` instead.
|
|
1693
|
+
`.pane-message.empty` instead. In a pane shorter than the block, the
|
|
1694
|
+
block scrolls between the path bar and the status line, never pushing
|
|
1695
|
+
the status line out, and its top stays reachable (safe centring). */
|
|
1694
1696
|
:where(.listing-root) .pane-empty {
|
|
1695
1697
|
display: flex;
|
|
1696
1698
|
flex: 1;
|
|
1697
1699
|
flex-direction: column;
|
|
1698
1700
|
align-items: center;
|
|
1699
|
-
justify-content: center;
|
|
1701
|
+
justify-content: safe center;
|
|
1702
|
+
min-height: 0;
|
|
1703
|
+
overflow-y: auto;
|
|
1700
1704
|
gap: var(--space-2);
|
|
1701
1705
|
padding: var(--space-16);
|
|
1702
1706
|
color: var(--text-dim);
|
|
@@ -1758,6 +1762,66 @@ button.crumb-label > .crumb-text {
|
|
|
1758
1762
|
overflow-wrap: anywhere;
|
|
1759
1763
|
}
|
|
1760
1764
|
|
|
1765
|
+
/* A host's own mark (a brand mark) in the glyph's place, at the glyph's
|
|
1766
|
+
scale: the mark is 1.4em, so the glyph's size sets its em. */
|
|
1767
|
+
:where(.listing-root) .pane-empty > .brand-mark {
|
|
1768
|
+
font-size: var(--icon-xl);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/* A quiet line under the actions (EmptyState's note). */
|
|
1772
|
+
:where(.listing-root) .pane-empty p.pane-empty-note {
|
|
1773
|
+
margin-top: var(--space-3);
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
/* The way in as numbered steps side by side under the rest, each number in
|
|
1777
|
+
a small key-like box beside its words, its detail dim under its title. */
|
|
1778
|
+
:where(.listing-root) .pane-empty-steps {
|
|
1779
|
+
display: flex;
|
|
1780
|
+
flex-wrap: wrap;
|
|
1781
|
+
justify-content: center;
|
|
1782
|
+
gap: var(--space-4) var(--space-12);
|
|
1783
|
+
max-width: 620px;
|
|
1784
|
+
margin: var(--space-12) 0 0;
|
|
1785
|
+
padding: 0;
|
|
1786
|
+
list-style: none;
|
|
1787
|
+
font-size: var(--font-size-small);
|
|
1788
|
+
line-height: var(--line-height-prose);
|
|
1789
|
+
text-align: left;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
:where(.listing-root) .pane-empty-step {
|
|
1793
|
+
display: flex;
|
|
1794
|
+
gap: var(--space-3);
|
|
1795
|
+
max-width: 180px;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
:where(.listing-root) .pane-empty-step-number {
|
|
1799
|
+
display: inline-flex;
|
|
1800
|
+
flex: none;
|
|
1801
|
+
align-items: center;
|
|
1802
|
+
justify-content: center;
|
|
1803
|
+
min-width: var(--icon-lg);
|
|
1804
|
+
height: var(--icon-lg);
|
|
1805
|
+
margin-top: var(--space-1);
|
|
1806
|
+
border: var(--line) solid var(--control-border);
|
|
1807
|
+
border-radius: var(--radius-xs);
|
|
1808
|
+
color: var(--text-dim);
|
|
1809
|
+
font-family: var(--font-mono);
|
|
1810
|
+
font-size: var(--font-size-caption);
|
|
1811
|
+
line-height: var(--line-height-compact);
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
:where(.listing-root) .pane-empty-step-text {
|
|
1815
|
+
display: flex;
|
|
1816
|
+
flex-direction: column;
|
|
1817
|
+
-webkit-user-select: text;
|
|
1818
|
+
user-select: text;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
:where(.listing-root) .pane-empty-step-title {
|
|
1822
|
+
color: var(--text);
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1761
1825
|
/* A state (StateMark): its mark, or its spinner for a transition, and its
|
|
1762
1826
|
word, in the state's tone. The mark takes the tone everywhere, the word
|
|
1763
1827
|
inside a row only, in the text-safe tone of its state. Each mark has its
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
/** One line of a log. */
|
|
3
|
+
export interface LogLine {
|
|
4
|
+
/** Names the line among the log's; its place in the list where lines only ever append. */
|
|
5
|
+
readonly key: string | number;
|
|
6
|
+
/** What wrote it (a process's name, `queue.2`); none for a line of the log's own. */
|
|
7
|
+
readonly source?: string | null;
|
|
8
|
+
/** The line's words, as written. */
|
|
9
|
+
readonly text: ReactNode;
|
|
10
|
+
/** A line the host marks: a failure (`danger`), a warning, or one of the log's own quiet notes (`dim`). */
|
|
11
|
+
readonly tone?: 'danger' | 'warning' | 'dim';
|
|
12
|
+
}
|
|
13
|
+
/** Props for {@link LogWell}. */
|
|
14
|
+
export interface LogWellProps {
|
|
15
|
+
readonly lines: readonly LogLine[];
|
|
16
|
+
/** The log's accessible name ("Combined log"). */
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** The sources in the order their colours go, so each keeps its colour; any other takes the next in turn. */
|
|
19
|
+
readonly sources?: readonly string[];
|
|
20
|
+
/** Keeps the newest line in view while the reader is at the foot; a reader scrolled up stays put. */
|
|
21
|
+
readonly follow?: boolean;
|
|
22
|
+
/** The words shown while the log has no line. */
|
|
23
|
+
readonly empty?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A log in a well: each line in the code face, its source first in a
|
|
27
|
+
* column as wide as the longest source and in that source's own colour
|
|
28
|
+
* (`--log-source-*`, legible as text), a bar, then the words; a line the
|
|
29
|
+
* host marks takes its tone. The words can be selected and copied. With
|
|
30
|
+
* `follow`, a new line scrolls into view while the reader is at the foot.
|
|
31
|
+
* It is a `log` region, so a screen reader hears new lines without being
|
|
32
|
+
* moved; it takes the focus so the keys scroll it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function LogWell({ lines, label, sources, follow, empty }: LogWellProps): ReactElement;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
3
|
+
import { logSourceColour, logSourceIndexes, logSourceWidth } from './LogWell.logic.js';
|
|
4
|
+
/** How near the foot, in pixels, still counts as reading the newest line. */
|
|
5
|
+
const FOOT_SLACK = 8;
|
|
6
|
+
/**
|
|
7
|
+
* A log in a well: each line in the code face, its source first in a
|
|
8
|
+
* column as wide as the longest source and in that source's own colour
|
|
9
|
+
* (`--log-source-*`, legible as text), a bar, then the words; a line the
|
|
10
|
+
* host marks takes its tone. The words can be selected and copied. With
|
|
11
|
+
* `follow`, a new line scrolls into view while the reader is at the foot.
|
|
12
|
+
* It is a `log` region, so a screen reader hears new lines without being
|
|
13
|
+
* moved; it takes the focus so the keys scroll it.
|
|
14
|
+
*/
|
|
15
|
+
export function LogWell({ lines, label, sources = [], follow = true, empty }) {
|
|
16
|
+
const well = useRef(null);
|
|
17
|
+
const atFoot = useRef(true);
|
|
18
|
+
const names = lines.map((line) => line.source);
|
|
19
|
+
const indexes = logSourceIndexes(names, sources);
|
|
20
|
+
const width = logSourceWidth(names);
|
|
21
|
+
const last = lines.at(-1)?.key;
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const element = well.current;
|
|
24
|
+
if (follow && atFoot.current && element) {
|
|
25
|
+
element.scrollTop = element.scrollHeight;
|
|
26
|
+
}
|
|
27
|
+
}, [follow, last, lines.length]);
|
|
28
|
+
return (_jsxs("div", { "aria-label": label, className: "log-well selectable", onScroll: (event) => {
|
|
29
|
+
const element = event.currentTarget;
|
|
30
|
+
atFoot.current =
|
|
31
|
+
element.scrollHeight - element.scrollTop - element.clientHeight <= FOOT_SLACK;
|
|
32
|
+
}, ref: well, role: "log", style: { '--log-source-width': `${width}ch` }, tabIndex: 0, children: [lines.length === 0 && empty !== undefined ? _jsx("p", { className: "log-empty", children: empty }) : null, lines.map((line) => {
|
|
33
|
+
const source = line.source ?? null;
|
|
34
|
+
const index = source === null ? undefined : indexes.get(source);
|
|
35
|
+
return (_jsxs("div", { className: "log-line", "data-tone": line.tone, children: [width > 0 ? (_jsx("span", { className: "log-source", style: index === undefined
|
|
36
|
+
? undefined
|
|
37
|
+
: { '--log-source': logSourceColour(index) }, children: source })) : null, width > 0 ? (_jsx("span", { "aria-hidden": true, className: "log-bar", children: "|" })) : null, _jsx("span", { className: "log-text", children: line.text })] }, line.key));
|
|
38
|
+
})] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** How many source colours the theme defines (`--log-source-1` to `--log-source-6`). */
|
|
2
|
+
export declare const LOG_SOURCE_COLOURS = 6;
|
|
3
|
+
/**
|
|
4
|
+
* The colour token the log source at `index` (from zero) is written in, as
|
|
5
|
+
* a `var()`: `--log-source-1` for 0 through `--log-source-6` for 5,
|
|
6
|
+
* starting over at 6. Each holds 4.5:1 as text on a panel.
|
|
7
|
+
*/
|
|
8
|
+
export declare const logSourceColour: (index: number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Each source's colour index, in the order given (`order`, then any other
|
|
11
|
+
* source in the order it first appears in `lines`), so a source keeps its
|
|
12
|
+
* colour however its lines interleave and whatever comes in later.
|
|
13
|
+
*/
|
|
14
|
+
export declare function logSourceIndexes(sources: readonly (string | null | undefined)[], order?: readonly string[]): ReadonlyMap<string, number>;
|
|
15
|
+
/** The width of a log's source column, in characters: its longest source, none when no line has one. */
|
|
16
|
+
export declare function logSourceWidth(sources: readonly (string | null | undefined)[]): number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** How many source colours the theme defines (`--log-source-1` to `--log-source-6`). */
|
|
2
|
+
export const LOG_SOURCE_COLOURS = 6;
|
|
3
|
+
/**
|
|
4
|
+
* The colour token the log source at `index` (from zero) is written in, as
|
|
5
|
+
* a `var()`: `--log-source-1` for 0 through `--log-source-6` for 5,
|
|
6
|
+
* starting over at 6. Each holds 4.5:1 as text on a panel.
|
|
7
|
+
*/
|
|
8
|
+
export const logSourceColour = (index) => `var(--log-source-${(index % LOG_SOURCE_COLOURS) + 1})`;
|
|
9
|
+
/**
|
|
10
|
+
* Each source's colour index, in the order given (`order`, then any other
|
|
11
|
+
* source in the order it first appears in `lines`), so a source keeps its
|
|
12
|
+
* colour however its lines interleave and whatever comes in later.
|
|
13
|
+
*/
|
|
14
|
+
export function logSourceIndexes(sources, order = []) {
|
|
15
|
+
const indexes = new Map();
|
|
16
|
+
for (const source of [...order, ...sources]) {
|
|
17
|
+
if (source !== null && source !== undefined && !indexes.has(source)) {
|
|
18
|
+
indexes.set(source, indexes.size);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return indexes;
|
|
22
|
+
}
|
|
23
|
+
/** The width of a log's source column, in characters: its longest source, none when no line has one. */
|
|
24
|
+
export function logSourceWidth(sources) {
|
|
25
|
+
return sources.reduce((widest, source) => Math.max(widest, source?.length ?? 0), 0);
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs: `LogWell`, a log's lines in a well with each source's prefix in its
|
|
3
|
+
* own colour, and the rules that give a source its colour and its column
|
|
4
|
+
* (`logSourceIndexes`, `logSourceColour`, `logSourceWidth`). Its look is
|
|
5
|
+
* `log.css` in `@bigpixelrocket/uiok/styles.css`.
|
|
6
|
+
*/
|
|
7
|
+
export { LogWell, type LogLine, type LogWellProps } from './LogWell.js';
|
|
8
|
+
export { LOG_SOURCE_COLOURS, logSourceColour, logSourceIndexes, logSourceWidth } from './LogWell.logic.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs: `LogWell`, a log's lines in a well with each source's prefix in its
|
|
3
|
+
* own colour, and the rules that give a source its colour and its column
|
|
4
|
+
* (`logSourceIndexes`, `logSourceColour`, `logSourceWidth`). Its look is
|
|
5
|
+
* `log.css` in `@bigpixelrocket/uiok/styles.css`.
|
|
6
|
+
*/
|
|
7
|
+
export { LogWell } from './LogWell.js';
|
|
8
|
+
export { LOG_SOURCE_COLOURS, logSourceColour, logSourceIndexes, logSourceWidth } from './LogWell.logic.js';
|
package/dist/log/log.css
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* A log in a well (LogWell): the code face at the small size, the lines
|
|
2
|
+
kept as written (wrapping only where a line is longer than the well),
|
|
3
|
+
each source in a column as wide as the longest, in its own colour
|
|
4
|
+
(--log-source, which the component sets to a --log-source-N token, each
|
|
5
|
+
legible as text on a panel). */
|
|
6
|
+
.log-well {
|
|
7
|
+
min-height: 0;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: var(--space-3) var(--space-4);
|
|
10
|
+
overflow: auto;
|
|
11
|
+
border: var(--line) solid var(--border-strong);
|
|
12
|
+
border-radius: var(--radius-md);
|
|
13
|
+
background: var(--surface);
|
|
14
|
+
color: var(--text);
|
|
15
|
+
font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
|
|
16
|
+
var(--font-mono);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.log-line {
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-template-columns: var(--log-source-width) auto minmax(0, 1fr);
|
|
22
|
+
column-gap: var(--space-3);
|
|
23
|
+
white-space: pre-wrap;
|
|
24
|
+
overflow-wrap: anywhere;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* A log with no sources: the words alone. */
|
|
28
|
+
.log-line:not(:has(> .log-source)) {
|
|
29
|
+
grid-template-columns: minmax(0, 1fr);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.log-source {
|
|
33
|
+
color: var(--log-source, var(--text-dim));
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.log-bar {
|
|
38
|
+
color: var(--text-faint);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.log-line[data-tone='danger'] > .log-text {
|
|
42
|
+
color: var(--danger-text);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.log-line[data-tone='warning'] > .log-text {
|
|
46
|
+
color: var(--warning-text);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.log-line[data-tone='dim'] > .log-text {
|
|
50
|
+
color: var(--text-dim);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.log-empty {
|
|
54
|
+
margin: 0;
|
|
55
|
+
color: var(--text-dim);
|
|
56
|
+
font-family: var(--font-ui);
|
|
57
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DOMAttributes, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The event handlers a host hangs on a pane or a region of the window for
|
|
4
|
+
* its keys, its focus, and its drop zone; nothing that styles it.
|
|
5
|
+
*/
|
|
6
|
+
export type RegionHandlers = Pick<DOMAttributes<HTMLElement>, 'onBlur' | 'onDragEnter' | 'onDragLeave' | 'onDragOver' | 'onDrop' | 'onFocus' | 'onKeyDown' | 'onKeyDownCapture' | 'onMouseDown' | 'onPointerDown'>;
|
|
7
|
+
/** Props for {@link PaneBox}. */
|
|
8
|
+
export interface PaneBoxProps extends RegionHandlers {
|
|
9
|
+
/** The pane holds the keyboard: its frame wears the accent. */
|
|
10
|
+
readonly active?: boolean;
|
|
11
|
+
/** The pane's accessible name, when its path bar does not name it. */
|
|
12
|
+
readonly label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* `danger` draws its frame, and its front tab's outline, in the danger
|
|
15
|
+
* colour at rest, active, and in an inactive window (a production server).
|
|
16
|
+
*/
|
|
17
|
+
readonly tone?: 'danger';
|
|
18
|
+
/** The element it draws: a `section` by default, an `aside` for a sidebar. */
|
|
19
|
+
readonly as?: 'section' | 'aside';
|
|
20
|
+
readonly ref?: Ref<HTMLElement>;
|
|
21
|
+
/** Its tabs (`PaneTabs`), path bar, list, and status line, top to bottom. */
|
|
22
|
+
readonly children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A pane in the listing look (under the listing root a `WindowFrame`
|
|
26
|
+
* wears): a framed column of its tab strip or path bar, its list, and its
|
|
27
|
+
* status line. `active` marks the pane that holds the keyboard; the others
|
|
28
|
+
* show their cursor row quietly.
|
|
29
|
+
*/
|
|
30
|
+
export declare function PaneBox({ active, label, tone, as: Element, ref, children, ...handlers }: PaneBoxProps): ReactElement;
|
|
31
|
+
/** Props for {@link PaneList}. */
|
|
32
|
+
export interface PaneListProps extends RegionHandlers {
|
|
33
|
+
/**
|
|
34
|
+
* The pane's home list, which the keys return to and Page Up and Page
|
|
35
|
+
* Down measure (`data-pane-home`): focusable by script, out of the Tab order.
|
|
36
|
+
*/
|
|
37
|
+
readonly home?: boolean;
|
|
38
|
+
/** Its rows act on a click, so the row under the pointer lights. */
|
|
39
|
+
readonly pointer?: boolean;
|
|
40
|
+
readonly label?: string;
|
|
41
|
+
readonly ref?: Ref<HTMLDivElement>;
|
|
42
|
+
/** Its listings, rows, and notes. */
|
|
43
|
+
readonly children?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The scrolling body of a pane, between its path bar and its status line:
|
|
47
|
+
* the listings and notes the pane shows.
|
|
48
|
+
*/
|
|
49
|
+
export declare function PaneList({ home, pointer, label, ref, children, ...handlers }: PaneListProps): ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A pane in the listing look (under the listing root a `WindowFrame`
|
|
4
|
+
* wears): a framed column of its tab strip or path bar, its list, and its
|
|
5
|
+
* status line. `active` marks the pane that holds the keyboard; the others
|
|
6
|
+
* show their cursor row quietly.
|
|
7
|
+
*/
|
|
8
|
+
export function PaneBox({ active = false, label, tone, as: Element = 'section', ref, children, ...handlers }) {
|
|
9
|
+
return (_jsx(Element, { "aria-label": label, className: active ? 'pane active' : 'pane', "data-tone": tone, ref: ref, ...handlers, children: children }));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The scrolling body of a pane, between its path bar and its status line:
|
|
13
|
+
* the listings and notes the pane shows.
|
|
14
|
+
*/
|
|
15
|
+
export function PaneList({ home = false, pointer = false, label, ref, children, ...handlers }) {
|
|
16
|
+
return (_jsx("div", { "aria-label": label, className: pointer ? 'pane-list pointer' : 'pane-list', "data-pane-home": home ? '' : undefined, ref: ref, tabIndex: home ? -1 : undefined, ...handlers, children: children }));
|
|
17
|
+
}
|
package/dist/pane/PaneKeys.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ControlVerb } from './PaneActions.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* A pane's home that shows: the first `data-pane-home` element in it (the
|
|
4
|
+
* sidebar's with `"sidebar"`) outside a hidden page, or null for none.
|
|
5
|
+
* Internal to the pane area.
|
|
6
|
+
*/
|
|
7
|
+
export declare const shownHome: (pane: Element | null, sidebar?: boolean) => HTMLElement | null;
|
|
8
|
+
/** The rows a pane's cursor walks, top to bottom: its `data-row-key` elements that show. */
|
|
3
9
|
export declare const paneRows: (pane: Element | null) => HTMLElement[];
|
|
4
10
|
/** A pane's row by its key, or null for none. */
|
|
5
11
|
export declare const paneRow: (pane: Element | null, key: string | null) => HTMLElement | null;
|
|
@@ -29,9 +35,10 @@ export interface SidebarTabStops {
|
|
|
29
35
|
* document puts it, make one cycle in document order that wraps at either
|
|
30
36
|
* end. A row's controls are no stops (the cursor row's keys run them) unless
|
|
31
37
|
* its listing keeps them in the Tab order (`Row`'s `tabbable`); a sidebar
|
|
32
|
-
* row's never are.
|
|
38
|
+
* row's never are. With `alone` (no sidebar shown) the page's stops make
|
|
39
|
+
* the one cycle, wrapping at either end, and the sidebar is never named.
|
|
33
40
|
*/
|
|
34
|
-
export declare function nextTabStop(main: Element, home: HTMLElement, from: TabStop, back: boolean, sidebar?: SidebarTabStops | null): TabStop;
|
|
41
|
+
export declare function nextTabStop(main: Element, home: HTMLElement, from: TabStop, back: boolean, sidebar?: SidebarTabStops | null, alone?: boolean): TabStop;
|
|
35
42
|
/**
|
|
36
43
|
* The rows one Page Up or Page Down moves in a pane: what its home
|
|
37
44
|
* (`data-pane-home`) shows of 24px rows, less one kept in view.
|
package/dist/pane/PaneKeys.js
CHANGED
|
@@ -5,8 +5,26 @@
|
|
|
5
5
|
* panes say what they offer by these marks, so the keys run exactly what a
|
|
6
6
|
* click would, disabled where the control is.
|
|
7
7
|
*/
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The elements in `root` matching `selector` that show: none inside a
|
|
10
|
+
* `hidden` element under `root`, such as a page held mounted out of sight
|
|
11
|
+
* behind the front tab (`PageSlot`), whose rows, home, and verbs the keys
|
|
12
|
+
* never reach.
|
|
13
|
+
*/
|
|
14
|
+
const shownMatches = (root, selector) => [...root.querySelectorAll(selector)].filter((match) => {
|
|
15
|
+
const hidden = match.closest('[hidden]');
|
|
16
|
+
return hidden === null || !root.contains(hidden) || hidden === root;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* A pane's home that shows: the first `data-pane-home` element in it (the
|
|
20
|
+
* sidebar's with `"sidebar"`) outside a hidden page, or null for none.
|
|
21
|
+
* Internal to the pane area.
|
|
22
|
+
*/
|
|
23
|
+
export const shownHome = (pane, sidebar = false) => pane === null
|
|
24
|
+
? null
|
|
25
|
+
: (shownMatches(pane, sidebar ? '[data-pane-home="sidebar"]' : '[data-pane-home]')[0] ?? null);
|
|
26
|
+
/** The rows a pane's cursor walks, top to bottom: its `data-row-key` elements that show. */
|
|
27
|
+
export const paneRows = (pane) => pane === null ? [] : shownMatches(pane, '[data-row-key]');
|
|
10
28
|
/** A pane's row by its key, or null for none. */
|
|
11
29
|
export const paneRow = (pane, key) => key === null ? null : (paneRows(pane).find((row) => row.dataset.rowKey === key) ?? null);
|
|
12
30
|
/** Whether a control takes a click: not disabled, not inert behind `aria-disabled`. */
|
|
@@ -18,7 +36,7 @@ const enabled = (control) => !control.disabled && control.getAttribute('aria-dis
|
|
|
18
36
|
export function verbControl(root, verb, attribute = 'verb') {
|
|
19
37
|
// The verb is quoted, so only a quote or a backslash in it needs escaping.
|
|
20
38
|
const quoted = verb.replace(/["\\]/g, '\\$&');
|
|
21
|
-
const control = root
|
|
39
|
+
const control = root === null ? null : (shownMatches(root, `[data-${attribute}~="${quoted}"]`)[0] ?? null);
|
|
22
40
|
return control !== null && enabled(control) ? control : null;
|
|
23
41
|
}
|
|
24
42
|
const FOCUSABLE = 'a[href], button, input, select, textarea, summary, [tabindex]';
|
|
@@ -61,9 +79,10 @@ const inDocumentOrder = (a, b) => a.compareDocumentPosition(b) & Node.DOCUMENT_P
|
|
|
61
79
|
* document puts it, make one cycle in document order that wraps at either
|
|
62
80
|
* end. A row's controls are no stops (the cursor row's keys run them) unless
|
|
63
81
|
* its listing keeps them in the Tab order (`Row`'s `tabbable`); a sidebar
|
|
64
|
-
* row's never are.
|
|
82
|
+
* row's never are. With `alone` (no sidebar shown) the page's stops make
|
|
83
|
+
* the one cycle, wrapping at either end, and the sidebar is never named.
|
|
65
84
|
*/
|
|
66
|
-
export function nextTabStop(main, home, from, back, sidebar = null) {
|
|
85
|
+
export function nextTabStop(main, home, from, back, sidebar = null, alone = false) {
|
|
67
86
|
if (from === 'sidebar' && sidebar === null)
|
|
68
87
|
return 'page';
|
|
69
88
|
const at = from === 'sidebar' ? (sidebar?.home ?? home) : from === 'page' ? home : from;
|
|
@@ -84,7 +103,7 @@ export function nextTabStop(main, home, from, back, sidebar = null) {
|
|
|
84
103
|
.filter((stop) => stop.compareDocumentPosition(at) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
85
104
|
.pop()
|
|
86
105
|
: stops.find((stop) => stop.compareDocumentPosition(at) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
87
|
-
const landed = next ?? (sidebar === null ? undefined : back ? stops.at(-1) : stops[0]);
|
|
106
|
+
const landed = next ?? (sidebar === null && !alone ? undefined : back ? stops.at(-1) : stops[0]);
|
|
88
107
|
if (landed === undefined || landed === sidebar?.home)
|
|
89
108
|
return 'sidebar';
|
|
90
109
|
return landed === home ? 'page' : landed;
|
|
@@ -94,7 +113,7 @@ export function nextTabStop(main, home, from, back, sidebar = null) {
|
|
|
94
113
|
* (`data-pane-home`) shows of 24px rows, less one kept in view.
|
|
95
114
|
*/
|
|
96
115
|
export const pageRows = (pane) => {
|
|
97
|
-
const list =
|
|
116
|
+
const list = shownHome(pane);
|
|
98
117
|
return Math.max(1, Math.floor((list?.clientHeight ?? 0) / 24) - 1);
|
|
99
118
|
};
|
|
100
119
|
/** Brings a row the keys moved to into view, clear of its strip (the row's own scroll margin). */
|
package/dist/pane/index.d.ts
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* fits its tools to one line (`useToolbarFit`), and the keyboard of a
|
|
5
5
|
* sidebar beside a page (`usePaneKeys`) with the pure key mapping and DOM
|
|
6
6
|
* readers it is built on, and the tab strip a pane hangs from (`PaneTabs`)
|
|
7
|
-
* with the pure rules it and its host keep tab state by
|
|
8
|
-
*
|
|
7
|
+
* with the pure rules it and its host keep tab state by; `PaneBox` and
|
|
8
|
+
* `PaneList` are the pane and its scrolling body. Styled by the listing
|
|
9
|
+
* look under `.listing-root`.
|
|
9
10
|
*/
|
|
11
|
+
export { PaneBox, PaneList, type PaneBoxProps, type PaneListProps, type RegionHandlers } from './Pane.js';
|
|
10
12
|
export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow, type ControlVerb, type LinkLook, type QuietActionProps, type RowIconActionProps } from './PaneActions.js';
|
|
11
13
|
export { PanePathBar, PaneStatus, PathFact, type PaneCrumb, type PanePathBarProps, type PaneStatusProps, type PathFactProps } from './PaneFrame.js';
|
|
12
14
|
export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl, type SidebarTabStops, type TabStop } from './PaneKeys.js';
|
package/dist/pane/index.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* fits its tools to one line (`useToolbarFit`), and the keyboard of a
|
|
5
5
|
* sidebar beside a page (`usePaneKeys`) with the pure key mapping and DOM
|
|
6
6
|
* readers it is built on, and the tab strip a pane hangs from (`PaneTabs`)
|
|
7
|
-
* with the pure rules it and its host keep tab state by
|
|
8
|
-
*
|
|
7
|
+
* with the pure rules it and its host keep tab state by; `PaneBox` and
|
|
8
|
+
* `PaneList` are the pane and its scrolling body. Styled by the listing
|
|
9
|
+
* look under `.listing-root`.
|
|
9
10
|
*/
|
|
11
|
+
export { PaneBox, PaneList } from './Pane.js';
|
|
10
12
|
export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow } from './PaneActions.js';
|
|
11
13
|
export { PanePathBar, PaneStatus, PathFact } from './PaneFrame.js';
|
|
12
14
|
export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl } from './PaneKeys.js';
|