ice-entity-designer 0.0.22 → 0.0.23
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/README.md +25 -0
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/react.cjs +3 -3
- package/dist/react.mjs +3 -3
- package/dist/types/flow/FlowDesigner.d.mts +16 -1
- package/dist/types/flow/FlowDesigner.d.ts +16 -1
- package/dist/types/ice-render/ICE.d.mts +36 -0
- package/dist/types/ice-render/ICE.d.ts +36 -0
- package/dist/types/ice-render/cross-platform/Path2DRecorder.d.mts +76 -0
- package/dist/types/ice-render/cross-platform/Path2DRecorder.d.ts +76 -0
- package/dist/types/ice-render/cross-platform/PolyfillPath2D.d.mts +8 -18
- package/dist/types/ice-render/cross-platform/PolyfillPath2D.d.ts +8 -18
- package/dist/types/ice-render/export/SvgExporter.d.mts +54 -0
- package/dist/types/ice-render/export/SvgExporter.d.ts +54 -0
- package/dist/types/ice-render/graphic/ICEComponent.d.mts +31 -1
- package/dist/types/ice-render/graphic/ICEComponent.d.ts +31 -1
- package/dist/types/ice-render/graphic/ICEPath.d.mts +7 -0
- package/dist/types/ice-render/graphic/ICEPath.d.ts +7 -0
- package/dist/types/ice-render/graphic/link/ICEPolyLine.d.mts +17 -0
- package/dist/types/ice-render/graphic/link/ICEPolyLine.d.ts +17 -0
- package/dist/types/ice-render/graphic/text/ICEText.d.mts +21 -0
- package/dist/types/ice-render/graphic/text/ICEText.d.ts +21 -0
- package/dist/types/ice-render/index.d.mts +2 -0
- package/dist/types/ice-render/index.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -205,6 +205,7 @@ flow.undo(); // 100 步历史
|
|
|
205
205
|
| 样式 | 节点:`fillColor` / `strokeColor` / `textColor` / `fontSize`(`updateNode` 即时生效);连线:`style.strokeStyle`(线色,同时作为箭头填充)/ `style.lineWidth`、`labelStyle.fillStyle`(标签颜色),全部随快照存取 |
|
|
206
206
|
| 增删改查 | `nodes` / `edges` / `selected` / `select()` / `updateNode()` / `updateEdge()` / `remove()`(删节点级联删连线)/ `clear()` |
|
|
207
207
|
| 历史与快照 | `undo()` / `redo()` / `canUndo()` / `canRedo()`、`serialize()` / `toSnapshot()` / `load()`(返回 `{ loaded, nodes, edges, skipped }`)。文档 **v2 直接复用引擎的序列化机制**:`{ version: 2, kind: 'flowchart', scene: <引擎 Serializer 产物> }`,因此自定义 `data` 与任何新增 state 字段自动往返;v1(`nodes`/`edges` 数组)仍可读,导出统一为 v2 |
|
|
208
|
+
| 导出 | `toSvg(options)` —— 导出**矢量** SVG(放大不糊、可进设计工具/打印);与画布同一口径 |
|
|
208
209
|
| 视图与订阅 | `fitViewport(padding)`、`subscribe()`、`dispose()` |
|
|
209
210
|
|
|
210
211
|
自定义形状(判定菱形 / 输入输出平行四边形)在 `src/flow/flow_shapes.ts`,走的是引擎的 `ICEPath` 子类机制。
|
|
@@ -252,6 +253,30 @@ const report = fromBpmnXml(xml, bpmn); // 导入并重建(含池 / 泳道容
|
|
|
252
253
|
BPMN 节点同样是**复合组件**(形状 + 角标 + 标记由 state 派生),内部子组件不写进文档、载入时重建。
|
|
253
254
|
AI Agent 生成 BPMN 的 JSON DSL(`kind: 'bpmn'`)见 `ice-entity-designer-dsl`。
|
|
254
255
|
|
|
256
|
+
#### 5.4 导出:矢量 SVG(与画布同一口径)
|
|
257
|
+
|
|
258
|
+
画布的 `toDataURL()` 是**光栅快照**(分辨率写死、放大就糊)。需要出图给文档、打印或设计工具时用
|
|
259
|
+
**矢量导出** —— 它复用引擎的 `exportSvg()`,从组件树 + 路径命令流重新生成 SVG,与画布逐像素同一口径
|
|
260
|
+
(绘制顺序、世界矩阵、样式合并、透明度、祖先裁剪、虚线、渐变、阴影、连线标签):
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
// 流程图 / BPMN(应用层,FlowDesigner 与 BpmnDesigner 都有)
|
|
264
|
+
const svg = designer.toSvg(); // 内容自适应 + 透明背景
|
|
265
|
+
const svg = designer.toSvg({ background: '#ffffff', padding: 16 });
|
|
266
|
+
const svg = designer.toSvg({ area: 'viewport' }); // 当前视口所见即所导
|
|
267
|
+
|
|
268
|
+
// 任何场景(ER / 流程图 / BPMN 都能用,含 `{ svg, width, height }` 版本)
|
|
269
|
+
const svg = IED.exportSvg(ice, { scale: 2 });
|
|
270
|
+
const { svg, width, height } = IED.exportSvgResult(ice, { padding: 12 });
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
`tests/bpmn-editor.html` 与 `tests/flowchart-editor.html` 上都有「导出 SVG」按钮,点一下即可下载
|
|
274
|
+
(BPMN 案例导出的池/泳道/事件/网关/连线/标签都是矢量)。服务端出图见引擎的 `ICE.headless()`。
|
|
275
|
+
|
|
276
|
+
限制(与引擎一致):阴影用 `feDropShadow` 近似(模糊观感不会与画布逐像素相同);SVG 与 canvas 的
|
|
277
|
+
字形栅格化是两套实现,文字位置**对齐口径一致、逐像素允许微差**;导出的是**静态瞬间**(蚂蚁线动画
|
|
278
|
+
只保留当前相位)。
|
|
279
|
+
|
|
255
280
|
## 6. 在 React 中使用
|
|
256
281
|
|
|
257
282
|
包内置 React 绑定(子路径导出 `ice-entity-designer/react`),不需要自己写 ref / effect 胶水代码。
|