@weapp-tailwindcss/merge 2.0.0 → 2.1.0

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/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,15 +0,0 @@
1
- /* eslint-disable ts/no-require-imports */
2
- const fs = require('node:fs')
3
- const path = require('node:path')
4
-
5
- function main() {
6
- const targetPath = path.resolve(__dirname, '../dist/postinstall.cjs')
7
- if (fs.existsSync(targetPath)) {
8
- require(targetPath)
9
- }
10
- else {
11
- console.log('postinstall.cjs not found')
12
- }
13
- }
14
-
15
- main()