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/index.cjs CHANGED
@@ -3648,7 +3648,7 @@ var StageNode = (0, import_react15.memo)(function StageNode2({
3648
3648
  const restingShadow = isHero ? `0 0 10px color-mix(in srgb, ${theme.primary} 22%, transparent)` : `0 2px 8px rgba(0,0,0,0.15)`;
3649
3649
  const bg = active ? theme.primary : done ? theme.success : error ? theme.error : restingBg;
3650
3650
  const borderColor = active ? theme.primary : done ? theme.success : error ? theme.error : restingBorder;
3651
- 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;
3651
+ 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;
3652
3652
  const textColor = active || done || error ? "#fff" : theme.textPrimary;
3653
3653
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3654
3654
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Handle, { type: "target", position: import_react16.Position.Top, style: { opacity: 0 } }),
@@ -3731,6 +3731,26 @@ var StageNode = (0, import_react15.memo)(function StageNode2({
3731
3731
  }
3732
3732
  }
3733
3733
  ),
3734
+ active && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3735
+ "div",
3736
+ {
3737
+ style: {
3738
+ position: "absolute",
3739
+ top: -9,
3740
+ right: -8,
3741
+ zIndex: 11,
3742
+ background: theme.warning,
3743
+ color: "#1a1a1a",
3744
+ fontSize: 9,
3745
+ fontWeight: 800,
3746
+ letterSpacing: 0.6,
3747
+ padding: "2px 6px",
3748
+ borderRadius: 10,
3749
+ boxShadow: `0 0 10px color-mix(in srgb, ${theme.warning} 60%, transparent)`
3750
+ },
3751
+ children: "NOW"
3752
+ }
3753
+ ),
3734
3754
  isDecider ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { position: "relative", width: 120, height: 72 }, children: [
3735
3755
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3736
3756
  "div",
@@ -3990,10 +4010,9 @@ function aggregateMountStatus(slice, graph, currentSubflowId) {
3990
4010
  const members = graph.nodes.filter((n) => n.data?.subflowOf === sfId);
3991
4011
  if (members.length === 0) continue;
3992
4012
  const anyActive = members.some((m) => m.id === slice.activeStageId);
3993
- const anyDone = members.some((m) => slice.doneStageIds.has(m.id));
3994
4013
  const allDone = members.every((m) => slice.doneStageIds.has(m.id));
3995
4014
  if (allDone) doneIds.add(mount.id);
3996
- else if ((anyActive || anyDone) && currentSubflowId === null) {
4015
+ else if (anyActive && currentSubflowId === null) {
3997
4016
  activeId = mount.id;
3998
4017
  }
3999
4018
  }
@@ -4036,6 +4055,7 @@ var import_react18 = require("react");
4036
4055
  function useChartAutoRefit(wrapperRef, rfInstance, options = {}) {
4037
4056
  const duration = options.duration ?? 200;
4038
4057
  const padding2 = options.padding ?? 0.1;
4058
+ const refitKey = options.refitKey;
4039
4059
  (0, import_react18.useEffect)(() => {
4040
4060
  const el = wrapperRef.current;
4041
4061
  if (!el || !rfInstance) return;
@@ -4055,6 +4075,19 @@ function useChartAutoRefit(wrapperRef, rfInstance, options = {}) {
4055
4075
  cancelAnimationFrame(raf);
4056
4076
  };
4057
4077
  }, [rfInstance, wrapperRef, duration, padding2]);
4078
+ (0, import_react18.useEffect)(() => {
4079
+ if (!rfInstance) return;
4080
+ let raf2 = 0;
4081
+ const raf1 = requestAnimationFrame(() => {
4082
+ raf2 = requestAnimationFrame(() => {
4083
+ rfInstance.fitView({ duration, padding: padding2 });
4084
+ });
4085
+ });
4086
+ return () => {
4087
+ cancelAnimationFrame(raf1);
4088
+ cancelAnimationFrame(raf2);
4089
+ };
4090
+ }, [rfInstance, refitKey, duration, padding2]);
4058
4091
  }
4059
4092
 
4060
4093
  // src/components/FlowchartView/SubflowBreadcrumbBar.tsx
@@ -4380,6 +4413,19 @@ function wrapInMainChartBox(graph, opts) {
4380
4413
 
4381
4414
  // src/components/LoopBackEdge/LoopBackEdge.tsx
4382
4415
  var import_jsx_runtime19 = require("react/jsx-runtime");
4416
+ var LOOP_DASH = "5 5";
4417
+ var LOOP_STROKE_OPACITY_CAP = 0.55;
4418
+ var LOOP_STROKE_WIDTH = 1.5;
4419
+ function softenLoopStyle(style) {
4420
+ const passedStrokeOpacity = typeof style?.strokeOpacity === "number" ? style.strokeOpacity : 1;
4421
+ return {
4422
+ ...style,
4423
+ strokeDasharray: style?.strokeDasharray ?? LOOP_DASH,
4424
+ strokeOpacity: Math.min(passedStrokeOpacity, LOOP_STROKE_OPACITY_CAP),
4425
+ strokeWidth: LOOP_STROKE_WIDTH
4426
+ };
4427
+ }
4428
+ var LOOP_CORNER_RADIUS = 28;
4383
4429
  function rightEdge(node) {
4384
4430
  return node.internals.positionAbsolute.x + (node.measured.width ?? 0);
4385
4431
  }
@@ -4400,11 +4446,21 @@ function LoopBackEdge({ id, source, target, markerEnd, style }) {
4400
4446
  return loopBackPath(
4401
4447
  { right: rightEdge(src), centerY: centerY(src) },
4402
4448
  { right: rightEdge(tgt), centerY: centerY(tgt) },
4403
- laneX
4449
+ laneX,
4450
+ LOOP_CORNER_RADIUS
4404
4451
  );
4405
4452
  });
4406
4453
  if (!path) return null;
4407
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react20.BaseEdge, { id, path, markerEnd, style, "aria-label": "Loop back" });
4454
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4455
+ import_react20.BaseEdge,
4456
+ {
4457
+ id,
4458
+ path,
4459
+ markerEnd,
4460
+ style: softenLoopStyle(style),
4461
+ "aria-label": "Loop back"
4462
+ }
4463
+ );
4408
4464
  }
4409
4465
 
4410
4466
  // src/components/SmartStepEdge/SmartStepEdge.tsx
@@ -4697,7 +4753,7 @@ function TracedFlow({
4697
4753
  );
4698
4754
  const wrapperRef = (0, import_react23.useRef)(null);
4699
4755
  const [rfInstance, setRfInstance] = (0, import_react23.useState)(null);
4700
- useChartAutoRefit(wrapperRef, rfInstance);
4756
+ useChartAutoRefit(wrapperRef, rfInstance, { refitKey: drill.currentSubflowId });
4701
4757
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4702
4758
  "div",
4703
4759
  {