image-exporter 1.2.0 → 1.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
@@ -12985,6 +12985,7 @@ var IN_FIREFOX = USER_AGENT.includes("Firefox");
12985
12985
  var isContext = (value) => value && ("__CONTEXT__" in value);
12986
12986
  var isCssFontFaceRule = (rule) => rule.constructor.name === "CSSFontFaceRule";
12987
12987
  var isCSSImportRule = (rule) => rule.constructor.name === "CSSImportRule";
12988
+ var isLayerBlockRule = (rule) => rule.constructor.name === "CSSLayerBlockRule";
12988
12989
  var isElementNode = (node) => node.nodeType === 1;
12989
12990
  var isSVGElementNode = (node) => typeof node.className === "object";
12990
12991
  var isSVGImageElementNode = (node) => node.tagName === "image";
@@ -14146,7 +14147,10 @@ async function embedWebFont(clone, context) {
14146
14147
  }
14147
14148
  });
14148
14149
  }));
14149
- const cssRules = styleSheets.flatMap((styleSheet) => Array.from(styleSheet.cssRules));
14150
+ const cssRules = [];
14151
+ styleSheets.forEach((sheet) => {
14152
+ unwrapCssLayers(sheet.cssRules, cssRules);
14153
+ });
14150
14154
  cssRules.filter((cssRule) => isCssFontFaceRule(cssRule) && hasCssUrl(cssRule.style.getPropertyValue("src")) && splitFontFamily(cssRule.style.getPropertyValue("font-family"))?.some((val) => fontFamilies.has(val))).forEach((value) => {
14151
14155
  const rule = value;
14152
14156
  const cssText = fontCssTexts.get(rule.cssText);
@@ -14211,6 +14215,18 @@ function filterPreferredFormat(str, context) {
14211
14215
  }
14212
14216
  }) : str;
14213
14217
  }
14218
+ function unwrapCssLayers(rules, out = []) {
14219
+ for (const rule of Array.from(rules)) {
14220
+ if (isLayerBlockRule(rule)) {
14221
+ out.push(...unwrapCssLayers(rule.cssRules));
14222
+ } else if ("cssRules" in rule) {
14223
+ unwrapCssLayers(rule.cssRules, out);
14224
+ } else {
14225
+ out.push(rule);
14226
+ }
14227
+ }
14228
+ return out;
14229
+ }
14214
14230
  async function domToForeignObjectSvg(node, options) {
14215
14231
  const context = await orCreateContext(node, options);
14216
14232
  if (isElementNode(context.node) && isSVGElementNode(context.node))
@@ -14875,4 +14891,4 @@ if (typeof window !== "undefined") {
14875
14891
  window.imageExporterDownload = downloadImages;
14876
14892
  }
14877
14893
 
14878
- //# debugId=70063F21D807DDC964756E2164756E21
14894
+ //# debugId=26234370B1A3CB5F64756E2164756E21