@myrmidon/cadmus-state 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.
Files changed (47) hide show
  1. package/esm2020/lib/app.query.mjs +1 -1
  2. package/esm2020/lib/app.service.mjs +1 -1
  3. package/esm2020/lib/app.store.mjs +1 -3
  4. package/esm2020/lib/cadmus-state.module.mjs +6 -2
  5. package/esm2020/lib/edit-fragment-feature-base.mjs +6 -3
  6. package/esm2020/lib/edit-fragment-query-base.mjs +1 -1
  7. package/esm2020/lib/edit-fragment-service-base.mjs +7 -4
  8. package/esm2020/lib/edit-fragment.store.mjs +1 -4
  9. package/esm2020/lib/edit-item.query.mjs +3 -3
  10. package/esm2020/lib/edit-item.service.mjs +18 -18
  11. package/esm2020/lib/edit-item.store.mjs +4 -11
  12. package/esm2020/lib/edit-layer-part.query.mjs +1 -1
  13. package/esm2020/lib/edit-layer-part.service.mjs +7 -7
  14. package/esm2020/lib/edit-layer-part.store.mjs +1 -5
  15. package/esm2020/lib/edit-part-feature-base.mjs +3 -3
  16. package/esm2020/lib/edit-part-query-base.mjs +3 -3
  17. package/esm2020/lib/edit-part-service-base.mjs +7 -7
  18. package/esm2020/lib/edit-part.store.mjs +2 -10
  19. package/esm2020/lib/edit-thesaurus.query.mjs +4 -4
  20. package/esm2020/lib/edit-thesaurus.service.mjs +2 -2
  21. package/esm2020/lib/edit-thesaurus.store.mjs +2 -9
  22. package/fesm2015/myrmidon-cadmus-state.mjs +77 -89
  23. package/fesm2015/myrmidon-cadmus-state.mjs.map +1 -1
  24. package/fesm2020/myrmidon-cadmus-state.mjs +68 -89
  25. package/fesm2020/myrmidon-cadmus-state.mjs.map +1 -1
  26. package/lib/app.query.d.ts +4 -4
  27. package/lib/app.service.d.ts +1 -1
  28. package/lib/app.store.d.ts +2 -2
  29. package/lib/cadmus-state.module.d.ts +2 -1
  30. package/lib/edit-fragment-feature-base.d.ts +7 -7
  31. package/lib/edit-fragment-query-base.d.ts +5 -5
  32. package/lib/edit-fragment-service-base.d.ts +1 -1
  33. package/lib/edit-fragment.store.d.ts +2 -2
  34. package/lib/edit-item.query.d.ts +6 -6
  35. package/lib/edit-item.service.d.ts +2 -2
  36. package/lib/edit-item.store.d.ts +5 -5
  37. package/lib/edit-layer-part.query.d.ts +6 -6
  38. package/lib/edit-layer-part.service.d.ts +1 -1
  39. package/lib/edit-layer-part.store.d.ts +3 -3
  40. package/lib/edit-part-feature-base.d.ts +9 -9
  41. package/lib/edit-part-query-base.d.ts +4 -4
  42. package/lib/edit-part-service-base.d.ts +3 -3
  43. package/lib/edit-part.store.d.ts +2 -3
  44. package/lib/edit-thesaurus.query.d.ts +2 -3
  45. package/lib/edit-thesaurus.service.d.ts +1 -1
  46. package/lib/edit-thesaurus.store.d.ts +1 -1
  47. package/package.json +3 -3
@@ -2,8 +2,8 @@ import { Fragment, ThesauriSet } from '@myrmidon/cadmus-core';
2
2
  import { Store } from '@datorama/akita';
3
3
  import * as i0 from "@angular/core";
4
4
  export interface EditFragmentState {
5
- fragment: Fragment | null;
6
- thesauri: ThesauriSet | null;
5
+ fragment?: Fragment;
6
+ thesauri?: ThesauriSet;
7
7
  dirty?: boolean;
8
8
  saving?: boolean;
9
9
  loading?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { Query } from '@datorama/akita';
2
- import { EditItemStore, EditItemState } from './edit-item.store';
3
2
  import { Observable } from 'rxjs';
4
3
  import { LibraryRouteService, FacetDefinition, Item, Part } from '@myrmidon/cadmus-core';
4
+ import { EditItemStore, EditItemState } from './edit-item.store';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * The query facade to the edit item store.
@@ -10,11 +10,11 @@ export declare class EditItemQuery extends Query<EditItemState> {
10
10
  protected store: EditItemStore;
11
11
  private _libraryRouteService;
12
12
  constructor(store: EditItemStore, _libraryRouteService: LibraryRouteService);
13
- selectItem(): Observable<Item>;
14
- selectParts(): Observable<Part[]>;
15
- selectFacet(): Observable<FacetDefinition>;
16
- selectSaving(): Observable<boolean>;
17
- selectDeletingPart(): Observable<boolean>;
13
+ selectItem(): Observable<Item | undefined>;
14
+ selectParts(): Observable<Part[] | undefined>;
15
+ selectFacet(): Observable<FacetDefinition | undefined>;
16
+ selectSaving(): Observable<boolean | undefined>;
17
+ selectDeletingPart(): Observable<boolean | undefined>;
18
18
  hasItem(id?: string): boolean;
19
19
  getEditorKeyFromPartTypeId(typeId: string, roleId?: string): string;
20
20
  static ɵfac: i0.ɵɵFactoryDeclaration<EditItemQuery, never>;
@@ -16,7 +16,7 @@ export declare class EditItemService {
16
16
  * Load the item with the specified ID (if any; the ID can be null for
17
17
  * a new item), and all the required lookup data into the item store.
18
18
  */
19
- load(itemId: string | null): void;
19
+ load(itemId?: string): void;
20
20
  /**
21
21
  * Reset the item.
22
22
  */
@@ -31,7 +31,7 @@ export declare class EditItemService {
31
31
  * @param id The ID of the part to be deleted.
32
32
  */
33
33
  deletePart(id: string): Promise<string>;
34
- addNewLayerPart(itemId: string, typeId: string, roleId: string): void;
34
+ addNewLayerPart(itemId: string, typeId: string, roleId?: string): void;
35
35
  setPartThesaurusScope(ids: string[], scope: string): void;
36
36
  static ɵfac: i0.ɵɵFactoryDeclaration<EditItemService, never>;
37
37
  static ɵprov: i0.ɵɵInjectableDeclaration<EditItemService>;
@@ -15,24 +15,24 @@ export interface EditItemState {
15
15
  /**
16
16
  * The item being edited.
17
17
  */
18
- item: Item | null;
18
+ item?: Item;
19
19
  /**
20
20
  * The raw list of item's parts.
21
21
  */
22
- parts: Part[] | null;
22
+ parts?: Part[];
23
23
  /**
24
24
  * The item's parts, grouped.
25
25
  */
26
- partGroups: PartGroup[] | null;
26
+ partGroups?: PartGroup[];
27
27
  /**
28
28
  * The set of all the possible layer parts for this item, either
29
29
  * present or absent.
30
30
  */
31
- layerPartInfos: LayerPartInfo[] | null;
31
+ layerPartInfos?: LayerPartInfo[];
32
32
  /**
33
33
  * The facet definition assigned to the item.
34
34
  */
35
- facet: FacetDefinition | null;
35
+ facet?: FacetDefinition;
36
36
  dirty?: boolean;
37
37
  saving?: boolean;
38
38
  deletingPart?: boolean;
@@ -1,17 +1,17 @@
1
- import { Query } from '@datorama/akita';
2
- import { EditLayerPartState, EditLayerPartStore } from './edit-layer-part.store';
3
1
  import { Observable } from 'rxjs';
2
+ import { Query } from '@datorama/akita';
4
3
  import { LayerHint } from '@myrmidon/cadmus-core';
4
+ import { EditLayerPartState, EditLayerPartStore } from './edit-layer-part.store';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class EditLayerPartQuery extends Query<EditLayerPartState> {
7
7
  protected store: EditLayerPartStore;
8
8
  constructor(store: EditLayerPartStore);
9
- selectDeletingFragment(): Observable<boolean>;
10
- selectSavingFragment(): Observable<boolean>;
11
- selectRefreshingBreakChance(): Observable<boolean>;
9
+ selectDeletingFragment(): Observable<boolean | undefined>;
10
+ selectSavingFragment(): Observable<boolean | undefined>;
11
+ selectRefreshingBreakChance(): Observable<boolean | undefined>;
12
12
  selectBreakChance(): Observable<number>;
13
13
  selectLayerHints(): Observable<LayerHint[]>;
14
- selectPatchingLayers(): Observable<boolean>;
14
+ selectPatchingLayers(): Observable<boolean | undefined>;
15
15
  static ɵfac: i0.ɵɵFactoryDeclaration<EditLayerPartQuery, never>;
16
16
  static ɵprov: i0.ɵɵInjectableDeclaration<EditLayerPartQuery>;
17
17
  }
@@ -16,7 +16,7 @@ export declare class EditLayerPartService {
16
16
  * @param partId The layer part ID.
17
17
  * @param thesauriIds The optional thesauri IDs to load.
18
18
  */
19
- load(itemId: string, partId: string, thesauriIds?: string[] | null): void;
19
+ load(itemId: string, partId: string, thesauriIds?: string[]): void;
20
20
  /**
21
21
  * Refresh the layer part break chance.
22
22
  */
@@ -9,7 +9,7 @@ export interface EditLayerPartState {
9
9
  /**
10
10
  * The layer part (=collection of fragments) being edited.
11
11
  */
12
- part: TextLayerPart | null;
12
+ part?: TextLayerPart;
13
13
  /**
14
14
  * The base text rendered into a plain string, whatever its original model.
15
15
  * This is used for reference (e.g. show it to the user while editing),
@@ -17,11 +17,11 @@ export interface EditLayerPartState {
17
17
  * layer part editor itself (this is the case of the token-based text,
18
18
  * but not e.g. for the tiles-based text).
19
19
  */
20
- baseText: string | null;
20
+ baseText?: string;
21
21
  /**
22
22
  * The base text part.
23
23
  */
24
- baseTextPart: Part | null;
24
+ baseTextPart?: Part;
25
25
  /**
26
26
  * The fragments locations, collected from all the fragments.
27
27
  */
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ThesauriSet, ComponentCanDeactivate, Part } from '@myrmidon/cadmus-core';
3
2
  import { Router, ActivatedRoute } from '@angular/router';
4
3
  import { MatSnackBar } from '@angular/material/snack-bar';
4
+ import { ThesauriSet, ComponentCanDeactivate, Part } from '@myrmidon/cadmus-core';
5
5
  import { EditPartQueryBase } from './edit-part-query-base';
6
6
  import { EditPartServiceBase } from './edit-part-service-base';
7
7
  import { EditItemQuery } from './edit-item.query';
@@ -27,16 +27,16 @@ export declare abstract class EditPartFeatureBase implements ComponentCanDeactiv
27
27
  private _editPartService;
28
28
  private _editItemQuery;
29
29
  private _editItemService;
30
- private _formDirty;
31
- private _stateDirty;
30
+ private _formDirty?;
31
+ private _stateDirty?;
32
32
  /**
33
33
  * The part being edited (from the local store).
34
34
  */
35
- part$: Observable<Part>;
35
+ part$?: Observable<Part | undefined>;
36
36
  /**
37
37
  * The thesauri requested for editing this part.
38
38
  */
39
- thesauri$: Observable<ThesauriSet>;
39
+ thesauri$?: Observable<ThesauriSet | undefined>;
40
40
  /**
41
41
  * The item ID of the edited part, as got from the route.
42
42
  */
@@ -44,17 +44,17 @@ export declare abstract class EditPartFeatureBase implements ComponentCanDeactiv
44
44
  /**
45
45
  * The part type ID of the edited part, as got from the route.
46
46
  */
47
- typeId: string | null;
47
+ typeId?: string;
48
48
  /**
49
49
  * The part ID of the edited part, as got from the route;
50
50
  * or null for a new part.
51
51
  */
52
- partId: string | null;
52
+ partId?: string;
53
53
  /**
54
54
  * The role ID of the edited part, as got from the route,
55
55
  * or null.
56
56
  */
57
- roleId: string | null;
57
+ roleId?: string;
58
58
  constructor(router: Router, route: ActivatedRoute, snackbar: MatSnackBar, _editPartQuery: EditPartQueryBase, _editPartService: EditPartServiceBase, _editItemQuery: EditItemQuery, _editItemService: EditItemService);
59
59
  /**
60
60
  * Implementation of ComponentCanDeactivate. The editor can deactivate
@@ -70,7 +70,7 @@ export declare abstract class EditPartFeatureBase implements ComponentCanDeactiv
70
70
  * @param thesauriIds The optional ID(s) of the thesauri sets you want
71
71
  * to use in your editor.
72
72
  */
73
- protected initEditor(thesauriIds: string[] | null): void;
73
+ protected initEditor(thesauriIds?: string[]): void;
74
74
  /**
75
75
  * Called when the wrapped editor dirty state changes.
76
76
  * In the HTML template, you MUST bind this handler to the dirtyChange event
@@ -10,8 +10,8 @@ import { EditPartState } from './edit-part.store';
10
10
  export declare abstract class EditPartQueryBase extends Query<EditPartState> {
11
11
  protected store: any;
12
12
  constructor(store: any);
13
- selectDirty(): Observable<boolean>;
14
- selectSaving(): Observable<boolean>;
15
- selectPart(): Observable<Part>;
16
- selectThesauri(): Observable<ThesauriSet>;
13
+ selectDirty(): Observable<boolean | undefined>;
14
+ selectSaving(): Observable<boolean | undefined>;
15
+ selectPart(): Observable<Part | undefined>;
16
+ selectThesauri(): Observable<ThesauriSet | undefined>;
17
17
  }
@@ -16,7 +16,7 @@ export interface EditPartStoreApi {
16
16
  export declare abstract class EditPartServiceBase {
17
17
  protected itemService: ItemService;
18
18
  protected thesaurusService: ThesaurusService;
19
- protected store: EditPartStoreApi;
19
+ protected store?: EditPartStoreApi;
20
20
  constructor(itemService: ItemService, thesaurusService: ThesaurusService);
21
21
  /**
22
22
  * Load into the state the part with the specified ID
@@ -25,12 +25,12 @@ export declare abstract class EditPartServiceBase {
25
25
  * it will get a null ID, but use the specified itemId and roleId.
26
26
  *
27
27
  * @param partId The part ID, unless it's a new part.
28
- * @param thesauriIds The thesauri IDs array, or null.
28
+ * @param thesauriIds The thesauri IDs array.
29
29
  * @param itemId The item ID for the new part.
30
30
  * @param typeId The part type ID for the new part.
31
31
  * @param roleId The role ID for the new part.
32
32
  */
33
- load(partId?: string, thesauriIds?: string[] | null, itemId?: string, typeId?: string, roleId?: string): void;
33
+ load(partId?: string, thesauriIds?: string[], itemId?: string, typeId?: string, roleId?: string): void;
34
34
  /**
35
35
  * Save the part.
36
36
  *
@@ -8,17 +8,16 @@ export interface EditPartState {
8
8
  /**
9
9
  * The part being edited.
10
10
  */
11
- part: Part | null;
11
+ part?: Part;
12
12
  /**
13
13
  * All the thesauri required by the part's editor.
14
14
  */
15
- thesauri: ThesauriSet | null;
15
+ thesauri?: ThesauriSet;
16
16
  dirty?: boolean;
17
17
  saving?: boolean;
18
18
  loading?: boolean;
19
19
  error?: string;
20
20
  }
21
- export declare const editPartInitialState: EditPartState;
22
21
  /**
23
22
  * General-purpose edit-part store. This can be used with any part, so that
24
23
  * you should only provide your part store, query, and service (usually
@@ -6,9 +6,8 @@ import * as i0 from "@angular/core";
6
6
  export declare class EditThesaurusQuery extends Query<EditThesaurusState> {
7
7
  protected store: EditThesaurusStore;
8
8
  constructor(store: EditThesaurusStore);
9
- selectThesaurus(): Observable<Thesaurus>;
10
- selectLoading(): Observable<boolean>;
11
- selectSaving(): Observable<boolean>;
9
+ selectThesaurus(): Observable<Thesaurus | undefined>;
10
+ selectSaving(): Observable<boolean | undefined>;
12
11
  static ɵfac: i0.ɵɵFactoryDeclaration<EditThesaurusQuery, never>;
13
12
  static ɵprov: i0.ɵɵInjectableDeclaration<EditThesaurusQuery>;
14
13
  }
@@ -6,7 +6,7 @@ export declare class EditThesaurusService {
6
6
  private _store;
7
7
  private _thesaurusService;
8
8
  constructor(_store: EditThesaurusStore, _thesaurusService: ThesaurusService);
9
- load(id: string | null): void;
9
+ load(id?: string): void;
10
10
  reset(): void;
11
11
  save(thesaurus: Thesaurus): Promise<Thesaurus>;
12
12
  static ɵfac: i0.ɵɵFactoryDeclaration<EditThesaurusService, never>;
@@ -2,7 +2,7 @@ import { Thesaurus } from '@myrmidon/cadmus-core';
2
2
  import { Store } from '@datorama/akita';
3
3
  import * as i0 from "@angular/core";
4
4
  export interface EditThesaurusState {
5
- thesaurus: Thesaurus | null;
5
+ thesaurus?: Thesaurus;
6
6
  dirty?: boolean;
7
7
  saving?: boolean;
8
8
  loading?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/cadmus-state",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Cadmus - application edit state.",
5
5
  "keywords": [
6
6
  "Cadmus"
@@ -16,8 +16,8 @@
16
16
  "peerDependencies": {
17
17
  "@angular/common": "^13.0.0",
18
18
  "@angular/core": "^13.0.0",
19
- "@myrmidon/cadmus-core": "^0.2.0",
20
- "@myrmidon/cadmus-api": "^0.2.0",
19
+ "@myrmidon/cadmus-core": "^0.3.0",
20
+ "@myrmidon/cadmus-api": "^0.3.0",
21
21
  "@myrmidon/cadmus-material": "^0.1.0"
22
22
  },
23
23
  "dependencies": {