@netless/appliance-plugin 1.1.42 → 1.1.43-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.
Files changed (112) hide show
  1. package/READMA.zh-CN.md +23 -1
  2. package/README.md +24 -1
  3. package/dist/appliance-plugin.js +1 -1
  4. package/dist/appliance-plugin.mjs +33 -30
  5. package/dist/{bridge-C8yT2GqS.js → bridge-D68E09T9.js} +1 -1
  6. package/dist/{bridge-DLGOhX8U.mjs → bridge-DcVN05tP.mjs} +1 -1
  7. package/dist/bridge.js +1 -1
  8. package/dist/bridge.mjs +1 -1
  9. package/dist/collector/collector.d.ts +50 -2
  10. package/dist/collector/types.d.ts +6 -0
  11. package/dist/component/svg/manager.d.ts +1 -0
  12. package/dist/component/svg/snapshot.d.ts +4 -1
  13. package/dist/component/textEditor/manager.d.ts +3 -0
  14. package/dist/core/backGroundThread/index.d.ts +6 -1
  15. package/dist/core/cameraTask.d.ts +45 -0
  16. package/dist/core/const.d.ts +4 -0
  17. package/dist/core/enum.d.ts +5 -1
  18. package/dist/core/error.d.ts +1 -0
  19. package/dist/core/fontFace.d.ts +5 -3
  20. package/dist/core/mainEngine.d.ts +230 -31
  21. package/dist/core/mainThread/base.d.ts +23 -2
  22. package/dist/core/mainThread/canvas2DReadback.d.ts +27 -0
  23. package/dist/core/mainThread/index.d.ts +12 -1
  24. package/dist/core/mainThread/snapshotThread.d.ts +11 -2
  25. package/dist/core/mainThread/subLocalThread.d.ts +12 -6
  26. package/dist/core/mainThread/subServiceThread.d.ts +5 -3
  27. package/dist/core/msgEvent/base.d.ts +4 -1
  28. package/dist/core/msgEvent/baseForWorker.d.ts +1 -1
  29. package/dist/core/msgEvent/copyNode/forWorker.d.ts +1 -1
  30. package/dist/core/msgEvent/forWorker.d.ts +1 -1
  31. package/dist/core/msgEvent/index.d.ts +5 -3
  32. package/dist/core/msgEvent/rotateNode/forMain.d.ts +1 -0
  33. package/dist/core/msgEvent/rotateNode/forWorker.d.ts +1 -1
  34. package/dist/core/msgEvent/scaleNode/forMain.d.ts +1 -0
  35. package/dist/core/msgEvent/scaleNode/forWorker.d.ts +1 -1
  36. package/dist/core/msgEvent/setColor/forMain.d.ts +1 -0
  37. package/dist/core/msgEvent/setColor/forWorker.d.ts +1 -1
  38. package/dist/core/msgEvent/setFont/forWorker.d.ts +1 -1
  39. package/dist/core/msgEvent/setLock/forWorker.d.ts +1 -1
  40. package/dist/core/msgEvent/setPoint/forWorker.d.ts +1 -1
  41. package/dist/core/msgEvent/setShape/forWorker.d.ts +1 -1
  42. package/dist/core/msgEvent/setZIndex/forWorker.d.ts +1 -1
  43. package/dist/core/msgEvent/translateNode/forMain.d.ts +1 -0
  44. package/dist/core/msgEvent/translateNode/forWorker.d.ts +1 -1
  45. package/dist/core/renderRuntimeFallback.d.ts +2 -0
  46. package/dist/core/rendererBusinessTask.d.ts +30 -0
  47. package/dist/core/serviceRenderScheduler.d.ts +33 -0
  48. package/dist/core/tools/base.d.ts +1 -1
  49. package/dist/core/tools/bitmapEraserFastPath.d.ts +8 -0
  50. package/dist/core/tools/eraserFaces.d.ts +24 -9
  51. package/dist/core/tools/image.d.ts +1 -0
  52. package/dist/core/tools/pencilEraserBitMap.d.ts +62 -14
  53. package/dist/core/tools/text.d.ts +2 -1
  54. package/dist/core/types.d.ts +64 -1
  55. package/dist/core/utils/indexDB.d.ts +3 -3
  56. package/dist/core/vNodeManager.d.ts +7 -0
  57. package/dist/core/worker/base.d.ts +52 -7
  58. package/dist/core/worker/fullWorkerLocal.d.ts +8 -2
  59. package/dist/core/worker/fullWorkerService.d.ts +7 -3
  60. package/dist/core/worker/renderCapabilityProbe.d.ts +54 -0
  61. package/dist/core/worker/simpleWorker.d.ts +2 -2
  62. package/dist/core/worker/snapshotWork.d.ts +1 -0
  63. package/dist/core/worker/workerManager.d.ts +17 -4
  64. package/dist/displayer/floatBar/selectorGesture.d.ts +2 -0
  65. package/dist/fullWorker.js +138 -139
  66. package/dist/index-BNHPCii1.mjs +4089 -0
  67. package/dist/index-B_vZ9d3x.mjs +55912 -0
  68. package/dist/index-C2AHqjj8.js +570 -0
  69. package/dist/index-CV8YaU3F.mjs +931 -0
  70. package/dist/index-CWDWQZBs.mjs +4088 -0
  71. package/dist/index-DChI1--R.js +1 -0
  72. package/dist/index-DFo0Gmfx.js +570 -0
  73. package/dist/index-DiLPVPwQ.js +1 -0
  74. package/dist/index-GBYM7kT5.js +1 -0
  75. package/dist/index-GZUDLXJC.js +1 -0
  76. package/dist/{index-D8p2ph99.mjs → index-K_0NX6pD.mjs} +401 -263
  77. package/dist/index-NG5kKK1W.mjs +55920 -0
  78. package/dist/plugin/applianceMultiPlugin.d.ts +18 -3
  79. package/dist/plugin/applianceSinglePlugin.d.ts +18 -4
  80. package/dist/plugin/baseApplianceManager.d.ts +138 -12
  81. package/dist/plugin/baseViewContainerManager.d.ts +40 -3
  82. package/dist/plugin/bitmapEraserOptions.d.ts +9 -0
  83. package/dist/plugin/const.d.ts +4 -0
  84. package/dist/plugin/displayerView.d.ts +7 -7
  85. package/dist/plugin/initLogAggregator.d.ts +45 -0
  86. package/dist/plugin/multi/applianceMultiManager.d.ts +1 -0
  87. package/dist/plugin/multi/containerManager.d.ts +19 -1
  88. package/dist/plugin/pluginInstanceOwner.d.ts +1 -0
  89. package/dist/plugin/renderImageBitmapRetirement.d.ts +100 -0
  90. package/dist/plugin/renderRuntimeCache.d.ts +18 -0
  91. package/dist/plugin/renderSurface.d.ts +15 -0
  92. package/dist/plugin/renderingCompatibility.d.ts +21 -5
  93. package/dist/plugin/roomLifecycle.d.ts +12 -0
  94. package/dist/plugin/selectorApi.d.ts +8 -0
  95. package/dist/plugin/single/applianceSingleManager.d.ts +4 -0
  96. package/dist/plugin/types.d.ts +11 -14
  97. package/dist/plugin/utils.d.ts +8 -0
  98. package/dist/subWorker.js +136 -137
  99. package/dist/undo/index.d.ts +12 -3
  100. package/dist/undo/timing.d.ts +9 -4
  101. package/package.json +23 -8
  102. package/dist/index--wqREfHK.js +0 -570
  103. package/dist/index-B-tFucpi.mjs +0 -48995
  104. package/dist/index-BOx854fU.mjs +0 -3266
  105. package/dist/index-BpiBM5wZ.js +0 -1
  106. package/dist/index-ByjVgxJm.js +0 -1
  107. package/dist/index-CSVCH-SQ.mjs +0 -789
  108. package/dist/index-CfIWmlMn.js +0 -570
  109. package/dist/index-D6gXcNbF.js +0 -1
  110. package/dist/index-HAZlgByL.mjs +0 -48987
  111. package/dist/index-OZXjSPr1.js +0 -1
  112. package/dist/index-z7deO9Md.mjs +0 -3267
package/READMA.zh-CN.md CHANGED
@@ -302,7 +302,7 @@ injectMethodToObject(windowmanager.mainView,'setMemberState');
302
302
  - `addListener` - 添加 appliance-plugin 内部事件监听器
303
303
  - `removeListener` - 移除 appliance-plugin 内部事件监听器
304
304
  - `disableDeviceInputs` - 替代接口 [room.disableDeviceInputs](https://doc.shengwang.cn/api-ref/whiteboard/javascript/interfaces/room#disableDeviceInputs)
305
- - `disableEraseImage` - 替代接口 [room.disableEraseImage](https://doc.shengwang.cn/api-ref/whiteboard/javascript/interfaces/room#disableEraseImage) **该方法只禁止整体擦除的橡皮擦对图片的擦除,局部橡皮擦无效**
305
+ - `disableEraseImage` - 替代接口 [room.disableEraseImage](https://doc.shengwang.cn/api-ref/whiteboard/javascript/interfaces/room#disableEraseImage)。该配置只控制整体橡皮擦(`ApplianceNames.eraser`)是否删除图片;Bitmap Eraser(`ApplianceNames.pencilEraser` 且 `useBitMap: true`)命中图片后仍会直接擦除:Doing 阶段先隐藏,Done 阶段从白板中删除。
306
306
  - `disableCameraTransform` - 替代接口 [room.disableCameraTransform](https://doc.shengwang.cn/api-ref/whiteboard/javascript/interfaces/room#disableCameraTransform) (Version >=1.1.17)
307
307
  - `insertText` - 在指定位置插入文字 (Version >=1.1.18)
308
308
  - `updateText` - 编辑指定文字的内容 (Version >=1.1.18)
@@ -892,6 +892,28 @@ plugin.insertBackgroundImage(viewId, {
892
892
  - `logger?: Logger` - 非必填,配置日志打印器对象。不填写默认在本地 console 输出,如果需要把日志上传到指定 server,则需要手动配置。
893
893
  > 如需要上传到白板日志服务器,可以把 `room.logger` 配置到该项目。
894
894
 
895
+ ### Bitmap Eraser 配置
896
+
897
+ Bitmap Eraser 统一使用事务级 FullLayer 透明 Mask 作为 Doing 预览,MainThread、Simple Worker 和 Full Worker 使用同一套处理逻辑。命中 Pencil/Shape 时,Done 阶段会把擦除结果分别固化到每个教具的 `eraserFaces`;命中 Image/Text 时,Doing 阶段先隐藏,Done 或达到点数上限触发 force-Done 后直接删除。
898
+
899
+ ```ts
900
+ const plugin = await ApplianceSinglePlugin.getInstance(room, {
901
+ options: {
902
+ extras: {
903
+ pencilEraser: {
904
+ useBitMap: true,
905
+ // 单个事务最多接收的逻辑输入点数,默认 500;达到上限后自动 force-Done。
906
+ fullLayerDoingMaskMaxInputPoints: 500,
907
+ // 完全擦除 Pencil/Shape 时是否删除该教具,默认 true。
908
+ removeOnDone: true,
909
+ },
910
+ },
911
+ },
912
+ });
913
+ ```
914
+
915
+ 不需要配置 `fullLayerDoingMask`。该旧字段仅保留兼容读取,无论传入 `true` 还是 `false`,当前实现都统一使用 FullLayer Doing Mask。`disableEraseImage` 不影响 Bitmap Eraser 对 Image 的直接擦除。
916
+
895
917
  ### 前端调试
896
918
 
897
919
  对接过程中如果想了解和跟踪插件内部状态,可以通过以下几个控制台指令,查看内部数据。
package/README.md CHANGED
@@ -294,7 +294,7 @@ The following interfaces are involved:
294
294
  - `addListener` - Add appliance-plugin internal event listener
295
295
  - `removeListener` - Remove appliance-plugin internal event listener
296
296
  - `disableDeviceInputs` - Replace interface [room.disableDeviceInputs](https://api-ref.agora.io/en/interactive-whiteboard-sdk/web/2.x/interfaces/room.html#disabledeviceinputs)
297
- - `disableEraseImage` - Replace interface [room.disableEraseImage](https://api-ref.agora.io/en/interactive-whiteboard-sdk/web/2.x/interfaces/room.html#disableeraseimage) **This method only prohibits the eraser that erases the entire image from erasing images, partial eraser is invalid**
297
+ - `disableEraseImage` - Replaces [room.disableEraseImage](https://api-ref.agora.io/en/interactive-whiteboard-sdk/web/2.x/interfaces/room.html#disableeraseimage). This option only controls whether the whole-object eraser (`ApplianceNames.eraser`) can delete images. The Bitmap Eraser (`ApplianceNames.pencilEraser` with `useBitMap: true`) still erases an intersected image directly: it hides the image during Doing and removes it from the whiteboard on Done.
298
298
  - `disableCameraTransform` - Replace interface [room.disableCameraTransform](https://api-ref.agora.io/en/interactive-whiteboard-sdk/web/2.x/interfaces/room.html#disablecameratransform) (Version >=1.1.17)
299
299
  - `insertText` - Insert text at the specified position (Version >=1.1.18)
300
300
  - `updateText` - Edit the content of the specified text (Version >=1.1.18)
@@ -938,6 +938,29 @@ plugin.usePlugin(autoDrawPlugin);
938
938
  - `logger?: Logger` - Optional, configure log printer object. If not provided, defaults to local console output. If logs need to be uploaded to a specified server, manual configuration is required.
939
939
  > If you need to upload to the whiteboard log server, you can configure `room.logger` to this item.
940
940
 
941
+ ### Bitmap Eraser options
942
+
943
+ The Bitmap Eraser always uses a transaction-scoped transparent FullLayer mask for its Doing preview. MainThread, Simple Worker, and Full Worker use the same processing model. On Done, Pencil/Shape results are persisted separately in each appliance's `eraserFaces`. Intersected Image/Text appliances are hidden during Doing and removed on Done, or when the input limit forces the transaction to finish.
944
+
945
+ ```ts
946
+ const plugin = await ApplianceSinglePlugin.getInstance(room, {
947
+ options: {
948
+ extras: {
949
+ pencilEraser: {
950
+ useBitMap: true,
951
+ // Maximum logical input points per transaction. Defaults to 500.
952
+ // Reaching the limit automatically force-finishes the transaction.
953
+ fullLayerDoingMaskMaxInputPoints: 500,
954
+ // Remove a fully erased Pencil/Shape appliance. Defaults to true.
955
+ removeOnDone: true,
956
+ },
957
+ },
958
+ },
959
+ });
960
+ ```
961
+
962
+ Do not configure `fullLayerDoingMask`. The legacy field is accepted only for compatibility; both `true` and `false` now use the single FullLayer Doing Mask path. `disableEraseImage` does not prevent the Bitmap Eraser from directly erasing Image appliances.
963
+
941
964
  ### Front-end Debugging
942
965
  During the integration process, if you want to understand and track the internal status of the plugin, you can view internal data through the following console commands.
943
966
  ```js
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index--wqREfHK.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.AppliancePluginCursorNames=e.AppliancePluginCursorNames;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.FontFaceFallbackBlacklistLevel=e.FontFaceFallbackBlacklistLevel;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.WorkerCanvasContextBlacklistLevel=e.WorkerCanvasContextBlacklistLevel;exports.WorkerImageBitmapFeatureBlacklistLevel=e.WorkerImageBitmapFeatureBlacklistLevel;exports.WorkerMaskTextureFormatBlacklistLevel=e.WorkerMaskTextureFormatBlacklistLevel;exports.WorkerMaskTextureUploadBlacklistLevel=e.WorkerMaskTextureUploadBlacklistLevel;exports.WorkerRenderModeBlacklistLevel=e.WorkerRenderModeBlacklistLevel;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DFo0Gmfx.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.AppliancePluginCursorNames=e.AppliancePluginCursorNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.Camera_Ack_Slow_Timeout=e.Camera_Ack_Slow_Timeout;exports.Camera_Transport_Fallback_Timeout=e.Camera_Transport_Fallback_Timeout;exports.Camera_Update_Business_Timeout=e.Camera_Update_Business_Timeout;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.FontFaceFallbackBlacklistLevel=e.FontFaceFallbackBlacklistLevel;exports.InternalMsgEmitterType=e.InternalMsgEmitterType;exports.Main_View_Id=e.Main_View_Id;exports.Plugin=e.Plugin;exports.Renderer_Business_Default_Timeout=e.Renderer_Business_Default_Timeout;exports.ShapeType=e.ShapeType;exports.Task_Time_Interval=e.Task_Time_Interval;exports.WorkerCanvasContextBlacklistLevel=e.WorkerCanvasContextBlacklistLevel;exports.WorkerMaskTextureFormatBlacklistLevel=e.WorkerMaskTextureFormatBlacklistLevel;exports.WorkerMaskTextureUploadBlacklistLevel=e.WorkerMaskTextureUploadBlacklistLevel;exports.WorkerRenderModeBlacklistLevel=e.WorkerRenderModeBlacklistLevel;
@@ -1,38 +1,41 @@
1
- import { I as s, J as l, K as t, L as r, N as p, P as i, C as n, p as o, b as T, Q as E, w as k, z as y, R as c, a as v, U as g, d as u, W as m, X as S, c as M, Y as W, E as d, Z as B, e as C, e as F, _ as I, $ as L, u as _, a0 as A, a1 as P, T as x, a2 as R, a3 as w, a4 as N, a5 as b, a6 as h } from "./index-B-tFucpi.mjs";
1
+ import { Y as s, Z as t, _ as r, $ as l, a0 as i, a1 as p, a2 as o, a3 as n, a4 as T, C as E, s as c, b as k, a5 as y, H as _, K as u, a6 as m, a as v, a7 as g, d as S, a8 as d, a9 as C, c as M, aa as A, E as B, ab as F, e as W, e as x, ac as I, ad as L, y as P, ae as R, af as b, ag as f, T as h, ah as w, ai as D, aj as H, ak as K } from "./index-NG5kKK1W.mjs";
2
2
  export {
3
3
  s as ActiveContainerType,
4
- l as ApplianceMultiPlugin,
5
- t as ApplianceNames,
6
- r as AppliancePluginCursorNames,
7
- p as ApplianceSigleWrapper,
8
- i as ApplianceSinglePlugin,
9
- n as Cursor_Hover_Id,
10
- o as ECanvasShowType,
11
- T as EDataType,
12
- E as EForceStopReason,
13
- k as EImageType,
14
- y as EMatrixrRelationType,
15
- c as EOperationType,
4
+ t as ApplianceMultiPlugin,
5
+ r as ApplianceNames,
6
+ l as AppliancePluginCursorNames,
7
+ i as ApplianceSigleWrapper,
8
+ p as ApplianceSinglePlugin,
9
+ o as Camera_Ack_Slow_Timeout,
10
+ n as Camera_Transport_Fallback_Timeout,
11
+ T as Camera_Update_Business_Timeout,
12
+ E as Cursor_Hover_Id,
13
+ c as ECanvasShowType,
14
+ k as EDataType,
15
+ y as EForceStopReason,
16
+ _ as EImageType,
17
+ u as EMatrixrRelationType,
18
+ m as EOperationType,
16
19
  v as EPostMessageType,
17
20
  g as ERenderFilterType,
18
- u as ESVGType,
19
- m as EScaleType,
20
- S as EStrokeType,
21
+ S as ESVGType,
22
+ d as EScaleType,
23
+ C as EStrokeType,
21
24
  M as EToolsKey,
22
- W as ElayerType,
23
- d as EmitEventType,
24
- B as EventMessageType,
25
- C as EventWorkState,
26
- F as EvevtWorkState,
25
+ A as ElayerType,
26
+ B as EmitEventType,
27
+ F as EventMessageType,
28
+ W as EventWorkState,
29
+ x as EvevtWorkState,
27
30
  I as FontFaceFallbackBlacklistLevel,
28
31
  L as InternalMsgEmitterType,
29
- _ as Main_View_Id,
30
- A as Plugin,
31
- P as ShapeType,
32
- x as Task_Time_Interval,
33
- R as WorkerCanvasContextBlacklistLevel,
34
- w as WorkerImageBitmapFeatureBlacklistLevel,
35
- N as WorkerMaskTextureFormatBlacklistLevel,
36
- b as WorkerMaskTextureUploadBlacklistLevel,
37
- h as WorkerRenderModeBlacklistLevel
32
+ P as Main_View_Id,
33
+ R as Plugin,
34
+ b as Renderer_Business_Default_Timeout,
35
+ f as ShapeType,
36
+ h as Task_Time_Interval,
37
+ w as WorkerCanvasContextBlacklistLevel,
38
+ D as WorkerMaskTextureFormatBlacklistLevel,
39
+ H as WorkerMaskTextureUploadBlacklistLevel,
40
+ K as WorkerRenderModeBlacklistLevel
38
41
  };
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var o=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var n=(i,e,t)=>o(i,typeof e!="symbol"?e+"":e,t);let r;function c(i){r=i}function u(){if(!r)throw new Error("[@netless/appliance-plugin/bridge] white-web-sdk runtime has not been bound yet.");return r}class h{constructor(){n(this,"control");n(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 g{constructor(e){n(this,"control");n(this,"worker");n(this,"publicMsgEmitter");n(this,"plugins",new Map);const{control:t,publicMsgEmitter:s}=e;this.control=t,this.publicMsgEmitter=s,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(s=>{s._onEvent(e,t)})}}async function a(i){return c(i),Promise.resolve().then(()=>require("./index-CfIWmlMn.js")).then(e=>e.index)}exports.Plugin=h;exports.PluginManager=g;exports.getWhiteWebSdkBridgeRuntime=u;exports.loadAppliancePluginBridge=a;
1
+ "use strict";var l=Object.defineProperty;var o=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var n=(i,e,t)=>o(i,typeof e!="symbol"?e+"":e,t);let r;function c(i){r=i}function u(){if(!r)throw new Error("[@netless/appliance-plugin/bridge] white-web-sdk runtime has not been bound yet.");return r}class h{constructor(){n(this,"control");n(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 g{constructor(e){n(this,"control");n(this,"worker");n(this,"publicMsgEmitter");n(this,"plugins",new Map);const{control:t,publicMsgEmitter:s}=e;this.control=t,this.publicMsgEmitter=s,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(s=>{s._onEvent(e,t)})}}async function a(i){return c(i),Promise.resolve().then(()=>require("./index-C2AHqjj8.js")).then(e=>e.index)}exports.Plugin=h;exports.PluginManager=g;exports.getWhiteWebSdkBridgeRuntime=u;exports.loadAppliancePluginBridge=a;
@@ -54,7 +54,7 @@ class g {
54
54
  }
55
55
  }
56
56
  async function d(i) {
57
- return c(i), import("./index-HAZlgByL.mjs").then((t) => t.J);
57
+ return c(i), import("./index-B_vZ9d3x.mjs").then((t) => t.Z);
58
58
  }
59
59
  export {
60
60
  g as P,
package/dist/bridge.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bridge-C8yT2GqS.js");exports.Plugin=e.Plugin;exports.loadAppliancePluginBridge=e.loadAppliancePluginBridge;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bridge-D68E09T9.js");exports.Plugin=e.Plugin;exports.loadAppliancePluginBridge=e.loadAppliancePluginBridge;
package/dist/bridge.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as i, l as e } from "./bridge-DLGOhX8U.mjs";
1
+ import { a as i, l as e } from "./bridge-DcVN05tP.mjs";
2
2
  export {
3
3
  i as Plugin,
4
4
  e as loadAppliancePluginBridge
@@ -1,5 +1,5 @@
1
1
  import { EOperationType, ERenderFilterType } from "../core/enum";
2
- import { BaseCollectorReducerAction, Diff, DiffAuthPage, DiffAuthRender, ISerializableAuthData, ISerializableStorageData, ISerializableStorageViewData, ISerializableUndoRedoStackViewData, ISerializableUndoStackId, ScenePath, Uid, ViewId, WorkId, DiffGlobalUndoRedoStack } from "./types";
2
+ import { BaseCollectorReducerAction, Diff, DiffAuthPage, DiffAuthRender, ISerializableAuthData, ISerializableStorageData, ISerializableStorageScenePathData, ISerializableStorageViewData, ISerializableUndoRedoStackViewData, ISerializableUndoStackId, ScenePath, Uid, ViewId, WorkId, DiffGlobalUndoRedoStack } from "./types";
3
3
  import { BaseCollector } from "./base";
4
4
  import type { _SetTrue, AppliancePluginLike } from "../plugin/types";
5
5
  import { BaseApplianceManager } from "../plugin/baseApplianceManager";
@@ -23,10 +23,34 @@ export declare class Collector extends BaseCollector<ISerializableStorageViewDat
23
23
  private stateDisposer;
24
24
  private authDisposer;
25
25
  private asyncClockState;
26
+ /** Updates received while the shared sync callback is pending. */
27
+ private pendingSyncViews;
28
+ private pendingSyncStorage?;
26
29
  private limitNums;
30
+ private destroyed;
31
+ private storageRevision;
32
+ private viewStorageRevisions;
33
+ private sceneStorageRevisions;
34
+ /** View-local terminal fence for idle sync callbacks after delete-storage. */
35
+ private discardedSyncViews;
27
36
  private syncInterval;
28
37
  constructor(control: BaseApplianceManager, plugin: AppliancePluginLike, syncInterval: number);
29
- get Logger(): import("..").Logger;
38
+ get Logger(): import("../plugin/utils").LoggerUtils;
39
+ discardViewPendingSync(viewId: string): void;
40
+ restoreViewPendingSync(viewId: string): void;
41
+ isViewPendingSyncDiscarded(viewId: string): boolean;
42
+ private canRunSync;
43
+ private getSceneRevisionKey;
44
+ private getSceneDiffKey;
45
+ private getDataDiffKey;
46
+ private bumpStorageRevision;
47
+ /**
48
+ * A deferred sync may hold a snapshot captured before closeApp/delete-storage.
49
+ * Filter terminal Views at the last possible moment so a later update from a
50
+ * different View cannot re-create the deleted View on the remote side.
51
+ * Nested scene/record objects are intentionally shared read-only references.
52
+ */
53
+ private filterDiscardedViews;
30
54
  hasId(viewId: string, scenePath: string, key: string): boolean;
31
55
  private getLimitNum;
32
56
  private getLimitNums;
@@ -38,6 +62,19 @@ export declare class Collector extends BaseCollector<ISerializableStorageViewDat
38
62
  scenePath: string | undefined;
39
63
  };
40
64
  getStorageData(viewId: string, scenePath: string): ISerializableStorageData | undefined;
65
+ /**
66
+ * Return a synchronous, read-only, deep copy of all service storage for one
67
+ * View. Init Padding uses this as its single authoritative baseline.
68
+ */
69
+ getServiceStorageViewSnapshot(viewId: string): ISerializableStorageScenePathData;
70
+ readViewStorageSnapshot(viewId: string): {
71
+ revision: number;
72
+ storage: ISerializableStorageScenePathData;
73
+ };
74
+ readSceneStorageSnapshot(viewId: string, scenePath: string): {
75
+ revision: number;
76
+ storage: ISerializableStorageData;
77
+ };
41
78
  hasSelector(viewId: string, scenePath: string): boolean;
42
79
  hasIncludeSelector(targetKey: string, targetViewId?: string, targetScenePath?: string): boolean;
43
80
  addStorageStateListener(callBack: (diff: Diff) => void): void;
@@ -62,7 +99,18 @@ export declare class Collector extends BaseCollector<ISerializableStorageViewDat
62
99
  isSync?: boolean;
63
100
  storage?: ISerializableStorageViewData;
64
101
  onApplied?: () => void;
102
+ preserveLastOperator?: boolean;
65
103
  }): void;
104
+ /**
105
+ * Repair-only update. Unlike updateValue(), this never creates a missing
106
+ * View or Scene, so closeApp/delete-storage can win a concurrent repair.
107
+ */
108
+ updateExistingValue(key: string, value: any, options: {
109
+ viewId: string;
110
+ scenePath: string;
111
+ isSync?: boolean;
112
+ preserveLastOperator?: boolean;
113
+ }): boolean;
66
114
  private runSyncService;
67
115
  private syncSerivice;
68
116
  private logLocalSyncChanges;
@@ -10,12 +10,16 @@ export declare type DiffOneScenePath<ISerializableStorageScenePathData> = {
10
10
  oldValue?: ISerializableStorageScenePathData;
11
11
  newValue?: ISerializableStorageScenePathData;
12
12
  viewId: string;
13
+ /** Logical scene path; the containing map key is collision-safe, not public data. */
14
+ scenePath?: string;
13
15
  };
14
16
  export declare type DiffOneData<ISerializableStorageData> = {
15
17
  oldValue: ISerializableStorageData;
16
18
  newValue: ISerializableStorageData;
17
19
  viewId: string;
18
20
  scenePath: string;
21
+ /** Logical storage key; the containing map key is collision-safe. */
22
+ storageKey?: string;
19
23
  };
20
24
  export declare type DiffView<ISerializableStorageViewData> = {
21
25
  [K in keyof ISerializableStorageViewData]?: DiffOneView<ISerializableStorageViewData[K]>;
@@ -37,6 +41,8 @@ export interface INormalPushMsg {
37
41
  toolsType?: EToolsKey;
38
42
  opt?: ShapeOptions;
39
43
  uid?: string;
44
+ /** Stable room user id of the last writer of this persisted record. */
45
+ lastOperator?: string;
40
46
  taskId?: number;
41
47
  namespace?: string;
42
48
  op?: number[];
@@ -21,6 +21,7 @@ export declare class BackgroundThreadEngineImpl implements BackgroundThreadEngin
21
21
  master: MasterControlForWorker;
22
22
  private cameraOpt?;
23
23
  private methodBuilder;
24
+ private destroyed;
24
25
  constructor(viewId: string, opt: IBackgroundThreadInitOption);
25
26
  get camera(): ICameraOpt;
26
27
  get view(): View | undefined;
@@ -13,10 +13,13 @@ export declare class BackgroundSnapshotThreadImpl {
13
13
  private cameraOpt?;
14
14
  readonly opt: IBackgroundThreadInitOption;
15
15
  workShapes: Map<string, BaseShapeTool>;
16
+ private destroyed;
17
+ private activeRequest?;
16
18
  get camera(): ICameraOpt;
17
19
  get view(): View | undefined;
18
20
  get markmapOptions(): Partial<IMarkmapOptions> | undefined;
19
21
  constructor(viewId: string, opt: IBackgroundThreadInitOption);
22
+ private reportRequestFailure;
20
23
  createOffscreenCanvas(opt: IBackgroundThreadInitOption): void;
21
24
  setCameraOpt(cameraOpt: ICameraOpt): Promise<void>;
22
25
  getPagePoint(x: number, y: number): {
@@ -27,5 +30,5 @@ export declare class BackgroundSnapshotThreadImpl {
27
30
  private createWorkShapeNode;
28
31
  private setFullWork;
29
32
  runFullWork(data: IWorkerMessage): Promise<void>;
30
- destroy(): void;
33
+ destroy(reason?: string): void;
31
34
  }
@@ -23,6 +23,8 @@ export interface TextEditorManager {
23
23
  computeTextActive(point: [number, number], viewId: string): void;
24
24
  /** 校验是否删除空文本或事失焦 */
25
25
  checkEmptyTextBlur(): void;
26
+ /** 生命周期边界立即收口指定 View 的全部本地 Text。 */
27
+ forceDoneLocalText(targetViewIds?: readonly string[]): void;
26
28
  /** 激活文本编辑组件 */
27
29
  active(workId: string, undoTickerId?: number): void;
28
30
  /** 不激活文本编辑组件 */
@@ -109,6 +111,7 @@ export declare class TextEditorManagerImpl implements TextEditorManager {
109
111
  computeTextActive(point: [number, number], viewId: string): void;
110
112
  checkLocalTextBlur: import("lodash").DebouncedFunc<() => void>;
111
113
  checkEmptyTextBlur(): void;
114
+ forceDoneLocalText(targetViewIds?: readonly string[]): void;
112
115
  onCameraChange(cameraOpt: ICameraOpt, viewId: string): void;
113
116
  deriveTextEditorInfoFromServiceData(data: IWorkerMessage, options?: {
114
117
  canWorker?: boolean;
@@ -19,17 +19,22 @@ export interface BackgroundThreadManager {
19
19
  createSnapshotThread(viewId: string, opt: IBackgroundThreadInitOption): BackgroundSnapshotThreadImpl;
20
20
  consume(msg: Set<IWorkerMessage>): Promise<void>;
21
21
  post(sp: Omit<IBatchMainMessage, "render">): void;
22
+ discardView(viewId: string): void;
22
23
  destroy(): void;
23
24
  }
24
25
  export declare class BackgroundThreadManagerImpl implements BackgroundThreadManager {
25
26
  backgroundThreadMap: Map<string, BackgroundThreadEngineImpl>;
26
- private snapshotThread?;
27
+ private snapshotThreadsByRequest;
28
+ private destroyed;
27
29
  master: MasterControlForWorker;
28
30
  constructor(master: MasterControlForWorker);
29
31
  createBackgroundThread(viewId: string, opt: IBackgroundThreadInitOption): BackgroundThreadEngineImpl;
30
32
  createSnapshotThread(viewId: string, opt: IBackgroundThreadInitOption): BackgroundSnapshotThreadImpl;
33
+ private getSnapshotRequestKey;
34
+ private disposeSnapshotThread;
31
35
  consume(msg: Set<IWorkerMessage>): Promise<void>;
32
36
  consumeTargetOne(viewId: string, msg: IWorkerMessage): Promise<void>;
33
37
  post: (msg: Omit<IBatchMainMessage, "render">) => void;
38
+ discardView(viewId: string): void;
34
39
  destroy(): void;
35
40
  }
@@ -0,0 +1,45 @@
1
+ import type { CameraTaskStatus, ICameraTaskError } from "./types";
2
+ /**
3
+ * A valid downstream error payload takes precedence over the protocol's
4
+ * default-success status. Explicit failure statuses remain terminal even when
5
+ * an older renderer omitted the optional payload.
6
+ */
7
+ export declare function normalizeCameraTaskError(status: CameraTaskStatus | undefined, error?: ICameraTaskError, workerType?: string): ICameraTaskError | undefined;
8
+ export type CameraUpdateTaskStage = "update-camera" | "blocking-works" | "prepare-render";
9
+ export interface CameraUpdateTaskContext {
10
+ readonly cameraTaskId?: number;
11
+ readonly startedAt: number;
12
+ readonly deadlineAt: number;
13
+ readonly abortPromise: Promise<void>;
14
+ /** Cancelled by the owning View when it is destroyed. */
15
+ abort?: () => void;
16
+ aborted: boolean;
17
+ stage: CameraUpdateTaskStage;
18
+ blockingWorks?: string[];
19
+ }
20
+ export declare class CameraUpdateTimeoutError extends Error {
21
+ readonly code = "RENDERER_BUSINESS_TIMEOUT";
22
+ readonly business = "updateCamera";
23
+ readonly cameraTaskId?: number;
24
+ readonly elapsedMs: number;
25
+ readonly stage: CameraUpdateTaskStage;
26
+ readonly blockingWorks?: string[];
27
+ constructor(context: CameraUpdateTaskContext, timeoutMs: number);
28
+ }
29
+ /**
30
+ * The owning renderer was destroyed while a Camera business operation was
31
+ * still waiting on a non-cancellable platform Promise. This is a local
32
+ * lifecycle failure, not a renderer timeout; callers still publish a failed
33
+ * Camera ACK so the queue can advance.
34
+ */
35
+ export declare class CameraUpdateAbortedError extends Error {
36
+ readonly code = "RENDERER_BUSINESS_ABORTED";
37
+ readonly business = "updateCamera";
38
+ readonly cameraTaskId?: number;
39
+ readonly stage: CameraUpdateTaskStage;
40
+ readonly blockingWorks?: string[];
41
+ constructor(context: CameraUpdateTaskContext);
42
+ }
43
+ export declare function runCameraUpdateWithTimeout(cameraTaskId: number | undefined, run: (context: CameraUpdateTaskContext) => Promise<void>, timeoutMs?: number): Promise<void>;
44
+ export declare function waitForCameraUpdateTask(context: CameraUpdateTaskContext, task: Promise<unknown>, stage: CameraUpdateTaskStage): Promise<boolean>;
45
+ export declare function isCameraUpdateTimeoutError(error: unknown): error is CameraUpdateTimeoutError;
@@ -1,3 +1,7 @@
1
1
  export declare const Cursor_Hover_Id = "cursorhover";
2
2
  export declare const Task_Time_Interval = 20;
3
3
  export declare const Main_View_Id = "mainView";
4
+ export declare const Renderer_Business_Default_Timeout = 500;
5
+ export declare const Camera_Update_Business_Timeout = 500;
6
+ export declare const Camera_Ack_Slow_Timeout = 500;
7
+ export declare const Camera_Transport_Fallback_Timeout = 1000;
@@ -140,7 +140,11 @@ export declare enum EPostMessageType {
140
140
  /** 内部文字刷新绘制完成 */
141
141
  RefreshTextRender = 37,
142
142
  /** 在 Worker 自身上下文探测渲染能力 */
143
- ProbeRenderCapabilities = 38
143
+ ProbeRenderCapabilities = 38,
144
+ /** 初始化 service snapshot 已完成 renderer 提交 */
145
+ ServiceSyncCommit = 39,
146
+ /** 取消尚未完成的字体加载请求,仅用于内部 Worker 协议 */
147
+ CancelFontFace = 40
144
148
  }
145
149
  export type ECanvasContextType = "webgl2" | "webgl" | "2d";
146
150
  export declare enum ECanvasShowType {
@@ -0,0 +1 @@
1
+ export declare function getErrorMessage(error: unknown): string;
@@ -12,14 +12,15 @@ export declare class FontFaceManager {
12
12
  private readonly getSubWorker;
13
13
  private readonly indexDBUtils;
14
14
  private fontFaceWorkerResolveMap;
15
- private fontFacesLoadingPromise?;
15
+ private fontFaceLoadGeneration;
16
+ private activeFontFaceAttempt?;
16
17
  private lastFontFacesAlreadyReady;
17
- private fontFaceLoadStateStarted;
18
18
  private documentFontsReadyLogged;
19
+ private readonly documentFontsReadyWaiters;
19
20
  constructor(props: FontFaceManagerProps);
20
21
  destroy(): void;
21
22
  private get Logger();
22
- waitDocumentFontsReady(reason: string): Promise<void>;
23
+ waitDocumentFontsReady(reason: string, timeoutMs?: number, signal?: AbortSignal): Promise<void>;
23
24
  clearFontCache(): Promise<boolean>;
24
25
  getFontCacheStatus(): Promise<{
25
26
  count: number;
@@ -34,6 +35,7 @@ export declare class FontFaceManager {
34
35
  private getWorkers;
35
36
  private areWorkerFontFacesReady;
36
37
  private waitWorkerReadyForFontFaces;
38
+ private assertAttemptActive;
37
39
  private getRuntimeFontFacesReadyState;
38
40
  private loadFontFaceBuffers;
39
41
  private setDocumentFontFaces;