@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,93 +1,93 @@
1
- var NotificationHost_1;
2
- import { __decorate } from "tslib";
3
- import { Component, state, css, html, component, LitElement } from '@a11d/lit';
4
- import { nonInertable, 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({ type: "info" /* NotificationType.Info */, ...normalizeNonTypedNotificationParameters(...notification) });
18
- }
19
- notifySuccess(...notification) {
20
- return this.notify({ type: "success" /* NotificationType.Success */, ...normalizeNonTypedNotificationParameters(...notification) });
21
- }
22
- notifyWarning(...notification) {
23
- return this.notify({ type: "warning" /* NotificationType.Warning */, ...normalizeNonTypedNotificationParameters(...notification) });
24
- }
25
- notifyError(...notification) {
26
- return this.notify({ type: "error" /* NotificationType.Error */, ...normalizeNonTypedNotificationParameters(...notification) });
27
- }
28
- notifyAndThrowError(error, ...notification) {
29
- const normalizedNotification = normalizeNonTypedNotificationParameters(...notification);
30
- normalizedNotification.message ?? (normalizedNotification.message = error.message);
31
- this.notifyError(normalizedNotification);
32
- throw error;
33
- }
34
- async notify(notification) {
35
- const notificationComponent = new NotificationHost_1.NotificationComponentConstructor;
36
- notificationComponent.notification = notification;
37
- if (notificationComponent instanceof LitElement) {
38
- this.notifications.add(notificationComponent);
39
- this.requestUpdate();
40
- }
41
- await notificationComponent.show();
42
- if (notificationComponent instanceof LitElement) {
43
- this.notifications.delete(notificationComponent);
44
- this.requestUpdate();
45
- }
46
- NotificationHost_1.shownNotifications.add(notification);
47
- }
48
- createRenderRoot() {
49
- return this;
50
- }
51
- static get styles() {
52
- return css `
53
- :host {
54
- z-index: var(--lit-notification-host-z-index, 8);
55
- position: fixed;
56
- inset-block-end: 0;
57
- inset-inline: 0;
58
- max-height: max(50vh, 50%);
59
-
60
- display: grid;
61
- justify-items: center;
62
- justify-content: center;
63
- gap: 0.5vh;
64
-
65
- overflow: hidden;
66
- }
67
- `;
68
- }
69
- get template() {
70
- return html `${this.notifications}`;
71
- }
72
- };
73
- NotificationHost.shownNotifications = new Set();
74
- NotificationHost.notificationComponent = () => {
75
- return (Constructor) => {
76
- NotificationHost_1.NotificationComponentConstructor = Constructor;
77
- };
78
- };
79
- __decorate([
80
- state()
81
- ], NotificationHost.prototype, "notifications", void 0);
82
- __decorate([
83
- queryInstanceElement()
84
- ], NotificationHost, "instance", void 0);
85
- NotificationHost = NotificationHost_1 = __decorate([
86
- component('lit-notification-host'),
87
- nonInertable()
88
- ], NotificationHost);
89
- export { NotificationHost };
90
- Object.defineProperty(globalThis, 'notificationHost', {
91
- get: () => NotificationHost.instance,
92
- configurable: false,
93
- });
1
+ var NotificationHost_1;
2
+ import { __decorate } from "tslib";
3
+ import { Component, state, css, html, component, LitElement } from '@a11d/lit';
4
+ import { nonInertable, 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({ type: "info" /* NotificationType.Info */, ...normalizeNonTypedNotificationParameters(...notification) });
18
+ }
19
+ notifySuccess(...notification) {
20
+ return this.notify({ type: "success" /* NotificationType.Success */, ...normalizeNonTypedNotificationParameters(...notification) });
21
+ }
22
+ notifyWarning(...notification) {
23
+ return this.notify({ type: "warning" /* NotificationType.Warning */, ...normalizeNonTypedNotificationParameters(...notification) });
24
+ }
25
+ notifyError(...notification) {
26
+ return this.notify({ type: "error" /* NotificationType.Error */, ...normalizeNonTypedNotificationParameters(...notification) });
27
+ }
28
+ notifyAndThrowError(error, ...notification) {
29
+ const normalizedNotification = normalizeNonTypedNotificationParameters(...notification);
30
+ normalizedNotification.message ?? (normalizedNotification.message = error.message);
31
+ this.notifyError(normalizedNotification);
32
+ throw error;
33
+ }
34
+ async notify(notification) {
35
+ const notificationComponent = new NotificationHost_1.NotificationComponentConstructor;
36
+ notificationComponent.notification = notification;
37
+ if (notificationComponent instanceof LitElement) {
38
+ this.notifications.add(notificationComponent);
39
+ this.requestUpdate();
40
+ }
41
+ await notificationComponent.show();
42
+ if (notificationComponent instanceof LitElement) {
43
+ this.notifications.delete(notificationComponent);
44
+ this.requestUpdate();
45
+ }
46
+ NotificationHost_1.shownNotifications.add(notification);
47
+ }
48
+ createRenderRoot() {
49
+ return this;
50
+ }
51
+ static get styles() {
52
+ return css `
53
+ :host {
54
+ z-index: var(--lit-notification-host-z-index, 8);
55
+ position: fixed;
56
+ inset-block-end: 0;
57
+ inset-inline: 0;
58
+ max-height: max(50vh, 50%);
59
+
60
+ display: grid;
61
+ justify-items: center;
62
+ justify-content: center;
63
+ gap: 0.5vh;
64
+
65
+ overflow: hidden;
66
+ }
67
+ `;
68
+ }
69
+ get template() {
70
+ return html `${this.notifications}`;
71
+ }
72
+ };
73
+ NotificationHost.shownNotifications = new Set();
74
+ NotificationHost.notificationComponent = () => {
75
+ return (Constructor) => {
76
+ NotificationHost_1.NotificationComponentConstructor = Constructor;
77
+ };
78
+ };
79
+ __decorate([
80
+ state()
81
+ ], NotificationHost.prototype, "notifications", void 0);
82
+ __decorate([
83
+ queryInstanceElement()
84
+ ], NotificationHost, "instance", void 0);
85
+ NotificationHost = NotificationHost_1 = __decorate([
86
+ component('lit-notification-host'),
87
+ nonInertable()
88
+ ], NotificationHost);
89
+ export { NotificationHost };
90
+ Object.defineProperty(globalThis, 'notificationHost', {
91
+ get: () => NotificationHost.instance,
92
+ configurable: false,
93
+ });
@@ -1,3 +1,3 @@
1
- export * from './NotificationHost.js';
2
- export * from './NotificationComponent.js';
1
+ export * from './NotificationHost.js';
2
+ export * from './NotificationComponent.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './NotificationHost.js';
2
- export * from './NotificationComponent.js';
1
+ export * from './NotificationHost.js';
2
+ export * from './NotificationComponent.js';
@@ -1,6 +1,6 @@
1
- import { LitElement } from '@a11d/lit';
2
- export interface Page extends LitElement {
3
- /** The event must be "composed", "bubbles" and "cancellable" */
4
- readonly pageHeadingChange: EventDispatcher<string>;
5
- }
1
+ import { LitElement } from '@a11d/lit';
2
+ export interface Page extends LitElement {
3
+ /** The event must be "composed", "bubbles" and "cancellable" */
4
+ readonly pageHeadingChange: EventDispatcher<string>;
5
+ }
6
6
  //# sourceMappingURL=Page.d.ts.map
package/dist/Page/Page.js CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,22 +1,22 @@
1
- import { Component } from '@a11d/lit';
2
- import { HookSet } from '../index.js';
3
- import { Page } from './index.js';
4
- export 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 connectingHooks: 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
- navigate(strategy?: PageNavigationStrategy, force?: boolean): Promise<void>;
17
- readonly pageElement: Page & HTMLElement;
18
- constructor(parameters: T);
19
- connectedCallback(): Promise<void>;
20
- protected refresh(parameters?: T): any;
21
- }
1
+ import { Component } from '@a11d/lit';
2
+ import { HookSet } from '../index.js';
3
+ import { Page } from './index.js';
4
+ export 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 connectingHooks: 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
+ navigate(strategy?: PageNavigationStrategy, force?: boolean): Promise<void>;
17
+ readonly pageElement: Page & HTMLElement;
18
+ constructor(parameters: T);
19
+ connectedCallback(): Promise<void>;
20
+ protected refresh(parameters?: T): any;
21
+ }
22
22
  //# sourceMappingURL=PageComponent.d.ts.map
@@ -1,39 +1,40 @@
1
- import { __decorate } from "tslib";
2
- import { Component, literal } from '@a11d/lit';
3
- import { querySymbolizedElement, WindowHelper, HookSet, Router } from '../index.js';
4
- export class PageComponent extends Component {
5
- static pageElement() {
6
- return (constructor) => {
7
- constructor[PageComponent.pageElementConstructorSymbol] = true;
8
- };
9
- }
10
- async navigate(strategy = 0 /* PageNavigationStrategy.Page */, force = false) {
11
- if (force === false && Router.match(this, "all" /* RouteMatchMode.All */)) {
12
- return;
13
- }
14
- if (strategy === 0 /* PageNavigationStrategy.Page */) {
15
- Router.setPathByPage(this);
16
- }
17
- else {
18
- const url = window.location.origin + Router.getPathOf(this);
19
- await WindowHelper.openAndFocus(url, strategy === 2 /* PageNavigationStrategy.Window */ ? 1 /* WindowOpenMode.Window */ : 0 /* WindowOpenMode.Tab */);
20
- }
21
- }
22
- constructor(parameters) {
23
- super();
24
- this.parameters = parameters;
25
- }
26
- async connectedCallback() {
27
- await PageComponent.connectingHooks.execute(this);
28
- super.connectedCallback();
29
- }
30
- refresh(parameters = this.parameters) {
31
- return new this.constructor(parameters).navigate(0 /* PageNavigationStrategy.Page */, true);
32
- }
33
- }
34
- PageComponent.connectingHooks = new HookSet();
35
- PageComponent.pageElementConstructorSymbol = Symbol('PageComponent.PageElementConstructor');
36
- PageComponent.defaultPageElementTag = literal `lit-page`;
37
- __decorate([
38
- querySymbolizedElement(PageComponent.pageElementConstructorSymbol)
39
- ], PageComponent.prototype, "pageElement", void 0);
1
+ import { __decorate } from "tslib";
2
+ import { Component, literal } from '@a11d/lit';
3
+ import { querySymbolizedElement, WindowHelper, HookSet, Router } from '../index.js';
4
+ class PageComponent extends Component {
5
+ static pageElement() {
6
+ return (constructor) => {
7
+ constructor[PageComponent.pageElementConstructorSymbol] = true;
8
+ };
9
+ }
10
+ async navigate(strategy = 0 /* PageNavigationStrategy.Page */, force = false) {
11
+ if (force === false && Router.match(this, "all" /* RouteMatchMode.All */)) {
12
+ return;
13
+ }
14
+ if (strategy === 0 /* PageNavigationStrategy.Page */) {
15
+ Router.setPathByPage(this);
16
+ }
17
+ else {
18
+ const url = window.location.origin + Router.getPathOf(this);
19
+ await WindowHelper.openAndFocus(url, strategy === 2 /* PageNavigationStrategy.Window */ ? 1 /* WindowOpenMode.Window */ : 0 /* WindowOpenMode.Tab */);
20
+ }
21
+ }
22
+ constructor(parameters) {
23
+ super();
24
+ this.parameters = parameters;
25
+ }
26
+ async connectedCallback() {
27
+ await PageComponent.connectingHooks.execute(this);
28
+ super.connectedCallback();
29
+ }
30
+ refresh(parameters = this.parameters) {
31
+ return new this.constructor(parameters).navigate(0 /* PageNavigationStrategy.Page */, true);
32
+ }
33
+ }
34
+ PageComponent.connectingHooks = new HookSet();
35
+ PageComponent.pageElementConstructorSymbol = Symbol('PageComponent.PageElementConstructor');
36
+ PageComponent.defaultPageElementTag = literal `lit-page`;
37
+ __decorate([
38
+ querySymbolizedElement(PageComponent.pageElementConstructorSymbol)
39
+ ], PageComponent.prototype, "pageElement", void 0);
40
+ export { PageComponent };
@@ -1,18 +1,18 @@
1
- import { HTMLTemplateResult } from '@a11d/lit';
2
- import { HttpErrorCode } from '../index.js';
3
- import { PageComponent } from './PageComponent.js';
4
- export declare class PageError extends PageComponent<{
5
- readonly error: HttpErrorCode;
6
- readonly message?: string;
7
- }> {
8
- private static readonly emojisByErrorCodes;
9
- static get styles(): import("@a11d/lit").CSSResult;
10
- protected get template(): HTMLTemplateResult;
11
- private get errorTemplate();
12
- }
13
- declare global {
14
- interface HTMLElementTagNameMap {
15
- 'lit-page-error': PageError;
16
- }
17
- }
1
+ import { HTMLTemplateResult } from '@a11d/lit';
2
+ import { HttpErrorCode } from '../index.js';
3
+ import { PageComponent } from './PageComponent.js';
4
+ export declare class PageError extends PageComponent<{
5
+ readonly error: HttpErrorCode;
6
+ readonly message?: string;
7
+ }> {
8
+ private static readonly emojisByErrorCodes;
9
+ static get styles(): import("@a11d/lit").CSSResult;
10
+ protected get template(): HTMLTemplateResult;
11
+ private get errorTemplate();
12
+ }
13
+ declare global {
14
+ interface HTMLElementTagNameMap {
15
+ 'lit-page-error': PageError;
16
+ }
17
+ }
18
18
  //# sourceMappingURL=PageError.d.ts.map
@@ -1,69 +1,69 @@
1
- var PageError_1;
2
- import { __decorate } from "tslib";
3
- import { component, css, html, staticHtml, style } from '@a11d/lit';
4
- import { HttpError } from '../index.js';
5
- import { route } from '../Router/route.js';
6
- import { PageComponent } from './PageComponent.js';
7
- let PageError = PageError_1 = class PageError extends PageComponent {
8
- static get styles() {
9
- return css `
10
- .code {
11
- font-size: 60px;
12
- font-weight: 400;
13
- text-align: center;
14
- }
15
-
16
- h1, h2 {
17
- text-align: center;
18
- margin: 0;
19
- }
20
- `;
21
- }
22
- get template() {
23
- return staticHtml `
24
- <${PageComponent.defaultPageElementTag} heading=${`Error ${this.parameters.error}`} fullHeight>
25
- <div ${style({ display: 'flex', gap: '8px', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' })}>
26
- <div class='code'>${this.errorTemplate}</div>
27
- <div ${style({ display: 'flex', gap: '4px', flexDirection: 'column' })}>
28
- <h1>${this.parameters.message ?? HttpError.defaultMessageByErrorCode.get(this.parameters.error) ?? 'Unknown Error'}</h1>
29
- </div>
30
- </div>
31
- </${PageComponent.defaultPageElementTag}>
32
- `;
33
- }
34
- get errorTemplate() {
35
- const errorCode = String(this.parameters.error);
36
- const emoji = PageError_1.emojisByErrorCodes.get(this.parameters.error);
37
- return !emoji ? html `
38
- <span>${errorCode}</span>
39
- ` : html `
40
- <span>${errorCode.charAt(0)}</span>${emoji}<span>${errorCode.charAt(2)}</span>
41
- `;
42
- }
43
- };
44
- PageError.emojisByErrorCodes = new Map([
45
- [400 /* HttpErrorCode.BadRequest */, '😟'],
46
- [401 /* HttpErrorCode.Unauthorized */, '⛔'],
47
- [402 /* HttpErrorCode.PaymentRequired */, 'ðŸĪ‘'],
48
- [404 /* HttpErrorCode.NotFound */, '🧐'],
49
- [403 /* HttpErrorCode.Forbidden */, '🔒'],
50
- [405 /* HttpErrorCode.MethodNotAllowed */, 'ðŸšŦ'],
51
- [406 /* HttpErrorCode.NotAcceptable */, 'ðŸ˜ĩ'],
52
- [407 /* HttpErrorCode.ProxyAuthenticationRequired */, 'ðŸĪ'],
53
- [408 /* HttpErrorCode.RequestTimeout */, 'âē'],
54
- [409 /* HttpErrorCode.Conflict */, 'ðŸ˜ĩ'],
55
- [500 /* HttpErrorCode.InternalServerError */, 'ðŸ˜Ĩ'],
56
- [501 /* HttpErrorCode.NotImplemented */, 'ðŸ˜ģ'],
57
- [502 /* HttpErrorCode.BadGateway */, 'ðŸĨī'],
58
- [503 /* HttpErrorCode.ServiceUnavailable */, 'ðŸ˜ī'],
59
- [504 /* HttpErrorCode.GatewayTimeout */, '⌚'],
60
- [505 /* HttpErrorCode.HttpVersionNotSupported */, '🙄'],
61
- [506 /* HttpErrorCode.VariantAlsoNegotiates */, 'ðŸĪŠ'],
62
- [507 /* HttpErrorCode.InsufficientStorage */, 'ðŸ’ū'],
63
- [508 /* HttpErrorCode.LoopDetected */, '➰'],
64
- ]);
65
- PageError = PageError_1 = __decorate([
66
- component('lit-page-error'),
67
- route('/error/:error')
68
- ], PageError);
69
- export { PageError };
1
+ var PageError_1;
2
+ import { __decorate } from "tslib";
3
+ import { component, css, html, staticHtml, style } from '@a11d/lit';
4
+ import { HttpError } from '../index.js';
5
+ import { route } from '../Router/route.js';
6
+ import { PageComponent } from './PageComponent.js';
7
+ let PageError = PageError_1 = class PageError extends PageComponent {
8
+ static get styles() {
9
+ return css `
10
+ .code {
11
+ font-size: 60px;
12
+ font-weight: 400;
13
+ text-align: center;
14
+ }
15
+
16
+ h1, h2 {
17
+ text-align: center;
18
+ margin: 0;
19
+ }
20
+ `;
21
+ }
22
+ get template() {
23
+ return staticHtml `
24
+ <${PageComponent.defaultPageElementTag} heading=${`Error ${this.parameters.error}`} fullHeight>
25
+ <div ${style({ display: 'flex', gap: '8px', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' })}>
26
+ <div class='code'>${this.errorTemplate}</div>
27
+ <div ${style({ display: 'flex', gap: '4px', flexDirection: 'column' })}>
28
+ <h1>${this.parameters.message ?? HttpError.defaultMessageByErrorCode.get(this.parameters.error) ?? 'Unknown Error'}</h1>
29
+ </div>
30
+ </div>
31
+ </${PageComponent.defaultPageElementTag}>
32
+ `;
33
+ }
34
+ get errorTemplate() {
35
+ const errorCode = String(this.parameters.error);
36
+ const emoji = PageError_1.emojisByErrorCodes.get(this.parameters.error);
37
+ return !emoji ? html `
38
+ <span>${errorCode}</span>
39
+ ` : html `
40
+ <span>${errorCode.charAt(0)}</span>${emoji}<span>${errorCode.charAt(2)}</span>
41
+ `;
42
+ }
43
+ };
44
+ PageError.emojisByErrorCodes = new Map([
45
+ [400 /* HttpErrorCode.BadRequest */, '😟'],
46
+ [401 /* HttpErrorCode.Unauthorized */, '⛔'],
47
+ [402 /* HttpErrorCode.PaymentRequired */, 'ðŸĪ‘'],
48
+ [404 /* HttpErrorCode.NotFound */, '🧐'],
49
+ [403 /* HttpErrorCode.Forbidden */, '🔒'],
50
+ [405 /* HttpErrorCode.MethodNotAllowed */, 'ðŸšŦ'],
51
+ [406 /* HttpErrorCode.NotAcceptable */, 'ðŸ˜ĩ'],
52
+ [407 /* HttpErrorCode.ProxyAuthenticationRequired */, 'ðŸĪ'],
53
+ [408 /* HttpErrorCode.RequestTimeout */, 'âē'],
54
+ [409 /* HttpErrorCode.Conflict */, 'ðŸ˜ĩ'],
55
+ [500 /* HttpErrorCode.InternalServerError */, 'ðŸ˜Ĩ'],
56
+ [501 /* HttpErrorCode.NotImplemented */, 'ðŸ˜ģ'],
57
+ [502 /* HttpErrorCode.BadGateway */, 'ðŸĨī'],
58
+ [503 /* HttpErrorCode.ServiceUnavailable */, 'ðŸ˜ī'],
59
+ [504 /* HttpErrorCode.GatewayTimeout */, '⌚'],
60
+ [505 /* HttpErrorCode.HttpVersionNotSupported */, '🙄'],
61
+ [506 /* HttpErrorCode.VariantAlsoNegotiates */, 'ðŸĪŠ'],
62
+ [507 /* HttpErrorCode.InsufficientStorage */, 'ðŸ’ū'],
63
+ [508 /* HttpErrorCode.LoopDetected */, '➰'],
64
+ ]);
65
+ PageError = PageError_1 = __decorate([
66
+ component('lit-page-error'),
67
+ route('/error/:error')
68
+ ], PageError);
69
+ export { PageError };
@@ -1,11 +1,11 @@
1
- import { Component } from '@a11d/lit';
2
- export declare class PageHost extends Component {
3
- static readonly instance?: PageHost;
4
- protected get template(): import("lit-html").TemplateResult<1>;
5
- }
6
- declare global {
7
- interface HTMLElementTagNameMap {
8
- 'lit-page-host': PageHost;
9
- }
10
- }
1
+ import { Component } from '@a11d/lit';
2
+ export declare class PageHost extends Component {
3
+ static readonly instance?: PageHost;
4
+ protected get template(): import("lit-html").TemplateResult<1>;
5
+ }
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'lit-page-host': PageHost;
9
+ }
10
+ }
11
11
  //# sourceMappingURL=PageHost.d.ts.map
@@ -1,19 +1,19 @@
1
- import { __decorate } from "tslib";
2
- import { Component, component, html, style } from '@a11d/lit';
3
- import { queryInstanceElement } from '../utilities/index.js';
4
- let PageHost = class PageHost extends Component {
5
- get template() {
6
- return html `
7
- <div part='pageHolder' ${style({ display: 'grid', gridTemplateRows: '1fr', width: '100%' })}>
8
- <slot></slot>
9
- </div>
10
- `;
11
- }
12
- };
13
- __decorate([
14
- queryInstanceElement()
15
- ], PageHost, "instance", void 0);
16
- PageHost = __decorate([
17
- component('lit-page-host')
18
- ], PageHost);
19
- export { PageHost };
1
+ import { __decorate } from "tslib";
2
+ import { Component, component, html, style } from '@a11d/lit';
3
+ import { queryInstanceElement } from '../utilities/index.js';
4
+ let PageHost = class PageHost extends Component {
5
+ get template() {
6
+ return html `
7
+ <div part='pageHolder' ${style({ display: 'grid', gridTemplateRows: '1fr', width: '100%' })}>
8
+ <slot></slot>
9
+ </div>
10
+ `;
11
+ }
12
+ };
13
+ __decorate([
14
+ queryInstanceElement()
15
+ ], PageHost, "instance", void 0);
16
+ PageHost = __decorate([
17
+ component('lit-page-host')
18
+ ], PageHost);
19
+ export { PageHost };
@@ -1,5 +1,5 @@
1
- export * from './PageError.js';
2
- export * from './PageHost.js';
3
- export * from './PageComponent.js';
4
- export * from './Page.js';
1
+ export * from './PageError.js';
2
+ export * from './PageHost.js';
3
+ export * from './PageComponent.js';
4
+ export * from './Page.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './PageError.js';
2
- export * from './PageHost.js';
3
- export * from './PageComponent.js';
4
- export * from './Page.js';
1
+ export * from './PageError.js';
2
+ export * from './PageHost.js';
3
+ export * from './PageComponent.js';
4
+ export * from './Page.js';
@@ -1,18 +1,18 @@
1
- export type Manifest = {
2
- readonly name: string;
3
- readonly short_name: string;
4
- readonly description: string;
5
- readonly start_url: string;
6
- readonly display: string;
7
- readonly display_override?: Array<string>;
8
- readonly background_color: string;
9
- readonly theme_color: string;
10
- readonly icons: Array<ManifestIcon>;
11
- readonly version?: string;
12
- };
13
- export type ManifestIcon = {
14
- readonly src: string;
15
- readonly sizes: string;
16
- readonly type: string;
17
- };
1
+ export type Manifest = {
2
+ readonly name: string;
3
+ readonly short_name: string;
4
+ readonly description: string;
5
+ readonly start_url: string;
6
+ readonly display: string;
7
+ readonly display_override?: Array<string>;
8
+ readonly background_color: string;
9
+ readonly theme_color: string;
10
+ readonly icons: Array<ManifestIcon>;
11
+ readonly version?: string;
12
+ };
13
+ export type ManifestIcon = {
14
+ readonly src: string;
15
+ readonly sizes: string;
16
+ readonly type: string;
17
+ };
18
18
  //# sourceMappingURL=Manifest.d.ts.map
@@ -1 +1 @@
1
- export {};
1
+ export {};