@myrmidon/gve-core 0.0.1

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 (48) hide show
  1. package/README.md +83 -0
  2. package/esm2022/lib/components/animation-timeline/animation-timeline.component.mjs +176 -0
  3. package/esm2022/lib/components/animation-tween/animation-tween.component.mjs +161 -0
  4. package/esm2022/lib/components/animation-vars/animation-vars.component.mjs +141 -0
  5. package/esm2022/lib/components/base-text-char/base-text-char.component.mjs +37 -0
  6. package/esm2022/lib/components/base-text-editor/base-text-editor.component.mjs +111 -0
  7. package/esm2022/lib/components/base-text-view/base-text-view.component.mjs +125 -0
  8. package/esm2022/lib/components/chain-operation-editor/chain-operation-editor.component.mjs +512 -0
  9. package/esm2022/lib/components/chain-result-view/chain-result-view.component.mjs +190 -0
  10. package/esm2022/lib/components/feature-editor/feature-editor.component.mjs +185 -0
  11. package/esm2022/lib/components/feature-set-editor/feature-set-editor.component.mjs +152 -0
  12. package/esm2022/lib/components/feature-set-view/feature-set-view.component.mjs +80 -0
  13. package/esm2022/lib/components/ln-heights-editor/ln-heights-editor.component.mjs +95 -0
  14. package/esm2022/lib/components/operation-source-editor/operation-source-editor.component.mjs +106 -0
  15. package/esm2022/lib/components/simple-tree/simple-tree.component.mjs +56 -0
  16. package/esm2022/lib/components/snapshot-editor/snapshot-editor.component.mjs +510 -0
  17. package/esm2022/lib/components/steps-map/steps-map.component.mjs +55 -0
  18. package/esm2022/lib/models.mjs +2 -0
  19. package/esm2022/lib/services/gve-api.service.mjs +52 -0
  20. package/esm2022/lib/services/settings.service.mjs +86 -0
  21. package/esm2022/lib/validators/svg-validators.mjs +28 -0
  22. package/esm2022/myrmidon-gve-core.mjs +5 -0
  23. package/esm2022/public-api.mjs +23 -0
  24. package/fesm2022/myrmidon-gve-core.mjs +2592 -0
  25. package/fesm2022/myrmidon-gve-core.mjs.map +1 -0
  26. package/index.d.ts +5 -0
  27. package/lib/components/animation-timeline/animation-timeline.component.d.ts +42 -0
  28. package/lib/components/animation-tween/animation-tween.component.d.ts +47 -0
  29. package/lib/components/animation-vars/animation-vars.component.d.ts +30 -0
  30. package/lib/components/base-text-char/base-text-char.component.d.ts +29 -0
  31. package/lib/components/base-text-editor/base-text-editor.component.d.ts +40 -0
  32. package/lib/components/base-text-view/base-text-view.component.d.ts +29 -0
  33. package/lib/components/chain-operation-editor/chain-operation-editor.component.d.ts +102 -0
  34. package/lib/components/chain-result-view/chain-result-view.component.d.ts +44 -0
  35. package/lib/components/feature-editor/feature-editor.component.d.ts +72 -0
  36. package/lib/components/feature-set-editor/feature-set-editor.component.d.ts +55 -0
  37. package/lib/components/feature-set-view/feature-set-view.component.d.ts +36 -0
  38. package/lib/components/ln-heights-editor/ln-heights-editor.component.d.ts +22 -0
  39. package/lib/components/operation-source-editor/operation-source-editor.component.d.ts +24 -0
  40. package/lib/components/simple-tree/simple-tree.component.d.ts +16 -0
  41. package/lib/components/snapshot-editor/snapshot-editor.component.d.ts +105 -0
  42. package/lib/components/steps-map/steps-map.component.d.ts +29 -0
  43. package/lib/models.d.ts +7 -0
  44. package/lib/services/gve-api.service.d.ts +57 -0
  45. package/lib/services/settings.service.d.ts +53 -0
  46. package/lib/validators/svg-validators.d.ts +4 -0
  47. package/package.json +45 -0
  48. package/public-api.d.ts +19 -0
@@ -0,0 +1,2592 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Component, Input, Output, ViewChild, Injectable, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { Validators, ReactiveFormsModule, FormControl, FormsModule } from '@angular/forms';
5
+ import * as i2 from '@angular/common';
6
+ import { CommonModule } from '@angular/common';
7
+ import * as i3 from '@angular/material/button';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import * as i4$2 from '@angular/material/checkbox';
10
+ import { MatCheckboxModule } from '@angular/material/checkbox';
11
+ import * as i4$1 from '@angular/material/expansion';
12
+ import { MatExpansionModule } from '@angular/material/expansion';
13
+ import * as i4 from '@angular/material/form-field';
14
+ import { MatFormFieldModule } from '@angular/material/form-field';
15
+ import * as i5 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i6 from '@angular/material/input';
18
+ import { MatInputModule } from '@angular/material/input';
19
+ import * as i8 from '@angular/material/select';
20
+ import { MatSelectModule } from '@angular/material/select';
21
+ import * as i13 from '@angular/material/tabs';
22
+ import { MatTabsModule } from '@angular/material/tabs';
23
+ import * as i10 from '@angular/material/tooltip';
24
+ import { MatTooltipModule } from '@angular/material/tooltip';
25
+ import * as i2$1 from '@myrmidon/ng-tools';
26
+ import { NgToolsValidators, NgToolsModule, deepCopy } from '@myrmidon/ng-tools';
27
+ import { GveAnimationTweenType, SnapshotViewService, FeatureSetPolicy, OperationType, DEFAULT_SVG_BASE_TEXT_OPTIONS } from '@myrmidon/gve-snapshot-view';
28
+ import { debounceTime, distinctUntilChanged, catchError } from 'rxjs';
29
+ import * as i9 from '@angular/material/core';
30
+ import { MatRippleModule } from '@angular/material/core';
31
+ import * as i2$2 from '@myrmidon/ng-mat-tools';
32
+ import { NgMatToolsModule } from '@myrmidon/ng-mat-tools';
33
+ import { filter, debounceTime as debounceTime$1 } from 'rxjs/operators';
34
+ import * as i2$3 from '@angular/cdk/clipboard';
35
+ import { ClipboardModule } from '@angular/cdk/clipboard';
36
+ import * as i15 from '@cisstech/nge/monaco';
37
+ import { NgeMonacoModule } from '@cisstech/nge/monaco';
38
+ import { customAlphabet } from 'nanoid';
39
+ import * as i7 from '@angular/material/button-toggle';
40
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
41
+ import * as i12 from '@angular/material/progress-bar';
42
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
43
+ import * as i4$3 from '@angular/material/snack-bar';
44
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
45
+ import * as i1$1 from '@angular/common/http';
46
+
47
+ class AnimationVarsComponent {
48
+ get vars() {
49
+ return this._vars;
50
+ }
51
+ set vars(value) {
52
+ if (this._vars === value) {
53
+ return;
54
+ }
55
+ this._vars = value;
56
+ this.updateForm(value);
57
+ }
58
+ constructor(formBuilder) {
59
+ this._vars = {};
60
+ this.varsChange = new EventEmitter();
61
+ this.editedVars = [];
62
+ this.name = formBuilder.control('', {
63
+ nonNullable: true,
64
+ validators: [Validators.required, Validators.maxLength(100)],
65
+ });
66
+ this.value = formBuilder.control('', {
67
+ nonNullable: true,
68
+ validators: [Validators.required, Validators.maxLength(1000)],
69
+ });
70
+ this.form = formBuilder.group({
71
+ name: this.name,
72
+ value: this.value,
73
+ });
74
+ }
75
+ updateForm(vars) {
76
+ this.editedVars = Object.entries(vars)
77
+ .map(([name, value]) => ({ name, value }))
78
+ .sort((a, b) => a.name.localeCompare(b.name));
79
+ }
80
+ getVars() {
81
+ return this.editedVars.reduce((acc, { name, value }) => ({ ...acc, [name]: value }), {});
82
+ }
83
+ addVar() {
84
+ this.form.reset();
85
+ // focus the name input
86
+ setTimeout(() => this.nameInput?.nativeElement.focus(), 0);
87
+ }
88
+ editVar(index) {
89
+ const { name, value } = this.editedVars[index];
90
+ this.form.setValue({ name, value });
91
+ this.form.markAsPristine();
92
+ // focus the name input
93
+ setTimeout(() => this.nameInput?.nativeElement.focus(), 0);
94
+ }
95
+ deleteVar(index) {
96
+ this.editedVars = this.editedVars.filter((_, i) => i !== index);
97
+ this.varsChange.emit(this.getVars());
98
+ }
99
+ parseValue(value) {
100
+ if (!value) {
101
+ return '';
102
+ }
103
+ if (value === 'true') {
104
+ return true;
105
+ }
106
+ else if (value === 'false') {
107
+ return false;
108
+ }
109
+ else if (/^\d+$/.test(value)) {
110
+ return parseInt(value, 10);
111
+ }
112
+ else if (/^\d+\.\d+$/.test(value)) {
113
+ return parseFloat(value);
114
+ }
115
+ return value;
116
+ }
117
+ saveVar() {
118
+ if (this.form.invalid) {
119
+ return;
120
+ }
121
+ const { name, value } = this.form.value;
122
+ // parse value assuming that if it looks like a boolean/number
123
+ // its value should be a boolean/number rather than a string
124
+ const v = this.parseValue(value);
125
+ const editedVars = [...this.editedVars];
126
+ // if name already exists, update the value; else add it
127
+ const existingIndex = this.editedVars.findIndex((vr) => vr.name === name);
128
+ if (existingIndex !== -1) {
129
+ editedVars[existingIndex] = { name, value: v };
130
+ this.editedVars = editedVars;
131
+ return;
132
+ }
133
+ else {
134
+ editedVars.push({ name, value: v });
135
+ this.editedVars = editedVars.sort((a, b) => a.name.localeCompare(b.name));
136
+ }
137
+ this.varsChange.emit(this.getVars());
138
+ setTimeout(() => {
139
+ this.nameInput?.nativeElement.focus();
140
+ this.form.reset();
141
+ this.form.markAsPristine();
142
+ this.form.updateValueAndValidity();
143
+ }, 0);
144
+ }
145
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: AnimationVarsComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
146
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: AnimationVarsComponent, isStandalone: true, selector: "gve-animation-vars", inputs: { vars: "vars" }, outputs: { varsChange: "varsChange" }, viewQueries: [{ propertyName: "nameInput", first: true, predicate: ["vname"], descendants: true, static: true }], ngImport: i0, template: "<div>\r\n <div>\r\n <button type=\"button\" mat-raised-button color=\"primary\" (click)=\"addVar()\">\r\n <mat-icon>add</mat-icon>\r\n property\r\n </button>\r\n </div>\r\n\r\n @if (editedVars.length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>name</th>\r\n <th>value</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (v of editedVars; track v.name; let index=$index) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"editVar(index)\"\r\n matTooltip=\"Edit this property\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteVar(index)\"\r\n matTooltip=\"Delete this property\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ v.name }}</td>\r\n <td>{{ v.value }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n } @else {\r\n <p class=\"muted\">(no vars)</p>\r\n }\r\n\r\n <form [formGroup]=\"form\" (submit)=\"saveVar()\">\r\n <fieldset>\r\n <div class=\"form-row\">\r\n <!-- name -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <input matInput [formControl]=\"name\" #vname />\r\n <mat-error\r\n *ngIf=\"$any(name).errors?.required && (name.dirty || name.touched)\"\r\n >name required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(name).errors?.maxLength && (name.dirty || name.touched)\"\r\n >name too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- value -->\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(value).errors?.required && (value.dirty || value.touched)\r\n \"\r\n >value required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(value).errors?.maxLength && (value.dirty || value.touched)\r\n \"\r\n >value too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"form.invalid\"\r\n >\r\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\r\n </button>\r\n </div>\r\n </fieldset>\r\n </form>\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}fieldset{border:1px solid silver;border-radius:4px;padding:8px;margin:8px 0}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
147
+ }
148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: AnimationVarsComponent, decorators: [{
149
+ type: Component,
150
+ args: [{ selector: 'gve-animation-vars', standalone: true, imports: [
151
+ CommonModule,
152
+ ReactiveFormsModule,
153
+ MatButtonModule,
154
+ MatCheckboxModule,
155
+ MatFormFieldModule,
156
+ MatIconModule,
157
+ MatInputModule,
158
+ MatSelectModule,
159
+ MatTooltipModule,
160
+ ], template: "<div>\r\n <div>\r\n <button type=\"button\" mat-raised-button color=\"primary\" (click)=\"addVar()\">\r\n <mat-icon>add</mat-icon>\r\n property\r\n </button>\r\n </div>\r\n\r\n @if (editedVars.length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>name</th>\r\n <th>value</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (v of editedVars; track v.name; let index=$index) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"editVar(index)\"\r\n matTooltip=\"Edit this property\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteVar(index)\"\r\n matTooltip=\"Delete this property\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ v.name }}</td>\r\n <td>{{ v.value }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n } @else {\r\n <p class=\"muted\">(no vars)</p>\r\n }\r\n\r\n <form [formGroup]=\"form\" (submit)=\"saveVar()\">\r\n <fieldset>\r\n <div class=\"form-row\">\r\n <!-- name -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <input matInput [formControl]=\"name\" #vname />\r\n <mat-error\r\n *ngIf=\"$any(name).errors?.required && (name.dirty || name.touched)\"\r\n >name required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(name).errors?.maxLength && (name.dirty || name.touched)\"\r\n >name too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- value -->\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(value).errors?.required && (value.dirty || value.touched)\r\n \"\r\n >value required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(value).errors?.maxLength && (value.dirty || value.touched)\r\n \"\r\n >value too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"form.invalid\"\r\n >\r\n <mat-icon class=\"mat-primary\">add_circle</mat-icon>\r\n </button>\r\n </div>\r\n </fieldset>\r\n </form>\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}fieldset{border:1px solid silver;border-radius:4px;padding:8px;margin:8px 0}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}\n"] }]
161
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { vars: [{
162
+ type: Input
163
+ }], varsChange: [{
164
+ type: Output
165
+ }], nameInput: [{
166
+ type: ViewChild,
167
+ args: ['vname', { static: true }]
168
+ }] } });
169
+
170
+ /**
171
+ * A component to edit an animation tween.
172
+ */
173
+ class AnimationTweenComponent {
174
+ /**
175
+ * The tween to edit.
176
+ */
177
+ get tween() {
178
+ return this._tween;
179
+ }
180
+ set tween(value) {
181
+ if (this._tween === value) {
182
+ return;
183
+ }
184
+ this._tween = value || undefined;
185
+ this.updateForm(this._tween);
186
+ }
187
+ constructor(formBuilder) {
188
+ this.tweenChange = new EventEmitter();
189
+ this.cancel = new EventEmitter();
190
+ this.types = [
191
+ { label: 'to', value: 0 },
192
+ { label: 'from', value: 1 },
193
+ { label: 'fromTo', value: 2 },
194
+ ];
195
+ this.label = formBuilder.control('', {
196
+ nonNullable: true,
197
+ validators: [Validators.required, Validators.maxLength(100)],
198
+ });
199
+ this.note = formBuilder.control(null);
200
+ this.type = formBuilder.control(0, { nonNullable: true });
201
+ this.selector = formBuilder.control('', {
202
+ nonNullable: true,
203
+ validators: [Validators.required, Validators.maxLength(200)],
204
+ });
205
+ this.vars = formBuilder.control({}, { nonNullable: true });
206
+ this.vars2 = formBuilder.control(null);
207
+ this.position = formBuilder.control(null, Validators.maxLength(100));
208
+ this.form = formBuilder.group({
209
+ label: this.label,
210
+ note: this.note,
211
+ type: this.type,
212
+ selector: this.selector,
213
+ vars: this.vars,
214
+ vars2: this.vars2,
215
+ position: this.position,
216
+ });
217
+ this.elementId = formBuilder.control(null);
218
+ }
219
+ ngOnInit() {
220
+ // set selector when elementId changes
221
+ this._sub = this.elementId.valueChanges
222
+ .pipe(debounceTime(200), distinctUntilChanged())
223
+ .subscribe((elementId) => {
224
+ if (elementId) {
225
+ this.selector.setValue('#' + elementId);
226
+ }
227
+ });
228
+ }
229
+ ngOnDestroy() {
230
+ this._sub?.unsubscribe();
231
+ }
232
+ onVarsChange(vars) {
233
+ this.vars.setValue(vars);
234
+ this.vars.markAsDirty();
235
+ this.vars.updateValueAndValidity();
236
+ }
237
+ onVars2Change(vars) {
238
+ this.vars2.setValue(vars);
239
+ this.vars2.markAsDirty();
240
+ this.vars2.updateValueAndValidity();
241
+ }
242
+ close() {
243
+ this.cancel.emit();
244
+ }
245
+ updateForm(tween) {
246
+ if (!tween) {
247
+ this.form.reset();
248
+ return;
249
+ }
250
+ this.label.setValue(tween.label);
251
+ this.note.setValue(tween.note || null);
252
+ this.type.setValue(tween.type);
253
+ this.selector.setValue(tween.selector);
254
+ this.vars.setValue(tween.vars || {});
255
+ this.vars2.setValue(tween.vars2 || null);
256
+ this.position.setValue(tween.position || null);
257
+ this.form.markAsPristine();
258
+ }
259
+ getTween() {
260
+ return {
261
+ label: this.label.value,
262
+ note: this.note.value?.trim() || undefined,
263
+ type: this.type.value,
264
+ selector: this.selector.value.trim(),
265
+ vars: Object.keys(this.vars.value).length === 0 ? undefined : this.vars.value,
266
+ vars2: this.vars2.value && Object.keys(this.vars2.value).length === 0
267
+ ? undefined
268
+ : this.vars2.value || undefined,
269
+ position: this.position.value?.trim() || undefined,
270
+ };
271
+ }
272
+ save() {
273
+ if (!this.form.valid) {
274
+ return;
275
+ }
276
+ this._tween = this.getTween();
277
+ this.tweenChange.emit(this._tween);
278
+ }
279
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: AnimationTweenComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
280
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: AnimationTweenComponent, isStandalone: true, selector: "gve-animation-tween", inputs: { tween: "tween", elementIds: "elementIds" }, outputs: { tweenChange: "tweenChange", cancel: "cancel" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <mat-tab-group>\r\n <mat-tab label=\"general\">\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(label).errors?.required && (label.dirty || label.touched)\r\n \"\r\n >label required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n \"\r\n >label too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- type -->\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"type\">\r\n <mat-option *ngFor=\"let t of types\" [value]=\"t.value\">{{\r\n t.label\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!-- position -->\r\n <mat-form-field>\r\n <mat-label>position</mat-label>\r\n <input matInput [formControl]=\"position\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(position).errors?.maxLength &&\r\n (position.dirty || position.touched)\r\n \"\r\n >position too long</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- selector -->\r\n <mat-form-field>\r\n <mat-label>selector</mat-label>\r\n <input matInput [formControl]=\"selector\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(selector).errors?.required &&\r\n (selector.dirty || selector.touched)\r\n \"\r\n >selector required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(selector).errors?.maxLength &&\r\n (selector.dirty || selector.touched)\r\n \"\r\n >selector too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- element id -->\r\n @if (elementIds?.length) {\r\n <mat-form-field>\r\n <mat-label>element ID</mat-label>\r\n <mat-select [formControl]=\"elementId\">\r\n <mat-option *ngFor=\"let id of elementIds\" [value]=\"id\">{{\r\n id\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </div>\r\n\r\n <!-- note -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>note</mat-label>\r\n <textarea rows=\"2\" matInput [formControl]=\"note\"></textarea>\r\n <mat-error\r\n *ngIf=\"$any(note).errors?.maxLength && (note.dirty || note.touched)\"\r\n >note too long</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"properties\">\r\n <!-- vars -->\r\n <gve-animation-vars\r\n [vars]=\"vars.value\"\r\n (varsChange)=\"onVarsChange($event)\"\r\n />\r\n\r\n <!-- vars2 only when type is fromTo -->\r\n @if (type.value === 2) {\r\n <gve-animation-vars\r\n [vars]=\"vars2.value || {}\"\r\n (varsChange)=\"onVars2Change($event)\"\r\n />\r\n }\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"close()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Save changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.long-text{width:100%;max-width:800px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTabsModule }, { kind: "component", type: i13.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i13.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: AnimationVarsComponent, selector: "gve-animation-vars", inputs: ["vars"], outputs: ["varsChange"] }] }); }
281
+ }
282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: AnimationTweenComponent, decorators: [{
283
+ type: Component,
284
+ args: [{ selector: 'gve-animation-tween', standalone: true, imports: [
285
+ CommonModule,
286
+ ReactiveFormsModule,
287
+ MatButtonModule,
288
+ MatCheckboxModule,
289
+ MatFormFieldModule,
290
+ MatIconModule,
291
+ MatInputModule,
292
+ MatSelectModule,
293
+ MatTabsModule,
294
+ MatTooltipModule,
295
+ AnimationVarsComponent,
296
+ ], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <mat-tab-group>\r\n <mat-tab label=\"general\">\r\n <div class=\"form-row\">\r\n <!-- label -->\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formControl]=\"label\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(label).errors?.required && (label.dirty || label.touched)\r\n \"\r\n >label required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(label).errors?.maxLength && (label.dirty || label.touched)\r\n \"\r\n >label too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- type -->\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"type\">\r\n <mat-option *ngFor=\"let t of types\" [value]=\"t.value\">{{\r\n t.label\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!-- position -->\r\n <mat-form-field>\r\n <mat-label>position</mat-label>\r\n <input matInput [formControl]=\"position\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(position).errors?.maxLength &&\r\n (position.dirty || position.touched)\r\n \"\r\n >position too long</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- selector -->\r\n <mat-form-field>\r\n <mat-label>selector</mat-label>\r\n <input matInput [formControl]=\"selector\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(selector).errors?.required &&\r\n (selector.dirty || selector.touched)\r\n \"\r\n >selector required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(selector).errors?.maxLength &&\r\n (selector.dirty || selector.touched)\r\n \"\r\n >selector too long</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- element id -->\r\n @if (elementIds?.length) {\r\n <mat-form-field>\r\n <mat-label>element ID</mat-label>\r\n <mat-select [formControl]=\"elementId\">\r\n <mat-option *ngFor=\"let id of elementIds\" [value]=\"id\">{{\r\n id\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n }\r\n </div>\r\n\r\n <!-- note -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>note</mat-label>\r\n <textarea rows=\"2\" matInput [formControl]=\"note\"></textarea>\r\n <mat-error\r\n *ngIf=\"$any(note).errors?.maxLength && (note.dirty || note.touched)\"\r\n >note too long</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n\r\n <mat-tab label=\"properties\">\r\n <!-- vars -->\r\n <gve-animation-vars\r\n [vars]=\"vars.value\"\r\n (varsChange)=\"onVarsChange($event)\"\r\n />\r\n\r\n <!-- vars2 only when type is fromTo -->\r\n @if (type.value === 2) {\r\n <gve-animation-vars\r\n [vars]=\"vars2.value || {}\"\r\n (varsChange)=\"onVars2Change($event)\"\r\n />\r\n }\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"close()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Save changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.long-text{width:100%;max-width:800px}\n"] }]
297
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { tween: [{
298
+ type: Input
299
+ }], elementIds: [{
300
+ type: Input
301
+ }], tweenChange: [{
302
+ type: Output
303
+ }], cancel: [{
304
+ type: Output
305
+ }] } });
306
+
307
+ class AnimationTimelineComponent {
308
+ get timeline() {
309
+ return this._timeline;
310
+ }
311
+ set timeline(value) {
312
+ this._timeline = value || undefined;
313
+ this.updateForm(this._timeline);
314
+ }
315
+ constructor(formBuilder) {
316
+ this.tags = [];
317
+ this.timelineChange = new EventEmitter();
318
+ this.cancel = new EventEmitter();
319
+ this.editedTweenIndex = -1;
320
+ this.selectors = {
321
+ 0: 'to',
322
+ 1: 'from',
323
+ 2: 'fromTo',
324
+ };
325
+ this.tag = formBuilder.control('', {
326
+ nonNullable: true,
327
+ validators: [Validators.required, Validators.maxLength(100)],
328
+ });
329
+ this.tweens = formBuilder.control([], {
330
+ nonNullable: true,
331
+ validators: NgToolsValidators.strictMinLengthValidator(1),
332
+ });
333
+ this.vars = formBuilder.control({}, { nonNullable: true });
334
+ this.form = formBuilder.group({
335
+ tag: this.tag,
336
+ tweens: this.tweens,
337
+ vars: this.vars,
338
+ });
339
+ }
340
+ updateForm(timeline) {
341
+ if (!timeline) {
342
+ this.form.reset();
343
+ return;
344
+ }
345
+ this.tag.setValue(timeline.tag);
346
+ this.tweens.setValue(timeline.tweens);
347
+ this.vars.setValue(timeline.vars || {});
348
+ this.form.markAsPristine();
349
+ }
350
+ addTween() {
351
+ this.editedTweenIndex = -1;
352
+ this.editedTween = {
353
+ label: 'tween #' + (this.tweens.value.length + 1),
354
+ type: GveAnimationTweenType.to,
355
+ selector: '',
356
+ };
357
+ }
358
+ editTween(index) {
359
+ this.editedTweenIndex = index;
360
+ this.editedTween = this.tweens.value[index];
361
+ }
362
+ deleteTween(index) {
363
+ this.tweens.setValue(this.tweens.value.filter((_, i) => i !== index));
364
+ this.tweens.markAsDirty();
365
+ this.tweens.updateValueAndValidity();
366
+ }
367
+ closeTween() {
368
+ this.editedTween = undefined;
369
+ this.editedTweenIndex = -1;
370
+ }
371
+ saveTween(tween) {
372
+ if (this.editedTweenIndex === -1) {
373
+ this.tweens.setValue([...this.tweens.value, tween]);
374
+ }
375
+ else {
376
+ this.tweens.setValue(this.tweens.value.map((t, index) => index === this.editedTweenIndex ? tween : t));
377
+ }
378
+ this.tweens.markAsDirty();
379
+ this.tweens.updateValueAndValidity();
380
+ this.closeTween();
381
+ }
382
+ moveTweenUp(index) {
383
+ if (index < 1) {
384
+ return;
385
+ }
386
+ const tweens = [...this.tweens.value];
387
+ const tmp = tweens[index];
388
+ tweens[index] = tweens[index - 1];
389
+ tweens[index - 1] = tmp;
390
+ this.tweens.setValue(tweens);
391
+ this.tweens.markAsDirty();
392
+ this.tweens.updateValueAndValidity();
393
+ }
394
+ moveTweenDown(index) {
395
+ if (index >= this.tweens.value.length - 1) {
396
+ return;
397
+ }
398
+ const tweens = [...this.tweens.value];
399
+ const tmp = tweens[index];
400
+ tweens[index] = tweens[index + 1];
401
+ tweens[index + 1] = tmp;
402
+ this.tweens.setValue(tweens);
403
+ this.tweens.markAsDirty();
404
+ this.tweens.updateValueAndValidity();
405
+ }
406
+ getTimeline() {
407
+ return {
408
+ tag: this.tag.value || '',
409
+ tweens: this.tweens.value,
410
+ vars: Object.keys(this.vars.value).length ? this.vars.value : undefined,
411
+ };
412
+ }
413
+ close() {
414
+ this.cancel.emit();
415
+ }
416
+ save() {
417
+ if (this.form.invalid) {
418
+ return;
419
+ }
420
+ this._timeline = this.getTimeline();
421
+ this.timelineChange.emit(this._timeline);
422
+ this.form.markAsPristine();
423
+ }
424
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: AnimationTimelineComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
425
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: AnimationTimelineComponent, isStandalone: true, selector: "gve-animation-timeline", inputs: { timeline: "timeline", elementIds: "elementIds", tags: "tags" }, outputs: { timelineChange: "timelineChange", cancel: "cancel" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- tag (bound) -->\r\n @if (tags.length) {\r\n <mat-form-field>\r\n <mat-label>tag</mat-label>\r\n <mat-select [formControl]=\"tag\">\r\n @for (t of tags; track t) {\r\n <mat-option [value]=\"t\">{{ t }}</mat-option>\r\n }\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"$any(tag).errors?.required && (tag.dirty || tag.touched)\"\r\n >tag required</mat-error\r\n >\r\n </mat-form-field>\r\n } @else {\r\n <!-- tag (free) -->\r\n <mat-form-field>\r\n <mat-label>tag</mat-label>\r\n <input matInput [formControl]=\"tag\" />\r\n <mat-error\r\n *ngIf=\"$any(tag).errors?.required && (tag.dirty || tag.touched)\"\r\n >tag required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(tag).errors?.maxLength && (tag.dirty || tag.touched)\"\r\n >tag too long</mat-error\r\n >\r\n </mat-form-field>\r\n }\r\n\r\n <button\r\n mat-flat-button\r\n type=\"button\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n (click)=\"addTween()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> tween\r\n </button>\r\n </div>\r\n\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>label</th>\r\n <th>type</th>\r\n <th>selector</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (t of tweens.value; track t; let index = $index) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <!-- edit -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"primary\"\r\n (click)=\"editTween(index)\"\r\n matTooltip=\"Edit tween\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"warn\"\r\n (click)=\"deleteTween(index)\"\r\n matTooltip=\"Delete tween\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n <!-- up -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"moveTweenUp(index)\"\r\n matTooltip=\"Move tween up\"\r\n [disabled]=\"index === 0\"\r\n >\r\n <mat-icon>arrow_circle_up</mat-icon>\r\n </button>\r\n <!-- down -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"moveTweenDown(index)\"\r\n matTooltip=\"Move tween down\"\r\n [disabled]=\"index === tweens.value.length - 1\"\r\n >\r\n <mat-icon>arrow_circle_down</mat-icon>\r\n </button>\r\n </td>\r\n <td>\r\n {{ t.label }}\r\n </td>\r\n <td>\r\n {{ t.type }}\r\n </td>\r\n <td>\r\n {{ t.selector | flatLookup : selectors }}\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n\r\n <mat-expansion-panel [expanded]=\"editedTween\" [disabled]=\"!editedTween\">\r\n @if (editedTween) {\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>tween {{ editedTween.label }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n }\r\n <fieldset>\r\n <gve-animation-tween\r\n [elementIds]=\"elementIds\"\r\n [tween]=\"editedTween\"\r\n (tweenChange)=\"saveTween($event)\"\r\n (cancel)=\"closeTween()\"\r\n />\r\n </fieldset>\r\n </mat-expansion-panel>\r\n\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"close()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Save changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin:8px 0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4$1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4$1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i4$1.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTabsModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: NgToolsModule }, { kind: "pipe", type: i2$1.FlatLookupPipe, name: "flatLookup" }, { kind: "component", type: AnimationTweenComponent, selector: "gve-animation-tween", inputs: ["tween", "elementIds"], outputs: ["tweenChange", "cancel"] }] }); }
426
+ }
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: AnimationTimelineComponent, decorators: [{
428
+ type: Component,
429
+ args: [{ selector: 'gve-animation-timeline', standalone: true, imports: [
430
+ CommonModule,
431
+ ReactiveFormsModule,
432
+ MatButtonModule,
433
+ MatCheckboxModule,
434
+ MatExpansionModule,
435
+ MatFormFieldModule,
436
+ MatIconModule,
437
+ MatInputModule,
438
+ MatSelectModule,
439
+ MatTabsModule,
440
+ MatTooltipModule,
441
+ NgToolsModule,
442
+ AnimationTweenComponent,
443
+ ], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- tag (bound) -->\r\n @if (tags.length) {\r\n <mat-form-field>\r\n <mat-label>tag</mat-label>\r\n <mat-select [formControl]=\"tag\">\r\n @for (t of tags; track t) {\r\n <mat-option [value]=\"t\">{{ t }}</mat-option>\r\n }\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"$any(tag).errors?.required && (tag.dirty || tag.touched)\"\r\n >tag required</mat-error\r\n >\r\n </mat-form-field>\r\n } @else {\r\n <!-- tag (free) -->\r\n <mat-form-field>\r\n <mat-label>tag</mat-label>\r\n <input matInput [formControl]=\"tag\" />\r\n <mat-error\r\n *ngIf=\"$any(tag).errors?.required && (tag.dirty || tag.touched)\"\r\n >tag required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"$any(tag).errors?.maxLength && (tag.dirty || tag.touched)\"\r\n >tag too long</mat-error\r\n >\r\n </mat-form-field>\r\n }\r\n\r\n <button\r\n mat-flat-button\r\n type=\"button\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n (click)=\"addTween()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> tween\r\n </button>\r\n </div>\r\n\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>label</th>\r\n <th>type</th>\r\n <th>selector</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (t of tweens.value; track t; let index = $index) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <!-- edit -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"primary\"\r\n (click)=\"editTween(index)\"\r\n matTooltip=\"Edit tween\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n color=\"warn\"\r\n (click)=\"deleteTween(index)\"\r\n matTooltip=\"Delete tween\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n <!-- up -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"moveTweenUp(index)\"\r\n matTooltip=\"Move tween up\"\r\n [disabled]=\"index === 0\"\r\n >\r\n <mat-icon>arrow_circle_up</mat-icon>\r\n </button>\r\n <!-- down -->\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"moveTweenDown(index)\"\r\n matTooltip=\"Move tween down\"\r\n [disabled]=\"index === tweens.value.length - 1\"\r\n >\r\n <mat-icon>arrow_circle_down</mat-icon>\r\n </button>\r\n </td>\r\n <td>\r\n {{ t.label }}\r\n </td>\r\n <td>\r\n {{ t.type }}\r\n </td>\r\n <td>\r\n {{ t.selector | flatLookup : selectors }}\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n\r\n <mat-expansion-panel [expanded]=\"editedTween\" [disabled]=\"!editedTween\">\r\n @if (editedTween) {\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>tween {{ editedTween.label }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n }\r\n <fieldset>\r\n <gve-animation-tween\r\n [elementIds]=\"elementIds\"\r\n [tween]=\"editedTween\"\r\n (tweenChange)=\"saveTween($event)\"\r\n (cancel)=\"closeTween()\"\r\n />\r\n </fieldset>\r\n </mat-expansion-panel>\r\n\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"close()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Save changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin:8px 0}\n"] }]
444
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { timeline: [{
445
+ type: Input
446
+ }], elementIds: [{
447
+ type: Input
448
+ }], tags: [{
449
+ type: Input
450
+ }], timelineChange: [{
451
+ type: Output
452
+ }], cancel: [{
453
+ type: Output
454
+ }] } });
455
+
456
+ /**
457
+ * A component that displays a single character from a base text.
458
+ */
459
+ class BaseTextCharComponent {
460
+ constructor() {
461
+ this.defaultColor = '#D8D8D8';
462
+ this.defaultBorderColor = '#D8D8D8';
463
+ this.defaultEmSize = 1.5;
464
+ this.charPick = new EventEmitter();
465
+ }
466
+ get char() {
467
+ return this._char;
468
+ }
469
+ set char(value) {
470
+ this._char = value || undefined;
471
+ }
472
+ onCharClick(event) {
473
+ this.charPick.emit({ char: this._char, event });
474
+ }
475
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: BaseTextCharComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
476
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: BaseTextCharComponent, isStandalone: true, selector: "gve-base-text-char", inputs: { char: "char" }, outputs: { charPick: "charPick" }, ngImport: i0, template: "@if (char) {\r\n<div matRipple id=\"container\" (click)=\"onCharClick($event)\">\r\n <div\r\n id=\"c-label\"\r\n [style.fontSize]=\"char.emSize + 'em'\"\r\n [style.borderColor]=\"char.borderColor\"\r\n >\r\n {{ char.label }}\r\n </div>\r\n <div\r\n id=\"c-id\"\r\n [style.fontSize]=\"char.emSize / 2 + 'em'\"\r\n [style.color]=\"char.color | colorToContrast\"\r\n [style.borderColor]=\"char.borderColor\"\r\n [style.backgroundColor]=\"char.color\"\r\n >\r\n {{ char.id }}\r\n </div>\r\n</div>\r\n}\r\n", styles: ["div#container{cursor:pointer;flex-direction:column;align-items:center}div#c-label{border:1px solid silver;border-radius:6px;padding:6px;height:1.5em;align-items:center;justify-content:center;text-align:center}div#c-id{margin-top:4px;margin-bottom:16px;border:1px solid silver;border-radius:6px;padding:6px;align-items:center;justify-content:center;text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: MatRippleModule }, { kind: "directive", type: i9.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "ngmodule", type: NgToolsModule }, { kind: "pipe", type: i2$1.ColorToContrastPipe, name: "colorToContrast" }] }); }
477
+ }
478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: BaseTextCharComponent, decorators: [{
479
+ type: Component,
480
+ args: [{ selector: 'gve-base-text-char', standalone: true, imports: [MatRippleModule, NgToolsModule], template: "@if (char) {\r\n<div matRipple id=\"container\" (click)=\"onCharClick($event)\">\r\n <div\r\n id=\"c-label\"\r\n [style.fontSize]=\"char.emSize + 'em'\"\r\n [style.borderColor]=\"char.borderColor\"\r\n >\r\n {{ char.label }}\r\n </div>\r\n <div\r\n id=\"c-id\"\r\n [style.fontSize]=\"char.emSize / 2 + 'em'\"\r\n [style.color]=\"char.color | colorToContrast\"\r\n [style.borderColor]=\"char.borderColor\"\r\n [style.backgroundColor]=\"char.color\"\r\n >\r\n {{ char.id }}\r\n </div>\r\n</div>\r\n}\r\n", styles: ["div#container{cursor:pointer;flex-direction:column;align-items:center}div#c-label{border:1px solid silver;border-radius:6px;padding:6px;height:1.5em;align-items:center;justify-content:center;text-align:center}div#c-id{margin-top:4px;margin-bottom:16px;border:1px solid silver;border-radius:6px;padding:6px;align-items:center;justify-content:center;text-align:center}\n"] }]
481
+ }], propDecorators: { char: [{
482
+ type: Input
483
+ }], charPick: [{
484
+ type: Output
485
+ }] } });
486
+
487
+ /**
488
+ * A component to display a selectable base text.
489
+ */
490
+ class BaseTextViewComponent {
491
+ constructor() {
492
+ this.defaultColor = '#DBDBDB';
493
+ this.defaultBorderColor = '#DBDBDB';
494
+ this.selectionColor = '#3E92CC';
495
+ this.hasLineNumber = false;
496
+ this.charPick = new EventEmitter();
497
+ this.rangePick = new EventEmitter();
498
+ this.lines = [];
499
+ }
500
+ get text() {
501
+ return this._text;
502
+ }
503
+ set text(value) {
504
+ this._text = value || undefined;
505
+ this.buildLines();
506
+ }
507
+ buildLines() {
508
+ if (!this._text) {
509
+ this.lines = [];
510
+ return;
511
+ }
512
+ const newLines = [];
513
+ newLines.push([]);
514
+ if (Array.isArray(this._text)) {
515
+ const nodes = this._text;
516
+ for (let i = 0; i < nodes.length; i++) {
517
+ const char = {
518
+ id: nodes[i].id,
519
+ value: nodes[i].data,
520
+ label: nodes[i].label,
521
+ color: this.defaultColor,
522
+ borderColor: this.defaultBorderColor,
523
+ emSize: 1.5,
524
+ };
525
+ newLines[newLines.length - 1].push(char);
526
+ if (char.value === '\n') {
527
+ newLines.push([]);
528
+ }
529
+ }
530
+ }
531
+ else {
532
+ for (let i = 0; i < this._text.length; i++) {
533
+ const char = {
534
+ id: i + 1,
535
+ value: this._text[i],
536
+ label: SnapshotViewService.translateSpecialChar(this._text[i]),
537
+ color: this.defaultColor,
538
+ borderColor: this.defaultBorderColor,
539
+ emSize: 1.5,
540
+ };
541
+ newLines[newLines.length - 1].push(char);
542
+ if (char.value === '\n') {
543
+ newLines.push([]);
544
+ }
545
+ }
546
+ }
547
+ this.lines = newLines;
548
+ }
549
+ resetColors() {
550
+ for (const line of this.lines) {
551
+ for (const c of line) {
552
+ c.color = this.defaultColor;
553
+ c.borderColor = this.defaultBorderColor;
554
+ }
555
+ }
556
+ }
557
+ onCharPick(event) {
558
+ this.resetColors();
559
+ if (this._lastSelectedChar &&
560
+ this._lastSelectedChar !== event.char &&
561
+ event.event.ctrlKey) {
562
+ const minId = Math.min(this._lastSelectedChar.id, event.char.id);
563
+ const maxId = Math.max(this._lastSelectedChar.id, event.char.id);
564
+ for (const line of this.lines) {
565
+ for (const c of line) {
566
+ if (c.id >= minId && c.id <= maxId) {
567
+ c.color = this.selectionColor;
568
+ c.borderColor = this.selectionColor;
569
+ }
570
+ }
571
+ }
572
+ this.charPick.emit(event);
573
+ this.rangePick.emit({ at: minId, run: maxId - minId + 1 });
574
+ return;
575
+ }
576
+ else {
577
+ // select current char
578
+ event.char.color = this.selectionColor;
579
+ event.char.borderColor = this.selectionColor;
580
+ this.charPick.emit(event);
581
+ this.rangePick.emit({ at: event.char.id, run: 1 });
582
+ }
583
+ this._lastSelectedChar = event.char;
584
+ }
585
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: BaseTextViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
586
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: BaseTextViewComponent, isStandalone: true, selector: "gve-base-text-view", inputs: { defaultColor: "defaultColor", defaultBorderColor: "defaultBorderColor", selectionColor: "selectionColor", hasLineNumber: "hasLineNumber", text: "text" }, outputs: { charPick: "charPick", rangePick: "rangePick" }, ngImport: i0, template: "<div id=\"text\">\r\n @for (line of lines; track line) {\r\n <div class=\"line\">\r\n @if (hasLineNumber) {\r\n <div class=\"nr\">\r\n {{ lines.indexOf(line) + 1 }}\r\n </div>\r\n } @for (c of line; track c.id) {\r\n <gve-base-text-char [char]=\"c\" (charPick)=\"onCharPick($event)\" />\r\n }\r\n </div>\r\n }\r\n</div>\r\n", styles: [".line{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.line *{flex:0 0 auto}.nr{font-size:.8em;font-weight:700;color:silver;margin:0 4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: BaseTextCharComponent, selector: "gve-base-text-char", inputs: ["char"], outputs: ["charPick"] }] }); }
587
+ }
588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: BaseTextViewComponent, decorators: [{
589
+ type: Component,
590
+ args: [{ selector: 'gve-base-text-view', standalone: true, imports: [CommonModule, BaseTextCharComponent], template: "<div id=\"text\">\r\n @for (line of lines; track line) {\r\n <div class=\"line\">\r\n @if (hasLineNumber) {\r\n <div class=\"nr\">\r\n {{ lines.indexOf(line) + 1 }}\r\n </div>\r\n } @for (c of line; track c.id) {\r\n <gve-base-text-char [char]=\"c\" (charPick)=\"onCharPick($event)\" />\r\n }\r\n </div>\r\n }\r\n</div>\r\n", styles: [".line{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.line *{flex:0 0 auto}.nr{font-size:.8em;font-weight:700;color:silver;margin:0 4px}\n"] }]
591
+ }], propDecorators: { defaultColor: [{
592
+ type: Input
593
+ }], defaultBorderColor: [{
594
+ type: Input
595
+ }], selectionColor: [{
596
+ type: Input
597
+ }], hasLineNumber: [{
598
+ type: Input
599
+ }], text: [{
600
+ type: Input
601
+ }], charPick: [{
602
+ type: Output
603
+ }], rangePick: [{
604
+ type: Output
605
+ }] } });
606
+
607
+ /**
608
+ * Feature editor. This edits a single feature, either free or from
609
+ * a closed set. In the latter case you must define the set via
610
+ * the `labeledIds` input. Also, you can provide a map of features
611
+ * to values via the `map` input. This is useful when you want to
612
+ * provide a set of features and values to the user, and you want
613
+ * to provide human-readable labels for the values.
614
+ */
615
+ class FeatureEditorComponent {
616
+ /**
617
+ * The feature values map. When specified and the user selects a feature
618
+ * name present in the map keys, the corresponding values will be used
619
+ * to populate the value selection.
620
+ */
621
+ get featValues() {
622
+ return this._map;
623
+ }
624
+ set featValues(value) {
625
+ this._map = value || undefined;
626
+ this.nameIds = this.getLabeledIdsFor(this.name.value);
627
+ }
628
+ /**
629
+ * The feature to edit.
630
+ */
631
+ get feature() {
632
+ return this._feature;
633
+ }
634
+ set feature(value) {
635
+ if (this._feature === value) {
636
+ return;
637
+ }
638
+ this._feature = value || undefined;
639
+ this.updateForm(this._feature);
640
+ setTimeout(() => {
641
+ this.nameControl?.nativeElement?.focus();
642
+ }, 500);
643
+ }
644
+ constructor(formBuilder) {
645
+ /**
646
+ * True if the feature is a variant operation feature, which has
647
+ * additional properties like negation, global, and short-lived.
648
+ */
649
+ this.isVar = false;
650
+ /**
651
+ * Event emitted when the user cancels the feature editing.
652
+ */
653
+ this.featureCancel = new EventEmitter();
654
+ /**
655
+ * Event emitted when the user saves the edited feature.
656
+ */
657
+ this.featureChange = new EventEmitter();
658
+ this.name = formBuilder.control('', {
659
+ validators: [Validators.required, Validators.maxLength(50)],
660
+ nonNullable: true,
661
+ });
662
+ this.value = formBuilder.control('', {
663
+ validators: [Validators.maxLength(5000)],
664
+ nonNullable: true,
665
+ });
666
+ this.setPolicy = formBuilder.control(FeatureSetPolicy.multiple, {
667
+ nonNullable: true,
668
+ });
669
+ this.isNegated = formBuilder.control(false, { nonNullable: true });
670
+ this.isGlobal = formBuilder.control(false, { nonNullable: true });
671
+ this.isShortLived = formBuilder.control(false, { nonNullable: true });
672
+ this.form = formBuilder.group({
673
+ name: this.name,
674
+ value: this.value,
675
+ setPolicy: this.setPolicy,
676
+ isNegated: this.isNegated,
677
+ isGlobal: this.isGlobal,
678
+ isShortLived: this.isShortLived,
679
+ });
680
+ }
681
+ ngOnInit() {
682
+ // whenever the name changes, update the value selection
683
+ this._sub = this.name.valueChanges
684
+ .pipe(debounceTime(300), distinctUntilChanged())
685
+ .subscribe((name) => {
686
+ this.value.reset();
687
+ this.nameIds = this.getLabeledIdsFor(name);
688
+ });
689
+ }
690
+ ngOnDestroy() {
691
+ this._sub?.unsubscribe();
692
+ }
693
+ getLabeledIdsFor(id) {
694
+ if (!id) {
695
+ return undefined;
696
+ }
697
+ return this.featValues ? this.featValues[id] : undefined;
698
+ }
699
+ updateForm(feature) {
700
+ if (!feature) {
701
+ this.form.reset();
702
+ }
703
+ else {
704
+ this.name.setValue(feature.name);
705
+ this.value.setValue(feature.value);
706
+ this.setPolicy.setValue(feature.setPolicy || FeatureSetPolicy.multiple);
707
+ this.isNegated.setValue(feature.isNegated || false);
708
+ this.isGlobal.setValue(feature.isGlobal || false);
709
+ this.isShortLived.setValue(feature.isShortLived || false);
710
+ }
711
+ }
712
+ cancel() {
713
+ this.featureCancel.emit();
714
+ }
715
+ save() {
716
+ if (!this.form.valid) {
717
+ return;
718
+ }
719
+ this.feature = this.isVar
720
+ ? {
721
+ name: this.name.value.trim(),
722
+ value: this.value.value.trim(),
723
+ setPolicy: this.setPolicy.value,
724
+ isNegated: this.isNegated.value,
725
+ isGlobal: this.isGlobal.value,
726
+ isShortLived: this.isShortLived.value,
727
+ }
728
+ : {
729
+ name: this.name.value.trim(),
730
+ value: this.value.value.trim(),
731
+ setPolicy: this.setPolicy.value,
732
+ };
733
+ this.featureChange.emit(this.feature);
734
+ }
735
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FeatureEditorComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
736
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: FeatureEditorComponent, isStandalone: true, selector: "gve-feature-editor", inputs: { featNames: "featNames", featValues: "featValues", feature: "feature", isVar: "isVar" }, outputs: { featureCancel: "featureCancel", featureChange: "featureChange" }, viewQueries: [{ propertyName: "nameControl", first: true, predicate: ["nameCtl"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n @if (featNames?.length) {\r\n <!-- name (bound) -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <mat-select #nameCtl [formControl]=\"name\">\r\n <mat-option *ngFor=\"let i of featNames\" [value]=\"i.id\">{{\r\n i.label\r\n }}</mat-option>\r\n </mat-select>\r\n @if ($any(name).errors?.required && (name.dirty || name.touched)) {\r\n <mat-error>name required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- name (free) -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <input #nameCtl matInput [formControl]=\"name\" />\r\n <mat-error\r\n *ngIf=\"$any(name).errors?.required && (name.dirty || name.touched)\"\r\n >name required</mat-error\r\n >\r\n @if ($any(name).errors?.maxLength && (name.dirty || name.touched)) {\r\n <mat-error>name too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- value (bound) -->\r\n @if (nameIds?.length) {\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <mat-select [formControl]=\"value\">\r\n <mat-option *ngFor=\"let e of nameIds\" [value]=\"e.id\">{{\r\n e.label\r\n }}</mat-option>\r\n </mat-select>\r\n @if ($any(value).errors?.required && (value.dirty || value.touched)) {\r\n <mat-error>value required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- value (free) -->\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n @if ($any(value).errors?.required && (value.dirty || value.touched)) {\r\n <mat-error>value required</mat-error>\r\n } @if ($any(value).errors?.maxLength && (value.dirty || value.touched)) {\r\n <mat-error>value too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- setPolicy -->\r\n <mat-form-field>\r\n <mat-label>set policy</mat-label>\r\n <mat-select [formControl]=\"setPolicy\">\r\n <mat-option [value]=\"0\">multiple</mat-option>\r\n <mat-option [value]=\"1\">single</mat-option>\r\n <mat-option [value]=\"2\">single first</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n @if (isVar) {\r\n <div class=\"form-row\">\r\n <!-- isNegated -->\r\n <mat-checkbox [formControl]=\"isNegated\">negated</mat-checkbox>\r\n\r\n <!-- isShortLived -->\r\n <mat-checkbox [formControl]=\"isShortLived\">short-lived</mat-checkbox>\r\n\r\n <!-- isGlobal -->\r\n <mat-checkbox [formControl]=\"isGlobal\">global</mat-checkbox>\r\n </div>\r\n }\r\n\r\n <!-- buttons -->\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i4$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
737
+ }
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FeatureEditorComponent, decorators: [{
739
+ type: Component,
740
+ args: [{ selector: 'gve-feature-editor', standalone: true, imports: [
741
+ CommonModule,
742
+ ReactiveFormsModule,
743
+ MatButtonModule,
744
+ MatCheckboxModule,
745
+ MatFormFieldModule,
746
+ MatIconModule,
747
+ MatInputModule,
748
+ MatSelectModule,
749
+ MatTooltipModule,
750
+ ], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n @if (featNames?.length) {\r\n <!-- name (bound) -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <mat-select #nameCtl [formControl]=\"name\">\r\n <mat-option *ngFor=\"let i of featNames\" [value]=\"i.id\">{{\r\n i.label\r\n }}</mat-option>\r\n </mat-select>\r\n @if ($any(name).errors?.required && (name.dirty || name.touched)) {\r\n <mat-error>name required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- name (free) -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <input #nameCtl matInput [formControl]=\"name\" />\r\n <mat-error\r\n *ngIf=\"$any(name).errors?.required && (name.dirty || name.touched)\"\r\n >name required</mat-error\r\n >\r\n @if ($any(name).errors?.maxLength && (name.dirty || name.touched)) {\r\n <mat-error>name too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- value (bound) -->\r\n @if (nameIds?.length) {\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <mat-select [formControl]=\"value\">\r\n <mat-option *ngFor=\"let e of nameIds\" [value]=\"e.id\">{{\r\n e.label\r\n }}</mat-option>\r\n </mat-select>\r\n @if ($any(value).errors?.required && (value.dirty || value.touched)) {\r\n <mat-error>value required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- value (free) -->\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n @if ($any(value).errors?.required && (value.dirty || value.touched)) {\r\n <mat-error>value required</mat-error>\r\n } @if ($any(value).errors?.maxLength && (value.dirty || value.touched)) {\r\n <mat-error>value too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- setPolicy -->\r\n <mat-form-field>\r\n <mat-label>set policy</mat-label>\r\n <mat-select [formControl]=\"setPolicy\">\r\n <mat-option [value]=\"0\">multiple</mat-option>\r\n <mat-option [value]=\"1\">single</mat-option>\r\n <mat-option [value]=\"2\">single first</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n @if (isVar) {\r\n <div class=\"form-row\">\r\n <!-- isNegated -->\r\n <mat-checkbox [formControl]=\"isNegated\">negated</mat-checkbox>\r\n\r\n <!-- isShortLived -->\r\n <mat-checkbox [formControl]=\"isShortLived\">short-lived</mat-checkbox>\r\n\r\n <!-- isGlobal -->\r\n <mat-checkbox [formControl]=\"isGlobal\">global</mat-checkbox>\r\n </div>\r\n }\r\n\r\n <!-- buttons -->\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"] }]
751
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { nameControl: [{
752
+ type: ViewChild,
753
+ args: ['nameCtl']
754
+ }], featNames: [{
755
+ type: Input
756
+ }], featValues: [{
757
+ type: Input
758
+ }], feature: [{
759
+ type: Input
760
+ }], isVar: [{
761
+ type: Input
762
+ }], featureCancel: [{
763
+ type: Output
764
+ }], featureChange: [{
765
+ type: Output
766
+ }] } });
767
+
768
+ /**
769
+ * Editor for a set of features.
770
+ */
771
+ class FeatureSetEditorComponent {
772
+ /**
773
+ * The features to edit.
774
+ */
775
+ get features() {
776
+ return this._features;
777
+ }
778
+ set features(value) {
779
+ if (this._features === value) {
780
+ return;
781
+ }
782
+ this._features = value;
783
+ this.applyFeatureFilter(this.filter.value);
784
+ }
785
+ constructor(formBuilder) {
786
+ /**
787
+ * True if the features are variable features.
788
+ */
789
+ this.isVar = false;
790
+ /**
791
+ * True to hide the feature filter.
792
+ */
793
+ this.noFilter = false;
794
+ /**
795
+ * Emitted when the features change.
796
+ */
797
+ this.featuresChange = new EventEmitter();
798
+ this._features = [];
799
+ this.filteredFeatures = [];
800
+ this.filter = formBuilder.control(null);
801
+ this._editedFeatureIndex = -1;
802
+ }
803
+ applyFeatureFilter(name) {
804
+ this.filteredFeatures = this.features.filter((feature) => {
805
+ return !name || feature.name.toLowerCase().includes(name.toLowerCase());
806
+ });
807
+ }
808
+ ngOnInit() {
809
+ this._sub = this.filter.valueChanges
810
+ .pipe(distinctUntilChanged(), debounceTime(300))
811
+ .subscribe((value) => {
812
+ this.applyFeatureFilter(value);
813
+ });
814
+ }
815
+ ngOnDestroy() {
816
+ this._sub?.unsubscribe();
817
+ }
818
+ addFeature() {
819
+ this.editedFeature = {
820
+ name: '',
821
+ value: '',
822
+ setPolicy: FeatureSetPolicy.multiple,
823
+ };
824
+ this._editedFeatureIndex = -1;
825
+ }
826
+ editFeature(feature) {
827
+ this.editedFeature = feature;
828
+ this._editedFeatureIndex = this.features.indexOf(feature);
829
+ }
830
+ deleteFeature(feature) {
831
+ const index = this.features.indexOf(feature);
832
+ if (index < 0) {
833
+ return;
834
+ }
835
+ const features = [...this.features];
836
+ features.splice(index, 1);
837
+ this.features = features;
838
+ this.featuresChange.emit(this.features);
839
+ }
840
+ onFeatureChange(feature) {
841
+ const features = [...this.features];
842
+ for (let i = features.length - 1; i >= 0; i--) {
843
+ if (features[i].name === feature.name) {
844
+ if (feature.setPolicy === FeatureSetPolicy.single ||
845
+ features[i].setPolicy === FeatureSetPolicy.single) {
846
+ features.splice(i, 1);
847
+ }
848
+ }
849
+ }
850
+ if (this._editedFeatureIndex === -1) {
851
+ features.push(feature);
852
+ }
853
+ else {
854
+ features.splice(this._editedFeatureIndex, 1, feature);
855
+ }
856
+ this.features = features;
857
+ this.editedFeature = undefined;
858
+ this._editedFeatureIndex = -1;
859
+ this.featuresChange.emit(this.features);
860
+ }
861
+ onFeatureCancel() {
862
+ this.editedFeature = undefined;
863
+ this._editedFeatureIndex = -1;
864
+ }
865
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FeatureSetEditorComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
866
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: FeatureSetEditorComponent, isStandalone: true, selector: "gve-feature-set-editor", inputs: { isVar: "isVar", featNames: "featNames", featValues: "featValues", noFilter: "noFilter", features: "features" }, outputs: { featuresChange: "featuresChange" }, ngImport: i0, template: "<div>\r\n <div class=\"form-row\">\r\n @if (!noFilter || !features.length) {\r\n <!-- filter -->\r\n <mat-form-field>\r\n <input matInput placeholder=\"filter\" [formControl]=\"filter\" />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"filter.reset()\"\r\n [disabled]=\"!filter.value\"\r\n [attr.aria-label]=\"'Reset filter'\"\r\n >\r\n <mat-icon color=\"warn\" class=\"mat-warn\">cancel</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n }\r\n\r\n <!-- add feature button -->\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Add a new feature\"\r\n (click)=\"addFeature()\"\r\n [class.in-row-button]=\"!noFilter\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n feature\r\n </button>\r\n </div>\r\n\r\n <!-- list -->\r\n @if (features.length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>feature</th>\r\n <th>value</th>\r\n @if (isVar) {\r\n <th>negated</th>\r\n <th>global</th>\r\n <th>short-lived</th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (feature of filteredFeatures; track feature) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <!-- edit -->\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit this feature\"\r\n (click)=\"editFeature(feature)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Delete this feature\"\r\n (click)=\"deleteFeature(feature)\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n </td>\r\n <td>\r\n @if (featNames?.length) {\r\n <span>{{\r\n feature.name | flatLookup : featNames : \"id\" : \"label\"\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.name }}</span>\r\n }\r\n </td>\r\n <td>\r\n @if (featValues) {\r\n <span>{{\r\n feature.value | flatLookup : featValues[feature.name]\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.value }}</span>\r\n }\r\n </td>\r\n @if (isVar) {\r\n <td>\r\n <span>{{ $any(feature).isNegated ? \"yes\" : \"no\" }}</span>\r\n </td>\r\n <td>\r\n <span>{{ $any(feature).isGlobal ? \"yes\" : \"no\" }}</span>\r\n </td>\r\n <td>\r\n <span>{{ $any(feature).isShortLived ? \"yes\" : \"no\" }}</span>\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n\r\n <!-- editor -->\r\n <mat-expansion-panel [disabled]=\"!editedFeature\" [expanded]=\"editedFeature\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n <span>{{ editedFeature?.name || \"feature\" }}</span>\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <gve-feature-editor\r\n [isVar]=\"isVar\"\r\n [featNames]=\"featNames\"\r\n [featValues]=\"featValues\"\r\n [feature]=\"editedFeature\"\r\n (featureChange)=\"onFeatureChange($event)\"\r\n (featureCancel)=\"onFeatureCancel()\"\r\n />\r\n </mat-expansion-panel>\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.in-row-button{margin-top:-16px}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4$1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4$1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i4$1.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: NgToolsModule }, { kind: "pipe", type: i2$1.FlatLookupPipe, name: "flatLookup" }, { kind: "component", type: FeatureEditorComponent, selector: "gve-feature-editor", inputs: ["featNames", "featValues", "feature", "isVar"], outputs: ["featureCancel", "featureChange"] }] }); }
867
+ }
868
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FeatureSetEditorComponent, decorators: [{
869
+ type: Component,
870
+ args: [{ selector: 'gve-feature-set-editor', standalone: true, imports: [
871
+ CommonModule,
872
+ ReactiveFormsModule,
873
+ MatButtonModule,
874
+ MatExpansionModule,
875
+ MatFormFieldModule,
876
+ MatIconModule,
877
+ MatInputModule,
878
+ MatSelectModule,
879
+ MatTooltipModule,
880
+ NgToolsModule,
881
+ FeatureEditorComponent,
882
+ ], template: "<div>\r\n <div class=\"form-row\">\r\n @if (!noFilter || !features.length) {\r\n <!-- filter -->\r\n <mat-form-field>\r\n <input matInput placeholder=\"filter\" [formControl]=\"filter\" />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"filter.reset()\"\r\n [disabled]=\"!filter.value\"\r\n [attr.aria-label]=\"'Reset filter'\"\r\n >\r\n <mat-icon color=\"warn\" class=\"mat-warn\">cancel</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n }\r\n\r\n <!-- add feature button -->\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Add a new feature\"\r\n (click)=\"addFeature()\"\r\n [class.in-row-button]=\"!noFilter\"\r\n >\r\n <mat-icon>add</mat-icon>\r\n feature\r\n </button>\r\n </div>\r\n\r\n <!-- list -->\r\n @if (features.length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>feature</th>\r\n <th>value</th>\r\n @if (isVar) {\r\n <th>negated</th>\r\n <th>global</th>\r\n <th>short-lived</th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (feature of filteredFeatures; track feature) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <!-- edit -->\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Edit this feature\"\r\n (click)=\"editFeature(feature)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Delete this feature\"\r\n (click)=\"deleteFeature(feature)\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n </td>\r\n <td>\r\n @if (featNames?.length) {\r\n <span>{{\r\n feature.name | flatLookup : featNames : \"id\" : \"label\"\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.name }}</span>\r\n }\r\n </td>\r\n <td>\r\n @if (featValues) {\r\n <span>{{\r\n feature.value | flatLookup : featValues[feature.name]\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.value }}</span>\r\n }\r\n </td>\r\n @if (isVar) {\r\n <td>\r\n <span>{{ $any(feature).isNegated ? \"yes\" : \"no\" }}</span>\r\n </td>\r\n <td>\r\n <span>{{ $any(feature).isGlobal ? \"yes\" : \"no\" }}</span>\r\n </td>\r\n <td>\r\n <span>{{ $any(feature).isShortLived ? \"yes\" : \"no\" }}</span>\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n\r\n <!-- editor -->\r\n <mat-expansion-panel [disabled]=\"!editedFeature\" [expanded]=\"editedFeature\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n <span>{{ editedFeature?.name || \"feature\" }}</span>\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <gve-feature-editor\r\n [isVar]=\"isVar\"\r\n [featNames]=\"featNames\"\r\n [featValues]=\"featValues\"\r\n [feature]=\"editedFeature\"\r\n (featureChange)=\"onFeatureChange($event)\"\r\n (featureCancel)=\"onFeatureCancel()\"\r\n />\r\n </mat-expansion-panel>\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.in-row-button{margin-top:-16px}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}\n"] }]
883
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { isVar: [{
884
+ type: Input
885
+ }], featNames: [{
886
+ type: Input
887
+ }], featValues: [{
888
+ type: Input
889
+ }], noFilter: [{
890
+ type: Input
891
+ }], features: [{
892
+ type: Input
893
+ }], featuresChange: [{
894
+ type: Output
895
+ }] } });
896
+
897
+ /**
898
+ * Editor for snapshot's base text. This can receive a string or an array
899
+ * of `CharNode` objects, and lets the user edit the text, character by
900
+ * character, optionally also setting its features.
901
+ */
902
+ class BaseTextEditorComponent {
903
+ /**
904
+ * The text to edit. In input this can be a string, an array of `CharNode`
905
+ * objects. In output this will be an array of `CharNode` objects.
906
+ */
907
+ get text() {
908
+ return this._text;
909
+ }
910
+ set text(value) {
911
+ this.resetSelectedChar();
912
+ if (this._text === value) {
913
+ return;
914
+ }
915
+ if (!value) {
916
+ this._text = [];
917
+ }
918
+ else {
919
+ this._text = Array.isArray(value)
920
+ ? value
921
+ : SnapshotViewService.stringToBaseChars(value);
922
+ }
923
+ }
924
+ constructor(formBuilder, _dialogService) {
925
+ this._dialogService = _dialogService;
926
+ this._text = [];
927
+ /**
928
+ * Emits the edited text as an array of `CharNode`'s whenever it changes.
929
+ */
930
+ this.textChange = new EventEmitter();
931
+ this.userText = formBuilder.control('', {
932
+ nonNullable: true,
933
+ validators: [Validators.required, Validators.maxLength(10000)],
934
+ });
935
+ this.form = formBuilder.group({
936
+ userText: this.userText,
937
+ });
938
+ }
939
+ resetSelectedChar() {
940
+ this.selectedChar = undefined;
941
+ this.selectedCharLabel = undefined;
942
+ }
943
+ onSelectedChar(event) {
944
+ this.selectedChar = this._text.find((c) => c.id === event.char.id);
945
+ this.selectedCharLabel = event.char.label;
946
+ }
947
+ onFeaturesChange(features) {
948
+ this.selectedChar.features = features;
949
+ this.textChange.emit(this._text);
950
+ }
951
+ onRangePick(range) {
952
+ this.textRange = range;
953
+ }
954
+ patchTextFromUser() {
955
+ // TODO
956
+ }
957
+ setTextFromUser() {
958
+ this._dialogService
959
+ .confirm('Confirm', 'Reset text?')
960
+ .subscribe((yes) => {
961
+ if (yes) {
962
+ this.text = this.userText.value;
963
+ this.textChange.emit(this._text);
964
+ }
965
+ });
966
+ }
967
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: BaseTextEditorComponent, deps: [{ token: i1.FormBuilder }, { token: i2$2.DialogService }], target: i0.ɵɵFactoryTarget.Component }); }
968
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: BaseTextEditorComponent, isStandalone: true, selector: "gve-base-text-editor", inputs: { text: "text" }, outputs: { textChange: "textChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"setTextFromUser()\">\r\n <!-- text -->\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>text</mat-label>\r\n <textarea matInput [formControl]=\"userText\" rows=\"5\"></textarea>\r\n <mat-error\r\n *ngIf=\"\r\n $any(userText).errors?.required &&\r\n (userText.dirty || userText.touched)\r\n \"\r\n >text required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(userText).errors?.maxLength &&\r\n (userText.dirty || userText.touched)\r\n \"\r\n >text too long</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <!-- buttons -->\r\n <div class=\"form-row\">\r\n <!-- set -->\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n class=\"mat-warn\"\r\n matTooltip=\"Reset characters to newly entered text\"\r\n [disabled]=\"!userText.value\"\r\n (click)=\"setTextFromUser()\"\r\n >\r\n set\r\n </button>\r\n <!-- patch -->\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n matTooltip=\"Patch characters with newly entered text\"\r\n [disabled]=\"!userText.value\"\r\n (click)=\"patchTextFromUser()\"\r\n >\r\n patch\r\n </button>\r\n </div>\r\n\r\n <!-- base text -->\r\n <div id=\"text-view\">\r\n <gve-base-text-view\r\n [text]=\"text\"\r\n (charPick)=\"onSelectedChar($event)\"\r\n (rangePick)=\"textRange = $event\"\r\n />\r\n\r\n <!-- text range -->\r\n @if (textRange) {\r\n <div id=\"text-range\">{{ textRange.at }} \u00D7 {{ textRange.run }}</div>\r\n }\r\n </div>\r\n\r\n <!-- char features -->\r\n @if (selectedChar) {\r\n <fieldset>\r\n <legend>features</legend>\r\n <gve-feature-set-editor\r\n [features]=\"selectedChar.features || []\"\r\n (featuresChange)=\"onFeaturesChange($event)\"\r\n />\r\n </fieldset>\r\n }\r\n</form>\r\n", styles: [".full-width{width:100%}#text-view{margin:8px 0}fieldset{border:1px solid #ccc;padding:10px;margin:10px 0;border-radius:5px}legend{color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: BaseTextViewComponent, selector: "gve-base-text-view", inputs: ["defaultColor", "defaultBorderColor", "selectionColor", "hasLineNumber", "text"], outputs: ["charPick", "rangePick"] }, { kind: "component", type: FeatureSetEditorComponent, selector: "gve-feature-set-editor", inputs: ["isVar", "featNames", "featValues", "noFilter", "features"], outputs: ["featuresChange"] }] }); }
969
+ }
970
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: BaseTextEditorComponent, decorators: [{
971
+ type: Component,
972
+ args: [{ selector: 'gve-base-text-editor', standalone: true, imports: [
973
+ CommonModule,
974
+ ReactiveFormsModule,
975
+ MatButtonModule,
976
+ MatFormFieldModule,
977
+ MatIconModule,
978
+ MatInputModule,
979
+ MatTooltipModule,
980
+ BaseTextViewComponent,
981
+ FeatureSetEditorComponent,
982
+ ], template: "<form [formGroup]=\"form\" (submit)=\"setTextFromUser()\">\r\n <!-- text -->\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>text</mat-label>\r\n <textarea matInput [formControl]=\"userText\" rows=\"5\"></textarea>\r\n <mat-error\r\n *ngIf=\"\r\n $any(userText).errors?.required &&\r\n (userText.dirty || userText.touched)\r\n \"\r\n >text required</mat-error\r\n >\r\n <mat-error\r\n *ngIf=\"\r\n $any(userText).errors?.maxLength &&\r\n (userText.dirty || userText.touched)\r\n \"\r\n >text too long</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <!-- buttons -->\r\n <div class=\"form-row\">\r\n <!-- set -->\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n class=\"mat-warn\"\r\n matTooltip=\"Reset characters to newly entered text\"\r\n [disabled]=\"!userText.value\"\r\n (click)=\"setTextFromUser()\"\r\n >\r\n set\r\n </button>\r\n <!-- patch -->\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n class=\"mat-primary\"\r\n matTooltip=\"Patch characters with newly entered text\"\r\n [disabled]=\"!userText.value\"\r\n (click)=\"patchTextFromUser()\"\r\n >\r\n patch\r\n </button>\r\n </div>\r\n\r\n <!-- base text -->\r\n <div id=\"text-view\">\r\n <gve-base-text-view\r\n [text]=\"text\"\r\n (charPick)=\"onSelectedChar($event)\"\r\n (rangePick)=\"textRange = $event\"\r\n />\r\n\r\n <!-- text range -->\r\n @if (textRange) {\r\n <div id=\"text-range\">{{ textRange.at }} \u00D7 {{ textRange.run }}</div>\r\n }\r\n </div>\r\n\r\n <!-- char features -->\r\n @if (selectedChar) {\r\n <fieldset>\r\n <legend>features</legend>\r\n <gve-feature-set-editor\r\n [features]=\"selectedChar.features || []\"\r\n (featuresChange)=\"onFeaturesChange($event)\"\r\n />\r\n </fieldset>\r\n }\r\n</form>\r\n", styles: [".full-width{width:100%}#text-view{margin:8px 0}fieldset{border:1px solid #ccc;padding:10px;margin:10px 0;border-radius:5px}legend{color:silver}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"] }]
983
+ }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2$2.DialogService }], propDecorators: { text: [{
984
+ type: Input
985
+ }], textChange: [{
986
+ type: Output
987
+ }] } });
988
+
989
+ class OperationSourceEditorComponent {
990
+ get source() {
991
+ return this._source;
992
+ }
993
+ set source(value) {
994
+ if (this._source === value) {
995
+ return;
996
+ }
997
+ this._source = value || undefined;
998
+ this.updateForm(this._source);
999
+ }
1000
+ constructor(formBuilder) {
1001
+ this.sourceChange = new EventEmitter();
1002
+ this.sourceCancel = new EventEmitter();
1003
+ this.id = new FormControl('', {
1004
+ validators: [Validators.required, Validators.maxLength(50)],
1005
+ nonNullable: true,
1006
+ });
1007
+ this.type = new FormControl('', {
1008
+ validators: [Validators.required, Validators.maxLength(50)],
1009
+ nonNullable: true,
1010
+ });
1011
+ this.rank = new FormControl(0, {
1012
+ nonNullable: true,
1013
+ });
1014
+ this.note = new FormControl(null, {
1015
+ validators: [Validators.maxLength(1000)],
1016
+ });
1017
+ this.form = formBuilder.group({
1018
+ id: this.id,
1019
+ type: this.type,
1020
+ rank: this.rank,
1021
+ note: this.note,
1022
+ });
1023
+ }
1024
+ updateForm(source) {
1025
+ if (!source) {
1026
+ this.form.reset();
1027
+ return;
1028
+ }
1029
+ this.id.setValue(source.id);
1030
+ this.type.setValue(source.type);
1031
+ this.rank.setValue(source.rank || 0);
1032
+ this.note.setValue(source.note || null);
1033
+ this.form.markAsPristine();
1034
+ }
1035
+ cancel() {
1036
+ this.sourceCancel.emit();
1037
+ }
1038
+ save() {
1039
+ if (this.form.invalid) {
1040
+ return;
1041
+ }
1042
+ this._source = {
1043
+ id: this.id.value,
1044
+ type: this.type.value,
1045
+ rank: this.rank.value,
1046
+ note: this.note.value || undefined,
1047
+ };
1048
+ this.sourceChange.emit(this._source);
1049
+ }
1050
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: OperationSourceEditorComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
1051
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: OperationSourceEditorComponent, isStandalone: true, selector: "gve-operation-source-editor", inputs: { source: "source", ids: "ids", types: "types" }, outputs: { sourceChange: "sourceChange", sourceCancel: "sourceCancel" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- id -->\r\n <!-- id (bound) -->\r\n @if (ids?.length) {\r\n <mat-form-field>\r\n <mat-label>id</mat-label>\r\n <mat-select [formControl]=\"id\">\r\n @for (i of ids; track i.id) {\r\n <mat-option [value]=\"i.id\">{{ i.label }}</mat-option>\r\n }\r\n </mat-select>\r\n @if ($any(id.errors)?.required && (id.dirty || id.touched)) {\r\n <mat-error>ID required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- id (free) -->\r\n <mat-form-field>\r\n <mat-label>id</mat-label>\r\n <input matInput [formControl]=\"id\" />\r\n @if ($any(id.errors)?.required && (id.dirty || id.touched)) {\r\n <mat-error>ID required</mat-error>\r\n } @if ($any(id.errors)?.maxLength && (id.dirty || id.touched)) {\r\n <mat-error>id too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- type (bound) -->\r\n @if (types?.length) {\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"type\">\r\n @for (i of types; track i.id) {\r\n <mat-option [value]=\"i.id\">{{ i.label }}</mat-option>\r\n }\r\n </mat-select>\r\n @if ($any(type.errors)?.required && (type.dirty || type.touched)) {\r\n <mat-error>type required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- type (free) -->\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <input matInput [formControl]=\"type\" />\r\n @if ($any(type.errors)?.required && (type.dirty || type.touched)) {\r\n <mat-error>type required</mat-error>\r\n } @if ($any(type.errors)?.maxLength && (type.dirty || type.touched)) {\r\n <mat-error>type too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- rank -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>rank</mat-label>\r\n <input matInput [formControl]=\"rank\" type=\"number\" min=\"0\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- note -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>note</mat-label>\r\n <textarea matInput [formControl]=\"note\" class=\"long-text\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".long-text{width:100%;max-width:800px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.nr{width:5em}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
1052
+ }
1053
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: OperationSourceEditorComponent, decorators: [{
1054
+ type: Component,
1055
+ args: [{ selector: 'gve-operation-source-editor', standalone: true, imports: [
1056
+ CommonModule,
1057
+ ReactiveFormsModule,
1058
+ MatButtonModule,
1059
+ MatFormFieldModule,
1060
+ MatIconModule,
1061
+ MatInputModule,
1062
+ MatSelectModule,
1063
+ MatTooltipModule,
1064
+ ], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <div class=\"form-row\">\r\n <!-- id -->\r\n <!-- id (bound) -->\r\n @if (ids?.length) {\r\n <mat-form-field>\r\n <mat-label>id</mat-label>\r\n <mat-select [formControl]=\"id\">\r\n @for (i of ids; track i.id) {\r\n <mat-option [value]=\"i.id\">{{ i.label }}</mat-option>\r\n }\r\n </mat-select>\r\n @if ($any(id.errors)?.required && (id.dirty || id.touched)) {\r\n <mat-error>ID required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- id (free) -->\r\n <mat-form-field>\r\n <mat-label>id</mat-label>\r\n <input matInput [formControl]=\"id\" />\r\n @if ($any(id.errors)?.required && (id.dirty || id.touched)) {\r\n <mat-error>ID required</mat-error>\r\n } @if ($any(id.errors)?.maxLength && (id.dirty || id.touched)) {\r\n <mat-error>id too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- type (bound) -->\r\n @if (types?.length) {\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"type\">\r\n @for (i of types; track i.id) {\r\n <mat-option [value]=\"i.id\">{{ i.label }}</mat-option>\r\n }\r\n </mat-select>\r\n @if ($any(type.errors)?.required && (type.dirty || type.touched)) {\r\n <mat-error>type required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- type (free) -->\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <input matInput [formControl]=\"type\" />\r\n @if ($any(type.errors)?.required && (type.dirty || type.touched)) {\r\n <mat-error>type required</mat-error>\r\n } @if ($any(type.errors)?.maxLength && (type.dirty || type.touched)) {\r\n <mat-error>type too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- rank -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>rank</mat-label>\r\n <input matInput [formControl]=\"rank\" type=\"number\" min=\"0\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- note -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>note</mat-label>\r\n <textarea matInput [formControl]=\"note\" class=\"long-text\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".long-text{width:100%;max-width:800px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.nr{width:5em}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}\n"] }]
1065
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { source: [{
1066
+ type: Input
1067
+ }], ids: [{
1068
+ type: Input
1069
+ }], types: [{
1070
+ type: Input
1071
+ }], sourceChange: [{
1072
+ type: Output
1073
+ }], sourceCancel: [{
1074
+ type: Output
1075
+ }] } });
1076
+
1077
+ class SvgValidators {
1078
+ static rootGValidator() {
1079
+ return (control) => {
1080
+ if (!control.value) {
1081
+ return null;
1082
+ }
1083
+ const parser = new DOMParser();
1084
+ let error = null;
1085
+ let svgRoot;
1086
+ try {
1087
+ const doc = parser.parseFromString(control.value, 'image/svg+xml');
1088
+ svgRoot =
1089
+ doc.documentElement.nodeName === 'svg' ? doc.documentElement : null;
1090
+ }
1091
+ catch (e) {
1092
+ error = { svgInvalid: { value: control.value } };
1093
+ }
1094
+ if (!error && svgRoot) {
1095
+ const gElements = svgRoot.getElementsByTagName('g');
1096
+ if (gElements.length !== 1 || svgRoot.childNodes.length > 1) {
1097
+ error = { svgInvalidRoot: { value: control.value } };
1098
+ }
1099
+ }
1100
+ return error;
1101
+ };
1102
+ }
1103
+ }
1104
+
1105
+ class SimpleTreeComponent {
1106
+ constructor() {
1107
+ this.selectedNodeChange = new EventEmitter();
1108
+ this.level = 0;
1109
+ }
1110
+ get node() {
1111
+ return this._node;
1112
+ }
1113
+ set node(value) {
1114
+ if (this._node === value) {
1115
+ return;
1116
+ }
1117
+ this._node = value;
1118
+ this.level = this.calculateLevel(value);
1119
+ }
1120
+ ngOnInit() {
1121
+ this.level = this.calculateLevel(this.node);
1122
+ }
1123
+ calculateLevel(node) {
1124
+ let level = 0;
1125
+ if (node) {
1126
+ let n = node;
1127
+ while (n.parent) {
1128
+ level++;
1129
+ n = n.parent;
1130
+ }
1131
+ }
1132
+ return level;
1133
+ }
1134
+ selectNode(node) {
1135
+ this.selectedNode = node;
1136
+ this.selectedNodeChange.emit(node);
1137
+ }
1138
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SimpleTreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1139
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: SimpleTreeComponent, isStandalone: true, selector: "gve-simple-tree", inputs: { node: "node", selectedNode: "selectedNode" }, outputs: { selectedNodeChange: "selectedNodeChange" }, ngImport: i0, template: "@if (node) {\r\n<div [style.margin-left]=\"level * 8 + 'px'\">\r\n <ng-template\r\n #tree\r\n let-node\r\n let-parentLevel=\"level\"\r\n let-selectedNode=\"selectedNode\"\r\n >\r\n <div\r\n [style.margin-left]=\"parentLevel * 8 + 'px'\"\r\n [class.selected]=\"node === selectedNode\"\r\n >\r\n <div class=\"toolbar-row\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n (click)=\"node.isExpanded = !node.isExpanded\"\r\n >\r\n <mat-icon>{{\r\n node.isExpanded ? \"expand_more\" : \"chevron_right\"\r\n }}</mat-icon>\r\n </button>\r\n <span class=\"label\" (click)=\"selectNode(node)\">\r\n {{ node.label }}\r\n </span>\r\n </div>\r\n <div *ngIf=\"node.children && node.isExpanded\">\r\n <ng-container *ngFor=\"let child of node.children\">\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n tree;\r\n context: {\r\n $implicit: child,\r\n level: parentLevel + 1,\r\n selectedNode: selectedNode\r\n }\r\n \"\r\n ></ng-container>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- $implicit is the source of let-node -->\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n tree;\r\n context: { $implicit: node, level: level, selectedNode: selectedNode }\r\n \"\r\n ></ng-container>\r\n</div>\r\n}\r\n", styles: [".label{cursor:pointer}.toolbar-row{display:flex;align-items:center;flex-wrap:wrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }] }); }
1140
+ }
1141
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SimpleTreeComponent, decorators: [{
1142
+ type: Component,
1143
+ args: [{ selector: 'gve-simple-tree', standalone: true, imports: [CommonModule, MatButtonModule, MatIconModule, MatTooltipModule], template: "@if (node) {\r\n<div [style.margin-left]=\"level * 8 + 'px'\">\r\n <ng-template\r\n #tree\r\n let-node\r\n let-parentLevel=\"level\"\r\n let-selectedNode=\"selectedNode\"\r\n >\r\n <div\r\n [style.margin-left]=\"parentLevel * 8 + 'px'\"\r\n [class.selected]=\"node === selectedNode\"\r\n >\r\n <div class=\"toolbar-row\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n (click)=\"node.isExpanded = !node.isExpanded\"\r\n >\r\n <mat-icon>{{\r\n node.isExpanded ? \"expand_more\" : \"chevron_right\"\r\n }}</mat-icon>\r\n </button>\r\n <span class=\"label\" (click)=\"selectNode(node)\">\r\n {{ node.label }}\r\n </span>\r\n </div>\r\n <div *ngIf=\"node.children && node.isExpanded\">\r\n <ng-container *ngFor=\"let child of node.children\">\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n tree;\r\n context: {\r\n $implicit: child,\r\n level: parentLevel + 1,\r\n selectedNode: selectedNode\r\n }\r\n \"\r\n ></ng-container>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- $implicit is the source of let-node -->\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n tree;\r\n context: { $implicit: node, level: level, selectedNode: selectedNode }\r\n \"\r\n ></ng-container>\r\n</div>\r\n}\r\n", styles: [".label{cursor:pointer}.toolbar-row{display:flex;align-items:center;flex-wrap:wrap}\n"] }]
1144
+ }], propDecorators: { node: [{
1145
+ type: Input
1146
+ }], selectedNode: [{
1147
+ type: Input
1148
+ }], selectedNodeChange: [{
1149
+ type: Output
1150
+ }] } });
1151
+
1152
+ /**
1153
+ * Service to store and retrieve dynamic settings.
1154
+ */
1155
+ class SettingsService {
1156
+ constructor() {
1157
+ this._cache = new Map();
1158
+ }
1159
+ /**
1160
+ * Scopes the key by prefixing it with the keyPrefix if any.
1161
+ *
1162
+ * @param key The key to scope.
1163
+ * @returns The scoped key.
1164
+ */
1165
+ getScopedKey(key) {
1166
+ return this.keyPrefix ? this.keyPrefix + key : key;
1167
+ }
1168
+ /**
1169
+ * Sets a setting's value.
1170
+ *
1171
+ * @param key The key.
1172
+ * @param value The value.
1173
+ * @param persist True to persist this setting in local storage.
1174
+ */
1175
+ set(key, value, persist = false) {
1176
+ key = this.getScopedKey(key);
1177
+ this._cache.set(key, value);
1178
+ if (persist && value) {
1179
+ localStorage.setItem(key, JSON.stringify(value));
1180
+ }
1181
+ }
1182
+ /**
1183
+ * Get a setting's value of type T.
1184
+ *
1185
+ * @param key The key.
1186
+ * @param defaultValue The default value to get when the setting
1187
+ * is not found in the store.
1188
+ * @returns The value.
1189
+ */
1190
+ get(key, defaultValue) {
1191
+ key = this.getScopedKey(key);
1192
+ // immediately return value from cache
1193
+ if (this._cache.has(key)) {
1194
+ return this._cache.get(key);
1195
+ }
1196
+ // try loading value from local storage
1197
+ const value = localStorage.getItem(key);
1198
+ if (value) {
1199
+ const v = JSON.parse(value);
1200
+ this._cache.set(key, v);
1201
+ return value;
1202
+ }
1203
+ // not found, return default value
1204
+ return defaultValue;
1205
+ }
1206
+ /**
1207
+ * Check if a key exists in the store.
1208
+ *
1209
+ * @param key The key.
1210
+ * @returns True if the key exists in the store.
1211
+ */
1212
+ contains(key) {
1213
+ key = this.getScopedKey(key);
1214
+ return this._cache.has(key) || localStorage.getItem(key) !== null;
1215
+ }
1216
+ /**
1217
+ * Remove a setting if present.
1218
+ *
1219
+ * @param key The key.
1220
+ */
1221
+ remove(key) {
1222
+ key = this.getScopedKey(key);
1223
+ this._cache.delete(key);
1224
+ localStorage.removeItem(key);
1225
+ }
1226
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1227
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SettingsService, providedIn: 'root' }); }
1228
+ }
1229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SettingsService, decorators: [{
1230
+ type: Injectable,
1231
+ args: [{
1232
+ providedIn: 'root',
1233
+ }]
1234
+ }] });
1235
+
1236
+ /**
1237
+ * A component for editing a variant generation operation.
1238
+ */
1239
+ class ChainOperationEditorComponent {
1240
+ /**
1241
+ * The operation to edit.
1242
+ */
1243
+ get operation() {
1244
+ return this._operation || undefined;
1245
+ }
1246
+ set operation(value) {
1247
+ if (this._operation === value) {
1248
+ return;
1249
+ }
1250
+ this._operation = value;
1251
+ this.updateForm(value);
1252
+ }
1253
+ /**
1254
+ * The snapshot the operation refers to.
1255
+ */
1256
+ get snapshot() {
1257
+ return this._snapshot;
1258
+ }
1259
+ set snapshot(value) {
1260
+ if (this._snapshot === value) {
1261
+ return;
1262
+ }
1263
+ const dirty = this.hasTextChanges(value || undefined);
1264
+ this._snapshot = value || undefined;
1265
+ if (dirty) {
1266
+ this.requestPreview();
1267
+ this._editorModel?.setValue(this.svg.value || '');
1268
+ }
1269
+ }
1270
+ constructor(formBuilder, _clipboard, _settings) {
1271
+ this._clipboard = _clipboard;
1272
+ this._settings = _settings;
1273
+ // monaco
1274
+ this._disposables = [];
1275
+ this._nanoid = customAlphabet('1234567890abcdef', 10);
1276
+ this._editedSourceIndex = -1;
1277
+ /**
1278
+ * Emits when the operation is changed.
1279
+ */
1280
+ this.operationChange = new EventEmitter();
1281
+ /**
1282
+ * Emits when the operation preview is requested.
1283
+ */
1284
+ this.operationPreview = new EventEmitter();
1285
+ /**
1286
+ * Emits when the operation editing is cancelled.
1287
+ */
1288
+ this.operationCancel = new EventEmitter();
1289
+ this.tabIndex = 0;
1290
+ this.hasTo = false;
1291
+ this.hasToRun = false;
1292
+ this.hasValue = false;
1293
+ this._subs = [];
1294
+ // general
1295
+ this.rank = formBuilder.control(0, { nonNullable: true });
1296
+ this.groupId = formBuilder.control(null);
1297
+ this.features = formBuilder.control([], { nonNullable: true });
1298
+ this.sources = formBuilder.control([], {
1299
+ nonNullable: true,
1300
+ });
1301
+ this.type = formBuilder.control(OperationType.replace, {
1302
+ validators: Validators.required,
1303
+ nonNullable: true,
1304
+ });
1305
+ this.at = formBuilder.control(0, {
1306
+ validators: Validators.required,
1307
+ nonNullable: true,
1308
+ });
1309
+ this.atAsIndex = formBuilder.control(false, { nonNullable: true });
1310
+ this.to = formBuilder.control(0, { nonNullable: true });
1311
+ this.toAsIndex = formBuilder.control(false, { nonNullable: true });
1312
+ this.inputTag = formBuilder.control(null);
1313
+ this.outputTag = formBuilder.control(null);
1314
+ this.run = formBuilder.control(0, {
1315
+ validators: Validators.required,
1316
+ nonNullable: true,
1317
+ });
1318
+ this.toRun = formBuilder.control(0, { nonNullable: true });
1319
+ this.value = formBuilder.control(null);
1320
+ // svg
1321
+ this.svg = formBuilder.control('', {
1322
+ validators: [SvgValidators.rootGValidator()],
1323
+ nonNullable: true,
1324
+ });
1325
+ this.elementFeatures = formBuilder.control({}, { nonNullable: true });
1326
+ this.dpFeatures = formBuilder.control([], { nonNullable: true });
1327
+ this.form = formBuilder.group({
1328
+ rank: this.rank,
1329
+ groupId: this.groupId,
1330
+ features: this.features,
1331
+ sources: this.sources,
1332
+ type: this.type,
1333
+ at: this.at,
1334
+ atAsIndex: this.atAsIndex,
1335
+ to: this.to,
1336
+ toAsIndex: this.toAsIndex,
1337
+ inputTag: this.inputTag,
1338
+ outputTag: this.outputTag,
1339
+ run: this.run,
1340
+ toRun: this.toRun,
1341
+ value: this.value,
1342
+ svg: this.svg,
1343
+ elementFeatures: this.elementFeatures,
1344
+ dpFeatures: this.dpFeatures,
1345
+ });
1346
+ // SVG elements
1347
+ this.elements = [];
1348
+ }
1349
+ ngOnInit() {
1350
+ // whenever svg or base change, update preview
1351
+ this._subs.push(this.form.valueChanges
1352
+ .pipe(filter((changes) => 'svg' in changes || 'snapshot' in changes), debounceTime$1(500))
1353
+ .subscribe(() => {
1354
+ this.requestPreview();
1355
+ }));
1356
+ // whenever type changes, update args UI
1357
+ this._subs.push(this.type.valueChanges.subscribe(() => this.updateArgsUI()));
1358
+ }
1359
+ ngOnDestroy() {
1360
+ this._disposables.forEach((d) => d.dispose());
1361
+ for (const sub of this._subs) {
1362
+ sub.unsubscribe();
1363
+ }
1364
+ }
1365
+ hasTextChanges(snapshot) {
1366
+ if ((!snapshot && this._snapshot) || (snapshot && !this._snapshot)) {
1367
+ return true;
1368
+ }
1369
+ if (snapshot?.size?.width !== this._snapshot?.size?.width ||
1370
+ snapshot?.size?.height !== this._snapshot?.size?.height) {
1371
+ return true;
1372
+ }
1373
+ if (snapshot?.style !== this._snapshot?.style ||
1374
+ snapshot?.text !== this._snapshot?.text ||
1375
+ snapshot?.textStyle !== this._snapshot?.textStyle) {
1376
+ return true;
1377
+ }
1378
+ // compare textOptions returning true if any different
1379
+ const options = snapshot?.textOptions;
1380
+ if (options?.lineHeightOffset !==
1381
+ this._snapshot?.textOptions?.lineHeightOffset ||
1382
+ options?.charSpacingOffset !==
1383
+ this._snapshot?.textOptions?.charSpacingOffset ||
1384
+ options?.spcWidthOffset !== this._snapshot?.textOptions?.spcWidthOffset) {
1385
+ return true;
1386
+ }
1387
+ return false;
1388
+ }
1389
+ onCreateEditor(editor) {
1390
+ console.log('creating editor');
1391
+ editor.updateOptions({
1392
+ minimap: {
1393
+ side: 'right',
1394
+ },
1395
+ wordWrap: 'on',
1396
+ automaticLayout: true,
1397
+ });
1398
+ this._editorModel =
1399
+ this._editorModel || monaco.editor.createModel(this.svg.value, 'xml');
1400
+ editor.setModel(this._editorModel);
1401
+ this._editor = editor;
1402
+ this._disposables.push(this._editorModel.onDidChangeContent((e) => {
1403
+ console.log('change content');
1404
+ const code = this._editorModel.getValue();
1405
+ if (code !== this.svg.value) {
1406
+ this.svg.setValue(code);
1407
+ this.svg.markAsDirty();
1408
+ this.svg.updateValueAndValidity();
1409
+ }
1410
+ }));
1411
+ }
1412
+ onFeaturesChange(features) {
1413
+ this.features.setValue(features);
1414
+ this.features.markAsDirty();
1415
+ }
1416
+ onDpFeaturesChange(features) {
1417
+ this.dpFeatures.setValue(features);
1418
+ this.dpFeatures.markAsDirty();
1419
+ }
1420
+ // #region sources
1421
+ addSource() {
1422
+ this.editedSource = { id: '', type: '' };
1423
+ this._editedSourceIndex = -1;
1424
+ }
1425
+ editSource(index) {
1426
+ this._editedSourceIndex = index;
1427
+ this.editedSource = this.sources.value[index];
1428
+ }
1429
+ closeSource() {
1430
+ this._editedSourceIndex = -1;
1431
+ this.editedSource = undefined;
1432
+ }
1433
+ onSourceChange(source) {
1434
+ const sources = [...this.sources.value];
1435
+ if (this._editedSourceIndex === -1) {
1436
+ sources.push(source);
1437
+ }
1438
+ else {
1439
+ sources[this._editedSourceIndex] = source;
1440
+ }
1441
+ this.sources.setValue(sources);
1442
+ this.closeSource();
1443
+ }
1444
+ // #endregion
1445
+ // #region svg
1446
+ saveSvg() {
1447
+ if (!this.svg.value) {
1448
+ return;
1449
+ }
1450
+ const blob = new Blob([this.svg.value], { type: 'application/xml' });
1451
+ const url = window.URL.createObjectURL(blob);
1452
+ const a = document.createElement('a');
1453
+ a.href = url;
1454
+ // create filename from date and time
1455
+ const now = new Date();
1456
+ const date = now.toISOString().split('T')[0];
1457
+ const time = now.toTimeString().split(' ')[0].replace(':', '-');
1458
+ a.download = `svg-${date}_${time}.svg`;
1459
+ a.click();
1460
+ window.URL.revokeObjectURL(url);
1461
+ }
1462
+ openSvgEditor() {
1463
+ const url = this._settings.get('svg-editor', 'https://editor.method.ac/');
1464
+ if (url) {
1465
+ if (this.svg.value) {
1466
+ this._clipboard.copy(this.svg.value);
1467
+ }
1468
+ window.open(url, '_blank');
1469
+ }
1470
+ }
1471
+ loadSvg() {
1472
+ const input = document.createElement('input');
1473
+ input.type = 'file';
1474
+ input.accept = '.svg';
1475
+ input.onchange = () => {
1476
+ const file = input.files?.[0];
1477
+ if (file) {
1478
+ const reader = new FileReader();
1479
+ reader.onload = (e) => {
1480
+ this.svg.setValue(e.target?.result);
1481
+ };
1482
+ reader.readAsText(file);
1483
+ }
1484
+ };
1485
+ input.click();
1486
+ }
1487
+ setSvgFromClipboard() {
1488
+ navigator.clipboard.readText().then((text) => {
1489
+ this.svg.setValue(text);
1490
+ });
1491
+ }
1492
+ parseSvg(svg) {
1493
+ if (!svg) {
1494
+ return [];
1495
+ }
1496
+ try {
1497
+ // parse SVG code extracting all the SVG elements with an id attribute
1498
+ const parser = new DOMParser();
1499
+ const doc = parser.parseFromString(svg, 'image/svg+xml');
1500
+ const elements = Array.from(doc.querySelectorAll('[id]'));
1501
+ // for each element, read x and y and add a transform with a translate
1502
+ // equal to -x and -y so that the element is at the origin. This is useful
1503
+ // so that the element can be previewed in its box without wasting space
1504
+ // just because it happens not to be placed at the SVG origin
1505
+ for (const element of elements) {
1506
+ const x = parseFloat(element.getAttribute('x') || '0');
1507
+ const y = parseFloat(element.getAttribute('y') || '0');
1508
+ element.setAttribute('transform', `translate(${-x},${-y})`);
1509
+ }
1510
+ return elements;
1511
+ }
1512
+ catch (e) {
1513
+ this.svg.setErrors({ invalidSvg: true });
1514
+ return [];
1515
+ }
1516
+ }
1517
+ // #endregion
1518
+ // #region element features
1519
+ onTabIndexChange(index) {
1520
+ this.tabIndex = index;
1521
+ if (index === 3) {
1522
+ this.elements = this.parseSvg(this.svg.value);
1523
+ }
1524
+ }
1525
+ editElementFeatures(element) {
1526
+ const id = element.id;
1527
+ const features = this.elementFeatures.value[id] || [];
1528
+ this.elementFeatures.setValue({
1529
+ ...this.elementFeatures.value,
1530
+ [id]: features,
1531
+ });
1532
+ this.editedElementId = id;
1533
+ }
1534
+ deleteElementFeatures(element) {
1535
+ const id = element.id;
1536
+ const elementFeatures = { ...this.elementFeatures.value };
1537
+ delete elementFeatures[id];
1538
+ this.elementFeatures.setValue(elementFeatures);
1539
+ if (this.editedElementId === id) {
1540
+ this.editedElementId = undefined;
1541
+ }
1542
+ }
1543
+ onElementFeaturesChange(features) {
1544
+ if (this.editedElementId) {
1545
+ this.elementFeatures.setValue({
1546
+ ...this.elementFeatures.value,
1547
+ [this.editedElementId]: features,
1548
+ });
1549
+ }
1550
+ }
1551
+ // #endregion
1552
+ updateArgsUI() {
1553
+ let to = false, toRun = false, value = false;
1554
+ switch (this.type.value) {
1555
+ case OperationType.moveAfter:
1556
+ case OperationType.moveBefore:
1557
+ to = true;
1558
+ break;
1559
+ case OperationType.swap:
1560
+ to = true;
1561
+ toRun = true;
1562
+ break;
1563
+ case OperationType.addAfter:
1564
+ case OperationType.addBefore:
1565
+ case OperationType.replace:
1566
+ value = true;
1567
+ break;
1568
+ }
1569
+ this.hasTo = to;
1570
+ this.hasToRun = toRun;
1571
+ this.hasValue = value;
1572
+ if (!to) {
1573
+ this.to.reset();
1574
+ }
1575
+ if (!toRun) {
1576
+ this.toRun.reset();
1577
+ }
1578
+ if (!value) {
1579
+ this.value.reset();
1580
+ }
1581
+ }
1582
+ updateForm(operation) {
1583
+ if (!operation) {
1584
+ this.form.reset();
1585
+ this.updateArgsUI();
1586
+ return;
1587
+ }
1588
+ // get or generate ID
1589
+ if (operation.id) {
1590
+ this.id = operation.id;
1591
+ }
1592
+ else {
1593
+ this.id = this._nanoid();
1594
+ }
1595
+ this.rank.setValue(operation.rank || 0);
1596
+ this.groupId.setValue(operation.groupId || null);
1597
+ this.features.setValue(operation.features || []);
1598
+ this.sources.setValue(operation.sources || []);
1599
+ this.dpFeatures.setValue(operation.diplomatics?.features || []);
1600
+ this.type.setValue(operation.type);
1601
+ this.at.setValue(operation.at);
1602
+ this.atAsIndex.setValue(operation.atAsIndex || false);
1603
+ this.to.setValue(operation.to || 0);
1604
+ this.toAsIndex.setValue(operation.toAsIndex || false);
1605
+ this.inputTag.setValue(operation.inputTag || null);
1606
+ this.outputTag.setValue(operation.outputTag || null);
1607
+ this.run.setValue(operation.run);
1608
+ this.toRun.setValue(operation.toRun || 0);
1609
+ this.value.setValue(operation.value || null);
1610
+ this.svg.setValue(operation.diplomatics?.g || '');
1611
+ this._editorModel?.setValue(this.svg.value || '');
1612
+ this.elementFeatures.setValue(operation.diplomatics?.elementFeatures || {});
1613
+ this.form.markAsPristine();
1614
+ this.elements = this.parseSvg(operation.diplomatics?.g);
1615
+ // SVG
1616
+ this.requestPreview();
1617
+ this.updateArgsUI();
1618
+ }
1619
+ cancel() {
1620
+ this.operationCancel.emit();
1621
+ }
1622
+ getOperation() {
1623
+ return {
1624
+ rank: this.rank.value,
1625
+ groupId: this.groupId.value || undefined,
1626
+ features: this.features.value,
1627
+ sources: this.sources.value?.length ? this.sources.value : undefined,
1628
+ diplomatics: {
1629
+ g: this.svg.value,
1630
+ features: this.dpFeatures.value,
1631
+ elementFeatures: this.elementFeatures.value,
1632
+ },
1633
+ id: this.id,
1634
+ type: this.type.value,
1635
+ at: this.at.value,
1636
+ atAsIndex: this.atAsIndex.value,
1637
+ to: this.to.value,
1638
+ toAsIndex: this.toAsIndex.value,
1639
+ inputTag: this.inputTag.value || undefined,
1640
+ outputTag: this.outputTag.value || undefined,
1641
+ run: this.run.value,
1642
+ toRun: this.toRun.value,
1643
+ value: this.value.value || undefined,
1644
+ };
1645
+ }
1646
+ requestPreview() {
1647
+ this.operationPreview.emit(this.getOperation());
1648
+ }
1649
+ save() {
1650
+ if (!this.form.valid) {
1651
+ return;
1652
+ }
1653
+ this._operation = this.getOperation();
1654
+ this.operationChange.emit(this._operation);
1655
+ }
1656
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: ChainOperationEditorComponent, deps: [{ token: i1.FormBuilder }, { token: i2$3.Clipboard }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Component }); }
1657
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: ChainOperationEditorComponent, isStandalone: true, selector: "gve-chain-operation-editor", inputs: { operation: "operation", snapshot: "snapshot", hidePreview: "hidePreview" }, outputs: { operationChange: "operationChange", operationPreview: "operationPreview", operationCancel: "operationCancel" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <!-- tabs -->\r\n <mat-tab-group\r\n [selectedIndex]=\"tabIndex\"\r\n (selectedIndexChange)=\"onTabIndexChange($event)\"\r\n >\r\n <!-- GENERAL -->\r\n <mat-tab label=\"general\">\r\n <div class=\"form-row\">\r\n <!-- id -->\r\n <div id=\"id\" class=\"muted\">{{ id }}</div>\r\n\r\n <!-- type -->\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"type\">\r\n <mat-option [value]=\"0\">replace</mat-option>\r\n <mat-option [value]=\"1\">delete</mat-option>\r\n <mat-option [value]=\"2\">add-before</mat-option>\r\n <mat-option [value]=\"3\">add-after</mat-option>\r\n <mat-option [value]=\"4\">move-before</mat-option>\r\n <mat-option [value]=\"5\">move-after</mat-option>\r\n <mat-option [value]=\"6\">swap</mat-option>\r\n <mat-option [value]=\"7\">annotate</mat-option>\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"$any(type).errors?.required && (type.dirty || type.touched)\"\r\n >type required</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <div class=\"form-row\">\r\n <!-- at -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>at</mat-label>\r\n <input matInput [formControl]=\"at\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(at).errors?.required && (at.dirty || at.touched)\"\r\n >at required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- atAsIndex -->\r\n <mat-checkbox [formControl]=\"atAsIndex\">idx</mat-checkbox>\r\n\r\n <!-- run -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>run</mat-label>\r\n <input matInput [formControl]=\"run\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(run).errors?.required && (run.dirty || run.touched)\"\r\n >run required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- to -->\r\n @if (hasTo) {\r\n <mat-form-field class=\"nr\">\r\n <mat-label>to</mat-label>\r\n <input matInput [formControl]=\"to\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(to).errors?.required && (to.dirty || to.touched)\"\r\n >to required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- toAsIndex -->\r\n <mat-checkbox [formControl]=\"toAsIndex\">idx</mat-checkbox>\r\n\r\n <!-- toRun -->\r\n @if (hasToRun) {\r\n <mat-form-field class=\"nr\">\r\n <mat-label>to run</mat-label>\r\n <input matInput [formControl]=\"toRun\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(toRun).errors?.required && (toRun.dirty || toRun.touched)\r\n \"\r\n >to run required</mat-error\r\n >\r\n </mat-form-field>\r\n } }\r\n\r\n <!-- value -->\r\n @if (hasValue) {\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n </mat-form-field>\r\n }\r\n </div>\r\n <div class=\"form-row\">\r\n <!-- rank -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>rank</mat-label>\r\n <input matInput [formControl]=\"rank\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(rank).errors?.required && (rank.dirty || rank.touched)\"\r\n >rank required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- groupId -->\r\n <mat-form-field>\r\n <mat-label>group ID</mat-label>\r\n <input matInput [formControl]=\"groupId\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(groupId).errors?.required &&\r\n (groupId.dirty || groupId.touched)\r\n \"\r\n >group ID required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- inputTag -->\r\n <mat-form-field>\r\n <mat-label>input tag</mat-label>\r\n <input matInput [formControl]=\"inputTag\" />\r\n <mat-hint>blank=latest</mat-hint>\r\n </mat-form-field>\r\n\r\n <!-- outputTag -->\r\n <mat-form-field>\r\n <mat-label>output tag</mat-label>\r\n <input matInput [formControl]=\"outputTag\" />\r\n <mat-hint>blank=auto (vN)</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <!-- features -->\r\n <fieldset>\r\n <legend>operation features</legend>\r\n <gve-feature-set-editor\r\n [isVar]=\"true\"\r\n [features]=\"features.value\"\r\n (featuresChange)=\"onFeaturesChange($event)\"\r\n ></gve-feature-set-editor>\r\n </fieldset>\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- SOURCES -->\r\n <mat-tab label=\"sources\">\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n (click)=\"addSource()\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n source\r\n </button>\r\n </div>\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>type</th>\r\n <th>id</th>\r\n <th>rank</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (s of sources.value; track s) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"editSource($index)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button type=\"button\" mat-icon-button color=\"warn\">\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ s.type }}</td>\r\n <td>{{ s.id }}</td>\r\n <td>{{ s.rank }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n <!-- source editor -->\r\n <mat-expansion-panel [disabled]=\"!editedSource\" [expanded]=\"editedSource\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>source</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <gve-operation-source-editor\r\n [source]=\"editedSource\"\r\n (sourceChange)=\"onSourceChange($event!)\"\r\n (sourceCancel)=\"closeSource()\"\r\n />\r\n </mat-expansion-panel>\r\n </mat-tab>\r\n\r\n <!-- DIPLOMATIC -->\r\n <mat-tab label=\"diplomatic\">\r\n <div class=\"toolbar-row\">\r\n <button\r\n id=\"btn-save\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Save to file\"\r\n [disabled]=\"!svg.value\"\r\n (click)=\"saveSvg()\"\r\n >\r\n <mat-icon>save</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-load\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Load from file\"\r\n (click)=\"loadSvg()\"\r\n >\r\n <mat-icon>folder</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-copy\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Copy\"\r\n [cdkCopyToClipboard]=\"svg.value\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-paste\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Set SVG from clipboard\"\r\n (click)=\"setSvgFromClipboard()\"\r\n >\r\n <mat-icon>content_paste_go</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-editor\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Open SVG external editor\"\r\n (click)=\"openSvgEditor()\"\r\n >\r\n <mat-icon>launch</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div id=\"code\">\r\n <nge-monaco-editor\r\n style=\"--editor-height: 400px\"\r\n (ready)=\"onCreateEditor($event)\"\r\n />\r\n @if (svg.invalid) {\r\n <mat-error>invalid SVG</mat-error>\r\n }\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- ELEMENTS -->\r\n <mat-tab label=\"elements\">\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>id</th>\r\n <th>visual</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (e of elements; track e.id) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"editElementFeatures(e)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteElementFeatures(e)\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ e.id }}</td>\r\n <td class=\"svg-cell\">\r\n <svg [innerHTML]=\"e.outerHTML | safeHtml : 'html'\"></svg>\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n\r\n <mat-expansion-panel\r\n [disabled]=\"!editedElementId\"\r\n [expanded]=\"editedElementId\"\r\n >\r\n <mat-expansion-panel-header>element</mat-expansion-panel-header>\r\n <gve-feature-set-editor\r\n [features]=\"elementFeatures.value[editedElementId!] || []\"\r\n (featuresChange)=\"onElementFeaturesChange($event)\"\r\n />\r\n </mat-expansion-panel>\r\n </mat-tab>\r\n\r\n <!-- DP FEATS -->\r\n <mat-tab label=\"d-features\">\r\n <gve-feature-set-editor\r\n [features]=\"dpFeatures.value\"\r\n (featuresChange)=\"onDpFeaturesChange($event)\"\r\n ></gve-feature-set-editor>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- buttons -->\r\n <div id=\"submit-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n @if (!hidePreview) {\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Preview operation\"\r\n (click)=\"requestPreview()\"\r\n >\r\n <mat-icon class=\"mat-primary\">preview</mat-icon>\r\n </button>\r\n }\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n save\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}#submit-row{display:flex;gap:8px;align-items:center;justify-content:center;flex-wrap:wrap;margin-top:8px;border-top:1px solid silver}.toolbar-row{display:flex;align-items:center;flex-wrap:wrap}.nr{width:5em}.long-text{width:100%;max-width:800px}#id{border-radius:6px;padding:4px;background-color:#beb9b9;color:#fff;margin-top:-16px}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin:8px 0}legend{color:silver}table{width:100%;border-collapse:collapse;margin:8px 0}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}tr{border-bottom:1px solid silver}th,td{text-align:center}#btn-save{color:#072d3e}#btn-load{color:#dbd112}#btn-copy{color:#22549f}#btn-preview{color:#095409}#code{height:500px;border:1px solid silver}#monaco{height:100%}.svg-cell{padding:0 8px}.svg-cell svg{border:1px solid silver;width:100%;height:auto}#preview{box-sizing:border-box;width:100%;border:1px solid silver;border-radius:4px;padding:8px}.tree-invisible{display:none}.tree ul,.tree li{margin-top:0;margin-bottom:0;list-style-type:none}.selected-node{background-color:#e5e5e5}.child-title{font-weight:700;margin:0;background-color:#ccc;color:#fff;padding:8px}#tree-container{display:grid;grid-template-rows:auto;grid-template-columns:auto 1fr;grid-template-areas:\"nav ed\";gap:0 16px;align-items:stretch}#tree-nav{grid-area:nav;border:1px solid silver;border-radius:6px;margin:8px 0;padding-right:8px}#tree-ed{grid-area:ed;border:1px solid silver;border-radius:6px;margin:8px 0}@media only screen and (max-width: 959px){div#container{grid-template-columns:1fr;grid-template-areas:\"nav\" \"ed\";gap:16px 0;align-items:start}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type:
1658
+ // material
1659
+ ClipboardModule }, { kind: "directive", type: i2$3.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i4$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4$1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4$1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i4$1.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTabsModule }, { kind: "component", type: i13.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i13.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type:
1660
+ // monaco
1661
+ NgeMonacoModule }, { kind: "component", type: i15.NgeMonacoEditorComponent, selector: "nge-monaco-editor", inputs: ["autoLayout", "options"], outputs: ["ready"] }, { kind: "ngmodule", type: NgToolsModule }, { kind: "pipe", type: i2$1.SafeHtmlPipe, name: "safeHtml" }, { kind: "ngmodule", type: NgMatToolsModule }, { kind: "component", type:
1662
+ // myrmex
1663
+ FeatureSetEditorComponent, selector: "gve-feature-set-editor", inputs: ["isVar", "featNames", "featValues", "noFilter", "features"], outputs: ["featuresChange"] }, { kind: "component", type: OperationSourceEditorComponent, selector: "gve-operation-source-editor", inputs: ["source", "ids", "types"], outputs: ["sourceChange", "sourceCancel"] }] }); }
1664
+ }
1665
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: ChainOperationEditorComponent, decorators: [{
1666
+ type: Component,
1667
+ args: [{ selector: 'gve-chain-operation-editor', standalone: true, imports: [
1668
+ CommonModule,
1669
+ ReactiveFormsModule,
1670
+ // material
1671
+ ClipboardModule,
1672
+ MatButtonModule,
1673
+ MatCheckboxModule,
1674
+ MatExpansionModule,
1675
+ MatFormFieldModule,
1676
+ MatIconModule,
1677
+ MatInputModule,
1678
+ MatSelectModule,
1679
+ MatTabsModule,
1680
+ MatTooltipModule,
1681
+ // monaco
1682
+ NgeMonacoModule,
1683
+ NgToolsModule,
1684
+ NgMatToolsModule,
1685
+ // myrmex
1686
+ FeatureSetEditorComponent,
1687
+ SimpleTreeComponent,
1688
+ OperationSourceEditorComponent,
1689
+ ], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <!-- tabs -->\r\n <mat-tab-group\r\n [selectedIndex]=\"tabIndex\"\r\n (selectedIndexChange)=\"onTabIndexChange($event)\"\r\n >\r\n <!-- GENERAL -->\r\n <mat-tab label=\"general\">\r\n <div class=\"form-row\">\r\n <!-- id -->\r\n <div id=\"id\" class=\"muted\">{{ id }}</div>\r\n\r\n <!-- type -->\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formControl]=\"type\">\r\n <mat-option [value]=\"0\">replace</mat-option>\r\n <mat-option [value]=\"1\">delete</mat-option>\r\n <mat-option [value]=\"2\">add-before</mat-option>\r\n <mat-option [value]=\"3\">add-after</mat-option>\r\n <mat-option [value]=\"4\">move-before</mat-option>\r\n <mat-option [value]=\"5\">move-after</mat-option>\r\n <mat-option [value]=\"6\">swap</mat-option>\r\n <mat-option [value]=\"7\">annotate</mat-option>\r\n </mat-select>\r\n <mat-error\r\n *ngIf=\"$any(type).errors?.required && (type.dirty || type.touched)\"\r\n >type required</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n <div class=\"form-row\">\r\n <!-- at -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>at</mat-label>\r\n <input matInput [formControl]=\"at\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(at).errors?.required && (at.dirty || at.touched)\"\r\n >at required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- atAsIndex -->\r\n <mat-checkbox [formControl]=\"atAsIndex\">idx</mat-checkbox>\r\n\r\n <!-- run -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>run</mat-label>\r\n <input matInput [formControl]=\"run\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(run).errors?.required && (run.dirty || run.touched)\"\r\n >run required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- to -->\r\n @if (hasTo) {\r\n <mat-form-field class=\"nr\">\r\n <mat-label>to</mat-label>\r\n <input matInput [formControl]=\"to\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(to).errors?.required && (to.dirty || to.touched)\"\r\n >to required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- toAsIndex -->\r\n <mat-checkbox [formControl]=\"toAsIndex\">idx</mat-checkbox>\r\n\r\n <!-- toRun -->\r\n @if (hasToRun) {\r\n <mat-form-field class=\"nr\">\r\n <mat-label>to run</mat-label>\r\n <input matInput [formControl]=\"toRun\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(toRun).errors?.required && (toRun.dirty || toRun.touched)\r\n \"\r\n >to run required</mat-error\r\n >\r\n </mat-form-field>\r\n } }\r\n\r\n <!-- value -->\r\n @if (hasValue) {\r\n <mat-form-field>\r\n <mat-label>value</mat-label>\r\n <input matInput [formControl]=\"value\" />\r\n </mat-form-field>\r\n }\r\n </div>\r\n <div class=\"form-row\">\r\n <!-- rank -->\r\n <mat-form-field class=\"nr\">\r\n <mat-label>rank</mat-label>\r\n <input matInput [formControl]=\"rank\" type=\"number\" min=\"0\" />\r\n <mat-error\r\n *ngIf=\"$any(rank).errors?.required && (rank.dirty || rank.touched)\"\r\n >rank required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- groupId -->\r\n <mat-form-field>\r\n <mat-label>group ID</mat-label>\r\n <input matInput [formControl]=\"groupId\" />\r\n <mat-error\r\n *ngIf=\"\r\n $any(groupId).errors?.required &&\r\n (groupId.dirty || groupId.touched)\r\n \"\r\n >group ID required</mat-error\r\n >\r\n </mat-form-field>\r\n\r\n <!-- inputTag -->\r\n <mat-form-field>\r\n <mat-label>input tag</mat-label>\r\n <input matInput [formControl]=\"inputTag\" />\r\n <mat-hint>blank=latest</mat-hint>\r\n </mat-form-field>\r\n\r\n <!-- outputTag -->\r\n <mat-form-field>\r\n <mat-label>output tag</mat-label>\r\n <input matInput [formControl]=\"outputTag\" />\r\n <mat-hint>blank=auto (vN)</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <!-- features -->\r\n <fieldset>\r\n <legend>operation features</legend>\r\n <gve-feature-set-editor\r\n [isVar]=\"true\"\r\n [features]=\"features.value\"\r\n (featuresChange)=\"onFeaturesChange($event)\"\r\n ></gve-feature-set-editor>\r\n </fieldset>\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- SOURCES -->\r\n <mat-tab label=\"sources\">\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n (click)=\"addSource()\"\r\n >\r\n <mat-icon>add_circle</mat-icon>\r\n source\r\n </button>\r\n </div>\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>type</th>\r\n <th>id</th>\r\n <th>rank</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (s of sources.value; track s) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"editSource($index)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button type=\"button\" mat-icon-button color=\"warn\">\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ s.type }}</td>\r\n <td>{{ s.id }}</td>\r\n <td>{{ s.rank }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n <!-- source editor -->\r\n <mat-expansion-panel [disabled]=\"!editedSource\" [expanded]=\"editedSource\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>source</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <gve-operation-source-editor\r\n [source]=\"editedSource\"\r\n (sourceChange)=\"onSourceChange($event!)\"\r\n (sourceCancel)=\"closeSource()\"\r\n />\r\n </mat-expansion-panel>\r\n </mat-tab>\r\n\r\n <!-- DIPLOMATIC -->\r\n <mat-tab label=\"diplomatic\">\r\n <div class=\"toolbar-row\">\r\n <button\r\n id=\"btn-save\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Save to file\"\r\n [disabled]=\"!svg.value\"\r\n (click)=\"saveSvg()\"\r\n >\r\n <mat-icon>save</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-load\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Load from file\"\r\n (click)=\"loadSvg()\"\r\n >\r\n <mat-icon>folder</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-copy\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Copy\"\r\n [cdkCopyToClipboard]=\"svg.value\"\r\n >\r\n <mat-icon>content_copy</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-paste\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Set SVG from clipboard\"\r\n (click)=\"setSvgFromClipboard()\"\r\n >\r\n <mat-icon>content_paste_go</mat-icon>\r\n </button>\r\n <button\r\n id=\"btn-editor\"\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Open SVG external editor\"\r\n (click)=\"openSvgEditor()\"\r\n >\r\n <mat-icon>launch</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div id=\"code\">\r\n <nge-monaco-editor\r\n style=\"--editor-height: 400px\"\r\n (ready)=\"onCreateEditor($event)\"\r\n />\r\n @if (svg.invalid) {\r\n <mat-error>invalid SVG</mat-error>\r\n }\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- ELEMENTS -->\r\n <mat-tab label=\"elements\">\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>id</th>\r\n <th>visual</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (e of elements; track e.id) {\r\n <tr>\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n (click)=\"editElementFeatures(e)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteElementFeatures(e)\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ e.id }}</td>\r\n <td class=\"svg-cell\">\r\n <svg [innerHTML]=\"e.outerHTML | safeHtml : 'html'\"></svg>\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n\r\n <mat-expansion-panel\r\n [disabled]=\"!editedElementId\"\r\n [expanded]=\"editedElementId\"\r\n >\r\n <mat-expansion-panel-header>element</mat-expansion-panel-header>\r\n <gve-feature-set-editor\r\n [features]=\"elementFeatures.value[editedElementId!] || []\"\r\n (featuresChange)=\"onElementFeaturesChange($event)\"\r\n />\r\n </mat-expansion-panel>\r\n </mat-tab>\r\n\r\n <!-- DP FEATS -->\r\n <mat-tab label=\"d-features\">\r\n <gve-feature-set-editor\r\n [features]=\"dpFeatures.value\"\r\n (featuresChange)=\"onDpFeaturesChange($event)\"\r\n ></gve-feature-set-editor>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- buttons -->\r\n <div id=\"submit-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n @if (!hidePreview) {\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Preview operation\"\r\n (click)=\"requestPreview()\"\r\n >\r\n <mat-icon class=\"mat-primary\">preview</mat-icon>\r\n </button>\r\n }\r\n <button\r\n type=\"submit\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n save\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}#submit-row{display:flex;gap:8px;align-items:center;justify-content:center;flex-wrap:wrap;margin-top:8px;border-top:1px solid silver}.toolbar-row{display:flex;align-items:center;flex-wrap:wrap}.nr{width:5em}.long-text{width:100%;max-width:800px}#id{border-radius:6px;padding:4px;background-color:#beb9b9;color:#fff;margin-top:-16px}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin:8px 0}legend{color:silver}table{width:100%;border-collapse:collapse;margin:8px 0}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}tr{border-bottom:1px solid silver}th,td{text-align:center}#btn-save{color:#072d3e}#btn-load{color:#dbd112}#btn-copy{color:#22549f}#btn-preview{color:#095409}#code{height:500px;border:1px solid silver}#monaco{height:100%}.svg-cell{padding:0 8px}.svg-cell svg{border:1px solid silver;width:100%;height:auto}#preview{box-sizing:border-box;width:100%;border:1px solid silver;border-radius:4px;padding:8px}.tree-invisible{display:none}.tree ul,.tree li{margin-top:0;margin-bottom:0;list-style-type:none}.selected-node{background-color:#e5e5e5}.child-title{font-weight:700;margin:0;background-color:#ccc;color:#fff;padding:8px}#tree-container{display:grid;grid-template-rows:auto;grid-template-columns:auto 1fr;grid-template-areas:\"nav ed\";gap:0 16px;align-items:stretch}#tree-nav{grid-area:nav;border:1px solid silver;border-radius:6px;margin:8px 0;padding-right:8px}#tree-ed{grid-area:ed;border:1px solid silver;border-radius:6px;margin:8px 0}@media only screen and (max-width: 959px){div#container{grid-template-columns:1fr;grid-template-areas:\"nav\" \"ed\";gap:16px 0;align-items:start}}\n"] }]
1690
+ }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2$3.Clipboard }, { type: SettingsService }], propDecorators: { operation: [{
1691
+ type: Input
1692
+ }], snapshot: [{
1693
+ type: Input
1694
+ }], hidePreview: [{
1695
+ type: Input
1696
+ }], operationChange: [{
1697
+ type: Output
1698
+ }], operationPreview: [{
1699
+ type: Output
1700
+ }], operationCancel: [{
1701
+ type: Output
1702
+ }] } });
1703
+
1704
+ class FeatureSetViewComponent {
1705
+ /**
1706
+ * The features.
1707
+ */
1708
+ get features() {
1709
+ return this._features;
1710
+ }
1711
+ set features(value) {
1712
+ if (this._features === value) {
1713
+ return;
1714
+ }
1715
+ this._features = value || undefined;
1716
+ this.filter.reset();
1717
+ this.applyFeatureFilter();
1718
+ }
1719
+ constructor(formBuilder) {
1720
+ this._features = [];
1721
+ /**
1722
+ * The minimum count of features required for filter to be visible.
1723
+ */
1724
+ this.minFilterCount = 6;
1725
+ this.filteredFeatures = [];
1726
+ this.filter = formBuilder.control(null);
1727
+ }
1728
+ applyFeatureFilter(name) {
1729
+ this.filteredFeatures = this._features.filter((feature) => {
1730
+ return !name || feature.name.toLowerCase().includes(name.toLowerCase());
1731
+ });
1732
+ }
1733
+ ngOnInit() {
1734
+ this._sub = this.filter.valueChanges
1735
+ .pipe(distinctUntilChanged(), debounceTime(300))
1736
+ .subscribe((value) => {
1737
+ this.applyFeatureFilter(value);
1738
+ });
1739
+ this.applyFeatureFilter();
1740
+ }
1741
+ ngOnDestroy() {
1742
+ this._sub?.unsubscribe();
1743
+ }
1744
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FeatureSetViewComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
1745
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: FeatureSetViewComponent, isStandalone: true, selector: "gve-feature-set-view", inputs: { features: "features", featNames: "featNames", featValues: "featValues", minFilterCount: "minFilterCount" }, ngImport: i0, template: "<div>\r\n <!-- filter -->\r\n <div>\r\n @if (features.length && features.length >= minFilterCount) {\r\n <div class=\"form-row\">\r\n <mat-form-field id=\"filter\">\r\n <mat-label>filter</mat-label>\r\n <input matInput placeholder=\"filter\" [formControl]=\"filter\" />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"filter.reset()\"\r\n [disabled]=\"!filter.value\"\r\n [attr.aria-label]=\"'Reset filter'\"\r\n >\r\n <mat-icon color=\"warn\" class=\"mat-warn\">cancel</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n\r\n <span>{{ filteredFeatures.length }}</span>\r\n </div>\r\n }\r\n\r\n <!-- list -->\r\n @if (filteredFeatures.length) {\r\n <table>\r\n <tbody>\r\n @for (feature of filteredFeatures; track feature) {\r\n <tr>\r\n <th>\r\n @if (featNames?.length) {\r\n <span>{{\r\n feature.name | flatLookup : featNames : \"id\" : \"label\"\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.name }}</span>\r\n }\r\n </th>\r\n <td>\r\n @if (featValues) {\r\n <span>{{\r\n feature.value | flatLookup : featValues[feature.name]\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.value }}</span>\r\n }\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n </div>\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.in-row-button{margin-top:-16px}table{width:100%;border-collapse:collapse}th{text-align:left;background-color:#c8d9eb;color:#333;font-weight:400}th,td{border:1px solid silver;padding:4px}tr:nth-child(2n){background-color:#dfdfdf}#filter{width:7em}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: NgToolsModule }, { kind: "pipe", type: i2$1.FlatLookupPipe, name: "flatLookup" }] }); }
1746
+ }
1747
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FeatureSetViewComponent, decorators: [{
1748
+ type: Component,
1749
+ args: [{ selector: 'gve-feature-set-view', standalone: true, imports: [
1750
+ CommonModule,
1751
+ ReactiveFormsModule,
1752
+ MatButtonModule,
1753
+ MatFormFieldModule,
1754
+ MatIconModule,
1755
+ MatInputModule,
1756
+ NgToolsModule,
1757
+ ], template: "<div>\r\n <!-- filter -->\r\n <div>\r\n @if (features.length && features.length >= minFilterCount) {\r\n <div class=\"form-row\">\r\n <mat-form-field id=\"filter\">\r\n <mat-label>filter</mat-label>\r\n <input matInput placeholder=\"filter\" [formControl]=\"filter\" />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"filter.reset()\"\r\n [disabled]=\"!filter.value\"\r\n [attr.aria-label]=\"'Reset filter'\"\r\n >\r\n <mat-icon color=\"warn\" class=\"mat-warn\">cancel</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n\r\n <span>{{ filteredFeatures.length }}</span>\r\n </div>\r\n }\r\n\r\n <!-- list -->\r\n @if (filteredFeatures.length) {\r\n <table>\r\n <tbody>\r\n @for (feature of filteredFeatures; track feature) {\r\n <tr>\r\n <th>\r\n @if (featNames?.length) {\r\n <span>{{\r\n feature.name | flatLookup : featNames : \"id\" : \"label\"\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.name }}</span>\r\n }\r\n </th>\r\n <td>\r\n @if (featValues) {\r\n <span>{{\r\n feature.value | flatLookup : featValues[feature.name]\r\n }}</span>\r\n } @else {\r\n <span>{{ feature.value }}</span>\r\n }\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n </div>\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.in-row-button{margin-top:-16px}table{width:100%;border-collapse:collapse}th{text-align:left;background-color:#c8d9eb;color:#333;font-weight:400}th,td{border:1px solid silver;padding:4px}tr:nth-child(2n){background-color:#dfdfdf}#filter{width:7em}\n"] }]
1758
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { features: [{
1759
+ type: Input
1760
+ }], featNames: [{
1761
+ type: Input
1762
+ }], featValues: [{
1763
+ type: Input
1764
+ }], minFilterCount: [{
1765
+ type: Input
1766
+ }] } });
1767
+
1768
+ /**
1769
+ * A map of steps in a chain operation context.
1770
+ */
1771
+ class StepsMapComponent {
1772
+ constructor() {
1773
+ /**
1774
+ * The font size of the steps text.
1775
+ */
1776
+ this.textFontSize = '0.5em';
1777
+ /**
1778
+ * Emitted when the selectd step has changed.
1779
+ */
1780
+ this.selectedStepChange = new EventEmitter();
1781
+ }
1782
+ /**
1783
+ * The steps to display.
1784
+ */
1785
+ get steps() {
1786
+ return this._steps;
1787
+ }
1788
+ set steps(value) {
1789
+ if (this._steps === value) {
1790
+ return;
1791
+ }
1792
+ this.selectedStep = undefined;
1793
+ this._steps = value || undefined;
1794
+ }
1795
+ onSelectStep(step) {
1796
+ this.selectedStep = step;
1797
+ this.selectedStepChange.emit(step);
1798
+ }
1799
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: StepsMapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1800
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: StepsMapComponent, isStandalone: true, selector: "gve-steps-map", inputs: { steps: "steps", selectedStep: "selectedStep", textFontSize: "textFontSize" }, outputs: { selectedStepChange: "selectedStepChange" }, ngImport: i0, template: "<div>\r\n @if (steps?.length) { @for (step of steps; track step.outputTag) {\r\n <div\r\n matRipple\r\n class=\"step form-row\"\r\n [ngClass]=\"{ selected: step === selectedStep }\"\r\n (click)=\"onSelectStep(step)\"\r\n >\r\n <div class=\"tag\">\r\n <span class=\"muted-tag\">{{ step.inputTag }} &#x25b6; </span>\r\n {{ step.outputTag }}\r\n </div>\r\n <div class=\"text\" [style.fontSize]=\"textFontSize\">{{ step.result }}</div>\r\n </div>\r\n } }\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.selected{background-color:#fbfb9d}.step{border-top:1px solid rgb(68,114,253);border-bottom:1px solid rgb(68,114,253);border-right:1px solid rgb(68,114,253);border-radius:6px;margin:8px 0}.tag{background-color:#4472fd;color:#fff;border:1px solid rgb(68,114,253);border-radius:6px;padding:4px;cursor:pointer}.muted-tag{color:silver}.text{font-size:.5em}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatRippleModule }, { kind: "directive", type: i9.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "ngmodule", type: MatTooltipModule }] }); }
1801
+ }
1802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: StepsMapComponent, decorators: [{
1803
+ type: Component,
1804
+ args: [{ selector: 'gve-steps-map', standalone: true, imports: [CommonModule, MatButtonModule, MatRippleModule, MatTooltipModule], template: "<div>\r\n @if (steps?.length) { @for (step of steps; track step.outputTag) {\r\n <div\r\n matRipple\r\n class=\"step form-row\"\r\n [ngClass]=\"{ selected: step === selectedStep }\"\r\n (click)=\"onSelectStep(step)\"\r\n >\r\n <div class=\"tag\">\r\n <span class=\"muted-tag\">{{ step.inputTag }} &#x25b6; </span>\r\n {{ step.outputTag }}\r\n </div>\r\n <div class=\"text\" [style.fontSize]=\"textFontSize\">{{ step.result }}</div>\r\n </div>\r\n } }\r\n</div>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.selected{background-color:#fbfb9d}.step{border-top:1px solid rgb(68,114,253);border-bottom:1px solid rgb(68,114,253);border-right:1px solid rgb(68,114,253);border-radius:6px;margin:8px 0}.tag{background-color:#4472fd;color:#fff;border:1px solid rgb(68,114,253);border-radius:6px;padding:4px;cursor:pointer}.muted-tag{color:silver}.text{font-size:.5em}\n"] }]
1805
+ }], propDecorators: { steps: [{
1806
+ type: Input
1807
+ }], selectedStep: [{
1808
+ type: Input
1809
+ }], textFontSize: [{
1810
+ type: Input
1811
+ }], selectedStepChange: [{
1812
+ type: Output
1813
+ }] } });
1814
+
1815
+ /**
1816
+ * Component to display a chain result.
1817
+ */
1818
+ class ChainResultViewComponent {
1819
+ /**
1820
+ * The result to display.
1821
+ */
1822
+ get result() {
1823
+ return this._result;
1824
+ }
1825
+ set result(value) {
1826
+ if (this._result === value) {
1827
+ return;
1828
+ }
1829
+ this._result = value || undefined;
1830
+ this.updateForm(this._result);
1831
+ // select last step by default
1832
+ if (this._result?.steps?.length) {
1833
+ this._stepPickFrozen = true;
1834
+ this.step = this._result.steps[this._result.steps.length - 1];
1835
+ this.tag.setValue(this.step.outputTag);
1836
+ this._stepPickFrozen = false;
1837
+ }
1838
+ }
1839
+ constructor(formBuilder) {
1840
+ /**
1841
+ * Emits when a result's step is picked.
1842
+ */
1843
+ this.stepPick = new EventEmitter();
1844
+ this.versionTags = [];
1845
+ this.tags = [];
1846
+ this.selectionFeatures = [];
1847
+ this.versionTag = formBuilder.control(null);
1848
+ this.tag = formBuilder.control(null);
1849
+ }
1850
+ ngOnInit() {
1851
+ this._subs = [
1852
+ this.versionTag.valueChanges
1853
+ .pipe(distinctUntilChanged(), debounceTime(200))
1854
+ .subscribe((value) => {
1855
+ this.tag.setValue(this.getTagFromVersion(value) || null);
1856
+ }),
1857
+ this.tag.valueChanges
1858
+ .pipe(distinctUntilChanged(), debounceTime(200))
1859
+ .subscribe((value) => {
1860
+ this.step = this._result?.steps.find((step) => step.outputTag === value);
1861
+ if (this.step && !this._stepPickFrozen) {
1862
+ this.stepPick.emit(this.step);
1863
+ }
1864
+ }),
1865
+ ];
1866
+ }
1867
+ ngOnDestroy() {
1868
+ this._subs?.forEach((sub) => sub.unsubscribe());
1869
+ }
1870
+ updateVersionTags() {
1871
+ if (!this._result) {
1872
+ this.versionTags = [];
1873
+ return;
1874
+ }
1875
+ // extract version tags from result steps features named 'version'
1876
+ const tags = new Set();
1877
+ for (const step of this._result.steps) {
1878
+ for (const feature of step.featureSet.features) {
1879
+ if (feature.name === 'version') {
1880
+ tags.add(feature.value);
1881
+ }
1882
+ }
1883
+ }
1884
+ this.versionTags = Array.from(tags).sort();
1885
+ }
1886
+ getTagFromVersion(version) {
1887
+ if (!this._result || !version) {
1888
+ return undefined;
1889
+ }
1890
+ for (const step of this._result.steps) {
1891
+ for (const feature of step.featureSet.features) {
1892
+ if (feature.name === 'version' && feature.value === version) {
1893
+ return step.outputTag;
1894
+ }
1895
+ }
1896
+ }
1897
+ return undefined;
1898
+ }
1899
+ updateForm(result) {
1900
+ this.selectionFeatures = [];
1901
+ if (!result) {
1902
+ this.step = undefined;
1903
+ this.selection = undefined;
1904
+ this.tags = [];
1905
+ this.versionTags = [];
1906
+ }
1907
+ else {
1908
+ this.tags = result.chainTags;
1909
+ this.updateVersionTags();
1910
+ }
1911
+ }
1912
+ getNodeFeatures(id) {
1913
+ if (!this.step) {
1914
+ return [];
1915
+ }
1916
+ return (this.step.featureSet.nodeFeatures[this.step.outputTag + '_' + id] || []);
1917
+ }
1918
+ findNode(id) {
1919
+ if (!this.step) {
1920
+ return null;
1921
+ }
1922
+ for (let key of Object.keys(this._result.taggedNodes)) {
1923
+ const node = this._result.taggedNodes[key].find((n) => n.id === id);
1924
+ if (node) {
1925
+ return node;
1926
+ }
1927
+ }
1928
+ return null;
1929
+ }
1930
+ onStepCharPick(event) {
1931
+ const features = this.getNodeFeatures(event.char.id);
1932
+ const node = this.findNode(event.char.id);
1933
+ this.selection = `${event.char.label} (${node.sourceTag})`;
1934
+ this.selectionFeatures = [...features];
1935
+ }
1936
+ onStepRangePick(range) {
1937
+ if (range.run === 1) {
1938
+ // already handled by onStepCharPick
1939
+ return;
1940
+ }
1941
+ this.selection = range.at + '×' + range.run;
1942
+ const end = range.at + range.run;
1943
+ const features = [];
1944
+ const tagNodes = this._result.taggedNodes[this.tag.value];
1945
+ for (let node of tagNodes) {
1946
+ // if in range, intersect features
1947
+ if (node.id >= range.at && node.id < end) {
1948
+ const nodeFeatures = this.getNodeFeatures(node.id);
1949
+ if (node.id === range.at) {
1950
+ for (let f of nodeFeatures) {
1951
+ features.push(f);
1952
+ }
1953
+ }
1954
+ else {
1955
+ // features = intersection of features and charFeatures
1956
+ features.splice(0, features.length, ...features.filter((f) => nodeFeatures.some((cf) => cf.name === f.name)));
1957
+ }
1958
+ }
1959
+ }
1960
+ this.selectionFeatures = features;
1961
+ }
1962
+ onStepChange(step) {
1963
+ this.tag.setValue(step.outputTag);
1964
+ this.selectionFeatures = [];
1965
+ }
1966
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: ChainResultViewComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
1967
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: ChainResultViewComponent, isStandalone: true, selector: "gve-chain-result-view", inputs: { result: "result" }, outputs: { stepPick: "stepPick" }, ngImport: i0, template: "@if (result) {\r\n<div id=\"container\">\r\n <div id=\"bar\" class=\"form-row\">\r\n <!-- version -->\r\n <mat-form-field *ngIf=\"versionTags?.length\">\r\n <mat-label>version</mat-label>\r\n <mat-select [formControl]=\"versionTag\">\r\n <mat-option [value]=\"null\">-</mat-option>\r\n <mat-option *ngFor=\"let t of versionTags\" [value]=\"t\">{{\r\n t\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <!-- tag -->\r\n <mat-form-field *ngIf=\"tags?.length\">\r\n <mat-label>tag</mat-label>\r\n <mat-select [formControl]=\"tag\">\r\n <mat-option *ngFor=\"let t of tags\" [value]=\"t\">{{ t }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- step -->\r\n @if (step) {\r\n <div id=\"step\">\r\n <!-- text -->\r\n <div id=\"text\">\r\n <gve-base-text-view\r\n [text]=\"result.taggedNodes[step.outputTag]\"\r\n (charPick)=\"onStepCharPick($event)\"\r\n (rangePick)=\"onStepRangePick($event)\"\r\n />\r\n </div>\r\n <!-- features -->\r\n <div id=\"feats\" class=\"form-row-top\">\r\n <div id=\"g-feats\">\r\n <div class=\"feat-header\">{{ step.outputTag }}</div>\r\n <gve-feature-set-view [features]=\"step.featureSet.features\" />\r\n </div>\r\n <div id=\"n-feats\">\r\n @if (selectionFeatures.length) {\r\n <div class=\"feat-header\">{{ selection }}</div>\r\n <gve-feature-set-view [features]=\"selectionFeatures\" />\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n\r\n <!-- steps map -->\r\n <div id=\"map\">\r\n <gve-steps-map\r\n [steps]=\"result.steps\"\r\n [selectedStep]=\"step\"\r\n (selectedStepChange)=\"onStepChange($event)\"\r\n />\r\n </div>\r\n</div>\r\n}\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.form-row-top{display:flex;gap:8px;align-items:start;flex-wrap:wrap}div#container{display:grid;grid-template-rows:auto 1fr;grid-template-columns:3fr 1fr;grid-template-areas:\"bar map\" \"step map\";gap:8px}div#bar{grid-area:bar}div#map{grid-area:map}div#step{grid-area:step}.feat-header{background-color:#3e92cc;color:#fff;text-align:center;border:1px solid #3e92cc;border-top-left-radius:4px;border-top-right-radius:4px}@media only screen and (max-width: 959px){div#container{grid-template-columns:1fr;grid-template-areas:\"bar\" \"step\"}#map{display:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: FeatureSetViewComponent, selector: "gve-feature-set-view", inputs: ["features", "featNames", "featValues", "minFilterCount"] }, { kind: "component", type: StepsMapComponent, selector: "gve-steps-map", inputs: ["steps", "selectedStep", "textFontSize"], outputs: ["selectedStepChange"] }, { kind: "component", type: BaseTextViewComponent, selector: "gve-base-text-view", inputs: ["defaultColor", "defaultBorderColor", "selectionColor", "hasLineNumber", "text"], outputs: ["charPick", "rangePick"] }] }); }
1968
+ }
1969
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: ChainResultViewComponent, decorators: [{
1970
+ type: Component,
1971
+ args: [{ selector: 'gve-chain-result-view', standalone: true, imports: [
1972
+ CommonModule,
1973
+ ReactiveFormsModule,
1974
+ MatButtonModule,
1975
+ MatFormFieldModule,
1976
+ MatIconModule,
1977
+ MatSelectModule,
1978
+ FeatureSetViewComponent,
1979
+ StepsMapComponent,
1980
+ BaseTextViewComponent,
1981
+ ], template: "@if (result) {\r\n<div id=\"container\">\r\n <div id=\"bar\" class=\"form-row\">\r\n <!-- version -->\r\n <mat-form-field *ngIf=\"versionTags?.length\">\r\n <mat-label>version</mat-label>\r\n <mat-select [formControl]=\"versionTag\">\r\n <mat-option [value]=\"null\">-</mat-option>\r\n <mat-option *ngFor=\"let t of versionTags\" [value]=\"t\">{{\r\n t\r\n }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <!-- tag -->\r\n <mat-form-field *ngIf=\"tags?.length\">\r\n <mat-label>tag</mat-label>\r\n <mat-select [formControl]=\"tag\">\r\n <mat-option *ngFor=\"let t of tags\" [value]=\"t\">{{ t }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- step -->\r\n @if (step) {\r\n <div id=\"step\">\r\n <!-- text -->\r\n <div id=\"text\">\r\n <gve-base-text-view\r\n [text]=\"result.taggedNodes[step.outputTag]\"\r\n (charPick)=\"onStepCharPick($event)\"\r\n (rangePick)=\"onStepRangePick($event)\"\r\n />\r\n </div>\r\n <!-- features -->\r\n <div id=\"feats\" class=\"form-row-top\">\r\n <div id=\"g-feats\">\r\n <div class=\"feat-header\">{{ step.outputTag }}</div>\r\n <gve-feature-set-view [features]=\"step.featureSet.features\" />\r\n </div>\r\n <div id=\"n-feats\">\r\n @if (selectionFeatures.length) {\r\n <div class=\"feat-header\">{{ selection }}</div>\r\n <gve-feature-set-view [features]=\"selectionFeatures\" />\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n\r\n <!-- steps map -->\r\n <div id=\"map\">\r\n <gve-steps-map\r\n [steps]=\"result.steps\"\r\n [selectedStep]=\"step\"\r\n (selectedStepChange)=\"onStepChange($event)\"\r\n />\r\n </div>\r\n</div>\r\n}\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}.form-row-top{display:flex;gap:8px;align-items:start;flex-wrap:wrap}div#container{display:grid;grid-template-rows:auto 1fr;grid-template-columns:3fr 1fr;grid-template-areas:\"bar map\" \"step map\";gap:8px}div#bar{grid-area:bar}div#map{grid-area:map}div#step{grid-area:step}.feat-header{background-color:#3e92cc;color:#fff;text-align:center;border:1px solid #3e92cc;border-top-left-radius:4px;border-top-right-radius:4px}@media only screen and (max-width: 959px){div#container{grid-template-columns:1fr;grid-template-areas:\"bar\" \"step\"}#map{display:none}}\n"] }]
1982
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { result: [{
1983
+ type: Input
1984
+ }], stepPick: [{
1985
+ type: Output
1986
+ }] } });
1987
+
1988
+ class LnHeightsEditorComponent {
1989
+ get lineCount() {
1990
+ return this._lineCount;
1991
+ }
1992
+ set lineCount(value) {
1993
+ if (this._lineCount === value)
1994
+ return;
1995
+ this._lineCount = value;
1996
+ this.lineNumbers = Array.from({ length: value }, (_, i) => i + 1);
1997
+ }
1998
+ get heights() {
1999
+ return this._heights;
2000
+ }
2001
+ set heights(value) {
2002
+ if (this._heights === value)
2003
+ return;
2004
+ this._heights = value || undefined;
2005
+ }
2006
+ constructor(formBuilder) {
2007
+ this._lineCount = 0;
2008
+ this.heightsChange = new EventEmitter();
2009
+ this.lineNumbers = [];
2010
+ this.lineNumber = formBuilder.control(0, { nonNullable: true });
2011
+ this.height = formBuilder.control(0, { nonNullable: true });
2012
+ }
2013
+ ngOnInit() {
2014
+ this._subs = [];
2015
+ // update heights[ln] when height changes and emit heightsChange
2016
+ this._subs.push(this.height.valueChanges
2017
+ .pipe(distinctUntilChanged(), debounceTime(200))
2018
+ .subscribe((value) => {
2019
+ if (!this._heights)
2020
+ return;
2021
+ this._heights[this.lineNumber.value] = value;
2022
+ this.heightsChange.emit(this._heights);
2023
+ }));
2024
+ // update height when line number changes
2025
+ this._subs.push(this.lineNumber.valueChanges
2026
+ .pipe(distinctUntilChanged(), debounceTime(200))
2027
+ .subscribe((value) => {
2028
+ if (!this._heights)
2029
+ return;
2030
+ this.height.setValue(this._heights[value] || 0);
2031
+ }));
2032
+ }
2033
+ ngOnDestroy() {
2034
+ this._subs?.forEach((sub) => sub.unsubscribe());
2035
+ }
2036
+ reset() {
2037
+ this._heights = undefined;
2038
+ this.heightsChange.emit(undefined);
2039
+ }
2040
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: LnHeightsEditorComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
2041
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: LnHeightsEditorComponent, isStandalone: true, selector: "gve-ln-heights-editor", inputs: { lineCount: "lineCount", heights: "heights" }, outputs: { heightsChange: "heightsChange" }, ngImport: i0, template: "@if (lineNumbers.length) {\r\n<div class=\"form-row\">\r\n <!-- line number -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>line</mat-label>\r\n <mat-select [formControl]=\"lineNumber\">\r\n <mat-option *ngFor=\"let n of lineNumbers\" [value]=\"n\">\r\n {{ n }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!-- height -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>height</mat-label>\r\n <input matInput type=\"number\" [formControl]=\"height\" min=\"0\" />\r\n </mat-form-field>\r\n\r\n <!-- reset button -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"reset()\"\r\n matTooltip=\"Remove all the heights\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n</div>\r\n}\r\n", styles: [".input-nr{width:5em}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
2042
+ }
2043
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: LnHeightsEditorComponent, decorators: [{
2044
+ type: Component,
2045
+ args: [{ selector: 'gve-ln-heights-editor', standalone: true, imports: [
2046
+ CommonModule,
2047
+ ReactiveFormsModule,
2048
+ MatButtonModule,
2049
+ MatFormFieldModule,
2050
+ MatIconModule,
2051
+ MatInputModule,
2052
+ MatSelectModule,
2053
+ MatTooltipModule,
2054
+ ], template: "@if (lineNumbers.length) {\r\n<div class=\"form-row\">\r\n <!-- line number -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>line</mat-label>\r\n <mat-select [formControl]=\"lineNumber\">\r\n <mat-option *ngFor=\"let n of lineNumbers\" [value]=\"n\">\r\n {{ n }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!-- height -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>height</mat-label>\r\n <input matInput type=\"number\" [formControl]=\"height\" min=\"0\" />\r\n </mat-form-field>\r\n\r\n <!-- reset button -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"reset()\"\r\n matTooltip=\"Remove all the heights\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n</div>\r\n}\r\n", styles: [".input-nr{width:5em}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"] }]
2055
+ }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { lineCount: [{
2056
+ type: Input
2057
+ }], heights: [{
2058
+ type: Input
2059
+ }], heightsChange: [{
2060
+ type: Output
2061
+ }] } });
2062
+
2063
+ /**
2064
+ * Service to interact with the GVE API.
2065
+ */
2066
+ class GveApiService {
2067
+ constructor(_http, _error, _env) {
2068
+ this._http = _http;
2069
+ this._error = _error;
2070
+ this._env = _env;
2071
+ }
2072
+ /**
2073
+ * Parse the specified text into operations. Each operation is a line
2074
+ * of the text.
2075
+ * @param text The text to parse.
2076
+ * @returns The operations.
2077
+ */
2078
+ parseOperations(text) {
2079
+ return this._http
2080
+ .post(`${this._env.get('apiUrl')}text/operations/parse`, {
2081
+ text,
2082
+ })
2083
+ .pipe(catchError(this._error.handleError));
2084
+ }
2085
+ /**
2086
+ * Run operations on the specified text.
2087
+ *
2088
+ * @param text The base text.
2089
+ * @param operations The operations to run.
2090
+ * @returns Result wrapper.
2091
+ */
2092
+ runOperations(text, operations) {
2093
+ return this._http
2094
+ .post(`${this._env.get('apiUrl')}text/operations/run`, {
2095
+ text,
2096
+ operations,
2097
+ })
2098
+ .pipe(catchError(this._error.handleError));
2099
+ }
2100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: GveApiService, deps: [{ token: i1$1.HttpClient }, { token: i2$1.ErrorService }, { token: i2$1.EnvService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2101
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: GveApiService, providedIn: 'root' }); }
2102
+ }
2103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: GveApiService, decorators: [{
2104
+ type: Injectable,
2105
+ args: [{
2106
+ providedIn: 'root',
2107
+ }]
2108
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.ErrorService }, { type: i2$1.EnvService }] });
2109
+
2110
+ const VIEW_TITLE = 'preview';
2111
+ /**
2112
+ * A component to edit a text snapshot.
2113
+ */
2114
+ class SnapshotEditorComponent {
2115
+ /**
2116
+ * The snapshot to edit.
2117
+ */
2118
+ get snapshot() {
2119
+ return this._snapshot;
2120
+ }
2121
+ set snapshot(value) {
2122
+ if (this._snapshot === value) {
2123
+ return;
2124
+ }
2125
+ this._snapshot = value || undefined;
2126
+ this.updateForm(this._snapshot);
2127
+ this.updateViewData();
2128
+ }
2129
+ constructor(formBuilder, _api, _dialogService, _snackbar) {
2130
+ this._api = _api;
2131
+ this._dialogService = _dialogService;
2132
+ this._snackbar = _snackbar;
2133
+ /**
2134
+ * Emitted when the user saves the edited snapshot.
2135
+ */
2136
+ this.snapshotChange = new EventEmitter();
2137
+ /**
2138
+ * Emitted when the user cancels the snapshot editing.
2139
+ */
2140
+ this.snapshotCancel = new EventEmitter();
2141
+ this.editedOpIndex = -1;
2142
+ this.opTypeMap = {
2143
+ 0: 'replace',
2144
+ 1: 'delete',
2145
+ 2: 'addBefore',
2146
+ 3: 'addAfter',
2147
+ 4: 'moveBefore',
2148
+ 5: 'moveAfter',
2149
+ 6: 'swap',
2150
+ 7: 'annotate',
2151
+ };
2152
+ this.lineCount = 0;
2153
+ this.viewTitle = VIEW_TITLE;
2154
+ this.rulers = true;
2155
+ // general
2156
+ this.width = new FormControl(800, { nonNullable: true });
2157
+ this.height = new FormControl(600, { nonNullable: true });
2158
+ this.style = new FormControl(null);
2159
+ // base text
2160
+ this.baseText = new FormControl([], {
2161
+ nonNullable: true,
2162
+ validators: [Validators.required],
2163
+ });
2164
+ this.offsetX = new FormControl(0, { nonNullable: true });
2165
+ this.offsetY = new FormControl(0, { nonNullable: true });
2166
+ this.lineHeightOffset = new FormControl(DEFAULT_SVG_BASE_TEXT_OPTIONS.lineHeightOffset, { nonNullable: true });
2167
+ this.lnHeights = new FormControl(null);
2168
+ this.charSpacingOffset = new FormControl(0, { nonNullable: true });
2169
+ this.spcWidthOffset = new FormControl(0, { nonNullable: true });
2170
+ this.textStyle = new FormControl(null);
2171
+ // operations
2172
+ this.operations = new FormControl([], {
2173
+ nonNullable: true,
2174
+ });
2175
+ this.inputOps = new FormControl(null);
2176
+ this.opStyle = new FormControl(null);
2177
+ // image
2178
+ this.imageUrl = new FormControl(null);
2179
+ this.imageOpacity = new FormControl(1, { nonNullable: true });
2180
+ this.imageX = new FormControl(0, { nonNullable: true });
2181
+ this.imageY = new FormControl(0, { nonNullable: true });
2182
+ this.imageWidth = new FormControl(0, { nonNullable: true });
2183
+ this.imageHeight = new FormControl(0, { nonNullable: true });
2184
+ this.defs = new FormControl(null);
2185
+ this.form = formBuilder.group({
2186
+ width: this.width,
2187
+ height: this.height,
2188
+ style: this.style,
2189
+ baseText: this.baseText,
2190
+ offsetX: this.offsetX,
2191
+ offsetY: this.offsetY,
2192
+ lineHeightOffset: this.lineHeightOffset,
2193
+ lnHeights: this.lnHeights,
2194
+ charSpacingOffset: this.charSpacingOffset,
2195
+ spcWidthOffset: this.spcWidthOffset,
2196
+ textStyle: this.textStyle,
2197
+ operations: this.operations,
2198
+ inputOps: this.inputOps,
2199
+ opStyle: this.opStyle,
2200
+ // image
2201
+ imageUrl: this.imageUrl,
2202
+ imageOpacity: this.imageOpacity,
2203
+ imageX: this.imageX,
2204
+ imageY: this.imageY,
2205
+ imageWidth: this.imageWidth,
2206
+ imageHeight: this.imageHeight,
2207
+ defs: this.defs,
2208
+ });
2209
+ }
2210
+ ngOnInit() {
2211
+ if (this.batchOps) {
2212
+ this.inputOps.setValue(this.batchOps);
2213
+ this.parseOperations();
2214
+ }
2215
+ }
2216
+ updateViewData(newOperation, snapshot, title = VIEW_TITLE) {
2217
+ if (!snapshot) {
2218
+ snapshot = this.getSnapshot();
2219
+ }
2220
+ // update or add new operation in copy
2221
+ if (newOperation) {
2222
+ const index = snapshot.operations.findIndex((op) => op.id === newOperation.id);
2223
+ if (index > -1) {
2224
+ snapshot.operations.splice(index, 1, newOperation);
2225
+ }
2226
+ else {
2227
+ snapshot.operations.push(newOperation);
2228
+ }
2229
+ }
2230
+ // update view data
2231
+ this.viewTitle = title;
2232
+ this.visualInfo = undefined;
2233
+ this.viewData = {
2234
+ snapshot: snapshot,
2235
+ options: {
2236
+ // debug: true,
2237
+ delayedRender: true,
2238
+ showRulers: true,
2239
+ showGrid: true,
2240
+ panZoom: true,
2241
+ },
2242
+ };
2243
+ }
2244
+ updateForm(snapshot) {
2245
+ if (!snapshot) {
2246
+ this.form.reset();
2247
+ }
2248
+ else {
2249
+ this.width.setValue(snapshot.size.width);
2250
+ this.height.setValue(snapshot.size.height);
2251
+ this.style.setValue(snapshot.style || null);
2252
+ this.imageUrl.setValue(snapshot.image?.url || null);
2253
+ this.imageOpacity.setValue(snapshot.image?.opacity || 0);
2254
+ this.imageX.setValue(snapshot.image?.canvas?.x || 0);
2255
+ this.imageY.setValue(snapshot.image?.canvas?.y || 0);
2256
+ this.imageWidth.setValue(snapshot.image?.canvas?.width || 0);
2257
+ this.imageHeight.setValue(snapshot.image?.canvas?.height || 0);
2258
+ this.defs.setValue(snapshot.defs || null);
2259
+ this.baseText.setValue(snapshot.text);
2260
+ this.offsetX.setValue(snapshot.textOptions?.offset?.x || 0);
2261
+ this.offsetY.setValue(snapshot.textOptions?.offset?.y || 0);
2262
+ this.lineHeightOffset.setValue(snapshot.textOptions?.lineHeightOffset);
2263
+ this.lnHeights.setValue(snapshot.textOptions?.minLineHeights || null);
2264
+ this.charSpacingOffset.setValue(snapshot.textOptions?.charSpacingOffset);
2265
+ this.spcWidthOffset.setValue(snapshot.textOptions?.spcWidthOffset);
2266
+ this.textStyle.setValue(snapshot.textStyle || null);
2267
+ this.operations.setValue(snapshot.operations);
2268
+ this.inputOps.reset();
2269
+ this.opStyle.setValue(snapshot.opStyle || null);
2270
+ }
2271
+ this.form.markAsPristine();
2272
+ }
2273
+ editNewOperation() {
2274
+ this.editedOp = {
2275
+ id: '',
2276
+ type: 0,
2277
+ at: this.textRange?.at || 0,
2278
+ run: this.textRange?.run || 1,
2279
+ };
2280
+ this.editedOpIndex = -1;
2281
+ }
2282
+ editOperation(index) {
2283
+ this.editedOp = this.operations.value[index];
2284
+ this.editedOpIndex = index;
2285
+ }
2286
+ closeEditedOp() {
2287
+ this.editedOp = undefined;
2288
+ this.editedOpIndex = -1;
2289
+ }
2290
+ onOperationCancel() {
2291
+ this.closeEditedOp();
2292
+ }
2293
+ onOperationChange(op) {
2294
+ const operations = [...this.operations.value];
2295
+ if (this.editedOpIndex > -1) {
2296
+ operations.splice(this.editedOpIndex, 1, op);
2297
+ }
2298
+ else {
2299
+ operations.push(op);
2300
+ }
2301
+ this.operations.setValue(operations);
2302
+ this.operations.markAsDirty();
2303
+ this.operations.updateValueAndValidity();
2304
+ this.closeEditedOp();
2305
+ }
2306
+ deleteOperation(index) {
2307
+ this._dialogService
2308
+ .confirm('Confirm Deletion', `Delete operation "${this.operations.value[index].id}"?`)
2309
+ .subscribe((yes) => {
2310
+ if (yes) {
2311
+ if (this.resultOperationId === this.operations.value[index].id) {
2312
+ this.resultOperationId = undefined;
2313
+ }
2314
+ const operations = [...this.operations.value];
2315
+ operations.splice(index, 1);
2316
+ this.operations.setValue(operations);
2317
+ this.operations.markAsDirty();
2318
+ this.operations.updateValueAndValidity();
2319
+ }
2320
+ });
2321
+ }
2322
+ onTextChange(text) {
2323
+ this.baseText.setValue(text);
2324
+ this.baseText.updateValueAndValidity();
2325
+ this.baseText.markAsDirty();
2326
+ if (!text.length) {
2327
+ this.lineCount = 0;
2328
+ }
2329
+ else {
2330
+ this.lineCount = text.filter((c) => c.data === '\n').length + 1;
2331
+ }
2332
+ this.textRange = undefined;
2333
+ this.closeEditedOp();
2334
+ this.operations.reset();
2335
+ this.updateViewData();
2336
+ }
2337
+ onRangePick(range) {
2338
+ this.textRange = range;
2339
+ }
2340
+ parseOperations() {
2341
+ if (this.busy || !this.inputOps.value) {
2342
+ return;
2343
+ }
2344
+ this._dialogService
2345
+ .confirm('Confirm', 'Parse operations?')
2346
+ .subscribe((yes) => {
2347
+ if (yes) {
2348
+ this.busy = true;
2349
+ this.parseError = undefined;
2350
+ this._api.parseOperations(this.inputOps.value).subscribe({
2351
+ next: (wrapper) => {
2352
+ const operations = [...this.operations.value];
2353
+ operations.push(...wrapper.result);
2354
+ this.operations.setValue(operations);
2355
+ this.operations.markAsDirty();
2356
+ this.operations.updateValueAndValidity();
2357
+ this.updateViewData();
2358
+ },
2359
+ error: (error) => {
2360
+ this.parseError = error.message;
2361
+ },
2362
+ complete: () => {
2363
+ this.busy = false;
2364
+ },
2365
+ });
2366
+ }
2367
+ });
2368
+ }
2369
+ clearOperations() {
2370
+ this._dialogService
2371
+ .confirm('Confirm', 'Remove all operations?')
2372
+ .subscribe((yes) => {
2373
+ if (yes) {
2374
+ this.resultOperationId = undefined;
2375
+ this.operations.reset();
2376
+ this.operations.markAsDirty();
2377
+ this.operations.updateValueAndValidity();
2378
+ this.updateViewData();
2379
+ }
2380
+ });
2381
+ }
2382
+ onOperationPreview(operation) {
2383
+ this.updateViewData(operation);
2384
+ }
2385
+ runTo(index) {
2386
+ const snapshot = this.getSnapshot();
2387
+ if (!snapshot.text) {
2388
+ return;
2389
+ }
2390
+ const operations = this.operations.value.slice(0, index + 1);
2391
+ this.busy = true;
2392
+ this._api.runOperations(snapshot.text, operations).subscribe({
2393
+ next: (wrapper) => {
2394
+ if (wrapper.error) {
2395
+ this._snackbar.open(wrapper.error, 'OK');
2396
+ return;
2397
+ }
2398
+ this.result = wrapper.result;
2399
+ // TODO update view
2400
+ // this.updateViewData(
2401
+ // undefined,
2402
+ // snapshot,
2403
+ // this.operations.value[index].outputTag
2404
+ // );
2405
+ },
2406
+ error: (error) => {
2407
+ console.error(error);
2408
+ this._snackbar.open('Error running operations', 'OK');
2409
+ },
2410
+ complete: () => {
2411
+ this.busy = false;
2412
+ },
2413
+ });
2414
+ }
2415
+ onStepPick(step) {
2416
+ if (!this.result) {
2417
+ return;
2418
+ }
2419
+ this.resultOperationId = step.operation.id;
2420
+ // get snapshot for preview by updating its text and
2421
+ // removing operations past the last executed
2422
+ const stepNodes = this.result.taggedNodes[step.outputTag];
2423
+ // we always display the original base text, just updating
2424
+ // its nodes features to those of the picked step, and adding
2425
+ // new nodes if they are not in the original text. It is assumed
2426
+ // that these new nodes have a manually set position.
2427
+ const snapshot = this.getSnapshot();
2428
+ const nodes = deepCopy(snapshot.text);
2429
+ for (const sn of stepNodes) {
2430
+ const i = nodes.findIndex((n) => n.id === sn.id);
2431
+ if (i > -1) {
2432
+ nodes[i].features = sn.features;
2433
+ }
2434
+ else {
2435
+ nodes.push(sn);
2436
+ }
2437
+ }
2438
+ // find max ID in snapshot.text (=original) nodes,
2439
+ // so that any ID greater than it belongs to new nodes
2440
+ const maxOriginalId = snapshot.text.reduce((max, n) => Math.max(max, n.id), 0);
2441
+ // append nodes introduced before the picked step if any
2442
+ // (those introduced by the picked step have already been added)
2443
+ const stepIndex = this.result.steps.indexOf(step);
2444
+ for (let i = 0; i < stepIndex; i++) {
2445
+ const stepNodes = this.result.taggedNodes[this.result.steps[i].outputTag];
2446
+ for (const n of stepNodes) {
2447
+ if (n.id > maxOriginalId && !nodes.find((x) => x.id === n.id)) {
2448
+ nodes.push(n);
2449
+ }
2450
+ }
2451
+ }
2452
+ snapshot.text = nodes;
2453
+ const i = snapshot.operations.findIndex((o) => o.id === step.operation.id);
2454
+ if (i > -1) {
2455
+ snapshot.operations = snapshot.operations.slice(0, i + 1);
2456
+ }
2457
+ this.updateViewData(undefined, snapshot, step.outputTag);
2458
+ }
2459
+ onVisualEvent(event) {
2460
+ const d = event.detail;
2461
+ if (d.event.type === 'mouseover') {
2462
+ const visual = d.source;
2463
+ const sb = [];
2464
+ sb.push('#' + visual.id);
2465
+ sb.push(` (${visual.type})`);
2466
+ if (visual.data?.label) {
2467
+ sb.push(': ');
2468
+ sb.push(visual.data.label);
2469
+ }
2470
+ if (visual.data?.features?.length) {
2471
+ sb.push(visual.data.features
2472
+ .map((f) => `${f.name}=${f.value}`)
2473
+ .join('\n'));
2474
+ }
2475
+ this.visualInfo = sb.join('');
2476
+ }
2477
+ }
2478
+ onHeightsChange(heights) {
2479
+ this.lnHeights.setValue(heights || null);
2480
+ this.lnHeights.markAsDirty();
2481
+ this.lnHeights.updateValueAndValidity();
2482
+ }
2483
+ close() {
2484
+ this.snapshotCancel.emit();
2485
+ }
2486
+ onSnapshotRender(event) {
2487
+ this._renderer = event.detail.renderer;
2488
+ }
2489
+ toggleRulers() {
2490
+ if (!this._renderer) {
2491
+ return;
2492
+ }
2493
+ this.rulers = this._renderer.toggleRulers();
2494
+ }
2495
+ getSnapshot() {
2496
+ const snapshot = {
2497
+ size: {
2498
+ width: this.width.value,
2499
+ height: this.height.value,
2500
+ },
2501
+ style: this.style.value || undefined,
2502
+ defs: this.defs.value || undefined,
2503
+ text: this.baseText.value,
2504
+ textStyle: this.textStyle.value || undefined,
2505
+ textOptions: {
2506
+ lineHeightOffset: this.lineHeightOffset.value,
2507
+ minLineHeights: this.lnHeights.value || undefined,
2508
+ charSpacingOffset: this.charSpacingOffset.value,
2509
+ spcWidthOffset: this.spcWidthOffset.value,
2510
+ offset: {
2511
+ x: this.offsetX.value,
2512
+ y: this.offsetY.value,
2513
+ },
2514
+ },
2515
+ operations: this.operations.value,
2516
+ opStyle: this.opStyle.value || undefined,
2517
+ timelines: {}, // TODO
2518
+ };
2519
+ // image
2520
+ if (this.imageUrl.value) {
2521
+ snapshot.image = {
2522
+ url: this.imageUrl.value,
2523
+ opacity: this.imageOpacity.value || undefined,
2524
+ };
2525
+ if (this.imageX.value ||
2526
+ this.imageY.value ||
2527
+ this.imageWidth.value ||
2528
+ this.imageHeight.value) {
2529
+ snapshot.image.canvas = {
2530
+ x: this.imageX.value,
2531
+ y: this.imageY.value,
2532
+ width: this.imageWidth.value,
2533
+ height: this.imageHeight.value,
2534
+ };
2535
+ }
2536
+ }
2537
+ return snapshot;
2538
+ }
2539
+ save() {
2540
+ if (this.form.invalid) {
2541
+ return;
2542
+ }
2543
+ this._snapshot = this.getSnapshot();
2544
+ this.snapshotChange.emit(this._snapshot);
2545
+ }
2546
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SnapshotEditorComponent, deps: [{ token: i1.FormBuilder }, { token: GveApiService }, { token: i2$2.DialogService }, { token: i4$3.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
2547
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: SnapshotEditorComponent, isStandalone: true, selector: "gve-snapshot-editor", inputs: { snapshot: "snapshot", batchOps: "batchOps" }, outputs: { snapshotChange: "snapshotChange", snapshotCancel: "snapshotCancel" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <mat-tab-group>\r\n <!-- text -->\r\n <mat-tab label=\"text\">\r\n <mat-expansion-panel [expanded]=\"!baseText.value\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title> base text </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <gve-base-text-editor\r\n [text]=\"baseText.value\"\r\n (textChange)=\"onTextChange($event)\"\r\n />\r\n <fieldset>\r\n <div class=\"form-row\">\r\n <!-- offsetX -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>X offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"offsetX\"\r\n placeholder=\"X offset\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- offsetY -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>Y offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"offsetY\"\r\n placeholder=\"Y offset\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- lineHeightOffset -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>ln h-offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"lineHeightOffset\"\r\n placeholder=\"ln h-offset\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- charSpacingOffset -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>char spacing</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"charSpacingOffset\"\r\n placeholder=\"char spacing\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- spcWidthOffset -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>spc w-offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"spcWidthOffset\"\r\n placeholder=\"spc w-offset\"\r\n />\r\n </mat-form-field>\r\n <!-- minLineHeights -->\r\n <div>\r\n <gve-ln-heights-editor\r\n [lineCount]=\"lineCount\"\r\n [heights]=\"lnHeights.value\"\r\n (heightsChange)=\"onHeightsChange($event)\"\r\n />\r\n </div>\r\n </div>\r\n <!-- textStyle -->\r\n <div>\r\n <mat-form-field class=\"long-text\" appearance=\"outline\">\r\n <mat-label>text style</mat-label>\r\n <textarea\r\n matInput\r\n [formControl]=\"textStyle\"\r\n placeholder=\"text style\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n </fieldset>\r\n </mat-expansion-panel>\r\n </mat-tab>\r\n\r\n <!-- operations -->\r\n <mat-tab label=\"operations\">\r\n <div id=\"snapshot-container\">\r\n <div id=\"general\">\r\n <div class=\"form-row\">\r\n <!-- width -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>width</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"width\"\r\n placeholder=\"width\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- height -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>height</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"height\"\r\n placeholder=\"height\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- add op -->\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n [disabled]=\"!baseText.value\"\r\n (click)=\"editNewOperation()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> operation\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- ops -->\r\n <div id=\"ops\">\r\n <!-- operations list -->\r\n @if (operations.value.length) {\r\n <table id=\"list\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>ID</th>\r\n <th>type</th>\r\n <th>at</th>\r\n <th>run</th>\r\n <th>value</th>\r\n <th>itag</th>\r\n <th>otag</th>\r\n <th>gid</th>\r\n <th>feats</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (operation of operations.value; track operation.id; let\r\n index=$index) {\r\n <tr [ngClass]=\"{ selected: operation.id === resultOperationId }\">\r\n <td class=\"fit-width\">\r\n <!-- edit -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n (click)=\"editOperation(index)\"\r\n matTooltip=\"Edit operation\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteOperation(index)\"\r\n matTooltip=\"Delete operation\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n <!-- run to -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"runTo(index)\"\r\n matTooltip=\"Run to this operation\"\r\n >\r\n <mat-icon class=\"mat-accent\">subscriptions</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ operation.id }}</td>\r\n <td>{{ operation.type | flatLookup : opTypeMap }}</td>\r\n <td>{{ operation.at }}</td>\r\n <td>{{ operation.run }}</td>\r\n <td>{{ operation.value }}</td>\r\n <td>{{ operation.inputTag }}</td>\r\n <td>{{ operation.outputTag }}</td>\r\n <td>{{ operation.groupId }}</td>\r\n <td>{{ operation.features?.length }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n\r\n <!-- operation editor -->\r\n <mat-expansion-panel [expanded]=\"editedOp\" [disabled]=\"!editedOp\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>operation {{ editedOp?.id }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <fieldset>\r\n <gve-chain-operation-editor\r\n [operation]=\"editedOp\"\r\n (operationCancel)=\"onOperationCancel()\"\r\n (operationChange)=\"onOperationChange($event)\"\r\n (operationPreview)=\"onOperationPreview($event)\"\r\n />\r\n </fieldset>\r\n </mat-expansion-panel>\r\n\r\n <div>\r\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"busy\" />\r\n </div>\r\n\r\n <!-- opStyle -->\r\n <div id=\"opStyle\">\r\n <mat-form-field class=\"long-text\" appearance=\"outline\">\r\n <mat-label>operations style</mat-label>\r\n <textarea\r\n matInput\r\n [formControl]=\"opStyle\"\r\n placeholder=\"operations style\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- batch ops -->\r\n <div>\r\n <mat-expansion-panel>\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>batch operations</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <fieldset>\r\n <div id=\"batch-container\">\r\n <div id=\"batch-input\">\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>operations</mat-label>\r\n <textarea\r\n class=\"code\"\r\n matInput\r\n [formControl]=\"inputOps\"\r\n placeholder=\"operations\"\r\n rows=\"8\"\r\n spellcheck=\"false\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n class=\"mat-warn\"\r\n mat-flat-button\r\n matTooltip=\"Remove all the operations\"\r\n [disabled]=\"!operations.value.length || busy\"\r\n (click)=\"clearOperations()\"\r\n >\r\n clear\r\n </button>\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Parse text and add results to the operations\"\r\n [disabled]=\"!inputOps.value || busy\"\r\n (click)=\"parseOperations()\"\r\n >\r\n batch add\r\n </button>\r\n @if (parseError) {\r\n <span class=\"error\">{{ parseError }}</span>\r\n }\r\n </div>\r\n </div>\r\n <div id=\"batch-help\">\r\n <ul>\r\n <li>\r\n <strong>replace</strong>:\r\n <code>ATxRUN<strong>=</strong>\"VALUE\"</code>\r\n </li>\r\n <li>\r\n <strong>delete</strong>:\r\n <code>ATxRUN<strong>-</strong></code>\r\n </li>\r\n <li>\r\n <strong>add-before</strong>:\r\n <code>ATxRUN<strong>+[</strong>\"VALUE\"</code>\r\n </li>\r\n <li>\r\n <strong>add-after</strong>:\r\n <code>ATxRUN<strong>+]</strong>\"VALUE\"</code>\r\n </li>\r\n <li>\r\n <strong>move-before</strong>:\r\n <code>ATxRUN<strong>&gt;[</strong>TO</code>\r\n </li>\r\n <li>\r\n <strong>move-after</strong>:\r\n <code>ATxRUN<strong>&gt;]</strong>TO</code>\r\n </li>\r\n <li>\r\n <strong>swap</strong>:\r\n <code>ATxRUN<strong>&lt;&gt;</strong>TOxRUN</code>\r\n </li>\r\n <li>\r\n <strong>annotate</strong>:\r\n <code>ATxRUN<strong>:</strong></code>\r\n </li>\r\n </ul>\r\n <p>For all the operations:</p>\r\n <ul>\r\n <li>\r\n prefix <code>(ITAG:OTAG)</code> to define input and/or\r\n output tags, separated by colon.\r\n </li>\r\n <li>\r\n prepend <code>&#x40;</code> to AT to use character\r\n indexes (0-N) rather than IDs.\r\n </li>\r\n <li>RUN (where applicable) defaults to 1.</li>\r\n <li>\r\n append features like <code>[NAME OPERATOR VALUE]</code>,\r\n separated by space, where:\r\n </li>\r\n <ol>\r\n <li>\r\n NAME is an arbitrary string. Prefixes:\r\n <code>*</code>=global features, <code>!</code>=remove\r\n feature (no value). Suffixes:\r\n <code>^</code>=short-lived (like\r\n <code>*version^=alpha</code>).\r\n </li>\r\n <li>\r\n OPERATOR is <code>=</code> (multiple),\r\n <code>:=</code> (single),\r\n <code>==</code> (first-single).\r\n </li>\r\n <li>\r\n VALUE is a string. If it includes spaces, wrap it in\r\n <code>\"\"</code>.\r\n </li>\r\n </ol>\r\n </ul>\r\n </div>\r\n </div>\r\n </fieldset>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n\r\n <!-- result -->\r\n @if (result) {\r\n <fieldset id=\"result\">\r\n <legend>result</legend>\r\n <gve-chain-result-view\r\n [result]=\"result\"\r\n (stepPick)=\"onStepPick($event)\"\r\n />\r\n </fieldset>\r\n }\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- image -->\r\n <mat-tab label=\"image\">\r\n <div id=\"image\">\r\n <div id=\"image-ctl\">\r\n <!-- url -->\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>URL</mat-label>\r\n <input matInput [formControl]=\"imageUrl\" />\r\n </mat-form-field>\r\n <div class=\"form-row\">\r\n <!-- x -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>X</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"imageX\"\r\n placeholder=\"X\"\r\n />\r\n </mat-form-field>\r\n <!-- y -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>Y</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"imageY\"\r\n placeholder=\"Y\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"form-row\">\r\n <!-- width -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>width</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"imageWidth\"\r\n />\r\n </mat-form-field>\r\n <!-- height -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>height</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"imageHeight\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <!-- defs -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>defs</mat-label>\r\n <textarea matInput [formControl]=\"defs\" rows=\"3\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div id=\"image-view\">\r\n @if (imageUrl.value) {\r\n <img alt=\"background\" [src]=\"imageUrl.value\" width=\"600\" />\r\n }\r\n </div>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- preview -->\r\n @if (snapshot) {\r\n <fieldset id=\"preview\">\r\n <legend class=\"button-row\">\r\n <span>{{ viewTitle }}</span>\r\n <button\r\n color=\"primary\"\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Refresh preview\"\r\n (click)=\"updateViewData()\"\r\n >\r\n <mat-icon class=\"mat-primary\">refresh</mat-icon>\r\n </button>\r\n </legend>\r\n <gve-snapshot-view\r\n [data]=\"viewData\"\r\n (snapshotRender)=\"onSnapshotRender($any($event))\"\r\n (visualEvent)=\"onVisualEvent($any($event))\"\r\n />\r\n <div>\r\n <mat-button-toggle\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Toggle rulers\"\r\n [checked]=\"rulers\"\r\n (change)=\"toggleRulers()\"\r\n >\r\n <mat-icon class=\"mat-primary\">straighten</mat-icon>\r\n </mat-button-toggle>\r\n </div>\r\n @if (visualInfo) {\r\n <div id=\"visual-info\">{{ visualInfo }}</div>\r\n }\r\n </fieldset>\r\n }\r\n\r\n <!--buttons -->\r\n <div class=\"form-row-center\">\r\n <button\r\n type=\"button\"\r\n class=\"mat-warn\"\r\n mat-flat-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"close()\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n close\r\n </button>\r\n <button\r\n type=\"submit\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Save changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n save\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row-center{display:flex;gap:8px;align-items:center;justify-content:center;flex-wrap:wrap}.form-row,.form-row-center *{flex:0 0 auto}.button-row{display:flex;align-items:center;flex-wrap:wrap}.button-row *{flex:0 0 auto}.long-text{width:100%;max-width:800px}#text-range{margin:8px;border:1px solid silver;border-radius:6px;padding:6px}mat-expansion-panel{margin:8px 0}div#visual-info{font-size:95%;color:#909090;margin:8px}div#batch-container{display:grid;gap:16px;grid-template-rows:auto;grid-template-columns:1fr auto;grid-template-areas:\"batch-input batch-help\"}div#batch-input{grid-area:batch-input}div#batch-help{grid-area:batch-help}div#batch-help strong{color:#ff8c00}#list{margin:8px 0}#opStyle{margin-top:8px}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}tr.selected{background-color:#c8d9eb}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin:8px 0}legend{color:#909090}.error{color:red}.input-nr{width:6em}.full-width{width:100%}.code{font-family:Courier New,Courier,monospace}div#image{display:grid;gap:8px;grid-template-rows:auto;grid-template-columns:1fr auto;grid-template-areas:\"image-ctl image-view\"}div#image-ctl{grid-area:image-ctl}div#image-view{grid-area:image-view}@media only screen and (max-width: 959px){div#batch-container{grid-template-columns:1fr;grid-template-areas:\"batch-input\" \"batch-help\"}div#image{grid-template-columns:1fr;grid-template-areas:\"image-ctl\" \"image-view\"}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatButtonToggleModule }, { kind: "component", type: i7.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i4$1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i4$1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i4$1.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i12.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "ngmodule", type: MatTabsModule }, { kind: "component", type: i13.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i13.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: NgToolsModule }, { kind: "pipe", type: i2$1.FlatLookupPipe, name: "flatLookup" }, { kind: "component", type: BaseTextEditorComponent, selector: "gve-base-text-editor", inputs: ["text"], outputs: ["textChange"] }, { kind: "component", type: ChainOperationEditorComponent, selector: "gve-chain-operation-editor", inputs: ["operation", "snapshot", "hidePreview"], outputs: ["operationChange", "operationPreview", "operationCancel"] }, { kind: "component", type: ChainResultViewComponent, selector: "gve-chain-result-view", inputs: ["result"], outputs: ["stepPick"] }, { kind: "component", type: LnHeightsEditorComponent, selector: "gve-ln-heights-editor", inputs: ["lineCount", "heights"], outputs: ["heightsChange"] }] }); }
2548
+ }
2549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: SnapshotEditorComponent, decorators: [{
2550
+ type: Component,
2551
+ args: [{ selector: 'gve-snapshot-editor', standalone: true, imports: [
2552
+ CommonModule,
2553
+ FormsModule,
2554
+ ReactiveFormsModule,
2555
+ MatButtonModule,
2556
+ MatButtonToggleModule,
2557
+ MatCheckboxModule,
2558
+ MatExpansionModule,
2559
+ MatFormFieldModule,
2560
+ MatIconModule,
2561
+ MatInputModule,
2562
+ MatProgressBarModule,
2563
+ MatSnackBarModule,
2564
+ MatTabsModule,
2565
+ MatTooltipModule,
2566
+ NgToolsModule,
2567
+ BaseTextEditorComponent,
2568
+ BaseTextViewComponent,
2569
+ ChainOperationEditorComponent,
2570
+ ChainResultViewComponent,
2571
+ LnHeightsEditorComponent,
2572
+ ], schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "<form [formGroup]=\"form\" (submit)=\"save()\">\r\n <mat-tab-group>\r\n <!-- text -->\r\n <mat-tab label=\"text\">\r\n <mat-expansion-panel [expanded]=\"!baseText.value\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title> base text </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <gve-base-text-editor\r\n [text]=\"baseText.value\"\r\n (textChange)=\"onTextChange($event)\"\r\n />\r\n <fieldset>\r\n <div class=\"form-row\">\r\n <!-- offsetX -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>X offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"offsetX\"\r\n placeholder=\"X offset\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- offsetY -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>Y offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"offsetY\"\r\n placeholder=\"Y offset\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- lineHeightOffset -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>ln h-offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"lineHeightOffset\"\r\n placeholder=\"ln h-offset\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- charSpacingOffset -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>char spacing</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"charSpacingOffset\"\r\n placeholder=\"char spacing\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- spcWidthOffset -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>spc w-offset</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"spcWidthOffset\"\r\n placeholder=\"spc w-offset\"\r\n />\r\n </mat-form-field>\r\n <!-- minLineHeights -->\r\n <div>\r\n <gve-ln-heights-editor\r\n [lineCount]=\"lineCount\"\r\n [heights]=\"lnHeights.value\"\r\n (heightsChange)=\"onHeightsChange($event)\"\r\n />\r\n </div>\r\n </div>\r\n <!-- textStyle -->\r\n <div>\r\n <mat-form-field class=\"long-text\" appearance=\"outline\">\r\n <mat-label>text style</mat-label>\r\n <textarea\r\n matInput\r\n [formControl]=\"textStyle\"\r\n placeholder=\"text style\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n </fieldset>\r\n </mat-expansion-panel>\r\n </mat-tab>\r\n\r\n <!-- operations -->\r\n <mat-tab label=\"operations\">\r\n <div id=\"snapshot-container\">\r\n <div id=\"general\">\r\n <div class=\"form-row\">\r\n <!-- width -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>width</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"width\"\r\n placeholder=\"width\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- height -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>height</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"height\"\r\n placeholder=\"height\"\r\n />\r\n </mat-form-field>\r\n\r\n <!-- add op -->\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n [disabled]=\"!baseText.value\"\r\n (click)=\"editNewOperation()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> operation\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- ops -->\r\n <div id=\"ops\">\r\n <!-- operations list -->\r\n @if (operations.value.length) {\r\n <table id=\"list\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>ID</th>\r\n <th>type</th>\r\n <th>at</th>\r\n <th>run</th>\r\n <th>value</th>\r\n <th>itag</th>\r\n <th>otag</th>\r\n <th>gid</th>\r\n <th>feats</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (operation of operations.value; track operation.id; let\r\n index=$index) {\r\n <tr [ngClass]=\"{ selected: operation.id === resultOperationId }\">\r\n <td class=\"fit-width\">\r\n <!-- edit -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n (click)=\"editOperation(index)\"\r\n matTooltip=\"Edit operation\"\r\n >\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <!-- delete -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteOperation(index)\"\r\n matTooltip=\"Delete operation\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete</mat-icon>\r\n </button>\r\n <!-- run to -->\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"accent\"\r\n (click)=\"runTo(index)\"\r\n matTooltip=\"Run to this operation\"\r\n >\r\n <mat-icon class=\"mat-accent\">subscriptions</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ operation.id }}</td>\r\n <td>{{ operation.type | flatLookup : opTypeMap }}</td>\r\n <td>{{ operation.at }}</td>\r\n <td>{{ operation.run }}</td>\r\n <td>{{ operation.value }}</td>\r\n <td>{{ operation.inputTag }}</td>\r\n <td>{{ operation.outputTag }}</td>\r\n <td>{{ operation.groupId }}</td>\r\n <td>{{ operation.features?.length }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n\r\n <!-- operation editor -->\r\n <mat-expansion-panel [expanded]=\"editedOp\" [disabled]=\"!editedOp\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>operation {{ editedOp?.id }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <fieldset>\r\n <gve-chain-operation-editor\r\n [operation]=\"editedOp\"\r\n (operationCancel)=\"onOperationCancel()\"\r\n (operationChange)=\"onOperationChange($event)\"\r\n (operationPreview)=\"onOperationPreview($event)\"\r\n />\r\n </fieldset>\r\n </mat-expansion-panel>\r\n\r\n <div>\r\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"busy\" />\r\n </div>\r\n\r\n <!-- opStyle -->\r\n <div id=\"opStyle\">\r\n <mat-form-field class=\"long-text\" appearance=\"outline\">\r\n <mat-label>operations style</mat-label>\r\n <textarea\r\n matInput\r\n [formControl]=\"opStyle\"\r\n placeholder=\"operations style\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- batch ops -->\r\n <div>\r\n <mat-expansion-panel>\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>batch operations</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <fieldset>\r\n <div id=\"batch-container\">\r\n <div id=\"batch-input\">\r\n <div>\r\n <mat-form-field class=\"full-width\">\r\n <mat-label>operations</mat-label>\r\n <textarea\r\n class=\"code\"\r\n matInput\r\n [formControl]=\"inputOps\"\r\n placeholder=\"operations\"\r\n rows=\"8\"\r\n spellcheck=\"false\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"form-row\">\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n class=\"mat-warn\"\r\n mat-flat-button\r\n matTooltip=\"Remove all the operations\"\r\n [disabled]=\"!operations.value.length || busy\"\r\n (click)=\"clearOperations()\"\r\n >\r\n clear\r\n </button>\r\n <button\r\n type=\"button\"\r\n color=\"primary\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Parse text and add results to the operations\"\r\n [disabled]=\"!inputOps.value || busy\"\r\n (click)=\"parseOperations()\"\r\n >\r\n batch add\r\n </button>\r\n @if (parseError) {\r\n <span class=\"error\">{{ parseError }}</span>\r\n }\r\n </div>\r\n </div>\r\n <div id=\"batch-help\">\r\n <ul>\r\n <li>\r\n <strong>replace</strong>:\r\n <code>ATxRUN<strong>=</strong>\"VALUE\"</code>\r\n </li>\r\n <li>\r\n <strong>delete</strong>:\r\n <code>ATxRUN<strong>-</strong></code>\r\n </li>\r\n <li>\r\n <strong>add-before</strong>:\r\n <code>ATxRUN<strong>+[</strong>\"VALUE\"</code>\r\n </li>\r\n <li>\r\n <strong>add-after</strong>:\r\n <code>ATxRUN<strong>+]</strong>\"VALUE\"</code>\r\n </li>\r\n <li>\r\n <strong>move-before</strong>:\r\n <code>ATxRUN<strong>&gt;[</strong>TO</code>\r\n </li>\r\n <li>\r\n <strong>move-after</strong>:\r\n <code>ATxRUN<strong>&gt;]</strong>TO</code>\r\n </li>\r\n <li>\r\n <strong>swap</strong>:\r\n <code>ATxRUN<strong>&lt;&gt;</strong>TOxRUN</code>\r\n </li>\r\n <li>\r\n <strong>annotate</strong>:\r\n <code>ATxRUN<strong>:</strong></code>\r\n </li>\r\n </ul>\r\n <p>For all the operations:</p>\r\n <ul>\r\n <li>\r\n prefix <code>(ITAG:OTAG)</code> to define input and/or\r\n output tags, separated by colon.\r\n </li>\r\n <li>\r\n prepend <code>&#x40;</code> to AT to use character\r\n indexes (0-N) rather than IDs.\r\n </li>\r\n <li>RUN (where applicable) defaults to 1.</li>\r\n <li>\r\n append features like <code>[NAME OPERATOR VALUE]</code>,\r\n separated by space, where:\r\n </li>\r\n <ol>\r\n <li>\r\n NAME is an arbitrary string. Prefixes:\r\n <code>*</code>=global features, <code>!</code>=remove\r\n feature (no value). Suffixes:\r\n <code>^</code>=short-lived (like\r\n <code>*version^=alpha</code>).\r\n </li>\r\n <li>\r\n OPERATOR is <code>=</code> (multiple),\r\n <code>:=</code> (single),\r\n <code>==</code> (first-single).\r\n </li>\r\n <li>\r\n VALUE is a string. If it includes spaces, wrap it in\r\n <code>\"\"</code>.\r\n </li>\r\n </ol>\r\n </ul>\r\n </div>\r\n </div>\r\n </fieldset>\r\n </mat-expansion-panel>\r\n </div>\r\n </div>\r\n\r\n <!-- result -->\r\n @if (result) {\r\n <fieldset id=\"result\">\r\n <legend>result</legend>\r\n <gve-chain-result-view\r\n [result]=\"result\"\r\n (stepPick)=\"onStepPick($event)\"\r\n />\r\n </fieldset>\r\n }\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- image -->\r\n <mat-tab label=\"image\">\r\n <div id=\"image\">\r\n <div id=\"image-ctl\">\r\n <!-- url -->\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>URL</mat-label>\r\n <input matInput [formControl]=\"imageUrl\" />\r\n </mat-form-field>\r\n <div class=\"form-row\">\r\n <!-- x -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>X</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"imageX\"\r\n placeholder=\"X\"\r\n />\r\n </mat-form-field>\r\n <!-- y -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>Y</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"imageY\"\r\n placeholder=\"Y\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div class=\"form-row\">\r\n <!-- width -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>width</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"imageWidth\"\r\n />\r\n </mat-form-field>\r\n <!-- height -->\r\n <mat-form-field class=\"input-nr\">\r\n <mat-label>height</mat-label>\r\n <input\r\n matInput\r\n type=\"number\"\r\n min=\"0\"\r\n [formControl]=\"imageHeight\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <!-- defs -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>defs</mat-label>\r\n <textarea matInput [formControl]=\"defs\" rows=\"3\"></textarea>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div id=\"image-view\">\r\n @if (imageUrl.value) {\r\n <img alt=\"background\" [src]=\"imageUrl.value\" width=\"600\" />\r\n }\r\n </div>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- preview -->\r\n @if (snapshot) {\r\n <fieldset id=\"preview\">\r\n <legend class=\"button-row\">\r\n <span>{{ viewTitle }}</span>\r\n <button\r\n color=\"primary\"\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Refresh preview\"\r\n (click)=\"updateViewData()\"\r\n >\r\n <mat-icon class=\"mat-primary\">refresh</mat-icon>\r\n </button>\r\n </legend>\r\n <gve-snapshot-view\r\n [data]=\"viewData\"\r\n (snapshotRender)=\"onSnapshotRender($any($event))\"\r\n (visualEvent)=\"onVisualEvent($any($event))\"\r\n />\r\n <div>\r\n <mat-button-toggle\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Toggle rulers\"\r\n [checked]=\"rulers\"\r\n (change)=\"toggleRulers()\"\r\n >\r\n <mat-icon class=\"mat-primary\">straighten</mat-icon>\r\n </mat-button-toggle>\r\n </div>\r\n @if (visualInfo) {\r\n <div id=\"visual-info\">{{ visualInfo }}</div>\r\n }\r\n </fieldset>\r\n }\r\n\r\n <!--buttons -->\r\n <div class=\"form-row-center\">\r\n <button\r\n type=\"button\"\r\n class=\"mat-warn\"\r\n mat-flat-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"close()\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n close\r\n </button>\r\n <button\r\n type=\"submit\"\r\n class=\"mat-primary\"\r\n mat-flat-button\r\n matTooltip=\"Save changes\"\r\n [disabled]=\"form.invalid || form.pristine\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n save\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row-center{display:flex;gap:8px;align-items:center;justify-content:center;flex-wrap:wrap}.form-row,.form-row-center *{flex:0 0 auto}.button-row{display:flex;align-items:center;flex-wrap:wrap}.button-row *{flex:0 0 auto}.long-text{width:100%;max-width:800px}#text-range{margin:8px;border:1px solid silver;border-radius:6px;padding:6px}mat-expansion-panel{margin:8px 0}div#visual-info{font-size:95%;color:#909090;margin:8px}div#batch-container{display:grid;gap:16px;grid-template-rows:auto;grid-template-columns:1fr auto;grid-template-areas:\"batch-input batch-help\"}div#batch-input{grid-area:batch-input}div#batch-help{grid-area:batch-help}div#batch-help strong{color:#ff8c00}#list{margin:8px 0}#opStyle{margin-top:8px}table{width:100%;border-collapse:collapse}th{color:#909090;font-weight:400;text-align:left;background-color:#e1e0e0}th,td{padding:4px;border-bottom:1px solid silver}tbody tr:nth-child(2n){background-color:#e8e8e8}td.fit-width{width:1px;white-space:nowrap}tr.selected{background-color:#c8d9eb}fieldset{border:1px solid silver;border-radius:6px;padding:8px;margin:8px 0}legend{color:#909090}.error{color:red}.input-nr{width:6em}.full-width{width:100%}.code{font-family:Courier New,Courier,monospace}div#image{display:grid;gap:8px;grid-template-rows:auto;grid-template-columns:1fr auto;grid-template-areas:\"image-ctl image-view\"}div#image-ctl{grid-area:image-ctl}div#image-view{grid-area:image-view}@media only screen and (max-width: 959px){div#batch-container{grid-template-columns:1fr;grid-template-areas:\"batch-input\" \"batch-help\"}div#image{grid-template-columns:1fr;grid-template-areas:\"image-ctl\" \"image-view\"}}\n"] }]
2573
+ }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: GveApiService }, { type: i2$2.DialogService }, { type: i4$3.MatSnackBar }], propDecorators: { snapshot: [{
2574
+ type: Input
2575
+ }], batchOps: [{
2576
+ type: Input
2577
+ }], snapshotChange: [{
2578
+ type: Output
2579
+ }], snapshotCancel: [{
2580
+ type: Output
2581
+ }] } });
2582
+
2583
+ /*
2584
+ * Public API Surface of gve-core
2585
+ */
2586
+
2587
+ /**
2588
+ * Generated bundle index. Do not edit.
2589
+ */
2590
+
2591
+ export { AnimationTimelineComponent, AnimationTweenComponent, AnimationVarsComponent, BaseTextCharComponent, BaseTextEditorComponent, BaseTextViewComponent, ChainOperationEditorComponent, ChainResultViewComponent, FeatureEditorComponent, FeatureSetEditorComponent, FeatureSetViewComponent, GveApiService, LnHeightsEditorComponent, OperationSourceEditorComponent, SettingsService, SimpleTreeComponent, SnapshotEditorComponent, StepsMapComponent };
2592
+ //# sourceMappingURL=myrmidon-gve-core.mjs.map