@netless/appliance-plugin 1.0.0-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 +138 -0
- package/cdn/appliance-plugin.js +1 -0
- package/cdn/appliance-plugin.mjs +8639 -0
- package/cdn/style.css +1 -0
- package/dist/appliance-plugin.js +1 -0
- package/dist/appliance-plugin.mjs +8639 -0
- package/dist/collector/base.d.ts +20 -0
- package/dist/collector/collector.d.ts +53 -0
- package/dist/collector/const.d.ts +3 -0
- package/dist/collector/enum.d.ts +13 -0
- package/dist/collector/eventCollector.d.ts +29 -0
- package/dist/collector/index.d.ts +4 -0
- package/dist/collector/types.d.ts +70 -0
- package/dist/collector/utils/color.d.ts +31 -0
- package/dist/collector/utils/index.d.ts +5 -0
- package/dist/component/textEditor/index.d.ts +2 -0
- package/dist/component/textEditor/manager.d.ts +120 -0
- package/dist/component/textEditor/types.d.ts +50 -0
- package/dist/component/textEditor/utils.d.ts +3 -0
- package/dist/component/textEditor/view.d.ts +68 -0
- package/dist/core/const.d.ts +1 -0
- package/dist/core/enum.d.ts +135 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/mainEngine.d.ts +163 -0
- package/dist/core/msgEvent/activeZIndex/forMain.d.ts +12 -0
- package/dist/core/msgEvent/activeZIndex/forWorker.d.ts +8 -0
- package/dist/core/msgEvent/base.d.ts +18 -0
- package/dist/core/msgEvent/baseForWorker.d.ts +13 -0
- package/dist/core/msgEvent/copyNode/forMain.d.ts +47 -0
- package/dist/core/msgEvent/copyNode/forWorker.d.ts +8 -0
- package/dist/core/msgEvent/deleteNode/forMain.d.ts +11 -0
- package/dist/core/msgEvent/deleteNode/forWorker.d.ts +13 -0
- package/dist/core/msgEvent/forWorker.d.ts +14 -0
- package/dist/core/msgEvent/index.d.ts +15 -0
- package/dist/core/msgEvent/rotateNode/forMain.d.ts +16 -0
- package/dist/core/msgEvent/rotateNode/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/scaleNode/forMain.d.ts +20 -0
- package/dist/core/msgEvent/scaleNode/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/setColor/forMain.d.ts +18 -0
- package/dist/core/msgEvent/setColor/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/setFont/forMain.d.ts +18 -0
- package/dist/core/msgEvent/setFont/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/setLock/forMain.d.ts +12 -0
- package/dist/core/msgEvent/setLock/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/setPoint/forMain.d.ts +15 -0
- package/dist/core/msgEvent/setPoint/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/setShape/forMain.d.ts +18 -0
- package/dist/core/msgEvent/setShape/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/setZIndex/forMain.d.ts +22 -0
- package/dist/core/msgEvent/setZIndex/forWorker.d.ts +9 -0
- package/dist/core/msgEvent/translateNode/forMain.d.ts +20 -0
- package/dist/core/msgEvent/translateNode/forWorker.d.ts +9 -0
- package/dist/core/tools/arrow.d.ts +46 -0
- package/dist/core/tools/base.d.ts +82 -0
- package/dist/core/tools/ellipse.d.ts +44 -0
- package/dist/core/tools/eraser.d.ts +41 -0
- package/dist/core/tools/image.d.ts +53 -0
- package/dist/core/tools/index.d.ts +13 -0
- package/dist/core/tools/laserPen.d.ts +42 -0
- package/dist/core/tools/pencil.d.ts +66 -0
- package/dist/core/tools/polygon.d.ts +45 -0
- package/dist/core/tools/rectangle.d.ts +46 -0
- package/dist/core/tools/selector.d.ts +83 -0
- package/dist/core/tools/speechBalloon.d.ts +49 -0
- package/dist/core/tools/star.d.ts +47 -0
- package/dist/core/tools/straight.d.ts +46 -0
- package/dist/core/tools/text.d.ts +42 -0
- package/dist/core/tools/utils.d.ts +39 -0
- package/dist/core/types.d.ts +295 -0
- package/dist/core/utils/bezier.d.ts +43 -0
- package/dist/core/utils/getSvgPathFromPoints.d.ts +10 -0
- package/dist/core/utils/index.d.ts +364 -0
- package/dist/core/utils/math.d.ts +57 -0
- package/dist/core/utils/primitives/Box2d.d.ts +100 -0
- package/dist/core/utils/primitives/Point2d.d.ts +71 -0
- package/dist/core/utils/primitives/Vec2d.d.ts +146 -0
- package/dist/core/utils/primitives/easings.d.ts +24 -0
- package/dist/core/utils/proxy.d.ts +21 -0
- package/dist/core/utils/spriteNode.d.ts +4 -0
- package/dist/core/worker/base.d.ts +103 -0
- package/dist/core/worker/fullWorker.d.ts +1 -0
- package/dist/core/worker/fullWorkerLocal.d.ts +46 -0
- package/dist/core/worker/fullWorkerService.d.ts +41 -0
- package/dist/core/worker/subWorker.d.ts +1 -0
- package/dist/core/worker/subWorkerLocal.d.ts +20 -0
- package/dist/core/worker/vNodeManager.d.ts +32 -0
- package/dist/core/worker/workerManager.d.ts +71 -0
- package/dist/cursors/index.d.ts +73 -0
- package/dist/displayer/const.d.ts +11 -0
- package/dist/displayer/cursor/index.d.ts +15 -0
- package/dist/displayer/floatBar/index.d.ts +10 -0
- package/dist/displayer/floatBtns/colors.d.ts +6 -0
- package/dist/displayer/floatBtns/del.d.ts +6 -0
- package/dist/displayer/floatBtns/duplicate.d.ts +5 -0
- package/dist/displayer/floatBtns/fontSize.d.ts +4 -0
- package/dist/displayer/floatBtns/fontStyle.d.ts +4 -0
- package/dist/displayer/floatBtns/index.d.ts +11 -0
- package/dist/displayer/floatBtns/layer.d.ts +3 -0
- package/dist/displayer/floatBtns/lock.d.ts +7 -0
- package/dist/displayer/floatBtns/shapeOpt.d.ts +3 -0
- package/dist/displayer/highlightBox/index.d.ts +5 -0
- package/dist/displayer/icons/index.d.ts +4 -0
- package/dist/displayer/resizable/index.d.ts +16 -0
- package/dist/displayer/rotate/index.d.ts +4 -0
- package/dist/displayer/types.d.ts +51 -0
- package/dist/hotkey/index.d.ts +51 -0
- package/dist/index.d.ts +1 -0
- package/dist/members/index.d.ts +15 -0
- package/dist/plugin/applianceMultiPlugin.d.ts +24 -0
- package/dist/plugin/applianceSinglePlugin.d.ts +28 -0
- package/dist/plugin/baseApplianceManager.d.ts +82 -0
- package/dist/plugin/baseViewContainerManager.d.ts +174 -0
- package/dist/plugin/displayerView.d.ts +55 -0
- package/dist/plugin/external.d.ts +2 -0
- package/dist/plugin/index.d.ts +6 -0
- package/dist/plugin/multi/applianceMultiManager.d.ts +14 -0
- package/dist/plugin/multi/containerManager.d.ts +24 -0
- package/dist/plugin/multi/displayer/appViewDisplayerManager.d.ts +24 -0
- package/dist/plugin/multi/displayer/mainViewDisplayerManager.d.ts +25 -0
- package/dist/plugin/single/applianceDisplayer.d.ts +16 -0
- package/dist/plugin/single/applianceSingleManager.d.ts +13 -0
- package/dist/plugin/single/containerManager.d.ts +11 -0
- package/dist/plugin/single/displayer/mainViewDisplayerManager.d.ts +25 -0
- package/dist/plugin/types.d.ts +310 -0
- package/dist/plugin/utils.d.ts +6 -0
- package/dist/style.css +1 -0
- package/dist/undo/index.d.ts +70 -0
- package/package.json +59 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import EventEmitter2 from "eventemitter2";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ApplianceMultiManager } from "../applianceMultiManager";
|
|
4
|
+
import { MainViewDisplayerManager } from "../../baseViewContainerManager";
|
|
5
|
+
import { BaseViewDisplayer } from "../../displayerView";
|
|
6
|
+
export declare class MainViewMultiDisplayerManager extends MainViewDisplayerManager {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
dpr: number;
|
|
10
|
+
vDom?: BaseViewDisplayer;
|
|
11
|
+
eventTragetElement?: HTMLDivElement;
|
|
12
|
+
canvasServiceFloatRef: React.RefObject<HTMLCanvasElement>;
|
|
13
|
+
canvasFloatRef: React.RefObject<HTMLCanvasElement>;
|
|
14
|
+
canvasBgRef: React.RefObject<HTMLCanvasElement>;
|
|
15
|
+
floatBarRef: React.RefObject<HTMLDivElement>;
|
|
16
|
+
floatBarCanvasRef: React.RefObject<HTMLCanvasElement>;
|
|
17
|
+
containerOffset: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
constructor(control: ApplianceMultiManager, internalMsgEmitter: EventEmitter2);
|
|
22
|
+
setCanvassStyle(): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
createMainViewDisplayer(mainViewContainer: HTMLDivElement): MainViewDisplayerManager;
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import EventEmitter2 from "eventemitter2";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
interface DisplayerProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface DisplayerState {
|
|
8
|
+
}
|
|
9
|
+
export declare class ApplianceSigleWrapper extends React.Component<DisplayerProps, DisplayerState> {
|
|
10
|
+
static emiter: EventEmitter2;
|
|
11
|
+
mainViewRef: HTMLDivElement | null;
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
componentWillUnmount(): void;
|
|
14
|
+
render(): ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import { BaseApplianceManager, BaseApplianceManagerProps } from "../baseApplianceManager";
|
|
3
|
+
import type { CameraState } from "../types";
|
|
4
|
+
import { ViewContainerSingleManager } from "./containerManager";
|
|
5
|
+
export declare class ApplianceSingleManager extends BaseApplianceManager {
|
|
6
|
+
viewContainerManager: ViewContainerSingleManager;
|
|
7
|
+
divMainView?: HTMLDivElement;
|
|
8
|
+
constructor(params: BaseApplianceManagerProps);
|
|
9
|
+
init(): void;
|
|
10
|
+
activePlugin(): void;
|
|
11
|
+
activeWorker(): void;
|
|
12
|
+
onCameraChange: import("lodash").DebouncedFunc<(cameraState: CameraState) => void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViewContainerManager, ViewInfo } from "../baseViewContainerManager";
|
|
2
|
+
import { ApplianceSingleManager } from "./applianceSingleManager";
|
|
3
|
+
import { BaseSubWorkModuleProps } from "../types";
|
|
4
|
+
export declare class ViewContainerSingleManager extends ViewContainerManager {
|
|
5
|
+
focuedViewId?: string;
|
|
6
|
+
control: ApplianceSingleManager;
|
|
7
|
+
focuedView?: ViewInfo;
|
|
8
|
+
constructor(props: BaseSubWorkModuleProps);
|
|
9
|
+
bindMainView(): void;
|
|
10
|
+
mountView(viewId: string): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import EventEmitter2 from "eventemitter2";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { MainViewDisplayerManager } from "../../baseViewContainerManager";
|
|
4
|
+
import { ApplianceSingleManager } from "../applianceSingleManager";
|
|
5
|
+
import { BaseViewDisplayer } from "../../displayerView";
|
|
6
|
+
export declare class MainViewSingleDisplayerManager extends MainViewDisplayerManager {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
dpr: number;
|
|
10
|
+
vDom?: BaseViewDisplayer;
|
|
11
|
+
viewId: string;
|
|
12
|
+
eventTragetElement?: HTMLDivElement;
|
|
13
|
+
canvasServiceFloatRef: React.RefObject<HTMLCanvasElement>;
|
|
14
|
+
canvasFloatRef: React.RefObject<HTMLCanvasElement>;
|
|
15
|
+
canvasBgRef: React.RefObject<HTMLCanvasElement>;
|
|
16
|
+
floatBarRef: React.RefObject<HTMLDivElement>;
|
|
17
|
+
floatBarCanvasRef: React.RefObject<HTMLCanvasElement>;
|
|
18
|
+
containerOffset: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
constructor(control: ApplianceSingleManager, internalMsgEmitter: EventEmitter2);
|
|
23
|
+
setCanvassStyle(): void;
|
|
24
|
+
createMainViewDisplayer(mainView: HTMLDivElement): MainViewDisplayerManager;
|
|
25
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { ISerializableEventData, ISerializableStorageViewData } from "../collector/types";
|
|
2
|
+
import type { Cursor, View, CameraState, DisplayerCallbacks, HotKeys, Player, Room, Point, RoomMember, RoomState, Size, Callbacks, Camera, Color, CursorAdapter, Displayer, ImageInformation, Rectangle, RenderEngine, MemberState as _MemberState } from "white-web-sdk";
|
|
3
|
+
import { ECanvasContextType } from "../core/enum";
|
|
4
|
+
import type EventEmitter2 from "eventemitter2";
|
|
5
|
+
import type { ApplianceSingleManager } from "./single/applianceSingleManager";
|
|
6
|
+
import type { ApplianceMultiManager, WindowManager } from "./multi/applianceMultiManager";
|
|
7
|
+
import type { BaseApplianceManager } from "./baseApplianceManager";
|
|
8
|
+
import type { AppViewDisplayerManager, MainViewDisplayerManager } from "./baseViewContainerManager";
|
|
9
|
+
import type { ApplianceSinglePlugin } from "./applianceSinglePlugin";
|
|
10
|
+
import type { ApplianceMultiPlugin } from "./applianceMultiPlugin";
|
|
11
|
+
export type { Room, ImageInformation, Point, Size, Rectangle, RoomMember, RoomState, Player, HotKeys, Camera, Displayer, DisplayerCallbacks, CameraState, View, Cursor, CursorAdapter, RenderEngine, _MemberState };
|
|
12
|
+
export declare enum ApplianceNames {
|
|
13
|
+
/**
|
|
14
|
+
* 选择工具
|
|
15
|
+
*/
|
|
16
|
+
selector = "selector",
|
|
17
|
+
/**
|
|
18
|
+
* 互动工具(无默认行为,可供 plugin 自定义)
|
|
19
|
+
*/
|
|
20
|
+
clicker = "clicker",
|
|
21
|
+
/**
|
|
22
|
+
* 激光笔
|
|
23
|
+
*/
|
|
24
|
+
laserPointer = "laserPointer",
|
|
25
|
+
/**
|
|
26
|
+
* 铅笔工具
|
|
27
|
+
*/
|
|
28
|
+
pencil = "pencil",
|
|
29
|
+
/**
|
|
30
|
+
* 矩形工具
|
|
31
|
+
*/
|
|
32
|
+
rectangle = "rectangle",
|
|
33
|
+
/**
|
|
34
|
+
* 圆形工具
|
|
35
|
+
*/
|
|
36
|
+
ellipse = "ellipse",
|
|
37
|
+
/**
|
|
38
|
+
* 图形工具
|
|
39
|
+
*/
|
|
40
|
+
shape = "shape",
|
|
41
|
+
/**
|
|
42
|
+
* 橡皮工具
|
|
43
|
+
*/
|
|
44
|
+
eraser = "eraser",
|
|
45
|
+
/**
|
|
46
|
+
* 橡皮工具(用来擦除铅笔笔迹的局部)
|
|
47
|
+
*/
|
|
48
|
+
pencilEraser = "pencilEraser",
|
|
49
|
+
/**
|
|
50
|
+
* 文字工具
|
|
51
|
+
*/
|
|
52
|
+
text = "text",
|
|
53
|
+
/**
|
|
54
|
+
* 直线工具
|
|
55
|
+
*/
|
|
56
|
+
straight = "straight",
|
|
57
|
+
/**
|
|
58
|
+
* 箭头工具
|
|
59
|
+
*/
|
|
60
|
+
arrow = "arrow",
|
|
61
|
+
/**
|
|
62
|
+
* 抓手工具
|
|
63
|
+
*/
|
|
64
|
+
hand = "hand",
|
|
65
|
+
/**
|
|
66
|
+
* 激光笔
|
|
67
|
+
*/
|
|
68
|
+
laserPen = "laserPen"
|
|
69
|
+
}
|
|
70
|
+
/** 扩展的MemberState */
|
|
71
|
+
export type ExtendMemberState = {
|
|
72
|
+
/**
|
|
73
|
+
* 当前用户所选择的教具
|
|
74
|
+
*/
|
|
75
|
+
currentApplianceName: ApplianceNames;
|
|
76
|
+
/** 是否开启笔锋 */
|
|
77
|
+
strokeType?: EStrokeType;
|
|
78
|
+
/** 是否删除整条线段 */
|
|
79
|
+
isLine?: boolean;
|
|
80
|
+
/** 线框透明度 */
|
|
81
|
+
strokeOpacity?: number;
|
|
82
|
+
/** 是否开启激光笔 */
|
|
83
|
+
useLaserPen?: boolean;
|
|
84
|
+
/** 激光笔保持时间, second */
|
|
85
|
+
duration?: number;
|
|
86
|
+
/** 是否使用新铅笔教具 */
|
|
87
|
+
useNewPencil?: boolean;
|
|
88
|
+
/** 填充样式 */
|
|
89
|
+
fillColor?: Color;
|
|
90
|
+
/** 填充透明度 */
|
|
91
|
+
fillOpacity?: number;
|
|
92
|
+
/**
|
|
93
|
+
* 使用 ``shape`` 教具时,绘制图形的具体类型
|
|
94
|
+
*/
|
|
95
|
+
shapeType?: ShapeType;
|
|
96
|
+
/** 多边形顶点数 */
|
|
97
|
+
vertices?: number;
|
|
98
|
+
/** 多边形向内顶点步长 */
|
|
99
|
+
innerVerticeStep?: number;
|
|
100
|
+
/** 多边形向内顶点与外顶点半径比率 */
|
|
101
|
+
innerRatio?: number;
|
|
102
|
+
/** 文字透明度 */
|
|
103
|
+
textOpacity?: number;
|
|
104
|
+
/** 文字背景颜色 */
|
|
105
|
+
textBgColor?: Color;
|
|
106
|
+
/** 文字背景颜色透明度 */
|
|
107
|
+
textBgOpacity?: number;
|
|
108
|
+
/** 水平对齐方式 */
|
|
109
|
+
textAlign?: "left" | "center" | "right";
|
|
110
|
+
/** 垂直对齐方式 */
|
|
111
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
112
|
+
/** 位置 */
|
|
113
|
+
placement?: SpeechBalloonPlacement;
|
|
114
|
+
};
|
|
115
|
+
export type MemberState = Omit<_MemberState, 'currentApplianceName' | 'shapeType'> & ExtendMemberState;
|
|
116
|
+
export type AppliancePluginLike = ApplianceMultiPlugin | ApplianceSinglePlugin;
|
|
117
|
+
export type ApplianceManagerLike = ApplianceMultiManager | ApplianceSingleManager | BaseApplianceManager;
|
|
118
|
+
export type ApplianceViewManagerLike = AppViewDisplayerManager | MainViewDisplayerManager;
|
|
119
|
+
export interface BaseSubWorkModuleProps {
|
|
120
|
+
control: ApplianceManagerLike;
|
|
121
|
+
internalMsgEmitter: EventEmitter2;
|
|
122
|
+
}
|
|
123
|
+
export type ApplianceAdaptor = {
|
|
124
|
+
logger?: Logger;
|
|
125
|
+
options?: AppliancePluginOptions;
|
|
126
|
+
cursorAdapter?: CursorAdapter;
|
|
127
|
+
};
|
|
128
|
+
export type canBindMethodType = keyof Omit<AppliancePluginInstance, 'displayer' | 'windowManager' | 'injectMethodToObject' | 'callbacksOn' | 'callbacksOnce' | 'callbacksOff' | '_injectTargetObject'>;
|
|
129
|
+
export interface AppliancePluginInstance {
|
|
130
|
+
readonly displayer: Displayer;
|
|
131
|
+
readonly windowManager?: WindowManager;
|
|
132
|
+
readonly _injectTargetObject: any;
|
|
133
|
+
/**
|
|
134
|
+
* 获取某个场景里包含所有元素的矩形
|
|
135
|
+
*/
|
|
136
|
+
getBoundingRectAsync(scenePath: string): Promise<Rectangle | undefined>;
|
|
137
|
+
/**
|
|
138
|
+
* 生成屏幕快照,并写入指定的 CanvasRenderingContext2D 对象中
|
|
139
|
+
*/
|
|
140
|
+
screenshotToCanvasAsync(context: CanvasRenderingContext2D, scenePath: string, width: number, height: number, camera: Camera, ratio?: number): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* 生成场景预览
|
|
143
|
+
* @param scenePath 想要获取预览内容的场景的场景路径
|
|
144
|
+
* @param div 想要展示预览内容的 div
|
|
145
|
+
* @param width 白板的缩放宽度:将当前白板内容,缩小到真实像素宽度。2.3.8 后,该参数为可选参数,如果不填,则默认为展示内容 div 的宽度。
|
|
146
|
+
* @param height 白板的缩放高度:将当前白板的内容,缩小到真实像素高度。2.3.8 后,该参数为可选参数,如果不填,则默认为展示内容 div 的高度。
|
|
147
|
+
*/
|
|
148
|
+
scenePreviewAsync(scenePath: string, div: HTMLElement, width?: number, height?: number, engine?: RenderEngine): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* 在当前场景中插入图片
|
|
151
|
+
* 该操作往往需要和 ``room.completeImageUpload`` 配合使用,具体例子可参考[《插入图片|教具》](/javascript-zh/home/tools#插入图片)。
|
|
152
|
+
*/
|
|
153
|
+
insertImage(imageInfo: ImageInformation): void;
|
|
154
|
+
/**
|
|
155
|
+
* 改变图片的锁定状态。若图片被锁定,则无法被框选、无法被拖动、无法被改变大小
|
|
156
|
+
* @param uuid 图片的 UUID
|
|
157
|
+
*/
|
|
158
|
+
lockImage(uuid: string, locked: boolean): void;
|
|
159
|
+
/**
|
|
160
|
+
* 设置图片资源。第一参数 ``uuid`` 是图片的唯一标识符,应该与 ``room.insertImage`` 中传入的 ``uuid`` 字段相同。
|
|
161
|
+
* 第二参数 ``src`` 是图片资源的 URL。具体例子可参考[《插入图片|教具》](/javascript-zh/home/tools#插入图片)。
|
|
162
|
+
*/
|
|
163
|
+
completeImageUpload(uuid: string, src: string): void;
|
|
164
|
+
/**
|
|
165
|
+
* 导出特定场景的图片信息,注意这些信息可能与插入时填写的不同。
|
|
166
|
+
* @param scenePath 需要导出图片信息的场景路径,必须是 ``ScenePathType`` 为 ``page`` 的路径。
|
|
167
|
+
*/
|
|
168
|
+
getImagesInformation(scenePath: string): ImageInformation[];
|
|
169
|
+
/** 撤销 */
|
|
170
|
+
undo(): number;
|
|
171
|
+
/** 恢复 */
|
|
172
|
+
redo(): number;
|
|
173
|
+
/** 清空当前场景 */
|
|
174
|
+
cleanCurrentScene(retainPpt?: boolean): void;
|
|
175
|
+
/** 把指定的方法注入到指定对象上 */
|
|
176
|
+
injectMethodToObject(object: WindowManager | Room | View, methodName: canBindMethodType): void;
|
|
177
|
+
/** 销毁 */
|
|
178
|
+
destroy(): void;
|
|
179
|
+
/** setMemberState */
|
|
180
|
+
setMemberState(modifyState: Partial<MemberState>): void;
|
|
181
|
+
/** 事件监听器 */
|
|
182
|
+
callbacks: Callbacks<any>;
|
|
183
|
+
}
|
|
184
|
+
export type Logger = {
|
|
185
|
+
readonly info: (...messages: any[]) => void;
|
|
186
|
+
readonly warn: (...messages: any[]) => void;
|
|
187
|
+
readonly error: (...messages: any[]) => void;
|
|
188
|
+
};
|
|
189
|
+
export type AppliancePluginOptions = {
|
|
190
|
+
/** 同步数据配置项 */
|
|
191
|
+
syncOpt?: SyncOpt;
|
|
192
|
+
/** 画布配置项 */
|
|
193
|
+
canvasOpt?: CanvasOpt;
|
|
194
|
+
};
|
|
195
|
+
export interface AppliancePluginAttributes {
|
|
196
|
+
[key: string]: ISerializableStorageViewData | ISerializableEventData;
|
|
197
|
+
}
|
|
198
|
+
export declare enum DisplayStateEnum {
|
|
199
|
+
pedding = 0,
|
|
200
|
+
mounted = 1,
|
|
201
|
+
update = 2,
|
|
202
|
+
unmounted = 3
|
|
203
|
+
}
|
|
204
|
+
export declare enum EStrokeType {
|
|
205
|
+
Normal = "Normal",
|
|
206
|
+
Stroke = "Stroke",
|
|
207
|
+
Dotted = "Dotted",
|
|
208
|
+
LongDotted = "LongDotted"
|
|
209
|
+
}
|
|
210
|
+
export declare enum ShapeType {
|
|
211
|
+
/**
|
|
212
|
+
* 三角形
|
|
213
|
+
*/
|
|
214
|
+
Triangle = "triangle",
|
|
215
|
+
/**
|
|
216
|
+
* 菱形
|
|
217
|
+
*/
|
|
218
|
+
Rhombus = "rhombus",
|
|
219
|
+
/**
|
|
220
|
+
* 五角星
|
|
221
|
+
*/
|
|
222
|
+
Pentagram = "pentagram",
|
|
223
|
+
/**
|
|
224
|
+
* 说话泡泡
|
|
225
|
+
*/
|
|
226
|
+
SpeechBalloon = "speechBalloon",
|
|
227
|
+
/**
|
|
228
|
+
* 星形
|
|
229
|
+
* */
|
|
230
|
+
Star = "star",
|
|
231
|
+
/**
|
|
232
|
+
* 多边形
|
|
233
|
+
* */
|
|
234
|
+
Polygon = "polygon"
|
|
235
|
+
}
|
|
236
|
+
export type SyncOpt = {
|
|
237
|
+
/** 同步间隔 */
|
|
238
|
+
interval?: number;
|
|
239
|
+
};
|
|
240
|
+
export type CanvasOpt = {
|
|
241
|
+
/** 画布上下文类型 */
|
|
242
|
+
contextType: ECanvasContextType;
|
|
243
|
+
};
|
|
244
|
+
export declare enum EmitEventType {
|
|
245
|
+
/** 无 */
|
|
246
|
+
None = "None",
|
|
247
|
+
/** 显示悬浮栏 */
|
|
248
|
+
ShowFloatBar = "ShowFloatBar",
|
|
249
|
+
/** 设置悬浮栏层级 */
|
|
250
|
+
ZIndexFloatBar = "ZIndexFloatBar",
|
|
251
|
+
/** 删除节点 */
|
|
252
|
+
DeleteNode = "DeleteNode",
|
|
253
|
+
/** 复制节点 */
|
|
254
|
+
CopyNode = "CopyNode",
|
|
255
|
+
/** 激活层级设置 */
|
|
256
|
+
ZIndexActive = "ZIndexActive",
|
|
257
|
+
/** 设置节点层级 */
|
|
258
|
+
ZIndexNode = "ZIndexNode",
|
|
259
|
+
/** 旋转节点 */
|
|
260
|
+
RotateNode = "RotateNode",
|
|
261
|
+
/** 设置节点颜色 */
|
|
262
|
+
SetColorNode = "SetColorNode",
|
|
263
|
+
/** 移动节点 */
|
|
264
|
+
TranslateNode = "TranslateNode",
|
|
265
|
+
/** 拉伸节点 */
|
|
266
|
+
ScaleNode = "ScaleNode",
|
|
267
|
+
/** 原始事件 */
|
|
268
|
+
OriginalEvent = "OriginalEvent",
|
|
269
|
+
/** 创建canvas */
|
|
270
|
+
CreateScene = "CreateScene",
|
|
271
|
+
/** 激活cursor */
|
|
272
|
+
ActiveCursor = "ActiveCursor",
|
|
273
|
+
/** 移动cursor */
|
|
274
|
+
MoveCursor = "MoveCursor",
|
|
275
|
+
/** 控制editor */
|
|
276
|
+
CommandEditor = "CommandEditor",
|
|
277
|
+
/** 设置editor */
|
|
278
|
+
SetEditorData = "SetEditorData",
|
|
279
|
+
/** 设置文字样式 */
|
|
280
|
+
SetFontStyle = "SetFontStyle",
|
|
281
|
+
/** 设置坐标 */
|
|
282
|
+
SetPoint = "SetPoint",
|
|
283
|
+
/** 设置是否锁定 */
|
|
284
|
+
SetLock = "SetLock",
|
|
285
|
+
/** 设置shape模型的配置项 */
|
|
286
|
+
SetShapeOpt = "SetShapeOpt"
|
|
287
|
+
}
|
|
288
|
+
export declare enum InternalMsgEmitterType {
|
|
289
|
+
DisplayState = "DisplayState",
|
|
290
|
+
FloatBar = "FloatBar",
|
|
291
|
+
CanvasSelector = "CanvasSelector",
|
|
292
|
+
MainEngine = "MainEngine",
|
|
293
|
+
DisplayContainer = "DisplayContainer",
|
|
294
|
+
Cursor = "Cursor",
|
|
295
|
+
TextEditor = "TextEditor",
|
|
296
|
+
BindMainView = "BindMainView",
|
|
297
|
+
MountMainView = "MountMainView",
|
|
298
|
+
MountAppView = "MountAppView"
|
|
299
|
+
}
|
|
300
|
+
export type InternalEventValue = {
|
|
301
|
+
id: string;
|
|
302
|
+
value?: boolean | number[];
|
|
303
|
+
};
|
|
304
|
+
export declare enum ActiveContainerType {
|
|
305
|
+
MainView = 0,
|
|
306
|
+
Plugin = 1,
|
|
307
|
+
Both = 2
|
|
308
|
+
}
|
|
309
|
+
export type SpeechBalloonPlacement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
310
|
+
export type TeleBoxState = "normal" | "minimized" | "maximized";
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.teaching-aids-plugin-main-view-displayer,.teaching-aids-plugin-app-view-displayer{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:2}.bezier-pencil-plugin-floatbtns{position:absolute;left:3px;transform:translateY(-60px);display:flex;flex-direction:row;align-items:center;background:#fff;border:1px solid #EFEFEF;box-shadow:0 6px 12px #0000001f;border-radius:4px;color-scheme:light;pointer-events:auto;z-index:9}.bezier-pencil-plugin-floatbtns .normal-button{width:40px;height:40px}.bezier-pencil-plugin-floatbtns .button{display:flex;justify-content:center;align-items:center;cursor:pointer;border:none}.bezier-pencil-plugin-floatbtns .button:hover,.bezier-pencil-plugin-floatbtns .button.active{background-color:#eef0f6}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu,.bezier-pencil-plugin-floatbtns .font-style-menu,.bezier-pencil-plugin-floatbtns .image-layer-menu,.bezier-pencil-plugin-floatbtns .font-colors-menu{box-sizing:border-box;display:flex;flex-wrap:wrap;flex-direction:row;justify-content:flex-start;align-items:center;position:absolute;padding:4px;background:#fff;box-shadow:0 3px 6px #0000001f;border-radius:2px;top:50px}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .normal-button,.bezier-pencil-plugin-floatbtns .font-style-menu .normal-button,.bezier-pencil-plugin-floatbtns .image-layer-menu .normal-button,.bezier-pencil-plugin-floatbtns .font-colors-menu .normal-button{width:32px;height:32px}.bezier-pencil-plugin-floatbtns .font-colors-menu{justify-content:space-between;width:128px}.bezier-pencil-plugin-floatbtns .font-colors-menu .font-color-button{display:flex;justify-content:center;align-items:center;cursor:pointer;margin:4px;width:20px;height:20px;border-radius:50%;border-width:1px;border-style:solid;border-color:#fff;background-image:conic-gradient(rgba(0,0,0,.06) 0 25%,transparent 0 50%,rgba(0,0,0,.06) 0 75%,transparent 0);background-size:6px 6px;box-sizing:border-box}.bezier-pencil-plugin-floatbtns .font-colors-menu .font-color-button.active{border-color:#a7a7a7}.bezier-pencil-plugin-floatbtns .font-colors-menu .font-color-button .circle{box-sizing:border-box;width:16px;height:16px;border-radius:50%;border:1px solid rgba(0,0,0,.12)}.bezier-pencil-plugin-floatbtns .font-colors-menu .font-color-button .none{position:relative;background-color:#fff}.bezier-pencil-plugin-floatbtns .font-colors-menu .font-color-button .none:before{content:"";position:absolute;left:50%;width:1px;height:100%;background-color:#0000001f;transform:rotate(45deg)}.bezier-pencil-plugin-floatbtns .font-colors-icon{flex-direction:column}.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar{height:2px;width:12px;margin-top:-2px;background-image:conic-gradient(rgba(0,0,0,.06) 0 25%,transparent 0 50%,rgba(0,0,0,.06) 0 75%,transparent 0);background-size:6px 6px}.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar .color-bar-color{width:100%;height:100%}.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar-fill,.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar-ring{height:12px;width:12px;border-radius:6px;border:1px solid rgba(0,0,0,.12);background-image:conic-gradient(rgba(0,0,0,.06) 0 25%,transparent 0 50%,rgba(0,0,0,.06) 0 75%,transparent 0);background-size:6px 6px}.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar-fill .circle,.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar-ring .circle{width:100%;height:100%;border-radius:50%}.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar-ring{border:0}.bezier-pencil-plugin-floatbtns .font-colors-icon .color-bar-ring .circle{transform:translate(35%,30%);width:60%;height:60%;border-radius:50%;background-color:#fff}.bezier-pencil-plugin-floatbtns .font-color-opacity{box-sizing:border-box;width:100px;height:6px;margin:5px 0 10px;border-radius:3px;background-image:conic-gradient(rgba(0,0,0,.06) 0 25%,transparent 0 50%,rgba(0,0,0,.06) 0 75%,transparent 0);background-size:6px 6px;position:relative}.bezier-pencil-plugin-floatbtns .font-color-opacity .range-color{height:6px;box-shadow:inset 0 0 1px #00000040;border-radius:4px;top:0;right:0;bottom:0;left:0}.bezier-pencil-plugin-floatbtns .font-color-opacity .range-opacity{position:absolute;top:0;left:-10px;height:6px;width:120px}.bezier-pencil-plugin-floatbtns .font-color-opacity .circle{position:absolute;top:-3px;border:2px solid #ffffff;border-radius:50%;cursor:pointer;box-shadow:inset 0 0 1px #00000040,0 0 0 1px #0000000f;width:12px;height:12px;box-sizing:border-box}.bezier-pencil-plugin-floatbtns .font-style-menu{justify-content:space-between;width:128px}.bezier-pencil-plugin-floatbtns .font-style-menu .font-style-button{display:flex;justify-content:center;align-items:center;cursor:pointer;margin:4px;width:20px;height:20px;box-sizing:border-box}.bezier-pencil-plugin-floatbtns .font-style-menu .font-style-button.active{border-color:#a7a7a7}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-input{line-height:20px;height:20px;padding:0 2px;margin-left:2px;width:25px;border:1px solid;border-radius:3px}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-input:focus{background:#eef0f6}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns{width:15px;margin-left:3px;display:flex;flex-direction:column;justify-content:center}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-add,.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-cut{position:relative;width:10px;height:10px}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-add:hover,.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-cut:hover{background:#eef0f6}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-add:after,.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-cut:after{content:"";position:absolute;top:0;border:4px solid #999;border-left-color:transparent;border-right-color:transparent}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-add{margin-bottom:3px}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-add:after{border-top-color:transparent}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-btns .font-size-cut:after{border-bottom-color:transparent}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-menu{position:absolute;top:35px;width:50px;overflow-y:auto;display:flex;flex-direction:column;align-items:center;background:#fff;border:1px solid #EFEFEF;box-shadow:0 6px 12px #0000001f}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-menu .font-size-btn{font-size:12px;line-height:20px;width:100%;text-align:center}.bezier-pencil-plugin-floatbtns .font-size-barBtn .font-size-menu .font-size-btn:hover{background:#eef0f6}.bezier-pencil-plugin-floatbtns .font-size-barBtn:hover{background:#fff}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu{flex-direction:column}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-tabs{display:flex;flex-direction:row;justify-content:flex-start;width:100%}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-tabs .tab-button{width:32px;height:24px}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content{flex:1;background-color:#eef0f6;display:flex;flex-direction:column;align-items:baseline;width:100%}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button{flex:1;height:32px;padding:5px 0;cursor:default;display:flex;flex-direction:row;justify-content:flex-start;width:100%}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button img{width:16px;height:16px;margin:0 5px}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number{flex:1;padding:0 3px;height:20px;border:1px solid;border-radius:3px;margin-right:5px;max-width:70px;min-width:40px}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns{width:15px;display:flex;flex-direction:column;justify-content:center}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-add,.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-cut{position:relative;width:10px;height:10px;cursor:pointer}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-add:hover,.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-cut:hover{background:#eef0f6}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-add:after,.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-cut:after{content:"";position:absolute;top:0;border:4px solid #999;border-left-color:transparent;border-right-color:transparent}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-add{margin-bottom:3px}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-add:after{border-top-color:transparent}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .input-number-btns .input-number-cut:after{border-bottom-color:transparent}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .range-number-container{flex:1;box-sizing:border-box;width:100px;height:6px;margin:7px 6px 7px 0;border-radius:3px;background-color:#3381ff;position:relative}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .range-number-container .range-number-color{height:6px;box-shadow:inset 0 0 1px #00000040;border-radius:4px;top:0;right:0;bottom:0;left:0}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .range-number-container .range-number{position:absolute;top:0;left:-6px;height:6px;width:112px;cursor:pointer}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .range-number-container .circle{position:absolute;top:-3px;border:2px solid #ffffff;border-radius:50%;cursor:pointer;box-shadow:inset 0 0 1px #00000040,0 0 0 1px #0000000f;width:12px;height:12px;box-sizing:border-box;background-color:#3381ff}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .select-option-menu{position:absolute;top:60px;left:30px;width:80px;display:flex;flex-direction:column;align-items:center;background:#fff;border:1px solid #EFEFEF;box-shadow:0 6px 12px #0000001f}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .select-option-menu .select-option-btn{font-size:12px;line-height:20px;width:100%;text-align:center}.bezier-pencil-plugin-floatbtns .shapeOpt-sub-menu .shapeOpt-sub-menu-content .input-button .select-option-menu .select-option-btn:hover{background:#eef0f6}.index-module__Container__nLsM3{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;outline:none;pointer-events:none}.index-module__Container__nLsM3 .index-module__CanvasBox__j2Xe-{position:relative;width:100%;height:100%;pointer-events:none}.index-module__Container__nLsM3 .index-module__CanvasBox__j2Xe- .index-module__FloatCanvas__d1YR7{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL{position:absolute;box-sizing:content-box;top:0;width:0;left:0;z-index:-1}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box{position:relative;box-sizing:border-box;width:100%;height:100%;border:1px solid;z-index:1;pointer-events:none}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .point{position:absolute;width:7px;height:7px;transform:translate(-50%,-50%);pointer-events:none}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .LT,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .LC,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .LB{left:0}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .LT,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .TC,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .RT{top:0}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .RT,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .RC,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .RB{right:-7px}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .RB,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .BC,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .LB{bottom:-7px}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .RC,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .LC{top:50%}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .TC,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .BC{left:50%}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-hightlight-box .lock{pointer-events:none;position:absolute;width:22px;height:22px;top:-11px;left:-11px}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-floatCanvas-box{position:absolute;z-index:1;overflow:hidden}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .bezier-pencil-plugin-floatCanvas{width:100%;height:100%}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .editor-box{position:absolute}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .editor{position:relative;padding:5px;pointer-events:auto;font-family:sans-serif;resize:none;z-index:2;border:1px dashed;white-space:pre;display:flex;flex-direction:column;align-items:baseline}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .editor:hover{border-style:solid}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .editor:focus,.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .editor:focus-visible{outline:none}.index-module__Container__nLsM3 .index-module__FloatBar__cm-EL .readOnly{border-color:transparent}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf{position:absolute;cursor:move;top:0;left:0;width:16px;height:16px;z-index:2;pointer-events:auto}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf .bezier-pencil-plugin-rotate-btn{position:absolute;left:0;top:0;width:16px;height:16px;border-radius:8px;display:flex;justify-content:center;align-items:center}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf .bezier-pencil-plugin-rotate-btn img{width:12px;height:12px}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf .bezier-pencil-plugin-rotate-mouse-pointer{position:relative;width:100%;height:100%;opacity:0}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf .bezier-pencil-plugin-rotate-mouse-pointer.active{opacity:1}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf .bezier-pencil-plugin-rotate-mouse-pointer img{width:100%;height:100%}.index-module__Container__nLsM3 .index-module__RotateBtn__HSSkf .bezier-pencil-plugin-rotate-mouse-pointer .angle-icon{position:absolute;top:-16px;left:-16px;width:30px;height:16px;text-align:center;background-color:#333;border-radius:4px;font-size:12px;color:#fff}.index-module__Container__nLsM3 .index-module__ResizeBtn__yjvda{position:absolute;box-sizing:content-box;top:0;width:0;left:0;z-index:1}.index-module__Container__nLsM3 .index-module__CursorBox__2UHvI{position:absolute;left:0;top:0;z-index:2}.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;pointer-events:none}.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC .editor-box{position:absolute}.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC .editor{position:relative;padding:5px;pointer-events:auto;font-family:sans-serif;resize:none;z-index:2;border:1px dashed;white-space:nowrap;display:flex;flex-direction:column;align-items:baseline}.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC .editor:hover{border-style:solid}.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC .editor:focus,.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC .editor:focus-visible{outline:none}.index-module__Container__nLsM3 .index-module__TextEditorContainer__Qm8KC .readOnly{pointer-events:none;border-color:transparent}.index-module__Container__nLsM3 .index-module__ResizeTowBox__HOllX{position:absolute;top:0;width:0;left:0}.index-module__Container__nLsM3 .index-module__ResizeTowBox__HOllX .bezier-pencil-plugin-point-btn{position:absolute;width:5px;height:5px;border:1px solid;border-radius:3px;transform:translate(-50%,-50%);background-color:#fff;z-index:2}.index-module__Container__nLsM3 .index-module__ResizeTowBox__HOllX .bezier-pencil-plugin-point-draggable-btn{position:absolute;width:8px;height:8px;z-index:3;pointer-events:auto;cursor:move}.index-module__Container__nLsM3 .index-module__ResizeTowBox__HOllX .bezier-pencil-plugin-point-draggable-btn .bezier-pencil-plugin-point-draggable-btn-inner{position:absolute;width:5px;height:5px;border:1px solid;border-radius:3px;transform:translate(-50%,-50%);background-color:#fff;pointer-events:none}.index-module__Container__nLsM3 .index-module__FloatBarBtn__FJrOG{position:absolute;pointer-events:none}.cursor-box{color:#fff;padding:4px;border-radius:2px;width:100%;height:100%}.cursor-pencil-image{width:26px;height:26px}.cursor-selector-image{width:24px;height:24px}.cursor-selector-avatar{border-radius:50%;border-style:solid;border-width:2px;border-color:#fff;margin-bottom:2px}.cursor-inner{border-radius:4px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:4px;padding-right:4px;font-size:12px}.cursor-inner-mellow{height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:16px;padding-right:16px}.cursor-tag-name{font-size:12px;margin-left:4px;padding:2px 8px;border-radius:4px}.cursor-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px}.cursor-pencil-offset{margin-left:-20px}.cursor-selector-offset{margin-left:-22px;margin-top:56px}.cursor-text-offset{margin-left:-30px;margin-top:18px}.cursor-shape-offset{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px;margin-left:-30px;margin-top:12px}.cursor-name{width:100%;height:48px;display:flex;align-items:center;justify-content:center}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import EventEmitter2 from "eventemitter2";
|
|
3
|
+
import { BaseCollectorReducerAction } from "../collector";
|
|
4
|
+
import type { Room } from "../plugin/types";
|
|
5
|
+
import { BaseSubWorkModuleProps, ApplianceManagerLike } from "../plugin/types";
|
|
6
|
+
import { MasterController } from "../core/mainEngine";
|
|
7
|
+
export declare enum EUndoType {
|
|
8
|
+
sdk = 1,
|
|
9
|
+
plugin = 2,
|
|
10
|
+
both = 3
|
|
11
|
+
}
|
|
12
|
+
export declare enum EUndoDataType {
|
|
13
|
+
Draw = 1,
|
|
14
|
+
Delete = 2,
|
|
15
|
+
Update = 3
|
|
16
|
+
}
|
|
17
|
+
export interface IUndoStackItem {
|
|
18
|
+
type: EUndoType;
|
|
19
|
+
id?: number;
|
|
20
|
+
sdkStep?: number;
|
|
21
|
+
data?: Set<ILocalStorageDataItem>;
|
|
22
|
+
scenePath: string;
|
|
23
|
+
tickStartStorerCache?: Map<string, BaseCollectorReducerAction | undefined>;
|
|
24
|
+
}
|
|
25
|
+
export interface ILocalStorageDataItem {
|
|
26
|
+
dataType: EUndoDataType;
|
|
27
|
+
key: string;
|
|
28
|
+
data: BaseCollectorReducerAction | [BaseCollectorReducerAction, BaseCollectorReducerAction];
|
|
29
|
+
}
|
|
30
|
+
export interface UndoRedoMethodProps extends BaseSubWorkModuleProps {
|
|
31
|
+
viewId: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class UndoRedoMethod {
|
|
34
|
+
static sdkCallBack: <NAME extends string>(name: NAME, listener: any) => void;
|
|
35
|
+
static MaxStackLength: number;
|
|
36
|
+
static waitTime: number;
|
|
37
|
+
emitter: EventEmitter2;
|
|
38
|
+
undoStack: IUndoStackItem[];
|
|
39
|
+
redoStack: IUndoStackItem[];
|
|
40
|
+
worker: MasterController;
|
|
41
|
+
control: ApplianceManagerLike;
|
|
42
|
+
room: Room;
|
|
43
|
+
private isTicking;
|
|
44
|
+
private undoTickerId?;
|
|
45
|
+
private viewId;
|
|
46
|
+
private scenePath?;
|
|
47
|
+
private tickStartStorerCache?;
|
|
48
|
+
private excludeIds;
|
|
49
|
+
constructor(props: UndoRedoMethodProps);
|
|
50
|
+
get collector(): import("../collector").Collector | undefined;
|
|
51
|
+
addExcludeIds(ids: string[]): void;
|
|
52
|
+
undoTickerStart(id: number, scenePath: string): void;
|
|
53
|
+
undoTickerEndSync(id: number, viewId: string, scenePath: string, isTmp?: boolean): void;
|
|
54
|
+
undoTickerEnd: import("lodash").DebouncedFunc<(id: number, viewId: string, scenePath: string) => void>;
|
|
55
|
+
undo(scenePath: string): number;
|
|
56
|
+
redo(scenePath: string): number;
|
|
57
|
+
clear(): void;
|
|
58
|
+
clearUndo(): void;
|
|
59
|
+
clearRedo(): void;
|
|
60
|
+
canUndo(): boolean;
|
|
61
|
+
canRedo(): boolean;
|
|
62
|
+
onChangeScene: import("lodash").DebouncedFunc<() => void>;
|
|
63
|
+
onFocusView(): void;
|
|
64
|
+
private diffFun;
|
|
65
|
+
private isDrawEffectiveScene;
|
|
66
|
+
private isDeleteEffectiveScene;
|
|
67
|
+
private isOldEffectiveScene;
|
|
68
|
+
private isNewEffectiveScene;
|
|
69
|
+
private refreshPlugin;
|
|
70
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@netless/appliance-plugin",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
|
+
"files": ["dist","cdn"],
|
|
5
|
+
"module": "./dist/appliance-plugin.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/appliance-plugin.mjs",
|
|
10
|
+
"require": "./dist/appliance-plugin.js"
|
|
11
|
+
},
|
|
12
|
+
"./cdn": {
|
|
13
|
+
"import": "./cdn/appliance-plugin.mjs",
|
|
14
|
+
"require": "./cdn/appliance-plugin.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"types:bundler": "tsc --emitDeclarationOnly",
|
|
20
|
+
"build:bundler": "vite build --config vite.config.bundler.js && yarn types:bundler",
|
|
21
|
+
"types:cdn": "tsc --noEmit",
|
|
22
|
+
"build:cdn": "vite build --config vite.config.cdn.js && yarn types:cdn",
|
|
23
|
+
"build": "cross-env NODE_ENV=production tsc && yarn build:bundler && yarn build:cdn",
|
|
24
|
+
"preview": "vite preview"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@netless/window-manager": "0.4.73-beta.0",
|
|
28
|
+
"@types/lodash": "^4.14.202",
|
|
29
|
+
"@types/react": "^17.0.0",
|
|
30
|
+
"@types/react-dom": "^17.0.0",
|
|
31
|
+
"cross-env": "^7.0.3",
|
|
32
|
+
"less": "^4.2.0",
|
|
33
|
+
"spritejs": "^3.8.3",
|
|
34
|
+
"typescript": "^5.2.2",
|
|
35
|
+
"vite": "^5.0.0",
|
|
36
|
+
"white-web-sdk": "^2.16.51"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@netless/app-slide": ">=0.2",
|
|
40
|
+
"@netless/window-manager": ">=0.4",
|
|
41
|
+
"white-web-sdk": ">= 2.16"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"eventemitter2": "^6.4.9",
|
|
45
|
+
"lineclip": "^1.1.5",
|
|
46
|
+
"lodash": "^4.17.21",
|
|
47
|
+
"lz-string": "^1.5.0",
|
|
48
|
+
"re-resizable": "^6.9.11",
|
|
49
|
+
"react": ">=17",
|
|
50
|
+
"react-dom": ">=17",
|
|
51
|
+
"react-draggable": "^4.4.6"
|
|
52
|
+
},
|
|
53
|
+
"description": "",
|
|
54
|
+
"directories": {
|
|
55
|
+
"example": "example"
|
|
56
|
+
},
|
|
57
|
+
"author": "hqer",
|
|
58
|
+
"license": "ISC"
|
|
59
|
+
}
|