@a11d/lit-application 0.0.1
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/dist/Application.d.ts +20 -0
- package/dist/Application.d.ts.map +1 -0
- package/dist/Application.js +93 -0
- package/dist/Dialog/Dialog.d.ts +20 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -0
- package/dist/Dialog/Dialog.js +1 -0
- package/dist/Dialog/DialogCancelledError.d.ts +5 -0
- package/dist/Dialog/DialogCancelledError.d.ts.map +1 -0
- package/dist/Dialog/DialogCancelledError.js +5 -0
- package/dist/Dialog/DialogComponent.d.ts +40 -0
- package/dist/Dialog/DialogComponent.d.ts.map +1 -0
- package/dist/Dialog/DialogComponent.js +138 -0
- package/dist/Dialog/DialogHost.d.ts +11 -0
- package/dist/Dialog/DialogHost.d.ts.map +1 -0
- package/dist/Dialog/DialogHost.js +13 -0
- package/dist/Dialog/PageDialog.d.ts +13 -0
- package/dist/Dialog/PageDialog.d.ts.map +1 -0
- package/dist/Dialog/PageDialog.js +22 -0
- package/dist/Dialog/index.d.ts +6 -0
- package/dist/Dialog/index.d.ts.map +1 -0
- package/dist/Dialog/index.js +5 -0
- package/dist/Notification/NotificationComponent.d.ts +6 -0
- package/dist/Notification/NotificationComponent.d.ts.map +1 -0
- package/dist/Notification/NotificationComponent.js +1 -0
- package/dist/Notification/NotificationHost.d.ts +44 -0
- package/dist/Notification/NotificationHost.d.ts.map +1 -0
- package/dist/Notification/NotificationHost.js +93 -0
- package/dist/Notification/index.d.ts +3 -0
- package/dist/Notification/index.d.ts.map +1 -0
- package/dist/Notification/index.js +2 -0
- package/dist/Page/Page.d.ts +5 -0
- package/dist/Page/Page.d.ts.map +1 -0
- package/dist/Page/Page.js +1 -0
- package/dist/Page/PageComponent.d.ts +23 -0
- package/dist/Page/PageComponent.d.ts.map +1 -0
- package/dist/Page/PageComponent.js +48 -0
- package/dist/Page/PageError.d.ts +18 -0
- package/dist/Page/PageError.d.ts.map +1 -0
- package/dist/Page/PageError.js +68 -0
- package/dist/Page/PageHost.d.ts +11 -0
- package/dist/Page/PageHost.d.ts.map +1 -0
- package/dist/Page/PageHost.js +25 -0
- package/dist/Page/index.d.ts +5 -0
- package/dist/Page/index.d.ts.map +1 -0
- package/dist/Page/index.js +4 -0
- package/dist/PwaHelper/Manifest.d.ts +17 -0
- package/dist/PwaHelper/Manifest.d.ts.map +1 -0
- package/dist/PwaHelper/Manifest.js +1 -0
- package/dist/PwaHelper/ManifestProvider.d.ts +5 -0
- package/dist/PwaHelper/ManifestProvider.d.ts.map +1 -0
- package/dist/PwaHelper/ManifestProvider.js +16 -0
- package/dist/PwaHelper/PwaHelper.d.ts +16 -0
- package/dist/PwaHelper/PwaHelper.d.ts.map +1 -0
- package/dist/PwaHelper/PwaHelper.js +37 -0
- package/dist/PwaHelper/index.d.ts +4 -0
- package/dist/PwaHelper/index.d.ts.map +1 -0
- package/dist/PwaHelper/index.js +3 -0
- package/dist/Router/Router.d.ts +18 -0
- package/dist/Router/Router.d.ts.map +1 -0
- package/dist/Router/Router.js +31 -0
- package/dist/Router/RouterController.d.ts +2 -0
- package/dist/Router/RouterController.d.ts.map +1 -0
- package/dist/Router/RouterController.js +1 -0
- package/dist/Router/index.d.ts +5 -0
- package/dist/Router/index.d.ts.map +1 -0
- package/dist/Router/index.js +4 -0
- package/dist/Router/routerLink.d.ts +16 -0
- package/dist/Router/routerLink.d.ts.map +1 -0
- package/dist/Router/routerLink.js +31 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utilities/HookSet.d.ts +5 -0
- package/dist/utilities/HookSet.d.ts.map +1 -0
- package/dist/utilities/HookSet.js +5 -0
- package/dist/utilities/HttpError.d.ts +7 -0
- package/dist/utilities/HttpError.d.ts.map +1 -0
- package/dist/utilities/HttpError.js +46 -0
- package/dist/utilities/HttpErrorCode.d.ts +41 -0
- package/dist/utilities/HttpErrorCode.d.ts.map +1 -0
- package/dist/utilities/HttpErrorCode.js +1 -0
- package/dist/utilities/LocalStorageEntry.d.ts +13 -0
- package/dist/utilities/LocalStorageEntry.d.ts.map +1 -0
- package/dist/utilities/LocalStorageEntry.js +30 -0
- package/dist/utilities/RootCssInjectorController.d.ts +12 -0
- package/dist/utilities/RootCssInjectorController.d.ts.map +1 -0
- package/dist/utilities/RootCssInjectorController.js +21 -0
- package/dist/utilities/WindowHelper.d.ts +10 -0
- package/dist/utilities/WindowHelper.d.ts.map +1 -0
- package/dist/utilities/WindowHelper.js +22 -0
- package/dist/utilities/index.d.ts +9 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +8 -0
- package/dist/utilities/queryInstanceElement.d.ts +3 -0
- package/dist/utilities/queryInstanceElement.d.ts.map +1 -0
- package/dist/utilities/queryInstanceElement.js +9 -0
- package/dist/utilities/querySymbolizedElement.d.ts +3 -0
- package/dist/utilities/querySymbolizedElement.d.ts.map +1 -0
- package/dist/utilities/querySymbolizedElement.js +15 -0
- package/package.json +46 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component } from '@a11d/lit';
|
|
2
|
+
import { HookSet, RootCssInjectorController, RouterController } from './index.js';
|
|
3
|
+
export declare const application: () => <T extends Application>(ApplicationConstructor: Constructor<T>) => void;
|
|
4
|
+
export declare abstract class Application extends Component {
|
|
5
|
+
static readonly connectedHooks: HookSet<void>;
|
|
6
|
+
static readonly instance: Application | undefined;
|
|
7
|
+
static get styles(): import("@a11d/lit").CSSResult;
|
|
8
|
+
pageHeading?: string;
|
|
9
|
+
readonly router: RouterController;
|
|
10
|
+
protected readonly rootCssInjector: RootCssInjectorController;
|
|
11
|
+
protected connected(): Promise<void>;
|
|
12
|
+
protected initialized(): void;
|
|
13
|
+
protected createRenderRoot(): this;
|
|
14
|
+
protected get template(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
protected get notificationHostTemplate(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
protected get bodyTemplate(): import("lit-html").TemplateResult<1>;
|
|
17
|
+
protected get pageHostTemplate(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
protected get dialogHostTemplate(): import("lit-html").TemplateResult<1>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,WAAW,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAa,yBAAyB,EAAU,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGpG,eAAO,MAAM,WAAW,+EAQvB,CAAA;AAED,8BAAsB,WAAY,SAAQ,SAAS;IAClD,MAAM,CAAC,QAAQ,CAAC,cAAc,gBAAgB;IAEtB,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAA;IAEzE,WAAoB,MAAM,kCA0BzB;IAEmI,WAAW,CAAC,EAAE,MAAM,CAAA;IAExJ,QAAQ,CAAC,MAAM,mBAOd;IAED,SAAS,CAAC,QAAQ,CAAC,eAAe,4BAAwE;cAEjF,SAAS;cAKf,WAAW;cAIX,gBAAgB;IAInC,cAAuB,QAAQ,yCAM9B;IAED,SAAS,KAAK,wBAAwB,yCAErC;IAED,SAAS,KAAK,YAAY,yCAIzB;IAED,SAAS,KAAK,gBAAgB,yCAM7B;IAED,SAAS,KAAK,kBAAkB,yCAE/B;CACD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Component, property, css, html } from '@a11d/lit';
|
|
3
|
+
import { HookSet, PageError, RootCssInjectorController, Router, RouterController } from './index.js';
|
|
4
|
+
import { queryInstanceElement } from './utilities/index.js';
|
|
5
|
+
export const application = () => {
|
|
6
|
+
return (ApplicationConstructor) => {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
const application = new ApplicationConstructor;
|
|
9
|
+
window.document.body.appendChild(application);
|
|
10
|
+
application.setAttribute('application', '');
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export class Application extends Component {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.router = new RouterController(this, [...Router.pageByRoute].map(([route, page]) => ({ path: route, render: params => new page(params) })), {
|
|
18
|
+
fallback: {
|
|
19
|
+
render: () => new PageError({ error: 404 /* HttpErrorCode.NotFound */ })
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
this.rootCssInjector = new RootCssInjectorController(this, this.constructor.styles);
|
|
23
|
+
}
|
|
24
|
+
static get styles() {
|
|
25
|
+
return css `
|
|
26
|
+
:root { color-scheme: light dark; }
|
|
27
|
+
|
|
28
|
+
html, body, [application] {
|
|
29
|
+
min-height: 100vh;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
scrollbar-width: thin;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
::-webkit-scrollbar {
|
|
36
|
+
width: 5px;
|
|
37
|
+
height: 5px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
::-webkit-scrollbar-thumb {
|
|
41
|
+
background: rgba(128, 128, 128, 0.75);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
lit-page-host {
|
|
45
|
+
display: grid;
|
|
46
|
+
justify-content: start;
|
|
47
|
+
min-height: 100vh;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
async connected() {
|
|
52
|
+
await Application.connectedHooks.execute();
|
|
53
|
+
window.dispatchEvent(new Event('Application.connected'));
|
|
54
|
+
}
|
|
55
|
+
initialized() {
|
|
56
|
+
window.dispatchEvent(new Event('Application.initialized'));
|
|
57
|
+
}
|
|
58
|
+
createRenderRoot() {
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
get template() {
|
|
62
|
+
return html `
|
|
63
|
+
${this.notificationHostTemplate}
|
|
64
|
+
${this.bodyTemplate}
|
|
65
|
+
${this.dialogHostTemplate}
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
get notificationHostTemplate() {
|
|
69
|
+
return html `<lit-notification-host></lit-notification-host>`;
|
|
70
|
+
}
|
|
71
|
+
get bodyTemplate() {
|
|
72
|
+
return html `
|
|
73
|
+
${this.pageHostTemplate}
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
get pageHostTemplate() {
|
|
77
|
+
return html `
|
|
78
|
+
<lit-page-host @pageHeadingChange=${(e) => this.pageHeading = e.detail}>
|
|
79
|
+
${this.router.outlet()}
|
|
80
|
+
</lit-page-host>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
get dialogHostTemplate() {
|
|
84
|
+
return html `<lit-dialog-host></lit-dialog-host>`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
Application.connectedHooks = new HookSet();
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ updated() { document.title = [this.pageHeading, manifest === null || manifest === void 0 ? void 0 : manifest.short_name].filter(Boolean).join(' | '); } })
|
|
90
|
+
], Application.prototype, "pageHeading", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
queryInstanceElement()
|
|
93
|
+
], Application, "instance", void 0);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const enum DialogActionKey {
|
|
2
|
+
Primary = "primary",
|
|
3
|
+
Secondary = "secondary",
|
|
4
|
+
Cancellation = "cancellation"
|
|
5
|
+
}
|
|
6
|
+
export interface Dialog {
|
|
7
|
+
/** The event must be "composed", "bubbles" and "cancellable" */ readonly dialogHeadingChange: EventDispatcher<string>;
|
|
8
|
+
heading: string;
|
|
9
|
+
open: boolean;
|
|
10
|
+
readonly primaryActionElement: HTMLElement | undefined;
|
|
11
|
+
readonly secondaryActionElement: HTMLElement | undefined;
|
|
12
|
+
readonly cancellationActionElement: HTMLElement | undefined;
|
|
13
|
+
handleAction: (key: DialogActionKey) => void | Promise<void>;
|
|
14
|
+
executingAction?: DialogActionKey;
|
|
15
|
+
poppable?: boolean;
|
|
16
|
+
boundToWindow?: boolean;
|
|
17
|
+
readonly requestPopup?: EventDispatcher<void>;
|
|
18
|
+
manualClose?: boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../Dialog/Dialog.ts"],"names":[],"mappings":"AAAA,0BAAkB,eAAe;IAChC,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,YAAY,iBAAiB;CAC7B;AAED,MAAM,WAAW,MAAM;IACtB,gEAAgE,CAAC,QAAQ,CAAC,mBAAmB,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAEtH,OAAO,EAAE,MAAM,CAAA;IAEf,IAAI,EAAE,OAAO,CAAA;IAEb,QAAQ,CAAC,oBAAoB,EAAE,WAAW,GAAG,SAAS,CAAA;IACtD,QAAQ,CAAC,sBAAsB,EAAE,WAAW,GAAG,SAAS,CAAA;IACxD,QAAQ,CAAC,yBAAyB,EAAE,WAAW,GAAG,SAAS,CAAA;IAC3D,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,eAAe,CAAC,EAAE,eAAe,CAAA;IAEjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAE7C,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogCancelledError.d.ts","sourceRoot":"","sources":["../../Dialog/DialogCancelledError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,qBAAa,oBAAqB,SAAQ,KAAK;gBAClC,eAAe,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC;CAGtD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Component, PropertyValues } from '@a11d/lit';
|
|
2
|
+
import { HookSet, LocalStorageEntry } from '../index.js';
|
|
3
|
+
import { Dialog } from './index.js';
|
|
4
|
+
export declare type DialogParameters = void | Record<string, any>;
|
|
5
|
+
export declare type DialogResult<TResult> = TResult | Error;
|
|
6
|
+
export declare type DialogAction<TResult> = DialogResult<TResult> | PromiseLike<DialogResult<TResult>>;
|
|
7
|
+
export declare const enum DialogConfirmationStrategy {
|
|
8
|
+
Dialog = 0,
|
|
9
|
+
Tab = 1,
|
|
10
|
+
Window = 2
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class DialogComponent<T extends DialogParameters = void, TResult = void> extends Component {
|
|
13
|
+
readonly parameters: T;
|
|
14
|
+
static readonly beforeConfirmationHooks: HookSet<DialogComponent<any, any>>;
|
|
15
|
+
private static readonly dialogElementConstructorSymbol;
|
|
16
|
+
static dialogElement(): (constructor: Constructor<Dialog>) => void;
|
|
17
|
+
static readonly poppableConfirmationStrategy: LocalStorageEntry<DialogConfirmationStrategy>;
|
|
18
|
+
static getHost(): Promise<HTMLElement>;
|
|
19
|
+
readonly dialogElement: Dialog;
|
|
20
|
+
get primaryActionElement(): HTMLElement | undefined;
|
|
21
|
+
get secondaryActionElement(): HTMLElement | undefined;
|
|
22
|
+
get cancellationActionElement(): HTMLElement | undefined;
|
|
23
|
+
constructor(parameters: T);
|
|
24
|
+
confirm(strategy?: DialogConfirmationStrategy): Promise<TResult>;
|
|
25
|
+
private _confirmationPromiseResolve;
|
|
26
|
+
private _confirmationPromiseReject;
|
|
27
|
+
protected confirmDialog(): Promise<TResult>;
|
|
28
|
+
private _popupWindow?;
|
|
29
|
+
protected confirmDialogInNewWindow(strategy: Exclude<DialogConfirmationStrategy, DialogConfirmationStrategy.Dialog>): Promise<TResult>;
|
|
30
|
+
protected pop(strategy?: Exclude<DialogConfirmationStrategy, DialogConfirmationStrategy.Dialog>): Promise<void>;
|
|
31
|
+
protected close(result: TResult | Error): void;
|
|
32
|
+
private get open();
|
|
33
|
+
private set open(value);
|
|
34
|
+
protected firstUpdated(props: PropertyValues): void;
|
|
35
|
+
protected primaryAction(): DialogAction<TResult>;
|
|
36
|
+
protected secondaryAction(): DialogAction<TResult>;
|
|
37
|
+
protected cancellationAction(): DialogAction<TResult>;
|
|
38
|
+
private readonly handleAction;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=DialogComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogComponent.d.ts","sourceRoot":"","sources":["../../Dialog/DialogComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAsC,OAAO,EAAE,iBAAiB,EAAwD,MAAM,aAAa,CAAA;AAClJ,OAAO,EAAc,MAAM,EAAqD,MAAM,YAAY,CAAA;AAElG,oBAAY,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEzD,oBAAY,YAAY,CAAC,OAAO,IAAI,OAAO,GAAG,KAAK,CAAA;AAEnD,oBAAY,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAE9F,0BAAkB,0BAA0B;IAAG,MAAM,IAAA;IAAE,GAAG,IAAA;IAAE,MAAM,IAAA;CAAE;AAEpE,8BAAsB,eAAe,CAAC,CAAC,SAAS,gBAAgB,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,CAAE,SAAQ,SAAS;IAyB7F,QAAQ,CAAC,UAAU,EAAE,CAAC;IAxBlC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,qCAA2C;IAElF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAqD;IAE3G,MAAM,CAAC,aAAa,kBACE,YAAY,MAAM,CAAC;IAKzC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,gDAAuI;IAEnL,MAAM,CAAC,OAAO;IAI0D,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAA;IAEvG,IAAI,oBAAoB,4BAAqD;IAE7E,IAAI,sBAAsB,4BAAuD;IAEjF,IAAI,yBAAyB,4BAA0D;gBAElE,UAAU,EAAE,CAAC;IAI5B,OAAO,CAAC,QAAQ,6BAAoC;IAO1D,OAAO,CAAC,2BAA2B,CAA2B;IAC9D,OAAO,CAAC,0BAA0B,CAA0B;cAC5C,aAAa;IAS7B,OAAO,CAAC,YAAY,CAAC,CAAQ;cACb,wBAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,MAAM,CAAC;cAoBzG,GAAG,CAAC,QAAQ,GAAE,OAAO,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,MAAM,CAAkC;IAarI,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,KAAK;IAYvC,OAAO,KAAK,IAAI,GAA8C;IAC9D,OAAO,KAAK,IAAI,QAIf;cAEkB,YAAY,CAAC,KAAK,EAAE,cAAc;IAgBrD,SAAS,CAAC,aAAa,IAAI,YAAY,CAAC,OAAO,CAAC;IAIhD,SAAS,CAAC,eAAe,IAAI,YAAY,CAAC,OAAO,CAAC;IAIlD,SAAS,CAAC,kBAAkB,IAAI,YAAY,CAAC,OAAO,CAAC;IAIrD,OAAO,CAAC,QAAQ,CAAC,YAAY,CA0B5B;CACD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Component } from '@a11d/lit';
|
|
3
|
+
import { Application, PageComponent, Router, HookSet, LocalStorageEntry, querySymbolizedElement, WindowHelper } from '../index.js';
|
|
4
|
+
import { PageDialog, DialogCancelledError, DialogHost } from './index.js';
|
|
5
|
+
export class DialogComponent extends Component {
|
|
6
|
+
constructor(parameters) {
|
|
7
|
+
super();
|
|
8
|
+
this.parameters = parameters;
|
|
9
|
+
this.handleAction = async (actionKey) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const actionByKey = new Map([
|
|
12
|
+
["primary" /* DialogActionKey.Primary */, this.primaryAction],
|
|
13
|
+
["secondary" /* DialogActionKey.Secondary */, this.secondaryAction],
|
|
14
|
+
["cancellation" /* DialogActionKey.Cancellation */, this.cancellationAction],
|
|
15
|
+
]);
|
|
16
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
17
|
+
const action = (_a = actionByKey.get(actionKey)) === null || _a === void 0 ? void 0 : _a.bind(this);
|
|
18
|
+
if (!action) {
|
|
19
|
+
throw new Error(`No action for key ${actionKey}`);
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
this.dialogElement.executingAction = actionKey;
|
|
23
|
+
const result = await action();
|
|
24
|
+
if (!this.dialogElement.manualClose) {
|
|
25
|
+
this.close(result);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
notificationHost.notifyError(e.message);
|
|
30
|
+
throw e;
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
this.dialogElement.executingAction = undefined;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static dialogElement() {
|
|
38
|
+
return (constructor) => {
|
|
39
|
+
constructor[DialogComponent.dialogElementConstructorSymbol] = true;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
static getHost() {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return Promise.resolve((_b = (_a = DialogHost.instance) !== null && _a !== void 0 ? _a : Application.instance) !== null && _b !== void 0 ? _b : document.body);
|
|
45
|
+
}
|
|
46
|
+
get primaryActionElement() { return this.dialogElement.primaryActionElement; }
|
|
47
|
+
get secondaryActionElement() { return this.dialogElement.secondaryActionElement; }
|
|
48
|
+
get cancellationActionElement() { return this.dialogElement.cancellationActionElement; }
|
|
49
|
+
async confirm(strategy = 0 /* DialogConfirmationStrategy.Dialog */) {
|
|
50
|
+
await DialogComponent.beforeConfirmationHooks.execute(this);
|
|
51
|
+
return strategy === 0 /* DialogConfirmationStrategy.Dialog */
|
|
52
|
+
? this.confirmDialog()
|
|
53
|
+
: this.confirmDialogInNewWindow(strategy);
|
|
54
|
+
}
|
|
55
|
+
async confirmDialog() {
|
|
56
|
+
const host = await DialogComponent.getHost();
|
|
57
|
+
host.appendChild(this);
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
this._confirmationPromiseResolve = resolve;
|
|
60
|
+
this._confirmationPromiseReject = reject;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async confirmDialogInNewWindow(strategy) {
|
|
64
|
+
this._popupWindow = await WindowHelper.open(PageDialog.route, strategy === 2 /* DialogConfirmationStrategy.Window */ ? 1 /* WindowOpenMode.Window */ : 0 /* WindowOpenMode.Tab */);
|
|
65
|
+
const DialogConstructor = this._popupWindow.customElements.get(this.tagName.toLowerCase());
|
|
66
|
+
const dialogComponent = new DialogConstructor(this.parameters);
|
|
67
|
+
const Constructor = this.constructor;
|
|
68
|
+
const propertiesToCopy = [...Constructor.elementProperties.keys()];
|
|
69
|
+
// @ts-expect-error property is a key of the elementProperties map
|
|
70
|
+
propertiesToCopy.forEach(property => dialogComponent[property] = this[property]);
|
|
71
|
+
const page = await PageComponent.getCurrentPage();
|
|
72
|
+
const confirmPromise = dialogComponent.confirm();
|
|
73
|
+
await dialogComponent.updateComplete;
|
|
74
|
+
dialogComponent.dialogElement.dialogHeadingChange.subscribe(heading => page.heading = heading);
|
|
75
|
+
dialogComponent.dialogElement.boundToWindow = true;
|
|
76
|
+
page.heading = dialogComponent.dialogElement.heading;
|
|
77
|
+
return confirmPromise;
|
|
78
|
+
}
|
|
79
|
+
async pop(strategy = 1 /* DialogConfirmationStrategy.Tab */) {
|
|
80
|
+
var _a;
|
|
81
|
+
this.open = false;
|
|
82
|
+
try {
|
|
83
|
+
const value = await this.confirm(strategy);
|
|
84
|
+
this._confirmationPromiseResolve(value);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
this._confirmationPromiseReject(error);
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
(_a = this._popupWindow) === null || _a === void 0 ? void 0 : _a.close();
|
|
91
|
+
this.remove();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
close(result) {
|
|
95
|
+
this.open = false;
|
|
96
|
+
if (result instanceof Error) {
|
|
97
|
+
this._confirmationPromiseReject(result);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this._confirmationPromiseResolve(result);
|
|
101
|
+
}
|
|
102
|
+
this.remove();
|
|
103
|
+
}
|
|
104
|
+
get open() { var _a; return (_a = this.dialogElement.open) !== null && _a !== void 0 ? _a : false; }
|
|
105
|
+
set open(value) {
|
|
106
|
+
if (this.dialogElement) {
|
|
107
|
+
this.dialogElement.open = value;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
firstUpdated(props) {
|
|
111
|
+
var _a;
|
|
112
|
+
this.dialogElement.handleAction = this.handleAction;
|
|
113
|
+
(_a = this.dialogElement.requestPopup) === null || _a === void 0 ? void 0 : _a.subscribe(() => this.pop());
|
|
114
|
+
if (this.dialogElement.poppable &&
|
|
115
|
+
Router.path !== PageDialog.route &&
|
|
116
|
+
DialogComponent.poppableConfirmationStrategy.value !== 0 /* DialogConfirmationStrategy.Dialog */) {
|
|
117
|
+
this.pop(DialogComponent.poppableConfirmationStrategy.value);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.open = true;
|
|
121
|
+
super.firstUpdated(props);
|
|
122
|
+
}
|
|
123
|
+
primaryAction() {
|
|
124
|
+
throw new Error('Not implemented.');
|
|
125
|
+
}
|
|
126
|
+
secondaryAction() {
|
|
127
|
+
return this.cancellationAction();
|
|
128
|
+
}
|
|
129
|
+
cancellationAction() {
|
|
130
|
+
return new DialogCancelledError(this);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
DialogComponent.beforeConfirmationHooks = new HookSet();
|
|
134
|
+
DialogComponent.dialogElementConstructorSymbol = Symbol('DialogComponent.DialogElementConstructor');
|
|
135
|
+
DialogComponent.poppableConfirmationStrategy = new LocalStorageEntry('DialogComponent.PoppableConfirmationStrategy', 0 /* DialogConfirmationStrategy.Dialog */);
|
|
136
|
+
__decorate([
|
|
137
|
+
querySymbolizedElement(DialogComponent.dialogElementConstructorSymbol)
|
|
138
|
+
], DialogComponent.prototype, "dialogElement", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component } from '@a11d/lit';
|
|
2
|
+
export declare class DialogHost extends Component {
|
|
3
|
+
static readonly instance: DialogHost | undefined;
|
|
4
|
+
protected createRenderRoot(): this;
|
|
5
|
+
}
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
'lit-dialog-host': DialogHost;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=DialogHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogHost.d.ts","sourceRoot":"","sources":["../../Dialog/DialogHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,WAAW,CAAA;AAGhD,qBACa,UAAW,SAAQ,SAAS;IAChB,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAA;cAErD,gBAAgB;CACnC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,iBAAiB,EAAE,UAAU,CAAA;KAC7B;CACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Component, component } from '@a11d/lit';
|
|
3
|
+
import { queryInstanceElement } from '../index.js';
|
|
4
|
+
let DialogHost = class DialogHost extends Component {
|
|
5
|
+
createRenderRoot() { return this; }
|
|
6
|
+
};
|
|
7
|
+
__decorate([
|
|
8
|
+
queryInstanceElement()
|
|
9
|
+
], DialogHost, "instance", void 0);
|
|
10
|
+
DialogHost = __decorate([
|
|
11
|
+
component('lit-dialog-host')
|
|
12
|
+
], DialogHost);
|
|
13
|
+
export { DialogHost };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLTemplateResult } from '@a11d/lit';
|
|
2
|
+
import { PageComponent } from '../index.js';
|
|
3
|
+
export declare class PageDialog extends PageComponent {
|
|
4
|
+
static readonly route = "/dialog";
|
|
5
|
+
heading: string;
|
|
6
|
+
protected get template(): HTMLTemplateResult;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'lit-page-dialog': PageDialog;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=PageDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageDialog.d.ts","sourceRoot":"","sources":["../../Dialog/PageDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,kBAAkB,EAAqB,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAS,MAAM,aAAa,CAAA;AAElD,qBAEa,UAAW,SAAQ,aAAa;IAC5C,MAAM,CAAC,QAAQ,CAAC,KAAK,aAAY;IAExB,OAAO,SAAK;IAErB,cAAuB,QAAQ,uBAE9B;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,iBAAiB,EAAE,UAAU,CAAA;KAC7B;CACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var PageDialog_1;
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
import { component, state, staticHtml } from '@a11d/lit';
|
|
4
|
+
import { PageComponent, route } from '../index.js';
|
|
5
|
+
let PageDialog = PageDialog_1 = class PageDialog extends PageComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.heading = '';
|
|
9
|
+
}
|
|
10
|
+
get template() {
|
|
11
|
+
return staticHtml `<${PageComponent.defaultPageElementTag} heading=${this.heading}></${PageComponent.defaultPageElementTag}>`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
PageDialog.route = '/dialog';
|
|
15
|
+
__decorate([
|
|
16
|
+
state()
|
|
17
|
+
], PageDialog.prototype, "heading", void 0);
|
|
18
|
+
PageDialog = PageDialog_1 = __decorate([
|
|
19
|
+
route(PageDialog_1.route),
|
|
20
|
+
component('lit-page-dialog')
|
|
21
|
+
], PageDialog);
|
|
22
|
+
export { PageDialog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Dialog/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../Notification/NotificationComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,WAAW,qBAAqB;IACrC,YAAY,EAAE,YAAY,CAAA;IAC1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component } from '@a11d/lit';
|
|
2
|
+
import { NotificationComponent } from './NotificationComponent.js';
|
|
3
|
+
export declare const enum NotificationType {
|
|
4
|
+
Info = "info",
|
|
5
|
+
Success = "success",
|
|
6
|
+
Warning = "warning",
|
|
7
|
+
Error = "error"
|
|
8
|
+
}
|
|
9
|
+
export declare type Notification = {
|
|
10
|
+
type?: NotificationType;
|
|
11
|
+
message: string;
|
|
12
|
+
actions?: Array<NotificationAction>;
|
|
13
|
+
};
|
|
14
|
+
declare type NotificationAction = {
|
|
15
|
+
title: string;
|
|
16
|
+
handleClick: () => void | PromiseLike<void>;
|
|
17
|
+
};
|
|
18
|
+
declare type NonTypedNotification = Omit<Notification, 'type'>;
|
|
19
|
+
declare type NonTypedNotificationParameters = [notification: NonTypedNotification] | [message: string, ...actions: Array<NotificationAction>];
|
|
20
|
+
declare type NonTypedNotificationWithErrorParameters = [notification: Partial<NonTypedNotification>] | [message?: string, ...actions: Array<NotificationAction>];
|
|
21
|
+
export declare class NotificationHost extends Component {
|
|
22
|
+
static readonly shownNotifications: Set<Notification>;
|
|
23
|
+
static readonly instance: NotificationHost | undefined;
|
|
24
|
+
static notificationComponent: () => <T extends NotificationComponent>(Constructor: Constructor<T>) => void;
|
|
25
|
+
private static NotificationComponentConstructor;
|
|
26
|
+
notifyInfo(...notification: NonTypedNotificationParameters): Promise<void>;
|
|
27
|
+
notifySuccess(...notification: NonTypedNotificationParameters): Promise<void>;
|
|
28
|
+
notifyWarning(...notification: NonTypedNotificationParameters): Promise<void>;
|
|
29
|
+
notifyError(...notification: NonTypedNotificationParameters): Promise<void>;
|
|
30
|
+
notifyAndThrowError<TError extends Error>(error: TError, ...notification: NonTypedNotificationWithErrorParameters): void;
|
|
31
|
+
notify(notification: Notification): Promise<void>;
|
|
32
|
+
createRenderRoot(): this;
|
|
33
|
+
static get styles(): import("@a11d/lit").CSSResult;
|
|
34
|
+
private readonly notifications;
|
|
35
|
+
protected get template(): import("lit-html").TemplateResult<1>;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
const notificationHost: NotificationHost;
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
'lit-notification-host': NotificationHost;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=NotificationHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationHost.d.ts","sourceRoot":"","sources":["../../Notification/NotificationHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2C,MAAM,WAAW,CAAA;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAElE,0BAAkB,gBAAgB;IACjC,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CACf;AAED,oBAAY,YAAY,GAAG;IAC1B,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAA;CACnC,CAAA;AAED,aAAK,kBAAkB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;CAC3C,CAAA;AAED,aAAK,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAEtD,aAAK,8BAA8B,GAChC,CAAC,YAAY,EAAE,oBAAoB,CAAC,GACpC,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAE3D,aAAK,uCAAuC,GACzC,CAAC,YAAY,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC,GAC7C,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAS5D,qBACa,gBAAiB,SAAQ,SAAS;IAC9C,MAAM,CAAC,QAAQ,CAAC,kBAAkB,oBAA0B;IAEpC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAAA;IAE9E,MAAM,CAAC,qBAAqB,+EAI3B;IAED,OAAO,CAAC,MAAM,CAAC,gCAAgC,CAAoC;IAEnF,UAAU,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAI1D,aAAa,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAI7D,aAAa,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAI7D,WAAW,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAI3D,mBAAmB,CAAC,MAAM,SAAS,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,uCAAuC;IAO3G,MAAM,CAAC,YAAY,EAAE,YAAY;IAmB9B,gBAAgB;IAIzB,WAAoB,MAAM,kCAiBzB;IAEQ,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmC;IAE1E,cAAuB,QAAQ,yCAE9B;CACD;AAOD,OAAO,CAAC,MAAM,CAAC;IAEd,MAAM,gBAAgB,EAAE,gBAAgB,CAAA;IACxC,UAAU,qBAAqB;QAC9B,uBAAuB,EAAE,gBAAgB,CAAA;KACzC;CACD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var NotificationHost_1;
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
import { Component, state, css, html, component, LitElement } from '@a11d/lit';
|
|
4
|
+
import { queryInstanceElement } from '../index.js';
|
|
5
|
+
function normalizeNonTypedNotificationParameters(...parameters) {
|
|
6
|
+
return typeof parameters[0] !== 'string' ? parameters[0] : {
|
|
7
|
+
message: parameters[0],
|
|
8
|
+
actions: parameters.slice(1),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
let NotificationHost = NotificationHost_1 = class NotificationHost extends Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.notifications = new Set();
|
|
15
|
+
}
|
|
16
|
+
notifyInfo(...notification) {
|
|
17
|
+
return this.notify(Object.assign({ type: "info" /* NotificationType.Info */ }, normalizeNonTypedNotificationParameters(...notification)));
|
|
18
|
+
}
|
|
19
|
+
notifySuccess(...notification) {
|
|
20
|
+
return this.notify(Object.assign({ type: "success" /* NotificationType.Success */ }, normalizeNonTypedNotificationParameters(...notification)));
|
|
21
|
+
}
|
|
22
|
+
notifyWarning(...notification) {
|
|
23
|
+
return this.notify(Object.assign({ type: "warning" /* NotificationType.Warning */ }, normalizeNonTypedNotificationParameters(...notification)));
|
|
24
|
+
}
|
|
25
|
+
notifyError(...notification) {
|
|
26
|
+
return this.notify(Object.assign({ type: "error" /* NotificationType.Error */ }, normalizeNonTypedNotificationParameters(...notification)));
|
|
27
|
+
}
|
|
28
|
+
notifyAndThrowError(error, ...notification) {
|
|
29
|
+
var _a;
|
|
30
|
+
const normalizedNotification = normalizeNonTypedNotificationParameters(...notification);
|
|
31
|
+
(_a = normalizedNotification.message) !== null && _a !== void 0 ? _a : (normalizedNotification.message = error.message);
|
|
32
|
+
this.notifyError(normalizedNotification);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
async notify(notification) {
|
|
36
|
+
const notificationComponent = new NotificationHost_1.NotificationComponentConstructor;
|
|
37
|
+
notificationComponent.notification = notification;
|
|
38
|
+
if (notificationComponent instanceof LitElement) {
|
|
39
|
+
this.notifications.add(notificationComponent);
|
|
40
|
+
this.requestUpdate();
|
|
41
|
+
}
|
|
42
|
+
await notificationComponent.show();
|
|
43
|
+
if (notificationComponent instanceof LitElement) {
|
|
44
|
+
this.notifications.delete(notificationComponent);
|
|
45
|
+
this.requestUpdate();
|
|
46
|
+
}
|
|
47
|
+
NotificationHost_1.shownNotifications.add(notification);
|
|
48
|
+
}
|
|
49
|
+
createRenderRoot() {
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
static get styles() {
|
|
53
|
+
return css `
|
|
54
|
+
:host {
|
|
55
|
+
z-index: var(--lit-notification-host-z-index, 8);
|
|
56
|
+
position: fixed;
|
|
57
|
+
inset-block-end: 0;
|
|
58
|
+
inset-inline: 0;
|
|
59
|
+
max-height: max(50vh, 50%);
|
|
60
|
+
|
|
61
|
+
display: grid;
|
|
62
|
+
justify-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
gap: 0.5vh;
|
|
65
|
+
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
get template() {
|
|
71
|
+
return html `${this.notifications}`;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
NotificationHost.shownNotifications = new Set();
|
|
75
|
+
NotificationHost.notificationComponent = () => {
|
|
76
|
+
return (Constructor) => {
|
|
77
|
+
NotificationHost_1.NotificationComponentConstructor = Constructor;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
__decorate([
|
|
81
|
+
state()
|
|
82
|
+
], NotificationHost.prototype, "notifications", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
queryInstanceElement()
|
|
85
|
+
], NotificationHost, "instance", void 0);
|
|
86
|
+
NotificationHost = NotificationHost_1 = __decorate([
|
|
87
|
+
component('lit-notification-host')
|
|
88
|
+
], NotificationHost);
|
|
89
|
+
export { NotificationHost };
|
|
90
|
+
Object.defineProperty(globalThis, 'notificationHost', {
|
|
91
|
+
get: () => NotificationHost.instance,
|
|
92
|
+
configurable: false,
|
|
93
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Notification/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../Page/Page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,WAAW,IAAK,SAAQ,UAAU;IACvC,QAAQ,CAAC,iBAAiB,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;CACnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, LitElement } from '@a11d/lit';
|
|
2
|
+
import { HookSet } from '../index.js';
|
|
3
|
+
import { Page } from './index.js';
|
|
4
|
+
export declare type PageParameters = void | Record<string, string | number | undefined>;
|
|
5
|
+
export declare const enum PageNavigationStrategy {
|
|
6
|
+
Page = 0,
|
|
7
|
+
Tab = 1,
|
|
8
|
+
Window = 2
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class PageComponent<T extends PageParameters = void> extends Component {
|
|
11
|
+
readonly parameters: T;
|
|
12
|
+
static readonly beforeNavigationHooks: HookSet<PageComponent<any>>;
|
|
13
|
+
private static readonly pageElementConstructorSymbol;
|
|
14
|
+
static defaultPageElementTag: import("lit-html/static.js").StaticValue;
|
|
15
|
+
static pageElement(): (constructor: Constructor<Page>) => void;
|
|
16
|
+
static getHost(): Promise<HTMLElement>;
|
|
17
|
+
static getCurrentPage(): Promise<PageComponent<any> | undefined>;
|
|
18
|
+
navigate(strategy?: PageNavigationStrategy, force?: boolean): Promise<void>;
|
|
19
|
+
readonly pageElement: LitElement;
|
|
20
|
+
constructor(parameters: T);
|
|
21
|
+
protected refresh(parameters?: T): any;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=PageComponent.d.ts.map
|