@unocss/inspector 0.58.8 → 0.59.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.
package/dist/index.mjs CHANGED
@@ -48,7 +48,18 @@ const globalKeywords = [
48
48
 
49
49
  const numberWithUnitRE = /^(-?\d*(?:\.\d+)?)(px|pt|pc|%|r?(?:em|ex|lh|cap|ch|ic)|(?:[sld]?v|cq)(?:[whib]|min|max)|in|cm|mm|rpx)?$/i;
50
50
  const numberRE = /^(-?\d*(?:\.\d+)?)$/i;
51
- const unitOnlyRE = /^(px)$/i;
51
+ const unitOnlyRE = /^(px|[sld]?v[wh])$/i;
52
+ const unitOnlyMap = {
53
+ px: 1,
54
+ vw: 100,
55
+ vh: 100,
56
+ svw: 100,
57
+ svh: 100,
58
+ dvw: 100,
59
+ dvh: 100,
60
+ lvh: 100,
61
+ lvw: 100
62
+ };
52
63
  const bracketTypeRe = /^\[(color|length|size|position|quoted|string):/i;
53
64
 
54
65
  const cssProps = [
@@ -128,7 +139,7 @@ function rem(str) {
128
139
  if (!str)
129
140
  return;
130
141
  if (unitOnlyRE.test(str))
131
- return `1${str}`;
142
+ return `${unitOnlyMap[str]}${str}`;
132
143
  const match = str.match(numberWithUnitRE);
133
144
  if (!match)
134
145
  return;
@@ -142,7 +153,7 @@ function rem(str) {
142
153
  }
143
154
  function px(str) {
144
155
  if (unitOnlyRE.test(str))
145
- return `1${str}`;
156
+ return `${unitOnlyMap[str]}${str}`;
146
157
  const match = str.match(numberWithUnitRE);
147
158
  if (!match)
148
159
  return;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/inspector",
3
- "version": "0.58.8",
3
+ "type": "module",
4
+ "version": "0.59.0-beta.1",
4
5
  "description": "The inspector UI for UnoCSS",
5
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
7
  "license": "MIT",
@@ -22,12 +23,11 @@
22
23
  "sideEffects": false,
23
24
  "exports": {
24
25
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.cjs"
26
+ "types": "./dist/index.d.mts",
27
+ "default": "./dist/index.mjs"
28
28
  }
29
29
  },
30
- "main": "./dist/index.cjs",
30
+ "main": "./dist/index.mjs",
31
31
  "module": "./dist/index.mjs",
32
32
  "types": "./dist/index.d.ts",
33
33
  "files": [
@@ -35,9 +35,9 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "gzip-size": "^6.0.0",
38
- "sirv": "^2.0.4",
39
- "@unocss/rule-utils": "0.58.8",
40
- "@unocss/core": "0.58.8"
38
+ "sirv": "^2.0.3",
39
+ "@unocss/core": "0.59.0-beta.1",
40
+ "@unocss/rule-utils": "0.59.0-beta.1"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild",