@myrmidon/cadmus-layer-demo 0.0.5 → 1.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CadmusLayerDemo
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.4.
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.0.
4
4
 
5
5
  ## Code scaffolding
6
6
 
@@ -21,4 +21,4 @@ Run `ng test cadmus-layer-demo` to execute the unit tests via [Karma](https://ka
21
21
 
22
22
  ## Further help
23
23
 
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,83 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
+ import { RouterModule } from '@angular/router';
5
+ import { MatButtonModule } from '@angular/material/button';
6
+ import { MatCardModule } from '@angular/material/card';
7
+ import { MatFormFieldModule } from '@angular/material/form-field';
8
+ import { MatIconModule } from '@angular/material/icon';
9
+ import { MatInputModule } from '@angular/material/input';
10
+ import { MatToolbarModule } from '@angular/material/toolbar';
11
+ import { MatTooltipModule } from '@angular/material/tooltip';
12
+ import { CadmusCoreModule } from '@myrmidon/cadmus-core';
13
+ import { CadmusUiModule } from '@myrmidon/cadmus-ui';
14
+ import { LayerDemoComponent } from './layer-demo/layer-demo.component';
15
+ import { NgToolsModule } from '@myrmidon/ng-tools';
16
+ import * as i0 from "@angular/core";
17
+ import * as i1 from "@angular/router";
18
+ // https://github.com/ng-packagr/ng-packagr/issues/778
19
+ export const RouterModuleForChild = RouterModule.forChild([
20
+ { path: '', pathMatch: 'full', component: LayerDemoComponent },
21
+ ]);
22
+ export class CadmusLayerDemoModule {
23
+ }
24
+ CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
25
+ CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, declarations: [LayerDemoComponent], imports: [CommonModule,
26
+ FormsModule,
27
+ ReactiveFormsModule, i1.RouterModule,
28
+ // material
29
+ MatButtonModule,
30
+ MatCardModule,
31
+ MatFormFieldModule,
32
+ MatIconModule,
33
+ MatInputModule,
34
+ MatToolbarModule,
35
+ MatTooltipModule,
36
+ // cadmus
37
+ NgToolsModule,
38
+ CadmusCoreModule,
39
+ CadmusUiModule], exports: [LayerDemoComponent] });
40
+ CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
41
+ CommonModule,
42
+ FormsModule,
43
+ ReactiveFormsModule,
44
+ RouterModuleForChild,
45
+ // material
46
+ MatButtonModule,
47
+ MatCardModule,
48
+ MatFormFieldModule,
49
+ MatIconModule,
50
+ MatInputModule,
51
+ MatToolbarModule,
52
+ MatTooltipModule,
53
+ // cadmus
54
+ NgToolsModule,
55
+ CadmusCoreModule,
56
+ CadmusUiModule,
57
+ ]] });
58
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
59
+ type: NgModule,
60
+ args: [{
61
+ imports: [
62
+ CommonModule,
63
+ FormsModule,
64
+ ReactiveFormsModule,
65
+ RouterModuleForChild,
66
+ // material
67
+ MatButtonModule,
68
+ MatCardModule,
69
+ MatFormFieldModule,
70
+ MatIconModule,
71
+ MatInputModule,
72
+ MatToolbarModule,
73
+ MatTooltipModule,
74
+ // cadmus
75
+ NgToolsModule,
76
+ CadmusCoreModule,
77
+ CadmusUiModule,
78
+ ],
79
+ declarations: [LayerDemoComponent],
80
+ exports: [LayerDemoComponent],
81
+ }]
82
+ }] });
83
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FkbXVzLWxheWVyLWRlbW8ubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbXlybWlkb24vY2FkbXVzLWxheWVyLWRlbW8vc3JjL2xpYi9jYWRtdXMtbGF5ZXItZGVtby5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDL0MsT0FBTyxFQUFFLFdBQVcsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUUvQyxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDM0QsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUN2RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDekQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDN0QsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFN0QsT0FBTyxFQUFFLGdC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ICAvLyBtYXRlcmlhbFxyXG4gICAgTWF0QnV0dG9uTW9kdWxlLFxyXG4gICAgTWF0Q2FyZE1vZHVsZSxcclxuICAgIE1hdEZvcm1GaWVsZE1vZHVsZSxcclxuICAgIE1hdEljb25Nb2R1bGUsXHJcbiAgICBNYXRJbnB1dE1vZHVsZSxcclxuICAgIE1hdFRvb2xiYXJNb2R1bGUsXHJcbiAgICBNYXRUb29sdGlwTW9kdWxlLFxyXG4gICAgLy8gY2FkbXVzXHJcbiAgICBOZ1Rvb2xzTW9kdWxlLFxyXG4gICAgQ2FkbXVzQ29yZU1vZHVsZSxcclxuICAgIENhZG11c1VpTW9kdWxlLFxyXG4gIF0sXHJcbiAgZGVjbGFyYXRpb25zOiBbTGF5ZXJEZW1vQ29tcG9uZW50XSxcclxuICBleHBvcnRzOiBbTGF5ZXJEZW1vQ29tcG9uZW50XSxcclxufSlcclxuZXhwb3J0IGNsYXNzIENhZG11c0xheWVyRGVtb01vZHVsZSB7fVxyXG4iXX0=
@@ -0,0 +1,108 @@
1
+ import { Component, ViewChild } from '@angular/core';
2
+ import { TokenLocation } from '@myrmidon/cadmus-core';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/forms";
5
+ import * as i2 from "@myrmidon/cadmus-core";
6
+ import * as i3 from "@angular/material/card";
7
+ import * as i4 from "@angular/material/form-field";
8
+ import * as i5 from "@angular/material/toolbar";
9
+ import * as i6 from "@angular/material/button";
10
+ import * as i7 from "@angular/material/icon";
11
+ import * as i8 from "@angular/material/input";
12
+ import * as i9 from "@angular/material/tooltip";
13
+ import * as i10 from "@angular/common";
14
+ import * as i11 from "@myrmidon/ng-tools";
15
+ export class LayerDemoComponent {
16
+ constructor(formBuilder, _textLayerService) {
17
+ this._textLayerService = _textLayerService;
18
+ this.textSize = 14;
19
+ this.locations = [];
20
+ this.text = formBuilder.control('alpha beta\ngamma\ndelta epsilon waw\nzeta');
21
+ this.location = formBuilder.control('1.2@2x2');
22
+ this.rendition = formBuilder.group({
23
+ text: this.text,
24
+ location: this.location,
25
+ });
26
+ this.result = '';
27
+ }
28
+ makeLarger() {
29
+ const size = this.textSize + 2;
30
+ if (size > 24) {
31
+ return;
32
+ }
33
+ this.textSize = size;
34
+ }
35
+ makeSmaller() {
36
+ const size = this.textSize - 2;
37
+ if (size < 12) {
38
+ return;
39
+ }
40
+ this.textSize = size;
41
+ }
42
+ removeOverlaps(loc) {
43
+ for (let i = this.locations.length - 1; i > -1; i--) {
44
+ if (loc === this.locations[i]) {
45
+ continue;
46
+ }
47
+ if (loc.overlaps(this.locations[i])) {
48
+ this.locations.splice(i, 1);
49
+ }
50
+ }
51
+ }
52
+ addLocation() {
53
+ if (!this.location.value) {
54
+ return;
55
+ }
56
+ const loc = TokenLocation.parse(this.location.value);
57
+ if (!loc) {
58
+ return;
59
+ }
60
+ let done = false;
61
+ for (let i = 0; i < this.locations.length && !done; i++) {
62
+ const n = loc.compareTo(this.locations[i]);
63
+ // nothing to do if equal
64
+ if (n === 0) {
65
+ return;
66
+ }
67
+ // insert before nearest bigger sort value
68
+ if (n < 0) {
69
+ this.locations.splice(i, 0, loc);
70
+ done = true;
71
+ }
72
+ }
73
+ // append if not yet inserted
74
+ if (!done) {
75
+ this.locations.push(loc);
76
+ }
77
+ // remove all the overlapping locations
78
+ this.removeOverlaps(loc);
79
+ }
80
+ removeLocation(loc) {
81
+ const i = this.locations.indexOf(loc);
82
+ if (i > -1) {
83
+ this.locations.splice(i, 1);
84
+ }
85
+ }
86
+ clearLocations() {
87
+ this.locations.length = 0;
88
+ }
89
+ render() {
90
+ this.result = this._textLayerService.render(this.text.value, this.locations);
91
+ }
92
+ getLocationForNew() {
93
+ this.userLocation = this._textLayerService.getSelectedLocationForNew(this._textLayerService.getSelectedRange(), this.text.value) || undefined;
94
+ }
95
+ getLocationForEdit() {
96
+ this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
97
+ }
98
+ }
99
+ LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LayerDemoComponent, deps: [{ token: i1.FormBuilder }, { token: i2.TextLayerService }], target: i0.ɵɵFactoryTarget.Component });
100
+ LayerDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: LayerDemoComponent, selector: "cadmus-layer-demo", viewQueries: [{ propertyName: "_resultElement", first: true, predicate: ["resultElem"], descendants: true }], ngImport: i0, template: "<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\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 <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\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 color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>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 <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\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"], components: [{ type: i3.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i3.MatCardHeader, selector: "mat-card-header" }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { 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]" }, { type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i9.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "safeHtml": i11.SafeHtmlPipe } });
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LayerDemoComponent, decorators: [{
102
+ type: Component,
103
+ args: [{ selector: 'cadmus-layer-demo', template: "<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\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 <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\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 color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>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 <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\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"] }]
104
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
105
+ type: ViewChild,
106
+ args: ['resultElem']
107
+ }] } });
108
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF5ZXItZGVtby5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9teXJtaWRvbi9jYWRtdXMtbGF5ZXItZGVtby9zcmMvbGliL2xheWVyLWRlbW8vbGF5ZXItZGVtby5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9teXJtaWRvbi9jYWRtdXMtbGF5ZXItZGVtby9zcmMvbGliL2xheWVyLWRlbW8vbGF5ZXItZGVtby5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFNBQVMsRUFBYyxNQUFNLGVBQWUsQ0FBQztBQUVqRSxPQUFPLEVBQW9CLGFBQWEsRUFBRSxNQUFNLHVCQUF1QixDQUFDOzs7Ozs7Ozs7Ozs7O0FBT3hFLE1BQU0sT0FBTyxrQkFBa0I7SUFhN0IsWUFDRSxXQUF3QixFQUNoQixpQkFBbUM7UUFBbkMsc0JBQWlCLEdBQWpCLGlCQUFpQixDQUFrQjtRQUUzQyxJQUFJLENBQUMsUUFBUSxHQUFHLEVBQUUsQ0FBQztRQUNuQixJQUFJLENBQUMsU0FBUyxHQUFHLEVBQUUsQ0FBQztRQUNwQixJQUFJLENBQUMsSUFBSSxHQUFHLFdBQVcsQ0FBQyxPQUFPLENBQzdCLDRDQUE0QyxDQUM3QyxDQUFDO1FBQ0YsSUFBSSxDQUFDLFFBQVEsR0FBRyxXQUFXLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQy9DLElBQUksQ0FBQyxTQUFTLEdBQUcsV0FBVyxDQUFDLEtBQUssQ0FBQztZQUNqQyxJQU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XRpb25cIiAobmdTdWJtaXQpPVwicmVuZGVyKClcIj5cclxuICAgICAgPGRpdj5cclxuICAgICAgICA8bWF0LWZvcm0tZmllbGQ+XHJcbiAgICAgICAgICA8dGV4dGFyZWFcclxuICAgICAgICAgICAgbWF0SW5wdXRcclxuICAgICAgICAgICAgdHlwZT1cInRleHRcIlxyXG4gICAgICAgICAgICBpZD1cInRleHRcIlxyXG4gICAgICAgICAgICBtYXhsZW5ndGg9XCIxMDAwXCJcclxuICAgICAgICAgICAgc3BlbGxjaGVjaz1cImZhbHNlXCJcclxuICAgICAgICAgICAgcGxhY2Vob2xkZXI9XCJlbnRlciB0aGUgYmFzZSB0ZXh0XCJcclxuICAgICAgICAgICAgZm9ybUNvbnRyb2xOYW1lPVwidGV4dFwiXHJcbiAgICAgICAgICA+PC90ZXh0YXJlYT5cclxuICAgICAgICA8L21hdC1mb3JtLWZpZWxkPlxyXG4gICAgICA8L2Rpdj5cclxuXHJcbiAgICAgIDxkaXY+XHJcbiAgICAgICAgPG1hdC1mb3JtLWZpZWxkPlxyXG4gICAgICAgICAgPGlucHV0XHJcbiAgICAgICAgICAgIG1hdElucHV0XHJcbiAgICAgICAgICAgIHR5cGU9XCJ0ZXh0XCJcclxuICAgICAgICAgICAgaWQ9XCJsb2NhdGlvblwiXHJcbiAgICAgICAgICAgIHJlcXVpcmVkXHJcbiAgICAgICAgICAgIHNwZWxsY2hlY2s9XCJmYWxzZVwiXHJcbiAgICAgICAgICAgIHBsYWNlaG9sZGVyPVwibG9jYXRpb246IFkuWEBBeFJcIlxyXG4gICAgICAgICAgICBmb3JtQ29udHJvbE5hbWU9XCJsb2NhdGlvblwiXHJcbiAgICAgICAgICAvPlxyXG4gICAgICAgIDwvbWF0LWZvcm0tZmllbGQ+XHJcbiAgICAgIDwvZGl2PlxyXG5cclxuICAgICAgPGRpdj5cclxuICAgICAgICA8bWF0LXRvb2xiYXI+XHJcbiAgICAgICAgICA8c3Bhbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJhZGRMb2NhdGlvbigpXCJcclxuICAgICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcclxuICAgICAgICAgICAgICBtYXRUb29sdGlwPVwiQWRkIHRoZSBzcGVjaWZpZWQgbG9jYXRpb25cIlxyXG4gICAgICAgICAgICA+XHJcbiAgICAgICAgICAgICAgPG1hdC1pY29uIHN0eWxlPVwiY29sb3I6ICM2NmNjNzVcIj5hZGRfY2lyY2xlPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgPC9idXR0b24+XHJcbiAgICAgICAgICAgIDxidXR0b25cclxuICAgICAgICAgICAgICBtYXQtaWNvbi1idXR0b25cclxuICAgICAgICAgICAgICBjb2xvcj1cIndhcm5cIlxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJjbGVhckxvY2F0aW9ucygpXCJcclxuICAgICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcclxuICAgICAgICAgICAgICBtYXRUb29sdGlwPVwiUmVtb3ZlIGFsbCB0aGUgbG9jYXRpb25zXCJcclxuICAgICAgICAgICAgPlxyXG4gICAgICAgICAgICAgIDxtYXQtaWNvbj5kZWxldGVfc3dlZXA8L21hdC1pY29uPlxyXG4gICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIGNvbG9yPVwicHJpbWFyeVwiXHJcbiAgICAgICAgICAgICAgdHlwZT1cInN1Ym1pdFwiXHJcbiAgICAgICAgICAgICAgbWF0VG9vbHRpcD1cIlJlbmRlciB0aGUgZGVjb3JhdGVkIGJhc2UgdGV4dFwiXHJcbiAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICA8bWF0LWljb24+cGxheV9jaXJjbGVfb3V0bGluZTwvbWF0LWljb24+XHJcbiAgICAgICAgICAgIDwvYnV0dG9uPlxyXG4gICAgICAgICAgICA8YnV0dG9uXHJcbiAgICAgICAgICAgICAgbWF0LWljb24tYnV0dG9uXHJcbiAgICAgICAgICAgICAgKGNsaWNrKT1cImdldExvY2F0aW9uRm9yTmV3KClcIlxyXG4gICAgICAgICAgICAgIHR5cGU9XCJidXR0b25cIlxyXG4gICAgICAgICAgICAgIG1hdFRvb2x0aXA9XCJHZXQgbG9jYXRpb24gZm9yIG5ldyBpdGVtXCJcclxuICAgICAgICAgICAgPlxyXG4gICAgICAgICAgICAgIDxtYXQtaWNvbj5wbGF5bGlzdF9hZGQ8L21hdC1pY29uPlxyXG4gICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJnZXRMb2NhdGlvbkZvckVkaXQoKVwiXHJcbiAgICAgICAgICAgICAgdHlwZT1cImJ1dHRvblwiXHJcbiAgICAgICAgICAgICAgbWF0VG9vbHRpcD1cIkdldCBsb2NhdGlvbiBmb3Igc2VsZWN0ZWQgaXRlbVwiXHJcbiAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICA8bWF0LWljb24+cGxheWxpc3RfYWRkX2NoZWNrPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgPC9idXR0b24+XHJcbiAgICAgICAgICAgIDxidXR0b25cclxuICAgICAgICAgICAgICBtYXQtaWNvbi1idXR0b25cclxuICAgICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcclxuICAgICAgICAgICAgICBtYXRUb29sdGlwPVwiTGFyZ2VyIHRleHRcIlxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJtYWtlTGFyZ2VyKClcIlxyXG4gICAgICAgICAgICAgIFtkaXNhYmxlZF09XCJ0ZXh0U2l6ZSA+PSAyNFwiXHJcbiAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICA8bWF0LWljb24+Zm9ybWF0X3NpemU8L21hdC1pY29uPlxyXG4gICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIHR5cGU9XCJidXR0b25cIlxyXG4gICAgICAgICAgICAgIG1hdFRvb2x0aXA9XCJTbWFsbGVyIHRleHRcIlxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJtYWtlU21hbGxlcigpXCJcclxuICAgICAgICAgICAgICBbZGlzYWJsZWRdPVwidGV4dFNpemUgPD0gMTJcIlxyXG4gICAgICAgICAgICA+XHJcbiAgICAgICAgICAgICAgPG1hdC1pY29uPnRleHRfZmllbGRzPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgPC9idXR0b24+XHJcbiAgICAgICAgICA8L3NwYW4+XHJcbiAgICAgICAgICA8c3BhbiBjbGFzcz1cInRiLWZpbGwtcmVtYWluaW5nLXNwYWNlXCI+PC9zcGFuPlxyXG4gICAgICAgICAgPHNwYW4+e3sgdXNlckxvY2F0aW9uIH19PC9zcGFuPlxyXG4gICAgICAgIDwvbWF0LXRvb2xiYXI+XHJcbiAgICAgIDwvZGl2PlxyXG5cclxuICAgICAgPHRhYmxlPlxyXG4gICAgICAgIDx0Ym9keT5cclxuICAgICAgICAgIDx0ciAqbmdGb3I9XCJsZXQgbG9jIG9mIGxvY2F0aW9uc1wiPlxyXG4gICAgICAgICAgICA8dGQ+XHJcbiAgICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgICAgbWF0LWljb24tYnV0dG9uXHJcbiAgICAgICAgICAgICAgICBjb2xvcj1cIndhcm5cIlxyXG4gICAgICAgICAgICAgICAgKGNsaWNrKT1cInJlbW92ZUxvY2F0aW9uKGxvYylcIlxyXG4gICAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICAgIDxtYXQtaWNvbj5yZW1vdmVfY2lyY2xlPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPC90ZD5cclxuICAgICAgICAgICAgPHRkPnt7IGxvYy50b1N0cmluZygpIH19PC90ZD5cclxuICAgICAgICAgIDwvdHI+XHJcbiAgICAgICAgPC90Ym9keT5cclxuICAgICAgPC90YWJsZT5cclxuICAgIDwvZm9ybT5cclxuICA8L21hdC1jYXJkLWNvbnRlbnQ+XHJcbjwvbWF0LWNhcmQ+XHJcblxyXG48bWF0LWNhcmQ+XHJcbiAgPG1hdC1jYXJkLWhlYWRlcj5cclxuICAgIDxoMz5SZW5kaXRpb248L2gzPlxyXG4gIDwvbWF0LWNhcmQtaGVhZGVyPlxyXG4gIDxtYXQtY2FyZC1jb250ZW50PlxyXG4gICAgPGRpdlxyXG4gICAgICBbc3R5bGUuZm9udC1zaXplXT1cInRleHRTaXplICsgJ3B4J1wiXHJcbiAgICAgIFtpbm5lckh0bWxdPVwicmVzdWx0IHwgc2FmZUh0bWw6ICdodG1sJ1wiXHJcbiAgICAgIGlkPVwicmVzdWx0XCJcclxuICAgICAgI3Jlc3VsdEVsZW1cclxuICAgID48L2Rpdj5cclxuICAgIDxociAvPlxyXG4gICAgPGRpdj5cclxuICAgICAgPGNvZGU+e3sgcmVzdWx0IH19PC9jb2RlPlxyXG4gICAgPC9kaXY+XHJcbiAgPC9tYXQtY2FyZC1jb250ZW50PlxyXG48L21hdC1jYXJkPlxyXG4iXX0=
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXlybWlkb24tY2FkbXVzLWxheWVyLWRlbW8uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9teXJtaWRvbi9jYWRtdXMtbGF5ZXItZGVtby9zcmMvbXlybWlkb24tY2FkbXVzLWxheWVyLWRlbW8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface of cadmus-layer-demo
3
+ */
4
+ export * from './lib/layer-demo/layer-demo.component';
5
+ export * from './lib/cadmus-layer-demo.module';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL215cm1pZG9uL2NhZG11cy1sYXllci1kZW1vL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyx1Q0FBdUMsQ0FBQztBQUN0RCxjQUFjLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcclxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGNhZG11cy1sYXllci1kZW1vXHJcbiAqL1xyXG5cclxuZXhwb3J0ICogZnJvbSAnLi9saWIvbGF5ZXItZGVtby9sYXllci1kZW1vLmNvbXBvbmVudCc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL2NhZG11cy1sYXllci1kZW1vLm1vZHVsZSc7XHJcbiJdfQ==
@@ -0,0 +1,198 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, ViewChild, NgModule } from '@angular/core';
3
+ import * as i2 from '@myrmidon/cadmus-core';
4
+ import { TokenLocation, CadmusCoreModule } from '@myrmidon/cadmus-core';
5
+ import * as i1 from '@angular/forms';
6
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i3 from '@angular/material/card';
8
+ import { MatCardModule } from '@angular/material/card';
9
+ import * as i4 from '@angular/material/form-field';
10
+ import { MatFormFieldModule } from '@angular/material/form-field';
11
+ import * as i5 from '@angular/material/toolbar';
12
+ import { MatToolbarModule } from '@angular/material/toolbar';
13
+ import * as i6 from '@angular/material/button';
14
+ import { MatButtonModule } from '@angular/material/button';
15
+ import * as i7 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i8 from '@angular/material/input';
18
+ import { MatInputModule } from '@angular/material/input';
19
+ import * as i9 from '@angular/material/tooltip';
20
+ import { MatTooltipModule } from '@angular/material/tooltip';
21
+ import * as i10 from '@angular/common';
22
+ import { CommonModule } from '@angular/common';
23
+ import * as i11 from '@myrmidon/ng-tools';
24
+ import { NgToolsModule } from '@myrmidon/ng-tools';
25
+ import * as i1$1 from '@angular/router';
26
+ import { RouterModule } from '@angular/router';
27
+ import { CadmusUiModule } from '@myrmidon/cadmus-ui';
28
+
29
+ class LayerDemoComponent {
30
+ constructor(formBuilder, _textLayerService) {
31
+ this._textLayerService = _textLayerService;
32
+ this.textSize = 14;
33
+ this.locations = [];
34
+ this.text = formBuilder.control('alpha beta\ngamma\ndelta epsilon waw\nzeta');
35
+ this.location = formBuilder.control('1.2@2x2');
36
+ this.rendition = formBuilder.group({
37
+ text: this.text,
38
+ location: this.location,
39
+ });
40
+ this.result = '';
41
+ }
42
+ makeLarger() {
43
+ const size = this.textSize + 2;
44
+ if (size > 24) {
45
+ return;
46
+ }
47
+ this.textSize = size;
48
+ }
49
+ makeSmaller() {
50
+ const size = this.textSize - 2;
51
+ if (size < 12) {
52
+ return;
53
+ }
54
+ this.textSize = size;
55
+ }
56
+ removeOverlaps(loc) {
57
+ for (let i = this.locations.length - 1; i > -1; i--) {
58
+ if (loc === this.locations[i]) {
59
+ continue;
60
+ }
61
+ if (loc.overlaps(this.locations[i])) {
62
+ this.locations.splice(i, 1);
63
+ }
64
+ }
65
+ }
66
+ addLocation() {
67
+ if (!this.location.value) {
68
+ return;
69
+ }
70
+ const loc = TokenLocation.parse(this.location.value);
71
+ if (!loc) {
72
+ return;
73
+ }
74
+ let done = false;
75
+ for (let i = 0; i < this.locations.length && !done; i++) {
76
+ const n = loc.compareTo(this.locations[i]);
77
+ // nothing to do if equal
78
+ if (n === 0) {
79
+ return;
80
+ }
81
+ // insert before nearest bigger sort value
82
+ if (n < 0) {
83
+ this.locations.splice(i, 0, loc);
84
+ done = true;
85
+ }
86
+ }
87
+ // append if not yet inserted
88
+ if (!done) {
89
+ this.locations.push(loc);
90
+ }
91
+ // remove all the overlapping locations
92
+ this.removeOverlaps(loc);
93
+ }
94
+ removeLocation(loc) {
95
+ const i = this.locations.indexOf(loc);
96
+ if (i > -1) {
97
+ this.locations.splice(i, 1);
98
+ }
99
+ }
100
+ clearLocations() {
101
+ this.locations.length = 0;
102
+ }
103
+ render() {
104
+ this.result = this._textLayerService.render(this.text.value, this.locations);
105
+ }
106
+ getLocationForNew() {
107
+ this.userLocation = this._textLayerService.getSelectedLocationForNew(this._textLayerService.getSelectedRange(), this.text.value) || undefined;
108
+ }
109
+ getLocationForEdit() {
110
+ this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
111
+ }
112
+ }
113
+ LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LayerDemoComponent, deps: [{ token: i1.FormBuilder }, { token: i2.TextLayerService }], target: i0.ɵɵFactoryTarget.Component });
114
+ LayerDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: LayerDemoComponent, selector: "cadmus-layer-demo", viewQueries: [{ propertyName: "_resultElement", first: true, predicate: ["resultElem"], descendants: true }], ngImport: i0, template: "<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\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 <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\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 color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>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 <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\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"], components: [{ type: i3.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { type: i3.MatCardHeader, selector: "mat-card-header" }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { 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]" }, { type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i9.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "safeHtml": i11.SafeHtmlPipe } });
115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: LayerDemoComponent, decorators: [{
116
+ type: Component,
117
+ args: [{ selector: 'cadmus-layer-demo', template: "<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\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 <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\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 color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>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 <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\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"] }]
118
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
119
+ type: ViewChild,
120
+ args: ['resultElem']
121
+ }] } });
122
+
123
+ // https://github.com/ng-packagr/ng-packagr/issues/778
124
+ const RouterModuleForChild = RouterModule.forChild([
125
+ { path: '', pathMatch: 'full', component: LayerDemoComponent },
126
+ ]);
127
+ class CadmusLayerDemoModule {
128
+ }
129
+ CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
130
+ CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, declarations: [LayerDemoComponent], imports: [CommonModule,
131
+ FormsModule,
132
+ ReactiveFormsModule, i1$1.RouterModule,
133
+ // material
134
+ MatButtonModule,
135
+ MatCardModule,
136
+ MatFormFieldModule,
137
+ MatIconModule,
138
+ MatInputModule,
139
+ MatToolbarModule,
140
+ MatTooltipModule,
141
+ // cadmus
142
+ NgToolsModule,
143
+ CadmusCoreModule,
144
+ CadmusUiModule], exports: [LayerDemoComponent] });
145
+ CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
146
+ CommonModule,
147
+ FormsModule,
148
+ ReactiveFormsModule,
149
+ RouterModuleForChild,
150
+ // material
151
+ MatButtonModule,
152
+ MatCardModule,
153
+ MatFormFieldModule,
154
+ MatIconModule,
155
+ MatInputModule,
156
+ MatToolbarModule,
157
+ MatTooltipModule,
158
+ // cadmus
159
+ NgToolsModule,
160
+ CadmusCoreModule,
161
+ CadmusUiModule,
162
+ ]] });
163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
164
+ type: NgModule,
165
+ args: [{
166
+ imports: [
167
+ CommonModule,
168
+ FormsModule,
169
+ ReactiveFormsModule,
170
+ RouterModuleForChild,
171
+ // material
172
+ MatButtonModule,
173
+ MatCardModule,
174
+ MatFormFieldModule,
175
+ MatIconModule,
176
+ MatInputModule,
177
+ MatToolbarModule,
178
+ MatTooltipModule,
179
+ // cadmus
180
+ NgToolsModule,
181
+ CadmusCoreModule,
182
+ CadmusUiModule,
183
+ ],
184
+ declarations: [LayerDemoComponent],
185
+ exports: [LayerDemoComponent],
186
+ }]
187
+ }] });
188
+
189
+ /*
190
+ * Public API Surface of cadmus-layer-demo
191
+ */
192
+
193
+ /**
194
+ * Generated bundle index. Do not edit.
195
+ */
196
+
197
+ export { CadmusLayerDemoModule, LayerDemoComponent, RouterModuleForChild };
198
+ //# sourceMappingURL=myrmidon-cadmus-layer-demo.mjs.map
@@ -0,0 +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/lib/cadmus-layer-demo.module.ts","../../../../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 { FormGroup, FormControl, FormBuilder } from '@angular/forms';\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})\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;\r\n public location: FormControl;\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 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 this.userLocation = 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 = this._textLayerService.getSelectedLocationForEdit(\r\n this._textLayerService.getSelectedRange()!\r\n ) || undefined;\r\n }\r\n}\r\n","<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\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 <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\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 <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\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 color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>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 <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\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","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { RouterModule } from '@angular/router';\r\n\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\n\r\nimport { CadmusCoreModule } from '@myrmidon/cadmus-core';\r\nimport { CadmusUiModule } from '@myrmidon/cadmus-ui';\r\n\r\nimport { LayerDemoComponent } from './layer-demo/layer-demo.component';\r\nimport { NgToolsModule } from '@myrmidon/ng-tools';\r\n\r\n// https://github.com/ng-packagr/ng-packagr/issues/778\r\nexport const RouterModuleForChild = RouterModule.forChild([\r\n { path: '', pathMatch: 'full', component: LayerDemoComponent },\r\n]);\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n RouterModuleForChild,\r\n // material\r\n MatButtonModule,\r\n MatCardModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatInputModule,\r\n MatToolbarModule,\r\n MatTooltipModule,\r\n // cadmus\r\n NgToolsModule,\r\n CadmusCoreModule,\r\n CadmusUiModule,\r\n ],\r\n declarations: [LayerDemoComponent],\r\n exports: [LayerDemoComponent],\r\n})\r\nexport class CadmusLayerDemoModule {}\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\nexport * from './lib/cadmus-layer-demo.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MASa,kBAAkB;IAa7B,YACE,WAAwB,EAChB,iBAAmC;QAAnC,sBAAiB,GAAjB,iBAAiB,CAAkB;QAE3C,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,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