@adecore/ui 0.31.12 → 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/file-tree/parts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { useRender } from '@base-ui/react/use-render';
|
|
5
5
|
import { FileTree as PierreFileTree } from '@pierre/trees/react';
|
|
@@ -7,137 +7,428 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { mergeRefs } from '../merge-refs.js';
|
|
9
9
|
import { directoryHandle, extendsSelection, followFocus, movesFocus, menuTargetsOf, rowPathOf, visibleRows } from './helpers.js';
|
|
10
|
-
import { useFileTreeShift } from
|
|
10
|
+
import { useFileTreeShift } from "./use-file-tree-shift.js";
|
|
11
11
|
import { useFileTreeSlots } from './use-slots.js';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
function inSlot(event) {
|
|
13
|
-
|
|
14
|
+
return event.composedPath().some(node => node instanceof HTMLElement && node.hasAttribute('data-tree-slot'));
|
|
14
15
|
}
|
|
15
|
-
export function FileTreeRoot(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
16
|
+
export function FileTreeRoot(t0) {
|
|
17
|
+
const $ = _c(79);
|
|
18
|
+
let children;
|
|
19
|
+
let className;
|
|
20
|
+
let label;
|
|
21
|
+
let model;
|
|
22
|
+
let onActivate;
|
|
23
|
+
let onClick;
|
|
24
|
+
let onExpandedPathsChange;
|
|
25
|
+
let onFocusMove;
|
|
26
|
+
let onKeyDownCapture;
|
|
27
|
+
let onLoadChildren;
|
|
28
|
+
let onRowContextMenu;
|
|
29
|
+
let onRowDragStart;
|
|
30
|
+
let props;
|
|
31
|
+
let ref;
|
|
32
|
+
let render;
|
|
33
|
+
let renderControl;
|
|
34
|
+
let renderDecoration;
|
|
35
|
+
let resetKey;
|
|
36
|
+
let t1;
|
|
37
|
+
let treeProps;
|
|
38
|
+
if ($[0] !== t0) {
|
|
39
|
+
({
|
|
40
|
+
model,
|
|
41
|
+
label,
|
|
42
|
+
resetKey,
|
|
43
|
+
selectionFollowsFocus: t1,
|
|
44
|
+
onActivate,
|
|
45
|
+
onFocusMove,
|
|
46
|
+
onLoadChildren,
|
|
47
|
+
onExpandedPathsChange,
|
|
48
|
+
onRowContextMenu,
|
|
49
|
+
onRowDragStart,
|
|
50
|
+
renderControl,
|
|
51
|
+
renderDecoration,
|
|
52
|
+
treeProps,
|
|
53
|
+
render,
|
|
54
|
+
className,
|
|
55
|
+
ref,
|
|
56
|
+
children,
|
|
57
|
+
onClick,
|
|
58
|
+
onKeyDownCapture,
|
|
59
|
+
...props
|
|
60
|
+
} = t0);
|
|
61
|
+
$[0] = t0;
|
|
62
|
+
$[1] = children;
|
|
63
|
+
$[2] = className;
|
|
64
|
+
$[3] = label;
|
|
65
|
+
$[4] = model;
|
|
66
|
+
$[5] = onActivate;
|
|
67
|
+
$[6] = onClick;
|
|
68
|
+
$[7] = onExpandedPathsChange;
|
|
69
|
+
$[8] = onFocusMove;
|
|
70
|
+
$[9] = onKeyDownCapture;
|
|
71
|
+
$[10] = onLoadChildren;
|
|
72
|
+
$[11] = onRowContextMenu;
|
|
73
|
+
$[12] = onRowDragStart;
|
|
74
|
+
$[13] = props;
|
|
75
|
+
$[14] = ref;
|
|
76
|
+
$[15] = render;
|
|
77
|
+
$[16] = renderControl;
|
|
78
|
+
$[17] = renderDecoration;
|
|
79
|
+
$[18] = resetKey;
|
|
80
|
+
$[19] = t1;
|
|
81
|
+
$[20] = treeProps;
|
|
82
|
+
} else {
|
|
83
|
+
children = $[1];
|
|
84
|
+
className = $[2];
|
|
85
|
+
label = $[3];
|
|
86
|
+
model = $[4];
|
|
87
|
+
onActivate = $[5];
|
|
88
|
+
onClick = $[6];
|
|
89
|
+
onExpandedPathsChange = $[7];
|
|
90
|
+
onFocusMove = $[8];
|
|
91
|
+
onKeyDownCapture = $[9];
|
|
92
|
+
onLoadChildren = $[10];
|
|
93
|
+
onRowContextMenu = $[11];
|
|
94
|
+
onRowDragStart = $[12];
|
|
95
|
+
props = $[13];
|
|
96
|
+
ref = $[14];
|
|
97
|
+
render = $[15];
|
|
98
|
+
renderControl = $[16];
|
|
99
|
+
renderDecoration = $[17];
|
|
100
|
+
resetKey = $[18];
|
|
101
|
+
t1 = $[19];
|
|
102
|
+
treeProps = $[20];
|
|
103
|
+
}
|
|
104
|
+
const selectionFollowsFocus = t1 === undefined ? true : t1;
|
|
105
|
+
const {
|
|
106
|
+
t
|
|
107
|
+
} = useTranslation("ui");
|
|
108
|
+
const [frame, setFrame] = useState(null);
|
|
109
|
+
const {
|
|
110
|
+
attach,
|
|
111
|
+
bar
|
|
112
|
+
} = useFileTreeShift(model, resetKey);
|
|
113
|
+
let t2;
|
|
114
|
+
if ($[21] !== attach || $[22] !== ref) {
|
|
115
|
+
t2 = node => {
|
|
116
|
+
setFrame(node);
|
|
117
|
+
attach(node);
|
|
118
|
+
mergeRefs(ref)(node);
|
|
119
|
+
};
|
|
120
|
+
$[21] = attach;
|
|
121
|
+
$[22] = ref;
|
|
122
|
+
$[23] = t2;
|
|
123
|
+
} else {
|
|
124
|
+
t2 = $[23];
|
|
125
|
+
}
|
|
126
|
+
const frameRef = t2;
|
|
127
|
+
let t3;
|
|
128
|
+
if ($[24] !== label || $[25] !== t) {
|
|
129
|
+
t3 = label ?? t("tree.label");
|
|
130
|
+
$[24] = label;
|
|
131
|
+
$[25] = t;
|
|
132
|
+
$[26] = t3;
|
|
133
|
+
} else {
|
|
134
|
+
t3 = $[26];
|
|
135
|
+
}
|
|
136
|
+
const slots = useFileTreeSlots(model, frame, t3);
|
|
137
|
+
let t4;
|
|
138
|
+
if ($[27] !== onExpandedPathsChange || $[28] !== onLoadChildren) {
|
|
139
|
+
t4 = {
|
|
140
|
+
onLoadChildren,
|
|
141
|
+
onExpandedPathsChange
|
|
142
|
+
};
|
|
143
|
+
$[27] = onExpandedPathsChange;
|
|
144
|
+
$[28] = onLoadChildren;
|
|
145
|
+
$[29] = t4;
|
|
146
|
+
} else {
|
|
147
|
+
t4 = $[29];
|
|
148
|
+
}
|
|
149
|
+
const latestLoads = useRef(t4);
|
|
150
|
+
let t5;
|
|
151
|
+
let t6;
|
|
152
|
+
if ($[30] !== onExpandedPathsChange || $[31] !== onLoadChildren) {
|
|
153
|
+
t5 = () => {
|
|
154
|
+
latestLoads.current = {
|
|
155
|
+
onLoadChildren,
|
|
156
|
+
onExpandedPathsChange
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
t6 = [onLoadChildren, onExpandedPathsChange];
|
|
160
|
+
$[30] = onExpandedPathsChange;
|
|
161
|
+
$[31] = onLoadChildren;
|
|
162
|
+
$[32] = t5;
|
|
163
|
+
$[33] = t6;
|
|
164
|
+
} else {
|
|
165
|
+
t5 = $[32];
|
|
166
|
+
t6 = $[33];
|
|
167
|
+
}
|
|
168
|
+
useLayoutEffect(t5, t6);
|
|
169
|
+
const cancelFocus = useRef(undefined);
|
|
170
|
+
let t7;
|
|
171
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
172
|
+
t7 = () => () => cancelFocus.current?.();
|
|
173
|
+
$[34] = t7;
|
|
174
|
+
} else {
|
|
175
|
+
t7 = $[34];
|
|
176
|
+
}
|
|
177
|
+
let t8;
|
|
178
|
+
if ($[35] !== model) {
|
|
179
|
+
t8 = [model];
|
|
180
|
+
$[35] = model;
|
|
181
|
+
$[36] = t8;
|
|
182
|
+
} else {
|
|
183
|
+
t8 = $[36];
|
|
184
|
+
}
|
|
185
|
+
useEffect(t7, t8);
|
|
186
|
+
let t10;
|
|
187
|
+
let t9;
|
|
188
|
+
if ($[37] !== model) {
|
|
189
|
+
t9 = () => {
|
|
190
|
+
let previous = new Set();
|
|
191
|
+
let disposed = false;
|
|
192
|
+
let pending = false;
|
|
193
|
+
const report = () => {
|
|
194
|
+
pending = false;
|
|
195
|
+
if (disposed) {
|
|
196
|
+
return;
|
|
74
197
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
198
|
+
const rows = visibleRows(model).filter(_temp);
|
|
199
|
+
const known = new Set(rows.map(_temp2));
|
|
200
|
+
const expanded = new Set([...previous].filter(path => !known.has(path)));
|
|
201
|
+
for (const row_1 of rows) {
|
|
202
|
+
if (row_1.isExpanded) {
|
|
203
|
+
expanded.add(row_1.path);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const opened = [...expanded].filter(path_0 => !previous.has(path_0));
|
|
207
|
+
const changed = opened.length > 0 || [...previous].some(path_1 => !expanded.has(path_1));
|
|
208
|
+
previous = expanded;
|
|
209
|
+
if (changed) {
|
|
210
|
+
latestLoads.current.onExpandedPathsChange?.([...expanded]);
|
|
211
|
+
}
|
|
212
|
+
for (const path_2 of opened) {
|
|
213
|
+
latestLoads.current.onLoadChildren?.(path_2);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const schedule = () => {
|
|
217
|
+
if (!pending) {
|
|
218
|
+
pending = true;
|
|
219
|
+
queueMicrotask(report);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const unsubscribe = model.subscribe(schedule);
|
|
223
|
+
report();
|
|
224
|
+
return () => {
|
|
225
|
+
disposed = true;
|
|
226
|
+
unsubscribe();
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
t10 = [model];
|
|
230
|
+
$[37] = model;
|
|
231
|
+
$[38] = t10;
|
|
232
|
+
$[39] = t9;
|
|
233
|
+
} else {
|
|
234
|
+
t10 = $[38];
|
|
235
|
+
t9 = $[39];
|
|
236
|
+
}
|
|
237
|
+
useEffect(t9, t10);
|
|
238
|
+
let t11;
|
|
239
|
+
let t12;
|
|
240
|
+
if ($[40] !== frame || $[41] !== model || $[42] !== onActivate || $[43] !== onFocusMove || $[44] !== onRowContextMenu || $[45] !== onRowDragStart || $[46] !== selectionFollowsFocus) {
|
|
241
|
+
t11 = () => {
|
|
242
|
+
if (frame === null) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const onClickRow = event => {
|
|
246
|
+
if (event.defaultPrevented || inSlot(event) || extendsSelection(event)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const path_3 = rowPathOf({
|
|
250
|
+
nativeEvent: event
|
|
251
|
+
});
|
|
252
|
+
if (path_3 !== null && directoryHandle(model, path_3) === null) {
|
|
253
|
+
onActivate?.(path_3);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const onKey = event_0 => {
|
|
257
|
+
if (event_0.defaultPrevented || inSlot(event_0)) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (movesFocus(event_0) && selectionFollowsFocus) {
|
|
261
|
+
cancelFocus.current?.();
|
|
262
|
+
cancelFocus.current = followFocus(model, onFocusMove);
|
|
263
|
+
} else {
|
|
264
|
+
if (event_0.key === "Enter" && !event_0.altKey && !event_0.metaKey && !event_0.ctrlKey) {
|
|
265
|
+
const path_4 = model.getFocusedPath();
|
|
266
|
+
if (path_4 === null) {
|
|
267
|
+
return;
|
|
112
268
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
269
|
+
event_0.preventDefault();
|
|
270
|
+
event_0.stopPropagation();
|
|
271
|
+
const directory = directoryHandle(model, path_4);
|
|
272
|
+
if (directory) {
|
|
273
|
+
directory.toggle();
|
|
274
|
+
} else {
|
|
275
|
+
onActivate?.(path_4);
|
|
116
276
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
};
|
|
130
|
-
}, [frame, model, selectionFollowsFocus, onActivate, onFocusMove, onRowContextMenu, onRowDragStart]);
|
|
131
|
-
return useRender({
|
|
132
|
-
render,
|
|
133
|
-
ref: frameRef,
|
|
134
|
-
defaultTagName: 'div',
|
|
135
|
-
props: {
|
|
136
|
-
...props,
|
|
137
|
-
className: clsx('adecore-tree adecore-file-tree', className),
|
|
138
|
-
onClick,
|
|
139
|
-
onKeyDownCapture,
|
|
140
|
-
children: (_jsxs(_Fragment, { children: [_jsx(PierreFileTree, { ...treeProps, model: model, className: clsx('adecore-file-tree-host', treeProps?.className) }), slots.map(({ row, control, decoration }) => (_jsxs("span", { style: { display: 'contents' }, children: [createPortal(renderControl?.(row), control), createPortal(renderDecoration?.(row), decoration)] }, control.slot))), children, bar] }))
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const withTargets = handle => event_1 => {
|
|
281
|
+
if (inSlot(event_1)) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const path_5 = rowPathOf({
|
|
285
|
+
nativeEvent: event_1
|
|
286
|
+
});
|
|
287
|
+
if (path_5 !== null) {
|
|
288
|
+
handle?.(path_5, menuTargetsOf(path_5, model.getSelectedPaths()), event_1);
|
|
141
289
|
}
|
|
290
|
+
};
|
|
291
|
+
const onContext = withTargets(onRowContextMenu);
|
|
292
|
+
const onDrag = withTargets(onRowDragStart);
|
|
293
|
+
frame.addEventListener("click", onClickRow);
|
|
294
|
+
frame.addEventListener("keydown", onKey, true);
|
|
295
|
+
frame.addEventListener("contextmenu", onContext);
|
|
296
|
+
frame.addEventListener("dragstart", onDrag);
|
|
297
|
+
return () => {
|
|
298
|
+
frame.removeEventListener("click", onClickRow);
|
|
299
|
+
frame.removeEventListener("keydown", onKey, true);
|
|
300
|
+
frame.removeEventListener("contextmenu", onContext);
|
|
301
|
+
frame.removeEventListener("dragstart", onDrag);
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
t12 = [frame, model, selectionFollowsFocus, onActivate, onFocusMove, onRowContextMenu, onRowDragStart];
|
|
305
|
+
$[40] = frame;
|
|
306
|
+
$[41] = model;
|
|
307
|
+
$[42] = onActivate;
|
|
308
|
+
$[43] = onFocusMove;
|
|
309
|
+
$[44] = onRowContextMenu;
|
|
310
|
+
$[45] = onRowDragStart;
|
|
311
|
+
$[46] = selectionFollowsFocus;
|
|
312
|
+
$[47] = t11;
|
|
313
|
+
$[48] = t12;
|
|
314
|
+
} else {
|
|
315
|
+
t11 = $[47];
|
|
316
|
+
t12 = $[48];
|
|
317
|
+
}
|
|
318
|
+
useEffect(t11, t12);
|
|
319
|
+
let t13;
|
|
320
|
+
if ($[49] !== className) {
|
|
321
|
+
t13 = clsx("adecore-tree adecore-file-tree", className);
|
|
322
|
+
$[49] = className;
|
|
323
|
+
$[50] = t13;
|
|
324
|
+
} else {
|
|
325
|
+
t13 = $[50];
|
|
326
|
+
}
|
|
327
|
+
const t14 = treeProps?.className;
|
|
328
|
+
let t15;
|
|
329
|
+
if ($[51] !== t14) {
|
|
330
|
+
t15 = clsx("adecore-file-tree-host", t14);
|
|
331
|
+
$[51] = t14;
|
|
332
|
+
$[52] = t15;
|
|
333
|
+
} else {
|
|
334
|
+
t15 = $[52];
|
|
335
|
+
}
|
|
336
|
+
let t16;
|
|
337
|
+
if ($[53] !== model || $[54] !== t15 || $[55] !== treeProps) {
|
|
338
|
+
t16 = /*#__PURE__*/_jsx(PierreFileTree, {
|
|
339
|
+
...treeProps,
|
|
340
|
+
model: model,
|
|
341
|
+
className: t15
|
|
142
342
|
});
|
|
343
|
+
$[53] = model;
|
|
344
|
+
$[54] = t15;
|
|
345
|
+
$[55] = treeProps;
|
|
346
|
+
$[56] = t16;
|
|
347
|
+
} else {
|
|
348
|
+
t16 = $[56];
|
|
349
|
+
}
|
|
350
|
+
let t17;
|
|
351
|
+
if ($[57] !== renderControl || $[58] !== renderDecoration || $[59] !== slots) {
|
|
352
|
+
let t18;
|
|
353
|
+
if ($[61] !== renderControl || $[62] !== renderDecoration) {
|
|
354
|
+
t18 = t19 => {
|
|
355
|
+
const {
|
|
356
|
+
row: row_2,
|
|
357
|
+
control,
|
|
358
|
+
decoration
|
|
359
|
+
} = t19;
|
|
360
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
361
|
+
style: {
|
|
362
|
+
display: "contents"
|
|
363
|
+
},
|
|
364
|
+
children: [createPortal(renderControl?.(row_2), control), createPortal(renderDecoration?.(row_2), decoration)]
|
|
365
|
+
}, control.slot);
|
|
366
|
+
};
|
|
367
|
+
$[61] = renderControl;
|
|
368
|
+
$[62] = renderDecoration;
|
|
369
|
+
$[63] = t18;
|
|
370
|
+
} else {
|
|
371
|
+
t18 = $[63];
|
|
372
|
+
}
|
|
373
|
+
t17 = slots.map(t18);
|
|
374
|
+
$[57] = renderControl;
|
|
375
|
+
$[58] = renderDecoration;
|
|
376
|
+
$[59] = slots;
|
|
377
|
+
$[60] = t17;
|
|
378
|
+
} else {
|
|
379
|
+
t17 = $[60];
|
|
380
|
+
}
|
|
381
|
+
let t18;
|
|
382
|
+
if ($[64] !== bar || $[65] !== children || $[66] !== t16 || $[67] !== t17) {
|
|
383
|
+
t18 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
384
|
+
children: [t16, t17, children, bar]
|
|
385
|
+
});
|
|
386
|
+
$[64] = bar;
|
|
387
|
+
$[65] = children;
|
|
388
|
+
$[66] = t16;
|
|
389
|
+
$[67] = t17;
|
|
390
|
+
$[68] = t18;
|
|
391
|
+
} else {
|
|
392
|
+
t18 = $[68];
|
|
393
|
+
}
|
|
394
|
+
let t19;
|
|
395
|
+
if ($[69] !== onClick || $[70] !== onKeyDownCapture || $[71] !== props || $[72] !== t13 || $[73] !== t18) {
|
|
396
|
+
t19 = {
|
|
397
|
+
...props,
|
|
398
|
+
className: t13,
|
|
399
|
+
onClick,
|
|
400
|
+
onKeyDownCapture,
|
|
401
|
+
children: t18
|
|
402
|
+
};
|
|
403
|
+
$[69] = onClick;
|
|
404
|
+
$[70] = onKeyDownCapture;
|
|
405
|
+
$[71] = props;
|
|
406
|
+
$[72] = t13;
|
|
407
|
+
$[73] = t18;
|
|
408
|
+
$[74] = t19;
|
|
409
|
+
} else {
|
|
410
|
+
t19 = $[74];
|
|
411
|
+
}
|
|
412
|
+
let t20;
|
|
413
|
+
if ($[75] !== frameRef || $[76] !== render || $[77] !== t19) {
|
|
414
|
+
t20 = {
|
|
415
|
+
render,
|
|
416
|
+
ref: frameRef,
|
|
417
|
+
defaultTagName: "div",
|
|
418
|
+
props: t19
|
|
419
|
+
};
|
|
420
|
+
$[75] = frameRef;
|
|
421
|
+
$[76] = render;
|
|
422
|
+
$[77] = t19;
|
|
423
|
+
$[78] = t20;
|
|
424
|
+
} else {
|
|
425
|
+
t20 = $[78];
|
|
426
|
+
}
|
|
427
|
+
return useRender(t20);
|
|
428
|
+
}
|
|
429
|
+
function _temp2(row_0) {
|
|
430
|
+
return row_0.path;
|
|
143
431
|
}
|
|
432
|
+
function _temp(row) {
|
|
433
|
+
return row.kind === "directory";
|
|
434
|
+
}
|
package/dist/file-tree/style.js
CHANGED
|
@@ -21,4 +21,4 @@ export const FILE_TREE_CSS = `
|
|
|
21
21
|
[data-item-section="content"] :where([data-truncate-content="overflow"], [data-truncate-marker-cell], [data-truncate-fill]) { display: none; }
|
|
22
22
|
[data-tree-port] { position: absolute; z-index: 4; display: flex; align-items: center; height: 25px; pointer-events: none; }
|
|
23
23
|
[data-tree-port] > slot { pointer-events: auto; }
|
|
24
|
-
`;
|
|
24
|
+
`;
|
|
@@ -1,43 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import 'react';
|
|
3
|
+
import { useTreeShift } from "../tree/use-tree-shift.js";
|
|
3
4
|
import { shiftNeed } from '../tree/shift.js';
|
|
4
5
|
const ROWS = '[data-type="item"]:not([data-item-parked="true"])';
|
|
5
6
|
function boxesOf(element) {
|
|
6
|
-
|
|
7
|
+
return element.getClientRects().length > 0 ? [element] : [...element.children].flatMap(child => boxesOf(child));
|
|
7
8
|
}
|
|
8
9
|
function limitOf(row, content, gap) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
if (part.childNodes.length === 0 && Number.parseFloat(getComputedStyle(part).flexGrow) > 0) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
limit = Math.min(limit, rect.left - gap);
|
|
10
|
+
const start = content.getBoundingClientRect().left;
|
|
11
|
+
const contentMargin = Number.parseFloat(getComputedStyle(content).marginInlineEnd) || 0;
|
|
12
|
+
let limit = Number.POSITIVE_INFINITY;
|
|
13
|
+
for (const part of [...row.children].filter(child => child !== content).flatMap(child => boxesOf(child))) {
|
|
14
|
+
const rect = part.getBoundingClientRect();
|
|
15
|
+
if (rect.width === 0 || rect.left < start) {
|
|
16
|
+
continue;
|
|
21
17
|
}
|
|
22
|
-
if (
|
|
23
|
-
|
|
18
|
+
if (part.childNodes.length === 0 && Number.parseFloat(getComputedStyle(part).flexGrow) > 0) {
|
|
19
|
+
continue;
|
|
24
20
|
}
|
|
25
|
-
|
|
21
|
+
limit = Math.min(limit, rect.left - gap);
|
|
22
|
+
}
|
|
23
|
+
if (limit !== Number.POSITIVE_INFINITY) {
|
|
24
|
+
return limit - contentMargin;
|
|
25
|
+
}
|
|
26
|
+
return row.getBoundingClientRect().right - Number.parseFloat(getComputedStyle(row).paddingInlineEnd) - contentMargin;
|
|
26
27
|
}
|
|
27
28
|
function needOf(row, shift, gap, range) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const content = row.querySelector(':scope > [data-item-section="content"]');
|
|
30
|
+
if (content === null || row.getBoundingClientRect().width === 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
range.selectNodeContents(content);
|
|
34
|
+
return shiftNeed(range.getBoundingClientRect().right, limitOf(row, content, gap), shift);
|
|
34
35
|
}
|
|
35
36
|
/* The file tree draws its rows in a shadow root, and only the name slides: its decorations sit over the row. */
|
|
36
37
|
export function useFileTreeShift(model, resetKey) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const $ = _c(2);
|
|
39
|
+
let t0;
|
|
40
|
+
if ($[0] !== model) {
|
|
41
|
+
t0 = {
|
|
42
|
+
root: () => model.getFileTreeContainer()?.shadowRoot ?? null,
|
|
43
|
+
rows: _temp,
|
|
44
|
+
need: needOf
|
|
45
|
+
};
|
|
46
|
+
$[0] = model;
|
|
47
|
+
$[1] = t0;
|
|
48
|
+
} else {
|
|
49
|
+
t0 = $[1];
|
|
50
|
+
}
|
|
51
|
+
const source = t0;
|
|
52
|
+
return useTreeShift(source, resetKey);
|
|
43
53
|
}
|
|
54
|
+
function _temp(root) {
|
|
55
|
+
return [...root.querySelectorAll(ROWS)];
|
|
56
|
+
}
|