@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.
- package/README.md +49 -19
- 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 -6
- package/src/version.js +2 -10
- package/templates/.node-version +1 -0
- package/templates/AGENTS.md.tmpl +44 -0
- package/templates/README.tmpl +140 -74
- package/templates/app/components/page-404.css +5 -7
- package/templates/app/components/page-404.tsx.tmpl +16 -37
- package/templates/app/components/page-about.css +5 -15
- package/templates/app/components/page-about.tsx.tmpl +86 -82
- package/templates/app/components/page-home.css +5 -23
- package/templates/app/components/page-home.tsx.tmpl +137 -114
- package/templates/app/components/site-chrome.css +5 -15
- package/templates/app/head.tsx.tmpl +12 -23
- package/templates/app/islands/live-timer.css +5 -9
- package/templates/app/islands/live-timer.tsx.tmpl +31 -21
- package/templates/app/islands/my-counter.css +5 -11
- package/templates/app/islands/my-counter.tsx.tmpl +26 -13
- package/templates/app/layout.tsx.tmpl +68 -0
- package/templates/app/routes/404.tsx.tmpl +7 -10
- package/templates/app/routes/about.tsx.tmpl +4 -4
- package/templates/app/routes/api/ping.ts.tmpl +4 -5
- package/templates/app/routes/index.tsx.tmpl +4 -4
- package/templates/app/styles/theme.css +64 -79
- package/templates/openelement.config.ts.tmpl +21 -33
- package/templates/package.json.tmpl +14 -10
- package/templates/tsconfig.json.tmpl +1 -1
- package/templates/vite.config.ts.tmpl +9 -7
- package/templates/app/components/badges.css +0 -5
- package/templates/app/styles/recipes.css +0 -43
|
@@ -1,47 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Styled 404 page element (
|
|
3
|
-
* with a 404 status for unmatched paths
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* rules via `static styles` (the imported .css sheets), inlined into SSR as
|
|
7
|
-
* @scope(el-404). The site chrome sheet (./site-chrome.css) is shared
|
|
2
|
+
* Styled 404 page element (path-derived tag 'el-404'): the request-time server
|
|
3
|
+
* renders it with a 404 status for unmatched paths. Presentation is
|
|
4
|
+
* utility-first in the markup; the one rule in `static styles` is the root's
|
|
5
|
+
* own box.
|
|
8
6
|
*/
|
|
9
|
-
import { element, OpenElement } from
|
|
10
|
-
import notFoundPageStyles from
|
|
11
|
-
import siteChromeStyles from './site-chrome.css';
|
|
7
|
+
import { element, OpenElement } from "@openelement/element";
|
|
8
|
+
import notFoundPageStyles from "./page-404.css";
|
|
12
9
|
|
|
13
|
-
@element(
|
|
10
|
+
@element("el-404", { root: "light" })
|
|
14
11
|
export default class NotFoundPage extends OpenElement {
|
|
15
|
-
static override styles = [notFoundPageStyles
|
|
12
|
+
static override styles = [notFoundPageStyles];
|
|
16
13
|
|
|
17
14
|
render() {
|
|
18
15
|
return (
|
|
19
|
-
<div class=
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<a href='/about'>About</a>
|
|
28
|
-
<a href='/api/ping'>API</a>
|
|
29
|
-
</nav>
|
|
30
|
-
</div>
|
|
31
|
-
</header>
|
|
32
|
-
<main>
|
|
33
|
-
<h1>404</h1>
|
|
34
|
-
<p>The page you are looking for does not exist.</p>
|
|
35
|
-
<p>
|
|
36
|
-
<a href='/'>Back to the homepage</a>
|
|
37
|
-
</p>
|
|
38
|
-
</main>
|
|
39
|
-
<footer class='site-foot'>
|
|
40
|
-
<div class='bar'>
|
|
41
|
-
<span>Generated by @openelement/create.</span>
|
|
42
|
-
<a href='https://openelement.org'>openelement.org</a>
|
|
43
|
-
</div>
|
|
44
|
-
</footer>
|
|
16
|
+
<div class="page-content">
|
|
17
|
+
<h1 class="mt-3 mb-2 text-[2.4rem] font-bold tracking-[-0.02em]">404</h1>
|
|
18
|
+
<p class="leading-[1.6] text-ink-soft">The page you are looking for does not exist.</p>
|
|
19
|
+
<p class="leading-[1.6] text-ink-soft">
|
|
20
|
+
<a class="font-semibold text-brand no-underline hover:underline" href="/">
|
|
21
|
+
Back to the homepage
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
45
24
|
</div>
|
|
46
25
|
);
|
|
47
26
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 2.25rem 0 0.6rem; }
|
|
7
|
-
p { margin: 0.6rem 0; max-width: 62ch; }
|
|
8
|
-
p code, li code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.35em; }
|
|
9
|
-
.conventions { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
|
|
10
|
-
.conventions li { display: flex; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
|
|
11
|
-
.conventions code { font-family: var(--font-mono); font-size: 0.85rem; color: var(--brand); min-width: 15rem; }
|
|
12
|
-
.conventions span { color: var(--ink-soft); font-size: 0.92rem; }
|
|
13
|
-
a { color: var(--brand); text-decoration: none; }
|
|
14
|
-
a:hover { text-decoration: underline; }
|
|
15
|
-
|
|
1
|
+
/* The page-about light root's box: a custom element is inline by default and
|
|
2
|
+
the host tag is not authored markup, so no utility can carry it. */
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
@@ -1,92 +1,96 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* About page element — the fully static showcase page
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* prerendered markup and CSS. The header, footer and badges come from the
|
|
7
|
-
* shared sheets in ./site-chrome.css and ./badges.css (light root, inlined
|
|
8
|
-
* into SSR as @scope(about-page)).
|
|
2
|
+
* About page element — the fully static showcase page: no islands, so nothing
|
|
3
|
+
* here ships JavaScript. The default static renderIntent prerenders it to HTML
|
|
4
|
+
* at build time; the layout owns the chrome; the one rule in `static styles`
|
|
5
|
+
* is the root's own box.
|
|
9
6
|
*/
|
|
10
|
-
import { element, OpenElement } from
|
|
11
|
-
import aboutPageStyles from
|
|
12
|
-
import badgeStyles from './badges.css';
|
|
13
|
-
import siteChromeStyles from './site-chrome.css';
|
|
7
|
+
import { element, OpenElement } from "@openelement/element";
|
|
8
|
+
import aboutPageStyles from "./page-about.css";
|
|
14
9
|
|
|
15
|
-
@element(
|
|
10
|
+
@element("about-page", { root: "light" })
|
|
16
11
|
export default class AboutPage extends OpenElement {
|
|
17
|
-
static override styles = [aboutPageStyles
|
|
12
|
+
static override styles = [aboutPageStyles];
|
|
18
13
|
|
|
19
14
|
render() {
|
|
20
15
|
return (
|
|
21
|
-
<div class=
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</
|
|
16
|
+
<div class="page-content">
|
|
17
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-ok/35 bg-ok/8 px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-ok uppercase">
|
|
18
|
+
static · no islands on this page
|
|
19
|
+
</span>
|
|
20
|
+
<p class="m-0 text-[0.78rem] font-semibold tracking-[0.14em] text-brand uppercase">About</p>
|
|
21
|
+
<h1 class="mt-3 mb-4 text-[clamp(1.9rem,5vw,2.6rem)] leading-[1.15] font-bold tracking-[-0.02em]">
|
|
22
|
+
Static first, interactive where it counts
|
|
23
|
+
</h1>
|
|
24
|
+
<p class="mb-8 max-w-[58ch] text-[1.08rem] text-ink-soft">
|
|
25
|
+
openElement prerenders pages to plain HTML and CSS at build time and hydrates compiled
|
|
26
|
+
islands only where a page needs interactivity. This page is the first half of that story:
|
|
27
|
+
it ships no islands at all.
|
|
28
|
+
</p>
|
|
29
|
+
<h2 class="mt-9 mb-[0.6rem] text-[1.25rem] tracking-[-0.01em]">
|
|
30
|
+
What happened when you opened this page
|
|
31
|
+
</h2>
|
|
32
|
+
<p class="my-[0.6rem] max-w-[62ch]">
|
|
33
|
+
The server sent HTML — prerendered at build time by SSG — plus the stylesheet the page's
|
|
34
|
+
utility classes compile into. No framework runtime executed to produce what you are
|
|
35
|
+
reading; the markup is the artifact.
|
|
36
|
+
</p>
|
|
37
|
+
<h2 class="mt-9 mb-[0.6rem] text-[1.25rem] tracking-[-0.01em]">Where things live</h2>
|
|
38
|
+
<ul class="mt-4 list-none border-t border-line p-0">
|
|
39
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
40
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/routes/</code>
|
|
41
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
42
|
+
page routes — one file per URL, prerendered by default
|
|
43
|
+
</span>
|
|
44
|
+
</li>
|
|
45
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
46
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/routes/api/</code>
|
|
47
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
48
|
+
request-time server routes — plain Request → Response handlers
|
|
49
|
+
</span>
|
|
50
|
+
</li>
|
|
51
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
52
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/components/</code>
|
|
53
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
54
|
+
compiled page elements and the shared style sheets they array
|
|
55
|
+
</span>
|
|
56
|
+
</li>
|
|
57
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
58
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/islands/</code>
|
|
59
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
60
|
+
client islands — the only code that ships JavaScript
|
|
61
|
+
</span>
|
|
62
|
+
</li>
|
|
63
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
64
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/layout.tsx</code>
|
|
65
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
66
|
+
the shared site chrome wrapped around every page
|
|
67
|
+
</span>
|
|
68
|
+
</li>
|
|
69
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
70
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">
|
|
71
|
+
app/styles/theme.css
|
|
72
|
+
</code>
|
|
73
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
74
|
+
design tokens — the @theme role sheet every utility reads
|
|
75
|
+
</span>
|
|
76
|
+
</li>
|
|
77
|
+
<li class="flex flex-wrap gap-4 border-b border-line py-[0.7rem]">
|
|
78
|
+
<code class="min-w-[15rem] font-mono text-[0.85rem] text-brand">app/head.tsx</code>
|
|
79
|
+
<span class="text-[0.92rem] text-ink-soft">
|
|
80
|
+
structural document-head content (meta tags, preloads)
|
|
81
|
+
</span>
|
|
82
|
+
</li>
|
|
83
|
+
</ul>
|
|
84
|
+
<h2 class="mt-9 mb-[0.6rem] text-[1.25rem] tracking-[-0.01em]">See it working</h2>
|
|
85
|
+
<p class="my-[0.6rem] max-w-[62ch]">
|
|
86
|
+
The{" "}
|
|
87
|
+
<a class="text-brand no-underline hover:underline" href="/">
|
|
88
|
+
home page
|
|
89
|
+
</a>{" "}
|
|
90
|
+
carries the interactive half: a counter island that hydrates on idle and a client-only
|
|
91
|
+
live timer. Open the browser DevTools on both pages and compare the network panels — the
|
|
92
|
+
badge on each section names what it costs.
|
|
93
|
+
</p>
|
|
90
94
|
</div>
|
|
91
95
|
);
|
|
92
96
|
}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.lede { font-size: 1.12rem; line-height: 1.75; color: var(--ink-soft); max-width: 56ch; margin: 0; }
|
|
7
|
-
.lede code, .panel p code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.35em; }
|
|
8
|
-
.cta { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin-top: 1.75rem; }
|
|
9
|
-
.button { display: inline-block; padding: 0.6rem 1.15rem; border-radius: var(--radius-m); background: var(--brand); border: 1px solid var(--brand); color: var(--brand-ink); font-weight: 600; text-decoration: none; transition: opacity 0.15s ease; }
|
|
10
|
-
.button:hover { opacity: 0.88; text-decoration: none; }
|
|
11
|
-
.button-ghost { display: inline-block; padding: 0.6rem 1.15rem; border-radius: var(--radius-m); border: 1px solid var(--line); color: var(--ink); font-weight: 600; text-decoration: none; background: var(--paper); transition: border-color 0.15s ease, color 0.15s ease; }
|
|
12
|
-
.button-ghost:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
|
|
13
|
-
.panel { margin-top: 2.5rem; border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.5rem 1.75rem; background: var(--paper); box-shadow: var(--shadow-1); }
|
|
14
|
-
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
|
|
15
|
-
.panel-head h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.01em; }
|
|
16
|
-
.panel > p { color: var(--ink-soft); margin: 0.35rem 0 1.25rem; max-width: 60ch; }
|
|
17
|
-
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
|
|
18
|
-
.card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.15rem; background: var(--surface); }
|
|
19
|
-
.card h3 { margin: 0.6rem 0 0.35rem; font-size: 1rem; }
|
|
20
|
-
.card p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.6; }
|
|
21
|
-
a { color: var(--brand); text-decoration: none; }
|
|
22
|
-
a:hover { text-decoration: underline; }
|
|
23
|
-
|
|
1
|
+
/* The page-home light root's box: a custom element is inline by default and
|
|
2
|
+
the host tag is not authored markup, so no utility can carry it. */
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
@@ -2,130 +2,153 @@
|
|
|
2
2
|
* Home page element — the showcase landing page (static prerendered, the
|
|
3
3
|
* default renderIntent mode).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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/).
|
|
5
|
+
* The compiled grammar lowers one root per render, so the page returns a
|
|
6
|
+
* single content wrapper; the header/footer chrome lives in the
|
|
7
|
+
* auto-registered layout (app/layout.tsx), which projects this render into its
|
|
8
|
+
* default slot. Presentation is authored as Tailwind utilities in the markup
|
|
9
|
+
* (the badge spans name each section's client cost); the one rule in
|
|
10
|
+
* `static styles` is the root's own box, which has no markup to carry it. The
|
|
11
|
+
* two island hosts (<my-counter>, <live-timer>) are expanded by the generated
|
|
12
|
+
* server entry through the islands' own compiled classes.
|
|
16
13
|
*/
|
|
17
|
-
import { element, OpenElement } from
|
|
18
|
-
import homePageStyles from
|
|
19
|
-
import badgeStyles from './badges.css';
|
|
20
|
-
import siteChromeStyles from './site-chrome.css';
|
|
14
|
+
import { element, OpenElement } from "@openelement/element";
|
|
15
|
+
import homePageStyles from "./page-home.css";
|
|
21
16
|
|
|
22
|
-
@element(
|
|
17
|
+
@element("index-page", { root: "light" })
|
|
23
18
|
export default class HomePage extends OpenElement {
|
|
24
|
-
static override styles = [homePageStyles
|
|
19
|
+
static override styles = [homePageStyles];
|
|
25
20
|
|
|
26
21
|
render() {
|
|
27
22
|
// Single root element: the compiled grammar lowers one root per render.
|
|
28
23
|
return (
|
|
29
|
-
<div class=
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
<div class="page-content">
|
|
25
|
+
<section class="pt-10 pb-4">
|
|
26
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-ok/35 bg-ok/8 px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-ok uppercase">
|
|
27
|
+
static · 0 KB JS
|
|
28
|
+
</span>
|
|
29
|
+
<p class="m-0 text-[0.78rem] font-semibold tracking-[0.14em] text-brand uppercase">
|
|
30
|
+
openElement starter
|
|
31
|
+
</p>
|
|
32
|
+
<h1 class="mt-3 mb-4 max-w-[22ch] text-[clamp(2.2rem,6vw,3.2rem)] leading-[1.1] font-bold tracking-[-0.02em]">
|
|
33
|
+
Rendered before JavaScript arrives
|
|
34
|
+
</h1>
|
|
35
|
+
<p class="m-0 max-w-[56ch] text-[1.12rem] leading-[1.75] text-ink-soft">
|
|
36
|
+
Every page here is prerendered HTML. JavaScript loads only where a section is
|
|
37
|
+
interactive — the badges below name the cost of each block. Edit{" "}
|
|
38
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
39
|
+
app/components/page-home.tsx
|
|
40
|
+
</code>{" "}
|
|
41
|
+
to make it yours.
|
|
42
|
+
</p>
|
|
43
|
+
<div class="mt-7 flex flex-wrap items-center gap-3">
|
|
44
|
+
<a
|
|
45
|
+
class="inline-block rounded-(--radius-m) border border-brand bg-brand px-[1.15rem] py-[0.6rem] font-semibold text-brand-ink no-underline transition-opacity duration-150 ease-out hover:opacity-[0.88] hover:no-underline"
|
|
46
|
+
href="/about"
|
|
47
|
+
>
|
|
48
|
+
How it works
|
|
49
|
+
</a>
|
|
50
|
+
<a
|
|
51
|
+
class="inline-block rounded-(--radius-m) border border-line bg-paper px-[1.15rem] py-[0.6rem] font-semibold text-ink no-underline transition-[border-color,color] duration-150 ease-out hover:border-brand hover:text-brand hover:no-underline"
|
|
52
|
+
href="https://openelement.org"
|
|
53
|
+
>
|
|
54
|
+
Read the docs
|
|
34
55
|
</a>
|
|
35
|
-
<nav>
|
|
36
|
-
<a href='/'>Home</a>
|
|
37
|
-
<a href='/about'>About</a>
|
|
38
|
-
<a href='/api/ping'>API</a>
|
|
39
|
-
</nav>
|
|
40
56
|
</div>
|
|
41
|
-
</
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
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>
|
|
57
|
+
</section>
|
|
58
|
+
<section class="mt-10 rounded-(--radius-l) border border-line bg-paper px-7 py-6 shadow-(--shadow-1)">
|
|
59
|
+
<div class="mb-2 flex flex-wrap items-baseline justify-between gap-4">
|
|
60
|
+
<h2 class="m-0 text-[1.3rem] tracking-[-0.01em]">Interactive island</h2>
|
|
61
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-brand/40 bg-brand-soft px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-brand uppercase">
|
|
62
|
+
island · hydrates on idle
|
|
63
|
+
</span>
|
|
64
|
+
</div>
|
|
65
|
+
<p class="mt-[0.35rem] mb-5 max-w-[60ch] text-ink-soft">
|
|
66
|
+
The counter is a compiled island (
|
|
67
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
68
|
+
app/islands/my-counter.tsx
|
|
69
|
+
</code>
|
|
70
|
+
): the server renders its markup, the browser hydrates it when idle.
|
|
71
|
+
</p>
|
|
72
|
+
<my-counter></my-counter>
|
|
73
|
+
</section>
|
|
74
|
+
<section class="mt-10 rounded-(--radius-l) border border-line bg-paper px-7 py-6 shadow-(--shadow-1)">
|
|
75
|
+
<div class="mb-2 flex flex-wrap items-baseline justify-between gap-4">
|
|
76
|
+
<h2 class="m-0 text-[1.3rem] tracking-[-0.01em]">Live stats</h2>
|
|
77
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-brand/40 bg-brand-soft px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-brand uppercase">
|
|
78
|
+
island · client-only
|
|
79
|
+
</span>
|
|
80
|
+
</div>
|
|
81
|
+
<p class="mt-[0.35rem] mb-5 max-w-[60ch] text-ink-soft">
|
|
82
|
+
Elapsed time on this page (
|
|
83
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
84
|
+
app/islands/live-timer.tsx
|
|
85
|
+
</code>
|
|
86
|
+
) renders only in the browser — a live clock has nothing meaningful to prerender, so the
|
|
87
|
+
island ships{" "}
|
|
88
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
89
|
+
ssr: false
|
|
90
|
+
</code>
|
|
91
|
+
.
|
|
92
|
+
</p>
|
|
93
|
+
<live-timer></live-timer>
|
|
94
|
+
</section>
|
|
95
|
+
<section class="mt-10 rounded-(--radius-l) border border-line bg-paper px-7 py-6 shadow-(--shadow-1)">
|
|
96
|
+
<div class="mb-2 flex flex-wrap items-baseline justify-between gap-4">
|
|
97
|
+
<h2 class="m-0 text-[1.3rem] tracking-[-0.01em]">The architecture</h2>
|
|
98
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-ok/35 bg-ok/8 px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-ok uppercase">
|
|
99
|
+
static · 0 KB JS
|
|
100
|
+
</span>
|
|
127
101
|
</div>
|
|
128
|
-
|
|
102
|
+
<p class="mt-[0.35rem] mb-5 max-w-[60ch] text-ink-soft">
|
|
103
|
+
This section — like the hero above — is plain prerendered HTML and CSS. No framework
|
|
104
|
+
script runs it.
|
|
105
|
+
</p>
|
|
106
|
+
<ul class="m-0 grid list-none grid-cols-[repeat(auto-fit,minmax(15rem,1fr))] gap-4 p-0">
|
|
107
|
+
<li class="rounded-(--radius-m) border border-line bg-surface px-[1.15rem] py-4">
|
|
108
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-ok/35 bg-ok/8 px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-ok uppercase">
|
|
109
|
+
static
|
|
110
|
+
</span>
|
|
111
|
+
<h3 class="mt-[0.6rem] mb-[0.35rem] text-[1rem]">Prerendered pages</h3>
|
|
112
|
+
<p class="m-0 text-[0.9rem] leading-[1.6] text-ink-soft">
|
|
113
|
+
Routes under{" "}
|
|
114
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
115
|
+
app/routes/
|
|
116
|
+
</code>{" "}
|
|
117
|
+
compile to static HTML at build time (SSG) and keep their HTTP cache semantics.
|
|
118
|
+
</p>
|
|
119
|
+
</li>
|
|
120
|
+
<li class="rounded-(--radius-m) border border-line bg-surface px-[1.15rem] py-4">
|
|
121
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-brand/40 bg-brand-soft px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-brand uppercase">
|
|
122
|
+
island
|
|
123
|
+
</span>
|
|
124
|
+
<h3 class="mt-[0.6rem] mb-[0.35rem] text-[1rem]">Islands where needed</h3>
|
|
125
|
+
<p class="m-0 text-[0.9rem] leading-[1.6] text-ink-soft">
|
|
126
|
+
Interactive pieces live in{" "}
|
|
127
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
128
|
+
app/islands/
|
|
129
|
+
</code>{" "}
|
|
130
|
+
and hydrate on the strategy each one declares — idle, load, visible, or client-only.
|
|
131
|
+
</p>
|
|
132
|
+
</li>
|
|
133
|
+
<li class="rounded-(--radius-m) border border-line bg-surface px-[1.15rem] py-4">
|
|
134
|
+
<span class="inline-flex items-center gap-[0.4em] rounded-full border border-ok/35 bg-ok/8 px-[0.65rem] py-[0.2rem] text-[0.72rem] font-semibold tracking-[0.04em] text-ok uppercase">
|
|
135
|
+
static
|
|
136
|
+
</span>
|
|
137
|
+
<h3 class="mt-[0.6rem] mb-[0.35rem] text-[1rem]">Platform APIs</h3>
|
|
138
|
+
<p class="m-0 text-[0.9rem] leading-[1.6] text-ink-soft">
|
|
139
|
+
Server routes (
|
|
140
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
141
|
+
app/routes/api/
|
|
142
|
+
</code>
|
|
143
|
+
) are plain{" "}
|
|
144
|
+
<code class="rounded-[5px] border border-line bg-surface px-[0.35em] py-[0.08em] font-mono text-[0.85em]">
|
|
145
|
+
Request → Response
|
|
146
|
+
</code>{" "}
|
|
147
|
+
handlers — WinterCG-shaped, no framework runtime attached.
|
|
148
|
+
</p>
|
|
149
|
+
</li>
|
|
150
|
+
</ul>
|
|
151
|
+
</section>
|
|
129
152
|
</div>
|
|
130
153
|
);
|
|
131
154
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
1
|
+
/* The chrome shadow host's box; the bars, brand and nav links are authored
|
|
2
|
+
as Tailwind utilities in layout.tsx. */
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|