@shortfuse/materialdesignweb 0.4.0 → 0.5.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 (184) hide show
  1. package/.browserslistrc +2 -1
  2. package/.eslintrc.json +59 -8
  3. package/.stylelintrc.json +94 -49
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +1 -3
  6. package/adapters/datatable/column.js +27 -54
  7. package/adapters/datatable/index.js +69 -81
  8. package/adapters/dom/index.js +32 -47
  9. package/adapters/search/index.js +107 -133
  10. package/components/appbar/_spec.scss +77 -137
  11. package/components/banner/_spec.scss +28 -63
  12. package/components/bottomnav/_spec.scss +46 -54
  13. package/components/bottomnav/index.js +15 -20
  14. package/components/bottomnav/item.js +4 -5
  15. package/components/button/README.md +1 -1
  16. package/components/button/_spec.scss +43 -42
  17. package/components/button/_theme.scss +27 -50
  18. package/components/card/_spec.scss +61 -69
  19. package/components/chip/_spec.scss +21 -44
  20. package/components/chip/_theme.scss +79 -151
  21. package/components/chip/index.js +6 -4
  22. package/components/datatable/_spec.scss +36 -99
  23. package/components/datatable/_theme.scss +98 -124
  24. package/components/datatable/cell.js +1 -2
  25. package/components/datatable/columnheader.js +1 -2
  26. package/components/datatable/index.js +33 -47
  27. package/components/datatable/row.js +4 -5
  28. package/components/dialog/_spec.scss +53 -63
  29. package/components/dialog/_theme.scss +7 -0
  30. package/components/dialog/index.js +62 -88
  31. package/components/divider/_spec.scss +6 -8
  32. package/components/elevation/_spec.scss +1 -1
  33. package/components/fab/_spec.scss +30 -42
  34. package/components/fab/index.js +4 -8
  35. package/components/grid/_spec.scss +68 -211
  36. package/components/layout/_mixins.scss +0 -22
  37. package/components/layout/_spec.scss +267 -363
  38. package/components/layout/_theme.scss +10 -35
  39. package/components/layout/index.js +40 -50
  40. package/components/list/_spec.scss +57 -91
  41. package/components/list/_theme.scss +75 -84
  42. package/components/list/content.js +9 -13
  43. package/components/list/index.js +34 -38
  44. package/components/list/item.js +8 -11
  45. package/components/list/secondary.js +8 -9
  46. package/components/menu/_spec.scss +134 -167
  47. package/components/menu/index.js +45 -61
  48. package/components/menu/item.js +11 -19
  49. package/components/progress/_spec.scss +43 -34
  50. package/components/selection/_spec.scss +123 -133
  51. package/components/selection/_theme.scss +88 -120
  52. package/components/selection/index.js +9 -15
  53. package/components/selection/input.js +3 -5
  54. package/components/selection/radiogroup.js +8 -15
  55. package/components/slider/_spec.scss +23 -28
  56. package/components/snackbar/_spec.scss +17 -62
  57. package/components/snackbar/index.js +15 -21
  58. package/components/tab/_spec.scss +35 -50
  59. package/components/tab/content.js +33 -28
  60. package/components/tab/index.js +30 -33
  61. package/components/tab/item.js +4 -5
  62. package/components/tab/list.js +22 -36
  63. package/components/textfield/README.md +2 -2
  64. package/components/textfield/_spec.scss +241 -287
  65. package/components/textfield/_theme.scss +197 -232
  66. package/components/textfield/index.js +8 -16
  67. package/components/tooltip/_spec.scss +23 -26
  68. package/components/type/_spec.scss +19 -16
  69. package/core/_breakpoint.scss +33 -33
  70. package/core/_elevation.scss +40 -0
  71. package/core/_length.scss +0 -1
  72. package/core/_platform.scss +0 -22
  73. package/core/_type.scss +7 -6
  74. package/core/aria/button.js +4 -5
  75. package/core/aria/keyboard.js +1 -2
  76. package/core/aria/rovingtabindex.js +14 -17
  77. package/core/aria/tab.js +1 -2
  78. package/core/dom.js +18 -109
  79. package/core/overlay/_spec.scss +5 -8
  80. package/core/overlay/_theme.scss +126 -150
  81. package/core/overlay/index.js +19 -32
  82. package/core/ripple/_spec.scss +16 -17
  83. package/core/ripple/_theme.scss +13 -33
  84. package/core/ripple/index.js +36 -44
  85. package/core/theme/_aliases.scss +15 -0
  86. package/core/theme/_config.scss +8 -2
  87. package/core/theme/_functions.scss +22 -0
  88. package/core/theme/_palettes.scss +0 -1
  89. package/core/{color → theme}/_spec.scss +0 -0
  90. package/core/theme/_theme.scss +268 -0
  91. package/core/theme/index.scss +4 -0
  92. package/core/transition/index.js +73 -76
  93. package/docs/_flex.scss +7 -1
  94. package/docs/_menuoptions.js +2 -2
  95. package/docs/_partials/_appbar.eta +12 -14
  96. package/docs/_partials/_header.eta +41 -44
  97. package/docs/_sample-utils.js +15 -20
  98. package/docs/docs.scss +123 -87
  99. package/docs/framework.scss +26 -0
  100. package/docs/index.eta +2 -6
  101. package/docs/index.js +7 -0
  102. package/docs/pages/appbar.eta +22 -28
  103. package/docs/pages/bottomnav.js +17 -14
  104. package/docs/pages/button.js +10 -10
  105. package/docs/pages/card.js +20 -22
  106. package/docs/pages/chip.js +11 -13
  107. package/docs/pages/color.js +35 -36
  108. package/docs/pages/datatable.js +11 -15
  109. package/docs/pages/dialog.eta +9 -11
  110. package/docs/pages/dialog.js +6 -9
  111. package/docs/pages/dom.js +6 -9
  112. package/docs/pages/elevation.eta +10 -10
  113. package/docs/pages/fab.js +2 -3
  114. package/docs/pages/grid.js +5 -5
  115. package/docs/pages/list.js +1 -2
  116. package/docs/pages/menu.eta +17 -19
  117. package/docs/pages/menu.js +7 -11
  118. package/docs/pages/overlay.js +1 -2
  119. package/docs/pages/progress.eta +2 -2
  120. package/docs/pages/progress.js +1 -1
  121. package/docs/pages/ripple.js +1 -2
  122. package/docs/pages/search.eta +20 -24
  123. package/docs/pages/search.js +24 -41
  124. package/docs/pages/selection.eta +2 -6
  125. package/docs/pages/selection.js +3 -4
  126. package/docs/pages/snackbar.js +3 -4
  127. package/docs/pages/tab.eta +61 -75
  128. package/docs/pages/tab.js +16 -15
  129. package/docs/pages/textfield.eta +9 -8
  130. package/docs/pages/textfield.js +26 -23
  131. package/docs/pages/tooltip.eta +10 -12
  132. package/docs/pages/transition.js +5 -7
  133. package/docs/postrender.js +7 -5
  134. package/docs/pwa/pwa.eta +14 -16
  135. package/docs/pwa/pwa.js +19 -27
  136. package/docs/pwa/pwa.scss +12 -7
  137. package/docs/themes/theme-colored.scss +9 -11
  138. package/docs/themes/theme-default.scss +0 -14
  139. package/index.scss +27 -0
  140. package/jsconfig.json +7 -3
  141. package/package.json +26 -15
  142. package/tsconfig.json +16 -0
  143. package/{webpack.config.cjs → webpack.config.js} +105 -58
  144. package/components/template/_theme.scss +0 -27
  145. package/components/textfield/_mixins.scss +0 -52
  146. package/core/color/_theme.scss +0 -390
  147. package/core/color/index.scss +0 -2
  148. package/core/theme/_mixins.scss +0 -172
  149. package/core/theme/_variables.scss +0 -24
  150. package/docs/_mixins.pug +0 -155
  151. package/docs/pages/appbar.pug +0 -78
  152. package/docs/pages/bottomnav.pug +0 -137
  153. package/docs/pages/button.pug +0 -121
  154. package/docs/pages/card.pug +0 -74
  155. package/docs/pages/chip.pug +0 -91
  156. package/docs/pages/color.pug +0 -121
  157. package/docs/pages/datatable.pug +0 -283
  158. package/docs/pages/dialog.pug +0 -132
  159. package/docs/pages/dom.pug +0 -22
  160. package/docs/pages/elevation.pug +0 -25
  161. package/docs/pages/fab.pug +0 -66
  162. package/docs/pages/grid.pug +0 -95
  163. package/docs/pages/layout.pug +0 -7
  164. package/docs/pages/list.pug +0 -326
  165. package/docs/pages/menu.pug +0 -205
  166. package/docs/pages/overlay.pug +0 -55
  167. package/docs/pages/progress.pug +0 -16
  168. package/docs/pages/ripple.pug +0 -21
  169. package/docs/pages/search.pug +0 -165
  170. package/docs/pages/selection.pug +0 -74
  171. package/docs/pages/slider.pug +0 -17
  172. package/docs/pages/snackbar.pug +0 -60
  173. package/docs/pages/tab.pug +0 -304
  174. package/docs/pages/textfield.pug +0 -360
  175. package/docs/pages/tooltip.pug +0 -78
  176. package/docs/pages/transition.pug +0 -76
  177. package/docs/pages/type.pug +0 -29
  178. package/docs/pwa/_dialogs.pug +0 -96
  179. package/docs/pwa/_menus.pug +0 -11
  180. package/docs/pwa/pwa.pug +0 -325
  181. package/docs/spec.scss +0 -26
  182. package/docs/themes/_component-themes.scss +0 -26
  183. package/docs/themes/theme-colored-fallbacks.scss +0 -17
  184. package/docs/themes/theme-default-fallbacks.scss +0 -17
package/docs/docs.scss CHANGED
@@ -5,23 +5,26 @@
5
5
  direction: inherit;
6
6
  }
7
7
 
8
-
9
8
  .comparison {
10
9
  display: flex;
11
- flex-direction: row;
12
10
  position: relative;
11
+ flex-direction: row;
13
12
  }
14
13
 
15
14
  .androidstatusbar {
16
- z-index: 16;
17
15
  display: flex;
18
16
  align-items: center;
19
17
  flex-direction: row-reverse;
20
- height: 24px;
18
+
19
+ block-size: 24px;
21
20
  padding: 0 8px;
22
- font-size: 14px;
21
+
22
+ z-index: 16;
23
+
23
24
  color: white;
24
25
 
26
+ font-size: 14px;
27
+
25
28
  .mdw-theme[mdw-light] &,
26
29
  .mdw-theme[mdw-dark] .mdw-theme[mdw-light] & {
27
30
  &:not([mdw-surface]) {
@@ -44,17 +47,18 @@
44
47
  }
45
48
 
46
49
  .content {
47
- flex: 1;
50
+ flex-direction: column;
51
+ -ms-overflow-style: -ms-autohiding-scrollbar;
48
52
  overflow-y: auto;
53
+
54
+ flex: 1;
49
55
  -webkit-overflow-scrolling: touch;
50
- -ms-overflow-style: -ms-autohiding-scrollbar;
51
- flex-direction: column;
52
56
  }
53
57
 
54
58
  .render,
55
59
  .target {
56
- width: 360px;
57
- max-width: 360px;
60
+ max-inline-size: 360px;
61
+ inline-size: 360px;
58
62
  }
59
63
 
60
64
  .render-fill {
@@ -63,93 +67,103 @@
63
67
 
64
68
  .render,
65
69
  .render-fill {
66
- z-index: 1;
67
70
  overflow-x: hidden;
68
- max-height: 640px;
69
- border-color: #eee;
70
- border-width: 1px;
71
- border-style: solid;
71
+
72
72
  box-sizing: border-box;
73
+ max-block-size: 640px;
74
+ border-style: solid;
75
+ border-width: 1px;
76
+
77
+ z-index: 1;
78
+
79
+ border-color: #eee;
80
+
73
81
  .mdw-theme[mdw-light] & {
74
- border-color: rgba(0,0,0,0.12);
82
+ border-color: rgba(0, 0, 0, 0.12);
75
83
  }
84
+
76
85
  .mdw-theme[mdw-dark] & {
77
- border-color: rgba(255,255,255,0.12);
86
+ border-color: rgba(255, 255, 255, 0.12);
78
87
  }
79
88
  }
80
89
 
81
90
  .docs-option-list {
82
91
  & > .mdw-selection {
83
- margin:16px 8px;
92
+ margin: 16px 8px;
84
93
  }
85
94
  }
86
95
 
87
96
  .render,
88
97
  .render-fill,
89
98
  .target {
99
+ display: flex;
90
100
  position: relative;
101
+ flex-direction: column;
102
+
103
+ block-size: 640px;
91
104
  margin: 8px;
92
- height: 640px;
93
- background-size: cover;
105
+
94
106
  background-repeat: no-repeat;
107
+ background-size: cover;
95
108
 
96
- display: flex;
97
- flex-direction: column;
98
109
  .clipped & {
99
- max-height: 190px;
110
+ max-block-size: 190px;
100
111
  }
112
+
101
113
  .clipped-236 & {
102
- max-height: 236px;
114
+ max-block-size: 236px;
103
115
  }
116
+
104
117
  .clipped-300 & {
105
- max-height: 300px;
118
+ max-block-size: 300px;
106
119
  }
120
+
107
121
  .clipped-304 & {
108
- max-height: 304px;
122
+ max-block-size: 304px;
109
123
  }
110
124
  }
111
125
 
126
+ .horizontal-controls {
127
+ display: inline-flex;
112
128
 
129
+ inline-size: 100%;
113
130
 
114
- .horizontal-controls {
115
- display:inline-flex;
116
- width:100%;
117
131
  & > :not(:last-child) {
118
- margin-right: 16px;
119
- margin-left: 0;
132
+ margin-inline: 0 16px;
120
133
  }
121
- [dir=rtl] & > :not(:last-child) {
122
- margin-left: 16px;
123
- margin-right: 0;
134
+
135
+ [dir="rtl"] & > :not(:last-child) {
136
+ margin-inline: 16px 0;
124
137
  }
125
138
  }
126
139
 
127
-
128
-
129
140
  .docs-render-overlay {
130
- position:absolute;
131
- left:0;
132
- right:0;
133
- bottom:0;
134
- flex-direction:row-reverse
141
+ position: absolute;
142
+ inset-block-end: 0;
143
+ inset-inline: 0;
144
+ flex-direction: row-reverse;
135
145
  }
136
146
 
137
147
  .component-sample {
138
- flex: 1;
139
- position: relative;
140
148
  display: flex;
149
+ position: relative;
141
150
  align-items: center;
142
151
  justify-content: center;
143
- padding: 24px;
152
+
153
+ min-block-size: 360px;
154
+ flex: 1;
144
155
  border-style: solid;
145
- border-radius: 2px;
146
156
  border-width: 1px;
147
- min-height: 360px;
157
+ padding: 24px;
158
+
159
+ border-radius: 2px;
160
+
148
161
  .mdw-theme[mdw-light] & {
149
- border-color: rgba(0,0,0,0.12);
162
+ border-color: rgba(0, 0, 0, 0.12);
150
163
  }
164
+
151
165
  .mdw-theme[mdw-dark] & {
152
- border-color: rgba(255,255,255,0.12);
166
+ border-color: rgba(255, 255, 255, 0.12);
153
167
  }
154
168
  }
155
169
 
@@ -159,137 +173,159 @@
159
173
 
160
174
  .component-code {
161
175
  display: flex;
176
+ position: relative;
162
177
  align-items: flex-start;
163
178
  justify-content: center;
179
+
180
+ flex-grow: 1;
164
181
  padding: 24px;
182
+
183
+ font-family: monospace;
165
184
  white-space: pre-wrap;
166
185
  word-break: break-word;
167
- font-family: monospace;
168
- flex-grow: 1;
169
- position: relative;
170
186
  }
171
187
 
172
188
  #usePug {
173
189
  position: absolute;
174
- top: 4px;
175
- right: 4px;
176
- left: auto;
177
- font-size: 12px;
190
+ inset-block-start: 4px;
191
+ inset-inline: auto 4px;
192
+
178
193
  margin: 0;
194
+
195
+ font-size: 12px;
196
+
179
197
  :root[dir="rtl"] {
180
- right: auto;
181
- left: 4px;
198
+ inset-inline: 4px auto;
182
199
  }
183
200
  }
184
201
 
185
-
186
202
  .androidnavbar {
187
203
  display: flex;
204
+ align-items: center;
188
205
  flex-direction: row;
189
206
  justify-content: space-around;
190
- align-items: center;
191
- min-height: 48px;
192
- height: 48px;
207
+
208
+ min-block-size: 48px;
209
+ block-size: 48px;
193
210
  padding: 0 30px;
211
+
194
212
  background-color: black;
195
213
  color: white;
214
+
196
215
  .material-icons {
197
216
  font-size: 20px;
198
217
  }
218
+
199
219
  .material-icons.back-button {
200
- transform: rotate(90deg);
220
+ transform: rotate(90deg);
201
221
  }
202
222
  }
203
223
 
204
224
  .custom-no-results-indicator {
225
+ min-block-size: 48px;
205
226
  margin: 8px;
206
- min-height: 48px;
207
227
  }
208
228
 
209
-
210
229
  #Vintage50Input {
211
230
  font-size: sp(34);
212
231
  }
213
232
 
214
233
  .type-comparison {
215
234
  .content {
216
- margin: 8px;
235
+ display: flex;
217
236
  align-items: flex-start;
218
237
  flex-direction: column;
219
- display: flex;
238
+
239
+ margin: 8px;
220
240
  }
241
+
221
242
  .target {
222
- margin-top: 42px;
243
+ block-size: 568px;
244
+ inline-size: 760px;
245
+ margin-block-start: 42px;
223
246
  background-position-x: -200px;
224
- width: 760px;
225
- height: 568px;
226
247
  }
248
+
227
249
  .mdw-type {
228
250
  position: relative; // For tooltip position
229
251
  }
230
252
  }
253
+
231
254
  .type-comparison-2 {
232
255
  .target {
233
- width: 760px;
234
- height: 208px;
256
+ block-size: 208px;
257
+ inline-size: 760px;
235
258
  }
236
259
  }
260
+
237
261
  .type-comparison-3 {
238
262
  .target {
239
- width: 360px;
240
- height: 300px;
263
+ block-size: 300px;
264
+ inline-size: 360px;
241
265
  }
242
266
  }
243
267
 
244
268
  .docs-grid {
245
269
  .mdw-card {
246
- padding: 16px 8px;
247
270
  display: flex;
248
- justify-content: center;
249
271
  align-items: center;
272
+ justify-content: center;
273
+
274
+ padding: 16px 8px;
275
+
250
276
  cursor: pointer;
251
277
  -webkit-tap-highlight-color: transparent;
252
278
  }
253
279
  }
254
280
 
255
281
  .docs-elevation__item {
256
- padding: 24px 0;
257
282
  display: flex;
258
- justify-content: center;
259
283
  align-items: center;
284
+ justify-content: center;
285
+
286
+ padding: 24px 0;
287
+
260
288
  border-radius: 4px;
261
289
  }
262
290
 
263
291
  .docs-tab {
264
292
  .component-sample__container {
265
- width: 100%;
293
+ inline-size: 100%;
294
+
266
295
  > .mdw-tab {
267
- width: 100%;
296
+ inline-size: 100%;
268
297
  }
269
298
  }
270
299
  }
271
300
 
272
301
  .demo-core-item {
273
- border-radius: 8px;
274
- min-width: 5em;
275
- height: 5em;
276
302
  display: inline-flex;
277
303
  align-items: center;
278
304
  justify-content: center;
305
+
306
+ block-size: 5em;
307
+ min-inline-size: 5em;
279
308
  margin: 4px;
309
+
280
310
  cursor: pointer;
281
311
  -moz-user-select: none;
282
312
  -ms-user-select: none;
283
313
  -webkit-user-select: none;
284
314
  user-select: none;
315
+
316
+ border-radius: 8px;
317
+
285
318
  &[demo-round] {
319
+ max-block-size: 5em;
320
+ max-inline-size: 5em;
321
+
286
322
  border-radius: 50%;
287
- max-width: 5em;
288
- max-height: 5em;
289
323
  }
324
+
290
325
  &[demo-square] {
326
+ max-block-size: 5em;
327
+ max-inline-size: 5em;
328
+
291
329
  border-radius: 0;
292
- max-width: 5em;
293
- max-height: 5em;
294
330
  }
295
- }
331
+ }
@@ -0,0 +1,26 @@
1
+ @use "../core/theme/index.scss" as theme;
2
+ @use "../core/overlay/index.scss" as overlay;
3
+ @use "../core/ripple/index.scss" as ripple;
4
+ @use "../components/appbar/index.scss" as appbar;
5
+ @use "../components/banner/index.scss" as banner;
6
+ @use "../components/bottomnav/index.scss" as bottomnav;
7
+ @use "../components/button/index.scss" as button;
8
+ @use "../components/card/index.scss" as card;
9
+ @use "../components/chip/index.scss" as chip;
10
+ @use "../components/datatable/index.scss" as datatable;
11
+ @use "../components/dialog/index.scss" as dialog;
12
+ @use "../components/divider/index.scss" as divider;
13
+ @use "../components/elevation/index.scss" as elevation;
14
+ @use "../components/fab/index.scss" as fab;
15
+ @use "../components/grid/index.scss" as grid;
16
+ @use "../components/layout/index.scss" as layout;
17
+ @use "../components/list/index.scss" as list;
18
+ @use "../components/menu/index.scss" as menu;
19
+ @use "../components/progress/index.scss" as progress;
20
+ @use "../components/selection/index.scss" as selection;
21
+ @use "../components/slider/index.scss" as slider;
22
+ @use "../components/snackbar/index.scss" as snackbar;
23
+ @use "../components/tab/index.scss" as tab;
24
+ @use "../components/textfield/index.scss" as textfield;
25
+ @use "../components/tooltip/index.scss" as tooltip;
26
+ @use "../components/type/index.scss" as type;
package/docs/index.eta CHANGED
@@ -3,12 +3,8 @@
3
3
  <div class="mdw-grid__item" mdw-colspan="100%">
4
4
  <div class="mdw-grid__content">
5
5
  <h1 class="mdw-type">Material Design Web</h1>
6
- <%~ includeFile('../components/button/index.eta', {
7
- ink: 'primary', attributes: {href:"https://github.com/clshortfuse/materialdesignweb"}, text: 'GitHub',
8
- }) %>
9
- <%~ includeFile('../components/button/index.eta', {
10
- ink: 'primary', attributes: {href:"./report.html"}, text: 'Bundle Analyzer Report',
11
- }) %>
6
+ <a class="mdw-button mdw-theme" mdw-ink="primary" href="https://github.com/clshortfuse/materialdesignweb">GitHub</a>
7
+ <a class="mdw-button mdw-theme" mdw-ink="primary" href="./report.html">Bundle Analyzer Report</a>
12
8
  </div>
13
9
  </div>
14
10
  </div>
package/docs/index.js CHANGED
@@ -0,0 +1,7 @@
1
+ import * as Button from '../components/button/index.js';
2
+
3
+ document.addEventListener('DOMContentLoaded', () => {
4
+ for (const el of document.getElementsByClassName('mdw-button')) {
5
+ Button.attach(el);
6
+ }
7
+ });
@@ -36,14 +36,12 @@
36
36
  <!-- Elevation and z-index only for demo-->
37
37
  <!-- Normally handled with .mdw-layout__appbar-->
38
38
  <div class="mdw-appbar mdw-elevation" mdw-dense mdw-elevation="4" style="z-index:4">
39
- <div class="mdw-appbar__action">
40
- <div class="mdw-appbar__start">
41
- <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'menu' }}) %>
42
- </div>
43
- <div class="mdw-appbar__title">Dense (Desktop)</div>
44
- <div class="mdw-appbar__end">
45
- <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'more_vert' }}) %>
46
- </div>
39
+ <div class="mdw-appbar__start">
40
+ <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'menu' }}) %>
41
+ </div>
42
+ <div class="mdw-appbar__title">Dense (Desktop)</div>
43
+ <div class="mdw-appbar__end">
44
+ <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'more_vert' }}) %>
47
45
  </div>
48
46
  </div>
49
47
  <div class="content mdw-theme" mdw-surface="background alt"></div>
@@ -53,15 +51,13 @@
53
51
  <div class="render">
54
52
  <%~ includeFile('../_partials/_androidstatusbar.eta') %>
55
53
  <div class="mdw-appbar mdw-elevation" mdw-prominent mdw-dense mdw-elevation="4" style="z-index:4">
56
- <div class="mdw-appbar__action">
57
- <div class="mdw-appbar__start">
58
- <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'menu' }}) %>
59
- </div>
60
- <div class="mdw-appbar__title">Prominent Dense</div>
61
- <div class="mdw-appbar__end">
62
- <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'search' }}) %>
63
- <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'more_vert' }}) %>
64
- </div>
54
+ <div class="mdw-appbar__start">
55
+ <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'menu' }}) %>
56
+ </div>
57
+ <div class="mdw-appbar__title">Prominent Dense</div>
58
+ <div class="mdw-appbar__end">
59
+ <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'search' }}) %>
60
+ <%~ includeFile(T, { button: {icon:true, class: 'material-icons', body: 'more_vert' }}) %>
65
61
  </div>
66
62
  </div>
67
63
  <div class="content mdw-theme" mdw-surface="background alt"></div>
@@ -71,18 +67,16 @@
71
67
  <div class="render">
72
68
  <%~ includeFile('../_partials/_androidstatusbar.eta') %>
73
69
  <div class="mdw-appbar mdw-elevation" mdw-elevation="4" style="z-index:4">
74
- <div class="mdw-appbar__action">
75
- <div class="mdw-appbar__start">
76
- <div class="mdw-tooltip__wrapper">
77
- <%~ includeFile(T, { button: {icon:true, class: 'mdw-tooltip__target material-icons', body: 'arrow_back' }}) %>
78
- <div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark>Back</div>
79
- </div>
70
+ <div class="mdw-appbar__start">
71
+ <div class="mdw-tooltip__wrapper">
72
+ <%~ includeFile(T, { button: {icon:true, class: 'mdw-tooltip__target material-icons', body: 'arrow_back' }}) %>
73
+ <div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark>Back</div>
80
74
  </div>
81
- <div class="mdw-appbar__end">
82
- <div class="mdw-tooltip__wrapper">
83
- <%~ includeFile(T, { button: {icon:true, class: 'mdw-tooltip__target material-icons', body: 'more_vert', attributes: {'mdw-more-button': true} }}) %>
84
- <div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark>More</div>
85
- </div>
75
+ </div>
76
+ <div class="mdw-appbar__end">
77
+ <div class="mdw-tooltip__wrapper">
78
+ <%~ includeFile(T, { button: {icon:true, class: 'mdw-tooltip__target material-icons', body: 'more_vert', attributes: {'mdw-more-button': true} }}) %>
79
+ <div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark>More</div>
86
80
  </div>
87
81
  </div>
88
82
  <div class="mdw-appbar__content">
@@ -1,12 +1,14 @@
1
1
  import * as BottomNav from '../../components/bottomnav/index.js';
2
2
  import * as BottomNavItem from '../../components/bottomnav/item.js';
3
3
  import * as Button from '../../components/button/index.js';
4
- import { iterateArrayLike, setTextNode } from '../../core/dom.js';
4
+ import { setTextNode } from '../../core/dom.js';
5
5
  import { convertElementToCode } from '../_sample-utils.js';
6
6
 
7
7
  /** @return {void} */
8
8
  function initializeSampleComponents() {
9
- iterateArrayLike(document.querySelectorAll('.mdw-bottomnav'), BottomNav.attach);
9
+ for (const element of document.querySelectorAll('.mdw-bottomnav')) {
10
+ BottomNav.attach(element);
11
+ }
10
12
  }
11
13
 
12
14
  /** @type {HTMLElement} */
@@ -17,17 +19,19 @@ function updateSampleCode() {
17
19
  // Strip JS related elements and attributes
18
20
  BottomNav.detach(sampleComponent);
19
21
  sampleComponent.removeAttribute('role');
20
- iterateArrayLike(sampleComponent.getElementsByClassName('mdw-bottomnav__item'), (item) => {
22
+ for (const item of sampleComponent.getElementsByClassName('mdw-bottomnav__item')) {
21
23
  BottomNavItem.detach(item);
22
24
  item.classList.remove('mdw-ripple');
23
25
  item.classList.remove('mdw-overlay');
24
26
  item.removeAttribute('mdw-overlay-off');
25
27
  item.removeAttribute('role');
26
- });
28
+ }
27
29
 
28
30
  const htmlCodeElement = document.getElementsByClassName('component-html')[0];
29
- setTextNode(htmlCodeElement, convertElementToCode(sampleComponent,
30
- document.getElementById('usePug').getAttribute('aria-pressed') === 'true'));
31
+ setTextNode(htmlCodeElement, convertElementToCode(
32
+ sampleComponent,
33
+ document.getElementById('usePug').getAttribute('aria-pressed') === 'true',
34
+ ));
31
35
 
32
36
  // Reattach JS if requested
33
37
  BottomNav.attach(sampleComponent);
@@ -55,16 +59,15 @@ function setupPugButton() {
55
59
  * @return {void}
56
60
  */
57
61
  function onOptionChange(event) {
58
- /** @type {HTMLInputElement} */
59
- const { name, value } = (event.target);
62
+ const { name, value } = /** @type {HTMLInputElement} */ (event.target);
60
63
  switch (name) {
61
64
  case 'ink':
62
65
  switch (value) {
63
66
  case 'default':
64
- iterateArrayLike(sampleComponent.getElementsByClassName('mdw-bottomnav__item'), (el) => el.removeAttribute('mdw-ink'));
67
+ for (const el of sampleComponent.getElementsByClassName('mdw-bottomnav__item')) el.removeAttribute('mdw-ink');
65
68
  break;
66
69
  default:
67
- iterateArrayLike(sampleComponent.getElementsByClassName('mdw-bottomnav__item'), (el) => el.setAttribute('mdw-ink', value));
70
+ for (const el of sampleComponent.getElementsByClassName('mdw-bottomnav__item')) el.setAttribute('mdw-ink', value);
68
71
  break;
69
72
  }
70
73
  break;
@@ -77,12 +80,12 @@ function onOptionChange(event) {
77
80
  break;
78
81
  default:
79
82
  sampleComponent.setAttribute('mdw-surface', value.replace(/ (light|dark)/, ''));
80
- if (value.indexOf(' light') === -1) {
83
+ if (!value.includes(' light')) {
81
84
  sampleComponent.removeAttribute('mdw-light');
82
85
  } else {
83
86
  sampleComponent.setAttribute('mdw-light', '');
84
87
  }
85
- if (value.indexOf(' dark') === -1) {
88
+ if (!value.includes(' dark')) {
86
89
  sampleComponent.removeAttribute('mdw-dark');
87
90
  } else {
88
91
  sampleComponent.setAttribute('mdw-dark', '');
@@ -104,9 +107,9 @@ function onOptionChange(event) {
104
107
  function setupComponentOptions() {
105
108
  sampleComponent = document.querySelector('.component-sample .mdw-bottomnav');
106
109
  BottomNav.attach(sampleComponent);
107
- iterateArrayLike(document.querySelectorAll('input[name]'), (el) => {
110
+ for (const el of document.querySelectorAll('input[name]')) {
108
111
  el.addEventListener('change', onOptionChange);
109
- });
112
+ }
110
113
  }
111
114
 
112
115
  initializeSampleComponents();
@@ -1,12 +1,12 @@
1
1
  import * as Button from '../../components/button/index.js';
2
- import { iterateArrayLike, setTextNode } from '../../core/dom.js';
2
+ import { setTextNode } from '../../core/dom.js';
3
3
  import * as Overlay from '../../core/overlay/index.js';
4
4
  import * as Ripple from '../../core/ripple/index.js';
5
5
  import { convertElementToCode } from '../_sample-utils.js';
6
6
 
7
7
  /** @return {void} */
8
8
  function initializeSampleComponents() {
9
- iterateArrayLike(document.querySelectorAll('.js .mdw-button'), Button.attach);
9
+ for (const element of document.querySelectorAll('.js .mdw-button')) { Button.attach(element); }
10
10
  }
11
11
 
12
12
  /** @type {HTMLElement} */
@@ -27,13 +27,13 @@ function toggleOverlayOption(name, value) {
27
27
  return;
28
28
  }
29
29
  if (value) {
30
- if (attr.indexOf(name) !== -1) {
30
+ if (attr.includes(name)) {
31
31
  return;
32
32
  }
33
33
  sampleComponent.setAttribute('mdw-overlay-off', `${attr} ${name}`);
34
34
  return;
35
35
  }
36
- if (attr.indexOf(name) === -1) {
36
+ if (!attr.includes(name)) {
37
37
  return;
38
38
  }
39
39
  sampleComponent.setAttribute('mdw-overlay-off', attr.replace(name, '').trim());
@@ -175,12 +175,12 @@ function onOptionChange(event) {
175
175
  break;
176
176
  default:
177
177
  sampleComponent.setAttribute('mdw-surface', value.replace(/ (light|dark)/, ''));
178
- if (value.indexOf(' light') === -1) {
178
+ if (!value.includes(' light')) {
179
179
  sampleComponent.removeAttribute('mdw-light');
180
180
  } else {
181
181
  sampleComponent.setAttribute('mdw-light', '');
182
182
  }
183
- if (value.indexOf(' dark') === -1) {
183
+ if (!value.includes(' dark')) {
184
184
  sampleComponent.removeAttribute('mdw-dark');
185
185
  } else {
186
186
  sampleComponent.setAttribute('mdw-dark', '');
@@ -198,9 +198,9 @@ function onOptionChange(event) {
198
198
  while (sampleComponent.firstChild) {
199
199
  newElement.appendChild(sampleComponent.firstChild);
200
200
  }
201
- iterateArrayLike(sampleComponent.attributes, (attr) => {
201
+ for (const attr of sampleComponent.attributes) {
202
202
  newElement.attributes.setNamedItem(attr.cloneNode());
203
- });
203
+ }
204
204
  sampleComponent.parentElement.replaceChild(newElement, sampleComponent);
205
205
  sampleComponent = newElement;
206
206
  break;
@@ -213,9 +213,9 @@ function onOptionChange(event) {
213
213
  function setupComponentOptions() {
214
214
  sampleComponent = document.querySelector('.component-sample .mdw-button');
215
215
  Button.attach(sampleComponent);
216
- iterateArrayLike(document.querySelectorAll('input[name]'), (el) => {
216
+ for (const el of document.querySelectorAll('input[name]')) {
217
217
  el.addEventListener('change', onOptionChange);
218
- });
218
+ }
219
219
  }
220
220
 
221
221
  initializeSampleComponents();