@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/index.cjs CHANGED
@@ -1,25 +1,23 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
- var _chunkEJHUA3F5cjs = require('./chunk-EJHUA3F5.cjs');
11
-
12
-
13
- var _chunkV4RUVSPVcjs = require('./chunk-V4RUVSPV.cjs');
14
- require('./chunk-PZ4IYNKU.cjs');
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
- exports.create = _chunkEJHUA3F5cjs.create; exports.createTailwindMerge = _chunkEJHUA3F5cjs.createTailwindMerge; exports.extendTailwindMerge = _chunkEJHUA3F5cjs.extendTailwindMerge; exports.getDefaultConfig = _chunkEJHUA3F5cjs.getDefaultConfig; exports.mergeConfigs = _chunkEJHUA3F5cjs.mergeConfigs; exports.tailwindMergeVersion = _chunkEJHUA3F5cjs.tailwindMergeVersion; exports.twJoin = _chunkEJHUA3F5cjs.twJoin; exports.twMerge = _chunkEJHUA3F5cjs.twMerge; exports.weappTwIgnore = _chunkV4RUVSPVcjs.weappTwIgnore;
1
+ let __weapp_tailwindcss_runtime = require("@weapp-tailwindcss/runtime");
2
+ let tailwind_merge = require("tailwind-merge");
3
+
4
+ //#region src/index.ts
5
+ const create = (0, __weapp_tailwindcss_runtime.createRuntimeFactory)({
6
+ createTailwindMerge: tailwind_merge.createTailwindMerge,
7
+ extendTailwindMerge: tailwind_merge.extendTailwindMerge,
8
+ twJoin: tailwind_merge.twJoin,
9
+ twMerge: tailwind_merge.twMerge,
10
+ version: 3
11
+ });
12
+ const { version: tailwindMergeVersion, twMerge, twJoin, extendTailwindMerge, createTailwindMerge } = create();
13
+
14
+ //#endregion
15
+ exports.create = create;
16
+ exports.createTailwindMerge = createTailwindMerge;
17
+ exports.extendTailwindMerge = extendTailwindMerge;
18
+ exports.getDefaultConfig = tailwind_merge.getDefaultConfig;
19
+ exports.mergeConfigs = tailwind_merge.mergeConfigs;
20
+ exports.tailwindMergeVersion = tailwindMergeVersion;
21
+ exports.twJoin = twJoin;
22
+ exports.twMerge = twMerge;
23
+ exports.weappTwIgnore = __weapp_tailwindcss_runtime.weappTwIgnore;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,16 @@
1
- export { create, createTailwindMerge, extendTailwindMerge, tailwindMergeVersion, twJoin, twMerge } from './v4.cjs';
2
- export { C as CreateOptions, E as EscapeConfig, U as UnescapeConfig } from './types-DSXe0vN9.cjs';
3
- export { getDefaultConfig, mergeConfigs } from 'tailwind-merge';
4
- export { weappTwIgnore } from 'weapp-tailwindcss/escape';
5
- export { ClassValue } from 'clsx';
6
- import '@weapp-core/escape';
1
+ import * as _weapp_tailwindcss_runtime0 from "@weapp-tailwindcss/runtime";
2
+ import { ClassValue, CreateOptions, EscapeConfig, UnescapeConfig, weappTwIgnore } from "@weapp-tailwindcss/runtime";
3
+ import * as tailwind_merge0 from "tailwind-merge";
4
+ import { getDefaultConfig, mergeConfigs } from "tailwind-merge";
5
+
6
+ //#region src/index.d.ts
7
+ declare const create: (createOptions?: _weapp_tailwindcss_runtime0.CreateOptions) => {
8
+ version: _weapp_tailwindcss_runtime0.TailwindMergeVersion;
9
+ twMerge: _weapp_tailwindcss_runtime0.TailwindMergeRuntime;
10
+ twJoin: _weapp_tailwindcss_runtime0.TailwindMergeRuntime;
11
+ extendTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge0.ConfigExtension<tailwind_merge0.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge0.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>), ...createConfig: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string)>;
12
+ createTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(createConfigFirst: () => tailwind_merge0.Config<string, string>, ...createConfigRest: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string>;
13
+ };
14
+ declare const tailwindMergeVersion: _weapp_tailwindcss_runtime0.TailwindMergeVersion, twMerge: _weapp_tailwindcss_runtime0.TailwindMergeRuntime, twJoin: _weapp_tailwindcss_runtime0.TailwindMergeRuntime, extendTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge0.ConfigExtension<tailwind_merge0.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge0.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>), ...createConfig: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string)>, createTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(createConfigFirst: () => tailwind_merge0.Config<string, string>, ...createConfigRest: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string>;
15
+ //#endregion
16
+ export { type ClassValue, type CreateOptions, type EscapeConfig, type UnescapeConfig, create, createTailwindMerge, extendTailwindMerge, getDefaultConfig, mergeConfigs, tailwindMergeVersion, twJoin, twMerge, weappTwIgnore };
@@ -0,0 +1,16 @@
1
+ import * as _weapp_tailwindcss_runtime0 from "@weapp-tailwindcss/runtime";
2
+ import { ClassValue, CreateOptions, EscapeConfig, UnescapeConfig, weappTwIgnore } from "@weapp-tailwindcss/runtime";
3
+ import * as tailwind_merge0 from "tailwind-merge";
4
+ import { getDefaultConfig, mergeConfigs } from "tailwind-merge";
5
+
6
+ //#region src/index.d.ts
7
+ declare const create: (createOptions?: _weapp_tailwindcss_runtime0.CreateOptions) => {
8
+ version: _weapp_tailwindcss_runtime0.TailwindMergeVersion;
9
+ twMerge: _weapp_tailwindcss_runtime0.TailwindMergeRuntime;
10
+ twJoin: _weapp_tailwindcss_runtime0.TailwindMergeRuntime;
11
+ extendTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge0.ConfigExtension<tailwind_merge0.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge0.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>), ...createConfig: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string)>;
12
+ createTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(createConfigFirst: () => tailwind_merge0.Config<string, string>, ...createConfigRest: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string>;
13
+ };
14
+ declare const tailwindMergeVersion: _weapp_tailwindcss_runtime0.TailwindMergeVersion, twMerge: _weapp_tailwindcss_runtime0.TailwindMergeRuntime, twJoin: _weapp_tailwindcss_runtime0.TailwindMergeRuntime, extendTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(<AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: tailwind_merge0.ConfigExtension<tailwind_merge0.DefaultClassGroupIds | AdditionalClassGroupIds, tailwind_merge0.DefaultThemeGroupIds | AdditionalThemeGroupIds> | ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>), ...createConfig: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string)>, createTailwindMerge: _weapp_tailwindcss_runtime0.TailwindMergeFactory<(createConfigFirst: () => tailwind_merge0.Config<string, string>, ...createConfigRest: ((config: tailwind_merge0.Config<string, string>) => tailwind_merge0.Config<string, string>)[]) => (...classLists: tailwind_merge0.ClassNameValue[]) => string>;
15
+ //#endregion
16
+ export { type ClassValue, type CreateOptions, type EscapeConfig, type UnescapeConfig, create, createTailwindMerge, extendTailwindMerge, getDefaultConfig, mergeConfigs, tailwindMergeVersion, twJoin, twMerge, weappTwIgnore };
package/dist/index.mjs ADDED
@@ -0,0 +1,15 @@
1
+ import { createRuntimeFactory, weappTwIgnore } from "@weapp-tailwindcss/runtime";
2
+ import { createTailwindMerge as createTailwindMerge$1, extendTailwindMerge as extendTailwindMerge$1, getDefaultConfig, mergeConfigs, twJoin as twJoin$1, twMerge as twMerge$1 } from "tailwind-merge";
3
+
4
+ //#region src/index.ts
5
+ const create = createRuntimeFactory({
6
+ createTailwindMerge: createTailwindMerge$1,
7
+ extendTailwindMerge: extendTailwindMerge$1,
8
+ twJoin: twJoin$1,
9
+ twMerge: twMerge$1,
10
+ version: 3
11
+ });
12
+ const { version: tailwindMergeVersion, twMerge, twJoin, extendTailwindMerge, createTailwindMerge } = create();
13
+
14
+ //#endregion
15
+ export { create, createTailwindMerge, extendTailwindMerge, getDefaultConfig, mergeConfigs, tailwindMergeVersion, twJoin, twMerge, weappTwIgnore };
package/package.json CHANGED
@@ -1,78 +1,63 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/merge",
3
3
  "type": "module",
4
- "version": "2.0.1",
5
- "description": "weapp-tailwindcss",
4
+ "version": "2.1.1",
5
+ "description": "Tailwind Merge v3 的 weapp 运行时封装,自动处理 escape/unescape。",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
8
+ "homepage": "https://tw.icebreaker.top/docs/community/merge/overview",
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "git+https://github.com/sonofmagic/weapp-tailwindcss.git",
11
- "directory": "packages/merge"
12
+ "directory": "packages-runtime/merge"
12
13
  },
13
14
  "bugs": {
14
15
  "url": "https://github.com/sonofmagic/weapp-tailwindcss/issues"
15
16
  },
16
- "keywords": [],
17
+ "keywords": [
18
+ "tailwindcss",
19
+ "merge",
20
+ "mini-program",
21
+ "runtime",
22
+ "v4"
23
+ ],
17
24
  "sideEffects": false,
18
25
  "_exports": {
19
26
  ".": "./src/index.ts"
20
27
  },
21
28
  "exports": {
22
29
  ".": {
23
- "types": "./dist/index.d.ts",
24
- "import": "./dist/index.js",
25
- "require": "./dist/index.cjs"
26
- },
27
- "./cva": {
28
- "types": "./dist/cva.d.ts",
29
- "import": "./dist/cva.js",
30
- "require": "./dist/cva.cjs"
31
- },
32
- "./v3": {
33
- "types": "./dist/v3.d.ts",
34
- "import": "./dist/v3.js",
35
- "require": "./dist/v3.cjs"
36
- },
37
- "./v4": {
38
- "types": "./dist/v4.d.ts",
39
- "import": "./dist/v4.js",
40
- "require": "./dist/v4.cjs"
41
- },
42
- "./variants": {
43
- "types": "./dist/variants.d.ts",
44
- "import": "./dist/variants.js",
45
- "require": "./dist/variants.cjs"
30
+ "import": {
31
+ "types": "./dist/index.d.mts",
32
+ "default": "./dist/index.mjs"
33
+ },
34
+ "require": {
35
+ "types": "./dist/index.d.cts",
36
+ "default": "./dist/index.cjs"
37
+ }
46
38
  }
47
39
  },
48
40
  "main": "./dist/index.cjs",
49
- "module": "./dist/index.js",
50
- "types": "./dist/index.d.ts",
41
+ "module": "./dist/index.mjs",
42
+ "types": "./dist/index.d.mts",
51
43
  "files": [
52
- "dist",
53
- "scripts"
44
+ "dist"
54
45
  ],
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
55
49
  "dependencies": {
56
50
  "@weapp-core/escape": "^5.0.1",
57
- "class-variance-authority": "^0.7.1",
58
- "clsx": "^2.1.1",
59
- "local-pkg": "^1.1.2",
60
- "semver": "^7.7.3",
61
- "tailwind-merge": "^3.3.1",
62
- "tailwind-merge-v2": "npm:tailwind-merge@^2.6.0",
63
- "tailwind-variants": "^3.1.1"
64
- },
65
- "devDependencies": {
66
- "weapp-tailwindcss": "4.7.0"
51
+ "tailwind-merge": "^3.4.0",
52
+ "@weapp-tailwindcss/runtime": "0.1.1"
67
53
  },
68
54
  "scripts": {
69
- "dev": "tsup --watch --sourcemap",
70
- "build": "tsup",
55
+ "dev": "tsdown --watch --sourcemap",
56
+ "build": "tsdown",
71
57
  "test": "vitest run",
72
58
  "test:dev": "vitest",
73
59
  "release": "pnpm publish",
74
60
  "lint": "eslint .",
75
- "lint:fix": "eslint . --fix",
76
- "postinstall": "node scripts/postinstall.mjs"
61
+ "lint:fix": "eslint . --fix"
77
62
  }
78
63
  }
@@ -1,71 +0,0 @@
1
- // src/core/transformers.ts
2
- import {
3
- escape as escapeSelectors,
4
- MappingChars2String,
5
- unescape as unescapeSelectors
6
- } from "@weapp-core/escape";
7
- var identity = (value) => value;
8
- function isConfig(value) {
9
- return typeof value === "object" && value !== null;
10
- }
11
- function mergeWithDefaultMap(map) {
12
- if (!map) {
13
- return void 0;
14
- }
15
- if (map === MappingChars2String) {
16
- return MappingChars2String;
17
- }
18
- return {
19
- ...MappingChars2String,
20
- ...map
21
- };
22
- }
23
- function resolveSharedMap(options) {
24
- const { escape, unescape } = options ?? {};
25
- if (isConfig(escape) && escape.map) {
26
- return mergeWithDefaultMap(escape.map);
27
- }
28
- if (isConfig(unescape) && unescape.map) {
29
- return mergeWithDefaultMap(unescape.map);
30
- }
31
- return MappingChars2String;
32
- }
33
- function resolveTransformers(options) {
34
- const sharedMap = resolveSharedMap(options);
35
- const escapeConfig = options?.escape;
36
- const unescapeConfig = options?.unescape;
37
- const escapeEnabled = escapeConfig !== false;
38
- const unescapeEnabled = unescapeConfig !== false;
39
- let escapeOptions;
40
- if (escapeEnabled) {
41
- if (isConfig(escapeConfig)) {
42
- escapeOptions = {
43
- ...escapeConfig,
44
- map: mergeWithDefaultMap(escapeConfig.map) ?? sharedMap
45
- };
46
- } else {
47
- escapeOptions = { map: sharedMap };
48
- }
49
- }
50
- let unescapeOptions;
51
- if (unescapeEnabled) {
52
- if (isConfig(unescapeConfig)) {
53
- unescapeOptions = {
54
- ...unescapeConfig,
55
- map: mergeWithDefaultMap(unescapeConfig.map) ?? sharedMap
56
- };
57
- } else {
58
- unescapeOptions = { map: sharedMap };
59
- }
60
- }
61
- const escapeFn = escapeEnabled ? (value) => escapeSelectors(value, escapeOptions) : identity;
62
- const unescapeFn = unescapeEnabled ? (value) => unescapeSelectors(value, unescapeOptions) : identity;
63
- return {
64
- escape: escapeFn,
65
- unescape: unescapeFn
66
- };
67
- }
68
-
69
- export {
70
- resolveTransformers
71
- };
@@ -1,53 +0,0 @@
1
- import {
2
- resolveTransformers
3
- } from "./chunk-2KHGHDND.js";
4
-
5
- // ../weapp-tailwindcss/dist/chunk-VSRDBMDB.mjs
6
- import { escape, MappingChars2String } from "@weapp-core/escape";
7
-
8
- // ../weapp-tailwindcss/dist/escape.mjs
9
- import { isAllowedClassName } from "@weapp-core/escape";
10
- var weappTwIgnore = String.raw;
11
-
12
- // src/core/create-runtime.ts
13
- import { clsx } from "clsx";
14
- function wrapClassAggregator(fn, transformers) {
15
- return (...inputs) => {
16
- const normalized = transformers.unescape(clsx(...inputs));
17
- return transformers.escape(fn(normalized));
18
- };
19
- }
20
- function wrapFactory(factory, transformers) {
21
- return (...args) => {
22
- const runtime = factory(...args);
23
- return wrapClassAggregator(runtime, transformers);
24
- };
25
- }
26
- function createRuntimeFactory(options) {
27
- const {
28
- version,
29
- twMerge: _twMerge,
30
- twJoin: _twJoin,
31
- extendTailwindMerge: _extendTailwindMerge,
32
- createTailwindMerge: _createTailwindMerge
33
- } = options;
34
- return function createRuntime(createOptions) {
35
- const transformers = resolveTransformers(createOptions);
36
- const twMerge = wrapClassAggregator(_twMerge, transformers);
37
- const twJoin = wrapClassAggregator(_twJoin, transformers);
38
- const extendTailwindMerge = wrapFactory(_extendTailwindMerge, transformers);
39
- const createTailwindMerge = wrapFactory(_createTailwindMerge, transformers);
40
- return {
41
- version,
42
- twMerge,
43
- twJoin,
44
- extendTailwindMerge,
45
- createTailwindMerge
46
- };
47
- };
48
- }
49
-
50
- export {
51
- weappTwIgnore,
52
- createRuntimeFactory
53
- };
@@ -1,38 +0,0 @@
1
- import {
2
- createRuntimeFactory
3
- } from "./chunk-2VBLBSOS.js";
4
-
5
- // src/v4.ts
6
- import {
7
- createTailwindMerge as _createTailwindMerge,
8
- extendTailwindMerge as _extendTailwindMerge,
9
- twJoin as _twJoin,
10
- twMerge as _twMerge,
11
- getDefaultConfig,
12
- mergeConfigs
13
- } from "tailwind-merge";
14
- var create = createRuntimeFactory({
15
- createTailwindMerge: _createTailwindMerge,
16
- extendTailwindMerge: _extendTailwindMerge,
17
- twJoin: _twJoin,
18
- twMerge: _twMerge,
19
- version: 3
20
- });
21
- var {
22
- version: tailwindMergeVersion,
23
- twMerge,
24
- twJoin,
25
- extendTailwindMerge,
26
- createTailwindMerge
27
- } = create();
28
-
29
- export {
30
- getDefaultConfig,
31
- mergeConfigs,
32
- create,
33
- tailwindMergeVersion,
34
- twMerge,
35
- twJoin,
36
- extendTailwindMerge,
37
- createTailwindMerge
38
- };
@@ -1,38 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkV4RUVSPVcjs = require('./chunk-V4RUVSPV.cjs');
4
-
5
- // src/v4.ts
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
- var _tailwindmerge = require('tailwind-merge');
14
- var create = _chunkV4RUVSPVcjs.createRuntimeFactory.call(void 0, {
15
- createTailwindMerge: _tailwindmerge.createTailwindMerge,
16
- extendTailwindMerge: _tailwindmerge.extendTailwindMerge,
17
- twJoin: _tailwindmerge.twJoin,
18
- twMerge: _tailwindmerge.twMerge,
19
- version: 3
20
- });
21
- var {
22
- version: tailwindMergeVersion,
23
- twMerge,
24
- twJoin,
25
- extendTailwindMerge,
26
- createTailwindMerge
27
- } = create();
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
- exports.getDefaultConfig = _tailwindmerge.getDefaultConfig; exports.mergeConfigs = _tailwindmerge.mergeConfigs; exports.create = create; exports.tailwindMergeVersion = tailwindMergeVersion; exports.twMerge = twMerge; exports.twJoin = twJoin; exports.extendTailwindMerge = extendTailwindMerge; exports.createTailwindMerge = createTailwindMerge;
@@ -1,71 +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; }// src/core/transformers.ts
2
-
3
-
4
-
5
-
6
- var _escape = require('@weapp-core/escape');
7
- var identity = (value) => value;
8
- function isConfig(value) {
9
- return typeof value === "object" && value !== null;
10
- }
11
- function mergeWithDefaultMap(map) {
12
- if (!map) {
13
- return void 0;
14
- }
15
- if (map === _escape.MappingChars2String) {
16
- return _escape.MappingChars2String;
17
- }
18
- return {
19
- ..._escape.MappingChars2String,
20
- ...map
21
- };
22
- }
23
- function resolveSharedMap(options) {
24
- const { escape, unescape } = _nullishCoalesce(options, () => ( {}));
25
- if (isConfig(escape) && escape.map) {
26
- return mergeWithDefaultMap(escape.map);
27
- }
28
- if (isConfig(unescape) && unescape.map) {
29
- return mergeWithDefaultMap(unescape.map);
30
- }
31
- return _escape.MappingChars2String;
32
- }
33
- function resolveTransformers(options) {
34
- const sharedMap = resolveSharedMap(options);
35
- const escapeConfig = _optionalChain([options, 'optionalAccess', _ => _.escape]);
36
- const unescapeConfig = _optionalChain([options, 'optionalAccess', _2 => _2.unescape]);
37
- const escapeEnabled = escapeConfig !== false;
38
- const unescapeEnabled = unescapeConfig !== false;
39
- let escapeOptions;
40
- if (escapeEnabled) {
41
- if (isConfig(escapeConfig)) {
42
- escapeOptions = {
43
- ...escapeConfig,
44
- map: _nullishCoalesce(mergeWithDefaultMap(escapeConfig.map), () => ( sharedMap))
45
- };
46
- } else {
47
- escapeOptions = { map: sharedMap };
48
- }
49
- }
50
- let unescapeOptions;
51
- if (unescapeEnabled) {
52
- if (isConfig(unescapeConfig)) {
53
- unescapeOptions = {
54
- ...unescapeConfig,
55
- map: _nullishCoalesce(mergeWithDefaultMap(unescapeConfig.map), () => ( sharedMap))
56
- };
57
- } else {
58
- unescapeOptions = { map: sharedMap };
59
- }
60
- }
61
- const escapeFn = escapeEnabled ? (value) => _escape.escape.call(void 0, value, escapeOptions) : identity;
62
- const unescapeFn = unescapeEnabled ? (value) => _escape.unescape.call(void 0, value, unescapeOptions) : identity;
63
- return {
64
- escape: escapeFn,
65
- unescape: unescapeFn
66
- };
67
- }
68
-
69
-
70
-
71
- exports.resolveTransformers = resolveTransformers;
@@ -1,53 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkPZ4IYNKUcjs = require('./chunk-PZ4IYNKU.cjs');
4
-
5
- // ../weapp-tailwindcss/dist/chunk-VSRDBMDB.mjs
6
- var _escape = require('@weapp-core/escape');
7
-
8
- // ../weapp-tailwindcss/dist/escape.mjs
9
-
10
- var weappTwIgnore = String.raw;
11
-
12
- // src/core/create-runtime.ts
13
- var _clsx = require('clsx');
14
- function wrapClassAggregator(fn, transformers) {
15
- return (...inputs) => {
16
- const normalized = transformers.unescape(_clsx.clsx.call(void 0, ...inputs));
17
- return transformers.escape(fn(normalized));
18
- };
19
- }
20
- function wrapFactory(factory, transformers) {
21
- return (...args) => {
22
- const runtime = factory(...args);
23
- return wrapClassAggregator(runtime, transformers);
24
- };
25
- }
26
- function createRuntimeFactory(options) {
27
- const {
28
- version,
29
- twMerge: _twMerge,
30
- twJoin: _twJoin,
31
- extendTailwindMerge: _extendTailwindMerge,
32
- createTailwindMerge: _createTailwindMerge
33
- } = options;
34
- return function createRuntime(createOptions) {
35
- const transformers = _chunkPZ4IYNKUcjs.resolveTransformers.call(void 0, createOptions);
36
- const twMerge = wrapClassAggregator(_twMerge, transformers);
37
- const twJoin = wrapClassAggregator(_twJoin, transformers);
38
- const extendTailwindMerge = wrapFactory(_extendTailwindMerge, transformers);
39
- const createTailwindMerge = wrapFactory(_createTailwindMerge, transformers);
40
- return {
41
- version,
42
- twMerge,
43
- twJoin,
44
- extendTailwindMerge,
45
- createTailwindMerge
46
- };
47
- };
48
- }
49
-
50
-
51
-
52
-
53
- exports.weappTwIgnore = weappTwIgnore; exports.createRuntimeFactory = createRuntimeFactory;
package/dist/cva.cjs DELETED
@@ -1,25 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkPZ4IYNKUcjs = require('./chunk-PZ4IYNKU.cjs');
4
-
5
- // src/cva.ts
6
- var _classvarianceauthority = require('class-variance-authority');
7
- function create(options) {
8
- const transformers = _chunkPZ4IYNKUcjs.resolveTransformers.call(void 0, options);
9
- function cva2(base, config) {
10
- const fn = _classvarianceauthority.cva.call(void 0, base, config);
11
- return (...props) => {
12
- const value = fn(...props);
13
- const normalized = transformers.unescape(value);
14
- return transformers.escape(normalized);
15
- };
16
- }
17
- return {
18
- cva: cva2
19
- };
20
- }
21
- var { cva } = create();
22
-
23
-
24
-
25
- exports.create = create; exports.cva = cva;
package/dist/cva.d.cts DELETED
@@ -1,37 +0,0 @@
1
- import * as CLSX from 'clsx';
2
- import { C as CreateOptions } from './types-DSXe0vN9.cjs';
3
- import '@weapp-core/escape';
4
-
5
- type ClassValue = CLSX.ClassValue
6
- type ClassProp = {
7
- class: ClassValue
8
- className?: never
9
- } | {
10
- class?: never
11
- className: ClassValue
12
- } | {
13
- class?: never
14
- className?: never
15
- }
16
- type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
17
-
18
- type ConfigSchema = Record<string, Record<string, ClassValue>>
19
- type ConfigVariants<T extends ConfigSchema> = {
20
- [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
21
- }
22
- type ConfigVariantsMulti<T extends ConfigSchema> = {
23
- [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined;
24
- }
25
- type Config<T> = T extends ConfigSchema ? {
26
- variants?: T
27
- defaultVariants?: ConfigVariants<T>
28
- compoundVariants?: (T extends ConfigSchema ? (ConfigVariants<T> | ConfigVariantsMulti<T>) & ClassProp : ClassProp)[]
29
- } : never
30
- type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp
31
-
32
- declare function create(options?: CreateOptions): {
33
- cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
34
- };
35
- declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
36
-
37
- export { create, cva };
package/dist/cva.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import * as CLSX from 'clsx';
2
- import { C as CreateOptions } from './types-DSXe0vN9.js';
3
- import '@weapp-core/escape';
4
-
5
- type ClassValue = CLSX.ClassValue
6
- type ClassProp = {
7
- class: ClassValue
8
- className?: never
9
- } | {
10
- class?: never
11
- className: ClassValue
12
- } | {
13
- class?: never
14
- className?: never
15
- }
16
- type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
17
-
18
- type ConfigSchema = Record<string, Record<string, ClassValue>>
19
- type ConfigVariants<T extends ConfigSchema> = {
20
- [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
21
- }
22
- type ConfigVariantsMulti<T extends ConfigSchema> = {
23
- [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined;
24
- }
25
- type Config<T> = T extends ConfigSchema ? {
26
- variants?: T
27
- defaultVariants?: ConfigVariants<T>
28
- compoundVariants?: (T extends ConfigSchema ? (ConfigVariants<T> | ConfigVariantsMulti<T>) & ClassProp : ClassProp)[]
29
- } : never
30
- type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp
31
-
32
- declare function create(options?: CreateOptions): {
33
- cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
34
- };
35
- declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
36
-
37
- export { create, cva };