@adecore/ui 0.31.11 → 0.32.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/dist/AccentSwatches.js +290 -13
- package/dist/Banner.js +90 -9
- package/dist/Button.js +114 -22
- package/dist/ButtonGroup.js +62 -8
- package/dist/Checkbox.js +73 -4
- package/dist/ChoiceCards.js +205 -11
- package/dist/CloseButton.js +87 -7
- package/dist/ColorSwatch.js +132 -15
- package/dist/ColorWheelPicker.js +305 -71
- package/dist/ColumnResizeHandle.js +43 -8
- package/dist/DisabledReason.js +27 -8
- package/dist/DockShell.js +144 -37
- package/dist/EmptyState.js +95 -6
- package/dist/ErrorBoundary.js +254 -31
- package/dist/Field.js +349 -31
- package/dist/FileIcon.js +67 -6
- package/dist/Icon.js +38 -6
- package/dist/IconButton.js +176 -20
- package/dist/IconPicker.js +344 -73
- package/dist/Input.js +233 -14
- package/dist/Kbd.js +150 -10
- package/dist/LazyBoundary.js +14 -5
- package/dist/ListRow.js +75 -15
- package/dist/Meter.js +108 -5
- package/dist/MiddleTruncate.js +126 -45
- package/dist/PanelEmpty.js +64 -5
- package/dist/PanelHeader.js +95 -13
- package/dist/Pill.js +114 -19
- package/dist/ProjectSwitcher.js +225 -12
- package/dist/PromptDialog.js +352 -37
- package/dist/SectionLabel.js +62 -8
- package/dist/SegmentBar.js +197 -36
- package/dist/Segmented.js +130 -23
- package/dist/Select.js +310 -19
- package/dist/SelectSearch.js +344 -29
- package/dist/Separator.js +35 -4
- package/dist/ShortcutHints.js +146 -76
- package/dist/Skeleton.js +31 -4
- package/dist/Slider.js +172 -10
- package/dist/SlidingColumn.js +194 -34
- package/dist/Spinner.js +100 -3
- package/dist/Stepper.js +232 -11
- package/dist/Surface.js +62 -8
- package/dist/Switch.js +60 -6
- package/dist/TextMenu.js +212 -17
- package/dist/Tile.js +149 -5
- package/dist/Toasts.js +391 -33
- package/dist/Tooltip.js +153 -16
- package/dist/UIProvider.js +62 -15
- package/dist/Waveform.js +362 -93
- package/dist/Wipe.js +259 -34
- package/dist/ZoomControls.js +356 -14
- package/dist/class-name.js +1 -1
- package/dist/clipboard.js +15 -17
- package/dist/context-menu/index.parts.js +1 -1
- package/dist/dialog/index.parts.js +1 -1
- package/dist/dialog/parts.js +378 -29
- package/dist/dialog-layer.js +51 -18
- package/dist/error-boundary.js +19 -19
- package/dist/error-message.js +1 -1
- package/dist/field-context.js +7 -5
- package/dist/file-icon.js +23 -21
- package/dist/file-tree/helpers.js +133 -119
- package/dist/file-tree/index.parts.js +3 -3
- package/dist/file-tree/parts.js +418 -127
- package/dist/file-tree/style.js +1 -1
- package/dist/file-tree/use-file-tree-shift.js +43 -30
- package/dist/file-tree/use-file-tree.js +60 -18
- package/dist/file-tree/use-slots.js +220 -192
- package/dist/floating.js +2 -2
- package/dist/format/datetime.js +88 -38
- package/dist/format/duration.js +59 -53
- package/dist/format/index.js +1 -1
- package/dist/format/locale.js +76 -56
- package/dist/format/number.js +77 -61
- package/dist/format/regions.js +4 -2
- package/dist/format/time-zone.js +1 -1
- package/dist/icon-button-size.js +12 -2
- package/dist/icon-picker.js +70 -61
- package/dist/index.js +57 -57
- package/dist/key-value-list/index.parts.js +1 -1
- package/dist/key-value-list/parts.js +256 -22
- package/dist/lazy-landings.js +10 -10
- package/dist/lazy.js +84 -71
- package/dist/locales/en.js +80 -80
- package/dist/locales/nl.js +80 -80
- package/dist/locales.js +10 -7
- package/dist/menu/index.parts.js +1 -1
- package/dist/menu/parts.js +882 -44
- package/dist/merge-refs.js +8 -9
- package/dist/middle-truncate.js +24 -25
- package/dist/modality.js +27 -19
- package/dist/placement.js +11 -20
- package/dist/platform.js +6 -6
- package/dist/popover/index.parts.js +1 -1
- package/dist/popover/parts.js +173 -11
- package/dist/popup-layer.js +38 -17
- package/dist/prefetch.js +78 -79
- package/dist/preview-card/index.parts.js +1 -1
- package/dist/project-switcher-row.js +153 -12
- package/dist/select-row.js +69 -5
- package/dist/select-shared.js +6 -6
- package/dist/selection.js +16 -16
- package/dist/seti-icons.js +413 -413
- package/dist/settings/ConfirmDialog.js +55 -8
- package/dist/settings/DetailHeader.js +72 -4
- package/dist/settings/MasterDetail.js +119 -7
- package/dist/settings/SettingsDialog.js +820 -80
- package/dist/settings/SettingsRow.js +205 -18
- package/dist/settings/SettingsSection.js +96 -6
- package/dist/settings/index.js +7 -7
- package/dist/settings/target.js +7 -2
- package/dist/shortcut-hints.js +73 -55
- package/dist/shortcut.js +140 -104
- package/dist/step-places.js +1 -1
- package/dist/tabs/index.parts.js +1 -1
- package/dist/tabs/overflow.js +18 -18
- package/dist/tabs/parts.js +780 -166
- package/dist/testing/dedupe.js +82 -75
- package/dist/testing/fake-source.js +12 -12
- package/dist/testing/index.js +1 -1
- package/dist/toast-store.js +65 -46
- package/dist/tree/index.parts.js +1 -1
- package/dist/tree/parts.js +721 -94
- package/dist/tree/shift.js +28 -22
- package/dist/tree/style.js +2 -2
- package/dist/tree/use-tree-shift.js +178 -117
- package/dist/useAsyncAction.js +23 -19
- package/dist/useColumnResize.js +36 -34
- package/dist/useContentSize.js +62 -18
- package/dist/useMeasuredWidth.js +14 -3
- package/dist/useNow.js +73 -30
- package/dist/wipe-split.js +14 -14
- package/dist/workspace/DropPreview.js +60 -7
- package/dist/workspace/SplitView.js +1025 -441
- package/dist/workspace/TabStrip.js +810 -191
- package/dist/workspace/Workspace.js +276 -26
- package/dist/workspace/context.js +8 -3
- package/dist/workspace/geometry.js +173 -150
- package/dist/workspace/model.js +313 -250
- package/dist/workspace/preview.js +61 -61
- package/dist/zoom.js +2 -2
- package/package.json +1 -1
- package/src/ErrorBoundary.tsx +1 -1
- package/src/Field.tsx +4 -3
- package/src/IconPicker.tsx +3 -3
- package/src/LazyBoundary.tsx +2 -0
- package/src/MiddleTruncate.tsx +2 -2
- package/src/SegmentBar.tsx +2 -2
- package/src/Toasts.tsx +3 -1
- package/src/Tooltip.tsx +7 -10
- package/src/Waveform.tsx +3 -3
- package/src/file-tree/parts.tsx +6 -9
- package/src/file-tree/use-file-tree-shift.tsx +6 -9
- package/src/lazy.tsx +4 -0
- package/src/locales/en.ts +4 -4
- package/src/locales/nl.ts +5 -5
- package/src/settings/SettingsDialog.tsx +1 -1
- package/src/tree/parts.tsx +5 -8
- package/src/useContentSize.ts +3 -3
- package/src/workspace/SplitView.tsx +2 -2
- package/src/workspace/TabStrip.tsx +2 -3
- package/src/workspace/Workspace.tsx +2 -5
package/dist/shortcut.js
CHANGED
|
@@ -1,142 +1,178 @@
|
|
|
1
1
|
/* Matched on the physical key: Shift turns `[` into `{` and Option turns most keys into a dead key. */
|
|
2
2
|
const PUNCTUATION_CODES = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
',': 'Comma',
|
|
4
|
+
'.': 'Period',
|
|
5
|
+
'/': 'Slash',
|
|
6
|
+
';': 'Semicolon',
|
|
7
|
+
"'": 'Quote',
|
|
8
|
+
'`': 'Backquote',
|
|
9
|
+
'\\': 'Backslash',
|
|
10
|
+
'[': 'BracketLeft',
|
|
11
|
+
']': 'BracketRight'
|
|
12
12
|
};
|
|
13
13
|
/* Matched on the character, because `+` sits on a different key per layout. */
|
|
14
14
|
const CHARACTER_KEYS = new Set(['+', '-', '=']);
|
|
15
15
|
const NAMED_KEYS = new Set(['Enter', 'Escape', 'Backspace', 'Delete', 'Tab', 'Space', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']);
|
|
16
16
|
const FUNCTION_KEY = /^F([1-9]|1[0-2])$/;
|
|
17
17
|
const MODIFIER_FIELDS = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
Mod: 'mod',
|
|
19
|
+
Ctrl: 'ctrl',
|
|
20
|
+
Meta: 'meta',
|
|
21
|
+
Alt: 'alt',
|
|
22
|
+
Shift: 'shift'
|
|
23
23
|
};
|
|
24
|
-
const isKey =
|
|
24
|
+
const isKey = word => /^[A-Za-z0-9]$/.test(word) || word in PUNCTUATION_CODES || CHARACTER_KEYS.has(word) || NAMED_KEYS.has(word) || FUNCTION_KEY.test(word);
|
|
25
25
|
/**
|
|
26
26
|
* Parses `Mod+Shift+K`. Throws on a word it does not know or on two keys, so a typo in a table fails
|
|
27
27
|
* the moment the module loads instead of leaving a shortcut that never fires.
|
|
28
28
|
*/
|
|
29
|
-
export const shortcut =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
result.key = word.length === 1 ? word.toUpperCase() : word;
|
|
29
|
+
export const shortcut = text => {
|
|
30
|
+
// A trailing `++` is the plus key itself, which a plain split would read as two empty words.
|
|
31
|
+
const words = text === '+' ? ['+'] : text.endsWith('++') ? [...text.slice(0, -2).split('+'), '+'] : text.split('+');
|
|
32
|
+
const result = {
|
|
33
|
+
mod: false,
|
|
34
|
+
ctrl: false,
|
|
35
|
+
meta: false,
|
|
36
|
+
alt: false,
|
|
37
|
+
shift: false,
|
|
38
|
+
key: ''
|
|
39
|
+
};
|
|
40
|
+
for (const word of words) {
|
|
41
|
+
if (Object.hasOwn(MODIFIER_FIELDS, word)) {
|
|
42
|
+
result[MODIFIER_FIELDS[word]] = true;
|
|
43
|
+
continue;
|
|
45
44
|
}
|
|
46
|
-
|
|
45
|
+
if (!isKey(word)) {
|
|
46
|
+
throw new Error(`Unknown key "${word}" in shortcut "${text}"`);
|
|
47
|
+
}
|
|
48
|
+
if (result.key !== '') {
|
|
49
|
+
throw new Error(`Shortcut "${text}" names two keys`);
|
|
50
|
+
}
|
|
51
|
+
result.key = word.length === 1 ? word.toUpperCase() : word;
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
47
54
|
};
|
|
48
55
|
// Letters and digits match on `code`: with Shift held `key` says `!` for 1, and Option's dead keys change it on macOS.
|
|
49
56
|
const matchesKey = (key, event) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
if (/^[A-Z]$/.test(key)) {
|
|
58
|
+
return event.code === `Key${key}`;
|
|
59
|
+
}
|
|
60
|
+
if (/^[0-9]$/.test(key)) {
|
|
61
|
+
return event.code === `Digit${key}`;
|
|
62
|
+
}
|
|
63
|
+
const code = PUNCTUATION_CODES[key];
|
|
64
|
+
if (code) {
|
|
65
|
+
return event.code === code;
|
|
66
|
+
}
|
|
67
|
+
if (key === 'Space') {
|
|
68
|
+
return event.code === 'Space';
|
|
69
|
+
}
|
|
70
|
+
return event.key === key;
|
|
64
71
|
};
|
|
65
72
|
/* Strict: every modifier the shortcut does not name has to be up, so Ctrl+K on macOS is not Cmd+K. */
|
|
66
73
|
export const matchesShortcut = (target, event, apple) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
const meta = target.meta || target.mod && apple;
|
|
75
|
+
const ctrl = target.ctrl || target.mod && !apple;
|
|
76
|
+
if (target.key === '' || event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== target.alt || event.shiftKey !== target.shift) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return matchesKey(target.key, event);
|
|
73
80
|
};
|
|
74
81
|
const KEY_LABELS = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
Enter: {
|
|
83
|
+
apple: '↩',
|
|
84
|
+
other: 'Enter'
|
|
85
|
+
},
|
|
86
|
+
Backspace: {
|
|
87
|
+
apple: '⌫',
|
|
88
|
+
other: 'Backspace'
|
|
89
|
+
},
|
|
90
|
+
Delete: {
|
|
91
|
+
apple: '⌦',
|
|
92
|
+
other: 'Delete'
|
|
93
|
+
},
|
|
94
|
+
Escape: {
|
|
95
|
+
apple: 'Esc',
|
|
96
|
+
other: 'Esc'
|
|
97
|
+
},
|
|
98
|
+
Tab: {
|
|
99
|
+
apple: '⇥',
|
|
100
|
+
other: 'Tab'
|
|
101
|
+
},
|
|
102
|
+
Space: {
|
|
103
|
+
apple: 'Space',
|
|
104
|
+
other: 'Space'
|
|
105
|
+
},
|
|
106
|
+
ArrowLeft: {
|
|
107
|
+
apple: '←',
|
|
108
|
+
other: '←'
|
|
109
|
+
},
|
|
110
|
+
ArrowRight: {
|
|
111
|
+
apple: '→',
|
|
112
|
+
other: '→'
|
|
113
|
+
},
|
|
114
|
+
ArrowUp: {
|
|
115
|
+
apple: '↑',
|
|
116
|
+
other: '↑'
|
|
117
|
+
},
|
|
118
|
+
ArrowDown: {
|
|
119
|
+
apple: '↓',
|
|
120
|
+
other: '↓'
|
|
121
|
+
}
|
|
85
122
|
};
|
|
86
123
|
/* The modifiers and the key as separate caps, in the order the platform prints them. */
|
|
87
124
|
export const shortcutParts = (target, apple) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
const parts = [];
|
|
126
|
+
if (apple) {
|
|
127
|
+
if (target.ctrl) {
|
|
128
|
+
parts.push('⌃');
|
|
129
|
+
}
|
|
130
|
+
if (target.alt) {
|
|
131
|
+
parts.push('⌥');
|
|
132
|
+
}
|
|
133
|
+
if (target.shift) {
|
|
134
|
+
parts.push('⇧');
|
|
135
|
+
}
|
|
136
|
+
if (target.meta || target.mod) {
|
|
137
|
+
parts.push('⌘');
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
if (target.ctrl || target.mod) {
|
|
141
|
+
parts.push('Ctrl');
|
|
142
|
+
}
|
|
143
|
+
if (target.alt) {
|
|
144
|
+
parts.push('Alt');
|
|
102
145
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
parts.push('Ctrl');
|
|
106
|
-
}
|
|
107
|
-
if (target.alt) {
|
|
108
|
-
parts.push('Alt');
|
|
109
|
-
}
|
|
110
|
-
if (target.shift) {
|
|
111
|
-
parts.push('Shift');
|
|
112
|
-
}
|
|
113
|
-
if (target.meta) {
|
|
114
|
-
parts.push('Meta');
|
|
115
|
-
}
|
|
146
|
+
if (target.shift) {
|
|
147
|
+
parts.push('Shift');
|
|
116
148
|
}
|
|
117
|
-
if (target.
|
|
118
|
-
|
|
119
|
-
parts.push(label ? label[apple ? 'apple' : 'other'] : target.key);
|
|
149
|
+
if (target.meta) {
|
|
150
|
+
parts.push('Meta');
|
|
120
151
|
}
|
|
121
|
-
|
|
152
|
+
}
|
|
153
|
+
if (target.key !== '') {
|
|
154
|
+
const label = KEY_LABELS[target.key];
|
|
155
|
+
parts.push(label ? label[apple ? 'apple' : 'other'] : target.key);
|
|
156
|
+
}
|
|
157
|
+
return parts;
|
|
122
158
|
};
|
|
123
159
|
/* `⌥⇧⌘K` on macOS, `Ctrl+Alt+Shift+K` elsewhere. */
|
|
124
160
|
export const formatShortcut = (target, apple) => shortcutParts(target, apple).join(apple ? '' : '+');
|
|
125
161
|
/* The browser's own editing shortcuts, which the app only ever prints in a menu. */
|
|
126
162
|
export const EDIT_SHORTCUTS = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
163
|
+
copy: /* @__PURE__ */shortcut('Mod+C'),
|
|
164
|
+
cut: /* @__PURE__ */shortcut('Mod+X'),
|
|
165
|
+
paste: /* @__PURE__ */shortcut('Mod+V'),
|
|
166
|
+
selectAll: /* @__PURE__ */shortcut('Mod+A')
|
|
131
167
|
};
|
|
132
168
|
/* Keys that are not a shortcut of their own but are printed as one in a hint. */
|
|
133
169
|
export const KEY_SHORTCUTS = {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
170
|
+
enter: /* @__PURE__ */shortcut('Enter'),
|
|
171
|
+
modEnter: /* @__PURE__ */shortcut('Mod+Enter'),
|
|
172
|
+
backspace: /* @__PURE__ */shortcut('Backspace'),
|
|
173
|
+
escape: /* @__PURE__ */shortcut('Escape'),
|
|
174
|
+
shift: /* @__PURE__ */shortcut('Shift'),
|
|
175
|
+
rename: /* @__PURE__ */shortcut('F2')
|
|
140
176
|
};
|
|
141
177
|
/* Whether the platform's own modifier is down during a pointer gesture: Cmd on macOS, Ctrl elsewhere. */
|
|
142
|
-
export const isModHeld = (event, apple) =>
|
|
178
|
+
export const isModHeld = (event, apple) => apple ? event.metaKey : event.ctrlKey;
|
package/dist/step-places.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* The places after the separator that `step` is written with, so a step of 0.1 shows `1,0` and never `1`. */
|
|
2
|
-
export const placesOf =
|
|
2
|
+
export const placesOf = step => String(step).split('.')[1]?.length ?? 0;
|
package/dist/tabs/index.parts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TabsCount as Count, TabsList as List, TabsPanel as Panel, TabsRoot as Root, TabsTab as Tab } from
|
|
1
|
+
export { TabsCount as Count, TabsList as List, TabsPanel as Panel, TabsRoot as Root, TabsTab as Tab } from "./parts.js";
|
package/dist/tabs/overflow.js
CHANGED
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
* the menu: they take the place of the last ones that no longer fit beside them.
|
|
6
6
|
*/
|
|
7
7
|
export const shownTabs = (widths, room, gap, more, kept) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const span = indices => indices.reduce((sum, index) => sum + widths[index], 0) + gap * Math.max(0, indices.length - 1);
|
|
9
|
+
const all = widths.map((_, index) => index);
|
|
10
|
+
// Half a pixel of slack, since a measured width is fractional and the room is not.
|
|
11
|
+
if (span(all) <= room + 0.5) {
|
|
12
|
+
return all;
|
|
13
|
+
}
|
|
14
|
+
const limit = room - more - gap + 0.5;
|
|
15
|
+
const held = all.filter(index => kept.includes(index));
|
|
16
|
+
const shown = [];
|
|
17
|
+
for (const index of all) {
|
|
18
|
+
if (held.includes(index)) {
|
|
19
|
+
continue;
|
|
13
20
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const shown = [];
|
|
17
|
-
for (const index of all) {
|
|
18
|
-
if (held.includes(index)) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (span([...held, ...shown, index]) > limit) {
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
shown.push(index);
|
|
21
|
+
if (span([...held, ...shown, index]) > limit) {
|
|
22
|
+
break;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
}
|
|
24
|
+
shown.push(index);
|
|
25
|
+
}
|
|
26
|
+
return [...held, ...shown].sort((left, right) => left - right);
|
|
27
|
+
};
|