@pikacss/plugin-reset 0.0.47 → 0.0.49
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 +29 -0
- package/dist/index.d.mts +37 -2
- package/dist/index.mjs +78 -8
- package/package.json +11 -7
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @pikacss/plugin-reset
|
|
2
|
+
|
|
3
|
+
CSS reset plugin for PikaCSS. Injects popular CSS reset stylesheets as preflight styles.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @pikacss/plugin-reset
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { defineEngineConfig } from '@pikacss/core'
|
|
15
|
+
import { reset } from '@pikacss/plugin-reset'
|
|
16
|
+
|
|
17
|
+
export default defineEngineConfig({
|
|
18
|
+
plugins: [reset()],
|
|
19
|
+
reset: 'modern-normalize', // default
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
See the [full documentation](https://pikacss.com/guide/plugins/reset).
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -8,17 +8,52 @@ declare const resetStyles: {
|
|
|
8
8
|
normalize: string;
|
|
9
9
|
'the-new-css-reset': string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Union of built-in CSS reset stylesheet names supported by the reset plugin.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Each value maps to a well-known CSS reset: Andy Bell's modern reset,
|
|
16
|
+
* Eric Meyer's classic reset, modern-normalize, normalize.css, and
|
|
17
|
+
* The New CSS Reset. The chosen name is passed to the `reset` engine
|
|
18
|
+
* config option to select which stylesheet is injected as a preflight.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const style: ResetStyle = 'modern-normalize'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
11
25
|
type ResetStyle = keyof typeof resetStyles;
|
|
12
26
|
declare module '@pikacss/core' {
|
|
13
27
|
interface EngineConfig {
|
|
14
28
|
/**
|
|
15
|
-
*
|
|
29
|
+
* CSS reset stylesheet to inject as a preflight.
|
|
16
30
|
*
|
|
17
|
-
* @default 'modern-normalize'
|
|
31
|
+
* @default `'modern-normalize'`
|
|
18
32
|
*/
|
|
19
33
|
reset?: ResetStyle;
|
|
20
34
|
}
|
|
21
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a PikaCSS engine plugin that injects a CSS reset stylesheet as a preflight.
|
|
38
|
+
*
|
|
39
|
+
* @returns An engine plugin that registers a reset preflight on the `reset` layer.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* The plugin reads the `reset` option from the engine config to select a
|
|
43
|
+
* stylesheet. If unset, it defaults to `'modern-normalize'`. A dedicated
|
|
44
|
+
* `reset` layer with order `-1` is created so the reset styles always
|
|
45
|
+
* appear before utility output.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { reset } from '@pikacss/plugin-reset'
|
|
50
|
+
*
|
|
51
|
+
* export default defineEngineConfig({
|
|
52
|
+
* plugins: [reset()],
|
|
53
|
+
* reset: 'eric-meyer',
|
|
54
|
+
* })
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
22
57
|
declare function reset(): EnginePlugin;
|
|
23
58
|
//#endregion
|
|
24
59
|
export { ResetStyle, reset };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { defineEnginePlugin } from "@pikacss/core";
|
|
2
|
-
|
|
3
2
|
//#region src/resets/andy-bell.ts
|
|
3
|
+
/**
|
|
4
|
+
* Andy Bell's "A Modern CSS Reset" stylesheet as a raw CSS string.
|
|
5
|
+
*
|
|
6
|
+
* Provides opinionated defaults: border-box sizing, margin removal, smooth
|
|
7
|
+
* scroll, reduced-motion media query, and inheritable fonts on form elements.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://piccalil.li/blog/a-modern-css-reset/}
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
4
13
|
var andy_bell_default = `
|
|
5
14
|
/* Box sizing rules */
|
|
6
15
|
*,
|
|
@@ -77,9 +86,19 @@ select {
|
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
`;
|
|
80
|
-
|
|
81
89
|
//#endregion
|
|
82
90
|
//#region src/resets/eric-meyer.ts
|
|
91
|
+
/**
|
|
92
|
+
* Eric Meyer's CSS Reset v5.0.2 stylesheet as a raw CSS string.
|
|
93
|
+
*
|
|
94
|
+
* A classic aggressive reset that zeroes out margin, padding, border, and
|
|
95
|
+
* font-size on nearly all HTML elements, removes list styles, resets quotes,
|
|
96
|
+
* and collapses table borders. Public domain.
|
|
97
|
+
*
|
|
98
|
+
* @see {@link https://meyerweb.com/eric/tools/css/reset/}
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
83
102
|
var eric_meyer_default = `
|
|
84
103
|
/* http://meyerweb.com/eric/tools/css/reset/
|
|
85
104
|
v5.0.2 | 20191019
|
|
@@ -134,9 +153,20 @@ table {
|
|
|
134
153
|
border-spacing: 0;
|
|
135
154
|
}
|
|
136
155
|
`;
|
|
137
|
-
|
|
138
156
|
//#endregion
|
|
139
157
|
//#region src/resets/modern-normalize.ts
|
|
158
|
+
/**
|
|
159
|
+
* modern-normalize v3.0.1 stylesheet as a raw CSS string.
|
|
160
|
+
*
|
|
161
|
+
* Normalizes browser defaults with modern sensibilities: border-box sizing,
|
|
162
|
+
* system-ui font stack, consistent `hr`/`abbr`/`table`/`form` rendering,
|
|
163
|
+
* and improved defaults for interactive and embedded elements.
|
|
164
|
+
* This is the default reset variant used by the `reset()` plugin.
|
|
165
|
+
*
|
|
166
|
+
* @see {@link https://github.com/sindresorhus/modern-normalize}
|
|
167
|
+
*
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
140
170
|
var modern_normalize_default = `
|
|
141
171
|
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
142
172
|
|
|
@@ -377,9 +407,19 @@ summary {
|
|
|
377
407
|
display: list-item;
|
|
378
408
|
}
|
|
379
409
|
`;
|
|
380
|
-
|
|
381
410
|
//#endregion
|
|
382
411
|
//#region src/resets/normalize.ts
|
|
412
|
+
/**
|
|
413
|
+
* normalize.css v8.0.1 stylesheet as a raw CSS string.
|
|
414
|
+
*
|
|
415
|
+
* Preserves useful browser defaults while normalizing cross-browser
|
|
416
|
+
* inconsistencies in line-height, font-size, margins, form elements, and
|
|
417
|
+
* HTML5 display roles. MIT licensed.
|
|
418
|
+
*
|
|
419
|
+
* @see {@link https://github.com/necolas/normalize.css}
|
|
420
|
+
*
|
|
421
|
+
* @internal
|
|
422
|
+
*/
|
|
383
423
|
var normalize_default = `
|
|
384
424
|
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
|
385
425
|
|
|
@@ -731,9 +771,20 @@ template {
|
|
|
731
771
|
display: none;
|
|
732
772
|
}
|
|
733
773
|
`;
|
|
734
|
-
|
|
735
774
|
//#endregion
|
|
736
775
|
//#region src/resets/the-new-css-reset.ts
|
|
776
|
+
/**
|
|
777
|
+
* The New CSS Reset v1.11.3 stylesheet as a raw CSS string.
|
|
778
|
+
*
|
|
779
|
+
* Uses `all: unset` with `display: revert` to strip all User-Agent styles
|
|
780
|
+
* except `display`, then re-applies specific opinionated defaults for
|
|
781
|
+
* box-sizing, text-size-adjust, cursors, list styles, tables, textareas,
|
|
782
|
+
* and media elements.
|
|
783
|
+
*
|
|
784
|
+
* @see {@link https://github.com/elad2412/the-new-css-reset}
|
|
785
|
+
*
|
|
786
|
+
* @internal
|
|
787
|
+
*/
|
|
737
788
|
var the_new_css_reset_default = `
|
|
738
789
|
/***
|
|
739
790
|
The new CSS reset - version 1.11.3 (last updated 25.08.2024)
|
|
@@ -851,7 +902,6 @@ meter {
|
|
|
851
902
|
display: none;
|
|
852
903
|
}
|
|
853
904
|
`;
|
|
854
|
-
|
|
855
905
|
//#endregion
|
|
856
906
|
//#region src/index.ts
|
|
857
907
|
const resetStyles = {
|
|
@@ -861,6 +911,27 @@ const resetStyles = {
|
|
|
861
911
|
"normalize": normalize_default,
|
|
862
912
|
"the-new-css-reset": the_new_css_reset_default
|
|
863
913
|
};
|
|
914
|
+
/**
|
|
915
|
+
* Creates a PikaCSS engine plugin that injects a CSS reset stylesheet as a preflight.
|
|
916
|
+
*
|
|
917
|
+
* @returns An engine plugin that registers a reset preflight on the `reset` layer.
|
|
918
|
+
*
|
|
919
|
+
* @remarks
|
|
920
|
+
* The plugin reads the `reset` option from the engine config to select a
|
|
921
|
+
* stylesheet. If unset, it defaults to `'modern-normalize'`. A dedicated
|
|
922
|
+
* `reset` layer with order `-1` is created so the reset styles always
|
|
923
|
+
* appear before utility output.
|
|
924
|
+
*
|
|
925
|
+
* @example
|
|
926
|
+
* ```ts
|
|
927
|
+
* import { reset } from '@pikacss/plugin-reset'
|
|
928
|
+
*
|
|
929
|
+
* export default defineEngineConfig({
|
|
930
|
+
* plugins: [reset()],
|
|
931
|
+
* reset: 'eric-meyer',
|
|
932
|
+
* })
|
|
933
|
+
* ```
|
|
934
|
+
*/
|
|
864
935
|
function reset() {
|
|
865
936
|
let style = "modern-normalize";
|
|
866
937
|
return defineEnginePlugin({
|
|
@@ -880,6 +951,5 @@ function reset() {
|
|
|
880
951
|
}
|
|
881
952
|
});
|
|
882
953
|
}
|
|
883
|
-
|
|
884
954
|
//#endregion
|
|
885
|
-
export { reset };
|
|
955
|
+
export { reset };
|
package/package.json
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.49",
|
|
8
8
|
"author": "DevilTea <ch19980814@gmail.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"homepage": "https://pikacss.com",
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/pikacss/pikacss.git",
|
|
13
|
+
"url": "git+https://github.com/pikacss/pikacss.git",
|
|
13
14
|
"directory": "packages/plugin-reset"
|
|
14
15
|
},
|
|
15
16
|
"bugs": {
|
|
@@ -20,6 +21,7 @@
|
|
|
20
21
|
"pikacss-plugin",
|
|
21
22
|
"reset"
|
|
22
23
|
],
|
|
24
|
+
"sideEffects": false,
|
|
23
25
|
"exports": {
|
|
24
26
|
".": {
|
|
25
27
|
"import": {
|
|
@@ -33,20 +35,22 @@
|
|
|
33
35
|
"files": [
|
|
34
36
|
"dist"
|
|
35
37
|
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=22"
|
|
40
|
+
},
|
|
36
41
|
"peerDependencies": {
|
|
37
|
-
"@pikacss/core": "0.0.
|
|
42
|
+
"@pikacss/core": "0.0.49"
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
|
40
|
-
"@pikacss/core": "0.0.
|
|
45
|
+
"@pikacss/core": "0.0.49"
|
|
41
46
|
},
|
|
42
47
|
"scripts": {
|
|
43
48
|
"build": "tsdown",
|
|
44
49
|
"build:watch": "tsdown --watch",
|
|
45
|
-
"build:pack": "pnpm build && pnpm pack",
|
|
46
50
|
"typecheck": "pnpm typecheck:package && pnpm typecheck:test",
|
|
47
51
|
"typecheck:package": "tsc --project ./tsconfig.package.json --noEmit",
|
|
48
52
|
"typecheck:test": "tsc --project ./tsconfig.tests.json --noEmit",
|
|
49
|
-
"test": "vitest run",
|
|
50
|
-
"test:watch": "vitest"
|
|
53
|
+
"test": "vitest run --config ./vitest.config.ts",
|
|
54
|
+
"test:watch": "vitest --config ./vitest.config.ts"
|
|
51
55
|
}
|
|
52
56
|
}
|