@umbraco-cms/backoffice 1.0.0-next.596cc732 → 1.0.0-next.6c429eee

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/models.d.ts CHANGED
@@ -3,13 +3,18 @@ import { EntityTreeItemResponseModel, FolderTreeItemResponseModel, PackageManife
3
3
  type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
4
4
  type ClassConstructor<T> = new (...args: any[]) => T;
5
5
  interface Entity {
6
- key: string;
6
+ id: string;
7
7
  name: string;
8
8
  icon: string;
9
9
  type: string;
10
10
  hasChildren: boolean;
11
- parentKey: string | null;
11
+ parentId: string | null;
12
12
  }
13
+ /** Tried to find a common base of our entities — used by Entity Workspace Context */
14
+ type BaseEntity = {
15
+ id?: string;
16
+ name?: string;
17
+ };
13
18
  interface UserEntity extends Entity {
14
19
  type: 'user';
15
20
  }
@@ -38,23 +43,23 @@ interface UserGroupDetails extends UserGroupEntity {
38
43
  permissions: Array<string>;
39
44
  }
40
45
  interface MemberTypeDetails extends EntityTreeItemResponseModel {
41
- key: string;
46
+ id: string;
42
47
  alias: string;
43
48
  properties: [];
44
49
  }
45
50
  interface MediaTypeDetails extends FolderTreeItemResponseModel {
46
- key: string;
51
+ id: string;
47
52
  alias: string;
48
53
  properties: [];
49
54
  }
50
55
  interface MemberGroupDetails extends EntityTreeItemResponseModel {
51
- key: string;
56
+ id: string;
52
57
  }
53
58
  interface MemberDetails extends EntityTreeItemResponseModel {
54
- key: string;
59
+ id: string;
55
60
  }
56
61
  interface DocumentBlueprintDetails {
57
- key: string;
62
+ id: string;
58
63
  name: string;
59
64
  type: 'document-blueprint';
60
65
  properties: Array<any>;
@@ -72,4 +77,4 @@ type UmbPackageWithMigrationStatus = UmbPackage & {
72
77
  hasPendingMigrations: boolean;
73
78
  };
74
79
 
75
- export { ClassConstructor, DocumentBlueprintDetails, Entity, HTMLElementConstructor, MediaTypeDetails, MemberDetails, MemberGroupDetails, MemberTypeDetails, PackageManifestResponse, SwatchDetails, UmbPackage, UmbPackageWithMigrationStatus, UserDetails, UserEntity, UserGroupDetails, UserGroupEntity, UserStatus };
80
+ export { BaseEntity, ClassConstructor, DocumentBlueprintDetails, Entity, HTMLElementConstructor, MediaTypeDetails, MemberDetails, MemberGroupDetails, MemberTypeDetails, PackageManifestResponse, SwatchDetails, UmbPackage, UmbPackageWithMigrationStatus, UserDetails, UserEntity, UserGroupDetails, UserGroupEntity, UserStatus };
@@ -1,6 +1,6 @@
1
1
  import * as rxjs from 'rxjs';
2
2
  import { Observable, BehaviorSubject } from 'rxjs';
3
- import { UmbControllerInterface, UmbControllerHostInterface } from './controller';
3
+ import { UmbControllerInterface, UmbControllerHostElement } from './controller';
4
4
 
5
5
  declare class UmbObserver<T> {
6
6
  #private;
@@ -13,7 +13,7 @@ declare class UmbObserver<T> {
13
13
  declare class UmbObserverController<T = unknown> extends UmbObserver<T> implements UmbControllerInterface {
14
14
  _alias?: string;
15
15
  get unique(): string | undefined;
16
- constructor(host: UmbControllerHostInterface, source: Observable<T>, callback: (_value: T) => void, alias?: string);
16
+ constructor(host: UmbControllerHostElement, source: Observable<T>, callback: (_value: T) => void, alias?: string);
17
17
  }
18
18
 
19
19
  /**
@@ -98,19 +98,33 @@ declare class DeepState<T> extends BehaviorSubject<T> {
98
98
  * The ArrayState provides methods to append data when the data is an Object.
99
99
  */
100
100
  declare class ArrayState<T> extends DeepState<T[]> {
101
- private _getUnique?;
102
- constructor(initialData: T[], _getUnique?: ((entry: T) => unknown) | undefined);
101
+ #private;
102
+ constructor(initialData: T[], getUniqueMethod?: (entry: T) => unknown);
103
+ /**
104
+ * @method sortBy
105
+ * @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting everytime data is set.
106
+ * @description - A sort method to this Subject.
107
+ * @example <caption>Example add sort method</caption>
108
+ * const data = [
109
+ * { key: 1, value: 'foo'},
110
+ * { key: 2, value: 'bar'}
111
+ * ];
112
+ * const myState = new ArrayState(data, (x) => x.key);
113
+ * myState.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
114
+ */
115
+ sortBy(sortMethod?: (a: T, b: T) => number): this;
116
+ next(value: T[]): void;
103
117
  /**
104
118
  * @method remove
105
119
  * @param {unknown[]} uniques - The unique values to remove.
106
120
  * @return {ArrayState<T>} Reference to it self.
107
121
  * @description - Remove some new data of this Subject.
108
- * @example <caption>Example remove entry with key '1' and '2'</caption>
122
+ * @example <caption>Example remove entry with id '1' and '2'</caption>
109
123
  * const data = [
110
- * { key: 1, value: 'foo'},
111
- * { key: 2, value: 'bar'}
124
+ * { id: 1, value: 'foo'},
125
+ * { id: 2, value: 'bar'}
112
126
  * ];
113
- * const myState = new ArrayState(data, (x) => x.key);
127
+ * const myState = new ArrayState(data, (x) => x.id);
114
128
  * myState.remove([1, 2]);
115
129
  */
116
130
  remove(uniques: unknown[]): this;
@@ -119,12 +133,12 @@ declare class ArrayState<T> extends DeepState<T[]> {
119
133
  * @param {unknown} unique - The unique value to remove.
120
134
  * @return {ArrayState<T>} Reference to it self.
121
135
  * @description - Remove some new data of this Subject.
122
- * @example <caption>Example remove entry with key '1'</caption>
136
+ * @example <caption>Example remove entry with id '1'</caption>
123
137
  * const data = [
124
- * { key: 1, value: 'foo'},
125
- * { key: 2, value: 'bar'}
138
+ * { id: 1, value: 'foo'},
139
+ * { id: 2, value: 'bar'}
126
140
  * ];
127
- * const myState = new ArrayState(data, (x) => x.key);
141
+ * const myState = new ArrayState(data, (x) => x.id);
128
142
  * myState.removeOne(1);
129
143
  */
130
144
  removeOne(unique: unknown): this;
@@ -181,6 +195,21 @@ declare class ArrayState<T> extends DeepState<T[]> {
181
195
  * ]);
182
196
  */
183
197
  append(entries: T[]): this;
198
+ /**
199
+ * @method updateOne
200
+ * @param {unknown} unique - Unique value to find entry to update.
201
+ * @param {Partial<T>} entry - new data to be added in this Subject.
202
+ * @return {ArrayState<T>} Reference to it self.
203
+ * @description - Update a item with some new data, requires the ArrayState to be constructed with a getUnique method.
204
+ * @example <caption>Example append some data.</caption>
205
+ * const data = [
206
+ * { key: 1, value: 'foo'},
207
+ * { key: 2, value: 'bar'}
208
+ * ];
209
+ * const myState = new ArrayState(data, (x) => x.key);
210
+ * myState.updateOne(2, {value: 'updated-bar'});
211
+ */
212
+ updateOne(unique: unknown, entry: Partial<T>): this;
184
213
  }
185
214
 
186
215
  /**
@@ -226,8 +255,8 @@ declare function createObservablePart<R, T>(source$: Observable<T>, mappingFunct
226
255
  * @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
227
256
  * @description - Creates a RxJS Observable from RxJS Subject.
228
257
  * @example <caption>Example append new entry for a ArrayState or a part of DeepState/ObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
229
- * const entry = {key: 'myKey', value: 'myValue'};
230
- * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.key === key);
258
+ * const entry = {id: 'myKey', value: 'myValue'};
259
+ * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.id === id);
231
260
  * mySubject.next(newDataSet);
232
261
  */
233
262
  declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (entry: T) => unknown): T[];
@@ -246,4 +275,4 @@ declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (
246
275
  */
247
276
  declare function partialUpdateFrozenArray<T>(data: T[], partialEntry: Partial<T>, findMethod: (entry: T) => boolean): T[];
248
277
 
249
- export { ArrayState, BasicState, BooleanState, ClassState, DeepState, NumberState, ObjectState, StringState, UmbObserver, UmbObserverController, appendToFrozenArray, createObservablePart, partialUpdateFrozenArray };
278
+ export { ArrayState, BasicState, BooleanState, ClassState, DeepState, MappingFunction, NumberState, ObjectState, StringState, UmbObserver, UmbObserverController, appendToFrozenArray, createObservablePart, partialUpdateFrozenArray };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-cms/backoffice",
3
- "version": "1.0.0-next.596cc732",
3
+ "version": "1.0.0-next.6c429eee",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "umbraco",
package/repository.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ProblemDetailsModel } from './backend-api';
1
+ import { ProblemDetailsModel, FolderReponseModel, CreateFolderRequestModel, UpdateFolderReponseModel, FolderModelBaseModel } from './backend-api';
2
2
  import { DataSourceResponse as DataSourceResponse$1 } from './repository';
3
3
  import { Observable } from 'rxjs';
4
4
 
@@ -7,12 +7,20 @@ interface DataSourceResponse<T = undefined> {
7
7
  error?: ProblemDetailsModel;
8
8
  }
9
9
 
10
- interface UmbDataSource<T> {
11
- createScaffold(parentKey: string | null): Promise<DataSourceResponse$1<T>>;
12
- get(key: string): Promise<DataSourceResponse$1<T>>;
13
- insert(data: T): Promise<DataSourceResponse$1<T>>;
14
- update(data: T): Promise<DataSourceResponse$1<T>>;
15
- delete(key: string): Promise<DataSourceResponse$1<T>>;
10
+ interface UmbDataSource<CreateRequestType, UpdateRequestType, ResponseType> {
11
+ createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
12
+ get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
13
+ insert(data: CreateRequestType): Promise<any>;
14
+ update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
15
+ delete(unique: string): Promise<DataSourceResponse$1>;
16
+ }
17
+
18
+ interface UmbFolderDataSource {
19
+ createScaffold(parentId: string | null): Promise<DataSourceResponse<FolderReponseModel>>;
20
+ get(unique: string): Promise<DataSourceResponse<FolderReponseModel>>;
21
+ insert(data: CreateFolderRequestModel): Promise<DataSourceResponse<string>>;
22
+ update(unique: string, data: CreateFolderRequestModel): Promise<DataSourceResponse<UpdateFolderReponseModel>>;
23
+ delete(unique: string): Promise<DataSourceResponse>;
16
24
  }
17
25
 
18
26
  interface UmbTreeDataSource<PagedItemsType = any, ItemsType = any> {
@@ -21,24 +29,18 @@ interface UmbTreeDataSource<PagedItemsType = any, ItemsType = any> {
21
29
  getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemsType>>>;
22
30
  }
23
31
 
24
- interface UmbDetailRepository<DetailType> {
25
- createScaffold(parentKey: string | null): Promise<{
26
- data?: DetailType;
27
- error?: ProblemDetailsModel;
28
- }>;
29
- requestByKey(key: string): Promise<{
30
- data?: DetailType;
31
- error?: ProblemDetailsModel;
32
- }>;
33
- create(data: DetailType): Promise<{
34
- error?: ProblemDetailsModel;
35
- }>;
36
- save(data: DetailType): Promise<{
37
- error?: ProblemDetailsModel;
38
- }>;
39
- delete(key: string): Promise<{
40
- error?: ProblemDetailsModel;
41
- }>;
32
+ interface UmbRepositoryErrorResponse {
33
+ error?: ProblemDetailsModel;
34
+ }
35
+ interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
36
+ data?: T;
37
+ }
38
+ interface UmbDetailRepository<CreateRequestType = any, UpdateRequestType = any, ResponseType = any> {
39
+ createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
40
+ requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
41
+ create(data: CreateRequestType): Promise<UmbRepositoryErrorResponse>;
42
+ save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
43
+ delete(id: string): Promise<UmbRepositoryErrorResponse>;
42
44
  }
43
45
 
44
46
  interface UmbPagedData<T> {
@@ -66,4 +68,26 @@ interface UmbTreeRepository<ItemType = any, PagedItemType = UmbPagedData<ItemTyp
66
68
  treeItems: (uniques: string[]) => Promise<Observable<ItemType[]>>;
67
69
  }
68
70
 
69
- export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbPagedData, UmbTreeDataSource, UmbTreeRepository };
71
+ interface UmbFolderRepository {
72
+ createFolderScaffold(parentId: string | null): Promise<{
73
+ data?: FolderReponseModel;
74
+ error?: ProblemDetailsModel;
75
+ }>;
76
+ createFolder(folderRequest: CreateFolderRequestModel): Promise<{
77
+ data?: string;
78
+ error?: ProblemDetailsModel;
79
+ }>;
80
+ requestFolder(unique: string): Promise<{
81
+ data?: FolderReponseModel;
82
+ error?: ProblemDetailsModel;
83
+ }>;
84
+ updateFolder(unique: string, folder: FolderModelBaseModel): Promise<{
85
+ data?: UpdateFolderReponseModel;
86
+ error?: ProblemDetailsModel;
87
+ }>;
88
+ deleteFolder(id: string): Promise<{
89
+ error?: ProblemDetailsModel;
90
+ }>;
91
+ }
92
+
93
+ export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };
package/resources.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { UmbNotificationOptions } from './notification';
2
2
  import { ProblemDetailsModel } from './backend-api';
3
- import { UmbController, UmbControllerHostInterface } from './controller';
3
+ import { UmbController, UmbControllerHostElement } from './controller';
4
4
  import { DataSourceResponse as DataSourceResponse$1 } from './repository';
5
5
 
6
6
  declare class UmbResourceController extends UmbController {
7
7
  #private;
8
- constructor(host: UmbControllerHostInterface, promise: Promise<any>, alias?: string);
8
+ constructor(host: UmbControllerHostElement, promise: Promise<any>, alias?: string);
9
9
  hostConnected(): void;
10
10
  hostDisconnected(): void;
11
11
  /**
@@ -45,6 +45,6 @@ interface DataSourceResponse<T = undefined> {
45
45
 
46
46
  declare function tryExecute<T>(promise: Promise<T>): Promise<DataSourceResponse<T>>;
47
47
 
48
- declare function tryExecuteAndNotify<T>(host: UmbControllerHostInterface, resource: Promise<T>, options?: UmbNotificationOptions<any>): Promise<DataSourceResponse<T>>;
48
+ declare function tryExecuteAndNotify<T>(host: UmbControllerHostElement, resource: Promise<T>, options?: UmbNotificationOptions<any>): Promise<DataSourceResponse<T>>;
49
49
 
50
50
  export { UmbResourceController, tryExecute, tryExecuteAndNotify };
package/router.d.ts CHANGED
@@ -1,25 +1,7 @@
1
1
  import { UmbContextToken } from './context-api';
2
- import { UmbControllerHostInterface } from './controller';
2
+ import { UmbControllerHostElement } from './controller';
3
3
  import { UmbModalRouteRegistration } from './modal';
4
4
 
5
- interface UmbRouteLocation {
6
- name?: string;
7
- params: {
8
- [key: string]: string;
9
- };
10
- }
11
-
12
- declare class UmbRouteContext {
13
- #private;
14
- private _onGotModals;
15
- constructor(host: UmbControllerHostInterface, _onGotModals: (contextRoutes: any) => void);
16
- registerModal(registration: UmbModalRouteRegistration): UmbModalRouteRegistration<object, any>;
17
- unregisterModal(registrationToken: ReturnType<typeof this$1.registerModal>): void;
18
- _internal_routerGotBasePath(routerBasePath: string): void;
19
- _internal_modalRouterChanged(activeModalPath: string | undefined): void;
20
- }
21
- declare const UMB_ROUTE_CONTEXT_TOKEN: UmbContextToken<UmbRouteContext>;
22
-
23
5
  interface IRouterSlot<D = any, P = any> extends HTMLElement {
24
6
  readonly route: IRoute<D> | null;
25
7
  readonly isRoot: boolean;
@@ -40,14 +22,21 @@ type IRoutingInfo<D = any, P = any> = {
40
22
  };
41
23
  type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
42
24
  type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
43
- type PageComponent = HTMLElement;
25
+ type Cancel = (() => boolean);
26
+ type PageComponent = HTMLElement | undefined;
44
27
  type ModuleResolver = Promise<{
45
28
  default: any;
46
29
  }>;
47
30
  type Class<T extends PageComponent = PageComponent> = {
48
31
  new (...args: any[]): T;
49
32
  };
33
+ type Component = Class | ModuleResolver | PageComponent | (() => Class) | (() => PromiseLike<Class>) | (() => PageComponent) | (() => PromiseLike<PageComponent>) | (() => ModuleResolver) | (() => PromiseLike<ModuleResolver>);
50
34
  type Setup<D = any> = ((component: PageComponent, info: IRoutingInfo<D>) => void);
35
+ type RouterTree<D = any, P = any> = {
36
+ slot: IRouterSlot<D, P>;
37
+ } & {
38
+ child?: RouterTree;
39
+ } | null | undefined;
51
40
  type PathMatch = "prefix" | "suffix" | "full" | "fuzzy";
52
41
  /**
53
42
  * The base route interface.
@@ -70,7 +59,7 @@ interface IRedirectRoute<D = any> extends IRouteBase<D> {
70
59
  * Route type used to resolve and stamp components.
71
60
  */
72
61
  interface IComponentRoute<D = any> extends IRouteBase<D> {
73
- component: Class | ModuleResolver | PageComponent | (() => Class) | (() => PageComponent) | (() => ModuleResolver);
62
+ component: Component | PromiseLike<Component>;
74
63
  setup?: Setup;
75
64
  }
76
65
  /**
@@ -106,10 +95,22 @@ type NavigationEndEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
106
95
  type Params = {
107
96
  [key: string]: string;
108
97
  };
98
+ type Query = {
99
+ [key: string]: string;
100
+ };
101
+ type EventListenerSubscription = (() => void);
102
+ /**
103
+ * RouterSlot related events.
104
+ */
105
+ type RouterSlotEvent = "changestate";
109
106
  /**
110
107
  * History related events.
111
108
  */
112
109
  type GlobalRouterEvent = "pushstate" | "replacestate" | "popstate" | "changestate" | "willchangestate" | "navigationstart" | "navigationcancel" | "navigationerror" | "navigationsuccess" | "navigationend";
110
+ interface ISlashOptions {
111
+ start: boolean;
112
+ end: boolean;
113
+ }
113
114
  declare global {
114
115
  interface GlobalEventHandlersEventMap {
115
116
  "pushstate": PushStateEvent;
@@ -125,6 +126,255 @@ declare global {
125
126
  }
126
127
  }
127
128
 
128
- type UmbRoute = IRoute;
129
+ /**
130
+ * Dispatches a did change route event.
131
+ * @param $elem
132
+ * @param {IRoute} detail
133
+ */
134
+ declare function dispatchRouteChangeEvent<D = any>($elem: HTMLElement, detail: IRoutingInfo<D>): void;
135
+ /**
136
+ * Dispatches an event on the window object.
137
+ * @param name
138
+ * @param detail
139
+ */
140
+ declare function dispatchGlobalRouterEvent<D = any>(name: GlobalRouterEvent, detail?: IRoutingInfo<D>): void;
141
+ /**
142
+ * Adds an event listener (or more) to an element and returns a function to unsubscribe.
143
+ * @param $elem
144
+ * @param type
145
+ * @param listener
146
+ * @param options
147
+ */
148
+ declare function addListener<T extends Event, eventType extends string>($elem: EventTarget, type: eventType[] | eventType, listener: ((e: T) => void), options?: boolean | AddEventListenerOptions): EventListenerSubscription;
149
+ /**
150
+ * Removes the event listeners in the array.
151
+ * @param listeners
152
+ */
153
+ declare function removeListeners(listeners: EventListenerSubscription[]): void;
154
+
155
+ declare const historyPatches: [string, GlobalRouterEvent[]][];
156
+ /**
157
+ * Patches the history object by ensuring correct events are dispatches when the history changes.
158
+ */
159
+ declare function ensureHistoryEvents(): void;
160
+ /**
161
+ * Attaches a global router event after the native function on the object has been invoked.
162
+ * Stores the original function at the _name.
163
+ * @param obj
164
+ * @param functionName
165
+ * @param eventName
166
+ */
167
+ declare function attachCallback(obj: any, functionName: string, eventName: GlobalRouterEvent): void;
168
+ /**
169
+ * Saves the native function on the history object.
170
+ * @param obj
171
+ * @param name
172
+ * @param func
173
+ */
174
+ declare function saveNativeFunction(obj: any, name: string, func: (() => void)): void;
175
+ declare global {
176
+ interface History {
177
+ "native": {
178
+ "back": ((distance?: any) => void);
179
+ "forward": ((distance?: any) => void);
180
+ "go": ((delta?: any) => void);
181
+ "pushState": ((data: any, title?: string, url?: string | null) => void);
182
+ "replaceState": ((data: any, title?: string, url?: string | null) => void);
183
+ };
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Determines whether the path is active.
189
+ * If the full path starts with the path and is followed by the end of the string or a "/" the path is considered active.
190
+ * @param path
191
+ * @param fullPath
192
+ */
193
+ declare function isPathActive(path: string | PathFragment, fullPath?: string): boolean;
194
+ /**
195
+ * Matches a route.
196
+ * @param route
197
+ * @param path
198
+ */
199
+ declare function matchRoute<D = any>(route: IRoute<D>, path: string | PathFragment): IRouteMatch<D> | null;
200
+ /**
201
+ * Matches the first route that matches the given path.
202
+ * @param routes
203
+ * @param path
204
+ */
205
+ declare function matchRoutes<D = any>(routes: IRoute<D>[], path: string | PathFragment): IRouteMatch<D> | null;
206
+ /**
207
+ * Returns the page from the route.
208
+ * If the component provided is a function (and not a class) call the function to get the promise.
209
+ * @param route
210
+ * @param info
211
+ */
212
+ declare function resolvePageComponent(route: IComponentRoute, info: IRoutingInfo): Promise<PageComponent>;
213
+ /**
214
+ * Determines if a route is a redirect route.
215
+ * @param route
216
+ */
217
+ declare function isRedirectRoute(route: IRoute): route is IRedirectRoute;
218
+ /**
219
+ * Determines if a route is a resolver route.
220
+ * @param route
221
+ */
222
+ declare function isResolverRoute(route: IRoute): route is IResolverRoute;
223
+ /**
224
+ * Traverses the router tree up to the root route.
225
+ * @param slot
226
+ */
227
+ declare function traverseRouterTree(slot: IRouterSlot): {
228
+ tree: RouterTree;
229
+ depth: number;
230
+ };
231
+ /**
232
+ * Generates a path based on the router tree.
233
+ * @param tree
234
+ * @param depth
235
+ */
236
+ declare function getFragments(tree: RouterTree, depth: number): PathFragment[];
237
+ /**
238
+ * Constructs the correct absolute path based on a router.
239
+ * - Handles relative paths: "mypath"
240
+ * - Handles absolute paths: "/mypath"
241
+ * - Handles traversing paths: "../../mypath"
242
+ * @param slot
243
+ * @param path
244
+ */
245
+ declare function constructAbsolutePath<D = any, P = any>(slot: IRouterSlot<D, P>, path?: string | PathFragment): string;
246
+ /**
247
+ * Handles a redirect.
248
+ * @param slot
249
+ * @param route
250
+ */
251
+ declare function handleRedirect(slot: IRouterSlot, route: IRedirectRoute): void;
252
+ /**
253
+ * Determines whether the navigation should start based on the current match and the new match.
254
+ * @param currentMatch
255
+ * @param newMatch
256
+ */
257
+ declare function shouldNavigate<D>(currentMatch: IRouteMatch<D> | null, newMatch: IRouteMatch<D>): boolean;
258
+
259
+ /**
260
+ * Queries the parent router.
261
+ * @param $elem
262
+ */
263
+ declare function queryParentRouterSlot<D = any>($elem: Element): IRouterSlot<D> | null;
264
+ /**
265
+ * Traverses the roots and returns the first match.
266
+ * The minRoots parameter indicates how many roots should be traversed before we started matching with the query.
267
+ * @param $elem
268
+ * @param query
269
+ * @param minRoots
270
+ * @param roots
271
+ */
272
+ declare function queryParentRoots<T>($elem: Element, query: string, minRoots?: number, roots?: number): T | null;
273
+
274
+ /**
275
+ * The current path of the location.
276
+ * As default slashes are included at the start and end.
277
+ * @param options
278
+ */
279
+ declare function path(options?: Partial<ISlashOptions>): string;
280
+ /**
281
+ * Returns the path without the base path.
282
+ * @param options
283
+ */
284
+ declare function pathWithoutBasePath(options?: Partial<ISlashOptions>): string;
285
+ /**
286
+ * Returns the base path as defined in the <base> tag in the head in a reliable way.
287
+ * If eg. <base href="/router-slot/"> is defined this function will return "/router-slot/".
288
+ *
289
+ * An alternative would be to use regex on document.baseURI,
290
+ * but that will be unreliable in some cases because it
291
+ * doesn't use the built in HTMLHyperlinkElementUtils.
292
+ *
293
+ * To make this method more performant we could cache the anchor element.
294
+ * As default it will return the base path with slashes in front and at the end.
295
+ */
296
+ declare function basePath(options?: Partial<ISlashOptions>): string;
297
+ /**
298
+ * Creates an URL using the built in HTMLHyperlinkElementUtils.
299
+ * An alternative would be to use regex on document.baseURI,
300
+ * but that will be unreliable in some cases because it
301
+ * doesn't use the built in HTMLHyperlinkElementUtils.
302
+ *
303
+ * As default it will return the base path with slashes in front and at the end.
304
+ * @param path
305
+ * @param options
306
+ */
307
+ declare function constructPathWithBasePath(path: string, options?: Partial<ISlashOptions>): string;
308
+ /**
309
+ * Removes the start of the path that matches the part.
310
+ * @param path
311
+ * @param part
312
+ */
313
+ declare function stripStart(path: string, part: string): string;
314
+ /**
315
+ * Returns the query string.
316
+ */
317
+ declare function queryString(): string;
318
+ /**
319
+ * Returns the params for the current path.
320
+ * @returns Params
321
+ */
322
+ declare function query(): Query;
323
+ /**
324
+ * Strips the slash from the start and end of a path.
325
+ * @param path
326
+ */
327
+ declare function stripSlash(path: string): string;
328
+ /**
329
+ * Ensures the path starts and ends with a slash
330
+ * @param path
331
+ */
332
+ declare function ensureSlash(path: string): string;
333
+ /**
334
+ * Makes sure that the start and end slashes are present or not depending on the options.
335
+ * @param path
336
+ * @param start
337
+ * @param end
338
+ */
339
+ declare function slashify(path: string, { start, end }?: Partial<ISlashOptions>): string;
340
+ /**
341
+ * Turns a query string into an object.
342
+ * @param {string} queryString (example: ("test=123&hejsa=LOL&wuhuu"))
343
+ * @returns {Query}
344
+ */
345
+ declare function toQuery(queryString: string): Query;
346
+ /**
347
+ * Turns a query object into a string query.
348
+ * @param query
349
+ */
350
+ declare function toQueryString(query: Query): string;
351
+
352
+ /**
353
+ * Hook up a click listener to the window that, for all anchor tags
354
+ * that has a relative HREF, uses the history API instead.
355
+ */
356
+ declare function ensureAnchorHistory(): void;
357
+
358
+ interface UmbRouteLocation {
359
+ name?: string;
360
+ params: {
361
+ [key: string]: string;
362
+ };
363
+ }
364
+
365
+ declare class UmbRouteContext {
366
+ #private;
367
+ private _onGotModals;
368
+ constructor(host: UmbControllerHostElement, _onGotModals: (contextRoutes: any) => void);
369
+ registerModal(registration: UmbModalRouteRegistration): UmbModalRouteRegistration<object, any>;
370
+ unregisterModal(registrationToken: ReturnType<typeof this$1.registerModal>): void;
371
+ _internal_routerGotBasePath(routerBasePath: string): void;
372
+ _internal_modalRouterChanged(activeModalPath: string | undefined): void;
373
+ }
374
+ declare const UMB_ROUTE_CONTEXT_TOKEN: UmbContextToken<UmbRouteContext>;
375
+
376
+ declare function generateRoutePathBuilder(path: string): (params: {
377
+ [key: string]: string | number;
378
+ }) => string;
129
379
 
130
- export { UMB_ROUTE_CONTEXT_TOKEN, UmbRoute, UmbRouteContext, UmbRouteLocation };
380
+ export { Cancel, ChangeStateEvent, Class, Component, CustomResolver, EventListenerSubscription, GlobalRouterEvent, Guard, IComponentRoute, IPathFragments, IRedirectRoute, IResolverRoute, IRoute, IRouteBase, IRouteMatch, IRouterSlot, IRoutingInfo, ISlashOptions, ModuleResolver, NavigationCancelEvent, NavigationEndEvent, NavigationErrorEvent, NavigationStartEvent, NavigationSuccessEvent, PageComponent, Params, PathFragment, PathMatch, PushStateEvent, Query, ReplaceStateEvent, RouterSlotEvent, RouterTree, Setup, UMB_ROUTE_CONTEXT_TOKEN, IRoute as UmbRoute, UmbRouteContext, UmbRouteLocation, WillChangeStateEvent, addListener, attachCallback, basePath, constructAbsolutePath, constructPathWithBasePath, dispatchGlobalRouterEvent, dispatchRouteChangeEvent, ensureAnchorHistory, ensureHistoryEvents, ensureSlash, generateRoutePathBuilder, getFragments, handleRedirect, historyPatches, isPathActive, isRedirectRoute, isResolverRoute, matchRoute, matchRoutes, path, pathWithoutBasePath, query, queryParentRoots, queryParentRouterSlot, queryString, removeListeners, resolvePageComponent, saveNativeFunction, shouldNavigate, slashify, stripSlash, stripStart, toQuery, toQueryString, traverseRouterTree };