@univerjs/engine-render 1.0.0-beta.0 → 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.
- package/lib/cjs/index.js +5665 -4737
- package/lib/es/index.js +5661 -4739
- package/lib/index.js +5661 -4739
- package/lib/types/basics/i-document-skeleton-cached.d.ts +10 -1
- 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 +2 -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/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/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 +6 -1
- package/lib/types/components/sheets/spreadsheet.d.ts +5 -2
- 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/scene.d.ts +17 -0
- package/lib/types/scene.transformer.d.ts +1 -0
- package/lib/types/services/canvas-color.service.d.ts +5 -2
- 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 +0 -2
- package/lib/types/shape/shape.d.ts +4 -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;
|
|
@@ -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,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;
|
|
@@ -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,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;
|
|
@@ -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;
|
|
@@ -116,8 +120,9 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
116
120
|
/**
|
|
117
121
|
* Set border background and font to this._stylesCache by visible range, which derives from bounds)
|
|
118
122
|
* @param vpInfo viewBounds
|
|
123
|
+
* @param options screen scale
|
|
119
124
|
*/
|
|
120
|
-
setStylesCache(vpInfo?: IViewportInfo): Nullable<SpreadsheetSkeleton>;
|
|
125
|
+
setStylesCache(vpInfo?: IViewportInfo, options?: ISetStylesCacheOptions): Nullable<SpreadsheetSkeleton>;
|
|
121
126
|
/**
|
|
122
127
|
* Calc all auto height by getDocsSkeletonPageSize in ranges
|
|
123
128
|
* @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/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;
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -55,6 +55,13 @@ export declare class Scene extends Disposable {
|
|
|
55
55
|
private _evented;
|
|
56
56
|
private _layers;
|
|
57
57
|
private _viewports;
|
|
58
|
+
private _preserveEngineOnRender;
|
|
59
|
+
private _scrollbarDragViewport;
|
|
60
|
+
private _isScrollbarSeeking;
|
|
61
|
+
private _isScrollbarPreviewDirty;
|
|
62
|
+
private _lastScrollbarSeekInputAt;
|
|
63
|
+
private _estimatedFullRenderDuration;
|
|
64
|
+
private _renderedViewportScrollPositions;
|
|
58
65
|
private _cursor;
|
|
59
66
|
private _defaultCursor;
|
|
60
67
|
private _addObject$;
|
|
@@ -121,6 +128,11 @@ export declare class Scene extends Disposable {
|
|
|
121
128
|
attachControl(options?: ISceneInputControlOptions): this | undefined;
|
|
122
129
|
detachControl(): this;
|
|
123
130
|
makeDirty(state?: boolean): this;
|
|
131
|
+
makeDirtyForScrolling(): this;
|
|
132
|
+
beginScrollbarDrag(viewport: Viewport): void;
|
|
133
|
+
updateScrollbarDrag(viewport: Viewport): void;
|
|
134
|
+
endScrollbarDrag(viewport: Viewport): void;
|
|
135
|
+
isScrollRenderPending(): boolean;
|
|
124
136
|
makeDirtyNoParent(state?: boolean): this;
|
|
125
137
|
enableLayerCache(...layerIndexes: number[]): void;
|
|
126
138
|
disableLayerCache(...layerIndexes: number[]): void;
|
|
@@ -218,6 +230,11 @@ export declare class Scene extends Disposable {
|
|
|
218
230
|
getViewports(): Viewport[];
|
|
219
231
|
getMainViewport(): Viewport;
|
|
220
232
|
getViewport(key: string): Viewport | undefined;
|
|
233
|
+
private _createScrollRenderState;
|
|
234
|
+
private _renderScrollbarSeekPreview;
|
|
235
|
+
private _shouldDeferScrollbarSeekRender;
|
|
236
|
+
private _recordRenderedViewportScrollPositions;
|
|
237
|
+
private _recordFullRenderDuration;
|
|
221
238
|
render(parentCtx?: UniverRenderingContext): void;
|
|
222
239
|
requestRender(parentCtx?: UniverRenderingContext): Promise<unknown>;
|
|
223
240
|
/**
|
|
@@ -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,10 +31,13 @@ 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 _resolvedColorCache;
|
|
35
36
|
private _invertAlgo;
|
|
36
37
|
constructor(_themeService: ThemeService);
|
|
37
|
-
getRenderColor(
|
|
38
|
+
getRenderColor(inputColor: string): string;
|
|
39
|
+
private _resolveColor;
|
|
40
|
+
private _resolveThemeColor;
|
|
38
41
|
}
|
|
39
42
|
export declare function getDarkRenderColorOverride(color: string): string | null;
|
|
40
43
|
export declare function hexToRgb(_hex: string): RGBColorType;
|
|
@@ -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;
|
|
@@ -143,7 +142,6 @@ export declare class ScrollBar extends Disposable {
|
|
|
143
142
|
static attachTo(view: Viewport, props?: IScrollBarProps): ScrollBar;
|
|
144
143
|
dispose(): void;
|
|
145
144
|
private _scheduleBarScrollDelta;
|
|
146
|
-
private _requestPendingBarScrollFrame;
|
|
147
145
|
private _flushPendingBarScroll;
|
|
148
146
|
private _applyPendingBarScroll;
|
|
149
147
|
render(ctx: UniverRenderingContext, left?: number, top?: number): void;
|
|
@@ -58,6 +58,7 @@ export declare abstract class Shape<T extends IShapeProps> extends BaseObject {
|
|
|
58
58
|
private _renderCacheCanvas;
|
|
59
59
|
private _renderCacheBounds;
|
|
60
60
|
private _renderCachePixelRatio;
|
|
61
|
+
private _renderCacheTransformSize;
|
|
61
62
|
private _hoverCursor;
|
|
62
63
|
private _moveCursor;
|
|
63
64
|
private _fillRule;
|
|
@@ -132,7 +133,9 @@ export declare abstract class Shape<T extends IShapeProps> extends BaseObject {
|
|
|
132
133
|
toJson(): {
|
|
133
134
|
[x: string]: any;
|
|
134
135
|
};
|
|
135
|
-
|
|
136
|
+
transformByState(option: IObjectFullState): this | undefined;
|
|
137
|
+
translate(x?: number | string, y?: number | string): this;
|
|
138
|
+
protected _renderWithCache(ctx: UniverRenderingContext, bounds: IBoundRectNoAngle, draw: (cacheContext: UniverRenderingContext) => void, fixedPixelRatio?: number): void;
|
|
136
139
|
protected _releaseRenderCache(): void;
|
|
137
140
|
protected _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
138
141
|
private _initialProps;
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -253,6 +253,7 @@ export declare class Viewport {
|
|
|
253
253
|
get _deltaViewportScrollX(): number;
|
|
254
254
|
get _deltaViewportScrollY(): number;
|
|
255
255
|
get canvas(): UniverCanvas | null;
|
|
256
|
+
swapCacheCanvas(cacheCanvas: UniverCanvas): UniverCanvas | null;
|
|
256
257
|
enable(): void;
|
|
257
258
|
disable(): void;
|
|
258
259
|
/**
|
|
@@ -343,7 +344,7 @@ export declare class Viewport {
|
|
|
343
344
|
* @param objects
|
|
344
345
|
* @param isMaxLayer
|
|
345
346
|
*/
|
|
346
|
-
render(parentCtx?: UniverRenderingContext, objects?: BaseObject[], isMaxLayer?: boolean): void;
|
|
347
|
+
render(parentCtx?: UniverRenderingContext, objects?: BaseObject[], isMaxLayer?: boolean, viewportInfo?: IViewportInfo): void;
|
|
347
348
|
private _makeDefaultViewport;
|
|
348
349
|
calcViewportInfo(): IViewportInfo;
|
|
349
350
|
/**
|
|
@@ -431,6 +432,7 @@ export declare class Viewport {
|
|
|
431
432
|
private _diffViewBound;
|
|
432
433
|
private _calcDiffCacheBound;
|
|
433
434
|
private _drawScrollbar;
|
|
435
|
+
renderScrollbarOnly(ctx: UniverRenderingContext, pixelRatio: number): void;
|
|
434
436
|
setViewportSize(props?: IViewProps): void;
|
|
435
437
|
}
|
|
436
438
|
export {};
|