@openelement/create 1.0.0-alpha.10 → 1.0.0-alpha.12

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 (45) hide show
  1. package/README.md +67 -60
  2. package/package.json +1 -1
  3. package/src/cli.js +177 -45
  4. package/src/install-command.d.ts +18 -10
  5. package/src/install-command.js +19 -12
  6. package/src/pm.js +30 -0
  7. package/src/template-builder.js +21 -71
  8. package/src/version.js +2 -12
  9. package/templates/README.tmpl +84 -48
  10. package/templates/app/components/badges.css +5 -0
  11. package/templates/app/components/page-404.css +7 -0
  12. package/templates/app/components/page-404.tsx.tmpl +32 -11
  13. package/templates/app/components/page-about.css +15 -0
  14. package/templates/app/components/page-about.tsx.tmpl +93 -0
  15. package/templates/app/components/page-home.css +23 -0
  16. package/templates/app/components/page-home.tsx.tmpl +113 -39
  17. package/templates/app/components/site-chrome.css +15 -0
  18. package/templates/app/head.tsx.tmpl +5 -15
  19. package/templates/app/islands/live-timer.css +9 -0
  20. package/templates/app/islands/live-timer.tsx.tmpl +54 -0
  21. package/templates/app/islands/my-counter.css +11 -0
  22. package/templates/app/islands/my-counter.tsx.tmpl +5 -21
  23. package/templates/app/routes/about.tsx.tmpl +10 -0
  24. package/templates/app/routes/api/ping.ts.tmpl +12 -0
  25. package/templates/app/routes/index.tsx.tmpl +2 -2
  26. package/templates/app/styles/recipes.css +43 -0
  27. package/templates/{tailwind → app/styles}/theme.css +83 -12
  28. package/templates/openelement.config.ts.tmpl +13 -3
  29. package/templates/package.json.tmpl +2 -0
  30. package/templates/tsconfig.json.tmpl +1 -0
  31. package/templates/vite.config.ts.tmpl +3 -3
  32. package/templates/app/components/page-blog-index.tsx.tmpl +0 -39
  33. package/templates/app/components/page-blog-welcome.tsx.tmpl +0 -57
  34. package/templates/app/components/page-contact.tsx.tmpl +0 -49
  35. package/templates/app/components/page-freshness.tsx.tmpl +0 -26
  36. package/templates/app/components/page-styles.ts.tmpl +0 -123
  37. package/templates/app/islands/app-shell.tsx.tmpl +0 -83
  38. package/templates/app/islands/only-ticker.tsx.tmpl +0 -51
  39. package/templates/app/routes/api/health.ts.tmpl +0 -7
  40. package/templates/app/routes/blog/index.tsx.tmpl +0 -10
  41. package/templates/app/routes/blog/welcome.tsx.tmpl +0 -7
  42. package/templates/app/routes/contact.tsx.tmpl +0 -36
  43. package/templates/app/routes/freshness.tsx.tmpl +0 -17
  44. package/templates/app/styles/tokens.css +0 -57
  45. package/templates/tailwind/vite.config.ts.tmpl +0 -38
@@ -1,58 +1,132 @@
1
1
  /**
2
- * Home page element — static prerendered (default renderIntent mode).
2
+ * Home page element — the showcase landing page (static prerendered, the
3
+ * default renderIntent mode).
3
4
  *
4
5
  * Compiled page: the render() below is lowered to a Part Program
5
6
  * at build time. The page uses a light root and owns its rules via
6
- * `static styles` (./page-styles.ts): the server inlines them into the SSR
7
+ * `static styles` (the imported .css sheets): the server inlines them into the SSR
7
8
  * output as a @scope(index-page) <style data-oe-static-styles> block, so the
8
9
  * page is styled with zero client JS. The two island hosts (<my-counter>,
9
- * <only-ticker>) are static custom-element hosts that the generated server
10
+ * <live-timer>) are static custom-element hosts that the generated server
10
11
  * entry expands through the islands' own compiled classes.
12
+ *
13
+ * The badge spans name each section's client cost: static sections ship
14
+ * markup only; island sections hydrate a compiled island (see the island
15
+ * modules under app/islands/).
11
16
  */
12
17
  import { element, OpenElement } from '@openelement/element';
13
- import { homePageStyles } from './page-styles.ts';
18
+ import homePageStyles from './page-home.css';
19
+ import badgeStyles from './badges.css';
20
+ import siteChromeStyles from './site-chrome.css';
14
21
 
15
22
  @element('index-page', { root: 'light' })
16
23
  export default class HomePage extends OpenElement {
17
- static override styles = homePageStyles;
24
+ static override styles = [homePageStyles, badgeStyles, siteChromeStyles];
18
25
 
19
26
  render() {
27
+ // Single root element: the compiled grammar lowers one root per render.
20
28
  return (
21
- <main>
22
- <section class='hero'>
23
- <span class='eyebrow'>openElement starter</span>
24
- <h1>Static pages, alive where it counts</h1>
25
- <p class='lede'>
26
- Your app is running. Edit <code>app/routes/index.tsx</code>{' '}
27
- to make it yours — add posts under <code>app/routes/blog/</code>, add pages under{' '}
28
- <code>app/routes/</code>, and hydrate only the components that need it.
29
- </p>
30
- <a class='more' href='/blog'>Read the blog →</a>
31
- </section>
32
- <section class='demo'>
33
- <p class='label'>Live island — hydrates on idle</p>
34
- <my-counter></my-counter>
35
- </section>
36
- <section class='demo'>
37
- <p class='label'>Client-only island — renders without SSR</p>
38
- <only-ticker></only-ticker>
39
- </section>
40
- <section class='recent'>
41
- <h2>From the blog</h2>
42
- <p class='sub'>
43
- Posts are compiled page routes under{' '}
44
- <code>app/routes/blog/</code>, prerendered at build time.
45
- </p>
46
- <ul class='posts'>
47
- <li>
48
- <a class='post' href='/blog/welcome'>
49
- <span class='title'>Welcome</span>
50
- <span class='meta'>Your first post — edit app/routes/blog/welcome.tsx</span>
29
+ <div class='page-body'>
30
+ <header class='site-head'>
31
+ <div class='bar'>
32
+ <a class='site-brand' href='/'>
33
+ openElement
34
+ </a>
35
+ <nav>
36
+ <a href='/'>Home</a>
37
+ <a href='/about'>About</a>
38
+ <a href='/api/ping'>API</a>
39
+ </nav>
40
+ </div>
41
+ </header>
42
+ <main>
43
+ <section class='hero'>
44
+ <span class='badge badge-static'>static · 0 KB JS</span>
45
+ <p class='eyebrow'>openElement starter</p>
46
+ <h1>Rendered before JavaScript arrives</h1>
47
+ <p class='lede'>
48
+ Every page here is prerendered HTML. JavaScript loads only where a
49
+ section is interactive — the badges below name the cost of each
50
+ block. Edit <code>app/routes/index.tsx</code> to make it yours.
51
+ </p>
52
+ <div class='cta'>
53
+ <a class='button' href='/about'>
54
+ How it works
55
+ </a>
56
+ <a class='button-ghost' href='https://openelement.org'>
57
+ Read the docs
51
58
  </a>
52
- </li>
53
- </ul>
54
- </section>
55
- </main>
59
+ </div>
60
+ </section>
61
+ <section class='panel'>
62
+ <div class='panel-head'>
63
+ <h2>Interactive island</h2>
64
+ <span class='badge badge-island'>island · hydrates on idle</span>
65
+ </div>
66
+ <p>
67
+ The counter is a compiled island (<code>app/islands/my-counter.tsx</code>
68
+ ): the server renders its markup, the browser hydrates it when idle.
69
+ </p>
70
+ <my-counter></my-counter>
71
+ </section>
72
+ <section class='panel'>
73
+ <div class='panel-head'>
74
+ <h2>Live stats</h2>
75
+ <span class='badge badge-island'>island · client-only</span>
76
+ </div>
77
+ <p>
78
+ Elapsed time on this page (<code>app/islands/live-timer.tsx</code>) renders
79
+ only in the browser — a live clock has nothing meaningful to
80
+ prerender, so the island ships <code>ssr: false</code>.
81
+ </p>
82
+ <live-timer></live-timer>
83
+ </section>
84
+ <section class='panel'>
85
+ <div class='panel-head'>
86
+ <h2>The architecture</h2>
87
+ <span class='badge badge-static'>static · 0 KB JS</span>
88
+ </div>
89
+ <p>
90
+ This section — like the hero and this page's header — is plain
91
+ prerendered HTML and CSS. No framework script runs it.
92
+ </p>
93
+ <ul class='cards'>
94
+ <li class='card'>
95
+ <span class='badge badge-static'>static</span>
96
+ <h3>Prerendered pages</h3>
97
+ <p>
98
+ Routes under <code>app/routes/</code> compile to static HTML at
99
+ build time (SSG) and keep their HTTP cache semantics.
100
+ </p>
101
+ </li>
102
+ <li class='card'>
103
+ <span class='badge badge-island'>island</span>
104
+ <h3>Islands where needed</h3>
105
+ <p>
106
+ Interactive pieces live in <code>app/islands/</code> and hydrate
107
+ on the strategy each one declares — idle, load, visible, or
108
+ client-only.
109
+ </p>
110
+ </li>
111
+ <li class='card'>
112
+ <span class='badge badge-static'>static</span>
113
+ <h3>Platform APIs</h3>
114
+ <p>
115
+ Server routes (<code>app/routes/api/</code>) are plain{' '}
116
+ <code>Request → Response</code> handlers — WinterCG-shaped, no
117
+ framework runtime attached.
118
+ </p>
119
+ </li>
120
+ </ul>
121
+ </section>
122
+ </main>
123
+ <footer class='site-foot'>
124
+ <div class='bar'>
125
+ <span>Generated by @openelement/create.</span>
126
+ <a href='https://openelement.org'>openelement.org</a>
127
+ </div>
128
+ </footer>
129
+ </div>
56
130
  );
57
131
  }
58
132
  }
@@ -0,0 +1,15 @@
1
+
2
+ :host { display: block; }
3
+ .site-head { border-bottom: 1px solid var(--line); background: var(--paper); }
4
+ .site-head .bar { max-width: var(--content-width); margin: 0 auto; padding: 1rem 1.25rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
5
+ .site-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
6
+ .site-brand:hover { color: var(--brand); text-decoration: none; }
7
+ .site-head nav { display: flex; gap: 1.25rem; }
8
+ .site-head nav a { color: var(--ink-soft); font-size: 0.95rem; font-weight: 500; text-decoration: none; }
9
+ .site-head nav a:hover { color: var(--brand); text-decoration: none; }
10
+ main { max-width: var(--content-width); margin: 0 auto; padding: 3rem 1.25rem 4rem; }
11
+ .site-foot { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.85rem; }
12
+ .site-foot .bar { max-width: var(--content-width); margin: 0 auto; padding: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
13
+ .site-foot a { color: var(--ink-soft); text-decoration: none; }
14
+ .site-foot a:hover { color: var(--brand); text-decoration: none; }
15
+
@@ -20,23 +20,13 @@
20
20
  * `head` in openelement.config.ts already covers the title, description,
21
21
  * favicon and the og:/twitter: pairs; `head.scripts` / `head.stylesheets`
22
22
  * cover external scripts and stylesheets. This file is for what neither can
23
- * express — here, a resource preload. Per-page meaning (title, description,
24
- * og:title, canonical) is declared by each route module's `head`, which
25
- * resolves at render time and wins for crawlers.
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.
26
26
  */
27
27
  export default [
28
- // The brand mark is used above the fold on the starter home page, so it is
29
- // preloaded. `crossorigin` needs an explicit value when the resource is
30
- // fetched with CORS; an image preload without it is same-origin as authored.
31
- {
32
- link: {
33
- rel: 'preload',
34
- href: '/openelement-mark.svg',
35
- as: 'image',
36
- type: 'image/svg+xml',
37
- },
38
- },
39
28
  // Declaring the color scheme the starter supports lets the browser pick the
40
- // right native form/scrollbar palette before any CSS is parsed.
29
+ // right native form/scrollbar palette before any CSS is parsed. The dark
30
+ // palette itself is theme.css's dark pair block — no runtime.
41
31
  { meta: { name: 'color-scheme', content: 'dark light' } },
42
32
  ];
@@ -0,0 +1,9 @@
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
+
@@ -0,0 +1,54 @@
1
+ /**
2
+ * live-timer — client-only live stats island (compiled).
3
+ *
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
8
+ * disconnectedCallback stops the interval when the host leaves the tree.
9
+ */
10
+ import { defineIslandConfig } from '@openelement/router';
11
+ import { element, OpenElement, property } from '@openelement/element';
12
+ import timerStyles from './live-timer.css';
13
+
14
+ export const openElement = defineIslandConfig({ hydrate: 'only', ssr: false, dsd: false });
15
+
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' })
21
+ export default class LiveTimer extends OpenElement {
22
+ static override styles = [timerStyles];
23
+
24
+ /** Elapsed seconds as preformatted text (compiled text Parts bind plain
25
+ * properties — no method calls in a text region, OEC9013). */
26
+ @property({ reflect: false, attribute: false })
27
+ elapsed = '0.0';
28
+
29
+ /** The ticking interval's handle; 0 when the host is not connected. */
30
+ @property({ reflect: false, attribute: false })
31
+ interval = 0;
32
+
33
+ override connectedCallback(): void {
34
+ super.connectedCallback();
35
+ this.interval = setInterval(() => {
36
+ this.elapsed = (Math.round(performance.now()) / 1000).toFixed(1);
37
+ }, 100);
38
+ }
39
+
40
+ override disconnectedCallback(): void {
41
+ clearInterval(this.interval);
42
+ this.interval = 0;
43
+ super.disconnectedCallback();
44
+ }
45
+
46
+ render() {
47
+ return (
48
+ <div class='timer-row'>
49
+ <span id='elapsed'>{this.elapsed}</span>
50
+ <span class='unit'>seconds on this page</span>
51
+ </div>
52
+ );
53
+ }
54
+ }
@@ -0,0 +1,11 @@
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,36 +1,20 @@
1
1
  /**
2
- * my-counter — minimal counter island (compiled).
2
+ * my-counter — the interactive counter island (compiled).
3
3
  *
4
4
  * Hydrates on idle; the buttons increment/decrement through the compiled
5
5
  * event Parts and the count renders through the compiled text Part. The
6
- * shadow root keeps the island a DSD citizen.
6
+ * shadow root keeps the island a DSD citizen. Design tokens from
7
+ * app/styles/theme.css inherit through the shadow boundary.
7
8
  */
8
9
  import { defineIslandConfig } from '@openelement/router';
9
10
  import { element, OpenElement, property } from '@openelement/element';
10
- import { compiledStyle } from '../components/page-styles.ts';
11
+ import counterStyles from './my-counter.css';
11
12
 
12
13
  export const openElement = defineIslandConfig({ hydrate: 'idle', ssr: true, dsd: true });
13
14
 
14
- // Same-module style sheet: the compiler erases this const from
15
- // the island module and emits its bytes as the component's `.oe-style.css`
16
- // asset. Cross-module sheet imports fail closed (OEC9028).
17
- const counterStyles = [
18
- compiledStyle(`
19
- :host { display: inline-block; }
20
- .counter-row { display: inline-flex; gap: 0.75rem; align-items: center; }
21
- button {
22
- width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: 6px;
23
- background: #fff; color: var(--ink); font-size: 1rem; line-height: 1; cursor: pointer;
24
- transition: border-color 0.15s ease, color 0.15s ease;
25
- }
26
- button:hover { border-color: var(--brand); color: var(--brand); }
27
- span { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
28
- `),
29
- ];
30
-
31
15
  @element('my-counter', { root: 'shadow-open' })
32
16
  export default class MyCounter extends OpenElement {
33
- static override styles = counterStyles;
17
+ static override styles = [counterStyles];
34
18
 
35
19
  @property({ reflect: false, attribute: false })
36
20
  count = 0;
@@ -0,0 +1,10 @@
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';
4
+
5
+ export default definePage(AboutPage, {
6
+ head: {
7
+ title: 'About',
8
+ description: 'Static-first openElement showcase — this page ships no islands',
9
+ },
10
+ });
@@ -0,0 +1,12 @@
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.
5
+ */
6
+ export default function ping() {
7
+ return Response.json({
8
+ pong: true,
9
+ framework: 'openElement',
10
+ route: '/api/ping',
11
+ });
12
+ }
@@ -4,7 +4,7 @@ import HomePage from '../components/page-home.tsx';
4
4
 
5
5
  export default definePage(HomePage, {
6
6
  head: {
7
- title: 'My openElement App',
8
- description: 'Generated openElement starter app',
7
+ title: 'Rendered before JavaScript arrives',
8
+ description: 'openElement showcase — static pages, alive where it counts',
9
9
  },
10
10
  });
@@ -0,0 +1,43 @@
1
+ /* authored from HEAD extraction — replace with design pass */
2
+ /* Plain HTML+CSS recipes for the four retired zero-interaction ui shapes
3
+ * (open-badge, open-callout, open-card, open-tabs #1557): the class
4
+ * structures their HEAD markup rendered, as copyable rules. Consumers delete
5
+ * what they do not use. Structure only — replace with the design pass. */
6
+
7
+ /* open-badge */
8
+ .badge {
9
+ display: inline-flex;
10
+ align-items: center;
11
+ }
12
+
13
+ /* open-callout */
14
+ .callout {
15
+ display: block;
16
+ }
17
+
18
+ .callout-header {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+
23
+ .callout-icon {
24
+ display: inline-flex;
25
+ }
26
+
27
+ .callout-title {
28
+ margin: 0;
29
+ }
30
+
31
+ /* open-card */
32
+ .surface {
33
+ display: block;
34
+ }
35
+
36
+ .card-body {
37
+ display: block;
38
+ }
39
+
40
+ /* open-tabs */
41
+ .tabs {
42
+ display: flex;
43
+ }
@@ -1,16 +1,19 @@
1
1
  /* ═══════════════════════════════════════════════════════════════════════
2
- The starter's @theme role sheet (scaffolded with Tailwind enabled).
3
-
4
- Same contract as @openelement/ui's theme.css (the reference table): every
5
- role is a shadcn-style semantic name expressed with Tailwind default theme
6
- variables (var(--color-<ramp>-<step>)) — no role carries a handwritten
7
- scale value. The installed tailwindcss build provides the scale variables
8
- through the preset's compile (the router's Tailwind preset), the compiled
9
- bundle links into every rendered page, and the custom properties inherit
10
- into every shadow root, so compiled elements and islands read the roles
11
- directly. Extend this table with new roles the same way — name on the
12
- left, an existing Tailwind variable on the right — or override a role per
13
- theme with the dark pairs below.
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.
14
17
  ═══════════════════════════════════════════════════════════════════════ */
15
18
 
16
19
  @theme {
@@ -106,3 +109,71 @@
106
109
  --color-ring: Highlight;
107
110
  }
108
111
  }
112
+
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) ── */
148
+ body {
149
+ margin: 0;
150
+ background: var(--paper);
151
+ color: var(--ink);
152
+ font-family: var(--font-sans);
153
+ line-height: 1.6;
154
+ }
155
+
156
+ ::selection {
157
+ background: var(--brand);
158
+ color: var(--brand-ink);
159
+ }
160
+
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. */
167
+ @media (prefers-color-scheme: dark) {
168
+ :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);
178
+ }
179
+ }
@@ -2,7 +2,9 @@
2
2
  //
3
3
  // Every option below is OPTIONAL. With an empty object, options come from the
4
4
  // file conventions:
5
- // - design tokens: app/styles/tokens.css (inlined into every document <head>)
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)
6
8
  // - app shell: app/islands/app-shell.tsx (auto-registered; the file is
7
9
  // deletable and pages still render)
8
10
  // - document head: app/head.tsx (structural head content: meta tags, font
@@ -21,11 +23,19 @@
21
23
  import { defineConfig } from '@openelement/router';
22
24
 
23
25
  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
31
+ // climbs out of the preset's staging entry (.openElement/tailwind-preset/),
32
+ // the file the @import resolves from.
33
+ tailwind: { theme: ['../../app/styles/theme.css'] },
24
34
  head: {
25
35
  // Titles default to the package.json "name"; this overrides the document
26
36
  // title fallback while page routes keep their own `head: { title }`.
27
- title: 'My openElement App',
28
- description: 'An openElement starter application.',
37
+ title: 'openElement Showcase',
38
+ description: 'A static-first openElement showcase — rendered before JavaScript arrives.',
29
39
  favicon: '/openelement-mark.svg',
30
40
  },
31
41
  });
@@ -23,6 +23,8 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@playwright/test": "1.59.1",
26
+ "@tailwindcss/vite": "4.3.3",
27
+ "tailwindcss": "4.3.3",
26
28
  "typescript": "6.0.3",
27
29
  "vite": "${v.vite}"
28
30
  }
@@ -6,6 +6,7 @@
6
6
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
7
  "jsx": "react-jsx",
8
8
  "jsxImportSource": "@openelement/element",
9
+ "types": ["@openelement/element/css-modules"],
9
10
  "strict": true,
10
11
  "skipLibCheck": true,
11
12
  "noEmit": true,
@@ -2,9 +2,9 @@ import { openElement } from '@openelement/router/vite';
2
2
  import { defineConfig } from 'vite';
3
3
 
4
4
  // Vite configuration only. Framework options live in openelement.config.ts —
5
- // the plugin reads that file itself, so this stays `plugins: [openElement()]`.
6
- // The JSX transform is owned by the plugin's compiler pass (TSX → Part
7
- // Program); nothing JSX-related needs configuring here.
5
+ // the plugin reads that file itself, so the plugin call stays bare. The JSX
6
+ // transform is owned by the plugin's compiler pass (TSX → Part Program);
7
+ // nothing JSX-related needs configuring here.
8
8
  export default defineConfig({
9
9
  base: '/',
10
10
  plugins: [...openElement()],
@@ -1,39 +0,0 @@
1
- /**
2
- * /blog index page element — static prerendered. Posts are markdown routes
3
- * under app/routes/blog/ (compiled to static pages at build time); the list
4
- * below is authored statically — add a link per post. (Compiler grammar v1
5
- * list Regions carry one value slot per item and no per-item attributes, so
6
- * a data-driven link list is a known v1 boundary.) Light root: the page owns
7
- * its rules via `static styles` (./page-styles.ts), inlined into SSR as
8
- * @scope(blog-index).
9
- */
10
- import { element, OpenElement } from '@openelement/element';
11
- import { blogIndexStyles } from './page-styles.ts';
12
-
13
- @element('blog-index', { root: 'light' })
14
- export default class BlogIndexPage extends OpenElement {
15
- static override styles = blogIndexStyles;
16
-
17
- render() {
18
- return (
19
- <main>
20
- <span class='eyebrow'>Index</span>
21
- <h1>Blog</h1>
22
- <p class='sub'>
23
- Every post is a compiled page route in{' '}
24
- <code>app/routes/blog/</code>, pre-rendered at build time.
25
- </p>
26
- <ul class='posts'>
27
- <li>
28
- <a class='post' href='/blog/welcome'>
29
- <span class='title'>Welcome</span>
30
- <span class='meta'>
31
- The starter blog is wired up — replace it with your first post.
32
- </span>
33
- </a>
34
- </li>
35
- </ul>
36
- </main>
37
- );
38
- }
39
- }