@greendrake/css-reset 0.1.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 +13 -0
- package/_index.scss +78 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eugene Greendrake
|
|
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,13 @@
|
|
|
1
|
+
# @greendrake/css-reset
|
|
2
|
+
|
|
3
|
+
Modern CSS reset for SPA/PWA projects.
|
|
4
|
+
|
|
5
|
+
Adapted from [Josh Comeau's custom CSS reset](https://www.joshwcomeau.com/css/custom-css-reset/) and [Andy Bell's more modern CSS reset](https://piccalil.li/blog/a-more-modern-css-reset/), with form-control resets added.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```scss
|
|
10
|
+
@use '@greendrake/css-reset';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Note: the reset is aggressive about form controls (`input`, `button`, `textarea`, `select` inherit fonts and lose native styling). It is intended for design systems that fully restyle controls, such as `@greendrake/ui` + `@greendrake/theme`.
|
package/_index.scss
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* https://www.joshwcomeau.com/css/custom-css-reset/ */
|
|
2
|
+
/* https://piccalil.li/blog/a-more-modern-css-reset/ */
|
|
3
|
+
|
|
4
|
+
/* Everything lives in the `reset` cascade layer. Unlayered author styles ALWAYS
|
|
5
|
+
win over any layer, regardless of source order or specificity — so an app's
|
|
6
|
+
form-control skin (borders, line-height, background) can never be overridden
|
|
7
|
+
by this reset even if the reset ends up emitted into a later stylesheet (e.g.
|
|
8
|
+
duplicated by a component's compiled styles). Without the layer, the reset's
|
|
9
|
+
`input { font: inherit; border: none }` ties on specificity with the app's
|
|
10
|
+
`input { … }` and the later one wins — a load-order-dependent flake. */
|
|
11
|
+
@layer reset {
|
|
12
|
+
/* 1. Use a more-intuitive box-sizing model */
|
|
13
|
+
*,
|
|
14
|
+
*::before,
|
|
15
|
+
*::after {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
* {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Prevent font size inflation */
|
|
25
|
+
html {
|
|
26
|
+
-moz-text-size-adjust: none;
|
|
27
|
+
-webkit-text-size-adjust: none;
|
|
28
|
+
text-size-adjust: none;
|
|
29
|
+
text-rendering: optimizeLegibility;
|
|
30
|
+
-webkit-font-smoothing: antialiased;
|
|
31
|
+
-moz-osx-font-smoothing: grayscale;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* 5. Improve media defaults */
|
|
35
|
+
img,
|
|
36
|
+
picture,
|
|
37
|
+
video,
|
|
38
|
+
canvas,
|
|
39
|
+
svg {
|
|
40
|
+
display: block;
|
|
41
|
+
max-width: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* 6. Inherit fonts for form controls */
|
|
45
|
+
input,
|
|
46
|
+
button,
|
|
47
|
+
textarea,
|
|
48
|
+
select {
|
|
49
|
+
font: inherit;
|
|
50
|
+
border: none;
|
|
51
|
+
outline: none;
|
|
52
|
+
background: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* 7. Avoid text overflows */
|
|
56
|
+
p,
|
|
57
|
+
h1,
|
|
58
|
+
h2,
|
|
59
|
+
h3,
|
|
60
|
+
h4,
|
|
61
|
+
h5,
|
|
62
|
+
h6 {
|
|
63
|
+
overflow-wrap: break-word;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 8. Improve line wrapping */
|
|
67
|
+
p {
|
|
68
|
+
text-wrap: pretty;
|
|
69
|
+
}
|
|
70
|
+
h1,
|
|
71
|
+
h2,
|
|
72
|
+
h3,
|
|
73
|
+
h4,
|
|
74
|
+
h5,
|
|
75
|
+
h6 {
|
|
76
|
+
text-wrap: balance;
|
|
77
|
+
}
|
|
78
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@greendrake/css-reset",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Modern CSS reset (adapted from Josh Comeau's and Andy Bell's resets)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Eugene Greendrake <eugene@greendrake.nz>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/greendrake/lib.git",
|
|
10
|
+
"directory": "css-reset"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/greendrake/lib/tree/main/css-reset#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/greendrake/lib/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "_index.scss",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"sass": "./_index.scss",
|
|
21
|
+
"default": "./_index.scss"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"_index.scss"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"prettier": "@greendrake/dev-config/prettier",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@greendrake/dev-config": "0.1.0"
|
|
33
|
+
}
|
|
34
|
+
}
|