framework7 8.3.3 → 9.0.0-beta.1

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.
Files changed (307) hide show
  1. package/components/actions/actions-ios.less +22 -15
  2. package/components/actions/actions-rtl.css +1 -1
  3. package/components/actions/actions-vars.less +4 -7
  4. package/components/actions/actions.css +1 -1
  5. package/components/actions/actions.js +2 -8
  6. package/components/actions/actions.less +0 -3
  7. package/components/app/app-class.d.ts +2 -0
  8. package/components/app/app-class.js +19 -15
  9. package/components/app/app-vars.less +41 -6
  10. package/components/app/app.less +1 -1
  11. package/components/area-chart/area-chart-class.js +18 -31
  12. package/components/area-chart/area-chart-rtl.css +1 -1
  13. package/components/area-chart/area-chart.css +1 -1
  14. package/components/autocomplete/autocomplete-class.js +13 -14
  15. package/components/autocomplete/autocomplete-ios.less +16 -0
  16. package/components/autocomplete/autocomplete-rtl.css +1 -1
  17. package/components/autocomplete/autocomplete.css +1 -1
  18. package/components/autocomplete/autocomplete.d.ts +3 -3
  19. package/components/autocomplete/autocomplete.js +3 -3
  20. package/components/autocomplete/autocomplete.less +7 -1
  21. package/components/block/block-vars.less +6 -6
  22. package/components/breadcrumbs/breadcrumbs-rtl.css +1 -1
  23. package/components/breadcrumbs/breadcrumbs.css +1 -1
  24. package/components/button/button-vars.less +13 -12
  25. package/components/button/button.less +2 -1
  26. package/components/calendar/calendar-class.js +20 -17
  27. package/components/calendar/calendar-ios.less +43 -0
  28. package/components/calendar/calendar-md.less +3 -0
  29. package/components/calendar/calendar-rtl.css +1 -1
  30. package/components/calendar/calendar-vars.less +24 -19
  31. package/components/calendar/calendar.css +1 -1
  32. package/components/calendar/calendar.d.ts +1 -1
  33. package/components/calendar/calendar.js +5 -8
  34. package/components/calendar/calendar.less +4 -2
  35. package/components/card/card-rtl.css +1 -1
  36. package/components/card/card-vars.less +5 -5
  37. package/components/card/card.css +1 -1
  38. package/components/card/card.js +3 -18
  39. package/components/card/card.less +1 -1
  40. package/components/color-picker/color-picker-class.js +11 -23
  41. package/components/color-picker/color-picker-ios.less +9 -0
  42. package/components/color-picker/color-picker-md.less +15 -0
  43. package/components/color-picker/color-picker-rtl.css +1 -1
  44. package/components/color-picker/color-picker-vars.less +9 -3
  45. package/components/color-picker/color-picker.css +1 -1
  46. package/components/color-picker/color-picker.d.ts +1 -2
  47. package/components/color-picker/color-picker.js +3 -7
  48. package/components/color-picker/color-picker.less +5 -25
  49. package/components/color-picker/modules/alpha-slider.js +2 -0
  50. package/components/color-picker/modules/brightness-slider.js +2 -0
  51. package/components/color-picker/modules/hs-spectrum.js +1 -2
  52. package/components/color-picker/modules/hsb-sliders.js +6 -0
  53. package/components/color-picker/modules/hue-slider.js +2 -0
  54. package/components/color-picker/modules/rgb-bars.js +6 -0
  55. package/components/color-picker/modules/rgb-sliders.js +6 -0
  56. package/components/color-picker/modules/sb-spectrum.js +1 -2
  57. package/components/color-picker/modules/wheel.js +1 -2
  58. package/components/data-table/data-table-class.js +1 -4
  59. package/components/data-table/data-table-ios.less +1 -1
  60. package/components/data-table/data-table-md.less +4 -2
  61. package/components/data-table/data-table-rtl.css +1 -1
  62. package/components/data-table/data-table.css +1 -1
  63. package/components/data-table/data-table.less +4 -4
  64. package/components/dialog/dialog-class.js +6 -3
  65. package/components/dialog/dialog-ios.less +10 -34
  66. package/components/dialog/dialog-md.less +2 -22
  67. package/components/dialog/dialog-rtl.css +1 -1
  68. package/components/dialog/dialog-vars.less +8 -10
  69. package/components/dialog/dialog.css +1 -1
  70. package/components/dialog/dialog.js +9 -27
  71. package/components/dialog/dialog.less +6 -25
  72. package/components/fab/fab-ios.less +2 -0
  73. package/components/fab/fab-rtl.css +1 -1
  74. package/components/fab/fab-vars.less +30 -6
  75. package/components/fab/fab.css +1 -1
  76. package/components/fab/fab.js +3 -12
  77. package/components/gauge/gauge-class.js +2 -8
  78. package/components/icon/icon-ios.less +10 -0
  79. package/components/icon/icon-md.less +9 -0
  80. package/components/icon/icon.less +2 -1
  81. package/components/input/input-ios.less +3 -2
  82. package/components/input/input-rtl.css +1 -1
  83. package/components/input/input.css +1 -1
  84. package/components/input/input.js +2 -5
  85. package/components/list/list-vars.less +7 -5
  86. package/components/list/list.less +1 -1
  87. package/components/list-index/list-index-class.js +3 -7
  88. package/components/login-screen/login-screen.js +2 -8
  89. package/components/login-screen/login-screen.less +1 -0
  90. package/components/messagebar/messagebar-class.js +5 -20
  91. package/components/messagebar/messagebar-ios.less +19 -14
  92. package/components/messagebar/messagebar-md.less +3 -0
  93. package/components/messagebar/messagebar-rtl.css +1 -1
  94. package/components/messagebar/messagebar-vars.less +12 -15
  95. package/components/messagebar/messagebar.css +1 -1
  96. package/components/messagebar/messagebar.less +4 -5
  97. package/components/messages/messages-class.js +25 -52
  98. package/components/messages/messages-ios.less +6 -2
  99. package/components/messages/messages-rtl.css +1 -1
  100. package/components/messages/messages-vars.less +1 -1
  101. package/components/messages/messages.css +1 -1
  102. package/components/navbar/navbar-ios.less +48 -672
  103. package/components/navbar/navbar-md.less +41 -1
  104. package/components/navbar/navbar-vars.less +4 -3
  105. package/components/navbar/navbar.js +28 -185
  106. package/components/navbar/navbar.less +8 -66
  107. package/components/notification/notification-class.js +6 -6
  108. package/components/notification/notification-ios.less +3 -8
  109. package/components/notification/notification-md.less +1 -20
  110. package/components/notification/notification-rtl.css +1 -1
  111. package/components/notification/notification-vars.less +13 -16
  112. package/components/notification/notification.css +1 -1
  113. package/components/notification/notification.less +8 -1
  114. package/components/page/page-ios.less +1 -8
  115. package/components/page/page-md.less +12 -11
  116. package/components/page/page.less +14 -12
  117. package/components/panel/panel-class.js +7 -28
  118. package/components/panel/panel-ios.less +4 -0
  119. package/components/panel/panel-rtl.css +2 -2
  120. package/components/panel/panel-vars.less +8 -5
  121. package/components/panel/panel.css +2 -2
  122. package/components/panel/panel.js +8 -32
  123. package/components/panel/panel.less +9 -9
  124. package/components/panel/resizable-panel.js +2 -4
  125. package/components/photo-browser/photo-browser-class.js +12 -47
  126. package/components/photo-browser/photo-browser-rtl.css +1 -1
  127. package/components/photo-browser/photo-browser-vars.less +8 -10
  128. package/components/photo-browser/photo-browser.css +1 -1
  129. package/components/photo-browser/photo-browser.d.ts +2 -4
  130. package/components/photo-browser/photo-browser.js +1 -3
  131. package/components/photo-browser/photo-browser.less +15 -71
  132. package/components/picker/picker-class.js +4 -5
  133. package/components/picker/picker-ios.less +6 -1
  134. package/components/picker/picker-md.less +9 -0
  135. package/components/picker/picker-rtl.css +1 -1
  136. package/components/picker/picker-vars.less +1 -1
  137. package/components/picker/picker.css +1 -1
  138. package/components/picker/picker.d.ts +1 -1
  139. package/components/picker/picker.js +2 -5
  140. package/components/picker/picker.less +0 -4
  141. package/components/pie-chart/pie-chart-class.js +7 -14
  142. package/components/popover/popover-class.js +22 -62
  143. package/components/popover/popover-ios.less +66 -2
  144. package/components/popover/popover-md.less +2 -27
  145. package/components/popover/popover-rtl.css +1 -1
  146. package/components/popover/popover-vars.less +2 -3
  147. package/components/popover/popover.css +1 -1
  148. package/components/popover/popover.d.ts +0 -2
  149. package/components/popover/popover.js +2 -9
  150. package/components/popover/popover.less +28 -50
  151. package/components/popup/popup-class.js +15 -9
  152. package/components/popup/popup-rtl.css +1 -1
  153. package/components/popup/popup-vars.less +2 -2
  154. package/components/popup/popup.css +1 -1
  155. package/components/popup/popup.js +2 -8
  156. package/components/popup/popup.less +6 -6
  157. package/components/preloader/preloader.js +2 -8
  158. package/components/progressbar/progressbar-md.less +12 -0
  159. package/components/progressbar/progressbar-rtl.css +1 -1
  160. package/components/progressbar/progressbar-vars.less +6 -5
  161. package/components/progressbar/progressbar.css +1 -1
  162. package/components/progressbar/progressbar.js +3 -12
  163. package/components/progressbar/progressbar.less +6 -0
  164. package/components/pull-to-refresh/pull-to-refresh-class.js +5 -12
  165. package/components/range/range-class.js +34 -27
  166. package/components/range/range-ios.less +60 -0
  167. package/components/range/range-md.less +67 -4
  168. package/components/range/range-rtl.css +1 -1
  169. package/components/range/range-vars.less +18 -13
  170. package/components/range/range.css +1 -1
  171. package/components/range/range.d.ts +3 -1
  172. package/components/range/range.js +2 -8
  173. package/components/range/range.less +11 -24
  174. package/components/searchbar/searchbar-class.js +7 -8
  175. package/components/searchbar/searchbar-ios.less +37 -13
  176. package/components/searchbar/searchbar-md.less +5 -0
  177. package/components/searchbar/searchbar-rtl.css +1 -1
  178. package/components/searchbar/searchbar-vars.less +13 -16
  179. package/components/searchbar/searchbar.css +1 -1
  180. package/components/searchbar/searchbar.js +4 -32
  181. package/components/searchbar/searchbar.less +4 -5
  182. package/components/sheet/sheet-class.js +21 -17
  183. package/components/sheet/sheet-ios.less +10 -0
  184. package/components/sheet/sheet-md.less +14 -0
  185. package/components/sheet/sheet-rtl.css +1 -1
  186. package/components/sheet/sheet-vars.less +5 -9
  187. package/components/sheet/sheet.css +1 -1
  188. package/components/sheet/sheet.js +2 -8
  189. package/components/sheet/sheet.less +5 -17
  190. package/components/skeleton/skeleton-rtl.css +1 -1
  191. package/components/skeleton/skeleton.css +1 -1
  192. package/components/smart-select/smart-select-class.js +15 -20
  193. package/components/smart-select/smart-select.d.ts +5 -7
  194. package/components/smart-select/smart-select.js +4 -4
  195. package/components/sortable/sortable.js +8 -27
  196. package/components/statusbar/statusbar.js +1 -4
  197. package/components/stepper/stepper-rtl.css +1 -1
  198. package/components/stepper/stepper-vars.less +3 -3
  199. package/components/stepper/stepper.css +1 -1
  200. package/components/stepper/stepper.js +2 -8
  201. package/components/subnavbar/subnavbar-ios.less +16 -1
  202. package/components/subnavbar/subnavbar-md.less +1 -1
  203. package/components/subnavbar/subnavbar-vars.less +12 -6
  204. package/components/subnavbar/subnavbar.less +5 -6
  205. package/components/swipeout/swipeout-ios.less +37 -0
  206. package/components/swipeout/swipeout-md.less +56 -0
  207. package/components/swipeout/swipeout-rtl.css +1 -1
  208. package/components/swipeout/swipeout-vars.less +13 -2
  209. package/components/swipeout/swipeout.css +1 -1
  210. package/components/swipeout/swipeout.js +102 -35
  211. package/components/swipeout/swipeout.less +20 -44
  212. package/components/swiper/swiper-rtl.css +1 -1
  213. package/components/swiper/swiper.css +1 -1
  214. package/components/tabs/tabs.js +3 -9
  215. package/components/text-editor/text-editor-class.js +1 -1
  216. package/components/text-editor/text-editor-rtl.css +1 -1
  217. package/components/text-editor/text-editor.css +1 -1
  218. package/components/timeline/timeline-ios.less +0 -5
  219. package/components/timeline/timeline-md.less +0 -5
  220. package/components/timeline/timeline-rtl.css +1 -1
  221. package/components/timeline/timeline-vars.less +1 -17
  222. package/components/timeline/timeline.css +1 -1
  223. package/components/timeline/timeline.less +0 -196
  224. package/components/toast/toast-class.js +2 -2
  225. package/components/toast/toast-ios.less +2 -0
  226. package/components/toast/toast-rtl.css +1 -1
  227. package/components/toast/toast-vars.less +2 -4
  228. package/components/toast/toast.css +1 -1
  229. package/components/toast/toast.less +1 -1
  230. package/components/toggle/toggle-class.js +5 -12
  231. package/components/toggle/toggle-ios.less +68 -50
  232. package/components/toggle/toggle-rtl.css +1 -1
  233. package/components/toggle/toggle-vars.less +2 -2
  234. package/components/toggle/toggle.css +1 -1
  235. package/components/toolbar/tabbar-highlight.js +134 -0
  236. package/components/toolbar/toolbar-ios.less +152 -14
  237. package/components/toolbar/toolbar-md.less +77 -3
  238. package/components/toolbar/toolbar-vars.less +14 -10
  239. package/components/toolbar/toolbar.js +32 -13
  240. package/components/toolbar/toolbar.less +8 -56
  241. package/components/tooltip/tooltip-class.js +13 -16
  242. package/components/tooltip/tooltip.js +0 -16
  243. package/components/touch-highlight/touch-highlight-ios.less +17 -0
  244. package/components/touch-highlight/touch-highlight-md.less +2 -0
  245. package/components/touch-highlight/touch-highlight-vars.less +8 -0
  246. package/components/touch-highlight/touch-highlight.d.ts +25 -0
  247. package/components/touch-highlight/touch-highlight.js +123 -0
  248. package/components/touch-highlight/touch-highlight.less +9 -0
  249. package/components/touch-ripple/touch-ripple.js +1 -4
  250. package/components/view/resizable-view.js +2 -4
  251. package/components/view/view-class.js +1 -15
  252. package/components/view/view.d.ts +0 -4
  253. package/components/view/view.js +1 -5
  254. package/components/virtual-list/virtual-list-class.js +2 -8
  255. package/framework7-bundle-rtl.css +2284 -3019
  256. package/framework7-bundle-rtl.min.css +9 -7
  257. package/framework7-bundle.css +2245 -2978
  258. package/framework7-bundle.esm.js +5 -4
  259. package/framework7-bundle.js +7170 -6469
  260. package/framework7-bundle.js.map +1 -1
  261. package/framework7-bundle.less +4 -3
  262. package/framework7-bundle.min.css +9 -7
  263. package/framework7-bundle.min.js +4 -4
  264. package/framework7-bundle.min.js.map +1 -1
  265. package/framework7-lite-bundle.esm.js +5 -4
  266. package/framework7-lite.esm.js +5 -4
  267. package/framework7-rtl.css +509 -844
  268. package/framework7-rtl.min.css +8 -6
  269. package/framework7-types.d.ts +5 -1
  270. package/framework7.css +509 -843
  271. package/framework7.d.ts +4 -0
  272. package/framework7.esm.js +5 -4
  273. package/framework7.less +4 -3
  274. package/framework7.min.css +8 -6
  275. package/less/mixins.less +10 -12
  276. package/modules/component/$h.js +1 -4
  277. package/modules/component/$jsx.js +1 -4
  278. package/modules/component/component-class.js +49 -114
  279. package/modules/component/component.js +6 -7
  280. package/modules/component/eventslisteners.js +1 -4
  281. package/modules/component/snabbdom/modules/hero.js +0 -1
  282. package/modules/component/snabbdom/modules/style.js +1 -1
  283. package/modules/component/vdom.js +17 -29
  284. package/modules/router/back.js +22 -96
  285. package/modules/router/clear-previous-history.js +1 -7
  286. package/modules/router/component-loader.js +23 -32
  287. package/modules/router/modal.js +1 -4
  288. package/modules/router/navigate.js +28 -167
  289. package/modules/router/redirect.js +1 -5
  290. package/modules/router/router-class.js +21 -288
  291. package/modules/router/swipe-back.js +10 -318
  292. package/modules/router/tab.js +1 -4
  293. package/modules/store/create-store.js +2 -8
  294. package/modules/touch/touch.d.ts +5 -3
  295. package/modules/touch/touch.js +22 -36
  296. package/package.json +4 -4
  297. package/shared/$jsx.js +1 -4
  298. package/shared/class.js +5 -26
  299. package/shared/constructor-methods.js +4 -19
  300. package/shared/events-class.js +3 -12
  301. package/shared/get-device.js +4 -11
  302. package/shared/get-support.d.ts +0 -6
  303. package/shared/get-support.js +1 -20
  304. package/shared/material-color-utils.js +2102 -693
  305. package/shared/material-colors.js +94 -23
  306. package/shared/modal-methods.js +2 -8
  307. package/shared/utils.js +23 -45
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line
2
- import { argbFromHex, hexFromArgb, themeFromSourceColor } from './material-color-utils.js';
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
- export const materialColors = function (hexColor) {
46
- if (hexColor === void 0) {
47
- hexColor = '';
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 theme = themeFromSourceColor(argbFromHex(`#${hexColor.replace('#', '')}`));
50
- [0.05, 0.08, 0.11, 0.12, 0.14].forEach((amount, index) => {
51
- theme.schemes.light.props[`surface${index + 1}`] = argbFromHex(blend(hexFromArgb(theme.schemes.light.props.surface), hexFromArgb(theme.schemes.light.props.primary), amount));
52
- theme.schemes.dark.props[`surface${index + 1}`] = argbFromHex(blend(hexFromArgb(theme.schemes.dark.props.surface), hexFromArgb(theme.schemes.dark.props.primary), amount));
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.split('').map(char => char.toUpperCase() === char && char !== '-' && char !== '7' ? `-${char.toLowerCase()}` : char).join('');
105
+ return n.replace(/_/g, '-');
56
106
  };
57
- const shouldSkip = prop => {
58
- const skip = ['tertiary', 'shadow', 'scrim', 'error', 'background'];
59
- return skip.filter(v => prop.toLowerCase().includes(v)).length > 0;
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.schemes.light.props).forEach(prop => {
64
- if (shouldSkip(prop)) return;
65
- light[name(`--f7-md-${prop}`)] = hexFromArgb(theme.schemes.light.props[prop]);
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.schemes.dark.props).forEach(prop => {
68
- if (shouldSkip(prop)) return;
69
- dark[name(`--f7-md-${prop}`)] = hexFromArgb(theme.schemes.dark.props[prop]);
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
- return {
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
  };
@@ -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
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
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