executable-stories-react 0.16.0 → 0.17.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 +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/interactive.cjs +43 -15
- package/dist/interactive.cjs.map +1 -1
- package/dist/interactive.d.cts +6 -0
- package/dist/interactive.d.ts +6 -0
- package/dist/interactive.js +43 -15
- package/dist/interactive.js.map +1 -1
- package/dist/report-island.global.js +9 -9
- package/dist/ssr.cjs +10 -8
- package/dist/ssr.cjs.map +1 -1
- package/dist/ssr.d.cts +2 -0
- package/dist/ssr.d.ts +2 -0
- package/dist/ssr.js +10 -8
- package/dist/ssr.js.map +1 -1
- package/package.json +2 -2
package/dist/interactive.d.cts
CHANGED
|
@@ -93,6 +93,12 @@ interface ReportInteractiveProps {
|
|
|
93
93
|
scenarioHistory?: ScenarioHistoryMap;
|
|
94
94
|
/** Show the Share button in the header (default false). `--html-share` turns it on. */
|
|
95
95
|
share?: boolean;
|
|
96
|
+
/**
|
|
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.
|
|
100
|
+
*/
|
|
101
|
+
architecture?: boolean;
|
|
96
102
|
/** Command the share dialog hands over. Default: `npx executable-stories share reports/`. */
|
|
97
103
|
shareCommand?: string;
|
|
98
104
|
}
|
package/dist/interactive.d.ts
CHANGED
|
@@ -93,6 +93,12 @@ interface ReportInteractiveProps {
|
|
|
93
93
|
scenarioHistory?: ScenarioHistoryMap;
|
|
94
94
|
/** Show the Share button in the header (default false). `--html-share` turns it on. */
|
|
95
95
|
share?: boolean;
|
|
96
|
+
/**
|
|
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.
|
|
100
|
+
*/
|
|
101
|
+
architecture?: boolean;
|
|
96
102
|
/** Command the share dialog hands over. Default: `npx executable-stories share reports/`. */
|
|
97
103
|
shareCommand?: string;
|
|
98
104
|
}
|
package/dist/interactive.js
CHANGED
|
@@ -1711,7 +1711,7 @@ function ReportSpanGraph() {
|
|
|
1711
1711
|
/* @__PURE__ */ jsx35("h2", { id: "es-span-graph-heading", className: "text-base font-semibold text-foreground", children: "Architecture, as it ran" }),
|
|
1712
1712
|
/* @__PURE__ */ jsx35("p", { className: "mt-1 text-sm text-muted-foreground", children: "Derived from this run\u2019s traces. Every component was named by a span while a scenario ran, so nothing here is inferred from the code. Instrumented, exercised paths only: a component no scenario reaches does not appear." }),
|
|
1713
1713
|
/* @__PURE__ */ jsx35(DocMermaid, { entry: { kind: "mermaid", phase: "static", code } }),
|
|
1714
|
-
/* @__PURE__ */ jsxs24("table", { className: "mt-2 w-full text-left text-sm", children: [
|
|
1714
|
+
/* @__PURE__ */ jsxs24("table", { className: "mt-2 w-full border-collapse text-left text-sm", children: [
|
|
1715
1715
|
/* @__PURE__ */ jsx35("caption", { className: "sr-only", children: "Each component and the scenarios that exercised it" }),
|
|
1716
1716
|
/* @__PURE__ */ jsx35("thead", { children: /* @__PURE__ */ jsxs24("tr", { className: "text-xs text-muted-foreground", children: [
|
|
1717
1717
|
/* @__PURE__ */ jsx35("th", { scope: "col", className: "py-1 pr-4 font-medium", children: "Component" }),
|
|
@@ -1724,7 +1724,7 @@ function ReportSpanGraph() {
|
|
|
1724
1724
|
/* @__PURE__ */ jsx35(MarkBadge, { node })
|
|
1725
1725
|
] }),
|
|
1726
1726
|
/* @__PURE__ */ jsx35("td", { className: "py-1.5 pr-4 text-xs text-muted-foreground", children: LANE_LABEL[node.kind] }),
|
|
1727
|
-
/* @__PURE__ */ jsx35("td", { className: "py-1.5", children: /* @__PURE__ */ jsx35("ul", { className: "flex flex-col gap-0.5", children: node.scenarioIds.map((id) => /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35("a", { href: `#${id}`, className: "text-xs underline underline-offset-2", children: titleById.get(id) ?? id }) }, id)) }) })
|
|
1727
|
+
/* @__PURE__ */ jsx35("td", { className: "py-1.5", children: /* @__PURE__ */ jsx35("ul", { className: "flex flex-col gap-0.5", children: node.scenarioIds.map((id) => /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35("a", { href: `#${id}`, className: "text-xs text-link underline underline-offset-2 hover:text-foreground", children: titleById.get(id) ?? id }) }, id)) }) })
|
|
1728
1728
|
] }, node.id)) })
|
|
1729
1729
|
] })
|
|
1730
1730
|
] });
|
|
@@ -2874,18 +2874,42 @@ function TocContent({ onNavigate }) {
|
|
|
2874
2874
|
[report]
|
|
2875
2875
|
);
|
|
2876
2876
|
useEffect7(() => {
|
|
2877
|
-
if (typeof
|
|
2877
|
+
if (typeof window === "undefined") return;
|
|
2878
2878
|
const els = scenarioIds.map((id) => document.getElementById(id)).filter((el) => el !== null);
|
|
2879
2879
|
if (els.length === 0) return;
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2880
|
+
let frame = 0;
|
|
2881
|
+
const update = () => {
|
|
2882
|
+
frame = 0;
|
|
2883
|
+
const atBottom = window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 2;
|
|
2884
|
+
const line = atBottom ? window.innerHeight : window.innerHeight * 0.2;
|
|
2885
|
+
let active = els[0];
|
|
2886
|
+
let best = -Infinity;
|
|
2887
|
+
let firstId = null;
|
|
2888
|
+
let firstTop = Infinity;
|
|
2889
|
+
for (const el of els) {
|
|
2890
|
+
const top = el.getBoundingClientRect().top;
|
|
2891
|
+
if (top <= line && top > best) {
|
|
2892
|
+
best = top;
|
|
2893
|
+
active = el;
|
|
2894
|
+
}
|
|
2895
|
+
if (top < firstTop) {
|
|
2896
|
+
firstTop = top;
|
|
2897
|
+
firstId = el.id;
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
setActiveId(best === -Infinity ? firstId : active.id);
|
|
2901
|
+
};
|
|
2902
|
+
const onScroll = () => {
|
|
2903
|
+
if (frame === 0) frame = requestAnimationFrame(update);
|
|
2904
|
+
};
|
|
2905
|
+
update();
|
|
2906
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
2907
|
+
window.addEventListener("resize", onScroll);
|
|
2908
|
+
return () => {
|
|
2909
|
+
window.removeEventListener("scroll", onScroll);
|
|
2910
|
+
window.removeEventListener("resize", onScroll);
|
|
2911
|
+
if (frame !== 0) cancelAnimationFrame(frame);
|
|
2912
|
+
};
|
|
2889
2913
|
}, [scenarioIds]);
|
|
2890
2914
|
if (report.features.length === 0) return null;
|
|
2891
2915
|
return /* @__PURE__ */ jsx50("ul", { className: "flex list-none flex-col gap-4 pl-0", children: report.features.map((feature) => /* @__PURE__ */ jsxs35("li", { children: [
|
|
@@ -3431,6 +3455,7 @@ function ReportInteractiveView({
|
|
|
3431
3455
|
staleAfterDays = 7,
|
|
3432
3456
|
scenarioHistory,
|
|
3433
3457
|
share = false,
|
|
3458
|
+
architecture = false,
|
|
3434
3459
|
shareCommand
|
|
3435
3460
|
}) {
|
|
3436
3461
|
const [urlState, setUrlState] = useUrlState();
|
|
@@ -3641,7 +3666,7 @@ function ReportInteractiveView({
|
|
|
3641
3666
|
/* @__PURE__ */ jsx52(ReportSummary, {}),
|
|
3642
3667
|
/* @__PURE__ */ jsx52(ReportMeta, {})
|
|
3643
3668
|
] }),
|
|
3644
|
-
/* @__PURE__ */ jsx52(ReportSpanGraph, {}),
|
|
3669
|
+
architecture ? /* @__PURE__ */ jsx52(ReportSpanGraph, {}) : null,
|
|
3645
3670
|
/* @__PURE__ */ jsx52(
|
|
3646
3671
|
ReportFreshness,
|
|
3647
3672
|
{
|
|
@@ -3797,7 +3822,10 @@ function MermaidView({ entry, load }) {
|
|
|
3797
3822
|
mermaid.initialize({
|
|
3798
3823
|
startOnLoad: false,
|
|
3799
3824
|
securityLevel: "strict",
|
|
3800
|
-
|
|
3825
|
+
// "neutral" in light: the same theme the static, no-JS render uses
|
|
3826
|
+
// in ssr-entry, so a diagram keeps its colours when the island takes
|
|
3827
|
+
// over.
|
|
3828
|
+
theme: prefersDark(ref.current) ? "dark" : "neutral"
|
|
3801
3829
|
});
|
|
3802
3830
|
await mermaid.parse(entry.code);
|
|
3803
3831
|
const id = `es-mermaid-${Math.random().toString(36).slice(2)}`;
|
|
@@ -3856,7 +3884,7 @@ function MermaidView({ entry, load }) {
|
|
|
3856
3884
|
// src/interactive/island-renderers.tsx
|
|
3857
3885
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
3858
3886
|
var HLJS_ESM = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/es/highlight.min.js";
|
|
3859
|
-
var MERMAID_ESM = "https://cdn.jsdelivr.net/npm/mermaid@
|
|
3887
|
+
var MERMAID_ESM = "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
|
3860
3888
|
function cachedCdnModule(url) {
|
|
3861
3889
|
let loader;
|
|
3862
3890
|
return () => {
|