@myrmidon/cadmus-core 0.2.0 → 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/lib/datation.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare class Datation implements DatationModel {
55
55
  * @param hint The hint or null/undefined.
56
56
  * @returns The sanitized hint or undefined.
57
57
  */
58
- static sanitizeHint(hint: string): string;
58
+ static sanitizeHint(hint: string): string | undefined;
59
59
  private static regexEscape;
60
60
  /**
61
61
  * Get BC and AD patterns for matching.
@@ -72,7 +72,7 @@ export declare class Datation implements DatationModel {
72
72
  * We do not want a non-existing point to be represented as a null,
73
73
  * as this would be included as in the JSON code when serializing.
74
74
  */
75
- static parse(text: string, options?: DatationFormatOptions): Datation | undefined;
75
+ static parse(text: string, options?: DatationFormatOptions): Datation | null;
76
76
  /**
77
77
  * Strip any era code from the specified datation format string.
78
78
  * @param format The format string.
@@ -19,20 +19,20 @@ export interface HistoricalDateModel {
19
19
  */
20
20
  export declare class HistoricalDate implements HistoricalDateModel {
21
21
  a: Datation;
22
- b: Datation;
22
+ b?: Datation;
23
23
  constructor(date?: HistoricalDateModel);
24
24
  /**
25
25
  * Parse the specified text representing a historical datation.
26
26
  * @param text The text to be parsed.
27
27
  * @param options The datation formatter options.
28
- * @return The datation, or null if invalid.
28
+ * @return The datation, or undefined if invalid.
29
29
  */
30
- static parse(text: string, options?: DatationFormatOptions): HistoricalDate;
31
- getStartPoint(): Datation;
30
+ static parse(text: string, options?: DatationFormatOptions): HistoricalDate | null;
31
+ getStartPoint(): Datation | undefined;
32
32
  setStartPoint(value: Datation): void;
33
- getEndPoint(): Datation;
33
+ getEndPoint(): Datation | undefined;
34
34
  setEndPoint(value: Datation): void;
35
- getSinglePoint(): Datation;
35
+ getSinglePoint(): Datation | undefined;
36
36
  setSinglePoint(value: Datation): void;
37
37
  /**
38
38
  * True if this date is undefined.
@@ -46,7 +46,7 @@ export declare class HistoricalDate implements HistoricalDateModel {
46
46
  * Validate this date.
47
47
  * @returns Error message if invalid, or null if valid.
48
48
  */
49
- validate(): string;
49
+ validate(): string | null;
50
50
  /**
51
51
  * Get the sort value for this date.
52
52
  */
package/lib/models.d.ts CHANGED
@@ -82,7 +82,7 @@ export interface DataPinDefinition {
82
82
  */
83
83
  export interface PartTypeIds {
84
84
  typeId: string;
85
- roleId: string | null;
85
+ roleId?: string;
86
86
  }
87
87
  /**
88
88
  * Part. This is the minimal set of properties present in all the
@@ -41,10 +41,10 @@ export declare class LibraryRouteService {
41
41
  * @returns An object where frTypeId=fragment type ID and frRoleId=fragment role
42
42
  * ID, or null.
43
43
  */
44
- getFragmentTypeAndRole(roleId: string): {
44
+ getFragmentTypeAndRole(roleId?: string): {
45
45
  frTypeId: string;
46
- frRoleId: string | null;
47
- };
46
+ frRoleId?: string;
47
+ } | null;
48
48
  /**
49
49
  * Find among the specified parts definitions the one matching the specified
50
50
  * type ID, and eventually role ID when specified.
@@ -52,7 +52,7 @@ export declare class LibraryRouteService {
52
52
  * @param partDefs The parts definitions.
53
53
  * @param typeId The type ID.
54
54
  * @param roleId The role ID or null.
55
- * @returns Part definition or null if not found.
55
+ * @returns Part definition or undefined if not found.
56
56
  */
57
57
  private findPartDefinition;
58
58
  /**
@@ -99,7 +99,7 @@ export declare class LibraryRouteService {
99
99
  */
100
100
  buildPartEditorRoute(itemId: string, partId: string, typeId: string, roleId?: string): {
101
101
  route: string;
102
- rid: string | null;
102
+ rid?: string;
103
103
  };
104
104
  /**
105
105
  * Build the route to the fragment editor corresponding to the specified
@@ -114,9 +114,9 @@ export declare class LibraryRouteService {
114
114
  * @returns Object with a route property and an optional rid property
115
115
  * representing the role ID, which will be rendered as a query parameter.
116
116
  */
117
- buildFragmentEditorRoute(partDefs: PartDefinition[], itemId: string, partId: string, typeId: string, roleId: string, loc: string): {
117
+ buildFragmentEditorRoute(partDefs: PartDefinition[], itemId: string, partId: string, typeId: string, roleId: string | undefined, loc: string): {
118
118
  route: string;
119
- rid: string | null;
119
+ rid?: string;
120
120
  };
121
121
  static ɵfac: i0.ɵɵFactoryDeclaration<LibraryRouteService, never>;
122
122
  static ɵprov: i0.ɵɵInjectableDeclaration<LibraryRouteService>;
@@ -69,12 +69,12 @@ export declare class TextLayerService {
69
69
  * fragment if any. The selected fragment gets decorated with an additional
70
70
  * class value.
71
71
  */
72
- render(text: string, locations: TokenLocation[], selectedLoc?: TokenLocation): string;
72
+ render(text: string, locations?: TokenLocation[], selectedLoc?: TokenLocation): string;
73
73
  /**
74
74
  * Get the Y bounds from the specified selection.
75
75
  * @param range The selection range.
76
76
  * @param forNew True if getting bounds for a new fragment.
77
- * @returns Range, inclusive.
77
+ * @returns Range, inclusive, or undefined.
78
78
  */
79
79
  private getYBoundsFromRange;
80
80
  private locatePrevSpace;
@@ -122,7 +122,7 @@ export declare class TextLayerService {
122
122
  * current selection using getSelectedRange().
123
123
  * @returns The token location or null.
124
124
  */
125
- getSelectedLocationForEdit(range: SelectedRange): TokenLocation;
125
+ getSelectedLocationForEdit(range: SelectedRange): TokenLocation | null;
126
126
  private textLineToString;
127
127
  private buildCoords;
128
128
  /**
@@ -142,14 +142,14 @@ export declare class TextLayerService {
142
142
  * @param range The selected range. You can get it from the
143
143
  * current selection using getSelectedRange().
144
144
  * @param text The full base text.
145
- * @returns TokenLocation The token location or null.
145
+ * @returns TokenLocation The token location or undefined.
146
146
  */
147
- getSelectedLocationForNew(range: SelectedRange, text: string): TokenLocation;
147
+ getSelectedLocationForNew(range: SelectedRange, text: string): TokenLocation | null;
148
148
  /**
149
149
  * Get the currently selected range in the browser's document.
150
150
  * This uses the rangy library.
151
151
  */
152
- getSelectedRange(): Range;
152
+ getSelectedRange(): Range | null;
153
153
  static ɵfac: i0.ɵɵFactoryDeclaration<TextLayerService, never>;
154
154
  static ɵprov: i0.ɵɵInjectableDeclaration<TextLayerService>;
155
155
  }
@@ -17,7 +17,7 @@ export declare class TextRange {
17
17
  *
18
18
  * @param text The text.
19
19
  */
20
- static parse(text: string): TextRange;
20
+ static parse(text: string): TextRange | null;
21
21
  constructor(start: number, length: number);
22
22
  /**
23
23
  * Get the inclusive end of the range.
@@ -9,7 +9,7 @@ export declare class TokenLocation {
9
9
  * TokenPoint.parse (e.g. Y.X or Y.X@AxR or Y.X@A, where R=1).
10
10
  * @param text The text to parse.
11
11
  */
12
- static parse(text: string): TokenLocation;
12
+ static parse(text: string): TokenLocation | null;
13
13
  constructor(primary: TokenPoint, secondary?: TokenPoint);
14
14
  isRange(): boolean;
15
15
  toString(): string;
@@ -11,7 +11,7 @@ export declare class TokenPoint {
11
11
  * @param text The text to parse, in the forms Y.X or Y.X@AxR or
12
12
  * Y.X@A, where R=1.
13
13
  */
14
- static parse(text: string): TokenPoint;
14
+ static parse(text: string): TokenPoint | null;
15
15
  constructor(y: number, x: number, at?: number, run?: number);
16
16
  toString(): string;
17
17
  compareTo(other: TokenPoint): number;
@@ -1,6 +1,4 @@
1
- import { AbstractControl } from '@angular/forms';
1
+ import { AbstractControl, ValidationErrors } from '@angular/forms';
2
2
  export declare class PasswordValidator {
3
- static isValidPassword(control: AbstractControl): {
4
- [key: string]: boolean;
5
- };
3
+ static isValidPassword(control: AbstractControl): ValidationErrors | null;
6
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-core",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Cadmus - core app components: guards, services, validators, and utility classes.",
5
5
  "keywords": [
6
6
  "Cadmus"