@netless/appliance-plugin 1.1.19-beta.1 → 1.1.19-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/cdn/cdn.js +1 -1
  2. package/cdn/{subWorker-rWfN0e.js → fullWorker-XyhFxc.js} +133 -133
  3. package/cdn/{fullWorker-3k30fq.js → subWorker-BpFYAC.js} +133 -133
  4. package/dist/appliance-plugin.js +1 -1
  5. package/dist/appliance-plugin.mjs +1 -1
  6. package/dist/collector/collector.d.ts +2 -2
  7. package/dist/component/textEditor/manager.d.ts +2 -1
  8. package/dist/component/textEditor/types.d.ts +2 -1
  9. package/dist/core/mainEngine.d.ts +14 -3
  10. package/dist/core/mainThread/subLocalThread.d.ts +2 -0
  11. package/dist/core/tools/arrow.d.ts +4 -0
  12. package/dist/core/tools/base.d.ts +1 -0
  13. package/dist/core/tools/ellipse.d.ts +4 -0
  14. package/dist/core/tools/polygon.d.ts +4 -0
  15. package/dist/core/tools/rectangle.d.ts +4 -0
  16. package/dist/core/tools/speechBalloon.d.ts +4 -0
  17. package/dist/core/tools/star.d.ts +4 -0
  18. package/dist/core/tools/straight.d.ts +4 -0
  19. package/dist/core/types.d.ts +9 -0
  20. package/dist/core/worker/fullWorkerLocal.d.ts +1 -0
  21. package/dist/cursors/index.d.ts +5 -3
  22. package/dist/displayer/cursor/index.d.ts +1 -0
  23. package/dist/fullWorker.js +133 -133
  24. package/dist/{index-BS5_t4VL.mjs → index-BJkvFhzU.mjs} +8022 -7967
  25. package/dist/index-BXV0vpe1.js +1 -0
  26. package/dist/index-D2qjaZgV.js +1 -0
  27. package/dist/{index-yLOzxVyY.mjs → index-DM5jr5_3.mjs} +826 -795
  28. package/dist/plugin/applianceMultiPlugin.d.ts +2 -3
  29. package/dist/plugin/applianceSinglePlugin.d.ts +3 -4
  30. package/dist/plugin/baseApplianceManager.d.ts +4 -4
  31. package/dist/plugin/baseViewContainerManager.d.ts +4 -0
  32. package/dist/plugin/const.d.ts +2 -35
  33. package/dist/plugin/types.d.ts +43 -16
  34. package/dist/subWorker.js +133 -133
  35. package/package.json +2 -2
  36. package/dist/index-B4Ld7AM5.js +0 -1
  37. package/dist/index-CG1H4AUQ.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { InvisiblePlugin } from "./external";
2
- import { Room, Displayer, AppliancePluginAttributes, AppliancePluginOptions, AppliancePluginInstance, Logger, ApplianceAdaptor } from "./types";
2
+ import { Room, Displayer, AppliancePluginAttributes, AppliancePluginInstance, Logger, ApplianceAdaptor, RequiredAppliancePluginOptions } from "./types";
3
3
  import type { WindowManager } from "./multi/applianceMultiManager";
4
4
  import { ApplianceMultiManager } from "./multi/applianceMultiManager";
5
5
  /**
@@ -9,11 +9,10 @@ export declare class ApplianceMultiPlugin extends InvisiblePlugin<AppliancePlugi
9
9
  static readonly kind: string;
10
10
  static currentManager?: ApplianceMultiManager;
11
11
  static logger: Logger;
12
- static options: AppliancePluginOptions;
13
12
  static getInstance(remake: WindowManager, adaptor: ApplianceAdaptor): Promise<AppliancePluginInstance>;
14
13
  static onCreate(plugin: InvisiblePlugin<AppliancePluginAttributes, any>): void;
15
14
  static createApplianceMultiPlugin(d: Room, kind: string): Promise<ApplianceMultiPlugin>;
16
- static createCurrentManager: (remake: WindowManager, options: AppliancePluginOptions, plugin: ApplianceMultiPlugin) => void;
15
+ static createCurrentManager: (remake: WindowManager, options: RequiredAppliancePluginOptions, plugin: ApplianceMultiPlugin) => void;
17
16
  private get isReplay();
18
17
  private get callbackName();
19
18
  init(displayer: Displayer): void;
@@ -1,5 +1,5 @@
1
1
  import { InvisiblePlugin } from "./external";
2
- import { CursorAdapter, Room, AppliancePluginAttributes, AppliancePluginOptions, AppliancePluginInstance, Logger, ApplianceAdaptor, Displayer } from "./types";
2
+ import { CursorAdapter, Room, AppliancePluginAttributes, AppliancePluginInstance, Logger, ApplianceAdaptor, Displayer, RequiredAppliancePluginOptions, Player } from "./types";
3
3
  import { ApplianceSingleManager } from "./single/applianceSingleManager";
4
4
  /**
5
5
  * 单白板教具
@@ -9,11 +9,10 @@ export declare class ApplianceSinglePlugin extends InvisiblePlugin<AppliancePlug
9
9
  static cursorAdapter?: CursorAdapter;
10
10
  static currentManager?: ApplianceSingleManager;
11
11
  static logger: Logger;
12
- static options: AppliancePluginOptions;
13
- static getInstance(remake: Displayer, adaptor: ApplianceAdaptor): Promise<AppliancePluginInstance>;
12
+ static getInstance(remake: Player | Room, adaptor: ApplianceAdaptor): Promise<AppliancePluginInstance>;
14
13
  static onCreate(plugin: InvisiblePlugin<AppliancePluginAttributes, any>): void;
15
14
  static createAppliancePlugin(d: Room, kind: string): Promise<ApplianceSinglePlugin>;
16
- static createCurrentManager: (displayer: Displayer, options: AppliancePluginOptions, plugin?: ApplianceSinglePlugin) => void;
15
+ static createCurrentManager: (displayer: Displayer, options: RequiredAppliancePluginOptions, plugin?: ApplianceSinglePlugin) => void;
17
16
  /**
18
17
  * 房间实例化时,将当前实例对displayer外部API的添加内部处理逻辑;
19
18
  * @param displayer
@@ -1,9 +1,9 @@
1
1
  import EventEmitter2 from "eventemitter2";
2
- import { MemberState, AppliancePluginLike, AppliancePluginOptions } from "./types";
2
+ import { MemberState, AppliancePluginLike } from "./types";
3
3
  import { Collector, ViewId } from "../collector";
4
4
  import { RoomMemberManager } from "../members";
5
5
  import { TextEditorManager } from "../component/textEditor";
6
- import type { Camera, Displayer, DisplayerCallbacks, IconifyInformation, Player, PriorityType, Rectangle, Room, RoomMember, _ArrayTrue } from "./types";
6
+ import type { Camera, Displayer, DisplayerCallbacks, IconifyInformation, Player, PriorityType, Rectangle, RequiredAppliancePluginOptions, Room, RoomMember, _ArrayTrue } from "./types";
7
7
  import { CursorManager } from "../cursors";
8
8
  import { ViewContainerManager } from "./baseViewContainerManager";
9
9
  import { MasterControlForWorker } from "../core/mainEngine";
@@ -17,7 +17,7 @@ import { PluginManager, Plugin } from "../core/plugin";
17
17
  export interface BaseApplianceManagerProps {
18
18
  displayer: Displayer<DisplayerCallbacks>;
19
19
  plugin?: AppliancePluginLike;
20
- options: AppliancePluginOptions;
20
+ options: RequiredAppliancePluginOptions;
21
21
  }
22
22
  /** 插件管理器 */
23
23
  export declare abstract class BaseApplianceManager {
@@ -38,7 +38,7 @@ export declare abstract class BaseApplianceManager {
38
38
  priority: PriorityType;
39
39
  effectResolve?: (value: boolean) => void;
40
40
  readonly hotkeyManager: HotkeyManager;
41
- readonly pluginOptions: AppliancePluginOptions;
41
+ readonly pluginOptions: RequiredAppliancePluginOptions;
42
42
  readonly roomMember: RoomMemberManager;
43
43
  readonly cursor: CursorManager;
44
44
  readonly textEditorManager: TextEditorManager;
@@ -114,6 +114,8 @@ export declare abstract class AppViewDisplayerManager {
114
114
  x: any;
115
115
  y: any;
116
116
  };
117
+ get isBezier(): boolean;
118
+ get maxDrawCount(): number;
117
119
  private checkConsumeCount;
118
120
  protected mousedown: (e: MouseEvent) => void;
119
121
  protected mousemove: (e: MouseEvent) => void;
@@ -175,6 +177,8 @@ export declare abstract class MainViewDisplayerManager {
175
177
  x: any;
176
178
  y: any;
177
179
  };
180
+ get isBezier(): boolean;
181
+ get maxDrawCount(): number;
178
182
  /** 检查是否超过最大绘制数量 */
179
183
  private checkConsumeCount;
180
184
  protected mousedown: (e: MouseEvent) => void;
@@ -1,38 +1,5 @@
1
+ import { RequiredExtrasOptions } from "./types";
1
2
  export declare const pkg_version: string;
2
3
  export declare const pkg_name: string;
3
4
  export declare const Use_WorkSpace: string;
4
- export declare const DefaultAppliancePluginOptions: {
5
- syncOpt: {
6
- interval: number;
7
- };
8
- cdn: {
9
- subWorkerUrl: string;
10
- fullWorkerUrl: string;
11
- };
12
- cursor: {
13
- expirationTime: number;
14
- };
15
- bufferSize: {
16
- full: number;
17
- sub: number;
18
- };
19
- bezier: {
20
- maxDrawCount: number;
21
- combineUnitTime: number;
22
- };
23
- pencilEraser: {
24
- useBitMap: boolean;
25
- maxImageWidth: number;
26
- maxImageHeight: number;
27
- maxCombineTime: number;
28
- };
29
- strokeWidth: {
30
- min: number;
31
- max: number;
32
- };
33
- textEditor: {
34
- showFloatBar: boolean;
35
- canSelectorSwitch: boolean;
36
- rightBoundBreak: boolean;
37
- };
38
- };
5
+ export declare const DefaultAppliancePluginExtrasOptions: Required<Omit<RequiredExtrasOptions, "canvasOpt">>;
@@ -290,9 +290,12 @@ export type Logger = {
290
290
  readonly warn: (...messages: any[]) => void;
291
291
  readonly error: (...messages: any[]) => void;
292
292
  };
293
- export type AppliancePluginOptions = {
294
- /** cdn配置项 */
295
- cdn: CdnOpt;
293
+ export type ExtrasOptions = {
294
+ /** 是否使用 worker, 默认值为 ``auto``
295
+ * auto: 自动选择(如果浏览器支持 offscreenCanvas 则使用 webWorker, 否则使用主线程)
296
+ * mainThread: 使用主线程
297
+ */
298
+ useWorker?: UseWorkerType;
296
299
  /** 同步数据配置项 */
297
300
  syncOpt?: SyncOpt;
298
301
  /** 画布配置项 */
@@ -310,6 +313,29 @@ export type AppliancePluginOptions = {
310
313
  /** 文字编辑器配置项 */
311
314
  textEditor?: TextEditorOpt;
312
315
  };
316
+ export type AppliancePluginOptions = {
317
+ /** cdn配置项 */
318
+ cdn: CdnOpt;
319
+ /** 额外配置项 */
320
+ extras?: ExtrasOptions;
321
+ };
322
+ export type RequiredExtrasOptions = {
323
+ useWorker: Required<UseWorkerType>;
324
+ syncOpt: Required<SyncOpt>;
325
+ canvasOpt: Required<CanvasOpt>;
326
+ cursor: Required<CursorOpt>;
327
+ bufferSize: Required<BufferSizeOpt>;
328
+ bezier: Required<BezierOpt>;
329
+ pencilEraser: Required<PencilEraserOpt>;
330
+ strokeWidth: Required<StrokeWidthOpt>;
331
+ textEditor: Required<TextEditorOpt>;
332
+ };
333
+ export type RequiredAppliancePluginOptions = {
334
+ cdn: CdnOpt;
335
+ extras: Required<Omit<ExtrasOptions, "canvasOpt">> & {
336
+ canvasOpt?: CanvasOpt;
337
+ };
338
+ };
313
339
  export interface AppliancePluginAttributes {
314
340
  [key: string]: ISerializableStorageViewData | ISerializableEventData;
315
341
  }
@@ -352,7 +378,9 @@ export type SyncOpt = {
352
378
  * 默认值:200 (每秒同步5次)
353
379
  *
354
380
  */
355
- interval?: number;
381
+ interval: number;
382
+ /** 是否开启平滑同步, 默认开启 */
383
+ smoothSync?: boolean;
356
384
  };
357
385
  export type CanvasOpt = {
358
386
  /** 指定画布上下文类型 */
@@ -364,15 +392,12 @@ export type CdnOpt = {
364
392
  fullWorkerUrl?: string;
365
393
  /** sub worker url 地址, 绘制一帧数据的线程 */
366
394
  subWorkerUrl?: string;
367
- /** 是否使用 worker, 默认值为 ``auto``
368
- * auto: 自动选择(如果浏览器支持 offscreenCanvas 则使用 webWorker, 否则使用主线程)
369
- * mainThread: 使用主线程
370
- */
371
- useWorker?: UseWorkerType;
372
395
  };
373
396
  export type CursorOpt = {
397
+ /** 是否启用指针 */
398
+ enable: boolean;
374
399
  /** 指针消失过期时间 */
375
- expirationTime: number;
400
+ expirationTime?: number;
376
401
  };
377
402
  export type BufferSizeOpt = {
378
403
  /** 分配给绘制完整数据cancanvas 缓存大小 */
@@ -381,20 +406,22 @@ export type BufferSizeOpt = {
381
406
  sub: number;
382
407
  };
383
408
  export type BezierOpt = {
409
+ /** 是否开启贝塞尔曲线 */
410
+ enable: boolean;
384
411
  /** 合并处理贝塞尔曲线的单位时间,单位:毫秒 */
385
- combineUnitTime: number;
386
- /** 贝塞尔曲线最大绘制数量 */
387
- maxDrawCount: number;
412
+ combineUnitTime?: number;
413
+ /** 贝塞尔曲线最大绘制点数 */
414
+ maxDrawCount?: number;
388
415
  };
389
416
  export type PencilEraserOpt = {
390
417
  /** 是否使用位图方式局部橡皮擦 */
391
418
  useBitMap: boolean;
392
419
  /** 最大图片宽度 */
393
- maxImageWidth: number;
420
+ maxImageWidth?: number;
394
421
  /** 最大图片高度 */
395
- maxImageHeight: number;
422
+ maxImageHeight?: number;
396
423
  /** 最长合并橡皮擦处理时间间隔,单位:毫秒 */
397
- maxCombineTime: number;
424
+ maxCombineTime?: number;
398
425
  };
399
426
  export type TextEditorOpt = {
400
427
  /** 是否显示浮动栏 */