@shortfuse/materialdesignweb 0.2.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.
- package/.browserslistrc +2 -1
- package/.eslintrc.json +188 -30
- package/.stylelintrc.json +643 -2
- package/.vscode/launch.json +20 -5
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +36 -0
- package/README.md +82 -2
- package/adapters/datatable/column.js +176 -0
- package/adapters/datatable/index.js +253 -437
- package/adapters/dom/index.js +586 -0
- package/adapters/list/index.js +36 -113
- package/adapters/search/index.js +153 -180
- package/components/appbar/_spec.scss +165 -0
- package/components/appbar/_theme.scss +0 -0
- package/components/appbar/index.scss +2 -0
- package/components/banner/_spec.scss +83 -0
- package/components/banner/_theme.scss +0 -0
- package/components/banner/index.scss +2 -0
- package/components/bottomnav/README.md +4 -4
- package/components/bottomnav/_spec.scss +149 -0
- package/components/bottomnav/_theme.scss +0 -0
- package/components/bottomnav/index.js +100 -120
- package/components/bottomnav/index.scss +2 -0
- package/components/bottomnav/item.js +88 -0
- package/components/button/README.md +16 -22
- package/components/button/_spec.scss +162 -0
- package/components/button/_theme.scss +42 -0
- package/components/button/index.eta +32 -0
- package/components/button/index.js +37 -48
- package/components/button/index.pug +18 -0
- package/components/button/index.scss +2 -0
- package/components/card/_spec.scss +241 -0
- package/components/card/_theme.scss +0 -0
- package/components/card/index.scss +2 -0
- package/components/chip/_spec.scss +111 -0
- package/components/chip/_theme.scss +105 -0
- package/components/chip/index.js +23 -0
- package/components/chip/index.scss +2 -0
- package/components/chip/item.js +20 -0
- package/components/datatable/_spec.scss +225 -0
- package/components/datatable/_theme.scss +128 -0
- package/components/datatable/cell.js +44 -0
- package/components/datatable/columnheader.js +46 -0
- package/components/datatable/index.js +339 -443
- package/components/datatable/index.scss +2 -0
- package/components/datatable/row.js +48 -0
- package/components/datatable/rowheader.js +18 -0
- package/components/dialog/_spec.scss +203 -0
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +512 -437
- package/components/dialog/index.scss +2 -0
- package/components/divider/_spec.scss +11 -0
- package/components/divider/_theme.scss +0 -0
- package/components/divider/index.scss +2 -0
- package/components/elevation/_spec.scss +9 -0
- package/components/elevation/_theme.scss +0 -0
- package/components/elevation/index.scss +2 -0
- package/components/fab/{style.scss → _spec.scss} +104 -79
- package/components/fab/_theme.scss +0 -0
- package/components/fab/index.js +85 -79
- package/components/fab/index.scss +2 -0
- package/components/grid/_spec.scss +169 -0
- package/components/grid/_theme.scss +0 -0
- package/components/grid/index.scss +2 -0
- package/components/layout/_mixins.scss +11 -0
- package/components/layout/_spec.scss +916 -0
- package/components/layout/_theme.scss +19 -0
- package/components/layout/index.js +454 -0
- package/components/layout/index.scss +2 -0
- package/components/list/_spec.scss +363 -0
- package/components/list/_theme.scss +102 -0
- package/components/list/content.js +106 -0
- package/components/list/index.js +234 -79
- package/components/list/index.scss +2 -0
- package/components/list/item.js +167 -0
- package/components/list/secondary.js +45 -0
- package/components/menu/_spec.scss +329 -0
- package/components/menu/_theme.scss +0 -0
- package/components/menu/index.js +636 -651
- package/components/menu/index.scss +2 -0
- package/components/menu/item.js +231 -0
- package/components/progress/_spec.scss +156 -0
- package/components/progress/_theme.scss +0 -0
- package/components/progress/index.js +29 -13
- package/components/progress/index.scss +2 -0
- package/components/selection/_spec.scss +376 -0
- package/components/selection/_theme.scss +134 -0
- package/components/selection/index.eta +60 -0
- package/components/selection/index.js +70 -0
- package/components/selection/index.pug +30 -0
- package/components/selection/index.scss +2 -0
- package/components/selection/input.js +54 -0
- package/components/selection/radiogroup.js +40 -0
- package/components/slider/{style.scss → _spec.scss} +31 -34
- package/components/slider/_theme.scss +0 -0
- package/components/slider/index.scss +2 -0
- package/components/snackbar/_spec.scss +150 -0
- package/components/snackbar/_theme.scss +0 -0
- package/components/snackbar/index.js +293 -206
- package/components/snackbar/index.scss +2 -0
- package/components/tab/_spec.scss +220 -0
- package/components/tab/_theme.scss +0 -0
- package/components/tab/content.js +210 -0
- package/components/tab/index.js +229 -213
- package/components/tab/index.scss +2 -0
- package/components/tab/item.js +88 -0
- package/components/tab/list.js +196 -0
- package/components/tab/panel.js +54 -0
- package/components/textfield/README.md +4 -4
- package/components/textfield/_spec.scss +763 -0
- package/components/textfield/_theme.scss +264 -0
- package/components/textfield/index.eta +74 -0
- package/components/textfield/index.js +132 -138
- package/components/textfield/index.pug +30 -0
- package/components/textfield/index.scss +2 -0
- package/components/tooltip/_spec.scss +185 -0
- package/components/tooltip/_theme.scss +0 -0
- package/components/tooltip/index.scss +2 -0
- package/components/type/_spec.scss +227 -0
- package/components/type/_theme.scss +0 -0
- package/components/type/index.scss +2 -0
- package/core/_breakpoint.scss +189 -0
- package/core/_elevation.scss +78 -0
- package/core/_length.scss +8 -0
- package/core/_motion.scss +31 -0
- package/core/_platform.scss +12 -0
- package/core/_type.scss +128 -0
- package/core/aria/attributes.js +141 -0
- package/core/aria/button.js +49 -0
- package/core/aria/keyboard.js +92 -0
- package/core/aria/rovingtabindex.js +175 -0
- package/core/aria/tab.js +59 -0
- package/core/document/index.js +39 -0
- package/core/dom.js +180 -0
- package/core/overlay/_spec.scss +28 -0
- package/core/overlay/_theme.scss +147 -0
- package/core/overlay/index.js +95 -0
- package/core/overlay/index.scss +2 -0
- package/core/ripple/_spec.scss +196 -0
- package/core/ripple/_theme.scss +20 -0
- package/core/ripple/index.js +286 -0
- package/core/ripple/index.scss +2 -0
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -0
- package/core/theme/_functions.scss +22 -0
- package/{components/theming/palettes.scss → core/theme/_palettes.scss} +173 -151
- package/core/theme/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.js +50 -0
- package/core/theme/index.scss +4 -0
- package/core/throttler.js +42 -0
- package/core/transition/index.js +465 -0
- package/docs/_flex.scss +28 -0
- package/docs/_menuoptions.js +183 -0
- package/docs/_partials/_androidnavbar.eta +5 -0
- package/docs/_partials/_androidstatusbar.eta +13 -0
- package/docs/_partials/_appbar.eta +27 -0
- package/docs/_partials/_buttontest.eta +31 -0
- package/docs/_partials/_header.eta +146 -0
- package/docs/_partials/_navlistitem.eta +16 -0
- package/docs/_partials/_target.eta +1 -0
- package/docs/_sample-utils.js +88 -0
- package/docs/{src/storage.js → _storage.js} +0 -0
- package/docs/docs.scss +331 -0
- package/docs/framework.scss +26 -0
- package/docs/index.eta +12 -0
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +108 -0
- package/docs/pages/appbar.js +0 -0
- package/docs/pages/bottomnav.eta +188 -0
- package/docs/pages/bottomnav.js +118 -0
- package/docs/pages/button.eta +124 -0
- package/docs/pages/button.js +224 -0
- package/docs/pages/card.eta +90 -0
- package/docs/pages/card.js +175 -0
- package/docs/pages/chip.eta +122 -0
- package/docs/pages/chip.js +80 -0
- package/docs/pages/color.eta +143 -0
- package/docs/pages/color.js +261 -0
- package/docs/pages/datatable.eta +323 -0
- package/docs/pages/datatable.js +160 -0
- package/docs/pages/dialog.eta +184 -0
- package/docs/{src/components → pages}/dialog.js +35 -48
- package/docs/pages/dom.eta +26 -0
- package/docs/pages/dom.js +140 -0
- package/docs/pages/elevation.eta +35 -0
- package/docs/pages/elevation.js +0 -0
- package/docs/pages/fab.eta +99 -0
- package/docs/{src/components → pages}/fab.js +6 -13
- package/docs/pages/grid.eta +135 -0
- package/docs/pages/grid.js +128 -0
- package/docs/pages/layout.eta +8 -0
- package/docs/pages/layout.js +0 -0
- package/docs/pages/list.eta +465 -0
- package/docs/pages/list.js +8 -0
- package/docs/pages/menu.eta +274 -0
- package/docs/{src/components → pages}/menu.js +26 -42
- package/docs/pages/overlay.eta +69 -0
- package/docs/pages/overlay.js +3 -0
- package/docs/pages/progress.eta +23 -0
- package/docs/{src/components → pages}/progress.js +2 -4
- package/docs/pages/ripple.eta +27 -0
- package/docs/pages/ripple.js +3 -0
- package/docs/pages/search.eta +242 -0
- package/docs/pages/search.js +226 -0
- package/docs/pages/selection.eta +107 -0
- package/docs/pages/selection.js +12 -0
- package/docs/pages/slider.eta +23 -0
- package/docs/pages/slider.js +0 -0
- package/docs/pages/snackbar.eta +83 -0
- package/docs/{src/components → pages}/snackbar.js +31 -36
- package/docs/pages/tab.eta +407 -0
- package/docs/pages/tab.js +152 -0
- package/docs/pages/textfield.eta +487 -0
- package/docs/{src/components → pages}/textfield.js +41 -45
- package/docs/pages/tooltip.eta +92 -0
- package/docs/pages/tooltip.js +0 -0
- package/docs/pages/transition.eta +117 -0
- package/docs/pages/transition.js +52 -0
- package/docs/pages/type.eta +31 -0
- package/docs/pages/type.js +0 -0
- package/docs/postrender.js +41 -0
- package/docs/prerender.js +16 -0
- package/docs/pwa/_dialogs.eta +143 -0
- package/docs/pwa/_menus.eta +16 -0
- package/docs/pwa/pwa-prerender.js +3 -0
- package/docs/pwa/pwa.eta +478 -0
- package/docs/pwa/pwa.js +298 -0
- package/docs/pwa/pwa.scss +31 -0
- package/docs/themes/theme-colored.scss +15 -0
- package/docs/themes/theme-default.scss +3 -0
- package/index.scss +27 -0
- package/jsconfig.json +8 -2
- package/package.json +54 -27
- package/scripts/deploy-docs.sh +9 -0
- package/templates/index.eta +2 -0
- package/templates/index.pug +3 -0
- package/tsconfig.json +16 -0
- package/utils/function.js +3 -0
- package/webpack.config.js +224 -68
- package/_index.scss +0 -4
- package/components/all-components.scss +0 -21
- package/components/bottomnav/style.scss +0 -190
- package/components/bottomnav/theming.scss +0 -76
- package/components/button/style.scss +0 -315
- package/components/button/theming.scss +0 -134
- package/components/card/style.scss +0 -175
- package/components/card/theming.scss +0 -43
- package/components/common/dom.js +0 -51
- package/components/common/functions.scss +0 -174
- package/components/common/mixins.scss +0 -122
- package/components/common/motion.scss +0 -36
- package/components/common/type.scss +0 -104
- package/components/common/variables.scss +0 -46
- package/components/datatable/style.scss +0 -257
- package/components/datatable/theming.scss +0 -119
- package/components/dialog/style.scss +0 -159
- package/components/dialog/theming.scss +0 -29
- package/components/divider/style.scss +0 -7
- package/components/divider/theming.scss +0 -20
- package/components/elevation/style.scss +0 -32
- package/components/layout/style.scss +0 -223
- package/components/list/style.scss +0 -358
- package/components/list/theming.scss +0 -83
- package/components/menu/style.scss +0 -280
- package/components/menu/theming.scss +0 -80
- package/components/navdrawer/index.js +0 -200
- package/components/navdrawer/style.scss +0 -595
- package/components/navdrawer/theming.scss +0 -62
- package/components/progress/style.scss +0 -136
- package/components/ripple/index.js +0 -63
- package/components/ripple/ripple.scss +0 -122
- package/components/selection/style.scss +0 -320
- package/components/selection/theming.scss +0 -98
- package/components/snackbar/style.scss +0 -212
- package/components/switch/style.scss +0 -3
- package/components/tab/style.scss +0 -275
- package/components/tab/theming.scss +0 -34
- package/components/template/theming.scss +0 -31
- package/components/textfield/style.scss +0 -795
- package/components/textfield/theming.scss +0 -256
- package/components/theming/globals.scss +0 -25
- package/components/theming/theming.scss +0 -559
- package/components/toolbar/style.scss +0 -190
- package/components/toolbar/theming.scss +0 -32
- package/components/tooltip/style.scss +0 -135
- package/components/type/style.scss +0 -167
- package/components/type/theming.scss +0 -25
- package/docs/bottomnav.html +0 -1
- package/docs/bottomnav.min.js +0 -2
- package/docs/bottomnav.min.js.map +0 -1
- package/docs/button.html +0 -1
- package/docs/button.min.js +0 -2
- package/docs/button.min.js.map +0 -1
- package/docs/card.html +0 -1
- package/docs/card.min.js +0 -2
- package/docs/card.min.js.map +0 -1
- package/docs/components.min.css +0 -1
- package/docs/components.min.js +0 -2
- package/docs/components.min.js.map +0 -1
- package/docs/datatable.html +0 -1
- package/docs/datatable.min.js +0 -2
- package/docs/datatable.min.js.map +0 -1
- package/docs/dialog.html +0 -1
- package/docs/dialog.min.js +0 -2
- package/docs/dialog.min.js.map +0 -1
- package/docs/docs.min.css +0 -1
- package/docs/docs.min.js +0 -2
- package/docs/docs.min.js.map +0 -1
- package/docs/elevation.html +0 -1
- package/docs/elevation.min.js +0 -2
- package/docs/elevation.min.js.map +0 -1
- package/docs/fab.html +0 -1
- package/docs/fab.min.js +0 -2
- package/docs/fab.min.js.map +0 -1
- package/docs/index.html +0 -1
- package/docs/index.min.js +0 -2
- package/docs/index.min.js.map +0 -1
- package/docs/layout.html +0 -1
- package/docs/layout.min.js +0 -2
- package/docs/layout.min.js.map +0 -1
- package/docs/list.html +0 -1
- package/docs/list.min.js +0 -2
- package/docs/list.min.js.map +0 -1
- package/docs/menu.html +0 -1
- package/docs/menu.min.js +0 -2
- package/docs/menu.min.js.map +0 -1
- package/docs/navdrawer.html +0 -1
- package/docs/navdrawer.min.js +0 -2
- package/docs/navdrawer.min.js.map +0 -1
- package/docs/prerender.min.js +0 -2
- package/docs/prerender.min.js.map +0 -1
- package/docs/progress.html +0 -1
- package/docs/progress.min.js +0 -2
- package/docs/progress.min.js.map +0 -1
- package/docs/search.html +0 -1
- package/docs/search.min.js +0 -2
- package/docs/search.min.js.map +0 -1
- package/docs/selection.html +0 -1
- package/docs/selection.min.js +0 -2
- package/docs/selection.min.js.map +0 -1
- package/docs/slider.html +0 -1
- package/docs/slider.min.js +0 -2
- package/docs/slider.min.js.map +0 -1
- package/docs/snackbar.html +0 -1
- package/docs/snackbar.min.js +0 -2
- package/docs/snackbar.min.js.map +0 -1
- package/docs/src/components/bottomnav.js +0 -16
- package/docs/src/components/bottomnav.pug +0 -112
- package/docs/src/components/button.js +0 -156
- package/docs/src/components/button.pug +0 -194
- package/docs/src/components/card.js +0 -136
- package/docs/src/components/card.pug +0 -133
- package/docs/src/components/datatable.js +0 -183
- package/docs/src/components/datatable.pug +0 -324
- package/docs/src/components/dialog.pug +0 -138
- package/docs/src/components/elevation.js +0 -3
- package/docs/src/components/elevation.pug +0 -17
- package/docs/src/components/fab.pug +0 -84
- package/docs/src/components/layout.js +0 -116
- package/docs/src/components/layout.pug +0 -104
- package/docs/src/components/list.js +0 -15
- package/docs/src/components/list.pug +0 -293
- package/docs/src/components/menu.pug +0 -292
- package/docs/src/components/navdrawer.js +0 -112
- package/docs/src/components/navdrawer.pug +0 -113
- package/docs/src/components/progress.pug +0 -17
- package/docs/src/components/search.js +0 -206
- package/docs/src/components/search.pug +0 -149
- package/docs/src/components/selection.js +0 -6
- package/docs/src/components/selection.pug +0 -116
- package/docs/src/components/slider.js +0 -3
- package/docs/src/components/slider.pug +0 -19
- package/docs/src/components/snackbar.pug +0 -145
- package/docs/src/components/tab.js +0 -137
- package/docs/src/components/tab.pug +0 -329
- package/docs/src/components/textfield.pug +0 -416
- package/docs/src/components/toolbar.js +0 -6
- package/docs/src/components/toolbar.pug +0 -86
- package/docs/src/components/tooltip.js +0 -6
- package/docs/src/components/tooltip.pug +0 -76
- package/docs/src/components/type.js +0 -6
- package/docs/src/components/type.pug +0 -34
- package/docs/src/components.scss +0 -1
- package/docs/src/docs.scss +0 -284
- package/docs/src/index.js +0 -3
- package/docs/src/index.pug +0 -6
- package/docs/src/menuoptions.js +0 -136
- package/docs/src/mixins.pug +0 -139
- package/docs/src/prerender.js +0 -26
- package/docs/src/sample-utils.js +0 -108
- package/docs/src/targetHandler.js +0 -50
- package/docs/src/theming.ie11.scss +0 -18
- package/docs/src/theming.scss +0 -18
- package/docs/tab.html +0 -1
- package/docs/tab.min.js +0 -2
- package/docs/tab.min.js.map +0 -1
- package/docs/textfield.html +0 -2
- package/docs/textfield.min.js +0 -2
- package/docs/textfield.min.js.map +0 -1
- package/docs/theming.ie11.min.css +0 -1
- package/docs/theming.ie11.min.js +0 -2
- package/docs/theming.ie11.min.js.map +0 -1
- package/docs/theming.min.css +0 -1
- package/docs/theming.min.js +0 -2
- package/docs/theming.min.js.map +0 -1
- package/docs/toolbar.html +0 -1
- package/docs/toolbar.min.js +0 -2
- package/docs/toolbar.min.js.map +0 -1
- package/docs/tooltip.html +0 -1
- package/docs/tooltip.min.js +0 -2
- package/docs/tooltip.min.js.map +0 -1
- package/docs/type.html +0 -1
- package/docs/type.min.js +0 -2
- package/docs/type.min.js.map +0 -1
- package/index.js +0 -16
package/docs/pwa/pwa.js
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import * as Button from '../../components/button/index.js';
|
|
2
|
+
import * as Dialog from '../../components/dialog/index.js';
|
|
3
|
+
import * as Layout from '../../components/layout/index.js';
|
|
4
|
+
import * as ListContent from '../../components/list/content.js';
|
|
5
|
+
import * as List from '../../components/list/index.js';
|
|
6
|
+
import * as ListSecondary from '../../components/list/secondary.js';
|
|
7
|
+
import * as Menu from '../../components/menu/index.js';
|
|
8
|
+
import * as Selection from '../../components/selection/index.js';
|
|
9
|
+
import * as SelectionRadioGroup from '../../components/selection/radiogroup.js';
|
|
10
|
+
import * as Snackbar from '../../components/snackbar/index.js';
|
|
11
|
+
import * as Attributes from '../../core/aria/attributes.js';
|
|
12
|
+
import * as Overlay from '../../core/overlay/index.js';
|
|
13
|
+
import * as Ripple from '../../core/ripple/index.js';
|
|
14
|
+
|
|
15
|
+
/** @type {Element} */
|
|
16
|
+
let checkedAutoHideItem;
|
|
17
|
+
/** @type {Element} */
|
|
18
|
+
let checkedFabMobileItem;
|
|
19
|
+
/** @type {Element} */
|
|
20
|
+
let checkedFabDesktopItem;
|
|
21
|
+
|
|
22
|
+
Layout.attach();
|
|
23
|
+
|
|
24
|
+
/** @return {void} */
|
|
25
|
+
function initializeSampleComponents() {
|
|
26
|
+
for (const element of document.getElementsByClassName('mdw-overlay')) { Overlay.attach(element); }
|
|
27
|
+
for (const element of document.getElementsByClassName('mdw-ripple')) { Ripple.attach(element); }
|
|
28
|
+
for (const element of document.getElementsByClassName('mdw-button')) { Button.attach(element); }
|
|
29
|
+
for (const element of document.getElementsByClassName('mdw-selection__radio-group')) { SelectionRadioGroup.attach(element); }
|
|
30
|
+
for (const element of document.getElementsByClassName('mdw-selection')) { Selection.attach(element); }
|
|
31
|
+
for (const element of document.getElementsByClassName('mdw-list')) { List.attach(element); }
|
|
32
|
+
for (const element of document.getElementsByClassName('mdw-dialog')) { Dialog.attach(element); }
|
|
33
|
+
for (const element of document.getElementsByClassName('mdw-menu')) { Menu.attach(element); }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} name
|
|
38
|
+
* @return {Element}
|
|
39
|
+
*/
|
|
40
|
+
function getListContentElementByName(name) {
|
|
41
|
+
return document.querySelector(`[data-name="${name}"]`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {string} name
|
|
46
|
+
* @return {string}
|
|
47
|
+
*/
|
|
48
|
+
function getCheckedValue(name) {
|
|
49
|
+
/** @type {HTMLElement} */
|
|
50
|
+
const el = document.querySelector(`[data-name="${name}"][aria-checked="true"]`);
|
|
51
|
+
return el.dataset.value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {string} name
|
|
56
|
+
* @return {boolean}
|
|
57
|
+
*/
|
|
58
|
+
function getIsChecked(name) {
|
|
59
|
+
return Attributes.isChecked(getListContentElementByName(name));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** @return {void} */
|
|
63
|
+
function refreshFabCut() {
|
|
64
|
+
const enabled = getIsChecked('use-fab-mobile') && getIsChecked('fab-cut');
|
|
65
|
+
if (!enabled) {
|
|
66
|
+
Layout.getAppBarElement().removeAttribute('mdw-fab-cut');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const shown = getIsChecked('fab-show');
|
|
70
|
+
const alignment = getCheckedValue('fab-mobile');
|
|
71
|
+
Layout.getAppBarElement().setAttribute('mdw-fab-cut', [shown ? 'open' : '', alignment].join(' ').trim());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** @return {void} */
|
|
75
|
+
function updateAutoHideOption() {
|
|
76
|
+
const switchItem = document.querySelector('[data-name="use-appbar-autohide"]');
|
|
77
|
+
const descriptionElement = switchItem.querySelector('.mdw-list__text-line:nth-child(2)');
|
|
78
|
+
const oldDescription = descriptionElement.textContent;
|
|
79
|
+
let newDescription = 'Off';
|
|
80
|
+
if (switchItem.getAttribute('aria-checked') === 'true') {
|
|
81
|
+
/** @type {HTMLElement} */
|
|
82
|
+
const checkedItem = document.querySelector('[data-name="appbar-autohide"][aria-checked="true"]');
|
|
83
|
+
newDescription = checkedItem.querySelector('.mdw-list__text-line').textContent;
|
|
84
|
+
Layout.getAppBarElement().setAttribute('mdw-autohide', checkedItem.dataset.value);
|
|
85
|
+
} else {
|
|
86
|
+
Layout.getAppBarElement().removeAttribute('mdw-autohide');
|
|
87
|
+
}
|
|
88
|
+
if (newDescription !== oldDescription) {
|
|
89
|
+
Layout.resetScroll();
|
|
90
|
+
descriptionElement.textContent = newDescription;
|
|
91
|
+
Snackbar.create({
|
|
92
|
+
text: `Auto hide is set to: ${newDescription}.`,
|
|
93
|
+
parent: document.getElementsByClassName('mdw-snackbar__container')[0],
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @return {void} */
|
|
99
|
+
function updateFabMobileOption() {
|
|
100
|
+
const switchItem = document.querySelector('[data-name="use-fab-mobile"]');
|
|
101
|
+
const descriptionElement = switchItem.querySelector('.mdw-list__text-line:nth-child(2)');
|
|
102
|
+
const oldDescription = descriptionElement.textContent;
|
|
103
|
+
let newDescription = 'Off';
|
|
104
|
+
if (switchItem.getAttribute('aria-checked') === 'true') {
|
|
105
|
+
/** @type {HTMLElement} */
|
|
106
|
+
const checkedItem = document.querySelector('[data-name="fab-mobile"][aria-checked="true"]');
|
|
107
|
+
newDescription = checkedItem.querySelector('.mdw-list__text-line').textContent;
|
|
108
|
+
document.getElementsByClassName('mdw-layout__fab')[0].setAttribute('mdw-mobile', checkedItem.dataset.value);
|
|
109
|
+
} else {
|
|
110
|
+
document.getElementsByClassName('mdw-layout__fab')[0].removeAttribute('mdw-mobile');
|
|
111
|
+
}
|
|
112
|
+
if (newDescription !== oldDescription) {
|
|
113
|
+
refreshFabCut();
|
|
114
|
+
descriptionElement.textContent = newDescription;
|
|
115
|
+
Snackbar.create({
|
|
116
|
+
text: `Mobile Fab is set to: ${newDescription}.`,
|
|
117
|
+
parent: document.getElementsByClassName('mdw-snackbar__container')[0],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @return {void} */
|
|
123
|
+
function updateFabDesktopOption() {
|
|
124
|
+
const switchItem = document.querySelector('[data-name="use-fab-desktop"]');
|
|
125
|
+
const descriptionElement = switchItem.querySelector('.mdw-list__text-line:nth-child(2)');
|
|
126
|
+
const oldDescription = descriptionElement.textContent;
|
|
127
|
+
let newDescription = 'Off';
|
|
128
|
+
if (switchItem.getAttribute('aria-checked') === 'true') {
|
|
129
|
+
/** @type {HTMLElement} */
|
|
130
|
+
const checkedItem = document.querySelector('[data-name="fab-desktop"][aria-checked="true"]');
|
|
131
|
+
newDescription = checkedItem.querySelector('.mdw-list__text-line').textContent;
|
|
132
|
+
document.getElementsByClassName('mdw-layout__fab')[0].setAttribute('mdw-desktop', checkedItem.dataset.value);
|
|
133
|
+
} else {
|
|
134
|
+
document.getElementsByClassName('mdw-layout__fab')[0].removeAttribute('mdw-desktop');
|
|
135
|
+
}
|
|
136
|
+
if (newDescription !== oldDescription) {
|
|
137
|
+
descriptionElement.textContent = newDescription;
|
|
138
|
+
Snackbar.create({
|
|
139
|
+
text: `Desktop Fab is set to: ${newDescription}.`,
|
|
140
|
+
parent: document.getElementsByClassName('mdw-snackbar__container')[0],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @param {CustomEvent} event
|
|
147
|
+
* @return {void}
|
|
148
|
+
*/
|
|
149
|
+
function onCheckChange(event) {
|
|
150
|
+
const listContentElement = /** @type {HTMLElement} */ (event.target);
|
|
151
|
+
const checked = event.detail.value === 'true';
|
|
152
|
+
const { name, value } = listContentElement.dataset;
|
|
153
|
+
switch (name) {
|
|
154
|
+
case 'use-appbar-autohide':
|
|
155
|
+
updateAutoHideOption();
|
|
156
|
+
break;
|
|
157
|
+
case 'use-fab-mobile':
|
|
158
|
+
updateFabMobileOption();
|
|
159
|
+
break;
|
|
160
|
+
case 'use-fab-desktop':
|
|
161
|
+
updateFabDesktopOption();
|
|
162
|
+
break;
|
|
163
|
+
case 'appbar-autohide':
|
|
164
|
+
Layout.getAppBarElement().setAttribute('mdw-autohide', value);
|
|
165
|
+
break;
|
|
166
|
+
case 'appbar-autoraise':
|
|
167
|
+
if (checked) {
|
|
168
|
+
Layout.getAppBarElement().setAttribute('mdw-autoraise', '');
|
|
169
|
+
} else {
|
|
170
|
+
Layout.getAppBarElement().removeAttribute('mdw-autoraise');
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
case 'appbar-bottom':
|
|
174
|
+
if (checked) {
|
|
175
|
+
Layout.getAppBarElement().setAttribute('mdw-bottom', '');
|
|
176
|
+
getListContentElementByName('fab-cut').setAttribute('aria-disabled', 'false');
|
|
177
|
+
} else {
|
|
178
|
+
Layout.getAppBarElement().removeAttribute('mdw-bottom');
|
|
179
|
+
getListContentElementByName('fab-cut').setAttribute('aria-disabled', 'true');
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
case 'appbar-autoprominent':
|
|
183
|
+
if (checked) {
|
|
184
|
+
Layout.getAppBarElement().setAttribute('mdw-autoprominent', '');
|
|
185
|
+
} else {
|
|
186
|
+
Layout.getAppBarElement().removeAttribute('mdw-autoprominent');
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case 'fab-cut':
|
|
190
|
+
refreshFabCut();
|
|
191
|
+
break;
|
|
192
|
+
case 'fab-show':
|
|
193
|
+
if (checked) {
|
|
194
|
+
Layout.showFab();
|
|
195
|
+
} else {
|
|
196
|
+
Layout.hideFab();
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
case 'navdrawer-style':
|
|
200
|
+
case 'navdrawer-toggle':
|
|
201
|
+
case 'sidesheet-style':
|
|
202
|
+
case 'sidesheet-toggle':
|
|
203
|
+
if (value) {
|
|
204
|
+
document.body.setAttribute(`mdw-${name}`, value);
|
|
205
|
+
} else {
|
|
206
|
+
document.body.removeAttribute(`mdw-${name}`);
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
}
|
|
211
|
+
if (name.indexOf('appbar') === 0) {
|
|
212
|
+
Layout.resetScroll();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** @return {void} */
|
|
217
|
+
function setupComponentOptions() {
|
|
218
|
+
document.addEventListener(ListSecondary.SECONDARY_ACTION_EVENT, (event) => {
|
|
219
|
+
const secondaryElement = /** @type {HTMLElement} */ (event.target);
|
|
220
|
+
const selectionElement = secondaryElement.parentElement;
|
|
221
|
+
// inverse check
|
|
222
|
+
const newValue = !Attributes.isChecked(selectionElement);
|
|
223
|
+
Selection.setChecked(selectionElement, newValue, true);
|
|
224
|
+
});
|
|
225
|
+
document.addEventListener(Selection.CHECKED_CHANGE_EVENT, onCheckChange);
|
|
226
|
+
document.getElementById('dialog-alert-button').addEventListener('click', (event) => {
|
|
227
|
+
Dialog.show(document.getElementById('dialog-alert'), event);
|
|
228
|
+
});
|
|
229
|
+
document.getElementById('dialog-confirm-button').addEventListener('click', (event) => {
|
|
230
|
+
Dialog.show(document.getElementById('dialog-confirm'), event);
|
|
231
|
+
});
|
|
232
|
+
document.getElementById('menu-button').addEventListener('click', (event) => {
|
|
233
|
+
Menu.show(document.getElementById('sample-menu'), event);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
initializeSampleComponents();
|
|
238
|
+
setupComponentOptions();
|
|
239
|
+
|
|
240
|
+
document.addEventListener(Dialog.CONFIRM_EVENT, (event) => {
|
|
241
|
+
const dialog = /** @type {HTMLElement} */ (event.target);
|
|
242
|
+
switch (dialog.id) {
|
|
243
|
+
case 'dialog-autohide-options':
|
|
244
|
+
updateAutoHideOption();
|
|
245
|
+
break;
|
|
246
|
+
case 'dialog-fabmobile-options':
|
|
247
|
+
updateFabMobileOption();
|
|
248
|
+
break;
|
|
249
|
+
case 'dialog-fabdesktop-options':
|
|
250
|
+
updateFabDesktopOption();
|
|
251
|
+
break;
|
|
252
|
+
default:
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
// Dialog was cancelled
|
|
256
|
+
document.addEventListener(Dialog.CANCEL_EVENT, (event) => {
|
|
257
|
+
const dialog = /** @type {HTMLElement} */ (event.target);
|
|
258
|
+
// Revert selection
|
|
259
|
+
switch (dialog.id) {
|
|
260
|
+
case 'dialog-autohide-options':
|
|
261
|
+
for (const item of document.querySelectorAll('[data-name="appbar-autohide"]')) {
|
|
262
|
+
item.setAttribute('aria-checked', (item === checkedAutoHideItem) ? 'true' : 'false');
|
|
263
|
+
}
|
|
264
|
+
break;
|
|
265
|
+
case 'dialog-fabmobile-options':
|
|
266
|
+
for (const item of document.querySelectorAll('[data-name="fab-mobile"]')) {
|
|
267
|
+
item.setAttribute('aria-checked', (item === checkedFabMobileItem) ? 'true' : 'false');
|
|
268
|
+
}
|
|
269
|
+
break;
|
|
270
|
+
case 'dialog-fabdesktop-options':
|
|
271
|
+
for (const item of document.querySelectorAll('[data-name="fab-desktop"]')) {
|
|
272
|
+
item.setAttribute('aria-checked', (item === checkedFabDesktopItem) ? 'true' : 'false');
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
default:
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
document.addEventListener(ListContent.ACTIVATE_EVENT, (event) => {
|
|
280
|
+
const listContentElement = /** @type {HTMLElement} */ (event.target);
|
|
281
|
+
|
|
282
|
+
// Before opening dialog, remember which item was checked
|
|
283
|
+
switch (listContentElement.dataset.name) {
|
|
284
|
+
case 'use-appbar-autohide':
|
|
285
|
+
checkedAutoHideItem = document.querySelector('[data-name="appbar-autohide"][aria-checked="true"]');
|
|
286
|
+
Dialog.show(document.getElementById('dialog-autohide-options'), event);
|
|
287
|
+
break;
|
|
288
|
+
case 'use-fab-mobile':
|
|
289
|
+
checkedFabMobileItem = document.querySelector('[data-name="fab-mobile"][aria-checked="true"]');
|
|
290
|
+
Dialog.show(document.getElementById('dialog-fabmobile-options'), event);
|
|
291
|
+
break;
|
|
292
|
+
case 'use-fab-desktop':
|
|
293
|
+
checkedFabDesktopItem = document.querySelector('[data-name="fab-desktop"][aria-checked="true"]');
|
|
294
|
+
Dialog.show(document.getElementById('dialog-fabdesktop-options'), event);
|
|
295
|
+
break;
|
|
296
|
+
default:
|
|
297
|
+
}
|
|
298
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@use "../../core/theme" with (
|
|
2
|
+
$alias: (
|
|
3
|
+
'primary': 'deeppurple',
|
|
4
|
+
'secondary': 'deeporange',
|
|
5
|
+
'warn': 'red',
|
|
6
|
+
'background': 'bluegray',
|
|
7
|
+
)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
@use "../../core/overlay";
|
|
11
|
+
@use "../../core/ripple";
|
|
12
|
+
|
|
13
|
+
@use "../../components/appbar";
|
|
14
|
+
@use "../../components/banner";
|
|
15
|
+
@use "../../components/button";
|
|
16
|
+
@use "../../components/card";
|
|
17
|
+
@use "../../components/dialog";
|
|
18
|
+
@use "../../components/divider";
|
|
19
|
+
@use "../../components/fab";
|
|
20
|
+
@use "../../components/grid";
|
|
21
|
+
@use "../../components/layout";
|
|
22
|
+
@use "../../components/list";
|
|
23
|
+
@use "../../components/menu";
|
|
24
|
+
@use "../../components/selection";
|
|
25
|
+
@use "../../components/snackbar";
|
|
26
|
+
@use "../../components/type";
|
|
27
|
+
|
|
28
|
+
:root {
|
|
29
|
+
--mdw-ink-default-light: 0,96,100;
|
|
30
|
+
--mdw-ink-default-dark: 224,247,250;
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use "../../core/theme/_config.scss" with (
|
|
2
|
+
$alias: (
|
|
3
|
+
'primary': 'deeppurple',
|
|
4
|
+
'secondary': 'deeporange',
|
|
5
|
+
'warn': 'red',
|
|
6
|
+
'background': 'bluegray'
|
|
7
|
+
)
|
|
8
|
+
);
|
|
9
|
+
@use "../../core/theme/_aliases.scss";
|
|
10
|
+
|
|
11
|
+
:root {
|
|
12
|
+
--mdw-ink-default-light: 0,96,100;
|
|
13
|
+
--mdw-ink-default-dark: 224,247,250;
|
|
14
|
+
font-family: Merriweather, sans-serif;
|
|
15
|
+
}
|
package/index.scss
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use './core/theme';
|
|
2
|
+
@use './core/overlay';
|
|
3
|
+
@use './core/ripple';
|
|
4
|
+
|
|
5
|
+
@use './components/appbar';
|
|
6
|
+
@use './components/banner';
|
|
7
|
+
@use './components/bottomnav';
|
|
8
|
+
@use './components/button';
|
|
9
|
+
@use './components/card';
|
|
10
|
+
@use './components/chip';
|
|
11
|
+
@use './components/datatable';
|
|
12
|
+
@use './components/dialog';
|
|
13
|
+
@use './components/divider';
|
|
14
|
+
@use './components/elevation';
|
|
15
|
+
@use './components/fab';
|
|
16
|
+
@use './components/grid';
|
|
17
|
+
@use './components/layout';
|
|
18
|
+
@use './components/list';
|
|
19
|
+
@use './components/menu';
|
|
20
|
+
@use './components/progress';
|
|
21
|
+
@use './components/selection';
|
|
22
|
+
@use './components/slider';
|
|
23
|
+
@use './components/snackbar';
|
|
24
|
+
@use './components/tab';
|
|
25
|
+
@use './components/textfield';
|
|
26
|
+
@use './components/tooltip';
|
|
27
|
+
@use './components/type';
|
package/jsconfig.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"checkJs": true,
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"noImplicitAny": true,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"strict": false,
|
|
9
|
+
"target": "esnext",
|
|
10
|
+
"allowSyntheticDefaultImports": true
|
|
6
11
|
},
|
|
7
12
|
"exclude": [
|
|
8
13
|
"**/node_modules/*",
|
|
14
|
+
".history/*"
|
|
9
15
|
]
|
|
10
16
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shortfuse/materialdesignweb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Material Design for Web",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"dist": "webpack"
|
|
7
|
+
"analyze:docs": "webpack-bundle-analyzer stats.json",
|
|
8
|
+
"build:docs": "webpack --config webpack.config.js --env target=docs",
|
|
9
|
+
"deploy:docs": "scripts/deploy-docs.sh",
|
|
10
|
+
"dist": "webpack",
|
|
11
|
+
"pretest": "eslint --ignore-path .gitignore .",
|
|
12
|
+
"start:docs": "webpack serve --config webpack.config.js --env target=docs --host 0.0.0.0",
|
|
13
|
+
"stats:docs": "webpack --config webpack.config.js --env target=docs --profile --json > stats.json",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
15
|
},
|
|
12
16
|
"repository": {
|
|
13
17
|
"type": "git",
|
|
@@ -18,33 +22,56 @@
|
|
|
18
22
|
"design",
|
|
19
23
|
"web"
|
|
20
24
|
],
|
|
25
|
+
"exports": {
|
|
26
|
+
"./": "./"
|
|
27
|
+
},
|
|
21
28
|
"author": "Carlos Lopez Jr. <clshortfuse@gmail.com> (https://shortfuse.org/)",
|
|
22
29
|
"license": "ISC",
|
|
30
|
+
"sideEffects": false,
|
|
23
31
|
"bugs": {
|
|
24
32
|
"url": "https://github.com/clshortfuse/materialdesignweb/issues"
|
|
25
33
|
},
|
|
26
34
|
"homepage": "https://github.com/clshortfuse/materialdesignweb#readme",
|
|
27
35
|
"devDependencies": {
|
|
28
|
-
"@babel/
|
|
29
|
-
"babel-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"eslint-
|
|
34
|
-
"eslint
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
36
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
37
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
38
|
+
"@babel/plugin-proposal-private-methods": "^7.16.11",
|
|
39
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
|
|
40
|
+
"@babel/preset-env": "^7.12.1",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "5.23",
|
|
42
|
+
"@typescript-eslint/parser": "5.23",
|
|
43
|
+
"babel-loader": "^8.2.3",
|
|
44
|
+
"clean-css": "^5.2.2",
|
|
45
|
+
"css-loader": "^6.5.1",
|
|
46
|
+
"cssnano": "^5.0.14",
|
|
47
|
+
"eslint": "^8.8.0",
|
|
48
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
49
|
+
"eslint-plugin-compat": "^4.0.2",
|
|
50
|
+
"eslint-plugin-eta": "github:clshortfuse/eslint-plugin-eta",
|
|
51
|
+
"eslint-plugin-github": "^4.3.5",
|
|
52
|
+
"eslint-plugin-import": "^2.22.1",
|
|
53
|
+
"eslint-plugin-jsdoc": "^39.2.9",
|
|
54
|
+
"eslint-plugin-node": "^11.1.0",
|
|
55
|
+
"eslint-plugin-unicorn": "^42.0.0",
|
|
56
|
+
"eta": "^1.12.0",
|
|
57
|
+
"extract-loader": "^5.1.0",
|
|
58
|
+
"fibers": "^5.0.0",
|
|
59
|
+
"file-loader": "^6.2.0",
|
|
60
|
+
"html-loader": "3.1",
|
|
61
|
+
"postcss-loader": "^6.2.1",
|
|
62
|
+
"sass": "^1.27.0",
|
|
63
|
+
"sass-loader": "^12.4.0",
|
|
64
|
+
"stylelint": "^14.8.2",
|
|
65
|
+
"stylelint-config-recommended-scss": "^6.0.0",
|
|
66
|
+
"stylelint-config-sass-guidelines": "^9.0.1",
|
|
67
|
+
"stylelint-no-unsupported-browser-features": "github:clshortfuse/stylelint-no-unsupported-browser-features",
|
|
68
|
+
"stylelint-scss": "^4.2.0",
|
|
69
|
+
"stylelint-use-logical-spec": "^3.2.2",
|
|
70
|
+
"terser-webpack-plugin": "^5.3.1",
|
|
71
|
+
"typescript": "^4.5.4",
|
|
72
|
+
"webpack": "^5.72.1",
|
|
73
|
+
"webpack-bundle-analyzer": "^4.1.0",
|
|
74
|
+
"webpack-cli": "^4.2.0",
|
|
75
|
+
"webpack-dev-server": "^4.7.0"
|
|
49
76
|
}
|
|
50
77
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
if [ -z $(git status --untracked-files=no --porcelain) ];
|
|
2
|
+
then
|
|
3
|
+
git add dist/docs -f
|
|
4
|
+
git commit -m "Update Docs"
|
|
5
|
+
git push origin `git subtree split --prefix dist/docs master`:gh-pages --force
|
|
6
|
+
git reset HEAD~
|
|
7
|
+
else
|
|
8
|
+
echo "Need clean working directory to publish"
|
|
9
|
+
fi
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"checkJs": true,
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"noImplicitAny": true,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"strict": false,
|
|
9
|
+
"target": "esnext",
|
|
10
|
+
"allowSyntheticDefaultImports": true
|
|
11
|
+
},
|
|
12
|
+
"exclude": [
|
|
13
|
+
"**/node_modules/*",
|
|
14
|
+
".history/*"
|
|
15
|
+
]
|
|
16
|
+
}
|