@weapp-tailwindcss/reset 0.1.1 → 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.en.md +9 -0
- package/README.md +4 -114
- package/dist/index.cjs +1 -1
- package/package.json +4 -3
- /package/dist/{index.mjs → index.js} +0 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @weapp-tailwindcss/reset
|
|
2
|
+
|
|
3
|
+
> English | [简体中文](./README.md)
|
|
4
|
+
|
|
5
|
+
This package provides reset stylesheet assets for mini program frameworks such as uni-app and Taro, designed to be imported from project entry styles.
|
|
6
|
+
|
|
7
|
+
## Website
|
|
8
|
+
|
|
9
|
+
For setup guides, configuration references, and framework examples, see the [official weapp-tailwindcss documentation](https://tw.icebreaker.top).
|
package/README.md
CHANGED
|
@@ -1,119 +1,9 @@
|
|
|
1
1
|
# @weapp-tailwindcss/reset
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 简体中文 | [English](./README.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- 可注册到 Tailwind 的 `reset()` 插件入口
|
|
5
|
+
这个包提供面向小程序多框架的 reset 样式资源,适合 uni-app、Taro 等项目在入口样式中直接引用。
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## 官网
|
|
9
8
|
|
|
10
|
-
-
|
|
11
|
-
- `normalize.css`:基于 `normalize.css` 的跨端静态版本
|
|
12
|
-
- `modern-normalize.css`:基于 `modern-normalize` 的跨端静态版本
|
|
13
|
-
- `eric-meyer.css`:经典 Eric Meyer reset
|
|
14
|
-
- `sanitize/sanitize.css`:基于 `sanitize.css` 的主体重置
|
|
15
|
-
- `sanitize/assets.css`:`sanitize.css` 的资源尺寸约束补充
|
|
16
|
-
- `tailwind.css`:静态版 Tailwind preflight
|
|
17
|
-
- `tailwind-compat.css`:在 `tailwind.css` 基础上移除按钮背景色重置,降低和组件库冲突概率
|
|
18
|
-
|
|
19
|
-
## 安装
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pnpm add -D @weapp-tailwindcss/reset
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 用法
|
|
26
|
-
|
|
27
|
-
### 1. 作为 Tailwind 插件使用
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
import reset from '@weapp-tailwindcss/reset'
|
|
31
|
-
|
|
32
|
-
export default {
|
|
33
|
-
plugins: [reset()],
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
它支持和原先 `weapp-tailwindcss/reset` 相同的选项:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
reset({
|
|
41
|
-
buttonReset: false,
|
|
42
|
-
imageReset: {
|
|
43
|
-
selectors: ['.wx-reset-image'],
|
|
44
|
-
},
|
|
45
|
-
extraResets: [
|
|
46
|
-
{
|
|
47
|
-
selectors: ['.wx-reset-view'],
|
|
48
|
-
declarations: {
|
|
49
|
-
display: 'block',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
})
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
现在还支持 `preset`,用来快速启用一组内置 reset:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
reset({ preset: 'form' })
|
|
60
|
-
reset({ preset: ['content', 'media'] })
|
|
61
|
-
reset({ preset: 'all', listReset: false })
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
可选预设:
|
|
65
|
-
|
|
66
|
-
- `minimal`:默认值,仅 `button` + `image`
|
|
67
|
-
- `form`:`minimal` + `input` + `textarea`
|
|
68
|
-
- `content`:`minimal` + `ul/ol` + `navigator/a`
|
|
69
|
-
- `media`:`minimal` + `video`
|
|
70
|
-
- `all`:启用全部内置 reset
|
|
71
|
-
|
|
72
|
-
新增内置 reset 项:
|
|
73
|
-
|
|
74
|
-
- `inputReset`
|
|
75
|
-
- `textareaReset`
|
|
76
|
-
- `listReset`
|
|
77
|
-
- `navigatorReset`
|
|
78
|
-
- `videoReset`
|
|
79
|
-
|
|
80
|
-
如果你直接传入这些内置项的配置对象,也会自动启用对应 reset;不必强制先写 `preset`:
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
reset({
|
|
84
|
-
inputReset: {
|
|
85
|
-
selectors: ['.wx-reset-input'],
|
|
86
|
-
},
|
|
87
|
-
videoReset: {
|
|
88
|
-
selectors: ['.wx-reset-video'],
|
|
89
|
-
},
|
|
90
|
-
})
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### 2. 作为静态 CSS 资源使用
|
|
94
|
-
|
|
95
|
-
`uni-app` 通常在 `src/main.ts` 或入口样式中导入:
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
import "@weapp-tailwindcss/reset/uni-app/button-after.css";
|
|
99
|
-
import "@weapp-tailwindcss/reset/uni-app/modern-normalize.css";
|
|
100
|
-
import "@weapp-tailwindcss/reset/uni-app/sanitize/sanitize.css";
|
|
101
|
-
import "@weapp-tailwindcss/reset/uni-app/sanitize/assets.css";
|
|
102
|
-
import "@weapp-tailwindcss/reset/uni-app/tailwind-compat.css";
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
`taro` 通常在 `src/app.tsx` 或入口样式中导入:
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
import "@weapp-tailwindcss/reset/taro/button-after.css";
|
|
109
|
-
import "@weapp-tailwindcss/reset/taro/modern-normalize.css";
|
|
110
|
-
import "@weapp-tailwindcss/reset/taro/sanitize/sanitize.css";
|
|
111
|
-
import "@weapp-tailwindcss/reset/taro/sanitize/assets.css";
|
|
112
|
-
import "@weapp-tailwindcss/reset/taro/tailwind-compat.css";
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
如果你想保留按钮原生背景色,优先使用 `tailwind-compat.css`。
|
|
116
|
-
|
|
117
|
-
如果你要更轻量、更传统的 reset,可以按需改用 `normalize.css`、`modern-normalize.css` 或 `eric-meyer.css`,它们都支持 `uni-app` / `taro` 两套路径。
|
|
118
|
-
|
|
119
|
-
为了兼容旧项目,`weapp-tailwindcss/reset` 仍然保留导出入口;但新的实际实现已经迁到 `@weapp-tailwindcss/reset`。
|
|
9
|
+
更多接入方式、配置说明和框架示例见 [weapp-tailwindcss 官方文档](https://tw.icebreaker.top)。
|
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
27
|
let tailwindcss_plugin = require("tailwindcss/plugin");
|
|
28
|
-
tailwindcss_plugin = __toESM(tailwindcss_plugin);
|
|
28
|
+
tailwindcss_plugin = __toESM(tailwindcss_plugin, 1);
|
|
29
29
|
//#region src/normalize.ts
|
|
30
30
|
function normalizeResetSelectors(option, defaults) {
|
|
31
31
|
const resolved = option?.selectors?.length ? option.selectors : defaults;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/reset",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.2",
|
|
4
5
|
"description": "weapp-tailwindcss 的静态 reset 样式资源集合",
|
|
5
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
7
|
"license": "MIT",
|
|
@@ -26,14 +27,14 @@
|
|
|
26
27
|
"exports": {
|
|
27
28
|
".": {
|
|
28
29
|
"types": "./dist/index.d.ts",
|
|
29
|
-
"import": "./dist/index.
|
|
30
|
+
"import": "./dist/index.js",
|
|
30
31
|
"require": "./dist/index.cjs"
|
|
31
32
|
},
|
|
32
33
|
"./*": "./*",
|
|
33
34
|
"./package.json": "./package.json"
|
|
34
35
|
},
|
|
35
36
|
"main": "./dist/index.cjs",
|
|
36
|
-
"module": "./dist/index.
|
|
37
|
+
"module": "./dist/index.js",
|
|
37
38
|
"types": "./dist/index.d.ts",
|
|
38
39
|
"files": [
|
|
39
40
|
"README.md",
|
|
File without changes
|