@netless/appliance-plugin 1.1.34-beta.2 → 1.1.34
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/{subWorker-DhqUsi.js → fullWorker-oI42U9.js} +109 -109
- package/cdn/{fullWorker-CuVwdG.js → subWorker-Bk6qRb.js} +109 -109
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/collector/collector.d.ts +0 -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 -1
- package/dist/core/tools/pencil.d.ts +3 -0
- package/dist/core/types.d.ts +7 -0
- package/dist/fullWorker.js +109 -109
- package/dist/{index-DD4uosmt.mjs → index-BPFYMff6.mjs} +1040 -1012
- package/dist/{index-Djm-u9a7.mjs → index-BTxxBSIk.mjs} +214 -207
- package/dist/index-BzcHKXGG.js +1 -0
- package/dist/index-CFIySwek.js +1 -0
- package/dist/{index-CslUUlge.mjs → index-CIPJM93i.mjs} +2829 -2011
- package/dist/{index-CnVA96FG.js → index-DVZBBduh.js} +3 -3
- package/dist/plugin/baseApplianceManager.d.ts +1 -2
- package/dist/plugin/multi/containerManager.d.ts +7 -0
- package/dist/plugin/types.d.ts +24 -0
- package/dist/plugin/utils.d.ts +0 -8
- package/dist/subWorker.js +109 -109
- package/package.json +8 -18
- package/dist/assets/fullWorker-CItZoPtX.js +0 -593
- package/dist/assets/subWorker-DTQZDdFT.js +0 -593
- package/dist/bridge-C4n1zHQZ.mjs +0 -67
- package/dist/bridge-DCJjH18X.js +0 -1
- package/dist/bridge-runtime.d.ts +0 -11
- package/dist/bridge.d.ts +0 -5
- package/dist/bridge.js +0 -1
- package/dist/bridge.mjs +0 -7
- package/dist/index-BZopbcnP.js +0 -1
- package/dist/index-Bc6Cv0DB.mjs +0 -15802
- package/dist/index-CH_SAlCz.mjs +0 -1255
- package/dist/index-CR9Nc39_.js +0 -1
- package/dist/index-D8qxABte.mjs +0 -9855
- package/dist/index-DjNO25oE.js +0 -1
- package/dist/index-Dk4BLxV5.js +0 -3
- package/dist/index-DnccF_rY.js +0 -1
- package/dist/plugin/external.bridge.d.ts +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-BzcHKXGG.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.Cursor_Hover_Id=e.Cursor_Hover_Id;exports.ECanvasShowType=e.ECanvasShowType;exports.EDataType=e.EDataType;exports.EForceStopReason=e.EForceStopReason;exports.EImageType=e.EImageType;exports.EMatrixrRelationType=e.EMatrixrRelationType;exports.EOperationType=e.EOperationType;exports.EPostMessageType=e.EPostMessageType;exports.ERenderFilterType=e.ERenderFilterType;exports.ESVGType=e.ESVGType;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.EventWorkState=e.EventWorkState;exports.EvevtWorkState=e.EventWorkState;exports.InternalMsgEmitterType=e.InternalMsgEmitterType;exports.Main_View_Id=e.Main_View_Id;exports.Plugin=e.Plugin;exports.ShapeType=e.ShapeType;exports.Task_Time_Interval=e.Task_Time_Interval;exports.fullWorkerUrl=e.fullWorker;exports.subWorkerUrl=e.subWorker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { af as s, a9 as p, ac as r, ab as t, aa as i, a4 as l, Z as n, b as E, ag as o, t as T, j as y, aj as v, a as g, ak as S, d as c, u, w as k, c as m, ai as M, E as _, ah as d, v as A, v as I, ae as W, Y as P, al as b, ad as f, a6 as h, a7 as w, a8 as C } from "./index-
|
|
1
|
+
import { af as s, a9 as p, ac as r, ab as t, aa as i, a4 as l, Z as n, b as E, ag as o, t as T, j as y, aj as v, a as g, ak as S, d as c, u, w as k, c as m, ai as M, E as _, ah as d, v as A, v as I, ae as W, Y as P, al as b, ad as f, a6 as h, a7 as w, a8 as C } from "./index-CIPJM93i.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|
|
@@ -26,7 +26,6 @@ export declare class Collector extends BaseCollector<ISerializableStorageViewDat
|
|
|
26
26
|
private limitNums;
|
|
27
27
|
private syncInterval;
|
|
28
28
|
constructor(control: BaseApplianceManager, plugin: AppliancePluginLike, syncInterval: number);
|
|
29
|
-
get Logger(): import("..").Logger;
|
|
30
29
|
hasId(viewId: string, scenePath: string, key: string): boolean;
|
|
31
30
|
private getLimitNum;
|
|
32
31
|
private getLimitNums;
|
|
@@ -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;
|
|
@@ -164,7 +166,6 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
164
166
|
private markmapIdResolveMap;
|
|
165
167
|
constructor(props: BaseSubWorkModuleProps);
|
|
166
168
|
get isBezier(): boolean;
|
|
167
|
-
get Logger(): import("..").Logger;
|
|
168
169
|
destroy(): void;
|
|
169
170
|
private get consumeCount();
|
|
170
171
|
private set consumeCount(value);
|
|
@@ -222,11 +223,18 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
222
223
|
getLocalPointsInfo(): Map<IworkId, {
|
|
223
224
|
state: EventWorkState;
|
|
224
225
|
points: number[];
|
|
226
|
+
rawPoints: number[];
|
|
225
227
|
/** 完整的绘制 */
|
|
226
228
|
isFullWork: boolean;
|
|
227
229
|
viewId: string;
|
|
228
230
|
opt?: BaseShapeOptions;
|
|
229
231
|
}>;
|
|
232
|
+
private shouldUseAutoShape;
|
|
233
|
+
private toAutoShapePoints;
|
|
234
|
+
private logAutoShapeResult;
|
|
235
|
+
private emitAutoShapeResult;
|
|
236
|
+
private createAutoShapeTask;
|
|
237
|
+
private mapAutoShapeFallback;
|
|
230
238
|
private correctStorage;
|
|
231
239
|
originalEventLintener(workState: EventWorkState, point: [number, number], viewId: string): Promise<void>;
|
|
232
240
|
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 {
|