@openelement/create 1.0.0-alpha.13 → 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.
Files changed (34) hide show
  1. package/README.md +49 -19
  2. package/package.json +1 -1
  3. package/src/cli.js +159 -76
  4. package/src/node-version.js +102 -0
  5. package/src/pm.js +143 -9
  6. package/src/template-builder.js +59 -6
  7. package/src/version.js +2 -10
  8. package/templates/.node-version +1 -0
  9. package/templates/AGENTS.md.tmpl +44 -0
  10. package/templates/README.tmpl +140 -74
  11. package/templates/app/components/page-404.css +5 -7
  12. package/templates/app/components/page-404.tsx.tmpl +16 -37
  13. package/templates/app/components/page-about.css +5 -15
  14. package/templates/app/components/page-about.tsx.tmpl +86 -82
  15. package/templates/app/components/page-home.css +5 -23
  16. package/templates/app/components/page-home.tsx.tmpl +137 -114
  17. package/templates/app/components/site-chrome.css +5 -15
  18. package/templates/app/head.tsx.tmpl +12 -23
  19. package/templates/app/islands/live-timer.css +5 -9
  20. package/templates/app/islands/live-timer.tsx.tmpl +31 -21
  21. package/templates/app/islands/my-counter.css +5 -11
  22. package/templates/app/islands/my-counter.tsx.tmpl +26 -13
  23. package/templates/app/layout.tsx.tmpl +68 -0
  24. package/templates/app/routes/404.tsx.tmpl +7 -10
  25. package/templates/app/routes/about.tsx.tmpl +4 -4
  26. package/templates/app/routes/api/ping.ts.tmpl +4 -5
  27. package/templates/app/routes/index.tsx.tmpl +4 -4
  28. package/templates/app/styles/theme.css +64 -79
  29. package/templates/openelement.config.ts.tmpl +21 -33
  30. package/templates/package.json.tmpl +14 -10
  31. package/templates/tsconfig.json.tmpl +1 -1
  32. package/templates/vite.config.ts.tmpl +9 -7
  33. package/templates/app/components/badges.css +0 -5
  34. package/templates/app/styles/recipes.css +0 -43
@@ -1,32 +1,21 @@
1
1
  /**
2
- * app/head.tsx — the starter's structural document-head content.
2
+ * app/head.tsx — structural document-head content: the entries a URL list
3
+ * cannot express (here, the color-scheme declaration).
3
4
  *
4
- * Everything here is DATA: the framework validates attribute names and URL
5
- * values, escapes every attribute, and serializes the tags into the document
6
- * <head>. The array is emitted in the order written, so this file is the head
7
- * order. Delete the file and the starter still builds — it is a convention, not
8
- * a requirement.
5
+ * Entries are DATA and are emitted in the order written: `{ meta: {...} }` is
6
+ * one meta tag, `{ link: { rel, href } }` one link tag, `{ style: 'css' }` one
7
+ * inline style block. The build compiles this module, so it can import CSS by
8
+ * URL and pull local constants — but it must not use host APIs: its output is
9
+ * a build artifact.
9
10
  *
10
- * Entries take one of three shapes:
11
- * { meta: { name, content } } one <meta> tag
12
- * { link: { rel, href, ... } } one <link> tag (rel and href are required)
13
- * { style: 'css text' } one inline <style> block
14
- *
15
- * The module is compiled by the build, so it can import CSS by URL
16
- * (`import css from './site.css?raw'`) and pull constants from local modules.
17
- * It must not use host APIs (no Deno, no Node): its output is a build artifact,
18
- * so a runtime read would make the document depend on the build machine.
19
- *
20
- * `head` in openelement.config.ts already covers the title, description,
21
- * favicon and the og:/twitter: pairs; `head.scripts` / `head.stylesheets`
22
- * cover external scripts and stylesheets. This file is for what neither can
23
- * express — here, the color-scheme declaration. Per-page meaning (title,
24
- * description, og:title, canonical) is declared by each route module's `head`,
25
- * which resolves at render time and wins for crawlers.
11
+ * Title, description, favicon and the og:/twitter: pairs come from `head` in
12
+ * openelement.config.ts. A route's own `head.meta` overrides a site default
13
+ * with the same property; `name=` entries never suppress one. Delete this file
14
+ * and the starter still builds — it is a convention, not a requirement.
26
15
  */
27
16
  export default [
28
17
  // Declaring the color scheme the starter supports lets the browser pick the
29
18
  // right native form/scrollbar palette before any CSS is parsed. The dark
30
19
  // palette itself is theme.css's dark pair block — no runtime.
31
- { meta: { name: 'color-scheme', content: 'dark light' } },
20
+ { meta: { name: "color-scheme", content: "dark light" } },
32
21
  ];
@@ -1,9 +1,5 @@
1
-
2
- :host { display: inline-block; }
3
- .timer-row { display: inline-flex; gap: 0.6rem; align-items: baseline; }
4
- /* #1582: the selector names the id the class renders (#elapsed) — a
5
- `.value` selector matched nothing, so the clock lost its brand color
6
- and tabular figures. */
7
- #elapsed { min-width: 6ch; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.4rem; color: var(--brand); }
8
- .unit { color: var(--ink-soft); font-size: 0.85rem; }
9
-
1
+ /* The island shadow host's box; the row and clock are authored as Tailwind
2
+ utilities in live-timer.tsx. */
3
+ :host {
4
+ display: inline-block;
5
+ }
@@ -2,52 +2,62 @@
2
2
  * live-timer — client-only live stats island (compiled).
3
3
  *
4
4
  * hydrate: 'only' with ssr: false renders nothing on the server; the client
5
- * entry creates the DOM fresh from the compiled Part Program and starts the
6
- * clock in connectedCallback. Elapsed time is measured from the document's
7
- * time origin (performance.now()), so the number is honest page time, and
5
+ * entry builds the DOM from the compiled Part Program and starts the clock in
6
+ * connectedCallback, measured from the document's time origin.
8
7
  * disconnectedCallback stops the interval when the host leaves the tree.
9
8
  */
10
- import { defineIslandConfig } from '@openelement/router';
11
- import { element, OpenElement, property } from '@openelement/element';
12
- import timerStyles from './live-timer.css';
9
+ import { defineIslandConfig } from "@openelement/router";
10
+ import { element, OpenElement, property } from "@openelement/element";
11
+ import timerStyles from "./live-timer.css";
13
12
 
14
- export const openElement = defineIslandConfig({ hydrate: 'only', ssr: false, dsd: false });
13
+ export const openElement = defineIslandConfig({ hydrate: "only", ssr: false, dsd: false });
15
14
 
16
- // The interval handle rides the compiled per-instance property state: island
17
- // classes carry compiled @property fields and methods, and module-level
18
- // runtime statements are outside the compiled grammar (OEC9008). In the
19
- // browser setInterval returns a number, so the handle is a plain number here.
20
- @element('live-timer', { root: 'shadow-open' })
15
+ // The interval handle rides compiled per-instance property state (module-level
16
+ // runtime statements are outside the compiled grammar, OEC9008).
17
+ @element("live-timer", { root: "shadow-open" })
21
18
  export default class LiveTimer extends OpenElement {
22
19
  static override styles = [timerStyles];
23
20
 
24
- /** Elapsed seconds as preformatted text (compiled text Parts bind plain
25
- * properties — no method calls in a text region, OEC9013). */
21
+ /** Elapsed seconds, preformatted: a compiled text Part binds a plain
22
+ * property, never a method call (OEC9013). */
26
23
  @property({ reflect: false, attribute: false })
27
- elapsed = '0.0';
24
+ elapsed = "0.0";
28
25
 
29
- /** The ticking interval's handle; 0 when the host is not connected. */
26
+ /**
27
+ * The ticking interval's handle; 0 when the host is not connected.
28
+ *
29
+ * `window.setInterval`, not the bare global: the generated tsconfig loads
30
+ * both DOM and node types (@types/node), so the bare `setInterval` name
31
+ * resolves to Node's overload and the handle becomes a `NodeJS.Timeout`
32
+ * (TS2322 on the assignment). The browser entry runs in the DOM, where the
33
+ * call returns a `number` — the honest type for this field.
34
+ */
30
35
  @property({ reflect: false, attribute: false })
31
36
  interval = 0;
32
37
 
33
38
  override connectedCallback(): void {
34
39
  super.connectedCallback();
35
- this.interval = setInterval(() => {
40
+ this.interval = window.setInterval(() => {
36
41
  this.elapsed = (Math.round(performance.now()) / 1000).toFixed(1);
37
42
  }, 100);
38
43
  }
39
44
 
40
45
  override disconnectedCallback(): void {
41
- clearInterval(this.interval);
46
+ window.clearInterval(this.interval);
42
47
  this.interval = 0;
43
48
  super.disconnectedCallback();
44
49
  }
45
50
 
46
51
  render() {
47
52
  return (
48
- <div class='timer-row'>
49
- <span id='elapsed'>{this.elapsed}</span>
50
- <span class='unit'>seconds on this page</span>
53
+ <div class="inline-flex items-baseline gap-[0.6rem]">
54
+ <span
55
+ id="elapsed"
56
+ class="min-w-[6ch] text-right text-[1.4rem] font-semibold text-brand tabular-nums"
57
+ >
58
+ {this.elapsed}
59
+ </span>
60
+ <span class="text-[0.85rem] text-ink-soft">seconds on this page</span>
51
61
  </div>
52
62
  );
53
63
  }
@@ -1,11 +1,5 @@
1
-
2
- :host { display: inline-block; }
3
- .counter-row { display: inline-flex; gap: 0.75rem; align-items: center; }
4
- button {
5
- width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: var(--radius-s);
6
- background: var(--paper); color: var(--ink); font-size: 1rem; line-height: 1; cursor: pointer;
7
- transition: border-color 0.15s ease, color 0.15s ease;
8
- }
9
- button:hover { border-color: var(--brand); color: var(--brand); }
10
- span { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
11
-
1
+ /* The island shadow host's box; the row, buttons and count are authored as
2
+ Tailwind utilities in my-counter.tsx. */
3
+ :host {
4
+ display: inline-block;
5
+ }
@@ -1,18 +1,17 @@
1
1
  /**
2
2
  * my-counter — the interactive counter island (compiled).
3
3
  *
4
- * Hydrates on idle; the buttons increment/decrement through the compiled
5
- * event Parts and the count renders through the compiled text Part. The
6
- * shadow root keeps the island a DSD citizen. Design tokens from
7
- * app/styles/theme.css inherit through the shadow boundary.
4
+ * Hydrates on idle; the buttons drive compiled event Parts and the count
5
+ * renders through a compiled text Part. Presentation is utility-first below,
6
+ * and the shadow root keeps the island a DSD citizen.
8
7
  */
9
- import { defineIslandConfig } from '@openelement/router';
10
- import { element, OpenElement, property } from '@openelement/element';
11
- import counterStyles from './my-counter.css';
8
+ import { defineIslandConfig } from "@openelement/router";
9
+ import { element, OpenElement, property } from "@openelement/element";
10
+ import counterStyles from "./my-counter.css";
12
11
 
13
- export const openElement = defineIslandConfig({ hydrate: 'idle', ssr: true, dsd: true });
12
+ export const openElement = defineIslandConfig({ hydrate: "idle", ssr: true, dsd: true });
14
13
 
15
- @element('my-counter', { root: 'shadow-open' })
14
+ @element("my-counter", { root: "shadow-open" })
16
15
  export default class MyCounter extends OpenElement {
17
16
  static override styles = [counterStyles];
18
17
 
@@ -29,10 +28,24 @@ export default class MyCounter extends OpenElement {
29
28
 
30
29
  render() {
31
30
  return (
32
- <div class='counter-row'>
33
- <button type='button' onClick={this.decrement}>-</button>
34
- <span id='count'>{this.count}</span>
35
- <button type='button' onClick={this.increment}>+</button>
31
+ <div class="inline-flex items-center gap-3">
32
+ <button
33
+ class="size-8 cursor-pointer rounded-(--radius-s) border border-line bg-paper text-[1rem] leading-none text-ink transition-[border-color,color] duration-150 ease-out hover:border-brand hover:text-brand"
34
+ type="button"
35
+ onClick={this.decrement}
36
+ >
37
+ -
38
+ </button>
39
+ <span id="count" class="min-w-[2ch] text-center font-semibold tabular-nums">
40
+ {this.count}
41
+ </span>
42
+ <button
43
+ class="size-8 cursor-pointer rounded-(--radius-s) border border-line bg-paper text-[1rem] leading-none text-ink transition-[border-color,color] duration-150 ease-out hover:border-brand hover:text-brand"
44
+ type="button"
45
+ onClick={this.increment}
46
+ >
47
+ +
48
+ </button>
36
49
  </div>
37
50
  );
38
51
  }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * app/layout.tsx — the auto-registered layout: header, main slot and footer
3
+ * exist here exactly once, so a page module carries only its own content.
4
+ *
5
+ * `root: 'shadow-open'` is what makes the projection work — the chrome renders
6
+ * in this element's shadow tree while the slotted page content stays in the
7
+ * page's light DOM. The markup below is styled with Tailwind utilities; the
8
+ * sheet in `static styles` holds only the host box, which has no markup to
9
+ * carry it.
10
+ *
11
+ * A convention, not a requirement: delete the file and pages render their own
12
+ * chrome again, or opt out with `layout: false` in openelement.config.ts.
13
+ */
14
+ import { element, OpenElement } from "@openelement/element";
15
+ import siteChromeStyles from "./components/site-chrome.css";
16
+
17
+ @element("app-layout", { root: "shadow-open" })
18
+ export default class Layout extends OpenElement {
19
+ static override styles = [siteChromeStyles];
20
+
21
+ render() {
22
+ return (
23
+ <div>
24
+ <header class="site-head border-b border-line bg-paper">
25
+ <div class="mx-auto flex max-w-(--content-width) items-baseline justify-between gap-4 px-5 py-4">
26
+ <a
27
+ class="text-[1.1rem] font-bold tracking-[-0.01em] text-ink no-underline hover:text-brand"
28
+ href="/"
29
+ >
30
+ openElement
31
+ </a>
32
+ <nav class="flex gap-5">
33
+ <a
34
+ class="text-[0.95rem] font-medium text-ink-soft no-underline hover:text-brand"
35
+ href="/"
36
+ >
37
+ Home
38
+ </a>
39
+ <a
40
+ class="text-[0.95rem] font-medium text-ink-soft no-underline hover:text-brand"
41
+ href="/about"
42
+ >
43
+ About
44
+ </a>
45
+ <a
46
+ class="text-[0.95rem] font-medium text-ink-soft no-underline hover:text-brand"
47
+ href="/api/ping"
48
+ >
49
+ API
50
+ </a>
51
+ </nav>
52
+ </div>
53
+ </header>
54
+ <main class="mx-auto max-w-(--content-width) px-5 pt-12 pb-16">
55
+ <slot></slot>
56
+ </main>
57
+ <footer class="site-foot border-t border-line text-[0.85rem] text-ink-soft">
58
+ <div class="mx-auto flex max-w-(--content-width) flex-wrap justify-between gap-4 p-5">
59
+ <span>Generated by @openelement/create.</span>
60
+ <a class="text-ink-soft no-underline hover:text-brand" href="https://openelement.org">
61
+ openelement.org
62
+ </a>
63
+ </div>
64
+ </footer>
65
+ </div>
66
+ );
67
+ }
68
+ }
@@ -1,15 +1,12 @@
1
1
  /**
2
- * Styled 404 (#923). `renderIntent: { mode: 'dynamic' }` keeps this page on
3
- * the request-time path, and it is the reason this starter's build emits
4
- * `dist/server/`: the request-time server renders it with a 404 status for
5
- * every unmatched path, so the build writes no static 404.html. Drop the
6
- * renderIntent line and the route becomes prerenderable — a build with no
7
- * other request-time route then writes the page to dist/404.html.
2
+ * Styled 404: `renderIntent: { mode: 'dynamic' }` keeps this route on the
3
+ * request-time path — the reason this starter's build emits `dist/server/`.
4
+ * Drop the line and the route prerenders to dist/404.html instead.
8
5
  */
9
- import { definePage } from '@openelement/router';
10
- import NotFoundPage from '../components/page-404.tsx';
6
+ import { definePage } from "@openelement/router";
7
+ import NotFoundPage from "../components/page-404.tsx";
11
8
 
12
9
  export default definePage(NotFoundPage, {
13
- renderIntent: { mode: 'dynamic' },
14
- head: { title: '404 — openElement' },
10
+ renderIntent: { mode: "dynamic" },
11
+ head: { title: "404 — openElement" },
15
12
  });
@@ -1,10 +1,10 @@
1
1
  /** Static About page (default renderIntent mode 'static') — prerendered at build time. */
2
- import { definePage } from '@openelement/router';
3
- import AboutPage from '../components/page-about.tsx';
2
+ import { definePage } from "@openelement/router";
3
+ import AboutPage from "../components/page-about.tsx";
4
4
 
5
5
  export default definePage(AboutPage, {
6
6
  head: {
7
- title: 'About',
8
- description: 'Static-first openElement showcase — this page ships no islands',
7
+ title: "About",
8
+ description: "Static-first openElement showcase — this page ships no islands",
9
9
  },
10
10
  });
@@ -1,12 +1,11 @@
1
1
  /**
2
- * /api/ping — a request-time server route: a plain WinterCG-shaped handler
3
- * (Request → Response). No framework runtime attaches to it; any Response
4
- * works, and Response.json is the common shape.
2
+ * /api/ping — a request-time server route: a plain WinterCG-shaped
3
+ * Request → Response handler with no framework runtime attached.
5
4
  */
6
5
  export default function ping() {
7
6
  return Response.json({
8
7
  pong: true,
9
- framework: 'openElement',
10
- route: '/api/ping',
8
+ framework: "openElement",
9
+ route: "/api/ping",
11
10
  });
12
11
  }
@@ -1,10 +1,10 @@
1
1
  /** Static home page (default renderIntent mode 'static') — prerendered at build time. */
2
- import { definePage } from '@openelement/router';
3
- import HomePage from '../components/page-home.tsx';
2
+ import { definePage } from "@openelement/router";
3
+ import HomePage from "../components/page-home.tsx";
4
4
 
5
5
  export default definePage(HomePage, {
6
6
  head: {
7
- title: 'Rendered before JavaScript arrives',
8
- description: 'openElement showcase — static pages, alive where it counts',
7
+ title: "Rendered before JavaScript arrives",
8
+ description: "openElement showcase — static pages, alive where it counts",
9
9
  },
10
10
  });
@@ -1,22 +1,18 @@
1
- /* ═══════════════════════════════════════════════════════════════════════
2
- The starter's @theme role sheet — the ONE styling source (Tailwind-ON is
3
- the single scaffold default; there is no variant pair and no flag).
4
-
5
- Two layers share this file:
6
- 1. @theme roles — shadcn-style semantic names over Tailwind default scale
7
- variables (var(--color-<ramp>-<step>)). Extend by naming a role on the
8
- left and an existing Tailwind variable on the right.
9
- 2. The starter palette aliases — the --paper/--ink/--brand names the
10
- component sheets use, each seated on a role so the dark and
11
- forced-colors pairs below apply everywhere.
12
-
13
- `pnpm dev` and the build both compile this file through the router's
14
- Tailwind preset: dev serves the compile from
15
- /.openElement/tailwind-preset/entry.css and links it in the document head,
16
- the build emits the same compile as the layer-ordered linked bundle.
17
- ═══════════════════════════════════════════════════════════════════════ */
18
-
19
- @theme {
1
+ /* The starter's theme sheet — the ONE styling source (Tailwind-ON is the
2
+ single scaffold default; there is no variant pair and no flag).
3
+
4
+ Two layers: @theme roles (shadcn-style semantic names over Tailwind default
5
+ scale variables) and the starter palette the markup consumes as utilities
6
+ (bg-paper, text-brand, border-line, …), each seated on a role so the dark
7
+ and forced-colors pairs below apply everywhere. `@theme static` keeps a
8
+ pruned variable from taking its palette aliases down with it.
9
+
10
+ Everything presentation-level is authored as Tailwind utilities in markup.
11
+ This token sheet, the document base below, and each component's `:host` box
12
+ rule are the only CSS. Dev and the build compile this file through the
13
+ official @tailwindcss/vite pipeline. */
14
+
15
+ @theme static {
20
16
  /* ── semantic roles (light), over the TW4 default scale.
21
17
  Violet-anchored roles (the starter brand reads violet); neutral
22
18
  surfaces stay zinc so the page base keeps its near-neutral paper
@@ -49,12 +45,39 @@
49
45
  --color-border: var(--color-violet-200);
50
46
  --color-input: var(--color-violet-200);
51
47
  --color-ring: var(--color-violet-500);
48
+
49
+ /* ── starter palette (the utility names the scaffold's markup reads) ── */
50
+
51
+ --color-paper: var(--color-background);
52
+ --color-surface: var(--color-card);
53
+ --color-ink: var(--color-foreground);
54
+ --color-ink-soft: var(--color-muted-foreground);
55
+ --color-line: var(--color-border);
56
+ --color-brand: var(--color-primary);
57
+ --color-brand-ink: var(--color-primary-foreground);
58
+ --color-brand-soft: var(--color-secondary);
59
+ /* --color-ok is read as text on a low-% tint of itself, so it seats on a
60
+ *-foreground role: a surface step there is unreadable (≈1.1:1). */
61
+ --color-ok: var(--color-secondary-foreground);
62
+
63
+ --font-sans: system-ui, -apple-system, sans-serif;
64
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
52
65
  }
53
66
 
54
- /* Dark pairs (shadcn v4 convention; the selector matches the runtime theme
55
- attribute the ui package documents). */
56
- :root[data-theme='dark'],
57
- :host([data-theme='dark']) {
67
+ /* Non-role tokens: nothing in the utility grammar reads them, so they must
68
+ not claim a theme namespace. */
69
+ :root {
70
+ --radius-s: 6px;
71
+ --radius-m: 10px;
72
+ --radius-l: 16px;
73
+ --content-width: 46rem;
74
+ --shadow-1: 0 1px 3px 0 rgb(20 18 33 / 0.07);
75
+ }
76
+
77
+ /* Runtime dark pairs (shadcn v4 convention): re-seating a role here re-seats
78
+ every palette alias that resolves through it. */
79
+ :root[data-theme="dark"],
80
+ :host([data-theme="dark"]) {
58
81
  --color-background: var(--color-zinc-950);
59
82
  --color-foreground: var(--color-zinc-50);
60
83
 
@@ -84,8 +107,7 @@
84
107
  --color-ring: var(--color-violet-400);
85
108
  }
86
109
 
87
- /* Forced-colors layer: every role re-seats on a system color. Values are
88
- system keywords — no author color survives the forcing. */
110
+ /* Forced colors: every role re-seats on a system keyword. */
89
111
  @media (forced-colors: active) {
90
112
  :root {
91
113
  --color-background: Canvas;
@@ -110,70 +132,33 @@
110
132
  }
111
133
  }
112
134
 
113
- /* ── Starter palette aliases (component sheet names → roles) ── */
114
- :root {
115
- --paper: var(--color-background);
116
- --surface: var(--color-card);
117
- --ink: var(--color-foreground);
118
- --ink-soft: var(--color-muted-foreground);
119
- --line: var(--color-border);
120
- --brand: var(--color-primary);
121
- --brand-ink: var(--color-primary-foreground);
122
- --brand-soft: var(--color-secondary);
123
- --ok: var(--color-secondary);
124
- --warn: var(--color-accent);
125
- }
126
-
127
- /* ── Static (non-role) design tokens the component sheets read ── */
128
- :root {
129
- --gray-0: var(--color-muted);
130
- --size-1: 4px;
131
- --size-2: 8px;
132
- --size-3: 12px;
133
- --size-4: 16px;
134
- --size-6: 24px;
135
- --size-8: 32px;
136
- --border-size-1: 1px;
137
- --radius-s: 6px;
138
- --radius-m: 10px;
139
- --radius-l: 16px;
140
- --font-sans: system-ui, -apple-system, sans-serif;
141
- --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
142
- --content-width: 46rem;
143
- --shadow-1: 0 1px 3px 0 rgb(20 18 33 / 0.07);
144
- --shadow-2: 0 10px 28px rgb(60 50 120 / 0.1);
145
- }
146
-
147
- /* ── Document base (rides the same sheet; no separate tokens convention) ── */
135
+ /* Document base: <body> is not authored markup, so a class cannot carry it. */
148
136
  body {
149
137
  margin: 0;
150
- background: var(--paper);
151
- color: var(--ink);
138
+ background: var(--color-paper);
139
+ color: var(--color-ink);
152
140
  font-family: var(--font-sans);
153
141
  line-height: 1.6;
154
142
  }
155
143
 
156
144
  ::selection {
157
- background: var(--brand);
158
- color: var(--brand-ink);
145
+ background: var(--color-brand);
146
+ color: var(--color-brand-ink);
159
147
  }
160
148
 
161
- /* Automatic dark for the starter palette (no runtime): the role sheet's
162
- data-theme pairs above cover runtime-toggled themes. The --brand pair joins
163
- the dark side here (#1582): the light violet-700 reads ≈2.8:1 on zinc-950,
164
- so the alias pair mirrors the data-theme dark roles (violet-400 on
165
- violet-950 ink — 6.98:1 / 5.36:1), and the referenced soft/ok aliases take
166
- the dark secondary surface instead of the light violet-100. */
149
+ /* Automatic dark for the palette, no runtime: the light violet-700 brand
150
+ reads ≈2.8:1 on zinc-950, so the dark side re-seats on the same steps the
151
+ data-theme pairs use (violet-400 on violet-950 ink — 6.98:1 / 5.36:1). */
167
152
  @media (prefers-color-scheme: dark) {
168
153
  :root {
169
- --paper: var(--color-zinc-950);
170
- --surface: var(--color-zinc-900);
171
- --ink: var(--color-zinc-50);
172
- --ink-soft: var(--color-zinc-400);
173
- --line: var(--color-zinc-800);
174
- --brand: var(--color-violet-400);
175
- --brand-ink: var(--color-violet-950);
176
- --brand-soft: var(--color-zinc-800);
177
- --ok: var(--color-zinc-800);
154
+ --color-paper: var(--color-zinc-950);
155
+ --color-surface: var(--color-zinc-900);
156
+ --color-ink: var(--color-zinc-50);
157
+ --color-ink-soft: var(--color-zinc-400);
158
+ --color-line: var(--color-zinc-800);
159
+ --color-brand: var(--color-violet-400);
160
+ --color-brand-ink: var(--color-violet-950);
161
+ --color-brand-soft: var(--color-zinc-800);
162
+ --color-ok: var(--color-zinc-100);
178
163
  }
179
164
  }
@@ -1,41 +1,29 @@
1
1
  // openelement.config.ts — framework options have exactly one home: this file.
2
2
  //
3
- // Every option below is OPTIONAL. With an empty object, options come from the
4
- // file conventions:
5
- // - design tokens: app/styles/theme.css (the @theme role sheet; dev compiles
6
- // it through the `tailwind` key below and serves the result as a linked
7
- // sheet, the build emits the same compile as /assets/open-tailwind.css)
8
- // - app shell: app/islands/app-shell.tsx (auto-registered; the file is
9
- // deletable and pages still render)
10
- // - document head: app/head.tsx (structural head content: meta tags, font
11
- // preloads, icons, inline CSS — the entries a URL list
12
- // cannot express; `head` below covers the rest)
13
- // - site title: the "name" field of package.json
3
+ // Every key is OPTIONAL; what it omits comes from a file convention:
4
+ // tokens app/styles/theme.css (the @theme role sheet, compiled through
5
+ // the `tailwind` key below)
6
+ // layout app/layout.tsx (auto-registered; delete it and pages still
7
+ // render their own chrome)
8
+ // head app/head.tsx (structural head entries; `head` below covers the
9
+ // title/description/favicon/og pairs)
10
+ // site name the "name" field of package.json
14
11
  //
15
- // The conventions follow `dirs`: give the three roots a shared leading
16
- // directory (src/routes, src/islands, src/components) and the tokens/app-shell/
17
- // head conventions resolve under that same directory (src/styles/tokens.css,
18
- // src/islands/app-shell.tsx, src/head.tsx).
19
- //
20
- // Passing framework options inline to openElement() while this file carries
21
- // options is a hard error: framework options cannot have two homes. Unknown
22
- // keys are rejected with the accepted-key list.
23
- import { defineConfig } from '@openelement/router';
12
+ // The conventions follow `dirs`: give the app roots a shared leading directory
13
+ // and the conventions resolve under it too. Passing options inline to
14
+ // openElement() while this file carries options is a hard error — one home —
15
+ // and unknown keys are rejected with the accepted-key list.
16
+ import { defineConfig } from "@openelement/router";
24
17
 
25
18
  export default defineConfig({
26
- // The Tailwind preset — the single-default scaffold form. The roles in
27
- // app/styles/theme.css compile into the preset's deliverable both ways: dev
28
- // serves the compile from /.openElement/tailwind-preset/entry.css and links
29
- // it in the document head, the build emits the same compile as the
30
- // layer-ordered /assets/open-tailwind.css after the SSG render. The path is
31
- // app-relative (resolved against the app root); package CSS specifiers such
32
- // as '@openelement/ui/theme.css' also work here.
33
- tailwind: { theme: ['app/styles/theme.css'] },
19
+ // The Tailwind entry: the path is app-relative, and package CSS specifiers
20
+ // such as '@openelement/ui/theme.css' work here too.
21
+ tailwind: { theme: ["app/styles/theme.css"] },
34
22
  head: {
35
- // Titles default to the package.json "name"; this overrides the document
36
- // title fallback while page routes keep their own `head: { title }`.
37
- title: 'openElement Showcase',
38
- description: 'A static-first openElement showcase — rendered before JavaScript arrives.',
39
- favicon: '/openelement-mark.svg',
23
+ // Overrides the package.json-name title fallback; page routes keep their
24
+ // own `head: { title }`.
25
+ title: "openElement Showcase",
26
+ description: "A static-first openElement showcase — rendered before JavaScript arrives.",
27
+ favicon: "/openelement-mark.svg",
40
28
  },
41
29
  });