mithril-materialized 3.3.4 → 3.3.5
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.
- package/README.md +3 -1
- package/dist/components.css +99 -0
- package/dist/index.esm.js +17 -6
- package/dist/index.js +17 -6
- package/dist/index.umd.js +17 -6
- package/dist/material-icon.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A Mithril.js component library inspired by [materialize-css](https://materializecss.com) design principles, [available on npm](https://www.npmjs.com/package/mithril-materialized). This library provides you with ready-to-use Mithril components that follow Material Design guidelines, with **no external JavaScript dependencies**.
|
|
4
4
|
|
|
5
|
-
## 🚀 v3.3
|
|
5
|
+
## 🚀 v3.3 - Latest Release
|
|
6
6
|
|
|
7
7
|
The current stable release that provides a complete Mithril.js Material Design component library with no external JavaScript dependencies.
|
|
8
8
|
|
|
@@ -99,6 +99,8 @@ Components marked with an * are not included in the original materialize-css lib
|
|
|
99
99
|
|
|
100
100
|
## 📖 Usage Instructions
|
|
101
101
|
|
|
102
|
+
Online [flems](flems.io) examples: [FlatButton](https://flems.io/#0=N4IgtglgJlA2CmIBcBWFA6AnAJgDQgGd4EBjAF3imRHTIJHwDMIF6kBtUAOwEMxEkNABZkwsBiBIB7LhVnUAPLAhcA1gAIATsQC8AHUJkAnqyHx4ZA+qHbG+kCLIAHAkgD0bgK5cnqgObo0mBukGQ2LAC0YDwUmhA8ygBelG5QEARkbipQ8AAegQQEBgB8elwSRKRkEDJsIACMSAAMIAC+uNx8AjR0EtKy8PKC-RnqwOoAYrAxAEKeZGQy6q3qOuoA7tlS6+wA5KHhsFEx8HEJEMlQuwC6ANxlZSNk6jIkyiQaawAUAJSrxeoEqcyF9dqoAFZCCG7H4PLhgdDaLg5TRfKBSEiefiydAAIykUCMuHUYC+U1m80WXGJ42muOISHUBgAskZJtNnrjKTIDMTXu8NK0fj97lwyhViPByDUuHUAGzNNodEC8fjUAr0fD9ORkahta74ZRqNicFVdagHOLifCeTTiQSOFzuLw+fyBKTBS0sAAC2HQAGZ0AB2EIQMJW9CQLjocGakDGJzdAgkOJOXXtTpqwReo7RWLxJKUCS2+0OBZOjzeXwBIKh8ORPOnAsXSjewOBgAsqXSmWyeXQWKgMbjCaTKYgaf1rSAA) and [Select](https://flems.io/#0=N4IgtglgJlA2CmIBcBWFA6AnAJgDQgGd4EBjAF3imRHTIJHwDMIF6kBtUAOwEMxEkNABZkwsBiBIB7LhVnUAPLAhcA1gAIATsQC8AHUJkAnqyHx4ZA+qHbG+kCLIAHAkgD0bgK5cnqgObo0mBukGQ2LAC0YDwUmhA8ygBelG5QEARkbipQ8AAegQQEBgB8elwSRKRkEDJsIACMSAAMIAC+uNx8AjR0EtKy8PKC-RnqwOoAysTw5Oqt6jrqAO7ZUkvsAOSh4bBRMfBxCRDJUBsAugDcZWUjZOokZiSqlACSUAvqG9gbV1xlYOhtFwcpoABRQKQkTz8WToABGUigRlw6jK6nUYFBG0Baw2KPGGRM8CQYwxPE0fhUABUpE4SRt6k0nLkNnM5ii0eiMaCplV8epYDw4cR6byZnd+HjUVwuVynIKSPAhFJYCD6QBhZRPdQyeB4zmyh4zZ5QN64A1c2nVWok9gW2XjaD0+pSwXC2D0gDyTmtMpd7PtXMdUHp3xRbpFn29vvU3wDMtlQfUTs+AGZXULIxtozUZen44n1GdzQnZTIHjwuH5iepQQA3ACUC2K6gSBzI9YbJdlrQbnL7XAbvzKFWm5FzdXqAA5mm0OiBePxqAV6Ph+nIyNQ2sWQMo1GxOAuutRtnFxPhPJpxIJHC53F4fP5AlJgqeWAABbDoVPoADsIQgMIz3QSAuHQAArVcQGMJxugIEg4h9OdOiXQQ312aJYniJJKAkS9rwcMhnFcDxvF8AIggAoDIkwg5sOOSh3x-H8ABZUnSTJsjydBoSgCCoJguCEIgJDWjOVogA).
|
|
103
|
+
|
|
102
104
|
### Quick Start
|
|
103
105
|
|
|
104
106
|
1. **Install the package**:
|
package/dist/components.css
CHANGED
|
@@ -4223,3 +4223,102 @@ body {
|
|
|
4223
4223
|
transform: none;
|
|
4224
4224
|
}
|
|
4225
4225
|
}
|
|
4226
|
+
.theme-switcher {
|
|
4227
|
+
display: flex;
|
|
4228
|
+
align-items: center;
|
|
4229
|
+
gap: 0.5rem;
|
|
4230
|
+
}
|
|
4231
|
+
.theme-switcher .theme-switcher-label {
|
|
4232
|
+
font-size: 0.875rem;
|
|
4233
|
+
color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
|
|
4234
|
+
font-weight: 500;
|
|
4235
|
+
}
|
|
4236
|
+
.theme-switcher .theme-switcher-buttons {
|
|
4237
|
+
display: flex;
|
|
4238
|
+
background: var(--mm-surface-color, #ffffff);
|
|
4239
|
+
border: 1px solid var(--mm-border-color, rgba(0, 0, 0, 0.12));
|
|
4240
|
+
border-radius: 0.5rem;
|
|
4241
|
+
overflow: hidden;
|
|
4242
|
+
}
|
|
4243
|
+
.theme-switcher .theme-switcher-buttons .btn-flat {
|
|
4244
|
+
display: flex;
|
|
4245
|
+
align-items: center;
|
|
4246
|
+
gap: 0.25rem;
|
|
4247
|
+
padding: 0.5rem 0.75rem;
|
|
4248
|
+
margin: 0;
|
|
4249
|
+
border: none;
|
|
4250
|
+
background: transparent;
|
|
4251
|
+
color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
|
|
4252
|
+
font-size: 0.875rem;
|
|
4253
|
+
border-radius: 0;
|
|
4254
|
+
min-width: auto;
|
|
4255
|
+
height: auto;
|
|
4256
|
+
line-height: 1;
|
|
4257
|
+
text-transform: none;
|
|
4258
|
+
transition: all 0.2s ease;
|
|
4259
|
+
cursor: pointer;
|
|
4260
|
+
}
|
|
4261
|
+
.theme-switcher .theme-switcher-buttons .btn-flat:hover {
|
|
4262
|
+
background: var(--mm-border-color, rgba(0, 0, 0, 0.12));
|
|
4263
|
+
color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
|
|
4264
|
+
}
|
|
4265
|
+
.theme-switcher .theme-switcher-buttons .btn-flat.active {
|
|
4266
|
+
background: var(--mm-primary-color, #26a69a);
|
|
4267
|
+
color: var(--mm-button-text, #ffffff);
|
|
4268
|
+
}
|
|
4269
|
+
.theme-switcher .theme-switcher-buttons .btn-flat.active:hover {
|
|
4270
|
+
background: var(--mm-primary-color-dark, #00695c);
|
|
4271
|
+
}
|
|
4272
|
+
.theme-switcher .theme-switcher-buttons .btn-flat .material-icons {
|
|
4273
|
+
font-size: 1rem;
|
|
4274
|
+
}
|
|
4275
|
+
.theme-switcher .theme-switcher-buttons .btn-flat span {
|
|
4276
|
+
font-size: 0.75rem;
|
|
4277
|
+
font-weight: 500;
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4280
|
+
.theme-toggle {
|
|
4281
|
+
width: 2.5rem;
|
|
4282
|
+
height: 2.5rem;
|
|
4283
|
+
border-radius: 50%;
|
|
4284
|
+
display: flex;
|
|
4285
|
+
align-items: center;
|
|
4286
|
+
justify-content: center;
|
|
4287
|
+
background: var(--mm-surface-color, #ffffff);
|
|
4288
|
+
border: 1px solid var(--mm-border-color, rgba(0, 0, 0, 0.12));
|
|
4289
|
+
color: var(--mm-text-secondary, rgba(0, 0, 0, 0.6));
|
|
4290
|
+
cursor: pointer;
|
|
4291
|
+
transition: all 0.2s ease;
|
|
4292
|
+
}
|
|
4293
|
+
.theme-toggle:hover {
|
|
4294
|
+
background: var(--mm-primary-color, #26a69a);
|
|
4295
|
+
color: var(--mm-button-text, #ffffff);
|
|
4296
|
+
border-color: var(--mm-primary-color, #26a69a);
|
|
4297
|
+
}
|
|
4298
|
+
.theme-toggle .material-icons {
|
|
4299
|
+
font-size: 1.25rem;
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
nav .theme-toggle {
|
|
4303
|
+
background: transparent;
|
|
4304
|
+
border: none;
|
|
4305
|
+
border-radius: 0;
|
|
4306
|
+
width: 64px;
|
|
4307
|
+
height: 64px;
|
|
4308
|
+
}
|
|
4309
|
+
nav .theme-toggle:hover {
|
|
4310
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4311
|
+
border: none;
|
|
4312
|
+
}
|
|
4313
|
+
nav .theme-toggle:focus {
|
|
4314
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4315
|
+
}
|
|
4316
|
+
|
|
4317
|
+
@media (max-width: 600px) {
|
|
4318
|
+
.theme-switcher .theme-switcher-buttons .btn-flat {
|
|
4319
|
+
padding: 0.5rem;
|
|
4320
|
+
}
|
|
4321
|
+
.theme-switcher .theme-switcher-buttons .btn-flat span {
|
|
4322
|
+
display: none;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
package/dist/index.esm.js
CHANGED
|
@@ -874,6 +874,14 @@ const iconPaths = {
|
|
|
874
874
|
'M19 13H5v-2h14v2z', // minus
|
|
875
875
|
'M0 0h24v24H0z', // background
|
|
876
876
|
],
|
|
877
|
+
light_mode: [
|
|
878
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
879
|
+
'M0 0h24v24H0z', // background
|
|
880
|
+
],
|
|
881
|
+
dark_mode: [
|
|
882
|
+
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
883
|
+
'M0 0h24v24H0z', // background
|
|
884
|
+
],
|
|
877
885
|
};
|
|
878
886
|
const MaterialIcon = () => {
|
|
879
887
|
return {
|
|
@@ -7162,20 +7170,23 @@ const ThemeSwitcher = () => {
|
|
|
7162
7170
|
showLabels && m('span.theme-switcher-label', labels.theme),
|
|
7163
7171
|
m('.theme-switcher-buttons', [
|
|
7164
7172
|
m('button.btn-flat', {
|
|
7173
|
+
type: 'button',
|
|
7165
7174
|
class: theme === 'light' ? 'active' : '',
|
|
7166
7175
|
onclick: () => handleThemeChange('light'),
|
|
7167
7176
|
title: labels.lightTitle,
|
|
7168
|
-
}, [m(
|
|
7177
|
+
}, [m(MaterialIcon, { name: 'light_mode' }), showLabels && m('span', labels.light)]),
|
|
7169
7178
|
m('button.btn-flat', {
|
|
7179
|
+
type: 'button',
|
|
7170
7180
|
class: theme === 'auto' ? 'active' : '',
|
|
7171
7181
|
onclick: () => handleThemeChange('auto'),
|
|
7172
7182
|
title: labels.autoTitle,
|
|
7173
7183
|
}, [m('i.material-icons', 'brightness_auto'), showLabels && m('span', labels.auto)]),
|
|
7174
7184
|
m('button.btn-flat', {
|
|
7185
|
+
type: 'button',
|
|
7175
7186
|
class: theme === 'dark' ? 'active' : '',
|
|
7176
7187
|
onclick: () => handleThemeChange('dark'),
|
|
7177
7188
|
title: labels.darkTitle,
|
|
7178
|
-
}, [m(
|
|
7189
|
+
}, [m(MaterialIcon, { name: 'dark_mode' }), showLabels && m('span', labels.dark)]),
|
|
7179
7190
|
]),
|
|
7180
7191
|
]);
|
|
7181
7192
|
},
|
|
@@ -7196,16 +7207,16 @@ const ThemeToggle = () => {
|
|
|
7196
7207
|
const currentTheme = ThemeManager.getEffectiveTheme();
|
|
7197
7208
|
const labels = Object.assign(Object.assign({}, defaultI18n$1), attrs.i18n);
|
|
7198
7209
|
return m('button.btn-flat.theme-toggle', {
|
|
7210
|
+
type: 'button',
|
|
7199
7211
|
class: attrs.className || '',
|
|
7200
7212
|
onclick: () => {
|
|
7201
7213
|
ThemeManager.toggle();
|
|
7202
7214
|
},
|
|
7203
7215
|
title: currentTheme === 'light' ? labels.switchToDark : labels.switchToLight,
|
|
7204
|
-
style: 'margin: 0; height: 64px; line-height: 64px; border-radius: 0; min-width: 64px; padding: 0;',
|
|
7205
7216
|
}, [
|
|
7206
|
-
m(
|
|
7207
|
-
|
|
7208
|
-
}
|
|
7217
|
+
m(MaterialIcon, {
|
|
7218
|
+
name: currentTheme === 'light' ? 'dark_mode' : 'light_mode',
|
|
7219
|
+
}),
|
|
7209
7220
|
]);
|
|
7210
7221
|
},
|
|
7211
7222
|
};
|
package/dist/index.js
CHANGED
|
@@ -876,6 +876,14 @@ const iconPaths = {
|
|
|
876
876
|
'M19 13H5v-2h14v2z', // minus
|
|
877
877
|
'M0 0h24v24H0z', // background
|
|
878
878
|
],
|
|
879
|
+
light_mode: [
|
|
880
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
881
|
+
'M0 0h24v24H0z', // background
|
|
882
|
+
],
|
|
883
|
+
dark_mode: [
|
|
884
|
+
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
885
|
+
'M0 0h24v24H0z', // background
|
|
886
|
+
],
|
|
879
887
|
};
|
|
880
888
|
const MaterialIcon = () => {
|
|
881
889
|
return {
|
|
@@ -7164,20 +7172,23 @@ const ThemeSwitcher = () => {
|
|
|
7164
7172
|
showLabels && m('span.theme-switcher-label', labels.theme),
|
|
7165
7173
|
m('.theme-switcher-buttons', [
|
|
7166
7174
|
m('button.btn-flat', {
|
|
7175
|
+
type: 'button',
|
|
7167
7176
|
class: theme === 'light' ? 'active' : '',
|
|
7168
7177
|
onclick: () => handleThemeChange('light'),
|
|
7169
7178
|
title: labels.lightTitle,
|
|
7170
|
-
}, [m(
|
|
7179
|
+
}, [m(MaterialIcon, { name: 'light_mode' }), showLabels && m('span', labels.light)]),
|
|
7171
7180
|
m('button.btn-flat', {
|
|
7181
|
+
type: 'button',
|
|
7172
7182
|
class: theme === 'auto' ? 'active' : '',
|
|
7173
7183
|
onclick: () => handleThemeChange('auto'),
|
|
7174
7184
|
title: labels.autoTitle,
|
|
7175
7185
|
}, [m('i.material-icons', 'brightness_auto'), showLabels && m('span', labels.auto)]),
|
|
7176
7186
|
m('button.btn-flat', {
|
|
7187
|
+
type: 'button',
|
|
7177
7188
|
class: theme === 'dark' ? 'active' : '',
|
|
7178
7189
|
onclick: () => handleThemeChange('dark'),
|
|
7179
7190
|
title: labels.darkTitle,
|
|
7180
|
-
}, [m(
|
|
7191
|
+
}, [m(MaterialIcon, { name: 'dark_mode' }), showLabels && m('span', labels.dark)]),
|
|
7181
7192
|
]),
|
|
7182
7193
|
]);
|
|
7183
7194
|
},
|
|
@@ -7198,16 +7209,16 @@ const ThemeToggle = () => {
|
|
|
7198
7209
|
const currentTheme = ThemeManager.getEffectiveTheme();
|
|
7199
7210
|
const labels = Object.assign(Object.assign({}, defaultI18n$1), attrs.i18n);
|
|
7200
7211
|
return m('button.btn-flat.theme-toggle', {
|
|
7212
|
+
type: 'button',
|
|
7201
7213
|
class: attrs.className || '',
|
|
7202
7214
|
onclick: () => {
|
|
7203
7215
|
ThemeManager.toggle();
|
|
7204
7216
|
},
|
|
7205
7217
|
title: currentTheme === 'light' ? labels.switchToDark : labels.switchToLight,
|
|
7206
|
-
style: 'margin: 0; height: 64px; line-height: 64px; border-radius: 0; min-width: 64px; padding: 0;',
|
|
7207
7218
|
}, [
|
|
7208
|
-
m(
|
|
7209
|
-
|
|
7210
|
-
}
|
|
7219
|
+
m(MaterialIcon, {
|
|
7220
|
+
name: currentTheme === 'light' ? 'dark_mode' : 'light_mode',
|
|
7221
|
+
}),
|
|
7211
7222
|
]);
|
|
7212
7223
|
},
|
|
7213
7224
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -878,6 +878,14 @@
|
|
|
878
878
|
'M19 13H5v-2h14v2z', // minus
|
|
879
879
|
'M0 0h24v24H0z', // background
|
|
880
880
|
],
|
|
881
|
+
light_mode: [
|
|
882
|
+
'M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z',
|
|
883
|
+
'M0 0h24v24H0z', // background
|
|
884
|
+
],
|
|
885
|
+
dark_mode: [
|
|
886
|
+
'M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z',
|
|
887
|
+
'M0 0h24v24H0z', // background
|
|
888
|
+
],
|
|
881
889
|
};
|
|
882
890
|
const MaterialIcon = () => {
|
|
883
891
|
return {
|
|
@@ -7166,20 +7174,23 @@
|
|
|
7166
7174
|
showLabels && m('span.theme-switcher-label', labels.theme),
|
|
7167
7175
|
m('.theme-switcher-buttons', [
|
|
7168
7176
|
m('button.btn-flat', {
|
|
7177
|
+
type: 'button',
|
|
7169
7178
|
class: theme === 'light' ? 'active' : '',
|
|
7170
7179
|
onclick: () => handleThemeChange('light'),
|
|
7171
7180
|
title: labels.lightTitle,
|
|
7172
|
-
}, [m(
|
|
7181
|
+
}, [m(MaterialIcon, { name: 'light_mode' }), showLabels && m('span', labels.light)]),
|
|
7173
7182
|
m('button.btn-flat', {
|
|
7183
|
+
type: 'button',
|
|
7174
7184
|
class: theme === 'auto' ? 'active' : '',
|
|
7175
7185
|
onclick: () => handleThemeChange('auto'),
|
|
7176
7186
|
title: labels.autoTitle,
|
|
7177
7187
|
}, [m('i.material-icons', 'brightness_auto'), showLabels && m('span', labels.auto)]),
|
|
7178
7188
|
m('button.btn-flat', {
|
|
7189
|
+
type: 'button',
|
|
7179
7190
|
class: theme === 'dark' ? 'active' : '',
|
|
7180
7191
|
onclick: () => handleThemeChange('dark'),
|
|
7181
7192
|
title: labels.darkTitle,
|
|
7182
|
-
}, [m(
|
|
7193
|
+
}, [m(MaterialIcon, { name: 'dark_mode' }), showLabels && m('span', labels.dark)]),
|
|
7183
7194
|
]),
|
|
7184
7195
|
]);
|
|
7185
7196
|
},
|
|
@@ -7200,16 +7211,16 @@
|
|
|
7200
7211
|
const currentTheme = ThemeManager.getEffectiveTheme();
|
|
7201
7212
|
const labels = Object.assign(Object.assign({}, defaultI18n$1), attrs.i18n);
|
|
7202
7213
|
return m('button.btn-flat.theme-toggle', {
|
|
7214
|
+
type: 'button',
|
|
7203
7215
|
class: attrs.className || '',
|
|
7204
7216
|
onclick: () => {
|
|
7205
7217
|
ThemeManager.toggle();
|
|
7206
7218
|
},
|
|
7207
7219
|
title: currentTheme === 'light' ? labels.switchToDark : labels.switchToLight,
|
|
7208
|
-
style: 'margin: 0; height: 64px; line-height: 64px; border-radius: 0; min-width: 64px; padding: 0;',
|
|
7209
7220
|
}, [
|
|
7210
|
-
m(
|
|
7211
|
-
|
|
7212
|
-
}
|
|
7221
|
+
m(MaterialIcon, {
|
|
7222
|
+
name: currentTheme === 'light' ? 'dark_mode' : 'light_mode',
|
|
7223
|
+
}),
|
|
7213
7224
|
]);
|
|
7214
7225
|
},
|
|
7215
7226
|
};
|
package/dist/material-icon.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ declare const iconPaths: {
|
|
|
5
5
|
readonly chevron: readonly ["M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z", "M0 0h24v24H0z"];
|
|
6
6
|
readonly expand: readonly ["M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", "M0 0h24v24H0z"];
|
|
7
7
|
readonly collapse: readonly ["M19 13H5v-2h14v2z", "M0 0h24v24H0z"];
|
|
8
|
+
readonly light_mode: readonly ["M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.4 12.4a.996.996 0 0 0-1.41 0 .996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41zm1.06-11a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.4a.996.996 0 0 0 0-1.41.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z", "M0 0h24v24H0z"];
|
|
9
|
+
readonly dark_mode: readonly ["M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-4.4 2.26 5.4 5.4 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z", "M0 0h24v24H0z"];
|
|
8
10
|
};
|
|
9
11
|
type IconName = keyof typeof iconPaths;
|
|
10
12
|
export interface MaterialIconAttrs extends Attributes {
|