@netless/appliance-plugin 1.1.2 → 1.1.3-4.beta.0

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 (154) hide show
  1. package/READMA.zh-CN.md +993 -0
  2. package/README.md +963 -176
  3. package/cdn/cdn.js +1 -1
  4. package/cdn/fullWorker-Dwf7nY.js +486 -0
  5. package/cdn/subWorker-DXBnNm.js +486 -0
  6. package/dist/ObserverMap-BudneEfB.mjs +58 -0
  7. package/dist/ObserverMap-DTz9zucn.js +1 -0
  8. package/dist/appliance-plugin.js +1 -1
  9. package/dist/appliance-plugin.mjs +27 -18
  10. package/dist/cdn.d.ts +2 -2
  11. package/dist/collector/base.d.ts +3 -1
  12. package/dist/collector/collector.d.ts +57 -14
  13. package/dist/collector/index.d.ts +4 -4
  14. package/dist/collector/types.d.ts +49 -10
  15. package/dist/component/autoDraw/index.d.ts +0 -0
  16. package/dist/component/miniMap/index.d.ts +1 -0
  17. package/dist/component/miniMap/manager.d.ts +37 -0
  18. package/dist/component/miniMap/view.d.ts +14 -0
  19. package/dist/component/svg/base.d.ts +30 -0
  20. package/dist/component/svg/manager.d.ts +44 -0
  21. package/dist/component/svg/markmap.d.ts +41 -0
  22. package/dist/component/svg/mermaid-check.d.ts +18 -0
  23. package/dist/component/svg/mermaid-loader.d.ts +29 -0
  24. package/dist/component/svg/mermaid.d.ts +109 -0
  25. package/dist/component/svg/snapshot.d.ts +31 -0
  26. package/dist/component/svg/svgElemt.d.ts +43 -0
  27. package/dist/component/svg/svgToImageLoader.d.ts +25 -0
  28. package/dist/component/svg/types.d.ts +10 -0
  29. package/dist/component/svg/utils.d.ts +9 -0
  30. package/dist/component/svg/vNodeManager.d.ts +28 -0
  31. package/dist/component/textEditor/index.d.ts +2 -2
  32. package/dist/component/textEditor/manager.d.ts +22 -3
  33. package/dist/component/textEditor/types.d.ts +5 -4
  34. package/dist/component/textEditor/utils.d.ts +1 -0
  35. package/dist/component/textEditor/view.d.ts +28 -48
  36. package/dist/core/autoShape/index.d.ts +12 -0
  37. package/dist/core/autoShape/mapper.d.ts +3 -0
  38. package/dist/core/autoShape/recognizer.d.ts +8 -0
  39. package/dist/core/autoShape/registry.d.ts +2 -0
  40. package/dist/core/autoShape/templates.d.ts +2 -0
  41. package/dist/core/autoShape/types.d.ts +78 -0
  42. package/dist/core/backGroundThread/index.d.ts +35 -0
  43. package/dist/core/backGroundThread/types.d.ts +12 -0
  44. package/dist/core/enum.d.ts +74 -13
  45. package/dist/core/index.d.ts +3 -3
  46. package/dist/core/mainEngine.d.ts +101 -27
  47. package/dist/core/mainThread/base.d.ts +10 -6
  48. package/dist/core/mainThread/index.d.ts +2 -2
  49. package/dist/core/mainThread/snapshotThread.d.ts +8 -4
  50. package/dist/core/mainThread/subLocalThread.d.ts +21 -16
  51. package/dist/core/mainThread/subServiceThread.d.ts +2 -2
  52. package/dist/core/mainThread/subTopThread.d.ts +2 -2
  53. package/dist/core/msgEvent/base.d.ts +1 -0
  54. package/dist/core/msgEvent/baseForBackgroundThread.d.ts +9 -0
  55. package/dist/core/msgEvent/baseForWorker.d.ts +2 -1
  56. package/dist/core/msgEvent/copyNode/forBackgroundThread.d.ts +8 -0
  57. package/dist/core/msgEvent/copyNode/forMain.d.ts +2 -2
  58. package/dist/core/msgEvent/forBackgroundThread.d.ts +12 -0
  59. package/dist/core/msgEvent/forMainThread.d.ts +4 -4
  60. package/dist/core/msgEvent/forWorker.d.ts +4 -4
  61. package/dist/core/msgEvent/index.d.ts +4 -4
  62. package/dist/core/msgEvent/rotateNode/forMain.d.ts +2 -2
  63. package/dist/core/msgEvent/scaleNode/forMain.d.ts +2 -2
  64. package/dist/core/msgEvent/setColor/forMain.d.ts +2 -2
  65. package/dist/core/msgEvent/setPoint/forMain.d.ts +2 -2
  66. package/dist/core/msgEvent/setZIndex/forMain.d.ts +7 -0
  67. package/dist/core/msgEvent/translateNode/forMain.d.ts +2 -2
  68. package/dist/core/plugin.d.ts +49 -0
  69. package/dist/core/renderCotrol.d.ts +12 -11
  70. package/dist/core/tools/arrow.d.ts +10 -22
  71. package/dist/core/tools/base.d.ts +52 -9
  72. package/dist/core/tools/ellipse.d.ts +10 -22
  73. package/dist/core/tools/image.d.ts +9 -7
  74. package/dist/core/tools/index.d.ts +14 -13
  75. package/dist/core/tools/laserPen.d.ts +1 -1
  76. package/dist/core/tools/pencil.d.ts +18 -8
  77. package/dist/core/tools/pencilEraser.d.ts +36 -41
  78. package/dist/core/tools/pencilEraserBitMap.d.ts +20 -27
  79. package/dist/core/tools/polygon.d.ts +10 -22
  80. package/dist/core/tools/rectangle.d.ts +10 -22
  81. package/dist/core/tools/selector.d.ts +42 -24
  82. package/dist/core/tools/shadowSvg.d.ts +36 -0
  83. package/dist/core/tools/speechBalloon.d.ts +10 -22
  84. package/dist/core/tools/star.d.ts +10 -22
  85. package/dist/core/tools/straight.d.ts +10 -22
  86. package/dist/core/tools/text.d.ts +2 -1
  87. package/dist/core/tools/utils.d.ts +11 -12
  88. package/dist/core/types.d.ts +98 -18
  89. package/dist/core/utils/ObserverMap.d.ts +19 -0
  90. package/dist/core/utils/clipper.d.ts +8 -0
  91. package/dist/core/utils/getSvgPathFromPoints.d.ts +1 -1
  92. package/dist/core/utils/index.d.ts +6 -5
  93. package/dist/core/utils/indexDB.d.ts +17 -0
  94. package/dist/core/utils/math.d.ts +1 -0
  95. package/dist/core/utils/polygonUtils.d.ts +8 -0
  96. package/dist/core/utils/primitives/Box2d.d.ts +4 -4
  97. package/dist/core/utils/proxy.d.ts +3 -4
  98. package/dist/core/utils/spriteNode.d.ts +8 -1
  99. package/dist/core/vNodeManager.d.ts +13 -9
  100. package/dist/core/worker/base.d.ts +43 -21
  101. package/dist/core/worker/fullWorkerLocal.d.ts +29 -25
  102. package/dist/core/worker/fullWorkerService.d.ts +9 -9
  103. package/dist/core/worker/simpleWorker.d.ts +28 -0
  104. package/dist/core/worker/snapshotWork.d.ts +27 -0
  105. package/dist/core/worker/subWorkerLocal.d.ts +2 -3
  106. package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
  107. package/dist/core/worker/workerManager.d.ts +52 -36
  108. package/dist/cursors/index.d.ts +9 -11
  109. package/dist/displayer/const.d.ts +1 -0
  110. package/dist/displayer/cursor/index.d.ts +1 -0
  111. package/dist/displayer/floatBar/dragBox/index.d.ts +9 -3
  112. package/dist/displayer/floatBar/index.d.ts +2 -1
  113. package/dist/displayer/floatBtns/index.d.ts +2 -0
  114. package/dist/displayer/utils.d.ts +1 -0
  115. package/dist/extend.d.ts +1 -0
  116. package/dist/fullWorker.js +242 -195
  117. package/dist/index-BCI9ZJly.mjs +9884 -0
  118. package/dist/index-CRWsZj1z.mjs +16601 -0
  119. package/dist/index-D2XqHUO-.js +1 -0
  120. package/dist/index-Dfujq78k.js +3 -0
  121. package/dist/index-TQPJgovl.mjs +1263 -0
  122. package/dist/index-ZvQrVWzu.js +1 -0
  123. package/dist/index.d.ts +1 -0
  124. package/dist/plugin/applianceMultiPlugin.d.ts +2 -3
  125. package/dist/plugin/applianceSinglePlugin.d.ts +3 -4
  126. package/dist/plugin/baseApplianceManager.d.ts +58 -13
  127. package/dist/plugin/baseViewContainerManager.d.ts +72 -73
  128. package/dist/plugin/const.d.ts +2 -22
  129. package/dist/plugin/displayerView.d.ts +18 -4
  130. package/dist/plugin/index.d.ts +1 -0
  131. package/dist/plugin/multi/applianceMultiManager.d.ts +0 -1
  132. package/dist/plugin/multi/containerManager.d.ts +8 -1
  133. package/dist/plugin/multi/displayer/appViewDisplayerManager.d.ts +3 -2
  134. package/dist/plugin/multi/displayer/mainViewDisplayerManager.d.ts +4 -2
  135. package/dist/plugin/single/displayer/mainViewDisplayerManager.d.ts +4 -3
  136. package/dist/plugin/types.d.ts +393 -32
  137. package/dist/style.css +1 -1
  138. package/dist/subWorker.js +242 -195
  139. package/dist/svgToImageLoader-DPRAAhwW.js +1 -0
  140. package/dist/svgToImageLoader-mXH53h-l.mjs +18 -0
  141. package/dist/undo/index.d.ts +25 -31
  142. package/dist/undo/proxyArray.d.ts +37 -0
  143. package/package.json +31 -9
  144. package/cdn/fullWorker-DMz46H.js +0 -439
  145. package/cdn/subWorker-B_zAQR.js +0 -439
  146. package/dist/collector/eventCollector.d.ts +0 -31
  147. package/dist/collector/magixEventCollector.d.ts +0 -31
  148. package/dist/core/mainThread/workerMainThread.d.ts +0 -99
  149. package/dist/core/msgEvent/deleteNode/forMainThread.d.ts +0 -6
  150. package/dist/core/msgEvent/deleteNode/forWorker.d.ts +0 -6
  151. package/dist/index-B-Nowr4E.mjs +0 -14865
  152. package/dist/index-BDVvqw7g.js +0 -1
  153. package/dist/index-DwakKeHT.mjs +0 -2497
  154. package/dist/index-cRE5FY5s.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { IWorkerMessage, IRectType, IUpdateNodeOpt } from "../types";
2
- import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
2
+ import { EDataType, EPostMessageType, EScaleType, EToolsKey, EventWorkState } from "../enum";
3
3
  import { Point2d } from "../utils/primitives/Point2d";
4
- import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
4
+ import { BaseConsumeResultType, BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
5
5
  import { VNodeManager } from "../vNodeManager";
6
6
  import { EStrokeType, SpeechBalloonPlacement } from "../../plugin/types";
7
7
  import { ShapeNodes } from "./utils";
@@ -14,7 +14,7 @@ export interface SpeechBalloonOptions extends BaseShapeOptions {
14
14
  }
15
15
  export declare class SpeechBalloonShape extends BaseShapeTool {
16
16
  readonly canRotate: boolean;
17
- readonly scaleType: EScaleType;
17
+ scaleType: EScaleType;
18
18
  readonly toolsType: EToolsKey;
19
19
  readonly ratio: number;
20
20
  protected tmpPoints: Array<Point2d>;
@@ -28,29 +28,16 @@ export declare class SpeechBalloonShape extends BaseShapeTool {
28
28
  isClearAll?: boolean;
29
29
  isSubWorker?: boolean;
30
30
  isMainThread?: boolean;
31
- }): {
32
- type: EPostMessageType;
33
- } | {
34
- workId: string;
35
- toolsType: EToolsKey;
36
- opt: import("./utils").ShapeOptions;
37
- type: EPostMessageType;
38
- dataType: EDataType;
39
- op: number[];
40
- isSync: boolean;
41
- index: number;
42
- } | {
43
- workId: string;
44
- toolsType: EToolsKey;
45
- opt: import("./utils").ShapeOptions;
46
- rect: IRectType | undefined;
47
- type: EPostMessageType;
48
- dataType: EDataType;
49
- };
31
+ smoothSync?: boolean;
32
+ isSimpleWorker?: boolean;
33
+ }): BaseConsumeResultType;
50
34
  consumeAll(): {
51
35
  type: EPostMessageType;
52
36
  removeIds: string[];
53
37
  } | {
38
+ updateNodeOpt: {
39
+ useAnimation: boolean;
40
+ };
54
41
  workId: string;
55
42
  toolsType: EToolsKey;
56
43
  opt: import("./utils").ShapeOptions;
@@ -68,6 +55,7 @@ export declare class SpeechBalloonShape extends BaseShapeTool {
68
55
  consumeService(props: {
69
56
  op: number[];
70
57
  isFullWork: boolean;
58
+ workState?: EventWorkState;
71
59
  }): IRectType | undefined;
72
60
  clearTmpPoints(): void;
73
61
  static updateNodeOpt(param: {
@@ -1,7 +1,7 @@
1
1
  import { IWorkerMessage, IRectType, IUpdateNodeOpt } from "../types";
2
- import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
2
+ import { EDataType, EPostMessageType, EScaleType, EToolsKey, EventWorkState } from "../enum";
3
3
  import { Point2d } from "../utils/primitives/Point2d";
4
- import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
4
+ import { BaseConsumeResultType, BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
5
5
  import { VNodeManager } from "../vNodeManager";
6
6
  import { ShapeNodes } from "./utils";
7
7
  import { EStrokeType } from "../../plugin/types";
@@ -16,7 +16,7 @@ export interface StarOptions extends BaseShapeOptions {
16
16
  }
17
17
  export declare class StarShape extends BaseShapeTool {
18
18
  readonly canRotate: boolean;
19
- readonly scaleType: EScaleType;
19
+ scaleType: EScaleType;
20
20
  readonly toolsType: EToolsKey;
21
21
  protected tmpPoints: Array<Point2d>;
22
22
  protected workOptions: StarOptions;
@@ -28,29 +28,16 @@ export declare class StarShape extends BaseShapeTool {
28
28
  isFullWork?: boolean;
29
29
  isSubWorker?: boolean;
30
30
  isMainThread?: boolean;
31
- }): {
32
- type: EPostMessageType;
33
- } | {
34
- workId: string;
35
- toolsType: EToolsKey;
36
- opt: import("./utils").ShapeOptions;
37
- type: EPostMessageType;
38
- dataType: EDataType;
39
- op: number[];
40
- isSync: boolean;
41
- index: number;
42
- } | {
43
- workId: string;
44
- toolsType: EToolsKey;
45
- opt: import("./utils").ShapeOptions;
46
- rect: IRectType | undefined;
47
- type: EPostMessageType;
48
- dataType: EDataType;
49
- };
31
+ smoothSync?: boolean;
32
+ isSimpleWorker?: boolean;
33
+ }): BaseConsumeResultType;
50
34
  consumeAll(): {
51
35
  type: EPostMessageType;
52
36
  removeIds: string[];
53
37
  } | {
38
+ updateNodeOpt: {
39
+ useAnimation: boolean;
40
+ };
54
41
  workId: string;
55
42
  toolsType: EToolsKey;
56
43
  opt: import("./utils").ShapeOptions;
@@ -67,6 +54,7 @@ export declare class StarShape extends BaseShapeTool {
67
54
  consumeService(props: {
68
55
  op: number[];
69
56
  isFullWork: boolean;
57
+ workState?: EventWorkState;
70
58
  }): IRectType | undefined;
71
59
  clearTmpPoints(): void;
72
60
  static updateNodeOpt(param: {
@@ -1,7 +1,7 @@
1
1
  import { IWorkerMessage, IRectType, IUpdateNodeOpt } from "../types";
2
- import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
2
+ import { EDataType, EPostMessageType, EScaleType, EToolsKey, EventWorkState } from "../enum";
3
3
  import { Point2d } from "../utils/primitives/Point2d";
4
- import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
4
+ import { BaseConsumeResultType, BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
5
5
  import { VNodeManager } from "../vNodeManager";
6
6
  import { ShapeNodes } from "./utils";
7
7
  import { EStrokeType } from "../../plugin/types";
@@ -12,7 +12,7 @@ export interface StraightOptions extends BaseShapeOptions {
12
12
  }
13
13
  export declare class StraightShape extends BaseShapeTool {
14
14
  readonly canRotate: boolean;
15
- readonly scaleType: EScaleType;
15
+ scaleType: EScaleType;
16
16
  readonly toolsType: EToolsKey;
17
17
  protected tmpPoints: Array<Point2d>;
18
18
  protected workOptions: StraightOptions;
@@ -26,29 +26,16 @@ export declare class StraightShape extends BaseShapeTool {
26
26
  isClearAll?: boolean;
27
27
  isSubWorker?: boolean;
28
28
  isMainThread?: boolean;
29
- }): {
30
- type: EPostMessageType;
31
- } | {
32
- workId: string;
33
- toolsType: EToolsKey;
34
- opt: import("./utils").ShapeOptions;
35
- type: EPostMessageType;
36
- dataType: EDataType;
37
- op: number[];
38
- isSync: boolean;
39
- index: number;
40
- } | {
41
- workId: string;
42
- toolsType: EToolsKey;
43
- opt: import("./utils").ShapeOptions;
44
- rect: IRectType | undefined;
45
- type: EPostMessageType;
46
- dataType: EDataType;
47
- };
29
+ smoothSync?: boolean;
30
+ isSimpleWorker?: boolean;
31
+ }): BaseConsumeResultType;
48
32
  consumeAll(): {
49
33
  type: EPostMessageType;
50
34
  removeIds: string[];
51
35
  } | {
36
+ updateNodeOpt: {
37
+ useAnimation: boolean;
38
+ };
52
39
  workId: string;
53
40
  toolsType: EToolsKey;
54
41
  opt: import("./utils").ShapeOptions;
@@ -67,6 +54,7 @@ export declare class StraightShape extends BaseShapeTool {
67
54
  consumeService(props: {
68
55
  op: number[];
69
56
  isFullWork: boolean;
57
+ workState?: EventWorkState;
70
58
  }): IRectType | undefined;
71
59
  clearTmpPoints(): void;
72
60
  static updateNodeOpt(param: {
@@ -28,9 +28,10 @@ export declare class TextShape extends BaseShapeTool {
28
28
  isFullWork: boolean;
29
29
  replaceId?: string;
30
30
  isDrawLabel?: boolean;
31
+ boxRect?: IRectType;
31
32
  }): Promise<IRectType | undefined>;
32
33
  updataOptService(): IRectType | undefined;
33
- updataOptServiceAsync(updateNodeOpt: IUpdateNodeOpt, isDrawLabel?: boolean): Promise<IRectType | undefined>;
34
+ updataOptServiceAsync(updateNodeOpt: IUpdateNodeOpt, isDrawLabel?: boolean, boxRect?: IRectType): Promise<IRectType | undefined>;
34
35
  clearTmpPoints(): void;
35
36
  static getSafetySnippetRatio(layer: Group): number;
36
37
  static getSafetySnippetFontLength(fontSize: number): number;
@@ -1,6 +1,6 @@
1
1
  import { EPostMessageType, EToolsKey } from "../enum";
2
- import { IRectType } from "../types";
3
- import type { Ellipse, Group, Label, Path, Polyline, Rect, Sprite } from "spritejs";
2
+ import { IRectType, ISVGOptions } from "../types";
3
+ import type { Ellipse, Group, Label, Path, Polyline, Rect, Sprite, SpriteSvg } from "spritejs";
4
4
  import { PencilOptions, PencilShape } from "./pencil";
5
5
  import { LaserPenOptions, LaserPenShape } from "./laserPen";
6
6
  import { EraserOptions, EraserShape } from "./eraser";
@@ -18,23 +18,22 @@ import { TextOptions } from "../../component/textEditor";
18
18
  import { ImageOptions, ImageShape } from "./image";
19
19
  import type { ServiceWorkForFullWorker } from "../worker/fullWorkerService";
20
20
  import type { SubServiceThread } from "../mainThread/subServiceThread";
21
- import { BaseShapeTool } from "./base";
21
+ import { BaseShapeOptions, BaseShapeTool } from "./base";
22
22
  import { PencilEraserOptions, PencilEraserShape } from "./pencilEraser";
23
23
  import { BitMapEraserOptions, BitMapEraserShape } from "./pencilEraserBitMap";
24
- export type ShapeTools = typeof PencilShape | typeof LaserPenShape | typeof PencilEraserShape | typeof BitMapEraserShape | typeof EraserShape | typeof StarShape | typeof SelectorShape | typeof ArrowShape | typeof EllipseShape | typeof RectangleShape | typeof StarShape | typeof PolygonShape | typeof TextShape | typeof SpeechBalloonShape | typeof ImageShape;
25
- export type ShapeToolsClass = BaseShapeTool | PencilShape | LaserPenShape | PencilEraserShape | BitMapEraserShape | EraserShape | StarShape | SelectorShape | ArrowShape | EllipseShape | RectangleShape | StarShape | PolygonShape | TextShape | SpeechBalloonShape | ImageShape;
26
- export type ShapeOptions = PencilOptions | LaserPenOptions | PencilEraserOptions | BitMapEraserOptions | EraserOptions | StarOptions | SelectorOptions | ArrowOptions | EllipseOptions | RectangleOptions | StarOptions | PolygonOptions | StraightOptions | TextOptions | SpeechBalloonOptions | ImageOptions;
27
- export type ShapeNodes = Group | Path | Polyline | Rect | Ellipse | Sprite | Label;
24
+ import { ISvgShadowShape } from "./shadowSvg";
25
+ export type ShapeTools = typeof PencilShape | typeof LaserPenShape | typeof PencilEraserShape | typeof BitMapEraserShape | typeof EraserShape | typeof StarShape | typeof SelectorShape | typeof ArrowShape | typeof EllipseShape | typeof RectangleShape | typeof StarShape | typeof PolygonShape | typeof TextShape | typeof SpeechBalloonShape | typeof ImageShape | typeof ISvgShadowShape;
26
+ export type ShapeToolsClass = BaseShapeTool | PencilShape | LaserPenShape | PencilEraserShape | BitMapEraserShape | EraserShape | StarShape | SelectorShape | ArrowShape | EllipseShape | RectangleShape | StarShape | PolygonShape | TextShape | SpeechBalloonShape | ImageShape | ISvgShadowShape;
27
+ export type ShapeOptions = PencilOptions | LaserPenOptions | PencilEraserOptions | BitMapEraserOptions | EraserOptions | StarOptions | SelectorOptions | ArrowOptions | EllipseOptions | RectangleOptions | StarOptions | PolygonOptions | StraightOptions | TextOptions | SpeechBalloonOptions | ImageOptions | ISVGOptions;
28
+ export type ShapeNodes = Group | Path | Polyline | Rect | Ellipse | Sprite | Label | SpriteSvg;
28
29
  export type ServiceThreadSubWork = SubServiceThread | ServiceWorkForFullWorker;
30
+ export type ShapeOptionsType<E extends BaseShapeOptions> = E;
29
31
  export interface CombineConsumeResult {
30
32
  type: EPostMessageType;
31
33
  rect: IRectType | undefined;
32
34
  consumeIndex: number;
33
35
  }
34
- export interface ShapeStateInfo {
35
- willClear: boolean;
36
- }
37
- export declare function getShapeTools(toolsType: EToolsKey): typeof PencilShape | typeof LaserPenShape | typeof EraserShape | typeof StarShape | typeof TextShape | typeof ArrowShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof BitMapEraserShape | typeof PencilEraserShape | typeof SelectorShape | typeof ImageShape | undefined;
36
+ export declare function getShapeTools(toolsType: EToolsKey): typeof ArrowShape | typeof PencilShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof StarShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof TextShape | typeof LaserPenShape | typeof EraserShape | typeof PencilEraserShape | typeof BitMapEraserShape | typeof SelectorShape | typeof ImageShape | typeof ISvgShadowShape | undefined;
38
37
  export declare function getShapeInstance(param: {
39
38
  workId: string;
40
39
  toolsType: EToolsKey;
@@ -42,5 +41,5 @@ export declare function getShapeInstance(param: {
42
41
  vNodes?: VNodeManager;
43
42
  fullLayer: Group;
44
43
  drawLayer?: Group;
45
- }, serviceWork?: ServiceThreadSubWork): PencilShape | LaserPenShape | EraserShape | StarShape | TextShape | SelectorShape | ImageShape | ArrowShape | StraightShape | EllipseShape | PolygonShape | RectangleShape | SpeechBalloonShape | BitMapEraserShape | PencilEraserShape | undefined;
44
+ }, serviceWork?: ServiceThreadSubWork): ArrowShape | PencilShape | StraightShape | EllipseShape | PolygonShape | StarShape | RectangleShape | SpeechBalloonShape | TextShape | LaserPenShape | EraserShape | PencilEraserShape | BitMapEraserShape | SelectorShape | ImageShape | ISvgShadowShape | undefined;
46
45
  export declare function findShapeBody(nodes: ShapeNodes[]): ShapeNodes[];
@@ -1,11 +1,12 @@
1
- import { BaseCollectorReducerAction, INormalPushMsg, ISerializableStorageData } from '../collector/types';
2
- import { ETextEditorType, FontStyleType, FontWeightType, TextOptions } from '../component/textEditor/types';
3
- import { EmitEventType } from '../plugin/types';
4
- import { type ECanvasContextType, ECanvasShowType, EDataType, EPostMessageType, EScaleType, EToolsKey, ElayerType, EvevtWorkState } from './enum';
5
- import { BaseShapeOptions, BaseShapeTool, ShapeOptions } from './tools';
6
- import type { SelectorShape } from './tools';
1
+ import type { BaseCollectorReducerAction, INormalPushMsg, ISerializableStorageData } from "../collector/types";
2
+ import type { ETextEditorType, FontStyleType, FontWeightType, TextOptions } from "../component/textEditor/types";
3
+ import type { EmitEventType } from "../plugin/types";
4
+ import type { ECanvasContextType, ECanvasShowType, EDataType, EPostMessageType, ESVGType, EScaleType, EToolsKey, ElayerType, EventWorkState } from "./enum";
5
+ import type { BaseShapeOptions, BaseShapeTool, ShapeOptions } from "./tools";
6
+ import type { SelectorShape } from "./tools";
7
7
  import type { Direction } from "re-resizable/lib/resizer";
8
- import { ShapeOptType } from '../displayer/types';
8
+ import type { ShapeOptType } from "../displayer/types";
9
+ import type { AutoShapeResult } from "./autoShape/types";
9
10
  export type PickOne<T> = {
10
11
  [P in keyof T]: Record<P, T[P]> & Partial<Record<Exclude<keyof T, P>, undefined>>;
11
12
  }[keyof T];
@@ -17,6 +18,11 @@ export type ViewWorkerOptions = {
17
18
  dpr: number;
18
19
  originalPoint: [number, number];
19
20
  cameraOpt: ICameraOpt;
21
+ transferOffscreenCanvas?: {
22
+ bgCanvas: OffscreenCanvas;
23
+ serviceCanvas: OffscreenCanvas;
24
+ localCanvas: OffscreenCanvas;
25
+ };
20
26
  };
21
27
  export interface ICanvasSceneType {
22
28
  /** canvas 上下文 */
@@ -41,12 +47,15 @@ export interface IOffscreenCanvasOptionType {
41
47
  [key: string]: any;
42
48
  }
43
49
  export interface ILayerOptionType {
50
+ canvas?: OffscreenCanvas;
44
51
  offscreen?: boolean;
45
52
  handleEvent?: boolean;
46
53
  depth?: boolean;
47
54
  width: number;
48
55
  height: number;
49
56
  bufferSize?: number;
57
+ contextType?: ECanvasContextType;
58
+ [key: string]: any;
50
59
  }
51
60
  export interface IUpdateNodeOpt {
52
61
  scale?: [number, number];
@@ -65,9 +74,10 @@ export interface IUpdateNodeOpt {
65
74
  fontBgColor?: string;
66
75
  isOpacity?: boolean;
67
76
  pos?: [number, number];
68
- workState?: EvevtWorkState;
77
+ workState?: EventWorkState;
69
78
  useAnimation?: boolean;
70
79
  zIndex?: number;
80
+ zIndexForBackgroundSVG?: number;
71
81
  zIndexLayer?: ElayerType;
72
82
  originPos?: [number, number];
73
83
  ops?: string;
@@ -84,14 +94,16 @@ export interface IUpdateNodeOpt {
84
94
  isLocked?: boolean;
85
95
  toolsType?: EToolsKey;
86
96
  willRefresh?: boolean;
97
+ /** 最新操作用户 */
98
+ uid?: string;
87
99
  [key: string]: any;
88
100
  }
89
- export type IWorkerMessage = Omit<Partial<BaseCollectorReducerAction>, 'op'> & {
101
+ export type IWorkerMessage = Omit<Partial<BaseCollectorReducerAction>, "op"> & {
90
102
  viewId: string;
91
103
  msgType: EPostMessageType;
92
104
  dataType: EDataType;
93
105
  scenePath?: string;
94
- workState?: EvevtWorkState;
106
+ workState?: EventWorkState;
95
107
  op?: number[];
96
108
  offscreenCanvasOpt?: IOffscreenCanvasOptionType;
97
109
  dpr?: number;
@@ -107,7 +119,6 @@ export type IWorkerMessage = Omit<Partial<BaseCollectorReducerAction>, 'op'> & {
107
119
  currentToolsData?: IActiveToolsDataType;
108
120
  updateNodeOpt?: IUpdateNodeOpt;
109
121
  layerOpt?: ILayerOptionType;
110
- drawCount?: number;
111
122
  useAnimation?: boolean;
112
123
  willRefreshSelector?: boolean;
113
124
  willSyncService?: boolean;
@@ -126,6 +137,29 @@ export type IWorkerMessage = Omit<Partial<BaseCollectorReducerAction>, 'op'> & {
126
137
  textUpdateForWoker?: boolean;
127
138
  tasksqueue?: Map<string, IWorkerMessage>;
128
139
  point?: [number, number];
140
+ disableEraseImage?: boolean;
141
+ disableEraseText?: boolean;
142
+ maxCombineEraserTime?: number;
143
+ /** 平滑同步 */
144
+ smoothSync?: boolean;
145
+ /** 是否使用单一worker模式 */
146
+ isUseSimple?: boolean;
147
+ /** 离屏canvas */
148
+ offscreenCanvas?: {
149
+ localCanvas: OffscreenCanvas;
150
+ bgCanvas: OffscreenCanvas;
151
+ serviceCanvas: OffscreenCanvas;
152
+ };
153
+ /** 字体库 */
154
+ fontBuffers?: {
155
+ fontFamily: string;
156
+ buffer: ArrayBuffer;
157
+ }[];
158
+ isRunBackgroundThread?: boolean;
159
+ /** 直接提交 FullWork 时,清理本地铅笔预览层 */
160
+ clearPreviewLocalWork?: boolean;
161
+ /** auto-shape 的识别结果,仅用于内部调试/日志 */
162
+ autoShapeResult?: AutoShapeResult;
129
163
  [key: string]: any;
130
164
  };
131
165
  export interface IRectType {
@@ -145,7 +179,6 @@ export interface IMainMessage extends INormalPushMsg {
145
179
  removeIds?: Array<string>;
146
180
  /** 是否是完整的一次任务 */
147
181
  isFullWork?: boolean;
148
- drawCount?: number;
149
182
  selectIds?: Array<string>;
150
183
  padding?: number;
151
184
  selectRect?: IRectType;
@@ -164,7 +197,7 @@ export interface IMainMessage extends INormalPushMsg {
164
197
  scenePath?: string;
165
198
  canvasWidth?: number;
166
199
  canvasHeight?: number;
167
- workState?: EvevtWorkState;
200
+ workState?: EventWorkState;
168
201
  canTextEdit?: boolean;
169
202
  canRotate?: boolean;
170
203
  canLock?: boolean;
@@ -179,6 +212,10 @@ export interface IMainMessage extends INormalPushMsg {
179
212
  toolsTypes?: EToolsKey[];
180
213
  isLockSentEventCursor?: boolean;
181
214
  nextTasks?: IMainMessage[];
215
+ setFontFaceResult?: boolean;
216
+ needUndoTicker?: number;
217
+ clearPreviewLocalWork?: boolean;
218
+ autoShapeResult?: AutoShapeResult;
182
219
  [key: string]: any;
183
220
  }
184
221
  export interface IMainMessageRenderData {
@@ -205,10 +242,12 @@ export interface IBatchMainMessage {
205
242
  render?: Array<IMainMessageRenderData>;
206
243
  /** 同步服务端数据 */
207
244
  sp?: Array<IMainMessage>;
208
- drawCount?: number;
209
245
  workerTasksqueueCount?: number;
210
246
  workIds?: Set<string>;
211
247
  viewId?: string;
248
+ consumeCount?: number;
249
+ subWorkerDrawCount?: number;
250
+ fullWorkerDrawCount?: number;
212
251
  }
213
252
  export interface ICameraOpt {
214
253
  centerX: number;
@@ -225,24 +264,32 @@ export interface IUpdateSelectorPropsType {
225
264
  emitEventType?: EmitEventType;
226
265
  isSync?: boolean;
227
266
  textUpdateForWoker?: boolean;
267
+ /** 平滑同步 */
268
+ smoothSync?: boolean;
269
+ /** 记录撤销重做id */
270
+ needUndoTicker?: number;
228
271
  }
229
272
  export interface IUpdateSelectorCallbackPropsType {
230
273
  res?: IMainMessage;
231
274
  param: IUpdateSelectorPropsType;
232
- postData: Pick<IBatchMainMessage, 'sp' | 'render'>;
275
+ postData: Pick<IBatchMainMessage, "sp" | "render">;
233
276
  workShapeNode: SelectorShape;
234
277
  newServiceStore: Map<string, {
235
278
  opt: BaseShapeOptions;
236
279
  toolsType: EToolsKey;
237
280
  ops?: string;
238
281
  }>;
282
+ /** 平滑同步 */
283
+ smoothSync?: boolean;
239
284
  }
240
285
  export interface IActiveToolsDataType {
241
286
  toolsType: EToolsKey;
242
287
  toolsOpt: ShapeOptions;
288
+ combineUnitTime?: number;
289
+ maxCombineEraserTime?: number;
243
290
  }
244
291
  export interface IActiveWorkDataType {
245
- workState: EvevtWorkState;
292
+ workState: EventWorkState;
246
293
  toolsOpt?: ShapeOptions;
247
294
  viewId?: string;
248
295
  workId?: IworkId;
@@ -264,6 +311,7 @@ export type IServiceWorkItem = {
264
311
  totalRect?: IRectType;
265
312
  isDiff?: boolean;
266
313
  imageBitmap?: ImageBitmap;
314
+ isEnableCursor?: boolean;
267
315
  };
268
316
  export type ILocalWorkItem = {
269
317
  toolsType: EToolsKey;
@@ -271,7 +319,7 @@ export type ILocalWorkItem = {
271
319
  data?: IWorkerMessage;
272
320
  result?: IMainMessage;
273
321
  totalRect?: IRectType;
274
- workState: EvevtWorkState;
322
+ workState: EventWorkState;
275
323
  isDel?: boolean;
276
324
  willRefresh?: boolean;
277
325
  };
@@ -286,7 +334,8 @@ export type BaseNodeMapItem = {
286
334
  scaleType: EScaleType;
287
335
  /** 是否被框选中,框选中的元素不能被其它人操作 */
288
336
  isSelected: boolean;
289
- eraserlines?: Map<string, Pick<BaseNodeMapItem, 'op' | 'opt'>>;
337
+ /** 是否是影子模型,影子模型不会被绘制 */
338
+ isShadow?: boolean;
290
339
  };
291
340
  export type Size = {
292
341
  /**
@@ -308,3 +357,34 @@ export type Rectangle = Size & {
308
357
  */
309
358
  originY: number;
310
359
  };
360
+ export interface ISVGBaseOptions extends BaseShapeOptions {
361
+ /** 图片的唯一识别符 */
362
+ uuid: string;
363
+ /** 图片中点在世界坐标系中的 x 坐标 */
364
+ centerX: number;
365
+ /** 图片中点在世界坐标系中的 y 坐标 */
366
+ centerY: number;
367
+ /** 图片中点在世界坐标系中的宽 */
368
+ width: number;
369
+ /** 图片中点在世界坐标系中的高 */
370
+ height: number;
371
+ /** 图片是否被锁定 */
372
+ locked: boolean;
373
+ /** 图片是否禁止非等比放缩 */
374
+ uniformScale: boolean;
375
+ /** 内部 状态数据 */
376
+ state?: unknown;
377
+ }
378
+ export interface ISVGUrlOptions extends ISVGBaseOptions {
379
+ type: ESVGType.url;
380
+ /** svg 源 url, 必须为 http 或 https 协议 */
381
+ src: string;
382
+ /** 是否以跨域方式加载图片 */
383
+ crossOrigin: boolean | string;
384
+ }
385
+ export interface ISVGMarkmapOptions extends ISVGBaseOptions {
386
+ type: ESVGType.markmap;
387
+ /** markdown 数据 tostring */
388
+ data: string;
389
+ }
390
+ export type ISVGOptions = ISVGUrlOptions | ISVGMarkmapOptions;
@@ -0,0 +1,19 @@
1
+ export type ObserverCallback<K, V> = (operation: "add" | "delete" | "update" | "clear", key: K, value?: V) => void;
2
+ export declare class ObserverMap<K extends string | number | symbol, V> {
3
+ private _map;
4
+ private _observers;
5
+ constructor(entries?: readonly (readonly [K, V])[] | null);
6
+ private notifyObservers;
7
+ observe(callback: ObserverCallback<K, V>): void;
8
+ unobserve(callback: ObserverCallback<K, V>): void;
9
+ get(key: K): V | undefined;
10
+ set(key: K, value: V, notify?: boolean): this;
11
+ has(key: K): boolean;
12
+ delete(key: K, notify?: boolean): boolean;
13
+ clear(notify?: boolean): void;
14
+ get size(): number;
15
+ keys(): IterableIterator<K>;
16
+ values(): IterableIterator<V>;
17
+ entries(): IterableIterator<[K, V]>;
18
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
19
+ }
@@ -0,0 +1,8 @@
1
+ import { Point2d } from "./primitives/Point2d";
2
+ /**
3
+ * 折线减去多个多边形,返回差集片段(去除冗余点、近似闭环、孤点)
4
+ * @param polyline 原始折线
5
+ * @param polygons 多个多边形数组
6
+ * @param epsilon 精度阈值
7
+ */
8
+ export declare function polylineMinusPolygon(polyline: Point2d[], polygons: [number, number][][], epsilon?: number): [number, number, number][][];
@@ -1,4 +1,4 @@
1
- import { PointLike } from './primitives/Point2d';
1
+ import { PointLike } from "./primitives/Point2d";
2
2
  /**
3
3
  * Turn an array of points into a path of quadradic curves.
4
4
  *
@@ -1,7 +1,7 @@
1
- import { EMatrixrRelationType } from '../enum';
2
- import { IRectType } from '../types';
3
- import { Box2d } from './primitives/Box2d';
4
- import { Vec2d, VecLike } from './primitives/Vec2d';
1
+ import { EMatrixrRelationType } from "../enum";
2
+ import { IRectType } from "../types";
3
+ import { Box2d } from "./primitives/Box2d";
4
+ import { Vec2d, VecLike } from "./primitives/Vec2d";
5
5
  export * from "./math";
6
6
  export * from "./spriteNode";
7
7
  /** @public */
@@ -362,7 +362,7 @@ export declare function toFixed(v: number): number;
362
362
  * @public
363
363
  */
364
364
  export declare const isSafeFloat: (n: number) => boolean;
365
- export declare const requestAsyncCallBack: (callBack: () => void, timeout: number) => Promise<void>;
365
+ export declare const requestAsyncCallBack: (callBack: () => void, timeout: number, isPolyfill?: boolean) => Promise<void>;
366
366
  export declare const getRatioWithContext: (context?: CanvasRenderingContext2D) => number;
367
367
  export declare const getRectMatrixrRelation: (rect: IRectType, BoxRect: IRectType) => EMatrixrRelationType;
368
368
  export declare function strlen(str: string): number;
@@ -372,3 +372,4 @@ export declare const getInSertRect: (rect: IRectType, boxRect: IRectType) => {
372
372
  w: number;
373
373
  h: number;
374
374
  } | undefined;
375
+ export declare function isMarkdown(data: string): boolean;
@@ -0,0 +1,17 @@
1
+ export declare class IndexDBUtils {
2
+ private static instance;
3
+ private fontDB?;
4
+ private readonly FONT_DB_NAME;
5
+ private readonly FONT_STORE_NAME;
6
+ private readonly FONT_DB_VERSION;
7
+ private constructor();
8
+ static getInstance(): IndexDBUtils;
9
+ initFontDB(): Promise<IDBDatabase>;
10
+ getFontFromDB(fontFamily: string): Promise<ArrayBuffer | null>;
11
+ saveFontToDB(fontFamily: string, url: string, buffer: ArrayBuffer): Promise<boolean>;
12
+ clearFontCache(): Promise<boolean>;
13
+ getFontCacheStatus(): Promise<{
14
+ count: number;
15
+ totalSize: number;
16
+ }>;
17
+ }
@@ -3,6 +3,7 @@ import { IRectType } from "../types";
3
3
  import { Point2d } from "./primitives/Point2d";
4
4
  import { Vec2d } from "./primitives/Vec2d";
5
5
  import type { Rectangle } from "../types";
6
+ export declare function getDprIntNumber(num: number, dpr: number): number;
6
7
  export declare function outerRect(rect: IRectType, offset: number): {
7
8
  x: number;
8
9
  y: number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 计算两条线段的交点
3
+ */
4
+ export declare function getIntersection(p1: [number, number], p2: [number, number], p3: [number, number], p4: [number, number]): [number, number] | null;
5
+ /**
6
+ * 判断点是否在多边形内
7
+ */
8
+ export declare function isPointInPolygon(point: [number, number], polygon: [number, number][]): boolean;
@@ -1,4 +1,4 @@
1
- import { Vec2d, VecLike } from './Vec2d';
1
+ import { Vec2d, VecLike } from "./Vec2d";
2
2
  /**
3
3
  * A serializable model for 2D boxes.
4
4
  *
@@ -10,13 +10,13 @@ export interface Box2dModel {
10
10
  h: number;
11
11
  }
12
12
  /** @public */
13
- export type SelectionEdge = 'top' | 'right' | 'bottom' | 'left';
13
+ export type SelectionEdge = "top" | "right" | "bottom" | "left";
14
14
  /** @public */
15
- export type SelectionCorner = 'top_left' | 'top_right' | 'bottom_right' | 'bottom_left';
15
+ export type SelectionCorner = "top_left" | "top_right" | "bottom_right" | "bottom_left";
16
16
  /** @public */
17
17
  export type SelectionHandle = SelectionEdge | SelectionCorner;
18
18
  /** @public */
19
- export type RotateCorner = 'top_left_rotate' | 'top_right_rotate' | 'bottom_right_rotate' | 'bottom_left_rotate' | 'mobile_rotate';
19
+ export type RotateCorner = "top_left_rotate" | "top_right_rotate" | "bottom_right_rotate" | "bottom_left_rotate" | "mobile_rotate";
20
20
  /** @public */
21
21
  export declare class Box2d {
22
22
  constructor(x?: number, y?: number, w?: number, h?: number);
@@ -1,4 +1,3 @@
1
- import { EDataType } from "../enum";
2
1
  export type InterceptorsType<T, K> = {
3
2
  get(key: T): K;
4
3
  set(key: T, value: K): void;
@@ -12,9 +11,9 @@ export declare class ProxyMap<T, K> {
12
11
  entries(...arg: any[]): any;
13
12
  forEach(...arg: any[]): any;
14
13
  size(): any;
15
- get(key: unknown): any;
16
- set(key: unknown, value: unknown): any;
17
- delete(key: unknown, _dataType?: EDataType): any;
14
+ get(key: any): any;
15
+ set(key: any, value: any): any;
16
+ delete(key: any): any;
18
17
  clear(): any;
19
18
  };
20
19
  createProxy(map: Map<T, K>): Map<T, K>;
@@ -1,2 +1,9 @@
1
- import { Group, Node, Path } from "spritejs";
1
+ import type { Group, Node, Path, Layer, Scene } from "spritejs";
2
+ import { ShapeNodes } from "../tools/utils";
3
+ import { IRectType } from "..";
2
4
  export declare const isSealedGroup: (group: Group | Path | Node) => boolean;
5
+ export declare const removeTexture: (node: any, layer: Layer) => void;
6
+ export declare const removeAllChildren: (group: Group, layer: Layer) => void;
7
+ export declare const replaceNode: (newNode: ShapeNodes, deleteNode: any, layer: Group) => void;
8
+ export declare const hideOriginNodes: (group: Group, layer: Layer) => void;
9
+ export declare const safariFixRect: (rect: IRectType, scene: Scene, dpr: number) => IRectType | undefined;