@harbour-enterprises/superdoc 0.12.35 → 0.12.36-next.10

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 (40) hide show
  1. package/dist/chunks/{super-editor.es-B4SPMXXo.cjs → super-editor.es-C5-RTRXN.cjs} +1754 -221
  2. package/dist/chunks/{super-editor.es-D8BL6ojY.es.js → super-editor.es-Zxne04bX.es.js} +1754 -221
  3. package/dist/style.css +36 -7
  4. package/dist/super-editor/ai-writer.es.js +2 -2
  5. package/dist/super-editor/chunks/{converter-DQPyKWs_.js → converter-Dhv5kzsP.js} +108 -9
  6. package/dist/super-editor/chunks/{docx-zipper-cJ42om_0.js → docx-zipper-Co1uS6tK.js} +1 -1
  7. package/dist/super-editor/chunks/{editor-B5TyAe8v.js → editor-D2aY4DLZ.js} +1688 -254
  8. package/dist/super-editor/chunks/{toolbar-CDeO5r_T.js → toolbar-CVZmXsRq.js} +2 -2
  9. package/dist/super-editor/components/pagination-helpers.d.ts.map +1 -1
  10. package/dist/super-editor/converter.es.js +1 -1
  11. package/dist/super-editor/core/Attribute.d.ts +2 -2
  12. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  13. package/dist/super-editor/core/Schema.d.ts +2 -2
  14. package/dist/super-editor/core/helpers/annotator.d.ts +2 -0
  15. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  16. package/dist/super-editor/core/helpers/findWordBounds.d.ts +5 -0
  17. package/dist/super-editor/core/helpers/findWordBounds.d.ts.map +1 -0
  18. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  19. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  20. package/dist/super-editor/core/super-converter/v2/importer/autoPageNumberImporter.d.ts.map +1 -1
  21. package/dist/super-editor/docx-zipper.es.js +2 -2
  22. package/dist/super-editor/editor.es.js +3 -3
  23. package/dist/super-editor/extensions/line-height/line-height.d.ts.map +1 -1
  24. package/dist/super-editor/extensions/page-number/page-number.d.ts +10 -0
  25. package/dist/super-editor/extensions/page-number/page-number.d.ts.map +1 -1
  26. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts +2 -1
  27. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
  28. package/dist/super-editor/extensions/pagination/pagination.d.ts.map +1 -1
  29. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  30. package/dist/super-editor/file-zipper.es.js +1 -1
  31. package/dist/super-editor/style.css +36 -7
  32. package/dist/super-editor/super-editor.es.js +7 -7
  33. package/dist/super-editor/toolbar.es.js +2 -2
  34. package/dist/super-editor.cjs +1 -1
  35. package/dist/super-editor.es.js +1 -1
  36. package/dist/superdoc.cjs +2 -2
  37. package/dist/superdoc.es.js +3 -3
  38. package/dist/superdoc.umd.js +1770 -237
  39. package/dist/superdoc.umd.js.map +1 -1
  40. package/package.json +1 -1
package/dist/style.css CHANGED
@@ -878,6 +878,22 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
878
878
  .sd-ai-highlight-pulse {
879
879
  animation: ai-pulse 1.5s ease-in-out infinite;
880
880
  }
881
+ .sd-editor-auto-page-number,
882
+ .sd-editor-auto-total-pages {
883
+ transition: all 250ms ease;
884
+ border-bottom: 1px solid #9A9A9A;
885
+ cursor: not-allowed;
886
+ }
887
+ .sd-editor-auto-page-numbe:hover,
888
+ .sd-editor-auto-total-pages:hover {
889
+ border-bottom: 1px solid #4f4f4f;
890
+ }
891
+ .sd-editor-auto-page-number-content {
892
+ pointer-events: none;
893
+ }
894
+ :root {
895
+ --sd-editor-separator-height: 18px;
896
+ }
881
897
  .pagination-section-header {
882
898
  cursor: default;
883
899
  }
@@ -900,14 +916,24 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
900
916
  .pagination-separator {
901
917
  position: relative;
902
918
  display: block;
903
- height: 18px;
904
- min-height: 18px;
919
+ height: var(--sd-editor-separator-height);
920
+ min-height: var(--sd-editor-separator-height);
905
921
  min-width: 100%;
906
922
  width: 100%;
907
923
  border-top: 1px solid #DBDBDB;
908
924
  border-bottom: 1px solid #DBDBDB;
909
925
  cursor: default;
910
926
  }
927
+ .pagination-separator--table {
928
+ border: 0;
929
+ }
930
+ .pagination-separator-floating {
931
+ position: absolute;
932
+ height: var(--sd-editor-separator-height);
933
+ border-top: 1px solid #DBDBDB;
934
+ border-bottom: 1px solid #DBDBDB;
935
+ pointer-events: none;
936
+ }
911
937
  .pagination-inner {
912
938
  position: absolute;
913
939
  top: 0;
@@ -1562,7 +1588,10 @@ on the right if it is inside shape textbox.
1562
1588
  user-select: none;
1563
1589
  }
1564
1590
 
1565
- .super-editor-container[data-v-199a4ecf] {
1591
+ .editor-element[data-v-4b700df1] {
1592
+ position: relative;
1593
+ }
1594
+ .super-editor-container[data-v-4b700df1] {
1566
1595
  width: auto;
1567
1596
  height: auto;
1568
1597
  min-width: 8in;
@@ -1571,13 +1600,13 @@ on the right if it is inside shape textbox.
1571
1600
  display: flex;
1572
1601
  flex-direction: column;
1573
1602
  }
1574
- .ruler[data-v-199a4ecf] {
1603
+ .ruler[data-v-4b700df1] {
1575
1604
  margin-bottom: 2px;
1576
1605
  }
1577
- .super-editor[data-v-199a4ecf] {
1606
+ .super-editor[data-v-4b700df1] {
1578
1607
  color: initial;
1579
1608
  }
1580
- .placeholder-editor[data-v-199a4ecf] {
1609
+ .placeholder-editor[data-v-4b700df1] {
1581
1610
  position: absolute;
1582
1611
  top: 0;
1583
1612
  left: 0;
@@ -1589,7 +1618,7 @@ on the right if it is inside shape textbox.
1589
1618
  background-color: white;
1590
1619
  box-sizing: border-box;
1591
1620
  }
1592
- .placeholder-title[data-v-199a4ecf] {
1621
+ .placeholder-title[data-v-4b700df1] {
1593
1622
  display: flex;
1594
1623
  justify-content: center;
1595
1624
  margin-bottom: 40px;
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-DQPyKWs_.js";
3
- import { _ as _export_sfc } from "./chunks/editor-B5TyAe8v.js";
2
+ import { T as TextSelection } from "./chunks/converter-Dhv5kzsP.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-D2aY4DLZ.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -16076,7 +16076,6 @@ const getLineHeightValueString = (lineHeight, defaultUnit, lineRule = "", isObje
16076
16076
  if (Number.isNaN(value) || value === 0) return {};
16077
16077
  if (lineRule === "atLeast" && value < 1) return {};
16078
16078
  unit = unit ? unit : defaultUnit;
16079
- value += unit ? 4 : 0.2;
16080
16079
  return isObject ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
16081
16080
  };
16082
16081
  const deobfuscateFont = (arrayBuffer, guidHex) => {
@@ -18865,7 +18864,9 @@ function exportSchemaToJson(params) {
18865
18864
  shapeContainer: translateShapeContainer,
18866
18865
  shapeTextbox: translateShapeTextbox,
18867
18866
  contentBlock: translateContentBlock,
18868
- structuredContent: translateStructuredContent
18867
+ structuredContent: translateStructuredContent,
18868
+ "page-number": translatePageNumberNode,
18869
+ "total-page-number": translateTotalPageNumberNode
18869
18870
  };
18870
18871
  if (!router[type2]) {
18871
18872
  console.error("No translation function found for node type:", type2);
@@ -19303,7 +19304,10 @@ function translateList(params) {
19303
19304
  if (Array.isArray(outputNode)) {
19304
19305
  const mapped = [];
19305
19306
  outputNode.forEach((el, index2) => {
19306
- mapped.push(...el.elements);
19307
+ el.elements.forEach((element) => {
19308
+ if (element.name === "w:pPr") return;
19309
+ mapped.push(element);
19310
+ });
19307
19311
  if (index2 < outputNode.length - 1) mapped.push({ name: "w:br", type: "element" });
19308
19312
  });
19309
19313
  mapped.unshift(carbonCopy(pPr));
@@ -20559,6 +20563,81 @@ function translateStructuredContent(params) {
20559
20563
  elements: nodeElements
20560
20564
  };
20561
20565
  }
20566
+ const translatePageNumberNode = (params) => {
20567
+ const outputMarks = processOutputMarks(params.node.attrs?.marksAsAttrs || []);
20568
+ return getAutoPageJson("PAGE", outputMarks);
20569
+ };
20570
+ const translateTotalPageNumberNode = (params) => {
20571
+ const outputMarks = processOutputMarks(params.node.attrs?.marksAsAttrs || []);
20572
+ return getAutoPageJson("NUMPAGES", outputMarks);
20573
+ };
20574
+ const getAutoPageJson = (type2, outputMarks = []) => {
20575
+ return [
20576
+ {
20577
+ "name": "w:r",
20578
+ "elements": [
20579
+ {
20580
+ "name": "w:rPr",
20581
+ "elements": outputMarks
20582
+ },
20583
+ {
20584
+ "name": "w:fldChar",
20585
+ "attributes": {
20586
+ "w:fldCharType": "begin"
20587
+ }
20588
+ }
20589
+ ]
20590
+ },
20591
+ {
20592
+ "name": "w:r",
20593
+ "elements": [
20594
+ {
20595
+ "name": "w:rPr",
20596
+ "elements": outputMarks
20597
+ },
20598
+ {
20599
+ "name": "w:instrText",
20600
+ "elements": [
20601
+ {
20602
+ "type": "text",
20603
+ "text": ` ${type2}`
20604
+ }
20605
+ ]
20606
+ }
20607
+ ]
20608
+ },
20609
+ {
20610
+ "name": "w:r",
20611
+ "elements": [
20612
+ {
20613
+ "name": "w:rPr",
20614
+ "elements": outputMarks
20615
+ },
20616
+ {
20617
+ "name": "w:fldChar",
20618
+ "attributes": {
20619
+ "w:fldCharType": "separate"
20620
+ }
20621
+ }
20622
+ ]
20623
+ },
20624
+ {
20625
+ "name": "w:r",
20626
+ "elements": [
20627
+ {
20628
+ "name": "w:rPr",
20629
+ "elements": outputMarks
20630
+ },
20631
+ {
20632
+ "name": "w:fldChar",
20633
+ "attributes": {
20634
+ "w:fldCharType": "end"
20635
+ }
20636
+ }
20637
+ ]
20638
+ }
20639
+ ];
20640
+ };
20562
20641
  const defaultInitialXml = `<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>`;
20563
20642
  const parseXmlToJson = (xml) => {
20564
20643
  return JSON.parse(xmljs.xml2json(xml, null, 2));
@@ -22267,15 +22346,25 @@ const processCombinedNodesForFldChar = (nodesToCombine = []) => {
22267
22346
  if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
22268
22347
  const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
22269
22348
  if (hasPageMarker) {
22270
- processedNodes.push({
22349
+ const pageNumNode = {
22271
22350
  name: "sd:autoPageNumber",
22272
22351
  type: "element"
22352
+ };
22353
+ nodesToCombine.forEach((n) => {
22354
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
22355
+ if (rPrNode) pageNumNode.elements = [rPrNode];
22273
22356
  });
22357
+ processedNodes.push(pageNumNode);
22274
22358
  } else if (isNumPages) {
22275
- processedNodes.push({
22359
+ const totalPageNumNode = {
22276
22360
  name: "sd:totalPageNumber",
22277
22361
  type: "element"
22362
+ };
22363
+ nodesToCombine.forEach((n) => {
22364
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
22365
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
22278
22366
  });
22367
+ processedNodes.push(totalPageNumNode);
22279
22368
  } else if (urlMatch && urlMatch?.length >= 2) {
22280
22369
  const url = urlMatch[1];
22281
22370
  const textMarks = [];
@@ -22611,8 +22700,13 @@ const handleAutoPageNumber = (params) => {
22611
22700
  if (nodes.length === 0 || nodes[0].name !== "sd:autoPageNumber") {
22612
22701
  return { nodes: [], consumed: 0 };
22613
22702
  }
22703
+ const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
22704
+ const marks = parseMarks(rPr || { elements: [] });
22614
22705
  const processedNode = {
22615
- type: "page-number"
22706
+ type: "page-number",
22707
+ attrs: {
22708
+ marksAsAttrs: marks
22709
+ }
22616
22710
  };
22617
22711
  return { nodes: [processedNode], consumed: 1 };
22618
22712
  };
@@ -22625,8 +22719,13 @@ const handleAutoTotalPageNumber = (params) => {
22625
22719
  if (nodes.length === 0 || nodes[0].name !== "sd:totalPageNumber") {
22626
22720
  return { nodes: [], consumed: 0 };
22627
22721
  }
22722
+ const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
22723
+ const marks = parseMarks(rPr || { elements: [] });
22628
22724
  const processedNode = {
22629
- type: "total-page-number"
22725
+ type: "total-page-number",
22726
+ attrs: {
22727
+ marksAsAttrs: marks
22728
+ }
22630
22729
  };
22631
22730
  return { nodes: [processedNode], consumed: 1 };
22632
22731
  };
@@ -23311,7 +23410,7 @@ const _SuperConverter = class _SuperConverter {
23311
23410
  return;
23312
23411
  }
23313
23412
  }
23314
- static updateDocumentVersion(docx = this.convertedXml, version = "0.12.35") {
23413
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.12.36-next.10") {
23315
23414
  const customLocation = "docProps/custom.xml";
23316
23415
  if (!docx[customLocation]) {
23317
23416
  docx[customLocation] = generateCustomXml();
@@ -23781,7 +23880,7 @@ function storeSuperdocVersion(docx) {
23781
23880
  function generateCustomXml() {
23782
23881
  return DEFAULT_CUSTOM_XML;
23783
23882
  }
23784
- function generateSuperdocVersion(pid = 2, version = "0.12.35") {
23883
+ function generateSuperdocVersion(pid = 2, version = "0.12.36-next.10") {
23785
23884
  return {
23786
23885
  type: "element",
23787
23886
  name: "property",
@@ -1,4 +1,4 @@
1
- import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-DQPyKWs_.js";
1
+ import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-Dhv5kzsP.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }