weapp-tailwindcss 2.3.3

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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +674 -0
  3. package/bin/weapp-tailwindcss.js +7 -0
  4. package/dist/babel/index.d.ts +4 -0
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +26 -0
  7. package/dist/cli.mjs +24 -0
  8. package/dist/constants.d.ts +6 -0
  9. package/dist/defaults.d.ts +2 -0
  10. package/dist/dic.d.ts +44 -0
  11. package/dist/env.d.ts +2 -0
  12. package/dist/escape.d.ts +3 -0
  13. package/dist/extractors/split.d.ts +3 -0
  14. package/dist/gulp/index.d.ts +8 -0
  15. package/dist/gulp.d.ts +1 -0
  16. package/dist/gulp.js +86 -0
  17. package/dist/gulp.mjs +78 -0
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.js +31 -0
  20. package/dist/index.mjs +21 -0
  21. package/dist/js/index.d.ts +5 -0
  22. package/dist/mangle/store.d.ts +15 -0
  23. package/dist/options-3a695e84.js +574 -0
  24. package/dist/options-ed6f4a3a.mjs +542 -0
  25. package/dist/options.d.ts +4 -0
  26. package/dist/postcss/index.d.ts +3 -0
  27. package/dist/postcss/mp.d.ts +4 -0
  28. package/dist/postcss/plugin.d.ts +6 -0
  29. package/dist/postcss/preflight.d.ts +3 -0
  30. package/dist/postcss/selectorParser.d.ts +3 -0
  31. package/dist/postcss/shared.d.ts +1 -0
  32. package/dist/postcss-1f9a5153.mjs +105 -0
  33. package/dist/postcss-dc9eeafc.js +114 -0
  34. package/dist/postcss.d.ts +1 -0
  35. package/dist/postcss.js +22 -0
  36. package/dist/postcss.mjs +6 -0
  37. package/dist/reg.d.ts +26 -0
  38. package/dist/replace.d.ts +4 -0
  39. package/dist/replace.js +36 -0
  40. package/dist/replace.mjs +27 -0
  41. package/dist/shared-c2953d9d.js +354 -0
  42. package/dist/shared-eae1dc7a.mjs +333 -0
  43. package/dist/tailwindcss/patcher.d.ts +8 -0
  44. package/dist/tailwindcss/supportCustomUnit.d.ts +6 -0
  45. package/dist/types.d.ts +118 -0
  46. package/dist/utils.d.ts +9 -0
  47. package/dist/vite/index.d.ts +3 -0
  48. package/dist/vite.d.ts +1 -0
  49. package/dist/vite.js +82 -0
  50. package/dist/vite.mjs +78 -0
  51. package/dist/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
  52. package/dist/webpack/index.d.ts +1 -0
  53. package/dist/webpack.d.ts +1 -0
  54. package/dist/webpack.js +101 -0
  55. package/dist/webpack.mjs +97 -0
  56. package/dist/wxml/index.d.ts +3 -0
  57. package/dist/wxml/shared.d.ts +2 -0
  58. package/dist/wxml/utils.d.ts +7 -0
  59. package/package.json +224 -0
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ var selectorParser = require('postcss-selector-parser');
4
+ var shared = require('./shared-c2953d9d.js');
5
+ var postcss = require('postcss');
6
+ require('@csstools/postcss-is-pseudo-class');
7
+
8
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var selectorParser__default = /*#__PURE__*/_interopDefaultCompat(selectorParser);
11
+
12
+ const createTransform = (rule, options) => {
13
+ const replaceFlag = options.replaceUniversalSelectorWith !== false;
14
+ const transform = (selectors) => {
15
+ selectors.walk((selector) => {
16
+ if (selector.type === 'universal' && replaceFlag) {
17
+ selector.value = options.replaceUniversalSelectorWith;
18
+ }
19
+ if (selector.type === 'selector') {
20
+ const node = selector.nodes.find((x) => x.type === 'pseudo' && x.value === ':hover');
21
+ node && selector.remove();
22
+ }
23
+ if (selector.type === 'class') {
24
+ selector.value = shared.internalCssSelectorReplacer(selector.value, options.escapeMap);
25
+ }
26
+ });
27
+ if (selectors.length === 0) {
28
+ rule.remove();
29
+ }
30
+ };
31
+ return transform;
32
+ };
33
+ const getTransformer = (rule, options) => {
34
+ return selectorParser__default["default"](createTransform(rule, options));
35
+ };
36
+ const transformSync = (rule, options) => {
37
+ const transformer = getTransformer(rule, options);
38
+ return transformer.transformSync(rule, {
39
+ lossless: false,
40
+ updateSelector: true
41
+ });
42
+ };
43
+
44
+ const PATTERNS = [/:not\(template\)\s*~\s*:not\(template\)/.source, /:not\(\[hidden\]\)\s*~\s*:not\(\[hidden\]\)/.source].join('|');
45
+ const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
46
+ function testIfVariablesScope(node, count = 1) {
47
+ if (/:?:before/.test(node.selector) && /:?:after/.test(node.selector)) {
48
+ for (let i = 0; i < count; i++) {
49
+ const tryTestDecl = node.nodes[i];
50
+ if (tryTestDecl && tryTestDecl.type === 'decl' && tryTestDecl.prop.startsWith('--tw-')) {
51
+ continue;
52
+ }
53
+ else {
54
+ return false;
55
+ }
56
+ }
57
+ return true;
58
+ }
59
+ return false;
60
+ }
61
+ function commonChunkPreflight(node, options) {
62
+ node.selector = node.selector.replace(BROAD_MATCH_GLOBAL_REGEXP, 'view + view');
63
+ if (testIfVariablesScope(node)) {
64
+ const selectorParts = node.selector.split(',');
65
+ if (!selectorParts.includes('view')) {
66
+ selectorParts.push('view');
67
+ }
68
+ if (options.cssPreflightRange === 'all') {
69
+ if (!selectorParts.includes(':not(not)')) {
70
+ selectorParts.push(':not(not)');
71
+ }
72
+ }
73
+ node.selector = selectorParts.join(',');
74
+ if (typeof options.cssInjectPreflight === 'function') {
75
+ node.append(...options.cssInjectPreflight());
76
+ }
77
+ const pseudoVarRule = new postcss.Rule({
78
+ selector: '::before,::after'
79
+ });
80
+ pseudoVarRule.append(new postcss.Declaration({
81
+ prop: '--tw-content',
82
+ value: '""'
83
+ }));
84
+ node.before(pseudoVarRule);
85
+ }
86
+ }
87
+
88
+ const NS = 'jsx-rename-loader';
89
+ const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin';
90
+ const pluginName = 'weapp-tailwindcss-webpack-plugin';
91
+ const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
92
+
93
+ const postcssWeappTailwindcss = (options = {
94
+ isMainChunk: true
95
+ }) => {
96
+ const { customRuleCallback, isMainChunk } = options;
97
+ const flag = typeof customRuleCallback === 'function';
98
+ return {
99
+ postcssPlugin,
100
+ Once(css) {
101
+ css.walkRules((rule) => {
102
+ transformSync(rule, options);
103
+ isMainChunk && commonChunkPreflight(rule, options);
104
+ flag && customRuleCallback(rule, options);
105
+ });
106
+ }
107
+ };
108
+ };
109
+ postcssWeappTailwindcss.postcss = true;
110
+
111
+ exports.NS = NS;
112
+ exports.pluginName = pluginName;
113
+ exports.postcssWeappTailwindcss = postcssWeappTailwindcss;
114
+ exports.vitePluginName = vitePluginName;
@@ -0,0 +1 @@
1
+ export * from './postcss/plugin';
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var postcss = require('./postcss-dc9eeafc.js');
6
+ var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
7
+ require('postcss-selector-parser');
8
+ require('./shared-c2953d9d.js');
9
+ require('tailwindcss-mangle-shared');
10
+ require('postcss');
11
+
12
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIsPseudoClass);
15
+
16
+
17
+
18
+ exports.postcssWeappTailwindcss = postcss.postcssWeappTailwindcss;
19
+ Object.defineProperty(exports, 'postcssIsPseudoClass', {
20
+ enumerable: true,
21
+ get: function () { return postcssIsPseudoClass__default["default"]; }
22
+ });
@@ -0,0 +1,6 @@
1
+ export { p as postcssWeappTailwindcss } from './postcss-1f9a5153.mjs';
2
+ export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
3
+ import 'postcss-selector-parser';
4
+ import './shared-eae1dc7a.mjs';
5
+ import 'tailwindcss-mangle-shared';
6
+ import 'postcss';
package/dist/reg.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import type { ICustomRegexp, ItemOrItemArray } from "./types";
2
+ export declare function escapeStringRegexp(str: string): string;
3
+ export declare const templateClassExactRegexp: RegExp;
4
+ export declare const tagWithEitherClassAndHoverClassRegexp: RegExp;
5
+ interface ICreateRegexpOptions {
6
+ exact?: boolean;
7
+ }
8
+ export declare function handleRegexp(reg: RegExp): string;
9
+ export declare function getSourceString(input: string | RegExp): string;
10
+ export declare function makePattern(arr: ItemOrItemArray<string | RegExp>): string;
11
+ export declare function createTempleteHandlerMatchRegexp(tag: string | RegExp, attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
12
+ export declare function createTemplateClassRegexp(attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
13
+ export declare function makeCustomAttributes(entries?: [string | RegExp, ItemOrItemArray<string | RegExp>][]): ICustomRegexp[] | undefined;
14
+ export declare const variableRegExp: RegExp;
15
+ export declare function variableMatch(original: string): RegExpExecArray | null;
16
+ export declare const classRegexp: RegExp;
17
+ export declare const vueTemplateClassRegexp: RegExp;
18
+ export declare const tagRegexp: RegExp;
19
+ export declare const tagWithClassRegexp: RegExp;
20
+ export declare function classStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
21
+ export declare function tagStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
22
+ export declare const wxmlAllowClassCharsRegExp: RegExp;
23
+ export declare function createWxmlAllowClassCharsRegExp(): RegExp;
24
+ export declare const doubleQuoteRegexp: RegExp;
25
+ export declare function doubleQuoteStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
26
+ export {};
@@ -0,0 +1,4 @@
1
+ import { replaceWxml as replaceJs } from './wxml/shared';
2
+ import { internalCssSelectorReplacer as replaceCss } from './postcss/shared';
3
+ export * from './dic';
4
+ export { replaceJs, replaceCss };
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var shared = require('./shared-c2953d9d.js');
6
+ require('tailwindcss-mangle-shared');
7
+
8
+ function replaceWxml(original, options = {
9
+ keepEOL: false,
10
+ escapeMap: shared.SimpleMappingChars2String
11
+ }) {
12
+ if (typeof options === 'boolean') {
13
+ options = {
14
+ keepEOL: options
15
+ };
16
+ }
17
+ let res = original;
18
+ if (!options.keepEOL) {
19
+ res = res
20
+ .replace(/[\r\n]+/g, '');
21
+ }
22
+ const { wxmlHandler } = shared.useStore();
23
+ res = wxmlHandler(res);
24
+ res = shared.escape(res, {
25
+ map: options.escapeMap
26
+ });
27
+ return res;
28
+ }
29
+
30
+ exports.MappingChars2String = shared.MappingChars2String;
31
+ exports.MappingChars2StringEntries = shared.MappingChars2StringEntries;
32
+ exports.SYMBOL_TABLE = shared.SYMBOL_TABLE;
33
+ exports.SimpleMappingChars2String = shared.SimpleMappingChars2String;
34
+ exports.SimpleMappingChars2StringEntries = shared.SimpleMappingChars2StringEntries;
35
+ exports.replaceCss = shared.internalCssSelectorReplacer;
36
+ exports.replaceJs = replaceWxml;
@@ -0,0 +1,27 @@
1
+ import { h as escape, S as SimpleMappingChars2String, u as useStore } from './shared-eae1dc7a.mjs';
2
+ export { M as MappingChars2String, k as MappingChars2StringEntries, j as SYMBOL_TABLE, l as SimpleMappingChars2StringEntries, f as replaceCss } from './shared-eae1dc7a.mjs';
3
+ import 'tailwindcss-mangle-shared';
4
+
5
+ function replaceWxml(original, options = {
6
+ keepEOL: false,
7
+ escapeMap: SimpleMappingChars2String
8
+ }) {
9
+ if (typeof options === 'boolean') {
10
+ options = {
11
+ keepEOL: options
12
+ };
13
+ }
14
+ let res = original;
15
+ if (!options.keepEOL) {
16
+ res = res
17
+ .replace(/[\r\n]+/g, '');
18
+ }
19
+ const { wxmlHandler } = useStore();
20
+ res = wxmlHandler(res);
21
+ res = escape(res, {
22
+ map: options.escapeMap
23
+ });
24
+ return res;
25
+ }
26
+
27
+ export { SimpleMappingChars2String, replaceWxml as replaceJs };
@@ -0,0 +1,354 @@
1
+ 'use strict';
2
+
3
+ var tailwindcssMangleShared = require('tailwindcss-mangle-shared');
4
+
5
+ function isRegexp(value) {
6
+ return Object.prototype.toString.call(value) === '[object RegExp]';
7
+ }
8
+ function isMap(value) {
9
+ return Object.prototype.toString.call(value) === '[object Map]';
10
+ }
11
+ const noop = () => { };
12
+ function groupBy(arr, cb) {
13
+ if (!Array.isArray(arr)) {
14
+ throw new Error('expected an array for first argument');
15
+ }
16
+ if (typeof cb !== 'function') {
17
+ throw new Error('expected a function for second argument');
18
+ }
19
+ const result = {};
20
+ for (let i = 0; i < arr.length; i++) {
21
+ const item = arr[i];
22
+ const bucketCategory = cb(item);
23
+ const bucket = result[bucketCategory];
24
+ if (!Array.isArray(bucket)) {
25
+ result[bucketCategory] = [item];
26
+ }
27
+ else {
28
+ result[bucketCategory].push(item);
29
+ }
30
+ }
31
+ return result;
32
+ }
33
+ function getGroupedEntries(entries, options) {
34
+ const { cssMatcher, htmlMatcher, jsMatcher } = options;
35
+ const groupedEntries = groupBy(entries, ([file]) => {
36
+ if (cssMatcher(file)) {
37
+ return 'css';
38
+ }
39
+ else if (htmlMatcher(file)) {
40
+ return 'html';
41
+ }
42
+ else if (jsMatcher(file)) {
43
+ return 'js';
44
+ }
45
+ else {
46
+ return 'other';
47
+ }
48
+ });
49
+ return groupedEntries;
50
+ }
51
+
52
+ const SYMBOL_TABLE = {
53
+ BACKQUOTE: '`',
54
+ TILDE: '~',
55
+ EXCLAM: '!',
56
+ AT: '@',
57
+ NUMBERSIGN: '#',
58
+ DOLLAR: '$',
59
+ PERCENT: '%',
60
+ CARET: '^',
61
+ AMPERSAND: '&',
62
+ ASTERISK: '*',
63
+ PARENLEFT: '(',
64
+ PARENRIGHT: ')',
65
+ MINUS: '-',
66
+ UNDERSCORE: '_',
67
+ EQUAL: '=',
68
+ PLUS: '+',
69
+ BRACKETLEFT: '[',
70
+ BRACELEFT: '{',
71
+ BRACKETRIGHT: ']',
72
+ BRACERIGHT: '}',
73
+ SEMICOLON: ';',
74
+ COLON: ':',
75
+ QUOTE: "'",
76
+ DOUBLEQUOTE: '"',
77
+ BACKSLASH: '\\',
78
+ BAR: '|',
79
+ COMMA: ',',
80
+ LESS: '<',
81
+ PERIOD: '.',
82
+ GREATER: '>',
83
+ SLASH: '/',
84
+ QUESTION: '?',
85
+ SPACE: ' ',
86
+ DOT: '.',
87
+ HASH: '#'
88
+ };
89
+ const MappingChars2String = {
90
+ '[': '_bl_',
91
+ ']': '_br_',
92
+ '(': '_pl_',
93
+ ')': '_qr_',
94
+ '#': '_h_',
95
+ '!': '_i_',
96
+ '/': '_s_',
97
+ '\\': '_bs_',
98
+ '.': '_d_',
99
+ ':': '_c_',
100
+ '%': '_p_',
101
+ ',': '_co_',
102
+ "'": '_q_',
103
+ '"': '_dq_',
104
+ '*': '_a_',
105
+ '&': '_am_',
106
+ '@': '_at_',
107
+ '{': '_bal_',
108
+ '}': '_bar_',
109
+ '+': '_plus_',
110
+ ';': '_se_',
111
+ '<': '_l_',
112
+ '~': '_t_',
113
+ '=': '_e_',
114
+ '>': '_g_',
115
+ '?': '_qu_',
116
+ '^': '_ca_',
117
+ '`': '_bq_',
118
+ '|': '_b_',
119
+ $: '_do_'
120
+ };
121
+ const MappingChars2StringEntries = Object.entries(MappingChars2String);
122
+ const SimpleMappingChars2String = {
123
+ '[': '_',
124
+ ']': '_',
125
+ '(': '_',
126
+ ')': '_',
127
+ '{': '_',
128
+ '}': '_',
129
+ '+': 'a',
130
+ ',': 'b',
131
+ ':': 'c',
132
+ '.': 'd',
133
+ '=': 'e',
134
+ ';': 'f',
135
+ '>': 'g',
136
+ '#': 'h',
137
+ '!': 'i',
138
+ '@': 'j',
139
+ '^': 'k',
140
+ '<': 'l',
141
+ '*': 'm',
142
+ '&': 'n',
143
+ '?': 'o',
144
+ '%': 'p',
145
+ "'": 'q',
146
+ $: 'r',
147
+ '/': 's',
148
+ '~': 't',
149
+ '|': 'u',
150
+ '`': 'v',
151
+ '\\': 'w',
152
+ '"': 'x'
153
+ };
154
+ const SimpleMappingChars2StringEntries = Object.entries(SimpleMappingChars2String);
155
+
156
+ function escape(selectors, options = {
157
+ map: SimpleMappingChars2String
158
+ }) {
159
+ const { map = SimpleMappingChars2String } = options;
160
+ const sb = selectors.split('');
161
+ for (let i = 0; i < sb.length; i++) {
162
+ const char = sb[i];
163
+ const code = char.charCodeAt(0);
164
+ if (code > 127) {
165
+ sb[i] = 'u' + Number(code).toString(16);
166
+ }
167
+ else {
168
+ const hit = map[char];
169
+ if (hit) {
170
+ sb[i] = hit;
171
+ }
172
+ }
173
+ }
174
+ const res = sb.join('');
175
+ return res;
176
+ }
177
+
178
+ const validateFilterRE = /[\w\u00A0-\uFFFF-_:%-?]/;
179
+ function isValidSelector(selector = '') {
180
+ return validateFilterRE.test(selector);
181
+ }
182
+ const splitCode = (code) => {
183
+ return code.split(/[\s]+/).filter(isValidSelector);
184
+ };
185
+
186
+ function escapeStringRegexp(str) {
187
+ if (typeof str !== 'string') {
188
+ throw new TypeError('Expected a string');
189
+ }
190
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
191
+ }
192
+ const templateClassExactRegexp = /(?:(?<=^|\s)(?:hover-)?class)=(?:["']\W+\s*(?:\w+)\()?["']([^"]+)['"]/gs;
193
+ const tagWithEitherClassAndHoverClassRegexp = /<(?:[a-z][-a-z]*[a-z]*)\s+[^>]*?(?:(?:hover-)?class="(?:[^"]*)")[^>]*?\/?>/g;
194
+ function handleRegexp(reg) {
195
+ return `(?:${reg.source})`;
196
+ }
197
+ function getSourceString(input) {
198
+ let result;
199
+ if (typeof input === 'string') {
200
+ result = input;
201
+ }
202
+ else if (isRegexp(input)) {
203
+ result = input.source;
204
+ }
205
+ else {
206
+ result = input.toString();
207
+ }
208
+ return result;
209
+ }
210
+ function makePattern(arr) {
211
+ let pattern = '';
212
+ if (Array.isArray(arr)) {
213
+ pattern = arr
214
+ .reduce((acc, cur) => {
215
+ if (typeof cur === 'string') {
216
+ acc.push(cur);
217
+ }
218
+ else if (isRegexp(cur)) {
219
+ acc.push(handleRegexp(cur));
220
+ }
221
+ return acc;
222
+ }, [])
223
+ .join('|');
224
+ }
225
+ else if (typeof arr === 'string') {
226
+ pattern = arr;
227
+ }
228
+ else if (isRegexp(arr)) {
229
+ pattern = handleRegexp(arr);
230
+ }
231
+ return pattern;
232
+ }
233
+ function createTempleteHandlerMatchRegexp(tag, attrs, options = {}) {
234
+ const { exact = true } = options;
235
+ const prefix = exact ? '(?<=^|\\s)' : '';
236
+ const pattern = makePattern(attrs);
237
+ let tagPattern = getSourceString(tag);
238
+ if (tagPattern === '*') {
239
+ tagPattern = '[a-z][-a-z]*[a-z]*';
240
+ }
241
+ const source = `<(${tagPattern})\\s+[^>]*?(?:${prefix}(${pattern})="(?:[^"]*)")[^>]*?\\/?>`;
242
+ return new RegExp(source, 'g');
243
+ }
244
+ function createTemplateClassRegexp(attrs, options = {}) {
245
+ const { exact = true } = options;
246
+ const prefix = exact ? '(?<=^|\\s)' : '';
247
+ const pattern = makePattern(attrs);
248
+ const source = `(?:${prefix}${pattern})=(?:["']\\W+\\s*(?:\\w+)\\()?["']([^"]+)['"]`;
249
+ return new RegExp(source, 'gs');
250
+ }
251
+ function makeCustomAttributes(entries) {
252
+ if (Array.isArray(entries)) {
253
+ return entries.map(([k, v]) => {
254
+ return {
255
+ tagRegexp: createTempleteHandlerMatchRegexp(k, v),
256
+ attrRegexp: createTemplateClassRegexp(v),
257
+ tag: getSourceString(k),
258
+ attrs: v
259
+ };
260
+ });
261
+ }
262
+ }
263
+ const variableRegExp = /{{(.*?)}}/gs;
264
+ function variableMatch(original) {
265
+ return variableRegExp.exec(original);
266
+ }
267
+
268
+ function getSelf(x) {
269
+ return x;
270
+ }
271
+ const defaultScopedStore = {
272
+ rawOptions: false,
273
+ runtimeSet: new Set(),
274
+ classGenerator: new tailwindcssMangleShared.ClassGenerator(),
275
+ filter: tailwindcssMangleShared.defaultMangleClassFilter,
276
+ cssHandler: getSelf,
277
+ jsHandler: getSelf,
278
+ wxmlHandler: getSelf
279
+ };
280
+ const store = Object.assign({}, defaultScopedStore);
281
+ function useStore() {
282
+ return store;
283
+ }
284
+ function handleValue(rawSource) {
285
+ const arr = splitCode(rawSource);
286
+ for (let i = 0; i < arr.length; i++) {
287
+ const x = arr[i];
288
+ if (store.runtimeSet.has(x)) {
289
+ rawSource = rawSource.replace(new RegExp(escapeStringRegexp(x), 'g'), store.classGenerator.generateClassName(x).name);
290
+ }
291
+ }
292
+ return rawSource;
293
+ }
294
+ function initStore(options) {
295
+ var _a;
296
+ store.rawOptions = options;
297
+ if (options) {
298
+ if (options === true) {
299
+ options = {
300
+ classGenerator: {},
301
+ mangleClassFilter: tailwindcssMangleShared.defaultMangleClassFilter
302
+ };
303
+ }
304
+ store.classGenerator = new tailwindcssMangleShared.ClassGenerator(options.classGenerator);
305
+ store.filter = (_a = options.mangleClassFilter) !== null && _a !== void 0 ? _a : tailwindcssMangleShared.defaultMangleClassFilter;
306
+ store.jsHandler = (rawSource) => {
307
+ return handleValue(rawSource);
308
+ };
309
+ store.cssHandler = (rawSource) => {
310
+ return handleValue(rawSource);
311
+ };
312
+ store.wxmlHandler = (rawSource) => {
313
+ return handleValue(rawSource);
314
+ };
315
+ }
316
+ }
317
+ function setRuntimeSet(runtimeSet) {
318
+ const newSet = new Set();
319
+ runtimeSet.forEach((c) => {
320
+ if (store.filter(c)) {
321
+ newSet.add(c);
322
+ }
323
+ });
324
+ store.runtimeSet = newSet;
325
+ }
326
+
327
+ function internalCssSelectorReplacer(selectors, map = SimpleMappingChars2String) {
328
+ const { cssHandler } = useStore();
329
+ selectors = cssHandler(selectors);
330
+ return escape(selectors, {
331
+ map
332
+ });
333
+ }
334
+
335
+ exports.MappingChars2String = MappingChars2String;
336
+ exports.MappingChars2StringEntries = MappingChars2StringEntries;
337
+ exports.SYMBOL_TABLE = SYMBOL_TABLE;
338
+ exports.SimpleMappingChars2String = SimpleMappingChars2String;
339
+ exports.SimpleMappingChars2StringEntries = SimpleMappingChars2StringEntries;
340
+ exports.escape = escape;
341
+ exports.escapeStringRegexp = escapeStringRegexp;
342
+ exports.getGroupedEntries = getGroupedEntries;
343
+ exports.initStore = initStore;
344
+ exports.internalCssSelectorReplacer = internalCssSelectorReplacer;
345
+ exports.isMap = isMap;
346
+ exports.makeCustomAttributes = makeCustomAttributes;
347
+ exports.noop = noop;
348
+ exports.setRuntimeSet = setRuntimeSet;
349
+ exports.splitCode = splitCode;
350
+ exports.tagWithEitherClassAndHoverClassRegexp = tagWithEitherClassAndHoverClassRegexp;
351
+ exports.templateClassExactRegexp = templateClassExactRegexp;
352
+ exports.useStore = useStore;
353
+ exports.variableMatch = variableMatch;
354
+ exports.variableRegExp = variableRegExp;