@_unit/unit 1.0.71 → 1.0.73

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 (41) hide show
  1. package/build/web.js +13 -13
  2. package/lib/Class/Graph/buildMoveMap.js +15 -4
  3. package/lib/Class/Graph/buildMoveMap.js.map +1 -1
  4. package/lib/Class/Graph/index.js +3 -3
  5. package/lib/Class/Graph/index.js.map +1 -1
  6. package/lib/Class/Graph/interface.d.ts +2 -0
  7. package/lib/client/component.d.ts +1 -1
  8. package/lib/client/component.js +1 -1
  9. package/lib/client/component.js.map +1 -1
  10. package/lib/spec/actions/G.d.ts +2 -2
  11. package/lib/spec/actions/G.js +4 -2
  12. package/lib/spec/actions/G.js.map +1 -1
  13. package/lib/spec/reducers/component.d.ts +4 -2
  14. package/lib/spec/reducers/component.js +16 -9
  15. package/lib/spec/reducers/component.js.map +1 -1
  16. package/lib/spec/reducers/spec.js +3 -1
  17. package/lib/spec/reducers/spec.js.map +1 -1
  18. package/lib/spec/reverseAction.js +2 -2
  19. package/lib/spec/reverseAction.js.map +1 -1
  20. package/lib/system/platform/component/app/Editor/Component.d.ts +25 -21
  21. package/lib/system/platform/component/app/Editor/Component.js +649 -382
  22. package/lib/system/platform/component/app/Editor/Component.js.map +1 -1
  23. package/lib/system/platform/component/app/Search/Component.d.ts +0 -1
  24. package/lib/system/platform/component/app/Search/Component.js +1 -33
  25. package/lib/system/platform/component/app/Search/Component.js.map +1 -1
  26. package/package.json +1 -1
  27. package/public/_worker.js +13 -13
  28. package/public/build.json +1 -1
  29. package/public/index.js +13 -13
  30. package/src/Class/Graph/buildMoveMap.ts +16 -3
  31. package/src/Class/Graph/index.ts +3 -3
  32. package/src/Class/Graph/interface.ts +2 -0
  33. package/src/client/component.ts +1 -4
  34. package/src/spec/actions/G.ts +4 -0
  35. package/src/spec/reducers/component.ts +29 -8
  36. package/src/spec/reducers/spec.ts +4 -1
  37. package/src/spec/reverseAction.ts +2 -0
  38. package/src/system/platform/component/app/Editor/Component.ts +1039 -644
  39. package/src/system/platform/component/app/Search/Component.ts +1 -52
  40. package/public/_worker.js.map +0 -7
  41. package/public/index.js.map +0 -7
@@ -1604,9 +1604,11 @@ class Editor_ extends element_1.Element {
1604
1604
  this._search_start_unit_plugs = {};
1605
1605
  this._search_start_unit_data = {};
1606
1606
  this._search_start_unit_parent_id = null;
1607
- this._search_start_unit_index = null;
1607
+ this._search_start_unit_parent_slot_name = null;
1608
+ this._search_start_unit_parent_index = null;
1608
1609
  this._search_start_graph_unit_spec = null;
1609
- this._search_start_component_index = null;
1610
+ this._search_start_unit_children = [];
1611
+ this._search_start_unit_children_slot_map = {};
1610
1612
  this._search_unit_id = null;
1611
1613
  this._search_unit_spec_id = null;
1612
1614
  this._search_unit_graph_position = null;
@@ -1670,7 +1672,7 @@ class Editor_ extends element_1.Element {
1670
1672
  this._blue_drag_hover_merge_swap = {};
1671
1673
  this._animating_enter_fullwindow = false;
1672
1674
  this._animating_sub_component_fullwindow = new Set();
1673
- this._animating_sub_component_base_id = new Set();
1675
+ this._animating_sub_component_transfer = new Set();
1674
1676
  this._abort_sub_component_enter_base_animation = {};
1675
1677
  this._abort_sub_component_leave_base_animation = {};
1676
1678
  this._abort_sub_component_base_animation = {};
@@ -1962,8 +1964,8 @@ class Editor_ extends element_1.Element {
1962
1964
  specs: {},
1963
1965
  };
1964
1966
  const center_of_screen = position !== null && position !== void 0 ? position : this._jiggle_world_screen_center();
1965
- this._add_unit(new_unit_id, bundle, null, null, position, {}, center_of_screen);
1966
- this._sim_add_sub_component(new_unit_id, undefined, undefined, undefined, undefined, image);
1967
+ this._add_unit(new_unit_id, bundle, null, null, null, position, {}, center_of_screen);
1968
+ this._sim_add_sub_component(new_unit_id, undefined, undefined, undefined, image);
1967
1969
  this._connect_sub_component(new_unit_id);
1968
1970
  image.onload = null;
1969
1971
  };
@@ -2000,7 +2002,7 @@ class Editor_ extends element_1.Element {
2000
2002
  specs: {},
2001
2003
  };
2002
2004
  const center_of_screen = position !== null && position !== void 0 ? position : this._jiggle_world_screen_center();
2003
- this._add_unit(new_unit_id, bundle, null, null, position, {}, center_of_screen);
2005
+ this._add_unit(new_unit_id, bundle, null, null, null, position, {}, center_of_screen);
2004
2006
  this._sim_add_sub_component(new_unit_id);
2005
2007
  this._connect_sub_component(new_unit_id);
2006
2008
  };
@@ -2055,8 +2057,8 @@ class Editor_ extends element_1.Element {
2055
2057
  specs: {},
2056
2058
  };
2057
2059
  const center_of_screen = position !== null && position !== void 0 ? position : this._jiggle_world_screen_center();
2058
- this._add_unit(new_unit_id, bundle, null, null, position, {}, center_of_screen);
2059
- this._sim_add_sub_component(new_unit_id, undefined, {}, undefined, undefined, element);
2060
+ this._add_unit(new_unit_id, bundle, null, null, null, position, {}, center_of_screen);
2061
+ this._sim_add_sub_component(new_unit_id, undefined, {}, undefined, element);
2060
2062
  this._connect_sub_component(new_unit_id);
2061
2063
  element.oncanplaythrough = null;
2062
2064
  };
@@ -2899,7 +2901,7 @@ class Editor_ extends element_1.Element {
2899
2901
  this.getZoom = () => {
2900
2902
  return this._zoom;
2901
2903
  };
2902
- this._dispatch_add_unit_action = (unit_id, unit) => {
2904
+ this._make_add_unit_action = (unit_id, unit) => {
2903
2905
  const position = this._get_node_position(unit_id);
2904
2906
  const pin_position = this._get_unit_pin_position(unit_id);
2905
2907
  const is_component = this._is_unit_component(unit_id);
@@ -2909,25 +2911,24 @@ class Editor_ extends element_1.Element {
2909
2911
  const layout_parent_id = is_component
2910
2912
  ? this._spec_get_sub_component_parent_id(unit_id)
2911
2913
  : null;
2914
+ const layout_slot = is_component
2915
+ ? this._spec_get_sub_component_slot_name(unit_id)
2916
+ : null;
2912
2917
  const layout_index = is_component
2913
- ? this._get_sub_component_index(unit_id)
2918
+ ? this._spec_get_sub_component_index(unit_id)
2914
2919
  : null;
2915
2920
  const layout_children = is_component
2916
2921
  ? this._spec_get_sub_component_children(unit_id)
2917
2922
  : null;
2918
2923
  const layout_children_slot = is_component
2919
- ? this._get_sub_component_children_slot(unit_id)
2924
+ ? this._spec_get_sub_component_children_slot(unit_id)
2920
2925
  : null;
2921
2926
  const bundle = (0, clone_1.clone)({ unit });
2922
- this._dispatch_action((0, G_1.makeAddUnitAction)(unit_id, bundle, {}, {}, layout_parent_id, layout_index, layout_children, layout_children_slot, position, pin_position, layout_position));
2923
- };
2924
- this._dispatch_swap_unit_action = (unit_id, unit_bundle, unit_merges, unit_plugs, unit_parent_id, unit_index, unit_children, unit_children_slot, new_unit_id, new_unit_bundle, new_unit_merges, new_unit_plugs, new_unit_parent_id, new_unit_index, new_unit_children, new_unit_children_slot) => {
2925
- const action = this._make_swap_unit_action(unit_id, unit_bundle, unit_merges, unit_plugs, unit_parent_id, unit_index, unit_children, unit_children_slot, new_unit_id, new_unit_bundle, new_unit_merges, new_unit_plugs, new_unit_parent_id, new_unit_index, new_unit_children, new_unit_children_slot);
2926
- this._dispatch_action(action);
2927
+ return (0, G_1.makeAddUnitAction)(unit_id, bundle, {}, {}, layout_parent_id, layout_slot, layout_index, layout_children, layout_children_slot, position, pin_position, layout_position);
2927
2928
  };
2928
- this._make_swap_unit_action = (unit_id, unit_bundle, unit_merges, unit_plugs, unit_parent_id, unit_index, unit_children, unit_children_slot, new_unit_id, new_unit_bundle, new_unit_merges, new_unit_plugs, new_unit_parent_id, new_unit_index, new_unit_children, new_unit_children_slot) => {
2929
- const remove_unit_actions = (0, G_1.makeRemoveUnitAction)(unit_id, unit_bundle, unit_merges, unit_plugs, unit_parent_id, unit_index, unit_children, unit_children_slot, null, null, null);
2930
- const add_unit_action = (0, G_1.makeAddUnitAction)(new_unit_id, new_unit_bundle, new_unit_merges, new_unit_plugs, new_unit_parent_id, new_unit_index, new_unit_children, new_unit_children_slot, undefined, undefined, undefined);
2929
+ this._make_swap_unit_action = (unit_id, unit_bundle, unit_merges, unit_plugs, unit_parent_id, unit_parent_slot, unit_index, unit_children, unit_children_slot, new_unit_id, new_unit_bundle, new_unit_merges, new_unit_plugs, new_unit_parent_id, new_unit_parent_slot, new_unit_index, new_unit_children, new_unit_children_slot) => {
2930
+ const remove_unit_actions = (0, G_1.makeRemoveUnitAction)(unit_id, unit_bundle, unit_merges, unit_plugs, unit_parent_id, unit_parent_slot, unit_index, unit_children, unit_children_slot, null, null, null);
2931
+ const add_unit_action = (0, G_1.makeAddUnitAction)(new_unit_id, new_unit_bundle, new_unit_merges, new_unit_plugs, new_unit_parent_id, new_unit_parent_slot, new_unit_index, new_unit_children, new_unit_children_slot, undefined, undefined, undefined);
2931
2932
  const actions = [remove_unit_actions, add_unit_action];
2932
2933
  return (0, G_1.makeBulkEditAction)(actions);
2933
2934
  };
@@ -2952,16 +2953,19 @@ class Editor_ extends element_1.Element {
2952
2953
  const layout_parent_id = is_component
2953
2954
  ? this._spec_get_sub_component_parent_id(unit_id)
2954
2955
  : null;
2956
+ const layout_slot = is_component
2957
+ ? this._spec_get_sub_component_slot_name(unit_id)
2958
+ : null;
2955
2959
  const layout_index = is_component
2956
- ? this._get_sub_component_index(unit_id)
2960
+ ? this._spec_get_sub_component_index(unit_id)
2957
2961
  : null;
2958
2962
  const layout_children = is_component
2959
2963
  ? this._spec_get_sub_component_children(unit_id)
2960
2964
  : null;
2961
2965
  const layout_children_slot = is_component
2962
- ? this._get_sub_component_children_slot(unit_id)
2966
+ ? this._spec_get_sub_component_children_slot(unit_id)
2963
2967
  : null;
2964
- return (0, clone_1.clone)((0, G_1.makeRemoveUnitAction)(unit_id, bundle, includeMerges ? merges : undefined, includePlugs ? plugs : undefined, layout_parent_id, layout_index, layout_children, layout_children_slot, position, pin_position, layout_position));
2968
+ return (0, clone_1.clone)((0, G_1.makeRemoveUnitAction)(unit_id, bundle, includeMerges ? merges : undefined, includePlugs ? plugs : undefined, layout_parent_id, layout_slot, layout_index, layout_children, layout_children_slot, position, pin_position, layout_position));
2965
2969
  };
2966
2970
  this._dispatch_action_remove_unit = (unit_id) => {
2967
2971
  const action = this._make_remove_unit_action(unit_id);
@@ -2990,6 +2994,10 @@ class Editor_ extends element_1.Element {
2990
2994
  this._spec_get_sub_component_children = (sub_component_id) => {
2991
2995
  return (0, component_2.getSubComponentChildren)(this._spec, sub_component_id);
2992
2996
  };
2997
+ this._spec_get_sub_component_children_count = (sub_component_id) => {
2998
+ const children = this._spec_get_sub_component_children(sub_component_id);
2999
+ return children.length;
3000
+ };
2993
3001
  this._spec_add_unit = (unitId, unit, specs, register = true, deep = true) => {
2994
3002
  // console.log('Graph', '_spec_add_unit', unitId, unit)
2995
3003
  const { parent } = this.$props;
@@ -3006,12 +3014,12 @@ class Editor_ extends element_1.Element {
3006
3014
  const mirrored_spec = (0, clone_1.clone)(spec);
3007
3015
  setSpec(spec.id, mirrored_spec);
3008
3016
  };
3009
- this._spec_append_component = (parent_id, unit_id, sub_component_spec = { children: [] }) => {
3017
+ this._spec_append_component = (parent_id, unit_id, slot_name, sub_component_spec = { children: [] }) => {
3010
3018
  // console.log('Graph', '_spec_append_component', parent_id, id)
3011
3019
  this._spec.component = this._spec.component || { subComponents: {} };
3012
3020
  (0, component_1.setSubComponent)({ unitId: unit_id, subComponent: sub_component_spec }, this._spec.component);
3013
3021
  if (parent_id) {
3014
- (0, component_1.appendSubComponentChild)({ parentId: parent_id, childId: unit_id }, this._spec.component);
3022
+ (0, component_1.appendSubComponentChild)({ parentId: parent_id, childId: unit_id, slotName: slot_name }, this._spec.component);
3015
3023
  }
3016
3024
  else {
3017
3025
  (0, component_1.appendRoot)({ childId: unit_id }, this._spec.component);
@@ -3318,7 +3326,6 @@ class Editor_ extends element_1.Element {
3318
3326
  description.$element.style.height = `${height + 3}px`;
3319
3327
  };
3320
3328
  this._sim_add_unit_core = (unit_id, unit, position, init_size = {}) => {
3321
- // console.log('Graph', '_sim_add_core', unit_id, unit, position)
3322
3329
  var _a, _b, _c, _d;
3323
3330
  const { classes } = this.$system;
3324
3331
  const { config, specs, getSpec } = this.$props;
@@ -3807,11 +3814,11 @@ class Editor_ extends element_1.Element {
3807
3814
  if (this._tree_layout) {
3808
3815
  const layout_core = this._layout_core[unit_id];
3809
3816
  this._listen_layout_core(unit_id, layout_core);
3817
+ this._move_core_content_graph_to_layout(unit_id);
3810
3818
  if (parent_id && !this._layout_path.includes(parent_id)) {
3811
3819
  //
3812
3820
  }
3813
3821
  else {
3814
- this._move_core_content_graph_to_layout(unit_id);
3815
3822
  this._show_layout_core(unit_id);
3816
3823
  }
3817
3824
  }
@@ -4040,25 +4047,24 @@ class Editor_ extends element_1.Element {
4040
4047
  }
4041
4048
  };
4042
4049
  this._search_adding_unit = false;
4043
- this._sim_add_sub_component = (unit_id, sub_component, sub_sub_component_map = {}, at, add_to_parent = true, element = undefined) => {
4050
+ this._sim_add_sub_component = (unit_id, sub_component, sub_sub_component_map = {}, add_to_parent = true, element = undefined) => {
4044
4051
  // console.log(
4045
4052
  // 'Graph',
4046
4053
  // '_sim_add_unit_component',
4047
4054
  // unit_id,
4048
4055
  // sub_component_map,
4049
- // at,
4050
4056
  // add_to_parent
4051
4057
  // )
4052
4058
  this._mem_add_unit_component(unit_id, sub_component, sub_sub_component_map, element);
4053
4059
  if (add_to_parent) {
4054
- this._sim_add_sub_component_to_parent(unit_id, at);
4060
+ this._sim_add_sub_component_to_parent(unit_id);
4055
4061
  }
4056
4062
  };
4057
- this._sim_add_sub_component_to_parent = (unit_id, at) => {
4063
+ this._sim_add_sub_component_to_parent = (unit_id) => {
4058
4064
  // console.log('Graph', '_sim_add_sub_component_to_parent', unit_id)
4059
4065
  this._mem_add_unit_component_parent(unit_id);
4060
4066
  if (this._in_component_control) {
4061
- this._place_sub_component(unit_id, at);
4067
+ this._place_sub_component(unit_id);
4062
4068
  }
4063
4069
  };
4064
4070
  this._set_sub_component_index = (sub_component_id, i) => {
@@ -4115,8 +4121,8 @@ class Editor_ extends element_1.Element {
4115
4121
  const parent = this._get_sub_component(parent_id);
4116
4122
  if (!parent.$parentRoot.includes(sub_component)) {
4117
4123
  parent.pushParentRoot(sub_component, 'default');
4124
+ this._mem_layout_push_parent_root(parent_id, unit_id, 'default');
4118
4125
  }
4119
- this._mem_layout_push_parent_root(parent_id, unit_id, 'default');
4120
4126
  }
4121
4127
  else {
4122
4128
  if (!this._component.$root.includes(sub_component)) {
@@ -4323,7 +4329,7 @@ class Editor_ extends element_1.Element {
4323
4329
  newSpec(new_spec, new_spec_id);
4324
4330
  const unit_data = this._get_unit_data(unit_id);
4325
4331
  const { valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index, } = this._generate_identity_matches(unit_id);
4326
- this._state_swap_unit(unit_id, new_unit_id, new_spec, valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index);
4332
+ this._state_swap_unit(unit_id, new_unit_id, new_spec, valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index, null, null, null, null, null);
4327
4333
  (0, IOOf_1.forIOObjKV)(unit_data, (type, pin_id, pin_data) => {
4328
4334
  const pin_node_id = (0, id_1.getPinNodeId)(new_unit_id, type, pin_id);
4329
4335
  this._graph_debug_set_pin_data_tree(pin_node_id, pin_data);
@@ -5322,11 +5328,20 @@ class Editor_ extends element_1.Element {
5322
5328
  data: {},
5323
5329
  ref: {},
5324
5330
  },
5325
- }, next_sub_component_index) => {
5326
- // console.log('Graph', '_sim_swap_unit', {
5327
- // merged_pin_ids,
5331
+ }, next_sub_component_parent_id, next_sub_component_parent_slot_name, next_sub_component_parent_index, next_sub_component_children, next_sub_component_children_slot_map) => {
5332
+ // console.log('Graph', '_state_swap_unit', {
5333
+ // unit_id,
5334
+ // new_unit_id,
5335
+ // new_unit_spec,
5328
5336
  // valid_pin_matches,
5337
+ // merged_pin_ids,
5329
5338
  // exposed_pin_ids,
5339
+ // exposed_pin_index,
5340
+ // next_sub_component_parent_id,
5341
+ // next_sub_component_parent_index,
5342
+ // next_sub_component_parent_slot_name,
5343
+ // next_sub_component_children,
5344
+ // next_sub_component_children_slot_map,
5330
5345
  // })
5331
5346
  var _a;
5332
5347
  const { specs } = this.$props;
@@ -5349,11 +5364,6 @@ class Editor_ extends element_1.Element {
5349
5364
  const unit = this._get_unit(unit_id);
5350
5365
  const unit_spec = this._get_unit_spec(unit_id);
5351
5366
  const { inputs: unit_inputs = {}, outputs: unit_outputs = {} } = unit_spec;
5352
- const is_component = this._is_unit_component(unit_id);
5353
- let component_index;
5354
- if (is_component) {
5355
- component_index = this._get_sub_component_index(unit_id);
5356
- }
5357
5367
  const pin_bag = {
5358
5368
  input: (0, clone_1.clone)(unit_inputs),
5359
5369
  output: (0, clone_1.clone)(unit_outputs),
@@ -5523,6 +5533,14 @@ class Editor_ extends element_1.Element {
5523
5533
  const is_unit_component = this._is_unit_component(unit_id);
5524
5534
  const unit_parent_id = (is_unit_component && this._spec_get_sub_component_parent_id(unit_id)) ||
5525
5535
  null;
5536
+ const unit_parent_index = (is_unit_component && this._spec_get_sub_component_index(unit_id)) || null;
5537
+ const unit_parent_slot_name = (is_unit_component && this._spec_get_sub_component_slot_name(unit_id)) ||
5538
+ null;
5539
+ const unit_children = (is_unit_component && this._spec_get_sub_component_children(unit_id)) ||
5540
+ null;
5541
+ const unit_children_slot_map = (is_unit_component &&
5542
+ this._spec_get_sub_component_children_slot(unit_id)) ||
5543
+ null;
5526
5544
  const is_swap_unit_component = (0, util_1.isComponentSpec)(new_unit_spec);
5527
5545
  if (is_unit_component && this._search_unit_id !== unit_id) {
5528
5546
  this._disconnect_sub_component(unit_id);
@@ -5547,18 +5565,25 @@ class Editor_ extends element_1.Element {
5547
5565
  if (is_unit_component && is_swap_unit_component) {
5548
5566
  (0, object_1.deepSet)(graph_unit_spec, ['metadata', 'component'], (0, object_1.deepGetOrDefault)(unit, ['metadata', 'component'], undefined));
5549
5567
  }
5550
- let next_sub_component_parent_id = (is_swap_unit_component && unit_parent_id) || null;
5551
- let next_sub_component_parent_index = (_a = (is_unit_component &&
5552
- is_swap_unit_component &&
5553
- this._get_sub_component_index(unit_id))) !== null && _a !== void 0 ? _a : null;
5568
+ next_sub_component_parent_id =
5569
+ next_sub_component_parent_id !== null && next_sub_component_parent_id !== void 0 ? next_sub_component_parent_id : ((is_swap_unit_component && unit_parent_id) || null);
5570
+ next_sub_component_parent_index =
5571
+ (_a = next_sub_component_parent_index !== null && next_sub_component_parent_index !== void 0 ? next_sub_component_parent_index : (is_unit_component && is_swap_unit_component && unit_parent_index)) !== null && _a !== void 0 ? _a : null;
5572
+ next_sub_component_parent_slot_name =
5573
+ next_sub_component_parent_slot_name !== null && next_sub_component_parent_slot_name !== void 0 ? next_sub_component_parent_slot_name : ((is_swap_unit_component && unit_parent_slot_name) || null);
5574
+ next_sub_component_children =
5575
+ next_sub_component_children !== null && next_sub_component_children !== void 0 ? next_sub_component_children : ((is_swap_unit_component && unit_children) || []);
5576
+ next_sub_component_children_slot_map =
5577
+ next_sub_component_children_slot_map !== null && next_sub_component_children_slot_map !== void 0 ? next_sub_component_children_slot_map : ((is_swap_unit_component && unit_children_slot_map) || {});
5554
5578
  const bundle = (0, bundle_1.unitBundleSpec)(graph_unit_spec, specs);
5555
5579
  const should_unregister = unit_id !== this._search_unit_id && unit_spec.id !== bundle.unit.id;
5556
5580
  this._state_remove_unit(unit_id, should_unregister);
5557
- this._state_add_unit(new_unit_id, bundle, next_sub_component_parent_id, next_sub_component_parent_index, position, new_unit_pin_position, layout_position, {}, should_unregister);
5558
- if (this._is_unit_component(new_unit_id) &&
5559
- this._search_unit_id !== unit_id) {
5560
- this._sim_add_sub_component(new_unit_id, undefined, {}, next_sub_component_index, true);
5561
- this._refresh_layout_node_target_position(unit_parent_id);
5581
+ this._state_add_unit(new_unit_id, bundle, next_sub_component_parent_id, next_sub_component_parent_slot_name, next_sub_component_parent_index, position, new_unit_pin_position, layout_position, {}, should_unregister);
5582
+ if (this._is_unit_component(new_unit_id)) {
5583
+ if (this._search_unit_id !== unit_id) {
5584
+ this._sim_add_sub_component(new_unit_id, undefined, {}, true);
5585
+ this._refresh_layout_node_target_position(unit_parent_id);
5586
+ }
5562
5587
  }
5563
5588
  const replace_exposed = (kind, tag) => {
5564
5589
  var _a;
@@ -9919,20 +9944,20 @@ class Editor_ extends element_1.Element {
9919
9944
  this._set_layout_search_offset_y(current_layer_id, offset_y);
9920
9945
  }
9921
9946
  };
9922
- this._state_swap_search_unit = (id, next_unit_id) => {
9923
- if (this._search_start_spec_id !== id) {
9947
+ this._state_swap_search_unit = (unit_id, next_unit_id) => {
9948
+ if (this._search_start_spec_id !== unit_id) {
9924
9949
  this._search_unit_spec_id_changed = true;
9925
9950
  }
9926
9951
  if (this._mode === 'add' ||
9927
9952
  this._mode === 'multiselect' ||
9928
9953
  this._mode === 'remove') {
9929
- this._state_swap_add_search_unit(id);
9954
+ this._state_swap_add_search_unit(unit_id);
9930
9955
  }
9931
9956
  else if (this._mode === 'change') {
9932
- this._state_swap_change_search_unit(id, next_unit_id);
9957
+ this._state_swap_change_search_unit(unit_id, next_unit_id);
9933
9958
  }
9934
9959
  else if (this._mode === 'data') {
9935
- this._state_swap_data_search_unit(id);
9960
+ this._state_swap_data_search_unit(unit_id);
9936
9961
  }
9937
9962
  };
9938
9963
  this._state_swap_add_search_unit = (id) => {
@@ -10010,7 +10035,7 @@ class Editor_ extends element_1.Element {
10010
10035
  },
10011
10036
  };
10012
10037
  const spec = getSpec(spec_id);
10013
- const { next_swap_merges, next_merged_pin_ids, next_ref_merge_id, next_ref_merge, next_merged_pin_index, next_exposed_pin_index, } = this._state_swap_unit(search_unit_id, new_unit_id, spec, valid_pin_match, this._search_unit_merged_pin_ids, this._search_unit_merged_pin_index, this._search_unit_exposed_pin_ids, this._search_unit_exposed_pin_index, this._search_start_component_index);
10038
+ const { next_swap_merges, next_merged_pin_ids, next_ref_merge_id, next_ref_merge, next_merged_pin_index, next_exposed_pin_index, } = this._state_swap_unit(search_unit_id, new_unit_id, spec, valid_pin_match, this._search_unit_merged_pin_ids, this._search_unit_merged_pin_index, this._search_unit_exposed_pin_ids, this._search_unit_exposed_pin_index, this._search_start_unit_parent_id, this._search_start_unit_parent_slot_name, this._search_start_unit_parent_index, this._search_start_unit_children, this._search_start_unit_children_slot_map);
10014
10039
  this._search_unit_id = new_unit_id;
10015
10040
  this._search_unit_merges = next_swap_merges;
10016
10041
  this._search_unit_merged_pin_ids = next_merged_pin_ids;
@@ -10170,8 +10195,13 @@ class Editor_ extends element_1.Element {
10170
10195
  let parent_id = null;
10171
10196
  const is_component = this._is_unit_component(unit_id);
10172
10197
  if (is_component) {
10173
- parent_id = this._get_sub_component_target_parent_id();
10174
- this._spec_append_component(parent_id, unit_id);
10198
+ if (this._mode === 'change') {
10199
+ parent_id = this._search_start_unit_parent_id;
10200
+ }
10201
+ else {
10202
+ parent_id = this._get_sub_component_target_parent_id();
10203
+ }
10204
+ this._spec_append_component(parent_id, unit_id, 'default');
10175
10205
  }
10176
10206
  this._sim_add_unit(unit_id, unit_spec, position, {}, pin_position, parent_id, layout_position);
10177
10207
  this._show_core_description(unit_id);
@@ -10500,9 +10530,12 @@ class Editor_ extends element_1.Element {
10500
10530
  const search_start_unit_merges = this._search_start_unit_merges;
10501
10531
  const search_start_unit_plugs = this._search_start_unit_plugs;
10502
10532
  const search_start_unit_parent_id = this._search_start_unit_parent_id;
10503
- const search_start_unit_index = this._search_start_unit_index;
10533
+ const search_start_unit_parent_slot_name = this._search_start_unit_parent_slot_name;
10534
+ const search_start_unit_parent_index = this._search_start_unit_parent_index;
10535
+ const search_start_unit_children = this._search_start_unit_children;
10536
+ const search_start_unit_children_slot_map = this._search_start_unit_children_slot_map;
10504
10537
  const search_unit_id = this._search_unit_id;
10505
- // const search_spec_id = this._search_unit_spec_id
10538
+ const actions = [];
10506
10539
  if (search_unit_id) {
10507
10540
  this._refresh_unit_layer(search_unit_id);
10508
10541
  if (this._mode === 'add' ||
@@ -10523,30 +10556,18 @@ class Editor_ extends element_1.Element {
10523
10556
  if (this._tree_layout) {
10524
10557
  parent_id = this._get_current_layout_layer_id();
10525
10558
  }
10526
- const actions = [
10527
- (0, G_1.makeAddUnitAction)(search_unit_id, search_unit_bundle, null, null, parent_id, null, null, null, null, null, null),
10528
- ];
10529
- const bulk_action = (0, G_1.makeBulkEditAction)(actions);
10530
- this._dispatch_action(bulk_action);
10531
- this._pod.$bulkEdit({ actions, fork, bubble });
10532
- this._download_pod_data();
10559
+ actions.push((0, G_1.makeAddUnitAction)(search_unit_id, search_unit_bundle, null, null, parent_id, null, null, null, null, null, null));
10533
10560
  should_add_component = true;
10534
10561
  }
10535
10562
  else if (this._mode === 'change') {
10536
10563
  if (this._search_start_unit_id) {
10537
- const is_component = (0, util_1.isComponentId)(specs, search_start_spec_id);
10538
10564
  const search_start_unit_bundle = (0, bundle_1.unitBundleSpec)(this._search_start_graph_unit_spec, specs);
10539
10565
  const search_unit_merges = (0, clone_1.clone)(this._get_unit_merges(search_unit_id));
10540
10566
  const search_unit_plugs = (0, clone_1.clone)(this._get_unit_plugs(search_unit_id));
10541
- this._dispatch_swap_unit_action(search_start_unit_id, search_start_unit_bundle, search_start_unit_merges, search_start_unit_plugs, search_start_unit_parent_id, search_start_unit_index, null, null, search_unit_id, search_unit_bundle, search_unit_merges, search_unit_plugs, search_start_unit_parent_id, search_start_unit_index, null, null);
10542
- if (did_spec_id_change) {
10543
- this._pod_remove_unit(search_start_unit_id, is_component);
10544
- this._pod_add_unit(search_unit_id, search_unit_bundle);
10545
- }
10567
+ actions.push(this._make_swap_unit_action(search_start_unit_id, search_start_unit_bundle, search_start_unit_merges, search_start_unit_plugs, search_start_unit_parent_id, search_start_unit_parent_slot_name, search_start_unit_parent_index, search_start_unit_children, search_start_unit_children_slot_map, search_unit_id, search_unit_bundle, search_unit_merges, search_unit_plugs, search_start_unit_parent_id, search_start_unit_parent_slot_name, search_start_unit_parent_index, search_start_unit_children, search_start_unit_children_slot_map));
10546
10568
  }
10547
10569
  else {
10548
- this._dispatch_add_unit_action(search_unit_id, unit);
10549
- this._pod_add_unit(search_unit_id, search_unit_bundle);
10570
+ actions.push(this._make_add_unit_action(search_unit_id, unit));
10550
10571
  }
10551
10572
  this._setup_pod(this._pod);
10552
10573
  should_add_component = this._search_unit_spec_id_changed;
@@ -10579,10 +10600,10 @@ class Editor_ extends element_1.Element {
10579
10600
  type = 'output';
10580
10601
  pin_id = (0, object_1.getObjSingleKey)(merge_unit.output || {});
10581
10602
  }
10582
- this.__pod_add_pin_to_merge(merge_id, search_unit_id, type, pin_id);
10603
+ actions.push((0, G_1.makeAddPinToMergeAction)(merge_id, search_unit_id, type, pin_id));
10583
10604
  }
10584
10605
  else {
10585
- this._pod_add_merge(merge_id, merge);
10606
+ actions.push((0, G_1.makeAddMergeAction)(merge_id, merge));
10586
10607
  }
10587
10608
  if (!this._is_merge_ref(merge_node_id)) {
10588
10609
  this._refresh_merge_pin_pin_color(merge_node_id, 'input');
@@ -10590,13 +10611,18 @@ class Editor_ extends element_1.Element {
10590
10611
  }
10591
10612
  }
10592
10613
  if (this._search_unit_ref_merge_id) {
10593
- this._pod_add_merge(this._search_unit_ref_merge_id, this._search_unit_ref_merge);
10614
+ actions.push((0, G_1.makeAddMergeAction)(this._search_unit_ref_merge_id, this._search_unit_ref_merge));
10594
10615
  }
10595
10616
  }
10617
+ const bulk_action = (0, G_1.makeBulkEditAction)(actions);
10618
+ this._dispatch_action(bulk_action);
10619
+ this._pod.$bulkEdit({ actions, fork, bubble });
10620
+ this._download_pod_data();
10596
10621
  if (should_add_component) {
10597
10622
  if (this._is_unit_component(search_unit_id)) {
10598
10623
  this._sim_add_sub_component(search_unit_id);
10599
10624
  this._connect_sub_component(search_unit_id);
10625
+ this._search_change_return_start_children(search_unit_id, search_start_unit_children, search_start_unit_children_slot_map);
10600
10626
  }
10601
10627
  }
10602
10628
  this._refresh_unit_compatibility(search_unit_id);
@@ -10623,6 +10649,24 @@ class Editor_ extends element_1.Element {
10623
10649
  this._refresh_datum_color(datum_node_id);
10624
10650
  }
10625
10651
  };
10652
+ this._search_change_return_start_children = (search_unit_id, search_start_unit_children, search_start_unit_children_slot_map) => {
10653
+ if (search_start_unit_children) {
10654
+ const parent_map = this._get_sub_components_parent_map(search_start_unit_children);
10655
+ const slot_map = this._get_sub_components_slot_map(search_start_unit_children);
10656
+ this._on_move_sub_component_root({
10657
+ prevParentIdMap: parent_map,
10658
+ prevSlotMap: slot_map,
10659
+ parentId: search_unit_id,
10660
+ children: search_start_unit_children,
10661
+ slotMap: search_start_unit_children_slot_map,
10662
+ index: 0,
10663
+ }, true, () => { });
10664
+ if (this._tree_layout) {
10665
+ this._refresh_current_layout_node_target_position();
10666
+ this._animate_all_current_layout_layer_node();
10667
+ }
10668
+ }
10669
+ };
10626
10670
  this._shift_search = () => {
10627
10671
  // console.log('Graph', '_shift_search')
10628
10672
  if (this._is_shift_pressed() || this._mode === 'multiselect') {
@@ -10750,7 +10794,7 @@ class Editor_ extends element_1.Element {
10750
10794
  this._search_start_unit_plugs = null;
10751
10795
  this._search_start_unit_data = null;
10752
10796
  this._search_start_graph_unit_spec = null;
10753
- this._search_start_component_index = null;
10797
+ this._search_start_unit_parent_index = null;
10754
10798
  this._search_unit_spec_id_changed = false;
10755
10799
  this._stop_zoom_target_animation();
10756
10800
  };
@@ -10800,6 +10844,8 @@ class Editor_ extends element_1.Element {
10800
10844
  const search_unit_start_data = this._search_start_unit_data;
10801
10845
  const search_unit_datum_node_id = this._search_unit_datum_node_id;
10802
10846
  const search_unit_spec_id_changed = this._search_unit_spec_id_changed;
10847
+ const search_start_unit_children = this._search_start_unit_children;
10848
+ const search_start_unit_children_slot_map = this._search_start_unit_children_slot_map;
10803
10849
  if (!search_adding_unit) {
10804
10850
  if (search_unit_id) {
10805
10851
  if (this._mode === 'add' ||
@@ -10816,9 +10862,10 @@ class Editor_ extends element_1.Element {
10816
10862
  this._connect_sub_component(search_start_unit_id);
10817
10863
  }
10818
10864
  (0, IOOf_1.forIOObjKV)(search_unit_start_data, (type, pin_id, data) => {
10819
- const pin_node_id = (0, id_1.getPinNodeId)(search_unit_id, type, pin_id);
10865
+ const pin_node_id = (0, id_1.getPinNodeId)(search_start_unit_id, type, pin_id);
10820
10866
  this._graph_debug_set_pin_data_tree(pin_node_id, data);
10821
10867
  });
10868
+ this._search_change_return_start_children(search_start_unit_id, search_start_unit_children, search_start_unit_children_slot_map);
10822
10869
  }
10823
10870
  }
10824
10871
  }
@@ -11350,16 +11397,22 @@ class Editor_ extends element_1.Element {
11350
11397
  const ordered_selected_sub_component_ids = this._order_sub_component_ids(selected_sub_component_ids);
11351
11398
  this._enter_fullwindow(animate, ordered_selected_sub_component_ids);
11352
11399
  };
11353
- this._get_sub_component_index = (sub_component_id) => {
11354
- return (0, component_2.getSubComponentParentIndex)(this._spec, sub_component_id);
11355
- };
11356
- this._get_sub_component_root_index = (sub_component_id) => {
11400
+ this._spec_get_sub_component_root_index = (sub_component_id) => {
11357
11401
  return (0, component_2.getSubComponentRootIndex)(this._spec, sub_component_id);
11358
11402
  };
11359
11403
  this._spec_get_sub_component_parent_root_index = (sub_component_id) => {
11360
11404
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
11361
11405
  return (0, component_2.getSubComponentParentRootIndex)(this._spec, parent_id, sub_component_id);
11362
11406
  };
11407
+ this._spec_get_sub_component_index = (sub_component_id) => {
11408
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
11409
+ if (parent_id) {
11410
+ return this._spec_get_sub_component_parent_root_index(sub_component_id);
11411
+ }
11412
+ else {
11413
+ return this._spec_get_sub_component_root_index(sub_component_id);
11414
+ }
11415
+ };
11363
11416
  this._get_sub_component_tree_index = (sub_component_id) => {
11364
11417
  const parent_sub_component_id = this._spec_get_sub_component_parent_id(sub_component_id);
11365
11418
  if (parent_sub_component_id) {
@@ -11370,7 +11423,7 @@ class Editor_ extends element_1.Element {
11370
11423
  return index;
11371
11424
  }
11372
11425
  else {
11373
- return this._get_sub_component_root_index(sub_component_id);
11426
+ return this._spec_get_sub_component_root_index(sub_component_id);
11374
11427
  }
11375
11428
  };
11376
11429
  this._get_sub_component_frame_context = (sub_component_id) => {
@@ -11518,13 +11571,29 @@ class Editor_ extends element_1.Element {
11518
11571
  }
11519
11572
  }
11520
11573
  };
11521
- this._place_sub_component = (sub_component_id, at) => {
11574
+ this._place_sub_component = (sub_component_id) => {
11522
11575
  // console.log('Graph', '_place_sub_component', sub_component_id)
11523
11576
  if (this._is_all_fullwindow) {
11524
11577
  this._fullwindow_component_set.add(sub_component_id);
11525
11578
  (0, array_1.push)(this._fullwindow_component_ids, sub_component_id);
11579
+ const at = this._spec_get_sub_component_parent_root_index(sub_component_id);
11526
11580
  this._couple_sub_component(sub_component_id, at);
11527
11581
  }
11582
+ if (this._tree_layout) {
11583
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
11584
+ if (!parent_id || this._is_layout_parent_visible(sub_component_id)) {
11585
+ this._enter_sub_component_frame(sub_component_id);
11586
+ }
11587
+ else {
11588
+ if (parent_id) {
11589
+ const at = this._spec_get_sub_component_parent_root_index(sub_component_id);
11590
+ this._couple_sub_component(sub_component_id, at);
11591
+ }
11592
+ else {
11593
+ this._enter_sub_component_frame(sub_component_id);
11594
+ }
11595
+ }
11596
+ }
11528
11597
  else {
11529
11598
  this._enter_sub_component_frame(sub_component_id);
11530
11599
  }
@@ -12417,13 +12486,7 @@ class Editor_ extends element_1.Element {
12417
12486
  this._enter_tree_layout = () => {
12418
12487
  // console.log('Graph', '_enter_tree_layout')
12419
12488
  const { animate } = this._config();
12420
- const animating_sub_component_set = new Set();
12421
- for (const sub_component_id in this._component.$subComponent) {
12422
- const animating_sub_component = this._is_sub_component_animating(sub_component_id);
12423
- if (animating_sub_component) {
12424
- animating_sub_component_set.add(sub_component_id);
12425
- }
12426
- }
12489
+ const animating_sub_component_set = this._build_animating_sub_component_set();
12427
12490
  this._tree_layout = true;
12428
12491
  this._pointer_up_all_pressed_pointer_id();
12429
12492
  this._cancel_all_layout_parent_children_animation();
@@ -12455,22 +12518,19 @@ class Editor_ extends element_1.Element {
12455
12518
  const visible = this._is_layout_component_layer_visible(sub_component_id);
12456
12519
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
12457
12520
  const children = this._spec_get_sub_component_children(sub_component_id);
12458
- const parent_visible = !parent_id || this._layout_path.includes(parent_id);
12459
12521
  if (!visible && children.length > 0) {
12460
- if (!this._animating_sub_component_base_id.has(sub_component_id)) {
12522
+ if (!this._is_sub_component_animating(sub_component_id)) {
12461
12523
  for (const child_id of children) {
12462
12524
  this._measure_sub_component_base(child_id);
12463
12525
  }
12464
12526
  }
12465
12527
  }
12466
- if (parent_visible) {
12467
- this._measure_sub_component_base(sub_component_id);
12468
- }
12469
12528
  if (!animating_sub_component_set.has(sub_component_id)) {
12529
+ this._measure_sub_component_base(sub_component_id);
12470
12530
  this._leave_sub_component_frame(sub_component_id);
12471
- const sub_component_base = this._get_sub_component_base(sub_component_id);
12531
+ const sub_component_base = this._get_sub_component_root_base(sub_component_id);
12472
12532
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
12473
- const parent_layout_layer = this._get_layout_layer(parent_id);
12533
+ const parent_layout_layer = this._ensure_layout_layer(parent_id);
12474
12534
  this._remove_sub_component_root_base(sub_component_id);
12475
12535
  this._plug_sub_component_base(sub_component_id, sub_component_base, [], parent_layout_layer.foreground);
12476
12536
  }
@@ -12503,7 +12563,8 @@ class Editor_ extends element_1.Element {
12503
12563
  // console.log('Graph', '_plug_leaf_frame', leaf_id, leaf_node)
12504
12564
  var _a, _b, _c;
12505
12565
  if (this._leaf_frame_active[leaf_id]) {
12506
- return;
12566
+ this._unplug_leaf_frame(leaf_id);
12567
+ this._leaf_frame_node[leaf_id] = leaf_node;
12507
12568
  }
12508
12569
  const { api: { text: { measureText }, }, } = this.$system;
12509
12570
  const { x, y, width, height, sx, sy, fontSize, opacity, color } = leaf_node;
@@ -12588,7 +12649,7 @@ class Editor_ extends element_1.Element {
12588
12649
  }
12589
12650
  else if (this._tree_layout) {
12590
12651
  parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
12591
- slot_name = this._get_sub_component_slot_name(sub_component_id);
12652
+ slot_name = this._spec_get_sub_component_slot_name(sub_component_id);
12592
12653
  parent = this._get_sub_component(parent_id);
12593
12654
  }
12594
12655
  else if (this._is_fullwindow) {
@@ -12787,15 +12848,11 @@ class Editor_ extends element_1.Element {
12787
12848
  }
12788
12849
  return (0, callAll_1.callAll)(all_unlisten);
12789
12850
  };
12790
- this._plug_animate_sub_component_base = (sub_component_id, leaf_base, leaf_traits, leaf_layer, n1, callback) => {
12791
- return this._animate_sub_component_base(sub_component_id, leaf_base, leaf_traits, n1, callback);
12792
- };
12793
12851
  this._animate_sub_component_base = (sub_component_id, leaf_base, leaf_traits, n1, callback) => {
12794
12852
  // console.log('Graph', '_animate_sub_component_base', sub_component_id)
12795
12853
  const base_length = leaf_base.length;
12796
12854
  let i = 0;
12797
12855
  const all_unlisten = [];
12798
- this._animating_sub_component_base_id.add(sub_component_id);
12799
12856
  const leaf_ended = new Set();
12800
12857
  for (const leaf of leaf_base) {
12801
12858
  const [leaf_path, leaf_comp] = leaf;
@@ -12822,10 +12879,9 @@ class Editor_ extends element_1.Element {
12822
12879
  cancelAnimationFrame(frame);
12823
12880
  });
12824
12881
  }
12825
- all_unlisten.push(() => {
12826
- this._animating_sub_component_base_id.delete(sub_component_id);
12827
- });
12828
- return (0, callAll_1.callAll)(all_unlisten);
12882
+ const stop = (0, callAll_1.callAll)(all_unlisten);
12883
+ this._abort_sub_component_base_animation[sub_component_id] = stop;
12884
+ return stop;
12829
12885
  };
12830
12886
  this._cancel_enter_animation = () => {
12831
12887
  // console.log('Graph', '_cancel_enter_animation')
@@ -12975,6 +13031,15 @@ class Editor_ extends element_1.Element {
12975
13031
  }
12976
13032
  Promise.all(promises).then(callback);
12977
13033
  };
13034
+ this._is_layout_parent_visible = (sub_component_id) => {
13035
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
13036
+ if (!parent_id) {
13037
+ return true;
13038
+ }
13039
+ const parent_fullwindow = this._is_sub_component_fullwindow(parent_id);
13040
+ const parent_visible = !parent_fullwindow && this._layout_path.includes(parent_id);
13041
+ return parent_visible;
13042
+ };
12978
13043
  this._animate_enter_tree_layout = () => {
12979
13044
  // console.log('Graph', '_animate_enter_tree_layout')
12980
13045
  var _a, _b;
@@ -12988,6 +13053,7 @@ class Editor_ extends element_1.Element {
12988
13053
  this._leaf_layer_offset_y = 0;
12989
13054
  }
12990
13055
  this._cancel_fullwindow_animation();
13056
+ this._cancel_all_layout_parent_children_animation();
12991
13057
  this._cancel_all_sub_component_base_animation();
12992
13058
  this._cancel_enter_animation();
12993
13059
  let all_layout_opacity_animation_finished = false;
@@ -13007,6 +13073,7 @@ class Editor_ extends element_1.Element {
13007
13073
  const finish = () => {
13008
13074
  (0, callAll_1.callAll)(all_stop)();
13009
13075
  for (const sub_component_id of ordered_sub_component_ids) {
13076
+ this._cancel_layout_child_transfer_animation(sub_component_id);
13010
13077
  this._cancel_sub_component_base_animation(sub_component_id);
13011
13078
  this._unplug_sub_component_root_base_frame(sub_component_id);
13012
13079
  this._append_sub_component_root_base(sub_component_id);
@@ -13052,7 +13119,7 @@ class Editor_ extends element_1.Element {
13052
13119
  sub_component_count++;
13053
13120
  const all_slot_children = {};
13054
13121
  for (const child_id of children) {
13055
- const slot_name = this._get_sub_component_slot_name(child_id);
13122
+ const slot_name = this._spec_get_sub_component_slot_name(child_id);
13056
13123
  all_slot_children[slot_name] = all_slot_children[slot_name] || [];
13057
13124
  all_slot_children[slot_name].push(child_id);
13058
13125
  }
@@ -13077,8 +13144,6 @@ class Editor_ extends element_1.Element {
13077
13144
  const sub_component_frame = this._get_sub_component_frame(sub_component_id);
13078
13145
  const sub_component_frame_trait = (0, extractTrait_1.extractTrait)(sub_component_frame, measureText);
13079
13146
  const sub_component_base = sub_component.getRootBase();
13080
- const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
13081
- const parent_layout_layer = this._get_layout_layer(parent_id);
13082
13147
  let all_base = {};
13083
13148
  let all_trait;
13084
13149
  let all_leaf_count = {};
@@ -13157,7 +13222,6 @@ class Editor_ extends element_1.Element {
13157
13222
  maybe_finish();
13158
13223
  });
13159
13224
  all_stop.push(stop);
13160
- this._abort_sub_component_base_animation[sub_component_id] = stop;
13161
13225
  }
13162
13226
  }
13163
13227
  }
@@ -13176,7 +13240,7 @@ class Editor_ extends element_1.Element {
13176
13240
  if (!dont_plug_base) {
13177
13241
  this._plug_sub_component_base(sub_component_id, leaf_base, leaf_traits, leaf_layer);
13178
13242
  }
13179
- const stop = this._plug_animate_sub_component_base(sub_component_id, leaf_base, leaf_traits, leaf_layer, (leaf_id) => {
13243
+ const stop = this._animate_sub_component_base(sub_component_id, leaf_base, leaf_traits, (leaf_id) => {
13180
13244
  const { $width, $height } = this.$context;
13181
13245
  const layout_node = this._layout_node[sub_component_id];
13182
13246
  const { x, y, width, height, color } = layout_node;
@@ -13219,7 +13283,6 @@ class Editor_ extends element_1.Element {
13219
13283
  : sub_component_id;
13220
13284
  delete this._leaf_target_trait[leaf_id];
13221
13285
  }
13222
- delete this._abort_sub_component_parent_animation[sub_component_id];
13223
13286
  });
13224
13287
  this._abort_sub_component_parent_animation[sub_component_id] = stop;
13225
13288
  return stop;
@@ -13269,22 +13332,28 @@ class Editor_ extends element_1.Element {
13269
13332
  (0, callAll_1.callAll)(all_stop)();
13270
13333
  finished = true;
13271
13334
  for (const sub_component_id of visible_root) {
13335
+ this._cancel_layout_parent_children_all_slot_animation(sub_component_id);
13272
13336
  this._cancel_sub_component_base_animation(sub_component_id);
13273
- delete this._abort_sub_component_base_animation[sub_component_id];
13274
13337
  this._unplug_sub_component_root_base_frame(sub_component_id);
13275
13338
  this._append_sub_component_root_base(sub_component_id);
13276
13339
  this._enter_sub_component_frame(sub_component_id);
13277
13340
  }
13278
13341
  for (const sub_component_id of visible_parent_root) {
13342
+ this._cancel_layout_parent_children_all_slot_animation(sub_component_id);
13343
+ this._cancel_sub_component_base_animation(sub_component_id);
13279
13344
  const all_slot_children = visible_parent_slot_children[sub_component_id];
13280
13345
  for (const slot_name in all_slot_children) {
13281
13346
  this._cancel_layout_parent_children_animation(sub_component_id, slot_name);
13282
13347
  this._end_layout_sub_component_transfer_children_animation(sub_component_id, slot_name);
13348
+ const children = all_slot_children[slot_name];
13349
+ for (const child_id of children) {
13350
+ this._cancel_layout_child_transfer_animation(child_id);
13351
+ }
13283
13352
  }
13284
- delete this._abort_sub_component_base_animation[sub_component_id];
13285
13353
  const children = this._spec_get_sub_component_children(sub_component_id);
13286
13354
  for (const child_id of children) {
13287
- delete this._abort_sub_component_base_animation[child_id];
13355
+ this._cancel_layout_child_transfer_animation(child_id);
13356
+ this._cancel_sub_component_base_animation(child_id);
13288
13357
  this._enter_sub_component_frame(child_id);
13289
13358
  this._append_sub_component_root_base(child_id);
13290
13359
  }
@@ -13297,14 +13366,12 @@ class Editor_ extends element_1.Element {
13297
13366
  }
13298
13367
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
13299
13368
  const children = this._spec_get_sub_component_children(sub_component_id);
13300
- const { foreground: leaf_layer } = this._get_sub_component_layout_layer(sub_component_id);
13301
- const leaf_traits = [];
13302
13369
  if (!this._layout_path.includes(sub_component_id) &&
13303
13370
  children.length > 0) {
13304
13371
  visible_parent_root_slot_finished[sub_component_id] = 0;
13305
13372
  const all_slot_children = {};
13306
13373
  for (const child_id of children) {
13307
- const slot_name = this._get_sub_component_slot_name(child_id);
13374
+ const slot_name = this._spec_get_sub_component_slot_name(child_id);
13308
13375
  all_slot_children[slot_name] = all_slot_children[slot_name] || [];
13309
13376
  all_slot_children[slot_name].push(child_id);
13310
13377
  }
@@ -13346,8 +13413,7 @@ class Editor_ extends element_1.Element {
13346
13413
  const leaf_node = this._leaf_frame_node[leaf_id];
13347
13414
  leaf_node.opacity *= layer_opacity;
13348
13415
  }
13349
- this._plug_sub_component_base(sub_component_id, leaf_base, leaf_traits, leaf_layer);
13350
- const stop = this._plug_animate_sub_component_base(sub_component_id, leaf_base, leaf_traits, leaf_layer, (leaf_id) => {
13416
+ const stop = this._animate_sub_component_base(sub_component_id, leaf_base, [], (leaf_id) => {
13351
13417
  const { x, y } = this._get_node_screen_position(sub_component_id);
13352
13418
  if (i === 0) {
13353
13419
  const trait = this._get_graph_sub_component_node_trait(sub_component_id);
@@ -13383,7 +13449,6 @@ class Editor_ extends element_1.Element {
13383
13449
  return true;
13384
13450
  });
13385
13451
  all_stop.push(stop);
13386
- this._abort_sub_component_base_animation[sub_component_id] = stop;
13387
13452
  }
13388
13453
  }
13389
13454
  };
@@ -13531,16 +13596,28 @@ class Editor_ extends element_1.Element {
13531
13596
  return { x, y };
13532
13597
  };
13533
13598
  this._is_sub_component_animating = (sub_component_id) => {
13534
- let animating_sub_component = !!(this._animating_sub_component_base_id.has(sub_component_id) ||
13535
- this._abort_sub_component_enter_base_animation[sub_component_id] ||
13536
- this._abort_sub_component_base_animation[sub_component_id]);
13599
+ if (this._abort_sub_component_enter_base_animation[sub_component_id]) {
13600
+ return true;
13601
+ }
13602
+ if (this._abort_sub_component_base_animation[sub_component_id]) {
13603
+ return true;
13604
+ }
13605
+ if (this._animating_sub_component_transfer.has(sub_component_id)) {
13606
+ return true;
13607
+ }
13608
+ if (this._abort_sub_component_parent_animation[sub_component_id]) {
13609
+ return true;
13610
+ }
13537
13611
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
13538
13612
  if (parent_id) {
13539
- animating_sub_component =
13540
- animating_sub_component ||
13541
- !!this._abort_sub_component_parent_animation[parent_id];
13613
+ if (this._abort_sub_component_parent_animation[parent_id]) {
13614
+ return true;
13615
+ }
13616
+ if (this._layout_parent_children_animation_frame[parent_id] !== undefined) {
13617
+ return true;
13618
+ }
13542
13619
  }
13543
- return animating_sub_component;
13620
+ return false;
13544
13621
  };
13545
13622
  this._animate_zoom_opacity = (to) => {
13546
13623
  if (this._zoom_opacity_animation) {
@@ -13550,10 +13627,7 @@ class Editor_ extends element_1.Element {
13550
13627
  this._zoom_opacity_animation = undefined;
13551
13628
  });
13552
13629
  };
13553
- this._leave_tree_layout = () => {
13554
- // console.log('Graph', '_leave_tree_layout')
13555
- const { animate } = this._config();
13556
- this._pointer_up_all_pressed_pointer_id();
13630
+ this._build_animating_sub_component_set = () => {
13557
13631
  const animating_sub_component_set = new Set();
13558
13632
  for (const sub_component_id in this._component.$subComponent) {
13559
13633
  const animating_sub_component = this._is_sub_component_animating(sub_component_id);
@@ -13561,10 +13635,18 @@ class Editor_ extends element_1.Element {
13561
13635
  animating_sub_component_set.add(sub_component_id);
13562
13636
  }
13563
13637
  }
13638
+ return animating_sub_component_set;
13639
+ };
13640
+ this._leave_tree_layout = () => {
13641
+ // console.log('Graph', '_leave_tree_layout')
13642
+ const { animate } = this._config();
13643
+ this._pointer_up_all_pressed_pointer_id();
13644
+ const animating_sub_component_set = this._build_animating_sub_component_set();
13564
13645
  this._cancel_fullwindow_animation();
13565
13646
  this._cancel_all_sub_component_base_animation();
13566
13647
  this._cancel_all_layout_parent_children_animation();
13567
13648
  this._cancel_all_sub_component_parent_animation();
13649
+ this._cancel_all_sub_component_parent_animation();
13568
13650
  this._tree_layout = false;
13569
13651
  if (animate) {
13570
13652
  this._animate_zoom_opacity(1);
@@ -13593,8 +13675,23 @@ class Editor_ extends element_1.Element {
13593
13675
  }
13594
13676
  }
13595
13677
  for (const sub_component_id in this._component.$subComponent) {
13596
- const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
13597
13678
  const children = this._spec_get_sub_component_children(sub_component_id);
13679
+ if (!this._layout_path.includes(sub_component_id) &&
13680
+ children.length > 0) {
13681
+ for (const child_id of children) {
13682
+ if (!animating_sub_component_set.has(child_id)) {
13683
+ this._remove_sub_component_parent_root(sub_component_id, child_id);
13684
+ this._remove_sub_component_root_base(child_id);
13685
+ const child = this._get_sub_component(child_id);
13686
+ if (child.$mounted) {
13687
+ child.unmount();
13688
+ }
13689
+ }
13690
+ }
13691
+ }
13692
+ }
13693
+ for (const sub_component_id in this._component.$subComponent) {
13694
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
13598
13695
  if (animate) {
13599
13696
  if (!parent_id || this._layout_path.includes(parent_id)) {
13600
13697
  const animating_sub_component = animating_sub_component_set.has(sub_component_id);
@@ -13605,15 +13702,9 @@ class Editor_ extends element_1.Element {
13605
13702
  }
13606
13703
  }
13607
13704
  }
13608
- if (!this._layout_path.includes(sub_component_id) &&
13609
- children.length > 0) {
13610
- for (const child_id of children) {
13611
- if (!this._animating_sub_component_base_id.has(child_id)) {
13612
- this._remove_sub_component_parent_root(sub_component_id, child_id);
13613
- this._remove_sub_component_root_base(child_id);
13614
- }
13615
- }
13616
- }
13705
+ const leaf_base = this._get_sub_component_root_base(sub_component_id);
13706
+ const { foreground: leaf_layer } = this._get_sub_component_layout_layer(sub_component_id);
13707
+ this._plug_sub_component_base(sub_component_id, leaf_base, [], leaf_layer);
13617
13708
  this._refresh_component_children_counter(sub_component_id);
13618
13709
  this._unlisten_sub_component(sub_component_id);
13619
13710
  this._move_core_content_layout_to_graph(sub_component_id);
@@ -14638,10 +14729,10 @@ class Editor_ extends element_1.Element {
14638
14729
  const merges_ = (0, util_1.remapUnitMerges)(merges, { [unit_id]: next_unit_id }, { [unit_id]: next_unit_pin_map });
14639
14730
  const plugs_ = (0, util_1.remapUnitPlugs)(plugs, next_unit_pin_map);
14640
14731
  actions.push(this._make_remove_unit_action(unit_id, undefined, true, true));
14641
- actions.push(this._make_add_unit_action(next_unit_id, class_bundle, merges_, plugs_));
14732
+ actions.push(this._make_add_unit_bundle_action(next_unit_id, class_bundle, merges_, plugs_));
14642
14733
  const action = (0, G_1.makeBulkEditAction)(actions);
14643
14734
  this._remove_datum(datum_node_id);
14644
- this._state_swap_unit(unit_id, next_unit_id, class_spec, valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index);
14735
+ this._state_swap_unit(unit_id, next_unit_id, class_spec, valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index, null, null, null, null, null);
14645
14736
  if (memory) {
14646
14737
  this._set_unit_memory(next_unit_id, memory);
14647
14738
  }
@@ -17136,6 +17227,7 @@ class Editor_ extends element_1.Element {
17136
17227
  this._animate_sub_component_graph_leave = (sub_component_id, base, base_node, measure, callback) => {
17137
17228
  // console.log('Graph', '_animate_sub_component_graph_leave', base, base_node)
17138
17229
  return this._animate_sub_component_graph_move__template(sub_component_id, base, base_node, false, measure, () => {
17230
+ this._cancel_sub_component_base_animation(sub_component_id);
17139
17231
  this._unplug_sub_component_base_frame(sub_component_id);
17140
17232
  this._compose_sub_component(sub_component_id);
17141
17233
  this._append_sub_component_base(sub_component_id);
@@ -17155,7 +17247,7 @@ class Editor_ extends element_1.Element {
17155
17247
  i++;
17156
17248
  }
17157
17249
  this._leave_sub_component_frame(sub_component_id);
17158
- if (this._animating_sub_component_base_id.has(sub_component_id)) {
17250
+ if (this._is_sub_component_animating(sub_component_id)) {
17159
17251
  //
17160
17252
  }
17161
17253
  else {
@@ -17269,8 +17361,10 @@ class Editor_ extends element_1.Element {
17269
17361
  return;
17270
17362
  }
17271
17363
  const { datumId } = (0, id_1.segmentDatumNodeId)(datum_node_id);
17272
- const value = this._get_datum_value(datum_node_id);
17273
- removeData({ datumId, value });
17364
+ if (this._has_node(datum_node_id)) {
17365
+ const value = this._get_datum_value(datum_node_id);
17366
+ removeData({ datumId, value });
17367
+ }
17274
17368
  };
17275
17369
  this._action_buffer = [];
17276
17370
  this._action_buffer_cursor = -1;
@@ -17697,9 +17791,11 @@ class Editor_ extends element_1.Element {
17697
17791
  const unit_layout_position = geometry_1.NULL_VECTOR;
17698
17792
  this._spec_add_unit(new_unit_id, new_unit, specs);
17699
17793
  let parent_id = null;
17794
+ let slot_name;
17700
17795
  if (this._is_unit_component(new_unit_id)) {
17701
17796
  parent_id = this._spec_get_sub_component_parent_id(unit_id);
17702
- this._spec_append_component(parent_id, new_unit_id);
17797
+ slot_name = this._spec_get_sub_component_slot_name(unit_id);
17798
+ this._spec_append_component(parent_id, new_unit_id, slot_name);
17703
17799
  }
17704
17800
  this._sim_add_unit(new_unit_id, new_unit, unit_position, {}, unit_pin_position, parent_id, unit_layout_position);
17705
17801
  if (this._is_unit_component(new_unit_id)) {
@@ -17937,7 +18033,7 @@ class Editor_ extends element_1.Element {
17937
18033
  if (parent) {
17938
18034
  this._register_unit(unit.id, specs, true);
17939
18035
  }
17940
- this._add_unit(new_unit_id, bundle, null, null, position, pin_position, layout_position);
18036
+ this._add_unit(new_unit_id, bundle, null, null, null, position, pin_position, layout_position);
17941
18037
  this.temp_fixate_node(new_unit_id);
17942
18038
  if (this._is_unit_component(new_unit_id)) {
17943
18039
  this._sim_add_sub_component(new_unit_id);
@@ -18114,6 +18210,7 @@ class Editor_ extends element_1.Element {
18114
18210
  }
18115
18211
  this._plunk_pod();
18116
18212
  const position = this._get_node_position(unit_id);
18213
+ const is_component = this._is_unit_component(unit_id);
18117
18214
  this._search_to_be_focused_by_click = true;
18118
18215
  this._search_start_unit_id = unit_id;
18119
18216
  this._search_start_spec_id = spec_id;
@@ -18122,12 +18219,21 @@ class Editor_ extends element_1.Element {
18122
18219
  this._search_start_unit_plugs = (0, clone_1.clone)(this._get_unit_plugs(unit_id));
18123
18220
  this._search_start_unit_data = (0, clone_1.clone)(this._get_unit_data(unit_id));
18124
18221
  this._search_start_graph_unit_spec = (0, clone_1.clone)(this._get_unit(unit_id));
18222
+ this._search_start_unit_parent_id =
18223
+ (is_component && this._spec_get_sub_component_parent_id(unit_id)) || null;
18224
+ this._search_start_unit_parent_slot_name =
18225
+ (is_component && this._spec_get_sub_component_slot_name(unit_id)) || null;
18226
+ this._search_start_unit_parent_index =
18227
+ (is_component && this._spec_get_sub_component_index(unit_id)) || null;
18228
+ this._search_start_unit_children =
18229
+ (is_component && (0, clone_1.clone)(this._spec_get_sub_component_children(unit_id))) ||
18230
+ null;
18231
+ this._search_start_unit_children_slot_map =
18232
+ (is_component && this._spec_get_sub_component_children_slot(unit_id)) ||
18233
+ null;
18125
18234
  this._search_unit_id = unit_id;
18126
18235
  this._search_unit_spec_id = spec_id;
18127
18236
  this._search_unit_spec_id_changed = false;
18128
- if (this._is_unit_component(unit_id)) {
18129
- this._search_start_component_index = this._sub_component_index[unit_id];
18130
- }
18131
18237
  this._search_unit_merges = this._get_unit_merges(unit_id);
18132
18238
  this._search_unit_merged_pin_ids = {
18133
18239
  input: {
@@ -18885,7 +18991,7 @@ class Editor_ extends element_1.Element {
18885
18991
  if (this._animating_sub_component_fullwindow.has(unit_id)) {
18886
18992
  this._cancel_fullwindow_animation();
18887
18993
  this._end_leave_fullwindow_animation([unit_id]);
18888
- this._animating_sub_component_base_id.delete(unit_id);
18994
+ this._cancel_sub_component_base_animation(unit_id);
18889
18995
  }
18890
18996
  if (this._is_sub_component_fullwindow(unit_id)) {
18891
18997
  fullwindow = true;
@@ -18921,7 +19027,6 @@ class Editor_ extends element_1.Element {
18921
19027
  const animating_sub_component = this._is_sub_component_animating(unit_id);
18922
19028
  if (is_component) {
18923
19029
  if (animating_sub_component) {
18924
- const sub_component = this._get_sub_component(unit_id);
18925
19030
  this._unplug_sub_component_root_base_frame(unit_id);
18926
19031
  this._cancel_sub_component_base_animation(unit_id);
18927
19032
  this._uncollapse_sub_component(unit_id);
@@ -19028,7 +19133,7 @@ class Editor_ extends element_1.Element {
19028
19133
  }
19029
19134
  this._component.decompose();
19030
19135
  if (component_collapsed) {
19031
- if (!this._animating_sub_component_base_id.has(sub_component_id)) {
19136
+ if (this._is_sub_component_animating(sub_component_id)) {
19032
19137
  this._remove_sub_component_root_base(sub_component_id);
19033
19138
  }
19034
19139
  }
@@ -19041,14 +19146,14 @@ class Editor_ extends element_1.Element {
19041
19146
  }
19042
19147
  }
19043
19148
  const trait = (0, extractTrait_1.extractTrait)(frame, measureText);
19044
- if (!this._animating_sub_component_base_id.has(sub_component_id)) {
19149
+ if (!this._is_sub_component_animating(sub_component_id)) {
19045
19150
  this._plug_sub_component_base(sub_component_id, base, base_node, leaf_layer);
19046
19151
  }
19047
19152
  let base_trait = this._reflect_sub_component_base_trait(sub_component_id, base, trait, false);
19048
19153
  const base_length = base.length;
19049
19154
  i = 0;
19050
19155
  this._abort_sub_component_enter_base_animation[sub_component_id] =
19051
- this._plug_animate_sub_component_base(sub_component_id, base, base_node, leaf_layer, (leaf_id) => {
19156
+ this._animate_sub_component_base(sub_component_id, base, base_node, (leaf_id) => {
19052
19157
  if (i === 0) {
19053
19158
  const trait = (0, extractTrait_1.extractTrait)(frame, measureText);
19054
19159
  base_trait = this._reflect_sub_component_base_trait(sub_component_id, base, trait, false);
@@ -19070,6 +19175,7 @@ class Editor_ extends element_1.Element {
19070
19175
  };
19071
19176
  }, async () => {
19072
19177
  await wait_for;
19178
+ this._cancel_sub_component_base_animation(sub_component_id);
19073
19179
  this._cancel_enter_sub_component_animation(sub_component_id);
19074
19180
  this._end_sub_component_enter_base_animation(sub_component_id);
19075
19181
  return true;
@@ -19161,7 +19267,7 @@ class Editor_ extends element_1.Element {
19161
19267
  leaf_trait.height /= this.$context.$sy;
19162
19268
  }
19163
19269
  for (const sub_component_id in this._component.$subComponent) {
19164
- if (this._animating_sub_component_base_id.has(sub_component_id)) {
19270
+ if (this._is_sub_component_animating(sub_component_id)) {
19165
19271
  this._unplug_sub_component_root_base_frame(sub_component_id);
19166
19272
  }
19167
19273
  if (this._abort_sub_component_enter_base_animation[sub_component_id]) {
@@ -19324,7 +19430,7 @@ class Editor_ extends element_1.Element {
19324
19430
  this._append_sub_component_base = (sub_component_id) => {
19325
19431
  // console.log('Graph', '_append_sub_component_base', sub_component_id)
19326
19432
  return this.__commit_sub_component_base(sub_component_id, (parent, leaf_comp) => {
19327
- const slot_name = this._get_sub_component_slot_name(sub_component_id);
19433
+ const slot_name = this._spec_get_sub_component_slot_name(sub_component_id);
19328
19434
  const i = parent.$parentRoot.indexOf(leaf_comp);
19329
19435
  parent.insertParentRootAt(leaf_comp, i, slot_name);
19330
19436
  }, (leaf_parent, leaf_comp, at) => {
@@ -19335,7 +19441,7 @@ class Editor_ extends element_1.Element {
19335
19441
  this._append_sub_component_root_base = (sub_component_id) => {
19336
19442
  // console.log('Graph', '_append_sub_component_root_base', sub_component_id)
19337
19443
  return this.__commit_sub_component_root_base(sub_component_id, (parent, leaf_comp) => {
19338
- const slot_name = this._get_sub_component_slot_name(sub_component_id);
19444
+ const slot_name = this._spec_get_sub_component_slot_name(sub_component_id);
19339
19445
  const i = parent.$parentRoot.indexOf(leaf_comp);
19340
19446
  parent.insertParentRootAt(leaf_comp, i, slot_name);
19341
19447
  }, (parent, leaf_comp, at) => {
@@ -19441,10 +19547,10 @@ class Editor_ extends element_1.Element {
19441
19547
  leaf_node.y += offset_y;
19442
19548
  }
19443
19549
  };
19444
- this._animate_layout_leave_sub_component = () => {
19550
+ this._layout_leave_sub_component = (animate = true) => {
19445
19551
  // console.log('Graph', '_animate_layout_leave_sub_component')
19446
- const { animate } = this._config();
19447
19552
  const sub_component_id = this._get_current_layout_layer_id();
19553
+ const animating_sub_component_set = this._build_animating_sub_component_set();
19448
19554
  this._measure_sub_component_base(sub_component_id);
19449
19555
  const children = this._spec_get_sub_component_children(sub_component_id);
19450
19556
  this._layout_path.pop();
@@ -19458,11 +19564,21 @@ class Editor_ extends element_1.Element {
19458
19564
  layout_layer.children.$element.style.opacity = '0';
19459
19565
  layout_layer.children.$element.style.overflowY = 'initial';
19460
19566
  layout_layer.children.$element.style.overflowX = 'initial';
19461
- if (next_unit_id) {
19462
- this._animate_layout_layer_element_opacity(next_unit_id, 1);
19567
+ if (animate) {
19568
+ if (next_unit_id) {
19569
+ this._animate_layout_layer_element_opacity(next_unit_id, 1);
19570
+ }
19571
+ else {
19572
+ this._animate_layout_root_element_opacity(1);
19573
+ }
19463
19574
  }
19464
19575
  else {
19465
- this._animate_layout_root_element_opacity(1);
19576
+ if (next_unit_id) {
19577
+ next_layout_layer.children.$element.style.opacity = `1`;
19578
+ }
19579
+ else {
19580
+ this._layout_root.children.$element.style.opacity = `1`;
19581
+ }
19466
19582
  }
19467
19583
  next_layout_layer.content.$element.style.overflowY = 'auto';
19468
19584
  next_layout_layer.content.$element.style.overflowX = 'auto';
@@ -19474,7 +19590,7 @@ class Editor_ extends element_1.Element {
19474
19590
  if (animate) {
19475
19591
  const all_slot_children = {};
19476
19592
  for (const child_id of children) {
19477
- const slot_name = this._get_sub_component_slot_name(child_id);
19593
+ const slot_name = this._spec_get_sub_component_slot_name(child_id);
19478
19594
  all_slot_children[slot_name] = all_slot_children[slot_name] || [];
19479
19595
  all_slot_children[slot_name].push(child_id);
19480
19596
  this._measure_sub_component_base(child_id);
@@ -19483,6 +19599,8 @@ class Editor_ extends element_1.Element {
19483
19599
  const parent_layer = this._get_layout_layer(parent_id);
19484
19600
  const all_unlisten = [];
19485
19601
  const finish = async () => {
19602
+ this._cancel_parent_animation(sub_component_id);
19603
+ this._cancel_sub_component_base_animation(sub_component_id);
19486
19604
  for (const slot_name in all_slot_children) {
19487
19605
  if (next_unit_id) {
19488
19606
  if (this._layout_layer_opacity_animation[next_unit_id]) {
@@ -19519,7 +19637,7 @@ class Editor_ extends element_1.Element {
19519
19637
  });
19520
19638
  all_unlisten.push(stop);
19521
19639
  for (const child_id of children) {
19522
- if (!this._animating_sub_component_base_id.has(child_id)) {
19640
+ if (!animating_sub_component_set.has(child_id)) {
19523
19641
  this._leave_sub_component_frame(child_id);
19524
19642
  this._remove_sub_component_root_base(child_id);
19525
19643
  }
@@ -19540,7 +19658,7 @@ class Editor_ extends element_1.Element {
19540
19658
  }
19541
19659
  }
19542
19660
  else {
19543
- // TODO
19661
+ //
19544
19662
  }
19545
19663
  };
19546
19664
  this._ensure_layout_layer = (parent_id) => {
@@ -19847,7 +19965,7 @@ class Editor_ extends element_1.Element {
19847
19965
  this._get_sub_components_slot_map = (sub_component_ids) => {
19848
19966
  const slot_map = {};
19849
19967
  for (const sub_component_id of sub_component_ids) {
19850
- const slot_name = this._get_sub_component_slot_name(sub_component_id);
19968
+ const slot_name = this._spec_get_sub_component_slot_name(sub_component_id);
19851
19969
  slot_map[slot_name] = sub_component_id;
19852
19970
  }
19853
19971
  return slot_map;
@@ -19865,9 +19983,9 @@ class Editor_ extends element_1.Element {
19865
19983
  const prev_parent_map = this._get_sub_components_parent_map(children);
19866
19984
  const slot_map = (0, object_1.makeTagObj)(children, slot_name);
19867
19985
  this._dispatch_action((0, C_1.makeMoveSubComponentRootAction)(parent_id, prev_parent_map, children, index, slot_map, prev_slot_map));
19868
- this._move_sub_component_root(parent_id, children, slot_name);
19986
+ this._layout_move_sub_component_root(parent_id, children, slot_name);
19869
19987
  };
19870
- this._move_sub_component_root = (parent_id, children, slot_name = 'default', animate, callback) => {
19988
+ this._layout_move_sub_component_root = (parent_id, children, slot_name = 'default', animate, emit = true, callback) => {
19871
19989
  // console.log(
19872
19990
  // 'Graph',
19873
19991
  // '_move_sub_component_root',
@@ -19877,9 +19995,15 @@ class Editor_ extends element_1.Element {
19877
19995
  // )
19878
19996
  const config = this._config();
19879
19997
  animate = animate !== null && animate !== void 0 ? animate : config.animate;
19880
- // this._cancel_tree_layout_animation()
19998
+ const animating_sub_component_set = this._build_animating_sub_component_set();
19999
+ for (const child_id of children) {
20000
+ this._cancel_sub_component_base_animation(child_id);
20001
+ }
19881
20002
  this._ensure_layout_layer(parent_id);
19882
20003
  let finish;
20004
+ let stop_core_animation = [];
20005
+ let layout_core_remaining_set = new Set(children);
20006
+ let finished = false;
19883
20007
  const current_layer_id = this._get_current_layout_layer_id();
19884
20008
  animate = animate && !this._is_layout_component_layer_visible(parent_id);
19885
20009
  if (animate) {
@@ -19899,34 +20023,37 @@ class Editor_ extends element_1.Element {
19899
20023
  for (const child_id of all_children) {
19900
20024
  this._measure_sub_component_base(child_id);
19901
20025
  }
19902
- for (const child_id of children) {
19903
- const child_component = this._get_sub_component(child_id);
19904
- this._cancel_sub_component_base_animation(child_id);
19905
- const prev_parent_id = this._spec_get_sub_component_parent_id(child_id);
19906
- if (prev_parent_id) {
19907
- const prev_parent_component = this._get_sub_component(prev_parent_id);
19908
- prev_parent_component.pullParentRoot(child_component);
19909
- }
19910
- else {
19911
- this._component.pullRoot(child_component);
19912
- }
19913
- this._pre_append_sub_component_child(parent_id, child_id, slot_name);
19914
- }
19915
20026
  for (const child_id of all_children) {
19916
- if (!this._animating_sub_component_base_id.has(child_id)) {
20027
+ if (!animating_sub_component_set.has(child_id)) {
19917
20028
  this._remove_sub_component_root_base(child_id);
19918
20029
  }
19919
20030
  }
19920
20031
  for (const child_id of slot_children) {
19921
- if (!this._animating_sub_component_base_id.has(child_id)) {
20032
+ if (!animating_sub_component_set.has(child_id)) {
19922
20033
  this._remove_sub_component_parent_root(parent_id, child_id);
19923
20034
  }
19924
20035
  }
19925
20036
  for (const child_id of children) {
19926
- if (!this._animating_sub_component_base_id.has(child_id)) {
19927
- this._leave_sub_component_frame(child_id);
20037
+ if (!animating_sub_component_set.has(child_id)) {
20038
+ const parent_id = this._spec_get_sub_component_parent_id(child_id);
20039
+ const parent_visible = this._is_layout_component_layer_visible(parent_id);
20040
+ if (!parent_id || parent_visible) {
20041
+ this._leave_sub_component_frame(child_id);
20042
+ }
19928
20043
  }
19929
20044
  }
20045
+ for (const child_id of children) {
20046
+ const child_component = this._get_sub_component(child_id);
20047
+ const prev_parent_id = this._spec_get_sub_component_parent_id(child_id);
20048
+ if (prev_parent_id) {
20049
+ const prev_parent_component = this._get_sub_component(prev_parent_id);
20050
+ prev_parent_component.pullParentRoot(child_component);
20051
+ }
20052
+ else {
20053
+ this._component.pullRoot(child_component);
20054
+ }
20055
+ this._pre_append_sub_component_child(parent_id, child_id, slot_name, emit);
20056
+ }
19930
20057
  const parent_animating = this._is_sub_component_animating(parent_id);
19931
20058
  const parent_leaf_traits = [];
19932
20059
  const parent_layer = this._get_sub_component_layout_layer(parent_id);
@@ -19952,31 +20079,49 @@ class Editor_ extends element_1.Element {
19952
20079
  return maybe_finish();
19953
20080
  });
19954
20081
  finish = () => {
20082
+ if (finished) {
20083
+ return;
20084
+ }
20085
+ finished = true;
20086
+ this._cancel_parent_animation(parent_id);
20087
+ this._cancel_layout_parent_children_all_slot_animation(parent_id);
20088
+ this._cancel_sub_component_base_animation(parent_id);
20089
+ (0, callAll_1.callAll)(stop_core_animation)();
19955
20090
  stop_parent_animation();
19956
20091
  stop_children_animation();
20092
+ for (const child_id of layout_core_remaining_set) {
20093
+ this._layout_layer_move_sub_component_child(current_layer_id, parent_id, child_id, i);
20094
+ }
19957
20095
  this._unplug_sub_component_root_base_frame(parent_id);
19958
20096
  this._append_sub_component_root_base(parent_id);
19959
20097
  this._enter_sub_component_frame(parent_id);
19960
20098
  this._end_layout_sub_component_transfer_children_animation(parent_id, slot_name);
19961
20099
  for (const child_id of slot_children) {
20100
+ this._cancel_layout_child_transfer_animation(child_id);
20101
+ this._cancel_sub_component_base_animation(child_id);
19962
20102
  this._insert_sub_component_child(parent_id, child_id);
19963
20103
  }
19964
20104
  for (const child_id of children) {
20105
+ this._cancel_layout_child_transfer_animation(child_id);
20106
+ this._cancel_sub_component_base_animation(child_id);
19965
20107
  this._insert_sub_component_child(parent_id, child_id);
19966
20108
  }
19967
20109
  this._layout_sub_components_commit_base(all_children);
19968
- this._animate_all_current_layout_layer_node();
19969
20110
  callback && callback();
19970
20111
  };
19971
20112
  let i = slot_children.length;
19972
20113
  for (const child_id of children) {
19973
20114
  const stop = this._animate_layout_core_anchor(child_id, this._layout_node[child_id], () => {
19974
20115
  stop();
20116
+ layout_core_remaining_set.delete(child_id);
19975
20117
  this._layout_layer_move_sub_component_child(current_layer_id, parent_id, child_id, i);
19976
20118
  i++;
19977
20119
  });
20120
+ stop_core_animation.push(stop);
19978
20121
  }
19979
20122
  }
20123
+ this._refresh_layout_node_target_position(current_layer_id);
20124
+ this._animate_all_current_layout_layer_node();
19980
20125
  if (animate) {
19981
20126
  //
19982
20127
  }
@@ -20006,14 +20151,14 @@ class Editor_ extends element_1.Element {
20006
20151
  }
20007
20152
  return finish;
20008
20153
  };
20009
- this._mem_append_sub_component_child = (parent_id, child_id, slot_name) => { };
20010
- this._pre_append_sub_component_child = (parent_id, child_id, slot_name) => {
20154
+ this._pre_append_sub_component_child = (parent_id, child_id, slot_name, emit = true) => {
20011
20155
  // console.log('Graph', '_pre_append_sub_component_child', parent_id, child_id)
20012
20156
  const next_index = this._get_component_children_count(parent_id);
20013
20157
  this._state_pre_append_sub_component_child(parent_id, child_id, slot_name);
20014
- this._pod_move_sub_component_root(parent_id, [child_id], {
20015
- [child_id]: slot_name,
20016
- }, next_index, {}, {});
20158
+ emit &&
20159
+ this._pod_move_sub_component_root(parent_id, [child_id], {
20160
+ [child_id]: slot_name,
20161
+ }, next_index, {}, {});
20017
20162
  };
20018
20163
  this._state_pre_append_sub_component_child = (parent_id, child_id, slot_name) => {
20019
20164
  // console.log(
@@ -20022,7 +20167,7 @@ class Editor_ extends element_1.Element {
20022
20167
  // parent_id,
20023
20168
  // child_id
20024
20169
  // )
20025
- const index = this._get_component_children_count(parent_id);
20170
+ const index = this._spec_get_sub_component_children_count(parent_id);
20026
20171
  this._state_pre_insert_sub_component_child(parent_id, child_id, slot_name, index);
20027
20172
  };
20028
20173
  this._state_pre_insert_sub_component_child = (parent_id, child_id, slot_name, at) => {
@@ -20090,7 +20235,7 @@ class Editor_ extends element_1.Element {
20090
20235
  this._leaf_layer_offset_y = 0;
20091
20236
  for (const sub_component_id of sub_component_ids) {
20092
20237
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
20093
- if (!this._animating_sub_component_base_id.has(sub_component_id) &&
20238
+ if (!this._is_sub_component_animating(sub_component_id) &&
20094
20239
  !this._animating_sub_component_fullwindow.has(sub_component_id)) {
20095
20240
  if (this._tree_layout) {
20096
20241
  if (parent_id) {
@@ -20119,7 +20264,7 @@ class Editor_ extends element_1.Element {
20119
20264
  this._plug_sub_component_base(sub_component_id, base, [], layer);
20120
20265
  }
20121
20266
  this._animating_sub_component_fullwindow.add(sub_component_id);
20122
- const stop = this._plug_animate_sub_component_base(sub_component_id, base, [], layer, (leaf_id) => {
20267
+ const stop = this._animate_sub_component_base(sub_component_id, base, [], (leaf_id) => {
20123
20268
  if (i === 0) {
20124
20269
  const color = sub_component.getColor();
20125
20270
  let target_slot = frame_slot;
@@ -20214,7 +20359,7 @@ class Editor_ extends element_1.Element {
20214
20359
  ];
20215
20360
  }
20216
20361
  else {
20217
- const slot_name = this._get_sub_component_slot_name(sub_component_id);
20362
+ const slot_name = this._spec_get_sub_component_slot_name(sub_component_id);
20218
20363
  all_parent_base[parent_id] = all_parent_base[parent_id] || {};
20219
20364
  all_parent_base[parent_id][slot_name] =
20220
20365
  all_parent_base[parent_id][slot_name] || [];
@@ -20273,7 +20418,7 @@ class Editor_ extends element_1.Element {
20273
20418
  this._component.decompose();
20274
20419
  }
20275
20420
  for (const sub_component_id of sub_component_ids) {
20276
- if (!this._animating_sub_component_base_id.has(sub_component_id) &&
20421
+ if (!this._is_sub_component_animating(sub_component_id) &&
20277
20422
  !this._animating_sub_component_fullwindow.has(sub_component_id)) {
20278
20423
  this._remove_sub_component_root_base(sub_component_id);
20279
20424
  this._remove_sub_component_all_root(sub_component_id);
@@ -20289,7 +20434,7 @@ class Editor_ extends element_1.Element {
20289
20434
  let i = 0;
20290
20435
  const leaf_total = base.length;
20291
20436
  this._plug_sub_component_base(sub_component_id, base, [], layer);
20292
- const stop = this._plug_animate_sub_component_base(sub_component_id, base, [], layer, (leaf_id) => {
20437
+ const stop = this._animate_sub_component_base(sub_component_id, base, [], (leaf_id) => {
20293
20438
  if (i === 0) {
20294
20439
  reset_all_trait();
20295
20440
  }
@@ -20374,6 +20519,9 @@ class Editor_ extends element_1.Element {
20374
20519
  this._cancel_layout_parent_children_animation(parent_id, slot_name);
20375
20520
  this._reset_layout_transfer_parent(parent_id, slot_name);
20376
20521
  this._reset_layout_transfer_parent_children(parent_id, slot_name, children);
20522
+ for (const child_id of children) {
20523
+ this._animating_sub_component_transfer.add(child_id);
20524
+ }
20377
20525
  const parent_child_leaf_style = [];
20378
20526
  const sub_component = this._get_sub_component(parent_id);
20379
20527
  const frame = this._get_sub_component_frame(parent_id);
@@ -20409,12 +20557,18 @@ class Editor_ extends element_1.Element {
20409
20557
  for (const sub_component_id in {
20410
20558
  ...this._layout_parent_children_animation_frame,
20411
20559
  }) {
20412
- // console.log('_cancel_all_layout_parent_children_animation')
20413
- for (const slot_name in {
20414
- ...this._layout_parent_children_animation_frame[sub_component_id],
20415
- }) {
20416
- this._cancel_layout_parent_children_animation(sub_component_id, slot_name);
20417
- }
20560
+ this._cancel_layout_parent_children_all_slot_animation(sub_component_id);
20561
+ }
20562
+ };
20563
+ this._cancel_layout_parent_children_all_slot_animation = (sub_component_id) => {
20564
+ // console.log(
20565
+ // '_cancel_layout_parent_children_all_slot_animation',
20566
+ // sub_component_id
20567
+ // )
20568
+ for (const slot_name in {
20569
+ ...this._layout_parent_children_animation_frame[sub_component_id],
20570
+ }) {
20571
+ this._cancel_layout_parent_children_animation(sub_component_id, slot_name);
20418
20572
  }
20419
20573
  };
20420
20574
  this._cancel_all_sub_component_parent_animation = () => {
@@ -20443,10 +20597,16 @@ class Editor_ extends element_1.Element {
20443
20597
  // slot_name
20444
20598
  // )
20445
20599
  cancelAnimationFrame(this._layout_parent_children_animation_frame[parent_id][slot_name]);
20446
- delete this._layout_parent_children_animation_frame[parent_id][slot_name];
20600
+ (0, object_1.deepDestroy)(this._layout_parent_children_animation_frame, [
20601
+ parent_id,
20602
+ slot_name,
20603
+ ]);
20447
20604
  }
20448
20605
  }
20449
20606
  };
20607
+ this._cancel_layout_child_transfer_animation = (child_id) => {
20608
+ this._animating_sub_component_transfer.delete(child_id);
20609
+ };
20450
20610
  this._start_layout_children_animation = (parent_id, slot_name, frame) => {
20451
20611
  // console.log(
20452
20612
  // 'Graph',
@@ -20465,7 +20625,7 @@ class Editor_ extends element_1.Element {
20465
20625
  // include_scroll,
20466
20626
  // slot_name
20467
20627
  // )
20468
- // this._cancel_layout_current_children_transfer_animation()
20628
+ this._cancel_all_layout_parent_children_animation();
20469
20629
  this._cancel_layout_parent_children_animation(sub_component_id, slot_name);
20470
20630
  this._setup_layout_sub_component_append_children_animation(sub_component_id, children, slot_name);
20471
20631
  this._layout_transfer_parent_callback[sub_component_id] = callback;
@@ -20479,7 +20639,6 @@ class Editor_ extends element_1.Element {
20479
20639
  return this._play_layout_sub_component_transfer_children_animation(sub_component_id, slot_name, children, pack, true, anticipate, offset, include_scroll, callback);
20480
20640
  };
20481
20641
  this._play_layout_sub_component_transfer_children_animation = (parent_id, slot_name, children, pack, expand, anticipate, offset, include_scroll, callback) => {
20482
- const { api: { animation: { requestAnimationFrame }, }, } = this.$system;
20483
20642
  const frame = () => {
20484
20643
  this._tick_animate_layout_transfer_children(parent_id, slot_name, pack, expand, anticipate, offset, include_scroll);
20485
20644
  if (this._layout_transfer_parent_leaf_end_count[parent_id][slot_name] <
@@ -20496,7 +20655,7 @@ class Editor_ extends element_1.Element {
20496
20655
  callback();
20497
20656
  }
20498
20657
  };
20499
- requestAnimationFrame(frame);
20658
+ this._start_layout_children_animation(parent_id, slot_name, frame);
20500
20659
  return () => {
20501
20660
  this._cancel_layout_parent_children_animation(parent_id, slot_name);
20502
20661
  };
@@ -20767,21 +20926,7 @@ class Editor_ extends element_1.Element {
20767
20926
  else {
20768
20927
  component.pullRoot(child_component);
20769
20928
  }
20770
- };
20771
- this._mem_push_parent_child = (parent_id, child_id, slot_name) => {
20772
- // console.log(
20773
- // 'Graph',
20774
- // '_mem_push_parent_child',
20775
- // parent_id,
20776
- // child_id,
20777
- // slot_name,
20778
- // )
20779
- const parent_component = this._get_sub_component(parent_id);
20780
- const child_component = this._get_sub_component(child_id);
20781
- const slot = this._get_sub_component_slot_name(child_id);
20782
- parent_component.pushParentRoot(child_component, slot);
20783
- this._layout_sub_component_parent[child_id] = parent_id;
20784
- this._mem_layout_push_parent_root(parent_id, child_id, slot_name);
20929
+ this._layout_mem_move_sub_component_child(parent_id, child_id, null);
20785
20930
  };
20786
20931
  this._mem_insert_parent_child = (parent_id, child_id, slot_name, at) => {
20787
20932
  // console.log(
@@ -20793,8 +20938,6 @@ class Editor_ extends element_1.Element {
20793
20938
  // at
20794
20939
  // )
20795
20940
  this._mem_place_parent_root(parent_id, child_id, slot_name, at);
20796
- this._layout_sub_component_parent[child_id] = parent_id;
20797
- this._mem_layout_insert_parent_root(parent_id, child_id, slot_name, at);
20798
20941
  };
20799
20942
  this._mem_layout_push_parent_root = (parent_id, child_id, slot_name) => {
20800
20943
  // console.log(
@@ -20830,6 +20973,8 @@ class Editor_ extends element_1.Element {
20830
20973
  const parent = this._get_sub_component(parent_id);
20831
20974
  const child = this._get_sub_component(child_id);
20832
20975
  parent.placeParentRoot(child, at, slot_name);
20976
+ this._layout_sub_component_parent[child_id] = parent_id;
20977
+ this._mem_layout_insert_parent_root(parent_id, child_id, slot_name, at);
20833
20978
  };
20834
20979
  this._layout_layer_move_sub_component_child = (parent_id, next_parent_id, child_id, next_index) => {
20835
20980
  // console.log(
@@ -20855,17 +21000,6 @@ class Editor_ extends element_1.Element {
20855
21000
  next_parent_layout_layer.layers.insertChild(layout_layer.layer, 'default', next_index);
20856
21001
  }
20857
21002
  };
20858
- this._layout_layer_move_sub_component_child_append = (parent_id, next_parent_id, child_id) => {
20859
- // console.log(
20860
- // 'Graph',
20861
- // '_layout_layer_move_sub_component_child',
20862
- // parent_id,
20863
- // next_parent_id,
20864
- // child_id
20865
- // )
20866
- const next_index = this._get_component_children_count(next_parent_id);
20867
- this._layout_layer_move_sub_component_child(parent_id, next_parent_id, child_id, next_index);
20868
- };
20869
21003
  this._ensure_parent_layout_layer = (sub_component_id) => {
20870
21004
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
20871
21005
  if (parent_id) {
@@ -20902,25 +21036,29 @@ class Editor_ extends element_1.Element {
20902
21036
  // )
20903
21037
  const parent_component = this._get_sub_component(parent_id);
20904
21038
  const child_component = this._get_sub_component(child_id);
20905
- const slot = this._get_sub_component_slot_name(child_id);
21039
+ const slot = this._spec_get_sub_component_slot_name(child_id);
20906
21040
  parent_component.appendParentRoot(child_component, slot);
20907
21041
  };
20908
21042
  this._insert_sub_component_parent_root_at = (parent_id, child_id, at) => {
20909
21043
  // console.log('Graph', '_insert_sub_component_parent_root_at', unit_id)
20910
21044
  const parent_component = this._get_sub_component(parent_id);
20911
21045
  const child_component = this._get_sub_component(child_id);
20912
- const slot = this._get_sub_component_slot_name(child_id);
21046
+ const slot = this._spec_get_sub_component_slot_name(child_id);
20913
21047
  parent_component.insertParentRootAt(child_component, at, slot);
20914
21048
  };
20915
21049
  this._remove_sub_component_parent_root = (sub_component_id, child_id) => {
20916
21050
  const sub_component = this._get_sub_component(sub_component_id);
20917
21051
  const sub_component_child = this._get_sub_component(child_id);
20918
- sub_component.removeParentRoot(sub_component_child);
21052
+ if (sub_component.$mountParentRoot.includes(sub_component_child)) {
21053
+ sub_component.removeParentRoot(sub_component_child);
21054
+ }
20919
21055
  };
20920
21056
  this._remove_sub_component_from_root = (sub_component_id) => {
20921
21057
  // console.log('Graph', '_remove_sub_component_from_root', sub_component_id)
20922
21058
  const sub_component = this._get_sub_component(sub_component_id);
20923
- this._component.removeRoot(sub_component);
21059
+ if (this.$mountRoot.includes(sub_component)) {
21060
+ this._component.removeRoot(sub_component);
21061
+ }
20924
21062
  };
20925
21063
  this._layout_collapse_sub_component = (sub_component_id, parent) => {
20926
21064
  // console.log('Graph', '_layout_collapse_sub_component')
@@ -21048,7 +21186,7 @@ class Editor_ extends element_1.Element {
21048
21186
  };
21049
21187
  this.__spec_append_sub_component_child = (parent_id, child_id, slot_name) => {
21050
21188
  if (parent_id) {
21051
- (0, component_1.appendSubComponentChild)({ parentId: parent_id, childId: child_id }, this._spec.component);
21189
+ (0, component_1.appendSubComponentChild)({ parentId: parent_id, childId: child_id, slotName: slot_name }, this._spec.component);
21052
21190
  this._layout_sub_component_parent[child_id] = parent_id;
21053
21191
  }
21054
21192
  else {
@@ -21132,29 +21270,74 @@ class Editor_ extends element_1.Element {
21132
21270
  this._layout_transfer_parent_leaf_end_set[parent_id][slot_name] = new Set();
21133
21271
  this._layout_transfer_parent_leaf_count[parent_id][slot_name] = 0;
21134
21272
  };
21135
- this.remove_sub_component_all_children = (parent_id, slot_name, next_parent_id, next_slot_name) => {
21136
- const children = this._spec_get_sub_component_children(parent_id);
21137
- const index = this._get_sub_component_index(parent_id);
21273
+ this.remove_sub_component_all_children = (parent_id, slot_name, next_parent_id, next_slot_name, emit, callback) => {
21274
+ const children = (0, clone_1.clone)(this._spec_get_sub_component_children(parent_id));
21275
+ const index = this._spec_get_sub_component_index(parent_id);
21138
21276
  const slot_map = this._get_sub_components_slot_map(children);
21139
21277
  const parent_map = this._get_sub_components_parent_map(children);
21140
21278
  this._dispatch_action((0, C_1.makeMoveSubComponentRootAction)(null, parent_map, children, index, {}, slot_map));
21141
- this._remove_sub_component_all_children(parent_id, slot_name, next_parent_id, next_slot_name);
21279
+ this._remove_sub_component_children(parent_id, slot_name, next_parent_id, next_slot_name, children, emit, callback);
21142
21280
  };
21143
- this._remove_sub_component_all_children = (parent_id, slot_name, next_parent_id, next_slot_name) => {
21144
- const children = (0, clone_1.clone)(this._spec_get_sub_component_children(parent_id));
21145
- this.remove_sub_component_children(parent_id, slot_name, next_parent_id, next_slot_name, children);
21281
+ this.remove_sub_component_children = (parent_id, slot_name, next_parent_id, next_slot_name, children, emit = true, callback) => {
21282
+ const prev_parent_id_map = {};
21283
+ const prev_slot_map = {};
21284
+ const next_slot_map = {};
21285
+ for (const child_id of children) {
21286
+ prev_parent_id_map[child_id] = parent_id;
21287
+ prev_slot_map[child_id] = slot_name;
21288
+ next_slot_map[child_id] = next_slot_name;
21289
+ }
21290
+ const index = this._spec_get_sub_component_children_count(next_parent_id);
21291
+ this._dispatch_action((0, C_1.makeMoveSubComponentRootAction)(next_parent_id, prev_parent_id_map, children, index, next_slot_map, prev_slot_map));
21292
+ this._remove_sub_component_children(parent_id, slot_name, next_parent_id, next_slot_name, children, emit, callback);
21146
21293
  };
21147
- this.remove_sub_component_children = (parent_id, slot_name, next_parent_id, next_slot_name, children, emit = true) => {
21294
+ this._remove_sub_component_children = (parent_id, slot_name, next_parent_id, next_slot_name, children, emit = true, callback) => {
21148
21295
  let { animate } = this._config();
21149
21296
  const parent_visible = this._is_layout_component_layer_visible(parent_id);
21150
21297
  animate = animate && !parent_visible;
21151
21298
  const layout_parent_node = this._layout_node[parent_id];
21152
21299
  const { x, y, width, height } = layout_parent_node;
21153
- const parent_index = this._get_sub_component_index(parent_id);
21300
+ const all_stop = [];
21301
+ const parent_index = this._spec_get_sub_component_index(parent_id);
21302
+ for (const child_id of children) {
21303
+ this._cancel_sub_component_base_animation(child_id);
21304
+ }
21305
+ this._cancel_layout_parent_children_animation(parent_id, slot_name);
21154
21306
  this._measure_sub_component_base(parent_id);
21307
+ let finish = NOOP_1.NOOP;
21308
+ let finish_parent = () => {
21309
+ this._cancel_parent_animation(parent_id);
21310
+ this._cancel_sub_component_base_animation(parent_id);
21311
+ this._unplug_sub_component_root_base_frame(parent_id);
21312
+ this._append_sub_component_root_base(parent_id);
21313
+ this._enter_sub_component_frame(parent_id);
21314
+ };
21315
+ let finish_children = () => {
21316
+ this._end_layout_sub_component_transfer_children_animation(parent_id, slot_name);
21317
+ for (const child_id of children) {
21318
+ this._cancel_layout_child_transfer_animation(child_id);
21319
+ this._enter_sub_component_frame(child_id);
21320
+ this._append_sub_component_base(child_id);
21321
+ }
21322
+ };
21323
+ if (animate) {
21324
+ finish = () => {
21325
+ (0, callAll_1.callAll)(all_stop);
21326
+ if (!parent_animation_finished) {
21327
+ parent_animation_finished = true;
21328
+ finish_parent();
21329
+ }
21330
+ if (!children_animation_finished) {
21331
+ children_animation_finished = true;
21332
+ finish_children();
21333
+ }
21334
+ callback();
21335
+ };
21336
+ }
21155
21337
  let i = parent_index + 1;
21338
+ let parent_animation_finished = false;
21339
+ let children_animation_finished = false;
21156
21340
  for (const child_id of children) {
21157
- this._cancel_sub_component_base_animation(child_id);
21158
21341
  this._layout_layer_move_sub_component_child(parent_id, next_parent_id, child_id, i);
21159
21342
  i++;
21160
21343
  if (animate) {
@@ -21165,7 +21348,7 @@ class Editor_ extends element_1.Element {
21165
21348
  }
21166
21349
  if (this._tree_layout) {
21167
21350
  for (const child_id of children) {
21168
- if (!this._animating_sub_component_base_id.has(child_id)) {
21351
+ if (!this._is_sub_component_animating(child_id)) {
21169
21352
  if (!this._is_layout_component_layer_visible(parent_id)) {
21170
21353
  this._remove_sub_component_parent_root(parent_id, child_id);
21171
21354
  }
@@ -21178,7 +21361,6 @@ class Editor_ extends element_1.Element {
21178
21361
  }
21179
21362
  }
21180
21363
  }
21181
- this._cancel_layout_parent_children_animation(parent_id, slot_name);
21182
21364
  if (this._tree_layout) {
21183
21365
  if (animate) {
21184
21366
  this._setup_layout_sub_component_remove_parent_children_animation(parent_id, slot_name, children);
@@ -21199,24 +21381,21 @@ class Editor_ extends element_1.Element {
21199
21381
  if (this._tree_layout) {
21200
21382
  if (animate) {
21201
21383
  const parent_animating = this._is_sub_component_animating(parent_id);
21202
- const parent_leaf_traits = [];
21203
21384
  const parent_layer = this._get_sub_component_layout_layer(parent_id);
21204
- const stop = this._animate_parent_component(parent_id, parent_animating, parent_animating, parent_leaf_traits, parent_layer.foreground, 1, false, () => ({ x: 0, y: -parent_layer.content.$element.scrollTop }), () => {
21205
- stop();
21206
- this._unplug_sub_component_root_base_frame(parent_id);
21207
- this._append_sub_component_root_base(parent_id);
21208
- this._enter_sub_component_frame(parent_id);
21209
- return true;
21385
+ const parent_leaf_traits = [];
21386
+ const stop_parent_animation = this._animate_parent_component(parent_id, parent_animating, parent_animating, parent_leaf_traits, parent_layer.foreground, 1, false, () => ({ x: 0, y: -parent_layer.content.$element.scrollTop }), () => {
21387
+ stop_parent_animation();
21388
+ parent_animation_finished = true;
21389
+ finish_parent();
21210
21390
  });
21391
+ all_stop.push(stop_parent_animation);
21211
21392
  this._animate_all_layout_layer_node(next_parent_id);
21212
- const stop_ = this._play_layout_sub_component_remove_children_animation(parent_id, slot_name, children, true, () => {
21213
- stop_();
21214
- this._end_layout_sub_component_transfer_children_animation(parent_id, slot_name);
21215
- for (const child_id of children) {
21216
- this._enter_sub_component_frame(child_id);
21217
- this._append_sub_component_base(child_id);
21218
- }
21393
+ const stop_children_animation = this._play_layout_sub_component_remove_children_animation(parent_id, slot_name, children, true, () => {
21394
+ stop_children_animation();
21395
+ children_animation_finished = true;
21396
+ finish_children();
21219
21397
  });
21398
+ all_stop.push(stop_children_animation);
21220
21399
  }
21221
21400
  else {
21222
21401
  if (!parent_visible) {
@@ -21228,6 +21407,10 @@ class Editor_ extends element_1.Element {
21228
21407
  this._force_layout_node_traits(next_parent_id);
21229
21408
  }
21230
21409
  }
21410
+ if (!animate) {
21411
+ callback();
21412
+ }
21413
+ return finish;
21231
21414
  };
21232
21415
  this._pre_remove_sub_component_child = (parent_id, child_id, next_parent_id, next_index) => {
21233
21416
  const is_child_fullwindow = this._is_sub_component_fullwindow(child_id);
@@ -21261,11 +21444,11 @@ class Editor_ extends element_1.Element {
21261
21444
  }
21262
21445
  };
21263
21446
  this._sim_move_out_sub_component_layout_children = (parent_id, next_parent_id) => {
21447
+ // console.log('_sim_move_out_sub_component_layout_children', parent_id)
21264
21448
  const children = this._spec_get_sub_component_children(parent_id);
21265
- const parent_index = this._get_sub_component_index(parent_id);
21449
+ const parent_index = this._spec_get_sub_component_index(parent_id);
21266
21450
  let i = parent_index;
21267
21451
  for (const child_id of children) {
21268
- this._layout_mem_move_sub_component_child(parent_id, child_id, next_parent_id);
21269
21452
  this._layout_layer_move_sub_component_child(parent_id, next_parent_id, child_id, i);
21270
21453
  i++;
21271
21454
  }
@@ -21274,9 +21457,11 @@ class Editor_ extends element_1.Element {
21274
21457
  const parent_component = this._get_sub_component(parent_id);
21275
21458
  const child_component = this._get_sub_component(child_id);
21276
21459
  parent_component.removeParentRoot(child_component);
21460
+ this._layout_mem_move_sub_component_child(parent_id, child_id, null);
21277
21461
  };
21278
21462
  this._mem_move_out_sub_component_child = (parent_id, child_id, next_parent_id, next_index) => {
21279
21463
  this._mem_pull_sub_component_child(parent_id, child_id);
21464
+ this._layout_mem_move_sub_component_child(parent_id, child_id, next_parent_id);
21280
21465
  if (next_parent_id) {
21281
21466
  this._mem_insert_sub_component_child(next_parent_id, child_id, 'default', next_index);
21282
21467
  }
@@ -21325,7 +21510,7 @@ class Editor_ extends element_1.Element {
21325
21510
  this._spec_remove_component_children = (parent_id, next_parent_id) => {
21326
21511
  const children = this._spec_get_sub_component_children(parent_id);
21327
21512
  let i = 0;
21328
- const parent_index = this._get_sub_component_index(parent_id);
21513
+ const parent_index = this._spec_get_sub_component_index(parent_id);
21329
21514
  for (const child_id of [...children]) {
21330
21515
  this._spec_move_sub_component_child(parent_id, child_id, next_parent_id, 'default', parent_index + i);
21331
21516
  i++;
@@ -21350,7 +21535,12 @@ class Editor_ extends element_1.Element {
21350
21535
  (0, component_1.removeRoot)({ childId: child_id }, this._spec.component);
21351
21536
  }
21352
21537
  if (next_parent_id) {
21353
- (0, component_1.insertSubComponentChild)({ parentId: next_parent_id, childId: child_id, at: next_index }, this._spec.component);
21538
+ (0, component_1.insertSubComponentChild)({
21539
+ parentId: next_parent_id,
21540
+ childId: child_id,
21541
+ slotName: next_slot_id,
21542
+ at: next_index,
21543
+ }, this._spec.component);
21354
21544
  this._layout_sub_component_parent[child_id] = next_parent_id;
21355
21545
  }
21356
21546
  else {
@@ -21434,7 +21624,7 @@ class Editor_ extends element_1.Element {
21434
21624
  }
21435
21625
  this._cancel_node_long_click = true;
21436
21626
  const next_parent_id = this._get_current_layout_layer_id();
21437
- this._remove_sub_component_all_children(node_id, 'default', next_parent_id, 'default');
21627
+ this.remove_sub_component_all_children(node_id, 'default', next_parent_id, 'default', true, () => { });
21438
21628
  this.deselect_node(node_id);
21439
21629
  }
21440
21630
  else {
@@ -21642,7 +21832,7 @@ class Editor_ extends element_1.Element {
21642
21832
  if (this._is_unit_node_id(selected_node_id) &&
21643
21833
  this._is_unit_component(selected_node_id)) {
21644
21834
  const parent_id = this._spec_get_sub_component_parent_id(selected_node_id);
21645
- const parent_index = this._get_sub_component_index(selected_node_id);
21835
+ const parent_index = this._spec_get_sub_component_index(selected_node_id);
21646
21836
  if (parent_id !== unit_id) {
21647
21837
  this._collapse_animation_next_parent[selected_node_id] = unit_id;
21648
21838
  this._collapse_animation_next_parent_slot[selected_node_id] =
@@ -21756,7 +21946,7 @@ class Editor_ extends element_1.Element {
21756
21946
  next_unit.id = new_spec.id;
21757
21947
  const new_bundle = (0, bundle_1.unitBundleSpec)(next_unit, specs);
21758
21948
  actions.push(this._make_remove_unit_action(unit_id, bundle, true, true));
21759
- actions.push(this._make_add_unit_action(next_unit_id, new_bundle, merges_, plugs));
21949
+ actions.push(this._make_add_unit_bundle_action(next_unit_id, new_bundle, merges_, plugs));
21760
21950
  actions.push(this._make_add_bundle_datum_action(datum_id, bundle));
21761
21951
  const action = (0, G_1.makeBulkEditAction)(actions);
21762
21952
  this._dispatch_action(action);
@@ -21771,7 +21961,7 @@ class Editor_ extends element_1.Element {
21771
21961
  const { fork, bubble } = this.$props;
21772
21962
  this._pod.$bulkEdit({ actions, fork, bubble });
21773
21963
  };
21774
- this._make_add_unit_action = (unit_id, bundle, merges, plugs) => {
21964
+ this._make_add_unit_bundle_action = (unit_id, bundle, merges, plugs) => {
21775
21965
  return (0, G_1.makeAddUnitAction)(unit_id, bundle, merges, plugs);
21776
21966
  };
21777
21967
  this._is_link_pin_default_ignored = (pin_node_id) => {
@@ -21929,7 +22119,7 @@ class Editor_ extends element_1.Element {
21929
22119
  const { x: prev_x, y: prev_y, width: prev_width, height: prev_height, } = unit_node;
21930
22120
  const new_unit_id = this._new_unit_id(new_spec.id);
21931
22121
  const { valid_pin_match, merge_pin_index, exposed_pin_index, merged_pin_ids, exposed_pin_ids, } = this._generate_identity_matches(unit_id);
21932
- this._state_swap_unit(unit_id, new_unit_id, new_spec, valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index);
22122
+ this._state_swap_unit(unit_id, new_unit_id, new_spec, valid_pin_match, merged_pin_ids, merge_pin_index, exposed_pin_ids, exposed_pin_index, null, null, null, null, null);
21933
22123
  const { x, y, width, height } = this._node[new_unit_id];
21934
22124
  const target_trait = {
21935
22125
  x,
@@ -22068,14 +22258,19 @@ class Editor_ extends element_1.Element {
22068
22258
  const position = this._get_node_position(unit_id);
22069
22259
  let sub_component_map = {};
22070
22260
  if (this._is_unit_component(unit_id)) {
22261
+ const sub_component = this._get_sub_component(unit_id);
22071
22262
  this._decompose_sub_component(unit_id);
22072
22263
  this._displace_sub_component(unit_id);
22073
22264
  this._decouple_sub_component(unit_id);
22074
- const sub_component = this._get_sub_component(unit_id);
22075
- this._component.removeSubComponent(unit_id);
22265
+ this._pull_sub_component(unit_id);
22266
+ this._remove_sub_component(unit_id);
22076
22267
  for (const sub_sub_component_id in sub_component.$subComponent) {
22077
22268
  const sub_sub_component = sub_component.$subComponent[sub_sub_component_id];
22078
- const next_sub_sub_component_id = (0, object_1.deepGetOrDefault)(map, ['mappaing', 'unit', sub_sub_component_id, 'in', 'unit', 'unitId'], sub_sub_component_id);
22269
+ const next_sub_sub_component_id = (0, object_1.deepGetOrDefault)(map, ['mapping', 'unit', sub_sub_component_id, 'in', 'unit', 'unitId'], sub_sub_component_id);
22270
+ const sub_sub_component_parent = sub_component.getSubComponentParent(sub_sub_component_id);
22271
+ if (sub_sub_component_parent) {
22272
+ sub_sub_component_parent.pullParentRoot(sub_sub_component);
22273
+ }
22079
22274
  sub_component_map[next_sub_sub_component_id] = sub_sub_component;
22080
22275
  }
22081
22276
  }
@@ -24989,7 +25184,7 @@ class Editor_ extends element_1.Element {
24989
25184
  this._start_graph_simulation(exports.LAYER_NONE);
24990
25185
  };
24991
25186
  this._sim_remove_component = (unit_id, displace, pull_from_parent = true, destroy = true) => {
24992
- // console.log('Graph', '_sim_remove_component', unit_id, remove_roots)
25187
+ // console.log('Graph', '_sim_remove_component', unit_id)
24993
25188
  const collapsing = this._collapse_init_node_id_set.has(unit_id);
24994
25189
  displace = displace && !collapsing;
24995
25190
  pull_from_parent = pull_from_parent && !collapsing;
@@ -24999,8 +25194,15 @@ class Editor_ extends element_1.Element {
24999
25194
  const animating = this._is_sub_component_animating(unit_id);
25000
25195
  this._cancel_parent_animation(unit_id);
25001
25196
  this._cancel_layout_core_animation(unit_id);
25197
+ this._cancel_layout_child_transfer_animation(unit_id);
25198
+ this._cancel_layout_parent_children_all_slot_animation(unit_id);
25199
+ this._cancel_sub_component_base_animation(unit_id);
25002
25200
  this._cancel_enter_sub_component_animation(unit_id);
25003
25201
  this._cancel_leave_sub_component_animation(unit_id);
25202
+ if (animating) {
25203
+ const base = this._get_sub_component_base(unit_id);
25204
+ this._unplug_base_frame(unit_id, base);
25205
+ }
25004
25206
  if (this._tree_layout) {
25005
25207
  if (children.length > 0) {
25006
25208
  for (const child_id of children) {
@@ -25015,7 +25217,13 @@ class Editor_ extends element_1.Element {
25015
25217
  if (this._in_component_control) {
25016
25218
  if (displace) {
25017
25219
  if (!animating) {
25018
- this._displace_sub_component(unit_id);
25220
+ if (this._tree_layout) {
25221
+ this._decouple_sub_component(unit_id);
25222
+ this._pull_sub_component(unit_id);
25223
+ }
25224
+ else {
25225
+ this._displace_sub_component(unit_id);
25226
+ }
25019
25227
  }
25020
25228
  }
25021
25229
  }
@@ -25032,29 +25240,51 @@ class Editor_ extends element_1.Element {
25032
25240
  });
25033
25241
  }
25034
25242
  }
25035
- if (this._animating_sub_component_base_id.has(unit_id)) {
25243
+ if (this._is_sub_component_animating(unit_id)) {
25036
25244
  this._unplug_sub_component_base_frame(unit_id);
25037
- this._animating_sub_component_base_id.delete(unit_id);
25245
+ }
25246
+ if (this._layout_path.includes(unit_id)) {
25247
+ const index = this._layout_path.indexOf(unit_id);
25248
+ let i = this._layout_path.length - 1;
25249
+ while (i >= index) {
25250
+ this._layout_leave_sub_component(false);
25251
+ i--;
25252
+ }
25038
25253
  }
25039
25254
  if (this._tree_layout) {
25040
25255
  if (children.length > 0) {
25041
- const current_layer = this._get_current_layout_layer_id();
25042
- const current_slot = 'default';
25043
- const parent_index = this._get_sub_component_index(unit_id);
25044
- let at = parent_index;
25256
+ const parent_id = this._spec_get_sub_component_parent_id(unit_id);
25257
+ const parent_index = this._spec_get_sub_component_index(unit_id);
25258
+ const parent_slot = this._spec_get_sub_component_slot_name(unit_id);
25045
25259
  for (const child_id of children) {
25046
25260
  this._remove_sub_component_child(unit_id, child_id);
25047
- this._remove_sub_component_root_base(child_id);
25048
- this._mem_insert_sub_component_child(current_layer, child_id, current_slot, at);
25261
+ }
25262
+ let at = parent_index;
25263
+ for (const child_id of children) {
25264
+ this._mem_insert_sub_component_child(parent_id, child_id, parent_slot, parent_index + at);
25049
25265
  at++;
25050
25266
  }
25051
- this._animate_layout_sub_component_remove_children(unit_id, 'default', children, false, () => {
25052
- this._end_layout_sub_component_transfer_children_animation(unit_id, 'default');
25267
+ if (this._is_layout_parent_visible(unit_id)) {
25053
25268
  for (const child_id of children) {
25054
- this._append_sub_component_base(child_id);
25055
- this._enter_sub_component_frame(child_id);
25269
+ this._remove_sub_component_root_base(child_id);
25056
25270
  }
25057
- });
25271
+ this._animate_layout_sub_component_remove_children(unit_id, 'default', children, false, () => {
25272
+ this._cancel_layout_parent_children_all_slot_animation(unit_id);
25273
+ for (const child_id of children) {
25274
+ this._cancel_layout_child_transfer_animation(child_id);
25275
+ }
25276
+ this._end_layout_sub_component_transfer_children_animation(unit_id, 'default');
25277
+ for (const child_id of children) {
25278
+ this._append_sub_component_base(child_id);
25279
+ this._enter_sub_component_frame(child_id);
25280
+ }
25281
+ });
25282
+ }
25283
+ else {
25284
+ for (const child_id of children) {
25285
+ this._insert_sub_component_child(parent_id, child_id);
25286
+ }
25287
+ }
25058
25288
  }
25059
25289
  }
25060
25290
  if (this._is_sub_component_fullwindow(unit_id)) {
@@ -25066,7 +25296,11 @@ class Editor_ extends element_1.Element {
25066
25296
  if (!this._tree_layout) {
25067
25297
  this._sim_move_out_sub_component_children(unit_id, parent_id);
25068
25298
  }
25069
- this._sim_remove_sub_component_roots(unit_id);
25299
+ const sub_component = this._get_sub_component(unit_id);
25300
+ if (sub_component) {
25301
+ this._pull_sub_component(unit_id);
25302
+ this._remove_sub_component(unit_id);
25303
+ }
25070
25304
  }
25071
25305
  this._sim_remove_layout_core(unit_id);
25072
25306
  this._mem_remove_component(unit_id);
@@ -25074,19 +25308,15 @@ class Editor_ extends element_1.Element {
25074
25308
  sub_component.destroy();
25075
25309
  }
25076
25310
  };
25077
- this._sim_remove_sub_component_roots = (unit_id) => {
25311
+ this._pull_sub_component = (unit_id) => {
25078
25312
  const sub_component = this._get_sub_component(unit_id);
25079
25313
  if (sub_component) {
25080
- if (this._abort_sub_component_enter_base_animation[unit_id] ||
25081
- this._abort_sub_component_leave_base_animation[unit_id]) {
25082
- const base = this._get_sub_component_base(unit_id);
25083
- this._unplug_base_frame(unit_id, base);
25084
- }
25085
25314
  const sub_component_parent_id = this._spec_get_sub_component_parent_id(unit_id);
25086
25315
  const parent_sub_component = this._get_sub_component(sub_component_parent_id);
25087
25316
  if (sub_component_parent_id) {
25088
25317
  if (parent_sub_component.hasParentRoot(sub_component)) {
25089
25318
  parent_sub_component.pullParentRoot(sub_component);
25319
+ this._layout_mem_move_sub_component_child(sub_component_parent_id, unit_id, null);
25090
25320
  }
25091
25321
  }
25092
25322
  else {
@@ -25094,10 +25324,11 @@ class Editor_ extends element_1.Element {
25094
25324
  this._component.pullRoot(sub_component);
25095
25325
  }
25096
25326
  }
25097
- this._component.removeSubComponent(unit_id);
25098
- sub_component.destroy();
25099
25327
  }
25100
25328
  };
25329
+ this._remove_sub_component = (unit_id) => {
25330
+ this._component.removeSubComponent(unit_id);
25331
+ };
25101
25332
  this._sim_remove_layout_core = (unit_id) => {
25102
25333
  // console.log('Graph', '_sim_remove_layout_core', unit_id)
25103
25334
  const layout_core = this._layout_core[unit_id];
@@ -25111,10 +25342,6 @@ class Editor_ extends element_1.Element {
25111
25342
  parent_layout_layer.layers.removeChild(layout_layer.layer);
25112
25343
  }
25113
25344
  }
25114
- const layout_parent_id = this._layout_sub_component_parent[unit_id] || null;
25115
- if (layout_parent_id) {
25116
- this._refresh_component_children_counter_up(layout_parent_id, -(1 + (this._layout_component_count[unit_id] || 0)));
25117
- }
25118
25345
  delete this._layout_core[unit_id];
25119
25346
  };
25120
25347
  this._cancel_graph_core_size_animation = (unit_id) => {
@@ -26080,7 +26307,7 @@ class Editor_ extends element_1.Element {
26080
26307
  parent_sub_component.removeParentRoot(sub_component);
26081
26308
  }
26082
26309
  parent_sub_component.pullParentRoot(sub_component);
26083
- const slot = this._get_sub_component_slot_name(unit_id);
26310
+ const slot = this._spec_get_sub_component_slot_name(unit_id);
26084
26311
  parent_sub_component.placeParentRoot(sub_component, i, slot);
26085
26312
  if (!parent_layer_visible) {
26086
26313
  parent_sub_component.insertParentRootAt(sub_component, i, slot);
@@ -28033,7 +28260,7 @@ class Editor_ extends element_1.Element {
28033
28260
  const new_unit_id = this._new_unit_id(id);
28034
28261
  const pin_position = (0, emptyIO_1.emptyIO)({}, {});
28035
28262
  const layout_position = { x: 0, y: 0 };
28036
- this._add_unit(new_unit_id, bundle, null, null, position, pin_position, layout_position);
28263
+ this._add_unit(new_unit_id, bundle, null, null, null, position, pin_position, layout_position);
28037
28264
  this._sim_add_sub_component(new_unit_id);
28038
28265
  this._connect_sub_component(new_unit_id);
28039
28266
  this._move_contained_nodes(new_unit_id, contained_nodes, true);
@@ -28780,11 +29007,12 @@ class Editor_ extends element_1.Element {
28780
29007
  };
28781
29008
  this._on_background_long_click = (event) => {
28782
29009
  const { api: { window: { setTimeout }, }, } = this.$system;
29010
+ const { animate } = this._config();
28783
29011
  if (this._tree_layout) {
28784
29012
  const current_layout_layer = this._get_current_layout_layer_id();
28785
29013
  if (current_layout_layer) {
28786
29014
  if (this._mode === 'none') {
28787
- this._animate_layout_leave_sub_component();
29015
+ this._layout_leave_sub_component(animate);
28788
29016
  }
28789
29017
  }
28790
29018
  }
@@ -29070,7 +29298,7 @@ class Editor_ extends element_1.Element {
29070
29298
  const new_unit_bundle = (0, bundle_1.unitBundleSpecById)(graph_spec.id, specs);
29071
29299
  graph_id = new_unit_id;
29072
29300
  graph_unit_bundle = new_unit_bundle;
29073
- this._state_add_unit(new_unit_id, new_unit_bundle, lowest_common_ancestor, undefined, { x, y }, { input: {}, output: {} }, { x: 0, y: 0 }, { width: 2, height: 2 }, true, false);
29301
+ this._state_add_unit(new_unit_id, new_unit_bundle, lowest_common_ancestor, undefined, undefined, { x, y }, { input: {}, output: {} }, { x: 0, y: 0 }, { width: 2, height: 2 }, true, false);
29074
29302
  if (there_is_selected_sub_component) {
29075
29303
  this._sim_add_sub_component(new_unit_id);
29076
29304
  }
@@ -29137,7 +29365,7 @@ class Editor_ extends element_1.Element {
29137
29365
  const actions = [];
29138
29366
  if (!this._collapse_unit_id) {
29139
29367
  const position = this._get_node_position(graph_id);
29140
- actions.push((0, G_1.makeAddUnitAction)(graph_id, (0, clone_1.clone)(new_bundle), undefined, undefined, undefined, undefined, undefined, undefined, position));
29368
+ actions.push((0, G_1.makeAddUnitAction)(graph_id, (0, clone_1.clone)(new_bundle), undefined, undefined, undefined, undefined, undefined, undefined, undefined, position));
29141
29369
  }
29142
29370
  this._refresh_compatible();
29143
29371
  const moves = (0, buildMoves_1.buildMoves)(selection, (0, clone_1.clone)(map));
@@ -30194,7 +30422,7 @@ class Editor_ extends element_1.Element {
30194
30422
  const selected_children = children.filter(this._is_node_selected);
30195
30423
  if (parent_id) {
30196
30424
  if (selected_children) {
30197
- this.remove_sub_component_children(parent_id, slot_name, next_parent_id, next_slot_name, selected_children);
30425
+ this.remove_sub_component_children(parent_id, slot_name, next_parent_id, next_slot_name, selected_children, true, () => { });
30198
30426
  this._refresh_layout_node_target_position(parent_id);
30199
30427
  this._move_all_current_layout_node_target_position();
30200
30428
  }
@@ -31180,26 +31408,25 @@ class Editor_ extends element_1.Element {
31180
31408
  if (parent_id) {
31181
31409
  const children = (0, component_2.getSubComponentChildren)(graph, parent_id);
31182
31410
  at = children.indexOf(unit_id);
31183
- this._spec_insert_component(parent_id, unit_id, at);
31411
+ this._spec_insert_component(parent_id, unit_id, 'default', at);
31184
31412
  }
31185
31413
  else {
31186
31414
  const children = (_d = (_c = graph.component) === null || _c === void 0 ? void 0 : _c.children) !== null && _d !== void 0 ? _d : [];
31187
31415
  at = children.indexOf(unit_id);
31188
- this._spec_insert_component(null, unit_id, at);
31416
+ this._spec_insert_component(null, unit_id, 'default', at);
31189
31417
  }
31190
31418
  }
31191
31419
  for (const unit_id in subComponents) {
31192
31420
  const parent_id = parent_map[unit_id] || fallback_parent_id;
31193
31421
  const layout_position = geometry_1.NULL_VECTOR;
31194
31422
  this._sim_add_core_component(unit_id, parent_id, layout_position);
31195
- mount &&
31196
- this._sim_add_sub_component(unit_id, undefined, undefined, undefined, false);
31423
+ mount && this._sim_add_sub_component(unit_id, undefined, undefined, false);
31197
31424
  }
31198
31425
  const sub_component_ids = (0, f_7.keys)(subComponents);
31199
31426
  const ordered_sub_component_ids = this._order_sub_component_ids(sub_component_ids);
31200
31427
  if (mount) {
31201
31428
  for (const unit_id of ordered_sub_component_ids) {
31202
- this._sim_add_sub_component_to_parent(unit_id, undefined);
31429
+ this._sim_add_sub_component_to_parent(unit_id);
31203
31430
  }
31204
31431
  }
31205
31432
  for (const datum_id in data) {
@@ -31250,7 +31477,9 @@ class Editor_ extends element_1.Element {
31250
31477
  const sub_component_spec = component.subComponents[sub_component_id];
31251
31478
  const { children = [] } = sub_component_spec;
31252
31479
  const index = this._get_component_children_count(sub_component_id);
31253
- bulk_actions.push((0, C_1.makeMoveSubComponentRootAction)(sub_component_id, {}, children, index, {}, {}));
31480
+ if (children.length) {
31481
+ bulk_actions.push((0, C_1.makeMoveSubComponentRootAction)(sub_component_id, {}, children, index, {}, {}));
31482
+ }
31254
31483
  }
31255
31484
  for (const merge_id in merges) {
31256
31485
  const merge = merges[merge_id];
@@ -31419,8 +31648,8 @@ class Editor_ extends element_1.Element {
31419
31648
  const parentId = data_.parentId && this._spec_has_unit(data_.parentId)
31420
31649
  ? data_.parentId
31421
31650
  : null;
31422
- this._add_unit(data_.unitId, data_.bundle, parentId, data_.parentIndex, data_.position, data_.pinPosition, data_.layoutPosition, false);
31423
- actions.push((0, G_1.makeAddUnitAction)(data_.unitId, data_.bundle, null, null, data_.parentId, data_.parentIndex, null, null, data_.position));
31651
+ this._add_unit(data_.unitId, data_.bundle, parentId, data_.parentSlot, data_.parentIndex, data_.position, data_.pinPosition, data_.layoutPosition, false);
31652
+ actions.push((0, G_1.makeAddUnitAction)(data_.unitId, data_.bundle, null, null, data_.parentId, data_.parentSlot, data_.parentIndex, null, null, data_.position));
31424
31653
  if (emit) {
31425
31654
  const { fork, bubble } = this.$props;
31426
31655
  this._pod.$bulkEdit({ actions, fork, bubble });
@@ -31428,7 +31657,7 @@ class Editor_ extends element_1.Element {
31428
31657
  if (this._is_unit_component(data_.unitId)) {
31429
31658
  if (this._in_component_control) {
31430
31659
  const sub_component = sub_component_map === null || sub_component_map === void 0 ? void 0 : sub_component_map[data_.unitId];
31431
- this._sim_add_sub_component(data_.unitId, sub_component, undefined, undefined, true);
31660
+ this._sim_add_sub_component(data_.unitId, sub_component, undefined, true);
31432
31661
  if (sub_component) {
31433
31662
  //
31434
31663
  }
@@ -31443,10 +31672,18 @@ class Editor_ extends element_1.Element {
31443
31672
  }
31444
31673
  const children = (_a = data_.children) !== null && _a !== void 0 ? _a : [];
31445
31674
  const childrenSlot = (_b = data_.childrenSlot) !== null && _b !== void 0 ? _b : {};
31675
+ const prevParentIdMap = this._get_sub_components_parent_map(children);
31676
+ const prevSlotMap = this._get_sub_components_slot_map(children);
31446
31677
  if (this._tree_layout) {
31447
31678
  const animate = children.length > 0;
31448
- const finish = this._move_sub_component_root(data_.unitId, children, 'default', animate, () => {
31449
- this._animate_all_current_layout_layer_node();
31679
+ const finish = this._on_move_sub_component_root({
31680
+ parentId: data_.unitId,
31681
+ slotMap: childrenSlot,
31682
+ children,
31683
+ prevParentIdMap,
31684
+ prevSlotMap,
31685
+ index: 0,
31686
+ }, emit, () => {
31450
31687
  this._force_finish_last_action = undefined;
31451
31688
  });
31452
31689
  actions.push((0, C_1.makeMoveSubComponentRootAction)(data_.unitId, {}, children, 0, data_.childrenSlot, {}));
@@ -31532,7 +31769,13 @@ class Editor_ extends element_1.Element {
31532
31769
  }
31533
31770
  case C_1.MOVE_SUB_COMPONENT_ROOT:
31534
31771
  {
31535
- this._on_move_sub_component_root(data, emit);
31772
+ const finish = this._on_move_sub_component_root(data, emit, () => {
31773
+ this._force_finish_last_action = undefined;
31774
+ });
31775
+ this._force_finish_last_action = () => {
31776
+ finish();
31777
+ this._force_finish_last_action = undefined;
31778
+ };
31536
31779
  }
31537
31780
  break;
31538
31781
  case G_1.SET_UNIT_PIN_CONSTANT:
@@ -32138,15 +32381,16 @@ class Editor_ extends element_1.Element {
32138
32381
  this._search.stop_microphone();
32139
32382
  }
32140
32383
  };
32141
- this._get_sub_component_children_slot = (sub_component_id) => {
32384
+ this._spec_get_sub_component_children_slot = (sub_component_id) => {
32142
32385
  const children = this._spec_get_sub_component_children(sub_component_id);
32143
32386
  const children_slot_map = {};
32144
32387
  for (const child_id of children) {
32145
- children_slot_map[child_id] = this._get_sub_component_slot_name(child_id);
32388
+ children_slot_map[child_id] =
32389
+ this._spec_get_sub_component_slot_name(child_id);
32146
32390
  }
32147
32391
  return children_slot_map;
32148
32392
  };
32149
- this._get_sub_component_slot_name = (sub_component_id) => {
32393
+ this._spec_get_sub_component_slot_name = (sub_component_id) => {
32150
32394
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id);
32151
32395
  if (parent_id) {
32152
32396
  const parent_component_spec = this._get_sub_component_spec(parent_id);
@@ -32165,7 +32409,7 @@ class Editor_ extends element_1.Element {
32165
32409
  // sub_component_id
32166
32410
  // )
32167
32411
  if (!this._is_fullwindow) {
32168
- const slot = this._get_sub_component_slot_name(sub_component_id);
32412
+ const slot = this._spec_get_sub_component_slot_name(sub_component_id);
32169
32413
  const i = this._spec_get_sub_component_parent_root_index(sub_component_id);
32170
32414
  this.__insert_sub_component_child(parent_id, sub_component_id, slot, i);
32171
32415
  }
@@ -32177,15 +32421,6 @@ class Editor_ extends element_1.Element {
32177
32421
  parent_component.insertParentRootAt(sub_component, i, slot);
32178
32422
  }
32179
32423
  };
32180
- this._mem_push_sub_component = (parent_id, child_id, slot_name) => {
32181
- // console.log('Graph', '_mem_push_sub_component', parent_id, child_id, slot_name)
32182
- if (parent_id === null) {
32183
- this._mem_push_root(child_id);
32184
- }
32185
- else {
32186
- this._mem_push_parent_child(parent_id, child_id, slot_name);
32187
- }
32188
- };
32189
32424
  this._mem_insert_sub_component_child = (parent_id, child_id, slot_name, at) => {
32190
32425
  // console.log(
32191
32426
  // 'Graph',
@@ -32211,7 +32446,7 @@ class Editor_ extends element_1.Element {
32211
32446
  const parent_component = this._get_sub_component(parent_id);
32212
32447
  const sub_component = this._get_sub_component(sub_component_id);
32213
32448
  if (!this._is_fullwindow) {
32214
- const slot = this._get_sub_component_slot_name(sub_component_id);
32449
+ const slot = this._spec_get_sub_component_slot_name(sub_component_id);
32215
32450
  const i = this._spec_get_sub_component_parent_root_index(sub_component_id);
32216
32451
  if (parent_component.$mountParentRoot.length > i) {
32217
32452
  parent_component.domInsertParentRootAt(sub_component, i, slot);
@@ -32231,7 +32466,7 @@ class Editor_ extends element_1.Element {
32231
32466
  const parent_component = this._get_sub_component(parent_id);
32232
32467
  const sub_component = this._get_sub_component(sub_component_id);
32233
32468
  if (!this._is_fullwindow) {
32234
- const slot = this._get_sub_component_slot_name(sub_component_id);
32469
+ const slot = this._spec_get_sub_component_slot_name(sub_component_id);
32235
32470
  const i = this._spec_get_sub_component_parent_root_index(sub_component_id);
32236
32471
  if (parent_component.$mountParentRoot.length > i) {
32237
32472
  parent_component.postInsertParentRootAt(sub_component, i, slot);
@@ -33374,7 +33609,7 @@ class Editor_ extends element_1.Element {
33374
33609
  this._componentify_core = (unit_id, sub_component_map, should_add_component = true) => {
33375
33610
  // console.log('Graph', '_componentify_core', unit_id)
33376
33611
  this._set_core_shape(unit_id, 'rect');
33377
- this._spec_append_component(null, unit_id);
33612
+ this._spec_append_component(null, unit_id, 'default');
33378
33613
  this._sim_add_core_component(unit_id, null, { x: 0, y: 0 });
33379
33614
  this._mem_add_unit_component(unit_id, undefined, sub_component_map);
33380
33615
  this._mem_add_unit_component_parent(unit_id);
@@ -33430,7 +33665,7 @@ class Editor_ extends element_1.Element {
33430
33665
  const specs_ = (0, weakMerge_1.weakMerge)(specs, (_a = bundle.specs) !== null && _a !== void 0 ? _a : {});
33431
33666
  this._spec_add_unit(unitId, unit, specs_);
33432
33667
  if (this._is_unit_component(unitId)) {
33433
- this._spec_append_component(null, unitId);
33668
+ this._spec_append_component(null, unitId, 'default');
33434
33669
  }
33435
33670
  this._sim_add_unit(unitId, unit, position, {}, { input: {}, output: {} }, null);
33436
33671
  if (this._is_unit_component(unitId)) {
@@ -33520,7 +33755,7 @@ class Editor_ extends element_1.Element {
33520
33755
  // console.log('Graph', '_on_graph_unit_add_unit_moment', data, this._id)
33521
33756
  var _a, _b, _c, _d, _e, _f;
33522
33757
  const { getSpec, setSpec, injectSpecs, specs, parent } = this.$props;
33523
- let { path, unitId, bundle, merges = {}, plugs: plugss = {}, parentId, parentIndex, children = [], childrenSlot = {}, } = data;
33758
+ let { path, unitId, bundle, merges = {}, plugs: plugss = {}, parentId, parentIndex, parentSlot, children = [], childrenSlot = {}, } = data;
33524
33759
  merges = merges !== null && merges !== void 0 ? merges : {};
33525
33760
  plugss = plugss !== null && plugss !== void 0 ? plugss : {};
33526
33761
  children = children !== null && children !== void 0 ? children : [];
@@ -33554,10 +33789,15 @@ class Editor_ extends element_1.Element {
33554
33789
  (0, component_1.setSubComponent)({ unitId, subComponent: {} }, next_spec.component);
33555
33790
  if (parentId) {
33556
33791
  if (parentIndex === null || parentIndex === undefined) {
33557
- (0, component_1.appendSubComponentChild)({ parentId, childId: unitId }, next_spec.component);
33792
+ (0, component_1.appendSubComponentChild)({ parentId, childId: unitId, slotName: parentSlot }, next_spec.component);
33558
33793
  }
33559
33794
  else {
33560
- (0, component_1.insertSubComponentChild)({ parentId, childId: unitId, at: parentIndex }, next_spec.component);
33795
+ (0, component_1.insertSubComponentChild)({
33796
+ parentId,
33797
+ childId: unitId,
33798
+ slotName: parentSlot,
33799
+ at: parentIndex,
33800
+ }, next_spec.component);
33561
33801
  }
33562
33802
  }
33563
33803
  else {
@@ -34217,34 +34457,57 @@ class Editor_ extends element_1.Element {
34217
34457
  this._state_reorder_sub_component(data.childId, data.to);
34218
34458
  }
34219
34459
  };
34220
- this._on_move_sub_component_root = (data, emit = true) => {
34221
- var _a, _b, _c, _d, _e, _f, _g, _h;
34460
+ this._on_move_sub_component_root = (data, emit = true, callback) => {
34461
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
34222
34462
  const { fork, bubble } = this.$props;
34223
- if (data.parentId) {
34224
- if (this._tree_layout) {
34225
- this._move_sub_component_root(data.parentId, data.children, 'default', true);
34463
+ let unlisten;
34464
+ const prevParentId = (_a = data.prevParentIdMap[data.children[0]]) !== null && _a !== void 0 ? _a : null;
34465
+ const prevSlotName = (_b = data.prevSlotMap[data.children[0]]) !== null && _b !== void 0 ? _b : 'default';
34466
+ const parentId = data.parentId;
34467
+ const slotName = (_c = data.slotMap[data.children[0]]) !== null && _c !== void 0 ? _c : 'default';
34468
+ const children = data.children;
34469
+ if (this._tree_layout) {
34470
+ if (!data.parentId ||
34471
+ this._is_layout_component_layer_visible(data.parentId)) {
34472
+ unlisten = this._remove_sub_component_children(prevParentId, prevSlotName, parentId, slotName, children, emit, callback);
34473
+ }
34474
+ else if (data.parentId &&
34475
+ this._is_layout_parent_visible(data.parentId)) {
34476
+ unlisten = this._layout_move_sub_component_root(data.parentId, data.children, 'default', true, emit, callback);
34226
34477
  }
34227
34478
  else {
34228
34479
  let i = 0;
34229
34480
  for (const child_id of data.children) {
34230
- const slot_name = (_b = (_a = data.slotMap) === null || _a === void 0 ? void 0 : _a[child_id]) !== null && _b !== void 0 ? _b : 'default';
34231
- const prev_parent_id = (_d = (_c = data.prevParentIdMap) === null || _c === void 0 ? void 0 : _c[child_id]) !== null && _d !== void 0 ? _d : null;
34481
+ const slot_name = (_e = (_d = data.slotMap) === null || _d === void 0 ? void 0 : _d[child_id]) !== null && _e !== void 0 ? _e : 'default';
34482
+ const prev_parent_id = (_g = (_f = data.prevParentIdMap) === null || _f === void 0 ? void 0 : _f[child_id]) !== null && _g !== void 0 ? _g : null;
34483
+ if (this._is_layout_parent_visible(child_id) || !prev_parent_id) {
34484
+ this._leave_sub_component_frame(child_id);
34485
+ }
34486
+ else {
34487
+ this._decouple_sub_component(child_id);
34488
+ }
34489
+ this._pull_sub_component(child_id);
34232
34490
  this._state_pre_append_sub_component_child(data.parentId, child_id, slot_name);
34491
+ this._append_sub_component_parent_root(data.parentId, child_id);
34233
34492
  this._layout_layer_move_sub_component_child(prev_parent_id, data.parentId, child_id, data.index);
34234
34493
  }
34235
34494
  i++;
34495
+ unlisten = NOOP_1.NOOP;
34496
+ callback();
34236
34497
  }
34237
34498
  }
34238
34499
  else {
34500
+ let i = 0;
34239
34501
  for (const child_id of data.children) {
34240
- this._measure_sub_component_base(child_id);
34502
+ const slot_name = (_j = (_h = data.slotMap) === null || _h === void 0 ? void 0 : _h[child_id]) !== null && _j !== void 0 ? _j : 'default';
34503
+ const prev_parent_id = (_l = (_k = data.prevParentIdMap) === null || _k === void 0 ? void 0 : _k[child_id]) !== null && _l !== void 0 ? _l : null;
34504
+ this._pull_sub_component(child_id);
34505
+ this._state_pre_append_sub_component_child(data.parentId, child_id, slot_name);
34506
+ this._layout_layer_move_sub_component_child(prev_parent_id, data.parentId, child_id, data.index + i);
34241
34507
  }
34242
- const prevParentId = (_e = data.prevParentIdMap[data.children[0]]) !== null && _e !== void 0 ? _e : null;
34243
- const prevSlotName = (_f = data.prevSlotMap[data.children[0]]) !== null && _f !== void 0 ? _f : 'default';
34244
- const parentId = data.parentId;
34245
- const slotName = (_g = data.slotMap[data.children[0]]) !== null && _g !== void 0 ? _g : 'default';
34246
- const children = data.children;
34247
- this.remove_sub_component_children(prevParentId, prevSlotName, parentId, slotName, children, emit);
34508
+ i++;
34509
+ unlisten = NOOP_1.NOOP;
34510
+ callback();
34248
34511
  }
34249
34512
  emit &&
34250
34513
  this._pod.$moveSubComponentRoot({
@@ -34252,13 +34515,14 @@ class Editor_ extends element_1.Element {
34252
34515
  prevSlotMap: data.prevSlotMap,
34253
34516
  parentId: data.parentId,
34254
34517
  children: data.children,
34255
- slotMap: (_h = data.slotMap) !== null && _h !== void 0 ? _h : {},
34518
+ slotMap: (_m = data.slotMap) !== null && _m !== void 0 ? _m : {},
34256
34519
  index: data.index,
34257
34520
  fork,
34258
34521
  bubble,
34259
34522
  });
34260
34523
  this._refresh_layout_node_target_position(null);
34261
34524
  this._animate_all_current_layout_layer_node();
34525
+ return unlisten;
34262
34526
  };
34263
34527
  this._on_set_unit_pin_constant = (data) => {
34264
34528
  // console.log('Graph', '_on_set_unit_pin_constant', data)
@@ -36216,19 +36480,18 @@ class Editor_ extends element_1.Element {
36216
36480
  height: max_height,
36217
36481
  };
36218
36482
  }
36219
- _add_unit(unit_id, bundle, parent_id, parent_index, position, pin_position = {
36483
+ _add_unit(unit_id, bundle, parent_id, parent_slot, parent_index, position, pin_position = {
36220
36484
  input: {},
36221
36485
  output: {},
36222
36486
  }, layout_position, emit = true) {
36223
36487
  // console.trace('Graph', '_add_unit')
36224
- this._state_add_unit(unit_id, bundle, parent_id, parent_index, position, pin_position, layout_position);
36488
+ this._state_add_unit(unit_id, bundle, parent_id, parent_slot, parent_index, position, pin_position, layout_position);
36225
36489
  emit && this._pod_add_unit(unit_id, bundle);
36226
36490
  }
36227
- _state_add_unit(unit_id, bundle, sub_component_parent_id, sub_component_index, position, pin_position = {
36491
+ _state_add_unit(unit_id, bundle, sub_component_parent_id, sub_component_parent_slot_name, sub_component_parent_index, position, pin_position = {
36228
36492
  input: {},
36229
36493
  output: {},
36230
36494
  }, sub_component_layout_position, size = {}, register = true, deep = true) {
36231
- // console.trace('Graph', '_add_unit')
36232
36495
  var _a;
36233
36496
  const { specs, injectSpecs } = this.$props;
36234
36497
  const id_map = injectSpecs((_a = bundle.specs) !== null && _a !== void 0 ? _a : {});
@@ -36238,17 +36501,17 @@ class Editor_ extends element_1.Element {
36238
36501
  this._spec_add_unit(unit_id, unit, specs, register, deep);
36239
36502
  const is_component = this._is_unit_component(unit_id);
36240
36503
  if (is_component) {
36241
- if (sub_component_index === undefined) {
36242
- this._spec_append_component(sub_component_parent_id, unit_id);
36504
+ if (sub_component_parent_index === undefined) {
36505
+ this._spec_append_component(sub_component_parent_id, unit_id, sub_component_parent_slot_name);
36243
36506
  }
36244
36507
  else {
36245
- this._spec_insert_component(sub_component_parent_id, unit_id, sub_component_index);
36508
+ this._spec_insert_component(sub_component_parent_id, unit_id, sub_component_parent_slot_name, sub_component_parent_index);
36246
36509
  }
36247
36510
  }
36248
36511
  if (is_component) {
36249
36512
  if (sub_component_parent_id) {
36250
36513
  this._mem_add_unit_component(unit_id);
36251
- this._mem_insert_sub_component_child(sub_component_parent_id, unit_id, 'default', sub_component_index);
36514
+ this._mem_insert_sub_component_child(sub_component_parent_id, unit_id, 'default', sub_component_parent_index);
36252
36515
  }
36253
36516
  }
36254
36517
  this._sim_add_unit(unit_id, unit, position, size, pin_position, sub_component_parent_id, sub_component_layout_position);
@@ -36259,10 +36522,11 @@ class Editor_ extends element_1.Element {
36259
36522
  output: {},
36260
36523
  }, layout_position) {
36261
36524
  const parent_index = parent_id
36262
- ? this._get_component_children_count(unit_id)
36525
+ ? this._get_component_children_count(parent_id)
36263
36526
  : this._spec_get_component_children_count();
36264
- this._dispatch_action((0, G_1.makeAddUnitAction)(unit_id, (0, clone_1.clone)(bundle), null, null, parent_id, parent_index, null, null, position, pin_position, layout_position));
36265
- this._add_unit(unit_id, bundle, parent_id, null, position, pin_position, layout_position);
36527
+ const parent_slot = 'default';
36528
+ this._dispatch_action((0, G_1.makeAddUnitAction)(unit_id, (0, clone_1.clone)(bundle), null, null, parent_id, parent_slot, parent_index, null, null, position, pin_position, layout_position));
36529
+ this._add_unit(unit_id, bundle, parent_id, null, null, position, pin_position, layout_position);
36266
36530
  }
36267
36531
  _enter_all_sub_component_frame() {
36268
36532
  for (const sub_component_id in this._component.$subComponent) {
@@ -36284,7 +36548,7 @@ class Editor_ extends element_1.Element {
36284
36548
  const sub_component = this._get_sub_component(unit_id);
36285
36549
  sub_component.compose();
36286
36550
  }
36287
- _spec_insert_component(parent_id, unit_id, at) {
36551
+ _spec_insert_component(parent_id, unit_id, slot_name, at) {
36288
36552
  var _a;
36289
36553
  this._spec.component = this._spec.component || { subComponents: {} };
36290
36554
  const current_sub_component_spec = (_a = this._get_sub_component_spec(unit_id)) !== null && _a !== void 0 ? _a : {};
@@ -36293,7 +36557,7 @@ class Editor_ extends element_1.Element {
36293
36557
  subComponent: { ...current_sub_component_spec },
36294
36558
  }, this._spec.component);
36295
36559
  if (parent_id) {
36296
- (0, component_1.insertSubComponentChild)({ parentId: parent_id, childId: unit_id, at }, this._spec.component);
36560
+ (0, component_1.insertSubComponentChild)({ parentId: parent_id, childId: unit_id, slotName: slot_name, at }, this._spec.component);
36297
36561
  }
36298
36562
  else {
36299
36563
  (0, component_1.insertRoot)({ childId: unit_id, at }, this._spec.component);
@@ -36818,6 +37082,8 @@ class Editor_ extends element_1.Element {
36818
37082
  const parent_layer = this._get_layout_layer(parent_id);
36819
37083
  const scroll_top = parent_layer.content.$element.scrollTop;
36820
37084
  const finish = () => {
37085
+ this._cancel_parent_animation(sub_component_id);
37086
+ this._cancel_sub_component_base_animation(sub_component_id);
36821
37087
  stop_parent_animation();
36822
37088
  stop_children_animation();
36823
37089
  this._unplug_sub_component_root_base_frame(sub_component_id);
@@ -36825,6 +37091,7 @@ class Editor_ extends element_1.Element {
36825
37091
  this._append_sub_component_root_base(sub_component_id);
36826
37092
  this._end_layout_sub_component_transfer_children_animation(sub_component_id, 'default');
36827
37093
  for (const child_id of children) {
37094
+ this._cancel_layout_child_transfer_animation(child_id);
36828
37095
  this._enter_sub_component_frame(child_id);
36829
37096
  this._append_sub_component_base(child_id);
36830
37097
  }
@@ -36835,7 +37102,7 @@ class Editor_ extends element_1.Element {
36835
37102
  this._measure_sub_component_base(child_id);
36836
37103
  }
36837
37104
  for (const child_id of children) {
36838
- if (!this._animating_sub_component_base_id.has(child_id)) {
37105
+ if (!this._is_sub_component_animating(child_id)) {
36839
37106
  this._remove_sub_component_parent_root(sub_component_id, child_id);
36840
37107
  this._remove_sub_component_root_base(child_id);
36841
37108
  }
@@ -37345,7 +37612,7 @@ class Editor_ extends element_1.Element {
37345
37612
  const target_position = this._get_node_position(target_node_id);
37346
37613
  const position = (0, geometry_1.mediumPoint)(source_position, target_position);
37347
37614
  const layout_position = this._screen_center();
37348
- this._add_unit(new_unit_id, bundle, null, null, position, undefined, layout_position);
37615
+ this._add_unit(new_unit_id, bundle, null, null, null, position, undefined, layout_position);
37349
37616
  const new_unit_source_pin_id = (0, id_1.getPinNodeId)(new_unit_id, 'input', 'a');
37350
37617
  const new_unit_target_pin_id = (0, id_1.getPinNodeId)(new_unit_id, 'output', 'a');
37351
37618
  const new_source_merge_id = this._merge_pin_pin(new_unit_source_pin_id, source_node_id);