@netless/appliance-plugin 1.1.6-beta.0 → 1.1.7-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.
- package/README.md +60 -6
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-l-yx2w.js +439 -0
- package/cdn/subWorker-B_WP6U.js +439 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +16 -14
- package/dist/component/miniMap/manager.d.ts +1 -0
- package/dist/core/enum.d.ts +7 -1
- package/dist/core/mainEngine.d.ts +15 -3
- package/dist/core/mainThread/base.d.ts +3 -0
- package/dist/core/mainThread/snapshotThread.d.ts +3 -0
- package/dist/core/plugin.d.ts +47 -0
- package/dist/core/tools/image.d.ts +5 -3
- package/dist/core/worker/base.d.ts +9 -3
- package/dist/core/worker/fullWorkerLocal.d.ts +2 -1
- package/dist/fullWorker.js +112 -112
- package/dist/index-9cZB1Gyu.js +1 -0
- package/dist/index-B1RiN3Qs.js +1 -0
- package/dist/{index-DK7rOQ8d.mjs → index-BhSfbo3W.mjs} +3750 -3616
- package/dist/{index-f9cCJCDG.mjs → index-C0f2hrD6.mjs} +591 -506
- package/dist/plugin/baseApplianceManager.d.ts +5 -1
- package/dist/plugin/types.d.ts +46 -1
- package/dist/subWorker.js +112 -112
- package/package.json +4 -4
- package/cdn/fullWorker-Bn23ql.js +0 -439
- package/cdn/subWorker-BHGGPo.js +0 -439
- package/dist/index--nNSULzs.js +0 -1
- package/dist/index-Jd0URiCw.js +0 -1
package/dist/appliance-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-9cZB1Gyu.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.ECanvasShowType=e.ECanvasShowType;exports.EDataType=e.EDataType;exports.EImageType=e.EImageType;exports.EMatrixrRelationType=e.EMatrixrRelationType;exports.EOperationType=e.EOperationType;exports.EPostMessageType=e.EPostMessageType;exports.ERenderFilterType=e.ERenderFilterType;exports.EScaleType=e.EScaleType;exports.EStrokeType=e.EStrokeType;exports.EToolsKey=e.EToolsKey;exports.ElayerType=e.ElayerType;exports.EmitEventType=e.EmitEventType;exports.EventMessageType=e.EventMessageType;exports.EvevtWorkState=e.EvevtWorkState;exports.EvevtWorkType=e.EvevtWorkType;exports.InternalMsgEmitterType=e.InternalMsgEmitterType;exports.Plugin=e.Plugin;exports.ShapeType=e.ShapeType;exports.fullWorkerUrl=e.fullWorker;exports.subWorkerUrl=e.subWorker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as s, A as p, F as r, B as t, z as l, K as y, h as i, q as n, s as E, R as T, k as o, U as g, O as v, G as S, E as c, N as k, p as u, L as A, a as m, Q as M, I as P, P as W, H as h, x, y as I } from "./index-BhSfbo3W.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|
|
@@ -7,20 +7,22 @@ export {
|
|
|
7
7
|
l as ApplianceSinglePlugin,
|
|
8
8
|
y as ECanvasShowType,
|
|
9
9
|
i as EDataType,
|
|
10
|
-
n as
|
|
11
|
-
E as
|
|
12
|
-
T as
|
|
13
|
-
o as
|
|
10
|
+
n as EImageType,
|
|
11
|
+
E as EMatrixrRelationType,
|
|
12
|
+
T as EOperationType,
|
|
13
|
+
o as EPostMessageType,
|
|
14
|
+
g as ERenderFilterType,
|
|
14
15
|
v as EScaleType,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
S as EStrokeType,
|
|
17
|
+
c as EToolsKey,
|
|
18
|
+
k as ElayerType,
|
|
19
|
+
u as EmitEventType,
|
|
19
20
|
A as EventMessageType,
|
|
20
|
-
|
|
21
|
+
m as EvevtWorkState,
|
|
21
22
|
M as EvevtWorkType,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
P as InternalMsgEmitterType,
|
|
24
|
+
W as Plugin,
|
|
25
|
+
h as ShapeType,
|
|
26
|
+
x as fullWorkerUrl,
|
|
27
|
+
I as subWorkerUrl
|
|
26
28
|
};
|
|
@@ -22,6 +22,7 @@ export declare class MiniMapManagerImpl implements MiniMapManager {
|
|
|
22
22
|
readonly maps: Map<ViewId, MiniMapsState>;
|
|
23
23
|
private showId?;
|
|
24
24
|
private color;
|
|
25
|
+
private timer?;
|
|
25
26
|
constructor(props: BaseSubWorkModuleProps);
|
|
26
27
|
get listener(): EventEmitter2;
|
|
27
28
|
get activeViewId(): string | undefined;
|
package/dist/core/enum.d.ts
CHANGED
|
@@ -113,7 +113,9 @@ export declare enum EPostMessageType {
|
|
|
113
113
|
/** 授权可以删除笔记权限 */
|
|
114
114
|
AuthClear = 26,
|
|
115
115
|
/** 授权可以操作page权限 */
|
|
116
|
-
AuthPage = 27
|
|
116
|
+
AuthPage = 27,
|
|
117
|
+
/** 获取vNode信息 */
|
|
118
|
+
GetVNodeInfo = 28
|
|
117
119
|
}
|
|
118
120
|
export type ECanvasContextType = "webgl2" | "webgl" | "2d";
|
|
119
121
|
export declare enum ECanvasShowType {
|
|
@@ -195,3 +197,7 @@ export declare enum ERenderFilterType {
|
|
|
195
197
|
/** 设置可删除权限 */
|
|
196
198
|
setClear = "setClear"
|
|
197
199
|
}
|
|
200
|
+
export declare enum EImageType {
|
|
201
|
+
Image = "image",
|
|
202
|
+
Iconify = "iconify"
|
|
203
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import EventEmitter2 from "eventemitter2";
|
|
1
|
+
import type EventEmitter2 from "eventemitter2";
|
|
2
2
|
import { BaseCollectorReducerAction, DiffOneData } from "../collector";
|
|
3
3
|
import { BaseApplianceManager } from "../plugin/baseApplianceManager";
|
|
4
|
-
import { IActiveToolsDataType, IActiveWorkDataType, ICameraOpt, IMainMessage, IRectType, IUpdateNodeOpt, IWorkerMessage, IqueryTask, IworkId, ViewWorkerOptions } from "./types";
|
|
4
|
+
import { BaseNodeMapItem, IActiveToolsDataType, IActiveWorkDataType, ICameraOpt, IMainMessage, IRectType, IUpdateNodeOpt, IWorkerMessage, IqueryTask, IworkId, ViewWorkerOptions } from "./types";
|
|
5
5
|
import { BaseSubWorkModuleProps } from "../plugin/types";
|
|
6
|
-
import type { ImageInformation, PriorityType, _SetTrue } from "../plugin/types";
|
|
6
|
+
import type { IconifyInformation, ImageInformation, PriorityType, _SetTrue } from "../plugin/types";
|
|
7
7
|
import { MethodBuilderMain } from "./msgEvent";
|
|
8
8
|
import { EvevtWorkState } from "./enum";
|
|
9
9
|
import { BaseShapeOptions } from "./tools";
|
|
@@ -79,6 +79,9 @@ export declare abstract class MasterController {
|
|
|
79
79
|
/** 根据查询条件查询事件任务处理批量池中任务 */
|
|
80
80
|
abstract queryTaskBatchData(query: IqueryTask): IWorkerMessage[];
|
|
81
81
|
abstract insertImage(viewId: string, imageInfo: ImageInformation): void;
|
|
82
|
+
abstract insertIconify(viewId: string, iconifyInfo: IconifyInformation & {
|
|
83
|
+
strokeColor?: string;
|
|
84
|
+
}): void;
|
|
82
85
|
abstract lockImage(viewId: string, uuid: string, locked: boolean): void;
|
|
83
86
|
abstract completeImageUpload(viewId: string, uuid: string, src: string): void;
|
|
84
87
|
abstract getImagesInformation(scenePath: string): ImageInformation[];
|
|
@@ -132,6 +135,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
132
135
|
private willSelectorWorkId?;
|
|
133
136
|
private isLockSentEventCursor;
|
|
134
137
|
private subMainThreadWorker?;
|
|
138
|
+
private getVNodeInfoResolveMap;
|
|
135
139
|
constructor(props: BaseSubWorkModuleProps);
|
|
136
140
|
destroy(): void;
|
|
137
141
|
private get viewContainerManager();
|
|
@@ -203,12 +207,16 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
203
207
|
private setZIndex;
|
|
204
208
|
checkDrawingWork(vId: string): void;
|
|
205
209
|
removeDrawingWork(vId: string): void;
|
|
210
|
+
removeNodes(viewId: string, removeIds: string[]): void;
|
|
206
211
|
hoverCursor(point: [number, number], viewId: string): void;
|
|
207
212
|
blurCursor(viewId: string): void;
|
|
208
213
|
sendCursorEvent(p: [number | undefined, number | undefined], viewId: string): void;
|
|
209
214
|
getBoundingRect(scenePath: string): Promise<IRectType> | undefined;
|
|
210
215
|
getSnapshot(scenePath: string, width?: number, height?: number, camera?: Pick<ICameraOpt, "centerX" | "centerY" | "scale">): Promise<ImageBitmap> | undefined;
|
|
211
216
|
queryTaskBatchData(query: IqueryTask): IWorkerMessage[];
|
|
217
|
+
insertIconify(viewId: string, iconifyInfo: IconifyInformation & {
|
|
218
|
+
strokeColor?: string;
|
|
219
|
+
}): void;
|
|
212
220
|
insertImage(viewId: string, imageInfo: ImageInformation): void;
|
|
213
221
|
lockImage(viewId: string, uuid: string, locked: boolean): void;
|
|
214
222
|
completeImageUpload(viewId: string, uuid: string, src: string): void;
|
|
@@ -218,4 +226,8 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
218
226
|
consoleWorkerInfo(): void;
|
|
219
227
|
setPriority(priority: PriorityType): void;
|
|
220
228
|
sendClearUids(viewId: string, clearUids?: _SetTrue): void;
|
|
229
|
+
getVNodeInfo(uuid: string, viewId: string, workIds: string[]): Promise<{
|
|
230
|
+
uuid: string;
|
|
231
|
+
vInfo?: BaseNodeMapItem[];
|
|
232
|
+
} | undefined>;
|
|
221
233
|
}
|
|
@@ -67,10 +67,13 @@ export declare class MainThreadEngineImpl implements MainThreadEngine {
|
|
|
67
67
|
private imageResolveMap;
|
|
68
68
|
constructor(viewId: string, opt: IMainThreadInitOption);
|
|
69
69
|
getCachedImages(imageSrc: string): ImageBitmap | undefined;
|
|
70
|
+
getCachedImagesByWorkId(workId: string): ImageBitmap | undefined;
|
|
71
|
+
deleteCachedImagesByWorkId(workId: string): void;
|
|
70
72
|
clearCacheImages(): void;
|
|
71
73
|
clearImageResolveMap(): void;
|
|
72
74
|
post(msg: Omit<IBatchMainMessage, 'render'>): void;
|
|
73
75
|
on(msg: IWorkerMessage): Promise<void>;
|
|
76
|
+
private getIconSize;
|
|
74
77
|
loadImageBitMap(msg: Pick<IWorkerMessage, 'toolsType' | 'opt' | 'workId'>): Promise<ImageBitmap | undefined>;
|
|
75
78
|
private removeNode;
|
|
76
79
|
consumeFull(type: EDataType, data: IWorkerMessage): Promise<void>;
|
|
@@ -18,10 +18,13 @@ export declare class SnapshotThreadImpl {
|
|
|
18
18
|
private imageResolveMap;
|
|
19
19
|
constructor(viewId: string, opt: IMainThreadInitOption);
|
|
20
20
|
getCachedImages(imageSrc: string): ImageBitmap | undefined;
|
|
21
|
+
getCachedImagesByWorkId(workId: string): ImageBitmap | undefined;
|
|
22
|
+
deleteCachedImagesByWorkId(workId: string): void;
|
|
21
23
|
clearCacheImages(): void;
|
|
22
24
|
clearImageResolveMap(): void;
|
|
23
25
|
post(msg: Omit<IBatchMainMessage, 'render'>): void;
|
|
24
26
|
on(msg: IWorkerMessage): Promise<void>;
|
|
27
|
+
private getIconSize;
|
|
25
28
|
loadImageBitMap(msg: Pick<IWorkerMessage, 'toolsType' | 'opt' | 'workId'>): Promise<ImageBitmap | undefined>;
|
|
26
29
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
27
30
|
workId: string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import EventEmitter2 from "eventemitter2";
|
|
2
|
+
import { ApplianceManagerLike, BaseSubWorkModuleProps } from "../plugin/types";
|
|
3
|
+
import { MasterControlForWorker } from "./mainEngine";
|
|
4
|
+
import { EToolsKey } from "../plugin";
|
|
5
|
+
export interface FloatBarOptions {
|
|
6
|
+
icon: string;
|
|
7
|
+
activeIcon: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 插件的监听器类型
|
|
12
|
+
*/
|
|
13
|
+
export type PluginListener = {
|
|
14
|
+
/** 设置教具类型 */
|
|
15
|
+
setToolkey: (data: EToolsKey) => void;
|
|
16
|
+
/** 同步笔记数据 */
|
|
17
|
+
syncStorage: (viewId: string, scenePath?: string) => void;
|
|
18
|
+
/** 改变场景 */
|
|
19
|
+
sceneChange: (viewId: string, scenePath: string) => void;
|
|
20
|
+
};
|
|
21
|
+
export type PluginEvent = keyof PluginListener;
|
|
22
|
+
export type PluginCallback<T extends PluginEvent> = PluginListener[T];
|
|
23
|
+
export type PluginParams<T extends PluginEvent> = Parameters<PluginListener[T]>;
|
|
24
|
+
export declare const plugin_map: Map<string, Plugin>;
|
|
25
|
+
export declare abstract class Plugin {
|
|
26
|
+
abstract readonly kind: string;
|
|
27
|
+
control: ApplianceManagerLike;
|
|
28
|
+
private _listeners;
|
|
29
|
+
abstract onDestroy(): void;
|
|
30
|
+
abstract onCreate(): void;
|
|
31
|
+
abstract mount(): void;
|
|
32
|
+
abstract unMount(): void;
|
|
33
|
+
_inject(applianceManager: ApplianceManagerLike): void;
|
|
34
|
+
_onEvent<T extends PluginEvent>(eventName: T, params: PluginParams<T>): void;
|
|
35
|
+
protected callbacks(eventName: PluginEvent, callback: PluginCallback<PluginEvent>): void;
|
|
36
|
+
protected removeCallback(eventName: PluginEvent): void;
|
|
37
|
+
}
|
|
38
|
+
export declare class PluginManager {
|
|
39
|
+
readonly control: ApplianceManagerLike;
|
|
40
|
+
readonly worker: MasterControlForWorker;
|
|
41
|
+
readonly publicMsgEmitter: EventEmitter2;
|
|
42
|
+
private plugins;
|
|
43
|
+
constructor(props: BaseSubWorkModuleProps);
|
|
44
|
+
use(plugin: Plugin): void;
|
|
45
|
+
destroy(): void;
|
|
46
|
+
dispatchPluginEvent(eventName: PluginEvent, ...data: PluginParams<PluginEvent>): void;
|
|
47
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRectType, IUpdateNodeOpt, BaseNodeMapItem } from "../types";
|
|
2
|
-
import { EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
2
|
+
import { EImageType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
3
3
|
import { Point2d } from "../utils/primitives/Point2d";
|
|
4
4
|
import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
|
|
5
5
|
import { VNodeManager } from "../vNodeManager";
|
|
@@ -10,6 +10,10 @@ import type { SnapshotThreadImpl } from "../mainThread/snapshotThread";
|
|
|
10
10
|
import type { SubServiceThreadImpl } from "../mainThread/subServiceThread";
|
|
11
11
|
import type { WorkThreadEngineForFullWorker, WorkThreadEngineForSubWorker } from "../worker/workerManager";
|
|
12
12
|
export interface ImageOptions extends BaseShapeOptions {
|
|
13
|
+
/** 图片地址 */
|
|
14
|
+
src: string;
|
|
15
|
+
/** 图片类型 */
|
|
16
|
+
type: EImageType;
|
|
13
17
|
/** 图片的唯一识别符 */
|
|
14
18
|
uuid: string;
|
|
15
19
|
/** 图片中点在世界坐标系中的 x 坐标 */
|
|
@@ -26,8 +30,6 @@ export interface ImageOptions extends BaseShapeOptions {
|
|
|
26
30
|
uniformScale?: boolean;
|
|
27
31
|
/** 是否以跨域方式加载图片 */
|
|
28
32
|
crossOrigin?: boolean | string;
|
|
29
|
-
/** 图片地址 */
|
|
30
|
-
src: string;
|
|
31
33
|
}
|
|
32
34
|
export declare class ImageShape extends BaseShapeTool {
|
|
33
35
|
readonly canRotate: boolean;
|
|
@@ -44,20 +44,26 @@ export declare abstract class WorkThreadEngineBase {
|
|
|
44
44
|
};
|
|
45
45
|
protected hasPriorityDraw: boolean;
|
|
46
46
|
protected delayPostDoneResolve?: (bol: boolean) => void;
|
|
47
|
-
protected cacheImages: Map<string,
|
|
47
|
+
protected cacheImages: Map<string, {
|
|
48
|
+
imageBitmap: ImageBitmap;
|
|
49
|
+
workId: string;
|
|
50
|
+
}>;
|
|
48
51
|
protected imageResolveMap: Map<string, {
|
|
49
52
|
timer?: number;
|
|
50
|
-
resolve?: (
|
|
53
|
+
resolve?: (src: string) => void;
|
|
51
54
|
}>;
|
|
52
55
|
constructor(viewId: string, opt: IWorkerInitOption, workerType: EWorkThreadType);
|
|
53
56
|
private createRenderLayer;
|
|
54
57
|
getCachedImages(imageSrc: string): ImageBitmap | undefined;
|
|
58
|
+
getCachedImagesByWorkId(workId: string): ImageBitmap | undefined;
|
|
59
|
+
deleteCachedImagesByWorkId(workId: string, filter?: string): void;
|
|
55
60
|
clearCacheImages(): void;
|
|
56
61
|
clearImageResolveMap(): void;
|
|
57
62
|
setHasPriorityDraw(bol: boolean): void;
|
|
58
63
|
getPriorityDraw(): boolean;
|
|
59
64
|
setIsSafari(isSafari: boolean): void;
|
|
60
65
|
on(msg: IWorkerMessage): Promise<void>;
|
|
66
|
+
private getIconSize;
|
|
61
67
|
loadImageBitMap(msg: Pick<IWorkerMessage, 'toolsType' | 'opt' | 'workId'>): Promise<ImageBitmap | undefined>;
|
|
62
68
|
protected createLocalWork(data: IWorkerMessage): void;
|
|
63
69
|
protected updateScene(offscreenCanvasOpt: IOffscreenCanvasOptionType): void;
|
|
@@ -100,7 +106,7 @@ export declare abstract class LocalWork {
|
|
|
100
106
|
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
101
107
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
102
108
|
workId: string;
|
|
103
|
-
}): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | import("../tools/text").TextShape | import("../tools").SelectorShape | import("../tools
|
|
109
|
+
}): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | import("../tools/text").TextShape | import("../tools").SelectorShape | import("../tools").ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools/pencilEraserBitMap").BitMapEraserShape | import("../tools/pencilEraser").PencilEraserShape | undefined;
|
|
104
110
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
105
111
|
getToolsOpt(): IActiveToolsDataType | undefined;
|
|
106
112
|
clearWorkShapeNodeCache(workId: string): void;
|
|
@@ -2,6 +2,7 @@ import { IWorkerMessage, IMainMessage, EToolsKey, IBatchMainMessage, IUpdateSele
|
|
|
2
2
|
import { BaseShapeOptions, SelectorShape } from "../tools";
|
|
3
3
|
import { ISubWorkerInitOption, LocalWork } from "./base";
|
|
4
4
|
import { ServiceWorkForFullWorker } from "./fullWorkerService";
|
|
5
|
+
import { WorkThreadEngineForFullWorker } from "./workerManager";
|
|
5
6
|
export declare class LocalWorkForFullWorker extends LocalWork {
|
|
6
7
|
private combineUnitTime;
|
|
7
8
|
private combineTimerId?;
|
|
@@ -18,7 +19,7 @@ export declare class LocalWorkForFullWorker extends LocalWork {
|
|
|
18
19
|
workShapesDone(scenePath: string, serviceWork: ServiceWorkForFullWorker): Promise<void>;
|
|
19
20
|
consumeFull(data: IWorkerMessage): Promise<void>;
|
|
20
21
|
private commandDeleteText;
|
|
21
|
-
removeSelector(data: IWorkerMessage): Promise<void>;
|
|
22
|
+
removeSelector(data: IWorkerMessage, workEngine?: WorkThreadEngineForFullWorker): Promise<void>;
|
|
22
23
|
removeWork(data: IWorkerMessage): Promise<void>;
|
|
23
24
|
private removeNode;
|
|
24
25
|
private _removeWork;
|