@univerjs/engine-render 0.1.0-beta.0 → 0.1.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 +2 -2
- package/lib/es/index.js +11293 -6686
- package/lib/types/base-object.d.ts +2 -1
- package/lib/types/basics/draw.d.ts +5 -4
- package/lib/types/basics/tools.d.ts +1 -2
- package/lib/types/canvas.d.ts +2 -1
- package/lib/types/components/component.d.ts +2 -1
- package/lib/types/components/docs/common/text-range.d.ts +4 -4
- package/lib/types/components/docs/doc-component.d.ts +3 -2
- package/lib/types/components/docs/document.d.ts +4 -3
- package/lib/types/components/docs/extensions/background.d.ts +2 -1
- package/lib/types/components/docs/extensions/border.d.ts +2 -1
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +2 -1
- package/lib/types/components/docs/extensions/line.d.ts +2 -2
- package/lib/types/components/docs/linebreak/__tests__/linebreak.spec.d.ts +16 -0
- package/lib/types/components/docs/linebreak/classes.d.ts +58 -0
- package/lib/types/components/docs/linebreak/index.d.ts +16 -0
- package/lib/types/components/docs/linebreak/linebreaker.d.ts +37 -0
- package/lib/types/components/docs/linebreak/pairs.d.ts +21 -0
- package/lib/types/components/docs/linebreak/swap.d.ts +16 -0
- package/lib/types/components/docs/linebreak/tiny-inflate.d.ts +31 -0
- package/lib/types/components/docs/linebreak/trie-data.d.ts +17 -0
- package/lib/types/components/docs/linebreak/unicode-trie.d.ts +22 -0
- package/lib/types/components/extension.d.ts +2 -1
- package/lib/types/components/sheets/column-header.d.ts +2 -1
- package/lib/types/components/sheets/extensions/background.d.ts +2 -1
- package/lib/types/components/sheets/extensions/border.d.ts +2 -1
- package/lib/types/components/sheets/extensions/column-header-layout.d.ts +2 -1
- package/lib/types/components/sheets/extensions/font.d.ts +3 -2
- package/lib/types/components/sheets/extensions/row-header-layout.d.ts +2 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +4 -4
- package/lib/types/components/sheets/row-header.d.ts +2 -1
- package/lib/types/components/sheets/sheet-component.d.ts +4 -3
- package/lib/types/components/sheets/sheet-skeleton.d.ts +11 -4
- package/lib/types/components/sheets/spreadsheet.d.ts +5 -10
- package/lib/types/components/slides/slide.d.ts +2 -1
- package/lib/types/context.d.ts +399 -0
- package/lib/types/custom/custom-object.d.ts +3 -2
- package/lib/types/group.d.ts +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/layer.d.ts +2 -1
- package/lib/types/scene-viewer.d.ts +2 -1
- package/lib/types/scene.d.ts +7 -2
- package/lib/types/scroll-timer.d.ts +11 -5
- package/lib/types/shape/base-scroll-bar.d.ts +2 -1
- package/lib/types/shape/circle.d.ts +3 -2
- package/lib/types/shape/path.d.ts +4 -3
- package/lib/types/shape/picture.d.ts +3 -2
- package/lib/types/shape/rect.d.ts +3 -2
- package/lib/types/shape/regular-polygon.d.ts +3 -2
- package/lib/types/shape/rich-text.d.ts +3 -2
- package/lib/types/shape/scroll-bar.d.ts +2 -1
- package/lib/types/shape/shape.d.ts +12 -11
- package/lib/types/thin-scene.d.ts +8 -2
- package/lib/types/viewport.d.ts +2 -2
- package/lib/umd/index.js +3 -3
- package/package.json +10 -10
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '@univerjs/core';
|
|
17
17
|
import type { Vector2 } from '../basics/vector2';
|
|
18
|
+
import type { UniverRenderingContext } from '../context';
|
|
18
19
|
import type { ThinScene } from '../thin-scene';
|
|
19
20
|
import type { Rect } from './rect';
|
|
20
21
|
export interface IScrollBarProps {
|
|
@@ -57,5 +58,5 @@ export declare class BaseScrollBar {
|
|
|
57
58
|
hasVerticalThumb(): boolean;
|
|
58
59
|
resize(parentWidth?: Nullable<number>, parentHeight?: Nullable<number>, contentWidth?: number, contentHeight?: number): void;
|
|
59
60
|
makeDirty(state: boolean): void;
|
|
60
|
-
render(ctx:
|
|
61
|
+
render(ctx: UniverRenderingContext, left?: number, top?: number): void;
|
|
61
62
|
}
|
|
@@ -13,6 +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 { UniverRenderingContext } from '../context';
|
|
16
17
|
import type { IShapeProps } from './shape';
|
|
17
18
|
import { Shape } from './shape';
|
|
18
19
|
export interface ICircleProps extends IShapeProps {
|
|
@@ -23,10 +24,10 @@ export declare class Circle extends Shape<ICircleProps> {
|
|
|
23
24
|
private _radius;
|
|
24
25
|
constructor(key?: string, props?: ICircleProps);
|
|
25
26
|
get radius(): number;
|
|
26
|
-
static drawWith(ctx:
|
|
27
|
+
static drawWith(ctx: UniverRenderingContext, props: ICircleProps | Circle): void;
|
|
27
28
|
toJson(): {
|
|
28
29
|
[x: string]: any;
|
|
29
30
|
};
|
|
30
|
-
protected _draw(ctx:
|
|
31
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
31
32
|
private _setFixBoundingBox;
|
|
32
33
|
}
|
|
@@ -13,6 +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 { UniverRenderingContext } from '../context';
|
|
16
17
|
import type { IShapeProps } from './shape';
|
|
17
18
|
import { Shape } from './shape';
|
|
18
19
|
interface IPathDataArray {
|
|
@@ -31,12 +32,12 @@ export interface IPathProps extends IShapeProps {
|
|
|
31
32
|
export declare const PATH_OBJECT_ARRAY: string[];
|
|
32
33
|
export declare class Path extends Shape<IPathProps> {
|
|
33
34
|
private _dataArray;
|
|
34
|
-
private
|
|
35
|
+
private _pathLength;
|
|
35
36
|
private _selfRectCache;
|
|
36
37
|
private _reCalculateCache;
|
|
37
38
|
constructor(key?: string, props?: IPathProps);
|
|
38
39
|
get dataArray(): IPathDataArray[];
|
|
39
|
-
static drawWith(ctx:
|
|
40
|
+
static drawWith(ctx: UniverRenderingContext, props: IPathProps | Path): void;
|
|
40
41
|
static getLineLength(x1: number, y1: number, x2: number, y2: number): number;
|
|
41
42
|
static getPointOnLine(dist: number, P1x: number, P1y: number, P2x: number, P2y: number, fromX?: number, fromY?: number): {
|
|
42
43
|
x: number;
|
|
@@ -99,7 +100,7 @@ export declare class Path extends Shape<IPathProps> {
|
|
|
99
100
|
x: number;
|
|
100
101
|
y: number;
|
|
101
102
|
} | null;
|
|
102
|
-
protected _draw(ctx:
|
|
103
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
103
104
|
private _setFixBoundingBox;
|
|
104
105
|
private _getSelfRect;
|
|
105
106
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '@univerjs/core';
|
|
17
|
+
import type { UniverRenderingContext } from '../context';
|
|
17
18
|
import type { IShapeProps } from './shape';
|
|
18
19
|
import { Shape } from './shape';
|
|
19
20
|
export interface IPictureProps extends IShapeProps {
|
|
@@ -30,9 +31,9 @@ export declare class Picture extends Shape<IPictureProps> {
|
|
|
30
31
|
protected _props: IPictureProps;
|
|
31
32
|
protected _native: Nullable<HTMLImageElement>;
|
|
32
33
|
constructor(id: string, config: IPictureProps);
|
|
33
|
-
static drawWith(ctx:
|
|
34
|
+
static drawWith(ctx: UniverRenderingContext, picture: Picture): void;
|
|
34
35
|
static create(id: string, url: string, callback?: () => void): Picture;
|
|
35
36
|
getPictureProps(): IPictureProps;
|
|
36
|
-
protected _draw(ctx:
|
|
37
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
37
38
|
protected _init(): void;
|
|
38
39
|
}
|
|
@@ -13,6 +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 { UniverRenderingContext } from '../context';
|
|
16
17
|
import type { IShapeProps } from './shape';
|
|
17
18
|
import { Shape } from './shape';
|
|
18
19
|
export interface IRectProps extends IShapeProps {
|
|
@@ -23,9 +24,9 @@ export declare class Rect<T extends IRectProps = IRectProps> extends Shape<T> {
|
|
|
23
24
|
private _radius;
|
|
24
25
|
constructor(key?: string, props?: T);
|
|
25
26
|
get radius(): number;
|
|
26
|
-
static drawWith(ctx:
|
|
27
|
+
static drawWith(ctx: UniverRenderingContext, props: IRectProps | Rect): void;
|
|
27
28
|
toJson(): {
|
|
28
29
|
[x: string]: any;
|
|
29
30
|
};
|
|
30
|
-
protected _draw(ctx:
|
|
31
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
31
32
|
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { IObjectFullState } from '../basics/interfaces';
|
|
17
17
|
import type { IPoint } from '../basics/vector2';
|
|
18
|
+
import type { UniverRenderingContext } from '../context';
|
|
18
19
|
import type { IShapeProps } from './shape';
|
|
19
20
|
import { Shape } from './shape';
|
|
20
21
|
export interface IRegularPolygonProps extends IShapeProps {
|
|
@@ -25,7 +26,7 @@ export declare class RegularPolygon extends Shape<IRegularPolygonProps> {
|
|
|
25
26
|
private _pointsGroup;
|
|
26
27
|
constructor(key?: string, props?: IRegularPolygonProps);
|
|
27
28
|
get pointsGroup(): IPoint[][];
|
|
28
|
-
static drawWith(ctx:
|
|
29
|
+
static drawWith(ctx: UniverRenderingContext, props: IRegularPolygonProps | RegularPolygon): void;
|
|
29
30
|
updatePointGroup(pointGroup: IPoint[][]): void;
|
|
30
31
|
resizePolygon(preValue: IObjectFullState): void;
|
|
31
32
|
toJson(): {
|
|
@@ -50,7 +51,7 @@ export declare class RegularPolygon extends Shape<IRegularPolygonProps> {
|
|
|
50
51
|
width: number;
|
|
51
52
|
height: number;
|
|
52
53
|
};
|
|
53
|
-
protected _draw(ctx:
|
|
54
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
54
55
|
private _setFixBoundingBox;
|
|
55
56
|
private _getSelfRect;
|
|
56
57
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import type { IDocumentData, IStyleBase, ITransformState, LocaleService } from '@univerjs/core';
|
|
17
17
|
import { BaseObject } from '../base-object';
|
|
18
18
|
import type { IViewportBound } from '../basics/vector2';
|
|
19
|
+
import type { UniverRenderingContext } from '../context';
|
|
19
20
|
export interface IRichTextProps extends ITransformState, IStyleBase {
|
|
20
21
|
text?: string;
|
|
21
22
|
richText?: IDocumentData;
|
|
@@ -46,11 +47,11 @@ export declare class RichText extends BaseObject {
|
|
|
46
47
|
height: number;
|
|
47
48
|
} | undefined;
|
|
48
49
|
setProps(props?: IRichTextProps): this | undefined;
|
|
49
|
-
render(mainCtx:
|
|
50
|
+
render(mainCtx: UniverRenderingContext, bounds?: IViewportBound): this;
|
|
50
51
|
toJson(): {
|
|
51
52
|
[x: string]: any;
|
|
52
53
|
};
|
|
53
|
-
protected _draw(ctx:
|
|
54
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
54
55
|
private _convertToDocumentData;
|
|
55
56
|
private _initialProps;
|
|
56
57
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Vector2 } from '../basics/vector2';
|
|
17
|
+
import type { UniverRenderingContext } from '../context';
|
|
17
18
|
import type { Viewport } from '../viewport';
|
|
18
19
|
import type { IScrollBarProps } from './base-scroll-bar';
|
|
19
20
|
import { BaseScrollBar } from './base-scroll-bar';
|
|
@@ -44,7 +45,7 @@ export declare class ScrollBar extends BaseScrollBar {
|
|
|
44
45
|
constructor(view: Viewport, props?: IScrollBarProps);
|
|
45
46
|
static attachTo(view: Viewport, props?: IScrollBarProps): ScrollBar;
|
|
46
47
|
dispose(): void;
|
|
47
|
-
render(ctx:
|
|
48
|
+
render(ctx: UniverRenderingContext, left?: number, top?: number): void;
|
|
48
49
|
resize(parentWidth?: number, parentHeight?: number, contentWidth?: number, contentHeight?: number): void;
|
|
49
50
|
makeDirty(state: boolean): void;
|
|
50
51
|
makeViewDirty(state: boolean): void;
|
|
@@ -17,6 +17,7 @@ import type { IScale, Nullable } from '@univerjs/core';
|
|
|
17
17
|
import { BaseObject } from '../base-object';
|
|
18
18
|
import type { IObjectFullState } from '../basics/interfaces';
|
|
19
19
|
import type { IViewportBound, Vector2 } from '../basics/vector2';
|
|
20
|
+
import type { UniverRenderingContext } from '../context';
|
|
20
21
|
export type LineJoin = 'round' | 'bevel' | 'miter';
|
|
21
22
|
export type LineCap = 'butt' | 'round' | 'square';
|
|
22
23
|
export type PaintFirst = 'fill' | 'stroke';
|
|
@@ -99,28 +100,28 @@ export declare abstract class Shape<T> extends BaseObject {
|
|
|
99
100
|
get strokeDashArray(): Nullable<number[]>;
|
|
100
101
|
get strokeDashOffset(): number;
|
|
101
102
|
get strokeMiterLimit(): number;
|
|
102
|
-
static drawWith(ctx:
|
|
103
|
-
protected static _renderPaintInOrder(ctx:
|
|
103
|
+
static drawWith(ctx: UniverRenderingContext, props: IShapeProps): void;
|
|
104
|
+
protected static _renderPaintInOrder(ctx: UniverRenderingContext, props: IShapeProps): void;
|
|
104
105
|
/**
|
|
105
106
|
* @private
|
|
106
|
-
* @param {
|
|
107
|
+
* @param {UniverRenderingContext} ctx SheetContext to render on
|
|
107
108
|
*/
|
|
108
109
|
private static _renderFill;
|
|
109
110
|
/**
|
|
110
111
|
* @private
|
|
111
|
-
* @param {
|
|
112
|
+
* @param {UniverRenderingContext} ctx SheetContext to render on
|
|
112
113
|
*/
|
|
113
114
|
private static _renderStroke;
|
|
114
|
-
private static
|
|
115
|
-
private static
|
|
116
|
-
private static
|
|
117
|
-
private static
|
|
118
|
-
private static
|
|
119
|
-
render(mainCtx:
|
|
115
|
+
private static _getObjectScaling;
|
|
116
|
+
private static _removeShadow;
|
|
117
|
+
private static _setFillStyles;
|
|
118
|
+
private static _setStrokeStyles;
|
|
119
|
+
private static _setLineDash;
|
|
120
|
+
render(mainCtx: UniverRenderingContext, bounds?: IViewportBound): this;
|
|
120
121
|
setProps(props?: T): this | undefined;
|
|
121
122
|
toJson(): {
|
|
122
123
|
[x: string]: any;
|
|
123
124
|
};
|
|
124
|
-
protected _draw(ctx:
|
|
125
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
125
126
|
private _initialProps;
|
|
126
127
|
}
|
|
@@ -22,6 +22,7 @@ import type { IKeyboardEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './
|
|
|
22
22
|
import type { ITransformChangeState } from './basics/interfaces';
|
|
23
23
|
import { Transform } from './basics/transform';
|
|
24
24
|
import type { IViewportBound, Vector2 } from './basics/vector2';
|
|
25
|
+
import type { UniverRenderingContext } from './context';
|
|
25
26
|
export declare abstract class ThinScene {
|
|
26
27
|
onTransformChangeObservable: Observable<ITransformChangeState>;
|
|
27
28
|
onPointerDownObserver: Observable<IMouseEvent | IPointerEvent>;
|
|
@@ -73,8 +74,8 @@ export declare abstract class ThinScene {
|
|
|
73
74
|
triggerPointerLeave(evt: IPointerEvent | IMouseEvent): void;
|
|
74
75
|
triggerPointerOver(evt: IPointerEvent | IMouseEvent): void;
|
|
75
76
|
triggerPointerEnter(evt: IPointerEvent | IMouseEvent): void;
|
|
76
|
-
renderObjects(ctx:
|
|
77
|
-
render(parentCtx?:
|
|
77
|
+
renderObjects(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
|
|
78
|
+
render(parentCtx?: UniverRenderingContext): void;
|
|
78
79
|
getParent(): any;
|
|
79
80
|
dispose(): void;
|
|
80
81
|
getObject(oKey: string): Nullable<BaseObject>;
|
|
@@ -87,9 +88,14 @@ export declare abstract class ThinScene {
|
|
|
87
88
|
makeDirty(state?: boolean): this;
|
|
88
89
|
pick(coord: Vector2): Nullable<BaseObject | ThinScene>;
|
|
89
90
|
getViewports(): any[];
|
|
91
|
+
addViewport(...viewport: any[]): void;
|
|
90
92
|
removeViewport(key: string): void;
|
|
91
93
|
getAncestorScale(): {
|
|
92
94
|
scaleX: number;
|
|
93
95
|
scaleY: number;
|
|
94
96
|
};
|
|
97
|
+
getPrecisionScale(): {
|
|
98
|
+
scaleX: number;
|
|
99
|
+
scaleY: number;
|
|
100
|
+
};
|
|
95
101
|
}
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { IWheelEvent } from './basics/i-events';
|
|
|
20
20
|
import { Transform } from './basics/transform';
|
|
21
21
|
import type { IViewportBound } from './basics/vector2';
|
|
22
22
|
import { Vector2 } from './basics/vector2';
|
|
23
|
+
import type { UniverRenderingContext } from './context';
|
|
23
24
|
import type { BaseScrollBar } from './shape/base-scroll-bar';
|
|
24
25
|
import type { ThinScene } from './thin-scene';
|
|
25
26
|
interface IViewPosition {
|
|
@@ -173,7 +174,6 @@ export declare class Viewport {
|
|
|
173
174
|
x: number;
|
|
174
175
|
y: number;
|
|
175
176
|
};
|
|
176
|
-
private _getScale;
|
|
177
177
|
getTransformedScroll(): {
|
|
178
178
|
x: number;
|
|
179
179
|
y: number;
|
|
@@ -181,7 +181,7 @@ export declare class Viewport {
|
|
|
181
181
|
getScrollBar(): Nullable<BaseScrollBar>;
|
|
182
182
|
updateScroll(param: IScrollObserverParam): this;
|
|
183
183
|
getScrollBarTransForm(): Transform;
|
|
184
|
-
render(parentCtx?:
|
|
184
|
+
render(parentCtx?: UniverRenderingContext, objects?: BaseObject[], isMaxLayer?: boolean): void;
|
|
185
185
|
getBounding(): IViewportBound;
|
|
186
186
|
getRelativeVector(coord: Vector2): Vector2;
|
|
187
187
|
getAbsoluteVector(coord: Vector2): Vector2;
|