[repo] Workspace: Scaffold Phase 0 with schema, engine, content, ui and the PWA shell
pnpm + turbo workspace with the commands from CLAUDE.md §3. The contracts from §6 as JSON Schemas with generated types; localDay as the one place a day is computed; the forbidden-word list shared by lint:copy and the library validator, with 13 negative fixtures; a Svelte 5 PWA shell built under /Rosea/ with a meta CSP. E2E and offline suites run against the built bundle; the offline one closes the server rather than emulating. Analysis: .agents/features/phase0-workspace.md
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@rosea/ui",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Svelte components, tokens and copy/. Renders what the engine returns; decides nothing.",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"svelte": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"svelte": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
},
|
||||
"./copy": "./src/copy/en.ts",
|
||||
"./tokens.css": "./src/tokens.css"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "svelte-check --threshold error --output human",
|
||||
"typecheck": "svelte-check --threshold error --output human",
|
||||
"test": "vitest run --reporter=verbose"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rosea/schema": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"svelte": "^5.56.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "5.1.1",
|
||||
"@testing-library/svelte": "5.4.2",
|
||||
"jsdom": "25.0.1",
|
||||
"svelte": "5.56.9",
|
||||
"svelte-check": "4.7.6",
|
||||
"typescript": "5.9.3",
|
||||
"vite": "6.4.3",
|
||||
"vitest": "3.2.7"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<script lang="ts">
|
||||
import { PRODUCT_NAME } from '@rosea/schema';
|
||||
import { en } from './copy/en.js';
|
||||
</script>
|
||||
|
||||
<main class="shell">
|
||||
<h1>{PRODUCT_NAME}</h1>
|
||||
<p>{en.shell.preparing}</p>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.shell {
|
||||
min-height: 100dvh;
|
||||
display: grid;
|
||||
place-content: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-4);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 400;
|
||||
font-size: clamp(2rem, 8vw, 3.5rem);
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--rose);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Every string a player reads lives under copy/ (CLAUDE.md §7) and passes
|
||||
* `pnpm lint:copy`. Plain English; Czech arrives as `cs.ts` with the same shape.
|
||||
*
|
||||
* The product name is not repeated here: it comes from @rosea/schema, one of the
|
||||
* three places it may live.
|
||||
*/
|
||||
export const en = {
|
||||
shell: {
|
||||
/** The one line on the Phase 0 page. True, calm, and asks nothing. */
|
||||
preparing: 'The garden is being prepared.'
|
||||
}
|
||||
} as const;
|
||||
|
||||
export type Copy = typeof en;
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as Shell } from './Shell.svelte';
|
||||
export { en, type Copy } from './copy/en.js';
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Design tokens. Placeholders until docs/ART.md sets the palette: they exist so
|
||||
* components reference tokens from the first commit, never raw colours.
|
||||
* System fonts only: nothing is fetched from a CDN (CLAUDE.md §4).
|
||||
*/
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
|
||||
--paper: #fbf6f1;
|
||||
--ink: #2b2324;
|
||||
--ink-soft: #6b5d5e;
|
||||
--rose: #b4485e;
|
||||
|
||||
--font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
--font-display: Georgia, 'Times New Roman', serif;
|
||||
|
||||
--space-1: 0.25rem;
|
||||
--space-2: 0.5rem;
|
||||
--space-3: 1rem;
|
||||
--space-4: 1.5rem;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--paper: #1d1819;
|
||||
--ink: #f1e8e6;
|
||||
--ink-soft: #b8a9a8;
|
||||
--rose: #e8899b;
|
||||
}
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--paper);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-body);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
@@ -0,0 +1,26 @@
|
||||
import { PRODUCT_NAME } from '@rosea/schema';
|
||||
import { cleanup, render, screen } from '@testing-library/svelte';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import Shell from '../src/Shell.svelte';
|
||||
import { en } from '../src/copy/en.js';
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe('Shell', () => {
|
||||
it('names the product in the page heading, from the schema constant', () => {
|
||||
render(Shell);
|
||||
expect(screen.getByRole('heading', { level: 1 }).textContent).toBe(PRODUCT_NAME);
|
||||
});
|
||||
|
||||
it('shows its one line from copy/, and no control to press', () => {
|
||||
render(Shell);
|
||||
expect(screen.getByText(en.shell.preparing)).toBeTruthy();
|
||||
expect(screen.queryAllByRole('button')).toEqual([]);
|
||||
expect(screen.queryAllByRole('link')).toEqual([]);
|
||||
});
|
||||
|
||||
it('is a landmark, so a screen reader can find it', () => {
|
||||
render(Shell);
|
||||
expect(screen.getByRole('main')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": ["node", "svelte"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.svelte", "test/**/*.ts", "vitest.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [svelte()],
|
||||
// Svelte resolves its client build only under the `browser` condition.
|
||||
resolve: { conditions: ['browser'] },
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
include: ['test/**/*.test.ts']
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user