@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as Chip from '../../components/chip/index.js';
|
|
2
|
+
import { convertElementToCode } from '../_sample-utils.js';
|
|
3
|
+
|
|
4
|
+
/** @type {Iterable<HTMLElement>} */
|
|
5
|
+
let sampleComponents;
|
|
6
|
+
|
|
7
|
+
/** @return {void} */
|
|
8
|
+
function updateSampleCode() {
|
|
9
|
+
const jsRequired = document.querySelector('input[name="javascript"][value="required"]').checked;
|
|
10
|
+
const jsOptional = document.querySelector('input[name="javascript"][value="optional"]').checked;
|
|
11
|
+
const useJS = jsRequired || jsOptional;
|
|
12
|
+
|
|
13
|
+
// Strip JS related elements and attributes
|
|
14
|
+
for (const element of sampleComponents) { Chip.detach(element); }
|
|
15
|
+
|
|
16
|
+
const htmlCodeElement = document.getElementsByClassName('component-html')[0];
|
|
17
|
+
const sampleContainer = document.querySelector('.component-sample__container').firstElementChild;
|
|
18
|
+
htmlCodeElement.textContent = convertElementToCode(sampleContainer);
|
|
19
|
+
|
|
20
|
+
// Reattach JS if requested
|
|
21
|
+
if (useJS) {
|
|
22
|
+
for (const element of sampleComponents) { Chip.attach(element); }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const jsCodeElement = document.getElementsByClassName('component-js')[0];
|
|
26
|
+
jsCodeElement.textContent = 'mdw.Chip.attach(chipElement);';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** @return {void} */
|
|
30
|
+
function initializeSampleComponents() {
|
|
31
|
+
for (const element of document.querySelectorAll('.js .mdw-tab')) { Chip.attach(element); }
|
|
32
|
+
for (const formElement of document.getElementsByTagName('form')) {
|
|
33
|
+
formElement.reset();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {Event} event
|
|
39
|
+
* @return {void}
|
|
40
|
+
*/
|
|
41
|
+
function onOptionChange(event) {
|
|
42
|
+
const inputElement = /** @type {HTMLInputElement} */ (event.currentTarget);
|
|
43
|
+
const { name, value, checked } = inputElement;
|
|
44
|
+
|
|
45
|
+
switch (name) {
|
|
46
|
+
case 'framework':
|
|
47
|
+
switch (value) {
|
|
48
|
+
case 'javascript':
|
|
49
|
+
break;
|
|
50
|
+
case 'css':
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
case 'outlined': {
|
|
56
|
+
for (const el of sampleComponents) {
|
|
57
|
+
if (checked) {
|
|
58
|
+
el.setAttribute('mdw-outlined', '');
|
|
59
|
+
} else {
|
|
60
|
+
el.removeAttribute('mdw-outlined');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
}
|
|
67
|
+
updateSampleCode();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** @return {void} */
|
|
71
|
+
function setupComponentOptions() {
|
|
72
|
+
sampleComponents = document.querySelectorAll('.component-sample .mdw-chip');
|
|
73
|
+
for (const el of document.querySelectorAll('.demo-options input[name]')) {
|
|
74
|
+
el.addEventListener('change', onOptionChange);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
initializeSampleComponents();
|
|
79
|
+
setupComponentOptions();
|
|
80
|
+
updateSampleCode();
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<% layout('../_partials/_header.eta', {page: 'color'}) %>
|
|
2
|
+
<div class="mdw-grid" mdw-margin-top mdw-margin-bottom mdw-columns="4" id="color-page-options">
|
|
3
|
+
<div class="mdw-grid__item" mdw-colspan="4">
|
|
4
|
+
<div class="mdw-grid__content mdw-theme" mdw-elevation="8">
|
|
5
|
+
<div id="color-sample-area">
|
|
6
|
+
<a class="demo-core-item mdw-overlay mdw-elevation mdw-ripple mdw-theme" id="sample-button" tabindex="0" mdw-elevation="1" mdw-surface="binary" mdw-ink="secondary contrast">Enabled</a>
|
|
7
|
+
<a class="demo-core-item mdw-overlay mdw-elevation mdw-ripple mdw-theme" id="sample-button__selected" tabindex="0" mdw-elevation="1" mdw-surface="binary" mdw-ink="secondary contrast" aria-selected="true">Selected</a>
|
|
8
|
+
<a class="demo-core-item mdw-overlay mdw-elevation mdw-ripple mdw-theme" id="sample-button__activated" tabindex="0" mdw-elevation="1" mdw-surface="binary" mdw-ink="secondary contrast" aria-pressed="true">Activated</a>
|
|
9
|
+
<div style="margin:8px">
|
|
10
|
+
<p class="mdw-type"><span>Surface: </span><span class="mdw-theme" id="sample-surface" mdw-ink="medium"></span></p>
|
|
11
|
+
<p class="mdw-type"><span>Ink: </span><span class="mdw-theme" id="sample-ink" mdw-ink="medium"></span></p>
|
|
12
|
+
</div>
|
|
13
|
+
<div style="margin:8px">
|
|
14
|
+
<p class="mdw-type"><span>Text Contrast: </span><span class="mdw-theme" id="sample-contrast__text" mdw-ink="medium"></span><span> / 4.5</span></p>
|
|
15
|
+
<p class="mdw-type"><span>Selected Contrast: </span><span class="mdw-theme" id="sample-contrast__selected" mdw-ink="medium"></span><span> / 4.5</span></p>
|
|
16
|
+
<p class="mdw-type"><span>Activated Contrast: </span><span class="mdw-theme" id="sample-contrast__activated" mdw-ink="medium"></span><span> / 4.5</span></p>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="mdw-grid__item" mdw-colspan="2">
|
|
22
|
+
<div class="mdw-grid__content">
|
|
23
|
+
<div class="mdw-type" mdw-style="subtitle">Ink</div>
|
|
24
|
+
<div>
|
|
25
|
+
<label class="mdw-textfield mdw-theme" mdw-ink="secondary" mdw-outlined>
|
|
26
|
+
<select class="mdw-textfield__input" name="ink-color">
|
|
27
|
+
<option class="mdw-theme" mdw-surface="card" value="default">Default</option>
|
|
28
|
+
<option class="mdw-theme" mdw-surface="card" value="black">Black</option>
|
|
29
|
+
<option class="mdw-theme" mdw-surface="card" value="white">White</option>
|
|
30
|
+
<option class="mdw-theme" mdw-surface="card" value="primary">Primary</option>
|
|
31
|
+
<option class="mdw-theme" mdw-surface="card" value="secondary" selected>Secondary</option>
|
|
32
|
+
<option class="mdw-theme" mdw-surface="card" value="warn">Warn</option>
|
|
33
|
+
<option class="mdw-theme" mdw-surface="card" value="amber">Amber</option>
|
|
34
|
+
<option class="mdw-theme" mdw-surface="card" value="blue">Blue</option>
|
|
35
|
+
<option class="mdw-theme" mdw-surface="card" value="cyan">Cyan</option>
|
|
36
|
+
<option class="mdw-theme" mdw-surface="card" value="red">Red</option>
|
|
37
|
+
<option class="mdw-theme" mdw-surface="card" value="green">Green</option>
|
|
38
|
+
<option class="mdw-theme" mdw-surface="card" value="deeppurple">Deeppurple</option>
|
|
39
|
+
<option class="mdw-theme" mdw-surface="card" value="purple">Purple</option>
|
|
40
|
+
<option class="mdw-theme" mdw-surface="card" value="yellow">Yellow</option>
|
|
41
|
+
<option class="mdw-theme" mdw-surface="card" value="teal">Teal</option>
|
|
42
|
+
</select>
|
|
43
|
+
<div class="mdw-textfield__icon" mdw-dropdown></div>
|
|
44
|
+
<div class="mdw-textfield__border">
|
|
45
|
+
<div class="mdw-textfield__outline-gap">
|
|
46
|
+
<div class="mdw-textfield__label">Color</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</label>
|
|
50
|
+
<label class="mdw-textfield mdw-theme" mdw-ink="secondary" mdw-outlined>
|
|
51
|
+
<select class="mdw-textfield__input" name="ink-tone">
|
|
52
|
+
<option class="mdw-theme" mdw-surface="card" value="">Auto</option>
|
|
53
|
+
<option class="mdw-theme" mdw-surface="card" value="light">Light</option>
|
|
54
|
+
<option class="mdw-theme" mdw-surface="card" value="contrast" auto>Contrast</option>
|
|
55
|
+
<option class="mdw-theme" mdw-surface="card" value="A100">A100</option>
|
|
56
|
+
<option class="mdw-theme" mdw-surface="card" value="A200">A200</option>
|
|
57
|
+
<option class="mdw-theme" mdw-surface="card" value="A400">A400</option>
|
|
58
|
+
<option class="mdw-theme" mdw-surface="card" value="A700">A700</option>
|
|
59
|
+
</select>
|
|
60
|
+
<div class="mdw-textfield__icon" mdw-dropdown></div>
|
|
61
|
+
<div class="mdw-textfield__border">
|
|
62
|
+
<div class="mdw-textfield__outline-gap">
|
|
63
|
+
<div class="mdw-textfield__label">Tone</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</label>
|
|
67
|
+
<label class="mdw-textfield mdw-theme" mdw-ink="secondary" mdw-outlined>
|
|
68
|
+
<select class="mdw-textfield__input" name="ink-opacity">
|
|
69
|
+
<option class="mdw-theme" mdw-surface="card" value="" selected>Auto</option>
|
|
70
|
+
<option class="mdw-theme" mdw-surface="card" value="solid">Solid</option>
|
|
71
|
+
<option class="mdw-theme" mdw-surface="card" value="high">High</option>
|
|
72
|
+
<option class="mdw-theme" mdw-surface="card" value="medium">Medium</option>
|
|
73
|
+
<option class="mdw-theme" mdw-surface="card" value="inactive">Inactive</option>
|
|
74
|
+
<option class="mdw-theme" mdw-surface="card" value="divider">Divider</option>
|
|
75
|
+
</select>
|
|
76
|
+
<div class="mdw-textfield__icon" mdw-dropdown></div>
|
|
77
|
+
<div class="mdw-textfield__border">
|
|
78
|
+
<div class="mdw-textfield__outline-gap">
|
|
79
|
+
<div class="mdw-textfield__label">Opacity</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</label>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="mdw-grid__item" mdw-colspan="2">
|
|
87
|
+
<div class="mdw-grid__content">
|
|
88
|
+
<div class="mdw-type" mdw-style="subtitle">Surface</div>
|
|
89
|
+
<div id="color-page-options">
|
|
90
|
+
<label class="mdw-textfield mdw-theme" mdw-ink="secondary" mdw-outlined>
|
|
91
|
+
<select class="mdw-textfield__input" name="surface-color">
|
|
92
|
+
<option class="mdw-theme" mdw-surface="card" value="card">Card</option>
|
|
93
|
+
<option class="mdw-theme" mdw-surface="card" value="binary" selected>Binary</option>
|
|
94
|
+
<option class="mdw-theme" mdw-surface="card" value="black">Black</option>
|
|
95
|
+
<option class="mdw-theme" mdw-surface="card" value="white">White</option>
|
|
96
|
+
<option class="mdw-theme" mdw-surface="card" value="background">Background</option>
|
|
97
|
+
<option class="mdw-theme" mdw-surface="card" value="primary">Primary</option>
|
|
98
|
+
<option class="mdw-theme" mdw-surface="card" value="secondary">Secondary</option>
|
|
99
|
+
<option class="mdw-theme" mdw-surface="card" value="warn">Warn</option>
|
|
100
|
+
<option class="mdw-theme" mdw-surface="card" value="amber">Amber</option>
|
|
101
|
+
<option class="mdw-theme" mdw-surface="card" value="blue">Blue</option>
|
|
102
|
+
<option class="mdw-theme" mdw-surface="card" value="cyan">Cyan</option>
|
|
103
|
+
<option class="mdw-theme" mdw-surface="card" value="red">Red</option>
|
|
104
|
+
<option class="mdw-theme" mdw-surface="card" value="green">Green</option>
|
|
105
|
+
<option class="mdw-theme" mdw-surface="card" value="deeppurple">Deeppurple</option>
|
|
106
|
+
<option class="mdw-theme" mdw-surface="card" value="purple">Purple</option>
|
|
107
|
+
<option class="mdw-theme" mdw-surface="card" value="yellow">Yellow</option>
|
|
108
|
+
<option class="mdw-theme" mdw-surface="card" value="teal">Teal</option>
|
|
109
|
+
</select>
|
|
110
|
+
<div class="mdw-textfield__icon" mdw-dropdown></div>
|
|
111
|
+
<div class="mdw-textfield__border">
|
|
112
|
+
<div class="mdw-textfield__outline-gap">
|
|
113
|
+
<div class="mdw-textfield__label">Color</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</label>
|
|
117
|
+
<label class="mdw-textfield mdw-theme" mdw-ink="secondary" mdw-outlined>
|
|
118
|
+
<select class="mdw-textfield__input" name="surface-tone">
|
|
119
|
+
<option class="mdw-theme" mdw-surface="card" value="" selected>Default</option>
|
|
120
|
+
<option class="mdw-theme" mdw-surface="card" value="alt">Alternate</option>
|
|
121
|
+
<option class="mdw-theme" mdw-surface="card" value="50">50</option>
|
|
122
|
+
<option class="mdw-theme" mdw-surface="card" value="100">100</option>
|
|
123
|
+
<option class="mdw-theme" mdw-surface="card" value="200">200</option>
|
|
124
|
+
<option class="mdw-theme" mdw-surface="card" value="300">300</option>
|
|
125
|
+
<option class="mdw-theme" mdw-surface="card" value="400">400</option>
|
|
126
|
+
<option class="mdw-theme" mdw-surface="card" value="500">500</option>
|
|
127
|
+
<option class="mdw-theme" mdw-surface="card" value="600">600</option>
|
|
128
|
+
<option class="mdw-theme" mdw-surface="card" value="700">700</option>
|
|
129
|
+
<option class="mdw-theme" mdw-surface="card" value="800">800</option>
|
|
130
|
+
<option class="mdw-theme" mdw-surface="card" value="900">900</option>
|
|
131
|
+
</select>
|
|
132
|
+
<div class="mdw-textfield__icon" mdw-dropdown></div>
|
|
133
|
+
<div class="mdw-textfield__border">
|
|
134
|
+
<div class="mdw-textfield__outline-gap">
|
|
135
|
+
<div class="mdw-textfield__label">Tone</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</label>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<script src="color.min.js"></script>
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import * as Overlay from '../../core/overlay/index.js';
|
|
2
|
+
import * as Ripple from '../../core/ripple/index.js';
|
|
3
|
+
|
|
4
|
+
for (const el of document.getElementsByClassName('mdw-overlay')) Overlay.attach(el);
|
|
5
|
+
for (const el of document.getElementsByClassName('mdw-ripple')) Ripple.attach(el);
|
|
6
|
+
|
|
7
|
+
const sampleSurface = document.getElementById('sample-surface');
|
|
8
|
+
const sampleInk = document.getElementById('sample-ink');
|
|
9
|
+
|
|
10
|
+
const sampleButton = document.getElementById('sample-button');
|
|
11
|
+
const sampleButtonSelected = document.getElementById('sample-button__selected');
|
|
12
|
+
const sampleButtonActivated = document.getElementById('sample-button__activated');
|
|
13
|
+
|
|
14
|
+
const sampleContrastText = document.getElementById('sample-contrast__text');
|
|
15
|
+
const sampleContrastSelected = document.getElementById('sample-contrast__selected');
|
|
16
|
+
const sampleContrastActivated = document.getElementById('sample-contrast__activated');
|
|
17
|
+
|
|
18
|
+
/** @typedef {{r:number,g:number,b:number,a:number}} Color */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {Color} color
|
|
22
|
+
* @return {string}
|
|
23
|
+
*/
|
|
24
|
+
function colorToString(color) {
|
|
25
|
+
return `rgba(${color.r},${color.g},${color.b},${color.a})`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} colorString
|
|
30
|
+
* @return {Color}
|
|
31
|
+
*/
|
|
32
|
+
function parseColor(colorString) {
|
|
33
|
+
if (colorString === 'transparent') {
|
|
34
|
+
return {
|
|
35
|
+
r: 0, g: 0, b: 0, a: 0,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return colorString
|
|
39
|
+
.match(/\(([^)]+)\)/)[1]
|
|
40
|
+
.split(',')
|
|
41
|
+
.map((value) => (value == null ? 1 : Number.parseFloat(value)))
|
|
42
|
+
.reduce((prev, curr, index) => {
|
|
43
|
+
if (index > 3) {
|
|
44
|
+
throw new Error('Unexpected 5th value');
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
r: index === 0 ? curr : prev.r,
|
|
48
|
+
g: index === 1 ? curr : prev.g,
|
|
49
|
+
b: index === 2 ? curr : prev.b,
|
|
50
|
+
a: index === 3 ? curr : prev.a,
|
|
51
|
+
};
|
|
52
|
+
}, {
|
|
53
|
+
r: 255, g: 255, b: 255, a: 1,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {Color} color
|
|
59
|
+
* @param {Color} overlay
|
|
60
|
+
* @return {Color}
|
|
61
|
+
*/
|
|
62
|
+
function overlayColor(color, overlay) {
|
|
63
|
+
return {
|
|
64
|
+
r: (1 - overlay.a) * color.r + overlay.a * overlay.r,
|
|
65
|
+
g: (1 - overlay.a) * color.g + overlay.a * overlay.g,
|
|
66
|
+
b: (1 - overlay.a) * color.b + overlay.a * overlay.b,
|
|
67
|
+
a: 1,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {number} colorValue
|
|
73
|
+
* @return {number}
|
|
74
|
+
*/
|
|
75
|
+
function sRGBMapping(colorValue) {
|
|
76
|
+
if (colorValue <= (0.039_28 * 255)) {
|
|
77
|
+
return colorValue / 255 / 12.92;
|
|
78
|
+
}
|
|
79
|
+
return ((colorValue / 255 + 0.055) / 1.055) ** 2.4;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
84
|
+
* @param {Color} color
|
|
85
|
+
* @return {number}
|
|
86
|
+
*/
|
|
87
|
+
function getLuminance(color) {
|
|
88
|
+
const R = 0.2126 * sRGBMapping(color.r);
|
|
89
|
+
const G = 0.7152 * sRGBMapping(color.g);
|
|
90
|
+
const B = 0.0722 * sRGBMapping(color.b);
|
|
91
|
+
return (R + G + B);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
|
|
96
|
+
* @param {Color} a
|
|
97
|
+
* @param {Color} b
|
|
98
|
+
* @return {number} X:1 ratio
|
|
99
|
+
*/
|
|
100
|
+
function getContrastRatio(a, b) {
|
|
101
|
+
const lumA = getLuminance(a);
|
|
102
|
+
const lumB = getLuminance(b);
|
|
103
|
+
if (lumA === 0 && lumB === 0) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {string} name
|
|
111
|
+
* @return {void}
|
|
112
|
+
*/
|
|
113
|
+
function updateSurfaces(name) {
|
|
114
|
+
sampleButton.setAttribute('mdw-surface', name);
|
|
115
|
+
sampleButtonSelected.setAttribute('mdw-surface', name);
|
|
116
|
+
sampleButtonActivated.setAttribute('mdw-surface', name);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param {string} name
|
|
121
|
+
* @return {void}
|
|
122
|
+
*/
|
|
123
|
+
function updateInks(name) {
|
|
124
|
+
sampleButton.setAttribute('mdw-ink', name);
|
|
125
|
+
sampleButtonSelected.setAttribute('mdw-ink', name);
|
|
126
|
+
sampleButtonActivated.setAttribute('mdw-ink', name);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** @return {void} */
|
|
130
|
+
function calculateContrast() {
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
const style = window.getComputedStyle(sampleButton);
|
|
133
|
+
const surfaceColor = parseColor(style.backgroundColor);
|
|
134
|
+
const inkColor = parseColor(style.color);
|
|
135
|
+
sampleSurface.textContent = colorToString(surfaceColor);
|
|
136
|
+
sampleInk.textContent = colorToString(inkColor);
|
|
137
|
+
const flattenedInk = overlayColor(surfaceColor, inkColor);
|
|
138
|
+
sampleContrastText.textContent = getContrastRatio(surfaceColor, flattenedInk).toFixed(2);
|
|
139
|
+
|
|
140
|
+
let selectedOpacity = 0.08;
|
|
141
|
+
let activatedOpacity = 0.12;
|
|
142
|
+
let overlayInkColor = inkColor;
|
|
143
|
+
|
|
144
|
+
if (document.documentElement.hasAttribute('mdw-dark')) {
|
|
145
|
+
selectedOpacity = 0.12;
|
|
146
|
+
activatedOpacity = 0.24;
|
|
147
|
+
overlayInkColor = inkColor;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const selectedInkColor = parseColor(window.getComputedStyle(sampleButtonSelected).color);
|
|
151
|
+
const selectedFlattenedInk = overlayColor(surfaceColor, selectedInkColor);
|
|
152
|
+
const selectedOverlay = parseColor(`rgba(${overlayInkColor.r},${overlayInkColor.g},${overlayInkColor.b},${selectedOpacity})`);
|
|
153
|
+
const selectedBackground = overlayColor(surfaceColor, selectedOverlay);
|
|
154
|
+
const selectedColor = overlayColor(selectedFlattenedInk, selectedOverlay);
|
|
155
|
+
sampleContrastSelected.textContent = getContrastRatio(selectedBackground, selectedColor).toFixed(2);
|
|
156
|
+
|
|
157
|
+
const activatedOverlay = parseColor(`rgba(${overlayInkColor.r},${overlayInkColor.g},${overlayInkColor.b},${activatedOpacity})`);
|
|
158
|
+
const activatedBackground = overlayColor(surfaceColor, activatedOverlay);
|
|
159
|
+
const activatedColor = overlayColor(flattenedInk, activatedOverlay);
|
|
160
|
+
sampleContrastActivated.textContent = getContrastRatio(activatedBackground, activatedColor).toFixed(2);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @param {MouseEvent} event
|
|
166
|
+
* @return {void}
|
|
167
|
+
*/
|
|
168
|
+
function onItemClick(event) {
|
|
169
|
+
const item = /** @type {HTMLElement} */ (event.currentTarget);
|
|
170
|
+
if (item.id) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const ink = item.getAttribute('mdw-ink');
|
|
174
|
+
if (ink == null) {
|
|
175
|
+
updateSurfaces(item.getAttribute('mdw-surface'));
|
|
176
|
+
} else {
|
|
177
|
+
updateInks(item.getAttribute('mdw-ink'));
|
|
178
|
+
}
|
|
179
|
+
calculateContrast();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const currentInkOptions = {
|
|
183
|
+
color: 'secondary',
|
|
184
|
+
tone: 'contrast',
|
|
185
|
+
opacity: '',
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const currentSurfaceOptions = {
|
|
189
|
+
color: 'binary',
|
|
190
|
+
tone: '',
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/** @return {void} */
|
|
194
|
+
function refresh() {
|
|
195
|
+
const inkProperties = [
|
|
196
|
+
currentInkOptions.color,
|
|
197
|
+
currentInkOptions.tone,
|
|
198
|
+
currentInkOptions.opacity,
|
|
199
|
+
].filter(Boolean).join(' ');
|
|
200
|
+
const surfaceProperties = [
|
|
201
|
+
currentSurfaceOptions.color,
|
|
202
|
+
currentSurfaceOptions.tone,
|
|
203
|
+
].filter(Boolean).join(' ');
|
|
204
|
+
for (const el of document.querySelectorAll('#color-sample-area .demo-core-item')) {
|
|
205
|
+
el.setAttribute('mdw-ink', inkProperties);
|
|
206
|
+
el.setAttribute('mdw-surface', surfaceProperties);
|
|
207
|
+
}
|
|
208
|
+
calculateContrast();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @param {Event} event
|
|
213
|
+
* @return {void}
|
|
214
|
+
*/
|
|
215
|
+
function onOptionChange(event) {
|
|
216
|
+
const selectElement = /** @type {HTMLSelectElement} */ (event.target);
|
|
217
|
+
const { name, value } = selectElement;
|
|
218
|
+
switch (name) {
|
|
219
|
+
case 'ink-color':
|
|
220
|
+
currentInkOptions.color = value;
|
|
221
|
+
break;
|
|
222
|
+
case 'ink-tone':
|
|
223
|
+
currentInkOptions.tone = value;
|
|
224
|
+
break;
|
|
225
|
+
case 'ink-opacity':
|
|
226
|
+
currentInkOptions.opacity = value;
|
|
227
|
+
break;
|
|
228
|
+
case 'surface-color':
|
|
229
|
+
currentSurfaceOptions.color = value;
|
|
230
|
+
break;
|
|
231
|
+
case 'surface-tone':
|
|
232
|
+
currentSurfaceOptions.tone = value;
|
|
233
|
+
break;
|
|
234
|
+
default:
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
refresh();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** @return {void} */
|
|
241
|
+
function setupComponentOptions() {
|
|
242
|
+
// sampleComponent = document.querySelector('.component-sample .mdw-button');
|
|
243
|
+
// Button.attach(sampleComponent);
|
|
244
|
+
for (const el of document.querySelectorAll('#color-page-options [name]')) {
|
|
245
|
+
el.addEventListener('change', onOptionChange);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
for (const item of document.getElementsByClassName('demo-core-item')) {
|
|
250
|
+
item.addEventListener('click', onItemClick);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
for (const button of [
|
|
254
|
+
document.getElementById('darkModeButton'),
|
|
255
|
+
document.getElementById('altThemeButton'),
|
|
256
|
+
]) {
|
|
257
|
+
button?.addEventListener('click', calculateContrast);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
setupComponentOptions();
|
|
261
|
+
refresh();
|