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