footprint-explainable-ui 0.27.0 → 0.28.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
@@ -5092,6 +5092,7 @@ function TracedFlow({
5092
5092
  nodeTypes: userNodeTypes,
5093
5093
  edgeTypes: userEdgeTypes,
5094
5094
  coActiveStageIds,
5095
+ sliceCone,
5095
5096
  children,
5096
5097
  className,
5097
5098
  style
@@ -5193,6 +5194,38 @@ function TracedFlow({
5193
5194
  ),
5194
5195
  [positioned.edges, slice, colors]
5195
5196
  );
5197
+ const [coneRevealed, setConeRevealed] = (0, import_react25.useState)(false);
5198
+ (0, import_react25.useEffect)(() => {
5199
+ if (!sliceCone) return;
5200
+ setConeRevealed(false);
5201
+ const raf = requestAnimationFrame(() => setConeRevealed(true));
5202
+ return () => cancelAnimationFrame(raf);
5203
+ }, [sliceCone]);
5204
+ const conedNodes = (0, import_react25.useMemo)(() => {
5205
+ if (!sliceCone || sliceCone.size === 0) return reactFlowNodes;
5206
+ return reactFlowNodes.map((n) => {
5207
+ const depth = sliceCone.get(n.id);
5208
+ if (depth === void 0) {
5209
+ return { ...n, style: { ...n.style, opacity: 0.22, transition: "opacity 260ms ease" } };
5210
+ }
5211
+ return {
5212
+ ...n,
5213
+ style: {
5214
+ ...n.style,
5215
+ opacity: coneRevealed ? 1 : 0.22,
5216
+ transition: "opacity 320ms ease",
5217
+ transitionDelay: `${depth * 90}ms`
5218
+ }
5219
+ };
5220
+ });
5221
+ }, [reactFlowNodes, sliceCone, coneRevealed]);
5222
+ const conedEdges = (0, import_react25.useMemo)(() => {
5223
+ if (!sliceCone || sliceCone.size === 0) return reactFlowEdges;
5224
+ return reactFlowEdges.map((e) => {
5225
+ const inCone = sliceCone.has(e.source) && sliceCone.has(e.target);
5226
+ return inCone ? e : { ...e, style: { ...e.style, opacity: 0.12, transition: "opacity 260ms ease" } };
5227
+ });
5228
+ }, [reactFlowEdges, sliceCone]);
5196
5229
  const handleNodeClick = (0, import_react25.useCallback)(
5197
5230
  (_, node) => {
5198
5231
  const data = node.data ?? {};
@@ -5234,8 +5267,8 @@ function TracedFlow({
5234
5267
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
5235
5268
  import_react26.ReactFlow,
5236
5269
  {
5237
- nodes: reactFlowNodes,
5238
- edges: reactFlowEdges,
5270
+ nodes: conedNodes,
5271
+ edges: conedEdges,
5239
5272
  nodeTypes: mergedNodeTypes,
5240
5273
  edgeTypes: mergedEdgeTypes,
5241
5274
  onNodeClick: handleNodeClick,
@@ -5428,9 +5461,14 @@ var InspectorPanel = (0, import_react28.memo)(function InspectorPanel2({
5428
5461
  dataTraceFrames,
5429
5462
  dataTraceNote,
5430
5463
  selectedStageId,
5431
- onNavigateToStage
5464
+ onNavigateToStage,
5465
+ onTabChange
5432
5466
  }) {
5433
- const [tab, setTab] = (0, import_react28.useState)("state");
5467
+ const [tab, setTabState] = (0, import_react28.useState)("state");
5468
+ const setTab = (t) => {
5469
+ setTabState(t);
5470
+ onTabChange?.(t);
5471
+ };
5434
5472
  const currentSnapshot = snapshots[selectedIndex];
5435
5473
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5436
5474
  "div",
@@ -6087,12 +6125,10 @@ var RightPanel = (0, import_react31.memo)(function RightPanel2({
6087
6125
  recorderViews,
6088
6126
  autoRecorderViews,
6089
6127
  size,
6090
- onNavigateToStage
6128
+ onNavigateToStage,
6129
+ dataTrace,
6130
+ onInspectorTabChange
6091
6131
  }) {
6092
- const dataTrace = (0, import_react31.useMemo)(
6093
- () => runtimeSnapshot?.commitLog ? buildDataTrace(runtimeSnapshot.commitLog, runtimeSnapshot.executionTree, snapshots[selectedIndex]?.runtimeStageId ?? "") : { frames: [], readsAvailable: true },
6094
- [runtimeSnapshot, snapshots, selectedIndex]
6095
- );
6096
6132
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6097
6133
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: {
6098
6134
  display: "flex",
@@ -6146,6 +6182,7 @@ var RightPanel = (0, import_react31.memo)(function RightPanel2({
6146
6182
  selectedIndex,
6147
6183
  dataTraceFrames: dataTrace.frames,
6148
6184
  dataTraceNote: dataTrace.readsAvailable ? void 0 : "\u26A0 reads were not recorded (readTracking off) \u2014 dependencies are unknowable, not absent.",
6185
+ onTabChange: onInspectorTabChange,
6149
6186
  selectedStageId: snapshots[selectedIndex]?.runtimeStageId,
6150
6187
  onNavigateToStage
6151
6188
  }
@@ -6199,7 +6236,7 @@ function ExplainableShell({
6199
6236
  const resultData = resultDataProp ?? derivedFromRuntime?.resultData ?? null;
6200
6237
  const tracedFlowRenderer = (0, import_react31.useMemo)(() => {
6201
6238
  if (!traceGraph) return void 0;
6202
- return ({ selectedIndex, snapshots: snapshots2, onNodeClick }) => {
6239
+ return ({ selectedIndex, snapshots: snapshots2, onNodeClick, sliceCone: sliceCone2 }) => {
6203
6240
  const activeRsid = snapshots2[selectedIndex]?.runtimeStageId;
6204
6241
  let overlayIdx = selectedIndex;
6205
6242
  if (activeRsid && runtimeOverlay) {
@@ -6223,6 +6260,7 @@ function ExplainableShell({
6223
6260
  {
6224
6261
  graph: traceGraph,
6225
6262
  overlay: runtimeOverlay ?? void 0,
6263
+ sliceCone: sliceCone2 ?? void 0,
6226
6264
  colors: traceColors || void 0,
6227
6265
  scrubIndex: overlayIdx,
6228
6266
  onNodeClick: (stageId) => onNodeClick?.(stageId),
@@ -6283,6 +6321,7 @@ function ExplainableShell({
6283
6321
  const [drillDownStack, setDrillDownStack] = (0, import_react31.useState)([]);
6284
6322
  const [rightExpanded, setRightExpanded] = (0, import_react31.useState)(defaultExpanded?.details ?? true);
6285
6323
  const [rightPanelMode, setRightPanelMode] = (0, import_react31.useState)("insights");
6324
+ const [inspectorTab, setInspectorTab] = (0, import_react31.useState)("state");
6286
6325
  const [leftExpanded, setLeftExpanded] = (0, import_react31.useState)(defaultExpanded?.topology ?? false);
6287
6326
  const [timelineExpanded, setTimelineExpanded] = (0, import_react31.useState)(defaultExpanded?.timeline ?? false);
6288
6327
  (0, import_react31.useEffect)(() => {
@@ -6318,6 +6357,21 @@ function ExplainableShell({
6318
6357
  }, [drillDownStack, snapshots]);
6319
6358
  const activeSnapshots = currentLevel.snapshots;
6320
6359
  const safeIdx = activeSnapshots.length > 0 ? Math.max(0, Math.min(snapshotIdx, activeSnapshots.length - 1)) : 0;
6360
+ const shellDataTrace = (0, import_react31.useMemo)(
6361
+ () => runtimeSnapshot?.commitLog ? buildDataTrace(runtimeSnapshot.commitLog, runtimeSnapshot.executionTree, activeSnapshots[safeIdx]?.runtimeStageId ?? "") : { frames: [], readsAvailable: true },
6362
+ [runtimeSnapshot, activeSnapshots, safeIdx]
6363
+ );
6364
+ const sliceCone = (0, import_react31.useMemo)(() => {
6365
+ if (rightPanelMode !== "what" || inspectorTab !== "trace") return void 0;
6366
+ if (shellDataTrace.frames.length < 2) return void 0;
6367
+ const cone = /* @__PURE__ */ new Map();
6368
+ for (const f of shellDataTrace.frames) {
6369
+ const stagePart = f.runtimeStageId.split("#")[0];
6370
+ const prev = cone.get(stagePart);
6371
+ if (prev === void 0 || f.depth < prev) cone.set(stagePart, f.depth);
6372
+ }
6373
+ return cone;
6374
+ }, [rightPanelMode, inspectorTab, shellDataTrace]);
6321
6375
  const activeNarrativeEntries = isInSubflow ? currentLevel.narrative : narrativeEntries;
6322
6376
  const breadcrumbs = (0, import_react31.useMemo)(() => {
6323
6377
  const root = { label: title || "Flowchart", spec: null, description: void 0 };
@@ -6401,7 +6455,7 @@ function ExplainableShell({
6401
6455
  (activeTab === "explainable" || activeTab === "ai-compatible") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6402
6456
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TimeTravelControls, { snapshots: activeSnapshots, selectedIndex: safeIdx, onIndexChange: handleSnapshotChange, unstyled: true }),
6403
6457
  isInSubflow && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SubflowBreadcrumb, { breadcrumbs, onNavigate: handleBreadcrumbNavigate }),
6404
- traceGraph && effectiveRenderFlowchart?.({ spec: null, snapshots: activeSnapshots, selectedIndex: safeIdx, onNodeClick: handleNodeClick, showStageId }),
6458
+ traceGraph && effectiveRenderFlowchart?.({ spec: null, snapshots: activeSnapshots, selectedIndex: safeIdx, onNodeClick: handleNodeClick, showStageId, ...sliceCone && { sliceCone } }),
6405
6459
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MemoryPanel, { snapshots: activeSnapshots, selectedIndex: safeIdx, unstyled: true }),
6406
6460
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(NarrativePanel, { snapshots: activeSnapshots, selectedIndex: safeIdx, narrativeEntries: activeNarrativeEntries, unstyled: true }),
6407
6461
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(GanttTimeline, { snapshots: activeSnapshots, selectedIndex: safeIdx, onSelect: handleSnapshotChange, unstyled: true })
@@ -6520,7 +6574,8 @@ function ExplainableShell({
6520
6574
  snapshots: activeSnapshots,
6521
6575
  selectedIndex: safeIdx,
6522
6576
  onNodeClick: handleNodeClick,
6523
- showStageId
6577
+ showStageId,
6578
+ ...sliceCone && { sliceCone }
6524
6579
  }) }),
6525
6580
  showTreeSidebar && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6526
6581
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HLinePill, { label: leftLabel, expanded: leftExpanded, onClick: () => toggleLeft(!leftExpanded) }),
@@ -6560,7 +6615,8 @@ function ExplainableShell({
6560
6615
  snapshots: activeSnapshots,
6561
6616
  selectedIndex: safeIdx,
6562
6617
  onNodeClick: handleNodeClick,
6563
- showStageId
6618
+ showStageId,
6619
+ ...sliceCone && { sliceCone }
6564
6620
  }) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { flex: 1 } }),
6565
6621
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VLinePill, { label: "Details", expanded: rightExpanded, onClick: () => toggleRight(!rightExpanded) }),
6566
6622
  rightExpanded && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { width: "42%", minWidth: 320, maxWidth: 550, display: "flex", flexDirection: "column", overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -6568,6 +6624,8 @@ function ExplainableShell({
6568
6624
  {
6569
6625
  mode: rightPanelMode,
6570
6626
  onModeChange: setRightPanelMode,
6627
+ dataTrace: shellDataTrace,
6628
+ onInspectorTabChange: setInspectorTab,
6571
6629
  snapshots: activeSnapshots,
6572
6630
  selectedIndex: safeIdx,
6573
6631
  runtimeSnapshot,