@myrmidon/cadmus-layer-demo 0.3.0 → 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 +24 -24
- package/esm2020/lib/cadmus-layer-demo.module.mjs +40 -9
- package/esm2020/lib/layer-demo/layer-demo.component.mjs +4 -4
- package/fesm2015/myrmidon-cadmus-layer-demo.mjs +45 -13
- package/fesm2015/myrmidon-cadmus-layer-demo.mjs.map +1 -1
- package/fesm2020/myrmidon-cadmus-layer-demo.mjs +45 -13
- package/fesm2020/myrmidon-cadmus-layer-demo.mjs.map +1 -1
- package/lib/cadmus-layer-demo.module.d.ts +11 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# CadmusLayerDemo
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project cadmus-layer-demo` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project cadmus-layer-demo`.
|
|
8
|
-
> Note: Don't forget to add `--project cadmus-layer-demo` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build cadmus-layer-demo` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
-
|
|
14
|
-
## Publishing
|
|
15
|
-
|
|
16
|
-
After building your library with `ng build cadmus-layer-demo`, go to the dist folder `cd dist/cadmus-layer-demo` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test cadmus-layer-demo` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
-
|
|
22
|
-
## Further help
|
|
23
|
-
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI
|
|
1
|
+
# CadmusLayerDemo
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project cadmus-layer-demo` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project cadmus-layer-demo`.
|
|
8
|
+
> Note: Don't forget to add `--project cadmus-layer-demo` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build cadmus-layer-demo` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build cadmus-layer-demo`, go to the dist folder `cd dist/cadmus-layer-demo` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test cadmus-layer-demo` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
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.
|
|
@@ -2,10 +2,17 @@ import { NgModule } from '@angular/core';
|
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
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';
|
|
5
12
|
import { CadmusCoreModule } from '@myrmidon/cadmus-core';
|
|
6
|
-
import { CadmusMaterialModule } from '@myrmidon/cadmus-material';
|
|
7
13
|
import { CadmusUiModule } from '@myrmidon/cadmus-ui';
|
|
8
14
|
import { LayerDemoComponent } from './layer-demo/layer-demo.component';
|
|
15
|
+
import { NgToolsModule } from '@myrmidon/ng-tools';
|
|
9
16
|
import * as i0 from "@angular/core";
|
|
10
17
|
import * as i1 from "@angular/router";
|
|
11
18
|
// https://github.com/ng-packagr/ng-packagr/issues/778
|
|
@@ -14,25 +21,41 @@ export const RouterModuleForChild = RouterModule.forChild([
|
|
|
14
21
|
]);
|
|
15
22
|
export class CadmusLayerDemoModule {
|
|
16
23
|
}
|
|
17
|
-
CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
18
|
-
CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.
|
|
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,
|
|
19
26
|
FormsModule,
|
|
20
27
|
ReactiveFormsModule, i1.RouterModule,
|
|
28
|
+
// material
|
|
29
|
+
MatButtonModule,
|
|
30
|
+
MatCardModule,
|
|
31
|
+
MatFormFieldModule,
|
|
32
|
+
MatIconModule,
|
|
33
|
+
MatInputModule,
|
|
34
|
+
MatToolbarModule,
|
|
35
|
+
MatTooltipModule,
|
|
21
36
|
// cadmus
|
|
37
|
+
NgToolsModule,
|
|
22
38
|
CadmusCoreModule,
|
|
23
|
-
CadmusMaterialModule,
|
|
24
39
|
CadmusUiModule], exports: [LayerDemoComponent] });
|
|
25
|
-
CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.
|
|
40
|
+
CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
|
|
26
41
|
CommonModule,
|
|
27
42
|
FormsModule,
|
|
28
43
|
ReactiveFormsModule,
|
|
29
44
|
RouterModuleForChild,
|
|
45
|
+
// material
|
|
46
|
+
MatButtonModule,
|
|
47
|
+
MatCardModule,
|
|
48
|
+
MatFormFieldModule,
|
|
49
|
+
MatIconModule,
|
|
50
|
+
MatInputModule,
|
|
51
|
+
MatToolbarModule,
|
|
52
|
+
MatTooltipModule,
|
|
30
53
|
// cadmus
|
|
54
|
+
NgToolsModule,
|
|
31
55
|
CadmusCoreModule,
|
|
32
|
-
CadmusMaterialModule,
|
|
33
56
|
CadmusUiModule,
|
|
34
57
|
]] });
|
|
35
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
|
|
36
59
|
type: NgModule,
|
|
37
60
|
args: [{
|
|
38
61
|
imports: [
|
|
@@ -40,13 +63,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
40
63
|
FormsModule,
|
|
41
64
|
ReactiveFormsModule,
|
|
42
65
|
RouterModuleForChild,
|
|
66
|
+
// material
|
|
67
|
+
MatButtonModule,
|
|
68
|
+
MatCardModule,
|
|
69
|
+
MatFormFieldModule,
|
|
70
|
+
MatIconModule,
|
|
71
|
+
MatInputModule,
|
|
72
|
+
MatToolbarModule,
|
|
73
|
+
MatTooltipModule,
|
|
43
74
|
// cadmus
|
|
75
|
+
NgToolsModule,
|
|
44
76
|
CadmusCoreModule,
|
|
45
|
-
CadmusMaterialModule,
|
|
46
77
|
CadmusUiModule,
|
|
47
78
|
],
|
|
48
79
|
declarations: [LayerDemoComponent],
|
|
49
80
|
exports: [LayerDemoComponent],
|
|
50
81
|
}]
|
|
51
82
|
}] });
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FkbXVzLWxheWVyLWRlbW8ubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbXlybWlkb24vY2FkbXVzLWxheWVyLWRlbW8vc3JjL2xpYi9jYWRtdXMtbGF5ZXItZGVtby5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDL0MsT0FBTyxFQUFFLFdBQVcsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUUvQyxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDM0QsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUN2RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDekQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDN0QsT0FBTyxFQUFFLGdCQUFnQ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9kdWxlLFxyXG4gICAgUm91dGVyTW9kdWxlRm9yQ2hpbGQsXHJcbiAgICAvLyBtYXRlcmlhbFxyXG4gICAgTWF0QnV0dG9uTW9kdWxlLFxyXG4gICAgTWF0Q2FyZE1vZHVsZSxcclxuICAgIE1hdEZvcm1GaWVsZE1vZHVsZSxcclxuICAgIE1hdEljb25Nb2R1bGUsXHJcbiAgICBNYXRJbnB1dE1vZHVsZSxcclxuICAgIE1hdFRvb2xiYXJNb2R1bGUsXHJcbiAgICBNYXRUb29sdGlwTW9kdWxlLFxyXG4gICAgLy8gY2FkbXVzXHJcbiAgICBOZ1Rvb2xzTW9kdWxlLFxyXG4gICAgQ2FkbXVzQ29yZU1vZHVsZSxcclxuICAgIENhZG11c1VpTW9kdWxlLFxyXG4gIF0sXHJcbiAgZGVjbGFyYXRpb25zOiBbTGF5ZXJEZW1vQ29tcG9uZW50XSxcclxuICBleHBvcnRzOiBbTGF5ZXJEZW1vQ29tcG9uZW50XSxcclxufSlcclxuZXhwb3J0IGNsYXNzIENhZG11c0xheWVyRGVtb01vZHVsZSB7fVxyXG4iXX0=
|
|
@@ -11,7 +11,7 @@ import * as i7 from "@angular/material/icon";
|
|
|
11
11
|
import * as i8 from "@angular/material/input";
|
|
12
12
|
import * as i9 from "@angular/material/tooltip";
|
|
13
13
|
import * as i10 from "@angular/common";
|
|
14
|
-
import * as i11 from "@myrmidon/
|
|
14
|
+
import * as i11 from "@myrmidon/ng-tools";
|
|
15
15
|
export class LayerDemoComponent {
|
|
16
16
|
constructor(formBuilder, _textLayerService) {
|
|
17
17
|
this._textLayerService = _textLayerService;
|
|
@@ -96,9 +96,9 @@ export class LayerDemoComponent {
|
|
|
96
96
|
this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
100
|
-
LayerDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.
|
|
101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
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
102
|
type: Component,
|
|
103
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
104
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
|
|
@@ -5,19 +5,26 @@ import { TokenLocation, CadmusCoreModule } from '@myrmidon/cadmus-core';
|
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i3 from '@angular/material/card';
|
|
8
|
+
import { MatCardModule } from '@angular/material/card';
|
|
8
9
|
import * as i4 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
9
11
|
import * as i5 from '@angular/material/toolbar';
|
|
12
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
10
13
|
import * as i6 from '@angular/material/button';
|
|
14
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
11
15
|
import * as i7 from '@angular/material/icon';
|
|
16
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
12
17
|
import * as i8 from '@angular/material/input';
|
|
18
|
+
import { MatInputModule } from '@angular/material/input';
|
|
13
19
|
import * as i9 from '@angular/material/tooltip';
|
|
20
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
14
21
|
import * as i10 from '@angular/common';
|
|
15
22
|
import { CommonModule } from '@angular/common';
|
|
16
|
-
import * as i11 from '@myrmidon/
|
|
17
|
-
import {
|
|
23
|
+
import * as i11 from '@myrmidon/ng-tools';
|
|
24
|
+
import { NgToolsModule } from '@myrmidon/ng-tools';
|
|
18
25
|
import * as i1$1 from '@angular/router';
|
|
19
26
|
import { RouterModule } from '@angular/router';
|
|
20
|
-
import {
|
|
27
|
+
import { CadmusUiModule } from '@myrmidon/cadmus-ui';
|
|
21
28
|
|
|
22
29
|
class LayerDemoComponent {
|
|
23
30
|
constructor(formBuilder, _textLayerService) {
|
|
@@ -103,9 +110,9 @@ class LayerDemoComponent {
|
|
|
103
110
|
this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
|
|
104
111
|
}
|
|
105
112
|
}
|
|
106
|
-
LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
107
|
-
LayerDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
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: [{
|
|
109
116
|
type: Component,
|
|
110
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"] }]
|
|
111
118
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
|
|
@@ -119,25 +126,41 @@ const RouterModuleForChild = RouterModule.forChild([
|
|
|
119
126
|
]);
|
|
120
127
|
class CadmusLayerDemoModule {
|
|
121
128
|
}
|
|
122
|
-
CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
123
|
-
CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.
|
|
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,
|
|
124
131
|
FormsModule,
|
|
125
132
|
ReactiveFormsModule, i1$1.RouterModule,
|
|
133
|
+
// material
|
|
134
|
+
MatButtonModule,
|
|
135
|
+
MatCardModule,
|
|
136
|
+
MatFormFieldModule,
|
|
137
|
+
MatIconModule,
|
|
138
|
+
MatInputModule,
|
|
139
|
+
MatToolbarModule,
|
|
140
|
+
MatTooltipModule,
|
|
126
141
|
// cadmus
|
|
142
|
+
NgToolsModule,
|
|
127
143
|
CadmusCoreModule,
|
|
128
|
-
CadmusMaterialModule,
|
|
129
144
|
CadmusUiModule], exports: [LayerDemoComponent] });
|
|
130
|
-
CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.
|
|
145
|
+
CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
|
|
131
146
|
CommonModule,
|
|
132
147
|
FormsModule,
|
|
133
148
|
ReactiveFormsModule,
|
|
134
149
|
RouterModuleForChild,
|
|
150
|
+
// material
|
|
151
|
+
MatButtonModule,
|
|
152
|
+
MatCardModule,
|
|
153
|
+
MatFormFieldModule,
|
|
154
|
+
MatIconModule,
|
|
155
|
+
MatInputModule,
|
|
156
|
+
MatToolbarModule,
|
|
157
|
+
MatTooltipModule,
|
|
135
158
|
// cadmus
|
|
159
|
+
NgToolsModule,
|
|
136
160
|
CadmusCoreModule,
|
|
137
|
-
CadmusMaterialModule,
|
|
138
161
|
CadmusUiModule,
|
|
139
162
|
]] });
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
|
|
141
164
|
type: NgModule,
|
|
142
165
|
args: [{
|
|
143
166
|
imports: [
|
|
@@ -145,9 +168,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
145
168
|
FormsModule,
|
|
146
169
|
ReactiveFormsModule,
|
|
147
170
|
RouterModuleForChild,
|
|
171
|
+
// material
|
|
172
|
+
MatButtonModule,
|
|
173
|
+
MatCardModule,
|
|
174
|
+
MatFormFieldModule,
|
|
175
|
+
MatIconModule,
|
|
176
|
+
MatInputModule,
|
|
177
|
+
MatToolbarModule,
|
|
178
|
+
MatTooltipModule,
|
|
148
179
|
// cadmus
|
|
180
|
+
NgToolsModule,
|
|
149
181
|
CadmusCoreModule,
|
|
150
|
-
CadmusMaterialModule,
|
|
151
182
|
CadmusUiModule,
|
|
152
183
|
],
|
|
153
184
|
declarations: [LayerDemoComponent],
|
|
@@ -164,3 +195,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
164
195
|
*/
|
|
165
196
|
|
|
166
197
|
export { CadmusLayerDemoModule, LayerDemoComponent, RouterModuleForChild };
|
|
198
|
+
//# sourceMappingURL=myrmidon-cadmus-layer-demo.mjs.map
|
|
@@ -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/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 { CadmusCoreModule } from '@myrmidon/cadmus-core';\r\nimport { CadmusMaterialModule } from '@myrmidon/cadmus-material';\r\nimport { CadmusUiModule } from '@myrmidon/cadmus-ui';\r\n\r\nimport { LayerDemoComponent } from './layer-demo/layer-demo.component';\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 // cadmus\r\n CadmusCoreModule,\r\n CadmusMaterialModule,\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,SA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idon/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,CAAC,IAAI,GAAG,WAAW,CAAC,OAAO,CAC7B,4CAA4C,CAC7C,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,K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+5,26 @@ import { TokenLocation, CadmusCoreModule } from '@myrmidon/cadmus-core';
|
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i3 from '@angular/material/card';
|
|
8
|
+
import { MatCardModule } from '@angular/material/card';
|
|
8
9
|
import * as i4 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
9
11
|
import * as i5 from '@angular/material/toolbar';
|
|
12
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
10
13
|
import * as i6 from '@angular/material/button';
|
|
14
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
11
15
|
import * as i7 from '@angular/material/icon';
|
|
16
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
12
17
|
import * as i8 from '@angular/material/input';
|
|
18
|
+
import { MatInputModule } from '@angular/material/input';
|
|
13
19
|
import * as i9 from '@angular/material/tooltip';
|
|
20
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
14
21
|
import * as i10 from '@angular/common';
|
|
15
22
|
import { CommonModule } from '@angular/common';
|
|
16
|
-
import * as i11 from '@myrmidon/
|
|
17
|
-
import {
|
|
23
|
+
import * as i11 from '@myrmidon/ng-tools';
|
|
24
|
+
import { NgToolsModule } from '@myrmidon/ng-tools';
|
|
18
25
|
import * as i1$1 from '@angular/router';
|
|
19
26
|
import { RouterModule } from '@angular/router';
|
|
20
|
-
import {
|
|
27
|
+
import { CadmusUiModule } from '@myrmidon/cadmus-ui';
|
|
21
28
|
|
|
22
29
|
class LayerDemoComponent {
|
|
23
30
|
constructor(formBuilder, _textLayerService) {
|
|
@@ -103,9 +110,9 @@ class LayerDemoComponent {
|
|
|
103
110
|
this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
|
|
104
111
|
}
|
|
105
112
|
}
|
|
106
|
-
LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
107
|
-
LayerDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.
|
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
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: [{
|
|
109
116
|
type: Component,
|
|
110
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"] }]
|
|
111
118
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
|
|
@@ -119,25 +126,41 @@ const RouterModuleForChild = RouterModule.forChild([
|
|
|
119
126
|
]);
|
|
120
127
|
class CadmusLayerDemoModule {
|
|
121
128
|
}
|
|
122
|
-
CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.
|
|
123
|
-
CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.
|
|
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,
|
|
124
131
|
FormsModule,
|
|
125
132
|
ReactiveFormsModule, i1$1.RouterModule,
|
|
133
|
+
// material
|
|
134
|
+
MatButtonModule,
|
|
135
|
+
MatCardModule,
|
|
136
|
+
MatFormFieldModule,
|
|
137
|
+
MatIconModule,
|
|
138
|
+
MatInputModule,
|
|
139
|
+
MatToolbarModule,
|
|
140
|
+
MatTooltipModule,
|
|
126
141
|
// cadmus
|
|
142
|
+
NgToolsModule,
|
|
127
143
|
CadmusCoreModule,
|
|
128
|
-
CadmusMaterialModule,
|
|
129
144
|
CadmusUiModule], exports: [LayerDemoComponent] });
|
|
130
|
-
CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.
|
|
145
|
+
CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
|
|
131
146
|
CommonModule,
|
|
132
147
|
FormsModule,
|
|
133
148
|
ReactiveFormsModule,
|
|
134
149
|
RouterModuleForChild,
|
|
150
|
+
// material
|
|
151
|
+
MatButtonModule,
|
|
152
|
+
MatCardModule,
|
|
153
|
+
MatFormFieldModule,
|
|
154
|
+
MatIconModule,
|
|
155
|
+
MatInputModule,
|
|
156
|
+
MatToolbarModule,
|
|
157
|
+
MatTooltipModule,
|
|
135
158
|
// cadmus
|
|
159
|
+
NgToolsModule,
|
|
136
160
|
CadmusCoreModule,
|
|
137
|
-
CadmusMaterialModule,
|
|
138
161
|
CadmusUiModule,
|
|
139
162
|
]] });
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
|
|
141
164
|
type: NgModule,
|
|
142
165
|
args: [{
|
|
143
166
|
imports: [
|
|
@@ -145,9 +168,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
145
168
|
FormsModule,
|
|
146
169
|
ReactiveFormsModule,
|
|
147
170
|
RouterModuleForChild,
|
|
171
|
+
// material
|
|
172
|
+
MatButtonModule,
|
|
173
|
+
MatCardModule,
|
|
174
|
+
MatFormFieldModule,
|
|
175
|
+
MatIconModule,
|
|
176
|
+
MatInputModule,
|
|
177
|
+
MatToolbarModule,
|
|
178
|
+
MatTooltipModule,
|
|
148
179
|
// cadmus
|
|
180
|
+
NgToolsModule,
|
|
149
181
|
CadmusCoreModule,
|
|
150
|
-
CadmusMaterialModule,
|
|
151
182
|
CadmusUiModule,
|
|
152
183
|
],
|
|
153
184
|
declarations: [LayerDemoComponent],
|
|
@@ -164,3 +195,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
164
195
|
*/
|
|
165
196
|
|
|
166
197
|
export { CadmusLayerDemoModule, LayerDemoComponent, RouterModuleForChild };
|
|
198
|
+
//# sourceMappingURL=myrmidon-cadmus-layer-demo.mjs.map
|
|
@@ -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/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 { CadmusCoreModule } from '@myrmidon/cadmus-core';\r\nimport { CadmusMaterialModule } from '@myrmidon/cadmus-material';\r\nimport { CadmusUiModule } from '@myrmidon/cadmus-ui';\r\n\r\nimport { LayerDemoComponent } from './layer-demo/layer-demo.component';\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 // cadmus\r\n CadmusCoreModule,\r\n CadmusMaterialModule,\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,CAAC,IAAI,GAAG,WAAW,CAAC,OAAO,CAC7B,4CAA4C,CAC7C,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,KA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AAC,0BAA0B,CACnE,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAG,CAC3C,IAAI,SAAS,CAAC;KAChB;;+GArHU,kBAAkB;mGAAlB,kBAAkB,uKCT/B,w1KAqKA;2FD5Ja,kBAAkB;kBAL9B,SAAS;+BACE,mBAAmB;iIAKJ,cAAc;sBAAtC,SAAS;uBAAC,YAAY;;;AECzB;MACa,oBAAoB,GAAG,YAAY,CAAC,QAAQ,CAAC;IACxD,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE;CAC/D,EAAE;MAgBU,qBAAqB;;kHAArB,qBAAqB;mHAArB,qBAAqB,iBAHjB,kBAAkB,aAT/B,YAAY;QACZ,WAAW;QACX,mBAAmB;;QAGnB,gBAAgB;QAChB,oBAAoB;QACpB,cAAc,aAGN,kBAAkB;mHAEjB,qBAAqB,YAbvB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,oBAAoB;;YAEpB,gBAAgB;YAChB,oBAAoB;YACpB,cAAc;SACf;2FAIU,qBAAqB;kBAdjC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,oBAAoB;;wBAEpB,gBAAgB;wBAChB,oBAAoB;wBACpB,cAAc;qBACf;oBACD,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;;AC7BD;;;;ACAA;;;;;;"}
|
|
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,CAAC,IAAI,GAAG,WAAW,CAAC,OAAO,CAC7B,4CAA4C,CAC7C,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;KAClB;IAEM,UAAU;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,C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AS;uBAAC,YAAY;;;AESzB;MACa,oBAAoB,GAAG,YAAY,CAAC,QAAQ,CAAC;IACxD,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE;CAC/D,EAAE;MAwBU,qBAAqB;;kHAArB,qBAAqB;mHAArB,qBAAqB,iBAHjB,kBAAkB,aAjB/B,YAAY;QACZ,WAAW;QACX,mBAAmB;;QAGnB,eAAe;QACf,aAAa;QACb,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,gBAAgB;QAChB,gBAAgB;;QAEhB,aAAa;QACb,gBAAgB;QAChB,cAAc,aAGN,kBAAkB;mHAEjB,qBAAqB,YArBvB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,oBAAoB;;YAEpB,eAAe;YACf,aAAa;YACb,kBAAkB;YAClB,aAAa;YACb,cAAc;YACd,gBAAgB;YAChB,gBAAgB;;YAEhB,aAAa;YACb,gBAAgB;YAChB,cAAc;SACf;2FAIU,qBAAqB;kBAtBjC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,oBAAoB;;wBAEpB,eAAe;wBACf,aAAa;wBACb,kBAAkB;wBAClB,aAAa;wBACb,cAAc;wBACd,gBAAgB;wBAChB,gBAAgB;;wBAEhB,aAAa;wBACb,gBAAgB;wBAChB,cAAc;qBACf;oBACD,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;;AC7CD;;;;ACAA;;;;;;"}
|
|
@@ -4,12 +4,19 @@ import * as i1 from "./layer-demo/layer-demo.component";
|
|
|
4
4
|
import * as i2 from "@angular/common";
|
|
5
5
|
import * as i3 from "@angular/forms";
|
|
6
6
|
import * as i4 from "@angular/router";
|
|
7
|
-
import * as i5 from "@
|
|
8
|
-
import * as i6 from "@
|
|
9
|
-
import * as i7 from "@
|
|
7
|
+
import * as i5 from "@angular/material/button";
|
|
8
|
+
import * as i6 from "@angular/material/card";
|
|
9
|
+
import * as i7 from "@angular/material/form-field";
|
|
10
|
+
import * as i8 from "@angular/material/icon";
|
|
11
|
+
import * as i9 from "@angular/material/input";
|
|
12
|
+
import * as i10 from "@angular/material/toolbar";
|
|
13
|
+
import * as i11 from "@angular/material/tooltip";
|
|
14
|
+
import * as i12 from "@myrmidon/ng-tools";
|
|
15
|
+
import * as i13 from "@myrmidon/cadmus-core";
|
|
16
|
+
import * as i14 from "@myrmidon/cadmus-ui";
|
|
10
17
|
export declare const RouterModuleForChild: import("@angular/core").ModuleWithProviders<RouterModule>;
|
|
11
18
|
export declare class CadmusLayerDemoModule {
|
|
12
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<CadmusLayerDemoModule, never>;
|
|
13
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<CadmusLayerDemoModule, [typeof i1.LayerDemoComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.RouterModule, typeof i5.
|
|
20
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<CadmusLayerDemoModule, [typeof i1.LayerDemoComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.RouterModule, typeof i5.MatButtonModule, typeof i6.MatCardModule, typeof i7.MatFormFieldModule, typeof i8.MatIconModule, typeof i9.MatInputModule, typeof i10.MatToolbarModule, typeof i11.MatTooltipModule, typeof i12.NgToolsModule, typeof i13.CadmusCoreModule, typeof i14.CadmusUiModule], [typeof i1.LayerDemoComponent]>;
|
|
14
21
|
static ɵinj: i0.ɵɵInjectorDeclaration<CadmusLayerDemoModule>;
|
|
15
22
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrmidon/cadmus-layer-demo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Cadmus - layer demo page.",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Cadmus - text layer demo page.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Cadmus"
|
|
7
7
|
],
|
|
8
|
-
"homepage": "https://github.com/vedph/
|
|
8
|
+
"homepage": "https://github.com/vedph/cadmus-shell",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/vedph/
|
|
11
|
+
"url": "https://github.com/vedph/cadmus-shell"
|
|
12
12
|
},
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "Daniele Fusi"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@angular/core": "^13.0.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"tslib": "^2.
|
|
21
|
+
"tslib": "^2.3.0"
|
|
22
22
|
},
|
|
23
23
|
"module": "fesm2015/myrmidon-cadmus-layer-demo.mjs",
|
|
24
24
|
"es2020": "fesm2020/myrmidon-cadmus-layer-demo.mjs",
|