footprint-explainable-ui 0.11.2 → 0.11.4
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 +94 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +94 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2442,16 +2442,43 @@ function StoryNarrative({
|
|
|
2442
2442
|
const fs = fontSize[size];
|
|
2443
2443
|
const pad = padding[size];
|
|
2444
2444
|
const revealedCount = (0, import_react11.useMemo)(() => {
|
|
2445
|
+
const isRevealed = (e) => e.stageId && revealedStages.has(e.stageId) || e.subflowId && revealedStages.has(e.subflowId) || e.stageName && revealedStages.has(e.stageName);
|
|
2446
|
+
let lastIdentifiedWasRevealed = true;
|
|
2445
2447
|
for (let i = 0; i < entries.length; i++) {
|
|
2446
2448
|
const e = entries[i];
|
|
2447
|
-
const
|
|
2448
|
-
if (
|
|
2449
|
-
|
|
2449
|
+
const hasKey = e.stageId || e.subflowId || e.stageName;
|
|
2450
|
+
if (hasKey) {
|
|
2451
|
+
lastIdentifiedWasRevealed = !!isRevealed(e);
|
|
2452
|
+
if (!lastIdentifiedWasRevealed) return i;
|
|
2453
|
+
} else {
|
|
2454
|
+
if (!lastIdentifiedWasRevealed) return i;
|
|
2450
2455
|
}
|
|
2451
2456
|
}
|
|
2452
2457
|
return entries.length;
|
|
2453
2458
|
}, [entries, revealedStages]);
|
|
2454
|
-
const revealed =
|
|
2459
|
+
const revealed = (0, import_react11.useMemo)(() => {
|
|
2460
|
+
const raw = entries.slice(0, revealedCount);
|
|
2461
|
+
const root = [];
|
|
2462
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2463
|
+
const groupOrder = [];
|
|
2464
|
+
for (const e of raw) {
|
|
2465
|
+
const sfId = e.subflowId;
|
|
2466
|
+
if (sfId) {
|
|
2467
|
+
if (!groups.has(sfId)) {
|
|
2468
|
+
groups.set(sfId, []);
|
|
2469
|
+
groupOrder.push(sfId);
|
|
2470
|
+
}
|
|
2471
|
+
groups.get(sfId).push(e);
|
|
2472
|
+
} else {
|
|
2473
|
+
root.push(e);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
const result = [...root];
|
|
2477
|
+
for (const sfId of groupOrder) {
|
|
2478
|
+
result.push(...groups.get(sfId));
|
|
2479
|
+
}
|
|
2480
|
+
return result;
|
|
2481
|
+
}, [entries, revealedCount]);
|
|
2455
2482
|
const future = entries.slice(revealedCount);
|
|
2456
2483
|
const latestRef = (0, import_react11.useRef)(null);
|
|
2457
2484
|
(0, import_react11.useEffect)(() => {
|
|
@@ -2481,52 +2508,65 @@ function StoryNarrative({
|
|
|
2481
2508
|
const isDecision = entry.type === "condition";
|
|
2482
2509
|
const isError = entry.type === "error";
|
|
2483
2510
|
const isLast = i === revealed.length - 1;
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2511
|
+
const sfId = entry.subflowId;
|
|
2512
|
+
const prevSfId = i > 0 ? revealed[i - 1].subflowId : void 0;
|
|
2513
|
+
const subflowChanged = sfId && sfId !== prevSfId;
|
|
2514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref: isLast ? latestRef : void 0, children: [
|
|
2515
|
+
subflowChanged && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: {
|
|
2516
|
+
fontSize: fs.small,
|
|
2517
|
+
fontWeight: 600,
|
|
2518
|
+
color: theme.textSecondary,
|
|
2519
|
+
padding: `6px 0 2px`,
|
|
2520
|
+
marginTop: 8,
|
|
2521
|
+
borderTop: `1px solid ${theme.border}`,
|
|
2522
|
+
textTransform: "uppercase",
|
|
2523
|
+
letterSpacing: "0.05em"
|
|
2524
|
+
}, children: sfId }),
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2526
|
+
"div",
|
|
2527
|
+
{
|
|
2528
|
+
style: {
|
|
2529
|
+
display: "flex",
|
|
2530
|
+
gap: 8,
|
|
2531
|
+
padding: isStage ? `${pad - 4}px 0` : `2px 0`,
|
|
2532
|
+
marginLeft: sfId ? 12 : entry.depth * 16,
|
|
2533
|
+
borderBottom: isStage && !sfId ? `1px solid ${theme.border}` : void 0,
|
|
2534
|
+
marginTop: isStage && i > 0 && !subflowChanged ? 8 : 0
|
|
2535
|
+
},
|
|
2536
|
+
children: [
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2538
|
+
"span",
|
|
2539
|
+
{
|
|
2540
|
+
style: {
|
|
2541
|
+
color: meta.color,
|
|
2542
|
+
fontWeight: 700,
|
|
2543
|
+
fontSize: isStage ? fs.body : fs.small,
|
|
2544
|
+
width: 16,
|
|
2545
|
+
textAlign: "center",
|
|
2546
|
+
flexShrink: 0
|
|
2547
|
+
},
|
|
2548
|
+
title: meta.label,
|
|
2549
|
+
"aria-label": meta.label,
|
|
2550
|
+
children: meta.icon
|
|
2551
|
+
}
|
|
2552
|
+
),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2554
|
+
"span",
|
|
2555
|
+
{
|
|
2556
|
+
style: {
|
|
2557
|
+
fontSize: isStage ? fs.body : fs.small,
|
|
2558
|
+
fontWeight: isStage ? 600 : 400,
|
|
2559
|
+
color: isError ? theme.error : isDecision ? theme.warning : isStage ? theme.textPrimary : theme.textSecondary,
|
|
2560
|
+
lineHeight: 1.6,
|
|
2561
|
+
fontFamily: entry.type === "step" ? theme.fontMono : theme.fontSans
|
|
2562
|
+
},
|
|
2563
|
+
children: entry.text
|
|
2564
|
+
}
|
|
2565
|
+
)
|
|
2566
|
+
]
|
|
2567
|
+
}
|
|
2568
|
+
)
|
|
2569
|
+
] }, i);
|
|
2530
2570
|
}),
|
|
2531
2571
|
future.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: {
|
|
2532
2572
|
opacity: 0.3,
|
|
@@ -2588,8 +2628,10 @@ function NarrativePanel({
|
|
|
2588
2628
|
const revealedStages = (0, import_react12.useMemo)(() => {
|
|
2589
2629
|
const labels = /* @__PURE__ */ new Set();
|
|
2590
2630
|
for (let i = 0; i <= selectedIndex && i < snapshots.length; i++) {
|
|
2591
|
-
|
|
2592
|
-
if (
|
|
2631
|
+
const s = snapshots[i];
|
|
2632
|
+
if (s.stageLabel) labels.add(s.stageLabel);
|
|
2633
|
+
if (s.stageName) labels.add(s.stageName);
|
|
2634
|
+
if (s.subflowId) labels.add(s.subflowId);
|
|
2593
2635
|
}
|
|
2594
2636
|
return labels;
|
|
2595
2637
|
}, [snapshots, selectedIndex]);
|