@univerjs/engine-render 0.8.0-beta.0 → 0.8.0-nightly.202505271607
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 +1 -1
- package/lib/es/index.js +10019 -9761
- package/lib/index.js +10019 -9761
- package/lib/types/basics/tools.d.ts +1 -1
- package/lib/types/components/docs/layout/doc-simple-skeleton.d.ts +37 -0
- package/lib/types/components/sheets/extensions/font.d.ts +1 -0
- package/lib/types/components/sheets/interfaces.d.ts +4 -3
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +8 -3
- package/lib/types/index.d.ts +1 -0
- package/lib/types/shape/index.d.ts +1 -0
- package/lib/types/shape/text.d.ts +30 -0
- package/lib/umd/index.js +1 -1
- package/package.json +2 -2
- package/LICENSE +0 -176
|
@@ -42,7 +42,7 @@ export declare function precisionTo(num: number, accurate: number): number;
|
|
|
42
42
|
* var time = performance.now(); for(let i=0;i<100000000;i++){ fixLineWidthByScale(i, 0.666); }; console.log(performance.now()-time);
|
|
43
43
|
*/
|
|
44
44
|
export declare function fixLineWidthByScale(num: number, scale: number): number;
|
|
45
|
-
export declare function getFontStyleString(textStyle?: IStyleBase): IDocumentSkeletonFontStyle;
|
|
45
|
+
export declare function getFontStyleString(textStyle?: Nullable<IStyleBase>): IDocumentSkeletonFontStyle;
|
|
46
46
|
export declare function hasCJKText(text: string): boolean;
|
|
47
47
|
export declare function hasCJK(text: string): boolean;
|
|
48
48
|
export declare function hasCJKPunctuation(text: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
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 ILineInfo {
|
|
17
|
+
text: string;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
baseline: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class DocSimpleSkeleton {
|
|
23
|
+
private _text;
|
|
24
|
+
private _fontStyle;
|
|
25
|
+
private _warp;
|
|
26
|
+
private _width;
|
|
27
|
+
private _height;
|
|
28
|
+
private _lineBreaker;
|
|
29
|
+
private _lines;
|
|
30
|
+
private _dirty;
|
|
31
|
+
constructor(_text: string, _fontStyle: string, _warp: boolean, _width: number, _height: number);
|
|
32
|
+
calculate(): ILineInfo[];
|
|
33
|
+
getLines(): ILineInfo[];
|
|
34
|
+
getTotalHeight(): number;
|
|
35
|
+
getTotalWidth(): number;
|
|
36
|
+
makeDirty(): void;
|
|
37
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BorderStyleTypes, HorizontalAlign, ICellDataForSheetInterceptor, ICellWithCoord, ImageCacheMap, Nullable, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
1
|
+
import { BorderStyleTypes, HorizontalAlign, ICellDataForSheetInterceptor, ICellWithCoord, ImageCacheMap, IStyleData, Nullable, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { BORDER_TYPE as BORDER_LTRB } from '../../basics/const';
|
|
3
3
|
import { Canvas } from '../../canvas';
|
|
4
4
|
import { UniverRenderingContext } from '../../context';
|
|
@@ -12,7 +12,7 @@ export interface BorderCacheItem {
|
|
|
12
12
|
color: string;
|
|
13
13
|
}
|
|
14
14
|
export interface IFontCacheItem {
|
|
15
|
-
documentSkeleton
|
|
15
|
+
documentSkeleton?: DocumentSkeleton;
|
|
16
16
|
vertexAngle?: number;
|
|
17
17
|
centerAngle?: number;
|
|
18
18
|
verticalAlign: VerticalAlign;
|
|
@@ -20,12 +20,13 @@ export interface IFontCacheItem {
|
|
|
20
20
|
wrapStrategy: WrapStrategy;
|
|
21
21
|
imageCacheMap: ImageCacheMap;
|
|
22
22
|
cellData: Nullable<ICellDataForSheetInterceptor>;
|
|
23
|
+
fontString: string;
|
|
24
|
+
style?: Nullable<IStyleData>;
|
|
23
25
|
}
|
|
24
26
|
type colorString = string;
|
|
25
27
|
export interface IStylesCache {
|
|
26
28
|
background?: Record<colorString, ObjectMatrix<string>>;
|
|
27
29
|
backgroundPositions?: ObjectMatrix<ICellWithCoord>;
|
|
28
|
-
font?: Record<string, ObjectMatrix<IFontCacheItem>>;
|
|
29
30
|
/**
|
|
30
31
|
* Get value from getCell in skeleton and this value is used in font extension
|
|
31
32
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentDataModel, ICellData, ICellDataForSheetInterceptor, ICellInfo, ICellWithCoord, IColAutoWidthInfo, IColumnRange, IGetRowColByPosOptions, IPaddingData, IRange, IRowAutoHeightInfo, IRowRange, ISize, IStyleData, ITextRotation, Nullable, Styles,
|
|
1
|
+
import { DocumentDataModel, ICellData, ICellDataForSheetInterceptor, ICellInfo, ICellWithCoord, IColAutoWidthInfo, IColumnRange, IGetRowColByPosOptions, IPaddingData, IRange, IRowAutoHeightInfo, IRowRange, ISize, IStyleData, ITextRotation, Nullable, Styles, Worksheet, BooleanNumber, HorizontalAlign, IConfigService, IContextService, Injector, LocaleService, ObjectMatrix, SheetSkeleton, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { IBoundRectNoAngle, IPoint, IViewportInfo } from '../../basics/vector2';
|
|
3
3
|
import { Scene } from '../../scene';
|
|
4
4
|
import { IFontCacheItem, IStylesCache, SHEET_VIEWPORT_KEY } from './interfaces';
|
|
@@ -44,10 +44,10 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
44
44
|
private _visibleRangeMap;
|
|
45
45
|
private _overflowCache;
|
|
46
46
|
private _stylesCache;
|
|
47
|
+
private _clearTaskId;
|
|
47
48
|
/** A matrix to store if a (row, column) position has render cache. */
|
|
48
49
|
private _handleBgMatrix;
|
|
49
50
|
private _handleBorderMatrix;
|
|
50
|
-
private _handleFontMatrix;
|
|
51
51
|
private _showGridlines;
|
|
52
52
|
private _gridlinesColor;
|
|
53
53
|
private _scene;
|
|
@@ -83,6 +83,10 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
83
83
|
updateVisibleRange(vpInfo?: IViewportInfo): boolean;
|
|
84
84
|
getVisibleRangeByViewport(viewportKey: SHEET_VIEWPORT_KEY): IRowColumnRange | undefined;
|
|
85
85
|
getVisibleRanges(): Map<SHEET_VIEWPORT_KEY, IRowColumnRange>;
|
|
86
|
+
/**
|
|
87
|
+
* Clear cache out of visible range when browser are free.
|
|
88
|
+
*/
|
|
89
|
+
private _clearCacheOutOfVisibleRange;
|
|
86
90
|
/**
|
|
87
91
|
* Set border background and font to this._stylesCache by visible range, which derives from bounds)
|
|
88
92
|
* @param vpInfo viewBounds
|
|
@@ -93,7 +97,8 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
93
97
|
* @param ranges
|
|
94
98
|
* @returns {IRowAutoHeightInfo[]} result
|
|
95
99
|
*/
|
|
96
|
-
calculateAutoHeightInRange(ranges: Nullable<IRange[]>): IRowAutoHeightInfo[];
|
|
100
|
+
calculateAutoHeightInRange(ranges: Nullable<IRange[]>, currentCellHeights?: ObjectMatrix<number>): IRowAutoHeightInfo[];
|
|
101
|
+
calculateAutoHeightForCell(row: number, col: number): number | undefined;
|
|
97
102
|
private _calculateRowAutoHeight;
|
|
98
103
|
calculateAutoWidthInRange(ranges: Nullable<IRange[]>): IColAutoWidthInfo[];
|
|
99
104
|
/**
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
|
+
import { Nullable, HorizontalAlign, VerticalAlign } from '@univerjs/core';
|
|
2
|
+
import { UniverRenderingContext } from '../context';
|
|
1
3
|
import { IShapeProps, Shape } from './shape';
|
|
4
|
+
import { DocSimpleSkeleton } from '../components/docs/layout/doc-simple-skeleton';
|
|
2
5
|
export interface ITextProps extends IShapeProps {
|
|
3
6
|
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
text: string;
|
|
9
|
+
fontStyle: string;
|
|
10
|
+
warp?: boolean;
|
|
11
|
+
hAlign?: HorizontalAlign;
|
|
12
|
+
vAlign?: VerticalAlign;
|
|
13
|
+
color?: Nullable<string>;
|
|
14
|
+
strokeLine?: boolean;
|
|
15
|
+
underline?: boolean;
|
|
4
16
|
}
|
|
17
|
+
export declare const TEXT_OBJECT_ARRAY: string[];
|
|
5
18
|
export declare class Text extends Shape<ITextProps> {
|
|
19
|
+
text: string;
|
|
20
|
+
fontStyle: string;
|
|
21
|
+
warp: boolean;
|
|
22
|
+
hAlign: HorizontalAlign;
|
|
23
|
+
vAlign: VerticalAlign;
|
|
24
|
+
skeleton: DocSimpleSkeleton;
|
|
25
|
+
constructor(key: string, props: ITextProps);
|
|
26
|
+
static drawWith(ctx: UniverRenderingContext, props: ITextProps, _skeleton?: DocSimpleSkeleton): number;
|
|
27
|
+
/**
|
|
28
|
+
* Draw text decoration lines (underline, strikethrough, etc.)
|
|
29
|
+
*/
|
|
30
|
+
private static _drawTextDecoration;
|
|
31
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
32
|
+
makeDirty(state?: boolean): this | undefined;
|
|
33
|
+
toJson(): {
|
|
34
|
+
[x: string]: any;
|
|
35
|
+
};
|
|
6
36
|
}
|