@openelement/create 1.0.0-alpha.1 → 1.0.0-alpha.11

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.
Files changed (46) hide show
  1. package/README.md +99 -28
  2. package/package.json +15 -4
  3. package/src/cli.d.ts +1 -1
  4. package/src/cli.js +254 -65
  5. package/src/install-command.d.ts +50 -0
  6. package/src/install-command.js +52 -0
  7. package/src/pm.js +30 -0
  8. package/src/template-builder.js +78 -174
  9. package/src/version.js +12 -6
  10. package/templates/README.tmpl +110 -47
  11. package/templates/app/components/badges.css +5 -0
  12. package/templates/app/components/page-404.css +7 -0
  13. package/templates/app/components/page-404.tsx.tmpl +32 -11
  14. package/templates/app/components/page-about.css +15 -0
  15. package/templates/app/components/page-about.tsx.tmpl +93 -0
  16. package/templates/app/components/page-home.css +23 -0
  17. package/templates/app/components/page-home.tsx.tmpl +114 -40
  18. package/templates/app/components/site-chrome.css +15 -0
  19. package/templates/app/head.tsx.tmpl +32 -0
  20. package/templates/app/islands/live-timer.css +6 -0
  21. package/templates/app/islands/live-timer.tsx.tmpl +54 -0
  22. package/templates/app/islands/my-counter.css +11 -0
  23. package/templates/app/islands/my-counter.tsx.tmpl +5 -4
  24. package/templates/app/routes/about.tsx.tmpl +10 -0
  25. package/templates/app/routes/api/ping.ts.tmpl +12 -0
  26. package/templates/app/routes/index.tsx.tmpl +2 -2
  27. package/templates/app/styles/recipes.css +43 -0
  28. package/templates/app/styles/theme.css +170 -0
  29. package/templates/gitignore.tmpl +1 -0
  30. package/templates/openelement.config.ts.tmpl +39 -0
  31. package/templates/package.json.tmpl +26 -1
  32. package/templates/tsconfig.json.tmpl +16 -0
  33. package/templates/vite.config.ts.tmpl +6 -32
  34. package/templates/app/components/page-blog-index.tsx.tmpl +0 -39
  35. package/templates/app/components/page-blog-welcome.tsx.tmpl +0 -57
  36. package/templates/app/components/page-contact.tsx.tmpl +0 -49
  37. package/templates/app/components/page-freshness.tsx.tmpl +0 -26
  38. package/templates/app/components/page-styles.ts.tmpl +0 -166
  39. package/templates/app/islands/app-shell.tsx.tmpl +0 -58
  40. package/templates/app/islands/only-ticker.tsx.tmpl +0 -34
  41. package/templates/app/routes/api/health.ts.tmpl +0 -7
  42. package/templates/app/routes/blog/index.tsx.tmpl +0 -10
  43. package/templates/app/routes/blog/welcome.tsx.tmpl +0 -7
  44. package/templates/app/routes/contact.tsx.tmpl +0 -36
  45. package/templates/app/routes/freshness.tsx.tmpl +0 -17
  46. package/templates/deno.json.tmpl +0 -25
package/src/pm.js ADDED
@@ -0,0 +1,30 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import process from "node:process";
3
+ //#region src/pm.ts
4
+ /**
5
+ * Package-manager detection for the create CLI's install/start steps.
6
+ *
7
+ * A separate module (not cli.ts): the module is imported by the tests, and
8
+ * cli.ts executes the CLI at import time (top-level main), so anything the
9
+ * tests need to call must live beside it, not inside it.
10
+ */
11
+ /** One package-manager probe: spawn `<pm> --version` off-PATH failures give ENOENT. */
12
+ function packageManagerAvailable(pm) {
13
+ const probe = spawnSync(pm, ["--version"], {
14
+ stdio: "ignore",
15
+ shell: process.platform === "win32"
16
+ });
17
+ return probe.error === void 0 && probe.status === 0;
18
+ }
19
+ /**
20
+ * Package-manager detection (pnpm wins, npm is the floor). Both ship with
21
+ * Node-adjacent toolchains; the first probe that answers --version wins.
22
+ * Never returns: with no manager the CLI fails with the manual-install path.
23
+ */
24
+ function detectPackageManager() {
25
+ for (const pm of ["pnpm", "npm"]) if (packageManagerAvailable(pm)) return pm;
26
+ console.error("error: No package manager found (probed pnpm, then npm). Install one of them, then run the install step manually inside the project directory.");
27
+ process.exit(1);
28
+ }
29
+ //#endregion
30
+ export { detectPackageManager };
@@ -1,186 +1,90 @@
1
- import { CREATE_VERSION, VITE_STARTER_PIN } from './version.js';
2
- // npm package-name ceiling (validate-npm-package-name); a generated project
3
- // directory must stay a legal package name so `npm init`-style flows and
4
- // registry publication are never blocked by the scaffold itself (L11).
1
+ import { CREATE_VERSION, VITE_STARTER_PIN } from "./version.js";
2
+ import { readFile } from "node:fs/promises";
3
+ //#region src/template-builder.ts
5
4
  const MAX_PROJECT_NAME_LENGTH = 214;
6
5
  const PROJECT_NAME_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
7
6
  /**
8
- * L11: validate the scaffold target name before any filesystem work. Returns
9
- * an actionable message when the name is unsafe, `null` when it is a legal
10
- * npm-style package name that cannot escape the current directory.
11
- */ export function validateProjectName(name) {
12
- if (name.length === 0) return 'Project name must not be empty.';
13
- if (name.length > MAX_PROJECT_NAME_LENGTH) {
14
- return `Project name must be at most ${MAX_PROJECT_NAME_LENGTH} characters (npm package-name limit).`;
15
- }
16
- if (name.includes('..')) {
17
- return 'Project name must not contain ".." (path traversal is not allowed).';
18
- }
19
- if (name !== name.toLowerCase()) {
20
- return 'Project name must be lowercase (npm package names cannot contain uppercase letters).';
21
- }
22
- if (!PROJECT_NAME_PATTERN.test(name)) {
23
- return 'Project name must start with a lowercase letter or number and may only contain ' + 'lowercase letters, numbers, dots, underscores, and hyphens.';
24
- }
25
- return null;
7
+ * L11: validate the scaffold target name before any filesystem work. Returns
8
+ * an actionable message when the name is unsafe, `null` when it is a legal
9
+ * npm-style package name that cannot escape the current directory.
10
+ */
11
+ function validateProjectName(name) {
12
+ if (name.length === 0) return "Project name must not be empty.";
13
+ if (name.length > MAX_PROJECT_NAME_LENGTH) return `Project name must be at most ${MAX_PROJECT_NAME_LENGTH} characters (npm package-name limit).`;
14
+ if (name.includes("..")) return "Project name must not contain \"..\" (path traversal is not allowed).";
15
+ if (name !== name.toLowerCase()) return "Project name must be lowercase (npm package names cannot contain uppercase letters).";
16
+ if (!PROJECT_NAME_PATTERN.test(name)) return "Project name must start with a lowercase letter or number and may only contain lowercase letters, numbers, dots, underscores, and hyphens.";
17
+ return null;
26
18
  }
27
19
  /**
28
- * The published starter relies on the support-package same-version release
29
- * invariant. Package-graph and release-prepare gates verify that invariant;
30
- * Create deliberately has no runtime registry fallback or mixed-version mode.
31
- * Caller-supplied versions are validated by `buildTemplates` below.
32
- */ export function resolveVersions() {
33
- return {
34
- router: CREATE_VERSION,
35
- element: CREATE_VERSION
36
- };
20
+ * The published starter relies on the support-package same-version release
21
+ * invariant. Package-graph and release-prepare gates verify that invariant;
22
+ * Create deliberately has no runtime registry fallback or mixed-version mode.
23
+ * Caller-supplied versions are validated by `buildTemplates` below.
24
+ */
25
+ function resolveVersions() {
26
+ return {
27
+ router: CREATE_VERSION,
28
+ element: CREATE_VERSION
29
+ };
37
30
  }
38
- export function assertUnifiedProductVersions(versions) {
39
- const observed = [
40
- ...new Set(Object.values(versions))
41
- ];
42
- if (observed.length !== 1) {
43
- throw new Error(`Create requires the support-package same-version release invariant; observed ${observed.join(', ')}`);
44
- }
45
- return versions;
31
+ function assertUnifiedProductVersions(versions) {
32
+ const observed = [...new Set(Object.values(versions))];
33
+ if (observed.length !== 1) throw new Error(`Create requires the support-package same-version release invariant; observed ${observed.join(", ")}`);
34
+ return versions;
46
35
  }
47
- // [sourceTemplate, targetRelativePath] pairs. The starter manifest is stored
48
- // as deno.json.tmpl so deno does not treat the templates/ directory as a
49
- // nested workspace config; it is renamed to deno.json when written.
50
36
  const TEMPLATE_FILES = [
51
- // npm tarballs omit dotfiles even when a directory is included. Keep the
52
- // template non-hidden and write the expected dotfile into generated apps.
53
- [
54
- 'gitignore.tmpl',
55
- '.gitignore'
56
- ],
57
- [
58
- 'README.tmpl',
59
- 'README.md'
60
- ],
61
- [
62
- 'public/openelement-mark.svg',
63
- 'public/openelement-mark.svg'
64
- ],
65
- [
66
- 'deno.json.tmpl',
67
- 'deno.json'
68
- ],
69
- // package.json carries no runtime npm dependencies: framework consumption
70
- // resolves through the deno.json import map, and packed first-party
71
- // modules carry no bare @std/* specifiers, so no @jsr registry bridge is
72
- // generated. npm is the only public registry.
73
- [
74
- 'package.json.tmpl',
75
- 'package.json'
76
- ],
77
- [
78
- 'vite.config.ts.tmpl',
79
- 'vite.config.ts'
80
- ],
81
- [
82
- 'app/islands/app-shell.tsx.tmpl',
83
- 'app/islands/app-shell.tsx'
84
- ],
85
- [
86
- 'app/components/page-styles.ts.tmpl',
87
- 'app/components/page-styles.ts'
88
- ],
89
- [
90
- 'app/components/page-home.tsx.tmpl',
91
- 'app/components/page-home.tsx'
92
- ],
93
- [
94
- 'app/components/page-freshness.tsx.tmpl',
95
- 'app/components/page-freshness.tsx'
96
- ],
97
- [
98
- 'app/components/page-404.tsx.tmpl',
99
- 'app/components/page-404.tsx'
100
- ],
101
- [
102
- 'app/components/page-contact.tsx.tmpl',
103
- 'app/components/page-contact.tsx'
104
- ],
105
- [
106
- 'app/components/page-blog-index.tsx.tmpl',
107
- 'app/components/page-blog-index.tsx'
108
- ],
109
- [
110
- 'app/components/page-blog-welcome.tsx.tmpl',
111
- 'app/components/page-blog-welcome.tsx'
112
- ],
113
- [
114
- 'app/routes/404.tsx.tmpl',
115
- 'app/routes/404.tsx'
116
- ],
117
- [
118
- 'app/routes/index.tsx.tmpl',
119
- 'app/routes/index.tsx'
120
- ],
121
- [
122
- 'app/routes/freshness.tsx.tmpl',
123
- 'app/routes/freshness.tsx'
124
- ],
125
- [
126
- 'app/routes/contact.tsx.tmpl',
127
- 'app/routes/contact.tsx'
128
- ],
129
- [
130
- 'app/routes/blog/index.tsx.tmpl',
131
- 'app/routes/blog/index.tsx'
132
- ],
133
- [
134
- 'app/routes/blog/welcome.tsx.tmpl',
135
- 'app/routes/blog/welcome.tsx'
136
- ],
137
- [
138
- 'app/routes/api/health.ts.tmpl',
139
- 'app/routes/api/health.ts'
140
- ],
141
- [
142
- 'app/islands/my-counter.tsx.tmpl',
143
- 'app/islands/my-counter.tsx'
144
- ],
145
- [
146
- 'app/islands/only-ticker.tsx.tmpl',
147
- 'app/islands/only-ticker.tsx'
148
- ]
37
+ ["gitignore.tmpl", ".gitignore"],
38
+ ["README.tmpl", "README.md"],
39
+ ["public/openelement-mark.svg", "public/openelement-mark.svg"],
40
+ ["package.json.tmpl", "package.json"],
41
+ ["tsconfig.json.tmpl", "tsconfig.json"],
42
+ ["vite.config.ts.tmpl", "vite.config.ts"],
43
+ ["openelement.config.ts.tmpl", "openelement.config.ts"],
44
+ ["app/styles/theme.css", "app/styles/theme.css"],
45
+ ["app/styles/recipes.css", "app/styles/recipes.css"],
46
+ ["app/head.tsx.tmpl", "app/head.tsx"],
47
+ ["app/components/page-home.css", "app/components/page-home.css"],
48
+ ["app/components/page-about.css", "app/components/page-about.css"],
49
+ ["app/components/page-404.css", "app/components/page-404.css"],
50
+ ["app/components/badges.css", "app/components/badges.css"],
51
+ ["app/components/site-chrome.css", "app/components/site-chrome.css"],
52
+ ["app/components/page-home.tsx.tmpl", "app/components/page-home.tsx"],
53
+ ["app/components/page-about.tsx.tmpl", "app/components/page-about.tsx"],
54
+ ["app/components/page-404.tsx.tmpl", "app/components/page-404.tsx"],
55
+ ["app/routes/index.tsx.tmpl", "app/routes/index.tsx"],
56
+ ["app/routes/about.tsx.tmpl", "app/routes/about.tsx"],
57
+ ["app/routes/404.tsx.tmpl", "app/routes/404.tsx"],
58
+ ["app/routes/api/ping.ts.tmpl", "app/routes/api/ping.ts"],
59
+ ["app/islands/my-counter.tsx.tmpl", "app/islands/my-counter.tsx"],
60
+ ["app/islands/my-counter.css", "app/islands/my-counter.css"],
61
+ ["app/islands/live-timer.tsx.tmpl", "app/islands/live-timer.tsx"],
62
+ ["app/islands/live-timer.css", "app/islands/live-timer.css"]
149
63
  ];
150
64
  function versionTokens(v) {
151
- return {
152
- ['$' + '{v.router}']: v.router,
153
- ['$' + '{v.element}']: v.element
154
- };
65
+ return {
66
+ ["${v.router}"]: v.router,
67
+ ["${v.element}"]: v.element
68
+ };
155
69
  }
156
- export async function buildTemplates(v, projectName) {
157
- assertUnifiedProductVersions(v);
158
- const invalid = validateProjectName(projectName);
159
- if (invalid) throw new Error(`Invalid project name "${projectName}". ${invalid}`);
160
- const templatesBase = new URL('../templates/', import.meta.url);
161
- // The starter's Vite pin comes from the workspace-anchored VITE_STARTER_PIN
162
- // (deps:vite-check), not from the product release version.
163
- const tokens = {
164
- ...versionTokens(v),
165
- ['$' + '{v.vite}']: VITE_STARTER_PIN,
166
- ['$' + '{name}']: projectName
167
- };
168
- const entries = await Promise.all(TEMPLATE_FILES.map(async ([source, target])=>{
169
- let content = await Deno.readTextFile(new URL(source, templatesBase));
170
- for (const [token, value] of Object.entries(tokens)){
171
- if (content.includes(token)) content = content.split(token).join(value);
172
- }
173
- if (content.includes('${v.') || content.includes('${name}')) {
174
- throw new Error(`Unresolved scaffold token in starter template: ${source}`);
175
- }
176
- return [
177
- target,
178
- content
179
- ];
180
- }));
181
- // Code-unit comparison (not localeCompare): deterministic across host
182
- // locales and matches the test's toSorted() expectation, including
183
- // uppercase targets like README.md.
184
- entries.sort(([a], [b])=>a < b ? -1 : a > b ? 1 : 0);
185
- return Object.fromEntries(entries);
70
+ async function buildTemplates(v, projectName) {
71
+ assertUnifiedProductVersions(v);
72
+ const invalid = validateProjectName(projectName);
73
+ if (invalid) throw new Error(`Invalid project name "${projectName}". ${invalid}`);
74
+ const templatesBase = new URL("../templates/", import.meta.url);
75
+ const tokens = {
76
+ ...versionTokens(v),
77
+ ["${v.vite}"]: VITE_STARTER_PIN,
78
+ ["${name}"]: projectName
79
+ };
80
+ const entries = await Promise.all(TEMPLATE_FILES.map(async ([source, target]) => {
81
+ let content = await readFile(new URL(source, templatesBase), "utf8");
82
+ for (const [token, value] of Object.entries(tokens)) if (content.includes(token)) content = content.split(token).join(value);
83
+ if (content.includes("${v.") || content.includes("${name}")) throw new Error(`Unresolved scaffold token in starter template: ${source}`);
84
+ return [target, content];
85
+ }));
86
+ const out = Object.fromEntries(entries);
87
+ return Object.fromEntries(Object.entries(out).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
186
88
  }
89
+ //#endregion
90
+ export { assertUnifiedProductVersions, buildTemplates, resolveVersions, validateProjectName };
package/src/version.js CHANGED
@@ -1,7 +1,13 @@
1
- /** The published CLI version, embedded so packed npm installs are self-contained. */ export const CREATE_VERSION = '1.0.0-alpha.1';
1
+ //#region src/version.ts
2
+ /** The published CLI version, embedded so packed npm installs are self-contained. */
3
+ const CREATE_VERSION = "1.0.0-alpha.11";
2
4
  /**
3
- * The Vite dev release stamped into the generated starter's import map and
4
- * dev task. Embedded for the same reason as CREATE_VERSION (packed npm
5
- * installs are self-contained); deps:vite-check anchors this copy to the
6
- * canonical VITE_DEV_PIN in tools/repo/deps-vite-check.ts.
7
- */ export const VITE_STARTER_PIN = '8.0.16';
5
+ * The Vite release pinned into the generated starter's package.json (the
6
+ * `${v.vite}` scaffold token in the npm/pnpm starter). Embedded for the same
7
+ * reason as CREATE_VERSION (packed npm installs are self-contained); the
8
+ * repository's Vite-pin check (deps:vite-check in the repo tooling package) anchors this copy
9
+ * to the canonical dev pin.
10
+ */
11
+ const VITE_STARTER_PIN = "8.0.16";
12
+ //#endregion
13
+ export { CREATE_VERSION, VITE_STARTER_PIN };
@@ -1,54 +1,117 @@
1
- # My openElement App
1
+ # openElement Showcase
2
2
 
3
- Generated by [`@openelement/create`](https://www.npmjs.com/package/@openelement/create).
4
- A file-based openElement app: page routes live in `app/routes/`, compiled page
5
- elements and shared style sheets in `app/components/`, and client islands
6
- (including the `app-shell` layout island) in `app/islands/`.
3
+ Generated by [`@openelement/create`](https://www.npmjs.com/package/@openelement/create) —
4
+ scaffold it elsewhere with `npm create @openelement@1.0.0-alpha.10 <project-name>` —
5
+ a static-first openElement app that shows its own costs. The landing page
6
+ carries two islands (`my-counter`, an interactive counter, and `live-timer`,
7
+ a client-only elapsed-time readout); every other page, including `/about`,
8
+ is prerendered HTML and CSS with no islands at all. The badge on each
9
+ section names what it costs the client.
10
+
11
+ Docs and guides: https://openelement.org
12
+
13
+ One directory is generated rather than source: `.openElement/` at the project
14
+ root holds the build's internal state (head-convention bookkeeping and build
15
+ plans). `pnpm dev` and `pnpm build` write it as needed; the `.gitignore`
16
+ excludes it and deleting it is safe — the next run recreates it.
7
17
 
8
18
  This starter pins the exact `@openelement/element` and `@openelement/router`
9
- versions it was generated from (`${v.element}`) in `deno.json`; update both
10
- there when moving to a new release.
11
-
12
- Styling ownership is split three ways. Global design tokens and the document
13
- baseline (`body`, `::selection`) live in `vite.config.ts`
14
- (`inject.headFragments`). Pages use light roots and own their rules in
15
- `static styles` (`app/components/page-styles.ts`): the server inlines each
16
- page's sheets into the SSR output as a `@scope(<page-tag>)` style block, so
17
- pages are fully styled with zero client JavaScript. The shell and the islands
18
- hydrate in the browser and carry their own `static styles`.
19
-
20
- ## Tasks
21
-
22
- - `deno task dev` — start the Vite dev server.
23
- - `deno task check` — type-check every route/component file. When you add a
24
- route file, add it to this task's file list in `deno.json`.
25
- - `deno task test` — run Deno tests (the starter ships none).
26
- - `deno task build` — production build (SSG + Nitro server) into `dist/`.
27
- - `deno task start` — serve the production build. Use this for production
28
- preview: the starter ships a request-time route (`/contact`), so
29
- `deno task preview` (static-only preview, #601) is refused by design.
30
- - `deno task preview` — static-only preview; refused for this starter (see
31
- above).
32
-
33
- ## Blog
34
-
35
- Blog posts are compiled page routes: `app/routes/blog/welcome.tsx` renders at
36
- `/blog/welcome`, prerendered at build time. Add a post by creating a page
37
- element under `app/components/` and a route module under `app/routes/blog/`,
38
- then link it from `app/routes/blog/index.tsx` (the index list is static
39
- authoring). Interactive content belongs in a compiled island composed from
40
- the page.
41
-
42
- ## Import map notes
43
-
44
- `deno.json` maps `@openelement/router/nitro-mount` and `hono` even
45
- though no source file imports them: the dev server and the production
46
- build resolve `hono` when loading the generated server entry (the
47
- bundled `dist/` output inlines it), and Nitro deployments bridge the
48
- built handler through `@openelement/router/nitro-mount`. Do not remove
49
- them.
19
+ versions it was generated from in `package.json`; update both there when
20
+ moving to a new release.
21
+
22
+ ## The JS cost map
23
+
24
+ | Surface | Ships JavaScript? | Why |
25
+ | --- | --- | --- |
26
+ | `/` hero + architecture sections | no | prerendered markup, styled with CSS |
27
+ | `/` counter island (`my-counter`) | yes, hydrates on idle | the one interactive piece |
28
+ | `/` live timer island (`live-timer`) | yes, client-only | a live clock has nothing to prerender |
29
+ | `/about` | no islands at all | fully static SSG output |
30
+ | `/api/ping` | no (server) | a plain `Request → Response` handler |
31
+
32
+ The badge classes (`badge-static`, `badge-island`) live in
33
+ `app/components/badges.css` — copy them onto new sections and keep the
34
+ map honest.
35
+
36
+ > Cost honesty: the island client is emitted app-wide today. A page without
37
+ > islands (like `/about`) carries no island hosts and renders nothing
38
+ > interactive, but the shared loader — and with the current app-wide
39
+ > hydration manifest, the island chunks themselves — still ride along in its
40
+ > network panel. Per-page pruning is framework work, not something a template
41
+ > can opt into; the page is authored so it becomes fully silent the moment
42
+ > the framework ships it.
43
+
44
+ ## Where things live
45
+
46
+ Framework options have exactly one home: `openelement.config.ts`. It is
47
+ optional and nearly empty — every option it omits comes from a file
48
+ convention:
49
+
50
+ | Option | Convention |
51
+ | --- | --- |
52
+ | design tokens | `app/styles/theme.css` (the @theme role sheet) |
53
+ | document head content | `app/head.tsx` (meta tags, preloads, inline CSS) |
54
+ | site title | the `name` field of `package.json` |
55
+ | 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) |
56
+
57
+ Passing framework options inline to `openElement()` while the config file
58
+ carries options is a hard error, and an unknown key fails the build with the
59
+ accepted-key list. `vite.config.ts` stays Vite-only: `plugins: [...openElement()]`.
60
+
61
+ - `app/routes/` — page routes, one file per URL. The default renderIntent is
62
+ `static`: prerendered at build time (SSG). `/about` and `/` are static.
63
+ - `app/routes/api/` — request-time server routes. `/api/ping` is a plain
64
+ WinterCG-shaped handler returning `Response.json`.
65
+ - `app/components/` — compiled page elements and their style sheets
66
+ (page CSS lives in `.css` files next to each element; pages import and
67
+ array them in `static styles`, sharing `site-chrome.css`/`badges.css`).
68
+ - `app/islands/` — client islands, the only code that ships JavaScript. Each
69
+ island declares its hydration strategy (`idle`, `load`, `visible`,
70
+ client-only) through `defineIslandConfig`.
71
+ - `app/styles/theme.css` — the @theme role sheet: Tailwind-ON roles, the starter palette aliases, dark and forced-colors pairs. Dev serves it directly; the build compiles it through the router's Tailwind preset.
72
+ Dark values ride `prefers-color-scheme`; no theme runtime.
73
+ - `app/styles/recipes.css` — documented plain HTML+CSS recipes for the
74
+ zero-interaction shapes (badge, callout, card, CSS-only tabs) that retired
75
+ from `@openelement/ui` (#1557). Delete the blocks you do not use: static
76
+ content never justifies a custom element.
77
+ - `app/head.tsx` — structural head content the URL list cannot express.
78
+
79
+ ## Scripts
80
+
81
+ - `pnpm dev` — start the Vite dev server.
82
+ - `pnpm check` — type-check every route/component file. The check covers the
83
+ whole `app/` directory (`tsconfig.json`), so new files are picked up
84
+ automatically.
85
+ - `pnpm test` — run Node's built-in test runner (the starter ships none).
86
+ - `pnpm build` — production build (SSG + Nitro server) into `dist/`.
87
+ - `pnpm start` — serve the production build.
88
+ - `pnpm preview` — static-only preview of the SSG output.
89
+
90
+ ## Styling ownership
91
+
92
+ Global design tokens and the document baseline (`body`, `::selection`) live
93
+ in `app/styles/theme.css`. Pages use light roots and own their rules in
94
+ `static styles`, arrayed from imported `.css` files (#1558 — the one style
95
+ authoring form): the server inlines each page's sheets into the SSR output as
96
+ a `@scope(<page-tag>)` style block, so pages are fully styled with zero
97
+ client JavaScript. Islands carry their own `.css` sheets the same way; in
98
+ island chunks those ride the style-asset protocol as real `.css` assets.
50
99
 
51
100
  ## Brand assets
52
101
 
53
102
  `public/openelement-mark.svg` is the openElement brand mark shipped with the
54
- starter — use it for a favicon or page header, or delete it if unused.
103
+ starter — the config file references it as the favicon, or delete it if
104
+ unused.
105
+
106
+ ## Dependency notes
107
+
108
+ `@hono/vite-dev-server` is installed even though no source file imports it:
109
+ the Vite dev server needs it, and it is loaded lazily, so `build`/`start`
110
+ never resolve it. `hono` rides along because the dev server's own node
111
+ adapter declares it a peer. The generated server entry itself imports no
112
+ HTTP framework — it composes on the internal WinterCG layer (#1560); `hono`
113
+ is an optional peer of `@openelement/router`, and `@openelement/router/hono`
114
+ (`createHonoAdapter`) is the one opt-in if you ever want to mount the built
115
+ handler inside your own Hono app. For Nitro deployments, the built handler
116
+ bridges through the `@openelement/router/nitro-mount` subpath of the one
117
+ `@openelement/router` dependency. Do not remove them.
@@ -0,0 +1,5 @@
1
+
2
+ .badge { display: inline-flex; align-items: center; gap: 0.4em; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--line); color: var(--ink-soft); background: var(--surface); }
3
+ .badge-static { border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
4
+ .badge-island { border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); background: var(--brand-soft); }
5
+
@@ -0,0 +1,7 @@
1
+
2
+ :host { display: block; }
3
+ h1 { font-size: 2.4rem; letter-spacing: -0.02em; margin: 0.75rem 0 0.5rem; font-weight: 700; }
4
+ p { color: var(--ink-soft); line-height: 1.6; }
5
+ a { color: var(--brand); font-weight: 600; text-decoration: none; }
6
+ a:hover { text-decoration: underline; }
7
+
@@ -2,25 +2,46 @@
2
2
  * Styled 404 page element (#923): the request-time server renders this page
3
3
  * with a 404 status for unmatched paths; SSG builds also emit it as static
4
4
  * 404.html. The path-derived tag is 'el-404'. Light root: the page owns its
5
- * rules via `static styles` (./page-styles.ts), inlined into SSR as
6
- * @scope(el-404).
5
+ * rules via `static styles` (the imported .css sheets), inlined into SSR as
6
+ * @scope(el-404). The site chrome sheet (./site-chrome.css) is shared
7
7
  */
8
8
  import { element, OpenElement } from '@openelement/element';
9
- import { notFoundPageStyles } from './page-styles.ts';
9
+ import notFoundPageStyles from './page-404.css';
10
+ import siteChromeStyles from './site-chrome.css';
10
11
 
11
12
  @element('el-404', { root: 'light' })
12
13
  export default class NotFoundPage extends OpenElement {
13
- static override styles = notFoundPageStyles;
14
+ static override styles = [notFoundPageStyles, siteChromeStyles];
14
15
 
15
16
  render() {
16
17
  return (
17
- <main>
18
- <h1>404</h1>
19
- <p>The page you are looking for does not exist.</p>
20
- <p>
21
- <a href='/'>Back to the homepage</a>
22
- </p>
23
- </main>
18
+ <div class='page-body'>
19
+ <header class='site-head'>
20
+ <div class='bar'>
21
+ <a class='site-brand' href='/'>
22
+ openElement
23
+ </a>
24
+ <nav>
25
+ <a href='/'>Home</a>
26
+ <a href='/about'>About</a>
27
+ <a href='/api/ping'>API</a>
28
+ </nav>
29
+ </div>
30
+ </header>
31
+ <main>
32
+ <h1>404</h1>
33
+ <p>The page you are looking for does not exist.</p>
34
+ <p>
35
+ <a href='/'>Back to the homepage</a>
36
+ </p>
37
+ </main>
38
+ <footer class='site-foot'>
39
+ <div class='bar'>
40
+ <span>Generated by @openelement/create.</span>
41
+ <a href='https://openelement.org'>openelement.org</a>
42
+ </div>
43
+ </footer>
44
+ </div>
24
45
  );
25
46
  }
26
47
  }
@@ -0,0 +1,15 @@
1
+
2
+ :host { display: block; }
3
+ .eyebrow { color: var(--brand); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; margin: 0; }
4
+ h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0.75rem 0 1rem; font-weight: 700; }
5
+ .lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 58ch; margin: 0 0 2rem; }
6
+ h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 2.25rem 0 0.6rem; }
7
+ p { margin: 0.6rem 0; max-width: 62ch; }
8
+ p code, li code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.35em; }
9
+ .conventions { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
10
+ .conventions li { display: flex; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
11
+ .conventions code { font-family: var(--font-mono); font-size: 0.85rem; color: var(--brand); min-width: 15rem; }
12
+ .conventions span { color: var(--ink-soft); font-size: 0.92rem; }
13
+ a { color: var(--brand); text-decoration: none; }
14
+ a:hover { text-decoration: underline; }
15
+