@_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.
@@ -294,6 +294,12 @@ class Editor extends element_1.Element {
294
294
  // console.log('Graph', '_fork_spec', spec, specId)
295
295
  return this._registry.forkSpec(spec, specId);
296
296
  };
297
+ this._enter_fullwindow = () => {
298
+ this._fallback_frame_container.$element.style.pointerEvents = 'inherit';
299
+ };
300
+ this._leave_fullwindow = () => {
301
+ this._fallback_frame_container.$element.style.pointerEvents = 'none';
302
+ };
297
303
  this._new_spec_id = () => {
298
304
  return this._registry.newSpecId();
299
305
  };
@@ -325,22 +331,6 @@ class Editor extends element_1.Element {
325
331
  return this._registry.shouldFork(id);
326
332
  };
327
333
  this._create_fallback_frame = () => {
328
- // const fallback_frame = new Div(
329
- // {
330
- // className: 'graph-fallback-frame',
331
- // style: {
332
- // position: 'absolute',
333
- // top: '0',
334
- // left: '0',
335
- // width: '100%',
336
- // height: '100%',
337
- // overflow: 'auto',
338
- // pointerEvents: 'none',
339
- // zIndex: '0',
340
- // },
341
- // },
342
- // this.$system
343
- // )
344
334
  const { component: fallback_frame } = (0, graphComponentFromSpec_1.graphComponentFromId)(this.$system, _ids_1.ID_SCROLL_SNAP_Y_DIV, {
345
335
  style: {
346
336
  position: 'absolute',
@@ -349,7 +339,6 @@ class Editor extends element_1.Element {
349
339
  width: '100%',
350
340
  height: '100%',
351
341
  overflow: 'auto',
352
- pointerEvents: 'none',
353
342
  zIndex: '0',
354
343
  },
355
344
  });
@@ -474,9 +463,10 @@ class Editor extends element_1.Element {
474
463
  this._unlisten_transcend();
475
464
  this.unregisterRoot(this._root);
476
465
  this._root.unregisterParentRoot(this._transcend);
477
- this._root.unregisterParentRoot(this._fallback_frame);
466
+ this._root.unregisterParentRoot(this._fallback_frame_container);
478
467
  this._root.unregisterParentRoot(this._editor);
479
468
  this._root.unregisterParentRoot(this._background);
469
+ this._fallback_frame_container.unregisterParentRoot(this._fallback_frame);
480
470
  this.removeSubComponent('transcend');
481
471
  this.removeSubComponent('background');
482
472
  this.removeSubComponent('editor');
@@ -495,6 +485,7 @@ class Editor extends element_1.Element {
495
485
  graph: this._pod,
496
486
  editor: this._editor,
497
487
  fallback: this._fallback_frame,
488
+ container: this._fallback_frame_container,
498
489
  transcend: this._transcend,
499
490
  background: this._background,
500
491
  root: this._root,
@@ -505,6 +496,19 @@ class Editor extends element_1.Element {
505
496
  const transcend = new Component_3.default({}, this.$system);
506
497
  this._transcend = transcend;
507
498
  this._listen_transcend();
499
+ this._fallback_frame_container = new Component_1.default({
500
+ className: 'graph-fallback-frame-container',
501
+ style: {
502
+ position: 'absolute',
503
+ top: '0',
504
+ left: '0',
505
+ width: '100%',
506
+ height: '100%',
507
+ overflow: 'auto',
508
+ pointerEvents: 'none',
509
+ zIndex: '0',
510
+ },
511
+ }, this.$system);
508
512
  const fallback_frame = this._create_fallback_frame();
509
513
  this._fallback_frame = fallback_frame;
510
514
  const Parent = (0, createParent_1.parentClass)();
@@ -524,6 +528,7 @@ class Editor extends element_1.Element {
524
528
  component: this._component,
525
529
  frame: this._fallback_frame,
526
530
  specs: this._specs,
531
+ typeCache: this._type_cache,
527
532
  hasSpec: this._has_spec,
528
533
  emptySpec: this._empty_spec,
529
534
  getSpec: this._get_spec,
@@ -537,7 +542,8 @@ class Editor extends element_1.Element {
537
542
  unregisterUnit: this._unregister_unit,
538
543
  newSpecId: this._new_spec_id,
539
544
  dispatchEvent: this._dispatch_event,
540
- typeCache: this._type_cache,
545
+ enterFullwindow: this._enter_fullwindow,
546
+ leaveFullwindow: this._leave_fullwindow,
541
547
  }, this.$system);
542
548
  this._editor = editor;
543
549
  this._listen_graph();
@@ -580,13 +586,15 @@ class Editor extends element_1.Element {
580
586
  root,
581
587
  editor,
582
588
  frame: this._fallback_frame,
589
+ container: this._fallback_frame_container,
583
590
  transcend,
584
591
  });
585
592
  this._root.$ref['transcend'] = transcend;
586
593
  this._root.registerParentRoot(this._background);
587
594
  this._root.registerParentRoot(this._editor);
588
- this._root.registerParentRoot(this._fallback_frame);
595
+ this._root.registerParentRoot(this._fallback_frame_container);
589
596
  this._root.registerParentRoot(this._transcend);
597
+ this._fallback_frame_container.registerParentRoot(this._fallback_frame);
590
598
  this.registerRoot(this._root);
591
599
  this._editor.select_node(editor_unit_id);
592
600
  this._editor.unlock_sub_component(editor_unit_id, true);
@@ -604,13 +612,28 @@ class Editor extends element_1.Element {
604
612
  // console.log('Graph', '_on_zoom')
605
613
  this.set('zoom', zoom);
606
614
  };
607
- const { graph, className, style, attr, zoom, config, controls = true, animate = true, fullwindow, fallback, } = $props;
615
+ const { graph, className, style, attr, zoom, config, controls = true, animate = true, fullwindow, fallback, container, } = $props;
608
616
  let { component, editor, transcend, background, root } = $props;
609
617
  const specs = (0, weakMerge_1.weakMerge)(this.$system.specs, {});
610
618
  this._specs = specs;
611
619
  this._registry = new Registry_1.Registry(specs);
612
620
  (0, mirror_1.mirror)(this.$system.specs_, this._registry.specs_);
613
621
  this._pod = graph;
622
+ this._fallback_frame_container =
623
+ container ||
624
+ new Component_1.default({
625
+ className: 'graph-fallback-frame-container',
626
+ style: {
627
+ position: 'absolute',
628
+ top: '0',
629
+ left: '0',
630
+ width: '100%',
631
+ height: '100%',
632
+ overflow: 'auto',
633
+ pointerEvents: 'none',
634
+ zIndex: '0',
635
+ },
636
+ }, this.$system);
614
637
  this._fallback_frame = fallback || this._create_fallback_frame();
615
638
  this._frame = this._fallback_frame;
616
639
  transcend =
@@ -652,6 +675,8 @@ class Editor extends element_1.Element {
652
675
  unregisterUnit: this._unregister_unit,
653
676
  newSpecId: this._new_spec_id,
654
677
  dispatchEvent: this._dispatch_event,
678
+ enterFullwindow: this._enter_fullwindow,
679
+ leaveFullwindow: this._leave_fullwindow,
655
680
  }, this.$system);
656
681
  this._editor = editor;
657
682
  this._editor.addEventListeners([
@@ -705,8 +730,9 @@ class Editor extends element_1.Element {
705
730
  }, this.$system);
706
731
  root.registerParentRoot(this._background);
707
732
  root.registerParentRoot(this._editor);
708
- root.registerParentRoot(this._fallback_frame);
733
+ root.registerParentRoot(this._fallback_frame_container);
709
734
  root.registerParentRoot(this._transcend);
735
+ this._fallback_frame_container.registerParentRoot(this._fallback_frame);
710
736
  (0, contextMenu_1.preventContextMenu)(root);
711
737
  this._root = root;
712
738
  this._root.$ref['transcend'] = transcend;
@@ -724,6 +750,7 @@ class Editor extends element_1.Element {
724
750
  background,
725
751
  root,
726
752
  editor,
753
+ container: this._fallback_frame_container,
727
754
  frame: this._fallback_frame,
728
755
  transcend,
729
756
  });
@@ -7012,16 +7039,25 @@ class Editor_ extends element_1.Element {
7012
7039
  };
7013
7040
  this._set_merge_name_color = (merge_node_id, color) => {
7014
7041
  const merge_name = this._merge_name[merge_node_id];
7042
+ if (!merge_name) {
7043
+ return;
7044
+ }
7015
7045
  merge_name.$element.style.color = color;
7016
7046
  };
7017
7047
  this._set_merge_name = (merge_node_id, name) => {
7018
7048
  // console.log('Graph', '_set_merge_name', merge_node_id, name)
7019
7049
  const merge_name = this._merge_name[merge_node_id];
7050
+ if (!merge_name) {
7051
+ return;
7052
+ }
7020
7053
  merge_name.setProp('value', name);
7021
7054
  merge_name.$element.style.width = `${name.length * 6}px`;
7022
7055
  };
7023
7056
  this._reset_merge_name_color = (merge_node_id) => {
7024
7057
  const merge_name = this._merge_name[merge_node_id];
7058
+ if (!merge_name) {
7059
+ return;
7060
+ }
7025
7061
  merge_name.$element.style.color = this._theme.pin_text;
7026
7062
  };
7027
7063
  this._set_output_r = (pin_node_id, r) => {
@@ -8598,9 +8634,18 @@ class Editor_ extends element_1.Element {
8598
8634
  return this._has_node(merge_node_id);
8599
8635
  };
8600
8636
  this._is_link_pin_present = (pin_node_id) => {
8601
- return (!this._is_link_pin_merged(pin_node_id) ||
8602
- (this._is_output_pin_node_id(pin_node_id) &&
8603
- this._is_link_pin_ref(pin_node_id)));
8637
+ const { type, pinId } = (0, id_1.segmentLinkPinNodeId)(pin_node_id);
8638
+ if (!this._is_link_pin_merged(pin_node_id) && !(0, spec_3.isSelfPin)(type, pinId)) {
8639
+ return true;
8640
+ }
8641
+ if (this._is_output_pin_node_id(pin_node_id)) {
8642
+ if (this._is_link_pin_ref(pin_node_id)) {
8643
+ if (pinId !== SELF_1.SELF) {
8644
+ return true;
8645
+ }
8646
+ }
8647
+ }
8648
+ return false;
8604
8649
  };
8605
8650
  this._reset_link_pin_color = (pin_node_id) => {
8606
8651
  // console.log('Graph', '_reset_link_pin_color', pin_node_id)
@@ -11090,7 +11135,8 @@ class Editor_ extends element_1.Element {
11090
11135
  };
11091
11136
  this._leave_fullwindow = (_animate) => {
11092
11137
  // console.log('Graph', '_leave_fullwindow', this._id)
11093
- const { animate } = this.$props;
11138
+ const { animate, leaveFullwindow } = this.$props;
11139
+ leaveFullwindow();
11094
11140
  _animate = _animate !== null && _animate !== void 0 ? _animate : animate;
11095
11141
  this._is_fullwindow = false;
11096
11142
  if (!this._frame_out) {
@@ -14879,20 +14925,9 @@ class Editor_ extends element_1.Element {
14879
14925
  this._control.show(animate);
14880
14926
  }
14881
14927
  };
14882
- this._disable_frame_pointer = () => {
14883
- console.log('Graph', '_disable_frame_pointer');
14884
- const frame_slot = this._frame.$slot['default'];
14885
- frame_slot.$element.style.pointerEvents = 'none';
14886
- };
14887
- this._enable_frame_pointer = () => {
14888
- // console.log('Graph', '_enable_frame_pointer')
14889
- const frame_slot = this._frame.$slot['default'];
14890
- frame_slot.$element.style.pointerEvents = 'all';
14891
- };
14892
14928
  this._force_control_animation_false = false;
14893
14929
  this._set_fullwindow_frame_off = (animate) => {
14894
14930
  // console.log('Graph', '_set_fullwindow_frame_off')
14895
- this._disable_frame_pointer();
14896
14931
  this._unclear_main(animate);
14897
14932
  };
14898
14933
  this._clear_component = (component, animate) => {
@@ -14933,13 +14968,13 @@ class Editor_ extends element_1.Element {
14933
14968
  };
14934
14969
  this._set_fullwindow_frame_on = (animate) => {
14935
14970
  // console.log('Graph', '_set_fullwindow_frame_on')
14936
- this._enable_frame_pointer();
14937
14971
  this._clear_main(animate);
14938
14972
  };
14939
14973
  this._fullwindow_focusing = false;
14940
14974
  this._enter_fullwindow = (_animate, sub_component_ids) => {
14941
14975
  // console.log('Graph', '_enter_fullwindow', _animate, sub_component_ids, this._id)
14942
- const { animate } = this.$props;
14976
+ const { animate, enterFullwindow } = this.$props;
14977
+ enterFullwindow();
14943
14978
  _animate = _animate !== null && _animate !== void 0 ? _animate : animate;
14944
14979
  this._is_fullwindow = true;
14945
14980
  if (!this._frame_out) {
@@ -17884,7 +17919,7 @@ class Editor_ extends element_1.Element {
17884
17919
  };
17885
17920
  };
17886
17921
  this._ensure_subgraph = (unit_id, { color, fullwindow } = {}) => {
17887
- const { fork, specs, registry, animate, hasSpec, emptySpec, getSpec, setSpec, newSpec, deleteSpec, forkSpec, shouldFork, injectSpecs, registerUnit, unregisterUnit, newSpecId, dispatchEvent, typeCache, } = this.$props;
17922
+ const { fork, specs, registry, animate, typeCache, hasSpec, emptySpec, getSpec, setSpec, newSpec, deleteSpec, forkSpec, shouldFork, injectSpecs, registerUnit, unregisterUnit, newSpecId, dispatchEvent, enterFullwindow, leaveFullwindow, } = this.$props;
17888
17923
  let graph = this._subgraph_cache[unit_id];
17889
17924
  if (graph) {
17890
17925
  //
@@ -17927,6 +17962,8 @@ class Editor_ extends element_1.Element {
17927
17962
  unregisterUnit,
17928
17963
  newSpecId,
17929
17964
  dispatchEvent,
17965
+ enterFullwindow,
17966
+ leaveFullwindow,
17930
17967
  }, this.$system);
17931
17968
  this.cache_subgraph(unit_id, graph);
17932
17969
  }
@@ -18719,7 +18756,7 @@ class Editor_ extends element_1.Element {
18719
18756
  }
18720
18757
  };
18721
18758
  this._enter_datum_class_literal = (datum_node_id) => {
18722
- const { fork, specs, registry, animate, typeCache, hasSpec, emptySpec, getSpec, setSpec, newSpec, deleteSpec, forkSpec, shouldFork, injectSpecs, registerUnit, unregisterUnit, newSpecId, dispatchEvent, } = this.$props;
18759
+ const { fork, specs, registry, animate, typeCache, hasSpec, emptySpec, getSpec, setSpec, newSpec, deleteSpec, forkSpec, shouldFork, injectSpecs, registerUnit, unregisterUnit, newSpecId, enterFullwindow, leaveFullwindow, dispatchEvent, } = this.$props;
18723
18760
  const { datumId } = (0, id_1.segmentDatumNodeId)(datum_node_id);
18724
18761
  const datum_tree = this._get_datum_tree(datum_node_id);
18725
18762
  const is_class_literal = datum_tree.type === parser_2.TreeNodeType.Unit;
@@ -18775,6 +18812,8 @@ class Editor_ extends element_1.Element {
18775
18812
  };
18776
18813
  }, {}),
18777
18814
  dispatchEvent,
18815
+ enterFullwindow,
18816
+ leaveFullwindow,
18778
18817
  }, this.$system);
18779
18818
  editor._graph.addEventListener((0, custom_1.makeCustomListener)('leave', () => {
18780
18819
  var _a;
@@ -19133,18 +19172,9 @@ class Editor_ extends element_1.Element {
19133
19172
  all_trait = this.___reflect_sub_component_base_trait('', this._component, all_base, style, trait, true);
19134
19173
  }
19135
19174
  const layer_trait = (0, extractTrait_1.extractTrait)(layer, measureText);
19136
- const frame_trait = (0, extractTrait_1.extractTrait)(this._frame, measureText);
19137
- const same_context = this._frame.$context.$parent === layer.$context;
19138
- let offset_x = this._frame_out
19139
- ? same_context
19140
- ? this.$context.$x
19141
- : frame_trait.x
19142
- : 0;
19143
- let offset_y = this._frame_out
19144
- ? same_context
19145
- ? this.$context.$y
19146
- : frame_trait.y
19147
- : 0;
19175
+ const frame_trait = (0, extractTrait_1.extractTrait)(frame_slot, measureText);
19176
+ const offset_x = this._frame_out ? frame_trait.x : this.$context.$x;
19177
+ const offset_y = this._frame_out ? frame_trait.y : this.$context.$y;
19148
19178
  const _trait = all_trait[leaf_id];
19149
19179
  const trait = {
19150
19180
  x: _trait.x - layer_trait.x + offset_x,
@@ -21733,7 +21763,7 @@ class Editor_ extends element_1.Element {
21733
21763
  this._for_each_merge_pin(mergeId, (unitId, type, pinId) => {
21734
21764
  const pin_node_id = (0, id_1.getPinNodeId)(unitId, type, pinId);
21735
21765
  const link_id = (0, id_1.getPinLinkIdFromPinNodeId)(pin_node_id);
21736
- if (this._is_link_pin_merged(pin_node_id)) {
21766
+ if (this._is_link_pin_visible(pin_node_id)) {
21737
21767
  this._show_link_text(link_id);
21738
21768
  }
21739
21769
  });
@@ -38481,9 +38511,6 @@ class Editor_ extends element_1.Element {
38481
38511
  if (this._in_component_control) {
38482
38512
  if (this._is_fullwindow) {
38483
38513
  this._leave_component_frame();
38484
- if (!this._frame_out) {
38485
- this._disable_frame_pointer();
38486
- }
38487
38514
  }
38488
38515
  }
38489
38516
  this._frame = frame;
@@ -38504,9 +38531,6 @@ class Editor_ extends element_1.Element {
38504
38531
  if (this._in_component_control) {
38505
38532
  if (this._is_fullwindow) {
38506
38533
  this._enter_component_frame();
38507
- if (!this._frame_out) {
38508
- this._enable_frame_pointer();
38509
- }
38510
38534
  }
38511
38535
  }
38512
38536
  for (const unit_id in this._subgraph_cache) {