superdoc 1.15.0-next.1 → 1.15.0-next.3

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 (23) hide show
  1. package/dist/chunks/{SuperConverter-0JXEABCU.es.js → SuperConverter-DBiUGLo-.es.js} +246 -76
  2. package/dist/chunks/{SuperConverter-D4bnFDP0.cjs → SuperConverter-XD7hP7T-.cjs} +246 -76
  3. package/dist/chunks/{src-C4usUjkO.cjs → src-13FP8ddK.cjs} +315 -49
  4. package/dist/chunks/{src-CF15O-H9.es.js → src-C_wxBbkT.es.js} +315 -49
  5. package/dist/style.css +22 -22
  6. package/dist/super-editor/converter.cjs +1 -1
  7. package/dist/super-editor/converter.es.js +1 -1
  8. package/dist/super-editor/src/components/SuperEditor.vue.d.ts.map +1 -1
  9. package/dist/super-editor/src/core/presentation-editor/pointer-events/EditorInputManager.d.ts.map +1 -1
  10. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts.map +1 -1
  11. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
  12. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/vector-shape-helpers.d.ts +9 -0
  13. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/vector-shape-helpers.d.ts.map +1 -1
  14. package/dist/super-editor/src/extensions/image/image.d.ts.map +1 -1
  15. package/dist/super-editor/src/extensions/types/node-attributes.d.ts +2 -0
  16. package/dist/super-editor/src/extensions/types/node-attributes.d.ts.map +1 -1
  17. package/dist/super-editor.cjs +2 -2
  18. package/dist/super-editor.es.js +2 -2
  19. package/dist/superdoc.cjs +3 -3
  20. package/dist/superdoc.es.js +3 -3
  21. package/dist/superdoc.umd.js +561 -125
  22. package/dist/superdoc.umd.js.map +1 -1
  23. package/package.json +1 -1
@@ -10728,6 +10728,182 @@ var PluginKey = class {
10728
10728
  return state[this.key];
10729
10729
  }
10730
10730
  };
10731
+ function getPresetColor(name) {
10732
+ return {
10733
+ aliceBlue: "#f0f8ff",
10734
+ antiqueWhite: "#faebd7",
10735
+ aqua: "#00ffff",
10736
+ aquamarine: "#7fffd4",
10737
+ azure: "#f0ffff",
10738
+ beige: "#f5f5dc",
10739
+ bisque: "#ffe4c4",
10740
+ black: "#000000",
10741
+ blanchedAlmond: "#ffebcd",
10742
+ blue: "#0000ff",
10743
+ blueViolet: "#8a2be2",
10744
+ brown: "#a52a2a",
10745
+ burlyWood: "#deb887",
10746
+ cadetBlue: "#5f9ea0",
10747
+ chartreuse: "#7fff00",
10748
+ chocolate: "#d2691e",
10749
+ coral: "#ff7f50",
10750
+ cornflowerBlue: "#6495ed",
10751
+ cornsilk: "#fff8dc",
10752
+ crimson: "#dc143c",
10753
+ cyan: "#00ffff",
10754
+ dkBlue: "#00008b",
10755
+ dkCyan: "#008b8b",
10756
+ dkGoldenrod: "#b8860b",
10757
+ dkGray: "#a9a9a9",
10758
+ dkGreen: "#006400",
10759
+ dkKhaki: "#bdb76b",
10760
+ dkMagenta: "#8b008b",
10761
+ dkOliveGreen: "#556b2f",
10762
+ dkOrange: "#ff8c00",
10763
+ dkOrchid: "#9932cc",
10764
+ dkRed: "#8b0000",
10765
+ dkSalmon: "#e9967a",
10766
+ dkSeaGreen: "#8fbc8f",
10767
+ dkSlateBlue: "#483d8b",
10768
+ dkSlateGray: "#2f4f4f",
10769
+ dkTurquoise: "#00ced1",
10770
+ dkViolet: "#9400d3",
10771
+ deepPink: "#ff1493",
10772
+ deepSkyBlue: "#00bfff",
10773
+ dimGray: "#696969",
10774
+ dodgerBlue: "#1e90ff",
10775
+ firebrick: "#b22222",
10776
+ floralWhite: "#fffaf0",
10777
+ forestGreen: "#228b22",
10778
+ fuchsia: "#ff00ff",
10779
+ gainsboro: "#dcdcdc",
10780
+ ghostWhite: "#f8f8ff",
10781
+ gold: "#ffd700",
10782
+ goldenrod: "#daa520",
10783
+ gray: "#808080",
10784
+ green: "#008000",
10785
+ greenYellow: "#adff2f",
10786
+ honeydew: "#f0fff0",
10787
+ hotPink: "#ff69b4",
10788
+ indianRed: "#cd5c5c",
10789
+ indigo: "#4b0082",
10790
+ ivory: "#fffff0",
10791
+ khaki: "#f0e68c",
10792
+ lavender: "#e6e6fa",
10793
+ lavenderBlush: "#fff0f5",
10794
+ lawnGreen: "#7cfc00",
10795
+ lemonChiffon: "#fffacd",
10796
+ ltBlue: "#add8e6",
10797
+ ltCoral: "#f08080",
10798
+ ltCyan: "#e0ffff",
10799
+ ltGoldenrodYellow: "#fafad2",
10800
+ ltGray: "#d3d3d3",
10801
+ ltGreen: "#90ee90",
10802
+ ltPink: "#ffb6c1",
10803
+ ltSalmon: "#ffa07a",
10804
+ ltSeaGreen: "#20b2aa",
10805
+ ltSkyBlue: "#87cefa",
10806
+ ltSlateGray: "#778899",
10807
+ ltSteelBlue: "#b0c4de",
10808
+ ltYellow: "#ffffe0",
10809
+ lime: "#00ff00",
10810
+ limeGreen: "#32cd32",
10811
+ linen: "#faf0e6",
10812
+ magenta: "#ff00ff",
10813
+ maroon: "#800000",
10814
+ medAquamarine: "#66cdaa",
10815
+ medBlue: "#0000cd",
10816
+ medOrchid: "#ba55d3",
10817
+ medPurple: "#9370db",
10818
+ medSeaGreen: "#3cb371",
10819
+ medSlateBlue: "#7b68ee",
10820
+ medSpringGreen: "#00fa9a",
10821
+ medTurquoise: "#48d1cc",
10822
+ medVioletRed: "#c71585",
10823
+ midnightBlue: "#191970",
10824
+ mintCream: "#f5fffa",
10825
+ mistyRose: "#ffe4e1",
10826
+ moccasin: "#ffe4b5",
10827
+ navajoWhite: "#ffdead",
10828
+ navy: "#000080",
10829
+ oldLace: "#fdf5e6",
10830
+ olive: "#808000",
10831
+ oliveDrab: "#6b8e23",
10832
+ orange: "#ffa500",
10833
+ orangeRed: "#ff4500",
10834
+ orchid: "#da70d6",
10835
+ paleGoldenrod: "#eee8aa",
10836
+ paleGreen: "#98fb98",
10837
+ paleTurquoise: "#afeeee",
10838
+ paleVioletRed: "#db7093",
10839
+ papayaWhip: "#ffefd5",
10840
+ peachPuff: "#ffdab9",
10841
+ peru: "#cd853f",
10842
+ pink: "#ffc0cb",
10843
+ plum: "#dda0dd",
10844
+ powderBlue: "#b0e0e6",
10845
+ purple: "#800080",
10846
+ red: "#ff0000",
10847
+ rosyBrown: "#bc8f8f",
10848
+ royalBlue: "#4169e1",
10849
+ saddleBrown: "#8b4513",
10850
+ salmon: "#fa8072",
10851
+ sandyBrown: "#f4a460",
10852
+ seaGreen: "#2e8b57",
10853
+ seaShell: "#fff5ee",
10854
+ sienna: "#a0522d",
10855
+ silver: "#c0c0c0",
10856
+ skyBlue: "#87ceeb",
10857
+ slateBlue: "#6a5acd",
10858
+ slateGray: "#708090",
10859
+ snow: "#fffafa",
10860
+ springGreen: "#00ff7f",
10861
+ steelBlue: "#4682b4",
10862
+ tan: "#d2b48c",
10863
+ teal: "#008080",
10864
+ thistle: "#d8bfd8",
10865
+ tomato: "#ff6347",
10866
+ turquoise: "#40e0d0",
10867
+ violet: "#ee82ee",
10868
+ wheat: "#f5deb3",
10869
+ white: "#ffffff",
10870
+ whiteSmoke: "#f5f5f5",
10871
+ yellow: "#ffff00",
10872
+ yellowGreen: "#9acd32"
10873
+ }[name] ?? null;
10874
+ }
10875
+ function applyModifiersAndAlpha(color, elements) {
10876
+ let alpha = null;
10877
+ (elements || []).forEach((mod) => {
10878
+ if (mod.name === "a:shade") color = applyColorModifier(color, "shade", mod.attributes["val"]);
10879
+ else if (mod.name === "a:tint") color = applyColorModifier(color, "tint", mod.attributes["val"]);
10880
+ else if (mod.name === "a:lumMod") color = applyColorModifier(color, "lumMod", mod.attributes["val"]);
10881
+ else if (mod.name === "a:lumOff") color = applyColorModifier(color, "lumOff", mod.attributes["val"]);
10882
+ else if (mod.name === "a:alpha") alpha = parseInt(mod.attributes["val"]) / 1e5;
10883
+ });
10884
+ return {
10885
+ color,
10886
+ alpha
10887
+ };
10888
+ }
10889
+ function extractColorFromElement(element) {
10890
+ if (!element?.elements) return null;
10891
+ const schemeClr = element.elements.find((el) => el.name === "a:schemeClr");
10892
+ if (schemeClr) {
10893
+ const themeName = schemeClr.attributes?.["val"];
10894
+ return applyModifiersAndAlpha(getThemeColor(themeName), schemeClr.elements);
10895
+ }
10896
+ const srgbClr = element.elements.find((el) => el.name === "a:srgbClr");
10897
+ if (srgbClr) return applyModifiersAndAlpha("#" + srgbClr.attributes?.["val"], srgbClr.elements);
10898
+ const prstClr = element.elements.find((el) => el.name === "a:prstClr");
10899
+ if (prstClr) {
10900
+ const presetName = prstClr.attributes?.["val"];
10901
+ const baseColor = getPresetColor(presetName);
10902
+ if (!baseColor) return null;
10903
+ return applyModifiersAndAlpha(baseColor, prstClr.elements);
10904
+ }
10905
+ return null;
10906
+ }
10731
10907
  function getThemeColor(name) {
10732
10908
  return {
10733
10909
  accent1: "#5b9bd5",
@@ -10776,9 +10952,13 @@ function applyColorModifier(hexColor, modifier, value) {
10776
10952
  return `#${toHex(newR)}${toHex(newG)}${toHex(newB)}`;
10777
10953
  }
10778
10954
  function extractStrokeWidth(spPr) {
10779
- const w$1 = (spPr?.elements?.find((el) => el.name === "a:ln"))?.attributes?.["w"];
10780
- if (!w$1) return 1;
10781
- return (typeof w$1 === "string" ? parseFloat(w$1) : w$1) * 72 / 914400;
10955
+ const ln = spPr?.elements?.find((el) => el.name === "a:ln");
10956
+ if (!ln) return 1;
10957
+ const w$1 = ln.attributes?.["w"];
10958
+ if (w$1 == null) return 1;
10959
+ const emu = typeof w$1 === "string" ? parseFloat(w$1) : w$1;
10960
+ if (emu === 0) return .75;
10961
+ return emu * 72 / 914400;
10782
10962
  }
10783
10963
  function extractLineEnds(spPr) {
10784
10964
  const ln = spPr?.elements?.find((el) => el.name === "a:ln");
@@ -10808,72 +10988,30 @@ function extractStrokeColor(spPr, style) {
10808
10988
  if (ln.elements?.find((el) => el.name === "a:noFill")) return null;
10809
10989
  const solidFill = ln.elements?.find((el) => el.name === "a:solidFill");
10810
10990
  if (solidFill) {
10811
- const schemeClr$1 = solidFill.elements?.find((el) => el.name === "a:schemeClr");
10812
- if (schemeClr$1) {
10813
- const themeName$1 = schemeClr$1.attributes?.["val"];
10814
- let color$1 = getThemeColor(themeName$1);
10815
- (schemeClr$1.elements || []).forEach((mod) => {
10816
- if (mod.name === "a:shade") color$1 = applyColorModifier(color$1, "shade", mod.attributes["val"]);
10817
- else if (mod.name === "a:tint") color$1 = applyColorModifier(color$1, "tint", mod.attributes["val"]);
10818
- else if (mod.name === "a:lumMod") color$1 = applyColorModifier(color$1, "lumMod", mod.attributes["val"]);
10819
- });
10820
- return color$1;
10821
- }
10822
- const srgbClr = solidFill.elements?.find((el) => el.name === "a:srgbClr");
10823
- if (srgbClr) return "#" + srgbClr.attributes?.["val"];
10991
+ const result = extractColorFromElement(solidFill);
10992
+ if (result) return result.color;
10824
10993
  }
10825
10994
  }
10826
10995
  if (!style) return null;
10827
10996
  const lnRef = style.elements?.find((el) => el.name === "a:lnRef");
10828
10997
  if (!lnRef) return null;
10829
10998
  if (lnRef.attributes?.["idx"] === "0") return null;
10830
- const schemeClr = lnRef.elements?.find((el) => el.name === "a:schemeClr");
10831
- if (!schemeClr) return null;
10832
- const themeName = schemeClr.attributes?.["val"];
10833
- let color = getThemeColor(themeName);
10834
- (schemeClr.elements || []).forEach((mod) => {
10835
- if (mod.name === "a:shade") color = applyColorModifier(color, "shade", mod.attributes["val"]);
10836
- else if (mod.name === "a:tint") color = applyColorModifier(color, "tint", mod.attributes["val"]);
10837
- else if (mod.name === "a:lumMod") color = applyColorModifier(color, "lumMod", mod.attributes["val"]);
10838
- else if (mod.name === "a:lumOff") color = applyColorModifier(color, "lumOff", mod.attributes["val"]);
10839
- });
10840
- return color;
10999
+ const lnRefResult = extractColorFromElement(lnRef);
11000
+ if (lnRefResult) return lnRefResult.color;
11001
+ return null;
10841
11002
  }
10842
11003
  function extractFillColor(spPr, style) {
10843
11004
  if (spPr?.elements?.find((el) => el.name === "a:noFill")) return null;
10844
11005
  const solidFill = spPr?.elements?.find((el) => el.name === "a:solidFill");
10845
11006
  if (solidFill) {
10846
- const schemeClr$1 = solidFill.elements?.find((el) => el.name === "a:schemeClr");
10847
- if (schemeClr$1) {
10848
- const themeName$1 = schemeClr$1.attributes?.["val"];
10849
- let color$1 = getThemeColor(themeName$1);
10850
- let alpha = null;
10851
- (schemeClr$1.elements || []).forEach((mod) => {
10852
- if (mod.name === "a:shade") color$1 = applyColorModifier(color$1, "shade", mod.attributes["val"]);
10853
- else if (mod.name === "a:tint") color$1 = applyColorModifier(color$1, "tint", mod.attributes["val"]);
10854
- else if (mod.name === "a:lumMod") color$1 = applyColorModifier(color$1, "lumMod", mod.attributes["val"]);
10855
- else if (mod.name === "a:lumOff") color$1 = applyColorModifier(color$1, "lumOff", mod.attributes["val"]);
10856
- else if (mod.name === "a:alpha") alpha = parseInt(mod.attributes["val"]) / 1e5;
10857
- });
10858
- if (alpha !== null && alpha < 1) return {
10859
- type: "solidWithAlpha",
10860
- color: color$1,
10861
- alpha
10862
- };
10863
- return color$1;
10864
- }
10865
- const srgbClr = solidFill.elements?.find((el) => el.name === "a:srgbClr");
10866
- if (srgbClr) {
10867
- let alpha = null;
10868
- const alphaEl = srgbClr.elements?.find((el) => el.name === "a:alpha");
10869
- if (alphaEl) alpha = parseInt(alphaEl.attributes?.["val"] || "100000", 10) / 1e5;
10870
- const color$1 = "#" + srgbClr.attributes?.["val"];
10871
- if (alpha !== null && alpha < 1) return {
11007
+ const result = extractColorFromElement(solidFill);
11008
+ if (result) {
11009
+ if (result.alpha !== null && result.alpha < 1) return {
10872
11010
  type: "solidWithAlpha",
10873
- color: color$1,
10874
- alpha
11011
+ color: result.color,
11012
+ alpha: result.alpha
10875
11013
  };
10876
- return color$1;
11014
+ return result.color;
10877
11015
  }
10878
11016
  }
10879
11017
  const gradFill = spPr?.elements?.find((el) => el.name === "a:gradFill");
@@ -10883,16 +11021,16 @@ function extractFillColor(spPr, style) {
10883
11021
  const fillRef = style.elements?.find((el) => el.name === "a:fillRef");
10884
11022
  if (!fillRef) return null;
10885
11023
  if (fillRef.attributes?.["idx"] === "0") return null;
10886
- const schemeClr = fillRef.elements?.find((el) => el.name === "a:schemeClr");
10887
- if (!schemeClr) return null;
10888
- const themeName = schemeClr.attributes?.["val"];
10889
- let color = getThemeColor(themeName);
10890
- (schemeClr.elements || []).forEach((mod) => {
10891
- if (mod.name === "a:shade") color = applyColorModifier(color, "shade", mod.attributes["val"]);
10892
- else if (mod.name === "a:tint") color = applyColorModifier(color, "tint", mod.attributes["val"]);
10893
- else if (mod.name === "a:lumMod") color = applyColorModifier(color, "lumMod", mod.attributes["val"]);
10894
- });
10895
- return color;
11024
+ const fillRefResult = extractColorFromElement(fillRef);
11025
+ if (fillRefResult) {
11026
+ if (fillRefResult.alpha !== null && fillRefResult.alpha < 1) return {
11027
+ type: "solidWithAlpha",
11028
+ color: fillRefResult.color,
11029
+ alpha: fillRefResult.alpha
11030
+ };
11031
+ return fillRefResult.color;
11032
+ }
11033
+ return null;
10896
11034
  }
10897
11035
  function extractGradientFill(gradFill) {
10898
11036
  const gradient = {
@@ -16364,6 +16502,29 @@ var extractEffectExtent = (node) => {
16364
16502
  bottom
16365
16503
  };
16366
16504
  };
16505
+ var buildClipPathFromSrcRect = (srcRectAttrs = {}) => {
16506
+ const edges = {
16507
+ left: srcRectAttrs.l,
16508
+ top: srcRectAttrs.t,
16509
+ right: srcRectAttrs.r,
16510
+ bottom: srcRectAttrs.b
16511
+ };
16512
+ let hasValue = false;
16513
+ let hasPositive = false;
16514
+ const percentEdges = {};
16515
+ for (const [edge, value] of Object.entries(edges)) {
16516
+ if (value == null) continue;
16517
+ const numeric = Number(value);
16518
+ if (!Number.isFinite(numeric)) continue;
16519
+ hasValue = true;
16520
+ if (numeric < 0) return null;
16521
+ const percent = Math.max(0, Math.min(100, numeric / 1e3));
16522
+ if (percent > 0) hasPositive = true;
16523
+ percentEdges[edge] = percent;
16524
+ }
16525
+ if (!hasValue || !hasPositive) return null;
16526
+ return `inset(${percentEdges.top ?? 0}% ${percentEdges.right ?? 0}% ${percentEdges.bottom ?? 0}% ${percentEdges.left ?? 0}%)`;
16527
+ };
16367
16528
  function handleImageNode(node, params, isAnchor) {
16368
16529
  if (!node) return null;
16369
16530
  const { docx, filename, converter } = params;
@@ -16483,7 +16644,9 @@ function handleImageNode(node, params, isAnchor) {
16483
16644
  if (!blip) return null;
16484
16645
  const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
16485
16646
  const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
16486
- const srcRectAttrs = (blipFill?.elements?.find((el) => el.name === "a:srcRect"))?.attributes || {};
16647
+ const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
16648
+ const srcRectAttrs = srcRect?.attributes || {};
16649
+ const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
16487
16650
  const srcRectHasNegativeValues = [
16488
16651
  "l",
16489
16652
  "t",
@@ -16493,7 +16656,7 @@ function handleImageNode(node, params, isAnchor) {
16493
16656
  const val = srcRectAttrs[attr];
16494
16657
  return val != null && parseFloat(val) < 0;
16495
16658
  });
16496
- const shouldCover = Boolean(stretch && fillRect) && !srcRectHasNegativeValues;
16659
+ const shouldCover = Boolean(stretch && fillRect) && !srcRectHasNegativeValues && !clipPath;
16497
16660
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
16498
16661
  if (spPr) {
16499
16662
  const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
@@ -16560,6 +16723,8 @@ function handleImageNode(node, params, isAnchor) {
16560
16723
  ...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
16561
16724
  wrapTopAndBottom: wrap$1.type === "TopAndBottom",
16562
16725
  shouldCover,
16726
+ ...clipPath ? { clipPath } : {},
16727
+ rawSrcRect: srcRect,
16563
16728
  originalPadding: {
16564
16729
  distT: attributes["distT"],
16565
16730
  distB: attributes["distB"],
@@ -22266,6 +22431,7 @@ const translateImageNode = (params) => {
22266
22431
  effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
22267
22432
  }
22268
22433
  }
22434
+ const rawSrcRect = attrs.rawSrcRect;
22269
22435
  const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
22270
22436
  const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
22271
22437
  return {
@@ -22330,13 +22496,17 @@ const translateImageNode = (params) => {
22330
22496
  },
22331
22497
  {
22332
22498
  name: "pic:blipFill",
22333
- elements: [{
22334
- name: "a:blip",
22335
- attributes: { "r:embed": imageId }
22336
- }, {
22337
- name: "a:stretch",
22338
- elements: [{ name: "a:fillRect" }]
22339
- }]
22499
+ elements: [
22500
+ {
22501
+ name: "a:blip",
22502
+ attributes: { "r:embed": imageId }
22503
+ },
22504
+ ...rawSrcRect ? [rawSrcRect] : [],
22505
+ {
22506
+ name: "a:stretch",
22507
+ elements: [{ name: "a:fillRect" }]
22508
+ }
22509
+ ]
22340
22510
  },
22341
22511
  {
22342
22512
  name: "pic:spPr",
@@ -33581,7 +33751,7 @@ var SuperConverter = class SuperConverter {
33581
33751
  static getStoredSuperdocVersion(docx) {
33582
33752
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33583
33753
  }
33584
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.1") {
33754
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.3") {
33585
33755
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33586
33756
  }
33587
33757
  static generateWordTimestamp() {