@shortfuse/materialdesignweb 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +2 -1
- package/.eslintrc.json +59 -8
- package/.stylelintrc.json +94 -49
- package/CHANGELOG.md +12 -0
- package/README.md +1 -3
- package/adapters/datatable/column.js +27 -54
- package/adapters/datatable/index.js +69 -81
- package/adapters/dom/index.js +32 -47
- package/adapters/search/index.js +107 -133
- package/components/appbar/_spec.scss +77 -137
- package/components/banner/_spec.scss +28 -63
- package/components/bottomnav/_spec.scss +46 -54
- package/components/bottomnav/index.js +15 -20
- package/components/bottomnav/item.js +4 -5
- package/components/button/README.md +1 -1
- package/components/button/_spec.scss +43 -42
- package/components/button/_theme.scss +27 -50
- package/components/card/_spec.scss +61 -69
- package/components/chip/_spec.scss +21 -44
- package/components/chip/_theme.scss +79 -151
- package/components/chip/index.js +6 -4
- package/components/datatable/_spec.scss +36 -99
- package/components/datatable/_theme.scss +98 -124
- package/components/datatable/cell.js +1 -2
- package/components/datatable/columnheader.js +1 -2
- package/components/datatable/index.js +33 -47
- package/components/datatable/row.js +4 -5
- package/components/dialog/_spec.scss +53 -63
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +62 -88
- package/components/divider/_spec.scss +6 -8
- package/components/elevation/_spec.scss +1 -1
- package/components/fab/_spec.scss +30 -42
- package/components/fab/index.js +4 -8
- package/components/grid/_spec.scss +68 -211
- package/components/layout/_mixins.scss +0 -22
- package/components/layout/_spec.scss +267 -363
- package/components/layout/_theme.scss +10 -35
- package/components/layout/index.js +40 -50
- package/components/list/_spec.scss +57 -91
- package/components/list/_theme.scss +75 -84
- package/components/list/content.js +9 -13
- package/components/list/index.js +34 -38
- package/components/list/item.js +8 -11
- package/components/list/secondary.js +8 -9
- package/components/menu/_spec.scss +134 -167
- package/components/menu/index.js +45 -61
- package/components/menu/item.js +11 -19
- package/components/progress/_spec.scss +43 -34
- package/components/selection/_spec.scss +123 -133
- package/components/selection/_theme.scss +88 -120
- package/components/selection/index.js +9 -15
- package/components/selection/input.js +3 -5
- package/components/selection/radiogroup.js +8 -15
- package/components/slider/_spec.scss +23 -28
- package/components/snackbar/_spec.scss +17 -62
- package/components/snackbar/index.js +15 -21
- package/components/tab/_spec.scss +35 -50
- package/components/tab/content.js +33 -28
- package/components/tab/index.js +30 -33
- package/components/tab/item.js +4 -5
- package/components/tab/list.js +22 -36
- package/components/textfield/README.md +2 -2
- package/components/textfield/_spec.scss +241 -287
- package/components/textfield/_theme.scss +197 -232
- package/components/textfield/index.js +8 -16
- package/components/tooltip/_spec.scss +23 -26
- package/components/type/_spec.scss +19 -16
- package/core/_breakpoint.scss +33 -33
- package/core/_elevation.scss +40 -0
- package/core/_length.scss +0 -1
- package/core/_platform.scss +0 -22
- package/core/_type.scss +7 -6
- package/core/aria/button.js +4 -5
- package/core/aria/keyboard.js +1 -2
- package/core/aria/rovingtabindex.js +14 -17
- package/core/aria/tab.js +1 -2
- package/core/dom.js +18 -109
- package/core/overlay/_spec.scss +5 -8
- package/core/overlay/_theme.scss +126 -150
- package/core/overlay/index.js +19 -32
- package/core/ripple/_spec.scss +16 -17
- package/core/ripple/_theme.scss +13 -33
- package/core/ripple/index.js +36 -44
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -2
- package/core/theme/_functions.scss +22 -0
- package/core/theme/_palettes.scss +0 -1
- package/core/{color → theme}/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.scss +4 -0
- package/core/transition/index.js +73 -76
- package/docs/_flex.scss +7 -1
- package/docs/_menuoptions.js +2 -2
- package/docs/_partials/_appbar.eta +12 -14
- package/docs/_partials/_header.eta +41 -44
- package/docs/_sample-utils.js +15 -20
- package/docs/docs.scss +123 -87
- package/docs/framework.scss +26 -0
- package/docs/index.eta +2 -6
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +22 -28
- package/docs/pages/bottomnav.js +17 -14
- package/docs/pages/button.js +10 -10
- package/docs/pages/card.js +20 -22
- package/docs/pages/chip.js +11 -13
- package/docs/pages/color.js +35 -36
- package/docs/pages/datatable.js +11 -15
- package/docs/pages/dialog.eta +9 -11
- package/docs/pages/dialog.js +6 -9
- package/docs/pages/dom.js +6 -9
- package/docs/pages/elevation.eta +10 -10
- package/docs/pages/fab.js +2 -3
- package/docs/pages/grid.js +5 -5
- package/docs/pages/list.js +1 -2
- package/docs/pages/menu.eta +17 -19
- package/docs/pages/menu.js +7 -11
- package/docs/pages/overlay.js +1 -2
- package/docs/pages/progress.eta +2 -2
- package/docs/pages/progress.js +1 -1
- package/docs/pages/ripple.js +1 -2
- package/docs/pages/search.eta +20 -24
- package/docs/pages/search.js +24 -41
- package/docs/pages/selection.eta +2 -6
- package/docs/pages/selection.js +3 -4
- package/docs/pages/snackbar.js +3 -4
- package/docs/pages/tab.eta +61 -75
- package/docs/pages/tab.js +16 -15
- package/docs/pages/textfield.eta +9 -8
- package/docs/pages/textfield.js +26 -23
- package/docs/pages/tooltip.eta +10 -12
- package/docs/pages/transition.js +5 -7
- package/docs/postrender.js +7 -5
- package/docs/pwa/pwa.eta +14 -16
- package/docs/pwa/pwa.js +19 -27
- package/docs/pwa/pwa.scss +12 -7
- package/docs/themes/theme-colored.scss +9 -11
- package/docs/themes/theme-default.scss +0 -14
- package/index.scss +27 -0
- package/jsconfig.json +7 -3
- package/package.json +26 -15
- package/tsconfig.json +16 -0
- package/{webpack.config.cjs → webpack.config.js} +105 -58
- package/components/template/_theme.scss +0 -27
- package/components/textfield/_mixins.scss +0 -52
- package/core/color/_theme.scss +0 -390
- package/core/color/index.scss +0 -2
- package/core/theme/_mixins.scss +0 -172
- package/core/theme/_variables.scss +0 -24
- package/docs/_mixins.pug +0 -155
- package/docs/pages/appbar.pug +0 -78
- package/docs/pages/bottomnav.pug +0 -137
- package/docs/pages/button.pug +0 -121
- package/docs/pages/card.pug +0 -74
- package/docs/pages/chip.pug +0 -91
- package/docs/pages/color.pug +0 -121
- package/docs/pages/datatable.pug +0 -283
- package/docs/pages/dialog.pug +0 -132
- package/docs/pages/dom.pug +0 -22
- package/docs/pages/elevation.pug +0 -25
- package/docs/pages/fab.pug +0 -66
- package/docs/pages/grid.pug +0 -95
- package/docs/pages/layout.pug +0 -7
- package/docs/pages/list.pug +0 -326
- package/docs/pages/menu.pug +0 -205
- package/docs/pages/overlay.pug +0 -55
- package/docs/pages/progress.pug +0 -16
- package/docs/pages/ripple.pug +0 -21
- package/docs/pages/search.pug +0 -165
- package/docs/pages/selection.pug +0 -74
- package/docs/pages/slider.pug +0 -17
- package/docs/pages/snackbar.pug +0 -60
- package/docs/pages/tab.pug +0 -304
- package/docs/pages/textfield.pug +0 -360
- package/docs/pages/tooltip.pug +0 -78
- package/docs/pages/transition.pug +0 -76
- package/docs/pages/type.pug +0 -29
- package/docs/pwa/_dialogs.pug +0 -96
- package/docs/pwa/_menus.pug +0 -11
- package/docs/pwa/pwa.pug +0 -325
- package/docs/spec.scss +0 -26
- package/docs/themes/_component-themes.scss +0 -26
- package/docs/themes/theme-colored-fallbacks.scss +0 -17
- package/docs/themes/theme-default-fallbacks.scss +0 -17
package/core/transition/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// https://material.io/design/navigation/navigation-transitions.html
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const EXPAND_DURATION_MS = 300;
|
|
4
|
+
const COLLAPSE_DURATION_MS = 250;
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @typedef {Object} ShapeTranformDetails
|
|
@@ -21,7 +22,7 @@ function pxToInteger(px) {
|
|
|
21
22
|
if (!px) {
|
|
22
23
|
return 0;
|
|
23
24
|
}
|
|
24
|
-
return parseInt(px, 10);
|
|
25
|
+
return Number.parseInt(px, 10);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -42,26 +43,26 @@ function convertBoxShadow(stringValue, scaleX, scaleY) {
|
|
|
42
43
|
let blurRadius = '';
|
|
43
44
|
let spreadRadius = '';
|
|
44
45
|
let color = '';
|
|
45
|
-
shadow.split(' ')
|
|
46
|
+
for (const value of shadow.trim().split(' ')) {
|
|
46
47
|
if (value.toLowerCase() === 'inset') {
|
|
47
48
|
inset = value;
|
|
48
|
-
|
|
49
|
+
continue;
|
|
49
50
|
}
|
|
50
|
-
if (value.
|
|
51
|
+
if (value.includes('(') || !value.match(/\d/).length) {
|
|
51
52
|
color = value;
|
|
52
|
-
|
|
53
|
+
continue;
|
|
53
54
|
}
|
|
54
55
|
const numberValue = pxToInteger(value);
|
|
55
56
|
if (!offsetX) {
|
|
56
|
-
offsetX = `${numberValue / scaleX}${value.replace(/[
|
|
57
|
+
offsetX = `${numberValue / scaleX}${value.replace(/[\d.\\]/g, '')}`;
|
|
57
58
|
} else if (!offsetY) {
|
|
58
|
-
offsetY = `${numberValue / scaleY}${value.replace(/[
|
|
59
|
+
offsetY = `${numberValue / scaleY}${value.replace(/[\d.\\]/g, '')}`;
|
|
59
60
|
} else if (!blurRadius) {
|
|
60
|
-
blurRadius = `${numberValue / (scaleX * scaleY)}${value.replace(/[
|
|
61
|
+
blurRadius = `${numberValue / (scaleX * scaleY)}${value.replace(/[\d.\\-]/g, '')}`;
|
|
61
62
|
} else {
|
|
62
|
-
spreadRadius = `${numberValue / (scaleX * scaleY)}${value.replace(/[
|
|
63
|
+
spreadRadius = `${numberValue / (scaleX * scaleY)}${value.replace(/[\d.\\-]/g, '')}`;
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
+
}
|
|
65
66
|
return [
|
|
66
67
|
inset,
|
|
67
68
|
offsetX,
|
|
@@ -69,7 +70,7 @@ function convertBoxShadow(stringValue, scaleX, scaleY) {
|
|
|
69
70
|
blurRadius,
|
|
70
71
|
spreadRadius,
|
|
71
72
|
color,
|
|
72
|
-
].filter(
|
|
73
|
+
].filter(Boolean).join(' ');
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
if (!stringValue) {
|
|
@@ -79,15 +80,26 @@ function convertBoxShadow(stringValue, scaleX, scaleY) {
|
|
|
79
80
|
// Strip spaces from anything parenthesized
|
|
80
81
|
.replace(/\([^)]+\)/g, (substring) => substring.replace(/ /g, ''))
|
|
81
82
|
// Split shadows by commas no inside parentheses
|
|
82
|
-
.match(/[
|
|
83
|
-
// Trim empty spaces
|
|
84
|
-
.map((shadow) => shadow.trim())
|
|
83
|
+
.match(/[^(,]+\([^)]+\)?[^,]*(|$)/g)
|
|
85
84
|
// Convert values
|
|
86
|
-
.map(convertShadow)
|
|
85
|
+
.map((shadow) => convertShadow(shadow))
|
|
87
86
|
// Rejoin shadows
|
|
88
87
|
.join(', ');
|
|
89
88
|
}
|
|
90
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} value
|
|
92
|
+
* @param {number} length
|
|
93
|
+
* @return {number}
|
|
94
|
+
*/
|
|
95
|
+
function parsePercentage(value, length) {
|
|
96
|
+
const numValue = pxToInteger(value);
|
|
97
|
+
if (!value.includes('%')) {
|
|
98
|
+
return numValue;
|
|
99
|
+
}
|
|
100
|
+
return ((numValue * length) / 100);
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
/**
|
|
92
104
|
* @param {string} stringValue
|
|
93
105
|
* @param {number} width
|
|
@@ -95,19 +107,6 @@ function convertBoxShadow(stringValue, scaleX, scaleY) {
|
|
|
95
107
|
* @return {{horizontal:number, vertical:number}}
|
|
96
108
|
*/
|
|
97
109
|
function convertBorderRadius(stringValue, width, height) {
|
|
98
|
-
/**
|
|
99
|
-
* @param {string} value
|
|
100
|
-
* @param {number} length
|
|
101
|
-
* @return {number}
|
|
102
|
-
*/
|
|
103
|
-
function parsePercentage(value, length) {
|
|
104
|
-
const numValue = pxToInteger(value);
|
|
105
|
-
if (value.indexOf('%') === -1) {
|
|
106
|
-
return numValue;
|
|
107
|
-
}
|
|
108
|
-
return ((numValue * length) / 100.0);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
110
|
if (!stringValue) {
|
|
112
111
|
return {
|
|
113
112
|
horizontal: 0,
|
|
@@ -222,9 +221,7 @@ function buildTransitionEndListener(element, property, callback, expectedDuratio
|
|
|
222
221
|
export function transitionElement(options) {
|
|
223
222
|
const toStyleSyle = window.getComputedStyle(options.toShapeElement);
|
|
224
223
|
|
|
225
|
-
const shapeTransform = getShapeTransform(
|
|
226
|
-
options.fromShapeElement, options.toShapeElement, toStyleSyle,
|
|
227
|
-
);
|
|
224
|
+
const shapeTransform = getShapeTransform(options.fromShapeElement, options.toShapeElement, toStyleSyle);
|
|
228
225
|
const contentTransform = getShapeTransform(options.toContentElement, options.fromContentElement);
|
|
229
226
|
|
|
230
227
|
const transitionProperties = [
|
|
@@ -240,17 +237,17 @@ export function transitionElement(options) {
|
|
|
240
237
|
'visibility',
|
|
241
238
|
];
|
|
242
239
|
|
|
243
|
-
/** @type {
|
|
240
|
+
/** @type {Record<string,string>} */
|
|
244
241
|
const oldFromShapeProperties = {};
|
|
245
|
-
/** @type {
|
|
242
|
+
/** @type {Record<string,string>} */
|
|
246
243
|
const oldToShapeProperties = {};
|
|
247
|
-
/** @type {
|
|
244
|
+
/** @type {Record<string,string>} */
|
|
248
245
|
const oldFromContentProperties = {};
|
|
249
|
-
/** @type {
|
|
246
|
+
/** @type {Record<string,string>} */
|
|
250
247
|
const oldToContentProperties = {};
|
|
251
|
-
/** @type {
|
|
248
|
+
/** @type {Record<string,string>} */
|
|
252
249
|
const newFromShapeProperties = {};
|
|
253
|
-
|
|
250
|
+
for (const prop of transitionProperties) {
|
|
254
251
|
oldFromShapeProperties[prop] = options.fromShapeElement.style.getPropertyValue(prop);
|
|
255
252
|
oldToShapeProperties[prop] = options.toShapeElement.style.getPropertyValue(prop);
|
|
256
253
|
oldFromContentProperties[prop] = options.fromContentElement.style.getPropertyValue(prop);
|
|
@@ -298,7 +295,7 @@ export function transitionElement(options) {
|
|
|
298
295
|
} else {
|
|
299
296
|
newFromShapeProperties[prop] = toStyleSyle.getPropertyValue(prop);
|
|
300
297
|
}
|
|
301
|
-
}
|
|
298
|
+
}
|
|
302
299
|
|
|
303
300
|
options.fromShapeElement.setAttribute('mdw-transition-busy', '');
|
|
304
301
|
options.toShapeElement.setAttribute('mdw-transition-busy', '');
|
|
@@ -326,7 +323,7 @@ export function transitionElement(options) {
|
|
|
326
323
|
options.toShapeElement.style.setProperty('visibility', 'visible');
|
|
327
324
|
|
|
328
325
|
const revertFunction = () => {
|
|
329
|
-
|
|
326
|
+
for (const prop of transitionProperties) {
|
|
330
327
|
if (oldFromShapeProperties[prop] == null) {
|
|
331
328
|
options.fromShapeElement.style.removeProperty(prop);
|
|
332
329
|
} else {
|
|
@@ -347,22 +344,16 @@ export function transitionElement(options) {
|
|
|
347
344
|
} else {
|
|
348
345
|
options.toContentElement.style.setProperty(prop, oldToContentProperties[prop]);
|
|
349
346
|
}
|
|
350
|
-
}
|
|
347
|
+
}
|
|
351
348
|
};
|
|
352
349
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (shapeTransform.scaleX * shapeTransform.scaleY >= 1) {
|
|
358
|
-
calculatedDuration = 300; // expand
|
|
359
|
-
} else {
|
|
360
|
-
calculatedDuration = 250; // collapse
|
|
361
|
-
}
|
|
362
|
-
}
|
|
350
|
+
requestAnimationFrame(() => {
|
|
351
|
+
requestAnimationFrame(() => {
|
|
352
|
+
const calculatedDuration = options.duration
|
|
353
|
+
?? ((shapeTransform.scaleX * shapeTransform.scaleY >= 1) ? EXPAND_DURATION_MS : COLLAPSE_DURATION_MS);
|
|
363
354
|
const totalDuration = calculatedDuration.toString(10);
|
|
364
|
-
const fadeInTime = (calculatedDuration * 0.
|
|
365
|
-
const fadeOutTime = (calculatedDuration * 0.
|
|
355
|
+
const fadeInTime = (calculatedDuration * 0.7).toString(10);
|
|
356
|
+
const fadeOutTime = (calculatedDuration * 0.3).toString(10);
|
|
366
357
|
const transformTransition = transitionProperties
|
|
367
358
|
.filter((prop) => prop !== 'transform-origin' && prop !== 'opacity' && prop !== 'transition')
|
|
368
359
|
.map((prop) => `${prop} ${totalDuration}ms cubic-bezier(0.4, 0.0, 0.2, 1) 0s`)
|
|
@@ -374,27 +365,34 @@ export function transitionElement(options) {
|
|
|
374
365
|
].join(', ');
|
|
375
366
|
|
|
376
367
|
options.fromShapeElement.style.setProperty('transition', transformTransition);
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
368
|
+
for (const prop of transitionProperties) {
|
|
369
|
+
switch (prop) {
|
|
370
|
+
case 'transform': {
|
|
371
|
+
options.fromShapeElement.style.setProperty('transform', shapeTransform.toString());
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
case 'transition': continue;
|
|
375
|
+
case 'transform-origin':
|
|
376
|
+
options.fromShapeElement.style.setProperty('transform-origin', '0 0 0');
|
|
377
|
+
continue;
|
|
378
|
+
case 'z-index':
|
|
379
|
+
options.fromShapeElement.style.setProperty('z-index', '8');
|
|
380
|
+
continue;
|
|
381
|
+
case 'visibility':
|
|
382
|
+
options.fromShapeElement.style.setProperty('visibility', 'hidden');
|
|
383
|
+
continue;
|
|
384
|
+
default:
|
|
385
|
+
if (newFromShapeProperties[prop] == null) {
|
|
386
|
+
options.fromShapeElement.style.removeProperty(prop);
|
|
387
|
+
} else {
|
|
388
|
+
options.fromShapeElement.style.setProperty(prop, newFromShapeProperties[prop]);
|
|
389
|
+
}
|
|
392
390
|
}
|
|
393
|
-
}
|
|
391
|
+
}
|
|
394
392
|
|
|
395
|
-
|
|
393
|
+
requestAnimationFrame(() => {
|
|
396
394
|
buildTransitionEndListener(options.fromShapeElement, 'transform', () => {
|
|
397
|
-
|
|
395
|
+
for (const prop of transitionProperties) {
|
|
398
396
|
if (prop === 'transition') {
|
|
399
397
|
options.toShapeElement.style.setProperty('transition', 'none');
|
|
400
398
|
options.toContentElement.style.setProperty('transition', 'none');
|
|
@@ -411,9 +409,8 @@ export function transitionElement(options) {
|
|
|
411
409
|
}
|
|
412
410
|
}
|
|
413
411
|
|
|
414
|
-
if (prop === 'visibility' && !options.revertFrom)
|
|
415
|
-
|
|
416
|
-
}
|
|
412
|
+
if (prop === 'visibility' && !options.revertFrom) continue;
|
|
413
|
+
|
|
417
414
|
if (oldFromContentProperties[prop] == null) {
|
|
418
415
|
options.fromContentElement.style.removeProperty(prop);
|
|
419
416
|
} else {
|
|
@@ -424,11 +421,11 @@ export function transitionElement(options) {
|
|
|
424
421
|
} else {
|
|
425
422
|
options.fromShapeElement.style.setProperty(prop, oldFromShapeProperties[prop]);
|
|
426
423
|
}
|
|
427
|
-
}
|
|
424
|
+
}
|
|
428
425
|
if (options.onTransitionEnd) {
|
|
429
426
|
options.onTransitionEnd(options);
|
|
430
427
|
}
|
|
431
|
-
|
|
428
|
+
requestAnimationFrame(() => {
|
|
432
429
|
if (oldToShapeProperties.transition == null) {
|
|
433
430
|
options.toShapeElement.style.removeProperty('transition');
|
|
434
431
|
} else {
|
package/docs/_flex.scss
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
.display-flex {
|
|
2
2
|
display: flex;
|
|
3
3
|
}
|
|
4
|
+
|
|
4
5
|
.flex-column {
|
|
5
6
|
display: flex;
|
|
6
7
|
flex-direction: column;
|
|
7
8
|
}
|
|
9
|
+
|
|
8
10
|
[flex-column] {
|
|
9
11
|
flex-direction: column;
|
|
10
12
|
}
|
|
13
|
+
|
|
11
14
|
[flex-justify-content="center"] {
|
|
12
15
|
justify-content: center;
|
|
13
16
|
}
|
|
17
|
+
|
|
14
18
|
[flex-align-items="center"] {
|
|
15
19
|
align-items: center;
|
|
16
20
|
}
|
|
21
|
+
|
|
17
22
|
.flex-wrap {
|
|
18
23
|
flex-wrap: wrap;
|
|
19
24
|
}
|
|
25
|
+
|
|
20
26
|
.flex-1 {
|
|
21
27
|
flex: 1;
|
|
22
|
-
}
|
|
28
|
+
}
|
package/docs/_menuoptions.js
CHANGED
|
@@ -57,10 +57,10 @@ export function setAltTheme(value, button) {
|
|
|
57
57
|
const items = document.head.getElementsByTagName('link');
|
|
58
58
|
for (let i = 0; i < items.length; i += 1) {
|
|
59
59
|
const stylesheet = items.item(i);
|
|
60
|
-
if (stylesheet.href.
|
|
60
|
+
if (stylesheet.href.includes(value ? 'theme-colored' : 'theme-default')) {
|
|
61
61
|
stylesheet.disabled = false;
|
|
62
62
|
}
|
|
63
|
-
if (stylesheet.href.
|
|
63
|
+
if (stylesheet.href.includes(value ? 'theme-default' : 'theme-colored')) {
|
|
64
64
|
stylesheet.disabled = true;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -11,19 +11,17 @@
|
|
|
11
11
|
if (value === false || value == null) return false;
|
|
12
12
|
return `${key}="${value}"`
|
|
13
13
|
}).filter(v=>v).join(' ')-%>>
|
|
14
|
-
<div class="mdw-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}})).join(' ') ?? '' _%>
|
|
27
|
-
</div>
|
|
14
|
+
<div class="mdw-appbar__start">
|
|
15
|
+
<%_~ it?.start?.map((icon) => includeFile(T, { button: {
|
|
16
|
+
class:'material-icons', icon:true, text:icon }})).join(' ') ?? '' _%>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="mdw-appbar__title">
|
|
19
|
+
<%_~ it?.body ?? '' %><%= it?.text ?? '' _%>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="mdw-appbar__end">
|
|
22
|
+
<%_~ it?.end?.map((icon) => includeFile(T, { button:{
|
|
23
|
+
class:'material-icons', icon:true, text:icon,
|
|
24
|
+
attributes: { 'mdw-more-button': icon === 'more_vert' }
|
|
25
|
+
}})).join(' ') ?? '' _%>
|
|
28
26
|
</div>
|
|
29
27
|
</div>
|
|
@@ -11,15 +11,14 @@
|
|
|
11
11
|
<meta name="theme-color" content="#C2185B">
|
|
12
12
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
13
13
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
14
|
+
|
|
14
15
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
|
15
|
-
<link rel="stylesheet" href="
|
|
16
|
-
<link rel="stylesheet" href="
|
|
16
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
|
|
17
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Merriweather:300,400,500">
|
|
17
18
|
<link rel="stylesheet" href="docs.min.css">
|
|
18
|
-
<link rel="stylesheet" href="
|
|
19
|
+
<link rel="stylesheet" href="framework.min.css">
|
|
19
20
|
<link rel="stylesheet" href="theme-default.min.css" title="Default Theme">
|
|
20
|
-
<link rel="stylesheet" href="theme-default-fallbacks.min.css" media="all\0" title="Default Theme">
|
|
21
21
|
<link rel="stylesheet" disabled href="theme-colored.min.css" title="Colored Theme">
|
|
22
|
-
<link rel="stylesheet" disabled href="theme-colored-fallbacks.min.css" media="all\0" title="Colored Theme">
|
|
23
22
|
<script src="prerender.min.js"></script>
|
|
24
23
|
</head>
|
|
25
24
|
|
|
@@ -91,46 +90,44 @@
|
|
|
91
90
|
<a class="mdw-layout__scrim" href="#" tabindex="-1"></a>
|
|
92
91
|
<div class="mdw-layout__appbar mdw-appbar mdw-theme" mdw-autohide="mobile tablet" mdw-surface="secondary 500" mdw-dark>
|
|
93
92
|
<div class="mdw-layout__appbar-shape"></div>
|
|
94
|
-
<div class="mdw-
|
|
95
|
-
<div class="mdw-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
<div class="mdw-appbar__start">
|
|
94
|
+
<div class="mdw-tooltip__wrapper">
|
|
95
|
+
<%~ includeFile(T, { button: {
|
|
96
|
+
class: 'mdw-tooltip__target material-icons mdw-layout__navdrawer-toggle',
|
|
97
|
+
text:'menu', icon:true, attributes: { href:"#docs-navdrawer" },
|
|
98
|
+
}}) %>
|
|
99
|
+
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="start">Menu</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="mdw-appbar__title"><%~ it.page %></div>
|
|
103
|
+
<div class="mdw-appbar__end" id="docs-menu-buttons">
|
|
104
|
+
<div class="mdw-tooltip__wrapper">
|
|
105
|
+
<%~ includeFile(T, { button: {
|
|
106
|
+
id: 'altThemeButton', class: 'mdw-tooltip__target material-icons',
|
|
107
|
+
text:'palette', icon:true, attributes: { 'mdw-overlay-default':'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
108
|
+
}}) %>
|
|
109
|
+
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">Alt Theme</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="mdw-tooltip__wrapper">
|
|
112
|
+
<%~ includeFile(T, { button: {
|
|
113
|
+
id: 'darkModeButton', class: 'mdw-tooltip__target material-icons',
|
|
114
|
+
text: 'brightness_3', icon: true, attributes: { 'mdw-overlay-default':'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
115
|
+
}}) %>
|
|
116
|
+
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">Dark Mode</div>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="mdw-tooltip__wrapper">
|
|
119
|
+
<%~ includeFile(T, { button: {
|
|
120
|
+
id: 'rtlButton', class: 'mdw-tooltip__target material-icons',
|
|
121
|
+
text: 'format_align_right', icon: true, attributes: { 'mdw-overlay-default': 'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
122
|
+
}}) %>
|
|
123
|
+
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">Right-to-Left</div>
|
|
103
124
|
</div>
|
|
104
|
-
<div class="mdw-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}}) %>
|
|
111
|
-
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">Alt Theme</div>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="mdw-tooltip__wrapper">
|
|
114
|
-
<%~ includeFile(T, { button: {
|
|
115
|
-
id: 'darkModeButton', class: 'mdw-tooltip__target material-icons',
|
|
116
|
-
text: 'brightness_3', icon: true, attributes: { 'mdw-overlay-default':'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
117
|
-
}}) %>
|
|
118
|
-
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">Dark Mode</div>
|
|
119
|
-
</div>
|
|
120
|
-
<div class="mdw-tooltip__wrapper">
|
|
121
|
-
<%~ includeFile(T, { button: {
|
|
122
|
-
id: 'rtlButton', class: 'mdw-tooltip__target material-icons',
|
|
123
|
-
text: 'format_align_right', icon: true, attributes: { 'mdw-overlay-default': 'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
124
|
-
}}) %>
|
|
125
|
-
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">Right-to-Left</div>
|
|
126
|
-
</div>
|
|
127
|
-
<div class="mdw-tooltip__wrapper">
|
|
128
|
-
<%~ includeFile(T, { button: {
|
|
129
|
-
id: 'largeFontButton', class: 'mdw-tooltip__target material-icons',
|
|
130
|
-
text: 'format_size', icon: true, attributes: { 'mdw-overlay-default': 'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
131
|
-
}}) %>
|
|
132
|
-
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">200% Text</div>
|
|
133
|
-
</div>
|
|
125
|
+
<div class="mdw-tooltip__wrapper">
|
|
126
|
+
<%~ includeFile(T, { button: {
|
|
127
|
+
id: 'largeFontButton', class: 'mdw-tooltip__target material-icons',
|
|
128
|
+
text: 'format_size', icon: true, attributes: { 'mdw-overlay-default': 'medium', 'mdw-overlay-off':'activated', 'aria-pressed':'false' },
|
|
129
|
+
}}) %>
|
|
130
|
+
<div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark mdw-align="end">200% Text</div>
|
|
134
131
|
</div>
|
|
135
132
|
</div>
|
|
136
133
|
</div>
|
package/docs/_sample-utils.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { iterateArrayLike } from '../core/dom.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* @param {Element|HTMLElement} element
|
|
5
3
|
* @param {boolean} [pug=false]
|
|
@@ -12,19 +10,19 @@ function convertElementToCode(element, pug = false, linePrefix = '') {
|
|
|
12
10
|
const attributes = [];
|
|
13
11
|
/** @type {string[]} */
|
|
14
12
|
const classes = [];
|
|
15
|
-
|
|
13
|
+
for (const c of element.classList) {
|
|
16
14
|
classes.push(c);
|
|
17
|
-
}
|
|
18
|
-
|
|
15
|
+
}
|
|
16
|
+
for (const attr of element.attributes) {
|
|
19
17
|
if (attr.name === 'class') {
|
|
20
|
-
|
|
18
|
+
continue;
|
|
21
19
|
}
|
|
22
20
|
if (attr.value.length) {
|
|
23
21
|
attributes.push(`${attr.name}="${attr.value}"`);
|
|
24
22
|
} else {
|
|
25
23
|
attributes.push(attr.name);
|
|
26
24
|
}
|
|
27
|
-
}
|
|
25
|
+
}
|
|
28
26
|
attributes.sort();
|
|
29
27
|
const syntaxItems = [
|
|
30
28
|
htmlType,
|
|
@@ -33,36 +31,33 @@ function convertElementToCode(element, pug = false, linePrefix = '') {
|
|
|
33
31
|
];
|
|
34
32
|
const openingHTMLLine = pug
|
|
35
33
|
? `${htmlType === 'div' && classes.length ? '' : htmlType}${classes.length ? `.${classes.join('.')}` : ''}${attributes.length ? `(${attributes.join(' ')})` : ''}`
|
|
36
|
-
: `<${syntaxItems.filter(
|
|
34
|
+
: `<${syntaxItems.filter(Boolean).join(' ').trim()}>`;
|
|
37
35
|
const closingHTMLLine = pug ? '' : `</${htmlType}>`;
|
|
38
36
|
const lines = [openingHTMLLine];
|
|
39
37
|
/** @type {string[]} */
|
|
40
38
|
const innerLines = [];
|
|
41
39
|
let onlyText = true;
|
|
42
|
-
|
|
40
|
+
for (const child of element.childNodes) {
|
|
43
41
|
let lineText;
|
|
44
42
|
if (child instanceof HTMLElement) {
|
|
45
43
|
lineText = convertElementToCode(child, pug, ` ${linePrefix}`);
|
|
46
44
|
if (lineText.trim()) {
|
|
47
45
|
onlyText = false;
|
|
48
46
|
}
|
|
49
|
-
} else if (child.nodeValue) {
|
|
50
|
-
|
|
51
|
-
lineText = ` ${child.nodeValue}`;
|
|
52
|
-
}
|
|
47
|
+
} else if (child.nodeValue && pug) {
|
|
48
|
+
lineText = ` ${child.nodeValue}`;
|
|
53
49
|
}
|
|
54
50
|
if (lineText && lineText.trim()) {
|
|
55
51
|
innerLines.push(lineText);
|
|
56
52
|
}
|
|
57
|
-
}
|
|
53
|
+
}
|
|
58
54
|
if (onlyText) {
|
|
59
55
|
if (pug) {
|
|
60
56
|
return `${linePrefix + lines.join('')} ${innerLines.join('').trim()}`;
|
|
61
57
|
}
|
|
62
58
|
return linePrefix + lines.join('') + innerLines.join('').trim() + closingHTMLLine;
|
|
63
59
|
}
|
|
64
|
-
|
|
65
|
-
lines.push(linePrefix + closingHTMLLine);
|
|
60
|
+
lines.push(...innerLines, linePrefix + closingHTMLLine);
|
|
66
61
|
return linePrefix + lines.filter((line) => line.trim()).join('\n');
|
|
67
62
|
}
|
|
68
63
|
|
|
@@ -73,17 +68,17 @@ function convertElementToCode(element, pug = false, linePrefix = '') {
|
|
|
73
68
|
*/
|
|
74
69
|
function changeElementTagName(element, tagname) {
|
|
75
70
|
const newElement = document.createElement(tagname);
|
|
76
|
-
|
|
71
|
+
let i = element.attributes.length;
|
|
72
|
+
while (i--) {
|
|
77
73
|
const attr = element.attributes.item(i);
|
|
78
|
-
/** @type {Attr} */
|
|
79
|
-
const clonedAttr = (attr.cloneNode());
|
|
74
|
+
const clonedAttr = /** @type {Attr} */ (attr.cloneNode());
|
|
80
75
|
newElement.attributes.setNamedItem(clonedAttr);
|
|
81
76
|
}
|
|
82
77
|
while (element.firstChild) {
|
|
83
78
|
newElement.appendChild(element.firstChild);
|
|
84
79
|
}
|
|
85
80
|
|
|
86
|
-
element.
|
|
81
|
+
element.replaceWith(newElement);
|
|
87
82
|
return newElement;
|
|
88
83
|
}
|
|
89
84
|
|