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.
@@ -245,6 +245,15 @@ function safeUrl(value) {
245
245
  if (scheme && !/^https?$/i.test(scheme[1] ?? "")) return void 0;
246
246
  return trimmed;
247
247
  }
248
+ function safeImageUrl(value) {
249
+ if (!value) return void 0;
250
+ const trimmed = value.trim();
251
+ if (/^data:image\//i.test(trimmed)) return trimmed;
252
+ return safeUrl(trimmed);
253
+ }
254
+ function isLocalFsPath(value) {
255
+ return /^(?:[/\\]|[A-Za-z]:[/\\])/.test(value);
256
+ }
248
257
 
249
258
  // src/components/doc/DocSection.tsx
250
259
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -300,11 +309,19 @@ function DocMermaid({ entry }) {
300
309
  // src/components/doc/DocScreenshot.tsx
301
310
  var import_jsx_runtime10 = require("react/jsx-runtime");
302
311
  function DocScreenshot({ entry }) {
312
+ const src = isLocalFsPath(entry.path) ? void 0 : safeImageUrl(entry.path);
313
+ if (!src) {
314
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("figure", { className: "my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground", children: [
315
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "font-medium", children: "Screenshot unavailable" }),
316
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-1 break-all font-mono text-xs", children: entry.path }),
317
+ entry.alt ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("figcaption", { className: "mt-1.5 text-xs", children: entry.alt }) : null
318
+ ] });
319
+ }
303
320
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("figure", { className: "my-3", children: [
304
321
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
305
322
  "img",
306
323
  {
307
- src: entry.path,
324
+ src,
308
325
  alt: entry.alt ?? "",
309
326
  loading: "lazy",
310
327
  className: "max-w-full rounded-md border border-border"
@@ -317,6 +334,13 @@ function DocScreenshot({ entry }) {
317
334
  // src/components/doc/DocVideo.tsx
318
335
  var import_jsx_runtime11 = require("react/jsx-runtime");
319
336
  function DocVideo({ entry }) {
337
+ if (isLocalFsPath(entry.path)) {
338
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("figure", { className: "my-3 rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground", children: [
339
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "font-medium", children: "Video unavailable" }),
340
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mt-1 break-all font-mono text-xs", children: entry.path }),
341
+ entry.caption ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("figcaption", { className: "mt-1.5 text-xs", children: entry.caption }) : null
342
+ ] });
343
+ }
320
344
  const src = safeUrl(entry.path);
321
345
  const poster = safeUrl(entry.poster);
322
346
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("figure", { className: "my-3", children: [