@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
@@ -0,0 +1,170 @@
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` serves this file directly (the #1558 authored-sheet path); the
14
+ build compiles it through the router's Tailwind preset into the linked,
15
+ layer-ordered bundle.
16
+ ═══════════════════════════════════════════════════════════════════════ */
17
+
18
+ @theme {
19
+ /* ── semantic roles (light), over the TW4 default scale.
20
+ Violet-anchored roles (the starter brand reads violet); neutral
21
+ surfaces stay zinc so the page base keeps its near-neutral paper
22
+ feel. ── */
23
+
24
+ --color-background: var(--color-white);
25
+ --color-foreground: var(--color-zinc-950);
26
+
27
+ --color-card: var(--color-white);
28
+ --color-card-foreground: var(--color-zinc-950);
29
+
30
+ --color-popover: var(--color-white);
31
+ --color-popover-foreground: var(--color-zinc-950);
32
+
33
+ --color-primary: var(--color-violet-700);
34
+ --color-primary-foreground: var(--color-violet-50);
35
+
36
+ --color-secondary: var(--color-violet-100);
37
+ --color-secondary-foreground: var(--color-violet-900);
38
+
39
+ --color-muted: var(--color-zinc-100);
40
+ --color-muted-foreground: var(--color-zinc-600);
41
+
42
+ --color-accent: var(--color-violet-100);
43
+ --color-accent-foreground: var(--color-violet-900);
44
+
45
+ --color-destructive: var(--color-red-700);
46
+ --color-destructive-foreground: var(--color-white);
47
+
48
+ --color-border: var(--color-violet-200);
49
+ --color-input: var(--color-violet-200);
50
+ --color-ring: var(--color-violet-500);
51
+ }
52
+
53
+ /* Dark pairs (shadcn v4 convention; the selector matches the runtime theme
54
+ attribute the ui package documents). */
55
+ :root[data-theme='dark'],
56
+ :host([data-theme='dark']) {
57
+ --color-background: var(--color-zinc-950);
58
+ --color-foreground: var(--color-zinc-50);
59
+
60
+ --color-card: var(--color-zinc-900);
61
+ --color-card-foreground: var(--color-zinc-50);
62
+
63
+ --color-popover: var(--color-zinc-900);
64
+ --color-popover-foreground: var(--color-zinc-50);
65
+
66
+ --color-primary: var(--color-violet-400);
67
+ --color-primary-foreground: var(--color-violet-950);
68
+
69
+ --color-secondary: var(--color-zinc-800);
70
+ --color-secondary-foreground: var(--color-zinc-100);
71
+
72
+ --color-muted: var(--color-zinc-800);
73
+ --color-muted-foreground: var(--color-zinc-400);
74
+
75
+ --color-accent: var(--color-zinc-800);
76
+ --color-accent-foreground: var(--color-zinc-100);
77
+
78
+ --color-destructive: var(--color-red-400);
79
+ --color-destructive-foreground: var(--color-red-950);
80
+
81
+ --color-border: var(--color-zinc-800);
82
+ --color-input: var(--color-zinc-800);
83
+ --color-ring: var(--color-violet-400);
84
+ }
85
+
86
+ /* Forced-colors layer: every role re-seats on a system color. Values are
87
+ system keywords — no author color survives the forcing. */
88
+ @media (forced-colors: active) {
89
+ :root {
90
+ --color-background: Canvas;
91
+ --color-foreground: CanvasText;
92
+ --color-card: Canvas;
93
+ --color-card-foreground: CanvasText;
94
+ --color-popover: Canvas;
95
+ --color-popover-foreground: CanvasText;
96
+ --color-primary: ButtonText;
97
+ --color-primary-foreground: Canvas;
98
+ --color-secondary: ButtonFace;
99
+ --color-secondary-foreground: ButtonText;
100
+ --color-muted: Canvas;
101
+ --color-muted-foreground: GrayText;
102
+ --color-accent: ButtonFace;
103
+ --color-accent-foreground: ButtonText;
104
+ --color-destructive: CanvasText;
105
+ --color-destructive-foreground: Canvas;
106
+ --color-border: CanvasText;
107
+ --color-input: CanvasText;
108
+ --color-ring: Highlight;
109
+ }
110
+ }
111
+
112
+ /* ── Starter palette aliases (component sheet names → roles) ── */
113
+ :root {
114
+ --paper: var(--color-background);
115
+ --surface: var(--color-card);
116
+ --ink: var(--color-foreground);
117
+ --ink-soft: var(--color-muted-foreground);
118
+ --line: var(--color-border);
119
+ --brand: var(--color-primary);
120
+ --brand-ink: var(--color-primary-foreground);
121
+ --brand-soft: var(--color-secondary);
122
+ --ok: var(--color-secondary);
123
+ --warn: var(--color-accent);
124
+ }
125
+
126
+ /* ── Static (non-role) design tokens the component sheets read ── */
127
+ :root {
128
+ --gray-0: var(--color-muted);
129
+ --size-1: 4px;
130
+ --size-2: 8px;
131
+ --size-3: 12px;
132
+ --size-4: 16px;
133
+ --size-6: 24px;
134
+ --size-8: 32px;
135
+ --border-size-1: 1px;
136
+ --radius-s: 6px;
137
+ --radius-m: 10px;
138
+ --radius-l: 16px;
139
+ --font-sans: system-ui, -apple-system, sans-serif;
140
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
141
+ --content-width: 46rem;
142
+ --shadow-1: 0 1px 3px 0 rgb(20 18 33 / 0.07);
143
+ --shadow-2: 0 10px 28px rgb(60 50 120 / 0.1);
144
+ }
145
+
146
+ /* ── Document base (rides the same sheet; no separate tokens convention) ── */
147
+ body {
148
+ margin: 0;
149
+ background: var(--paper);
150
+ color: var(--ink);
151
+ font-family: var(--font-sans);
152
+ line-height: 1.6;
153
+ }
154
+
155
+ ::selection {
156
+ background: var(--brand);
157
+ color: var(--brand-ink);
158
+ }
159
+
160
+ /* Automatic dark for the starter palette (no runtime): the role sheet's
161
+ data-theme pairs above cover runtime-toggled themes. */
162
+ @media (prefers-color-scheme: dark) {
163
+ :root {
164
+ --paper: var(--color-zinc-950);
165
+ --surface: var(--color-zinc-900);
166
+ --ink: var(--color-zinc-50);
167
+ --ink-soft: var(--color-zinc-400);
168
+ --line: var(--color-zinc-800);
169
+ }
170
+ }
@@ -1,2 +1,3 @@
1
1
  dist/
2
2
  node_modules/
3
+ .openElement/
@@ -0,0 +1,39 @@
1
+ // openelement.config.ts — framework options have exactly one home: this file.
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 serves
6
+ // it directly, the build compiles it through the `tailwind` key below)
7
+ // - app shell: app/islands/app-shell.tsx (auto-registered; the file is
8
+ // deletable and pages still render)
9
+ // - document head: app/head.tsx (structural head content: meta tags, font
10
+ // preloads, icons, inline CSS — the entries a URL list
11
+ // cannot express; `head` below covers the rest)
12
+ // - site title: the "name" field of package.json
13
+ //
14
+ // The conventions follow `dirs`: give the three roots a shared leading
15
+ // directory (src/routes, src/islands, src/components) and the tokens/app-shell/
16
+ // head conventions resolve under that same directory (src/styles/tokens.css,
17
+ // src/islands/app-shell.tsx, src/head.tsx).
18
+ //
19
+ // Passing framework options inline to openElement() while this file carries
20
+ // options is a hard error: framework options cannot have two homes. Unknown
21
+ // keys are rejected with the accepted-key list.
22
+ import { defineConfig } from '@openelement/router';
23
+
24
+ export default defineConfig({
25
+ // The Tailwind preset — the single-default scaffold form. The roles in
26
+ // app/styles/theme.css compile into the preset's linked, layer-ordered
27
+ // bundle (/assets/open-tailwind.css) after the SSG render; the path climbs
28
+ // out of the preset's build-time staging entry (.openElement/
29
+ // tailwind-preset/), the file the @import resolves from. `pnpm dev` serves
30
+ // the authored sheet directly.
31
+ tailwind: { theme: ['../../app/styles/theme.css'] },
32
+ head: {
33
+ // Titles default to the package.json "name"; this overrides the document
34
+ // title fallback while page routes keep their own `head: { title }`.
35
+ title: 'openElement Showcase',
36
+ description: 'A static-first openElement showcase — rendered before JavaScript arrives.',
37
+ favicon: '/openelement-mark.svg',
38
+ },
39
+ });
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "${name}",
3
3
  "private": true,
4
+ "version": "0.0.0",
4
5
  "type": "module",
5
- "dependencies": {}
6
+ "packageManager": "pnpm@12.8.1",
7
+ "engines": {
8
+ "node": ">=24.2"
9
+ },
10
+ "scripts": {
11
+ "dev": "vite",
12
+ "check": "tsc --noEmit",
13
+ "test": "node --test",
14
+ "build": "node node_modules/@openelement/router/src/cli/build.js",
15
+ "start": "node node_modules/@openelement/router/src/cli/start.js",
16
+ "preview": "node node_modules/@openelement/router/src/cli/start.js --mode=preview"
17
+ },
18
+ "dependencies": {
19
+ "@hono/vite-dev-server": "^0.25.3",
20
+ "@openelement/element": "${v.element}",
21
+ "@openelement/router": "${v.router}",
22
+ "hono": "^4.12"
23
+ },
24
+ "devDependencies": {
25
+ "@playwright/test": "1.59.1",
26
+ "@tailwindcss/vite": "4.3.3",
27
+ "tailwindcss": "4.3.3",
28
+ "typescript": "6.0.3",
29
+ "vite": "${v.vite}"
30
+ }
6
31
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+ "jsxImportSource": "@openelement/element",
9
+ "types": ["@openelement/element/css-modules"],
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "noEmit": true,
13
+ "allowImportingTsExtensions": true
14
+ },
15
+ "include": ["app", "vite.config.ts", "openelement.config.ts"]
16
+ }
@@ -1,37 +1,11 @@
1
1
  import { openElement } from '@openelement/router/vite';
2
2
  import { defineConfig } from 'vite';
3
3
 
4
- // Design tokens (from Open Props) plus the global baseline. `--brand` must
5
- // stay aligned with the ui package tokens (`--violet-6` in
6
- // a consumer-owned design-system stylesheet).
7
- //
8
- // Styling ownership: only true globals (design tokens, body baseline) live
9
- // here in headFragments. Each page element carries its own rules in
10
- // `static styles` (app/components/page-styles.ts) — the server inlines them
11
- // into the SSR output as a @scope(<page-tag>) style block for light roots.
12
- // Islands carry their own `static styles` too.
13
- const globalStyle =
14
- '<style>:root{--paper:#faf9f6;--ink:#1c1b17;--ink-2:#5b594f;--line:#e5e2d8;--gray-0:#f8f9fa;--gray-1:#f1f3f5;--gray-3:#dee2e6;--gray-5:#adb5bd;--gray-7:#495057;--gray-9:#212529;--brand:#8262db;--brand-2:#4f8ef7;--size-1:4px;--size-2:8px;--size-3:12px;--size-4:16px;--border-size-1:1px;--radius-2:8px;--radius-3:14px;--font-sans:system-ui,-apple-system,sans-serif;--font-serif:ui-serif,Georgia,"Times New Roman",serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,monospace;--font-size-0:0.875rem;--font-weight-5:500;--shadow-1:0 1px 3px 0 rgb(0 0 0 / 0.08);--shadow-2:0 10px 28px rgb(80 70 160 / 0.12)}' +
15
- 'body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}' +
16
- '::selection{background:#8262db2e}' +
17
- '</style>';
18
-
4
+ // Vite configuration only. Framework options live in openelement.config.ts —
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.
19
8
  export default defineConfig({
20
- plugins: [
21
- openElement({
22
- html: { title: 'My openElement App' },
23
- appShell: {
24
- tagName: 'app-shell',
25
- import: './app/islands/app-shell.tsx',
26
- props: {
27
- siteName: 'My openElement App',
28
- },
29
- },
30
- inject: {
31
- headFragments: [
32
- globalStyle,
33
- ],
34
- },
35
- }),
36
- ],
9
+ base: '/',
10
+ plugins: [...openElement()],
37
11
  });
@@ -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
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * /blog/welcome post page element — static prerendered. A post is a compiled
3
- * page route in the 1.0 Alpha baseline: static markup in the render() below,
4
- * page rules in `static styles` (./page-styles.ts, inlined into SSR as
5
- * @scope(blog-welcome)). The path derives the tag ('blog-welcome'); there is
6
- * no dynamic [slug] route in grammar v1 (with no raw-HTML sink), so unknown
7
- * slugs fall through to the styled 404 (#922).
8
- */
9
- import { element, OpenElement } from '@openelement/element';
10
- import { blogWelcomeStyles } from './page-styles.ts';
11
-
12
- @element('blog-welcome', { root: 'light' })
13
- export default class BlogWelcomePage extends OpenElement {
14
- static override styles = blogWelcomeStyles;
15
-
16
- render() {
17
- return (
18
- <main>
19
- <p>
20
- <a href='/blog'>← Back to the blog</a>
21
- </p>
22
- <h1>Welcome</h1>
23
- <p class='meta'>
24
- <time>2026-01-01</time>
25
- </p>
26
- <article class='post-body'>
27
- <p>
28
- This starter keeps one post route present so the blog is wired up from the first build.
29
- In the 1.0 Alpha baseline a post is a compiled page: edit{' '}
30
- <code>app/components/page-blog-welcome.tsx</code> and the route module{' '}
31
- <code>app/routes/blog/welcome.tsx</code> next to it.
32
- </p>
33
- <h2>What ships in the box</h2>
34
- <p>The starter demonstrates the pieces a content site needs:</p>
35
- <ul>
36
- <li>
37
- static routes prerendered at build time (the home page, the blog index, this post)
38
- </li>
39
- <li>a request-time route with a plain HTML form loop (/contact)</li>
40
- <li>client islands hydrated on demand (the counter on the home page)</li>
41
- <li>an app shell composed around every page from vite.config.ts</li>
42
- </ul>
43
- <h2>Write your own posts</h2>
44
- <p>
45
- Add a page element under <code>app/components/</code> and a route module under{' '}
46
- <code>app/routes/blog/</code>, then link the post from the blog index. Interactive
47
- content belongs in a compiled island composed from the page.
48
- </p>
49
- <p>
50
- When you are ready, replace this page with your first real post and update the links on
51
- the blog index and home pages.
52
- </p>
53
- </article>
54
- </main>
55
- );
56
- }
57
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * /contact page element — request-time rendered (renderIntent mode
3
- * 'dynamic'). The plain form works without JavaScript (422 echo / 303 PRG)
4
- * and morphs in place with it (data-open-enhance). The route module's props
5
- * projector maps request/action state onto the compiled properties below;
6
- * the feedback paragraphs render empty (zero-height, invisible) until the
7
- * action supplies text. Light root: the page owns its rules via
8
- * `static styles` (./page-styles.ts), inlined into SSR as @scope(contact-page).
9
- */
10
- import { element, OpenElement, property } from '@openelement/element';
11
- import { contactPageStyles } from './page-styles.ts';
12
-
13
- @element('contact-page', { root: 'light' })
14
- export default class ContactPage extends OpenElement {
15
- static override styles = contactPageStyles;
16
-
17
- @property({ reflect: false, attribute: false })
18
- email = '';
19
-
20
- @property({ reflect: false, attribute: false })
21
- errorText = '';
22
-
23
- @property({ reflect: false, attribute: false })
24
- subscribedText = '';
25
-
26
- render() {
27
- return (
28
- <main>
29
- <h1>Stay in the loop</h1>
30
- <p class='sub'>
31
- A request-time route: the plain form works without JavaScript, and morphs in place with
32
- it.
33
- </p>
34
- <form method='post' data-open-enhance>
35
- <input
36
- id='email'
37
- name='email'
38
- type='text'
39
- value={this.email}
40
- placeholder='you@example.com'
41
- />
42
- <button type='submit'>Subscribe</button>
43
- </form>
44
- <p id='error'>{this.errorText}</p>
45
- <p id='thanks'>{this.subscribedText}</p>
46
- </main>
47
- );
48
- }
49
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * /freshness page element — prerendered statically at build time like any
3
- * other static route. v0.44 ships no route-level cache revalidation
4
- * semantics (ISR was removed, see issue #1217). Light root: the page owns its
5
- * rules via `static styles` (./page-styles.ts), inlined into SSR as
6
- * @scope(freshness-page).
7
- */
8
- import { element, OpenElement } from '@openelement/element';
9
- import { freshnessPageStyles } from './page-styles.ts';
10
-
11
- @element('freshness-page', { root: 'light' })
12
- export default class FreshnessPage extends OpenElement {
13
- static override styles = freshnessPageStyles;
14
-
15
- render() {
16
- return (
17
- <main>
18
- <h1>Freshness proof</h1>
19
- <p>
20
- This page is prerendered statically at build time like any other static route. The
21
- framework ships no route-level cache revalidation in v0.44.
22
- </p>
23
- </main>
24
- );
25
- }
26
- }
@@ -1,166 +0,0 @@
1
- /**
2
- * Style sheets for the starter's compiled elements (v0.44).
3
- *
4
- * Compiled modules may not carry runtime top-level statements, so the sheets
5
- * live in this plain module and the compiled classes reference them through
6
- * `static styles`. Island sheets (shadow roots) apply as adoptedStyleSheets
7
- * when the element hydrates — see the zag-combobox fixture pattern in
8
- * fixtures/router-native-framework. Page elements use light roots: the server
9
- * inlines their sheets into the SSR output as a @scope(<page-tag>) block
10
- * (<style data-oe-static-styles>), so pages are styled with zero client JS.
11
- * Under @scope the host tag prefixes of a document stylesheet are dropped:
12
- * the page element itself is `:host` and descendant selectors go unprefixed.
13
- */
14
- import { StyleSheet, type StyleSheetLike } from '@openelement/element';
15
-
16
- function sheet(css: string): StyleSheetLike {
17
- const instance = new StyleSheet();
18
- instance.replaceSync(css);
19
- return instance;
20
- }
21
-
22
- export const shellStyles = [
23
- sheet(`
24
- :host { display: block; min-height: 100vh; }
25
- header { border-bottom: 1px solid var(--line); }
26
- .bar { max-width: 740px; margin: 0 auto; padding: 1.15rem 1.25rem; display: flex; justify-content: space-between; align-items: baseline; }
27
- .brand { font-family: var(--font-serif); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--ink); }
28
- .brand:hover { text-decoration: none; color: var(--brand); }
29
- nav { display: flex; gap: 1.5rem; }
30
- nav a { color: var(--ink-2); font-size: 0.95rem; font-weight: 500; }
31
- nav a:hover { color: var(--brand); text-decoration: none; }
32
- main { max-width: 740px; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
33
- footer { border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.85rem; }
34
- .foot { max-width: 740px; margin: 0 auto; padding: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; }
35
- a { color: var(--brand); text-decoration: none; }
36
- a:hover { text-decoration: underline; }
37
- `),
38
- ];
39
-
40
- export const counterStyles = [
41
- sheet(`
42
- :host { display: inline-block; }
43
- .counter-row { display: inline-flex; gap: 0.75rem; align-items: center; }
44
- button {
45
- width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: 6px;
46
- background: #fff; color: var(--ink); font-size: 1rem; line-height: 1; cursor: pointer;
47
- transition: border-color 0.15s ease, color 0.15s ease;
48
- }
49
- button:hover { border-color: var(--brand); color: var(--brand); }
50
- span { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
51
- `),
52
- ];
53
-
54
- export const tickerStyles = [
55
- sheet(`
56
- :host { display: inline-block; }
57
- .ticker-row { display: inline-flex; gap: 0.75rem; align-items: center; }
58
- button {
59
- height: 2rem; padding: 0 0.9rem; border: 1px solid var(--line); border-radius: 6px;
60
- background: #fff; color: var(--ink); font-size: 0.9rem; cursor: pointer;
61
- transition: border-color 0.15s ease, color 0.15s ease;
62
- }
63
- button:hover { border-color: var(--brand); color: var(--brand); }
64
- span { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
65
- `),
66
- ];
67
-
68
- // ─── Page sheets (light roots → inlined as @scope(<page-tag>) in SSR) ───
69
-
70
- // Shared post-list rules (home teaser + blog index) — one source, both pages
71
- // include this sheet in their `static styles` arrays.
72
- export const postListStyles = [
73
- sheet(`
74
- .posts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
75
- .post { display: block; padding: 1.15rem 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
76
- a.post:hover .title { color: var(--brand); }
77
- .post .title { display: block; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); transition: color 0.15s ease; }
78
- .post .meta { display: block; margin-top: 0.3rem; font-size: 0.85rem; color: var(--ink-2); }
79
- .post .excerpt { display: block; margin-top: 0.45rem; color: var(--ink-2); line-height: 1.6; }
80
- `),
81
- ];
82
-
83
- // Home page (index-page)
84
- export const homePageStyles = [
85
- sheet(`
86
- :host { display: block; }
87
- .hero { padding: 2.5rem 0 1rem; }
88
- .eyebrow { color: var(--brand); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }
89
- h1 { font-family: var(--font-serif); font-size: 3rem; line-height: 1.12; letter-spacing: -0.015em; margin: 0.75rem 0 1.25rem; font-weight: 700; }
90
- .lede { font-size: 1.15rem; line-height: 1.75; color: var(--ink-2); max-width: 58ch; margin: 0; }
91
- .lede code { font-size: 0.85em; }
92
- .more { display: inline-block; margin-top: 1.5rem; font-weight: 600; }
93
- .demo { margin-top: 2.75rem; border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem 1.5rem; }
94
- .demo .label { color: var(--ink-2); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 0.9rem; }
95
- .recent { margin-top: 3rem; }
96
- .recent h2 { font-family: var(--font-serif); letter-spacing: -0.01em; margin: 0 0 0.25rem; }
97
- .recent .sub { color: var(--ink-2); font-size: 0.925rem; margin: 0 0 1.5rem; }
98
- .recent .sub code { font-size: 0.85em; }
99
- a { color: var(--brand); text-decoration: none; }
100
- a:hover { text-decoration: underline; }
101
- `),
102
- ...postListStyles,
103
- ];
104
-
105
- // Blog index (blog-index)
106
- export const blogIndexStyles = [
107
- sheet(`
108
- :host { display: block; }
109
- .eyebrow { color: var(--brand); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }
110
- h1 { font-family: var(--font-serif); letter-spacing: -0.015em; margin: 0.5rem 0; }
111
- .sub { color: var(--ink-2); font-size: 0.925rem; margin: 0 0 1.5rem; }
112
- .sub code { font-size: 0.85em; }
113
- a { color: var(--brand); text-decoration: none; }
114
- `),
115
- ...postListStyles,
116
- ];
117
-
118
- // Blog post page (blog-welcome)
119
- export const blogWelcomeStyles = [
120
- sheet(`
121
- :host { display: block; }
122
- h1 { font-family: var(--font-serif); font-size: 2.4rem; line-height: 1.15; letter-spacing: -0.015em; margin: 0.5rem 0; }
123
- .meta { color: var(--ink-2); font-size: 0.9rem; margin-top: 0; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
124
- a { color: var(--brand); text-decoration: none; }
125
- .post-body { line-height: 1.8; font-size: 1.05rem; }
126
- .post-body h2 { font-family: var(--font-serif); margin: 2.5rem 0 0.75rem; letter-spacing: -0.01em; }
127
- .post-body p { margin: 1rem 0; }
128
- .post-body code { font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 0.85em; background: #f1efe8; border: 1px solid var(--line); padding: 0.1em 0.4em; border-radius: 5px; }
129
- `),
130
- ];
131
-
132
- // Freshness proof (freshness-page)
133
- export const freshnessPageStyles = [
134
- sheet(`
135
- :host { display: block; max-width: 800px; margin: 2rem auto; padding: 0 1rem; }
136
- p { color: var(--ink-2); }
137
- `),
138
- ];
139
-
140
- // Styled 404 (el-404)
141
- export const notFoundPageStyles = [
142
- sheet(`
143
- :host { display: block; }
144
- h1 { font-family: var(--font-serif); font-size: 2.4rem; letter-spacing: -0.015em; margin: 0.75rem 0 0.5rem; font-weight: 700; }
145
- p { color: var(--ink-2); line-height: 1.6; }
146
- a { color: var(--brand); font-weight: 600; text-decoration: none; }
147
- a:hover { text-decoration: underline; }
148
- `),
149
- ];
150
-
151
- // Contact form (contact-page)
152
- export const contactPageStyles = [
153
- sheet(`
154
- :host { display: block; }
155
- h1 { font-family: var(--font-serif); font-size: 2.4rem; letter-spacing: -0.015em; margin: 0.75rem 0 0.5rem; font-weight: 700; }
156
- .sub { color: var(--ink-2); line-height: 1.6; max-width: 52ch; margin: 0 0 1.75rem; }
157
- form { display: flex; gap: 0.6rem; flex-wrap: wrap; }
158
- input { font: inherit; min-width: 16rem; padding: 0.55rem 0.8rem; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: #fff; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
159
- input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #8262db2e; }
160
- button { font: inherit; font-weight: 600; padding: 0.55rem 1.1rem; cursor: pointer; border: 1px solid var(--brand); border-radius: 6px; background: var(--brand); color: #fff; transition: opacity 0.15s ease; }
161
- button:hover { opacity: 0.88; }
162
- #error { color: #c92a2a; margin: 1rem 0 0; }
163
- #error:empty, #thanks:empty { display: none; }
164
- #thanks { color: var(--brand); font-weight: 600; margin: 1rem 0 0; }
165
- `),
166
- ];