@weapp-tailwindcss/merge 1.0.0-alpha.1 → 1.0.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/chunk-VR7IWN2Z.cjs +200 -0
- package/dist/chunk-YR5LCHCZ.js +200 -0
- package/dist/cva.cjs +15 -0
- package/dist/cva.d.cts +6 -0
- package/dist/cva.d.ts +6 -0
- package/dist/cva.js +15 -0
- package/dist/index.cjs +6 -207
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +5 -206
- package/package.json +7 -2
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/@weapp-core+escape@3.0.2/node_modules/@weapp-core/escape/dist/index.mjs
|
|
2
|
+
var MappingChars2String = {
|
|
3
|
+
"[": "_bl_",
|
|
4
|
+
"]": "_br_",
|
|
5
|
+
"(": "_pl_",
|
|
6
|
+
")": "_qr_",
|
|
7
|
+
"#": "_h_",
|
|
8
|
+
"!": "_i_",
|
|
9
|
+
"/": "_s_",
|
|
10
|
+
"\\": "_bs_",
|
|
11
|
+
".": "_d_",
|
|
12
|
+
":": "_c_",
|
|
13
|
+
"%": "_p_",
|
|
14
|
+
",": "_co_",
|
|
15
|
+
"'": "_q_",
|
|
16
|
+
'"': "_dq_",
|
|
17
|
+
"*": "_a_",
|
|
18
|
+
"&": "_am_",
|
|
19
|
+
"@": "_at_",
|
|
20
|
+
"{": "_bal_",
|
|
21
|
+
"}": "_bar_",
|
|
22
|
+
// ' ': '_sp_',
|
|
23
|
+
"+": "_plus_",
|
|
24
|
+
// '-': '_m_',
|
|
25
|
+
";": "_se_",
|
|
26
|
+
"<": "_l_",
|
|
27
|
+
"~": "_t_",
|
|
28
|
+
"=": "_e_",
|
|
29
|
+
">": "_g_",
|
|
30
|
+
"?": "_qu_",
|
|
31
|
+
"^": "_ca_",
|
|
32
|
+
"`": "_bq_",
|
|
33
|
+
"|": "_b_",
|
|
34
|
+
"$": "_do_"
|
|
35
|
+
// _: '_u_'
|
|
36
|
+
};
|
|
37
|
+
var MappingChars2StringEntries = Object.entries(MappingChars2String);
|
|
38
|
+
var SimpleMappingChars2String = {
|
|
39
|
+
"[": "_",
|
|
40
|
+
"]": "_",
|
|
41
|
+
"(": "_",
|
|
42
|
+
")": "_",
|
|
43
|
+
"{": "_",
|
|
44
|
+
"}": "_",
|
|
45
|
+
"+": "a",
|
|
46
|
+
",": "b",
|
|
47
|
+
":": "c",
|
|
48
|
+
".": "d",
|
|
49
|
+
"=": "e",
|
|
50
|
+
";": "f",
|
|
51
|
+
">": "g",
|
|
52
|
+
"#": "h",
|
|
53
|
+
"!": "i",
|
|
54
|
+
"@": "j",
|
|
55
|
+
"^": "k",
|
|
56
|
+
"<": "l",
|
|
57
|
+
"*": "m",
|
|
58
|
+
"&": "n",
|
|
59
|
+
"?": "o",
|
|
60
|
+
"%": "p",
|
|
61
|
+
"'": "q",
|
|
62
|
+
"$": "r",
|
|
63
|
+
"/": "s",
|
|
64
|
+
"~": "t",
|
|
65
|
+
"|": "u",
|
|
66
|
+
"`": "v",
|
|
67
|
+
"\\": "w",
|
|
68
|
+
'"': "x"
|
|
69
|
+
};
|
|
70
|
+
var SimpleMappingChars2StringEntries = Object.entries(SimpleMappingChars2String);
|
|
71
|
+
var MAX_ASCII_CHAR_CODE = 127;
|
|
72
|
+
function isPlainObject(value) {
|
|
73
|
+
if (value === null || typeof value !== "object") {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const prototype = Object.getPrototypeOf(value);
|
|
77
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (Symbol.iterator in value) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (Symbol.toStringTag in value) {
|
|
84
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
89
|
+
if (!isPlainObject(defaults)) {
|
|
90
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
91
|
+
}
|
|
92
|
+
const object = Object.assign({}, defaults);
|
|
93
|
+
for (const key in baseObject) {
|
|
94
|
+
if (key === "__proto__" || key === "constructor") {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const value = baseObject[key];
|
|
98
|
+
if (value === null || value === void 0) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
105
|
+
object[key] = [...value, ...object[key]];
|
|
106
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
107
|
+
object[key] = _defu(
|
|
108
|
+
value,
|
|
109
|
+
object[key],
|
|
110
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
111
|
+
merger
|
|
112
|
+
);
|
|
113
|
+
} else {
|
|
114
|
+
object[key] = value;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return object;
|
|
118
|
+
}
|
|
119
|
+
function createDefu(merger) {
|
|
120
|
+
return (...arguments_) => (
|
|
121
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
122
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
var defu = createDefu();
|
|
126
|
+
function isAsciiNumber(code) {
|
|
127
|
+
return code >= 48 && code <= 57;
|
|
128
|
+
}
|
|
129
|
+
function handleFirstCharacter(char, nextChar, ignoreHead) {
|
|
130
|
+
if (!ignoreHead) {
|
|
131
|
+
const code = char.codePointAt(0);
|
|
132
|
+
if (isAsciiNumber(code)) {
|
|
133
|
+
return `_${char}`;
|
|
134
|
+
}
|
|
135
|
+
if (char === "-" && nextChar && isAsciiNumber(nextChar.codePointAt(0))) {
|
|
136
|
+
return `_${char}`;
|
|
137
|
+
}
|
|
138
|
+
if (char === "-" && nextChar === void 0) {
|
|
139
|
+
return `_${char}`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return char;
|
|
143
|
+
}
|
|
144
|
+
function escape(selectors, options) {
|
|
145
|
+
if (selectors.length === 0) {
|
|
146
|
+
return "";
|
|
147
|
+
}
|
|
148
|
+
const { map, ignoreHead } = defu(options, {
|
|
149
|
+
map: SimpleMappingChars2String,
|
|
150
|
+
ignoreHead: false
|
|
151
|
+
});
|
|
152
|
+
const sb = [];
|
|
153
|
+
for (let i = 0; i < selectors.length; i++) {
|
|
154
|
+
const char = selectors[i];
|
|
155
|
+
const code = char.codePointAt(0);
|
|
156
|
+
if (code !== void 0) {
|
|
157
|
+
if (code > MAX_ASCII_CHAR_CODE) {
|
|
158
|
+
sb.push(`u${code.toString(16)}`);
|
|
159
|
+
} else {
|
|
160
|
+
const hit = map[char];
|
|
161
|
+
if (hit) {
|
|
162
|
+
sb.push(hit);
|
|
163
|
+
} else if (i === 0) {
|
|
164
|
+
sb.push(handleFirstCharacter(char, selectors[i + 1], ignoreHead));
|
|
165
|
+
} else {
|
|
166
|
+
sb.push(char);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return sb.join("");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ../weapp-tailwindcss/dist/chunk-U7O2XXYR.mjs
|
|
175
|
+
function replaceWxml(original, options = {
|
|
176
|
+
keepEOL: false,
|
|
177
|
+
escapeMap: SimpleMappingChars2String
|
|
178
|
+
}) {
|
|
179
|
+
const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
|
|
180
|
+
let res = original;
|
|
181
|
+
if (!keepEOL) {
|
|
182
|
+
res = res.replaceAll(/[\n\r]+/g, "");
|
|
183
|
+
}
|
|
184
|
+
if (mangleContext) {
|
|
185
|
+
res = mangleContext.wxmlHandler(res);
|
|
186
|
+
}
|
|
187
|
+
res = escape(res, {
|
|
188
|
+
map: escapeMap,
|
|
189
|
+
ignoreHead
|
|
190
|
+
});
|
|
191
|
+
return res;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ../weapp-tailwindcss/dist/escape.mjs
|
|
195
|
+
var weappTwIgnore = String.raw;
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
exports.replaceWxml = replaceWxml; exports.weappTwIgnore = weappTwIgnore;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// ../../node_modules/.pnpm/@weapp-core+escape@3.0.2/node_modules/@weapp-core/escape/dist/index.mjs
|
|
2
|
+
var MappingChars2String = {
|
|
3
|
+
"[": "_bl_",
|
|
4
|
+
"]": "_br_",
|
|
5
|
+
"(": "_pl_",
|
|
6
|
+
")": "_qr_",
|
|
7
|
+
"#": "_h_",
|
|
8
|
+
"!": "_i_",
|
|
9
|
+
"/": "_s_",
|
|
10
|
+
"\\": "_bs_",
|
|
11
|
+
".": "_d_",
|
|
12
|
+
":": "_c_",
|
|
13
|
+
"%": "_p_",
|
|
14
|
+
",": "_co_",
|
|
15
|
+
"'": "_q_",
|
|
16
|
+
'"': "_dq_",
|
|
17
|
+
"*": "_a_",
|
|
18
|
+
"&": "_am_",
|
|
19
|
+
"@": "_at_",
|
|
20
|
+
"{": "_bal_",
|
|
21
|
+
"}": "_bar_",
|
|
22
|
+
// ' ': '_sp_',
|
|
23
|
+
"+": "_plus_",
|
|
24
|
+
// '-': '_m_',
|
|
25
|
+
";": "_se_",
|
|
26
|
+
"<": "_l_",
|
|
27
|
+
"~": "_t_",
|
|
28
|
+
"=": "_e_",
|
|
29
|
+
">": "_g_",
|
|
30
|
+
"?": "_qu_",
|
|
31
|
+
"^": "_ca_",
|
|
32
|
+
"`": "_bq_",
|
|
33
|
+
"|": "_b_",
|
|
34
|
+
"$": "_do_"
|
|
35
|
+
// _: '_u_'
|
|
36
|
+
};
|
|
37
|
+
var MappingChars2StringEntries = Object.entries(MappingChars2String);
|
|
38
|
+
var SimpleMappingChars2String = {
|
|
39
|
+
"[": "_",
|
|
40
|
+
"]": "_",
|
|
41
|
+
"(": "_",
|
|
42
|
+
")": "_",
|
|
43
|
+
"{": "_",
|
|
44
|
+
"}": "_",
|
|
45
|
+
"+": "a",
|
|
46
|
+
",": "b",
|
|
47
|
+
":": "c",
|
|
48
|
+
".": "d",
|
|
49
|
+
"=": "e",
|
|
50
|
+
";": "f",
|
|
51
|
+
">": "g",
|
|
52
|
+
"#": "h",
|
|
53
|
+
"!": "i",
|
|
54
|
+
"@": "j",
|
|
55
|
+
"^": "k",
|
|
56
|
+
"<": "l",
|
|
57
|
+
"*": "m",
|
|
58
|
+
"&": "n",
|
|
59
|
+
"?": "o",
|
|
60
|
+
"%": "p",
|
|
61
|
+
"'": "q",
|
|
62
|
+
"$": "r",
|
|
63
|
+
"/": "s",
|
|
64
|
+
"~": "t",
|
|
65
|
+
"|": "u",
|
|
66
|
+
"`": "v",
|
|
67
|
+
"\\": "w",
|
|
68
|
+
'"': "x"
|
|
69
|
+
};
|
|
70
|
+
var SimpleMappingChars2StringEntries = Object.entries(SimpleMappingChars2String);
|
|
71
|
+
var MAX_ASCII_CHAR_CODE = 127;
|
|
72
|
+
function isPlainObject(value) {
|
|
73
|
+
if (value === null || typeof value !== "object") {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const prototype = Object.getPrototypeOf(value);
|
|
77
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (Symbol.iterator in value) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (Symbol.toStringTag in value) {
|
|
84
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
89
|
+
if (!isPlainObject(defaults)) {
|
|
90
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
91
|
+
}
|
|
92
|
+
const object = Object.assign({}, defaults);
|
|
93
|
+
for (const key in baseObject) {
|
|
94
|
+
if (key === "__proto__" || key === "constructor") {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const value = baseObject[key];
|
|
98
|
+
if (value === null || value === void 0) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
105
|
+
object[key] = [...value, ...object[key]];
|
|
106
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
107
|
+
object[key] = _defu(
|
|
108
|
+
value,
|
|
109
|
+
object[key],
|
|
110
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
111
|
+
merger
|
|
112
|
+
);
|
|
113
|
+
} else {
|
|
114
|
+
object[key] = value;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return object;
|
|
118
|
+
}
|
|
119
|
+
function createDefu(merger) {
|
|
120
|
+
return (...arguments_) => (
|
|
121
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
122
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
var defu = createDefu();
|
|
126
|
+
function isAsciiNumber(code) {
|
|
127
|
+
return code >= 48 && code <= 57;
|
|
128
|
+
}
|
|
129
|
+
function handleFirstCharacter(char, nextChar, ignoreHead) {
|
|
130
|
+
if (!ignoreHead) {
|
|
131
|
+
const code = char.codePointAt(0);
|
|
132
|
+
if (isAsciiNumber(code)) {
|
|
133
|
+
return `_${char}`;
|
|
134
|
+
}
|
|
135
|
+
if (char === "-" && nextChar && isAsciiNumber(nextChar.codePointAt(0))) {
|
|
136
|
+
return `_${char}`;
|
|
137
|
+
}
|
|
138
|
+
if (char === "-" && nextChar === void 0) {
|
|
139
|
+
return `_${char}`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return char;
|
|
143
|
+
}
|
|
144
|
+
function escape(selectors, options) {
|
|
145
|
+
if (selectors.length === 0) {
|
|
146
|
+
return "";
|
|
147
|
+
}
|
|
148
|
+
const { map, ignoreHead } = defu(options, {
|
|
149
|
+
map: SimpleMappingChars2String,
|
|
150
|
+
ignoreHead: false
|
|
151
|
+
});
|
|
152
|
+
const sb = [];
|
|
153
|
+
for (let i = 0; i < selectors.length; i++) {
|
|
154
|
+
const char = selectors[i];
|
|
155
|
+
const code = char.codePointAt(0);
|
|
156
|
+
if (code !== void 0) {
|
|
157
|
+
if (code > MAX_ASCII_CHAR_CODE) {
|
|
158
|
+
sb.push(`u${code.toString(16)}`);
|
|
159
|
+
} else {
|
|
160
|
+
const hit = map[char];
|
|
161
|
+
if (hit) {
|
|
162
|
+
sb.push(hit);
|
|
163
|
+
} else if (i === 0) {
|
|
164
|
+
sb.push(handleFirstCharacter(char, selectors[i + 1], ignoreHead));
|
|
165
|
+
} else {
|
|
166
|
+
sb.push(char);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return sb.join("");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ../weapp-tailwindcss/dist/chunk-U7O2XXYR.mjs
|
|
175
|
+
function replaceWxml(original, options = {
|
|
176
|
+
keepEOL: false,
|
|
177
|
+
escapeMap: SimpleMappingChars2String
|
|
178
|
+
}) {
|
|
179
|
+
const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
|
|
180
|
+
let res = original;
|
|
181
|
+
if (!keepEOL) {
|
|
182
|
+
res = res.replaceAll(/[\n\r]+/g, "");
|
|
183
|
+
}
|
|
184
|
+
if (mangleContext) {
|
|
185
|
+
res = mangleContext.wxmlHandler(res);
|
|
186
|
+
}
|
|
187
|
+
res = escape(res, {
|
|
188
|
+
map: escapeMap,
|
|
189
|
+
ignoreHead
|
|
190
|
+
});
|
|
191
|
+
return res;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ../weapp-tailwindcss/dist/escape.mjs
|
|
195
|
+
var weappTwIgnore = String.raw;
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
replaceWxml,
|
|
199
|
+
weappTwIgnore
|
|
200
|
+
};
|
package/dist/cva.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkVR7IWN2Zcjs = require('./chunk-VR7IWN2Z.cjs');
|
|
4
|
+
|
|
5
|
+
// src/cva.ts
|
|
6
|
+
var _classvarianceauthority = require('class-variance-authority');
|
|
7
|
+
function cva(...inputs) {
|
|
8
|
+
const fn = _classvarianceauthority.cva.call(void 0, ...inputs);
|
|
9
|
+
return (...props) => {
|
|
10
|
+
return _chunkVR7IWN2Zcjs.replaceWxml.call(void 0, fn(...props));
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.cva = cva;
|
package/dist/cva.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { cva as cva$1 } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
declare function cva(...inputs: Parameters<typeof cva$1>): (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
5
|
+
|
|
6
|
+
export { cva };
|
package/dist/cva.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { cva as cva$1 } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
declare function cva(...inputs: Parameters<typeof cva$1>): (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
5
|
+
|
|
6
|
+
export { cva };
|
package/dist/cva.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
replaceWxml
|
|
3
|
+
} from "./chunk-YR5LCHCZ.js";
|
|
4
|
+
|
|
5
|
+
// src/cva.ts
|
|
6
|
+
import { cva as _cva } from "class-variance-authority";
|
|
7
|
+
function cva(...inputs) {
|
|
8
|
+
const fn = _cva(...inputs);
|
|
9
|
+
return (...props) => {
|
|
10
|
+
return replaceWxml(fn(...props));
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
cva
|
|
15
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,216 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var _classvarianceauthority = require('class-variance-authority');
|
|
3
|
-
var _clsx = require('clsx');
|
|
4
|
-
var _tailwindmerge = require('tailwind-merge');
|
|
5
|
-
|
|
6
|
-
// ../../node_modules/.pnpm/@weapp-core+escape@3.0.2/node_modules/@weapp-core/escape/dist/index.mjs
|
|
7
|
-
var MappingChars2String = {
|
|
8
|
-
"[": "_bl_",
|
|
9
|
-
"]": "_br_",
|
|
10
|
-
"(": "_pl_",
|
|
11
|
-
")": "_qr_",
|
|
12
|
-
"#": "_h_",
|
|
13
|
-
"!": "_i_",
|
|
14
|
-
"/": "_s_",
|
|
15
|
-
"\\": "_bs_",
|
|
16
|
-
".": "_d_",
|
|
17
|
-
":": "_c_",
|
|
18
|
-
"%": "_p_",
|
|
19
|
-
",": "_co_",
|
|
20
|
-
"'": "_q_",
|
|
21
|
-
'"': "_dq_",
|
|
22
|
-
"*": "_a_",
|
|
23
|
-
"&": "_am_",
|
|
24
|
-
"@": "_at_",
|
|
25
|
-
"{": "_bal_",
|
|
26
|
-
"}": "_bar_",
|
|
27
|
-
// ' ': '_sp_',
|
|
28
|
-
"+": "_plus_",
|
|
29
|
-
// '-': '_m_',
|
|
30
|
-
";": "_se_",
|
|
31
|
-
"<": "_l_",
|
|
32
|
-
"~": "_t_",
|
|
33
|
-
"=": "_e_",
|
|
34
|
-
">": "_g_",
|
|
35
|
-
"?": "_qu_",
|
|
36
|
-
"^": "_ca_",
|
|
37
|
-
"`": "_bq_",
|
|
38
|
-
"|": "_b_",
|
|
39
|
-
"$": "_do_"
|
|
40
|
-
// _: '_u_'
|
|
41
|
-
};
|
|
42
|
-
var MappingChars2StringEntries = Object.entries(MappingChars2String);
|
|
43
|
-
var SimpleMappingChars2String = {
|
|
44
|
-
"[": "_",
|
|
45
|
-
"]": "_",
|
|
46
|
-
"(": "_",
|
|
47
|
-
")": "_",
|
|
48
|
-
"{": "_",
|
|
49
|
-
"}": "_",
|
|
50
|
-
"+": "a",
|
|
51
|
-
",": "b",
|
|
52
|
-
":": "c",
|
|
53
|
-
".": "d",
|
|
54
|
-
"=": "e",
|
|
55
|
-
";": "f",
|
|
56
|
-
">": "g",
|
|
57
|
-
"#": "h",
|
|
58
|
-
"!": "i",
|
|
59
|
-
"@": "j",
|
|
60
|
-
"^": "k",
|
|
61
|
-
"<": "l",
|
|
62
|
-
"*": "m",
|
|
63
|
-
"&": "n",
|
|
64
|
-
"?": "o",
|
|
65
|
-
"%": "p",
|
|
66
|
-
"'": "q",
|
|
67
|
-
"$": "r",
|
|
68
|
-
"/": "s",
|
|
69
|
-
"~": "t",
|
|
70
|
-
"|": "u",
|
|
71
|
-
"`": "v",
|
|
72
|
-
"\\": "w",
|
|
73
|
-
'"': "x"
|
|
74
|
-
};
|
|
75
|
-
var SimpleMappingChars2StringEntries = Object.entries(SimpleMappingChars2String);
|
|
76
|
-
var MAX_ASCII_CHAR_CODE = 127;
|
|
77
|
-
function isPlainObject(value) {
|
|
78
|
-
if (value === null || typeof value !== "object") {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const prototype = Object.getPrototypeOf(value);
|
|
82
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
if (Symbol.iterator in value) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (Symbol.toStringTag in value) {
|
|
89
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
94
|
-
if (!isPlainObject(defaults)) {
|
|
95
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
96
|
-
}
|
|
97
|
-
const object = Object.assign({}, defaults);
|
|
98
|
-
for (const key in baseObject) {
|
|
99
|
-
if (key === "__proto__" || key === "constructor") {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const value = baseObject[key];
|
|
103
|
-
if (value === null || value === void 0) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
110
|
-
object[key] = [...value, ...object[key]];
|
|
111
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
112
|
-
object[key] = _defu(
|
|
113
|
-
value,
|
|
114
|
-
object[key],
|
|
115
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
116
|
-
merger
|
|
117
|
-
);
|
|
118
|
-
} else {
|
|
119
|
-
object[key] = value;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return object;
|
|
123
|
-
}
|
|
124
|
-
function createDefu(merger) {
|
|
125
|
-
return (...arguments_) => (
|
|
126
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
127
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
var defu = createDefu();
|
|
131
|
-
function isAsciiNumber(code) {
|
|
132
|
-
return code >= 48 && code <= 57;
|
|
133
|
-
}
|
|
134
|
-
function handleFirstCharacter(char, nextChar, ignoreHead) {
|
|
135
|
-
if (!ignoreHead) {
|
|
136
|
-
const code = char.codePointAt(0);
|
|
137
|
-
if (isAsciiNumber(code)) {
|
|
138
|
-
return `_${char}`;
|
|
139
|
-
}
|
|
140
|
-
if (char === "-" && nextChar && isAsciiNumber(nextChar.codePointAt(0))) {
|
|
141
|
-
return `_${char}`;
|
|
142
|
-
}
|
|
143
|
-
if (char === "-" && nextChar === void 0) {
|
|
144
|
-
return `_${char}`;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return char;
|
|
148
|
-
}
|
|
149
|
-
function escape(selectors, options) {
|
|
150
|
-
if (selectors.length === 0) {
|
|
151
|
-
return "";
|
|
152
|
-
}
|
|
153
|
-
const { map, ignoreHead } = defu(options, {
|
|
154
|
-
map: SimpleMappingChars2String,
|
|
155
|
-
ignoreHead: false
|
|
156
|
-
});
|
|
157
|
-
const sb = [];
|
|
158
|
-
for (let i = 0; i < selectors.length; i++) {
|
|
159
|
-
const char = selectors[i];
|
|
160
|
-
const code = char.codePointAt(0);
|
|
161
|
-
if (code !== void 0) {
|
|
162
|
-
if (code > MAX_ASCII_CHAR_CODE) {
|
|
163
|
-
sb.push(`u${code.toString(16)}`);
|
|
164
|
-
} else {
|
|
165
|
-
const hit = map[char];
|
|
166
|
-
if (hit) {
|
|
167
|
-
sb.push(hit);
|
|
168
|
-
} else if (i === 0) {
|
|
169
|
-
sb.push(handleFirstCharacter(char, selectors[i + 1], ignoreHead));
|
|
170
|
-
} else {
|
|
171
|
-
sb.push(char);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return sb.join("");
|
|
177
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
178
2
|
|
|
179
|
-
// ../weapp-tailwindcss/dist/chunk-U7O2XXYR.mjs
|
|
180
|
-
function replaceWxml(original, options = {
|
|
181
|
-
keepEOL: false,
|
|
182
|
-
escapeMap: SimpleMappingChars2String
|
|
183
|
-
}) {
|
|
184
|
-
const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
|
|
185
|
-
let res = original;
|
|
186
|
-
if (!keepEOL) {
|
|
187
|
-
res = res.replaceAll(/[\n\r]+/g, "");
|
|
188
|
-
}
|
|
189
|
-
if (mangleContext) {
|
|
190
|
-
res = mangleContext.wxmlHandler(res);
|
|
191
|
-
}
|
|
192
|
-
res = escape(res, {
|
|
193
|
-
map: escapeMap,
|
|
194
|
-
ignoreHead
|
|
195
|
-
});
|
|
196
|
-
return res;
|
|
197
|
-
}
|
|
198
3
|
|
|
199
|
-
|
|
200
|
-
var weappTwIgnore = String.raw;
|
|
4
|
+
var _chunkVR7IWN2Zcjs = require('./chunk-VR7IWN2Z.cjs');
|
|
201
5
|
|
|
202
6
|
// src/index.ts
|
|
7
|
+
var _clsx = require('clsx');
|
|
8
|
+
var _tailwindmerge = require('tailwind-merge');
|
|
203
9
|
function cn(...inputs) {
|
|
204
|
-
return replaceWxml(_tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, inputs)));
|
|
205
|
-
}
|
|
206
|
-
function cva(...inputs) {
|
|
207
|
-
const fn = _classvarianceauthority.cva.call(void 0, ...inputs);
|
|
208
|
-
return (...props) => {
|
|
209
|
-
return replaceWxml(fn(...props));
|
|
210
|
-
};
|
|
10
|
+
return _chunkVR7IWN2Zcjs.replaceWxml.call(void 0, _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, inputs)));
|
|
211
11
|
}
|
|
212
12
|
|
|
213
13
|
|
|
214
14
|
|
|
215
|
-
|
|
216
|
-
exports.cn = cn; exports.cva = cva; exports.weappTwIgnore = weappTwIgnore;
|
|
15
|
+
exports.cn = cn; exports.weappTwIgnore = _chunkVR7IWN2Zcjs.weappTwIgnore;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
-
import { cva as cva$1 } from 'class-variance-authority';
|
|
3
1
|
import { ClassValue } from 'clsx';
|
|
4
2
|
export { weappTwIgnore } from 'weapp-tailwindcss/escape';
|
|
5
3
|
|
|
6
4
|
declare function cn(...inputs: ClassValue[]): string;
|
|
7
|
-
declare function cva(...inputs: Parameters<typeof cva$1>): (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
8
5
|
|
|
9
|
-
export { cn
|
|
6
|
+
export { cn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
-
import { cva as cva$1 } from 'class-variance-authority';
|
|
3
1
|
import { ClassValue } from 'clsx';
|
|
4
2
|
export { weappTwIgnore } from 'weapp-tailwindcss/escape';
|
|
5
3
|
|
|
6
4
|
declare function cn(...inputs: ClassValue[]): string;
|
|
7
|
-
declare function cva(...inputs: Parameters<typeof cva$1>): (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
8
5
|
|
|
9
|
-
export { cn
|
|
6
|
+
export { cn };
|
package/dist/index.js
CHANGED
|
@@ -1,216 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
replaceWxml,
|
|
3
|
+
weappTwIgnore
|
|
4
|
+
} from "./chunk-YR5LCHCZ.js";
|
|
5
|
+
|
|
1
6
|
// src/index.ts
|
|
2
|
-
import { cva as _cva } from "class-variance-authority";
|
|
3
7
|
import { clsx } from "clsx";
|
|
4
8
|
import { twMerge } from "tailwind-merge";
|
|
5
|
-
|
|
6
|
-
// ../../node_modules/.pnpm/@weapp-core+escape@3.0.2/node_modules/@weapp-core/escape/dist/index.mjs
|
|
7
|
-
var MappingChars2String = {
|
|
8
|
-
"[": "_bl_",
|
|
9
|
-
"]": "_br_",
|
|
10
|
-
"(": "_pl_",
|
|
11
|
-
")": "_qr_",
|
|
12
|
-
"#": "_h_",
|
|
13
|
-
"!": "_i_",
|
|
14
|
-
"/": "_s_",
|
|
15
|
-
"\\": "_bs_",
|
|
16
|
-
".": "_d_",
|
|
17
|
-
":": "_c_",
|
|
18
|
-
"%": "_p_",
|
|
19
|
-
",": "_co_",
|
|
20
|
-
"'": "_q_",
|
|
21
|
-
'"': "_dq_",
|
|
22
|
-
"*": "_a_",
|
|
23
|
-
"&": "_am_",
|
|
24
|
-
"@": "_at_",
|
|
25
|
-
"{": "_bal_",
|
|
26
|
-
"}": "_bar_",
|
|
27
|
-
// ' ': '_sp_',
|
|
28
|
-
"+": "_plus_",
|
|
29
|
-
// '-': '_m_',
|
|
30
|
-
";": "_se_",
|
|
31
|
-
"<": "_l_",
|
|
32
|
-
"~": "_t_",
|
|
33
|
-
"=": "_e_",
|
|
34
|
-
">": "_g_",
|
|
35
|
-
"?": "_qu_",
|
|
36
|
-
"^": "_ca_",
|
|
37
|
-
"`": "_bq_",
|
|
38
|
-
"|": "_b_",
|
|
39
|
-
"$": "_do_"
|
|
40
|
-
// _: '_u_'
|
|
41
|
-
};
|
|
42
|
-
var MappingChars2StringEntries = Object.entries(MappingChars2String);
|
|
43
|
-
var SimpleMappingChars2String = {
|
|
44
|
-
"[": "_",
|
|
45
|
-
"]": "_",
|
|
46
|
-
"(": "_",
|
|
47
|
-
")": "_",
|
|
48
|
-
"{": "_",
|
|
49
|
-
"}": "_",
|
|
50
|
-
"+": "a",
|
|
51
|
-
",": "b",
|
|
52
|
-
":": "c",
|
|
53
|
-
".": "d",
|
|
54
|
-
"=": "e",
|
|
55
|
-
";": "f",
|
|
56
|
-
">": "g",
|
|
57
|
-
"#": "h",
|
|
58
|
-
"!": "i",
|
|
59
|
-
"@": "j",
|
|
60
|
-
"^": "k",
|
|
61
|
-
"<": "l",
|
|
62
|
-
"*": "m",
|
|
63
|
-
"&": "n",
|
|
64
|
-
"?": "o",
|
|
65
|
-
"%": "p",
|
|
66
|
-
"'": "q",
|
|
67
|
-
"$": "r",
|
|
68
|
-
"/": "s",
|
|
69
|
-
"~": "t",
|
|
70
|
-
"|": "u",
|
|
71
|
-
"`": "v",
|
|
72
|
-
"\\": "w",
|
|
73
|
-
'"': "x"
|
|
74
|
-
};
|
|
75
|
-
var SimpleMappingChars2StringEntries = Object.entries(SimpleMappingChars2String);
|
|
76
|
-
var MAX_ASCII_CHAR_CODE = 127;
|
|
77
|
-
function isPlainObject(value) {
|
|
78
|
-
if (value === null || typeof value !== "object") {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const prototype = Object.getPrototypeOf(value);
|
|
82
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
if (Symbol.iterator in value) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (Symbol.toStringTag in value) {
|
|
89
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
94
|
-
if (!isPlainObject(defaults)) {
|
|
95
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
96
|
-
}
|
|
97
|
-
const object = Object.assign({}, defaults);
|
|
98
|
-
for (const key in baseObject) {
|
|
99
|
-
if (key === "__proto__" || key === "constructor") {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const value = baseObject[key];
|
|
103
|
-
if (value === null || value === void 0) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
110
|
-
object[key] = [...value, ...object[key]];
|
|
111
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
112
|
-
object[key] = _defu(
|
|
113
|
-
value,
|
|
114
|
-
object[key],
|
|
115
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
116
|
-
merger
|
|
117
|
-
);
|
|
118
|
-
} else {
|
|
119
|
-
object[key] = value;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return object;
|
|
123
|
-
}
|
|
124
|
-
function createDefu(merger) {
|
|
125
|
-
return (...arguments_) => (
|
|
126
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
127
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
var defu = createDefu();
|
|
131
|
-
function isAsciiNumber(code) {
|
|
132
|
-
return code >= 48 && code <= 57;
|
|
133
|
-
}
|
|
134
|
-
function handleFirstCharacter(char, nextChar, ignoreHead) {
|
|
135
|
-
if (!ignoreHead) {
|
|
136
|
-
const code = char.codePointAt(0);
|
|
137
|
-
if (isAsciiNumber(code)) {
|
|
138
|
-
return `_${char}`;
|
|
139
|
-
}
|
|
140
|
-
if (char === "-" && nextChar && isAsciiNumber(nextChar.codePointAt(0))) {
|
|
141
|
-
return `_${char}`;
|
|
142
|
-
}
|
|
143
|
-
if (char === "-" && nextChar === void 0) {
|
|
144
|
-
return `_${char}`;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return char;
|
|
148
|
-
}
|
|
149
|
-
function escape(selectors, options) {
|
|
150
|
-
if (selectors.length === 0) {
|
|
151
|
-
return "";
|
|
152
|
-
}
|
|
153
|
-
const { map, ignoreHead } = defu(options, {
|
|
154
|
-
map: SimpleMappingChars2String,
|
|
155
|
-
ignoreHead: false
|
|
156
|
-
});
|
|
157
|
-
const sb = [];
|
|
158
|
-
for (let i = 0; i < selectors.length; i++) {
|
|
159
|
-
const char = selectors[i];
|
|
160
|
-
const code = char.codePointAt(0);
|
|
161
|
-
if (code !== void 0) {
|
|
162
|
-
if (code > MAX_ASCII_CHAR_CODE) {
|
|
163
|
-
sb.push(`u${code.toString(16)}`);
|
|
164
|
-
} else {
|
|
165
|
-
const hit = map[char];
|
|
166
|
-
if (hit) {
|
|
167
|
-
sb.push(hit);
|
|
168
|
-
} else if (i === 0) {
|
|
169
|
-
sb.push(handleFirstCharacter(char, selectors[i + 1], ignoreHead));
|
|
170
|
-
} else {
|
|
171
|
-
sb.push(char);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return sb.join("");
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// ../weapp-tailwindcss/dist/chunk-U7O2XXYR.mjs
|
|
180
|
-
function replaceWxml(original, options = {
|
|
181
|
-
keepEOL: false,
|
|
182
|
-
escapeMap: SimpleMappingChars2String
|
|
183
|
-
}) {
|
|
184
|
-
const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
|
|
185
|
-
let res = original;
|
|
186
|
-
if (!keepEOL) {
|
|
187
|
-
res = res.replaceAll(/[\n\r]+/g, "");
|
|
188
|
-
}
|
|
189
|
-
if (mangleContext) {
|
|
190
|
-
res = mangleContext.wxmlHandler(res);
|
|
191
|
-
}
|
|
192
|
-
res = escape(res, {
|
|
193
|
-
map: escapeMap,
|
|
194
|
-
ignoreHead
|
|
195
|
-
});
|
|
196
|
-
return res;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// ../weapp-tailwindcss/dist/escape.mjs
|
|
200
|
-
var weappTwIgnore = String.raw;
|
|
201
|
-
|
|
202
|
-
// src/index.ts
|
|
203
9
|
function cn(...inputs) {
|
|
204
10
|
return replaceWxml(twMerge(clsx(inputs)));
|
|
205
11
|
}
|
|
206
|
-
function cva(...inputs) {
|
|
207
|
-
const fn = _cva(...inputs);
|
|
208
|
-
return (...props) => {
|
|
209
|
-
return replaceWxml(fn(...props));
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
12
|
export {
|
|
213
13
|
cn,
|
|
214
|
-
cva,
|
|
215
14
|
weappTwIgnore
|
|
216
15
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/merge",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.2",
|
|
5
5
|
"description": "weapp-tailwindcss",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"import": "./dist/index.js",
|
|
22
22
|
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./cva": {
|
|
25
|
+
"types": "./dist/cva.d.ts",
|
|
26
|
+
"import": "./dist/cva.js",
|
|
27
|
+
"require": "./dist/cva.cjs"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"files": [
|
|
@@ -31,7 +36,7 @@
|
|
|
31
36
|
"tailwind-merge": "^2.6.0"
|
|
32
37
|
},
|
|
33
38
|
"devDependencies": {
|
|
34
|
-
"weapp-tailwindcss": "4.0.0-alpha.
|
|
39
|
+
"weapp-tailwindcss": "4.0.0-alpha.5"
|
|
35
40
|
},
|
|
36
41
|
"scripts": {
|
|
37
42
|
"dev": "tsup --watch --sourcemap",
|