@myrmidon/cadmus-layer-demo 0.0.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # CadmusLayerDemo
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.4.
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 README](https://github.com/angular/angular-cli/blob/master/README.md).
1
+ # CadmusLayerDemo
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.4.
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 README](https://github.com/angular/angular-cli/blob/master/README.md).
@@ -0,0 +1,52 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
+ import { RouterModule } from '@angular/router';
5
+ import { CadmusCoreModule } from '@myrmidon/cadmus-core';
6
+ import { CadmusMaterialModule } from '@myrmidon/cadmus-material';
7
+ import { CadmusUiModule } from '@myrmidon/cadmus-ui';
8
+ import { LayerDemoComponent } from './layer-demo/layer-demo.component';
9
+ import * as i0 from "@angular/core";
10
+ import * as i1 from "@angular/router";
11
+ // https://github.com/ng-packagr/ng-packagr/issues/778
12
+ export const RouterModuleForChild = RouterModule.forChild([
13
+ { path: '', pathMatch: 'full', component: LayerDemoComponent },
14
+ ]);
15
+ export class CadmusLayerDemoModule {
16
+ }
17
+ CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
18
+ CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, declarations: [LayerDemoComponent], imports: [CommonModule,
19
+ FormsModule,
20
+ ReactiveFormsModule, i1.RouterModule,
21
+ // cadmus
22
+ CadmusCoreModule,
23
+ CadmusMaterialModule,
24
+ CadmusUiModule], exports: [LayerDemoComponent] });
25
+ CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
26
+ CommonModule,
27
+ FormsModule,
28
+ ReactiveFormsModule,
29
+ RouterModuleForChild,
30
+ // cadmus
31
+ CadmusCoreModule,
32
+ CadmusMaterialModule,
33
+ CadmusUiModule,
34
+ ]] });
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
36
+ type: NgModule,
37
+ args: [{
38
+ imports: [
39
+ CommonModule,
40
+ FormsModule,
41
+ ReactiveFormsModule,
42
+ RouterModuleForChild,
43
+ // cadmus
44
+ CadmusCoreModule,
45
+ CadmusMaterialModule,
46
+ CadmusUiModule,
47
+ ],
48
+ declarations: [LayerDemoComponent],
49
+ exports: [LayerDemoComponent],
50
+ }]
51
+ }] });
52
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FkbXVzLWxheWVyLWRlbW8ubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbXlybWlkb24vY2FkbXVzLWxheWVyLWRlbW8vc3JjL2xpYi9jYWRtdXMtbGF5ZXItZGVtby5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDL0MsT0FBTyxFQUFFLFdBQVcsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2xFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUUvQyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNqRSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFckQsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sbUNBQW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gICAgQ2FkbXVzVWlNb2R1bGUsXHJcbiAgXSxcclxuICBkZWNsYXJhdGlvbnM6IFtMYXllckRlbW9Db21wb25lbnRdLFxyXG4gIGV4cG9ydHM6IFtMYXllckRlbW9Db21wb25lbnRdLFxyXG59KVxyXG5leHBvcnQgY2xhc3MgQ2FkbXVzTGF5ZXJEZW1vTW9kdWxlIHt9XHJcbiJdfQ==
@@ -0,0 +1,108 @@
1
+ import { Component, ViewChild } from '@angular/core';
2
+ import { TokenLocation } from '@myrmidon/cadmus-core';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/forms";
5
+ import * as i2 from "@myrmidon/cadmus-core";
6
+ import * as i3 from "@angular/material/card";
7
+ import * as i4 from "@angular/material/form-field";
8
+ import * as i5 from "@angular/material/toolbar";
9
+ import * as i6 from "@angular/material/button";
10
+ import * as i7 from "@angular/material/icon";
11
+ import * as i8 from "@angular/material/input";
12
+ import * as i9 from "@angular/material/tooltip";
13
+ import * as i10 from "@angular/common";
14
+ import * as i11 from "@myrmidon/cadmus-ui";
15
+ export class LayerDemoComponent {
16
+ constructor(formBuilder, _textLayerService) {
17
+ this._textLayerService = _textLayerService;
18
+ this.textSize = 14;
19
+ this.locations = [];
20
+ this.text = formBuilder.control('alpha beta\ngamma\ndelta epsilon waw\nzeta');
21
+ this.location = formBuilder.control('1.2@2x2');
22
+ this.rendition = formBuilder.group({
23
+ text: this.text,
24
+ location: this.location,
25
+ });
26
+ this.result = '';
27
+ }
28
+ makeLarger() {
29
+ const size = this.textSize + 2;
30
+ if (size > 24) {
31
+ return;
32
+ }
33
+ this.textSize = size;
34
+ }
35
+ makeSmaller() {
36
+ const size = this.textSize - 2;
37
+ if (size < 12) {
38
+ return;
39
+ }
40
+ this.textSize = size;
41
+ }
42
+ removeOverlaps(loc) {
43
+ for (let i = this.locations.length - 1; i > -1; i--) {
44
+ if (loc === this.locations[i]) {
45
+ continue;
46
+ }
47
+ if (loc.overlaps(this.locations[i])) {
48
+ this.locations.splice(i, 1);
49
+ }
50
+ }
51
+ }
52
+ addLocation() {
53
+ if (!this.location.value) {
54
+ return;
55
+ }
56
+ const loc = TokenLocation.parse(this.location.value);
57
+ if (!loc) {
58
+ return;
59
+ }
60
+ let done = false;
61
+ for (let i = 0; i < this.locations.length && !done; i++) {
62
+ const n = loc.compareTo(this.locations[i]);
63
+ // nothing to do if equal
64
+ if (n === 0) {
65
+ return;
66
+ }
67
+ // insert before nearest bigger sort value
68
+ if (n < 0) {
69
+ this.locations.splice(i, 0, loc);
70
+ done = true;
71
+ }
72
+ }
73
+ // append if not yet inserted
74
+ if (!done) {
75
+ this.locations.push(loc);
76
+ }
77
+ // remove all the overlapping locations
78
+ this.removeOverlaps(loc);
79
+ }
80
+ removeLocation(loc) {
81
+ const i = this.locations.indexOf(loc);
82
+ if (i > -1) {
83
+ this.locations.splice(i, 1);
84
+ }
85
+ }
86
+ clearLocations() {
87
+ this.locations.length = 0;
88
+ }
89
+ render() {
90
+ this.result = this._textLayerService.render(this.text.value, this.locations);
91
+ }
92
+ getLocationForNew() {
93
+ this.userLocation = this._textLayerService.getSelectedLocationForNew(this._textLayerService.getSelectedRange(), this.text.value) || undefined;
94
+ }
95
+ getLocationForEdit() {
96
+ this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
97
+ }
98
+ }
99
+ LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", 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.2", 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.2", ngImport: i0, type: LayerDemoComponent, decorators: [{
102
+ type: Component,
103
+ args: [{ selector: 'cadmus-layer-demo', template: "<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize + 'px'\"\r\n [innerHtml]=\"result | safeHtml: 'html'\"\r\n id=\"result\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n", styles: ["textarea#text{min-width:300px;min-height:100px}:host ::ng-deep div#result{counter-reset:text-y-counter}:host ::ng-deep div#result p:before{content:counter(text-y-counter);counter-increment:text-y-counter;margin-right:6px;color:#a0a0a0}:host ::ng-deep span.fr{background-color:#ff0;border:1px solid silver;border-radius:6px}article{column-width:20em}\n"] }]
104
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
105
+ type: ViewChild,
106
+ args: ['resultElem']
107
+ }] } });
108
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF5ZXItZGVtby5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9teXJtaWRvbi9jYWRtdXMtbGF5ZXItZGVtby9zcmMvbGliL2xheWVyLWRlbW8vbGF5ZXItZGVtby5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wcm9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ob2xkZXI9XCJlbnRlciB0aGUgYmFzZSB0ZXh0XCJcclxuICAgICAgICAgICAgZm9ybUNvbnRyb2xOYW1lPVwidGV4dFwiXHJcbiAgICAgICAgICA+PC90ZXh0YXJlYT5cclxuICAgICAgICA8L21hdC1mb3JtLWZpZWxkPlxyXG4gICAgICA8L2Rpdj5cclxuXHJcbiAgICAgIDxkaXY+XHJcbiAgICAgICAgPG1hdC1mb3JtLWZpZWxkPlxyXG4gICAgICAgICAgPGlucHV0XHJcbiAgICAgICAgICAgIG1hdElucHV0XHJcbiAgICAgICAgICAgIHR5cGU9XCJ0ZXh0XCJcclxuICAgICAgICAgICAgaWQ9XCJsb2NhdGlvblwiXHJcbiAgICAgICAgICAgIHJlcXVpcmVkXHJcbiAgICAgICAgICAgIHNwZWxsY2hlY2s9XCJmYWxzZVwiXHJcbiAgICAgICAgICAgIHBsYWNlaG9sZGVyPVwibG9jYXRpb246IFkuWEBBeFJcIlxyXG4gICAgICAgICAgICBmb3JtQ29udHJvbE5hbWU9XCJsb2NhdGlvblwiXHJcbiAgICAgICAgICAvPlxyXG4gICAgICAgIDwvbWF0LWZvcm0tZmllbGQ+XHJcbiAgICAgIDwvZGl2PlxyXG5cclxuICAgICAgPGRpdj5cclxuICAgICAgICA8bWF0LXRvb2xiYXI+XHJcbiAgICAgICAgICA8c3Bhbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJhZGRMb2NhdGlvbigpXCJcclxuICAgICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcclxuICAgICAgICAgICAgICBtYXRUb29sdGlwPVwiQWRkIHRoZSBzcGVjaWZpZWQgbG9jYXRpb25cIlxyXG4gICAgICAgICAgICA+XHJcbiAgICAgICAgICAgICAgPG1hdC1pY29uIHN0eWxlPVwiY29sb3I6ICM2NmNjNzVcIj5hZGRfY2lyY2xlPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgPC9idXR0b24+XHJcbiAgICAgICAgICAgIDxidXR0b25cclxuICAgICAgICAgICAgICBtYXQtaWNvbi1idXR0b25cclxuICAgICAgICAgICAgICBjb2xvcj1cIndhcm5cIlxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJjbGVhckxvY2F0aW9ucygpXCJcclxuICAgICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcclxuICAgICAgICAgICAgICBtYXRUb29sdGlwPVwiUmVtb3ZlIGFsbCB0aGUgbG9jYXRpb25zXCJcclxuICAgICAgICAgICAgPlxyXG4gICAgICAgICAgICAgIDxtYXQtaWNvbj5kZWxldGVfc3dlZXA8L21hdC1pY29uPlxyXG4gICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIGNvbG9yPVwicHJpbWFyeVwiXHJcbiAgICAgICAgICAgICAgdHlwZT1cInN1Ym1pdFwiXHJcbiAgICAgICAgICAgICAgbWF0VG9vbHRpcD1cIlJlbmRlciB0aGUgZGVjb3JhdGVkIGJhc2UgdGV4dFwiXHJcbiAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICA8bWF0LWljb24+cGxheV9jaXJjbGVfb3V0bGluZTwvbWF0LWljb24+XHJcbiAgICAgICAgICAgIDwvYnV0dG9uPlxyXG4gICAgICAgICAgICA8YnV0dG9uXHJcbiAgICAgICAgICAgICAgbWF0LWljb24tYnV0dG9uXHJcbiAgICAgICAgICAgICAgKGNsaWNrKT1cImdldExvY2F0aW9uRm9yTmV3KClcIlxyXG4gICAgICAgICAgICAgIHR5cGU9XCJidXR0b25cIlxyXG4gICAgICAgICAgICAgIG1hdFRvb2x0aXA9XCJHZXQgbG9jYXRpb24gZm9yIG5ldyBpdGVtXCJcclxuICAgICAgICAgICAgPlxyXG4gICAgICAgICAgICAgIDxtYXQtaWNvbj5wbGF5bGlzdF9hZGQ8L21hdC1pY29uPlxyXG4gICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJnZXRMb2NhdGlvbkZvckVkaXQoKVwiXHJcbiAgICAgICAgICAgICAgdHlwZT1cImJ1dHRvblwiXHJcbiAgICAgICAgICAgICAgbWF0VG9vbHRpcD1cIkdldCBsb2NhdGlvbiBmb3Igc2VsZWN0ZWQgaXRlbVwiXHJcbiAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICA8bWF0LWljb24+cGxheWxpc3RfYWRkX2NoZWNrPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgPC9idXR0b24+XHJcbiAgICAgICAgICAgIDxidXR0b25cclxuICAgICAgICAgICAgICBtYXQtaWNvbi1idXR0b25cclxuICAgICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcclxuICAgICAgICAgICAgICBtYXRUb29sdGlwPVwiTGFyZ2VyIHRleHRcIlxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJtYWtlTGFyZ2VyKClcIlxyXG4gICAgICAgICAgICAgIFtkaXNhYmxlZF09XCJ0ZXh0U2l6ZSA+PSAyNFwiXHJcbiAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICA8bWF0LWljb24+Zm9ybWF0X3NpemU8L21hdC1pY29uPlxyXG4gICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgIG1hdC1pY29uLWJ1dHRvblxyXG4gICAgICAgICAgICAgIHR5cGU9XCJidXR0b25cIlxyXG4gICAgICAgICAgICAgIG1hdFRvb2x0aXA9XCJTbWFsbGVyIHRleHRcIlxyXG4gICAgICAgICAgICAgIChjbGljayk9XCJtYWtlU21hbGxlcigpXCJcclxuICAgICAgICAgICAgICBbZGlzYWJsZWRdPVwidGV4dFNpemUgPD0gMTJcIlxyXG4gICAgICAgICAgICA+XHJcbiAgICAgICAgICAgICAgPG1hdC1pY29uPnRleHRfZmllbGRzPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgPC9idXR0b24+XHJcbiAgICAgICAgICA8L3NwYW4+XHJcbiAgICAgICAgICA8c3BhbiBjbGFzcz1cInRiLWZpbGwtcmVtYWluaW5nLXNwYWNlXCI+PC9zcGFuPlxyXG4gICAgICAgICAgPHNwYW4+e3sgdXNlckxvY2F0aW9uIH19PC9zcGFuPlxyXG4gICAgICAgIDwvbWF0LXRvb2xiYXI+XHJcbiAgICAgIDwvZGl2PlxyXG5cclxuICAgICAgPHRhYmxlPlxyXG4gICAgICAgIDx0Ym9keT5cclxuICAgICAgICAgIDx0ciAqbmdGb3I9XCJsZXQgbG9jIG9mIGxvY2F0aW9uc1wiPlxyXG4gICAgICAgICAgICA8dGQ+XHJcbiAgICAgICAgICAgICAgPGJ1dHRvblxyXG4gICAgICAgICAgICAgICAgbWF0LWljb24tYnV0dG9uXHJcbiAgICAgICAgICAgICAgICBjb2xvcj1cIndhcm5cIlxyXG4gICAgICAgICAgICAgICAgKGNsaWNrKT1cInJlbW92ZUxvY2F0aW9uKGxvYylcIlxyXG4gICAgICAgICAgICAgID5cclxuICAgICAgICAgICAgICAgIDxtYXQtaWNvbj5yZW1vdmVfY2lyY2xlPC9tYXQtaWNvbj5cclxuICAgICAgICAgICAgICA8L2J1dHRvbj5cclxuICAgICAgICAgICAgPC90ZD5cclxuICAgICAgICAgICAgPHRkPnt7IGxvYy50b1N0cmluZygpIH19PC90ZD5cclxuICAgICAgICAgIDwvdHI+XHJcbiAgICAgICAgPC90Ym9keT5cclxuICAgICAgPC90YWJsZT5cclxuICAgIDwvZm9ybT5cclxuICA8L21hdC1jYXJkLWNvbnRlbnQ+XHJcbjwvbWF0LWNhcmQ+XHJcblxyXG48bWF0LWNhcmQ+XHJcbiAgPG1hdC1jYXJkLWhlYWRlcj5cclxuICAgIDxoMz5SZW5kaXRpb248L2gzPlxyXG4gIDwvbWF0LWNhcmQtaGVhZGVyPlxyXG4gIDxtYXQtY2FyZC1jb250ZW50PlxyXG4gICAgPGRpdlxyXG4gICAgICBbc3R5bGUuZm9udC1zaXplXT1cInRleHRTaXplICsgJ3B4J1wiXHJcbiAgICAgIFtpbm5lckh0bWxdPVwicmVzdWx0IHwgc2FmZUh0bWw6ICdodG1sJ1wiXHJcbiAgICAgIGlkPVwicmVzdWx0XCJcclxuICAgICAgI3Jlc3VsdEVsZW1cclxuICAgID48L2Rpdj5cclxuICAgIDxociAvPlxyXG4gICAgPGRpdj5cclxuICAgICAgPGNvZGU+e3sgcmVzdWx0IH19PC9jb2RlPlxyXG4gICAgPC9kaXY+XHJcbiAgPC9tYXQtY2FyZC1jb250ZW50PlxyXG48L21hdC1jYXJkPlxyXG4iXX0=
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXlybWlkb24tY2FkbXVzLWxheWVyLWRlbW8uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9teXJtaWRvbi9jYWRtdXMtbGF5ZXItZGVtby9zcmMvbXlybWlkb24tY2FkbXVzLWxheWVyLWRlbW8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface of cadmus-layer-demo
3
+ */
4
+ export * from './lib/layer-demo/layer-demo.component';
5
+ export * from './lib/cadmus-layer-demo.module';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL215cm1pZG9uL2NhZG11cy1sYXllci1kZW1vL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyx1Q0FBdUMsQ0FBQztBQUN0RCxjQUFjLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcclxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGNhZG11cy1sYXllci1kZW1vXHJcbiAqL1xyXG5cclxuZXhwb3J0ICogZnJvbSAnLi9saWIvbGF5ZXItZGVtby9sYXllci1kZW1vLmNvbXBvbmVudCc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL2NhZG11cy1sYXllci1kZW1vLm1vZHVsZSc7XHJcbiJdfQ==
@@ -0,0 +1,166 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, ViewChild, NgModule } from '@angular/core';
3
+ import * as i2 from '@myrmidon/cadmus-core';
4
+ import { TokenLocation, CadmusCoreModule } from '@myrmidon/cadmus-core';
5
+ import * as i1 from '@angular/forms';
6
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i3 from '@angular/material/card';
8
+ import * as i4 from '@angular/material/form-field';
9
+ import * as i5 from '@angular/material/toolbar';
10
+ import * as i6 from '@angular/material/button';
11
+ import * as i7 from '@angular/material/icon';
12
+ import * as i8 from '@angular/material/input';
13
+ import * as i9 from '@angular/material/tooltip';
14
+ import * as i10 from '@angular/common';
15
+ import { CommonModule } from '@angular/common';
16
+ import * as i11 from '@myrmidon/cadmus-ui';
17
+ import { CadmusUiModule } from '@myrmidon/cadmus-ui';
18
+ import * as i1$1 from '@angular/router';
19
+ import { RouterModule } from '@angular/router';
20
+ import { CadmusMaterialModule } from '@myrmidon/cadmus-material';
21
+
22
+ class LayerDemoComponent {
23
+ constructor(formBuilder, _textLayerService) {
24
+ this._textLayerService = _textLayerService;
25
+ this.textSize = 14;
26
+ this.locations = [];
27
+ this.text = formBuilder.control('alpha beta\ngamma\ndelta epsilon waw\nzeta');
28
+ this.location = formBuilder.control('1.2@2x2');
29
+ this.rendition = formBuilder.group({
30
+ text: this.text,
31
+ location: this.location,
32
+ });
33
+ this.result = '';
34
+ }
35
+ makeLarger() {
36
+ const size = this.textSize + 2;
37
+ if (size > 24) {
38
+ return;
39
+ }
40
+ this.textSize = size;
41
+ }
42
+ makeSmaller() {
43
+ const size = this.textSize - 2;
44
+ if (size < 12) {
45
+ return;
46
+ }
47
+ this.textSize = size;
48
+ }
49
+ removeOverlaps(loc) {
50
+ for (let i = this.locations.length - 1; i > -1; i--) {
51
+ if (loc === this.locations[i]) {
52
+ continue;
53
+ }
54
+ if (loc.overlaps(this.locations[i])) {
55
+ this.locations.splice(i, 1);
56
+ }
57
+ }
58
+ }
59
+ addLocation() {
60
+ if (!this.location.value) {
61
+ return;
62
+ }
63
+ const loc = TokenLocation.parse(this.location.value);
64
+ if (!loc) {
65
+ return;
66
+ }
67
+ let done = false;
68
+ for (let i = 0; i < this.locations.length && !done; i++) {
69
+ const n = loc.compareTo(this.locations[i]);
70
+ // nothing to do if equal
71
+ if (n === 0) {
72
+ return;
73
+ }
74
+ // insert before nearest bigger sort value
75
+ if (n < 0) {
76
+ this.locations.splice(i, 0, loc);
77
+ done = true;
78
+ }
79
+ }
80
+ // append if not yet inserted
81
+ if (!done) {
82
+ this.locations.push(loc);
83
+ }
84
+ // remove all the overlapping locations
85
+ this.removeOverlaps(loc);
86
+ }
87
+ removeLocation(loc) {
88
+ const i = this.locations.indexOf(loc);
89
+ if (i > -1) {
90
+ this.locations.splice(i, 1);
91
+ }
92
+ }
93
+ clearLocations() {
94
+ this.locations.length = 0;
95
+ }
96
+ render() {
97
+ this.result = this._textLayerService.render(this.text.value, this.locations);
98
+ }
99
+ getLocationForNew() {
100
+ this.userLocation = this._textLayerService.getSelectedLocationForNew(this._textLayerService.getSelectedRange(), this.text.value) || undefined;
101
+ }
102
+ getLocationForEdit() {
103
+ this.userLocation = this._textLayerService.getSelectedLocationForEdit(this._textLayerService.getSelectedRange()) || undefined;
104
+ }
105
+ }
106
+ LayerDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayerDemoComponent, deps: [{ token: i1.FormBuilder }, { token: i2.TextLayerService }], target: i0.ɵɵFactoryTarget.Component });
107
+ LayerDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", 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 } });
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: LayerDemoComponent, decorators: [{
109
+ type: Component,
110
+ 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
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.TextLayerService }]; }, propDecorators: { _resultElement: [{
112
+ type: ViewChild,
113
+ args: ['resultElem']
114
+ }] } });
115
+
116
+ // https://github.com/ng-packagr/ng-packagr/issues/778
117
+ const RouterModuleForChild = RouterModule.forChild([
118
+ { path: '', pathMatch: 'full', component: LayerDemoComponent },
119
+ ]);
120
+ class CadmusLayerDemoModule {
121
+ }
122
+ CadmusLayerDemoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
123
+ CadmusLayerDemoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, declarations: [LayerDemoComponent], imports: [CommonModule,
124
+ FormsModule,
125
+ ReactiveFormsModule, i1$1.RouterModule,
126
+ // cadmus
127
+ CadmusCoreModule,
128
+ CadmusMaterialModule,
129
+ CadmusUiModule], exports: [LayerDemoComponent] });
130
+ CadmusLayerDemoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, imports: [[
131
+ CommonModule,
132
+ FormsModule,
133
+ ReactiveFormsModule,
134
+ RouterModuleForChild,
135
+ // cadmus
136
+ CadmusCoreModule,
137
+ CadmusMaterialModule,
138
+ CadmusUiModule,
139
+ ]] });
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CadmusLayerDemoModule, decorators: [{
141
+ type: NgModule,
142
+ args: [{
143
+ imports: [
144
+ CommonModule,
145
+ FormsModule,
146
+ ReactiveFormsModule,
147
+ RouterModuleForChild,
148
+ // cadmus
149
+ CadmusCoreModule,
150
+ CadmusMaterialModule,
151
+ CadmusUiModule,
152
+ ],
153
+ declarations: [LayerDemoComponent],
154
+ exports: [LayerDemoComponent],
155
+ }]
156
+ }] });
157
+
158
+ /*
159
+ * Public API Surface of cadmus-layer-demo
160
+ */
161
+
162
+ /**
163
+ * Generated bundle index. Do not edit.
164
+ */
165
+
166
+ export { CadmusLayerDemoModule, LayerDemoComponent, RouterModuleForChild };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"myrmidon-cadmus-layer-demo.mjs","sources":["../../../../projects/myrmidon/cadmus-layer-demo/src/lib/layer-demo/layer-demo.component.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/lib/layer-demo/layer-demo.component.html","../../../../projects/myrmidon/cadmus-layer-demo/src/lib/cadmus-layer-demo.module.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/public-api.ts","../../../../projects/myrmidon/cadmus-layer-demo/src/myrmidon-cadmus-layer-demo.ts"],"sourcesContent":["import { Component, ViewChild, ElementRef } from '@angular/core';\r\nimport { FormGroup, FormControl, FormBuilder } from '@angular/forms';\r\nimport { TextLayerService, TokenLocation } from '@myrmidon/cadmus-core';\r\n\r\n@Component({\r\n selector: 'cadmus-layer-demo',\r\n templateUrl: './layer-demo.component.html',\r\n styleUrls: ['./layer-demo.component.css'],\r\n})\r\nexport class LayerDemoComponent {\r\n @ViewChild('resultElem') _resultElement?: ElementRef;\r\n\r\n public locations: TokenLocation[];\r\n public result: string;\r\n public userLocation?: TokenLocation;\r\n // form\r\n public rendition: FormGroup;\r\n public text: FormControl;\r\n public location: FormControl;\r\n\r\n public textSize: number;\r\n\r\n constructor(\r\n formBuilder: FormBuilder,\r\n private _textLayerService: TextLayerService\r\n ) {\r\n this.textSize = 14;\r\n this.locations = [];\r\n this.text = formBuilder.control(\r\n 'alpha beta\\ngamma\\ndelta epsilon waw\\nzeta'\r\n );\r\n this.location = formBuilder.control('1.2@2x2');\r\n this.rendition = formBuilder.group({\r\n text: this.text,\r\n location: this.location,\r\n });\r\n this.result = '';\r\n }\r\n\r\n public makeLarger(): void {\r\n const size = this.textSize + 2;\r\n if (size > 24) {\r\n return;\r\n }\r\n this.textSize = size;\r\n }\r\n\r\n public makeSmaller(): void {\r\n const size = this.textSize - 2;\r\n if (size < 12) {\r\n return;\r\n }\r\n this.textSize = size;\r\n }\r\n\r\n private removeOverlaps(loc: TokenLocation): void {\r\n for (let i = this.locations.length - 1; i > -1; i--) {\r\n if (loc === this.locations[i]) {\r\n continue;\r\n }\r\n if (loc.overlaps(this.locations[i])) {\r\n this.locations.splice(i, 1);\r\n }\r\n }\r\n }\r\n\r\n public addLocation(): void {\r\n if (!this.location.value) {\r\n return;\r\n }\r\n const loc = TokenLocation.parse(this.location.value);\r\n if (!loc) {\r\n return;\r\n }\r\n\r\n let done = false;\r\n for (let i = 0; i < this.locations.length && !done; i++) {\r\n const n = loc.compareTo(this.locations[i]);\r\n // nothing to do if equal\r\n if (n === 0) {\r\n return;\r\n }\r\n // insert before nearest bigger sort value\r\n if (n < 0) {\r\n this.locations.splice(i, 0, loc);\r\n done = true;\r\n }\r\n }\r\n // append if not yet inserted\r\n if (!done) {\r\n this.locations.push(loc);\r\n }\r\n\r\n // remove all the overlapping locations\r\n this.removeOverlaps(loc);\r\n }\r\n\r\n public removeLocation(loc: TokenLocation): void {\r\n const i = this.locations.indexOf(loc);\r\n if (i > -1) {\r\n this.locations.splice(i, 1);\r\n }\r\n }\r\n\r\n public clearLocations(): void {\r\n this.locations.length = 0;\r\n }\r\n\r\n public render(): void {\r\n this.result = this._textLayerService.render(\r\n this.text.value,\r\n this.locations\r\n );\r\n }\r\n\r\n public getLocationForNew(): void {\r\n this.userLocation = this._textLayerService.getSelectedLocationForNew(\r\n this._textLayerService.getSelectedRange()!,\r\n this.text.value\r\n ) || undefined;\r\n }\r\n\r\n public getLocationForEdit(): void {\r\n this.userLocation = this._textLayerService.getSelectedLocationForEdit(\r\n this._textLayerService.getSelectedRange()!\r\n ) || undefined;\r\n }\r\n}\r\n","<mat-card>\r\n <mat-card-header>\r\n <h2>Layered Text Demo</h2>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <article>\r\n <p>\r\n Enter some base text and zero or more layer fragments locations, then\r\n click the render button. This renders the base text with all its ranges.\r\n </p>\r\n <p>\r\n Once the text has been decorated, select any portion of it, either\r\n including a decorated part, or not. Then, if you selected a part\r\n including decorations, click the location button with the checkmark\r\n (=get the location of the fragment to edit); else, click the location\r\n button with the plus (=get the location of a new fragment).\r\n </p>\r\n <p>\r\n This will show you the token-based coordinates corresponding to your\r\n selection, provided that if you include any portion of a decorated text\r\n you will get the full coordinates of the decoration; otherwise, you will\r\n just get the coordinates of the selected character(s).\r\n </p>\r\n <p>\r\n This behavior is used to allow users edit existing part fragments by\r\n just selecting any part of it, even partially; while they must be\r\n precise when they are creating a new fragment.\r\n </p>\r\n </article>\r\n <hr />\r\n\r\n <form [formGroup]=\"rendition\" (ngSubmit)=\"render()\">\r\n <div>\r\n <mat-form-field>\r\n <textarea\r\n matInput\r\n type=\"text\"\r\n id=\"text\"\r\n maxlength=\"1000\"\r\n spellcheck=\"false\"\r\n placeholder=\"enter the base text\"\r\n formControlName=\"text\"\r\n ></textarea>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-form-field>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"location\"\r\n required\r\n spellcheck=\"false\"\r\n placeholder=\"location: Y.X@AxR\"\r\n formControlName=\"location\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-toolbar>\r\n <span>\r\n <button\r\n mat-icon-button\r\n (click)=\"addLocation()\"\r\n type=\"button\"\r\n matTooltip=\"Add the specified location\"\r\n >\r\n <mat-icon style=\"color: #66cc75\">add_circle</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"clearLocations()\"\r\n type=\"button\"\r\n matTooltip=\"Remove all the locations\"\r\n >\r\n <mat-icon>delete_sweep</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n color=\"primary\"\r\n type=\"submit\"\r\n matTooltip=\"Render the decorated base text\"\r\n >\r\n <mat-icon>play_circle_outline</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForNew()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for new item\"\r\n >\r\n <mat-icon>playlist_add</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n (click)=\"getLocationForEdit()\"\r\n type=\"button\"\r\n matTooltip=\"Get location for selected item\"\r\n >\r\n <mat-icon>playlist_add_check</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Larger text\"\r\n (click)=\"makeLarger()\"\r\n [disabled]=\"textSize >= 24\"\r\n >\r\n <mat-icon>format_size</mat-icon>\r\n </button>\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n matTooltip=\"Smaller text\"\r\n (click)=\"makeSmaller()\"\r\n [disabled]=\"textSize <= 12\"\r\n >\r\n <mat-icon>text_fields</mat-icon>\r\n </button>\r\n </span>\r\n <span class=\"tb-fill-remaining-space\"></span>\r\n <span>{{ userLocation }}</span>\r\n </mat-toolbar>\r\n </div>\r\n\r\n <table>\r\n <tbody>\r\n <tr *ngFor=\"let loc of locations\">\r\n <td>\r\n <button\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"removeLocation(loc)\"\r\n >\r\n <mat-icon>remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ loc.toString() }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </form>\r\n </mat-card-content>\r\n</mat-card>\r\n\r\n<mat-card>\r\n <mat-card-header>\r\n <h3>Rendition</h3>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div\r\n [style.font-size]=\"textSize + 'px'\"\r\n [innerHtml]=\"result | safeHtml: 'html'\"\r\n id=\"result\"\r\n #resultElem\r\n ></div>\r\n <hr />\r\n <div>\r\n <code>{{ result }}</code>\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { RouterModule } from '@angular/router';\r\n\r\nimport { 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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