executable-stories-react 0.18.0 → 0.19.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 +58 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +58 -20
- package/dist/index.js.map +1 -1
- package/dist/interactive.cjs +54 -20
- package/dist/interactive.cjs.map +1 -1
- package/dist/interactive.js +54 -20
- package/dist/interactive.js.map +1 -1
- package/dist/parse.cjs +4 -0
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.js +4 -0
- package/dist/parse.js.map +1 -1
- package/dist/report-island.global.js +61 -58
- package/dist/ssr.cjs +54 -20
- package/dist/ssr.cjs.map +1 -1
- package/dist/ssr.js +54 -20
- package/dist/ssr.js.map +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +20 -20
package/dist/interactive.cjs
CHANGED
|
@@ -757,42 +757,76 @@ function StateCardView({ card }) {
|
|
|
757
757
|
|
|
758
758
|
// src/components/ReportAttachments.tsx
|
|
759
759
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
760
|
+
function attachmentText(att) {
|
|
761
|
+
if (att.contentEncoding !== "BASE64") return att.body;
|
|
762
|
+
try {
|
|
763
|
+
return new TextDecoder().decode(Uint8Array.from(atob(att.body), (c) => c.charCodeAt(0)));
|
|
764
|
+
} catch {
|
|
765
|
+
return void 0;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
function preview(att) {
|
|
769
|
+
const type = att.mediaType.split(";")[0].trim().toLowerCase();
|
|
770
|
+
const text = attachmentText(att);
|
|
771
|
+
if (text === void 0) return null;
|
|
772
|
+
if (type === "text/plain") {
|
|
773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "max-h-96 overflow-auto rounded-md border border-border bg-muted/40 p-3 text-xs whitespace-pre-wrap", children: text });
|
|
774
|
+
}
|
|
775
|
+
if (type === "text/markdown") {
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
777
|
+
"div",
|
|
778
|
+
{
|
|
779
|
+
className: "es-doc-prose prose prose-sm max-w-none rounded-md border border-border p-3",
|
|
780
|
+
dangerouslySetInnerHTML: { __html: safeMarkdownHtml(text) }
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
if (type === "text/html") {
|
|
785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DocHtml, { entry: { kind: "html", content: text, title: att.name, phase: "runtime" } });
|
|
786
|
+
}
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
760
789
|
function ReportAttachments({ attachments }) {
|
|
761
790
|
if (attachments.length === 0) return null;
|
|
762
791
|
return (
|
|
763
792
|
// role="group" (not a labelled <section>) so multiple scenarios' attachment
|
|
764
793
|
// blocks don't create duplicate "Attachments" region landmarks.
|
|
765
794
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "group", "aria-label": "Attachments", className: "mt-3 flex flex-col gap-2", children: attachments.map((att, i) => {
|
|
766
|
-
const dataUri = att.contentEncoding === "BASE64" ? `data:${att.mediaType};base64,${att.body}` : `data:${att.mediaType},${encodeURIComponent(att.body)}`;
|
|
767
|
-
const
|
|
795
|
+
const dataUri = att.external ? void 0 : att.contentEncoding === "BASE64" ? `data:${att.mediaType};base64,${att.body}` : `data:${att.mediaType},${encodeURIComponent(att.body)}`;
|
|
796
|
+
const href = dataUri ?? (0, import_url.safeUrl)(att.body);
|
|
797
|
+
const imageSrc = dataUri ?? (0, import_url.safeImageUrl)(att.body);
|
|
798
|
+
const isImage = att.mediaType.startsWith("image/") && imageSrc !== void 0;
|
|
768
799
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("figure", { className: "m-0", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
769
800
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
770
801
|
"img",
|
|
771
802
|
{
|
|
772
|
-
src:
|
|
803
|
+
src: imageSrc,
|
|
773
804
|
alt: att.name,
|
|
774
805
|
loading: "lazy",
|
|
775
806
|
className: "max-w-full rounded-md border border-border"
|
|
776
807
|
}
|
|
777
808
|
),
|
|
778
809
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("figcaption", { className: "mt-1 text-xs text-muted-foreground", children: att.name })
|
|
779
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
"
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
810
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
811
|
+
att.external ? null : preview(att),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
813
|
+
"a",
|
|
814
|
+
{
|
|
815
|
+
href,
|
|
816
|
+
download: att.name,
|
|
817
|
+
className: "text-xs text-link underline underline-offset-2",
|
|
818
|
+
children: [
|
|
819
|
+
att.name,
|
|
820
|
+
" ",
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
822
|
+
"(",
|
|
823
|
+
att.mediaType,
|
|
824
|
+
")"
|
|
825
|
+
] })
|
|
826
|
+
]
|
|
827
|
+
}
|
|
828
|
+
)
|
|
829
|
+
] }) }, `${att.name}-${i}`);
|
|
796
830
|
}) })
|
|
797
831
|
);
|
|
798
832
|
}
|