@univerjs/engine-render 1.0.0-alpha.8 → 1.0.0-beta.1

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 (45) hide show
  1. package/lib/cjs/index.js +6526 -5282
  2. package/lib/es/index.js +6513 -5284
  3. package/lib/index.js +6513 -5284
  4. package/lib/types/alignment-snap.d.ts +67 -0
  5. package/lib/types/base-object.d.ts +8 -0
  6. package/lib/types/basics/drawing-effect.d.ts +1 -1
  7. package/lib/types/basics/i-document-skeleton-cached.d.ts +17 -1
  8. package/lib/types/basics/interfaces.d.ts +10 -0
  9. package/lib/types/basics/performance-monitor.d.ts +5 -0
  10. package/lib/types/basics/tools.d.ts +1 -0
  11. package/lib/types/basics/transformer-config.d.ts +2 -0
  12. package/lib/types/components/docs/custom-block-render-viewport.d.ts +2 -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 +3 -2
  16. package/lib/types/components/docs/extensions/font-and-base-line.d.ts +1 -0
  17. package/lib/types/components/docs/extensions/line.d.ts +5 -1
  18. package/lib/types/components/docs/layout/block/paragraph/bullet.d.ts +2 -2
  19. package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +6 -4
  20. package/lib/types/components/docs/layout/block/paragraph/linebreaking.d.ts +1 -1
  21. package/lib/types/components/docs/layout/doc-no-wrap-measure.d.ts +5 -0
  22. package/lib/types/{basics/unit-convert.d.ts → components/docs/layout/line-breaker/extensions/east-asian-quote-linebreak-extension.d.ts} +2 -2
  23. package/lib/types/components/docs/layout/model/page.d.ts +2 -1
  24. package/lib/types/components/docs/layout/tools.d.ts +1 -0
  25. package/lib/types/components/sheets/constants.d.ts +2 -0
  26. package/lib/types/components/sheets/extensions/column-header-layout.d.ts +1 -1
  27. package/lib/types/components/sheets/extensions/row-header-layout.d.ts +1 -1
  28. package/lib/types/components/sheets/index.d.ts +2 -0
  29. package/lib/types/components/sheets/sheet.render-skeleton.d.ts +8 -1
  30. package/lib/types/components/sheets/spreadsheet.d.ts +8 -3
  31. package/lib/types/components/sheets/util.d.ts +10 -0
  32. package/lib/types/drawing-group.d.ts +1 -1
  33. package/lib/types/engine.d.ts +1 -0
  34. package/lib/types/index.d.ts +4 -1
  35. package/lib/types/layer.d.ts +14 -1
  36. package/lib/types/scene.d.ts +17 -0
  37. package/lib/types/scene.transformer.d.ts +1 -0
  38. package/lib/types/services/canvas-color.service.d.ts +5 -2
  39. package/lib/types/shape/checkbox.d.ts +2 -0
  40. package/lib/types/shape/image.d.ts +4 -0
  41. package/lib/types/shape/scroll-bar.d.ts +6 -2
  42. package/lib/types/shape/shape.d.ts +4 -1
  43. package/lib/types/viewport.d.ts +3 -1
  44. package/lib/umd/index.js +2 -2
  45. package/package.json +3 -3
@@ -0,0 +1,67 @@
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 interface IAlignmentRect {
17
+ left: number;
18
+ top: number;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ export type AlignmentSnapAxis = 'x' | 'y';
23
+ export interface IAlignmentSnapGuide {
24
+ id: string;
25
+ axis: AlignmentSnapAxis;
26
+ position: number;
27
+ }
28
+ export interface IAlignmentSnapSessionConfig {
29
+ enterThreshold?: number;
30
+ exitThreshold?: number;
31
+ breakawayThreshold?: number;
32
+ softThreshold?: number;
33
+ hardThreshold?: number;
34
+ softMaxStrength?: number;
35
+ cooldownMs?: number;
36
+ }
37
+ export interface IAlignmentSnapAxisOptions {
38
+ axis: AlignmentSnapAxis;
39
+ value: number;
40
+ guide: IAlignmentSnapGuide | null;
41
+ now?: number;
42
+ }
43
+ export interface IAlignmentSnapAxisResult {
44
+ snapped: boolean;
45
+ value: number;
46
+ guide: IAlignmentSnapGuide | null;
47
+ }
48
+ export declare function normalizeAlignmentRect(rect: IAlignmentRect): IAlignmentRect;
49
+ export declare function getAlignmentRectXAnchors(rect: IAlignmentRect): [number, number, number];
50
+ export declare function getAlignmentRectYAnchors(rect: IAlignmentRect): [number, number, number];
51
+ export declare function getClosestAlignmentOffset(activeAnchors: readonly number[], targetAnchors: readonly number[], threshold: number): number;
52
+ export declare class AlignmentSnapSession {
53
+ private readonly _enterThreshold;
54
+ private readonly _exitThreshold;
55
+ private readonly _breakawayThreshold;
56
+ private readonly _softThreshold;
57
+ private readonly _hardThreshold;
58
+ private readonly _softMaxStrength;
59
+ private readonly _cooldownMs;
60
+ private _activeGuideId;
61
+ private _activeGuideStartValue;
62
+ private _releasedUntil;
63
+ constructor(config?: IAlignmentSnapSessionConfig);
64
+ reset(): void;
65
+ resolveAxisSnap(options: IAlignmentSnapAxisOptions): IAlignmentSnapAxisResult;
66
+ private _resolveSnappedValue;
67
+ }
@@ -164,6 +164,14 @@ export declare abstract class BaseObject extends Disposable {
164
164
  isRender(bounds?: IViewportInfo): boolean | undefined;
165
165
  getParent(): any;
166
166
  getState(): ITransformState;
167
+ /**
168
+ * Returns the flip state after composing this object with every ancestor
169
+ * drawing group whose transform participates in rendering.
170
+ */
171
+ getEffectiveFlipState(): {
172
+ flipX: boolean;
173
+ flipY: boolean;
174
+ };
167
175
  getRealBound(): IGroupBaseBound;
168
176
  hide(): void;
169
177
  show(): void;
@@ -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 { IGlowEffect, IShadowEffect } from '@univerjs/core';
16
17
  import type { IBoundRectNoAngle } from './vector2';
17
- import { type IGlowEffect, type IShadowEffect } from '@univerjs/core';
18
18
  export interface IResolvedDrawingShadow {
19
19
  color: string;
20
20
  blurRadius: number;
@@ -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[];
@@ -67,8 +67,14 @@ export interface IDocumentSkeletonPage {
67
67
  width: number;
68
68
  height: number;
69
69
  breakType: BreakType;
70
+ /** Internal layout provenance used to distinguish a forced boundary from natural overflow. */
71
+ isExplicitPageBreak?: boolean;
72
+ /** Internal layout provenance for a page opened because content exhausted the previous page. */
73
+ isNaturalPageOverflow?: boolean;
70
74
  st: number;
71
75
  ed: number;
76
+ /** Whether this cell page is only a layout placeholder covered by a merged cell. */
77
+ isMergedCellCovered?: boolean;
72
78
  skeDrawings: Map<string, IDocumentSkeletonDrawing>;
73
79
  skeTables: Map<string, IDocumentSkeletonTable>;
74
80
  skeColumnGroups: Map<string, IDocumentSkeletonColumnGroup>;
@@ -98,6 +104,7 @@ export interface IDocumentSkeletonTable {
98
104
  ed: number;
99
105
  tableId: string;
100
106
  tableSource: ITable;
107
+ hasPageBreak?: boolean;
101
108
  parent?: IDocumentSkeletonPage;
102
109
  }
103
110
  export interface IDocumentSkeletonRow {
@@ -209,6 +216,8 @@ export interface IDocumentSkeletonGlyph {
209
216
  url?: string;
210
217
  featureId?: string;
211
218
  drawingId?: string;
219
+ fauxBoldStrokeWidth?: number;
220
+ tabLeader?: TabStopLeader;
212
221
  }
213
222
  export interface IDocumentSkeletonBullet {
214
223
  listId: string;
@@ -216,9 +225,13 @@ export interface IDocumentSkeletonBullet {
216
225
  ts: ITextStyle;
217
226
  fontStyle?: IDocumentSkeletonFontStyle;
218
227
  startIndexItem: number;
228
+ startNumber?: number;
219
229
  nestingLevel?: INestingLevel;
220
230
  bulletAlign?: BulletAlignment;
221
231
  bulletType?: boolean;
232
+ compactSpacing?: boolean;
233
+ preserveTextLineHeight?: boolean;
234
+ imageSource?: string;
222
235
  paragraphProperties?: IParagraphProperties;
223
236
  }
224
237
  export interface IDocumentSkeletonDrawing {
@@ -241,6 +254,8 @@ export interface IDocumentSkeletonDrawing {
241
254
  contentHeight?: number;
242
255
  contentWidth?: number;
243
256
  height?: number;
257
+ pageContentWidth?: number;
258
+ viewScale?: number;
244
259
  viewportHeight?: number;
245
260
  };
246
261
  }
@@ -255,6 +270,7 @@ export interface IDocumentSkeletonBoundingBox {
255
270
  width: number;
256
271
  ba: number;
257
272
  bd: number;
273
+ normalLineHeight?: number;
258
274
  aba: number;
259
275
  abd: number;
260
276
  sp: number;
@@ -92,8 +92,18 @@ export interface IParagraphTableCache {
92
92
  }
93
93
  export interface IParagraphConfig {
94
94
  paragraphIndex: number;
95
+ isInsideTable?: boolean;
95
96
  documentCompatibilityPolicy?: IDocumentCompatibilityPolicy;
96
97
  useWordStyleLineHeight?: boolean;
98
+ usePptxFontSizeLineHeight?: boolean;
99
+ usePptxNominalFontLineHeight?: boolean;
100
+ usePptxCompatibleLineSpacing?: boolean;
101
+ usePptxPercentageLineSpacing?: boolean;
102
+ pptxPercentageFontSize?: number;
103
+ usePptxNormAutofitLineHeight?: boolean;
104
+ pptxEmptyParagraphFontSize?: number;
105
+ pptxHasExplicitEndParaFontSize?: boolean;
106
+ sumPptxParagraphSpacing?: boolean;
97
107
  docxFallbackAnchorLeft?: IParagraphStyle['indentStart'];
98
108
  paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
99
109
  paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
@@ -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
@@ -16,6 +16,7 @@
16
16
  import type { IPosition, IRange, IRangeWithCoord, IScale, IStyleBase, Nullable } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonFontStyle } from './i-document-skeleton-cached';
18
18
  import type { IBoundRectNoAngle } from './vector2';
19
+ export declare function hasScrollableOverflow(contentSize: number, viewportSize: number): boolean;
19
20
  export declare const getColor: (RgbArray: number[], opacity?: number) => string;
20
21
  export declare const toPx: (num: number | string, ReferenceValue: Nullable<number>) => number;
21
22
  /**
@@ -62,6 +62,8 @@ export interface ITransformerConfig {
62
62
  boundBoxFunc?: Nullable<(oldBox: BaseObject, newBox: BaseObject) => BaseObject>;
63
63
  useSingleNodeRotation?: boolean;
64
64
  shouldOverdrawWholeArea?: boolean;
65
+ /** Render transformer controls on a layer independent from the selected object. */
66
+ controlLayerIndex?: number;
65
67
  zeroLeft?: number;
66
68
  zeroTop?: number;
67
69
  moveBoundaryEnabled?: boolean;
@@ -29,6 +29,8 @@ export interface IDocsCustomBlockRenderViewport {
29
29
  height: number;
30
30
  layoutWidth?: number;
31
31
  offsetLeft?: number;
32
+ pageContentWidth?: number;
33
+ viewScale?: number;
32
34
  viewportHeight?: number;
33
35
  width: number;
34
36
  }
@@ -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;
@@ -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
  }
@@ -15,17 +15,21 @@
15
15
  */
16
16
  import type { IScale } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonGlyph } from '../../../basics/i-document-skeleton-cached';
18
+ import type { IBoundRectNoAngle } from '../../../basics/vector2';
18
19
  import type { UniverRenderingContext } from '../../../context';
20
+ import type { IDrawInfo } from '../../extension';
19
21
  import { docExtension } from '../doc-extension';
20
22
  export declare class Line extends docExtension {
21
23
  uKey: string;
22
24
  Z_INDEX: number;
23
25
  private _preBackgroundColor;
24
- draw(ctx: UniverRenderingContext, parentScale: IScale, glyph: IDocumentSkeletonGlyph): void;
26
+ draw(ctx: UniverRenderingContext, parentScale: IScale, glyph: IDocumentSkeletonGlyph, _diff?: IBoundRectNoAngle, more?: IDrawInfo): void;
25
27
  clearCache(): void;
26
28
  private _drawLine;
27
29
  private _drawLineTo;
28
30
  private _setLineType;
29
31
  private _isWave;
30
32
  private _isDouble;
33
+ private _isAccounting;
34
+ private _isFirstAccountingGlyph;
31
35
  }
@@ -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 { IBullet, ILists, LocaleService, Nullable } from '@univerjs/core';
16
+ import type { IBullet, ILists, ITextStyle, LocaleService, Nullable } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonBullet } from '../../../../../basics/i-document-skeleton-cached';
18
- export declare function dealWithBullet(bullet?: IBullet, lists?: ILists, listLevelAncestors?: Array<Nullable<IDocumentSkeletonBullet>>, localeService?: LocaleService): IDocumentSkeletonBullet | undefined;
18
+ export declare function dealWithBullet(bullet?: IBullet, lists?: ILists, listLevelAncestors?: Array<Nullable<IDocumentSkeletonBullet>>, localeService?: LocaleService, compactSpacing?: boolean, paragraphTextStyle?: ITextStyle): IDocumentSkeletonBullet | undefined;
19
19
  export declare function getDefaultBulletSke(listId: string, startIndex?: number): IDocumentSkeletonBullet;
@@ -13,13 +13,14 @@
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
- declare function isGlyphGroupBeyondDivideWidth(glyphGroup: IDocumentSkeletonGlyph[], offsetLeft: number, divideWidth: number): boolean;
22
- export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType): IDocumentSkeletonPage[];
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, 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
25
  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
26
  declare function _reLayoutCheck(ctx: ILayoutContext, floatObjects: IFloatObject[], column: IDocumentSkeletonColumn, paragraphIndex: number): void;
@@ -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;
@@ -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): IDocumentSkeletonPage[];
@@ -27,6 +27,11 @@ export declare function measureDocumentNoWrapTextRangeWidth(documentData: IDocum
27
27
  * details such as CJK-Latin spacing.
28
28
  */
29
29
  export declare function measureDocumentNoWrapTextWidth(documentData: IDocumentData | null | undefined): number;
30
+ /**
31
+ * Measures the widest line after applying the docs Unicode break policy
32
+ * within a fixed-width host.
33
+ */
34
+ export declare function measureDocumentWrappedTextWidth(documentData: IDocumentData | null | undefined, maxLineWidth: number): number;
30
35
  /**
31
36
  * Measures the widest segment that docs line breaking keeps together. This is
32
37
  * useful when a host may wrap normally but still needs enough width to avoid
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- declare const whiteListKeyForPt: Set<string>;
17
- declare function isNotEmpty(value: unknown): boolean;
16
+ import type { LineBreaker } from '../line-breaker';
17
+ export declare function eastAsianQuoteLineBreakExtension(breaker: LineBreaker): void;
@@ -21,10 +21,11 @@ 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
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): {
24
+ export declare function createNullCellPage(ctx: ILayoutContext, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number, inheritDocumentLinePitch?: boolean, enableDocumentTableLineGrid?: boolean): {
25
25
  page: IDocumentSkeletonPage;
26
26
  sectionBreakConfig: ISectionBreakConfig;
27
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
29
  export declare function expandCellPageHeightForInlineDrawings(pages: IDocumentSkeletonPage[]): void;
30
+ export declare function expandCellPageHeightForFlowTables(pages: IDocumentSkeletonPage[]): void;
30
31
  export declare function applyTrailingBlockRangeSpaceBelow(pages: IDocumentSkeletonPage[], body: Nullable<IDocumentBody>, containerEndIndex: number): void;
@@ -50,6 +50,7 @@ export declare function isBlankColumn(column: IDocumentSkeletonColumn): boolean;
50
50
  export declare function getNumberUnitValue(unitValue: Nullable<INumberUnit>, benchMark: number): number;
51
51
  export declare function getCharSpaceApply(charSpace: number | undefined, defaultTabStop: number, gridType?: GridType, snapToGrid?: BooleanNumber): number;
52
52
  export declare function validationGrid(gridType?: GridType, snapToGrid?: BooleanNumber): boolean;
53
+ export declare function reachesNextDocumentGridLine(lineSpacing: number, spaceBelow: number, linePitch: number): boolean;
53
54
  export declare function getLineHeightConfig(sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig): {
54
55
  paragraphLineGapDefault: number;
55
56
  linePitch: number;
@@ -19,6 +19,8 @@ export declare const FONT_EXTENSION_Z_INDEX = 45;
19
19
  export declare const BG_Z_INDEX = 21;
20
20
  export declare const PRINTING_BG_Z_INDEX = 21;
21
21
  export declare const EXPAND_SIZE_FOR_RENDER_OVERFLOW = 20;
22
+ export declare const MIN_TEXT_RENDER_HEIGHT_IN_SCREEN_PX = 4;
23
+ export declare function shouldRenderRowText(rowHeight: number, scaleY?: number): boolean;
22
24
  export declare const sheetContentViewportKeys: SHEET_VIEWPORT_KEY[];
23
25
  export declare const sheetHeaderViewportKeys: SHEET_VIEWPORT_KEY[];
24
26
  export declare const MEASURE_EXTENT = 10000;
@@ -35,7 +35,7 @@ export declare class ColumnHeaderLayout extends SheetExtension {
35
35
  constructor(cfg?: IColumnsHeaderCfgParam);
36
36
  configHeaderColumn(cfg: IColumnsHeaderCfgParam, sheetId?: string): void;
37
37
  getColumnsCfg(sheetId: string): Record<number, IAColumnCfg>;
38
- getHeaderStyle(sheetId: string): IHeaderStyleCfg;
38
+ getHeaderStyle(sheetId: string, isPrinting?: boolean): IHeaderStyleCfg;
39
39
  getCfgOfCurrentColumn(columnsCfg: Record<number, IAColumnCfg>, headerStyle: IHeaderStyleCfg, colIndex: number): [IAColumnCfgObj, boolean];
40
40
  setStyleToCtx(ctx: UniverRenderingContext, columnStyle: Partial<IHeaderStyleCfg>): void;
41
41
  draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton): void;
@@ -32,7 +32,7 @@ export declare class RowHeaderLayout extends SheetExtension {
32
32
  constructor(cfg?: IRowsHeaderCfgParam);
33
33
  configHeaderRow(cfg: IRowsHeaderCfgParam, sheetId?: string): void;
34
34
  getRowsCfg(sheetId: string): Record<number, IARowCfg>;
35
- getHeaderStyle(sheetId: string): IRowStyleCfg;
35
+ getHeaderStyle(sheetId: string, isPrinting?: boolean): IRowStyleCfg;
36
36
  getCfgOfCurrentRow(rowsCfg: Record<number, IARowCfg>, headerStyle: IHeaderStyleCfg, rowIndex: number): [IARowCfgObj, boolean];
37
37
  setStyleToCtx(ctx: UniverRenderingContext, rowStyle: Partial<IHeaderStyleCfg>): void;
38
38
  draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton): void;
@@ -21,4 +21,6 @@ export * from './row-header';
21
21
  export * from './sheet-component';
22
22
  export * from './sheet.render-skeleton';
23
23
  export * from './spreadsheet';
24
+ export { calculateCellImageRect } from './util';
25
+ export type { ICellImageRectConfig } from './util';
24
26
  export * from './watermark';
@@ -40,6 +40,7 @@ export declare const DEFAULT_PADDING_DATA: {
40
40
  };
41
41
  export declare const RENDER_RAW_FORMULA_KEY = "RENDER_RAW_FORMULA";
42
42
  export declare function getShrinkToFitScale(contentWidth: number, availableWidth: number, fontSize: number): number;
43
+ export declare function getGeneralNumberDisplayText(value: number, displayText: string, fontString: string, availableWidth: number): string;
43
44
  export declare function scaleDocumentDataForShrinkToFit(documentData: IDocumentData, scale: number, fallbackFontSize: number): IDocumentData;
44
45
  export interface ICacheItem {
45
46
  bg: boolean;
@@ -51,6 +52,10 @@ interface ISetStylesCacheForOneCellOptions {
51
52
  reuseExisting?: boolean;
52
53
  hasMergeData?: boolean;
53
54
  rowVisible?: boolean;
55
+ skipFontCache?: boolean;
56
+ }
57
+ export interface ISetStylesCacheOptions {
58
+ scaleY?: number;
54
59
  }
55
60
  export interface IGetPosByRowColOptions {
56
61
  closeFirst?: boolean;
@@ -115,8 +120,9 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
115
120
  /**
116
121
  * Set border background and font to this._stylesCache by visible range, which derives from bounds)
117
122
  * @param vpInfo viewBounds
123
+ * @param options screen scale
118
124
  */
119
- setStylesCache(vpInfo?: IViewportInfo): Nullable<SpreadsheetSkeleton>;
125
+ setStylesCache(vpInfo?: IViewportInfo, options?: ISetStylesCacheOptions): Nullable<SpreadsheetSkeleton>;
120
126
  /**
121
127
  * Calc all auto height by getDocsSkeletonPageSize in ranges
122
128
  * @param ranges
@@ -177,6 +183,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
177
183
  _setBorderStylesCache(row: number, col: number, style: Nullable<IStyleData>, options: ISetStylesCacheForOneCellOptions | undefined): void;
178
184
  _setBgStylesCache(row: number, col: number, style: Nullable<IStyleData>, options: ISetStylesCacheForOneCellOptions | undefined): void;
179
185
  private _applyShrinkToFit;
186
+ private _applyGeneralNumberDisplay;
180
187
  _setFontStylesCache(row: number, col: number, cellData: Nullable<ICellDataForSheetInterceptor>, style: IStyleData, hasMergeData?: boolean): void;
181
188
  /**
182
189
  * Set border background and font to this._stylesCache cell by cell.
@@ -15,7 +15,6 @@
15
15
  */
16
16
  import type { IPosition, IRange } from '@univerjs/core';
17
17
  import type { IBoundRectNoAngle, IViewportInfo, Vector2 } from '../../basics/vector2';
18
- import type { Canvas } from '../../canvas';
19
18
  import type { UniverRenderingContext2D } from '../../context';
20
19
  import type { Scene } from '../../scene';
21
20
  import type { Background } from './extensions/background';
@@ -23,10 +22,12 @@ import type { Border } from './extensions/border';
23
22
  import type { Font } from './extensions/font';
24
23
  import type { IPaintForRefresh, IPaintForScrolling } from './interfaces';
25
24
  import type { SpreadsheetSkeleton } from './sheet.render-skeleton';
25
+ import { Canvas } from '../../canvas';
26
26
  import { Documents } from '../docs/document';
27
27
  import { SheetComponent } from './sheet-component';
28
28
  export declare class Spreadsheet extends SheetComponent {
29
29
  private _allowCache;
30
+ private _scrollBufferCanvases;
30
31
  private _backgroundExtension;
31
32
  private _borderExtension;
32
33
  private _fontExtension;
@@ -48,7 +49,7 @@ export declare class Spreadsheet extends SheetComponent {
48
49
  * @param ctx
49
50
  * @param viewportInfo
50
51
  */
51
- draw(ctx: UniverRenderingContext2D, viewportInfo: IViewportInfo): void;
52
+ draw(ctx: UniverRenderingContext2D, viewportInfo: IViewportInfo, isMergeRepair?: boolean): void;
52
53
  addRenderFrameTimeMetricToScene(timeKey: string, val: number, scene: Scene): void;
53
54
  addRenderTagToScene(renderKey: string, val: any, scene?: Scene): void;
54
55
  /**
@@ -77,7 +78,11 @@ export declare class Spreadsheet extends SheetComponent {
77
78
  makeDirty(state?: boolean): this;
78
79
  setDirtyArea(dirtyBounds: IBoundRectNoAngle[]): void;
79
80
  renderByViewports(mainCtx: UniverRenderingContext2D, viewportInfo: IViewportInfo, spreadsheetSkeleton: SpreadsheetSkeleton): void;
80
- paintNewAreaForScrolling(viewportInfo: IViewportInfo, param: IPaintForScrolling): void;
81
+ private _getMergeRepairBounds;
82
+ private _getRepaintBounds;
83
+ paintNewAreaForScrolling(viewportInfo: IViewportInfo, param: IPaintForScrolling, mergeRepairBounds?: IBoundRectNoAngle[]): Canvas;
84
+ private _copyCacheForScrolling;
85
+ private _getScrollBufferCanvas;
81
86
  /**
82
87
  * Redraw the entire viewport.
83
88
  */
@@ -14,7 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { CellValueType, IPaddingData, IStyleBase, IStyleData, ITextRotation, ITextStyle, Nullable, TextDirection } from '@univerjs/core';
17
+ import type { IBoundRectNoAngle } from '../../basics';
17
18
  import { DocumentDataModel, HorizontalAlign, VerticalAlign, WrapStrategy } from '@univerjs/core';
19
+ export interface ICellImageRectConfig {
20
+ cellRect: IBoundRectNoAngle;
21
+ imageWidth: number;
22
+ imageHeight: number;
23
+ horizontalAlign: HorizontalAlign;
24
+ verticalAlign: VerticalAlign;
25
+ padding?: Nullable<IPaddingData>;
26
+ }
27
+ export declare function calculateCellImageRect(config: ICellImageRectConfig): IBoundRectNoAngle;
18
28
  export interface ICellStyle {
19
29
  textRotation?: ITextRotation;
20
30
  textDirection?: Nullable<TextDirection>;
@@ -34,7 +34,7 @@ export declare class DrawingGroupObject extends Group {
34
34
  * When rendering, positions are mapped from baseBound space to the group's current transform.
35
35
  */
36
36
  private _baseBound;
37
- private _outerShadow?;
37
+ protected _outerShadow?: IDrawingGroupShadow;
38
38
  private _glow?;
39
39
  setOuterShadow(shadow?: IDrawingGroupShadow): void;
40
40
  setGlow(glow?: IGlowEffect): void;
@@ -171,6 +171,7 @@ export declare class Engine extends Disposable {
171
171
  * @returns a number representing the delta time in ms
172
172
  */
173
173
  getDeltaTime(): number;
174
+ getEstimatedFrameInterval(): number;
174
175
  /**
175
176
  * Exec all function in _renderFrameTasks
176
177
  */
@@ -13,6 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export { AlignmentSnapSession, getAlignmentRectXAnchors, getAlignmentRectYAnchors, getClosestAlignmentOffset, normalizeAlignmentRect, } from './alignment-snap';
17
+ export type { AlignmentSnapAxis, IAlignmentRect, IAlignmentSnapAxisOptions, IAlignmentSnapAxisResult, IAlignmentSnapGuide, IAlignmentSnapSessionConfig, } from './alignment-snap';
16
18
  export * from './base-object';
17
19
  export * from './basics';
18
20
  export { combineDrawingEffectFilter, createDrawingEffectFilter, expandDrawingEffectBounds, resolveDrawingEffectMasks, resolveGlowEffect, resolveOuterShadowEffect, } from './basics/drawing-effect';
@@ -23,11 +25,12 @@ export * from './components';
23
25
  export type { DocsCustomBlockRenderViewportProvider, IDocsCustomBlockRenderViewport, IDocsCustomBlockRenderViewportInput } from './components/docs/custom-block-render-viewport';
24
26
  export { getDocsCustomBlockRenderViewport, setDocsCustomBlockRenderViewportProvider } from './components/docs/custom-block-render-viewport';
25
27
  export { DocBackground } from './components/docs/doc-background';
28
+ export { DOCS_EXTENSION_TYPE } from './components/docs/doc-extension';
26
29
  export { Documents } from './components/docs/document';
27
30
  export type { IPageRenderConfig } from './components/docs/document';
28
31
  export type { IDocumentOffsetConfig } from './components/docs/document';
29
32
  export { getTableIdAndSliceIndex } from './components/docs/layout/block/table';
30
- export { measureDocumentNoWrapTextRangeWidth, measureDocumentNoWrapTextWidth, measureDocumentUnbreakableTextWidth, } from './components/docs/layout/doc-no-wrap-measure';
33
+ export { measureDocumentNoWrapTextRangeWidth, measureDocumentNoWrapTextWidth, measureDocumentUnbreakableTextWidth, measureDocumentWrappedTextWidth, } from './components/docs/layout/doc-no-wrap-measure';
31
34
  export * from './components/docs/layout/doc-simple-skeleton';
32
35
  export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
33
36
  export type { IFindNodeRestrictions } from './components/docs/layout/doc-skeleton';
@@ -13,16 +13,29 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { IBoundRectNoAngle, IViewportInfo } from './basics/vector2';
16
17
  import type { UniverRenderingContext } from './context';
17
18
  import type { Scene } from './scene';
18
19
  import { Disposable } from '@univerjs/core';
19
20
  import { BaseObject } from './base-object';
21
+ export interface IScrollRenderInfo {
22
+ bounds: IBoundRectNoAngle;
23
+ offsetX: number;
24
+ offsetY: number;
25
+ }
26
+ export interface ILayerRenderOptions {
27
+ dirtyBounds?: IBoundRectNoAngle[];
28
+ preserveCache?: boolean;
29
+ viewportInfos?: Map<string, IViewportInfo>;
30
+ }
31
+ export declare function scrollAndClearCanvas(ctx: UniverRenderingContext, pixelRatio: number, scrollRenderInfos: IScrollRenderInfo[], dirtyBounds: IBoundRectNoAngle[]): void;
20
32
  export declare class Layer extends Disposable {
21
33
  private _scene;
22
34
  private _zIndex;
23
35
  private _allowCache;
24
36
  private _objects;
25
37
  private _cacheCanvas;
38
+ private _cacheValid;
26
39
  protected _dirty: boolean;
27
40
  private _debounceDirtyFunc;
28
41
  constructor(_scene: Scene, objects?: BaseObject[], _zIndex?: number, _allowCache?: boolean);
@@ -59,7 +72,7 @@ export declare class Layer extends Disposable {
59
72
  makeDirty(state?: boolean): this;
60
73
  makeDirtyWithDebounce(state?: boolean): void;
61
74
  isDirty(): boolean;
62
- render(parentCtx?: UniverRenderingContext, isMaxLayer?: boolean): this;
75
+ render(parentCtx?: UniverRenderingContext, isMaxLayer?: boolean, options?: ILayerRenderOptions): this;
63
76
  private _layerBehavior;
64
77
  private _initialCacheCanvas;
65
78
  private _draw;