@principal-ade/dynamic-file-tree 0.1.69 → 0.1.71
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +259 -8
- package/dist/src/components/CanvasListTree/CanvasListTreeCore.d.ts.map +1 -1
- package/dist/src/components/CanvasListTree/types.d.ts +12 -1
- package/dist/src/components/CanvasListTree/types.d.ts.map +1 -1
- package/dist/src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTree.stories.d.ts +1 -0
- package/dist/src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTree.stories.d.ts.map +1 -1
- package/dist/src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.d.ts.map +1 -1
- package/dist/src/components/StoryboardWorkflowsTree/types.d.ts +12 -1
- package/dist/src/components/StoryboardWorkflowsTree/types.d.ts.map +1 -1
- package/dist/src/components/TreeNode.d.ts +21 -1
- package/dist/src/components/TreeNode.d.ts.map +1 -1
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { getDndProps } from './src/hooks/useDndManager';
|
|
|
3
3
|
export { DirectoryFilterInput } from './src/components/DirectoryFilterInput';
|
|
4
4
|
export type { DirectoryFilter, DirectoryFilterInputProps } from './src/components/DirectoryFilterInput';
|
|
5
5
|
export { TreeNode } from './src/components/TreeNode';
|
|
6
|
-
export type { TreeNodeProps, TreeNodeData } from './src/components/TreeNode';
|
|
6
|
+
export type { TreeNodeProps, TreeNodeData, DragConfig } from './src/components/TreeNode';
|
|
7
7
|
export { DynamicFileTree } from './src/components/DynamicFileTree';
|
|
8
8
|
export type { DynamicFileTreeProps } from './src/components/DynamicFileTree';
|
|
9
9
|
export { OrderedFileList } from './src/components/OrderedFileList';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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EACf,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,SAAS,EACT,aAAa,EACb,gBAAgB,GACjB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -251,7 +251,8 @@ var DirectoryFilterInput = ({
|
|
|
251
251
|
};
|
|
252
252
|
// src/components/TreeNode.tsx
|
|
253
253
|
import { ChevronRight, ChevronDown } from "lucide-react";
|
|
254
|
-
import React2, { useState as useState3 } from "react";
|
|
254
|
+
import React2, { useState as useState3, useCallback as useCallback2 } from "react";
|
|
255
|
+
var PANEL_DATA_MIME_TYPE = "application/x-panel-data";
|
|
255
256
|
function TreeNode({
|
|
256
257
|
node,
|
|
257
258
|
style,
|
|
@@ -265,10 +266,48 @@ function TreeNode({
|
|
|
265
266
|
verticalNodePadding = "3px",
|
|
266
267
|
onContextMenu,
|
|
267
268
|
onHover,
|
|
268
|
-
leftIcon
|
|
269
|
+
leftIcon,
|
|
270
|
+
dragConfig
|
|
269
271
|
}) {
|
|
270
272
|
const [isHovered, setIsHovered] = useState3(false);
|
|
273
|
+
const [isDragging, setIsDragging] = useState3(false);
|
|
271
274
|
const isFolder = node.isInternal;
|
|
275
|
+
const handleDragStart = useCallback2((e) => {
|
|
276
|
+
if (!dragConfig)
|
|
277
|
+
return;
|
|
278
|
+
const panelDragData = {
|
|
279
|
+
dataType: dragConfig.dataType,
|
|
280
|
+
primaryData: dragConfig.primaryData,
|
|
281
|
+
metadata: dragConfig.metadata,
|
|
282
|
+
suggestedActions: dragConfig.suggestedActions,
|
|
283
|
+
sourcePanel: dragConfig.sourcePanel
|
|
284
|
+
};
|
|
285
|
+
e.dataTransfer.setData(PANEL_DATA_MIME_TYPE, JSON.stringify(panelDragData));
|
|
286
|
+
e.dataTransfer.setData("text/plain", dragConfig.primaryData);
|
|
287
|
+
e.dataTransfer.effectAllowed = "copyMove";
|
|
288
|
+
if (dragConfig.dragPreview) {
|
|
289
|
+
const dragPreview = document.createElement("div");
|
|
290
|
+
dragPreview.textContent = dragConfig.dragPreview;
|
|
291
|
+
dragPreview.style.cssText = `
|
|
292
|
+
position: absolute;
|
|
293
|
+
top: -1000px;
|
|
294
|
+
padding: 4px 8px;
|
|
295
|
+
background: ${theme.colors.backgroundSecondary};
|
|
296
|
+
border: 1px solid ${theme.colors.border};
|
|
297
|
+
border-radius: 4px;
|
|
298
|
+
font-size: 12px;
|
|
299
|
+
color: ${theme.colors.text};
|
|
300
|
+
white-space: nowrap;
|
|
301
|
+
`;
|
|
302
|
+
document.body.appendChild(dragPreview);
|
|
303
|
+
e.dataTransfer.setDragImage(dragPreview, 0, 0);
|
|
304
|
+
setTimeout(() => document.body.removeChild(dragPreview), 0);
|
|
305
|
+
}
|
|
306
|
+
setIsDragging(true);
|
|
307
|
+
}, [dragConfig, theme]);
|
|
308
|
+
const handleDragEnd = useCallback2(() => {
|
|
309
|
+
setIsDragging(false);
|
|
310
|
+
}, []);
|
|
272
311
|
const leftElement = leftIcon ? /* @__PURE__ */ React2.createElement("span", {
|
|
273
312
|
style: { marginRight: "6px", display: "flex", alignItems: "center" }
|
|
274
313
|
}, leftIcon) : isFolder ? /* @__PURE__ */ React2.createElement("span", {
|
|
@@ -283,13 +322,14 @@ function TreeNode({
|
|
|
283
322
|
const backgroundColor = node.isSelected ? `${theme.colors.primary}20` : isSelectedDirectory ? `${theme.colors.primary}15` : isHovered ? `${theme.colors.text}10` : "transparent";
|
|
284
323
|
const border = node.isSelected ? `1px solid ${theme.colors.primary}` : "1px solid transparent";
|
|
285
324
|
const color = nameColor ? nameColor : node.isSelected || isSelectedDirectory ? theme.colors.primary : theme.colors.text;
|
|
325
|
+
const isDraggable = !!dragConfig;
|
|
286
326
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
287
327
|
style: {
|
|
288
328
|
...style,
|
|
289
329
|
backgroundColor,
|
|
290
330
|
border,
|
|
291
331
|
color,
|
|
292
|
-
cursor: "pointer",
|
|
332
|
+
cursor: isDraggable ? isDragging ? "grabbing" : "grab" : "pointer",
|
|
293
333
|
paddingLeft: `calc(${horizontalNodePadding} + ${node.level * 16}px)`,
|
|
294
334
|
paddingRight: horizontalNodePadding,
|
|
295
335
|
paddingTop: verticalNodePadding,
|
|
@@ -298,9 +338,14 @@ function TreeNode({
|
|
|
298
338
|
alignItems: "center",
|
|
299
339
|
justifyContent: "space-between",
|
|
300
340
|
boxSizing: "border-box",
|
|
301
|
-
lineHeight: "20px"
|
|
341
|
+
lineHeight: "20px",
|
|
342
|
+
opacity: isDragging ? 0.5 : 1,
|
|
343
|
+
transition: "opacity 0.2s ease"
|
|
302
344
|
},
|
|
303
345
|
ref: dragHandle,
|
|
346
|
+
draggable: isDraggable,
|
|
347
|
+
onDragStart: isDraggable ? handleDragStart : undefined,
|
|
348
|
+
onDragEnd: isDraggable ? handleDragEnd : undefined,
|
|
304
349
|
onClick: () => node.isInternal ? node.toggle() : node.select(),
|
|
305
350
|
onContextMenu: (e) => {
|
|
306
351
|
if (onContextMenu) {
|
|
@@ -2166,6 +2211,118 @@ var buildTreeDataFromVersions = (versionSnapshots, workflowCoverageMap, filterMo
|
|
|
2166
2211
|
}
|
|
2167
2212
|
return result;
|
|
2168
2213
|
};
|
|
2214
|
+
var getDefaultDragConfig = (node) => {
|
|
2215
|
+
const DATA_TYPES = {
|
|
2216
|
+
TEXT_SELECTION: "text-selection"
|
|
2217
|
+
};
|
|
2218
|
+
const DRAG_ACTIONS = {
|
|
2219
|
+
INSERT_PATH: "insert-path",
|
|
2220
|
+
OPEN: "open"
|
|
2221
|
+
};
|
|
2222
|
+
const CLI = "npx @principal-ai/principal-view-cli@latest";
|
|
2223
|
+
switch (node.type) {
|
|
2224
|
+
case "canvas":
|
|
2225
|
+
if (node.canvas) {
|
|
2226
|
+
const canvasType = node.canvas.type === "otel" ? "OTEL Canvas" : "Canvas";
|
|
2227
|
+
const content = [
|
|
2228
|
+
`# ${canvasType}: ${node.canvas.name}`,
|
|
2229
|
+
`# View with: ${CLI} canvas view "${node.canvas.path}"`,
|
|
2230
|
+
node.canvas.path
|
|
2231
|
+
].join(`
|
|
2232
|
+
`);
|
|
2233
|
+
return {
|
|
2234
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2235
|
+
primaryData: content,
|
|
2236
|
+
metadata: {
|
|
2237
|
+
name: node.canvas.name,
|
|
2238
|
+
type: "canvas",
|
|
2239
|
+
canvasType: node.canvas.type,
|
|
2240
|
+
storyboardId: node.storyboard?.id,
|
|
2241
|
+
path: node.canvas.path
|
|
2242
|
+
},
|
|
2243
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH, DRAG_ACTIONS.OPEN],
|
|
2244
|
+
sourcePanel: "storyboard-list",
|
|
2245
|
+
dragPreview: `${canvasType}: ${node.canvas.name}`
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
break;
|
|
2249
|
+
case "workflow":
|
|
2250
|
+
if (node.workflow) {
|
|
2251
|
+
const content = [
|
|
2252
|
+
`# Workflow: ${node.workflow.name}`,
|
|
2253
|
+
`# Run with: ${CLI} workflow run "${node.workflow.path}"`,
|
|
2254
|
+
node.workflow.path
|
|
2255
|
+
].join(`
|
|
2256
|
+
`);
|
|
2257
|
+
return {
|
|
2258
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2259
|
+
primaryData: content,
|
|
2260
|
+
metadata: {
|
|
2261
|
+
name: node.workflow.name,
|
|
2262
|
+
type: "workflow",
|
|
2263
|
+
storyboardId: node.storyboard?.id,
|
|
2264
|
+
workflowId: node.workflow.id,
|
|
2265
|
+
path: node.workflow.path
|
|
2266
|
+
},
|
|
2267
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH, DRAG_ACTIONS.OPEN],
|
|
2268
|
+
sourcePanel: "storyboard-list",
|
|
2269
|
+
dragPreview: `Workflow: ${node.workflow.name}`
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
break;
|
|
2273
|
+
case "overview":
|
|
2274
|
+
if (node.markdownPath) {
|
|
2275
|
+
const content = [
|
|
2276
|
+
`# Overview: ${node.storyboard?.name || node.name}`,
|
|
2277
|
+
`# Documentation: ${node.markdownPath}`,
|
|
2278
|
+
node.markdownPath
|
|
2279
|
+
].join(`
|
|
2280
|
+
`);
|
|
2281
|
+
return {
|
|
2282
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2283
|
+
primaryData: content,
|
|
2284
|
+
metadata: {
|
|
2285
|
+
name: node.name,
|
|
2286
|
+
type: "overview",
|
|
2287
|
+
storyboardId: node.storyboard?.id,
|
|
2288
|
+
path: node.markdownPath
|
|
2289
|
+
},
|
|
2290
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH, DRAG_ACTIONS.OPEN],
|
|
2291
|
+
sourcePanel: "storyboard-list",
|
|
2292
|
+
dragPreview: `Overview: ${node.storyboard?.name || node.name}`
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
2295
|
+
break;
|
|
2296
|
+
case "storyboard":
|
|
2297
|
+
if (node.storyboard) {
|
|
2298
|
+
const content = [
|
|
2299
|
+
`# Storyboard: ${node.storyboard.name}`,
|
|
2300
|
+
`# Contains ${node.storyboard.workflows.length} workflow(s)`,
|
|
2301
|
+
`# Info: ${CLI} storyboard info "${node.storyboard.path}"`,
|
|
2302
|
+
node.storyboard.path
|
|
2303
|
+
].join(`
|
|
2304
|
+
`);
|
|
2305
|
+
return {
|
|
2306
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2307
|
+
primaryData: content,
|
|
2308
|
+
metadata: {
|
|
2309
|
+
name: node.storyboard.name,
|
|
2310
|
+
type: "storyboard",
|
|
2311
|
+
canvasPath: node.storyboard.canvas.path,
|
|
2312
|
+
workflowCount: node.storyboard.workflows.length,
|
|
2313
|
+
path: node.storyboard.path
|
|
2314
|
+
},
|
|
2315
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH],
|
|
2316
|
+
sourcePanel: "storyboard-list",
|
|
2317
|
+
dragPreview: `Storyboard: ${node.storyboard.name}`
|
|
2318
|
+
};
|
|
2319
|
+
}
|
|
2320
|
+
break;
|
|
2321
|
+
default:
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
return;
|
|
2325
|
+
};
|
|
2169
2326
|
var StoryboardWorkflowsTreeCore = ({
|
|
2170
2327
|
storyboards,
|
|
2171
2328
|
theme,
|
|
@@ -2181,7 +2338,9 @@ var StoryboardWorkflowsTreeCore = ({
|
|
|
2181
2338
|
versionSnapshots,
|
|
2182
2339
|
workflowFilterMode = "all",
|
|
2183
2340
|
traceWorkflowsSet,
|
|
2184
|
-
gitStatusData
|
|
2341
|
+
gitStatusData,
|
|
2342
|
+
enablePanelDrag = false,
|
|
2343
|
+
getDragConfig
|
|
2185
2344
|
}) => {
|
|
2186
2345
|
const dndProps = getDndProps(enableDragAndDrop);
|
|
2187
2346
|
const gitStatusMap = useMemo9(() => {
|
|
@@ -2265,6 +2424,7 @@ var StoryboardWorkflowsTreeCore = ({
|
|
|
2265
2424
|
style: { display: "flex", alignItems: "center" }
|
|
2266
2425
|
}, indicators) : undefined;
|
|
2267
2426
|
})();
|
|
2427
|
+
const dragConfig = enablePanelDrag ? getDragConfig ? getDragConfig(data) : getDefaultDragConfig(data) : undefined;
|
|
2268
2428
|
return /* @__PURE__ */ React12.createElement(TreeNode, {
|
|
2269
2429
|
...props,
|
|
2270
2430
|
theme,
|
|
@@ -2272,7 +2432,8 @@ var StoryboardWorkflowsTreeCore = ({
|
|
|
2272
2432
|
leftIcon: icon,
|
|
2273
2433
|
rightContent,
|
|
2274
2434
|
horizontalNodePadding: nodeHorizontalPadding,
|
|
2275
|
-
verticalNodePadding
|
|
2435
|
+
verticalNodePadding,
|
|
2436
|
+
dragConfig
|
|
2276
2437
|
});
|
|
2277
2438
|
};
|
|
2278
2439
|
const lastSelectionRef = useRef5(null);
|
|
@@ -2634,6 +2795,92 @@ var buildTreeData = (canvases, gitStatusMap) => {
|
|
|
2634
2795
|
return allCanvases.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
2635
2796
|
}
|
|
2636
2797
|
};
|
|
2798
|
+
var getDefaultCanvasDragConfig = (node) => {
|
|
2799
|
+
const DATA_TYPES = {
|
|
2800
|
+
TEXT_SELECTION: "text-selection"
|
|
2801
|
+
};
|
|
2802
|
+
const DRAG_ACTIONS = {
|
|
2803
|
+
INSERT_PATH: "insert-path",
|
|
2804
|
+
OPEN: "open"
|
|
2805
|
+
};
|
|
2806
|
+
const CLI = "npx @principal-ai/principal-view-cli@latest";
|
|
2807
|
+
switch (node.type) {
|
|
2808
|
+
case "canvas":
|
|
2809
|
+
if (node.canvas) {
|
|
2810
|
+
const canvasType = node.canvas.type === "otel" ? "OTEL Canvas" : "Canvas";
|
|
2811
|
+
const content = [
|
|
2812
|
+
`# ${canvasType}: ${node.canvas.name}`,
|
|
2813
|
+
`# View with: ${CLI} canvas view "${node.canvas.path}"`,
|
|
2814
|
+
node.canvas.path
|
|
2815
|
+
].join(`
|
|
2816
|
+
`);
|
|
2817
|
+
return {
|
|
2818
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2819
|
+
primaryData: content,
|
|
2820
|
+
metadata: {
|
|
2821
|
+
name: node.canvas.name,
|
|
2822
|
+
type: "canvas",
|
|
2823
|
+
canvasType: node.canvas.type,
|
|
2824
|
+
path: node.canvas.path
|
|
2825
|
+
},
|
|
2826
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH, DRAG_ACTIONS.OPEN],
|
|
2827
|
+
sourcePanel: "canvas-list",
|
|
2828
|
+
dragPreview: `${canvasType}: ${node.canvas.name}`
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
break;
|
|
2832
|
+
case "overview":
|
|
2833
|
+
if (node.markdownPath) {
|
|
2834
|
+
const content = [
|
|
2835
|
+
`# Overview: ${node.canvas?.name || node.name}`,
|
|
2836
|
+
`# Documentation: ${node.markdownPath}`,
|
|
2837
|
+
node.markdownPath
|
|
2838
|
+
].join(`
|
|
2839
|
+
`);
|
|
2840
|
+
return {
|
|
2841
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2842
|
+
primaryData: content,
|
|
2843
|
+
metadata: {
|
|
2844
|
+
name: node.name,
|
|
2845
|
+
type: "overview",
|
|
2846
|
+
canvasId: node.canvas?.id,
|
|
2847
|
+
path: node.markdownPath
|
|
2848
|
+
},
|
|
2849
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH, DRAG_ACTIONS.OPEN],
|
|
2850
|
+
sourcePanel: "canvas-list",
|
|
2851
|
+
dragPreview: `Overview: ${node.canvas?.name || node.name}`
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2854
|
+
break;
|
|
2855
|
+
case "canvas-folder":
|
|
2856
|
+
if (node.canvas) {
|
|
2857
|
+
const folderPath = node.canvas.path.replace(/\/[^/]+$/, "");
|
|
2858
|
+
const content = [
|
|
2859
|
+
`# Canvas Folder: ${node.canvas.name}`,
|
|
2860
|
+
`# Info: ${CLI} canvas info "${node.canvas.path}"`,
|
|
2861
|
+
folderPath
|
|
2862
|
+
].join(`
|
|
2863
|
+
`);
|
|
2864
|
+
return {
|
|
2865
|
+
dataType: DATA_TYPES.TEXT_SELECTION,
|
|
2866
|
+
primaryData: content,
|
|
2867
|
+
metadata: {
|
|
2868
|
+
name: node.canvas.name,
|
|
2869
|
+
type: "canvas-folder",
|
|
2870
|
+
canvasPath: node.canvas.path,
|
|
2871
|
+
path: folderPath
|
|
2872
|
+
},
|
|
2873
|
+
suggestedActions: [DRAG_ACTIONS.INSERT_PATH],
|
|
2874
|
+
sourcePanel: "canvas-list",
|
|
2875
|
+
dragPreview: `Folder: ${node.canvas.name}`
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
break;
|
|
2879
|
+
default:
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
return;
|
|
2883
|
+
};
|
|
2637
2884
|
var CanvasListTreeCore = ({
|
|
2638
2885
|
canvases,
|
|
2639
2886
|
theme,
|
|
@@ -2645,7 +2892,9 @@ var CanvasListTreeCore = ({
|
|
|
2645
2892
|
verticalNodePadding = "6px",
|
|
2646
2893
|
verticalPadding = "20px",
|
|
2647
2894
|
enableDragAndDrop = false,
|
|
2648
|
-
gitStatusData
|
|
2895
|
+
gitStatusData,
|
|
2896
|
+
enablePanelDrag = false,
|
|
2897
|
+
getDragConfig
|
|
2649
2898
|
}) => {
|
|
2650
2899
|
const dndProps = getDndProps(enableDragAndDrop);
|
|
2651
2900
|
const gitStatusMap = useMemo11(() => {
|
|
@@ -2683,6 +2932,7 @@ var CanvasListTreeCore = ({
|
|
|
2683
2932
|
}
|
|
2684
2933
|
return;
|
|
2685
2934
|
})();
|
|
2935
|
+
const dragConfig = enablePanelDrag ? getDragConfig ? getDragConfig(data) : getDefaultCanvasDragConfig(data) : undefined;
|
|
2686
2936
|
return /* @__PURE__ */ React14.createElement(TreeNode, {
|
|
2687
2937
|
...props,
|
|
2688
2938
|
theme,
|
|
@@ -2690,7 +2940,8 @@ var CanvasListTreeCore = ({
|
|
|
2690
2940
|
leftIcon: icon,
|
|
2691
2941
|
rightContent,
|
|
2692
2942
|
horizontalNodePadding: nodeHorizontalPadding,
|
|
2693
|
-
verticalNodePadding
|
|
2943
|
+
verticalNodePadding,
|
|
2944
|
+
dragConfig
|
|
2694
2945
|
});
|
|
2695
2946
|
};
|
|
2696
2947
|
const lastSelectionRef = useRef6(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasListTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/CanvasListTree/CanvasListTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAQ/C,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"CanvasListTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/CanvasListTree/CanvasListTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAQ/C,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAuNjB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqK5D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Theme } from '@principal-ade/industry-theme';
|
|
2
2
|
import type { DiscoveredCanvas } from '@principal-ai/principal-view-core';
|
|
3
3
|
import type { GitFileStatus, GitStatus } from '../../utils/gitStatus';
|
|
4
|
-
import type { TreeNodeData } from '../TreeNode';
|
|
4
|
+
import type { TreeNodeData, DragConfig } from '../TreeNode';
|
|
5
5
|
export type { DiscoveredCanvas };
|
|
6
6
|
export type CanvasListNodeType = 'package' | 'canvas-folder' | 'canvas' | 'overview';
|
|
7
7
|
export interface CanvasListNodeData extends TreeNodeData {
|
|
@@ -25,5 +25,16 @@ export interface CanvasListTreeProps {
|
|
|
25
25
|
verticalPadding?: string;
|
|
26
26
|
enableDragAndDrop?: boolean;
|
|
27
27
|
gitStatusData?: GitFileStatus[];
|
|
28
|
+
/**
|
|
29
|
+
* Enable dragging nodes to other panels (e.g., terminal).
|
|
30
|
+
* When enabled, nodes will transfer their path/data using the panel-framework-core format.
|
|
31
|
+
*/
|
|
32
|
+
enablePanelDrag?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Optional callback to customize the drag config for each node.
|
|
35
|
+
* If not provided, default configs are generated based on node type.
|
|
36
|
+
* Return undefined to disable dragging for a specific node.
|
|
37
|
+
*/
|
|
38
|
+
getDragConfig?: (node: CanvasListNodeData) => DragConfig | undefined;
|
|
28
39
|
}
|
|
29
40
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/CanvasListTree/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/CanvasListTree/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG5D,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,eAAe,GAAG,QAAQ,GAAG,UAAU,CAAC;AAErF,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAGhC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;IAGhC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,UAAU,GAAG,SAAS,CAAC;CACtE"}
|
|
@@ -30,4 +30,5 @@ export declare const WithGitStatus: Story;
|
|
|
30
30
|
export declare const GitStatusAllTypes: Story;
|
|
31
31
|
export declare const GitStatusWithVersionGrouping: Story;
|
|
32
32
|
export declare const GitStatusMixedScenarios: Story;
|
|
33
|
+
export declare const DragAndDropTest: Story;
|
|
33
34
|
//# sourceMappingURL=StoryboardWorkflowsTree.stories.d.ts.map
|
package/dist/src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTree.stories.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryboardWorkflowsTree.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTree.stories.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAyP5E,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,2BAA2B,CAOlD,CAAC;AAEF,eAAe,IAAI,CAAC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C;AA4CF,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAqEvC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAyFvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAiH9B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KA2GzC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KAyEzC,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,KAwF3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KA0H/B,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,KAwF1C,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAuIrC,CAAC;AAMF,eAAO,MAAM,eAAe,EAAE,KAqK7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAQ/C,OAAO,KAAK,EAEV,4BAA4B,EAK7B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAQ/C,OAAO,KAAK,EAEV,4BAA4B,EAK7B,MAAM,SAAS,CAAC;AA4XjB,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAyO9E,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Theme } from '@principal-ade/industry-theme';
|
|
2
2
|
import type { DiscoveredStoryboard, DiscoveredCanvas, DiscoveredWorkflow, DiscoveredWorkflowWithContent, WorkflowTemplate, VersionSnapshot } from '@principal-ai/principal-view-core';
|
|
3
3
|
import type { GitFileStatus, GitStatus } from '../../utils/gitStatus';
|
|
4
|
-
import type { TreeNodeData } from '../TreeNode';
|
|
4
|
+
import type { TreeNodeData, DragConfig } from '../TreeNode';
|
|
5
5
|
export type { DiscoveredStoryboard, DiscoveredCanvas, DiscoveredWorkflow, DiscoveredWorkflowWithContent, WorkflowTemplate, VersionSnapshot };
|
|
6
6
|
export type StoryboardWorkflowNodeType = 'version' | 'package' | 'storyboard' | 'overview' | 'canvas' | 'workflows' | 'workflow';
|
|
7
7
|
/**
|
|
@@ -51,5 +51,16 @@ export interface StoryboardWorkflowsTreeProps {
|
|
|
51
51
|
workflowFilterMode?: StoryboardFilterMode;
|
|
52
52
|
traceWorkflowsSet?: Set<string>;
|
|
53
53
|
gitStatusData?: GitFileStatus[];
|
|
54
|
+
/**
|
|
55
|
+
* Enable dragging nodes to other panels (e.g., terminal).
|
|
56
|
+
* When enabled, nodes will transfer their path/data using the panel-framework-core format.
|
|
57
|
+
*/
|
|
58
|
+
enablePanelDrag?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Optional callback to customize the drag config for each node.
|
|
61
|
+
* If not provided, default configs are generated based on node type.
|
|
62
|
+
* Return undefined to disable dragging for a specific node.
|
|
63
|
+
*/
|
|
64
|
+
getDragConfig?: (node: StoryboardWorkflowNodeData) => DragConfig | undefined;
|
|
54
65
|
}
|
|
55
66
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEtL,OAAO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 -7,6 +7,24 @@ export interface TreeNodeData {
|
|
|
7
7
|
children?: TreeNodeData[];
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for making a tree node draggable to other panels.
|
|
12
|
+
* Uses the panel-framework-core drag data format for cross-panel communication.
|
|
13
|
+
*/
|
|
14
|
+
export interface DragConfig {
|
|
15
|
+
/** The type of data being dragged (e.g., 'file-path', 'directory-path', 'text-selection') */
|
|
16
|
+
dataType: string;
|
|
17
|
+
/** The primary data to transfer (e.g., the file path) */
|
|
18
|
+
primaryData: string;
|
|
19
|
+
/** Optional metadata to include with the drag data */
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
/** Suggested actions for the target (e.g., ['insert-path', 'open']) */
|
|
22
|
+
suggestedActions?: string[];
|
|
23
|
+
/** Source panel identifier */
|
|
24
|
+
sourcePanel?: string;
|
|
25
|
+
/** Text shown during drag preview */
|
|
26
|
+
dragPreview?: string;
|
|
27
|
+
}
|
|
10
28
|
export interface TreeNodeProps<T extends TreeNodeData> extends NodeRendererProps<T> {
|
|
11
29
|
theme: Theme;
|
|
12
30
|
rightContent?: ReactNode;
|
|
@@ -18,6 +36,8 @@ export interface TreeNodeProps<T extends TreeNodeData> extends NodeRendererProps
|
|
|
18
36
|
onContextMenu?: (event: React.MouseEvent, node: NodeRendererProps<T>['node']) => void;
|
|
19
37
|
onHover?: (isHovered: boolean, node: NodeRendererProps<T>['node']) => void;
|
|
20
38
|
leftIcon?: ReactNode;
|
|
39
|
+
/** Configuration for making this node draggable to other panels */
|
|
40
|
+
dragConfig?: DragConfig;
|
|
21
41
|
}
|
|
22
|
-
export declare function TreeNode<T extends TreeNodeData>({ node, style, dragHandle, theme, rightContent, extraContent, isSelectedDirectory, nameColor, horizontalNodePadding, verticalNodePadding, onContextMenu, onHover, leftIcon, }: TreeNodeProps<T>): React.JSX.Element;
|
|
42
|
+
export declare function TreeNode<T extends TreeNodeData>({ node, style, dragHandle, theme, rightContent, extraContent, isSelectedDirectory, nameColor, horizontalNodePadding, verticalNodePadding, onContextMenu, onHover, leftIcon, dragConfig, }: TreeNodeProps<T>): React.JSX.Element;
|
|
23
43
|
//# sourceMappingURL=TreeNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.d.ts","sourceRoot":"","sources":["../../../src/components/TreeNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,EAAY,SAAS,
|
|
1
|
+
{"version":3,"file":"TreeNode.d.ts","sourceRoot":"","sources":["../../../src/components/TreeNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,EAAY,SAAS,EAAe,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,6FAA6F;IAC7F,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,YAAY,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IACjF,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACtF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mEAAmE;IACnE,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAKD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAAE,EAC/C,IAAI,EACJ,KAAK,EACL,UAAU,EACV,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,mBAA2B,EAC3B,SAAS,EACT,qBAA6B,EAC7B,mBAA2B,EAC3B,aAAa,EACb,OAAO,EACP,QAAQ,EACR,UAAU,GACX,EAAE,aAAa,CAAC,CAAC,CAAC,qBAwJlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ade/dynamic-file-tree",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.71",
|
|
4
4
|
"description": "React component for selective directory filtering and file tree visualization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "bun run clean && bun run build:esm && bun run build:types",
|
|
20
|
-
"build:esm": "bun build ./index.ts --outfile ./dist/index.mjs --format esm --target browser --external react --external react-dom --external lucide-react --external react-arborist --external @principal-ade/industry-theme --external @principal-ai/repository-abstraction --external @principal-ai/principal-view-core",
|
|
20
|
+
"build:esm": "bun build ./index.ts --outfile ./dist/index.mjs --format esm --target browser --external react --external react-dom --external lucide-react --external react-arborist --external @principal-ade/industry-theme --external @principal-ade/panel-framework-core --external @principal-ai/repository-abstraction --external @principal-ai/principal-view-core",
|
|
21
21
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationMap",
|
|
22
22
|
"dev": "bun run build --watch",
|
|
23
23
|
"test": "bun test",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@principal-ade/industry-theme": ">=0.1.0",
|
|
51
|
+
"@principal-ade/panel-framework-core": ">=0.4.0",
|
|
51
52
|
"@principal-ai/principal-view-core": "^0.24.8",
|
|
52
53
|
"@principal-ai/repository-abstraction": "^0.5.7",
|
|
53
54
|
"lucide-react": ">=0.263.0",
|
|
@@ -58,6 +59,9 @@
|
|
|
58
59
|
"@principal-ade/industry-theme": {
|
|
59
60
|
"optional": false
|
|
60
61
|
},
|
|
62
|
+
"@principal-ade/panel-framework-core": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
61
65
|
"react": {
|
|
62
66
|
"optional": true
|
|
63
67
|
},
|
|
@@ -71,6 +75,7 @@
|
|
|
71
75
|
"devDependencies": {
|
|
72
76
|
"@eslint/js": "^9.32.0",
|
|
73
77
|
"@principal-ade/industry-theme": "^0.1.0",
|
|
78
|
+
"@principal-ade/panel-framework-core": "^0.4.2",
|
|
74
79
|
"@principal-ai/principal-view-core": "^0.24.8",
|
|
75
80
|
"@principal-ai/repository-abstraction": "^0.5.7",
|
|
76
81
|
"@storybook/addon-docs": "^10.0.0",
|