superdoc 1.0.0-beta.27 → 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-iCAmPXap.cjs → PdfViewer-DWBkw4lb.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DGrlCXZ4.es.js → PdfViewer-tNr66QJz.es.js} +1 -1
  3. package/dist/chunks/{index-B9InP_01-Xwm9fBmW.es.js → index-C-fdgXvG-CG001xE6.es.js} +1 -1
  4. package/dist/chunks/{index-B9InP_01-BiyU244m.cjs → index-C-fdgXvG-CIkJMNA_.cjs} +1 -1
  5. package/dist/chunks/{index-DqPOJm-d.es.js → index-C6yeAWhT.es.js} +3 -4
  6. package/dist/chunks/{index-0fejVel3.cjs → index-DDwDzZCu.cjs} +3 -4
  7. package/dist/chunks/{super-editor.es-BU2yH1Gu.cjs → super-editor.es-CbWugsqL.cjs} +204 -63
  8. package/dist/chunks/{super-editor.es-C7-Cnj9g.es.js → super-editor.es-DUQSn16o.es.js} +204 -63
  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-Djir61CW.js → converter-GXPldmlh.js} +5 -3
  12. package/dist/super-editor/chunks/{docx-zipper-CHXUPlGv.js → docx-zipper-D7QUJRNp.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-DFDdrZ-w.js → editor-DaDga3Ye.js} +201 -62
  14. package/dist/super-editor/chunks/{index-B9InP_01.js → index-C-fdgXvG.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-D1rWwsr9.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 +206 -66
  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-0fejVel3.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-DqPOJm-d.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-C7-Cnj9g.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-BU2yH1Gu.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-C7-Cnj9g.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-DGrlCXZ4.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.27";
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-BU2yH1Gu.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-iCAmPXap.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.27";
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 });
@@ -39195,7 +39195,9 @@ const INLINE_PARENT_NAMES = /* @__PURE__ */ new Set([
39195
39195
  "w:fldSimple",
39196
39196
  "w:proofErr",
39197
39197
  "w:del",
39198
- "w:ins"
39198
+ "w:ins",
39199
+ "w:p"
39200
+ // Paragraph is an inline container; unknown children must be inline-safe
39199
39201
  ]);
39200
39202
  const INLINE_NODE_NAMES = /* @__PURE__ */ new Set([
39201
39203
  "m:oMathPara",
@@ -39208,7 +39210,7 @@ const INLINE_NODE_NAMES = /* @__PURE__ */ new Set([
39208
39210
  "m:sup",
39209
39211
  "m:sSup"
39210
39212
  ]);
39211
- const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:p", "w:body", "w:tbl", "w:tc", "w:tr"]);
39213
+ const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:body", "w:tbl", "w:tc", "w:tr"]);
39212
39214
  const isInlineContext = (path = [], currentNodeName) => {
39213
39215
  if (currentNodeName && INLINE_NODE_NAMES.has(currentNodeName)) {
39214
39216
  return true;
@@ -41856,7 +41858,7 @@ const _SuperConverter = class _SuperConverter2 {
41856
41858
  static getStoredSuperdocVersion(docx) {
41857
41859
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41858
41860
  }
41859
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.27") {
41861
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.29") {
41860
41862
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41861
41863
  }
41862
41864
  /**
@@ -59029,7 +59031,7 @@ const isHeadless = (editor) => {
59029
59031
  const shouldSkipNodeView = (editor) => {
59030
59032
  return isHeadless(editor);
59031
59033
  };
59032
- const summaryVersion = "1.0.0-beta.27";
59034
+ const summaryVersion = "1.0.0-beta.29";
59033
59035
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59034
59036
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59035
59037
  function mapAttributes(attrs) {
@@ -59818,7 +59820,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
59818
59820
  { default: remarkStringify },
59819
59821
  { default: remarkGfm }
59820
59822
  ] = await Promise.all([
59821
- Promise.resolve().then(() => require("./index-B9InP_01-BiyU244m.cjs")),
59823
+ Promise.resolve().then(() => require("./index-C-fdgXvG-CIkJMNA_.cjs")),
59822
59824
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
59823
59825
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
59824
59826
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60023,7 +60025,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60023
60025
  * Process collaboration migrations
60024
60026
  */
60025
60027
  processCollaborationMigrations() {
60026
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.27");
60028
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.29");
60027
60029
  if (!this.options.ydoc) return;
60028
60030
  const metaMap = this.options.ydoc.getMap("meta");
60029
60031
  let docVersion = metaMap.get("version");
@@ -60892,7 +60894,8 @@ function publishSectionMetadata(sectionRanges, options) {
60892
60894
  sectionIndex: section.sectionIndex,
60893
60895
  headerRefs: section.headerRefs,
60894
60896
  footerRefs: section.footerRefs,
60895
- numbering: section.numbering
60897
+ numbering: section.numbering,
60898
+ titlePg: section.titlePg
60896
60899
  });
60897
60900
  });
60898
60901
  }
@@ -62051,6 +62054,7 @@ const DEFAULT_HYPERLINK_CONFIG = {
62051
62054
  enableRichHyperlinks: false
62052
62055
  };
62053
62056
  const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors) => {
62057
+ const isTabRun2 = run2.kind === "tab";
62054
62058
  marks.forEach((mark) => {
62055
62059
  const forwardedDataAttrs = extractDataAttributes(mark.attrs);
62056
62060
  try {
@@ -62083,11 +62087,15 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62083
62087
  break;
62084
62088
  }
62085
62089
  case "textStyle":
62086
- applyTextStyleMark(run2, mark.attrs ?? {}, themeColors);
62090
+ if (!isTabRun2) {
62091
+ applyTextStyleMark(run2, mark.attrs ?? {}, themeColors);
62092
+ }
62087
62093
  break;
62088
62094
  case "commentMark":
62089
62095
  case "comment": {
62090
- pushCommentAnnotation(run2, mark.attrs ?? {});
62096
+ if (!isTabRun2) {
62097
+ pushCommentAnnotation(run2, mark.attrs ?? {});
62098
+ }
62091
62099
  break;
62092
62100
  }
62093
62101
  case "underline": {
@@ -62114,31 +62122,33 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62114
62122
  run2.highlight = resolveColorFromAttributes(mark.attrs ?? {}, themeColors);
62115
62123
  break;
62116
62124
  case "link": {
62117
- const attrs = mark.attrs ?? {};
62118
- if (hyperlinkConfig.enableRichHyperlinks) {
62119
- try {
62120
- const link = buildFlowRunLink(attrs);
62121
- if (link) {
62122
- run2.link = link;
62123
- }
62124
- } catch (error) {
62125
- if (process$1$1.env.NODE_ENV === "development") {
62126
- console.warn("[PM-Adapter] Failed to build rich hyperlink:", error);
62127
- }
62128
- }
62129
- } else if (typeof attrs.href === "string" && attrs.href.trim()) {
62130
- try {
62131
- const sanitized = sanitizeHref(attrs.href);
62132
- if (sanitized && sanitized.href) {
62133
- const legacyLink = {
62134
- href: sanitized.href,
62135
- title: typeof attrs.title === "string" ? attrs.title : void 0
62136
- };
62137
- 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
+ }
62138
62137
  }
62139
- } catch (error) {
62140
- if (process$1$1.env.NODE_ENV === "development") {
62141
- 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
+ }
62142
62152
  }
62143
62153
  }
62144
62154
  }
@@ -62152,7 +62162,7 @@ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG
62152
62162
  console.warn(`[PM-Adapter] Failed to apply mark ${mark.type}:`, error);
62153
62163
  }
62154
62164
  }
62155
- if (forwardedDataAttrs) {
62165
+ if (forwardedDataAttrs && !isTabRun2) {
62156
62166
  run2.dataAttrs = { ...run2.dataAttrs ?? {}, ...forwardedDataAttrs };
62157
62167
  }
62158
62168
  });
@@ -62174,14 +62184,14 @@ function textNodeToRun(textNode, positions, defaultFont, defaultSize, inheritedM
62174
62184
  }
62175
62185
  return run2;
62176
62186
  }
62177
- function tabNodeToRun(node, positions, tabIndex, paragraph) {
62187
+ function tabNodeToRun(node, positions, tabIndex, paragraph, inheritedMarks = []) {
62178
62188
  const pos = positions.get(node);
62179
62189
  if (!pos) return null;
62180
62190
  const paragraphAttrs = paragraph.attrs ?? {};
62181
62191
  const paragraphProps = typeof paragraphAttrs.paragraphProperties === "object" && paragraphAttrs.paragraphProperties !== null ? paragraphAttrs.paragraphProperties : {};
62182
62192
  const tabStops = Array.isArray(paragraphAttrs.tabStops) && paragraphAttrs.tabStops.length ? paragraphAttrs.tabStops : Array.isArray(paragraphProps.tabStops) ? paragraphProps.tabStops : void 0;
62183
62193
  const indent = paragraphAttrs.indent ?? paragraphProps.indent ?? void 0;
62184
- return {
62194
+ const run2 = {
62185
62195
  kind: "tab",
62186
62196
  text: " ",
62187
62197
  pmStart: pos.start,
@@ -62191,6 +62201,11 @@ function tabNodeToRun(node, positions, tabIndex, paragraph) {
62191
62201
  indent,
62192
62202
  leader: node.attrs?.leader ?? null
62193
62203
  };
62204
+ const marks = [...node.marks ?? [], ...inheritedMarks ?? []];
62205
+ if (marks.length > 0) {
62206
+ applyMarksToRun(run2, marks);
62207
+ }
62208
+ return run2;
62194
62209
  }
62195
62210
  function tokenNodeToRun(node, positions, defaultFont, defaultSize, inheritedMarks = [], token, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors) {
62196
62211
  const run2 = {
@@ -64017,9 +64032,26 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
64017
64032
  if (isHeadingStyle && (!resolvedIndent || Object.keys(resolvedIndent).length === 0 || onlyFirstLineIndent)) {
64018
64033
  resolvedIndent = { firstLine: 0, hanging: 0, left: resolvedIndent?.left, right: resolvedIndent?.right };
64019
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
+ }
64020
64052
  const hydrated = {
64021
64053
  resolved,
64022
- spacing: cloneIfObject(resolvedAsRecord.spacing),
64054
+ spacing: resolvedSpacing,
64023
64055
  indent: resolvedIndent,
64024
64056
  borders: cloneIfObject(resolvedExtended.borders),
64025
64057
  shading: cloneIfObject(resolvedExtended.shading),
@@ -64918,11 +64950,12 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
64918
64950
  }
64919
64951
  }
64920
64952
  paragraphAttrs.wordLayout = wordLayout;
64921
- if (enrichedNumberingProps.resolvedLevelIndent && !hasExplicitIndent) {
64953
+ if (enrichedNumberingProps.resolvedLevelIndent) {
64922
64954
  const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
64955
+ const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
64923
64956
  paragraphAttrs.indent = {
64924
- ...paragraphAttrs.indent,
64925
- ...resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent
64957
+ ...baseIndent,
64958
+ ...normalizedIndent ?? {}
64926
64959
  };
64927
64960
  }
64928
64961
  }
@@ -65987,7 +66020,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
65987
66020
  return;
65988
66021
  }
65989
66022
  if (node.type === "tab") {
65990
- const tabRun = tabNodeToRun(node, positions, tabOrdinal, para);
66023
+ const tabRun = tabNodeToRun(node, positions, tabOrdinal, para, inheritedMarks);
65991
66024
  tabOrdinal += 1;
65992
66025
  if (tabRun) {
65993
66026
  currentRuns.push(tabRun);
@@ -66682,6 +66715,10 @@ const hydrateTableStyleAttrs = (tableNode, context) => {
66682
66715
  hydration.justification = referenced.justification;
66683
66716
  }
66684
66717
  }
66718
+ const paragraphProps = extractTableStyleParagraphProps(styleId, context.docx);
66719
+ if (paragraphProps) {
66720
+ hydration.paragraphProps = paragraphProps;
66721
+ }
66685
66722
  }
66686
66723
  if (Object.keys(hydration).length > 0) {
66687
66724
  return hydration;
@@ -66732,6 +66769,51 @@ const normalizeTableWidth = (value) => {
66732
66769
  }
66733
66770
  return { width: raw, type: measurement.type };
66734
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
+ };
66735
66817
  const isTableRowNode = (node) => node.type === "tableRow" || node.type === "table_row";
66736
66818
  const isTableCellNode = (node) => node.type === "tableCell" || node.type === "table_cell" || node.type === "tableHeader" || node.type === "table_header";
66737
66819
  const normalizeRowHeight = (rowProps) => {
@@ -66751,11 +66833,15 @@ const normalizeRowHeight = (rowProps) => {
66751
66833
  };
66752
66834
  };
66753
66835
  const parseTableCell = (args) => {
66754
- const { cellNode, rowIndex, cellIndex, context, defaultCellPadding } = args;
66836
+ const { cellNode, rowIndex, cellIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
66755
66837
  if (!isTableCellNode(cellNode) || !Array.isArray(cellNode.content)) {
66756
66838
  return null;
66757
66839
  }
66758
66840
  const blocks = [];
66841
+ const cellConverterContext = tableStyleParagraphProps ? {
66842
+ ...context.converterContext,
66843
+ tableStyleParagraphProps
66844
+ } : context.converterContext;
66759
66845
  for (const childNode of cellNode.content) {
66760
66846
  if (childNode.type === "paragraph") {
66761
66847
  const paragraphBlocks = context.paragraphToFlowBlocks(
@@ -66766,11 +66852,13 @@ const parseTableCell = (args) => {
66766
66852
  context.defaultSize,
66767
66853
  context.styleContext,
66768
66854
  void 0,
66855
+ // listCounterContext
66769
66856
  context.trackedChanges,
66770
66857
  context.bookmarks,
66771
66858
  context.hyperlinkConfig,
66772
66859
  context.themeColors,
66773
- context.converterContext
66860
+ cellConverterContext
66861
+ // converterContext at position 12
66774
66862
  );
66775
66863
  const paragraph = paragraphBlocks.find((b2) => b2.kind === "paragraph");
66776
66864
  if (paragraph) {
@@ -66813,7 +66901,7 @@ const parseTableCell = (args) => {
66813
66901
  };
66814
66902
  };
66815
66903
  const parseTableRow = (args) => {
66816
- const { rowNode, rowIndex, context, defaultCellPadding } = args;
66904
+ const { rowNode, rowIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
66817
66905
  if (!isTableRowNode(rowNode) || !Array.isArray(rowNode.content)) {
66818
66906
  return null;
66819
66907
  }
@@ -66824,7 +66912,8 @@ const parseTableRow = (args) => {
66824
66912
  rowIndex,
66825
66913
  cellIndex,
66826
66914
  context,
66827
- defaultCellPadding
66915
+ defaultCellPadding,
66916
+ tableStyleParagraphProps
66828
66917
  });
66829
66918
  if (parsedCell) {
66830
66919
  cells.push(parsedCell);
@@ -66933,13 +67022,15 @@ function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSi
66933
67022
  };
66934
67023
  const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
66935
67024
  const defaultCellPadding = hydratedTableStyle?.cellPadding;
67025
+ const tableStyleParagraphProps = hydratedTableStyle?.paragraphProps;
66936
67026
  const rows = [];
66937
67027
  node.content.forEach((rowNode, rowIndex) => {
66938
67028
  const parsedRow = parseTableRow({
66939
67029
  rowNode,
66940
67030
  rowIndex,
66941
67031
  context: parserDeps,
66942
- defaultCellPadding
67032
+ defaultCellPadding,
67033
+ tableStyleParagraphProps
66943
67034
  });
66944
67035
  if (parsedRow) {
66945
67036
  rows.push(parsedRow);
@@ -67195,7 +67286,7 @@ function toFlowBlocks(pmDoc, options) {
67195
67286
  blocks.push(sectionBreak);
67196
67287
  recordBlockKind(sectionBreak.kind);
67197
67288
  }
67198
- 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(
67199
67290
  para,
67200
67291
  nextBlockId2,
67201
67292
  positions2,
@@ -67206,8 +67297,8 @@ function toFlowBlocks(pmDoc, options) {
67206
67297
  trackedChanges,
67207
67298
  bookmarks2,
67208
67299
  hyperlinkConfig2,
67209
- themeColors,
67210
- converterContext
67300
+ themeColorsParam ?? themeColors,
67301
+ converterCtx ?? converterContext
67211
67302
  );
67212
67303
  const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
67213
67304
  node,
@@ -67987,9 +68078,7 @@ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
67987
68078
  odd: section.footerRefs.odd ?? null
67988
68079
  });
67989
68080
  }
67990
- const hasFirstHeader = Boolean(section.headerRefs?.first);
67991
- const hasFirstFooter = Boolean(section.footerRefs?.first);
67992
- if (hasFirstHeader || hasFirstFooter) {
68081
+ if (section.titlePg === true) {
67993
68082
  identifier.sectionTitlePg.set(idx, true);
67994
68083
  }
67995
68084
  }
@@ -69196,14 +69285,35 @@ function layoutTableBlock({
69196
69285
  const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
69197
69286
  let state2 = ensurePage();
69198
69287
  const availableHeight = state2.contentBottom - state2.cursorY;
69199
- let minRequiredHeight = 0;
69200
- if (measure.rows.length > 0) {
69201
- minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
69202
- } else if (measure.totalHeight > 0) {
69203
- minRequiredHeight = measure.totalHeight;
69204
- }
69205
- if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
69206
- 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
+ }
69207
69317
  }
69208
69318
  let currentRow = 0;
69209
69319
  let isTableContinuation = false;
@@ -69268,7 +69378,7 @@ function layoutTableBlock({
69268
69378
  return fromLine < totalLines;
69269
69379
  });
69270
69380
  const fragmentHeight2 = continuationPartialRow.partialHeight + (repeatHeaderCount > 0 ? headerHeight : 0);
69271
- if (fragmentHeight2 > 0) {
69381
+ if (fragmentHeight2 > 0 && madeProgress) {
69272
69382
  const fragment2 = {
69273
69383
  kind: "table",
69274
69384
  blockId: block.id,
@@ -77777,9 +77887,16 @@ const _DomPainter = class _DomPainter2 {
77777
77887
  tabEl.style.width = `${actualTabWidth}px`;
77778
77888
  tabEl.style.height = `${line.lineHeight}px`;
77779
77889
  tabEl.style.display = "inline-block";
77780
- tabEl.style.visibility = "hidden";
77781
77890
  tabEl.style.pointerEvents = "none";
77782
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
+ }
77783
77900
  if (styleId) {
77784
77901
  tabEl.setAttribute("styleid", styleId);
77785
77902
  }
@@ -77857,6 +77974,28 @@ const _DomPainter = class _DomPainter2 {
77857
77974
  }
77858
77975
  } else {
77859
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
+ }
77860
77999
  const elem = this.renderRun(run2, context, trackedConfig);
77861
78000
  if (elem) {
77862
78001
  if (styleId) {
@@ -78945,8 +79084,10 @@ async function measureParagraphBlock(block, maxWidth) {
78945
79084
  const indentRight = sanitizePositive(indent?.right);
78946
79085
  const firstLine = indent?.firstLine ?? 0;
78947
79086
  const hanging = indent?.hanging ?? 0;
79087
+ const isWordLayoutList = Boolean(wordLayout?.marker);
78948
79088
  const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
78949
- const firstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
79089
+ const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
79090
+ const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
78950
79091
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
78951
79092
  const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
78952
79093
  const tabStops = buildTabStopsPx(