@hugocxl/design-system 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/DESIGN.md +546 -0
- package/LICENSE +21 -0
- package/README.md +37 -2
- package/package.json +46 -4
- package/system/figures/LICENSE +21 -0
- package/system/figures/index.js +5950 -0
- package/system/fonts/Geist-LICENSE.txt +92 -0
- package/system/fonts/Geist-Variable.woff2 +0 -0
- package/system/fonts/GeistMono-Variable.woff2 +0 -0
- package/system/images/gray-folds.png +0 -0
- package/system/p9.css +240 -0
- package/system/p9.js +30 -0
- package/system/plan.schema.json +196 -0
- package/system/theme.js +13 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2023 Vercel, in collaboration with basement.studio
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/system/p9.css
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/* Design system — the only stylesheet a page built with the system loads. Values mirror the DESIGN.md front matter. */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: "Geist Sans";
|
|
4
|
+
src: url("fonts/Geist-Variable.woff2") format("woff2");
|
|
5
|
+
font-weight: 100 900;
|
|
6
|
+
font-display: swap;
|
|
7
|
+
}
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: "Geist Mono";
|
|
10
|
+
src: url("fonts/GeistMono-Variable.woff2") format("woff2");
|
|
11
|
+
font-weight: 100 900;
|
|
12
|
+
font-display: swap;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ─── Tokens ─────────────────────────────────────────────────────────── */
|
|
16
|
+
:root {
|
|
17
|
+
/* Palette: Superlogical paper and orange with neutral greys. Muted meets WCAG AA. */
|
|
18
|
+
--p9-canvas: #f5f5f4;
|
|
19
|
+
--p9-ink: #171717;
|
|
20
|
+
--p9-muted: #6e6e6e;
|
|
21
|
+
--p9-faint: #b3b3b3;
|
|
22
|
+
--p9-rule: #1717171f;
|
|
23
|
+
--p9-surface: #ebebea;
|
|
24
|
+
--p9-accent: #fe9369;
|
|
25
|
+
--p9-accent-text: #ce7755;
|
|
26
|
+
|
|
27
|
+
--p9-sans: "Geist Sans", Helvetica, Arial, sans-serif;
|
|
28
|
+
--p9-mono: "Geist Mono", ui-monospace, Menlo, monospace;
|
|
29
|
+
|
|
30
|
+
--p9-size-reading: min(calc(1rem + .36vw), 1.54rem);
|
|
31
|
+
--p9-size-title: calc(var(--p9-size-reading) * 1.4);
|
|
32
|
+
--p9-size-small: calc(var(--p9-size-reading) * .8);
|
|
33
|
+
--p9-size-control: 1rem;
|
|
34
|
+
--p9-size-mono: .9375rem;
|
|
35
|
+
--p9-size-label: .8125rem;
|
|
36
|
+
|
|
37
|
+
--p9-space-1: .25rem;
|
|
38
|
+
--p9-space-2: .5rem;
|
|
39
|
+
--p9-space-3: .75rem;
|
|
40
|
+
--p9-space-4: 1rem;
|
|
41
|
+
--p9-space-5: 1.25rem;
|
|
42
|
+
--p9-space-6: 2rem;
|
|
43
|
+
--p9-space-7: 2.5rem;
|
|
44
|
+
--p9-space-8: 3.5rem;
|
|
45
|
+
--p9-space-9: 5rem;
|
|
46
|
+
--p9-space-10: 8rem;
|
|
47
|
+
|
|
48
|
+
--p9-radius-control: 6px;
|
|
49
|
+
--p9-radius-media: 12px;
|
|
50
|
+
--p9-radius-pill: 999px;
|
|
51
|
+
--p9-target: 44px;
|
|
52
|
+
--p9-measure: 30em;
|
|
53
|
+
--p9-wide: 80rem;
|
|
54
|
+
--p9-ease: 120ms ease-out;
|
|
55
|
+
|
|
56
|
+
/* Hairline figure palette, derived from the theme. */
|
|
57
|
+
--hairline-plate: var(--p9-canvas);
|
|
58
|
+
--hairline-hi: var(--p9-ink);
|
|
59
|
+
--hairline-edge: color-mix(in srgb, var(--p9-ink) 45%, var(--p9-canvas));
|
|
60
|
+
--hairline-mid: color-mix(in srgb, var(--p9-ink) 22%, var(--p9-canvas));
|
|
61
|
+
--hairline-lo: color-mix(in srgb, var(--p9-ink) 10%, var(--p9-canvas));
|
|
62
|
+
|
|
63
|
+
accent-color: var(--p9-ink);
|
|
64
|
+
color-scheme: light;
|
|
65
|
+
}
|
|
66
|
+
:root[data-theme=dark] {
|
|
67
|
+
--p9-canvas: #111111;
|
|
68
|
+
--p9-ink: #ededed;
|
|
69
|
+
--p9-muted: #7d7d7d;
|
|
70
|
+
--p9-faint: #737373;
|
|
71
|
+
--p9-rule: #ededed24;
|
|
72
|
+
--p9-surface: #1c1c1c;
|
|
73
|
+
--p9-accent-text: #fe9369;
|
|
74
|
+
color-scheme: dark;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ─── Shell and layout ───────────────────────────────────────────────── */
|
|
78
|
+
.p9 {
|
|
79
|
+
--p9-gutter: clamp(1.25rem, 4.5vw, 4rem);
|
|
80
|
+
--p9-field: 0px;
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
margin: 0;
|
|
83
|
+
padding: 0 calc(var(--p9-field) + var(--p9-gutter)) 0 var(--p9-gutter);
|
|
84
|
+
color: var(--p9-ink);
|
|
85
|
+
background: var(--p9-canvas);
|
|
86
|
+
font: 300 var(--p9-size-reading)/1.3 var(--p9-sans);
|
|
87
|
+
letter-spacing: -.01em;
|
|
88
|
+
-webkit-font-smoothing: antialiased;
|
|
89
|
+
}
|
|
90
|
+
.p9 *, .p9 *::before, .p9 *::after { box-sizing: border-box }
|
|
91
|
+
.p9 main { container-type: inline-size }
|
|
92
|
+
.p9 :where(h1, h2, h3, p, ol, ul, figure, pre, table) { margin: 0 }
|
|
93
|
+
.p9[data-layout=field] { --p9-field: clamp(30vw, calc(100vw - 2 * var(--p9-gutter) - 47.6rem), 40vw) }
|
|
94
|
+
.p9[data-layout=field]::after {
|
|
95
|
+
content: "";
|
|
96
|
+
position: fixed;
|
|
97
|
+
inset: 12px 12px 12px auto;
|
|
98
|
+
width: calc(var(--p9-field) - 12px);
|
|
99
|
+
border-radius: var(--p9-radius-media);
|
|
100
|
+
background: #777 url("images/gray-folds.png") center / cover;
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
}
|
|
103
|
+
.p9-column { max-width: var(--p9-measure); margin-inline: auto }
|
|
104
|
+
.p9[data-layout=field] .p9-column { margin-inline: 0 }
|
|
105
|
+
.p9-opening { padding-top: clamp(var(--p9-space-9), 8vw, var(--p9-space-10)) }
|
|
106
|
+
.p9-wide {
|
|
107
|
+
width: min(100cqw, var(--p9-wide));
|
|
108
|
+
margin-block: var(--p9-space-8);
|
|
109
|
+
margin-inline: calc((100% - min(100cqw, var(--p9-wide))) / 2);
|
|
110
|
+
}
|
|
111
|
+
.p9[data-layout=field] .p9-wide { margin-inline: 0 }
|
|
112
|
+
@media (max-width: 760px) {
|
|
113
|
+
.p9[data-layout=field] { --p9-field: 20px }
|
|
114
|
+
.p9[data-layout=field]::after { inset: 6px 5px 6px auto; width: 12px; border-radius: 5px }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ─── Text ───────────────────────────────────────────────────────────── */
|
|
118
|
+
.p9 :where(h1, h2, h3) { font: inherit; letter-spacing: inherit }
|
|
119
|
+
.p9 :where(p, ul, ol, .p9-code, .p9-table, .p9-table-scroll) + :where(p, ul, ol, .p9-code, .p9-table, .p9-table-scroll) { margin-top: var(--p9-space-5) }
|
|
120
|
+
.p9 p { text-wrap: pretty }
|
|
121
|
+
.p9-section :where(ul:not([class]), ol:not([class])) { padding-left: 1.2em }
|
|
122
|
+
.p9-section :where(ul:not([class]), ol:not([class])) > li + li { margin-top: var(--p9-space-2) }
|
|
123
|
+
.p9 strong { font-weight: 500 }
|
|
124
|
+
.p9 a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: .2em }
|
|
125
|
+
.p9 a:hover { text-decoration-color: currentColor }
|
|
126
|
+
.p9 :where(code, kbd, samp) { font-family: var(--p9-mono); font-size: .85em; font-weight: 400; letter-spacing: 0 }
|
|
127
|
+
.p9 :focus-visible { outline: 2px solid var(--p9-ink); outline-offset: 3px }
|
|
128
|
+
.p9-muted { color: var(--p9-muted) }
|
|
129
|
+
.p9-accent { color: var(--p9-accent-text) }
|
|
130
|
+
.p9-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0 }
|
|
131
|
+
|
|
132
|
+
.p9-title { font-size: var(--p9-size-title); font-weight: 500; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance }
|
|
133
|
+
.p9-title > * { display: block }
|
|
134
|
+
.p9-title > :not(:first-child) { color: var(--p9-muted) }
|
|
135
|
+
.p9-statement { font-size: var(--p9-size-title); font-weight: 500; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance }
|
|
136
|
+
|
|
137
|
+
.p9-section { margin-top: var(--p9-space-7); scroll-margin-top: var(--p9-space-6) }
|
|
138
|
+
.p9-section > h2 { margin-bottom: var(--p9-space-4); color: var(--p9-muted); font-weight: 400 }
|
|
139
|
+
.p9-section h3 { font-weight: 400 }
|
|
140
|
+
|
|
141
|
+
.p9-label { font: 400 var(--p9-size-label)/1.5 var(--p9-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--p9-muted) }
|
|
142
|
+
.p9-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--p9-space-2) var(--p9-space-5); margin-top: var(--p9-space-6); list-style: none; padding: 0 }
|
|
143
|
+
.p9-meta + * { margin-top: var(--p9-space-8) }
|
|
144
|
+
.p9-dot { display: inline-block; width: .5rem; height: .5rem; margin-right: var(--p9-space-2); border-radius: 50%; background: var(--p9-accent); vertical-align: .05em }
|
|
145
|
+
|
|
146
|
+
/* ─── Masthead and footer ────────────────────────────────────────────── */
|
|
147
|
+
.p9-masthead { display: flex; align-items: center; gap: var(--p9-space-5); padding-top: var(--p9-space-6); font-size: var(--p9-size-small) }
|
|
148
|
+
.p9-masthead a { display: inline-flex; align-items: center; min-height: var(--p9-target); text-decoration: none }
|
|
149
|
+
.p9-masthead a:hover { text-decoration: underline }
|
|
150
|
+
.p9-wordmark { margin-right: auto; font-size: 1.125rem; font-weight: 600; letter-spacing: -.055em }
|
|
151
|
+
.p9-masthead .p9-wordmark:hover { text-decoration: none }
|
|
152
|
+
@media (max-width: 480px) { .p9-masthead { gap: var(--p9-space-3) } }
|
|
153
|
+
.p9-theme { flex: none; width: var(--p9-target); height: var(--p9-target); border: 1px solid var(--p9-rule); border-radius: 50%; color: inherit; background: transparent; font: inherit; cursor: pointer }
|
|
154
|
+
|
|
155
|
+
.p9-footer { display: flex; align-items: center; gap: var(--p9-space-5); margin-top: var(--p9-space-9); padding-bottom: var(--p9-space-7); font: 400 var(--p9-size-mono)/1.4 var(--p9-mono); letter-spacing: 0 }
|
|
156
|
+
.p9-footer::before { content: ""; order: 1; flex: 1; min-width: var(--p9-space-6); border-top: 1px solid var(--p9-rule) }
|
|
157
|
+
.p9-footer ul { display: flex; flex-wrap: wrap; gap: var(--p9-space-2) var(--p9-space-5); margin: 0; padding: 0; list-style: none }
|
|
158
|
+
.p9-footer ul:last-child { order: 2 }
|
|
159
|
+
.p9-footer li + li { margin-top: 0 }
|
|
160
|
+
.p9-footer a { text-decoration: none }
|
|
161
|
+
.p9-footer a:hover { text-decoration: underline }
|
|
162
|
+
|
|
163
|
+
/* ─── Figures ────────────────────────────────────────────────────────── */
|
|
164
|
+
.p9-media { display: grid; place-items: center; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--p9-radius-media); background: var(--p9-surface); --hairline-plate: var(--p9-surface) }
|
|
165
|
+
.p9-media > [data-figure] { width: auto; height: 82%; max-width: 92%; aspect-ratio: 5 / 4 }
|
|
166
|
+
.p9-media > img { width: 100%; height: 100%; object-fit: cover }
|
|
167
|
+
.p9-caption { display: flex; align-items: center; justify-content: space-between; gap: var(--p9-space-4); min-height: var(--p9-target); margin-top: var(--p9-space-3) }
|
|
168
|
+
|
|
169
|
+
.p9-grid { display: grid; grid-template-columns: repeat(var(--p9-cols, 3), minmax(0, 1fr)); list-style: none; padding: 0 }
|
|
170
|
+
.p9-grid[data-columns="2"] { --p9-cols: 2 }
|
|
171
|
+
.p9-grid[data-columns="4"] { --p9-cols: 4 }
|
|
172
|
+
.p9-grid > li { display: flex; flex-direction: column; padding: 0 var(--p9-space-6) }
|
|
173
|
+
.p9-grid > li:first-child { padding-left: 0 }
|
|
174
|
+
.p9-grid > li:last-child { padding-right: 0 }
|
|
175
|
+
.p9-grid > li + li { border-left: 1px solid var(--p9-rule) }
|
|
176
|
+
.p9-grid [data-figure] { width: 100%; aspect-ratio: 5 / 4; margin-block: var(--p9-space-5) }
|
|
177
|
+
.p9-grid h3 { margin-top: auto; font-weight: 400 }
|
|
178
|
+
.p9-grid p { margin-top: var(--p9-space-2); font-size: var(--p9-size-small); line-height: 1.4; color: var(--p9-muted) }
|
|
179
|
+
@container (max-width: 34rem) {
|
|
180
|
+
.p9-grid { grid-template-columns: minmax(0, 1fr) }
|
|
181
|
+
.p9-grid > li { padding: var(--p9-space-5) 0 }
|
|
182
|
+
.p9-grid > li + li { border-left: 0; border-top: 1px solid var(--p9-rule) }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* ─── Index list and table ───────────────────────────────────────────── */
|
|
186
|
+
.p9-index { list-style: none; padding: 0; border-bottom: 1px solid var(--p9-rule) }
|
|
187
|
+
.p9-index > li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--p9-space-2) var(--p9-space-5); padding-block: var(--p9-space-5); border-top: 1px solid var(--p9-rule) }
|
|
188
|
+
.p9-index .p9-label { padding-top: .35em }
|
|
189
|
+
.p9-index h3 { font-weight: 400 }
|
|
190
|
+
.p9-index p { margin-top: var(--p9-space-2); color: var(--p9-muted) }
|
|
191
|
+
@container (max-width: 30rem) { .p9-index > li { grid-template-columns: minmax(0, 1fr) } }
|
|
192
|
+
|
|
193
|
+
.p9-table { width: 100%; border-collapse: collapse; font-size: var(--p9-size-small); font-variant-numeric: tabular-nums }
|
|
194
|
+
.p9-table th { font: 400 var(--p9-size-label)/1.5 var(--p9-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--p9-muted); text-align: left }
|
|
195
|
+
.p9-table :where(th, td) { padding: var(--p9-space-3) var(--p9-space-4) var(--p9-space-3) 0; border-bottom: 1px solid var(--p9-rule); vertical-align: top }
|
|
196
|
+
.p9-table tbody th { font: inherit; letter-spacing: inherit; text-transform: none; color: var(--p9-ink) }
|
|
197
|
+
.p9-table-scroll { overflow-x: auto }
|
|
198
|
+
|
|
199
|
+
/* ─── Controls ───────────────────────────────────────────────────────── */
|
|
200
|
+
.p9-button { display: inline-flex; align-items: center; gap: var(--p9-space-3); min-height: var(--p9-target); padding: 0 var(--p9-space-5); border: 0; border-radius: var(--p9-radius-control); color: var(--p9-canvas); background: var(--p9-ink); font: 400 var(--p9-size-control)/1 var(--p9-sans); letter-spacing: -.01em; text-decoration: none; cursor: pointer }
|
|
201
|
+
.p9 a.p9-button { color: var(--p9-canvas); text-decoration: none }
|
|
202
|
+
.p9-button:hover { opacity: .84 }
|
|
203
|
+
|
|
204
|
+
.p9-form { margin-top: var(--p9-space-7) }
|
|
205
|
+
.p9-form label { display: block }
|
|
206
|
+
.p9-input { display: flex; align-items: center; max-width: 20em; margin-top: var(--p9-space-4); border-bottom: 1px solid var(--p9-rule) }
|
|
207
|
+
.p9-input:hover, .p9-input:focus-within { border-color: color-mix(in srgb, var(--p9-ink) 40%, transparent) }
|
|
208
|
+
.p9-input input { flex: 1; min-width: 0; min-height: var(--p9-target); padding: 0; border: 0; border-radius: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; appearance: none }
|
|
209
|
+
.p9-input input::placeholder { color: var(--p9-faint) }
|
|
210
|
+
.p9-input input:focus-visible { outline: none }
|
|
211
|
+
.p9-input:has(input:focus-visible) { outline: 2px solid var(--p9-ink); outline-offset: 3px }
|
|
212
|
+
.p9-input input[aria-invalid=true] { text-decoration: underline wavy var(--p9-muted) 1px; text-underline-offset: .25em }
|
|
213
|
+
.p9-input button { flex: none; width: var(--p9-target); height: var(--p9-target); padding: 0; border: 0; color: var(--p9-muted); background: transparent; font: inherit; cursor: pointer }
|
|
214
|
+
.p9-input button:hover { color: var(--p9-ink) }
|
|
215
|
+
.p9-help { margin-top: var(--p9-space-5); color: var(--p9-muted) }
|
|
216
|
+
.p9-feedback { display: block; margin-top: var(--p9-space-3); font-size: var(--p9-size-small) }
|
|
217
|
+
.p9-feedback:empty { display: none }
|
|
218
|
+
|
|
219
|
+
.p9-code { position: relative; border-radius: var(--p9-radius-control); background: var(--p9-surface) }
|
|
220
|
+
.p9-code pre { padding: var(--p9-space-4) var(--p9-space-5); overflow-x: auto; font: 400 .8125rem/1.6 var(--p9-mono); letter-spacing: 0 }
|
|
221
|
+
.p9-code pre code { font-size: inherit }
|
|
222
|
+
.p9-code button { position: absolute; top: 0; right: 0; min-width: var(--p9-target); min-height: var(--p9-target); padding: 0 var(--p9-space-3); border: 0; border-radius: var(--p9-radius-control); color: var(--p9-ink); background: var(--p9-surface); font: 400 var(--p9-size-label)/1 var(--p9-mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer }
|
|
223
|
+
.p9-code button:hover { text-decoration: underline }
|
|
224
|
+
|
|
225
|
+
.p9-pager { display: inline-flex; padding: 2px; border: 1px solid var(--p9-rule); border-radius: var(--p9-radius-pill); background: var(--p9-canvas) }
|
|
226
|
+
.p9-pager button { width: var(--p9-target); height: var(--p9-target); padding: 0; border: 0; border-radius: 50%; color: inherit; background: transparent; font: 400 1.1rem/1 var(--p9-sans); cursor: pointer }
|
|
227
|
+
.p9-pager button:hover { background: var(--p9-surface) }
|
|
228
|
+
|
|
229
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
230
|
+
.p9-button, .p9-pager button, .p9-input { transition: transform var(--p9-ease), background-color var(--p9-ease), border-color var(--p9-ease), opacity var(--p9-ease) }
|
|
231
|
+
.p9-button:active, .p9-pager button:active { transform: scale(.96) }
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Icons from @hugocxl/icons (Stroke): inline before a link, button or label, at the size and color of its text. */
|
|
235
|
+
.p9-icon { display: inline-block; width: 1em; height: 1em; margin-inline-end: var(--p9-space-2); vertical-align: -.125em; flex: none }
|
|
236
|
+
|
|
237
|
+
/* Vectors from @hugocxl/vectors: a 4:3 line illustration in place of a drawing, in ink. */
|
|
238
|
+
.p9-vector { display: block; color: var(--p9-ink) }
|
|
239
|
+
.p9-media > .p9-vector { width: auto; height: 82%; max-width: 92%; aspect-ratio: 4 / 3 }
|
|
240
|
+
.p9-grid .p9-vector { width: 100%; height: auto; aspect-ratio: 4 / 3; margin-block: var(--p9-space-5) }
|
package/system/p9.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Design system runtime: mounts [data-figure] drawings and wires .p9-code copy buttons.
|
|
2
|
+
import * as figures from './figures/index.js';
|
|
3
|
+
|
|
4
|
+
const mounted = new Map();
|
|
5
|
+
|
|
6
|
+
export function show(element, name) {
|
|
7
|
+
mounted.get(element)?.destroy();
|
|
8
|
+
element.dataset.figure = name;
|
|
9
|
+
mounted.set(element, figures[name](element));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function mountFigures(root = document) {
|
|
13
|
+
for (const element of root.querySelectorAll('[data-figure]')) {
|
|
14
|
+
if (!mounted.has(element) && figures[element.dataset.figure]) show(element, element.dataset.figure);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
document.addEventListener('click', async event => {
|
|
19
|
+
const button = event.target.closest('.p9-code button');
|
|
20
|
+
if (!button) return;
|
|
21
|
+
try {
|
|
22
|
+
await navigator.clipboard.writeText(button.closest('.p9-code').querySelector('pre').textContent);
|
|
23
|
+
button.textContent = 'Copied';
|
|
24
|
+
} catch {
|
|
25
|
+
button.textContent = 'Select to copy';
|
|
26
|
+
}
|
|
27
|
+
setTimeout(() => { button.textContent = 'Copy' }, 1600);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
mountFigures();
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hugocxl.github.io/design-system/system/plan.schema.json",
|
|
4
|
+
"title": "Design system page plan",
|
|
5
|
+
"description": "One page as data. Render each block by copying its component markup from DESIGN.md and replacing only the slot values.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["designRevision", "recipe", "layout", "blocks"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"designRevision": { "type": "string", "pattern": "^[0-9a-f]{7,40}$" },
|
|
11
|
+
"recipe": { "enum": ["home", "article", "docs", "changelog", "pricing", "contact"] },
|
|
12
|
+
"layout": { "enum": ["field", "plain"] },
|
|
13
|
+
"lang": { "type": "string", "default": "en" },
|
|
14
|
+
"pageTitle": { "type": "string", "maxLength": 70 },
|
|
15
|
+
"description": { "type": "string", "maxLength": 160 },
|
|
16
|
+
"blocks": { "type": "array", "minItems": 3, "items": { "$ref": "#/$defs/block" } }
|
|
17
|
+
},
|
|
18
|
+
"allOf": [
|
|
19
|
+
{ "if": { "properties": { "recipe": { "const": "home" } } }, "then": { "properties": { "layout": { "const": "field" } } }, "else": { "properties": { "layout": { "const": "plain" } } } }
|
|
20
|
+
],
|
|
21
|
+
"$defs": {
|
|
22
|
+
"text": { "type": "string", "minLength": 1 },
|
|
23
|
+
"link": {
|
|
24
|
+
"type": "object", "required": ["label", "href"], "additionalProperties": false,
|
|
25
|
+
"properties": { "label": { "$ref": "#/$defs/text" }, "href": { "$ref": "#/$defs/text" }, "icon": { "$ref": "#/$defs/icon" } }
|
|
26
|
+
},
|
|
27
|
+
"icon": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "description": "A Stroke icon from @hugocxl/icons, rendered before the words with class p9-icon." },
|
|
28
|
+
"vector": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "description": "An illustration from @hugocxl/vectors, inlined with class p9-vector." },
|
|
29
|
+
"figure": {
|
|
30
|
+
"enum": ["basket", "branches", "cabinet", "dish", "drawer", "elevator", "exploded", "format", "hub", "keyboard", "laptop", "lockers", "loupe", "padlock", "patch", "phone", "phosphor", "plot", "plug", "query", "rail", "rebuild", "relay", "riffle", "router", "settle", "sieve", "slow", "stack", "terminal", "terrain", "turntable", "vault"]
|
|
31
|
+
},
|
|
32
|
+
"paragraph": {
|
|
33
|
+
"type": "object", "required": ["text"], "additionalProperties": false,
|
|
34
|
+
"description": "Inline links use Markdown [label](href). 'muted' is appended in the muted color after 'text'.",
|
|
35
|
+
"properties": { "text": { "$ref": "#/$defs/text" }, "muted": { "type": "string" } }
|
|
36
|
+
},
|
|
37
|
+
"block": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"required": ["component"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"component": { "enum": ["masthead", "title", "statement", "meta", "section", "figure-wide", "figure-grid", "index", "table", "button", "form", "code", "footer"] }
|
|
42
|
+
},
|
|
43
|
+
"oneOf": [
|
|
44
|
+
{ "$ref": "#/$defs/masthead" }, { "$ref": "#/$defs/title" }, { "$ref": "#/$defs/statement" },
|
|
45
|
+
{ "$ref": "#/$defs/meta" }, { "$ref": "#/$defs/section" }, { "$ref": "#/$defs/figure-wide" },
|
|
46
|
+
{ "$ref": "#/$defs/figure-grid" }, { "$ref": "#/$defs/index" }, { "$ref": "#/$defs/table" },
|
|
47
|
+
{ "$ref": "#/$defs/button" }, { "$ref": "#/$defs/form" }, { "$ref": "#/$defs/code" },
|
|
48
|
+
{ "$ref": "#/$defs/footer" }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"masthead": {
|
|
52
|
+
"type": "object", "required": ["component", "wordmark"], "additionalProperties": false,
|
|
53
|
+
"properties": {
|
|
54
|
+
"component": { "const": "masthead" },
|
|
55
|
+
"wordmark": { "$ref": "#/$defs/text" },
|
|
56
|
+
"links": { "type": "array", "maxItems": 3, "items": { "$ref": "#/$defs/link" } }
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"title": {
|
|
60
|
+
"type": "object", "required": ["component", "heading"], "additionalProperties": false,
|
|
61
|
+
"properties": {
|
|
62
|
+
"component": { "const": "title" },
|
|
63
|
+
"heading": { "type": "string", "minLength": 1, "maxLength": 60 },
|
|
64
|
+
"byline": { "type": "string", "maxLength": 80 }
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"statement": {
|
|
68
|
+
"type": "object", "required": ["component", "text"], "additionalProperties": false,
|
|
69
|
+
"properties": {
|
|
70
|
+
"component": { "const": "statement" },
|
|
71
|
+
"text": { "type": "string", "minLength": 1, "maxLength": 90 },
|
|
72
|
+
"accent": { "type": "string", "maxLength": 30, "description": "Two or three words appended after 'text' in the accent color." }
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"meta": {
|
|
76
|
+
"type": "object", "required": ["component", "items"], "additionalProperties": false,
|
|
77
|
+
"properties": {
|
|
78
|
+
"component": { "const": "meta" },
|
|
79
|
+
"status": { "type": "string", "maxLength": 20, "description": "Rendered first, with the accent dot." },
|
|
80
|
+
"items": { "type": "array", "minItems": 1, "maxItems": 3, "items": { "type": "string", "maxLength": 30 } }
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"section": {
|
|
84
|
+
"type": "object", "required": ["component", "content"], "additionalProperties": false,
|
|
85
|
+
"properties": {
|
|
86
|
+
"component": { "const": "section" },
|
|
87
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
|
|
88
|
+
"heading": { "type": "string", "maxLength": 40 },
|
|
89
|
+
"content": {
|
|
90
|
+
"type": "array", "minItems": 1,
|
|
91
|
+
"items": {
|
|
92
|
+
"oneOf": [
|
|
93
|
+
{ "$ref": "#/$defs/paragraph" },
|
|
94
|
+
{ "type": "object", "required": ["list"], "additionalProperties": false, "properties": { "list": { "type": "array", "minItems": 2, "items": { "$ref": "#/$defs/text" } }, "ordered": { "type": "boolean" } } },
|
|
95
|
+
{ "$ref": "#/$defs/code" },
|
|
96
|
+
{ "$ref": "#/$defs/table" }
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"figure-wide": {
|
|
103
|
+
"type": "object", "required": ["component", "caption"], "additionalProperties": false,
|
|
104
|
+
"properties": {
|
|
105
|
+
"component": { "const": "figure-wide" },
|
|
106
|
+
"figure": { "$ref": "#/$defs/figure" },
|
|
107
|
+
"vector": { "$ref": "#/$defs/vector" },
|
|
108
|
+
"image": { "type": "object", "required": ["src", "alt"], "additionalProperties": false, "properties": { "src": { "$ref": "#/$defs/text" }, "alt": { "$ref": "#/$defs/text" } } },
|
|
109
|
+
"label": { "type": "string", "description": "aria-label for a drawing or vector." },
|
|
110
|
+
"caption": { "type": "string", "pattern": "^Fig\\. [0-9]{2} / .+$" }
|
|
111
|
+
},
|
|
112
|
+
"oneOf": [{ "required": ["figure", "label"] }, { "required": ["vector"] }, { "required": ["image"] }]
|
|
113
|
+
},
|
|
114
|
+
"figure-grid": {
|
|
115
|
+
"type": "object", "required": ["component", "items"], "additionalProperties": false,
|
|
116
|
+
"properties": {
|
|
117
|
+
"component": { "const": "figure-grid" },
|
|
118
|
+
"items": {
|
|
119
|
+
"type": "array", "minItems": 2, "maxItems": 4,
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "object", "required": ["label", "title", "text"], "additionalProperties": false,
|
|
122
|
+
"oneOf": [{ "required": ["figure"] }, { "required": ["vector"] }],
|
|
123
|
+
"properties": {
|
|
124
|
+
"figure": { "$ref": "#/$defs/figure" },
|
|
125
|
+
"vector": { "$ref": "#/$defs/vector" },
|
|
126
|
+
"label": { "type": "string", "description": "aria-label for the drawing or vector." },
|
|
127
|
+
"title": { "type": "string", "maxLength": 32 },
|
|
128
|
+
"text": { "type": "string", "maxLength": 90 }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"index": {
|
|
135
|
+
"type": "object", "required": ["component", "items"], "additionalProperties": false,
|
|
136
|
+
"properties": {
|
|
137
|
+
"component": { "const": "index" },
|
|
138
|
+
"items": {
|
|
139
|
+
"type": "array", "minItems": 1,
|
|
140
|
+
"items": {
|
|
141
|
+
"type": "object", "required": ["label", "title"], "additionalProperties": false,
|
|
142
|
+
"properties": {
|
|
143
|
+
"label": { "type": "string", "maxLength": 16, "description": "Number, date or price." },
|
|
144
|
+
"datetime": { "type": "string", "format": "date" },
|
|
145
|
+
"title": { "$ref": "#/$defs/text" },
|
|
146
|
+
"text": { "type": "string" }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"table": {
|
|
153
|
+
"type": "object", "required": ["component", "columns", "rows"], "additionalProperties": false,
|
|
154
|
+
"properties": {
|
|
155
|
+
"component": { "const": "table" },
|
|
156
|
+
"columns": { "type": "array", "minItems": 2, "items": { "$ref": "#/$defs/text" } },
|
|
157
|
+
"rows": { "type": "array", "minItems": 1, "items": { "type": "array", "minItems": 2, "items": { "type": "string" } } }
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"button": {
|
|
161
|
+
"type": "object", "required": ["component", "label"], "additionalProperties": false,
|
|
162
|
+
"properties": {
|
|
163
|
+
"component": { "const": "button" },
|
|
164
|
+
"label": { "type": "string", "maxLength": 32 },
|
|
165
|
+
"icon": { "$ref": "#/$defs/icon" },
|
|
166
|
+
"href": { "type": "string", "description": "Present for navigation (anchor); absent for an in-place action (button)." }
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"form": {
|
|
170
|
+
"type": "object", "required": ["component", "id", "label", "type", "action", "submitLabel"], "additionalProperties": false,
|
|
171
|
+
"properties": {
|
|
172
|
+
"component": { "const": "form" },
|
|
173
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
|
|
174
|
+
"label": { "$ref": "#/$defs/text" },
|
|
175
|
+
"type": { "enum": ["email", "text", "search", "url", "tel"] },
|
|
176
|
+
"name": { "type": "string" },
|
|
177
|
+
"placeholder": { "type": "string" },
|
|
178
|
+
"action": { "$ref": "#/$defs/text" },
|
|
179
|
+
"submitLabel": { "type": "string", "description": "Accessible name of the icon submit button." },
|
|
180
|
+
"help": { "type": "string" }
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"code": {
|
|
184
|
+
"type": "object", "required": ["component", "code"], "additionalProperties": false,
|
|
185
|
+
"properties": { "component": { "const": "code" }, "code": { "$ref": "#/$defs/text" } }
|
|
186
|
+
},
|
|
187
|
+
"footer": {
|
|
188
|
+
"type": "object", "required": ["component", "start", "end"], "additionalProperties": false,
|
|
189
|
+
"properties": {
|
|
190
|
+
"component": { "const": "footer" },
|
|
191
|
+
"start": { "type": "array", "maxItems": 3, "items": { "$ref": "#/$defs/link" } },
|
|
192
|
+
"end": { "type": "array", "maxItems": 3, "items": { "$ref": "#/$defs/link" } }
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
package/system/theme.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Follow the system appearance until the visitor picks one with a [data-p9-theme] button.
|
|
2
|
+
const preference = window.matchMedia('(prefers-color-scheme: dark)');
|
|
3
|
+
function applyTheme() {
|
|
4
|
+
document.documentElement.dataset.theme = localStorage.getItem('p9-theme') || (preference.matches ? 'dark' : 'light');
|
|
5
|
+
}
|
|
6
|
+
applyTheme();
|
|
7
|
+
preference.addEventListener('change', applyTheme);
|
|
8
|
+
|
|
9
|
+
document.addEventListener('click', event => {
|
|
10
|
+
if (!event.target.closest('[data-p9-theme]')) return;
|
|
11
|
+
localStorage.setItem('p9-theme', document.documentElement.dataset.theme === 'light' ? 'dark' : 'light');
|
|
12
|
+
applyTheme();
|
|
13
|
+
});
|