@a11d/lit-application 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/Application.d.ts +22 -22
  2. package/dist/Application.js +113 -112
  3. package/dist/Dialog/Dialog.d.ts +21 -21
  4. package/dist/Dialog/Dialog.js +1 -1
  5. package/dist/Dialog/DialogCancelledError.d.ts +4 -4
  6. package/dist/Dialog/DialogCancelledError.js +5 -5
  7. package/dist/Dialog/DialogComponent.d.ts +44 -44
  8. package/dist/Dialog/DialogComponent.js +164 -163
  9. package/dist/Dialog/DialogHost.d.ts +10 -10
  10. package/dist/Dialog/DialogHost.js +13 -13
  11. package/dist/Dialog/PageDialog.d.ts +12 -12
  12. package/dist/Dialog/PageDialog.js +23 -23
  13. package/dist/Dialog/index.d.ts +5 -5
  14. package/dist/Dialog/index.js +5 -5
  15. package/dist/Notification/NotificationComponent.d.ts +5 -5
  16. package/dist/Notification/NotificationComponent.js +1 -1
  17. package/dist/Notification/NotificationHost.d.ts +43 -43
  18. package/dist/Notification/NotificationHost.js +93 -93
  19. package/dist/Notification/index.d.ts +2 -2
  20. package/dist/Notification/index.js +2 -2
  21. package/dist/Page/Page.d.ts +5 -5
  22. package/dist/Page/Page.js +1 -1
  23. package/dist/Page/PageComponent.d.ts +21 -21
  24. package/dist/Page/PageComponent.js +40 -39
  25. package/dist/Page/PageError.d.ts +17 -17
  26. package/dist/Page/PageError.js +69 -69
  27. package/dist/Page/PageHost.d.ts +10 -10
  28. package/dist/Page/PageHost.js +19 -19
  29. package/dist/Page/index.d.ts +4 -4
  30. package/dist/Page/index.js +4 -4
  31. package/dist/PwaHelper/Manifest.d.ts +17 -17
  32. package/dist/PwaHelper/Manifest.js +1 -1
  33. package/dist/PwaHelper/ManifestProvider.d.ts +4 -4
  34. package/dist/PwaHelper/ManifestProvider.js +17 -17
  35. package/dist/PwaHelper/PwaHelper.d.ts +15 -15
  36. package/dist/PwaHelper/PwaHelper.js +40 -40
  37. package/dist/PwaHelper/index.d.ts +3 -3
  38. package/dist/PwaHelper/index.js +3 -3
  39. package/dist/Router/Router.d.ts +16 -16
  40. package/dist/Router/Router.js +39 -38
  41. package/dist/Router/RouterController.d.ts +9 -9
  42. package/dist/Router/RouterController.js +27 -27
  43. package/dist/Router/RoutesContainer.d.ts +18 -18
  44. package/dist/Router/RoutesContainer.js +9 -9
  45. package/dist/Router/index.d.ts +5 -5
  46. package/dist/Router/index.js +5 -5
  47. package/dist/Router/route.d.ts +5 -5
  48. package/dist/Router/route.js +20 -20
  49. package/dist/Router/routerLink.d.ts +26 -26
  50. package/dist/Router/routerLink.js +109 -109
  51. package/dist/index.d.ts +7 -7
  52. package/dist/index.js +7 -7
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/dist/utilities/HookSet.d.ts +4 -4
  55. package/dist/utilities/HookSet.js +5 -5
  56. package/dist/utilities/HttpError.d.ts +6 -6
  57. package/dist/utilities/HttpError.js +47 -46
  58. package/dist/utilities/HttpErrorCode.d.ts +40 -40
  59. package/dist/utilities/HttpErrorCode.js +1 -1
  60. package/dist/utilities/RootCssInjectorController.d.ts +11 -11
  61. package/dist/utilities/RootCssInjectorController.js +20 -20
  62. package/dist/utilities/WindowHelper.d.ts +9 -9
  63. package/dist/utilities/WindowHelper.js +22 -21
  64. package/dist/utilities/index.d.ts +9 -9
  65. package/dist/utilities/index.js +9 -9
  66. package/dist/utilities/nonInertable.d.ts +2 -2
  67. package/dist/utilities/nonInertable.js +11 -11
  68. package/dist/utilities/queryInstanceElement.d.ts +2 -2
  69. package/dist/utilities/queryInstanceElement.js +9 -9
  70. package/dist/utilities/querySymbolizedElement.d.ts +2 -2
  71. package/dist/utilities/querySymbolizedElement.js +14 -14
  72. package/package.json +40 -40
  73. package/dist/utilities/LocalStorageEntry.d.ts +0 -13
  74. package/dist/utilities/LocalStorageEntry.d.ts.map +0 -1
  75. package/dist/utilities/LocalStorageEntry.js +0 -29
@@ -1,23 +1,23 @@
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 connectingHooks: HookSet<void>;
6
- static readonly beforeRouteHooks: HookSet<void>;
7
- static readonly instance?: Application;
8
- static get styles(): import("@a11d/lit").CSSResult;
9
- pageHeading?: string;
10
- readonly router: RouterController;
11
- protected readonly rootCssInjector: RootCssInjectorController;
12
- private shallRenderRouter;
13
- protected createRenderRoot(): this;
14
- connectedCallback(): Promise<void>;
15
- protected initialized(): Promise<void>;
16
- protected get documentTitle(): string;
17
- protected get template(): import("lit-html").TemplateResult<1>;
18
- protected get notificationHostTemplate(): import("lit-html").TemplateResult<1>;
19
- protected get bodyTemplate(): import("lit-html").TemplateResult<1>;
20
- protected get pageHostTemplate(): import("lit-html").TemplateResult<1>;
21
- protected get dialogHostTemplate(): import("lit-html").TemplateResult<1>;
22
- }
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 connectingHooks: HookSet<void>;
6
+ static readonly beforeRouteHooks: HookSet<void>;
7
+ static readonly instance?: Application;
8
+ static get styles(): import("@a11d/lit").CSSResult;
9
+ pageHeading?: string;
10
+ readonly router: RouterController;
11
+ protected readonly rootCssInjector: RootCssInjectorController;
12
+ private shallRenderRouter;
13
+ protected createRenderRoot(): this;
14
+ connectedCallback(): Promise<void>;
15
+ protected initialized(): Promise<void>;
16
+ protected get documentTitle(): string;
17
+ protected get template(): import("lit-html").TemplateResult<1>;
18
+ protected get notificationHostTemplate(): import("lit-html").TemplateResult<1>;
19
+ protected get bodyTemplate(): import("lit-html").TemplateResult<1>;
20
+ protected get pageHostTemplate(): import("lit-html").TemplateResult<1>;
21
+ protected get dialogHostTemplate(): import("lit-html").TemplateResult<1>;
22
+ }
23
23
  //# sourceMappingURL=Application.d.ts.map
@@ -1,112 +1,113 @@
1
- import { __decorate } from "tslib";
2
- import { Component, property, css, html, nothing, state } from '@a11d/lit';
3
- import { HookSet, PageError, RootCssInjectorController, RouterController } from './index.js';
4
- import { queryInstanceElement } from './utilities/index.js';
5
- export const application = () => {
6
- return (ApplicationConstructor) => {
7
- window.document.body.appendChild(new ApplicationConstructor);
8
- };
9
- };
10
- export class Application extends Component {
11
- constructor() {
12
- super(...arguments);
13
- this.router = new RouterController(this, [], {
14
- fallback: {
15
- render: () => new PageError({ error: 404 /* HttpErrorCode.NotFound */ })
16
- }
17
- });
18
- this.rootCssInjector = new RootCssInjectorController(this, this.constructor.styles);
19
- this.shallRenderRouter = false;
20
- }
21
- static get styles() {
22
- return css `
23
- :root { color-scheme: light dark; }
24
-
25
- html, body, [application] {
26
- margin: 0;
27
- padding: 0;
28
- scrollbar-width: thin;
29
- display: block;
30
- min-height: 100vh;
31
- min-height: 100dvh;
32
- }
33
-
34
- [application] {
35
- display: flex;
36
- flex-direction: column;
37
- }
38
-
39
- ::-webkit-scrollbar {
40
- width: 5px;
41
- height: 5px;
42
- }
43
-
44
- ::-webkit-scrollbar-thumb {
45
- background: rgba(128, 128, 128, 0.75);
46
- }
47
-
48
- lit-page-host {
49
- display: flex;
50
- flex: 1;
51
- margin: auto;
52
- width: 100%;
53
- max-width: var(--lit-application-page-host-max-width, 2560px);
54
- }
55
-
56
- lit-page-host > * {
57
- padding: max(min(1rem, 1vw), min(1rem, 1vh));
58
- }
59
- `;
60
- }
61
- createRenderRoot() {
62
- return this;
63
- }
64
- async connectedCallback() {
65
- this.setAttribute('application', '');
66
- await Application.connectingHooks.execute();
67
- super.connectedCallback();
68
- window.dispatchEvent(new Event('Application.connected'));
69
- }
70
- async initialized() {
71
- window.dispatchEvent(new Event('Application.initialized'));
72
- await Application.beforeRouteHooks.execute();
73
- this.shallRenderRouter = true;
74
- }
75
- get documentTitle() {
76
- return [this.pageHeading, manifest?.short_name].filter(Boolean).join(' | ');
77
- }
78
- get template() {
79
- return html `
80
- ${this.notificationHostTemplate}
81
- ${this.bodyTemplate}
82
- ${this.dialogHostTemplate}
83
- `;
84
- }
85
- get notificationHostTemplate() {
86
- return html `<lit-notification-host></lit-notification-host>`;
87
- }
88
- get bodyTemplate() {
89
- return html `${this.pageHostTemplate}`;
90
- }
91
- get pageHostTemplate() {
92
- return html `
93
- <lit-page-host @pageHeadingChange=${(e) => this.pageHeading = e.detail}>
94
- ${!this.shallRenderRouter ? nothing : this.router.outlet()}
95
- </lit-page-host>
96
- `;
97
- }
98
- get dialogHostTemplate() {
99
- return html `<lit-dialog-host></lit-dialog-host>`;
100
- }
101
- }
102
- Application.connectingHooks = new HookSet();
103
- Application.beforeRouteHooks = new HookSet();
104
- __decorate([
105
- property({ updated() { document.title = this.documentTitle; } })
106
- ], Application.prototype, "pageHeading", void 0);
107
- __decorate([
108
- state()
109
- ], Application.prototype, "shallRenderRouter", void 0);
110
- __decorate([
111
- queryInstanceElement()
112
- ], Application, "instance", void 0);
1
+ import { __decorate } from "tslib";
2
+ import { Component, property, css, html, nothing, state } from '@a11d/lit';
3
+ import { HookSet, PageError, RootCssInjectorController, RouterController } from './index.js';
4
+ import { queryInstanceElement } from './utilities/index.js';
5
+ export const application = () => {
6
+ return (ApplicationConstructor) => {
7
+ window.document.body.appendChild(new ApplicationConstructor);
8
+ };
9
+ };
10
+ class Application extends Component {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.router = new RouterController(this, [], {
14
+ fallback: {
15
+ render: () => new PageError({ error: 404 /* HttpErrorCode.NotFound */ })
16
+ }
17
+ });
18
+ this.rootCssInjector = new RootCssInjectorController(this, this.constructor.styles);
19
+ this.shallRenderRouter = false;
20
+ }
21
+ static get styles() {
22
+ return css `
23
+ :root { color-scheme: light dark; }
24
+
25
+ html, body, [application] {
26
+ margin: 0;
27
+ padding: 0;
28
+ scrollbar-width: thin;
29
+ display: block;
30
+ min-height: 100vh;
31
+ min-height: 100dvh;
32
+ }
33
+
34
+ [application] {
35
+ display: flex;
36
+ flex-direction: column;
37
+ }
38
+
39
+ ::-webkit-scrollbar {
40
+ width: 5px;
41
+ height: 5px;
42
+ }
43
+
44
+ ::-webkit-scrollbar-thumb {
45
+ background: rgba(128, 128, 128, 0.75);
46
+ }
47
+
48
+ lit-page-host {
49
+ display: flex;
50
+ flex: 1;
51
+ margin: auto;
52
+ width: 100%;
53
+ max-width: var(--lit-application-page-host-max-width, 2560px);
54
+ }
55
+
56
+ lit-page-host > * {
57
+ padding: max(min(1rem, 1vw), min(1rem, 1vh));
58
+ }
59
+ `;
60
+ }
61
+ createRenderRoot() {
62
+ return this;
63
+ }
64
+ async connectedCallback() {
65
+ this.setAttribute('application', '');
66
+ await Application.connectingHooks.execute();
67
+ super.connectedCallback();
68
+ window.dispatchEvent(new Event('Application.connected'));
69
+ }
70
+ async initialized() {
71
+ window.dispatchEvent(new Event('Application.initialized'));
72
+ await Application.beforeRouteHooks.execute();
73
+ this.shallRenderRouter = true;
74
+ }
75
+ get documentTitle() {
76
+ return [this.pageHeading, manifest?.short_name].filter(Boolean).join(' | ');
77
+ }
78
+ get template() {
79
+ return html `
80
+ ${this.notificationHostTemplate}
81
+ ${this.bodyTemplate}
82
+ ${this.dialogHostTemplate}
83
+ `;
84
+ }
85
+ get notificationHostTemplate() {
86
+ return html `<lit-notification-host></lit-notification-host>`;
87
+ }
88
+ get bodyTemplate() {
89
+ return html `${this.pageHostTemplate}`;
90
+ }
91
+ get pageHostTemplate() {
92
+ return html `
93
+ <lit-page-host @pageHeadingChange=${(e) => this.pageHeading = e.detail}>
94
+ ${!this.shallRenderRouter ? nothing : this.router.outlet()}
95
+ </lit-page-host>
96
+ `;
97
+ }
98
+ get dialogHostTemplate() {
99
+ return html `<lit-dialog-host></lit-dialog-host>`;
100
+ }
101
+ }
102
+ Application.connectingHooks = new HookSet();
103
+ Application.beforeRouteHooks = new HookSet();
104
+ __decorate([
105
+ property({ updated() { document.title = this.documentTitle; } })
106
+ ], Application.prototype, "pageHeading", void 0);
107
+ __decorate([
108
+ state()
109
+ ], Application.prototype, "shallRenderRouter", void 0);
110
+ __decorate([
111
+ queryInstanceElement()
112
+ ], Application, "instance", void 0);
113
+ export { Application };
@@ -1,22 +1,22 @@
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
- preventCancellationOnEscape?: boolean;
16
- primaryOnEnter?: boolean;
17
- poppable?: boolean;
18
- boundToWindow?: boolean;
19
- readonly requestPopup?: EventDispatcher<void>;
20
- manualClose?: boolean;
21
- }
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
+ preventCancellationOnEscape?: boolean;
16
+ primaryOnEnter?: boolean;
17
+ poppable?: boolean;
18
+ boundToWindow?: boolean;
19
+ readonly requestPopup?: EventDispatcher<void>;
20
+ manualClose?: boolean;
21
+ }
22
22
  //# sourceMappingURL=Dialog.d.ts.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,5 +1,5 @@
1
- import type { DialogComponent } from './DialogComponent.js';
2
- export declare class DialogCancelledError extends Error {
3
- constructor(dialogComponent: DialogComponent<any, any>);
4
- }
1
+ import type { DialogComponent } from './DialogComponent.js';
2
+ export declare class DialogCancelledError extends Error {
3
+ constructor(dialogComponent: DialogComponent<any, any>);
4
+ }
5
5
  //# sourceMappingURL=DialogCancelledError.d.ts.map
@@ -1,5 +1,5 @@
1
- export class DialogCancelledError extends Error {
2
- constructor(dialogComponent) {
3
- super(`Dialog "${dialogComponent.tagName.toLowerCase()}" was cancelled.`);
4
- }
5
- }
1
+ export class DialogCancelledError extends Error {
2
+ constructor(dialogComponent) {
3
+ super(`Dialog "${dialogComponent.tagName.toLowerCase()}" was cancelled.`);
4
+ }
5
+ }
@@ -1,45 +1,45 @@
1
- import { Component, PropertyValues } from '@a11d/lit';
2
- import { LocalStorage } from '@a11d/local-storage';
3
- import { HookSet } from '../index.js';
4
- import { Dialog, DialogActionKey } from './index.js';
5
- export type DialogParameters = void | Record<string, any>;
6
- export type DialogResult<TResult> = TResult | Error;
7
- export type DialogAction<TResult> = DialogResult<TResult> | PromiseLike<DialogResult<TResult>>;
8
- export declare const enum DialogConfirmationStrategy {
9
- Dialog = 0,
10
- Tab = 1,
11
- Window = 2
12
- }
13
- export type PopupConfirmationStrategy = Exclude<DialogConfirmationStrategy, DialogConfirmationStrategy.Dialog>;
14
- export declare abstract class DialogComponent<T extends DialogParameters = void, TResult = void> extends Component {
15
- readonly parameters: T;
16
- static readonly connectingHooks: HookSet<DialogComponent<any, any>>;
17
- private static readonly dialogElementConstructorSymbol;
18
- static defaultDialogElementTag: import("lit-html/static.js").StaticValue;
19
- static dialogElement(): (constructor: Constructor<Dialog>) => void;
20
- static readonly poppableConfirmationStrategy: LocalStorage<DialogConfirmationStrategy>;
21
- static getHost(): Promise<HTMLElement>;
22
- readonly dialogElement: Dialog & HTMLElement;
23
- get primaryActionElement(): HTMLElement | undefined;
24
- get secondaryActionElement(): HTMLElement | undefined;
25
- get cancellationActionElement(): HTMLElement | undefined;
26
- constructor(parameters: T);
27
- protected handleBeforeUnload(): Promise<void>;
28
- protected handleKeyDown(e: KeyboardEvent): Promise<void>;
29
- connectedCallback(): Promise<void>;
30
- confirm(strategy?: DialogConfirmationStrategy): Promise<TResult>;
31
- private _confirmationPromiseExecutor?;
32
- protected confirmAsDialog(): Promise<TResult>;
33
- private _popupWindow?;
34
- protected confirmAsPopup(strategy: PopupConfirmationStrategy): Promise<TResult>;
35
- protected pop(strategy?: Exclude<DialogConfirmationStrategy, DialogConfirmationStrategy.Dialog>): Promise<void>;
36
- protected close(result: TResult | Error): void;
37
- private get open();
38
- private set open(value);
39
- protected firstUpdated(props: PropertyValues): void;
40
- protected primaryAction(): DialogAction<TResult>;
41
- protected secondaryAction(): DialogAction<TResult>;
42
- protected cancellationAction(): DialogAction<TResult>;
43
- protected readonly handleAction: (actionKey: DialogActionKey) => Promise<void>;
44
- }
1
+ import { Component, PropertyValues } from '@a11d/lit';
2
+ import { LocalStorage } from '@a11d/local-storage';
3
+ import { HookSet } from '../index.js';
4
+ import { Dialog, DialogActionKey } from './index.js';
5
+ export type DialogParameters = void | Record<string, any>;
6
+ export type DialogResult<TResult> = TResult | Error;
7
+ export type DialogAction<TResult> = DialogResult<TResult> | PromiseLike<DialogResult<TResult>>;
8
+ export declare const enum DialogConfirmationStrategy {
9
+ Dialog = 0,
10
+ Tab = 1,
11
+ Window = 2
12
+ }
13
+ export type PopupConfirmationStrategy = Exclude<DialogConfirmationStrategy, DialogConfirmationStrategy.Dialog>;
14
+ export declare abstract class DialogComponent<T extends DialogParameters = void, TResult = void> extends Component {
15
+ readonly parameters: T;
16
+ static readonly connectingHooks: HookSet<DialogComponent<any, any>>;
17
+ private static readonly dialogElementConstructorSymbol;
18
+ static defaultDialogElementTag: import("lit-html/static.js").StaticValue;
19
+ static dialogElement(): (constructor: Constructor<Dialog>) => void;
20
+ static readonly poppableConfirmationStrategy: LocalStorage<DialogConfirmationStrategy>;
21
+ static getHost(): Promise<HTMLElement>;
22
+ readonly dialogElement: Dialog & HTMLElement;
23
+ get primaryActionElement(): HTMLElement | undefined;
24
+ get secondaryActionElement(): HTMLElement | undefined;
25
+ get cancellationActionElement(): HTMLElement | undefined;
26
+ constructor(parameters: T);
27
+ protected handleBeforeUnload(): Promise<void>;
28
+ protected handleKeyDown(e: KeyboardEvent): Promise<void>;
29
+ connectedCallback(): Promise<void>;
30
+ confirm(strategy?: DialogConfirmationStrategy): Promise<TResult>;
31
+ private _confirmationPromiseExecutor?;
32
+ protected confirmAsDialog(): Promise<TResult>;
33
+ private _popupWindow?;
34
+ protected confirmAsPopup(strategy: PopupConfirmationStrategy): Promise<TResult>;
35
+ protected pop(strategy?: Exclude<DialogConfirmationStrategy, DialogConfirmationStrategy.Dialog>): Promise<void>;
36
+ protected close(result: TResult | Error): void;
37
+ private get open();
38
+ private set open(value);
39
+ protected firstUpdated(props: PropertyValues): void;
40
+ protected primaryAction(): DialogAction<TResult>;
41
+ protected secondaryAction(): DialogAction<TResult>;
42
+ protected cancellationAction(): DialogAction<TResult>;
43
+ protected readonly handleAction: (actionKey: DialogActionKey) => Promise<void>;
44
+ }
45
45
  //# sourceMappingURL=DialogComponent.d.ts.map