@_unit/unit 1.0.9 → 1.0.10

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 (108) hide show
  1. package/build/web.js +8 -8
  2. package/lib/API.d.ts +2 -0
  3. package/lib/API.js +1 -0
  4. package/lib/API.js.map +1 -1
  5. package/lib/Class/Graph/index.d.ts +2 -3
  6. package/lib/Class/Graph/index.js +161 -95
  7. package/lib/Class/Graph/index.js.map +1 -1
  8. package/lib/Class/Graph/moveSubgraph.js +2 -4
  9. package/lib/Class/Graph/moveSubgraph.js.map +1 -1
  10. package/lib/boot/index.js +2 -2
  11. package/lib/boot/index.js.map +1 -1
  12. package/lib/buildIdSetFromBundle.js +4 -3
  13. package/lib/buildIdSetFromBundle.js.map +1 -1
  14. package/lib/bundle.js +19 -1
  15. package/lib/bundle.js.map +1 -1
  16. package/lib/client/cache.js.map +1 -1
  17. package/lib/client/component.js +9 -2
  18. package/lib/client/component.js.map +1 -1
  19. package/lib/client/event/wheel.js.map +1 -1
  20. package/lib/client/platform/node/boot.js +1 -1
  21. package/lib/client/platform/node/boot.js.map +1 -1
  22. package/lib/client/platform/web/api/document.js +3 -0
  23. package/lib/client/platform/web/api/document.js.map +1 -1
  24. package/lib/client/platform/web/api/file.js +92 -0
  25. package/lib/client/platform/web/api/file.js.map +1 -1
  26. package/lib/client/platform/web/boot.d.ts +2 -2
  27. package/lib/client/platform/web/boot.js +6 -6
  28. package/lib/client/platform/web/boot.js.map +1 -1
  29. package/lib/client/platform/web/render.d.ts +1 -0
  30. package/lib/client/platform/web/render.js +11 -1
  31. package/lib/client/platform/web/render.js.map +1 -1
  32. package/lib/client/render/renderBundle.d.ts +2 -1
  33. package/lib/client/render/renderBundle.js +3 -4
  34. package/lib/client/render/renderBundle.js.map +1 -1
  35. package/lib/host/none.d.ts +1 -1
  36. package/lib/host/none.js +4 -3
  37. package/lib/host/none.js.map +1 -1
  38. package/lib/spec/escape.js.map +1 -1
  39. package/lib/spec/type.js +4 -4
  40. package/lib/spec/type.js.map +1 -1
  41. package/lib/spec/util.d.ts +1 -1
  42. package/lib/spec/util.js +19 -5
  43. package/lib/spec/util.js.map +1 -1
  44. package/lib/spec/validate.js +1 -0
  45. package/lib/spec/validate.js.map +1 -1
  46. package/lib/start.d.ts +2 -2
  47. package/lib/start.js +2 -1
  48. package/lib/start.js.map +1 -1
  49. package/lib/system/_classes.d.ts +10 -2
  50. package/lib/system/_classes.js +10 -2
  51. package/lib/system/_classes.js.map +1 -1
  52. package/lib/system/_ids.d.ts +5 -0
  53. package/lib/system/_ids.js +15 -10
  54. package/lib/system/_ids.js.map +1 -1
  55. package/lib/system/_specs.js +1 -1
  56. package/lib/system/_specs.js.map +1 -1
  57. package/lib/system/f/unit/HasInput/index.d.ts +15 -0
  58. package/lib/system/f/unit/HasInput/index.js +24 -0
  59. package/lib/system/f/unit/HasInput/index.js.map +1 -0
  60. package/lib/system/globalComponent.d.ts +1 -0
  61. package/lib/system/globalComponent.js +16 -1
  62. package/lib/system/globalComponent.js.map +1 -1
  63. package/lib/system/platform/api/observer/IntersectionObserver/index.d.ts +19 -0
  64. package/lib/system/platform/api/observer/IntersectionObserver/index.js +60 -0
  65. package/lib/system/platform/api/observer/IntersectionObserver/index.js.map +1 -0
  66. package/lib/system/platform/api/observer/SizeObserver/index.js +1 -0
  67. package/lib/system/platform/api/observer/SizeObserver/index.js.map +1 -1
  68. package/lib/system/platform/component/app/Editor/Component.d.ts +3 -1
  69. package/lib/system/platform/component/app/Editor/Component.js +186 -93
  70. package/lib/system/platform/component/app/Editor/Component.js.map +1 -1
  71. package/lib/system/platform/component/app/GUI/Component.js +2 -2
  72. package/lib/system/platform/meta/{Child → component/Child}/index.d.ts +5 -5
  73. package/lib/system/platform/meta/{Child → component/Child}/index.js +2 -2
  74. package/lib/system/platform/meta/component/Child/index.js.map +1 -0
  75. package/lib/system/platform/meta/component/Children/index.d.ts +16 -0
  76. package/lib/system/platform/meta/component/Children/index.js +70 -0
  77. package/lib/system/platform/meta/component/Children/index.js.map +1 -0
  78. package/lib/system/platform/meta/{ParentChild → component/ParentChild}/index.d.ts +5 -5
  79. package/lib/system/platform/meta/{ParentChild → component/ParentChild}/index.js +2 -2
  80. package/lib/system/platform/meta/component/ParentChild/index.js.map +1 -0
  81. package/lib/system/platform/method/array/{Push → Length0}/index.d.ts +5 -4
  82. package/lib/system/platform/method/array/{Push → Length0}/index.js +16 -9
  83. package/lib/system/platform/method/array/Length0/index.js.map +1 -0
  84. package/lib/system/platform/method/process/NewGraph/index.js +1 -1
  85. package/lib/system/platform/method/process/NewGraph/index.js.map +1 -1
  86. package/lib/types/global/IIntersectionObserver.d.ts +7 -0
  87. package/lib/types/global/{IHTTPServer.js → IIntersectionObserver.js} +1 -1
  88. package/lib/types/global/IIntersectionObserver.js.map +1 -0
  89. package/lib/types/index.d.ts +4 -1
  90. package/package-lock.json +4 -4
  91. package/package.json +3 -2
  92. package/public/_worker.js +10 -86061
  93. package/public/build.json +1 -1
  94. package/public/index.js +1163 -88931
  95. package/lib/ObjectWaiter.d.ts +0 -7
  96. package/lib/ObjectWaiter.js +0 -43
  97. package/lib/ObjectWaiter.js.map +0 -1
  98. package/lib/system/platform/api/http/HTTPServer/index.d.ts +0 -31
  99. package/lib/system/platform/api/http/HTTPServer/index.js +0 -31
  100. package/lib/system/platform/api/http/HTTPServer/index.js.map +0 -1
  101. package/lib/system/platform/api/media/image/BlobToBitmap/index.d.ts +0 -18
  102. package/lib/system/platform/api/media/image/BlobToBitmap/index.js +0 -63
  103. package/lib/system/platform/api/media/image/BlobToBitmap/index.js.map +0 -1
  104. package/lib/system/platform/meta/Child/index.js.map +0 -1
  105. package/lib/system/platform/meta/ParentChild/index.js.map +0 -1
  106. package/lib/system/platform/method/array/Push/index.js.map +0 -1
  107. package/lib/types/global/IHTTPServer.d.ts +0 -9
  108. package/lib/types/global/IHTTPServer.js.map +0 -1
@@ -1179,11 +1179,15 @@ const remapGraph = (graph, map_unit_id, map_merge_id, map_plug_id, map_datum_id)
1179
1179
  for (const sub_pin_id in plug) {
1180
1180
  const sub_pin = plug[sub_pin_id];
1181
1181
  const next_sub_pin_id = (0, object_1.pathOrDefault)(map_plug_id, [type, pin_id, sub_pin_id], sub_pin_id);
1182
- const { unitId, pinId, mergeId } = sub_pin;
1182
+ const { unitId, pinId, mergeId, kind = type } = sub_pin;
1183
1183
  if (unitId && pinId) {
1184
1184
  const new_unit_id = map_unit_id[unitId];
1185
1185
  if (new_unit_id) {
1186
- new_pin.plug[next_sub_pin_id] = { unitId: new_unit_id, pinId };
1186
+ new_pin.plug[next_sub_pin_id] = {
1187
+ unitId: new_unit_id,
1188
+ pinId,
1189
+ kind,
1190
+ };
1187
1191
  }
1188
1192
  }
1189
1193
  else if (mergeId) {
@@ -2160,6 +2164,7 @@ class Editor_ extends element_1.Element {
2160
2164
  return sub_pin;
2161
2165
  };
2162
2166
  this._spec_get_pin_node_plug_spec = (type, pin_node_id) => {
2167
+ var _b;
2163
2168
  const is_merge = this._is_merge_node_id(pin_node_id);
2164
2169
  const is_link_pin = this._is_link_pin_node_id(pin_node_id);
2165
2170
  const pinSpecs = this._spec[`${type}s`];
@@ -2175,9 +2180,10 @@ class Editor_ extends element_1.Element {
2175
2180
  }
2176
2181
  }
2177
2182
  else if (is_link_pin) {
2178
- const { unitId: pinUnitId, pinId: pinPinId } = (0, id_1.segmentLinkPinNodeId)(pin_node_id);
2183
+ const { unitId: pinUnitId, type: pinUnitType, pinId: pinUnitPinId, } = (0, id_1.segmentLinkPinNodeId)(pin_node_id);
2179
2184
  if (pinUnitId === subPinSpec.unitId &&
2180
- pinPinId === subPinSpec.pinId) {
2185
+ pinUnitPinId === subPinSpec.pinId &&
2186
+ pinUnitType === ((_b = subPinSpec.kind) !== null && _b !== void 0 ? _b : type)) {
2181
2187
  return { type, pinId, subPinId, pinSpec, subPinSpec };
2182
2188
  }
2183
2189
  }
@@ -4197,11 +4203,11 @@ class Editor_ extends element_1.Element {
4197
4203
  const int_node_id = (0, id_1.getIntNodeId)(type, pin_id, sub_pin_id);
4198
4204
  const functional = this.__is_exposed_pin_functional(type, pin_id);
4199
4205
  this._exposed_pin_unplugged_count++;
4200
- const { unitId, pinId, mergeId } = sub_pin_spec;
4206
+ const { unitId, pinId, mergeId, kind = type } = sub_pin_spec;
4201
4207
  let fallback_position = (0, geometry_1.randomInRect)(this._width / 4, this._height / 4, (3 * this._width) / 4, (3 * this._height) / 4);
4202
4208
  if (unitId && pinId) {
4203
- const pin_node_id = (0, id_1.getPinNodeId)(unitId, type, pinId);
4204
- if (type === 'output' && pinId === SELF_1.SELF) {
4209
+ const pin_node_id = (0, id_1.getPinNodeId)(unitId, kind, pinId);
4210
+ if (kind === 'output' && pinId === SELF_1.SELF) {
4205
4211
  const unit_node = this.get_node(unitId);
4206
4212
  const u = (0, geometry_1.randomUnitVector)();
4207
4213
  if (unit_node.shape === 'rect') {
@@ -4318,7 +4324,7 @@ class Editor_ extends element_1.Element {
4318
4324
  anchor_node_id = unitId;
4319
4325
  }
4320
4326
  else {
4321
- anchor_node_id = (0, id_1.getPinNodeId)(unitId, type, pinId);
4327
+ anchor_node_id = (0, id_1.getPinNodeId)(unitId, kind, pinId);
4322
4328
  this._pin_to_int[type][anchor_node_id] = int_node_id;
4323
4329
  this._pin_to_ext[type][anchor_node_id] = ext_node_id;
4324
4330
  }
@@ -4739,6 +4745,7 @@ class Editor_ extends element_1.Element {
4739
4745
  const sub_pin_spec = {
4740
4746
  unitId: new_unit_id,
4741
4747
  pinId: swap_pin_id,
4748
+ kind: type,
4742
4749
  };
4743
4750
  delete exposed_swap_pin_bag[type][tag][swap_pin_id];
4744
4751
  next_exposed_pin_index[type][tag][pin_id] = pin_index;
@@ -5641,6 +5648,7 @@ class Editor_ extends element_1.Element {
5641
5648
  this._sim_plug_exposed_pin(type, pinId, subPinId, {
5642
5649
  unitId: unit_id,
5643
5650
  pinId: pin_id,
5651
+ kind: type,
5644
5652
  });
5645
5653
  }
5646
5654
  if (data) {
@@ -5648,12 +5656,17 @@ class Editor_ extends element_1.Element {
5648
5656
  }
5649
5657
  if (merge_node_id) {
5650
5658
  const { mergeId } = (0, id_1.segmentMergeNodeId)(merge_node_id);
5651
- if (this._has_node(merge_node_id)) {
5652
- this._sim_add_link_pin_to_merge(pin_node_id, merge_node_id);
5659
+ if (this._is_merge_ref(merge_node_id)) {
5660
+ // TODO
5653
5661
  }
5654
5662
  else {
5655
- this._sim_add_merge(mergeId, merge_spec, merge_position);
5656
- this._sim_collapse_merge(mergeId);
5663
+ if (this._has_node(merge_node_id)) {
5664
+ this._sim_add_link_pin_to_merge(pin_node_id, merge_node_id);
5665
+ }
5666
+ else {
5667
+ this._sim_add_merge(mergeId, merge_spec, merge_position);
5668
+ this._sim_collapse_merge(mergeId);
5669
+ }
5657
5670
  }
5658
5671
  }
5659
5672
  };
@@ -13989,7 +14002,7 @@ class Editor_ extends element_1.Element {
13989
14002
  this._is_plug_pin_match = (type, pin_id, pin_node_id) => {
13990
14003
  var _b;
13991
14004
  const { specs } = this.$props;
13992
- const { pinId: pin_exposed_id } = (_b = this._spec_get_pin_node_plug_spec(type, pin_node_id)) !== null && _b !== void 0 ? _b : {};
14005
+ const { pinId: pin_exposed_id } = (_b = this._spec_get_pin_node_plug_spec(type, pin_node_id)) !== null && _b !== void 0 ? _b : { kind: undefined };
13993
14006
  if (pin_exposed_id === pin_id) {
13994
14007
  return false;
13995
14008
  }
@@ -14009,39 +14022,41 @@ class Editor_ extends element_1.Element {
14009
14022
  return false;
14010
14023
  }
14011
14024
  const { type: _type } = (0, id_1.segmentLinkPinNodeId)(pin_node_id);
14012
- if (type === _type) {
14013
- const exp_pin_type = this.__get_ext_pin_type(type, pin_id);
14014
- const link_pin_type = this._get_link_pin_type(pin_node_id);
14015
- if (_type === 'input') {
14016
- if (this._is_link_pin_ref(pin_node_id)) {
14017
- if (this._is_unit_datum_type(exp_pin_type)) {
14018
- return true;
14019
- }
14020
- else {
14021
- return (0, parser_2._isTypeMatch)(specs, exp_pin_type, link_pin_type);
14022
- }
14025
+ // if (type === _type) {
14026
+ const exp_pin_type = this.__get_ext_pin_type(type, pin_id);
14027
+ const link_pin_type = this._get_link_pin_type(pin_node_id);
14028
+ if (_type === 'input') {
14029
+ if (this._is_link_pin_ref(pin_node_id)) {
14030
+ if (this._is_unit_datum_type(exp_pin_type)) {
14031
+ return true;
14023
14032
  }
14024
14033
  else {
14025
14034
  return (0, parser_2._isTypeMatch)(specs, exp_pin_type, link_pin_type);
14026
14035
  }
14027
14036
  }
14028
14037
  else {
14029
- return (0, parser_2._isTypeMatch)(specs, link_pin_type, exp_pin_type);
14038
+ return (0, parser_2._isTypeMatch)(specs, exp_pin_type, link_pin_type);
14030
14039
  }
14031
14040
  }
14041
+ else {
14042
+ return (0, parser_2._isTypeMatch)(specs, link_pin_type, exp_pin_type);
14043
+ }
14044
+ // }
14032
14045
  }
14033
14046
  else if (this._is_merge_node_id(pin_node_id)) {
14034
- if ((type === 'input' && !this._is_output_only_merge(pin_node_id)) ||
14035
- (type === 'output' && !this._is_input_only_merge(pin_node_id))) {
14036
- const exp_pin_type = this.__get_ext_pin_type(type, pin_id);
14037
- const merge_pin_type = this._get_merge_pin_type(pin_node_id, type);
14038
- if (type === 'input') {
14039
- return (0, parser_2._isTypeMatch)(specs, exp_pin_type, merge_pin_type);
14040
- }
14041
- else {
14042
- return (0, parser_2._isTypeMatch)(specs, merge_pin_type, exp_pin_type);
14043
- }
14047
+ // if (
14048
+ // (type === 'input' && !this._is_output_only_merge(pin_node_id)) ||
14049
+ // (type === 'output' && !this._is_input_only_merge(pin_node_id))
14050
+ // ) {
14051
+ const exp_pin_type = this.__get_ext_pin_type(type, pin_id);
14052
+ const merge_pin_type = this._get_merge_pin_type(pin_node_id, type);
14053
+ if (type === 'input') {
14054
+ return (0, parser_2._isTypeMatch)(specs, exp_pin_type, merge_pin_type);
14044
14055
  }
14056
+ else {
14057
+ return (0, parser_2._isTypeMatch)(specs, merge_pin_type, exp_pin_type);
14058
+ }
14059
+ // }
14045
14060
  }
14046
14061
  return false;
14047
14062
  };
@@ -15356,7 +15371,40 @@ class Editor_ extends element_1.Element {
15356
15371
  this._sim_set_unit_pin_ref = (pin_node_id, ref) => {
15357
15372
  // console.log('Graph', '_sim_set_unit_pin_ref', pin_node_id, ref)
15358
15373
  const { unitId, type, pinId } = (0, id_1.segmentLinkPinNodeId)(pin_node_id);
15359
- this._sim_refresh_link_pin(unitId, type, pinId);
15374
+ const merge_node_id = this._pin_to_merge[pin_node_id];
15375
+ const merge_spec = merge_node_id && this._get_merge(merge_node_id);
15376
+ const merge_position = merge_spec && this._get_anchor_node_position(merge_node_id);
15377
+ const ext_node_id = this._pin_to_ext[type][pin_node_id];
15378
+ const position = this._get_anchor_node_position(pin_node_id);
15379
+ const data = this._pin_datum_tree[pin_node_id];
15380
+ // this._sim_graph_unit_remove_pin(pin_node_id)
15381
+ // this._sim_graph_unit_add_unit_pin(unitId, type, pinId, position)
15382
+ // if (ext_node_id) {
15383
+ // const { type, pinId, subPinId } = segmentPlugNodeId(ext_node_id)
15384
+ // this._sim_plug_exposed_pin(type, pinId, subPinId, {
15385
+ // unitId,
15386
+ // pinId,
15387
+ // kind: type,
15388
+ // })
15389
+ // }
15390
+ // if (data) {
15391
+ // this._graph_debug_set_pin_data_tree(pin_node_id, data)
15392
+ // }
15393
+ if (merge_node_id) {
15394
+ const { mergeId } = (0, id_1.segmentMergeNodeId)(merge_node_id);
15395
+ if (this._is_merge_ref(merge_node_id)) {
15396
+ // TODO
15397
+ }
15398
+ else {
15399
+ if (this._has_node(merge_node_id)) {
15400
+ this._sim_add_link_pin_to_merge(pin_node_id, merge_node_id);
15401
+ }
15402
+ else {
15403
+ this._sim_add_merge(mergeId, merge_spec, merge_position);
15404
+ this._sim_collapse_merge(mergeId);
15405
+ }
15406
+ }
15407
+ }
15360
15408
  };
15361
15409
  this._pod_set_unit_pin_ignored = (pin_node_id, ignored) => {
15362
15410
  const { unitId, type, pinId } = (0, id_1.segmentLinkPinNodeId)(pin_node_id);
@@ -17089,42 +17137,61 @@ class Editor_ extends element_1.Element {
17089
17137
  }
17090
17138
  else {
17091
17139
  if (this._is_unit_node_id(node_id)) {
17092
- if (!this._resize_node_id_pointer_id[node_id] &&
17093
- !this._animating_unit_explosion.has(node_id)) {
17094
- if (this._mode === 'none') {
17095
- if (!this._is_unit_base(node_id)) {
17096
- this._enter_subgraph(node_id);
17097
- }
17098
- else {
17099
- //
17100
- }
17101
- }
17102
- else if (this._mode === 'multiselect') {
17103
- // TODO
17104
- }
17105
- else if (this._mode === 'info') {
17106
- if (this._tree_layout) {
17107
- // TODO sub-component
17108
- }
17109
- else {
17110
- if (!this._is_unit_base(node_id)) {
17111
- this._enter_subgraph(node_id);
17112
- }
17113
- }
17114
- }
17115
- else {
17116
- // TODO mode action on soul
17117
- }
17118
- }
17140
+ this._on_unit_long_click(node_id);
17119
17141
  }
17120
17142
  else if (this._is_link_pin_node_id(node_id)) {
17121
- if (this._mode === 'change') {
17122
- // this._toggle_link_pin_memory(node_id)
17123
- }
17143
+ this._on_link_pin_long_click(node_id);
17144
+ }
17145
+ else if (this._is_datum_node_id(node_id)) {
17146
+ this._on_datum_long_click(node_id);
17147
+ }
17148
+ else {
17149
+ //
17124
17150
  }
17125
17151
  }
17126
17152
  };
17127
17153
  this._on_unit_long_click = (unit_id) => {
17154
+ if (!this._resize_node_id_pointer_id[unit_id] &&
17155
+ !this._animating_unit_explosion.has(unit_id)) {
17156
+ if (this._mode === 'none') {
17157
+ if (!this._is_unit_base(unit_id)) {
17158
+ this._enter_subgraph(unit_id);
17159
+ }
17160
+ else {
17161
+ //
17162
+ }
17163
+ }
17164
+ else if (this._mode === 'multiselect') {
17165
+ // TODO
17166
+ }
17167
+ else if (this._mode === 'info') {
17168
+ if (this._tree_layout) {
17169
+ // TODO sub-component
17170
+ }
17171
+ else {
17172
+ if (!this._is_unit_base(unit_id)) {
17173
+ this._enter_subgraph(unit_id);
17174
+ }
17175
+ }
17176
+ }
17177
+ else {
17178
+ // TODO mode action on soul
17179
+ }
17180
+ }
17181
+ };
17182
+ this._on_link_pin_long_click = (pin_node_id) => {
17183
+ if (this._mode === 'change') {
17184
+ // this._toggle_link_pin_memory(node_id)
17185
+ }
17186
+ };
17187
+ this._on_datum_long_click = (datum_node_id) => {
17188
+ if (this._mode === 'none') {
17189
+ if (this._is_datum_class_literal(datum_node_id)) {
17190
+ this._enter_datum_class_literal(datum_node_id);
17191
+ }
17192
+ }
17193
+ };
17194
+ this._enter_datum_class_literal = (datum_node_id) => {
17128
17195
  // TODO
17129
17196
  };
17130
17197
  this._on_link_pin_long_press = (pin_node_id) => {
@@ -19520,7 +19587,7 @@ class Editor_ extends element_1.Element {
19520
19587
  }
19521
19588
  }
19522
19589
  (0, IOOf_1.forIOObjKV)(unit_plugs, (type, unitPinId, { pinId, subPinId }) => {
19523
- var _b, _c;
19590
+ var _b, _c, _d;
19524
19591
  const specPin = (0, util_1.getPinSpec)(spec, type, unitPinId);
19525
19592
  const { plug } = specPin;
19526
19593
  for (const sub_pin_id in plug) {
@@ -19530,10 +19597,11 @@ class Editor_ extends element_1.Element {
19530
19597
  this._state_plug_exposed_pin(type, pinId, subPinId, {
19531
19598
  unitId: sub_pin_next_unit_id,
19532
19599
  pinId: sub_pin.pinId,
19600
+ kind: (_c = sub_pin.kind) !== null && _c !== void 0 ? _c : type,
19533
19601
  });
19534
19602
  }
19535
19603
  else if (sub_pin.mergeId) {
19536
- const sub_pin_next_merge_id = (_c = map_merge_id[sub_pin.mergeId]) !== null && _c !== void 0 ? _c : sub_pin.mergeId;
19604
+ const sub_pin_next_merge_id = (_d = map_merge_id[sub_pin.mergeId]) !== null && _d !== void 0 ? _d : sub_pin.mergeId;
19537
19605
  this._state_plug_exposed_pin(type, pinId, subPinId, {
19538
19606
  mergeId: sub_pin_next_merge_id,
19539
19607
  });
@@ -20194,6 +20262,7 @@ class Editor_ extends element_1.Element {
20194
20262
  (0, id_1.getIntNodeId)(type, pin_id, sub_pin_id));
20195
20263
  };
20196
20264
  this._get_exposed_pin_spec_internal_node_id = (type, sub_pin_spec) => {
20265
+ var _b;
20197
20266
  const { mergeId, unitId, pinId } = sub_pin_spec;
20198
20267
  if (mergeId) {
20199
20268
  const merge_node_id = (0, id_1.getMergeNodeId)(mergeId);
@@ -20205,7 +20274,7 @@ class Editor_ extends element_1.Element {
20205
20274
  return unitId;
20206
20275
  }
20207
20276
  else {
20208
- return (0, id_1.getPinNodeId)(unitId, type, pinId);
20277
+ return (0, id_1.getPinNodeId)(unitId, (_b = sub_pin_spec.kind) !== null && _b !== void 0 ? _b : type, pinId);
20209
20278
  }
20210
20279
  }
20211
20280
  else {
@@ -20927,6 +20996,7 @@ class Editor_ extends element_1.Element {
20927
20996
  this._plug_exposed_pin(_type, pinId, subPinId, {
20928
20997
  unitId,
20929
20998
  pinId: _pinId,
20999
+ kind: _type,
20930
21000
  });
20931
21001
  }
20932
21002
  }
@@ -20968,6 +21038,7 @@ class Editor_ extends element_1.Element {
20968
21038
  this._sim_plug_exposed_pin('input', _pinId, subPinId, {
20969
21039
  unitId,
20970
21040
  pinId,
21041
+ kind: 'input',
20971
21042
  });
20972
21043
  }
20973
21044
  else if (should_plug_output) {
@@ -20975,6 +21046,7 @@ class Editor_ extends element_1.Element {
20975
21046
  this._sim_plug_exposed_pin('output', _pinId, subPinId, {
20976
21047
  unitId,
20977
21048
  pinId,
21049
+ kind: 'output',
20978
21050
  });
20979
21051
  }
20980
21052
  }
@@ -21000,12 +21072,14 @@ class Editor_ extends element_1.Element {
21000
21072
  this._spec_plug_sub_pin('input', merge_input.pinId, merge_input.subPinId, {
21001
21073
  unitId,
21002
21074
  pinId,
21075
+ kind: 'input',
21003
21076
  });
21004
21077
  }
21005
21078
  if (merge_output) {
21006
21079
  this._spec_plug_sub_pin('output', merge_output.pinId, merge_output.subPinId, {
21007
21080
  unitId,
21008
21081
  pinId,
21082
+ kind: 'output',
21009
21083
  });
21010
21084
  }
21011
21085
  });
@@ -22494,15 +22568,20 @@ class Editor_ extends element_1.Element {
22494
22568
  this.__plug_exposed_pin_to = (type, pin_id, sub_pin_id, node_id) => {
22495
22569
  let sub_pin_spec;
22496
22570
  if (this._is_link_pin_node_id(node_id)) {
22497
- const { unitId, pinId } = (0, id_1.segmentLinkPinNodeId)(node_id);
22498
- sub_pin_spec = { unitId, pinId };
22571
+ const { unitId, type, pinId } = (0, id_1.segmentLinkPinNodeId)(node_id);
22572
+ sub_pin_spec = { unitId, pinId, kind: type };
22499
22573
  }
22500
22574
  else if (this._is_merge_node_id(node_id)) {
22501
22575
  const { mergeId } = (0, id_1.segmentMergeNodeId)(node_id);
22502
22576
  sub_pin_spec = { mergeId };
22503
22577
  }
22504
22578
  else if (this._is_unit_node_id(node_id)) {
22505
- sub_pin_spec = { unitId: node_id, pinId: SELF_1.SELF };
22579
+ sub_pin_spec = {
22580
+ unitId: node_id,
22581
+ type: 'output',
22582
+ pinId: SELF_1.SELF,
22583
+ kind: type,
22584
+ };
22506
22585
  }
22507
22586
  else {
22508
22587
  throw new Error(`cannot plug to node id: ${node_id}`);
@@ -22580,7 +22659,7 @@ class Editor_ extends element_1.Element {
22580
22659
  }
22581
22660
  };
22582
22661
  this._state_plug_exposed_pin = (type, pin_id, sub_pin_id, sub_pin_spec) => {
22583
- // console.log('Graph', '_state_plug_exposed_pin', type, pin_id, sub_pin_id)
22662
+ // console.log('Graph', '_state_plug_exposed_pin', type, pin_id, sub_pin_id, sub_pin_spec)
22584
22663
  this._spec_plug_sub_pin(type, pin_id, sub_pin_id, sub_pin_spec);
22585
22664
  this._sim_plug_exposed_pin(type, pin_id, sub_pin_id, sub_pin_spec);
22586
22665
  };
@@ -26679,6 +26758,7 @@ class Editor_ extends element_1.Element {
26679
26758
  next_merge_sub_pin_spec = {
26680
26759
  unitId: unit_id,
26681
26760
  pinId: pin_id,
26761
+ kind: opposite_type,
26682
26762
  };
26683
26763
  }
26684
26764
  else {
@@ -28115,6 +28195,10 @@ class Editor_ extends element_1.Element {
28115
28195
  const graph_spec_id = this._get_unit_spec_id(graphId);
28116
28196
  const graph_spec = this._get_unit_spec(graphId);
28117
28197
  const next_graph_spec = (0, object_1.clone)(graph_spec);
28198
+ const pin_plug = (0, util_1.findUnitPinPlug)(this._spec, graphId, type, pinId);
28199
+ if (pin_plug) {
28200
+ this._spec_unplug_sub_pin(type, pin_plug.pinId, pin_plug.subPinId);
28201
+ }
28118
28202
  (0, spec_2.coverPinSet)({ pinId, type }, next_graph_spec);
28119
28203
  if (mergeId) {
28120
28204
  const pin_node_id = (0, id_1.getPinNodeId)(graphId, type, pinId);
@@ -29259,7 +29343,11 @@ class Editor_ extends element_1.Element {
29259
29343
  this._plug_exposed_pin(type, pinId, subPinId, { mergeId });
29260
29344
  }
29261
29345
  else {
29262
- this._plug_exposed_pin(type, pinId, subPinId, { unitId, pinId: _pinId });
29346
+ this._plug_exposed_pin(type, pinId, subPinId, {
29347
+ unitId,
29348
+ pinId: _pinId,
29349
+ kind: type,
29350
+ });
29263
29351
  }
29264
29352
  });
29265
29353
  };
@@ -30827,6 +30915,7 @@ class Editor_ extends element_1.Element {
30827
30915
  const unit_id = (0, array_1.last)(path);
30828
30916
  const parent_path = (0, array_1.butLast)(path);
30829
30917
  const parent_spec = (0, util_1.findSpecAtPath)(specs, this._spec, parent_path);
30918
+ const pin_plug = (0, util_1.findUnitPinPlug)(parent_spec, unit_id, type, pinId);
30830
30919
  (0, object_1.pathDelete)(parent_spec, ['units', unit_id, type, pinId]);
30831
30920
  setSpec(parent_spec.id, parent_spec);
30832
30921
  }
@@ -31676,8 +31765,7 @@ class Editor_ extends element_1.Element {
31676
31765
  const { plug, unit } = nodeIds;
31677
31766
  const unit_spec = (0, util_1.findSpecAtPath)(specs, this._spec, path);
31678
31767
  if (this._is_spec_updater(path)) {
31679
- // if (this._subgraph_unit_id !== graph_unit_id) {
31680
- const spec = (0, util_1.findSpecAtPath)(specs, this._spec, path);
31768
+ const spec = (0, util_1.findSpecAtPath)(specs, this._spec, [...path, graphId]);
31681
31769
  const next_spec = (0, object_1.clone)(spec);
31682
31770
  const graph_unit_spec = this._get_unit_spec(graph_unit_id);
31683
31771
  const merges = (0, object_1.clone)(this._get_graph_unit_unit_merges(graph_unit_id, data.graphId));
@@ -31694,7 +31782,6 @@ class Editor_ extends element_1.Element {
31694
31782
  spec_interface.coverPinSet(type, pinId, path);
31695
31783
  },
31696
31784
  }), data.graphId, data, connectOpt, false);
31697
- // }
31698
31785
  }
31699
31786
  };
31700
31787
  this._on_graph_unit_move_subgraph_out_of = (data) => {
@@ -31771,17 +31858,24 @@ class Editor_ extends element_1.Element {
31771
31858
  }
31772
31859
  };
31773
31860
  this._state_graph_remove_unit_pin = (unitId, type, pinId) => {
31861
+ const pin_node_id = (0, id_1.getPinNodeId)(unitId, type, pinId);
31862
+ const mergeId = this._get_pin_merge_id(pin_node_id);
31774
31863
  this._sim_graph_remove_unit_pin(unitId, type, pinId);
31775
- this._spec_graph_remove_unit_pin(unitId, type, pinId);
31864
+ this._spec_graph_unit_remove_pin(unitId, type, pinId, mergeId);
31776
31865
  };
31777
31866
  this._sim_graph_remove_unit_pin = (unitId, type, pinId) => {
31778
- // console.log('Graph', '_sim_graph_remove_unit_pin')
31867
+ // console.log('Graph', '_sim_graph_remove_unit_pin', unitId, type, pinId)
31779
31868
  const { specs } = this.$props;
31780
31869
  const pin_node_id = (0, id_1.getPinNodeId)(unitId, type, pinId);
31781
31870
  const merge_node_id = this._pin_to_merge[pin_node_id];
31782
31871
  if (merge_node_id) {
31783
31872
  this._state_remove_pin_or_merge(pin_node_id);
31784
31873
  }
31874
+ const plug_node_id = this._pin_to_int[type][pin_node_id];
31875
+ if (plug_node_id) {
31876
+ const { type, pinId, subPinId } = (0, id_1.segmentPlugNodeId)(plug_node_id);
31877
+ this._state_unplug_exposed_pin(type, pinId, subPinId);
31878
+ }
31785
31879
  if (this._pin_node[pin_node_id]) {
31786
31880
  this._sim_graph_unit_remove_pin(pin_node_id);
31787
31881
  }
@@ -32124,7 +32218,7 @@ class Editor_ extends element_1.Element {
32124
32218
  let { type: _type, pinId, subPinId, subPinSpec } = plug;
32125
32219
  if (subPinSpec.unitId && subPinSpec.pinId) {
32126
32220
  subPinSpec = {
32127
- type: _type !== null && _type !== void 0 ? _type : type,
32221
+ kind: _type !== null && _type !== void 0 ? _type : type,
32128
32222
  unitId: subPinSpec.unitId,
32129
32223
  pinId: nextPinId,
32130
32224
  };
@@ -33538,10 +33632,10 @@ class Editor_ extends element_1.Element {
33538
33632
  this._refresh_plug_layer(ext_node_id, int_node_id);
33539
33633
  delete this._int_node_locked[int_node_id];
33540
33634
  if (this._is_pin_node_id(target_node_id)) {
33635
+ const { type: kind } = (0, id_1.segmentLinkPinNodeId)(target_node_id);
33541
33636
  this.__plug_exposed_pin_to(type, pinId, subPinId, target_node_id);
33542
33637
  }
33543
33638
  else if (this._is_unit_node_id(target_node_id)) {
33544
- const pin_node_id = (0, id_1.getSelfPinNodeId)(target_node_id);
33545
33639
  this.__plug_exposed_pin_to(type, pinId, subPinId, target_node_id);
33546
33640
  }
33547
33641
  else if (this._is_plug_node_id(target_node_id)) {
@@ -34150,6 +34244,7 @@ class Editor_ extends element_1.Element {
34150
34244
  new_pin_sub_spec = {
34151
34245
  unitId,
34152
34246
  pinId,
34247
+ kind: _type,
34153
34248
  };
34154
34249
  const pin_datum_node_id = this._get_pin_datum_node_id(pin_node_id);
34155
34250
  if (pin_datum_node_id) {
@@ -34426,6 +34521,7 @@ class Editor_ extends element_1.Element {
34426
34521
  subPinSpec: {
34427
34522
  unitId: next_unit_id,
34428
34523
  pinId: pin_id,
34524
+ kind: type,
34429
34525
  },
34430
34526
  }, updated_graph_spec);
34431
34527
  }
@@ -34434,7 +34530,13 @@ class Editor_ extends element_1.Element {
34434
34530
  pinId,
34435
34531
  type,
34436
34532
  pinSpec: {
34437
- plug: { [subPinId]: { unitId: next_unit_id, pinId: pin_id } },
34533
+ plug: {
34534
+ [subPinId]: {
34535
+ unitId: next_unit_id,
34536
+ pinId: pin_id,
34537
+ kind: type,
34538
+ },
34539
+ },
34438
34540
  ref,
34439
34541
  },
34440
34542
  }, updated_graph_spec);
@@ -34510,6 +34612,7 @@ class Editor_ extends element_1.Element {
34510
34612
  target.plugPin(type, pinId, subPinId, {
34511
34613
  unitId: next_unit_id,
34512
34614
  pinId: pin_id,
34615
+ kind: type,
34513
34616
  });
34514
34617
  }
34515
34618
  }
@@ -34517,6 +34620,7 @@ class Editor_ extends element_1.Element {
34517
34620
  plugPin(type, pinId, subPinId, {
34518
34621
  unitId: graph_id,
34519
34622
  pinId: next_pin_id,
34623
+ kind: type,
34520
34624
  }, position);
34521
34625
  }
34522
34626
  });
@@ -34800,17 +34904,6 @@ class Editor_ extends element_1.Element {
34800
34904
  forked: true,
34801
34905
  };
34802
34906
  }
34803
- _spec_graph_remove_unit_pin(unitId, type, pinId) {
34804
- const { setSpec } = this.$props;
34805
- const unit_spec_id = this._get_unit_spec_id(unitId);
34806
- const unit_spec = this._get_unit_spec(unitId);
34807
- const next_spec = (0, object_1.clone)(unit_spec);
34808
- (0, spec_2.coverPinSet)({
34809
- pinId,
34810
- type,
34811
- }, next_spec);
34812
- setSpec(unit_spec_id, next_spec);
34813
- }
34814
34907
  _graph_debug_set_unit_err(unit_id, err) {
34815
34908
  this._set_core_border_color(unit_id, theme_1.COLOR_OPAQUE_RED);
34816
34909
  if (!this._err[unit_id]) {