drawui-core 0.5.2 → 0.6.0

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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  配套 React 封装见 [drawui-react](https://www.npmjs.com/package/drawui-react)。
8
8
 
9
- > 🛠 **图片上传对接**(接 OSS / 自建后端)请看 [IMAGE_UPLOAD.md](./IMAGE_UPLOAD.md):含 30 MB 体积上限、60 s 超时、两种通道(`ImageUploadConfig` 与 `ImageUploader` 函数)、OSS CORS 与 STS 直传示例。
9
+ > 🛠 **图片上传对接**(接 OSS / 自建后端):完整指南随包发布,安装后直接打开 `node_modules/drawui-core/IMAGE_UPLOAD.md` 查看。含 30 MB 体积上限、60 s 超时、两种通道(`ImageUploadConfig` 与 `ImageUploader` 函数)、OSS CORS 与 STS 直传示例。
10
10
 
11
11
  ## 安装
12
12
 
@@ -63,6 +63,15 @@ interface EditorOptions {
63
63
 
64
64
  ## 更新日志
65
65
 
66
+ ### v0.5.3
67
+
68
+ > 主题:**连线避让绕行 + 线段手柄收敛 + 橡皮擦渐隐**
69
+
70
+ - 🧭 **连线不再横穿目标图形**:旧实现在「出线方向与目标方向相反」时会压线(从右边缘出线、目标却在左边,末段直接穿过目标身体)。根因是正交路由只有 H-V-H / V-V 两种单总线骨架,这种布局下**几何上无解**。新增绕行骨架(走出去 → 跨过图形上/下方 → 从目标外侧折回),仅在两个单总线骨架都仍压线时启用,并复验不穿两端图形——**原本正确的走线不受影响**,画布与 SVG 导出依旧一致。
71
+ - 🎚️ **线段手柄只给折线 / 直角折线**:新增 `supportsSegmentHandles(connectionType)` 作为唯一判据。直线(两点直连、多为斜线)与曲线没有正交段可平移,不再绘制拖动把手;命中检测同步关闭,避免「看不见但能拖」。
72
+ - 🫥 **橡皮擦渐隐**:命中后不再瞬间移除,而是在 `ERASE_FADE_MS`(200ms)内把不透明度线性降到 0 再删除。撤销粒度不变(整段拖拽仍是一个撤销点);撤销 / 重做 / `setShapes` 会中断未完成的渐隐,不会出现「撤销救回来的图形又被计时器删掉」。新导出常量 `ERASE_FADE_MS`。
73
+ - 📄 `IMAGE_UPLOAD.md` 的入口说明改为「随包发布,安装后在 `node_modules/drawui-core/` 下查看」(此前是相对链接,在 npm 上会被解析成无法访问的仓库地址)。
74
+
66
75
  ### v0.5.2
67
76
 
68
77
  > 主题:**思维导图:节点升降层级 + 拖拽换层级**
@@ -95,7 +104,7 @@ interface EditorOptions {
95
104
  - 🛡️ **单张图片体积上限 30 MB**:超过上限直接拒绝(抛 `image.tooLarge`),不会真的发请求;接入方可按需通过 `ImageUploadConfig.maxSizeBytes` 自定义。
96
105
  - ⏱ **上传超时 30 s → 60 s**:默认 `timeoutMs` 从 30000 调整为 60000;同样支持 `ImageUploadConfig.timeoutMs` 自定义。
97
106
  - 🧰 **新增 `ImageUploader` 函数通道**(优先级高于配置):需要自定义上传逻辑(OSS STS 直传、分片、压缩、重试、并发限流)时,传一个 `(file: File) => Promise<string>` 给 `imageUpload` 即可。
98
- - 📄 **新增 [`IMAGE_UPLOAD.md`](./IMAGE_UPLOAD.md)**:接入方对接指南 —— 两条通道对比、调用链速览、10 个最容易踩的坑、上线前自检 checklist。
107
+ - 📄 **新增 `IMAGE_UPLOAD.md`**(随包发布,安装后在 `node_modules/drawui-core/` 下):接入方对接指南 —— 两条通道对比、调用链速览、10 个最容易踩的坑、上线前自检 checklist。
99
108
 
100
109
  ### v0.4.2
101
110
 
@@ -274,6 +283,15 @@ interface EditorOptions {
274
283
 
275
284
  ## Changelog
276
285
 
286
+ ### v0.5.3
287
+
288
+ > Theme: **Connector detour routing + narrower segment handles + eraser fade-out**
289
+
290
+ - 🧭 **Connectors no longer cut through the target shape**: the old behaviour overlapped the target when the exit side and the approach side point away from each other (exit the right edge, target sits to the left, and the final leg runs straight through it). The root cause is that orthogonal routing only had two single-bus skeletons (H-V-H / V-H-V), which is **geometrically unsolvable** for that layout. Added a detour skeleton (step out → cross above/below the box → come back from the target's own side). It is only used when both single-bus skeletons still overlap, and it is re-validated against both end shapes — **routes that were already correct are unchanged**, and canvas output still matches SVG export.
291
+ - 🎚️ **Segment handles only for polyline / orthogonal connectors**: new `supportsSegmentHandles(connectionType)` is the single source of truth. Straight connectors (two-point, usually diagonal) and curves have no axis-aligned segment to slide, so the handle is no longer drawn — and hit-testing is disabled too, so there is no "invisible but draggable" handle.
292
+ - 🫥 **Eraser fade-out**: a hit shape is no longer removed instantly; its opacity ramps to 0 over `ERASE_FADE_MS` (200 ms) before deletion. Undo granularity is unchanged (one drag = one undo step); undo / redo / `setShapes` cancel in-flight fades so a shape restored by undo cannot be deleted by a stale timer. New export: `ERASE_FADE_MS`.
293
+ - 📄 The `IMAGE_UPLOAD.md` entry now reads "ships with the package, see `node_modules/drawui-core/`" (the previous relative link resolved to an unreachable repository URL on npm).
294
+
277
295
  ### v0.5.2
278
296
 
279
297
  > Theme: **Mind map: promote/demote a node's level + drag to re-parent**
@@ -306,7 +324,7 @@ interface EditorOptions {
306
324
  - 🛡️ **30 MB per-image size cap**: oversized images are rejected before any request is sent (throws `image.tooLarge`); the cap can be overridden via `ImageUploadConfig.maxSizeBytes`.
307
325
  - ⏱ **Upload timeout 30 s → 60 s**: default `timeoutMs` bumped from 30000 to 60000; still overridable per-config.
308
326
  - 🧰 **New `ImageUploader` function channel** (takes priority over config): pass a `(file: File) => Promise<string>` to `imageUpload` whenever you need custom upload logic (OSS STS direct upload, chunking, compression, retries, concurrency limits).
309
- - 📄 **New [`IMAGE_UPLOAD.md`](./IMAGE_UPLOAD.md)**: integration guide for hosts — both channels, call chain, 10 common OSS pitfalls, pre-release checklist.
327
+ - 📄 **New `IMAGE_UPLOAD.md`** (ships with the package, next to `node_modules/drawui-core/`): integration guide for hosts — both channels, call chain, 10 common OSS pitfalls, pre-release checklist.
310
328
 
311
329
  ### v0.4.2
312
330