footprint-explainable-ui 0.11.4 → 0.11.5

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
@@ -2458,28 +2458,20 @@ function StoryNarrative({
2458
2458
  }, [entries, revealedStages]);
2459
2459
  const revealed = (0, import_react11.useMemo)(() => {
2460
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) {
2461
+ return raw.filter((e) => {
2465
2462
  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));
2463
+ if (!sfId && e.type !== "subflow") return true;
2464
+ return false;
2465
+ });
2466
+ }, [entries, revealedCount]);
2467
+ const futureCount = (0, import_react11.useMemo)(() => {
2468
+ let count = 0;
2469
+ for (let i = revealedCount; i < entries.length; i++) {
2470
+ const e = entries[i];
2471
+ if (!e.subflowId && entries[i].type !== "subflow") count++;
2479
2472
  }
2480
- return result;
2473
+ return count;
2481
2474
  }, [entries, revealedCount]);
2482
- const future = entries.slice(revealedCount);
2483
2475
  const latestRef = (0, import_react11.useRef)(null);
2484
2476
  (0, import_react11.useEffect)(() => {
2485
2477
  latestRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
@@ -2508,76 +2500,63 @@ function StoryNarrative({
2508
2500
  const isDecision = entry.type === "condition";
2509
2501
  const isError = entry.type === "error";
2510
2502
  const isLast = i === revealed.length - 1;
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);
2503
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2504
+ "div",
2505
+ {
2506
+ ref: isLast ? latestRef : void 0,
2507
+ style: {
2508
+ display: "flex",
2509
+ gap: 8,
2510
+ padding: isStage ? `${pad - 4}px 0` : `2px 0`,
2511
+ marginLeft: entry.depth * 16,
2512
+ borderBottom: isStage ? `1px solid ${theme.border}` : void 0,
2513
+ marginTop: isStage && i > 0 ? 8 : 0
2514
+ },
2515
+ children: [
2516
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2517
+ "span",
2518
+ {
2519
+ style: {
2520
+ color: meta.color,
2521
+ fontWeight: 700,
2522
+ fontSize: isStage ? fs.body : fs.small,
2523
+ width: 16,
2524
+ textAlign: "center",
2525
+ flexShrink: 0
2526
+ },
2527
+ title: meta.label,
2528
+ "aria-label": meta.label,
2529
+ children: meta.icon
2530
+ }
2531
+ ),
2532
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2533
+ "span",
2534
+ {
2535
+ style: {
2536
+ fontSize: isStage ? fs.body : fs.small,
2537
+ fontWeight: isStage ? 600 : 400,
2538
+ color: isError ? theme.error : isDecision ? theme.warning : isStage ? theme.textPrimary : theme.textSecondary,
2539
+ lineHeight: 1.6,
2540
+ fontFamily: entry.type === "step" ? theme.fontMono : theme.fontSans
2541
+ },
2542
+ children: entry.text
2543
+ }
2544
+ )
2545
+ ]
2546
+ },
2547
+ i
2548
+ );
2570
2549
  }),
2571
- future.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: {
2550
+ futureCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: {
2572
2551
  opacity: 0.3,
2573
2552
  fontSize: fs.small,
2574
2553
  color: theme.textMuted,
2575
2554
  padding: `8px 0`,
2576
2555
  fontStyle: "italic"
2577
2556
  }, children: [
2578
- future.length,
2557
+ futureCount,
2579
2558
  " more ",
2580
- future.length === 1 ? "entry" : "entries",
2559
+ futureCount === 1 ? "entry" : "entries",
2581
2560
  " ahead..."
2582
2561
  ] })
2583
2562
  ]