superdoc 2.4.0-next.50 → 2.4.0-next.52

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.
@@ -13,6 +13,8 @@ var DOM_CLASS_NAMES = {
13
13
  PAGE: "superdoc-page",
14
14
  /** Fragment container (paragraph, table, image block, etc.). */
15
15
  FRAGMENT: "superdoc-fragment",
16
+ /** Non-flowing fragment whose visual position must not define body flow geometry. */
17
+ FLOATING_FRAGMENT: "superdoc-floating-fragment",
16
18
  /** Line container within a fragment. */
17
19
  LINE: "superdoc-line",
18
20
  /**
@@ -13,6 +13,8 @@ var DOM_CLASS_NAMES = {
13
13
  PAGE: "superdoc-page",
14
14
  /** Fragment container (paragraph, table, image block, etc.). */
15
15
  FRAGMENT: "superdoc-fragment",
16
+ /** Non-flowing fragment whose visual position must not define body flow geometry. */
17
+ FLOATING_FRAGMENT: "superdoc-floating-fragment",
16
18
  /** Line container within a fragment. */
17
19
  LINE: "superdoc-line",
18
20
  /**
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.4.0-next.50",
22
+ superdocVersion: "2.4.0-next.52",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.4.0-next.50",
21
+ superdocVersion: "2.4.0-next.52",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,7 +1,19 @@
1
- type AnchorVRelative = 'paragraph' | 'page' | 'margin';
2
- type AnchorHRelative = 'column' | 'page' | 'margin';
3
- type AnchorAlignH = 'left' | 'center' | 'right';
4
- type AnchorAlignV = 'top' | 'center' | 'bottom';
1
+ /** ECMA-376 Part 1 §20.4.3.4 (`ST_RelFromH`). */
2
+ export declare const ANCHOR_H_RELATIVE_VALUES: readonly ["margin", "page", "column", "character", "leftMargin", "rightMargin", "insideMargin", "outsideMargin"];
3
+ /** ECMA-376 Part 1 §20.4.3.5 (`ST_RelFromV`). */
4
+ export declare const ANCHOR_V_RELATIVE_VALUES: readonly ["margin", "page", "paragraph", "line", "topMargin", "bottomMargin", "insideMargin", "outsideMargin"];
5
+ /** ECMA-376 Part 1 §20.4.3.1 (`ST_AlignH`). */
6
+ export declare const ANCHOR_H_ALIGN_VALUES: readonly ["left", "right", "center", "inside", "outside"];
7
+ /** ECMA-376 Part 1 §20.4.3.2 (`ST_AlignV`). */
8
+ export declare const ANCHOR_V_ALIGN_VALUES: readonly ["top", "bottom", "center", "inside", "outside"];
9
+ export type AnchorHRelative = (typeof ANCHOR_H_RELATIVE_VALUES)[number];
10
+ export type AnchorVRelative = (typeof ANCHOR_V_RELATIVE_VALUES)[number];
11
+ export type AnchorAlignH = (typeof ANCHOR_H_ALIGN_VALUES)[number];
12
+ export type AnchorAlignV = (typeof ANCHOR_V_ALIGN_VALUES)[number];
13
+ export declare function isAnchorHRelative(value: unknown): value is AnchorHRelative;
14
+ export declare function isAnchorVRelative(value: unknown): value is AnchorVRelative;
15
+ export declare function isAnchorAlignH(value: unknown): value is AnchorAlignH;
16
+ export declare function isAnchorAlignV(value: unknown): value is AnchorAlignV;
5
17
  export declare function isPositionedParagraphFrame<T extends {
6
18
  wrap?: string;
7
19
  }>(frame: T | undefined): frame is T & {
@@ -35,6 +47,10 @@ export type ColumnLayoutForAnchor = {
35
47
  */
36
48
  export type ResolveAnchoredGraphicYInput = {
37
49
  anchor?: {
50
+ simplePos?: {
51
+ x: number;
52
+ y: number;
53
+ };
38
54
  vRelativeFrom?: AnchorVRelative;
39
55
  alignV?: AnchorAlignV;
40
56
  offsetV?: number;
@@ -49,8 +65,12 @@ export type ResolveAnchoredGraphicYInput = {
49
65
  * Used for `paragraph` and legacy (undefined vRelativeFrom) positioning.
50
66
  */
51
67
  anchorParagraphY?: number;
68
+ /** Anchor line top Y. Falls back to the paragraph top when unavailable. */
69
+ anchorLineY?: number;
52
70
  /** First line height of the anchor paragraph (paragraph-relative alignV). */
53
71
  firstLineHeight?: number;
72
+ /** One-based physical page number, used by inside/outside placement. */
73
+ pageNumber?: number;
54
74
  /**
55
75
  * When true, anchor has no host paragraph (pre-registered / paragraphless layout).
56
76
  * For `vRelativeFrom: 'paragraph'`, use `contentTop + offsetV` instead of alignV on a
@@ -62,15 +82,24 @@ export type ResolveAnchoredGraphicYInput = {
62
82
  * Resolve the vertical paint position for an anchored graphic (image, drawing, or table).
63
83
  */
64
84
  export declare function resolveAnchoredGraphicY(input: ResolveAnchoredGraphicYInput): number;
85
+ export type ResolveAnchoredGraphicXContext = {
86
+ /** One-based physical page number, used by inside/outside placement. */
87
+ pageNumber?: number;
88
+ /** Page-space X of the anchor character. Falls back to the column origin. */
89
+ anchorCharacterX?: number;
90
+ };
65
91
  /**
66
92
  * Resolve horizontal paint position for an anchored graphic.
67
93
  */
68
94
  export declare function resolveAnchoredGraphicX(anchor: {
95
+ simplePos?: {
96
+ x: number;
97
+ y: number;
98
+ };
69
99
  hRelativeFrom?: AnchorHRelative;
70
100
  alignH?: AnchorAlignH;
71
101
  offsetH?: number;
72
102
  }, columnIndex: number, columns: ColumnLayoutForAnchor, objectWidth: number, margins?: {
73
103
  left?: number;
74
104
  right?: number;
75
- }, pageWidth?: number): number;
76
- export {};
105
+ }, pageWidth?: number, context?: ResolveAnchoredGraphicXContext): number;
@@ -1,6 +1,7 @@
1
1
  import { TabStop } from './engines/tabs.js';
2
2
  import { PageNumberChapterSeparator, PageNumberFieldFormat, PageNumberFormat } from './page-number-formatting.js';
3
3
  import { TrackedChangeSemanticColorKey } from './semantic-colors.js';
4
+ import { AnchorAlignH, AnchorAlignV, AnchorHRelative, AnchorVRelative } from './graphic-placement.js';
4
5
  import { ParagraphDirectionContext, RunBidiContext, RunScriptContext, TableDirectionContext } from './direction-context.js';
5
6
  import { LayoutSourceIdentity } from './layout-identity.js';
6
7
  export { computeTabStops, layoutWithTabs, calculateTabWidth } from './engines/tabs.js';
@@ -17,7 +18,7 @@ export { shouldApplyJustify, calculateJustifySpacing, getFirstLineIndentOffset,
17
18
  export { parseInsetClipPathForScale, formatInsetClipPathTransform, type InsetClipPathScale, } from './clip-path-inset.js';
18
19
  export { SUBSCRIPT_SUPERSCRIPT_SCALE, normalizeBaselineShift, hasExplicitBaselineShift, isSuperscriptOrSubscript, usesDefaultScriptLayout, scaleFontSizeForVerticalText, resolveBaseFontSizeForVerticalText, type VerticalTextAlign, } from './vertical-text.js';
19
20
  export { computeFragmentPmRange, computeLinePmRange, type LinePmRange } from './pm-range.js';
20
- export { resolveAnchoredGraphicY, resolveAnchoredGraphicX, resolveFooterPageFrameOriginY, isPositionedParagraphFrame, isPagePositionedParagraphFrame, type ColumnLayoutForAnchor, type ResolveAnchoredGraphicYInput, } from './graphic-placement.js';
21
+ export { resolveAnchoredGraphicY, resolveAnchoredGraphicX, resolveFooterPageFrameOriginY, isPositionedParagraphFrame, isPagePositionedParagraphFrame, isAnchorHRelative, isAnchorVRelative, isAnchorAlignH, isAnchorAlignV, ANCHOR_H_RELATIVE_VALUES, ANCHOR_V_RELATIVE_VALUES, ANCHOR_H_ALIGN_VALUES, ANCHOR_V_ALIGN_VALUES, type ColumnLayoutForAnchor, type ResolveAnchoredGraphicYInput, type ResolveAnchoredGraphicXContext, type AnchorHRelative, type AnchorVRelative, type AnchorAlignH, type AnchorAlignV, } from './graphic-placement.js';
21
22
  export { LAYOUT_BOUNDARY_SCHEMA, bodyStoryLocator, namedStoryLocator, computeLayoutFragmentId, buildLayoutSourceIdentity, buildLayoutSourceIdentityForFragment, } from './layout-identity.js';
22
23
  export type { LayoutBlockRef, LayoutFragmentId, LayoutPartialRowIdentity, LayoutSourceIdentity, LayoutStoryKind, LayoutStoryLocator, } from './layout-identity.js';
23
24
  export { LAYOUT_SEGMENT_GEOMETRY_SCHEMA } from './segment-geometry.js';
@@ -1350,12 +1351,21 @@ export type ColumnBreakBlock = {
1350
1351
  /** Positioning for anchored images (offsets in CSS px). */
1351
1352
  export type ImageAnchor = {
1352
1353
  isAnchored?: boolean;
1354
+ /**
1355
+ * Page-space coordinates from `wp:simplePos` in CSS px.
1356
+ * ECMA-376 Part 1 §20.4.2.13: when present because `wp:anchor/@simplePos`
1357
+ * is true, these coordinates override positionH/positionV.
1358
+ */
1359
+ simplePos?: {
1360
+ x: number;
1361
+ y: number;
1362
+ };
1353
1363
  /** Keep the anchored object inside its table cell and resize the cell as needed. */
1354
1364
  layoutInCell?: boolean;
1355
- hRelativeFrom?: 'column' | 'page' | 'margin';
1356
- vRelativeFrom?: 'paragraph' | 'page' | 'margin';
1357
- alignH?: 'left' | 'center' | 'right';
1358
- alignV?: 'top' | 'center' | 'bottom';
1365
+ hRelativeFrom?: AnchorHRelative;
1366
+ vRelativeFrom?: AnchorVRelative;
1367
+ alignH?: AnchorAlignH;
1368
+ alignV?: AnchorAlignV;
1359
1369
  offsetH?: number;
1360
1370
  offsetV?: number;
1361
1371
  behindDoc?: boolean;
@@ -1371,6 +1381,7 @@ export type ImageAnchor = {
1371
1381
  */
1372
1382
  export declare function isPageRelativeAnchor(input: {
1373
1383
  anchor?: {
1384
+ simplePos?: unknown;
1374
1385
  vRelativeFrom?: unknown;
1375
1386
  } | null;
1376
1387
  } | null | undefined): boolean;
@@ -2476,6 +2487,18 @@ export type HeaderFooterType = 'default' | 'first' | 'even' | 'odd';
2476
2487
  export type HeaderFooterPage = {
2477
2488
  number: number;
2478
2489
  fragments: Fragment[];
2490
+ /**
2491
+ * Measurement height for this page's resolved story content. PAGE/NUMPAGES
2492
+ * fields can wrap differently across physical pages, so paint alignment must
2493
+ * not substitute the layout-wide maximum for this value.
2494
+ */
2495
+ measurementHeight?: number;
2496
+ /** Per-page minimum rendered y, including out-of-band decorations. */
2497
+ minY?: number;
2498
+ /** Per-page maximum rendered y + fragment height. */
2499
+ maxY?: number;
2500
+ /** Per-page visual extent (`maxY - minY`). */
2501
+ renderHeight?: number;
2479
2502
  numberText?: string;
2480
2503
  /** Section-aware numeric page value before formatting. */
2481
2504
  displayNumber?: number;
@@ -476,6 +476,11 @@ export declare function isResolvedDrawingItem(item: ResolvedPaintItem): item is
476
476
  /** A resolved header/footer page — mirrors HeaderFooterPage but with resolved items. */
477
477
  export type ResolvedHeaderFooterPage = {
478
478
  number: number;
479
+ /** Page-local measurement height; see `HeaderFooterPage.measurementHeight`. */
480
+ measurementHeight?: number;
481
+ minY?: number;
482
+ maxY?: number;
483
+ renderHeight?: number;
479
484
  numberText?: string;
480
485
  /** Section-aware numeric page value before formatting. */
481
486
  displayNumber?: number;
@@ -12,6 +12,8 @@ export declare const DOM_CLASS_NAMES: {
12
12
  readonly PAGE: "superdoc-page";
13
13
  /** Fragment container (paragraph, table, image block, etc.). */
14
14
  readonly FRAGMENT: "superdoc-fragment";
15
+ /** Non-flowing fragment whose visual position must not define body flow geometry. */
16
+ readonly FLOATING_FRAGMENT: "superdoc-floating-fragment";
15
17
  /** Line container within a fragment. */
16
18
  readonly LINE: "superdoc-line";
17
19
  /**
@@ -1,4 +1,4 @@
1
- import { ImageBlock, ImageMeasure, ExclusionZone, DrawingBlock, DrawingMeasure, TableBlock, TableMeasure, ColumnLayoutForAnchor } from '../../contracts/src/index.js';
1
+ import { ImageBlock, ImageMeasure, ExclusionZone, DrawingBlock, DrawingMeasure, TableBlock, TableMeasure, ColumnLayoutForAnchor, ResolveAnchoredGraphicXContext } from '../../contracts/src/index.js';
2
2
  type FloatBlock = ImageBlock | DrawingBlock;
3
3
  type FloatMeasure = ImageMeasure | DrawingMeasure;
4
4
  export type FloatingObjectManager = {
@@ -69,5 +69,5 @@ export declare function createFloatingObjectManager(columns: ColumnLayout, margi
69
69
  export declare function computeAnchorX(anchor: NonNullable<ImageBlock['anchor']>, columnIndex: number, columns: ColumnLayout, imageWidth: number, margins?: {
70
70
  left?: number;
71
71
  right?: number;
72
- }, pageWidth?: number): number;
72
+ }, pageWidth?: number, context?: ResolveAnchoredGraphicXContext): number;
73
73
  export {};
@@ -0,0 +1,9 @@
1
+ import { FlowBlock, Measure, Page } from '../../contracts/src/index.js';
2
+ /**
3
+ * Word baseline-aligns an inline zero-height connector with the run that owns
4
+ * it. Projection keeps vector drawings as sibling blocks, so the connector has
5
+ * already reserved its authored flow height before the empty carrier paragraph
6
+ * is laid out. Reposition only its paint fragment once that carrier's measured
7
+ * baseline is known; later flow remains untouched.
8
+ */
9
+ export declare function alignInlineZeroHeightDrawingFragments(pages: Page[], blocks: FlowBlock[], measures: Measure[]): void;
@@ -600,6 +600,12 @@ export declare class DomPainter {
600
600
  * Uses resolved data for spatial properties and delegates PM attributes to the legacy path.
601
601
  */
602
602
  private isAnchoredMediaFragment;
603
+ /**
604
+ * Marks fragments whose paint coordinates are independent from body flow.
605
+ * DOM consumers such as header/footer hit-testing must not infer page margins
606
+ * from floating objects that happen to paint above the first flow block.
607
+ */
608
+ private applyFragmentFlowClass;
603
609
  private shouldRenderBehindPageContent;
604
610
  private isHeaderWordArtWatermark;
605
611
  private isVmlTextWatermarkImage;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C7loo2YE.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-DNtHxzz_.cjs");
3
3
  let react = require("react");
4
4
  //#region src/public/ui/react.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-C6qsVKMY.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-B_1l545i.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  //#region src/public/ui/react.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C7loo2YE.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-DNtHxzz_.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-C6qsVKMY.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-B_1l545i.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
package/dist/superdoc.cjs CHANGED
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
4
  const require_eventemitter3 = require("./chunks/eventemitter3-D38u8ta_.cjs");
5
5
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
6
6
  const require_jszip = require("./chunks/jszip-RC64TPzL.cjs");
7
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-C7loo2YE.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-DNtHxzz_.cjs");
8
8
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-SDR04tiH.cjs");
9
9
  const require_constants = require("./chunks/constants-DpXuDx_g.cjs");
10
10
  let vue = require("vue");
@@ -43261,7 +43261,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43261
43261
  this.config.colors = shuffleArray(this.config.colors);
43262
43262
  this.userColorMap = /* @__PURE__ */ new Map();
43263
43263
  this.colorIndex = 0;
43264
- this.version = "2.4.0-next.50";
43264
+ this.version = "2.4.0-next.52";
43265
43265
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43266
43266
  this.superdocId = config.superdocId || require_uuid.v4();
43267
43267
  this.colors = this.config.colors ?? [];
@@ -3,7 +3,7 @@ import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
3
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-CMOjDs74.es.js";
4
4
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
5
5
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-VxCFV9YS.es.js";
6
- import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-C6qsVKMY.es.js";
6
+ import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-B_1l545i.es.js";
7
7
  import { t as _plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-BOaGB7Aw.es.js";
8
8
  import { t as PDF_TO_CSS_UNITS } from "./chunks/constants-B6VBlmKp.es.js";
9
9
  import * as Vue from "vue";
@@ -43194,7 +43194,7 @@ var SuperDoc = class extends import_eventemitter3.default {
43194
43194
  this.config.colors = shuffleArray(this.config.colors);
43195
43195
  this.userColorMap = /* @__PURE__ */ new Map();
43196
43196
  this.colorIndex = 0;
43197
- this.version = "2.4.0-next.50";
43197
+ this.version = "2.4.0-next.52";
43198
43198
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43199
43199
  this.superdocId = config.superdocId || v4();
43200
43200
  this.colors = this.config.colors ?? [];