@vandeurenglenn/lite-elements 0.3.40 → 0.3.42

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 (114) hide show
  1. package/exports/bar/top-app-bar.d.ts +1 -1
  2. package/exports/bundle/banner.js +1 -1
  3. package/exports/bundle/button.js +1 -1
  4. package/exports/bundle/card.js +1 -1
  5. package/exports/bundle/code.js +1 -1
  6. package/exports/bundle/{column-CNOGwAhj.js → column-B0bUzxkF.js} +1 -1
  7. package/exports/bundle/custom-element-CAdbJRVg.js +1 -0
  8. package/exports/bundle/demo-elements.js +1 -1
  9. package/exports/bundle/demo-icons.js +3 -3
  10. package/exports/bundle/demo-shell.js +1 -1
  11. package/exports/bundle/demo.js +1 -1
  12. package/exports/bundle/dialog.js +1 -1
  13. package/exports/bundle/divider.js +1 -1
  14. package/exports/bundle/drawer-button.js +1 -1
  15. package/exports/bundle/drawer-item.js +1 -1
  16. package/exports/bundle/drawer-layout.js +1 -1
  17. package/exports/bundle/drawer.js +46 -47
  18. package/exports/bundle/dropdown-menu.js +1 -1
  19. package/exports/bundle/dropdown.js +1 -1
  20. package/exports/bundle/elements.js +1 -1
  21. package/exports/bundle/elevation.js +1 -1
  22. package/exports/bundle/fab.js +2 -2
  23. package/exports/bundle/hash-router.js +1 -0
  24. package/exports/bundle/icon-button.js +1 -1
  25. package/exports/bundle/icon-set.js +1 -1
  26. package/exports/bundle/icon.js +1 -1
  27. package/exports/bundle/input.js +1 -1
  28. package/exports/bundle/list-item.js +1 -1
  29. package/exports/bundle/menu.js +1 -1
  30. package/exports/bundle/minute-field.js +1 -1
  31. package/exports/bundle/notification.js +1 -1
  32. package/exports/bundle/notifications.js +1 -1
  33. package/exports/bundle/pages.js +1 -1
  34. package/exports/bundle/pane.js +69 -66
  35. package/exports/bundle/property-BYA8Sw2t.js +11 -0
  36. package/exports/bundle/property-C4lhirVQ.js +23 -0
  37. package/exports/bundle/query-DCTzLeFk.js +1 -0
  38. package/exports/bundle/rail.js +1 -1
  39. package/exports/bundle/root.js +1 -1
  40. package/exports/bundle/row-DYDgQVDj.js +28 -0
  41. package/exports/bundle/section.js +1 -1
  42. package/exports/bundle/section2.js +1 -1
  43. package/exports/bundle/select-mixin.js +1 -1
  44. package/exports/bundle/selector-mixin.js +1 -1
  45. package/exports/bundle/selector.js +1 -1
  46. package/exports/bundle/simple-hash-router.js +1 -0
  47. package/exports/bundle/summary-mirror.js +1 -1
  48. package/exports/bundle/summary.js +1 -1
  49. package/exports/bundle/supporting-pane.js +1 -1
  50. package/exports/bundle/tab.js +1 -1
  51. package/exports/bundle/tabs.js +1 -1
  52. package/exports/bundle/text-field.js +1 -1
  53. package/exports/bundle/theme.js +1 -1
  54. package/exports/bundle/time-picker.js +1 -1
  55. package/exports/bundle/toggle-button.js +1 -1
  56. package/exports/bundle/toggle.js +1 -1
  57. package/exports/bundle/top-app-bar.js +4 -4
  58. package/exports/bundle/types2.js +1 -0
  59. package/exports/bundle/typography.js +1 -1
  60. package/exports/bundle/upload-file.js +1 -1
  61. package/exports/bundle/upload-image.js +91 -88
  62. package/exports/button/button.d.ts +1 -1
  63. package/exports/button/icon-button.d.ts +1 -1
  64. package/exports/demo/code.d.ts +1 -1
  65. package/exports/demo/demo-icons.d.ts +1 -1
  66. package/exports/demo/demo-shell.d.ts +1 -1
  67. package/exports/demo/demo.d.ts +1 -1
  68. package/exports/demo/section.d.ts +1 -1
  69. package/exports/demo-shell.js +2 -0
  70. package/exports/dialog/dialog.d.ts +1 -1
  71. package/exports/drawer/drawer-button.d.ts +1 -1
  72. package/exports/drawer/drawer-item.d.ts +1 -1
  73. package/exports/drawer/drawer.d.ts +1 -0
  74. package/exports/drawer-layout.js +2 -0
  75. package/exports/drawer.js +9 -54
  76. package/exports/dropdown/dropdown-menu.d.ts +1 -1
  77. package/exports/dropdown/dropdown.d.ts +1 -1
  78. package/exports/elements.js +2 -0
  79. package/exports/fab/fab.d.ts +1 -1
  80. package/exports/hash-router.js +97 -0
  81. package/exports/icon/icon-set.d.ts +1 -1
  82. package/exports/icon/icon.d.ts +1 -1
  83. package/exports/list/list-item.d.ts +1 -1
  84. package/exports/menu/menu.d.ts +1 -1
  85. package/exports/mixins/file-reader-mixin.d.ts +1 -1
  86. package/exports/notification/notifications.d.ts +1 -1
  87. package/exports/notifications.js +1 -0
  88. package/exports/pages/pages.d.ts +1 -1
  89. package/exports/pane/pane.d.ts +1 -0
  90. package/exports/pane.js +8 -80
  91. package/exports/rail.js +1 -0
  92. package/exports/root/root.d.ts +1 -1
  93. package/exports/router/hash-router.d.ts +18 -0
  94. package/exports/router/types.d.ts +45 -0
  95. package/exports/section/section.d.ts +1 -1
  96. package/exports/selector/selector.d.ts +1 -1
  97. package/exports/simple-hash-router.js +111 -0
  98. package/exports/summary/summary.d.ts +1 -1
  99. package/exports/supporting-pane.js +1 -0
  100. package/exports/text-field/text-field.d.ts +1 -1
  101. package/exports/time-picker/input.d.ts +1 -1
  102. package/exports/time-picker/minute-field.d.ts +1 -1
  103. package/exports/time-picker/time-picker.d.ts +1 -1
  104. package/exports/toggle/toggle.d.ts +1 -1
  105. package/exports/types2.js +1 -0
  106. package/exports/typography/typography.d.ts +1 -1
  107. package/exports/upload/upload-file.d.ts +1 -1
  108. package/exports/upload/upload-image.d.ts +2 -2
  109. package/package.json +527 -517
  110. package/exports/bundle/custom-element-BOdKJYdz.js +0 -1
  111. package/exports/bundle/property-BhmaXNYq.js +0 -39
  112. package/exports/bundle/property-D-Y1CFIF.js +0 -11
  113. package/exports/bundle/query-D-PG8Oyh.js +0 -1
  114. package/exports/bundle/row-BHK6Zell.js +0 -28
@@ -1,5 +1,5 @@
1
1
  import { SelectorBase } from '../mixins/selector-mixin.js';
2
2
  export declare class CustomSelector extends SelectorBase {
3
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
3
+ static styles: import("lit").CSSResult[];
4
4
  render(): import("lit-html").TemplateResult<1>;
5
5
  }
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @description
3
+ * A hash based router meant to work together with custom-pages, custom-select etc
4
+ *
5
+ * @example
6
+ * new HashRouter({
7
+ * host: document.querySelector('app-shell'),
8
+ * fallback: {route: 'home' params: {...}},
9
+ * routes: [{
10
+ * 'home': {
11
+ * import: 'views/home.js'
12
+ * }
13
+ * }]
14
+ * })
15
+ *
16
+ */
17
+ class SimpleHashRouter {
18
+ routes;
19
+ constructor({ host, fallback, routes }) {
20
+ this.host = host;
21
+ this.routes = routes;
22
+ globalThis.onhashchange = this.#onhashchange;
23
+ if (!location.hash && fallback?.route) {
24
+ location.hash = HashRouter.bang(fallback.params ? `${fallback.route}?${HashRouter.queryIt(fallback.params)}` : fallback.route);
25
+ }
26
+ else
27
+ this.#onhashchange();
28
+ }
29
+ static queryIt(params) {
30
+ return Object.entries(params)
31
+ .map(([key, value]) => `${key}=${value}`)
32
+ .join('&');
33
+ }
34
+ static dequeryIt(query) {
35
+ const params = {};
36
+ if (!query)
37
+ return params;
38
+ for (const item of query.split('&')) {
39
+ const [key, value] = item.split('=');
40
+ params[key] = value;
41
+ }
42
+ return;
43
+ }
44
+ static bang(route) {
45
+ return `#!/${route}`;
46
+ }
47
+ static debang(route) {
48
+ return route.split('#!/')[1];
49
+ }
50
+ static parseHash(hash) {
51
+ const afterBang = HashRouter.debang(hash);
52
+ const splitted = afterBang.split('?');
53
+ const routes = splitted[0].split('/');
54
+ const route = routes[0];
55
+ const subRoutes = routes.slice(1, -1);
56
+ const params = HashRouter.dequeryIt(splitted[1]);
57
+ return { route, routes, subRoutes, params, url: splitted[0] };
58
+ }
59
+ #handleSubRoutes = async (routing, routeInfo) => {
60
+ const { params, subRoutes } = routing;
61
+ let selected = this.host.pages.querySelector('.custom-selected');
62
+ if (routing.subRoutes?.length > 0) {
63
+ for (const route of routing.subRoutes) {
64
+ const subRouteInfo = routeInfo.subRoutes[route];
65
+ if (subRouteInfo) {
66
+ if (!customElements.get(`./${subRouteInfo.tagName}`))
67
+ await import(`./${subRouteInfo.import}.js`);
68
+ }
69
+ else {
70
+ if (!customElements.get(`./${route}`))
71
+ await import(`./${route}.js`);
72
+ console.warn(`handling undefined subroute for ${routing.route} falling back to default behavior.`);
73
+ }
74
+ selected.select({ route, params, subRoutes });
75
+ selected = selected.pages.querySelector('.custom-selected');
76
+ }
77
+ }
78
+ if (params) {
79
+ for (const [key, value] of Object.entries(params)) {
80
+ selected[key] = value;
81
+ }
82
+ }
83
+ };
84
+ #onhashchange = async () => {
85
+ const routing = HashRouter.parseHash(location.hash);
86
+ const routeInfo = this.routes[routing.url];
87
+ // todo allow to set loading
88
+ if (routeInfo) {
89
+ if (!customElements.get(`./${routeInfo.tagName}`))
90
+ await import(`./${routeInfo.import}.js`);
91
+ }
92
+ else {
93
+ if (!customElements.get(`./${routing.route}`))
94
+ await import(`./${routing.route}.js`);
95
+ }
96
+ this.host.select(routing);
97
+ // when a custom-pages element (or sortlike) is defined loop trough subroutes and make devlife easier
98
+ if (this.host.pages) {
99
+ this.#handleSubRoutes(routing, routeInfo);
100
+ }
101
+ document.dispatchEvent(new CustomEvent('route-change', {
102
+ detail: {
103
+ routing,
104
+ routeInfo
105
+ }
106
+ }));
107
+ };
108
+ go(route, params) { }
109
+ }
110
+
111
+ export { SimpleHashRouter as default };
@@ -1,5 +1,5 @@
1
1
  import { LiteElement } from '@vandeurenglenn/lite';
2
2
  export declare class CustomSummary extends LiteElement {
3
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
3
+ static styles: import("lit").CSSResult[];
4
4
  render(): import("lit-html").TemplateResult<1>;
5
5
  }
@@ -6,6 +6,7 @@ import './icon-button.js';
6
6
  import './button.js';
7
7
  import './icon.js';
8
8
  import '@vandeurenglenn/little-pubsub';
9
+ import '@vandeurenglenn/custom-shared-styles/pane.css';
9
10
 
10
11
  let CustomSupportingPane = (() => {
11
12
  let _classDecorators = [customElement('custom-supporting-pane')];
@@ -6,6 +6,6 @@ export declare class TextField extends LiteElement {
6
6
  accessor hasLeadingIcon: any;
7
7
  accessor hasTrailingIcon: any;
8
8
  connectedCallback(): void;
9
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
9
+ static styles: import("lit").CSSResult[];
10
10
  render(): import("lit-html").TemplateResult<1>;
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import { LiteElement } from '@vandeurenglenn/lite';
2
2
  export declare class TimePickerInput extends LiteElement {
3
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
3
+ static styles: import("lit").CSSResult[];
4
4
  render(): import("lit-html").TemplateResult<1>;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { LiteElement } from '@vandeurenglenn/lite';
2
2
  export declare class TimePickerMinuteField extends LiteElement {
3
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
3
+ static styles: import("lit").CSSResult[];
4
4
  render(): import("lit-html").TemplateResult<1>;
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { LiteElement } from '@vandeurenglenn/lite';
2
2
  import './input.js';
3
3
  export declare class CustomTimePicker extends LiteElement {
4
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
4
+ static styles: import("lit").CSSResult[];
5
5
  render(): import("lit-html").TemplateResult<1>;
6
6
  }
@@ -7,6 +7,6 @@ export declare class CustomToggle extends LiteElement {
7
7
  onChange(propertyKey: any, value: any): void;
8
8
  next(): Promise<void>;
9
9
  previous(): void;
10
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
10
+ static styles: import("lit").CSSResult[];
11
11
  render(): import("lit-html").TemplateResult<1>;
12
12
  }
@@ -0,0 +1 @@
1
+
@@ -2,6 +2,6 @@ import { LiteElement } from '@vandeurenglenn/lite';
2
2
  export declare class CustomTypography extends LiteElement {
3
3
  accessor type: 'label' | 'title' | 'headline' | 'display' | 'body';
4
4
  accessor size: 'small' | 'medium' | 'large';
5
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
5
+ static styles: import("lit").CSSResult[];
6
6
  render(): import("lit-html").TemplateResult<1>;
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { LiteElement } from '@vandeurenglenn/lite';
2
2
  export declare class CustomUploadFile extends LiteElement {
3
3
  accessor multiple: any;
4
- static get styles(): import("@lit/reactive-element/css-tag.js").CSSResult[];
4
+ static get styles(): import("lit").CSSResult[];
5
5
  render(): import("lit-html").TemplateResult<1>;
6
6
  }
@@ -357,7 +357,7 @@ declare const CustomUploadImage_base: {
357
357
  focus(options?: FocusOptions): void;
358
358
  };
359
359
  readonly observedAttributes: any;
360
- styles?: import("@vandeurenglenn/lite/element").StyleList;
360
+ styles?: import("lit").CSSResultGroup;
361
361
  };
362
362
  export declare class CustomUploadImage extends CustomUploadImage_base {
363
363
  #private;
@@ -369,7 +369,7 @@ export declare class CustomUploadImage extends CustomUploadImage_base {
369
369
  accessor frontCameraDisabled: boolean;
370
370
  accessor rearCameraDisabled: boolean;
371
371
  accessor hasLibrary: boolean;
372
- static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
372
+ static styles: import("lit").CSSResult[];
373
373
  onChange(propertyKey: any, value: any): void;
374
374
  select(value: any): void;
375
375
  show(): void;