@bigpixelrocket/uiok 0.2.2 → 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 +62 -1
- package/dist/button/TextLink.d.ts +27 -0
- package/dist/button/TextLink.js +15 -0
- package/dist/button/button.css +48 -0
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.js +2 -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 +10 -4
- package/dist/dialog/DialogLists.d.ts +8 -1
- package/dist/dialog/DialogLists.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/field.css +110 -2
- package/dist/field/index.d.ts +3 -2
- package/dist/field/index.js +3 -2
- package/dist/filter/filter.css +16 -0
- 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/grid/DataGrid.d.ts +10 -2
- package/dist/grid/DataGrid.js +47 -13
- package/dist/grid/DataGrid.logic.d.ts +16 -0
- package/dist/grid/DataGrid.logic.js +28 -0
- package/dist/grid/grid.css +128 -4
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -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/keys.js +2 -0
- package/dist/labels/paneTabs.d.ts +27 -0
- package/dist/labels/paneTabs.js +10 -0
- package/dist/labels/selectAll.d.ts +4 -1
- package/dist/labels/selectAll.js +1 -1
- package/dist/labels/settings.d.ts +46 -0
- package/dist/labels/settings.js +29 -0
- package/dist/legend/KeyLegendStrip.d.ts +9 -1
- package/dist/legend/KeyLegendStrip.js +119 -5
- package/dist/legend/legend.css +52 -0
- package/dist/listing/EmptyState.d.ts +40 -0
- package/dist/listing/EmptyState.js +14 -0
- package/dist/listing/Listing.d.ts +23 -5
- package/dist/listing/Listing.js +11 -8
- package/dist/listing/index.d.ts +3 -1
- package/dist/listing/index.js +3 -1
- package/dist/listing/listing.css +172 -5
- 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/PaneActions.d.ts +3 -1
- package/dist/pane/PaneActions.js +6 -5
- package/dist/pane/PaneKeys.d.ts +10 -3
- package/dist/pane/PaneKeys.js +26 -7
- package/dist/pane/PaneTabs.d.ts +92 -0
- package/dist/pane/PaneTabs.js +326 -0
- package/dist/pane/PaneTabs.logic.d.ts +97 -0
- package/dist/pane/PaneTabs.logic.js +158 -0
- package/dist/pane/index.d.ts +7 -1
- package/dist/pane/index.js +7 -1
- package/dist/pane/panetabs.css +408 -0
- package/dist/pane/usePaneKeys.js +9 -11
- package/dist/pane/useTabDrag.d.ts +49 -0
- package/dist/pane/useTabDrag.js +306 -0
- package/dist/segmented/SegmentedChoice.d.ts +8 -1
- package/dist/segmented/SegmentedChoice.js +7 -4
- 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 +10 -0
- package/dist/surface/GroupSwatch.d.ts +22 -0
- package/dist/surface/GroupSwatch.js +15 -0
- package/dist/surface/Tag.d.ts +26 -0
- package/dist/surface/Tag.js +12 -0
- package/dist/surface/index.d.ts +7 -0
- package/dist/surface/index.js +7 -0
- package/dist/surface/surface.css +116 -1
- 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 +75 -1
- package/dist/tokens.css +11 -0
- package/package.json +1 -1
package/dist/labels/dialog.d.ts
CHANGED
|
@@ -24,6 +24,18 @@ export interface DialogLabels {
|
|
|
24
24
|
* technology after the dialog's lead and before the names: "3 items".
|
|
25
25
|
*/
|
|
26
26
|
readonly itemCount: (count: number) => string;
|
|
27
|
+
/** The verb that acknowledges a settled outcome (`ProgressDialog`): "OK". */
|
|
28
|
+
readonly ok: string;
|
|
29
|
+
/** The leave verb of a dialog that asks nothing (an alert, `SettingsFileAlert`): "Close". */
|
|
30
|
+
readonly close: string;
|
|
31
|
+
/** The verb that ends work under way (`ProgressDialog`): "Stop". */
|
|
32
|
+
readonly stop: string;
|
|
33
|
+
/** The verb that starts again what could not start (`ProgressDialog`): "Try Again". */
|
|
34
|
+
readonly tryAgain: string;
|
|
35
|
+
/** The verb that puts a progress dialog away while its work goes on: "Run in Background". */
|
|
36
|
+
readonly runInBackground: string;
|
|
37
|
+
/** The note under a typed-name confirmation's field (`TypedNameDialog`): "Type the name to confirm." */
|
|
38
|
+
readonly typeName: string;
|
|
27
39
|
}
|
|
28
40
|
/** English dialog words: the `dialog` group `UiokProvider` starts from. */
|
|
29
41
|
export declare const DEFAULT_DIALOG_LABELS: DialogLabels;
|
package/dist/labels/dialog.js
CHANGED
|
@@ -4,5 +4,11 @@ export const DEFAULT_DIALOG_LABELS = {
|
|
|
4
4
|
clear: 'Clear',
|
|
5
5
|
affectedItems: () => 'Affected items',
|
|
6
6
|
moreItems: (count) => `+${count.toLocaleString('en-US')} more`,
|
|
7
|
-
itemCount: (count) => (count === 1 ? '1 item' : `${count.toLocaleString('en-US')} items`)
|
|
7
|
+
itemCount: (count) => (count === 1 ? '1 item' : `${count.toLocaleString('en-US')} items`),
|
|
8
|
+
ok: 'OK',
|
|
9
|
+
close: 'Close',
|
|
10
|
+
stop: 'Stop',
|
|
11
|
+
tryAgain: 'Try Again',
|
|
12
|
+
runInBackground: 'Run in Background',
|
|
13
|
+
typeName: 'Type the name to confirm.'
|
|
8
14
|
};
|
package/dist/labels/index.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export { DEFAULT_LEGEND_LABELS, type LegendLabels } from './legend.js';
|
|
|
7
7
|
export { DEFAULT_LISTING_LABELS, type ListingLabels, type SortDirection } from './listing.js';
|
|
8
8
|
export { DEFAULT_PAGER_LABELS, type PagerLabels, type PagerStep } from './pager.js';
|
|
9
9
|
export { DEFAULT_PALETTE_LABELS, type PaletteLabels } from './palette.js';
|
|
10
|
+
export { DEFAULT_PANE_TABS_LABELS, type PaneTabsLabels } from './paneTabs.js';
|
|
10
11
|
export { DEFAULT_SELECT_ALL_LABELS, type SelectAllLabels } from './selectAll.js';
|
|
12
|
+
export { DEFAULT_SETTINGS_LABELS, type AppearanceLabels, type AppearanceMode, type SettingsLabels } from './settings.js';
|
|
11
13
|
export { DEFAULT_TERMINAL_LABELS, type TerminalLabels } from './terminal.js';
|
|
12
14
|
export { DEFAULT_LABELS, type UiokLabels } from './UiokLabels.js';
|
|
13
15
|
export { mergeLabels, UiokProvider, useLabels, type LabelsOverride, type UiokLabelsOverride, type UiokProviderProps } from './UiokProvider.js';
|
package/dist/labels/index.js
CHANGED
|
@@ -7,7 +7,9 @@ export { DEFAULT_LEGEND_LABELS } from './legend.js';
|
|
|
7
7
|
export { DEFAULT_LISTING_LABELS } from './listing.js';
|
|
8
8
|
export { DEFAULT_PAGER_LABELS } from './pager.js';
|
|
9
9
|
export { DEFAULT_PALETTE_LABELS } from './palette.js';
|
|
10
|
+
export { DEFAULT_PANE_TABS_LABELS } from './paneTabs.js';
|
|
10
11
|
export { DEFAULT_SELECT_ALL_LABELS } from './selectAll.js';
|
|
12
|
+
export { DEFAULT_SETTINGS_LABELS } from './settings.js';
|
|
11
13
|
export { DEFAULT_TERMINAL_LABELS } from './terminal.js';
|
|
12
14
|
export { DEFAULT_LABELS } from './UiokLabels.js';
|
|
13
15
|
export { mergeLabels, UiokProvider, useLabels } from './UiokProvider.js';
|
package/dist/labels/keys.js
CHANGED
|
@@ -12,6 +12,7 @@ export const DEFAULT_KEY_LABELS = {
|
|
|
12
12
|
ArrowLeft: 'Left',
|
|
13
13
|
ArrowRight: 'Right',
|
|
14
14
|
Backspace: 'Backspace',
|
|
15
|
+
Delete: 'Delete',
|
|
15
16
|
Enter: 'Return',
|
|
16
17
|
Escape: 'Escape',
|
|
17
18
|
Tab: 'Tab',
|
|
@@ -40,6 +41,7 @@ export const DEFAULT_KEY_LABELS = {
|
|
|
40
41
|
ArrowLeft: '←',
|
|
41
42
|
ArrowRight: '→',
|
|
42
43
|
Backspace: '⌫',
|
|
44
|
+
Delete: '⌦',
|
|
43
45
|
Enter: '↩',
|
|
44
46
|
Escape: '⎋',
|
|
45
47
|
Tab: '⇥',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words a pane's tab strip repeats whatever its tabs hold: New Tab, a
|
|
3
|
+
* tab's close control and picked state, the pinned and unsaved marks, and
|
|
4
|
+
* the folded tabs' count and menu. A tab's name and tooltip are its own.
|
|
5
|
+
*/
|
|
6
|
+
export interface PaneTabsLabels {
|
|
7
|
+
/** The New Tab button's accessible name and tooltip: "New Tab". */
|
|
8
|
+
readonly newTab: string;
|
|
9
|
+
/** A tab's close control, given the tab's name: "Close orders". */
|
|
10
|
+
readonly close: (name: string) => string;
|
|
11
|
+
/** A tab picked beside the one in front, given its name: "orders, picked". */
|
|
12
|
+
readonly picked: (name: string) => string;
|
|
13
|
+
/** What a pinned tab's description adds: "Pinned". */
|
|
14
|
+
readonly pinned: string;
|
|
15
|
+
/** What a tab holding changes not saved adds, its mark's meaning: "Changes not saved". */
|
|
16
|
+
readonly notSaved: string;
|
|
17
|
+
/**
|
|
18
|
+
* The folded tabs' count, its tooltip and description, given how many
|
|
19
|
+
* tabs folded and how many of them hold changes not saved:
|
|
20
|
+
* "6 tabs folded here, 1 with changes not saved".
|
|
21
|
+
*/
|
|
22
|
+
readonly folded: (count: number, dirty: number) => string;
|
|
23
|
+
/** The heading of the folded tabs' menu, and the count's accessible name: "Folded here". */
|
|
24
|
+
readonly foldedHeading: string;
|
|
25
|
+
}
|
|
26
|
+
/** English tab strip words: the `paneTabs` group `UiokProvider` starts from. */
|
|
27
|
+
export declare const DEFAULT_PANE_TABS_LABELS: PaneTabsLabels;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** English tab strip words: the `paneTabs` group `UiokProvider` starts from. */
|
|
2
|
+
export const DEFAULT_PANE_TABS_LABELS = {
|
|
3
|
+
newTab: 'New Tab',
|
|
4
|
+
close: (name) => `Close ${name}`,
|
|
5
|
+
picked: (name) => `${name}, picked`,
|
|
6
|
+
pinned: 'Pinned',
|
|
7
|
+
notSaved: 'Changes not saved',
|
|
8
|
+
folded: (count, dirty) => `${count.toLocaleString('en-US')} ${count === 1 ? 'tab' : 'tabs'} folded here${dirty > 0 ? `, ${dirty.toLocaleString('en-US')} with changes not saved` : ''}`,
|
|
9
|
+
foldedHeading: 'Folded here'
|
|
10
|
+
};
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
export interface SelectAllLabels {
|
|
7
7
|
/** The checkbox that checks or clears every row: "Check all". */
|
|
8
8
|
readonly checkAll: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* How many rows are checked, said before the bulk actions as a status line
|
|
11
|
+
* says it: "3 of 8 selected", "1,000 of 20,000 selected".
|
|
12
|
+
*/
|
|
10
13
|
readonly selected: (checked: number, total: number) => string;
|
|
11
14
|
/** The bar's accessible name when the caller gives none: "With selected". */
|
|
12
15
|
readonly label: string;
|
package/dist/labels/selectAll.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** English select-all words: the `selectAll` group `UiokProvider` starts from. */
|
|
2
2
|
export const DEFAULT_SELECT_ALL_LABELS = {
|
|
3
3
|
checkAll: 'Check all',
|
|
4
|
-
selected: (checked, total) => `${checked} of ${total} selected`,
|
|
4
|
+
selected: (checked, total) => `${checked.toLocaleString('en-US')} of ${total.toLocaleString('en-US')} selected`,
|
|
5
5
|
label: 'With selected'
|
|
6
6
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the Settings dialog and its shared pages repeat in every app:
|
|
3
|
+
* the dialog's title and its one verb, the sidebar's name, and the
|
|
4
|
+
* Appearance page's choices, notes, and bands (`SettingsDialog`,
|
|
5
|
+
* `AppearanceSettings`). A page's title and its own rows are the app's.
|
|
6
|
+
*/
|
|
7
|
+
/** Which appearance the windows wear: the system's, or one of the two always. */
|
|
8
|
+
export type AppearanceMode = 'system' | 'light' | 'dark';
|
|
9
|
+
/** The Appearance page's words (`AppearanceSettings`). */
|
|
10
|
+
export interface AppearanceLabels {
|
|
11
|
+
/** The subsection's name: "Theme". */
|
|
12
|
+
readonly title: string;
|
|
13
|
+
/** The appearance choice's label: "Appearance". */
|
|
14
|
+
readonly mode: string;
|
|
15
|
+
/** Each appearance choice's name: System, Light, Dark. */
|
|
16
|
+
readonly modes: Readonly<Record<AppearanceMode, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* The note under the appearance choice: what it does, and, while it
|
|
19
|
+
* follows the system, what that gives now ("Follows the system, which is
|
|
20
|
+
* light now.").
|
|
21
|
+
*/
|
|
22
|
+
readonly modeNote: (mode: AppearanceMode, systemDark: boolean) => string;
|
|
23
|
+
/** The light themes' band: "Light theme". */
|
|
24
|
+
readonly lightTheme: string;
|
|
25
|
+
/** When the light band's theme shows: "Shown while the appearance is light." */
|
|
26
|
+
readonly lightNote: string;
|
|
27
|
+
/** The dark themes' band: "Dark theme". */
|
|
28
|
+
readonly darkTheme: string;
|
|
29
|
+
/** When the dark band's theme shows: "Shown while the appearance is dark." */
|
|
30
|
+
readonly darkNote: string;
|
|
31
|
+
/** The mark on the band the window wears now: "In use now". */
|
|
32
|
+
readonly inUse: string;
|
|
33
|
+
}
|
|
34
|
+
/** The Settings dialog's shared words. */
|
|
35
|
+
export interface SettingsLabels {
|
|
36
|
+
/** The dialog's title: "Settings". */
|
|
37
|
+
readonly title: string;
|
|
38
|
+
/** The sidebar's accessible name: "Settings pages". */
|
|
39
|
+
readonly sidebar: string;
|
|
40
|
+
/** The dialog's one verb, on Return and Escape: "Done". */
|
|
41
|
+
readonly done: string;
|
|
42
|
+
/** The Appearance page's words. */
|
|
43
|
+
readonly appearance: AppearanceLabels;
|
|
44
|
+
}
|
|
45
|
+
/** English Settings words: the `settings` group `UiokProvider` starts from. */
|
|
46
|
+
export declare const DEFAULT_SETTINGS_LABELS: SettingsLabels;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the Settings dialog and its shared pages repeat in every app:
|
|
3
|
+
* the dialog's title and its one verb, the sidebar's name, and the
|
|
4
|
+
* Appearance page's choices, notes, and bands (`SettingsDialog`,
|
|
5
|
+
* `AppearanceSettings`). A page's title and its own rows are the app's.
|
|
6
|
+
*/
|
|
7
|
+
/** English Settings words: the `settings` group `UiokProvider` starts from. */
|
|
8
|
+
export const DEFAULT_SETTINGS_LABELS = {
|
|
9
|
+
title: 'Settings',
|
|
10
|
+
sidebar: 'Settings pages',
|
|
11
|
+
done: 'Done',
|
|
12
|
+
appearance: {
|
|
13
|
+
title: 'Theme',
|
|
14
|
+
mode: 'Appearance',
|
|
15
|
+
modes: { system: 'System', light: 'Light', dark: 'Dark' },
|
|
16
|
+
modeNote: (mode, systemDark) => mode === 'system'
|
|
17
|
+
? systemDark
|
|
18
|
+
? 'Follows the system, which is dark now.'
|
|
19
|
+
: 'Follows the system, which is light now.'
|
|
20
|
+
: mode === 'light'
|
|
21
|
+
? 'Light whatever the system uses.'
|
|
22
|
+
: 'Dark whatever the system uses.',
|
|
23
|
+
lightTheme: 'Light theme',
|
|
24
|
+
lightNote: 'Shown while the appearance is light.',
|
|
25
|
+
darkTheme: 'Dark theme',
|
|
26
|
+
darkNote: 'Shown while the appearance is dark.',
|
|
27
|
+
inUse: 'In use now'
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -20,6 +20,14 @@ export interface KeyLegendStripProps {
|
|
|
20
20
|
* Without it no verbs fold, and each keeps a place of its own.
|
|
21
21
|
*/
|
|
22
22
|
readonly pairLabel?: (pair: LegendPair) => string;
|
|
23
|
+
/**
|
|
24
|
+
* What the strip does with places that do not fit. `'drop'`, the default,
|
|
25
|
+
* leaves them off, so the strip ends on its last whole place. `'more'`
|
|
26
|
+
* folds them into a "+N" chip at the strip's end, its room kept whether or
|
|
27
|
+
* not anything folds, whose list names each folded verb with its whole
|
|
28
|
+
* chord and runs the one chosen.
|
|
29
|
+
*/
|
|
30
|
+
readonly overflow?: 'drop' | 'more';
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* A key legend strip along a window's bottom edge: a dock of fn and the four
|
|
@@ -33,4 +41,4 @@ export interface KeyLegendStripProps {
|
|
|
33
41
|
* them. Its own name, its verb group's name, and a paired cap's name come
|
|
34
42
|
* from `UiokLabels.legend`, chords in words from `UiokLabels.keys`.
|
|
35
43
|
*/
|
|
36
|
-
export declare function KeyLegendStrip({ verbs, pairLabel }: KeyLegendStripProps): ReactElement;
|
|
44
|
+
export declare function KeyLegendStrip({ verbs, pairLabel, overflow }: KeyLegendStripProps): ReactElement;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ArrowBigUp, ChevronUp, Command, Option } from 'lucide-react';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
import { chordGlyphs, chordSpoken } from '../keyboard/KeyChord.logic.js';
|
|
5
5
|
import { KeyChord } from '../keychord/KeyChord.js';
|
|
6
6
|
import { useLabels } from '../labels/UiokProvider.js';
|
|
7
7
|
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
8
|
-
import { legendUnits } from './KeyLegend.logic.js';
|
|
8
|
+
import { legendUnits, moreLabel, moreListAction } from './KeyLegend.logic.js';
|
|
9
9
|
/** The dock's keys, as they sit at the keyboard's left edge: Shift on its row, then Control, Option, Command. */
|
|
10
10
|
const DOCK = [
|
|
11
11
|
{ mod: 'shift', Icon: ArrowBigUp },
|
|
@@ -55,6 +55,33 @@ function useHeldModifiers() {
|
|
|
55
55
|
const keepFocus = (event) => event.preventDefault();
|
|
56
56
|
/** For a strip given no pair labels: no verb is read as one of a pair, so no label is asked for. */
|
|
57
57
|
const UNPAIRED = { pairLabel: (pair) => pair, pairOf: () => undefined };
|
|
58
|
+
/**
|
|
59
|
+
* How many places at the tail of `row` wrapped onto the line the strip
|
|
60
|
+
* never shows: every child whose top sits below the first child's. Read
|
|
61
|
+
* again whenever the row changes size or its places change.
|
|
62
|
+
*/
|
|
63
|
+
function useWrappedCount(row, places) {
|
|
64
|
+
const [count, setCount] = useState(0);
|
|
65
|
+
useLayoutEffect(() => {
|
|
66
|
+
if (row === null) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const read = () => {
|
|
70
|
+
const children = [...row.children];
|
|
71
|
+
const top = children[0]?.offsetTop ?? 0;
|
|
72
|
+
const wrapped = children.filter((child) => child.offsetTop > top).length;
|
|
73
|
+
setCount((current) => (current === wrapped ? current : wrapped));
|
|
74
|
+
};
|
|
75
|
+
read();
|
|
76
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const observer = new ResizeObserver(read);
|
|
80
|
+
observer.observe(row);
|
|
81
|
+
return () => observer.disconnect();
|
|
82
|
+
}, [row, places]);
|
|
83
|
+
return count;
|
|
84
|
+
}
|
|
58
85
|
/**
|
|
59
86
|
* A key legend strip along a window's bottom edge: a dock of fn and the four
|
|
60
87
|
* modifiers at the left, lit while held, then the verbs the keyboard offers
|
|
@@ -67,16 +94,103 @@ const UNPAIRED = { pairLabel: (pair) => pair, pairOf: () => undefined };
|
|
|
67
94
|
* them. Its own name, its verb group's name, and a paired cap's name come
|
|
68
95
|
* from `UiokLabels.legend`, chords in words from `UiokLabels.keys`.
|
|
69
96
|
*/
|
|
70
|
-
export function KeyLegendStrip({ verbs, pairLabel }) {
|
|
97
|
+
export function KeyLegendStrip({ verbs, pairLabel, overflow = 'drop' }) {
|
|
71
98
|
const { keys, legend } = useLabels();
|
|
72
99
|
const held = useHeldModifiers();
|
|
73
100
|
const units = legendUnits(verbs, pairLabel === undefined ? UNPAIRED : { pairLabel });
|
|
101
|
+
const [row, setRow] = useState(null);
|
|
102
|
+
const placesKey = units
|
|
103
|
+
.map((unit) => unit.label + chordGlyphs(unit.entries[0].chord, keys))
|
|
104
|
+
.join('\n');
|
|
105
|
+
const wrapped = useWrappedCount(overflow === 'more' ? row : null, placesKey);
|
|
106
|
+
const folded = overflow === 'more' && wrapped > 0 ? units.slice(units.length - wrapped) : [];
|
|
107
|
+
const foldedVerbs = folded.flatMap((unit) => unit.entries);
|
|
74
108
|
const place = (unit) => {
|
|
75
109
|
const [first, second] = unit.entries;
|
|
76
110
|
if (second === undefined) {
|
|
77
|
-
return (_jsxs("button", { onClick: first.run, onMouseDown: keepFocus, tabIndex: -1, type: "button", children: [_jsx(KeyChord, { chord: first.chord }), " ", first.label] }, first.label + chordGlyphs(first.chord, keys)));
|
|
111
|
+
return (_jsxs("button", { onClick: first.run, onMouseDown: keepFocus, tabIndex: -1, type: "button", ...tooltip(first.label, first.chord), children: [_jsx(KeyChord, { chord: first.chord }), " ", first.label] }, first.label + chordGlyphs(first.chord, keys)));
|
|
78
112
|
}
|
|
79
113
|
return (_jsxs("span", { className: "keylegend-pair", children: [unit.entries.map((entry) => (_jsx("button", { "aria-label": legend.capName(chordSpoken(entry.chord, keys), entry.label), className: "keylegend-cap", onClick: entry.run, onMouseDown: keepFocus, tabIndex: -1, type: "button", ...tooltip(entry.label, entry.chord), children: _jsx(KeyChord, { chord: entry.chord }) }, entry.chord.key))), _jsx("span", { "aria-hidden": true, className: "keylegend-pair-label", children: unit.label })] }, unit.label + chordGlyphs(first.chord, keys)));
|
|
80
114
|
};
|
|
81
|
-
return (_jsxs("footer", { "aria-label": legend.label, className: "keylegend", "data-fn": "false", "data-layer": "none", children: [_jsxs("span", { "aria-hidden": true, className: "keylegend-dock", children: [_jsx("span", { className: "keylegend-key keylegend-dock-fn", children: "fn" }), DOCK.map(({ mod, Icon }) => (_jsx("span", { className: held.has(mod) ? 'keylegend-key held' : 'keylegend-key', children: _jsx(Icon, { className: "key-icon" }) }, mod)))] }),
|
|
115
|
+
return (_jsxs("footer", { "aria-label": legend.label, className: "keylegend", "data-fn": "false", "data-layer": "none", children: [_jsxs("span", { "aria-hidden": true, className: "keylegend-dock", children: [_jsx("span", { className: "keylegend-key keylegend-dock-fn", children: "fn" }), DOCK.map(({ mod, Icon }) => (_jsx("span", { className: held.has(mod) ? 'keylegend-key held' : 'keylegend-key', children: _jsx(Icon, { className: "key-icon" }) }, mod)))] }), _jsxs("span", { className: "keylegend-row", children: [_jsx("span", { "aria-label": legend.verbs, className: "keylegend-verbs", ref: setRow, role: "group", children: units.map(place) }), overflow === 'more' ? (_jsx(LegendMore, { keys: keys, legend: legend, verbs: foldedVerbs })) : null] })] }));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The "+N" chip at a folding strip's end and its list above it. The chip
|
|
119
|
+
* keeps its room while nothing is folded (hidden, so the strip never jumps
|
|
120
|
+
* when the first place folds). Its list is a compact menu: the keys of
|
|
121
|
+
* `moreListAction`, a click or Return runs the verb and closes the list, and
|
|
122
|
+
* the focus goes back to where it was before the list opened, as a verb
|
|
123
|
+
* button's press keeps it, so the keyboard stays on what it was driving.
|
|
124
|
+
*/
|
|
125
|
+
function LegendMore({ verbs, keys, legend }) {
|
|
126
|
+
const [open, setOpen] = useState(false);
|
|
127
|
+
const [cursor, setCursor] = useState(0);
|
|
128
|
+
const chip = useRef(null);
|
|
129
|
+
const list = useRef(null);
|
|
130
|
+
const returnRef = useRef(null);
|
|
131
|
+
const label = moreLabel(verbs.length, legend);
|
|
132
|
+
const shown = verbs.length > 0;
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (!shown) {
|
|
135
|
+
setOpen(false);
|
|
136
|
+
}
|
|
137
|
+
}, [shown]);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (open) {
|
|
140
|
+
list.current?.focus();
|
|
141
|
+
}
|
|
142
|
+
}, [open]);
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (!open) {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
const away = (event) => {
|
|
148
|
+
const target = event.target;
|
|
149
|
+
if (target !== null && !list.current?.contains(target) && !chip.current?.contains(target)) {
|
|
150
|
+
setOpen(false);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
document.addEventListener('pointerdown', away);
|
|
154
|
+
return () => document.removeEventListener('pointerdown', away);
|
|
155
|
+
}, [open]);
|
|
156
|
+
const close = () => {
|
|
157
|
+
const back = returnRef.current;
|
|
158
|
+
returnRef.current = null;
|
|
159
|
+
setOpen(false);
|
|
160
|
+
if (back instanceof HTMLElement && back.isConnected) {
|
|
161
|
+
back.focus({ preventScroll: true });
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const run = (verb) => {
|
|
165
|
+
close();
|
|
166
|
+
verb?.run();
|
|
167
|
+
};
|
|
168
|
+
const onKeyDown = (event) => {
|
|
169
|
+
const action = moreListAction(event.nativeEvent, cursor, verbs.length);
|
|
170
|
+
if (action === null) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
event.stopPropagation();
|
|
175
|
+
if (action.kind === 'close') {
|
|
176
|
+
close();
|
|
177
|
+
}
|
|
178
|
+
else if (action.kind === 'cursor') {
|
|
179
|
+
setCursor(action.row);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
run(verbs[action.row]);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
return (_jsxs("span", { className: "keylegend-more-place", children: [_jsx("button", { "aria-expanded": open, "aria-haspopup": "menu", "aria-label": label.spoken, "aria-hidden": shown ? undefined : true, className: "keylegend-more quiet-control", "data-empty": shown ? undefined : 'true', disabled: !shown, onClick: () => {
|
|
186
|
+
if (open) {
|
|
187
|
+
close();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
returnRef.current = document.activeElement;
|
|
191
|
+
setCursor(0);
|
|
192
|
+
setOpen(true);
|
|
193
|
+
},
|
|
194
|
+
// A press must not take the focus from what the keyboard was driving.
|
|
195
|
+
onMouseDown: keepFocus, ref: chip, tabIndex: -1, type: "button", ...tooltip(label.spoken), children: label.text }), open && shown ? (_jsx("div", { "aria-label": label.spoken, className: "folder-menu folder-menu-compact keylegend-more-list", "data-overlay": true, onKeyDown: onKeyDown, ref: list, role: "menu", tabIndex: -1, children: verbs.map((verb, index) => (_jsxs("button", { "aria-label": `${chordSpoken(verb.chord, keys)} ${verb.label}`, className: index === cursor ? 'folder-menu-option cursor' : 'folder-menu-option', onClick: () => run(verb), onMouseDown: keepFocus, onPointerEnter: () => setCursor(index), role: "menuitem", tabIndex: -1, type: "button", children: [_jsx("span", { "aria-hidden": true, className: "row-icon" }), _jsx("span", { className: "row-name", children: verb.label }), _jsx(KeyChord, { chord: verb.chord })] }, verb.label + chordGlyphs(verb.chord, keys)))) })) : null] }));
|
|
82
196
|
}
|
package/dist/legend/legend.css
CHANGED
|
@@ -171,3 +171,55 @@
|
|
|
171
171
|
background: var(--accent-wash);
|
|
172
172
|
color: var(--accent-text);
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
/* The overflow chip (overflow="more"): the places that wrapped off the
|
|
176
|
+
line, counted ("+3") at the strip's end. It keeps its room while nothing
|
|
177
|
+
is folded, so the first place to fold never moves the others; then it is
|
|
178
|
+
hidden and out of reach. Its list is the compact menu, opened above it
|
|
179
|
+
and ending at its right edge. Hover and press come from .quiet-control. */
|
|
180
|
+
.keylegend-more-place {
|
|
181
|
+
position: relative;
|
|
182
|
+
flex: none;
|
|
183
|
+
margin-left: var(--space-2);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.keylegend-more {
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
min-width: var(--control-height);
|
|
191
|
+
height: var(--control-height-sm);
|
|
192
|
+
padding: 0 var(--space-3);
|
|
193
|
+
background: none;
|
|
194
|
+
border: none;
|
|
195
|
+
border-radius: var(--radius-sm);
|
|
196
|
+
color: var(--text-dim);
|
|
197
|
+
font: inherit;
|
|
198
|
+
font-size: var(--font-size-small);
|
|
199
|
+
font-variant-numeric: tabular-nums;
|
|
200
|
+
white-space: nowrap;
|
|
201
|
+
cursor: default;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.keylegend-more[data-empty] {
|
|
205
|
+
visibility: hidden;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Two classes, so it wins over the menu sheet's own place (.folder-menu
|
|
209
|
+
opens below and from the left), which loads after this one. */
|
|
210
|
+
.keylegend-more-place > .keylegend-more-list {
|
|
211
|
+
top: auto;
|
|
212
|
+
bottom: calc(100% + var(--space-2));
|
|
213
|
+
left: auto;
|
|
214
|
+
right: 0;
|
|
215
|
+
width: max-content;
|
|
216
|
+
min-width: 200px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Right to left, the chip ends the strip on the left: the list ends there
|
|
220
|
+
too. :dir() follows the nearest direction, so an LTR footer inside an RTL
|
|
221
|
+
page keeps the left-to-right place. */
|
|
222
|
+
.keylegend-more-place > .keylegend-more-list:dir(rtl) {
|
|
223
|
+
left: 0;
|
|
224
|
+
right: auto;
|
|
225
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -45,6 +45,12 @@ export interface ListingColumn {
|
|
|
45
45
|
readonly control?: ReactNode;
|
|
46
46
|
/** The label sorts the listing by its column. */
|
|
47
47
|
readonly sort?: ColumnSort;
|
|
48
|
+
/**
|
|
49
|
+
* What the label's column holds, beyond its label (a unit, how a value is
|
|
50
|
+
* measured): the label's tooltip and accessible description, sortable or
|
|
51
|
+
* not.
|
|
52
|
+
*/
|
|
53
|
+
readonly tip?: string;
|
|
48
54
|
}
|
|
49
55
|
/** Props for {@link Strip}. */
|
|
50
56
|
export interface StripProps {
|
|
@@ -143,6 +149,12 @@ export interface RowProps {
|
|
|
143
149
|
readonly className?: string;
|
|
144
150
|
/** Opens the row's item on a click anywhere but its controls. */
|
|
145
151
|
readonly onOpen?: () => void;
|
|
152
|
+
/**
|
|
153
|
+
* How deep the row stands in a tree or a plan: its name is indented by one
|
|
154
|
+
* icon column a level (`--row-level`); 0, or none, is no indent. The
|
|
155
|
+
* expansion and its keys stay the host's.
|
|
156
|
+
*/
|
|
157
|
+
readonly level?: number;
|
|
146
158
|
/** Its controls stay in the Tab order. */
|
|
147
159
|
readonly tabbable?: boolean;
|
|
148
160
|
/** The row itself takes the focus: in the Tab order while it is the cursor row. */
|
|
@@ -165,7 +177,7 @@ export interface RowProps {
|
|
|
165
177
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
166
178
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
167
179
|
*/
|
|
168
|
-
export declare function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable, focusable, entry, children }: RowProps): ReactElement;
|
|
180
|
+
export declare function Row({ rowKey, mark, name, nameClass, className, onOpen, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
|
|
169
181
|
/** Props for {@link Cell}. */
|
|
170
182
|
export interface CellProps {
|
|
171
183
|
/** Right-aligned, for numbers. */
|
|
@@ -177,8 +189,11 @@ export interface CellProps {
|
|
|
177
189
|
}
|
|
178
190
|
/** A cell of a row after its name, in the listing's metadata look (`.row-meta`). */
|
|
179
191
|
export declare function Cell({ align, className, tip, children }: CellProps): ReactElement;
|
|
180
|
-
/**
|
|
181
|
-
|
|
192
|
+
/**
|
|
193
|
+
* The tone of a state: ready, a warning, a failure, a transition under way,
|
|
194
|
+
* quiet, or a note (`info`: an Info or Note line, in the accent).
|
|
195
|
+
*/
|
|
196
|
+
export type StateTone = 'ready' | 'warning' | 'danger' | 'busy' | 'muted' | 'info';
|
|
182
197
|
/** Props for {@link StateMark}. */
|
|
183
198
|
export interface StateMarkProps {
|
|
184
199
|
readonly tone: StateTone;
|
|
@@ -186,6 +201,8 @@ export interface StateMarkProps {
|
|
|
186
201
|
readonly word: string;
|
|
187
202
|
/** A transition under way: a spinner in place of the dot. */
|
|
188
203
|
readonly busy?: boolean;
|
|
204
|
+
/** What the state means, beyond its word: the mark's tooltip and accessible description. */
|
|
205
|
+
readonly tip?: string;
|
|
189
206
|
}
|
|
190
207
|
/**
|
|
191
208
|
* A state as a State column says it: a mark in the state's tone and its word
|
|
@@ -194,9 +211,10 @@ export interface StateMarkProps {
|
|
|
194
211
|
* without its hue. Inside a row the word takes the tone too, so a failure
|
|
195
212
|
* reads red and a stopped line dim. A word wider than its column ends in an
|
|
196
213
|
* ellipsis and carries itself whole as its tooltip, which a word shown
|
|
197
|
-
* whole does not open
|
|
214
|
+
* whole does not open; a `tip` says what the state means instead, as the
|
|
215
|
+
* whole mark's tooltip and description.
|
|
198
216
|
*/
|
|
199
|
-
export declare function StateMark({ tone, word, busy }: StateMarkProps): ReactElement;
|
|
217
|
+
export declare function StateMark({ tone, word, busy, tip }: StateMarkProps): ReactElement;
|
|
200
218
|
/** Props for {@link PathCell}. */
|
|
201
219
|
export interface PathCellProps {
|
|
202
220
|
/** The whole path, slash-separated ("/opt/homebrew/var/mysql"). */
|
package/dist/listing/Listing.js
CHANGED
|
@@ -44,10 +44,10 @@ export const linksColumn = (look, icons, words, extraPx = 0) => look === 'icons'
|
|
|
44
44
|
* arrow of the way it sorts beside the label (before it over numbers, so
|
|
45
45
|
* the label keeps the edge they line up on).
|
|
46
46
|
*/
|
|
47
|
-
function SortLabel({ label, sort, align }) {
|
|
47
|
+
function SortLabel({ label, sort, align, tip }) {
|
|
48
48
|
const { sortBy } = useLabels().listing;
|
|
49
49
|
const mark = sort.direction === null ? null : sort.direction === 'asc' ? (_jsx(ChevronUp, { "aria-hidden": true, size: ICON_SM })) : (_jsx(ChevronDown, { "aria-hidden": true, size: ICON_SM }));
|
|
50
|
-
return (_jsxs("button", { "aria-label": sortBy(label, sort.direction), className: sort.direction === null ? 'pane-sort sortable' : 'pane-sort sortable active', onClick: sort.onSort, type: "button", children: [align === 'right' && mark, _jsx("span", { className: "pane-sort-label", ...cutTooltip(label), children: label }), align !== 'right' && mark] }));
|
|
50
|
+
return (_jsxs("button", { "aria-label": sortBy(label, sort.direction), className: sort.direction === null ? 'pane-sort sortable' : 'pane-sort sortable active', onClick: sort.onSort, type: "button", ...describedTooltip(tip), children: [align === 'right' && mark, _jsx("span", { className: "pane-sort-label", ...(tip === undefined ? cutTooltip(label) : {}), children: label }), align !== 'right' && mark] }));
|
|
51
51
|
}
|
|
52
52
|
/** The `aria-sort` of a sorting column's header. */
|
|
53
53
|
const ariaSort = (sort) => sort?.direction === 'asc' ? 'ascending' : sort?.direction === 'desc' ? 'descending' : undefined;
|
|
@@ -72,7 +72,9 @@ export function Strip({ title, columns = [], table = false, heading = false, cla
|
|
|
72
72
|
.join(' '), "aria-sort": table ? ariaSort(entry.sort) : undefined, role: table ? 'columnheader' : undefined, children: [entry.control, entry.hidden === true
|
|
73
73
|
? table && _jsx("span", { className: "visually-hidden", children: entry.label })
|
|
74
74
|
: entry.control === undefined &&
|
|
75
|
-
(entry.sort === undefined ? (_jsx("span", { className: "pane-sort", children: _jsx("span", { className: "pane-sort-label", ...
|
|
75
|
+
(entry.sort === undefined ? (_jsx("span", { className: "pane-sort", children: _jsx("span", { className: "pane-sort-label", ...(entry.tip === undefined
|
|
76
|
+
? cutTooltip(entry.label)
|
|
77
|
+
: describedTooltip(entry.tip)), children: entry.label }) })) : (_jsx(SortLabel, { align: entry.align, label: entry.label, sort: entry.sort, tip: entry.tip })))] }, entry.label)))] }));
|
|
76
78
|
}
|
|
77
79
|
/** The plainer look a row link takes when the one it has makes its listing scroll sideways. */
|
|
78
80
|
const PLAINER_LOOK = {
|
|
@@ -211,7 +213,7 @@ export const RowCursorContext = createContext({
|
|
|
211
213
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
212
214
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
213
215
|
*/
|
|
214
|
-
export function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable = false, focusable = false, entry = false, children }) {
|
|
216
|
+
export function Row({ rowKey, mark, name, nameClass, className, onOpen, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
215
217
|
const cursor = useContext(RowCursorContext);
|
|
216
218
|
const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
|
|
217
219
|
useLayoutEffect(() => {
|
|
@@ -224,7 +226,7 @@ export function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable
|
|
|
224
226
|
onPointerMove: () => {
|
|
225
227
|
if (!current)
|
|
226
228
|
cursor.point(rowKey);
|
|
227
|
-
}, role: "row", 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 }), children] }) }) }));
|
|
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 }), children] }) }) }));
|
|
228
230
|
}
|
|
229
231
|
/** A cell of a row after its name, in the listing's metadata look (`.row-meta`). */
|
|
230
232
|
export function Cell({ align, className, tip, children }) {
|
|
@@ -239,10 +241,11 @@ export function Cell({ align, className, tip, children }) {
|
|
|
239
241
|
* without its hue. Inside a row the word takes the tone too, so a failure
|
|
240
242
|
* reads red and a stopped line dim. A word wider than its column ends in an
|
|
241
243
|
* ellipsis and carries itself whole as its tooltip, which a word shown
|
|
242
|
-
* whole does not open
|
|
244
|
+
* whole does not open; a `tip` says what the state means instead, as the
|
|
245
|
+
* whole mark's tooltip and description.
|
|
243
246
|
*/
|
|
244
|
-
export function StateMark({ tone, word, busy = false }) {
|
|
245
|
-
return (_jsxs("span", { className: `pane-state pane-tone-${tone}`, children: [busy ? (_jsx(Spinner, { className: "pane-state-busy" })) : (_jsx("span", { "aria-hidden": true, className: "pane-state-dot" })), _jsx("span", { className: "pane-state-word", ...cutTooltip(word), children: word })] }));
|
|
247
|
+
export function StateMark({ tone, word, busy = false, tip }) {
|
|
248
|
+
return (_jsxs("span", { className: `pane-state pane-tone-${tone}`, ...describedTooltip(tip), children: [busy ? (_jsx(Spinner, { className: "pane-state-busy" })) : (_jsx("span", { "aria-hidden": true, className: "pane-state-dot" })), _jsx("span", { className: "pane-state-word", ...(tip === undefined ? cutTooltip(word) : {}), children: word })] }));
|
|
246
249
|
}
|
|
247
250
|
/**
|
|
248
251
|
* A path cell: its folders in the row-meta tone, the head giving way first
|