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.js
CHANGED
|
@@ -721,42 +721,76 @@ function StateCardView({ card }) {
|
|
|
721
721
|
|
|
722
722
|
// src/components/ReportAttachments.tsx
|
|
723
723
|
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
724
|
+
function attachmentText(att) {
|
|
725
|
+
if (att.contentEncoding !== "BASE64") return att.body;
|
|
726
|
+
try {
|
|
727
|
+
return new TextDecoder().decode(Uint8Array.from(atob(att.body), (c) => c.charCodeAt(0)));
|
|
728
|
+
} catch {
|
|
729
|
+
return void 0;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
function preview(att) {
|
|
733
|
+
const type = att.mediaType.split(";")[0].trim().toLowerCase();
|
|
734
|
+
const text = attachmentText(att);
|
|
735
|
+
if (text === void 0) return null;
|
|
736
|
+
if (type === "text/plain") {
|
|
737
|
+
return /* @__PURE__ */ jsx21("pre", { className: "max-h-96 overflow-auto rounded-md border border-border bg-muted/40 p-3 text-xs whitespace-pre-wrap", children: text });
|
|
738
|
+
}
|
|
739
|
+
if (type === "text/markdown") {
|
|
740
|
+
return /* @__PURE__ */ jsx21(
|
|
741
|
+
"div",
|
|
742
|
+
{
|
|
743
|
+
className: "es-doc-prose prose prose-sm max-w-none rounded-md border border-border p-3",
|
|
744
|
+
dangerouslySetInnerHTML: { __html: safeMarkdownHtml(text) }
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
if (type === "text/html") {
|
|
749
|
+
return /* @__PURE__ */ jsx21(DocHtml, { entry: { kind: "html", content: text, title: att.name, phase: "runtime" } });
|
|
750
|
+
}
|
|
751
|
+
return null;
|
|
752
|
+
}
|
|
724
753
|
function ReportAttachments({ attachments }) {
|
|
725
754
|
if (attachments.length === 0) return null;
|
|
726
755
|
return (
|
|
727
756
|
// role="group" (not a labelled <section>) so multiple scenarios' attachment
|
|
728
757
|
// blocks don't create duplicate "Attachments" region landmarks.
|
|
729
758
|
/* @__PURE__ */ jsx21("div", { role: "group", "aria-label": "Attachments", className: "mt-3 flex flex-col gap-2", children: attachments.map((att, i) => {
|
|
730
|
-
const dataUri = att.contentEncoding === "BASE64" ? `data:${att.mediaType};base64,${att.body}` : `data:${att.mediaType},${encodeURIComponent(att.body)}`;
|
|
731
|
-
const
|
|
759
|
+
const dataUri = att.external ? void 0 : att.contentEncoding === "BASE64" ? `data:${att.mediaType};base64,${att.body}` : `data:${att.mediaType},${encodeURIComponent(att.body)}`;
|
|
760
|
+
const href = dataUri ?? safeUrl(att.body);
|
|
761
|
+
const imageSrc = dataUri ?? safeImageUrl(att.body);
|
|
762
|
+
const isImage = att.mediaType.startsWith("image/") && imageSrc !== void 0;
|
|
732
763
|
return /* @__PURE__ */ jsx21("figure", { className: "m-0", children: isImage ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
733
764
|
/* @__PURE__ */ jsx21(
|
|
734
765
|
"img",
|
|
735
766
|
{
|
|
736
|
-
src:
|
|
767
|
+
src: imageSrc,
|
|
737
768
|
alt: att.name,
|
|
738
769
|
loading: "lazy",
|
|
739
770
|
className: "max-w-full rounded-md border border-border"
|
|
740
771
|
}
|
|
741
772
|
),
|
|
742
773
|
/* @__PURE__ */ jsx21("figcaption", { className: "mt-1 text-xs text-muted-foreground", children: att.name })
|
|
743
|
-
] }) : /* @__PURE__ */ jsxs12(
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
"
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
774
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
775
|
+
att.external ? null : preview(att),
|
|
776
|
+
/* @__PURE__ */ jsxs12(
|
|
777
|
+
"a",
|
|
778
|
+
{
|
|
779
|
+
href,
|
|
780
|
+
download: att.name,
|
|
781
|
+
className: "text-xs text-link underline underline-offset-2",
|
|
782
|
+
children: [
|
|
783
|
+
att.name,
|
|
784
|
+
" ",
|
|
785
|
+
/* @__PURE__ */ jsxs12("span", { className: "text-muted-foreground", children: [
|
|
786
|
+
"(",
|
|
787
|
+
att.mediaType,
|
|
788
|
+
")"
|
|
789
|
+
] })
|
|
790
|
+
]
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
] }) }, `${att.name}-${i}`);
|
|
760
794
|
}) })
|
|
761
795
|
);
|
|
762
796
|
}
|