@netless/appliance-plugin 1.1.36-beta.0 → 1.1.36-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.
- package/READMA.zh-CN.md +47 -48
- package/README.md +17 -49
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/assets/fullWorker-D9xRgd20.js +593 -0
- package/dist/assets/subWorker-DDz22vt8.js +593 -0
- package/dist/{bridge-DO3A2FRh.js → bridge-BKHuhuVK.js} +1 -1
- package/dist/bridge-g7eU9k12.mjs +67 -0
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/collector/collector.d.ts +1 -0
- package/dist/collector/types.d.ts +5 -1
- package/dist/component/textEditor/manager.d.ts +8 -1
- package/dist/component/textEditor/types.d.ts +5 -0
- package/dist/component/textEditor/utils.d.ts +21 -0
- package/dist/component/textEditor/view.d.ts +0 -4
- package/dist/core/enum.d.ts +3 -1
- package/dist/core/mainEngine.d.ts +4 -1
- package/dist/core/msgEvent/copyNode/forMain.d.ts +3 -0
- package/dist/core/msgEvent/copyNode/utils.d.ts +9 -0
- package/dist/core/msgEvent/deleteNode/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setColor/forMain.d.ts +2 -0
- package/dist/core/msgEvent/setFont/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setLock/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setShape/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setZIndex/forMain.d.ts +2 -0
- package/dist/core/tools/pencil.d.ts +1 -0
- package/dist/core/tools/selector.d.ts +4 -0
- package/dist/core/types.d.ts +6 -0
- package/dist/core/worker/fullWorkerLocal.d.ts +4 -4
- package/dist/core/worker/simpleWorker.d.ts +2 -2
- package/dist/displayer/floatBar/dragBox/activateSelectorText.d.ts +13 -0
- package/dist/displayer/floatBar/dragBox/selectorSwitch.d.ts +19 -0
- package/dist/fullWorker.js +110 -110
- package/dist/index-B7w-GcID.js +1 -0
- package/dist/index-BLzjGoXh.js +1 -0
- package/dist/{index-CqQPnW7_.js → index-BjEjHeEF.js} +1 -1
- package/dist/{index-B4Npl8dw.mjs → index-C019qtsS.mjs} +3234 -3057
- package/dist/index-CfKLCV2y.mjs +19590 -0
- package/dist/{index-DDULymwD.mjs → index-L2uoKaSf.mjs} +3234 -3057
- package/dist/index-L470yte_.js +1 -0
- package/dist/index-LBCXcuGb.mjs +19564 -0
- package/dist/{index-vfn-RVQz.js → index-PebKJQE3.js} +1 -1
- package/dist/index-Yc4OIUoM.js +1 -0
- package/dist/{index-BBcEMXkc.mjs → index-bMvJ4igq.mjs} +1 -1
- package/dist/{index-BVkfyJQn.mjs → index-hePUiGEB.mjs} +1 -1
- package/dist/plugin/baseApplianceManager.d.ts +7 -0
- package/dist/plugin/baseViewContainerManager.d.ts +23 -9
- package/dist/plugin/displayerView.d.ts +4 -1
- package/dist/plugin/elementCapability.d.ts +29 -0
- package/dist/plugin/multi/displayer/appViewDisplayerManager.d.ts +1 -0
- package/dist/plugin/multi/displayer/mainViewDisplayerManager.d.ts +1 -0
- package/dist/plugin/selectorApi.d.ts +141 -0
- package/dist/plugin/single/displayer/mainViewDisplayerManager.d.ts +1 -0
- package/dist/plugin/types.d.ts +339 -5
- package/dist/plugin/utils.d.ts +9 -0
- package/dist/style.css +1 -1
- package/dist/subWorker.js +110 -110
- package/dist/undo/index.d.ts +44 -4
- package/dist/undo/timing.d.ts +50 -0
- package/package.json +13 -4
- package/cdn/cdn.js +0 -1
- package/cdn/fullWorker-Cu37fr.js +0 -486
- package/cdn/subWorker-le1nnC.js +0 -486
- package/dist/assets/fullWorker-C_pHxd3d.js +0 -593
- package/dist/assets/subWorker-mLNCeIEX.js +0 -593
- package/dist/bridge-DskXXarZ.mjs +0 -67
- package/dist/bridge-white-web-sdk.d.ts +0 -1
- package/dist/index-B00mKJ2E.js +0 -1
- package/dist/index-BAT55jp1.mjs +0 -16599
- package/dist/index-D50QxS0c.js +0 -1
- package/dist/index-DTMQbvIh.mjs +0 -16625
- package/dist/index-DlkXPynh.js +0 -1
- package/dist/index-DoKk1ccL.js +0 -1
package/READMA.zh-CN.md
CHANGED
|
@@ -47,6 +47,10 @@ appliance-plugin 是一个高性能的白板绘制插件,依赖 [white-web-sdk
|
|
|
47
47
|
npm install @netless/appliance-plugin
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
> **Fastboard full 包说明:** 如果你是通过 `@netless/fastboard-full` 或 `@netless/fastboard-react-full` 配合 `enableAppliancePlugin` 使用,请安装带有 `./bridge` 导出的 `@netless/appliance-plugin` 版本,建议 `>= 1.1.35`(`./bridge` 首次出现在 `>= 1.1.34-beta.2`)。
|
|
51
|
+
>
|
|
52
|
+
> 业务代码继续引用 `@netless/appliance-plugin` 即可,不需要也不建议手动改成 `@netless/appliance-plugin/bridge`。`@netless/appliance-plugin/bridge` 由 fastboard full 在内部加载,用来复用 full 内部已经 bundled 的 `white-web-sdk` runtime。
|
|
53
|
+
|
|
50
54
|
### 注册插件
|
|
51
55
|
|
|
52
56
|
插件可以支持两种场景,它们接入插件命名不同:
|
|
@@ -59,34 +63,13 @@ import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
|
|
|
59
63
|
import { ApplianceSinglePlugin } from '@netless/appliance-plugin';
|
|
60
64
|
```
|
|
61
65
|
|
|
62
|
-
> **worker.js 文件与 CDN / 静态资源**
|
|
63
|
-
>
|
|
64
|
-
> 我们采用双 worker 并发来提高绘制效率,比主线程效率提高 40% 以上。两个 worker 文件的公共依赖重复,直接打进包体会显著增加体积,因此推荐通过 `options.cdn` 指定 worker 地址,有两种常见方式:
|
|
65
|
-
>
|
|
66
|
-
> 1. **CDN 方式**:将 `@netless/appliance-plugin/cdn` 下的 `fullWorker.js`、`subWorker.js` 部署到 CDN,在插件的 `getInstance` 的第二个参数 `options.cdn` 中传入这两个文件的 CDN 地址(`fullWorkerUrl`、`subWorkerUrl`)。
|
|
67
|
-
> ***注意***:CDN 配置的 URL 必须同源,否则 worker 线程会无法加载。
|
|
68
|
-
>
|
|
69
|
-
> 2. **静态资源方式**:将 `fullWorker.js`、`subWorker.js` 放到项目的静态目录(如 Vite 的 `public/`),不参与打包。在代码中基于 `import.meta.env.BASE_URL`(或等效的 publicPath)拼出完整 URL,传入 `options.cdn`。同源请求、不占打包体积,也无需 Blob 内联,内存占用更小。
|
|
70
|
-
>
|
|
71
|
-
> 若需控制包体积,请使用上述任一方式配置 `options.cdn`。
|
|
72
|
-
|
|
73
66
|
### 接入方式参考
|
|
74
67
|
|
|
75
|
-
####
|
|
68
|
+
#### 准备 worker URL
|
|
76
69
|
```js
|
|
77
|
-
// 引入 worker 方式三选一:
|
|
78
|
-
// 方式一:静态资源(推荐)- 将 fullWorker.js、subWorker.js 放到 public 等静态目录,同源请求、不占打包体积
|
|
79
|
-
const workerBase = (import.meta.env.BASE_URL || '/').replace(/\/?$/, '/');
|
|
80
|
-
const fullWorkerUrl = workerBase + 'fullWorker.js';
|
|
81
|
-
const subWorkerUrl = workerBase + 'subWorker.js';
|
|
82
|
-
|
|
83
|
-
// 方式二:CDN - 将 @netless/appliance-plugin/cdn 下文件部署到 CDN 后,此处写 CDN 地址、不占打包体积 注意: 域名一定要同源
|
|
84
|
-
const fullWorkerUrl = 'https://your-cdn.com/fullWorker.js';
|
|
85
|
-
const subWorkerUrl = 'https://your-cdn.com/subWorker.js';
|
|
86
|
-
|
|
87
|
-
// 方式三:从 dist 以 ?raw 内联为 Blob(需打包器支持 ?raw,如 Vite / webpack raw-loader)这种方式会占用一定内存.
|
|
88
70
|
import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
|
|
89
71
|
import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
|
|
72
|
+
|
|
90
73
|
const fullWorkerUrl = URL.createObjectURL(new Blob([fullWorkerString], { type: 'text/javascript' }));
|
|
91
74
|
const subWorkerUrl = URL.createObjectURL(new Blob([subWorkerString], { type: 'text/javascript' }));
|
|
92
75
|
```
|
|
@@ -99,7 +82,7 @@ const subWorkerUrl = URL.createObjectURL(new Blob([subWorkerString], { type: 'te
|
|
|
99
82
|
// 分包引用
|
|
100
83
|
import { useFastboard, Fastboard } from "@netless/fastboard-react";
|
|
101
84
|
|
|
102
|
-
//
|
|
85
|
+
// 按上文方式准备 worker URL:
|
|
103
86
|
const fullWorkerUrl = ...;
|
|
104
87
|
const subWorkerUrl = ...;
|
|
105
88
|
|
|
@@ -130,7 +113,7 @@ const app = useFastboard(() => ({
|
|
|
130
113
|
// 分包引用
|
|
131
114
|
import { createFastboard, createUI } from "@netless/fastboard";
|
|
132
115
|
|
|
133
|
-
//
|
|
116
|
+
// 按上文方式准备 worker URL:
|
|
134
117
|
const fullWorkerUrl = ...;
|
|
135
118
|
const subWorkerUrl = ...;
|
|
136
119
|
|
|
@@ -156,6 +139,8 @@ const fastboard = await createFastboard({
|
|
|
156
139
|
});
|
|
157
140
|
```
|
|
158
141
|
|
|
142
|
+
> **注意:** 在 fastboard full 模式下,`@netless/fastboard-full` / `@netless/fastboard-react-full` 会在内部加载 `@netless/appliance-plugin/bridge`。业务代码只需要配置 `enableAppliancePlugin` 并提供 worker 地址,同时继续引用 `@netless/appliance-plugin` 即可;不需要也不建议手动引入 `@netless/appliance-plugin/bridge`。
|
|
143
|
+
|
|
159
144
|
#### 多窗口(直接对接window-manager)
|
|
160
145
|
|
|
161
146
|
```js
|
|
@@ -167,7 +152,7 @@ import { WhiteWebSdk } from "white-web-sdk";
|
|
|
167
152
|
import { WindowManager } from "@netless/window-manager";
|
|
168
153
|
import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
|
|
169
154
|
|
|
170
|
-
//
|
|
155
|
+
// 按上文方式准备 worker URL:
|
|
171
156
|
const fullWorkerUrl = ...;
|
|
172
157
|
const subWorkerUrl = ...;
|
|
173
158
|
|
|
@@ -205,7 +190,7 @@ import '@netless/appliance-plugin/dist/style.css';
|
|
|
205
190
|
import { WhiteWebSdk } from "white-web-sdk";
|
|
206
191
|
import { ApplianceSinglePlugin, ApplianceSigleWrapper } from '@netless/appliance-plugin';
|
|
207
192
|
|
|
208
|
-
//
|
|
193
|
+
// 按上文方式准备 worker URL:
|
|
209
194
|
const fullWorkerUrl = ...;
|
|
210
195
|
const subWorkerUrl = ...;
|
|
211
196
|
|
|
@@ -330,6 +315,36 @@ injectMethodToObject(windowmanager.mainView,'setMemberState');
|
|
|
330
315
|
- `updateMarkmap` - 修改白板中的markdow文本 (Version >=1.1.32) **该方法需要开启extras.useBackgroundThread**
|
|
331
316
|
- `insertBackgroundImage` - 插入白板的背景图片 (Version >=1.1.32) **该方法需要开启extras.useBackgroundThread**
|
|
332
317
|
|
|
318
|
+
6. Selector / Element 扩展接口
|
|
319
|
+
- `getSelectedElements(viewId?)` - 获取当前 selector 选中快照
|
|
320
|
+
- `blurSelector(viewId?)` - 取消当前 selector 选中
|
|
321
|
+
- `updateSelectedElements(viewId?, changes)` - 更新当前 selector 选中集的属性
|
|
322
|
+
- `copySelectedElements(viewId?)` - 复制当前 selector 选中集
|
|
323
|
+
- `deleteSelectedElements(viewId?)` - 删除当前 selector 选中集
|
|
324
|
+
- `updateElement(elementId, scenePath, viewId, updateElementInfo, useUndoRedoStack?)` - 单元素最终态更新接口,返回 `Promise<boolean>`
|
|
325
|
+
|
|
326
|
+
其中需要注意:
|
|
327
|
+
|
|
328
|
+
- `updateSelectedElements(...)` 是 selector-only 能力,只处理当前选中的 selector 集合
|
|
329
|
+
- `updateElement(...)` 是 storage-first 的单元素最终态更新通知接口
|
|
330
|
+
- `updateElement(...)` 不表达调用返回时已经渲染完成
|
|
331
|
+
- `updateElement(...)` 不支持 selector
|
|
332
|
+
- `updateElementInfo` 需要显式携带 `toolsType`,并按教具类型声明对应字段
|
|
333
|
+
- `updateElement(...)` 返回 `Promise<boolean>`,仅表示本次调用是否通过基础校验并成功发起
|
|
334
|
+
|
|
335
|
+
7. Selector 扩展事件
|
|
336
|
+
- `selectedElementsChange`
|
|
337
|
+
- 只在 `selectedIds` 变化时触发
|
|
338
|
+
- 只表示最终选中集合变化
|
|
339
|
+
- `selectorGeometryChange`
|
|
340
|
+
- 只表示最终几何结果变化
|
|
341
|
+
- 坐标统一为 `viewRect`
|
|
342
|
+
- `selectorTransformChange`
|
|
343
|
+
- 只表示拖拽、拉伸、旋转、端点编辑等过程态
|
|
344
|
+
- 只暴露 `viewId + emitEventType + workState`
|
|
345
|
+
- `remoteSelectorChange`
|
|
346
|
+
- 表示远端 / 被同步端 selector 的同步结果变化
|
|
347
|
+
|
|
333
348
|
5. 不兼容接口
|
|
334
349
|
- [`exportScene`](https://doc.shengwang.cn/api-ref/whiteboard/javascript/interfaces/room#exportScene) - appliance-plugin 开启后,笔记不能按 room 的方式导出
|
|
335
350
|
- [服务端截图](https://doc.shengwang.cn/doc/whiteboard/restful/fastboard-sdk/restful-wb/operations/post-v5-rooms-uuid-screenshots) - appliance-plugin 开启后,笔记不能通过调用服务端截图方式获取截图,而需要改用 `screenshotToCanvasAsync` 获取
|
|
@@ -760,10 +775,10 @@ plugin.insertBackgroundImage(viewId, {
|
|
|
760
775
|
`getInstance(wm: WindowManager | Room | Player, adaptor: ApplianceAdaptor)`
|
|
761
776
|
- `wm`: `WindowManager | Room | Player`。多窗口模式下传入的是 `WindowManager`,单窗口模式下传入的是 `Room` 或者 `Player`(白板回放模式)。
|
|
762
777
|
- `adaptor`: 配置适配器。
|
|
763
|
-
- `options: AppliancePluginOptions` - 必须配置,其中 `cdn`
|
|
778
|
+
- `options: AppliancePluginOptions` - 必须配置,其中 `cdn` 用于传入 worker URL。
|
|
764
779
|
```js
|
|
765
780
|
export type AppliancePluginOptions = {
|
|
766
|
-
/**
|
|
781
|
+
/** worker URL 配置项 */
|
|
767
782
|
cdn: CdnOpt;
|
|
768
783
|
/** 额外配置项 */
|
|
769
784
|
extras?: ExtrasOptions;
|
|
@@ -838,19 +853,9 @@ appliancePlugin.currentManager.consoleWorkerInfo() // 可以查看到 worker
|
|
|
838
853
|
import { ApplianceSinglePlugin } from '@netless/appliance-plugin';
|
|
839
854
|
import '@netless/appliance-plugin/dist/style.css';
|
|
840
855
|
|
|
841
|
-
// 方式1: 使用 CDN(推荐生产环境)
|
|
842
|
-
const plugin = await ApplianceSinglePlugin.getInstance(room, {
|
|
843
|
-
options: {
|
|
844
|
-
cdn: {
|
|
845
|
-
fullWorkerUrl: 'https://your-cdn.com/fullWorker.js',
|
|
846
|
-
subWorkerUrl: 'https://your-cdn.com/subWorker.js',
|
|
847
|
-
},
|
|
848
|
-
},
|
|
849
|
-
});
|
|
850
|
-
|
|
851
|
-
// 方式2: 使用本地 worker 文件(适合开发环境)
|
|
852
856
|
import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
|
|
853
857
|
import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
|
|
858
|
+
|
|
854
859
|
const fullWorkerBlob = new Blob([fullWorkerString], {type: 'text/javascript'});
|
|
855
860
|
const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
|
|
856
861
|
const subWorkerBlob = new Blob([subWorkerString], {type: 'text/javascript'});
|
|
@@ -956,19 +961,13 @@ const canRedo = plugin.canRedoSteps() > 0;
|
|
|
956
961
|
- **多窗口场景**:如果需要多窗口功能,使用 `ApplianceMultiPlugin`
|
|
957
962
|
- **单白板场景**:如果只需要单白板功能,使用 `ApplianceSinglePlugin`
|
|
958
963
|
|
|
959
|
-
### 2.
|
|
960
|
-
|
|
961
|
-
- **CDN 部署**(推荐):适合生产环境,可以减少主包体积(主包约 400kB,两个 worker 各约 800kB)
|
|
962
|
-
- **本地打包**:适合开发环境或对包体积不敏感的场景
|
|
963
|
-
|
|
964
|
-
### 3. 性能优化建议
|
|
964
|
+
### 2. 性能优化建议
|
|
965
965
|
|
|
966
|
-
- 使用 CDN 部署 worker 文件,减少主包体积
|
|
967
966
|
- 合理配置 `bufferSize`,根据设备性能调整画布缓存大小
|
|
968
967
|
- 在移动端或低性能设备上,可以考虑使用 `useSimple: true` 简单模式
|
|
969
968
|
- 如有非必要的功能, 可以不用开启 `useBackgroundThread: true`
|
|
970
969
|
|
|
971
|
-
###
|
|
970
|
+
### 3. 兼容性说明
|
|
972
971
|
|
|
973
972
|
- 支持现代浏览器(Chrome、Firefox、Safari、Edge)
|
|
974
973
|
- 移动端浏览器支持情况取决于 OffscreenCanvas 支持情况
|
package/README.md
CHANGED
|
@@ -47,6 +47,10 @@ The plugin supports the following drawing tools:
|
|
|
47
47
|
npm install @netless/appliance-plugin
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
> **Fastboard full packages:** If you are using `@netless/fastboard-full` or `@netless/fastboard-react-full` together with `enableAppliancePlugin`, install an `@netless/appliance-plugin` version that exposes `./bridge`. We recommend `>= 1.1.35` (`./bridge` first appeared in `>= 1.1.34-beta.2`).
|
|
51
|
+
>
|
|
52
|
+
> Keep importing `@netless/appliance-plugin` in app code. You do not need, and generally should not, replace it with `@netless/appliance-plugin/bridge`. The `/bridge` entry is loaded internally by fastboard full to reuse the bundled `white-web-sdk` runtime.
|
|
53
|
+
|
|
50
54
|
### Register Plugin
|
|
51
55
|
|
|
52
56
|
Plugins can support two scenarios, they have different plugin names:
|
|
@@ -59,35 +63,13 @@ import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
|
|
|
59
63
|
import { ApplianceSinglePlugin } from '@netless/appliance-plugin';
|
|
60
64
|
```
|
|
61
65
|
|
|
62
|
-
> **worker.js files: CDN & static assets**
|
|
63
|
-
>
|
|
64
|
-
> We use dual workers for higher drawing efficiency (40%+ over the main thread). The two worker files share duplicated dependencies, so bundling them would significantly increase package size. We recommend providing worker URLs via `options.cdn`. Two common approaches:
|
|
65
|
-
>
|
|
66
|
-
> 1. **CDN**: Deploy `fullWorker.js` and `subWorker.js` from `@netless/appliance-plugin/cdn` to your CDN, then pass their URLs as `fullWorkerUrl` and `subWorkerUrl` in the plugin’s `getInstance` second argument `options.cdn`.
|
|
67
|
-
> ***Note***: CDN URLs must be same-origin with your app, or the workers will fail to load.
|
|
68
|
-
>
|
|
69
|
-
> 2. **Static assets**: Put `fullWorker.js` and `subWorker.js` in your project’s static directory (e.g. Vite’s `public/`), so they are not bundled. In code, build full URLs from `import.meta.env.BASE_URL` (or your publicPath) and pass them to `options.cdn`. Same-origin, no bundle bloat, no Blob inline, lower memory use.
|
|
70
|
-
>
|
|
71
|
-
> To keep bundle size down, configure `options.cdn` using one of the above.
|
|
72
|
-
|
|
73
66
|
### Access Mode Reference
|
|
74
67
|
|
|
75
|
-
####
|
|
68
|
+
#### Preparing worker URLs
|
|
76
69
|
```js
|
|
77
|
-
// Choose one of three ways to provide worker URLs:
|
|
78
|
-
|
|
79
|
-
// Option 1: Static assets (recommended) — put fullWorker.js & subWorker.js in public (or similar); same-origin, no bundle cost
|
|
80
|
-
const workerBase = (import.meta.env.BASE_URL || '/').replace(/\/?$/, '/');
|
|
81
|
-
const fullWorkerUrl = workerBase + 'fullWorker.js';
|
|
82
|
-
const subWorkerUrl = workerBase + 'subWorker.js';
|
|
83
|
-
|
|
84
|
-
// Option 2: CDN — after deploying files from @netless/appliance-plugin/cdn to your CDN, set URLs here. Note: must be same-origin
|
|
85
|
-
const fullWorkerUrl = 'https://your-cdn.com/fullWorker.js';
|
|
86
|
-
const subWorkerUrl = 'https://your-cdn.com/subWorker.js';
|
|
87
|
-
|
|
88
|
-
// Option 3: Inline via ?raw as Blob (requires ?raw support, e.g. Vite or webpack raw-loader). Uses more memory.
|
|
89
70
|
import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
|
|
90
71
|
import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
|
|
72
|
+
|
|
91
73
|
const fullWorkerUrl = URL.createObjectURL(new Blob([fullWorkerString], { type: 'text/javascript' }));
|
|
92
74
|
const subWorkerUrl = URL.createObjectURL(new Blob([subWorkerString], { type: 'text/javascript' }));
|
|
93
75
|
```
|
|
@@ -100,7 +82,7 @@ const subWorkerUrl = URL.createObjectURL(new Blob([subWorkerString], { type: 'te
|
|
|
100
82
|
// Subpackage reference
|
|
101
83
|
import { useFastboard, Fastboard } from "@netless/fastboard-react";
|
|
102
84
|
|
|
103
|
-
//
|
|
85
|
+
// Prepare worker URLs as shown above:
|
|
104
86
|
const fullWorkerUrl = ...;
|
|
105
87
|
const subWorkerUrl = ...;
|
|
106
88
|
|
|
@@ -131,7 +113,7 @@ const app = useFastboard(() => ({
|
|
|
131
113
|
// Subpackage reference
|
|
132
114
|
import { createFastboard, createUI } from "@netless/fastboard";
|
|
133
115
|
|
|
134
|
-
//
|
|
116
|
+
// Prepare worker URLs as shown above:
|
|
135
117
|
const fullWorkerUrl = ...;
|
|
136
118
|
const subWorkerUrl = ...;
|
|
137
119
|
|
|
@@ -157,6 +139,8 @@ const fastboard = await createFastboard({
|
|
|
157
139
|
});
|
|
158
140
|
```
|
|
159
141
|
|
|
142
|
+
> **Note:** In fastboard full mode, `@netless/fastboard-full` / `@netless/fastboard-react-full` load `@netless/appliance-plugin/bridge` internally. App code only needs to configure `enableAppliancePlugin`, provide worker URLs, and keep importing `@netless/appliance-plugin`; do not manually switch your import to `@netless/appliance-plugin/bridge`.
|
|
143
|
+
|
|
160
144
|
#### Multi-window (Direct integration with window-manager)
|
|
161
145
|
|
|
162
146
|
```js
|
|
@@ -168,7 +152,7 @@ import { WhiteWebSdk } from "white-web-sdk";
|
|
|
168
152
|
import { WindowManager } from "@netless/window-manager";
|
|
169
153
|
import { ApplianceMultiPlugin } from '@netless/appliance-plugin';
|
|
170
154
|
|
|
171
|
-
//
|
|
155
|
+
// Prepare worker URLs as shown above:
|
|
172
156
|
const fullWorkerUrl = ...;
|
|
173
157
|
const subWorkerUrl = ...;
|
|
174
158
|
|
|
@@ -205,7 +189,7 @@ import '@netless/appliance-plugin/dist/style.css';
|
|
|
205
189
|
|
|
206
190
|
import { WhiteWebSdk } from "white-web-sdk";
|
|
207
191
|
import { ApplianceSinglePlugin, ApplianceSigleWrapper } from '@netless/appliance-plugin';
|
|
208
|
-
//
|
|
192
|
+
// Prepare worker URLs as shown above:
|
|
209
193
|
const fullWorkerUrl = ...;
|
|
210
194
|
const subWorkerUrl = ...;
|
|
211
195
|
|
|
@@ -774,10 +758,10 @@ plugin.usePlugin(autoDrawPlugin);
|
|
|
774
758
|
`getInstance(wm: WindowManager | Room | Player, adaptor: ApplianceAdaptor)`
|
|
775
759
|
- `wm`: `WindowManager | Room | Player`. In multi-window mode, pass `WindowManager`, in single-window mode, pass `Room` or `Player` (whiteboard playback mode).
|
|
776
760
|
- `adaptor`: Configuration adapter.
|
|
777
|
-
- `options: AppliancePluginOptions` - Must be configured, where `cdn`
|
|
761
|
+
- `options: AppliancePluginOptions` - Must be configured, where `cdn` contains worker URLs.
|
|
778
762
|
```js
|
|
779
763
|
export type AppliancePluginOptions = {
|
|
780
|
-
/**
|
|
764
|
+
/** Worker URL configuration item */
|
|
781
765
|
cdn: CdnOpt;
|
|
782
766
|
/** Additional configuration items */
|
|
783
767
|
extras?: ExtrasOptions;
|
|
@@ -850,19 +834,9 @@ appliancePlugin.currentManager.consoleWorkerInfo() // Can view drawing informat
|
|
|
850
834
|
import { ApplianceSinglePlugin } from '@netless/appliance-plugin';
|
|
851
835
|
import '@netless/appliance-plugin/dist/style.css';
|
|
852
836
|
|
|
853
|
-
// Method 1: Using CDN (recommended for production)
|
|
854
|
-
const plugin = await ApplianceSinglePlugin.getInstance(room, {
|
|
855
|
-
options: {
|
|
856
|
-
cdn: {
|
|
857
|
-
fullWorkerUrl: 'https://your-cdn.com/fullWorker.js',
|
|
858
|
-
subWorkerUrl: 'https://your-cdn.com/subWorker.js',
|
|
859
|
-
},
|
|
860
|
-
},
|
|
861
|
-
});
|
|
862
|
-
|
|
863
|
-
// Method 2: Using local worker files (suitable for development)
|
|
864
837
|
import fullWorkerString from '@netless/appliance-plugin/dist/fullWorker.js?raw';
|
|
865
838
|
import subWorkerString from '@netless/appliance-plugin/dist/subWorker.js?raw';
|
|
839
|
+
|
|
866
840
|
const fullWorkerBlob = new Blob([fullWorkerString], {type: 'text/javascript'});
|
|
867
841
|
const fullWorkerUrl = URL.createObjectURL(fullWorkerBlob);
|
|
868
842
|
const subWorkerBlob = new Blob([subWorkerString], {type: 'text/javascript'});
|
|
@@ -968,19 +942,13 @@ const canRedo = plugin.canRedoSteps() > 0;
|
|
|
968
942
|
- **Multi-window scenario**: If you need multi-window functionality, use `ApplianceMultiPlugin`
|
|
969
943
|
- **Single whiteboard scenario**: If you only need single whiteboard functionality, use `ApplianceSinglePlugin`
|
|
970
944
|
|
|
971
|
-
### 2.
|
|
972
|
-
|
|
973
|
-
- **CDN deployment** (recommended): Suitable for production environments, can reduce main package size (main package ~400kB, two workers ~800kB each)
|
|
974
|
-
- **Local packaging**: Suitable for development environments or scenarios where package size is not a concern
|
|
975
|
-
|
|
976
|
-
### 3. Performance optimization recommendations
|
|
945
|
+
### 2. Performance optimization recommendations
|
|
977
946
|
|
|
978
|
-
- Use CDN deployment for worker files to reduce main package size
|
|
979
947
|
- Reasonably configure `bufferSize` to adjust canvas cache size according to device performance
|
|
980
948
|
- On mobile or low-performance devices, consider using `useSimple: true` simple mode
|
|
981
949
|
- If there are unnecessary features, you can avoid enabling `useBackgroundThread: true`
|
|
982
950
|
|
|
983
|
-
###
|
|
951
|
+
### 3. Compatibility notes
|
|
984
952
|
|
|
985
953
|
- Supports modern browsers (Chrome, Firefox, Safari, Edge)
|
|
986
954
|
- Mobile browser support depends on OffscreenCanvas support
|
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-B7w-GcID.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 { a7 as s, a8 as p, a9 as r, aa as t, ab as i, a4 as l, Z as n, b as E, ac as o, t as T, j as y, ad as v, a as g, ae as S, d as c, u, w as k, c as m, af as M, E as _, ag as d, v as A, v as I, ah as W, Y as P, ai as b, aj as f, a6 as h, ak as w, al as C } from "./index-
|
|
1
|
+
import { a7 as s, a8 as p, a9 as r, aa as t, ab as i, a4 as l, Z as n, b as E, ac as o, t as T, j as y, ad as v, a as g, ae as S, d as c, u, w as k, c as m, af as M, E as _, ag as d, v as A, v as I, ah as W, Y as P, ai as b, aj as f, a6 as h, ak as w, al as C } from "./index-CfKLCV2y.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|