drawui-core 0.5.2 → 0.5.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/README.md +21 -3
- package/dist/index.cjs +23 -22
- package/dist/index.d.cts +32 -7
- package/dist/index.d.ts +32 -7
- package/dist/index.js +23 -22
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -673,11 +673,11 @@ declare const zhCN: {
|
|
|
673
673
|
readonly 'toolbar.grid': "网格";
|
|
674
674
|
readonly 'toolbar.undo': "撤销 (Ctrl+Z)";
|
|
675
675
|
readonly 'toolbar.redo': "重做 (Ctrl+Shift+Z)";
|
|
676
|
-
readonly 'toolbar.arrow': "箭头";
|
|
677
|
-
readonly 'toolbar.text': "文本";
|
|
676
|
+
readonly 'toolbar.arrow': "箭头 (A)";
|
|
677
|
+
readonly 'toolbar.text': "文本 (T)";
|
|
678
678
|
readonly 'toolbar.pen': "画笔";
|
|
679
679
|
readonly 'toolbar.highlighter': "荧光笔";
|
|
680
|
-
readonly 'toolbar.eraser': "橡皮擦";
|
|
680
|
+
readonly 'toolbar.eraser': "橡皮擦 (E)";
|
|
681
681
|
readonly 'toolbar.uml-class': "UML 类图";
|
|
682
682
|
readonly 'toolbar.uml-interface': "UML 接口";
|
|
683
683
|
readonly 'zoom.in': "放大";
|
|
@@ -788,7 +788,6 @@ declare const zhCN: {
|
|
|
788
788
|
readonly 'table.insertColRight': "在右侧插入列";
|
|
789
789
|
readonly 'table.pickHint': "拖选行列数";
|
|
790
790
|
readonly 'ctx.copy': "复制";
|
|
791
|
-
readonly 'ctx.copyAsImage': "复制为图片";
|
|
792
791
|
readonly 'ctx.paste': "粘贴";
|
|
793
792
|
readonly 'ctx.duplicate': "创建副本";
|
|
794
793
|
readonly 'ctx.layer': "层级";
|
|
@@ -807,7 +806,7 @@ declare const zhCN: {
|
|
|
807
806
|
readonly 'ctx.lock': "锁定";
|
|
808
807
|
readonly 'ctx.unlock': "解锁";
|
|
809
808
|
readonly 'ctx.delete': "删除";
|
|
810
|
-
readonly 'toolbar.icon': "图标";
|
|
809
|
+
readonly 'toolbar.icon': "图标 (S)";
|
|
811
810
|
readonly 'toolbar.image': "图片";
|
|
812
811
|
readonly 'toolbar.more': "更多";
|
|
813
812
|
readonly 'toolbar.pageTheme': "页面主题";
|
|
@@ -835,6 +834,7 @@ declare const zhCN: {
|
|
|
835
834
|
readonly 'iconCat.arrow': "箭头方向";
|
|
836
835
|
readonly 'iconCat.misc': "常用";
|
|
837
836
|
readonly 'iconCat.emoji': "表情";
|
|
837
|
+
readonly 'iconCat.sticker': "贴纸";
|
|
838
838
|
readonly 'iconCat.device': "电脑设备";
|
|
839
839
|
readonly 'iconCat.weather': "天气";
|
|
840
840
|
readonly 'iconCat.transport': "交通";
|
|
@@ -1067,6 +1067,13 @@ declare class Editor {
|
|
|
1067
1067
|
private hoverAnchorShapeId;
|
|
1068
1068
|
private hoverConnectorId;
|
|
1069
1069
|
private eraserPoint;
|
|
1070
|
+
/**
|
|
1071
|
+
* 橡皮擦「渐隐」中的图形:id → 开始时间戳。
|
|
1072
|
+
* 命中后不立刻从 shapes 里删掉,而是先让不透明度在 ERASE_FADE_MS 内降到 0,
|
|
1073
|
+
* 到点再真正移除(这样擦除是「变浅 → 消失」而不是「啪一下不见」)。
|
|
1074
|
+
*/
|
|
1075
|
+
private eraseFades;
|
|
1076
|
+
private eraseFadeRaf;
|
|
1070
1077
|
private mindMapEditingShapeId;
|
|
1071
1078
|
private mindMapSelectedNode;
|
|
1072
1079
|
private mindMapHoverNode;
|
|
@@ -1170,6 +1177,20 @@ declare class Editor {
|
|
|
1170
1177
|
private updateBoundArrows;
|
|
1171
1178
|
private getBindingPosition;
|
|
1172
1179
|
private deleteShape;
|
|
1180
|
+
/**
|
|
1181
|
+
* 橡皮擦命中:图形先进入「渐隐」再被真正删除(见 eraseFades)。
|
|
1182
|
+
* 历史快照在拖拽开始时已经打过,所以整段擦除仍然只占一个撤销点。
|
|
1183
|
+
*/
|
|
1184
|
+
private eraseShape;
|
|
1185
|
+
/** 渐隐时钟:每帧推进,到点的图形才真正删除;整批结束后停表 */
|
|
1186
|
+
private tickEraseFade;
|
|
1187
|
+
/** 当前帧各渐隐图形的不透明度(0~1);没有渐隐时返回 undefined,避免每帧建 Map */
|
|
1188
|
+
private eraseFadeMap;
|
|
1189
|
+
/**
|
|
1190
|
+
* 丢弃所有未完成的渐隐(撤销 / 重做 / 整体换数据时调用)。
|
|
1191
|
+
* 否则「撤销把图形救回来 → 渐隐计时器到点又把它删掉」会凭空吃掉一次撤销。
|
|
1192
|
+
*/
|
|
1193
|
+
private clearEraseFades;
|
|
1173
1194
|
/**
|
|
1174
1195
|
* 选中图形(additive=true 时切换选中态);id 为空串清空选中。右键菜单/外部控制用。
|
|
1175
1196
|
* ⚠️ 组感知:点任一成员都会选中它所属的整组(同组的绑行为一致),additive 时整组一起加减。
|
|
@@ -1930,7 +1951,9 @@ declare class Renderer {
|
|
|
1930
1951
|
/** 悬停的图形 id:为其绘制四边连接锚点(飞书式悬浮提示),已选中图形由选择手柄负责 */
|
|
1931
1952
|
hoverAnchorShapeId?: string | null,
|
|
1932
1953
|
/** 悬停的连线 id:整条线描一层浅蓝高亮(提示「这条线可点、点开能调线段」) */
|
|
1933
|
-
hoverConnectorId?: string | null
|
|
1954
|
+
hoverConnectorId?: string | null,
|
|
1955
|
+
/** 橡皮擦渐隐:图形 id → 不透明度(0~1)。缺省时不改任何图形的透明度 */
|
|
1956
|
+
eraseFade?: Map<string, number> | null): void;
|
|
1934
1957
|
/** 橡皮擦:半透明主色圆 + 主色描边,半径与笔刷命中范围一致(屏幕像素恒定) */
|
|
1935
1958
|
private drawEraserBrush;
|
|
1936
1959
|
/** 连接进行中,高亮目标图形四边中点的可连锚点 */
|
|
@@ -2286,7 +2309,7 @@ declare const ICON_CATEGORIES: {
|
|
|
2286
2309
|
id: IconCategoryId;
|
|
2287
2310
|
labelKey: MessageKey;
|
|
2288
2311
|
}[];
|
|
2289
|
-
type IconCategoryId = 'status' | 'number' | 'emoji' | 'device' | 'tech' | 'chart' | 'office' | 'media' | 'arrow' | 'misc' | 'weather' | 'transport' | 'nature' | 'building' | 'medical' | 'shopping' | 'science' | 'animal' | 'time' | 'edit' | 'food' | 'communication';
|
|
2312
|
+
type IconCategoryId = 'status' | 'number' | 'emoji' | 'sticker' | 'device' | 'tech' | 'chart' | 'office' | 'media' | 'arrow' | 'misc' | 'weather' | 'transport' | 'nature' | 'building' | 'medical' | 'shopping' | 'science' | 'animal' | 'time' | 'edit' | 'food' | 'communication';
|
|
2290
2313
|
interface IconLayer {
|
|
2291
2314
|
/** 24×24 网格内的路径(语法同 SVG path,统一大写指令) */
|
|
2292
2315
|
d: string;
|
|
@@ -2423,6 +2446,8 @@ interface ToolContext {
|
|
|
2423
2446
|
addShape(shape: Shape): void;
|
|
2424
2447
|
updateShape(id: string, updates: Partial<Shape>): void;
|
|
2425
2448
|
deleteShape(id: string): void;
|
|
2449
|
+
/** 橡皮擦专用:先渐隐再删除(普通删除请用 deleteShape) */
|
|
2450
|
+
eraseShape(id: string): void;
|
|
2426
2451
|
selectShape(id: string, additive: boolean): void;
|
|
2427
2452
|
selectShapes(ids: string[]): void;
|
|
2428
2453
|
getShapes(): Shape[];
|
package/dist/index.d.ts
CHANGED
|
@@ -673,11 +673,11 @@ declare const zhCN: {
|
|
|
673
673
|
readonly 'toolbar.grid': "网格";
|
|
674
674
|
readonly 'toolbar.undo': "撤销 (Ctrl+Z)";
|
|
675
675
|
readonly 'toolbar.redo': "重做 (Ctrl+Shift+Z)";
|
|
676
|
-
readonly 'toolbar.arrow': "箭头";
|
|
677
|
-
readonly 'toolbar.text': "文本";
|
|
676
|
+
readonly 'toolbar.arrow': "箭头 (A)";
|
|
677
|
+
readonly 'toolbar.text': "文本 (T)";
|
|
678
678
|
readonly 'toolbar.pen': "画笔";
|
|
679
679
|
readonly 'toolbar.highlighter': "荧光笔";
|
|
680
|
-
readonly 'toolbar.eraser': "橡皮擦";
|
|
680
|
+
readonly 'toolbar.eraser': "橡皮擦 (E)";
|
|
681
681
|
readonly 'toolbar.uml-class': "UML 类图";
|
|
682
682
|
readonly 'toolbar.uml-interface': "UML 接口";
|
|
683
683
|
readonly 'zoom.in': "放大";
|
|
@@ -788,7 +788,6 @@ declare const zhCN: {
|
|
|
788
788
|
readonly 'table.insertColRight': "在右侧插入列";
|
|
789
789
|
readonly 'table.pickHint': "拖选行列数";
|
|
790
790
|
readonly 'ctx.copy': "复制";
|
|
791
|
-
readonly 'ctx.copyAsImage': "复制为图片";
|
|
792
791
|
readonly 'ctx.paste': "粘贴";
|
|
793
792
|
readonly 'ctx.duplicate': "创建副本";
|
|
794
793
|
readonly 'ctx.layer': "层级";
|
|
@@ -807,7 +806,7 @@ declare const zhCN: {
|
|
|
807
806
|
readonly 'ctx.lock': "锁定";
|
|
808
807
|
readonly 'ctx.unlock': "解锁";
|
|
809
808
|
readonly 'ctx.delete': "删除";
|
|
810
|
-
readonly 'toolbar.icon': "图标";
|
|
809
|
+
readonly 'toolbar.icon': "图标 (S)";
|
|
811
810
|
readonly 'toolbar.image': "图片";
|
|
812
811
|
readonly 'toolbar.more': "更多";
|
|
813
812
|
readonly 'toolbar.pageTheme': "页面主题";
|
|
@@ -835,6 +834,7 @@ declare const zhCN: {
|
|
|
835
834
|
readonly 'iconCat.arrow': "箭头方向";
|
|
836
835
|
readonly 'iconCat.misc': "常用";
|
|
837
836
|
readonly 'iconCat.emoji': "表情";
|
|
837
|
+
readonly 'iconCat.sticker': "贴纸";
|
|
838
838
|
readonly 'iconCat.device': "电脑设备";
|
|
839
839
|
readonly 'iconCat.weather': "天气";
|
|
840
840
|
readonly 'iconCat.transport': "交通";
|
|
@@ -1067,6 +1067,13 @@ declare class Editor {
|
|
|
1067
1067
|
private hoverAnchorShapeId;
|
|
1068
1068
|
private hoverConnectorId;
|
|
1069
1069
|
private eraserPoint;
|
|
1070
|
+
/**
|
|
1071
|
+
* 橡皮擦「渐隐」中的图形:id → 开始时间戳。
|
|
1072
|
+
* 命中后不立刻从 shapes 里删掉,而是先让不透明度在 ERASE_FADE_MS 内降到 0,
|
|
1073
|
+
* 到点再真正移除(这样擦除是「变浅 → 消失」而不是「啪一下不见」)。
|
|
1074
|
+
*/
|
|
1075
|
+
private eraseFades;
|
|
1076
|
+
private eraseFadeRaf;
|
|
1070
1077
|
private mindMapEditingShapeId;
|
|
1071
1078
|
private mindMapSelectedNode;
|
|
1072
1079
|
private mindMapHoverNode;
|
|
@@ -1170,6 +1177,20 @@ declare class Editor {
|
|
|
1170
1177
|
private updateBoundArrows;
|
|
1171
1178
|
private getBindingPosition;
|
|
1172
1179
|
private deleteShape;
|
|
1180
|
+
/**
|
|
1181
|
+
* 橡皮擦命中:图形先进入「渐隐」再被真正删除(见 eraseFades)。
|
|
1182
|
+
* 历史快照在拖拽开始时已经打过,所以整段擦除仍然只占一个撤销点。
|
|
1183
|
+
*/
|
|
1184
|
+
private eraseShape;
|
|
1185
|
+
/** 渐隐时钟:每帧推进,到点的图形才真正删除;整批结束后停表 */
|
|
1186
|
+
private tickEraseFade;
|
|
1187
|
+
/** 当前帧各渐隐图形的不透明度(0~1);没有渐隐时返回 undefined,避免每帧建 Map */
|
|
1188
|
+
private eraseFadeMap;
|
|
1189
|
+
/**
|
|
1190
|
+
* 丢弃所有未完成的渐隐(撤销 / 重做 / 整体换数据时调用)。
|
|
1191
|
+
* 否则「撤销把图形救回来 → 渐隐计时器到点又把它删掉」会凭空吃掉一次撤销。
|
|
1192
|
+
*/
|
|
1193
|
+
private clearEraseFades;
|
|
1173
1194
|
/**
|
|
1174
1195
|
* 选中图形(additive=true 时切换选中态);id 为空串清空选中。右键菜单/外部控制用。
|
|
1175
1196
|
* ⚠️ 组感知:点任一成员都会选中它所属的整组(同组的绑行为一致),additive 时整组一起加减。
|
|
@@ -1930,7 +1951,9 @@ declare class Renderer {
|
|
|
1930
1951
|
/** 悬停的图形 id:为其绘制四边连接锚点(飞书式悬浮提示),已选中图形由选择手柄负责 */
|
|
1931
1952
|
hoverAnchorShapeId?: string | null,
|
|
1932
1953
|
/** 悬停的连线 id:整条线描一层浅蓝高亮(提示「这条线可点、点开能调线段」) */
|
|
1933
|
-
hoverConnectorId?: string | null
|
|
1954
|
+
hoverConnectorId?: string | null,
|
|
1955
|
+
/** 橡皮擦渐隐:图形 id → 不透明度(0~1)。缺省时不改任何图形的透明度 */
|
|
1956
|
+
eraseFade?: Map<string, number> | null): void;
|
|
1934
1957
|
/** 橡皮擦:半透明主色圆 + 主色描边,半径与笔刷命中范围一致(屏幕像素恒定) */
|
|
1935
1958
|
private drawEraserBrush;
|
|
1936
1959
|
/** 连接进行中,高亮目标图形四边中点的可连锚点 */
|
|
@@ -2286,7 +2309,7 @@ declare const ICON_CATEGORIES: {
|
|
|
2286
2309
|
id: IconCategoryId;
|
|
2287
2310
|
labelKey: MessageKey;
|
|
2288
2311
|
}[];
|
|
2289
|
-
type IconCategoryId = 'status' | 'number' | 'emoji' | 'device' | 'tech' | 'chart' | 'office' | 'media' | 'arrow' | 'misc' | 'weather' | 'transport' | 'nature' | 'building' | 'medical' | 'shopping' | 'science' | 'animal' | 'time' | 'edit' | 'food' | 'communication';
|
|
2312
|
+
type IconCategoryId = 'status' | 'number' | 'emoji' | 'sticker' | 'device' | 'tech' | 'chart' | 'office' | 'media' | 'arrow' | 'misc' | 'weather' | 'transport' | 'nature' | 'building' | 'medical' | 'shopping' | 'science' | 'animal' | 'time' | 'edit' | 'food' | 'communication';
|
|
2290
2313
|
interface IconLayer {
|
|
2291
2314
|
/** 24×24 网格内的路径(语法同 SVG path,统一大写指令) */
|
|
2292
2315
|
d: string;
|
|
@@ -2423,6 +2446,8 @@ interface ToolContext {
|
|
|
2423
2446
|
addShape(shape: Shape): void;
|
|
2424
2447
|
updateShape(id: string, updates: Partial<Shape>): void;
|
|
2425
2448
|
deleteShape(id: string): void;
|
|
2449
|
+
/** 橡皮擦专用:先渐隐再删除(普通删除请用 deleteShape) */
|
|
2450
|
+
eraseShape(id: string): void;
|
|
2426
2451
|
selectShape(id: string, additive: boolean): void;
|
|
2427
2452
|
selectShapes(ids: string[]): void;
|
|
2428
2453
|
getShapes(): Shape[];
|