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/ssr.d.cts CHANGED
@@ -91,6 +91,8 @@ interface RenderReportToHtmlOptions {
91
91
  share?: boolean;
92
92
  /** Command the share dialog hands over, e.g. `npx executable-stories share reports/`. */
93
93
  shareCommand?: string;
94
+ /** Draw the "Architecture, as it ran" span section (default false). `--html-architecture`. */
95
+ architecture?: boolean;
94
96
  }
95
97
  /**
96
98
  * Render a StoryReport (or a parse Result) to a complete, self-contained HTML
package/dist/ssr.d.ts CHANGED
@@ -91,6 +91,8 @@ interface RenderReportToHtmlOptions {
91
91
  share?: boolean;
92
92
  /** Command the share dialog hands over, e.g. `npx executable-stories share reports/`. */
93
93
  shareCommand?: string;
94
+ /** Draw the "Architecture, as it ran" span section (default false). `--html-architecture`. */
95
+ architecture?: boolean;
94
96
  }
95
97
  /**
96
98
  * Render a StoryReport (or a parse Result) to a complete, self-contained HTML
package/dist/ssr.js CHANGED
@@ -1803,7 +1803,7 @@ function ReportSpanGraph() {
1803
1803
  /* @__PURE__ */ jsx37("h2", { id: "es-span-graph-heading", className: "text-base font-semibold text-foreground", children: "Architecture, as it ran" }),
1804
1804
  /* @__PURE__ */ jsx37("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." }),
1805
1805
  /* @__PURE__ */ jsx37(DocMermaid, { entry: { kind: "mermaid", phase: "static", code } }),
1806
- /* @__PURE__ */ jsxs25("table", { className: "mt-2 w-full text-left text-sm", children: [
1806
+ /* @__PURE__ */ jsxs25("table", { className: "mt-2 w-full border-collapse text-left text-sm", children: [
1807
1807
  /* @__PURE__ */ jsx37("caption", { className: "sr-only", children: "Each component and the scenarios that exercised it" }),
1808
1808
  /* @__PURE__ */ jsx37("thead", { children: /* @__PURE__ */ jsxs25("tr", { className: "text-xs text-muted-foreground", children: [
1809
1809
  /* @__PURE__ */ jsx37("th", { scope: "col", className: "py-1 pr-4 font-medium", children: "Component" }),
@@ -1816,7 +1816,7 @@ function ReportSpanGraph() {
1816
1816
  /* @__PURE__ */ jsx37(MarkBadge, { node })
1817
1817
  ] }),
1818
1818
  /* @__PURE__ */ jsx37("td", { className: "py-1.5 pr-4 text-xs text-muted-foreground", children: LANE_LABEL[node.kind] }),
1819
- /* @__PURE__ */ jsx37("td", { className: "py-1.5", children: /* @__PURE__ */ jsx37("ul", { className: "flex flex-col gap-0.5", children: node.scenarioIds.map((id) => /* @__PURE__ */ jsx37("li", { children: /* @__PURE__ */ jsx37("a", { href: `#${id}`, className: "text-xs underline underline-offset-2", children: titleById.get(id) ?? id }) }, id)) }) })
1819
+ /* @__PURE__ */ jsx37("td", { className: "py-1.5", children: /* @__PURE__ */ jsx37("ul", { className: "flex flex-col gap-0.5", children: node.scenarioIds.map((id) => /* @__PURE__ */ jsx37("li", { children: /* @__PURE__ */ jsx37("a", { href: `#${id}`, className: "text-xs text-link underline underline-offset-2 hover:text-foreground", children: titleById.get(id) ?? id }) }, id)) }) })
1820
1820
  ] }, node.id)) })
1821
1821
  ] })
1822
1822
  ] });
@@ -1825,7 +1825,7 @@ function ReportSpanGraph() {
1825
1825
  // src/components/Report.tsx
1826
1826
  import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
1827
1827
  function Report(props) {
1828
- const { report, customRenderers, renderers, className, title, dataTheme } = props;
1828
+ const { report, customRenderers, renderers, className, title, dataTheme, architecture = false } = props;
1829
1829
  const result = unwrapReport(report);
1830
1830
  if (!result.ok) {
1831
1831
  return /* @__PURE__ */ jsx38(ReportErrorShell, { error: result.error, className, title, dataTheme });
@@ -1834,7 +1834,7 @@ function Report(props) {
1834
1834
  const hasContent = data.features.length > 0;
1835
1835
  return /* @__PURE__ */ jsx38(ReportRoot, { report: data, customRenderers, renderers, children: /* @__PURE__ */ jsxs26("main", { className: cn("es-report", className), "aria-label": title ?? "Test report", "data-theme": dataTheme, children: [
1836
1836
  /* @__PURE__ */ jsx38("header", { className: "es-report-header", children: /* @__PURE__ */ jsx38(ReportTitleBlock, { title }) }),
1837
- /* @__PURE__ */ jsx38(ReportSpanGraph, {}),
1837
+ architecture ? /* @__PURE__ */ jsx38(ReportSpanGraph, {}) : null,
1838
1838
  hasContent ? /* @__PURE__ */ jsx38(ReportFeatureList, {}) : /* @__PURE__ */ jsx38(ReportEmpty, {})
1839
1839
  ] }) });
1840
1840
  }
@@ -1850,7 +1850,7 @@ function escapeJsonForScript(json) {
1850
1850
  var HLJS_URL = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/es/highlight.min.js";
1851
1851
  var HLJS_CSS_LIGHT = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css";
1852
1852
  var HLJS_CSS_DARK = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css";
1853
- var MERMAID_URL = "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
1853
+ var MERMAID_URL = "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
1854
1854
  function cdnAssets(syntaxHighlighting, mermaid) {
1855
1855
  const headParts = [];
1856
1856
  const imports = [];
@@ -1896,10 +1896,11 @@ function renderReportToHtml(report, options = {}) {
1896
1896
  staleAfterDays = 7,
1897
1897
  scenarioHistory,
1898
1898
  share = false,
1899
- shareCommand = ""
1899
+ shareCommand = "",
1900
+ architecture = false
1900
1901
  } = options;
1901
1902
  const markup = renderToStaticMarkup(
1902
- createElement(Report, { report, title })
1903
+ createElement(Report, { report, title, architecture })
1903
1904
  );
1904
1905
  const cdn = cdnAssets(syntaxHighlighting, mermaid);
1905
1906
  const parsed = unwrapReport(report);
@@ -1909,8 +1910,9 @@ function renderReportToHtml(report, options = {}) {
1909
1910
  const historyScript = interactive && scenarioHistory && Object.keys(scenarioHistory).length > 0 ? `<script type="application/json" id="${HISTORY_ID}">${escapeJsonForScript(JSON.stringify(scenarioHistory))}</script>` : "";
1910
1911
  const islandTag = interactive ? `<script>${islandScript}</script>` : "";
1911
1912
  const cdnBody = interactive ? "" : cdn.body;
1913
+ const architectureAttr = architecture ? ` data-es-architecture="true"` : "";
1912
1914
  const shareAttrs = share ? ` data-es-share="true"${shareCommand ? ` data-es-share-cmd="${escapeHtml(shareCommand)}"` : ""}` : "";
1913
- const islandConfigAttrs = interactive ? ` data-es-syntax="${syntaxHighlighting ? "true" : "false"}" data-es-mermaid="${mermaid ? "true" : "false"}" data-es-stale-days="${Number.isFinite(staleAfterDays) && staleAfterDays >= 0 ? staleAfterDays : 7}"${shareAttrs}` : "";
1915
+ const islandConfigAttrs = interactive ? ` data-es-syntax="${syntaxHighlighting ? "true" : "false"}" data-es-mermaid="${mermaid ? "true" : "false"}" data-es-stale-days="${Number.isFinite(staleAfterDays) && staleAfterDays >= 0 ? staleAfterDays : 7}"${shareAttrs}${architectureAttr}` : "";
1914
1916
  const rootAttrs = interactive ? ` id="${ROOT_ID}" data-title="${escapeHtml(title)}"${islandConfigAttrs}` : "";
1915
1917
  return `<!DOCTYPE html>
1916
1918
  <html lang="${escapeHtml(lang)}" data-theme="${theme === "dark" ? "dark" : "light"}">