@univerjs/engine-render 1.0.0-insiders.20260809-70eefdd → 1.0.0-rc.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 (61) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +0 -1
  3. package/lib/cjs/index.js +17525 -11746
  4. package/lib/es/index.js +17519 -11749
  5. package/lib/index.js +17519 -11749
  6. package/lib/types/basics/i-document-skeleton-cached.d.ts +60 -3
  7. package/lib/types/basics/index.d.ts +1 -0
  8. package/lib/types/basics/interfaces.d.ts +4 -0
  9. package/lib/types/basics/performance-monitor.d.ts +5 -0
  10. package/lib/types/basics/range.d.ts +1 -1
  11. package/lib/types/basics/transformer-config.d.ts +32 -1
  12. package/lib/types/components/docs/doc-background.d.ts +8 -0
  13. package/lib/types/components/docs/doc-extension.d.ts +3 -1
  14. package/lib/types/components/docs/document-compatibility.d.ts +1 -1
  15. package/lib/types/components/docs/document.d.ts +4 -3
  16. package/lib/types/components/docs/extensions/font-and-base-line.d.ts +1 -0
  17. package/lib/types/components/docs/layout/block/column.d.ts +15 -1
  18. package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +6 -4
  19. package/lib/types/components/docs/layout/block/paragraph/line-adjustment.d.ts +1 -1
  20. package/lib/types/components/docs/layout/block/paragraph/linebreaking.d.ts +1 -1
  21. package/lib/types/components/docs/layout/block/paragraph/paragraph-layout.d.ts +1 -1
  22. package/lib/types/components/docs/layout/block/paragraph/shaping.d.ts +3 -0
  23. package/lib/types/components/docs/layout/block/section.d.ts +7 -1
  24. package/lib/types/components/docs/layout/block/table.d.ts +57 -1
  25. package/lib/types/components/docs/layout/doc-skeleton.d.ts +98 -3
  26. package/lib/types/components/docs/layout/document-layout-page-patch.d.ts +104 -0
  27. package/lib/types/components/docs/layout/document-layout-publication.d.ts +50 -0
  28. package/lib/types/components/docs/layout/document-layout-types.d.ts +65 -0
  29. package/lib/types/components/docs/layout/endnote-layout.d.ts +26 -0
  30. package/lib/types/components/docs/layout/footnote-layout.d.ts +70 -0
  31. package/lib/types/components/docs/layout/hyphenation/hyphen.d.ts +2 -0
  32. package/lib/types/components/docs/layout/model/line.d.ts +3 -2
  33. package/lib/types/components/docs/layout/model/page.d.ts +19 -2
  34. package/lib/types/components/docs/layout/note-numbering.d.ts +33 -0
  35. package/lib/types/components/docs/layout/shaping-engine/font-cache.d.ts +12 -1
  36. package/lib/types/components/docs/layout/style/color.d.ts +17 -0
  37. package/lib/types/components/docs/layout/tools.d.ts +33 -1
  38. package/lib/types/components/docs/view-model/document-view-model.d.ts +21 -1
  39. package/lib/types/components/sheets/constants.d.ts +2 -0
  40. package/lib/types/components/sheets/extensions/column-header-layout.d.ts +1 -1
  41. package/lib/types/components/sheets/extensions/row-header-layout.d.ts +1 -1
  42. package/lib/types/components/sheets/sheet.render-skeleton.d.ts +8 -1
  43. package/lib/types/components/sheets/spreadsheet.d.ts +5 -2
  44. package/lib/types/components/sheets/watermark/watermark-layer.d.ts +2 -1
  45. package/lib/types/context.d.ts +4 -0
  46. package/lib/types/engine.d.ts +1 -0
  47. package/lib/types/index.d.ts +6 -0
  48. package/lib/types/layer.d.ts +14 -1
  49. package/lib/types/render-manager/render-manager.service.d.ts +3 -1
  50. package/lib/types/scene.d.ts +19 -0
  51. package/lib/types/scene.input-manager.d.ts +5 -0
  52. package/lib/types/scene.transformer.d.ts +2 -0
  53. package/lib/types/services/canvas-color.service.d.ts +4 -3
  54. package/lib/types/shape/checkbox.d.ts +2 -0
  55. package/lib/types/shape/image.d.ts +4 -0
  56. package/lib/types/shape/scroll-bar.d.ts +2 -2
  57. package/lib/types/shape/shape.d.ts +10 -1
  58. package/lib/types/viewport.d.ts +3 -1
  59. package/lib/types/worker-layout.d.ts +62 -0
  60. package/lib/umd/index.js +4 -2
  61. package/package.json +4 -4
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IColorStyle, IColumnGroup, IDocDrawingBase, IDocumentRenderConfig, INestingLevel, IParagraph, IParagraphBorder, IParagraphProperties, ITable, ITableRow, ITextStyle, PageOrientType } from '@univerjs/core';
16
+ import type { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IColorStyle, IColumnGroup, IDocDrawingBase, IDocumentRenderConfig, INestingLevel, IParagraph, IParagraphBorder, IParagraphProperties, ITable, ITableRow, ITextStyle, PageOrientType, TabStopLeader } from '@univerjs/core';
17
17
  import type { BreakPointType } from '../components/docs/layout/line-breaker/break';
18
18
  export interface IDocumentSkeletonCached extends ISkeletonResourceReference {
19
19
  pages: IDocumentSkeletonPage[];
@@ -27,6 +27,13 @@ export interface IParagraphList {
27
27
  bullet: IDocumentSkeletonBullet;
28
28
  paragraph: IParagraph;
29
29
  }
30
+ export interface IDocumentSkeletonParagraphBorders {
31
+ borderTop?: IParagraphBorder;
32
+ borderBottom?: IParagraphBorder;
33
+ borderLeft?: IParagraphBorder;
34
+ borderRight?: IParagraphBorder;
35
+ borderBetween?: IParagraphBorder;
36
+ }
30
37
  export interface ISkeletonResourceReference {
31
38
  skeHeaders: Map<string, Map<number, IDocumentSkeletonHeaderFooter>>;
32
39
  skeFooters: Map<string, Map<number, IDocumentSkeletonHeaderFooter>>;
@@ -42,9 +49,18 @@ export declare enum DocumentSkeletonPageType {
42
49
  BODY = 0,
43
50
  HEADER = 1,
44
51
  FOOTER = 2,
45
- CELL = 3
52
+ CELL = 3,
53
+ NOTE = 4
46
54
  }
47
55
  export interface IDocumentSkeletonPage {
56
+ /**
57
+ * Preserves page geometry while incremental pagination rebuilds a later page.
58
+ * A placeholder can retain cloned flow nodes as a non-interactive visual preview;
59
+ * coordinate lookup must still treat the page as non-editable.
60
+ */
61
+ isLayoutPlaceholder?: boolean;
62
+ /** Canonical page geometry is available in the layout executor but not materialized on Main. */
63
+ isMaterializationPlaceholder?: boolean;
48
64
  /** Stable id of the document section that owns this body page. */
49
65
  sectionId?: string;
50
66
  sections: IDocumentSkeletonSection[];
@@ -67,15 +83,44 @@ export interface IDocumentSkeletonPage {
67
83
  width: number;
68
84
  height: number;
69
85
  breakType: BreakType;
86
+ /** Internal layout provenance used to distinguish a forced boundary from natural overflow. */
87
+ isExplicitPageBreak?: boolean;
88
+ /** Internal layout provenance for a page opened because content exhausted the previous page. */
89
+ isNaturalPageOverflow?: boolean;
90
+ /** Note fragments use their own segment offsets, independent of body character indices. */
91
+ notes?: IDocumentSkeletonNote[];
92
+ /** Space reserved on this body page for footnotes, including separators and continuation notices. */
93
+ footnoteHeight?: number;
94
+ /** Positioned separators and continuation notices for both footnotes and endnotes. */
95
+ noteDecorations?: IDocumentSkeletonNoteDecoration[];
70
96
  st: number;
71
97
  ed: number;
98
+ /** Whether this cell page is only a layout placeholder covered by a merged cell. */
99
+ isMergedCellCovered?: boolean;
72
100
  skeDrawings: Map<string, IDocumentSkeletonDrawing>;
73
101
  skeTables: Map<string, IDocumentSkeletonTable>;
74
102
  skeColumnGroups: Map<string, IDocumentSkeletonColumnGroup>;
75
103
  segmentId: string;
76
104
  type: DocumentSkeletonPageType;
77
105
  renderConfig?: IDocumentRenderConfig;
78
- parent?: IDocumentSkeletonCached | IDocumentSkeletonRow;
106
+ parent?: IDocumentSkeletonCached | IDocumentSkeletonRow | IDocumentSkeletonColumnGroupColumn | IDocumentSkeletonNote;
107
+ }
108
+ export interface IDocumentSkeletonNoteDecoration {
109
+ noteType?: 'footnote' | 'endnote';
110
+ kind: 'separator' | 'continuationSeparator' | 'continuationNotice';
111
+ left: number;
112
+ top: number;
113
+ page: IDocumentSkeletonPage;
114
+ }
115
+ export interface IDocumentSkeletonNote {
116
+ noteType?: 'footnote' | 'endnote';
117
+ noteId: string;
118
+ referenceIndex: number;
119
+ continued: boolean;
120
+ left: number;
121
+ top: number;
122
+ page: IDocumentSkeletonPage;
123
+ parent?: IDocumentSkeletonPage;
79
124
  }
80
125
  export interface IDocumentSkeletonHeaderFooter extends IDocumentSkeletonPage {
81
126
  }
@@ -98,6 +143,7 @@ export interface IDocumentSkeletonTable {
98
143
  ed: number;
99
144
  tableId: string;
100
145
  tableSource: ITable;
146
+ hasPageBreak?: boolean;
101
147
  parent?: IDocumentSkeletonPage;
102
148
  }
103
149
  export interface IDocumentSkeletonRow {
@@ -168,7 +214,14 @@ export interface IDocumentSkeletonLine {
168
214
  paragraphStart: boolean;
169
215
  isBehindTable: boolean;
170
216
  tableId: string;
217
+ borderBetween?: IParagraphBorder;
218
+ borderTop?: IParagraphBorder;
171
219
  borderBottom?: IParagraphBorder;
220
+ borderLeft?: IParagraphBorder;
221
+ borderRight?: IParagraphBorder;
222
+ paragraphBorders?: IDocumentSkeletonParagraphBorders;
223
+ paragraphPaddingLeft?: number;
224
+ paragraphPaddingRight?: number;
172
225
  backgroundColor?: IColorStyle;
173
226
  bullet?: IDocumentSkeletonBullet;
174
227
  width?: number;
@@ -209,7 +262,10 @@ export interface IDocumentSkeletonGlyph {
209
262
  url?: string;
210
263
  featureId?: string;
211
264
  drawingId?: string;
265
+ noteId?: string;
266
+ noteSeparator?: boolean;
212
267
  fauxBoldStrokeWidth?: number;
268
+ tabLeader?: TabStopLeader;
213
269
  }
214
270
  export interface IDocumentSkeletonBullet {
215
271
  listId: string;
@@ -262,6 +318,7 @@ export interface IDocumentSkeletonBoundingBox {
262
318
  width: number;
263
319
  ba: number;
264
320
  bd: number;
321
+ normalLineHeight?: number;
265
322
  aba: number;
266
323
  abd: number;
267
324
  sp: number;
@@ -31,5 +31,6 @@ export * from './text-rotation';
31
31
  export * from './tools';
32
32
  export * from './transform';
33
33
  export type { ITransformerConfig } from './transformer-config';
34
+ export { DEFAULT_TRANSFORMER_CONFIG } from './transformer-config';
34
35
  export * from './vector2';
35
36
  export * from './zoom';
@@ -78,6 +78,9 @@ export interface IFooterIds {
78
78
  }
79
79
  export interface ISectionBreakConfig extends IDocStyleBase, ISectionBreakBase, IDocsConfig {
80
80
  sectionId: string;
81
+ /** Cell continuation pages retain their segment and physical row-slice budgets. */
82
+ cellTableId?: string;
83
+ cellPageHeights?: readonly number[];
81
84
  headerIds?: IHeaderIds;
82
85
  footerIds?: IFooterIds;
83
86
  useFirstPageHeaderFooter?: BooleanNumber;
@@ -92,6 +95,7 @@ export interface IParagraphTableCache {
92
95
  }
93
96
  export interface IParagraphConfig {
94
97
  paragraphIndex: number;
98
+ isInsideTable?: boolean;
95
99
  documentCompatibilityPolicy?: IDocumentCompatibilityPolicy;
96
100
  useWordStyleLineHeight?: boolean;
97
101
  usePptxFontSizeLineHeight?: boolean;
@@ -71,6 +71,10 @@ export declare class PerformanceMonitor extends Disposable {
71
71
  * Returns the frame time of the last recent frame.
72
72
  */
73
73
  get instantaneousFrameTime(): number;
74
+ /**
75
+ * Estimates the browser animation-frame cadence while ignoring isolated long frames.
76
+ */
77
+ get estimatedFrameInterval(): number;
74
78
  /**
75
79
  * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)
76
80
  */
@@ -151,6 +155,7 @@ export declare class RollingAverage {
151
155
  * @return Value previously recorded with add() or null if outside of range
152
156
  */
153
157
  history(i: number): number;
158
+ percentile(percentile: number): number;
154
159
  /**
155
160
  * Returns true if enough samples have been taken to completely fill the sliding window
156
161
  * @return true if sample-set saturated
@@ -37,7 +37,7 @@ export interface IRectRangeWithStyle extends ITextRangeWithStyle {
37
37
  spanEntireColumn: boolean;
38
38
  spanEntireTable: boolean;
39
39
  }
40
- export type ISuccinctDocRangeParam = Pick<ITextRangeWithStyle, 'startOffset' | 'endOffset' | 'segmentId' | 'segmentPage' | 'style' | 'rangeType'>;
40
+ export type ISuccinctDocRangeParam = Pick<ITextRangeWithStyle, 'startOffset' | 'endOffset' | 'segmentId' | 'segmentPage' | 'style' | 'rangeType'> & Partial<Pick<ITextRangeWithStyle, 'collapsed' | 'direction' | 'isActive' | 'startNodePosition' | 'endNodePosition'>>;
41
41
  export interface IDocSelectionInnerParam {
42
42
  textRanges: ITextRangeWithStyle[];
43
43
  rectRanges: IRectRangeWithStyle[];
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable } from '@univerjs/core';
16
+ import type { ITransformState, Nullable } from '@univerjs/core';
17
17
  import type { BaseObject } from '../base-object';
18
18
  import type { IMouseEvent, IPointerEvent } from './i-events';
19
19
  export interface ITransformerConfig {
@@ -41,6 +41,7 @@ export interface ITransformerConfig {
41
41
  borderDash?: number[];
42
42
  borderSpacing?: number;
43
43
  resizeEnabled?: boolean;
44
+ moveEnabled?: boolean;
44
45
  enabledAnchors?: number[];
45
46
  anchorFill?: string;
46
47
  anchorStroke?: string;
@@ -64,7 +65,37 @@ export interface ITransformerConfig {
64
65
  shouldOverdrawWholeArea?: boolean;
65
66
  /** Render transformer controls on a layer independent from the selected object. */
66
67
  controlLayerIndex?: number;
68
+ /** Resolve display geometry for controls without changing the object's persisted transform. */
69
+ controlStateResolver?: (object: BaseObject) => ITransformState;
67
70
  zeroLeft?: number;
68
71
  zeroTop?: number;
69
72
  moveBoundaryEnabled?: boolean;
70
73
  }
74
+ export declare const DEFAULT_TRANSFORMER_CONFIG: {
75
+ moveEnabled: true;
76
+ resizeEnabled: true;
77
+ rotateEnabled: true;
78
+ rotateAnchorOffset: number;
79
+ rotateAnchorPosition: "bottom";
80
+ rotateLineEnabled: false;
81
+ rotateSize: number;
82
+ rotateCornerRadius: number;
83
+ rotateFill: string;
84
+ rotateStroke: string;
85
+ rotateStrokeWidth: number;
86
+ rotateIconEnabled: true;
87
+ rotateIconStroke: string;
88
+ rotateIconStrokeWidth: number;
89
+ borderEnabled: true;
90
+ borderStroke: string;
91
+ borderStrokeWidth: number;
92
+ borderSpacing: number;
93
+ anchorFill: string;
94
+ anchorStroke: string;
95
+ anchorStrokeWidth: number;
96
+ anchorSize: number;
97
+ anchorCornerRadius: number;
98
+ anchorStyle: "canva";
99
+ keepRatio: true;
100
+ moveBoundaryEnabled: true;
101
+ };
@@ -26,11 +26,19 @@ export declare class DocBackground extends DocComponent {
26
26
  private _marginStrokeColor?;
27
27
  private _pageBackgroundSource?;
28
28
  private _pageBackgroundImage?;
29
+ private _continuousSkeletonGeneration;
30
+ private _continuousSkeletonTimer;
31
+ private _continuousSkeletonVisible;
29
32
  constructor(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig);
30
33
  static create(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig): DocBackground;
34
+ dispose(): void;
31
35
  setFillColors(backgroundFillColor?: string, pageFillColor?: string, pageStrokeColor?: string, marginStrokeColor?: string): void;
32
36
  draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
33
37
  private _drawWorkspaceBackground;
38
+ private _drawPaginatedPlaceholderPages;
39
+ private _drawContinuousLayoutSkeleton;
40
+ private _resetContinuousSkeleton;
41
+ private _drawSkeletonLines;
34
42
  private _drawPageBackgroundImage;
35
43
  private _getPageBackgroundImage;
36
44
  changeSkeleton(newSkeleton: DocumentSkeleton): this;
@@ -18,7 +18,9 @@ import type { IBoundRectNoAngle } from '../../basics/vector2';
18
18
  import { ComponentExtension } from '../extension';
19
19
  export declare enum DOCS_EXTENSION_TYPE {
20
20
  SPAN = 0,
21
- LINE = 1
21
+ LINE = 1,
22
+ /** Draws range or block backgrounds before inline backgrounds and text. */
23
+ BACKGROUND = 2
22
24
  }
23
25
  export declare class docExtension extends ComponentExtension<IDocumentSkeletonGlyph | IDocumentSkeletonLine, DOCS_EXTENSION_TYPE, IBoundRectNoAngle> {
24
26
  type: DOCS_EXTENSION_TYPE;
@@ -38,6 +38,6 @@ export interface IDocumentCompatibilityPolicy {
38
38
  }
39
39
  export declare function getDocumentCompatibilityPolicy(documentFlavor?: DocumentFlavor): IDocumentCompatibilityPolicy;
40
40
  export declare function applyFontMetricCompatibility(content: string, fontStyle: IDocumentSkeletonFontStyle, bBox: IDocumentSkeletonBoundingBox, policy: IDocumentCompatibilityPolicy): IDocumentSkeletonBoundingBox;
41
- export declare function isTraditionalDocumentCompatibility(policy: IDocumentCompatibilityPolicy): boolean;
41
+ export declare function isTraditionalDocumentCompatibility(policy?: IDocumentCompatibilityPolicy): boolean;
42
42
  export declare function shouldAllowImportedTableMarginOverflow(policy: IDocumentCompatibilityPolicy, tableSource: ITable | unknown): boolean;
43
43
  export {};
@@ -13,8 +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 { Nullable } from '@univerjs/core';
17
- import type { IDocumentSkeletonPage, IDocumentSkeletonSection } from '../../basics/i-document-skeleton-cached';
16
+ import type { ICustomRange, Nullable } from '@univerjs/core';
17
+ import type { IDocumentSkeletonGlyph, IDocumentSkeletonPage, IDocumentSkeletonSection } from '../../basics/i-document-skeleton-cached';
18
18
  import type { Transform } from '../../basics/transform';
19
19
  import type { IViewportInfo } from '../../basics/vector2';
20
20
  import type { UniverRenderingContext } from '../../context';
@@ -23,6 +23,7 @@ import type { DocumentSkeleton } from './layout/doc-skeleton';
23
23
  import { Vector2 } from '../../basics/vector2';
24
24
  import { DocComponent } from './doc-component';
25
25
  import './extensions';
26
+ export declare function resolveHeaderFooterFieldGlyph(glyph: IDocumentSkeletonGlyph, startIndex: number, endIndex: number, customRanges: ICustomRange[], pageNumber: number, pageCount: number): IDocumentSkeletonGlyph;
26
27
  export interface IPageRenderConfig {
27
28
  page: IDocumentSkeletonPage;
28
29
  pageLeft: number;
@@ -55,7 +56,7 @@ export declare class Documents extends DocComponent {
55
56
  private _getRenderUnitId;
56
57
  private _getDocumentCompatibilityPolicy;
57
58
  private _drawLineBackground;
58
- private _drawBorderBottom;
59
+ private _drawParagraphBorders;
59
60
  private _drawGlyphGroupBackgrounds;
60
61
  private _drawTableCell;
61
62
  private _drawNestedPageContent;
@@ -46,5 +46,6 @@ export declare class FontAndBaseLine extends docExtension {
46
46
  private _colorWithOpacity;
47
47
  private _clamp;
48
48
  private _fillText;
49
+ private _getTabLeaderCharacter;
49
50
  clearCache(): void;
50
51
  }
@@ -13,11 +13,25 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable } from '@univerjs/core';
16
+ import type { IColumnGroup, Nullable } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonColumnGroup, IDocumentSkeletonPage } 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
+ interface IColumnGroupLayoutColumn {
23
+ columnId: string;
24
+ left: number;
25
+ top: number;
26
+ width: number;
27
+ }
28
+ interface IColumnGroupLayout {
29
+ mode: 'horizontal' | 'stack';
30
+ width: number;
31
+ height: number;
32
+ columns: IColumnGroupLayoutColumn[];
33
+ }
22
34
  export declare function createColumnGroupSkeleton(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, columnGroupNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): Nullable<IDocumentSkeletonColumnGroup>;
23
35
  export declare function appendColumnGroupBlockLine(page: IDocumentSkeletonPage, columnGroup: IDocumentSkeletonColumnGroup): boolean;
36
+ export declare function calculateColumnGroupLayout(source: IColumnGroup, availableWidth: number, columnHeights: number[]): IColumnGroupLayout;
37
+ export {};
@@ -13,15 +13,16 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDocumentSkeletonColumn, IDocumentSkeletonDrawing, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonSection, IDocumentSkeletonTable } from '../../../../../basics/i-document-skeleton-cached';
16
+ import type { IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonDrawing, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonSection, IDocumentSkeletonTable } from '../../../../../basics/i-document-skeleton-cached';
17
17
  import type { IParagraphConfig, IParagraphTableCache, ISectionBreakConfig } from '../../../../../basics/interfaces';
18
18
  import type { IFloatObject, ILayoutContext } from '../../tools';
19
19
  import { BooleanNumber, GridType, SpacingRule } from '@univerjs/core';
20
20
  import { BreakPointType } from '../../line-breaker/break';
21
21
  declare function isGlyphGroupBeyondDivideWidth(glyphGroup: IDocumentSkeletonGlyph[], offsetLeft: number, divideWidth: number, hangingPunctuation?: boolean): boolean;
22
- export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType): IDocumentSkeletonPage[];
22
+ export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType, renderBullet?: boolean): IDocumentSkeletonPage[];
23
+ declare function _adjustExplicitTabStop(divide: IDocumentSkeletonDivide, followingGlyphs: IDocumentSkeletonGlyph[], paragraphConfig: IParagraphConfig): void;
23
24
  declare function __avoidFlowAffectingDrawingsForTable(table: IDocumentSkeletonTable, page: IDocumentSkeletonPage, column: IDocumentSkeletonColumn): void;
24
- declare function _updateAndPositionTable(ctx: ILayoutContext, lineTop: number, lineHeight: number, page: IDocumentSkeletonPage, column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, skeTablesInParagraph: IParagraphTableCache[], paragraphIndex: number, sectionBreakConfig: ISectionBreakConfig, drawingAnchorTop?: number): boolean;
25
+ declare function _updateAndPositionTable(ctx: ILayoutContext, lineTop: number, lineHeight: number, page: IDocumentSkeletonPage, pages: IDocumentSkeletonPage[], column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, skeTablesInParagraph: IParagraphTableCache[], paragraphIndex: number, sectionBreakConfig: ISectionBreakConfig, drawingAnchorTop?: number): boolean;
25
26
  declare function _reLayoutCheck(ctx: ILayoutContext, floatObjects: IFloatObject[], column: IDocumentSkeletonColumn, paragraphIndex: number): void;
26
27
  export declare const __testing: {
27
28
  reLayoutCheck: typeof _reLayoutCheck;
@@ -29,8 +30,9 @@ export declare const __testing: {
29
30
  isGlyphGroupBeyondDivideWidth: typeof isGlyphGroupBeyondDivideWidth;
30
31
  checkPageBreak: typeof __checkPageBreak;
31
32
  updateAndPositionTable: typeof _updateAndPositionTable;
33
+ adjustExplicitTabStop: typeof _adjustExplicitTabStop;
32
34
  };
33
- export declare function getLineHeightMetrics(glyphLineHeight: number, paragraphLineGapDefault: number, linePitch: number, gridType: GridType, lineSpacing: number, spacingRule: SpacingRule, snapToGrid: BooleanNumber, useWordStyleLineHeight?: boolean, scaleAutoLineSpacingByGlyphHeight?: boolean): {
35
+ export declare function getLineHeightMetrics(glyphLineHeight: number, paragraphLineGapDefault: number, linePitch: number, gridType: GridType, lineSpacing: number, spacingRule: SpacingRule, snapToGrid: BooleanNumber, useWordStyleLineHeight?: boolean, scaleAutoLineSpacingByGlyphHeight?: boolean, normalLineHeight?: number, snapAutoLineSpacingToWholeGridLines?: boolean): {
34
36
  paddingTop: number;
35
37
  paddingBottom: number;
36
38
  contentHeight: number;
@@ -13,8 +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 { ISectionBreakConfig } from '../../../../../basics';
17
16
  import type { IDocumentSkeletonPage } from '../../../../../basics/i-document-skeleton-cached';
17
+ import type { ISectionBreakConfig } from '../../../../../basics/interfaces';
18
18
  import type { DataStreamTreeNode } from '../../../view-model/data-stream-tree-node';
19
19
  import type { DocumentViewModel } from '../../../view-model/document-view-model';
20
20
  export declare function lineAdjustment(pages: IDocumentSkeletonPage[], viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): void;
@@ -20,4 +20,4 @@ import type { DataStreamTreeNode } from '../../../view-model/data-stream-tree-no
20
20
  import type { DocumentViewModel } from '../../../view-model/document-view-model';
21
21
  import type { ILayoutContext } from '../../tools';
22
22
  import type { IShapedText } from './shaping';
23
- export declare function lineBreaking(ctx: ILayoutContext, viewModel: DocumentViewModel, shapedTextList: IShapedText[], curPage: IDocumentSkeletonPage, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableSkeleton: Nullable<IDocumentSkeletonTable>): IDocumentSkeletonPage[];
23
+ export declare function lineBreaking(ctx: ILayoutContext, viewModel: DocumentViewModel, shapedTextList: IShapedText[], curPage: IDocumentSkeletonPage, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableSkeleton: Nullable<IDocumentSkeletonTable>, tablePageBreakBefore?: boolean, nextParagraphNode?: DataStreamTreeNode): IDocumentSkeletonPage[];
@@ -18,4 +18,4 @@ import type { ISectionBreakConfig } from '../../../../../basics/interfaces';
18
18
  import type { DataStreamTreeNode } from '../../../view-model/data-stream-tree-node';
19
19
  import type { DocumentViewModel } from '../../../view-model/document-view-model';
20
20
  import type { ILayoutContext } from '../../tools';
21
- export declare function dealWidthParagraph(ctx: ILayoutContext, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, curPage: IDocumentSkeletonPage, sectionBreakConfig: ISectionBreakConfig): IDocumentSkeletonPage[];
21
+ export declare function dealWidthParagraph(ctx: ILayoutContext, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, curPage: IDocumentSkeletonPage, sectionBreakConfig: ISectionBreakConfig, nextParagraphNode?: DataStreamTreeNode): IDocumentSkeletonPage[];
@@ -13,12 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { IParagraphStyle } from '@univerjs/core';
16
17
  import type { IDocumentSkeletonGlyph } from '../../../../../basics/i-document-skeleton-cached';
17
18
  import type { ISectionBreakConfig } from '../../../../../basics/interfaces';
18
19
  import type { DataStreamTreeNode } from '../../../view-model/data-stream-tree-node';
19
20
  import type { DocumentViewModel } from '../../../view-model/document-view-model';
20
21
  import type { ILayoutContext } from '../../tools';
22
+ import { Lang } from '../../hyphenation/lang';
21
23
  import { BreakPointType } from '../../line-breaker/break';
24
+ export declare function getHyphenationLanguage(ctx: ILayoutContext, content: string, paragraphStyle: IParagraphStyle, sectionBreakConfig: ISectionBreakConfig): Lang;
22
25
  export interface IShapedText {
23
26
  text: string;
24
27
  glyphs: IDocumentSkeletonGlyph[];
@@ -19,7 +19,13 @@ 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
- export declare function dealWithSection(ctx: ILayoutContext, viewModel: DocumentViewModel, sectionNode: DataStreamTreeNode, curPage: IDocumentSkeletonPage, sectionBreakConfig: ISectionBreakConfig, layoutAnchor: Nullable<number>): {
22
+ export interface IDealWithSectionOptions {
23
+ startParagraphIndex?: number;
24
+ maxParagraphs?: number;
25
+ }
26
+ export declare function dealWithSection(ctx: ILayoutContext, viewModel: DocumentViewModel, sectionNode: DataStreamTreeNode, curPage: IDocumentSkeletonPage, sectionBreakConfig: ISectionBreakConfig, layoutAnchor: Nullable<number>, options?: IDealWithSectionOptions): {
23
27
  pages: IDocumentSkeletonPage[];
24
28
  renderedBlockIdMap: Map<string, boolean>;
29
+ nextParagraphIndex: number;
30
+ complete: boolean;
25
31
  };
@@ -14,17 +14,72 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { INumberUnit, ITable, Nullable } from '@univerjs/core';
17
- import type { IDocumentSkeletonPage, IDocumentSkeletonTable, IParagraphList, ISectionBreakConfig } from '../../../../basics';
17
+ import type { IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, IParagraphList } from '../../../../basics/i-document-skeleton-cached';
18
+ import type { ISectionBreakConfig } from '../../../../basics/interfaces';
18
19
  import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
19
20
  import type { DocumentViewModel } from '../../view-model/document-view-model';
21
+ import type { DocumentFootnoteLayout } from '../footnote-layout';
22
+ import type { ICellSkeletonBuildState } from '../model/page';
20
23
  import type { ILayoutContext } from '../tools';
21
24
  import { TableAlignmentType } from '@univerjs/core';
25
+ export interface ITableSkeletonBuildState {
26
+ ctx: ILayoutContext;
27
+ curPage: IDocumentSkeletonPage;
28
+ viewModel: DocumentViewModel;
29
+ tableNode: DataStreamTreeNode;
30
+ sectionBreakConfig: ISectionBreakConfig;
31
+ table: ITable;
32
+ tableSkeleton: IDocumentSkeletonTable;
33
+ rowIndex: number;
34
+ rowTop: number;
35
+ tableWidth: number;
36
+ complete: boolean;
37
+ currentRowNode: Nullable<DataStreamTreeNode>;
38
+ currentRowSkeleton: Nullable<IDocumentSkeletonRow>;
39
+ currentColumnIndex: number;
40
+ currentRowLeft: number;
41
+ currentRowHeight: number;
42
+ currentCellBuild: Nullable<ICellSkeletonBuildState>;
43
+ }
44
+ export declare function startTableSkeletonBuild(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, tableNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): Nullable<ITableSkeletonBuildState>;
45
+ export declare function stepTableSkeletonBuild(state: ITableSkeletonBuildState): boolean;
46
+ export declare function cachePrecomputedTableSkeleton(ctx: ILayoutContext, tableStartIndex: number, tableSkeleton: IDocumentSkeletonTable): void;
22
47
  export declare function createTableSkeleton(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, tableNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): Nullable<IDocumentSkeletonTable>;
23
48
  export declare function rollbackListCache(listLevel: Map<string, IParagraphList[][]>, table: DataStreamTreeNode): void;
24
49
  export interface ISlicedTableSkeletonParams {
25
50
  skeTables: IDocumentSkeletonTable[];
26
51
  fromCurrentPage: boolean;
27
52
  }
53
+ export interface ISlicedTableSkeletonBuildState {
54
+ ctx: ILayoutContext;
55
+ curPage: IDocumentSkeletonPage;
56
+ viewModel: DocumentViewModel;
57
+ tableNode: DataStreamTreeNode;
58
+ sectionBreakConfig: ISectionBreakConfig;
59
+ availableHeight: number;
60
+ table: ITable;
61
+ skeTables: IDocumentSkeletonTable[];
62
+ createCache: ICreateTableCache;
63
+ rowIndex: number;
64
+ columnIndex: number;
65
+ preparedCellPages: Map<number, IDocumentSkeletonPage[]>;
66
+ cellPageHeights?: number[];
67
+ pendingCellBuild: Nullable<ICellSkeletonBuildState>;
68
+ complete: boolean;
69
+ result: Nullable<ISlicedTableSkeletonParams>;
70
+ }
71
+ interface ICreateTableCache {
72
+ rowTop: number;
73
+ tableWidth: number;
74
+ remainHeight: number;
75
+ repeatRows: DataStreamTreeNode[];
76
+ repeatRowsHeight: number;
77
+ notes?: ReturnType<DocumentFootnoteLayout['createTablePagination']>;
78
+ fromCurrentPage?: boolean;
79
+ }
80
+ export declare function startTableSkeletonsBuild(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, tableNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, availableHeight: number): Nullable<ISlicedTableSkeletonBuildState>;
81
+ export declare function stepTableSkeletonsBuild(state: ISlicedTableSkeletonBuildState): boolean;
82
+ export declare function cachePrecomputedSlicedTableSkeletons(ctx: ILayoutContext, tableStartIndex: number, availableHeight: number, result: ISlicedTableSkeletonParams): void;
28
83
  export declare function createTableSkeletons(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, tableNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, availableHeight: number): ISlicedTableSkeletonParams;
29
84
  export declare function getTableLeft(pageWidth: number, tableWidth: number, align: TableAlignmentType, indent?: INumberUnit): number;
30
85
  export declare function getNullTableSkeleton(st: number, ed: number, table: ITable): IDocumentSkeletonTable;
@@ -33,3 +88,4 @@ export declare function getTableIdAndSliceIndex(tableSliceId: string): {
33
88
  tableId: string;
34
89
  sliceIndex: number;
35
90
  };
91
+ export {};