@aiot-toolkit/parser 2.0.5-beta.8 → 2.0.5-beta.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/lib/ux/utils/StyleUtil.js +11 -9
- package/package.json +7 -6
|
@@ -12,9 +12,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
12
12
|
var _CompressConfig = require("../config/CompressConfig");
|
|
13
13
|
var _StyleSelectorType = require("../enum/StyleSelectorType");
|
|
14
14
|
var _StyleAttributeConfig = require("../config/vela/StyleAttributeConfig");
|
|
15
|
-
var
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
var _tinycolor = _interopRequireDefault(require("tinycolor2"));
|
|
18
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
17
|
/**
|
|
20
18
|
* StyleUtil
|
|
@@ -769,29 +767,33 @@ class StyleUtil {
|
|
|
769
767
|
return numberValue;
|
|
770
768
|
}
|
|
771
769
|
// 2
|
|
772
|
-
else if (StyleUtil.isColor(value)) {
|
|
773
|
-
return StyleUtil.formatColor(value);
|
|
770
|
+
else if (StyleUtil.isColor(`${value}${unit}`)) {
|
|
771
|
+
return StyleUtil.formatColor(`${value}${unit}`);
|
|
774
772
|
}
|
|
775
773
|
// 3
|
|
776
774
|
return node.value + this.translatePercentage(unit);
|
|
777
775
|
}
|
|
778
776
|
static isColor(color) {
|
|
779
|
-
const colorItem =
|
|
777
|
+
const colorItem = (0, _tinycolor.default)(color);
|
|
780
778
|
return colorItem.isValid();
|
|
781
779
|
}
|
|
782
780
|
static formatColor(color) {
|
|
783
|
-
const colorItem =
|
|
781
|
+
const colorItem = (0, _tinycolor.default)(color);
|
|
784
782
|
if (!colorItem.isValid()) {
|
|
785
783
|
return color;
|
|
786
784
|
}
|
|
787
|
-
const format =
|
|
785
|
+
const format = colorItem.getFormat();
|
|
788
786
|
switch (format) {
|
|
789
787
|
case 'hex':
|
|
790
|
-
return colorItem.
|
|
788
|
+
return colorItem.toHexString();
|
|
789
|
+
case 'hex8':
|
|
790
|
+
return colorItem.toHex8String();
|
|
791
791
|
case 'rgb':
|
|
792
792
|
return colorItem.toRgbString();
|
|
793
793
|
case 'hsl':
|
|
794
794
|
return colorItem.toHslString();
|
|
795
|
+
case 'name':
|
|
796
|
+
return color;
|
|
795
797
|
default:
|
|
796
798
|
return colorItem.toRgbString();
|
|
797
799
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/parser",
|
|
3
|
-
"version": "2.0.5-beta.
|
|
3
|
+
"version": "2.0.5-beta.9",
|
|
4
4
|
"description": "Parse the source code of aiot and convert it to the AST (Abstract Syntax Tree) of the target code.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"test": "node ./__tests__/parser.test.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aiot-toolkit/generator": "2.0.5-beta.
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.0.5-beta.
|
|
23
|
+
"@aiot-toolkit/generator": "2.0.5-beta.9",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.0.5-beta.9",
|
|
25
25
|
"@babel/core": "^7.23.6",
|
|
26
26
|
"@babel/generator": "^7.24.10",
|
|
27
27
|
"@babel/parser": "^7.24.8",
|
|
@@ -29,11 +29,10 @@
|
|
|
29
29
|
"@babel/traverse": "^7.23.7",
|
|
30
30
|
"@babel/types": "^7.23.6",
|
|
31
31
|
"aiot-parse5": "^1.0.2",
|
|
32
|
-
"colord": "^2.9.3",
|
|
33
32
|
"css-tree": "npm:aiot-css-tree@^2.3.1",
|
|
34
33
|
"csstree-validator": "^3.0.0",
|
|
35
34
|
"eslint": "^8.46.0",
|
|
36
|
-
"file-lane": "2.0.5-beta.
|
|
35
|
+
"file-lane": "2.0.5-beta.9",
|
|
37
36
|
"fs-extra": "^11.2.0",
|
|
38
37
|
"google-protobuf": "^3.21.2",
|
|
39
38
|
"less": "^4.2.0",
|
|
@@ -46,6 +45,7 @@
|
|
|
46
45
|
"sass": "^1.69.5",
|
|
47
46
|
"sass-alias": "^2.0.1",
|
|
48
47
|
"source-map": "^0.7.4",
|
|
48
|
+
"tinycolor2": "^1.6.0",
|
|
49
49
|
"ts-morph": "^19.0.0",
|
|
50
50
|
"vela-chai": "^1.0.2",
|
|
51
51
|
"vela-quickapp-test": "^1.0.13"
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"@types/postcss-import": "^14.0.3",
|
|
59
59
|
"@types/postcss-url": "^10.0.4",
|
|
60
60
|
"@types/reserved-words": "^0.1.4",
|
|
61
|
+
"@types/tinycolor2": "^1.4.6",
|
|
61
62
|
"babel-plugin-tester": "^11.0.4"
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "c8c79fa9f882b5dcdac5f0dadb5863343eda44b1"
|
|
64
65
|
}
|