@weapp-tailwindcss/merge 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/v4.d.cts DELETED
@@ -1,23 +0,0 @@
1
- import * as tailwind_merge from 'tailwind-merge';
2
- import { createTailwindMerge as createTailwindMerge$1 } from 'tailwind-merge';
3
- export { getDefaultConfig, mergeConfigs } from 'tailwind-merge';
4
- import { C as CreateOptions, T as TailwindMergeVersion, a as TailwindMergeRuntime, b as TailwindMergeFactory } from './types-DSXe0vN9.cjs';
5
- export { E as EscapeConfig, U as UnescapeConfig } from './types-DSXe0vN9.cjs';
6
- export { ClassValue } from 'clsx';
7
- export { weappTwIgnore } from 'weapp-tailwindcss/escape';
8
- import '@weapp-core/escape';
9
-
10
- declare const create: (createOptions?: CreateOptions) => {
11
- version: TailwindMergeVersion;
12
- twMerge: TailwindMergeRuntime;
13
- twJoin: TailwindMergeRuntime;
14
- extendTailwindMerge: TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge.ConfigExtension<tailwind_merge.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>), ...createConfig: ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>)[]) => (...classLists: tailwind_merge.ClassNameValue[]) => string)>;
15
- createTailwindMerge: TailwindMergeFactory<typeof createTailwindMerge$1>;
16
- };
17
- declare const tailwindMergeVersion: TailwindMergeVersion;
18
- declare const twMerge: TailwindMergeRuntime;
19
- declare const twJoin: TailwindMergeRuntime;
20
- declare const extendTailwindMerge: TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge.ConfigExtension<tailwind_merge.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>), ...createConfig: ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>)[]) => (...classLists: tailwind_merge.ClassNameValue[]) => string)>;
21
- declare const createTailwindMerge: TailwindMergeFactory<typeof createTailwindMerge$1>;
22
-
23
- export { CreateOptions, create, createTailwindMerge, extendTailwindMerge, tailwindMergeVersion, twJoin, twMerge };
package/dist/v4.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import * as tailwind_merge from 'tailwind-merge';
2
- import { createTailwindMerge as createTailwindMerge$1 } from 'tailwind-merge';
3
- export { getDefaultConfig, mergeConfigs } from 'tailwind-merge';
4
- import { C as CreateOptions, T as TailwindMergeVersion, a as TailwindMergeRuntime, b as TailwindMergeFactory } from './types-DSXe0vN9.js';
5
- export { E as EscapeConfig, U as UnescapeConfig } from './types-DSXe0vN9.js';
6
- export { ClassValue } from 'clsx';
7
- export { weappTwIgnore } from 'weapp-tailwindcss/escape';
8
- import '@weapp-core/escape';
9
-
10
- declare const create: (createOptions?: CreateOptions) => {
11
- version: TailwindMergeVersion;
12
- twMerge: TailwindMergeRuntime;
13
- twJoin: TailwindMergeRuntime;
14
- extendTailwindMerge: TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge.ConfigExtension<tailwind_merge.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>), ...createConfig: ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>)[]) => (...classLists: tailwind_merge.ClassNameValue[]) => string)>;
15
- createTailwindMerge: TailwindMergeFactory<typeof createTailwindMerge$1>;
16
- };
17
- declare const tailwindMergeVersion: TailwindMergeVersion;
18
- declare const twMerge: TailwindMergeRuntime;
19
- declare const twJoin: TailwindMergeRuntime;
20
- declare const extendTailwindMerge: TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge.ConfigExtension<tailwind_merge.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>), ...createConfig: ((config: tailwind_merge.Config<string, string>) => tailwind_merge.Config<string, string>)[]) => (...classLists: tailwind_merge.ClassNameValue[]) => string)>;
21
- declare const createTailwindMerge: TailwindMergeFactory<typeof createTailwindMerge$1>;
22
-
23
- export { CreateOptions, create, createTailwindMerge, extendTailwindMerge, tailwindMergeVersion, twJoin, twMerge };
package/dist/v4.js DELETED
@@ -1,25 +0,0 @@
1
- import {
2
- create,
3
- createTailwindMerge,
4
- extendTailwindMerge,
5
- getDefaultConfig,
6
- mergeConfigs,
7
- tailwindMergeVersion,
8
- twJoin,
9
- twMerge
10
- } from "./chunk-7WDGWM6R.js";
11
- import {
12
- weappTwIgnore
13
- } from "./chunk-2VBLBSOS.js";
14
- import "./chunk-2KHGHDND.js";
15
- export {
16
- create,
17
- createTailwindMerge,
18
- extendTailwindMerge,
19
- getDefaultConfig,
20
- mergeConfigs,
21
- tailwindMergeVersion,
22
- twJoin,
23
- twMerge,
24
- weappTwIgnore
25
- };
package/dist/variants.cjs DELETED
@@ -1,76 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkEJHUA3F5cjs = require('./chunk-EJHUA3F5.cjs');
4
- require('./chunk-V4RUVSPV.cjs');
5
-
6
-
7
- var _chunkPZ4IYNKUcjs = require('./chunk-PZ4IYNKU.cjs');
8
-
9
- // src/variants.ts
10
- var _tailwindvariants = require('tailwind-variants');
11
- var _chunkIFWU2MEMjs = require('tailwind-variants/dist/chunk-IFWU2MEM.js');
12
- function createVariantsRuntime(options) {
13
- const transformers = _chunkPZ4IYNKUcjs.resolveTransformers.call(void 0, options);
14
- const tailwindMergeRuntime = _chunkEJHUA3F5cjs.create.call(void 0, options);
15
- let cachedConfig;
16
- let cachedMergeFn = tailwindMergeRuntime.twMerge;
17
- const getMergeFn = (config) => {
18
- if (!config) {
19
- return tailwindMergeRuntime.twMerge;
20
- }
21
- if (config === cachedConfig) {
22
- return cachedMergeFn;
23
- }
24
- cachedConfig = config;
25
- cachedMergeFn = tailwindMergeRuntime.extendTailwindMerge(config);
26
- return cachedMergeFn;
27
- };
28
- const cn2 = (...classes) => {
29
- const aggregated = _tailwindvariants.cnBase.call(void 0, ...classes);
30
- return (config) => {
31
- if (aggregated == null) {
32
- return aggregated;
33
- }
34
- const shouldMerge = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.twMerge]), () => ( true));
35
- if (!shouldMerge) {
36
- const normalized = transformers.unescape(aggregated);
37
- return transformers.escape(normalized);
38
- }
39
- const mergeFn = getMergeFn(_optionalChain([config, 'optionalAccess', _2 => _2.twMergeConfig]));
40
- return mergeFn(aggregated);
41
- };
42
- };
43
- const factory = _chunkIFWU2MEMjs.c.call(void 0, cn2);
44
- const cnBase2 = (...classes) => {
45
- const aggregated = _tailwindvariants.cnBase.call(void 0, ...classes);
46
- if (aggregated == null) {
47
- return aggregated;
48
- }
49
- const normalized = transformers.unescape(aggregated);
50
- return transformers.escape(normalized);
51
- };
52
- return {
53
- cnBase: cnBase2,
54
- cn: cn2,
55
- tv: factory.tv,
56
- createTV: factory.createTV
57
- };
58
- }
59
- function create2(options) {
60
- return createVariantsRuntime(options);
61
- }
62
- var variantsRuntime = create2();
63
- var {
64
- cnBase,
65
- cn,
66
- tv,
67
- createTV
68
- } = variantsRuntime;
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
- exports.cn = cn; exports.cnBase = cnBase; exports.create = create2; exports.createTV = createTV; exports.defaultConfig = _tailwindvariants.defaultConfig; exports.tv = tv;
@@ -1,19 +0,0 @@
1
- import { CnOptions, TWMConfig, CnReturn, cnBase as cnBase$1, TV, createTV as createTV$1 } from 'tailwind-variants';
2
- export { CnOptions, CnReturn, TV, TVConfig, TWMConfig, TWMergeConfig, defaultConfig } from 'tailwind-variants';
3
- import { C as CreateOptions } from './types-DSXe0vN9.cjs';
4
- import '@weapp-core/escape';
5
- import 'clsx';
6
-
7
- type TailwindVariantsCn = <T extends CnOptions>(...classes: T) => (config?: TWMConfig) => CnReturn;
8
- declare function create(options?: CreateOptions): {
9
- cnBase: (...classes: Parameters<typeof cnBase$1>) => string | undefined;
10
- cn: TailwindVariantsCn;
11
- tv: TV;
12
- createTV: typeof createTV$1;
13
- };
14
- declare const cnBase: (...classes: Parameters<typeof cnBase$1>) => string | undefined;
15
- declare const cn: TailwindVariantsCn;
16
- declare const tv: TV;
17
- declare const createTV: typeof createTV$1;
18
-
19
- export { cn, cnBase, create, createTV, tv };
@@ -1,19 +0,0 @@
1
- import { CnOptions, TWMConfig, CnReturn, cnBase as cnBase$1, TV, createTV as createTV$1 } from 'tailwind-variants';
2
- export { CnOptions, CnReturn, TV, TVConfig, TWMConfig, TWMergeConfig, defaultConfig } from 'tailwind-variants';
3
- import { C as CreateOptions } from './types-DSXe0vN9.js';
4
- import '@weapp-core/escape';
5
- import 'clsx';
6
-
7
- type TailwindVariantsCn = <T extends CnOptions>(...classes: T) => (config?: TWMConfig) => CnReturn;
8
- declare function create(options?: CreateOptions): {
9
- cnBase: (...classes: Parameters<typeof cnBase$1>) => string | undefined;
10
- cn: TailwindVariantsCn;
11
- tv: TV;
12
- createTV: typeof createTV$1;
13
- };
14
- declare const cnBase: (...classes: Parameters<typeof cnBase$1>) => string | undefined;
15
- declare const cn: TailwindVariantsCn;
16
- declare const tv: TV;
17
- declare const createTV: typeof createTV$1;
18
-
19
- export { cn, cnBase, create, createTV, tv };
package/dist/variants.js DELETED
@@ -1,76 +0,0 @@
1
- import {
2
- create
3
- } from "./chunk-7WDGWM6R.js";
4
- import "./chunk-2VBLBSOS.js";
5
- import {
6
- resolveTransformers
7
- } from "./chunk-2KHGHDND.js";
8
-
9
- // src/variants.ts
10
- import { defaultConfig, cnBase as tailwindVariantsCnBase } from "tailwind-variants";
11
- import { c as createTailwindVariantsFactory } from "tailwind-variants/dist/chunk-IFWU2MEM.js";
12
- function createVariantsRuntime(options) {
13
- const transformers = resolveTransformers(options);
14
- const tailwindMergeRuntime = create(options);
15
- let cachedConfig;
16
- let cachedMergeFn = tailwindMergeRuntime.twMerge;
17
- const getMergeFn = (config) => {
18
- if (!config) {
19
- return tailwindMergeRuntime.twMerge;
20
- }
21
- if (config === cachedConfig) {
22
- return cachedMergeFn;
23
- }
24
- cachedConfig = config;
25
- cachedMergeFn = tailwindMergeRuntime.extendTailwindMerge(config);
26
- return cachedMergeFn;
27
- };
28
- const cn2 = (...classes) => {
29
- const aggregated = tailwindVariantsCnBase(...classes);
30
- return (config) => {
31
- if (aggregated == null) {
32
- return aggregated;
33
- }
34
- const shouldMerge = config?.twMerge ?? true;
35
- if (!shouldMerge) {
36
- const normalized = transformers.unescape(aggregated);
37
- return transformers.escape(normalized);
38
- }
39
- const mergeFn = getMergeFn(config?.twMergeConfig);
40
- return mergeFn(aggregated);
41
- };
42
- };
43
- const factory = createTailwindVariantsFactory(cn2);
44
- const cnBase2 = (...classes) => {
45
- const aggregated = tailwindVariantsCnBase(...classes);
46
- if (aggregated == null) {
47
- return aggregated;
48
- }
49
- const normalized = transformers.unescape(aggregated);
50
- return transformers.escape(normalized);
51
- };
52
- return {
53
- cnBase: cnBase2,
54
- cn: cn2,
55
- tv: factory.tv,
56
- createTV: factory.createTV
57
- };
58
- }
59
- function create2(options) {
60
- return createVariantsRuntime(options);
61
- }
62
- var variantsRuntime = create2();
63
- var {
64
- cnBase,
65
- cn,
66
- tv,
67
- createTV
68
- } = variantsRuntime;
69
- export {
70
- cn,
71
- cnBase,
72
- create2 as create,
73
- createTV,
74
- defaultConfig,
75
- tv
76
- };
@@ -1,83 +0,0 @@
1
- import { existsSync as defaultExistsSync } from 'node:fs'
2
- import { createRequire } from 'node:module'
3
- import path from 'node:path'
4
- import process from 'node:process'
5
- import { fileURLToPath, pathToFileURL } from 'node:url'
6
-
7
- const requireFn = createRequire(import.meta.url)
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
-
10
- /**
11
- * @param {object} [options]
12
- * @param {(path: string) => boolean} [options.existsSync]
13
- * @param {(path: string) => Promise<unknown>} [options.loadEsm]
14
- * @param {(path: string) => unknown | Promise<unknown>} [options.loadCjs]
15
- * @param {{ log: typeof console.log, error: typeof console.error }} [options.logger]
16
- */
17
- export async function run(options = {}) {
18
- const {
19
- existsSync = defaultExistsSync,
20
- loadEsm = async filePath => import(pathToFileURL(filePath).href),
21
- loadCjs = filePath => requireFn(filePath),
22
- logger = console,
23
- } = options
24
-
25
- const esmPath = path.resolve(__dirname, '../dist/postinstall.js')
26
- const cjsPath = path.resolve(__dirname, '../dist/postinstall.cjs')
27
-
28
- const hasEsm = existsSync(esmPath)
29
- const hasCjs = existsSync(cjsPath)
30
-
31
- const loadErrors = []
32
-
33
- if (hasEsm) {
34
- try {
35
- await loadEsm(esmPath)
36
- return
37
- }
38
- catch (error) {
39
- loadErrors.push(error)
40
- }
41
- }
42
-
43
- if (hasCjs) {
44
- try {
45
- await loadCjs(cjsPath)
46
- return
47
- }
48
- catch (error) {
49
- loadErrors.push(error)
50
- }
51
- }
52
-
53
- if (!hasEsm && !hasCjs) {
54
- logger.log('postinstall bundle not found')
55
- return
56
- }
57
-
58
- logger.error('Failed to load postinstall bundle.')
59
- for (const error of loadErrors) {
60
- logger.error(error)
61
- }
62
- process.exitCode = process.exitCode ?? 1
63
- }
64
-
65
- const entryUrl = (() => {
66
- const candidate = process.argv[1]
67
- if (!candidate) {
68
- return undefined
69
- }
70
- try {
71
- return pathToFileURL(candidate).href
72
- }
73
- catch {
74
- return undefined
75
- }
76
- })()
77
-
78
- if (entryUrl === import.meta.url) {
79
- run().catch((error) => {
80
- console.error('Failed to execute postinstall entry.', error)
81
- process.exitCode = process.exitCode ?? 1
82
- })
83
- }