superdoc 2.22.0-next.15 → 2.22.0-next.16

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.22.0-next.15",
22
+ superdocVersion: "2.22.0-next.16",
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.22.0-next.15",
21
+ superdocVersion: "2.22.0-next.16",
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
@@ -840,6 +840,8 @@ export declare const isExplicitNoneBorder: (border?: unknown) => boolean;
840
840
  */
841
841
  export declare const resolveBorderConflict: (first?: BorderSpec, second?: BorderSpec) => BorderSpec | undefined;
842
842
  export type TableCellAttrs = {
843
+ /** Resolved ordinary Latin text rotation from w:tcPr/w:textDirection. */
844
+ textDirection?: 'btLr' | 'tbRl';
843
845
  borders?: CellBorders;
844
846
  padding?: BoxSpacing;
845
847
  verticalAlign?: 'top' | 'middle' | 'center' | 'bottom';
@@ -891,6 +893,8 @@ export type TableCell = {
891
893
  attrs?: TableCellAttrs;
892
894
  sourceAnchor?: SourceAnchor;
893
895
  };
896
+ /** Read the resolved cell axis, with compatibility for older raw carriers. */
897
+ export declare function getTableCellTextDirection(attrs: TableCellAttrs | undefined): 'btLr' | 'tbRl' | undefined;
894
898
  export type TableRowProperties = {
895
899
  repeatHeader?: boolean;
896
900
  cantSplit?: boolean;
@@ -1671,13 +1675,9 @@ export declare function allExplicitColumnWidthsEqual(widths: readonly number[]):
1671
1675
  /**
1672
1676
  * Shared "genuinely unequal explicit column widths" predicate (SD-2324).
1673
1677
  *
1674
- * The layout engine skips end-of-section column balancing exactly when this
1675
- * is true: Word fills genuinely-unequal explicit columns column-by-column
1676
- * rather than rebalancing them. Host retained-layout dependency scanning
1677
- * (SD-3772) consumes the same predicate so checkpoint admission can never
1678
- * drift from the engine's balancing semantics. Explicit widths that are all
1679
- * EQUAL (`equalWidth="0"` with every `<w:col w:w>` equal) still balance like
1680
- * implicit equal columns and are NOT genuinely unequal.
1678
+ * Unequal geometry requires width-aware paragraph reflow during balancing;
1679
+ * equal explicit widths can use the same fixed-line balancing as implicit
1680
+ * equal columns. This predicate describes geometry, not balancing eligibility.
1681
1681
  */
1682
1682
  export declare function hasGenuinelyUnequalExplicitColumnWidths(columns: {
1683
1683
  equalWidth?: boolean | undefined;
@@ -2067,6 +2067,8 @@ export type ParagraphAttrs = {
2067
2067
  * See `@superdoc/contracts/direction-context` for axis semantics.
2068
2068
  */
2069
2069
  directionContext?: ParagraphDirectionContext;
2070
+ /** Authored paragraph writing-mode override; kept distinct from inherited cell rotation. */
2071
+ textDirection?: string;
2070
2072
  isTocEntry?: boolean;
2071
2073
  tocInstruction?: string;
2072
2074
  /** Stable id shared by every paragraph in the same TOC (docPartObj uniqueId or parent sdBlockId). */
@@ -2413,6 +2415,12 @@ export type TableCellMeasure = {
2413
2415
  paragraph?: ParagraphMeasure;
2414
2416
  width: number;
2415
2417
  height: number;
2418
+ /** Resolved whole-cell rotated flow; dimensions exclude physical padding/borders. */
2419
+ verticalText?: {
2420
+ direction: 'btLr' | 'tbRl';
2421
+ inlineSize: number;
2422
+ blockSize: number;
2423
+ };
2416
2424
  /** Starting grid column index (0-based) */
2417
2425
  gridColumnStart?: number;
2418
2426
  /** Number of grid columns this cell spans */
@@ -372,8 +372,7 @@ export type IncrementalPaginationProof = IncrementalPaginationProofBase & ({
372
372
  predecessorBlockId: string | null;
373
373
  };
374
374
  /**
375
- * SD-3772 D1: true means the host proved (via the shared
376
- * `hasGenuinelyUnequalExplicitColumnWidths` predicate) that no
375
+ * SD-3772 D1: true means the host proved that no
377
376
  * potentially balanceable multi-column section exists anywhere in the
378
377
  * retained document. Balancing is a post-pagination finalizer that a
379
378
  * mid-section checkpoint cannot seed. False is admissible only
@@ -250,8 +250,8 @@ export interface BalanceSectionOnPageArgs {
250
250
  * Guards (skip balancing when):
251
251
  * - Section has <= 1 column (nothing to balance)
252
252
  * - Section contains an explicit column break (author intent wins)
253
- * - Section uses GENUINELY-unequal column widths (Word fills these column-by-column;
254
- * explicit widths that are all equal still balance — SD-2324)
253
+ * - Section uses genuinely unequal widths, which require width-aware reflow
254
+ * rather than this redistribution of fixed line measurements
255
255
  * - No fragments on this page belong to the section
256
256
  */
257
257
  export declare function balanceSectionOnPage(args: BalanceSectionOnPageArgs): {
@@ -3,7 +3,7 @@ import { FootnotePageFlow } from './footnote-page-flow.js';
3
3
  import { PageState, ConstraintBoundary } from './paginator.js';
4
4
  import { LayoutExecutionControl } from './execution.js';
5
5
  export type { FootnotePageFlow } from './footnote-page-flow.js';
6
- export { findLineIndexForRunOrdinal } from './layout-utils.js';
6
+ export { findLineIndexForRunOrdinal, findKeepNextChainStart, isOutOfFlowDrawing } from './layout-utils.js';
7
7
  type PageSize = {
8
8
  w: number;
9
9
  h: number;
@@ -21,6 +21,7 @@ export type ParagraphLayoutContext = {
21
21
  block: ParagraphBlock;
22
22
  measure: ParagraphMeasure;
23
23
  columnWidth: number;
24
+ columnWidthForState?: (state: PageState) => number;
24
25
  ensurePage: () => PageState;
25
26
  advanceColumn: (state: PageState) => PageState;
26
27
  columnX: (state: PageState, columnIndex?: number) => number;
@@ -32,6 +33,8 @@ export type ParagraphLayoutContext = {
32
33
  * When undefined, uses the value from block.attrs.spacing.after.
33
34
  */
34
35
  overrideSpacingAfter?: number;
36
+ /** A keep-next preflight moved this paragraph to a fresh page. */
37
+ suppressSpacingBefore?: boolean;
35
38
  /**
36
39
  * SD-3049 / SD-2656: footnote demand under the ordered-cluster rule.
37
40
  *
@@ -1,4 +1,4 @@
1
- import { Line, ParagraphBlock, ParagraphMeasure, LinePmRange } from '../../contracts/src/index.js';
1
+ import { FlowBlock, Line, ParagraphBlock, ParagraphMeasure, LinePmRange } from '../../contracts/src/index.js';
2
2
  /**
3
3
  * Tracks which paragraph spacing properties were explicitly set.
4
4
  *
@@ -104,3 +104,7 @@ export declare function computeParagraphLayoutStartY(input: {
104
104
  export declare const extractBlockPmRange: (block: {
105
105
  attrs?: Record<string, unknown>;
106
106
  } | null | undefined) => LinePmRange;
107
+ /** Positioned drawings are laid out by their owner, rather than consuming a flow slot. */
108
+ export declare function isOutOfFlowDrawing(block: FlowBlock): boolean;
109
+ /** Find the kept paragraph whose page decision also owns this flow block. */
110
+ export declare function findKeepNextChainStart(blocks: readonly FlowBlock[], index: number): number;
@@ -0,0 +1,6 @@
1
+ import { Line, ParagraphBlock } from '../../contracts/src/index.js';
2
+ /** Build a measurement-only suffix while keeping line coordinates in the original paragraph. */
3
+ export declare function paragraphContinuation(block: ParagraphBlock, first: Line): {
4
+ block: ParagraphBlock;
5
+ mapLine: (line: Line) => Line;
6
+ };
package/dist/superdoc.cjs CHANGED
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
316
316
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
317
317
  function getSuperdocVersion() {
318
318
  try {
319
- return "2.22.0-next.15";
319
+ return "2.22.0-next.16";
320
320
  } catch {
321
321
  return "unknown";
322
322
  }
@@ -46382,7 +46382,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46382
46382
  this.config.colors = shuffleArray(this.config.colors);
46383
46383
  this.userColorMap = /* @__PURE__ */ new Map();
46384
46384
  this.colorIndex = 0;
46385
- this.version = "2.22.0-next.15";
46385
+ this.version = "2.22.0-next.16";
46386
46386
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46387
46387
  this.superdocId = config.superdocId || require_uuid.v4();
46388
46388
  this.colors = this.config.colors ?? [];
@@ -314,7 +314,7 @@ var shuffleArray = (array) => {
314
314
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
315
315
  function getSuperdocVersion() {
316
316
  try {
317
- return "2.22.0-next.15";
317
+ return "2.22.0-next.16";
318
318
  } catch {
319
319
  return "unknown";
320
320
  }
@@ -46311,7 +46311,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46311
46311
  this.config.colors = shuffleArray(this.config.colors);
46312
46312
  this.userColorMap = /* @__PURE__ */ new Map();
46313
46313
  this.colorIndex = 0;
46314
- this.version = "2.22.0-next.15";
46314
+ this.version = "2.22.0-next.16";
46315
46315
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46316
46316
  this.superdocId = config.superdocId || v4();
46317
46317
  this.colors = this.config.colors ?? [];