@harbour-enterprises/superdoc 1.0.0-beta.28 → 1.0.0-beta.29

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-B7Hq0aBG.cjs → PdfViewer-DWBkw4lb.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-5NaTJwvl.es.js → PdfViewer-tNr66QJz.es.js} +1 -1
  3. package/dist/chunks/{index-CLV7-rJY-i5JVHTCR.es.js → index-C-fdgXvG-CG001xE6.es.js} +1 -1
  4. package/dist/chunks/{index-CLV7-rJY-C4coR32S.cjs → index-C-fdgXvG-CIkJMNA_.cjs} +1 -1
  5. package/dist/chunks/{index-W4KMCYbF.es.js → index-C6yeAWhT.es.js} +3 -4
  6. package/dist/chunks/{index-CQPftiv3.cjs → index-DDwDzZCu.cjs} +3 -4
  7. package/dist/chunks/{super-editor.es-DR7G4vGz.cjs → super-editor.es-CbWugsqL.cjs} +200 -61
  8. package/dist/chunks/{super-editor.es-D4MMQONw.es.js → super-editor.es-DUQSn16o.es.js} +200 -61
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-DCpgxLLA.js → converter-GXPldmlh.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-BvQShjmj.js → docx-zipper-D7QUJRNp.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-Df43-j5L.js → editor-DaDga3Ye.js} +201 -62
  14. package/dist/super-editor/chunks/{index-CLV7-rJY.js → index-C-fdgXvG.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-DCnKrmbU.js → toolbar-DjueghNO.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +202 -64
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-jWLMl8Ts.cjs");
4
- const superdoc = require("./index-CQPftiv3.cjs");
4
+ const superdoc = require("./index-DDwDzZCu.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, z as h, O as Transition, a0 as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-Dysv_7z5.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-W4KMCYbF.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-C6yeAWhT.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-D4MMQONw.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DUQSn16o.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-DR7G4vGz.cjs");
3
+ const superEditor_es = require("./super-editor.es-CbWugsqL.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-D4MMQONw.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DUQSn16o.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-CcXAdeql.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17214,7 +17214,7 @@ const _sfc_main = {
17214
17214
  __name: "SuperDoc",
17215
17215
  emits: ["selection-update"],
17216
17216
  setup(__props, { emit: __emit }) {
17217
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-5NaTJwvl.es.js"));
17217
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-tNr66QJz.es.js"));
17218
17218
  const superdocStore = useSuperdocStore();
17219
17219
  const commentsStore = useCommentsStore();
17220
17220
  const {
@@ -18067,7 +18067,7 @@ class SuperDoc extends EventEmitter {
18067
18067
  this.config.colors = shuffleArray(this.config.colors);
18068
18068
  this.userColorMap = /* @__PURE__ */ new Map();
18069
18069
  this.colorIndex = 0;
18070
- this.version = "1.0.0-beta.28";
18070
+ this.version = "1.0.0-beta.29";
18071
18071
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18072
18072
  this.superdocId = config.superdocId || v4();
18073
18073
  this.colors = this.config.colors;
@@ -18415,7 +18415,6 @@ class SuperDoc extends EventEmitter {
18415
18415
  */
18416
18416
  addCommentsList(element) {
18417
18417
  if (!this.config?.modules?.comments || this.config.role === "viewer") return;
18418
- this.#log("🦋 [superdoc] Adding comments list to:", element);
18419
18418
  if (element) this.config.modules.comments.element = element;
18420
18419
  this.commentsList = new SuperComments(this.config.modules?.comments, this);
18421
18420
  if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-DR7G4vGz.cjs");
2
+ const superEditor_es = require("./super-editor.es-CbWugsqL.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DQmQUge-.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17231,7 +17231,7 @@ const _sfc_main = {
17231
17231
  __name: "SuperDoc",
17232
17232
  emits: ["selection-update"],
17233
17233
  setup(__props, { emit: __emit }) {
17234
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-B7Hq0aBG.cjs")));
17234
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DWBkw4lb.cjs")));
17235
17235
  const superdocStore = useSuperdocStore();
17236
17236
  const commentsStore = useCommentsStore();
17237
17237
  const {
@@ -18084,7 +18084,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18084
18084
  this.config.colors = shuffleArray(this.config.colors);
18085
18085
  this.userColorMap = /* @__PURE__ */ new Map();
18086
18086
  this.colorIndex = 0;
18087
- this.version = "1.0.0-beta.28";
18087
+ this.version = "1.0.0-beta.29";
18088
18088
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18089
18089
  this.superdocId = config.superdocId || uuid.v4();
18090
18090
  this.colors = this.config.colors;
@@ -18432,7 +18432,6 @@ class SuperDoc extends eventemitter3.EventEmitter {
18432
18432
  */
18433
18433
  addCommentsList(element) {
18434
18434
  if (!this.config?.modules?.comments || this.config.role === "viewer") return;
18435
- this.#log("🦋 [superdoc] Adding comments list to:", element);
18436
18435
  if (element) this.config.modules.comments.element = element;
18437
18436
  this.commentsList = new SuperComments(this.config.modules?.comments, this);
18438
18437
  if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -41858,7 +41858,7 @@ const _SuperConverter = class _SuperConverter2 {
41858
41858
  static getStoredSuperdocVersion(docx) {
41859
41859
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41860
41860
  }
41861
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.28") {
41861
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.29") {
41862
41862
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41863
41863
  }
41864
41864
  /**
@@ -59031,7 +59031,7 @@ const isHeadless = (editor) => {
59031
59031
  const shouldSkipNodeView = (editor) => {
59032
59032
  return isHeadless(editor);
59033
59033
  };
59034
- const summaryVersion = "1.0.0-beta.28";
59034
+ const summaryVersion = "1.0.0-beta.29";
59035
59035
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59036
59036
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59037
59037
  function mapAttributes(attrs) {
@@ -59820,7 +59820,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
59820
59820
  { default: remarkStringify },
59821
59821
  { default: remarkGfm }
59822
59822
  ] = await Promise.all([
59823
- Promise.resolve().then(() => require("./index-CLV7-rJY-C4coR32S.cjs")),
59823
+ Promise.resolve().then(() => require("./index-C-fdgXvG-CIkJMNA_.cjs")),
59824
59824
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
59825
59825
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
59826
59826
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60025,7 +60025,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60025
60025
  * Process collaboration migrations
60026
60026
  */
60027
60027
  processCollaborationMigrations() {
60028
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.28");
60028
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.29");
60029
60029
  if (!this.options.ydoc) return;
60030
60030
  const metaMap = this.options.ydoc.getMap("meta");
60031
60031
  let docVersion = metaMap.get("version");
@@ -60894,7 +60894,8 @@ function publishSectionMetadata(sectionRanges, options) {
60894
60894
  sectionIndex: section.sectionIndex,
60895
60895
  headerRefs: section.headerRefs,
60896
60896
  footerRefs: section.footerRefs,
60897
- numbering: section.numbering
60897
+ numbering: section.numbering,
60898
+ titlePg: section.titlePg
60898
60899
  });
60899
60900
  });
60900
60901
  }
@@ -62053,6 +62054,7 @@ const DEFAULT_HYPERLINK_CONFIG = {
62053
62054
  enableRichHyperlinks: false
62054
62055
  };
62055
62056
  const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors) => {
62057
+ const isTabRun2 = run2.kind === "tab";
62056
62058
  marks.forEach((mark) => {
62057
62059
  const forwardedDataAttrs = extractDataAttributes(mark.attrs);
62058
62060
  try {
@@ -62085,11 +62087,15 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62085
62087
  break;
62086
62088
  }
62087
62089
  case "textStyle":
62088
- applyTextStyleMark(run2, mark.attrs ?? {}, themeColors);
62090
+ if (!isTabRun2) {
62091
+ applyTextStyleMark(run2, mark.attrs ?? {}, themeColors);
62092
+ }
62089
62093
  break;
62090
62094
  case "commentMark":
62091
62095
  case "comment": {
62092
- pushCommentAnnotation(run2, mark.attrs ?? {});
62096
+ if (!isTabRun2) {
62097
+ pushCommentAnnotation(run2, mark.attrs ?? {});
62098
+ }
62093
62099
  break;
62094
62100
  }
62095
62101
  case "underline": {
@@ -62116,31 +62122,33 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62116
62122
  run2.highlight = resolveColorFromAttributes(mark.attrs ?? {}, themeColors);
62117
62123
  break;
62118
62124
  case "link": {
62119
- const attrs = mark.attrs ?? {};
62120
- if (hyperlinkConfig.enableRichHyperlinks) {
62121
- try {
62122
- const link = buildFlowRunLink(attrs);
62123
- if (link) {
62124
- run2.link = link;
62125
- }
62126
- } catch (error) {
62127
- if (process$1$1.env.NODE_ENV === "development") {
62128
- console.warn("[PM-Adapter] Failed to build rich hyperlink:", error);
62129
- }
62130
- }
62131
- } else if (typeof attrs.href === "string" && attrs.href.trim()) {
62132
- try {
62133
- const sanitized = sanitizeHref(attrs.href);
62134
- if (sanitized && sanitized.href) {
62135
- const legacyLink = {
62136
- href: sanitized.href,
62137
- title: typeof attrs.title === "string" ? attrs.title : void 0
62138
- };
62139
- run2.link = migrateLegacyLink(legacyLink);
62125
+ if (!isTabRun2) {
62126
+ const attrs = mark.attrs ?? {};
62127
+ if (hyperlinkConfig.enableRichHyperlinks) {
62128
+ try {
62129
+ const link = buildFlowRunLink(attrs);
62130
+ if (link) {
62131
+ run2.link = link;
62132
+ }
62133
+ } catch (error) {
62134
+ if (process$1$1.env.NODE_ENV === "development") {
62135
+ console.warn("[PM-Adapter] Failed to build rich hyperlink:", error);
62136
+ }
62140
62137
  }
62141
- } catch (error) {
62142
- if (process$1$1.env.NODE_ENV === "development") {
62143
- console.warn("[PM-Adapter] Failed to sanitize link href:", error);
62138
+ } else if (typeof attrs.href === "string" && attrs.href.trim()) {
62139
+ try {
62140
+ const sanitized = sanitizeHref(attrs.href);
62141
+ if (sanitized && sanitized.href) {
62142
+ const legacyLink = {
62143
+ href: sanitized.href,
62144
+ title: typeof attrs.title === "string" ? attrs.title : void 0
62145
+ };
62146
+ run2.link = migrateLegacyLink(legacyLink);
62147
+ }
62148
+ } catch (error) {
62149
+ if (process$1$1.env.NODE_ENV === "development") {
62150
+ console.warn("[PM-Adapter] Failed to sanitize link href:", error);
62151
+ }
62144
62152
  }
62145
62153
  }
62146
62154
  }
@@ -62154,7 +62162,7 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62154
62162
  console.warn(`[PM-Adapter] Failed to apply mark ${mark.type}:`, error);
62155
62163
  }
62156
62164
  }
62157
- if (forwardedDataAttrs) {
62165
+ if (forwardedDataAttrs && !isTabRun2) {
62158
62166
  run2.dataAttrs = { ...run2.dataAttrs ?? {}, ...forwardedDataAttrs };
62159
62167
  }
62160
62168
  });
@@ -62176,14 +62184,14 @@ function textNodeToRun(textNode, positions, defaultFont, defaultSize, inheritedM
62176
62184
  }
62177
62185
  return run2;
62178
62186
  }
62179
- function tabNodeToRun(node, positions, tabIndex, paragraph) {
62187
+ function tabNodeToRun(node, positions, tabIndex, paragraph, inheritedMarks = []) {
62180
62188
  const pos = positions.get(node);
62181
62189
  if (!pos) return null;
62182
62190
  const paragraphAttrs = paragraph.attrs ?? {};
62183
62191
  const paragraphProps = typeof paragraphAttrs.paragraphProperties === "object" && paragraphAttrs.paragraphProperties !== null ? paragraphAttrs.paragraphProperties : {};
62184
62192
  const tabStops = Array.isArray(paragraphAttrs.tabStops) && paragraphAttrs.tabStops.length ? paragraphAttrs.tabStops : Array.isArray(paragraphProps.tabStops) ? paragraphProps.tabStops : void 0;
62185
62193
  const indent = paragraphAttrs.indent ?? paragraphProps.indent ?? void 0;
62186
- return {
62194
+ const run2 = {
62187
62195
  kind: "tab",
62188
62196
  text: " ",
62189
62197
  pmStart: pos.start,
@@ -62193,6 +62201,11 @@ function tabNodeToRun(node, positions, tabIndex, paragraph) {
62193
62201
  indent,
62194
62202
  leader: node.attrs?.leader ?? null
62195
62203
  };
62204
+ const marks = [...node.marks ?? [], ...inheritedMarks ?? []];
62205
+ if (marks.length > 0) {
62206
+ applyMarksToRun(run2, marks);
62207
+ }
62208
+ return run2;
62196
62209
  }
62197
62210
  function tokenNodeToRun(node, positions, defaultFont, defaultSize, inheritedMarks = [], token, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors) {
62198
62211
  const run2 = {
@@ -64019,9 +64032,26 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
64019
64032
  if (isHeadingStyle && (!resolvedIndent || Object.keys(resolvedIndent).length === 0 || onlyFirstLineIndent)) {
64020
64033
  resolvedIndent = { firstLine: 0, hanging: 0, left: resolvedIndent?.left, right: resolvedIndent?.right };
64021
64034
  }
64035
+ let resolvedSpacing = cloneIfObject(resolvedAsRecord.spacing);
64036
+ const tableStyleParagraphProps = context.tableStyleParagraphProps;
64037
+ if (tableStyleParagraphProps?.spacing) {
64038
+ const tableSpacing = tableStyleParagraphProps.spacing;
64039
+ const paragraphHasExplicitSpacing = Boolean(spacing);
64040
+ if (!paragraphHasExplicitSpacing) {
64041
+ resolvedSpacing = {
64042
+ ...resolvedSpacing,
64043
+ ...tableSpacing
64044
+ };
64045
+ } else {
64046
+ resolvedSpacing = {
64047
+ ...tableSpacing,
64048
+ ...resolvedSpacing
64049
+ };
64050
+ }
64051
+ }
64022
64052
  const hydrated = {
64023
64053
  resolved,
64024
- spacing: cloneIfObject(resolvedAsRecord.spacing),
64054
+ spacing: resolvedSpacing,
64025
64055
  indent: resolvedIndent,
64026
64056
  borders: cloneIfObject(resolvedExtended.borders),
64027
64057
  shading: cloneIfObject(resolvedExtended.shading),
@@ -64920,11 +64950,12 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
64920
64950
  }
64921
64951
  }
64922
64952
  paragraphAttrs.wordLayout = wordLayout;
64923
- if (enrichedNumberingProps.resolvedLevelIndent && !hasExplicitIndent) {
64953
+ if (enrichedNumberingProps.resolvedLevelIndent) {
64924
64954
  const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
64955
+ const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
64925
64956
  paragraphAttrs.indent = {
64926
- ...paragraphAttrs.indent,
64927
- ...resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent
64957
+ ...baseIndent,
64958
+ ...normalizedIndent ?? {}
64928
64959
  };
64929
64960
  }
64930
64961
  }
@@ -65989,7 +66020,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
65989
66020
  return;
65990
66021
  }
65991
66022
  if (node.type === "tab") {
65992
- const tabRun = tabNodeToRun(node, positions, tabOrdinal, para);
66023
+ const tabRun = tabNodeToRun(node, positions, tabOrdinal, para, inheritedMarks);
65993
66024
  tabOrdinal += 1;
65994
66025
  if (tabRun) {
65995
66026
  currentRuns.push(tabRun);
@@ -66684,6 +66715,10 @@ const hydrateTableStyleAttrs = (tableNode, context) => {
66684
66715
  hydration.justification = referenced.justification;
66685
66716
  }
66686
66717
  }
66718
+ const paragraphProps = extractTableStyleParagraphProps(styleId, context.docx);
66719
+ if (paragraphProps) {
66720
+ hydration.paragraphProps = paragraphProps;
66721
+ }
66687
66722
  }
66688
66723
  if (Object.keys(hydration).length > 0) {
66689
66724
  return hydration;
@@ -66734,6 +66769,51 @@ const normalizeTableWidth = (value) => {
66734
66769
  }
66735
66770
  return { width: raw, type: measurement.type };
66736
66771
  };
66772
+ const extractTableStyleParagraphProps = (styleId, docx) => {
66773
+ try {
66774
+ const stylesXml = docx["word/styles.xml"];
66775
+ if (!stylesXml?.elements?.[0]?.elements) return void 0;
66776
+ const styleElements = stylesXml.elements[0].elements.filter((el) => el.name === "w:style");
66777
+ const styleTag = styleElements.find((el) => el.attributes?.["w:styleId"] === styleId);
66778
+ if (!styleTag?.elements) {
66779
+ return void 0;
66780
+ }
66781
+ const pPr = styleTag.elements.find((el) => el.name === "w:pPr");
66782
+ if (!pPr?.elements) {
66783
+ return void 0;
66784
+ }
66785
+ const spacingEl = pPr.elements.find((el) => el.name === "w:spacing");
66786
+ if (!spacingEl?.attributes) {
66787
+ return void 0;
66788
+ }
66789
+ const attrs = spacingEl.attributes;
66790
+ const spacing = {};
66791
+ const before = parseIntSafe(attrs["w:before"]);
66792
+ const after = parseIntSafe(attrs["w:after"]);
66793
+ const line = parseIntSafe(attrs["w:line"]);
66794
+ const rawLineRule = attrs["w:lineRule"];
66795
+ const lineRule = rawLineRule === "auto" || rawLineRule === "exact" || rawLineRule === "atLeast" ? rawLineRule : void 0;
66796
+ if (before != null) spacing.before = twipsToPx$1(before);
66797
+ if (after != null) spacing.after = twipsToPx$1(after);
66798
+ if (line != null) {
66799
+ if (lineRule === "auto") {
66800
+ spacing.line = line / 240;
66801
+ } else {
66802
+ spacing.line = twipsToPx$1(line);
66803
+ }
66804
+ }
66805
+ if (lineRule) spacing.lineRule = lineRule;
66806
+ const result = Object.keys(spacing).length > 0 ? { spacing } : void 0;
66807
+ return result;
66808
+ } catch (err) {
66809
+ return void 0;
66810
+ }
66811
+ };
66812
+ const parseIntSafe = (value) => {
66813
+ if (value == null) return void 0;
66814
+ const num = typeof value === "number" ? value : parseInt(String(value), 10);
66815
+ return Number.isFinite(num) ? num : void 0;
66816
+ };
66737
66817
  const isTableRowNode = (node) => node.type === "tableRow" || node.type === "table_row";
66738
66818
  const isTableCellNode = (node) => node.type === "tableCell" || node.type === "table_cell" || node.type === "tableHeader" || node.type === "table_header";
66739
66819
  const normalizeRowHeight = (rowProps) => {
@@ -66753,11 +66833,15 @@ const normalizeRowHeight = (rowProps) => {
66753
66833
  };
66754
66834
  };
66755
66835
  const parseTableCell = (args) => {
66756
- const { cellNode, rowIndex, cellIndex, context, defaultCellPadding } = args;
66836
+ const { cellNode, rowIndex, cellIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
66757
66837
  if (!isTableCellNode(cellNode) || !Array.isArray(cellNode.content)) {
66758
66838
  return null;
66759
66839
  }
66760
66840
  const blocks = [];
66841
+ const cellConverterContext = tableStyleParagraphProps ? {
66842
+ ...context.converterContext,
66843
+ tableStyleParagraphProps
66844
+ } : context.converterContext;
66761
66845
  for (const childNode of cellNode.content) {
66762
66846
  if (childNode.type === "paragraph") {
66763
66847
  const paragraphBlocks = context.paragraphToFlowBlocks(
@@ -66768,11 +66852,13 @@ const parseTableCell = (args) => {
66768
66852
  context.defaultSize,
66769
66853
  context.styleContext,
66770
66854
  void 0,
66855
+ // listCounterContext
66771
66856
  context.trackedChanges,
66772
66857
  context.bookmarks,
66773
66858
  context.hyperlinkConfig,
66774
66859
  context.themeColors,
66775
- context.converterContext
66860
+ cellConverterContext
66861
+ // converterContext at position 12
66776
66862
  );
66777
66863
  const paragraph = paragraphBlocks.find((b2) => b2.kind === "paragraph");
66778
66864
  if (paragraph) {
@@ -66815,7 +66901,7 @@ const parseTableCell = (args) => {
66815
66901
  };
66816
66902
  };
66817
66903
  const parseTableRow = (args) => {
66818
- const { rowNode, rowIndex, context, defaultCellPadding } = args;
66904
+ const { rowNode, rowIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
66819
66905
  if (!isTableRowNode(rowNode) || !Array.isArray(rowNode.content)) {
66820
66906
  return null;
66821
66907
  }
@@ -66826,7 +66912,8 @@ const parseTableRow = (args) => {
66826
66912
  rowIndex,
66827
66913
  cellIndex,
66828
66914
  context,
66829
- defaultCellPadding
66915
+ defaultCellPadding,
66916
+ tableStyleParagraphProps
66830
66917
  });
66831
66918
  if (parsedCell) {
66832
66919
  cells.push(parsedCell);
@@ -66935,13 +67022,15 @@ function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSi
66935
67022
  };
66936
67023
  const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
66937
67024
  const defaultCellPadding = hydratedTableStyle?.cellPadding;
67025
+ const tableStyleParagraphProps = hydratedTableStyle?.paragraphProps;
66938
67026
  const rows = [];
66939
67027
  node.content.forEach((rowNode, rowIndex) => {
66940
67028
  const parsedRow = parseTableRow({
66941
67029
  rowNode,
66942
67030
  rowIndex,
66943
67031
  context: parserDeps,
66944
- defaultCellPadding
67032
+ defaultCellPadding,
67033
+ tableStyleParagraphProps
66945
67034
  });
66946
67035
  if (parsedRow) {
66947
67036
  rows.push(parsedRow);
@@ -67197,7 +67286,7 @@ function toFlowBlocks(pmDoc, options) {
67197
67286
  blocks.push(sectionBreak);
67198
67287
  recordBlockKind(sectionBreak.kind);
67199
67288
  }
67200
- const paragraphConverter = (para, nextBlockId2, positions2, defaultFont2, defaultSize2, context, listCounterContext, trackedChanges, bookmarks2, hyperlinkConfig2) => paragraphToFlowBlocks(
67289
+ const paragraphConverter = (para, nextBlockId2, positions2, defaultFont2, defaultSize2, context, listCounterContext, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => paragraphToFlowBlocks(
67201
67290
  para,
67202
67291
  nextBlockId2,
67203
67292
  positions2,
@@ -67208,8 +67297,8 @@ function toFlowBlocks(pmDoc, options) {
67208
67297
  trackedChanges,
67209
67298
  bookmarks2,
67210
67299
  hyperlinkConfig2,
67211
- themeColors,
67212
- converterContext
67300
+ themeColorsParam ?? themeColors,
67301
+ converterCtx ?? converterContext
67213
67302
  );
67214
67303
  const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
67215
67304
  node,
@@ -67989,9 +68078,7 @@ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
67989
68078
  odd: section.footerRefs.odd ?? null
67990
68079
  });
67991
68080
  }
67992
- const hasFirstHeader = Boolean(section.headerRefs?.first);
67993
- const hasFirstFooter = Boolean(section.footerRefs?.first);
67994
- if (hasFirstHeader || hasFirstFooter) {
68081
+ if (section.titlePg === true) {
67995
68082
  identifier.sectionTitlePg.set(idx, true);
67996
68083
  }
67997
68084
  }
@@ -69198,14 +69285,35 @@ function layoutTableBlock({
69198
69285
  const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
69199
69286
  let state2 = ensurePage();
69200
69287
  const availableHeight = state2.contentBottom - state2.cursorY;
69201
- let minRequiredHeight = 0;
69202
- if (measure.rows.length > 0) {
69203
- minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
69204
- } else if (measure.totalHeight > 0) {
69205
- minRequiredHeight = measure.totalHeight;
69206
- }
69207
- if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
69208
- state2 = advanceColumn(state2);
69288
+ const hasPriorFragments = state2.page.fragments.length > 0;
69289
+ const hasMeasuredRows = measure.rows.length > 0 && block.rows.length > 0;
69290
+ if (hasMeasuredRows && hasPriorFragments) {
69291
+ const firstRowCantSplit = block.rows[0]?.attrs?.tableRowProperties?.cantSplit === true;
69292
+ const firstRowHeight = measure.rows[0]?.height ?? measure.totalHeight ?? 0;
69293
+ if (firstRowCantSplit) {
69294
+ if (firstRowHeight > availableHeight) {
69295
+ state2 = advanceColumn(state2);
69296
+ }
69297
+ } else {
69298
+ const partial = computePartialRow(0, block.rows[0], measure, availableHeight);
69299
+ const madeProgress = partial.toLineByCell.some(
69300
+ (toLine, idx) => toLine > (partial.fromLineByCell[idx] || 0)
69301
+ );
69302
+ const hasRenderableHeight = partial.partialHeight > 0;
69303
+ if (!madeProgress || !hasRenderableHeight) {
69304
+ state2 = advanceColumn(state2);
69305
+ }
69306
+ }
69307
+ } else if (hasPriorFragments) {
69308
+ let minRequiredHeight = 0;
69309
+ if (measure.rows.length > 0) {
69310
+ minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
69311
+ } else if (measure.totalHeight > 0) {
69312
+ minRequiredHeight = measure.totalHeight;
69313
+ }
69314
+ if (minRequiredHeight > availableHeight) {
69315
+ state2 = advanceColumn(state2);
69316
+ }
69209
69317
  }
69210
69318
  let currentRow = 0;
69211
69319
  let isTableContinuation = false;
@@ -69270,7 +69378,7 @@ function layoutTableBlock({
69270
69378
  return fromLine < totalLines;
69271
69379
  });
69272
69380
  const fragmentHeight2 = continuationPartialRow.partialHeight + (repeatHeaderCount > 0 ? headerHeight : 0);
69273
- if (fragmentHeight2 > 0) {
69381
+ if (fragmentHeight2 > 0 && madeProgress) {
69274
69382
  const fragment2 = {
69275
69383
  kind: "table",
69276
69384
  blockId: block.id,
@@ -77779,9 +77887,16 @@ const _DomPainter = class _DomPainter2 {
77779
77887
  tabEl.style.width = `${actualTabWidth}px`;
77780
77888
  tabEl.style.height = `${line.lineHeight}px`;
77781
77889
  tabEl.style.display = "inline-block";
77782
- tabEl.style.visibility = "hidden";
77783
77890
  tabEl.style.pointerEvents = "none";
77784
77891
  tabEl.style.zIndex = "1";
77892
+ if (baseRun.underline) {
77893
+ const underlineStyle = baseRun.underline.style ?? "single";
77894
+ const underlineColor = baseRun.underline.color ?? "#000000";
77895
+ const borderStyle = underlineStyle === "double" ? "double" : "solid";
77896
+ tabEl.style.borderBottom = `1px ${borderStyle} ${underlineColor}`;
77897
+ } else {
77898
+ tabEl.style.visibility = "hidden";
77899
+ }
77785
77900
  if (styleId) {
77786
77901
  tabEl.setAttribute("styleid", styleId);
77787
77902
  }
@@ -77859,6 +77974,28 @@ const _DomPainter = class _DomPainter2 {
77859
77974
  }
77860
77975
  } else {
77861
77976
  runsForLine.forEach((run2) => {
77977
+ if (run2.kind === "tab") {
77978
+ const tabEl = this.doc.createElement("span");
77979
+ tabEl.classList.add("superdoc-tab");
77980
+ const tabWidth = run2.width ?? 48;
77981
+ tabEl.style.display = "inline-block";
77982
+ tabEl.style.width = `${tabWidth}px`;
77983
+ tabEl.style.height = `${line.lineHeight}px`;
77984
+ tabEl.style.verticalAlign = "bottom";
77985
+ if (run2.underline) {
77986
+ const underlineStyle = run2.underline.style ?? "single";
77987
+ const underlineColor = run2.underline.color ?? "#000000";
77988
+ const borderStyle = underlineStyle === "double" ? "double" : "solid";
77989
+ tabEl.style.borderBottom = `1px ${borderStyle} ${underlineColor}`;
77990
+ }
77991
+ if (styleId) {
77992
+ tabEl.setAttribute("styleid", styleId);
77993
+ }
77994
+ if (run2.pmStart != null) tabEl.dataset.pmStart = String(run2.pmStart);
77995
+ if (run2.pmEnd != null) tabEl.dataset.pmEnd = String(run2.pmEnd);
77996
+ el.appendChild(tabEl);
77997
+ return;
77998
+ }
77862
77999
  const elem = this.renderRun(run2, context, trackedConfig);
77863
78000
  if (elem) {
77864
78001
  if (styleId) {
@@ -78947,8 +79084,10 @@ async function measureParagraphBlock(block, maxWidth) {
78947
79084
  const indentRight = sanitizePositive(indent?.right);
78948
79085
  const firstLine = indent?.firstLine ?? 0;
78949
79086
  const hanging = indent?.hanging ?? 0;
79087
+ const isWordLayoutList = Boolean(wordLayout?.marker);
78950
79088
  const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
78951
- const firstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
79089
+ const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
79090
+ const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
78952
79091
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
78953
79092
  const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
78954
79093
  const tabStops = buildTabStopsPx(