@bigpixelrocket/uiok 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -1
- package/dist/button/TextLink.d.ts +9 -2
- package/dist/button/TextLink.js +4 -3
- package/dist/button/button.css +7 -0
- package/dist/dialog/SectionedDialog.d.ts +37 -0
- package/dist/dialog/SectionedDialog.js +157 -0
- package/dist/dialog/dialog.css +102 -0
- package/dist/dialog/index.d.ts +4 -2
- package/dist/dialog/index.js +4 -2
- package/dist/frame/AppRoot.d.ts +1 -1
- package/dist/frame/AppRoot.js +2 -1
- package/dist/frame/Dock.d.ts +1 -1
- package/dist/frame/Dock.js +2 -1
- package/dist/frame/FilterChips.d.ts +5 -2
- package/dist/frame/FilterChips.js +35 -2
- package/dist/frame/FilterChips.logic.d.ts +24 -0
- package/dist/frame/FilterChips.logic.js +34 -0
- package/dist/frame/PageParts.d.ts +4 -3
- package/dist/frame/PageParts.js +10 -3
- package/dist/frame/SideBySide.d.ts +32 -0
- package/dist/frame/SideBySide.js +50 -0
- package/dist/frame/Tree.d.ts +1 -1
- package/dist/frame/Tree.js +3 -2
- package/dist/frame/WindowFrame.d.ts +1 -1
- package/dist/frame/WindowFrame.js +2 -1
- package/dist/frame/frame.css +48 -1
- package/dist/frame/index.d.ts +4 -2
- package/dist/frame/index.js +4 -2
- package/dist/grid/grid.css +1 -0
- package/dist/keyboard/Keyboard.logic.js +20 -3
- package/dist/keychord/KeyChord.d.ts +17 -1
- package/dist/keychord/KeyChord.js +16 -1
- package/dist/keychord/ShortcutIndex.d.ts +49 -0
- package/dist/keychord/ShortcutIndex.js +28 -0
- package/dist/keychord/index.d.ts +8 -2
- package/dist/keychord/index.js +8 -2
- package/dist/keychord/keychord.css +101 -0
- package/dist/labels/dialog.d.ts +2 -0
- package/dist/labels/dialog.js +2 -1
- package/dist/labels/keys.d.ts +5 -0
- package/dist/labels/keys.js +2 -1
- package/dist/listing/Listing.d.ts +36 -4
- package/dist/listing/Listing.js +21 -6
- package/dist/listing/PaneMessage.d.ts +7 -4
- package/dist/listing/PaneMessage.js +11 -4
- package/dist/listing/index.d.ts +1 -1
- package/dist/listing/listing.css +84 -4
- package/dist/menu/Menu.d.ts +52 -8
- package/dist/menu/Menu.js +288 -80
- package/dist/menu/Menu.logic.d.ts +39 -12
- package/dist/menu/Menu.logic.js +36 -8
- package/dist/menu/index.d.ts +4 -3
- package/dist/menu/index.js +2 -1
- package/dist/menu/menu.css +6 -0
- package/dist/palette/PaletteRows.d.ts +11 -2
- package/dist/palette/PaletteRows.js +6 -4
- package/dist/pane/Pane.d.ts +42 -6
- package/dist/pane/Pane.js +92 -5
- package/dist/pane/PaneKeys.d.ts +5 -1
- package/dist/pane/PaneKeys.js +28 -3
- package/dist/pane/PaneKeys.logic.d.ts +25 -0
- package/dist/pane/PaneKeys.logic.js +30 -0
- package/dist/pane/index.d.ts +1 -1
- package/dist/pane/index.js +1 -1
- package/dist/pane/usePaneKeys.d.ts +8 -1
- package/dist/pane/usePaneKeys.js +32 -12
- package/dist/styles.css +17 -3
- package/dist/surface/FactList.d.ts +54 -0
- package/dist/surface/FactList.js +33 -0
- package/dist/surface/index.d.ts +4 -1
- package/dist/surface/index.js +4 -1
- package/dist/surface/surface.css +75 -2
- package/dist/terminal/ghostty/core.d.ts +12 -4
- package/dist/terminal/ghostty/core.js +12 -4
- package/dist/terminal/index.d.ts +4 -2
- package/dist/terminal/index.js +4 -2
- package/dist/text/Code.d.ts +15 -0
- package/dist/text/Code.js +12 -0
- package/dist/text/index.d.ts +6 -1
- package/dist/text/index.js +6 -1
- package/dist/text/text.css +21 -0
- package/dist/themes/tokens.js +3 -1
- package/package.json +1 -1
package/dist/labels/keys.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ReactElement, type ReactNode } from 'react';
|
|
1
|
+
import { type MouseEvent, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import type { SortDirection } from '../labels/listing.js';
|
|
3
|
-
import { type LinkLook } from '../pane/PaneActions.js';
|
|
3
|
+
import { type ControlVerb, type LinkLook } from '../pane/PaneActions.js';
|
|
4
4
|
/**
|
|
5
5
|
* A listing column as wide as `ch` characters and the gutter before it, for
|
|
6
6
|
* a listing's `grid`: `column(9)` is "calc(9ch + var(--pane-column-gap))".
|
|
@@ -139,12 +139,33 @@ export interface RowCursor {
|
|
|
139
139
|
}
|
|
140
140
|
/** The cursor of the pane a row is in, which the app provides; without one no row is the cursor. */
|
|
141
141
|
export declare const RowCursorContext: import("react").Context<RowCursor>;
|
|
142
|
+
/**
|
|
143
|
+
* The radio a row leads with in place of its mark (`Row`'s `radio`): the
|
|
144
|
+
* row is one choice of several, the one picked checked.
|
|
145
|
+
*/
|
|
146
|
+
export interface RowRadio {
|
|
147
|
+
/** Whether this row is the one picked. */
|
|
148
|
+
readonly checked: boolean;
|
|
149
|
+
/** Picks this row; a press on the radio, or the key the app maps to its `verb`. */
|
|
150
|
+
readonly onPick: () => void;
|
|
151
|
+
/** The radio group's name, the same on every row of the choice and unique in the window. */
|
|
152
|
+
readonly group: string;
|
|
153
|
+
/** Holds the choice where it is (a change under way). */
|
|
154
|
+
readonly disabled?: boolean;
|
|
155
|
+
/** What the cursor row's keys run it for (`data-verb`), so a key the app maps picks the cursor row. */
|
|
156
|
+
readonly verb?: ControlVerb;
|
|
157
|
+
}
|
|
142
158
|
/** Props for {@link Row}. */
|
|
143
159
|
export interface RowProps {
|
|
144
160
|
/** Names the row to the cursor (`data-row-key`); unique in its pane. */
|
|
145
161
|
readonly rowKey: string;
|
|
146
162
|
/** The icon before the name, decorative. */
|
|
147
163
|
readonly mark?: ReactNode;
|
|
164
|
+
/**
|
|
165
|
+
* Leads the row with a radio in the mark's place: the row is one choice
|
|
166
|
+
* of several (the database a server uses), named by the row's name.
|
|
167
|
+
*/
|
|
168
|
+
readonly radio?: RowRadio;
|
|
148
169
|
readonly name: ReactNode;
|
|
149
170
|
/** The name cell's own class, beside `row-name`. */
|
|
150
171
|
readonly nameClass?: string;
|
|
@@ -181,6 +202,15 @@ export interface RowProps {
|
|
|
181
202
|
readonly emphasis?: boolean;
|
|
182
203
|
/** Opens the row's item on a click anywhere but its controls. */
|
|
183
204
|
readonly onOpen?: () => void;
|
|
205
|
+
/**
|
|
206
|
+
* A secondary click (the right button, a Control-click, the menu key) on
|
|
207
|
+
* the row, with the row's key, for the row's menu: open it at
|
|
208
|
+
* `event.clientX` and `event.clientY`. The row moves the pane's cursor to
|
|
209
|
+
* itself first, as a file manager does, so the menu acts on the cursor row,
|
|
210
|
+
* and cancels the browser's own menu; a cancelled event is one the
|
|
211
|
+
* `PaneBox` around it leaves alone, so one click never opens both menus.
|
|
212
|
+
*/
|
|
213
|
+
readonly onContextMenu?: (event: MouseEvent<HTMLElement>, rowKey: string) => void;
|
|
184
214
|
/**
|
|
185
215
|
* How deep the row stands in a tree or a plan: its name is indented by one
|
|
186
216
|
* icon column a level (`--row-level`); 0, or none, is no indent. The
|
|
@@ -201,7 +231,9 @@ export interface RowProps {
|
|
|
201
231
|
* it to the pane's cursor (`RowCursorContext`), which it wears as the
|
|
202
232
|
* listing's cursor row (`.cursor`, `aria-current`); the pointer moving over
|
|
203
233
|
* it or the focus entering it moves the cursor there. A row with `onOpen`
|
|
204
|
-
* opens its item on a click anywhere but its controls
|
|
234
|
+
* opens its item on a click anywhere but its controls; one with
|
|
235
|
+
* `onContextMenu` takes the cursor on a secondary click, then hands the
|
|
236
|
+
* click and its key to the app for the row's menu. Controls that say
|
|
205
237
|
* what the keys run mark it with `data-verb` (`QuietAction`,
|
|
206
238
|
* `RowIconAction`), and the app reads them off the cursor row
|
|
207
239
|
* (`verbControl`); such controls leave the Tab order, unless `tabbable`
|
|
@@ -209,7 +241,7 @@ export interface RowProps {
|
|
|
209
241
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
210
242
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
211
243
|
*/
|
|
212
|
-
export declare function Row({ rowKey, mark, name, nameClass, className, dim, add, selected, marked, change, emphasis, onOpen, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
|
|
244
|
+
export declare function Row({ rowKey, mark, radio, name, nameClass, className, dim, add, selected, marked, change, emphasis, onOpen, onContextMenu, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
|
|
213
245
|
/**
|
|
214
246
|
* A cell's tone: `warning` a value with something waiting on it (an
|
|
215
247
|
* update), `accent` a value offered (the version an update brings),
|
package/dist/listing/Listing.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDown, ChevronUp, Plus } from 'lucide-react';
|
|
3
|
-
import { createContext, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { createContext, useContext, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
4
|
import { ICON_MD, ICON_SM, Spinner } from '../icon/index.js';
|
|
5
5
|
import { useLabels } from '../labels/UiokProvider.js';
|
|
6
|
+
import { unclaimedContextMenu } from '../pane/Pane.js';
|
|
6
7
|
import { InListingRowContext, InRowContext, RowLinkLookContext } from '../pane/PaneActions.js';
|
|
7
8
|
import { cutTooltip, describedTooltip } from '../tooltip/Tooltip.logic.js';
|
|
8
9
|
import { ListingScopeContext } from './ListingScope.js';
|
|
@@ -208,12 +209,16 @@ export const RowCursorContext = createContext({
|
|
|
208
209
|
subscribe: () => () => undefined,
|
|
209
210
|
point: () => undefined
|
|
210
211
|
});
|
|
212
|
+
/** A press on a row's radio picks it and never opens the row. */
|
|
213
|
+
const keepRadioToSelf = (event) => event.stopPropagation();
|
|
211
214
|
/**
|
|
212
215
|
* One row of a listing: its mark, its name, then its cells. `rowKey` names
|
|
213
216
|
* it to the pane's cursor (`RowCursorContext`), which it wears as the
|
|
214
217
|
* listing's cursor row (`.cursor`, `aria-current`); the pointer moving over
|
|
215
218
|
* it or the focus entering it moves the cursor there. A row with `onOpen`
|
|
216
|
-
* opens its item on a click anywhere but its controls
|
|
219
|
+
* opens its item on a click anywhere but its controls; one with
|
|
220
|
+
* `onContextMenu` takes the cursor on a secondary click, then hands the
|
|
221
|
+
* click and its key to the app for the row's menu. Controls that say
|
|
217
222
|
* what the keys run mark it with `data-verb` (`QuietAction`,
|
|
218
223
|
* `RowIconAction`), and the app reads them off the cursor row
|
|
219
224
|
* (`verbControl`); such controls leave the Tab order, unless `tabbable`
|
|
@@ -221,9 +226,10 @@ export const RowCursorContext = createContext({
|
|
|
221
226
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
222
227
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
223
228
|
*/
|
|
224
|
-
export function Row({ rowKey, mark, name, nameClass, className, dim = false, add = false, selected = false, marked = false, change = null, emphasis = false, onOpen, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
229
|
+
export function Row({ rowKey, mark, radio, name, nameClass, className, dim = false, add = false, selected = false, marked = false, change = null, emphasis = false, onOpen, onContextMenu, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
225
230
|
const cursor = useContext(RowCursorContext);
|
|
226
231
|
const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
|
|
232
|
+
const nameId = useId();
|
|
227
233
|
useLayoutEffect(() => {
|
|
228
234
|
cursor.rowsChanged?.();
|
|
229
235
|
return () => cursor.rowsChanged?.();
|
|
@@ -240,13 +246,22 @@ export function Row({ rowKey, mark, name, nameClass, className, dim = false, add
|
|
|
240
246
|
className ?? ''
|
|
241
247
|
]
|
|
242
248
|
.filter(Boolean)
|
|
243
|
-
.join(' '), "data-row-key": rowKey, onClick: onOpen,
|
|
249
|
+
.join(' '), "data-row-key": rowKey, "data-row-menu": onContextMenu === undefined ? undefined : '', onClick: onOpen, onContextMenu: unclaimedContextMenu(onContextMenu &&
|
|
250
|
+
((event) => {
|
|
251
|
+
// The menu acts on the row it opened over, so that row is the cursor first.
|
|
252
|
+
if (!current)
|
|
253
|
+
cursor.point(rowKey);
|
|
254
|
+
onContextMenu(event, rowKey);
|
|
255
|
+
})), onFocus: () => cursor.point(rowKey),
|
|
244
256
|
// Movement, not entry: a row scrolled under a still pointer as the
|
|
245
257
|
// keys move the cursor must not take the cursor back.
|
|
246
258
|
onPointerMove: () => {
|
|
247
259
|
if (!current)
|
|
248
260
|
cursor.point(rowKey);
|
|
249
|
-
}, 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 === undefined && add ? _jsx(Plus, { size: ICON_MD }) : mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name })
|
|
261
|
+
}, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [radio === undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark === undefined && add ? _jsx(Plus, { size: ICON_MD }) : mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name })] })) : (_jsxs("span", { className: nameClass === undefined ? 'row-name row-pick' : `row-name row-pick ${nameClass}`, role: "cell", children: [_jsx("input", { "aria-labelledby": nameId, checked: radio.checked, className: "check row-radio", "data-verb": radio.verb, disabled: radio.disabled, name: radio.group, onChange: () => {
|
|
262
|
+
if (!radio.disabled)
|
|
263
|
+
radio.onPick();
|
|
264
|
+
}, onClick: keepRadioToSelf, tabIndex: tabbable ? undefined : -1, type: "radio" }), _jsx("span", { className: "row-pick-name", id: nameId, ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name })] })), children] }) }) }));
|
|
250
265
|
}
|
|
251
266
|
/**
|
|
252
267
|
* A cell of a row after its name, in the listing's metadata look
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* A pane message's tone: `danger` a refusal or a failure, `warning` a state
|
|
4
4
|
* that needs a second look, `empty` a list with no rows; a plain hint
|
|
@@ -21,8 +21,11 @@ export interface PaneMessageProps {
|
|
|
21
21
|
* One line that says something about a listing, where its rows stand: a
|
|
22
22
|
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
23
23
|
* glyph, or the line of a list with no rows, in the interface face from the
|
|
24
|
-
* rows' inset
|
|
25
|
-
*
|
|
26
|
-
* `.
|
|
24
|
+
* rows' inset. Inside a listing, after one, or anywhere else: drawn
|
|
25
|
+
* outside every listing scope (a page of the app's own, a popover), it
|
|
26
|
+
* carries the scope itself (a `.listing-root` around it), as `Listing`
|
|
27
|
+
* does, so it keeps its look. For what `Listing`'s `empty` and `PageNote`
|
|
28
|
+
* do not cover. Draws `.pane-message` (`.danger`, `.warning`, `.empty`), its
|
|
29
|
+
* words in one `.pane-message-text`, so a `Code` inside flows with them.
|
|
27
30
|
*/
|
|
28
31
|
export declare function PaneMessage({ children, tone, live }: PaneMessageProps): ReactElement;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { ListingScopeContext } from './ListingScope.js';
|
|
2
4
|
/**
|
|
3
5
|
* One line that says something about a listing, where its rows stand: a
|
|
4
6
|
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
5
7
|
* glyph, or the line of a list with no rows, in the interface face from the
|
|
6
|
-
* rows' inset
|
|
7
|
-
*
|
|
8
|
-
* `.
|
|
8
|
+
* rows' inset. Inside a listing, after one, or anywhere else: drawn
|
|
9
|
+
* outside every listing scope (a page of the app's own, a popover), it
|
|
10
|
+
* carries the scope itself (a `.listing-root` around it), as `Listing`
|
|
11
|
+
* does, so it keeps its look. For what `Listing`'s `empty` and `PageNote`
|
|
12
|
+
* do not cover. Draws `.pane-message` (`.danger`, `.warning`, `.empty`), its
|
|
13
|
+
* words in one `.pane-message-text`, so a `Code` inside flows with them.
|
|
9
14
|
*/
|
|
10
15
|
export function PaneMessage({ children, tone, live = false }) {
|
|
11
|
-
|
|
16
|
+
const scoped = useContext(ListingScopeContext);
|
|
17
|
+
const message = (_jsx("p", { className: tone === undefined ? 'pane-message' : `pane-message ${tone}`, role: live ? 'status' : undefined, children: _jsx("span", { className: "pane-message-text", children: children }) }));
|
|
18
|
+
return scoped ? message : _jsx("div", { className: "listing-root", children: message });
|
|
12
19
|
}
|
package/dist/listing/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { type SortDirection } from '../labels/listing.js';
|
|
11
11
|
export { CurrentDot, type CurrentDotProps } from './CurrentDot.js';
|
|
12
12
|
export { EmptyState, type EmptyStateProps, type EmptyStateStep } from './EmptyState.js';
|
|
13
|
-
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn, type CellProps, type CellTone, type ColumnSort, type ListingColumn, type ListingProps, type PathCellProps, type RowCursor, type RowProps, type StateMarkProps, type StateTone, type StripProps, type WellColumnProps } from './Listing.js';
|
|
13
|
+
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn, type CellProps, type CellTone, type ColumnSort, type ListingColumn, type ListingProps, type PathCellProps, type RowCursor, type RowProps, type RowRadio, type StateMarkProps, type StateTone, type StripProps, type WellColumnProps } from './Listing.js';
|
|
14
14
|
export { PaneMessage, type PaneMessageProps, type PaneMessageTone } from './PaneMessage.js';
|
|
15
15
|
export { pathParts, type PathParts } from './PathParts.logic.js';
|
|
16
16
|
export { TimelineCell, TimelineScale, type TimelineCellProps, type TimelineScaleProps, type TimelineTick } from './Timeline.js';
|
package/dist/listing/listing.css
CHANGED
|
@@ -734,6 +734,7 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
734
734
|
.disclosure,
|
|
735
735
|
.settings-sidebar-page,
|
|
736
736
|
.settings-sidebar-subsection,
|
|
737
|
+
.sectioned-dialog-nav-row,
|
|
737
738
|
.quiet-control,
|
|
738
739
|
.quiet-track-item,
|
|
739
740
|
.toggle-chip
|
|
@@ -1019,7 +1020,7 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
1019
1020
|
and an app's own placement of the label wins. */
|
|
1020
1021
|
:where(
|
|
1021
1022
|
.pane-listing:is(.listing-root, .listing-root *):has(> .row):not(
|
|
1022
|
-
:has(> .row > .row-icon:not(:empty))
|
|
1023
|
+
:has(> .row > .row-icon:not(:empty), > .row > .row-pick)
|
|
1023
1024
|
)
|
|
1024
1025
|
)
|
|
1025
1026
|
> .pane-columns
|
|
@@ -1712,12 +1713,16 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
1712
1713
|
|
|
1713
1714
|
/* A warning (.warning): the warning tone's TriangleAlert, drawn as a mask
|
|
1714
1715
|
in --warning as the danger line's glyph is, then the words in --text. A
|
|
1715
|
-
host that draws its own glyph first (an svg
|
|
1716
|
+
host that draws its own glyph first (an svg, inside a PaneMessage's
|
|
1717
|
+
words too) gets no second one. */
|
|
1716
1718
|
:where(.listing-root) .pane-message.warning {
|
|
1717
1719
|
color: var(--text);
|
|
1718
1720
|
}
|
|
1719
1721
|
|
|
1720
|
-
:where(.listing-root)
|
|
1722
|
+
:where(.listing-root)
|
|
1723
|
+
.pane-message.warning:not(
|
|
1724
|
+
:has(> svg:first-child, > .pane-message-text > svg:first-child)
|
|
1725
|
+
)::before {
|
|
1721
1726
|
content: '';
|
|
1722
1727
|
flex: none;
|
|
1723
1728
|
width: var(--icon-md);
|
|
@@ -1727,11 +1732,19 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
1727
1732
|
center / contain no-repeat;
|
|
1728
1733
|
}
|
|
1729
1734
|
|
|
1730
|
-
:where(.listing-root) .pane-message.warning > svg:first-child
|
|
1735
|
+
:where(.listing-root) .pane-message.warning > svg:first-child,
|
|
1736
|
+
:where(.listing-root) .pane-message.warning > .pane-message-text > svg:first-child {
|
|
1731
1737
|
flex: none;
|
|
1732
1738
|
color: var(--warning);
|
|
1733
1739
|
}
|
|
1734
1740
|
|
|
1741
|
+
/* A refusal's own glyph takes the danger tone, as the drawn one does. */
|
|
1742
|
+
:where(.listing-root) .pane-message.danger > svg:first-child,
|
|
1743
|
+
:where(.listing-root) .pane-message.danger > .pane-message-text > svg:first-child {
|
|
1744
|
+
flex: none;
|
|
1745
|
+
color: var(--danger);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1735
1748
|
/* A line that says a listing has no rows (`.empty`, Listing's `empty`)
|
|
1736
1749
|
reads as a quiet row in the rows' place: it starts where a row's icon
|
|
1737
1750
|
starts, in the rows' own typeface and size (the host's, as the rows'
|
|
@@ -1742,6 +1755,20 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
1742
1755
|
line-height: var(--line-height-compact);
|
|
1743
1756
|
}
|
|
1744
1757
|
|
|
1758
|
+
/* A message's words in one box (PaneMessage), so text and inline code
|
|
1759
|
+
flow as a sentence beside the glyph instead of as separate flex items.
|
|
1760
|
+
A glyph the host leads the words with lands in that box too: it keeps
|
|
1761
|
+
the glyph's place, the message's gap before the words, on the text's
|
|
1762
|
+
middle. */
|
|
1763
|
+
:where(.listing-root) .pane-message-text {
|
|
1764
|
+
min-width: 0;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
:where(.listing-root) .pane-message-text > svg:first-child {
|
|
1768
|
+
margin-inline-end: var(--space-4);
|
|
1769
|
+
vertical-align: middle;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1745
1772
|
:where(.listing-root) .pane-message code {
|
|
1746
1773
|
font-family: var(--font-mono);
|
|
1747
1774
|
}
|
|
@@ -2531,6 +2558,29 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
2531
2558
|
border-color: var(--border-strong);
|
|
2532
2559
|
}
|
|
2533
2560
|
|
|
2561
|
+
/* A row that is one choice of several (Row's `radio`): the radio in the
|
|
2562
|
+
icon column and the name after it, both in the name's cell, which spans
|
|
2563
|
+
the two columns as the strip's name label does. The words keep the
|
|
2564
|
+
name's ellipsis; the radio keeps its size. */
|
|
2565
|
+
:where(.listing-root) .row > .row-name.row-pick {
|
|
2566
|
+
grid-column: 1 / span 2;
|
|
2567
|
+
display: grid;
|
|
2568
|
+
grid-template-columns: var(--icon-column) minmax(0, 1fr);
|
|
2569
|
+
align-items: center;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
:where(.listing-root) .row-pick > .row-radio {
|
|
2573
|
+
justify-self: start;
|
|
2574
|
+
margin: 0;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
:where(.listing-root) .row-pick > .row-pick-name {
|
|
2578
|
+
min-width: 0;
|
|
2579
|
+
overflow: hidden;
|
|
2580
|
+
text-overflow: ellipsis;
|
|
2581
|
+
white-space: nowrap;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2534
2584
|
/* A row that stands out from its peers (Row's `emphasis`): its name in the
|
|
2535
2585
|
strong weight. */
|
|
2536
2586
|
:where(.listing-root) .row.row-emphasis > .row-name {
|
|
@@ -2623,3 +2673,33 @@ button.crumb-label.crumb-siblings > svg {
|
|
|
2623
2673
|
transform: translateY(-50%);
|
|
2624
2674
|
white-space: nowrap;
|
|
2625
2675
|
}
|
|
2676
|
+
|
|
2677
|
+
/* ---- The visual bell (PaneBox's bell) ----
|
|
2678
|
+
A key that could not act shoves the pane's cursor row sideways for one
|
|
2679
|
+
beat, the wrong-password shake. The parity classes alternate `bell-0`
|
|
2680
|
+
and `bell-1` on consecutive rings (useBellBeat), on keyframes of two
|
|
2681
|
+
names with the same steps (menu.css), so every refused key shoves again,
|
|
2682
|
+
the repeats of a held one included. Without motion the row flips to the
|
|
2683
|
+
selection fill for the beat instead, its words in the selection's. */
|
|
2684
|
+
:where(.listing-root) .pane.bell-0 .row.cursor {
|
|
2685
|
+
animation: row-nudge-a var(--duration-slow) var(--ease-in-out);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
:where(.listing-root) .pane.bell-1 .row.cursor {
|
|
2689
|
+
animation: row-nudge-b var(--duration-slow) var(--ease-in-out);
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2693
|
+
:where(.listing-root) .pane:is(.bell-0, .bell-1) .row.cursor {
|
|
2694
|
+
animation: none;
|
|
2695
|
+
--row-fill: var(--selected-bg);
|
|
2696
|
+
background: var(--row-fill);
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
:where(.listing-root)
|
|
2700
|
+
.pane:is(.bell-0, .bell-1)
|
|
2701
|
+
.row.cursor
|
|
2702
|
+
:is(.row-icon, .row-name, .row-meta) {
|
|
2703
|
+
color: var(--on-selected);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
package/dist/menu/Menu.d.ts
CHANGED
|
@@ -38,8 +38,32 @@ export interface MenuHeadingEntry {
|
|
|
38
38
|
readonly kind: 'heading';
|
|
39
39
|
readonly label: string;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* An item that opens a submenu beside it ("Copy As", opening Path and File
|
|
43
|
+
* URL): its glyph and words, and a chevron at its end in place of a chord.
|
|
44
|
+
* It runs nothing itself; its submenu's items do.
|
|
45
|
+
*/
|
|
46
|
+
export interface MenuSubmenuEntry {
|
|
47
|
+
readonly kind: 'submenu';
|
|
48
|
+
/** Names the item; unique in the menu, its submenus' items included. Never passed to `onPick`. */
|
|
49
|
+
readonly id: string;
|
|
50
|
+
/** The submenu's name, in words: "Copy As", "Open With". */
|
|
51
|
+
readonly label: string;
|
|
52
|
+
/** A lucide glyph in the icon column. */
|
|
53
|
+
readonly icon?: LucideIcon;
|
|
54
|
+
/** Anything else in the icon column, when `icon` is absent. */
|
|
55
|
+
readonly mark?: ReactNode;
|
|
56
|
+
/** Listed but not openable now: dimmed and passed over by the keys. Say why in `tip`. */
|
|
57
|
+
readonly disabled?: boolean;
|
|
58
|
+
/** More about the item, or why it is disabled: its tooltip and description. */
|
|
59
|
+
readonly tip?: string;
|
|
60
|
+
/** The submenu's entries, in order: items, separators, and headings, never another submenu. */
|
|
61
|
+
readonly entries: readonly MenuLeafEntry[];
|
|
62
|
+
}
|
|
63
|
+
/** An entry a submenu can hold: any but another submenu, so a menu nests one level deep. */
|
|
64
|
+
export type MenuLeafEntry = MenuItemEntry | MenuSeparatorEntry | MenuHeadingEntry;
|
|
41
65
|
/** One entry of a menu, in order. */
|
|
42
|
-
export type MenuEntry =
|
|
66
|
+
export type MenuEntry = MenuLeafEntry | MenuSubmenuEntry;
|
|
43
67
|
/** Props for {@link Menu}. */
|
|
44
68
|
export interface MenuProps {
|
|
45
69
|
/** The menu's accessible name: "Actions", "Other versions". */
|
|
@@ -54,11 +78,21 @@ export interface MenuProps {
|
|
|
54
78
|
* toggle it. Used when `at` is absent.
|
|
55
79
|
*/
|
|
56
80
|
readonly anchor?: HTMLElement | null;
|
|
57
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* The item the cursor starts on (the current one), in the menu itself,
|
|
83
|
+
* not a submenu; the first that can run when absent.
|
|
84
|
+
*/
|
|
58
85
|
readonly initial?: string | null;
|
|
59
86
|
/** The small size, for a menu of short commands (`.folder-menu-compact`). */
|
|
60
87
|
readonly compact?: boolean;
|
|
61
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* The direction it reads in, which its keys, a submenu's side, and the
|
|
90
|
+
* chevron follow; when absent, the direction of `anchor`, or of the place
|
|
91
|
+
* it is rendered in, as it opens (the document body it is drawn on may
|
|
92
|
+
* read the other way).
|
|
93
|
+
*/
|
|
94
|
+
readonly dir?: 'ltr' | 'rtl';
|
|
95
|
+
/** Runs an item that can run, by its id, a submenu's items included; the caller closes the menu. */
|
|
62
96
|
readonly onPick: (id: string) => void;
|
|
63
97
|
/**
|
|
64
98
|
* Closes the menu, saying how it was dismissed: by a key in it (Escape,
|
|
@@ -72,18 +106,28 @@ export interface MenuProps {
|
|
|
72
106
|
* dropped from an element (a crumb's ⌄, an Actions button): each item its
|
|
73
107
|
* glyph, its words, and its chord as key caps; a destructive one in the
|
|
74
108
|
* danger tone; a setting with its check; the current place with its dot;
|
|
75
|
-
* separators and group headings between them
|
|
109
|
+
* separators and group headings between them; and items that open a
|
|
110
|
+
* submenu beside them, one level deep. It is the menu look
|
|
76
111
|
* (`.folder-menu`) drawn through a portal on the document's body (or the
|
|
77
112
|
* element shown full screen), so no pane or dialog clips it, placed inside
|
|
78
113
|
* the window (`placeMenu`); React still carries its events to its owner.
|
|
79
114
|
*
|
|
80
115
|
* It takes the focus and holds the keys while open (`menuKeyAction`: ↑ ↓,
|
|
81
|
-
* Home, End, Return and Space, Escape and Tab), which travel no
|
|
82
|
-
* neither a dialog nor the page hears them; `data-native-keyboard`
|
|
83
|
-
* the browser-key guard and a page's own key handlers out
|
|
116
|
+
* Home, End, Return and Space, → and ←, Escape and Tab), which travel no
|
|
117
|
+
* further, so neither a dialog nor the page hears them; `data-native-keyboard`
|
|
118
|
+
* keeps the browser-key guard and a page's own key handlers out
|
|
84
119
|
* (`isNativeKeyboardTarget`), and `data-overlay` marks it an open overlay
|
|
85
120
|
* while it shows. A press on it never takes the focus from it; a press or
|
|
86
121
|
* a focus anywhere else closes it. A menu taller than the window less its
|
|
87
122
|
* margins scrolls, and the keys keep the cursor's item in view.
|
|
123
|
+
*
|
|
124
|
+
* A submenu opens beside its item (on the inline-end side, or the other
|
|
125
|
+
* when the window has no room there) when the pointer rests on the item or
|
|
126
|
+
* presses it, showing without the keys, or with the keys and its cursor on
|
|
127
|
+
* its first item that can run on → (← in a right-to-left page), Return,
|
|
128
|
+
* or Space. ← goes back to its item, and Escape closes the submenu alone;
|
|
129
|
+
* Tab closes the whole menu. The pointer crossing other items on its way
|
|
130
|
+
* into the submenu leaves it open for a moment, and moving over the
|
|
131
|
+
* submenu gives it the keys.
|
|
88
132
|
*/
|
|
89
|
-
export declare function Menu({ label, entries, at, anchor, initial, compact, onPick, onClose }: MenuProps): ReactElement;
|
|
133
|
+
export declare function Menu({ label, entries, at, anchor, initial, compact, dir: dirGiven, onPick, onClose }: MenuProps): ReactElement;
|