@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.
Files changed (163) hide show
  1. package/dist/AccentSwatches.js +290 -13
  2. package/dist/Banner.js +90 -9
  3. package/dist/Button.js +114 -22
  4. package/dist/ButtonGroup.js +62 -8
  5. package/dist/Checkbox.js +73 -4
  6. package/dist/ChoiceCards.js +205 -11
  7. package/dist/CloseButton.js +87 -7
  8. package/dist/ColorSwatch.js +132 -15
  9. package/dist/ColorWheelPicker.js +305 -71
  10. package/dist/ColumnResizeHandle.js +43 -8
  11. package/dist/DisabledReason.js +27 -8
  12. package/dist/DockShell.js +144 -37
  13. package/dist/EmptyState.js +95 -6
  14. package/dist/ErrorBoundary.js +254 -31
  15. package/dist/Field.js +349 -31
  16. package/dist/FileIcon.js +67 -6
  17. package/dist/Icon.js +38 -6
  18. package/dist/IconButton.js +176 -20
  19. package/dist/IconPicker.js +344 -73
  20. package/dist/Input.js +233 -14
  21. package/dist/Kbd.js +150 -10
  22. package/dist/LazyBoundary.js +14 -5
  23. package/dist/ListRow.js +75 -15
  24. package/dist/Meter.js +108 -5
  25. package/dist/MiddleTruncate.js +126 -45
  26. package/dist/PanelEmpty.js +64 -5
  27. package/dist/PanelHeader.js +95 -13
  28. package/dist/Pill.js +114 -19
  29. package/dist/ProjectSwitcher.js +225 -12
  30. package/dist/PromptDialog.js +352 -37
  31. package/dist/SectionLabel.js +62 -8
  32. package/dist/SegmentBar.js +197 -36
  33. package/dist/Segmented.js +130 -23
  34. package/dist/Select.js +310 -19
  35. package/dist/SelectSearch.js +344 -29
  36. package/dist/Separator.js +35 -4
  37. package/dist/ShortcutHints.js +146 -76
  38. package/dist/Skeleton.js +31 -4
  39. package/dist/Slider.js +172 -10
  40. package/dist/SlidingColumn.js +194 -34
  41. package/dist/Spinner.js +100 -3
  42. package/dist/Stepper.js +232 -11
  43. package/dist/Surface.js +62 -8
  44. package/dist/Switch.js +60 -6
  45. package/dist/TextMenu.js +212 -17
  46. package/dist/Tile.js +149 -5
  47. package/dist/Toasts.js +391 -33
  48. package/dist/Tooltip.js +153 -16
  49. package/dist/UIProvider.js +62 -15
  50. package/dist/Waveform.js +362 -93
  51. package/dist/Wipe.js +259 -34
  52. package/dist/ZoomControls.js +356 -14
  53. package/dist/class-name.js +1 -1
  54. package/dist/clipboard.js +15 -17
  55. package/dist/context-menu/index.parts.js +1 -1
  56. package/dist/dialog/index.parts.js +1 -1
  57. package/dist/dialog/parts.js +378 -29
  58. package/dist/dialog-layer.js +51 -18
  59. package/dist/error-boundary.js +19 -19
  60. package/dist/error-message.js +1 -1
  61. package/dist/field-context.js +7 -5
  62. package/dist/file-icon.js +23 -21
  63. package/dist/file-tree/helpers.js +133 -119
  64. package/dist/file-tree/index.parts.js +3 -3
  65. package/dist/file-tree/parts.js +418 -127
  66. package/dist/file-tree/style.js +1 -1
  67. package/dist/file-tree/use-file-tree-shift.js +43 -30
  68. package/dist/file-tree/use-file-tree.js +60 -18
  69. package/dist/file-tree/use-slots.js +220 -192
  70. package/dist/floating.js +2 -2
  71. package/dist/format/datetime.js +88 -38
  72. package/dist/format/duration.js +59 -53
  73. package/dist/format/index.js +1 -1
  74. package/dist/format/locale.js +76 -56
  75. package/dist/format/number.js +77 -61
  76. package/dist/format/regions.js +4 -2
  77. package/dist/format/time-zone.js +1 -1
  78. package/dist/icon-button-size.js +12 -2
  79. package/dist/icon-picker.js +70 -61
  80. package/dist/index.js +57 -57
  81. package/dist/key-value-list/index.parts.js +1 -1
  82. package/dist/key-value-list/parts.js +256 -22
  83. package/dist/lazy-landings.js +10 -10
  84. package/dist/lazy.js +84 -71
  85. package/dist/locales/en.js +80 -80
  86. package/dist/locales/nl.js +80 -80
  87. package/dist/locales.js +10 -7
  88. package/dist/menu/index.parts.js +1 -1
  89. package/dist/menu/parts.js +882 -44
  90. package/dist/merge-refs.js +8 -9
  91. package/dist/middle-truncate.js +24 -25
  92. package/dist/modality.js +27 -19
  93. package/dist/placement.js +11 -20
  94. package/dist/platform.js +6 -6
  95. package/dist/popover/index.parts.js +1 -1
  96. package/dist/popover/parts.js +173 -11
  97. package/dist/popup-layer.js +38 -17
  98. package/dist/prefetch.js +78 -79
  99. package/dist/preview-card/index.parts.js +1 -1
  100. package/dist/project-switcher-row.js +153 -12
  101. package/dist/select-row.js +69 -5
  102. package/dist/select-shared.js +6 -6
  103. package/dist/selection.js +16 -16
  104. package/dist/seti-icons.js +413 -413
  105. package/dist/settings/ConfirmDialog.js +55 -8
  106. package/dist/settings/DetailHeader.js +72 -4
  107. package/dist/settings/MasterDetail.js +119 -7
  108. package/dist/settings/SettingsDialog.js +820 -80
  109. package/dist/settings/SettingsRow.js +205 -18
  110. package/dist/settings/SettingsSection.js +96 -6
  111. package/dist/settings/index.js +7 -7
  112. package/dist/settings/target.js +7 -2
  113. package/dist/shortcut-hints.js +73 -55
  114. package/dist/shortcut.js +140 -104
  115. package/dist/step-places.js +1 -1
  116. package/dist/tabs/index.parts.js +1 -1
  117. package/dist/tabs/overflow.js +18 -18
  118. package/dist/tabs/parts.js +780 -166
  119. package/dist/testing/dedupe.js +82 -75
  120. package/dist/testing/fake-source.js +12 -12
  121. package/dist/testing/index.js +1 -1
  122. package/dist/toast-store.js +65 -46
  123. package/dist/tree/index.parts.js +1 -1
  124. package/dist/tree/parts.js +721 -94
  125. package/dist/tree/shift.js +28 -22
  126. package/dist/tree/style.js +2 -2
  127. package/dist/tree/use-tree-shift.js +178 -117
  128. package/dist/useAsyncAction.js +23 -19
  129. package/dist/useColumnResize.js +36 -34
  130. package/dist/useContentSize.js +62 -18
  131. package/dist/useMeasuredWidth.js +14 -3
  132. package/dist/useNow.js +73 -30
  133. package/dist/wipe-split.js +14 -14
  134. package/dist/workspace/DropPreview.js +60 -7
  135. package/dist/workspace/SplitView.js +1025 -441
  136. package/dist/workspace/TabStrip.js +810 -191
  137. package/dist/workspace/Workspace.js +276 -26
  138. package/dist/workspace/context.js +8 -3
  139. package/dist/workspace/geometry.js +173 -150
  140. package/dist/workspace/model.js +313 -250
  141. package/dist/workspace/preview.js +61 -61
  142. package/dist/zoom.js +2 -2
  143. package/package.json +1 -1
  144. package/src/ErrorBoundary.tsx +1 -1
  145. package/src/Field.tsx +4 -3
  146. package/src/IconPicker.tsx +3 -3
  147. package/src/LazyBoundary.tsx +2 -0
  148. package/src/MiddleTruncate.tsx +2 -2
  149. package/src/SegmentBar.tsx +2 -2
  150. package/src/Toasts.tsx +3 -1
  151. package/src/Tooltip.tsx +7 -10
  152. package/src/Waveform.tsx +3 -3
  153. package/src/file-tree/parts.tsx +6 -9
  154. package/src/file-tree/use-file-tree-shift.tsx +6 -9
  155. package/src/lazy.tsx +4 -0
  156. package/src/locales/en.ts +4 -4
  157. package/src/locales/nl.ts +5 -5
  158. package/src/settings/SettingsDialog.tsx +1 -1
  159. package/src/tree/parts.tsx +5 -8
  160. package/src/useContentSize.ts +3 -3
  161. package/src/workspace/SplitView.tsx +2 -2
  162. package/src/workspace/TabStrip.tsx +2 -3
  163. package/src/workspace/Workspace.tsx +2 -5
@@ -1,5 +1,5 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
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 './use-file-tree-shift.js';
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
- return event.composedPath().some((node) => node instanceof HTMLElement && node.hasAttribute('data-tree-slot'));
14
+ return event.composedPath().some(node => node instanceof HTMLElement && node.hasAttribute('data-tree-slot'));
14
15
  }
15
- export function FileTreeRoot({ model, label, resetKey, selectionFollowsFocus = true, onActivate, onFocusMove, onLoadChildren, onExpandedPathsChange, onRowContextMenu, onRowDragStart, renderControl, renderDecoration, treeProps, render, className, ref, children, onClick, onKeyDownCapture, ...props }) {
16
- const { t } = useTranslation('ui');
17
- const [frame, setFrame] = useState(null);
18
- const { attach, bar } = useFileTreeShift(model, resetKey);
19
- const frameRef = useCallback((node) => {
20
- setFrame(node);
21
- attach(node);
22
- mergeRefs(ref)(node);
23
- }, [ref, attach]);
24
- const slots = useFileTreeSlots(model, frame, label ?? t('tree.label'));
25
- const latestLoads = useRef({ onLoadChildren, onExpandedPathsChange });
26
- useLayoutEffect(() => {
27
- latestLoads.current = { onLoadChildren, onExpandedPathsChange };
28
- }, [onLoadChildren, onExpandedPathsChange]);
29
- const cancelFocus = useRef(undefined);
30
- useEffect(() => () => cancelFocus.current?.(), [model]);
31
- useEffect(() => {
32
- let previous = new Set();
33
- let disposed = false;
34
- let pending = false;
35
- const report = () => {
36
- pending = false;
37
- if (disposed) {
38
- return;
39
- }
40
- const rows = visibleRows(model).filter((row) => row.kind === 'directory');
41
- const known = new Set(rows.map((row) => row.path));
42
- const expanded = new Set([...previous].filter((path) => !known.has(path)));
43
- for (const row of rows) {
44
- if (row.isExpanded) {
45
- expanded.add(row.path);
46
- }
47
- }
48
- const opened = [...expanded].filter((path) => !previous.has(path));
49
- const changed = opened.length > 0 || [...previous].some((path) => !expanded.has(path));
50
- previous = expanded;
51
- if (changed) {
52
- latestLoads.current.onExpandedPathsChange?.([...expanded]);
53
- }
54
- for (const path of opened) {
55
- latestLoads.current.onLoadChildren?.(path);
56
- }
57
- };
58
- const schedule = () => {
59
- if (!pending) {
60
- pending = true;
61
- queueMicrotask(report);
62
- }
63
- };
64
- const unsubscribe = model.subscribe(schedule);
65
- report();
66
- return () => {
67
- disposed = true;
68
- unsubscribe();
69
- };
70
- }, [model]);
71
- useEffect(() => {
72
- if (frame === null) {
73
- return;
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 onClickRow = (event) => {
76
- if (event.defaultPrevented || inSlot(event) || extendsSelection(event)) {
77
- return;
78
- }
79
- const path = rowPathOf({ nativeEvent: event });
80
- if (path !== null && directoryHandle(model, path) === null) {
81
- onActivate?.(path);
82
- }
83
- };
84
- const onKey = (event) => {
85
- if (event.defaultPrevented || inSlot(event)) {
86
- return;
87
- }
88
- if (movesFocus(event) && selectionFollowsFocus) {
89
- cancelFocus.current?.();
90
- // beta.6 stops the key in its own handler; selection must follow after that handler moves focus.
91
- cancelFocus.current = followFocus(model, onFocusMove);
92
- }
93
- else if (event.key === 'Enter' && !event.altKey && !event.metaKey && !event.ctrlKey) {
94
- const path = model.getFocusedPath();
95
- if (path === null) {
96
- return;
97
- }
98
- event.preventDefault();
99
- event.stopPropagation();
100
- const directory = directoryHandle(model, path);
101
- if (directory) {
102
- directory.toggle();
103
- }
104
- else {
105
- onActivate?.(path);
106
- }
107
- }
108
- };
109
- const withTargets = (handle) => (event) => {
110
- if (inSlot(event)) {
111
- return;
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
- const path = rowPathOf({ nativeEvent: event });
114
- if (path !== null) {
115
- handle?.(path, menuTargetsOf(path, model.getSelectedPaths()), event);
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
- const onContext = withTargets(onRowContextMenu);
119
- const onDrag = withTargets(onRowDragStart);
120
- frame.addEventListener('click', onClickRow);
121
- frame.addEventListener('keydown', onKey, true);
122
- frame.addEventListener('contextmenu', onContext);
123
- frame.addEventListener('dragstart', onDrag);
124
- return () => {
125
- frame.removeEventListener('click', onClickRow);
126
- frame.removeEventListener('keydown', onKey, true);
127
- frame.removeEventListener('contextmenu', onContext);
128
- frame.removeEventListener('dragstart', onDrag);
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
+ }
@@ -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 { useMemo } from 'react';
2
- import { useTreeShift } from '../tree/use-tree-shift.js';
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
- return element.getClientRects().length > 0 ? [element] : [...element.children].flatMap((child) => boxesOf(child));
7
+ return element.getClientRects().length > 0 ? [element] : [...element.children].flatMap(child => boxesOf(child));
7
8
  }
8
9
  function limitOf(row, content, gap) {
9
- const start = content.getBoundingClientRect().left;
10
- const contentMargin = Number.parseFloat(getComputedStyle(content).marginInlineEnd) || 0;
11
- let limit = Number.POSITIVE_INFINITY;
12
- for (const part of [...row.children].filter((child) => child !== content).flatMap((child) => boxesOf(child))) {
13
- const rect = part.getBoundingClientRect();
14
- if (rect.width === 0 || rect.left < start) {
15
- continue;
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 (limit !== Number.POSITIVE_INFINITY) {
23
- return limit - contentMargin;
18
+ if (part.childNodes.length === 0 && Number.parseFloat(getComputedStyle(part).flexGrow) > 0) {
19
+ continue;
24
20
  }
25
- return row.getBoundingClientRect().right - Number.parseFloat(getComputedStyle(row).paddingInlineEnd) - contentMargin;
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
- const content = row.querySelector(':scope > [data-item-section="content"]');
29
- if (content === null || row.getBoundingClientRect().width === 0) {
30
- return null;
31
- }
32
- range.selectNodeContents(content);
33
- return shiftNeed(range.getBoundingClientRect().right, limitOf(row, content, gap), shift);
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
- const source = useMemo(() => ({
38
- root: () => model.getFileTreeContainer()?.shadowRoot ?? null,
39
- rows: (root) => [...root.querySelectorAll(ROWS)],
40
- need: needOf
41
- }), [model]);
42
- return useTreeShift(source, resetKey);
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
+ }