@somewhere-cloud/cli 0.38.87 → 0.38.89

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 (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/commands/cron.js +5 -1
  3. package/dist/commands/cron.js.map +1 -1
  4. package/dist/commands/deploy.js +16 -5
  5. package/dist/commands/deploy.js.map +1 -1
  6. package/dist/commands/dev.d.ts +9 -0
  7. package/dist/commands/dev.js +354 -97
  8. package/dist/commands/dev.js.map +1 -1
  9. package/dist/commands/email.js +17 -0
  10. package/dist/commands/email.js.map +1 -1
  11. package/dist/commands/promote.d.ts +14 -0
  12. package/dist/commands/promote.js +41 -0
  13. package/dist/commands/promote.js.map +1 -1
  14. package/dist/lib/app-test.d.ts +125 -0
  15. package/dist/lib/app-test.js +267 -0
  16. package/dist/lib/app-test.js.map +1 -0
  17. package/dist/lib/form-auth.d.ts +83 -0
  18. package/dist/lib/form-auth.js +350 -0
  19. package/dist/lib/form-auth.js.map +1 -0
  20. package/dist/lib/init-agent-guide.d.ts +5 -2
  21. package/dist/lib/init-agent-guide.js +13 -19
  22. package/dist/lib/init-agent-guide.js.map +1 -1
  23. package/dist/lib/init-feature-template.js +10 -10
  24. package/dist/lib/init-green-template.js +0 -3
  25. package/dist/lib/init-green-template.js.map +1 -1
  26. package/dist/lib/init-test-template.d.ts +1 -1
  27. package/dist/lib/init-test-template.js +55 -139
  28. package/dist/lib/init-test-template.js.map +1 -1
  29. package/dist/lib/init-ui-kit.d.ts +2 -2
  30. package/dist/lib/init-ui-kit.js +2 -2
  31. package/dist/lib/playwright-fixtures.d.ts +10 -45
  32. package/dist/lib/playwright-fixtures.js +10 -300
  33. package/dist/lib/playwright-fixtures.js.map +1 -1
  34. package/dist/lib/preview-record.d.ts +54 -0
  35. package/dist/lib/preview-record.js +78 -0
  36. package/dist/lib/preview-record.js.map +1 -0
  37. package/dist/lib/test-reporter.d.ts +0 -1
  38. package/dist/lib/test-reporter.js +19 -71
  39. package/dist/lib/test-reporter.js.map +1 -1
  40. package/dist/lib/test-run.js +8 -27
  41. package/dist/lib/test-run.js.map +1 -1
  42. package/dist/script.d.ts +3 -0
  43. package/dist/script.js +4 -0
  44. package/dist/script.js.map +1 -0
  45. package/npm-shrinkwrap.json +2 -2
  46. package/package.json +6 -2
  47. package/runtime/DECLARED-DATA-VENDOR.json +1 -1
  48. package/dist/lib/test-inputs.d.ts +0 -23
  49. package/dist/lib/test-inputs.js +0 -42
  50. package/dist/lib/test-inputs.js.map +0 -1
  51. package/dist/lib/test-ledger.d.ts +0 -91
  52. package/dist/lib/test-ledger.js +0 -334
  53. package/dist/lib/test-ledger.js.map +0 -1
@@ -2133,7 +2133,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
2133
2133
  <p className={notes.notice?.tone === 'error' ? 'note-status error' : 'note-status'} role="status">{notes.notice?.text ?? ''}</p>
2134
2134
  </form>
2135
2135
 
2136
- <section aria-labelledby="notes-title" aria-busy={notes.status === 'loading'}>
2136
+ <section aria-labelledby="notes-title" aria-busy={notes.status === 'loading'} data-sw-data={notes.status}>
2137
2137
  <h2 id="notes-title" className="section-title">Your notes</h2>
2138
2138
  {notes.status === 'loading' ? <p className="muted" role="status">Loading notes…</p> : null}
2139
2139
  {notes.status === 'error' ? (
@@ -2298,7 +2298,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
2298
2298
  {editing ? <button type="button" onClick={notes.cancelEdit}>Cancel</button> : null}
2299
2299
  <p role="status">{notes.notice?.text ?? ''}</p>
2300
2300
  </form>
2301
- <h2>Your notes</h2>
2301
+ <h2 data-sw-data={notes.status}>Your notes</h2>
2302
2302
  {notes.status === 'loading' ? <p role="status">Loading notes…</p> : null}
2303
2303
  {notes.status === 'error' ? <Alert action={<button type="button" onClick={notes.reload}>Try again</button>}>{notes.loadError}</Alert> : null}
2304
2304
  {notes.status === 'ready' && notes.notes.length === 0 ? <EmptyState title="No notes yet." /> : null}
@@ -3196,14 +3196,14 @@ export function createFeatureTemplate(selection, options) {
3196
3196
  ...starterTests({ privateData }),
3197
3197
  { path: '.gitignore', content: 'node_modules\ndist\nbuild\n.env\n# Generated from db/schema.ts by somewhere typecheck, dev and deploy.\n__somewhere_data.d.ts\n__somewhere_files.d.ts\n' },
3198
3198
  { path: 'AGENTS.md', content: INIT_AGENTS_MD.replace(/## Getting started[^]*?After edits:/, `## Testing
3199
- tests/account, phone and access specs are working journeys: adapt them, one journey per test.
3200
- Each test makes its own people at once (Promise.all of newUser()) and unique row values.
3201
- Run somewhere test (or somewhere deploy --test): every spec, old and new, in one run.
3202
- After fixing a test, run only what failed: somewhere test --failed. Never rerun a green suite on one release.
3203
- A pass means the checks you wrote passed; say which requirements they do not cover.
3204
- Use ready(page) for starter session readiness, or an explicit locator.
3205
- Test users are removed afterwards; rows, files and mail they created remain.
3206
- Managed users bypass signup/onboarding; test those separately if you customize them.
3199
+ Test the journeys you changed and your access boundaries with an ordinary Playwright script.
3200
+ tests/app-check.mjs is a short example to change: npx somewhere deploy && node tests/app-check.mjs
3201
+ (after a successful deploy only; one result file, .somewhere/app-check.json; the exit code is the verdict).
3202
+ Helpers from @somewhere-cloud/cli/script (import or require): signUp/signIn/signOut through your form,
3203
+ data(page, { table, operation, id, values, where }) as that person, expectRefused with a positive control,
3204
+ captureResponses, dataReady (the list has loaded), launchOptions. A rebuilt sign-in form keeps
3205
+ data-sw-auth="email", "password", "sign-up", "sign-in" on its controls, or pass { form: { … } } selectors.
3206
+ Rerun only to answer a question. A pass means the checks you wrote passed; say what they do not cover.
3207
3207
 
3208
3208
  After edits:`) },
3209
3209
  { path: 'CLAUDE.md', content: INIT_CLAUDE_MD },
@@ -1,7 +1,6 @@
1
1
  import { CLI_VERSION } from './version.js';
2
2
  import { INIT_AGENTS_MD, INIT_CLAUDE_MD } from './init-agent-guide.js';
3
3
  import { ASSET_TYPES_FILE } from './init-asset-types.js';
4
- import { starterTests } from './init-test-template.js';
5
4
  const PACKAGE_JSON = `{
6
5
  "name": "somewhere-starter",
7
6
  "private": true,
@@ -18,7 +17,6 @@ const PACKAGE_JSON = `{
18
17
  },
19
18
  "devDependencies": {
20
19
  "@somewhere-cloud/cli": "${CLI_VERSION}",
21
- "@playwright/test": "1.65.0",
22
20
  "@types/react": "19.2.2",
23
21
  "@types/react-dom": "19.2.2",
24
22
  "typescript": "5.9.3",
@@ -169,7 +167,6 @@ Deploy the raw source. The platform compiles it; do not create or deploy a
169
167
  `;
170
168
  export function createGreenTemplate() {
171
169
  return [
172
- ...starterTests({ minimal: true }),
173
170
  { path: '.gitignore', content: 'node_modules\ndist\nbuild\n.env\n# Generated from db/schema.ts by somewhere typecheck, dev and deploy.\n__somewhere_data.d.ts\n__somewhere_files.d.ts\n' },
174
171
  { path: 'AGENTS.md', content: INIT_AGENTS_MD },
175
172
  { path: 'CLAUDE.md', content: INIT_CLAUDE_MD },
@@ -1 +1 @@
1
- {"version":3,"file":"init-green-template.js","sourceRoot":"","sources":["../../src/lib/init-green-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;+BAeU,WAAW;;;;;;;;;;;CAWzC,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;CAchB,CAAC;AAEF,MAAM,SAAS,GAAG;;;CAGjB,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AAEF,MAAM,GAAG,GAAG;;;;;;;;;CASX,CAAC;AAEF,MAAM,OAAO,GAAG;;;;;;;CAOf,CAAC;AAEF,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBX,CAAC;AAEF,MAAM,IAAI,GAAG;;;;;;;;;;CAUZ,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;CAcd,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AAEF,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAClC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,yJAAyJ,EAAE;QAC1L,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE;QAC9C,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE;QAC9C,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE;QACtC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE;QAC/C,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC5C;YACE,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,oUAAoU;SAC9U;QACD,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE;QACrC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE;QACvC,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,OAAO,EAAE;QACtD,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3C,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,EAAE;QACzC,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,2EAA2E,EAAE;QACvH,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE;QACzC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE;QAC5C,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"init-green-template.js","sourceRoot":"","sources":["../../src/lib/init-green-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;+BAeU,WAAW;;;;;;;;;;CAUzC,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;CAchB,CAAC;AAEF,MAAM,SAAS,GAAG;;;CAGjB,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AAEF,MAAM,GAAG,GAAG;;;;;;;;;CASX,CAAC;AAEF,MAAM,OAAO,GAAG;;;;;;;CAOf,CAAC;AAEF,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBX,CAAC;AAEF,MAAM,IAAI,GAAG;;;;;;;;;;CAUZ,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;CAcd,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AAEF,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,yJAAyJ,EAAE;QAC1L,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE;QAC9C,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE;QAC9C,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE;QACtC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE;QAC/C,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC5C;YACE,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,oUAAoU;SAC9U;QACD,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE;QACrC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE;QACvC,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,OAAO,EAAE;QACtD,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3C,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,EAAE;QACzC,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,2EAA2E,EAAE;QACvH,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE;QACzC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE;QAC5C,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { InitScaffoldFile } from './init-scaffold.js';
2
+ /** The starter's example script (auth starters only; the minimal starter has no sign-in form). */
2
3
  export declare function starterTests(options?: {
3
4
  privateData?: boolean;
4
- minimal?: boolean;
5
5
  }): InitScaffoldFile[];
@@ -1,145 +1,61 @@
1
- // The starter's journeys: small, independent specs an agent adapts instead of writing from nothing.
2
- // Each one makes its own people (at the same time, with Promise.all), shares nothing with the others,
3
- // runs alone or in any order, and waits on what the app does, never on a fixed sleep.
4
- const FORM_ACCOUNT = `import { test, expect } from '@somewhere-cloud/cli/testing';
5
-
6
- // A visitor signs up through the app's own form, signs out and signs back in.
7
- test('sign up, sign out and sign back in', async ({ page, signUp, signOut, signIn }) => {
8
- const person = await signUp(page);
9
- await expect(page.getByText(person.email)).toBeVisible();
10
- await signOut(page);
11
- await signIn(page, person);
12
- await expect(page.getByText(person.email)).toBeVisible();
13
- });
14
- `;
15
- // The minimal starter has no sign-in screens yet: these steps call its auth route from the page.
16
- // Once the app has a form, drop the steps (starter form) or replace them with the form's own steps.
17
- const ROUTE_ACCOUNT = `import { test, expect, type FormSteps } from '@somewhere-cloud/cli/testing';
18
-
19
- // This app has no sign-in screens yet, so these steps use its auth route from the page.
20
- // When you add a form, replace them with your form's steps: fill, submit.
21
- const viaAuthRoute = (path: string): FormSteps => async (page, { email, password }) => {
22
- if (page.url() === 'about:blank') await page.goto('/');
23
- await page.evaluate(async ([path, body]) => {
24
- const response = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
25
- await response.text(); // read the answer, as a form would
26
- }, [path, { email, password }] as const);
1
+ // One short, ordinary Playwright script an agent copies and changes, not a second test suite:
2
+ // nothing here is discovered by `somewhere test` (it runs tests/**/*.spec.ts only). The helpers come
3
+ // from @somewhere-cloud/cli/script and work the same from .mjs or .cjs.
4
+ const SCRIPT = (privateData) => `// tests/app-check.mjs — an ordinary Playwright script for this app: change the checks to match
5
+ // what you built. Run it after a successful deploy, never after a refused one:
6
+ // npx somewhere deploy && node tests/app-check.mjs
7
+ // It writes its result once to .somewhere/app-check.json; the exit code is the verdict.
8
+ // From a .cjs script: const { openAppTest } = require('@somewhere-cloud/cli/script');
9
+ import { chromium } from '@playwright/test';
10
+ import { openAppTest${privateData ? ', captureResponses, dataReady' : ''} } from '@somewhere-cloud/cli/script';
11
+
12
+ const app = await openAppTest(); // stops if this folder has changes the live release lacks
13
+ const browser = await chromium.launch(app.launchOptions());
14
+ // One person = one browser context, signed up through the app's own form (accounts are
15
+ // deleted by exact id in finish()).
16
+ const person = async () => {
17
+ const page = await browser.newPage({ baseURL: app.origin });
18
+ return { page, account: await app.signUp(page) };
27
19
  };
28
- const signedInAs = async (page: import('@playwright/test').Page) => (await (await page.request.get('/api/auth/me')).json()).user;
29
-
30
- test('sign up, sign out and sign back in', async ({ page, signUp, signOut, signIn }) => {
31
- const person = await signUp(page, { steps: viaAuthRoute('/api/auth/signup') });
32
- expect((await signedInAs(page)).email).toBe(person.email);
33
- await signOut(page, { steps: async page => { expect((await page.request.post('/api/auth/logout', { data: {} })).ok()).toBe(true); } });
34
- expect(await signedInAs(page)).toBeNull();
35
- await signIn(page, person, { steps: viaAuthRoute('/api/auth/login') });
36
- expect((await signedInAs(page)).email).toBe(person.email);
37
- });
38
- `;
39
- // Nothing scrolls sideways at phone width: not the page, and not a table or panel inside it.
40
- const SIDEWAYS = `async function scrollsSideways(page: import('@playwright/test').Page) {
41
- return page.evaluate(() => [document.documentElement, ...document.querySelectorAll('body *')]
42
- .filter((el) => el.scrollWidth > el.clientWidth + 1
43
- && (el === document.documentElement || ['auto', 'scroll'].includes(getComputedStyle(el).overflowX)))
44
- .map((el) => el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : '')));
20
+ try {
21
+ const [ana, ben] = await Promise.all([person(), person()]);
22
+ await app.check('the signed-in page shows the account', () => ana.page.getByText(ana.account.email).waitFor());
23
+ await app.check('sign out, then sign back in', async () => {
24
+ await app.signOut(ana.page);
25
+ await app.signIn(ana.page, ana.account);
26
+ });
27
+ ${privateData ? ` await app.check('a note stays private to its owner', async () => {
28
+ const secret = 'private ' + crypto.randomUUID(); // a unique value: search for it, not a common word
29
+ await ana.page.getByLabel('Title').fill(secret);
30
+ await ana.page.getByRole('button', { name: 'Add note' }).click();
31
+ await ana.page.getByRole('heading', { name: secret }).waitFor();
32
+ const seen = captureResponses(ben.page);
33
+ await ben.page.reload();
34
+ await dataReady(ben.page); // the list has loaded, not merely "signed in"
35
+ const leaks = await seen.find(secret);
36
+ if (leaks.length) throw new Error('the other person received the note: ' + JSON.stringify(leaks));
37
+ const { data: [note] } = await app.data(ana.page, { table: 'notes', operation: 'list', where: { title: secret } });
38
+ await app.expectRefused(ben.page, { table: 'notes', operation: 'get', id: note.id }, { allowed: ana.page });
39
+ await app.expectRefused(ben.page, { table: 'notes', operation: 'update', id: note.id, values: { title: 'changed' } }, { allowed: ana.page });
40
+ await app.expectRefused(ben.page, { table: 'notes', operation: 'delete', id: note.id }, { allowed: ana.page });
41
+ });
42
+ ` : ''} await app.check('at phone width nothing scrolls sideways', async () => {
43
+ await ana.page.setViewportSize({ width: 390, height: 844 });
44
+ await ana.page.reload();
45
+ await ana.page.getByText(ana.account.email).waitFor();
46
+ const wide = await ana.page.evaluate(() => [document.documentElement, ...document.querySelectorAll('body *')]
47
+ .filter((el) => el.scrollWidth > el.clientWidth + 1
48
+ && (el === document.documentElement || ['auto', 'scroll'].includes(getComputedStyle(el).overflowX)))
49
+ .map((el) => el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : '')));
50
+ if (wide.length) throw new Error('scrolls sideways at 390 px: ' + wide.join(', '));
51
+ });
52
+ } finally {
53
+ await app.finish(); // confirms the release, deletes the accounts, writes the result once
54
+ await browser.close();
45
55
  }
46
56
  `;
47
- const FORM_PHONE = (privateData) => `import { test, expect } from '@somewhere-cloud/cli/testing';
48
-
49
- // One pass at phone width. Adapt: do the app's main action here, as a person on a phone would.
50
- test.use({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
51
- ${SIDEWAYS}
52
- test('phone: ${privateData ? 'sign up, add a note and sign out' : 'sign up and sign out'}', async ({ page, signUp, signOut }) => {
53
- const person = await signUp(page);
54
- await expect(page.getByText(person.email)).toBeVisible();
55
- expect(await scrollsSideways(page), 'these scroll sideways at 390 px').toEqual([]);
56
- ${privateData ? ` const title = 'phone ' + crypto.randomUUID();
57
- await page.getByLabel('Title').fill(title);
58
- await page.getByRole('button', { name: 'Add note' }).click();
59
- await expect(page.getByRole('heading', { name: title })).toBeVisible();
60
- ` : ''} await signOut(page);
61
- });
62
- `;
63
- const ROUTE_PHONE = `import { test, expect } from '@somewhere-cloud/cli/testing';
64
-
65
- // One pass at phone width. Adapt: do the app's main action here, as a person on a phone would.
66
- test.use({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
67
- ${SIDEWAYS}
68
- test('phone: the page shows the greeting from its function', async ({ page }) => {
69
- await page.goto('/');
70
- await expect(page.getByText('Your full-stack app is ready.')).toBeVisible();
71
- expect(await scrollsSideways(page), 'these scroll sideways at 390 px').toEqual([]);
72
- });
73
- `;
74
- // Two people, one role-holder: the access journeys. In the private-data starter the first one runs
75
- // against its notes; elsewhere both say exactly what to fill in and are skipped until then.
76
- const ACCESS = (variant) => `import { test, expect, data, expectRefused } from '@somewhere-cloud/cli/testing';
77
-
78
- // Adapt: a table whose rows belong to the person who made them, values to create one, and a change.
79
- const OWNED = ${variant === 'notes'
80
- ? `{ table: 'notes', values: { title: 'private ' + crypto.randomUUID() }, change: { title: 'changed' } }`
81
- : `{ table: '', values: {} as Record<string, unknown>, change: {} as Record<string, unknown> }`};
82
- // Adapt: a role from appRoles in db/schema.ts, a table only that role may use, and values to create a row.
83
- const ROLE = { role: '', table: '', values: {} as Record<string, unknown> };
84
-
85
- test('one person cannot see or change another person\\'s rows', async ({ newUser }) => {
86
- test.skip(!OWNED.table, 'Fill in OWNED at the top of tests/access.spec.ts');
87
- const [owner, other] = await Promise.all([newUser(), newUser()]);
88
- ${variant === 'notes' ? ` // The owner adds the row through the app's own form.
89
- await owner.page.goto('/');
90
- await owner.page.getByLabel('Title').fill(OWNED.values.title);
91
- await owner.page.getByRole('button', { name: 'Add note' }).click();
92
- await expect(owner.page.getByRole('heading', { name: OWNED.values.title })).toBeVisible();
93
- const listed = await data(owner.request, OWNED.table, { operation: 'list', where: { title: OWNED.values.title } });
94
- const { id } = (await listed.json()).data[0];
95
- // The other person's own list loads without it.
96
- await other.page.goto('/');
97
- await expect(other.page.getByText('No notes yet.')).toBeVisible();
98
- ` : ` const created = await data(owner.request, OWNED.table, { operation: 'create', values: OWNED.values });
99
- expect(created.status()).toBe(200);
100
- const { id } = (await created.json()).data;
101
- `} // Every way the other person could reach the row is refused; the owner is the positive control.
102
- await Promise.all([
103
- expectRefused(other, OWNED.table, { operation: 'get', id }, { allowed: owner }),
104
- expectRefused(other, OWNED.table, { operation: 'list', where: { id } }, { allowed: owner }),
105
- expectRefused(other, OWNED.table, { operation: 'update', id, values: OWNED.change }, { allowed: owner }),
106
- expectRefused(other, OWNED.table, { operation: 'delete', id }, { allowed: owner }),
107
- ]);
108
- // Nothing they tried changed it.
109
- const after = await data(owner.request, OWNED.table, { operation: 'get', id });
110
- expect((await after.json()).data).toMatchObject(OWNED.values);
111
- });
112
-
113
- test('a role-holder may use what a non-holder is refused', async ({ newUser }) => {
114
- test.skip(!ROLE.role, 'Fill in ROLE at the top of tests/access.spec.ts');
115
- const [holder, person] = await Promise.all([newUser({ role: ROLE.role }), newUser()]);
116
- const created = await data(holder.request, ROLE.table, { operation: 'create', values: ROLE.values });
117
- expect(created.status()).toBe(200);
118
- const { id } = (await created.json()).data;
119
- await Promise.all([
120
- expectRefused(person, ROLE.table, { operation: 'get', id }, { allowed: holder }),
121
- expectRefused(person, ROLE.table, { operation: 'create', values: ROLE.values }, { allowed: holder }),
122
- expectRefused(person, ROLE.table, { operation: 'delete', id }, { allowed: holder }),
123
- ]);
124
- expect((await (await data(holder.request, ROLE.table, { operation: 'get', id })).json()).data).toMatchObject(ROLE.values);
125
- });
126
- ${variant === 'minimal' ? `
127
- test('visitors cannot read the server-only greetings table', async ({ anonymous }) => {
128
- await expectRefused(anonymous, 'greetings', { operation: 'list' });
129
- });
130
- ` : ''}`;
57
+ /** The starter's example script (auth starters only; the minimal starter has no sign-in form). */
131
58
  export function starterTests(options = {}) {
132
- if (options.minimal) {
133
- return [
134
- { path: 'tests/account.spec.ts', content: ROUTE_ACCOUNT },
135
- { path: 'tests/phone.spec.ts', content: ROUTE_PHONE },
136
- { path: 'tests/access.spec.ts', content: ACCESS('minimal') },
137
- ];
138
- }
139
- return [
140
- { path: 'tests/account.spec.ts', content: FORM_ACCOUNT },
141
- { path: 'tests/phone.spec.ts', content: FORM_PHONE(Boolean(options.privateData)) },
142
- { path: 'tests/access.spec.ts', content: ACCESS(options.privateData ? 'notes' : 'none') },
143
- ];
59
+ return [{ path: 'tests/app-check.mjs', content: SCRIPT(Boolean(options.privateData)) }];
144
60
  }
145
61
  //# sourceMappingURL=init-test-template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,sGAAsG;AACtG,sFAAsF;AAEtF,MAAM,YAAY,GAAG;;;;;;;;;;CAUpB,CAAC;AAEF,iGAAiG;AACjG,oGAAoG;AACpG,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBrB,CAAC;AAEF,6FAA6F;AAC7F,MAAM,QAAQ,GAAG;;;;;;CAMhB,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,WAAoB,EAAE,EAAE,CAAC;;;;EAI3C,QAAQ;eACK,WAAW,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,sBAAsB;;;;EAItF,WAAW,CAAC,CAAC,CAAC;;;;CAIf,CAAC,CAAC,CAAC,EAAE;;CAEL,CAAC;AAEF,MAAM,WAAW,GAAG;;;;EAIlB,QAAQ;;;;;;CAMT,CAAC;AAEF,mGAAmG;AACnG,4FAA4F;AAC5F,MAAM,MAAM,GAAG,CAAC,OAAqC,EAAE,EAAE,CAAC;;;gBAG1C,OAAO,KAAK,OAAO;IACjC,CAAC,CAAC,uGAAuG;IACzG,CAAC,CAAC,6FAA6F;;;;;;;EAO/F,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;CAUvB,CAAC,CAAC,CAAC;;;CAGH;;;;;;;;;;;;;;;;;;;;;;;;;EAyBC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;;;;CAIzB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAET,MAAM,UAAU,YAAY,CAAC,UAAwD,EAAE;IACrF,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;YACL,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,aAAa,EAAE;YACzD,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,WAAW,EAAE;YACrD,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;SAC7D,CAAC;IACJ,CAAC;IACD,OAAO;QACL,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,YAAY,EAAE;QACxD,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE;QAClF,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;KAC1F,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,qGAAqG;AACrG,wEAAwE;AAExE,MAAM,MAAM,GAAG,CAAC,WAAoB,EAAE,EAAE,CAAC;;;;;;sBAMnB,WAAW,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;EAiBtE,WAAW,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;CAef,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;CAcL,CAAC;AAEF,kGAAkG;AAClG,MAAM,UAAU,YAAY,CAAC,UAAqC,EAAE;IAClE,OAAO,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { InitScaffoldFile } from './init-scaffold.js';
2
2
  export declare const TOKENS_CSS = "/* Design tokens: the only place colours, type and spacing are defined.\n app.css and src/ui read these; pages never write a raw hex or px value.\n To restyle the whole app, change the values here.\n\n Fonts are local stacks only (no network fonts), chosen so every platform\n falls back to a good face, not to Arial/Times. Prefer one family: set\n --font-display to a serif stack only if the app wants that personality. */\n:root {\n color-scheme: light;\n\n --font-body: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n --font-display: var(--font-body);\n /* Serif alternative: \"Iowan Old Style\", \"Palatino Linotype\", Palatino, Georgia, serif; */\n --font-mono: ui-monospace, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace;\n\n --text-xs: 0.75rem;\n --text-sm: 0.875rem;\n --text-base: 1rem;\n --text-lg: 1.125rem;\n --text-xl: 1.375rem;\n --text-2xl: 1.75rem;\n --text-display: clamp(2rem, 4.4vw, 2.75rem);\n --tracking-display: -0.02em;\n --tracking-label: 0.06em;\n\n --space-1: 4px;\n --space-2: 8px;\n --space-3: 12px;\n --space-4: 16px;\n --space-5: 20px;\n --space-6: 24px;\n --space-8: 32px;\n --space-10: 40px;\n --space-12: 48px;\n --space-16: 64px;\n\n --radius-control: 8px;\n --radius-panel: 14px;\n --radius-pill: 999px;\n\n --control-height: 44px;\n --content-width: 1040px;\n\n --shadow-sm: 0 1px 2px rgba(28, 27, 24, 0.05);\n --shadow-md: 0 1px 2px rgba(28, 27, 24, 0.05), 0 16px 40px -28px rgba(28, 27, 24, 0.35);\n --shadow-lg: 0 24px 64px -24px rgba(28, 27, 24, 0.45);\n\n /* Surfaces and text */\n --color-bg: #f5f3ee;\n --color-surface: #ffffff;\n --color-surface-2: #faf8f4;\n --color-text: #1c1b18;\n --color-muted: #66615a;\n --color-border: #e0dbd1;\n --color-border-strong: #c9c2b5;\n\n /* One accent. Everything interactive uses it. */\n --color-accent: #1d6b52;\n --color-accent-hover: #185b46;\n --color-accent-soft: #e3efe9;\n --color-on-accent: #ffffff;\n --color-focus: #1d6b52;\n\n /* Semantic tones for badges, notices and stats: not for buttons. */\n --color-success: #1d6b52;\n --color-success-soft: #e3efe9;\n --color-warning: #8a5a00;\n --color-warning-soft: #f7ebd2;\n --color-danger: #b42318;\n --color-danger-soft: #fbe4e1;\n --color-info: #2a5d9f;\n --color-info-soft: #e1eaf7;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n color-scheme: dark;\n\n --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -28px rgba(0, 0, 0, 0.7);\n --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.8);\n\n --color-bg: #15161a;\n --color-surface: #1e2025;\n --color-surface-2: #24272d;\n --color-text: #ecebe6;\n --color-muted: #a19d95;\n --color-border: #31343b;\n --color-border-strong: #454953;\n\n --color-accent: #5fbf9a;\n --color-accent-hover: #74cba9;\n --color-accent-soft: #1f3a31;\n --color-on-accent: #0f1f19;\n --color-focus: #5fbf9a;\n\n --color-success: #5fbf9a;\n --color-success-soft: #1f3a31;\n --color-warning: #e2b25a;\n --color-warning-soft: #3a2f16;\n --color-danger: #f0867c;\n --color-danger-soft: #42221f;\n --color-info: #7fa9e6;\n --color-info-soft: #1f2d42;\n }\n}\n";
3
3
  export declare const APP_CSS = "/* Base styles and the classes src/ui components render. Values come from\n tokens.css. Add app-specific styles at the end of this file, or in a new\n file imported from src/main.tsx; do not restyle native elements globally. */\n\n/* ---------- Base ---------- */\n*, *::before, *::after { box-sizing: border-box; }\nhtml { -webkit-text-size-adjust: 100%; }\nbody {\n margin: 0;\n min-width: 320px;\n background: var(--color-bg);\n color: var(--color-text);\n font: 400 var(--text-base)/1.55 var(--font-body);\n -webkit-font-smoothing: antialiased;\n}\nbutton, input, select, textarea { font: inherit; color: inherit; }\nh1, h2, h3, p { margin: 0; }\nh1, h2, h3 { font-family: var(--font-display); line-height: 1.2; letter-spacing: var(--tracking-display); font-weight: 600; }\nh1 { font-size: var(--text-2xl); }\nh2 { font-size: var(--text-xl); }\nh3 { font-size: var(--text-lg); }\na { color: var(--color-accent); text-underline-offset: 3px; }\ncode, kbd { font-family: var(--font-mono); font-size: 0.9em; }\n:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }\n::placeholder { color: var(--color-muted); opacity: 0.8; }\n\n.muted { color: var(--color-muted); }\n.hint { margin: 0; color: var(--color-muted); font-size: var(--text-sm); font-weight: 400; }\n.error { margin: 0; color: var(--color-danger); font-size: var(--text-sm); }\n.skip-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; position: absolute; left: var(--space-3); top: -60px; padding: var(--space-2) var(--space-3); background: var(--color-text); color: var(--color-bg); z-index: 10; }\n.skip-link:focus { top: var(--space-3); }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n\n/* ---------- Layout primitives (src/ui/layout.tsx) ---------- */\n.stack { display: grid; gap: var(--stack-gap, var(--space-4)); align-content: start; }\n.stack > *, .grid > *, .card > *, .content > * { min-width: 0; }\n.inline { display: flex; flex-wrap: wrap; gap: var(--inline-gap, var(--space-2)); align-items: var(--inline-align, center); justify-content: var(--inline-justify, flex-start); }\n.grid { display: grid; gap: var(--grid-gap, var(--space-4)); grid-template-columns: repeat(auto-fit, minmax(min(var(--grid-min, 220px), 100%), 1fr)); }\n.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }\n\n.page-header { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-end; justify-content: space-between; margin-bottom: var(--space-8); }\n.page-header__text { display: grid; gap: var(--space-1); min-width: 0; }\n.page-header__title { font-size: var(--text-display); line-height: 1.1; }\n.page-header__description { color: var(--color-muted); max-width: 60ch; }\n\n.eyebrow { margin: 0; color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; }\n.section-title { margin: 0 0 var(--space-3); font-size: var(--text-sm); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--color-muted); }\n\n/* ---------- Panel and Card ---------- */\n.panel {\n display: grid;\n gap: var(--space-4);\n padding: var(--space-6);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-panel);\n background: var(--color-surface);\n box-shadow: var(--shadow-md);\n}\n.panel__title { margin: 0; font: 600 var(--text-lg)/1.2 var(--font-display); }\n\n.card { display: grid; gap: 0; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); box-shadow: var(--shadow-sm); overflow: hidden; }\n.card__header { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border); }\n.card__heading { display: grid; gap: 2px; min-width: 0; }\n.card__title { font-size: var(--text-base); font-weight: 600; letter-spacing: 0; }\n.card__description { color: var(--color-muted); font-size: var(--text-sm); }\n.card__body { padding: var(--space-5); }\n.card__body--flush { padding: 0; }\n.card__footer { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); background: var(--color-surface-2); }\n\n/* ---------- Buttons (src/ui/Button.tsx) ---------- */\n.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--space-2);\n min-height: var(--control-height);\n padding: 0 var(--space-4);\n border: 1px solid var(--color-accent);\n border-radius: var(--radius-control);\n background: var(--color-accent);\n color: var(--color-on-accent);\n font-weight: 600;\n line-height: 1.2;\n white-space: nowrap;\n text-decoration: none;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;\n}\n.button:hover:not(:disabled) { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }\n.button:disabled { opacity: 0.5; cursor: not-allowed; }\n.button--secondary { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }\n.button--secondary:hover:not(:disabled) { background: var(--color-surface-2); border-color: var(--color-border-strong); }\n.button--quiet { background: transparent; border-color: transparent; color: var(--color-text); }\n.button--quiet:hover:not(:disabled) { background: var(--color-accent-soft); border-color: transparent; }\n.button--danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }\n.button--danger:hover:not(:disabled) { background: var(--color-danger); border-color: var(--color-danger); filter: brightness(0.92); }\n.button--sm { padding: 0 var(--space-3); font-size: var(--text-sm); }\n.button--block { width: 100%; }\n.button__spinner { width: 1em; height: 1em; border-width: 2px; }\n\n.link-button {\n display: inline-flex; align-items: center; min-height: var(--control-height);\n padding: 0 var(--space-2); border: 0; background: none;\n color: var(--color-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;\n}\n.link-button:disabled { opacity: 0.5; cursor: not-allowed; }\n.link-button--danger { color: var(--color-danger); }\n\n/* ---------- Fields (src/ui/Field.tsx) ---------- */\n.field { display: grid; gap: 6px; min-width: 0; }\n.field__label { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }\n.field__optional { color: var(--color-muted); font-weight: 400; }\n.field .control {\n width: 100%;\n min-height: var(--control-height);\n padding: 10px 12px;\n border: 1px solid var(--color-border-strong);\n border-radius: var(--radius-control);\n background: var(--color-surface);\n color: var(--color-text);\n}\n.field .control:hover { border-color: var(--color-muted); }\n.field .control[aria-invalid=\"true\"] { border-color: var(--color-danger); }\n.field .control:disabled { background: var(--color-surface-2); color: var(--color-muted); cursor: not-allowed; }\n.field textarea.control { min-height: calc(var(--control-height) * 2.2); resize: vertical; line-height: 1.5; }\n.field select.control {\n appearance: none;\n padding-right: 40px;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2366615a' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right 12px center;\n}\n.field input[type=\"date\"].control, .field input[type=\"time\"].control { min-width: 10ch; }\n.field--inline { grid-template-columns: auto 1fr; align-items: center; }\n.field--inline .field__label { font-weight: 400; }\n.field input[type=\"checkbox\"], .field input[type=\"radio\"] { width: 20px; height: 20px; margin: 0; accent-color: var(--color-accent); }\n.field__hint { color: var(--color-muted); font-size: var(--text-sm); }\n.field__error { color: var(--color-danger); font-size: var(--text-sm); }\n.form-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(var(--form-row-min, 160px), 100%), 1fr)); align-items: start; }\n\n/* ---------- Tabs (src/ui/Tabs.tsx) ---------- */\n.tabs { display: flex; gap: var(--space-1); padding: var(--space-1); min-height: var(--control-height); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-2); overflow-x: auto; scrollbar-width: none; max-width: 100%; }\n.tabs::-webkit-scrollbar { display: none; }\n.tab { flex: 0 0 auto; min-height: calc(var(--control-height) - 8px); padding: 0 var(--space-4); border: 0; border-radius: calc(var(--radius-control) - 2px); background: transparent; color: var(--color-muted); font-weight: 600; font-size: var(--text-sm); white-space: nowrap; cursor: pointer; }\n.tab:hover { color: var(--color-text); }\n.tab[aria-selected=\"true\"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }\n\n/* ---------- Badge (src/ui/Badge.tsx) ---------- */\n.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }\n.badge--accent { background: var(--color-accent-soft); border-color: transparent; color: var(--color-accent); }\n.badge--success { background: var(--color-success-soft); border-color: transparent; color: var(--color-success); }\n.badge--warning { background: var(--color-warning-soft); border-color: transparent; color: var(--color-warning); }\n.badge--danger { background: var(--color-danger-soft); border-color: transparent; color: var(--color-danger); }\n.badge--info { background: var(--color-info-soft); border-color: transparent; color: var(--color-info); }\n.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }\n\n/* ---------- Stat (src/ui/Stat.tsx) ---------- */\n.stat { display: grid; gap: var(--space-2); padding: var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); box-shadow: var(--shadow-sm); }\n.stat__value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 600; letter-spacing: var(--tracking-display); line-height: 1.1; font-variant-numeric: tabular-nums; }\n.stat__value small { color: var(--color-muted); font-size: 0.55em; font-weight: 500; letter-spacing: 0; margin-left: 0.3em; }\n.stat__detail { color: var(--color-muted); font-size: var(--text-sm); }\n.stat__detail--success { color: var(--color-success); }\n.stat__detail--danger { color: var(--color-danger); }\n.meter { height: 6px; border-radius: var(--radius-pill); background: var(--color-border); overflow: hidden; }\n.meter__fill { height: 100%; border-radius: inherit; background: var(--color-accent); transition: width 240ms ease; }\n\n/* ---------- Table (src/ui/Table.tsx) ---------- */\n.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; container-type: inline-size; }\n.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }\n.table th, .table td { padding: var(--space-3) var(--space-5); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--color-border); }\n.table th { color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; white-space: nowrap; background: var(--color-surface-2); }\n.table tbody tr:last-child td { border-bottom: 0; }\n.table tbody tr:hover td { background: var(--color-surface-2); }\n.table .is-numeric { text-align: right; }\n.table__empty { padding: var(--space-8) var(--space-5); text-align: center; color: var(--color-muted); }\n/* A narrow card (a phone): each row becomes a block of label and value lines, so nothing scrolls sideways. */\n@container (max-width: 560px) {\n .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n .table, .table tbody, .table tr { display: block; width: 100%; }\n .table tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }\n .table tbody tr:last-child { border-bottom: 0; }\n .table td { display: flex; gap: var(--space-3); align-items: baseline; padding: var(--space-1) 0; border-bottom: 0; text-align: left; overflow-wrap: anywhere; }\n .table td::before { content: attr(data-label); flex: 0 0 38%; color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; }\n .table td.is-numeric { text-align: left; }\n .table tbody tr:hover td { background: transparent; }\n .table .table__empty { display: block; padding: var(--space-6) 0; text-align: center; }\n .table .table__empty::before { content: none; }\n}\n\n/* ---------- Notice (src/ui/Notice.tsx) ---------- */\n.notice { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-left-width: 4px; border-radius: var(--radius-control); background: var(--color-surface); font-size: var(--text-sm); }\n.notice__body { flex: 1 1 240px; display: grid; gap: 2px; min-width: 0; }\n.notice__title { font-weight: 600; }\n.notice--info { border-left-color: var(--color-info); }\n.notice--success { border-left-color: var(--color-success); }\n.notice--warning { border-left-color: var(--color-warning); }\n.notice--danger { border-left-color: var(--color-danger); }\n.notice__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }\n\n/* Alert from feedback.tsx; Notice is preferred for new code. */\n.alert { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-danger); border-radius: var(--radius-control); color: var(--color-danger); background: var(--color-surface); }\n.alert p { margin: 0; }\n\n/* ---------- Dialog (src/ui/Dialog.tsx) ---------- */\n.dialog { width: min(480px, calc(100% - 2 * var(--space-4))); padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-lg); }\n.dialog::backdrop { background: rgba(20, 20, 18, 0.45); backdrop-filter: blur(2px); }\n.dialog__header { display: flex; align-items: start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }\n.dialog__title { font-size: var(--text-lg); }\n.dialog__body { display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-5); }\n.dialog__footer { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); background: var(--color-surface-2); }\n\n/* ---------- Skeleton (src/ui/Skeleton.tsx) ---------- */\n.skeleton { display: grid; gap: var(--space-2); }\n.skeleton__line { height: 1em; border-radius: 4px; background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface-2) 50%, var(--color-border) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n\n/* ---------- Empty state (src/ui/feedback.tsx) ---------- */\n.empty { display: grid; gap: var(--space-2); justify-items: center; padding: var(--space-10) var(--space-6); border: 1px dashed var(--color-border-strong); border-radius: var(--radius-panel); text-align: center; }\n.empty__title { margin: 0; font: 600 var(--text-lg)/1.3 var(--font-display); }\n.empty__body { margin: 0; color: var(--color-muted); max-width: 44ch; }\n\n/* ---------- Loading, unavailable, banner ---------- */\n.loading { display: grid; place-content: center; justify-items: center; gap: var(--space-3); min-height: 100vh; color: var(--color-muted); }\n.unavailable { max-width: 380px; margin: 0 var(--space-4); color: var(--color-text); }\n.unavailable p { margin: 0; }\n.banner { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-danger); background: var(--color-surface); color: var(--color-danger); }\n.banner p { margin: 0; }\n.spinner { width: 24px; height: 24px; border: 3px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.8s linear infinite; }\n@keyframes spin { to { transform: rotate(360deg); } }\n\n/* ---------- Sign-in (src/ui/AuthCard.tsx) ---------- */\n.auth {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);\n gap: var(--space-12);\n align-items: center;\n width: min(960px, calc(100% - 2 * var(--space-6)));\n min-height: 100vh;\n margin: 0 auto;\n padding: var(--space-12) 0;\n}\n.auth__intro { display: grid; gap: var(--space-3); align-content: center; }\n.auth__app { margin: 0; color: var(--color-accent); font-weight: 600; }\n.auth__title { margin: 0; font-size: var(--text-display); line-height: 1.05; }\n.auth__column { display: grid; gap: var(--space-4); }\n.auth__form .button { width: 100%; }\n.auth__providers { display: grid; gap: var(--space-2); }\n.auth__switch { margin: 0; text-align: center; color: var(--color-muted); font-size: var(--text-sm); }\n.auth__forgot { margin: 0; text-align: right; font-size: var(--text-sm); }\n.auth__forgot a { display: inline-flex; align-items: center; min-height: 44px; }\n.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--color-muted); font-size: var(--text-sm); }\n.divider::before, .divider::after { content: \"\"; flex: 1; height: 1px; background: var(--color-border); }\n.provider-icon { width: 18px; height: 18px; flex: none; }\n\n/* ---------- Signed-in frame (src/ui/AppShell.tsx) ---------- */\n.shell { min-height: 100vh; }\n.topbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-4);\n width: min(var(--content-width), calc(100% - 2 * var(--space-6)));\n margin: 0 auto;\n padding: var(--space-3) 0;\n border-bottom: 1px solid var(--color-border);\n}\n.topbar__error { width: min(var(--content-width), calc(100% - 2 * var(--space-6))); margin: var(--space-2) auto 0; }\n.brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; font: 600 var(--text-lg)/1 var(--font-display); letter-spacing: var(--tracking-display); color: inherit; text-decoration: none; }\n.account { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }\n.account__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-muted); font-size: var(--text-sm); }\n.content { width: min(var(--content-width), calc(100% - 2 * var(--space-6))); margin: 0 auto; padding: var(--space-8) 0 var(--space-16); outline: none; }\n\n/* ---------- Email verification (src/ui/VerifyEmail.tsx) ---------- */\n.verify-email { margin-bottom: var(--space-6); }\n.verify-email__form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }\n.verify-email__form .field { grid-template-columns: auto auto; align-items: center; }\n.verify-email__form input { width: 8ch; letter-spacing: 0.2em; text-align: center; }\n\n/* ---------- Responsive ---------- */\n@media (max-width: 760px) {\n .auth { grid-template-columns: 1fr; gap: var(--space-6); align-content: start; padding-top: var(--space-8); }\n .auth__title { font-size: var(--text-2xl); }\n .page-header { margin-bottom: var(--space-6); }\n .page-header__title { font-size: var(--text-2xl); }\n .content { padding-top: var(--space-6); }\n}\n@media (max-width: 480px) {\n .panel { padding: var(--space-4); }\n .card__header, .card__body, .card__footer { padding-left: var(--space-4); padding-right: var(--space-4); }\n .table th, .table td { padding-left: var(--space-4); padding-right: var(--space-4); }\n}\n@media (prefers-reduced-motion: reduce) {\n .spinner { animation-duration: 3s; }\n .skeleton__line { animation: none; }\n .button, .meter__fill { transition: none; }\n}\n\n/* ---------- Your app ---------- */\n/* Add page-specific styles below. Use tokens; add a class, don't restyle a tag. */\n";
4
- export declare const STYLED_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** Anything that belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page: an intro column and a form column. Add to it through\n * the `providers` and `children` slots; the two-column grid holds exactly\n * these two columns, so don't add siblings to it. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n const signUp = form.mode === 'sign-up';\n\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit();\n }\n\n return (\n <main className=\"auth\">\n <div className=\"auth__intro\">\n <p className=\"auth__app\">{appName}</p>\n <h1 className=\"auth__title\">{signUp ? 'Create your account' : 'Welcome back'}</h1>\n <p className=\"muted\">{tagline ?? (signUp ? 'It takes a few seconds.' : 'Sign in to continue.')}</p>\n </div>\n <div className=\"auth__column\">\n <form className=\"panel auth__form\" onSubmit={onSubmit} noValidate aria-label={signUp ? 'Create account' : 'Sign in'}\n data-sw-auth=\"form\" data-sw-auth-mode={form.mode}>\n {providers ? (\n <>\n {providers}\n <p className=\"divider\" aria-hidden=\"true\">or use email</p>\n </>\n ) : null}\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\"\n autoComplete={signUp ? 'new-password' : 'current-password'}\n minLength={signUp ? form.passwordMinLength : undefined}\n hint={signUp ? `At least ${form.passwordMinLength} characters.` : undefined}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n {signUp ? null : <p className=\"auth__forgot\"><a href=\"/forgot-password\">Forgot password?</a></p>}\n {form.error ? <p className=\"error\" role=\"alert\" data-sw-auth=\"error\">{form.error}</p> : null}\n <Button type=\"submit\" block disabled={!form.canSubmit} pending={form.pending} data-sw-auth=\"submit\">\n {signUp ? 'Create account' : 'Sign in'}\n </Button>\n <p className=\"auth__switch\">\n {signUp ? 'Already have an account?' : 'New here?'}{' '}\n <button type=\"button\" className=\"link-button\" onClick={form.toggleMode} disabled={form.pending} data-sw-auth=\"mode\">\n {signUp ? 'Sign in' : 'Create an account'}\n </button>\n </p>\n </form>\n {children}\n </div>\n </main>\n );\n}\n";
5
- export declare const PLAIN_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** What belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page. Add to it through the `providers` and `children` slots. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n const signUp = form.mode === 'sign-up';\n\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit();\n }\n\n return (\n <main>\n <h1>{signUp ? 'Create your account' : 'Sign in'} \u00B7 {appName}</h1>\n {tagline ? <p>{tagline}</p> : null}\n {providers}\n <form onSubmit={onSubmit} noValidate aria-label={signUp ? 'Create account' : 'Sign in'} data-sw-auth=\"form\" data-sw-auth-mode={form.mode}>\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\"\n autoComplete={signUp ? 'new-password' : 'current-password'}\n minLength={signUp ? form.passwordMinLength : undefined}\n hint={signUp ? `At least ${form.passwordMinLength} characters.` : undefined}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n {signUp ? null : <p><a href=\"/forgot-password\">Forgot password?</a></p>}\n {form.error ? <p role=\"alert\" data-sw-auth=\"error\">{form.error}</p> : null}\n <Button type=\"submit\" disabled={!form.canSubmit} pending={form.pending} data-sw-auth=\"submit\">\n {signUp ? 'Create account' : 'Sign in'}\n </Button>\n </form>\n <p>\n <button type=\"button\" onClick={form.toggleMode} disabled={form.pending} data-sw-auth=\"mode\">\n {signUp ? 'Sign in' : 'Create an account'}\n </button>\n </p>\n {children}\n </main>\n );\n}\n";
4
+ export declare const STYLED_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** Anything that belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page: an intro column and a form column. Add to it through\n * the `providers` and `children` slots; the two-column grid holds exactly\n * these two columns, so don't add siblings to it. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n const signUp = form.mode === 'sign-up';\n\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit();\n }\n\n return (\n <main className=\"auth\">\n <div className=\"auth__intro\">\n <p className=\"auth__app\">{appName}</p>\n <h1 className=\"auth__title\">{signUp ? 'Create your account' : 'Welcome back'}</h1>\n <p className=\"muted\">{tagline ?? (signUp ? 'It takes a few seconds.' : 'Sign in to continue.')}</p>\n </div>\n <div className=\"auth__column\">\n <form className=\"panel auth__form\" onSubmit={onSubmit} noValidate aria-label={signUp ? 'Create account' : 'Sign in'}\n data-sw-auth=\"form\" data-sw-auth-mode={form.mode}>\n {providers ? (\n <>\n {providers}\n <p className=\"divider\" aria-hidden=\"true\">or use email</p>\n </>\n ) : null}\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\"\n autoComplete={signUp ? 'new-password' : 'current-password'}\n minLength={signUp ? form.passwordMinLength : undefined}\n hint={signUp ? `At least ${form.passwordMinLength} characters.` : undefined}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n {signUp ? null : <p className=\"auth__forgot\"><a href=\"/forgot-password\">Forgot password?</a></p>}\n {form.error ? <p className=\"error\" role=\"alert\" data-sw-auth=\"error\">{form.error}</p> : null}\n <Button type=\"submit\" block disabled={!form.canSubmit} pending={form.pending} data-sw-auth={form.mode === 'sign-up' ? 'sign-up' : 'sign-in'}>\n {signUp ? 'Create account' : 'Sign in'}\n </Button>\n <p className=\"auth__switch\">\n {signUp ? 'Already have an account?' : 'New here?'}{' '}\n <button type=\"button\" className=\"link-button\" onClick={form.toggleMode} disabled={form.pending} data-sw-auth=\"mode\">\n {signUp ? 'Sign in' : 'Create an account'}\n </button>\n </p>\n </form>\n {children}\n </div>\n </main>\n );\n}\n";
5
+ export declare const PLAIN_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** What belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page. Add to it through the `providers` and `children` slots. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n const signUp = form.mode === 'sign-up';\n\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit();\n }\n\n return (\n <main>\n <h1>{signUp ? 'Create your account' : 'Sign in'} \u00B7 {appName}</h1>\n {tagline ? <p>{tagline}</p> : null}\n {providers}\n <form onSubmit={onSubmit} noValidate aria-label={signUp ? 'Create account' : 'Sign in'} data-sw-auth=\"form\" data-sw-auth-mode={form.mode}>\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\"\n autoComplete={signUp ? 'new-password' : 'current-password'}\n minLength={signUp ? form.passwordMinLength : undefined}\n hint={signUp ? `At least ${form.passwordMinLength} characters.` : undefined}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n {signUp ? null : <p><a href=\"/forgot-password\">Forgot password?</a></p>}\n {form.error ? <p role=\"alert\" data-sw-auth=\"error\">{form.error}</p> : null}\n <Button type=\"submit\" disabled={!form.canSubmit} pending={form.pending} data-sw-auth={form.mode === 'sign-up' ? 'sign-up' : 'sign-in'}>\n {signUp ? 'Create account' : 'Sign in'}\n </Button>\n </form>\n <p>\n <button type=\"button\" onClick={form.toggleMode} disabled={form.pending} data-sw-auth=\"mode\">\n {signUp ? 'Sign in' : 'Create an account'}\n </button>\n </p>\n {children}\n </main>\n );\n}\n";
6
6
  export declare const STYLED_VERIFY_EMAIL = "import type { FormEvent } from 'react';\nimport type { EmailVerification } from '../../types/auth';\n\n/** A quiet reminder above the page, never its main call to action. */\nexport function VerifyEmailPanel({ verification }: { verification: EmailVerification }) {\n if (verification.status === 'checking' || verification.status === 'verified') return null;\n if (verification.status === 'unavailable') {\n return (\n <div className=\"notice notice--warning verify-email\" role=\"alert\">\n <p className=\"notice__body\">Could not check whether your email is verified.</p>\n <div className=\"notice__actions\">\n <button type=\"button\" className=\"button button--secondary button--sm\" onClick={verification.retry}>Try again</button>\n </div>\n </div>\n );\n }\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void verification.submit();\n }\n return (\n <section className=\"notice notice--info verify-email\" aria-label=\"Verify your email\">\n <div className=\"notice__body\">\n <p className=\"notice__title\">Verify your email</p>\n <p>{verification.sent ? 'Enter the 6-digit code we emailed you.' : verification.entering ? 'Enter the 6-digit code from the latest email we sent you.' : 'We will email you a 6-digit code.'}</p>\n {verification.error ? <p className=\"error\" role=\"alert\">{verification.error}</p> : null}\n </div>\n {verification.entering ? (\n <form className=\"notice__actions verify-email__form\" onSubmit={onSubmit} noValidate>\n <label className=\"visually-hidden\" htmlFor=\"verify-code\">Code</label>\n <input id=\"verify-code\" className=\"control\" inputMode=\"numeric\" autoComplete=\"one-time-code\" maxLength={6} required placeholder=\"000000\"\n value={verification.code} onChange={(event) => verification.setCode(event.target.value)} />\n <button type=\"submit\" className=\"button button--sm\" disabled={!verification.canSubmit} aria-busy={verification.pending}>Verify</button>\n <button type=\"button\" className=\"button button--quiet button--sm\" onClick={() => void verification.sendCode()} disabled={verification.pending}>Send a new code</button>\n </form>\n ) : (\n <div className=\"notice__actions\">\n <button type=\"button\" className=\"button button--secondary button--sm\" onClick={() => void verification.sendCode()} disabled={verification.pending} aria-busy={verification.pending}>\n Email me a code\n </button>\n <button type=\"button\" className=\"button button--quiet button--sm\" onClick={verification.enterCode} disabled={verification.pending}>I already have a code</button>\n </div>\n )}\n </section>\n );\n}\n";
7
7
  export declare const STYLED_UI_KIT: InitScaffoldFile[];
8
8
  export declare const PLAIN_UI_KIT: InitScaffoldFile[];
@@ -463,7 +463,7 @@ export function AuthCard({ appName, tagline, form, providers, children }: AuthCa
463
463
  value={form.password} onChange={(event) => form.setPassword(event.target.value)} />
464
464
  {signUp ? null : <p className="auth__forgot"><a href="/forgot-password">Forgot password?</a></p>}
465
465
  {form.error ? <p className="error" role="alert" data-sw-auth="error">{form.error}</p> : null}
466
- <Button type="submit" block disabled={!form.canSubmit} pending={form.pending} data-sw-auth="submit">
466
+ <Button type="submit" block disabled={!form.canSubmit} pending={form.pending} data-sw-auth={form.mode === 'sign-up' ? 'sign-up' : 'sign-in'}>
467
467
  {signUp ? 'Create account' : 'Sign in'}
468
468
  </Button>
469
469
  <p className="auth__switch">
@@ -519,7 +519,7 @@ export function AuthCard({ appName, tagline, form, providers, children }: AuthCa
519
519
  value={form.password} onChange={(event) => form.setPassword(event.target.value)} />
520
520
  {signUp ? null : <p><a href="/forgot-password">Forgot password?</a></p>}
521
521
  {form.error ? <p role="alert" data-sw-auth="error">{form.error}</p> : null}
522
- <Button type="submit" disabled={!form.canSubmit} pending={form.pending} data-sw-auth="submit">
522
+ <Button type="submit" disabled={!form.canSubmit} pending={form.pending} data-sw-auth={form.mode === 'sign-up' ? 'sign-up' : 'sign-in'}>
523
523
  {signUp ? 'Create account' : 'Sign in'}
524
524
  </Button>
525
525
  </form>
@@ -1,6 +1,6 @@
1
- import type { APIRequestContext, APIResponse, Locator, Page, TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from '@playwright/test';
2
- import { ApiClient } from './client.js';
3
- import type { TestTarget } from './test-target.js';
1
+ import type { APIRequestContext, APIResponse, Page, TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from '@playwright/test';
2
+ import { ready, type FormHost, type FormControl, type Attempt, type Person, type FormSteps, type CodeSteps, type SignUpOptions, type SignInOptions, type FormAdapter } from './form-auth.js';
3
+ export type { Person, FormSteps, CodeSteps, SignUpOptions, SignInOptions, FormAdapter };
4
4
  import type { TestInfo } from '@playwright/test';
5
5
  import type { DataRequest } from '../testing.js';
6
6
  export interface TestUser {
@@ -14,31 +14,6 @@ export interface TestUser {
14
14
  export interface NewUserOptions {
15
15
  role?: string;
16
16
  }
17
- /** An ordinary account made through the app's own sign-up form. `verified` is true once its
18
- * address was verified with a captured code (verify(), or a project that requires email codes). */
19
- export interface Person {
20
- id: string;
21
- email: string;
22
- password: string;
23
- verified: boolean;
24
- }
25
- /** Your own form steps, for an app that replaced the starter's form. */
26
- export type FormSteps = (page: Page, input: {
27
- email: string;
28
- password: string;
29
- }) => Promise<void>;
30
- /** Your own steps to enter an emailed sign-in code. */
31
- export type CodeSteps = (page: Page, code: string) => Promise<void>;
32
- export interface SignUpOptions {
33
- domain?: string;
34
- email?: string;
35
- steps?: FormSteps;
36
- codeSteps?: CodeSteps;
37
- }
38
- export interface SignInOptions {
39
- steps?: FormSteps;
40
- codeSteps?: CodeSteps;
41
- }
42
17
  interface Fixtures {
43
18
  _evidence: void;
44
19
  anonymous: APIRequestContext;
@@ -53,6 +28,7 @@ interface Fixtures {
53
28
  signIn: (page: Page, person: Person, options?: SignInOptions) => Promise<void>;
54
29
  signOut: (page: Page, options?: {
55
30
  steps?: (page: Page) => Promise<void>;
31
+ form?: FormAdapter;
56
32
  }) => Promise<void>;
57
33
  }
58
34
  type RunnerTest = TestType<PlaywrightTestArgs & PlaywrightTestOptions & Fixtures, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
@@ -83,30 +59,19 @@ export declare function expectRefused(response: APIResponse, status: number, cod
83
59
  /** Test seam: a stand-in request client that data() accepts. */
84
60
  export declare function _fixtureClientForTests(client: APIRequestContext, digest: string): APIRequestContext;
85
61
  export declare function data(client: APIRequestContext, table: string, request: DataRequest): Promise<APIResponse>;
86
- export declare function ready(page: Page, state?: 'ready' | 'signed-in' | 'signed-out' | Locator): Promise<void>;
87
- interface Attempt {
88
- email: string;
89
- record: string;
90
- id: string | null;
91
- submitted: boolean;
92
- refused: boolean;
93
- }
94
- interface Control {
95
- client: ApiClient;
96
- projectId: string;
97
- target: TestTarget;
98
- }
99
- declare class FormRun {
62
+ export { ready };
63
+ declare class FormRun implements FormHost {
100
64
  readonly info: TestInfo;
101
65
  readonly pages: Set<Page>;
102
66
  readonly attempts: Attempt[];
103
67
  private loading?;
68
+ readonly root: string;
104
69
  constructor(info: TestInfo);
105
- control(): Promise<Control>;
70
+ timed<T>(name: string, work: () => Promise<T>): Promise<T>;
71
+ control(): Promise<FormControl>;
106
72
  /** The page's own request client, with the app Origin and the data contract, for data()/expectRefused(). */
107
73
  attach(page: Page): Promise<void>;
108
74
  /** Email codes travel by real mail paths; give each auth step room inside the test's timeout. */
109
- allowTime(): void;
75
+ allowTime(ms: number): void;
110
76
  finish(): Promise<void>;
111
77
  }
112
- export {};