@xenknight/framework7 0.0.5 → 0.0.6
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/components/block/block-vars.less +6 -6
- package/components/button/button-vars.less +11 -10
- package/components/dialog/dialog-class.js +6 -3
- package/components/dialog/dialog-ios.less +10 -34
- package/components/dialog/dialog-md.less +2 -22
- package/components/dialog/dialog-rtl.css +1 -1
- package/components/dialog/dialog-vars.less +8 -10
- package/components/dialog/dialog.css +1 -1
- package/components/dialog/dialog.js +3 -3
- package/components/dialog/dialog.less +6 -25
- package/components/list/list-vars.less +7 -5
- package/components/list/list.less +1 -1
- package/components/notification/notification-class.js +6 -6
- package/components/notification/notification-ios.less +3 -8
- package/components/notification/notification-md.less +1 -20
- package/components/notification/notification-rtl.css +1 -1
- package/components/notification/notification-vars.less +13 -16
- package/components/notification/notification.css +1 -1
- package/components/notification/notification.less +13 -1
- package/components/popover/popover-class.js +21 -58
- package/components/popover/popover-ios.less +66 -2
- package/components/popover/popover-md.less +2 -27
- package/components/popover/popover-rtl.css +1 -1
- package/components/popover/popover-vars.less +2 -3
- package/components/popover/popover.css +1 -1
- package/components/popover/popover.d.ts +0 -2
- package/components/popover/popover.js +0 -1
- package/components/popover/popover.less +28 -50
- package/components/range/range-class.js +34 -27
- package/components/range/range-ios.less +60 -0
- package/components/range/range-md.less +67 -4
- package/components/range/range-rtl.css +1 -1
- package/components/range/range-vars.less +18 -13
- package/components/range/range.css +1 -1
- package/components/range/range.d.ts +3 -1
- package/components/range/range.less +11 -24
- package/components/swipeout/swipeout-ios.less +37 -0
- package/components/swipeout/swipeout-md.less +56 -0
- package/components/swipeout/swipeout-rtl.css +1 -1
- package/components/swipeout/swipeout-vars.less +13 -2
- package/components/swipeout/swipeout.css +1 -1
- package/components/swipeout/swipeout.js +99 -23
- package/components/swipeout/swipeout.less +20 -44
- package/components/toast/toast-class.js +2 -2
- package/components/toast/toast-ios.less +2 -0
- package/components/toast/toast-rtl.css +1 -1
- package/components/toast/toast-vars.less +2 -4
- package/components/toast/toast.css +1 -1
- package/components/toast/toast.less +1 -1
- package/framework7-bundle-rtl.css +417 -368
- package/framework7-bundle-rtl.min.css +4 -4
- package/framework7-bundle.css +417 -368
- package/framework7-bundle.esm.js +2 -2
- package/framework7-bundle.js +2446 -849
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +2 -2
- package/framework7-bundle.min.css +4 -4
- package/framework7-bundle.min.js +3 -3
- package/framework7-bundle.min.js.map +1 -1
- package/framework7-lite-bundle.esm.js +2 -2
- package/framework7-lite.esm.js +2 -2
- package/framework7-rtl.css +27 -25
- package/framework7-rtl.min.css +3 -3
- package/framework7.css +27 -25
- package/framework7.esm.js +2 -2
- package/framework7.less +2 -2
- package/framework7.min.css +3 -3
- package/package.json +1 -1
- package/shared/get-support.d.ts +0 -6
- package/shared/get-support.js +1 -20
- package/shared/material-color-utils.js +2153 -679
- package/shared/material-colors.js +97 -17
- package/shared/utils.js +18 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line
|
|
2
|
-
import { argbFromHex, hexFromArgb,
|
|
2
|
+
import { argbFromHex, hexFromArgb, Hct, SchemeTonalSpot, SchemeVibrant, SchemeMonochrome } from './material-color-utils.js';
|
|
3
3
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
// prettier-ignore
|
|
@@ -42,34 +42,114 @@ function blend(from, to, p) {
|
|
|
42
42
|
}
|
|
43
43
|
/* eslint-enable */
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
let monochromeCached = null;
|
|
46
|
+
const cachedColors = {};
|
|
47
|
+
export const materialColors = function (hexColor, colorScheme) {
|
|
46
48
|
if (hexColor === void 0) {
|
|
47
49
|
hexColor = '';
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (colorScheme === void 0) {
|
|
52
|
+
colorScheme = 'default';
|
|
53
|
+
}
|
|
54
|
+
const cacheKey = `${hexColor}-${colorScheme}`;
|
|
55
|
+
if (cachedColors[cacheKey]) {
|
|
56
|
+
return cachedColors[cacheKey];
|
|
57
|
+
}
|
|
58
|
+
if (monochromeCached && colorScheme.includes('monochrome')) {
|
|
59
|
+
const defaultColors = materialColors(hexColor, colorScheme === 'monochrome' ? 'default' : 'vibrant');
|
|
60
|
+
cachedColors[cacheKey] = {
|
|
61
|
+
light: {
|
|
62
|
+
...defaultColors.light,
|
|
63
|
+
...monochromeCached.light
|
|
64
|
+
},
|
|
65
|
+
dark: {
|
|
66
|
+
...defaultColors.dark,
|
|
67
|
+
...monochromeCached.dark
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return cachedColors[cacheKey];
|
|
71
|
+
}
|
|
72
|
+
const sourceColor = argbFromHex(`#${hexColor.replace('#', '')}`);
|
|
73
|
+
let lightScheme;
|
|
74
|
+
let darkScheme;
|
|
75
|
+
const hctColor = Hct.fromInt(sourceColor);
|
|
76
|
+
if (colorScheme === 'default') {
|
|
77
|
+
lightScheme = new SchemeTonalSpot(hctColor, false, 0, '2025');
|
|
78
|
+
darkScheme = new SchemeTonalSpot(hctColor, true, 0, '2025');
|
|
79
|
+
}
|
|
80
|
+
if (colorScheme === 'vibrant') {
|
|
81
|
+
lightScheme = new SchemeVibrant(hctColor, false, 0, '2025');
|
|
82
|
+
darkScheme = new SchemeVibrant(hctColor, true, 0, '2025');
|
|
83
|
+
}
|
|
84
|
+
if (colorScheme.includes('monochrome')) {
|
|
85
|
+
lightScheme = new SchemeMonochrome(hctColor, false, 0, '2025');
|
|
86
|
+
darkScheme = new SchemeMonochrome(hctColor, true, 0, '2025');
|
|
87
|
+
}
|
|
88
|
+
const getColorName = name => {
|
|
89
|
+
let newName = name;
|
|
90
|
+
if (name === 'surface_dim') newName = 'surface_variant';
|
|
91
|
+
if (name === 'surface_container_low') newName = 'surface_1';
|
|
92
|
+
if (name === 'surface_container') newName = 'surface_2';
|
|
93
|
+
if (name === 'surface_container_high') newName = 'surface_3';
|
|
94
|
+
if (name === 'surface_container_highest') newName = 'surface_4';
|
|
95
|
+
return newName;
|
|
96
|
+
};
|
|
97
|
+
const theme = {
|
|
98
|
+
light: {},
|
|
99
|
+
dark: {}
|
|
100
|
+
};
|
|
101
|
+
lightScheme.colors.allColors.forEach(color => {
|
|
102
|
+
const name = getColorName(color.name);
|
|
103
|
+
const argb = color.getArgb(lightScheme);
|
|
104
|
+
theme.light[name] = argb;
|
|
53
105
|
});
|
|
106
|
+
darkScheme.colors.allColors.forEach(color => {
|
|
107
|
+
const name = getColorName(color.name);
|
|
108
|
+
const argb = color.getArgb(darkScheme);
|
|
109
|
+
theme.dark[name] = argb;
|
|
110
|
+
});
|
|
111
|
+
theme.light.surface_5 = argbFromHex(blend(hexFromArgb(theme.light.surface_4), hexFromArgb(theme.light.primary), 0.05));
|
|
112
|
+
theme.dark.surface_5 = argbFromHex(blend(hexFromArgb(theme.dark.surface_4), hexFromArgb(theme.dark.primary), 0.05));
|
|
54
113
|
const name = n => {
|
|
55
|
-
return n.
|
|
114
|
+
return n.replace(/_/g, '-');
|
|
56
115
|
};
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
|
|
116
|
+
const shouldKeep = prop => {
|
|
117
|
+
const foreground = ['inverse_primary', 'primary', 'on_primary', 'primary_container', 'on_primary_container', 'secondary', 'on_secondary', 'secondary_container', 'on_secondary_container', 'outline', 'outline_variant'];
|
|
118
|
+
const background = ['on_surface', 'on_surface_variant', 'inverse_on_surface', 'inverse_surface', 'surface', 'surface_variant', 'surface_1', 'surface_2', 'surface_3', 'surface_4', 'surface_5'];
|
|
119
|
+
const keep = colorScheme === 'default' ? [...foreground, ...background] : colorScheme === 'vibrant' ? [...foreground, ...background] : background;
|
|
120
|
+
return keep.includes(prop);
|
|
60
121
|
};
|
|
61
122
|
const light = {};
|
|
62
123
|
const dark = {};
|
|
63
|
-
Object.keys(theme.
|
|
64
|
-
if (
|
|
65
|
-
light[name(`--f7-md-${prop}`)] = hexFromArgb(theme.
|
|
124
|
+
Object.keys(theme.light).forEach(prop => {
|
|
125
|
+
if (!shouldKeep(prop)) return;
|
|
126
|
+
light[name(`--f7-md-${prop}`)] = hexFromArgb(theme.light[prop]);
|
|
66
127
|
});
|
|
67
|
-
Object.keys(theme.
|
|
68
|
-
if (
|
|
69
|
-
dark[name(`--f7-md-${prop}`)] = hexFromArgb(theme.
|
|
128
|
+
Object.keys(theme.dark).forEach(prop => {
|
|
129
|
+
if (!shouldKeep(prop)) return;
|
|
130
|
+
dark[name(`--f7-md-${prop}`)] = hexFromArgb(theme.dark[prop]);
|
|
70
131
|
});
|
|
71
|
-
|
|
132
|
+
if (colorScheme.includes('monochrome')) {
|
|
133
|
+
monochromeCached = {
|
|
134
|
+
light,
|
|
135
|
+
dark
|
|
136
|
+
};
|
|
137
|
+
const defaultColors = materialColors(hexColor, colorScheme === 'monochrome' ? 'default' : 'vibrant');
|
|
138
|
+
cachedColors[cacheKey] = {
|
|
139
|
+
light: {
|
|
140
|
+
...defaultColors.light,
|
|
141
|
+
...light
|
|
142
|
+
},
|
|
143
|
+
dark: {
|
|
144
|
+
...defaultColors.dark,
|
|
145
|
+
...dark
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return cachedColors[cacheKey];
|
|
149
|
+
}
|
|
150
|
+
cachedColors[cacheKey] = {
|
|
72
151
|
light,
|
|
73
152
|
dark
|
|
74
153
|
};
|
|
154
|
+
return cachedColors[cacheKey];
|
|
75
155
|
};
|
package/shared/utils.js
CHANGED
|
@@ -332,31 +332,40 @@ const getShadeTintColors = rgb => {
|
|
|
332
332
|
export function colorThemeCSSProperties() {
|
|
333
333
|
let hex;
|
|
334
334
|
let rgb;
|
|
335
|
+
let mdColorScheme;
|
|
335
336
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
336
337
|
args[_key3] = arguments[_key3];
|
|
337
338
|
}
|
|
338
339
|
if (args.length === 1) {
|
|
339
340
|
hex = args[0];
|
|
340
341
|
rgb = colorHexToRgb(hex);
|
|
342
|
+
} else if (args.length === 2) {
|
|
343
|
+
hex = args[0];
|
|
344
|
+
rgb = colorHexToRgb(hex);
|
|
345
|
+
mdColorScheme = args[1] || 'default';
|
|
341
346
|
} else if (args.length === 3) {
|
|
342
347
|
rgb = args;
|
|
343
348
|
hex = colorRgbToHex(...rgb);
|
|
349
|
+
} else if (args.length === 4) {
|
|
350
|
+
rgb = args.slice(0, 3);
|
|
351
|
+
hex = colorRgbToHex(...rgb);
|
|
352
|
+
mdColorScheme = args[3] || 'default';
|
|
344
353
|
}
|
|
345
354
|
if (!rgb) return {};
|
|
346
355
|
const {
|
|
347
356
|
light,
|
|
348
357
|
dark
|
|
349
|
-
} = materialColors(hex);
|
|
358
|
+
} = materialColors(hex, mdColorScheme);
|
|
350
359
|
const shadeTintIos = getShadeTintColors(rgb);
|
|
351
360
|
const shadeTintMdLight = getShadeTintColors(colorHexToRgb(light['--f7-md-primary']));
|
|
352
361
|
const shadeTintMdDark = getShadeTintColors(colorHexToRgb(dark['--f7-md-primary']));
|
|
353
362
|
Object.keys(light).forEach(key => {
|
|
354
|
-
if (key.includes('surface-')) {
|
|
363
|
+
if (key.includes('surface-') && !key.includes('-rgb')) {
|
|
355
364
|
light[`${key}-rgb`] = colorHexToRgb(light[key]);
|
|
356
365
|
}
|
|
357
366
|
});
|
|
358
367
|
Object.keys(dark).forEach(key => {
|
|
359
|
-
if (key.includes('surface-')) {
|
|
368
|
+
if (key.includes('surface-') && !key.includes('-rgb')) {
|
|
360
369
|
dark[`${key}-rgb`] = colorHexToRgb(dark[key]);
|
|
361
370
|
}
|
|
362
371
|
});
|
|
@@ -413,10 +422,13 @@ export function flattenArray() {
|
|
|
413
422
|
});
|
|
414
423
|
return arr;
|
|
415
424
|
}
|
|
416
|
-
export function colorThemeCSSStyles(colors) {
|
|
425
|
+
export function colorThemeCSSStyles(colors, mdColorScheme) {
|
|
417
426
|
if (colors === void 0) {
|
|
418
427
|
colors = {};
|
|
419
428
|
}
|
|
429
|
+
if (mdColorScheme === void 0) {
|
|
430
|
+
mdColorScheme = 'default';
|
|
431
|
+
}
|
|
420
432
|
const stringifyObject = obj => {
|
|
421
433
|
let res = '';
|
|
422
434
|
Object.keys(obj).forEach(key => {
|
|
@@ -424,12 +436,12 @@ export function colorThemeCSSStyles(colors) {
|
|
|
424
436
|
});
|
|
425
437
|
return res;
|
|
426
438
|
};
|
|
427
|
-
const colorVars = colorThemeCSSProperties(colors.primary);
|
|
439
|
+
const colorVars = colorThemeCSSProperties(colors.primary, mdColorScheme);
|
|
428
440
|
const primary = [`:root{`, stringifyObject(colorVars.light), `--swiper-theme-color:var(--f7-theme-color);`, ...Object.keys(colors).map(colorName => `--f7-color-${colorName}: ${colors[colorName]};`), `}`, `.dark{`, stringifyObject(colorVars.dark), `}`, `.ios, .ios .dark{`, stringifyObject(colorVars.ios), '}', `.md, .md .dark{`, stringifyObject(colorVars.md), '}'].join('');
|
|
429
441
|
const restVars = {};
|
|
430
442
|
Object.keys(colors).forEach(colorName => {
|
|
431
443
|
const colorValue = colors[colorName];
|
|
432
|
-
restVars[colorName] = colorThemeCSSProperties(colorValue);
|
|
444
|
+
restVars[colorName] = colorThemeCSSProperties(colorValue, mdColorScheme);
|
|
433
445
|
});
|
|
434
446
|
|
|
435
447
|
// rest
|