@weapp-tailwindcss/cn 0.1.0 → 0.1.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.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +5 -2
- package/dist/index.d.mts +5 -2
- package/dist/index.mjs +8 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> English | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
基于 npm `cn` 引擎的面向小程序 Tailwind CSS 类名组合工具,兼容条件类名、嵌套数组、Tailwind 冲突合并和 `rpx`
|
|
5
|
+
基于 npm `cn` 引擎的面向小程序 Tailwind CSS 类名组合工具,兼容条件类名、嵌套数组、Tailwind 冲突合并和 `rpx` 任意值。`text` / `border` / `bg` / `outline` / `ring` 的 rpx 长度会与颜色类共存,例如 `cn('text-red', 'text-[80rpx]')`。
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { cn } from '@weapp-tailwindcss/cn'
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> [English](./README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
基于 npm `cn` 引擎的面向小程序 Tailwind CSS 类名组合工具,兼容条件类名、嵌套数组、Tailwind 冲突合并和 `rpx`
|
|
5
|
+
基于 npm `cn` 引擎的面向小程序 Tailwind CSS 类名组合工具,兼容条件类名、嵌套数组、Tailwind 冲突合并和 `rpx` 任意值。`text` / `border` / `bg` / `outline` / `ring` 的 rpx 长度会与颜色类共存,例如 `cn('text-red', 'text-[80rpx]')`。
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { cn } from '@weapp-tailwindcss/cn'
|
package/dist/index.cjs
CHANGED
|
@@ -3,11 +3,11 @@ let _weapp_tailwindcss_runtime = require("@weapp-tailwindcss/runtime");
|
|
|
3
3
|
let cn = require("cn");
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
const transformers = (0, _weapp_tailwindcss_runtime.resolveTransformers)();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const rpxTransform = (0, _weapp_tailwindcss_runtime.createRpxLengthTransform)();
|
|
7
|
+
/**
|
|
8
|
+
* 组合条件类名,并按 Tailwind 冲突规则保留最后一个类名。
|
|
9
|
+
* 经 runtime 聚合包装:有界 LRU、rpx 长度归一化、按需 unescape/escape。
|
|
10
|
+
*/
|
|
11
|
+
const cn$1 = (0, _weapp_tailwindcss_runtime.wrapRuntimeAggregator)(cn.twMerge, transformers, rpxTransform.prepareValue, rpxTransform.restoreValue);
|
|
12
12
|
//#endregion
|
|
13
13
|
exports.cn = cn$1;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ClassValue } from "@weapp-tailwindcss/runtime";
|
|
2
2
|
//#region src/index.d.ts
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 组合条件类名,并按 Tailwind 冲突规则保留最后一个类名。
|
|
5
|
+
* 经 runtime 聚合包装:有界 LRU、rpx 长度归一化、按需 unescape/escape。
|
|
6
|
+
*/
|
|
7
|
+
export declare const cn: import("@weapp-tailwindcss/runtime").TailwindMergeRuntime;
|
|
5
8
|
//#endregion
|
|
6
9
|
export type { ClassValue };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ClassValue } from "@weapp-tailwindcss/runtime";
|
|
2
2
|
//#region src/index.d.ts
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 组合条件类名,并按 Tailwind 冲突规则保留最后一个类名。
|
|
5
|
+
* 经 runtime 聚合包装:有界 LRU、rpx 长度归一化、按需 unescape/escape。
|
|
6
|
+
*/
|
|
7
|
+
export declare const cn: import("@weapp-tailwindcss/runtime").TailwindMergeRuntime;
|
|
5
8
|
//#endregion
|
|
6
9
|
export type { ClassValue };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createRpxLengthTransform, resolveTransformers, wrapRuntimeAggregator } from "@weapp-tailwindcss/runtime";
|
|
2
|
+
import { twMerge } from "cn";
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
const transformers = resolveTransformers();
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const rpxTransform = createRpxLengthTransform();
|
|
6
|
+
/**
|
|
7
|
+
* 组合条件类名,并按 Tailwind 冲突规则保留最后一个类名。
|
|
8
|
+
* 经 runtime 聚合包装:有界 LRU、rpx 长度归一化、按需 unescape/escape。
|
|
9
|
+
*/
|
|
10
|
+
const cn = wrapRuntimeAggregator(twMerge, transformers, rpxTransform.prepareValue, rpxTransform.restoreValue);
|
|
11
11
|
//#endregion
|
|
12
12
|
export { cn };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/cn",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Cross-platform Tailwind CSS class name utility for mini-programs. 面向小程序的跨端 Tailwind CSS 类名组合工具。",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://tw.weapp.dev/docs/community/merge
|
|
8
|
+
"homepage": "https://tw.weapp.dev/docs/community/merge",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/sonofmagic/weapp-tailwindcss.git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@weapp-tailwindcss/runtime": "0.1.
|
|
49
|
+
"@weapp-tailwindcss/runtime": "0.1.9",
|
|
50
50
|
"cn": "^0.3.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|