ice-entity-designer 0.0.22 → 0.0.24

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.
Files changed (39) hide show
  1. package/README.md +85 -0
  2. package/dist/index.cjs +3 -3
  3. package/dist/index.mjs +3 -3
  4. package/dist/index.umd.js +3 -3
  5. package/dist/react.cjs +3 -3
  6. package/dist/react.mjs +3 -3
  7. package/dist/types/flow/FlowDesigner.d.mts +23 -5
  8. package/dist/types/flow/FlowDesigner.d.ts +23 -5
  9. package/dist/types/ice-render/ICE.d.mts +55 -0
  10. package/dist/types/ice-render/ICE.d.ts +55 -0
  11. package/dist/types/ice-render/cross-platform/Path2DRecorder.d.mts +76 -0
  12. package/dist/types/ice-render/cross-platform/Path2DRecorder.d.ts +76 -0
  13. package/dist/types/ice-render/cross-platform/PolyfillPath2D.d.mts +8 -18
  14. package/dist/types/ice-render/cross-platform/PolyfillPath2D.d.ts +8 -18
  15. package/dist/types/ice-render/event/DOMEventDispatcher.d.mts +9 -2
  16. package/dist/types/ice-render/event/DOMEventDispatcher.d.ts +9 -2
  17. package/dist/types/ice-render/export/SvgExporter.d.mts +54 -0
  18. package/dist/types/ice-render/export/SvgExporter.d.ts +54 -0
  19. package/dist/types/ice-render/graphic/ICEComponent.d.mts +31 -1
  20. package/dist/types/ice-render/graphic/ICEComponent.d.ts +31 -1
  21. package/dist/types/ice-render/graphic/ICEPath.d.mts +7 -0
  22. package/dist/types/ice-render/graphic/ICEPath.d.ts +7 -0
  23. package/dist/types/ice-render/graphic/link/ICEPolyLine.d.mts +17 -0
  24. package/dist/types/ice-render/graphic/link/ICEPolyLine.d.ts +17 -0
  25. package/dist/types/ice-render/graphic/text/ICEText.d.mts +21 -0
  26. package/dist/types/ice-render/graphic/text/ICEText.d.ts +21 -0
  27. package/dist/types/ice-render/index.d.mts +2 -0
  28. package/dist/types/ice-render/index.d.ts +2 -0
  29. package/dist/types/index.d.mts +8 -0
  30. package/dist/types/index.d.ts +8 -0
  31. package/dist/types/uml/UmlClass.d.mts +46 -0
  32. package/dist/types/uml/UmlClass.d.ts +46 -0
  33. package/dist/types/uml/UmlDesigner.d.mts +53 -0
  34. package/dist/types/uml/UmlDesigner.d.ts +53 -0
  35. package/dist/types/uml/UmlRelation.d.mts +63 -0
  36. package/dist/types/uml/UmlRelation.d.ts +63 -0
  37. package/dist/types/uml/uml_text.d.mts +33 -0
  38. package/dist/types/uml/uml_text.d.ts +33 -0
  39. package/package.json +1 -1
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { ICEPolyLine } from '../ice-render/index';
9
+ /** UML 类图里的六种关系(记法见下方 STYLE_BY_KIND) */
10
+ export declare const UML_RELATION_KINDS: readonly ["inheritance", "realization", "association", "aggregation", "composition", "dependency"];
11
+ export declare type UmlRelationKind = (typeof UML_RELATION_KINDS)[number];
12
+ /** 端点标记种类 */
13
+ export declare type UmlMarker = 'none' | 'triangle' | 'diamond' | 'open';
14
+ declare type UmlRelationStyle = {
15
+ marker: UmlMarker;
16
+ /** 标记画在哪一端:整体(owner)一侧 / 目标(被继承、被依赖)一侧 */
17
+ markerEnd: 'start' | 'end';
18
+ filled: boolean;
19
+ dashed: boolean;
20
+ };
21
+ /**
22
+ * 六种关系的**记法**(UML 2.5 规范):
23
+ *
24
+ * | 关系 | 线型 | 端点 |
25
+ * |---|---|---|
26
+ * | 继承 generalization | 实线 | 空心三角,指向父类 |
27
+ * | 实现 realization | 虚线 | 空心三角,指向接口 |
28
+ * | 关联 association | 实线 | 无 |
29
+ * | 聚合 aggregation | 实线 | **空心菱形**,在整体一侧 |
30
+ * | 组合 composition | 实线 | **实心菱形**,在整体一侧 |
31
+ * | 依赖 dependency | 虚线 | 开放箭头,指向被依赖方 |
32
+ */
33
+ export declare const UML_RELATION_STYLE: Record<UmlRelationKind, UmlRelationStyle>;
34
+ /**
35
+ * @class UmlRelation UML 类图的关系线
36
+ *
37
+ * 复用引擎的折线(`ICEPolyLine`):插槽吸附、正交/贝塞尔路由、标签、跟随宿主都是现成的。
38
+ * 这里只补 UML 特有的一件事 —— **端点标记**(三角/菱形/开放箭头)。
39
+ *
40
+ * 关键实现选择:标记**作为路径点插进 dots**(而不是画上去的装饰),因此
41
+ * - 描边/填充走引擎既有通道(空心/实心天然可分);
42
+ * - SVG 导出**自动带上**标记(导出器读的是同一条命令流);
43
+ * - 包围盒、命中检测也跟着正确。
44
+ */
45
+ export default class UmlRelation extends ICEPolyLine {
46
+ static readonly typeId = "UmlRelation";
47
+ constructor(props?: any);
48
+ protected static arrangeParam(props: any): any;
49
+ setState(patch: any): void;
50
+ /** 属性面板/DSL 改关系种类走这里 */
51
+ applyPatch(patch?: any): void;
52
+ /** 把记法写进 state:线型、端点、填充、标记种类 */
53
+ private __applyNotation;
54
+ /**
55
+ * @overwrite
56
+ * 端点标记:按记法把三角/菱形/开放箭头的顶点插进 dots(因此它们是**路径的一部分**)。
57
+ *
58
+ * 引擎原生只支持三角(`doCalcArrowPoints()` 返回两个底角),这里对菱形做同样的展开:
59
+ * 菱形的四个顶点 = 端点 P、两个腰点、远端顶点 —— 闭合后就是一个菱形。
60
+ */
61
+ protected calcArrowPoints(): void;
62
+ }
63
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { UmlRelationKind } from './UmlRelation.mjs';
9
+ export declare type UmlTextImportResult = {
10
+ classes: number;
11
+ relations: number;
12
+ /** 解析不了 / 不支持的输入行(不阻断整体导入) */
13
+ warnings: string[];
14
+ };
15
+ /**
16
+ * 导出为 PlantUML 文本(`@startuml` 起)。
17
+ *
18
+ * 只输出**记法本身**(类、成员、关系),不输出布局坐标 —— PlantUML 自己会排;
19
+ * 需要保坐标的场景用引擎快照(`serialize()`)或 SVG 导出。
20
+ */
21
+ export declare function toPlantUml(designer: any, options?: {
22
+ title?: string;
23
+ }): string;
24
+ /**
25
+ * 从 PlantUML / Mermaid 类图文本导入(容错:不认识的行进 `warnings`,不阻断整体导入)。
26
+ *
27
+ * 会先清空目标 designer 的当前模型(与 BPMN XML 导入同一语义)。
28
+ */
29
+ export declare function fromPlantUml(text: string, designer: any): UmlTextImportResult;
30
+ /** 关系记法 ↔ PlantUML 连接符(供文档/属性面板展示) */
31
+ export declare function arrowOf(kind: UmlRelationKind): string;
32
+ /** 判断文本看起来是哪种方言(两者都被支持,这里只影响提示文案) */
33
+ export declare function detectUmlDialect(text: string): 'plantuml' | 'mermaid' | 'unknown';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { UmlRelationKind } from './UmlRelation';
9
+ export declare type UmlTextImportResult = {
10
+ classes: number;
11
+ relations: number;
12
+ /** 解析不了 / 不支持的输入行(不阻断整体导入) */
13
+ warnings: string[];
14
+ };
15
+ /**
16
+ * 导出为 PlantUML 文本(`@startuml` 起)。
17
+ *
18
+ * 只输出**记法本身**(类、成员、关系),不输出布局坐标 —— PlantUML 自己会排;
19
+ * 需要保坐标的场景用引擎快照(`serialize()`)或 SVG 导出。
20
+ */
21
+ export declare function toPlantUml(designer: any, options?: {
22
+ title?: string;
23
+ }): string;
24
+ /**
25
+ * 从 PlantUML / Mermaid 类图文本导入(容错:不认识的行进 `warnings`,不阻断整体导入)。
26
+ *
27
+ * 会先清空目标 designer 的当前模型(与 BPMN XML 导入同一语义)。
28
+ */
29
+ export declare function fromPlantUml(text: string, designer: any): UmlTextImportResult;
30
+ /** 关系记法 ↔ PlantUML 连接符(供文档/属性面板展示) */
31
+ export declare function arrowOf(kind: UmlRelationKind): string;
32
+ /** 判断文本看起来是哪种方言(两者都被支持,这里只影响提示文案) */
33
+ export declare function detectUmlDialect(text: string): 'plantuml' | 'mermaid' | 'unknown';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "大漠穷秋",
3
3
  "name": "ice-entity-designer",
4
- "version": "0.0.22",
4
+ "version": "0.0.24",
5
5
  "description": "An entity designer based on ice-render.",
6
6
  "repository": {
7
7
  "type": "git",