@myrmidon/cadmus-layer-demo 14.0.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ViewChild, Component } from '@angular/core';
2
+ import { signal, ViewChild, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import { MatCard, MatCardHeader, MatCardContent } from '@angular/material/card';
@@ -16,49 +16,48 @@ import { TokenLocation } from '@myrmidon/cadmus-core';
16
16
  class LayerDemoComponent {
17
17
  _textLayerService;
18
18
  _resultElement;
19
- locations;
20
- result;
21
- userLocation;
19
+ locations = signal([], ...(ngDevMode ? [{ debugName: "locations" }] : []));
20
+ result = signal('', ...(ngDevMode ? [{ debugName: "result" }] : []));
21
+ userLocation = signal(undefined, ...(ngDevMode ? [{ debugName: "userLocation" }] : []));
22
+ textSize = signal(14, ...(ngDevMode ? [{ debugName: "textSize" }] : []));
22
23
  // form
23
24
  rendition;
24
25
  text;
25
26
  location;
26
- textSize;
27
27
  constructor(formBuilder, _textLayerService) {
28
28
  this._textLayerService = _textLayerService;
29
- this.textSize = 14;
30
- this.locations = [];
31
29
  this.text = formBuilder.control('alpha beta\ngamma\ndelta epsilon waw\nzeta');
32
30
  this.location = formBuilder.control('1.2@2x2');
33
31
  this.rendition = formBuilder.group({
34
32
  text: this.text,
35
33
  location: this.location,
36
34
  });
37
- this.result = '';
38
35
  }
39
36
  makeLarger() {
40
- const size = this.textSize + 2;
37
+ const size = this.textSize() + 2;
41
38
  if (size > 24) {
42
39
  return;
43
40
  }
44
- this.textSize = size;
41
+ this.textSize.set(size);
45
42
  }
46
43
  makeSmaller() {
47
- const size = this.textSize - 2;
44
+ const size = this.textSize() - 2;
48
45
  if (size < 12) {
49
46
  return;
50
47
  }
51
- this.textSize = size;
48
+ this.textSize.set(size);
52
49
  }
53
50
  removeOverlaps(loc) {
54
- for (let i = this.locations.length - 1; i > -1; i--) {
55
- if (loc === this.locations[i]) {
51
+ const locations = [...this.locations()];
52
+ for (let i = locations.length - 1; i > -1; i--) {
53
+ if (loc === locations[i]) {
56
54
  continue;
57
55
  }
58
- if (loc.overlaps(this.locations[i])) {
59
- this.locations.splice(i, 1);
56
+ if (loc.overlaps(locations[i])) {
57
+ locations.splice(i, 1);
60
58
  }
61
59
  }
60
+ this.locations.set(locations);
62
61
  }
63
62
  addLocation() {
64
63
  if (!this.location.value) {
@@ -68,56 +67,58 @@ class LayerDemoComponent {
68
67
  if (!loc) {
69
68
  return;
70
69
  }
70
+ const locations = [...this.locations()];
71
71
  let done = false;
72
- for (let i = 0; i < this.locations.length && !done; i++) {
73
- const n = loc.compareTo(this.locations[i]);
72
+ for (let i = 0; i < locations.length && !done; i++) {
73
+ const n = loc.compareTo(locations[i]);
74
74
  // nothing to do if equal
75
75
  if (n === 0) {
76
76
  return;
77
77
  }
78
78
  // insert before nearest bigger sort value
79
79
  if (n < 0) {
80
- this.locations.splice(i, 0, loc);
80
+ locations.splice(i, 0, loc);
81
81
  done = true;
82
82
  }
83
83
  }
84
84
  // append if not yet inserted
85
85
  if (!done) {
86
- this.locations.push(loc);
86
+ locations.push(loc);
87
87
  }
88
+ this.locations.set(locations);
88
89
  // remove all the overlapping locations
89
90
  this.removeOverlaps(loc);
90
91
  }
91
92
  removeLocation(loc) {
92
- const i = this.locations.indexOf(loc);
93
+ const i = this.locations().indexOf(loc);
93
94
  if (i > -1) {
94
- this.locations.splice(i, 1);
95
+ const locations = [...this.locations()];
96
+ locations.splice(i, 1);
97
+ this.locations.set(locations);
95
98
  }
96
99
  }
97
100
  clearLocations() {
98
- this.locations.length = 0;
101
+ this.locations.set([]);
99
102
  }
100
103
  render() {
101
104
  if (!this.text.value) {
102
105
  return;
103
106
  }
104
- this.result = this._textLayerService.render(this.text.value, this.locations);
107
+ this.result.set(this._textLayerService.render(this.text.value, this.locations()));
105
108
  }
106
109
  getLocationForNew() {
107
110
  if (!this.text.value) {
108
111
  return;
109
112
  }
110
- this.userLocation =
111
- this._textLayerService.getSelectedLocationForNew(this._textLayerService.getSelectedRange(), this.text.value) || undefined;
113
+ this.userLocation.set(this._textLayerService.getSelectedLocationForNew(this._textLayerService.getSelectedRange(), this.text.value) || undefined);
112
114
  }
113
115
  getLocationForEdit() {
114
- this.userLocation =
115
- this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
116
+ this.userLocation.set(this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined);
116
117
  }
117
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: LayerDemoComponent, deps: [{ token: i1.FormBuilder }, { token: i2.TextLayerService }], target: i0.ɵɵFactoryTarget.Component });
118
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: LayerDemoComponent, isStandalone: true, selector: "cadmus-layer-demo", viewQueries: [{ propertyName: "_resultElement", first: true, predicate: ["resultElem"], descendants: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Layered Text Demo</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <mat-label>base text</mat-label>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <mat-label>location</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n formControlName=\"location\"\r\n />\r\n <mat-hint>Y.X&#64;AxR</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon class=\"mat-primary\">play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n @for (loc of locations; track loc) {\r\n <tr>\r\n <td>\r\n <button mat-icon-button (click)=\"removeLocation(loc)\">\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize + 'px'\"\r\n [innerHtml]=\"result | safeHtml : 'html'\"\r\n id=\"result\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: ["textarea#text{min-width:300px;min-height:100px}:host ::ng-deep div#result{counter-reset:text-y-counter}:host ::ng-deep div#result p:before{content:counter(text-y-counter);counter-increment:text-y-counter;margin-right:6px;color:#a0a0a0}:host ::ng-deep span.fr{background-color:#ff0;border:1px solid silver;border-radius:6px}article{column-width:20em}\n"], dependencies: [{ kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { 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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
118
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: LayerDemoComponent, deps: [{ token: i1.FormBuilder }, { token: i2.TextLayerService }], target: i0.ɵɵFactoryTarget.Component });
119
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: LayerDemoComponent, isStandalone: true, selector: "cadmus-layer-demo", viewQueries: [{ propertyName: "_resultElement", first: true, predicate: ["resultElem"], descendants: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Layered Text Demo</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <mat-label>base text</mat-label>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <mat-label>location</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n formControlName=\"location\"\r\n />\r\n <mat-hint>Y.X&#64;AxR</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon class=\"mat-primary\">play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize() >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize() <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation() }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n @for (loc of locations(); track loc) {\r\n <tr>\r\n <td>\r\n <button mat-icon-button (click)=\"removeLocation(loc)\">\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize() + 'px'\"\r\n [innerHtml]=\"result() | safeHtml : 'html'\"\r\n id=\"result()\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result() }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: ["textarea#text{min-width:300px;min-height:100px}:host ::ng-deep div#result{counter-reset:text-y-counter}:host ::ng-deep div#result p:before{content:counter(text-y-counter);counter-increment:text-y-counter;margin-right:6px;color:#a0a0a0}:host ::ng-deep span.fr{background-color:#ff0;border:1px solid silver;border-radius:6px}article{column-width:20em}\n"], dependencies: [{ kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { 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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
119
120
  }
120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: LayerDemoComponent, decorators: [{
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: LayerDemoComponent, decorators: [{
121
122
  type: Component,
122
123
  args: [{ selector: 'cadmus-layer-demo', imports: [
123
124
  MatCard,
@@ -134,7 +135,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
134
135
  MatTooltip,
135
136
  MatIcon,
136
137
  SafeHtmlPipe,
137
- ], template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Layered Text Demo</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <mat-label>base text</mat-label>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <mat-label>location</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n formControlName=\"location\"\r\n />\r\n <mat-hint>Y.X&#64;AxR</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon class=\"mat-primary\">play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n @for (loc of locations; track loc) {\r\n <tr>\r\n <td>\r\n <button mat-icon-button (click)=\"removeLocation(loc)\">\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize + 'px'\"\r\n [innerHtml]=\"result | safeHtml : 'html'\"\r\n id=\"result\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: ["textarea#text{min-width:300px;min-height:100px}:host ::ng-deep div#result{counter-reset:text-y-counter}:host ::ng-deep div#result p:before{content:counter(text-y-counter);counter-increment:text-y-counter;margin-right:6px;color:#a0a0a0}:host ::ng-deep span.fr{background-color:#ff0;border:1px solid silver;border-radius:6px}article{column-width:20em}\n"] }]
138
+ ], template: "<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Layered Text Demo</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <mat-label>base text</mat-label>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <mat-label>location</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n formControlName=\"location\"\r\n />\r\n <mat-hint>Y.X&#64;AxR</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon class=\"mat-primary\">play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize() >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize() <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation() }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n @for (loc of locations(); track loc) {\r\n <tr>\r\n <td>\r\n <button mat-icon-button (click)=\"removeLocation(loc)\">\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize() + 'px'\"\r\n [innerHtml]=\"result() | safeHtml : 'html'\"\r\n id=\"result()\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result() }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: ["textarea#text{min-width:300px;min-height:100px}:host ::ng-deep div#result{counter-reset:text-y-counter}:host ::ng-deep div#result p:before{content:counter(text-y-counter);counter-increment:text-y-counter;margin-right:6px;color:#a0a0a0}:host ::ng-deep span.fr{background-color:#ff0;border:1px solid silver;border-radius:6px}article{column-width:20em}\n"] }]
138
139
  }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.TextLayerService }], propDecorators: { _resultElement: [{
139
140
  type: ViewChild,
140
141
  args: ['resultElem']
@@ -1 +1 @@
1
- {"version":3,"file":"myrmidon-cadmus-layer-demo.mjs","sources":["../../../../projects/myrmidon/cadmus-layer-demo/src/lib/layer-demo/layer-demo.component.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/lib/layer-demo/layer-demo.component.html","../../../../projects/myrmidon/cadmus-layer-demo/src/public-api.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/myrmidon-cadmus-layer-demo.ts"],"sourcesContent":["import { Component, ViewChild, ElementRef } from '@angular/core';\r\nimport {\r\n FormGroup,\r\n FormControl,\r\n FormBuilder,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n} from '@angular/forms';\r\n\r\nimport { MatCard, MatCardHeader, MatCardContent } from '@angular/material/card';\r\nimport { MatFormField, MatLabel, MatHint } from '@angular/material/form-field';\r\nimport { MatInput } from '@angular/material/input';\r\nimport { MatToolbar } from '@angular/material/toolbar';\r\nimport { MatIconButton } from '@angular/material/button';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\nimport { MatIcon } from '@angular/material/icon';\r\n\r\nimport { SafeHtmlPipe } from '@myrmidon/ngx-tools';\r\n\r\nimport { TextLayerService, TokenLocation } from '@myrmidon/cadmus-core';\r\n\r\n@Component({\r\n selector: 'cadmus-layer-demo',\r\n templateUrl: './layer-demo.component.html',\r\n styleUrls: ['./layer-demo.component.css'],\r\n imports: [\r\n MatCard,\r\n MatCardHeader,\r\n MatCardContent,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormField,\r\n MatLabel,\r\n MatInput,\r\n MatHint,\r\n MatToolbar,\r\n MatIconButton,\r\n MatTooltip,\r\n MatIcon,\r\n SafeHtmlPipe,\r\n ],\r\n})\r\nexport class LayerDemoComponent {\r\n @ViewChild('resultElem') _resultElement?: ElementRef;\r\n\r\n public locations: TokenLocation[];\r\n public result: string;\r\n public userLocation?: TokenLocation;\r\n // form\r\n public rendition: FormGroup;\r\n public text: FormControl<string | null>;\r\n public location: FormControl<string | null>;\r\n\r\n public textSize: number;\r\n\r\n constructor(\r\n formBuilder: FormBuilder,\r\n private _textLayerService: TextLayerService\r\n ) {\r\n this.textSize = 14;\r\n this.locations = [];\r\n this.text = formBuilder.control(\r\n 'alpha beta\\ngamma\\ndelta epsilon waw\\nzeta'\r\n );\r\n this.location = formBuilder.control('1.2@2x2');\r\n this.rendition = formBuilder.group({\r\n text: this.text,\r\n location: this.location,\r\n });\r\n this.result = '';\r\n }\r\n\r\n public makeLarger(): void {\r\n const size = this.textSize + 2;\r\n if (size > 24) {\r\n return;\r\n }\r\n this.textSize = size;\r\n }\r\n\r\n public makeSmaller(): void {\r\n const size = this.textSize - 2;\r\n if (size < 12) {\r\n return;\r\n }\r\n this.textSize = size;\r\n }\r\n\r\n private removeOverlaps(loc: TokenLocation): void {\r\n for (let i = this.locations.length - 1; i > -1; i--) {\r\n if (loc === this.locations[i]) {\r\n continue;\r\n }\r\n if (loc.overlaps(this.locations[i])) {\r\n this.locations.splice(i, 1);\r\n }\r\n }\r\n }\r\n\r\n public addLocation(): void {\r\n if (!this.location.value) {\r\n return;\r\n }\r\n const loc = TokenLocation.parse(this.location.value);\r\n if (!loc) {\r\n return;\r\n }\r\n\r\n let done = false;\r\n for (let i = 0; i < this.locations.length && !done; i++) {\r\n const n = loc.compareTo(this.locations[i]);\r\n // nothing to do if equal\r\n if (n === 0) {\r\n return;\r\n }\r\n // insert before nearest bigger sort value\r\n if (n < 0) {\r\n this.locations.splice(i, 0, loc);\r\n done = true;\r\n }\r\n }\r\n // append if not yet inserted\r\n if (!done) {\r\n this.locations.push(loc);\r\n }\r\n\r\n // remove all the overlapping locations\r\n this.removeOverlaps(loc);\r\n }\r\n\r\n public removeLocation(loc: TokenLocation): void {\r\n const i = this.locations.indexOf(loc);\r\n if (i > -1) {\r\n this.locations.splice(i, 1);\r\n }\r\n }\r\n\r\n public clearLocations(): void {\r\n this.locations.length = 0;\r\n }\r\n\r\n public render(): void {\r\n if (!this.text.value) {\r\n return;\r\n }\r\n this.result = this._textLayerService.render(\r\n this.text.value,\r\n this.locations\r\n );\r\n }\r\n\r\n public getLocationForNew(): void {\r\n if (!this.text.value) {\r\n return;\r\n }\r\n this.userLocation =\r\n this._textLayerService.getSelectedLocationForNew(\r\n this._textLayerService.getSelectedRange()!,\r\n this.text.value\r\n ) || undefined;\r\n }\r\n\r\n public getLocationForEdit(): void {\r\n this.userLocation =\r\n this._textLayerService.getSelectedLocationForEdit(\r\n this._textLayerService.getSelectedRange()!\r\n ) || undefined;\r\n }\r\n}\r\n","<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Layered Text Demo</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <mat-label>base text</mat-label>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <mat-label>location</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n formControlName=\"location\"\r\n />\r\n <mat-hint>Y.X&#64;AxR</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon class=\"mat-primary\">play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n @for (loc of locations; track loc) {\r\n <tr>\r\n <td>\r\n <button mat-icon-button (click)=\"removeLocation(loc)\">\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize + 'px'\"\r\n [innerHtml]=\"result | safeHtml : 'html'\"\r\n id=\"result\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n","/*\r\n * Public API Surface of cadmus-layer-demo\r\n */\r\n\r\nexport * from './lib/layer-demo/layer-demo.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MA0Ca,kBAAkB,CAAA;AAenB,IAAA,iBAAA;AAde,IAAA,cAAc;AAEhC,IAAA,SAAS;AACT,IAAA,MAAM;AACN,IAAA,YAAY;;AAEZ,IAAA,SAAS;AACT,IAAA,IAAI;AACJ,IAAA,QAAQ;AAER,IAAA,QAAQ;IAEf,WAAA,CACE,WAAwB,EAChB,iBAAmC,EAAA;QAAnC,IAAA,CAAA,iBAAiB,GAAjB,iBAAiB;AAEzB,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE;AAClB,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE;QACnB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,OAAO,CAC7B,4CAA4C,CAC7C;QACD,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;AAC9C,QAAA,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;AACxB,SAAA,CAAC;AACF,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE;;IAGX,UAAU,GAAA;AACf,QAAA,MAAM,IAAI,GAAG,IA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mBAAmB;wBACnB,YAAY;wBACZ,QAAQ;wBACR,QAAQ;wBACR,OAAO;wBACP,UAAU;wBACV,aAAa;wBACb,UAAU;wBACV,OAAO;wBACP,YAAY;AACb,qBAAA,EAAA,QAAA,EAAA,82KAAA,EAAA,MAAA,EAAA,CAAA,iWAAA,CAAA,EAAA;+GAGwB,cAAc,EAAA,CAAA;sBAAtC,SAAS;uBAAC,YAAY;;;AE3CzB;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"myrmidon-cadmus-layer-demo.mjs","sources":["../../../../projects/myrmidon/cadmus-layer-demo/src/lib/layer-demo/layer-demo.component.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/lib/layer-demo/layer-demo.component.html","../../../../projects/myrmidon/cadmus-layer-demo/src/public-api.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/myrmidon-cadmus-layer-demo.ts"],"sourcesContent":["import { Component, ViewChild, ElementRef, signal } from '@angular/core';\r\nimport {\r\n FormGroup,\r\n FormControl,\r\n FormBuilder,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n} from '@angular/forms';\r\n\r\nimport { MatCard, MatCardHeader, MatCardContent } from '@angular/material/card';\r\nimport { MatFormField, MatLabel, MatHint } from '@angular/material/form-field';\r\nimport { MatInput } from '@angular/material/input';\r\nimport { MatToolbar } from '@angular/material/toolbar';\r\nimport { MatIconButton } from '@angular/material/button';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\nimport { MatIcon } from '@angular/material/icon';\r\n\r\nimport { SafeHtmlPipe } from '@myrmidon/ngx-tools';\r\n\r\nimport { TextLayerService, TokenLocation } from '@myrmidon/cadmus-core';\r\n\r\n@Component({\r\n selector: 'cadmus-layer-demo',\r\n templateUrl: './layer-demo.component.html',\r\n styleUrls: ['./layer-demo.component.css'],\r\n imports: [\r\n MatCard,\r\n MatCardHeader,\r\n MatCardContent,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormField,\r\n MatLabel,\r\n MatInput,\r\n MatHint,\r\n MatToolbar,\r\n MatIconButton,\r\n MatTooltip,\r\n MatIcon,\r\n SafeHtmlPipe,\r\n ],\r\n})\r\nexport class LayerDemoComponent {\r\n @ViewChild('resultElem') _resultElement?: ElementRef;\r\n\r\n public readonly locations = signal<TokenLocation[]>([]);\r\n public readonly result = signal<string>('');\r\n public readonly userLocation = signal<TokenLocation | undefined>(undefined);\r\n public readonly textSize = signal<number>(14);\r\n\r\n // form\r\n public rendition: FormGroup;\r\n public text: FormControl<string | null>;\r\n public location: FormControl<string | null>;\r\n\r\n constructor(\r\n formBuilder: FormBuilder,\r\n private _textLayerService: TextLayerService\r\n ) {\r\n this.text = formBuilder.control(\r\n 'alpha beta\\ngamma\\ndelta epsilon waw\\nzeta'\r\n );\r\n this.location = formBuilder.control('1.2@2x2');\r\n this.rendition = formBuilder.group({\r\n text: this.text,\r\n location: this.location,\r\n });\r\n }\r\n\r\n public makeLarger(): void {\r\n const size = this.textSize() + 2;\r\n if (size > 24) {\r\n return;\r\n }\r\n this.textSize.set(size);\r\n }\r\n\r\n public makeSmaller(): void {\r\n const size = this.textSize() - 2;\r\n if (size < 12) {\r\n return;\r\n }\r\n this.textSize.set(size);\r\n }\r\n\r\n private removeOverlaps(loc: TokenLocation): void {\r\n const locations = [...this.locations()];\r\n\r\n for (let i = locations.length - 1; i > -1; i--) {\r\n if (loc === locations[i]) {\r\n continue;\r\n }\r\n if (loc.overlaps(locations[i])) {\r\n locations.splice(i, 1);\r\n }\r\n }\r\n\r\n this.locations.set(locations);\r\n }\r\n\r\n public addLocation(): void {\r\n if (!this.location.value) {\r\n return;\r\n }\r\n const loc = TokenLocation.parse(this.location.value);\r\n if (!loc) {\r\n return;\r\n }\r\n\r\n const locations = [...this.locations()];\r\n let done = false;\r\n for (let i = 0; i < locations.length && !done; i++) {\r\n const n = loc.compareTo(locations[i]);\r\n // nothing to do if equal\r\n if (n === 0) {\r\n return;\r\n }\r\n // insert before nearest bigger sort value\r\n if (n < 0) {\r\n locations.splice(i, 0, loc);\r\n done = true;\r\n }\r\n }\r\n // append if not yet inserted\r\n if (!done) {\r\n locations.push(loc);\r\n }\r\n this.locations.set(locations);\r\n\r\n // remove all the overlapping locations\r\n this.removeOverlaps(loc);\r\n }\r\n\r\n public removeLocation(loc: TokenLocation): void {\r\n const i = this.locations().indexOf(loc);\r\n if (i > -1) {\r\n const locations = [...this.locations()];\r\n locations.splice(i, 1);\r\n this.locations.set(locations);\r\n }\r\n }\r\n\r\n public clearLocations(): void {\r\n this.locations.set([]);\r\n }\r\n\r\n public render(): void {\r\n if (!this.text.value) {\r\n return;\r\n }\r\n this.result.set(\r\n this._textLayerService.render(this.text.value, this.locations())\r\n );\r\n }\r\n\r\n public getLocationForNew(): void {\r\n if (!this.text.value) {\r\n return;\r\n }\r\n this.userLocation.set(\r\n this._textLayerService.getSelectedLocationForNew(\r\n this._textLayerService.getSelectedRange()!,\r\n this.text.value\r\n ) || undefined\r\n );\r\n }\r\n\r\n public getLocationForEdit(): void {\r\n this.userLocation.set(\r\n this._textLayerService.getSelectedLocationForEdit(\r\n this._textLayerService.getSelectedRange()!\r\n ) || undefined\r\n );\r\n }\r\n}\r\n","<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Layered Text Demo</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <mat-label>base text</mat-label>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <mat-label>location</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n formControlName=\"location\"\r\n />\r\n <mat-hint>Y.X&#64;AxR</mat-hint>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon class=\"mat-warn\">delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon class=\"mat-primary\">play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize() >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize() <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation() }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n @for (loc of locations(); track loc) {\r\n <tr>\r\n <td>\r\n <button mat-icon-button (click)=\"removeLocation(loc)\">\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card appearance=\"outlined\">\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize() + 'px'\"\r\n [innerHtml]=\"result() | safeHtml : 'html'\"\r\n id=\"result()\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result() }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n","/*\r\n * Public API Surface of cadmus-layer-demo\r\n */\r\n\r\nexport * from './lib/layer-demo/layer-demo.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MA0Ca,kBAAkB,CAAA;AAenB,IAAA,iBAAA;AAde,IAAA,cAAc;AAEvB,IAAA,SAAS,GAAG,MAAM,CAAkB,EAAE,qDAAC;AACvC,IAAA,MAAM,GAAG,MAAM,CAAS,EAAE,kDAAC;AAC3B,IAAA,YAAY,GAAG,MAAM,CAA4B,SAAS,wDAAC;AAC3D,IAAA,QAAQ,GAAG,MAAM,CAAS,EAAE,oDAAC;;AAG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  import { ElementRef } from '@angular/core';
3
3
  import { FormGroup, FormControl, FormBuilder } from '@angular/forms';
4
4
  import { TokenLocation, TextLayerService } from '@myrmidon/cadmus-core';
@@ -6,13 +6,13 @@ import { TokenLocation, TextLayerService } from '@myrmidon/cadmus-core';
6
6
  declare class LayerDemoComponent {
7
7
  private _textLayerService;
8
8
  _resultElement?: ElementRef;
9
- locations: TokenLocation[];
10
- result: string;
11
- userLocation?: TokenLocation;
9
+ readonly locations: _angular_core.WritableSignal<TokenLocation[]>;
10
+ readonly result: _angular_core.WritableSignal<string>;
11
+ readonly userLocation: _angular_core.WritableSignal<TokenLocation | undefined>;
12
+ readonly textSize: _angular_core.WritableSignal<number>;
12
13
  rendition: FormGroup;
13
14
  text: FormControl<string | null>;
14
15
  location: FormControl<string | null>;
15
- textSize: number;
16
16
  constructor(formBuilder: FormBuilder, _textLayerService: TextLayerService);
17
17
  makeLarger(): void;
18
18
  makeSmaller(): void;
@@ -23,8 +23,8 @@ declare class LayerDemoComponent {
23
23
  render(): void;
24
24
  getLocationForNew(): void;
25
25
  getLocationForEdit(): void;
26
- static ɵfac: i0.ɵɵFactoryDeclaration<LayerDemoComponent, never>;
27
- static ɵcmp: i0.ɵɵComponentDeclaration<LayerDemoComponent, "cadmus-layer-demo", never, {}, {}, never, never, true, never>;
26
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<LayerDemoComponent, never>;
27
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<LayerDemoComponent, "cadmus-layer-demo", never, {}, {}, never, never, true, never>;
28
28
  }
29
29
 
30
30
  export { LayerDemoComponent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-layer-demo",
3
- "version": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "description": "Cadmus - text layer demo page.",
5
5
  "keywords": [
6
6
  "Cadmus"
@@ -16,9 +16,10 @@
16
16
  "peerDependencies": {
17
17
  "@angular/common": "^20.0.0",
18
18
  "@angular/core": "^20.0.0",
19
+ "@angular/material": "^20.0.0",
19
20
  "@myrmidon/ngx-tools": "^2.0.0",
20
- "@myrmidon/cadmus-core": "^12.0.1",
21
- "@myrmidon/cadmus-ui": "^14.0.0"
21
+ "@myrmidon/cadmus-core": "^12.0.2",
22
+ "@myrmidon/cadmus-ui": "^15.0.0"
22
23
  },
23
24
  "dependencies": {
24
25
  "tslib": "^2.3.0"