@myrmidon/cadmus-state 1.1.2 → 2.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.
Files changed (57) hide show
  1. package/esm2020/lib/app.repository.mjs +75 -0
  2. package/esm2020/lib/cadmus-state.module.mjs +4 -4
  3. package/esm2020/lib/edit-fragment-feature-base.mjs +76 -63
  4. package/esm2020/lib/edit-part-feature-base.mjs +78 -68
  5. package/esm2020/lib/edited-layer.repository.mjs +277 -0
  6. package/esm2020/lib/edited-thesaurus.repository.mjs +80 -0
  7. package/esm2020/lib/fragment-editor.service.mjs +167 -0
  8. package/esm2020/lib/part-editor.service.mjs +157 -0
  9. package/esm2020/public-api.mjs +6 -19
  10. package/fesm2015/myrmidon-cadmus-state.mjs +640 -1095
  11. package/fesm2015/myrmidon-cadmus-state.mjs.map +1 -1
  12. package/fesm2020/myrmidon-cadmus-state.mjs +665 -1080
  13. package/fesm2020/myrmidon-cadmus-state.mjs.map +1 -1
  14. package/lib/{app.store.d.ts → app.repository.d.ts} +24 -8
  15. package/lib/edit-fragment-feature-base.d.ts +35 -53
  16. package/lib/edit-part-feature-base.d.ts +37 -51
  17. package/lib/edited-layer.repository.d.ts +90 -0
  18. package/lib/edited-thesaurus.repository.d.ts +34 -0
  19. package/lib/fragment-editor.service.d.ts +40 -0
  20. package/lib/part-editor.service.d.ts +39 -0
  21. package/package.json +3 -3
  22. package/public-api.d.ts +5 -18
  23. package/esm2020/lib/app.query.mjs +0 -38
  24. package/esm2020/lib/app.service.mjs +0 -60
  25. package/esm2020/lib/app.store.mjs +0 -27
  26. package/esm2020/lib/edit-fragment-query-base.mjs +0 -20
  27. package/esm2020/lib/edit-fragment-service-base.mjs +0 -140
  28. package/esm2020/lib/edit-fragment.store.mjs +0 -36
  29. package/esm2020/lib/edit-item.query.mjs +0 -52
  30. package/esm2020/lib/edit-item.service.mjs +0 -212
  31. package/esm2020/lib/edit-item.store.mjs +0 -40
  32. package/esm2020/lib/edit-layer-part.query.mjs +0 -35
  33. package/esm2020/lib/edit-layer-part.service.mjs +0 -230
  34. package/esm2020/lib/edit-layer-part.store.mjs +0 -49
  35. package/esm2020/lib/edit-part-query-base.mjs +0 -25
  36. package/esm2020/lib/edit-part-service-base.mjs +0 -120
  37. package/esm2020/lib/edit-part.store.mjs +0 -31
  38. package/esm2020/lib/edit-thesaurus.query.mjs +0 -26
  39. package/esm2020/lib/edit-thesaurus.service.mjs +0 -59
  40. package/esm2020/lib/edit-thesaurus.store.mjs +0 -30
  41. package/lib/app.query.d.ts +0 -18
  42. package/lib/app.service.d.ts +0 -14
  43. package/lib/edit-fragment-query-base.d.ts +0 -12
  44. package/lib/edit-fragment-service-base.d.ts +0 -39
  45. package/lib/edit-fragment.store.d.ts +0 -24
  46. package/lib/edit-item.query.d.ts +0 -22
  47. package/lib/edit-item.service.d.ts +0 -38
  48. package/lib/edit-item.store.d.ts +0 -49
  49. package/lib/edit-layer-part.query.d.ts +0 -17
  50. package/lib/edit-layer-part.service.d.ts +0 -39
  51. package/lib/edit-layer-part.store.d.ts +0 -57
  52. package/lib/edit-part-query-base.d.ts +0 -17
  53. package/lib/edit-part-service-base.d.ts +0 -42
  54. package/lib/edit-part.store.d.ts +0 -32
  55. package/lib/edit-thesaurus.query.d.ts +0 -13
  56. package/lib/edit-thesaurus.service.d.ts +0 -14
  57. package/lib/edit-thesaurus.store.d.ts +0 -17
@@ -1,30 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { Injectable } from '@angular/core';
3
- import { StoreConfig, Store } from '@datorama/akita';
4
- import * as i0 from "@angular/core";
5
- let EditThesaurusStore = class EditThesaurusStore extends Store {
6
- constructor() {
7
- super({});
8
- }
9
- setDirty(value = true) {
10
- this.update({
11
- dirty: value,
12
- });
13
- }
14
- setSaving(value = true) {
15
- this.update({
16
- saving: value,
17
- });
18
- }
19
- };
20
- EditThesaurusStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: EditThesaurusStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
21
- EditThesaurusStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: EditThesaurusStore, providedIn: 'root' });
22
- EditThesaurusStore = __decorate([
23
- StoreConfig({ name: 'edit-thesaurus', resettable: true })
24
- ], EditThesaurusStore);
25
- export { EditThesaurusStore };
26
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: EditThesaurusStore, decorators: [{
27
- type: Injectable,
28
- args: [{ providedIn: 'root' }]
29
- }], ctorParameters: function () { return []; } });
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWRpdC10aGVzYXVydXMuc3RvcmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9teXJtaWRvbi9jYWRtdXMtc3RhdGUvc3JjL2xpYi9lZGl0LXRoZXNhdXJ1cy5zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEVBQUUsV0FBVyxFQUFFLEtBQUssRUFBRSxNQUFNLGlCQUFpQixDQUFDOztJQVl4QyxrQkFBa0IsU0FBbEIsa0JBQW1CLFNBQVEsS0FBeUI7SUFDL0Q7UUFDRSxLQUFLLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDWixDQUFDO0lBRU0sUUFBUSxDQUFDLEtBQUssR0FBRyxJQUFJO1FBQzFCLElBQUksQ0FBQyxNQUFNLENBQUM7WUFDVixLQUFLLEVBQUUsS0FBSztTQUNiLENBQUMsQ0FBQztJQUNMLENBQUM7SUFFTSxTQUFTLENBQUMsS0FBSyxHQUFHLElBQUk7UUFDM0IsSUFBSSxDQUFDLE1BQU0sQ0FBQztZQUNWLE1BQU0sRUFBRSxLQUFLO1NBQ2QsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztDQUNGLENBQUE7K0dBaEJZLGtCQUFrQjttSEFBbEIsa0JBQWtCLGNBRkwsTUFBTTtBQUVuQixrQkFBa0I7SUFEOUIsV0FBVyxDQUFDLEVBQUUsSUFBSSxFQUFFLGdCQUFnQixFQUFFLFVBQVUsRUFBRSxJQUFJLEVBQUUsQ0FBQztHQUM3QyxrQkFBa0IsQ0FnQjlCO1NBaEJZLGtCQUFrQjsyRkFBbEIsa0JBQWtCO2tCQUY5QixVQUFVO21CQUFDLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRoZXNhdXJ1cyB9IGZyb20gJ0BteXJtaWRvbi9jYWRtdXMtY29yZSc7XHJcbmltcG9ydCB7IEluamVjdGFibGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcclxuaW1wb3J0IHsgU3RvcmVDb25maWcsIFN0b3JlIH0gZnJvbSAnQGRhdG9yYW1hL2FraXRhJztcclxuXHJcbmV4cG9ydCBpbnRlcmZhY2UgRWRpdFRoZXNhdXJ1c1N0YXRlIHtcclxuICB0aGVzYXVydXM/OiBUaGVzYXVydXM7XHJcbiAgZGlydHk/OiBib29sZWFuO1xyXG4gIHNhdmluZz86IGJvb2xlYW47XHJcbiAgbG9hZGluZz86IGJvb2xlYW47XHJcbiAgZXJyb3I/OiBzdHJpbmc7XHJcbn1cclxuXHJcbkBJbmplY3RhYmxlKHsgcHJvdmlkZWRJbjogJ3Jvb3QnIH0pXHJcbkBTdG9yZUNvbmZpZyh7IG5hbWU6ICdlZGl0LXRoZXNhdXJ1cycsIHJlc2V0dGFibGU6IHRydWUgfSlcclxuZXhwb3J0IGNsYXNzIEVkaXRUaGVzYXVydXNTdG9yZSBleHRlbmRzIFN0b3JlPEVkaXRUaGVzYXVydXNTdGF0ZT4ge1xyXG4gIGNvbnN0cnVjdG9yKCkge1xyXG4gICAgc3VwZXIoe30pO1xyXG4gIH1cclxuXHJcbiAgcHVibGljIHNldERpcnR5KHZhbHVlID0gdHJ1ZSk6IHZvaWQge1xyXG4gICAgdGhpcy51cGRhdGUoe1xyXG4gICAgICBkaXJ0eTogdmFsdWUsXHJcbiAgICB9KTtcclxuICB9XHJcblxyXG4gIHB1YmxpYyBzZXRTYXZpbmcodmFsdWUgPSB0cnVlKTogdm9pZCB7XHJcbiAgICB0aGlzLnVwZGF0ZSh7XHJcbiAgICAgIHNhdmluZzogdmFsdWUsXHJcbiAgICB9KTtcclxuICB9XHJcbn1cclxuIl19
@@ -1,18 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { Query } from '@datorama/akita';
3
- import { FacetDefinition, FlagDefinition, Thesaurus } from '@myrmidon/cadmus-core';
4
- import { AppState, AppStore } from './app.store';
5
- import * as i0 from "@angular/core";
6
- export declare class AppQuery extends Query<AppState> {
7
- protected store: AppStore;
8
- constructor(store: AppStore);
9
- selectFacets(): Observable<FacetDefinition[]>;
10
- selectFlags(): Observable<FlagDefinition[]>;
11
- selectTypeThesaurus(): Observable<Thesaurus | undefined>;
12
- selectItemBrowserThesaurus(): Observable<Thesaurus | undefined>;
13
- selectPreviewJKeys(): Observable<string[]>;
14
- selectPreviewFKeys(): Observable<string[]>;
15
- selectPreviewCKeys(): Observable<string[]>;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<AppQuery, never>;
17
- static ɵprov: i0.ɵɵInjectableDeclaration<AppQuery>;
18
- }
@@ -1,14 +0,0 @@
1
- import { FacetService, FlagService, PreviewService, ThesaurusService } from '@myrmidon/cadmus-api';
2
- import { AppStore } from './app.store';
3
- import * as i0 from "@angular/core";
4
- export declare class AppService {
5
- private _store;
6
- private _facetService;
7
- private _flagService;
8
- private _thesaurusService;
9
- private _previewService;
10
- constructor(_store: AppStore, _facetService: FacetService, _flagService: FlagService, _thesaurusService: ThesaurusService, _previewService: PreviewService);
11
- load(): void;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<AppService, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<AppService>;
14
- }
@@ -1,12 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { Query } from '@datorama/akita';
3
- import { ThesauriSet, Fragment } from '@myrmidon/cadmus-core';
4
- import { EditFragmentState } from './edit-fragment.store';
5
- export declare abstract class EditFragmentQueryBase extends Query<EditFragmentState> {
6
- protected store: any;
7
- constructor(store: any);
8
- selectDirty(): Observable<boolean | undefined>;
9
- selectSaving(): Observable<boolean | undefined>;
10
- selectFragment(): Observable<Fragment | undefined>;
11
- selectThesauri(): Observable<ThesauriSet | undefined>;
12
- }
@@ -1,39 +0,0 @@
1
- import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
2
- import { Part } from '@myrmidon/cadmus-core';
3
- /**
4
- * API provided by any Akita-based fragment store.
5
- */
6
- export interface EditFragmentStoreApi {
7
- update(value: any): void;
8
- setLoading(value: boolean): void;
9
- setDirty(value: boolean): void;
10
- setSaving(value: boolean): void;
11
- setError(value: string): void;
12
- }
13
- /**
14
- * Base class for fragment editor services.
15
- */
16
- export declare abstract class EditFragmentServiceBase {
17
- private _itemService;
18
- private _thesaurusService;
19
- protected store?: EditFragmentStoreApi;
20
- constructor(_itemService: ItemService, _thesaurusService: ThesaurusService);
21
- /**
22
- * Load into the state the fragment with the specified ID
23
- * and its thesauri.
24
- *
25
- * @param partId The ID of the part the fragment belongs to.
26
- * @param loc The fragment's location.
27
- * @param thesauriIds The thesauri IDs array, or null.
28
- */
29
- load(partId: string, loc: string, thesauriIds?: string[] | null): void;
30
- /**
31
- * Save the fragments in their layer part.
32
- *
33
- * @param part The part.
34
- * @returns Promise which when successful returns the
35
- * saved part (which contains the fragment being saved).
36
- */
37
- save(part: Part): Promise<Part>;
38
- setDirty(value?: boolean): void;
39
- }
@@ -1,24 +0,0 @@
1
- import { Fragment, ThesauriSet } from '@myrmidon/cadmus-core';
2
- import { Store } from '@datorama/akita';
3
- import * as i0 from "@angular/core";
4
- export interface EditFragmentState {
5
- fragment?: Fragment;
6
- thesauri?: ThesauriSet;
7
- dirty?: boolean;
8
- saving?: boolean;
9
- loading?: boolean;
10
- error?: string;
11
- }
12
- export declare const editFragmentInitialState: EditFragmentState;
13
- /**
14
- * General-purpose edit-fragment store. This can be used with any fragment,
15
- * so that you should only provide your fragment store, query, and service
16
- * (usually extending EditFragmentServiceBase).
17
- */
18
- export declare class EditFragmentStore extends Store<EditFragmentState> {
19
- constructor();
20
- setDirty(value: boolean): void;
21
- setSaving(value: boolean): void;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<EditFragmentStore, never>;
23
- static ɵprov: i0.ɵɵInjectableDeclaration<EditFragmentStore>;
24
- }
@@ -1,22 +0,0 @@
1
- import { Query } from '@datorama/akita';
2
- import { Observable } from 'rxjs';
3
- import { LibraryRouteService, FacetDefinition, Item, Part } from '@myrmidon/cadmus-core';
4
- import { EditItemStore, EditItemState } from './edit-item.store';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * The query facade to the edit item store.
8
- */
9
- export declare class EditItemQuery extends Query<EditItemState> {
10
- protected store: EditItemStore;
11
- private _libraryRouteService;
12
- constructor(store: EditItemStore, _libraryRouteService: LibraryRouteService);
13
- selectItem(): Observable<Item | undefined>;
14
- selectParts(): Observable<Part[]>;
15
- selectFacet(): Observable<FacetDefinition | undefined>;
16
- selectSaving(): Observable<boolean>;
17
- selectDeletingPart(): Observable<boolean>;
18
- hasItem(id?: string): boolean;
19
- getEditorKeyFromPartTypeId(typeId: string, roleId?: string): string;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<EditItemQuery, never>;
21
- static ɵprov: i0.ɵɵInjectableDeclaration<EditItemQuery>;
22
- }
@@ -1,38 +0,0 @@
1
- import { ItemService } from '@myrmidon/cadmus-api';
2
- import { Item } from '@myrmidon/cadmus-core';
3
- import { EditItemStore } from './edit-item.store';
4
- import { AppQuery } from './app.query';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * The service which handles the edit item store.
8
- */
9
- export declare class EditItemService {
10
- private _store;
11
- private _appQuery;
12
- private _itemService;
13
- constructor(_store: EditItemStore, _appQuery: AppQuery, _itemService: ItemService);
14
- private pickDefaultFacet;
15
- /**
16
- * Load the item with the specified ID (if any; the ID can be null for
17
- * a new item), and all the required lookup data into the item store.
18
- */
19
- load(itemId?: string): void;
20
- /**
21
- * Reset the item.
22
- */
23
- reset(): void;
24
- /**
25
- * Save the item and update the store.
26
- * @param item The item to be saved.
27
- */
28
- save(item: Item): Promise<Item>;
29
- /**
30
- * Delete the part with the specified ID from the edited item.
31
- * @param id The ID of the part to be deleted.
32
- */
33
- deletePart(id: string): Promise<string>;
34
- addNewLayerPart(itemId: string, typeId: string, roleId?: string): void;
35
- setPartThesaurusScope(ids: string[], scope: string): void;
36
- static ɵfac: i0.ɵɵFactoryDeclaration<EditItemService, never>;
37
- static ɵprov: i0.ɵɵInjectableDeclaration<EditItemService>;
38
- }
@@ -1,49 +0,0 @@
1
- import { Store } from '@datorama/akita';
2
- import { Item, PartGroup, FacetDefinition, LayerPartInfo, Part } from '@myrmidon/cadmus-core';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * The state of the currently edited item, if any.
6
- * This state is set when editing a single item, or any of its parts or
7
- * part fragments. The app ensures that a new item has been saved before
8
- * users can edit their parts, so this grants that the edit state is always
9
- * available when editing parts/fragments.
10
- * Note that as for any other state, properties "loading" and "error" are
11
- * implemented inside Akita states, but you must explicitly add the keys
12
- * to your state (it's an opt-in: see https://github.com/datorama/akita/issues/61).
13
- */
14
- export interface EditItemState {
15
- /**
16
- * The item being edited.
17
- */
18
- item?: Item;
19
- /**
20
- * The raw list of item's parts.
21
- */
22
- parts: Part[];
23
- /**
24
- * The item's parts, grouped.
25
- */
26
- partGroups: PartGroup[];
27
- /**
28
- * The set of all the possible layer parts for this item, either
29
- * present or absent.
30
- */
31
- layerPartInfos: LayerPartInfo[];
32
- /**
33
- * The facet definition assigned to the item.
34
- */
35
- facet?: FacetDefinition;
36
- dirty?: boolean;
37
- saving?: boolean;
38
- deletingPart?: boolean;
39
- loading?: boolean;
40
- error?: string;
41
- }
42
- export declare class EditItemStore extends Store<EditItemState> {
43
- constructor();
44
- setDirty(value?: boolean): void;
45
- setSaving(value?: boolean): void;
46
- setDeletingPart(value?: boolean): void;
47
- static ɵfac: i0.ɵɵFactoryDeclaration<EditItemStore, never>;
48
- static ɵprov: i0.ɵɵInjectableDeclaration<EditItemStore>;
49
- }
@@ -1,17 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { Query } from '@datorama/akita';
3
- import { LayerHint } from '@myrmidon/cadmus-core';
4
- import { EditLayerPartState, EditLayerPartStore } from './edit-layer-part.store';
5
- import * as i0 from "@angular/core";
6
- export declare class EditLayerPartQuery extends Query<EditLayerPartState> {
7
- protected store: EditLayerPartStore;
8
- constructor(store: EditLayerPartStore);
9
- selectDeletingFragment(): Observable<boolean | undefined>;
10
- selectSavingFragment(): Observable<boolean | undefined>;
11
- selectRefreshingBreakChance(): Observable<boolean | undefined>;
12
- selectBreakChance(): Observable<number>;
13
- selectLayerHints(): Observable<LayerHint[]>;
14
- selectPatchingLayers(): Observable<boolean | undefined>;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<EditLayerPartQuery, never>;
16
- static ɵprov: i0.ɵɵInjectableDeclaration<EditLayerPartQuery>;
17
- }
@@ -1,39 +0,0 @@
1
- import { TokenLocation, Fragment } from '@myrmidon/cadmus-core';
2
- import { ItemService, FacetService, ThesaurusService } from '@myrmidon/cadmus-api';
3
- import { EditLayerPartStore } from './edit-layer-part.store';
4
- import * as i0 from "@angular/core";
5
- export declare class EditLayerPartService {
6
- private _store;
7
- private _itemService;
8
- private _facetService;
9
- private _thesaurusService;
10
- constructor(_store: EditLayerPartStore, _itemService: ItemService, _facetService: FacetService, _thesaurusService: ThesaurusService);
11
- private getLocations;
12
- /**
13
- * Load the state for editing layer part(s).
14
- *
15
- * @param itemId The item ID the layer part belongs to.
16
- * @param partId The layer part ID.
17
- * @param thesauriIds The optional thesauri IDs to load.
18
- */
19
- load(itemId: string, partId: string, thesauriIds?: string[]): void;
20
- /**
21
- * Refresh the layer part break chance.
22
- */
23
- refreshBreakChance(): void;
24
- applyLayerPatches(partId: string, patches: string[]): void;
25
- /**
26
- * Delete the fragment at the specified location.
27
- *
28
- * @param loc The fragment's location.
29
- */
30
- deleteFragment(loc: TokenLocation): void;
31
- /**
32
- * Save the specified fragment.
33
- *
34
- * @param fragment The fragment.
35
- */
36
- saveFragment(fragment: Fragment): void;
37
- static ɵfac: i0.ɵɵFactoryDeclaration<EditLayerPartService, never>;
38
- static ɵprov: i0.ɵɵInjectableDeclaration<EditLayerPartService>;
39
- }
@@ -1,57 +0,0 @@
1
- import { Store } from '@datorama/akita';
2
- import { TextLayerPart, Part, LayerHint, ThesauriSet, TokenLocation } from '@myrmidon/cadmus-core';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * The state of the currently edited text layer part, if any.
6
- * This state is set when editing a text layer.
7
- */
8
- export interface EditLayerPartState {
9
- /**
10
- * The layer part (=collection of fragments) being edited.
11
- */
12
- part?: TextLayerPart;
13
- /**
14
- * The base text rendered into a plain string, whatever its original model.
15
- * This is used for reference (e.g. show it to the user while editing),
16
- * even if in some cases it can be enough to work with the base text in the
17
- * layer part editor itself (this is the case of the token-based text,
18
- * but not e.g. for the tiles-based text).
19
- */
20
- baseText?: string;
21
- /**
22
- * The base text part.
23
- */
24
- baseTextPart?: Part;
25
- /**
26
- * The fragments locations, collected from all the fragments.
27
- */
28
- locations: TokenLocation[];
29
- /**
30
- * The estimated chance of broken fragments in this layer: 0=safe,
31
- * 1=potentially broken, 2=broken.
32
- */
33
- breakChance: number;
34
- /**
35
- * The layer fragments reconciliation hints. There is one hint for each
36
- * fragment in the layer.
37
- */
38
- layerHints: LayerHint[];
39
- thesauri: ThesauriSet;
40
- loading?: boolean;
41
- error?: string;
42
- deletingFragment?: boolean;
43
- savingFragment?: boolean;
44
- refreshingBreakChance?: boolean;
45
- patchingLayer?: boolean;
46
- }
47
- export declare class EditLayerPartStore extends Store<EditLayerPartState> {
48
- constructor();
49
- setDeletingFragment(value?: boolean): void;
50
- setSavingFragment(value?: boolean): void;
51
- setRefreshingBreakChance(value?: boolean): void;
52
- setBreakChance(value: number): void;
53
- setPatchingLayer(value?: boolean): void;
54
- setLocations(locations: TokenLocation[]): void;
55
- static ɵfac: i0.ɵɵFactoryDeclaration<EditLayerPartStore, never>;
56
- static ɵprov: i0.ɵɵInjectableDeclaration<EditLayerPartStore>;
57
- }
@@ -1,17 +0,0 @@
1
- import { Part, ThesauriSet } from '@myrmidon/cadmus-core';
2
- import { Observable } from 'rxjs';
3
- import { Query } from '@datorama/akita';
4
- import { EditPartState } from './edit-part.store';
5
- /**
6
- * Base class for implementing editor part queries.
7
- * To implement an editor part query, just extend this passing the specialized
8
- * part's store to the constructor.
9
- */
10
- export declare abstract class EditPartQueryBase extends Query<EditPartState> {
11
- protected store: any;
12
- constructor(store: any);
13
- selectDirty(): Observable<boolean | undefined>;
14
- selectSaving(): Observable<boolean | undefined>;
15
- selectPart(): Observable<Part | undefined>;
16
- selectThesauri(): Observable<ThesauriSet | undefined>;
17
- }
@@ -1,42 +0,0 @@
1
- import { ItemService, ThesaurusService } from '@myrmidon/cadmus-api';
2
- import { Part } from '@myrmidon/cadmus-core';
3
- /**
4
- * API provided by any Akita-based part store.
5
- */
6
- export interface EditPartStoreApi {
7
- update(value: any): void;
8
- setLoading(value: boolean): void;
9
- setDirty(value: boolean): void;
10
- setSaving(value: boolean): void;
11
- setError(value: string): void;
12
- }
13
- /**
14
- * Base class for part editor services.
15
- */
16
- export declare abstract class EditPartServiceBase {
17
- protected itemService: ItemService;
18
- protected thesaurusService: ThesaurusService;
19
- protected store?: EditPartStoreApi;
20
- constructor(itemService: ItemService, thesaurusService: ThesaurusService);
21
- /**
22
- * Load into the state the part with the specified ID
23
- * and its thesauri.
24
- * If the ID is not specified, it's a new part; in this case,
25
- * it will get a null ID, but use the specified itemId and roleId.
26
- *
27
- * @param partId The part ID, unless it's a new part.
28
- * @param thesauriIds The thesauri IDs array.
29
- * @param itemId The item ID for the new part.
30
- * @param typeId The part type ID for the new part.
31
- * @param roleId The role ID for the new part.
32
- */
33
- load(partId?: string, thesauriIds?: string[], itemId?: string, typeId?: string, roleId?: string): void;
34
- /**
35
- * Save the part.
36
- *
37
- * @param part The part.
38
- * @returns Promise which when successful returns the saved part.
39
- */
40
- save(part: Part): Promise<Part>;
41
- setDirty(value?: boolean): void;
42
- }
@@ -1,32 +0,0 @@
1
- import { ThesauriSet, Part } from '@myrmidon/cadmus-core';
2
- import { Store } from '@datorama/akita';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * The state of the currently edited part, if any.
6
- */
7
- export interface EditPartState {
8
- /**
9
- * The part being edited.
10
- */
11
- part?: Part;
12
- /**
13
- * All the thesauri required by the part's editor.
14
- */
15
- thesauri?: ThesauriSet;
16
- dirty?: boolean;
17
- saving?: boolean;
18
- loading?: boolean;
19
- error?: string;
20
- }
21
- /**
22
- * General-purpose edit-part store. This can be used with any part, so that
23
- * you should only provide your part store, query, and service (usually
24
- * extending EditPartServiceBase).
25
- */
26
- export declare class EditPartStore extends Store<EditPartState> {
27
- constructor();
28
- setDirty(value: boolean): void;
29
- setSaving(value: boolean): void;
30
- static ɵfac: i0.ɵɵFactoryDeclaration<EditPartStore, never>;
31
- static ɵprov: i0.ɵɵInjectableDeclaration<EditPartStore>;
32
- }
@@ -1,13 +0,0 @@
1
- import { EditThesaurusState, EditThesaurusStore } from './edit-thesaurus.store';
2
- import { Query } from '@datorama/akita';
3
- import { Observable } from 'rxjs';
4
- import { Thesaurus } from '@myrmidon/cadmus-core';
5
- import * as i0 from "@angular/core";
6
- export declare class EditThesaurusQuery extends Query<EditThesaurusState> {
7
- protected store: EditThesaurusStore;
8
- constructor(store: EditThesaurusStore);
9
- selectThesaurus(): Observable<Thesaurus | undefined>;
10
- selectSaving(): Observable<boolean | undefined>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<EditThesaurusQuery, never>;
12
- static ɵprov: i0.ɵɵInjectableDeclaration<EditThesaurusQuery>;
13
- }
@@ -1,14 +0,0 @@
1
- import { ThesaurusService } from '@myrmidon/cadmus-api';
2
- import { Thesaurus } from '@myrmidon/cadmus-core';
3
- import { EditThesaurusStore } from './edit-thesaurus.store';
4
- import * as i0 from "@angular/core";
5
- export declare class EditThesaurusService {
6
- private _store;
7
- private _thesaurusService;
8
- constructor(_store: EditThesaurusStore, _thesaurusService: ThesaurusService);
9
- load(id?: string): void;
10
- reset(): void;
11
- save(thesaurus: Thesaurus): Promise<Thesaurus>;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<EditThesaurusService, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<EditThesaurusService>;
14
- }
@@ -1,17 +0,0 @@
1
- import { Thesaurus } from '@myrmidon/cadmus-core';
2
- import { Store } from '@datorama/akita';
3
- import * as i0 from "@angular/core";
4
- export interface EditThesaurusState {
5
- thesaurus?: Thesaurus;
6
- dirty?: boolean;
7
- saving?: boolean;
8
- loading?: boolean;
9
- error?: string;
10
- }
11
- export declare class EditThesaurusStore extends Store<EditThesaurusState> {
12
- constructor();
13
- setDirty(value?: boolean): void;
14
- setSaving(value?: boolean): void;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<EditThesaurusStore, never>;
16
- static ɵprov: i0.ɵɵInjectableDeclaration<EditThesaurusStore>;
17
- }