@harbour-enterprises/superdoc 0.27.0-next.3 → 0.27.0

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.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-C7U0afIq.cjs → PdfViewer-Bn22y6ec.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CymzL6pA.es.js → PdfViewer-D-KVtp3c.es.js} +1 -1
  3. package/dist/chunks/{index-FmOItkm6.cjs → index-C3orQzQX.cjs} +2 -2
  4. package/dist/chunks/{index-CCotbgzR.es.js → index-xI8uWu34.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-DiNNVR7Q.es.js → super-editor.es-CsIBkkoq.es.js} +37 -15
  6. package/dist/chunks/{super-editor.es-C4b8Qz1U.cjs → super-editor.es-DYXjHRhh.cjs} +37 -15
  7. package/dist/super-editor/ai-writer.es.js +2 -2
  8. package/dist/super-editor/chunks/{converter-Bnmt0bNT.js → converter-806EiX64.js} +34 -12
  9. package/dist/super-editor/chunks/{docx-zipper-B1_YD3fF.js → docx-zipper-BKv1T53G.js} +1 -1
  10. package/dist/super-editor/chunks/{editor-BHtGMc-u.js → editor-ClQoPr_d.js} +5 -5
  11. package/dist/super-editor/chunks/{toolbar-Cgj3meLH.js → toolbar-Be9BTeNN.js} +2 -2
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/docx-zipper.es.js +2 -2
  14. package/dist/super-editor/editor.es.js +3 -3
  15. package/dist/super-editor/file-zipper.es.js +1 -1
  16. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +1 -1
  17. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts +1 -3
  18. package/dist/super-editor/super-editor/src/extensions/vector-shape/VectorShapeView.d.ts +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +37 -15
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -22972,17 +22972,39 @@
22972
22972
  const exportValue = functionsMap[unit] ? functionsMap[unit](value) : pixelsToTwips(value);
22973
22973
  return exportValue;
22974
22974
  };
22975
- const getArrayBufferFromUrl = async (input, isHeadless) => {
22976
- const isLikelyUrl = /^https?:|^blob:|^file:|^data:/i.test(input);
22977
- if (isHeadless && isLikelyUrl && typeof fetch === "function") {
22978
- const res = await fetch(input);
22979
- if (!res.ok) throw new Error(`Fetch failed: ${res.status} ${res.statusText}`);
22980
- return await res.arrayBuffer();
22981
- }
22982
- const base64 = input.includes(",") ? input.split(",", 2)[1] : input.trim().replace(/\s/g, "");
22975
+ const REMOTE_RESOURCE_PATTERN = /^https?:|^blob:|^file:/i;
22976
+ const DATA_URI_PATTERN = /^data:/i;
22977
+ const getArrayBufferFromUrl = async (input) => {
22978
+ if (input == null) {
22979
+ return new ArrayBuffer(0);
22980
+ }
22981
+ if (input instanceof ArrayBuffer) {
22982
+ return input;
22983
+ }
22984
+ if (ArrayBuffer.isView(input)) {
22985
+ const view = input;
22986
+ return view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
22987
+ }
22988
+ if (typeof input !== "string") {
22989
+ throw new TypeError("Unsupported media input type");
22990
+ }
22991
+ const trimmed = input.trim();
22992
+ const shouldFetchRemote = REMOTE_RESOURCE_PATTERN.test(trimmed);
22993
+ const isDataUri = DATA_URI_PATTERN.test(trimmed);
22994
+ if (shouldFetchRemote) {
22995
+ if (typeof fetch !== "function") {
22996
+ throw new Error(`Fetch API is not available to retrieve media: ${trimmed}`);
22997
+ }
22998
+ const response = await fetch(trimmed);
22999
+ if (!response.ok) {
23000
+ throw new Error(`Fetch failed: ${response.status} ${response.statusText}`);
23001
+ }
23002
+ return await response.arrayBuffer();
23003
+ }
23004
+ const base64Payload = isDataUri ? trimmed.split(",", 2)[1] : trimmed.replace(/\s/g, "");
22983
23005
  try {
22984
23006
  if (typeof globalThis.atob === "function") {
22985
- const binary = globalThis.atob(base64);
23007
+ const binary = globalThis.atob(base64Payload);
22986
23008
  const bytes = new Uint8Array(binary.length);
22987
23009
  for (let i2 = 0; i2 < binary.length; i2++) {
22988
23010
  bytes[i2] = binary.charCodeAt(i2);
@@ -22992,7 +23014,7 @@
22992
23014
  } catch (err) {
22993
23015
  console.warn("atob failed, falling back to Buffer:", err);
22994
23016
  }
22995
- const buf = Buffer2.from(base64, "base64");
23017
+ const buf = Buffer2.from(base64Payload, "base64");
22996
23018
  return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
22997
23019
  };
22998
23020
  const getContentTypesFromXml = (contentTypesXml) => {
@@ -36948,7 +36970,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36948
36970
  return getRectangleShape(params2, spPr);
36949
36971
  }
36950
36972
  if (shapeType && !textBoxContent) {
36951
- const result = getVectorShape({ params: params2, node, graphicData });
36973
+ const result = getVectorShape({ params: params2, graphicData });
36952
36974
  if (result) return result;
36953
36975
  }
36954
36976
  if (!textBoxContent) {
@@ -37029,7 +37051,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37029
37051
  attrs
37030
37052
  };
37031
37053
  };
37032
- function getVectorShape({ params: params2, node, graphicData }) {
37054
+ function getVectorShape({ params: params2, graphicData }) {
37033
37055
  const schemaAttrs = {};
37034
37056
  const drawingNode = params2.nodes?.[0];
37035
37057
  if (drawingNode?.name === "w:drawing") {
@@ -76843,9 +76865,9 @@ ${l}
76843
76865
  this.editor = props.editor;
76844
76866
  this.extension = props.extension;
76845
76867
  this.htmlAttributes = props.htmlAttributes;
76846
- this.mount(props);
76868
+ this.mount();
76847
76869
  }
76848
- mount(props) {
76870
+ mount() {
76849
76871
  this.buildView();
76850
76872
  }
76851
76873
  get dom() {
@@ -76900,7 +76922,7 @@ ${l}
76900
76922
  strokeWidth: strokeWidth || 0
76901
76923
  }
76902
76924
  });
76903
- } catch (error) {
76925
+ } catch {
76904
76926
  return null;
76905
76927
  }
76906
76928
  }