@bigpixelrocket/uiok 0.3.0 → 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 +23 -1
- package/dist/dialog/ConfirmDialog.d.ts +7 -1
- package/dist/dialog/ConfirmDialog.js +2 -2
- package/dist/dialog/ProgressDialog.d.ts +7 -1
- package/dist/dialog/ProgressDialog.js +2 -2
- package/dist/dialog/TypedNameDialog.d.ts +8 -0
- 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/index.d.ts +9 -6
- package/dist/field/index.js +9 -6
- package/dist/frame/Dock.js +1 -1
- package/dist/frame/SidebarResizer.js +1 -1
- package/dist/frame/Tree.d.ts +9 -2
- package/dist/frame/Tree.js +29 -6
- package/dist/labels/UiokLabels.d.ts +3 -0
- package/dist/labels/UiokLabels.js +3 -1
- package/dist/labels/index.d.ts +1 -0
- package/dist/labels/index.js +1 -0
- package/dist/labels/viewer.d.ts +193 -0
- package/dist/labels/viewer.js +124 -0
- package/dist/listing/PaneMessage.d.ts +28 -0
- package/dist/listing/PaneMessage.js +12 -0
- package/dist/listing/index.d.ts +4 -2
- package/dist/listing/index.js +4 -2
- package/dist/styles.css +3 -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/themes.generated.css +1 -0
- package/dist/themes/tokens.js +4 -1
- 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,89 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, use, useId } from 'react';
|
|
3
|
+
import { VisuallyHidden } from '../VisuallyHidden.js';
|
|
4
|
+
import { labelHelp } from './labelHelp.js';
|
|
5
|
+
/** The wiring of the row a control stands in; null outside a `FieldRow`. */
|
|
6
|
+
const FieldRowContext = createContext(null);
|
|
7
|
+
/**
|
|
8
|
+
* The attributes a control takes from the `FieldRow` it stands in, with
|
|
9
|
+
* any it sets itself: its id (the row's, which its label names, so in a row
|
|
10
|
+
* give the id to `FieldRow`), `aria-describedby` (its own ids first), and
|
|
11
|
+
* `aria-invalid`.
|
|
12
|
+
*/
|
|
13
|
+
export function useFieldWiring(own) {
|
|
14
|
+
const row = use(FieldRowContext);
|
|
15
|
+
const describedBy = [own.describedBy, row?.describedBy].filter(Boolean).join(' ');
|
|
16
|
+
const invalid = own.invalid ?? row?.invalid ?? false;
|
|
17
|
+
return {
|
|
18
|
+
id: row?.id ?? own.id,
|
|
19
|
+
'aria-describedby': describedBy === '' ? undefined : describedBy,
|
|
20
|
+
'aria-invalid': invalid ? true : undefined
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A form laid out as rows of a label and its value on one label column,
|
|
25
|
+
* each label centred on its control's first line. Draws `.field-grid`.
|
|
26
|
+
*/
|
|
27
|
+
export function FieldGrid({ children, labelWidth }) {
|
|
28
|
+
return (_jsx("div", { className: "field-grid", style: labelWidth === undefined
|
|
29
|
+
? undefined
|
|
30
|
+
: { '--field-label-width': labelWidth }, children: children }));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One row of a `FieldGrid`: the label, then the value with its note and
|
|
34
|
+
* problem under it. The one control inside takes the label's id, the
|
|
35
|
+
* problem, note, and help as its description, and `aria-invalid` while a
|
|
36
|
+
* problem stands, with no wiring by the app. Draws
|
|
37
|
+
* `.field-label` and `.field-value` with `.field-note` and `.field-problem`.
|
|
38
|
+
*/
|
|
39
|
+
export function FieldRow({ label, labelDetail, help, children, note, problem, group = false, id }) {
|
|
40
|
+
const made = useId();
|
|
41
|
+
const controlId = id ?? `${made}-control`;
|
|
42
|
+
const labelId = `${made}-label`;
|
|
43
|
+
const noteId = `${made}-note`;
|
|
44
|
+
const problemId = `${made}-problem`;
|
|
45
|
+
const helpId = `${made}-help`;
|
|
46
|
+
const hasNote = note !== undefined && note !== null && note !== false;
|
|
47
|
+
const hasProblem = problem !== undefined && problem !== null && problem !== false;
|
|
48
|
+
const helpParts = labelHelp(help);
|
|
49
|
+
// The help is read through aria-describedby with the note and problem, not
|
|
50
|
+
// as aria-description, which aria-describedby would override.
|
|
51
|
+
const describedBy = [hasProblem ? problemId : '', hasNote ? noteId : '', help ? helpId : '']
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(' ');
|
|
54
|
+
const wiring = {
|
|
55
|
+
id: controlId,
|
|
56
|
+
describedBy: describedBy === '' ? undefined : describedBy,
|
|
57
|
+
invalid: hasProblem
|
|
58
|
+
};
|
|
59
|
+
const labelBody = (_jsxs(_Fragment, { children: [label, labelDetail === undefined ? null : (_jsx("span", { className: "settings-label-detail", children: labelDetail }))] }));
|
|
60
|
+
return (_jsxs(_Fragment, { children: [group ? (_jsx("span", { className: "field-label", id: labelId, ...helpParts.label, children: labelBody })) : (_jsx("label", { className: "field-label", htmlFor: controlId, id: labelId, ...helpParts.label, children: labelBody })), _jsxs("div", { "aria-describedby": group ? wiring.describedBy : undefined, "aria-labelledby": group ? labelId : undefined, className: "field-value", role: group ? 'group' : undefined, children: [_jsx(FieldRowContext, { value: group ? null : wiring, children: children }), hasProblem ? _jsx(FieldProblem, { id: problemId, children: problem }) : null, hasNote ? _jsx(FieldNote, { id: noteId, children: note }) : null, help ? _jsx(VisuallyHidden, { id: helpId, children: help }) : null] })] }));
|
|
61
|
+
}
|
|
62
|
+
/** One line of a row's value (a field and a choice beside it), at least a control high. Draws `.field-option`. */
|
|
63
|
+
export function FieldOption({ children }) {
|
|
64
|
+
return _jsx("div", { className: "field-option", children: children });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One short line under a control on what the current choice does ("Worn
|
|
68
|
+
* while the system is light."). Draws `.field-note`.
|
|
69
|
+
*/
|
|
70
|
+
export function FieldNote({ children, id }) {
|
|
71
|
+
return (_jsx("p", { className: "field-note", id: id, children: children }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What is wrong with a value, as a status line led by the danger glyph.
|
|
75
|
+
* Name it in the control's `aria-describedby` (`FieldRow` does). Draws
|
|
76
|
+
* `.field-problem`.
|
|
77
|
+
*/
|
|
78
|
+
export function FieldProblem({ children, id }) {
|
|
79
|
+
return (_jsx("p", { className: "field-problem", id: id, children: children }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A group of choices under its legend, 4px apart, or in `columns`. Draws
|
|
83
|
+
* `fieldset.field-group` (`.field-columns`).
|
|
84
|
+
*/
|
|
85
|
+
export function FieldGroup({ legend, legendHidden = false, children, columns, note, problem }) {
|
|
86
|
+
const made = useId();
|
|
87
|
+
const hasProblem = problem !== undefined && problem !== null && problem !== false;
|
|
88
|
+
return (_jsxs("fieldset", { "aria-describedby": hasProblem ? `${made}-problem` : undefined, className: columns === undefined ? 'field-group' : 'field-group field-columns', style: columns === undefined ? undefined : { '--field-columns': columns }, children: [_jsx("legend", { className: legendHidden ? 'visually-hidden' : undefined, children: legend }), children, hasProblem ? _jsx(FieldProblem, { id: `${made}-problem`, children: problem }) : null, note === undefined || note === null ? null : _jsx(FieldNote, { children: note })] }));
|
|
89
|
+
}
|
package/dist/field/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Form controls
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `labelHelp` puts a control's help in its
|
|
2
|
+
* Form controls as components over the shared field look (`field.css`):
|
|
3
|
+
* `TextField`, `TextArea`, `Select`, `FieldBox`, and `FieldEditor` in the
|
|
4
|
+
* field's well; `Check`, `Radio`, and `Switch`; `Range` and `Meter`; and the
|
|
5
|
+
* form's layout, `FieldGrid` of `FieldRow`s (label, value, note, problem,
|
|
6
|
+
* wired to the control on their own), `FieldOption`, `FieldGroup`,
|
|
7
|
+
* `FieldNote`, and `FieldProblem`. `labelHelp` puts a control's help in its
|
|
8
|
+
* label's tooltip; `RestoreDefault` sets a changed setting back.
|
|
8
9
|
*/
|
|
9
10
|
export { Check, type CheckProps } from './Check.js';
|
|
11
|
+
export { FieldBox, FieldEditor, Meter, Radio, Range, RestoreDefault, Select, TextArea, TextField, type FieldBoxProps, type FieldEditorProps, type FieldSize, type FieldTone, type FieldWidth, type MeterProps, type RadioProps, type RangeProps, type RestoreDefaultProps, type SelectOption, type SelectOptionGroup, type SelectProps, type TextAreaProps, type TextFieldProps } from './Controls.js';
|
|
12
|
+
export { FieldGrid, FieldGroup, FieldNote, FieldOption, FieldProblem, FieldRow, useFieldWiring, type FieldGridProps, type FieldGroupProps, type FieldMessageProps, type FieldOptionProps, type FieldRowProps, type FieldRowWiring } from './FieldLayout.js';
|
|
10
13
|
export { labelHelp, type LabelHelp } from './labelHelp.js';
|
|
11
14
|
export { Switch, type SwitchProps } from './Switch.js';
|
package/dist/field/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Form controls
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `labelHelp` puts a control's help in its
|
|
2
|
+
* Form controls as components over the shared field look (`field.css`):
|
|
3
|
+
* `TextField`, `TextArea`, `Select`, `FieldBox`, and `FieldEditor` in the
|
|
4
|
+
* field's well; `Check`, `Radio`, and `Switch`; `Range` and `Meter`; and the
|
|
5
|
+
* form's layout, `FieldGrid` of `FieldRow`s (label, value, note, problem,
|
|
6
|
+
* wired to the control on their own), `FieldOption`, `FieldGroup`,
|
|
7
|
+
* `FieldNote`, and `FieldProblem`. `labelHelp` puts a control's help in its
|
|
8
|
+
* label's tooltip; `RestoreDefault` sets a changed setting back.
|
|
8
9
|
*/
|
|
9
10
|
export { Check } from './Check.js';
|
|
11
|
+
export { FieldBox, FieldEditor, Meter, Radio, Range, RestoreDefault, Select, TextArea, TextField } from './Controls.js';
|
|
12
|
+
export { FieldGrid, FieldGroup, FieldNote, FieldOption, FieldProblem, FieldRow, useFieldWiring } from './FieldLayout.js';
|
|
10
13
|
export { labelHelp } from './labelHelp.js';
|
|
11
14
|
export { Switch } from './Switch.js';
|
package/dist/frame/Dock.js
CHANGED
|
@@ -107,7 +107,7 @@ export function Dock({ open, label, height, pageMin = 160, active = false, tone,
|
|
|
107
107
|
const classes = ['pane', 'window-dock', active ? 'active' : '', open ? '' : 'closed']
|
|
108
108
|
.filter(Boolean)
|
|
109
109
|
.join(' ');
|
|
110
|
-
return (_jsxs("section", { "aria-label": label, className: classes, "data-tone": tone, ref: attach, style: { height: shown }, ...handlers, children: [onResize === undefined ? null : (_jsx("div", { "aria-label": resizeLabel, "aria-orientation": "horizontal",
|
|
110
|
+
return (_jsxs("section", { "aria-label": label, className: classes, "data-tone": tone, ref: attach, style: { height: shown }, ...handlers, children: [onResize === undefined ? null : (_jsx("div", { "aria-label": resizeLabel, "aria-orientation": "horizontal", className: "pane-splitter", onPointerDown: start, role: "separator" })), drawn(bar) ? _jsx("div", { className: "dock-bar", children: bar }) : null, _jsx("div", { className: "dock-body", children: children })] }));
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* A dock's log: its entries over a hairline each, the newest at the foot;
|
|
@@ -39,5 +39,5 @@ export function SidebarResizer({ width, min, max, pageMin, label, onResize, onRe
|
|
|
39
39
|
handle.addEventListener('pointerup', end);
|
|
40
40
|
handle.addEventListener('pointercancel', end);
|
|
41
41
|
};
|
|
42
|
-
return (_jsx("div", { "aria-label": label, "aria-orientation": "vertical",
|
|
42
|
+
return (_jsx("div", { "aria-label": label, "aria-orientation": "vertical", className: "window-frame-resizer", onPointerDown: start, role: "separator" }));
|
|
43
43
|
}
|
package/dist/frame/Tree.d.ts
CHANGED
|
@@ -100,7 +100,14 @@ export interface TreeToolProps {
|
|
|
100
100
|
readonly icon?: LucideIcon;
|
|
101
101
|
/** Its words. */
|
|
102
102
|
readonly text?: ReactNode;
|
|
103
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Its key among the tree's rows, which joins it to the pane's cursor
|
|
105
|
+
* (`RowCursorContext`) as a `TreeRow` is: the cursor's keys reach it and
|
|
106
|
+
* the pointer moves the cursor to it. Without one it stands outside the
|
|
107
|
+
* cursor, which `cursor` then draws.
|
|
108
|
+
*/
|
|
109
|
+
readonly rowKey?: string;
|
|
110
|
+
/** The pane's cursor stands on it, for a tool row without a `rowKey`. */
|
|
104
111
|
readonly cursor?: boolean;
|
|
105
112
|
/** Its control after the words: a `TreeFilterInput`, a pager, an action. */
|
|
106
113
|
readonly children?: ReactNode;
|
|
@@ -110,7 +117,7 @@ export interface TreeToolProps {
|
|
|
110
117
|
* size: a filter field, a pager, a note, a heading, or a failed read with
|
|
111
118
|
* its action.
|
|
112
119
|
*/
|
|
113
|
-
export declare function TreeTool({ kind, level, icon: Icon, text, cursor, children }: TreeToolProps): ReactElement;
|
|
120
|
+
export declare function TreeTool({ kind, level, icon: Icon, text, rowKey, cursor: cursorOn, children }: TreeToolProps): ReactElement;
|
|
114
121
|
/** Props for {@link TreeFilterInput}. */
|
|
115
122
|
export interface TreeFilterInputProps {
|
|
116
123
|
readonly value: string;
|
package/dist/frame/Tree.js
CHANGED
|
@@ -40,9 +40,14 @@ export function TreeList({ label, ref, children, ...handlers }) {
|
|
|
40
40
|
return;
|
|
41
41
|
const key = cursor.current();
|
|
42
42
|
const id = key === null ? null : rowId(tree, key);
|
|
43
|
-
// One lookup by id
|
|
44
|
-
//
|
|
45
|
-
|
|
43
|
+
// One lookup by id in the tree's own root (the document, or the shadow
|
|
44
|
+
// root it is mounted in, where the document cannot see), never a scan
|
|
45
|
+
// of the rows; the tree's prefix makes the id unique there. A tree not
|
|
46
|
+
// yet attached has no such root, and nothing to name.
|
|
47
|
+
// Asked by shape, not instanceof, so a tree React renders into another
|
|
48
|
+
// window's document (a same-origin frame) finds its row too.
|
|
49
|
+
const root = element.getRootNode();
|
|
50
|
+
const row = id === null || typeof root.getElementById !== 'function' ? null : root.getElementById(id);
|
|
46
51
|
const drawnRow = row !== null && element.contains(row);
|
|
47
52
|
if (drawnRow && id !== null)
|
|
48
53
|
element.setAttribute('aria-activedescendant', id);
|
|
@@ -113,17 +118,35 @@ export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name,
|
|
|
113
118
|
* size: a filter field, a pager, a note, a heading, or a failed read with
|
|
114
119
|
* its action.
|
|
115
120
|
*/
|
|
116
|
-
export function TreeTool({ kind = 'tool', level = 0, icon: Icon, text, cursor = false, children }) {
|
|
121
|
+
export function TreeTool({ kind = 'tool', level = 0, icon: Icon, text, rowKey, cursor: cursorOn = false, children }) {
|
|
122
|
+
const cursor = useContext(RowCursorContext);
|
|
123
|
+
const tree = useContext(TreeIdContext);
|
|
124
|
+
const current = useSyncExternalStore(cursor.subscribe, () => rowKey !== undefined && cursor.current() === rowKey);
|
|
125
|
+
useLayoutEffect(() => {
|
|
126
|
+
if (rowKey === undefined)
|
|
127
|
+
return;
|
|
128
|
+
cursor.rowsChanged?.();
|
|
129
|
+
tree?.rowsChanged();
|
|
130
|
+
return () => {
|
|
131
|
+
cursor.rowsChanged?.();
|
|
132
|
+
tree?.rowsChanged();
|
|
133
|
+
};
|
|
134
|
+
}, [cursor, rowKey, tree]);
|
|
117
135
|
const classes = [
|
|
118
136
|
'tree-tool',
|
|
119
137
|
kind === 'note' ? 'tree-note' : '',
|
|
120
138
|
kind === 'heading' ? 'tree-heading' : '',
|
|
121
139
|
kind === 'danger' ? 'danger' : '',
|
|
122
|
-
|
|
140
|
+
current || (rowKey === undefined && cursorOn) ? 'cursor' : ''
|
|
123
141
|
]
|
|
124
142
|
.filter(Boolean)
|
|
125
143
|
.join(' ');
|
|
126
|
-
return (_jsxs("div", { className: classes,
|
|
144
|
+
return (_jsxs("div", { className: classes, "data-row-key": rowKey, id: rowKey === undefined || tree === null ? undefined : rowId(tree.id, rowKey), onPointerMove: rowKey === undefined
|
|
145
|
+
? undefined
|
|
146
|
+
: () => {
|
|
147
|
+
if (!current)
|
|
148
|
+
cursor.point(rowKey);
|
|
149
|
+
}, "aria-level": rowKey === undefined ? undefined : level + 1, role: rowKey !== undefined ? 'treeitem' : kind === 'danger' ? 'alert' : undefined, style: levelStyle(level), children: [Icon === undefined ? null : (_jsx("span", { "aria-hidden": true, className: "tree-note-glyph", children: _jsx(Icon, { size: ICON_MD }) })), text === undefined ? null : (_jsx("span", { className: "tree-note-text", role: rowKey !== undefined && kind === 'danger' ? 'alert' : undefined, children: text })), children] }));
|
|
127
150
|
}
|
|
128
151
|
/**
|
|
129
152
|
* A tree's filter field: a bare field that fills its `TreeTool` row, the
|
|
@@ -10,6 +10,7 @@ import { type PaneTabsLabels } from './paneTabs.js';
|
|
|
10
10
|
import { type SelectAllLabels } from './selectAll.js';
|
|
11
11
|
import { type SettingsLabels } from './settings.js';
|
|
12
12
|
import { type TerminalLabels } from './terminal.js';
|
|
13
|
+
import { type ViewerLabels } from './viewer.js';
|
|
13
14
|
/**
|
|
14
15
|
* Every chrome string UIOK's components share across instances, grouped by
|
|
15
16
|
* area: key names, and, as areas arrive, verbs such as Cancel and More.
|
|
@@ -42,6 +43,8 @@ export interface UiokLabels {
|
|
|
42
43
|
readonly paneTabs: PaneTabsLabels;
|
|
43
44
|
/** The Settings dialog's title, sidebar, and Done, and the Appearance page's words (`SettingsDialog`, `AppearanceSettings`). */
|
|
44
45
|
readonly settings: SettingsLabels;
|
|
46
|
+
/** The file viewer's modes, facts, notices, and each view's words and formats (`@bigpixelrocket/uiok/viewer`). */
|
|
47
|
+
readonly viewer: ViewerLabels;
|
|
45
48
|
}
|
|
46
49
|
/** The English labels every component falls back to without a `UiokProvider`. */
|
|
47
50
|
export declare const DEFAULT_LABELS: UiokLabels;
|
|
@@ -18,6 +18,7 @@ import { DEFAULT_PANE_TABS_LABELS } from './paneTabs.js';
|
|
|
18
18
|
import { DEFAULT_SELECT_ALL_LABELS } from './selectAll.js';
|
|
19
19
|
import { DEFAULT_SETTINGS_LABELS } from './settings.js';
|
|
20
20
|
import { DEFAULT_TERMINAL_LABELS } from './terminal.js';
|
|
21
|
+
import { DEFAULT_VIEWER_LABELS } from './viewer.js';
|
|
21
22
|
/** The English labels every component falls back to without a `UiokProvider`. */
|
|
22
23
|
export const DEFAULT_LABELS = {
|
|
23
24
|
keys: DEFAULT_KEY_LABELS,
|
|
@@ -31,5 +32,6 @@ export const DEFAULT_LABELS = {
|
|
|
31
32
|
selectAll: DEFAULT_SELECT_ALL_LABELS,
|
|
32
33
|
terminal: DEFAULT_TERMINAL_LABELS,
|
|
33
34
|
paneTabs: DEFAULT_PANE_TABS_LABELS,
|
|
34
|
-
settings: DEFAULT_SETTINGS_LABELS
|
|
35
|
+
settings: DEFAULT_SETTINGS_LABELS,
|
|
36
|
+
viewer: DEFAULT_VIEWER_LABELS
|
|
35
37
|
};
|
package/dist/labels/index.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export { DEFAULT_PANE_TABS_LABELS, type PaneTabsLabels } from './paneTabs.js';
|
|
|
11
11
|
export { DEFAULT_SELECT_ALL_LABELS, type SelectAllLabels } from './selectAll.js';
|
|
12
12
|
export { DEFAULT_SETTINGS_LABELS, type AppearanceLabels, type AppearanceMode, type SettingsLabels } from './settings.js';
|
|
13
13
|
export { DEFAULT_TERMINAL_LABELS, type TerminalLabels } from './terminal.js';
|
|
14
|
+
export { DEFAULT_VIEWER_LABELS, type ViewerContentLabels, type ViewerLabels, type ViewerModeLabels } from './viewer.js';
|
|
14
15
|
export { DEFAULT_LABELS, type UiokLabels } from './UiokLabels.js';
|
|
15
16
|
export { mergeLabels, UiokProvider, useLabels, type LabelsOverride, type UiokLabelsOverride, type UiokProviderProps } from './UiokProvider.js';
|
package/dist/labels/index.js
CHANGED
|
@@ -11,5 +11,6 @@ export { DEFAULT_PANE_TABS_LABELS } from './paneTabs.js';
|
|
|
11
11
|
export { DEFAULT_SELECT_ALL_LABELS } from './selectAll.js';
|
|
12
12
|
export { DEFAULT_SETTINGS_LABELS } from './settings.js';
|
|
13
13
|
export { DEFAULT_TERMINAL_LABELS } from './terminal.js';
|
|
14
|
+
export { DEFAULT_VIEWER_LABELS } from './viewer.js';
|
|
14
15
|
export { DEFAULT_LABELS } from './UiokLabels.js';
|
|
15
16
|
export { mergeLabels, UiokProvider, useLabels } from './UiokProvider.js';
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the read-only file viewer repeats for every file: its modes,
|
|
3
|
+
* the facts line, change notices, each view's status line, buttons, and
|
|
4
|
+
* fallbacks, and the number, size, and date formats it writes them with.
|
|
5
|
+
* The file's name and contents are the app's.
|
|
6
|
+
*/
|
|
7
|
+
/** The names of the viewer's modes in its switcher (`ViewerWindow`). */
|
|
8
|
+
export interface ViewerModeLabels {
|
|
9
|
+
/** A text file's text: "Text". */
|
|
10
|
+
readonly text: string;
|
|
11
|
+
/** An SVG's markup: "Source". */
|
|
12
|
+
readonly source: string;
|
|
13
|
+
/** Any file's bytes: "Hex". */
|
|
14
|
+
readonly hex: string;
|
|
15
|
+
/** An image: "Image". */
|
|
16
|
+
readonly image: string;
|
|
17
|
+
/** Audio or video: "Player". */
|
|
18
|
+
readonly player: string;
|
|
19
|
+
/** A PDF: "Document". */
|
|
20
|
+
readonly document: string;
|
|
21
|
+
}
|
|
22
|
+
/** What kind of file the facts line names, given the format where one is known. */
|
|
23
|
+
export interface ViewerContentLabels {
|
|
24
|
+
/** "Text". */
|
|
25
|
+
readonly text: string;
|
|
26
|
+
/** "Binary". */
|
|
27
|
+
readonly binary: string;
|
|
28
|
+
/** "SVG image". */
|
|
29
|
+
readonly svg: string;
|
|
30
|
+
/** "PDF document". */
|
|
31
|
+
readonly pdf: string;
|
|
32
|
+
/** "PNG image", or "Image" when `format` is null. */
|
|
33
|
+
readonly image: (format: string | null) => string;
|
|
34
|
+
/** "MP3 audio", or "Audio" when `format` is null. */
|
|
35
|
+
readonly audio: (format: string | null) => string;
|
|
36
|
+
/** "QuickTime video", or "Video" when `format` is null. */
|
|
37
|
+
readonly video: (format: string | null) => string;
|
|
38
|
+
}
|
|
39
|
+
/** The viewer's shared words. */
|
|
40
|
+
export interface ViewerLabels {
|
|
41
|
+
/** The window's title while it has no file name to show: "Viewer". */
|
|
42
|
+
readonly title: string;
|
|
43
|
+
/** The failure shown when the viewer was given no reader: "The viewer could not reach its file." */
|
|
44
|
+
readonly unreachable: string;
|
|
45
|
+
/** The failure a reader call that rejected settles into: "The app did not answer." */
|
|
46
|
+
readonly noAnswer: string;
|
|
47
|
+
/** The mode switcher's accessible name: "View as". */
|
|
48
|
+
readonly modesLabel: string;
|
|
49
|
+
/** Each mode's name. */
|
|
50
|
+
readonly modes: ViewerModeLabels;
|
|
51
|
+
/** The verb that reopens a changed file: "Reload". */
|
|
52
|
+
readonly reload: string;
|
|
53
|
+
/** The kind of file, for the facts line. */
|
|
54
|
+
readonly content: ViewerContentLabels;
|
|
55
|
+
/** Where a copy came from, first in the facts line: "in backup.zip". */
|
|
56
|
+
readonly inArchive: (archive: string) => string;
|
|
57
|
+
/** When the file last changed, in the facts line: "Modified 2026-10-05 09:30". */
|
|
58
|
+
readonly modified: (date: string) => string;
|
|
59
|
+
/** The exact size on hover over the facts line: "1,234 bytes". */
|
|
60
|
+
readonly exactSize: (count: number) => string;
|
|
61
|
+
/** The note on hover for a copy: "A read-only copy of src/a.txt in backup.zip". */
|
|
62
|
+
readonly readOnlyCopy: (path: string, archive: string) => string;
|
|
63
|
+
/** The notices that the file changed at its source. */
|
|
64
|
+
readonly change: {
|
|
65
|
+
/** "The file changed on disk." */
|
|
66
|
+
readonly modified: string;
|
|
67
|
+
/** "The file was replaced on disk." */
|
|
68
|
+
readonly replaced: string;
|
|
69
|
+
/** "The file was moved or deleted. This window still shows it as it was opened." */
|
|
70
|
+
readonly removed: string;
|
|
71
|
+
};
|
|
72
|
+
/** What the text and hex views show for an empty file: "The file is empty." */
|
|
73
|
+
readonly empty: string;
|
|
74
|
+
/** The status line while a large selection is read for copy: "Copying the selection…". */
|
|
75
|
+
readonly copying: string;
|
|
76
|
+
/** The status line when copy failed: "Could not copy the selection." */
|
|
77
|
+
readonly copyFailed: string;
|
|
78
|
+
/** The text view's words. */
|
|
79
|
+
readonly text: {
|
|
80
|
+
/** The rows' accessible name: "Text of notes.txt". */
|
|
81
|
+
readonly rows: (name: string) => string;
|
|
82
|
+
/** The status line's position: "Line 1,561". */
|
|
83
|
+
readonly line: (line: number) => string;
|
|
84
|
+
/** The position while lines are still being counted: "Byte 8,192 · Counting lines…". */
|
|
85
|
+
readonly counting: (byte: number) => string;
|
|
86
|
+
/** The wrap toggle: "Wrap". */
|
|
87
|
+
readonly wrap: string;
|
|
88
|
+
/** UTF-8 that starts with a byte order mark: "UTF-8 with BOM". */
|
|
89
|
+
readonly utf8Bom: string;
|
|
90
|
+
/** Highlighting off for a large file: "JavaScript · Not highlighted, file over 16 MB". */
|
|
91
|
+
readonly tooLarge: (language: string, size: string) => string;
|
|
92
|
+
/** Long lines left plain: "JavaScript · Lines over 4 KB not highlighted". */
|
|
93
|
+
readonly longLines: (language: string, size: string) => string;
|
|
94
|
+
/** Highlighting failed to load: "JavaScript · Could not load highlighting". */
|
|
95
|
+
readonly unavailable: (language: string) => string;
|
|
96
|
+
/** A selection too large to copy: "The selection is too large to copy. Select up to 1 MB of text at a time." */
|
|
97
|
+
readonly copyTooLarge: (size: string) => string;
|
|
98
|
+
/** A copy a reload overtook: "The file was reloaded. Select the text again." */
|
|
99
|
+
readonly copyReloaded: string;
|
|
100
|
+
};
|
|
101
|
+
/** The hex view's words. */
|
|
102
|
+
readonly hex: {
|
|
103
|
+
/** The rows' accessible name: "Bytes of photo.png". */
|
|
104
|
+
readonly rows: (name: string) => string;
|
|
105
|
+
/** The status line's position: "Offset 00001F40". */
|
|
106
|
+
readonly top: (offset: string) => string;
|
|
107
|
+
/**
|
|
108
|
+
* The status line's selection: "Offset 00000010 selected" for one byte,
|
|
109
|
+
* "00000010–0000001F · 16 bytes" for more.
|
|
110
|
+
*/
|
|
111
|
+
readonly selection: (start: string, end: string, count: number) => string;
|
|
112
|
+
/** "Copy Hex". */
|
|
113
|
+
readonly copyHex: string;
|
|
114
|
+
/** "Copy Text". */
|
|
115
|
+
readonly copyText: string;
|
|
116
|
+
/** "The selection is too large to copy. Select up to 64 KB at a time." */
|
|
117
|
+
readonly copyTooLarge: (size: string) => string;
|
|
118
|
+
/** "The file was reloaded. Select the bytes again." */
|
|
119
|
+
readonly copyReloaded: string;
|
|
120
|
+
/** The jump button and its tooltip: "Go to Offset". */
|
|
121
|
+
readonly jump: string;
|
|
122
|
+
/** The jump field's accessible name: "Offset in hex". */
|
|
123
|
+
readonly jumpLabel: string;
|
|
124
|
+
/** The jump field's placeholder: "Offset, such as 1F40". */
|
|
125
|
+
readonly jumpPlaceholder: string;
|
|
126
|
+
/** "Type an offset in hex, such as 1F40 or 0x1F40." */
|
|
127
|
+
readonly jumpInvalid: string;
|
|
128
|
+
/** A jump in an empty file: "The file is empty." */
|
|
129
|
+
readonly jumpEmpty: string;
|
|
130
|
+
/** "Offset 2000 is past the end of the file. The last offset is 1FFF." */
|
|
131
|
+
readonly jumpPastEnd: (offset: string, last: string) => string;
|
|
132
|
+
};
|
|
133
|
+
/** The image view's words. */
|
|
134
|
+
readonly image: {
|
|
135
|
+
/** Before the image decodes: "Loading…". */
|
|
136
|
+
readonly loading: string;
|
|
137
|
+
/** "1,280 × 720 px", given the numbers already formatted. */
|
|
138
|
+
readonly pixelSize: (width: string, height: string) => string;
|
|
139
|
+
/** The zoom: "25%". */
|
|
140
|
+
readonly scale: (percent: string) => string;
|
|
141
|
+
/** An SVG without a size of its own: "No intrinsic size". */
|
|
142
|
+
readonly noIntrinsicSize: string;
|
|
143
|
+
/** The fit button: "Fit". */
|
|
144
|
+
readonly fit: string;
|
|
145
|
+
/** The fit button's tooltip: "Zoom to Fit". */
|
|
146
|
+
readonly fitTooltip: string;
|
|
147
|
+
/** "Actual Size". */
|
|
148
|
+
readonly actualSize: string;
|
|
149
|
+
/** "Could not decode this image, so it shows in hex." */
|
|
150
|
+
readonly fallbackDecode: string;
|
|
151
|
+
/** "Could not render this SVG, so it shows its source." */
|
|
152
|
+
readonly fallbackSvg: string;
|
|
153
|
+
};
|
|
154
|
+
/** The audio and video players' words. */
|
|
155
|
+
readonly media: {
|
|
156
|
+
/** "Play". */
|
|
157
|
+
readonly play: string;
|
|
158
|
+
/** "Pause". */
|
|
159
|
+
readonly pause: string;
|
|
160
|
+
/** The seek bar's name: "Seek". */
|
|
161
|
+
readonly seek: string;
|
|
162
|
+
/** The seek bar's value: "1:05 of 3:20". */
|
|
163
|
+
readonly seekValue: (elapsed: string, total: string) => string;
|
|
164
|
+
/** "Mute". */
|
|
165
|
+
readonly mute: string;
|
|
166
|
+
/** "Unmute". */
|
|
167
|
+
readonly unmute: string;
|
|
168
|
+
/** The volume slider's name: "Volume". */
|
|
169
|
+
readonly volume: string;
|
|
170
|
+
/** "Full Screen". */
|
|
171
|
+
readonly enterFullScreen: string;
|
|
172
|
+
/** "Exit Full Screen". */
|
|
173
|
+
readonly exitFullScreen: string;
|
|
174
|
+
/** A format the browser does not play: "Could not play this video format, so it shows in hex." */
|
|
175
|
+
readonly fallbackFormat: (media: 'audio' | 'video') => string;
|
|
176
|
+
/** "Could not decode this video, so it shows in hex." */
|
|
177
|
+
readonly fallbackDecode: (media: 'audio' | 'video') => string;
|
|
178
|
+
/** "Could not play this video, so it shows in hex." */
|
|
179
|
+
readonly fallbackPlay: (media: 'audio' | 'video') => string;
|
|
180
|
+
/** A video file with sound only: "No picture to show". */
|
|
181
|
+
readonly noPicture: string;
|
|
182
|
+
/** "1,280 × 720 px", given the numbers already formatted. */
|
|
183
|
+
readonly pixelSize: (width: string, height: string) => string;
|
|
184
|
+
};
|
|
185
|
+
/** A whole number as the app's language writes it: "1,234". */
|
|
186
|
+
readonly number: (value: number) => string;
|
|
187
|
+
/** A size in bytes, short: "1.4 MB". */
|
|
188
|
+
readonly size: (bytes: number) => string;
|
|
189
|
+
/** A date and time: "2026-10-05 09:30"; empty for a date the file does not have. */
|
|
190
|
+
readonly dateTime: (epochMs: number) => string;
|
|
191
|
+
}
|
|
192
|
+
/** English viewer words: the `viewer` group `UiokProvider` starts from. */
|
|
193
|
+
export declare const DEFAULT_VIEWER_LABELS: ViewerLabels;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the read-only file viewer repeats for every file: its modes,
|
|
3
|
+
* the facts line, change notices, each view's status line, buttons, and
|
|
4
|
+
* fallbacks, and the number, size, and date formats it writes them with.
|
|
5
|
+
* The file's name and contents are the app's.
|
|
6
|
+
*/
|
|
7
|
+
const WHOLE = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });
|
|
8
|
+
const ONE_DECIMAL = new Intl.NumberFormat('en-US', { maximumFractionDigits: 1 });
|
|
9
|
+
const SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
10
|
+
/** "1.4 MB" in English: 1024 steps, one decimal under 100 of a unit, none from 100. */
|
|
11
|
+
const englishSize = (bytes) => {
|
|
12
|
+
if (!Number.isFinite(bytes) || bytes < 0)
|
|
13
|
+
return '–';
|
|
14
|
+
let value = bytes;
|
|
15
|
+
let unit = 0;
|
|
16
|
+
while (value >= 1024 && unit < SIZE_UNITS.length - 1) {
|
|
17
|
+
value /= 1024;
|
|
18
|
+
unit += 1;
|
|
19
|
+
}
|
|
20
|
+
const amount = unit === 0 || value >= 100 ? WHOLE.format(value) : ONE_DECIMAL.format(value);
|
|
21
|
+
return `${amount} ${SIZE_UNITS[unit] ?? 'B'}`;
|
|
22
|
+
};
|
|
23
|
+
/** "2026-10-05 09:30", local time. */
|
|
24
|
+
const englishDateTime = (epochMs) => {
|
|
25
|
+
if (!Number.isFinite(epochMs) || epochMs <= 0)
|
|
26
|
+
return '';
|
|
27
|
+
const date = new Date(epochMs);
|
|
28
|
+
const pad = (part) => String(part).padStart(2, '0');
|
|
29
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
30
|
+
};
|
|
31
|
+
/** English viewer words: the `viewer` group `UiokProvider` starts from. */
|
|
32
|
+
export const DEFAULT_VIEWER_LABELS = {
|
|
33
|
+
title: 'Viewer',
|
|
34
|
+
unreachable: 'The viewer could not reach its file.',
|
|
35
|
+
noAnswer: 'The app did not answer.',
|
|
36
|
+
modesLabel: 'View as',
|
|
37
|
+
modes: {
|
|
38
|
+
text: 'Text',
|
|
39
|
+
source: 'Source',
|
|
40
|
+
hex: 'Hex',
|
|
41
|
+
image: 'Image',
|
|
42
|
+
player: 'Player',
|
|
43
|
+
document: 'Document'
|
|
44
|
+
},
|
|
45
|
+
reload: 'Reload',
|
|
46
|
+
content: {
|
|
47
|
+
text: 'Text',
|
|
48
|
+
binary: 'Binary',
|
|
49
|
+
svg: 'SVG image',
|
|
50
|
+
pdf: 'PDF document',
|
|
51
|
+
image: (format) => (format ? `${format} image` : 'Image'),
|
|
52
|
+
audio: (format) => (format ? `${format} audio` : 'Audio'),
|
|
53
|
+
video: (format) => (format ? `${format} video` : 'Video')
|
|
54
|
+
},
|
|
55
|
+
inArchive: (archive) => `in ${archive}`,
|
|
56
|
+
modified: (date) => `Modified ${date}`,
|
|
57
|
+
exactSize: (count) => (count === 1 ? '1 byte' : `${WHOLE.format(count)} bytes`),
|
|
58
|
+
readOnlyCopy: (path, archive) => `A read-only copy of ${path} in ${archive}`,
|
|
59
|
+
change: {
|
|
60
|
+
modified: 'The file changed on disk.',
|
|
61
|
+
replaced: 'The file was replaced on disk.',
|
|
62
|
+
removed: 'The file was moved or deleted. This window still shows it as it was opened.'
|
|
63
|
+
},
|
|
64
|
+
empty: 'The file is empty.',
|
|
65
|
+
copying: 'Copying the selection…',
|
|
66
|
+
copyFailed: 'Could not copy the selection.',
|
|
67
|
+
text: {
|
|
68
|
+
rows: (name) => `Text of ${name}`,
|
|
69
|
+
line: (line) => `Line ${WHOLE.format(line)}`,
|
|
70
|
+
counting: (byte) => `Byte ${WHOLE.format(byte)} · Counting lines…`,
|
|
71
|
+
wrap: 'Wrap',
|
|
72
|
+
utf8Bom: 'UTF-8 with BOM',
|
|
73
|
+
tooLarge: (language, size) => `${language} · Not highlighted, file over ${size}`,
|
|
74
|
+
longLines: (language, size) => `${language} · Lines over ${size} not highlighted`,
|
|
75
|
+
unavailable: (language) => `${language} · Could not load highlighting`,
|
|
76
|
+
copyTooLarge: (size) => `The selection is too large to copy. Select up to ${size} of text at a time.`,
|
|
77
|
+
copyReloaded: 'The file was reloaded. Select the text again.'
|
|
78
|
+
},
|
|
79
|
+
hex: {
|
|
80
|
+
rows: (name) => `Bytes of ${name}`,
|
|
81
|
+
top: (offset) => `Offset ${offset}`,
|
|
82
|
+
selection: (start, end, count) => count === 1 ? `Offset ${start} selected` : `${start}–${end} · ${WHOLE.format(count)} bytes`,
|
|
83
|
+
copyHex: 'Copy Hex',
|
|
84
|
+
copyText: 'Copy Text',
|
|
85
|
+
copyTooLarge: (size) => `The selection is too large to copy. Select up to ${size} at a time.`,
|
|
86
|
+
copyReloaded: 'The file was reloaded. Select the bytes again.',
|
|
87
|
+
jump: 'Go to Offset',
|
|
88
|
+
jumpLabel: 'Offset in hex',
|
|
89
|
+
jumpPlaceholder: 'Offset, such as 1F40',
|
|
90
|
+
jumpInvalid: 'Type an offset in hex, such as 1F40 or 0x1F40.',
|
|
91
|
+
jumpEmpty: 'The file is empty.',
|
|
92
|
+
jumpPastEnd: (offset, last) => `Offset ${offset} is past the end of the file. The last offset is ${last}.`
|
|
93
|
+
},
|
|
94
|
+
image: {
|
|
95
|
+
loading: 'Loading…',
|
|
96
|
+
pixelSize: (width, height) => `${width} × ${height} px`,
|
|
97
|
+
scale: (percent) => `${percent}%`,
|
|
98
|
+
noIntrinsicSize: 'No intrinsic size',
|
|
99
|
+
fit: 'Fit',
|
|
100
|
+
fitTooltip: 'Zoom to Fit',
|
|
101
|
+
actualSize: 'Actual Size',
|
|
102
|
+
fallbackDecode: 'Could not decode this image, so it shows in hex.',
|
|
103
|
+
fallbackSvg: 'Could not render this SVG, so it shows its source.'
|
|
104
|
+
},
|
|
105
|
+
media: {
|
|
106
|
+
play: 'Play',
|
|
107
|
+
pause: 'Pause',
|
|
108
|
+
seek: 'Seek',
|
|
109
|
+
seekValue: (elapsed, total) => `${elapsed} of ${total}`,
|
|
110
|
+
mute: 'Mute',
|
|
111
|
+
unmute: 'Unmute',
|
|
112
|
+
volume: 'Volume',
|
|
113
|
+
enterFullScreen: 'Full Screen',
|
|
114
|
+
exitFullScreen: 'Exit Full Screen',
|
|
115
|
+
fallbackFormat: (media) => `Could not play this ${media} format, so it shows in hex.`,
|
|
116
|
+
fallbackDecode: (media) => `Could not decode this ${media}, so it shows in hex.`,
|
|
117
|
+
fallbackPlay: (media) => `Could not play this ${media}, so it shows in hex.`,
|
|
118
|
+
noPicture: 'No picture to show',
|
|
119
|
+
pixelSize: (width, height) => `${width} × ${height} px`
|
|
120
|
+
},
|
|
121
|
+
number: (value) => WHOLE.format(value),
|
|
122
|
+
size: englishSize,
|
|
123
|
+
dateTime: englishDateTime
|
|
124
|
+
};
|
|
@@ -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;
|