@principal-ade/dynamic-file-tree 0.2.33 → 0.2.34

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
@@ -285,7 +285,8 @@ function TreeNode({
285
285
  onHover,
286
286
  leftIcon,
287
287
  dragConfig,
288
- onNodeClick
288
+ onNodeClick,
289
+ renderName
289
290
  }) {
290
291
  const [isHovered, setIsHovered] = useState3(false);
291
292
  const [isDragging, setIsDragging] = useState3(false);
@@ -402,7 +403,7 @@ function TreeNode({
402
403
  overflowWrap: "normal",
403
404
  wordBreak: "normal"
404
405
  }
405
- }, node.data.name), extraContent), rightContent && /* @__PURE__ */ React2.createElement("div", {
406
+ }, renderName ?? node.data.name), extraContent), rightContent && /* @__PURE__ */ React2.createElement("div", {
406
407
  style: { flexShrink: 0 }
407
408
  }, rightContent));
408
409
  }
@@ -2189,6 +2190,29 @@ var StatusBar = ({
2189
2190
  };
2190
2191
 
2191
2192
  // src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx
2193
+ var parseHex = (hex) => {
2194
+ const h = hex.replace("#", "");
2195
+ return [
2196
+ parseInt(h.slice(0, 2), 16),
2197
+ parseInt(h.slice(2, 4), 16),
2198
+ parseInt(h.slice(4, 6), 16)
2199
+ ];
2200
+ };
2201
+ var toHex = (r, g, b) => `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
2202
+ var blendColors = (colors) => {
2203
+ const totalWeight = colors.reduce((sum, c) => sum + c.weight, 0);
2204
+ if (totalWeight === 0)
2205
+ return colors[0]?.color || "#6b7280";
2206
+ let r = 0, g = 0, b = 0;
2207
+ for (const { color, weight } of colors) {
2208
+ const [cr, cg, cb] = parseHex(color);
2209
+ const w = weight / totalWeight;
2210
+ r += cr * w;
2211
+ g += cg * w;
2212
+ b += cb * w;
2213
+ }
2214
+ return toHex(Math.round(r), Math.round(g), Math.round(b));
2215
+ };
2192
2216
  var buildTreeDataFromStoryboards = (storyboards, workflowCoverageMap, traceWorkflowsSet, filterMode, versionPrefix, gitStatusMap, scenarioStatusMap, canvasNodeStatusMap, scenarioTraceCounts, showScenarios) => {
2193
2217
  const packagesMap = new Map;
2194
2218
  const rootStoryboards = [];
@@ -2632,13 +2656,14 @@ var StoryboardWorkflowsTreeCoreInner = ({
2632
2656
  if (total === 0) {
2633
2657
  return theme.colors.textSecondary;
2634
2658
  }
2635
- if (draft === 0 && approved === 0 && implemented > 0) {
2636
- return theme.colors.success || "#10b981";
2637
- }
2638
- if (draft === 0 && approved > 0) {
2639
- return theme.colors.warning || "#f59e0b";
2640
- }
2641
- return theme.colors.textSecondary;
2659
+ const greenColor = "#10b981";
2660
+ const amberColor = "#f59e0b";
2661
+ const grayColor = "#6b7280";
2662
+ return blendColors([
2663
+ { color: greenColor, weight: implemented },
2664
+ { color: amberColor, weight: approved },
2665
+ { color: grayColor, weight: draft }
2666
+ ]);
2642
2667
  };
2643
2668
  const nameColor = data.type === "version" ? data.hasTraces ? "#a855f7" : theme.colors.textMuted : data.type === "package" ? theme.colors.primary : data.type === "storyboard" ? getStoryboardColor() : data.type === "overview" ? theme.colors.info || "#3b82f6" : data.type === "canvas" ? theme.colors.warning || "#f59e0b" : data.type === "workflows" ? theme.colors.text : data.type === "workflow" ? data.hasTraces ? theme.colors.textSecondary : theme.colors.textMuted : data.type === "scenario" ? data.hasTraces ? theme.colors.textSecondary : theme.colors.textMuted : theme.colors.textSecondary;
2644
2669
  const nodeHorizontalPadding = data.type === "overview" || data.type === "canvas" || data.type === "workflows" || data.type === "workflow" || data.type === "scenario" ? `calc(${horizontalNodePadding} + 12px)` : horizontalNodePadding;
@@ -1 +1 @@
1
- {"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAU/C,OAAO,KAAK,EAEV,4BAA4B,EAQ7B,MAAM,SAAS,CAAC;AAq9BjB,eAAO,MAAM,2BAA2B,0DAA+C,CAAC"}
1
+ {"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAU/C,OAAO,KAAK,EAEV,4BAA4B,EAQ7B,MAAM,SAAS,CAAC;AAo/BjB,eAAO,MAAM,2BAA2B,0DAA+C,CAAC"}
@@ -40,6 +40,8 @@ export interface TreeNodeProps<T extends TreeNodeData> extends NodeRendererProps
40
40
  dragConfig?: DragConfig;
41
41
  /** Callback fired when the node is clicked, before selection. Receives the mouse event for modifier key detection. */
42
42
  onNodeClick?: (event: React.MouseEvent, node: NodeRendererProps<T>['node']) => void;
43
+ /** Custom render for the name - allows multi-colored text, etc. If provided, nameColor is ignored. */
44
+ renderName?: ReactNode;
43
45
  }
44
- export declare function TreeNode<T extends TreeNodeData>({ node, style, dragHandle, theme, rightContent, extraContent, isSelectedDirectory, nameColor, horizontalNodePadding, verticalNodePadding, onContextMenu, onHover, leftIcon, dragConfig, onNodeClick, }: TreeNodeProps<T>): React.JSX.Element;
46
+ export declare function TreeNode<T extends TreeNodeData>({ node, style, dragHandle, theme, rightContent, extraContent, isSelectedDirectory, nameColor, horizontalNodePadding, verticalNodePadding, onContextMenu, onHover, leftIcon, dragConfig, onNodeClick, renderName, }: TreeNodeProps<T>): React.JSX.Element;
45
47
  //# 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,EAAe,MAAM,OAAO,CAAC;AAChE,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R,UAAU,EACV,WAAW,EACX,UAAU,GACX,EAAE,aAAa,CAAC,CAAC,CAAC,qBAyKlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ade/dynamic-file-tree",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "description": "React component for selective directory filtering and file tree visualization",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",