@dcloudio/vue-cli-plugin-hbuilderx 2.0.1-alpha-34920220512001 → 2.0.1-alpha-34920220513003

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.1-alpha-34920220512001",
3
+ "version": "2.0.1-alpha-34920220513003",
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": "f1e8a95ca6df4b7634ed03d42e91e8a524e62b3d"
21
+ "gitHead": "017777d0e42e1a05ce9539f72f97cd7f17d27c1b"
22
22
  }
@@ -16,15 +16,32 @@ function clearImportant (value) {
16
16
  }
17
17
 
18
18
  function transition (declaration) {
19
- var CHUNK_REGEXP = /^(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?\s*(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?$/
19
+ var CHUNK_REGEXP = /^([a-z-_]\S*)(\s+[\d.]+m?s)?(\s+[a-z-_]\S*)?(\s+[\d.]+m?s)?/
20
20
  var { value, important } = clearImportant(declaration.value)
21
- var match = value.match(CHUNK_REGEXP)
22
- var result = []
21
+ var values = value.replace(/(\d)\s*,\s*/g, '$1#').split(',')
23
22
  var position = declaration.position
24
- match[1] && result.push(generateDeclaration('transition-property', match[1], important, position))
25
- match[2] && result.push(generateDeclaration('transition-duration', match[2], important, position))
26
- match[3] && result.push(generateDeclaration('transition-timing-function', match[3], important, position))
27
- match[4] && result.push(generateDeclaration('transition-delay', match[4], important, position))
23
+ var result = []
24
+ var map = {
25
+ 'transition-property': [],
26
+ 'transition-duration': [],
27
+ 'transition-timing-function': [],
28
+ 'transition-delay': []
29
+ }
30
+ if (values.length) {
31
+ for (var i1 = 0; i1 < values.length; i1++) {
32
+ var match = values[i1].trim().match(CHUNK_REGEXP)
33
+ if (!match) {
34
+ return []
35
+ }
36
+ map['transition-property'].push(match[1] || 'all')
37
+ map['transition-duration'].push((match[2] || '0s').trim())
38
+ map['transition-timing-function'].push((match[3] || 'ease').trim().replace(/#/g, ', '))
39
+ map['transition-delay'].push((match[4] || '0s').trim())
40
+ }
41
+ for (var key in map) {
42
+ result.push(generateDeclaration(key, map[key].join(', '), important, position))
43
+ }
44
+ }
28
45
  return result
29
46
  }
30
47
 
@@ -43,6 +43,36 @@ describe('shorthand-parser', function () {
43
43
  position: {}
44
44
  }
45
45
  ])
46
+
47
+ expect(shorthandParser([{
48
+ type: 'declaration',
49
+ property: 'transition',
50
+ value: 'width 2s ease-in-out, height 1s 1s, top cubic-bezier(0.1, 0.7, 1.0, 0.1)',
51
+ position: {}
52
+ }])).eql([{
53
+ type: 'declaration',
54
+ property: 'transition-property',
55
+ value: 'width, height, top',
56
+ position: {}
57
+ },
58
+ {
59
+ type: 'declaration',
60
+ property: 'transition-duration',
61
+ value: '2s, 1s, 0s',
62
+ position: {}
63
+ },
64
+ {
65
+ type: 'declaration',
66
+ property: 'transition-timing-function',
67
+ value: 'ease-in-out, ease, cubic-bezier(0.1, 0.7, 1.0, 0.1)',
68
+ position: {}
69
+ },
70
+ {
71
+ type: 'declaration',
72
+ property: 'transition-delay',
73
+ value: '0s, 1s, 0s',
74
+ position: {}
75
+ }])
46
76
  })
47
77
 
48
78
  it('parse margin', function () {