@harborclient/sdk 1.3.3 → 1.3.5
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 +24 -0
- package/dist/components/AnchorMenuPanel/index.d.ts +35 -0
- package/dist/components/AnchorMenuPanel/index.d.ts.map +1 -0
- package/dist/components/AnchorMenuPanel/index.js +364 -0
- package/dist/components/Breadcrumb/SegmentShell.d.ts +12 -1
- package/dist/components/Breadcrumb/SegmentShell.d.ts.map +1 -1
- package/dist/components/Breadcrumb/SegmentShell.js +7 -5
- package/dist/components/CodeEditor/index.d.ts +7 -4
- package/dist/components/CodeEditor/index.d.ts.map +1 -1
- package/dist/components/CodeEditor/index.js +15 -176
- package/dist/components/CodeEditor/selectionActionToolbar.d.ts +162 -0
- package/dist/components/CodeEditor/selectionActionToolbar.d.ts.map +1 -0
- package/dist/components/CodeEditor/selectionActionToolbar.js +319 -0
- package/dist/components/CopyToChatButton/constants.d.ts +18 -0
- package/dist/components/CopyToChatButton/constants.d.ts.map +1 -0
- package/dist/components/CopyToChatButton/constants.js +19 -0
- package/dist/components/CopyToChatButton/index.d.ts +49 -0
- package/dist/components/CopyToChatButton/index.d.ts.map +1 -0
- package/dist/components/CopyToChatButton/index.js +43 -0
- package/dist/components/FloatingDialog/floatingDialogPosition.d.ts +52 -0
- package/dist/components/FloatingDialog/floatingDialogPosition.d.ts.map +1 -0
- package/dist/components/FloatingDialog/floatingDialogPosition.js +33 -0
- package/dist/components/FloatingDialog/index.d.ts +95 -0
- package/dist/components/FloatingDialog/index.d.ts.map +1 -0
- package/dist/components/FloatingDialog/index.js +275 -0
- package/dist/components/FormGroup/index.d.ts +7 -1
- package/dist/components/FormGroup/index.d.ts.map +1 -1
- package/dist/components/FormGroup/index.js +8 -11
- package/dist/components/PageHeader/index.d.ts +2 -1
- package/dist/components/PageHeader/index.d.ts.map +1 -1
- package/dist/components/PageHeader/index.js +3 -2
- package/dist/components/PageSidebar/index.d.ts +1 -0
- package/dist/components/PageSidebar/index.d.ts.map +1 -1
- package/dist/components/PageSidebar/index.js +4 -13
- package/dist/components/Resizable/useResizable.d.ts +6 -0
- package/dist/components/Resizable/useResizable.d.ts.map +1 -1
- package/dist/components/Resizable/useResizable.js +113 -11
- package/dist/components/SettingFieldActions/index.d.ts +42 -0
- package/dist/components/SettingFieldActions/index.d.ts.map +1 -0
- package/dist/components/SettingFieldActions/index.js +66 -0
- package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts +42 -4
- package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarEnvironmentItem.js +34 -5
- package/dist/components/SidebarItem/SidebarHistoryItem.d.ts +5 -1
- package/dist/components/SidebarItem/SidebarHistoryItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarHistoryItem.js +2 -2
- package/dist/components/SidebarItem/SidebarWorkspaceItem.d.ts +9 -1
- package/dist/components/SidebarItem/SidebarWorkspaceItem.d.ts.map +1 -1
- package/dist/components/SidebarItem/SidebarWorkspaceItem.js +15 -2
- package/dist/components/TabBar/TabContextMenu.d.ts +3 -0
- package/dist/components/TabBar/TabContextMenu.d.ts.map +1 -1
- package/dist/components/TabBar/TabContextMenu.js +25 -16
- package/dist/components/VariableTable/index.d.ts +1 -1
- package/dist/components/VariableTable/index.d.ts.map +1 -1
- package/dist/components/VariableTable/index.js +14 -3
- package/dist/components/index.d.ts +6 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -1
- package/dist/runtime/createBridgedPluginContext.js +240 -2
- package/dist/snippets.d.ts +48 -2
- package/dist/styles.css +16 -0
- package/dist/types.d.ts +1159 -30
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/package.json +1 -1
- package/dist/components/SelectionActionToolbar/index.d.ts +0 -41
- package/dist/components/SelectionActionToolbar/index.d.ts.map +0 -1
- package/dist/components/SelectionActionToolbar/index.js +0 -13
|
@@ -3,6 +3,15 @@ import { RESIZABLE_SYNC_EVENT } from './applyResizableSizes.js';
|
|
|
3
3
|
export { applyResizableSizes, RESIZABLE_SYNC_EVENT } from './applyResizableSizes.js';
|
|
4
4
|
/** Id of the shared stylesheet injected during resize drags. */
|
|
5
5
|
const RESIZING_STYLE_ID = 'hc-resizable-drag-styles';
|
|
6
|
+
/**
|
|
7
|
+
* Fraction of the remaining target gap closed per animation frame during drag.
|
|
8
|
+
* Lower values feel heavier; higher values track the pointer more closely.
|
|
9
|
+
*/
|
|
10
|
+
const RESIZE_DRAG_LERP = 0.22;
|
|
11
|
+
/**
|
|
12
|
+
* Stop the drag lerp loop when within this many pixels of the pointer target.
|
|
13
|
+
*/
|
|
14
|
+
const RESIZE_DRAG_SNAP_EPSILON = 0.5;
|
|
6
15
|
/**
|
|
7
16
|
* Injects shared CSS that neutralizes webviews/iframes and shows the resize cursor during drags.
|
|
8
17
|
* Electron webviews paint above normal DOM, so pointer-events must be disabled on the webview itself.
|
|
@@ -45,6 +54,17 @@ function setResizingState(axis) {
|
|
|
45
54
|
function clearResizingState() {
|
|
46
55
|
delete document.body.dataset.hcResizing;
|
|
47
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns whether the user prefers reduced motion.
|
|
59
|
+
*
|
|
60
|
+
* @returns True when the OS requests minimized animation.
|
|
61
|
+
*/
|
|
62
|
+
function prefersReducedMotion() {
|
|
63
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
67
|
+
}
|
|
48
68
|
/**
|
|
49
69
|
* Loads a persisted size from localStorage.
|
|
50
70
|
*
|
|
@@ -79,15 +99,17 @@ function persistSize(storageKey, size) {
|
|
|
79
99
|
}
|
|
80
100
|
/**
|
|
81
101
|
* Clamps a size between min and optional max bounds.
|
|
102
|
+
*
|
|
103
|
+
* @param size - Candidate size in pixels.
|
|
104
|
+
* @param minSize - Minimum allowed size.
|
|
105
|
+
* @param getMaxSize - Optional dynamic max getter.
|
|
106
|
+
* @returns Size clamped to [minSize, max].
|
|
82
107
|
*/
|
|
83
108
|
function clampSize(size, minSize, getMaxSize) {
|
|
84
109
|
const rawMax = getMaxSize?.() ?? Number.POSITIVE_INFINITY;
|
|
85
110
|
const maxSize = Math.max(minSize, rawMax);
|
|
86
111
|
return Math.min(maxSize, Math.max(minSize, size));
|
|
87
112
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Tracks resizable panel size with pointer drag and optional persistence.
|
|
90
|
-
*/
|
|
91
113
|
/**
|
|
92
114
|
* Persists a committed resize size via localStorage and/or a caller callback.
|
|
93
115
|
*
|
|
@@ -101,6 +123,12 @@ function commitSize(storageKey, onPersist, size) {
|
|
|
101
123
|
}
|
|
102
124
|
onPersist?.(size);
|
|
103
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Tracks resizable panel size with pointer drag and optional persistence.
|
|
128
|
+
*
|
|
129
|
+
* During drag, pointer movement sets a target size; the displayed size eases
|
|
130
|
+
* toward that target each frame unless the user prefers reduced motion.
|
|
131
|
+
*/
|
|
104
132
|
export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize, storageKey, onPersist }) {
|
|
105
133
|
const [size, setSizeState] = useState(() => {
|
|
106
134
|
const initial = storageKey ? loadStoredSize(storageKey, defaultSize) : defaultSize;
|
|
@@ -111,12 +139,60 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
111
139
|
const startPosRef = useRef(0);
|
|
112
140
|
const startSizeRef = useRef(defaultSize);
|
|
113
141
|
const sizeRef = useRef(size);
|
|
142
|
+
const targetSizeRef = useRef(size);
|
|
143
|
+
const rafIdRef = useRef(null);
|
|
144
|
+
const minSizeRef = useRef(minSize);
|
|
145
|
+
const getMaxSizeRef = useRef(getMaxSize);
|
|
114
146
|
/**
|
|
115
147
|
* Keeps a ref in sync with state so drag handlers read the latest size.
|
|
116
148
|
*/
|
|
117
149
|
useEffect(() => {
|
|
118
150
|
sizeRef.current = size;
|
|
119
151
|
}, [size]);
|
|
152
|
+
/**
|
|
153
|
+
* Keeps bound refs current so the lerp loop does not close over stale values.
|
|
154
|
+
*/
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
minSizeRef.current = minSize;
|
|
157
|
+
getMaxSizeRef.current = getMaxSize;
|
|
158
|
+
}, [getMaxSize, minSize]);
|
|
159
|
+
/**
|
|
160
|
+
* Cancels any in-flight drag lerp animation frame.
|
|
161
|
+
*/
|
|
162
|
+
const stopResizeLerp = useCallback(() => {
|
|
163
|
+
if (rafIdRef.current != null) {
|
|
164
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
165
|
+
rafIdRef.current = null;
|
|
166
|
+
}
|
|
167
|
+
}, []);
|
|
168
|
+
/**
|
|
169
|
+
* Eases displayed size toward the pointer target while a drag is active.
|
|
170
|
+
*/
|
|
171
|
+
const runResizeLerpStep = useCallback(() => {
|
|
172
|
+
rafIdRef.current = null;
|
|
173
|
+
if (!resizingRef.current) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const current = sizeRef.current;
|
|
177
|
+
const target = targetSizeRef.current;
|
|
178
|
+
const gap = target - current;
|
|
179
|
+
if (Math.abs(gap) <= RESIZE_DRAG_SNAP_EPSILON) {
|
|
180
|
+
setSizeState(target);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const nextSize = clampSize(current + gap * RESIZE_DRAG_LERP, minSizeRef.current, getMaxSizeRef.current);
|
|
184
|
+
setSizeState(nextSize);
|
|
185
|
+
rafIdRef.current = requestAnimationFrame(runResizeLerpStep);
|
|
186
|
+
}, []);
|
|
187
|
+
/**
|
|
188
|
+
* Starts the drag lerp loop when it is not already scheduled.
|
|
189
|
+
*/
|
|
190
|
+
const startResizeLerp = useCallback(() => {
|
|
191
|
+
if (rafIdRef.current != null) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
rafIdRef.current = requestAnimationFrame(runResizeLerpStep);
|
|
195
|
+
}, [runResizeLerpStep]);
|
|
120
196
|
/**
|
|
121
197
|
* Re-reads this panel's localStorage size when a workspace (or other caller)
|
|
122
198
|
* applies sizes externally via {@link applyResizableSizes}.
|
|
@@ -153,22 +229,30 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
153
229
|
}, [getMaxSize, size]);
|
|
154
230
|
/**
|
|
155
231
|
* Updates panel size with min/max clamping applied.
|
|
232
|
+
*
|
|
233
|
+
* @param nextSize - Desired size in pixels before clamping.
|
|
156
234
|
*/
|
|
157
235
|
const setSize = useCallback((nextSize) => {
|
|
158
236
|
setSizeState(clampSize(nextSize, minSize, getMaxSize));
|
|
159
237
|
}, [getMaxSize, minSize]);
|
|
160
238
|
/**
|
|
161
239
|
* Captures pointer position and current size when a resize drag begins.
|
|
240
|
+
*
|
|
241
|
+
* @param event - React mouse event from the resize handle.
|
|
162
242
|
*/
|
|
163
243
|
const onResizeStart = useCallback((event) => {
|
|
164
244
|
event.preventDefault();
|
|
245
|
+
stopResizeLerp();
|
|
165
246
|
resizingRef.current = true;
|
|
166
247
|
startPosRef.current = axis === 'x' ? event.clientX : event.clientY;
|
|
167
248
|
startSizeRef.current = sizeRef.current;
|
|
249
|
+
targetSizeRef.current = sizeRef.current;
|
|
168
250
|
setResizingState(axis);
|
|
169
|
-
}, [axis]);
|
|
251
|
+
}, [axis, stopResizeLerp]);
|
|
170
252
|
/**
|
|
171
253
|
* Nudges panel size from arrow keys using the same axis/direction math as drag.
|
|
254
|
+
*
|
|
255
|
+
* @param event - React keyboard event from the focused resize handle.
|
|
172
256
|
*/
|
|
173
257
|
const onKeyboardResize = useCallback((event) => {
|
|
174
258
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -201,7 +285,7 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
201
285
|
*/
|
|
202
286
|
useEffect(() => {
|
|
203
287
|
/**
|
|
204
|
-
* Updates
|
|
288
|
+
* Updates the pointer target (and eases toward it) while a resize drag is active.
|
|
205
289
|
*
|
|
206
290
|
* @param event - Window mousemove event.
|
|
207
291
|
*/
|
|
@@ -211,17 +295,25 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
211
295
|
const currentPos = axis === 'x' ? event.clientX : event.clientY;
|
|
212
296
|
const delta = (currentPos - startPosRef.current) * direction;
|
|
213
297
|
const nextSize = clampSize(startSizeRef.current + delta, minSize, getMaxSize);
|
|
214
|
-
|
|
298
|
+
targetSizeRef.current = nextSize;
|
|
299
|
+
if (prefersReducedMotion()) {
|
|
300
|
+
setSizeState(nextSize);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
startResizeLerp();
|
|
215
304
|
};
|
|
216
305
|
/**
|
|
217
|
-
* Ends the resize drag and commits the
|
|
306
|
+
* Ends the resize drag, snaps to the pointer target, and commits the size.
|
|
218
307
|
*/
|
|
219
308
|
const handleMouseUp = () => {
|
|
220
309
|
if (!resizingRef.current)
|
|
221
310
|
return;
|
|
222
311
|
resizingRef.current = false;
|
|
312
|
+
stopResizeLerp();
|
|
223
313
|
clearResizingState();
|
|
224
|
-
|
|
314
|
+
const snapped = clampSize(targetSizeRef.current, minSize, getMaxSize);
|
|
315
|
+
setSizeState(snapped);
|
|
316
|
+
commitSize(storageKey, onPersist, snapped);
|
|
225
317
|
};
|
|
226
318
|
window.addEventListener('mousemove', handleMouseMove);
|
|
227
319
|
window.addEventListener('mouseup', handleMouseUp);
|
|
@@ -235,17 +327,27 @@ export function useResizable({ axis, direction, defaultSize, minSize, getMaxSize
|
|
|
235
327
|
window.removeEventListener('mousemove', handleMouseMove);
|
|
236
328
|
window.removeEventListener('mouseup', handleMouseUp);
|
|
237
329
|
};
|
|
238
|
-
}, [
|
|
330
|
+
}, [
|
|
331
|
+
axis,
|
|
332
|
+
direction,
|
|
333
|
+
getMaxSize,
|
|
334
|
+
minSize,
|
|
335
|
+
onPersist,
|
|
336
|
+
startResizeLerp,
|
|
337
|
+
stopResizeLerp,
|
|
338
|
+
storageKey
|
|
339
|
+
]);
|
|
239
340
|
/**
|
|
240
|
-
* Clears the document resize marker when the hook unmounts mid-drag.
|
|
341
|
+
* Clears the document resize marker and any lerp loop when the hook unmounts mid-drag.
|
|
241
342
|
*/
|
|
242
343
|
useEffect(() => {
|
|
243
344
|
return () => {
|
|
345
|
+
stopResizeLerp();
|
|
244
346
|
if (resizingRef.current) {
|
|
245
347
|
resizingRef.current = false;
|
|
246
348
|
clearResizingState();
|
|
247
349
|
}
|
|
248
350
|
};
|
|
249
|
-
}, []);
|
|
351
|
+
}, [stopResizeLerp]);
|
|
250
352
|
return { size, minSize, maxSize, setSize, onResizeStart, onKeyboardResize };
|
|
251
353
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* Catalog setting id (e.g. `general.verifySsl`), used for the accessible name
|
|
5
|
+
* and as context for copy/reset actions.
|
|
6
|
+
*/
|
|
7
|
+
settingId: string;
|
|
8
|
+
/**
|
|
9
|
+
* True when the field value differs from its factory default. Keeps the gear
|
|
10
|
+
* visible and enables Reset Setting.
|
|
11
|
+
*/
|
|
12
|
+
isModified: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Resets the setting to its factory default.
|
|
15
|
+
*/
|
|
16
|
+
onReset: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Copies the setting id to the clipboard.
|
|
19
|
+
*/
|
|
20
|
+
onCopyId: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* When set, adds a "Copy Setting as JSON" menu item.
|
|
23
|
+
*/
|
|
24
|
+
onCopyJson?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* When set, adds a "Copy Deep Link" menu item for the `#setting-…` hash.
|
|
27
|
+
*/
|
|
28
|
+
onCopyDeepLink?: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gear button and dropdown for a single settings field: reset to default and
|
|
32
|
+
* copy helpers. Hidden until the parent `group/setting-field` is hovered or
|
|
33
|
+
* focused; always visible when the field is modified or the menu is open.
|
|
34
|
+
*
|
|
35
|
+
* Place inside a container with the `group/setting-field` Tailwind class so
|
|
36
|
+
* hover/focus reveal works.
|
|
37
|
+
*
|
|
38
|
+
* @param props - Setting id, modified flag, and action handlers.
|
|
39
|
+
*/
|
|
40
|
+
export declare function SettingFieldActions({ settingId, isModified, onReset, onCopyId, onCopyJson, onCopyDeepLink }: Props): JSX.Element;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SettingFieldActions/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAiC,MAAM,OAAO,CAAC;AAIhE,UAAU,KAAK;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,cAAc,EACf,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAyErB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { faGear } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { useMemo, useState } from '@harborclient/sdk/react';
|
|
4
|
+
import { RowActionsMenu } from '../RowActionsMenu/index.js';
|
|
5
|
+
import { cn } from '../utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Gear button and dropdown for a single settings field: reset to default and
|
|
8
|
+
* copy helpers. Hidden until the parent `group/setting-field` is hovered or
|
|
9
|
+
* focused; always visible when the field is modified or the menu is open.
|
|
10
|
+
*
|
|
11
|
+
* Place inside a container with the `group/setting-field` Tailwind class so
|
|
12
|
+
* hover/focus reveal works.
|
|
13
|
+
*
|
|
14
|
+
* @param props - Setting id, modified flag, and action handlers.
|
|
15
|
+
*/
|
|
16
|
+
export function SettingFieldActions({ settingId, isModified, onReset, onCopyId, onCopyJson, onCopyDeepLink }) {
|
|
17
|
+
const [openMenuId, setOpenMenuId] = useState(null);
|
|
18
|
+
const menuId = `setting-actions-${settingId}`;
|
|
19
|
+
const isOpen = openMenuId === menuId;
|
|
20
|
+
/**
|
|
21
|
+
* Menu groups for reset and copy actions. Reset is disabled when the value
|
|
22
|
+
* matches the factory default.
|
|
23
|
+
*/
|
|
24
|
+
const groups = useMemo(() => {
|
|
25
|
+
const copyItems = [
|
|
26
|
+
{
|
|
27
|
+
label: 'Copy Setting ID',
|
|
28
|
+
onSelect: onCopyId
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
if (onCopyJson != null) {
|
|
32
|
+
copyItems.push({
|
|
33
|
+
label: 'Copy Setting as JSON',
|
|
34
|
+
onSelect: onCopyJson
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (onCopyDeepLink != null) {
|
|
38
|
+
copyItems.push({
|
|
39
|
+
label: 'Copy Deep Link',
|
|
40
|
+
onSelect: onCopyDeepLink
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return [
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
label: 'Reset Setting',
|
|
47
|
+
disabled: !isModified,
|
|
48
|
+
onSelect: onReset
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
copyItems
|
|
52
|
+
];
|
|
53
|
+
}, [isModified, onCopyDeepLink, onCopyId, onCopyJson, onReset]);
|
|
54
|
+
/**
|
|
55
|
+
* Prevents the gear click from toggling a wrapping checkbox label.
|
|
56
|
+
*
|
|
57
|
+
* @param event - Native click on the actions wrapper.
|
|
58
|
+
*/
|
|
59
|
+
const handleWrapperClick = (event) => {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
};
|
|
62
|
+
const alwaysVisible = isModified || isOpen;
|
|
63
|
+
return (_jsx("div", { className: cn('hc-setting-field-actions shrink-0', alwaysVisible
|
|
64
|
+
? 'opacity-100'
|
|
65
|
+
: 'opacity-0 group-focus-within/setting-field:opacity-100 group-hover/setting-field:opacity-100 focus-within:opacity-100'), onClick: handleWrapperClick, children: _jsx(RowActionsMenu, { menuId: menuId, openMenuId: openMenuId, onOpenChange: setOpenMenuId, triggerIcon: faGear, triggerAriaLabel: `Setting actions for ${settingId}`, triggerTitle: "Setting actions", groups: groups }) }));
|
|
66
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
1
2
|
import type { JSX, MouseEvent, ReactNode } from 'react';
|
|
2
3
|
import { type SidebarItemSortableConfig } from './SidebarItem.js';
|
|
3
4
|
interface Props {
|
|
@@ -21,13 +22,46 @@ interface Props {
|
|
|
21
22
|
* Whether this row should use selected/highlighted row styling.
|
|
22
23
|
*/
|
|
23
24
|
selected?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether this environment has nested child environments.
|
|
27
|
+
*/
|
|
28
|
+
hasChildren?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the child environment list is expanded.
|
|
31
|
+
*/
|
|
32
|
+
expanded?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Id of the child region controlled by this row (`SidebarTreeGroup` id).
|
|
35
|
+
*/
|
|
36
|
+
childrenId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Nesting depth for indentation (`0` = root, no extra indent).
|
|
39
|
+
*/
|
|
40
|
+
level?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Total siblings at this level (tree a11y).
|
|
43
|
+
*/
|
|
44
|
+
setSize?: number;
|
|
45
|
+
/**
|
|
46
|
+
* 1-based position among siblings at this level (tree a11y).
|
|
47
|
+
*/
|
|
48
|
+
posInSet?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Toggles child environment expand/collapse when {@link hasChildren} is true.
|
|
51
|
+
*/
|
|
52
|
+
onToggleExpand?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Icons for expand/collapse chevrons when {@link hasChildren} is true.
|
|
55
|
+
*/
|
|
56
|
+
expandIcon?: IconDefinition;
|
|
57
|
+
collapseIcon?: IconDefinition;
|
|
24
58
|
/**
|
|
25
59
|
* dnd-kit sortable configuration for environment reordering.
|
|
26
60
|
*/
|
|
27
61
|
sortable?: SidebarItemSortableConfig;
|
|
28
62
|
/**
|
|
29
|
-
* Accessible label for the listbox option. When omitted, the name
|
|
30
|
-
* from visible row content (name, variable summary).
|
|
63
|
+
* Accessible label for the listbox option or tree item. When omitted, the name
|
|
64
|
+
* is derived from visible row content (name, variable summary).
|
|
31
65
|
*/
|
|
32
66
|
ariaLabel?: string;
|
|
33
67
|
/**
|
|
@@ -64,15 +98,19 @@ interface Props {
|
|
|
64
98
|
*/
|
|
65
99
|
dataSidebarEnvironmentId?: string | number;
|
|
66
100
|
/**
|
|
67
|
-
* HTML element for the row container. Use `li` inside {@link SidebarListbox}
|
|
101
|
+
* HTML element for the row container. Use `li` inside {@link SidebarListbox}
|
|
102
|
+
* or {@link SidebarTree}.
|
|
68
103
|
*/
|
|
69
104
|
as?: 'div' | 'li';
|
|
70
105
|
}
|
|
71
106
|
/**
|
|
72
107
|
* Renders an environment row in the Collections sidebar Environments section.
|
|
73
108
|
*
|
|
109
|
+
* Flat list rows use listbox option semantics. Nested tree rows (when `level` is
|
|
110
|
+
* set) use treeitem semantics with optional expand/collapse chevrons.
|
|
111
|
+
*
|
|
74
112
|
* The accessible name is derived from visible row content (name, variable summary).
|
|
75
113
|
*/
|
|
76
|
-
export declare function SidebarEnvironmentItem({ name, variableSummary, markerDot, selected, sortable, ariaLabel, ariaSelected, ariaCurrent, onContextMenu, onClick, onDoubleClick, onEnter, actions, dataSidebarEnvironmentId, as }: Props): JSX.Element;
|
|
114
|
+
export declare function SidebarEnvironmentItem({ name, variableSummary, markerDot, selected, hasChildren, expanded, childrenId, level, setSize, posInSet, onToggleExpand, expandIcon, collapseIcon, sortable, ariaLabel, ariaSelected, ariaCurrent, onContextMenu, onClick, onDoubleClick, onEnter, actions, dataSidebarEnvironmentId, as }: Props): JSX.Element;
|
|
77
115
|
export {};
|
|
78
116
|
//# sourceMappingURL=SidebarEnvironmentItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarEnvironmentItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarEnvironmentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAiB,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SidebarEnvironmentItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarEnvironmentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAiB,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAU/E,UAAU,KAAK;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,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,CAAC;IAE3C;;;OAGG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACnB;AAOD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,eAAe,EACf,SAAS,EACT,QAAgB,EAChB,WAAmB,EACnB,QAAgB,EAChB,UAAU,EACV,KAAK,EACL,OAAO,EACP,QAAQ,EACR,cAAc,EACd,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,EACP,wBAAwB,EACxB,EAAS,EACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAmGrB"}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
|
|
2
|
+
import { FaIcon } from '../FaIcon/index.js';
|
|
2
3
|
import { SidebarItem } from './SidebarItem.js';
|
|
3
4
|
import { SidebarMarkerDot } from './SidebarMarkerDot.js';
|
|
4
|
-
import { SIDEBAR_ITEM_BUTTON_CLASS } from './sidebarItemClasses.js';
|
|
5
|
+
import { SIDEBAR_CHEVRON_BUTTON_CLASS, SIDEBAR_CHEVRON_ICON_CLASS, SIDEBAR_CHEVRON_LABEL_OFFSET_CLASS, SIDEBAR_ITEM_BUTTON_CLASS } from './sidebarItemClasses.js';
|
|
6
|
+
import { stopSortableDragPointerDown } from './stopSortableDragPointerDown.js';
|
|
7
|
+
/**
|
|
8
|
+
* Nesting indent step matching Tailwind `ml-4` (1rem) per depth level.
|
|
9
|
+
*/
|
|
10
|
+
const ENVIRONMENT_LEVEL_INDENT_PX = 16;
|
|
5
11
|
/**
|
|
6
12
|
* Renders an environment row in the Collections sidebar Environments section.
|
|
7
13
|
*
|
|
14
|
+
* Flat list rows use listbox option semantics. Nested tree rows (when `level` is
|
|
15
|
+
* set) use treeitem semantics with optional expand/collapse chevrons.
|
|
16
|
+
*
|
|
8
17
|
* The accessible name is derived from visible row content (name, variable summary).
|
|
9
18
|
*/
|
|
10
|
-
export function SidebarEnvironmentItem({ name, variableSummary, markerDot, selected = false, sortable, ariaLabel, ariaSelected, ariaCurrent, onContextMenu, onClick, onDoubleClick, onEnter, actions, dataSidebarEnvironmentId, as = 'li' }) {
|
|
11
|
-
const
|
|
19
|
+
export function SidebarEnvironmentItem({ name, variableSummary, markerDot, selected = false, hasChildren = false, expanded = false, childrenId, level, setSize, posInSet, onToggleExpand, expandIcon, collapseIcon, sortable, ariaLabel, ariaSelected, ariaCurrent, onContextMenu, onClick, onDoubleClick, onEnter, actions, dataSidebarEnvironmentId, as = 'li' }) {
|
|
20
|
+
const useTreeItem = as === 'li' && level != null;
|
|
21
|
+
const useListboxOption = as === 'li' && !useTreeItem;
|
|
22
|
+
const showChevron = hasChildren && expandIcon != null && collapseIcon != null && onToggleExpand != null;
|
|
23
|
+
const indentPx = (level ?? 0) * ENVIRONMENT_LEVEL_INDENT_PX;
|
|
12
24
|
/**
|
|
13
25
|
* Opens environment settings when Enter is pressed on the name area.
|
|
14
26
|
*/
|
|
@@ -20,6 +32,8 @@ export function SidebarEnvironmentItem({ name, variableSummary, markerDot, selec
|
|
|
20
32
|
event.stopPropagation();
|
|
21
33
|
onEnter();
|
|
22
34
|
};
|
|
35
|
+
const chevronLabel = expanded ? `Collapse environment "${name}"` : `Expand environment "${name}"`;
|
|
36
|
+
const labelOffsetClass = useTreeItem ? SIDEBAR_CHEVRON_LABEL_OFFSET_CLASS : '';
|
|
23
37
|
return (_jsx(SidebarItem, { selected: selected, sortable: sortable, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
24
38
|
? {
|
|
25
39
|
ariaLabel,
|
|
@@ -29,7 +43,22 @@ export function SidebarEnvironmentItem({ name, variableSummary, markerDot, selec
|
|
|
29
43
|
onDoubleClick,
|
|
30
44
|
onKeyDown: onEnter != null ? handleKeyDown : undefined
|
|
31
45
|
}
|
|
32
|
-
: undefined,
|
|
46
|
+
: undefined, treeItem: useTreeItem
|
|
47
|
+
? {
|
|
48
|
+
ariaLabel,
|
|
49
|
+
expanded: hasChildren ? expanded : undefined,
|
|
50
|
+
controlsId: hasChildren ? childrenId : undefined,
|
|
51
|
+
level: (level ?? 0) + 1,
|
|
52
|
+
setSize,
|
|
53
|
+
posInSet,
|
|
54
|
+
onClick,
|
|
55
|
+
onDoubleClick,
|
|
56
|
+
onKeyDown: onEnter != null ? handleKeyDown : undefined
|
|
57
|
+
}
|
|
58
|
+
: undefined, children: _jsxs("span", { className: SIDEBAR_ITEM_BUTTON_CLASS, style: indentPx > 0 ? { paddingLeft: indentPx } : undefined, ...(dataSidebarEnvironmentId != null
|
|
33
59
|
? { 'data-sidebar-environment-id': String(dataSidebarEnvironmentId) }
|
|
34
|
-
: {}), children: [
|
|
60
|
+
: {}), children: [showChevron ? (_jsx("button", { type: "button", className: SIDEBAR_CHEVRON_BUTTON_CLASS, onClick: (event) => {
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
onToggleExpand();
|
|
63
|
+
}, onPointerDown: stopSortableDragPointerDown, tabIndex: -1, "aria-label": chevronLabel, children: _jsx(FaIcon, { icon: expanded ? collapseIcon : expandIcon, className: SIDEBAR_CHEVRON_ICON_CLASS }) })) : useTreeItem ? (_jsx("span", { className: "inline-flex h-4 w-4 shrink-0", "aria-hidden": true })) : null, _jsxs("span", { className: `inline-flex min-w-0 flex-1 items-center gap-1.5 ${labelOffsetClass}`, children: [_jsx("span", { className: "min-w-0 truncate", children: name }), markerDot != null ? (_jsx(SidebarMarkerDot, { marker: markerDot.marker, visible: markerDot.visible, label: markerDot.label })) : null] }), _jsx("span", { className: "shrink-0 text-muted", children: variableSummary })] }) }));
|
|
35
64
|
}
|
|
@@ -61,10 +61,14 @@ interface Props {
|
|
|
61
61
|
* HTML element for the row container. Use `li` inside {@link SidebarListbox}.
|
|
62
62
|
*/
|
|
63
63
|
as?: 'div' | 'li';
|
|
64
|
+
/**
|
|
65
|
+
* Additional class names merged onto the row container.
|
|
66
|
+
*/
|
|
67
|
+
className?: string;
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
70
|
* Renders a request or run history entry row in the Collections sidebar History section.
|
|
67
71
|
*/
|
|
68
|
-
export declare function SidebarHistoryItem({ method, name, isRun, status, statusText, statusDotVisible, methodColors, runIcon, selected, title, ariaLabel, onContextMenu, onClick, actions, as }: Props): JSX.Element;
|
|
72
|
+
export declare function SidebarHistoryItem({ method, name, isRun, status, statusText, statusDotVisible, methodColors, runIcon, selected, title, ariaLabel, onContextMenu, onClick, actions, as, className }: Props): JSX.Element;
|
|
69
73
|
export {};
|
|
70
74
|
//# sourceMappingURL=SidebarHistoryItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarHistoryItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarHistoryItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOxD,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IA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;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEnD;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,IAAI,EACJ,KAAa,EACb,MAAM,EACN,UAAU,EACV,gBAAuB,EACvB,YAAmB,EACnB,OAAO,EACP,QAAgB,EAChB,KAAK,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,EAAS,EACT,SAAS,EACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA0CrB"}
|
|
@@ -7,12 +7,12 @@ import { SIDEBAR_ITEM_BUTTON_CLASS, statusDotClass } from './sidebarItemClasses.
|
|
|
7
7
|
/**
|
|
8
8
|
* Renders a request or run history entry row in the Collections sidebar History section.
|
|
9
9
|
*/
|
|
10
|
-
export function SidebarHistoryItem({ method, name, isRun = false, status, statusText, statusDotVisible = true, methodColors = true, runIcon, selected = false, title, ariaLabel, onContextMenu, onClick, actions, as = 'li' }) {
|
|
10
|
+
export function SidebarHistoryItem({ method, name, isRun = false, status, statusText, statusDotVisible = true, methodColors = true, runIcon, selected = false, title, ariaLabel, onContextMenu, onClick, actions, as = 'li', className }) {
|
|
11
11
|
const useListboxOption = as === 'li';
|
|
12
12
|
const optionAriaLabel = !isRun && status != null && statusText != null
|
|
13
13
|
? `${ariaLabel}, responded ${status} ${statusText}`
|
|
14
14
|
: ariaLabel;
|
|
15
|
-
return (_jsx(SidebarItem, { selected: selected, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
15
|
+
return (_jsx(SidebarItem, { selected: selected, onContextMenu: onContextMenu, actions: actions, as: as, className: className, listboxOption: useListboxOption
|
|
16
16
|
? {
|
|
17
17
|
ariaLabel: optionAriaLabel,
|
|
18
18
|
onClick
|
|
@@ -38,6 +38,14 @@ interface Props {
|
|
|
38
38
|
* Called when the primary row area is activated.
|
|
39
39
|
*/
|
|
40
40
|
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Called when the primary row area is double-clicked.
|
|
43
|
+
*/
|
|
44
|
+
onDoubleClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Called when Enter is pressed on the primary row area.
|
|
47
|
+
*/
|
|
48
|
+
onEnter?: () => void;
|
|
41
49
|
/**
|
|
42
50
|
* Trailing actions slot, typically a row actions menu.
|
|
43
51
|
*/
|
|
@@ -50,6 +58,6 @@ interface Props {
|
|
|
50
58
|
/**
|
|
51
59
|
* Renders a workspace row in the Collections sidebar Workspaces section.
|
|
52
60
|
*/
|
|
53
|
-
export declare function SidebarWorkspaceItem({ name, summary, icon, markerDot, selected, sortable, onContextMenu, onClick, actions, as }: Props): JSX.Element;
|
|
61
|
+
export declare function SidebarWorkspaceItem({ name, summary, icon, markerDot, selected, sortable, onContextMenu, onClick, onDoubleClick, onEnter, actions, as }: Props): JSX.Element;
|
|
54
62
|
export {};
|
|
55
63
|
//# sourceMappingURL=SidebarWorkspaceItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarWorkspaceItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarWorkspaceItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"SidebarWorkspaceItem.d.ts","sourceRoot":"","sources":["../../../src/components/SidebarItem/SidebarWorkspaceItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE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AO,CAiDrB"}
|
|
@@ -6,11 +6,24 @@ import { SIDEBAR_ITEM_BUTTON_CLASS } from './sidebarItemClasses.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Renders a workspace row in the Collections sidebar Workspaces section.
|
|
8
8
|
*/
|
|
9
|
-
export function SidebarWorkspaceItem({ name, summary, icon, markerDot, selected = false, sortable, onContextMenu, onClick, actions, as = 'li' }) {
|
|
9
|
+
export function SidebarWorkspaceItem({ name, summary, icon, markerDot, selected = false, sortable, onContextMenu, onClick, onDoubleClick, onEnter, actions, as = 'li' }) {
|
|
10
10
|
const useListboxOption = as === 'li';
|
|
11
|
+
/**
|
|
12
|
+
* Opens workspace settings when Enter is pressed on the row.
|
|
13
|
+
*/
|
|
14
|
+
const handleKeyDown = (event) => {
|
|
15
|
+
if (event.key !== 'Enter' || onEnter == null) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
onEnter();
|
|
21
|
+
};
|
|
11
22
|
return (_jsx(SidebarItem, { selected: selected, sortable: sortable, onContextMenu: onContextMenu, actions: actions, as: as, listboxOption: useListboxOption
|
|
12
23
|
? {
|
|
13
|
-
onClick
|
|
24
|
+
onClick,
|
|
25
|
+
onDoubleClick,
|
|
26
|
+
onKeyDown: onEnter != null ? handleKeyDown : undefined
|
|
14
27
|
}
|
|
15
28
|
: undefined, children: _jsxs("span", { className: `${SIDEBAR_ITEM_BUTTON_CLASS} gap-2 rounded-md px-2 py-1`, children: [_jsx(FaIcon, { icon: icon, className: "h-3.5 w-3.5 shrink-0 text-muted", "aria-hidden": true }), _jsxs("span", { className: "inline-flex min-w-0 flex-1 items-center gap-1.5", children: [_jsx("span", { className: "min-w-0 truncate", children: name }), markerDot != null ? (_jsx(SidebarMarkerDot, { marker: markerDot.marker, visible: markerDot.visible, label: markerDot.label })) : null] }), _jsx("span", { className: "shrink-0 text-muted", children: summary })] }) }));
|
|
16
29
|
}
|
|
@@ -17,6 +17,9 @@ interface Props {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Cursor-positioned context menu for tab bars, rendered in a portal at the click point.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Menu groups, cursor anchor, and close handler.
|
|
22
|
+
* @returns Portal menu panel, or null when there are no items.
|
|
20
23
|
*/
|
|
21
24
|
export declare function TabContextMenu({ groups, position, onClose }: Props): JSX.Element | null;
|
|
22
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/TabBar/TabContextMenu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"TabContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/TabBar/TabContextMenu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AAU1E,UAAU,KAAK;IACb;;OAEG;IACH,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAoKvF"}
|