@umbraco-cms/backoffice 1.0.0-next.249bf505 → 1.0.0-next.264a3c21

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.
@@ -1,8 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- import { HTMLElementConstructor } from './models';
3
- import { UmbControllerHostElement } from './controller';
4
- import { UmbContextToken, UmbContextProviderController, UmbContextCallback, UmbContextConsumerController } from './context-api';
5
- import { UmbObserverController } from './observable-api';
2
+ import { HTMLElementConstructor } from '@umbraco-cms/backoffice/extension-api';
3
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
4
+ import { UmbContextToken, UmbContextProviderController, UmbContextCallback, UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api';
5
+ import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
6
6
 
7
7
  interface ResolvedContexts {
8
8
  [key: string]: any;
@@ -1,6 +1,6 @@
1
- import { UmbControllerHostElement } from './controller';
2
- import { UmbEntityActionBase as UmbEntityActionBase$1 } from './entity-action';
3
- import { UmbFolderRepository } from './repository';
1
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
2
+ import { UmbEntityActionBase as UmbEntityActionBase$1 } from '@umbraco-cms/backoffice/entity-action';
3
+ import { UmbDetailRepository, UmbItemRepository, UmbFolderRepository } from '@umbraco-cms/backoffice/repository';
4
4
 
5
5
  interface UmbAction<RepositoryType = unknown> {
6
6
  host: UmbControllerHostElement;
@@ -39,19 +39,13 @@ declare class UmbCopyEntityAction<T extends {
39
39
  execute(): Promise<void>;
40
40
  }
41
41
 
42
- declare class UmbDeleteEntityAction<T extends {
43
- delete(unique: string): Promise<void>;
44
- requestTreeItems(uniques: Array<string>): any;
45
- }> extends UmbEntityActionBase$1<T> {
42
+ declare class UmbDeleteEntityAction<T extends UmbDetailRepository & UmbItemRepository<any>> extends UmbEntityActionBase$1<T> {
46
43
  #private;
47
44
  constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string);
48
45
  execute(): Promise<void>;
49
46
  }
50
47
 
51
- declare class UmbDeleteFolderEntityAction<T extends {
52
- deleteFolder(unique: string): Promise<void>;
53
- requestTreeItems(uniques: Array<string>): any;
54
- }> extends UmbEntityActionBase$1<T> {
48
+ declare class UmbDeleteFolderEntityAction<T extends UmbFolderRepository> extends UmbEntityActionBase$1<T> {
55
49
  #private;
56
50
  constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string);
57
51
  execute(): Promise<void>;
@@ -77,9 +71,8 @@ declare class UmbSortChildrenOfEntityAction<T extends {
77
71
  execute(): Promise<void>;
78
72
  }
79
73
 
80
- declare class UmbTrashEntityAction<T extends {
74
+ declare class UmbTrashEntityAction<T extends UmbItemRepository<any> & {
81
75
  trash(unique: Array<string>): Promise<void>;
82
- requestTreeItems(uniques: Array<string>): any;
83
76
  }> extends UmbEntityActionBase$1<T> {
84
77
  #private;
85
78
  constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string);
@@ -0,0 +1,200 @@
1
+ import { Observable } from 'rxjs';
2
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
3
+
4
+ type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
5
+ type ClassConstructor<T> = new (...args: any[]) => T;
6
+ type ManifestTypeMap<ManifestTypes extends ManifestBase> = {
7
+ [Manifest in ManifestTypes as Manifest['type']]: Manifest;
8
+ } & {
9
+ [key: string]: ManifestBase;
10
+ };
11
+ type SpecificManifestTypeOrManifestBase<ManifestTypes extends ManifestBase, T extends keyof ManifestTypeMap<ManifestTypes> | string> = T extends keyof ManifestTypeMap<ManifestTypes> ? ManifestTypeMap<ManifestTypes>[T] : ManifestBase;
12
+ interface ManifestBase {
13
+ /**
14
+ * The type of extension such as dashboard etc...
15
+ */
16
+ type: string;
17
+ /**
18
+ * The alias of the extension, ensure it is unique
19
+ */
20
+ alias: string;
21
+ /**
22
+ * The kind of the extension, used to group extensions together
23
+ *
24
+ * @examples ["button"]
25
+ */
26
+ kind?: unknown;
27
+ /**
28
+ * The friendly name of the extension
29
+ */
30
+ name: string;
31
+ /**
32
+ * Extensions such as dashboards are ordered by weight with lower numbers being first in the list
33
+ */
34
+ weight?: number;
35
+ }
36
+ interface ManifestKind<ManifestTypes> {
37
+ type: 'kind';
38
+ alias: string;
39
+ matchType: string;
40
+ matchKind: string;
41
+ manifest: Partial<ManifestTypes>;
42
+ }
43
+ interface ManifestWithConditions<ConditionsType> {
44
+ /**
45
+ * Set the conditions for when the extension should be loaded
46
+ */
47
+ conditions: ConditionsType;
48
+ }
49
+ interface ManifestWithLoader<LoaderReturnType> extends ManifestBase {
50
+ /**
51
+ * @TJS-ignore
52
+ */
53
+ loader?: () => Promise<LoaderReturnType>;
54
+ }
55
+ /**
56
+ * The type of extension such as dashboard etc...
57
+ */
58
+ interface ManifestClass<ClassType = unknown> extends ManifestWithLoader<{
59
+ default: ClassConstructor<ClassType>;
60
+ }> {
61
+ readonly CLASS_TYPE?: ClassType;
62
+ /**
63
+ * The file location of the javascript file to load
64
+ * @TJS-required
65
+ */
66
+ js?: string;
67
+ /**
68
+ * @TJS-ignore
69
+ */
70
+ className?: string;
71
+ /**
72
+ * @TJS-ignore
73
+ */
74
+ class?: ClassConstructor<ClassType>;
75
+ }
76
+ interface ManifestClassWithClassConstructor<T = unknown> extends ManifestClass<T> {
77
+ class: ClassConstructor<T>;
78
+ }
79
+ interface ManifestElement<ElementType extends HTMLElement = HTMLElement> extends ManifestWithLoader<{
80
+ default: ClassConstructor<ElementType>;
81
+ } | Omit<object, 'default'>> {
82
+ readonly ELEMENT_TYPE?: ElementType;
83
+ /**
84
+ * The file location of the javascript file to load
85
+ *
86
+ * @TJS-require
87
+ */
88
+ js?: string;
89
+ /**
90
+ * The HTML web component name to use such as 'my-dashboard'
91
+ * Note it is NOT <my-dashboard></my-dashboard> but just the name
92
+ */
93
+ elementName?: string;
94
+ /**
95
+ * This contains properties specific to the type of extension
96
+ */
97
+ meta?: unknown;
98
+ }
99
+ interface ManifestWithView<ElementType extends HTMLElement = HTMLElement> extends ManifestElement<ElementType> {
100
+ meta: MetaManifestWithView;
101
+ }
102
+ interface MetaManifestWithView {
103
+ pathname: string;
104
+ label: string;
105
+ icon: string;
106
+ }
107
+ interface ManifestElementWithElementName extends ManifestElement {
108
+ /**
109
+ * The HTML web component name to use such as 'my-dashboard'
110
+ * Note it is NOT <my-dashboard></my-dashboard> but just the name
111
+ */
112
+ elementName: string;
113
+ }
114
+ interface ManifestWithMeta extends ManifestBase {
115
+ /**
116
+ * This contains properties specific to the type of extension
117
+ */
118
+ meta: unknown;
119
+ }
120
+ /**
121
+ * This type of extension gives full control and will simply load the specified JS file
122
+ * You could have custom logic to decide which extensions to load/register by using extensionRegistry
123
+ */
124
+ interface ManifestEntryPoint extends ManifestBase {
125
+ type: 'entryPoint';
126
+ /**
127
+ * The file location of the javascript file to load in the backoffice
128
+ */
129
+ js: string;
130
+ }
131
+
132
+ declare class UmbExtensionRegistry<IncomingManifestTypes extends ManifestBase, ManifestTypes extends ManifestBase = IncomingManifestTypes | ManifestBase> {
133
+ private _extensions;
134
+ readonly extensions: Observable<ManifestTypes[]>;
135
+ private _kinds;
136
+ readonly kinds: Observable<ManifestKind<ManifestTypes>[]>;
137
+ defineKind(kind: ManifestKind<ManifestTypes>): void;
138
+ register(manifest: ManifestTypes | ManifestKind<ManifestTypes>): void;
139
+ registerMany(manifests: Array<ManifestTypes | ManifestKind<ManifestTypes>>): void;
140
+ unregister(alias: string): void;
141
+ isRegistered(alias: string): boolean;
142
+ private _kindsOfType;
143
+ private _extensionsOfType;
144
+ private _kindsOfTypes;
145
+ private _extensionsOfTypes;
146
+ getByTypeAndAlias<Key extends keyof ManifestTypeMap<ManifestTypes> | string, T extends ManifestBase = SpecificManifestTypeOrManifestBase<ManifestTypes, Key>>(type: Key, alias: string): Observable<T | undefined>;
147
+ extensionsOfType<Key extends keyof ManifestTypeMap<ManifestTypes> | string, T extends ManifestBase = SpecificManifestTypeOrManifestBase<ManifestTypes, Key>>(type: Key): Observable<T[]>;
148
+ extensionsOfTypes<ExtensionTypes extends ManifestBase = ManifestBase>(types: string[]): Observable<Array<ExtensionTypes>>;
149
+ }
150
+
151
+ declare function isManifestClassConstructorType(manifest: unknown): manifest is ManifestClassWithClassConstructor;
152
+
153
+ declare function isManifestClassableType(manifest: ManifestBase): manifest is ManifestClass;
154
+
155
+ declare function isManifestElementNameType(manifest: unknown): manifest is ManifestElementWithElementName;
156
+
157
+ declare function isManifestElementableType<ElementType extends HTMLElement = HTMLElement>(manifest: ManifestBase): manifest is ManifestElement;
158
+
159
+ type ManifestJSType<T> = ManifestWithLoader<T> & {
160
+ js: string;
161
+ };
162
+ declare function isManifestJSType<T>(manifest: ManifestBase | unknown): manifest is ManifestJSType<T>;
163
+
164
+ type ManifestLoaderType<T> = ManifestWithLoader<T> & {
165
+ loader: () => Promise<T>;
166
+ };
167
+ declare function isManifestLoaderType<T>(manifest: ManifestBase): manifest is ManifestLoaderType<T>;
168
+
169
+ declare function createExtensionElement<ElementType extends HTMLElement>(manifest: ManifestElement<ElementType>): Promise<ElementType | undefined>;
170
+
171
+ declare function hasDefaultExport<ConstructorType>(object: unknown): object is {
172
+ default: ConstructorType;
173
+ };
174
+
175
+ type UmbEntryPointOnInit = (host: UmbControllerHostElement, extensionRegistry: UmbExtensionRegistry<ManifestBase>) => void;
176
+ /**
177
+ * Interface containing supported life-cycle functions for ESModule entry points
178
+ */
179
+ interface UmbEntryPointModule {
180
+ onInit: UmbEntryPointOnInit;
181
+ }
182
+
183
+ /**
184
+ * Validate if an ESModule exports a known init function called 'onInit'
185
+ */
186
+ declare function hasInitExport(obj: unknown): obj is Pick<UmbEntryPointModule, 'onInit'>;
187
+
188
+ declare function loadExtension<T = unknown>(manifest: ManifestWithLoader<T>): Promise<T | null>;
189
+
190
+ declare function createExtensionElementOrFallback(manifest: any, fallbackElementName: string): Promise<HTMLElement | undefined>;
191
+
192
+ declare function createExtensionClass<T = unknown>(manifest: ManifestClass, constructorArguments: unknown[]): Promise<T | undefined>;
193
+
194
+ declare class UmbEntryPointExtensionInitializer {
195
+ #private;
196
+ constructor(host: UmbControllerHostElement, extensionRegistry: UmbExtensionRegistry<ManifestEntryPoint>);
197
+ instantiateEntryPoint(manifest: ManifestEntryPoint): Promise<void>;
198
+ }
199
+
200
+ export { ClassConstructor, HTMLElementConstructor, ManifestBase, ManifestClass, ManifestClassWithClassConstructor, ManifestElement, ManifestElementWithElementName, ManifestEntryPoint, ManifestJSType, ManifestKind, ManifestLoaderType, ManifestTypeMap, ManifestWithConditions, ManifestWithLoader, ManifestWithMeta, ManifestWithView, MetaManifestWithView, SpecificManifestTypeOrManifestBase, UmbEntryPointExtensionInitializer, UmbEntryPointModule, UmbEntryPointOnInit, UmbExtensionRegistry, createExtensionClass, createExtensionElement, createExtensionElementOrFallback, hasDefaultExport, hasInitExport, isManifestClassConstructorType, isManifestClassableType, isManifestElementNameType, isManifestElementableType, isManifestJSType, isManifestLoaderType, loadExtension };