@a11d/lit-application 0.8.2 → 0.9.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.
@@ -23,44 +23,46 @@ export class Application extends NonInertableComponent {
23
23
  this.rootCssInjector = new RootCssInjectorController(this, this.constructor.styles);
24
24
  this.shallRenderRouter = false;
25
25
  }
26
+ static { this.connectingHooks = new HookSet(); }
27
+ static { this.beforeRouteHooks = new HookSet(); }
26
28
  static get topLayer() { return ApplicationTopLayer.instance; }
27
29
  static get styles() {
28
- return css `
29
- :root { color-scheme: light dark; }
30
-
31
- html, body, [application] {
32
- margin: 0;
33
- padding: 0;
34
- scrollbar-width: thin;
35
- display: block;
36
- min-height: 100vh;
37
- min-height: 100dvh;
38
- }
39
-
40
- [application] {
41
- display: flex;
42
- flex-direction: column;
43
- }
44
-
45
- ::-webkit-scrollbar {
46
- width: 5px;
47
- height: 5px;
48
- }
49
-
50
- ::-webkit-scrollbar-thumb {
51
- background: rgba(128, 128, 128, 0.75);
52
- }
53
-
54
- lit-page-host {
55
- flex: 1;
56
- margin: auto;
57
- width: 100%;
58
- max-width: var(--lit-application-page-host-max-width, 2560px);
59
- }
60
-
61
- lit-page-host > * {
62
- padding: max(min(1rem, 1vw), min(1rem, 1vh));
63
- }
30
+ return css `
31
+ :root { color-scheme: light dark; }
32
+
33
+ html, body, [application] {
34
+ margin: 0;
35
+ padding: 0;
36
+ scrollbar-width: thin;
37
+ display: block;
38
+ min-height: 100vh;
39
+ min-height: 100dvh;
40
+ }
41
+
42
+ [application] {
43
+ display: flex;
44
+ flex-direction: column;
45
+ }
46
+
47
+ ::-webkit-scrollbar {
48
+ width: 5px;
49
+ height: 5px;
50
+ }
51
+
52
+ ::-webkit-scrollbar-thumb {
53
+ background: rgba(128, 128, 128, 0.75);
54
+ }
55
+
56
+ lit-page-host {
57
+ flex: 1;
58
+ margin: auto;
59
+ width: 100%;
60
+ max-width: var(--lit-application-page-host-max-width, 2560px);
61
+ }
62
+
63
+ lit-page-host > * {
64
+ padding: max(min(1rem, 1vw), min(1rem, 1vh));
65
+ }
64
66
  `;
65
67
  }
66
68
  createRenderRoot() {
@@ -83,21 +85,21 @@ export class Application extends NonInertableComponent {
83
85
  return [this.pageHeading, manifest?.short_name].filter(Boolean).join(' | ');
84
86
  }
85
87
  get template() {
86
- return html `
87
- ${this.bodyTemplate}
88
+ return html `
89
+ ${this.bodyTemplate}
88
90
  `;
89
91
  }
90
92
  get bodyTemplate() {
91
- return html `
92
- ${this.pageHostTemplate}
93
- ${this.topLayerTemplate}
93
+ return html `
94
+ ${this.pageHostTemplate}
95
+ ${this.topLayerTemplate}
94
96
  `;
95
97
  }
96
98
  get pageHostTemplate() {
97
- return html `
98
- <lit-page-host @pageHeadingChange=${(e) => this.pageHeading = e.detail}>
99
- ${!this.shallRenderRouter ? this.pageLoadingTemplate : this.router.outlet()}
100
- </lit-page-host>
99
+ return html `
100
+ <lit-page-host @pageHeadingChange=${(e) => this.pageHeading = e.detail}>
101
+ ${!this.shallRenderRouter ? this.pageLoadingTemplate : this.router.outlet()}
102
+ </lit-page-host>
101
103
  `;
102
104
  }
103
105
  get pageLoadingTemplate() {
@@ -107,8 +109,6 @@ export class Application extends NonInertableComponent {
107
109
  return html `<lit-application-top-layer></lit-application-top-layer>`;
108
110
  }
109
111
  }
110
- Application.connectingHooks = new HookSet();
111
- Application.beforeRouteHooks = new HookSet();
112
112
  __decorate([
113
113
  property({ updated() { document.title = this.documentTitle; } })
114
114
  ], Application.prototype, "pageHeading", void 0);
@@ -1,7 +1,8 @@
1
1
  var ApplicationTopLayer_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { Component, component, css, html, queryConnectedInstances } from '@a11d/lit';
4
- let ApplicationTopLayer = ApplicationTopLayer_1 = class ApplicationTopLayer extends Component {
4
+ let ApplicationTopLayer = class ApplicationTopLayer extends Component {
5
+ static { ApplicationTopLayer_1 = this; }
5
6
  static get instance() {
6
7
  const instances = [...ApplicationTopLayer_1.instances];
7
8
  return instances[instances.length - 1] ?? document.body;
@@ -10,15 +11,15 @@ let ApplicationTopLayer = ApplicationTopLayer_1 = class ApplicationTopLayer exte
10
11
  return html `<slot></slot>`;
11
12
  }
12
13
  static get styles() {
13
- return css `
14
- :host {
15
- position: fixed !important;
16
- width: 0px !important;
17
- height: 0px !important;
18
- margin: 0px !important;
19
- padding: 0px !important;
20
- z-index: 9999 !important;
21
- }
14
+ return css `
15
+ :host {
16
+ position: fixed !important;
17
+ width: 0px !important;
18
+ height: 0px !important;
19
+ margin: 0px !important;
20
+ padding: 0px !important;
21
+ z-index: 9999 !important;
22
+ }
22
23
  `;
23
24
  }
24
25
  disconnectedCallback() {
@@ -43,7 +43,7 @@ export declare abstract class DialogComponent<T extends DialogParameters = void,
43
43
  private get open();
44
44
  private set open(value);
45
45
  get poppable(): boolean;
46
- protected firstUpdated(props: PropertyValues<this>): void;
46
+ protected firstUpdated(props: PropertyValues): void;
47
47
  protected primaryAction(): DialogAction<TResult>;
48
48
  protected secondaryAction(): DialogAction<TResult>;
49
49
  protected cancellationAction(): DialogAction<TResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"DialogComponent.d.ts","sourceRoot":"","sources":["../../Dialog/DialogComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAe,OAAO,EAA0B,iBAAiB,EAAqC,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACpJ,OAAO,EAAE,KAAK,MAAM,EAAE,eAAe,EAAwB,MAAM,YAAY,CAAA;AAE/E,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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new Map(); }
47
49
  static dialogElement() {
48
50
  return (constructor) => {
49
51
  constructor[dialogElementConstructorSymbol] = true;
@@ -57,6 +59,7 @@ export class DialogComponent extends RoutableComponent {
57
59
  }
58
60
  };
59
61
  }
62
+ static { this.poppableConfirmationStrategy = new LocalStorage('DialogComponent.PoppableConfirmationStrategy', DialogConfirmationStrategy.Dialog); }
60
63
  static getHost() {
61
64
  return Promise.resolve(Application.topLayer);
62
65
  }
@@ -99,9 +102,9 @@ export class DialogComponent extends RoutableComponent {
99
102
  return this.confirm(strategy);
100
103
  }
101
104
  confirm(strategy) {
102
- strategy ?? (strategy = !this.poppable
105
+ strategy ??= !this.poppable
103
106
  ? DialogConfirmationStrategy.Dialog
104
- : DialogComponent.poppableConfirmationStrategy.value);
107
+ : DialogComponent.poppableConfirmationStrategy.value;
105
108
  return strategy === DialogConfirmationStrategy.Dialog
106
109
  ? this.confirmAsDialog()
107
110
  : this.confirmAsPopup(strategy);
@@ -175,12 +178,11 @@ export class DialogComponent extends RoutableComponent {
175
178
  return !!this.route && !this.urlMatches();
176
179
  }
177
180
  firstUpdated(props) {
178
- var _a;
179
181
  this.dialogElement.handleAction = this.handleAction;
180
182
  this.dialogElement.requestPopup?.subscribe(() => this.pop());
181
183
  this.dialogElement.poppable = this.poppable;
182
184
  this.dialogElement.boundToWindow = this.boundToWindow;
183
- (_a = this.dialogElement).heading || (_a.heading = label.get(this.constructor)?.toString());
185
+ this.dialogElement.heading ||= label.get(this.constructor)?.toString();
184
186
  this.open = true;
185
187
  super.firstUpdated(props);
186
188
  }
@@ -210,9 +212,6 @@ export class DialogComponent extends RoutableComponent {
210
212
  this.dialogElement.errorHandler(error);
211
213
  }
212
214
  }
213
- DialogComponent.connectingHooks = new HookSet();
214
- DialogComponent.errorHandlers = new Map();
215
- DialogComponent.poppableConfirmationStrategy = new LocalStorage('DialogComponent.PoppableConfirmationStrategy', DialogConfirmationStrategy.Dialog);
216
215
  __decorate([
217
216
  querySymbolizedElement(dialogElementConstructorSymbol)
218
217
  ], DialogComponent.prototype, "dialogElement", void 0);
@@ -15,6 +15,12 @@ function normalizeNonTypedNotificationParameters(...parameters) {
15
15
  };
16
16
  }
17
17
  export class NotificationComponent extends NonInertableComponent {
18
+ static { this.shownNotifications = new Set(); }
19
+ static { this.defaultComponent = () => {
20
+ return (Constructor) => {
21
+ NotificationComponent.DefaultComponentConstructor = Constructor;
22
+ };
23
+ }; }
18
24
  static notifyInfo(...parameters) {
19
25
  return this.notify({ type: NotificationType.Info, ...normalizeNonTypedNotificationParameters(...parameters) });
20
26
  }
@@ -64,9 +70,3 @@ export class NotificationComponent extends NonInertableComponent {
64
70
  NotificationComponent.shownNotifications.add(notification);
65
71
  }
66
72
  }
67
- NotificationComponent.shownNotifications = new Set();
68
- NotificationComponent.defaultComponent = () => {
69
- return (Constructor) => {
70
- NotificationComponent.DefaultComponentConstructor = Constructor;
71
- };
72
- };
@@ -9,6 +9,6 @@ export declare abstract class PageComponent<T extends PageParameters = void> ext
9
9
  navigate(...args: Parameters<RoutableComponent['navigate']>): Promise<void>;
10
10
  readonly pageElement: Page & HTMLElement;
11
11
  connectedCallback(): Promise<void>;
12
- protected firstUpdated(props: PropertyValues<this>): void;
12
+ protected firstUpdated(props: PropertyValues): void;
13
13
  }
14
14
  //# sourceMappingURL=PageComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageComponent.d.ts","sourceRoot":"","sources":["../../Page/PageComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EAA0B,iBAAiB,EAAE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACzG,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAI/C,8BAAsB,aAAa,CAAC,CAAC,SAAS,cAAc,GAAG,IAAI,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAChG,MAAM,CAAC,QAAQ,CAAC,eAAe,8BAAoC;IAEnE,MAAM,CAAC,qBAAqB,2CAAoB;IAEhD,MAAM,CAAC,WAAW,KACT,aAAa,WAAW,CAAC,IAAI,CAAC;IAKxB,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAIpB,QAAQ,CAAC,WAAW,EAAG,IAAI,GAAG,WAAW,CAAA;IAEhF,iBAAiB;cAKb,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC;CAI3D"}
1
+ {"version":3,"file":"PageComponent.d.ts","sourceRoot":"","sources":["../../Page/PageComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EAA0B,iBAAiB,EAAE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACzG,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAI/C,8BAAsB,aAAa,CAAC,CAAC,SAAS,cAAc,GAAG,IAAI,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAChG,MAAM,CAAC,QAAQ,CAAC,eAAe,8BAAoC;IAEnE,MAAM,CAAC,qBAAqB,2CAAoB;IAEhD,MAAM,CAAC,WAAW,KACT,aAAa,WAAW,CAAC,IAAI,CAAC;IAKxB,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAIpB,QAAQ,CAAC,WAAW,EAAG,IAAI,GAAG,WAAW,CAAA;IAEhF,iBAAiB;cAKb,YAAY,CAAC,KAAK,EAAE,cAAc;CAIrD"}
@@ -4,6 +4,8 @@ import { label } from '@a11d/metadata';
4
4
  import { querySymbolizedElement, RoutableComponent, HookSet } from '../index.js';
5
5
  const pageElementConstructorSymbol = Symbol('PageComponent.PageElementConstructor');
6
6
  export class PageComponent extends RoutableComponent {
7
+ static { this.connectingHooks = new HookSet(); }
8
+ static { this.defaultPageElementTag = literal `lit-page`; }
7
9
  static pageElement() {
8
10
  return (constructor) => {
9
11
  constructor[pageElementConstructorSymbol] = true;
@@ -17,13 +19,10 @@ export class PageComponent extends RoutableComponent {
17
19
  super.connectedCallback();
18
20
  }
19
21
  firstUpdated(props) {
20
- var _a;
21
- (_a = this.pageElement).heading || (_a.heading = label.get(this.constructor)?.toString());
22
+ this.pageElement.heading ||= label.get(this.constructor)?.toString();
22
23
  super.firstUpdated(props);
23
24
  }
24
25
  }
25
- PageComponent.connectingHooks = new HookSet();
26
- PageComponent.defaultPageElementTag = literal `lit-page`;
27
26
  __decorate([
28
27
  querySymbolizedElement(pageElementConstructorSymbol)
29
28
  ], PageComponent.prototype, "pageElement", void 0);
@@ -4,64 +4,65 @@ import { component, css, html, staticHtml, style } from '@a11d/lit';
4
4
  import { HttpError, HttpErrorCode } from '../index.js';
5
5
  import { route } from '../Router/route.js';
6
6
  import { PageComponent } from './PageComponent.js';
7
- let PageError = PageError_1 = class PageError extends PageComponent {
7
+ let PageError = class PageError extends PageComponent {
8
+ static { PageError_1 = this; }
9
+ static { this.emojisByErrorCodes = new Map([
10
+ [HttpErrorCode.BadRequest, '😟'],
11
+ [HttpErrorCode.Unauthorized, '⛔'],
12
+ [HttpErrorCode.PaymentRequired, 'ðŸĪ‘'],
13
+ [HttpErrorCode.NotFound, '🧐'],
14
+ [HttpErrorCode.Forbidden, '🔒'],
15
+ [HttpErrorCode.MethodNotAllowed, 'ðŸšŦ'],
16
+ [HttpErrorCode.NotAcceptable, 'ðŸ˜ĩ'],
17
+ [HttpErrorCode.ProxyAuthenticationRequired, 'ðŸĪ'],
18
+ [HttpErrorCode.RequestTimeout, 'âē'],
19
+ [HttpErrorCode.Conflict, 'ðŸ˜ĩ'],
20
+ [HttpErrorCode.InternalServerError, 'ðŸ˜Ĩ'],
21
+ [HttpErrorCode.NotImplemented, 'ðŸ˜ģ'],
22
+ [HttpErrorCode.BadGateway, 'ðŸĨī'],
23
+ [HttpErrorCode.ServiceUnavailable, 'ðŸ˜ī'],
24
+ [HttpErrorCode.GatewayTimeout, '⌚'],
25
+ [HttpErrorCode.HttpVersionNotSupported, '🙄'],
26
+ [HttpErrorCode.VariantAlsoNegotiates, 'ðŸĪŠ'],
27
+ [HttpErrorCode.InsufficientStorage, 'ðŸ’ū'],
28
+ [HttpErrorCode.LoopDetected, '➰'],
29
+ ]); }
8
30
  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
- }
31
+ return css `
32
+ .code {
33
+ font-size: 60px;
34
+ font-weight: 400;
35
+ text-align: center;
36
+ }
37
+
38
+ h1, h2 {
39
+ text-align: center;
40
+ margin: 0;
41
+ }
20
42
  `;
21
43
  }
22
44
  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}>
45
+ return staticHtml `
46
+ <${PageComponent.defaultPageElementTag} heading=${`Error ${this.parameters.error}`} fullHeight>
47
+ <div ${style({ display: 'flex', gap: '8px', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' })}>
48
+ <div class='code'>${this.errorTemplate}</div>
49
+ <div ${style({ display: 'flex', gap: '4px', flexDirection: 'column' })}>
50
+ <h1>${this.parameters.message ?? HttpError.defaultMessageByErrorCode.get(this.parameters.error) ?? 'Unknown Error'}</h1>
51
+ </div>
52
+ </div>
53
+ </${PageComponent.defaultPageElementTag}>
32
54
  `;
33
55
  }
34
56
  get errorTemplate() {
35
57
  const errorCode = String(this.parameters.error);
36
58
  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>
59
+ return !emoji ? html `
60
+ <span>${errorCode}</span>
61
+ ` : html `
62
+ <span>${errorCode.charAt(0)}</span>${emoji}<span>${errorCode.charAt(2)}</span>
41
63
  `;
42
64
  }
43
65
  };
44
- PageError.emojisByErrorCodes = new Map([
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
- ]);
65
66
  PageError = PageError_1 = __decorate([
66
67
  component('lit-page-error'),
67
68
  route('/error/:error')
@@ -2,12 +2,12 @@ import { __decorate } from "tslib";
2
2
  import { Component, component, css, html } from '@a11d/lit';
3
3
  let PageHost = class PageHost extends Component {
4
4
  static get styles() {
5
- return css `
6
- :host {
7
- display: grid;
8
- grid-template-rows: 1fr;
9
- width: 100%;
10
- }
5
+ return css `
6
+ :host {
7
+ display: grid;
8
+ grid-template-rows: 1fr;
9
+ width: 100%;
10
+ }
11
11
  `;
12
12
  }
13
13
  get template() {
@@ -1,5 +1,10 @@
1
- var _a;
2
1
  export class PwaHelper {
2
+ static {
3
+ window?.addEventListener('beforeinstallprompt', e => {
4
+ this.pwaPrompt = e;
5
+ e.preventDefault();
6
+ });
7
+ }
3
8
  static get serviceWorkerContainer() {
4
9
  return navigator.serviceWorker;
5
10
  }
@@ -31,10 +36,3 @@ export class PwaHelper {
31
36
  }
32
37
  }
33
38
  }
34
- _a = PwaHelper;
35
- (() => {
36
- window?.addEventListener('beforeinstallprompt', e => {
37
- _a.pwaPrompt = e;
38
- e.preventDefault();
39
- });
40
- })();
@@ -11,6 +11,10 @@ export var NavigationStrategy;
11
11
  NavigationStrategy[NavigationStrategy["Window"] = 2] = "Window";
12
12
  })(NavigationStrategy || (NavigationStrategy = {}));
13
13
  export class RoutableComponent extends Component {
14
+ static { this.basePath = ''; }
15
+ static { this.container = new Set(); }
16
+ static { this.host = Application; }
17
+ static { this._routes = new Array(); }
14
18
  static get routes() { return this._routes.map(route => RoutableComponent.basePath + route); }
15
19
  static set routes(value) { this._routes = value; }
16
20
  static render(p) {
@@ -57,7 +61,7 @@ export class RoutableComponent extends Component {
57
61
  if (!force && this.urlMatches()) {
58
62
  return;
59
63
  }
60
- strategy ?? (strategy = NavigationStrategy.Page);
64
+ strategy ??= NavigationStrategy.Page;
61
65
  if (strategy !== NavigationStrategy.Page) {
62
66
  await WindowHelper.openAndFocus(this.url, strategy === NavigationStrategy.Window ? WindowOpenMode.Window : WindowOpenMode.Tab);
63
67
  return;
@@ -86,8 +90,8 @@ export class RoutableComponent extends Component {
86
90
  * @param mode The matching mode. 'all' matches the path and parameters, 'ignore-parameters' matches only the path. Defaults to 'all'.
87
91
  */
88
92
  urlMatches(options) {
89
- options ?? (options = {});
90
- options.url ?? (options.url = RoutableComponent.url);
93
+ options ??= {};
94
+ options.url ??= RoutableComponent.url;
91
95
  const route = this.route;
92
96
  const m = route === undefined ? false : match(route)(options.url.pathname);
93
97
  if (m === false) {
@@ -111,10 +115,6 @@ export class RoutableComponent extends Component {
111
115
  return new this.constructor(parameters).navigate(NavigationStrategy.Page, true);
112
116
  }
113
117
  }
114
- RoutableComponent.basePath = '';
115
- RoutableComponent.container = new Set();
116
- RoutableComponent.host = Application;
117
- RoutableComponent._routes = new Array();
118
118
  __decorate([
119
119
  state({
120
120
  updated() {