@dcloudio/vue-cli-plugin-hbuilderx 2.0.2-3061520221228001 → 2.0.2-3061720230112001
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vue-cli-plugin-hbuilderx",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-3061720230112001",
|
|
4
4
|
"description": "HBuilderX plugin for vue-cli 3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"css": "~2.2.1",
|
|
19
19
|
"escodegen": "^1.8.1"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "2d4422d48475c99a97a56a71b2eaebc0e3107f9d"
|
|
22
22
|
}
|
|
@@ -5,26 +5,6 @@ var util = require('./lib/util')
|
|
|
5
5
|
var validateItem = require('./lib/validator').validate
|
|
6
6
|
var shorthandParser = require('./lib/shorthand-parser')
|
|
7
7
|
|
|
8
|
-
// padding & margin shorthand parsing
|
|
9
|
-
function convertLengthShorthand (rule, prop) {
|
|
10
|
-
for (var i = 0; i < rule.declarations.length; i++) {
|
|
11
|
-
var declaration = rule.declarations[i]
|
|
12
|
-
if (declaration.property === prop) {
|
|
13
|
-
var values = declaration.value.split(/\s+/)
|
|
14
|
-
// values[0] = values[0] || 0
|
|
15
|
-
values[1] = values[1] || values[0]
|
|
16
|
-
values[2] = values[2] || values[0]
|
|
17
|
-
values[3] = values[3] || values[1]
|
|
18
|
-
rule.declarations.splice(i, 1)
|
|
19
|
-
rule.declarations.splice(i, 0, { type: 'declaration', property: prop + '-left', value: values[3], position: declaration.position })
|
|
20
|
-
rule.declarations.splice(i, 0, { type: 'declaration', property: prop + '-bottom', value: values[2], position: declaration.position })
|
|
21
|
-
rule.declarations.splice(i, 0, { type: 'declaration', property: prop + '-right', value: values[1], position: declaration.position })
|
|
22
|
-
rule.declarations.splice(i, 0, { type: 'declaration', property: prop + '-top', value: values[0], position: declaration.position })
|
|
23
|
-
// break
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
8
|
/**
|
|
29
9
|
* mergeStyle
|
|
30
10
|
* @param {*} object
|
|
@@ -85,9 +65,6 @@ function parse (code, done) {
|
|
|
85
65
|
if (type === 'rule') {
|
|
86
66
|
if (rule.declarations && rule.declarations.length) {
|
|
87
67
|
rule.declarations = shorthandParser(rule.declarations)
|
|
88
|
-
// padding & margin shorthand parsing
|
|
89
|
-
convertLengthShorthand(rule, 'padding')
|
|
90
|
-
convertLengthShorthand(rule, 'margin')
|
|
91
68
|
|
|
92
69
|
rule.declarations.forEach(function (declaration) {
|
|
93
70
|
var subType = declaration.type
|
|
@@ -47,31 +47,37 @@ function transition (declaration) {
|
|
|
47
47
|
return result
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
function createParser (property) {
|
|
51
|
+
return function (declaration) {
|
|
52
|
+
var { value, important } = clearImportant(declaration.value)
|
|
53
|
+
var position = declaration.position
|
|
54
|
+
var splitResult = value.split(/\s+/)
|
|
55
|
+
var result = []
|
|
56
|
+
switch (splitResult.length) {
|
|
57
|
+
case 1:
|
|
58
|
+
splitResult.push(splitResult[0], splitResult[0], splitResult[0])
|
|
59
|
+
break
|
|
60
|
+
case 2:
|
|
61
|
+
splitResult.push(splitResult[0], splitResult[1])
|
|
62
|
+
break
|
|
63
|
+
case 3:
|
|
64
|
+
splitResult.push(splitResult[1])
|
|
65
|
+
break
|
|
66
|
+
}
|
|
67
|
+
result.push(
|
|
68
|
+
generateDeclaration(property + '-top', splitResult[0], important, position),
|
|
69
|
+
generateDeclaration(property + '-right', splitResult[1], important, position),
|
|
70
|
+
generateDeclaration(property + '-bottom', splitResult[2], important, position),
|
|
71
|
+
generateDeclaration(property + '-left', splitResult[3], important, position)
|
|
72
|
+
)
|
|
73
|
+
return result
|
|
65
74
|
}
|
|
66
|
-
result.push(
|
|
67
|
-
generateDeclaration('margin-top', splitResult[0], important, position),
|
|
68
|
-
generateDeclaration('margin-right', splitResult[1], important, position),
|
|
69
|
-
generateDeclaration('margin-bottom', splitResult[2], important, position),
|
|
70
|
-
generateDeclaration('margin-left', splitResult[3], important, position)
|
|
71
|
-
)
|
|
72
|
-
return result
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
var margin = createParser('margin')
|
|
78
|
+
|
|
79
|
+
var padding = createParser('padding')
|
|
80
|
+
|
|
75
81
|
function border (declaration) {
|
|
76
82
|
var { value, important } = clearImportant(declaration.value)
|
|
77
83
|
var property = declaration.property
|
|
@@ -199,6 +205,7 @@ function background (declaration) {
|
|
|
199
205
|
var parserCollection = {
|
|
200
206
|
transition,
|
|
201
207
|
margin,
|
|
208
|
+
padding,
|
|
202
209
|
border,
|
|
203
210
|
'border-top': border,
|
|
204
211
|
'border-right': border,
|