@netless/appliance-plugin 1.0.0-beta.0 → 1.0.0-beta.10

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 (98) hide show
  1. package/README.md +54 -15
  2. package/cdn/cdn.js +1 -0
  3. package/cdn/fullWorker-DkNRgu.js +468 -0
  4. package/cdn/subWorker-BvxT1L.js +468 -0
  5. package/dist/appliance-plugin.js +1 -1
  6. package/dist/appliance-plugin.mjs +22 -8637
  7. package/dist/cdn.d.ts +3 -0
  8. package/dist/collector/types.d.ts +0 -1
  9. package/dist/component/textEditor/manager.d.ts +2 -5
  10. package/dist/component/textEditor/types.d.ts +1 -0
  11. package/dist/component/textEditor/view.d.ts +9 -7
  12. package/dist/core/enum.d.ts +8 -9
  13. package/dist/core/mainEngine.d.ts +37 -15
  14. package/dist/core/mainThread/base.d.ts +81 -0
  15. package/dist/core/mainThread/index.d.ts +23 -0
  16. package/dist/core/mainThread/snapshotThread.d.ts +39 -0
  17. package/dist/core/mainThread/subLocalThread.d.ts +102 -0
  18. package/dist/core/mainThread/subServiceThread.d.ts +42 -0
  19. package/dist/core/mainThread/subTopThread.d.ts +46 -0
  20. package/dist/core/mainThread/vNodeManager.d.ts +32 -0
  21. package/dist/core/msgEvent/baseForMainThread.d.ts +13 -0
  22. package/dist/core/msgEvent/copyNode/forMain.d.ts +2 -0
  23. package/dist/core/msgEvent/copyNode/forMainThread.d.ts +8 -0
  24. package/dist/core/msgEvent/deleteNode/forMainThread.d.ts +13 -0
  25. package/dist/core/msgEvent/forMainThread.d.ts +14 -0
  26. package/dist/core/msgEvent/rotateNode/forMain.d.ts +0 -1
  27. package/dist/core/msgEvent/rotateNode/forMainThread.d.ts +9 -0
  28. package/dist/core/msgEvent/scaleNode/forMain.d.ts +2 -1
  29. package/dist/core/msgEvent/scaleNode/forMainThread.d.ts +9 -0
  30. package/dist/core/msgEvent/setColor/forMain.d.ts +2 -1
  31. package/dist/core/msgEvent/setColor/forMainThread.d.ts +9 -0
  32. package/dist/core/msgEvent/setFont/forMainThread.d.ts +9 -0
  33. package/dist/core/msgEvent/setLock/forMainThread.d.ts +9 -0
  34. package/dist/core/msgEvent/setPoint/forMainThread.d.ts +9 -0
  35. package/dist/core/msgEvent/setShape/forMainThread.d.ts +9 -0
  36. package/dist/core/msgEvent/setZIndex/forMainThread.d.ts +9 -0
  37. package/dist/core/msgEvent/translateNode/forMain.d.ts +0 -1
  38. package/dist/core/msgEvent/translateNode/forMainThread.d.ts +9 -0
  39. package/dist/core/tools/arrow.d.ts +3 -3
  40. package/dist/core/tools/base.d.ts +5 -5
  41. package/dist/core/tools/ellipse.d.ts +3 -3
  42. package/dist/core/tools/eraser.d.ts +3 -3
  43. package/dist/core/tools/image.d.ts +2 -0
  44. package/dist/core/tools/pencil.d.ts +3 -2
  45. package/dist/core/tools/polygon.d.ts +4 -3
  46. package/dist/core/tools/rectangle.d.ts +4 -3
  47. package/dist/core/tools/selector.d.ts +11 -9
  48. package/dist/core/tools/speechBalloon.d.ts +4 -3
  49. package/dist/core/tools/star.d.ts +3 -3
  50. package/dist/core/tools/straight.d.ts +4 -3
  51. package/dist/core/tools/text.d.ts +7 -4
  52. package/dist/core/tools/utils.d.ts +7 -3
  53. package/dist/core/types.d.ts +16 -4
  54. package/dist/core/utils/index.d.ts +1 -1
  55. package/dist/core/utils/math.d.ts +3 -0
  56. package/dist/core/utils/spriteNode.d.ts +2 -2
  57. package/dist/core/worker/base.d.ts +17 -34
  58. package/dist/core/worker/fullWorkerLocal.d.ts +1 -1
  59. package/dist/core/worker/fullWorkerService.d.ts +23 -7
  60. package/dist/core/worker/subWorkerLocal.d.ts +1 -6
  61. package/dist/core/worker/subWorkerTopLayer.d.ts +43 -0
  62. package/dist/core/worker/vNodeManager.d.ts +3 -2
  63. package/dist/core/worker/workerManager.d.ts +16 -16
  64. package/dist/displayer/floatBar/dragBox/index.d.ts +4 -0
  65. package/dist/displayer/floatBar/index.d.ts +1 -5
  66. package/dist/fullWorker.js +468 -0
  67. package/dist/index-B3tcgIQd.js +1 -0
  68. package/dist/index-BFpq0pIU.mjs +8844 -0
  69. package/dist/index-CP5_CnSG.mjs +5419 -0
  70. package/dist/index-ChX1QimR.js +1 -0
  71. package/dist/index.d.ts +1 -0
  72. package/dist/plugin/applianceMultiPlugin.d.ts +1 -1
  73. package/dist/plugin/applianceSinglePlugin.d.ts +1 -1
  74. package/dist/plugin/baseApplianceManager.d.ts +5 -5
  75. package/dist/plugin/baseViewContainerManager.d.ts +6 -4
  76. package/dist/plugin/const.d.ts +13 -0
  77. package/dist/plugin/displayerView.d.ts +4 -11
  78. package/dist/plugin/index.d.ts +2 -3
  79. package/dist/plugin/multi/applianceMultiManager.d.ts +1 -1
  80. package/dist/plugin/multi/containerManager.d.ts +3 -1
  81. package/dist/plugin/multi/displayer/appViewDisplayerManager.d.ts +2 -1
  82. package/dist/plugin/multi/displayer/mainViewDisplayerManager.d.ts +3 -1
  83. package/dist/plugin/single/applianceSingleManager.d.ts +1 -1
  84. package/dist/plugin/single/containerManager.d.ts +1 -1
  85. package/dist/plugin/single/displayer/mainViewDisplayerManager.d.ts +3 -1
  86. package/dist/plugin/types.d.ts +9 -3
  87. package/dist/style.css +1 -1
  88. package/dist/subWorker.js +468 -0
  89. package/dist/undo/index.d.ts +1 -2
  90. package/package.json +15 -17
  91. package/cdn/appliance-plugin.js +0 -1
  92. package/cdn/appliance-plugin.mjs +0 -8639
  93. package/cdn/style.css +0 -1
  94. package/dist/core/msgEvent/activeZIndex/forMain.d.ts +0 -12
  95. package/dist/core/msgEvent/activeZIndex/forWorker.d.ts +0 -8
  96. /package/dist/displayer/{highlightBox → floatBar/highlightBox}/index.d.ts +0 -0
  97. /package/dist/displayer/{resizable → floatBar/resizable}/index.d.ts +0 -0
  98. /package/dist/displayer/{rotate → floatBar/rotate}/index.d.ts +0 -0
package/README.md CHANGED
@@ -33,25 +33,18 @@ npm install @netless/appliance-plugin
33
33
  Plug-ins can support two scenarios, their access plug-in names are different:
34
34
  - Multi-window 'ApplianceMultiPlugin'
35
35
  ```js
36
- // All bundled
37
36
  import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
38
- // cdn
39
- // import { ApplianceMultiPlugin } from '@netless/appliance-plugin/cdn';
40
37
  ```
41
38
  - Single whiteboard 'ApplianceSinglePlugin'
42
39
  ```js
43
- // All bundled
44
40
  import { ApplianceSinglePlugin } from '@netless/appliance-plugin';
45
- // cdn
46
- // import { ApplianceSinglePlugin } from '@netless/appliance-plugin/cdn';
47
41
  ```
48
42
 
49
- > About cdn version description
43
+ > workerjs file cdn deployment
50
44
  >
51
- > Since worker is logic independent of main thread js, public packages in worker, such as spritejs, etc. These are all repeated into workerjs, so we have introduced the cdn version to include these public packages in the cdn
45
+ > We used two-worker concurrency to improve drawing efficiency, which improved it by more than 40% over single-thread efficiency. However, the common dependencies on the two worker files are repeated, so building directly into the package will greatly increase the package size. So we allow the workerjs file cdn deployment by simply deploying the file under @netless/appliance-plugin/cdn into the cdn and then configuring the c of the last two workerjs via the second parameter of getInstance in the plug-in, options.cdn The dn address is fine. This solves the problem of excessive package size
52
46
  >
53
- > - **cdn package is about 700kb, full package is about 2100kb.** If you need to consider the size of the package to be built, please choose reasonably.
54
- > - The cdn version reduces the size of the package, but there are network problems, please fully consider it
47
+ > - **The total package is about 300kB, and the two wokerjs are 600kB each** If you need to consider the size of the package you are building, select Configure cdn.
55
48
 
56
49
  ### Access mode reference
57
50
 
@@ -64,7 +57,13 @@ import { WindowManager } from "@netless/window-manager";
64
57
  // All bundled
65
58
  import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
66
59
  // cdn
67
- // import { ApplianceMultiPlugin } from '@netless/appliance-plugin/cdn';
60
+ // The following steps are optional. If you use cdn, you do not need to import from dist. If you import from dist, you need to import resources and configure them to options.cdn in bolb inline form. Such as? raw, this requires packaging support,vite default support? raw,webpack needs to be configured.
61
+ import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
62
+ import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
63
+ const fullWorkerBlob = new Blob([fullWorkerString], {type: 'text/javascript'});
64
+ const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
65
+ const subWorkerBlob = new Blob([subWorkerString], {type: 'text/javascript'});
66
+ const subWorkerUrl = URL.createObjectURL(subWorkerBlob);
68
67
 
69
68
  const whiteWebSdk = new WhiteWebSdk(...)
70
69
  const room = await whiteWebSdk.joinRoom({
@@ -75,7 +74,16 @@ useMultiViews: true,
75
74
  const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportTeachingAidsPlugin: true});
76
75
  if (manager) {
77
76
  await manager.switchMainViewToWriter();
78
- await ApplianceMultiPlugin.getInstance(manager);
77
+ await ApplianceMultiPlugin.getInstance(manager,
78
+ {
79
+ options: {
80
+ cdn: {
81
+ fullWorkerUrl,
82
+ subWorkerUrl,
83
+ }
84
+ }
85
+ }
86
+ );
79
87
  }
80
88
  ```
81
89
  #### Single whiteboard (interconnection with white-web-sdk)
@@ -83,8 +91,13 @@ await ApplianceMultiPlugin.getInstance(manager);
83
91
  import { WhiteWebSdk } from "white-web-sdk";
84
92
  // All bundled
85
93
  import { ApplianceSinglePlugin, ApplianceSigleWrapper } from '@netless/appliance-plugin';
86
- // cdn
87
- // import { ApplianceMultiPlugin } from '@netless/appliance-plugin/cdn';
94
+ // The following steps are optional. If you use cdn, you do not need to import from dist. If you import from dist, you need to import resources and configure them to options.cdn in bolb inline form. Such as? raw, this requires packaging support,vite default support? raw,webpack needs to be configured.
95
+ import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
96
+ import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
97
+ const fullWorkerBlob = new Blob([fullWorkerString], {type: 'text/javascript'});
98
+ const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
99
+ const subWorkerBlob = new Blob([subWorkerString], {type: 'text/javascript'});
100
+ const subWorkerUrl = URL.createObjectURL(subWorkerBlob);
88
101
 
89
102
  const whiteWebSdk = new WhiteWebSdk(...)
90
103
  const room = await whiteWebSdk.joinRoom({
@@ -92,7 +105,33 @@ const room = await whiteWebSdk.joinRoom({
92
105
  invisiblePlugins: [ApplianceSinglePlugin],
93
106
  wrappedComponents: [ApplianceSigleWrapper]
94
107
  })
95
- await ApplianceSinglePlugin.getInstance(room);
108
+ await ApplianceSinglePlugin.getInstance(room,
109
+ {
110
+ options: {
111
+ cdn: {
112
+ fullWorkerUrl,
113
+ subWorkerUrl,
114
+ }
115
+ }
116
+ }
117
+ );
118
+ ```
119
+ #### About ’?raw‘ webpack configuration
120
+ ```js
121
+ module: {
122
+ rules: [
123
+ // ...
124
+ {
125
+ test: /\.m?js$/,
126
+ resourceQuery: { not: [/raw/] },
127
+ use: [ ... ]
128
+ },
129
+ {
130
+ resourceQuery: /raw/,
131
+ type: 'asset/source',
132
+ }
133
+ ]
134
+ },
96
135
  ```
97
136
 
98
137
  ### Call introduction
package/cdn/cdn.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-DkNRgu.js",e="/subWorker-BvxT1L.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;