@univerjs/engine-render 1.0.0-insiders.20260813-7c9aa50 → 1.0.0

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 (146) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +0 -1
  3. package/lib/cjs/{af-B2UUzO69.js → af-nci0ERu_.js} +0 -1
  4. package/lib/cjs/{as-DbZDYp6O.js → as-9-ZvOvbK.js} +0 -1
  5. package/lib/cjs/{be-BBx0lyG-.js → be-CPDnc13A.js} +0 -1
  6. package/lib/cjs/{bg-DeX16RKi.js → bg-Tu2vvwIU.js} +0 -1
  7. package/lib/cjs/{bn-3fjitMC3.js → bn-CP4-u1Rh.js} +0 -1
  8. package/lib/cjs/{ca-BxC8Zblv.js → ca-9lX3QWYB.js} +0 -1
  9. package/lib/cjs/{cop-TvdaSBlz.js → cop-BpbDnfNH.js} +0 -1
  10. package/lib/cjs/{cs-MSNfJH-L.js → cs-6wd1Lm8r.js} +0 -1
  11. package/lib/cjs/{cu-7FYbjEBr.js → cu-DoUwo0RX.js} +0 -1
  12. package/lib/cjs/{cy-CPuxVqb_.js → cy-uvacbUjY.js} +0 -1
  13. package/lib/cjs/{da-BWsE849b.js → da-vuRoJfkB.js} +0 -1
  14. package/lib/cjs/{de-1901-BYSTp3Fp.js → de-1901-C-Rx0RIO.js} +0 -1
  15. package/lib/cjs/{de-1996-DWtCfm_A.js → de-1996-CqTjCS2g.js} +0 -1
  16. package/lib/cjs/{de-ch-1901-rWVcF3cs.js → de-ch-1901-j-eB6ude.js} +0 -1
  17. package/lib/cjs/{el-monoton-BEUGM9Fi.js → el-monoton-CdxEzdnL.js} +0 -1
  18. package/lib/cjs/{el-polyton-Bvh6HAfD.js → el-polyton-QS0KX3lc.js} +0 -1
  19. package/lib/cjs/{en-gb-Dcrai7kY.js → en-gb-B4rmyRrO.js} +0 -1
  20. package/lib/cjs/{es-CVNdGI0L.js → es-BA4drX0l.js} +0 -1
  21. package/lib/cjs/{et-7Rdfp2-O.js → et-C7DwwRsT.js} +0 -1
  22. package/lib/cjs/{eu-DyEtVwHo.js → eu-ClKht9Pp.js} +0 -1
  23. package/lib/cjs/{fi-DzRES2Ke.js → fi-DuHvPYlK.js} +0 -1
  24. package/lib/cjs/{fr-DJMVMLCz.js → fr-B6k7oFRi.js} +0 -1
  25. package/lib/cjs/{fur-CzhK3vxZ.js → fur-BNKRNrN9.js} +0 -1
  26. package/lib/cjs/{ga-HXzOFdlG.js → ga-BZ0KaaVs.js} +0 -1
  27. package/lib/cjs/{gl-C5TM79ih.js → gl-CctrPjLD.js} +0 -1
  28. package/lib/cjs/{grc-CPQF-xFI.js → grc-BE-oBfLv.js} +0 -1
  29. package/lib/cjs/{gu-AqCkEYxo.js → gu-Bv2fvk65.js} +0 -1
  30. package/lib/cjs/{hi-DugLLbv4.js → hi-D9Q0HIae.js} +0 -1
  31. package/lib/cjs/{hr-LSMYFsyP.js → hr-BWOyJbhV.js} +0 -1
  32. package/lib/cjs/{hsb-BlnRYHkg.js → hsb-DbVr5Yti.js} +0 -1
  33. package/lib/cjs/{hu-Dwvtkpy7.js → hu-CZLP-2fR.js} +0 -1
  34. package/lib/cjs/{hy-BsG06_IV.js → hy-ZPOiR2Pl.js} +0 -1
  35. package/lib/cjs/{ia-BMOUZLGD.js → ia-COSQW4z-.js} +0 -1
  36. package/lib/cjs/{id-DhSs0vqq.js → id-5X-mf3_K.js} +0 -1
  37. package/lib/cjs/index.js +13007 -5653
  38. package/lib/cjs/{is-iJhrS7Aw.js → is-B0v_L_rD.js} +0 -1
  39. package/lib/cjs/{it-Aam-BmsV.js → it-BYUjiLCa.js} +0 -1
  40. package/lib/cjs/{ka-CfLSYpVb.js → ka-CqhPSSIU.js} +0 -1
  41. package/lib/cjs/{kmr-DYCscIsi.js → kmr-BuxJ3UNX.js} +0 -1
  42. package/lib/cjs/{kn-OCEDIM_O.js → kn-CqFXlbev.js} +0 -1
  43. package/lib/cjs/{la-DFS3RPxE.js → la-BFXoayQr.js} +0 -1
  44. package/lib/cjs/{la-x-classic-BocVpbl6.js → la-x-classic-BYzNHSGU.js} +0 -1
  45. package/lib/cjs/{la-x-liturgic-CpZYm3b6.js → la-x-liturgic-vXxx2nLG.js} +0 -1
  46. package/lib/cjs/{lt-NC6HHzxn.js → lt-D2dXvF2J.js} +0 -1
  47. package/lib/cjs/{lv-BMFTm6cB.js → lv-bwpCf-Pe.js} +0 -1
  48. package/lib/cjs/{ml-DDWi25Fi.js → ml-Cg8vxrAK.js} +0 -1
  49. package/lib/cjs/{mn-cyrl-TCUeX7is.js → mn-cyrl-B6DZDQQA.js} +0 -1
  50. package/lib/cjs/{mn-cyrl-x-lmc-BCmp3Ybn.js → mn-cyrl-x-lmc-CXBgZUX1.js} +0 -1
  51. package/lib/cjs/{mr-1gjg-u15.js → mr-BBVGX8dy.js} +0 -1
  52. package/lib/cjs/{mul-ethi-B9a4BMM6.js → mul-ethi-CHBVIYMf.js} +0 -1
  53. package/lib/cjs/{nb-DS_J6lre.js → nb-BCuMJhLv.js} +0 -1
  54. package/lib/cjs/{nl-CBtSVLcv.js → nl-8OOgTtzV.js} +0 -1
  55. package/lib/cjs/{nn-DYJOn4Sh.js → nn-XJlYZMaR.js} +0 -1
  56. package/lib/cjs/{no-C20NyT1P.js → no-BYOYolO_.js} +0 -1
  57. package/lib/cjs/{oc-CrKqER_F.js → oc-OPfeuk3n.js} +0 -1
  58. package/lib/cjs/{or-ZqEtsnaq.js → or-1B6R0ukY.js} +0 -1
  59. package/lib/cjs/{pa-BD3r0Teo.js → pa-D7Ec6DsZ.js} +0 -1
  60. package/lib/cjs/{pi-CQUwMUvz.js → pi-CrindCzM.js} +0 -1
  61. package/lib/cjs/{pl-CawofTLo.js → pl-Bhte1xma.js} +0 -1
  62. package/lib/cjs/{pms-DMqDXwo-.js → pms-B5-d2U_Z.js} +0 -1
  63. package/lib/cjs/{pt-BIiUaINZ.js → pt-CtFPi0Il.js} +0 -1
  64. package/lib/cjs/{rm-B_-8T7Y1.js → rm-fgO3AV82.js} +0 -1
  65. package/lib/cjs/{ro-B2Xhfkgx.js → ro-BUB-IxaH.js} +0 -1
  66. package/lib/cjs/{ru-lj-rTTpe.js → ru-BYdNAMwp.js} +0 -1
  67. package/lib/cjs/{sa-D3h-cY2Z.js → sa-BX4Bcw9p.js} +0 -1
  68. package/lib/cjs/{sh-cyrl-0o7p_z-7.js → sh-cyrl-BMS20HU0.js} +0 -1
  69. package/lib/cjs/{sh-latn-BTi9p-0q.js → sh-latn-B5r4ufen.js} +0 -1
  70. package/lib/cjs/{sk-D6mOX2KK.js → sk-B2xqlAKO.js} +0 -1
  71. package/lib/cjs/{sl-Bzz3gkvn.js → sl-BQIVIls0.js} +0 -1
  72. package/lib/cjs/{sr-cyrl-V07WO3rb.js → sr-cyrl-DYfSvoxX.js} +0 -1
  73. package/lib/cjs/{sv-CyQXUuzx.js → sv-Dnaw_W7A.js} +0 -1
  74. package/lib/cjs/{ta-Brwz0zYf.js → ta-UtrX1d-L.js} +0 -1
  75. package/lib/cjs/{te-CgvirCa4.js → te-Cd9aOzWW.js} +0 -1
  76. package/lib/cjs/{th-PlSNhaza.js → th-DMVAQILd.js} +0 -1
  77. package/lib/cjs/{tk-O54r2ybT.js → tk-CmEXyO1-.js} +0 -1
  78. package/lib/cjs/{tr-Dh1h3Dno.js → tr--Z-rfClX.js} +0 -1
  79. package/lib/cjs/{uk-E2mCrVCU.js → uk-COcQB_vY.js} +0 -1
  80. package/lib/cjs/{zh-latn-pinyin-C2RfFfDl.js → zh-latn-pinyin-Cw5tH1Uh.js} +0 -1
  81. package/lib/es/index.js +12920 -5579
  82. package/lib/index.js +12920 -5579
  83. package/lib/types/basics/document-node-tools.d.ts +2 -0
  84. package/lib/types/basics/i-document-skeleton-cached.d.ts +82 -8
  85. package/lib/types/basics/index.d.ts +1 -0
  86. package/lib/types/basics/interfaces.d.ts +17 -5
  87. package/lib/types/basics/performance-monitor.d.ts +5 -0
  88. package/lib/types/basics/range.d.ts +1 -1
  89. package/lib/types/basics/tools.d.ts +4 -2
  90. package/lib/types/basics/transformer-config.d.ts +36 -1
  91. package/lib/types/components/docs/custom-glyph-renderer.d.ts +36 -0
  92. package/lib/types/components/docs/doc-background.d.ts +8 -0
  93. package/lib/types/components/docs/document-compatibility.d.ts +5 -3
  94. package/lib/types/components/docs/document-layout-presentation.d.ts +104 -0
  95. package/lib/types/components/docs/document.d.ts +21 -3
  96. package/lib/types/components/docs/extensions/font-and-base-line.d.ts +5 -1
  97. package/lib/types/components/docs/layout/block/column.d.ts +15 -0
  98. package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +15 -6
  99. package/lib/types/components/docs/layout/block/paragraph/line-adjustment.d.ts +1 -1
  100. package/lib/types/components/docs/layout/block/paragraph/linebreaking.d.ts +1 -1
  101. package/lib/types/components/docs/layout/block/paragraph/paragraph-layout.d.ts +1 -1
  102. package/lib/types/components/docs/layout/block/paragraph/shaping.d.ts +3 -0
  103. package/lib/types/components/docs/layout/block/section.d.ts +7 -1
  104. package/lib/types/components/docs/layout/block/table.d.ts +59 -2
  105. package/lib/types/components/docs/layout/doc-skeleton.d.ts +111 -3
  106. package/lib/types/components/docs/layout/document-layout-page-patch.d.ts +104 -0
  107. package/lib/types/components/docs/layout/document-layout-publication.d.ts +50 -0
  108. package/lib/types/components/docs/layout/document-layout-types.d.ts +65 -0
  109. package/lib/types/components/docs/layout/endnote-layout.d.ts +26 -0
  110. package/lib/types/components/docs/layout/footnote-layout.d.ts +70 -0
  111. package/lib/types/components/docs/layout/hyphenation/hyphen.d.ts +2 -0
  112. package/lib/types/components/docs/layout/line-breaker/enhancers/link-enhancer.d.ts +2 -1
  113. package/lib/types/components/docs/layout/model/glyph.d.ts +28 -4
  114. package/lib/types/components/docs/layout/model/line.d.ts +3 -2
  115. package/lib/types/components/docs/layout/model/page.d.ts +24 -4
  116. package/lib/types/components/docs/layout/note-numbering.d.ts +33 -0
  117. package/lib/types/components/docs/layout/shaping-engine/font-cache.d.ts +13 -2
  118. package/lib/types/components/docs/layout/style/color.d.ts +17 -0
  119. package/lib/types/components/docs/layout/tools.d.ts +48 -8
  120. package/lib/types/components/docs/page-borders.d.ts +20 -0
  121. package/lib/types/components/docs/table-hit-test.d.ts +16 -0
  122. package/lib/types/components/docs/table-render-viewport.d.ts +4 -0
  123. package/lib/types/components/docs/view-model/data-stream-tree-node.d.ts +1 -0
  124. package/lib/types/components/docs/view-model/document-view-model.d.ts +29 -8
  125. package/lib/types/components/extension.d.ts +3 -2
  126. package/lib/types/components/sheets/extensions/sheet-extension.d.ts +2 -1
  127. package/lib/types/components/sheets/sheet.render-skeleton.d.ts +5 -1
  128. package/lib/types/components/sheets/spreadsheet.d.ts +5 -2
  129. package/lib/types/components/sheets/watermark/watermark-layer.d.ts +2 -1
  130. package/lib/types/context.d.ts +4 -0
  131. package/lib/types/engine.d.ts +1 -0
  132. package/lib/types/index.d.ts +12 -3
  133. package/lib/types/layer.d.ts +14 -1
  134. package/lib/types/render-manager/render-manager.service.d.ts +3 -1
  135. package/lib/types/scene-viewer.d.ts +2 -1
  136. package/lib/types/scene.d.ts +21 -1
  137. package/lib/types/scene.input-manager.d.ts +7 -0
  138. package/lib/types/scene.transformer.d.ts +8 -2
  139. package/lib/types/services/canvas-color.service.d.ts +2 -4
  140. package/lib/types/shape/control.d.ts +5 -1
  141. package/lib/types/shape/scroll-bar.d.ts +2 -2
  142. package/lib/types/shape/shape.d.ts +9 -0
  143. package/lib/types/viewport.d.ts +3 -1
  144. package/lib/types/worker-layout.d.ts +71 -0
  145. package/lib/umd/index.js +5 -4
  146. package/package.json +6 -6
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDocumentBody } from '@univerjs/core';
17
+ import type { IDocumentSkeletonGlyph, IDocumentSkeletonPage, IDocumentSkeletonTable } from '../../../basics/i-document-skeleton-cached';
18
+ import type { IParagraphConfig, ISectionBreakConfig } from '../../../basics/interfaces';
19
+ import type { INoteReferenceLayout } from './note-numbering';
20
+ import type { ILayoutContext } from './tools';
21
+ import { DocumentViewModel } from '../view-model/document-view-model';
22
+ export interface INoteLayoutConstraints {
23
+ width: number;
24
+ firstPageHeight: number;
25
+ continuationPageHeight: number;
26
+ columnCount?: number;
27
+ firstColumn?: {
28
+ index: number;
29
+ top: number;
30
+ };
31
+ }
32
+ /** Uses the body layout pipeline, including table row splitting and inline drawing metrics. */
33
+ export declare function layoutNoteBody(parentContext: ILayoutContext, reference: INoteReferenceLayout, sectionConfig: ISectionBreakConfig, constraints: INoteLayoutConstraints): IDocumentSkeletonPage[];
34
+ export declare function layoutNoteSegment(parentContext: ILayoutContext, viewModel: DocumentViewModel, reference: Pick<INoteReferenceLayout, 'noteId' | 'sectionId'> & {
35
+ label?: string;
36
+ }, sectionConfig: ISectionBreakConfig, constraints: INoteLayoutConstraints): IDocumentSkeletonPage[];
37
+ export declare function defaultSeparatorBody(continued: boolean): IDocumentBody;
38
+ /** Per-layout state, shared by synchronous and sliced body pagination. */
39
+ export declare class DocumentFootnoteLayout {
40
+ private readonly _ctx;
41
+ private readonly _pages;
42
+ private readonly _inherited;
43
+ private readonly _references;
44
+ private readonly _referencePageBreaks;
45
+ private readonly _decorations;
46
+ constructor(_ctx: ILayoutContext);
47
+ updateReferenceGlyphs(page: IDocumentSkeletonPage, glyphs: IDocumentSkeletonGlyph[], config: ISectionBreakConfig, paragraph: IParagraphConfig): void;
48
+ private _updateReferenceLabels;
49
+ getTableBodyLimit(page: IDocumentSkeletonPage, currentPages: IDocumentSkeletonPage[], config: ISectionBreakConfig, table: IDocumentSkeletonTable): number;
50
+ /** Measure table slices without publishing speculative notes on body pages. */
51
+ createTablePagination(page: IDocumentSkeletonPage, config: ISectionBreakConfig, availableHeight: number): {
52
+ renumberWholeRow: (table: IDocumentSkeletonTable, rows: IDocumentSkeletonTable["rows"], remainingHeight: number) => boolean;
53
+ measureRow: (table: IDocumentSkeletonTable, rows: IDocumentSkeletonTable["rows"], previousHeights?: readonly number[]) => number[] | undefined;
54
+ append: (table: IDocumentSkeletonTable, row: IDocumentSkeletonTable["rows"][number]) => number | undefined;
55
+ hasContinuation: () => boolean;
56
+ nextPage: () => void;
57
+ } | undefined;
58
+ getBodyLimit(page: IDocumentSkeletonPage, currentPages: IDocumentSkeletonPage[], config: ISectionBreakConfig, bodyBottom: number, incoming?: IDocumentSkeletonGlyph[]): number;
59
+ finish(pages: IDocumentSkeletonPage[], config: ISectionBreakConfig): void;
60
+ getReferencePageBreaks(paragraphIndex: number): readonly number[] | undefined;
61
+ /** Re-shape moved text while retaining the page boundary chosen by keep/widow control. */
62
+ queueReferenceRelayout(pages: IDocumentSkeletonPage[]): void;
63
+ /** Rebuild reservations after keep-lines or widow control relocates shaped lines. */
64
+ reconcilePages(pages: IDocumentSkeletonPage[], config: ISectionBreakConfig): boolean;
65
+ private _layoutPageNotes;
66
+ private _layoutDecoration;
67
+ private _appendFollowing;
68
+ private _getInherited;
69
+ private _position;
70
+ }
@@ -18,12 +18,14 @@ import { Lang } from './lang';
18
18
  export declare class Hyphen implements IDisposable {
19
19
  private _patterns;
20
20
  private _hyphenCache;
21
+ private _patternLoads;
21
22
  private static _instance;
22
23
  static getInstance(): Hyphen;
23
24
  constructor();
24
25
  private _preloadPatterns;
25
26
  private _loadExceptionsToCache;
26
27
  loadPattern(lang: Lang): Promise<void>;
28
+ private _loadPattern;
27
29
  fetchHyphenCache(lang: Lang): Map<string, string[]> | undefined;
28
30
  hasPattern(lang: Lang): boolean;
29
31
  hyphenate(word: string, lang: Lang): string[] | undefined;
@@ -18,6 +18,7 @@ import type { IBreakPoints } from '../line-breaker';
18
18
  import { Break } from '../break';
19
19
  export declare class LineBreakerLinkEnhancer implements IBreakPoints {
20
20
  private _lineBreaker;
21
+ private readonly _allowLinkBreaks;
21
22
  private _curBreak;
22
23
  private _nextBreak;
23
24
  private _isInLink;
@@ -25,6 +26,6 @@ export declare class LineBreakerLinkEnhancer implements IBreakPoints {
25
26
  private _index;
26
27
  private _linkSlice;
27
28
  content: string;
28
- constructor(_lineBreaker: IBreakPoints);
29
+ constructor(_lineBreaker: IBreakPoints, _allowLinkBreaks?: boolean);
29
30
  nextBreakPoint(): Nullable<Break>;
30
31
  }
@@ -13,12 +13,21 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IAdjustability, IDocumentSkeletonBullet, IDocumentSkeletonDivide, IDocumentSkeletonGlyph } from '../../../../basics/i-document-skeleton-cached';
16
+ import type { IAdjustability, IDocumentSkeletonBullet, IDocumentSkeletonDivide, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph } from '../../../../basics/i-document-skeleton-cached';
17
17
  import type { IFontCreateConfig } from '../../../../basics/interfaces';
18
+ import type { IDocumentCompatibilityPolicy } from '../../document-compatibility';
18
19
  import { GlyphType } from '../../../../basics/i-document-skeleton-cached';
19
20
  export declare function isSpace(char: string): boolean;
21
+ export declare function getGlyphGroupFontBoundingBox(policy: IDocumentCompatibilityPolicy | undefined, ...glyphGroups: IDocumentSkeletonGlyph[][]): {
22
+ boundingBoxAscent: number;
23
+ boundingBoxDescent: number;
24
+ normalLineHeight: number;
25
+ };
26
+ export declare function getTextHorizontalScale(percent?: number): number;
20
27
  export declare function isJustifiable(content: string): boolean;
21
- export declare function baseAdjustability(content: string, width: number): IAdjustability;
28
+ export declare function baseAdjustability(content: string, width: number, emWidth?: number): IAdjustability;
29
+ export declare function getGlyphGroupStretchability(glyphGroup: IDocumentSkeletonGlyph[]): number;
30
+ export declare function getGlyphGroupShrinkability(glyphGroup: IDocumentSkeletonGlyph[], punctuationOnly?: boolean): number;
22
31
  export declare function createSkeletonWordGlyph(content: string, config: IFontCreateConfig, glyphWidth?: number): IDocumentSkeletonGlyph;
23
32
  export declare function createSkeletonLetterGlyph(content: string, config: IFontCreateConfig, glyphMetrics?: number | {
24
33
  ascent?: number;
@@ -41,10 +50,25 @@ export declare function createSkeletonWholeEntityGlyph(raw: string, config: IFon
41
50
  export declare function createSkeletonTabGlyph(config: IFontCreateConfig, glyphWidth?: number): IDocumentSkeletonGlyph;
42
51
  export declare function createHyphenDashGlyph(config: IFontCreateConfig): IDocumentSkeletonGlyph;
43
52
  export declare function createSkeletonCustomBlockGlyph(config: IFontCreateConfig, glyphWidth?: number, glyphHeight?: number, drawingId?: string): IDocumentSkeletonGlyph;
44
- export declare function _createSkeletonWordOrLetter(glyphType: GlyphType, content: string, config: IFontCreateConfig, glyphWidth?: number): IDocumentSkeletonGlyph;
45
- export declare function createSkeletonBulletGlyph(glyph: IDocumentSkeletonGlyph, bulletSkeleton: IDocumentSkeletonBullet, charSpaceApply: number): IDocumentSkeletonGlyph;
53
+ export declare function getPairKerningAdjustment(left: string, right: string, font: IDocumentSkeletonFontStyle): number;
54
+ export declare function applyGlyphKerning(glyphs: IDocumentSkeletonGlyph[]): void;
55
+ export declare function getGlyphPairKerningAdjustment(left?: IDocumentSkeletonGlyph, right?: IDocumentSkeletonGlyph): number;
56
+ /** Shared by skeleton layout and lightweight host measurement; offsets also drive painting. */
57
+ export declare function measureTextWithCharacterSpacing(content: string, spacing: number | undefined, measure: (text: string) => number, pairAdjustment?: (left: string, right: string) => number): {
58
+ content: string;
59
+ width: number;
60
+ inkWidth: number;
61
+ segments: Array<{
62
+ content: string;
63
+ left: number;
64
+ }>;
65
+ } | undefined;
66
+ export declare function _createSkeletonWordOrLetter(glyphType: GlyphType, raw: string, config: IFontCreateConfig, glyphWidth?: number): IDocumentSkeletonGlyph;
67
+ export declare function createSkeletonBulletGlyph(glyph: IDocumentSkeletonGlyph, bulletSkeleton: IDocumentSkeletonBullet, charSpaceApply: number, documentCompatibilityPolicy?: IDocumentCompatibilityPolicy): IDocumentSkeletonGlyph;
46
68
  export declare function setGlyphGroupLeft(glyphGroup: IDocumentSkeletonGlyph[], left?: number): void;
47
69
  export declare function setGlyphLeft(glyph: IDocumentSkeletonGlyph, left?: number): void;
48
70
  export declare function addGlyphToDivide(divide: IDocumentSkeletonDivide, glyphGroup: IDocumentSkeletonGlyph[], offsetLeft?: number): void;
71
+ export declare function removeGlyphAutoSpacing(glyph: IDocumentSkeletonGlyph, side: 0 | 1): void;
49
72
  export declare function glyphShrinkRight(glyph: IDocumentSkeletonGlyph, amount: number): void;
50
73
  export declare function glyphShrinkLeft(glyph: IDocumentSkeletonGlyph, amount: number): void;
74
+ export declare function preserveLineStartPunctuationSpace(glyph: IDocumentSkeletonGlyph): void;
@@ -14,9 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
- import type { IParagraphConfig } from '../../../../basics';
18
17
  import type { IDocumentSkeletonDivide, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonLine, IDocumentSkeletonPage, LineType } from '../../../../basics/i-document-skeleton-cached';
18
+ import type { IParagraphConfig } from '../../../../basics/interfaces';
19
19
  import type { IFloatObject } from '../tools';
20
+ export declare const TRADITIONAL_TABLE_WRAP_MIN_WIDTH = 24;
20
21
  interface ILineBoundingBox {
21
22
  lineHeight: number;
22
23
  lineTop: number;
@@ -29,7 +30,7 @@ interface ILineBoundingBox {
29
30
  spaceBelowApply?: number;
30
31
  }
31
32
  export declare function createSkeletonLine(paragraphIndex: number, lineType: LineType, lineBoundingBox: ILineBoundingBox, columnWidth: number, lineIndex: number | undefined, isParagraphStart: boolean | undefined, paragraphConfig: IParagraphConfig, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>, columnLeft?: number, sectionTop?: number): IDocumentSkeletonLine;
32
- export declare function calculateLineTopByDrawings(lineHeight: number | undefined, lineTop: number | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>, columnLeft?: number, columnWidth?: number, sectionTop?: number): number;
33
+ export declare function calculateLineTopByDrawings(lineHeight: number | undefined, lineTop: number | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>, columnLeft?: number, columnWidth?: number, sectionTop?: number, minimumTableWrapWidth?: number): number;
33
34
  export declare function updateDivideInfo(divide: IDocumentSkeletonDivide, states: Partial<IDocumentSkeletonDivide>): void;
34
35
  export declare function setLineMarginBottom(line: IDocumentSkeletonLine, marginBottom: number): void;
35
36
  export declare function collisionDetection(floatObject: IFloatObject, lineHeight: number, lineTop: number, columnLeft: number, columnWidth: number): boolean;
@@ -13,19 +13,39 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDocumentBody, ITable, Nullable } from '@univerjs/core';
16
+ import type { IDocumentBody, ITable, ITableCellBorder, ITableRow, Nullable } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonPage, ISkeletonResourceReference } from '../../../../basics/i-document-skeleton-cached';
18
18
  import type { ISectionBreakConfig } from '../../../../basics/interfaces';
19
19
  import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
20
20
  import type { DocumentViewModel } from '../../view-model/document-view-model';
21
21
  import type { ILayoutContext } from '../tools';
22
22
  import { BreakType } from '../../../../basics/i-document-skeleton-cached';
23
- export declare function createSkeletonPage(ctx: ILayoutContext, sectionBreakConfig: ISectionBreakConfig, skeletonResourceReference: ISkeletonResourceReference, pageNumber?: number, breakType?: BreakType): IDocumentSkeletonPage;
24
- export declare function createNullCellPage(ctx: ILayoutContext, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number, inheritDocumentLinePitch?: boolean, enableDocumentTableLineGrid?: boolean): {
23
+ export declare function createSkeletonPage(ctx: ILayoutContext, sectionBreakConfig: ISectionBreakConfig, skeletonResourceReference: ISkeletonResourceReference, pageNumber?: number, breakType?: BreakType, pageContext?: Pick<IDocumentSkeletonPage, 'type' | 'segmentId'>): IDocumentSkeletonPage;
24
+ export declare function createNullCellPage(ctx: ILayoutContext, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number, inheritDocumentLinePitch?: boolean, enableDocumentTableLineGrid?: boolean, cellPageHeights?: readonly number[]): {
25
25
  page: IDocumentSkeletonPage;
26
26
  sectionBreakConfig: ISectionBreakConfig;
27
+ verticalCellWidth: number | undefined;
27
28
  };
28
- export declare function createSkeletonCellPages(ctx: ILayoutContext, viewModel: DocumentViewModel, cellNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number): IDocumentSkeletonPage[];
29
+ export declare function getCellBorderWidth(border: ITableCellBorder | undefined): number;
30
+ export declare function getRowBorderInset(row: ITableRow, edge: 'borderTop' | 'borderBottom', tableBoundary?: boolean): number;
31
+ export declare function createSkeletonCellPages(ctx: ILayoutContext, viewModel: DocumentViewModel, cellNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number, cellPageHeights?: readonly number[]): IDocumentSkeletonPage[];
32
+ export interface ICellSkeletonBuildState {
33
+ ctx: ILayoutContext;
34
+ viewModel: DocumentViewModel;
35
+ cellNode: DataStreamTreeNode;
36
+ sectionNode: DataStreamTreeNode;
37
+ sectionBreakConfig: ISectionBreakConfig;
38
+ cellSectionBreakConfig: ISectionBreakConfig;
39
+ tableConfig: ITable;
40
+ verticalCellWidth?: number;
41
+ paragraphIndex: number;
42
+ layoutAnchor: Nullable<number>;
43
+ pages: IDocumentSkeletonPage[];
44
+ complete: boolean;
45
+ requiresSyncFallback: boolean;
46
+ }
47
+ export declare function startSkeletonCellPagesBuild(ctx: ILayoutContext, viewModel: DocumentViewModel, cellNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number, cellPageHeights?: readonly number[]): ICellSkeletonBuildState;
48
+ export declare function stepSkeletonCellPagesBuild(state: ICellSkeletonBuildState): boolean;
29
49
  export declare function expandCellPageHeightForInlineDrawings(pages: IDocumentSkeletonPage[]): void;
30
50
  export declare function expandCellPageHeightForFlowTables(pages: IDocumentSkeletonPage[]): void;
31
51
  export declare function applyTrailingBlockRangeSpaceBelow(pages: IDocumentSkeletonPage[], body: Nullable<IDocumentBody>, containerEndIndex: number): void;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { DocumentNoteType, IDocumentData, IFootnoteProperties, ISectionBreak } from '@univerjs/core';
17
+ export interface INoteLayoutProperties extends Omit<IFootnoteProperties, 'position'> {
18
+ position?: 'pageBottom' | 'beneathText' | 'docEnd' | 'sectEnd';
19
+ }
20
+ export interface INoteReferenceLayout {
21
+ noteId: string;
22
+ type: DocumentNoteType;
23
+ referenceIndex: number;
24
+ sectionId: string;
25
+ label: string;
26
+ number?: number;
27
+ properties: INoteLayoutProperties;
28
+ }
29
+ export declare function formatNoteNumber(number: number, format?: string): string;
30
+ /** Page keys are physical page indices, independent of the printed page-number format. */
31
+ /** Cell section sentinels cannot own document-level note numbering or placement. */
32
+ export declare function getNoteSections(snapshot: Pick<IDocumentData, 'body'>): ISectionBreak[];
33
+ export declare function resolveNoteReferences(snapshot: Pick<IDocumentData, 'body' | 'notes' | 'noteSettings'>, referencePages?: ReadonlyMap<string, number>): Map<number, INoteReferenceLayout>;
@@ -23,12 +23,16 @@ export interface IMeasureTextCache {
23
23
  actualBoundingBoxDescent: number;
24
24
  width: number;
25
25
  }
26
+ /** Invalidates selected CSS font keys in both measurement caches; registered font data is retained. */
27
+ export declare function invalidateDocumentFontMetrics(matches: (fontStyle: string) => boolean): boolean;
26
28
  export declare class FontCache {
29
+ private static _normalLineHeightCache;
27
30
  private static _getTextHeightCache;
28
31
  private static _context;
29
32
  private static _fontDataMap;
30
33
  private static _globalFontMeasureCache;
31
34
  static get globalFontMeasureCache(): Map<string, Map<string, IMeasureTextCache>>;
35
+ static invalidateMetrics(matches: (fontStyle: string) => boolean): boolean;
32
36
  static setFontMeasureCache(fontStyle: string, content: string, tm: IMeasureTextCache): void;
33
37
  static clearFontMeasureCache(path: string): boolean;
34
38
  static getFontMeasureCache(fontStyle: string, content: string): Nullable<IMeasureTextCache>;
@@ -43,14 +47,21 @@ export declare class FontCache {
43
47
  width: number;
44
48
  height: number;
45
49
  };
46
- static getTextSize(content: string, fontStyle: IDocumentSkeletonFontStyle): IDocumentSkeletonBoundingBox;
50
+ /** CSS normal spacing includes font leading that Canvas bounding boxes omit. */
51
+ static getNormalLineHeight(fontStyle: IDocumentSkeletonFontStyle): number | undefined;
52
+ /** Transfers browser-only normal spacing measurements to the document layout Worker. */
53
+ static getNormalLineHeightCache(): Record<string, number>;
54
+ static setNormalLineHeightCache(metrics: Record<string, number>): void;
55
+ static getTextSize(content: string, fontStyle: IDocumentSkeletonFontStyle, includeNormalFontLeading?: boolean, useUnhintedMetrics?: boolean): IDocumentSkeletonBoundingBox;
47
56
  /**
48
57
  * Measure text on another canvas.
49
58
  * @param content
50
59
  * @param fontString
51
60
  * @returns IMeasureTextCache
52
61
  */
53
- static getMeasureText(content: string, fontString: string): IMeasureTextCache;
62
+ static getMeasureText(content: string, fontString: string, kerning?: CanvasFontKerning): IMeasureTextCache;
63
+ private static _createMeasureContext;
64
+ private static _getFontSizeFromStyle;
54
65
  private static _clearMeasureCache;
55
66
  /**
56
67
  * Vertical Metrics https://glyphsapp.com/learn/vertical-metrics
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IColorStyle, Nullable } from '@univerjs/core';
17
+ export declare function getColorStyleForCanvas(color: Nullable<IColorStyle>): Nullable<string>;
@@ -13,15 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { DocumentDataModel, ICustomRangeForInterceptor, INumberUnit, IObjectPositionH, IObjectPositionV, IParagraph, IParagraphStyle, ITextStyle, Nullable, PositionedObjectLayoutType } from '@univerjs/core';
17
- import type { IDocumentSkeletonCached, IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonSection, IDocumentSkeletonTable, ISkeletonResourceReference } from '../../../basics/i-document-skeleton-cached';
16
+ import type { DocumentDataModel, ICustomRangeForInterceptor, IDocDrawingBase, INumberUnit, IObjectPositionH, IObjectPositionV, Nullable, PositionedObjectLayoutType } from '@univerjs/core';
17
+ import type { IDocumentSkeletonCached, IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonParagraphBorders, IDocumentSkeletonRow, IDocumentSkeletonSection, IDocumentSkeletonTable, ISkeletonResourceReference } from '../../../basics/i-document-skeleton-cached';
18
18
  import type { IDocsConfig, IParagraphConfig, ISectionBreakConfig } from '../../../basics/interfaces';
19
19
  import type { IBoundRectNoAngle } from '../../../basics/vector2';
20
20
  import type { IDocumentCompatibilityPolicy } from '../document-compatibility';
21
+ import type { IDocumentLayoutParagraph, IDocumentLayoutParagraphStyle, IDocumentLayoutTextStyle } from '../document-layout-presentation';
21
22
  import type { DataStreamTreeNode } from '../view-model/data-stream-tree-node';
22
23
  import type { DocumentViewModel } from '../view-model/document-view-model';
24
+ import type { DocumentEndnoteLayout } from './endnote-layout';
25
+ import type { DocumentFootnoteLayout } from './footnote-layout';
23
26
  import type { Hyphen } from './hyphenation/hyphen';
24
27
  import type { LanguageDetector } from './hyphenation/language-detector';
28
+ import type { INoteReferenceLayout } from './note-numbering';
25
29
  import { BooleanNumber, GridType, SpacingRule } from '@univerjs/core';
26
30
  export declare function getLastPage(pages: IDocumentSkeletonPage[]): IDocumentSkeletonPage;
27
31
  export declare function getLastSection(page: IDocumentSkeletonPage): IDocumentSkeletonSection;
@@ -67,8 +71,13 @@ export declare function getCharSpaceConfig(sectionBreakConfig: ISectionBreakConf
67
71
  gridType: GridType;
68
72
  snapToGrid: BooleanNumber;
69
73
  };
74
+ export declare function getLineMetricGlyphs(glyphGroup: IDocumentSkeletonGlyph[], documentCompatibilityPolicy?: IDocumentCompatibilityPolicy, previousGlyphs?: IDocumentSkeletonGlyph[]): IDocumentSkeletonGlyph[];
75
+ export declare function getDrawingMLLineBaseline(lineHeight: number, ascent: number, descent: number): number;
70
76
  export declare function updateBlockIndex(pages: IDocumentSkeletonPage[], start?: number, documentCompatibilityPolicy?: IDocumentCompatibilityPolicy): void;
77
+ export declare function isParagraphEnd(line: IDocumentSkeletonLine): boolean;
78
+ export declare function hasSameParagraphBorderSet(first: IDocumentSkeletonParagraphBorders, second: IDocumentSkeletonParagraphBorders): boolean;
71
79
  export declare function updateInlineDrawingCoordsAndBorder(ctx: ILayoutContext, pages: IDocumentSkeletonPage[]): void;
80
+ export declare function updateParagraphBorders(ctx: ILayoutContext, pages: IDocumentSkeletonPage[], targetPages?: IDocumentSkeletonPage[]): void;
72
81
  export declare function glyphIterator(pages: IDocumentSkeletonPage[], cb: (glyph: IDocumentSkeletonGlyph, divide: IDocumentSkeletonDivide, line: IDocumentSkeletonLine, column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, page: IDocumentSkeletonPage) => void): void;
73
82
  export declare function lineIterator(pagesOrCells: (IDocumentSkeletonPage)[], cb: (line: IDocumentSkeletonLine, column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, page: IDocumentSkeletonPage) => void): void;
74
83
  export type DocumentSkeletonLineSource = 'page' | 'table-cell' | 'column';
@@ -93,7 +102,7 @@ export interface IDocumentSkeletonLineContext {
93
102
  visualLeft?: number;
94
103
  visualWidth?: number;
95
104
  }
96
- export type DocumentSkeletonTableSource = 'page' | 'column' | 'header' | 'footer';
105
+ export type DocumentSkeletonTableSource = 'page' | 'table-cell' | 'column' | 'header' | 'footer';
97
106
  type HeaderFooterSkeletonMap = Map<string, Map<number, IDocumentSkeletonPage>>;
98
107
  export interface IDocumentSkeletonTableCellGeometry {
99
108
  cell: IDocumentSkeletonPage;
@@ -153,25 +162,29 @@ export declare function compareDocumentSkeletonNestedPagePathOrder(pos1: {
153
162
  export declare function columnIterator(pages: IDocumentSkeletonPage[], iteratorFunction: (column: IDocumentSkeletonColumn) => void): void;
154
163
  export declare function getPositionHorizon(positionH: IObjectPositionH, column: IDocumentSkeletonColumn, page: IDocumentSkeletonPage, objectWidth: number, isPageBreak?: boolean): number | undefined;
155
164
  export declare function getPositionVertical(positionV: IObjectPositionV, page: IDocumentSkeletonPage, lineTop: number, lineHeight: number, objectHeight: number, blockAnchorTop?: number, isPageBreak?: boolean): number | undefined;
156
- export declare function getGlyphGroupWidth(divide: IDocumentSkeletonDivide): number;
165
+ export declare function getGlyphGroupWidth(divide: IDocumentSkeletonDivide, excludeTrailingSpaces?: boolean): number;
157
166
  interface IFontCreateConfig {
167
+ documentCompatibilityPolicy?: IDocumentCompatibilityPolicy;
158
168
  fontStyle: IDocumentSkeletonFontStyle;
159
- textStyle: ITextStyle;
169
+ textStyle: IDocumentLayoutTextStyle;
160
170
  charSpace: number;
161
171
  gridType: GridType;
162
172
  snapToGrid: BooleanNumber;
163
173
  pageWidth: number;
174
+ balanceSingleByteDoubleByteWidth?: BooleanNumber;
164
175
  }
165
176
  export declare function clearFontCreateConfigCache(): void;
166
- export declare function getFontConfigFromLastGlyph(glyph: IDocumentSkeletonGlyph, sectionBreakConfig: ISectionBreakConfig, paragraphStyle: IParagraphStyle): {
177
+ export declare function getFontConfigFromLastGlyph(glyph: IDocumentSkeletonGlyph, sectionBreakConfig: ISectionBreakConfig, paragraphStyle: IDocumentLayoutParagraphStyle): {
178
+ documentCompatibilityPolicy: IDocumentCompatibilityPolicy;
167
179
  fontStyle: IDocumentSkeletonFontStyle;
168
- textStyle: ITextStyle;
180
+ textStyle: IDocumentLayoutTextStyle;
181
+ balanceSingleByteDoubleByteWidth: BooleanNumber | undefined;
169
182
  charSpace: number;
170
183
  gridType: GridType;
171
184
  snapToGrid: BooleanNumber;
172
185
  pageWidth: number;
173
186
  };
174
- export declare function getFontCreateConfig(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, paragraph: IParagraph): IFontCreateConfig;
187
+ export declare function getFontCreateConfig(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, paragraph: IDocumentLayoutParagraph): IFontCreateConfig;
175
188
  export declare function getCustomRangeGlyphWidth(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, config: IFontCreateConfig): number | undefined;
176
189
  /**
177
190
  * Returns whether a custom range should occupy one measured glyph in the
@@ -207,6 +220,7 @@ export interface IFloatObject {
207
220
  angle: number;
208
221
  behindDoc?: BooleanNumber;
209
222
  layoutType?: PositionedObjectLayoutType;
223
+ effectExtent?: IDocDrawingBase['effectExtent'];
210
224
  type: FloatObjectType;
211
225
  positionV: IObjectPositionV;
212
226
  }
@@ -227,9 +241,23 @@ export interface IDocumentPaginationMetrics {
227
241
  peakCheckpointLineCount: number;
228
242
  }
229
243
  export interface ILayoutContext {
244
+ noteReferences?: ReadonlyMap<number, INoteReferenceLayout>;
245
+ footnoteLayout?: DocumentFootnoteLayout;
246
+ endnoteLayout?: DocumentEndnoteLayout;
247
+ /** Virtual marker in a note body; it never consumes a persisted character. */
248
+ noteLabel?: string;
249
+ noteReferenceTextStyle?: IDocumentLayoutTextStyle;
250
+ /** Preserve the local note segment when the paragraph/table pipeline opens a continuation page. */
251
+ noteSegmentId?: string;
252
+ footnoteFirstColumn?: {
253
+ index: number;
254
+ top: number;
255
+ };
230
256
  viewModel: DocumentViewModel;
231
257
  dataModel: DocumentDataModel;
232
258
  docsConfig: IDocsConfig;
259
+ modernPageWidth?: number;
260
+ modernHorizontalMargin?: number;
233
261
  skeleton: IDocumentSkeletonCached;
234
262
  layoutStartPointer: Record<string, Nullable<number>>;
235
263
  isDirty: boolean;
@@ -243,6 +271,18 @@ export interface ILayoutContext {
243
271
  sectionBreakConfigCache: Map<number, ISectionBreakConfig>;
244
272
  paragraphsOpenNewPage: Set<number>;
245
273
  paginationMetrics?: IDocumentPaginationMetrics;
274
+ /**
275
+ * Incremental layout may defer an expensive split-table calculation after
276
+ * the normal line-layout path has resolved its exact pagination context.
277
+ * Synchronous callers leave this unset.
278
+ */
279
+ deferSlicedTableLayout?: (request: {
280
+ curPage: IDocumentSkeletonPage;
281
+ viewModel: DocumentViewModel;
282
+ tableNode: DataStreamTreeNode;
283
+ sectionBreakConfig: ISectionBreakConfig;
284
+ availableHeight: number;
285
+ }) => boolean;
246
286
  hyphen: Hyphen;
247
287
  languageDetector: LanguageDetector;
248
288
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IPageBorders } from '@univerjs/core';
17
+ import type { IDocumentSkeletonPage } from '../../basics/i-document-skeleton-cached';
18
+ import type { UniverRenderingContext } from '../../context';
19
+ /** Draws section page borders without contributing to text/table layout. */
20
+ export declare function drawPageBorders(ctx: UniverRenderingContext, page: IDocumentSkeletonPage, borders: IPageBorders | undefined, pageLeft: number, pageTop: number, firstPageInSection: boolean): void;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare function getTopmostDocsTableHit<T>(tables: readonly T[], hitBody: (table: T) => boolean, hitControls: (table: T) => boolean, isNestedTable?: (outer: T, inner: T) => boolean): T | undefined;
@@ -13,6 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { DocumentFlavor } from '@univerjs/core';
17
+ import type { IDocumentSkeletonPage } from '../../basics/i-document-skeleton-cached';
18
+ /** Shared by the canvas renderer and interactive table viewport provider. */
19
+ export declare function getDocsTableLayoutViewportWidth(page: Pick<IDocumentSkeletonPage, 'pageWidth' | 'marginLeft' | 'marginRight'> & Partial<Pick<IDocumentSkeletonPage, 'type'>>, tableLeft: number, tableSource: unknown, documentFlavor?: DocumentFlavor): number;
16
20
  export interface IDocsTableRenderViewport {
17
21
  contentWidth: number;
18
22
  leadingInsetLeft?: number;
@@ -25,6 +25,7 @@ export declare class DataStreamTreeNode {
25
25
  blocks: number[];
26
26
  constructor(nodeType: DataStreamTreeNodeType, content?: string | undefined);
27
27
  static create(nodeType: DataStreamTreeNodeType, content?: string): DataStreamTreeNode;
28
+ get contentStartIndex(): number;
28
29
  dispose(): void;
29
30
  getProps(): {
30
31
  children: DataStreamTreeNode[];
@@ -13,7 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { DocumentDataModel, IColumnGroup, ICustomBlock, ICustomColumnGroup, ICustomDecorationForInterceptor, ICustomRangeForInterceptor, ICustomTable, IDisposable, IParagraph, ISectionBreak, ITable, ITextRun, Nullable } from '@univerjs/core';
16
+ import type { DocumentDataModel, ICustomBlock, ICustomDecorationForInterceptor, ICustomRangeForInterceptor, ICustomTable, IDisposable, ITable, JSONXActions, Nullable } from '@univerjs/core';
17
+ import type { IDocumentLayoutBody, IDocumentLayoutColumnGroup, IDocumentLayoutCustomColumnGroup, IDocumentLayoutParagraph, IDocumentLayoutSectionBreak, IDocumentLayoutSnapshot, IDocumentLayoutTextRun } from '../document-layout-presentation';
17
18
  import { DataStreamTreeNode } from './data-stream-tree-node';
18
19
  interface ITableNodeCache {
19
20
  table: DataStreamTreeNode;
@@ -36,8 +37,8 @@ interface ITableCoupleCache {
36
37
  tableSource: ITable;
37
38
  }
38
39
  interface IColumnGroupCoupleCache {
39
- columnGroup: ICustomColumnGroup;
40
- columnGroupSource: IColumnGroup;
40
+ columnGroup: IDocumentLayoutCustomColumnGroup;
41
+ columnGroupSource: IDocumentLayoutColumnGroup;
41
42
  }
42
43
  export declare class DocumentViewModel implements IDisposable {
43
44
  private _documentDataModel;
@@ -52,11 +53,23 @@ export declare class DocumentViewModel implements IDisposable {
52
53
  private _columnGroupCache;
53
54
  private _tableNodeCache;
54
55
  private _children;
56
+ private _treeNodes;
57
+ private _treeNodesByStartIndex;
58
+ private _plainTopLevelParagraphNodes;
59
+ private _metadataCachesDirty;
60
+ private _textRunsOrderedAndDisjoint;
61
+ private _paragraphsOrdered;
62
+ private _sectionBreaksOrdered;
63
+ private _customBlocksOrdered;
64
+ private _tablesOrdered;
65
+ private _columnGroupsOrdered;
66
+ private _lastTextRun;
55
67
  private _editArea;
56
68
  private readonly _editAreaChange$;
57
69
  readonly editAreaChange$: import("rxjs").Observable<Nullable<DocumentEditArea>>;
58
70
  private _headerTreeMap;
59
71
  private _footerTreeMap;
72
+ private _noteTreeMap;
60
73
  private readonly _segmentViewModels$;
61
74
  readonly segmentViewModels$: import("rxjs").Observable<DocumentViewModel[]>;
62
75
  constructor(_documentDataModel: DocumentDataModel, _tableSource?: Record<string, ITable> | undefined);
@@ -66,17 +79,20 @@ export declare class DocumentViewModel implements IDisposable {
66
79
  headerTreeMap: Map<string, DocumentViewModel>;
67
80
  footerTreeMap: Map<string, DocumentViewModel>;
68
81
  };
82
+ getNoteTreeMap(): ReadonlyMap<string, DocumentViewModel>;
69
83
  getEditArea(): DocumentEditArea;
70
84
  setEditArea(editArea: DocumentEditArea): void;
71
85
  getChildren(): DataStreamTreeNode[];
72
- getBody(): import("@univerjs/core").IDocumentBody | undefined;
73
- getSnapshot(): import("@univerjs/core").IDocumentData;
86
+ getBody(): IDocumentLayoutBody | undefined;
87
+ getSnapshot(): IDocumentLayoutSnapshot;
74
88
  getDataModel(): DocumentDataModel;
75
89
  getSelfOrHeaderFooterViewModel(segmentId?: string): DocumentViewModel;
76
90
  reset(documentDataModel: DocumentDataModel): void;
77
- getSectionBreak(index: number): ISectionBreak | undefined;
78
- getParagraph(index: number): IParagraph | undefined;
79
- getTextRun(index: number): Nullable<ITextRun>;
91
+ resetByValidatedTextMutation(documentDataModel: DocumentDataModel, actions: JSONXActions): boolean;
92
+ resetByValidatedMetadataMutation(documentDataModel: DocumentDataModel, actions: JSONXActions): boolean;
93
+ getSectionBreak(index: number): IDocumentLayoutSectionBreak | undefined;
94
+ getParagraph(index: number): IDocumentLayoutParagraph | undefined;
95
+ getTextRun(index: number): Nullable<IDocumentLayoutTextRun>;
80
96
  getCustomBlock(index: number): ICustomBlock | undefined;
81
97
  getCustomBlockWithoutSetCurrentIndex(index: number): ICustomBlock | undefined;
82
98
  getTableByStartIndex(index: number): ITableCoupleCache | undefined;
@@ -87,6 +103,11 @@ export declare class DocumentViewModel implements IDisposable {
87
103
  getCustomDecorationRaw(index: number): import("@univerjs/core").ICustomDecoration | undefined;
88
104
  getCustomDecoration(index: number): Nullable<ICustomDecorationForInterceptor>;
89
105
  private _buildAllCache;
106
+ private _insertPlainText;
107
+ private _deletePlainText;
108
+ private _findParagraphNode;
109
+ private _rebuildTreeNodes;
110
+ private _collectNodePath;
90
111
  private _buildParagraphCache;
91
112
  private _buildSectionBreakCache;
92
113
  private _buildCustomBlockCache;
@@ -13,10 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDocumentRenderConfig, IRange, IScale, Nullable } from '@univerjs/core';
16
+ import type { IRange, IScale, Nullable } from '@univerjs/core';
17
17
  import type { BaseObject } from '../base-object';
18
18
  import type { IBoundRectNoAngle, Vector2 } from '../basics/vector2';
19
19
  import type { UniverRenderingContext } from '../context';
20
+ import type { IDocumentLayoutRenderConfig } from './docs/document-layout-presentation';
20
21
  import { Registry } from '@univerjs/core';
21
22
  export interface IExtensionConfig {
22
23
  originTranslate?: Vector2;
@@ -24,7 +25,7 @@ export interface IExtensionConfig {
24
25
  spanPointWithFont?: Vector2;
25
26
  centerPoint?: Vector2;
26
27
  alignOffset?: Vector2;
27
- renderConfig?: IDocumentRenderConfig;
28
+ renderConfig?: IDocumentLayoutRenderConfig;
28
29
  }
29
30
  export interface IDrawInfo {
30
31
  viewRanges: IRange[];
@@ -17,7 +17,8 @@ import type { IRange } from '@univerjs/core';
17
17
  import type { SpreadsheetSkeleton } from '../sheet.render-skeleton';
18
18
  import { ComponentExtension } from '../../extension';
19
19
  export declare enum SHEET_EXTENSION_TYPE {
20
- GRID = 0
20
+ BACKGROUND = 0,
21
+ GRID = 1
21
22
  }
22
23
  /**
23
24
  * for distinguish doc & slides extensions, now only used when metric performance.