ice-entity-designer 0.0.32 → 0.0.34

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.
@@ -85,7 +85,7 @@ export default class FlowDesigner {
85
85
  protected __emitChange(): void;
86
86
  /** 订阅节点的拖拽事件:拖动是画布侧的行为,designer 需要感知才能广播与记历史 */
87
87
  protected __attachNodeListeners(node: any): void;
88
- private __detachNodeListeners;
88
+ protected __detachNodeListeners(node: any): void;
89
89
  private __onBeforeMove;
90
90
  private __onAfterMove;
91
91
  private __endMoveSession;
@@ -85,7 +85,7 @@ export default class FlowDesigner {
85
85
  protected __emitChange(): void;
86
86
  /** 订阅节点的拖拽事件:拖动是画布侧的行为,designer 需要感知才能广播与记历史 */
87
87
  protected __attachNodeListeners(node: any): void;
88
- private __detachNodeListeners;
88
+ protected __detachNodeListeners(node: any): void;
89
89
  private __onBeforeMove;
90
90
  private __onAfterMove;
91
91
  private __endMoveSession;
@@ -13,6 +13,15 @@ export declare type PowerIssue = {
13
13
  message: string;
14
14
  id?: string;
15
15
  };
16
+ /**
17
+ * 母线接间隔的几何约定:设备**顶部引线**贴在母线中心线下方这么多像素。
18
+ *
19
+ * 方案 A(零引擎改动):母线当容器,挂在它上面的间隔用「几何贴合 + 父容器」表达等电位,
20
+ * 不再需要从母线中心拉一条绕行导体。评估见 `ice-render/docs/architecture/16-link-port-evaluation.md`。
21
+ */
22
+ export declare const POWER_BUS_ATTACH_GAP = 3;
23
+ /** 判定「仍然挂在母线上」的纵向容差(拖离出这个范围就算断开,走校验提示) */
24
+ export declare const POWER_BUS_ATTACH_TOLERANCE = 8;
16
25
  export declare type PowerTopology = {
17
26
  /** 带电的设备 id(从电源点出发,只经过处于合位的开关) */
18
27
  energized: string[];
@@ -69,5 +78,33 @@ export default class PowerDesigner extends FlowDesigner {
69
78
  topology(): PowerTopology;
70
79
  /** 语义校验(结构 + 电压等级 + 与五防相关的两条运行规则) */
71
80
  validatePower(): PowerIssue[];
81
+ /**
82
+ * 把设备挂到母线上(母线 T 接)。
83
+ *
84
+ * 落地形态(方案 A 的精化版,见 `ice-render/docs/architecture/16-link-port-evaluation.md`):
85
+ * **不把设备变成母线的子节点** —— 复合组件的 `hasDerivedChildren() === true` 会让序列化器
86
+ * 跳过全部子节点,嵌套会让挂上去的设备在快照里直接丢失(实测 23 → 15)。
87
+ * 改成三件事:
88
+ *
89
+ * 1. 设备 state 里记 `attachedBusId`(普通字段,随快照往返);
90
+ * 2. 位置按「顶部引线贴住母线中心线下方 POWER_BUS_ATTACH_GAP 处」摆放;
91
+ * 3. 拖动母线时由应用层把挂上去的设备一起平移(`__followBusMove`),
92
+ * 设备之间的导体本来就会跟随宿主(引擎能力),所以整条间隔会跟着走。
93
+ *
94
+ * 电气语义:拓扑把「attachedBusId 指向的母线 **且** 几何仍然贴合」当成一条隐式连接,
95
+ * 所以把设备拖开就自动断开,不需要额外的「断开」操作。
96
+ */
97
+ attachToBus(deviceOrId: any, busOrId: any, options?: {
98
+ centerX?: number;
99
+ }): any;
100
+ /** 设备挂在哪条母线上(按 `attachedBusId` 解析;不要求几何仍然贴合) */
101
+ attachedBusOf(device: any): any;
102
+ /** 设备是否**真的**还挂在母线上(记录 + 几何贴合 + 横向仍落在母线段内;拖离后为 false) */
103
+ isAttachedToBus(device: any): boolean;
104
+ /** 解除母线 T 接(设备留在原地,只是不再等电位) */
105
+ detachFromBus(deviceOrId: any): any;
106
+ /** 母线移动时,把挂在它上面的设备一起平移(应用层补上「容器」那部分行为) */
107
+ private __watchBusMove;
108
+ private __buildAdjacency;
72
109
  private __symbolById;
73
110
  }
@@ -13,6 +13,15 @@ export declare type PowerIssue = {
13
13
  message: string;
14
14
  id?: string;
15
15
  };
16
+ /**
17
+ * 母线接间隔的几何约定:设备**顶部引线**贴在母线中心线下方这么多像素。
18
+ *
19
+ * 方案 A(零引擎改动):母线当容器,挂在它上面的间隔用「几何贴合 + 父容器」表达等电位,
20
+ * 不再需要从母线中心拉一条绕行导体。评估见 `ice-render/docs/architecture/16-link-port-evaluation.md`。
21
+ */
22
+ export declare const POWER_BUS_ATTACH_GAP = 3;
23
+ /** 判定「仍然挂在母线上」的纵向容差(拖离出这个范围就算断开,走校验提示) */
24
+ export declare const POWER_BUS_ATTACH_TOLERANCE = 8;
16
25
  export declare type PowerTopology = {
17
26
  /** 带电的设备 id(从电源点出发,只经过处于合位的开关) */
18
27
  energized: string[];
@@ -69,5 +78,33 @@ export default class PowerDesigner extends FlowDesigner {
69
78
  topology(): PowerTopology;
70
79
  /** 语义校验(结构 + 电压等级 + 与五防相关的两条运行规则) */
71
80
  validatePower(): PowerIssue[];
81
+ /**
82
+ * 把设备挂到母线上(母线 T 接)。
83
+ *
84
+ * 落地形态(方案 A 的精化版,见 `ice-render/docs/architecture/16-link-port-evaluation.md`):
85
+ * **不把设备变成母线的子节点** —— 复合组件的 `hasDerivedChildren() === true` 会让序列化器
86
+ * 跳过全部子节点,嵌套会让挂上去的设备在快照里直接丢失(实测 23 → 15)。
87
+ * 改成三件事:
88
+ *
89
+ * 1. 设备 state 里记 `attachedBusId`(普通字段,随快照往返);
90
+ * 2. 位置按「顶部引线贴住母线中心线下方 POWER_BUS_ATTACH_GAP 处」摆放;
91
+ * 3. 拖动母线时由应用层把挂上去的设备一起平移(`__followBusMove`),
92
+ * 设备之间的导体本来就会跟随宿主(引擎能力),所以整条间隔会跟着走。
93
+ *
94
+ * 电气语义:拓扑把「attachedBusId 指向的母线 **且** 几何仍然贴合」当成一条隐式连接,
95
+ * 所以把设备拖开就自动断开,不需要额外的「断开」操作。
96
+ */
97
+ attachToBus(deviceOrId: any, busOrId: any, options?: {
98
+ centerX?: number;
99
+ }): any;
100
+ /** 设备挂在哪条母线上(按 `attachedBusId` 解析;不要求几何仍然贴合) */
101
+ attachedBusOf(device: any): any;
102
+ /** 设备是否**真的**还挂在母线上(记录 + 几何贴合 + 横向仍落在母线段内;拖离后为 false) */
103
+ isAttachedToBus(device: any): boolean;
104
+ /** 解除母线 T 接(设备留在原地,只是不再等电位) */
105
+ detachFromBus(deviceOrId: any): any;
106
+ /** 母线移动时,把挂在它上面的设备一起平移(应用层补上「容器」那部分行为) */
107
+ private __watchBusMove;
108
+ private __buildAdjacency;
72
109
  private __symbolById;
73
110
  }
@@ -20,7 +20,7 @@
20
20
  * 尺寸也按同一套基准走(见 `POWER_STYLE` 与各 preset 的 width/height)。
21
21
  */
22
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"];
23
+ export declare const POWER_SYMBOL_KINDS: readonly ["busbar", "breaker", "disconnector", "loadSwitch", "earthingSwitch", "earth", "currentTransformer", "voltageTransformer", "transformer", "fuse", "arrester", "reactor", "generator", "motor", "load", "capacitor", "arcSuppressionCoil", "threeWindingTransformer", "groundingTransformer", "groundingResistor", "cable", "cableTermination", "cubicle"];
24
24
  export declare type PowerSymbolKind = (typeof POWER_SYMBOL_KINDS)[number];
25
25
  declare type PowerSymbolPreset = {
26
26
  /** 中文名(属性面板 / 图例用) */
@@ -85,6 +85,13 @@ export default class PowerSymbol extends ICEGroup {
85
85
  /** 接地符号:三条递减横线 */
86
86
  private __earth;
87
87
  private __add;
88
+ /**
89
+ * 只清「派生部件」,**不能**清 `childNodes` 全集。
90
+ *
91
+ * 母线同时扮演容器(间隔作为真实子节点挂在它上面),如果这里把 childNodes 全删掉,
92
+ * 每次重建记法都会连挂在母线上的间隔一起删掉(`removeChild` 内部会 `destory()`)。
93
+ * 派生部件在 `parts` 里有登记,按登记删即可。
94
+ */
88
95
  private __clearParts;
89
96
  }
90
97
  export {};
@@ -20,7 +20,7 @@
20
20
  * 尺寸也按同一套基准走(见 `POWER_STYLE` 与各 preset 的 width/height)。
21
21
  */
22
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"];
23
+ export declare const POWER_SYMBOL_KINDS: readonly ["busbar", "breaker", "disconnector", "loadSwitch", "earthingSwitch", "earth", "currentTransformer", "voltageTransformer", "transformer", "fuse", "arrester", "reactor", "generator", "motor", "load", "capacitor", "arcSuppressionCoil", "threeWindingTransformer", "groundingTransformer", "groundingResistor", "cable", "cableTermination", "cubicle"];
24
24
  export declare type PowerSymbolKind = (typeof POWER_SYMBOL_KINDS)[number];
25
25
  declare type PowerSymbolPreset = {
26
26
  /** 中文名(属性面板 / 图例用) */
@@ -85,6 +85,13 @@ export default class PowerSymbol extends ICEGroup {
85
85
  /** 接地符号:三条递减横线 */
86
86
  private __earth;
87
87
  private __add;
88
+ /**
89
+ * 只清「派生部件」,**不能**清 `childNodes` 全集。
90
+ *
91
+ * 母线同时扮演容器(间隔作为真实子节点挂在它上面),如果这里把 childNodes 全删掉,
92
+ * 每次重建记法都会连挂在母线上的间隔一起删掉(`removeChild` 内部会 `destory()`)。
93
+ * 派生部件在 `parts` 里有登记,按登记删即可。
94
+ */
88
95
  private __clearParts;
89
96
  }
90
97
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "大漠穷秋",
3
3
  "name": "ice-entity-designer",
4
- "version": "0.0.32",
4
+ "version": "0.0.34",
5
5
  "description": "An entity designer based on ice-render.",
6
6
  "repository": {
7
7
  "type": "git",