@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.
- package/es/action-sheet/style/index.mjs +1 -1
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/snackbar/style/index.mjs +1 -1
- package/es/themes/convert.d.ts +3 -0
- package/es/themes/convert.mjs +9 -0
- package/es/themes/index.mjs +3 -1
- package/es/themes/toRem.d.ts +3 -0
- package/es/themes/toRem.mjs +8 -0
- package/es/themes/toViewport.mjs +2 -7
- package/es/varlet.esm.js +2667 -2662
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +13 -9
- package/package.json +7 -7
- package/types/themes.d.ts +7 -0
- package/umd/varlet.js +7 -7
package/es/index.bundle.mjs
CHANGED
|
@@ -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.
|
|
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.
|
|
191
|
+
const version = '3.10.9'
|
|
192
192
|
|
|
193
193
|
function install(app) {
|
|
194
194
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -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
|
+
};
|
package/es/themes/index.mjs
CHANGED
|
@@ -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,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
|
+
};
|
package/es/themes/toViewport.mjs
CHANGED
|
@@ -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
|
|
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
|