astro-nosferatu 0.1.0 → 0.2.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.
@@ -1,81 +1,110 @@
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
- }
1
+ :root {
2
+ /*
3
+ * Base fonts. The library names the families and never loads them: a
4
+ * consumer installs the matching Fontsource package (or supplies the font
5
+ * itself) and each stack falls through to a system font when they do not.
6
+ * The variable family name comes first, then the static one, so either
7
+ * @fontsource-variable/* or @fontsource/* works.
8
+ */
9
+ --nf-font-family:
10
+ "Outfit Variable", "Outfit", system-ui, -apple-system, sans-serif;
11
+ --nf-font-family-blog-post:
12
+ "Plus Jakarta Sans Variable", "Plus Jakarta Sans", system-ui, -apple-system,
13
+ sans-serif;
14
+ --nf-font-family-code-blog-post:
15
+ "Geist Mono Variable", "Geist Mono", ui-monospace, monospace;
16
+ --nf-font-weight: 400;
27
17
 
28
- h5,
29
- h6 {
30
- font-size: var(--nf-font-size-md);
31
- }
18
+ /* Viewport interpolation */
19
+ --nf-typography-viewport-min: 560px;
20
+ --nf-typography-viewport-max: 1088px;
21
+ --nf-typography-viewport-progress: progress(
22
+ 100svw,
23
+ var(--nf-typography-viewport-min),
24
+ var(--nf-typography-viewport-max)
25
+ );
32
26
 
33
- p,
34
- ul,
35
- ol {
36
- margin-block-end: var(--nf-space-4);
37
- }
27
+ /* h1 */
28
+ --nf-typography-font-size-h1-min: 3rem;
29
+ --nf-typography-font-size-h1-max: 3.5rem;
30
+ --nf-typography-font-size-h1: calc(
31
+ var(--nf-typography-font-size-h1-min) +
32
+ var(--nf-typography-viewport-progress) *
33
+ (
34
+ var(--nf-typography-font-size-h1-max) -
35
+ var(--nf-typography-font-size-h1-min)
36
+ )
37
+ );
38
38
 
39
- ul,
40
- ol {
41
- padding-inline-start: var(--nf-space-6);
42
- }
39
+ /* h2 */
40
+ --nf-typography-font-size-h2-min: 2.5rem;
41
+ --nf-typography-font-size-h2-max: 3rem;
42
+ --nf-typography-font-size-h2: calc(
43
+ var(--nf-typography-font-size-h2-min) +
44
+ var(--nf-typography-viewport-progress) *
45
+ (
46
+ var(--nf-typography-font-size-h2-max) -
47
+ var(--nf-typography-font-size-h2-min)
48
+ )
49
+ );
43
50
 
44
- a {
45
- color: var(--nf-color-primary);
46
- text-underline-offset: 0.15em;
47
- }
51
+ /* h3 */
52
+ --nf-typography-font-size-h3-min: 2rem;
53
+ --nf-typography-font-size-h3-max: 2.5rem;
54
+ --nf-typography-font-size-h3: calc(
55
+ var(--nf-typography-font-size-h3-min) +
56
+ var(--nf-typography-viewport-progress) *
57
+ (
58
+ var(--nf-typography-font-size-h3-max) -
59
+ var(--nf-typography-font-size-h3-min)
60
+ )
61
+ );
48
62
 
49
- a:hover {
50
- color: var(--nf-color-primary-hover);
63
+ /* p */
64
+ --nf-typography-font-size-base-min: 1rem;
65
+ --nf-typography-font-size-base-max: 1.125rem;
66
+ --nf-typography-font-size-base: calc(
67
+ var(--nf-typography-font-size-base-min) +
68
+ var(--nf-typography-viewport-progress) *
69
+ (
70
+ var(--nf-typography-font-size-base-max) -
71
+ var(--nf-typography-font-size-base-min)
72
+ )
73
+ );
51
74
  }
52
75
 
53
- code,
54
- kbd,
55
- pre {
56
- font-family: var(--nf-font-mono);
57
- font-size: var(--nf-font-size-sm);
76
+ /*
77
+ * The one element the library gives a font to; everything else inherits.
78
+ * This sits outside the @supports guard below, which is about progress() and
79
+ * not about fonts: a browser without it still gets the typeface.
80
+ */
81
+ body {
82
+ font-family: var(--nf-font-family);
83
+ font-weight: var(--nf-font-weight);
58
84
  }
59
85
 
60
- code {
61
- padding: 0.1em 0.3em;
62
- border-radius: var(--nf-radius-sm);
63
- background-color: var(--nf-color-surface);
64
- }
86
+ /*
87
+ * The scale is progressive enhancement. Without this guard, a browser with no
88
+ * progress() support still accepts the custom properties above — custom
89
+ * properties take arbitrary tokens — and fails later, on the calc() here. Since
90
+ * font-size inherits, every heading would then render at body size. Inside the
91
+ * guard such a browser simply keeps the sizes it already had.
92
+ */
93
+ @supports (font-size: calc(1rem + progress(100svw, 0px, 1px) * 1rem)) {
94
+ h1 {
95
+ font-size: var(--nf-typography-font-size-h1);
96
+ }
65
97
 
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
- }
98
+ h2 {
99
+ font-size: var(--nf-typography-font-size-h2);
100
+ }
72
101
 
73
- pre code {
74
- padding: 0;
75
- background: none;
76
- }
102
+ h3 {
103
+ font-size: var(--nf-typography-font-size-h3);
104
+ }
77
105
 
78
- small {
79
- font-size: var(--nf-font-size-sm);
80
- color: var(--nf-color-text-muted);
106
+ button,
107
+ p {
108
+ font-size: var(--nf-typography-font-size-base);
109
+ }
81
110
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared prop types for the library's components.
3
+ *
4
+ * Published components import this file by **relative** path, never through
5
+ * the `@/*` alias: the library ships source, and a consumer's TypeScript has
6
+ * no such alias, so an aliased import would resolve to `any` on their side and
7
+ * silently drop the prop's type checking.
8
+ */
9
+
10
+ /** The palette hues a component's `color` prop accepts. */
11
+ export type ColorPalette =
12
+ | "blue"
13
+ | "cyan"
14
+ | "green"
15
+ | "grey"
16
+ | "orange"
17
+ | "pink"
18
+ | "purple"
19
+ | "red"
20
+ | "yellow";
21
+
22
+ /**
23
+ * Any component a prop renders as an icon: an `.astro` file, an imported
24
+ * `.svg`, a framework component. The receiving component is never told what
25
+ * an icon is: it renders it with no props, or, where it fixes the icon's look
26
+ * (the navbar parts), with `width` and `height` of `1em` and a `stroke-width`
27
+ * of `2`, which an imported `.svg` honours and any other component may ignore.
28
+ */
29
+ export type IconComponent = (props: Record<string, any>) => any;
30
+
31
+ /**
32
+ * One link in a navigation list. `NavItemsDesktop` and `NavItemsMobile` both
33
+ * take an array of these, so the two lists can differ in items, order and icons.
34
+ */
35
+ export type NavItem = {
36
+ text: string;
37
+ href: string;
38
+ /** Rendered before the text, hidden from assistive technology. */
39
+ icon?: IconComponent;
40
+ /** Marks the link `aria-current="page"` and draws it in the active color. */
41
+ current?: boolean;
42
+ };
@@ -1,24 +0,0 @@
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
- }