@weapp-tailwindcss/reset 0.0.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/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/index.cjs +295 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.mjs +260 -0
- package/package.json +62 -0
- package/taro/button-after.css +3 -0
- package/taro/eric-meyer.css +184 -0
- package/taro/modern-normalize.css +355 -0
- package/taro/normalize.css +300 -0
- package/taro/sanitize/assets.css +16 -0
- package/taro/sanitize/sanitize.css +459 -0
- package/taro/tailwind-compat.css +539 -0
- package/taro/tailwind.css +537 -0
- package/uni-app/button-after.css +3 -0
- package/uni-app/eric-meyer.css +184 -0
- package/uni-app/modern-normalize.css +355 -0
- package/uni-app/normalize.css +300 -0
- package/uni-app/sanitize/assets.css +16 -0
- package/uni-app/sanitize/sanitize.css +459 -0
- package/uni-app/tailwind-compat.css +539 -0
- package/uni-app/tailwind.css +537 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 ice breaker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @weapp-tailwindcss/reset
|
|
2
|
+
|
|
3
|
+
`@weapp-tailwindcss/reset` 同时提供两类能力:
|
|
4
|
+
|
|
5
|
+
- 可直接导入的静态 reset CSS 资源,适用于 `uni-app` 与 `taro`
|
|
6
|
+
- 可注册到 Tailwind 的 `reset()` 插件入口
|
|
7
|
+
|
|
8
|
+
当前提供:
|
|
9
|
+
|
|
10
|
+
- `button-after.css`:清理 `button::after`
|
|
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
|
+
### 2. 作为静态 CSS 资源使用
|
|
81
|
+
|
|
82
|
+
`uni-app` 通常在 `src/main.ts` 或入口样式中导入:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import "@weapp-tailwindcss/reset/uni-app/button-after.css";
|
|
86
|
+
import "@weapp-tailwindcss/reset/uni-app/modern-normalize.css";
|
|
87
|
+
import "@weapp-tailwindcss/reset/uni-app/sanitize/sanitize.css";
|
|
88
|
+
import "@weapp-tailwindcss/reset/uni-app/sanitize/assets.css";
|
|
89
|
+
import "@weapp-tailwindcss/reset/uni-app/tailwind-compat.css";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`taro` 通常在 `src/app.tsx` 或入口样式中导入:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import "@weapp-tailwindcss/reset/taro/button-after.css";
|
|
96
|
+
import "@weapp-tailwindcss/reset/taro/modern-normalize.css";
|
|
97
|
+
import "@weapp-tailwindcss/reset/taro/sanitize/sanitize.css";
|
|
98
|
+
import "@weapp-tailwindcss/reset/taro/sanitize/assets.css";
|
|
99
|
+
import "@weapp-tailwindcss/reset/taro/tailwind-compat.css";
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
如果你想保留按钮原生背景色,优先使用 `tailwind-compat.css`。
|
|
103
|
+
|
|
104
|
+
如果你要更轻量、更传统的 reset,可以按需改用 `normalize.css`、`modern-normalize.css` 或 `eric-meyer.css`,它们都支持 `uni-app` / `taro` 两套路径。
|
|
105
|
+
|
|
106
|
+
为了兼容旧项目,`weapp-tailwindcss/reset` 仍然保留导出入口;但新的实际实现已经迁到 `@weapp-tailwindcss/reset`。
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
default: () => index_default,
|
|
34
|
+
reset: () => reset
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
var import_plugin = __toESM(require("tailwindcss/plugin"));
|
|
38
|
+
|
|
39
|
+
// src/normalize.ts
|
|
40
|
+
function normalizeResetSelectors(option, defaults) {
|
|
41
|
+
const resolved = option?.selectors?.length ? option.selectors : defaults;
|
|
42
|
+
const normalized = [];
|
|
43
|
+
for (const selector of resolved) {
|
|
44
|
+
const trimmed = selector.trim();
|
|
45
|
+
if (!trimmed || normalized.includes(trimmed)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
normalized.push(trimmed);
|
|
49
|
+
}
|
|
50
|
+
return normalized.length ? normalized : void 0;
|
|
51
|
+
}
|
|
52
|
+
function convertSelectorForBase(selector) {
|
|
53
|
+
if (selector.startsWith(".")) {
|
|
54
|
+
const className = selector.slice(1);
|
|
55
|
+
if (className.length > 0) {
|
|
56
|
+
return `[class~="${className}"]`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (selector.startsWith("#")) {
|
|
60
|
+
const id = selector.slice(1);
|
|
61
|
+
if (id.length > 0) {
|
|
62
|
+
return `[id="${id}"]`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return selector;
|
|
66
|
+
}
|
|
67
|
+
function normalizeDeclarationValue(value) {
|
|
68
|
+
if (value === false || value === null || value === void 0) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
return typeof value === "number" ? value.toString() : value;
|
|
72
|
+
}
|
|
73
|
+
function normalizeDeclarations(option, defaults) {
|
|
74
|
+
const normalized = { ...defaults };
|
|
75
|
+
const overrides = option?.declarations;
|
|
76
|
+
if (!overrides) {
|
|
77
|
+
return normalized;
|
|
78
|
+
}
|
|
79
|
+
const entries = Object.entries(overrides);
|
|
80
|
+
for (const [prop, value] of entries) {
|
|
81
|
+
const resolved = normalizeDeclarationValue(value);
|
|
82
|
+
if (resolved === void 0) {
|
|
83
|
+
delete normalized[prop];
|
|
84
|
+
} else {
|
|
85
|
+
normalized[prop] = resolved;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return normalized;
|
|
89
|
+
}
|
|
90
|
+
function normalizePseudo(option, defaults) {
|
|
91
|
+
const normalized = defaults ? { ...defaults } : {};
|
|
92
|
+
const overrides = option?.pseudo;
|
|
93
|
+
if (!overrides) {
|
|
94
|
+
return Object.keys(normalized).length ? normalized : void 0;
|
|
95
|
+
}
|
|
96
|
+
const entries = Object.entries(overrides);
|
|
97
|
+
for (const [prop, value] of entries) {
|
|
98
|
+
const resolved = normalizeDeclarationValue(value);
|
|
99
|
+
if (resolved === void 0) {
|
|
100
|
+
delete normalized[prop];
|
|
101
|
+
} else {
|
|
102
|
+
normalized[prop] = resolved;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return Object.keys(normalized).length ? normalized : void 0;
|
|
106
|
+
}
|
|
107
|
+
function createResetRule(option, defaults) {
|
|
108
|
+
if (option === false) {
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
111
|
+
const selectors = normalizeResetSelectors(option, defaults.selectors);
|
|
112
|
+
if (!selectors) {
|
|
113
|
+
return void 0;
|
|
114
|
+
}
|
|
115
|
+
const declarations = normalizeDeclarations(option ?? {}, defaults.declarations);
|
|
116
|
+
if (Object.keys(declarations).length === 0) {
|
|
117
|
+
return void 0;
|
|
118
|
+
}
|
|
119
|
+
const pseudo = normalizePseudo(option ?? {}, defaults.pseudo);
|
|
120
|
+
return {
|
|
121
|
+
selectors: selectors.map(convertSelectorForBase),
|
|
122
|
+
declarations,
|
|
123
|
+
pseudo
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/index.ts
|
|
128
|
+
var DEFAULT_BUTTON_RESET_SELECTORS = ["button"];
|
|
129
|
+
var DEFAULT_BUTTON_DECLARATIONS = {
|
|
130
|
+
padding: "0",
|
|
131
|
+
backgroundColor: "transparent",
|
|
132
|
+
fontSize: "inherit",
|
|
133
|
+
lineHeight: "inherit",
|
|
134
|
+
color: "inherit",
|
|
135
|
+
borderWidth: "0"
|
|
136
|
+
};
|
|
137
|
+
var BUTTON_RESET_PSEUDO_DECLARATIONS = {
|
|
138
|
+
border: "none"
|
|
139
|
+
};
|
|
140
|
+
var DEFAULT_IMAGE_RESET_SELECTORS = ["image", "img"];
|
|
141
|
+
var DEFAULT_IMAGE_DECLARATIONS = {
|
|
142
|
+
display: "block",
|
|
143
|
+
borderWidth: "0",
|
|
144
|
+
backgroundColor: "transparent",
|
|
145
|
+
maxWidth: "100%",
|
|
146
|
+
height: "auto"
|
|
147
|
+
};
|
|
148
|
+
var DEFAULT_INPUT_RESET_SELECTORS = ["input"];
|
|
149
|
+
var DEFAULT_INPUT_DECLARATIONS = {
|
|
150
|
+
padding: "0",
|
|
151
|
+
fontSize: "100%",
|
|
152
|
+
fontFamily: "inherit",
|
|
153
|
+
lineHeight: "inherit",
|
|
154
|
+
color: "inherit",
|
|
155
|
+
backgroundColor: "transparent",
|
|
156
|
+
borderWidth: "0"
|
|
157
|
+
};
|
|
158
|
+
var DEFAULT_TEXTAREA_RESET_SELECTORS = ["textarea"];
|
|
159
|
+
var DEFAULT_TEXTAREA_DECLARATIONS = {
|
|
160
|
+
padding: "0",
|
|
161
|
+
fontSize: "100%",
|
|
162
|
+
fontFamily: "inherit",
|
|
163
|
+
lineHeight: "inherit",
|
|
164
|
+
color: "inherit",
|
|
165
|
+
backgroundColor: "transparent",
|
|
166
|
+
borderWidth: "0",
|
|
167
|
+
resize: "vertical"
|
|
168
|
+
};
|
|
169
|
+
var DEFAULT_LIST_RESET_SELECTORS = ["ul", "ol"];
|
|
170
|
+
var DEFAULT_LIST_DECLARATIONS = {
|
|
171
|
+
listStyle: "none",
|
|
172
|
+
margin: "0",
|
|
173
|
+
padding: "0"
|
|
174
|
+
};
|
|
175
|
+
var DEFAULT_NAVIGATOR_RESET_SELECTORS = ["navigator", "a"];
|
|
176
|
+
var DEFAULT_NAVIGATOR_DECLARATIONS = {
|
|
177
|
+
color: "inherit",
|
|
178
|
+
textDecoration: "inherit"
|
|
179
|
+
};
|
|
180
|
+
var DEFAULT_VIDEO_RESET_SELECTORS = ["video"];
|
|
181
|
+
var DEFAULT_VIDEO_DECLARATIONS = {
|
|
182
|
+
display: "block",
|
|
183
|
+
maxWidth: "100%",
|
|
184
|
+
height: "auto"
|
|
185
|
+
};
|
|
186
|
+
var presetMap = {
|
|
187
|
+
minimal: ["buttonReset", "imageReset"],
|
|
188
|
+
form: ["buttonReset", "imageReset", "inputReset", "textareaReset"],
|
|
189
|
+
content: ["buttonReset", "imageReset", "listReset", "navigatorReset"],
|
|
190
|
+
media: ["buttonReset", "imageReset", "videoReset"],
|
|
191
|
+
all: [
|
|
192
|
+
"buttonReset",
|
|
193
|
+
"imageReset",
|
|
194
|
+
"inputReset",
|
|
195
|
+
"textareaReset",
|
|
196
|
+
"listReset",
|
|
197
|
+
"navigatorReset",
|
|
198
|
+
"videoReset"
|
|
199
|
+
]
|
|
200
|
+
};
|
|
201
|
+
function resolvePresetFlags(options) {
|
|
202
|
+
const resolved = {
|
|
203
|
+
buttonReset: true,
|
|
204
|
+
imageReset: true,
|
|
205
|
+
inputReset: false,
|
|
206
|
+
textareaReset: false,
|
|
207
|
+
listReset: false,
|
|
208
|
+
navigatorReset: false,
|
|
209
|
+
videoReset: false
|
|
210
|
+
};
|
|
211
|
+
const presets = options?.preset;
|
|
212
|
+
if (!presets) {
|
|
213
|
+
return resolved;
|
|
214
|
+
}
|
|
215
|
+
const normalizedPresets = Array.isArray(presets) ? presets : [presets];
|
|
216
|
+
for (const preset of normalizedPresets) {
|
|
217
|
+
for (const key of presetMap[preset]) {
|
|
218
|
+
resolved[key] = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return resolved;
|
|
222
|
+
}
|
|
223
|
+
var reset = import_plugin.default.withOptions(
|
|
224
|
+
(options) => {
|
|
225
|
+
const rules = [];
|
|
226
|
+
const enabledFlags = resolvePresetFlags(options);
|
|
227
|
+
const builtInRules = [
|
|
228
|
+
enabledFlags.buttonReset ? createResetRule(options?.buttonReset, {
|
|
229
|
+
selectors: DEFAULT_BUTTON_RESET_SELECTORS,
|
|
230
|
+
declarations: DEFAULT_BUTTON_DECLARATIONS,
|
|
231
|
+
pseudo: BUTTON_RESET_PSEUDO_DECLARATIONS
|
|
232
|
+
}) : void 0,
|
|
233
|
+
enabledFlags.imageReset ? createResetRule(options?.imageReset, {
|
|
234
|
+
selectors: DEFAULT_IMAGE_RESET_SELECTORS,
|
|
235
|
+
declarations: DEFAULT_IMAGE_DECLARATIONS
|
|
236
|
+
}) : void 0,
|
|
237
|
+
enabledFlags.inputReset ? createResetRule(options?.inputReset, {
|
|
238
|
+
selectors: DEFAULT_INPUT_RESET_SELECTORS,
|
|
239
|
+
declarations: DEFAULT_INPUT_DECLARATIONS
|
|
240
|
+
}) : void 0,
|
|
241
|
+
enabledFlags.textareaReset ? createResetRule(options?.textareaReset, {
|
|
242
|
+
selectors: DEFAULT_TEXTAREA_RESET_SELECTORS,
|
|
243
|
+
declarations: DEFAULT_TEXTAREA_DECLARATIONS
|
|
244
|
+
}) : void 0,
|
|
245
|
+
enabledFlags.listReset ? createResetRule(options?.listReset, {
|
|
246
|
+
selectors: DEFAULT_LIST_RESET_SELECTORS,
|
|
247
|
+
declarations: DEFAULT_LIST_DECLARATIONS
|
|
248
|
+
}) : void 0,
|
|
249
|
+
enabledFlags.navigatorReset ? createResetRule(options?.navigatorReset, {
|
|
250
|
+
selectors: DEFAULT_NAVIGATOR_RESET_SELECTORS,
|
|
251
|
+
declarations: DEFAULT_NAVIGATOR_DECLARATIONS
|
|
252
|
+
}) : void 0,
|
|
253
|
+
enabledFlags.videoReset ? createResetRule(options?.videoReset, {
|
|
254
|
+
selectors: DEFAULT_VIDEO_RESET_SELECTORS,
|
|
255
|
+
declarations: DEFAULT_VIDEO_DECLARATIONS
|
|
256
|
+
}) : void 0
|
|
257
|
+
];
|
|
258
|
+
for (const rule of builtInRules) {
|
|
259
|
+
if (rule) {
|
|
260
|
+
rules.push(rule);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
for (const extra of options?.extraResets ?? []) {
|
|
264
|
+
const normalized = createResetRule(extra, {
|
|
265
|
+
selectors: extra.selectors ?? [],
|
|
266
|
+
declarations: {}
|
|
267
|
+
});
|
|
268
|
+
if (normalized) {
|
|
269
|
+
rules.push(normalized);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return ({ addBase }) => {
|
|
273
|
+
if (!rules.length) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const baseRules = {};
|
|
277
|
+
for (const rule of rules) {
|
|
278
|
+
baseRules[rule.selectors.join(",")] = rule.declarations;
|
|
279
|
+
if (rule.pseudo) {
|
|
280
|
+
const pseudoSelectors = rule.selectors.map((selector) => `${selector}::after`).join(",");
|
|
281
|
+
baseRules[pseudoSelectors] = rule.pseudo;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
addBase(baseRules);
|
|
285
|
+
};
|
|
286
|
+
},
|
|
287
|
+
() => {
|
|
288
|
+
return {};
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
var index_default = reset;
|
|
292
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
293
|
+
0 && (module.exports = {
|
|
294
|
+
reset
|
|
295
|
+
});
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as node_modules_tailwindcss_dist_types_CJYAW1ql_mjs from 'node_modules/tailwindcss/dist/types-CJYAW1ql.mjs';
|
|
2
|
+
|
|
3
|
+
type ResetPreset = 'minimal' | 'form' | 'content' | 'media' | 'all';
|
|
4
|
+
interface ResetOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 启用一组内置 reset 预设;默认不传时保持最小行为,仅注入 button/image。
|
|
7
|
+
*/
|
|
8
|
+
preset?: ResetPreset | ResetPreset[];
|
|
9
|
+
/**
|
|
10
|
+
* 控制 `button` reset 的注入与选择器,传入 `false` 可跳过该规则。
|
|
11
|
+
*/
|
|
12
|
+
buttonReset?: false | ResetConfig;
|
|
13
|
+
/**
|
|
14
|
+
* 控制 `image` reset(同时覆盖 `<image>` 与 `<img>`)。
|
|
15
|
+
*/
|
|
16
|
+
imageReset?: false | ResetConfig;
|
|
17
|
+
/**
|
|
18
|
+
* 控制常见输入框 reset(`input`)。
|
|
19
|
+
*/
|
|
20
|
+
inputReset?: false | ResetConfig;
|
|
21
|
+
/**
|
|
22
|
+
* 控制多行输入框 reset(`textarea`)。
|
|
23
|
+
*/
|
|
24
|
+
textareaReset?: false | ResetConfig;
|
|
25
|
+
/**
|
|
26
|
+
* 控制列表 reset(`ul` / `ol`)。
|
|
27
|
+
*/
|
|
28
|
+
listReset?: false | ResetConfig;
|
|
29
|
+
/**
|
|
30
|
+
* 控制链接 reset(`navigator` / `a`)。
|
|
31
|
+
*/
|
|
32
|
+
navigatorReset?: false | ResetConfig;
|
|
33
|
+
/**
|
|
34
|
+
* 控制 `video` reset。
|
|
35
|
+
*/
|
|
36
|
+
videoReset?: false | ResetConfig;
|
|
37
|
+
/**
|
|
38
|
+
* 额外的 reset 规则,可根据业务自定义。
|
|
39
|
+
*/
|
|
40
|
+
extraResets?: ResetConfig[];
|
|
41
|
+
}
|
|
42
|
+
interface ResetConfig {
|
|
43
|
+
selectors?: string[];
|
|
44
|
+
declarations?: Record<string, string | number | false | null | undefined>;
|
|
45
|
+
pseudo?: Record<string, string | number | false | null | undefined>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare const reset: node_modules_tailwindcss_dist_types_CJYAW1ql_mjs.c<ResetOptions>;
|
|
49
|
+
|
|
50
|
+
export { type ResetConfig, type ResetOptions, type ResetPreset, reset as default, reset };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as node_modules_tailwindcss_dist_types_CJYAW1ql_mjs from 'node_modules/tailwindcss/dist/types-CJYAW1ql.mjs';
|
|
2
|
+
|
|
3
|
+
type ResetPreset = 'minimal' | 'form' | 'content' | 'media' | 'all';
|
|
4
|
+
interface ResetOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 启用一组内置 reset 预设;默认不传时保持最小行为,仅注入 button/image。
|
|
7
|
+
*/
|
|
8
|
+
preset?: ResetPreset | ResetPreset[];
|
|
9
|
+
/**
|
|
10
|
+
* 控制 `button` reset 的注入与选择器,传入 `false` 可跳过该规则。
|
|
11
|
+
*/
|
|
12
|
+
buttonReset?: false | ResetConfig;
|
|
13
|
+
/**
|
|
14
|
+
* 控制 `image` reset(同时覆盖 `<image>` 与 `<img>`)。
|
|
15
|
+
*/
|
|
16
|
+
imageReset?: false | ResetConfig;
|
|
17
|
+
/**
|
|
18
|
+
* 控制常见输入框 reset(`input`)。
|
|
19
|
+
*/
|
|
20
|
+
inputReset?: false | ResetConfig;
|
|
21
|
+
/**
|
|
22
|
+
* 控制多行输入框 reset(`textarea`)。
|
|
23
|
+
*/
|
|
24
|
+
textareaReset?: false | ResetConfig;
|
|
25
|
+
/**
|
|
26
|
+
* 控制列表 reset(`ul` / `ol`)。
|
|
27
|
+
*/
|
|
28
|
+
listReset?: false | ResetConfig;
|
|
29
|
+
/**
|
|
30
|
+
* 控制链接 reset(`navigator` / `a`)。
|
|
31
|
+
*/
|
|
32
|
+
navigatorReset?: false | ResetConfig;
|
|
33
|
+
/**
|
|
34
|
+
* 控制 `video` reset。
|
|
35
|
+
*/
|
|
36
|
+
videoReset?: false | ResetConfig;
|
|
37
|
+
/**
|
|
38
|
+
* 额外的 reset 规则,可根据业务自定义。
|
|
39
|
+
*/
|
|
40
|
+
extraResets?: ResetConfig[];
|
|
41
|
+
}
|
|
42
|
+
interface ResetConfig {
|
|
43
|
+
selectors?: string[];
|
|
44
|
+
declarations?: Record<string, string | number | false | null | undefined>;
|
|
45
|
+
pseudo?: Record<string, string | number | false | null | undefined>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare const reset: node_modules_tailwindcss_dist_types_CJYAW1ql_mjs.c<ResetOptions>;
|
|
49
|
+
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
export = reset;
|
|
52
|
+
export { type ResetConfig, type ResetOptions, type ResetPreset, reset };
|