weapp-tailwindcss 3.4.0-alpha.0 → 3.4.0-alpha.2
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/babel/index.d.ts +16 -0
- package/dist/bundlers/gulp/index.d.ts +8 -0
- package/dist/bundlers/vite/index.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +8 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +8 -0
- package/dist/bundlers/webpack/index.d.ts +1 -0
- package/dist/{weapp-tw-runtime-loader.d.ts → bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts} +2 -4
- package/dist/cache/index.d.ts +32 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +51 -1760
- package/dist/cli.mjs +45 -34
- package/dist/constants-CFM1J-h1.js +42 -0
- package/dist/constants-Dy2Dd3Fz.mjs +36 -0
- package/dist/constants.d.ts +7 -0
- package/dist/core.d.ts +2 -16
- package/dist/core.js +60 -1775
- package/dist/core.mjs +60 -46
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +4 -7
- package/dist/css-macro/index.js +30 -140
- package/dist/css-macro/index.mjs +28 -35
- package/dist/css-macro/postcss.d.ts +3 -5
- package/dist/css-macro/postcss.js +46 -99
- package/dist/css-macro/postcss.mjs +45 -54
- package/dist/debug/index.d.ts +2 -0
- package/dist/defaults-DW-EahCC.js +145 -0
- package/dist/defaults-w3rlKQwe.mjs +139 -0
- package/dist/defaults.d.ts +2 -16
- package/dist/defaults.js +7 -208
- package/dist/defaults.mjs +4 -9
- package/dist/defu-Cdz2PomB.js +60 -0
- package/dist/defu-n46TJT6t.mjs +57 -0
- package/dist/env.d.ts +2 -0
- package/dist/escape.d.ts +4 -0
- package/dist/extractors/split.d.ts +3 -0
- package/dist/gulp.d.ts +1 -26
- package/dist/gulp.js +38 -1898
- package/dist/gulp.mjs +30 -15
- package/dist/index-B2TNoaOv.mjs +134 -0
- package/dist/index-B5NiRecR.js +130 -0
- package/dist/index-BEIjgKpF.mjs +11 -0
- package/dist/index-BPzIdybK.mjs +513 -0
- package/dist/index-DeW_zXzo.mjs +124 -0
- package/dist/index-DmzxhHCX.js +136 -0
- package/dist/index-DwZHOkK3.js +526 -0
- package/dist/index-HC-Qkn0i.js +17 -0
- package/dist/index.d.ts +4 -17
- package/dist/index.js +43 -2291
- package/dist/index.mjs +33 -23
- package/dist/js/handlers.d.ts +13 -0
- package/dist/js/index.d.ts +7 -0
- package/dist/mangle/index.d.ts +8 -0
- package/dist/options-7EjuAISl.mjs +869 -0
- package/dist/options-C-rvBixk.js +901 -0
- package/dist/options.d.ts +2 -0
- package/dist/postcss/cssVars.d.ts +5 -0
- package/dist/postcss/index.d.ts +3 -0
- package/dist/postcss/mp.d.ts +8 -0
- package/dist/postcss/plugins/ctx.d.ts +6 -0
- package/dist/postcss/plugins/index.d.ts +7 -0
- package/dist/postcss/plugins/post.d.ts +5 -0
- package/dist/postcss/plugins/pre.d.ts +5 -0
- package/dist/postcss/preflight.d.ts +3 -0
- package/dist/postcss/selectorParser.d.ts +6 -0
- package/dist/postcss/shared.d.ts +3 -0
- package/dist/postcss/symbols.d.ts +1 -0
- package/dist/postcss.d.ts +1 -23
- package/dist/postcss.js +22 -598
- package/dist/postcss.mjs +8 -17
- package/dist/reg.d.ts +1 -0
- package/dist/replace.d.ts +3 -19
- package/dist/replace.js +42 -93
- package/dist/replace.mjs +26 -30
- package/dist/shared-DbJl6i6a.mjs +25 -0
- package/dist/shared-hzYeE1wX.js +28 -0
- package/dist/tailwindcss/patcher.d.ts +3 -0
- package/dist/types.d.ts +165 -0
- package/dist/utils.d.ts +18 -0
- package/dist/v5-BD9-sqra.mjs +174 -0
- package/dist/v5-Ch6783yy.js +181 -0
- package/dist/vite.d.ts +1 -22
- package/dist/vite.js +36 -1947
- package/dist/vite.mjs +28 -15
- package/dist/weapp-tw-runtime-loader.js +14 -41
- package/dist/weapp-tw-runtime-loader.mjs +8 -12
- package/dist/webpack.d.ts +1 -26
- package/dist/webpack.js +37 -1994
- package/dist/webpack.mjs +29 -15
- package/dist/webpack4.d.ts +1 -27
- package/dist/webpack4.js +190 -1979
- package/dist/webpack4.mjs +188 -211
- package/dist/wxml/Tokenizer.d.ts +31 -0
- package/dist/wxml/index.d.ts +2 -0
- package/dist/wxml/shared.d.ts +2 -0
- package/dist/wxml/utils.d.ts +13 -0
- package/package.json +3 -3
- package/dist/chunk-257YPDSI.mjs +0 -173
- package/dist/chunk-75EWCRQW.mjs +0 -13
- package/dist/chunk-AB467PG7.mjs +0 -43
- package/dist/chunk-E7XGHGC7.mjs +0 -62
- package/dist/chunk-GUE4UCRJ.mjs +0 -126
- package/dist/chunk-IOYI6MSW.mjs +0 -533
- package/dist/chunk-LDWI65M5.mjs +0 -152
- package/dist/chunk-NVFWRLOI.mjs +0 -27
- package/dist/chunk-ORMKM6ZA.mjs +0 -30
- package/dist/chunk-PC4B5JJB.mjs +0 -953
- package/dist/chunk-SRLZU2YE.mjs +0 -95
- package/dist/chunk-VECXHWWG.mjs +0 -31
- package/dist/chunk-VN37QGSM.mjs +0 -216
- package/dist/cli.d.mts +0 -2
- package/dist/core.d.mts +0 -22
- package/dist/css-macro/index.d.mts +0 -18
- package/dist/css-macro/postcss.d.mts +0 -7
- package/dist/defaults.d.mts +0 -16
- package/dist/gulp.d.mts +0 -26
- package/dist/index.d.mts +0 -17
- package/dist/postcss.d.mts +0 -23
- package/dist/replace.d.mts +0 -19
- package/dist/types-DSNuiOhH.d.mts +0 -519
- package/dist/types-DSNuiOhH.d.ts +0 -519
- package/dist/vite.d.mts +0 -22
- package/dist/weapp-tw-runtime-loader.d.mts +0 -7
- package/dist/webpack.d.mts +0 -26
- package/dist/webpack4.d.mts +0 -27
package/dist/core.mjs
CHANGED
|
@@ -1,49 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { g as getOptions, _ as __awaiter } from './options-7EjuAISl.mjs';
|
|
2
|
+
import 'magic-string';
|
|
3
|
+
import './replace.mjs';
|
|
4
|
+
import '@weapp-core/escape';
|
|
5
|
+
import '@ast-core/escape';
|
|
6
|
+
import './shared-DbJl6i6a.mjs';
|
|
7
|
+
import '@weapp-core/regex';
|
|
8
|
+
import '@babel/generator';
|
|
9
|
+
import '@babel/traverse';
|
|
10
|
+
import '@babel/parser';
|
|
11
|
+
import './defaults-w3rlKQwe.mjs';
|
|
12
|
+
import './defu-n46TJT6t.mjs';
|
|
13
|
+
import '@babel/types';
|
|
14
|
+
import 'htmlparser2';
|
|
15
|
+
import 'postcss';
|
|
16
|
+
import './index-BPzIdybK.mjs';
|
|
17
|
+
import '@csstools/postcss-is-pseudo-class';
|
|
18
|
+
import 'postcss-rem-to-responsive-pixel';
|
|
19
|
+
import 'postcss-selector-parser';
|
|
20
|
+
import 'node:path';
|
|
21
|
+
import 'node:process';
|
|
22
|
+
import 'tailwindcss-patch';
|
|
23
|
+
import '@tailwindcss-mangle/shared';
|
|
24
|
+
import 'lru-cache';
|
|
25
|
+
import 'md5';
|
|
13
26
|
|
|
14
|
-
// src/core.ts
|
|
15
27
|
function createContext(options = {}) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
const opts = getOptions(options);
|
|
29
|
+
const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
|
|
30
|
+
let runtimeSet = new Set();
|
|
31
|
+
patch === null || patch === void 0 ? void 0 : patch();
|
|
32
|
+
function transformWxss(rawCss, options) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const code = yield styleHandler(rawCss, Object.assign({
|
|
35
|
+
isMainChunk: true,
|
|
36
|
+
}, options));
|
|
37
|
+
return code;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function transformJs(rawJs_1) {
|
|
41
|
+
return __awaiter(this, arguments, void 0, function* (rawJs, options = {}) {
|
|
42
|
+
runtimeSet
|
|
43
|
+
= options && options.runtimeSet
|
|
44
|
+
? options.runtimeSet
|
|
45
|
+
: twPatcher.getClassSet();
|
|
46
|
+
const { code } = yield jsHandler(rawJs, runtimeSet, options);
|
|
47
|
+
return code;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function transformWxml(rawWxml, options) {
|
|
51
|
+
const code = templateHandler(rawWxml, Object.assign({
|
|
52
|
+
runtimeSet,
|
|
53
|
+
}, options));
|
|
54
|
+
return code;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
transformWxss,
|
|
58
|
+
transformWxml,
|
|
59
|
+
transformJs,
|
|
60
|
+
};
|
|
46
61
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
62
|
+
|
|
63
|
+
export { createContext };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const uniAppPlatform: string[];
|
|
2
|
+
export declare const queryKey = "weapp-tw-platform";
|
|
3
|
+
export declare function createMediaQuery(value: string): string;
|
|
4
|
+
export declare function createNegativeMediaQuery(value: string): string;
|
|
5
|
+
export declare function normalComment(text: string): string;
|
|
6
|
+
export declare function ifdef(text: string): {
|
|
7
|
+
start: string;
|
|
8
|
+
end: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function ifndef(text: string): {
|
|
11
|
+
start: string;
|
|
12
|
+
end: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
1
|
+
export interface Options {
|
|
4
2
|
variantsMap?: Record<string, string | {
|
|
5
3
|
value: string;
|
|
6
4
|
negative?: boolean;
|
|
@@ -9,10 +7,9 @@ interface Options {
|
|
|
9
7
|
}
|
|
10
8
|
declare const _default: {
|
|
11
9
|
(options: Options): {
|
|
12
|
-
handler:
|
|
13
|
-
config?: Partial<
|
|
10
|
+
handler: import("tailwindcss/types/config").PluginCreator;
|
|
11
|
+
config?: Partial<import("tailwindcss/types/config").Config> | undefined;
|
|
14
12
|
};
|
|
15
13
|
__isOptionsFunction: true;
|
|
16
14
|
};
|
|
17
|
-
|
|
18
|
-
export { type Options, _default as default };
|
|
15
|
+
export default _default;
|
package/dist/css-macro/index.js
CHANGED
|
@@ -1,146 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
default: () => css_macro_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(css_macro_exports);
|
|
36
|
-
var import_plugin = __toESM(require("tailwindcss/plugin"));
|
|
3
|
+
var plugin = require('tailwindcss/plugin');
|
|
4
|
+
var constants = require('../constants-CFM1J-h1.js');
|
|
5
|
+
var defu = require('../defu-Cdz2PomB.js');
|
|
37
6
|
|
|
38
|
-
|
|
39
|
-
var queryKey = "weapp-tw-platform";
|
|
40
|
-
function createMediaQuery(value) {
|
|
41
|
-
return `@media (${queryKey}:"${value}"){&}`;
|
|
42
|
-
}
|
|
43
|
-
function createNegativeMediaQuery(value) {
|
|
44
|
-
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
45
|
-
}
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
46
8
|
|
|
47
|
-
|
|
48
|
-
function isPlainObject(value) {
|
|
49
|
-
if (value === null || typeof value !== "object") {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
const prototype = Object.getPrototypeOf(value);
|
|
53
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
if (Symbol.iterator in value) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
if (Symbol.toStringTag in value) {
|
|
60
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
61
|
-
}
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
65
|
-
if (!isPlainObject(defaults)) {
|
|
66
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
67
|
-
}
|
|
68
|
-
const object = Object.assign({}, defaults);
|
|
69
|
-
for (const key in baseObject) {
|
|
70
|
-
if (key === "__proto__" || key === "constructor") {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
const value = baseObject[key];
|
|
74
|
-
if (value === null || value === void 0) {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
81
|
-
object[key] = [...value, ...object[key]];
|
|
82
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
83
|
-
object[key] = _defu(
|
|
84
|
-
value,
|
|
85
|
-
object[key],
|
|
86
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
87
|
-
merger
|
|
88
|
-
);
|
|
89
|
-
} else {
|
|
90
|
-
object[key] = value;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return object;
|
|
94
|
-
}
|
|
95
|
-
function createDefu(merger) {
|
|
96
|
-
return (...arguments_) => (
|
|
97
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
98
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
var defu = createDefu();
|
|
102
|
-
var defuFn = createDefu((object, key, currentValue) => {
|
|
103
|
-
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
104
|
-
object[key] = currentValue(object[key]);
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
109
|
-
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
110
|
-
object[key] = currentValue(object[key]);
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
9
|
+
var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
|
|
114
10
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
11
|
+
var index = plugin__default["default"].withOptions((options) => {
|
|
12
|
+
const { dynamic: dynamicMode, variantsMap } = defu.defu(options, {
|
|
13
|
+
dynamic: true,
|
|
14
|
+
variantsMap: {},
|
|
15
|
+
});
|
|
16
|
+
return ({ matchVariant, addVariant }) => {
|
|
17
|
+
if (dynamicMode) {
|
|
18
|
+
matchVariant('ifdef', (value) => {
|
|
19
|
+
return constants.createMediaQuery(value);
|
|
20
|
+
});
|
|
21
|
+
matchVariant('ifndef', (value) => {
|
|
22
|
+
return constants.createNegativeMediaQuery(value);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
26
|
+
if (typeof obj === 'string') {
|
|
27
|
+
addVariant(name, constants.createMediaQuery(obj));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
addVariant(name, obj.negative ? constants.createNegativeMediaQuery(obj.value) : constants.createMediaQuery(obj.value));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
121
34
|
});
|
|
122
35
|
|
|
123
|
-
|
|
124
|
-
var css_macro_default = import_plugin.default.withOptions((options) => {
|
|
125
|
-
const { dynamic: dynamicMode, variantsMap } = defu(options, {
|
|
126
|
-
dynamic: true,
|
|
127
|
-
variantsMap: {}
|
|
128
|
-
});
|
|
129
|
-
return ({ matchVariant, addVariant }) => {
|
|
130
|
-
if (dynamicMode) {
|
|
131
|
-
matchVariant("ifdef", (value) => {
|
|
132
|
-
return createMediaQuery(value);
|
|
133
|
-
});
|
|
134
|
-
matchVariant("ifndef", (value) => {
|
|
135
|
-
return createNegativeMediaQuery(value);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
139
|
-
if (typeof obj === "string") {
|
|
140
|
-
addVariant(name, createMediaQuery(obj));
|
|
141
|
-
} else {
|
|
142
|
-
addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
});
|
|
36
|
+
module.exports = index;
|
package/dist/css-macro/index.mjs
CHANGED
|
@@ -1,37 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../chunk-AB467PG7.mjs";
|
|
5
|
-
import {
|
|
6
|
-
defu
|
|
7
|
-
} from "../chunk-GUE4UCRJ.mjs";
|
|
8
|
-
import "../chunk-E7XGHGC7.mjs";
|
|
1
|
+
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants-Dy2Dd3Fz.mjs';
|
|
3
|
+
import { d as defu } from '../defu-n46TJT6t.mjs';
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
};
|
|
5
|
+
var index = plugin.withOptions((options) => {
|
|
6
|
+
const { dynamic: dynamicMode, variantsMap } = defu(options, {
|
|
7
|
+
dynamic: true,
|
|
8
|
+
variantsMap: {},
|
|
9
|
+
});
|
|
10
|
+
return ({ matchVariant, addVariant }) => {
|
|
11
|
+
if (dynamicMode) {
|
|
12
|
+
matchVariant('ifdef', (value) => {
|
|
13
|
+
return createMediaQuery(value);
|
|
14
|
+
});
|
|
15
|
+
matchVariant('ifndef', (value) => {
|
|
16
|
+
return createNegativeMediaQuery(value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
20
|
+
if (typeof obj === 'string') {
|
|
21
|
+
addVariant(name, createMediaQuery(obj));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
34
28
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
29
|
+
|
|
30
|
+
export { index as default };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { PluginCreator } from 'postcss';
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
1
|
+
import type { PluginCreator } from 'postcss';
|
|
2
|
+
export interface Options {
|
|
4
3
|
}
|
|
5
4
|
declare const creator: PluginCreator<Options>;
|
|
6
|
-
|
|
7
|
-
export { type Options, creator as default };
|
|
5
|
+
export default creator;
|
|
@@ -1,104 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var postcss_exports = {};
|
|
22
|
-
__export(postcss_exports, {
|
|
23
|
-
default: () => postcss_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(postcss_exports);
|
|
3
|
+
var constants = require('../constants-CFM1J-h1.js');
|
|
26
4
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
values.push(arr[1]);
|
|
69
|
-
});
|
|
70
|
-
if (values.length > 0) {
|
|
71
|
-
const isNegative = atRule.params.includes("not");
|
|
72
|
-
const text = values.join(" ");
|
|
73
|
-
const comment = isNegative ? ifndef(text) : ifdef(text);
|
|
74
|
-
atRule.replaceWith([
|
|
75
|
-
helper.comment({
|
|
76
|
-
raws: {
|
|
77
|
-
before: "\n"
|
|
78
|
-
},
|
|
79
|
-
text: comment.start
|
|
80
|
-
}),
|
|
81
|
-
...(_a = atRule.nodes) != null ? _a : [],
|
|
82
|
-
// .map((x) => x.clone()),
|
|
83
|
-
helper.comment({
|
|
84
|
-
raws: {
|
|
85
|
-
before: "\n"
|
|
86
|
-
},
|
|
87
|
-
text: comment.end
|
|
88
|
-
})
|
|
89
|
-
]);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
5
|
+
const creator = () => {
|
|
6
|
+
return {
|
|
7
|
+
postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
|
|
8
|
+
prepare() {
|
|
9
|
+
return {
|
|
10
|
+
AtRule(atRule, helper) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (atRule.name === 'media') {
|
|
13
|
+
const values = [];
|
|
14
|
+
constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
15
|
+
values.push(arr[1]);
|
|
16
|
+
});
|
|
17
|
+
if (values.length > 0) {
|
|
18
|
+
const isNegative = atRule.params.includes('not');
|
|
19
|
+
const text = values.join(' ');
|
|
20
|
+
const comment = isNegative ? constants.ifndef(text) : constants.ifdef(text);
|
|
21
|
+
atRule.replaceWith([
|
|
22
|
+
helper.comment({
|
|
23
|
+
raws: {
|
|
24
|
+
before: '\n',
|
|
25
|
+
},
|
|
26
|
+
text: comment.start,
|
|
27
|
+
}),
|
|
28
|
+
...((_a = atRule.nodes) !== null && _a !== void 0 ? _a : []),
|
|
29
|
+
helper.comment({
|
|
30
|
+
raws: {
|
|
31
|
+
before: '\n',
|
|
32
|
+
},
|
|
33
|
+
text: comment.end,
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
CommentExit(comment) {
|
|
40
|
+
if (/#(?:ifn?def|endif)/.test(comment.text)) {
|
|
41
|
+
comment.raws.left = ' ';
|
|
42
|
+
comment.raws.right = ' ';
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
92
46
|
},
|
|
93
|
-
|
|
94
|
-
if (/#(?:ifn?def|endif)/.test(comment.text)) {
|
|
95
|
-
comment.raws.left = " ";
|
|
96
|
-
comment.raws.right = " ";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
};
|
|
47
|
+
};
|
|
102
48
|
};
|
|
103
49
|
creator.postcss = true;
|
|
104
|
-
|
|
50
|
+
|
|
51
|
+
module.exports = creator;
|
|
@@ -1,58 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ifdef,
|
|
3
|
-
ifndef,
|
|
4
|
-
matchCustomPropertyFromValue
|
|
5
|
-
} from "../chunk-AB467PG7.mjs";
|
|
6
|
-
import "../chunk-E7XGHGC7.mjs";
|
|
1
|
+
import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants-Dy2Dd3Fz.mjs';
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
3
|
+
const creator = () => {
|
|
4
|
+
return {
|
|
5
|
+
postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
|
|
6
|
+
prepare() {
|
|
7
|
+
return {
|
|
8
|
+
AtRule(atRule, helper) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (atRule.name === 'media') {
|
|
11
|
+
const values = [];
|
|
12
|
+
matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
13
|
+
values.push(arr[1]);
|
|
14
|
+
});
|
|
15
|
+
if (values.length > 0) {
|
|
16
|
+
const isNegative = atRule.params.includes('not');
|
|
17
|
+
const text = values.join(' ');
|
|
18
|
+
const comment = isNegative ? ifndef(text) : ifdef(text);
|
|
19
|
+
atRule.replaceWith([
|
|
20
|
+
helper.comment({
|
|
21
|
+
raws: {
|
|
22
|
+
before: '\n',
|
|
23
|
+
},
|
|
24
|
+
text: comment.start,
|
|
25
|
+
}),
|
|
26
|
+
...((_a = atRule.nodes) !== null && _a !== void 0 ? _a : []),
|
|
27
|
+
helper.comment({
|
|
28
|
+
raws: {
|
|
29
|
+
before: '\n',
|
|
30
|
+
},
|
|
31
|
+
text: comment.end,
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
CommentExit(comment) {
|
|
38
|
+
if (/#(?:ifn?def|endif)/.test(comment.text)) {
|
|
39
|
+
comment.raws.left = ' ';
|
|
40
|
+
comment.raws.right = ' ';
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
-
if (/#(?:ifn?def|endif)/.test(comment.text)) {
|
|
46
|
-
comment.raws.left = " ";
|
|
47
|
-
comment.raws.right = " ";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
};
|
|
45
|
+
};
|
|
53
46
|
};
|
|
54
47
|
creator.postcss = true;
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
postcss_default as default
|
|
58
|
-
};
|
|
48
|
+
|
|
49
|
+
export { creator as default };
|