@a11d/lit-application 0.0.52 → 0.1.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.
Files changed (50) hide show
  1. package/dist/Application.d.ts +1 -2
  2. package/dist/Application.d.ts.map +1 -1
  3. package/dist/Application.js +4 -10
  4. package/dist/ApplicationTopLayer.d.ts +13 -0
  5. package/dist/ApplicationTopLayer.d.ts.map +1 -0
  6. package/dist/ApplicationTopLayer.js +29 -0
  7. package/dist/Dialog/Dialog.d.ts +1 -1
  8. package/dist/Dialog/Dialog.d.ts.map +1 -1
  9. package/dist/Dialog/Dialog.js +6 -1
  10. package/dist/Dialog/DialogComponent.d.ts +1 -1
  11. package/dist/Dialog/DialogComponent.d.ts.map +1 -1
  12. package/dist/Dialog/DialogComponent.js +23 -17
  13. package/dist/Dialog/index.d.ts +0 -1
  14. package/dist/Dialog/index.d.ts.map +1 -1
  15. package/dist/Dialog/index.js +0 -1
  16. package/dist/Notification/NotificationComponent.d.ts +31 -4
  17. package/dist/Notification/NotificationComponent.d.ts.map +1 -1
  18. package/dist/Notification/NotificationComponent.js +62 -1
  19. package/dist/Notification/index.d.ts +0 -1
  20. package/dist/Notification/index.d.ts.map +1 -1
  21. package/dist/Notification/index.js +0 -1
  22. package/dist/Page/PageComponent.d.ts +1 -1
  23. package/dist/Page/PageComponent.d.ts.map +1 -1
  24. package/dist/Page/PageComponent.js +12 -6
  25. package/dist/Page/PageError.js +20 -20
  26. package/dist/Page/PageHost.d.ts +1 -1
  27. package/dist/Page/PageHost.d.ts.map +1 -1
  28. package/dist/Page/PageHost.js +11 -10
  29. package/dist/Router/Router.d.ts +1 -1
  30. package/dist/Router/Router.d.ts.map +1 -1
  31. package/dist/Router/Router.js +7 -2
  32. package/dist/Router/routerLink.js +10 -10
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/dist/utilities/HttpError.js +39 -38
  38. package/dist/utilities/HttpErrorCode.d.ts +1 -1
  39. package/dist/utilities/HttpErrorCode.d.ts.map +1 -1
  40. package/dist/utilities/HttpErrorCode.js +41 -1
  41. package/dist/utilities/WindowHelper.d.ts +1 -1
  42. package/dist/utilities/WindowHelper.d.ts.map +1 -1
  43. package/dist/utilities/WindowHelper.js +9 -4
  44. package/package.json +2 -1
  45. package/dist/Dialog/DialogHost.d.ts +0 -11
  46. package/dist/Dialog/DialogHost.d.ts.map +0 -1
  47. package/dist/Dialog/DialogHost.js +0 -13
  48. package/dist/Notification/NotificationHost.d.ts +0 -44
  49. package/dist/Notification/NotificationHost.d.ts.map +0 -1
  50. package/dist/Notification/NotificationHost.js +0 -95
@@ -5,6 +5,7 @@ export declare const application: () => <T extends Application>(ApplicationConst
5
5
  export declare abstract class Application extends NonInertableComponent {
6
6
  static readonly connectingHooks: HookSet<void>;
7
7
  static readonly beforeRouteHooks: HookSet<void>;
8
+ static get topLayer(): HTMLElement;
8
9
  static readonly instance?: Application;
9
10
  static get styles(): import("@a11d/lit").CSSResult;
10
11
  pageHeading?: string;
@@ -16,9 +17,7 @@ export declare abstract class Application extends NonInertableComponent {
16
17
  protected initialized(): Promise<void>;
17
18
  protected get documentTitle(): string;
18
19
  protected get template(): import("lit-html").TemplateResult<1>;
19
- protected get notificationHostTemplate(): import("lit-html").TemplateResult<1>;
20
20
  protected get bodyTemplate(): import("lit-html").TemplateResult<1>;
21
21
  protected get pageHostTemplate(): import("lit-html").TemplateResult<1>;
22
- protected get dialogHostTemplate(): import("lit-html").TemplateResult<1>;
23
22
  }
24
23
  //# sourceMappingURL=Application.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../Application.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAA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;IAEiF,WAAW,CAAC,EAAE,MAAM,CAAA;IAEtG,QAAQ,CAAC,MAAM,mBAMd;IAED,SAAS,CAAC,QAAQ,CAAC,eAAe,4BAAwE;IAEjG,OAAO,CAAC,iBAAiB,CAAQ;cAEvB,gBAAgB;IAIpB,iBAAiB;cAOP,WAAW;IAMpC,SAAS,KAAK,aAAa,WAE1B;IAED,cAAuB,QAAQ,yCAI9B;IAED,SAAS,KAAK,YAAY,yCAEzB;IAED,SAAS,KAAK,gBAAgB,yCAM7B;CACD"}
@@ -3,7 +3,8 @@ import { property, css, html, nothing, state } from '@a11d/lit';
3
3
  import { RootCssInjectorController } from '@a11d/root-css-injector';
4
4
  import { NonInertableComponent } from '@a11d/non-inertable-component';
5
5
  import { HookSet, PageError, RouterController } from './index.js';
6
- import { queryInstanceElement } from './utilities/index.js';
6
+ import { HttpErrorCode, queryInstanceElement } from './utilities/index.js';
7
+ import { ApplicationTopLayer } from './ApplicationTopLayer.js';
7
8
  export const application = () => {
8
9
  return (ApplicationConstructor) => {
9
10
  if (!ApplicationConstructor.instance) {
@@ -16,12 +17,13 @@ export class Application extends NonInertableComponent {
16
17
  super(...arguments);
17
18
  this.router = new RouterController(this, [], {
18
19
  fallback: {
19
- render: () => new PageError({ error: 404 /* HttpErrorCode.NotFound */ })
20
+ render: () => new PageError({ error: HttpErrorCode.NotFound })
20
21
  }
21
22
  });
22
23
  this.rootCssInjector = new RootCssInjectorController(this, this.constructor.styles);
23
24
  this.shallRenderRouter = false;
24
25
  }
26
+ static get topLayer() { return ApplicationTopLayer.instance; }
25
27
  static get styles() {
26
28
  return css `
27
29
  :root { color-scheme: light dark; }
@@ -81,14 +83,9 @@ export class Application extends NonInertableComponent {
81
83
  }
82
84
  get template() {
83
85
  return html `
84
- ${this.notificationHostTemplate}
85
86
  ${this.bodyTemplate}
86
- ${this.dialogHostTemplate}
87
87
  `;
88
88
  }
89
- get notificationHostTemplate() {
90
- return html `<lit-notification-host></lit-notification-host>`;
91
- }
92
89
  get bodyTemplate() {
93
90
  return html `${this.pageHostTemplate}`;
94
91
  }
@@ -99,9 +96,6 @@ export class Application extends NonInertableComponent {
99
96
  </lit-page-host>
100
97
  `;
101
98
  }
102
- get dialogHostTemplate() {
103
- return html `<lit-dialog-host></lit-dialog-host>`;
104
- }
105
99
  }
106
100
  Application.connectingHooks = new HookSet();
107
101
  Application.beforeRouteHooks = new HookSet();
@@ -0,0 +1,13 @@
1
+ import { Component } from '@a11d/lit';
2
+ export declare class ApplicationTopLayer extends Component {
3
+ private static readonly instances;
4
+ static get instance(): HTMLElement;
5
+ get template(): import("lit-html").TemplateResult<1>;
6
+ static get styles(): import("@a11d/lit").CSSResult;
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'lit-application-top-layer': ApplicationTopLayer;
11
+ }
12
+ }
13
+ //# sourceMappingURL=ApplicationTopLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationTopLayer.d.ts","sourceRoot":"","sources":["../ApplicationTopLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAA;AAG3D,qBACa,mBAAoB,SAAQ,SAAS;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAA0B;IAEtF,MAAM,KAAK,QAAQ,gBAGlB;IAED,IAAa,QAAQ,yCAEpB;IAED,WAAoB,MAAM,kCAQzB;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,2BAA2B,EAAE,mBAAmB,CAAA;KAChD;CACD"}
@@ -0,0 +1,29 @@
1
+ var ApplicationTopLayer_1;
2
+ import { __decorate } from "tslib";
3
+ import { Component, component, css, html } from '@a11d/lit';
4
+ import { queryConnectedInstances } from '@3mo/query-connected-instances';
5
+ let ApplicationTopLayer = ApplicationTopLayer_1 = class ApplicationTopLayer extends Component {
6
+ static get instance() {
7
+ const instances = [...ApplicationTopLayer_1.instances];
8
+ return instances[instances.length - 1] ?? document.body;
9
+ }
10
+ get template() {
11
+ return html `<slot></slot>`;
12
+ }
13
+ static get styles() {
14
+ return css `
15
+ :host {
16
+ position: absolute;
17
+ width: 0px;
18
+ height: 0px;
19
+ }
20
+ `;
21
+ }
22
+ };
23
+ __decorate([
24
+ queryConnectedInstances()
25
+ ], ApplicationTopLayer, "instances", void 0);
26
+ ApplicationTopLayer = ApplicationTopLayer_1 = __decorate([
27
+ component('lit-application-top-layer')
28
+ ], ApplicationTopLayer);
29
+ export { ApplicationTopLayer };
@@ -1,4 +1,4 @@
1
- export declare const enum DialogActionKey {
1
+ export declare enum DialogActionKey {
2
2
  Primary = "primary",
3
3
  Secondary = "secondary",
4
4
  Cancellation = "cancellation"
@@ -1 +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,2BAA2B,CAAC,EAAE,OAAO,CAAA;IACrC,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB,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"}
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../Dialog/Dialog.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IAC1B,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,2BAA2B,CAAC,EAAE,OAAO,CAAA;IACrC,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB,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"}
@@ -1 +1,6 @@
1
- export {};
1
+ export var DialogActionKey;
2
+ (function (DialogActionKey) {
3
+ DialogActionKey["Primary"] = "primary";
4
+ DialogActionKey["Secondary"] = "secondary";
5
+ DialogActionKey["Cancellation"] = "cancellation";
6
+ })(DialogActionKey || (DialogActionKey = {}));
@@ -5,7 +5,7 @@ import { Dialog, DialogActionKey } from './index.js';
5
5
  export type DialogParameters = void | Record<string, any>;
6
6
  export type DialogResult<TResult> = TResult | Error;
7
7
  export type DialogAction<TResult> = DialogResult<TResult> | PromiseLike<DialogResult<TResult>>;
8
- export declare const enum DialogConfirmationStrategy {
8
+ export declare enum DialogConfirmationStrategy {
9
9
  Dialog = 0,
10
10
  Tab = 1,
11
11
  Window = 2
@@ -1 +1 @@
1
- {"version":3,"file":"DialogComponent.d.ts","sourceRoot":"","sources":["../../Dialog/DialogComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,cAAc,EAAE,MAAM,WAAW,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAe,OAAO,EAA6D,MAAM,aAAa,CAAA;AAC7G,OAAO,EAAc,MAAM,EAAE,eAAe,EAAoC,MAAM,YAAY,CAAA;AAElG,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEzD,MAAM,MAAM,YAAY,CAAC,OAAO,IAAI,OAAO,GAAG,KAAK,CAAA;AAEnD,MAAM,MAAM,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,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAA;AAE9G,8BAAsB,eAAe,CAAC,CAAC,SAAS,gBAAgB,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,CAAE,SAAQ,SAAS;IA2B7F,QAAQ,CAAC,UAAU,EAAE,CAAC;IA1BlC,MAAM,CAAC,QAAQ,CAAC,eAAe,qCAA2C;IAE1E,OAAO,CAAC,MAAM,CAAC,QAAQ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aAAa;IAgB/B,iBAAiB;IAKhC,OAAO,CAAC,QAAQ,6BAAoC;IAMpD,OAAO,CAAC,4BAA4B,CAAC,CAGpC;cAEe,eAAe;IAQ/B,OAAO,CAAC,YAAY,CAAC,CAAQ;cACb,cAAc,CAAC,QAAQ,EAAE,yBAAyB;cAmBlD,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,SAAS,CAAC,QAAQ,CAAC,YAAY,cAAqB,eAAe,mBA0BlE;CACD"}
@@ -1,8 +1,14 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { Component, eventListener, literal } from '@a11d/lit';
3
3
  import { LocalStorage } from '@a11d/local-storage';
4
- import { Application, HookSet, querySymbolizedElement, WindowHelper, Key } from '../index.js';
5
- import { PageDialog, DialogCancelledError, DialogHost } from './index.js';
4
+ import { Application, HookSet, querySymbolizedElement, WindowHelper, WindowOpenMode, Key, NotificationComponent } from '../index.js';
5
+ import { PageDialog, DialogActionKey, DialogCancelledError } from './index.js';
6
+ export var DialogConfirmationStrategy;
7
+ (function (DialogConfirmationStrategy) {
8
+ DialogConfirmationStrategy[DialogConfirmationStrategy["Dialog"] = 0] = "Dialog";
9
+ DialogConfirmationStrategy[DialogConfirmationStrategy["Tab"] = 1] = "Tab";
10
+ DialogConfirmationStrategy[DialogConfirmationStrategy["Window"] = 2] = "Window";
11
+ })(DialogConfirmationStrategy || (DialogConfirmationStrategy = {}));
6
12
  export class DialogComponent extends Component {
7
13
  static dialogElement() {
8
14
  return (constructor) => {
@@ -10,7 +16,7 @@ export class DialogComponent extends Component {
10
16
  };
11
17
  }
12
18
  static getHost() {
13
- return Promise.resolve(DialogHost.instance ?? Application.instance ?? document.body);
19
+ return Promise.resolve(Application.topLayer);
14
20
  }
15
21
  get primaryActionElement() { return this.dialogElement.primaryActionElement; }
16
22
  get secondaryActionElement() { return this.dialogElement.secondaryActionElement; }
@@ -20,9 +26,9 @@ export class DialogComponent extends Component {
20
26
  this.parameters = parameters;
21
27
  this.handleAction = async (actionKey) => {
22
28
  const actionByKey = new Map([
23
- ["primary" /* DialogActionKey.Primary */, this.primaryAction],
24
- ["secondary" /* DialogActionKey.Secondary */, this.secondaryAction],
25
- ["cancellation" /* DialogActionKey.Cancellation */, this.cancellationAction],
29
+ [DialogActionKey.Primary, this.primaryAction],
30
+ [DialogActionKey.Secondary, this.secondaryAction],
31
+ [DialogActionKey.Cancellation, this.cancellationAction],
26
32
  ]);
27
33
  // eslint-disable-next-line no-restricted-syntax
28
34
  const action = actionByKey.get(actionKey)?.bind(this);
@@ -32,12 +38,12 @@ export class DialogComponent extends Component {
32
38
  try {
33
39
  this.dialogElement.executingAction = actionKey;
34
40
  const result = await action();
35
- if (!this.dialogElement.manualClose || actionKey === "cancellation" /* DialogActionKey.Cancellation */) {
41
+ if (!this.dialogElement.manualClose || actionKey === DialogActionKey.Cancellation) {
36
42
  this.close(result);
37
43
  }
38
44
  }
39
45
  catch (e) {
40
- notificationHost.notifyError(e.message);
46
+ NotificationComponent.notifyError(e.message);
41
47
  throw e;
42
48
  }
43
49
  finally {
@@ -47,7 +53,7 @@ export class DialogComponent extends Component {
47
53
  }
48
54
  async handleBeforeUnload() {
49
55
  if (this.dialogElement.boundToWindow) {
50
- await this.handleAction("cancellation" /* DialogActionKey.Cancellation */);
56
+ await this.handleAction(DialogActionKey.Cancellation);
51
57
  }
52
58
  }
53
59
  async handleKeyDown(e) {
@@ -56,18 +62,18 @@ export class DialogComponent extends Component {
56
62
  return;
57
63
  }
58
64
  if (this.dialogElement.primaryOnEnter === true && e.key === Key.Enter) {
59
- await this.handleAction("primary" /* DialogActionKey.Primary */);
65
+ await this.handleAction(DialogActionKey.Primary);
60
66
  }
61
67
  if (!this.dialogElement.preventCancellationOnEscape && e.key === Key.Escape) {
62
- await this.handleAction("cancellation" /* DialogActionKey.Cancellation */);
68
+ await this.handleAction(DialogActionKey.Cancellation);
63
69
  }
64
70
  }
65
71
  async connectedCallback() {
66
72
  await DialogComponent.connectingHooks.execute(this);
67
73
  super.connectedCallback();
68
74
  }
69
- confirm(strategy = 0 /* DialogConfirmationStrategy.Dialog */) {
70
- return strategy === 0 /* DialogConfirmationStrategy.Dialog */
75
+ confirm(strategy = DialogConfirmationStrategy.Dialog) {
76
+ return strategy === DialogConfirmationStrategy.Dialog
71
77
  ? this.confirmAsDialog()
72
78
  : this.confirmAsPopup(strategy);
73
79
  }
@@ -79,7 +85,7 @@ export class DialogComponent extends Component {
79
85
  });
80
86
  }
81
87
  async confirmAsPopup(strategy) {
82
- this._popupWindow = await WindowHelper.open(PageDialog.route, strategy === 2 /* DialogConfirmationStrategy.Window */ ? 1 /* WindowOpenMode.Window */ : 0 /* WindowOpenMode.Tab */);
88
+ this._popupWindow = await WindowHelper.open(PageDialog.route, strategy === DialogConfirmationStrategy.Window ? WindowOpenMode.Window : WindowOpenMode.Tab);
83
89
  const DialogConstructor = this._popupWindow.customElements.get(this.tagName.toLowerCase());
84
90
  const dialogComponent = new DialogConstructor(this.parameters);
85
91
  const Constructor = this.constructor;
@@ -93,7 +99,7 @@ export class DialogComponent extends Component {
93
99
  dialogComponent.dialogElement.boundToWindow = true;
94
100
  return confirmPromise;
95
101
  }
96
- async pop(strategy = 1 /* DialogConfirmationStrategy.Tab */) {
102
+ async pop(strategy = DialogConfirmationStrategy.Tab) {
97
103
  this.open = false;
98
104
  try {
99
105
  const value = await this.confirm(strategy);
@@ -128,7 +134,7 @@ export class DialogComponent extends Component {
128
134
  this.dialogElement.requestPopup?.subscribe(() => this.pop());
129
135
  if (this.dialogElement.poppable &&
130
136
  window.location.pathname !== PageDialog.route &&
131
- DialogComponent.poppableConfirmationStrategy.value !== 0 /* DialogConfirmationStrategy.Dialog */) {
137
+ DialogComponent.poppableConfirmationStrategy.value !== DialogConfirmationStrategy.Dialog) {
132
138
  this.pop(DialogComponent.poppableConfirmationStrategy.value);
133
139
  return;
134
140
  }
@@ -148,7 +154,7 @@ export class DialogComponent extends Component {
148
154
  DialogComponent.connectingHooks = new HookSet();
149
155
  DialogComponent.dialogElementConstructorSymbol = Symbol('DialogComponent.DialogElementConstructor');
150
156
  DialogComponent.defaultDialogElementTag = literal `lit-dialog`;
151
- DialogComponent.poppableConfirmationStrategy = new LocalStorage('DialogComponent.PoppableConfirmationStrategy', 0 /* DialogConfirmationStrategy.Dialog */);
157
+ DialogComponent.poppableConfirmationStrategy = new LocalStorage('DialogComponent.PoppableConfirmationStrategy', DialogConfirmationStrategy.Dialog);
152
158
  __decorate([
153
159
  querySymbolizedElement(DialogComponent.dialogElementConstructorSymbol)
154
160
  ], DialogComponent.prototype, "dialogElement", void 0);
@@ -1,5 +1,4 @@
1
1
  export * from './DialogCancelledError.js';
2
- export * from './DialogHost.js';
3
2
  export * from './DialogComponent.js';
4
3
  export * from './Dialog.js';
5
4
  export * from './PageDialog.js';
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Dialog/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
@@ -1,5 +1,4 @@
1
1
  export * from './DialogCancelledError.js';
2
- export * from './DialogHost.js';
3
2
  export * from './DialogComponent.js';
4
3
  export * from './Dialog.js';
5
4
  export * from './PageDialog.js';
@@ -1,6 +1,33 @@
1
- import { Notification } from './NotificationHost.js';
2
- export interface NotificationComponent {
3
- notification: Notification;
4
- show(): Promise<void>;
1
+ export declare enum NotificationType {
2
+ Info = "info",
3
+ Success = "success",
4
+ Warning = "warning",
5
+ Error = "error"
5
6
  }
7
+ export type Notification = {
8
+ type?: NotificationType;
9
+ message: string;
10
+ actions?: Array<NotificationAction>;
11
+ };
12
+ type NotificationAction = {
13
+ title: string;
14
+ handleClick: () => void | PromiseLike<void>;
15
+ };
16
+ type NonTypedNotification = Omit<Notification, 'type'>;
17
+ type NonTypedNotificationParameters = [notification: NonTypedNotification] | [message: string, ...actions: Array<NotificationAction>];
18
+ type NonTypedNotificationWithErrorParameters = [notification: Partial<NonTypedNotification>] | [message?: string, ...actions: Array<NotificationAction>];
19
+ export declare abstract class NotificationComponent {
20
+ static readonly shownNotifications: Set<Notification>;
21
+ private static DefaultComponentConstructor?;
22
+ static defaultComponent: () => <T extends NotificationComponent>(Constructor: Constructor<T>) => void;
23
+ static notifyInfo(...notification: NonTypedNotificationParameters): Promise<void>;
24
+ static notifySuccess(...notification: NonTypedNotificationParameters): Promise<void>;
25
+ static notifyWarning(...notification: NonTypedNotificationParameters): Promise<void>;
26
+ static notifyError(...notification: NonTypedNotificationParameters): Promise<void>;
27
+ static notifyAndThrowError<TError extends Error>(error: TError, ...notification: NonTypedNotificationWithErrorParameters): void;
28
+ static notify(notification: Notification): Promise<void>;
29
+ abstract notification: Notification;
30
+ abstract show(): Promise<void>;
31
+ }
32
+ export {};
6
33
  //# sourceMappingURL=NotificationComponent.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../Notification/NotificationComponent.ts"],"names":[],"mappings":"AAGA,oBAAY,gBAAgB;IAC3B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CACf;AAED,MAAM,MAAM,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,KAAK,kBAAkB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;CAC3C,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAEtD,KAAK,8BAA8B,GAChC,CAAC,YAAY,EAAE,oBAAoB,CAAC,GACpC,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAE3D,KAAK,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,8BAAsB,qBAAqB;IAC1C,MAAM,CAAC,QAAQ,CAAC,kBAAkB,oBAA0B;IAE5D,OAAO,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAoC;IAE/E,MAAM,CAAC,gBAAgB,+EAItB;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAIjE,MAAM,CAAC,aAAa,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAIpE,MAAM,CAAC,aAAa,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAIpE,MAAM,CAAC,WAAW,CAAC,GAAG,YAAY,EAAE,8BAA8B;IAIlE,MAAM,CAAC,mBAAmB,CAAC,MAAM,SAAS,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,uCAAuC;WAS3G,MAAM,CAAC,YAAY,EAAE,YAAY;IA0B9C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAA;IACnC,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAC9B"}
@@ -1 +1,62 @@
1
- export {};
1
+ import { LitElement } from "@a11d/lit";
2
+ import { Application } from "../Application.js";
3
+ export var NotificationType;
4
+ (function (NotificationType) {
5
+ NotificationType["Info"] = "info";
6
+ NotificationType["Success"] = "success";
7
+ NotificationType["Warning"] = "warning";
8
+ NotificationType["Error"] = "error";
9
+ })(NotificationType || (NotificationType = {}));
10
+ function normalizeNonTypedNotificationParameters(...parameters) {
11
+ return typeof parameters[0] !== 'string' ? parameters[0] : {
12
+ message: parameters[0],
13
+ actions: parameters.slice(1),
14
+ };
15
+ }
16
+ export class NotificationComponent {
17
+ static notifyInfo(...notification) {
18
+ return this.notify({ type: NotificationType.Info, ...normalizeNonTypedNotificationParameters(...notification) });
19
+ }
20
+ static notifySuccess(...notification) {
21
+ return this.notify({ type: NotificationType.Success, ...normalizeNonTypedNotificationParameters(...notification) });
22
+ }
23
+ static notifyWarning(...notification) {
24
+ return this.notify({ type: NotificationType.Warning, ...normalizeNonTypedNotificationParameters(...notification) });
25
+ }
26
+ static notifyError(...notification) {
27
+ return this.notify({ type: NotificationType.Error, ...normalizeNonTypedNotificationParameters(...notification) });
28
+ }
29
+ static notifyAndThrowError(error, ...notification) {
30
+ const normalizedNotification = notification.length === 0
31
+ ? {}
32
+ : normalizeNonTypedNotificationParameters(...notification);
33
+ normalizedNotification.message ?? (normalizedNotification.message = error.message);
34
+ this.notifyError(normalizedNotification);
35
+ throw error;
36
+ }
37
+ static async notify(notification) {
38
+ const notificationComponent = this !== NotificationComponent
39
+ ? new this()
40
+ : NotificationComponent.DefaultComponentConstructor
41
+ ? new NotificationComponent.DefaultComponentConstructor()
42
+ : undefined;
43
+ if (!notificationComponent) {
44
+ throw new Error('No notification component registered');
45
+ }
46
+ notificationComponent.notification = notification;
47
+ if (notificationComponent instanceof LitElement) {
48
+ Application.topLayer.appendChild(notificationComponent);
49
+ }
50
+ await notificationComponent.show();
51
+ if (notificationComponent instanceof LitElement) {
52
+ notificationComponent.remove();
53
+ }
54
+ NotificationComponent.shownNotifications.add(notification);
55
+ }
56
+ }
57
+ NotificationComponent.shownNotifications = new Set();
58
+ NotificationComponent.defaultComponent = () => {
59
+ return (Constructor) => {
60
+ NotificationComponent.DefaultComponentConstructor = Constructor;
61
+ };
62
+ };
@@ -1,4 +1,3 @@
1
1
  import '@a11d/constructor';
2
- export * from './NotificationHost.js';
3
2
  export * from './NotificationComponent.js';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,cAAc,4BAA4B,CAAA"}
@@ -1,3 +1,2 @@
1
1
  import '@a11d/constructor';
2
- export * from './NotificationHost.js';
3
2
  export * from './NotificationComponent.js';
@@ -2,7 +2,7 @@ import { Component } from '@a11d/lit';
2
2
  import { HookSet } from '../index.js';
3
3
  import { Page } from './index.js';
4
4
  export type PageParameters = void | Record<string, string | number | undefined>;
5
- export declare const enum PageNavigationStrategy {
5
+ export declare enum PageNavigationStrategy {
6
6
  Page = 0,
7
7
  Tab = 1,
8
8
  Window = 2
@@ -1 +1 @@
1
- {"version":3,"file":"PageComponent.d.ts","sourceRoot":"","sources":["../../Page/PageComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAwD,OAAO,EAA0B,MAAM,aAAa,CAAA;AACnH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;AAE/E,0BAAkB,sBAAsB;IAAG,IAAI,IAAA;IAAE,GAAG,IAAA;IAAE,MAAM,IAAA;CAAE;AAE9D,8BAAsB,aAAa,CAAC,CAAC,SAAS,cAAc,GAAG,IAAI,CAAE,SAAQ,SAAS;IA4BzE,QAAQ,CAAC,UAAU,EAAE,CAAC;IA3BlC,MAAM,CAAC,QAAQ,CAAC,eAAe,8BAAoC;IAEnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAiD;IAErG,MAAM,CAAC,qBAAqB,2CAAoB;IAEhD,MAAM,CAAC,WAAW,kBACI,YAAY,IAAI,CAAC;IAKjC,QAAQ,CAAC,QAAQ,yBAA8B,EAAE,KAAK,UAAQ;IAaA,QAAQ,CAAC,WAAW,EAAG,IAAI,GAAG,WAAW,CAAA;gBAExF,UAAU,EAAE,CAAC;IAInB,iBAAiB;IAKhC,SAAS,CAAC,OAAO,CAAC,UAAU,IAAkB;CAG9C"}
1
+ {"version":3,"file":"PageComponent.d.ts","sourceRoot":"","sources":["../../Page/PageComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAwD,OAAO,EAA0B,MAAM,aAAa,CAAA;AACnH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;AAE/E,oBAAY,sBAAsB;IAAG,IAAI,IAAA;IAAE,GAAG,IAAA;IAAE,MAAM,IAAA;CAAE;AAExD,8BAAsB,aAAa,CAAC,CAAC,SAAS,cAAc,GAAG,IAAI,CAAE,SAAQ,SAAS;IA4BzE,QAAQ,CAAC,UAAU,EAAE,CAAC;IA3BlC,MAAM,CAAC,QAAQ,CAAC,eAAe,8BAAoC;IAEnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAiD;IAErG,MAAM,CAAC,qBAAqB,2CAAoB;IAEhD,MAAM,CAAC,WAAW,kBACI,YAAY,IAAI,CAAC;IAKjC,QAAQ,CAAC,QAAQ,yBAA8B,EAAE,KAAK,UAAQ;IAaA,QAAQ,CAAC,WAAW,EAAG,IAAI,GAAG,WAAW,CAAA;gBAExF,UAAU,EAAE,CAAC;IAInB,iBAAiB;IAKhC,SAAS,CAAC,OAAO,CAAC,UAAU,IAAkB;CAG9C"}
@@ -1,22 +1,28 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { Component, literal } from '@a11d/lit';
3
- import { querySymbolizedElement, WindowHelper, HookSet, Router } from '../index.js';
3
+ import { querySymbolizedElement, WindowHelper, WindowOpenMode, HookSet, Router, RouteMatchMode } from '../index.js';
4
+ export var PageNavigationStrategy;
5
+ (function (PageNavigationStrategy) {
6
+ PageNavigationStrategy[PageNavigationStrategy["Page"] = 0] = "Page";
7
+ PageNavigationStrategy[PageNavigationStrategy["Tab"] = 1] = "Tab";
8
+ PageNavigationStrategy[PageNavigationStrategy["Window"] = 2] = "Window";
9
+ })(PageNavigationStrategy || (PageNavigationStrategy = {}));
4
10
  export class PageComponent extends Component {
5
11
  static pageElement() {
6
12
  return (constructor) => {
7
13
  constructor[PageComponent.pageElementConstructorSymbol] = true;
8
14
  };
9
15
  }
10
- async navigate(strategy = 0 /* PageNavigationStrategy.Page */, force = false) {
11
- if (force === false && Router.match(this, "all" /* RouteMatchMode.All */)) {
16
+ async navigate(strategy = PageNavigationStrategy.Page, force = false) {
17
+ if (force === false && Router.match(this, RouteMatchMode.All)) {
12
18
  return;
13
19
  }
14
- if (strategy === 0 /* PageNavigationStrategy.Page */) {
20
+ if (strategy === PageNavigationStrategy.Page) {
15
21
  Router.setPathByPage(this);
16
22
  }
17
23
  else {
18
24
  const url = window.location.origin + Router.getPathOf(this);
19
- await WindowHelper.openAndFocus(url, strategy === 2 /* PageNavigationStrategy.Window */ ? 1 /* WindowOpenMode.Window */ : 0 /* WindowOpenMode.Tab */);
25
+ await WindowHelper.openAndFocus(url, strategy === PageNavigationStrategy.Window ? WindowOpenMode.Window : WindowOpenMode.Tab);
20
26
  }
21
27
  }
22
28
  constructor(parameters) {
@@ -28,7 +34,7 @@ export class PageComponent extends Component {
28
34
  super.connectedCallback();
29
35
  }
30
36
  refresh(parameters = this.parameters) {
31
- return new this.constructor(parameters).navigate(0 /* PageNavigationStrategy.Page */, true);
37
+ return new this.constructor(parameters).navigate(PageNavigationStrategy.Page, true);
32
38
  }
33
39
  }
34
40
  PageComponent.connectingHooks = new HookSet();
@@ -1,7 +1,7 @@
1
1
  var PageError_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { component, css, html, staticHtml, style } from '@a11d/lit';
4
- import { HttpError } from '../index.js';
4
+ import { HttpError, HttpErrorCode } from '../index.js';
5
5
  import { route } from '../Router/route.js';
6
6
  import { PageComponent } from './PageComponent.js';
7
7
  let PageError = PageError_1 = class PageError extends PageComponent {
@@ -42,25 +42,25 @@ let PageError = PageError_1 = class PageError extends PageComponent {
42
42
  }
43
43
  };
44
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 */, '➰'],
45
+ [HttpErrorCode.BadRequest, '😟'],
46
+ [HttpErrorCode.Unauthorized, '⛔'],
47
+ [HttpErrorCode.PaymentRequired, 'ðŸĪ‘'],
48
+ [HttpErrorCode.NotFound, '🧐'],
49
+ [HttpErrorCode.Forbidden, '🔒'],
50
+ [HttpErrorCode.MethodNotAllowed, 'ðŸšŦ'],
51
+ [HttpErrorCode.NotAcceptable, 'ðŸ˜ĩ'],
52
+ [HttpErrorCode.ProxyAuthenticationRequired, 'ðŸĪ'],
53
+ [HttpErrorCode.RequestTimeout, 'âē'],
54
+ [HttpErrorCode.Conflict, 'ðŸ˜ĩ'],
55
+ [HttpErrorCode.InternalServerError, 'ðŸ˜Ĩ'],
56
+ [HttpErrorCode.NotImplemented, 'ðŸ˜ģ'],
57
+ [HttpErrorCode.BadGateway, 'ðŸĨī'],
58
+ [HttpErrorCode.ServiceUnavailable, 'ðŸ˜ī'],
59
+ [HttpErrorCode.GatewayTimeout, '⌚'],
60
+ [HttpErrorCode.HttpVersionNotSupported, '🙄'],
61
+ [HttpErrorCode.VariantAlsoNegotiates, 'ðŸĪŠ'],
62
+ [HttpErrorCode.InsufficientStorage, 'ðŸ’ū'],
63
+ [HttpErrorCode.LoopDetected, '➰'],
64
64
  ]);
65
65
  PageError = PageError_1 = __decorate([
66
66
  component('lit-page-error'),
@@ -1,6 +1,6 @@
1
1
  import { Component } from '@a11d/lit';
2
2
  export declare class PageHost extends Component {
3
- static readonly instance?: PageHost;
3
+ static get styles(): import("@a11d/lit").CSSResult;
4
4
  protected get template(): import("lit-html").TemplateResult<1>;
5
5
  }
6
6
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"PageHost.d.ts","sourceRoot":"","sources":["../../Page/PageHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,WAAW,CAAA;AAG7D,qBACa,QAAS,SAAQ,SAAS;IACd,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAE3D,cAAuB,QAAQ,yCAM9B;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,QAAQ,CAAA;KACzB;CACD"}
1
+ {"version":3,"file":"PageHost.d.ts","sourceRoot":"","sources":["../../Page/PageHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAA;AAE3D,qBACa,QAAS,SAAQ,SAAS;IACtC,WAAoB,MAAM,kCAQzB;IAED,cAAuB,QAAQ,yCAE9B;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,QAAQ,CAAA;KACzB;CACD"}
@@ -1,18 +1,19 @@
1
1
  import { __decorate } from "tslib";
2
- import { Component, component, html, style } from '@a11d/lit';
3
- import { queryInstanceElement } from '../utilities/index.js';
2
+ import { Component, component, css, html } from '@a11d/lit';
4
3
  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>
4
+ static get styles() {
5
+ return css `
6
+ :host {
7
+ display: grid;
8
+ grid-template-rows: 1fr;
9
+ width: 100%;
10
+ }
10
11
  `;
11
12
  }
13
+ get template() {
14
+ return html `<slot></slot>`;
15
+ }
12
16
  };
13
- __decorate([
14
- queryInstanceElement()
15
- ], PageHost, "instance", void 0);
16
17
  PageHost = __decorate([
17
18
  component('lit-page-host')
18
19
  ], PageHost);
@@ -1,5 +1,5 @@
1
1
  import { RoutesContainer, type Page } from './RoutesContainer.js';
2
- export declare const enum RouteMatchMode {
2
+ export declare enum RouteMatchMode {
3
3
  All = "all",
4
4
  IgnoreParameters = "ignore-parameters"
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../Router/Router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAEjE,0BAAkB,cAAc;IAC/B,GAAG,QAAQ;IACX,gBAAgB,sBAAsB;CACtC;AAED,qBAAa,MAAM;IAClB,MAAM,CAAC,QAAQ,CAAC,SAAS,kBAAsB;IAE/C,IAAI,QAAQ,WAAuC;IACnD,IAAI,QAAQ,CAAC,KAAK,QAAA,EAAuC;IAEzD,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI;IAK3B,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI;IAO/B,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,iBAAqB;IAalD,OAAO,CAAC,MAAM,CAAC,UAAU;IAMzB,MAAM,KAAK,IAAI,WAA+D;IA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