@fusion.dev/helix-templates 0.139.0 → 0.141.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/dist/index.js +6 -6
- package/package.json +1 -1
- package/templates/angular/src/app/data.ts +17 -17
- package/templates/angular/src/app/docs.ts +9 -9
- package/templates/angular/src/app/landing.html +39 -74
- package/templates/angular/src/app/landing.ts +0 -2
- package/templates/angular/src/app/overview.html +2 -2
- package/templates/angular/src/app/pathname.ts +1 -1
- package/templates/angular/src/app/signup-form.html +13 -14
- package/templates/angular/src/app/site-footer.html +3 -6
- package/templates/angular/src/app/site-footer.ts +2 -2
- package/templates/angular/src/app/site-header.html +3 -6
- package/templates/angular/src/app/site-header.ts +2 -3
- package/templates/angular/src/app.css +151 -158
- package/templates/react-nextjs/app/app.css +151 -158
- package/templates/react-nextjs/app/data.ts +17 -17
- package/templates/react-nextjs/app/docs.ts +9 -9
- package/templates/react-nextjs/app/landing.tsx +66 -128
- package/templates/react-nextjs/app/overview.tsx +24 -26
- package/templates/react-nextjs/app/signup-form.tsx +36 -40
- package/templates/react-nextjs/app/site-footer.tsx +9 -15
- package/templates/react-nextjs/app/site-header.tsx +18 -26
- package/templates/react-nextjs/helix-jsx.d.ts +5 -7
- package/templates/react-nextjs/tsconfig.json +4 -1
- package/templates/react-vite/helix-jsx.d.ts +5 -7
- package/templates/react-vite/src/app.css +151 -158
- package/templates/react-vite/src/data.ts +17 -17
- package/templates/react-vite/src/docs.ts +9 -9
- package/templates/react-vite/src/landing.tsx +66 -128
- package/templates/react-vite/src/overview.tsx +24 -26
- package/templates/react-vite/src/routes.tsx +11 -13
- package/templates/react-vite/src/signup-form.tsx +36 -40
- package/templates/react-vite/src/site-footer.tsx +9 -15
- package/templates/react-vite/src/site-header.tsx +16 -24
- package/templates/solid-vite/src/app.css +151 -158
- package/templates/solid-vite/src/data.ts +17 -17
- package/templates/solid-vite/src/docs.ts +9 -9
- package/templates/solid-vite/src/landing.tsx +54 -105
- package/templates/solid-vite/src/overview.tsx +2 -2
- package/templates/solid-vite/src/routes.ts +6 -6
- package/templates/solid-vite/src/signup-form.tsx +14 -14
- package/templates/solid-vite/src/site-footer.tsx +5 -8
- package/templates/solid-vite/src/site-header.tsx +5 -9
- package/templates/svelte-vite/src/Landing.svelte +39 -76
- package/templates/svelte-vite/src/Overview.svelte +2 -2
- package/templates/svelte-vite/src/SignupForm.svelte +13 -14
- package/templates/svelte-vite/src/SiteFooter.svelte +5 -8
- package/templates/svelte-vite/src/SiteHeader.svelte +5 -8
- package/templates/svelte-vite/src/app.css +151 -158
- package/templates/svelte-vite/src/data.ts +17 -17
- package/templates/svelte-vite/src/docs.ts +9 -9
- package/templates/svelte-vite/src/routes.svelte.ts +5 -5
- package/templates/vue-vite/src/LandingPage.vue +39 -76
- package/templates/vue-vite/src/OverviewPage.vue +2 -2
- package/templates/vue-vite/src/SignupForm.vue +14 -14
- package/templates/vue-vite/src/SiteFooter.vue +5 -8
- package/templates/vue-vite/src/SiteHeader.vue +5 -9
- package/templates/vue-vite/src/app.css +151 -158
- package/templates/vue-vite/src/data.ts +17 -17
- package/templates/vue-vite/src/docs.ts +9 -9
- package/templates/vue-vite/src/routes.ts +6 -6
- package/templates.json +4 -10
|
@@ -3,43 +3,43 @@ import { roster } from './data'
|
|
|
3
3
|
import { DOCS } from './docs'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* **A locale named
|
|
7
|
-
* argument reads the
|
|
8
|
-
* and the
|
|
9
|
-
* markup React hydrates does not match the markup it
|
|
6
|
+
* **A locale named, so the number reads the same everywhere.**
|
|
7
|
+
* `toLocaleString()` with no argument reads the machine's locale: the server's
|
|
8
|
+
* in the Next.js template, and the browser's in both. The same number is then
|
|
9
|
+
* grouped two ways, and the markup React hydrates does not match the markup it
|
|
10
|
+
* rendered.
|
|
10
11
|
*/
|
|
11
12
|
const figure = new Intl.NumberFormat('en-US')
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* The first screen, and the only page here
|
|
15
|
-
* than built out of it.
|
|
15
|
+
* The first screen, and the only page here about the starter itself.
|
|
16
16
|
*
|
|
17
17
|
* Delete it once you know your way around: nothing else imports it, and the
|
|
18
18
|
* route it answers becomes yours.
|
|
19
19
|
*
|
|
20
|
-
* **The
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* **Anchors, not a `Button` with an `href`.** A button that navigates is a link
|
|
26
|
-
* wearing a button's clothes, and the two are different things to a keyboard and
|
|
27
|
-
* to a screen reader. The base stylesheet styles an anchor that asks with
|
|
28
|
-
* `data-button`, so a link can look like one without being one.
|
|
20
|
+
* **The calls to action are anchors.** A button that navigates is a link
|
|
21
|
+
* dressed as a button, and the two are different things to a keyboard and to
|
|
22
|
+
* a screen reader. The base stylesheet styles an anchor that asks with
|
|
23
|
+
* `data-button`, so a link can look like one and stay a link.
|
|
29
24
|
*/
|
|
30
25
|
export function Landing() {
|
|
31
26
|
return (
|
|
32
27
|
<div className="stack">
|
|
33
28
|
<header className="first-screen">
|
|
29
|
+
{/* **The light behind the first screen**: a helix, drawn by the library
|
|
30
|
+
in the theme's colors, so a new brand color relights it. It shows
|
|
31
|
+
one still frame where motion is reduced, and a gradient where the
|
|
32
|
+
browser draws without a GPU. */}
|
|
33
|
+
<helix-aura className="first-light" data-layer speed={0.4} terminus={0.8} variant="braid" />
|
|
34
34
|
<div className="hero">
|
|
35
|
-
<helix-
|
|
36
|
-
|
|
35
|
+
<helix-tag emphasis="subtle" tone="primary">
|
|
36
|
+
Starter
|
|
37
|
+
</helix-tag>
|
|
38
|
+
<helix-text as="h1" variant="display">
|
|
39
|
+
Helix design system
|
|
37
40
|
</helix-text>
|
|
38
|
-
<helix-text as="
|
|
39
|
-
|
|
40
|
-
Nothing here is a wrapper: the tags are the library's own elements, and every color,
|
|
41
|
-
size and space inside them comes from one set of tokens. Three routes are laid down, and
|
|
42
|
-
all of them are yours.
|
|
41
|
+
<helix-text as="p" className="lede" variant="body">
|
|
42
|
+
Web components in your brand's colors, drawn from one set of tokens.
|
|
43
43
|
</helix-text>
|
|
44
44
|
<div className="actions">
|
|
45
45
|
<Link data-button="solid" data-button-tone="primary" href="/overview">
|
|
@@ -51,17 +51,13 @@ export function Landing() {
|
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
53
53
|
|
|
54
|
-
{/* **
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<helix-text as="h2" slot="header" variant="title">
|
|
62
|
-
The roster, in three figures
|
|
63
|
-
</helix-text>
|
|
64
|
-
<helix-stat-group divided>
|
|
54
|
+
{/* **The library at work, on the first screen.** The figures are the
|
|
55
|
+
roster the data view draws, read from the same module, so the panel
|
|
56
|
+
is the app itself, on glass over the light. It has no link of its own:
|
|
57
|
+
the button beside it goes to the same page. */}
|
|
58
|
+
<helix-card className="specimen" material="glass" separation="outlined">
|
|
59
|
+
<helix-text as="h2" slot="header" variant="title">Roster</helix-text>
|
|
60
|
+
<helix-stat-group>
|
|
65
61
|
<helix-stat>
|
|
66
62
|
{roster.people}
|
|
67
63
|
<span slot="label">People</span>
|
|
@@ -75,9 +71,6 @@ export function Landing() {
|
|
|
75
71
|
<span slot="label">Reviews</span>
|
|
76
72
|
</helix-stat>
|
|
77
73
|
</helix-stat-group>
|
|
78
|
-
<Link data-link href="/overview" slot="footer">
|
|
79
|
-
Open the data view
|
|
80
|
-
</Link>
|
|
81
74
|
</helix-card>
|
|
82
75
|
</header>
|
|
83
76
|
|
|
@@ -85,106 +78,51 @@ export function Landing() {
|
|
|
85
78
|
<helix-text as="h2" variant="subheading">
|
|
86
79
|
What you have
|
|
87
80
|
</helix-text>
|
|
88
|
-
{/*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</helix-text>
|
|
95
|
-
<helix-text as="p" emphasis="muted" variant="body">
|
|
96
|
-
They are custom elements, so you write the tags and there is no per-component import
|
|
97
|
-
to keep in step. One line in <helix-code>app/helix-elements.tsx</helix-code> registers all of
|
|
98
|
-
them, and a subpath like <helix-code>@fusion.dev/helix/tabs</helix-code> registers
|
|
99
|
-
one.
|
|
100
|
-
</helix-text>
|
|
101
|
-
<a data-link href={DOCS.elements}>
|
|
102
|
-
Using the elements
|
|
103
|
-
</a>
|
|
104
|
-
</article>
|
|
105
|
-
|
|
106
|
-
<article className="fact">
|
|
107
|
-
<helix-text as="h3" variant="title">
|
|
108
|
-
One set of tokens
|
|
109
|
-
</helix-text>
|
|
110
|
-
<helix-text as="p" emphasis="muted" variant="body">
|
|
111
|
-
Every color is written once as a light and dark pair, so the control in the bar moves
|
|
112
|
-
the whole page by setting a single attribute on the root. Type, spacing, radii and
|
|
113
|
-
control sizes come from the same place.
|
|
114
|
-
</helix-text>
|
|
115
|
-
<a data-link href={DOCS.tokens}>
|
|
116
|
-
Tokens
|
|
117
|
-
</a>
|
|
118
|
-
</article>
|
|
119
|
-
|
|
120
|
-
<article className="fact">
|
|
121
|
-
<helix-text as="h3" variant="title">
|
|
122
|
-
A short stylesheet
|
|
123
|
-
</helix-text>
|
|
124
|
-
<helix-text as="p" emphasis="muted" variant="body">
|
|
125
|
-
<helix-code>app/app.css</helix-code> holds this page's measure, the rhythm between its
|
|
126
|
-
blocks, and nothing a component already draws. Where a component leaves a decision
|
|
127
|
-
open it names a part: the data view reaches one to paint the row you tick.
|
|
128
|
-
</helix-text>
|
|
129
|
-
<a data-link href={DOCS.parts}>
|
|
130
|
-
Overriding a component
|
|
131
|
-
</a>
|
|
132
|
-
</article>
|
|
133
|
-
</div>
|
|
134
|
-
</section>
|
|
135
|
-
|
|
136
|
-
<section className="section">
|
|
137
|
-
<helix-text as="h2" variant="subheading">
|
|
138
|
-
Where to go next
|
|
139
|
-
</helix-text>
|
|
140
|
-
{/* **The whole card is the link, which is what `data-card` is for.** A
|
|
141
|
-
card with an anchor in its footer gives a reader a target the size of
|
|
142
|
-
three words inside a box the size of a paragraph, and the box is what
|
|
143
|
-
they aim at. The recipe is in the base layer: it draws the ring, moves
|
|
144
|
-
the card's border to the brand on hover, and leaves focus alone. So
|
|
145
|
-
nothing inside may be interactive, a link inside a link being neither
|
|
146
|
-
valid nor reachable. */}
|
|
147
|
-
<helix-grid columns={2} gap="md">
|
|
148
|
-
<Link data-card href="/overview">
|
|
81
|
+
{/* **Each tile is a link, which is what `data-card` is for.** The base
|
|
82
|
+
layer draws the ring, moves the card's border to the brand on hover,
|
|
83
|
+
and leaves focus alone. Nothing inside may be interactive, since a
|
|
84
|
+
link inside a link is neither valid nor reachable. */}
|
|
85
|
+
<div className="features">
|
|
86
|
+
<a className="feature" data-card href={DOCS.elements}>
|
|
149
87
|
<helix-card separation="outlined">
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
The data view
|
|
157
|
-
</helix-text>
|
|
158
|
-
<helix-text emphasis="subtle" variant="code">
|
|
159
|
-
/overview
|
|
160
|
-
</helix-text>
|
|
161
|
-
</helix-flex>
|
|
88
|
+
<span className="feature-mark">
|
|
89
|
+
<helix-icon name="cube" />
|
|
90
|
+
</span>
|
|
91
|
+
<helix-text as="h3" variant="title">
|
|
92
|
+
Custom elements
|
|
93
|
+
</helix-text>
|
|
162
94
|
<helix-text as="p" emphasis="muted" variant="body">
|
|
163
|
-
|
|
164
|
-
The columns are markup you can read and the rows are one property, which is what
|
|
165
|
-
keeps the same component working at ten thousand.
|
|
95
|
+
One import in <helix-code>app/helix-elements.tsx</helix-code> registers every tag.
|
|
166
96
|
</helix-text>
|
|
167
97
|
</helix-card>
|
|
168
|
-
</
|
|
169
|
-
|
|
170
|
-
<Link data-card href="/join">
|
|
98
|
+
</a>
|
|
99
|
+
<a className="feature" data-card href={DOCS.tokens}>
|
|
171
100
|
<helix-card separation="outlined">
|
|
172
|
-
<
|
|
173
|
-
<helix-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
</helix-text>
|
|
179
|
-
</helix-flex>
|
|
101
|
+
<span className="feature-mark">
|
|
102
|
+
<helix-icon name="palette" />
|
|
103
|
+
</span>
|
|
104
|
+
<helix-text as="h3" variant="title">
|
|
105
|
+
One set of tokens
|
|
106
|
+
</helix-text>
|
|
180
107
|
<helix-text as="p" emphasis="muted" variant="body">
|
|
181
|
-
|
|
182
|
-
<helix-code>FormData</helix-code>, because every one of them is a real form
|
|
183
|
-
participant. The email field's complaint is the browser's own.
|
|
108
|
+
Every color, size, and space, in light and dark.
|
|
184
109
|
</helix-text>
|
|
185
110
|
</helix-card>
|
|
186
|
-
</
|
|
187
|
-
|
|
111
|
+
</a>
|
|
112
|
+
<a className="feature" data-card href={DOCS.parts}>
|
|
113
|
+
<helix-card separation="outlined">
|
|
114
|
+
<span className="feature-mark">
|
|
115
|
+
<helix-icon name="sliders-horizontal" />
|
|
116
|
+
</span>
|
|
117
|
+
<helix-text as="h3" variant="title">
|
|
118
|
+
Parts to style
|
|
119
|
+
</helix-text>
|
|
120
|
+
<helix-text as="p" emphasis="muted" variant="body">
|
|
121
|
+
Reach inside a component with <helix-code>::part()</helix-code>.
|
|
122
|
+
</helix-text>
|
|
123
|
+
</helix-card>
|
|
124
|
+
</a>
|
|
125
|
+
</div>
|
|
188
126
|
</section>
|
|
189
127
|
</div>
|
|
190
128
|
)
|
|
@@ -6,13 +6,13 @@ import { DOCS } from './docs'
|
|
|
6
6
|
*
|
|
7
7
|
* **The schema is markup and the data is a property.** The columns are elements
|
|
8
8
|
* you can read in the HTML, and `rows` is the whole result handed over at once,
|
|
9
|
-
*
|
|
10
|
-
* table sorts, pages and selects out of that array on its own
|
|
11
|
-
*
|
|
9
|
+
* since a table of ten thousand rows cannot be written out as elements. The
|
|
10
|
+
* table sorts, pages, and selects out of that array on its own, with no handler
|
|
11
|
+
* for you to write.
|
|
12
12
|
*
|
|
13
13
|
* **Selection is keyed on `row-key`, so it survives a sort and a page.** A row
|
|
14
|
-
* is chosen by its identity
|
|
15
|
-
*
|
|
14
|
+
* is chosen by its identity, wherever it sits, and `app.css` paints the chosen
|
|
15
|
+
* row through the parts the table names for it.
|
|
16
16
|
*/
|
|
17
17
|
export function Overview() {
|
|
18
18
|
return (
|
|
@@ -39,18 +39,18 @@ export function Overview() {
|
|
|
39
39
|
rows={members}
|
|
40
40
|
selectable
|
|
41
41
|
>
|
|
42
|
-
{/* **Every column declares what it may give up,
|
|
42
|
+
{/* **Every column declares what it may give up, which is the whole of
|
|
43
43
|
the narrow-window story.** A column left to itself takes
|
|
44
|
-
`minmax(max-content, 1fr)`, which
|
|
45
|
-
cell
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
344, so at a 376 pixel window they exactly fit and below it the
|
|
52
|
-
scrolls its own box
|
|
53
|
-
|
|
44
|
+
`minmax(max-content, 1fr)`, which never goes below its longest
|
|
45
|
+
cell, so the last column is pushed outside the box and you have to
|
|
46
|
+
scroll the table sideways to read a value. Each column here has a
|
|
47
|
+
floor and a share: the floor is what the words need, and the share
|
|
48
|
+
is how the spare width is divided. Measured September 16, 2026: at
|
|
49
|
+
390 the four columns and the checkboxes come to 358 in a box of
|
|
50
|
+
358, so nothing is cut and nothing wraps. The floors alone come to
|
|
51
|
+
344, so at a 376 pixel window they exactly fit, and below it the
|
|
52
|
+
table scrolls its own box and fades whichever edge has more behind
|
|
53
|
+
it. */}
|
|
54
54
|
<helix-table-column field="name" sortable width="minmax(5.5rem, 1.6fr)">
|
|
55
55
|
Name
|
|
56
56
|
</helix-table-column>
|
|
@@ -60,26 +60,24 @@ export function Overview() {
|
|
|
60
60
|
<helix-table-column field="role" width="minmax(4.5rem, 1fr)">
|
|
61
61
|
Role
|
|
62
62
|
</helix-table-column>
|
|
63
|
-
{/* `end` lines the digits up under each other, which is
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
take a share of anything. */}
|
|
63
|
+
{/* `end` lines the digits up under each other, which is what makes a
|
|
64
|
+
number column different from a text one. `max-content`, since a
|
|
65
|
+
column of numerals has one right width. */}
|
|
67
66
|
<helix-table-column field="reviews" sortable text-align="end" width="max-content">
|
|
68
67
|
Reviews
|
|
69
68
|
</helix-table-column>
|
|
70
69
|
|
|
71
|
-
{/* The footer is a row across the table
|
|
72
|
-
|
|
70
|
+
{/* The footer is a row across the table: anything you slot goes at the
|
|
71
|
+
start, and the table's own pagination sits at the end. */}
|
|
73
72
|
<helix-text emphasis="subtle" slot="footer" variant="caption">
|
|
74
73
|
{members.length} people
|
|
75
74
|
</helix-text>
|
|
76
75
|
</helix-data-table>
|
|
77
76
|
|
|
78
|
-
{/* A footnote to the table
|
|
79
|
-
takes the section's gap and not the stack's. */}
|
|
77
|
+
{/* A footnote to the table, so it takes the section's gap. */}
|
|
80
78
|
<helix-text as="p" emphasis="muted" variant="caption">
|
|
81
|
-
Filtering, column reordering, resizing, virtualized rows and a server mode
|
|
82
|
-
|
|
79
|
+
Filtering, column reordering, resizing, virtualized rows, and a server mode for large
|
|
80
|
+
results are on{' '}
|
|
83
81
|
<a data-link href={DOCS.table}>
|
|
84
82
|
the component's own page
|
|
85
83
|
</a>
|
|
@@ -21,21 +21,21 @@ interface Message {
|
|
|
21
21
|
* The form.
|
|
22
22
|
*
|
|
23
23
|
* **Every control here is a form-associated custom element**, so a `<form>`
|
|
24
|
-
* collects them, resets them and validates them the way it does an `<input>`.
|
|
25
|
-
*
|
|
26
|
-
* the answers with `new FormData(form)
|
|
24
|
+
* collects them, resets them, and validates them the way it does an `<input>`.
|
|
25
|
+
* `ElementInternals` makes that possible, and the submit below proves it: it
|
|
26
|
+
* reads the answers with `new FormData(form)`, and nothing gathers them by hand.
|
|
27
27
|
*
|
|
28
|
-
* There is no wrapping `Field` component. A label in one shadow root cannot
|
|
29
|
-
* a control in another, so every control renders its own `label`, `hint
|
|
30
|
-
* `feedback
|
|
28
|
+
* There is no wrapping `Field` component. A label in one shadow root cannot
|
|
29
|
+
* name a control in another, so every control renders its own `label`, `hint`,
|
|
30
|
+
* and `feedback`.
|
|
31
31
|
*/
|
|
32
32
|
export function SignupForm() {
|
|
33
33
|
const [handle, setHandle] = useState('')
|
|
34
34
|
const [messages, setMessages] = useState<readonly Message[]>([])
|
|
35
35
|
|
|
36
36
|
const join = (event: FormEvent<HTMLFormElement>) => {
|
|
37
|
-
/* The page
|
|
38
|
-
posts to the server like any other, with the same names. */
|
|
37
|
+
/* The page takes the submit, so nothing navigates. Remove the line and the
|
|
38
|
+
form posts to the server like any other, with the same names. */
|
|
39
39
|
event.preventDefault()
|
|
40
40
|
const answers = [...new FormData(event.currentTarget).entries()]
|
|
41
41
|
.map(([field, value]) => `${field}=${value}`)
|
|
@@ -58,18 +58,16 @@ export function SignupForm() {
|
|
|
58
58
|
</helix-text>
|
|
59
59
|
</header>
|
|
60
60
|
|
|
61
|
-
{/* The form takes a column of its own and the notes take what is left
|
|
62
|
-
|
|
63
|
-
the two stack and the notes read as a postscript. */}
|
|
61
|
+
{/* The form takes a column of its own and the notes take what is left. At
|
|
62
|
+
390 the two stack, and the notes read as a postscript. */}
|
|
64
63
|
<div className="split">
|
|
65
64
|
<form className="form" onSubmit={join}>
|
|
66
65
|
<helix-input autocomplete="name" label="Name" name="name" required />
|
|
67
66
|
|
|
68
67
|
{/* Validation is the platform's: `type` and `required` are set on the
|
|
69
|
-
real input inside, and its own message
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
mistake. */}
|
|
68
|
+
real input inside, and its own message shows once the field has been
|
|
69
|
+
touched. Set `feedback` to say it in your own words, and it shows
|
|
70
|
+
from the first paint. */}
|
|
73
71
|
<helix-input
|
|
74
72
|
hint="Where we send the welcome note."
|
|
75
73
|
label="Email"
|
|
@@ -81,11 +79,11 @@ export function SignupForm() {
|
|
|
81
79
|
{/* **A controlled value, which is the one habit to unlearn.** The handler
|
|
82
80
|
is a prop named for the event, so `onhelix-before-change` hears
|
|
83
81
|
`helix-before-change`. A Helix element is not read-only: writing
|
|
84
|
-
`value` seeds it and the element goes on applying its own changes
|
|
85
|
-
taking the decision means refusing the change with
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
`value` seeds it, and the element goes on applying its own changes.
|
|
83
|
+
So taking the decision means refusing the change with
|
|
84
|
+
`preventDefault()`, then setting the value you want. Leaving
|
|
85
|
+
`setHandle` uncalled refuses nothing, and the element keeps the value
|
|
86
|
+
you meant to turn down. */}
|
|
89
87
|
<helix-input
|
|
90
88
|
hint="Lowercase and hyphens, whatever you type."
|
|
91
89
|
label="Handle"
|
|
@@ -105,8 +103,8 @@ export function SignupForm() {
|
|
|
105
103
|
))}
|
|
106
104
|
</helix-select>
|
|
107
105
|
|
|
108
|
-
{/* A switch is a thing happening now
|
|
109
|
-
|
|
106
|
+
{/* A switch is a thing happening now, which is why it says on and off.
|
|
107
|
+
It still submits, as `on`. */}
|
|
110
108
|
<helix-switch label="Send me the weekly digest" name="digest" />
|
|
111
109
|
|
|
112
110
|
<helix-button emphasis="solid" tone="primary" type="submit">
|
|
@@ -115,27 +113,25 @@ export function SignupForm() {
|
|
|
115
113
|
</form>
|
|
116
114
|
|
|
117
115
|
<aside className="notes">
|
|
118
|
-
{/* The one fact
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Nothing is posted anywhere. Submit it and the message shows exactly what a server would
|
|
126
|
-
have been handed.
|
|
116
|
+
{/* The one fact you need before typing your name into a page you have
|
|
117
|
+
had for five minutes, so it is a callout. `neutral` is a note that
|
|
118
|
+
reports no status, drawn in the muted ink with a bar on the inline
|
|
119
|
+
start, so it stays in the palette, ink or brand. */}
|
|
120
|
+
<helix-callout tone="neutral">
|
|
121
|
+
The form posts nothing. Submit it, and a message shows exactly what a server would
|
|
122
|
+
receive.
|
|
127
123
|
</helix-callout>
|
|
128
124
|
<helix-text as="h2" variant="title">
|
|
129
|
-
What
|
|
125
|
+
What the form shows
|
|
130
126
|
</helix-text>
|
|
131
127
|
<helix-text as="p" emphasis="muted" variant="body">
|
|
132
|
-
Every control is a form-associated custom element, so the submit reads them
|
|
133
|
-
<helix-code>new FormData(form)</helix-code
|
|
134
|
-
|
|
128
|
+
Every control is a form-associated custom element, so the submit reads them all
|
|
129
|
+
with <helix-code>new FormData(form)</helix-code>. Reset the form and they all go back,
|
|
130
|
+
the way an <helix-code>input</helix-code> does.
|
|
135
131
|
</helix-text>
|
|
136
132
|
<helix-text as="p" emphasis="muted" variant="body">
|
|
137
|
-
Leave the email wrong and the
|
|
138
|
-
|
|
133
|
+
Leave the email wrong and the browser shows its own message, in your language. Handle is
|
|
134
|
+
the controlled field: the page refuses each change and writes back a cleaned value.
|
|
139
135
|
</helix-text>
|
|
140
136
|
<a data-link href={DOCS.forms}>
|
|
141
137
|
Forms
|
|
@@ -145,9 +141,9 @@ export function SignupForm() {
|
|
|
145
141
|
|
|
146
142
|
{/* **The region is rendered whether or not there is anything in it.**
|
|
147
143
|
Assistive technology subscribes to a live region, and one that arrives
|
|
148
|
-
already holding its message is
|
|
149
|
-
creates or destroys
|
|
150
|
-
|
|
144
|
+
already holding its message is often never announced. Messages are
|
|
145
|
+
state, so nothing creates or destroys one here, and a dismissed one
|
|
146
|
+
asks to go through `helix-dismiss`. */}
|
|
151
147
|
<helix-toast>
|
|
152
148
|
{messages.map((message) => (
|
|
153
149
|
<helix-toast-item
|
|
@@ -3,32 +3,26 @@ import { DOCS } from './docs'
|
|
|
3
3
|
/**
|
|
4
4
|
* The bar's counterpart, on every route.
|
|
5
5
|
*
|
|
6
|
-
* **It
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* a reader wants once rather than constantly belong, which is why the landing
|
|
11
|
-
* page no longer carries them itself.
|
|
6
|
+
* **It puts a floor under the content.** The overview is a heading, a table,
|
|
7
|
+
* and a caption, which on a tall window left the bottom third of the screen
|
|
8
|
+
* empty, as if the layout had run out. The footer is also where the links you
|
|
9
|
+
* want once belong, so the landing page no longer carries them.
|
|
12
10
|
*
|
|
13
|
-
* `data-link="
|
|
14
|
-
*
|
|
15
|
-
* asking to be read.
|
|
11
|
+
* `data-link="quiet"` sets a link in the muted ink with no underline, and it
|
|
12
|
+
* takes the foreground on hover, which suits a row of links under a rule.
|
|
16
13
|
*/
|
|
17
14
|
export function SiteFooter() {
|
|
18
15
|
return (
|
|
19
16
|
<footer className="site-footer">
|
|
20
17
|
<div className="footer-row">
|
|
21
|
-
<helix-text as="p" emphasis="subtle" variant="caption">
|
|
22
|
-
Every component in here, with its API, its parts and its examples, has a page.
|
|
23
|
-
</helix-text>
|
|
24
18
|
<div className="footer-links">
|
|
25
|
-
<a data-link="
|
|
19
|
+
<a data-link="quiet" href={DOCS.gallery}>
|
|
26
20
|
Components
|
|
27
21
|
</a>
|
|
28
|
-
<a data-link="
|
|
22
|
+
<a data-link="quiet" href={DOCS.elements}>
|
|
29
23
|
Documentation
|
|
30
24
|
</a>
|
|
31
|
-
<a data-link="
|
|
25
|
+
<a data-link="quiet" href={DOCS.react}>
|
|
32
26
|
React
|
|
33
27
|
</a>
|
|
34
28
|
</div>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
/*
|
|
4
4
|
* **A handler is what makes this a client component**, and so does `usePathname`:
|
|
5
5
|
* a server component's output is serialized, and a function cannot be. The bar
|
|
6
|
-
* is rendered from the layout, so it
|
|
7
|
-
*
|
|
6
|
+
* is rendered from the layout, so it stays in place across a navigation and is
|
|
7
|
+
* built once.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import Link from 'next/link'
|
|
@@ -28,18 +28,16 @@ export function SiteHeader() {
|
|
|
28
28
|
control draws the same glyph on the server and on the first client paint. */
|
|
29
29
|
const [mode, setMode] = useState<Mode>('system')
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
32
|
* One attribute, two modes, and no second stylesheet.
|
|
33
33
|
*
|
|
34
|
-
* Every Helix token is written once as a `light-dark()` pair, so
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* a dark page.
|
|
34
|
+
* Every Helix token is written once as a `light-dark()` pair, so
|
|
35
|
+
* `color-scheme` decides which half resolves. `data-color-mode` sets it, and
|
|
36
|
+
* since `color-scheme` inherits, the attribute works on any element: put it
|
|
37
|
+
* on a panel for a light preview inside a dark page.
|
|
39
38
|
*
|
|
40
|
-
* `system` removes the attribute
|
|
41
|
-
*
|
|
42
|
-
* changed.
|
|
39
|
+
* `system` removes the attribute. Writing out whichever mode is current would
|
|
40
|
+
* hold the page there when the system's own setting changed.
|
|
43
41
|
*/
|
|
44
42
|
const cycle = () => {
|
|
45
43
|
const next = MODES[(MODES.indexOf(mode) + 1) % MODES.length]
|
|
@@ -53,22 +51,17 @@ export function SiteHeader() {
|
|
|
53
51
|
|
|
54
52
|
return (
|
|
55
53
|
<helix-app-header material="glass" sticky>
|
|
56
|
-
{/* The wordmark is the way back to the first page,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
it.
|
|
61
|
-
|
|
62
|
-
The mark is a placeholder for your own, and it is drawn in
|
|
63
|
-
`--helix-color-brand-mark`, the token for the brand as a graphic. */}
|
|
54
|
+
{/* The wordmark is the way back to the first page, as a wordmark usually
|
|
55
|
+
is, so there is no third destination in the bar saying the same thing.
|
|
56
|
+
It names the library the starter is built on, and it is the place for
|
|
57
|
+
your own name or logo. */}
|
|
64
58
|
<Link className="wordmark" data-link="quiet" href="/" slot="start">
|
|
65
|
-
<helix-
|
|
66
|
-
<helix-text variant="body-strong">__PROJECT_NAME__</helix-text>
|
|
59
|
+
<helix-text variant="body-strong">Helix</helix-text>
|
|
67
60
|
</Link>
|
|
68
61
|
|
|
69
62
|
{/* The links are yours. Navigation owns the marker that travels between
|
|
70
|
-
them and renders no anchors of its own,
|
|
71
|
-
own
|
|
63
|
+
them and renders no anchors of its own, since a router renders its
|
|
64
|
+
own, which could not sit inside this shadow root. The base layer
|
|
72
65
|
styles them, `aria-current="page"` included. */}
|
|
73
66
|
<helix-navigation label="Pages">
|
|
74
67
|
<Link aria-current={path === '/overview' ? 'page' : undefined} href="/overview">
|
|
@@ -79,9 +72,8 @@ export function SiteHeader() {
|
|
|
79
72
|
</Link>
|
|
80
73
|
</helix-navigation>
|
|
81
74
|
|
|
82
|
-
{/* An icon with no words has no accessible name
|
|
83
|
-
which is
|
|
84
|
-
with a glyph in it. */}
|
|
75
|
+
{/* An icon with no words has no accessible name until it is given one,
|
|
76
|
+
which is why this is its own element. */}
|
|
85
77
|
<helix-icon-button
|
|
86
78
|
label={`Color mode: ${mode}`}
|
|
87
79
|
onClick={cycle}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* Types for the Helix custom elements written directly in JSX.
|
|
3
3
|
*
|
|
4
4
|
* Emitted by `@wc-toolkit/jsx-types` from the same manifest the API pages read,
|
|
5
|
-
* so a wrong attribute or a wrong event detail is a compile error
|
|
6
|
-
* silent no-op.
|
|
5
|
+
* so a wrong attribute or a wrong event detail is a compile error.
|
|
7
6
|
*
|
|
8
|
-
* **A side-effect import in a `.d.ts
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* every Helix tag comes out untyped.
|
|
7
|
+
* **A side-effect import in a `.d.ts`.** The typings are the subpath export
|
|
8
|
+
* `@fusion.dev/helix/jsx`, and entries in the `types` compiler array resolve as
|
|
9
|
+
* ambient type packages, outside a package's exports map, so naming the subpath
|
|
10
|
+
* there resolves to nothing and every Helix tag comes out untyped.
|
|
13
11
|
*/
|
|
14
12
|
import '@fusion.dev/helix/jsx'
|