@univerjs/engine-render 0.1.3 → 0.1.4
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 +10832 -10790
- package/lib/types/basics/document-node-tools.d.ts +8 -8
- package/lib/types/basics/i-document-skeleton-cached.d.ts +13 -7
- package/lib/types/basics/interfaces.d.ts +3 -3
- package/lib/types/basics/tools.d.ts +4 -0
- package/lib/types/{components/docs/block/index.d.ts → basics/viewport-subtract.d.ts} +2 -3
- package/lib/types/components/docs/doc-component.d.ts +4 -4
- package/lib/types/components/docs/doc-extension.d.ts +2 -2
- package/lib/types/components/docs/document.d.ts +2 -1
- package/lib/types/components/docs/extensions/background.d.ts +2 -2
- package/lib/types/components/docs/extensions/border.d.ts +2 -2
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +2 -2
- package/lib/types/components/docs/extensions/line.d.ts +2 -2
- package/lib/types/components/docs/{block → layout/block}/paragraph/bullet.d.ts +1 -1
- package/lib/types/components/docs/{block → layout/block}/paragraph/inline-drawing.d.ts +2 -2
- package/lib/types/components/docs/{block → layout/block}/paragraph/language-ruler.d.ts +7 -7
- package/lib/types/components/docs/{block → layout/block}/paragraph/layout-ruler.d.ts +3 -3
- package/lib/types/components/docs/{block/paragraph/paragraph.d.ts → layout/block/paragraph/layout.d.ts} +4 -4
- package/lib/types/components/docs/{block/paragraph/index.d.ts → layout/block/paragraph/line-adjustment.d.ts} +3 -6
- package/lib/types/components/docs/layout/block/paragraph/linebreaking.d.ts +21 -0
- package/lib/types/components/docs/layout/block/paragraph/shaping.d.ts +25 -0
- package/lib/types/components/docs/{block → layout/block}/section.d.ts +5 -5
- package/lib/types/components/docs/{doc-skeleton.d.ts → layout/doc-skeleton.d.ts} +9 -9
- package/lib/types/components/docs/layout/model/__test__/glyph.spec.d.ts +16 -0
- package/lib/types/components/docs/{common → layout/model}/column.d.ts +1 -1
- package/lib/types/components/docs/layout/model/glyph.d.ts +31 -0
- package/lib/types/components/docs/{common → layout/model}/line.d.ts +1 -1
- package/lib/types/components/docs/{common → layout/model}/page.d.ts +3 -3
- package/lib/types/components/docs/{common → layout/model}/section.d.ts +1 -1
- package/lib/types/components/docs/{common → layout}/tools.d.ts +4 -4
- package/lib/types/components/docs/{common/liquid.d.ts → liquid.d.ts} +4 -4
- package/lib/types/components/docs/{common → text-selection}/convert-cursor.d.ts +4 -4
- package/lib/types/components/docs/{common → text-selection}/text-range.d.ts +1 -1
- package/lib/types/components/docs/{text-selection-render-manager.d.ts → text-selection/text-selection-render-manager.d.ts} +11 -9
- package/lib/types/components/index.d.ts +0 -1
- package/lib/types/components/sheets/interfaces.d.ts +1 -1
- package/lib/types/components/sheets/sheet-skeleton.d.ts +1 -1
- package/lib/types/context.d.ts +4 -0
- package/lib/types/engine.d.ts +2 -0
- package/lib/types/index.d.ts +9 -1
- package/lib/types/layer.d.ts +1 -0
- package/lib/types/render-manager.service.d.ts +1 -0
- package/lib/types/thin-scene.d.ts +4 -1
- package/lib/types/viewport.d.ts +0 -3
- package/lib/umd/index.js +2 -2
- package/package.json +8 -7
- package/lib/types/components/docs/common/index.d.ts +0 -24
- package/lib/types/components/docs/common/span.d.ts +0 -28
- package/lib/types/components/docs/index.d.ts +0 -22
- /package/lib/types/components/docs/{block → layout/block}/block-error.d.ts +0 -0
- /package/lib/types/components/docs/{block → layout/block}/paragraph/bullet-ruler.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/__tests__/linebreak.spec.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/break.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/classes.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/extensions/tab-linebreak-extension.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/index.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/linebreaker.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/pairs.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/rule.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/swap.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/tiny-inflate.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/trie-data.d.ts +0 -0
- /package/lib/types/components/docs/{linebreak → layout/linebreak}/unicode-trie.d.ts +0 -0
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { ITextRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { INodePosition } from '../../../basics/interfaces';
|
|
18
18
|
import type { IPoint } from '../../../basics/vector2';
|
|
19
|
-
import type { DocumentSkeleton } from '../doc-skeleton';
|
|
19
|
+
import type { DocumentSkeleton } from '../layout/doc-skeleton';
|
|
20
20
|
import type { IDocumentOffsetConfig } from '../document';
|
|
21
21
|
export declare enum NodePositionStateType {
|
|
22
22
|
NORMAL = 0,
|
|
@@ -29,7 +29,7 @@ export declare enum NodePositionType {
|
|
|
29
29
|
column = 2,
|
|
30
30
|
line = 3,
|
|
31
31
|
divide = 4,
|
|
32
|
-
|
|
32
|
+
glyph = 5
|
|
33
33
|
}
|
|
34
34
|
export interface ICurrentNodePositionState {
|
|
35
35
|
page: NodePositionStateType;
|
|
@@ -37,7 +37,7 @@ export interface ICurrentNodePositionState {
|
|
|
37
37
|
column: NodePositionStateType;
|
|
38
38
|
line: NodePositionStateType;
|
|
39
39
|
divide: NodePositionStateType;
|
|
40
|
-
|
|
40
|
+
glyph: NodePositionStateType;
|
|
41
41
|
}
|
|
42
42
|
export declare const NodePositionMap: {
|
|
43
43
|
page: number;
|
|
@@ -45,7 +45,7 @@ export declare const NodePositionMap: {
|
|
|
45
45
|
column: number;
|
|
46
46
|
line: number;
|
|
47
47
|
divide: number;
|
|
48
|
-
|
|
48
|
+
glyph: number;
|
|
49
49
|
};
|
|
50
50
|
export declare function compareNodePositionLogic(pos1: INodePosition, pos2: INodePosition): boolean;
|
|
51
51
|
export declare function compareNodePosition(pos1: INodePosition, pos2: INodePosition): {
|
|
@@ -21,7 +21,7 @@ import type { IPoint } from '../../../basics/vector2';
|
|
|
21
21
|
import type { Scene } from '../../../scene';
|
|
22
22
|
import { Rect } from '../../../shape/rect';
|
|
23
23
|
import type { ThinScene } from '../../../thin-scene';
|
|
24
|
-
import type { DocumentSkeleton } from '../doc-skeleton';
|
|
24
|
+
import type { DocumentSkeleton } from '../layout/doc-skeleton';
|
|
25
25
|
import type { Documents } from '../document';
|
|
26
26
|
export declare const TEXT_RANGE_LAYER_INDEX = 1;
|
|
27
27
|
export declare function cursorConvertToTextRange(scene: Scene, range: ISuccinctTextRangeParam, docSkeleton: DocumentSkeleton, document: Documents): Nullable<TextRange>;
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
import type { Nullable } from '@univerjs/core';
|
|
17
17
|
import { ILogService, RxDisposable } from '@univerjs/core';
|
|
18
18
|
import type { Observable } from 'rxjs';
|
|
19
|
-
import type { IMouseEvent, IPointerEvent } from '
|
|
20
|
-
import type { INodePosition } from '
|
|
21
|
-
import type { ISuccinctTextRangeParam, ITextRangeWithStyle, ITextSelectionStyle, RANGE_DIRECTION } from '
|
|
22
|
-
import type { Engine } from '
|
|
23
|
-
import type { Scene } from '
|
|
24
|
-
import type { Viewport } from '
|
|
25
|
-
import {
|
|
26
|
-
import type {
|
|
27
|
-
import
|
|
19
|
+
import type { IMouseEvent, IPointerEvent } from '../../../basics/i-events';
|
|
20
|
+
import type { INodePosition } from '../../../basics/interfaces';
|
|
21
|
+
import type { ISuccinctTextRangeParam, ITextRangeWithStyle, ITextSelectionStyle, RANGE_DIRECTION } from '../../../basics/range';
|
|
22
|
+
import type { Engine } from '../../../engine';
|
|
23
|
+
import type { Scene } from '../../../scene';
|
|
24
|
+
import type { Viewport } from '../../../viewport';
|
|
25
|
+
import type { DocumentSkeleton } from '../layout/doc-skeleton';
|
|
26
|
+
import type { Documents } from '../document';
|
|
27
|
+
import { TextRange } from './text-range';
|
|
28
28
|
export declare function getCanvasOffsetByEngine(engine: Nullable<Engine>): {
|
|
29
29
|
left: number;
|
|
30
30
|
top: number;
|
|
@@ -77,6 +77,7 @@ export interface ITextSelectionRenderManager {
|
|
|
77
77
|
handleDblClick(evt: IPointerEvent | IMouseEvent): void;
|
|
78
78
|
handleTripleClick(evt: IPointerEvent | IMouseEvent): void;
|
|
79
79
|
eventTrigger(evt: IPointerEvent | IMouseEvent): void;
|
|
80
|
+
setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
|
|
80
81
|
}
|
|
81
82
|
export interface IEditorInputConfig {
|
|
82
83
|
event: Event | CompositionEvent | KeyboardEvent;
|
|
@@ -144,6 +145,7 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
144
145
|
changeRuntime(docSkeleton: DocumentSkeleton, scene: Scene, document: Documents): void;
|
|
145
146
|
handleDblClick(evt: IPointerEvent | IMouseEvent): void;
|
|
146
147
|
handleTripleClick(evt: IPointerEvent | IMouseEvent): void;
|
|
148
|
+
setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
|
|
147
149
|
eventTrigger(evt: IPointerEvent | IMouseEvent): void;
|
|
148
150
|
removeAllTextRanges(): void;
|
|
149
151
|
private _getAllTextRanges;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { BorderStyleTypes, HorizontalAlign, ISelectionCellWithCoord, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
17
17
|
import type { BORDER_TYPE } from '../../basics/const';
|
|
18
|
-
import type { DocumentSkeleton } from '../docs/doc-skeleton';
|
|
18
|
+
import type { DocumentSkeleton } from '../docs/layout/doc-skeleton';
|
|
19
19
|
export interface BorderCache {
|
|
20
20
|
[key: string]: BorderCacheItem | {};
|
|
21
21
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { ICellData, IPaddingData, IRange, ISelectionCellWithCoord, ITextRotation, IWorksheetData, Nullable, Styles, Worksheet } from '@univerjs/core';
|
|
17
17
|
import { BooleanNumber, DocumentDataModel, HorizontalAlign, IContextService, LocaleService, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
18
18
|
import type { IBoundRectNoAngle, IViewportBound } from '../../basics/vector2';
|
|
19
|
-
import { DocumentSkeleton } from '../docs/doc-skeleton';
|
|
19
|
+
import { DocumentSkeleton } from '../docs/layout/doc-skeleton';
|
|
20
20
|
import { Skeleton } from '../skeleton';
|
|
21
21
|
import type { IStylesCache } from './interfaces';
|
|
22
22
|
/**
|
package/lib/types/context.d.ts
CHANGED
|
@@ -150,6 +150,10 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
150
150
|
* @method
|
|
151
151
|
*/
|
|
152
152
|
closePath(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Chrome hardware acceleration causes canvas stroke to fail to draw lines on Mac.
|
|
155
|
+
*/
|
|
156
|
+
closePathByEnv(): void;
|
|
153
157
|
/**
|
|
154
158
|
* createImageData function.
|
|
155
159
|
* @method
|
package/lib/types/engine.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
52
52
|
private pointer;
|
|
53
53
|
private _mouseId;
|
|
54
54
|
private _isUsingFirefox;
|
|
55
|
+
private _previousWidth;
|
|
56
|
+
private _previousHeight;
|
|
55
57
|
constructor(elemWidth?: number, elemHeight?: number, pixelRatio?: number, mode?: CanvasRenderMode);
|
|
56
58
|
get width(): number;
|
|
57
59
|
get height(): number;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export * from './base-object';
|
|
|
17
17
|
export * from './basics';
|
|
18
18
|
export * from './canvas';
|
|
19
19
|
export * from './components';
|
|
20
|
-
export { DocumentViewModel } from './components/docs/view-model/document-view-model';
|
|
21
20
|
export * from './context';
|
|
22
21
|
export * from './custom';
|
|
23
22
|
export * from './engine';
|
|
@@ -30,3 +29,12 @@ export * from './scene-viewer';
|
|
|
30
29
|
export * from './scroll-timer';
|
|
31
30
|
export * from './shape';
|
|
32
31
|
export * from './viewport';
|
|
32
|
+
export { DocumentViewModel } from './components/docs/view-model/document-view-model';
|
|
33
|
+
export { getAnchorBounding, TEXT_RANGE_LAYER_INDEX, TextRange } from './components/docs/text-selection/text-range';
|
|
34
|
+
export { NodePositionConvertToCursor } from './components/docs/text-selection/convert-cursor';
|
|
35
|
+
export { Liquid } from './components/docs/liquid';
|
|
36
|
+
export { ITextSelectionRenderManager, TextSelectionRenderManager, getCanvasOffsetByEngine, } from './components/docs/text-selection/text-selection-render-manager';
|
|
37
|
+
export type { IActiveTextRange, IEditorInputConfig, ITextSelectionInnerParam } from './components/docs/text-selection/text-selection-render-manager';
|
|
38
|
+
export { Documents } from './components/docs/document';
|
|
39
|
+
export type { IPageRenderConfig } from './components/docs/document';
|
|
40
|
+
export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
|
package/lib/types/layer.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare class Layer extends Disposable {
|
|
|
40
40
|
makeDirty(state?: boolean): this;
|
|
41
41
|
isDirty(): boolean;
|
|
42
42
|
render(parentCtx?: UniverRenderingContext, isMaxLayer?: boolean): this;
|
|
43
|
+
private _layerBehavior;
|
|
43
44
|
private _initialCacheCanvas;
|
|
44
45
|
private _draw;
|
|
45
46
|
private _applyCache;
|
|
@@ -58,6 +58,7 @@ export declare class RenderManagerService implements IRenderManagerService {
|
|
|
58
58
|
get defaultEngine(): Engine;
|
|
59
59
|
dispose(): void;
|
|
60
60
|
createRenderWithParent(unitId: string, parentUnitId: string): IRender;
|
|
61
|
+
createRenderWithEngine(unitId: string, engine: Engine): IRender;
|
|
61
62
|
create(unitId: Nullable<string>): void;
|
|
62
63
|
createRender(unitId: string): IRender;
|
|
63
64
|
private _createRender;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { EventState, Nullable, Observer } from '@univerjs/core';
|
|
17
17
|
import { Disposable, Observable } from '@univerjs/core';
|
|
18
18
|
import type { BaseObject } from './base-object';
|
|
19
|
-
import type { EVENT_TYPE } from './basics/const';
|
|
19
|
+
import type { CURSOR_TYPE, EVENT_TYPE } from './basics/const';
|
|
20
20
|
import { RENDER_CLASS_TYPE } from './basics/const';
|
|
21
21
|
import type { IKeyboardEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events';
|
|
22
22
|
import type { ITransformChangeState } from './basics/interfaces';
|
|
@@ -25,6 +25,7 @@ import type { IViewportBound, Vector2 } from './basics/vector2';
|
|
|
25
25
|
import type { UniverRenderingContext } from './context';
|
|
26
26
|
export declare abstract class ThinScene extends Disposable {
|
|
27
27
|
onTransformChangeObservable: Observable<ITransformChangeState>;
|
|
28
|
+
onFileLoadedObservable: Observable<string>;
|
|
28
29
|
onPointerDownObserver: Observable<IMouseEvent | IPointerEvent>;
|
|
29
30
|
onPointerMoveObserver: Observable<IMouseEvent | IPointerEvent>;
|
|
30
31
|
onPointerUpObserver: Observable<IMouseEvent | IPointerEvent>;
|
|
@@ -98,4 +99,6 @@ export declare abstract class ThinScene extends Disposable {
|
|
|
98
99
|
scaleX: number;
|
|
99
100
|
scaleY: number;
|
|
100
101
|
};
|
|
102
|
+
setCursor(val: CURSOR_TYPE): void;
|
|
103
|
+
resetCursor(): void;
|
|
101
104
|
}
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -74,7 +74,6 @@ export declare class Viewport {
|
|
|
74
74
|
onScrollStopObserver: Observable<IScrollObserverParam>;
|
|
75
75
|
onScrollByBarObserver: Observable<IScrollObserverParam>;
|
|
76
76
|
private _viewPortKey;
|
|
77
|
-
private _dirty;
|
|
78
77
|
private _topOrigin;
|
|
79
78
|
private _leftOrigin;
|
|
80
79
|
private _bottomOrigin;
|
|
@@ -133,8 +132,6 @@ export declare class Viewport {
|
|
|
133
132
|
resize(position: IViewPosition): void;
|
|
134
133
|
setPadding(param: IPosition): void;
|
|
135
134
|
resetPadding(): void;
|
|
136
|
-
makeDirty(state?: boolean, refreshParent?: boolean): void;
|
|
137
|
-
isDirty(): boolean;
|
|
138
135
|
/**
|
|
139
136
|
* scroll to position, absolute
|
|
140
137
|
* @param pos
|