executable-stories-react 0.17.0 → 0.18.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.
@@ -95,8 +95,7 @@ interface ReportInteractiveProps {
95
95
  share?: boolean;
96
96
  /**
97
97
  * Draw the "Architecture, as it ran" section (default false). Only an
98
- * instrumented suite has anything to draw, and the span picture is a
99
- * specialist view. `--html-architecture` turns it on.
98
+ * instrumented suite has anything to draw. `--html-architecture` turns it on.
100
99
  */
101
100
  architecture?: boolean;
102
101
  /** Command the share dialog hands over. Default: `npx executable-stories share reports/`. */
@@ -95,8 +95,7 @@ interface ReportInteractiveProps {
95
95
  share?: boolean;
96
96
  /**
97
97
  * Draw the "Architecture, as it ran" section (default false). Only an
98
- * instrumented suite has anything to draw, and the span picture is a
99
- * specialist view. `--html-architecture` turns it on.
98
+ * instrumented suite has anything to draw. `--html-architecture` turns it on.
100
99
  */
101
100
  architecture?: boolean;
102
101
  /** Command the share dialog hands over. Default: `npx executable-stories share reports/`. */
@@ -203,11 +203,11 @@ function formatValue(value) {
203
203
  return String(value);
204
204
  }
205
205
  }
206
- function DocKv({ entry }) {
207
- return /* @__PURE__ */ jsxs("dl", { className: "my-2 flex flex-wrap items-baseline gap-x-2 text-sm", children: [
206
+ function DocKv({ entries }) {
207
+ return /* @__PURE__ */ jsx6("dl", { className: "my-2 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-sm", children: entries.map((entry, i) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
208
208
  /* @__PURE__ */ jsx6("dt", { className: "font-semibold text-muted-foreground", children: entry.label }),
209
209
  /* @__PURE__ */ jsx6("dd", { className: "min-w-0 break-words font-mono text-foreground", children: formatValue(entry.value) })
210
- ] });
210
+ ] }, i)) });
211
211
  }
212
212
 
213
213
  // src/hooks/useRenderers.ts
@@ -294,7 +294,7 @@ function DocSection({ entry }) {
294
294
  if (renderers.section) {
295
295
  return /* @__PURE__ */ jsx10(Fragment2, { children: renderers.section(entry) });
296
296
  }
297
- const html = safeMarkdownHtml(entry.markdown);
297
+ const html = safeMarkdownHtml(dedent(entry.markdown));
298
298
  return /* @__PURE__ */ jsxs4("section", { className: "my-3 text-sm", "aria-label": entry.title, children: [
299
299
  entry.title ? /* @__PURE__ */ jsx10("h4", { className: "mb-1 font-semibold text-foreground", children: entry.title }) : null,
300
300
  /* @__PURE__ */ jsx10(
@@ -480,7 +480,7 @@ function DocEntry({ entry }) {
480
480
  case "tag":
481
481
  return /* @__PURE__ */ jsx17(DocTag, { entry });
482
482
  case "kv":
483
- return /* @__PURE__ */ jsx17(DocKv, { entry });
483
+ return /* @__PURE__ */ jsx17(DocKv, { entries: [entry] });
484
484
  case "code":
485
485
  return /* @__PURE__ */ jsx17(DocCode, { entry });
486
486
  case "table":
@@ -508,7 +508,15 @@ function DocEntry({ entry }) {
508
508
  import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
509
509
  function ReportDocEntries({ entries }) {
510
510
  if (entries.length === 0) return null;
511
- return /* @__PURE__ */ jsx18(Fragment5, { children: entries.map((entry, i) => /* @__PURE__ */ jsx18(DocEntry, { entry }, i)) });
511
+ const groups = [];
512
+ for (const entry of entries) {
513
+ const last = groups[groups.length - 1];
514
+ if (entry.kind === "kv" && Array.isArray(last)) last.push(entry);
515
+ else groups.push(entry.kind === "kv" ? [entry] : entry);
516
+ }
517
+ return /* @__PURE__ */ jsx18(Fragment5, { children: groups.map(
518
+ (g, i) => Array.isArray(g) ? /* @__PURE__ */ jsx18(DocKv, { entries: g }, i) : /* @__PURE__ */ jsx18(DocEntry, { entry: g }, i)
519
+ ) });
512
520
  }
513
521
 
514
522
  // src/components/ReportSteps.tsx
@@ -1403,10 +1411,17 @@ function ReportFeatureIntro({ feature }) {
1403
1411
  dangerouslySetInnerHTML: { __html: safeMarkdownHtml(dedent(feature.narrative)) }
1404
1412
  }
1405
1413
  ) : null,
1406
- hasGlossary ? /* @__PURE__ */ jsx28("dl", { className: "grid gap-1.5", "aria-label": "Glossary", children: feature.glossary.map((entry) => /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-x-2 text-xs", children: [
1407
- /* @__PURE__ */ jsx28("dt", { className: "font-medium text-foreground", children: entry.term }),
1408
- /* @__PURE__ */ jsx28("dd", { className: "flex-1 text-muted-foreground", children: entry.definition })
1409
- ] }, entry.term)) }) : null
1414
+ hasGlossary ? /* @__PURE__ */ jsx28(
1415
+ "dl",
1416
+ {
1417
+ className: "grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5 text-xs",
1418
+ "aria-label": "Glossary",
1419
+ children: feature.glossary.map((entry) => /* @__PURE__ */ jsxs18("div", { className: "contents", children: [
1420
+ /* @__PURE__ */ jsx28("dt", { className: "font-medium text-foreground", children: entry.term }),
1421
+ /* @__PURE__ */ jsx28("dd", { className: "text-muted-foreground", children: entry.definition })
1422
+ ] }, entry.term))
1423
+ }
1424
+ ) : null
1410
1425
  ] });
1411
1426
  }
1412
1427
  function featureKindLabel(kind) {
@@ -1422,7 +1437,6 @@ function ReportFeature({ feature }) {
1422
1437
  const titleId = `${feature.id}-title`;
1423
1438
  const bodyId = `${feature.id}-body`;
1424
1439
  const s = feature.summary;
1425
- const skipped = s.skipped + s.pending;
1426
1440
  const collapse = useCollapse();
1427
1441
  const collapsed = collapse?.isCollapsed(feature.id) ?? false;
1428
1442
  const kindLabel = featureKindLabel(feature.kind);
@@ -1462,7 +1476,12 @@ function ReportFeature({ feature }) {
1462
1476
  "p",
1463
1477
  {
1464
1478
  className: "flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",
1465
- "aria-label": `${s.passed} passed, ${s.failed} failed, ${skipped} skipped`,
1479
+ "aria-label": [
1480
+ `${s.passed} passed`,
1481
+ `${s.failed} failed`,
1482
+ s.skipped > 0 && `${s.skipped} skipped`,
1483
+ s.pending > 0 && `${s.pending} pending`
1484
+ ].filter(Boolean).join(", "),
1466
1485
  children: [
1467
1486
  /* @__PURE__ */ jsxs19("span", { children: [
1468
1487
  s.passed,
@@ -1473,12 +1492,19 @@ function ReportFeature({ feature }) {
1473
1492
  s.failed,
1474
1493
  " failed"
1475
1494
  ] }),
1476
- skipped > 0 ? /* @__PURE__ */ jsxs19(Fragment9, { children: [
1495
+ s.skipped > 0 ? /* @__PURE__ */ jsxs19(Fragment9, { children: [
1477
1496
  /* @__PURE__ */ jsx29("span", { "aria-hidden": true, children: "\xB7" }),
1478
1497
  /* @__PURE__ */ jsxs19("span", { children: [
1479
- skipped,
1498
+ s.skipped,
1480
1499
  " skipped"
1481
1500
  ] })
1501
+ ] }) : null,
1502
+ s.pending > 0 ? /* @__PURE__ */ jsxs19(Fragment9, { children: [
1503
+ /* @__PURE__ */ jsx29("span", { "aria-hidden": true, children: "\xB7" }),
1504
+ /* @__PURE__ */ jsxs19("span", { children: [
1505
+ s.pending,
1506
+ " pending"
1507
+ ] })
1482
1508
  ] }) : null
1483
1509
  ]
1484
1510
  }
@@ -2687,7 +2713,7 @@ function ReportShare({
2687
2713
  "a",
2688
2714
  {
2689
2715
  className: "text-xs underline underline-offset-2",
2690
- href: "https://executablestories.com/guides/sharing-reports/",
2716
+ href: "https://docs.executablestories.com/guides/sharing-reports/",
2691
2717
  target: "_blank",
2692
2718
  rel: "noreferrer",
2693
2719
  children: "How sharing works"
@@ -2884,20 +2910,14 @@ function TocContent({ onNavigate }) {
2884
2910
  const line = atBottom ? window.innerHeight : window.innerHeight * 0.2;
2885
2911
  let active = els[0];
2886
2912
  let best = -Infinity;
2887
- let firstId = null;
2888
- let firstTop = Infinity;
2889
2913
  for (const el of els) {
2890
2914
  const top = el.getBoundingClientRect().top;
2891
2915
  if (top <= line && top > best) {
2892
2916
  best = top;
2893
2917
  active = el;
2894
2918
  }
2895
- if (top < firstTop) {
2896
- firstTop = top;
2897
- firstId = el.id;
2898
- }
2899
2919
  }
2900
- setActiveId(best === -Infinity ? firstId : active.id);
2920
+ setActiveId(active.id);
2901
2921
  };
2902
2922
  const onScroll = () => {
2903
2923
  if (frame === 0) frame = requestAnimationFrame(update);