footprint-explainable-ui 0.21.0 → 0.22.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.
package/dist/flowchart.js CHANGED
@@ -280,7 +280,7 @@ var StageNode = memo(function StageNode2({
280
280
  const restingShadow = isHero ? `0 0 10px color-mix(in srgb, ${theme.primary} 22%, transparent)` : `0 2px 8px rgba(0,0,0,0.15)`;
281
281
  const bg = active ? theme.primary : done ? theme.success : error ? theme.error : restingBg;
282
282
  const borderColor = active ? theme.primary : done ? theme.success : error ? theme.error : restingBorder;
283
- const shadow = active ? `0 0 16px color-mix(in srgb, ${theme.primary} 40%, transparent)` : done ? `0 0 8px color-mix(in srgb, ${theme.success} 20%, transparent)` : error ? `0 0 12px color-mix(in srgb, ${theme.error} 30%, transparent)` : restingShadow;
283
+ const shadow = active ? `0 0 22px color-mix(in srgb, ${theme.primary} 55%, transparent)` : done ? `0 0 8px color-mix(in srgb, ${theme.success} 20%, transparent)` : error ? `0 0 12px color-mix(in srgb, ${theme.error} 30%, transparent)` : restingShadow;
284
284
  const textColor = active || done || error ? "#fff" : theme.textPrimary;
285
285
  return /* @__PURE__ */ jsxs(Fragment, { children: [
286
286
  /* @__PURE__ */ jsx2(Handle, { type: "target", position: Position.Top, style: { opacity: 0 } }),
@@ -363,6 +363,26 @@ var StageNode = memo(function StageNode2({
363
363
  }
364
364
  }
365
365
  ),
366
+ active && /* @__PURE__ */ jsx2(
367
+ "div",
368
+ {
369
+ style: {
370
+ position: "absolute",
371
+ top: -9,
372
+ right: -8,
373
+ zIndex: 11,
374
+ background: theme.warning,
375
+ color: "#1a1a1a",
376
+ fontSize: 9,
377
+ fontWeight: 800,
378
+ letterSpacing: 0.6,
379
+ padding: "2px 6px",
380
+ borderRadius: 10,
381
+ boxShadow: `0 0 10px color-mix(in srgb, ${theme.warning} 60%, transparent)`
382
+ },
383
+ children: "NOW"
384
+ }
385
+ ),
366
386
  isDecider ? /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: 120, height: 72 }, children: [
367
387
  /* @__PURE__ */ jsx2(
368
388
  "div",
@@ -1378,6 +1398,19 @@ function createMainChartBoxLayout(opts) {
1378
1398
 
1379
1399
  // src/components/LoopBackEdge/LoopBackEdge.tsx
1380
1400
  import { jsx as jsx6 } from "react/jsx-runtime";
1401
+ var LOOP_DASH = "5 5";
1402
+ var LOOP_STROKE_OPACITY_CAP = 0.55;
1403
+ var LOOP_STROKE_WIDTH = 1.5;
1404
+ function softenLoopStyle(style) {
1405
+ const passedStrokeOpacity = typeof style?.strokeOpacity === "number" ? style.strokeOpacity : 1;
1406
+ return {
1407
+ ...style,
1408
+ strokeDasharray: style?.strokeDasharray ?? LOOP_DASH,
1409
+ strokeOpacity: Math.min(passedStrokeOpacity, LOOP_STROKE_OPACITY_CAP),
1410
+ strokeWidth: LOOP_STROKE_WIDTH
1411
+ };
1412
+ }
1413
+ var LOOP_CORNER_RADIUS = 28;
1381
1414
  function rightEdge(node) {
1382
1415
  return node.internals.positionAbsolute.x + (node.measured.width ?? 0);
1383
1416
  }
@@ -1398,11 +1431,21 @@ function LoopBackEdge({ id, source, target, markerEnd, style }) {
1398
1431
  return loopBackPath(
1399
1432
  { right: rightEdge(src), centerY: centerY(src) },
1400
1433
  { right: rightEdge(tgt), centerY: centerY(tgt) },
1401
- laneX
1434
+ laneX,
1435
+ LOOP_CORNER_RADIUS
1402
1436
  );
1403
1437
  });
1404
1438
  if (!path) return null;
1405
- return /* @__PURE__ */ jsx6(BaseEdge, { id, path, markerEnd, style, "aria-label": "Loop back" });
1439
+ return /* @__PURE__ */ jsx6(
1440
+ BaseEdge,
1441
+ {
1442
+ id,
1443
+ path,
1444
+ markerEnd,
1445
+ style: softenLoopStyle(style),
1446
+ "aria-label": "Loop back"
1447
+ }
1448
+ );
1406
1449
  }
1407
1450
 
1408
1451
  // src/components/SmartStepEdge/SmartStepEdge.tsx
@@ -2006,10 +2049,9 @@ function aggregateMountStatus(slice, graph, currentSubflowId) {
2006
2049
  const members = graph.nodes.filter((n) => n.data?.subflowOf === sfId);
2007
2050
  if (members.length === 0) continue;
2008
2051
  const anyActive = members.some((m) => m.id === slice.activeStageId);
2009
- const anyDone = members.some((m) => slice.doneStageIds.has(m.id));
2010
2052
  const allDone = members.every((m) => slice.doneStageIds.has(m.id));
2011
2053
  if (allDone) doneIds.add(mount.id);
2012
- else if ((anyActive || anyDone) && currentSubflowId === null) {
2054
+ else if (anyActive && currentSubflowId === null) {
2013
2055
  activeId = mount.id;
2014
2056
  }
2015
2057
  }
@@ -2052,6 +2094,7 @@ import { useEffect as useEffect5 } from "react";
2052
2094
  function useChartAutoRefit(wrapperRef, rfInstance, options = {}) {
2053
2095
  const duration = options.duration ?? 200;
2054
2096
  const padding2 = options.padding ?? 0.1;
2097
+ const refitKey = options.refitKey;
2055
2098
  useEffect5(() => {
2056
2099
  const el = wrapperRef.current;
2057
2100
  if (!el || !rfInstance) return;
@@ -2071,6 +2114,19 @@ function useChartAutoRefit(wrapperRef, rfInstance, options = {}) {
2071
2114
  cancelAnimationFrame(raf);
2072
2115
  };
2073
2116
  }, [rfInstance, wrapperRef, duration, padding2]);
2117
+ useEffect5(() => {
2118
+ if (!rfInstance) return;
2119
+ let raf2 = 0;
2120
+ const raf1 = requestAnimationFrame(() => {
2121
+ raf2 = requestAnimationFrame(() => {
2122
+ rfInstance.fitView({ duration, padding: padding2 });
2123
+ });
2124
+ });
2125
+ return () => {
2126
+ cancelAnimationFrame(raf1);
2127
+ cancelAnimationFrame(raf2);
2128
+ };
2129
+ }, [rfInstance, refitKey, duration, padding2]);
2074
2130
  }
2075
2131
 
2076
2132
  // src/components/FlowchartView/SubflowBreadcrumbBar.tsx
@@ -2404,7 +2460,7 @@ function TracedFlow({
2404
2460
  );
2405
2461
  const wrapperRef = useRef5(null);
2406
2462
  const [rfInstance, setRfInstance] = useState4(null);
2407
- useChartAutoRefit(wrapperRef, rfInstance);
2463
+ useChartAutoRefit(wrapperRef, rfInstance, { refitKey: drill.currentSubflowId });
2408
2464
  return /* @__PURE__ */ jsxs8(
2409
2465
  "div",
2410
2466
  {