transform-to-unocss-core 0.0.59 → 0.0.60
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/dist/index.cjs +12 -18
- package/dist/index.iife.js +12 -18
- package/dist/index.js +12 -18
- package/dist/index.umd.js +12 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -59,10 +59,10 @@ function getHundred(n) {
|
|
|
59
59
|
return +n * 100;
|
|
60
60
|
}
|
|
61
61
|
function joinWithLine(s) {
|
|
62
|
-
return s.replace(/\s
|
|
62
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("-");
|
|
63
63
|
}
|
|
64
64
|
function joinWithUnderLine(s) {
|
|
65
|
-
return s.replace(/\s
|
|
65
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("_");
|
|
66
66
|
}
|
|
67
67
|
const positionMap = [
|
|
68
68
|
"top",
|
|
@@ -85,7 +85,7 @@ function trim(s, type = "around") {
|
|
|
85
85
|
return s;
|
|
86
86
|
}
|
|
87
87
|
function transformImportant(v) {
|
|
88
|
-
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s
|
|
88
|
+
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/g, "/");
|
|
89
89
|
if (/rgb/.test(v)) v = v.replace(/rgba?\(([^)]+)\)/g, (all, k) => {
|
|
90
90
|
const _k = k.trim().split(" ");
|
|
91
91
|
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
@@ -251,14 +251,14 @@ const positionPair = `(${lengthRe})\\s+(${lengthRe})`;
|
|
|
251
251
|
const optimizedReg = new RegExp(`${positionPair}\\s*,\\s*${positionPair}`);
|
|
252
252
|
function background(key, val) {
|
|
253
253
|
const [value, important] = transformImportant(val);
|
|
254
|
-
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ?
|
|
255
|
-
if (backgroundMap.includes(key)) return `bg${getVal(value,
|
|
254
|
+
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ? joinWithUnderLine : joinWithLine, false, "length:")}${important}`;
|
|
255
|
+
if (backgroundMap.includes(key)) return `bg${getVal(value, joinWithLine)}${important}`;
|
|
256
256
|
if (key === "background-position") {
|
|
257
|
-
if (/\d/.test(value)) return `bg${getVal(value,
|
|
258
|
-
return `bg${getVal(value,
|
|
257
|
+
if (/\d/.test(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
258
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
259
259
|
}
|
|
260
260
|
if (["background", "background-image"].includes(key)) {
|
|
261
|
-
if (isSize(value)) return `bg${getVal(value,
|
|
261
|
+
if (isSize(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
262
262
|
const temp = value.replace(/rgba?\([^)]+\)/g, "temp");
|
|
263
263
|
if (/\)\s*,/.test(temp)) return `bg="[${matchMultipleBgAttrs(value)}]"`;
|
|
264
264
|
if (value.startsWith("linear-gradient")) {
|
|
@@ -350,7 +350,7 @@ function background(key, val) {
|
|
|
350
350
|
}
|
|
351
351
|
return r;
|
|
352
352
|
}
|
|
353
|
-
return `bg${getVal(value,
|
|
353
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
354
354
|
}
|
|
355
355
|
if (key === "background-blend-mode") return `bg-blend-${value}${important}`;
|
|
356
356
|
return `${replaceBackground(key, value)}-${transformBox(value)}${important}`;
|
|
@@ -363,13 +363,7 @@ function transformBox(s) {
|
|
|
363
363
|
const reg = /border|content|padding-box/;
|
|
364
364
|
if (reg.test(s)) return s.replace("-box", "");
|
|
365
365
|
if (s.startsWith("repeat-")) return s.replace("repeat-", "");
|
|
366
|
-
return
|
|
367
|
-
}
|
|
368
|
-
function transformSpaceToLine(s) {
|
|
369
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "-");
|
|
370
|
-
}
|
|
371
|
-
function transformSpaceToUnderLine(s) {
|
|
372
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "_");
|
|
366
|
+
return joinWithLine(s);
|
|
373
367
|
}
|
|
374
368
|
function getLinearGradientPosition$1(from, via, to) {
|
|
375
369
|
let result = "";
|
|
@@ -401,7 +395,7 @@ const CONSTANTFLAG = "__transform_to_unocss__";
|
|
|
401
395
|
function matchMultipleBgAttrs(value) {
|
|
402
396
|
const map$2 = {};
|
|
403
397
|
let i = 0;
|
|
404
|
-
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)
|
|
398
|
+
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)/g, (_) => {
|
|
405
399
|
map$2[i++] = _;
|
|
406
400
|
return `${CONSTANTFLAG}${i}}`;
|
|
407
401
|
});
|
|
@@ -1071,7 +1065,7 @@ function toUnocss(css, isRem = false) {
|
|
|
1071
1065
|
const [_, key, val] = match;
|
|
1072
1066
|
const first = getFirstName(key);
|
|
1073
1067
|
const result = (_typeMap$first = typeMap[first]) === null || _typeMap$first === void 0 ? void 0 : _typeMap$first.call(typeMap, key, val);
|
|
1074
|
-
if (result && isRem) return result.replace(/-([0-9.]+)px
|
|
1068
|
+
if (result && isRem) return result.replace(/-([0-9.]+)px/g, (_$1, v) => `-${+v / 4}`).replace(/\[[^\]]+\]/g, (match$1) => match$1.replace(/([0-9.]+)px/g, (_$1, v) => `${+v / 16}rem`));
|
|
1075
1069
|
return result;
|
|
1076
1070
|
}
|
|
1077
1071
|
|
package/dist/index.iife.js
CHANGED
|
@@ -61,10 +61,10 @@ function getHundred(n) {
|
|
|
61
61
|
return +n * 100;
|
|
62
62
|
}
|
|
63
63
|
function joinWithLine(s) {
|
|
64
|
-
return s.replace(/\s
|
|
64
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("-");
|
|
65
65
|
}
|
|
66
66
|
function joinWithUnderLine(s) {
|
|
67
|
-
return s.replace(/\s
|
|
67
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("_");
|
|
68
68
|
}
|
|
69
69
|
const positionMap = [
|
|
70
70
|
"top",
|
|
@@ -87,7 +87,7 @@ function trim(s, type = "around") {
|
|
|
87
87
|
return s;
|
|
88
88
|
}
|
|
89
89
|
function transformImportant(v) {
|
|
90
|
-
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s
|
|
90
|
+
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/g, "/");
|
|
91
91
|
if (/rgb/.test(v)) v = v.replace(/rgba?\(([^)]+)\)/g, (all, k) => {
|
|
92
92
|
const _k = k.trim().split(" ");
|
|
93
93
|
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
@@ -253,14 +253,14 @@ const positionPair = `(${lengthRe})\\s+(${lengthRe})`;
|
|
|
253
253
|
const optimizedReg = new RegExp(`${positionPair}\\s*,\\s*${positionPair}`);
|
|
254
254
|
function background(key, val) {
|
|
255
255
|
const [value, important] = transformImportant(val);
|
|
256
|
-
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ?
|
|
257
|
-
if (backgroundMap.includes(key)) return `bg${getVal(value,
|
|
256
|
+
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ? joinWithUnderLine : joinWithLine, false, "length:")}${important}`;
|
|
257
|
+
if (backgroundMap.includes(key)) return `bg${getVal(value, joinWithLine)}${important}`;
|
|
258
258
|
if (key === "background-position") {
|
|
259
|
-
if (/\d/.test(value)) return `bg${getVal(value,
|
|
260
|
-
return `bg${getVal(value,
|
|
259
|
+
if (/\d/.test(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
260
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
261
261
|
}
|
|
262
262
|
if (["background", "background-image"].includes(key)) {
|
|
263
|
-
if (isSize(value)) return `bg${getVal(value,
|
|
263
|
+
if (isSize(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
264
264
|
const temp = value.replace(/rgba?\([^)]+\)/g, "temp");
|
|
265
265
|
if (/\)\s*,/.test(temp)) return `bg="[${matchMultipleBgAttrs(value)}]"`;
|
|
266
266
|
if (value.startsWith("linear-gradient")) {
|
|
@@ -352,7 +352,7 @@ function background(key, val) {
|
|
|
352
352
|
}
|
|
353
353
|
return r;
|
|
354
354
|
}
|
|
355
|
-
return `bg${getVal(value,
|
|
355
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
356
356
|
}
|
|
357
357
|
if (key === "background-blend-mode") return `bg-blend-${value}${important}`;
|
|
358
358
|
return `${replaceBackground(key, value)}-${transformBox(value)}${important}`;
|
|
@@ -365,13 +365,7 @@ function transformBox(s) {
|
|
|
365
365
|
const reg = /border|content|padding-box/;
|
|
366
366
|
if (reg.test(s)) return s.replace("-box", "");
|
|
367
367
|
if (s.startsWith("repeat-")) return s.replace("repeat-", "");
|
|
368
|
-
return
|
|
369
|
-
}
|
|
370
|
-
function transformSpaceToLine(s) {
|
|
371
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "-");
|
|
372
|
-
}
|
|
373
|
-
function transformSpaceToUnderLine(s) {
|
|
374
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "_");
|
|
368
|
+
return joinWithLine(s);
|
|
375
369
|
}
|
|
376
370
|
function getLinearGradientPosition$1(from, via, to) {
|
|
377
371
|
let result = "";
|
|
@@ -403,7 +397,7 @@ const CONSTANTFLAG = "__transform_to_unocss__";
|
|
|
403
397
|
function matchMultipleBgAttrs(value) {
|
|
404
398
|
const map$2 = {};
|
|
405
399
|
let i = 0;
|
|
406
|
-
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)
|
|
400
|
+
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)/g, (_) => {
|
|
407
401
|
map$2[i++] = _;
|
|
408
402
|
return `${CONSTANTFLAG}${i}}`;
|
|
409
403
|
});
|
|
@@ -1073,7 +1067,7 @@ function toUnocss(css, isRem = false) {
|
|
|
1073
1067
|
const [_, key, val] = match;
|
|
1074
1068
|
const first = getFirstName(key);
|
|
1075
1069
|
const result = (_typeMap$first = typeMap[first]) === null || _typeMap$first === void 0 ? void 0 : _typeMap$first.call(typeMap, key, val);
|
|
1076
|
-
if (result && isRem) return result.replace(/-([0-9.]+)px
|
|
1070
|
+
if (result && isRem) return result.replace(/-([0-9.]+)px/g, (_$1, v) => `-${+v / 4}`).replace(/\[[^\]]+\]/g, (match$1) => match$1.replace(/([0-9.]+)px/g, (_$1, v) => `${+v / 16}rem`));
|
|
1077
1071
|
return result;
|
|
1078
1072
|
}
|
|
1079
1073
|
|
package/dist/index.js
CHANGED
|
@@ -57,10 +57,10 @@ function getHundred(n) {
|
|
|
57
57
|
return +n * 100;
|
|
58
58
|
}
|
|
59
59
|
function joinWithLine(s) {
|
|
60
|
-
return s.replace(/\s
|
|
60
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("-");
|
|
61
61
|
}
|
|
62
62
|
function joinWithUnderLine(s) {
|
|
63
|
-
return s.replace(/\s
|
|
63
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("_");
|
|
64
64
|
}
|
|
65
65
|
const positionMap = [
|
|
66
66
|
"top",
|
|
@@ -83,7 +83,7 @@ function trim(s, type = "around") {
|
|
|
83
83
|
return s;
|
|
84
84
|
}
|
|
85
85
|
function transformImportant(v) {
|
|
86
|
-
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s
|
|
86
|
+
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/g, "/");
|
|
87
87
|
if (/rgb/.test(v)) v = v.replace(/rgba?\(([^)]+)\)/g, (all, k) => {
|
|
88
88
|
const _k = k.trim().split(" ");
|
|
89
89
|
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
@@ -249,14 +249,14 @@ const positionPair = `(${lengthRe})\\s+(${lengthRe})`;
|
|
|
249
249
|
const optimizedReg = new RegExp(`${positionPair}\\s*,\\s*${positionPair}`);
|
|
250
250
|
function background(key, val) {
|
|
251
251
|
const [value, important] = transformImportant(val);
|
|
252
|
-
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ?
|
|
253
|
-
if (backgroundMap.includes(key)) return `bg${getVal(value,
|
|
252
|
+
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ? joinWithUnderLine : joinWithLine, false, "length:")}${important}`;
|
|
253
|
+
if (backgroundMap.includes(key)) return `bg${getVal(value, joinWithLine)}${important}`;
|
|
254
254
|
if (key === "background-position") {
|
|
255
|
-
if (/\d/.test(value)) return `bg${getVal(value,
|
|
256
|
-
return `bg${getVal(value,
|
|
255
|
+
if (/\d/.test(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
256
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
257
257
|
}
|
|
258
258
|
if (["background", "background-image"].includes(key)) {
|
|
259
|
-
if (isSize(value)) return `bg${getVal(value,
|
|
259
|
+
if (isSize(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
260
260
|
const temp = value.replace(/rgba?\([^)]+\)/g, "temp");
|
|
261
261
|
if (/\)\s*,/.test(temp)) return `bg="[${matchMultipleBgAttrs(value)}]"`;
|
|
262
262
|
if (value.startsWith("linear-gradient")) {
|
|
@@ -348,7 +348,7 @@ function background(key, val) {
|
|
|
348
348
|
}
|
|
349
349
|
return r;
|
|
350
350
|
}
|
|
351
|
-
return `bg${getVal(value,
|
|
351
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
352
352
|
}
|
|
353
353
|
if (key === "background-blend-mode") return `bg-blend-${value}${important}`;
|
|
354
354
|
return `${replaceBackground(key, value)}-${transformBox(value)}${important}`;
|
|
@@ -361,13 +361,7 @@ function transformBox(s) {
|
|
|
361
361
|
const reg = /border|content|padding-box/;
|
|
362
362
|
if (reg.test(s)) return s.replace("-box", "");
|
|
363
363
|
if (s.startsWith("repeat-")) return s.replace("repeat-", "");
|
|
364
|
-
return
|
|
365
|
-
}
|
|
366
|
-
function transformSpaceToLine(s) {
|
|
367
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "-");
|
|
368
|
-
}
|
|
369
|
-
function transformSpaceToUnderLine(s) {
|
|
370
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "_");
|
|
364
|
+
return joinWithLine(s);
|
|
371
365
|
}
|
|
372
366
|
function getLinearGradientPosition$1(from, via, to) {
|
|
373
367
|
let result = "";
|
|
@@ -399,7 +393,7 @@ const CONSTANTFLAG = "__transform_to_unocss__";
|
|
|
399
393
|
function matchMultipleBgAttrs(value) {
|
|
400
394
|
const map$2 = {};
|
|
401
395
|
let i = 0;
|
|
402
|
-
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)
|
|
396
|
+
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)/g, (_) => {
|
|
403
397
|
map$2[i++] = _;
|
|
404
398
|
return `${CONSTANTFLAG}${i}}`;
|
|
405
399
|
});
|
|
@@ -1069,7 +1063,7 @@ function toUnocss(css, isRem = false) {
|
|
|
1069
1063
|
const [_, key, val] = match;
|
|
1070
1064
|
const first = getFirstName(key);
|
|
1071
1065
|
const result = (_typeMap$first = typeMap[first]) === null || _typeMap$first === void 0 ? void 0 : _typeMap$first.call(typeMap, key, val);
|
|
1072
|
-
if (result && isRem) return result.replace(/-([0-9.]+)px
|
|
1066
|
+
if (result && isRem) return result.replace(/-([0-9.]+)px/g, (_$1, v) => `-${+v / 4}`).replace(/\[[^\]]+\]/g, (match$1) => match$1.replace(/([0-9.]+)px/g, (_$1, v) => `${+v / 16}rem`));
|
|
1073
1067
|
return result;
|
|
1074
1068
|
}
|
|
1075
1069
|
|
package/dist/index.umd.js
CHANGED
|
@@ -64,10 +64,10 @@ function getHundred(n) {
|
|
|
64
64
|
return +n * 100;
|
|
65
65
|
}
|
|
66
66
|
function joinWithLine(s) {
|
|
67
|
-
return s.replace(/\s
|
|
67
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("-");
|
|
68
68
|
}
|
|
69
69
|
function joinWithUnderLine(s) {
|
|
70
|
-
return s.replace(/\s
|
|
70
|
+
return s.replace(/\s+/g, " ").split(/\s/g).join("_");
|
|
71
71
|
}
|
|
72
72
|
const positionMap = [
|
|
73
73
|
"top",
|
|
@@ -90,7 +90,7 @@ function trim(s, type = "around") {
|
|
|
90
90
|
return s;
|
|
91
91
|
}
|
|
92
92
|
function transformImportant(v) {
|
|
93
|
-
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s
|
|
93
|
+
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/g, "/");
|
|
94
94
|
if (/rgb/.test(v)) v = v.replace(/rgba?\(([^)]+)\)/g, (all, k) => {
|
|
95
95
|
const _k = k.trim().split(" ");
|
|
96
96
|
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
@@ -256,14 +256,14 @@ const positionPair = `(${lengthRe})\\s+(${lengthRe})`;
|
|
|
256
256
|
const optimizedReg = new RegExp(`${positionPair}\\s*,\\s*${positionPair}`);
|
|
257
257
|
function background(key, val) {
|
|
258
258
|
const [value, important] = transformImportant(val);
|
|
259
|
-
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ?
|
|
260
|
-
if (backgroundMap.includes(key)) return `bg${getVal(value,
|
|
259
|
+
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ? joinWithUnderLine : joinWithLine, false, "length:")}${important}`;
|
|
260
|
+
if (backgroundMap.includes(key)) return `bg${getVal(value, joinWithLine)}${important}`;
|
|
261
261
|
if (key === "background-position") {
|
|
262
|
-
if (/\d/.test(value)) return `bg${getVal(value,
|
|
263
|
-
return `bg${getVal(value,
|
|
262
|
+
if (/\d/.test(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
263
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
264
264
|
}
|
|
265
265
|
if (["background", "background-image"].includes(key)) {
|
|
266
|
-
if (isSize(value)) return `bg${getVal(value,
|
|
266
|
+
if (isSize(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
267
267
|
const temp = value.replace(/rgba?\([^)]+\)/g, "temp");
|
|
268
268
|
if (/\)\s*,/.test(temp)) return `bg="[${matchMultipleBgAttrs(value)}]"`;
|
|
269
269
|
if (value.startsWith("linear-gradient")) {
|
|
@@ -355,7 +355,7 @@ function background(key, val) {
|
|
|
355
355
|
}
|
|
356
356
|
return r;
|
|
357
357
|
}
|
|
358
|
-
return `bg${getVal(value,
|
|
358
|
+
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
359
359
|
}
|
|
360
360
|
if (key === "background-blend-mode") return `bg-blend-${value}${important}`;
|
|
361
361
|
return `${replaceBackground(key, value)}-${transformBox(value)}${important}`;
|
|
@@ -368,13 +368,7 @@ function transformBox(s) {
|
|
|
368
368
|
const reg = /border|content|padding-box/;
|
|
369
369
|
if (reg.test(s)) return s.replace("-box", "");
|
|
370
370
|
if (s.startsWith("repeat-")) return s.replace("repeat-", "");
|
|
371
|
-
return
|
|
372
|
-
}
|
|
373
|
-
function transformSpaceToLine(s) {
|
|
374
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "-");
|
|
375
|
-
}
|
|
376
|
-
function transformSpaceToUnderLine(s) {
|
|
377
|
-
return s.replace(/\s+/, " ").replace(/\s/g, "_");
|
|
371
|
+
return joinWithLine(s);
|
|
378
372
|
}
|
|
379
373
|
function getLinearGradientPosition$1(from, via, to) {
|
|
380
374
|
let result = "";
|
|
@@ -406,7 +400,7 @@ const CONSTANTFLAG = "__transform_to_unocss__";
|
|
|
406
400
|
function matchMultipleBgAttrs(value) {
|
|
407
401
|
const map$2 = {};
|
|
408
402
|
let i = 0;
|
|
409
|
-
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)
|
|
403
|
+
value = value.replace(/(rgba?|hsla?|lab|lch|hwb|color)\(\)*\)/g, (_) => {
|
|
410
404
|
map$2[i++] = _;
|
|
411
405
|
return `${CONSTANTFLAG}${i}}`;
|
|
412
406
|
});
|
|
@@ -1076,7 +1070,7 @@ function toUnocss(css, isRem = false) {
|
|
|
1076
1070
|
const [_, key, val] = match;
|
|
1077
1071
|
const first = getFirstName(key);
|
|
1078
1072
|
const result = (_typeMap$first = typeMap[first]) === null || _typeMap$first === void 0 ? void 0 : _typeMap$first.call(typeMap, key, val);
|
|
1079
|
-
if (result && isRem) return result.replace(/-([0-9.]+)px
|
|
1073
|
+
if (result && isRem) return result.replace(/-([0-9.]+)px/g, (_$1, v) => `-${+v / 4}`).replace(/\[[^\]]+\]/g, (match$1) => match$1.replace(/([0-9.]+)px/g, (_$1, v) => `${+v / 16}rem`));
|
|
1080
1074
|
return result;
|
|
1081
1075
|
}
|
|
1082
1076
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "transform-to-unocss-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.60",
|
|
5
5
|
"description": "A utility to transform CSS to UnoCSS syntax. Supports various CSS properties and custom parsing.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|