@netless/appliance-plugin 1.1.36-beta.2 → 1.1.36-beta.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.
package/READMA.zh-CN.md CHANGED
@@ -317,20 +317,26 @@ injectMethodToObject(windowmanager.mainView,'setMemberState');
317
317
 
318
318
  6. Selector / Element 扩展接口
319
319
  - `getSelectedElements(viewId?)` - 获取当前 selector 选中快照
320
+ - `isElementPropertySupported(toolsType, field)` - 判断指定教具类型是否支持某个属性字段,适合自定义 floatbar 按钮显隐
320
321
  - `blurSelector(viewId?)` - 取消当前 selector 选中
321
322
  - `updateSelectedElements(viewId?, changes)` - 更新当前 selector 选中集的属性
322
323
  - `copySelectedElements(viewId?)` - 复制当前 selector 选中集
323
324
  - `deleteSelectedElements(viewId?)` - 删除当前 selector 选中集
324
325
  - `updateElement(elementId, scenePath, viewId, updateElementInfo, useUndoRedoStack?)` - 单元素最终态更新接口,返回 `Promise<boolean>`
326
+ - `getFloatbarContainer(viewId?)` - 获取当前 view 内置的自定义 floatbar 挂载容器
327
+ - `getViewOffsetToContainer(container, viewId?)` - 计算当前 view 到外部容器的坐标偏移,用于挂载到业务 overlay root
325
328
 
326
329
  其中需要注意:
327
330
 
328
331
  - `updateSelectedElements(...)` 是 selector-only 能力,只处理当前选中的 selector 集合
332
+ - `blurSelector(...)`、`updateSelectedElements(...)`、`copySelectedElements(...)`、`deleteSelectedElements(...)`、`updateElement(...)` 都要求在可写权限下调用
329
333
  - `updateElement(...)` 是 storage-first 的单元素最终态更新通知接口
330
334
  - `updateElement(...)` 不表达调用返回时已经渲染完成
331
335
  - `updateElement(...)` 不支持 selector
332
336
  - `updateElementInfo` 需要显式携带 `toolsType`,并按教具类型声明对应字段
333
337
  - `updateElement(...)` 返回 `Promise<boolean>`,仅表示本次调用是否通过基础校验并成功发起
338
+ - `getFloatbarContainer(...)` 是推荐的自定义 floatbar 挂载方式;挂到该容器下时,`selectorGeometryChange.viewRect` 可直接用于定位
339
+ - 如果业务必须挂到外部容器,请配合 `getViewOffsetToContainer(...)` 做坐标换算
334
340
 
335
341
  7. Selector 扩展事件
336
342
  - `selectedElementsChange`
@@ -345,7 +351,14 @@ injectMethodToObject(windowmanager.mainView,'setMemberState');
345
351
  - `remoteSelectorChange`
346
352
  - 表示远端 / 被同步端 selector 的同步结果变化
347
353
 
348
- 5. 不兼容接口
354
+ 8. Selector / Floatbar 自定义能力
355
+ - 支持关闭内置 floatbar,仅保留 selector 选中、拖拽、缩放、旋转等交互能力
356
+ - 支持基于 `selectedElementsChange`、`selectorGeometryChange`、`selectorTransformChange`、`remoteSelectorChange` 事件渲染业务自定义 UI
357
+ - 支持通过 `overwriteSelectorStyles` 覆盖 selector 外框、控制点、端点和锁态图标样式
358
+ - 支持将自定义 floatbar 挂到 plugin 内部容器,或挂到业务自己的外部 overlay 容器
359
+ - 推荐结合 [customer-custom-selector-floatbar-integration.zh-CN.md](https://github.com/user-attachments/files/29439912/customer-custom-selector-floatbar-integration.zh-CN.md) 接入
360
+
361
+ 9. 不兼容接口
349
362
  - [`exportScene`](https://doc.shengwang.cn/api-ref/whiteboard/javascript/interfaces/room#exportScene) - appliance-plugin 开启后,笔记不能按 room 的方式导出
350
363
  - [服务端截图](https://doc.shengwang.cn/doc/whiteboard/restful/fastboard-sdk/restful-wb/operations/post-v5-rooms-uuid-screenshots) - appliance-plugin 开启后,笔记不能通过调用服务端截图方式获取截图,而需要改用 `screenshotToCanvasAsync` 获取
351
364
 
@@ -387,6 +400,41 @@ room.setMemberState({
387
400
  - 闭合绘制矩形、圆/椭圆、三角形、五角星
388
401
  - 箭头和直线保持单笔非闭合
389
402
 
403
+ ##### 自定义 Selector / Floatbar 与 Selector 扩展 API (Version >=1.1.36-beta.2)
404
+
405
+ 当前版本新增了一套围绕 selector 的事件与命令式 API,方便业务在 `white-web-sdk` / `@netless/window-manager` 场景下自定义 selector UI、floatbar UI 和选中属性面板。
406
+
407
+ 新增事件:
408
+
409
+ - `selectedElementsChange` - 只表示最终选中集合变化
410
+ - `selectorGeometryChange` - 只表示最终几何结果变化,坐标统一输出 `viewRect`
411
+ - `selectorTransformChange` - 只表示拖拽、拉伸、旋转、端点编辑等过程态
412
+ - `remoteSelectorChange` - 表示远端 / 被同步端 selector 的同步结果变化
413
+
414
+ 新增 API:
415
+
416
+ - `getSelectedElements(viewId?)`
417
+ - `isElementPropertySupported(toolsType, field)`
418
+ - `blurSelector(viewId?)`
419
+ - `updateSelectedElements(viewId?, changes)`
420
+ - `copySelectedElements(viewId?)`
421
+ - `deleteSelectedElements(viewId?)`
422
+ - `updateElement(elementId, scenePath, viewId, updateElementInfo, useUndoRedoStack?)`
423
+ - `getFloatbarContainer(viewId?)`
424
+ - `getViewOffsetToContainer(container, viewId?)`
425
+
426
+ 典型用途:
427
+
428
+ - 关闭内置 floatbar,自己渲染按钮、色板、字号和文本样式 UI
429
+ - 通过 `getSelectedElements()` 获取当前选中快照
430
+ - 通过 `updateSelectedElements()` 批量更新当前选中元素属性
431
+ - 通过 `updateElement()` 更新某个非当前选中的单元素
432
+ - 通过 `getFloatbarContainer()` 或 `getViewOffsetToContainer()` 决定自定义 floatbar 挂载位置
433
+ - 通过 `overwriteSelectorStyles` 统一覆盖 selector 视觉样式
434
+
435
+ 详细设计与接入示例请参考:
436
+ - [customer-custom-selector-floatbar-integration.zh-CN.md](https://github.com/user-attachments/files/29439912/customer-custom-selector-floatbar-integration.zh-CN.md)
437
+
390
438
  ##### 扩展教具 (Version >=1.1.1)
391
439
  在原来的[白板教具](https://doc.shengwang.cn/api-ref/whiteboard/javascript/globals.html#memberstate)类型上,增加了一些扩展功能属性,如下:
392
440
 
package/README.md CHANGED
@@ -307,7 +307,51 @@ The following interfaces are involved:
307
307
  - `updateMarkmap` - Update markdown text in whiteboard (Version >=1.1.32) **This method requires enabling extras.useBackgroundThread**
308
308
  - `insertBackgroundImage` - Insert whiteboard background image (Version >=1.1.32) **This method requires enabling extras.useBackgroundThread**
309
309
 
310
- 5. Incompatible interfaces
310
+ 5. Selector / Element extension APIs
311
+ - `getSelectedElements(viewId?)` - Get the current selector snapshot
312
+ - `isElementPropertySupported(toolsType, field)` - Check whether a property field is supported by a specific tools type, useful for custom floatbar button visibility
313
+ - `blurSelector(viewId?)` - Clear the current selector selection
314
+ - `updateSelectedElements(viewId?, changes)` - Update properties of the current selector selection set
315
+ - `copySelectedElements(viewId?)` - Copy the current selector selection set
316
+ - `deleteSelectedElements(viewId?)` - Delete the current selector selection set
317
+ - `updateElement(elementId, scenePath, viewId, updateElementInfo, useUndoRedoStack?)` - Single-element final-state update API, returns `Promise<boolean>`
318
+ - `getFloatbarContainer(viewId?)` - Get the built-in custom floatbar mount container for the current view
319
+ - `getViewOffsetToContainer(container, viewId?)` - Convert coordinates from the current view to an external container, useful when mounting to a business overlay root
320
+
321
+ Notes:
322
+
323
+ - `updateSelectedElements(...)` is selector-only and only operates on the current selection set
324
+ - `blurSelector(...)`, `updateSelectedElements(...)`, `copySelectedElements(...)`, `deleteSelectedElements(...)`, and `updateElement(...)` should be called only when the room is writable
325
+ - `updateElement(...)` is a storage-first single-element final-state update API
326
+ - `updateElement(...)` does not imply rendering has finished when the Promise resolves
327
+ - `updateElement(...)` does not support selector itself
328
+ - `updateElementInfo` must explicitly include `toolsType`, and fields must match that tools type
329
+ - `updateElement(...)` returning `Promise<boolean>` only means the call passed validation and the update flow was started successfully
330
+ - `getFloatbarContainer(...)` is the recommended mount point for a custom floatbar; when mounted there, `selectorGeometryChange.viewRect` can be used directly for positioning
331
+ - If you must mount to an external container, use `getViewOffsetToContainer(...)` to convert coordinates
332
+
333
+ 6. Selector extension events
334
+ - `selectedElementsChange`
335
+ - Fires only when `selectedIds` change
336
+ - Represents only the final selection set change
337
+ - `selectorGeometryChange`
338
+ - Represents only the final geometry change
339
+ - Coordinates are unified as `viewRect`
340
+ - `selectorTransformChange`
341
+ - Represents only transform process states such as drag, resize, rotate, and endpoint editing
342
+ - Exposes only `viewId + emitEventType + workState`
343
+ - `remoteSelectorChange`
344
+ - Represents selector sync result changes from remote / synced clients
345
+
346
+ 7. Custom selector / floatbar capability
347
+ - You can disable the built-in floatbar while keeping selector selection, drag, resize, rotate, and endpoint-edit interactions
348
+ - You can render your own custom UI based on `selectedElementsChange`, `selectorGeometryChange`, `selectorTransformChange`, and `remoteSelectorChange`
349
+ - You can override selector visuals such as the highlight box, control points, endpoint dots, and locked icon through `overwriteSelectorStyles`
350
+ - You can mount your custom floatbar into the plugin-provided internal container or your own external overlay container
351
+ - Recommended reading:
352
+ - [customer-custom-selector-floatbar-integration.zh-CN.md](https://github.com/user-attachments/files/29439912/customer-custom-selector-floatbar-integration.zh-CN.md)
353
+
354
+ 8. Incompatible interfaces
311
355
  - [`exportScene`](https://api-ref.agora.io/en/interactive-whiteboard-sdk/web/2.x/interfaces/room.html#exportscene) - After appliance-plugin is enabled, notes cannot be exported in room mode
312
356
  - [Server-side screenshot](https://docs.agora.io/en/interactive-whiteboard/reference/whiteboard-api/screenshots?platform=web#screenshot-a-scene-post) - After appliance-plugin is enabled, notes cannot be obtained by calling server-side screenshot, but need to use `screenshotToCanvasAsync` to obtain the screenshot
313
357
 
@@ -349,6 +393,42 @@ Recommendations:
349
393
  - Draw `Rectangle`, `Ellipse / Circle`, `Triangle`, and `Five-point Star` as closed strokes
350
394
  - Draw `Arrow` and `Straight` as open single strokes
351
395
 
396
+ ##### Custom Selector / Floatbar and Selector Extension APIs (Version >=1.1.36-beta.2)
397
+
398
+ This version adds a selector-focused event and imperative API set so that integrators can build custom selector UI, floatbar UI, and selected-element property panels in `white-web-sdk` / `@netless/window-manager` scenarios.
399
+
400
+ New events:
401
+
402
+ - `selectedElementsChange` - final selection set changes only
403
+ - `selectorGeometryChange` - final geometry changes only, with unified `viewRect`
404
+ - `selectorTransformChange` - process states for drag, resize, rotate, and endpoint editing
405
+ - `remoteSelectorChange` - selector sync result changes from remote / synced clients
406
+
407
+ New APIs:
408
+
409
+ - `getSelectedElements(viewId?)`
410
+ - `isElementPropertySupported(toolsType, field)`
411
+ - `blurSelector(viewId?)`
412
+ - `updateSelectedElements(viewId?, changes)`
413
+ - `copySelectedElements(viewId?)`
414
+ - `deleteSelectedElements(viewId?)`
415
+ - `updateElement(elementId, scenePath, viewId, updateElementInfo, useUndoRedoStack?)`
416
+ - `getFloatbarContainer(viewId?)`
417
+ - `getViewOffsetToContainer(container, viewId?)`
418
+
419
+ Typical usage:
420
+
421
+ - Disable the built-in floatbar and render your own buttons, palettes, font-size, and text-style UI
422
+ - Use `getSelectedElements()` to read the current selector snapshot
423
+ - Use `updateSelectedElements()` to batch-update the current selection
424
+ - Use `updateElement()` to update a specific element outside the current selection
425
+ - Use `getFloatbarContainer()` or `getViewOffsetToContainer()` to decide where custom floatbar UI should be mounted
426
+ - Use `overwriteSelectorStyles` to customize selector visuals
427
+
428
+ For design details and integration examples, see:
429
+
430
+ - [customer-custom-selector-floatbar-integration.zh-CN.md](https://github.com/user-attachments/files/29439912/customer-custom-selector-floatbar-integration.zh-CN.md)
431
+
352
432
  ##### Extended Tools (Version >=1.1.1)
353
433
  On the original [whiteboard tools](https://api-ref.agora.io/en/interactive-whiteboard-sdk/web/2.x/globals.html#memberstate) type, some extended function attributes have been added, as follows:
354
434
 
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D9xjZ07S.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-CfKLCV2y.mjs";
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-Dllr4Im3.mjs";
2
2
  export {
3
3
  s as ActiveContainerType,
4
4
  p as ApplianceMultiPlugin,