@openelement/create 1.0.0-alpha.1 → 1.0.0-alpha.10
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 +90 -24
- package/package.json +15 -4
- package/src/cli.d.ts +1 -1
- package/src/cli.js +122 -65
- package/src/install-command.d.ts +50 -0
- package/src/install-command.js +52 -0
- package/src/template-builder.js +128 -174
- package/src/version.js +22 -6
- package/templates/README.tmpl +52 -25
- package/templates/app/components/page-blog-welcome.tsx.tmpl +1 -1
- package/templates/app/components/page-home.tsx.tmpl +1 -1
- package/templates/app/components/page-styles.ts.tmpl +21 -64
- package/templates/app/head.tsx.tmpl +42 -0
- package/templates/app/islands/app-shell.tsx.tmpl +36 -11
- package/templates/app/islands/my-counter.tsx.tmpl +19 -2
- package/templates/app/islands/only-ticker.tsx.tmpl +19 -2
- package/templates/app/styles/tokens.css +57 -0
- package/templates/gitignore.tmpl +1 -0
- package/templates/openelement.config.ts.tmpl +31 -0
- package/templates/package.json.tmpl +24 -1
- package/templates/tailwind/theme.css +108 -0
- package/templates/tailwind/vite.config.ts.tmpl +38 -0
- package/templates/tsconfig.json.tmpl +15 -0
- package/templates/vite.config.ts.tmpl +6 -32
- package/templates/deno.json.tmpl +0 -25
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* app/head.tsx — the starter's structural document-head content.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is DATA: the framework validates attribute names and URL
|
|
5
|
+
* values, escapes every attribute, and serializes the tags into the document
|
|
6
|
+
* <head>. The array is emitted in the order written, so this file is the head
|
|
7
|
+
* order. Delete the file and the starter still builds — it is a convention, not
|
|
8
|
+
* a requirement.
|
|
9
|
+
*
|
|
10
|
+
* Entries take one of three shapes:
|
|
11
|
+
* { meta: { name, content } } one <meta> tag
|
|
12
|
+
* { link: { rel, href, ... } } one <link> tag (rel and href are required)
|
|
13
|
+
* { style: 'css text' } one inline <style> block
|
|
14
|
+
*
|
|
15
|
+
* The module is compiled by the build, so it can import CSS by URL
|
|
16
|
+
* (`import css from './site.css?raw'`) and pull constants from local modules.
|
|
17
|
+
* It must not use host APIs (no Deno, no Node): its output is a build artifact,
|
|
18
|
+
* so a runtime read would make the document depend on the build machine.
|
|
19
|
+
*
|
|
20
|
+
* `head` in openelement.config.ts already covers the title, description,
|
|
21
|
+
* favicon and the og:/twitter: pairs; `head.scripts` / `head.stylesheets`
|
|
22
|
+
* cover external scripts and stylesheets. This file is for what neither can
|
|
23
|
+
* express — here, 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.
|
|
26
|
+
*/
|
|
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
|
+
// Declaring the color scheme the starter supports lets the browser pick the
|
|
40
|
+
// right native form/scrollbar palette before any CSS is parsed.
|
|
41
|
+
{ meta: { name: 'color-scheme', content: 'dark light' } },
|
|
42
|
+
];
|
|
@@ -1,29 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* app-shell — compiled layout island
|
|
2
|
+
* app-shell — compiled layout island.
|
|
3
3
|
*
|
|
4
|
-
* The server entry renders this class around every page
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* The server entry renders this class around every page, registered by the
|
|
5
|
+
* `app/islands/app-shell.tsx` file convention; `openelement.config.ts`
|
|
6
|
+
* overrides it with `appShell: { import, props }`. The entry injects the page
|
|
7
|
+
* host before the closing tag and the static <slot> projects it. Deleting
|
|
8
|
+
* this file is supported: pages still render, just without the shell chrome.
|
|
9
|
+
* The shell is also a 'load' island: the compiled style scope applies
|
|
10
|
+
* `static styles` when the element activates client-side (the serializer
|
|
11
|
+
* never inlines styles into DSD), so the shell chrome is styled as soon as
|
|
12
|
+
* it hydrates.
|
|
10
13
|
*
|
|
11
14
|
* The compiler grammar v1 has no data-driven per-item attribute slots, so the
|
|
12
|
-
* header nav is static authoring here — edit the links below directly
|
|
13
|
-
* (the vite.config content.nav headerNav indirection of 0.43 is gone).
|
|
15
|
+
* header nav is static authoring here — edit the links below directly.
|
|
14
16
|
*/
|
|
15
17
|
import { defineIslandConfig } from '@openelement/router';
|
|
16
18
|
import { element, OpenElement, property } from '@openelement/element';
|
|
17
|
-
import {
|
|
19
|
+
import { compiledStyle } from '../components/page-styles.ts';
|
|
18
20
|
|
|
19
21
|
export const openElement = defineIslandConfig({ hydrate: 'load', ssr: true, dsd: true });
|
|
20
22
|
|
|
23
|
+
// Same-module style sheet: the compiler erases this const from
|
|
24
|
+
// the island module and emits its bytes as the component's `.oe-style.css`
|
|
25
|
+
// asset. Cross-module sheet imports fail closed (OEC9028).
|
|
26
|
+
const shellStyles = [
|
|
27
|
+
compiledStyle(`
|
|
28
|
+
:host { display: block; min-height: 100vh; }
|
|
29
|
+
header { border-bottom: 1px solid var(--line); }
|
|
30
|
+
.bar { max-width: 740px; margin: 0 auto; padding: 1.15rem 1.25rem; display: flex; justify-content: space-between; align-items: baseline; }
|
|
31
|
+
.brand { font-family: var(--font-serif); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--ink); }
|
|
32
|
+
.brand:hover { text-decoration: none; color: var(--brand); }
|
|
33
|
+
nav { display: flex; gap: 1.5rem; }
|
|
34
|
+
nav a { color: var(--ink-2); font-size: 0.95rem; font-weight: 500; }
|
|
35
|
+
nav a:hover { color: var(--brand); text-decoration: none; }
|
|
36
|
+
main { max-width: 740px; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
|
|
37
|
+
footer { border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.85rem; }
|
|
38
|
+
.foot { max-width: 740px; margin: 0 auto; padding: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; }
|
|
39
|
+
a { color: var(--brand); text-decoration: none; }
|
|
40
|
+
a:hover { text-decoration: underline; }
|
|
41
|
+
`),
|
|
42
|
+
];
|
|
43
|
+
|
|
21
44
|
@element('app-shell', { root: 'shadow-open' })
|
|
22
45
|
export default class AppShell extends OpenElement {
|
|
23
46
|
static override styles = shellStyles;
|
|
24
47
|
|
|
25
48
|
/**
|
|
26
|
-
* Filled from appShell.props
|
|
49
|
+
* Filled from `appShell.props` at render time; a convention app-shell
|
|
50
|
+
* carries no props, so set them in openelement.config.ts to change this
|
|
51
|
+
* (appShell: { import: './app/islands/app-shell.tsx', props: { siteName } }).
|
|
27
52
|
* Attribute-backed (site-name) so the SSR'd value survives the client claim:
|
|
28
53
|
* attribute: false properties reset to their compiled default on claim and
|
|
29
54
|
* the drift check would fail closed.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* my-counter — minimal counter island (
|
|
2
|
+
* my-counter — minimal 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
|
|
@@ -7,10 +7,27 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { defineIslandConfig } from '@openelement/router';
|
|
9
9
|
import { element, OpenElement, property } from '@openelement/element';
|
|
10
|
-
import {
|
|
10
|
+
import { compiledStyle } from '../components/page-styles.ts';
|
|
11
11
|
|
|
12
12
|
export const openElement = defineIslandConfig({ hydrate: 'idle', ssr: true, dsd: true });
|
|
13
13
|
|
|
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
|
+
|
|
14
31
|
@element('my-counter', { root: 'shadow-open' })
|
|
15
32
|
export default class MyCounter extends OpenElement {
|
|
16
33
|
static override styles = counterStyles;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* only-ticker — client-only island (
|
|
2
|
+
* only-ticker — client-only island (compiled).
|
|
3
3
|
*
|
|
4
4
|
* hydrate: 'only' with ssr: false renders nothing on the server; the client
|
|
5
5
|
* entry creates the DOM fresh from the compiled Part Program and binds the
|
|
@@ -8,10 +8,27 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { defineIslandConfig } from '@openelement/router';
|
|
10
10
|
import { element, OpenElement, property } from '@openelement/element';
|
|
11
|
-
import {
|
|
11
|
+
import { compiledStyle } from '../components/page-styles.ts';
|
|
12
12
|
|
|
13
13
|
export const openElement = defineIslandConfig({ hydrate: 'only', ssr: false, dsd: false });
|
|
14
14
|
|
|
15
|
+
// Same-module style sheet: the compiler erases this const from
|
|
16
|
+
// the island module and emits its bytes as the component's `.oe-style.css`
|
|
17
|
+
// asset. Cross-module sheet imports fail closed (OEC9028).
|
|
18
|
+
const tickerStyles = [
|
|
19
|
+
compiledStyle(`
|
|
20
|
+
:host { display: inline-block; }
|
|
21
|
+
.ticker-row { display: inline-flex; gap: 0.75rem; align-items: center; }
|
|
22
|
+
button {
|
|
23
|
+
height: 2rem; padding: 0 0.9rem; border: 1px solid var(--line); border-radius: 6px;
|
|
24
|
+
background: #fff; color: var(--ink); font-size: 0.9rem; cursor: pointer;
|
|
25
|
+
transition: border-color 0.15s ease, color 0.15s ease;
|
|
26
|
+
}
|
|
27
|
+
button:hover { border-color: var(--brand); color: var(--brand); }
|
|
28
|
+
span { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
|
|
29
|
+
`),
|
|
30
|
+
];
|
|
31
|
+
|
|
15
32
|
@element('only-ticker', { root: 'shadow-open' })
|
|
16
33
|
export default class OnlyTicker extends OpenElement {
|
|
17
34
|
static override styles = tickerStyles;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* Design tokens + the document baseline (openElement starter).
|
|
2
|
+
*
|
|
3
|
+
* Convention, not configuration: `openelement.config.ts` inlines this file
|
|
4
|
+
* into every rendered document's <head> as <style data-oe-tokens>. Override
|
|
5
|
+
* the path with `styles: { tokens: '...' }` there; delete the file and the
|
|
6
|
+
* pages render unstyled but functional.
|
|
7
|
+
*
|
|
8
|
+
* Styling ownership: only true globals (design tokens, body baseline) live
|
|
9
|
+
* here. Each page element carries its own rules in `static styles`
|
|
10
|
+
* (`app/components/page-styles.ts`) — the server inlines them into the SSR
|
|
11
|
+
* output as a @scope(<page-tag>) style block for light roots. Islands carry
|
|
12
|
+
* their own `static styles` too.
|
|
13
|
+
*
|
|
14
|
+
* `--brand` must stay aligned with the ui package tokens (`--violet-6` in a
|
|
15
|
+
* consumer-owned design-system stylesheet).
|
|
16
|
+
*/
|
|
17
|
+
:root {
|
|
18
|
+
--paper: #faf9f6;
|
|
19
|
+
--ink: #1c1b17;
|
|
20
|
+
--ink-2: #5b594f;
|
|
21
|
+
--line: #e5e2d8;
|
|
22
|
+
--gray-0: #f8f9fa;
|
|
23
|
+
--gray-1: #f1f3f5;
|
|
24
|
+
--gray-3: #dee2e6;
|
|
25
|
+
--gray-5: #adb5bd;
|
|
26
|
+
--gray-7: #495057;
|
|
27
|
+
--gray-9: #212529;
|
|
28
|
+
--brand: #8262db;
|
|
29
|
+
--brand-2: #4f8ef7;
|
|
30
|
+
--size-1: 4px;
|
|
31
|
+
--size-2: 8px;
|
|
32
|
+
--size-3: 12px;
|
|
33
|
+
--size-4: 16px;
|
|
34
|
+
--border-size-1: 1px;
|
|
35
|
+
--radius-2: 8px;
|
|
36
|
+
--radius-3: 14px;
|
|
37
|
+
--font-sans: system-ui, -apple-system, sans-serif;
|
|
38
|
+
--font-serif: ui-serif, Georgia, 'Times New Roman', serif;
|
|
39
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
40
|
+
--font-size-0: 0.875rem;
|
|
41
|
+
--font-weight-5: 500;
|
|
42
|
+
--shadow-1: 0 1px 3px 0 rgb(0 0 0 / 0.08);
|
|
43
|
+
--shadow-2: 0 10px 28px rgb(80 70 160 / 0.12);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
body {
|
|
47
|
+
margin: 0;
|
|
48
|
+
background: var(--paper);
|
|
49
|
+
color: var(--ink);
|
|
50
|
+
font-family: var(--font-sans);
|
|
51
|
+
-webkit-font-smoothing: antialiased;
|
|
52
|
+
-moz-osx-font-smoothing: grayscale;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
::selection {
|
|
56
|
+
background: #8262db2e;
|
|
57
|
+
}
|
package/templates/gitignore.tmpl
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
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/tokens.css (inlined into every document <head>)
|
|
6
|
+
// - app shell: app/islands/app-shell.tsx (auto-registered; the file is
|
|
7
|
+
// deletable and pages still render)
|
|
8
|
+
// - document head: app/head.tsx (structural head content: meta tags, font
|
|
9
|
+
// preloads, icons, inline CSS — the entries a URL list
|
|
10
|
+
// cannot express; `head` below covers the rest)
|
|
11
|
+
// - site title: the "name" field of package.json
|
|
12
|
+
//
|
|
13
|
+
// The conventions follow `dirs`: give the three roots a shared leading
|
|
14
|
+
// directory (src/routes, src/islands, src/components) and the tokens/app-shell/
|
|
15
|
+
// head conventions resolve under that same directory (src/styles/tokens.css,
|
|
16
|
+
// src/islands/app-shell.tsx, src/head.tsx).
|
|
17
|
+
//
|
|
18
|
+
// Passing framework options inline to openElement() while this file carries
|
|
19
|
+
// options is a hard error: framework options cannot have two homes. Unknown
|
|
20
|
+
// keys are rejected with the accepted-key list.
|
|
21
|
+
import { defineConfig } from '@openelement/router';
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
head: {
|
|
25
|
+
// Titles default to the package.json "name"; this overrides the document
|
|
26
|
+
// title fallback while page routes keep their own `head: { title }`.
|
|
27
|
+
title: 'My openElement App',
|
|
28
|
+
description: 'An openElement starter application.',
|
|
29
|
+
favicon: '/openelement-mark.svg',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "${name}",
|
|
3
3
|
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
4
5
|
"type": "module",
|
|
5
|
-
"
|
|
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
|
+
"typescript": "6.0.3",
|
|
27
|
+
"vite": "${v.vite}"
|
|
28
|
+
}
|
|
6
29
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
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.
|
|
14
|
+
═══════════════════════════════════════════════════════════════════════ */
|
|
15
|
+
|
|
16
|
+
@theme {
|
|
17
|
+
/* ── semantic roles (light), over the TW4 default scale.
|
|
18
|
+
Violet-anchored roles (the starter brand reads violet); neutral
|
|
19
|
+
surfaces stay zinc so the page base keeps its near-neutral paper
|
|
20
|
+
feel. ── */
|
|
21
|
+
|
|
22
|
+
--color-background: var(--color-white);
|
|
23
|
+
--color-foreground: var(--color-zinc-950);
|
|
24
|
+
|
|
25
|
+
--color-card: var(--color-white);
|
|
26
|
+
--color-card-foreground: var(--color-zinc-950);
|
|
27
|
+
|
|
28
|
+
--color-popover: var(--color-white);
|
|
29
|
+
--color-popover-foreground: var(--color-zinc-950);
|
|
30
|
+
|
|
31
|
+
--color-primary: var(--color-violet-700);
|
|
32
|
+
--color-primary-foreground: var(--color-violet-50);
|
|
33
|
+
|
|
34
|
+
--color-secondary: var(--color-violet-100);
|
|
35
|
+
--color-secondary-foreground: var(--color-violet-900);
|
|
36
|
+
|
|
37
|
+
--color-muted: var(--color-zinc-100);
|
|
38
|
+
--color-muted-foreground: var(--color-zinc-600);
|
|
39
|
+
|
|
40
|
+
--color-accent: var(--color-violet-100);
|
|
41
|
+
--color-accent-foreground: var(--color-violet-900);
|
|
42
|
+
|
|
43
|
+
--color-destructive: var(--color-red-700);
|
|
44
|
+
--color-destructive-foreground: var(--color-white);
|
|
45
|
+
|
|
46
|
+
--color-border: var(--color-violet-200);
|
|
47
|
+
--color-input: var(--color-violet-200);
|
|
48
|
+
--color-ring: var(--color-violet-500);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Dark pairs (shadcn v4 convention; the selector matches the runtime theme
|
|
52
|
+
attribute the ui package documents). */
|
|
53
|
+
:root[data-theme='dark'],
|
|
54
|
+
:host([data-theme='dark']) {
|
|
55
|
+
--color-background: var(--color-zinc-950);
|
|
56
|
+
--color-foreground: var(--color-zinc-50);
|
|
57
|
+
|
|
58
|
+
--color-card: var(--color-zinc-900);
|
|
59
|
+
--color-card-foreground: var(--color-zinc-50);
|
|
60
|
+
|
|
61
|
+
--color-popover: var(--color-zinc-900);
|
|
62
|
+
--color-popover-foreground: var(--color-zinc-50);
|
|
63
|
+
|
|
64
|
+
--color-primary: var(--color-violet-400);
|
|
65
|
+
--color-primary-foreground: var(--color-violet-950);
|
|
66
|
+
|
|
67
|
+
--color-secondary: var(--color-zinc-800);
|
|
68
|
+
--color-secondary-foreground: var(--color-zinc-100);
|
|
69
|
+
|
|
70
|
+
--color-muted: var(--color-zinc-800);
|
|
71
|
+
--color-muted-foreground: var(--color-zinc-400);
|
|
72
|
+
|
|
73
|
+
--color-accent: var(--color-zinc-800);
|
|
74
|
+
--color-accent-foreground: var(--color-zinc-100);
|
|
75
|
+
|
|
76
|
+
--color-destructive: var(--color-red-400);
|
|
77
|
+
--color-destructive-foreground: var(--color-red-950);
|
|
78
|
+
|
|
79
|
+
--color-border: var(--color-zinc-800);
|
|
80
|
+
--color-input: var(--color-zinc-800);
|
|
81
|
+
--color-ring: var(--color-violet-400);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Forced-colors layer: every role re-seats on a system color. Values are
|
|
85
|
+
system keywords — no author color survives the forcing. */
|
|
86
|
+
@media (forced-colors: active) {
|
|
87
|
+
:root {
|
|
88
|
+
--color-background: Canvas;
|
|
89
|
+
--color-foreground: CanvasText;
|
|
90
|
+
--color-card: Canvas;
|
|
91
|
+
--color-card-foreground: CanvasText;
|
|
92
|
+
--color-popover: Canvas;
|
|
93
|
+
--color-popover-foreground: CanvasText;
|
|
94
|
+
--color-primary: ButtonText;
|
|
95
|
+
--color-primary-foreground: Canvas;
|
|
96
|
+
--color-secondary: ButtonFace;
|
|
97
|
+
--color-secondary-foreground: ButtonText;
|
|
98
|
+
--color-muted: Canvas;
|
|
99
|
+
--color-muted-foreground: GrayText;
|
|
100
|
+
--color-accent: ButtonFace;
|
|
101
|
+
--color-accent-foreground: ButtonText;
|
|
102
|
+
--color-destructive: CanvasText;
|
|
103
|
+
--color-destructive-foreground: Canvas;
|
|
104
|
+
--color-border: CanvasText;
|
|
105
|
+
--color-input: CanvasText;
|
|
106
|
+
--color-ring: Highlight;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { applyTailwindPreset, openElement } from '@openelement/router/vite';
|
|
2
|
+
import { defineConfig, type Plugin, type ResolvedConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
// Vite configuration only. Framework options live in openelement.config.ts —
|
|
5
|
+
// the plugin reads that file itself, so the plugin call stays
|
|
6
|
+
// `openElement()`. The JSX transform is owned by the plugin's compiler pass
|
|
7
|
+
// (TSX → Part Program); nothing JSX-related needs configuring here.
|
|
8
|
+
//
|
|
9
|
+
// Tailwind role sheet (scaffolded ON): the roles in app/styles/theme.css are
|
|
10
|
+
// compiled into the preset's linked, layer-ordered bundle at build time and
|
|
11
|
+
// referenced from every rendered page with <link rel="stylesheet">. The role
|
|
12
|
+
// file is declared relative to the preset's build-time staging entry (it is
|
|
13
|
+
// @import-ed from .openElement/tailwind-preset/), which is why the path
|
|
14
|
+
// climbs out of that directory. `pnpm dev` serves the tokens convention
|
|
15
|
+
// (app/styles/tokens.css); the compiled bundle exists in the build output.
|
|
16
|
+
// No node: imports here on purpose — the starter's `check` surface has no
|
|
17
|
+
// @types/node, and vite resolves `root` to an absolute path already.
|
|
18
|
+
|
|
19
|
+
function tailwindPreset(): Plugin {
|
|
20
|
+
let config: ResolvedConfig | undefined;
|
|
21
|
+
return {
|
|
22
|
+
name: 'starter:tailwind-preset',
|
|
23
|
+
apply: 'build',
|
|
24
|
+
configResolved(resolved) {
|
|
25
|
+
config = resolved;
|
|
26
|
+
},
|
|
27
|
+
async closeBundle() {
|
|
28
|
+
if (!config || config.command !== 'build') return;
|
|
29
|
+
const outDir = `${config.root}/${config.build.outDir || 'dist'}`;
|
|
30
|
+
await applyTailwindPreset({ theme: ['../../app/styles/theme.css'] }, config, outDir);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
base: '/',
|
|
37
|
+
plugins: [...openElement(), tailwindPreset()],
|
|
38
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
"strict": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"allowImportingTsExtensions": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["app", "vite.config.ts", "openelement.config.ts"]
|
|
15
|
+
}
|
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
import { openElement } from '@openelement/router/vite';
|
|
2
2
|
import { defineConfig } from 'vite';
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
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 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.
|
|
19
8
|
export default defineConfig({
|
|
20
|
-
|
|
21
|
-
|
|
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
|
});
|
package/templates/deno.json.tmpl
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"imports": {
|
|
3
|
-
"@hono/vite-dev-server": "npm:@hono/vite-dev-server@^0.25.3",
|
|
4
|
-
"@openelement/router": "npm:@openelement/router@${v.router}",
|
|
5
|
-
"@openelement/router/vite": "npm:@openelement/router@${v.router}/vite",
|
|
6
|
-
"@openelement/router/nitro-mount": "npm:@openelement/router@${v.router}/nitro-mount",
|
|
7
|
-
"@openelement/element": "npm:@openelement/element@${v.element}",
|
|
8
|
-
"@openelement/element/build-utils": "npm:@openelement/element@${v.element}/build-utils",
|
|
9
|
-
"@openelement/element/jsx-dev-runtime": "npm:@openelement/element@${v.element}/jsx-dev-runtime",
|
|
10
|
-
"@openelement/element/jsx-runtime": "npm:@openelement/element@${v.element}/jsx-runtime",
|
|
11
|
-
"hono": "npm:hono@^4.12",
|
|
12
|
-
"vite": "npm:vite@${v.vite}"
|
|
13
|
-
},
|
|
14
|
-
"nodeModulesDir": "auto",
|
|
15
|
-
"minimumDependencyAge": 0,
|
|
16
|
-
"tasks": {
|
|
17
|
-
"dev": "deno run --config deno.json --allow-read --allow-write --allow-env --allow-net --allow-run --allow-sys --allow-ffi npm:vite@${v.vite}",
|
|
18
|
-
"check": "deno check --config deno.json app/ vite.config.ts",
|
|
19
|
-
"test": "deno test --config deno.json --permit-no-files",
|
|
20
|
-
"build": "deno run --config deno.json --allow-read --allow-write --allow-net --allow-env --allow-ffi --allow-sys --allow-run npm:@openelement/router@${v.router}/cli/build",
|
|
21
|
-
"start": "deno run --config deno.json --allow-read --allow-write --allow-net --allow-env --allow-ffi --allow-sys --allow-run npm:@openelement/router@${v.router}/cli/start",
|
|
22
|
-
"preview": "deno run --config deno.json --allow-read --allow-write --allow-net --allow-env --allow-ffi --allow-sys --allow-run npm:@openelement/router@${v.router}/cli/start --mode=preview"
|
|
23
|
-
},
|
|
24
|
-
"compilerOptions": { "lib": ["ES2022", "DOM", "DOM.Iterable"], "jsx": "react-jsx", "jsxImportSource": "@openelement/element" }
|
|
25
|
-
}
|