@openelement/create 1.0.0-alpha.14 → 1.0.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -51
- package/package.json +1 -1
- package/src/cli.js +159 -76
- package/src/node-version.js +102 -0
- package/src/pm.js +143 -9
- package/src/template-builder.js +59 -14
- package/src/version.js +2 -10
- package/templates/.node-version +1 -0
- package/templates/AGENTS.md.tmpl +46 -0
- package/templates/README.tmpl +36 -145
- package/templates/app/head.tsx.tmpl +11 -26
- package/templates/app/islands/live-timer.css +2 -20
- package/templates/app/islands/live-timer.tsx.tmpl +49 -43
- package/templates/app/islands/my-counter.css +2 -29
- package/templates/app/islands/my-counter.tsx.tmpl +43 -34
- package/templates/app/layout.tsx.tmpl +79 -0
- package/templates/app/routes/404.tsx.tmpl +20 -8
- package/templates/app/routes/about.tsx.tmpl +34 -3
- package/templates/app/routes/api/ping.ts.tmpl +2 -3
- package/templates/app/routes/index.tsx.tmpl +32 -3
- package/templates/app/styles/theme.css +81 -77
- package/templates/gitignore.tmpl +2 -0
- package/templates/openelement.config.ts.tmpl +16 -28
- package/templates/package.json.tmpl +8 -6
- package/templates/tests/ping.test.ts.tmpl +15 -0
- package/templates/tsconfig.json.tmpl +2 -2
- package/templates/vite.config.ts.tmpl +7 -14
- package/templates/app/components/badges.css +0 -24
- package/templates/app/components/page-404.css +0 -21
- package/templates/app/components/page-404.tsx.tmpl +0 -28
- package/templates/app/components/page-about.css +0 -72
- package/templates/app/components/page-about.tsx.tmpl +0 -77
- package/templates/app/components/page-home.css +0 -135
- package/templates/app/components/page-home.tsx.tmpl +0 -116
- package/templates/app/components/site-chrome.css +0 -68
- package/templates/app/islands/app-shell.tsx.tmpl +0 -54
- package/templates/app/styles/recipes.css +0 -43
- package/templates/pnpm-workspace.yaml.tmpl +0 -29
|
@@ -1,54 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* live-timer — client-only live stats island (compiled).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Generated-element lane (2026-11-20): the class this template used to declare
|
|
5
|
+
* is a function component with a sidecar. `hydrate: 'only'` with `ssr: false`
|
|
6
|
+
* renders nothing on the server; the client entry builds the shadow root from
|
|
7
|
+
* the compiled Part Program and starts the clock in `onConnect`, measured from
|
|
8
|
+
* the document's time origin. The cleanup `onConnect` returns stops the
|
|
9
|
+
* interval when the host leaves the tree, so a reconnect arms exactly one clock.
|
|
10
|
+
*
|
|
11
|
+
* Styling has ONE owner: the sidecar's `styles` declaration. This island is
|
|
12
|
+
* client-only, so no DSD template exists to carry a `<link>`: the compiler
|
|
13
|
+
* turns the declaration into a real `import` of the same sheet and the shell
|
|
14
|
+
* adopts it into the root it creates. The `:host` box rule in
|
|
15
|
+
* `app/islands/live-timer.css` therefore reaches the host, and the single
|
|
16
|
+
* declaration still feeds the build-time asset and the DSD link for the
|
|
17
|
+
* islands that do render on the server.
|
|
9
18
|
*/
|
|
10
19
|
import { defineIslandConfig } from "@openelement/router";
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
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];
|
|
20
|
+
import { signal } from "@openelement/element";
|
|
21
|
+
import { onConnect } from "@openelement/element/lifecycle";
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export const openElement = defineIslandConfig({
|
|
24
|
+
hydrate: "only",
|
|
25
|
+
ssr: false,
|
|
26
|
+
dsd: false,
|
|
27
|
+
root: "shadow",
|
|
28
|
+
styles: ["./live-timer.css"],
|
|
29
|
+
});
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
function LiveTimer() {
|
|
32
|
+
/** Elapsed seconds, preformatted: a compiled text Part binds a plain signal
|
|
33
|
+
* value, never a method call (OEC9013). */
|
|
34
|
+
const elapsed = signal("0.0");
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
onConnect(() => {
|
|
37
|
+
// `globalThis.setInterval`, not the bare global: the generated tsconfig
|
|
38
|
+
// loads both DOM and node types, so the bare name resolves to Node's
|
|
39
|
+
// overload. No handle is stored on the element; the returned cleanup owns
|
|
40
|
+
// it for the connection's lifetime (the emitted factory keeps the closure).
|
|
41
|
+
const interval = globalThis.setInterval(() => {
|
|
42
|
+
elapsed.value = (Math.round(globalThis.performance.now()) / 1000).toFixed(1);
|
|
37
43
|
}, 100);
|
|
38
|
-
|
|
44
|
+
return () => globalThis.clearInterval(interval);
|
|
45
|
+
});
|
|
39
46
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
47
|
+
return (
|
|
48
|
+
<div class="inline-flex items-baseline gap-[0.6rem]">
|
|
49
|
+
<span
|
|
50
|
+
id="elapsed"
|
|
51
|
+
class="min-w-[6ch] text-right text-[1.4rem] font-semibold text-brand tabular-nums"
|
|
52
|
+
>
|
|
53
|
+
{elapsed.value}
|
|
54
|
+
</span>
|
|
55
|
+
<span class="text-[0.85rem] text-ink-soft">seconds on this page</span>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
54
58
|
}
|
|
59
|
+
|
|
60
|
+
export default LiveTimer;
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
+
/* The island shadow host's box; the row, buttons and count are authored as
|
|
2
|
+
Tailwind utilities in my-counter.tsx. */
|
|
1
3
|
:host {
|
|
2
4
|
display: inline-block;
|
|
3
5
|
}
|
|
4
|
-
.counter-row {
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
gap: 0.75rem;
|
|
7
|
-
align-items: center;
|
|
8
|
-
}
|
|
9
|
-
button {
|
|
10
|
-
width: 2rem;
|
|
11
|
-
height: 2rem;
|
|
12
|
-
border: 1px solid var(--line);
|
|
13
|
-
border-radius: var(--radius-s);
|
|
14
|
-
background: var(--paper);
|
|
15
|
-
color: var(--ink);
|
|
16
|
-
font-size: 1rem;
|
|
17
|
-
line-height: 1;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
transition:
|
|
20
|
-
border-color 0.15s ease,
|
|
21
|
-
color 0.15s ease;
|
|
22
|
-
}
|
|
23
|
-
button:hover {
|
|
24
|
-
border-color: var(--brand);
|
|
25
|
-
color: var(--brand);
|
|
26
|
-
}
|
|
27
|
-
span {
|
|
28
|
-
min-width: 2ch;
|
|
29
|
-
text-align: center;
|
|
30
|
-
font-variant-numeric: tabular-nums;
|
|
31
|
-
font-weight: 600;
|
|
32
|
-
}
|
|
@@ -1,43 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* my-counter — the interactive counter island (compiled).
|
|
3
3
|
*
|
|
4
|
-
* Hydrates on idle; the buttons
|
|
5
|
-
*
|
|
6
|
-
* shadow root keeps the island a DSD citizen.
|
|
7
|
-
*
|
|
4
|
+
* Hydrates on idle; the buttons drive compiled event Parts and the count renders
|
|
5
|
+
* through a compiled text Part. Presentation is utility-first below, and the
|
|
6
|
+
* shadow root keeps the island a DSD citizen.
|
|
7
|
+
*
|
|
8
|
+
* Generated-element lane (2026-11-20): the class this template used to declare is
|
|
9
|
+
* a function component with a sidecar. `count` is the lane's `signal` intrinsic —
|
|
10
|
+
* a reactive node the compiler creates in the retained instance scope, so the
|
|
11
|
+
* buttons write it and the text Part reads it with no second state channel. The
|
|
12
|
+
* sidecar's `styles` channel is the DSD style-link carrier (M09-2e / #1803): the
|
|
13
|
+
* sheet is declared as a marked `<link>` INSIDE the shadow template.
|
|
8
14
|
*/
|
|
9
15
|
import { defineIslandConfig } from "@openelement/router";
|
|
10
|
-
import {
|
|
11
|
-
import counterStyles from "./my-counter.css";
|
|
12
|
-
|
|
13
|
-
export const openElement = defineIslandConfig({ hydrate: "idle", ssr: true, dsd: true });
|
|
14
|
-
|
|
15
|
-
@element("my-counter", { root: "shadow-open" })
|
|
16
|
-
export default class MyCounter extends OpenElement {
|
|
17
|
-
static override styles = [counterStyles];
|
|
16
|
+
import { signal } from "@openelement/element";
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export const openElement = defineIslandConfig({
|
|
19
|
+
hydrate: "idle",
|
|
20
|
+
ssr: true,
|
|
21
|
+
dsd: true,
|
|
22
|
+
root: "shadow",
|
|
23
|
+
styles: ["./my-counter.css"],
|
|
24
|
+
});
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
26
|
+
function MyCounter() {
|
|
27
|
+
const count = signal(0);
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
return (
|
|
30
|
+
<div class="inline-flex items-center gap-3">
|
|
31
|
+
<button
|
|
32
|
+
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"
|
|
33
|
+
type="button"
|
|
34
|
+
onClick={() => count.value--}
|
|
35
|
+
>
|
|
36
|
+
-
|
|
37
|
+
</button>
|
|
38
|
+
<span id="count" class="min-w-[2ch] text-center font-semibold tabular-nums">
|
|
39
|
+
{count.value}
|
|
40
|
+
</span>
|
|
41
|
+
<button
|
|
42
|
+
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"
|
|
43
|
+
type="button"
|
|
44
|
+
onClick={() => count.value++}
|
|
45
|
+
>
|
|
46
|
+
+
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
43
50
|
}
|
|
51
|
+
|
|
52
|
+
export default MyCounter;
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
* A convention, not a requirement: delete the file and pages render their own
|
|
6
|
+
* chrome again, or opt out with `layout: false` in openelement.config.ts.
|
|
7
|
+
*/
|
|
8
|
+
import { defineIslandConfig } from "@openelement/router";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The convention layout on the generated-element lane (2026-11-20).
|
|
12
|
+
*
|
|
13
|
+
* The class this template used to declare is a function component plus the
|
|
14
|
+
* sidecar below. The tag is the router's convention constant, and the entry
|
|
15
|
+
* registers the host through the generated host PAIR channel, so the layout
|
|
16
|
+
* renders as a generated element instead of a class.
|
|
17
|
+
*
|
|
18
|
+
* LIGHT root on purpose. The chrome is styled with Tailwind utilities, and a
|
|
19
|
+
* LIGHT root's CSS is a DOCUMENT resource: the utilities ride the compiled
|
|
20
|
+
* document sheet, and the host's box rule lives in `app/styles/theme.css`
|
|
21
|
+
* (`app-layout { display: block }`). Page content still projects through the
|
|
22
|
+
* `<slot>` — the generated light-root producer substitutes it at the slot.
|
|
23
|
+
* A shadow root would need the utilities inside its shadow tree, which requires
|
|
24
|
+
* a component-sheet link channel the generated lane has no app-local
|
|
25
|
+
* declaration for (package components declare it in their manifest; an app's
|
|
26
|
+
* own layout does not).
|
|
27
|
+
*/
|
|
28
|
+
export const openElement = defineIslandConfig({
|
|
29
|
+
tag: "app-layout",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function Layout() {
|
|
33
|
+
return (
|
|
34
|
+
<div>
|
|
35
|
+
<header class="site-head border-b border-line bg-paper">
|
|
36
|
+
<div class="mx-auto flex max-w-(--content-width) items-baseline justify-between gap-4 px-5 py-4">
|
|
37
|
+
<a
|
|
38
|
+
class="text-[1.1rem] font-bold tracking-[-0.01em] text-ink no-underline hover:text-brand"
|
|
39
|
+
href="/"
|
|
40
|
+
>
|
|
41
|
+
openElement
|
|
42
|
+
</a>
|
|
43
|
+
<nav class="flex gap-5">
|
|
44
|
+
<a
|
|
45
|
+
class="text-[0.95rem] font-medium text-ink-soft no-underline hover:text-brand"
|
|
46
|
+
href="/"
|
|
47
|
+
>
|
|
48
|
+
Home
|
|
49
|
+
</a>
|
|
50
|
+
<a
|
|
51
|
+
class="text-[0.95rem] font-medium text-ink-soft no-underline hover:text-brand"
|
|
52
|
+
href="/about"
|
|
53
|
+
>
|
|
54
|
+
About
|
|
55
|
+
</a>
|
|
56
|
+
<a
|
|
57
|
+
class="text-[0.95rem] font-medium text-ink-soft no-underline hover:text-brand"
|
|
58
|
+
href="/api/ping"
|
|
59
|
+
>
|
|
60
|
+
API
|
|
61
|
+
</a>
|
|
62
|
+
</nav>
|
|
63
|
+
</div>
|
|
64
|
+
</header>
|
|
65
|
+
<main class="mx-auto max-w-(--content-width) px-5 pt-12 pb-16">
|
|
66
|
+
<slot></slot>
|
|
67
|
+
</main>
|
|
68
|
+
<footer class="site-foot border-t border-line text-[0.85rem] text-ink-soft">
|
|
69
|
+
<div class="mx-auto flex max-w-(--content-width) flex-wrap justify-between gap-4 p-5">
|
|
70
|
+
<a class="text-ink-soft no-underline hover:text-brand" href="https://openelement.org">
|
|
71
|
+
openelement.org
|
|
72
|
+
</a>
|
|
73
|
+
</div>
|
|
74
|
+
</footer>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default Layout;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Styled 404
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
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.
|
|
5
|
+
*
|
|
6
|
+
* Server function component declared in its own route module; the root box rule
|
|
7
|
+
* lives in the document token sheet. */
|
|
9
8
|
import { definePage } from "@openelement/router";
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
export function NotFoundPage() {
|
|
11
|
+
return (
|
|
12
|
+
<div class="page-content">
|
|
13
|
+
<h1 class="mt-3 mb-2 text-[2.4rem] font-bold tracking-[-0.02em]">404</h1>
|
|
14
|
+
<p class="leading-[1.6] text-ink-soft">The page you are looking for does not exist.</p>
|
|
15
|
+
<p class="leading-[1.6] text-ink-soft">
|
|
16
|
+
<a class="font-semibold text-brand no-underline hover:underline" href="/">
|
|
17
|
+
Back to the homepage
|
|
18
|
+
</a>
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
11
23
|
|
|
12
24
|
export default definePage(NotFoundPage, {
|
|
13
25
|
renderIntent: { mode: "dynamic" },
|
|
@@ -1,10 +1,41 @@
|
|
|
1
|
-
/** Static About page (default renderIntent mode 'static') — prerendered at build time. */
|
|
2
1
|
import { definePage } from "@openelement/router";
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export function AboutPage() {
|
|
4
|
+
return (
|
|
5
|
+
<div class="page-content">
|
|
6
|
+
<h1 class="mt-0 mb-4 text-[clamp(1.9rem,5vw,2.6rem)] leading-[1.15] font-bold tracking-[-0.02em]">
|
|
7
|
+
Static first, interactive where it counts
|
|
8
|
+
</h1>
|
|
9
|
+
<p class="max-w-[58ch] text-[1.08rem] text-ink-soft">
|
|
10
|
+
This route is built as HTML and CSS and has no islands of its own. The{" "}
|
|
11
|
+
<a class="text-brand hover:underline" href="/">
|
|
12
|
+
home page
|
|
13
|
+
</a>{" "}
|
|
14
|
+
adds a counter and a timer.
|
|
15
|
+
</p>
|
|
16
|
+
<h2 class="mt-9 text-[1.25rem]">Make a change</h2>
|
|
17
|
+
<ul class="space-y-2 pl-5 text-ink-soft">
|
|
18
|
+
<li>
|
|
19
|
+
Add a page under <code class="font-mono text-brand">app/routes/</code>.
|
|
20
|
+
</li>
|
|
21
|
+
<li>
|
|
22
|
+
Edit the counter or timer under <code class="font-mono text-brand">app/islands/</code>.
|
|
23
|
+
</li>
|
|
24
|
+
<li>
|
|
25
|
+
Try{" "}
|
|
26
|
+
<a class="text-brand hover:underline" href="/api/ping">
|
|
27
|
+
/api/ping
|
|
28
|
+
</a>{" "}
|
|
29
|
+
for a request-time JSON response.
|
|
30
|
+
</li>
|
|
31
|
+
</ul>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
4
35
|
|
|
5
36
|
export default definePage(AboutPage, {
|
|
6
37
|
head: {
|
|
7
38
|
title: "About",
|
|
8
|
-
description: "
|
|
39
|
+
description: "A prerendered route with no client islands of its own.",
|
|
9
40
|
},
|
|
10
41
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* /api/ping — a request-time server route: a plain WinterCG-shaped
|
|
3
|
-
*
|
|
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({
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
/** Static home page (default renderIntent mode 'static') — prerendered at build time. */
|
|
2
1
|
import { definePage } from "@openelement/router";
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div class="page-content">
|
|
6
|
+
<h1 class="mt-0 mb-4 max-w-[22ch] text-[clamp(2.2rem,6vw,3.2rem)] leading-[1.1] font-bold tracking-[-0.02em]">
|
|
7
|
+
Rendered before JavaScript arrives
|
|
8
|
+
</h1>
|
|
9
|
+
<p class="max-w-[56ch] text-[1.12rem] leading-[1.75] text-ink-soft">
|
|
10
|
+
Edit <code class="font-mono text-brand">app/routes/index.tsx</code> and save to see your
|
|
11
|
+
first change in the dev server.
|
|
12
|
+
</p>
|
|
13
|
+
<div class="mt-10 grid grid-cols-[repeat(auto-fit,minmax(min(100%,18rem),1fr))] gap-4">
|
|
14
|
+
<section class="rounded-(--radius-l) border border-line bg-paper px-7 py-6">
|
|
15
|
+
<h2 class="m-0 text-[1.3rem]">Interactive island</h2>
|
|
16
|
+
<p class="mt-2 mb-5 text-ink-soft">
|
|
17
|
+
The server renders the counter. Its button starts responding when the browser hydrates
|
|
18
|
+
the island during idle time.
|
|
19
|
+
</p>
|
|
20
|
+
<my-counter></my-counter>
|
|
21
|
+
</section>
|
|
22
|
+
<section class="rounded-(--radius-l) border border-line bg-paper px-7 py-6">
|
|
23
|
+
<h2 class="m-0 text-[1.3rem]">Client-only timer</h2>
|
|
24
|
+
<p class="mt-2 mb-5 text-ink-soft">
|
|
25
|
+
The browser mounts the timer and measures elapsed time locally.
|
|
26
|
+
</p>
|
|
27
|
+
<live-timer></live-timer>
|
|
28
|
+
</section>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
4
33
|
|
|
5
34
|
export default definePage(HomePage, {
|
|
6
35
|
head: {
|
|
7
36
|
title: "Rendered before JavaScript arrives",
|
|
8
|
-
description: "
|
|
37
|
+
description: "A prerendered page with an interactive counter and a client-only timer.",
|
|
9
38
|
},
|
|
10
39
|
});
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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,10 +45,37 @@
|
|
|
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;
|
|
65
|
+
}
|
|
66
|
+
|
|
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);
|
|
52
75
|
}
|
|
53
76
|
|
|
54
|
-
/*
|
|
55
|
-
|
|
77
|
+
/* Runtime dark pairs (shadcn v4 convention): re-seating a role here re-seats
|
|
78
|
+
every palette alias that resolves through it. */
|
|
56
79
|
:root[data-theme="dark"],
|
|
57
80
|
:host([data-theme="dark"]) {
|
|
58
81
|
--color-background: var(--color-zinc-950);
|
|
@@ -84,8 +107,7 @@
|
|
|
84
107
|
--color-ring: var(--color-violet-400);
|
|
85
108
|
}
|
|
86
109
|
|
|
87
|
-
/* Forced
|
|
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,52 @@
|
|
|
110
132
|
}
|
|
111
133
|
}
|
|
112
134
|
|
|
113
|
-
/*
|
|
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
|
|
162
|
-
|
|
163
|
-
|
|
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-
|
|
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
|
}
|
|
165
|
+
|
|
166
|
+
/* ── LIGHT-root host boxes ────────────────────────────────────────────────
|
|
167
|
+
A custom element is inline by default and the host tag is not authored
|
|
168
|
+
markup, so no utility can carry its own box. The layout and the page
|
|
169
|
+
components are function components on the generated-element lane and render
|
|
170
|
+
LIGHT roots, whose CSS is a DOCUMENT resource — this token sheet is its
|
|
171
|
+
single owner. These selectors are the exact replacements for the retired
|
|
172
|
+
per-component `:host { display: block }` sheets.
|
|
173
|
+
|
|
174
|
+
The layout is a LIGHT root on purpose: its chrome is styled with Tailwind
|
|
175
|
+
utilities, and a shadow root's utilities would need a component-sheet link
|
|
176
|
+
channel the generated lane has no app-local declaration for. Slotted page
|
|
177
|
+
content still projects through its `<slot>`. */
|
|
178
|
+
app-layout,
|
|
179
|
+
index-page,
|
|
180
|
+
about-page,
|
|
181
|
+
el-404 {
|
|
182
|
+
display: block;
|
|
183
|
+
}
|