@_unit/unit 1.0.48 → 1.0.49

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.
@@ -2543,7 +2543,7 @@ export class Component<
2543
2543
  }
2544
2544
  }
2545
2545
  } else {
2546
- if (this.$slotParent) {
2546
+ if (this.$slotParent && component.$slotParent) {
2547
2547
  this.$slotParent.domRemoveParentChildAt(
2548
2548
  component,
2549
2549
  'default',
@@ -3020,7 +3020,7 @@ export class Component<
3020
3020
  }
3021
3021
 
3022
3022
  if (this.isParent()) {
3023
- if (this.$slotParent) {
3023
+ if (this.$slotParent && component.$slotParent) {
3024
3024
  this.$slotParent.domCommitRemoveChild(component)
3025
3025
  } else {
3026
3026
  if (this.$element.contains(component.$element)) {
@@ -909,6 +909,7 @@ export interface Props {
909
909
  component?: Component
910
910
  frame?: $Component
911
911
  fallback?: Component<HTMLElement>
912
+ container?: Component<HTMLElement>
912
913
  background?: Div
913
914
  transcend?: Transcend
914
915
  root?: Frame
@@ -925,6 +926,7 @@ export default class Editor extends Element<HTMLDivElement, Props> {
925
926
  private _root: Frame
926
927
  private _editor: Editor_
927
928
  private _component: Component
929
+ private _fallback_frame_container: Component<HTMLElement>
928
930
  private _fallback_frame: Component<HTMLElement>
929
931
  private _transcend: Transcend
930
932
  private _frame: Component<HTMLElement>
@@ -954,6 +956,7 @@ export default class Editor extends Element<HTMLDivElement, Props> {
954
956
  animate = true,
955
957
  fullwindow,
956
958
  fallback,
959
+ container,
957
960
  } = $props
958
961
 
959
962
  let { component, editor, transcend, background, root } = $props
@@ -968,6 +971,25 @@ export default class Editor extends Element<HTMLDivElement, Props> {
968
971
 
969
972
  this._pod = graph
970
973
 
974
+ this._fallback_frame_container =
975
+ container ||
976
+ new Div(
977
+ {
978
+ className: 'graph-fallback-frame-container',
979
+ style: {
980
+ position: 'absolute',
981
+ top: '0',
982
+ left: '0',
983
+ width: '100%',
984
+ height: '100%',
985
+ overflow: 'auto',
986
+ pointerEvents: 'none',
987
+ zIndex: '0',
988
+ },
989
+ },
990
+ this.$system
991
+ )
992
+
971
993
  this._fallback_frame = fallback || this._create_fallback_frame()
972
994
 
973
995
  this._frame = this._fallback_frame
@@ -1018,6 +1040,8 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1018
1040
  unregisterUnit: this._unregister_unit,
1019
1041
  newSpecId: this._new_spec_id,
1020
1042
  dispatchEvent: this._dispatch_event,
1043
+ enterFullwindow: this._enter_fullwindow,
1044
+ leaveFullwindow: this._leave_fullwindow,
1021
1045
  },
1022
1046
  this.$system
1023
1047
  )
@@ -1094,9 +1118,11 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1094
1118
  )
1095
1119
  root.registerParentRoot(this._background)
1096
1120
  root.registerParentRoot(this._editor)
1097
- root.registerParentRoot(this._fallback_frame)
1121
+ root.registerParentRoot(this._fallback_frame_container)
1098
1122
  root.registerParentRoot(this._transcend)
1099
1123
 
1124
+ this._fallback_frame_container.registerParentRoot(this._fallback_frame)
1125
+
1100
1126
  preventContextMenu(root)
1101
1127
 
1102
1128
  this._root = root
@@ -1121,6 +1147,7 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1121
1147
  background,
1122
1148
  root,
1123
1149
  editor,
1150
+ container: this._fallback_frame_container,
1124
1151
  frame: this._fallback_frame,
1125
1152
  transcend,
1126
1153
  })
@@ -1171,6 +1198,14 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1171
1198
  return this._registry.forkSpec(spec, specId)
1172
1199
  }
1173
1200
 
1201
+ private _enter_fullwindow = () => {
1202
+ this._fallback_frame_container.$element.style.pointerEvents = 'inherit'
1203
+ }
1204
+
1205
+ private _leave_fullwindow = () => {
1206
+ this._fallback_frame_container.$element.style.pointerEvents = 'none'
1207
+ }
1208
+
1174
1209
  private _new_spec_id = () => {
1175
1210
  return this._registry.newSpecId()
1176
1211
  }
@@ -1212,23 +1247,6 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1212
1247
  }
1213
1248
 
1214
1249
  private _create_fallback_frame = (): Component => {
1215
- // const fallback_frame = new Div(
1216
- // {
1217
- // className: 'graph-fallback-frame',
1218
- // style: {
1219
- // position: 'absolute',
1220
- // top: '0',
1221
- // left: '0',
1222
- // width: '100%',
1223
- // height: '100%',
1224
- // overflow: 'auto',
1225
- // pointerEvents: 'none',
1226
- // zIndex: '0',
1227
- // },
1228
- // },
1229
- // this.$system
1230
- // )
1231
-
1232
1250
  const { component: fallback_frame } = graphComponentFromId(
1233
1251
  this.$system,
1234
1252
  ID_SCROLL_SNAP_Y_DIV,
@@ -1240,7 +1258,6 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1240
1258
  width: '100%',
1241
1259
  height: '100%',
1242
1260
  overflow: 'auto',
1243
- pointerEvents: 'none',
1244
1261
  zIndex: '0',
1245
1262
  },
1246
1263
  }
@@ -1408,10 +1425,12 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1408
1425
  this.unregisterRoot(this._root)
1409
1426
 
1410
1427
  this._root.unregisterParentRoot(this._transcend)
1411
- this._root.unregisterParentRoot(this._fallback_frame)
1428
+ this._root.unregisterParentRoot(this._fallback_frame_container)
1412
1429
  this._root.unregisterParentRoot(this._editor)
1413
1430
  this._root.unregisterParentRoot(this._background)
1414
1431
 
1432
+ this._fallback_frame_container.unregisterParentRoot(this._fallback_frame)
1433
+
1415
1434
  this.removeSubComponent('transcend')
1416
1435
  this.removeSubComponent('background')
1417
1436
  this.removeSubComponent('editor')
@@ -1436,6 +1455,7 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1436
1455
  graph: this._pod,
1437
1456
  editor: this._editor,
1438
1457
  fallback: this._fallback_frame,
1458
+ container: this._fallback_frame_container,
1439
1459
  transcend: this._transcend,
1440
1460
  background: this._background,
1441
1461
  root: this._root,
@@ -1453,7 +1473,25 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1453
1473
 
1454
1474
  this._listen_transcend()
1455
1475
 
1476
+ this._fallback_frame_container = new Div(
1477
+ {
1478
+ className: 'graph-fallback-frame-container',
1479
+ style: {
1480
+ position: 'absolute',
1481
+ top: '0',
1482
+ left: '0',
1483
+ width: '100%',
1484
+ height: '100%',
1485
+ overflow: 'auto',
1486
+ pointerEvents: 'none',
1487
+ zIndex: '0',
1488
+ },
1489
+ },
1490
+ this.$system
1491
+ )
1492
+
1456
1493
  const fallback_frame = this._create_fallback_frame()
1494
+
1457
1495
  this._fallback_frame = fallback_frame
1458
1496
 
1459
1497
  const Parent = parentClass()
@@ -1483,6 +1521,7 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1483
1521
  component: this._component,
1484
1522
  frame: this._fallback_frame,
1485
1523
  specs: this._specs,
1524
+ typeCache: this._type_cache,
1486
1525
  hasSpec: this._has_spec,
1487
1526
  emptySpec: this._empty_spec,
1488
1527
  getSpec: this._get_spec,
@@ -1496,7 +1535,8 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1496
1535
  unregisterUnit: this._unregister_unit,
1497
1536
  newSpecId: this._new_spec_id,
1498
1537
  dispatchEvent: this._dispatch_event,
1499
- typeCache: this._type_cache,
1538
+ enterFullwindow: this._enter_fullwindow,
1539
+ leaveFullwindow: this._leave_fullwindow,
1500
1540
  },
1501
1541
  this.$system
1502
1542
  )
@@ -1556,6 +1596,7 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1556
1596
  root,
1557
1597
  editor,
1558
1598
  frame: this._fallback_frame,
1599
+ container: this._fallback_frame_container,
1559
1600
  transcend,
1560
1601
  })
1561
1602
 
@@ -1563,9 +1604,11 @@ export default class Editor extends Element<HTMLDivElement, Props> {
1563
1604
 
1564
1605
  this._root.registerParentRoot(this._background)
1565
1606
  this._root.registerParentRoot(this._editor)
1566
- this._root.registerParentRoot(this._fallback_frame)
1607
+ this._root.registerParentRoot(this._fallback_frame_container)
1567
1608
  this._root.registerParentRoot(this._transcend)
1568
1609
 
1610
+ this._fallback_frame_container.registerParentRoot(this._fallback_frame)
1611
+
1569
1612
  this.registerRoot(this._root)
1570
1613
 
1571
1614
  this._editor.select_node(editor_unit_id)
@@ -1715,6 +1758,8 @@ export interface _Props extends R {
1715
1758
  typeCache?: TypeTreeInterfaceCache
1716
1759
  config?: Config
1717
1760
  dispatchEvent: (type: string, detail: any, bubbles: boolean) => void
1761
+ enterFullwindow: () => void
1762
+ leaveFullwindow: () => void
1718
1763
  }
1719
1764
 
1720
1765
  export interface DefaultProps {
@@ -12501,6 +12546,10 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
12501
12546
  ): void => {
12502
12547
  const merge_name = this._merge_name[merge_node_id]
12503
12548
 
12549
+ if (!merge_name) {
12550
+ return
12551
+ }
12552
+
12504
12553
  merge_name.$element.style.color = color
12505
12554
  }
12506
12555
 
@@ -12509,6 +12558,10 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
12509
12558
 
12510
12559
  const merge_name = this._merge_name[merge_node_id]
12511
12560
 
12561
+ if (!merge_name) {
12562
+ return
12563
+ }
12564
+
12512
12565
  merge_name.setProp('value', name)
12513
12566
  merge_name.$element.style.width = `${name.length * 6}px`
12514
12567
  }
@@ -12516,6 +12569,10 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
12516
12569
  private _reset_merge_name_color = (merge_node_id: string): void => {
12517
12570
  const merge_name = this._merge_name[merge_node_id]
12518
12571
 
12572
+ if (!merge_name) {
12573
+ return
12574
+ }
12575
+
12519
12576
  merge_name.$element.style.color = this._theme.pin_text
12520
12577
  }
12521
12578
 
@@ -14631,11 +14688,21 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
14631
14688
  }
14632
14689
 
14633
14690
  private _is_link_pin_present = (pin_node_id: string): boolean => {
14634
- return (
14635
- !this._is_link_pin_merged(pin_node_id) ||
14636
- (this._is_output_pin_node_id(pin_node_id) &&
14637
- this._is_link_pin_ref(pin_node_id))
14638
- )
14691
+ const { type, pinId } = segmentLinkPinNodeId(pin_node_id)
14692
+
14693
+ if (!this._is_link_pin_merged(pin_node_id) && !isSelfPin(type, pinId)) {
14694
+ return true
14695
+ }
14696
+
14697
+ if (this._is_output_pin_node_id(pin_node_id)) {
14698
+ if (this._is_link_pin_ref(pin_node_id)) {
14699
+ if (pinId !== SELF) {
14700
+ return true
14701
+ }
14702
+ }
14703
+ }
14704
+
14705
+ return false
14639
14706
  }
14640
14707
 
14641
14708
  private _reset_link_pin_color = (pin_node_id: string): void => {
@@ -18476,7 +18543,9 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
18476
18543
  private _leave_fullwindow = (_animate: boolean) => {
18477
18544
  // console.log('Graph', '_leave_fullwindow', this._id)
18478
18545
 
18479
- const { animate } = this.$props
18546
+ const { animate, leaveFullwindow } = this.$props
18547
+
18548
+ leaveFullwindow()
18480
18549
 
18481
18550
  _animate = _animate ?? animate
18482
18551
 
@@ -24459,29 +24528,11 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
24459
24528
  }
24460
24529
  }
24461
24530
 
24462
- private _disable_frame_pointer = (): void => {
24463
- console.log('Graph', '_disable_frame_pointer')
24464
-
24465
- const frame_slot = this._frame.$slot['default']
24466
-
24467
- frame_slot.$element.style.pointerEvents = 'none'
24468
- }
24469
-
24470
- private _enable_frame_pointer = (): void => {
24471
- // console.log('Graph', '_enable_frame_pointer')
24472
-
24473
- const frame_slot = this._frame.$slot['default']
24474
-
24475
- frame_slot.$element.style.pointerEvents = 'all'
24476
- }
24477
-
24478
24531
  private _force_control_animation_false: boolean = false
24479
24532
 
24480
24533
  private _set_fullwindow_frame_off = (animate: boolean): void => {
24481
24534
  // console.log('Graph', '_set_fullwindow_frame_off')
24482
24535
 
24483
- this._disable_frame_pointer()
24484
-
24485
24536
  this._unclear_main(animate)
24486
24537
  }
24487
24538
 
@@ -24541,8 +24592,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
24541
24592
  private _set_fullwindow_frame_on = (animate: boolean): void => {
24542
24593
  // console.log('Graph', '_set_fullwindow_frame_on')
24543
24594
 
24544
- this._enable_frame_pointer()
24545
-
24546
24595
  this._clear_main(animate)
24547
24596
  }
24548
24597
 
@@ -24556,7 +24605,9 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
24556
24605
  ) => {
24557
24606
  // console.log('Graph', '_enter_fullwindow', _animate, sub_component_ids, this._id)
24558
24607
 
24559
- const { animate } = this.$props
24608
+ const { animate, enterFullwindow } = this.$props
24609
+
24610
+ enterFullwindow()
24560
24611
 
24561
24612
  _animate = _animate ?? animate
24562
24613
 
@@ -29175,6 +29226,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
29175
29226
  specs,
29176
29227
  registry,
29177
29228
  animate,
29229
+ typeCache,
29178
29230
  hasSpec,
29179
29231
  emptySpec,
29180
29232
  getSpec,
@@ -29188,7 +29240,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
29188
29240
  unregisterUnit,
29189
29241
  newSpecId,
29190
29242
  dispatchEvent,
29191
- typeCache,
29243
+ enterFullwindow,
29244
+ leaveFullwindow,
29192
29245
  } = this.$props
29193
29246
 
29194
29247
  let graph = this._subgraph_cache[unit_id]
@@ -29237,6 +29290,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
29237
29290
  unregisterUnit,
29238
29291
  newSpecId,
29239
29292
  dispatchEvent,
29293
+ enterFullwindow,
29294
+ leaveFullwindow,
29240
29295
  },
29241
29296
  this.$system
29242
29297
  )
@@ -30583,6 +30638,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
30583
30638
  registerUnit,
30584
30639
  unregisterUnit,
30585
30640
  newSpecId,
30641
+ enterFullwindow,
30642
+ leaveFullwindow,
30586
30643
  dispatchEvent,
30587
30644
  } = this.$props
30588
30645
 
@@ -30658,6 +30715,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
30658
30715
  }
30659
30716
  }, {}) as R),
30660
30717
  dispatchEvent,
30718
+ enterFullwindow,
30719
+ leaveFullwindow,
30661
30720
  },
30662
30721
  this.$system
30663
30722
  )
@@ -31264,20 +31323,10 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
31264
31323
  }
31265
31324
 
31266
31325
  const layer_trait = extractTrait(layer, measureText)
31267
- const frame_trait = extractTrait(this._frame, measureText)
31326
+ const frame_trait = extractTrait(frame_slot, measureText)
31268
31327
 
31269
- const same_context = this._frame.$context.$parent === layer.$context
31270
-
31271
- let offset_x = this._frame_out
31272
- ? same_context
31273
- ? this.$context.$x
31274
- : frame_trait.x
31275
- : 0
31276
- let offset_y = this._frame_out
31277
- ? same_context
31278
- ? this.$context.$y
31279
- : frame_trait.y
31280
- : 0
31328
+ const offset_x = this._frame_out ? frame_trait.x : this.$context.$x
31329
+ const offset_y = this._frame_out ? frame_trait.y : this.$context.$y
31281
31330
 
31282
31331
  const _trait = all_trait[leaf_id]
31283
31332
 
@@ -36128,7 +36177,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
36128
36177
 
36129
36178
  const link_id = getPinLinkIdFromPinNodeId(pin_node_id)
36130
36179
 
36131
- if (this._is_link_pin_merged(pin_node_id)) {
36180
+ if (this._is_link_pin_visible(pin_node_id)) {
36132
36181
  this._show_link_text(link_id)
36133
36182
  }
36134
36183
  })
@@ -59755,10 +59804,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
59755
59804
  if (this._in_component_control) {
59756
59805
  if (this._is_fullwindow) {
59757
59806
  this._leave_component_frame()
59758
-
59759
- if (!this._frame_out) {
59760
- this._disable_frame_pointer()
59761
- }
59762
59807
  }
59763
59808
  }
59764
59809
 
@@ -59785,10 +59830,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
59785
59830
  if (this._in_component_control) {
59786
59831
  if (this._is_fullwindow) {
59787
59832
  this._enter_component_frame()
59788
-
59789
- if (!this._frame_out) {
59790
- this._enable_frame_pointer()
59791
- }
59792
59833
  }
59793
59834
  }
59794
59835