astro-nosferatu 0.0.0-stage → 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 +52 -2
- package/package.json +32 -3
- package/src/components/Button.astro +59 -0
- package/src/styles/base.css +24 -0
- package/src/styles/index.css +6 -0
- package/src/styles/reset.css +35 -0
- package/src/styles/tokens.css +41 -0
- package/src/styles/typography.css +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nosferatu contributors
|
|
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
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# astro-nosferatu
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Styles and `.astro` components for [Astro](https://astro.build) 7.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install astro-nosferatu
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Styles
|
|
10
|
+
|
|
11
|
+
Import the full set once, for example in your base layout:
|
|
12
|
+
|
|
13
|
+
```astro
|
|
14
|
+
---
|
|
15
|
+
import 'astro-nosferatu/styles/index.css';
|
|
16
|
+
---
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`index.css` loads the tokens and puts the reset, base and typography styles in cascade layers, in this order:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
nosferatu.reset < nosferatu.base < nosferatu.typography < your unlayered CSS
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Any CSS you write outside a layer wins, with no `!important` or extra specificity needed.
|
|
26
|
+
|
|
27
|
+
You can also import single files: `tokens.css`, `reset.css`, `base.css`, `typography.css`. Files imported on their own are **not** layered; only `index.css` adds the layers.
|
|
28
|
+
|
|
29
|
+
### Theming
|
|
30
|
+
|
|
31
|
+
Every design value is a CSS custom property prefixed with `--nf-`. Override one to re-theme:
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
:root {
|
|
35
|
+
--nf-color-primary: #7c3aed;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Components
|
|
40
|
+
|
|
41
|
+
```astro
|
|
42
|
+
---
|
|
43
|
+
import Button from 'astro-nosferatu/components/Button.astro';
|
|
44
|
+
---
|
|
45
|
+
<Button>Save</Button>
|
|
46
|
+
<Button variant="secondary">Cancel</Button>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Components read their values from the `--nf-*` tokens, so load `tokens.css` (or `index.css`) on the page.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-nosferatu",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"author": "renangirotto",
|
|
5
|
+
"description": "Astro component library: styles and .astro components.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/renangirotto/nosferatu.git",
|
|
10
|
+
"directory": "packages/ui"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/renangirotto/nosferatu#readme",
|
|
13
|
+
"bugs": "https://github.com/renangirotto/nosferatu/issues",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"astro-component",
|
|
17
|
+
"astro",
|
|
18
|
+
"ui",
|
|
19
|
+
"css"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
"./components/*": "./src/components/*",
|
|
23
|
+
"./styles/*": "./src/styles/*",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src"
|
|
28
|
+
],
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"astro": "^7.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"astro": "^7.4.1"
|
|
34
|
+
}
|
|
6
35
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
|
|
4
|
+
interface Props extends HTMLAttributes<'button'> {
|
|
5
|
+
variant?: 'primary' | 'secondary';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { variant = 'primary', type = 'button', class: className, ...attrs } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<button type={type} class:list={['nf-button', `nf-button--${variant}`, className]} {...attrs}>
|
|
12
|
+
<slot />
|
|
13
|
+
</button>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.nf-button {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
gap: var(--nf-space-2);
|
|
21
|
+
padding: var(--nf-space-2) var(--nf-space-4);
|
|
22
|
+
border: 1px solid transparent;
|
|
23
|
+
border-radius: var(--nf-radius-md);
|
|
24
|
+
font-family: var(--nf-font-body);
|
|
25
|
+
font-size: var(--nf-font-size-md);
|
|
26
|
+
font-weight: var(--nf-font-weight-medium);
|
|
27
|
+
line-height: var(--nf-line-height-heading);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nf-button:focus-visible {
|
|
32
|
+
outline: 2px solid var(--nf-color-focus);
|
|
33
|
+
outline-offset: 2px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.nf-button:disabled {
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
opacity: 0.5;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nf-button--primary {
|
|
42
|
+
background-color: var(--nf-color-primary);
|
|
43
|
+
color: var(--nf-color-on-primary);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.nf-button--primary:hover:not(:disabled) {
|
|
47
|
+
background-color: var(--nf-color-primary-hover);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nf-button--secondary {
|
|
51
|
+
background-color: var(--nf-color-background);
|
|
52
|
+
border-color: var(--nf-color-border);
|
|
53
|
+
color: var(--nf-color-text);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nf-button--secondary:hover:not(:disabled) {
|
|
57
|
+
background-color: var(--nf-color-surface);
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
html {
|
|
2
|
+
-webkit-text-size-adjust: 100%;
|
|
3
|
+
text-size-adjust: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
body {
|
|
7
|
+
min-height: 100vh;
|
|
8
|
+
background-color: var(--nf-color-background);
|
|
9
|
+
color: var(--nf-color-text);
|
|
10
|
+
font-family: var(--nf-font-body);
|
|
11
|
+
font-size: var(--nf-font-size-md);
|
|
12
|
+
line-height: var(--nf-line-height-body);
|
|
13
|
+
-webkit-font-smoothing: antialiased;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:focus-visible {
|
|
17
|
+
outline: 2px solid var(--nf-color-focus);
|
|
18
|
+
outline-offset: 2px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
::selection {
|
|
22
|
+
background-color: var(--nf-color-primary);
|
|
23
|
+
color: var(--nf-color-on-primary);
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
* {
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
img,
|
|
12
|
+
picture,
|
|
13
|
+
video,
|
|
14
|
+
canvas,
|
|
15
|
+
svg {
|
|
16
|
+
display: block;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
input,
|
|
21
|
+
button,
|
|
22
|
+
textarea,
|
|
23
|
+
select {
|
|
24
|
+
font: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
p,
|
|
28
|
+
h1,
|
|
29
|
+
h2,
|
|
30
|
+
h3,
|
|
31
|
+
h4,
|
|
32
|
+
h5,
|
|
33
|
+
h6 {
|
|
34
|
+
overflow-wrap: break-word;
|
|
35
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Color */
|
|
3
|
+
--nf-color-primary: #b91c1c;
|
|
4
|
+
--nf-color-primary-hover: #991b1b;
|
|
5
|
+
--nf-color-on-primary: #ffffff;
|
|
6
|
+
--nf-color-text: #18181b;
|
|
7
|
+
--nf-color-text-muted: #52525b;
|
|
8
|
+
--nf-color-background: #ffffff;
|
|
9
|
+
--nf-color-surface: #f4f4f5;
|
|
10
|
+
--nf-color-border: #d4d4d8;
|
|
11
|
+
--nf-color-focus: #2563eb;
|
|
12
|
+
|
|
13
|
+
/* Spacing */
|
|
14
|
+
--nf-space-1: 0.25rem;
|
|
15
|
+
--nf-space-2: 0.5rem;
|
|
16
|
+
--nf-space-3: 0.75rem;
|
|
17
|
+
--nf-space-4: 1rem;
|
|
18
|
+
--nf-space-6: 1.5rem;
|
|
19
|
+
--nf-space-8: 2rem;
|
|
20
|
+
|
|
21
|
+
/* Typography */
|
|
22
|
+
--nf-font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
23
|
+
--nf-font-heading: var(--nf-font-body);
|
|
24
|
+
--nf-font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
25
|
+
--nf-font-size-sm: 0.875rem;
|
|
26
|
+
--nf-font-size-md: 1rem;
|
|
27
|
+
--nf-font-size-lg: 1.25rem;
|
|
28
|
+
--nf-font-size-xl: 1.5rem;
|
|
29
|
+
--nf-font-size-2xl: 2rem;
|
|
30
|
+
--nf-font-size-3xl: 2.5rem;
|
|
31
|
+
--nf-font-weight-normal: 400;
|
|
32
|
+
--nf-font-weight-medium: 500;
|
|
33
|
+
--nf-font-weight-bold: 700;
|
|
34
|
+
--nf-line-height-body: 1.6;
|
|
35
|
+
--nf-line-height-heading: 1.2;
|
|
36
|
+
|
|
37
|
+
/* Radius */
|
|
38
|
+
--nf-radius-sm: 0.25rem;
|
|
39
|
+
--nf-radius-md: 0.5rem;
|
|
40
|
+
--nf-radius-full: 9999px;
|
|
41
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
h1,
|
|
2
|
+
h2,
|
|
3
|
+
h3,
|
|
4
|
+
h4,
|
|
5
|
+
h5,
|
|
6
|
+
h6 {
|
|
7
|
+
font-family: var(--nf-font-heading);
|
|
8
|
+
font-weight: var(--nf-font-weight-bold);
|
|
9
|
+
line-height: var(--nf-line-height-heading);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
h1 {
|
|
13
|
+
font-size: var(--nf-font-size-3xl);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
h2 {
|
|
17
|
+
font-size: var(--nf-font-size-2xl);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
h3 {
|
|
21
|
+
font-size: var(--nf-font-size-xl);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h4 {
|
|
25
|
+
font-size: var(--nf-font-size-lg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h5,
|
|
29
|
+
h6 {
|
|
30
|
+
font-size: var(--nf-font-size-md);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
p,
|
|
34
|
+
ul,
|
|
35
|
+
ol {
|
|
36
|
+
margin-block-end: var(--nf-space-4);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ul,
|
|
40
|
+
ol {
|
|
41
|
+
padding-inline-start: var(--nf-space-6);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
a {
|
|
45
|
+
color: var(--nf-color-primary);
|
|
46
|
+
text-underline-offset: 0.15em;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
a:hover {
|
|
50
|
+
color: var(--nf-color-primary-hover);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
code,
|
|
54
|
+
kbd,
|
|
55
|
+
pre {
|
|
56
|
+
font-family: var(--nf-font-mono);
|
|
57
|
+
font-size: var(--nf-font-size-sm);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
code {
|
|
61
|
+
padding: 0.1em 0.3em;
|
|
62
|
+
border-radius: var(--nf-radius-sm);
|
|
63
|
+
background-color: var(--nf-color-surface);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
pre {
|
|
67
|
+
padding: var(--nf-space-4);
|
|
68
|
+
border-radius: var(--nf-radius-md);
|
|
69
|
+
background-color: var(--nf-color-surface);
|
|
70
|
+
overflow-x: auto;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pre code {
|
|
74
|
+
padding: 0;
|
|
75
|
+
background: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
small {
|
|
79
|
+
font-size: var(--nf-font-size-sm);
|
|
80
|
+
color: var(--nf-color-text-muted);
|
|
81
|
+
}
|