@harbour-enterprises/superdoc 0.27.0-next.2 → 0.27.0-next.4

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 (25) hide show
  1. package/dist/chunks/{PdfViewer-BYzQ-Z8r.es.js → PdfViewer-BH326izt.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CaR2rmuW.cjs → PdfViewer-CsMYG9jY.cjs} +1 -1
  3. package/dist/chunks/{index-DATrA3lt.es.js → index-D4gqW11N.es.js} +2 -2
  4. package/dist/chunks/{index-EIErxDyE.cjs → index-DlKmbda5.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-DXEbSokY.cjs → super-editor.es-BOSseISU.cjs} +50 -20
  6. package/dist/chunks/{super-editor.es-DtgJu0CH.es.js → super-editor.es-IuxTXi0S.es.js} +50 -20
  7. package/dist/super-editor/ai-writer.es.js +2 -2
  8. package/dist/super-editor/chunks/{converter-BupPKWvT.js → converter-DW0ykKpx.js} +37 -15
  9. package/dist/super-editor/chunks/{docx-zipper-B_zB1qvo.js → docx-zipper-eWjTV-8Q.js} +1 -1
  10. package/dist/super-editor/chunks/{editor-ByRd7RN8.js → editor-CUz7q8Xz.js} +15 -7
  11. package/dist/super-editor/chunks/{toolbar-BOxA8SfG.js → toolbar-DglPzsaY.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.es.js +6 -6
  18. package/dist/super-editor/toolbar.es.js +2 -2
  19. package/dist/super-editor.cjs +1 -1
  20. package/dist/super-editor.es.js +1 -1
  21. package/dist/superdoc.cjs +2 -2
  22. package/dist/superdoc.es.js +2 -2
  23. package/dist/superdoc.umd.js +50 -20
  24. package/dist/superdoc.umd.js.map +1 -1
  25. 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, _isHeadless) => {
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) => {
@@ -36611,9 +36633,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36611
36633
  newG = g * percent2;
36612
36634
  newB = b2 * percent2;
36613
36635
  } else if (modifier === "tint") {
36614
- newR = r2 + (255 - r2) * (1 - percent2);
36615
- newG = g + (255 - g) * (1 - percent2);
36616
- newB = b2 + (255 - b2) * (1 - percent2);
36636
+ newR = r2 + (255 - r2) * percent2;
36637
+ newG = g + (255 - g) * percent2;
36638
+ newB = b2 + (255 - b2) * percent2;
36617
36639
  } else if (modifier === "lumOff") {
36618
36640
  const offset2 = 255 * percent2;
36619
36641
  newR = r2 + offset2;
@@ -37371,11 +37393,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37371
37393
  attributes: { Requires: "wps" },
37372
37394
  elements: [drawing]
37373
37395
  };
37374
- const result = {
37396
+ const alternateContent = {
37375
37397
  name: "mc:AlternateContent",
37376
37398
  elements: [choice]
37377
37399
  };
37378
- return result;
37400
+ return wrapTextInRun(alternateContent);
37379
37401
  }
37380
37402
  function translateAnchorNode(params2) {
37381
37403
  const { attrs } = params2.node;
@@ -67268,7 +67290,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67268
67290
  if (!decorations) {
67269
67291
  decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
67270
67292
  }
67271
- if (!tr.docChanged) {
67293
+ if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
67272
67294
  return { decorations };
67273
67295
  }
67274
67296
  decorations = decorations.map(tr.mapping, tr.doc);
@@ -74633,13 +74655,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74633
74655
  return [
74634
74656
  new Plugin({
74635
74657
  key: BlockNodePluginKey,
74636
- appendTransaction: (transactions, _oldState, newState) => {
74637
- if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
74638
- if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
74658
+ appendTransaction: (transactions, oldState, newState) => {
74659
+ let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
74660
+ if (hasInitialized && !docChanges) {
74661
+ return;
74662
+ }
74663
+ if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) {
74664
+ return;
74665
+ }
74639
74666
  const { tr } = newState;
74640
74667
  let changed = false;
74641
74668
  newState.doc.descendants((node, pos) => {
74642
- if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) return null;
74669
+ if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) {
74670
+ return;
74671
+ }
74643
74672
  tr.setNodeMarkup(
74644
74673
  pos,
74645
74674
  void 0,
@@ -74653,6 +74682,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74653
74682
  });
74654
74683
  if (changed && !hasInitialized) {
74655
74684
  hasInitialized = true;
74685
+ tr.setMeta("blockNodeInitialUpdate", true);
74656
74686
  }
74657
74687
  tr.setStoredMarks(newState.tr.storedMarks);
74658
74688
  return changed ? tr : null;