drawui-core 0.2.1 → 0.3.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/dist/index.cjs +16 -16
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +16 -16
- package/package.json +6 -7
package/dist/index.d.cts
CHANGED
|
@@ -13,6 +13,10 @@ interface ShapeStyle {
|
|
|
13
13
|
fillColor: string;
|
|
14
14
|
strokeWidth: number;
|
|
15
15
|
strokeDash: number[] | null;
|
|
16
|
+
/** 填充色透明度(0-1),缺省为 1;与 fillColor 叠加使用 */
|
|
17
|
+
fillOpacity?: number;
|
|
18
|
+
/** 描边色透明度(0-1),缺省为 1;与 strokeColor 叠加使用 */
|
|
19
|
+
strokeOpacity?: number;
|
|
16
20
|
}
|
|
17
21
|
type ShapeType = 'rectangle' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'diamond' | 'triangle' | 'hexagon' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'octagon' | 'star' | 'uml-class' | 'uml-interface' | 'mind-map' | 'line' | 'arrow' | 'text' | 'draw';
|
|
18
22
|
interface BaseShape {
|
|
@@ -26,6 +30,8 @@ interface BaseShape {
|
|
|
26
30
|
textColor?: string;
|
|
27
31
|
fontSize?: number;
|
|
28
32
|
highlightColor?: string;
|
|
33
|
+
/** 文字高亮背景透明度(0-1),缺省为 1 */
|
|
34
|
+
highlightOpacity?: number;
|
|
29
35
|
}
|
|
30
36
|
interface RectangleShape extends BaseShape {
|
|
31
37
|
type: 'rectangle';
|
|
@@ -179,6 +185,10 @@ interface TextShape extends BaseShape {
|
|
|
179
185
|
}
|
|
180
186
|
interface DrawShape extends BaseShape {
|
|
181
187
|
type: 'draw';
|
|
188
|
+
/** 包围盒尺寸(含少量外扩 padding,使选中框略大于笔迹) */
|
|
189
|
+
width: number;
|
|
190
|
+
height: number;
|
|
191
|
+
/** 本地坐标点(相对包围盒中心 x/y),渲染/命中均转换到世界坐标 */
|
|
182
192
|
points: Vec2[];
|
|
183
193
|
}
|
|
184
194
|
/** 思维导图节点:可带子节点;颜色/图标/属性说明均可手动覆盖,默认取层级色 */
|
|
@@ -371,14 +381,19 @@ declare const dictionaries: {
|
|
|
371
381
|
readonly 'zoom.out': "缩小";
|
|
372
382
|
readonly 'zoom.reset': "重置";
|
|
373
383
|
readonly 'style.stroke': "边框";
|
|
384
|
+
readonly 'style.line': "线条";
|
|
374
385
|
readonly 'style.fill': "填充";
|
|
375
386
|
readonly 'style.text': "文字";
|
|
376
387
|
readonly 'style.highlight': "高亮";
|
|
388
|
+
readonly 'style.prefix': "前缀符号";
|
|
389
|
+
readonly 'style.prefix.soon': "前缀符号开发中,敬请期待";
|
|
377
390
|
readonly 'style.none': "无";
|
|
391
|
+
readonly 'style.addColor': "添加颜色";
|
|
378
392
|
readonly 'style.connection': "连线";
|
|
379
393
|
readonly 'style.arrow': "箭头";
|
|
380
394
|
readonly 'style.dashed': "虚线";
|
|
381
395
|
readonly 'style.solid': "实线";
|
|
396
|
+
readonly 'style.opacity': "不透明度";
|
|
382
397
|
readonly 'style.connection.straight': "直线";
|
|
383
398
|
readonly 'style.connection.polyline': "折线";
|
|
384
399
|
readonly 'style.connection.orthogonal': "直角折线";
|
|
@@ -488,14 +503,19 @@ declare const dictionaries: {
|
|
|
488
503
|
readonly 'zoom.out': "Zoom out";
|
|
489
504
|
readonly 'zoom.reset': "Reset";
|
|
490
505
|
readonly 'style.stroke': "Border";
|
|
506
|
+
readonly 'style.line': "Line";
|
|
491
507
|
readonly 'style.fill': "Fill";
|
|
492
508
|
readonly 'style.text': "Text";
|
|
493
509
|
readonly 'style.highlight': "Highlight";
|
|
510
|
+
readonly 'style.prefix': "Prefix";
|
|
511
|
+
readonly 'style.prefix.soon': "Prefix symbols are coming soon";
|
|
494
512
|
readonly 'style.none': "None";
|
|
513
|
+
readonly 'style.addColor': "Add color";
|
|
495
514
|
readonly 'style.connection': "Connection";
|
|
496
515
|
readonly 'style.arrow': "Arrow head";
|
|
497
516
|
readonly 'style.dashed': "Dashed";
|
|
498
517
|
readonly 'style.solid': "Solid";
|
|
518
|
+
readonly 'style.opacity': "Opacity";
|
|
499
519
|
readonly 'style.connection.straight': "Straight";
|
|
500
520
|
readonly 'style.connection.polyline': "Polyline";
|
|
501
521
|
readonly 'style.connection.orthogonal': "Orthogonal";
|
|
@@ -706,10 +726,11 @@ declare class Editor {
|
|
|
706
726
|
private emitUi;
|
|
707
727
|
/** 批量更新选中图形的样式(边框色、填充色等),提交历史记录 */
|
|
708
728
|
updateSelectedShapesStyle(updates: Partial<ShapeStyle>): void;
|
|
709
|
-
/**
|
|
729
|
+
/** 批量更新选中图形的文字颜色/高亮背景色/高亮透明度,提交历史记录 */
|
|
710
730
|
updateSelectedShapesText(updates: {
|
|
711
731
|
textColor?: string;
|
|
712
732
|
highlightColor?: string;
|
|
733
|
+
highlightOpacity?: number;
|
|
713
734
|
}): void;
|
|
714
735
|
/** 批量更新选中线条/箭头的连线类型 */
|
|
715
736
|
updateConnectionType(connectionType: ConnectionType): void;
|
|
@@ -1361,6 +1382,12 @@ declare class FreehandTool extends Tool {
|
|
|
1361
1382
|
private fadeTimer;
|
|
1362
1383
|
constructor(context: ToolContext, mode: FreehandMode);
|
|
1363
1384
|
onPointerDown(point: Vec2, _event: PointerEvent): void;
|
|
1385
|
+
/**
|
|
1386
|
+
* 由世界坐标点集计算飞书式「矩形区域」几何:
|
|
1387
|
+
* 包围盒中心作为 shape 的 (x, y),points 转为相对中心的本地坐标,
|
|
1388
|
+
* 包围盒外扩少量 padding 使选中框略大于笔迹。
|
|
1389
|
+
*/
|
|
1390
|
+
private buildGeometry;
|
|
1364
1391
|
onPointerMove(point: Vec2, _event: PointerEvent): void;
|
|
1365
1392
|
onPointerUp(_point: Vec2, _event: PointerEvent): void;
|
|
1366
1393
|
onKeyDown(_event: KeyboardEvent): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ interface ShapeStyle {
|
|
|
13
13
|
fillColor: string;
|
|
14
14
|
strokeWidth: number;
|
|
15
15
|
strokeDash: number[] | null;
|
|
16
|
+
/** 填充色透明度(0-1),缺省为 1;与 fillColor 叠加使用 */
|
|
17
|
+
fillOpacity?: number;
|
|
18
|
+
/** 描边色透明度(0-1),缺省为 1;与 strokeColor 叠加使用 */
|
|
19
|
+
strokeOpacity?: number;
|
|
16
20
|
}
|
|
17
21
|
type ShapeType = 'rectangle' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'diamond' | 'triangle' | 'hexagon' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'octagon' | 'star' | 'uml-class' | 'uml-interface' | 'mind-map' | 'line' | 'arrow' | 'text' | 'draw';
|
|
18
22
|
interface BaseShape {
|
|
@@ -26,6 +30,8 @@ interface BaseShape {
|
|
|
26
30
|
textColor?: string;
|
|
27
31
|
fontSize?: number;
|
|
28
32
|
highlightColor?: string;
|
|
33
|
+
/** 文字高亮背景透明度(0-1),缺省为 1 */
|
|
34
|
+
highlightOpacity?: number;
|
|
29
35
|
}
|
|
30
36
|
interface RectangleShape extends BaseShape {
|
|
31
37
|
type: 'rectangle';
|
|
@@ -179,6 +185,10 @@ interface TextShape extends BaseShape {
|
|
|
179
185
|
}
|
|
180
186
|
interface DrawShape extends BaseShape {
|
|
181
187
|
type: 'draw';
|
|
188
|
+
/** 包围盒尺寸(含少量外扩 padding,使选中框略大于笔迹) */
|
|
189
|
+
width: number;
|
|
190
|
+
height: number;
|
|
191
|
+
/** 本地坐标点(相对包围盒中心 x/y),渲染/命中均转换到世界坐标 */
|
|
182
192
|
points: Vec2[];
|
|
183
193
|
}
|
|
184
194
|
/** 思维导图节点:可带子节点;颜色/图标/属性说明均可手动覆盖,默认取层级色 */
|
|
@@ -371,14 +381,19 @@ declare const dictionaries: {
|
|
|
371
381
|
readonly 'zoom.out': "缩小";
|
|
372
382
|
readonly 'zoom.reset': "重置";
|
|
373
383
|
readonly 'style.stroke': "边框";
|
|
384
|
+
readonly 'style.line': "线条";
|
|
374
385
|
readonly 'style.fill': "填充";
|
|
375
386
|
readonly 'style.text': "文字";
|
|
376
387
|
readonly 'style.highlight': "高亮";
|
|
388
|
+
readonly 'style.prefix': "前缀符号";
|
|
389
|
+
readonly 'style.prefix.soon': "前缀符号开发中,敬请期待";
|
|
377
390
|
readonly 'style.none': "无";
|
|
391
|
+
readonly 'style.addColor': "添加颜色";
|
|
378
392
|
readonly 'style.connection': "连线";
|
|
379
393
|
readonly 'style.arrow': "箭头";
|
|
380
394
|
readonly 'style.dashed': "虚线";
|
|
381
395
|
readonly 'style.solid': "实线";
|
|
396
|
+
readonly 'style.opacity': "不透明度";
|
|
382
397
|
readonly 'style.connection.straight': "直线";
|
|
383
398
|
readonly 'style.connection.polyline': "折线";
|
|
384
399
|
readonly 'style.connection.orthogonal': "直角折线";
|
|
@@ -488,14 +503,19 @@ declare const dictionaries: {
|
|
|
488
503
|
readonly 'zoom.out': "Zoom out";
|
|
489
504
|
readonly 'zoom.reset': "Reset";
|
|
490
505
|
readonly 'style.stroke': "Border";
|
|
506
|
+
readonly 'style.line': "Line";
|
|
491
507
|
readonly 'style.fill': "Fill";
|
|
492
508
|
readonly 'style.text': "Text";
|
|
493
509
|
readonly 'style.highlight': "Highlight";
|
|
510
|
+
readonly 'style.prefix': "Prefix";
|
|
511
|
+
readonly 'style.prefix.soon': "Prefix symbols are coming soon";
|
|
494
512
|
readonly 'style.none': "None";
|
|
513
|
+
readonly 'style.addColor': "Add color";
|
|
495
514
|
readonly 'style.connection': "Connection";
|
|
496
515
|
readonly 'style.arrow': "Arrow head";
|
|
497
516
|
readonly 'style.dashed': "Dashed";
|
|
498
517
|
readonly 'style.solid': "Solid";
|
|
518
|
+
readonly 'style.opacity': "Opacity";
|
|
499
519
|
readonly 'style.connection.straight': "Straight";
|
|
500
520
|
readonly 'style.connection.polyline': "Polyline";
|
|
501
521
|
readonly 'style.connection.orthogonal': "Orthogonal";
|
|
@@ -706,10 +726,11 @@ declare class Editor {
|
|
|
706
726
|
private emitUi;
|
|
707
727
|
/** 批量更新选中图形的样式(边框色、填充色等),提交历史记录 */
|
|
708
728
|
updateSelectedShapesStyle(updates: Partial<ShapeStyle>): void;
|
|
709
|
-
/**
|
|
729
|
+
/** 批量更新选中图形的文字颜色/高亮背景色/高亮透明度,提交历史记录 */
|
|
710
730
|
updateSelectedShapesText(updates: {
|
|
711
731
|
textColor?: string;
|
|
712
732
|
highlightColor?: string;
|
|
733
|
+
highlightOpacity?: number;
|
|
713
734
|
}): void;
|
|
714
735
|
/** 批量更新选中线条/箭头的连线类型 */
|
|
715
736
|
updateConnectionType(connectionType: ConnectionType): void;
|
|
@@ -1361,6 +1382,12 @@ declare class FreehandTool extends Tool {
|
|
|
1361
1382
|
private fadeTimer;
|
|
1362
1383
|
constructor(context: ToolContext, mode: FreehandMode);
|
|
1363
1384
|
onPointerDown(point: Vec2, _event: PointerEvent): void;
|
|
1385
|
+
/**
|
|
1386
|
+
* 由世界坐标点集计算飞书式「矩形区域」几何:
|
|
1387
|
+
* 包围盒中心作为 shape 的 (x, y),points 转为相对中心的本地坐标,
|
|
1388
|
+
* 包围盒外扩少量 padding 使选中框略大于笔迹。
|
|
1389
|
+
*/
|
|
1390
|
+
private buildGeometry;
|
|
1364
1391
|
onPointerMove(point: Vec2, _event: PointerEvent): void;
|
|
1365
1392
|
onPointerUp(_point: Vec2, _event: PointerEvent): void;
|
|
1366
1393
|
onKeyDown(_event: KeyboardEvent): void;
|