@principal-ade/dynamic-file-tree 0.2.22 → 0.2.23
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.mjs
CHANGED
|
@@ -3034,19 +3034,20 @@ var WorkflowScenarioTreeCore = ({
|
|
|
3034
3034
|
}, NodeRenderer));
|
|
3035
3035
|
};
|
|
3036
3036
|
// src/components/CanvasListTree/CanvasListTreeCore.tsx
|
|
3037
|
-
import { Package as Package3, Folder, LayoutDashboard as LayoutDashboard2, FileText } from "lucide-react";
|
|
3037
|
+
import { Package as Package3, Folder, LayoutDashboard as LayoutDashboard2, FileText, Layers, Network } from "lucide-react";
|
|
3038
3038
|
import React15, { useMemo as useMemo11, useRef as useRef6 } from "react";
|
|
3039
3039
|
import { Tree as Tree5 } from "react-arborist";
|
|
3040
3040
|
var buildTreeData = (canvases, gitStatusMap) => {
|
|
3041
|
-
const
|
|
3042
|
-
const
|
|
3041
|
+
const resourcesScopesCanvases = [];
|
|
3042
|
+
const spansCanvases = [];
|
|
3043
|
+
const regularCanvases = [];
|
|
3043
3044
|
for (const canvas of canvases) {
|
|
3044
|
-
if (canvas.
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3045
|
+
if (canvas.type === "resources" || canvas.type === "scopes") {
|
|
3046
|
+
resourcesScopesCanvases.push(canvas);
|
|
3047
|
+
} else if (canvas.type === "spans") {
|
|
3048
|
+
spansCanvases.push(canvas);
|
|
3048
3049
|
} else {
|
|
3049
|
-
|
|
3050
|
+
regularCanvases.push(canvas);
|
|
3050
3051
|
}
|
|
3051
3052
|
}
|
|
3052
3053
|
const buildCanvasNode = (canvas) => {
|
|
@@ -3078,47 +3079,84 @@ var buildTreeData = (canvases, gitStatusMap) => {
|
|
|
3078
3079
|
children
|
|
3079
3080
|
};
|
|
3080
3081
|
};
|
|
3081
|
-
const
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
packageName,
|
|
3093
|
-
scope: "package",
|
|
3094
|
-
children: canvasNodes
|
|
3095
|
-
});
|
|
3082
|
+
const buildPackageGroupedCanvases = (canvasesToGroup) => {
|
|
3083
|
+
const packagesMap = new Map;
|
|
3084
|
+
const rootCanvasesList = [];
|
|
3085
|
+
for (const canvas of canvasesToGroup) {
|
|
3086
|
+
if (canvas.scope === "package" && canvas.packageName) {
|
|
3087
|
+
const existing = packagesMap.get(canvas.packageName) || [];
|
|
3088
|
+
existing.push(canvas);
|
|
3089
|
+
packagesMap.set(canvas.packageName, existing);
|
|
3090
|
+
} else {
|
|
3091
|
+
rootCanvasesList.push(canvas);
|
|
3092
|
+
}
|
|
3096
3093
|
}
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3094
|
+
const hasMultiplePackages = packagesMap.size > 1;
|
|
3095
|
+
const hasRootAndPackages = packagesMap.size > 0 && rootCanvasesList.length > 0;
|
|
3096
|
+
const shouldShowPackageLevel = hasMultiplePackages || hasRootAndPackages;
|
|
3097
|
+
if (shouldShowPackageLevel) {
|
|
3098
|
+
const result2 = [];
|
|
3099
|
+
for (const [packageName, packageCanvases] of packagesMap) {
|
|
3100
|
+
const canvasNodes = packageCanvases.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
3101
|
+
result2.push({
|
|
3102
|
+
id: `package:${packageName}`,
|
|
3103
|
+
name: packageName,
|
|
3104
|
+
type: "package",
|
|
3105
|
+
packageName,
|
|
3106
|
+
scope: "package",
|
|
3107
|
+
children: canvasNodes
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
if (rootCanvasesList.length > 0) {
|
|
3111
|
+
const rootCanvasNodes = rootCanvasesList.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
3112
|
+
result2.push({
|
|
3113
|
+
id: "package:root",
|
|
3114
|
+
name: "Root",
|
|
3115
|
+
type: "package",
|
|
3116
|
+
packageName: "root",
|
|
3117
|
+
scope: "root",
|
|
3118
|
+
children: rootCanvasNodes
|
|
3119
|
+
});
|
|
3120
|
+
}
|
|
3121
|
+
return result2.sort((a, b) => {
|
|
3122
|
+
if (a.packageName === "root")
|
|
3123
|
+
return 1;
|
|
3124
|
+
if (b.packageName === "root")
|
|
3125
|
+
return -1;
|
|
3126
|
+
return a.name.localeCompare(b.name);
|
|
3106
3127
|
});
|
|
3128
|
+
} else {
|
|
3129
|
+
const allCanvases = [...rootCanvasesList];
|
|
3130
|
+
for (const packageCanvases of packagesMap.values()) {
|
|
3131
|
+
allCanvases.push(...packageCanvases);
|
|
3132
|
+
}
|
|
3133
|
+
return allCanvases.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
3107
3134
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3135
|
+
};
|
|
3136
|
+
const result = [];
|
|
3137
|
+
if (resourcesScopesCanvases.length > 0) {
|
|
3138
|
+
const resourcesScopesNodes = resourcesScopesCanvases.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
3139
|
+
result.push({
|
|
3140
|
+
id: "architecture-group:resources-scopes",
|
|
3141
|
+
name: "Resources & Scopes",
|
|
3142
|
+
type: "architecture-group",
|
|
3143
|
+
architectureGroupType: "resources-scopes",
|
|
3144
|
+
children: resourcesScopesNodes
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
if (spansCanvases.length > 0) {
|
|
3148
|
+
const spansNodes = spansCanvases.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
3149
|
+
result.push({
|
|
3150
|
+
id: "architecture-group:spans",
|
|
3151
|
+
name: "Spans",
|
|
3152
|
+
type: "architecture-group",
|
|
3153
|
+
architectureGroupType: "spans",
|
|
3154
|
+
children: spansNodes
|
|
3114
3155
|
});
|
|
3115
|
-
} else {
|
|
3116
|
-
const allCanvases = [...rootCanvases];
|
|
3117
|
-
for (const packageCanvases of packagesMap.values()) {
|
|
3118
|
-
allCanvases.push(...packageCanvases);
|
|
3119
|
-
}
|
|
3120
|
-
return allCanvases.map(buildCanvasNode).sort((a, b) => a.name.localeCompare(b.name));
|
|
3121
3156
|
}
|
|
3157
|
+
const regularNodes = buildPackageGroupedCanvases(regularCanvases);
|
|
3158
|
+
result.push(...regularNodes);
|
|
3159
|
+
return result;
|
|
3122
3160
|
};
|
|
3123
3161
|
var getDefaultCanvasDragConfig = (node) => {
|
|
3124
3162
|
const DATA_TYPES = {
|
|
@@ -3238,7 +3276,11 @@ var CanvasListTreeCore = ({
|
|
|
3238
3276
|
const NodeRenderer = (props) => {
|
|
3239
3277
|
const { node } = props;
|
|
3240
3278
|
const data = node.data;
|
|
3241
|
-
const icon = data.type === "
|
|
3279
|
+
const icon = data.type === "architecture-group" ? data.architectureGroupType === "resources-scopes" ? /* @__PURE__ */ React15.createElement(Layers, {
|
|
3280
|
+
size: 16
|
|
3281
|
+
}) : /* @__PURE__ */ React15.createElement(Network, {
|
|
3282
|
+
size: 16
|
|
3283
|
+
}) : data.type === "package" ? /* @__PURE__ */ React15.createElement(Package3, {
|
|
3242
3284
|
size: 16
|
|
3243
3285
|
}) : data.type === "canvas-folder" ? /* @__PURE__ */ React15.createElement(Folder, {
|
|
3244
3286
|
size: 16
|
|
@@ -3247,7 +3289,7 @@ var CanvasListTreeCore = ({
|
|
|
3247
3289
|
}) : /* @__PURE__ */ React15.createElement(LayoutDashboard2, {
|
|
3248
3290
|
size: 16
|
|
3249
3291
|
});
|
|
3250
|
-
const nameColor = data.type === "package" ? theme.colors.primary : data.type === "canvas-folder" ? theme.colors.textSecondary : data.type === "overview" ? theme.colors.info || "#3b82f6" : theme.colors.warning || "#f59e0b";
|
|
3292
|
+
const nameColor = data.type === "architecture-group" ? theme.colors.info || "#3b82f6" : data.type === "package" ? theme.colors.primary : data.type === "canvas-folder" ? theme.colors.textSecondary : data.type === "overview" ? theme.colors.info || "#3b82f6" : theme.colors.warning || "#f59e0b";
|
|
3251
3293
|
const nodeHorizontalPadding = data.type === "overview" || data.type === "canvas" ? `calc(${horizontalNodePadding} + 12px)` : horizontalNodePadding;
|
|
3252
3294
|
const rightContent = (() => {
|
|
3253
3295
|
if (data.gitStatus && (data.type === "canvas" || data.type === "overview")) {
|
|
@@ -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;AA8QjB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqM5D,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { DiscoveredCanvas } from '@principal-ai/principal-view-core';
|
|
|
3
3
|
import type { GitFileStatus, GitStatus } from '../../utils/gitStatus';
|
|
4
4
|
import type { TreeNodeData, DragConfig } from '../TreeNode';
|
|
5
5
|
export type { DiscoveredCanvas };
|
|
6
|
-
export type CanvasListNodeType = 'package' | 'canvas-folder' | 'canvas' | 'overview';
|
|
6
|
+
export type CanvasListNodeType = 'package' | 'architecture-group' | 'canvas-folder' | 'canvas' | 'overview';
|
|
7
7
|
export interface CanvasListNodeData extends TreeNodeData {
|
|
8
8
|
type: CanvasListNodeType;
|
|
9
9
|
children?: CanvasListNodeData[];
|
|
@@ -11,6 +11,8 @@ export interface CanvasListNodeData extends TreeNodeData {
|
|
|
11
11
|
packageName?: string;
|
|
12
12
|
scope?: 'package' | 'root';
|
|
13
13
|
markdownPath?: string;
|
|
14
|
+
/** Architecture group type for grouping special canvas types */
|
|
15
|
+
architectureGroupType?: 'resources-scopes' | 'spans';
|
|
14
16
|
gitStatus?: GitStatus;
|
|
15
17
|
}
|
|
16
18
|
export interface CanvasListTreeProps {
|
|
@@ -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,UAAU,EAAE,MAAM,aAAa,CAAC;AAG5D,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,eAAe,GAAG,QAAQ,GAAG,UAAU,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,G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AAI,EAAE,kBAAkB,KAAK,UAAU,GAAG,SAAS,CAAC;CACtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ade/dynamic-file-tree",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"description": "React component for selective directory filtering and file tree visualization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@principal-ade/industry-theme": "^0.1.8",
|
|
82
82
|
"@principal-ade/panel-framework-core": "^0.5.1",
|
|
83
83
|
"@principal-ai/alexandria-core-library": "^0.3.3",
|
|
84
|
-
"@principal-ai/principal-view-core": "0.24.
|
|
84
|
+
"@principal-ai/principal-view-core": "0.24.76",
|
|
85
85
|
"@principal-ai/repository-abstraction": "^0.5.7",
|
|
86
86
|
"@storybook/addon-docs": "^10.2.14",
|
|
87
87
|
"@storybook/addon-onboarding": "^10.2.14",
|