@netless/appliance-plugin 1.0.1 → 1.0.3

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 (76) hide show
  1. package/README.md +52 -14
  2. package/cdn/cdn.js +1 -1
  3. package/cdn/fullWorker-uIttd_.js +437 -0
  4. package/cdn/subWorker-4wkCzC.js +437 -0
  5. package/dist/appliance-plugin.js +1 -1
  6. package/dist/appliance-plugin.mjs +14 -13
  7. package/dist/collector/base.d.ts +3 -1
  8. package/dist/collector/collector.d.ts +5 -4
  9. package/dist/collector/eventCollector.d.ts +2 -1
  10. package/dist/collector/magixEventCollector.d.ts +30 -0
  11. package/dist/collector/types.d.ts +27 -7
  12. package/dist/component/textEditor/manager.d.ts +2 -2
  13. package/dist/component/textEditor/types.d.ts +0 -1
  14. package/dist/component/textEditor/view.d.ts +4 -1
  15. package/dist/core/const.d.ts +2 -0
  16. package/dist/core/enum.d.ts +12 -5
  17. package/dist/core/mainEngine.d.ts +31 -10
  18. package/dist/core/mainThread/base.d.ts +6 -2
  19. package/dist/core/mainThread/snapshotThread.d.ts +3 -3
  20. package/dist/core/mainThread/subLocalThread.d.ts +18 -10
  21. package/dist/core/mainThread/subServiceThread.d.ts +2 -1
  22. package/dist/core/mainThread/subTopThread.d.ts +15 -8
  23. package/dist/core/msgEvent/deleteNode/forMainThread.d.ts +1 -5
  24. package/dist/core/msgEvent/deleteNode/forWorker.d.ts +1 -5
  25. package/dist/core/msgEvent/scaleNode/forMain.d.ts +7 -6
  26. package/dist/core/msgEvent/setFont/forMain.d.ts +2 -1
  27. package/dist/core/msgEvent/translateNode/forMain.d.ts +0 -1
  28. package/dist/core/tools/arrow.d.ts +36 -7
  29. package/dist/core/tools/base.d.ts +22 -8
  30. package/dist/core/tools/ellipse.d.ts +36 -7
  31. package/dist/core/tools/eraser.d.ts +40 -4
  32. package/dist/core/tools/image.d.ts +9 -5
  33. package/dist/core/tools/laserPen.d.ts +34 -4
  34. package/dist/core/tools/pencil.d.ts +37 -4
  35. package/dist/core/tools/polygon.d.ts +36 -7
  36. package/dist/core/tools/rectangle.d.ts +36 -7
  37. package/dist/core/tools/selector.d.ts +52 -5
  38. package/dist/core/tools/speechBalloon.d.ts +36 -8
  39. package/dist/core/tools/star.d.ts +36 -7
  40. package/dist/core/tools/straight.d.ts +36 -7
  41. package/dist/core/tools/text.d.ts +20 -10
  42. package/dist/core/tools/utils.d.ts +6 -5
  43. package/dist/core/types.d.ts +1 -3
  44. package/dist/core/utils/index.d.ts +10 -0
  45. package/dist/core/utils/math.d.ts +9 -2
  46. package/dist/core/{mainThread/vNodeManager.d.ts → vNodeManager.d.ts} +10 -3
  47. package/dist/core/worker/base.d.ts +18 -16
  48. package/dist/core/worker/fullWorkerLocal.d.ts +18 -9
  49. package/dist/core/worker/fullWorkerService.d.ts +10 -9
  50. package/dist/core/worker/subWorkerLocal.d.ts +5 -8
  51. package/dist/core/worker/subWorkerTopLayer.d.ts +13 -9
  52. package/dist/core/worker/workerManager.d.ts +18 -10
  53. package/dist/cursors/index.d.ts +44 -18
  54. package/dist/displayer/floatBtns/del.d.ts +1 -1
  55. package/dist/displayer/floatBtns/lock.d.ts +1 -1
  56. package/dist/fullWorker.js +141 -157
  57. package/dist/index-BdHH_zhp.js +1 -0
  58. package/dist/index-RCWmSJU4.mjs +9601 -0
  59. package/dist/index-RcUgPE7z.mjs +5570 -0
  60. package/dist/index-a-uKt6aD.js +1 -0
  61. package/dist/plugin/applianceSinglePlugin.d.ts +1 -0
  62. package/dist/plugin/baseApplianceManager.d.ts +7 -1
  63. package/dist/plugin/baseViewContainerManager.d.ts +0 -3
  64. package/dist/plugin/const.d.ts +11 -1
  65. package/dist/plugin/displayerView.d.ts +3 -5
  66. package/dist/plugin/multi/containerManager.d.ts +2 -1
  67. package/dist/style.css +1 -1
  68. package/dist/subWorker.js +141 -157
  69. package/package.json +2 -3
  70. package/cdn/fullWorker-CIvt1j.js +0 -453
  71. package/cdn/subWorker-BE-0dg.js +0 -453
  72. package/dist/core/worker/vNodeManager.d.ts +0 -34
  73. package/dist/index-BcIJbozZ.js +0 -1
  74. package/dist/index-C1YKkWHE.mjs +0 -9090
  75. package/dist/index-ClJPZxV-.mjs +0 -5462
  76. package/dist/index-SsMz_ohn.js +0 -1
package/README.md CHANGED
@@ -11,8 +11,8 @@ A whiteboard pencil drawing plugin based on SpriteJS as a rendering engine.
11
11
  The following two demos are implemented in the example folder for reference only.
12
12
  | scenario | demo path | depends on |
13
13
  | :-- | :----: | :-- |
14
- | multi-window | example/src/multi.ts | @netless/window-manager, white-web-sdk |
15
- | white-board | example/src/single.ts | white-web-sdk |
14
+ | multi-window | [example/src/multi.ts](https://github.com/hqer927/appliance-plugin/blob/master/example/src/multi.ts) | @netless/window-managerwhite-web-sdk |
15
+ | white-board | [example/src/single.ts](https://github.com/hqer927/appliance-plugin/blob/master/example/src/single.ts) | white-web-sdk |
16
16
  <!-- | fastboard | todo | todo | -->
17
17
 
18
18
  ## Principle
@@ -71,7 +71,7 @@ const room = await whiteWebSdk.joinRoom({
71
71
  invisiblePlugins: [WindowManager, ApplianceMultiPlugin],
72
72
  useMultiViews: true,
73
73
  })
74
- const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportTeachingAidsPlugin: true});
74
+ const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportAppliancePlugin: true});
75
75
  if (manager) {
76
76
  await manager.switchMainViewToWriter();
77
77
  await ApplianceMultiPlugin.getInstance(manager,
@@ -134,8 +134,29 @@ module: {
134
134
  },
135
135
  ```
136
136
 
137
- ### Call introduction
138
- The plug-in re-implements some interfaces of the same name on room or window or manager. If you do not use the interface on the plug-in, you will not get the desired effect. But we can use injectMethodToObject to re-inject it back into the original object to get the plugin's intended effect. As follows:
137
+ ## Call introduction
138
+ ### api introduction
139
+ The plugin re-implements some of the interfaces of the same name on room or Windows Manager, but internally we have re-injected them back into the original object via injectMethodToObject. No changes are required for external users. As follows:
140
+ ```js
141
+ // Internal hack
142
+ injectMethodToObject(windowmanager, 'undo');
143
+ injectMethodToObject(windowmanager, 'redo');
144
+ injectMethodToObject(windowmanager,'cleanCurrentScene');
145
+ injectMethodToObject(windowmanager,'insertImage');
146
+ injectMethodToObject(windowmanager,'completeImageUpload');
147
+ injectMethodToObject(windowmanager,'lockImage');
148
+ injectMethodToObject(room,'getImagesInformation');
149
+ injectMethodToObject(room,'callbacks');
150
+ injectMethodToObject(room,'screenshotToCanvasAsync');
151
+ injectMethodToObject(room,'getBoundingRectAsync');
152
+ injectMethodToObject(room,'scenePreviewAsync');
153
+ injectMethodToObject(windowmanager.mainView,'setMemberState');
154
+ // These we can see the call behavior through the front-end log, for example:
155
+ // [ApplianceMultiPlugin] setMemberState
156
+ // [ApplianceMultiPlugin] cleanCurrentScene
157
+ ```
158
+ The following interfaces are involved:
159
+
139
160
  1. Interface on room
140
161
  - `setMemberState`
141
162
  - `undo`
@@ -165,13 +186,30 @@ The plug-in re-implements some interfaces of the same name on room or window or
165
186
  - `getBoundingRectAsync`
166
187
  - `screenshotToCanvasAsync`
167
188
  - `scenePreviewAsync`
168
- - `destroy`
169
- - `injectMethodToObject`
170
-
171
- **The injectMethodToObject interface can rebind the plugin's reimplemented method to the desired object.** For example:
172
-
189
+ - `destroy`
190
+
191
+ ### Configure parameters
192
+ ``getInstance(wm: WindowManager, adaptor: ApplianceAdaptor)``
193
+ - wm: WindowManager\room\player. In multi-window mode, you pass WindowManager, and in single-window mode, you pass room or player(whiteboard playback mode).
194
+ - adaptor: configures the adapter.
195
+ - options: ``AppliancePluginOptions``; The cdn addresses of both workers must be configured.
196
+ ```js
197
+ export type AppliancePluginOptions = {
198
+ /** cdn Configuration item */
199
+ cdn: CdnOpt;
200
+ /** Synchronize data configuration items */
201
+ syncOpt? : SyncOpt;
202
+ /** Canvas configuration item */
203
+ canvasOpt? : CanvasOpt;
204
+ }
205
+ ```
206
+ - cursorAdapter? : ``CursorAdapter``; This parameter is optional. In single whiteboard mode, customize the mouse style.
207
+
208
+ ### Front-end debugging introduction
209
+ During the interconnection process, if you want to understand and track the internal status of the plug-in, you can view the internal data through the following console commands.
210
+
173
211
  ```js
174
- // The purpose is to bind the plugin's undo operation to room. Keep outside calls to undo logic from room.
175
- plugin.injectMethodToObject(room,'undo');
176
- ```
177
- So, the interface of the same name on room,window-manager, or Window-Manager.mainView can be injected into the original object using injectMethodToObject.
212
+ const applianPlugin = await ApplianceSinglePlugin.getInstance(...)
213
+ applianPlugin.CurrentManager // can see the package version number, internal state, etc
214
+ applianPlugin.CurrentManager.ConsoleWorkerInfo () // can check information to draw on the worker
215
+ ```
package/cdn/cdn.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-CIvt1j.js",e="/subWorker-BE-0dg.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-uIttd_.js",e="/subWorker-4wkCzC.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;