@classic-homes/slides 0.5.1 → 0.5.2

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.
@@ -3,7 +3,7 @@ import {
3
3
  parseDeckSource,
4
4
  renderDeck,
5
5
  stringifyDeck
6
- } from "./chunk-OUAMH2TP.js";
6
+ } from "./chunk-WTC2VV5C.js";
7
7
 
8
8
  // src/node/index.ts
9
9
  import { readFile, stat, writeFile } from "fs/promises";
@@ -117,4 +117,4 @@ export {
117
117
  buildDeckFile,
118
118
  exportDeckFile
119
119
  };
120
- //# sourceMappingURL=chunk-GX6P2SE6.js.map
120
+ //# sourceMappingURL=chunk-7GFFKI3D.js.map
@@ -4,7 +4,7 @@ import {
4
4
  LAYOUT_CATEGORIES,
5
5
  baseSlide,
6
6
  getLayout
7
- } from "./chunk-OUAMH2TP.js";
7
+ } from "./chunk-WTC2VV5C.js";
8
8
 
9
9
  // src/catalog.ts
10
10
  import { z } from "zod";
@@ -104,4 +104,4 @@ export {
104
104
  deckJsonSchema,
105
105
  AUTHORING_GUIDE
106
106
  };
107
- //# sourceMappingURL=chunk-TEE3OGRQ.js.map
107
+ //# sourceMappingURL=chunk-RIKOLCES.js.map
@@ -581,11 +581,16 @@ function escapeHtml(value) {
581
581
  function escapeAttr(value) {
582
582
  return escapeHtml(value);
583
583
  }
584
+ function escapeCssString(value) {
585
+ return value.replace(/["'\\\n\r\f]/g, (c) => `\\${c.charCodeAt(0).toString(16)} `);
586
+ }
584
587
  var SAFE_URL = /^(https?:|mailto:|tel:|#|\/)/i;
585
588
  function isSafeLinkUrl(url) {
586
589
  return SAFE_URL.test(url);
587
590
  }
588
591
  function inline(text) {
592
+ if (!text) return "";
593
+ text = text.replace(/[\uE000\uE001]/g, "");
589
594
  if (!text) return "";
590
595
  const codes = [];
591
596
  let s = text.replace(/`([^`]+)`/g, (_, code) => {
@@ -690,14 +695,15 @@ function items(list, marker = "square") {
690
695
  (i) => `<li class="b-item">${inline(i.text)}${i.sub ? `<span class="sub">${inline(i.sub)}</span>` : ""}</li>`
691
696
  ).join("")}</ul>`;
692
697
  }
698
+ var SAFE_FOCUS = /^[a-z0-9.%\s-]+$/i;
693
699
  function img(image2, ctx, cls = "") {
694
700
  const style = [];
695
701
  if (image2.fit === "contain") style.push("object-fit:contain");
696
- if (image2.focus) style.push(`object-position:${image2.focus.replace(/[;"<>]/g, "")}`);
702
+ if (image2.focus && SAFE_FOCUS.test(image2.focus)) style.push(`object-position:${image2.focus}`);
697
703
  const classes = [cls, image2.size === "natural" ? "natural" : ""].filter(Boolean).join(" ");
698
704
  const src = ctx.image(image2.src);
699
705
  const loading = src.startsWith("data:") ? "" : ' loading="lazy"';
700
- return `<img${classes ? ` class="${classes}"` : ""} src="${escapeAttr(src)}" alt="${escapeAttr(image2.alt)}"${style.length ? ` style="${style.join(";")}"` : ""}${loading} decoding="async">`;
706
+ return `<img${classes ? ` class="${classes}"` : ""} src="${escapeAttr(src)}" alt="${escapeAttr(image2.alt)}"${style.length ? ` style="${escapeAttr(style.join(";"))}"` : ""}${loading} decoding="async">`;
701
707
  }
702
708
  function maxLen(value, limit, path, what) {
703
709
  if (!value || value.length <= limit) return [];
@@ -3592,7 +3598,7 @@ async function renderDeck(input, options = {}) {
3592
3598
  const overlay = slide.overlay ?? "dark";
3593
3599
  classes.push("has-bg", `overlay-${overlay}`);
3594
3600
  if (overlay !== "light" && !classes.includes("solid")) classes.push("solid");
3595
- style = ` style="--bg-img:url(&quot;${escapeAttr(ctx.image(slide.backgroundImage.src))}&quot;)"`;
3601
+ style = ` style="--bg-img:url(&quot;${escapeAttr(escapeCssString(ctx.image(slide.backgroundImage.src)))}&quot;)"`;
3596
3602
  }
3597
3603
  if (slide.hidden) classes.push("is-hidden");
3598
3604
  let chrome = "";
@@ -3954,4 +3960,4 @@ export {
3954
3960
  inlineDeckImages,
3955
3961
  externalizeDeckImages
3956
3962
  };
3957
- //# sourceMappingURL=chunk-OUAMH2TP.js.map
3963
+ //# sourceMappingURL=chunk-WTC2VV5C.js.map