footprint-explainable-ui 0.25.4 → 0.26.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/README.md +22 -14
- package/dist/flowchart.cjs +4 -4
- package/dist/flowchart.cjs.map +1 -1
- package/dist/flowchart.js +4 -4
- package/dist/flowchart.js.map +1 -1
- package/dist/index.cjs +43 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +43 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3957,10 +3957,10 @@ var StageNode = (0, import_react15.memo)(function StageNode2({
|
|
|
3957
3957
|
const restingBg = isHero ? `color-mix(in srgb, ${theme.nodeMain} 12%, ${theme.bgSecondary})` : theme.bgSecondary;
|
|
3958
3958
|
const restingBorder = isHero ? theme.nodeMain : theme.border;
|
|
3959
3959
|
const restingShadow = isHero ? `0 0 10px color-mix(in srgb, ${theme.nodeMain} 22%, transparent)` : `0 2px 8px rgba(0,0,0,0.15)`;
|
|
3960
|
-
const bg = active ? theme.nodeCursor : done ? theme.nodeVisited : error ? theme.error : restingBg;
|
|
3961
|
-
const borderColor = active ? theme.nodeCursor : done ? theme.nodeVisited : error ? theme.error : restingBorder;
|
|
3962
|
-
const shadow = active ? `0 0 22px color-mix(in srgb, ${theme.nodeCursor} 55%, transparent)` : done ? `0 0 8px color-mix(in srgb, ${theme.nodeVisited} 20%, transparent)` : error ? `0 0 12px color-mix(in srgb, ${theme.error} 30%, transparent)` : restingShadow;
|
|
3963
|
-
const textColor = active
|
|
3960
|
+
const bg = active ? theme.nodeCursor : isHero && done ? theme.nodeMain : done ? theme.nodeVisited : error ? theme.error : restingBg;
|
|
3961
|
+
const borderColor = active ? theme.nodeCursor : isHero && done ? theme.nodeMain : done ? theme.nodeVisited : error ? theme.error : restingBorder;
|
|
3962
|
+
const shadow = active ? `0 0 22px color-mix(in srgb, ${theme.nodeCursor} 55%, transparent)` : isHero && done ? `0 0 12px color-mix(in srgb, ${theme.nodeMain} 30%, transparent)` : done ? `0 0 8px color-mix(in srgb, ${theme.nodeVisited} 20%, transparent)` : error ? `0 0 12px color-mix(in srgb, ${theme.error} 30%, transparent)` : restingShadow;
|
|
3963
|
+
const textColor = active ? "#1a1a1a" : done || error ? "#fff" : theme.textPrimary;
|
|
3964
3964
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3965
3965
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Handle, { type: "target", position: import_react16.Position.Top, style: { opacity: 0 } }),
|
|
3966
3966
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: "100%", display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -5994,42 +5994,19 @@ var DetailsContent = (0, import_react31.memo)(function DetailsContent2({
|
|
|
5994
5994
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { flex: 1, overflow: "auto" }, children: activeView?.render({ snapshots, selectedIndex }) })
|
|
5995
5995
|
] });
|
|
5996
5996
|
});
|
|
5997
|
-
function
|
|
5998
|
-
const
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
5997
|
+
function resolveSubflowFromRuntime(parentSnapshots, subflowId, narrativeEntries) {
|
|
5998
|
+
const localId = subflowId.split("/").pop() ?? subflowId;
|
|
5999
|
+
const parentSnap = parentSnapshots.find((s) => {
|
|
6000
|
+
if (!s.subflowResult) return false;
|
|
6001
|
+
const sfStageId = s.runtimeStageId?.split("#")[0]?.split("/").pop();
|
|
6002
|
+
return s.subflowId === subflowId || s.subflowId === localId || s.stageName === subflowId || s.stageLabel === subflowId || sfStageId === subflowId || sfStageId === localId;
|
|
6003
|
+
});
|
|
6003
6004
|
if (!parentSnap?.subflowResult) return null;
|
|
6004
|
-
const
|
|
6005
|
-
const
|
|
6006
|
-
const sfNarrative = narrativeEntries ? extractSubflowNarrative(narrativeEntries, sfId, sfDisplayName) : void 0;
|
|
6005
|
+
const label = parentSnap.stageLabel ?? parentSnap.stageName ?? localId;
|
|
6006
|
+
const sfNarrative = narrativeEntries ? extractSubflowNarrative(narrativeEntries, subflowId, label) : void 0;
|
|
6007
6007
|
const sfSnapshots = subflowResultToSnapshots(parentSnap.subflowResult, sfNarrative);
|
|
6008
6008
|
if (sfSnapshots.length === 0) return null;
|
|
6009
|
-
return {
|
|
6010
|
-
subflowId: specNode.subflowId ?? subflowNodeName,
|
|
6011
|
-
label: specNode.subflowName ?? specNode.name,
|
|
6012
|
-
spec: specNode.subflowStructure,
|
|
6013
|
-
snapshots: sfSnapshots
|
|
6014
|
-
};
|
|
6015
|
-
}
|
|
6016
|
-
function findSubflowSpecNode(node, name) {
|
|
6017
|
-
if ((node.name === name || node.id === name) && node.isSubflowRoot) return node;
|
|
6018
|
-
if (node.children) {
|
|
6019
|
-
for (const child of node.children) {
|
|
6020
|
-
const f = findSubflowSpecNode(child, name);
|
|
6021
|
-
if (f) return f;
|
|
6022
|
-
}
|
|
6023
|
-
}
|
|
6024
|
-
if (node.next) return findSubflowSpecNode(node.next, name);
|
|
6025
|
-
return null;
|
|
6026
|
-
}
|
|
6027
|
-
function hasSubflowNodes(node) {
|
|
6028
|
-
if (!node) return false;
|
|
6029
|
-
if (node.isSubflowRoot) return true;
|
|
6030
|
-
if (node.children?.some((c) => c && hasSubflowNodes(c))) return true;
|
|
6031
|
-
if (node.next && hasSubflowNodes(node.next)) return true;
|
|
6032
|
-
return false;
|
|
6009
|
+
return { subflowId, label, spec: null, snapshots: sfSnapshots, narrative: sfNarrative };
|
|
6033
6010
|
}
|
|
6034
6011
|
function buildDataTrace(commitLog, targetRuntimeStageId, maxDepth = 10) {
|
|
6035
6012
|
const log = commitLog;
|
|
@@ -6071,7 +6048,6 @@ var RightPanel = (0, import_react31.memo)(function RightPanel2({
|
|
|
6071
6048
|
snapshots,
|
|
6072
6049
|
selectedIndex,
|
|
6073
6050
|
runtimeSnapshot,
|
|
6074
|
-
spec,
|
|
6075
6051
|
activeTab,
|
|
6076
6052
|
allTabs,
|
|
6077
6053
|
activeNarrativeEntries,
|
|
@@ -6117,7 +6093,7 @@ var RightPanel = (0, import_react31.memo)(function RightPanel2({
|
|
|
6117
6093
|
id: tab.id,
|
|
6118
6094
|
name: insightName(tab.name),
|
|
6119
6095
|
render: () => {
|
|
6120
|
-
if (tab.id === "narrative") return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(NarrativePanel, { snapshots, selectedIndex, narrativeEntries: activeNarrativeEntries, runtimeSnapshot,
|
|
6096
|
+
if (tab.id === "narrative") return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(NarrativePanel, { snapshots, selectedIndex, narrativeEntries: activeNarrativeEntries, runtimeSnapshot, size, style: { height: "100%" } });
|
|
6121
6097
|
const customView = recorderViews?.find((v2) => v2.id === tab.id);
|
|
6122
6098
|
if (customView?.render) return customView.render({ snapshots, selectedIndex });
|
|
6123
6099
|
const autoView = autoRecorderViews.find((v2) => v2.id === tab.id);
|
|
@@ -6151,7 +6127,6 @@ function insightName(name) {
|
|
|
6151
6127
|
function ExplainableShell({
|
|
6152
6128
|
snapshots: snapshotsProp,
|
|
6153
6129
|
runtimeSnapshot,
|
|
6154
|
-
spec,
|
|
6155
6130
|
title,
|
|
6156
6131
|
resultData: resultDataProp,
|
|
6157
6132
|
logs = [],
|
|
@@ -6189,9 +6164,14 @@ function ExplainableShell({
|
|
|
6189
6164
|
const activeRsid = snapshots2[selectedIndex]?.runtimeStageId;
|
|
6190
6165
|
let overlayIdx = selectedIndex;
|
|
6191
6166
|
if (activeRsid && runtimeOverlay) {
|
|
6192
|
-
|
|
6167
|
+
let i = runtimeOverlay.executionOrder.findIndex(
|
|
6193
6168
|
(s) => s.runtimeStageId === activeRsid
|
|
6194
6169
|
);
|
|
6170
|
+
if (i < 0) {
|
|
6171
|
+
i = runtimeOverlay.executionOrder.findIndex(
|
|
6172
|
+
(s) => s.runtimeStageId?.endsWith("/" + activeRsid)
|
|
6173
|
+
);
|
|
6174
|
+
}
|
|
6195
6175
|
if (i >= 0) overlayIdx = i;
|
|
6196
6176
|
}
|
|
6197
6177
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -6287,24 +6267,23 @@ function ExplainableShell({
|
|
|
6287
6267
|
const currentLevel = (0, import_react31.useMemo)(() => {
|
|
6288
6268
|
if (drillDownStack.length > 0) {
|
|
6289
6269
|
const top = drillDownStack[drillDownStack.length - 1];
|
|
6290
|
-
return { spec: top.spec, snapshots: top.snapshots };
|
|
6270
|
+
return { spec: top.spec, snapshots: top.snapshots, narrative: top.narrative };
|
|
6291
6271
|
}
|
|
6292
|
-
return { spec:
|
|
6293
|
-
}, [drillDownStack,
|
|
6272
|
+
return { spec: null, snapshots, narrative: void 0 };
|
|
6273
|
+
}, [drillDownStack, snapshots]);
|
|
6294
6274
|
const activeSnapshots = currentLevel.snapshots;
|
|
6295
|
-
const activeSpec = currentLevel.spec;
|
|
6296
6275
|
const safeIdx = activeSnapshots.length > 0 ? Math.max(0, Math.min(snapshotIdx, activeSnapshots.length - 1)) : 0;
|
|
6297
|
-
const activeNarrativeEntries = isInSubflow ?
|
|
6276
|
+
const activeNarrativeEntries = isInSubflow ? currentLevel.narrative : narrativeEntries;
|
|
6298
6277
|
const breadcrumbs = (0, import_react31.useMemo)(() => {
|
|
6299
|
-
const root = { label: title || "Flowchart", spec, description:
|
|
6278
|
+
const root = { label: title || "Flowchart", spec: null, description: void 0 };
|
|
6300
6279
|
return [root, ...drillDownStack.map((e) => ({ label: e.label, spec: e.spec, description: void 0 }))];
|
|
6301
|
-
}, [
|
|
6280
|
+
}, [title, drillDownStack]);
|
|
6302
6281
|
const showTreeSidebar = (0, import_react31.useMemo)(() => {
|
|
6303
6282
|
if (traceGraph?.nodes?.length) {
|
|
6304
6283
|
return traceGraph.nodes.some((n) => n.data?.isSubflow === true);
|
|
6305
6284
|
}
|
|
6306
|
-
return
|
|
6307
|
-
}, [traceGraph
|
|
6285
|
+
return false;
|
|
6286
|
+
}, [traceGraph]);
|
|
6308
6287
|
const rootOverlay = (0, import_react31.useMemo)(() => {
|
|
6309
6288
|
if (isInSubflow || !snapshots.length) return { activeStage: void 0, doneStages: void 0 };
|
|
6310
6289
|
const doneStages = new Set(snapshots.slice(0, safeIdx).map((s) => s.stageLabel));
|
|
@@ -6320,14 +6299,13 @@ function ExplainableShell({
|
|
|
6320
6299
|
}, []);
|
|
6321
6300
|
const handleDrillDown = (0, import_react31.useCallback)(
|
|
6322
6301
|
(nodeName) => {
|
|
6323
|
-
|
|
6324
|
-
const entry = resolveSubflowLevel(activeSpec, activeSnapshots, nodeName, narrativeEntries);
|
|
6302
|
+
const entry = resolveSubflowFromRuntime(activeSnapshots, nodeName, narrativeEntries);
|
|
6325
6303
|
if (entry) {
|
|
6326
6304
|
setDrillDownStack((prev) => [...prev, { ...entry, parentSnapshotIdx: snapshotIdx }]);
|
|
6327
6305
|
setSnapshotIdx(0);
|
|
6328
6306
|
}
|
|
6329
6307
|
},
|
|
6330
|
-
[
|
|
6308
|
+
[activeSnapshots, narrativeEntries, snapshotIdx]
|
|
6331
6309
|
);
|
|
6332
6310
|
const handleBreadcrumbNavigate = (0, import_react31.useCallback)((level) => {
|
|
6333
6311
|
setDrillDownStack((prev) => {
|
|
@@ -6342,23 +6320,21 @@ function ExplainableShell({
|
|
|
6342
6320
|
setSnapshotIdx(indexOrId);
|
|
6343
6321
|
return;
|
|
6344
6322
|
}
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
return;
|
|
6350
|
-
}
|
|
6323
|
+
const drillable = resolveSubflowFromRuntime(activeSnapshots, indexOrId, narrativeEntries);
|
|
6324
|
+
if (drillable) {
|
|
6325
|
+
handleDrillDown(indexOrId);
|
|
6326
|
+
return;
|
|
6351
6327
|
}
|
|
6352
6328
|
const idx = activeSnapshots.findIndex((s) => s.stageLabel === indexOrId);
|
|
6353
6329
|
if (idx >= 0) setSnapshotIdx(idx);
|
|
6354
6330
|
},
|
|
6355
|
-
[
|
|
6331
|
+
[activeSnapshots, narrativeEntries, handleDrillDown]
|
|
6356
6332
|
);
|
|
6357
6333
|
const handleTreeNodeSelect = (0, import_react31.useCallback)(
|
|
6358
6334
|
(name, isSubflow) => {
|
|
6359
|
-
if (isSubflow
|
|
6335
|
+
if (isSubflow) {
|
|
6360
6336
|
setDrillDownStack([]);
|
|
6361
|
-
const entry =
|
|
6337
|
+
const entry = resolveSubflowFromRuntime(snapshots, name, narrativeEntries);
|
|
6362
6338
|
if (entry) {
|
|
6363
6339
|
setDrillDownStack([{ ...entry, parentSnapshotIdx: snapshotIdx }]);
|
|
6364
6340
|
setSnapshotIdx(0);
|
|
@@ -6369,7 +6345,7 @@ function ExplainableShell({
|
|
|
6369
6345
|
if (idx >= 0) setSnapshotIdx(idx);
|
|
6370
6346
|
}
|
|
6371
6347
|
},
|
|
6372
|
-
[
|
|
6348
|
+
[snapshots, narrativeEntries, snapshotIdx]
|
|
6373
6349
|
);
|
|
6374
6350
|
const tabLabels = new Map(allTabs.map((t) => [t.id, t.name]));
|
|
6375
6351
|
if (unstyled) {
|
|
@@ -6380,7 +6356,7 @@ function ExplainableShell({
|
|
|
6380
6356
|
(activeTab === "explainable" || activeTab === "ai-compatible") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
6381
6357
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TimeTravelControls, { snapshots: activeSnapshots, selectedIndex: safeIdx, onIndexChange: handleSnapshotChange, unstyled: true }),
|
|
6382
6358
|
isInSubflow && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SubflowBreadcrumb, { breadcrumbs, onNavigate: handleBreadcrumbNavigate }),
|
|
6383
|
-
|
|
6359
|
+
traceGraph && effectiveRenderFlowchart?.({ spec: null, snapshots: activeSnapshots, selectedIndex: safeIdx, onNodeClick: handleNodeClick, showStageId }),
|
|
6384
6360
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MemoryPanel, { snapshots: activeSnapshots, selectedIndex: safeIdx, unstyled: true }),
|
|
6385
6361
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(NarrativePanel, { snapshots: activeSnapshots, selectedIndex: safeIdx, narrativeEntries: activeNarrativeEntries, unstyled: true }),
|
|
6386
6362
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(GanttTimeline, { snapshots: activeSnapshots, selectedIndex: safeIdx, onSelect: handleSnapshotChange, unstyled: true })
|
|
@@ -6388,7 +6364,7 @@ function ExplainableShell({
|
|
|
6388
6364
|
] })
|
|
6389
6365
|
] });
|
|
6390
6366
|
}
|
|
6391
|
-
const showTopology = !!effectiveRenderFlowchart && !!
|
|
6367
|
+
const showTopology = !!effectiveRenderFlowchart && !!traceGraph;
|
|
6392
6368
|
const detailsContent = (0, import_react31.useMemo)(() => {
|
|
6393
6369
|
if (activeTab === "result") {
|
|
6394
6370
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ResultPanel, { data: resultData ?? null, logs, hideConsole, size });
|
|
@@ -6485,7 +6461,7 @@ function ExplainableShell({
|
|
|
6485
6461
|
/* ── Mobile: stacked vertical ── */
|
|
6486
6462
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
6487
6463
|
showTopology && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { height: 350, flexShrink: 0, overflow: "hidden" }, children: effectiveRenderFlowchart({
|
|
6488
|
-
spec:
|
|
6464
|
+
spec: null,
|
|
6489
6465
|
snapshots: activeSnapshots,
|
|
6490
6466
|
selectedIndex: safeIdx,
|
|
6491
6467
|
onNodeClick: handleNodeClick,
|
|
@@ -6525,7 +6501,7 @@ function ExplainableShell({
|
|
|
6525
6501
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VLinePill, { label: "Topology", expanded: true, side: "left", onClick: () => toggleLeft(false) })
|
|
6526
6502
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VLinePill, { label: "Topology", expanded: false, side: "left", onClick: () => toggleLeft(true) })),
|
|
6527
6503
|
showTopology ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { flex: 1, overflow: "hidden", minWidth: 0 }, children: effectiveRenderFlowchart({
|
|
6528
|
-
spec:
|
|
6504
|
+
spec: null,
|
|
6529
6505
|
snapshots: activeSnapshots,
|
|
6530
6506
|
selectedIndex: safeIdx,
|
|
6531
6507
|
onNodeClick: handleNodeClick,
|
|
@@ -6540,7 +6516,6 @@ function ExplainableShell({
|
|
|
6540
6516
|
snapshots: activeSnapshots,
|
|
6541
6517
|
selectedIndex: safeIdx,
|
|
6542
6518
|
runtimeSnapshot,
|
|
6543
|
-
spec,
|
|
6544
6519
|
activeTab,
|
|
6545
6520
|
allTabs,
|
|
6546
6521
|
activeNarrativeEntries,
|
|
@@ -6657,7 +6632,6 @@ function TraceViewer({
|
|
|
6657
6632
|
ExplainableShell,
|
|
6658
6633
|
{
|
|
6659
6634
|
snapshots,
|
|
6660
|
-
spec: parsed.trace.spec,
|
|
6661
6635
|
narrativeEntries: parsed.trace.narrativeEntries,
|
|
6662
6636
|
tabs,
|
|
6663
6637
|
defaultTab,
|