executable-stories-react 0.2.0 → 0.2.1

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.
@@ -216,6 +216,15 @@ function safeUrl(value) {
216
216
  if (scheme && !/^https?$/i.test(scheme[1] ?? "")) return void 0;
217
217
  return trimmed;
218
218
  }
219
+ function safeImageUrl(value) {
220
+ if (!value) return void 0;
221
+ const trimmed = value.trim();
222
+ if (/^data:image\//i.test(trimmed)) return trimmed;
223
+ return safeUrl(trimmed);
224
+ }
225
+ function isLocalFsPath(value) {
226
+ return /^(?:[/\\]|[A-Za-z]:[/\\])/.test(value);
227
+ }
219
228
 
220
229
  // src/components/doc/DocSection.tsx
221
230
  import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -271,11 +280,19 @@ function DocMermaid({ entry }) {
271
280
  // src/components/doc/DocScreenshot.tsx
272
281
  import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
273
282
  function DocScreenshot({ entry }) {
283
+ const src = isLocalFsPath(entry.path) ? void 0 : safeImageUrl(entry.path);
284
+ if (!src) {
285
+ return /* @__PURE__ */ jsxs6("figure", { className: "my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground", children: [
286
+ /* @__PURE__ */ jsx10("div", { className: "font-medium", children: "Screenshot unavailable" }),
287
+ /* @__PURE__ */ jsx10("div", { className: "mt-1 break-all font-mono text-xs", children: entry.path }),
288
+ entry.alt ? /* @__PURE__ */ jsx10("figcaption", { className: "mt-1.5 text-xs", children: entry.alt }) : null
289
+ ] });
290
+ }
274
291
  return /* @__PURE__ */ jsxs6("figure", { className: "my-3", children: [
275
292
  /* @__PURE__ */ jsx10(
276
293
  "img",
277
294
  {
278
- src: entry.path,
295
+ src,
279
296
  alt: entry.alt ?? "",
280
297
  loading: "lazy",
281
298
  className: "max-w-full rounded-md border border-border"
@@ -288,6 +305,13 @@ function DocScreenshot({ entry }) {
288
305
  // src/components/doc/DocVideo.tsx
289
306
  import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
290
307
  function DocVideo({ entry }) {
308
+ if (isLocalFsPath(entry.path)) {
309
+ return /* @__PURE__ */ jsxs7("figure", { className: "my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground", children: [
310
+ /* @__PURE__ */ jsx11("div", { className: "font-medium", children: "Video unavailable" }),
311
+ /* @__PURE__ */ jsx11("div", { className: "mt-1 break-all font-mono text-xs", children: entry.path }),
312
+ entry.caption ? /* @__PURE__ */ jsx11("figcaption", { className: "mt-1.5 text-xs", children: entry.caption }) : null
313
+ ] });
314
+ }
291
315
  const src = safeUrl(entry.path);
292
316
  const poster = safeUrl(entry.poster);
293
317
  return /* @__PURE__ */ jsxs7("figure", { className: "my-3", children: [