@genesislcap/foundation-shell 14.131.0 → 14.133.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/MODULE_FEDERATION.md +11 -0
- package/README.md +19 -31
- package/dist/{13.13.60f90061d33208d1354b.js → 13.13.cc8f282b2fd08bdaa429.js} +2 -2
- package/dist/{13.4d4d342ba791da63d597e22d6d61f90f.js.map → 13.18ce90986215931e094ef572bdb883d6.js.map} +1 -1
- package/dist/InjectManifest.e1f16063b12a45e391ae7b4f95241ab2.js.map +1 -0
- package/dist/dts/app/app.d.ts +159 -0
- package/dist/dts/app/app.d.ts.map +1 -0
- package/dist/dts/app/behaviors.d.ts +53 -0
- package/dist/dts/app/behaviors.d.ts.map +1 -0
- package/dist/dts/app/config.d.ts +25 -0
- package/dist/dts/app/config.d.ts.map +1 -0
- package/dist/dts/app/index.d.ts +5 -0
- package/dist/dts/app/index.d.ts.map +1 -0
- package/dist/dts/app/types.d.ts +700 -0
- package/dist/dts/app/types.d.ts.map +1 -0
- package/dist/dts/app/utils.d.ts +61 -0
- package/dist/dts/app/utils.d.ts.map +1 -0
- package/dist/dts/index.docs.d.ts +8 -0
- package/dist/dts/index.docs.d.ts.map +1 -0
- package/dist/dts/layouts/default/layout.d.ts.map +1 -1
- package/dist/dts/layouts/formatsExample/layout.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +3 -0
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.styles.d.ts +3 -0
- package/dist/dts/main/main.styles.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts +9 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/pbc/index.d.ts +2 -0
- package/dist/dts/pbc/index.d.ts.map +1 -0
- package/dist/dts/pbc/pbc.d.ts +68 -0
- package/dist/dts/pbc/pbc.d.ts.map +1 -0
- package/dist/dts/pbc/vite/exports.d.ts +26 -0
- package/dist/dts/pbc/vite/exports.d.ts.map +1 -0
- package/dist/dts/pbc/vite/index.d.ts +2 -0
- package/dist/dts/pbc/vite/index.d.ts.map +1 -0
- package/dist/dts/pbc/vite/utils.d.ts +8 -0
- package/dist/dts/pbc/vite/utils.d.ts.map +1 -0
- package/dist/dts/pbc/webpack/exports.d.ts +26 -0
- package/dist/dts/pbc/webpack/exports.d.ts.map +1 -0
- package/dist/dts/pbc/webpack/index.d.ts +2 -0
- package/dist/dts/pbc/webpack/index.d.ts.map +1 -0
- package/dist/dts/pbc/webpack/utils.d.ts +9 -0
- package/dist/dts/pbc/webpack/utils.d.ts.map +1 -0
- package/dist/dts/serviceWorker/serviceWorker.d.ts +5 -0
- package/dist/dts/serviceWorker/serviceWorker.d.ts.map +1 -1
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/esm/app/app.js +190 -0
- package/dist/esm/app/behaviors.js +126 -0
- package/dist/esm/app/config.js +28 -0
- package/dist/esm/app/index.js +4 -0
- package/dist/esm/app/types.js +1 -0
- package/dist/esm/app/utils.js +102 -0
- package/dist/esm/index.docs.js +7 -0
- package/dist/esm/layouts/default/layout.js +3 -0
- package/dist/esm/layouts/formatsExample/layout.js +3 -0
- package/dist/esm/main/main.js +3 -0
- package/dist/esm/main/main.styles.js +3 -0
- package/dist/esm/main/main.template.js +9 -0
- package/dist/esm/pbc/index.js +1 -0
- package/dist/esm/pbc/pbc.js +82 -0
- package/dist/esm/pbc/vite/exports.js +38 -0
- package/dist/esm/pbc/vite/index.js +1 -0
- package/dist/esm/pbc/vite/utils.js +16 -0
- package/dist/esm/pbc/webpack/exports.js +26 -0
- package/dist/esm/pbc/webpack/index.js +1 -0
- package/dist/esm/pbc/webpack/utils.js +16 -0
- package/dist/esm/serviceWorker/serviceWorker.js +2 -0
- package/dist/foundation-shell.api.json +4415 -0
- package/dist/foundation-shell.d.ts +1098 -0
- package/dist/{foundationShell.36a3b143a4ba39b4f032455d8eb5e502.js.map → foundationShell.fadec38bfa479afb70fbd232cd79236c.js.map} +1 -1
- package/dist/index.html +2 -2
- package/dist/main.3083ee4d28f46e8a3506.js +2 -0
- package/dist/{main.6f018458fb996d9110cc5fd4557cc7b2.js.map → main.4eedb5ca7f0017cbc616ee79b8e61731.js.map} +1 -1
- package/dist/remoteEntry.js +2 -2
- package/dist/sw.js +2 -2
- package/dist/{swRegistration.5825d13b9d973891da34.js → swRegistration.48635f3caa94cdf4bcb2.js} +2 -2
- package/dist/{swRegistration.de691080ebb6f93ca0a423137ad2c19a.js.map → swRegistration.a93f46a92fddad87f178ead7e088ee54.js.map} +1 -1
- package/docs/.gitattributes +2 -0
- package/docs/api/foundation-shell.app.config.md +13 -0
- package/docs/api/foundation-shell.app.deregisterassets.md +17 -0
- package/docs/api/foundation-shell.app.hasassets.md +17 -0
- package/docs/api/foundation-shell.app.md +49 -0
- package/docs/api/foundation-shell.app.registerassets.md +52 -0
- package/docs/api/foundation-shell.appassets.elements.md +13 -0
- package/docs/api/foundation-shell.appassets.md +25 -0
- package/docs/api/foundation-shell.appassets.metadata.md +13 -0
- package/docs/api/foundation-shell.appassets.registrations.md +13 -0
- package/docs/api/foundation-shell.appassets.routes.md +13 -0
- package/docs/api/foundation-shell.appassets.stores.md +13 -0
- package/docs/api/foundation-shell.appassets.styles.md +13 -0
- package/docs/api/foundation-shell.appconfig.context.md +11 -0
- package/docs/api/foundation-shell.appconfig.defaultelementrepeatoptions.md +11 -0
- package/docs/api/foundation-shell.appconfig.md +21 -0
- package/docs/api/foundation-shell.appcontext.md +19 -0
- package/docs/api/foundation-shell.appdependencies.md +15 -0
- package/docs/api/foundation-shell.appdependencyprerequisites.md +15 -0
- package/docs/api/foundation-shell.appelement.md +55 -0
- package/docs/api/foundation-shell.appelementpredicate.md +17 -0
- package/docs/api/foundation-shell.appmetadata.md +45 -0
- package/docs/api/foundation-shell.appregister.deregisterelement.md +31 -0
- package/docs/api/foundation-shell.appregister.deregisterroute.md +31 -0
- package/docs/api/foundation-shell.appregister.deregisterstore.md +31 -0
- package/docs/api/foundation-shell.appregister.deregisterstyle.md +31 -0
- package/docs/api/foundation-shell.appregister.md +37 -0
- package/docs/api/foundation-shell.appregister.registercomponents.md +13 -0
- package/docs/api/foundation-shell.appregister.registerelement.md +31 -0
- package/docs/api/foundation-shell.appregister.registerelementstarget.md +13 -0
- package/docs/api/foundation-shell.appregister.registerroute.md +31 -0
- package/docs/api/foundation-shell.appregister.registerroutecollection.md +13 -0
- package/docs/api/foundation-shell.appregister.registerstore.md +31 -0
- package/docs/api/foundation-shell.appregister.registerstoreroot.md +13 -0
- package/docs/api/foundation-shell.appregister.registerstyle.md +31 -0
- package/docs/api/foundation-shell.appregister.registerstylestarget.md +13 -0
- package/docs/api/foundation-shell.appregistration.md +57 -0
- package/docs/api/foundation-shell.appregistrationcontext.md +15 -0
- package/docs/api/foundation-shell.approute.md +49 -0
- package/docs/api/foundation-shell.approutepredicate.md +17 -0
- package/docs/api/foundation-shell.appstore.md +45 -0
- package/docs/api/foundation-shell.appstorepredicate.md +17 -0
- package/docs/api/foundation-shell.appstyle.md +48 -0
- package/docs/api/foundation-shell.appstylepredicate.md +17 -0
- package/docs/api/foundation-shell.apptargetid.md +43 -0
- package/docs/api/foundation-shell.apptokentypepredicate.md +13 -0
- package/docs/api/foundation-shell.appvalidity.isvalid.md +26 -0
- package/docs/api/foundation-shell.appvalidity.md +20 -0
- package/docs/api/foundation-shell.appvaliditycontext.md +18 -0
- package/docs/api/foundation-shell.assetpredicate.md +12 -0
- package/docs/api/foundation-shell.defaultapp.deregisterassets.md +17 -0
- package/docs/api/foundation-shell.defaultapp.deregisterelement.md +24 -0
- package/docs/api/foundation-shell.defaultapp.deregisterroute.md +24 -0
- package/docs/api/foundation-shell.defaultapp.deregisterstore.md +24 -0
- package/docs/api/foundation-shell.defaultapp.deregisterstyle.md +24 -0
- package/docs/api/foundation-shell.defaultapp.elements.md +13 -0
- package/docs/api/foundation-shell.defaultapp.hasassets.md +17 -0
- package/docs/api/foundation-shell.defaultapp.isvalid.md +26 -0
- package/docs/api/foundation-shell.defaultapp.md +48 -0
- package/docs/api/foundation-shell.defaultapp.metadata.md +13 -0
- package/docs/api/foundation-shell.defaultapp.registerassets.md +24 -0
- package/docs/api/foundation-shell.defaultapp.registercomponents.md +24 -0
- package/docs/api/foundation-shell.defaultapp.registerelement.md +24 -0
- package/docs/api/foundation-shell.defaultapp.registerelementstarget.md +28 -0
- package/docs/api/foundation-shell.defaultapp.registerroute.md +24 -0
- package/docs/api/foundation-shell.defaultapp.registerroutecollection.md +25 -0
- package/docs/api/foundation-shell.defaultapp.registerstore.md +24 -0
- package/docs/api/foundation-shell.defaultapp.registerstoreroot.md +25 -0
- package/docs/api/foundation-shell.defaultapp.registerstyle.md +24 -0
- package/docs/api/foundation-shell.defaultapp.registerstylestarget.md +27 -0
- package/docs/api/foundation-shell.defaultapp.registrations.md +13 -0
- package/docs/api/foundation-shell.defaultapp.routes.md +13 -0
- package/docs/api/foundation-shell.defaultapp.stores.md +13 -0
- package/docs/api/foundation-shell.defaultapp.styles.md +13 -0
- package/docs/api/foundation-shell.defaultappconfig.md +13 -0
- package/docs/api/foundation-shell.dynamictemplate.md +12 -0
- package/docs/api/foundation-shell.getapp.md +30 -0
- package/docs/api/foundation-shell.getqualifiedmoduletokens.md +11 -0
- package/docs/api/foundation-shell.haspredicate.md +17 -0
- package/docs/api/foundation-shell.hastarget.md +15 -0
- package/docs/api/foundation-shell.importpbcassets.md +75 -0
- package/docs/api/foundation-shell.isappelement.md +22 -0
- package/docs/api/foundation-shell.isappmetadata.md +22 -0
- package/docs/api/foundation-shell.isappregistration.md +22 -0
- package/docs/api/foundation-shell.isapproute.md +22 -0
- package/docs/api/foundation-shell.isappstore.md +22 -0
- package/docs/api/foundation-shell.isappstyle.md +22 -0
- package/docs/api/foundation-shell.iscomposablestyles.md +22 -0
- package/docs/api/foundation-shell.isviewtemplate.md +22 -0
- package/docs/api/foundation-shell.loadingtemplate.md +12 -0
- package/docs/api/foundation-shell.mainapplication.connectedcallback.md +15 -0
- package/docs/api/foundation-shell.mainapplication.md +27 -0
- package/docs/api/foundation-shell.mainapplication.ready.md +11 -0
- package/docs/api/foundation-shell.mainapplication.selecttemplate.md +15 -0
- package/docs/api/foundation-shell.maintemplate.md +12 -0
- package/docs/api/foundation-shell.md +81 -0
- package/docs/api/foundation-shell.registercomponents.md +34 -0
- package/docs/api/foundation-shell.registerelementstarget.md +39 -0
- package/docs/api/foundation-shell.registerroutecollection.md +24 -0
- package/docs/api/foundation-shell.registerstoreroot.md +33 -0
- package/docs/api/foundation-shell.registerstylestarget.md +27 -0
- package/docs/api/foundation-shell.registrationpredicate.md +12 -0
- package/docs/api/foundation-shell.targetidpredicate.md +12 -0
- package/docs/api/index.md +12 -0
- package/docs/api-report.md +293 -0
- package/package.json +50 -9
- package/dist/InjectManifest.44b41759e967dfc682a50ab3e02bfaba.js.map +0 -1
- package/dist/main.21fe80be0d6102e2dccf.js +0 -2
|
@@ -0,0 +1,1098 @@
|
|
|
1
|
+
import { Behavior } from '@microsoft/fast-element';
|
|
2
|
+
import { ComposableStyles } from '@microsoft/fast-element';
|
|
3
|
+
import type { DesignSystemModule } from '@genesislcap/foundation-utils';
|
|
4
|
+
import type { ElementStyles } from '@microsoft/fast-element';
|
|
5
|
+
import { FASTElement } from '@microsoft/fast-element';
|
|
6
|
+
import type { FoundationRoute } from '@genesislcap/foundation-ui';
|
|
7
|
+
import type { FoundationRouteCollection } from '@genesislcap/foundation-ui';
|
|
8
|
+
import type { HasElement } from '@microsoft/fast-router';
|
|
9
|
+
import { InterfaceSymbol } from '@microsoft/fast-foundation';
|
|
10
|
+
import { RepeatOptions } from '@microsoft/fast-element';
|
|
11
|
+
import type { StoreRoot } from '@genesislcap/foundation-store';
|
|
12
|
+
import { ViewTemplate } from '@microsoft/fast-element';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `App` provides APIs to register integration targets for PBCs and other actors to register their assets in bulk via
|
|
16
|
+
* token exports. It also provides specific APIs to add single assets to the application itself, like routes, elements,
|
|
17
|
+
* styles, store fragments etc.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* App reference via DI.
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { App } from '@genesislcap/foundation-shell/app';
|
|
23
|
+
* ...
|
|
24
|
+
* @App private app: App;
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* App reference via getApp util.
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { getApp } from '@genesislcap/foundation-shell/app';
|
|
31
|
+
* ...
|
|
32
|
+
* const app = getApp();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare interface App extends AppAssets, AppRegister, AppValidity {
|
|
38
|
+
/**
|
|
39
|
+
* High-level app configuration.
|
|
40
|
+
*/
|
|
41
|
+
readonly config: AppConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Register assets from either a globed dynamic import or some predefined AppAssets instance. This is a one time
|
|
44
|
+
* operation. Assets had be subsequently registered and deregistered using their individual APIs.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* Manual `AppAssets` registration.
|
|
48
|
+
* ```ts
|
|
49
|
+
* app.registerAssets({
|
|
50
|
+
* // with or without pbcAssets
|
|
51
|
+
* elements: [...],
|
|
52
|
+
* metadata: [...],
|
|
53
|
+
* registrations: [...],
|
|
54
|
+
* routes: [...],
|
|
55
|
+
* styles: [...],
|
|
56
|
+
* stores: [...],
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* PBC `AppAssets` registration.
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { importPBCAssets } from '@genesislcap/foundation-shell/pbc';
|
|
64
|
+
* ...
|
|
65
|
+
* const pbcAssets = await importPBCAssets();
|
|
66
|
+
* ...
|
|
67
|
+
* app.registerAssets(pbcAssets);
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param assets - {@link AppAssets}.
|
|
71
|
+
*/
|
|
72
|
+
registerAssets(assets: Partial<AppAssets>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Deregister assets.
|
|
75
|
+
*/
|
|
76
|
+
deregisterAssets(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Check if the App has registered assets.
|
|
79
|
+
*/
|
|
80
|
+
hasAssets(): boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* App DI key.
|
|
85
|
+
*
|
|
86
|
+
* @privateRemarks
|
|
87
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export declare const App: InterfaceSymbol<App>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Dynamically registered assets.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare interface AppAssets {
|
|
99
|
+
/**
|
|
100
|
+
* All {@link AppElement} tokens.
|
|
101
|
+
*/
|
|
102
|
+
readonly elements: AppElement[];
|
|
103
|
+
/**
|
|
104
|
+
* All {@link AppMetadata} tokens.
|
|
105
|
+
*/
|
|
106
|
+
readonly metadata: AppMetadata[];
|
|
107
|
+
/**
|
|
108
|
+
* All {@link AppRegistration} tokens.
|
|
109
|
+
*/
|
|
110
|
+
readonly registrations: AppRegistration[];
|
|
111
|
+
/**
|
|
112
|
+
* All {@link AppRoute} tokens.
|
|
113
|
+
*/
|
|
114
|
+
readonly routes: AppRoute[];
|
|
115
|
+
/**
|
|
116
|
+
* All {@link AppStyle} tokens.
|
|
117
|
+
*/
|
|
118
|
+
readonly styles: AppStyle[];
|
|
119
|
+
/**
|
|
120
|
+
* All {@link AppStore} tokens.
|
|
121
|
+
*/
|
|
122
|
+
readonly stores: AppStore[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* AppConfig DI interface.
|
|
127
|
+
*
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
export declare interface AppConfig {
|
|
131
|
+
context?: AppContext;
|
|
132
|
+
defaultElementRepeatOptions?: RepeatOptions;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* AppConfig DI key.
|
|
137
|
+
*
|
|
138
|
+
* @internal
|
|
139
|
+
* @privateRemarks
|
|
140
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
|
141
|
+
*/
|
|
142
|
+
export declare const AppConfig: InterfaceSymbol<AppConfig>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Context passed to predicate functions and other utilities.
|
|
146
|
+
*
|
|
147
|
+
* @privateRemarks
|
|
148
|
+
* Properties are dynamically assigned.
|
|
149
|
+
*
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
export declare type AppContext = {
|
|
153
|
+
env?: string;
|
|
154
|
+
domain?: string;
|
|
155
|
+
user?: {};
|
|
156
|
+
answers?: {};
|
|
157
|
+
featureFlags?: {};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* A record of app dependencies.
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
export declare type AppDependencies = {
|
|
165
|
+
[key: string]: string;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A record of app dependency prerequisites.
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
export declare type AppDependencyPrerequisites = {
|
|
173
|
+
[key: string]: string;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @example
|
|
178
|
+
* AppElement definition example.
|
|
179
|
+
* ```ts
|
|
180
|
+
* const store = getNotifyStore();
|
|
181
|
+
* ...
|
|
182
|
+
* export const inboxFlyout: AppElement = {
|
|
183
|
+
* targetId: 'layout',
|
|
184
|
+
* elements: html`
|
|
185
|
+
* <zero-flyout
|
|
186
|
+
* position="right"
|
|
187
|
+
* @closed=${(x, c) => c.parent.$emit('change-inbox-display', false)}
|
|
188
|
+
* ?closed=${() => !store.inboxDisplayState}
|
|
189
|
+
* displayHeader=${false}
|
|
190
|
+
* data-pbc-asset-id="inbox-flyout"
|
|
191
|
+
* >
|
|
192
|
+
* <foundation-inbox
|
|
193
|
+
* @close=${(x, c) => (<Flyout>(<HTMLElement>c.event.target).parentNode).closeFlyout()}
|
|
194
|
+
* ></foundation-inbox>
|
|
195
|
+
* </zero-flyout>
|
|
196
|
+
* `,
|
|
197
|
+
* };
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* Note that bindings may need to use `c.parent` to `$emit` or reference properties of the target integration point.
|
|
201
|
+
* The inclusion of a `data-pbc-asset-id` is not a hard requirement, but should be considered for future operations.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* Optional runtime {@link AssetPredicate} function to determine if the asset should be used.
|
|
205
|
+
* ```ts
|
|
206
|
+
* export const inboxFlyout: AppElement = {
|
|
207
|
+
* targetId: 'layout',
|
|
208
|
+
* predicate: (context: AppContext) => true, // < assess the user, permissions, env, domain, etc.
|
|
209
|
+
* elements: html``,
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @typeParam TSource - Optional ViewTemplate TSource interface.
|
|
214
|
+
* @typeParam TParent - Optional ViewTemplate TParent interface.
|
|
215
|
+
* @typeParam TTarget - Optional target id type.
|
|
216
|
+
*
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
export declare type AppElement<TSource = any, TParent = any, TTarget = string> = HasTarget<TTarget> & HasPredicate & {
|
|
220
|
+
/**
|
|
221
|
+
* The elements to integrate.
|
|
222
|
+
*/
|
|
223
|
+
elements: ViewTemplate<TSource, TParent>;
|
|
224
|
+
/**
|
|
225
|
+
* Optional placement index which influences ordering.
|
|
226
|
+
*/
|
|
227
|
+
placementIndex?: number;
|
|
228
|
+
/**
|
|
229
|
+
* Optional slot id of the target, such as start, end or default/omitted.
|
|
230
|
+
* @privateRemarks
|
|
231
|
+
* Not currently used. We could mirror https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement#position here.
|
|
232
|
+
*/
|
|
233
|
+
slotId?: string;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Determine if {@link AppElement} should be included during runtime integration.
|
|
238
|
+
*
|
|
239
|
+
* Provides app, micro frontend, and seed author fine-grained control over what assets they will accept in their
|
|
240
|
+
* target integration points. This is a similar concept to {@link @microsoft/fast-element#ElementsFilter} which may be
|
|
241
|
+
* applied to slotted content. For example the accordion accepts slotted accordionItems only.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
export declare type AppElementPredicate = (element: AppElement, context?: AppContext) => boolean;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @example
|
|
249
|
+
* AppMetadata definition example.
|
|
250
|
+
* ```ts
|
|
251
|
+
* // src/pbc/reporting/metadata.ts
|
|
252
|
+
*
|
|
253
|
+
* export const metadata: AppMetadata = {
|
|
254
|
+
* name: '@genesiscommunitysuccess/pbc-reporting',
|
|
255
|
+
* description: 'Genesis Reporting PBC',
|
|
256
|
+
* version: '1.0.0',
|
|
257
|
+
* prerequisites: {
|
|
258
|
+
* '@genesislcap/foundation-ui': '14.0.0',
|
|
259
|
+
* gsf: '7.1.0-SNAPSHOT',
|
|
260
|
+
* },
|
|
261
|
+
* dependencies: {
|
|
262
|
+
* '@genesislcap/pbc-reporting': '1.0.0',
|
|
263
|
+
* serverDepId: '7.1.0-SNAPSHOT',
|
|
264
|
+
* },
|
|
265
|
+
* };
|
|
266
|
+
* ```
|
|
267
|
+
*
|
|
268
|
+
* @remarks
|
|
269
|
+
* It is not a hard requirement to have a `metadata.ts` file or a `AppMetadata` export token.
|
|
270
|
+
*
|
|
271
|
+
* @public
|
|
272
|
+
*/
|
|
273
|
+
export declare type AppMetadata = {
|
|
274
|
+
name: string;
|
|
275
|
+
version: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
dependencies?: AppDependencies;
|
|
278
|
+
prerequisites?: AppDependencyPrerequisites;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* APIs to register asset targets and assets. These can be lazily registered and deregistered.
|
|
283
|
+
*
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
286
|
+
export declare interface AppRegister {
|
|
287
|
+
/** {@inheritDoc RegisterComponents} */
|
|
288
|
+
registerComponents: RegisterComponents;
|
|
289
|
+
/** {@inheritDoc RegisterElementsTarget} */
|
|
290
|
+
registerElementsTarget: RegisterElementsTarget;
|
|
291
|
+
/**
|
|
292
|
+
* API for developers to register {@link AppElement | AppElements} lazily.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* getApp().registerElement(someAppElement);
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* @param element - The {@link AppElement} to register.
|
|
300
|
+
*
|
|
301
|
+
* @public
|
|
302
|
+
*/
|
|
303
|
+
registerElement(element: AppElement): void;
|
|
304
|
+
/**
|
|
305
|
+
* API for developers to deregister {@link AppElement | AppElements}.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* getApp().deregisterElement(someAppElement);
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @param element - The {@link AppElement} to deregister.
|
|
313
|
+
*
|
|
314
|
+
* @public
|
|
315
|
+
*/
|
|
316
|
+
deregisterElement(element: AppElement): void;
|
|
317
|
+
/** {@inheritDoc RegisterRouteCollection} */
|
|
318
|
+
registerRouteCollection: RegisterRouteCollection;
|
|
319
|
+
/**
|
|
320
|
+
* API for developers to register {@link AppRoute | AppRoutes} lazily.
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```ts
|
|
324
|
+
* getApp().registerRoute(someAppRoute);
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* @param route - The {@link AppRoute} to register.
|
|
328
|
+
*
|
|
329
|
+
* @public
|
|
330
|
+
*/
|
|
331
|
+
registerRoute(route: AppRoute): void;
|
|
332
|
+
/**
|
|
333
|
+
* API for developers to deregister {@link AppRoute | AppRoutes}.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* getApp().deregisterRoute(someAppRoute);
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @param route - The {@link AppRoute} to deregister.
|
|
341
|
+
*
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
deregisterRoute(route: AppRoute): void;
|
|
345
|
+
/** {@inheritDoc RegisterStylesTarget} */
|
|
346
|
+
registerStylesTarget: RegisterStylesTarget;
|
|
347
|
+
/**
|
|
348
|
+
* API for developers to register {@link AppStyle | AppStyles} lazily.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* getApp().registerStyle(someAppStyle);
|
|
353
|
+
* ```
|
|
354
|
+
*
|
|
355
|
+
* @param style - The {@link AppStyle} to register.
|
|
356
|
+
*
|
|
357
|
+
* @public
|
|
358
|
+
*/
|
|
359
|
+
registerStyle(style: AppStyle): void;
|
|
360
|
+
/**
|
|
361
|
+
* API for developers to deregister {@link AppStyle | AppStyles}.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```ts
|
|
365
|
+
* getApp().deregisterStyle(someAppStyle);
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @param style - The {@link AppStyle} to deregister.
|
|
369
|
+
*
|
|
370
|
+
* @public
|
|
371
|
+
*/
|
|
372
|
+
deregisterStyle(style: AppStyle): void;
|
|
373
|
+
/** {@inheritDoc RegisterStoreRoot} */
|
|
374
|
+
registerStoreRoot: RegisterStoreRoot;
|
|
375
|
+
/**
|
|
376
|
+
* API for developers to register {@link AppStore | AppStores} lazily.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* getApp().registerStore(someAppStore);
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* @param store - The {@link AppStore} to register.
|
|
384
|
+
*
|
|
385
|
+
* @public
|
|
386
|
+
*/
|
|
387
|
+
registerStore(store: AppStore): void;
|
|
388
|
+
/**
|
|
389
|
+
* API for developers to deregister {@link AppStore | AppStores}.
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* getApp().deregisterStore(someAppStore);
|
|
394
|
+
* ```
|
|
395
|
+
*
|
|
396
|
+
* @param store - The {@link AppStore} to deregister.
|
|
397
|
+
*
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
deregisterStore(store: AppStore): void;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @example
|
|
405
|
+
* Simple registration function to include a component and avoid it being tree-shaken out of the build.
|
|
406
|
+
* ```ts
|
|
407
|
+
* // src/pbc/notify/registrations.ts
|
|
408
|
+
*
|
|
409
|
+
* export function registerAlerts() {
|
|
410
|
+
* FoundationAlerts;
|
|
411
|
+
* }
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* Combined registration function.
|
|
416
|
+
* ```ts
|
|
417
|
+
* // src/pbc/notify/registrations.ts
|
|
418
|
+
*
|
|
419
|
+
* export function register() {
|
|
420
|
+
* FoundationAlerts;
|
|
421
|
+
* FoundationInbox;
|
|
422
|
+
* ...
|
|
423
|
+
* }
|
|
424
|
+
* ```
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* Using the host application's registration context to register with the design system and import from it if needed.
|
|
428
|
+
* ```ts
|
|
429
|
+
* // src/pbc/notify/registrations.ts
|
|
430
|
+
*
|
|
431
|
+
* export async function registerAlerts(context: AppRegistrationContext) {
|
|
432
|
+
* try {
|
|
433
|
+
* const { provideDesignSystem, tokenX } = context.designSystem;
|
|
434
|
+
* provideDesignSystem().register(foundationAlerts, tokenX);
|
|
435
|
+
* } catch (e) {
|
|
436
|
+
* console.error('Error registering alerts', e);
|
|
437
|
+
* }
|
|
438
|
+
* }
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* When defining `AppRegistration` functions in a PBC context, consider defining separate register functions if various
|
|
442
|
+
* subcomponents may be conditionally included based on user preferences or runtime predicates.
|
|
443
|
+
*
|
|
444
|
+
* @param context - {@link AppRegistrationContext}.
|
|
445
|
+
*
|
|
446
|
+
* @public
|
|
447
|
+
*/
|
|
448
|
+
export declare type AppRegistration = (context: AppRegistrationContext) => void;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Context used during component registration.
|
|
452
|
+
*
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
455
|
+
export declare type AppRegistrationContext = {
|
|
456
|
+
/**
|
|
457
|
+
* Explicitly set by app author via registerComponents.
|
|
458
|
+
*/
|
|
459
|
+
designSystem: DesignSystemModule;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* @example
|
|
464
|
+
* AppRoute definition example.
|
|
465
|
+
* ```ts
|
|
466
|
+
* export const reporting: AppRoute = {
|
|
467
|
+
* title: 'Reporting',
|
|
468
|
+
* path: 'reporting',
|
|
469
|
+
* name: 'reporting',
|
|
470
|
+
* element: async () => (await import('@genesislcap/pbc-reporting')).Reporting,
|
|
471
|
+
* navItems: [
|
|
472
|
+
* {
|
|
473
|
+
* navId: 'header',
|
|
474
|
+
* title: 'Reporting',
|
|
475
|
+
* icon: {
|
|
476
|
+
* name: 'file-csv',
|
|
477
|
+
* variant: 'solid',
|
|
478
|
+
* },
|
|
479
|
+
* placementIndex: 15,
|
|
480
|
+
* },
|
|
481
|
+
* ],
|
|
482
|
+
* };
|
|
483
|
+
* ```
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* Optional runtime {@link AssetPredicate} function to determine if the asset should be used.
|
|
487
|
+
* ```ts
|
|
488
|
+
* export const reportingAdmin: AppRoute = {
|
|
489
|
+
* path: 'reporting-admin',
|
|
490
|
+
* predicate: (context: AppContext) => context.user.isAdmin(),
|
|
491
|
+
* ...
|
|
492
|
+
* }
|
|
493
|
+
* ```
|
|
494
|
+
*
|
|
495
|
+
* @public
|
|
496
|
+
*/
|
|
497
|
+
export declare type AppRoute = FoundationRoute & HasElement & HasPredicate;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Determine if the {@link AppRoute} should be integrated.
|
|
501
|
+
*
|
|
502
|
+
* Provides app, micro frontend, and seed author fine-grained control over what assets they will accept in their
|
|
503
|
+
* target integration points.
|
|
504
|
+
*
|
|
505
|
+
* @public
|
|
506
|
+
*/
|
|
507
|
+
export declare type AppRoutePredicate = (route: AppRoute, context?: AppContext) => boolean;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* @example
|
|
511
|
+
* AppStore definition example.
|
|
512
|
+
* ```ts
|
|
513
|
+
* // src/pbc/notify/stores.ts
|
|
514
|
+
*
|
|
515
|
+
* // Setup the foundation stores your PBC needs to function, then include the following for each:
|
|
516
|
+
*
|
|
517
|
+
* export function getNotifyStore(): NotifyStore {
|
|
518
|
+
* return DI.getOrCreateDOMContainer().get(NotifyStore);
|
|
519
|
+
* }
|
|
520
|
+
*
|
|
521
|
+
* // The actual `AppStore` definition
|
|
522
|
+
* export const notifyAppStore: AppStore<NotifyStore> = {
|
|
523
|
+
* store: getNotifyStore(),
|
|
524
|
+
* };
|
|
525
|
+
* ```
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* Optional runtime {@link AssetPredicate} function to determine if the asset should be used.
|
|
529
|
+
* ```ts
|
|
530
|
+
* export const notifyAppStore: AppStore<NotifyStore> = {
|
|
531
|
+
* store: getNotifyStore(),
|
|
532
|
+
* predicate: (context: AppContext) => true, // < assess the user, permissions, env, domain, etc.
|
|
533
|
+
* };
|
|
534
|
+
* ```
|
|
535
|
+
*
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
538
|
+
export declare type AppStore<S = any> = HasPredicate & {
|
|
539
|
+
/**
|
|
540
|
+
* A `foundation-store` reference.
|
|
541
|
+
*/
|
|
542
|
+
store: S;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Determine if {@link AppStore} should be included during runtime integration.
|
|
547
|
+
*
|
|
548
|
+
* Provides app, micro frontend, and seed author fine-grained control over what assets they will accept in their
|
|
549
|
+
* target integration points.
|
|
550
|
+
*
|
|
551
|
+
* @public
|
|
552
|
+
*/
|
|
553
|
+
export declare type AppStorePredicate = (store: AppStore, context?: AppContext) => boolean;
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* @example
|
|
557
|
+
* AppStyle definition example.
|
|
558
|
+
* ```ts
|
|
559
|
+
* export const alerts: AppStyle = {
|
|
560
|
+
* targetId: 'layout',
|
|
561
|
+
* styles: css`
|
|
562
|
+
* foundation-alerts {
|
|
563
|
+
* --design-unit: 2.5;
|
|
564
|
+
* --stroke-width: 1;
|
|
565
|
+
* }
|
|
566
|
+
*
|
|
567
|
+
* foundation-alerts::part(filter-button) {
|
|
568
|
+
* --design-unit: 4;
|
|
569
|
+
* }
|
|
570
|
+
* `,
|
|
571
|
+
* };
|
|
572
|
+
* ```
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* Optional runtime {@link AssetPredicate} function to determine if the asset should be used.
|
|
576
|
+
* ```ts
|
|
577
|
+
* export const alerts: AppStyle = {
|
|
578
|
+
* targetId: 'layout',
|
|
579
|
+
* predicate: (context: AppContext) => context.user.isAdmin(),
|
|
580
|
+
* styles: css``,
|
|
581
|
+
* ...
|
|
582
|
+
* }
|
|
583
|
+
* ```
|
|
584
|
+
*
|
|
585
|
+
* @typeParam TTarget - Optional target id type.
|
|
586
|
+
*
|
|
587
|
+
* @public
|
|
588
|
+
*/
|
|
589
|
+
export declare type AppStyle<T = string> = HasTarget<T> & HasPredicate & {
|
|
590
|
+
/**
|
|
591
|
+
* The styles to integrate.
|
|
592
|
+
*/
|
|
593
|
+
styles: ComposableStyles | ComposableStyles[];
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Determine if {@link AppStyle} should be included during runtime integration.
|
|
598
|
+
*
|
|
599
|
+
* Provides app, micro frontend, and seed author fine-grained control over what assets they will accept in their
|
|
600
|
+
* target integration points.
|
|
601
|
+
*
|
|
602
|
+
* @public
|
|
603
|
+
*/
|
|
604
|
+
export declare type AppStylePredicate = (style: AppStyle, context?: AppContext) => boolean;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* @internal
|
|
608
|
+
*/
|
|
609
|
+
declare class AppStylesTargetBehavior implements Behavior {
|
|
610
|
+
protected app: App;
|
|
611
|
+
protected targetId: AppTargetId;
|
|
612
|
+
protected predicate?: AppStylePredicate;
|
|
613
|
+
protected targetElement: FASTElement;
|
|
614
|
+
protected prevTargetStyles: ElementStyles;
|
|
615
|
+
protected nextTargetStyles: ElementStyles;
|
|
616
|
+
constructor(app: App, targetId: AppTargetId, predicate?: AppStylePredicate);
|
|
617
|
+
bind(elementInstance: FASTElement): void;
|
|
618
|
+
unbind(): void;
|
|
619
|
+
handleChange(): void;
|
|
620
|
+
protected updateTargetStyles(): void;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* A targetId string or an array of targetId strings.
|
|
625
|
+
*
|
|
626
|
+
* Apps and micro frontends will predefine integration targets that dynamic app assets can target using a `targetId`
|
|
627
|
+
* property. This creates a pull-like effect where the host can live reload itself should any matching asset be lazily
|
|
628
|
+
* added, removed, or customised.
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* Foundation-header example.
|
|
632
|
+
* ```ts
|
|
633
|
+
* // src/main/targetId.ts
|
|
634
|
+
*
|
|
635
|
+
* export type NavTargetId = 'nav-start' | 'nav' | 'nav-end';
|
|
636
|
+
* export type SideNavTargetId = 'side-nav-start' | 'side-nav' | 'side-nav-end';
|
|
637
|
+
* export type ElementTargetId = HeaderTargetId | NavTargetId | SideNavTargetId;
|
|
638
|
+
* export type StyleTargetId = 'header';
|
|
639
|
+
*
|
|
640
|
+
* // src/main/main.template.ts
|
|
641
|
+
*
|
|
642
|
+
* export const NavTemplate = html<Navigation>`
|
|
643
|
+
* ...
|
|
644
|
+
* ${app.registerElementsTarget<NavTargetId>('nav-start')}
|
|
645
|
+
* ...
|
|
646
|
+
* `
|
|
647
|
+
*
|
|
648
|
+
* // src/main/main.styles.ts
|
|
649
|
+
*
|
|
650
|
+
* export const MainStyles = css`
|
|
651
|
+
* ...
|
|
652
|
+
* `.withBehaviors(getApp().registerStylesTarget<StyleTargetId>('header'));
|
|
653
|
+
* ```
|
|
654
|
+
*
|
|
655
|
+
* @typeParam TTarget - Optional target id type.
|
|
656
|
+
*
|
|
657
|
+
* @public
|
|
658
|
+
*/
|
|
659
|
+
export declare type AppTargetId<TTarget = string> = TTarget | TTarget[];
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Determine if export token should be included in the import all glob.
|
|
663
|
+
*
|
|
664
|
+
* @public
|
|
665
|
+
*/
|
|
666
|
+
export declare type AppTokenTypePredicate = (token: unknown) => boolean;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* APIs to check app validity.
|
|
670
|
+
*
|
|
671
|
+
* @public
|
|
672
|
+
*/
|
|
673
|
+
export declare interface AppValidity {
|
|
674
|
+
/**
|
|
675
|
+
* Monitors metadata and other data points as assets are registered and deregistered for app validity.
|
|
676
|
+
*
|
|
677
|
+
* @param context - {@link AppValidityContext}.
|
|
678
|
+
* @returns A boolean to indicate app validity.
|
|
679
|
+
*/
|
|
680
|
+
isValid(context: AppValidityContext): boolean;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Context used to assess app validity.
|
|
685
|
+
*
|
|
686
|
+
* @public
|
|
687
|
+
*/
|
|
688
|
+
export declare type AppValidityContext = {
|
|
689
|
+
dependencies?: AppDependencies;
|
|
690
|
+
prerequisites?: AppDependencyPrerequisites;
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Asset runtime predicate function.
|
|
695
|
+
*
|
|
696
|
+
* @param context - {@link AppContext}.
|
|
697
|
+
*
|
|
698
|
+
* @public
|
|
699
|
+
*/
|
|
700
|
+
export declare type AssetPredicate = (context?: AppContext) => boolean;
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
export declare const assetPredicate: (asset: HasPredicate, context: AppContext) => boolean;
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Default App implementation.
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
export declare class DefaultApp implements App {
|
|
712
|
+
/**
|
|
713
|
+
* {@inheritDoc App.config}
|
|
714
|
+
* @internal
|
|
715
|
+
*/
|
|
716
|
+
config: AppConfig;
|
|
717
|
+
/** {@inheritDoc AppAssets.elements} */
|
|
718
|
+
elements: AppElement[];
|
|
719
|
+
/** {@inheritDoc AppAssets.metadata} */
|
|
720
|
+
metadata: AppMetadata[];
|
|
721
|
+
/** {@inheritDoc AppAssets.registrations} */
|
|
722
|
+
registrations: AppRegistration[];
|
|
723
|
+
/** {@inheritDoc AppAssets.routes} */
|
|
724
|
+
routes: AppRoute[];
|
|
725
|
+
/** {@inheritDoc AppAssets.styles} */
|
|
726
|
+
styles: AppStyle[];
|
|
727
|
+
/** {@inheritDoc AppAssets.stores} */
|
|
728
|
+
stores: AppStore[];
|
|
729
|
+
/** {@inheritDoc AppRegister.registerElementsTarget} */
|
|
730
|
+
registerElementsTarget(targetId: any, predicate: any, repeatOptions?: RepeatOptions): ViewTemplate<any, any>;
|
|
731
|
+
/** {@inheritDoc AppRegister.registerElement} */
|
|
732
|
+
registerElement(element: any): void;
|
|
733
|
+
/** {@inheritDoc AppRegister.deregisterElement} */
|
|
734
|
+
deregisterElement(element: any): void;
|
|
735
|
+
/** {@inheritDoc AppRegister.registerRouteCollection} */
|
|
736
|
+
registerRouteCollection(routeCollection: any, predicate: any): any;
|
|
737
|
+
/** {@inheritDoc AppRegister.registerRoute} */
|
|
738
|
+
registerRoute(route: any): void;
|
|
739
|
+
/** {@inheritDoc AppRegister.deregisterRoute} */
|
|
740
|
+
deregisterRoute(route: any): void;
|
|
741
|
+
/** {@inheritDoc AppRegister.registerStoreRoot} */
|
|
742
|
+
registerStoreRoot(storeRoot: any, predicate: any): () => void;
|
|
743
|
+
/** {@inheritDoc AppRegister.registerStore} */
|
|
744
|
+
registerStore(store: any): void;
|
|
745
|
+
/** {@inheritDoc AppRegister.deregisterStore} */
|
|
746
|
+
deregisterStore(store: any): void;
|
|
747
|
+
/** {@inheritDoc AppRegister.registerStylesTarget} */
|
|
748
|
+
registerStylesTarget(targetId: any, predicate: any): AppStylesTargetBehavior;
|
|
749
|
+
/** {@inheritDoc AppRegister.registerStyle} */
|
|
750
|
+
registerStyle(style: any): void;
|
|
751
|
+
/** {@inheritDoc AppRegister.deregisterStyle} */
|
|
752
|
+
deregisterStyle(style: any): void;
|
|
753
|
+
/** {@inheritDoc AppRegister.registerComponents} */
|
|
754
|
+
registerComponents(context: any): void;
|
|
755
|
+
/**
|
|
756
|
+
* {@inheritDoc AppValidity.isValid}
|
|
757
|
+
*
|
|
758
|
+
* @privateRemarks
|
|
759
|
+
* This is a placeholder to potentially monitor metadata etc. as assets are registered and deregistered.
|
|
760
|
+
*/
|
|
761
|
+
isValid(context: any): boolean;
|
|
762
|
+
/** {@inheritDoc App.registerAssets} */
|
|
763
|
+
registerAssets(assets: any): void;
|
|
764
|
+
/** {@inheritDoc App.deregisterAssets} */
|
|
765
|
+
deregisterAssets(): void;
|
|
766
|
+
/** {@inheritDoc App.hasAssets} */
|
|
767
|
+
hasAssets(): boolean;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Default AppConfig DI implementation.
|
|
772
|
+
* @public
|
|
773
|
+
*/
|
|
774
|
+
export declare const defaultAppConfig: AppConfig;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* @public
|
|
778
|
+
*/
|
|
779
|
+
export declare const DynamicTemplate: ViewTemplate<MainApplication>;
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Gets App from the DI container.
|
|
783
|
+
*
|
|
784
|
+
* @remarks
|
|
785
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* ```ts
|
|
789
|
+
* import { getApp } from '@genesislcap/foundation-shell/app';
|
|
790
|
+
* ...
|
|
791
|
+
* private user = getApp();
|
|
792
|
+
* ```
|
|
793
|
+
*
|
|
794
|
+
* @public
|
|
795
|
+
*/
|
|
796
|
+
export declare function getApp(): App;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* @param module - An imported module.
|
|
800
|
+
* @param predicate - Token type predicate.
|
|
801
|
+
* @public
|
|
802
|
+
*/
|
|
803
|
+
export declare const getQualifiedModuleTokens: <T extends unknown>(module: any, predicate: AppTokenTypePredicate) => T[];
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Interface that includes `predicate` function.
|
|
807
|
+
*
|
|
808
|
+
* @public
|
|
809
|
+
*/
|
|
810
|
+
export declare type HasPredicate = {
|
|
811
|
+
/**
|
|
812
|
+
* Optional runtime predicate to include or exclude the pbc asset.
|
|
813
|
+
*/
|
|
814
|
+
predicate?: AssetPredicate;
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Interface that includes `targetId`.
|
|
819
|
+
*
|
|
820
|
+
* @typeParam TTarget - Optional target id type.
|
|
821
|
+
*
|
|
822
|
+
* @public
|
|
823
|
+
*/
|
|
824
|
+
export declare type HasTarget<TTarget = string> = {
|
|
825
|
+
/**
|
|
826
|
+
* The target the asset is intended for, such as main, header, header-start, header-end, layout etc.
|
|
827
|
+
*/
|
|
828
|
+
targetId: TTarget;
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* A utility for importing PBC assets that have been added to the application's src/pbc directory via genx add.
|
|
833
|
+
*
|
|
834
|
+
* The `genx` builder (webpack or vite) will attempt to dynamically load all PBC assets from the application's `src/pbc`
|
|
835
|
+
* directory by default. The returned AppAssets can then be applied to the App. Please note that `app.registerAssets`
|
|
836
|
+
* is a one-time operation, intended for upfront bulk registration. After this point, you must use the single asset
|
|
837
|
+
* APIs of the `App` for lazy asset registration or deregistration.
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* ```ts
|
|
841
|
+
* import { importPBCAssets } from '@genesislcap/foundation-shell/pbc';
|
|
842
|
+
* ...
|
|
843
|
+
* const assets = await importPBCAssets();
|
|
844
|
+
* ...
|
|
845
|
+
* app.registerAssets(assets);
|
|
846
|
+
* ```
|
|
847
|
+
*
|
|
848
|
+
* @example
|
|
849
|
+
* A typical app setup that makes use of PBC imports might look like this.
|
|
850
|
+
* ```ts
|
|
851
|
+
* // src/main/main.ts
|
|
852
|
+
*
|
|
853
|
+
* @App app: App;
|
|
854
|
+
*
|
|
855
|
+
* async connectedCallback() {
|
|
856
|
+
* ...
|
|
857
|
+
* await this.loadPBCs();
|
|
858
|
+
* ...
|
|
859
|
+
* }
|
|
860
|
+
*
|
|
861
|
+
* async loadPBCs() {
|
|
862
|
+
* // Import PBC assets that may have been added to the ./pbc directory by genx or by hand
|
|
863
|
+
* const pbcAssets = await importPBCAssets();
|
|
864
|
+
*
|
|
865
|
+
* // Register bulk assets
|
|
866
|
+
* this.app.registerAssets(pbcAssets);
|
|
867
|
+
*
|
|
868
|
+
* // Register the top-level route collection
|
|
869
|
+
* this.app.registerRouteCollection(this.config.routes);
|
|
870
|
+
* }
|
|
871
|
+
* ```
|
|
872
|
+
*
|
|
873
|
+
* The rest of the PBC setup is handled by the system automatically, however, you will still need to register
|
|
874
|
+
* application asset integration points.
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* A typical PBC directory structure may look like this.
|
|
878
|
+
* ```markdown
|
|
879
|
+
* ├── reporting
|
|
880
|
+
* │ ├── elements.ts
|
|
881
|
+
* │ ├── metadata.ts
|
|
882
|
+
* │ ├── registrations.ts
|
|
883
|
+
* │ ├── routes.ts
|
|
884
|
+
* │ ├── stores.ts
|
|
885
|
+
* │ └── styles.ts
|
|
886
|
+
* ```
|
|
887
|
+
*
|
|
888
|
+
* Each file is dynamically loaded and processed as part of the overall PBC set the application contains. PBCs do not
|
|
889
|
+
* need to include `index.ts` files, and export token naming does not matter within any of these files. For example,
|
|
890
|
+
* `foo` here `export const foo: AppElement = {...}` has no impact on PBC integration.
|
|
891
|
+
*
|
|
892
|
+
* The answers generated from the `genx add` cli flows can be used to tailor what PBC assets are included at build-time.
|
|
893
|
+
*
|
|
894
|
+
* @public
|
|
895
|
+
*/
|
|
896
|
+
export declare function importPBCAssets(): Promise<AppAssets>;
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* @param token - A module export token.
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
export declare function isAppElement(token: unknown): token is AppElement;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* @param token - A module export token.
|
|
906
|
+
* @public
|
|
907
|
+
*/
|
|
908
|
+
export declare function isAppMetadata(token: unknown): token is AppMetadata;
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* @param token - A module export token.
|
|
912
|
+
* @public
|
|
913
|
+
*/
|
|
914
|
+
export declare function isAppRegistration(token: unknown): token is AppRegistration;
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* @param token - A module export token.
|
|
918
|
+
* @public
|
|
919
|
+
*/
|
|
920
|
+
export declare function isAppRoute(token: unknown): token is AppRoute;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* @param token - A module export token.
|
|
924
|
+
* @public
|
|
925
|
+
*/
|
|
926
|
+
export declare function isAppStore(token: unknown): token is AppStore;
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* @param token - A module export token.
|
|
930
|
+
* @public
|
|
931
|
+
*/
|
|
932
|
+
export declare function isAppStyle(token: unknown): token is AppStyle;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* @param token - A module export token / styles candidate.
|
|
936
|
+
* @public
|
|
937
|
+
*/
|
|
938
|
+
export declare function isComposableStyles(token: unknown): token is ComposableStyles;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* @param token - A module export token / element candidate.
|
|
942
|
+
* @public
|
|
943
|
+
*/
|
|
944
|
+
export declare function isViewTemplate(token: unknown): token is ViewTemplate;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* @public
|
|
948
|
+
*/
|
|
949
|
+
export declare const LoadingTemplate: ViewTemplate<MainApplication>;
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* @public
|
|
953
|
+
*/
|
|
954
|
+
export declare class MainApplication extends FASTElement {
|
|
955
|
+
ready: boolean;
|
|
956
|
+
connectedCallback(): void;
|
|
957
|
+
selectTemplate(): ViewTemplate<MainApplication, any>;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* @public
|
|
962
|
+
*/
|
|
963
|
+
export declare const MainTemplate: ViewTemplate<MainApplication>;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* API for Application and Seed authors to register dynamic components.
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* Register components.
|
|
970
|
+
* ```ts
|
|
971
|
+
* export async function registerComponents() {
|
|
972
|
+
* const designSystem = await designSystemImport();
|
|
973
|
+
* const { provideDesignSystem, baseComponents } = designSystem;
|
|
974
|
+
* ...
|
|
975
|
+
* // Register any pbc components with the design system
|
|
976
|
+
* getApp().registerComponents({
|
|
977
|
+
* designSystem,
|
|
978
|
+
* });
|
|
979
|
+
* ...
|
|
980
|
+
* provideDesignSystem().register(...);
|
|
981
|
+
* }
|
|
982
|
+
* ```
|
|
983
|
+
*
|
|
984
|
+
* PBCs or other application assets may need to register components with the design system of the application, or simply
|
|
985
|
+
* to ensure they are referenced, so they can be used in template literals without the risk of them being tree-shaken
|
|
986
|
+
* out by the application's build process.
|
|
987
|
+
*
|
|
988
|
+
* @public
|
|
989
|
+
*/
|
|
990
|
+
export declare type RegisterComponents = AppRegistration;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* API for Application and Seed authors to define dynamic {@link AppElement} integration points.
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* Register elements targets within a {@link @microsoft/fast-element#html | html} template literal. An array can be used
|
|
997
|
+
* to integrate assets targeting N number of targets to the one integration location, ie. `['layout', 'layout-end']`.
|
|
998
|
+
* ```ts
|
|
999
|
+
* html`
|
|
1000
|
+
* ${app.registerElementsTarget('layout-start')}
|
|
1001
|
+
* ...
|
|
1002
|
+
* ${app.registerElementsTarget(['layout', 'layout-end'])}
|
|
1003
|
+
* `
|
|
1004
|
+
* ```
|
|
1005
|
+
*
|
|
1006
|
+
* @example
|
|
1007
|
+
* Providing a predicate function to filter what elements you will allow.
|
|
1008
|
+
* ```ts
|
|
1009
|
+
* html`
|
|
1010
|
+
* ${app.registerElementsTarget('admin-tools', (element: AppElement, context: AppContext) => {
|
|
1011
|
+
* return context.user.isAdmin();
|
|
1012
|
+
* })}
|
|
1013
|
+
* `
|
|
1014
|
+
* ```
|
|
1015
|
+
*
|
|
1016
|
+
* @param targetId - {@link AppTargetId}.
|
|
1017
|
+
* @param predicate - Optional {@link AppElementPredicate}.
|
|
1018
|
+
* @returns A {@link @microsoft/fast-element#html | html} fragment that will stay in sync as elements are registered and deregistered.
|
|
1019
|
+
*
|
|
1020
|
+
* @public
|
|
1021
|
+
*/
|
|
1022
|
+
export declare type RegisterElementsTarget = <T = string>(targetId: AppTargetId<T>, predicate?: AppElementPredicate, repeatOptions?: RepeatOptions) => ViewTemplate;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* API for Application and Seed authors to register the main {@link @genesislcap/foundation-ui#FoundationRouteCollection | FoundationRouteCollection}.
|
|
1026
|
+
*
|
|
1027
|
+
* @example
|
|
1028
|
+
* ```ts
|
|
1029
|
+
* // src/main/main.ts
|
|
1030
|
+
* ...
|
|
1031
|
+
* getApp().registerRouteCollection(this.config.routes);
|
|
1032
|
+
* ```
|
|
1033
|
+
*
|
|
1034
|
+
* @param routeCollection - The route collection to register {@link AppRoute | AppRoutes} to.
|
|
1035
|
+
* @param predicate - Optional {@link AppRoutePredicate}.
|
|
1036
|
+
*
|
|
1037
|
+
* @public
|
|
1038
|
+
*/
|
|
1039
|
+
export declare type RegisterRouteCollection = (routeCollection: FoundationRouteCollection, predicate?: AppRoutePredicate) => (source: unknown) => void;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* API for Application and Seed authors to register the {@link @genesislcap/foundation-store#StoreRoot | StoreRoot}.
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```ts
|
|
1046
|
+
* // src/store/store.ts
|
|
1047
|
+
*
|
|
1048
|
+
* class DefaultStore extends AbstractStoreRoot<Store, StoreEventDetailMap> implements Store {
|
|
1049
|
+
* ...
|
|
1050
|
+
* constructor() {
|
|
1051
|
+
* super();
|
|
1052
|
+
*
|
|
1053
|
+
* // Register the store root
|
|
1054
|
+
* getApp().registerStoreRoot(this);
|
|
1055
|
+
* }
|
|
1056
|
+
* ...
|
|
1057
|
+
* }
|
|
1058
|
+
* ```
|
|
1059
|
+
*
|
|
1060
|
+
* @param storeRoot - The store root to register {@link AppStore | AppStores} to.
|
|
1061
|
+
* @param predicate - Optional {@link AppStorePredicate}.
|
|
1062
|
+
*
|
|
1063
|
+
* @public
|
|
1064
|
+
*/
|
|
1065
|
+
export declare type RegisterStoreRoot = (storeRoot: StoreRoot, predicate?: AppStorePredicate) => (source: unknown) => void;
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* API for Application and Seed authors to define dynamic {@link AppStyle} integration points.
|
|
1069
|
+
*
|
|
1070
|
+
* @example
|
|
1071
|
+
* Register styles targets as a {@link @microsoft/fast-element#Behavior | Behavior} on a {@link @microsoft/fast-element#css | css} definition.
|
|
1072
|
+
* ```ts
|
|
1073
|
+
* export const MainStyles = css`
|
|
1074
|
+
* :host {
|
|
1075
|
+
* contain: content;
|
|
1076
|
+
* }
|
|
1077
|
+
* `.withBehaviors(getApp().registerStylesTarget('main'));
|
|
1078
|
+
* ```
|
|
1079
|
+
*
|
|
1080
|
+
* @param targetId - {@link AppTargetId}.
|
|
1081
|
+
* @param predicate - Optional {@link AppStylePredicate}.
|
|
1082
|
+
* @returns A {@link @microsoft/fast-element#Behavior | Behavior} that will stay in sync as styles are registered and deregistered.
|
|
1083
|
+
*
|
|
1084
|
+
* @public
|
|
1085
|
+
*/
|
|
1086
|
+
export declare type RegisterStylesTarget = <T = string>(targetId: AppTargetId<T>, predicate?: AppStylePredicate) => Behavior;
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* @public
|
|
1090
|
+
*/
|
|
1091
|
+
export declare const registrationPredicate: <A, P>(asset: A, predicate: P, context: AppContext) => boolean;
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* @public
|
|
1095
|
+
*/
|
|
1096
|
+
export declare const targetIdPredicate: (asset: HasTarget, targetId: AppTargetId) => boolean;
|
|
1097
|
+
|
|
1098
|
+
export { }
|