@harbour-enterprises/superdoc 1.0.0-beta.61 → 1.0.0-beta.62

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-CuTlpPQO.cjs → PdfViewer-Dm3bZ_1B.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BHLsVrSe.es.js → PdfViewer-rmkhzY1H.es.js} +1 -1
  3. package/dist/chunks/{index-DeFp1DEO.es.js → index-5vPj3xiM.es.js} +3 -3
  4. package/dist/chunks/{index-E5x6cBKw.cjs → index-VQNmJYMh.cjs} +3 -3
  5. package/dist/chunks/{index-u8dj63PM-VgHx1nNP.cjs → index-XOsGE2PW-BL-ekicF.cjs} +1 -1
  6. package/dist/chunks/{index-u8dj63PM-Bfomc8Z6.es.js → index-XOsGE2PW-hNAnvmsK.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-CI3WoKIG.es.js → super-editor.es-BIEE4joF.es.js} +190 -62
  8. package/dist/chunks/{super-editor.es-nY9_xN6Z.cjs → super-editor.es-CxtR72x8.cjs} +190 -62
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-DaSkPzA9.js → converter-Bo9KIIo_.js} +164 -46
  11. package/dist/super-editor/chunks/{docx-zipper-Cx1zgQ8B.js → docx-zipper-Cw0Rbwvk.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-45pxcsTR.js → editor-v-i8Oo_X.js} +28 -18
  13. package/dist/super-editor/chunks/{index-u8dj63PM.js → index-XOsGE2PW.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-C4OC-AnI.js → toolbar-CiKH0Ttu.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +192 -64
  26. package/dist/superdoc.umd.js.map +1 -1
  27. 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-E5x6cBKw.cjs");
4
+ const superdoc = require("./index-VQNmJYMh.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-DeFp1DEO.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-5vPj3xiM.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -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-CI3WoKIG.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-BIEE4joF.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";
@@ -17251,7 +17251,7 @@ const _sfc_main = {
17251
17251
  __name: "SuperDoc",
17252
17252
  emits: ["selection-update"],
17253
17253
  setup(__props, { emit: __emit }) {
17254
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BHLsVrSe.es.js"));
17254
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-rmkhzY1H.es.js"));
17255
17255
  const superdocStore = useSuperdocStore();
17256
17256
  const commentsStore = useCommentsStore();
17257
17257
  const {
@@ -18140,7 +18140,7 @@ class SuperDoc extends EventEmitter {
18140
18140
  this.config.colors = shuffleArray(this.config.colors);
18141
18141
  this.userColorMap = /* @__PURE__ */ new Map();
18142
18142
  this.colorIndex = 0;
18143
- this.version = "1.0.0-beta.61";
18143
+ this.version = "1.0.0-beta.62";
18144
18144
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18145
18145
  this.superdocId = config.superdocId || v4();
18146
18146
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-nY9_xN6Z.cjs");
2
+ const superEditor_es = require("./super-editor.es-CxtR72x8.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");
@@ -17268,7 +17268,7 @@ const _sfc_main = {
17268
17268
  __name: "SuperDoc",
17269
17269
  emits: ["selection-update"],
17270
17270
  setup(__props, { emit: __emit }) {
17271
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CuTlpPQO.cjs")));
17271
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Dm3bZ_1B.cjs")));
17272
17272
  const superdocStore = useSuperdocStore();
17273
17273
  const commentsStore = useCommentsStore();
17274
17274
  const {
@@ -18157,7 +18157,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18157
18157
  this.config.colors = shuffleArray(this.config.colors);
18158
18158
  this.userColorMap = /* @__PURE__ */ new Map();
18159
18159
  this.colorIndex = 0;
18160
- this.version = "1.0.0-beta.61";
18160
+ this.version = "1.0.0-beta.62";
18161
18161
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18162
18162
  this.superdocId = config.superdocId || uuid.v4();
18163
18163
  this.colors = this.config.colors;
@@ -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-nY9_xN6Z.cjs");
3
+ const superEditor_es = require("./super-editor.es-CxtR72x8.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 { s as getDefaultExportFromCjs$2 } from "./super-editor.es-CI3WoKIG.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-BIEE4joF.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -42114,11 +42114,71 @@ const _SuperConverter = class _SuperConverter2 {
42114
42114
  return JSON.parse(xmljs.xml2json(newXml, null, 2));
42115
42115
  }
42116
42116
  /**
42117
- * Generic method to get a stored custom property from docx
42117
+ * Checks if an element name matches the expected local name, with or without namespace prefix.
42118
+ * This helper supports custom namespace prefixes in DOCX files (e.g., 'op:Properties', 'custom:property').
42119
+ *
42120
+ * @private
42121
+ * @static
42122
+ * @param {string|undefined|null} elementName - The element name to check (may include namespace prefix)
42123
+ * @param {string} expectedLocalName - The expected local name without prefix
42124
+ * @returns {boolean} True if the element name matches (with or without prefix)
42125
+ *
42126
+ * @example
42127
+ * // Exact match without prefix
42128
+ * _matchesElementName('Properties', 'Properties') // => true
42129
+ *
42130
+ * @example
42131
+ * // Match with namespace prefix
42132
+ * _matchesElementName('op:Properties', 'Properties') // => true
42133
+ * _matchesElementName('custom:property', 'property') // => true
42134
+ *
42135
+ * @example
42136
+ * // No match
42137
+ * _matchesElementName('SomeOtherElement', 'Properties') // => false
42138
+ * _matchesElementName(':Properties', 'Properties') // => false (empty prefix)
42139
+ */
42140
+ static _matchesElementName(elementName, expectedLocalName) {
42141
+ if (!elementName || typeof elementName !== "string") return false;
42142
+ if (!expectedLocalName) return false;
42143
+ if (elementName === expectedLocalName) return true;
42144
+ if (elementName.endsWith(`:${expectedLocalName}`)) {
42145
+ const prefix2 = elementName.slice(0, -(expectedLocalName.length + 1));
42146
+ return prefix2.length > 0;
42147
+ }
42148
+ return false;
42149
+ }
42150
+ /**
42151
+ * Generic method to get a stored custom property from docx.
42152
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42153
+ *
42118
42154
  * @static
42119
42155
  * @param {Array} docx - Array of docx file objects
42120
42156
  * @param {string} propertyName - Name of the property to retrieve
42121
42157
  * @returns {string|null} The property value or null if not found
42158
+ *
42159
+ * Returns null in the following cases:
42160
+ * - docx array is empty or doesn't contain 'docProps/custom.xml'
42161
+ * - custom.xml cannot be parsed
42162
+ * - Properties element is not found (with or without namespace prefix)
42163
+ * - Property with the specified name is not found
42164
+ * - Property has malformed structure (missing nested elements or text)
42165
+ * - Any error occurs during parsing or retrieval
42166
+ *
42167
+ * @example
42168
+ * // Standard property without namespace prefix
42169
+ * const version = SuperConverter.getStoredCustomProperty(docx, 'SuperdocVersion');
42170
+ * // => '1.2.3'
42171
+ *
42172
+ * @example
42173
+ * // Property with namespace prefix (e.g., from Office 365)
42174
+ * const guid = SuperConverter.getStoredCustomProperty(docx, 'DocumentGuid');
42175
+ * // Works with both 'Properties' and 'op:Properties' elements
42176
+ * // => 'abc-123-def-456'
42177
+ *
42178
+ * @example
42179
+ * // Non-existent property
42180
+ * const missing = SuperConverter.getStoredCustomProperty(docx, 'NonExistent');
42181
+ * // => null
42122
42182
  */
42123
42183
  static getStoredCustomProperty(docx, propertyName) {
42124
42184
  try {
@@ -42127,10 +42187,16 @@ const _SuperConverter = class _SuperConverter2 {
42127
42187
  const converter = new _SuperConverter2();
42128
42188
  const content = customXml.content;
42129
42189
  const contentJson = converter.parseXmlToJson(content);
42130
- const properties = contentJson.elements?.find((el) => el.name === "Properties");
42190
+ const properties = contentJson?.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42131
42191
  if (!properties?.elements) return null;
42132
- const property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42192
+ const property2 = properties.elements.find(
42193
+ (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42194
+ );
42133
42195
  if (!property2) return null;
42196
+ if (!property2.elements?.[0]?.elements?.[0]?.text) {
42197
+ console.warn(`Malformed property structure for "${propertyName}"`);
42198
+ return null;
42199
+ }
42134
42200
  return property2.elements[0].elements[0].text;
42135
42201
  } catch (e) {
42136
42202
  console.warn(`Error getting custom property ${propertyName}:`, e);
@@ -42138,60 +42204,112 @@ const _SuperConverter = class _SuperConverter2 {
42138
42204
  }
42139
42205
  }
42140
42206
  /**
42141
- * Generic method to set a stored custom property in docx
42207
+ * Generic method to set a stored custom property in docx.
42208
+ * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
42209
+ *
42142
42210
  * @static
42143
- * @param {Object} docx - The docx object to store the property in
42211
+ * @param {Object} docx - The docx object to store the property in (converted XML structure)
42144
42212
  * @param {string} propertyName - Name of the property
42145
42213
  * @param {string|Function} value - Value or function that returns the value
42146
42214
  * @param {boolean} preserveExisting - If true, won't overwrite existing values
42147
- * @returns {string} The stored value
42215
+ * @returns {string|null} The stored value, or null if Properties element is not found
42216
+ *
42217
+ * @throws {Error} If an error occurs during property setting (logged as warning)
42218
+ *
42219
+ * @example
42220
+ * // Set a new property
42221
+ * const value = SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'MyValue');
42222
+ * // => 'MyValue'
42223
+ *
42224
+ * @example
42225
+ * // Set a property with a function
42226
+ * const guid = SuperConverter.setStoredCustomProperty(docx, 'DocumentGuid', () => uuidv4());
42227
+ * // => 'abc-123-def-456'
42228
+ *
42229
+ * @example
42230
+ * // Preserve existing value
42231
+ * SuperConverter.setStoredCustomProperty(docx, 'MyProperty', 'NewValue', true);
42232
+ * // => 'MyValue' (original value preserved)
42233
+ *
42234
+ * @example
42235
+ * // Works with namespace prefixes
42236
+ * // If docx has 'op:Properties' and 'op:property' elements, this will handle them correctly
42237
+ * const version = SuperConverter.setStoredCustomProperty(docx, 'Version', '2.0.0');
42238
+ * // => '2.0.0'
42148
42239
  */
42149
42240
  static setStoredCustomProperty(docx, propertyName, value, preserveExisting = false) {
42150
- const customLocation = "docProps/custom.xml";
42151
- if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42152
- const customXml = docx[customLocation];
42153
- const properties = customXml.elements?.find((el) => el.name === "Properties");
42154
- if (!properties) return null;
42155
- if (!properties.elements) properties.elements = [];
42156
- let property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
42157
- if (property2 && preserveExisting) {
42158
- return property2.elements[0].elements[0].text;
42159
- }
42160
- const finalValue = typeof value === "function" ? value() : value;
42161
- if (!property2) {
42162
- const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42163
- const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42164
- property2 = {
42165
- type: "element",
42166
- name: "property",
42167
- attributes: {
42168
- name: propertyName,
42169
- fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42170
- pid
42171
- },
42172
- elements: [
42173
- {
42174
- type: "element",
42175
- name: "vt:lpwstr",
42176
- elements: [
42177
- {
42178
- type: "text",
42179
- text: finalValue
42180
- }
42181
- ]
42182
- }
42183
- ]
42184
- };
42185
- properties.elements.push(property2);
42186
- } else {
42187
- property2.elements[0].elements[0].text = finalValue;
42241
+ try {
42242
+ const customLocation = "docProps/custom.xml";
42243
+ if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
42244
+ const customXml = docx[customLocation];
42245
+ const properties = customXml.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42246
+ if (!properties) return null;
42247
+ if (!properties.elements) properties.elements = [];
42248
+ let property2 = properties.elements.find(
42249
+ (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42250
+ );
42251
+ if (property2 && preserveExisting) {
42252
+ if (!property2.elements?.[0]?.elements?.[0]?.text) {
42253
+ console.warn(`Malformed existing property structure for "${propertyName}"`);
42254
+ return null;
42255
+ }
42256
+ return property2.elements[0].elements[0].text;
42257
+ }
42258
+ const finalValue = typeof value === "function" ? value() : value;
42259
+ if (!property2) {
42260
+ const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
42261
+ const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42262
+ property2 = {
42263
+ type: "element",
42264
+ name: "property",
42265
+ attributes: {
42266
+ name: propertyName,
42267
+ fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
42268
+ pid
42269
+ },
42270
+ elements: [
42271
+ {
42272
+ type: "element",
42273
+ name: "vt:lpwstr",
42274
+ elements: [
42275
+ {
42276
+ type: "text",
42277
+ text: finalValue
42278
+ }
42279
+ ]
42280
+ }
42281
+ ]
42282
+ };
42283
+ properties.elements.push(property2);
42284
+ } else {
42285
+ if (!property2.elements?.[0]?.elements?.[0]) {
42286
+ console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42287
+ property2.elements = [
42288
+ {
42289
+ type: "element",
42290
+ name: "vt:lpwstr",
42291
+ elements: [
42292
+ {
42293
+ type: "text",
42294
+ text: finalValue
42295
+ }
42296
+ ]
42297
+ }
42298
+ ];
42299
+ } else {
42300
+ property2.elements[0].elements[0].text = finalValue;
42301
+ }
42302
+ }
42303
+ return finalValue;
42304
+ } catch (e) {
42305
+ console.warn(`Error setting custom property ${propertyName}:`, e);
42306
+ return null;
42188
42307
  }
42189
- return finalValue;
42190
42308
  }
42191
42309
  static getStoredSuperdocVersion(docx) {
42192
42310
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42193
42311
  }
42194
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.61") {
42312
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.62") {
42195
42313
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42196
42314
  }
42197
42315
  /**
@@ -59380,7 +59498,7 @@ const isHeadless = (editor) => {
59380
59498
  const shouldSkipNodeView = (editor) => {
59381
59499
  return isHeadless(editor);
59382
59500
  };
59383
- const summaryVersion = "1.0.0-beta.61";
59501
+ const summaryVersion = "1.0.0-beta.62";
59384
59502
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59385
59503
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59386
59504
  function mapAttributes(attrs) {
@@ -60169,7 +60287,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60169
60287
  { default: remarkStringify },
60170
60288
  { default: remarkGfm }
60171
60289
  ] = await Promise.all([
60172
- import("./index-u8dj63PM-Bfomc8Z6.es.js"),
60290
+ import("./index-XOsGE2PW-hNAnvmsK.es.js"),
60173
60291
  import("./index-DRCvimau-Cw339678.es.js"),
60174
60292
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60175
60293
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60374,7 +60492,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60374
60492
  * Process collaboration migrations
60375
60493
  */
60376
60494
  processCollaborationMigrations() {
60377
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.61");
60495
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.62");
60378
60496
  if (!this.options.ydoc) return;
60379
60497
  const metaMap = this.options.ydoc.getMap("meta");
60380
60498
  let docVersion = metaMap.get("version");
@@ -64347,12 +64465,6 @@ const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
64347
64465
  resolveSpacingIndent: resolveSpacingIndent$1,
64348
64466
  scaleWrapPolygon
64349
64467
  }, Symbol.toStringTag, { value: "Module" }));
64350
- const extractHeaderFooterSpace = (margins) => {
64351
- return {
64352
- headerSpace: margins?.header ?? 0,
64353
- footerSpace: margins?.footer ?? 0
64354
- };
64355
- };
64356
64468
  const hasParagraphStyleContext = (context) => {
64357
64469
  return Boolean(context?.docx);
64358
64470
  };
@@ -72604,6 +72716,7 @@ const _DomPainter = class _DomPainter2 {
72604
72716
  container.style.height = `${data.height}px`;
72605
72717
  container.style.top = `${Math.max(0, offset2)}px`;
72606
72718
  container.style.zIndex = "1";
72719
+ container.style.overflow = "visible";
72607
72720
  let footerYOffset = 0;
72608
72721
  if (kind === "footer" && data.fragments.length > 0) {
72609
72722
  const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
@@ -81616,7 +81729,14 @@ async function measureParagraphBlock(block, maxWidth) {
81616
81729
  leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
81617
81730
  }
81618
81731
  }
81619
- const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
81732
+ let initialAvailableWidth;
81733
+ const isFirstLineIndentMode = wordLayout?.firstLineIndentMode === true;
81734
+ const textStartPx = wordLayout?.textStartPx;
81735
+ if (isFirstLineIndentMode && typeof textStartPx === "number" && textStartPx > 0) {
81736
+ initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
81737
+ } else {
81738
+ initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
81739
+ }
81620
81740
  const tabStops = buildTabStopsPx(
81621
81741
  indent,
81622
81742
  block.attrs?.tabs,
@@ -83592,7 +83712,9 @@ class HeaderFooterLayoutAdapter {
83592
83712
  const batch = {};
83593
83713
  let hasBlocks = false;
83594
83714
  descriptors.forEach((descriptor) => {
83595
- if (!descriptor.variant) return;
83715
+ if (!descriptor.variant) {
83716
+ return;
83717
+ }
83596
83718
  const blocks = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
83597
83719
  if (blocks && blocks.length > 0) {
83598
83720
  batch[descriptor.variant] = blocks;
@@ -86859,14 +86981,20 @@ computeHeaderFooterConstraints_fn = function() {
86859
86981
  const margins = __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
86860
86982
  const marginLeft = margins.left ?? DEFAULT_MARGINS.left;
86861
86983
  const marginRight = margins.right ?? DEFAULT_MARGINS.right;
86862
- const width = pageSize.w - (marginLeft + marginRight);
86863
- if (!Number.isFinite(width) || width <= 0) {
86984
+ const bodyContentWidth = pageSize.w - (marginLeft + marginRight);
86985
+ if (!Number.isFinite(bodyContentWidth) || bodyContentWidth <= 0) {
86864
86986
  return null;
86865
86987
  }
86866
- const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
86867
- const height = Math.max(headerSpace, footerSpace, 1);
86988
+ const measurementWidth = bodyContentWidth;
86989
+ const marginTop = margins.top ?? DEFAULT_MARGINS.top;
86990
+ const marginBottom = margins.bottom ?? DEFAULT_MARGINS.bottom;
86991
+ const headerMargin = margins.header ?? 0;
86992
+ const footerMargin = margins.footer ?? 0;
86993
+ const headerContentSpace = Math.max(marginTop - headerMargin, 0);
86994
+ const footerContentSpace = Math.max(marginBottom - footerMargin, 0);
86995
+ const height = Math.max(headerContentSpace, footerContentSpace, 1);
86868
86996
  return {
86869
- width,
86997
+ width: measurementWidth,
86870
86998
  height,
86871
86999
  // Pass actual page dimensions for page-relative anchor positioning in headers/footers
86872
87000
  pageWidth: pageSize.w,