weapp-tailwindcss 2.10.0 → 2.10.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/{constants-9jsALkux.js → constants-EVxkHOXL.js} +5 -5
- package/dist/{constants--OCCPvZ8.mjs → constants-ol1NPf7z.mjs} +5 -5
- package/dist/css-macro/index.js +1 -1
- package/dist/css-macro/index.mjs +1 -1
- package/dist/css-macro/postcss.js +38 -22
- package/dist/css-macro/postcss.mjs +38 -22
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const queryKey = 'weapp-tw-platform';
|
|
4
4
|
function createMediaQuery(value) {
|
|
5
|
-
return `@media (${queryKey}
|
|
5
|
+
return `@media (${queryKey}:"${value}"){&}`;
|
|
6
6
|
}
|
|
7
7
|
function createNegativeMediaQuery(value) {
|
|
8
|
-
return `@media not screen and (${queryKey}
|
|
8
|
+
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
9
9
|
}
|
|
10
10
|
function normalComment(text) {
|
|
11
11
|
if (typeof text === 'string') {
|
|
@@ -15,20 +15,20 @@ function normalComment(text) {
|
|
|
15
15
|
}
|
|
16
16
|
function ifdef(text) {
|
|
17
17
|
return {
|
|
18
|
-
start: `#ifdef ${normalComment(text)}
|
|
18
|
+
start: `#ifdef ${normalComment(text)}`,
|
|
19
19
|
end: `#endif`
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
function ifndef(text) {
|
|
23
23
|
return {
|
|
24
|
-
start: `#ifndef ${normalComment(text)}
|
|
24
|
+
start: `#ifndef ${normalComment(text)}`,
|
|
25
25
|
end: `#endif`
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function matchCustomPropertyFromValue(str, cb) {
|
|
29
29
|
let arr;
|
|
30
30
|
let index = 0;
|
|
31
|
-
const regex = new RegExp('\\(\\s*' + queryKey + '\\s
|
|
31
|
+
const regex = new RegExp('\\(\\s*' + queryKey + '\\s*:\\s*"([^)]*)"\\)', 'g');
|
|
32
32
|
while ((arr = regex.exec(str)) !== null) {
|
|
33
33
|
cb(arr, index);
|
|
34
34
|
index++;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const queryKey = 'weapp-tw-platform';
|
|
2
2
|
function createMediaQuery(value) {
|
|
3
|
-
return `@media (${queryKey}
|
|
3
|
+
return `@media (${queryKey}:"${value}"){&}`;
|
|
4
4
|
}
|
|
5
5
|
function createNegativeMediaQuery(value) {
|
|
6
|
-
return `@media not screen and (${queryKey}
|
|
6
|
+
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
7
7
|
}
|
|
8
8
|
function normalComment(text) {
|
|
9
9
|
if (typeof text === 'string') {
|
|
@@ -13,20 +13,20 @@ function normalComment(text) {
|
|
|
13
13
|
}
|
|
14
14
|
function ifdef(text) {
|
|
15
15
|
return {
|
|
16
|
-
start: `#ifdef ${normalComment(text)}
|
|
16
|
+
start: `#ifdef ${normalComment(text)}`,
|
|
17
17
|
end: `#endif`
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function ifndef(text) {
|
|
21
21
|
return {
|
|
22
|
-
start: `#ifndef ${normalComment(text)}
|
|
22
|
+
start: `#ifndef ${normalComment(text)}`,
|
|
23
23
|
end: `#endif`
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function matchCustomPropertyFromValue(str, cb) {
|
|
27
27
|
let arr;
|
|
28
28
|
let index = 0;
|
|
29
|
-
const regex = new RegExp('\\(\\s*' + queryKey + '\\s
|
|
29
|
+
const regex = new RegExp('\\(\\s*' + queryKey + '\\s*:\\s*"([^)]*)"\\)', 'g');
|
|
30
30
|
while ((arr = regex.exec(str)) !== null) {
|
|
31
31
|
cb(arr, index);
|
|
32
32
|
index++;
|
package/dist/css-macro/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var plugin = require('tailwindcss/plugin');
|
|
4
|
-
var constants = require('../constants-
|
|
4
|
+
var constants = require('../constants-EVxkHOXL.js');
|
|
5
5
|
var defu = require('../defu-d2wgbAKv.js');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/dist/css-macro/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import plugin from 'tailwindcss/plugin';
|
|
2
|
-
import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants
|
|
2
|
+
import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants-ol1NPf7z.mjs';
|
|
3
3
|
import { d as defu } from '../defu-R3SAEzGq.mjs';
|
|
4
4
|
|
|
5
5
|
var index = plugin.withOptions((options) => {
|
|
@@ -1,32 +1,48 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var constants = require('../constants-
|
|
3
|
+
var constants = require('../constants-EVxkHOXL.js');
|
|
4
4
|
|
|
5
5
|
const creator = () => {
|
|
6
6
|
return {
|
|
7
7
|
postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
prepare() {
|
|
9
|
+
return {
|
|
10
|
+
AtRule(atRule, helper) {
|
|
11
|
+
if (atRule.name === 'media') {
|
|
12
|
+
const values = [];
|
|
13
|
+
constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
14
|
+
values.push(arr[1]);
|
|
15
|
+
});
|
|
16
|
+
if (values.length > 0) {
|
|
17
|
+
const isNegative = atRule.params.includes('not');
|
|
18
|
+
const text = values.join(' ');
|
|
19
|
+
const comment = isNegative ? constants.ifndef(text) : constants.ifdef(text);
|
|
20
|
+
atRule.before([
|
|
21
|
+
helper.comment({
|
|
22
|
+
raws: {
|
|
23
|
+
before: '\n'
|
|
24
|
+
},
|
|
25
|
+
text: comment.start
|
|
26
|
+
}),
|
|
27
|
+
...atRule.nodes,
|
|
28
|
+
helper.comment({
|
|
29
|
+
raws: {
|
|
30
|
+
before: '\n'
|
|
31
|
+
},
|
|
32
|
+
text: comment.end
|
|
33
|
+
})
|
|
34
|
+
]);
|
|
35
|
+
atRule.remove();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
CommentExit(comment) {
|
|
40
|
+
if (/#(?:ifn?def|endif)/.test(comment.text)) {
|
|
41
|
+
comment.raws.left = ' ';
|
|
42
|
+
comment.raws.right = ' ';
|
|
43
|
+
}
|
|
28
44
|
}
|
|
29
|
-
}
|
|
45
|
+
};
|
|
30
46
|
}
|
|
31
47
|
};
|
|
32
48
|
};
|
|
@@ -1,30 +1,46 @@
|
|
|
1
|
-
import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants
|
|
1
|
+
import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants-ol1NPf7z.mjs';
|
|
2
2
|
|
|
3
3
|
const creator = () => {
|
|
4
4
|
return {
|
|
5
5
|
postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
prepare() {
|
|
7
|
+
return {
|
|
8
|
+
AtRule(atRule, helper) {
|
|
9
|
+
if (atRule.name === 'media') {
|
|
10
|
+
const values = [];
|
|
11
|
+
matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
12
|
+
values.push(arr[1]);
|
|
13
|
+
});
|
|
14
|
+
if (values.length > 0) {
|
|
15
|
+
const isNegative = atRule.params.includes('not');
|
|
16
|
+
const text = values.join(' ');
|
|
17
|
+
const comment = isNegative ? ifndef(text) : ifdef(text);
|
|
18
|
+
atRule.before([
|
|
19
|
+
helper.comment({
|
|
20
|
+
raws: {
|
|
21
|
+
before: '\n'
|
|
22
|
+
},
|
|
23
|
+
text: comment.start
|
|
24
|
+
}),
|
|
25
|
+
...atRule.nodes,
|
|
26
|
+
helper.comment({
|
|
27
|
+
raws: {
|
|
28
|
+
before: '\n'
|
|
29
|
+
},
|
|
30
|
+
text: comment.end
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
atRule.remove();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
CommentExit(comment) {
|
|
38
|
+
if (/#(?:ifn?def|endif)/.test(comment.text)) {
|
|
39
|
+
comment.raws.left = ' ';
|
|
40
|
+
comment.raws.right = ' ';
|
|
41
|
+
}
|
|
26
42
|
}
|
|
27
|
-
}
|
|
43
|
+
};
|
|
28
44
|
}
|
|
29
45
|
};
|
|
30
46
|
};
|
package/package.json
CHANGED