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.
package/dist/index.cjs CHANGED
@@ -282,6 +282,15 @@ function safeUrl(value) {
282
282
  if (scheme && !/^https?$/i.test(scheme[1] ?? "")) return void 0;
283
283
  return trimmed;
284
284
  }
285
+ function safeImageUrl(value) {
286
+ if (!value) return void 0;
287
+ const trimmed = value.trim();
288
+ if (/^data:image\//i.test(trimmed)) return trimmed;
289
+ return safeUrl(trimmed);
290
+ }
291
+ function isLocalFsPath(value) {
292
+ return /^(?:[/\\]|[A-Za-z]:[/\\])/.test(value);
293
+ }
285
294
 
286
295
  // src/components/doc/DocSection.tsx
287
296
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -337,11 +346,19 @@ function DocMermaid({ entry }) {
337
346
  // src/components/doc/DocScreenshot.tsx
338
347
  var import_jsx_runtime10 = require("react/jsx-runtime");
339
348
  function DocScreenshot({ entry }) {
349
+ const src = isLocalFsPath(entry.path) ? void 0 : safeImageUrl(entry.path);
350
+ if (!src) {
351
+ 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: [
352
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "font-medium", children: "Screenshot unavailable" }),
353
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-1 break-all font-mono text-xs", children: entry.path }),
354
+ entry.alt ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("figcaption", { className: "mt-1.5 text-xs", children: entry.alt }) : null
355
+ ] });
356
+ }
340
357
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("figure", { className: "my-3", children: [
341
358
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
342
359
  "img",
343
360
  {
344
- src: entry.path,
361
+ src,
345
362
  alt: entry.alt ?? "",
346
363
  loading: "lazy",
347
364
  className: "max-w-full rounded-md border border-border"
@@ -354,6 +371,13 @@ function DocScreenshot({ entry }) {
354
371
  // src/components/doc/DocVideo.tsx
355
372
  var import_jsx_runtime11 = require("react/jsx-runtime");
356
373
  function DocVideo({ entry }) {
374
+ if (isLocalFsPath(entry.path)) {
375
+ 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: [
376
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "font-medium", children: "Video unavailable" }),
377
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mt-1 break-all font-mono text-xs", children: entry.path }),
378
+ entry.caption ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("figcaption", { className: "mt-1.5 text-xs", children: entry.caption }) : null
379
+ ] });
380
+ }
357
381
  const src = safeUrl(entry.path);
358
382
  const poster = safeUrl(entry.poster);
359
383
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("figure", { className: "my-3", children: [