@univerjs/engine-render 0.1.0-beta.1 → 0.1.0-beta.3

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.
Files changed (63) hide show
  1. package/{LICENSE.txt → LICENSE} +0 -2
  2. package/lib/cjs/index.js +4 -4
  3. package/lib/es/index.js +12704 -8240
  4. package/lib/types/base-object.d.ts +2 -1
  5. package/lib/types/basics/draw.d.ts +5 -4
  6. package/lib/types/basics/tools.d.ts +1 -2
  7. package/lib/types/canvas.d.ts +2 -1
  8. package/lib/types/components/component.d.ts +2 -1
  9. package/lib/types/components/docs/common/text-range.d.ts +4 -4
  10. package/lib/types/components/docs/doc-component.d.ts +3 -2
  11. package/lib/types/components/docs/document.d.ts +4 -3
  12. package/lib/types/components/docs/extensions/background.d.ts +2 -1
  13. package/lib/types/components/docs/extensions/border.d.ts +2 -1
  14. package/lib/types/components/docs/extensions/font-and-base-line.d.ts +2 -1
  15. package/lib/types/components/docs/extensions/line.d.ts +2 -2
  16. package/lib/types/components/docs/linebreak/__tests__/linebreak.spec.d.ts +16 -0
  17. package/lib/types/components/docs/linebreak/break.d.ts +20 -0
  18. package/lib/types/components/docs/linebreak/classes.d.ts +58 -0
  19. package/lib/types/components/docs/linebreak/extensions/tab-linebreak-extension.d.ts +17 -0
  20. package/lib/types/components/docs/linebreak/index.d.ts +16 -0
  21. package/lib/types/components/docs/linebreak/linebreaker.d.ts +41 -0
  22. package/lib/types/components/docs/linebreak/pairs.d.ts +21 -0
  23. package/lib/types/components/docs/linebreak/rule.d.ts +23 -0
  24. package/lib/types/components/docs/linebreak/swap.d.ts +16 -0
  25. package/lib/types/components/docs/linebreak/tiny-inflate.d.ts +31 -0
  26. package/lib/types/components/docs/linebreak/trie-data.d.ts +17 -0
  27. package/lib/types/components/docs/linebreak/unicode-trie.d.ts +22 -0
  28. package/lib/types/components/docs/text-selection-render-manager.d.ts +5 -3
  29. package/lib/types/components/extension.d.ts +2 -1
  30. package/lib/types/components/sheets/column-header.d.ts +2 -1
  31. package/lib/types/components/sheets/extensions/background.d.ts +2 -1
  32. package/lib/types/components/sheets/extensions/border.d.ts +2 -1
  33. package/lib/types/components/sheets/extensions/column-header-layout.d.ts +2 -1
  34. package/lib/types/components/sheets/extensions/font.d.ts +3 -2
  35. package/lib/types/components/sheets/extensions/row-header-layout.d.ts +2 -1
  36. package/lib/types/components/sheets/row-header.d.ts +2 -1
  37. package/lib/types/components/sheets/sheet-component.d.ts +4 -3
  38. package/lib/types/components/sheets/sheet-skeleton.d.ts +10 -4
  39. package/lib/types/components/sheets/spreadsheet.d.ts +5 -10
  40. package/lib/types/components/slides/slide.d.ts +2 -1
  41. package/lib/types/context.d.ts +284 -0
  42. package/lib/types/custom/custom-object.d.ts +3 -2
  43. package/lib/types/engine.d.ts +6 -0
  44. package/lib/types/group.d.ts +2 -1
  45. package/lib/types/index.d.ts +1 -0
  46. package/lib/types/layer.d.ts +2 -1
  47. package/lib/types/scene-viewer.d.ts +2 -1
  48. package/lib/types/scene.d.ts +7 -2
  49. package/lib/types/scroll-timer.d.ts +11 -5
  50. package/lib/types/shape/base-scroll-bar.d.ts +2 -1
  51. package/lib/types/shape/circle.d.ts +3 -2
  52. package/lib/types/shape/path.d.ts +4 -3
  53. package/lib/types/shape/picture.d.ts +3 -2
  54. package/lib/types/shape/rect.d.ts +3 -2
  55. package/lib/types/shape/regular-polygon.d.ts +3 -2
  56. package/lib/types/shape/rich-text.d.ts +3 -2
  57. package/lib/types/shape/scroll-bar.d.ts +2 -1
  58. package/lib/types/shape/shape.d.ts +12 -11
  59. package/lib/types/thin-engine.d.ts +1 -0
  60. package/lib/types/thin-scene.d.ts +8 -2
  61. package/lib/types/viewport.d.ts +2 -2
  62. package/lib/umd/index.js +4 -4
  63. package/package.json +26 -23
@@ -21,6 +21,7 @@ import type { IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events'
21
21
  import type { IObjectFullState, ITransformChangeState } from './basics/interfaces';
22
22
  import { Transform } from './basics/transform';
23
23
  import type { IViewportBound, Vector2 } from './basics/vector2';
24
+ import type { UniverRenderingContext } from './context';
24
25
  export declare const BASE_OBJECT_ARRAY: string[];
25
26
  export declare abstract class BaseObject {
26
27
  groupKey?: string;
@@ -142,7 +143,7 @@ export declare abstract class BaseObject {
142
143
  };
143
144
  hide(): void;
144
145
  show(): void;
145
- render(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
146
+ render(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
146
147
  isHit(coord: Vector2): boolean;
147
148
  on(eventType: EVENT_TYPE, func: (evt: unknown, state: EventState) => void): Nullable<Observer<unknown>>;
148
149
  off(eventType: EVENT_TYPE, observer: Nullable<Observer<unknown>>): void;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { IPosition } from '@univerjs/core';
17
17
  import { BorderStyleTypes } from '@univerjs/core';
18
+ import type { UniverRenderingContext } from '../context';
18
19
  import { BORDER_TYPE, ORIENTATION_TYPE } from './const';
19
20
  import type { IDocumentSkeletonLine } from './i-document-skeleton-cached';
20
21
  import { Vector2 } from './vector2';
@@ -26,10 +27,10 @@ export interface IContext2D extends CanvasRenderingContext2D {
26
27
  backingStorePixelRatio: number;
27
28
  }
28
29
  export declare function getDevicePixelRatio(): number;
29
- export declare function drawLineByBorderType(ctx: CanvasRenderingContext2D, type: BORDER_TYPE, position: IPosition): void;
30
- export declare function drawDiagonalLineByBorderType(ctx: CanvasRenderingContext2D, type: BORDER_TYPE, position: IPosition): void;
31
- export declare function clearLineByBorderType(ctx: CanvasRenderingContext2D, type: BORDER_TYPE, position: IPosition, scaleX: number, scaleY: number): void;
32
- export declare function setLineType(ctx: CanvasRenderingContext2D, style: BorderStyleTypes): void;
30
+ export declare function drawLineByBorderType(ctx: UniverRenderingContext, type: BORDER_TYPE, position: IPosition): void;
31
+ export declare function drawDiagonalLineByBorderType(ctx: UniverRenderingContext, type: BORDER_TYPE, position: IPosition): void;
32
+ export declare function clearLineByBorderType(ctx: UniverRenderingContext, type: BORDER_TYPE, position: IPosition): void;
33
+ export declare function setLineType(ctx: UniverRenderingContext, style: BorderStyleTypes): void;
33
34
  export declare function getLineOffset(): number;
34
35
  export declare function getLineWith(width: number): number;
35
36
  export declare function getLineWidth(style: BorderStyleTypes): number;
@@ -62,7 +62,6 @@ export declare function getFontStyleString(textStyle?: IStyleBase, localeService
62
62
  fontSize: number;
63
63
  fontFamily: string;
64
64
  };
65
- export declare function isSupportBoundingBox(ctx: CanvasRenderingContext2D): boolean;
66
65
  export declare function hasCJKText(text: string): boolean;
67
66
  export declare function hasCJK(text: string): boolean;
68
67
  export declare function hasAllLatin(text: string): boolean;
@@ -96,7 +95,7 @@ export declare function getCellInfoInMergeData(row: number, column: number, merg
96
95
  * Determine whether there are any cells in a row that are not in the merged cells, mainly used for the calculation of auto height
97
96
  */
98
97
  export declare function hasUnMergedCellInRow(row: number, startColumn: number, endColumn: number, mergeData: IRange[]): boolean;
99
- export declare function mergeInfoOffset(mergeInfo: IRangeWithCoord, offsetX: number, offsetY: number, scaleX: number, scaleY: number): {
98
+ export declare function mergeInfoOffset(mergeInfo: IRangeWithCoord, offsetX: number, offsetY: number): {
100
99
  startX: number;
101
100
  startY: number;
102
101
  endX: number;
@@ -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 { UniverRenderingContext } from './context';
16
17
  interface ICanvasProps {
17
18
  width?: number;
18
19
  height?: number;
@@ -42,7 +43,7 @@ export declare class Canvas {
42
43
  * @method
43
44
  * @returns {CanvasContext} context
44
45
  */
45
- getContext(): CanvasRenderingContext2D;
46
+ getContext(): UniverRenderingContext;
46
47
  getPixelRatio(): number;
47
48
  getWidth(): number;
48
49
  getHeight(): number;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { BaseObject } from '../base-object';
17
17
  import type { IViewportBound } from '../basics/vector2';
18
+ import type { UniverRenderingContext } from '../context';
18
19
  import type { ComponentExtension } from './extension';
19
20
  export declare class RenderComponent<T, U, V> extends BaseObject {
20
21
  private _extensions;
@@ -23,5 +24,5 @@ export declare class RenderComponent<T, U, V> extends BaseObject {
23
24
  unRegister(...uKeys: string[]): void;
24
25
  getExtensionsByOrder(): ComponentExtension<T, U, V>[];
25
26
  getExtensionByKey(uKey: string): ComponentExtension<T, U, V> | undefined;
26
- draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
27
+ draw(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
27
28
  }
@@ -21,11 +21,11 @@ import type { Scene } from '../../../scene';
21
21
  import { Rect } from '../../../shape/rect';
22
22
  import type { ThinScene } from '../../../thin-scene';
23
23
  import type { DocumentSkeleton } from '../doc-skeleton';
24
- import type { IDocumentOffsetConfig } from '../document';
25
- export declare function cursorConvertToTextRange(scene: Scene, range: ISuccinctTextRangeParam, docSkeleton: DocumentSkeleton, documentOffsetConfig: IDocumentOffsetConfig): Nullable<TextRange>;
24
+ import type { Documents } from '../document';
25
+ export declare function cursorConvertToTextRange(scene: Scene, range: ISuccinctTextRangeParam, docSkeleton: DocumentSkeleton, document: Documents): Nullable<TextRange>;
26
26
  export declare class TextRange {
27
27
  private _scene;
28
- private _documentOffsetConfig;
28
+ private _document;
29
29
  private _docSkeleton;
30
30
  anchorNodePosition?: Nullable<INodePosition>;
31
31
  focusNodePosition?: Nullable<INodePosition>;
@@ -34,7 +34,7 @@ export declare class TextRange {
34
34
  private _rangeShape;
35
35
  private _anchorShape;
36
36
  private _cursorList;
37
- constructor(_scene: ThinScene, _documentOffsetConfig: IDocumentOffsetConfig, _docSkeleton: DocumentSkeleton, anchorNodePosition?: Nullable<INodePosition>, focusNodePosition?: Nullable<INodePosition>, style?: ITextSelectionStyle);
37
+ constructor(_scene: ThinScene, _document: Documents, _docSkeleton: DocumentSkeleton, anchorNodePosition?: Nullable<INodePosition>, focusNodePosition?: Nullable<INodePosition>, style?: ITextSelectionStyle);
38
38
  get startOffset(): number | undefined;
39
39
  get endOffset(): number | undefined;
40
40
  get collapsed(): boolean;
@@ -18,6 +18,7 @@ import type { IDocumentSkeletonLine, IDocumentSkeletonSpan } from '../../basics/
18
18
  import { PageLayoutType } from '../../basics/i-document-skeleton-cached';
19
19
  import type { INodeInfo } from '../../basics/interfaces';
20
20
  import type { IBoundRectNoAngle, IViewportBound } from '../../basics/vector2';
21
+ import type { UniverRenderingContext } from '../../context';
21
22
  import { RenderComponent } from '../component';
22
23
  import type { DOCS_EXTENSION_TYPE } from './doc-extension';
23
24
  import type { DocumentSkeleton } from './doc-skeleton';
@@ -29,7 +30,7 @@ export declare class DocComponent extends RenderComponent<IDocumentSkeletonSpan
29
30
  constructor(oKey: string, _skeleton?: DocumentSkeleton | undefined);
30
31
  getSkeleton(): DocumentSkeleton | undefined;
31
32
  setSkeleton(skeleton: DocumentSkeleton): void;
32
- render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this | undefined;
33
+ render(mainCtx: UniverRenderingContext, bounds?: IViewportBound): this | undefined;
33
34
  getParentScale(): {
34
35
  scaleX: any;
35
36
  scaleY: any;
@@ -40,5 +41,5 @@ export declare class DocComponent extends RenderComponent<IDocumentSkeletonSpan
40
41
  findNodeByCoord(offsetX: number, offsetY: number): Nullable<INodeInfo>;
41
42
  findCoordByNode(span: IDocumentSkeletonSpan): void;
42
43
  protected _getBounding(bounds?: IViewportBound): void;
43
- protected _draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
44
+ protected _draw(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
44
45
  }
@@ -19,6 +19,7 @@ import type { IDocumentSkeletonPage } from '../../basics/i-document-skeleton-cac
19
19
  import { PageLayoutType } from '../../basics/i-document-skeleton-cached';
20
20
  import type { Transform } from '../../basics/transform';
21
21
  import type { IViewportBound } from '../../basics/vector2';
22
+ import type { UniverRenderingContext } from '../../context';
22
23
  import type { Scene } from '../../scene';
23
24
  import { DocComponent } from './doc-component';
24
25
  import type { DocumentSkeleton } from './doc-skeleton';
@@ -34,7 +35,7 @@ export interface IPageRenderConfig {
34
35
  page: IDocumentSkeletonPage;
35
36
  pageLeft: number;
36
37
  pageTop: number;
37
- ctx: CanvasRenderingContext2D;
38
+ ctx: UniverRenderingContext;
38
39
  }
39
40
  export interface IDocumentOffsetConfig extends IPageMarginLayout {
40
41
  docsLeft: number;
@@ -53,9 +54,9 @@ export declare class Documents extends DocComponent {
53
54
  setConfig(config?: IDocumentsConfig): void;
54
55
  getOffsetConfig(): IDocumentOffsetConfig;
55
56
  getEngine(): Nullable<import("../../thin-engine").ThinEngine<Scene>>;
56
- draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
57
+ draw(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
57
58
  changeSkeleton(newSkeleton: DocumentSkeleton): this;
58
- protected _draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
59
+ protected _draw(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
59
60
  private _horizontalHandler;
60
61
  private _verticalHandler;
61
62
  private _startRotation;
@@ -15,11 +15,12 @@
15
15
  */
16
16
  import type { IScale } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonSpan } from '../../../basics/i-document-skeleton-cached';
18
+ import type { UniverRenderingContext } from '../../../context';
18
19
  import { docExtension } from '../doc-extension';
19
20
  export declare class Background extends docExtension {
20
21
  uKey: string;
21
22
  zIndex: number;
22
23
  private _preBackgroundColor;
23
- draw(ctx: CanvasRenderingContext2D, parentScale: IScale, span: IDocumentSkeletonSpan): void;
24
+ draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
24
25
  clearCache(): void;
25
26
  }
@@ -15,13 +15,14 @@
15
15
  */
16
16
  import type { IScale } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonSpan } from '../../../basics/i-document-skeleton-cached';
18
+ import type { UniverRenderingContext } from '../../../context';
18
19
  import { docExtension } from '../doc-extension';
19
20
  export declare class Border extends docExtension {
20
21
  uKey: string;
21
22
  zIndex: number;
22
23
  private _preBorderStyle;
23
24
  private _preBorderColor;
24
- draw(ctx: CanvasRenderingContext2D, parentScale: IScale, span: IDocumentSkeletonSpan): void;
25
+ draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
25
26
  clearCache(): void;
26
27
  private _createBorderCache;
27
28
  }
@@ -15,13 +15,14 @@
15
15
  */
16
16
  import type { IScale } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonSpan } from '../../../basics/i-document-skeleton-cached';
18
+ import type { UniverRenderingContext } from '../../../context';
18
19
  import { docExtension } from '../doc-extension';
19
20
  export declare class FontAndBaseLine extends docExtension {
20
21
  uKey: string;
21
22
  zIndex: number;
22
23
  private _preFontString;
23
24
  private _preFontColor;
24
- draw(ctx: CanvasRenderingContext2D, parentScale: IScale, span: IDocumentSkeletonSpan): void;
25
+ draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
25
26
  private _fillText;
26
27
  clearCache(): void;
27
28
  }
@@ -15,14 +15,14 @@
15
15
  */
16
16
  import type { IScale } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonSpan } from '../../../basics/i-document-skeleton-cached';
18
+ import type { UniverRenderingContext } from '../../../context';
18
19
  import { docExtension } from '../doc-extension';
19
20
  export declare class Line extends docExtension {
20
21
  uKey: string;
21
22
  zIndex: number;
22
23
  private _preBackgroundColor;
23
- draw(ctx: CanvasRenderingContext2D, parentScale: IScale, span: IDocumentSkeletonSpan): void;
24
+ draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
24
25
  clearCache(): void;
25
26
  private _drawLine;
26
27
  private _setLineType;
27
- private _getLineWidth;
28
28
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 declare class Break {
17
+ position: number;
18
+ required: boolean;
19
+ constructor(position: number, required?: boolean);
20
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 declare const OP = 0;
17
+ export declare const CL = 1;
18
+ export declare const CP = 2;
19
+ export declare const QU = 3;
20
+ export declare const GL = 4;
21
+ export declare const NS = 5;
22
+ export declare const EX = 6;
23
+ export declare const SY = 7;
24
+ export declare const IS = 8;
25
+ export declare const PR = 9;
26
+ export declare const PO = 10;
27
+ export declare const NU = 11;
28
+ export declare const AL = 12;
29
+ export declare const HL = 13;
30
+ export declare const ID = 14;
31
+ export declare const IN = 15;
32
+ export declare const HY = 16;
33
+ export declare const BA = 17;
34
+ export declare const BB = 18;
35
+ export declare const B2 = 19;
36
+ export declare const ZW = 20;
37
+ export declare const CM = 21;
38
+ export declare const WJ = 22;
39
+ export declare const H2 = 23;
40
+ export declare const H3 = 24;
41
+ export declare const JL = 25;
42
+ export declare const JV = 26;
43
+ export declare const JT = 27;
44
+ export declare const RI = 28;
45
+ export declare const EB = 29;
46
+ export declare const EM = 30;
47
+ export declare const ZWJ = 31;
48
+ export declare const CB = 32;
49
+ export declare const AI = 33;
50
+ export declare const BK = 34;
51
+ export declare const CJ = 35;
52
+ export declare const CR = 36;
53
+ export declare const LF = 37;
54
+ export declare const NL = 38;
55
+ export declare const SA = 39;
56
+ export declare const SG = 40;
57
+ export declare const SP = 41;
58
+ export declare const XX = 42;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 { LineBreaker } from '../linebreaker';
17
+ export declare function tabLineBreakExtension(breaker: LineBreaker): void;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 { LineBreaker } from './linebreaker';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 { Break } from './break';
17
+ import type { ILineBreakRule } from './rule';
18
+ interface ILineBreakExtension {
19
+ (breaker: LineBreaker): void;
20
+ }
21
+ export declare class LineBreaker {
22
+ string: string;
23
+ private _pos;
24
+ private _lastPos;
25
+ private _curClass;
26
+ private _codePoint;
27
+ private _nextClass;
28
+ private _LB8a;
29
+ private _LB21a;
30
+ private _LB30a;
31
+ private _rule;
32
+ constructor(string: string);
33
+ use(extension: ILineBreakExtension): this;
34
+ addRule(key: string, rule: ILineBreakRule): this;
35
+ nextBreak(): Break | null;
36
+ private _getNextCodePoint;
37
+ private _nextCharClass;
38
+ private _getSimpleBreak;
39
+ private _getPairTableBreak;
40
+ }
41
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 declare const DI_BRK = 0;
17
+ export declare const IN_BRK = 1;
18
+ export declare const CI_BRK = 2;
19
+ export declare const CP_BRK = 3;
20
+ export declare const PR_BRK = 4;
21
+ export declare const pairTable: number[][];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 ILineBreakRule {
17
+ (codePoint: number, className: number): boolean;
18
+ }
19
+ export declare class Rule {
20
+ private _rules;
21
+ add(key: string, rule: ILineBreakRule): void;
22
+ shouldBreak(codePoint: number, className: number): boolean;
23
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 declare const swap32LE: (array: Uint8Array) => void;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 declare class Tree {
17
+ table: Uint16Array;
18
+ trans: Uint16Array;
19
+ }
20
+ export declare class Data {
21
+ source: Uint8Array;
22
+ dest: Uint8Array;
23
+ sourceIndex: number;
24
+ tag: number;
25
+ bitcount: number;
26
+ destLen: number;
27
+ ltree: Tree;
28
+ dtree: Tree;
29
+ constructor(source: Uint8Array, dest: Uint8Array);
30
+ }
31
+ export default function tinf_uncompress(source: Uint8Array, dest: Uint8Array): Uint8Array;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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
+ declare const _default: Uint8Array;
17
+ export default _default;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 default class UnicodeTrie {
17
+ highStart: number;
18
+ errorValue: number;
19
+ data: Uint32Array;
20
+ constructor(data: any);
21
+ get(codePoint: number): number;
22
+ }
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
- import { RxDisposable } from '@univerjs/core';
17
+ import { ILogService, RxDisposable } from '@univerjs/core';
18
18
  import type { Observable } from 'rxjs';
19
19
  import type { IMouseEvent, IPointerEvent } from '../../basics/i-events';
20
20
  import type { INodePosition } from '../../basics/interfaces';
@@ -86,6 +86,7 @@ export interface IEditorInputConfig {
86
86
  rangeList?: TextRange[];
87
87
  }
88
88
  export declare class TextSelectionRenderManager extends RxDisposable implements ITextSelectionRenderManager {
89
+ private readonly _logService;
89
90
  private readonly _onInputBefore$;
90
91
  readonly onInputBefore$: Observable<Nullable<IEditorInputConfig>>;
91
92
  private readonly _onKeydown$;
@@ -122,7 +123,7 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
122
123
  private _docSkeleton;
123
124
  private _scene;
124
125
  private _document;
125
- constructor();
126
+ constructor(_logService: ILogService);
126
127
  __getEditorContainer(): HTMLElement;
127
128
  getViewPort(): Viewport;
128
129
  setSegment(id: string): void;
@@ -154,7 +155,8 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
154
155
  private _removeAllTextRanges;
155
156
  private _deactivateAllTextRanges;
156
157
  private _addTextRange;
157
- private _updateTextRangePosition;
158
+ private _updateTextRangeAnchorPosition;
159
+ private _updateActiveRangeFocusPosition;
158
160
  private _isEmpty;
159
161
  private _getCanvasOffset;
160
162
  private _scrollToSelection;
@@ -17,6 +17,7 @@ import type { IDocumentRenderConfig, IScale, Nullable } from '@univerjs/core';
17
17
  import { Registry } from '@univerjs/core';
18
18
  import type { BaseObject } from '../base-object';
19
19
  import type { Vector2 } from '../basics/vector2';
20
+ import type { UniverRenderingContext } from '../context';
20
21
  export interface IExtensionConfig {
21
22
  originTranslate?: Vector2;
22
23
  spanStartPoint?: Vector2;
@@ -33,7 +34,7 @@ export declare class ComponentExtension<T, U, V> {
33
34
  translateX: number;
34
35
  translateY: number;
35
36
  extensionOffset: IExtensionConfig;
36
- draw(ctx: CanvasRenderingContext2D, parentScale: IScale, skeleton: T, diffBounds?: V): void;
37
+ draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: T, diffBounds?: V): void;
37
38
  clearCache(): void;
38
39
  protected _getScale(parentScale: IScale): number;
39
40
  }
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IViewportBound, Vector2 } from '../../basics/vector2';
17
+ import type { UniverRenderingContext } from '../../context';
17
18
  import type { ColumnHeaderLayout } from './extensions/column-header-layout';
18
19
  import { SpreadsheetHeader } from './sheet-component';
19
20
  import type { SpreadsheetSkeleton } from './sheet-skeleton';
@@ -21,7 +22,7 @@ export declare class SpreadsheetColumnHeader extends SpreadsheetHeader {
21
22
  private _columnHeaderLayoutExtension;
22
23
  constructor(oKey: string, spreadsheetSkeleton?: SpreadsheetSkeleton);
23
24
  get columnHeaderLayoutExtension(): ColumnHeaderLayout;
24
- draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
25
+ draw(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
25
26
  isHit(coord: Vector2): boolean;
26
27
  private _initialDefaultExtension;
27
28
  }
@@ -14,10 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IRange, IScale } from '@univerjs/core';
17
+ import type { UniverRenderingContext } from '../../../context';
17
18
  import type { SpreadsheetSkeleton } from '../sheet-skeleton';
18
19
  import { SheetExtension } from './sheet-extension';
19
20
  export declare class Background extends SheetExtension {
20
21
  uKey: string;
21
22
  zIndex: number;
22
- draw(ctx: CanvasRenderingContext2D, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
23
+ draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
23
24
  }