superdoc 2.4.0-next.59 → 2.4.0-next.60

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.
@@ -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.59",
22
+ superdocVersion: "2.4.0-next.60",
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.59",
21
+ superdocVersion: "2.4.0-next.60",
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
@@ -1060,12 +1060,18 @@ export type VectorShapeStyle = {
1060
1060
  fillColor?: FillColor;
1061
1061
  strokeColor?: StrokeColor;
1062
1062
  strokeWidth?: number;
1063
+ /** Physical CSS-pixel dash/gap lengths resolved from the source stroke. */
1064
+ strokeDashArray?: number[];
1065
+ strokeLineJoin?: 'round' | 'bevel' | 'miter';
1066
+ strokeLineCap?: 'round' | 'square' | 'butt';
1063
1067
  /** Optional per-edge frame used by render-only table cells inside legacy shape groups. */
1064
1068
  borders?: CellBorders;
1065
1069
  lineEnds?: LineEnds;
1066
1070
  textContent?: ShapeTextContent;
1067
1071
  textAlign?: string;
1068
1072
  textVerticalAlign?: 'top' | 'center' | 'bottom';
1073
+ /** Legacy VML textbox text-flow semantics. */
1074
+ textFlow?: 'horizontal' | 'vertical' | 'vertical-ideographic' | 'horizontal-ideographic' | 'bottom-to-top';
1069
1075
  textInsets?: {
1070
1076
  top: number;
1071
1077
  right: number;
@@ -1146,11 +1152,15 @@ export type VectorShapeDrawing = DrawingBlockBase & {
1146
1152
  fillColor?: FillColor;
1147
1153
  strokeColor?: StrokeColor;
1148
1154
  strokeWidth?: number;
1155
+ strokeDashArray?: number[];
1156
+ strokeLineJoin?: 'round' | 'bevel' | 'miter';
1157
+ strokeLineCap?: 'round' | 'square' | 'butt';
1149
1158
  lineEnds?: LineEnds;
1150
1159
  effectExtent?: EffectExtent;
1151
1160
  textContent?: ShapeTextContent;
1152
1161
  textAlign?: string;
1153
1162
  textVerticalAlign?: 'top' | 'center' | 'bottom';
1163
+ textFlow?: 'horizontal' | 'vertical' | 'vertical-ideographic' | 'horizontal-ideographic' | 'bottom-to-top';
1154
1164
  textInsets?: {
1155
1165
  top: number;
1156
1166
  right: number;
@@ -1168,21 +1178,35 @@ export type TextboxDrawing = DrawingBlockBase & {
1168
1178
  fillColor?: FillColor;
1169
1179
  strokeColor?: StrokeColor;
1170
1180
  strokeWidth?: number;
1181
+ strokeDashArray?: number[];
1182
+ strokeLineJoin?: 'round' | 'bevel' | 'miter';
1183
+ strokeLineCap?: 'round' | 'square' | 'butt';
1171
1184
  lineEnds?: LineEnds;
1172
1185
  effectExtent?: EffectExtent;
1173
1186
  textContent?: ShapeTextContent;
1174
1187
  textAlign?: string;
1175
1188
  textVerticalAlign?: 'top' | 'center' | 'bottom';
1189
+ textFlow?: 'horizontal' | 'vertical' | 'vertical-ideographic' | 'horizontal-ideographic' | 'bottom-to-top';
1176
1190
  textInsets?: {
1177
1191
  top: number;
1178
1192
  right: number;
1179
1193
  bottom: number;
1180
1194
  left: number;
1181
1195
  };
1182
- contentBlocks: ParagraphBlock[];
1183
- /** Paragraph layout results for table-cell textboxes; populated by the layout bridge, read by the painter. */
1184
- contentMeasures?: ParagraphMeasure[];
1196
+ /**
1197
+ * Canonical block content owned by the textbox story.
1198
+ *
1199
+ * ECMA-376 permits general block-level WordprocessingML in `w:txbxContent`.
1200
+ * V2 currently supports paragraphs and tables explicitly; keeping this as a
1201
+ * named subset makes later block-family additions additive instead of
1202
+ * flattening rich content into drawing primitives.
1203
+ */
1204
+ contentBlocks: TextboxContentBlock[];
1205
+ /** Canonical layout results for textbox content; populated by measurement or the layout bridge. */
1206
+ contentMeasures?: TextboxContentMeasure[];
1185
1207
  };
1208
+ export type TextboxContentBlock = ParagraphBlock | TableBlock;
1209
+ export type TextboxContentMeasure = ParagraphMeasure | TableMeasure;
1186
1210
  export type ShapeGroupDrawing = DrawingBlockBase & {
1187
1211
  drawingKind: 'shapeGroup';
1188
1212
  geometry: DrawingGeometry;
@@ -1254,6 +1278,13 @@ export type SectionBreakBlock = {
1254
1278
  kind: 'sectionBreak';
1255
1279
  id: BlockId;
1256
1280
  type?: 'continuous' | 'nextPage' | 'evenPage' | 'oddPage';
1281
+ /**
1282
+ * Physical page parity required for a `nextPage` break. Word derives this
1283
+ * when distinct odd/even headers are enabled and the new section explicitly
1284
+ * restarts page numbering; authored `evenPage`/`oddPage` breaks express the
1285
+ * same constraint through `type` instead.
1286
+ */
1287
+ requiredPageParity?: 'even' | 'odd';
1257
1288
  pageSize?: {
1258
1289
  w: number;
1259
1290
  h: number;
@@ -2093,8 +2124,8 @@ export type DrawingMeasure = {
2093
2124
  naturalHeight: number;
2094
2125
  geometry: DrawingGeometry;
2095
2126
  groupTransform?: ShapeGroupTransform;
2096
- /** Canonical paragraph measurements for textbox content, when the drawing owns text. */
2097
- contentMeasures?: ParagraphMeasure[];
2127
+ /** Canonical block measurements for textbox content, when the drawing owns a textbox story. */
2128
+ contentMeasures?: TextboxContentMeasure[];
2098
2129
  };
2099
2130
  export type TableCellMeasure = {
2100
2131
  /** Multi-block cell measurements (new feature) */
@@ -2223,6 +2254,13 @@ export type FootnotePageLedger = {
2223
2254
  export type Page = {
2224
2255
  number: number;
2225
2256
  fragments: Fragment[];
2257
+ /**
2258
+ * Suppress header/footer stories on a physically inserted parity page.
2259
+ * Word emits these pages to satisfy odd/even section starts, but leaves the
2260
+ * page itself completely blank and does not treat it as page one of the new
2261
+ * section.
2262
+ */
2263
+ suppressHeaderFooter?: boolean;
2226
2264
  margins?: PageMargins;
2227
2265
  /**
2228
2266
  * Extra bottom space reserved on this page for footnotes (in px).
@@ -2456,7 +2494,7 @@ export type DrawingFragment = {
2456
2494
  drawingContentId?: string;
2457
2495
  /** V2 textbox story id for DrawingML textbox content painted inside this drawing. */
2458
2496
  textboxId?: string;
2459
- contentMeasures?: ParagraphMeasure[];
2497
+ contentMeasures?: TextboxContentMeasure[];
2460
2498
  pmStart?: number;
2461
2499
  pmEnd?: number;
2462
2500
  sourceAnchor?: SourceAnchor;
@@ -1,4 +1,4 @@
1
- import { DrawingBlock, DrawingMeasure, ParagraphMeasure } from '../../contracts/src/index.js';
1
+ import { DrawingBlock, DrawingMeasure, TextboxContentMeasure } from '../../contracts/src/index.js';
2
2
  import { NormalizedColumns } from './layout-image.js';
3
3
  import { PageState } from './paginator.js';
4
4
  /**
@@ -21,8 +21,8 @@ export type DrawingLayoutContext = {
21
21
  advanceColumn: (state: PageState) => PageState;
22
22
  /** Computes the X coordinate for a column in the given page state (SD-2629). */
23
23
  columnX: (state: PageState, columnIndex?: number) => number;
24
- /** Optional textbox paragraph measurements carried alongside textbox drawings. */
25
- textboxContentMeasures?: ParagraphMeasure[];
24
+ /** Optional canonical textbox block measurements carried alongside textbox drawings. */
25
+ textboxContentMeasures?: TextboxContentMeasure[];
26
26
  };
27
27
  /**
28
28
  * Layout a drawing block (vector shape) within the document flow.
@@ -1,4 +1,4 @@
1
- import { DrawingMeasure, ParagraphMeasure, TextboxDrawing } from '../../contracts/src/index.js';
2
- export declare function layoutTextboxContent(block: TextboxDrawing, remeasureParagraph: (block: TextboxDrawing['contentBlocks'][number], maxWidth: number) => ParagraphMeasure): ParagraphMeasure[];
1
+ import { DrawingMeasure, ParagraphBlock, ParagraphMeasure, TextboxContentMeasure, TextboxDrawing } from '../../contracts/src/index.js';
2
+ export declare function layoutTextboxContent(block: TextboxDrawing, remeasureParagraph: (block: ParagraphBlock, maxWidth: number) => ParagraphMeasure): ParagraphMeasure[] | undefined;
3
3
  /** Prefer canonical measurement output, retaining the synchronous bridge as a legacy fallback. */
4
- export declare function resolveTextboxContentMeasures(block: TextboxDrawing, measure: DrawingMeasure, remeasureParagraph?: (block: TextboxDrawing['contentBlocks'][number], maxWidth: number) => ParagraphMeasure): ParagraphMeasure[] | undefined;
4
+ export declare function resolveTextboxContentMeasures(block: TextboxDrawing, measure: DrawingMeasure, remeasureParagraph?: (block: ParagraphBlock, maxWidth: number) => ParagraphMeasure): TextboxContentMeasure[] | undefined;
@@ -94,7 +94,9 @@ export type PaginatorOptions = {
94
94
  w: number;
95
95
  h: number;
96
96
  }): Page;
97
- onNewPage?: (state: PageState) => void;
97
+ onNewPage?: (state: PageState | undefined, options?: {
98
+ applyPendingSection: boolean;
99
+ }) => void;
98
100
  shouldStopBeforeNewPage?: (input: {
99
101
  completedPageIndex: number;
100
102
  pages: readonly Page[];
@@ -122,7 +124,10 @@ export declare function breakParagraphAdjacency(state: PageState): void;
122
124
  export declare function createPaginator(opts: PaginatorOptions): {
123
125
  readonly pages: Page[];
124
126
  readonly states: PageState[];
125
- readonly startNewPage: () => PageState;
127
+ readonly startNewPage: (options?: {
128
+ applyPendingSection?: boolean;
129
+ replaceCurrentPage?: boolean;
130
+ }) => PageState;
126
131
  readonly ensurePage: () => PageState;
127
132
  readonly advanceColumn: (state: PageState) => PageState;
128
133
  readonly getActiveColumnsForState: (state: PageState) => ColumnLayout;
@@ -520,6 +520,14 @@ export declare class DomPainter {
520
520
  * Apply fill and stroke styles to a fallback shape container
521
521
  */
522
522
  private applyFallbackShapeStyle;
523
+ /**
524
+ * Shape stroke widths reach the painter in physical CSS pixels. Preset SVGs
525
+ * use a normalized 100 × 100 viewBox while VML custom geometry often uses a
526
+ * coordsize in the thousands. In both cases allowing the viewBox transform to
527
+ * scale the stroke changes the authored line weight, sometimes by orders of
528
+ * magnitude. Keep geometry scalable and paint the resolved width verbatim.
529
+ */
530
+ private applyPhysicalStrokeSemantics;
523
531
  private hasShapeTextContent;
524
532
  private createShapeTextElement;
525
533
  private createTextboxContentElement;
@@ -540,6 +548,7 @@ export declare class DomPainter {
540
548
  * @param _groupScaleY - Reserved parent-group scale factor
541
549
  */
542
550
  private createFallbackTextElement;
551
+ private applyShapeTextFlow;
543
552
  private tryCreatePresetSvg;
544
553
  /**
545
554
  * Creates an SVG string from custom geometry path data (a:custGeom).
@@ -566,6 +575,9 @@ export declare class DomPainter {
566
575
  */
567
576
  private createChartElement;
568
577
  private resolveTableRenderData;
578
+ private createTableCellLineRenderer;
579
+ /** Render drawing content nested in any canonical table, including a textbox-owned table. */
580
+ private renderDrawingContentForTable;
569
581
  private renderTableFragment;
570
582
  private renderLine;
571
583
  private createRunRenderContext;
@@ -39,7 +39,7 @@ export type TableRenderDependencies = {
39
39
  /** Built-in SDT chrome rendering mode. */
40
40
  chrome?: 'default' | 'none';
41
41
  /** Function to render a line of paragraph content */
42
- renderLine: (block: ParagraphBlock, line: Line, context: FragmentRenderContext, lineIndex: number, isLastLine: boolean) => HTMLElement;
42
+ renderLine: (block: ParagraphBlock, line: Line, context: FragmentRenderContext, lineIndex: number, isLastLine: boolean, resolvedListTextStartPx?: number) => HTMLElement;
43
43
  /** Optional callback invoked after a table line's final styles/markers are applied. */
44
44
  captureLineSnapshot?: (lineEl: HTMLElement, context: FragmentRenderContext, options?: {
45
45
  inTableParagraph?: boolean;
package/dist/superdoc.cjs CHANGED
@@ -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.59";
43264
+ this.version = "2.4.0-next.60";
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 ?? [];
@@ -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.59";
43197
+ this.version = "2.4.0-next.60";
43198
43198
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43199
43199
  this.superdocId = config.superdocId || v4();
43200
43200
  this.colors = this.config.colors ?? [];