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/ssr.cjs
CHANGED
|
@@ -881,42 +881,76 @@ function StateCardView({ card }) {
|
|
|
881
881
|
|
|
882
882
|
// src/components/ReportAttachments.tsx
|
|
883
883
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
884
|
+
function attachmentText(att) {
|
|
885
|
+
if (att.contentEncoding !== "BASE64") return att.body;
|
|
886
|
+
try {
|
|
887
|
+
return new TextDecoder().decode(Uint8Array.from(atob(att.body), (c) => c.charCodeAt(0)));
|
|
888
|
+
} catch {
|
|
889
|
+
return void 0;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
function preview(att) {
|
|
893
|
+
const type = att.mediaType.split(";")[0].trim().toLowerCase();
|
|
894
|
+
const text = attachmentText(att);
|
|
895
|
+
if (text === void 0) return null;
|
|
896
|
+
if (type === "text/plain") {
|
|
897
|
+
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 });
|
|
898
|
+
}
|
|
899
|
+
if (type === "text/markdown") {
|
|
900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
901
|
+
"div",
|
|
902
|
+
{
|
|
903
|
+
className: "es-doc-prose prose prose-sm max-w-none rounded-md border border-border p-3",
|
|
904
|
+
dangerouslySetInnerHTML: { __html: safeMarkdownHtml(text) }
|
|
905
|
+
}
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
if (type === "text/html") {
|
|
909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DocHtml, { entry: { kind: "html", content: text, title: att.name, phase: "runtime" } });
|
|
910
|
+
}
|
|
911
|
+
return null;
|
|
912
|
+
}
|
|
884
913
|
function ReportAttachments({ attachments }) {
|
|
885
914
|
if (attachments.length === 0) return null;
|
|
886
915
|
return (
|
|
887
916
|
// role="group" (not a labelled <section>) so multiple scenarios' attachment
|
|
888
917
|
// blocks don't create duplicate "Attachments" region landmarks.
|
|
889
918
|
/* @__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) => {
|
|
890
|
-
const dataUri = att.contentEncoding === "BASE64" ? `data:${att.mediaType};base64,${att.body}` : `data:${att.mediaType},${encodeURIComponent(att.body)}`;
|
|
891
|
-
const
|
|
919
|
+
const dataUri = att.external ? void 0 : att.contentEncoding === "BASE64" ? `data:${att.mediaType};base64,${att.body}` : `data:${att.mediaType},${encodeURIComponent(att.body)}`;
|
|
920
|
+
const href = dataUri ?? (0, import_url.safeUrl)(att.body);
|
|
921
|
+
const imageSrc = dataUri ?? (0, import_url.safeImageUrl)(att.body);
|
|
922
|
+
const isImage = att.mediaType.startsWith("image/") && imageSrc !== void 0;
|
|
892
923
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("figure", { className: "m-0", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
893
924
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
894
925
|
"img",
|
|
895
926
|
{
|
|
896
|
-
src:
|
|
927
|
+
src: imageSrc,
|
|
897
928
|
alt: att.name,
|
|
898
929
|
loading: "lazy",
|
|
899
930
|
className: "max-w-full rounded-md border border-border"
|
|
900
931
|
}
|
|
901
932
|
),
|
|
902
933
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("figcaption", { className: "mt-1 text-xs text-muted-foreground", children: att.name })
|
|
903
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
"
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
934
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
935
|
+
att.external ? null : preview(att),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
937
|
+
"a",
|
|
938
|
+
{
|
|
939
|
+
href,
|
|
940
|
+
download: att.name,
|
|
941
|
+
className: "text-xs text-link underline underline-offset-2",
|
|
942
|
+
children: [
|
|
943
|
+
att.name,
|
|
944
|
+
" ",
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
946
|
+
"(",
|
|
947
|
+
att.mediaType,
|
|
948
|
+
")"
|
|
949
|
+
] })
|
|
950
|
+
]
|
|
951
|
+
}
|
|
952
|
+
)
|
|
953
|
+
] }) }, `${att.name}-${i}`);
|
|
920
954
|
}) })
|
|
921
955
|
);
|
|
922
956
|
}
|