@vandeurenglenn/lite-elements 0.3.50 → 0.3.52

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 (82) hide show
  1. package/exports/banner.js +36 -36
  2. package/exports/bundle/button.js +6 -1
  3. package/exports/bundle/dialog.js +10 -8
  4. package/exports/bundle/index.html +590 -590
  5. package/exports/bundle/themes/default/colors.module.css +180 -180
  6. package/exports/bundle/themes/default/missing/motion.css +3 -3
  7. package/exports/bundle/themes/default/missing/shape.css +12 -12
  8. package/exports/bundle/themes/default/missing/theme.dark.css +4 -4
  9. package/exports/bundle/themes/default/missing/theme.light.css +4 -4
  10. package/exports/bundle/themes/default/missing/tokens.css +8 -8
  11. package/exports/bundle/themes/default/theme.css +10 -10
  12. package/exports/bundle/themes/default/theme.dark.css +33 -33
  13. package/exports/bundle/themes/default/theme.light.css +33 -33
  14. package/exports/bundle/themes/default/tokens.css +256 -256
  15. package/exports/bundle/themes/default/typography.module.css +150 -150
  16. package/exports/bundle/upload-image.js +49 -45
  17. package/exports/button.js +148 -143
  18. package/exports/card.js +139 -139
  19. package/exports/code.js +34 -34
  20. package/exports/demo-icons.js +15 -15
  21. package/exports/demo-shell.js +539 -539
  22. package/exports/demo.js +456 -456
  23. package/exports/dialog.js +150 -148
  24. package/exports/divider.js +21 -21
  25. package/exports/drawer-button.js +13 -13
  26. package/exports/drawer-item.js +38 -38
  27. package/exports/drawer-layout.js +95 -95
  28. package/exports/drawer.js +7 -7
  29. package/exports/dropdown-menu.js +58 -58
  30. package/exports/dropdown.js +25 -25
  31. package/exports/elevation.js +50 -50
  32. package/exports/fab.js +145 -145
  33. package/exports/icon-button.js +12 -12
  34. package/exports/icon-set.js +4 -4
  35. package/exports/icon.js +15 -15
  36. package/exports/input.js +5 -5
  37. package/exports/list-item.js +42 -42
  38. package/exports/menu.js +12 -12
  39. package/exports/minute-field.js +4 -4
  40. package/exports/mixins/scroll-mixin.d.ts +1 -1
  41. package/exports/notification.js +34 -34
  42. package/exports/notifications.js +65 -65
  43. package/exports/pages.js +42 -42
  44. package/exports/pane.js +18 -18
  45. package/exports/rail.js +57 -57
  46. package/exports/root.js +7 -7
  47. package/exports/section/section.d.ts +1 -1
  48. package/exports/section.js +10 -10
  49. package/exports/section2.js +24 -24
  50. package/exports/selector.js +30 -30
  51. package/exports/summary-mirror.js +19 -19
  52. package/exports/summary.js +24 -24
  53. package/exports/supporting-pane.js +46 -46
  54. package/exports/tab.js +21 -21
  55. package/exports/tabs.js +50 -50
  56. package/exports/text-field.js +9 -9
  57. package/exports/theme.js +8 -8
  58. package/exports/themes/default/colors.module.css +180 -180
  59. package/exports/themes/default/missing/motion.css +3 -3
  60. package/exports/themes/default/missing/shape.css +12 -12
  61. package/exports/themes/default/missing/theme.dark.css +4 -4
  62. package/exports/themes/default/missing/theme.light.css +4 -4
  63. package/exports/themes/default/missing/tokens.css +8 -8
  64. package/exports/themes/default/theme.css +10 -10
  65. package/exports/themes/default/theme.dark.css +33 -33
  66. package/exports/themes/default/theme.light.css +33 -33
  67. package/exports/themes/default/tokens.css +256 -256
  68. package/exports/themes/default/typography.module.css +150 -150
  69. package/exports/time-picker.js +20 -20
  70. package/exports/toggle-button.js +3 -3
  71. package/exports/toggle.js +4 -4
  72. package/exports/top-app-bar.js +20 -20
  73. package/exports/typography.js +155 -155
  74. package/exports/upload-file.js +8 -8
  75. package/exports/upload-image.js +200 -200
  76. package/package.json +20 -28
  77. package/exports/bundle/simple-hash-router.js +0 -1
  78. package/exports/bundle/types2.js +0 -1
  79. package/exports/router/simple-hash-router.d.ts +0 -34
  80. package/exports/router/types.d.ts +0 -45
  81. package/exports/simple-hash-router.js +0 -111
  82. package/exports/types2.js +0 -1
@@ -89,99 +89,99 @@ let CustomUploadImage = (() => {
89
89
  get hasLibrary() { return this.#hasLibrary_accessor_storage; }
90
90
  set hasLibrary(value) { this.#hasLibrary_accessor_storage = value; }
91
91
  static styles = [
92
- css `
93
- :host {
94
- display: block;
95
- }
96
-
97
- h5 {
98
- margin: 0;
99
- }
100
-
101
- custom-tab.custom-selected {
102
- background: var(--md-sys-color-tertiary);
103
- --custom-icon-color: var(--md-sys-color-on-tertiary);
104
- border: none;
105
- }
106
-
107
- custom-tab.custom-selected span,
108
- custom-tab.custom-selected custom-icon {
109
- color: var(--md-sys-color-on-tertiary);
110
- --custom-icon-color: var(--md-sys-color-on-tertiary);
111
- }
112
-
113
- custom-tab {
114
- gap: 8px;
115
- height: 40px;
116
- padding: 0 12px;
117
- box-sizing: border-box;
118
- width: auto;
119
- border-radius: 20px;
120
- font: var(--_supporting-text-type);
121
- }
122
-
123
- custom-tabs {
124
- height: 40px;
125
- }
126
-
127
- section {
128
- display: flex;
129
- flex-direction: column;
130
- height: 100%;
131
- width: 100%;
132
- min-height: 168px;
133
- position: absolute;
134
- transform: scale(0);
135
- justify-content: center;
136
- align-items: center;
137
- }
138
-
139
- section[route='camera'] {
140
- overflow-y: hidden;
141
- }
142
-
143
- section.custom-selected {
144
- transform: scale(1);
145
- position: relative;
146
- }
147
- md-outlined-text-field {
148
- padding-top: 12px;
149
- }
150
-
151
- .camera-actions {
152
- width: 100%;
153
- position: absolute;
154
- bottom: 0;
155
- margin-bottom: 3px;
156
- }
157
-
158
- section[route='camera'] flex-container {
159
- height: 320px;
160
- }
161
-
162
- flex-column {
163
- width: auto;
164
- }
165
-
166
- flex-container video,
167
- img:not([data-variant='icon']) {
168
- height: -webkit-fill-available;
169
- width: -webkit-fill-available;
170
- }
171
-
172
- [route='library'] img {
173
- width: 150px;
174
- cursor: pointer;
175
- }
176
-
177
- [data-variant='icon'] {
178
- height: 48px;
179
- width: 48px;
180
- }
181
-
182
- md-dialog {
183
- --_container-color: #2d2f31;
184
- }
92
+ css `
93
+ :host {
94
+ display: block;
95
+ }
96
+
97
+ h5 {
98
+ margin: 0;
99
+ }
100
+
101
+ custom-tab.custom-selected {
102
+ background: var(--md-sys-color-tertiary);
103
+ --custom-icon-color: var(--md-sys-color-on-tertiary);
104
+ border: none;
105
+ }
106
+
107
+ custom-tab.custom-selected span,
108
+ custom-tab.custom-selected custom-icon {
109
+ color: var(--md-sys-color-on-tertiary);
110
+ --custom-icon-color: var(--md-sys-color-on-tertiary);
111
+ }
112
+
113
+ custom-tab {
114
+ gap: 8px;
115
+ height: 40px;
116
+ padding: 0 12px;
117
+ box-sizing: border-box;
118
+ width: auto;
119
+ border-radius: 20px;
120
+ font: var(--_supporting-text-type);
121
+ }
122
+
123
+ custom-tabs {
124
+ height: 40px;
125
+ }
126
+
127
+ section {
128
+ display: flex;
129
+ flex-direction: column;
130
+ height: 100%;
131
+ width: 100%;
132
+ min-height: 168px;
133
+ position: absolute;
134
+ transform: scale(0);
135
+ justify-content: center;
136
+ align-items: center;
137
+ }
138
+
139
+ section[route='camera'] {
140
+ overflow-y: hidden;
141
+ }
142
+
143
+ section.custom-selected {
144
+ transform: scale(1);
145
+ position: relative;
146
+ }
147
+ md-outlined-text-field {
148
+ padding-top: 12px;
149
+ }
150
+
151
+ .camera-actions {
152
+ width: 100%;
153
+ position: absolute;
154
+ bottom: 0;
155
+ margin-bottom: 3px;
156
+ }
157
+
158
+ section[route='camera'] flex-container {
159
+ height: 320px;
160
+ }
161
+
162
+ flex-column {
163
+ width: auto;
164
+ }
165
+
166
+ flex-container video,
167
+ img:not([data-variant='icon']) {
168
+ height: -webkit-fill-available;
169
+ width: -webkit-fill-available;
170
+ }
171
+
172
+ [route='library'] img {
173
+ width: 150px;
174
+ cursor: pointer;
175
+ }
176
+
177
+ [data-variant='icon'] {
178
+ height: 48px;
179
+ width: 48px;
180
+ }
181
+
182
+ md-dialog {
183
+ --_container-color: #2d2f31;
184
+ }
185
185
  `
186
186
  ];
187
187
  get #dialog() {
@@ -214,9 +214,9 @@ let CustomUploadImage = (() => {
214
214
  const item = document.createElement('md-list-item');
215
215
  item.headline = file.name;
216
216
  item.setAttribute('noninteractive', '');
217
- item.innerHTML = `
218
- <img data-variant="icon" slot="start" src="${data}">
219
- <md-standard-icon-button slot="end"><custom-icon>delete</custom-icon></md-standard-icon-button>
217
+ item.innerHTML = `
218
+ <img data-variant="icon" slot="start" src="${data}">
219
+ <md-standard-icon-button slot="end"><custom-icon>delete</custom-icon></md-standard-icon-button>
220
220
  `;
221
221
  item.onclick = () => {
222
222
  this.shadowRoot.querySelector('section[route="file"]').removeChild(item);
@@ -255,103 +255,103 @@ let CustomUploadImage = (() => {
255
255
  this.#dialog.open = true;
256
256
  }
257
257
  #addImageTemplate() {
258
- return html `
259
- <form id="form-content" method="dialog">
260
- <custom-tabs attr-for-selected="route" @selected=${this.#onSelected.bind(this)}>
258
+ return html `
259
+ <form id="form-content" method="dialog">
260
+ <custom-tabs attr-for-selected="route" @selected=${this.#onSelected.bind(this)}>
261
261
  ${this.hasLibrary
262
- ? html `
263
- <custom-tab route="library">
264
- <custom-icon>photo_library</custom-icon>
265
- <span>library</span>
266
- </custom-tab>
262
+ ? html `
263
+ <custom-tab route="library">
264
+ <custom-icon>photo_library</custom-icon>
265
+ <span>library</span>
266
+ </custom-tab>
267
267
  `
268
- : ''}
269
- <custom-tab route="url">
270
- <custom-icon>link</custom-icon>
271
- <span>url</span>
272
- </custom-tab>
273
-
274
- <custom-tab route="camera">
275
- <custom-icon>camera</custom-icon>
276
- <span>camera</span>
277
- </custom-tab>
278
-
279
- <custom-tab route="file">
280
- <custom-icon>upload</custom-icon>
281
- <span>file</span>
282
- </custom-tab>
283
- <flex-it></flex-it>
284
- </custom-tabs>
285
- <custom-pages attr-for-selected="route">
268
+ : ''}
269
+ <custom-tab route="url">
270
+ <custom-icon>link</custom-icon>
271
+ <span>url</span>
272
+ </custom-tab>
273
+
274
+ <custom-tab route="camera">
275
+ <custom-icon>camera</custom-icon>
276
+ <span>camera</span>
277
+ </custom-tab>
278
+
279
+ <custom-tab route="file">
280
+ <custom-icon>upload</custom-icon>
281
+ <span>file</span>
282
+ </custom-tab>
283
+ <flex-it></flex-it>
284
+ </custom-tabs>
285
+ <custom-pages attr-for-selected="route">
286
286
  ${this.hasLibrary
287
- ? html `
288
- <section route="library">
289
- <flex-wrap-around>
290
- ${this.images.map((image) => html `
291
- <img
292
- @click=${(event) => this.#onlibclick.call(this, event, image.firebaseKey)}
293
- src=${`${location.origin}/api/image?image=${image.link.replace('.png', 'b.png')}`}
294
- />
295
- `)}
296
- </flex-wrap-around>
297
- </section>
287
+ ? html `
288
+ <section route="library">
289
+ <flex-wrap-around>
290
+ ${this.images.map((image) => html `
291
+ <img
292
+ @click=${(event) => this.#onlibclick.call(this, event, image.firebaseKey)}
293
+ src=${`${location.origin}/api/image?image=${image.link.replace('.png', 'b.png')}`}
294
+ />
295
+ `)}
296
+ </flex-wrap-around>
297
+ </section>
298
298
  `
299
- : ''}
300
- <section route="url">
301
- <flex-column>
302
- add image using a link/url
303
- <md-outlined-text-field label="url" input-field="url"></md-outlined-text-field>
304
- </flex-column>
305
- </section>
306
-
307
- <section route="camera">
308
- <flex-container>
309
- <video autoplay mute="true" class="camera-preview"></video>
310
- </flex-container>
311
-
312
- <flex-row class="camera-actions">
313
- <flex-it flex="2"></flex-it>
314
-
315
- <md-standard-icon-button
316
- @click=${() => (this.#cameraFacingMode = 'user')}
317
- ?disabled=${this.frontCameraDisabled}
318
- >
319
- <custom-icon>photo_camera_front</custom-icon>
320
- </md-standard-icon-button>
321
-
322
- <flex-it flex="1"></flex-it>
323
-
324
- <md-standard-icon-button style="transform: scale(1.66);" @click=${this.#takePhoto}>
325
- <custom-icon>photo_camera</custom-icon>
326
- </md-standard-icon-button>
327
-
328
- <flex-it flex="1"></flex-it>
329
-
330
- <md-standard-icon-button
331
- @click=${() => (this.#cameraFacingMode = 'environment')}
332
- ?disabled=${this.rearCameraDisabled}
333
- >
334
- <custom-icon>photo_camera_back</custom-icon>
335
- </md-standard-icon-button>
336
-
337
- <flex-it flex="2"></flex-it>
338
- </flex-row>
339
- </section>
340
-
341
- <section route="file">
342
- <md-filled-tonal-button @click=${this.#selectFile.bind(this)}>
343
- <custom-icon slot="icon">upload</custom-icon>
344
- select
345
- </md-filled-tonal-button>
346
- </section>
347
- </custom-pages>
348
- </form>
349
-
350
- <flex-row slot="actions">
351
- <md-text-button form="form-content" value="cancel">cancel</md-text-button>
352
- <flex-one></flex-one>
353
- <md-text-button form="form-content" value="submit">submit</md-text-button>
354
- </flex-row>
299
+ : ''}
300
+ <section route="url">
301
+ <flex-column>
302
+ add image using a link/url
303
+ <md-outlined-text-field label="url" input-field="url"></md-outlined-text-field>
304
+ </flex-column>
305
+ </section>
306
+
307
+ <section route="camera">
308
+ <flex-container>
309
+ <video autoplay mute="true" class="camera-preview"></video>
310
+ </flex-container>
311
+
312
+ <flex-row class="camera-actions">
313
+ <flex-it flex="2"></flex-it>
314
+
315
+ <md-standard-icon-button
316
+ @click=${() => (this.#cameraFacingMode = 'user')}
317
+ ?disabled=${this.frontCameraDisabled}
318
+ >
319
+ <custom-icon>photo_camera_front</custom-icon>
320
+ </md-standard-icon-button>
321
+
322
+ <flex-it flex="1"></flex-it>
323
+
324
+ <md-standard-icon-button style="transform: scale(1.66);" @click=${this.#takePhoto}>
325
+ <custom-icon>photo_camera</custom-icon>
326
+ </md-standard-icon-button>
327
+
328
+ <flex-it flex="1"></flex-it>
329
+
330
+ <md-standard-icon-button
331
+ @click=${() => (this.#cameraFacingMode = 'environment')}
332
+ ?disabled=${this.rearCameraDisabled}
333
+ >
334
+ <custom-icon>photo_camera_back</custom-icon>
335
+ </md-standard-icon-button>
336
+
337
+ <flex-it flex="2"></flex-it>
338
+ </flex-row>
339
+ </section>
340
+
341
+ <section route="file">
342
+ <md-filled-tonal-button @click=${this.#selectFile.bind(this)}>
343
+ <custom-icon slot="icon">upload</custom-icon>
344
+ select
345
+ </md-filled-tonal-button>
346
+ </section>
347
+ </custom-pages>
348
+ </form>
349
+
350
+ <flex-row slot="actions">
351
+ <md-text-button form="form-content" value="cancel">cancel</md-text-button>
352
+ <flex-one></flex-one>
353
+ <md-text-button form="form-content" value="submit">submit</md-text-button>
354
+ </flex-row>
355
355
  `;
356
356
  }
357
357
  #onAction = () => new Promise((resolve, reject) => {
@@ -383,17 +383,17 @@ let CustomUploadImage = (() => {
383
383
  this.#dialog.addEventListener('closed', action);
384
384
  });
385
385
  #busytemplate(title, description) {
386
- return html `
387
- <flex-row slot="title">
388
- <h5>${title}</h5>
389
- </flex-row>
390
- <flex-column>
391
- <flex-column> ${description} </flex-column>
392
-
393
- <flex-row style="justify-content: center; width: 100%;">
394
- <md-circular-progress indeterminate></md-circular-progress>
395
- </flex-row>
396
- </flex-column>
386
+ return html `
387
+ <flex-row slot="title">
388
+ <h5>${title}</h5>
389
+ </flex-row>
390
+ <flex-column>
391
+ <flex-column> ${description} </flex-column>
392
+
393
+ <flex-row style="justify-content: center; width: 100%;">
394
+ <md-circular-progress indeterminate></md-circular-progress>
395
+ </flex-row>
396
+ </flex-column>
397
397
  `;
398
398
  }
399
399
  async addImage() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vandeurenglenn/lite-elements",
3
- "version": "0.3.50",
3
+ "version": "0.3.52",
4
4
  "description": "set of lite elements following Material Design 3 spec",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -19,32 +19,32 @@
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
21
  "@material-design-icons/svg": "^0.14.13",
22
- "@material-symbols/svg-400": "^0.17.0",
23
- "@material/web": "^1.3.0",
24
- "@vandeurenglenn/custom-shared-styles": "^0.0.16",
25
- "@vandeurenglenn/flex-elements": "^1.3.1",
26
- "@vandeurenglenn/lite": "^0.2.37",
22
+ "@material-symbols/svg-400": "^0.27.2",
23
+ "@material/web": "^2.2.0",
24
+ "@vandeurenglenn/custom-shared-styles": "^0.0.18",
25
+ "@vandeurenglenn/flex-elements": "^1.3.2",
26
+ "@vandeurenglenn/lite": "^0.2.52",
27
27
  "custom-element-decorator": "^0.6.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@rollup/plugin-commonjs": "^25.0.7",
30
+ "@rollup/plugin-commonjs": "^28.0.1",
31
31
  "@rollup/plugin-json": "^6.1.0",
32
- "@rollup/plugin-node-resolve": "^15.2.3",
32
+ "@rollup/plugin-node-resolve": "^15.3.0",
33
33
  "@rollup/plugin-terser": "^0.4.4",
34
- "@rollup/plugin-typescript": "^11.1.6",
34
+ "@rollup/plugin-typescript": "^12.1.1",
35
35
  "@types/html": "^1.0.4",
36
- "@types/node": "^20.11.30",
36
+ "@types/node": "^22.10.1",
37
37
  "@web/rollup-plugin-html": "^2.3.0",
38
- "chrome-launcher": "^1.1.0",
39
- "globby": "^14.0.1",
40
- "lighthouse": "^11.6.0",
41
- "material-symbols": "^0.17.0",
42
- "rimraf": "^5.0.5",
43
- "rollup": "^4.13.0",
38
+ "chrome-launcher": "^1.1.2",
39
+ "globby": "^14.0.2",
40
+ "lighthouse": "^12.2.2",
41
+ "material-symbols": "^0.27.2",
42
+ "rimraf": "^6.0.1",
43
+ "rollup": "^4.28.1",
44
44
  "rollup-plugin-auto-exports": "^1.0.8",
45
45
  "rollup-plugin-material-symbols": "^2.1.5",
46
- "tslib": "^2.6.2",
47
- "typescript": "^5.4.2"
46
+ "tslib": "^2.8.1",
47
+ "typescript": "^5.7.2"
48
48
  },
49
49
  "exports": {
50
50
  ".": {
@@ -387,14 +387,6 @@
387
387
  "import": "./exports/selector.js",
388
388
  "types": "./exports/selector/selector.d.ts"
389
389
  },
390
- "./simple-hash-router": {
391
- "import": "./exports/simple-hash-router.js",
392
- "types": "./exports/router/simple-hash-router.d.ts"
393
- },
394
- "./simple-hash-router.js": {
395
- "import": "./exports/simple-hash-router.js",
396
- "types": "./exports/router/simple-hash-router.d.ts"
397
- },
398
390
  "./summary-mirror": {
399
391
  "import": "./exports/summary-mirror.js",
400
392
  "types": "./exports/summary/summary-mirror.d.ts"
@@ -493,11 +485,11 @@
493
485
  },
494
486
  "./types": {
495
487
  "import": "./exports/types.js",
496
- "types": "./exports/router/types.d.ts"
488
+ "types": "./exports/types.d.ts"
497
489
  },
498
490
  "./types.js": {
499
491
  "import": "./exports/types.js",
500
- "types": "./exports/router/types.d.ts"
492
+ "types": "./exports/types.d.ts"
501
493
  },
502
494
  "./typography": {
503
495
  "import": "./exports/typography.js",
@@ -1 +0,0 @@
1
- class SimpleHashRouter{routes;constructor({host:t,fallback:s,routes:e}){this.host=t,this.routes=e,globalThis.onhashchange=this.#t,!location.hash&&s?.route?location.hash=HashRouter.bang(s.params?`${s.route}?${HashRouter.queryIt(s.params)}`:s.route):this.#t()}static queryIt(t){return Object.entries(t).map((([t,s])=>`${t}=${s}`)).join("&")}static dequeryIt(t){const s={};if(!t)return s;for(const e of t.split("&")){const[t,o]=e.split("=");s[t]=o}}static bang(t){return`#!/${t}`}static debang(t){return t.split("#!/")[1]}static parseHash(t){const s=HashRouter.debang(t).split("?"),e=s[0].split("/"),o=e[0],a=e.slice(1,-1);return{route:o,routes:e,subRoutes:a,params:HashRouter.dequeryIt(s[1]),url:s[0]}}#s=async(t,s)=>{const{params:e,subRoutes:o}=t;let a=this.host.pages.querySelector(".custom-selected");if(t.subRoutes?.length>0)for(const r of t.subRoutes){const u=s.subRoutes[r];u?customElements.get(`./${u.tagName}`)||await import(`./${u.import}.js`):(customElements.get(`./${r}`)||await import(`./${r}.js`),console.warn(`handling undefined subroute for ${t.route} falling back to default behavior.`)),a.select({route:r,params:e,subRoutes:o}),a=a.pages.querySelector(".custom-selected")}if(e)for(const[t,s]of Object.entries(e))a[t]=s};#t=async()=>{const t=HashRouter.parseHash(location.hash),s=this.routes[t.url];s?customElements.get(`./${s.tagName}`)||await import(`./${s.import}.js`):customElements.get(`./${t.route}`)||await import(`./${t.route}.js`),this.host.select(t),this.host.pages&&this.#s(t,s),document.dispatchEvent(new CustomEvent("route-change",{detail:{routing:t,routeInfo:s}}))};go(t,s){}}export{SimpleHashRouter as default};
@@ -1 +0,0 @@
1
-
@@ -1,34 +0,0 @@
1
- import { RoutesOption } from './types.js';
2
- /**
3
- * @description
4
- * A hash based router meant to work together with custom-pages, custom-select etc
5
- *
6
- * @example
7
- * new HashRouter({
8
- * host: document.querySelector('app-shell'),
9
- * fallback: {route: 'home' params: {...}},
10
- * routes: [{
11
- * 'home': {
12
- * import: 'views/home.js'
13
- * }
14
- * }]
15
- * })
16
- *
17
- */
18
- export default class SimpleHashRouter {
19
- #private;
20
- routes: RoutesOption;
21
- constructor({ host, fallback, routes }: HashRouterConstructorOptions);
22
- static queryIt(params: any): string;
23
- static dequeryIt(query: any): {};
24
- static bang(route: string): string;
25
- static debang(route: string): string;
26
- static parseHash(hash: any): {
27
- route: any;
28
- routes: any;
29
- subRoutes: any;
30
- params: any;
31
- url: any;
32
- };
33
- go(route: any, params: any): void;
34
- }
@@ -1,45 +0,0 @@
1
- import { CustomPages } from '../elements.js';
2
- /**
3
- * @example
4
- * {
5
- * tagName: 'home-view',
6
- * import: './views/home',
7
- * subRoutes: [
8
- * 'home/one' : {
9
- * tagName: 'home-view-one',
10
- * import: '...'
11
- * },
12
- * 'home/one/two' : {
13
- * tagName: 'home-two',
14
- * import: '...'
15
- * }]
16
- * }
17
- *
18
- */
19
- export type RouteInfo = {
20
- tagName: string;
21
- import: string;
22
- subRoutes?: {
23
- [route: string]: Omit<RouteInfo, 'subRoutes'>;
24
- };
25
- };
26
- export type RoutesOption = {
27
- [route: string]: RouteInfo;
28
- };
29
- export type HashRouterConstructorOptions = {
30
- host: RouteAble;
31
- fallback?: {
32
- route: string;
33
- params?: object;
34
- };
35
- routes?: RoutesOption;
36
- };
37
- export type RouteSelectInput = {
38
- route: string;
39
- subRoutes?: string[];
40
- params?: object;
41
- };
42
- export interface RouteAble extends HTMLElement {
43
- select: ({ route, subRoutes, params }: RouteSelectInput) => void;
44
- pages?: CustomPages;
45
- }