@netless/appliance-plugin 1.1.34-beta.3 → 1.1.35-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/READMA.zh-CN.md +33 -1
- package/README.md +32 -0
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-BShzOf.js +486 -0
- package/cdn/subWorker-DofGU2.js +486 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/assets/fullWorker-BLBp1QlT.js +593 -0
- package/dist/assets/subWorker-CA5sK8hX.js +593 -0
- package/dist/{bridge-Bb-MjyNY.mjs → bridge-D6IerdOk.mjs} +6 -6
- package/dist/{bridge-m2Uim0rf.js → bridge-s6K3XU2g.js} +1 -1
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/core/autoShape/index.d.ts +12 -0
- package/dist/core/autoShape/mapper.d.ts +3 -0
- package/dist/core/autoShape/recognizer.d.ts +8 -0
- package/dist/core/autoShape/registry.d.ts +2 -0
- package/dist/core/autoShape/templates.d.ts +2 -0
- package/dist/core/autoShape/types.d.ts +78 -0
- package/dist/core/mainEngine.d.ts +9 -0
- package/dist/core/tools/pencil.d.ts +3 -0
- package/dist/core/types.d.ts +7 -0
- package/dist/fullWorker.js +147 -147
- package/dist/index-328yD4vj.js +1 -0
- package/dist/{index-B5p02yLM.mjs → index-4k563Sm-.mjs} +3076 -2293
- package/dist/index-C89lvDjQ.js +1 -0
- package/dist/{index-C-ITXa9_.js → index-CBE_U7Gn.js} +3 -3
- package/dist/{index-BAEfMWKR.mjs → index-CPmHcL9u.mjs} +1041 -1013
- package/dist/{index-BbVM6AMN.mjs → index-D-IWIyEl.mjs} +260 -253
- package/dist/{index-D9CYiyfx.mjs → index-D1p6YXf0.mjs} +3014 -2238
- package/dist/{index-HS0sRcOj.js → index-DDL0Hq_X.js} +3 -3
- package/dist/{index-on8Dtynb.mjs → index-DR2km5D4.mjs} +215 -208
- package/dist/index-DXx1-O0K.js +1 -0
- package/dist/index-DbLWM-6h.js +1 -0
- package/dist/{index-O6ldDna3.mjs → index-IQRiGPX7.mjs} +1041 -1013
- package/dist/plugin/multi/containerManager.d.ts +7 -0
- package/dist/plugin/types.d.ts +24 -0
- package/dist/subWorker.js +147 -147
- package/dist/svgToImageLoader-B3gIDAQo.js +1 -0
- package/dist/svgToImageLoader-DZz5bAo4.mjs +22 -0
- package/package.json +11 -5
- package/cdn/fullWorker-cY8Uuj.js +0 -486
- package/cdn/subWorker-BleGf3.js +0 -486
- package/dist/assets/fullWorker-BuSPsz-_.js +0 -593
- package/dist/assets/subWorker-B0NfJ2Bk.js +0 -593
- package/dist/index-BVYBjZU_.js +0 -1
- package/dist/index-D696FwsD.js +0 -1
- package/dist/index-DTeRhVER.js +0 -1
- package/dist/index-DnT8RFOT.js +0 -1
- package/dist/svgToImageLoader-DPRAAhwW.js +0 -1
- package/dist/svgToImageLoader-mXH53h-l.mjs +0 -18
|
@@ -12,7 +12,7 @@ function u() {
|
|
|
12
12
|
);
|
|
13
13
|
return r;
|
|
14
14
|
}
|
|
15
|
-
const h = "/assets/fullWorker-
|
|
15
|
+
const h = "/assets/fullWorker-BLBp1QlT.js", g = "/assets/subWorker-CA5sK8hX.js";
|
|
16
16
|
class d {
|
|
17
17
|
constructor() {
|
|
18
18
|
i(this, "control");
|
|
@@ -31,7 +31,7 @@ class d {
|
|
|
31
31
|
delete this._listeners[e];
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class b {
|
|
35
35
|
constructor(e) {
|
|
36
36
|
i(this, "control");
|
|
37
37
|
i(this, "worker");
|
|
@@ -54,14 +54,14 @@ class k {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
async function
|
|
58
|
-
return c(s), import("./index-
|
|
57
|
+
async function k(s) {
|
|
58
|
+
return c(s), import("./index-D1p6YXf0.mjs").then((e) => e.a7);
|
|
59
59
|
}
|
|
60
60
|
export {
|
|
61
|
-
|
|
61
|
+
b as P,
|
|
62
62
|
d as a,
|
|
63
63
|
h as f,
|
|
64
64
|
u as g,
|
|
65
|
-
|
|
65
|
+
k as l,
|
|
66
66
|
g as s
|
|
67
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var o=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>o(s,typeof e!="symbol"?e+"":e,t);let n;function u(s){n=s}function c(){if(!n)throw new Error("[@netless/appliance-plugin/bridge] white-web-sdk runtime has not been bound yet.");return n}const h="/assets/fullWorker-BLBp1QlT.js",a="/assets/subWorker-CA5sK8hX.js";class g{constructor(){i(this,"control");i(this,"_listeners",{})}_inject(e){this.control=e}_onEvent(e,t){this._listeners[e]&&this._listeners[e](...t)}callbacks(e,t){this._listeners[e]=t}removeCallback(e){delete this._listeners[e]}}class d{constructor(e){i(this,"control");i(this,"worker");i(this,"publicMsgEmitter");i(this,"plugins",new Map);const{control:t,publicMsgEmitter:r}=e;this.control=t,this.publicMsgEmitter=r,this.worker=t.worker}use(e){this.plugins.set(e.kind,e),e._inject(this.control),e.onCreate()}destroy(){this.plugins.forEach(e=>{this.plugins.delete(e.kind),e.onDestroy()})}dispatchPluginEvent(e,...t){this.plugins.forEach(r=>{r._onEvent(e,t)})}}async function k(s){return u(s),Promise.resolve().then(()=>require("./index-DbLWM-6h.js")).then(e=>e.index)}exports.Plugin=g;exports.PluginManager=d;exports.fullWorker=h;exports.getWhiteWebSdkBridgeRuntime=c;exports.loadAppliancePluginBridge=k;exports.subWorker=a;
|
package/dist/bridge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./bridge-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./bridge-s6K3XU2g.js");exports.Plugin=r.Plugin;exports.fullWorkerUrl=r.fullWorker;exports.loadAppliancePluginBridge=r.loadAppliancePluginBridge;exports.subWorkerUrl=r.subWorker;
|
package/dist/bridge.mjs
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { serializeAutoShapeWork } from "./mapper";
|
|
2
|
+
import type { AutoShapeContext, AutoShapeMappedWork, AutoShapePoint, AutoShapeResult } from "./types";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export declare function buildAutoShapeContext(params: {
|
|
5
|
+
rawPoints: AutoShapePoint[];
|
|
6
|
+
pencilOptions: AutoShapeContext["pencilOptions"];
|
|
7
|
+
viewId: string;
|
|
8
|
+
scenePath?: string;
|
|
9
|
+
}): AutoShapeContext | null;
|
|
10
|
+
export declare function detectAutoShape(context: AutoShapeContext): AutoShapeResult;
|
|
11
|
+
export declare function mapAutoShapeResult(result: AutoShapeResult, context: AutoShapeContext): AutoShapeMappedWork | null;
|
|
12
|
+
export { serializeAutoShapeWork };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AutoShapeDefinition, AutoShapeMappedWork } from "./types";
|
|
2
|
+
export declare const defaultAutoShapeMappers: Record<Exclude<AutoShapeDefinition["kind"], "none">, AutoShapeDefinition["mapper"]>;
|
|
3
|
+
export declare function serializeAutoShapeWork(work: AutoShapeMappedWork): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AutoShapeContext, AutoShapePoint, AutoShapeResult } from "./types";
|
|
2
|
+
export declare function createAutoShapeContext(params: {
|
|
3
|
+
rawPoints: AutoShapePoint[];
|
|
4
|
+
pencilOptions: AutoShapeContext["pencilOptions"];
|
|
5
|
+
viewId: string;
|
|
6
|
+
scenePath?: string;
|
|
7
|
+
}): AutoShapeContext | null;
|
|
8
|
+
export declare function recognizeAutoShape(context: AutoShapeContext): AutoShapeResult;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { EToolsKey } from "../enum";
|
|
2
|
+
import type { ShapeOptions } from "../tools";
|
|
3
|
+
import type { PencilOptions } from "../tools/pencil";
|
|
4
|
+
export type AutoShapePoint = [number, number];
|
|
5
|
+
export type AutoShapeKind = "straight" | "arrow" | "rectangle" | "ellipse" | "triangle" | "rhombus" | "star" | "none";
|
|
6
|
+
export interface AutoShapeBounds {
|
|
7
|
+
minX: number;
|
|
8
|
+
minY: number;
|
|
9
|
+
maxX: number;
|
|
10
|
+
maxY: number;
|
|
11
|
+
}
|
|
12
|
+
export interface AutoShapeMetrics {
|
|
13
|
+
pathLength: number;
|
|
14
|
+
chordLength: number;
|
|
15
|
+
straightness: number;
|
|
16
|
+
closureDistance: number;
|
|
17
|
+
closureRatio: number;
|
|
18
|
+
bboxWidth: number;
|
|
19
|
+
bboxHeight: number;
|
|
20
|
+
bboxDiagonal: number;
|
|
21
|
+
aspectRatio: number;
|
|
22
|
+
cornerCount: number;
|
|
23
|
+
angleVariance: number;
|
|
24
|
+
radialVariance: number;
|
|
25
|
+
bboxCornerCloseness: number;
|
|
26
|
+
diamondCloseness: number;
|
|
27
|
+
}
|
|
28
|
+
export interface AutoShapeContext {
|
|
29
|
+
viewId: string;
|
|
30
|
+
scenePath?: string;
|
|
31
|
+
pencilOptions: PencilOptions;
|
|
32
|
+
rawPoints: AutoShapePoint[];
|
|
33
|
+
points: AutoShapePoint[];
|
|
34
|
+
start: AutoShapePoint;
|
|
35
|
+
end: AutoShapePoint;
|
|
36
|
+
bbox: AutoShapeBounds;
|
|
37
|
+
metrics: AutoShapeMetrics;
|
|
38
|
+
}
|
|
39
|
+
export interface AutoShapeTemplateDefinition {
|
|
40
|
+
id: string;
|
|
41
|
+
semanticKind: Exclude<AutoShapeKind, "none">;
|
|
42
|
+
points: AutoShapePoint[];
|
|
43
|
+
threshold?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface AutoShapeCandidate {
|
|
46
|
+
kind: Exclude<AutoShapeKind, "none">;
|
|
47
|
+
templateId: string;
|
|
48
|
+
score: number;
|
|
49
|
+
threshold: number;
|
|
50
|
+
distance: number;
|
|
51
|
+
}
|
|
52
|
+
export interface AutoShapeResult {
|
|
53
|
+
kind: AutoShapeKind;
|
|
54
|
+
score: number;
|
|
55
|
+
threshold: number;
|
|
56
|
+
recognized: boolean;
|
|
57
|
+
bbox: AutoShapeBounds;
|
|
58
|
+
start: AutoShapePoint;
|
|
59
|
+
end: AutoShapePoint;
|
|
60
|
+
points: AutoShapePoint[];
|
|
61
|
+
templateId?: string;
|
|
62
|
+
metrics: AutoShapeMetrics;
|
|
63
|
+
candidates: AutoShapeCandidate[];
|
|
64
|
+
}
|
|
65
|
+
export interface AutoShapeMappedWork {
|
|
66
|
+
toolsType: EToolsKey;
|
|
67
|
+
opt: ShapeOptions;
|
|
68
|
+
op: number[];
|
|
69
|
+
}
|
|
70
|
+
export type AutoShapePostProcessor = (candidate: AutoShapeCandidate, context: AutoShapeContext) => AutoShapeCandidate | null;
|
|
71
|
+
export type AutoShapeMapper = (result: AutoShapeResult, context: AutoShapeContext) => AutoShapeMappedWork | null;
|
|
72
|
+
export interface AutoShapeDefinition {
|
|
73
|
+
kind: Exclude<AutoShapeKind, "none">;
|
|
74
|
+
templates: AutoShapeTemplateDefinition[];
|
|
75
|
+
postProcessor?: AutoShapePostProcessor;
|
|
76
|
+
mapper: AutoShapeMapper;
|
|
77
|
+
enabledInV1?: boolean;
|
|
78
|
+
}
|
|
@@ -26,6 +26,7 @@ export declare abstract class MasterController {
|
|
|
26
26
|
protected abstract localPointsBatchData: Map<IworkId, {
|
|
27
27
|
state: EventWorkState;
|
|
28
28
|
points: number[];
|
|
29
|
+
rawPoints: number[];
|
|
29
30
|
isFullWork: boolean;
|
|
30
31
|
viewId: string;
|
|
31
32
|
}>;
|
|
@@ -133,6 +134,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
133
134
|
protected localPointsBatchData: Map<IworkId, {
|
|
134
135
|
state: EventWorkState;
|
|
135
136
|
points: number[];
|
|
137
|
+
rawPoints: number[];
|
|
136
138
|
/** 完整的绘制 */
|
|
137
139
|
isFullWork: boolean;
|
|
138
140
|
viewId: string;
|
|
@@ -222,11 +224,18 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
222
224
|
getLocalPointsInfo(): Map<IworkId, {
|
|
223
225
|
state: EventWorkState;
|
|
224
226
|
points: number[];
|
|
227
|
+
rawPoints: number[];
|
|
225
228
|
/** 完整的绘制 */
|
|
226
229
|
isFullWork: boolean;
|
|
227
230
|
viewId: string;
|
|
228
231
|
opt?: BaseShapeOptions;
|
|
229
232
|
}>;
|
|
233
|
+
private shouldUseAutoShape;
|
|
234
|
+
private toAutoShapePoints;
|
|
235
|
+
private logAutoShapeResult;
|
|
236
|
+
private emitAutoShapeResult;
|
|
237
|
+
private createAutoShapeTask;
|
|
238
|
+
private mapAutoShapeFallback;
|
|
230
239
|
private correctStorage;
|
|
231
240
|
originalEventLintener(workState: EventWorkState, point: [number, number], viewId: string): Promise<void>;
|
|
232
241
|
getLocalWorkViewId(): string | undefined;
|
|
@@ -9,6 +9,9 @@ export interface PencilOptions extends BaseShapeOptions {
|
|
|
9
9
|
thickness: number;
|
|
10
10
|
strokeColor: string;
|
|
11
11
|
strokeType: EStrokeType;
|
|
12
|
+
autoShape?: boolean;
|
|
13
|
+
/** 仅用于本地预览,不向 collector 同步中间态 */
|
|
14
|
+
previewLocalOnly?: boolean;
|
|
12
15
|
}
|
|
13
16
|
export declare class PencilShape extends BaseShapeTool {
|
|
14
17
|
readonly canRotate: boolean;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { BaseShapeOptions, BaseShapeTool, ShapeOptions } from "./tools";
|
|
|
6
6
|
import type { SelectorShape } from "./tools";
|
|
7
7
|
import type { Direction } from "re-resizable/lib/resizer";
|
|
8
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];
|
|
@@ -155,6 +156,10 @@ export type IWorkerMessage = Omit<Partial<BaseCollectorReducerAction>, "op"> & {
|
|
|
155
156
|
buffer: ArrayBuffer;
|
|
156
157
|
}[];
|
|
157
158
|
isRunBackgroundThread?: boolean;
|
|
159
|
+
/** 直接提交 FullWork 时,清理本地铅笔预览层 */
|
|
160
|
+
clearPreviewLocalWork?: boolean;
|
|
161
|
+
/** auto-shape 的识别结果,仅用于内部调试/日志 */
|
|
162
|
+
autoShapeResult?: AutoShapeResult;
|
|
158
163
|
[key: string]: any;
|
|
159
164
|
};
|
|
160
165
|
export interface IRectType {
|
|
@@ -209,6 +214,8 @@ export interface IMainMessage extends INormalPushMsg {
|
|
|
209
214
|
nextTasks?: IMainMessage[];
|
|
210
215
|
setFontFaceResult?: boolean;
|
|
211
216
|
needUndoTicker?: number;
|
|
217
|
+
clearPreviewLocalWork?: boolean;
|
|
218
|
+
autoShapeResult?: AutoShapeResult;
|
|
212
219
|
[key: string]: any;
|
|
213
220
|
}
|
|
214
221
|
export interface IMainMessageRenderData {
|