ice-entity-designer 0.0.30 → 0.0.32

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.
@@ -1,5 +1,6 @@
1
1
  import type { ICE, SvgExportOptions } from '../ice-render/index.mjs';
2
2
  import type { FlowNodeKind } from './FlowNode.mjs';
3
+ import type { FlowPort } from './FlowEdge.mjs';
3
4
  /**
4
5
  * 流程图文档。
5
6
  *
@@ -96,7 +97,8 @@ export default class FlowDesigner {
96
97
  };
97
98
  createNode(kind: FlowNodeKind, props?: any): any;
98
99
  /** 由节点的插槽位置算出连线端点(引擎按插槽吸附,端点需要给出初始坐标) */
99
- private __slotPoint;
100
+ /** 取插槽点:`protected` 供域包(如电力一次图)建自己的连线类型时复用 */
101
+ protected __slotPoint(component: any, position: FlowPort): number[];
100
102
  createEdge(props?: any): any;
101
103
  updateNode(id: string, patch: Record<string, any>): any;
102
104
  updateEdge(id: string, patch: Record<string, any>): any;
@@ -1,5 +1,6 @@
1
1
  import type { ICE, SvgExportOptions } from '../ice-render/index';
2
2
  import type { FlowNodeKind } from './FlowNode';
3
+ import type { FlowPort } from './FlowEdge';
3
4
  /**
4
5
  * 流程图文档。
5
6
  *
@@ -96,7 +97,8 @@ export default class FlowDesigner {
96
97
  };
97
98
  createNode(kind: FlowNodeKind, props?: any): any;
98
99
  /** 由节点的插槽位置算出连线端点(引擎按插槽吸附,端点需要给出初始坐标) */
99
- private __slotPoint;
100
+ /** 取插槽点:`protected` 供域包(如电力一次图)建自己的连线类型时复用 */
101
+ protected __slotPoint(component: any, position: FlowPort): number[];
100
102
  createEdge(props?: any): any;
101
103
  updateNode(id: string, patch: Record<string, any>): any;
102
104
  updateEdge(id: string, patch: Record<string, any>): any;
@@ -15,7 +15,8 @@ export declare type FlowPort = 'T' | 'R' | 'B' | 'L' | 'C';
15
15
  * 两端节点的插槽上 —— 节点被拖动时连线自动跟随重新布线。
16
16
  */
17
17
  export default class FlowEdge extends ICEVisioLink {
18
- static readonly typeId = "FlowEdge";
18
+ /** 稳定类型标识。声明为 `string`(而不是字面量类型):域包可以派生自己的导体类型(如 PowerLine) */
19
+ static readonly typeId: string;
19
20
  /** 连线没有子组件;声明派生可保证将来即使加了内部装饰也不会被重复序列化 */
20
21
  hasDerivedChildren(): boolean;
21
22
  constructor(props?: any);
@@ -15,7 +15,8 @@ export declare type FlowPort = 'T' | 'R' | 'B' | 'L' | 'C';
15
15
  * 两端节点的插槽上 —— 节点被拖动时连线自动跟随重新布线。
16
16
  */
17
17
  export default class FlowEdge extends ICEVisioLink {
18
- static readonly typeId = "FlowEdge";
18
+ /** 稳定类型标识。声明为 `string`(而不是字面量类型):域包可以派生自己的导体类型(如 PowerLine) */
19
+ static readonly typeId: string;
19
20
  /** 连线没有子组件;声明派生可保证将来即使加了内部装饰也不会被重复序列化 */
20
21
  hasDerivedChildren(): boolean;
21
22
  constructor(props?: any);
@@ -0,0 +1,31 @@
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
+ export declare type GanttTextImportResult = {
9
+ tasks: number;
10
+ dependencies: number;
11
+ /** 解析不了 / 不支持的输入行(不阻断整体导入) */
12
+ warnings: string[];
13
+ };
14
+ /**
15
+ * 导出为 Mermaid gantt 文本。
16
+ *
17
+ * 只输出**排期语义**(负责人分组、日期、天数、进度、依赖),不输出像素/画布坐标 ——
18
+ * 要保坐标的场景用引擎快照(`designer.serialize()`)或 SVG 导出。
19
+ */
20
+ export declare function toMermaidGantt(designer: any, options?: {
21
+ title?: string;
22
+ }): string;
23
+ /**
24
+ * 从 Mermaid gantt 文本导入(容错:不认识的行进 `warnings`,不阻断整体导入)。
25
+ *
26
+ * 会先清空目标 designer 的当前模型(与 BPMN XML / UML 文本导入同一语义)。
27
+ * `after X` 按引擎的依赖语义(前置结束 → 本任务开始)反推出起始日期,并建立依赖线。
28
+ */
29
+ export declare function fromMermaidGantt(text: string, designer: any, options?: {
30
+ defaultStart?: string;
31
+ }): GanttTextImportResult;
@@ -0,0 +1,31 @@
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
+ export declare type GanttTextImportResult = {
9
+ tasks: number;
10
+ dependencies: number;
11
+ /** 解析不了 / 不支持的输入行(不阻断整体导入) */
12
+ warnings: string[];
13
+ };
14
+ /**
15
+ * 导出为 Mermaid gantt 文本。
16
+ *
17
+ * 只输出**排期语义**(负责人分组、日期、天数、进度、依赖),不输出像素/画布坐标 ——
18
+ * 要保坐标的场景用引擎快照(`designer.serialize()`)或 SVG 导出。
19
+ */
20
+ export declare function toMermaidGantt(designer: any, options?: {
21
+ title?: string;
22
+ }): string;
23
+ /**
24
+ * 从 Mermaid gantt 文本导入(容错:不认识的行进 `warnings`,不阻断整体导入)。
25
+ *
26
+ * 会先清空目标 designer 的当前模型(与 BPMN XML / UML 文本导入同一语义)。
27
+ * `after X` 按引擎的依赖语义(前置结束 → 本任务开始)反推出起始日期,并建立依赖线。
28
+ */
29
+ export declare function fromMermaidGantt(text: string, designer: any, options?: {
30
+ defaultStart?: string;
31
+ }): GanttTextImportResult;
@@ -37,6 +37,8 @@ export { default as StateNode, STATECHART_NODE_KINDS } from './statechart/StateN
37
37
  export type { StatechartNodeKind } from './statechart/StateNode.mjs';
38
38
  export { default as StateTransition } from './statechart/StateTransition.mjs';
39
39
  export { default as StatechartDesigner } from './statechart/StatechartDesigner.mjs';
40
+ export { toPlantUmlState, fromPlantUmlState, splitTransitionLabel } from './statechart/statechart_text.mjs';
41
+ export type { StatechartTextImportResult } from './statechart/statechart_text.mjs';
40
42
  export type { StatechartIssue } from './statechart/StatechartDesigner.mjs';
41
43
  export { default as GanttTask } from './gantt/GanttTask.mjs';
42
44
  export { default as GanttDependency } from './gantt/GanttDependency.mjs';
@@ -44,6 +46,13 @@ export { default as GanttRuler } from './gantt/GanttRuler.mjs';
44
46
  export type { GanttRulerOptions } from './gantt/GanttRuler.mjs';
45
47
  export { default as GanttDesigner } from './gantt/GanttDesigner.mjs';
46
48
  export type { GanttIssue, GanttTaskInput } from './gantt/GanttDesigner.mjs';
49
+ export { toMermaidGantt, fromMermaidGantt } from './gantt/gantt_text.mjs';
50
+ export type { GanttTextImportResult } from './gantt/gantt_text.mjs';
51
+ export { default as PowerSymbol, POWER_SYMBOL_KINDS, POWER_SYMBOL_PRESETS, POWER_STYLE } from './power/power_shapes.mjs';
52
+ export type { PowerSymbolKind } from './power/power_shapes.mjs';
53
+ export { default as PowerDesigner, PowerLine } from './power/PowerDesigner.mjs';
54
+ export type { PowerIssue, PowerTopology } from './power/PowerDesigner.mjs';
55
+ export { POWER_VOLTAGE_LEVELS, voltageColorOf, defaultVoltageColors } from './power/power_voltage.mjs';
47
56
  export { parseDate, formatDate, addDays, diffDays, eachDay, tickLabel } from './gantt/gantt_date.mjs';
48
57
  export { toPlantUml, fromPlantUml, arrowOf, detectUmlDialect } from './uml/uml_text.mjs';
49
58
  export type { UmlTextImportResult } from './uml/uml_text.mjs';
@@ -37,6 +37,8 @@ export { default as StateNode, STATECHART_NODE_KINDS } from './statechart/StateN
37
37
  export type { StatechartNodeKind } from './statechart/StateNode';
38
38
  export { default as StateTransition } from './statechart/StateTransition';
39
39
  export { default as StatechartDesigner } from './statechart/StatechartDesigner';
40
+ export { toPlantUmlState, fromPlantUmlState, splitTransitionLabel } from './statechart/statechart_text';
41
+ export type { StatechartTextImportResult } from './statechart/statechart_text';
40
42
  export type { StatechartIssue } from './statechart/StatechartDesigner';
41
43
  export { default as GanttTask } from './gantt/GanttTask';
42
44
  export { default as GanttDependency } from './gantt/GanttDependency';
@@ -44,6 +46,13 @@ export { default as GanttRuler } from './gantt/GanttRuler';
44
46
  export type { GanttRulerOptions } from './gantt/GanttRuler';
45
47
  export { default as GanttDesigner } from './gantt/GanttDesigner';
46
48
  export type { GanttIssue, GanttTaskInput } from './gantt/GanttDesigner';
49
+ export { toMermaidGantt, fromMermaidGantt } from './gantt/gantt_text';
50
+ export type { GanttTextImportResult } from './gantt/gantt_text';
51
+ export { default as PowerSymbol, POWER_SYMBOL_KINDS, POWER_SYMBOL_PRESETS, POWER_STYLE } from './power/power_shapes';
52
+ export type { PowerSymbolKind } from './power/power_shapes';
53
+ export { default as PowerDesigner, PowerLine } from './power/PowerDesigner';
54
+ export type { PowerIssue, PowerTopology } from './power/PowerDesigner';
55
+ export { POWER_VOLTAGE_LEVELS, voltageColorOf, defaultVoltageColors } from './power/power_voltage';
47
56
  export { parseDate, formatDate, addDays, diffDays, eachDay, tickLabel } from './gantt/gantt_date';
48
57
  export { toPlantUml, fromPlantUml, arrowOf, detectUmlDialect } from './uml/uml_text';
49
58
  export type { UmlTextImportResult } from './uml/uml_text';
@@ -0,0 +1,73 @@
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 FlowDesigner from '../flow/FlowDesigner.mjs';
9
+ import FlowEdge from '../flow/FlowEdge.mjs';
10
+ import type { PowerSymbolKind, PowerSwitchState } from './power_shapes.mjs';
11
+ export declare type PowerIssue = {
12
+ level: 'error' | 'warning';
13
+ message: string;
14
+ id?: string;
15
+ };
16
+ export declare type PowerTopology = {
17
+ /** 带电的设备 id(从电源点出发,只经过处于合位的开关) */
18
+ energized: string[];
19
+ /**
20
+ * 电气连通域(**忽略开关分合**:按「开关全合」算),用于结构检查
21
+ * (比如「这条母线所在连通域里有没有电源」)。
22
+ */
23
+ islands: string[][];
24
+ };
25
+ /** 一次系统图的导线(导体)—— 复用引擎折线,颜色跟电压等级走 */
26
+ export declare class PowerLine extends FlowEdge {
27
+ static readonly typeId = "PowerLine";
28
+ constructor(props?: any);
29
+ /** 电压等级 → 线色(不标等级时用中性色) */
30
+ applyVoltageColor(table?: Record<string, string>): void;
31
+ }
32
+ /**
33
+ * @class PowerDesigner 电力一次系统图(单线图)设计器
34
+ *
35
+ * 域包的应用层,只做四件事,其余(选择 / 增删改 / 连线 / 撤销重做 / 快照 / 适应视图 / 订阅)
36
+ * 全部继承 `FlowDesigner`:
37
+ *
38
+ * 1. 建电力图元(`PowerSymbol`)与导体(`PowerLine`);
39
+ * 2. **运行态**:开关分合、带电状态写回(供色标与状态标签用);
40
+ * 3. **拓扑**:导电岛 / 带电范围(从电源点出发,只经过合位开关);
41
+ * 4. **语义校验**:设备名唯一、电压等级一致(变压器两侧例外)、母线要有进线、
42
+ * 断路器两侧应有隔离开关,以及两条与「五防」直接相关的规则
43
+ * (**带电合接地刀闸**、**带接地线合闸送电**)。
44
+ */
45
+ export default class PowerDesigner extends FlowDesigner {
46
+ /** 色标表(可被公司规范覆盖) */
47
+ voltageColors: Record<string, string>;
48
+ constructor(ice: any);
49
+ get nodes(): any[];
50
+ get edges(): any[];
51
+ /** 覆盖电压等级色标(各电网公司规范不同) */
52
+ setVoltageColors(table: Record<string, string>): void;
53
+ /** 建一个电力设备(母线/断路器/隔离开关/互感器/变压器…) */
54
+ createSymbol(kind: PowerSymbolKind, props?: any): any;
55
+ /** 建一段导体(一次图里的导线) */
56
+ createLine(props?: any): any;
57
+ /** 开关分 / 合(运行态操作) */
58
+ setSwitchState(id: string, switchState: PowerSwitchState): any;
59
+ /** 标记 / 取消电源点(发电机、进线、主变电源侧…) */
60
+ setEnergizedSource(id: string, enabled: boolean): any;
61
+ /**
62
+ * 算拓扑并把带电状态写回节点(`energized`)—— 色标与状态标签据此着色。
63
+ *
64
+ * 规则:从电源点出发做 BFS;**只有合位的开关**才允许电流继续往外走
65
+ * (开关自身在分位时仍然算带电,因为它的一端接着电源)。
66
+ */
67
+ applyTopology(): PowerTopology;
68
+ /** 拓扑分析(不改模型,只算) */
69
+ topology(): PowerTopology;
70
+ /** 语义校验(结构 + 电压等级 + 与五防相关的两条运行规则) */
71
+ validatePower(): PowerIssue[];
72
+ private __symbolById;
73
+ }
@@ -0,0 +1,73 @@
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 FlowDesigner from '../flow/FlowDesigner';
9
+ import FlowEdge from '../flow/FlowEdge';
10
+ import type { PowerSymbolKind, PowerSwitchState } from './power_shapes';
11
+ export declare type PowerIssue = {
12
+ level: 'error' | 'warning';
13
+ message: string;
14
+ id?: string;
15
+ };
16
+ export declare type PowerTopology = {
17
+ /** 带电的设备 id(从电源点出发,只经过处于合位的开关) */
18
+ energized: string[];
19
+ /**
20
+ * 电气连通域(**忽略开关分合**:按「开关全合」算),用于结构检查
21
+ * (比如「这条母线所在连通域里有没有电源」)。
22
+ */
23
+ islands: string[][];
24
+ };
25
+ /** 一次系统图的导线(导体)—— 复用引擎折线,颜色跟电压等级走 */
26
+ export declare class PowerLine extends FlowEdge {
27
+ static readonly typeId = "PowerLine";
28
+ constructor(props?: any);
29
+ /** 电压等级 → 线色(不标等级时用中性色) */
30
+ applyVoltageColor(table?: Record<string, string>): void;
31
+ }
32
+ /**
33
+ * @class PowerDesigner 电力一次系统图(单线图)设计器
34
+ *
35
+ * 域包的应用层,只做四件事,其余(选择 / 增删改 / 连线 / 撤销重做 / 快照 / 适应视图 / 订阅)
36
+ * 全部继承 `FlowDesigner`:
37
+ *
38
+ * 1. 建电力图元(`PowerSymbol`)与导体(`PowerLine`);
39
+ * 2. **运行态**:开关分合、带电状态写回(供色标与状态标签用);
40
+ * 3. **拓扑**:导电岛 / 带电范围(从电源点出发,只经过合位开关);
41
+ * 4. **语义校验**:设备名唯一、电压等级一致(变压器两侧例外)、母线要有进线、
42
+ * 断路器两侧应有隔离开关,以及两条与「五防」直接相关的规则
43
+ * (**带电合接地刀闸**、**带接地线合闸送电**)。
44
+ */
45
+ export default class PowerDesigner extends FlowDesigner {
46
+ /** 色标表(可被公司规范覆盖) */
47
+ voltageColors: Record<string, string>;
48
+ constructor(ice: any);
49
+ get nodes(): any[];
50
+ get edges(): any[];
51
+ /** 覆盖电压等级色标(各电网公司规范不同) */
52
+ setVoltageColors(table: Record<string, string>): void;
53
+ /** 建一个电力设备(母线/断路器/隔离开关/互感器/变压器…) */
54
+ createSymbol(kind: PowerSymbolKind, props?: any): any;
55
+ /** 建一段导体(一次图里的导线) */
56
+ createLine(props?: any): any;
57
+ /** 开关分 / 合(运行态操作) */
58
+ setSwitchState(id: string, switchState: PowerSwitchState): any;
59
+ /** 标记 / 取消电源点(发电机、进线、主变电源侧…) */
60
+ setEnergizedSource(id: string, enabled: boolean): any;
61
+ /**
62
+ * 算拓扑并把带电状态写回节点(`energized`)—— 色标与状态标签据此着色。
63
+ *
64
+ * 规则:从电源点出发做 BFS;**只有合位的开关**才允许电流继续往外走
65
+ * (开关自身在分位时仍然算带电,因为它的一端接着电源)。
66
+ */
67
+ applyTopology(): PowerTopology;
68
+ /** 拓扑分析(不改模型,只算) */
69
+ topology(): PowerTopology;
70
+ /** 语义校验(结构 + 电压等级 + 与五防相关的两条运行规则) */
71
+ validatePower(): PowerIssue[];
72
+ private __symbolById;
73
+ }
@@ -0,0 +1,90 @@
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
+ /**
9
+ * 电力一次系统图(单线图)符号库。
10
+ *
11
+ * **记法来源**(不凭印象画,逐个符号对着标准图例核过):
12
+ * - JB/T 5872-1991《高压开关设备电气图形及文字符号》—— 3kV 及以上高压开关设备的图形符号与文字符号,
13
+ * 本文件里的 QF / QS / QL / QE / TA / TV / TM / FU / F / L / E 等记法都出自它;
14
+ * - GB/T 4728 系列《电气简图用图形符号》(等同采用 IEC 60617)—— 通用图形符号体系,第 7 部分为
15
+ * 开关、控制和保护器件;其中一条通用规则是:**开关电器的可动部分按「无激励、无外力」的正常状态绘制**。
16
+ * - 调度编号(设备命名,《电力系统部分设备统一编号准则》SD 240-87、母线 #1M 之类)是**另一层**,
17
+ * 属于设备命名而不是图形记法,本包用 `tag`(图形符号旁的文字符号)与之并存。
18
+ *
19
+ * **外观统一**:所有符号共用同一套描边色 / 线宽 / 文字符号字号与位置、统一端子在上下(T/B),
20
+ * 尺寸也按同一套基准走(见 `POWER_STYLE` 与各 preset 的 width/height)。
21
+ */
22
+ import { ICEGroup } from '../ice-render/index.mjs';
23
+ export declare const POWER_SYMBOL_KINDS: readonly ["busbar", "breaker", "disconnector", "loadSwitch", "earthingSwitch", "earth", "currentTransformer", "voltageTransformer", "transformer", "fuse", "arrester", "reactor", "generator", "motor", "load"];
24
+ export declare type PowerSymbolKind = (typeof POWER_SYMBOL_KINDS)[number];
25
+ declare type PowerSymbolPreset = {
26
+ /** 中文名(属性面板 / 图例用) */
27
+ label: string;
28
+ /** 图形符号旁的文字符号(JB/T 5872 / GB/T 7159 口径) */
29
+ tag: string;
30
+ width: number;
31
+ height: number;
32
+ /** 是否串联在导线上(母线/接地这类不串联的例外) */
33
+ inline: boolean;
34
+ };
35
+ /** 文字符号取自 JB/T 5872-1991 的「图形符号 + 文字符号」对照表 */
36
+ export declare const POWER_SYMBOL_PRESETS: Record<PowerSymbolKind, PowerSymbolPreset>;
37
+ /** 全局外观基准:所有符号共用,保证「一张图上不花」 */
38
+ export declare const POWER_STYLE: {
39
+ /** 符号描边色(近黑的石板色,不用纯黑,缩放/打印都不刺眼) */
40
+ strokeStyle: string;
41
+ /** 引线(导线)与符号本体同一线宽 */
42
+ lineWidth: number;
43
+ /** 接地/母线这类「加粗」元素用更粗的线 */
44
+ heavyLineWidth: number;
45
+ /** 文字符号(QF/QS…)的字号与颜色 */
46
+ tagFontSize: number;
47
+ tagColor: string;
48
+ /** 圆内字母(G / M)的字号 */
49
+ letterFontSize: number;
50
+ /** 明确不带电时的颜色(只有算过拓扑 `energized: false` 才会用到) */
51
+ deEnergizedColor: string;
52
+ /** 设备名 / 编号标注的字号与颜色 */
53
+ nameFontSize: number;
54
+ nameColor: string;
55
+ /** 开关状态标签(合 / 分)的字号 */
56
+ stateFontSize: number;
57
+ };
58
+ /** 有分 / 合状态的开关电器(其余是静止设备) */
59
+ export declare const POWER_SWITCH_KINDS: PowerSymbolKind[];
60
+ export declare type PowerSwitchState = 'open' | 'closed';
61
+ /**
62
+ * @class PowerSymbol 电力一次系统图的图元(复合组件)
63
+ *
64
+ * 与其它域包同一套做法:内部形状按 `kind` 派生(`hasDerivedChildren() === true`),不进文档、载入时重建。
65
+ * 每个派生部件都带一个稳定的 `role`(`blade` / `arcMark` / `earth` …),测试与属性面板按 role 认部件,
66
+ * **不用位置去猜**。
67
+ */
68
+ export default class PowerSymbol extends ICEGroup {
69
+ static readonly typeId = "PowerSymbol";
70
+ /** 派生部件:`{ role, component }` 列表(按添加顺序) */
71
+ parts: Array<{
72
+ role: string;
73
+ component: any;
74
+ }>;
75
+ hasDerivedChildren(): boolean;
76
+ constructor(props?: any);
77
+ protected static arrangeParam(props?: any): any;
78
+ private static readonly __shapeKeys;
79
+ setState(patch: any): void;
80
+ applyPatch(patch?: any): void;
81
+ /** 取某个角色的派生部件(测试/属性面板用) */
82
+ part(role: string): any;
83
+ /** 按 `kind` 重建内部形状与文字符号 */
84
+ protected syncShape(): void;
85
+ /** 接地符号:三条递减横线 */
86
+ private __earth;
87
+ private __add;
88
+ private __clearParts;
89
+ }
90
+ export {};
@@ -0,0 +1,90 @@
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
+ /**
9
+ * 电力一次系统图(单线图)符号库。
10
+ *
11
+ * **记法来源**(不凭印象画,逐个符号对着标准图例核过):
12
+ * - JB/T 5872-1991《高压开关设备电气图形及文字符号》—— 3kV 及以上高压开关设备的图形符号与文字符号,
13
+ * 本文件里的 QF / QS / QL / QE / TA / TV / TM / FU / F / L / E 等记法都出自它;
14
+ * - GB/T 4728 系列《电气简图用图形符号》(等同采用 IEC 60617)—— 通用图形符号体系,第 7 部分为
15
+ * 开关、控制和保护器件;其中一条通用规则是:**开关电器的可动部分按「无激励、无外力」的正常状态绘制**。
16
+ * - 调度编号(设备命名,《电力系统部分设备统一编号准则》SD 240-87、母线 #1M 之类)是**另一层**,
17
+ * 属于设备命名而不是图形记法,本包用 `tag`(图形符号旁的文字符号)与之并存。
18
+ *
19
+ * **外观统一**:所有符号共用同一套描边色 / 线宽 / 文字符号字号与位置、统一端子在上下(T/B),
20
+ * 尺寸也按同一套基准走(见 `POWER_STYLE` 与各 preset 的 width/height)。
21
+ */
22
+ import { ICEGroup } from '../ice-render/index';
23
+ export declare const POWER_SYMBOL_KINDS: readonly ["busbar", "breaker", "disconnector", "loadSwitch", "earthingSwitch", "earth", "currentTransformer", "voltageTransformer", "transformer", "fuse", "arrester", "reactor", "generator", "motor", "load"];
24
+ export declare type PowerSymbolKind = (typeof POWER_SYMBOL_KINDS)[number];
25
+ declare type PowerSymbolPreset = {
26
+ /** 中文名(属性面板 / 图例用) */
27
+ label: string;
28
+ /** 图形符号旁的文字符号(JB/T 5872 / GB/T 7159 口径) */
29
+ tag: string;
30
+ width: number;
31
+ height: number;
32
+ /** 是否串联在导线上(母线/接地这类不串联的例外) */
33
+ inline: boolean;
34
+ };
35
+ /** 文字符号取自 JB/T 5872-1991 的「图形符号 + 文字符号」对照表 */
36
+ export declare const POWER_SYMBOL_PRESETS: Record<PowerSymbolKind, PowerSymbolPreset>;
37
+ /** 全局外观基准:所有符号共用,保证「一张图上不花」 */
38
+ export declare const POWER_STYLE: {
39
+ /** 符号描边色(近黑的石板色,不用纯黑,缩放/打印都不刺眼) */
40
+ strokeStyle: string;
41
+ /** 引线(导线)与符号本体同一线宽 */
42
+ lineWidth: number;
43
+ /** 接地/母线这类「加粗」元素用更粗的线 */
44
+ heavyLineWidth: number;
45
+ /** 文字符号(QF/QS…)的字号与颜色 */
46
+ tagFontSize: number;
47
+ tagColor: string;
48
+ /** 圆内字母(G / M)的字号 */
49
+ letterFontSize: number;
50
+ /** 明确不带电时的颜色(只有算过拓扑 `energized: false` 才会用到) */
51
+ deEnergizedColor: string;
52
+ /** 设备名 / 编号标注的字号与颜色 */
53
+ nameFontSize: number;
54
+ nameColor: string;
55
+ /** 开关状态标签(合 / 分)的字号 */
56
+ stateFontSize: number;
57
+ };
58
+ /** 有分 / 合状态的开关电器(其余是静止设备) */
59
+ export declare const POWER_SWITCH_KINDS: PowerSymbolKind[];
60
+ export declare type PowerSwitchState = 'open' | 'closed';
61
+ /**
62
+ * @class PowerSymbol 电力一次系统图的图元(复合组件)
63
+ *
64
+ * 与其它域包同一套做法:内部形状按 `kind` 派生(`hasDerivedChildren() === true`),不进文档、载入时重建。
65
+ * 每个派生部件都带一个稳定的 `role`(`blade` / `arcMark` / `earth` …),测试与属性面板按 role 认部件,
66
+ * **不用位置去猜**。
67
+ */
68
+ export default class PowerSymbol extends ICEGroup {
69
+ static readonly typeId = "PowerSymbol";
70
+ /** 派生部件:`{ role, component }` 列表(按添加顺序) */
71
+ parts: Array<{
72
+ role: string;
73
+ component: any;
74
+ }>;
75
+ hasDerivedChildren(): boolean;
76
+ constructor(props?: any);
77
+ protected static arrangeParam(props?: any): any;
78
+ private static readonly __shapeKeys;
79
+ setState(patch: any): void;
80
+ applyPatch(patch?: any): void;
81
+ /** 取某个角色的派生部件(测试/属性面板用) */
82
+ part(role: string): any;
83
+ /** 按 `kind` 重建内部形状与文字符号 */
84
+ protected syncShape(): void;
85
+ /** 接地符号:三条递减横线 */
86
+ private __earth;
87
+ private __add;
88
+ private __clearParts;
89
+ }
90
+ 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
+ /**
9
+ * 电压等级与色标。
10
+ *
11
+ * 电力行业习惯用颜色区分电压等级,但**各电网公司/各设计院的规范并不统一**,
12
+ * 所以这里给的是**可覆盖的默认值**(按公开资料里流传较广的一套命名:
13
+ * 500kV 淡黄、220kV 紫、110kV 朱红、35kV 鲜黄、10kV 绛红、6kV 深蓝),
14
+ * 颜色名对应的是行业称呼,hex 是近似值 —— 需要贴合某家公司规范时,
15
+ * 用 `PowerDesigner.setVoltageColors({ '110kV': '#xxxxxx' })` 覆盖即可。
16
+ */
17
+ export declare type PowerVoltageLevel = {
18
+ /** 等级标识:'500kV' / '220kV' / '110kV' / '35kV' / '10kV' / '6kV' */
19
+ level: string;
20
+ /** 行业里的颜色称呼 */
21
+ colorName: string;
22
+ /** 近似的 hex 值(可被覆盖) */
23
+ color: string;
24
+ /** 标称电压(kV),用于排序与展示 */
25
+ kv: number;
26
+ };
27
+ export declare const POWER_VOLTAGE_LEVELS: PowerVoltageLevel[];
28
+ /** 未标注电压等级时用的中性色(不参与色标语义) */
29
+ export declare const POWER_NEUTRAL_COLOR = "#1f2937";
30
+ /** 默认色标表(level → color) */
31
+ export declare function defaultVoltageColors(): Record<string, string>;
32
+ /** 按等级取颜色;没标等级或等级不认识时回落到中性色 */
33
+ export declare function voltageColorOf(level: string, table?: Record<string, string>): string;
@@ -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
+ /**
9
+ * 电压等级与色标。
10
+ *
11
+ * 电力行业习惯用颜色区分电压等级,但**各电网公司/各设计院的规范并不统一**,
12
+ * 所以这里给的是**可覆盖的默认值**(按公开资料里流传较广的一套命名:
13
+ * 500kV 淡黄、220kV 紫、110kV 朱红、35kV 鲜黄、10kV 绛红、6kV 深蓝),
14
+ * 颜色名对应的是行业称呼,hex 是近似值 —— 需要贴合某家公司规范时,
15
+ * 用 `PowerDesigner.setVoltageColors({ '110kV': '#xxxxxx' })` 覆盖即可。
16
+ */
17
+ export declare type PowerVoltageLevel = {
18
+ /** 等级标识:'500kV' / '220kV' / '110kV' / '35kV' / '10kV' / '6kV' */
19
+ level: string;
20
+ /** 行业里的颜色称呼 */
21
+ colorName: string;
22
+ /** 近似的 hex 值(可被覆盖) */
23
+ color: string;
24
+ /** 标称电压(kV),用于排序与展示 */
25
+ kv: number;
26
+ };
27
+ export declare const POWER_VOLTAGE_LEVELS: PowerVoltageLevel[];
28
+ /** 未标注电压等级时用的中性色(不参与色标语义) */
29
+ export declare const POWER_NEUTRAL_COLOR = "#1f2937";
30
+ /** 默认色标表(level → color) */
31
+ export declare function defaultVoltageColors(): Record<string, string>;
32
+ /** 按等级取颜色;没标等级或等级不认识时回落到中性色 */
33
+ export declare function voltageColorOf(level: string, table?: Record<string, string>): string;
@@ -0,0 +1,41 @@
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
+ export declare type StatechartTextImportResult = {
9
+ states: number;
10
+ transitions: number;
11
+ /** 解析不了 / 不支持的输入行(不阻断整体导入) */
12
+ warnings: string[];
13
+ };
14
+ /**
15
+ * `事件 [守卫] / 动作` → 三段(`StateTransition.composeLabel` 的逆运算)。
16
+ *
17
+ * 规则与拼装严格对称:只按**第一个** ` / ` 切分(动作里再出现 ` / ` 也属于动作),
18
+ * 守卫取事件末尾那对方括号;缺哪段就是空串,不会凭空造出括号或斜杠。
19
+ */
20
+ export declare function splitTransitionLabel(label: string): {
21
+ event: string;
22
+ guard: string;
23
+ action: string;
24
+ };
25
+ /**
26
+ * 导出为 PlantUML 状态图文本。
27
+ *
28
+ * 只输出**记法本身**(状态、嵌套、转移),不输出坐标 —— PlantUML 自己会排版;
29
+ * 要保坐标的场景用引擎快照(`designer.serialize()`)或 SVG 导出。
30
+ */
31
+ export declare function toPlantUmlState(designer: any, options?: {
32
+ title?: string;
33
+ }): string;
34
+ /**
35
+ * 从 PlantUML 状态图文本导入(容错:不认识的行进 `warnings`,不阻断整体导入)。
36
+ *
37
+ * 会先清空目标 designer 的当前模型(与 BPMN XML / UML 文本导入同一语义)。
38
+ * 文本里没有坐标:导入后按「根级分层、子状态装在复合状态盒子里」给一套可读的初始布局,
39
+ * 用户随后可以自己排版(或交给自动布局)。
40
+ */
41
+ export declare function fromPlantUmlState(text: string, designer: any): StatechartTextImportResult;
@@ -0,0 +1,41 @@
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
+ export declare type StatechartTextImportResult = {
9
+ states: number;
10
+ transitions: number;
11
+ /** 解析不了 / 不支持的输入行(不阻断整体导入) */
12
+ warnings: string[];
13
+ };
14
+ /**
15
+ * `事件 [守卫] / 动作` → 三段(`StateTransition.composeLabel` 的逆运算)。
16
+ *
17
+ * 规则与拼装严格对称:只按**第一个** ` / ` 切分(动作里再出现 ` / ` 也属于动作),
18
+ * 守卫取事件末尾那对方括号;缺哪段就是空串,不会凭空造出括号或斜杠。
19
+ */
20
+ export declare function splitTransitionLabel(label: string): {
21
+ event: string;
22
+ guard: string;
23
+ action: string;
24
+ };
25
+ /**
26
+ * 导出为 PlantUML 状态图文本。
27
+ *
28
+ * 只输出**记法本身**(状态、嵌套、转移),不输出坐标 —— PlantUML 自己会排版;
29
+ * 要保坐标的场景用引擎快照(`designer.serialize()`)或 SVG 导出。
30
+ */
31
+ export declare function toPlantUmlState(designer: any, options?: {
32
+ title?: string;
33
+ }): string;
34
+ /**
35
+ * 从 PlantUML 状态图文本导入(容错:不认识的行进 `warnings`,不阻断整体导入)。
36
+ *
37
+ * 会先清空目标 designer 的当前模型(与 BPMN XML / UML 文本导入同一语义)。
38
+ * 文本里没有坐标:导入后按「根级分层、子状态装在复合状态盒子里」给一套可读的初始布局,
39
+ * 用户随后可以自己排版(或交给自动布局)。
40
+ */
41
+ export declare function fromPlantUmlState(text: string, designer: any): StatechartTextImportResult;