framework7 8.3.4 → 9.0.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/components/accordion/accordion-rtl.css +1 -1
- package/components/accordion/accordion.css +1 -1
- package/components/actions/actions-ios.less +22 -15
- package/components/actions/actions-rtl.css +1 -1
- package/components/actions/actions-vars.less +4 -7
- package/components/actions/actions.css +1 -1
- package/components/actions/actions.js +2 -8
- package/components/actions/actions.less +0 -3
- package/components/app/app-class.d.ts +2 -0
- package/components/app/app-class.js +19 -15
- package/components/app/app-vars.less +41 -6
- package/components/app/app.less +1 -1
- package/components/area-chart/area-chart-class.js +18 -31
- package/components/area-chart/area-chart-rtl.css +1 -1
- package/components/area-chart/area-chart.css +1 -1
- package/components/autocomplete/autocomplete-class.js +13 -14
- package/components/autocomplete/autocomplete-ios.less +16 -0
- package/components/autocomplete/autocomplete-rtl.css +1 -1
- package/components/autocomplete/autocomplete.css +1 -1
- package/components/autocomplete/autocomplete.d.ts +3 -3
- package/components/autocomplete/autocomplete.js +3 -3
- package/components/autocomplete/autocomplete.less +7 -1
- package/components/block/block-vars.less +6 -6
- package/components/breadcrumbs/breadcrumbs-rtl.css +1 -1
- package/components/breadcrumbs/breadcrumbs.css +1 -1
- package/components/button/button-vars.less +13 -12
- package/components/button/button.less +2 -1
- package/components/calendar/calendar-class.js +20 -17
- package/components/calendar/calendar-ios.less +43 -0
- package/components/calendar/calendar-md.less +3 -0
- package/components/calendar/calendar-rtl.css +1 -1
- package/components/calendar/calendar-vars.less +24 -19
- package/components/calendar/calendar.css +1 -1
- package/components/calendar/calendar.d.ts +1 -1
- package/components/calendar/calendar.js +5 -8
- package/components/calendar/calendar.less +4 -2
- package/components/card/card-rtl.css +1 -1
- package/components/card/card-vars.less +5 -5
- package/components/card/card.css +1 -1
- package/components/card/card.js +3 -18
- package/components/card/card.less +1 -1
- package/components/checkbox/checkbox-rtl.css +1 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/chip/chip-rtl.css +1 -1
- package/components/chip/chip.css +1 -1
- package/components/color-picker/color-picker-class.js +11 -23
- package/components/color-picker/color-picker-ios.less +9 -0
- package/components/color-picker/color-picker-md.less +15 -0
- package/components/color-picker/color-picker-rtl.css +1 -1
- package/components/color-picker/color-picker-vars.less +9 -3
- package/components/color-picker/color-picker.css +1 -1
- package/components/color-picker/color-picker.d.ts +1 -2
- package/components/color-picker/color-picker.js +3 -7
- package/components/color-picker/color-picker.less +5 -25
- package/components/color-picker/modules/alpha-slider.js +2 -0
- package/components/color-picker/modules/brightness-slider.js +2 -0
- package/components/color-picker/modules/hs-spectrum.js +1 -2
- package/components/color-picker/modules/hsb-sliders.js +6 -0
- package/components/color-picker/modules/hue-slider.js +2 -0
- package/components/color-picker/modules/rgb-bars.js +6 -0
- package/components/color-picker/modules/rgb-sliders.js +6 -0
- package/components/color-picker/modules/sb-spectrum.js +1 -2
- package/components/color-picker/modules/wheel.js +1 -2
- package/components/contacts-list/contacts-list-rtl.css +1 -1
- package/components/contacts-list/contacts-list.css +1 -1
- package/components/data-table/data-table-class.js +1 -4
- package/components/data-table/data-table-ios.less +1 -1
- package/components/data-table/data-table-md.less +4 -2
- package/components/data-table/data-table-rtl.css +1 -1
- package/components/data-table/data-table.css +1 -1
- package/components/data-table/data-table.less +4 -4
- 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 +9 -27
- package/components/dialog/dialog.less +6 -25
- package/components/fab/fab-ios.less +2 -0
- package/components/fab/fab-rtl.css +1 -1
- package/components/fab/fab-vars.less +30 -6
- package/components/fab/fab.css +1 -1
- package/components/fab/fab.js +3 -12
- package/components/gauge/gauge-class.js +2 -8
- package/components/gauge/gauge-rtl.css +1 -1
- package/components/gauge/gauge.css +1 -1
- package/components/icon/icon-ios.less +10 -0
- package/components/icon/icon-md.less +9 -0
- package/components/icon/icon.less +2 -1
- package/components/infinite-scroll/infinite-scroll-rtl.css +1 -1
- package/components/infinite-scroll/infinite-scroll.css +1 -1
- package/components/input/input-ios.less +3 -2
- package/components/input/input-rtl.css +1 -1
- package/components/input/input.css +1 -1
- package/components/input/input.js +2 -5
- package/components/list/list-vars.less +7 -5
- package/components/list/list.less +1 -1
- package/components/list-index/list-index-class.js +3 -7
- package/components/list-index/list-index-rtl.css +1 -1
- package/components/list-index/list-index.css +1 -1
- package/components/login-screen/login-screen-rtl.css +1 -1
- package/components/login-screen/login-screen.css +1 -1
- package/components/login-screen/login-screen.js +2 -8
- package/components/login-screen/login-screen.less +1 -0
- package/components/messagebar/messagebar-class.js +5 -20
- package/components/messagebar/messagebar-ios.less +19 -14
- package/components/messagebar/messagebar-md.less +3 -0
- package/components/messagebar/messagebar-rtl.css +1 -1
- package/components/messagebar/messagebar-vars.less +12 -15
- package/components/messagebar/messagebar.css +1 -1
- package/components/messagebar/messagebar.less +4 -5
- package/components/messages/messages-class.js +25 -52
- package/components/messages/messages-ios.less +6 -2
- package/components/messages/messages-rtl.css +1 -1
- package/components/messages/messages-vars.less +1 -1
- package/components/messages/messages.css +1 -1
- package/components/navbar/navbar-ios.less +52 -672
- package/components/navbar/navbar-md.less +41 -1
- package/components/navbar/navbar-vars.less +4 -3
- package/components/navbar/navbar.js +28 -185
- package/components/navbar/navbar.less +8 -66
- 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 +8 -1
- package/components/page/page-ios.less +1 -8
- package/components/page/page-md.less +12 -11
- package/components/page/page.less +14 -12
- package/components/panel/panel-class.js +7 -28
- package/components/panel/panel-ios.less +4 -0
- package/components/panel/panel-rtl.css +1 -3
- package/components/panel/panel-vars.less +8 -5
- package/components/panel/panel.css +1 -3
- package/components/panel/panel.js +8 -32
- package/components/panel/panel.less +9 -9
- package/components/panel/resizable-panel.js +2 -4
- package/components/photo-browser/photo-browser-class.js +12 -47
- package/components/photo-browser/photo-browser-rtl.css +1 -1
- package/components/photo-browser/photo-browser-vars.less +8 -10
- package/components/photo-browser/photo-browser.css +1 -1
- package/components/photo-browser/photo-browser.d.ts +2 -4
- package/components/photo-browser/photo-browser.js +1 -3
- package/components/photo-browser/photo-browser.less +15 -71
- package/components/picker/picker-class.js +4 -5
- package/components/picker/picker-ios.less +6 -1
- package/components/picker/picker-md.less +9 -0
- package/components/picker/picker-rtl.css +1 -1
- package/components/picker/picker-vars.less +1 -1
- package/components/picker/picker.css +1 -1
- package/components/picker/picker.d.ts +1 -1
- package/components/picker/picker.js +2 -5
- package/components/picker/picker.less +0 -4
- package/components/pie-chart/pie-chart-class.js +7 -14
- package/components/pie-chart/pie-chart-rtl.css +1 -1
- package/components/pie-chart/pie-chart.css +1 -1
- package/components/popover/popover-class.js +22 -62
- 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 +2 -9
- package/components/popover/popover.less +28 -50
- package/components/popup/popup-class.js +15 -9
- package/components/popup/popup-rtl.css +1 -1
- package/components/popup/popup-vars.less +2 -2
- package/components/popup/popup.css +1 -1
- package/components/popup/popup.js +2 -8
- package/components/popup/popup.less +6 -6
- package/components/preloader/preloader-rtl.css +1 -1
- package/components/preloader/preloader.css +1 -1
- package/components/preloader/preloader.js +2 -8
- package/components/progressbar/progressbar-md.less +12 -0
- package/components/progressbar/progressbar-rtl.css +1 -1
- package/components/progressbar/progressbar-vars.less +6 -5
- package/components/progressbar/progressbar.css +1 -1
- package/components/progressbar/progressbar.js +3 -12
- package/components/progressbar/progressbar.less +6 -0
- package/components/pull-to-refresh/pull-to-refresh-class.js +5 -12
- package/components/pull-to-refresh/pull-to-refresh-rtl.css +1 -1
- package/components/pull-to-refresh/pull-to-refresh.css +1 -1
- package/components/radio/radio-rtl.css +1 -1
- package/components/radio/radio.css +1 -1
- 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.js +2 -8
- package/components/range/range.less +11 -24
- package/components/searchbar/searchbar-class.js +7 -8
- package/components/searchbar/searchbar-ios.less +37 -13
- package/components/searchbar/searchbar-md.less +5 -0
- package/components/searchbar/searchbar-rtl.css +1 -1
- package/components/searchbar/searchbar-vars.less +13 -16
- package/components/searchbar/searchbar.css +1 -1
- package/components/searchbar/searchbar.js +4 -32
- package/components/searchbar/searchbar.less +4 -5
- package/components/sheet/sheet-class.js +21 -17
- package/components/sheet/sheet-ios.less +10 -0
- package/components/sheet/sheet-md.less +14 -0
- package/components/sheet/sheet-rtl.css +1 -1
- package/components/sheet/sheet-vars.less +5 -9
- package/components/sheet/sheet.css +1 -1
- package/components/sheet/sheet.js +2 -8
- package/components/sheet/sheet.less +5 -17
- package/components/skeleton/skeleton-rtl.css +1 -1
- package/components/skeleton/skeleton.css +1 -1
- package/components/smart-select/smart-select-class.js +15 -20
- package/components/smart-select/smart-select-rtl.css +1 -1
- package/components/smart-select/smart-select.css +1 -1
- package/components/smart-select/smart-select.d.ts +5 -7
- package/components/smart-select/smart-select.js +4 -4
- package/components/sortable/sortable-rtl.css +1 -1
- package/components/sortable/sortable.css +1 -1
- package/components/sortable/sortable.js +8 -27
- package/components/statusbar/statusbar.js +2 -5
- package/components/stepper/stepper-rtl.css +1 -1
- package/components/stepper/stepper-vars.less +3 -3
- package/components/stepper/stepper.css +1 -1
- package/components/stepper/stepper.js +2 -8
- package/components/subnavbar/subnavbar-ios.less +16 -1
- package/components/subnavbar/subnavbar-md.less +5 -5
- package/components/subnavbar/subnavbar-vars.less +12 -6
- package/components/subnavbar/subnavbar.less +5 -6
- 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 +102 -35
- package/components/swipeout/swipeout.less +20 -44
- package/components/swiper/swiper-rtl.css +1 -1
- package/components/swiper/swiper.css +1 -1
- package/components/tabs/tabs-rtl.css +1 -1
- package/components/tabs/tabs.css +1 -1
- package/components/tabs/tabs.js +3 -9
- package/components/text-editor/text-editor-class.js +1 -1
- package/components/text-editor/text-editor-rtl.css +1 -1
- package/components/text-editor/text-editor.css +1 -1
- package/components/timeline/timeline-ios.less +0 -5
- package/components/timeline/timeline-md.less +0 -5
- package/components/timeline/timeline-rtl.css +1 -1
- package/components/timeline/timeline-vars.less +1 -17
- package/components/timeline/timeline.css +1 -1
- package/components/timeline/timeline.less +0 -196
- 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/components/toggle/toggle-class.js +5 -12
- package/components/toggle/toggle-ios.less +68 -50
- package/components/toggle/toggle-rtl.css +1 -1
- package/components/toggle/toggle-vars.less +2 -2
- package/components/toggle/toggle.css +1 -1
- package/components/toolbar/tabbar-highlight.js +134 -0
- package/components/toolbar/toolbar-ios.less +160 -14
- package/components/toolbar/toolbar-md.less +77 -3
- package/components/toolbar/toolbar-vars.less +14 -10
- package/components/toolbar/toolbar.js +32 -13
- package/components/toolbar/toolbar.less +8 -56
- package/components/tooltip/tooltip-class.js +13 -16
- package/components/tooltip/tooltip-rtl.css +1 -1
- package/components/tooltip/tooltip.css +1 -1
- package/components/tooltip/tooltip.js +0 -16
- package/components/touch-highlight/touch-highlight-ios.less +17 -0
- package/components/touch-highlight/touch-highlight-md.less +2 -0
- package/components/touch-highlight/touch-highlight-vars.less +8 -0
- package/components/touch-highlight/touch-highlight.d.ts +25 -0
- package/components/touch-highlight/touch-highlight.js +123 -0
- package/components/touch-highlight/touch-highlight.less +9 -0
- package/components/touch-ripple/touch-ripple.js +1 -4
- package/components/treeview/treeview-rtl.css +1 -1
- package/components/treeview/treeview.css +1 -1
- package/components/typography/typography-rtl.css +1 -1
- package/components/typography/typography.css +1 -1
- package/components/view/resizable-view.js +2 -4
- package/components/view/view-class.js +1 -15
- package/components/view/view.d.ts +0 -4
- package/components/view/view.js +1 -5
- package/components/virtual-list/virtual-list-class.js +2 -8
- package/framework7-bundle-rtl.css +2284 -3019
- package/framework7-bundle-rtl.min.css +4 -10
- package/framework7-bundle.css +2245 -2978
- package/framework7-bundle.esm.js +5 -4
- package/framework7-bundle.js +7180 -6477
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +4 -3
- package/framework7-bundle.min.css +4 -10
- package/framework7-bundle.min.js +4 -4
- package/framework7-bundle.min.js.map +1 -1
- package/framework7-lite-bundle.esm.js +5 -4
- package/framework7-lite.esm.js +5 -4
- package/framework7-rtl.css +509 -844
- package/framework7-rtl.min.css +4 -8
- package/framework7-types.d.ts +5 -1
- package/framework7.css +509 -843
- package/framework7.d.ts +4 -0
- package/framework7.esm.js +5 -4
- package/framework7.less +4 -3
- package/framework7.min.css +4 -8
- package/less/mixins.less +10 -12
- package/modules/component/$h.js +1 -4
- package/modules/component/$jsx.js +1 -4
- package/modules/component/component-class.js +49 -114
- package/modules/component/component.js +6 -7
- package/modules/component/eventslisteners.js +1 -4
- package/modules/component/snabbdom/modules/hero.js +0 -1
- package/modules/component/snabbdom/modules/style.js +1 -1
- package/modules/component/vdom.js +17 -29
- package/modules/router/back.js +22 -96
- package/modules/router/clear-previous-history.js +1 -7
- package/modules/router/component-loader.js +23 -32
- package/modules/router/modal.js +1 -4
- package/modules/router/navigate.js +28 -167
- package/modules/router/redirect.js +1 -5
- package/modules/router/router-class.js +28 -293
- package/modules/router/router.d.ts +2 -0
- package/modules/router/swipe-back.js +10 -318
- package/modules/router/tab.js +1 -4
- package/modules/service-worker/service-worker.js +1 -1
- package/modules/store/create-store.js +2 -8
- package/modules/touch/touch.d.ts +5 -3
- package/modules/touch/touch.js +23 -37
- package/package.json +4 -4
- package/shared/$jsx.js +1 -4
- package/shared/class.js +5 -26
- package/shared/constructor-methods.js +4 -19
- package/shared/events-class.js +3 -12
- package/shared/get-device.js +4 -11
- package/shared/get-support.d.ts +0 -6
- package/shared/get-support.js +1 -20
- package/shared/material-color-utils.js +2102 -693
- package/shared/material-colors.js +94 -23
- package/shared/modal-methods.js +2 -8
- package/shared/utils.js +23 -45
|
@@ -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
|
|
@@ -24,10 +24,7 @@ function toRGBA(d) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// prettier-ignore
|
|
27
|
-
function blend(from, to, p) {
|
|
28
|
-
if (p === void 0) {
|
|
29
|
-
p = 0.5;
|
|
30
|
-
}
|
|
27
|
+
function blend(from, to, p = 0.5) {
|
|
31
28
|
const r = Math.round;
|
|
32
29
|
from = from.trim();
|
|
33
30
|
to = to.trim();
|
|
@@ -42,34 +39,108 @@ function blend(from, to, p) {
|
|
|
42
39
|
}
|
|
43
40
|
/* eslint-enable */
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
let monochromeCached = null;
|
|
43
|
+
const cachedColors = {};
|
|
44
|
+
export const materialColors = (hexColor = '', colorScheme = 'default') => {
|
|
45
|
+
const cacheKey = `${hexColor}-${colorScheme}`;
|
|
46
|
+
if (cachedColors[cacheKey]) {
|
|
47
|
+
return cachedColors[cacheKey];
|
|
48
|
+
}
|
|
49
|
+
if (monochromeCached && colorScheme.includes('monochrome')) {
|
|
50
|
+
const defaultColors = materialColors(hexColor, colorScheme === 'monochrome' ? 'default' : 'vibrant');
|
|
51
|
+
cachedColors[cacheKey] = {
|
|
52
|
+
light: {
|
|
53
|
+
...defaultColors.light,
|
|
54
|
+
...monochromeCached.light
|
|
55
|
+
},
|
|
56
|
+
dark: {
|
|
57
|
+
...defaultColors.dark,
|
|
58
|
+
...monochromeCached.dark
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return cachedColors[cacheKey];
|
|
62
|
+
}
|
|
63
|
+
const sourceColor = argbFromHex(`#${hexColor.replace('#', '')}`);
|
|
64
|
+
let lightScheme;
|
|
65
|
+
let darkScheme;
|
|
66
|
+
const hctColor = Hct.fromInt(sourceColor);
|
|
67
|
+
if (colorScheme === 'default') {
|
|
68
|
+
lightScheme = new SchemeTonalSpot(hctColor, false, 0, '2025');
|
|
69
|
+
darkScheme = new SchemeTonalSpot(hctColor, true, 0, '2025');
|
|
70
|
+
}
|
|
71
|
+
if (colorScheme === 'vibrant') {
|
|
72
|
+
lightScheme = new SchemeVibrant(hctColor, false, 0, '2025');
|
|
73
|
+
darkScheme = new SchemeVibrant(hctColor, true, 0, '2025');
|
|
74
|
+
}
|
|
75
|
+
if (colorScheme.includes('monochrome')) {
|
|
76
|
+
lightScheme = new SchemeMonochrome(hctColor, false, 0, '2025');
|
|
77
|
+
darkScheme = new SchemeMonochrome(hctColor, true, 0, '2025');
|
|
48
78
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
const getColorName = name => {
|
|
80
|
+
let newName = name;
|
|
81
|
+
if (name === 'surface_dim') newName = 'surface_variant';
|
|
82
|
+
if (name === 'surface_container_low') newName = 'surface_1';
|
|
83
|
+
if (name === 'surface_container') newName = 'surface_2';
|
|
84
|
+
if (name === 'surface_container_high') newName = 'surface_3';
|
|
85
|
+
if (name === 'surface_container_highest') newName = 'surface_4';
|
|
86
|
+
return newName;
|
|
87
|
+
};
|
|
88
|
+
const theme = {
|
|
89
|
+
light: {},
|
|
90
|
+
dark: {}
|
|
91
|
+
};
|
|
92
|
+
lightScheme.colors.allColors.forEach(color => {
|
|
93
|
+
const name = getColorName(color.name);
|
|
94
|
+
const argb = color.getArgb(lightScheme);
|
|
95
|
+
theme.light[name] = argb;
|
|
53
96
|
});
|
|
97
|
+
darkScheme.colors.allColors.forEach(color => {
|
|
98
|
+
const name = getColorName(color.name);
|
|
99
|
+
const argb = color.getArgb(darkScheme);
|
|
100
|
+
theme.dark[name] = argb;
|
|
101
|
+
});
|
|
102
|
+
theme.light.surface_5 = argbFromHex(blend(hexFromArgb(theme.light.surface_4), hexFromArgb(theme.light.primary), 0.05));
|
|
103
|
+
theme.dark.surface_5 = argbFromHex(blend(hexFromArgb(theme.dark.surface_4), hexFromArgb(theme.dark.primary), 0.05));
|
|
54
104
|
const name = n => {
|
|
55
|
-
return n.
|
|
105
|
+
return n.replace(/_/g, '-');
|
|
56
106
|
};
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
|
|
107
|
+
const shouldKeep = prop => {
|
|
108
|
+
const foreground = ['inverse_primary', 'primary', 'on_primary', 'primary_container', 'on_primary_container', 'secondary', 'on_secondary', 'secondary_container', 'on_secondary_container', 'outline', 'outline_variant'];
|
|
109
|
+
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'];
|
|
110
|
+
const keep = colorScheme === 'default' ? [...foreground, ...background] : colorScheme === 'vibrant' ? [...foreground, ...background] : background;
|
|
111
|
+
return keep.includes(prop);
|
|
60
112
|
};
|
|
61
113
|
const light = {};
|
|
62
114
|
const dark = {};
|
|
63
|
-
Object.keys(theme.
|
|
64
|
-
if (
|
|
65
|
-
light[name(`--f7-md-${prop}`)] = hexFromArgb(theme.
|
|
115
|
+
Object.keys(theme.light).forEach(prop => {
|
|
116
|
+
if (!shouldKeep(prop)) return;
|
|
117
|
+
light[name(`--f7-md-${prop}`)] = hexFromArgb(theme.light[prop]);
|
|
66
118
|
});
|
|
67
|
-
Object.keys(theme.
|
|
68
|
-
if (
|
|
69
|
-
dark[name(`--f7-md-${prop}`)] = hexFromArgb(theme.
|
|
119
|
+
Object.keys(theme.dark).forEach(prop => {
|
|
120
|
+
if (!shouldKeep(prop)) return;
|
|
121
|
+
dark[name(`--f7-md-${prop}`)] = hexFromArgb(theme.dark[prop]);
|
|
70
122
|
});
|
|
71
|
-
|
|
123
|
+
if (colorScheme.includes('monochrome')) {
|
|
124
|
+
monochromeCached = {
|
|
125
|
+
light,
|
|
126
|
+
dark
|
|
127
|
+
};
|
|
128
|
+
const defaultColors = materialColors(hexColor, colorScheme === 'monochrome' ? 'default' : 'vibrant');
|
|
129
|
+
cachedColors[cacheKey] = {
|
|
130
|
+
light: {
|
|
131
|
+
...defaultColors.light,
|
|
132
|
+
...light
|
|
133
|
+
},
|
|
134
|
+
dark: {
|
|
135
|
+
...defaultColors.dark,
|
|
136
|
+
...dark
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return cachedColors[cacheKey];
|
|
140
|
+
}
|
|
141
|
+
cachedColors[cacheKey] = {
|
|
72
142
|
light,
|
|
73
143
|
dark
|
|
74
144
|
};
|
|
145
|
+
return cachedColors[cacheKey];
|
|
75
146
|
};
|
package/shared/modal-methods.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import $ from './dom7.js';
|
|
2
2
|
import { extend } from './utils.js';
|
|
3
3
|
import ConstructorMethods from './constructor-methods.js';
|
|
4
|
-
export default function ModalMethods(parameters) {
|
|
5
|
-
if (parameters === void 0) {
|
|
6
|
-
parameters = {};
|
|
7
|
-
}
|
|
4
|
+
export default function ModalMethods(parameters = {}) {
|
|
8
5
|
const {
|
|
9
6
|
defaultSelector,
|
|
10
7
|
constructor: Constructor,
|
|
@@ -44,10 +41,7 @@ export default function ModalMethods(parameters) {
|
|
|
44
41
|
}
|
|
45
42
|
return instance.open(animate);
|
|
46
43
|
},
|
|
47
|
-
close(el, animate, targetEl) {
|
|
48
|
-
if (el === void 0) {
|
|
49
|
-
el = defaultSelector;
|
|
50
|
-
}
|
|
44
|
+
close(el = defaultSelector, animate, targetEl) {
|
|
51
45
|
let $el = $(el);
|
|
52
46
|
if (!$el.length) return undefined;
|
|
53
47
|
if ($el.length > 1) {
|
package/shared/utils.js
CHANGED
|
@@ -5,13 +5,7 @@ export function uniqueNumber() {
|
|
|
5
5
|
uniqueNum += 1;
|
|
6
6
|
return uniqueNum;
|
|
7
7
|
}
|
|
8
|
-
export function id(mask, map) {
|
|
9
|
-
if (mask === void 0) {
|
|
10
|
-
mask = 'xxxxxxxxxx';
|
|
11
|
-
}
|
|
12
|
-
if (map === void 0) {
|
|
13
|
-
map = '0123456789abcdef';
|
|
14
|
-
}
|
|
8
|
+
export function id(mask = 'xxxxxxxxxx', map = '0123456789abcdef') {
|
|
15
9
|
const length = map.length;
|
|
16
10
|
return mask.replace(/x/g, () => map[Math.floor(Math.random() * length)]);
|
|
17
11
|
}
|
|
@@ -60,10 +54,7 @@ export function cancelAnimationFrame(frameId) {
|
|
|
60
54
|
const window = getWindow();
|
|
61
55
|
return window.cancelAnimationFrame(frameId);
|
|
62
56
|
}
|
|
63
|
-
export function nextTick(callback, delay) {
|
|
64
|
-
if (delay === void 0) {
|
|
65
|
-
delay = 0;
|
|
66
|
-
}
|
|
57
|
+
export function nextTick(callback, delay = 0) {
|
|
67
58
|
return setTimeout(callback, delay);
|
|
68
59
|
}
|
|
69
60
|
export function nextFrame(callback) {
|
|
@@ -93,10 +84,7 @@ export function parseUrlQuery(url) {
|
|
|
93
84
|
}
|
|
94
85
|
return query;
|
|
95
86
|
}
|
|
96
|
-
export function getTranslate(el, axis) {
|
|
97
|
-
if (axis === void 0) {
|
|
98
|
-
axis = 'x';
|
|
99
|
-
}
|
|
87
|
+
export function getTranslate(el, axis = 'x') {
|
|
100
88
|
const window = getWindow();
|
|
101
89
|
let matrix;
|
|
102
90
|
let curTransform;
|
|
@@ -132,10 +120,7 @@ export function getTranslate(el, axis) {
|
|
|
132
120
|
}
|
|
133
121
|
return curTransform || 0;
|
|
134
122
|
}
|
|
135
|
-
export function serializeObject(obj, parents) {
|
|
136
|
-
if (parents === void 0) {
|
|
137
|
-
parents = [];
|
|
138
|
-
}
|
|
123
|
+
export function serializeObject(obj, parents = []) {
|
|
139
124
|
if (typeof obj === 'string') return obj;
|
|
140
125
|
const resultArray = [];
|
|
141
126
|
const separator = '&';
|
|
@@ -181,16 +166,12 @@ export function serializeObject(obj, parents) {
|
|
|
181
166
|
resultArray.push(`${varName(prop)}=${varValue(obj[prop])}`);
|
|
182
167
|
} else if (obj[prop] === '') resultArray.push(varName(prop)); // eslint-disable-line
|
|
183
168
|
});
|
|
184
|
-
|
|
185
169
|
return resultArray.join(separator);
|
|
186
170
|
}
|
|
187
171
|
export function isObject(o) {
|
|
188
172
|
return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object;
|
|
189
173
|
}
|
|
190
|
-
export function merge() {
|
|
191
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
192
|
-
args[_key] = arguments[_key];
|
|
193
|
-
}
|
|
174
|
+
export function merge(...args) {
|
|
194
175
|
const to = args[0];
|
|
195
176
|
args.splice(0, 1);
|
|
196
177
|
const from = args;
|
|
@@ -209,13 +190,10 @@ export function merge() {
|
|
|
209
190
|
}
|
|
210
191
|
return to;
|
|
211
192
|
}
|
|
212
|
-
export function extend() {
|
|
193
|
+
export function extend(...args) {
|
|
213
194
|
let deep = true;
|
|
214
195
|
let to;
|
|
215
196
|
let from;
|
|
216
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
217
|
-
args[_key2] = arguments[_key2];
|
|
218
|
-
}
|
|
219
197
|
if (typeof args[0] === 'boolean') {
|
|
220
198
|
deep = args[0];
|
|
221
199
|
to = args[1];
|
|
@@ -329,34 +307,40 @@ const getShadeTintColors = rgb => {
|
|
|
329
307
|
tint
|
|
330
308
|
};
|
|
331
309
|
};
|
|
332
|
-
export function colorThemeCSSProperties() {
|
|
310
|
+
export function colorThemeCSSProperties(...args) {
|
|
333
311
|
let hex;
|
|
334
312
|
let rgb;
|
|
335
|
-
|
|
336
|
-
args[_key3] = arguments[_key3];
|
|
337
|
-
}
|
|
313
|
+
let mdColorScheme;
|
|
338
314
|
if (args.length === 1) {
|
|
339
315
|
hex = args[0];
|
|
340
316
|
rgb = colorHexToRgb(hex);
|
|
317
|
+
} else if (args.length === 2) {
|
|
318
|
+
hex = args[0];
|
|
319
|
+
rgb = colorHexToRgb(hex);
|
|
320
|
+
mdColorScheme = args[1] || 'default';
|
|
341
321
|
} else if (args.length === 3) {
|
|
342
322
|
rgb = args;
|
|
343
323
|
hex = colorRgbToHex(...rgb);
|
|
324
|
+
} else if (args.length === 4) {
|
|
325
|
+
rgb = args.slice(0, 3);
|
|
326
|
+
hex = colorRgbToHex(...rgb);
|
|
327
|
+
mdColorScheme = args[3] || 'default';
|
|
344
328
|
}
|
|
345
329
|
if (!rgb) return {};
|
|
346
330
|
const {
|
|
347
331
|
light,
|
|
348
332
|
dark
|
|
349
|
-
} = materialColors(hex);
|
|
333
|
+
} = materialColors(hex, mdColorScheme);
|
|
350
334
|
const shadeTintIos = getShadeTintColors(rgb);
|
|
351
335
|
const shadeTintMdLight = getShadeTintColors(colorHexToRgb(light['--f7-md-primary']));
|
|
352
336
|
const shadeTintMdDark = getShadeTintColors(colorHexToRgb(dark['--f7-md-primary']));
|
|
353
337
|
Object.keys(light).forEach(key => {
|
|
354
|
-
if (key.includes('surface-')) {
|
|
338
|
+
if (key.includes('surface-') && !key.includes('-rgb')) {
|
|
355
339
|
light[`${key}-rgb`] = colorHexToRgb(light[key]);
|
|
356
340
|
}
|
|
357
341
|
});
|
|
358
342
|
Object.keys(dark).forEach(key => {
|
|
359
|
-
if (key.includes('surface-')) {
|
|
343
|
+
if (key.includes('surface-') && !key.includes('-rgb')) {
|
|
360
344
|
dark[`${key}-rgb`] = colorHexToRgb(dark[key]);
|
|
361
345
|
}
|
|
362
346
|
});
|
|
@@ -403,20 +387,14 @@ export function bindMethods(instance, obj) {
|
|
|
403
387
|
instance[key] = obj[key];
|
|
404
388
|
});
|
|
405
389
|
}
|
|
406
|
-
export function flattenArray() {
|
|
390
|
+
export function flattenArray(...args) {
|
|
407
391
|
const arr = [];
|
|
408
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
409
|
-
args[_key4] = arguments[_key4];
|
|
410
|
-
}
|
|
411
392
|
args.forEach(arg => {
|
|
412
393
|
if (Array.isArray(arg)) arr.push(...flattenArray(...arg));else arr.push(arg);
|
|
413
394
|
});
|
|
414
395
|
return arr;
|
|
415
396
|
}
|
|
416
|
-
export function colorThemeCSSStyles(colors) {
|
|
417
|
-
if (colors === void 0) {
|
|
418
|
-
colors = {};
|
|
419
|
-
}
|
|
397
|
+
export function colorThemeCSSStyles(colors = {}, mdColorScheme = 'default') {
|
|
420
398
|
const stringifyObject = obj => {
|
|
421
399
|
let res = '';
|
|
422
400
|
Object.keys(obj).forEach(key => {
|
|
@@ -424,12 +402,12 @@ export function colorThemeCSSStyles(colors) {
|
|
|
424
402
|
});
|
|
425
403
|
return res;
|
|
426
404
|
};
|
|
427
|
-
const colorVars = colorThemeCSSProperties(colors.primary);
|
|
405
|
+
const colorVars = colorThemeCSSProperties(colors.primary, mdColorScheme);
|
|
428
406
|
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
407
|
const restVars = {};
|
|
430
408
|
Object.keys(colors).forEach(colorName => {
|
|
431
409
|
const colorValue = colors[colorName];
|
|
432
|
-
restVars[colorName] = colorThemeCSSProperties(colorValue);
|
|
410
|
+
restVars[colorName] = colorThemeCSSProperties(colorValue, mdColorScheme);
|
|
433
411
|
});
|
|
434
412
|
|
|
435
413
|
// rest
|