@openelement/create 1.0.0-alpha.14 → 1.0.0-alpha.15
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/README.md +49 -19
- package/package.json +1 -1
- package/src/cli.js +159 -76
- package/src/node-version.js +102 -0
- package/src/pm.js +143 -9
- package/src/template-builder.js +58 -7
- package/src/version.js +2 -10
- package/templates/.node-version +1 -0
- package/templates/AGENTS.md.tmpl +44 -0
- package/templates/README.tmpl +137 -96
- package/templates/app/components/page-404.css +2 -18
- package/templates/app/components/page-404.tsx.tmpl +10 -11
- package/templates/app/components/page-about.css +2 -69
- package/templates/app/components/page-about.tsx.tmpl +68 -48
- package/templates/app/components/page-home.css +2 -132
- package/templates/app/components/page-home.tsx.tmpl +106 -67
- package/templates/app/components/site-chrome.css +2 -65
- package/templates/app/head.tsx.tmpl +11 -26
- package/templates/app/islands/live-timer.css +2 -20
- package/templates/app/islands/live-timer.tsx.tmpl +25 -15
- package/templates/app/islands/my-counter.css +2 -29
- package/templates/app/islands/my-counter.tsx.tmpl +17 -8
- package/templates/app/layout.tsx.tmpl +68 -0
- package/templates/app/routes/404.tsx.tmpl +3 -6
- package/templates/app/routes/api/ping.ts.tmpl +2 -3
- package/templates/app/styles/theme.css +62 -77
- package/templates/openelement.config.ts.tmpl +16 -28
- package/templates/package.json.tmpl +8 -6
- package/templates/tsconfig.json.tmpl +1 -1
- package/templates/vite.config.ts.tmpl +7 -14
- package/templates/app/components/badges.css +0 -24
- package/templates/app/islands/app-shell.tsx.tmpl +0 -54
- package/templates/app/styles/recipes.css +0 -43
- package/templates/pnpm-workspace.yaml.tmpl +0 -29
package/templates/README.tmpl
CHANGED
|
@@ -5,42 +5,59 @@ scaffold it elsewhere with `npm create @openelement <project-name>` —
|
|
|
5
5
|
a static-first openElement app that shows its own costs. The landing page
|
|
6
6
|
carries two islands (`my-counter`, an interactive counter, and `live-timer`,
|
|
7
7
|
a client-only elapsed-time readout); every other page, including `/about`,
|
|
8
|
-
is prerendered HTML and CSS with no islands
|
|
9
|
-
|
|
8
|
+
is prerendered HTML and CSS with no islands of its own — no island chunk is
|
|
9
|
+
executed there (a linked page's chunks can still be prefetched); the only
|
|
10
|
+
script such a page executes is the app-wide claim bootstrap (about 2 KB
|
|
11
|
+
gzipped) that runs while the app has any island. The badge on each section
|
|
12
|
+
names what it costs the client.
|
|
10
13
|
|
|
11
14
|
Docs and guides: https://openelement.org
|
|
12
15
|
|
|
16
|
+
Requires **Node.js 24.2+ (24.18.0 recommended)** and any one package manager:
|
|
17
|
+
npm, pnpm, yarn, or bun. Node 24.2 is the floor the packed framework packages
|
|
18
|
+
declare in their `engines` and CI exercises; 24.18.0 is the line this template
|
|
19
|
+
is verified on, pinned by the scaffold's own `.node-version`. The generated
|
|
20
|
+
project pins no package manager: every script is a plain command, so whichever
|
|
21
|
+
manager you install with runs them all.
|
|
22
|
+
|
|
13
23
|
One directory is generated rather than source: `.openElement/` at the project
|
|
14
24
|
root holds the build's internal state (head-convention bookkeeping and build
|
|
15
|
-
plans).
|
|
25
|
+
plans). The dev server and the build write it as needed; the `.gitignore`
|
|
16
26
|
excludes it and deleting it is safe — the next run recreates it.
|
|
17
27
|
|
|
18
28
|
The `@openelement/element` and `@openelement/router` dependencies carry caret
|
|
19
|
-
ranges over the `1.0.0`
|
|
20
|
-
|
|
29
|
+
ranges over the `1.0.0` prerelease this starter was generated from, so a
|
|
30
|
+
dependency update picks up later `1.0.0` prereleases (and the final `1.0.0`)
|
|
21
31
|
without editing this file.
|
|
22
32
|
|
|
33
|
+
Nothing here is tied to one package manager: the manifest declares no
|
|
34
|
+
`packageManager`, every script is a plain command, and the scaffold ships no
|
|
35
|
+
`pnpm-workspace.yaml`. Install with npm, pnpm, yarn, or bun — whichever one
|
|
36
|
+
runs first writes its lockfile, and every command below works the same.
|
|
37
|
+
|
|
23
38
|
## The JS cost map
|
|
24
39
|
|
|
25
|
-
| Surface | Ships JavaScript? | Why
|
|
26
|
-
| ------------------------------------ | --------------------- |
|
|
27
|
-
| `/` hero + architecture sections | no | prerendered markup, styled with CSS
|
|
28
|
-
| `/` counter island (`my-counter`) | yes, hydrates on idle | the one interactive piece
|
|
29
|
-
| `/` live timer island (`live-timer`) | yes, client-only | a live clock has nothing to prerender
|
|
30
|
-
| `/about` | no islands
|
|
31
|
-
| `/api/ping` | no (server) | a plain `Request → Response` handler
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
>
|
|
39
|
-
>
|
|
40
|
-
>
|
|
41
|
-
>
|
|
42
|
-
>
|
|
43
|
-
> the
|
|
40
|
+
| Surface | Ships JavaScript? | Why |
|
|
41
|
+
| ------------------------------------ | --------------------- | ------------------------------------------------- |
|
|
42
|
+
| `/` hero + architecture sections | no | prerendered markup, styled with CSS |
|
|
43
|
+
| `/` counter island (`my-counter`) | yes, hydrates on idle | the one interactive piece |
|
|
44
|
+
| `/` live timer island (`live-timer`) | yes, client-only | a live clock has nothing to prerender |
|
|
45
|
+
| `/about` | no islands of its own | fully static SSG output, no island chunk executes |
|
|
46
|
+
| `/api/ping` | no (server) | a plain `Request → Response` handler |
|
|
47
|
+
| `/404` (unmatched paths) | no (server) | dynamic 404 from the styled 404 page |
|
|
48
|
+
|
|
49
|
+
The badge on each section is a Tailwind utility string on the span itself
|
|
50
|
+
(`bg-ok/8 text-ok` for a static section, `bg-brand-soft text-brand` for an
|
|
51
|
+
interactive one) — copy the span onto new sections and keep the map honest.
|
|
52
|
+
|
|
53
|
+
> Cost honesty: the island client is emitted app-wide today, so a page
|
|
54
|
+
> without islands (like `/about`) still carries the ~2 KB gzipped app-wide
|
|
55
|
+
> claim bootstrap — but no island chunk executes and no element-runtime
|
|
56
|
+
> preload is added for it: the build records islands per page and the client
|
|
57
|
+
> only activates tags the page hosts. Fetches can still be broader than
|
|
58
|
+
> execution when the reader follows a link, because the target page's chunks
|
|
59
|
+
> may be prefetched; what a page executes is always limited to its own
|
|
60
|
+
> registered islands.
|
|
44
61
|
|
|
45
62
|
## Where things live
|
|
46
63
|
|
|
@@ -48,13 +65,12 @@ Framework options have exactly one home: `openelement.config.ts`. It is
|
|
|
48
65
|
optional and nearly empty — every option it omits comes from a file
|
|
49
66
|
convention:
|
|
50
67
|
|
|
51
|
-
| Option | Convention
|
|
52
|
-
| --------------------- |
|
|
53
|
-
| design tokens | `app/styles/theme.css` (the @theme role sheet)
|
|
54
|
-
|
|
|
55
|
-
| document head content | `app/head.tsx` (meta tags, preloads, inline CSS)
|
|
56
|
-
| site title | the `name` field of `package.json`
|
|
57
|
-
| static-shape recipes | `app/styles/recipes.css` (zero-interaction badge/callout/card/tabs shapes as plain HTML+CSS — the @openelement/ui components retired to these recipes in #1557) |
|
|
68
|
+
| Option | Convention |
|
|
69
|
+
| --------------------- | ------------------------------------------------------------------- |
|
|
70
|
+
| design tokens | `app/styles/theme.css` (the @theme role sheet) |
|
|
71
|
+
| layout | `app/layout.tsx` (the shared site chrome every page renders inside) |
|
|
72
|
+
| document head content | `app/head.tsx` (meta tags, preloads, inline CSS) |
|
|
73
|
+
| site title | the `name` field of `package.json` |
|
|
58
74
|
|
|
59
75
|
Passing framework options inline to `openElement()` while the config file
|
|
60
76
|
carries options is a hard error, and an unknown key fails the build with the
|
|
@@ -64,66 +80,90 @@ accepted-key list. `vite.config.ts` stays Vite-only: `plugins: [...openElement()
|
|
|
64
80
|
`static`: prerendered at build time (SSG). `/about` and `/` are static.
|
|
65
81
|
- `app/routes/api/` — request-time server routes. `/api/ping` is a plain
|
|
66
82
|
WinterCG-shaped handler returning `Response.json`.
|
|
67
|
-
- `app/components/` — compiled page elements
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
- `app/components/` — compiled page elements. Presentation is authored as
|
|
84
|
+
Tailwind utility classes in the markup; each element's `.css` sheet carries
|
|
85
|
+
only its root's box rule, which has no markup to carry it.
|
|
70
86
|
- `app/islands/` — client islands, the only code that ships JavaScript. Each
|
|
71
87
|
island declares its hydration strategy (`idle`, `load`, `visible`,
|
|
72
|
-
client-only) through `defineIslandConfig`.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- `
|
|
88
|
+
client-only) through `defineIslandConfig`.
|
|
89
|
+
- `app/layout.tsx` — the auto-registered layout, not an island itself: the
|
|
90
|
+
site chrome every page renders inside. The header, the `main` content
|
|
91
|
+
block, and the footer live here exactly once instead of being copied onto
|
|
92
|
+
each page. The build registers the layout automatically and projects each
|
|
93
|
+
page's render into its default slot, so a page module carries only its own
|
|
94
|
+
content. The layout is a convention: delete the file and pages still render
|
|
95
|
+
(carrying their own chrome again), or opt out explicitly with `layout: false`
|
|
96
|
+
in `openelement.config.ts`.
|
|
97
|
+
- `app/styles/theme.css` — the @theme role sheet: Tailwind-ON roles, the
|
|
98
|
+
starter palette (`bg-paper`, `text-brand`, `border-line`, …), dark and
|
|
99
|
+
forced-colors pairs, and the document base (`body`, `::selection`). Dev
|
|
100
|
+
serves the compiled result at `/.openElement/tailwind.css` and the build
|
|
101
|
+
emits it as the content-hashed document stylesheet the head links — both
|
|
102
|
+
through the official `@tailwindcss/vite` pipeline.
|
|
83
103
|
Dark values ride `prefers-color-scheme`; no theme runtime.
|
|
84
|
-
- `app/styles/recipes.css` — documented plain HTML+CSS recipes for the
|
|
85
|
-
zero-interaction shapes (badge, callout, card, CSS-only tabs) that retired
|
|
86
|
-
from `@openelement/ui` (#1557). Delete the blocks you do not use: static
|
|
87
|
-
content never justifies a custom element.
|
|
88
104
|
- `app/head.tsx` — structural head content the URL list cannot express.
|
|
89
105
|
|
|
90
106
|
## Scripts
|
|
91
107
|
|
|
92
|
-
|
|
108
|
+
Every script is a plain command, so every one of them runs under any package
|
|
109
|
+
manager (`npm run dev`, `pnpm run dev`, `yarn run dev`, `bun run dev` — this
|
|
110
|
+
file spells them as `npm run …`):
|
|
93
111
|
|
|
94
|
-
- `
|
|
95
|
-
- `
|
|
96
|
-
- `
|
|
97
|
-
- `
|
|
112
|
+
- `npm run dev` — start the Vite dev server (`oe dev`).
|
|
113
|
+
- `npm run fmt` — format the sources (`oxfmt`).
|
|
114
|
+
- `npm run lint` — lint the sources (`oxlint`).
|
|
115
|
+
- `npm run typecheck` — type-check every route/component file (`tsc --noEmit`).
|
|
98
116
|
The check covers the whole `app/` directory (`tsconfig.json`), so new files
|
|
99
117
|
are picked up automatically.
|
|
100
|
-
- `
|
|
101
|
-
- `
|
|
118
|
+
- `npm test` — run Node's built-in test runner (the starter ships none).
|
|
119
|
+
- `npm run build` — production build into `dist/`: prerendered HTML for every
|
|
102
120
|
static route, plus the request-time server when the app has one.
|
|
103
|
-
- `
|
|
121
|
+
- `npm start` — serve the production build.
|
|
122
|
+
|
|
123
|
+
`dev`, `build`, and `start` run the router CLI's short `oe` bin from the
|
|
124
|
+
`@openelement/router` dependency (`oe dev` / `oe build` / `oe start`; the same
|
|
125
|
+
entry is installed as `openelement`, so both spellings work). `oe dev` boots the
|
|
126
|
+
framework's own dev server — the SSR dev middleware, HMR, and the Tailwind
|
|
127
|
+
pipeline — with no extra wrapper, and `oe start --mode=preview` is the
|
|
128
|
+
static-only serve mode that refuses a build carrying a request-time server.
|
|
129
|
+
|
|
130
|
+
`oxfmt` and `oxlint` run with their defaults: both skip markdown, JSON, YAML,
|
|
131
|
+
and CSS, so `npx oxfmt --check` and `npx oxlint` pass on a fresh scaffold.
|
|
104
132
|
|
|
105
|
-
|
|
106
|
-
`@openelement/router`
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
request-time server.
|
|
133
|
+
The Vite tree is one direct devDependency pin (`"vite": "8.0.16"` — the same
|
|
134
|
+
version `@openelement/router` resolves against), so every peer that asks for
|
|
135
|
+
Vite gets that copy. There is no workspace catalog and no `vite@*` override:
|
|
136
|
+
a pin plus the router's own aligned dependency is what keeps the tree single.
|
|
110
137
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
138
|
+
### Package manager
|
|
139
|
+
|
|
140
|
+
Install with whichever manager you prefer; the first install decides the
|
|
141
|
+
lockfile and everything afterwards follows it. The manifest deliberately
|
|
142
|
+
carries no `packageManager` field: with the field absent, the manager you run
|
|
143
|
+
first is the one that owns the project. The commands in this file are spelled
|
|
144
|
+
`npm run …` only because npm's spelling works unchanged under all four.
|
|
115
145
|
|
|
116
146
|
## Styling ownership
|
|
117
147
|
|
|
118
|
-
|
|
119
|
-
in
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
Styling is utility-first: presentation is authored as Tailwind utility
|
|
149
|
+
classes directly in the markup, and nothing else in the app spells it out.
|
|
150
|
+
The compiler admits those static tokens and the build generates the CSS — the
|
|
151
|
+
document stylesheet for light-root pages and the layout, one shared component
|
|
152
|
+
stylesheet for the shadow-root islands — so every page is fully styled with
|
|
153
|
+
zero client JavaScript and no CSS text ships inside JavaScript.
|
|
154
|
+
|
|
155
|
+
Two things stay CSS, and each has a reason:
|
|
156
|
+
|
|
157
|
+
- `app/styles/theme.css` — the design tokens and the document base (`body`,
|
|
158
|
+
`::selection`, the dark and forced-colors pairs). The document shell's
|
|
159
|
+
`body` is not authored markup, so no class can carry it.
|
|
160
|
+
- the per-element `.css` sheet — one `:host` rule for the element's own box.
|
|
161
|
+
A custom element is `display: inline` by default and the host tag is not
|
|
162
|
+
authored markup either.
|
|
163
|
+
|
|
164
|
+
The `.css` + `static styles` authoring path stays fully available — array any
|
|
165
|
+
sheet you want and the server inlines it into the SSR output as a
|
|
166
|
+
`@scope(<tag>)` block — the starter simply has no need for it.
|
|
127
167
|
|
|
128
168
|
## Brand assets
|
|
129
169
|
|
|
@@ -134,24 +174,25 @@ unused.
|
|
|
134
174
|
## Dependency notes
|
|
135
175
|
|
|
136
176
|
`@openelement/element` and `@openelement/router` are the runtime dependencies
|
|
137
|
-
your app imports. Everything else rides devDependencies:
|
|
138
|
-
`
|
|
139
|
-
the `
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
177
|
+
your app imports. Everything else this manifest declares rides devDependencies:
|
|
178
|
+
`vite` (the tree the router's `oe dev` / `oe build` drive), `oxfmt` and `oxlint`
|
|
179
|
+
(the `fmt` / `lint` scripts), the Tailwind-ON build-time pins, the dev-server
|
|
180
|
+
pair — `@hono/vite-dev-server` (loaded lazily by the dev server) and its `hono`
|
|
181
|
+
peer — and the `typescript` pin.
|
|
182
|
+
|
|
183
|
+
`npm install --omit=dev` drops what this manifest declares as devDependencies —
|
|
184
|
+
the Tailwind pair, `oxfmt`, `oxlint`, the Vite pin, `hono` — but it does not
|
|
185
|
+
shrink the install to the runtime pair: `@openelement/router` declares its own
|
|
186
|
+
dependencies (the compiler, the protocol package, TypeScript, PostCSS, `mime`,
|
|
187
|
+
`pathe`) and npm installs those in a production install too. Vite, Element,
|
|
188
|
+
`hono`, `marked` and `@hono/vite-dev-server` are optional peers of the router
|
|
189
|
+
and are never auto-installed, so a `--omit=dev` tree has no Vite: run the build
|
|
190
|
+
from the full install and ship only its output.
|
|
191
|
+
|
|
192
|
+
The generated server entry itself imports no HTTP framework — it composes on
|
|
193
|
+
the internal WinterCG layer — and `hono` is only an optional peer of
|
|
194
|
+
`@openelement/router`: `@openelement/router/hono` (`createHonoAdapter`) is the
|
|
195
|
+
one opt-in if you ever want to mount the built handler inside your own Hono
|
|
196
|
+
app. For Nitro deployments, the built handler bridges through the
|
|
197
|
+
`@openelement/router/nitro-mount` subpath of the one `@openelement/router`
|
|
198
|
+
dependency. Do not remove them.
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
+
/* The page-404 light root's box: a custom element is inline by default and
|
|
2
|
+
the host tag is not authored markup, so no utility can carry it. */
|
|
1
3
|
:host {
|
|
2
4
|
display: block;
|
|
3
5
|
}
|
|
4
|
-
h1 {
|
|
5
|
-
font-size: 2.4rem;
|
|
6
|
-
letter-spacing: -0.02em;
|
|
7
|
-
margin: 0.75rem 0 0.5rem;
|
|
8
|
-
font-weight: 700;
|
|
9
|
-
}
|
|
10
|
-
p {
|
|
11
|
-
color: var(--ink-soft);
|
|
12
|
-
line-height: 1.6;
|
|
13
|
-
}
|
|
14
|
-
a {
|
|
15
|
-
color: var(--brand);
|
|
16
|
-
font-weight: 600;
|
|
17
|
-
text-decoration: none;
|
|
18
|
-
}
|
|
19
|
-
a:hover {
|
|
20
|
-
text-decoration: underline;
|
|
21
|
-
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Styled 404 page element (
|
|
3
|
-
* with a 404 status for unmatched paths
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `static styles` (the imported .css sheets), inlined into SSR as
|
|
7
|
-
* @scope(el-404). Like every page it renders inside the app shell
|
|
8
|
-
* (app/islands/app-shell.tsx), which owns the header and footer.
|
|
2
|
+
* Styled 404 page element (path-derived tag 'el-404'): the request-time server
|
|
3
|
+
* renders it with a 404 status for unmatched paths. Presentation is
|
|
4
|
+
* utility-first in the markup; the one rule in `static styles` is the root's
|
|
5
|
+
* own box.
|
|
9
6
|
*/
|
|
10
7
|
import { element, OpenElement } from "@openelement/element";
|
|
11
8
|
import notFoundPageStyles from "./page-404.css";
|
|
@@ -17,10 +14,12 @@ export default class NotFoundPage extends OpenElement {
|
|
|
17
14
|
render() {
|
|
18
15
|
return (
|
|
19
16
|
<div class="page-content">
|
|
20
|
-
<h1>404</h1>
|
|
21
|
-
<p>The page you are looking for does not exist.</p>
|
|
22
|
-
<p>
|
|
23
|
-
<a href="/">
|
|
17
|
+
<h1 class="mt-3 mb-2 text-[2.4rem] font-bold tracking-[-0.02em]">404</h1>
|
|
18
|
+
<p class="leading-[1.6] text-ink-soft">The page you are looking for does not exist.</p>
|
|
19
|
+
<p class="leading-[1.6] text-ink-soft">
|
|
20
|
+
<a class="font-semibold text-brand no-underline hover:underline" href="/">
|
|
21
|
+
Back to the homepage
|
|
22
|
+
</a>
|
|
24
23
|
</p>
|
|
25
24
|
</div>
|
|
26
25
|
);
|
|
@@ -1,72 +1,5 @@
|
|
|
1
|
+
/* The page-about light root's box: a custom element is inline by default and
|
|
2
|
+
the host tag is not authored markup, so no utility can carry it. */
|
|
1
3
|
:host {
|
|
2
4
|
display: block;
|
|
3
5
|
}
|
|
4
|
-
.eyebrow {
|
|
5
|
-
color: var(--brand);
|
|
6
|
-
font-weight: 600;
|
|
7
|
-
font-size: 0.78rem;
|
|
8
|
-
letter-spacing: 0.14em;
|
|
9
|
-
text-transform: uppercase;
|
|
10
|
-
margin: 0;
|
|
11
|
-
}
|
|
12
|
-
h1 {
|
|
13
|
-
font-size: clamp(1.9rem, 5vw, 2.6rem);
|
|
14
|
-
line-height: 1.15;
|
|
15
|
-
letter-spacing: -0.02em;
|
|
16
|
-
margin: 0.75rem 0 1rem;
|
|
17
|
-
font-weight: 700;
|
|
18
|
-
}
|
|
19
|
-
.lede {
|
|
20
|
-
font-size: 1.08rem;
|
|
21
|
-
color: var(--ink-soft);
|
|
22
|
-
max-width: 58ch;
|
|
23
|
-
margin: 0 0 2rem;
|
|
24
|
-
}
|
|
25
|
-
h2 {
|
|
26
|
-
font-size: 1.25rem;
|
|
27
|
-
letter-spacing: -0.01em;
|
|
28
|
-
margin: 2.25rem 0 0.6rem;
|
|
29
|
-
}
|
|
30
|
-
p {
|
|
31
|
-
margin: 0.6rem 0;
|
|
32
|
-
max-width: 62ch;
|
|
33
|
-
}
|
|
34
|
-
p code,
|
|
35
|
-
li code {
|
|
36
|
-
font-family: var(--font-mono);
|
|
37
|
-
font-size: 0.85em;
|
|
38
|
-
background: var(--surface);
|
|
39
|
-
border: 1px solid var(--line);
|
|
40
|
-
border-radius: 5px;
|
|
41
|
-
padding: 0.08em 0.35em;
|
|
42
|
-
}
|
|
43
|
-
.conventions {
|
|
44
|
-
list-style: none;
|
|
45
|
-
margin: 1rem 0 0;
|
|
46
|
-
padding: 0;
|
|
47
|
-
border-top: 1px solid var(--line);
|
|
48
|
-
}
|
|
49
|
-
.conventions li {
|
|
50
|
-
display: flex;
|
|
51
|
-
gap: 1rem;
|
|
52
|
-
padding: 0.7rem 0;
|
|
53
|
-
border-bottom: 1px solid var(--line);
|
|
54
|
-
flex-wrap: wrap;
|
|
55
|
-
}
|
|
56
|
-
.conventions code {
|
|
57
|
-
font-family: var(--font-mono);
|
|
58
|
-
font-size: 0.85rem;
|
|
59
|
-
color: var(--brand);
|
|
60
|
-
min-width: 15rem;
|
|
61
|
-
}
|
|
62
|
-
.conventions span {
|
|
63
|
-
color: var(--ink-soft);
|
|
64
|
-
font-size: 0.92rem;
|
|
65
|
-
}
|
|
66
|
-
a {
|
|
67
|
-
color: var(--brand);
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
}
|
|
70
|
-
a:hover {
|
|
71
|
-
text-decoration: underline;
|
|
72
|
-
}
|
|
@@ -1,75 +1,95 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* About page element — the fully static showcase page
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* prerendered markup and CSS. The page renders inside the auto-registered
|
|
7
|
-
* app shell (app/islands/app-shell.tsx), which owns the header, main region
|
|
8
|
-
* and footer; the badges come from ./badges.css (light root, inlined into
|
|
9
|
-
* SSR as @scope(about-page)). The compiled grammar lowers one root per
|
|
10
|
-
* render, so the page returns a single content wrapper.
|
|
2
|
+
* About page element — the fully static showcase page: no islands, so nothing
|
|
3
|
+
* here ships JavaScript. The default static renderIntent prerenders it to HTML
|
|
4
|
+
* at build time; the layout owns the chrome; the one rule in `static styles`
|
|
5
|
+
* is the root's own box.
|
|
11
6
|
*/
|
|
12
7
|
import { element, OpenElement } from "@openelement/element";
|
|
13
8
|
import aboutPageStyles from "./page-about.css";
|
|
14
|
-
import badgeStyles from "./badges.css";
|
|
15
9
|
|
|
16
10
|
@element("about-page", { root: "light" })
|
|
17
11
|
export default class AboutPage extends OpenElement {
|
|
18
|
-
static override styles = [aboutPageStyles
|
|
12
|
+
static override styles = [aboutPageStyles];
|
|
19
13
|
|
|
20
14
|
render() {
|
|
21
15
|
return (
|
|
22
16
|
<div class="page-content">
|
|
23
|
-
<span class="
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<p class="
|
|
17
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-ok/35 bg-ok/8 px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-ok uppercase">
|
|
18
|
+
static · no islands on this page
|
|
19
|
+
</span>
|
|
20
|
+
<p class="m-0 text-[0.78rem] font-semibold tracking-[0.14em] text-brand uppercase">About</p>
|
|
21
|
+
<h1 class="mt-3 mb-4 text-[clamp(1.9rem,5vw,2.6rem)] leading-[1.15] font-bold tracking-[-0.02em]">
|
|
22
|
+
Static first, interactive where it counts
|
|
23
|
+
</h1>
|
|
24
|
+
<p class="mb-8 max-w-[58ch] text-[1.08rem] text-ink-soft">
|
|
27
25
|
openElement prerenders pages to plain HTML and CSS at build time and hydrates compiled
|
|
28
26
|
islands only where a page needs interactivity. This page is the first half of that story:
|
|
29
27
|
it ships no islands at all.
|
|
30
28
|
</p>
|
|
31
|
-
<h2
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
the
|
|
29
|
+
<h2 class="mt-9 mb-[0.6rem] text-[1.25rem] tracking-[-0.01em]">
|
|
30
|
+
What happened when you opened this page
|
|
31
|
+
</h2>
|
|
32
|
+
<p class="my-[0.6rem] max-w-[62ch]">
|
|
33
|
+
The server sent HTML — prerendered at build time by SSG — plus the stylesheet the page's
|
|
34
|
+
utility classes compile into. No framework runtime executed to produce what you are
|
|
35
|
+
reading; the markup is the artifact.
|
|
36
36
|
</p>
|
|
37
|
-
<h2>Where things live</h2>
|
|
38
|
-
<ul class="
|
|
39
|
-
<li>
|
|
40
|
-
<code>app/routes/</code>
|
|
41
|
-
<span
|
|
37
|
+
<h2 class="mt-9 mb-[0.6rem] text-[1.25rem] tracking-[-0.01em]">Where things live</h2>
|
|
38
|
+
<ul class="mt-4 list-none border-t border-line p-0">
|
|
39
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
40
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/routes/</code>
|
|
41
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
42
|
+
page routes — one file per URL, prerendered by default
|
|
43
|
+
</span>
|
|
42
44
|
</li>
|
|
43
|
-
<li>
|
|
44
|
-
<code>app/routes/api/</code>
|
|
45
|
-
<span
|
|
45
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
46
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/routes/api/</code>
|
|
47
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
48
|
+
request-time server routes — plain Request → Response handlers
|
|
49
|
+
</span>
|
|
46
50
|
</li>
|
|
47
|
-
<li>
|
|
48
|
-
<code>app/components/</code>
|
|
49
|
-
<span
|
|
51
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
52
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/components/</code>
|
|
53
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
54
|
+
compiled page elements and the shared style sheets they array
|
|
55
|
+
</span>
|
|
50
56
|
</li>
|
|
51
|
-
<li>
|
|
52
|
-
<code>app/islands/</code>
|
|
53
|
-
<span
|
|
57
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
58
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/islands/</code>
|
|
59
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
60
|
+
client islands — the only code that ships JavaScript
|
|
61
|
+
</span>
|
|
54
62
|
</li>
|
|
55
|
-
<li>
|
|
56
|
-
<code>app/
|
|
57
|
-
<span
|
|
63
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
64
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/layout.tsx</code>
|
|
65
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
66
|
+
the shared site chrome wrapped around every page
|
|
67
|
+
</span>
|
|
58
68
|
</li>
|
|
59
|
-
<li>
|
|
60
|
-
<code
|
|
61
|
-
|
|
69
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
70
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">
|
|
71
|
+
app/styles/theme.css
|
|
72
|
+
</code>
|
|
73
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
74
|
+
design tokens — the @theme role sheet every utility reads
|
|
75
|
+
</span>
|
|
62
76
|
</li>
|
|
63
|
-
<li>
|
|
64
|
-
<code>app/head.tsx</code>
|
|
65
|
-
<span
|
|
77
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
78
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/head.tsx</code>
|
|
79
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
80
|
+
structural document-head content (meta tags, preloads)
|
|
81
|
+
</span>
|
|
66
82
|
</li>
|
|
67
83
|
</ul>
|
|
68
|
-
<h2>See it working</h2>
|
|
69
|
-
<p>
|
|
70
|
-
The
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
<h2 class="mt-9 mb-[0.6rem] text-[1.25rem] tracking-[-0.01em]">See it working</h2>
|
|
85
|
+
<p class="my-[0.6rem] max-w-[62ch]">
|
|
86
|
+
The{" "}
|
|
87
|
+
<a class="text-brand no-underline hover:underline" href="/">
|
|
88
|
+
home page
|
|
89
|
+
</a>{" "}
|
|
90
|
+
carries the interactive half: a counter island that hydrates on idle and a client-only
|
|
91
|
+
live timer. Open the browser DevTools on both pages and compare the network panels — the
|
|
92
|
+
badge on each section names what it costs.
|
|
73
93
|
</p>
|
|
74
94
|
</div>
|
|
75
95
|
);
|