transform-to-unocss-core 0.0.71 → 0.0.74

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 CHANGED
@@ -356,7 +356,7 @@ function background(key, val) {
356
356
  const rgb = match[0];
357
357
  return `bg="${value.replace(rgb, `[${rgb}]`)}${important}"`;
358
358
  }
359
- const urlMatch = value.match(/^url\(["'\s.\-\w/@]*\)$/);
359
+ const urlMatch = value.match(/^url\(["'\s.\-\w/@:?#=%&+,;~]*\)$/);
360
360
  if (urlMatch) return `bg="${value.replace(urlMatch[0], `[${urlMatch[0].replace(/['"]/g, "")}]${important}`)}"`;
361
361
  const safeValueMap = new Map();
362
362
  let i = 0;
@@ -756,9 +756,9 @@ function font(key, val) {
756
756
  }
757
757
  if (key === "font-weight") return `font${getVal(value)}${important}`;
758
758
  if (key === "font-family") {
759
- const match = value.match(/ui-(\w{0,4})/);
759
+ const match = value.match(/ui-(sans-serif|serif|monospace)/);
760
760
  if (!match) return `font-[${joinWithUnderLine(val)}]${important}`;
761
- const [_, family] = match;
761
+ const family = match[1] === "sans-serif" ? "sans" : match[1] === "monospace" ? "mono" : "serif";
762
762
  return `font-${family}${important}`;
763
763
  }
764
764
  if (key === "font-style") {
@@ -1339,7 +1339,10 @@ function text(key, val) {
1339
1339
  if (value === "none") return `normal-case${important}`;
1340
1340
  return `${value}${important}`;
1341
1341
  }
1342
- if (key === "text-decoration") return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1342
+ if (key === "text-decoration") {
1343
+ if (value === "none") return `no-underline${important}`;
1344
+ return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1345
+ }
1343
1346
  if (key.startsWith("text-decoration") || key === "text-indent") return `${key.split("-")[1]}${getVal(value)}${important}`;
1344
1347
  if (key === "text-underline-offset") return `underline-offset${getVal(value)}${important}`;
1345
1348
  if (key === "text-align-last") return `${important}[${key}:${value}]`;
@@ -358,7 +358,7 @@ function background(key, val) {
358
358
  const rgb = match[0];
359
359
  return `bg="${value.replace(rgb, `[${rgb}]`)}${important}"`;
360
360
  }
361
- const urlMatch = value.match(/^url\(["'\s.\-\w/@]*\)$/);
361
+ const urlMatch = value.match(/^url\(["'\s.\-\w/@:?#=%&+,;~]*\)$/);
362
362
  if (urlMatch) return `bg="${value.replace(urlMatch[0], `[${urlMatch[0].replace(/['"]/g, "")}]${important}`)}"`;
363
363
  const safeValueMap = new Map();
364
364
  let i = 0;
@@ -758,9 +758,9 @@ function font(key, val) {
758
758
  }
759
759
  if (key === "font-weight") return `font${getVal(value)}${important}`;
760
760
  if (key === "font-family") {
761
- const match = value.match(/ui-(\w{0,4})/);
761
+ const match = value.match(/ui-(sans-serif|serif|monospace)/);
762
762
  if (!match) return `font-[${joinWithUnderLine(val)}]${important}`;
763
- const [_, family] = match;
763
+ const family = match[1] === "sans-serif" ? "sans" : match[1] === "monospace" ? "mono" : "serif";
764
764
  return `font-${family}${important}`;
765
765
  }
766
766
  if (key === "font-style") {
@@ -1341,7 +1341,10 @@ function text(key, val) {
1341
1341
  if (value === "none") return `normal-case${important}`;
1342
1342
  return `${value}${important}`;
1343
1343
  }
1344
- if (key === "text-decoration") return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1344
+ if (key === "text-decoration") {
1345
+ if (value === "none") return `no-underline${important}`;
1346
+ return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1347
+ }
1345
1348
  if (key.startsWith("text-decoration") || key === "text-indent") return `${key.split("-")[1]}${getVal(value)}${important}`;
1346
1349
  if (key === "text-underline-offset") return `underline-offset${getVal(value)}${important}`;
1347
1350
  if (key === "text-align-last") return `${important}[${key}:${value}]`;
package/dist/index.js CHANGED
@@ -354,7 +354,7 @@ function background(key, val) {
354
354
  const rgb = match[0];
355
355
  return `bg="${value.replace(rgb, `[${rgb}]`)}${important}"`;
356
356
  }
357
- const urlMatch = value.match(/^url\(["'\s.\-\w/@]*\)$/);
357
+ const urlMatch = value.match(/^url\(["'\s.\-\w/@:?#=%&+,;~]*\)$/);
358
358
  if (urlMatch) return `bg="${value.replace(urlMatch[0], `[${urlMatch[0].replace(/['"]/g, "")}]${important}`)}"`;
359
359
  const safeValueMap = new Map();
360
360
  let i = 0;
@@ -754,9 +754,9 @@ function font(key, val) {
754
754
  }
755
755
  if (key === "font-weight") return `font${getVal(value)}${important}`;
756
756
  if (key === "font-family") {
757
- const match = value.match(/ui-(\w{0,4})/);
757
+ const match = value.match(/ui-(sans-serif|serif|monospace)/);
758
758
  if (!match) return `font-[${joinWithUnderLine(val)}]${important}`;
759
- const [_, family] = match;
759
+ const family = match[1] === "sans-serif" ? "sans" : match[1] === "monospace" ? "mono" : "serif";
760
760
  return `font-${family}${important}`;
761
761
  }
762
762
  if (key === "font-style") {
@@ -1337,7 +1337,10 @@ function text(key, val) {
1337
1337
  if (value === "none") return `normal-case${important}`;
1338
1338
  return `${value}${important}`;
1339
1339
  }
1340
- if (key === "text-decoration") return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1340
+ if (key === "text-decoration") {
1341
+ if (value === "none") return `no-underline${important}`;
1342
+ return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1343
+ }
1341
1344
  if (key.startsWith("text-decoration") || key === "text-indent") return `${key.split("-")[1]}${getVal(value)}${important}`;
1342
1345
  if (key === "text-underline-offset") return `underline-offset${getVal(value)}${important}`;
1343
1346
  if (key === "text-align-last") return `${important}[${key}:${value}]`;
package/dist/index.umd.js CHANGED
@@ -361,7 +361,7 @@ function background(key, val) {
361
361
  const rgb = match[0];
362
362
  return `bg="${value.replace(rgb, `[${rgb}]`)}${important}"`;
363
363
  }
364
- const urlMatch = value.match(/^url\(["'\s.\-\w/@]*\)$/);
364
+ const urlMatch = value.match(/^url\(["'\s.\-\w/@:?#=%&+,;~]*\)$/);
365
365
  if (urlMatch) return `bg="${value.replace(urlMatch[0], `[${urlMatch[0].replace(/['"]/g, "")}]${important}`)}"`;
366
366
  const safeValueMap = new Map();
367
367
  let i = 0;
@@ -761,9 +761,9 @@ function font(key, val) {
761
761
  }
762
762
  if (key === "font-weight") return `font${getVal(value)}${important}`;
763
763
  if (key === "font-family") {
764
- const match = value.match(/ui-(\w{0,4})/);
764
+ const match = value.match(/ui-(sans-serif|serif|monospace)/);
765
765
  if (!match) return `font-[${joinWithUnderLine(val)}]${important}`;
766
- const [_, family] = match;
766
+ const family = match[1] === "sans-serif" ? "sans" : match[1] === "monospace" ? "mono" : "serif";
767
767
  return `font-${family}${important}`;
768
768
  }
769
769
  if (key === "font-style") {
@@ -1344,7 +1344,10 @@ function text(key, val) {
1344
1344
  if (value === "none") return `normal-case${important}`;
1345
1345
  return `${value}${important}`;
1346
1346
  }
1347
- if (key === "text-decoration") return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1347
+ if (key === "text-decoration") {
1348
+ if (value === "none") return `no-underline${important}`;
1349
+ return value.split(" ").map((v) => v ? `${important}${v}` : "").join(" ");
1350
+ }
1348
1351
  if (key.startsWith("text-decoration") || key === "text-indent") return `${key.split("-")[1]}${getVal(value)}${important}`;
1349
1352
  if (key === "text-underline-offset") return `underline-offset${getVal(value)}${important}`;
1350
1353
  if (key === "text-align-last") return `${important}[${key}:${value}]`;
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.71",
4
+ "version": "0.0.74",
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",
@@ -54,7 +54,8 @@
54
54
  "format": "prettier --write --cache .",
55
55
  "lint": "eslint . --cache",
56
56
  "lint:fix": "pnpm run lint --fix",
57
- "prepublishOnly": "nr build",
57
+ "prepublishOnly": "npm run build",
58
+ "publish": "npm publish",
58
59
  "release": "bumpp && npm publish",
59
60
  "start": "esno src/index.ts",
60
61
  "test": "vitest",
@@ -64,7 +65,7 @@
64
65
  "@antfu/eslint-config": "^4.19.0",
65
66
  "@types/node": "^18.19.130",
66
67
  "bumpp": "^8.2.1",
67
- "eslint": "^9.39.1",
68
+ "eslint": "^9.39.4",
68
69
  "esno": "^0.16.3",
69
70
  "picocolors": "^1.1.1",
70
71
  "prettier": "^2.8.8",