rete-angular-plugin 2.4.1 → 2.6.0

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 (114) hide show
  1. package/12/bundles/rete-angular-plugin-ng12.umd.js +43 -8
  2. package/12/bundles/rete-angular-plugin-ng12.umd.js.map +1 -1
  3. package/12/esm2015/index.js +2 -1
  4. package/12/esm2015/module.js +10 -5
  5. package/12/esm2015/presets/classic/components/node/node.component.js +6 -5
  6. package/12/esm2015/shared/pipes/impure-keyvalue.pipe.js +24 -0
  7. package/12/esm2015/shared/pipes/index.js +2 -0
  8. package/12/fesm2015/rete-angular-plugin-ng12.js +36 -10
  9. package/12/fesm2015/rete-angular-plugin-ng12.js.map +1 -1
  10. package/12/index.d.ts +1 -0
  11. package/12/module.d.ts +3 -2
  12. package/12/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  13. package/12/shared/pipes/index.d.ts +1 -0
  14. package/13/esm2020/index.mjs +2 -1
  15. package/13/esm2020/module.mjs +10 -5
  16. package/13/esm2020/presets/classic/components/node/node.component.mjs +7 -6
  17. package/13/esm2020/shared/pipes/impure-keyvalue.pipe.mjs +24 -0
  18. package/13/esm2020/shared/pipes/index.mjs +2 -0
  19. package/13/fesm2015/rete-angular-plugin-ng13.mjs +39 -11
  20. package/13/fesm2015/rete-angular-plugin-ng13.mjs.map +1 -1
  21. package/13/fesm2020/rete-angular-plugin-ng13.mjs +37 -11
  22. package/13/fesm2020/rete-angular-plugin-ng13.mjs.map +1 -1
  23. package/13/index.d.ts +1 -0
  24. package/13/module.d.ts +3 -2
  25. package/13/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  26. package/13/shared/pipes/index.d.ts +1 -0
  27. package/14/esm2020/index.mjs +2 -1
  28. package/14/esm2020/module.mjs +10 -5
  29. package/14/esm2020/presets/classic/components/node/node.component.mjs +7 -6
  30. package/14/esm2020/shared/pipes/impure-keyvalue.pipe.mjs +24 -0
  31. package/14/esm2020/shared/pipes/index.mjs +2 -0
  32. package/14/fesm2015/rete-angular-plugin-ng14.mjs +39 -11
  33. package/14/fesm2015/rete-angular-plugin-ng14.mjs.map +1 -1
  34. package/14/fesm2020/rete-angular-plugin-ng14.mjs +37 -11
  35. package/14/fesm2020/rete-angular-plugin-ng14.mjs.map +1 -1
  36. package/14/index.d.ts +1 -0
  37. package/14/module.d.ts +3 -2
  38. package/14/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  39. package/14/shared/pipes/index.d.ts +1 -0
  40. package/15/esm2020/index.mjs +2 -1
  41. package/15/esm2020/module.mjs +10 -5
  42. package/15/esm2020/presets/classic/components/node/node.component.mjs +7 -6
  43. package/15/esm2020/shared/pipes/impure-keyvalue.pipe.mjs +24 -0
  44. package/15/esm2020/shared/pipes/index.mjs +2 -0
  45. package/15/fesm2015/rete-angular-plugin-ng15.mjs +39 -11
  46. package/15/fesm2015/rete-angular-plugin-ng15.mjs.map +1 -1
  47. package/15/fesm2020/rete-angular-plugin-ng15.mjs +37 -11
  48. package/15/fesm2020/rete-angular-plugin-ng15.mjs.map +1 -1
  49. package/15/index.d.ts +1 -0
  50. package/15/module.d.ts +3 -2
  51. package/15/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  52. package/15/shared/pipes/index.d.ts +1 -0
  53. package/16/esm2022/index.mjs +2 -1
  54. package/16/esm2022/module.mjs +10 -5
  55. package/16/esm2022/presets/classic/components/node/node.component.mjs +7 -6
  56. package/16/esm2022/shared/pipes/impure-keyvalue.pipe.mjs +24 -0
  57. package/16/esm2022/shared/pipes/index.mjs +2 -0
  58. package/16/fesm2022/rete-angular-plugin-ng16.mjs +37 -11
  59. package/16/fesm2022/rete-angular-plugin-ng16.mjs.map +1 -1
  60. package/16/index.d.ts +1 -0
  61. package/16/module.d.ts +3 -2
  62. package/16/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  63. package/16/shared/pipes/index.d.ts +1 -0
  64. package/17/esm2022/index.mjs +2 -1
  65. package/17/esm2022/module.mjs +10 -5
  66. package/17/esm2022/presets/classic/components/node/node.component.mjs +7 -6
  67. package/17/esm2022/shared/pipes/impure-keyvalue.pipe.mjs +24 -0
  68. package/17/esm2022/shared/pipes/index.mjs +2 -0
  69. package/17/fesm2022/rete-angular-plugin-ng17.mjs +37 -11
  70. package/17/fesm2022/rete-angular-plugin-ng17.mjs.map +1 -1
  71. package/17/index.d.ts +1 -0
  72. package/17/module.d.ts +3 -2
  73. package/17/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  74. package/17/shared/pipes/index.d.ts +1 -0
  75. package/18/esm2022/index.mjs +2 -1
  76. package/18/esm2022/module.mjs +10 -5
  77. package/18/esm2022/presets/classic/components/node/node.component.mjs +7 -6
  78. package/18/esm2022/shared/pipes/impure-keyvalue.pipe.mjs +24 -0
  79. package/18/esm2022/shared/pipes/index.mjs +2 -0
  80. package/18/fesm2022/rete-angular-plugin-ng18.mjs +37 -11
  81. package/18/fesm2022/rete-angular-plugin-ng18.mjs.map +1 -1
  82. package/18/index.d.ts +1 -0
  83. package/18/module.d.ts +3 -2
  84. package/18/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  85. package/18/shared/pipes/index.d.ts +1 -0
  86. package/19/fesm2022/rete-angular-plugin-ng19.mjs +31 -9
  87. package/19/fesm2022/rete-angular-plugin-ng19.mjs.map +1 -1
  88. package/19/index.d.ts +1 -0
  89. package/19/shared/pipes/impure-keyvalue.pipe.d.ts +12 -0
  90. package/19/shared/pipes/index.d.ts +1 -0
  91. package/20/fesm2022/rete-angular-plugin-ng20.mjs +31 -9
  92. package/20/fesm2022/rete-angular-plugin-ng20.mjs.map +1 -1
  93. package/20/index.d.ts +13 -2
  94. package/21/fesm2022/rete-angular-plugin-ng21.mjs +1582 -0
  95. package/21/fesm2022/rete-angular-plugin-ng21.mjs.map +1 -0
  96. package/21/package.json +22 -0
  97. package/21/types/rete-angular-plugin-ng21.d.ts +564 -0
  98. package/CHANGELOG.md +14 -0
  99. package/bundles/rete-angular-plugin.umd.js +40 -11
  100. package/bundles/rete-angular-plugin.umd.js.map +1 -1
  101. package/esm2015/index.js +2 -1
  102. package/esm2015/module.js +6 -3
  103. package/esm2015/presets/classic/components/node/node.component.js +2 -2
  104. package/esm2015/rete-angular-plugin.js +10 -9
  105. package/esm2015/shared/pipes/impure-keyvalue.pipe.js +20 -0
  106. package/esm2015/shared/pipes/index.js +2 -0
  107. package/fesm2015/rete-angular-plugin.js +26 -5
  108. package/fesm2015/rete-angular-plugin.js.map +1 -1
  109. package/index.d.ts +1 -0
  110. package/package.json +5 -5
  111. package/rete-angular-plugin.d.ts +9 -8
  112. package/rete-angular-plugin.metadata.json +1 -1
  113. package/shared/pipes/impure-keyvalue.pipe.d.ts +9 -0
  114. package/shared/pipes/index.d.ts +1 -0
@@ -0,0 +1,1582 @@
1
+ import { getUID, ClassicPreset, Scope } from 'rete';
2
+ import { getDOMSocketPosition, loopConnectionPath, classicConnectionPath } from 'rete-render-utils';
3
+ import * as i0 from '@angular/core';
4
+ import { Directive, Input, Pipe, Component, HostBinding, HostListener, EventEmitter, Output, NgModule } from '@angular/core';
5
+ import * as i1 from '@angular/common';
6
+ import { CommonModule } from '@angular/common';
7
+ import { BaseAreaPlugin } from 'rete-area-plugin';
8
+ import { createCustomElement } from '@angular/elements';
9
+
10
+ class RefDirective {
11
+ el;
12
+ data;
13
+ emit;
14
+ constructor(el) {
15
+ this.el = el;
16
+ }
17
+ ngOnChanges() {
18
+ this.emit({ type: 'render', data: { ...this.data, element: this.el.nativeElement } });
19
+ }
20
+ ngOnDestroy() {
21
+ this.emit({ type: 'unmount', data: { element: this.el.nativeElement } });
22
+ }
23
+ static ɵfac = function RefDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RefDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
24
+ static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: RefDirective, selectors: [["", "refComponent", ""]], inputs: { data: "data", emit: "emit" }, features: [i0.ɵɵNgOnChangesFeature] });
25
+ }
26
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RefDirective, [{
27
+ type: Directive,
28
+ args: [{
29
+ selector: '[refComponent]'
30
+ }]
31
+ }], () => [{ type: i0.ElementRef }], { data: [{
32
+ type: Input
33
+ }], emit: [{
34
+ type: Input
35
+ }] }); })();
36
+
37
+ class ImpureKeyvaluePipe {
38
+ transform(value, compareFn) {
39
+ if (!value || typeof value !== 'object') {
40
+ return [];
41
+ }
42
+ const result = Object.entries(value).map(([key, val]) => ({ key, value: val }));
43
+ if (compareFn) {
44
+ result.sort(compareFn);
45
+ }
46
+ return result;
47
+ }
48
+ static ɵfac = function ImpureKeyvaluePipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ImpureKeyvaluePipe)(); };
49
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "keyvalueimpure", type: ImpureKeyvaluePipe, pure: false });
50
+ }
51
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImpureKeyvaluePipe, [{
52
+ type: Pipe,
53
+ args: [{
54
+ name: 'keyvalueimpure',
55
+ pure: false
56
+ }]
57
+ }], null, null); })();
58
+
59
+ const _c0$1 = (a0, a1, a2, a3) => ({ type: "socket", side: "output", key: a0, nodeId: a1, payload: a2, seed: a3 });
60
+ const _c1 = a0 => ({ type: "control", payload: a0 });
61
+ const _c2 = (a0, a1, a2, a3) => ({ type: "socket", side: "input", key: a0, nodeId: a1, payload: a2, seed: a3 });
62
+ function NodeComponent_div_2_Template(rf, ctx) { if (rf & 1) {
63
+ i0.ɵɵelementStart(0, "div", 4)(1, "div", 5);
64
+ i0.ɵɵtext(2);
65
+ i0.ɵɵelementEnd();
66
+ i0.ɵɵelement(3, "div", 6);
67
+ i0.ɵɵelementEnd();
68
+ } if (rf & 2) {
69
+ const output_r1 = ctx.$implicit;
70
+ const ctx_r1 = i0.ɵɵnextContext();
71
+ i0.ɵɵattribute("data-testid", "output-" + output_r1.key);
72
+ i0.ɵɵadvance(2);
73
+ i0.ɵɵtextInterpolate(output_r1.value == null ? null : output_r1.value.label);
74
+ i0.ɵɵadvance();
75
+ i0.ɵɵproperty("data", i0.ɵɵpureFunction4(4, _c0$1, output_r1.key, ctx_r1.data.id, output_r1.value == null ? null : output_r1.value.socket, ctx_r1.seed))("emit", ctx_r1.emit);
76
+ } }
77
+ function NodeComponent_div_4_Template(rf, ctx) { if (rf & 1) {
78
+ i0.ɵɵelement(0, "div", 7);
79
+ } if (rf & 2) {
80
+ const control_r3 = ctx.$implicit;
81
+ const ctx_r1 = i0.ɵɵnextContext();
82
+ i0.ɵɵproperty("data", i0.ɵɵpureFunction1(3, _c1, control_r3.value))("emit", ctx_r1.emit);
83
+ i0.ɵɵattribute("data-testid", "control-" + control_r3.key);
84
+ } }
85
+ function NodeComponent_div_6_div_2_Template(rf, ctx) { if (rf & 1) {
86
+ i0.ɵɵelementStart(0, "div", 12);
87
+ i0.ɵɵtext(1);
88
+ i0.ɵɵelementEnd();
89
+ } if (rf & 2) {
90
+ const input_r4 = i0.ɵɵnextContext().$implicit;
91
+ i0.ɵɵadvance();
92
+ i0.ɵɵtextInterpolate(input_r4.value == null ? null : input_r4.value.label);
93
+ } }
94
+ function NodeComponent_div_6_Template(rf, ctx) { if (rf & 1) {
95
+ i0.ɵɵelementStart(0, "div", 8);
96
+ i0.ɵɵelement(1, "div", 9);
97
+ i0.ɵɵtemplate(2, NodeComponent_div_6_div_2_Template, 2, 1, "div", 10);
98
+ i0.ɵɵelement(3, "div", 11);
99
+ i0.ɵɵelementEnd();
100
+ } if (rf & 2) {
101
+ const input_r4 = ctx.$implicit;
102
+ const ctx_r1 = i0.ɵɵnextContext();
103
+ i0.ɵɵattribute("data-testid", "input-" + input_r4.key);
104
+ i0.ɵɵadvance();
105
+ i0.ɵɵproperty("data", i0.ɵɵpureFunction4(8, _c2, input_r4.key, ctx_r1.data.id, input_r4.value == null ? null : input_r4.value.socket, ctx_r1.seed))("emit", ctx_r1.emit);
106
+ i0.ɵɵadvance();
107
+ i0.ɵɵproperty("ngIf", !(input_r4.value == null ? null : input_r4.value.control) || !(input_r4.value == null ? null : input_r4.value.showControl));
108
+ i0.ɵɵadvance();
109
+ i0.ɵɵstyleProp("display", (input_r4.value == null ? null : input_r4.value.control) && (input_r4.value == null ? null : input_r4.value.showControl) ? "" : "none");
110
+ i0.ɵɵproperty("data", i0.ɵɵpureFunction1(13, _c1, input_r4.value == null ? null : input_r4.value.control))("emit", ctx_r1.emit);
111
+ } }
112
+ class NodeComponent {
113
+ cdr;
114
+ data;
115
+ emit;
116
+ rendered;
117
+ seed = 0;
118
+ get width() {
119
+ return this.data.width;
120
+ }
121
+ get height() {
122
+ return this.data.height;
123
+ }
124
+ get selected() {
125
+ return this.data.selected;
126
+ }
127
+ constructor(cdr) {
128
+ this.cdr = cdr;
129
+ this.cdr.detach();
130
+ }
131
+ ngOnChanges() {
132
+ this.cdr.detectChanges();
133
+ requestAnimationFrame(() => this.rendered());
134
+ this.seed++; // force render sockets
135
+ }
136
+ sortByIndex(a, b) {
137
+ const ai = a.value?.index || 0;
138
+ const bi = b.value?.index || 0;
139
+ return ai - bi;
140
+ }
141
+ static ɵfac = function NodeComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || NodeComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
142
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: NodeComponent, selectors: [["ng-component"]], hostAttrs: ["data-testid", "node"], hostVars: 6, hostBindings: function NodeComponent_HostBindings(rf, ctx) { if (rf & 2) {
143
+ i0.ɵɵstyleProp("width", ctx.width, "px")("height", ctx.height, "px");
144
+ i0.ɵɵclassProp("selected", ctx.selected);
145
+ } }, inputs: { data: "data", emit: "emit", rendered: "rendered" }, features: [i0.ɵɵNgOnChangesFeature], decls: 8, vars: 13, consts: [["data-testid", "title", 1, "title"], ["class", "output", 4, "ngFor", "ngForOf"], ["class", "control", "refComponent", "", 3, "data", "emit", 4, "ngFor", "ngForOf"], ["class", "input", 4, "ngFor", "ngForOf"], [1, "output"], ["data-testid", "output-title", 1, "output-title"], ["refComponent", "", "data-testid", "output-socket", 1, "output-socket", 3, "data", "emit"], ["refComponent", "", 1, "control", 3, "data", "emit"], [1, "input"], ["refComponent", "", "data-testid", "input-socket", 1, "input-socket", 3, "data", "emit"], ["class", "input-title", "data-testid", "input-title", 4, "ngIf"], ["refComponent", "", "data-testid", "input-control", 1, "input-control", 3, "data", "emit"], ["data-testid", "input-title", 1, "input-title"]], template: function NodeComponent_Template(rf, ctx) { if (rf & 1) {
146
+ i0.ɵɵelementStart(0, "div", 0);
147
+ i0.ɵɵtext(1);
148
+ i0.ɵɵelementEnd();
149
+ i0.ɵɵtemplate(2, NodeComponent_div_2_Template, 4, 9, "div", 1);
150
+ i0.ɵɵpipe(3, "keyvalueimpure");
151
+ i0.ɵɵtemplate(4, NodeComponent_div_4_Template, 1, 5, "div", 2);
152
+ i0.ɵɵpipe(5, "keyvalueimpure");
153
+ i0.ɵɵtemplate(6, NodeComponent_div_6_Template, 4, 15, "div", 3);
154
+ i0.ɵɵpipe(7, "keyvalueimpure");
155
+ } if (rf & 2) {
156
+ i0.ɵɵadvance();
157
+ i0.ɵɵtextInterpolate(ctx.data.label);
158
+ i0.ɵɵadvance();
159
+ i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind2(3, 4, ctx.data.outputs, ctx.sortByIndex));
160
+ i0.ɵɵadvance(2);
161
+ i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind2(5, 7, ctx.data.controls, ctx.sortByIndex));
162
+ i0.ɵɵadvance(2);
163
+ i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind2(7, 10, ctx.data.inputs, ctx.sortByIndex));
164
+ } }, dependencies: [CommonModule, i1.NgForOf, i1.NgIf, RefDirective, ImpureKeyvaluePipe], styles: ["[_nghost-%COMP%]{display:block;background:#6e88ffcc;border:2px solid #4e58bf;border-radius:10px;cursor:pointer;box-sizing:border-box;width:180px;height:auto;padding-bottom:6px;position:relative;-webkit-user-select:none;user-select:none;line-height:initial;font-family:Arial}[_nghost-%COMP%]:hover{background:#8299ffcc}.selected[_nghost-%COMP%]{background:#ffd92c;border-color:#e3c000}[_nghost-%COMP%] .title[_ngcontent-%COMP%]{color:#fff;font-family:sans-serif;font-size:18px;padding:8px}[_nghost-%COMP%] .output[_ngcontent-%COMP%]{text-align:right}[_nghost-%COMP%] .input[_ngcontent-%COMP%]{text-align:left}[_nghost-%COMP%] .input-title[_ngcontent-%COMP%], [_nghost-%COMP%] .output-title[_ngcontent-%COMP%]{vertical-align:middle;color:#fff;display:inline-block;font-family:sans-serif;font-size:14px;margin:6px;line-height:24px}[_nghost-%COMP%] .input-title[hidden][_ngcontent-%COMP%], [_nghost-%COMP%] .output-title[hidden][_ngcontent-%COMP%]{display:none}[_nghost-%COMP%] .output-socket[_ngcontent-%COMP%]{text-align:right;margin-right:-18px;display:inline-block}[_nghost-%COMP%] .input-socket[_ngcontent-%COMP%]{text-align:left;margin-left:-18px;display:inline-block}[_nghost-%COMP%] .input-control[_ngcontent-%COMP%]{z-index:1;width:calc(100% - 36px);vertical-align:middle;display:inline-block}[_nghost-%COMP%] .control[_ngcontent-%COMP%]{padding:6px 18px}"] });
165
+ }
166
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NodeComponent, [{
167
+ type: Component,
168
+ args: [{ imports: [CommonModule, RefDirective, ImpureKeyvaluePipe], host: {
169
+ 'data-testid': 'node'
170
+ }, template: "<div class=\"title\" data-testid=\"title\">{{data.label}}</div>\n<div class=\"output\" *ngFor=\"let output of data.outputs | keyvalueimpure: sortByIndex\" [attr.data-testid]=\"'output-'+output.key\">\n <div class=\"output-title\" data-testid=\"output-title\">{{output.value?.label}}</div>\n <div\n class=\"output-socket\"\n refComponent\n [data]=\"{type: 'socket', side: 'output', key: output.key, nodeId: data.id, payload: output.value?.socket, seed: seed }\"\n [emit]=\"emit\"\n data-testid=\"output-socket\"\n ></div>\n</div>\n<div\n class=\"control\"\n *ngFor=\"let control of data.controls | keyvalueimpure: sortByIndex\"\n refComponent\n [data]=\"{type: 'control', payload: control.value }\"\n [emit]=\"emit\"\n [attr.data-testid]=\"'control-'+control.key\"\n></div>\n<div class=\"input\" *ngFor=\"let input of data.inputs | keyvalueimpure: sortByIndex\" [attr.data-testid]=\"'input-'+input.key\">\n <div\n class=\"input-socket\"\n refComponent\n [data]=\"{type: 'socket', side: 'input', key: input.key, nodeId: data.id, payload: input.value?.socket, seed: seed }\"\n [emit]=\"emit\"\n data-testid=\"input-socket\"\n ></div>\n <div class=\"input-title\" data-testid=\"input-title\" *ngIf=\"!input.value?.control || !input.value?.showControl\">{{input.value?.label}}</div>\n <div\n class=\"input-control\"\n [style.display]=\"input.value?.control && input.value?.showControl ? '' : 'none'\"\n refComponent\n [data]=\"{type: 'control', payload: input.value?.control }\"\n [emit]=\"emit\"\n data-testid=\"input-control\"\n ></div>\n</div>\n", styles: [":host{display:block;background:#6e88ffcc;border:2px solid #4e58bf;border-radius:10px;cursor:pointer;box-sizing:border-box;width:180px;height:auto;padding-bottom:6px;position:relative;-webkit-user-select:none;user-select:none;line-height:initial;font-family:Arial}:host:hover{background:#8299ffcc}:host.selected{background:#ffd92c;border-color:#e3c000}:host .title{color:#fff;font-family:sans-serif;font-size:18px;padding:8px}:host .output{text-align:right}:host .input{text-align:left}:host .input-title,:host .output-title{vertical-align:middle;color:#fff;display:inline-block;font-family:sans-serif;font-size:14px;margin:6px;line-height:24px}:host .input-title[hidden],:host .output-title[hidden]{display:none}:host .output-socket{text-align:right;margin-right:-18px;display:inline-block}:host .input-socket{text-align:left;margin-left:-18px;display:inline-block}:host .input-control{z-index:1;width:calc(100% - 36px);vertical-align:middle;display:inline-block}:host .control{padding:6px 18px}\n"] }]
171
+ }], () => [{ type: i0.ChangeDetectorRef }], { data: [{
172
+ type: Input
173
+ }], emit: [{
174
+ type: Input
175
+ }], rendered: [{
176
+ type: Input
177
+ }], width: [{
178
+ type: HostBinding,
179
+ args: ['style.width.px']
180
+ }], height: [{
181
+ type: HostBinding,
182
+ args: ['style.height.px']
183
+ }], selected: [{
184
+ type: HostBinding,
185
+ args: ['class.selected']
186
+ }] }); })();
187
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(NodeComponent, { className: "NodeComponent", filePath: "presets/classic/components/node/node.component.ts", lineNumber: 21 }); })();
188
+
189
+ class SocketComponent {
190
+ cdr;
191
+ data;
192
+ rendered;
193
+ get title() {
194
+ return this.data.name;
195
+ }
196
+ constructor(cdr) {
197
+ this.cdr = cdr;
198
+ this.cdr.detach();
199
+ }
200
+ ngOnChanges() {
201
+ this.cdr.detectChanges();
202
+ requestAnimationFrame(() => this.rendered());
203
+ }
204
+ static ɵfac = function SocketComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SocketComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
205
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SocketComponent, selectors: [["ng-component"]], hostVars: 1, hostBindings: function SocketComponent_HostBindings(rf, ctx) { if (rf & 2) {
206
+ i0.ɵɵdomProperty("title", ctx.title);
207
+ } }, inputs: { data: "data", rendered: "rendered" }, features: [i0.ɵɵNgOnChangesFeature], decls: 0, vars: 0, template: function SocketComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%]{display:inline-block;cursor:pointer;border:1px solid white;border-radius:12px;width:24px;height:24px;margin:6px;vertical-align:middle;background:#96b38a;z-index:2;box-sizing:border-box}[_nghost-%COMP%]:hover{border-width:4px}.multiple[_nghost-%COMP%]{border-color:#ff0}.output[_nghost-%COMP%]{margin-right:-12px}.input[_nghost-%COMP%]{margin-left:-12px}"] });
208
+ }
209
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SocketComponent, [{
210
+ type: Component,
211
+ args: [{ template: ``, styles: [":host{display:inline-block;cursor:pointer;border:1px solid white;border-radius:12px;width:24px;height:24px;margin:6px;vertical-align:middle;background:#96b38a;z-index:2;box-sizing:border-box}:host:hover{border-width:4px}:host.multiple{border-color:#ff0}:host.output{margin-right:-12px}:host.input{margin-left:-12px}\n"] }]
212
+ }], () => [{ type: i0.ChangeDetectorRef }], { data: [{
213
+ type: Input
214
+ }], rendered: [{
215
+ type: Input
216
+ }], title: [{
217
+ type: HostBinding,
218
+ args: ['title']
219
+ }] }); })();
220
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SocketComponent, { className: "SocketComponent", filePath: "presets/classic/components/socket/socket.component.ts", lineNumber: 7 }); })();
221
+
222
+ class ControlComponent {
223
+ cdr;
224
+ data;
225
+ rendered;
226
+ pointerdown(event) {
227
+ event.stopPropagation();
228
+ }
229
+ constructor(cdr) {
230
+ this.cdr = cdr;
231
+ this.cdr.detach();
232
+ }
233
+ ngOnChanges(changes) {
234
+ const seed = changes['seed'];
235
+ const data = changes['data'];
236
+ if ((seed && seed.currentValue !== seed.previousValue)
237
+ || (data && data.currentValue !== data.previousValue)) {
238
+ this.cdr.detectChanges();
239
+ }
240
+ requestAnimationFrame(() => this.rendered());
241
+ }
242
+ onChange(e) {
243
+ const target = e.target;
244
+ const value = (this.data.type === 'number'
245
+ ? +target.value
246
+ : target.value);
247
+ this.data.setValue(value);
248
+ this.cdr.detectChanges();
249
+ }
250
+ static ɵfac = function ControlComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ControlComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
251
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ControlComponent, selectors: [["ng-component"]], hostBindings: function ControlComponent_HostBindings(rf, ctx) { if (rf & 1) {
252
+ i0.ɵɵlistener("pointerdown", function ControlComponent_pointerdown_HostBindingHandler($event) { return ctx.pointerdown($event); });
253
+ } }, inputs: { data: "data", rendered: "rendered" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 3, consts: [[3, "input", "value", "readonly", "type"]], template: function ControlComponent_Template(rf, ctx) { if (rf & 1) {
254
+ i0.ɵɵdomElementStart(0, "input", 0);
255
+ i0.ɵɵdomListener("input", function ControlComponent_Template_input_input_0_listener($event) { return ctx.onChange($event); });
256
+ i0.ɵɵdomElementEnd();
257
+ } if (rf & 2) {
258
+ i0.ɵɵdomProperty("value", ctx.data.value)("readOnly", ctx.data.readonly)("type", ctx.data.type);
259
+ } }, styles: ["input[_ngcontent-%COMP%]{width:100%;border-radius:30px;background-color:#fff;padding:2px 6px;border:1px solid #999;font-size:110%;box-sizing:border-box}"] });
260
+ }
261
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ControlComponent, [{
262
+ type: Component,
263
+ args: [{ template: "<input\n [value]=\"data.value\"\n [readonly]=\"data.readonly\"\n [type]=\"data.type\"\n (input)=\"onChange($event)\"\n/>\n", styles: ["input{width:100%;border-radius:30px;background-color:#fff;padding:2px 6px;border:1px solid #999;font-size:110%;box-sizing:border-box}\n"] }]
264
+ }], () => [{ type: i0.ChangeDetectorRef }], { data: [{
265
+ type: Input
266
+ }], rendered: [{
267
+ type: Input
268
+ }], pointerdown: [{
269
+ type: HostListener,
270
+ args: ['pointerdown', ['$event']]
271
+ }] }); })();
272
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ControlComponent, { className: "ControlComponent", filePath: "presets/classic/components/control/control.component.ts", lineNumber: 8 }); })();
273
+
274
+ class ConnectionComponent {
275
+ data;
276
+ start;
277
+ end;
278
+ path;
279
+ static ɵfac = function ConnectionComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConnectionComponent)(); };
280
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ConnectionComponent, selectors: [["connection"]], inputs: { data: "data", start: "start", end: "end", path: "path" }, decls: 2, vars: 1, consts: [["data-testid", "connection"]], template: function ConnectionComponent_Template(rf, ctx) { if (rf & 1) {
281
+ i0.ɵɵnamespaceSVG();
282
+ i0.ɵɵdomElementStart(0, "svg", 0);
283
+ i0.ɵɵdomElement(1, "path");
284
+ i0.ɵɵdomElementEnd();
285
+ } if (rf & 2) {
286
+ i0.ɵɵadvance();
287
+ i0.ɵɵattribute("d", ctx.path);
288
+ } }, styles: ["svg[_ngcontent-%COMP%]{overflow:visible!important;position:absolute;pointer-events:none;width:9999px;height:9999px}svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:none;stroke-width:5px;stroke:#4682b4;pointer-events:auto}"] });
289
+ }
290
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConnectionComponent, [{
291
+ type: Component,
292
+ args: [{ selector: 'connection', template: "<svg data-testid=\"connection\">\n <path [attr.d]=\"path\" />\n</svg>\n", styles: ["svg{overflow:visible!important;position:absolute;pointer-events:none;width:9999px;height:9999px}svg path{fill:none;stroke-width:5px;stroke:#4682b4;pointer-events:auto}\n"] }]
293
+ }], null, { data: [{
294
+ type: Input
295
+ }], start: [{
296
+ type: Input
297
+ }], end: [{
298
+ type: Input
299
+ }], path: [{
300
+ type: Input
301
+ }] }); })();
302
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConnectionComponent, { className: "ConnectionComponent", filePath: "presets/classic/components/connection/connection.component.ts", lineNumber: 12 }); })();
303
+
304
+ class ConnectionWrapperComponent {
305
+ cdr;
306
+ viewContainerRef;
307
+ componentFactoryResolver;
308
+ data;
309
+ start;
310
+ end;
311
+ path;
312
+ rendered;
313
+ connectionComponent;
314
+ ref;
315
+ startOb = null;
316
+ get _start() {
317
+ return 'x' in this.start ? this.start : this.startOb;
318
+ }
319
+ endOb = null;
320
+ get _end() {
321
+ return 'x' in this.end ? this.end : this.endOb;
322
+ }
323
+ _path;
324
+ constructor(cdr, viewContainerRef, componentFactoryResolver) {
325
+ this.cdr = cdr;
326
+ this.viewContainerRef = viewContainerRef;
327
+ this.componentFactoryResolver = componentFactoryResolver;
328
+ this.cdr.detach();
329
+ }
330
+ async ngOnChanges() {
331
+ await this.updatePath();
332
+ requestAnimationFrame(() => this.rendered());
333
+ this.cdr.detectChanges();
334
+ this.update();
335
+ }
336
+ async updatePath() {
337
+ if (this._start && this._end) {
338
+ this._path = await this.path(this._start, this._end);
339
+ }
340
+ }
341
+ ngOnInit() {
342
+ if (typeof this.start === 'function') {
343
+ this.start(async (value) => {
344
+ this.startOb = value;
345
+ await this.updatePath();
346
+ this.cdr.detectChanges();
347
+ this.update();
348
+ });
349
+ }
350
+ if (typeof this.end === 'function') {
351
+ this.end(async (value) => {
352
+ this.endOb = value;
353
+ await this.updatePath();
354
+ this.cdr.detectChanges();
355
+ this.update();
356
+ });
357
+ }
358
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.connectionComponent);
359
+ this.viewContainerRef.clear();
360
+ this.ref = this.viewContainerRef.createComponent(componentFactory);
361
+ this.update();
362
+ }
363
+ update() {
364
+ this.ref.instance.data = this.data;
365
+ this.ref.instance.start = this._start;
366
+ this.ref.instance.end = this._end;
367
+ this.ref.instance.path = this._path;
368
+ this.ref.changeDetectorRef.markForCheck();
369
+ }
370
+ static ɵfac = function ConnectionWrapperComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConnectionWrapperComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
371
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ConnectionWrapperComponent, selectors: [["ng-component"]], inputs: { data: "data", start: "start", end: "end", path: "path", rendered: "rendered", connectionComponent: "connectionComponent" }, features: [i0.ɵɵNgOnChangesFeature], decls: 0, vars: 0, template: function ConnectionWrapperComponent_Template(rf, ctx) { }, encapsulation: 2 });
372
+ }
373
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConnectionWrapperComponent, [{
374
+ type: Component,
375
+ args: [{
376
+ template: ''
377
+ }]
378
+ }], () => [{ type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }], { data: [{
379
+ type: Input
380
+ }], start: [{
381
+ type: Input
382
+ }], end: [{
383
+ type: Input
384
+ }], path: [{
385
+ type: Input
386
+ }], rendered: [{
387
+ type: Input
388
+ }], connectionComponent: [{
389
+ type: Input
390
+ }] }); })();
391
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConnectionWrapperComponent, { className: "ConnectionWrapperComponent", filePath: "presets/classic/components/connection/connection-wrapper.component.ts", lineNumber: 10 }); })();
392
+
393
+ /**
394
+ * Classic preset for rendering nodes, connections, controls and sockets.
395
+ */
396
+ function setup$3(props) {
397
+ const positionWatcher = typeof props?.socketPositionWatcher === 'undefined'
398
+ ? getDOMSocketPosition() // fix Type instantiation is excessively deep and possibly infinite.
399
+ : props?.socketPositionWatcher;
400
+ const { node, connection, socket, control } = props?.customize || {};
401
+ return {
402
+ attach(plugin) {
403
+ positionWatcher.attach(plugin);
404
+ },
405
+ update(context) {
406
+ const data = context.data.payload;
407
+ if (context.data.type === 'connection') {
408
+ const { start, end } = context.data;
409
+ return {
410
+ data,
411
+ ...(start ? { start } : {}),
412
+ ...(end ? { end } : {}),
413
+ };
414
+ }
415
+ return { data };
416
+ },
417
+ mount(context, plugin) {
418
+ const parent = plugin.parentScope();
419
+ const emit = parent.emit.bind(parent);
420
+ const rendered = () => {
421
+ emit({ type: 'rendered', data: context.data });
422
+ };
423
+ if (context.data.type === 'node') {
424
+ const component = node ? node(context.data) : NodeComponent;
425
+ return {
426
+ key: `node-${context.data.payload.id}`,
427
+ component,
428
+ props: {
429
+ data: context.data.payload,
430
+ emit,
431
+ rendered
432
+ }
433
+ };
434
+ }
435
+ if (context.data.type === 'connection') {
436
+ const component = connection ? connection(context.data) : ConnectionComponent;
437
+ const id = context.data.payload.id;
438
+ const { sourceOutput, targetInput, source, target } = context.data.payload;
439
+ const { start, end, payload } = context.data;
440
+ return {
441
+ key: `connection-${id}`,
442
+ component: ConnectionWrapperComponent,
443
+ props: {
444
+ connectionComponent: component,
445
+ data: payload,
446
+ start: start || ((change) => positionWatcher.listen(source, 'output', sourceOutput, change)),
447
+ end: end || ((change) => positionWatcher.listen(target, 'input', targetInput, change)),
448
+ path: async (start, end) => {
449
+ const response = await plugin.emit({ type: 'connectionpath', data: { payload, points: [start, end] } });
450
+ if (!response)
451
+ return '';
452
+ const { path, points } = response.data;
453
+ const curvature = 0.3;
454
+ if (!path && points.length !== 2)
455
+ throw new Error('cannot render connection with a custom number of points');
456
+ if (!path)
457
+ return payload.isLoop
458
+ ? loopConnectionPath(points, curvature, 120)
459
+ : classicConnectionPath(points, curvature);
460
+ return path;
461
+ },
462
+ rendered
463
+ }
464
+ };
465
+ }
466
+ if (context.data.type === 'socket') {
467
+ const component = socket ? socket(context.data) : SocketComponent;
468
+ return {
469
+ key: `socket-${getUID()}`,
470
+ component,
471
+ props: {
472
+ data: context.data.payload,
473
+ rendered
474
+ }
475
+ };
476
+ }
477
+ if (context.data.type === 'control') {
478
+ const component = control
479
+ ? control(context.data)
480
+ : (context.data.payload instanceof ClassicPreset.InputControl
481
+ ? ControlComponent
482
+ : null);
483
+ if (component) {
484
+ return {
485
+ key: `control-${context.data.payload.id}`,
486
+ component,
487
+ props: {
488
+ data: context.data.payload,
489
+ rendered
490
+ }
491
+ };
492
+ }
493
+ return;
494
+ }
495
+ return;
496
+ }
497
+ };
498
+ }
499
+
500
+ var index$4 = /*#__PURE__*/Object.freeze({
501
+ __proto__: null,
502
+ setup: setup$3
503
+ });
504
+
505
+ function debounce(cb) {
506
+ return {
507
+ timeout: null,
508
+ cancel() {
509
+ if (this.timeout) {
510
+ window.clearTimeout(this.timeout);
511
+ this.timeout = null;
512
+ }
513
+ },
514
+ call(delay) {
515
+ this.timeout = window.setTimeout(() => {
516
+ cb();
517
+ }, delay);
518
+ }
519
+ };
520
+ }
521
+
522
+ class ContextMenuSearchComponent {
523
+ value;
524
+ update = new EventEmitter();
525
+ static ɵfac = function ContextMenuSearchComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ContextMenuSearchComponent)(); };
526
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ContextMenuSearchComponent, selectors: [["context-menu-search"]], inputs: { value: "value" }, outputs: { update: "update" }, decls: 1, vars: 1, consts: [["data-testid", "context-menu-search-input", 1, "search", 3, "input", "value"]], template: function ContextMenuSearchComponent_Template(rf, ctx) { if (rf & 1) {
527
+ i0.ɵɵdomElementStart(0, "input", 0);
528
+ i0.ɵɵdomListener("input", function ContextMenuSearchComponent_Template_input_input_0_listener($event) { return ctx.update.emit(($event.target == null ? null : $event.target.value) || ""); });
529
+ i0.ɵɵdomElementEnd();
530
+ } if (rf & 2) {
531
+ i0.ɵɵdomProperty("value", ctx.value);
532
+ } }, styles: [".search[_ngcontent-%COMP%]{color:#fff;padding:1px 8px;border:1px solid white;border-radius:10px;font-size:16px;font-family:serif;width:100%;box-sizing:border-box;background:transparent}"] });
533
+ }
534
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ContextMenuSearchComponent, [{
535
+ type: Component,
536
+ args: [{ selector: 'context-menu-search', template: "<input class=\"search\" [value]=\"value\" (input)=\"update.emit($any($event.target)?.value || '')\"\n data-testid=\"context-menu-search-input\" />\n", styles: [".search{color:#fff;padding:1px 8px;border:1px solid white;border-radius:10px;font-size:16px;font-family:serif;width:100%;box-sizing:border-box;background:transparent}\n"] }]
537
+ }], null, { value: [{
538
+ type: Input
539
+ }], update: [{
540
+ type: Output
541
+ }] }); })();
542
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ContextMenuSearchComponent, { className: "ContextMenuSearchComponent", filePath: "presets/context-menu/components/search/search.component.ts", lineNumber: 8 }); })();
543
+
544
+ const _c0 = ["*"];
545
+ function ContextMenuItemComponent_div_1_context_menu_item_1_Template(rf, ctx) { if (rf & 1) {
546
+ const _r1 = i0.ɵɵgetCurrentView();
547
+ i0.ɵɵelementStart(0, "context-menu-item", 3);
548
+ i0.ɵɵlistener("select", function ContextMenuItemComponent_div_1_context_menu_item_1_Template_context_menu_item_select_0_listener() { const item_r2 = i0.ɵɵrestoreView(_r1).$implicit; return i0.ɵɵresetView(item_r2.handler()); })("hide", function ContextMenuItemComponent_div_1_context_menu_item_1_Template_context_menu_item_hide_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.hide.emit()); });
549
+ i0.ɵɵtext(1);
550
+ i0.ɵɵelementEnd();
551
+ } if (rf & 2) {
552
+ const item_r2 = ctx.$implicit;
553
+ const ctx_r2 = i0.ɵɵnextContext(2);
554
+ i0.ɵɵproperty("delay", ctx_r2.delay);
555
+ i0.ɵɵadvance();
556
+ i0.ɵɵtextInterpolate1(" ", item_r2.label, " ");
557
+ } }
558
+ function ContextMenuItemComponent_div_1_Template(rf, ctx) { if (rf & 1) {
559
+ i0.ɵɵelementStart(0, "div", 1);
560
+ i0.ɵɵtemplate(1, ContextMenuItemComponent_div_1_context_menu_item_1_Template, 2, 2, "context-menu-item", 2);
561
+ i0.ɵɵelementEnd();
562
+ } if (rf & 2) {
563
+ const ctx_r2 = i0.ɵɵnextContext();
564
+ i0.ɵɵadvance();
565
+ i0.ɵɵproperty("ngForOf", ctx_r2.subitems);
566
+ } }
567
+ class ContextMenuItemComponent {
568
+ cdr;
569
+ subitems;
570
+ delay;
571
+ select = new EventEmitter();
572
+ hide = new EventEmitter();
573
+ get block() { return true; }
574
+ get hasSubitems() { return this.subitems; }
575
+ click(event) {
576
+ event.stopPropagation();
577
+ this.select.emit();
578
+ this.hide.emit();
579
+ }
580
+ pointerdown(event) {
581
+ event.stopPropagation();
582
+ }
583
+ wheel(event) {
584
+ event.stopPropagation();
585
+ }
586
+ hideSubitems = debounce(() => {
587
+ this.visibleSubitems = false;
588
+ this.cdr.detectChanges();
589
+ });
590
+ visibleSubitems = false;
591
+ pointerover() {
592
+ this.hideSubitems.cancel();
593
+ this.visibleSubitems = true;
594
+ this.cdr.detectChanges();
595
+ }
596
+ pointerleave() {
597
+ this.hideSubitems.call(this.delay);
598
+ this.cdr.detectChanges();
599
+ }
600
+ constructor(cdr) {
601
+ this.cdr = cdr;
602
+ this.cdr.detach();
603
+ }
604
+ static ɵfac = function ContextMenuItemComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ContextMenuItemComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
605
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ContextMenuItemComponent, selectors: [["context-menu-item"]], hostAttrs: ["data-testid", "context-menu-item"], hostVars: 4, hostBindings: function ContextMenuItemComponent_HostBindings(rf, ctx) { if (rf & 1) {
606
+ i0.ɵɵlistener("click", function ContextMenuItemComponent_click_HostBindingHandler($event) { return ctx.click($event); })("pointerdown", function ContextMenuItemComponent_pointerdown_HostBindingHandler($event) { return ctx.pointerdown($event); })("wheel", function ContextMenuItemComponent_wheel_HostBindingHandler($event) { return ctx.wheel($event); })("pointerover", function ContextMenuItemComponent_pointerover_HostBindingHandler() { return ctx.pointerover(); })("pointerleave", function ContextMenuItemComponent_pointerleave_HostBindingHandler() { return ctx.pointerleave(); });
607
+ } if (rf & 2) {
608
+ i0.ɵɵclassProp("block", ctx.block)("hasSubitems", ctx.hasSubitems);
609
+ } }, inputs: { subitems: "subitems", delay: "delay" }, outputs: { select: "select", hide: "hide" }, ngContentSelectors: _c0, decls: 2, vars: 1, consts: [["class", "subitems", 4, "ngIf"], [1, "subitems"], [3, "delay", "select", "hide", 4, "ngFor", "ngForOf"], [3, "select", "hide", "delay"]], template: function ContextMenuItemComponent_Template(rf, ctx) { if (rf & 1) {
610
+ i0.ɵɵprojectionDef();
611
+ i0.ɵɵprojection(0);
612
+ i0.ɵɵtemplate(1, ContextMenuItemComponent_div_1_Template, 2, 1, "div", 0);
613
+ } if (rf & 2) {
614
+ i0.ɵɵadvance();
615
+ i0.ɵɵproperty("ngIf", ctx.subitems && ctx.visibleSubitems);
616
+ } }, dependencies: [ContextMenuItemComponent, CommonModule, i1.NgForOf, i1.NgIf], styles: ["@charset \"UTF-8\";.hasSubitems[_nghost-%COMP%]:after{content:\"\\25ba\";position:absolute;opacity:.6;right:5px;top:5px;font-family:initial}.subitems[_ngcontent-%COMP%]{position:absolute;top:0;left:100%;width:120px}", ".block[_ngcontent-%COMP%]{display:block;color:#fff;padding:4px;border-bottom:1px solid rgba(69,103,255,.8);background-color:#6e88ffcc;cursor:pointer;width:100%;position:relative}.block[_ngcontent-%COMP%]:first-child{border-top-left-radius:5px;border-top-right-radius:5px}.block[_ngcontent-%COMP%]:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.block[_ngcontent-%COMP%]:hover{background-color:#8299ffcc}"] });
617
+ }
618
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ContextMenuItemComponent, [{
619
+ type: Component,
620
+ args: [{ imports: [CommonModule], selector: 'context-menu-item', host: {
621
+ 'data-testid': 'context-menu-item'
622
+ }, template: "<ng-content></ng-content>\n<div class=\"subitems\" *ngIf=\"subitems && visibleSubitems\">\n <context-menu-item *ngFor=\"let item of subitems\" [delay]=\"delay\" (select)=\"item.handler()\" (hide)=\"hide.emit()\">\n {{ item.label }}\n </context-menu-item>\n</div>\n", styles: ["@charset \"UTF-8\";:host(.hasSubitems):after{content:\"\\25ba\";position:absolute;opacity:.6;right:5px;top:5px;font-family:initial}.subitems{position:absolute;top:0;left:100%;width:120px}\n", ".block{display:block;color:#fff;padding:4px;border-bottom:1px solid rgba(69,103,255,.8);background-color:#6e88ffcc;cursor:pointer;width:100%;position:relative}.block:first-child{border-top-left-radius:5px;border-top-right-radius:5px}.block:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.block:hover{background-color:#8299ffcc}\n"] }]
623
+ }], () => [{ type: i0.ChangeDetectorRef }], { subitems: [{
624
+ type: Input
625
+ }], delay: [{
626
+ type: Input
627
+ }], select: [{
628
+ type: Output
629
+ }], hide: [{
630
+ type: Output
631
+ }], block: [{
632
+ type: HostBinding,
633
+ args: ['class.block']
634
+ }], hasSubitems: [{
635
+ type: HostBinding,
636
+ args: ['class.hasSubitems']
637
+ }], click: [{
638
+ type: HostListener,
639
+ args: ['click', ['$event']]
640
+ }], pointerdown: [{
641
+ type: HostListener,
642
+ args: ['pointerdown', ['$event']]
643
+ }], wheel: [{
644
+ type: HostListener,
645
+ args: ['wheel', ['$event']]
646
+ }], pointerover: [{
647
+ type: HostListener,
648
+ args: ['pointerover']
649
+ }], pointerleave: [{
650
+ type: HostListener,
651
+ args: ['pointerleave']
652
+ }] }); })();
653
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ContextMenuItemComponent, { className: "ContextMenuItemComponent", filePath: "presets/context-menu/components/item/item.component.ts", lineNumber: 18 }); })();
654
+
655
+ function ContextMenuComponent_div_0_Template(rf, ctx) { if (rf & 1) {
656
+ const _r1 = i0.ɵɵgetCurrentView();
657
+ i0.ɵɵelementStart(0, "div", 2)(1, "context-menu-search", 3);
658
+ i0.ɵɵlistener("update", function ContextMenuComponent_div_0_Template_context_menu_search_update_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setFilter($event)); });
659
+ i0.ɵɵelementEnd()();
660
+ } if (rf & 2) {
661
+ const ctx_r1 = i0.ɵɵnextContext();
662
+ i0.ɵɵadvance();
663
+ i0.ɵɵproperty("value", ctx_r1.filter);
664
+ } }
665
+ function ContextMenuComponent_context_menu_item_1_Template(rf, ctx) { if (rf & 1) {
666
+ const _r3 = i0.ɵɵgetCurrentView();
667
+ i0.ɵɵelementStart(0, "context-menu-item", 4);
668
+ i0.ɵɵlistener("select", function ContextMenuComponent_context_menu_item_1_Template_context_menu_item_select_0_listener() { const item_r4 = i0.ɵɵrestoreView(_r3).$implicit; return i0.ɵɵresetView(item_r4.handler()); })("hide", function ContextMenuComponent_context_menu_item_1_Template_context_menu_item_hide_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onHide()); });
669
+ i0.ɵɵtext(1);
670
+ i0.ɵɵelementEnd();
671
+ } if (rf & 2) {
672
+ const item_r4 = ctx.$implicit;
673
+ const ctx_r1 = i0.ɵɵnextContext();
674
+ i0.ɵɵproperty("delay", ctx_r1.delay)("subitems", item_r4.subitems);
675
+ i0.ɵɵadvance();
676
+ i0.ɵɵtextInterpolate1(" ", item_r4.label, "\n");
677
+ } }
678
+ class ContextMenuComponent {
679
+ cdr;
680
+ items;
681
+ delay;
682
+ searchBar;
683
+ onHide;
684
+ rendered;
685
+ filter = '';
686
+ hide = debounce(() => {
687
+ this.onHide();
688
+ this.cdr.detectChanges();
689
+ });
690
+ customAttribute = '';
691
+ pointerover() {
692
+ this.hide.cancel();
693
+ this.cdr.detectChanges();
694
+ }
695
+ pointerleave() {
696
+ this.hide.call(this.delay);
697
+ this.cdr.detectChanges();
698
+ }
699
+ constructor(cdr) {
700
+ this.cdr = cdr;
701
+ this.cdr.detach();
702
+ }
703
+ ngOnChanges() {
704
+ this.cdr.detectChanges();
705
+ requestAnimationFrame(() => this.rendered());
706
+ }
707
+ setFilter(value) {
708
+ this.filter = value;
709
+ this.cdr.detectChanges();
710
+ }
711
+ getItems() {
712
+ const filterRegexp = new RegExp(this.filter, 'i');
713
+ const filteredList = this.items.filter(item => (item.label.match(filterRegexp)));
714
+ return filteredList;
715
+ }
716
+ ngOnDestroy() {
717
+ if (this.hide)
718
+ this.hide.cancel();
719
+ }
720
+ static ɵfac = function ContextMenuComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ContextMenuComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
721
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ContextMenuComponent, selectors: [["ng-component"]], hostAttrs: ["data-testid", "context-menu"], hostVars: 1, hostBindings: function ContextMenuComponent_HostBindings(rf, ctx) { if (rf & 1) {
722
+ i0.ɵɵlistener("mouseover", function ContextMenuComponent_mouseover_HostBindingHandler() { return ctx.pointerover(); })("mouseleave", function ContextMenuComponent_mouseleave_HostBindingHandler() { return ctx.pointerleave(); });
723
+ } if (rf & 2) {
724
+ i0.ɵɵattribute("rete-context-menu", ctx.customAttribute);
725
+ } }, inputs: { items: "items", delay: "delay", searchBar: "searchBar", onHide: "onHide", rendered: "rendered" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [["class", "block", 4, "ngIf"], [3, "delay", "subitems", "select", "hide", 4, "ngFor", "ngForOf"], [1, "block"], [3, "update", "value"], [3, "select", "hide", "delay", "subitems"]], template: function ContextMenuComponent_Template(rf, ctx) { if (rf & 1) {
726
+ i0.ɵɵtemplate(0, ContextMenuComponent_div_0_Template, 2, 1, "div", 0)(1, ContextMenuComponent_context_menu_item_1_Template, 2, 3, "context-menu-item", 1);
727
+ } if (rf & 2) {
728
+ i0.ɵɵproperty("ngIf", ctx.searchBar);
729
+ i0.ɵɵadvance();
730
+ i0.ɵɵproperty("ngForOf", ctx.getItems());
731
+ } }, dependencies: [CommonModule, i1.NgForOf, i1.NgIf, ContextMenuSearchComponent, ContextMenuItemComponent], styles: ["[_nghost-%COMP%]{display:block;padding:10px;width:120px;margin-top:-20px;margin-left:-60px}", ".block[_ngcontent-%COMP%]{display:block;color:#fff;padding:4px;border-bottom:1px solid rgba(69,103,255,.8);background-color:#6e88ffcc;cursor:pointer;width:100%;position:relative}.block[_ngcontent-%COMP%]:first-child{border-top-left-radius:5px;border-top-right-radius:5px}.block[_ngcontent-%COMP%]:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.block[_ngcontent-%COMP%]:hover{background-color:#8299ffcc}"] });
732
+ }
733
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ContextMenuComponent, [{
734
+ type: Component,
735
+ args: [{ imports: [CommonModule, ContextMenuSearchComponent, ContextMenuItemComponent], host: {
736
+ 'data-testid': 'context-menu'
737
+ }, template: "<div class=\"block\" *ngIf=\"searchBar\">\n <context-menu-search [value]=\"filter\" (update)=\"setFilter($event)\"></context-menu-search>\n</div>\n\n<context-menu-item *ngFor=\"let item of getItems()\" [delay]=\"delay\" (select)=\"item.handler()\" [subitems]=\"item.subitems\"\n (hide)=\"onHide()\">\n {{ item.label }}\n</context-menu-item>\n", styles: [":host{display:block;padding:10px;width:120px;margin-top:-20px;margin-left:-60px}\n", ".block{display:block;color:#fff;padding:4px;border-bottom:1px solid rgba(69,103,255,.8);background-color:#6e88ffcc;cursor:pointer;width:100%;position:relative}.block:first-child{border-top-left-radius:5px;border-top-right-radius:5px}.block:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.block:hover{background-color:#8299ffcc}\n"] }]
738
+ }], () => [{ type: i0.ChangeDetectorRef }], { items: [{
739
+ type: Input
740
+ }], delay: [{
741
+ type: Input
742
+ }], searchBar: [{
743
+ type: Input
744
+ }], onHide: [{
745
+ type: Input
746
+ }], rendered: [{
747
+ type: Input
748
+ }], customAttribute: [{
749
+ type: HostBinding,
750
+ args: ['attr.rete-context-menu']
751
+ }], pointerover: [{
752
+ type: HostListener,
753
+ args: ['mouseover']
754
+ }], pointerleave: [{
755
+ type: HostListener,
756
+ args: ['mouseleave']
757
+ }] }); })();
758
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ContextMenuComponent, { className: "ContextMenuComponent", filePath: "presets/context-menu/components/menu/menu.component.ts", lineNumber: 19 }); })();
759
+
760
+ /**
761
+ * Preset for rendering context menu.
762
+ */
763
+ function setup$2(props) {
764
+ const delay = typeof props?.delay === 'undefined' ? 1000 : props.delay;
765
+ return {
766
+ update(context) {
767
+ if (context.data.type === 'contextmenu') {
768
+ return {
769
+ items: context.data.items,
770
+ delay,
771
+ searchBar: context.data.searchBar,
772
+ onHide: context.data.onHide
773
+ };
774
+ }
775
+ },
776
+ mount(context, plugin) {
777
+ const parent = plugin.parentScope();
778
+ const emit = parent.emit.bind(parent);
779
+ const rendered = () => {
780
+ emit({ type: 'rendered', data: context.data });
781
+ };
782
+ if (context.data.type === 'contextmenu') {
783
+ return {
784
+ key: 'context-menu',
785
+ component: ContextMenuComponent,
786
+ props: {
787
+ items: context.data.items,
788
+ delay,
789
+ searchBar: context.data.searchBar,
790
+ onHide: context.data.onHide,
791
+ rendered
792
+ }
793
+ };
794
+ }
795
+ return null;
796
+ }
797
+ };
798
+ }
799
+
800
+ var index$3 = /*#__PURE__*/Object.freeze({
801
+ __proto__: null,
802
+ setup: setup$2
803
+ });
804
+
805
+ class MiniNodeComponent {
806
+ left;
807
+ top;
808
+ width;
809
+ height;
810
+ get styleLeft() {
811
+ return this.px(this.left);
812
+ }
813
+ get styleTop() {
814
+ return this.px(this.top);
815
+ }
816
+ get styleWidth() {
817
+ return this.px(this.width);
818
+ }
819
+ get styleHeight() {
820
+ return this.px(this.height);
821
+ }
822
+ px(value) {
823
+ return `${value}px`;
824
+ }
825
+ static ɵfac = function MiniNodeComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MiniNodeComponent)(); };
826
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MiniNodeComponent, selectors: [["minimap-mini-node"]], hostAttrs: ["data-testid", "minimap-node"], hostVars: 8, hostBindings: function MiniNodeComponent_HostBindings(rf, ctx) { if (rf & 2) {
827
+ i0.ɵɵstyleProp("left", ctx.styleLeft)("top", ctx.styleTop)("width", ctx.styleWidth)("height", ctx.styleHeight);
828
+ } }, inputs: { left: "left", top: "top", width: "width", height: "height" }, decls: 0, vars: 0, template: function MiniNodeComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%]{display:block;position:absolute;background:#6e88ffcc;border:1px solid rgba(192,206,212,.6)}"] });
829
+ }
830
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MiniNodeComponent, [{
831
+ type: Component,
832
+ args: [{ selector: 'minimap-mini-node', host: {
833
+ 'data-testid': 'minimap-node'
834
+ }, template: "", styles: [":host{display:block;position:absolute;background:#6e88ffcc;border:1px solid rgba(192,206,212,.6)}\n"] }]
835
+ }], null, { left: [{
836
+ type: Input
837
+ }], top: [{
838
+ type: Input
839
+ }], width: [{
840
+ type: Input
841
+ }], height: [{
842
+ type: Input
843
+ }], styleLeft: [{
844
+ type: HostBinding,
845
+ args: ['style.left']
846
+ }], styleTop: [{
847
+ type: HostBinding,
848
+ args: ['style.top']
849
+ }], styleWidth: [{
850
+ type: HostBinding,
851
+ args: ['style.width']
852
+ }], styleHeight: [{
853
+ type: HostBinding,
854
+ args: ['style.height']
855
+ }] }); })();
856
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MiniNodeComponent, { className: "MiniNodeComponent", filePath: "presets/minimap/components/mini-node/mini-node.component.ts", lineNumber: 11 }); })();
857
+
858
+ function useDrag(translate, getPointer) {
859
+ return {
860
+ start(e) {
861
+ let previous = { ...getPointer(e) };
862
+ function move(moveEvent) {
863
+ const current = { ...getPointer(moveEvent) };
864
+ const dx = current.x - previous.x;
865
+ const dy = current.y - previous.y;
866
+ previous = current;
867
+ translate(dx, dy);
868
+ }
869
+ function up() {
870
+ window.removeEventListener('pointermove', move);
871
+ window.removeEventListener('pointerup', up);
872
+ window.removeEventListener('pointercancel', up);
873
+ }
874
+ window.addEventListener('pointermove', move);
875
+ window.addEventListener('pointerup', up);
876
+ window.addEventListener('pointercancel', up);
877
+ }
878
+ };
879
+ }
880
+
881
+ class MiniViewportComponent {
882
+ left;
883
+ top;
884
+ width;
885
+ height;
886
+ containerWidth;
887
+ translate;
888
+ drag = useDrag((dx, dy) => this.onDrag(dx, dy), e => ({ x: e.pageX, y: e.pageY }));
889
+ get styleLeft() {
890
+ return this.px(this.scale(this.left));
891
+ }
892
+ get styleTop() {
893
+ return this.px(this.scale(this.top));
894
+ }
895
+ get styleWidth() {
896
+ return this.px(this.scale(this.width));
897
+ }
898
+ get styleHeight() {
899
+ return this.px(this.scale(this.height));
900
+ }
901
+ pointerdown(event) {
902
+ event.stopPropagation();
903
+ this.drag.start(event);
904
+ }
905
+ px(value) {
906
+ return `${value}px`;
907
+ }
908
+ scale(v) {
909
+ return v * this.containerWidth;
910
+ }
911
+ invert(v) {
912
+ return v / this.containerWidth;
913
+ }
914
+ onDrag(dx, dy) {
915
+ this.translate(this.invert(-dx), this.invert(-dy));
916
+ }
917
+ static ɵfac = function MiniViewportComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MiniViewportComponent)(); };
918
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MiniViewportComponent, selectors: [["minimap-mini-viewport"]], hostAttrs: ["data-testid", "minimap-viewport"], hostVars: 8, hostBindings: function MiniViewportComponent_HostBindings(rf, ctx) { if (rf & 1) {
919
+ i0.ɵɵlistener("pointerdown", function MiniViewportComponent_pointerdown_HostBindingHandler($event) { return ctx.pointerdown($event); });
920
+ } if (rf & 2) {
921
+ i0.ɵɵstyleProp("left", ctx.styleLeft)("top", ctx.styleTop)("width", ctx.styleWidth)("height", ctx.styleHeight);
922
+ } }, inputs: { left: "left", top: "top", width: "width", height: "height", containerWidth: "containerWidth", translate: "translate" }, decls: 0, vars: 0, template: function MiniViewportComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%]{display:block;position:absolute;background:#fffb8052;border:1px solid #ffe52b}"] });
923
+ }
924
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MiniViewportComponent, [{
925
+ type: Component,
926
+ args: [{ selector: 'minimap-mini-viewport', host: {
927
+ 'data-testid': 'minimap-viewport'
928
+ }, template: "", styles: [":host{display:block;position:absolute;background:#fffb8052;border:1px solid #ffe52b}\n"] }]
929
+ }], null, { left: [{
930
+ type: Input
931
+ }], top: [{
932
+ type: Input
933
+ }], width: [{
934
+ type: Input
935
+ }], height: [{
936
+ type: Input
937
+ }], containerWidth: [{
938
+ type: Input
939
+ }], translate: [{
940
+ type: Input
941
+ }], styleLeft: [{
942
+ type: HostBinding,
943
+ args: ['style.left']
944
+ }], styleTop: [{
945
+ type: HostBinding,
946
+ args: ['style.top']
947
+ }], styleWidth: [{
948
+ type: HostBinding,
949
+ args: ['style.width']
950
+ }], styleHeight: [{
951
+ type: HostBinding,
952
+ args: ['style.height']
953
+ }], pointerdown: [{
954
+ type: HostListener,
955
+ args: ['pointerdown', ['$event']]
956
+ }] }); })();
957
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MiniViewportComponent, { className: "MiniViewportComponent", filePath: "presets/minimap/components/mini-viewport/mini-viewport.component.ts", lineNumber: 13 }); })();
958
+
959
+ function MinimapComponent_minimap_mini_node_0_Template(rf, ctx) { if (rf & 1) {
960
+ i0.ɵɵelement(0, "minimap-mini-node", 2);
961
+ } if (rf & 2) {
962
+ const node_r1 = ctx.$implicit;
963
+ const ctx_r1 = i0.ɵɵnextContext();
964
+ i0.ɵɵproperty("left", ctx_r1.scale(node_r1.left))("top", ctx_r1.scale(node_r1.top))("width", ctx_r1.scale(node_r1.width))("height", ctx_r1.scale(node_r1.height));
965
+ } }
966
+ class MinimapComponent {
967
+ el;
968
+ cdr;
969
+ rendered;
970
+ size;
971
+ ratio;
972
+ nodes;
973
+ viewport;
974
+ translate;
975
+ point;
976
+ get width() {
977
+ return this.px(this.size * this.ratio);
978
+ }
979
+ get height() {
980
+ return this.px(this.size);
981
+ }
982
+ pointerdown(event) {
983
+ event.stopPropagation();
984
+ event.preventDefault();
985
+ }
986
+ dblclick(event) {
987
+ event.stopPropagation();
988
+ event.preventDefault();
989
+ if (!this.el.nativeElement)
990
+ return;
991
+ const box = this.el.nativeElement.getBoundingClientRect();
992
+ const x = (event.clientX - box.left) / (this.size * this.ratio);
993
+ const y = (event.clientY - box.top) / (this.size * this.ratio);
994
+ this.point(x, y);
995
+ }
996
+ constructor(el, cdr) {
997
+ this.el = el;
998
+ this.cdr = cdr;
999
+ this.cdr.detach();
1000
+ }
1001
+ ngOnChanges() {
1002
+ this.cdr.detectChanges();
1003
+ requestAnimationFrame(() => this.rendered());
1004
+ }
1005
+ px(value) {
1006
+ return `${value}px`;
1007
+ }
1008
+ scale(value) {
1009
+ if (!this.el.nativeElement)
1010
+ return 0;
1011
+ return value * this.el.nativeElement.clientWidth;
1012
+ }
1013
+ identifyMiniNode(_, item) {
1014
+ return [item.top, item.left].join('_');
1015
+ }
1016
+ static ɵfac = function MinimapComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MinimapComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
1017
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MinimapComponent, selectors: [["ng-component"]], hostAttrs: ["data-testid", "minimap"], hostVars: 4, hostBindings: function MinimapComponent_HostBindings(rf, ctx) { if (rf & 1) {
1018
+ i0.ɵɵlistener("pointerdown", function MinimapComponent_pointerdown_HostBindingHandler($event) { return ctx.pointerdown($event); })("dblclick", function MinimapComponent_dblclick_HostBindingHandler($event) { return ctx.dblclick($event); });
1019
+ } if (rf & 2) {
1020
+ i0.ɵɵstyleProp("width", ctx.width)("height", ctx.height);
1021
+ } }, inputs: { rendered: "rendered", size: "size", ratio: "ratio", nodes: "nodes", viewport: "viewport", translate: "translate", point: "point" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 8, consts: [[3, "left", "top", "width", "height", 4, "ngFor", "ngForOf", "ngForTrackBy"], [3, "left", "top", "width", "height", "containerWidth", "translate"], [3, "left", "top", "width", "height"]], template: function MinimapComponent_Template(rf, ctx) { if (rf & 1) {
1022
+ i0.ɵɵtemplate(0, MinimapComponent_minimap_mini_node_0_Template, 1, 4, "minimap-mini-node", 0);
1023
+ i0.ɵɵelement(1, "minimap-mini-viewport", 1);
1024
+ } if (rf & 2) {
1025
+ i0.ɵɵproperty("ngForOf", ctx.nodes)("ngForTrackBy", ctx.identifyMiniNode);
1026
+ i0.ɵɵadvance();
1027
+ i0.ɵɵproperty("left", ctx.viewport.left)("top", ctx.viewport.top)("width", ctx.viewport.width)("height", ctx.viewport.height)("containerWidth", ctx.el.nativeElement == null ? null : ctx.el.nativeElement.clientWidth)("translate", ctx.translate);
1028
+ } }, dependencies: [CommonModule, i1.NgForOf, MiniNodeComponent, MiniViewportComponent], styles: ["[_nghost-%COMP%]{position:absolute;right:24px;bottom:24px;background:#e5eaefa6;padding:20px;overflow:hidden;border:1px solid #b1b7ff;border-radius:8px;box-sizing:border-box}"] });
1029
+ }
1030
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MinimapComponent, [{
1031
+ type: Component,
1032
+ args: [{ imports: [CommonModule, MiniNodeComponent, MiniViewportComponent], host: {
1033
+ 'data-testid': 'minimap'
1034
+ }, template: "<minimap-mini-node *ngFor=\"let node of nodes; trackBy: identifyMiniNode\" [left]=\"scale(node.left)\"\n [top]=\"scale(node.top)\" [width]=\"scale(node.width)\" [height]=\"scale(node.height)\">\n\n</minimap-mini-node>\n<minimap-mini-viewport [left]=\"viewport.left\" [top]=\"viewport.top\" [width]=\"viewport.width\" [height]=\"viewport.height\"\n [containerWidth]=\"el.nativeElement?.clientWidth\" [translate]=\"translate\"></minimap-mini-viewport>\n", styles: [":host{position:absolute;right:24px;bottom:24px;background:#e5eaefa6;padding:20px;overflow:hidden;border:1px solid #b1b7ff;border-radius:8px;box-sizing:border-box}\n"] }]
1035
+ }], () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], { rendered: [{
1036
+ type: Input
1037
+ }], size: [{
1038
+ type: Input
1039
+ }], ratio: [{
1040
+ type: Input
1041
+ }], nodes: [{
1042
+ type: Input
1043
+ }], viewport: [{
1044
+ type: Input
1045
+ }], translate: [{
1046
+ type: Input
1047
+ }], point: [{
1048
+ type: Input
1049
+ }], width: [{
1050
+ type: HostBinding,
1051
+ args: ['style.width']
1052
+ }], height: [{
1053
+ type: HostBinding,
1054
+ args: ['style.height']
1055
+ }], pointerdown: [{
1056
+ type: HostListener,
1057
+ args: ['pointerdown', ['$event']]
1058
+ }], dblclick: [{
1059
+ type: HostListener,
1060
+ args: ['dblclick', ['$event']]
1061
+ }] }); })();
1062
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MinimapComponent, { className: "MinimapComponent", filePath: "presets/minimap/components/minimap/minimap.component.ts", lineNumber: 17 }); })();
1063
+
1064
+ /**
1065
+ * Preset for rendering minimap.
1066
+ */
1067
+ function setup$1(props) {
1068
+ return {
1069
+ update(context) {
1070
+ if (context.data.type === 'minimap') {
1071
+ return {
1072
+ nodes: context.data.nodes,
1073
+ size: props?.size || 200,
1074
+ ratio: context.data.ratio,
1075
+ viewport: context.data.viewport,
1076
+ translate: context.data.translate,
1077
+ point: context.data.point
1078
+ };
1079
+ }
1080
+ return null;
1081
+ },
1082
+ mount(context, plugin) {
1083
+ const parent = plugin.parentScope();
1084
+ const emit = parent.emit.bind(parent);
1085
+ const rendered = () => {
1086
+ emit({ type: 'rendered', data: context.data });
1087
+ };
1088
+ if (context.data.type === 'minimap') {
1089
+ return {
1090
+ key: 'rete-minimap',
1091
+ component: MinimapComponent,
1092
+ props: {
1093
+ nodes: context.data.nodes,
1094
+ size: props?.size || 200,
1095
+ ratio: context.data.ratio,
1096
+ viewport: context.data.viewport,
1097
+ translate: context.data.translate,
1098
+ point: context.data.point,
1099
+ rendered
1100
+ }
1101
+ };
1102
+ }
1103
+ return null;
1104
+ }
1105
+ };
1106
+ }
1107
+
1108
+ var index$2 = /*#__PURE__*/Object.freeze({
1109
+ __proto__: null,
1110
+ setup: setup$1
1111
+ });
1112
+
1113
+ const pinSize = 20;
1114
+ class PinComponent {
1115
+ cdr;
1116
+ position;
1117
+ selected;
1118
+ getPointer;
1119
+ menu = new EventEmitter();
1120
+ translate = new EventEmitter();
1121
+ down = new EventEmitter();
1122
+ drag = useDrag((dx, dy) => {
1123
+ this.translate.emit({ dx, dy });
1124
+ }, () => this.getPointer());
1125
+ get _selected() {
1126
+ return this.selected;
1127
+ }
1128
+ get top() {
1129
+ return `${this.position.y - pinSize / 2}px`;
1130
+ }
1131
+ get left() {
1132
+ return `${this.position.x - pinSize / 2}px`;
1133
+ }
1134
+ pointerdown(event) {
1135
+ event.stopPropagation();
1136
+ event.preventDefault();
1137
+ this.drag.start(event);
1138
+ this.down.emit();
1139
+ }
1140
+ contextmenu(event) {
1141
+ event.stopPropagation();
1142
+ event.preventDefault();
1143
+ this.menu.emit();
1144
+ }
1145
+ constructor(cdr) {
1146
+ this.cdr = cdr;
1147
+ // this.cdr.detach()
1148
+ }
1149
+ ngOnChanges() {
1150
+ // this.cdr.detectChanges()
1151
+ // requestAnimationFrame(() => this.rendered())
1152
+ }
1153
+ static ɵfac = function PinComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PinComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
1154
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PinComponent, selectors: [["reroute-pin"]], hostAttrs: ["data-testid", "pin"], hostVars: 6, hostBindings: function PinComponent_HostBindings(rf, ctx) { if (rf & 1) {
1155
+ i0.ɵɵlistener("pointerdown", function PinComponent_pointerdown_HostBindingHandler($event) { return ctx.pointerdown($event); })("contextmenu", function PinComponent_contextmenu_HostBindingHandler($event) { return ctx.contextmenu($event); });
1156
+ } if (rf & 2) {
1157
+ i0.ɵɵstyleProp("top", ctx.top)("left", ctx.left);
1158
+ i0.ɵɵclassProp("selected", ctx._selected);
1159
+ } }, inputs: { position: "position", selected: "selected", getPointer: "getPointer" }, outputs: { menu: "menu", translate: "translate", down: "down" }, features: [i0.ɵɵNgOnChangesFeature], decls: 0, vars: 0, template: function PinComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%]{display:block;width:20px;height:20px;box-sizing:border-box;background:#4682b4;border:2px solid white;border-radius:20px;position:absolute}.selected[_nghost-%COMP%]{background:#ffd92c}"] });
1160
+ }
1161
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PinComponent, [{
1162
+ type: Component,
1163
+ args: [{ selector: 'reroute-pin', template: '', host: {
1164
+ 'data-testid': 'pin'
1165
+ }, styles: [":host{display:block;width:20px;height:20px;box-sizing:border-box;background:#4682b4;border:2px solid white;border-radius:20px;position:absolute}:host.selected{background:#ffd92c}\n"] }]
1166
+ }], () => [{ type: i0.ChangeDetectorRef }], { position: [{
1167
+ type: Input
1168
+ }], selected: [{
1169
+ type: Input
1170
+ }], getPointer: [{
1171
+ type: Input
1172
+ }], menu: [{
1173
+ type: Output
1174
+ }], translate: [{
1175
+ type: Output
1176
+ }], down: [{
1177
+ type: Output
1178
+ }], _selected: [{
1179
+ type: HostBinding,
1180
+ args: ['class.selected']
1181
+ }], top: [{
1182
+ type: HostBinding,
1183
+ args: ['style.top']
1184
+ }], left: [{
1185
+ type: HostBinding,
1186
+ args: ['style.left']
1187
+ }], pointerdown: [{
1188
+ type: HostListener,
1189
+ args: ['pointerdown', ['$event']]
1190
+ }], contextmenu: [{
1191
+ type: HostListener,
1192
+ args: ['contextmenu', ['$event']]
1193
+ }] }); })();
1194
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PinComponent, { className: "PinComponent", filePath: "presets/reroute/components/pin/pin.component.ts", lineNumber: 15 }); })();
1195
+
1196
+ function PinsComponent_reroute_pin_0_Template(rf, ctx) { if (rf & 1) {
1197
+ const _r1 = i0.ɵɵgetCurrentView();
1198
+ i0.ɵɵelementStart(0, "reroute-pin", 1);
1199
+ i0.ɵɵlistener("menu", function PinsComponent_reroute_pin_0_Template_reroute_pin_menu_0_listener() { const pin_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.menu && ctx_r2.menu(pin_r2.id)); })("translate", function PinsComponent_reroute_pin_0_Template_reroute_pin_translate_0_listener($event) { const pin_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.translate && ctx_r2.translate(pin_r2.id, $event.dx, $event.dy)); })("down", function PinsComponent_reroute_pin_0_Template_reroute_pin_down_0_listener() { const pin_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.down && ctx_r2.down(pin_r2.id)); });
1200
+ i0.ɵɵelementEnd();
1201
+ } if (rf & 2) {
1202
+ const pin_r2 = ctx.$implicit;
1203
+ const ctx_r2 = i0.ɵɵnextContext();
1204
+ i0.ɵɵproperty("position", pin_r2.position)("selected", pin_r2.selected)("getPointer", ctx_r2.getPointer);
1205
+ } }
1206
+ class PinsComponent {
1207
+ cdr;
1208
+ rendered;
1209
+ pins;
1210
+ down;
1211
+ translate;
1212
+ menu;
1213
+ getPointer;
1214
+ constructor(cdr) {
1215
+ this.cdr = cdr;
1216
+ this.cdr.detach();
1217
+ }
1218
+ ngOnChanges() {
1219
+ this.cdr.detectChanges();
1220
+ requestAnimationFrame(() => this.rendered());
1221
+ }
1222
+ track(_, item) {
1223
+ return item.id;
1224
+ }
1225
+ static ɵfac = function PinsComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PinsComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
1226
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PinsComponent, selectors: [["ng-component"]], inputs: { rendered: "rendered", pins: "pins", down: "down", translate: "translate", menu: "menu", getPointer: "getPointer" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 2, consts: [[3, "position", "selected", "getPointer", "menu", "translate", "down", 4, "ngFor", "ngForOf", "ngForTrackBy"], [3, "menu", "translate", "down", "position", "selected", "getPointer"]], template: function PinsComponent_Template(rf, ctx) { if (rf & 1) {
1227
+ i0.ɵɵtemplate(0, PinsComponent_reroute_pin_0_Template, 1, 3, "reroute-pin", 0);
1228
+ } if (rf & 2) {
1229
+ i0.ɵɵproperty("ngForOf", ctx.pins)("ngForTrackBy", ctx.track);
1230
+ } }, dependencies: [CommonModule, i1.NgForOf, PinComponent], encapsulation: 2 });
1231
+ }
1232
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PinsComponent, [{
1233
+ type: Component,
1234
+ args: [{ imports: [CommonModule, PinComponent], template: "<reroute-pin *ngFor=\"let pin of pins; trackBy: track\" [position]=\"pin.position\" [selected]=\"pin.selected\"\n (menu)=\"menu && menu(pin.id)\" (translate)=\"translate && translate(pin.id, $event.dx, $event.dy)\"\n (down)=\"down && down(pin.id)\" [getPointer]=\"getPointer\"></reroute-pin>\n" }]
1235
+ }], () => [{ type: i0.ChangeDetectorRef }], { rendered: [{
1236
+ type: Input
1237
+ }], pins: [{
1238
+ type: Input
1239
+ }], down: [{
1240
+ type: Input
1241
+ }], translate: [{
1242
+ type: Input
1243
+ }], menu: [{
1244
+ type: Input
1245
+ }], getPointer: [{
1246
+ type: Input
1247
+ }] }); })();
1248
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PinsComponent, { className: "PinsComponent", filePath: "presets/reroute/components/pins/pins.component.ts", lineNumber: 12 }); })();
1249
+
1250
+ /**
1251
+ * Preset for rendering pins.
1252
+ */
1253
+ function setup(props) {
1254
+ const getProps = () => ({
1255
+ menu: props?.contextMenu || (() => null),
1256
+ translate: props?.translate || (() => null),
1257
+ down: props?.pointerdown || (() => null)
1258
+ });
1259
+ return {
1260
+ update(context) {
1261
+ if (context.data.type === 'reroute-pins') {
1262
+ return {
1263
+ ...getProps(),
1264
+ pins: context.data.data.pins
1265
+ };
1266
+ }
1267
+ return null;
1268
+ },
1269
+ mount(context, plugin) {
1270
+ const area = plugin.parentScope(BaseAreaPlugin);
1271
+ const rendered = () => {
1272
+ area.emit({ type: 'rendered', data: context.data });
1273
+ };
1274
+ if (context.data.type === 'reroute-pins') {
1275
+ return {
1276
+ key: 'rete-reroute',
1277
+ component: PinsComponent,
1278
+ props: {
1279
+ ...getProps(),
1280
+ pins: context.data.data.pins,
1281
+ rendered,
1282
+ getPointer: () => area.area.pointer
1283
+ }
1284
+ };
1285
+ }
1286
+ return null;
1287
+ }
1288
+ };
1289
+ }
1290
+
1291
+ var index$1 = /*#__PURE__*/Object.freeze({
1292
+ __proto__: null,
1293
+ setup: setup
1294
+ });
1295
+
1296
+ /**
1297
+ * Built-in presets, responsible for rendering different parts of the editor.
1298
+ * @module
1299
+ */
1300
+
1301
+ var index = /*#__PURE__*/Object.freeze({
1302
+ __proto__: null,
1303
+ classic: index$4,
1304
+ contextMenu: index$3,
1305
+ minimap: index$2,
1306
+ reroute: index$1
1307
+ });
1308
+
1309
+ class ReteModule {
1310
+ static ɵfac = function ReteModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ReteModule)(); };
1311
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ReteModule });
1312
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1313
+ NodeComponent] });
1314
+ }
1315
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReteModule, [{
1316
+ type: NgModule,
1317
+ args: [{
1318
+ imports: [
1319
+ CommonModule,
1320
+ RefDirective,
1321
+ NodeComponent,
1322
+ ConnectionComponent,
1323
+ ConnectionWrapperComponent,
1324
+ SocketComponent,
1325
+ ControlComponent
1326
+ ],
1327
+ exports: [
1328
+ RefDirective,
1329
+ NodeComponent,
1330
+ ConnectionComponent,
1331
+ ConnectionWrapperComponent,
1332
+ SocketComponent,
1333
+ ControlComponent
1334
+ ]
1335
+ }]
1336
+ }], null, null); })();
1337
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ReteModule, { imports: [CommonModule,
1338
+ RefDirective,
1339
+ NodeComponent,
1340
+ ConnectionComponent,
1341
+ ConnectionWrapperComponent,
1342
+ SocketComponent,
1343
+ ControlComponent], exports: [RefDirective,
1344
+ NodeComponent,
1345
+ ConnectionComponent,
1346
+ ConnectionWrapperComponent,
1347
+ SocketComponent,
1348
+ ControlComponent] }); })();
1349
+
1350
+ class ReteContextMenuModule {
1351
+ static ɵfac = function ReteContextMenuModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ReteContextMenuModule)(); };
1352
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ReteContextMenuModule });
1353
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1354
+ ContextMenuComponent,
1355
+ ContextMenuItemComponent] });
1356
+ }
1357
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReteContextMenuModule, [{
1358
+ type: NgModule,
1359
+ args: [{
1360
+ imports: [
1361
+ CommonModule,
1362
+ ContextMenuComponent,
1363
+ ContextMenuSearchComponent,
1364
+ ContextMenuItemComponent
1365
+ ],
1366
+ exports: [
1367
+ ContextMenuComponent,
1368
+ ContextMenuSearchComponent,
1369
+ ContextMenuItemComponent,
1370
+ ]
1371
+ }]
1372
+ }], null, null); })();
1373
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ReteContextMenuModule, { imports: [CommonModule,
1374
+ ContextMenuComponent,
1375
+ ContextMenuSearchComponent,
1376
+ ContextMenuItemComponent], exports: [ContextMenuComponent,
1377
+ ContextMenuSearchComponent,
1378
+ ContextMenuItemComponent] }); })();
1379
+
1380
+ class ReteMinimapModule {
1381
+ static ɵfac = function ReteMinimapModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ReteMinimapModule)(); };
1382
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ReteMinimapModule });
1383
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1384
+ MinimapComponent] });
1385
+ }
1386
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReteMinimapModule, [{
1387
+ type: NgModule,
1388
+ args: [{
1389
+ imports: [
1390
+ CommonModule,
1391
+ MinimapComponent,
1392
+ MiniViewportComponent,
1393
+ MiniNodeComponent
1394
+ ],
1395
+ exports: [
1396
+ MinimapComponent,
1397
+ MiniViewportComponent,
1398
+ MiniNodeComponent
1399
+ ]
1400
+ }]
1401
+ }], null, null); })();
1402
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ReteMinimapModule, { imports: [CommonModule,
1403
+ MinimapComponent,
1404
+ MiniViewportComponent,
1405
+ MiniNodeComponent], exports: [MinimapComponent,
1406
+ MiniViewportComponent,
1407
+ MiniNodeComponent] }); })();
1408
+
1409
+ class ReteRerouteModule {
1410
+ static ɵfac = function ReteRerouteModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ReteRerouteModule)(); };
1411
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ReteRerouteModule });
1412
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1413
+ PinsComponent] });
1414
+ }
1415
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReteRerouteModule, [{
1416
+ type: NgModule,
1417
+ args: [{
1418
+ imports: [
1419
+ CommonModule,
1420
+ PinsComponent,
1421
+ PinComponent,
1422
+ ],
1423
+ exports: [
1424
+ PinsComponent,
1425
+ PinComponent,
1426
+ ]
1427
+ }]
1428
+ }], null, null); })();
1429
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ReteRerouteModule, { imports: [CommonModule,
1430
+ PinsComponent,
1431
+ PinComponent], exports: [PinsComponent,
1432
+ PinComponent] }); })();
1433
+
1434
+ function reflect(obj) {
1435
+ if (typeof obj !== 'object' || obj === null) {
1436
+ return obj;
1437
+ }
1438
+ return new Proxy(obj, {
1439
+ get(target, prop) {
1440
+ return target[prop];
1441
+ },
1442
+ set(target, prop, value) {
1443
+ target[prop] = value;
1444
+ return true;
1445
+ },
1446
+ has: (target, prop) => prop in target,
1447
+ deleteProperty: (target, prop) => delete target[prop],
1448
+ ownKeys: target => Reflect.ownKeys(target)
1449
+ });
1450
+ }
1451
+
1452
+ function getRenderer() {
1453
+ const elements = new WeakMap();
1454
+ return {
1455
+ get(element) {
1456
+ return elements.get(element);
1457
+ },
1458
+ mount(element, key, component, injector, props) {
1459
+ // LIMITATION: If an element is remounted with the same identifier, the component cannot be replaced
1460
+ let CustomElement = customElements.get(key);
1461
+ if (!CustomElement) {
1462
+ CustomElement = createCustomElement(component, { injector });
1463
+ customElements.define(key, CustomElement);
1464
+ }
1465
+ const ngElement = new CustomElement(injector);
1466
+ Object.keys(props).forEach(key => {
1467
+ ngElement[key] = props[key];
1468
+ });
1469
+ element.appendChild(ngElement);
1470
+ elements.set(element, { key, ngElement });
1471
+ },
1472
+ update({ ngElement }, props) {
1473
+ Object.keys(props).forEach(key => {
1474
+ ngElement.ngElementStrategy.setInputValue(key, reflect(props[key]));
1475
+ });
1476
+ },
1477
+ unmount(element) {
1478
+ const existing = elements.get(element);
1479
+ if (existing) {
1480
+ existing.ngElement.remove();
1481
+ elements.delete(element);
1482
+ }
1483
+ }
1484
+ };
1485
+ }
1486
+ /**
1487
+ * Angular plugin. Renders nodes, connections and other elements using React.
1488
+ * @priority 9
1489
+ * @emits connectionpath
1490
+ * @listens render
1491
+ * @listens unmount
1492
+ */
1493
+ class AngularPlugin extends Scope {
1494
+ params;
1495
+ presets = [];
1496
+ renderer;
1497
+ owners = new WeakMap();
1498
+ /**
1499
+ * @constructor
1500
+ * @param params Plugin properties
1501
+ * @param params.injector Angular's Injector instance
1502
+ */
1503
+ constructor(params) {
1504
+ super('angular-render');
1505
+ this.params = params;
1506
+ this.renderer = getRenderer();
1507
+ this.addPipe(context => {
1508
+ if (!context || typeof context !== 'object' || !('type' in context))
1509
+ return context;
1510
+ if (context.type === 'unmount') {
1511
+ this.unmount(context.data.element);
1512
+ }
1513
+ else if (context.type === 'render') {
1514
+ if ('filled' in context.data && context.data.filled) {
1515
+ return context;
1516
+ }
1517
+ if (this.mount(context.data.element, context)) {
1518
+ return {
1519
+ ...context,
1520
+ data: {
1521
+ ...context.data,
1522
+ filled: true
1523
+ }
1524
+ };
1525
+ }
1526
+ }
1527
+ return context;
1528
+ });
1529
+ }
1530
+ setParent(scope) {
1531
+ super.setParent(scope);
1532
+ this.presets.forEach(preset => {
1533
+ if (preset.attach)
1534
+ preset.attach(this);
1535
+ });
1536
+ }
1537
+ unmount(element) {
1538
+ this.owners.delete(element);
1539
+ this.renderer.unmount(element);
1540
+ }
1541
+ mount(element, context) {
1542
+ const existing = this.renderer.get(element);
1543
+ if (existing) {
1544
+ this.presets.forEach(preset => {
1545
+ if (this.owners.get(element) !== preset)
1546
+ return;
1547
+ const result = preset.update(context, this);
1548
+ if (result) {
1549
+ this.renderer.update(existing, result);
1550
+ }
1551
+ });
1552
+ return true;
1553
+ }
1554
+ for (const preset of this.presets) {
1555
+ const result = preset.mount(context, this);
1556
+ if (!result)
1557
+ continue;
1558
+ const { key, component, props } = result;
1559
+ this.renderer.mount(element, key, component, this.params.injector, props);
1560
+ this.owners.set(element, preset);
1561
+ return true;
1562
+ }
1563
+ return;
1564
+ }
1565
+ /**
1566
+ * Adds a preset to the plugin.
1567
+ * @param preset Preset that can render nodes, connections and other elements.
1568
+ */
1569
+ addPreset(preset) {
1570
+ const local = preset;
1571
+ if (local.attach)
1572
+ local.attach(this);
1573
+ this.presets.push(local);
1574
+ }
1575
+ }
1576
+
1577
+ /**
1578
+ * Generated bundle index. Do not edit.
1579
+ */
1580
+
1581
+ export { AngularPlugin, ConnectionComponent, ConnectionWrapperComponent, ContextMenuComponent, ContextMenuItemComponent, ContextMenuSearchComponent, ControlComponent, ImpureKeyvaluePipe, MiniNodeComponent, MiniViewportComponent, MinimapComponent, NodeComponent, PinComponent, PinsComponent, index as Presets, RefDirective, ReteContextMenuModule, ReteMinimapModule, ReteModule, ReteRerouteModule, SocketComponent };
1582
+ //# sourceMappingURL=rete-angular-plugin-ng21.mjs.map