@univerjs/engine-render 1.0.0-beta.0 → 1.0.0-beta.2
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.
- package/lib/cjs/index.js +5801 -4841
- package/lib/es/index.js +5797 -4844
- package/lib/index.js +5797 -4844
- package/lib/types/basics/i-document-skeleton-cached.d.ts +10 -1
- package/lib/types/basics/index.d.ts +1 -0
- package/lib/types/basics/interfaces.d.ts +1 -0
- package/lib/types/basics/performance-monitor.d.ts +5 -0
- package/lib/types/basics/transformer-config.d.ts +29 -0
- package/lib/types/components/docs/doc-extension.d.ts +3 -1
- package/lib/types/components/docs/document-compatibility.d.ts +1 -1
- package/lib/types/components/docs/document.d.ts +3 -2
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +1 -0
- package/lib/types/components/docs/layout/block/column.d.ts +15 -1
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +5 -3
- package/lib/types/components/docs/layout/block/paragraph/linebreaking.d.ts +1 -1
- package/lib/types/components/docs/layout/model/page.d.ts +2 -1
- package/lib/types/components/docs/layout/style/color.d.ts +17 -0
- package/lib/types/components/docs/layout/tools.d.ts +1 -0
- package/lib/types/components/sheets/constants.d.ts +2 -0
- package/lib/types/components/sheets/extensions/column-header-layout.d.ts +1 -1
- package/lib/types/components/sheets/extensions/row-header-layout.d.ts +1 -1
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +8 -1
- package/lib/types/components/sheets/spreadsheet.d.ts +5 -2
- package/lib/types/context.d.ts +4 -0
- package/lib/types/engine.d.ts +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/layer.d.ts +14 -1
- package/lib/types/render-manager/render-manager.service.d.ts +1 -1
- package/lib/types/scene.d.ts +19 -0
- package/lib/types/scene.transformer.d.ts +1 -0
- package/lib/types/services/canvas-color.service.d.ts +4 -3
- package/lib/types/shape/checkbox.d.ts +2 -0
- package/lib/types/shape/image.d.ts +4 -0
- package/lib/types/shape/scroll-bar.d.ts +2 -2
- package/lib/types/shape/shape.d.ts +10 -1
- package/lib/types/viewport.d.ts +3 -1
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
|
@@ -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 {
|
|
@@ -210,6 +217,7 @@ export interface IDocumentSkeletonGlyph {
|
|
|
210
217
|
featureId?: string;
|
|
211
218
|
drawingId?: string;
|
|
212
219
|
fauxBoldStrokeWidth?: number;
|
|
220
|
+
tabLeader?: TabStopLeader;
|
|
213
221
|
}
|
|
214
222
|
export interface IDocumentSkeletonBullet {
|
|
215
223
|
listId: string;
|
|
@@ -262,6 +270,7 @@ export interface IDocumentSkeletonBoundingBox {
|
|
|
262
270
|
width: number;
|
|
263
271
|
ba: number;
|
|
264
272
|
bd: number;
|
|
273
|
+
normalLineHeight?: number;
|
|
265
274
|
aba: number;
|
|
266
275
|
abd: number;
|
|
267
276
|
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';
|
|
@@ -92,6 +92,7 @@ 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;
|
|
97
98
|
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
|
|
@@ -62,7 +62,36 @@ 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;
|
|
68
70
|
}
|
|
71
|
+
export declare const DEFAULT_TRANSFORMER_CONFIG: {
|
|
72
|
+
resizeEnabled: true;
|
|
73
|
+
rotateEnabled: true;
|
|
74
|
+
rotateAnchorOffset: number;
|
|
75
|
+
rotateAnchorPosition: "bottom";
|
|
76
|
+
rotateLineEnabled: false;
|
|
77
|
+
rotateSize: number;
|
|
78
|
+
rotateCornerRadius: number;
|
|
79
|
+
rotateFill: string;
|
|
80
|
+
rotateStroke: string;
|
|
81
|
+
rotateStrokeWidth: number;
|
|
82
|
+
rotateIconEnabled: true;
|
|
83
|
+
rotateIconStroke: string;
|
|
84
|
+
rotateIconStrokeWidth: number;
|
|
85
|
+
borderEnabled: true;
|
|
86
|
+
borderStroke: string;
|
|
87
|
+
borderStrokeWidth: number;
|
|
88
|
+
borderSpacing: number;
|
|
89
|
+
anchorFill: string;
|
|
90
|
+
anchorStroke: string;
|
|
91
|
+
anchorStrokeWidth: number;
|
|
92
|
+
anchorSize: number;
|
|
93
|
+
anchorCornerRadius: number;
|
|
94
|
+
anchorStyle: "canva";
|
|
95
|
+
keepRatio: true;
|
|
96
|
+
moveBoundaryEnabled: true;
|
|
97
|
+
};
|
|
@@ -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
|
|
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;
|
|
@@ -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,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
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
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
|
|
23
|
+
export declare function lineBreaking(ctx: ILayoutContext, viewModel: DocumentViewModel, shapedTextList: IShapedText[], curPage: IDocumentSkeletonPage, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableSkeleton: Nullable<IDocumentSkeletonTable>, tablePageBreakBefore?: boolean): IDocumentSkeletonPage[];
|
|
@@ -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;
|
|
@@ -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>;
|
|
@@ -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;
|
|
@@ -52,6 +52,10 @@ interface ISetStylesCacheForOneCellOptions {
|
|
|
52
52
|
reuseExisting?: boolean;
|
|
53
53
|
hasMergeData?: boolean;
|
|
54
54
|
rowVisible?: boolean;
|
|
55
|
+
skipFontCache?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface ISetStylesCacheOptions {
|
|
58
|
+
scaleY?: number;
|
|
55
59
|
}
|
|
56
60
|
export interface IGetPosByRowColOptions {
|
|
57
61
|
closeFirst?: boolean;
|
|
@@ -78,6 +82,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
78
82
|
private _handleBorderMatrix;
|
|
79
83
|
private _showGridlines;
|
|
80
84
|
private _gridlinesColor;
|
|
85
|
+
private _defaultGridlinesColor;
|
|
81
86
|
private _scene;
|
|
82
87
|
constructor(worksheet: Worksheet, _styles: Styles, _localeService: LocaleService, _contextService: IContextService, _configService: IConfigService, _injector: Injector);
|
|
83
88
|
registerGetCellHeight(): void;
|
|
@@ -98,6 +103,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
98
103
|
get incrementalFontRenderRanges(): IRange[];
|
|
99
104
|
get showGridlines(): BooleanNumber;
|
|
100
105
|
get gridlinesColor(): string | undefined;
|
|
106
|
+
get defaultGridlinesColor(): string;
|
|
101
107
|
dispose(): void;
|
|
102
108
|
setOverflowCache(value: ObjectMatrix<IRange>): void;
|
|
103
109
|
getFont(rowIndex: number, columnIndex: number): Nullable<IFontCacheItem>;
|
|
@@ -116,8 +122,9 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
116
122
|
/**
|
|
117
123
|
* Set border background and font to this._stylesCache by visible range, which derives from bounds)
|
|
118
124
|
* @param vpInfo viewBounds
|
|
125
|
+
* @param options screen scale
|
|
119
126
|
*/
|
|
120
|
-
setStylesCache(vpInfo?: IViewportInfo): Nullable<SpreadsheetSkeleton>;
|
|
127
|
+
setStylesCache(vpInfo?: IViewportInfo, options?: ISetStylesCacheOptions): Nullable<SpreadsheetSkeleton>;
|
|
121
128
|
/**
|
|
122
129
|
* Calc all auto height by getDocsSkeletonPageSize in ranges
|
|
123
130
|
* @param ranges
|
|
@@ -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;
|
|
@@ -79,7 +80,9 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
79
80
|
renderByViewports(mainCtx: UniverRenderingContext2D, viewportInfo: IViewportInfo, spreadsheetSkeleton: SpreadsheetSkeleton): void;
|
|
80
81
|
private _getMergeRepairBounds;
|
|
81
82
|
private _getRepaintBounds;
|
|
82
|
-
paintNewAreaForScrolling(viewportInfo: IViewportInfo, param: IPaintForScrolling, mergeRepairBounds?: IBoundRectNoAngle[]):
|
|
83
|
+
paintNewAreaForScrolling(viewportInfo: IViewportInfo, param: IPaintForScrolling, mergeRepairBounds?: IBoundRectNoAngle[]): Canvas;
|
|
84
|
+
private _copyCacheForScrolling;
|
|
85
|
+
private _getScrollBufferCanvas;
|
|
83
86
|
/**
|
|
84
87
|
* Redraw the entire viewport.
|
|
85
88
|
*/
|
package/lib/types/context.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface IUniverRenderingContextOptions {
|
|
|
21
21
|
export declare class UniverRenderingContext2D implements CanvasRenderingContext2D {
|
|
22
22
|
__mode: string;
|
|
23
23
|
private _transformCache;
|
|
24
|
+
private _bitmapMutationId;
|
|
25
|
+
private _bitmapMutationTrackingDepth;
|
|
24
26
|
readonly canvas: HTMLCanvasElement;
|
|
25
27
|
_context: CanvasRenderingContext2D;
|
|
26
28
|
private _systemType;
|
|
@@ -31,6 +33,8 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
31
33
|
private _id;
|
|
32
34
|
getId(): string;
|
|
33
35
|
setId(id: string): void;
|
|
36
|
+
detectBitmapMutation(callback: () => void): boolean;
|
|
37
|
+
private _markBitmapMutation;
|
|
34
38
|
isContextLost(): boolean;
|
|
35
39
|
get globalAlpha(): number;
|
|
36
40
|
set globalAlpha(val: number);
|
package/lib/types/engine.d.ts
CHANGED
package/lib/types/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './components';
|
|
|
25
25
|
export type { DocsCustomBlockRenderViewportProvider, IDocsCustomBlockRenderViewport, IDocsCustomBlockRenderViewportInput } from './components/docs/custom-block-render-viewport';
|
|
26
26
|
export { getDocsCustomBlockRenderViewport, setDocsCustomBlockRenderViewportProvider } from './components/docs/custom-block-render-viewport';
|
|
27
27
|
export { DocBackground } from './components/docs/doc-background';
|
|
28
|
+
export { DOCS_EXTENSION_TYPE } from './components/docs/doc-extension';
|
|
28
29
|
export { Documents } from './components/docs/document';
|
|
29
30
|
export type { IPageRenderConfig } from './components/docs/document';
|
|
30
31
|
export type { IDocumentOffsetConfig } from './components/docs/document';
|
package/lib/types/layer.d.ts
CHANGED
|
@@ -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;
|
|
@@ -78,7 +78,7 @@ export declare class RenderManagerService extends Disposable implements IRenderM
|
|
|
78
78
|
* @returns Dependency[]
|
|
79
79
|
*/
|
|
80
80
|
private _getRenderDepsByType;
|
|
81
|
-
private
|
|
81
|
+
private _initThemeListener;
|
|
82
82
|
/**
|
|
83
83
|
* create renderUnit & init deps from renderDependencies
|
|
84
84
|
* @param unitId
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -55,6 +55,14 @@ export declare class Scene extends Disposable {
|
|
|
55
55
|
private _evented;
|
|
56
56
|
private _layers;
|
|
57
57
|
private _viewports;
|
|
58
|
+
private _preserveEngineOnRender;
|
|
59
|
+
private _hasPostRenderCanvasMutation;
|
|
60
|
+
private _scrollbarDragViewport;
|
|
61
|
+
private _isScrollbarSeeking;
|
|
62
|
+
private _isScrollbarPreviewDirty;
|
|
63
|
+
private _lastScrollbarSeekInputAt;
|
|
64
|
+
private _estimatedFullRenderDuration;
|
|
65
|
+
private _renderedViewportScrollPositions;
|
|
58
66
|
private _cursor;
|
|
59
67
|
private _defaultCursor;
|
|
60
68
|
private _addObject$;
|
|
@@ -121,6 +129,11 @@ export declare class Scene extends Disposable {
|
|
|
121
129
|
attachControl(options?: ISceneInputControlOptions): this | undefined;
|
|
122
130
|
detachControl(): this;
|
|
123
131
|
makeDirty(state?: boolean): this;
|
|
132
|
+
makeDirtyForScrolling(): this;
|
|
133
|
+
beginScrollbarDrag(viewport: Viewport): void;
|
|
134
|
+
updateScrollbarDrag(viewport: Viewport): void;
|
|
135
|
+
endScrollbarDrag(viewport: Viewport): void;
|
|
136
|
+
isScrollRenderPending(): boolean;
|
|
124
137
|
makeDirtyNoParent(state?: boolean): this;
|
|
125
138
|
enableLayerCache(...layerIndexes: number[]): void;
|
|
126
139
|
disableLayerCache(...layerIndexes: number[]): void;
|
|
@@ -218,6 +231,12 @@ export declare class Scene extends Disposable {
|
|
|
218
231
|
getViewports(): Viewport[];
|
|
219
232
|
getMainViewport(): Viewport;
|
|
220
233
|
getViewport(key: string): Viewport | undefined;
|
|
234
|
+
private _createScrollRenderState;
|
|
235
|
+
private _renderScrollbarSeekPreview;
|
|
236
|
+
private _shouldDeferScrollbarSeekRender;
|
|
237
|
+
private _recordRenderedViewportScrollPositions;
|
|
238
|
+
private _recordFullRenderDuration;
|
|
239
|
+
private _notifyAfterRender;
|
|
221
240
|
render(parentCtx?: UniverRenderingContext): void;
|
|
222
241
|
requestRender(parentCtx?: UniverRenderingContext): Promise<unknown>;
|
|
223
242
|
/**
|
|
@@ -95,6 +95,7 @@ export declare class Transformer extends Disposable implements ITransformerConfi
|
|
|
95
95
|
boundBoxFunc: Nullable<(oldBox: BaseObject, newBox: BaseObject) => BaseObject>;
|
|
96
96
|
useSingleNodeRotation: boolean;
|
|
97
97
|
shouldOverdrawWholeArea: boolean;
|
|
98
|
+
controlLayerIndex: number | undefined;
|
|
98
99
|
private readonly _changeStart$;
|
|
99
100
|
/**
|
|
100
101
|
* actually pointer down on a object,
|
|
@@ -31,11 +31,12 @@ export declare class DumbCanvasColorService implements ICanvasColorService {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare class CanvasColorService extends Disposable implements ICanvasColorService {
|
|
33
33
|
private readonly _themeService;
|
|
34
|
-
private readonly
|
|
34
|
+
private readonly _darkModeCache;
|
|
35
|
+
private readonly _resolvedThemeColors;
|
|
35
36
|
private _invertAlgo;
|
|
36
37
|
constructor(_themeService: ThemeService);
|
|
37
|
-
getRenderColor(
|
|
38
|
+
getRenderColor(inputColor: string): string;
|
|
39
|
+
private _cacheThemeColors;
|
|
38
40
|
}
|
|
39
|
-
export declare function getDarkRenderColorOverride(color: string): string | null;
|
|
40
41
|
export declare function hexToRgb(_hex: string): RGBColorType;
|
|
41
42
|
export declare function rgbToHex(rgbColor: RGBColorType): string;
|
|
@@ -20,6 +20,8 @@ export interface ICheckboxShapeProps extends IShapeProps {
|
|
|
20
20
|
checked?: boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare const CHECK_OBJECT_ARRAY: string[];
|
|
23
|
+
export declare function isCheckboxGlyph(content: string): boolean;
|
|
24
|
+
export declare function getCheckboxShapeSize(fontSize?: number): number;
|
|
23
25
|
export declare class CheckboxShape extends Shape<ICheckboxShapeProps> {
|
|
24
26
|
_checked: boolean;
|
|
25
27
|
constructor(key: string, props: ICheckboxShapeProps);
|
|
@@ -63,6 +63,8 @@ export declare class Image extends Shape<IImageProps> {
|
|
|
63
63
|
private _renderByCropper;
|
|
64
64
|
private _transformCalculateSrcRect;
|
|
65
65
|
private _clipService;
|
|
66
|
+
private _rasterCacheSource;
|
|
67
|
+
private _autoRasterCache;
|
|
66
68
|
objectType: ObjectType;
|
|
67
69
|
isDrawingObject: boolean;
|
|
68
70
|
constructor(id: string, config: IImageProps);
|
|
@@ -70,6 +72,7 @@ export declare class Image extends Shape<IImageProps> {
|
|
|
70
72
|
get prstGeom(): Nullable<string>;
|
|
71
73
|
get opacity(): number;
|
|
72
74
|
get clipBounds(): Nullable<IShapeClipBounds>;
|
|
75
|
+
private _shouldRasterCache;
|
|
73
76
|
setOpacity(opacity: number): void;
|
|
74
77
|
setClipBounds(clipBounds?: Nullable<IShapeClipBounds>): void;
|
|
75
78
|
setClipService(clipService: Nullable<IImageShapeClipService>): void;
|
|
@@ -100,6 +103,7 @@ export declare class Image extends Shape<IImageProps> {
|
|
|
100
103
|
private _transformBySrcRect;
|
|
101
104
|
render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo): this;
|
|
102
105
|
protected _draw(ctx: UniverRenderingContext, _bounds?: IViewportInfo, renderWidth?: number, renderHeight?: number): void;
|
|
106
|
+
private _drawNative;
|
|
103
107
|
private _init;
|
|
104
108
|
private _updateSrcRectByTransform;
|
|
105
109
|
set transform(trans: Transform);
|
|
@@ -75,7 +75,6 @@ export declare class ScrollBar extends Disposable {
|
|
|
75
75
|
private _pendingBarDeltaX;
|
|
76
76
|
private _pendingBarDeltaY;
|
|
77
77
|
private _pendingBarScrollFrameId;
|
|
78
|
-
private _pendingBarScrollThrottleId;
|
|
79
78
|
private _horizonPointerMoveSub;
|
|
80
79
|
private _horizonPointerUpSub;
|
|
81
80
|
private _verticalPointerMoveSub;
|
|
@@ -85,6 +84,8 @@ export declare class ScrollBar extends Disposable {
|
|
|
85
84
|
private _thumbActiveBackgroundColor;
|
|
86
85
|
private _trackBackgroundColor;
|
|
87
86
|
private _trackBorderColor;
|
|
87
|
+
private _trackBackgroundOpacity;
|
|
88
|
+
private _trackBorderOpacity;
|
|
88
89
|
/**
|
|
89
90
|
* The thickness of a scrolling track
|
|
90
91
|
* ThumbSize = trackSize - thumbMargin * 2
|
|
@@ -143,7 +144,6 @@ export declare class ScrollBar extends Disposable {
|
|
|
143
144
|
static attachTo(view: Viewport, props?: IScrollBarProps): ScrollBar;
|
|
144
145
|
dispose(): void;
|
|
145
146
|
private _scheduleBarScrollDelta;
|
|
146
|
-
private _requestPendingBarScrollFrame;
|
|
147
147
|
private _flushPendingBarScroll;
|
|
148
148
|
private _applyPendingBarScroll;
|
|
149
149
|
render(ctx: UniverRenderingContext, left?: number, top?: number): void;
|