footprint-explainable-ui 0.11.0 → 0.11.2

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
@@ -2433,7 +2433,7 @@ var ENTRY_ICONS = {
2433
2433
  };
2434
2434
  function StoryNarrative({
2435
2435
  entries,
2436
- stageCount,
2436
+ revealedStages,
2437
2437
  size = "default",
2438
2438
  unstyled = false,
2439
2439
  className,
@@ -2442,15 +2442,15 @@ function StoryNarrative({
2442
2442
  const fs = fontSize[size];
2443
2443
  const pad = padding[size];
2444
2444
  const revealedCount = (0, import_react11.useMemo)(() => {
2445
- let stagesSeen = 0;
2446
2445
  for (let i = 0; i < entries.length; i++) {
2447
2446
  const e = entries[i];
2448
- const isBoundary = e.type === "stage" || e.type === "subflow" && e.text.startsWith("Entering");
2449
- if (isBoundary) stagesSeen++;
2450
- if (stagesSeen > stageCount) return i;
2447
+ const key = e.stageId ?? e.stageName;
2448
+ if (key && !revealedStages.has(key)) {
2449
+ return i;
2450
+ }
2451
2451
  }
2452
2452
  return entries.length;
2453
- }, [entries, stageCount]);
2453
+ }, [entries, revealedStages]);
2454
2454
  const revealed = entries.slice(0, revealedCount);
2455
2455
  const future = entries.slice(revealedCount);
2456
2456
  const latestRef = (0, import_react11.useRef)(null);
@@ -2585,9 +2585,17 @@ function NarrativePanel({
2585
2585
  const endIdx = groupsToShow < stageBoundaries.length ? stageBoundaries[groupsToShow] : narrative.length;
2586
2586
  return Math.max(1, endIdx);
2587
2587
  }, [snapshots.length, selectedIndex, narrative]);
2588
+ const revealedStages = (0, import_react12.useMemo)(() => {
2589
+ const labels = /* @__PURE__ */ new Set();
2590
+ for (let i = 0; i <= selectedIndex && i < snapshots.length; i++) {
2591
+ if (snapshots[i].stageLabel) labels.add(snapshots[i].stageLabel);
2592
+ if (snapshots[i].stageName) labels.add(snapshots[i].stageName);
2593
+ }
2594
+ return labels;
2595
+ }, [snapshots, selectedIndex]);
2588
2596
  const hasStructured = narrativeEntries && narrativeEntries.length > 0;
2589
2597
  if (unstyled) {
2590
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className, style, "data-fp": "narrative-panel", children: hasStructured ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StoryNarrative, { entries: narrativeEntries, stageCount: selectedIndex + 1, unstyled: true }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NarrativeTrace, { narrative, revealedCount, unstyled: true }) });
2598
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className, style, "data-fp": "narrative-panel", children: hasStructured ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StoryNarrative, { entries: narrativeEntries, revealedStages, unstyled: true }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NarrativeTrace, { narrative, revealedCount, unstyled: true }) });
2591
2599
  }
2592
2600
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2593
2601
  "div",
@@ -2619,7 +2627,7 @@ function NarrativePanel({
2619
2627
  StoryNarrative,
2620
2628
  {
2621
2629
  entries: narrativeEntries,
2622
- stageCount: selectedIndex + 1,
2630
+ revealedStages,
2623
2631
  size,
2624
2632
  style: { flex: 1 }
2625
2633
  }
@@ -4001,7 +4009,7 @@ function ExplainableShell({
4001
4009
  const validTabIds = new Set(allTabs.map((t) => t.id));
4002
4010
  const resolvedDefault = defaultTab && validTabIds.has(defaultTab) ? defaultTab : allTabs[0]?.id ?? "result";
4003
4011
  const [activeTab, setActiveTab] = (0, import_react19.useState)(resolvedDefault);
4004
- const [snapshotIdx, setSnapshotIdx] = (0, import_react19.useState)(999);
4012
+ const [snapshotIdx, setSnapshotIdx] = (0, import_react19.useState)(0);
4005
4013
  const [drillDownStack, setDrillDownStack] = (0, import_react19.useState)([]);
4006
4014
  const [rightExpanded, setRightExpanded] = (0, import_react19.useState)(defaultExpanded?.details ?? true);
4007
4015
  const [leftExpanded, setLeftExpanded] = (0, import_react19.useState)(defaultExpanded?.topology ?? false);