@varlet/ui 3.10.8 → 3.10.9

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.
@@ -3,5 +3,5 @@ import '../../icon/icon.css'
3
3
  import '../../ripple/ripple.css'
4
4
  import '../../popup/popup.css'
5
5
  import '../actionSheet.css'
6
- import '../ActionItemSfc.css'
7
6
  import '../ActionSheetSfc.css'
7
+ import '../ActionItemSfc.css'
@@ -283,7 +283,7 @@ import './tooltip/style/index.mjs'
283
283
  import './uploader/style/index.mjs'
284
284
  import './watermark/style/index.mjs'
285
285
 
286
- const version = '3.10.8'
286
+ const version = '3.10.9'
287
287
 
288
288
  function install(app) {
289
289
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -188,7 +188,7 @@ export * from './tooltip/index.mjs'
188
188
  export * from './uploader/index.mjs'
189
189
  export * from './watermark/index.mjs'
190
190
 
191
- const version = '3.10.8'
191
+ const version = '3.10.9'
192
192
 
193
193
  function install(app) {
194
194
  ActionSheet.install && app.use(ActionSheet)
@@ -1,7 +1,7 @@
1
1
  import '../../styles/common.css'
2
+ import '../SnackbarSfc.css'
2
3
  import '../../styles/elevation.css'
3
4
  import '../../loading/loading.css'
4
5
  import '../../icon/icon.css'
5
6
  import '../snackbar.css'
6
7
  import '../coreSfc.css'
7
- import '../SnackbarSfc.css'
@@ -0,0 +1,3 @@
1
+ import { Themes } from '../../types'
2
+
3
+ declare const convert: Themes['convert']
@@ -0,0 +1,9 @@
1
+ function convert(theme, converter) {
2
+ return Object.entries(theme).reduce((target, [key, value]) => {
3
+ target[key] = value.includes("px") ? value.replace(/(\d+(\.\d+)?)px/g, (_, p1) => converter(p1)) : value;
4
+ return target;
5
+ }, {});
6
+ }
7
+ export {
8
+ convert
9
+ };
@@ -1,8 +1,10 @@
1
+ import { convert } from "./convert.mjs";
1
2
  import dark from "./dark/index.mjs";
2
3
  import md3Dark from "./md3-dark/index.mjs";
3
4
  import md3Light from "./md3-light/index.mjs";
5
+ import { toRem } from "./toRem.mjs";
4
6
  import { toViewport } from "./toViewport.mjs";
5
- const Themes = { dark, md3Light, md3Dark, toViewport };
7
+ const Themes = { dark, md3Light, md3Dark, toViewport, toRem, convert };
6
8
  const _ThemesComponent = null;
7
9
  var stdin_default = Themes;
8
10
  export {
@@ -0,0 +1,3 @@
1
+ import { Themes } from '../../types'
2
+
3
+ declare const toRem: Themes['toRem']
@@ -0,0 +1,8 @@
1
+ import { convert } from "./convert.mjs";
2
+ function toRem(theme, options = {}) {
3
+ const { rootFontSize = 16, unitPrecision = 6 } = options;
4
+ return convert(theme, (value) => `${Number((value / rootFontSize).toFixed(unitPrecision))}rem`);
5
+ }
6
+ export {
7
+ toRem
8
+ };
@@ -1,12 +1,7 @@
1
+ import { convert } from "./convert.mjs";
1
2
  function toViewport(theme, options = {}) {
2
3
  const { viewportWidth = 375, viewportUnit = "vmin", unitPrecision = 6 } = options;
3
- return Object.entries(theme).reduce((target, [key, value]) => {
4
- target[key] = value.includes("px") ? value.replace(
5
- /(\d+(\.\d+)?)px/g,
6
- (_, p1) => `${Number((p1 / viewportWidth * 100).toFixed(unitPrecision))}${viewportUnit}`
7
- ) : value;
8
- return target;
9
- }, {});
4
+ return convert(theme, (value) => `${Number((value / viewportWidth * 100).toFixed(unitPrecision))}${viewportUnit}`);
10
5
  }
11
6
  export {
12
7
  toViewport