@_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
@@ -555,7 +555,6 @@ import {
555
555
  import {
556
556
  getSubComponentChildren,
557
557
  getSubComponentParentId,
558
- getSubComponentParentIndex,
559
558
  getSubComponentParentRootIndex,
560
559
  getSubComponentRootIndex,
561
560
  getSubComponentSpec,
@@ -687,6 +686,7 @@ import { randomIdNotIn } from '../../../../../util/id'
687
686
  import {
688
687
  deepDec,
689
688
  deepDelete,
689
+ deepDestroy,
690
690
  deepGet,
691
691
  deepGetOrDefault,
692
692
  deepInc,
@@ -2919,10 +2919,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
2919
2919
  private _search_start_unit_plugs: GraphUnitPlugs = {}
2920
2920
  private _search_start_unit_data: IOOf<Dict<TreeNode>> = {}
2921
2921
  private _search_start_unit_parent_id: string | null = null
2922
- private _search_start_unit_index: number | null = null
2922
+ private _search_start_unit_parent_slot_name: string | null = null
2923
+ private _search_start_unit_parent_index: number | null = null
2923
2924
  private _search_start_graph_unit_spec: GraphUnitSpec | null = null
2924
-
2925
- private _search_start_component_index: number | null = null
2925
+ private _search_start_unit_children: string[] = []
2926
+ private _search_start_unit_children_slot_map: Dict<string> = {}
2926
2927
 
2927
2928
  private _search_unit_id: string | null = null
2928
2929
  private _search_unit_spec_id: string | null = null
@@ -3045,7 +3046,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
3045
3046
 
3046
3047
  private _animating_enter_fullwindow = false
3047
3048
  private _animating_sub_component_fullwindow: Set<string> = new Set()
3048
- private _animating_sub_component_base_id: Set<string> = new Set()
3049
+
3050
+ private _animating_sub_component_transfer: Set<string> = new Set()
3049
3051
 
3050
3052
  private _abort_sub_component_enter_base_animation: Dict<Unlisten> = {}
3051
3053
  private _abort_sub_component_leave_base_animation: Dict<Unlisten> = {}
@@ -3808,6 +3810,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
3808
3810
  bundle,
3809
3811
  null,
3810
3812
  null,
3813
+ null,
3811
3814
  position,
3812
3815
  {},
3813
3816
  center_of_screen
@@ -3818,7 +3821,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
3818
3821
  undefined,
3819
3822
  undefined,
3820
3823
  undefined,
3821
- undefined,
3822
3824
  image
3823
3825
  )
3824
3826
 
@@ -3877,6 +3879,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
3877
3879
  bundle,
3878
3880
  null,
3879
3881
  null,
3882
+ null,
3880
3883
  position,
3881
3884
  {},
3882
3885
  center_of_screen
@@ -3955,6 +3958,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
3955
3958
  bundle,
3956
3959
  null,
3957
3960
  null,
3961
+ null,
3958
3962
  position,
3959
3963
  {},
3960
3964
  center_of_screen
@@ -3965,7 +3969,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
3965
3969
  undefined,
3966
3970
  {},
3967
3971
  undefined,
3968
- undefined,
3969
3972
  element
3970
3973
  )
3971
3974
 
@@ -6017,6 +6020,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6017
6020
  unit_id: string,
6018
6021
  bundle: UnitBundleSpec,
6019
6022
  parent_id: string | null,
6023
+ parent_slot: string | null,
6020
6024
  parent_index: number | null,
6021
6025
  position: Position,
6022
6026
  pin_position: UnitPinPosition = {
@@ -6032,6 +6036,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6032
6036
  unit_id,
6033
6037
  bundle,
6034
6038
  parent_id,
6039
+ parent_slot,
6035
6040
  parent_index,
6036
6041
  position,
6037
6042
  pin_position,
@@ -6045,7 +6050,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6045
6050
  unit_id: string,
6046
6051
  bundle: UnitBundleSpec,
6047
6052
  sub_component_parent_id: string | null,
6048
- sub_component_index: number | null,
6053
+ sub_component_parent_slot_name: string | null,
6054
+ sub_component_parent_index: number | null,
6049
6055
  position: Position,
6050
6056
  pin_position: UnitPinPosition = {
6051
6057
  input: {},
@@ -6056,8 +6062,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6056
6062
  register: boolean = true,
6057
6063
  deep: boolean = true
6058
6064
  ): void {
6059
- // console.trace('Graph', '_add_unit')
6060
-
6061
6065
  const { specs, injectSpecs } = this.$props
6062
6066
 
6063
6067
  const id_map = injectSpecs(bundle.specs ?? {})
@@ -6073,13 +6077,18 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6073
6077
  const is_component = this._is_unit_component(unit_id)
6074
6078
 
6075
6079
  if (is_component) {
6076
- if (sub_component_index === undefined) {
6077
- this._spec_append_component(sub_component_parent_id, unit_id)
6080
+ if (sub_component_parent_index === undefined) {
6081
+ this._spec_append_component(
6082
+ sub_component_parent_id,
6083
+ unit_id,
6084
+ sub_component_parent_slot_name
6085
+ )
6078
6086
  } else {
6079
6087
  this._spec_insert_component(
6080
6088
  sub_component_parent_id,
6081
6089
  unit_id,
6082
- sub_component_index
6090
+ sub_component_parent_slot_name,
6091
+ sub_component_parent_index
6083
6092
  )
6084
6093
  }
6085
6094
  }
@@ -6091,7 +6100,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6091
6100
  sub_component_parent_id,
6092
6101
  unit_id,
6093
6102
  'default',
6094
- sub_component_index
6103
+ sub_component_parent_index
6095
6104
  )
6096
6105
  }
6097
6106
  }
@@ -6121,9 +6130,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6121
6130
  layout_position: Position
6122
6131
  ): void {
6123
6132
  const parent_index = parent_id
6124
- ? this._get_component_children_count(unit_id)
6133
+ ? this._get_component_children_count(parent_id)
6125
6134
  : this._spec_get_component_children_count()
6126
6135
 
6136
+ const parent_slot = 'default'
6137
+
6127
6138
  this._dispatch_action(
6128
6139
  makeAddUnitAction(
6129
6140
  unit_id,
@@ -6131,6 +6142,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6131
6142
  null,
6132
6143
  null,
6133
6144
  parent_id,
6145
+ parent_slot,
6134
6146
  parent_index,
6135
6147
  null,
6136
6148
  null,
@@ -6145,16 +6157,17 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6145
6157
  bundle,
6146
6158
  parent_id,
6147
6159
  null,
6160
+ null,
6148
6161
  position,
6149
6162
  pin_position,
6150
6163
  layout_position
6151
6164
  )
6152
6165
  }
6153
6166
 
6154
- private _dispatch_add_unit_action = (
6167
+ private _make_add_unit_action = (
6155
6168
  unit_id: string,
6156
6169
  unit: GraphUnitSpec
6157
- ): void => {
6170
+ ): Action => {
6158
6171
  const position = this._get_node_position(unit_id)
6159
6172
  const pin_position = this._get_unit_pin_position(unit_id)
6160
6173
  const is_component = this._is_unit_component(unit_id)
@@ -6165,73 +6178,35 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6165
6178
  const layout_parent_id = is_component
6166
6179
  ? this._spec_get_sub_component_parent_id(unit_id)
6167
6180
  : null
6181
+ const layout_slot = is_component
6182
+ ? this._spec_get_sub_component_slot_name(unit_id)
6183
+ : null
6168
6184
  const layout_index = is_component
6169
- ? this._get_sub_component_index(unit_id)
6185
+ ? this._spec_get_sub_component_index(unit_id)
6170
6186
  : null
6171
6187
  const layout_children = is_component
6172
6188
  ? this._spec_get_sub_component_children(unit_id)
6173
6189
  : null
6174
6190
  const layout_children_slot = is_component
6175
- ? this._get_sub_component_children_slot(unit_id)
6191
+ ? this._spec_get_sub_component_children_slot(unit_id)
6176
6192
  : null
6177
6193
 
6178
6194
  const bundle = clone({ unit })
6179
6195
 
6180
- this._dispatch_action(
6181
- makeAddUnitAction(
6182
- unit_id,
6183
- bundle,
6184
- {},
6185
- {},
6186
- layout_parent_id,
6187
- layout_index,
6188
- layout_children,
6189
- layout_children_slot,
6190
- position,
6191
- pin_position,
6192
- layout_position
6193
- )
6194
- )
6195
- }
6196
-
6197
- private _dispatch_swap_unit_action = (
6198
- unit_id: string,
6199
- unit_bundle: UnitBundleSpec,
6200
- unit_merges: GraphUnitMerges,
6201
- unit_plugs: GraphUnitPlugs,
6202
- unit_parent_id: string | null,
6203
- unit_index: number | null,
6204
- unit_children: string[],
6205
- unit_children_slot: Dict<string>,
6206
- new_unit_id: string,
6207
- new_unit_bundle: UnitBundleSpec,
6208
- new_unit_merges: GraphUnitMerges,
6209
- new_unit_plugs: GraphUnitPlugs,
6210
- new_unit_parent_id: string | null,
6211
- new_unit_index: number | null,
6212
- new_unit_children: string[],
6213
- new_unit_children_slot: Dict<string>
6214
- ) => {
6215
- const action = this._make_swap_unit_action(
6196
+ return makeAddUnitAction(
6216
6197
  unit_id,
6217
- unit_bundle,
6218
- unit_merges,
6219
- unit_plugs,
6220
- unit_parent_id,
6221
- unit_index,
6222
- unit_children,
6223
- unit_children_slot,
6224
- new_unit_id,
6225
- new_unit_bundle,
6226
- new_unit_merges,
6227
- new_unit_plugs,
6228
- new_unit_parent_id,
6229
- new_unit_index,
6230
- new_unit_children,
6231
- new_unit_children_slot
6198
+ bundle,
6199
+ {},
6200
+ {},
6201
+ layout_parent_id,
6202
+ layout_slot,
6203
+ layout_index,
6204
+ layout_children,
6205
+ layout_children_slot,
6206
+ position,
6207
+ pin_position,
6208
+ layout_position
6232
6209
  )
6233
-
6234
- this._dispatch_action(action)
6235
6210
  }
6236
6211
 
6237
6212
  private _make_swap_unit_action = (
@@ -6240,6 +6215,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6240
6215
  unit_merges: GraphUnitMerges,
6241
6216
  unit_plugs: GraphUnitPlugs,
6242
6217
  unit_parent_id: string | null,
6218
+ unit_parent_slot: string | null,
6243
6219
  unit_index: number | null,
6244
6220
  unit_children: string[],
6245
6221
  unit_children_slot: Dict<string>,
@@ -6248,6 +6224,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6248
6224
  new_unit_merges: GraphUnitMerges,
6249
6225
  new_unit_plugs: GraphUnitPlugs,
6250
6226
  new_unit_parent_id: string | null,
6227
+ new_unit_parent_slot: string | null,
6251
6228
  new_unit_index: number | null,
6252
6229
  new_unit_children: string[],
6253
6230
  new_unit_children_slot: Dict<string>
@@ -6258,6 +6235,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6258
6235
  unit_merges,
6259
6236
  unit_plugs,
6260
6237
  unit_parent_id,
6238
+ unit_parent_slot,
6261
6239
  unit_index,
6262
6240
  unit_children,
6263
6241
  unit_children_slot,
@@ -6271,6 +6249,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6271
6249
  new_unit_merges,
6272
6250
  new_unit_plugs,
6273
6251
  new_unit_parent_id,
6252
+ new_unit_parent_slot,
6274
6253
  new_unit_index,
6275
6254
  new_unit_children,
6276
6255
  new_unit_children_slot,
@@ -6324,14 +6303,17 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6324
6303
  const layout_parent_id = is_component
6325
6304
  ? this._spec_get_sub_component_parent_id(unit_id)
6326
6305
  : null
6306
+ const layout_slot = is_component
6307
+ ? this._spec_get_sub_component_slot_name(unit_id)
6308
+ : null
6327
6309
  const layout_index = is_component
6328
- ? this._get_sub_component_index(unit_id)
6310
+ ? this._spec_get_sub_component_index(unit_id)
6329
6311
  : null
6330
6312
  const layout_children = is_component
6331
6313
  ? this._spec_get_sub_component_children(unit_id)
6332
6314
  : null
6333
6315
  const layout_children_slot = is_component
6334
- ? this._get_sub_component_children_slot(unit_id)
6316
+ ? this._spec_get_sub_component_children_slot(unit_id)
6335
6317
  : null
6336
6318
 
6337
6319
  return clone(
@@ -6341,6 +6323,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6341
6323
  includeMerges ? merges : undefined,
6342
6324
  includePlugs ? plugs : undefined,
6343
6325
  layout_parent_id,
6326
+ layout_slot,
6344
6327
  layout_index,
6345
6328
  layout_children,
6346
6329
  layout_children_slot,
@@ -6403,6 +6386,14 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6403
6386
  return getSubComponentChildren(this._spec, sub_component_id)
6404
6387
  }
6405
6388
 
6389
+ private _spec_get_sub_component_children_count = (
6390
+ sub_component_id: string
6391
+ ): number => {
6392
+ const children = this._spec_get_sub_component_children(sub_component_id)
6393
+
6394
+ return children.length
6395
+ }
6396
+
6406
6397
  private _decompose_sub_component(
6407
6398
  unit_id: string,
6408
6399
  deep: boolean = true
@@ -6454,6 +6445,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6454
6445
  private _spec_append_component = (
6455
6446
  parent_id: string | null,
6456
6447
  unit_id: string,
6448
+ slot_name: string | null,
6457
6449
  sub_component_spec: GraphSubComponentSpec = { children: [] }
6458
6450
  ): void => {
6459
6451
  // console.log('Graph', '_spec_append_component', parent_id, id)
@@ -6467,7 +6459,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6467
6459
 
6468
6460
  if (parent_id) {
6469
6461
  appendSubComponentChild(
6470
- { parentId: parent_id, childId: unit_id },
6462
+ { parentId: parent_id, childId: unit_id, slotName: slot_name },
6471
6463
  this._spec.component
6472
6464
  )
6473
6465
  } else {
@@ -6484,6 +6476,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6484
6476
  private _spec_insert_component(
6485
6477
  parent_id: string | null,
6486
6478
  unit_id: string,
6479
+ slot_name: string,
6487
6480
  at: number
6488
6481
  ) {
6489
6482
  this._spec.component = this._spec.component || { subComponents: {} }
@@ -6501,7 +6494,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
6501
6494
 
6502
6495
  if (parent_id) {
6503
6496
  insertSubComponentChild(
6504
- { parentId: parent_id, childId: unit_id, at },
6497
+ { parentId: parent_id, childId: unit_id, slotName: slot_name, at },
6505
6498
  this._spec.component
6506
6499
  )
6507
6500
  } else {
@@ -7051,8 +7044,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
7051
7044
  position: Position | undefined,
7052
7045
  init_size: { width?: number; height?: number } = {}
7053
7046
  ): void => {
7054
- // console.log('Graph', '_sim_add_core', unit_id, unit, position)
7055
-
7056
7047
  const { classes } = this.$system
7057
7048
 
7058
7049
  const { config, specs, getSpec } = this.$props
@@ -7777,11 +7768,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
7777
7768
 
7778
7769
  this._listen_layout_core(unit_id, layout_core)
7779
7770
 
7771
+ this._move_core_content_graph_to_layout(unit_id)
7772
+
7780
7773
  if (parent_id && !this._layout_path.includes(parent_id)) {
7781
7774
  //
7782
7775
  } else {
7783
- this._move_core_content_graph_to_layout(unit_id)
7784
-
7785
7776
  this._show_layout_core(unit_id)
7786
7777
  }
7787
7778
  }
@@ -8118,7 +8109,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
8118
8109
  unit_id: string,
8119
8110
  sub_component?: Component,
8120
8111
  sub_sub_component_map: Dict<Component> = {},
8121
- at?: number,
8122
8112
  add_to_parent: boolean = true,
8123
8113
  element: IOElement = undefined
8124
8114
  ): void => {
@@ -8127,7 +8117,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
8127
8117
  // '_sim_add_unit_component',
8128
8118
  // unit_id,
8129
8119
  // sub_component_map,
8130
- // at,
8131
8120
  // add_to_parent
8132
8121
  // )
8133
8122
 
@@ -8139,20 +8128,17 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
8139
8128
  )
8140
8129
 
8141
8130
  if (add_to_parent) {
8142
- this._sim_add_sub_component_to_parent(unit_id, at)
8131
+ this._sim_add_sub_component_to_parent(unit_id)
8143
8132
  }
8144
8133
  }
8145
8134
 
8146
- private _sim_add_sub_component_to_parent = (
8147
- unit_id: string,
8148
- at?: number
8149
- ): void => {
8135
+ private _sim_add_sub_component_to_parent = (unit_id: string): void => {
8150
8136
  // console.log('Graph', '_sim_add_sub_component_to_parent', unit_id)
8151
8137
 
8152
8138
  this._mem_add_unit_component_parent(unit_id)
8153
8139
 
8154
8140
  if (this._in_component_control) {
8155
- this._place_sub_component(unit_id, at)
8141
+ this._place_sub_component(unit_id)
8156
8142
  }
8157
8143
  }
8158
8144
 
@@ -8249,9 +8235,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
8249
8235
 
8250
8236
  if (!parent.$parentRoot.includes(sub_component)) {
8251
8237
  parent.pushParentRoot(sub_component, 'default')
8252
- }
8253
8238
 
8254
- this._mem_layout_push_parent_root(parent_id, unit_id, 'default')
8239
+ this._mem_layout_push_parent_root(parent_id, unit_id, 'default')
8240
+ }
8255
8241
  } else {
8256
8242
  if (!this._component.$root.includes(sub_component)) {
8257
8243
  this._component.pushRoot(sub_component)
@@ -8608,7 +8594,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
8608
8594
  merged_pin_ids,
8609
8595
  merge_pin_index,
8610
8596
  exposed_pin_ids,
8611
- exposed_pin_index
8597
+ exposed_pin_index,
8598
+ null,
8599
+ null,
8600
+ null,
8601
+ null,
8602
+ null
8612
8603
  )
8613
8604
 
8614
8605
  forIOObjKV(unit_data, (type, pin_id, pin_data) => {
@@ -10133,7 +10124,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10133
10124
  ref: {},
10134
10125
  },
10135
10126
  },
10136
- next_sub_component_index?: number
10127
+ next_sub_component_parent_id: string,
10128
+ next_sub_component_parent_slot_name: string,
10129
+ next_sub_component_parent_index: number,
10130
+ next_sub_component_children: string[],
10131
+ next_sub_component_children_slot_map: Dict<string>
10137
10132
  ): {
10138
10133
  next_swap_merges: GraphMergesSpec
10139
10134
  next_ref_merge_id: string | null
@@ -10145,10 +10140,19 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10145
10140
  next_merged_pin_index: IOOf<{ data: Dict<number>; ref: Dict<number> }>
10146
10141
  next_exposed_pin_index: IOOf<{ data: Dict<number>; ref: Dict<number> }>
10147
10142
  } => {
10148
- // console.log('Graph', '_sim_swap_unit', {
10149
- // merged_pin_ids,
10143
+ // console.log('Graph', '_state_swap_unit', {
10144
+ // unit_id,
10145
+ // new_unit_id,
10146
+ // new_unit_spec,
10150
10147
  // valid_pin_matches,
10148
+ // merged_pin_ids,
10151
10149
  // exposed_pin_ids,
10150
+ // exposed_pin_index,
10151
+ // next_sub_component_parent_id,
10152
+ // next_sub_component_parent_index,
10153
+ // next_sub_component_parent_slot_name,
10154
+ // next_sub_component_children,
10155
+ // next_sub_component_children_slot_map,
10152
10156
  // })
10153
10157
 
10154
10158
  const { specs } = this.$props
@@ -10181,14 +10185,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10181
10185
 
10182
10186
  const { inputs: unit_inputs = {}, outputs: unit_outputs = {} } = unit_spec
10183
10187
 
10184
- const is_component = this._is_unit_component(unit_id)
10185
-
10186
- let component_index: number
10187
-
10188
- if (is_component) {
10189
- component_index = this._get_sub_component_index(unit_id)
10190
- }
10191
-
10192
10188
  const pin_bag = {
10193
10189
  input: clone(unit_inputs),
10194
10190
  output: clone(unit_outputs),
@@ -10421,6 +10417,22 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10421
10417
  (is_unit_component && this._spec_get_sub_component_parent_id(unit_id)) ||
10422
10418
  null
10423
10419
 
10420
+ const unit_parent_index =
10421
+ (is_unit_component && this._spec_get_sub_component_index(unit_id)) || null
10422
+
10423
+ const unit_parent_slot_name =
10424
+ (is_unit_component && this._spec_get_sub_component_slot_name(unit_id)) ||
10425
+ null
10426
+
10427
+ const unit_children =
10428
+ (is_unit_component && this._spec_get_sub_component_children(unit_id)) ||
10429
+ null
10430
+
10431
+ const unit_children_slot_map =
10432
+ (is_unit_component &&
10433
+ this._spec_get_sub_component_children_slot(unit_id)) ||
10434
+ null
10435
+
10424
10436
  const is_swap_unit_component = isComponentSpec(new_unit_spec)
10425
10437
 
10426
10438
  if (is_unit_component && this._search_unit_id !== unit_id) {
@@ -10454,15 +10466,27 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10454
10466
  )
10455
10467
  }
10456
10468
 
10457
- let next_sub_component_parent_id =
10458
- (is_swap_unit_component && unit_parent_id) || null
10469
+ next_sub_component_parent_id =
10470
+ next_sub_component_parent_id ??
10471
+ ((is_swap_unit_component && unit_parent_id) || null)
10459
10472
 
10460
- let next_sub_component_parent_index =
10461
- (is_unit_component &&
10462
- is_swap_unit_component &&
10463
- this._get_sub_component_index(unit_id)) ??
10473
+ next_sub_component_parent_index =
10474
+ next_sub_component_parent_index ??
10475
+ (is_unit_component && is_swap_unit_component && unit_parent_index) ??
10464
10476
  null
10465
10477
 
10478
+ next_sub_component_parent_slot_name =
10479
+ next_sub_component_parent_slot_name ??
10480
+ ((is_swap_unit_component && unit_parent_slot_name) || null)
10481
+
10482
+ next_sub_component_children =
10483
+ next_sub_component_children ??
10484
+ ((is_swap_unit_component && unit_children) || [])
10485
+
10486
+ next_sub_component_children_slot_map =
10487
+ next_sub_component_children_slot_map ??
10488
+ ((is_swap_unit_component && unit_children_slot_map) || {})
10489
+
10466
10490
  const bundle = unitBundleSpec(graph_unit_spec, specs)
10467
10491
 
10468
10492
  const should_unregister =
@@ -10474,6 +10498,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10474
10498
  new_unit_id,
10475
10499
  bundle,
10476
10500
  next_sub_component_parent_id,
10501
+ next_sub_component_parent_slot_name,
10477
10502
  next_sub_component_parent_index,
10478
10503
  position,
10479
10504
  new_unit_pin_position,
@@ -10482,19 +10507,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
10482
10507
  should_unregister
10483
10508
  )
10484
10509
 
10485
- if (
10486
- this._is_unit_component(new_unit_id) &&
10487
- this._search_unit_id !== unit_id
10488
- ) {
10489
- this._sim_add_sub_component(
10490
- new_unit_id,
10491
- undefined,
10492
- {},
10493
- next_sub_component_index,
10494
- true
10495
- )
10510
+ if (this._is_unit_component(new_unit_id)) {
10511
+ if (this._search_unit_id !== unit_id) {
10512
+ this._sim_add_sub_component(new_unit_id, undefined, {}, true)
10496
10513
 
10497
- this._refresh_layout_node_target_position(unit_parent_id)
10514
+ this._refresh_layout_node_target_position(unit_parent_id)
10515
+ }
10498
10516
  }
10499
10517
 
10500
10518
  const replace_exposed = (kind: IO, tag: 'ref' | 'data'): void => {
@@ -16733,8 +16751,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
16733
16751
  }
16734
16752
  }
16735
16753
 
16736
- private _state_swap_search_unit = (id: string, next_unit_id?: string) => {
16737
- if (this._search_start_spec_id !== id) {
16754
+ private _state_swap_search_unit = (
16755
+ unit_id: string,
16756
+ next_unit_id?: string
16757
+ ) => {
16758
+ if (this._search_start_spec_id !== unit_id) {
16738
16759
  this._search_unit_spec_id_changed = true
16739
16760
  }
16740
16761
 
@@ -16743,11 +16764,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
16743
16764
  this._mode === 'multiselect' ||
16744
16765
  this._mode === 'remove'
16745
16766
  ) {
16746
- this._state_swap_add_search_unit(id)
16767
+ this._state_swap_add_search_unit(unit_id)
16747
16768
  } else if (this._mode === 'change') {
16748
- this._state_swap_change_search_unit(id, next_unit_id)
16769
+ this._state_swap_change_search_unit(unit_id, next_unit_id)
16749
16770
  } else if (this._mode === 'data') {
16750
- this._state_swap_data_search_unit(id)
16771
+ this._state_swap_data_search_unit(unit_id)
16751
16772
  }
16752
16773
  }
16753
16774
 
@@ -16887,7 +16908,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
16887
16908
  this._search_unit_merged_pin_index,
16888
16909
  this._search_unit_exposed_pin_ids,
16889
16910
  this._search_unit_exposed_pin_index,
16890
- this._search_start_component_index
16911
+ this._search_start_unit_parent_id,
16912
+ this._search_start_unit_parent_slot_name,
16913
+ this._search_start_unit_parent_index,
16914
+ this._search_start_unit_children,
16915
+ this._search_start_unit_children_slot_map
16891
16916
  )
16892
16917
 
16893
16918
  this._search_unit_id = new_unit_id
@@ -17140,9 +17165,13 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17140
17165
  const is_component = this._is_unit_component(unit_id)
17141
17166
 
17142
17167
  if (is_component) {
17143
- parent_id = this._get_sub_component_target_parent_id()
17168
+ if (this._mode === 'change') {
17169
+ parent_id = this._search_start_unit_parent_id
17170
+ } else {
17171
+ parent_id = this._get_sub_component_target_parent_id()
17172
+ }
17144
17173
 
17145
- this._spec_append_component(parent_id, unit_id)
17174
+ this._spec_append_component(parent_id, unit_id, 'default')
17146
17175
  }
17147
17176
 
17148
17177
  this._sim_add_unit(
@@ -17773,10 +17802,16 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17773
17802
  const search_start_unit_merges = this._search_start_unit_merges
17774
17803
  const search_start_unit_plugs = this._search_start_unit_plugs
17775
17804
  const search_start_unit_parent_id = this._search_start_unit_parent_id
17776
- const search_start_unit_index = this._search_start_unit_index
17805
+ const search_start_unit_parent_slot_name =
17806
+ this._search_start_unit_parent_slot_name
17807
+ const search_start_unit_parent_index = this._search_start_unit_parent_index
17808
+ const search_start_unit_children = this._search_start_unit_children
17809
+ const search_start_unit_children_slot_map =
17810
+ this._search_start_unit_children_slot_map
17777
17811
 
17778
17812
  const search_unit_id = this._search_unit_id
17779
- // const search_spec_id = this._search_unit_spec_id
17813
+
17814
+ const actions: Action[] = []
17780
17815
 
17781
17816
  if (search_unit_id) {
17782
17817
  this._refresh_unit_layer(search_unit_id)
@@ -17818,7 +17853,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17818
17853
  parent_id = this._get_current_layout_layer_id()
17819
17854
  }
17820
17855
 
17821
- const actions: Action[] = [
17856
+ actions.push(
17822
17857
  makeAddUnitAction(
17823
17858
  search_unit_id,
17824
17859
  search_unit_bundle,
@@ -17831,22 +17866,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17831
17866
  null,
17832
17867
  null,
17833
17868
  null
17834
- ),
17835
- ]
17836
-
17837
- const bulk_action = makeBulkEditAction(actions)
17838
-
17839
- this._dispatch_action(bulk_action)
17840
-
17841
- this._pod.$bulkEdit({ actions, fork, bubble })
17842
-
17843
- this._download_pod_data()
17869
+ )
17870
+ )
17844
17871
 
17845
17872
  should_add_component = true
17846
17873
  } else if (this._mode === 'change') {
17847
17874
  if (this._search_start_unit_id) {
17848
- const is_component = isComponentId(specs, search_start_spec_id)
17849
-
17850
17875
  const search_start_unit_bundle = unitBundleSpec(
17851
17876
  this._search_start_graph_unit_spec,
17852
17877
  specs
@@ -17859,33 +17884,30 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17859
17884
  this._get_unit_plugs(search_unit_id)
17860
17885
  )
17861
17886
 
17862
- this._dispatch_swap_unit_action(
17863
- search_start_unit_id,
17864
- search_start_unit_bundle,
17865
- search_start_unit_merges,
17866
- search_start_unit_plugs,
17867
- search_start_unit_parent_id,
17868
- search_start_unit_index,
17869
- null,
17870
- null,
17871
- search_unit_id,
17872
- search_unit_bundle,
17873
- search_unit_merges,
17874
- search_unit_plugs,
17875
- search_start_unit_parent_id,
17876
- search_start_unit_index,
17877
- null,
17878
- null
17887
+ actions.push(
17888
+ this._make_swap_unit_action(
17889
+ search_start_unit_id,
17890
+ search_start_unit_bundle,
17891
+ search_start_unit_merges,
17892
+ search_start_unit_plugs,
17893
+ search_start_unit_parent_id,
17894
+ search_start_unit_parent_slot_name,
17895
+ search_start_unit_parent_index,
17896
+ search_start_unit_children,
17897
+ search_start_unit_children_slot_map,
17898
+ search_unit_id,
17899
+ search_unit_bundle,
17900
+ search_unit_merges,
17901
+ search_unit_plugs,
17902
+ search_start_unit_parent_id,
17903
+ search_start_unit_parent_slot_name,
17904
+ search_start_unit_parent_index,
17905
+ search_start_unit_children,
17906
+ search_start_unit_children_slot_map
17907
+ )
17879
17908
  )
17880
-
17881
- if (did_spec_id_change) {
17882
- this._pod_remove_unit(search_start_unit_id, is_component)
17883
- this._pod_add_unit(search_unit_id, search_unit_bundle)
17884
- }
17885
17909
  } else {
17886
- this._dispatch_add_unit_action(search_unit_id, unit)
17887
-
17888
- this._pod_add_unit(search_unit_id, search_unit_bundle)
17910
+ actions.push(this._make_add_unit_action(search_unit_id, unit))
17889
17911
  }
17890
17912
 
17891
17913
  this._setup_pod(this._pod)
@@ -17927,14 +17949,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17927
17949
  pin_id = getObjSingleKey(merge_unit.output || {})
17928
17950
  }
17929
17951
 
17930
- this.__pod_add_pin_to_merge(
17931
- merge_id,
17932
- search_unit_id,
17933
- type,
17934
- pin_id
17952
+ actions.push(
17953
+ makeAddPinToMergeAction(merge_id, search_unit_id, type, pin_id)
17935
17954
  )
17936
17955
  } else {
17937
- this._pod_add_merge(merge_id, merge)
17956
+ actions.push(makeAddMergeAction(merge_id, merge))
17938
17957
  }
17939
17958
 
17940
17959
  if (!this._is_merge_ref(merge_node_id)) {
@@ -17944,17 +17963,33 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17944
17963
  }
17945
17964
 
17946
17965
  if (this._search_unit_ref_merge_id) {
17947
- this._pod_add_merge(
17948
- this._search_unit_ref_merge_id,
17949
- this._search_unit_ref_merge
17966
+ actions.push(
17967
+ makeAddMergeAction(
17968
+ this._search_unit_ref_merge_id,
17969
+ this._search_unit_ref_merge
17970
+ )
17950
17971
  )
17951
17972
  }
17952
17973
  }
17953
17974
 
17975
+ const bulk_action = makeBulkEditAction(actions)
17976
+
17977
+ this._dispatch_action(bulk_action)
17978
+
17979
+ this._pod.$bulkEdit({ actions, fork, bubble })
17980
+
17981
+ this._download_pod_data()
17982
+
17954
17983
  if (should_add_component) {
17955
17984
  if (this._is_unit_component(search_unit_id)) {
17956
17985
  this._sim_add_sub_component(search_unit_id)
17957
17986
  this._connect_sub_component(search_unit_id)
17987
+
17988
+ this._search_change_return_start_children(
17989
+ search_unit_id,
17990
+ search_start_unit_children,
17991
+ search_start_unit_children_slot_map
17992
+ )
17958
17993
  }
17959
17994
  }
17960
17995
 
@@ -17990,6 +18025,39 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
17990
18025
  }
17991
18026
  }
17992
18027
 
18028
+ private _search_change_return_start_children = (
18029
+ search_unit_id: string,
18030
+ search_start_unit_children: string[],
18031
+ search_start_unit_children_slot_map: Dict<string>
18032
+ ) => {
18033
+ if (search_start_unit_children) {
18034
+ const parent_map = this._get_sub_components_parent_map(
18035
+ search_start_unit_children
18036
+ )
18037
+ const slot_map = this._get_sub_components_slot_map(
18038
+ search_start_unit_children
18039
+ )
18040
+
18041
+ this._on_move_sub_component_root(
18042
+ {
18043
+ prevParentIdMap: parent_map,
18044
+ prevSlotMap: slot_map,
18045
+ parentId: search_unit_id,
18046
+ children: search_start_unit_children,
18047
+ slotMap: search_start_unit_children_slot_map,
18048
+ index: 0,
18049
+ },
18050
+ true,
18051
+ () => {}
18052
+ )
18053
+
18054
+ if (this._tree_layout) {
18055
+ this._refresh_current_layout_node_target_position()
18056
+ this._animate_all_current_layout_layer_node()
18057
+ }
18058
+ }
18059
+ }
18060
+
17993
18061
  private _shift_search = (): void => {
17994
18062
  // console.log('Graph', '_shift_search')
17995
18063
 
@@ -18162,7 +18230,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
18162
18230
  this._search_start_unit_plugs = null
18163
18231
  this._search_start_unit_data = null
18164
18232
  this._search_start_graph_unit_spec = null
18165
- this._search_start_component_index = null
18233
+ this._search_start_unit_parent_index = null
18166
18234
 
18167
18235
  this._search_unit_spec_id_changed = false
18168
18236
 
@@ -18235,6 +18303,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
18235
18303
  const search_unit_start_data = this._search_start_unit_data
18236
18304
  const search_unit_datum_node_id = this._search_unit_datum_node_id
18237
18305
  const search_unit_spec_id_changed = this._search_unit_spec_id_changed
18306
+ const search_start_unit_children = this._search_start_unit_children
18307
+ const search_start_unit_children_slot_map =
18308
+ this._search_start_unit_children_slot_map
18238
18309
 
18239
18310
  if (!search_adding_unit) {
18240
18311
  if (search_unit_id) {
@@ -18258,10 +18329,20 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
18258
18329
  }
18259
18330
 
18260
18331
  forIOObjKV(search_unit_start_data, (type, pin_id, data) => {
18261
- const pin_node_id = getPinNodeId(search_unit_id, type, pin_id)
18332
+ const pin_node_id = getPinNodeId(
18333
+ search_start_unit_id,
18334
+ type,
18335
+ pin_id
18336
+ )
18262
18337
 
18263
18338
  this._graph_debug_set_pin_data_tree(pin_node_id, data)
18264
18339
  })
18340
+
18341
+ this._search_change_return_start_children(
18342
+ search_start_unit_id,
18343
+ search_start_unit_children,
18344
+ search_start_unit_children_slot_map
18345
+ )
18265
18346
  }
18266
18347
  }
18267
18348
  }
@@ -18972,11 +19053,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
18972
19053
  this._enter_fullwindow(animate, ordered_selected_sub_component_ids)
18973
19054
  }
18974
19055
 
18975
- private _get_sub_component_index = (sub_component_id: string): number => {
18976
- return getSubComponentParentIndex(this._spec, sub_component_id)
18977
- }
18978
-
18979
- private _get_sub_component_root_index = (
19056
+ private _spec_get_sub_component_root_index = (
18980
19057
  sub_component_id: string
18981
19058
  ): number => {
18982
19059
  return getSubComponentRootIndex(this._spec, sub_component_id)
@@ -18994,6 +19071,16 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
18994
19071
  )
18995
19072
  }
18996
19073
 
19074
+ private _spec_get_sub_component_index = (sub_component_id: string) => {
19075
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
19076
+
19077
+ if (parent_id) {
19078
+ return this._spec_get_sub_component_parent_root_index(sub_component_id)
19079
+ } else {
19080
+ return this._spec_get_sub_component_root_index(sub_component_id)
19081
+ }
19082
+ }
19083
+
18997
19084
  private _get_sub_component_tree_index = (
18998
19085
  sub_component_id: string
18999
19086
  ): number => {
@@ -19010,7 +19097,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
19010
19097
  const index = parent_sub_component_index + sub_component_index
19011
19098
  return index
19012
19099
  } else {
19013
- return this._get_sub_component_root_index(sub_component_id)
19100
+ return this._spec_get_sub_component_root_index(sub_component_id)
19014
19101
  }
19015
19102
  }
19016
19103
 
@@ -19207,10 +19294,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
19207
19294
  }
19208
19295
  }
19209
19296
 
19210
- private _place_sub_component = (
19211
- sub_component_id: string,
19212
- at?: number
19213
- ): void => {
19297
+ private _place_sub_component = (sub_component_id: string): void => {
19214
19298
  // console.log('Graph', '_place_sub_component', sub_component_id)
19215
19299
 
19216
19300
  if (this._is_all_fullwindow) {
@@ -19218,7 +19302,26 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
19218
19302
 
19219
19303
  push(this._fullwindow_component_ids, sub_component_id)
19220
19304
 
19305
+ const at =
19306
+ this._spec_get_sub_component_parent_root_index(sub_component_id)
19307
+
19221
19308
  this._couple_sub_component(sub_component_id, at)
19309
+ }
19310
+ if (this._tree_layout) {
19311
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
19312
+
19313
+ if (!parent_id || this._is_layout_parent_visible(sub_component_id)) {
19314
+ this._enter_sub_component_frame(sub_component_id)
19315
+ } else {
19316
+ if (parent_id) {
19317
+ const at =
19318
+ this._spec_get_sub_component_parent_root_index(sub_component_id)
19319
+
19320
+ this._couple_sub_component(sub_component_id, at)
19321
+ } else {
19322
+ this._enter_sub_component_frame(sub_component_id)
19323
+ }
19324
+ }
19222
19325
  } else {
19223
19326
  this._enter_sub_component_frame(sub_component_id)
19224
19327
  }
@@ -19294,6 +19397,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
19294
19397
  root_callback: () => void
19295
19398
  ): void => {
19296
19399
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
19400
+
19297
19401
  if (parent_id) {
19298
19402
  parent_root_callback(parent_id)
19299
19403
  } else {
@@ -20483,16 +20587,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
20483
20587
 
20484
20588
  const { animate } = this._config()
20485
20589
 
20486
- const animating_sub_component_set = new Set()
20487
-
20488
- for (const sub_component_id in this._component.$subComponent) {
20489
- const animating_sub_component =
20490
- this._is_sub_component_animating(sub_component_id)
20491
-
20492
- if (animating_sub_component) {
20493
- animating_sub_component_set.add(sub_component_id)
20494
- }
20495
- }
20590
+ const animating_sub_component_set =
20591
+ this._build_animating_sub_component_set()
20496
20592
 
20497
20593
  this._tree_layout = true
20498
20594
 
@@ -20543,30 +20639,26 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
20543
20639
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
20544
20640
  const children = this._spec_get_sub_component_children(sub_component_id)
20545
20641
 
20546
- const parent_visible = !parent_id || this._layout_path.includes(parent_id)
20547
-
20548
20642
  if (!visible && children.length > 0) {
20549
- if (!this._animating_sub_component_base_id.has(sub_component_id)) {
20643
+ if (!this._is_sub_component_animating(sub_component_id)) {
20550
20644
  for (const child_id of children) {
20551
20645
  this._measure_sub_component_base(child_id)
20552
20646
  }
20553
20647
  }
20554
20648
  }
20555
20649
 
20556
- if (parent_visible) {
20650
+ if (!animating_sub_component_set.has(sub_component_id)) {
20557
20651
  this._measure_sub_component_base(sub_component_id)
20558
- }
20559
20652
 
20560
- if (!animating_sub_component_set.has(sub_component_id)) {
20561
20653
  this._leave_sub_component_frame(sub_component_id)
20562
20654
 
20563
20655
  const sub_component_base =
20564
- this._get_sub_component_base(sub_component_id)
20656
+ this._get_sub_component_root_base(sub_component_id)
20565
20657
 
20566
20658
  const parent_id =
20567
20659
  this._spec_get_sub_component_parent_id(sub_component_id)
20568
20660
 
20569
- const parent_layout_layer = this._get_layout_layer(parent_id)
20661
+ const parent_layout_layer = this._ensure_layout_layer(parent_id)
20570
20662
 
20571
20663
  this._remove_sub_component_root_base(sub_component_id)
20572
20664
 
@@ -20620,7 +20712,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
20620
20712
  // console.log('Graph', '_plug_leaf_frame', leaf_id, leaf_node)
20621
20713
 
20622
20714
  if (this._leaf_frame_active[leaf_id]) {
20623
- return
20715
+ this._unplug_leaf_frame(leaf_id)
20716
+
20717
+ this._leaf_frame_node[leaf_id] = leaf_node
20624
20718
  }
20625
20719
 
20626
20720
  const {
@@ -20740,7 +20834,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
20740
20834
  } else if (this._tree_layout) {
20741
20835
  parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
20742
20836
 
20743
- slot_name = this._get_sub_component_slot_name(sub_component_id)
20837
+ slot_name = this._spec_get_sub_component_slot_name(sub_component_id)
20744
20838
  parent = this._get_sub_component(parent_id)
20745
20839
  } else if (this._is_fullwindow) {
20746
20840
  const [sub_component_id] = leaf_path
@@ -21039,27 +21133,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21039
21133
  return callAll(all_unlisten)
21040
21134
  }
21041
21135
 
21042
- private _plug_animate_sub_component_base = (
21043
- sub_component_id: string,
21044
- leaf_base: LayoutBase,
21045
- leaf_traits: LayoutNode[],
21046
- leaf_layer: Component<HTMLElement>,
21047
- n1: (
21048
- leaf_id: string,
21049
- leaf_path: string[],
21050
- leaf_comp: Component
21051
- ) => LayoutNode,
21052
- callback: () => void
21053
- ): Unlisten => {
21054
- return this._animate_sub_component_base(
21055
- sub_component_id,
21056
- leaf_base,
21057
- leaf_traits,
21058
- n1,
21059
- callback
21060
- )
21061
- }
21062
-
21063
21136
  private _animate_sub_component_base = (
21064
21137
  sub_component_id: string,
21065
21138
  leaf_base: LayoutBase,
@@ -21079,8 +21152,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21079
21152
 
21080
21153
  const all_unlisten = []
21081
21154
 
21082
- this._animating_sub_component_base_id.add(sub_component_id)
21083
-
21084
21155
  const leaf_ended = new Set()
21085
21156
 
21086
21157
  for (const leaf of leaf_base) {
@@ -21122,11 +21193,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21122
21193
  })
21123
21194
  }
21124
21195
 
21125
- all_unlisten.push(() => {
21126
- this._animating_sub_component_base_id.delete(sub_component_id)
21127
- })
21196
+ const stop = callAll(all_unlisten)
21128
21197
 
21129
- return callAll(all_unlisten)
21198
+ this._abort_sub_component_base_animation[sub_component_id] = stop
21199
+
21200
+ return stop
21130
21201
  }
21131
21202
 
21132
21203
  private _cancel_enter_animation = (): void => {
@@ -21373,6 +21444,20 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21373
21444
  Promise.all(promises).then(callback)
21374
21445
  }
21375
21446
 
21447
+ private _is_layout_parent_visible = (sub_component_id: string) => {
21448
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
21449
+
21450
+ if (!parent_id) {
21451
+ return true
21452
+ }
21453
+
21454
+ const parent_fullwindow = this._is_sub_component_fullwindow(parent_id)
21455
+ const parent_visible =
21456
+ !parent_fullwindow && this._layout_path.includes(parent_id)
21457
+
21458
+ return parent_visible
21459
+ }
21460
+
21376
21461
  private _animate_enter_tree_layout = (): void => {
21377
21462
  // console.log('Graph', '_animate_enter_tree_layout')
21378
21463
 
@@ -21393,6 +21478,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21393
21478
  }
21394
21479
 
21395
21480
  this._cancel_fullwindow_animation()
21481
+ this._cancel_all_layout_parent_children_animation()
21396
21482
  this._cancel_all_sub_component_base_animation()
21397
21483
  this._cancel_enter_animation()
21398
21484
 
@@ -21423,6 +21509,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21423
21509
  callAll(all_stop)()
21424
21510
 
21425
21511
  for (const sub_component_id of ordered_sub_component_ids) {
21512
+ this._cancel_layout_child_transfer_animation(sub_component_id)
21426
21513
  this._cancel_sub_component_base_animation(sub_component_id)
21427
21514
  this._unplug_sub_component_root_base_frame(sub_component_id)
21428
21515
 
@@ -21495,7 +21582,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21495
21582
  const all_slot_children: Dict<string[]> = {}
21496
21583
 
21497
21584
  for (const child_id of children) {
21498
- const slot_name = this._get_sub_component_slot_name(child_id)
21585
+ const slot_name = this._spec_get_sub_component_slot_name(child_id)
21499
21586
 
21500
21587
  all_slot_children[slot_name] = all_slot_children[slot_name] || []
21501
21588
  all_slot_children[slot_name].push(child_id)
@@ -21541,11 +21628,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21541
21628
 
21542
21629
  const sub_component_base = sub_component.getRootBase()
21543
21630
 
21544
- const parent_id =
21545
- this._spec_get_sub_component_parent_id(sub_component_id)
21546
-
21547
- const parent_layout_layer = this._get_layout_layer(parent_id)
21548
-
21549
21631
  let all_base: Dict<LayoutBase> = {}
21550
21632
  let all_trait: Dict<LayoutNode>
21551
21633
  let all_leaf_count: Dict<number> = {}
@@ -21688,8 +21770,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21688
21770
  )
21689
21771
 
21690
21772
  all_stop.push(stop)
21691
-
21692
- this._abort_sub_component_base_animation[sub_component_id] = stop
21693
21773
  }
21694
21774
  }
21695
21775
  }
@@ -21735,11 +21815,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21735
21815
  )
21736
21816
  }
21737
21817
 
21738
- const stop = this._plug_animate_sub_component_base(
21818
+ const stop = this._animate_sub_component_base(
21739
21819
  sub_component_id,
21740
21820
  leaf_base,
21741
21821
  leaf_traits,
21742
- leaf_layer,
21743
21822
  (leaf_id: string) => {
21744
21823
  const { $width, $height } = this.$context
21745
21824
 
@@ -21805,8 +21884,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21805
21884
 
21806
21885
  delete this._leaf_target_trait[leaf_id]
21807
21886
  }
21808
-
21809
- delete this._abort_sub_component_parent_animation[sub_component_id]
21810
21887
  }
21811
21888
  )
21812
21889
 
@@ -21883,16 +21960,22 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21883
21960
  finished = true
21884
21961
 
21885
21962
  for (const sub_component_id of visible_root) {
21963
+ this._cancel_layout_parent_children_all_slot_animation(
21964
+ sub_component_id
21965
+ )
21886
21966
  this._cancel_sub_component_base_animation(sub_component_id)
21887
21967
 
21888
- delete this._abort_sub_component_base_animation[sub_component_id]
21889
-
21890
21968
  this._unplug_sub_component_root_base_frame(sub_component_id)
21891
21969
  this._append_sub_component_root_base(sub_component_id)
21892
21970
  this._enter_sub_component_frame(sub_component_id)
21893
21971
  }
21894
21972
 
21895
21973
  for (const sub_component_id of visible_parent_root) {
21974
+ this._cancel_layout_parent_children_all_slot_animation(
21975
+ sub_component_id
21976
+ )
21977
+ this._cancel_sub_component_base_animation(sub_component_id)
21978
+
21896
21979
  const all_slot_children =
21897
21980
  visible_parent_slot_children[sub_component_id]
21898
21981
 
@@ -21906,15 +21989,20 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21906
21989
  sub_component_id,
21907
21990
  slot_name
21908
21991
  )
21909
- }
21910
21992
 
21911
- delete this._abort_sub_component_base_animation[sub_component_id]
21993
+ const children = all_slot_children[slot_name]
21994
+
21995
+ for (const child_id of children) {
21996
+ this._cancel_layout_child_transfer_animation(child_id)
21997
+ }
21998
+ }
21912
21999
 
21913
22000
  const children =
21914
22001
  this._spec_get_sub_component_children(sub_component_id)
21915
22002
 
21916
22003
  for (const child_id of children) {
21917
- delete this._abort_sub_component_base_animation[child_id]
22004
+ this._cancel_layout_child_transfer_animation(child_id)
22005
+ this._cancel_sub_component_base_animation(child_id)
21918
22006
 
21919
22007
  this._enter_sub_component_frame(child_id)
21920
22008
  this._append_sub_component_root_base(child_id)
@@ -21931,11 +22019,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21931
22019
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
21932
22020
  const children = this._spec_get_sub_component_children(sub_component_id)
21933
22021
 
21934
- const { foreground: leaf_layer } =
21935
- this._get_sub_component_layout_layer(sub_component_id)
21936
-
21937
- const leaf_traits = []
21938
-
21939
22022
  if (
21940
22023
  !this._layout_path.includes(sub_component_id) &&
21941
22024
  children.length > 0
@@ -21945,7 +22028,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
21945
22028
  const all_slot_children: Dict<string[]> = {}
21946
22029
 
21947
22030
  for (const child_id of children) {
21948
- const slot_name = this._get_sub_component_slot_name(child_id)
22031
+ const slot_name = this._spec_get_sub_component_slot_name(child_id)
21949
22032
 
21950
22033
  all_slot_children[slot_name] = all_slot_children[slot_name] || []
21951
22034
  all_slot_children[slot_name].push(child_id)
@@ -22019,18 +22102,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22019
22102
  leaf_node.opacity *= layer_opacity
22020
22103
  }
22021
22104
 
22022
- this._plug_sub_component_base(
22105
+ const stop = this._animate_sub_component_base(
22023
22106
  sub_component_id,
22024
22107
  leaf_base,
22025
- leaf_traits,
22026
- leaf_layer
22027
- )
22028
-
22029
- const stop = this._plug_animate_sub_component_base(
22030
- sub_component_id,
22031
- leaf_base,
22032
- leaf_traits,
22033
- leaf_layer,
22108
+ [],
22034
22109
  (leaf_id: string) => {
22035
22110
  const { x, y } = this._get_node_screen_position(sub_component_id)
22036
22111
 
@@ -22092,8 +22167,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22092
22167
  )
22093
22168
 
22094
22169
  all_stop.push(stop)
22095
-
22096
- this._abort_sub_component_base_animation[sub_component_id] = stop
22097
22170
  }
22098
22171
  }
22099
22172
  }
@@ -22291,21 +22364,37 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22291
22364
  }
22292
22365
 
22293
22366
  private _is_sub_component_animating = (sub_component_id: string): boolean => {
22294
- let animating_sub_component = !!(
22295
- this._animating_sub_component_base_id.has(sub_component_id) ||
22296
- this._abort_sub_component_enter_base_animation[sub_component_id] ||
22297
- this._abort_sub_component_base_animation[sub_component_id]
22298
- )
22367
+ if (this._abort_sub_component_enter_base_animation[sub_component_id]) {
22368
+ return true
22369
+ }
22370
+
22371
+ if (this._abort_sub_component_base_animation[sub_component_id]) {
22372
+ return true
22373
+ }
22374
+
22375
+ if (this._animating_sub_component_transfer.has(sub_component_id)) {
22376
+ return true
22377
+ }
22378
+
22379
+ if (this._abort_sub_component_parent_animation[sub_component_id]) {
22380
+ return true
22381
+ }
22299
22382
 
22300
22383
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
22301
22384
 
22302
22385
  if (parent_id) {
22303
- animating_sub_component =
22304
- animating_sub_component ||
22305
- !!this._abort_sub_component_parent_animation[parent_id]
22386
+ if (this._abort_sub_component_parent_animation[parent_id]) {
22387
+ return true
22388
+ }
22389
+
22390
+ if (
22391
+ this._layout_parent_children_animation_frame[parent_id] !== undefined
22392
+ ) {
22393
+ return true
22394
+ }
22306
22395
  }
22307
22396
 
22308
- return animating_sub_component
22397
+ return false
22309
22398
  }
22310
22399
 
22311
22400
  private _zoom_opacity_animation: Animation
@@ -22324,13 +22413,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22324
22413
  )
22325
22414
  }
22326
22415
 
22327
- private _leave_tree_layout = (): void => {
22328
- // console.log('Graph', '_leave_tree_layout')
22329
-
22330
- const { animate } = this._config()
22331
-
22332
- this._pointer_up_all_pressed_pointer_id()
22333
-
22416
+ private _build_animating_sub_component_set = () => {
22334
22417
  const animating_sub_component_set = new Set()
22335
22418
 
22336
22419
  for (const sub_component_id in this._component.$subComponent) {
@@ -22342,10 +22425,24 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22342
22425
  }
22343
22426
  }
22344
22427
 
22428
+ return animating_sub_component_set
22429
+ }
22430
+
22431
+ private _leave_tree_layout = (): void => {
22432
+ // console.log('Graph', '_leave_tree_layout')
22433
+
22434
+ const { animate } = this._config()
22435
+
22436
+ this._pointer_up_all_pressed_pointer_id()
22437
+
22438
+ const animating_sub_component_set =
22439
+ this._build_animating_sub_component_set()
22440
+
22345
22441
  this._cancel_fullwindow_animation()
22346
22442
  this._cancel_all_sub_component_base_animation()
22347
22443
  this._cancel_all_layout_parent_children_animation()
22348
22444
  this._cancel_all_sub_component_parent_animation()
22445
+ this._cancel_all_sub_component_parent_animation()
22349
22446
 
22350
22447
  this._tree_layout = false
22351
22448
 
@@ -22386,9 +22483,30 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22386
22483
  }
22387
22484
 
22388
22485
  for (const sub_component_id in this._component.$subComponent) {
22389
- const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
22390
22486
  const children = this._spec_get_sub_component_children(sub_component_id)
22391
22487
 
22488
+ if (
22489
+ !this._layout_path.includes(sub_component_id) &&
22490
+ children.length > 0
22491
+ ) {
22492
+ for (const child_id of children) {
22493
+ if (!animating_sub_component_set.has(child_id)) {
22494
+ this._remove_sub_component_parent_root(sub_component_id, child_id)
22495
+ this._remove_sub_component_root_base(child_id)
22496
+
22497
+ const child = this._get_sub_component(child_id)
22498
+
22499
+ if (child.$mounted) {
22500
+ child.unmount()
22501
+ }
22502
+ }
22503
+ }
22504
+ }
22505
+ }
22506
+
22507
+ for (const sub_component_id in this._component.$subComponent) {
22508
+ const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
22509
+
22392
22510
  if (animate) {
22393
22511
  if (!parent_id || this._layout_path.includes(parent_id)) {
22394
22512
  const animating_sub_component =
@@ -22404,17 +22522,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
22404
22522
  }
22405
22523
  }
22406
22524
 
22407
- if (
22408
- !this._layout_path.includes(sub_component_id) &&
22409
- children.length > 0
22410
- ) {
22411
- for (const child_id of children) {
22412
- if (!this._animating_sub_component_base_id.has(child_id)) {
22413
- this._remove_sub_component_parent_root(sub_component_id, child_id)
22414
- this._remove_sub_component_root_base(child_id)
22415
- }
22416
- }
22417
- }
22525
+ const leaf_base = this._get_sub_component_root_base(sub_component_id)
22526
+
22527
+ const { foreground: leaf_layer } =
22528
+ this._get_sub_component_layout_layer(sub_component_id)
22529
+
22530
+ this._plug_sub_component_base(sub_component_id, leaf_base, [], leaf_layer)
22418
22531
 
22419
22532
  this._refresh_component_children_counter(sub_component_id)
22420
22533
  this._unlisten_sub_component(sub_component_id)
@@ -24013,7 +24126,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
24013
24126
 
24014
24127
  actions.push(this._make_remove_unit_action(unit_id, undefined, true, true))
24015
24128
  actions.push(
24016
- this._make_add_unit_action(next_unit_id, class_bundle, merges_, plugs_)
24129
+ this._make_add_unit_bundle_action(
24130
+ next_unit_id,
24131
+ class_bundle,
24132
+ merges_,
24133
+ plugs_
24134
+ )
24017
24135
  )
24018
24136
 
24019
24137
  const action = makeBulkEditAction(actions)
@@ -24028,7 +24146,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
24028
24146
  merged_pin_ids,
24029
24147
  merge_pin_index,
24030
24148
  exposed_pin_ids,
24031
- exposed_pin_index
24149
+ exposed_pin_index,
24150
+ null,
24151
+ null,
24152
+ null,
24153
+ null,
24154
+ null
24032
24155
  )
24033
24156
 
24034
24157
  if (memory) {
@@ -27993,6 +28116,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
27993
28116
  false,
27994
28117
  measure,
27995
28118
  () => {
28119
+ this._cancel_sub_component_base_animation(sub_component_id)
28120
+
27996
28121
  this._unplug_sub_component_base_frame(sub_component_id)
27997
28122
  this._compose_sub_component(sub_component_id)
27998
28123
  this._append_sub_component_base(sub_component_id)
@@ -28031,7 +28156,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
28031
28156
 
28032
28157
  this._leave_sub_component_frame(sub_component_id)
28033
28158
 
28034
- if (this._animating_sub_component_base_id.has(sub_component_id)) {
28159
+ if (this._is_sub_component_animating(sub_component_id)) {
28035
28160
  //
28036
28161
  } else {
28037
28162
  this._remove_sub_component_base(sub_component_id)
@@ -28207,9 +28332,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
28207
28332
 
28208
28333
  const { datumId } = segmentDatumNodeId(datum_node_id)
28209
28334
 
28210
- const value = this._get_datum_value(datum_node_id)
28335
+ if (this._has_node(datum_node_id)) {
28336
+ const value = this._get_datum_value(datum_node_id)
28211
28337
 
28212
- removeData({ datumId, value })
28338
+ removeData({ datumId, value })
28339
+ }
28213
28340
  }
28214
28341
 
28215
28342
  private _action_buffer: Action[] = []
@@ -28898,11 +29025,13 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
28898
29025
  this._spec_add_unit(new_unit_id, new_unit, specs)
28899
29026
 
28900
29027
  let parent_id: string | null = null
29028
+ let slot_name: string | null
28901
29029
 
28902
29030
  if (this._is_unit_component(new_unit_id)) {
28903
29031
  parent_id = this._spec_get_sub_component_parent_id(unit_id)
29032
+ slot_name = this._spec_get_sub_component_slot_name(unit_id)
28904
29033
 
28905
- this._spec_append_component(parent_id, new_unit_id)
29034
+ this._spec_append_component(parent_id, new_unit_id, slot_name)
28906
29035
  }
28907
29036
 
28908
29037
  this._sim_add_unit(
@@ -29276,6 +29405,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
29276
29405
  bundle,
29277
29406
  null,
29278
29407
  null,
29408
+ null,
29279
29409
  position,
29280
29410
  pin_position,
29281
29411
  layout_position
@@ -29541,6 +29671,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
29541
29671
 
29542
29672
  const position = this._get_node_position(unit_id)
29543
29673
 
29674
+ const is_component = this._is_unit_component(unit_id)
29675
+
29544
29676
  this._search_to_be_focused_by_click = true
29545
29677
 
29546
29678
  this._search_start_unit_id = unit_id
@@ -29550,15 +29682,23 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
29550
29682
  this._search_start_unit_plugs = clone(this._get_unit_plugs(unit_id))
29551
29683
  this._search_start_unit_data = clone(this._get_unit_data(unit_id))
29552
29684
  this._search_start_graph_unit_spec = clone(this._get_unit(unit_id))
29685
+ this._search_start_unit_parent_id =
29686
+ (is_component && this._spec_get_sub_component_parent_id(unit_id)) || null
29687
+ this._search_start_unit_parent_slot_name =
29688
+ (is_component && this._spec_get_sub_component_slot_name(unit_id)) || null
29689
+ this._search_start_unit_parent_index =
29690
+ (is_component && this._spec_get_sub_component_index(unit_id)) || null
29691
+ this._search_start_unit_children =
29692
+ (is_component && clone(this._spec_get_sub_component_children(unit_id))) ||
29693
+ null
29694
+ this._search_start_unit_children_slot_map =
29695
+ (is_component && this._spec_get_sub_component_children_slot(unit_id)) ||
29696
+ null
29553
29697
 
29554
29698
  this._search_unit_id = unit_id
29555
29699
  this._search_unit_spec_id = spec_id
29556
29700
  this._search_unit_spec_id_changed = false
29557
29701
 
29558
- if (this._is_unit_component(unit_id)) {
29559
- this._search_start_component_index = this._sub_component_index[unit_id]
29560
- }
29561
-
29562
29702
  this._search_unit_merges = this._get_unit_merges(unit_id)
29563
29703
 
29564
29704
  this._search_unit_merged_pin_ids = {
@@ -30827,7 +30967,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
30827
30967
  this._cancel_fullwindow_animation()
30828
30968
  this._end_leave_fullwindow_animation([unit_id])
30829
30969
 
30830
- this._animating_sub_component_base_id.delete(unit_id)
30970
+ this._cancel_sub_component_base_animation(unit_id)
30831
30971
  }
30832
30972
 
30833
30973
  if (this._is_sub_component_fullwindow(unit_id)) {
@@ -30881,8 +31021,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
30881
31021
 
30882
31022
  if (is_component) {
30883
31023
  if (animating_sub_component) {
30884
- const sub_component = this._get_sub_component(unit_id)
30885
-
30886
31024
  this._unplug_sub_component_root_base_frame(unit_id)
30887
31025
  this._cancel_sub_component_base_animation(unit_id)
30888
31026
  this._uncollapse_sub_component(unit_id)
@@ -31097,7 +31235,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31097
31235
  this._component.decompose()
31098
31236
 
31099
31237
  if (component_collapsed) {
31100
- if (!this._animating_sub_component_base_id.has(sub_component_id)) {
31238
+ if (this._is_sub_component_animating(sub_component_id)) {
31101
31239
  this._remove_sub_component_root_base(sub_component_id)
31102
31240
  }
31103
31241
  } else {
@@ -31112,7 +31250,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31112
31250
 
31113
31251
  const trait = extractTrait(frame, measureText)
31114
31252
 
31115
- if (!this._animating_sub_component_base_id.has(sub_component_id)) {
31253
+ if (!this._is_sub_component_animating(sub_component_id)) {
31116
31254
  this._plug_sub_component_base(
31117
31255
  sub_component_id,
31118
31256
  base,
@@ -31133,11 +31271,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31133
31271
  i = 0
31134
31272
 
31135
31273
  this._abort_sub_component_enter_base_animation[sub_component_id] =
31136
- this._plug_animate_sub_component_base(
31274
+ this._animate_sub_component_base(
31137
31275
  sub_component_id,
31138
31276
  base,
31139
31277
  base_node,
31140
- leaf_layer,
31141
31278
  (leaf_id) => {
31142
31279
  if (i === 0) {
31143
31280
  const trait = extractTrait(frame, measureText)
@@ -31172,6 +31309,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31172
31309
  async () => {
31173
31310
  await wait_for
31174
31311
 
31312
+ this._cancel_sub_component_base_animation(sub_component_id)
31175
31313
  this._cancel_enter_sub_component_animation(sub_component_id)
31176
31314
 
31177
31315
  this._end_sub_component_enter_base_animation(sub_component_id)
@@ -31325,7 +31463,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31325
31463
  }
31326
31464
 
31327
31465
  for (const sub_component_id in this._component.$subComponent) {
31328
- if (this._animating_sub_component_base_id.has(sub_component_id)) {
31466
+ if (this._is_sub_component_animating(sub_component_id)) {
31329
31467
  this._unplug_sub_component_root_base_frame(sub_component_id)
31330
31468
  }
31331
31469
 
@@ -31625,7 +31763,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31625
31763
  return this.__commit_sub_component_base(
31626
31764
  sub_component_id,
31627
31765
  (parent, leaf_comp) => {
31628
- const slot_name = this._get_sub_component_slot_name(sub_component_id)
31766
+ const slot_name =
31767
+ this._spec_get_sub_component_slot_name(sub_component_id)
31629
31768
 
31630
31769
  const i = parent.$parentRoot.indexOf(leaf_comp)
31631
31770
 
@@ -31647,7 +31786,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31647
31786
  return this.__commit_sub_component_root_base(
31648
31787
  sub_component_id,
31649
31788
  (parent, leaf_comp) => {
31650
- const slot_name = this._get_sub_component_slot_name(sub_component_id)
31789
+ const slot_name =
31790
+ this._spec_get_sub_component_slot_name(sub_component_id)
31651
31791
  const i = parent.$parentRoot.indexOf(leaf_comp)
31652
31792
 
31653
31793
  parent.insertParentRootAt(leaf_comp, i, slot_name)
@@ -31830,13 +31970,14 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31830
31970
  }
31831
31971
  }
31832
31972
 
31833
- private _animate_layout_leave_sub_component = () => {
31973
+ private _layout_leave_sub_component = (animate: boolean = true) => {
31834
31974
  // console.log('Graph', '_animate_layout_leave_sub_component')
31835
31975
 
31836
- const { animate } = this._config()
31837
-
31838
31976
  const sub_component_id = this._get_current_layout_layer_id()
31839
31977
 
31978
+ const animating_sub_component_set =
31979
+ this._build_animating_sub_component_set()
31980
+
31840
31981
  this._measure_sub_component_base(sub_component_id)
31841
31982
 
31842
31983
  const children = this._spec_get_sub_component_children(sub_component_id)
@@ -31859,10 +32000,18 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31859
32000
  layout_layer.children.$element.style.overflowY = 'initial'
31860
32001
  layout_layer.children.$element.style.overflowX = 'initial'
31861
32002
 
31862
- if (next_unit_id) {
31863
- this._animate_layout_layer_element_opacity(next_unit_id, 1)
32003
+ if (animate) {
32004
+ if (next_unit_id) {
32005
+ this._animate_layout_layer_element_opacity(next_unit_id, 1)
32006
+ } else {
32007
+ this._animate_layout_root_element_opacity(1)
32008
+ }
31864
32009
  } else {
31865
- this._animate_layout_root_element_opacity(1)
32010
+ if (next_unit_id) {
32011
+ next_layout_layer.children.$element.style.opacity = `1`
32012
+ } else {
32013
+ this._layout_root.children.$element.style.opacity = `1`
32014
+ }
31866
32015
  }
31867
32016
 
31868
32017
  next_layout_layer.content.$element.style.overflowY = 'auto'
@@ -31881,7 +32030,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31881
32030
  const all_slot_children: Dict<string[]> = {}
31882
32031
 
31883
32032
  for (const child_id of children) {
31884
- const slot_name = this._get_sub_component_slot_name(child_id)
32033
+ const slot_name = this._spec_get_sub_component_slot_name(child_id)
31885
32034
 
31886
32035
  all_slot_children[slot_name] = all_slot_children[slot_name] || []
31887
32036
  all_slot_children[slot_name].push(child_id)
@@ -31896,6 +32045,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31896
32045
  const all_unlisten: Unlisten[] = []
31897
32046
 
31898
32047
  const finish = async () => {
32048
+ this._cancel_parent_animation(sub_component_id)
32049
+ this._cancel_sub_component_base_animation(sub_component_id)
32050
+
31899
32051
  for (const slot_name in all_slot_children) {
31900
32052
  if (next_unit_id) {
31901
32053
  if (this._layout_layer_opacity_animation[next_unit_id]) {
@@ -31958,7 +32110,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31958
32110
  all_unlisten.push(stop)
31959
32111
 
31960
32112
  for (const child_id of children) {
31961
- if (!this._animating_sub_component_base_id.has(child_id)) {
32113
+ if (!animating_sub_component_set.has(child_id)) {
31962
32114
  this._leave_sub_component_frame(child_id)
31963
32115
  this._remove_sub_component_root_base(child_id)
31964
32116
  }
@@ -31992,7 +32144,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
31992
32144
  all_unlisten.push(stop)
31993
32145
  }
31994
32146
  } else {
31995
- // TODO
32147
+ //
31996
32148
  }
31997
32149
  }
31998
32150
 
@@ -32417,7 +32569,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32417
32569
  const slot_map = {}
32418
32570
 
32419
32571
  for (const sub_component_id of sub_component_ids) {
32420
- const slot_name = this._get_sub_component_slot_name(sub_component_id)
32572
+ const slot_name = this._spec_get_sub_component_slot_name(sub_component_id)
32421
32573
 
32422
32574
  slot_map[slot_name] = sub_component_id
32423
32575
  }
@@ -32461,14 +32613,15 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32461
32613
  )
32462
32614
  )
32463
32615
 
32464
- this._move_sub_component_root(parent_id, children, slot_name)
32616
+ this._layout_move_sub_component_root(parent_id, children, slot_name)
32465
32617
  }
32466
32618
 
32467
- private _move_sub_component_root = (
32619
+ private _layout_move_sub_component_root = (
32468
32620
  parent_id: string,
32469
32621
  children: string[],
32470
32622
  slot_name: string = 'default',
32471
32623
  animate?: boolean,
32624
+ emit: boolean = true,
32472
32625
  callback?: Callback
32473
32626
  ): Unlisten => {
32474
32627
  // console.log(
@@ -32483,12 +32636,22 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32483
32636
 
32484
32637
  animate = animate ?? config.animate
32485
32638
 
32486
- // this._cancel_tree_layout_animation()
32639
+ const animating_sub_component_set =
32640
+ this._build_animating_sub_component_set()
32641
+
32642
+ for (const child_id of children) {
32643
+ this._cancel_sub_component_base_animation(child_id)
32644
+ }
32487
32645
 
32488
32646
  this._ensure_layout_layer(parent_id)
32489
32647
 
32490
32648
  let finish: Unlisten
32491
32649
 
32650
+ let stop_core_animation: Unlisten[] = []
32651
+ let layout_core_remaining_set: Set<string> = new Set(children)
32652
+
32653
+ let finished = false
32654
+
32492
32655
  const current_layer_id = this._get_current_layout_layer_id()
32493
32656
 
32494
32657
  animate = animate && !this._is_layout_component_layer_visible(parent_id)
@@ -32516,41 +32679,51 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32516
32679
  this._measure_sub_component_base(child_id)
32517
32680
  }
32518
32681
 
32519
- for (const child_id of children) {
32520
- const child_component = this._get_sub_component(child_id)
32521
-
32522
- this._cancel_sub_component_base_animation(child_id)
32523
-
32524
- const prev_parent_id = this._spec_get_sub_component_parent_id(child_id)
32525
- if (prev_parent_id) {
32526
- const prev_parent_component = this._get_sub_component(prev_parent_id)
32527
-
32528
- prev_parent_component.pullParentRoot(child_component)
32529
- } else {
32530
- this._component.pullRoot(child_component)
32531
- }
32532
-
32533
- this._pre_append_sub_component_child(parent_id, child_id, slot_name)
32534
- }
32535
-
32536
32682
  for (const child_id of all_children) {
32537
- if (!this._animating_sub_component_base_id.has(child_id)) {
32683
+ if (!animating_sub_component_set.has(child_id)) {
32538
32684
  this._remove_sub_component_root_base(child_id)
32539
32685
  }
32540
32686
  }
32541
32687
 
32542
32688
  for (const child_id of slot_children) {
32543
- if (!this._animating_sub_component_base_id.has(child_id)) {
32689
+ if (!animating_sub_component_set.has(child_id)) {
32544
32690
  this._remove_sub_component_parent_root(parent_id, child_id)
32545
32691
  }
32546
32692
  }
32547
32693
 
32548
32694
  for (const child_id of children) {
32549
- if (!this._animating_sub_component_base_id.has(child_id)) {
32550
- this._leave_sub_component_frame(child_id)
32695
+ if (!animating_sub_component_set.has(child_id)) {
32696
+ const parent_id = this._spec_get_sub_component_parent_id(child_id)
32697
+
32698
+ const parent_visible =
32699
+ this._is_layout_component_layer_visible(parent_id)
32700
+
32701
+ if (!parent_id || parent_visible) {
32702
+ this._leave_sub_component_frame(child_id)
32703
+ }
32551
32704
  }
32552
32705
  }
32553
32706
 
32707
+ for (const child_id of children) {
32708
+ const child_component = this._get_sub_component(child_id)
32709
+
32710
+ const prev_parent_id = this._spec_get_sub_component_parent_id(child_id)
32711
+ if (prev_parent_id) {
32712
+ const prev_parent_component = this._get_sub_component(prev_parent_id)
32713
+
32714
+ prev_parent_component.pullParentRoot(child_component)
32715
+ } else {
32716
+ this._component.pullRoot(child_component)
32717
+ }
32718
+
32719
+ this._pre_append_sub_component_child(
32720
+ parent_id,
32721
+ child_id,
32722
+ slot_name,
32723
+ emit
32724
+ )
32725
+ }
32726
+
32554
32727
  const parent_animating = this._is_sub_component_animating(parent_id)
32555
32728
 
32556
32729
  const parent_leaf_traits = []
@@ -32606,9 +32779,30 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32606
32779
  )
32607
32780
 
32608
32781
  finish = () => {
32782
+ if (finished) {
32783
+ return
32784
+ }
32785
+
32786
+ finished = true
32787
+
32788
+ this._cancel_parent_animation(parent_id)
32789
+ this._cancel_layout_parent_children_all_slot_animation(parent_id)
32790
+ this._cancel_sub_component_base_animation(parent_id)
32791
+
32792
+ callAll(stop_core_animation)()
32793
+
32609
32794
  stop_parent_animation()
32610
32795
  stop_children_animation()
32611
32796
 
32797
+ for (const child_id of layout_core_remaining_set) {
32798
+ this._layout_layer_move_sub_component_child(
32799
+ current_layer_id,
32800
+ parent_id,
32801
+ child_id,
32802
+ i
32803
+ )
32804
+ }
32805
+
32612
32806
  this._unplug_sub_component_root_base_frame(parent_id)
32613
32807
  this._append_sub_component_root_base(parent_id)
32614
32808
  this._enter_sub_component_frame(parent_id)
@@ -32619,14 +32813,19 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32619
32813
  )
32620
32814
 
32621
32815
  for (const child_id of slot_children) {
32816
+ this._cancel_layout_child_transfer_animation(child_id)
32817
+ this._cancel_sub_component_base_animation(child_id)
32818
+
32622
32819
  this._insert_sub_component_child(parent_id, child_id)
32623
32820
  }
32624
32821
  for (const child_id of children) {
32822
+ this._cancel_layout_child_transfer_animation(child_id)
32823
+ this._cancel_sub_component_base_animation(child_id)
32824
+
32625
32825
  this._insert_sub_component_child(parent_id, child_id)
32626
32826
  }
32627
32827
 
32628
32828
  this._layout_sub_components_commit_base(all_children)
32629
- this._animate_all_current_layout_layer_node()
32630
32829
 
32631
32830
  callback && callback()
32632
32831
  }
@@ -32640,6 +32839,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32640
32839
  () => {
32641
32840
  stop()
32642
32841
 
32842
+ layout_core_remaining_set.delete(child_id)
32843
+
32643
32844
  this._layout_layer_move_sub_component_child(
32644
32845
  current_layer_id,
32645
32846
  parent_id,
@@ -32650,9 +32851,15 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32650
32851
  i++
32651
32852
  }
32652
32853
  )
32854
+
32855
+ stop_core_animation.push(stop)
32653
32856
  }
32654
32857
  }
32655
32858
 
32859
+ this._refresh_layout_node_target_position(current_layer_id)
32860
+
32861
+ this._animate_all_current_layout_layer_node()
32862
+
32656
32863
  if (animate) {
32657
32864
  //
32658
32865
  } else {
@@ -32700,16 +32907,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32700
32907
  return finish
32701
32908
  }
32702
32909
 
32703
- private _mem_append_sub_component_child = (
32704
- parent_id: string,
32705
- child_id: string,
32706
- slot_name: string
32707
- ): void => {}
32708
-
32709
32910
  private _pre_append_sub_component_child = (
32710
32911
  parent_id: string,
32711
32912
  child_id: string,
32712
- slot_name: string
32913
+ slot_name: string,
32914
+ emit: boolean = true
32713
32915
  ): void => {
32714
32916
  // console.log('Graph', '_pre_append_sub_component_child', parent_id, child_id)
32715
32917
 
@@ -32717,16 +32919,17 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32717
32919
 
32718
32920
  this._state_pre_append_sub_component_child(parent_id, child_id, slot_name)
32719
32921
 
32720
- this._pod_move_sub_component_root(
32721
- parent_id,
32722
- [child_id],
32723
- {
32724
- [child_id]: slot_name,
32725
- },
32726
- next_index,
32727
- {},
32728
- {}
32729
- )
32922
+ emit &&
32923
+ this._pod_move_sub_component_root(
32924
+ parent_id,
32925
+ [child_id],
32926
+ {
32927
+ [child_id]: slot_name,
32928
+ },
32929
+ next_index,
32930
+ {},
32931
+ {}
32932
+ )
32730
32933
  }
32731
32934
 
32732
32935
  private _state_pre_append_sub_component_child = (
@@ -32741,7 +32944,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32741
32944
  // child_id
32742
32945
  // )
32743
32946
 
32744
- const index = this._get_component_children_count(parent_id)
32947
+ const index = this._spec_get_sub_component_children_count(parent_id)
32745
32948
 
32746
32949
  this._state_pre_insert_sub_component_child(
32747
32950
  parent_id,
@@ -32880,7 +33083,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32880
33083
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
32881
33084
 
32882
33085
  if (
32883
- !this._animating_sub_component_base_id.has(sub_component_id) &&
33086
+ !this._is_sub_component_animating(sub_component_id) &&
32884
33087
  !this._animating_sub_component_fullwindow.has(sub_component_id)
32885
33088
  ) {
32886
33089
  if (this._tree_layout) {
@@ -32916,11 +33119,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
32916
33119
 
32917
33120
  this._animating_sub_component_fullwindow.add(sub_component_id)
32918
33121
 
32919
- const stop = this._plug_animate_sub_component_base(
33122
+ const stop = this._animate_sub_component_base(
32920
33123
  sub_component_id,
32921
33124
  base,
32922
33125
  [],
32923
- layer,
32924
33126
  (leaf_id: string) => {
32925
33127
  if (i === 0) {
32926
33128
  const color = sub_component.getColor()
@@ -33072,7 +33274,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33072
33274
  ]
33073
33275
  } else {
33074
33276
  const slot_name =
33075
- this._get_sub_component_slot_name(sub_component_id)
33277
+ this._spec_get_sub_component_slot_name(sub_component_id)
33076
33278
 
33077
33279
  all_parent_base[parent_id] = all_parent_base[parent_id] || {}
33078
33280
  all_parent_base[parent_id][slot_name] =
@@ -33147,7 +33349,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33147
33349
 
33148
33350
  for (const sub_component_id of sub_component_ids) {
33149
33351
  if (
33150
- !this._animating_sub_component_base_id.has(sub_component_id) &&
33352
+ !this._is_sub_component_animating(sub_component_id) &&
33151
33353
  !this._animating_sub_component_fullwindow.has(sub_component_id)
33152
33354
  ) {
33153
33355
  this._remove_sub_component_root_base(sub_component_id)
@@ -33171,11 +33373,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33171
33373
 
33172
33374
  this._plug_sub_component_base(sub_component_id, base, [], layer)
33173
33375
 
33174
- const stop = this._plug_animate_sub_component_base(
33376
+ const stop = this._animate_sub_component_base(
33175
33377
  sub_component_id,
33176
33378
  base,
33177
33379
  [],
33178
- layer,
33179
33380
  (leaf_id: string) => {
33180
33381
  if (i === 0) {
33181
33382
  reset_all_trait()
@@ -33333,6 +33534,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33333
33534
  this._reset_layout_transfer_parent(parent_id, slot_name)
33334
33535
  this._reset_layout_transfer_parent_children(parent_id, slot_name, children)
33335
33536
 
33537
+ for (const child_id of children) {
33538
+ this._animating_sub_component_transfer.add(child_id)
33539
+ }
33540
+
33336
33541
  const parent_child_leaf_style = []
33337
33542
 
33338
33543
  const sub_component = this._get_sub_component(parent_id)
@@ -33400,15 +33605,22 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33400
33605
  for (const sub_component_id in {
33401
33606
  ...this._layout_parent_children_animation_frame,
33402
33607
  }) {
33403
- // console.log('_cancel_all_layout_parent_children_animation')
33404
- for (const slot_name in {
33405
- ...this._layout_parent_children_animation_frame[sub_component_id],
33406
- }) {
33407
- this._cancel_layout_parent_children_animation(
33408
- sub_component_id,
33409
- slot_name
33410
- )
33411
- }
33608
+ this._cancel_layout_parent_children_all_slot_animation(sub_component_id)
33609
+ }
33610
+ }
33611
+
33612
+ private _cancel_layout_parent_children_all_slot_animation = (
33613
+ sub_component_id: string
33614
+ ) => {
33615
+ // console.log(
33616
+ // '_cancel_layout_parent_children_all_slot_animation',
33617
+ // sub_component_id
33618
+ // )
33619
+
33620
+ for (const slot_name in {
33621
+ ...this._layout_parent_children_animation_frame[sub_component_id],
33622
+ }) {
33623
+ this._cancel_layout_parent_children_animation(sub_component_id, slot_name)
33412
33624
  }
33413
33625
  }
33414
33626
 
@@ -33451,13 +33663,20 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33451
33663
  this._layout_parent_children_animation_frame[parent_id][slot_name]
33452
33664
  )
33453
33665
 
33454
- delete this._layout_parent_children_animation_frame[parent_id][
33455
- slot_name
33456
- ]
33666
+ deepDestroy(this._layout_parent_children_animation_frame, [
33667
+ parent_id,
33668
+ slot_name,
33669
+ ])
33457
33670
  }
33458
33671
  }
33459
33672
  }
33460
33673
 
33674
+ private _cancel_layout_child_transfer_animation = (
33675
+ child_id: string
33676
+ ): void => {
33677
+ this._animating_sub_component_transfer.delete(child_id)
33678
+ }
33679
+
33461
33680
  private _start_layout_children_animation = (
33462
33681
  parent_id: string,
33463
33682
  slot_name: string,
@@ -33495,7 +33714,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33495
33714
  // slot_name
33496
33715
  // )
33497
33716
 
33498
- // this._cancel_layout_current_children_transfer_animation()
33717
+ this._cancel_all_layout_parent_children_animation()
33499
33718
  this._cancel_layout_parent_children_animation(sub_component_id, slot_name)
33500
33719
 
33501
33720
  this._setup_layout_sub_component_append_children_animation(
@@ -33541,12 +33760,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33541
33760
  include_scroll: () => boolean,
33542
33761
  callback: Callback
33543
33762
  ): Unlisten => {
33544
- const {
33545
- api: {
33546
- animation: { requestAnimationFrame },
33547
- },
33548
- } = this.$system
33549
-
33550
33763
  const frame = () => {
33551
33764
  this._tick_animate_layout_transfer_children(
33552
33765
  parent_id,
@@ -33576,7 +33789,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
33576
33789
  }
33577
33790
  }
33578
33791
 
33579
- requestAnimationFrame(frame)
33792
+ this._start_layout_children_animation(parent_id, slot_name, frame)
33580
33793
 
33581
33794
  return () => {
33582
33795
  this._cancel_layout_parent_children_animation(parent_id, slot_name)
@@ -34069,30 +34282,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34069
34282
  } else {
34070
34283
  component.pullRoot(child_component)
34071
34284
  }
34072
- }
34073
-
34074
- private _mem_push_parent_child = (
34075
- parent_id: string,
34076
- child_id: string,
34077
- slot_name: string
34078
- ): void => {
34079
- // console.log(
34080
- // 'Graph',
34081
- // '_mem_push_parent_child',
34082
- // parent_id,
34083
- // child_id,
34084
- // slot_name,
34085
- // )
34086
-
34087
- const parent_component = this._get_sub_component(parent_id)
34088
- const child_component = this._get_sub_component(child_id)
34089
- const slot = this._get_sub_component_slot_name(child_id)
34090
-
34091
- parent_component.pushParentRoot(child_component, slot)
34092
34285
 
34093
- this._layout_sub_component_parent[child_id] = parent_id
34094
-
34095
- this._mem_layout_push_parent_root(parent_id, child_id, slot_name)
34286
+ this._layout_mem_move_sub_component_child(parent_id, child_id, null)
34096
34287
  }
34097
34288
 
34098
34289
  private _mem_insert_parent_child = (
@@ -34111,10 +34302,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34111
34302
  // )
34112
34303
 
34113
34304
  this._mem_place_parent_root(parent_id, child_id, slot_name, at)
34114
-
34115
- this._layout_sub_component_parent[child_id] = parent_id
34116
-
34117
- this._mem_layout_insert_parent_root(parent_id, child_id, slot_name, at)
34118
34305
  }
34119
34306
 
34120
34307
  private _mem_layout_push_parent_root = (
@@ -34181,6 +34368,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34181
34368
  const child = this._get_sub_component(child_id)
34182
34369
 
34183
34370
  parent.placeParentRoot(child, at, slot_name)
34371
+
34372
+ this._layout_sub_component_parent[child_id] = parent_id
34373
+
34374
+ this._mem_layout_insert_parent_root(parent_id, child_id, slot_name, at)
34184
34375
  }
34185
34376
 
34186
34377
  private _layout_layer_move_sub_component_child = (
@@ -34226,29 +34417,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34226
34417
  }
34227
34418
  }
34228
34419
 
34229
- private _layout_layer_move_sub_component_child_append = (
34230
- parent_id: string,
34231
- next_parent_id: string | null,
34232
- child_id: string
34233
- ): void => {
34234
- // console.log(
34235
- // 'Graph',
34236
- // '_layout_layer_move_sub_component_child',
34237
- // parent_id,
34238
- // next_parent_id,
34239
- // child_id
34240
- // )
34241
-
34242
- const next_index = this._get_component_children_count(next_parent_id)
34243
-
34244
- this._layout_layer_move_sub_component_child(
34245
- parent_id,
34246
- next_parent_id,
34247
- child_id,
34248
- next_index
34249
- )
34250
- }
34251
-
34252
34420
  private _ensure_parent_layout_layer = (
34253
34421
  sub_component_id: string
34254
34422
  ): LayoutLayer => {
@@ -34300,7 +34468,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34300
34468
  const parent_component = this._get_sub_component(parent_id)
34301
34469
  const child_component = this._get_sub_component(child_id)
34302
34470
 
34303
- const slot = this._get_sub_component_slot_name(child_id)
34471
+ const slot = this._spec_get_sub_component_slot_name(child_id)
34304
34472
 
34305
34473
  parent_component.appendParentRoot(child_component, slot)
34306
34474
  }
@@ -34313,7 +34481,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34313
34481
  // console.log('Graph', '_insert_sub_component_parent_root_at', unit_id)
34314
34482
  const parent_component = this._get_sub_component(parent_id)
34315
34483
  const child_component = this._get_sub_component(child_id)
34316
- const slot = this._get_sub_component_slot_name(child_id)
34484
+ const slot = this._spec_get_sub_component_slot_name(child_id)
34317
34485
  parent_component.insertParentRootAt(child_component, at, slot)
34318
34486
  }
34319
34487
 
@@ -34324,7 +34492,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34324
34492
  const sub_component = this._get_sub_component(sub_component_id)
34325
34493
  const sub_component_child = this._get_sub_component(child_id)
34326
34494
 
34327
- sub_component.removeParentRoot(sub_component_child)
34495
+ if (sub_component.$mountParentRoot.includes(sub_component_child)) {
34496
+ sub_component.removeParentRoot(sub_component_child)
34497
+ }
34328
34498
  }
34329
34499
 
34330
34500
  private _remove_sub_component_from_root = (
@@ -34334,7 +34504,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34334
34504
 
34335
34505
  const sub_component = this._get_sub_component(sub_component_id)
34336
34506
 
34337
- this._component.removeRoot(sub_component)
34507
+ if (this.$mountRoot.includes(sub_component)) {
34508
+ this._component.removeRoot(sub_component)
34509
+ }
34338
34510
  }
34339
34511
 
34340
34512
  private _layout_collapse_sub_component = (
@@ -34542,7 +34714,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34542
34714
  ): void => {
34543
34715
  if (parent_id) {
34544
34716
  appendSubComponentChild(
34545
- { parentId: parent_id, childId: child_id },
34717
+ { parentId: parent_id, childId: child_id, slotName: slot_name },
34546
34718
  this._spec.component
34547
34719
  )
34548
34720
 
@@ -34667,10 +34839,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34667
34839
  parent_id: string,
34668
34840
  slot_name: string,
34669
34841
  next_parent_id: string | null,
34670
- next_slot_name: string
34842
+ next_slot_name: string,
34843
+ emit: boolean,
34844
+ callback: Callback
34671
34845
  ): void => {
34672
- const children = this._spec_get_sub_component_children(parent_id)
34673
- const index = this._get_sub_component_index(parent_id)
34846
+ const children = clone(this._spec_get_sub_component_children(parent_id))
34847
+ const index = this._spec_get_sub_component_index(parent_id)
34674
34848
 
34675
34849
  const slot_map = this._get_sub_components_slot_map(children)
34676
34850
  const parent_map = this._get_sub_components_parent_map(children)
@@ -34686,39 +34860,71 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34686
34860
  )
34687
34861
  )
34688
34862
 
34689
- this._remove_sub_component_all_children(
34863
+ this._remove_sub_component_children(
34690
34864
  parent_id,
34691
34865
  slot_name,
34692
34866
  next_parent_id,
34693
- next_slot_name
34867
+ next_slot_name,
34868
+ children,
34869
+ emit,
34870
+ callback
34694
34871
  )
34695
34872
  }
34696
34873
 
34697
- private _remove_sub_component_all_children = (
34874
+ public remove_sub_component_children = (
34698
34875
  parent_id: string,
34699
34876
  slot_name: string,
34700
34877
  next_parent_id: string | null,
34701
- next_slot_name: string
34878
+ next_slot_name: string,
34879
+ children: string[],
34880
+ emit: boolean = true,
34881
+ callback: Callback
34702
34882
  ): void => {
34703
- const children = clone(this._spec_get_sub_component_children(parent_id))
34883
+ const prev_parent_id_map = {}
34884
+ const prev_slot_map = {}
34704
34885
 
34705
- this.remove_sub_component_children(
34886
+ const next_slot_map = {}
34887
+
34888
+ for (const child_id of children) {
34889
+ prev_parent_id_map[child_id] = parent_id
34890
+ prev_slot_map[child_id] = slot_name
34891
+
34892
+ next_slot_map[child_id] = next_slot_name
34893
+ }
34894
+
34895
+ const index = this._spec_get_sub_component_children_count(next_parent_id)
34896
+
34897
+ this._dispatch_action(
34898
+ makeMoveSubComponentRootAction(
34899
+ next_parent_id,
34900
+ prev_parent_id_map,
34901
+ children,
34902
+ index,
34903
+ next_slot_map,
34904
+ prev_slot_map
34905
+ )
34906
+ )
34907
+
34908
+ this._remove_sub_component_children(
34706
34909
  parent_id,
34707
34910
  slot_name,
34708
34911
  next_parent_id,
34709
34912
  next_slot_name,
34710
- children
34913
+ children,
34914
+ emit,
34915
+ callback
34711
34916
  )
34712
34917
  }
34713
34918
 
34714
- private remove_sub_component_children = (
34919
+ private _remove_sub_component_children = (
34715
34920
  parent_id: string,
34716
34921
  slot_name: string,
34717
34922
  next_parent_id: string | null,
34718
34923
  next_slot_name: string,
34719
34924
  children: string[],
34720
- emit: boolean = true
34721
- ): void => {
34925
+ emit: boolean = true,
34926
+ callback: Callback
34927
+ ): Unlisten => {
34722
34928
  let { animate } = this._config()
34723
34929
 
34724
34930
  const parent_visible = this._is_layout_component_layer_visible(parent_id)
@@ -34729,15 +34935,69 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34729
34935
 
34730
34936
  const { x, y, width, height } = layout_parent_node
34731
34937
 
34732
- const parent_index = this._get_sub_component_index(parent_id)
34938
+ const all_stop: Unlisten[] = []
34939
+
34940
+ const parent_index = this._spec_get_sub_component_index(parent_id)
34941
+
34942
+ for (const child_id of children) {
34943
+ this._cancel_sub_component_base_animation(child_id)
34944
+ }
34945
+
34946
+ this._cancel_layout_parent_children_animation(parent_id, slot_name)
34733
34947
 
34734
34948
  this._measure_sub_component_base(parent_id)
34735
34949
 
34950
+ let finish = NOOP
34951
+
34952
+ let finish_parent = () => {
34953
+ this._cancel_parent_animation(parent_id)
34954
+ this._cancel_sub_component_base_animation(parent_id)
34955
+
34956
+ this._unplug_sub_component_root_base_frame(parent_id)
34957
+ this._append_sub_component_root_base(parent_id)
34958
+ this._enter_sub_component_frame(parent_id)
34959
+ }
34960
+
34961
+ let finish_children = () => {
34962
+ this._end_layout_sub_component_transfer_children_animation(
34963
+ parent_id,
34964
+ slot_name
34965
+ )
34966
+
34967
+ for (const child_id of children) {
34968
+ this._cancel_layout_child_transfer_animation(child_id)
34969
+
34970
+ this._enter_sub_component_frame(child_id)
34971
+ this._append_sub_component_base(child_id)
34972
+ }
34973
+ }
34974
+
34975
+ if (animate) {
34976
+ finish = () => {
34977
+ callAll(all_stop)
34978
+
34979
+ if (!parent_animation_finished) {
34980
+ parent_animation_finished = true
34981
+
34982
+ finish_parent()
34983
+ }
34984
+
34985
+ if (!children_animation_finished) {
34986
+ children_animation_finished = true
34987
+
34988
+ finish_children()
34989
+ }
34990
+
34991
+ callback()
34992
+ }
34993
+ }
34994
+
34736
34995
  let i = parent_index + 1
34737
34996
 
34738
- for (const child_id of children) {
34739
- this._cancel_sub_component_base_animation(child_id)
34997
+ let parent_animation_finished = false
34998
+ let children_animation_finished = false
34740
34999
 
35000
+ for (const child_id of children) {
34741
35001
  this._layout_layer_move_sub_component_child(
34742
35002
  parent_id,
34743
35003
  next_parent_id,
@@ -34757,7 +35017,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34757
35017
 
34758
35018
  if (this._tree_layout) {
34759
35019
  for (const child_id of children) {
34760
- if (!this._animating_sub_component_base_id.has(child_id)) {
35020
+ if (!this._is_sub_component_animating(child_id)) {
34761
35021
  if (!this._is_layout_component_layer_visible(parent_id)) {
34762
35022
  this._remove_sub_component_parent_root(parent_id, child_id)
34763
35023
  } else {
@@ -34771,8 +35031,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34771
35031
  }
34772
35032
  }
34773
35033
 
34774
- this._cancel_layout_parent_children_animation(parent_id, slot_name)
34775
-
34776
35034
  if (this._tree_layout) {
34777
35035
  if (animate) {
34778
35036
  this._setup_layout_sub_component_remove_parent_children_animation(
@@ -34817,12 +35075,11 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34817
35075
  if (this._tree_layout) {
34818
35076
  if (animate) {
34819
35077
  const parent_animating = this._is_sub_component_animating(parent_id)
35078
+ const parent_layer = this._get_sub_component_layout_layer(parent_id)
34820
35079
 
34821
35080
  const parent_leaf_traits = []
34822
35081
 
34823
- const parent_layer = this._get_sub_component_layout_layer(parent_id)
34824
-
34825
- const stop = this._animate_parent_component(
35082
+ const stop_parent_animation = this._animate_parent_component(
34826
35083
  parent_id,
34827
35084
  parent_animating,
34828
35085
  parent_animating,
@@ -34832,37 +35089,34 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34832
35089
  false,
34833
35090
  () => ({ x: 0, y: -parent_layer.content.$element.scrollTop }),
34834
35091
  () => {
34835
- stop()
35092
+ stop_parent_animation()
34836
35093
 
34837
- this._unplug_sub_component_root_base_frame(parent_id)
34838
- this._append_sub_component_root_base(parent_id)
34839
- this._enter_sub_component_frame(parent_id)
35094
+ parent_animation_finished = true
34840
35095
 
34841
- return true
35096
+ finish_parent()
34842
35097
  }
34843
35098
  )
34844
35099
 
35100
+ all_stop.push(stop_parent_animation)
35101
+
34845
35102
  this._animate_all_layout_layer_node(next_parent_id)
34846
35103
 
34847
- const stop_ = this._play_layout_sub_component_remove_children_animation(
34848
- parent_id,
34849
- slot_name,
34850
- children,
34851
- true,
34852
- () => {
34853
- stop_()
35104
+ const stop_children_animation =
35105
+ this._play_layout_sub_component_remove_children_animation(
35106
+ parent_id,
35107
+ slot_name,
35108
+ children,
35109
+ true,
35110
+ () => {
35111
+ stop_children_animation()
34854
35112
 
34855
- this._end_layout_sub_component_transfer_children_animation(
34856
- parent_id,
34857
- slot_name
34858
- )
35113
+ children_animation_finished = true
34859
35114
 
34860
- for (const child_id of children) {
34861
- this._enter_sub_component_frame(child_id)
34862
- this._append_sub_component_base(child_id)
35115
+ finish_children()
34863
35116
  }
34864
- }
34865
- )
35117
+ )
35118
+
35119
+ all_stop.push(stop_children_animation)
34866
35120
  } else {
34867
35121
  if (!parent_visible) {
34868
35122
  for (const child_id of children) {
@@ -34874,6 +35128,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34874
35128
  this._force_layout_node_traits(next_parent_id)
34875
35129
  }
34876
35130
  }
35131
+
35132
+ if (!animate) {
35133
+ callback()
35134
+ }
35135
+
35136
+ return finish
34877
35137
  }
34878
35138
 
34879
35139
  private _pre_remove_sub_component_child = (
@@ -34945,17 +35205,14 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34945
35205
  parent_id: string,
34946
35206
  next_parent_id: string | null
34947
35207
  ): void => {
35208
+ // console.log('_sim_move_out_sub_component_layout_children', parent_id)
35209
+
34948
35210
  const children = this._spec_get_sub_component_children(parent_id)
34949
- const parent_index = this._get_sub_component_index(parent_id)
35211
+ const parent_index = this._spec_get_sub_component_index(parent_id)
34950
35212
 
34951
35213
  let i = parent_index
34952
35214
 
34953
35215
  for (const child_id of children) {
34954
- this._layout_mem_move_sub_component_child(
34955
- parent_id,
34956
- child_id,
34957
- next_parent_id
34958
- )
34959
35216
  this._layout_layer_move_sub_component_child(
34960
35217
  parent_id,
34961
35218
  next_parent_id,
@@ -34975,6 +35232,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34975
35232
  const child_component = this._get_sub_component(child_id)
34976
35233
 
34977
35234
  parent_component.removeParentRoot(child_component)
35235
+
35236
+ this._layout_mem_move_sub_component_child(parent_id, child_id, null)
34978
35237
  }
34979
35238
 
34980
35239
  private _mem_move_out_sub_component_child = (
@@ -34985,6 +35244,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
34985
35244
  ) => {
34986
35245
  this._mem_pull_sub_component_child(parent_id, child_id)
34987
35246
 
35247
+ this._layout_mem_move_sub_component_child(
35248
+ parent_id,
35249
+ child_id,
35250
+ next_parent_id
35251
+ )
35252
+
34988
35253
  if (next_parent_id) {
34989
35254
  this._mem_insert_sub_component_child(
34990
35255
  next_parent_id,
@@ -35060,7 +35325,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
35060
35325
 
35061
35326
  let i = 0
35062
35327
 
35063
- const parent_index = this._get_sub_component_index(parent_id)
35328
+ const parent_index = this._spec_get_sub_component_index(parent_id)
35064
35329
 
35065
35330
  for (const child_id of [...children]) {
35066
35331
  this._spec_move_sub_component_child(
@@ -35107,7 +35372,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
35107
35372
 
35108
35373
  if (next_parent_id) {
35109
35374
  insertSubComponentChild(
35110
- { parentId: next_parent_id, childId: child_id, at: next_index },
35375
+ {
35376
+ parentId: next_parent_id,
35377
+ childId: child_id,
35378
+ slotName: next_slot_id,
35379
+ at: next_index,
35380
+ },
35111
35381
  this._spec.component
35112
35382
  )
35113
35383
 
@@ -35223,11 +35493,13 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
35223
35493
 
35224
35494
  const next_parent_id = this._get_current_layout_layer_id()
35225
35495
 
35226
- this._remove_sub_component_all_children(
35496
+ this.remove_sub_component_all_children(
35227
35497
  node_id,
35228
35498
  'default',
35229
35499
  next_parent_id,
35230
- 'default'
35500
+ 'default',
35501
+ true,
35502
+ () => {}
35231
35503
  )
35232
35504
 
35233
35505
  this.deselect_node(node_id)
@@ -35619,7 +35891,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
35619
35891
  const parent_id =
35620
35892
  this._spec_get_sub_component_parent_id(selected_node_id)
35621
35893
 
35622
- const parent_index = this._get_sub_component_index(selected_node_id)
35894
+ const parent_index =
35895
+ this._spec_get_sub_component_index(selected_node_id)
35623
35896
 
35624
35897
  if (parent_id !== unit_id) {
35625
35898
  this._collapse_animation_next_parent[selected_node_id] = unit_id
@@ -35869,7 +36142,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
35869
36142
 
35870
36143
  actions.push(this._make_remove_unit_action(unit_id, bundle, true, true))
35871
36144
  actions.push(
35872
- this._make_add_unit_action(next_unit_id, new_bundle, merges_, plugs)
36145
+ this._make_add_unit_bundle_action(
36146
+ next_unit_id,
36147
+ new_bundle,
36148
+ merges_,
36149
+ plugs
36150
+ )
35873
36151
  )
35874
36152
  actions.push(this._make_add_bundle_datum_action(datum_id, bundle))
35875
36153
 
@@ -35892,7 +36170,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
35892
36170
  this._pod.$bulkEdit({ actions, fork, bubble })
35893
36171
  }
35894
36172
 
35895
- private _make_add_unit_action = (
36173
+ private _make_add_unit_bundle_action = (
35896
36174
  unit_id: string,
35897
36175
  bundle: UnitBundleSpec,
35898
36176
  merges: GraphUnitMerges,
@@ -36168,7 +36446,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
36168
36446
  merged_pin_ids,
36169
36447
  merge_pin_index,
36170
36448
  exposed_pin_ids,
36171
- exposed_pin_index
36449
+ exposed_pin_index,
36450
+ null,
36451
+ null,
36452
+ null,
36453
+ null,
36454
+ null
36172
36455
  )
36173
36456
 
36174
36457
  const { x, y, width, height } = this._node[new_unit_id]
@@ -36391,13 +36674,13 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
36391
36674
  let sub_component_map: Dict<Component> = {}
36392
36675
 
36393
36676
  if (this._is_unit_component(unit_id)) {
36677
+ const sub_component = this._get_sub_component(unit_id)
36678
+
36394
36679
  this._decompose_sub_component(unit_id)
36395
36680
  this._displace_sub_component(unit_id)
36396
36681
  this._decouple_sub_component(unit_id)
36397
-
36398
- const sub_component = this._get_sub_component(unit_id)
36399
-
36400
- this._component.removeSubComponent(unit_id)
36682
+ this._pull_sub_component(unit_id)
36683
+ this._remove_sub_component(unit_id)
36401
36684
 
36402
36685
  for (const sub_sub_component_id in sub_component.$subComponent) {
36403
36686
  const sub_sub_component =
@@ -36405,10 +36688,17 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
36405
36688
 
36406
36689
  const next_sub_sub_component_id = deepGetOrDefault(
36407
36690
  map,
36408
- ['mappaing', 'unit', sub_sub_component_id, 'in', 'unit', 'unitId'],
36691
+ ['mapping', 'unit', sub_sub_component_id, 'in', 'unit', 'unitId'],
36409
36692
  sub_sub_component_id
36410
36693
  )
36411
36694
 
36695
+ const sub_sub_component_parent =
36696
+ sub_component.getSubComponentParent(sub_sub_component_id)
36697
+
36698
+ if (sub_sub_component_parent) {
36699
+ sub_sub_component_parent.pullParentRoot(sub_sub_component)
36700
+ }
36701
+
36412
36702
  sub_component_map[next_sub_sub_component_id] = sub_sub_component
36413
36703
  }
36414
36704
  }
@@ -37084,6 +37374,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
37084
37374
  const scroll_top = parent_layer.content.$element.scrollTop
37085
37375
 
37086
37376
  const finish = () => {
37377
+ this._cancel_parent_animation(sub_component_id)
37378
+ this._cancel_sub_component_base_animation(sub_component_id)
37379
+
37087
37380
  stop_parent_animation()
37088
37381
  stop_children_animation()
37089
37382
 
@@ -37097,6 +37390,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
37097
37390
  )
37098
37391
 
37099
37392
  for (const child_id of children) {
37393
+ this._cancel_layout_child_transfer_animation(child_id)
37394
+
37100
37395
  this._enter_sub_component_frame(child_id)
37101
37396
  this._append_sub_component_base(child_id)
37102
37397
  }
@@ -37110,7 +37405,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
37110
37405
  }
37111
37406
 
37112
37407
  for (const child_id of children) {
37113
- if (!this._animating_sub_component_base_id.has(child_id)) {
37408
+ if (!this._is_sub_component_animating(child_id)) {
37114
37409
  this._remove_sub_component_parent_root(sub_component_id, child_id)
37115
37410
  this._remove_sub_component_root_base(child_id)
37116
37411
  }
@@ -41332,7 +41627,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41332
41627
  pull_from_parent: boolean = true,
41333
41628
  destroy: boolean = true
41334
41629
  ): void => {
41335
- // console.log('Graph', '_sim_remove_component', unit_id, remove_roots)
41630
+ // console.log('Graph', '_sim_remove_component', unit_id)
41336
41631
 
41337
41632
  const collapsing = this._collapse_init_node_id_set.has(unit_id)
41338
41633
 
@@ -41348,9 +41643,18 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41348
41643
 
41349
41644
  this._cancel_parent_animation(unit_id)
41350
41645
  this._cancel_layout_core_animation(unit_id)
41646
+ this._cancel_layout_child_transfer_animation(unit_id)
41647
+ this._cancel_layout_parent_children_all_slot_animation(unit_id)
41648
+ this._cancel_sub_component_base_animation(unit_id)
41351
41649
  this._cancel_enter_sub_component_animation(unit_id)
41352
41650
  this._cancel_leave_sub_component_animation(unit_id)
41353
41651
 
41652
+ if (animating) {
41653
+ const base = this._get_sub_component_base(unit_id)
41654
+
41655
+ this._unplug_base_frame(unit_id, base)
41656
+ }
41657
+
41354
41658
  if (this._tree_layout) {
41355
41659
  if (children.length > 0) {
41356
41660
  for (const child_id of children) {
@@ -41365,7 +41669,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41365
41669
  if (this._in_component_control) {
41366
41670
  if (displace) {
41367
41671
  if (!animating) {
41368
- this._displace_sub_component(unit_id)
41672
+ if (this._tree_layout) {
41673
+ this._decouple_sub_component(unit_id)
41674
+ this._pull_sub_component(unit_id)
41675
+ } else {
41676
+ this._displace_sub_component(unit_id)
41677
+ }
41369
41678
  }
41370
41679
  }
41371
41680
  }
@@ -41389,53 +41698,78 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41389
41698
  }
41390
41699
  }
41391
41700
 
41392
- if (this._animating_sub_component_base_id.has(unit_id)) {
41701
+ if (this._is_sub_component_animating(unit_id)) {
41393
41702
  this._unplug_sub_component_base_frame(unit_id)
41703
+ }
41704
+
41705
+ if (this._layout_path.includes(unit_id)) {
41706
+ const index = this._layout_path.indexOf(unit_id)
41707
+
41708
+ let i = this._layout_path.length - 1
41709
+
41710
+ while (i >= index) {
41711
+ this._layout_leave_sub_component(false)
41394
41712
 
41395
- this._animating_sub_component_base_id.delete(unit_id)
41713
+ i--
41714
+ }
41396
41715
  }
41397
41716
 
41398
41717
  if (this._tree_layout) {
41399
41718
  if (children.length > 0) {
41400
- const current_layer = this._get_current_layout_layer_id()
41401
-
41402
- const current_slot = 'default'
41719
+ const parent_id = this._spec_get_sub_component_parent_id(unit_id)
41720
+ const parent_index = this._spec_get_sub_component_index(unit_id)
41721
+ const parent_slot = this._spec_get_sub_component_slot_name(unit_id)
41403
41722
 
41404
- const parent_index = this._get_sub_component_index(unit_id)
41723
+ for (const child_id of children) {
41724
+ this._remove_sub_component_child(unit_id, child_id)
41725
+ }
41405
41726
 
41406
41727
  let at = parent_index
41407
41728
 
41408
41729
  for (const child_id of children) {
41409
- this._remove_sub_component_child(unit_id, child_id)
41410
- this._remove_sub_component_root_base(child_id)
41411
-
41412
41730
  this._mem_insert_sub_component_child(
41413
- current_layer,
41731
+ parent_id,
41414
41732
  child_id,
41415
- current_slot,
41416
- at
41733
+ parent_slot,
41734
+ parent_index + at
41417
41735
  )
41418
41736
 
41419
41737
  at++
41420
41738
  }
41421
41739
 
41422
- this._animate_layout_sub_component_remove_children(
41423
- unit_id,
41424
- 'default',
41425
- children,
41426
- false,
41427
- () => {
41428
- this._end_layout_sub_component_transfer_children_animation(
41429
- unit_id,
41430
- 'default'
41431
- )
41740
+ if (this._is_layout_parent_visible(unit_id)) {
41741
+ for (const child_id of children) {
41742
+ this._remove_sub_component_root_base(child_id)
41743
+ }
41432
41744
 
41433
- for (const child_id of children) {
41434
- this._append_sub_component_base(child_id)
41435
- this._enter_sub_component_frame(child_id)
41745
+ this._animate_layout_sub_component_remove_children(
41746
+ unit_id,
41747
+ 'default',
41748
+ children,
41749
+ false,
41750
+ () => {
41751
+ this._cancel_layout_parent_children_all_slot_animation(unit_id)
41752
+
41753
+ for (const child_id of children) {
41754
+ this._cancel_layout_child_transfer_animation(child_id)
41755
+ }
41756
+
41757
+ this._end_layout_sub_component_transfer_children_animation(
41758
+ unit_id,
41759
+ 'default'
41760
+ )
41761
+
41762
+ for (const child_id of children) {
41763
+ this._append_sub_component_base(child_id)
41764
+ this._enter_sub_component_frame(child_id)
41765
+ }
41436
41766
  }
41767
+ )
41768
+ } else {
41769
+ for (const child_id of children) {
41770
+ this._insert_sub_component_child(parent_id, child_id)
41437
41771
  }
41438
- )
41772
+ }
41439
41773
  }
41440
41774
  }
41441
41775
 
@@ -41452,7 +41786,12 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41452
41786
  this._sim_move_out_sub_component_children(unit_id, parent_id)
41453
41787
  }
41454
41788
 
41455
- this._sim_remove_sub_component_roots(unit_id)
41789
+ const sub_component = this._get_sub_component(unit_id)
41790
+
41791
+ if (sub_component) {
41792
+ this._pull_sub_component(unit_id)
41793
+ this._remove_sub_component(unit_id)
41794
+ }
41456
41795
  }
41457
41796
 
41458
41797
  this._sim_remove_layout_core(unit_id)
@@ -41502,19 +41841,10 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41502
41841
  delete this._resize_component_start_size[unit_id]
41503
41842
  }
41504
41843
 
41505
- private _sim_remove_sub_component_roots = (unit_id: string) => {
41844
+ private _pull_sub_component = (unit_id: string) => {
41506
41845
  const sub_component = this._get_sub_component(unit_id)
41507
41846
 
41508
41847
  if (sub_component) {
41509
- if (
41510
- this._abort_sub_component_enter_base_animation[unit_id] ||
41511
- this._abort_sub_component_leave_base_animation[unit_id]
41512
- ) {
41513
- const base = this._get_sub_component_base(unit_id)
41514
-
41515
- this._unplug_base_frame(unit_id, base)
41516
- }
41517
-
41518
41848
  const sub_component_parent_id =
41519
41849
  this._spec_get_sub_component_parent_id(unit_id)
41520
41850
 
@@ -41525,19 +41855,25 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41525
41855
  if (sub_component_parent_id) {
41526
41856
  if (parent_sub_component.hasParentRoot(sub_component)) {
41527
41857
  parent_sub_component.pullParentRoot(sub_component)
41858
+
41859
+ this._layout_mem_move_sub_component_child(
41860
+ sub_component_parent_id,
41861
+ unit_id,
41862
+ null
41863
+ )
41528
41864
  }
41529
41865
  } else {
41530
41866
  if (this._component.hasRoot(sub_component)) {
41531
41867
  this._component.pullRoot(sub_component)
41532
41868
  }
41533
41869
  }
41534
-
41535
- this._component.removeSubComponent(unit_id)
41536
-
41537
- sub_component.destroy()
41538
41870
  }
41539
41871
  }
41540
41872
 
41873
+ private _remove_sub_component = (unit_id: string) => {
41874
+ this._component.removeSubComponent(unit_id)
41875
+ }
41876
+
41541
41877
  private _sim_remove_layout_core = (unit_id: string): void => {
41542
41878
  // console.log('Graph', '_sim_remove_layout_core', unit_id)
41543
41879
 
@@ -41556,14 +41892,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
41556
41892
  }
41557
41893
  }
41558
41894
 
41559
- const layout_parent_id = this._layout_sub_component_parent[unit_id] || null
41560
- if (layout_parent_id) {
41561
- this._refresh_component_children_counter_up(
41562
- layout_parent_id,
41563
- -(1 + (this._layout_component_count[unit_id] || 0))
41564
- )
41565
- }
41566
-
41567
41895
  delete this._layout_core[unit_id]
41568
41896
  }
41569
41897
 
@@ -43177,7 +43505,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
43177
43505
 
43178
43506
  parent_sub_component.pullParentRoot(sub_component)
43179
43507
 
43180
- const slot = this._get_sub_component_slot_name(unit_id)
43508
+ const slot = this._spec_get_sub_component_slot_name(unit_id)
43181
43509
 
43182
43510
  parent_sub_component.placeParentRoot(sub_component, i, slot)
43183
43511
 
@@ -46614,6 +46942,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
46614
46942
  bundle,
46615
46943
  null,
46616
46944
  null,
46945
+ null,
46617
46946
  position,
46618
46947
  pin_position,
46619
46948
  layout_position
@@ -47714,12 +48043,14 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
47714
48043
  },
47715
48044
  } = this.$system
47716
48045
 
48046
+ const { animate } = this._config()
48047
+
47717
48048
  if (this._tree_layout) {
47718
48049
  const current_layout_layer = this._get_current_layout_layer_id()
47719
48050
 
47720
48051
  if (current_layout_layer) {
47721
48052
  if (this._mode === 'none') {
47722
- this._animate_layout_leave_sub_component()
48053
+ this._layout_leave_sub_component(animate)
47723
48054
  }
47724
48055
  }
47725
48056
  } else {
@@ -48110,6 +48441,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
48110
48441
  new_unit_bundle,
48111
48442
  lowest_common_ancestor,
48112
48443
  undefined,
48444
+ undefined,
48113
48445
  { x, y },
48114
48446
  { input: {}, output: {} },
48115
48447
  { x: 0, y: 0 },
@@ -48228,6 +48560,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
48228
48560
  undefined,
48229
48561
  undefined,
48230
48562
  undefined,
48563
+ undefined,
48231
48564
  position
48232
48565
  )
48233
48566
  )
@@ -49110,6 +49443,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
49110
49443
  bundle,
49111
49444
  null,
49112
49445
  null,
49446
+ null,
49113
49447
  position,
49114
49448
  undefined,
49115
49449
  layout_position
@@ -50135,7 +50469,9 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
50135
50469
  slot_name,
50136
50470
  next_parent_id,
50137
50471
  next_slot_name,
50138
- selected_children
50472
+ selected_children,
50473
+ true,
50474
+ () => {}
50139
50475
  )
50140
50476
 
50141
50477
  this._refresh_layout_node_target_position(parent_id)
@@ -51746,13 +52082,13 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
51746
52082
 
51747
52083
  at = children.indexOf(unit_id)
51748
52084
 
51749
- this._spec_insert_component(parent_id, unit_id, at)
52085
+ this._spec_insert_component(parent_id, unit_id, 'default', at)
51750
52086
  } else {
51751
52087
  const children = graph.component?.children ?? []
51752
52088
 
51753
52089
  at = children.indexOf(unit_id)
51754
52090
 
51755
- this._spec_insert_component(null, unit_id, at)
52091
+ this._spec_insert_component(null, unit_id, 'default', at)
51756
52092
  }
51757
52093
  }
51758
52094
 
@@ -51763,14 +52099,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
51763
52099
 
51764
52100
  this._sim_add_core_component(unit_id, parent_id, layout_position)
51765
52101
 
51766
- mount &&
51767
- this._sim_add_sub_component(
51768
- unit_id,
51769
- undefined,
51770
- undefined,
51771
- undefined,
51772
- false
51773
- )
52102
+ mount && this._sim_add_sub_component(unit_id, undefined, undefined, false)
51774
52103
  }
51775
52104
 
51776
52105
  const sub_component_ids = keys(subComponents)
@@ -51780,7 +52109,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
51780
52109
 
51781
52110
  if (mount) {
51782
52111
  for (const unit_id of ordered_sub_component_ids) {
51783
- this._sim_add_sub_component_to_parent(unit_id, undefined)
52112
+ this._sim_add_sub_component_to_parent(unit_id)
51784
52113
  }
51785
52114
  }
51786
52115
 
@@ -51882,16 +52211,18 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
51882
52211
 
51883
52212
  const index = this._get_component_children_count(sub_component_id)
51884
52213
 
51885
- bulk_actions.push(
51886
- makeMoveSubComponentRootAction(
51887
- sub_component_id,
51888
- {},
51889
- children,
51890
- index,
51891
- {},
51892
- {}
52214
+ if (children.length) {
52215
+ bulk_actions.push(
52216
+ makeMoveSubComponentRootAction(
52217
+ sub_component_id,
52218
+ {},
52219
+ children,
52220
+ index,
52221
+ {},
52222
+ {}
52223
+ )
51893
52224
  )
51894
- )
52225
+ }
51895
52226
  }
51896
52227
 
51897
52228
  for (const merge_id in merges) {
@@ -52151,6 +52482,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
52151
52482
  data_.unitId,
52152
52483
  data_.bundle,
52153
52484
  parentId,
52485
+ data_.parentSlot,
52154
52486
  data_.parentIndex,
52155
52487
  data_.position,
52156
52488
  data_.pinPosition,
@@ -52165,6 +52497,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
52165
52497
  null,
52166
52498
  null,
52167
52499
  data_.parentId,
52500
+ data_.parentSlot,
52168
52501
  data_.parentIndex,
52169
52502
  null,
52170
52503
  null,
@@ -52186,7 +52519,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
52186
52519
  data_.unitId,
52187
52520
  sub_component,
52188
52521
  undefined,
52189
- undefined,
52190
52522
  true
52191
52523
  )
52192
52524
 
@@ -52205,18 +52537,24 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
52205
52537
 
52206
52538
  const children = data_.children ?? []
52207
52539
  const childrenSlot = data_.childrenSlot ?? {}
52540
+ const prevParentIdMap =
52541
+ this._get_sub_components_parent_map(children)
52542
+ const prevSlotMap = this._get_sub_components_slot_map(children)
52208
52543
 
52209
52544
  if (this._tree_layout) {
52210
52545
  const animate = children.length > 0
52211
52546
 
52212
- const finish = this._move_sub_component_root(
52213
- data_.unitId,
52214
- children,
52215
- 'default',
52216
- animate,
52547
+ const finish = this._on_move_sub_component_root(
52548
+ {
52549
+ parentId: data_.unitId,
52550
+ slotMap: childrenSlot,
52551
+ children,
52552
+ prevParentIdMap,
52553
+ prevSlotMap,
52554
+ index: 0,
52555
+ },
52556
+ emit,
52217
52557
  () => {
52218
- this._animate_all_current_layout_layer_node()
52219
-
52220
52558
  this._force_finish_last_action = undefined
52221
52559
  }
52222
52560
  )
@@ -52350,7 +52688,15 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
52350
52688
  }
52351
52689
  case MOVE_SUB_COMPONENT_ROOT:
52352
52690
  {
52353
- this._on_move_sub_component_root(data, emit)
52691
+ const finish = this._on_move_sub_component_root(data, emit, () => {
52692
+ this._force_finish_last_action = undefined
52693
+ })
52694
+
52695
+ this._force_finish_last_action = () => {
52696
+ finish()
52697
+
52698
+ this._force_finish_last_action = undefined
52699
+ }
52354
52700
  }
52355
52701
  break
52356
52702
  case SET_UNIT_PIN_CONSTANT:
@@ -53258,19 +53604,24 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
53258
53604
  }
53259
53605
  }
53260
53606
 
53261
- private _get_sub_component_children_slot = (sub_component_id: string) => {
53607
+ private _spec_get_sub_component_children_slot = (
53608
+ sub_component_id: string
53609
+ ) => {
53262
53610
  const children = this._spec_get_sub_component_children(sub_component_id)
53263
53611
 
53264
53612
  const children_slot_map = {}
53265
53613
 
53266
53614
  for (const child_id of children) {
53267
- children_slot_map[child_id] = this._get_sub_component_slot_name(child_id)
53615
+ children_slot_map[child_id] =
53616
+ this._spec_get_sub_component_slot_name(child_id)
53268
53617
  }
53269
53618
 
53270
53619
  return children_slot_map
53271
53620
  }
53272
53621
 
53273
- private _get_sub_component_slot_name = (sub_component_id: string): string => {
53622
+ private _spec_get_sub_component_slot_name = (
53623
+ sub_component_id: string
53624
+ ): string => {
53274
53625
  const parent_id = this._spec_get_sub_component_parent_id(sub_component_id)
53275
53626
 
53276
53627
  if (parent_id) {
@@ -53296,7 +53647,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
53296
53647
  // )
53297
53648
 
53298
53649
  if (!this._is_fullwindow) {
53299
- const slot = this._get_sub_component_slot_name(sub_component_id)
53650
+ const slot = this._spec_get_sub_component_slot_name(sub_component_id)
53300
53651
  const i = this._spec_get_sub_component_parent_root_index(sub_component_id)
53301
53652
 
53302
53653
  this.__insert_sub_component_child(parent_id, sub_component_id, slot, i)
@@ -53316,20 +53667,6 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
53316
53667
  }
53317
53668
  }
53318
53669
 
53319
- private _mem_push_sub_component = (
53320
- parent_id: string | null,
53321
- child_id: string,
53322
- slot_name: string
53323
- ) => {
53324
- // console.log('Graph', '_mem_push_sub_component', parent_id, child_id, slot_name)
53325
-
53326
- if (parent_id === null) {
53327
- this._mem_push_root(child_id)
53328
- } else {
53329
- this._mem_push_parent_child(parent_id, child_id, slot_name)
53330
- }
53331
- }
53332
-
53333
53670
  private _mem_insert_sub_component_child = (
53334
53671
  parent_id: string,
53335
53672
  child_id: string,
@@ -53366,7 +53703,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
53366
53703
  const sub_component = this._get_sub_component(sub_component_id)
53367
53704
 
53368
53705
  if (!this._is_fullwindow) {
53369
- const slot = this._get_sub_component_slot_name(sub_component_id)
53706
+ const slot = this._spec_get_sub_component_slot_name(sub_component_id)
53370
53707
  const i = this._spec_get_sub_component_parent_root_index(sub_component_id)
53371
53708
 
53372
53709
  if (parent_component.$mountParentRoot.length > i) {
@@ -53392,7 +53729,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
53392
53729
  const sub_component = this._get_sub_component(sub_component_id)
53393
53730
 
53394
53731
  if (!this._is_fullwindow) {
53395
- const slot = this._get_sub_component_slot_name(sub_component_id)
53732
+ const slot = this._spec_get_sub_component_slot_name(sub_component_id)
53396
53733
  const i = this._spec_get_sub_component_parent_root_index(sub_component_id)
53397
53734
 
53398
53735
  if (parent_component.$mountParentRoot.length > i) {
@@ -55294,7 +55631,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
55294
55631
  // console.log('Graph', '_componentify_core', unit_id)
55295
55632
 
55296
55633
  this._set_core_shape(unit_id, 'rect')
55297
- this._spec_append_component(null, unit_id)
55634
+ this._spec_append_component(null, unit_id, 'default')
55298
55635
 
55299
55636
  this._sim_add_core_component(unit_id, null, { x: 0, y: 0 })
55300
55637
 
@@ -55376,7 +55713,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
55376
55713
  this._spec_add_unit(unitId, unit, specs_)
55377
55714
 
55378
55715
  if (this._is_unit_component(unitId)) {
55379
- this._spec_append_component(null, unitId)
55716
+ this._spec_append_component(null, unitId, 'default')
55380
55717
  }
55381
55718
 
55382
55719
  this._sim_add_unit(
@@ -55553,6 +55890,7 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
55553
55890
  plugs: plugss = {},
55554
55891
  parentId,
55555
55892
  parentIndex,
55893
+ parentSlot,
55556
55894
  children = [],
55557
55895
  childrenSlot = {},
55558
55896
  } = data
@@ -55613,12 +55951,17 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
55613
55951
  if (parentId) {
55614
55952
  if (parentIndex === null || parentIndex === undefined) {
55615
55953
  appendSubComponentChild(
55616
- { parentId, childId: unitId },
55954
+ { parentId, childId: unitId, slotName: parentSlot },
55617
55955
  next_spec.component
55618
55956
  )
55619
55957
  } else {
55620
55958
  insertSubComponentChild(
55621
- { parentId, childId: unitId, at: parentIndex },
55959
+ {
55960
+ parentId,
55961
+ childId: unitId,
55962
+ slotName: parentSlot,
55963
+ at: parentIndex,
55964
+ },
55622
55965
  next_spec.component
55623
55966
  )
55624
55967
  }
@@ -56609,17 +56952,44 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
56609
56952
 
56610
56953
  private _on_move_sub_component_root = (
56611
56954
  data: GraphMoveSubComponentRootData,
56612
- emit: boolean = true
56613
- ) => {
56955
+ emit: boolean = true,
56956
+ callback: Callback
56957
+ ): Unlisten => {
56614
56958
  const { fork, bubble } = this.$props
56615
56959
 
56616
- if (data.parentId) {
56617
- if (this._tree_layout) {
56618
- this._move_sub_component_root(
56960
+ let unlisten: Unlisten
56961
+
56962
+ const prevParentId = data.prevParentIdMap[data.children[0]] ?? null
56963
+ const prevSlotName = data.prevSlotMap[data.children[0]] ?? 'default'
56964
+ const parentId = data.parentId
56965
+ const slotName = data.slotMap[data.children[0]] ?? 'default'
56966
+ const children = data.children
56967
+
56968
+ if (this._tree_layout) {
56969
+ if (
56970
+ !data.parentId ||
56971
+ this._is_layout_component_layer_visible(data.parentId)
56972
+ ) {
56973
+ unlisten = this._remove_sub_component_children(
56974
+ prevParentId,
56975
+ prevSlotName,
56976
+ parentId,
56977
+ slotName,
56978
+ children,
56979
+ emit,
56980
+ callback
56981
+ )
56982
+ } else if (
56983
+ data.parentId &&
56984
+ this._is_layout_parent_visible(data.parentId)
56985
+ ) {
56986
+ unlisten = this._layout_move_sub_component_root(
56619
56987
  data.parentId,
56620
56988
  data.children,
56621
56989
  'default',
56622
- true
56990
+ true,
56991
+ emit,
56992
+ callback
56623
56993
  )
56624
56994
  } else {
56625
56995
  let i = 0
@@ -56628,11 +56998,22 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
56628
56998
  const slot_name = data.slotMap?.[child_id] ?? 'default'
56629
56999
  const prev_parent_id = data.prevParentIdMap?.[child_id] ?? null
56630
57000
 
57001
+ if (this._is_layout_parent_visible(child_id) || !prev_parent_id) {
57002
+ this._leave_sub_component_frame(child_id)
57003
+ } else {
57004
+ this._decouple_sub_component(child_id)
57005
+ }
57006
+
57007
+ this._pull_sub_component(child_id)
57008
+
56631
57009
  this._state_pre_append_sub_component_child(
56632
57010
  data.parentId,
56633
57011
  child_id,
56634
57012
  slot_name
56635
57013
  )
57014
+
57015
+ this._append_sub_component_parent_root(data.parentId, child_id)
57016
+
56636
57017
  this._layout_layer_move_sub_component_child(
56637
57018
  prev_parent_id,
56638
57019
  data.parentId,
@@ -56642,26 +57023,38 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
56642
57023
  }
56643
57024
 
56644
57025
  i++
57026
+
57027
+ unlisten = NOOP
57028
+
57029
+ callback()
56645
57030
  }
56646
57031
  } else {
57032
+ let i = 0
57033
+
56647
57034
  for (const child_id of data.children) {
56648
- this._measure_sub_component_base(child_id)
57035
+ const slot_name = data.slotMap?.[child_id] ?? 'default'
57036
+ const prev_parent_id = data.prevParentIdMap?.[child_id] ?? null
57037
+
57038
+ this._pull_sub_component(child_id)
57039
+
57040
+ this._state_pre_append_sub_component_child(
57041
+ data.parentId,
57042
+ child_id,
57043
+ slot_name
57044
+ )
57045
+ this._layout_layer_move_sub_component_child(
57046
+ prev_parent_id,
57047
+ data.parentId,
57048
+ child_id,
57049
+ data.index + i
57050
+ )
56649
57051
  }
56650
57052
 
56651
- const prevParentId = data.prevParentIdMap[data.children[0]] ?? null
56652
- const prevSlotName = data.prevSlotMap[data.children[0]] ?? 'default'
56653
- const parentId = data.parentId
56654
- const slotName = data.slotMap[data.children[0]] ?? 'default'
56655
- const children = data.children
57053
+ i++
56656
57054
 
56657
- this.remove_sub_component_children(
56658
- prevParentId,
56659
- prevSlotName,
56660
- parentId,
56661
- slotName,
56662
- children,
56663
- emit
56664
- )
57055
+ unlisten = NOOP
57056
+
57057
+ callback()
56665
57058
  }
56666
57059
 
56667
57060
  emit &&
@@ -56679,6 +57072,8 @@ export class Editor_ extends Element<HTMLDivElement, Props_> {
56679
57072
  this._refresh_layout_node_target_position(null)
56680
57073
 
56681
57074
  this._animate_all_current_layout_layer_node()
57075
+
57076
+ return unlisten
56682
57077
  }
56683
57078
 
56684
57079
  private _on_set_unit_pin_constant = (