@myrmidon/cadmus-core 10.1.0 → 12.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 +7 -24
- package/fesm2022/myrmidon-cadmus-core.mjs +32 -35
- package/fesm2022/myrmidon-cadmus-core.mjs.map +1 -1
- package/index.d.ts +673 -3
- package/package.json +4 -4
- package/lib/cadmus-core.module.d.ts +0 -8
- package/lib/guards/pending-changes.guard.d.ts +0 -18
- package/lib/models.d.ts +0 -286
- package/lib/pipes/sort.pipe.d.ts +0 -10
- package/lib/services/library-route.service.d.ts +0 -123
- package/lib/services/text-layer.service.d.ts +0 -161
- package/lib/text-range.d.ts +0 -36
- package/lib/token-location.d.ts +0 -18
- package/lib/token-point.d.ts +0 -19
- package/public-api.d.ts +0 -9
package/index.d.ts
CHANGED
|
@@ -1,5 +1,675 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DialogService } from '@myrmidon/ngx-mat-tools';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { PipeTransform } from '@angular/core';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
|
-
*
|
|
7
|
+
* Interface implemented by versioned storage objects.
|
|
3
8
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
9
|
+
interface HasVersion {
|
|
10
|
+
timeCreated: Date;
|
|
11
|
+
creatorId: string;
|
|
12
|
+
timeModified: Date;
|
|
13
|
+
userId: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Item's properties, excluding its parts.
|
|
17
|
+
*/
|
|
18
|
+
interface Item extends HasVersion {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
facetId: string;
|
|
23
|
+
groupId: string;
|
|
24
|
+
sortKey: string;
|
|
25
|
+
flags: number;
|
|
26
|
+
parts?: Part[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Flags matching mode.
|
|
30
|
+
*/
|
|
31
|
+
declare enum FlagMatching {
|
|
32
|
+
none = -1,
|
|
33
|
+
bitsAllSet = 0,
|
|
34
|
+
bitsAnySet = 1,
|
|
35
|
+
bitsAllClear = 2,
|
|
36
|
+
bitsAnyClear = 3
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Filter for items.
|
|
40
|
+
*/
|
|
41
|
+
interface ItemFilter {
|
|
42
|
+
title?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
facetId?: string;
|
|
45
|
+
groupId?: string;
|
|
46
|
+
flags?: number;
|
|
47
|
+
flagMatching?: FlagMatching;
|
|
48
|
+
minModified?: Date;
|
|
49
|
+
maxModified?: Date;
|
|
50
|
+
userId?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Essential information about an item.
|
|
54
|
+
*/
|
|
55
|
+
interface ItemInfo extends HasVersion {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description: string;
|
|
59
|
+
facetId: string;
|
|
60
|
+
groupId: string;
|
|
61
|
+
sortKey: string;
|
|
62
|
+
flags: number;
|
|
63
|
+
payload?: any;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Information about a data pin; returned by pins search.
|
|
67
|
+
*/
|
|
68
|
+
interface DataPinInfo {
|
|
69
|
+
itemId: string;
|
|
70
|
+
partId: string;
|
|
71
|
+
roleId: string | null;
|
|
72
|
+
partTypeId: string;
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
tag?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Data pin value type in a DataPinDefinition.
|
|
79
|
+
*/
|
|
80
|
+
declare enum DataPinValueType {
|
|
81
|
+
string = 0,
|
|
82
|
+
boolean = 1,
|
|
83
|
+
integer = 2,
|
|
84
|
+
decimal = 3
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Definition of a data pin.
|
|
88
|
+
*/
|
|
89
|
+
interface DataPinDefinition {
|
|
90
|
+
name: string;
|
|
91
|
+
type: DataPinValueType;
|
|
92
|
+
tip?: string;
|
|
93
|
+
attributes?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Part type and role IDs.
|
|
97
|
+
*/
|
|
98
|
+
interface PartTypeIds {
|
|
99
|
+
typeId: string;
|
|
100
|
+
roleId?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Part. This is the minimal set of properties present in all the
|
|
104
|
+
* parts. Each part then adds its own properties, extending this interface.
|
|
105
|
+
*/
|
|
106
|
+
interface Part extends HasVersion, PartTypeIds {
|
|
107
|
+
id: string;
|
|
108
|
+
itemId: string;
|
|
109
|
+
thesaurusScope?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Essential information about a layer part.
|
|
113
|
+
*/
|
|
114
|
+
interface LayerPartInfo extends HasVersion, PartTypeIds {
|
|
115
|
+
id: string;
|
|
116
|
+
itemId: string;
|
|
117
|
+
fragmentCount: number;
|
|
118
|
+
isAbsent: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Text layer fragment. This is the minimal set of properties present in all the
|
|
122
|
+
* fragments. Each fragment then adds its own properties, extending this
|
|
123
|
+
* interface.
|
|
124
|
+
* Every fragment has a location, and can be enriched with the corresponding
|
|
125
|
+
* base text when used in views.
|
|
126
|
+
*/
|
|
127
|
+
interface Fragment {
|
|
128
|
+
location: string;
|
|
129
|
+
baseText?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Text layer part. This represents a special type of part,
|
|
133
|
+
* whose only content is a collection of fragments.
|
|
134
|
+
*/
|
|
135
|
+
interface TextLayerPart extends Part {
|
|
136
|
+
fragments: Fragment[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A text line in a base text part.
|
|
140
|
+
*/
|
|
141
|
+
interface TokenTextLayerLine {
|
|
142
|
+
y: number;
|
|
143
|
+
tokens: string[];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Token-based text coordinates.
|
|
147
|
+
*/
|
|
148
|
+
interface TextCoords {
|
|
149
|
+
y: number;
|
|
150
|
+
x: number;
|
|
151
|
+
at?: number;
|
|
152
|
+
run?: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Layer reconciliation hint for a single fragment.
|
|
156
|
+
*/
|
|
157
|
+
interface LayerHint {
|
|
158
|
+
location: string;
|
|
159
|
+
editOperation: string;
|
|
160
|
+
patchOperation?: string;
|
|
161
|
+
impactLevel: number;
|
|
162
|
+
description?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A single entry in a thesaurus.
|
|
166
|
+
*/
|
|
167
|
+
interface ThesaurusEntry {
|
|
168
|
+
id: string;
|
|
169
|
+
value: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* A set of thesaurus entries.
|
|
173
|
+
*/
|
|
174
|
+
interface Thesaurus {
|
|
175
|
+
id: string;
|
|
176
|
+
language?: string;
|
|
177
|
+
targetId?: string;
|
|
178
|
+
entries?: ThesaurusEntry[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A set of thesauri which get passed to an editor component.
|
|
182
|
+
* In the set, each thesaurus is identified by an arbitrarily
|
|
183
|
+
* defined key, which is unique only within the context of the editor
|
|
184
|
+
* consuming the set, and refers to frontend only.
|
|
185
|
+
*/
|
|
186
|
+
interface ThesauriSet {
|
|
187
|
+
[key: string]: Thesaurus;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Filter for thesauri.
|
|
191
|
+
*/
|
|
192
|
+
interface ThesaurusFilter {
|
|
193
|
+
id?: string;
|
|
194
|
+
isAlias?: boolean;
|
|
195
|
+
language?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Part definition in a facet.
|
|
199
|
+
*/
|
|
200
|
+
interface PartDefinition extends PartTypeIds {
|
|
201
|
+
name: string;
|
|
202
|
+
description?: string;
|
|
203
|
+
isRequired?: boolean;
|
|
204
|
+
colorKey?: string;
|
|
205
|
+
groupKey?: string;
|
|
206
|
+
sortKey?: string;
|
|
207
|
+
settings?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Fragment definition in a facet.
|
|
211
|
+
*/
|
|
212
|
+
/**
|
|
213
|
+
* Facet definition.
|
|
214
|
+
*/
|
|
215
|
+
interface FacetDefinition {
|
|
216
|
+
id: string;
|
|
217
|
+
label: string;
|
|
218
|
+
colorKey: string;
|
|
219
|
+
description: string;
|
|
220
|
+
partDefinitions: PartDefinition[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Flag definition.
|
|
224
|
+
*/
|
|
225
|
+
interface FlagDefinition {
|
|
226
|
+
id: number;
|
|
227
|
+
label: string;
|
|
228
|
+
description: string;
|
|
229
|
+
colorKey: string;
|
|
230
|
+
isAdmin?: boolean;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The group key for a part type. This is used in EditorKeys objects
|
|
234
|
+
* to map a specific part ID with all its fragment IDs into group key(s).
|
|
235
|
+
* The part ID is used alone with normal parts; for layer parts, it is
|
|
236
|
+
* used in conjunction with 1 or more fragment type IDs, each mapped to
|
|
237
|
+
* a corresponding editor key.
|
|
238
|
+
*/
|
|
239
|
+
interface PartGroupKey {
|
|
240
|
+
part: string;
|
|
241
|
+
fragments?: {
|
|
242
|
+
[key: string]: string;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Part type IDs to editor keys mappings. This contains a set of component
|
|
247
|
+
* type IDs (parts and parts + fragments) mapped to editor keys, which are
|
|
248
|
+
* used to build their routes in the UI.
|
|
249
|
+
*/
|
|
250
|
+
interface PartEditorKeys {
|
|
251
|
+
[key: string]: PartGroupKey;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* An index lookup definition, used in dynamic lookup to provide the set
|
|
255
|
+
* of parameters required for a data pins based search.
|
|
256
|
+
*/
|
|
257
|
+
interface IndexLookupDefinition {
|
|
258
|
+
typeId?: string;
|
|
259
|
+
roleId?: string;
|
|
260
|
+
name: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* A dictionary of index lookup definitions.
|
|
264
|
+
*/
|
|
265
|
+
interface IndexLookupDefinitions {
|
|
266
|
+
[key: string]: IndexLookupDefinition;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* A group of parts. Usually the item's parts are grouped according
|
|
270
|
+
* to their metadata, and presented in this way.
|
|
271
|
+
*/
|
|
272
|
+
interface PartGroup {
|
|
273
|
+
key: string;
|
|
274
|
+
label: string;
|
|
275
|
+
parts: Part[];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Essential information about a user.
|
|
279
|
+
*/
|
|
280
|
+
interface UserInfo {
|
|
281
|
+
userName: string;
|
|
282
|
+
firstName: string;
|
|
283
|
+
lastName: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Login credentials.
|
|
287
|
+
*/
|
|
288
|
+
interface LoginCredentials {
|
|
289
|
+
name: string;
|
|
290
|
+
password: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* A simple text range, expressed as start character index and characters
|
|
295
|
+
* length. This is used for misspellings operations.
|
|
296
|
+
*/
|
|
297
|
+
declare class TextRange {
|
|
298
|
+
/**
|
|
299
|
+
* The start character index.
|
|
300
|
+
*/
|
|
301
|
+
start: number;
|
|
302
|
+
/**
|
|
303
|
+
* The length in characters.
|
|
304
|
+
*/
|
|
305
|
+
length: number;
|
|
306
|
+
/**
|
|
307
|
+
* Parse the specified text representing a range, in the form "startxlength"
|
|
308
|
+
* or just "start" when length is 1.
|
|
309
|
+
*
|
|
310
|
+
* @param text The text.
|
|
311
|
+
*/
|
|
312
|
+
static parse(text: string): TextRange | null;
|
|
313
|
+
constructor(start: number, length: number);
|
|
314
|
+
/**
|
|
315
|
+
* Get the inclusive end of the range.
|
|
316
|
+
*/
|
|
317
|
+
end(): number;
|
|
318
|
+
/**
|
|
319
|
+
* True if this range value is equal to the other range value.
|
|
320
|
+
* @param other The other range.
|
|
321
|
+
*/
|
|
322
|
+
isEqual(other: TextRange): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Get a parsable textual representation of this range.
|
|
325
|
+
* @returns Text.
|
|
326
|
+
*/
|
|
327
|
+
toString(): string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A single point in a token-based textual location.
|
|
332
|
+
*/
|
|
333
|
+
declare class TokenPoint {
|
|
334
|
+
y: number;
|
|
335
|
+
x: number;
|
|
336
|
+
at?: number;
|
|
337
|
+
run?: number;
|
|
338
|
+
/**
|
|
339
|
+
* Parse the specified text representing a token-based point location.
|
|
340
|
+
* @param text The text to parse, in the forms Y.X or Y.X@AxR or
|
|
341
|
+
* Y.X@A, where R=1.
|
|
342
|
+
*/
|
|
343
|
+
static parse(text: string): TokenPoint | null;
|
|
344
|
+
constructor(y: number, x: number, at?: number, run?: number);
|
|
345
|
+
toString(): string;
|
|
346
|
+
compareTo(other: TokenPoint): number;
|
|
347
|
+
integralCompareTo(other: TokenPoint): number;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
declare class TokenLocation {
|
|
351
|
+
primary: TokenPoint;
|
|
352
|
+
secondary?: TokenPoint;
|
|
353
|
+
/**
|
|
354
|
+
* Parse the text representing a token-based location,
|
|
355
|
+
* which has the form "primary-secondary", or just "primary",
|
|
356
|
+
* where each of these points has the format required by
|
|
357
|
+
* TokenPoint.parse (e.g. Y.X or Y.X@AxR or Y.X@A, where R=1).
|
|
358
|
+
* @param text The text to parse.
|
|
359
|
+
*/
|
|
360
|
+
static parse(text: string): TokenLocation | null;
|
|
361
|
+
constructor(primary: TokenPoint, secondary?: TokenPoint);
|
|
362
|
+
isRange(): boolean;
|
|
363
|
+
toString(): string;
|
|
364
|
+
compareTo(other: TokenLocation): number;
|
|
365
|
+
overlaps(other: TokenLocation): boolean;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Interface implemented by those components which require a pending changes
|
|
370
|
+
* guard. The implementor must keep its canDeactivate property up to date,
|
|
371
|
+
* so that it reflects its dirty state.
|
|
372
|
+
*/
|
|
373
|
+
interface ComponentCanDeactivate {
|
|
374
|
+
canDeactivate: () => boolean | Observable<boolean>;
|
|
375
|
+
}
|
|
376
|
+
declare class PendingChangesGuard {
|
|
377
|
+
private _dialogService;
|
|
378
|
+
constructor(_dialogService: DialogService);
|
|
379
|
+
canDeactivate(component: ComponentCanDeactivate): boolean | Observable<boolean>;
|
|
380
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PendingChangesGuard, never>;
|
|
381
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PendingChangesGuard>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Sort pipe. Use like *ngFor="let i of items | sort:'propname'".
|
|
386
|
+
*/
|
|
387
|
+
declare class SortPipe implements PipeTransform {
|
|
388
|
+
transform(value: any[], propName: string): unknown;
|
|
389
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SortPipe, never>;
|
|
390
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SortPipe, "sort", true>;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Library route service.
|
|
395
|
+
* This service is used to build routes to part and fragment editors,
|
|
396
|
+
* which are hosted in an open list of library modules in the Cadmus
|
|
397
|
+
* application.
|
|
398
|
+
* This architecture allows lazy-loading part- and fragment-editors
|
|
399
|
+
* only when they are required.
|
|
400
|
+
* Each part type with its dumb UI editor component is located in a
|
|
401
|
+
* library, named after the name of the group the part belongs to. For
|
|
402
|
+
* instance, the model and dumb UI editor component for a part belonging
|
|
403
|
+
* to the "general" group are located in the "parts/general/general-ui"
|
|
404
|
+
* library.
|
|
405
|
+
* In turn, the feature UI editor component for the same part is located
|
|
406
|
+
* in the "parts/general/general-feature" library. This library has
|
|
407
|
+
* a route for each part editor. For instance, the NotePart editor
|
|
408
|
+
* component route is "items/:iid/general/it.vedph.note/:pid", where
|
|
409
|
+
* ":iid" is the item ID and ":pid" the part ID.
|
|
410
|
+
*/
|
|
411
|
+
declare class LibraryRouteService {
|
|
412
|
+
private _partEditorKeys;
|
|
413
|
+
constructor(_partEditorKeys: PartEditorKeys);
|
|
414
|
+
/**
|
|
415
|
+
* Strip the eventual fragment-role ID from the specified part's role ID.
|
|
416
|
+
* For instance, a part's role ID like "fr.it.vedph.comment:scholarly"
|
|
417
|
+
* becomes "fr.it.vedph.comment".
|
|
418
|
+
*
|
|
419
|
+
* @param roleId The part's role ID.
|
|
420
|
+
*/
|
|
421
|
+
stripFragmentRoleId(roleId: string): string;
|
|
422
|
+
/**
|
|
423
|
+
* Get the fragment type and role from the part's role ID. This starts
|
|
424
|
+
* with "fr.", and might be followed by the role proper, introduced
|
|
425
|
+
* by the first dot if any. For instance, "fr.it.vedph.comment" would just
|
|
426
|
+
* return "fr.it.vedph.comment", while "fr.it.vedph.comment:scholarly"
|
|
427
|
+
* would return "fr.it.vedph.comment". This is required to navigate to
|
|
428
|
+
* the correct fragment editor, which is the same for each fragment type,
|
|
429
|
+
* independently from its role.
|
|
430
|
+
* @param roleId The part role ID.
|
|
431
|
+
* @returns An object where frTypeId=fragment type ID and frRoleId=fragment role
|
|
432
|
+
* ID, or null.
|
|
433
|
+
*/
|
|
434
|
+
getFragmentTypeAndRole(roleId?: string): {
|
|
435
|
+
frTypeId: string;
|
|
436
|
+
frRoleId?: string;
|
|
437
|
+
} | null;
|
|
438
|
+
/**
|
|
439
|
+
* Find among the specified parts definitions the one matching the specified
|
|
440
|
+
* type ID, and eventually role ID when specified.
|
|
441
|
+
*
|
|
442
|
+
* @param partDefs The parts definitions.
|
|
443
|
+
* @param typeId The type ID.
|
|
444
|
+
* @param roleId The role ID or null.
|
|
445
|
+
* @returns Part definition or undefined if not found.
|
|
446
|
+
*/
|
|
447
|
+
private findPartDefinition;
|
|
448
|
+
/**
|
|
449
|
+
* Get the library editor key from the specified part type, looking up
|
|
450
|
+
* the specified parts definitions.
|
|
451
|
+
*
|
|
452
|
+
* @param typeId The part's type ID.
|
|
453
|
+
* @param roleId The part's role ID.
|
|
454
|
+
*/
|
|
455
|
+
getEditorKeyFromPartType(typeId: string, roleId?: string): {
|
|
456
|
+
partKey: string;
|
|
457
|
+
frKey?: string;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Decompose the specified editor key into part and fragment.
|
|
461
|
+
* A simple editor key will just provide the same value for both.
|
|
462
|
+
*
|
|
463
|
+
* @param key The editor key to decompose.
|
|
464
|
+
*/
|
|
465
|
+
decomposeEditorKey(key: string): {
|
|
466
|
+
partKey: string;
|
|
467
|
+
frKey: string;
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* Build the route to the part editor corresponding to the specified
|
|
471
|
+
* part.
|
|
472
|
+
*
|
|
473
|
+
* A part editing route is like
|
|
474
|
+
* "/items/<id>/<part-group>/<part-typeid>/<part-id>?rid=<role-id>",
|
|
475
|
+
* where the role ID is optional, and may include the fragment role ID
|
|
476
|
+
* as a suffix preceded by a colon.
|
|
477
|
+
*
|
|
478
|
+
* A fragment editing route is like
|
|
479
|
+
* "/items/<id>/<part-group>/fragment/<part-id>/<fr-typeid>/<loc>?frrid=<role-id>",
|
|
480
|
+
* where the role ID is as above, and the fragment's type ID is derived
|
|
481
|
+
* from the part's role ID, stripping the eventual fragment's role ID out.
|
|
482
|
+
*
|
|
483
|
+
* @param itemId The ID of the item the parts belongs to.
|
|
484
|
+
* @param partId The part's ID.
|
|
485
|
+
* @param typeId The part's type ID.
|
|
486
|
+
* @param roleId The optional part's role ID.
|
|
487
|
+
* @returns Object with a route property and an optional rid property
|
|
488
|
+
* representing the role ID, which will be rendered as a query parameter.
|
|
489
|
+
*/
|
|
490
|
+
buildPartEditorRoute(itemId: string, partId: string, typeId: string, roleId?: string): {
|
|
491
|
+
route: string;
|
|
492
|
+
rid?: string;
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Build the route to the fragment editor corresponding to the specified
|
|
496
|
+
* layers part and location.
|
|
497
|
+
*
|
|
498
|
+
* @param partDefs The parts definitions.
|
|
499
|
+
* @param itemId The ID of the item the parts belongs to.
|
|
500
|
+
* @param partId The part's ID.
|
|
501
|
+
* @param typeId The part's type ID.
|
|
502
|
+
* @param roleId The part's role ID.
|
|
503
|
+
* @param loc The fragment's location.
|
|
504
|
+
* @returns Object with a route property and an optional rid property
|
|
505
|
+
* representing the role ID, which will be rendered as a query parameter.
|
|
506
|
+
*/
|
|
507
|
+
buildFragmentEditorRoute(partDefs: PartDefinition[], itemId: string, partId: string, typeId: string, roleId: string | undefined, loc: string): {
|
|
508
|
+
route: string;
|
|
509
|
+
rid?: string;
|
|
510
|
+
};
|
|
511
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibraryRouteService, never>;
|
|
512
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LibraryRouteService>;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* The selected range of text. This reflects Range useful properties;
|
|
517
|
+
* in fact, you can just pass a Range to any method requiring this parameter type,
|
|
518
|
+
* but this adds a level of indirection useful in testing.
|
|
519
|
+
*/
|
|
520
|
+
interface SelectedRange {
|
|
521
|
+
commonAncestorContainer: Node;
|
|
522
|
+
startContainer: Node;
|
|
523
|
+
startOffset: number;
|
|
524
|
+
endContainer: Node;
|
|
525
|
+
endOffset: number;
|
|
526
|
+
}
|
|
527
|
+
declare class TextLayerService {
|
|
528
|
+
private readonly _wsRegex;
|
|
529
|
+
constructor();
|
|
530
|
+
private isWhitespace;
|
|
531
|
+
/**
|
|
532
|
+
* Extract the lines with their tokens from the specified text.
|
|
533
|
+
* @param text the source text.
|
|
534
|
+
* @returns lines.
|
|
535
|
+
*/
|
|
536
|
+
getLines(text: string): TokenTextLayerLine[];
|
|
537
|
+
/**
|
|
538
|
+
* Get the fragment of text defined by the specified location.
|
|
539
|
+
*
|
|
540
|
+
* @param text The full base text.
|
|
541
|
+
* @param location The location to get text for.
|
|
542
|
+
* @returns A fragment of text corresponding to location.
|
|
543
|
+
*/
|
|
544
|
+
getTextFragment(text: string, location: TokenLocation): string;
|
|
545
|
+
/**
|
|
546
|
+
* Render the opening span for a layer fragment.
|
|
547
|
+
* @param loc location.
|
|
548
|
+
* @param locPortion the index of the token's portion (0-N). This is used
|
|
549
|
+
* to build a unique ID for each HTML span rendering a layer fragment.
|
|
550
|
+
* @param sb the target strings array.
|
|
551
|
+
* @param isSelected true if selected.
|
|
552
|
+
*/
|
|
553
|
+
private renderOpeningSpan;
|
|
554
|
+
/**
|
|
555
|
+
* Render the specified token intersecting the specified end-fragment location.
|
|
556
|
+
* @param pt The point.
|
|
557
|
+
* @param token The token.
|
|
558
|
+
* @param sb The target array.
|
|
559
|
+
*/
|
|
560
|
+
private renderTokenAtEnd;
|
|
561
|
+
/**
|
|
562
|
+
* Render the specified token intersecting the specified single-point location.
|
|
563
|
+
* The received token starts and ends a single-token range.
|
|
564
|
+
* @param loc location.
|
|
565
|
+
* @param token token.
|
|
566
|
+
* @param sb target strings array.
|
|
567
|
+
* @param isSelected True if the token is selected.
|
|
568
|
+
*/
|
|
569
|
+
private renderTokenAtPointStart;
|
|
570
|
+
/**
|
|
571
|
+
* Render the specified token intersecting the specified range start location.
|
|
572
|
+
* The received token starts a multi-tokens range.
|
|
573
|
+
* @param loc location.
|
|
574
|
+
* @param token token.
|
|
575
|
+
* @param sb target strings array.
|
|
576
|
+
* @param isSelected True if the token is selected.
|
|
577
|
+
*/
|
|
578
|
+
private renderTokenAtRangeStart;
|
|
579
|
+
private renderTokenAtStart;
|
|
580
|
+
/**
|
|
581
|
+
* Render to HTML the base text decorated with its layer fragments.
|
|
582
|
+
* @param text The base text.
|
|
583
|
+
* @param locations The locations of all the fragments
|
|
584
|
+
* of the same type to be rendered on top of the base text.
|
|
585
|
+
* @param selectedLoc The optional location of the selected
|
|
586
|
+
* fragment if any. The selected fragment gets decorated with an additional
|
|
587
|
+
* class value.
|
|
588
|
+
*/
|
|
589
|
+
render(text: string, locations?: TokenLocation[], selectedLoc?: TokenLocation): string;
|
|
590
|
+
/**
|
|
591
|
+
* Get the Y bounds from the specified selection.
|
|
592
|
+
* @param range The selection range.
|
|
593
|
+
* @param forNew True if getting bounds for a new fragment.
|
|
594
|
+
* @returns Range, inclusive, or undefined.
|
|
595
|
+
*/
|
|
596
|
+
private getYBoundsFromRange;
|
|
597
|
+
private locatePrevSpace;
|
|
598
|
+
private locateNextSpace;
|
|
599
|
+
/**
|
|
600
|
+
* Get the bounds of the token any character of which is indexed
|
|
601
|
+
* by index.
|
|
602
|
+
* @param line The text line.
|
|
603
|
+
* @param index The index to the text line to start from.
|
|
604
|
+
* @returns Bounds where start=index of the first character of the token,
|
|
605
|
+
* and end=index of the character past the token's last character;
|
|
606
|
+
* or null if index was not valid.
|
|
607
|
+
*/
|
|
608
|
+
private getTokenBounds;
|
|
609
|
+
/**
|
|
610
|
+
* Return the received selection bounds, adjusted to exclude spaces.
|
|
611
|
+
*/
|
|
612
|
+
private getAdjustedSelectionBounds;
|
|
613
|
+
/**
|
|
614
|
+
* Get the start coordinates for the selected range and line.
|
|
615
|
+
* @param range The selected range.
|
|
616
|
+
* @param line The reference text line.
|
|
617
|
+
*/
|
|
618
|
+
private getStartCoordsFromRange;
|
|
619
|
+
private getEndCoordsFromRange;
|
|
620
|
+
private getSpanLocFromId;
|
|
621
|
+
private visitNodes;
|
|
622
|
+
private findFirstDescendantSpan;
|
|
623
|
+
/**
|
|
624
|
+
* Get the base offset for the specified node. This is used
|
|
625
|
+
* when the start container of the selected range has any
|
|
626
|
+
* preceding sibling node, which happens only when you have
|
|
627
|
+
* any spans in the p element (=the line). In this case,
|
|
628
|
+
* the selection offset starts from the start container node,
|
|
629
|
+
* which is preceded by other nodes including other text.
|
|
630
|
+
* As we must get the line-based offset, we have to start
|
|
631
|
+
* from a base offset equal to the sum of the lengths of
|
|
632
|
+
* all the preceding siblings.
|
|
633
|
+
*/
|
|
634
|
+
private getNodeBaseOffset;
|
|
635
|
+
/**
|
|
636
|
+
* Get the location corresponding to the user selection,
|
|
637
|
+
* for editing the first fragment included in it.
|
|
638
|
+
* @param range The selected range. You can get it from the
|
|
639
|
+
* current selection using getSelectedRange().
|
|
640
|
+
* @returns The token location or null.
|
|
641
|
+
*/
|
|
642
|
+
getSelectedLocationForEdit(range: SelectedRange): TokenLocation | null;
|
|
643
|
+
private textLineToString;
|
|
644
|
+
private buildCoords;
|
|
645
|
+
/**
|
|
646
|
+
* Recursively find the node matching the specified matcher
|
|
647
|
+
* function, starting from the specified node (included).
|
|
648
|
+
*
|
|
649
|
+
* @param node The node to start from.
|
|
650
|
+
* @param matcher The matcher function, which receives a node
|
|
651
|
+
* to match, and returns 1=match, 0=no match, -1=stop the
|
|
652
|
+
* find operation with a no match.
|
|
653
|
+
* @return 1=match, 0=no match, -1=stop the find operation with a no match.
|
|
654
|
+
*/
|
|
655
|
+
private matchNode;
|
|
656
|
+
private selHasAnySpan;
|
|
657
|
+
/**
|
|
658
|
+
* Get the location corresponding to the user selection,
|
|
659
|
+
* for adding a new fragment with the same extension.
|
|
660
|
+
* @param range The selected range. You can get it from the
|
|
661
|
+
* current selection using getSelectedRange().
|
|
662
|
+
* @param text The full base text.
|
|
663
|
+
* @returns TokenLocation The token location or undefined.
|
|
664
|
+
*/
|
|
665
|
+
getSelectedLocationForNew(range: SelectedRange, text: string): TokenLocation | null;
|
|
666
|
+
/**
|
|
667
|
+
* Get the currently selected range in the browser's document.
|
|
668
|
+
*/
|
|
669
|
+
getSelectedRange(): Range | null;
|
|
670
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextLayerService, never>;
|
|
671
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TextLayerService>;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export { DataPinValueType, FlagMatching, LibraryRouteService, PendingChangesGuard, SortPipe, TextLayerService, TextRange, TokenLocation, TokenPoint };
|
|
675
|
+
export type { ComponentCanDeactivate, DataPinDefinition, DataPinInfo, FacetDefinition, FlagDefinition, Fragment, HasVersion, IndexLookupDefinition, IndexLookupDefinitions, Item, ItemFilter, ItemInfo, LayerHint, LayerPartInfo, LoginCredentials, Part, PartDefinition, PartEditorKeys, PartGroup, PartGroupKey, PartTypeIds, SelectedRange, TextCoords, TextLayerPart, ThesauriSet, Thesaurus, ThesaurusEntry, ThesaurusFilter, TokenTextLayerLine, UserInfo };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrmidon/cadmus-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Cadmus - core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Cadmus"
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"name": "Daniele Fusi"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@angular/common": "^
|
|
18
|
-
"@angular/core": "^
|
|
19
|
-
"@myrmidon/ngx-tools": "^
|
|
17
|
+
"@angular/common": "^20.0.0",
|
|
18
|
+
"@angular/core": "^20.0.0",
|
|
19
|
+
"@myrmidon/ngx-tools": "^2.0.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"tslib": "^2.3.0"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
import * as i1 from "./pipes/sort.pipe";
|
|
3
|
-
import * as i2 from "@angular/common";
|
|
4
|
-
export declare class CadmusCoreModule {
|
|
5
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CadmusCoreModule, never>;
|
|
6
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<CadmusCoreModule, [typeof i1.SortPipe], [typeof i2.CommonModule], [typeof i1.SortPipe]>;
|
|
7
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<CadmusCoreModule>;
|
|
8
|
-
}
|