@harbour-enterprises/superdoc 0.6.6 → 0.6.8

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 (34) hide show
  1. package/dist/chunks/{super-editor.es-BL0SUzqA.js → super-editor.es-C2Mpe7zw.js} +371 -223
  2. package/dist/chunks/{super-editor.es-BL0SUzqA.js.map → super-editor.es-C2Mpe7zw.js.map} +1 -1
  3. package/dist/style.css +63 -52
  4. package/dist/super-editor/chunks/{converter-Db6kOZVK.js → converter-D38BagOs.js} +54 -7
  5. package/dist/super-editor/chunks/{converter-Db6kOZVK.js.map → converter-D38BagOs.js.map} +1 -1
  6. package/dist/super-editor/chunks/{docx-zipper-CU9-L2k_.js → docx-zipper-OU0T3wnQ.js} +2 -2
  7. package/dist/super-editor/chunks/{docx-zipper-CU9-L2k_.js.map → docx-zipper-OU0T3wnQ.js.map} +1 -1
  8. package/dist/super-editor/chunks/{editor-DDFPZgN6.js → editor-DFibABN8.js} +5 -5
  9. package/dist/super-editor/chunks/{editor-DDFPZgN6.js.map → editor-DFibABN8.js.map} +1 -1
  10. package/dist/super-editor/chunks/{toolbar-B1D1-QVR.js → toolbar-D5mDT387.js} +12 -6
  11. package/dist/super-editor/chunks/toolbar-D5mDT387.js.map +1 -0
  12. package/dist/super-editor/components/toolbar/color-dropdown-helpers.d.ts +15 -0
  13. package/dist/super-editor/components/toolbar/color-dropdown-helpers.d.ts.map +1 -0
  14. package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
  15. package/dist/super-editor/components/toolbar/super-toolbar.d.ts +1 -0
  16. package/dist/super-editor/components/toolbar/super-toolbar.d.ts.map +1 -1
  17. package/dist/super-editor/components/toolbar/toolbarIcons.d.ts +1 -0
  18. package/dist/super-editor/converter.es.js +1 -1
  19. package/dist/super-editor/core/super-converter/SuperConverter.d.ts +1 -0
  20. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  21. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  22. package/dist/super-editor/core/super-converter/helpers.d.ts +2 -0
  23. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  24. package/dist/super-editor/docx-zipper.es.js +2 -2
  25. package/dist/super-editor/editor.es.js +3 -3
  26. package/dist/super-editor/file-zipper.es.js +1 -1
  27. package/dist/super-editor/style.css +63 -52
  28. package/dist/super-editor/super-editor.es.js +303 -208
  29. package/dist/super-editor/super-editor.es.js.map +1 -1
  30. package/dist/super-editor/toolbar.es.js +2 -2
  31. package/dist/super-editor.es.js +1 -1
  32. package/dist/superdoc.es.js +3 -3
  33. package/package.json +1 -1
  34. package/dist/super-editor/chunks/toolbar-B1D1-QVR.js.map +0 -1
package/dist/style.css CHANGED
@@ -117,36 +117,41 @@
117
117
  box-sizing: border-box;
118
118
  }
119
119
 
120
- .toolbar-icon[data-v-16bc31dc] {
120
+ .toolbar-icon[data-v-fff4aa3f] {
121
121
  display: flex;
122
122
  align-items: center;
123
123
  justify-content: center;
124
124
  flex-shrink: 0;
125
125
  }
126
- .toolbar-icon__icon[data-v-16bc31dc] {
126
+ .toolbar-icon__icon[data-v-fff4aa3f] {
127
127
  display: inline-flex;
128
128
  align-items: center;
129
129
  justify-content: center;
130
130
  flex-shrink: 0;
131
131
  height: 16px;
132
132
  }
133
- .toolbar-icon__icon[data-v-16bc31dc] svg {
133
+ .toolbar-icon__icon--highlight[data-v-fff4aa3f] {
134
+ width: 16px;
135
+ margin-left: 3px;
136
+ margin-bottom: 1px;
137
+ }
138
+ .toolbar-icon__icon[data-v-fff4aa3f] svg {
134
139
  width: auto; /* needed for safari */
135
140
  max-height: 16px;
136
141
  }
137
- .toolbar-icon__icon--color[data-v-16bc31dc] svg {
142
+ .toolbar-icon__icon--color[data-v-fff4aa3f] svg {
138
143
  max-height: 14px;
139
144
  margin-top: -3px;
140
145
  }
141
- .toolbar-button[data-v-16bc31dc]:hover {
146
+ .toolbar-button[data-v-fff4aa3f]:hover {
142
147
  color: black;
143
148
  background-color: #d8dee5;
144
149
  }
145
- .toolbar-button[data-v-16bc31dc]:active,
146
- .active[data-v-16bc31dc] {
150
+ .toolbar-button[data-v-fff4aa3f]:active,
151
+ .active[data-v-fff4aa3f] {
147
152
  background-color: #c8d0d8;
148
153
  }
149
- .color-bar[data-v-16bc31dc] {
154
+ .color-bar[data-v-fff4aa3f] {
150
155
  border-radius: 4px;
151
156
  position: absolute;
152
157
  z-index: 5;
@@ -631,50 +636,6 @@ img.ProseMirror-separator {
631
636
  background-color: #1354FF55;
632
637
  }
633
638
 
634
- .option-grid-ctn[data-v-c5c5fefc] {
635
- display: flex;
636
- flex-direction: column;
637
- padding: 5px;
638
- border-radius: 5px;
639
- background-color: #fff;
640
- z-index: 3;
641
- box-sizing: border-box;
642
- }
643
- .option-grid-ctn[data-v-c5c5fefc] svg {
644
- width: 100%;
645
- height: 100%;
646
- display: block;
647
- fill: currentColor;
648
- }
649
- .option-row[data-v-c5c5fefc] {
650
- display: flex;
651
- flex-direction: row;
652
- }
653
- .option[data-v-c5c5fefc] {
654
- border-radius: 50%;
655
- cursor: pointer;
656
- padding: 3px;
657
- display: flex;
658
- align-items: center;
659
- justify-content: center;
660
- position: relative;
661
- box-sizing: border-box;
662
- }
663
- .option[data-v-c5c5fefc]:hover {
664
- background-color: #dbdbdb;
665
- }
666
- .option__icon[data-v-c5c5fefc] {
667
- width: 20px;
668
- height: 20px;
669
- flex-shrink: 0;
670
- }
671
- .option__check[data-v-c5c5fefc] {
672
- width: 14px;
673
- height: 14px;
674
- flex-shrink: 0;
675
- position: absolute;
676
- }
677
-
678
639
  .alignment-buttons[data-v-d6fae878] {
679
640
  display: flex;
680
641
  justify-content: space-between;
@@ -962,6 +923,56 @@ img.ProseMirror-separator {
962
923
  display: block;
963
924
  fill: currentColor;
964
925
  }
926
+
927
+ .option-row[data-v-6a2a9a40] {
928
+ display: flex;
929
+ flex-direction: row;
930
+ }
931
+ .option[data-v-6a2a9a40] {
932
+ border-radius: 50%;
933
+ cursor: pointer;
934
+ padding: 3px;
935
+ display: flex;
936
+ align-items: center;
937
+ justify-content: center;
938
+ position: relative;
939
+ box-sizing: border-box;
940
+ }
941
+ .option[data-v-6a2a9a40]:hover {
942
+ background-color: #dbdbdb;
943
+ }
944
+ .option__icon[data-v-6a2a9a40] {
945
+ width: 20px;
946
+ height: 20px;
947
+ flex-shrink: 0;
948
+ }
949
+ .option__check[data-v-6a2a9a40] {
950
+ width: 14px;
951
+ height: 14px;
952
+ flex-shrink: 0;
953
+ position: absolute;
954
+ }
955
+
956
+ .option-grid-ctn[data-v-fa2949d8] {
957
+ display: flex;
958
+ flex-direction: column;
959
+ padding: 5px;
960
+ border-radius: 5px;
961
+ background-color: #fff;
962
+ z-index: 3;
963
+ box-sizing: border-box;
964
+ }
965
+ .option-grid-ctn__subtitle[data-v-fa2949d8] {
966
+ padding: 3px;
967
+ font-size: 12px;
968
+ font-weight: 600;
969
+ }
970
+ .option-grid-ctn[data-v-fa2949d8] svg {
971
+ width: 100%;
972
+ height: 100%;
973
+ display: block;
974
+ fill: currentColor;
975
+ }
965
976
  .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
966
977
  .vertical-indicator[data-v-82812cc5] {
967
978
  position: absolute;
@@ -49551,6 +49551,39 @@ const getContentTypesFromXml = (contentTypesXml) => {
49551
49551
  const defaults = xmlDoc.querySelectorAll("Default");
49552
49552
  return Array.from(defaults).map((item) => item.getAttribute("Extension"));
49553
49553
  };
49554
+ const getHexColorFromDocxSystem = (docxColor) => {
49555
+ const colorMap = /* @__PURE__ */ new Map([
49556
+ ["yellow", "#ffff00"],
49557
+ ["green", "#00ff00"],
49558
+ ["blue", "#0000FFFF"],
49559
+ ["cyan", "#00ffff"],
49560
+ ["magenta", "#ff00ff"],
49561
+ ["red", "#ff0000"],
49562
+ ["darkYellow", "#808000FF"],
49563
+ ["darkGreen", "#008000FF"],
49564
+ ["darkBlue", "#000080"],
49565
+ ["darkCyan", "#008080FF"],
49566
+ ["darkMagenta", "#800080FF"],
49567
+ ["darkGray", "#808080FF"],
49568
+ ["darkRed", "#800000FF"],
49569
+ ["lightGray", "#C0C0C0FF"],
49570
+ ["black", "#000"]
49571
+ ]);
49572
+ return colorMap.get(docxColor) || null;
49573
+ };
49574
+ function isValidHexColor(color) {
49575
+ if (!color || typeof color !== "string") return false;
49576
+ switch (color.length) {
49577
+ case 3:
49578
+ return /^[0-9A-F]{3}$/i.test(color);
49579
+ case 6:
49580
+ return /^[0-9A-F]{6}$/i.test(color);
49581
+ case 8:
49582
+ return /^[0-9A-F]{8}$/i.test(color);
49583
+ default:
49584
+ return false;
49585
+ }
49586
+ }
49554
49587
  function generateDocxRandomId(length = 8) {
49555
49588
  const characters = "0123456789abcdef";
49556
49589
  let id = [];
@@ -50458,7 +50491,10 @@ function translateMark(mark) {
50458
50491
  markElement.attributes["w:line"] = linesToTwips(attrs.lineHeight);
50459
50492
  break;
50460
50493
  case "highlight":
50461
- markElement.attributes["w:val"] = attrs.color;
50494
+ markElement.attributes["w:fill"] = attrs.color.substring(1);
50495
+ markElement.attributes["w:color"] = "auto";
50496
+ markElement.attributes["w:val"] = "clear";
50497
+ markElement.name = "w:shd";
50462
50498
  break;
50463
50499
  }
50464
50500
  return markElement;
@@ -51385,7 +51421,7 @@ function getMarkValue(markType, attributes, docx) {
51385
51421
  underline: () => attributes["w:val"],
51386
51422
  bold: () => attributes?.["w:val"] || null,
51387
51423
  italic: () => attributes?.["w:val"] || null,
51388
- highlight: () => attributes?.["w:val"] || null
51424
+ highlight: () => getHighLightValue(attributes)
51389
51425
  };
51390
51426
  if (!(markType in markValueMapper)) {
51391
51427
  console.debug("❗️❗️ No value mapper for:", markType, "Attributes:", attributes);
@@ -51420,6 +51456,11 @@ function getLineHeightValue(attributes) {
51420
51456
  if (!value || value === "0") return null;
51421
51457
  return `${twipsToLines(value)}`;
51422
51458
  }
51459
+ function getHighLightValue(attributes) {
51460
+ if (attributes["w:fill"]) return `#${attributes["w:fill"]}`;
51461
+ if (isValidHexColor(attributes?.["w:val"])) return `#${attributes["w:val"]}`;
51462
+ return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
51463
+ }
51423
51464
  function parseProperties(node2, docx) {
51424
51465
  const marks = [];
51425
51466
  const unknownMarks = [];
@@ -52484,7 +52525,7 @@ function importCommentData({ docx }) {
52484
52525
  if (!comments) return;
52485
52526
  const { elements } = comments;
52486
52527
  if (!elements || !elements.length) return;
52487
- const { elements: allComments } = elements[0];
52528
+ const { elements: allComments = [] } = elements[0];
52488
52529
  const extractedComments = allComments.map((el) => {
52489
52530
  const { attributes } = el;
52490
52531
  const commentId = attributes["w:id"];
@@ -52688,6 +52729,10 @@ const createNodeListHandler = (nodeHandlers) => {
52688
52729
  converter?.telemetry?.trackStatistic("attributes", innerItemContext);
52689
52730
  });
52690
52731
  }
52732
+ const hasHighlightMark = nodes[0]?.marks?.find((mark) => mark.type === "highlight");
52733
+ if (hasHighlightMark) {
52734
+ converter?.docHiglightColors.add(hasHighlightMark.attrs.color.toUpperCase());
52735
+ }
52691
52736
  }
52692
52737
  if (nodes) {
52693
52738
  nodes.forEach((node2) => {
@@ -52838,6 +52883,7 @@ const _SuperConverter = class _SuperConverter {
52838
52883
  this.media = params?.media || {};
52839
52884
  this.addedMedia = {};
52840
52885
  this.comments = [];
52886
+ this.docHiglightColors = /* @__PURE__ */ new Set([]);
52841
52887
  this.xml = params?.xml;
52842
52888
  this.declaration = null;
52843
52889
  this.numbering = null;
@@ -52889,7 +52935,7 @@ const _SuperConverter = class _SuperConverter {
52889
52935
  return;
52890
52936
  }
52891
52937
  }
52892
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.6") {
52938
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.8") {
52893
52939
  const customLocation = "docProps/custom.xml";
52894
52940
  if (!docx[customLocation]) {
52895
52941
  docx[customLocation] = generateCustomXml();
@@ -53110,7 +53156,8 @@ __publicField(_SuperConverter, "markTypes", [
53110
53156
  { name: "w:ind", type: "textIndent", mark: "textStyle", property: "textIndent" },
53111
53157
  { name: "w:spacing", type: "lineHeight", mark: "textStyle", property: "lineHeight" },
53112
53158
  { name: "link", type: "link", mark: "link", property: "href" },
53113
- { name: "w:highlight", type: "highlight", mark: "highlight", property: "color" }
53159
+ { name: "w:highlight", type: "highlight", mark: "highlight", property: "color" },
53160
+ { name: "w:shd", type: "highlight", mark: "highlight", property: "color" }
53114
53161
  ]);
53115
53162
  __publicField(_SuperConverter, "propertyTypes", Object.freeze({
53116
53163
  "w:pPr": "paragraphProperties",
@@ -53136,7 +53183,7 @@ function storeSuperdocVersion(docx) {
53136
53183
  function generateCustomXml() {
53137
53184
  return DEFAULT_CUSTOM_XML;
53138
53185
  }
53139
- function generateSuperdocVersion(version2 = "0.6.6") {
53186
+ function generateSuperdocVersion(version2 = "0.6.8") {
53140
53187
  return {
53141
53188
  type: "element",
53142
53189
  name: "property",
@@ -53208,4 +53255,4 @@ export {
53208
53255
  twipsToLines as y,
53209
53256
  pixelsToTwips as z
53210
53257
  };
53211
- //# sourceMappingURL=converter-Db6kOZVK.js.map
53258
+ //# sourceMappingURL=converter-D38BagOs.js.map