x-print-designer 0.4.8 → 0.4.13

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.
@@ -1,4 +1,4 @@
1
- import { getDefaultExportFromCjs } from "./web-component-DTlUr7qT.js";
1
+ import { getDefaultExportFromCjs } from "./index-sx0m_xBC.js";
2
2
  function _mergeNamespaces(n, m) {
3
3
  for (var i = 0; i < m.length; i++) {
4
4
  const e = m[i];
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, computed, onUnmounted, watch, shallowRef, loader, onMounted, nextTick, ref } from "./web-component-DTlUr7qT.js";
1
+ import { defineComponent, h, computed, onUnmounted, watch, shallowRef, loader, onMounted, nextTick, ref } from "./index-sx0m_xBC.js";
2
2
  var __defProp$2 = Object.defineProperty;
3
3
  var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -17894,12 +17894,20 @@ const messages = {
17894
17894
  en,
17895
17895
  zh
17896
17896
  };
17897
+ const getStoredLanguage = () => {
17898
+ if (typeof localStorage === "undefined") return null;
17899
+ try {
17900
+ return localStorage.getItem("print-designer-language");
17901
+ } catch {
17902
+ return null;
17903
+ }
17904
+ };
17897
17905
  const getInitialLanguage = () => {
17898
- const stored = localStorage.getItem("print-designer-language");
17906
+ const stored = getStoredLanguage();
17899
17907
  if (stored && (stored === "zh" || stored === "en")) {
17900
17908
  return stored;
17901
17909
  }
17902
- const lang = navigator.language.toLowerCase();
17910
+ const lang = typeof navigator !== "undefined" ? navigator.language.toLowerCase() : "";
17903
17911
  if (lang.startsWith("zh")) {
17904
17912
  return "zh";
17905
17913
  }
@@ -30514,7 +30522,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
30514
30522
  const renderBarcode = async () => {
30515
30523
  if (!barcodeRef.value) return;
30516
30524
  try {
30517
- const jsBarcodeModule = await import("./JsBarcode-DxjTagMM.js").then((n) => n.JsBarcode);
30525
+ const jsBarcodeModule = await import("./JsBarcode-Ie7CY3Wt.js").then((n) => n.JsBarcode);
30518
30526
  const JsBarcode = (jsBarcodeModule == null ? void 0 : jsBarcodeModule.default) || jsBarcodeModule;
30519
30527
  const content = resolvedContent.value;
30520
30528
  const style = props.element.style;
@@ -30614,7 +30622,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
30614
30622
  });
30615
30623
  const renderQR = async () => {
30616
30624
  try {
30617
- const qrcodeModule = await import("./browser-CYHQS9L7.js").then((n) => n.browser);
30625
+ const qrcodeModule = await import("./browser-VQbZ-HlB.js").then((n) => n.browser);
30618
30626
  const QRCode = (qrcodeModule == null ? void 0 : qrcodeModule.default) || qrcodeModule;
30619
30627
  const content = resolvedContent.value;
30620
30628
  qrSrc.value = await QRCode.toDataURL(content, {
@@ -34402,7 +34410,7 @@ const usePrint = () => {
34402
34410
  const svgToCanvas = async (root) => {
34403
34411
  const svgs = root.querySelectorAll("svg");
34404
34412
  if (svgs.length === 0) return;
34405
- const { Canvg } = await import("./index.es-bGPC2lWY.js");
34413
+ const { Canvg } = await import("./index.es-CJVAF11T.js");
34406
34414
  svgs.forEach((svg) => {
34407
34415
  const parent = svg.parentElement;
34408
34416
  if (!parent) return;
@@ -34990,7 +34998,7 @@ const usePrint = () => {
34990
34998
  }
34991
34999
  try {
34992
35000
  const generatePageImage = async (page) => {
34993
- const domToImageModule = await import("./dom-to-image-more.min-BPzsxQjT.js").then((n) => n.domToImageMore_min);
35001
+ const domToImageModule = await import("./dom-to-image-more.min-CyxmydGS.js").then((n) => n.domToImageMore_min);
34994
35002
  const domtoimage = (domToImageModule == null ? void 0 : domToImageModule.default) || domToImageModule;
34995
35003
  const canvas = await domtoimage.toCanvas(page, {
34996
35004
  filter: (node) => {
@@ -35048,7 +35056,7 @@ const usePrint = () => {
35048
35056
  cleanup = source.cleanup;
35049
35057
  const { container, tempWrapper: wrapper } = await processContentForImage(source.content, width, height, true, source.getComputedStyleFn);
35050
35058
  tempWrapper = wrapper;
35051
- const jsPdfModule = await import("./jspdf.es.min-Bl2JrjPw.js");
35059
+ const jsPdfModule = await import("./jspdf.es.min-BZ5J-fwr.js");
35052
35060
  const jsPDF = (jsPdfModule == null ? void 0 : jsPdfModule.default) || (jsPdfModule == null ? void 0 : jsPdfModule.jsPDF) || jsPdfModule;
35053
35061
  const pdf = new jsPDF({
35054
35062
  orientation: width > height ? "l" : "p",
@@ -35460,7 +35468,7 @@ const usePrint = () => {
35460
35468
  link.click();
35461
35469
  document.body.removeChild(link);
35462
35470
  } else {
35463
- const jsZipModule = await import("./jszip.min-DjNutFBr.js").then((n) => n.jszip_min);
35471
+ const jsZipModule = await import("./jszip.min-DQML3mxT.js").then((n) => n.jszip_min);
35464
35472
  const JSZip = (jsZipModule == null ? void 0 : jsZipModule.default) || jsZipModule;
35465
35473
  const zip = new JSZip();
35466
35474
  await Promise.all(pageImages.map(async (dataUrl, index2) => {
@@ -36919,7 +36927,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
36919
36927
  },
36920
36928
  emits: ["update:visible", "update:value", "close"],
36921
36929
  setup(__props, { emit: __emit }) {
36922
- const Editor = /* @__PURE__ */ defineAsyncComponent(() => import("./index-DDpdu5o7.js").then((m) => m.Editor));
36930
+ const Editor = /* @__PURE__ */ defineAsyncComponent(() => import("./index-C6B5Mzsh.js").then((m) => m.Editor));
36923
36931
  const { t } = useI18n();
36924
36932
  const { isDark: isDark2 } = useTheme();
36925
36933
  const modalContainer = inject("modal-container", /* @__PURE__ */ ref(null));
@@ -39230,9 +39238,9 @@ function render$x(_ctx, _cache) {
39230
39238
  }
39231
39239
  const InfoIcon = markRaw({ name: "material-symbols-info", render: render$x });
39232
39240
  const name = "x-print-designer";
39233
- const version = "0.4.8";
39234
- const dependencies = { "@guolao/vue-monaco-editor": "^1.6.0", "canvg": "^3.0.11", "dom-to-image-more": "^3.7.2", "echarts": "^6.0.0", "jsbarcode": "^3.12.3", "jspdf": "4.2", "jszip": "^3.10.1", "lodash": "^4.17.21", "pinia": "^2.3.0", "qrcode": "^1.5.4", "uuid": "^11.0.3", "vue": "^3.5.13", "vue-i18n": "^11.2.8" };
39235
- const devDependencies = { "@iconify-json/material-symbols": "^1.2.53", "@types/jsbarcode": "^3.11.4", "@types/lodash": "^4.17.13", "@types/node": "^22.10.2", "@types/qrcode": "^1.5.6", "@types/uuid": "^10.0.0", "@vitejs/plugin-vue": "^5.2.1", "@vue/tsconfig": "^0.7.0", "autoprefixer": "^10.4.20", "postcss": "^8.4.49", "rollup-plugin-visualizer": "^7.0.1", "sharp": "^0.34.5", "tailwindcss": "^3.4.17", "terser": "^5.46.1", "typescript": "~5.6.2", "unplugin-icons": "^23.0.1", "vite": "^6.0.1", "vue-tsc": "^2.1.10" };
39241
+ const version = "0.4.12";
39242
+ const dependencies = { "@guolao/vue-monaco-editor": "^1.6.0", "canvg": "^3.0.11", "dom-to-image-more": "^3.7.2", "echarts": "^6.0.0", "jsbarcode": "^3.12.3", "jspdf": "4.2", "jszip": "^3.10.1", "lodash": "^4.17.21", "qrcode": "^1.5.4", "uuid": "^11.0.3" };
39243
+ const devDependencies = { "@iconify-json/material-symbols": "^1.2.53", "@types/jsbarcode": "^3.11.4", "@types/lodash": "^4.17.13", "@types/node": "^22.10.2", "@types/qrcode": "^1.5.6", "@types/uuid": "^10.0.0", "@vitejs/plugin-vue": "^5.2.1", "@vue/tsconfig": "^0.7.0", "autoprefixer": "^10.4.20", "postcss": "^8.4.49", "pinia": "2.3.0", "rollup-plugin-visualizer": "^7.0.1", "sharp": "^0.34.5", "tailwindcss": "^3.4.17", "terser": "^5.46.1", "typescript": "~5.6.2", "unplugin-icons": "^23.0.1", "vite": "^6.0.1", "vue": "3.5.13", "vue-i18n": "11.2.8", "vue-tsc": "^2.1.10" };
39236
39244
  const pkg = {
39237
39245
  name,
39238
39246
  version,
@@ -41931,7 +41939,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
41931
41939
  },
41932
41940
  emits: ["update:value"],
41933
41941
  setup(__props, { emit: __emit }) {
41934
- const Editor = /* @__PURE__ */ defineAsyncComponent(() => import("./index-DDpdu5o7.js").then((m) => m.Editor));
41942
+ const Editor = /* @__PURE__ */ defineAsyncComponent(() => import("./index-C6B5Mzsh.js").then((m) => m.Editor));
41935
41943
  const emit2 = __emit;
41936
41944
  useDesignerStore();
41937
41945
  const { isDark: isDark2 } = useTheme();
@@ -45321,7 +45329,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
45321
45329
  };
45322
45330
  const renderBarcodeDataUrl = async (element) => {
45323
45331
  try {
45324
- const jsBarcodeModule = await import("./JsBarcode-DxjTagMM.js").then((n) => n.JsBarcode);
45332
+ const jsBarcodeModule = await import("./JsBarcode-Ie7CY3Wt.js").then((n) => n.JsBarcode);
45325
45333
  const JsBarcode = (jsBarcodeModule == null ? void 0 : jsBarcodeModule.default) || jsBarcodeModule;
45326
45334
  const canvas = document.createElement("canvas");
45327
45335
  const style = element.style || {};
@@ -45348,7 +45356,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
45348
45356
  const renderQrDataUrl = async (element) => {
45349
45357
  var _a2, _b;
45350
45358
  try {
45351
- const qrcodeModule = await import("./browser-CYHQS9L7.js").then((n) => n.browser);
45359
+ const qrcodeModule = await import("./browser-VQbZ-HlB.js").then((n) => n.browser);
45352
45360
  const QRCode = (qrcodeModule == null ? void 0 : qrcodeModule.default) || qrcodeModule;
45353
45361
  return await QRCode.toDataURL(getResolvedContent(element), {
45354
45362
  margin: 0,
@@ -54109,8 +54117,30 @@ loader.config({
54109
54117
  }
54110
54118
  });
54111
54119
  const designerFontStorageKey = "print-designer-font-family";
54120
+ const readStorage = (key) => {
54121
+ if (typeof localStorage === "undefined") return null;
54122
+ try {
54123
+ return localStorage.getItem(key);
54124
+ } catch {
54125
+ return null;
54126
+ }
54127
+ };
54128
+ const writeStorage = (key, value) => {
54129
+ if (typeof localStorage === "undefined") return;
54130
+ try {
54131
+ localStorage.setItem(key, value);
54132
+ } catch {
54133
+ }
54134
+ };
54135
+ const removeStorage = (key) => {
54136
+ if (typeof localStorage === "undefined") return;
54137
+ try {
54138
+ localStorage.removeItem(key);
54139
+ } catch {
54140
+ }
54141
+ };
54112
54142
  const applyStoredBrandVars = () => {
54113
- const stored = localStorage.getItem("print-designer-brand-vars");
54143
+ const stored = readStorage("print-designer-brand-vars");
54114
54144
  if (!stored) return;
54115
54145
  try {
54116
54146
  const vars = JSON.parse(stored);
@@ -54124,8 +54154,10 @@ const applyStoredBrandVars = () => {
54124
54154
  };
54125
54155
  const getStoredDesignerFont = () => {
54126
54156
  var _a2;
54127
- return ((_a2 = localStorage.getItem(designerFontStorageKey)) == null ? void 0 : _a2.trim()) || "";
54157
+ return ((_a2 = readStorage(designerFontStorageKey)) == null ? void 0 : _a2.trim()) || "";
54128
54158
  };
54159
+ const HTMLElementBase = typeof HTMLElement === "undefined" ? class {
54160
+ } : HTMLElement;
54129
54161
  const normalizeTemplateVariableKey = (rawKey) => {
54130
54162
  const key = String(rawKey || "").trim();
54131
54163
  if (!key) return "";
@@ -54159,7 +54191,7 @@ const sanitizeTemplateRenderState = (data) => {
54159
54191
  }));
54160
54192
  return next;
54161
54193
  };
54162
- class PrintDesignerElement extends HTMLElement {
54194
+ class PrintDesignerElement extends HTMLElementBase {
54163
54195
  constructor() {
54164
54196
  super(...arguments);
54165
54197
  __publicField(this, "app", null);
@@ -54231,16 +54263,58 @@ class PrintDesignerElement extends HTMLElement {
54231
54263
  this._autoSaveIntervalMs.value = intervalMs;
54232
54264
  }
54233
54265
  }
54266
+ getPreviewPageProps(options) {
54267
+ var _a2, _b, _c, _d, _e, _f;
54268
+ return {
54269
+ autoRender: true,
54270
+ pages: options.pages,
54271
+ canvasSize: options.canvasSize,
54272
+ canvasBackground: options.canvasBackground,
54273
+ testData: options.testData,
54274
+ variables: options.variables,
54275
+ watermark: options.watermark,
54276
+ mode: options.mode ?? ((_a2 = this.designerStore) == null ? void 0 : _a2.mode) ?? this._mode.value,
54277
+ headerHeight: options.headerHeight ?? ((_b = this.designerStore) == null ? void 0 : _b.headerHeight),
54278
+ footerHeight: options.footerHeight ?? ((_c = this.designerStore) == null ? void 0 : _c.footerHeight),
54279
+ showHeaderLine: options.showHeaderLine ?? ((_d = this.designerStore) == null ? void 0 : _d.showHeaderLine),
54280
+ showFooterLine: options.showFooterLine ?? ((_e = this.designerStore) == null ? void 0 : _e.showFooterLine),
54281
+ pageSpacingY: options.pageSpacingY ?? ((_f = this.designerStore) == null ? void 0 : _f.pageSpacingY),
54282
+ autoRenderTrigger: 1
54283
+ };
54284
+ }
54285
+ syncPreviewStore(pinia, options) {
54286
+ const previewStore = useDesignerStore(pinia);
54287
+ const snapshot = this._designerStateSnapshot;
54288
+ previewStore.pages = lodashExports.cloneDeep(options.pages || []);
54289
+ if (options.canvasSize) previewStore.canvasSize = lodashExports.cloneDeep(options.canvasSize);
54290
+ if (options.canvasBackground !== void 0) previewStore.canvasBackground = options.canvasBackground;
54291
+ if (options.testData !== void 0) previewStore.testData = lodashExports.cloneDeep(options.testData || {});
54292
+ if (options.variables !== void 0) previewStore.variables = lodashExports.cloneDeep(options.variables || {});
54293
+ if (options.watermark !== void 0) previewStore.watermark = lodashExports.cloneDeep(options.watermark);
54294
+ previewStore.setMode(options.mode ?? (snapshot == null ? void 0 : snapshot.mode) ?? this._mode.value);
54295
+ previewStore.headerHeight = options.headerHeight ?? (snapshot == null ? void 0 : snapshot.headerHeight) ?? previewStore.headerHeight;
54296
+ previewStore.footerHeight = options.footerHeight ?? (snapshot == null ? void 0 : snapshot.footerHeight) ?? previewStore.footerHeight;
54297
+ previewStore.showHeaderLine = options.showHeaderLine ?? (snapshot == null ? void 0 : snapshot.showHeaderLine) ?? previewStore.showHeaderLine;
54298
+ previewStore.showFooterLine = options.showFooterLine ?? (snapshot == null ? void 0 : snapshot.showFooterLine) ?? previewStore.showFooterLine;
54299
+ previewStore.pageSpacingY = options.pageSpacingY ?? (snapshot == null ? void 0 : snapshot.pageSpacingY) ?? previewStore.pageSpacingY;
54300
+ previewStore.regenerateFieldTree();
54301
+ }
54234
54302
  setPreviewMode(options) {
54235
54303
  var _a2;
54236
- if (this.designerStore) {
54304
+ if (!this._previewMode.value && this.designerStore) {
54237
54305
  this._designerStateSnapshot = {
54306
+ mode: this.designerStore.mode,
54238
54307
  pages: lodashExports.cloneDeep(this.designerStore.pages),
54239
54308
  canvasSize: lodashExports.cloneDeep(this.designerStore.canvasSize),
54240
54309
  canvasBackground: this.designerStore.canvasBackground,
54241
54310
  testData: lodashExports.cloneDeep(this.designerStore.testData || {}),
54242
54311
  variables: lodashExports.cloneDeep(this.designerStore.variables || {}),
54243
54312
  watermark: lodashExports.cloneDeep(this.designerStore.watermark),
54313
+ headerHeight: this.designerStore.headerHeight,
54314
+ footerHeight: this.designerStore.footerHeight,
54315
+ showHeaderLine: this.designerStore.showHeaderLine,
54316
+ showFooterLine: this.designerStore.showFooterLine,
54317
+ pageSpacingY: this.designerStore.pageSpacingY,
54244
54318
  currentTemplateId: (_a2 = this.templateStore) == null ? void 0 : _a2.currentTemplateId
54245
54319
  };
54246
54320
  }
@@ -54257,37 +54331,33 @@ class PrintDesignerElement extends HTMLElement {
54257
54331
  }
54258
54332
  const pinia = createPinia();
54259
54333
  setActivePinia(pinia);
54334
+ const previewI18n = createI18nInstance(this.getAttribute("lang") || void 0);
54335
+ this.i18n = previewI18n;
54336
+ const previewPageProps = this.getPreviewPageProps(options);
54260
54337
  const app = createApp({
54261
54338
  setup: () => {
54262
- return () => h(PreviewPage, {
54263
- autoRender: true,
54264
- pages: options.pages,
54265
- canvasSize: options.canvasSize,
54266
- canvasBackground: options.canvasBackground,
54267
- testData: options.testData,
54268
- variables: options.variables,
54269
- watermark: options.watermark,
54270
- autoRenderTrigger: 1
54271
- });
54339
+ return () => h(PreviewPage, previewPageProps);
54272
54340
  }
54273
54341
  });
54274
54342
  app.use(pinia);
54343
+ app.use(previewI18n);
54275
54344
  if (app.config) {
54276
54345
  app.config.errorHandler = (err) => {
54277
54346
  this.dispatchEvent(new CustomEvent("error", { detail: { scope: "render", error: err } }));
54278
54347
  };
54279
54348
  }
54280
- const previewStore = useDesignerStore(pinia);
54281
- if (options.testData) previewStore.testData = options.testData;
54282
- if (options.variables) previewStore.variables = options.variables;
54283
- if (options.canvasSize) previewStore.canvasSize = options.canvasSize;
54349
+ this.syncPreviewStore(pinia, options);
54284
54350
  app.mount(this.mountEl);
54285
54351
  this.app = app;
54286
54352
  }
54287
54353
  }
54288
54354
  exitPreviewMode() {
54355
+ var _a2;
54289
54356
  this._previewMode.value = false;
54290
54357
  this._previewData.value = null;
54358
+ if ((_a2 = this._designerStateSnapshot) == null ? void 0 : _a2.mode) {
54359
+ this._mode.value = this._designerStateSnapshot.mode;
54360
+ }
54291
54361
  if (this.app) {
54292
54362
  this.app.unmount();
54293
54363
  const shadow = this.shadowRoot || this.attachShadow({ mode: "open" });
@@ -54300,6 +54370,7 @@ class PrintDesignerElement extends HTMLElement {
54300
54370
  const pinia = createPinia();
54301
54371
  setActivePinia(pinia);
54302
54372
  const i18n2 = createI18nInstance(this.getAttribute("lang") || void 0);
54373
+ this.i18n = i18n2;
54303
54374
  const app = createApp({
54304
54375
  setup: () => {
54305
54376
  return () => h(_sfc_main$1, { headless: this._headless.value, mode: this._mode.value, viewMode: this._viewMode.value, onSave: this._onSave.value ?? void 0, autoSaveEnabled: this._autoSaveEnabled.value, autoSaveIntervalMs: this._autoSaveIntervalMs.value, fieldDictionary: this._fieldDictionary.value });
@@ -54330,8 +54401,14 @@ class PrintDesignerElement extends HTMLElement {
54330
54401
  canvasBackground: snap.canvasBackground,
54331
54402
  testData: snap.testData,
54332
54403
  variables: snap.variables,
54333
- watermark: snap.watermark
54404
+ watermark: snap.watermark,
54405
+ headerHeight: snap.headerHeight,
54406
+ footerHeight: snap.footerHeight,
54407
+ showHeaderLine: snap.showHeaderLine,
54408
+ showFooterLine: snap.showFooterLine,
54409
+ pageSpacingY: snap.pageSpacingY
54334
54410
  });
54411
+ this.designerStore.setMode(snap.mode ?? this._mode.value);
54335
54412
  if (snap.currentTemplateId && this.templateStore) {
54336
54413
  this.templateStore.currentTemplateId = snap.currentTemplateId;
54337
54414
  }
@@ -54344,7 +54421,7 @@ class PrintDesignerElement extends HTMLElement {
54344
54421
  if (this.i18n) {
54345
54422
  this.i18n.global.locale.value = lang;
54346
54423
  }
54347
- localStorage.setItem("print-designer-language", lang);
54424
+ writeStorage("print-designer-language", lang);
54348
54425
  }
54349
54426
  }
54350
54427
  syncMonacoStyles() {
@@ -54409,16 +54486,8 @@ class PrintDesignerElement extends HTMLElement {
54409
54486
  const app = createApp({
54410
54487
  setup: () => {
54411
54488
  if (isPreview && previewData) {
54412
- return () => h(PreviewPage, {
54413
- autoRender: true,
54414
- pages: previewData.pages,
54415
- canvasSize: previewData.canvasSize,
54416
- canvasBackground: previewData.canvasBackground,
54417
- testData: previewData.testData,
54418
- variables: previewData.variables,
54419
- watermark: previewData.watermark,
54420
- autoRenderTrigger: 1
54421
- });
54489
+ const previewPageProps = this.getPreviewPageProps(previewData);
54490
+ return () => h(PreviewPage, previewPageProps);
54422
54491
  }
54423
54492
  return () => h(_sfc_main$1, { headless: this._headless.value, mode: this._mode.value, viewMode: this._viewMode.value, onSave: this._onSave.value ?? void 0, autoSaveEnabled: this._autoSaveEnabled.value, autoSaveIntervalMs: this._autoSaveIntervalMs.value, fieldDictionary: this._fieldDictionary.value });
54424
54493
  }
@@ -54441,6 +54510,9 @@ class PrintDesignerElement extends HTMLElement {
54441
54510
  if (storedDesignerFont) {
54442
54511
  this.mountEl.style.fontFamily = storedDesignerFont;
54443
54512
  }
54513
+ if (isPreview && previewData) {
54514
+ this.syncPreviewStore(pinia, previewData);
54515
+ }
54444
54516
  app.mount(this.mountEl);
54445
54517
  this.printApi = usePrint();
54446
54518
  this.printSettings = usePrintSettings();
@@ -54561,7 +54633,7 @@ class PrintDesignerElement extends HTMLElement {
54561
54633
  root.style.setProperty(key, value);
54562
54634
  });
54563
54635
  if (options.persist !== false) {
54564
- localStorage.setItem("print-designer-brand-vars", JSON.stringify(vars));
54636
+ writeStorage("print-designer-brand-vars", JSON.stringify(vars));
54565
54637
  }
54566
54638
  }
54567
54639
  setTheme(theme2) {
@@ -54578,9 +54650,9 @@ class PrintDesignerElement extends HTMLElement {
54578
54650
  }
54579
54651
  if (options.persist !== false) {
54580
54652
  if (normalized) {
54581
- localStorage.setItem(designerFontStorageKey, normalized);
54653
+ writeStorage(designerFontStorageKey, normalized);
54582
54654
  } else {
54583
- localStorage.removeItem(designerFontStorageKey);
54655
+ removeStorage(designerFontStorageKey);
54584
54656
  }
54585
54657
  }
54586
54658
  }
@@ -55202,12 +55274,14 @@ const checkCompatibility = () => {
55202
55274
  if (!("contentDocument" in document.createElement("iframe"))) issues.push("iframe isolation not supported");
55203
55275
  return issues;
55204
55276
  };
55205
- const compatIssues = checkCompatibility();
55206
- if (compatIssues.length > 0) {
55207
- console.warn("[PrintDesigner] Browser compatibility issues:", compatIssues.join(", "));
55208
- }
55209
- if (!customElements.get(elementName)) {
55210
- customElements.define(elementName, PrintDesignerElement);
55277
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
55278
+ const compatIssues = checkCompatibility();
55279
+ if (compatIssues.length > 0) {
55280
+ console.warn("[PrintDesigner] Browser compatibility issues:", compatIssues.join(", "));
55281
+ }
55282
+ if (typeof customElements !== "undefined" && !customElements.get(elementName)) {
55283
+ customElements.define(elementName, PrintDesignerElement);
55284
+ }
55211
55285
  }
55212
55286
  export {
55213
55287
  PrintDesignerElement,
@@ -1,4 +1,4 @@
1
- import { commonjsGlobal, getDefaultExportFromCjs } from "./web-component-DTlUr7qT.js";
1
+ import { commonjsGlobal, getDefaultExportFromCjs } from "./index-sx0m_xBC.js";
2
2
  import { _typeof as _typeof$1 } from "./typeof-DxTVrAEz.js";
3
3
  var es_promise = {};
4
4
  var es_promise_constructor = {};
@@ -10832,7 +10832,7 @@ function le() {
10832
10832
  var h2 = l2.getContext("2d");
10833
10833
  h2.fillStyle = "#fff", h2.fillRect(0, 0, l2.width, l2.height);
10834
10834
  var f2 = { ignoreMouse: true, ignoreAnimation: true, ignoreDimensions: true }, d2 = this;
10835
- return (i.canvg ? Promise.resolve(i.canvg) : import("./index.es-bGPC2lWY.js")).catch(function(t3) {
10835
+ return (i.canvg ? Promise.resolve(i.canvg) : import("./index.es-CJVAF11T.js")).catch(function(t3) {
10836
10836
  return Promise.reject(new Error("Could not load canvg: " + t3));
10837
10837
  }).then(function(t3) {
10838
10838
  return t3.default ? t3.default : t3;
@@ -1,4 +1,4 @@
1
- import { commonjsGlobal, getDefaultExportFromCjs } from "./web-component-DTlUr7qT.js";
1
+ import { commonjsGlobal, getDefaultExportFromCjs } from "./index-sx0m_xBC.js";
2
2
  function _mergeNamespaces(n, m) {
3
3
  for (var i = 0; i < m.length; i++) {
4
4
  const e = m[i];
@@ -1,4 +1,4 @@
1
- import { PrintDesignerElement } from "./web-component-DTlUr7qT.js";
1
+ import { PrintDesignerElement } from "./index-sx0m_xBC.js";
2
2
  export {
3
3
  PrintDesignerElement
4
4
  };