@somewhere-cloud/cli 0.38.95 → 0.38.97
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/CHANGELOG.md +21 -0
- package/dist/commands/cron.js +45 -0
- package/dist/commands/cron.js.map +1 -1
- package/dist/commands/deploy.d.ts +2 -2
- package/dist/commands/deploy.js +14 -13
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +70 -11
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/lint.js +1 -1
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/test.js +33 -2
- package/dist/commands/test.js.map +1 -1
- package/dist/lib/app-test.d.ts +5 -29
- package/dist/lib/app-test.js +27 -49
- package/dist/lib/app-test.js.map +1 -1
- package/dist/lib/declared-data.js +5 -2
- package/dist/lib/declared-data.js.map +1 -1
- package/dist/lib/form-accounts.d.ts +2 -1
- package/dist/lib/form-accounts.js +3 -2
- package/dist/lib/form-accounts.js.map +1 -1
- package/dist/lib/form-auth.d.ts +4 -0
- package/dist/lib/form-auth.js +24 -4
- package/dist/lib/form-auth.js.map +1 -1
- package/dist/lib/init-agent-guide.d.ts +2 -2
- package/dist/lib/init-agent-guide.js +30 -14
- package/dist/lib/init-agent-guide.js.map +1 -1
- package/dist/lib/init-feature-template.js +32 -45
- package/dist/lib/init-feature-template.js.map +1 -1
- package/dist/lib/init-green-template.js +2 -1
- package/dist/lib/init-green-template.js.map +1 -1
- package/dist/lib/init-scaffold.d.ts +5 -2
- package/dist/lib/init-scaffold.js +7 -3
- package/dist/lib/init-scaffold.js.map +1 -1
- package/dist/lib/init-template.js +2 -1
- package/dist/lib/init-template.js.map +1 -1
- package/dist/lib/init-test-template.js +13 -5
- package/dist/lib/init-test-template.js.map +1 -1
- package/dist/lib/init-ui-kit.d.ts +3 -3
- package/dist/lib/init-ui-kit.js +56 -54
- package/dist/lib/init-ui-kit.js.map +1 -1
- package/dist/lib/next-actions.js +4 -3
- package/dist/lib/next-actions.js.map +1 -1
- package/dist/lib/preview-jobs.d.ts +32 -0
- package/dist/lib/preview-jobs.js +38 -0
- package/dist/lib/preview-jobs.js.map +1 -0
- package/dist/lib/reference-check-note.d.ts +17 -0
- package/dist/lib/reference-check-note.js +27 -0
- package/dist/lib/reference-check-note.js.map +1 -0
- package/dist/lib/scaffold.d.ts +2 -2
- package/dist/lib/scaffold.js +5 -3
- package/dist/lib/scaffold.js.map +1 -1
- package/dist/lib/test-diagnostics.js +34 -7
- package/dist/lib/test-diagnostics.js.map +1 -1
- package/dist/lib/test-report.d.ts +18 -0
- package/dist/lib/test-report.js +39 -0
- package/dist/lib/test-report.js.map +1 -0
- package/dist/lib/test-scripts.d.ts +29 -0
- package/dist/lib/test-scripts.js +166 -0
- package/dist/lib/test-scripts.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/runtime/DECLARED-DATA-VENDOR.json +7 -6
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/declared-data.cjs +1 -1
|
@@ -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
|
-
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, .auth__switch 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
|
|
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
|
|
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__forgot { margin: 0; text-align: right; font-size: var(--text-sm); }\n.auth__switch { margin: 0; text-align: center; color: var(--color-muted); font-size: var(--text-sm); }\n.auth__forgot a, .auth__switch 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 // Enter signs in; Create account is its own button. Both are always on the page.\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit('sign-in');\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\">Welcome</h1>\n <p className=\"muted\">{tagline ?? 'Sign in, or create an account in a few seconds.'}</p>\n </div>\n <div className=\"auth__column\">\n <form className=\"panel auth__form\" onSubmit={onSubmit} noValidate aria-label=\"Sign in or create an account\" data-sw-auth=\"form\">\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\" data-testid=\"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\" data-testid=\"auth-password\"\n autoComplete=\"current-password\"\n hint={`A new account needs at least ${form.passwordMinLength} characters.`}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n <p className=\"auth__forgot\"><a href=\"/forgot-password\">Forgot password?</a></p>\n {form.error ? <p className=\"error\" role=\"alert\" data-sw-auth=\"error\" data-testid=\"auth-error\">{form.error}</p> : null}\n <Button type=\"submit\" block disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth=\"sign-in\" data-testid=\"auth-signin\">Sign in</Button>\n <Button variant=\"secondary\" block disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth=\"sign-up\" data-testid=\"auth-signup\"\n onClick={() => void form.submit('sign-up')}>Create account</Button>\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 // Enter signs in; Create account is its own button. Both are always on the page.\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit('sign-in');\n }\n\n return (\n <main>\n <h1>Sign in or create an account \u00B7 {appName}</h1>\n {tagline ? <p>{tagline}</p> : null}\n {providers}\n <form onSubmit={onSubmit} noValidate aria-label=\"Sign in or create an account\" data-sw-auth=\"form\">\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\" data-testid=\"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\" data-testid=\"auth-password\"\n autoComplete=\"current-password\"\n hint={`A new account needs at least ${form.passwordMinLength} characters.`}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n <p><a href=\"/forgot-password\">Forgot password?</a></p>\n {form.error ? <p role=\"alert\" data-sw-auth=\"error\" data-testid=\"auth-error\">{form.error}</p> : null}\n <Button type=\"submit\" disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth=\"sign-in\" data-testid=\"auth-signin\">Sign in</Button>{' '}\n <Button variant=\"secondary\" disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth=\"sign-up\" data-testid=\"auth-signup\"\n onClick={() => void form.submit('sign-up')}>Create account</Button>\n </form>\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[];
|
package/dist/lib/init-ui-kit.js
CHANGED
|
@@ -357,8 +357,8 @@ code, kbd { font-family: var(--font-mono); font-size: 0.9em; }
|
|
|
357
357
|
.auth__column { display: grid; gap: var(--space-4); }
|
|
358
358
|
.auth__form .button { width: 100%; }
|
|
359
359
|
.auth__providers { display: grid; gap: var(--space-2); }
|
|
360
|
-
.auth__switch { margin: 0; text-align: center; color: var(--color-muted); font-size: var(--text-sm); }
|
|
361
360
|
.auth__forgot { margin: 0; text-align: right; font-size: var(--text-sm); }
|
|
361
|
+
.auth__switch { margin: 0; text-align: center; color: var(--color-muted); font-size: var(--text-sm); }
|
|
362
362
|
.auth__forgot a, .auth__switch a { display: inline-flex; align-items: center; min-height: 44px; }
|
|
363
363
|
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--color-muted); font-size: var(--text-sm); }
|
|
364
364
|
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }
|
|
@@ -431,47 +431,38 @@ interface AuthCardProps {
|
|
|
431
431
|
* the \`providers\` and \`children\` slots; the two-column grid holds exactly
|
|
432
432
|
* these two columns, so don't add siblings to it. */
|
|
433
433
|
export function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
// Enter signs in; Create account is its own button. Both are always on the page.
|
|
436
435
|
function onSubmit(event: FormEvent<HTMLFormElement>) {
|
|
437
436
|
event.preventDefault();
|
|
438
|
-
void form.submit();
|
|
437
|
+
void form.submit('sign-in');
|
|
439
438
|
}
|
|
440
439
|
|
|
441
440
|
return (
|
|
442
441
|
<main className="auth">
|
|
443
442
|
<div className="auth__intro">
|
|
444
443
|
<p className="auth__app">{appName}</p>
|
|
445
|
-
<h1 className="auth__title">
|
|
446
|
-
<p className="muted">{tagline ??
|
|
444
|
+
<h1 className="auth__title">Welcome</h1>
|
|
445
|
+
<p className="muted">{tagline ?? 'Sign in, or create an account in a few seconds.'}</p>
|
|
447
446
|
</div>
|
|
448
447
|
<div className="auth__column">
|
|
449
|
-
<form className="panel auth__form" onSubmit={onSubmit} noValidate aria-label=
|
|
450
|
-
data-sw-auth="form" data-sw-auth-mode={form.mode}>
|
|
448
|
+
<form className="panel auth__form" onSubmit={onSubmit} noValidate aria-label="Sign in or create an account" data-sw-auth="form">
|
|
451
449
|
{providers ? (
|
|
452
450
|
<>
|
|
453
451
|
{providers}
|
|
454
452
|
<p className="divider" aria-hidden="true">or use email</p>
|
|
455
453
|
</>
|
|
456
454
|
) : null}
|
|
457
|
-
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email"
|
|
455
|
+
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email" data-testid="auth-email"
|
|
458
456
|
value={form.email} onChange={(event) => form.setEmail(event.target.value)} />
|
|
459
|
-
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password"
|
|
460
|
-
autoComplete=
|
|
461
|
-
|
|
462
|
-
hint={signUp ? \`At least \${form.passwordMinLength} characters.\` : undefined}
|
|
457
|
+
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password" data-testid="auth-password"
|
|
458
|
+
autoComplete="current-password"
|
|
459
|
+
hint={\`A new account needs at least \${form.passwordMinLength} characters.\`}
|
|
463
460
|
value={form.password} onChange={(event) => form.setPassword(event.target.value)} />
|
|
464
|
-
|
|
465
|
-
{form.error ? <p className="error" role="alert" data-sw-auth="error">{form.error}</p> : null}
|
|
466
|
-
<Button type="submit" block disabled={
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
<p className="auth__switch">
|
|
470
|
-
{signUp ? 'Already have an account?' : 'New here?'}{' '}
|
|
471
|
-
<button type="button" className="link-button" onClick={form.toggleMode} disabled={form.pending} data-sw-auth="mode">
|
|
472
|
-
{signUp ? 'Sign in' : 'Create an account'}
|
|
473
|
-
</button>
|
|
474
|
-
</p>
|
|
461
|
+
<p className="auth__forgot"><a href="/forgot-password">Forgot password?</a></p>
|
|
462
|
+
{form.error ? <p className="error" role="alert" data-sw-auth="error" data-testid="auth-error">{form.error}</p> : null}
|
|
463
|
+
<Button type="submit" block disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth="sign-in" data-testid="auth-signin">Sign in</Button>
|
|
464
|
+
<Button variant="secondary" block disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth="sign-up" data-testid="auth-signup"
|
|
465
|
+
onClick={() => void form.submit('sign-up')}>Create account</Button>
|
|
475
466
|
</form>
|
|
476
467
|
{children}
|
|
477
468
|
</div>
|
|
@@ -497,37 +488,30 @@ interface AuthCardProps {
|
|
|
497
488
|
|
|
498
489
|
/** The sign-in page. Add to it through the \`providers\` and \`children\` slots. */
|
|
499
490
|
export function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {
|
|
500
|
-
|
|
501
|
-
|
|
491
|
+
// Enter signs in; Create account is its own button. Both are always on the page.
|
|
502
492
|
function onSubmit(event: FormEvent<HTMLFormElement>) {
|
|
503
493
|
event.preventDefault();
|
|
504
|
-
void form.submit();
|
|
494
|
+
void form.submit('sign-in');
|
|
505
495
|
}
|
|
506
496
|
|
|
507
497
|
return (
|
|
508
498
|
<main>
|
|
509
|
-
<h1>
|
|
499
|
+
<h1>Sign in or create an account · {appName}</h1>
|
|
510
500
|
{tagline ? <p>{tagline}</p> : null}
|
|
511
501
|
{providers}
|
|
512
|
-
<form onSubmit={onSubmit} noValidate aria-label=
|
|
513
|
-
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email"
|
|
502
|
+
<form onSubmit={onSubmit} noValidate aria-label="Sign in or create an account" data-sw-auth="form">
|
|
503
|
+
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email" data-testid="auth-email"
|
|
514
504
|
value={form.email} onChange={(event) => form.setEmail(event.target.value)} />
|
|
515
|
-
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password"
|
|
516
|
-
autoComplete=
|
|
517
|
-
|
|
518
|
-
hint={signUp ? \`At least \${form.passwordMinLength} characters.\` : undefined}
|
|
505
|
+
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password" data-testid="auth-password"
|
|
506
|
+
autoComplete="current-password"
|
|
507
|
+
hint={\`A new account needs at least \${form.passwordMinLength} characters.\`}
|
|
519
508
|
value={form.password} onChange={(event) => form.setPassword(event.target.value)} />
|
|
520
|
-
|
|
521
|
-
{form.error ? <p role="alert" data-sw-auth="error">{form.error}</p> : null}
|
|
522
|
-
<Button type="submit" disabled={
|
|
523
|
-
|
|
524
|
-
|
|
509
|
+
<p><a href="/forgot-password">Forgot password?</a></p>
|
|
510
|
+
{form.error ? <p role="alert" data-sw-auth="error" data-testid="auth-error">{form.error}</p> : null}
|
|
511
|
+
<Button type="submit" disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth="sign-in" data-testid="auth-signin">Sign in</Button>{' '}
|
|
512
|
+
<Button variant="secondary" disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth="sign-up" data-testid="auth-signup"
|
|
513
|
+
onClick={() => void form.submit('sign-up')}>Create account</Button>
|
|
525
514
|
</form>
|
|
526
|
-
<p>
|
|
527
|
-
<button type="button" onClick={form.toggleMode} disabled={form.pending} data-sw-auth="mode">
|
|
528
|
-
{signUp ? 'Sign in' : 'Create an account'}
|
|
529
|
-
</button>
|
|
530
|
-
</p>
|
|
531
515
|
{children}
|
|
532
516
|
</main>
|
|
533
517
|
);
|
|
@@ -634,7 +618,8 @@ interface FieldChrome {
|
|
|
634
618
|
label: ReactNode;
|
|
635
619
|
hint?: ReactNode;
|
|
636
620
|
error?: string | null;
|
|
637
|
-
/** Shows "optional" next to the label. Required is the default and needs no mark
|
|
621
|
+
/** Shows "optional" next to the label. Required is the default and needs no mark;
|
|
622
|
+
* your onSubmit checks it and shows the error (the browser's check is off). */
|
|
638
623
|
optional?: boolean;
|
|
639
624
|
}
|
|
640
625
|
|
|
@@ -642,6 +627,14 @@ function describedBy(id: string, hint: ReactNode, error: string | null | undefin
|
|
|
642
627
|
return [hint ? \`\${id}-hint\` : null, error ? \`\${id}-error\` : null].filter(Boolean).join(' ') || undefined;
|
|
643
628
|
}
|
|
644
629
|
|
|
630
|
+
/** Kit controls turn off the browser's own form checks (required, type="email",
|
|
631
|
+
* pattern, min/max, minLength) on the form they sit in, so every submit reaches
|
|
632
|
+
* your onSubmit and your app's own error message is what people and tests see.
|
|
633
|
+
* To keep the browser's checks on one form, give it data-browser-checks. */
|
|
634
|
+
function appValidated(control: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null) {
|
|
635
|
+
if (control?.form && !control.form.hasAttribute('data-browser-checks')) control.form.noValidate = true;
|
|
636
|
+
}
|
|
637
|
+
|
|
645
638
|
/** The label/hint/error frame. Prefer TextField, SelectField and
|
|
646
639
|
* TextareaField; use Field directly for a control they don't cover. */
|
|
647
640
|
export function Field({ id, label, hint, error, optional, children }: FieldChrome & { children: ReactNode }) {
|
|
@@ -663,7 +656,7 @@ type TextFieldProps = FieldChrome & Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
663
656
|
export function TextField({ id, label, hint, error, optional, className, ...input }: TextFieldProps) {
|
|
664
657
|
return (
|
|
665
658
|
<Field id={id} label={label} hint={hint} error={error} optional={optional}>
|
|
666
|
-
<input id={id} className={['control', className].filter(Boolean).join(' ')} aria-invalid={error ? true : undefined}
|
|
659
|
+
<input ref={appValidated} id={id} className={['control', className].filter(Boolean).join(' ')} aria-invalid={error ? true : undefined}
|
|
667
660
|
aria-describedby={describedBy(id, hint, error)} required={!optional && input.required !== false} {...input} />
|
|
668
661
|
</Field>
|
|
669
662
|
);
|
|
@@ -680,7 +673,7 @@ type SelectFieldProps = FieldChrome & Omit<SelectHTMLAttributes<HTMLSelectElemen
|
|
|
680
673
|
export function SelectField({ id, label, hint, error, optional, options, placeholder, className, ...select }: SelectFieldProps) {
|
|
681
674
|
return (
|
|
682
675
|
<Field id={id} label={label} hint={hint} error={error} optional={optional}>
|
|
683
|
-
<select id={id} className={['control', className].filter(Boolean).join(' ')} aria-invalid={error ? true : undefined}
|
|
676
|
+
<select ref={appValidated} id={id} className={['control', className].filter(Boolean).join(' ')} aria-invalid={error ? true : undefined}
|
|
684
677
|
aria-describedby={describedBy(id, hint, error)} {...select}>
|
|
685
678
|
{placeholder ? <option value="" disabled>{placeholder}</option> : null}
|
|
686
679
|
{options.map((option) => <option key={option.value} value={option.value} disabled={option.disabled}>{option.label}</option>)}
|
|
@@ -694,7 +687,7 @@ type TextareaFieldProps = FieldChrome & Omit<TextareaHTMLAttributes<HTMLTextArea
|
|
|
694
687
|
export function TextareaField({ id, label, hint, error, optional, className, ...textarea }: TextareaFieldProps) {
|
|
695
688
|
return (
|
|
696
689
|
<Field id={id} label={label} hint={hint} error={error} optional={optional}>
|
|
697
|
-
<textarea id={id} className={['control', className].filter(Boolean).join(' ')} aria-invalid={error ? true : undefined}
|
|
690
|
+
<textarea ref={appValidated} id={id} className={['control', className].filter(Boolean).join(' ')} aria-invalid={error ? true : undefined}
|
|
698
691
|
aria-describedby={describedBy(id, hint, error)} required={!optional && textarea.required !== false} {...textarea} />
|
|
699
692
|
</Field>
|
|
700
693
|
);
|
|
@@ -704,7 +697,7 @@ export function TextareaField({ id, label, hint, error, optional, className, ...
|
|
|
704
697
|
export function CheckboxField({ id, label, hint, className, ...input }: { id: string; label: ReactNode; hint?: ReactNode } & Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'type'>) {
|
|
705
698
|
return (
|
|
706
699
|
<div className="field field--inline">
|
|
707
|
-
<input id={id} type="checkbox" className={className} aria-describedby={hint ? \`\${id}-hint\` : undefined} {...input} />
|
|
700
|
+
<input ref={appValidated} id={id} type="checkbox" className={className} aria-describedby={hint ? \`\${id}-hint\` : undefined} {...input} />
|
|
708
701
|
<label className="field__label" htmlFor={id}><span>{label}</span></label>
|
|
709
702
|
{hint ? <p id={\`\${id}-hint\`} className="field__hint" style={{ gridColumn: 2 }}>{hint}</p> : null}
|
|
710
703
|
</div>
|
|
@@ -1127,7 +1120,8 @@ interface FieldChrome {
|
|
|
1127
1120
|
label: ReactNode;
|
|
1128
1121
|
hint?: ReactNode;
|
|
1129
1122
|
error?: string | null;
|
|
1130
|
-
/** Shows "optional" next to the label. Required is the default and needs no mark
|
|
1123
|
+
/** Shows "optional" next to the label. Required is the default and needs no mark;
|
|
1124
|
+
* your onSubmit checks it and shows the error (the browser's check is off). */
|
|
1131
1125
|
optional?: boolean;
|
|
1132
1126
|
}
|
|
1133
1127
|
|
|
@@ -1135,6 +1129,14 @@ function describedBy(id: string, hint: ReactNode, error: string | null | undefin
|
|
|
1135
1129
|
return [hint ? \`\${id}-hint\` : null, error ? \`\${id}-error\` : null].filter(Boolean).join(' ') || undefined;
|
|
1136
1130
|
}
|
|
1137
1131
|
|
|
1132
|
+
/** Kit controls turn off the browser's own form checks (required, type="email",
|
|
1133
|
+
* pattern, min/max, minLength) on the form they sit in, so every submit reaches
|
|
1134
|
+
* your onSubmit and your app's own error message is what people and tests see.
|
|
1135
|
+
* To keep the browser's checks on one form, give it data-browser-checks. */
|
|
1136
|
+
function appValidated(control: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null) {
|
|
1137
|
+
if (control?.form && !control.form.hasAttribute('data-browser-checks')) control.form.noValidate = true;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1138
1140
|
/** The label/hint/error frame. Prefer TextField, SelectField and
|
|
1139
1141
|
* TextareaField; use Field directly for a control they don't cover. */
|
|
1140
1142
|
export function Field({ id, label, hint, error, optional, children }: FieldChrome & { children: ReactNode }) {
|
|
@@ -1153,7 +1155,7 @@ type TextFieldProps = FieldChrome & Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
1153
1155
|
export function TextField({ id, label, hint, error, optional, className, ...input }: TextFieldProps) {
|
|
1154
1156
|
return (
|
|
1155
1157
|
<Field id={id} label={label} hint={hint} error={error} optional={optional}>
|
|
1156
|
-
<input id={id} className={className} aria-invalid={error ? true : undefined}
|
|
1158
|
+
<input ref={appValidated} id={id} className={className} aria-invalid={error ? true : undefined}
|
|
1157
1159
|
aria-describedby={describedBy(id, hint, error)} required={!optional && input.required !== false} {...input} />
|
|
1158
1160
|
</Field>
|
|
1159
1161
|
);
|
|
@@ -1170,7 +1172,7 @@ type SelectFieldProps = FieldChrome & Omit<SelectHTMLAttributes<HTMLSelectElemen
|
|
|
1170
1172
|
export function SelectField({ id, label, hint, error, optional, options, placeholder, className, ...select }: SelectFieldProps) {
|
|
1171
1173
|
return (
|
|
1172
1174
|
<Field id={id} label={label} hint={hint} error={error} optional={optional}>
|
|
1173
|
-
<select id={id} className={className} aria-invalid={error ? true : undefined}
|
|
1175
|
+
<select ref={appValidated} id={id} className={className} aria-invalid={error ? true : undefined}
|
|
1174
1176
|
aria-describedby={describedBy(id, hint, error)} {...select}>
|
|
1175
1177
|
{placeholder ? <option value="" disabled>{placeholder}</option> : null}
|
|
1176
1178
|
{options.map((option) => <option key={option.value} value={option.value} disabled={option.disabled}>{option.label}</option>)}
|
|
@@ -1184,7 +1186,7 @@ type TextareaFieldProps = FieldChrome & Omit<TextareaHTMLAttributes<HTMLTextArea
|
|
|
1184
1186
|
export function TextareaField({ id, label, hint, error, optional, className, ...textarea }: TextareaFieldProps) {
|
|
1185
1187
|
return (
|
|
1186
1188
|
<Field id={id} label={label} hint={hint} error={error} optional={optional}>
|
|
1187
|
-
<textarea id={id} className={className} aria-invalid={error ? true : undefined}
|
|
1189
|
+
<textarea ref={appValidated} id={id} className={className} aria-invalid={error ? true : undefined}
|
|
1188
1190
|
aria-describedby={describedBy(id, hint, error)} required={!optional && textarea.required !== false} {...textarea} />
|
|
1189
1191
|
</Field>
|
|
1190
1192
|
);
|
|
@@ -1194,7 +1196,7 @@ export function TextareaField({ id, label, hint, error, optional, className, ...
|
|
|
1194
1196
|
export function CheckboxField({ id, label, hint, className, ...input }: { id: string; label: ReactNode; hint?: ReactNode } & Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'type'>) {
|
|
1195
1197
|
return (
|
|
1196
1198
|
<p>
|
|
1197
|
-
<input id={id} type="checkbox" className={className} aria-describedby={hint ? \`\${id}-hint\` : undefined} {...input} />{' '}
|
|
1199
|
+
<input ref={appValidated} id={id} type="checkbox" className={className} aria-describedby={hint ? \`\${id}-hint\` : undefined} {...input} />{' '}
|
|
1198
1200
|
<label htmlFor={id}>{label}</label>
|
|
1199
1201
|
{hint ? <><br /><small id={\`\${id}-hint\`}>{hint}</small></> : null}
|
|
1200
1202
|
</p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-ui-kit.js","sourceRoot":"","sources":["../../src/lib/init-ui-kit.ts"],"names":[],"mappings":"AACA,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAE3E,4EAA4E;AAE5E,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GzB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2StB,CAAC;AAEF,0EAA0E;AAE1E,MAAM,CAAC,MAAM,gBAAgB,GAAG
|
|
1
|
+
{"version":3,"file":"init-ui-kit.js","sourceRoot":"","sources":["../../src/lib/init-ui-kit.ts"],"names":[],"mappings":"AACA,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAE3E,4EAA4E;AAE5E,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ED
|
@@ -24,7 +24,7 @@ const SEE_IT_LINKED = {
|
|
|
24
24
|
};
|
|
25
25
|
const CHECK_IT_LINKED = {
|
|
26
26
|
command: 'somewhere verify',
|
|
27
|
-
why: '
|
|
27
|
+
why: 'the page loads and looks right at desktop and phone size; nothing to write',
|
|
28
28
|
};
|
|
29
29
|
/** EYES mode on a public URL, which REQUIRES `--store` — commands/browser.ts
|
|
30
30
|
* refuses `--screenshot` without it. Temporary credentials carry the `browser`
|
|
@@ -63,11 +63,12 @@ export function nextActions(ctx) {
|
|
|
63
63
|
},
|
|
64
64
|
];
|
|
65
65
|
case 'deploy': {
|
|
66
|
-
const test = { command: 'somewhere test', why: '
|
|
66
|
+
const test = { command: 'somewhere test', why: 'journeys, several users and access rules: your tests/*.mjs' };
|
|
67
67
|
if (ctx.temporary)
|
|
68
68
|
return ctx.liveUrl ? [seeItByUrl(ctx.liveUrl), test] : [];
|
|
69
|
+
// Test first, then verify (the AGENTS.md split); the screenshot link last.
|
|
69
70
|
if (ctx.projectLinked)
|
|
70
|
-
return [
|
|
71
|
+
return [test, CHECK_IT_LINKED, SEE_IT_LINKED];
|
|
71
72
|
if (ctx.liveUrl)
|
|
72
73
|
return [seeItByUrl(ctx.liveUrl), test];
|
|
73
74
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-actions.js","sourceRoot":"","sources":["../../src/lib/next-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAyBH;4EAC4E;AAC5E,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3C,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC1C,CAAC;AAED,MAAM,aAAa,GAAe;IAChC,4EAA4E;IAC5E,mCAAmC;IACnC,OAAO,EAAE,gCAAgC;IACzC,GAAG,EAAE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EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface FolderPreview {
|
|
2
|
+
projectId: string;
|
|
3
|
+
previewSessionId: string;
|
|
4
|
+
credential: string;
|
|
5
|
+
}
|
|
6
|
+
/** This folder's open preview (or the one named) and its tool credential. */
|
|
7
|
+
export declare function folderPreviewTool(opts: {
|
|
8
|
+
project?: string;
|
|
9
|
+
previewSession?: string;
|
|
10
|
+
}): Promise<FolderPreview>;
|
|
11
|
+
/** The preview's current version, as the platform resolves it for this credential. */
|
|
12
|
+
export declare function previewCurrentVersion(credential: string): Promise<{
|
|
13
|
+
preview_session_id: string;
|
|
14
|
+
preview_id: string;
|
|
15
|
+
}>;
|
|
16
|
+
export interface PreviewJob {
|
|
17
|
+
job_id: string;
|
|
18
|
+
status: string;
|
|
19
|
+
handler: string;
|
|
20
|
+
result: unknown;
|
|
21
|
+
error: string | null;
|
|
22
|
+
error_code: string | null;
|
|
23
|
+
timeout_seconds: number;
|
|
24
|
+
attempts_allowed: number;
|
|
25
|
+
preview_session_id: string;
|
|
26
|
+
preview_id: string;
|
|
27
|
+
}
|
|
28
|
+
/** Waits for a preview job to finish, reading it through the preview's own credential. */
|
|
29
|
+
export declare function waitForPreviewJob(credential: string, jobId: string, timeoutSeconds: number): Promise<{
|
|
30
|
+
job: PreviewJob;
|
|
31
|
+
timedOut: boolean;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Preview jobs from the CLI: `somewhere preview run-job` and `somewhere cron run --preview`.
|
|
2
|
+
// Every call about the preview's own jobs carries ONLY that preview's tool credential (lib/preview-credential.ts); your
|
|
3
|
+
// own sign-in is used for nothing but minting it, and a production job read never sees a preview job.
|
|
4
|
+
import { ApiClient } from './client.js';
|
|
5
|
+
import { getToken, loadProjectConfig } from './config.js';
|
|
6
|
+
import { loadPreviewCredential, mintPreviewCredential, previewToolClient } from './preview-credential.js';
|
|
7
|
+
import { loadPreviewRecord } from './preview-record.js';
|
|
8
|
+
/** This folder's open preview (or the one named) and its tool credential. */
|
|
9
|
+
export async function folderPreviewTool(opts) {
|
|
10
|
+
const projectId = opts.project ?? loadProjectConfig()?.project_id;
|
|
11
|
+
if (!projectId)
|
|
12
|
+
throw new Error('No project linked. Run `somewhere init` or pass --project <id>.');
|
|
13
|
+
const previewSessionId = opts.previewSession ?? loadPreviewRecord(process.cwd(), projectId)?.preview_session_id;
|
|
14
|
+
if (!previewSessionId)
|
|
15
|
+
throw new Error('This folder has no open preview. Open one with `somewhere preview`, or name one with --preview-session <id> (`somewhere preview list`).');
|
|
16
|
+
const credential = loadPreviewCredential(projectId, previewSessionId)
|
|
17
|
+
?? await mintPreviewCredential(new ApiClient(getToken()), projectId, previewSessionId);
|
|
18
|
+
return { projectId, previewSessionId, credential };
|
|
19
|
+
}
|
|
20
|
+
/** The preview's current version, as the platform resolves it for this credential. */
|
|
21
|
+
export async function previewCurrentVersion(credential) {
|
|
22
|
+
return previewToolClient(credential).call('GET', '/preview-tools/whoami');
|
|
23
|
+
}
|
|
24
|
+
const TERMINAL = new Set(['complete', 'failed', 'cancelled', 'indeterminate']);
|
|
25
|
+
/** Waits for a preview job to finish, reading it through the preview's own credential. */
|
|
26
|
+
export async function waitForPreviewJob(credential, jobId, timeoutSeconds) {
|
|
27
|
+
const client = previewToolClient(credential);
|
|
28
|
+
const deadline = Date.now() + timeoutSeconds * 1000;
|
|
29
|
+
for (;;) {
|
|
30
|
+
const job = await client.call('GET', `/preview-tools/jobs/${encodeURIComponent(jobId)}`);
|
|
31
|
+
if (TERMINAL.has(job.status))
|
|
32
|
+
return { job, timedOut: false };
|
|
33
|
+
if (Date.now() >= deadline)
|
|
34
|
+
return { job, timedOut: true };
|
|
35
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=preview-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-jobs.js","sourceRoot":"","sources":["../../src/lib/preview-jobs.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,wHAAwH;AACxH,sGAAsG;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,6EAA6E;AAC7E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAmD;IACzF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,IAAI,iBAAiB,EAAE,EAAE,UAAU,CAAC;IAClE,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACnG,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,IAAI,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAChH,IAAI,CAAC,gBAAgB;QAAE,MAAM,IAAI,KAAK,CAAC,yIAAyI,CAAC,CAAC;IAClL,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,EAAE,gBAAgB,CAAC;WAChE,MAAM,qBAAqB,CAAC,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;IACzF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC;AACrD,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAkB;IAC5D,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAqD,KAAK,EAAE,uBAAuB,CAAC,CAAC;AAChI,CAAC;AAOD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;AAE/E,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAAkB,EAAE,KAAa,EAAE,cAAsB;IAC/F,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,cAAc,GAAG,IAAI,CAAC;IACpD,SAAS,CAAC;QACR,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAa,KAAK,EAAE,uBAAuB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrG,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAC9D,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ;YAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC3D,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ReferenceCheck {
|
|
2
|
+
status?: string;
|
|
3
|
+
reason?: string;
|
|
4
|
+
findings?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface DeployLogRead {
|
|
7
|
+
version?: number;
|
|
8
|
+
reference_check?: ReferenceCheck | null;
|
|
9
|
+
}
|
|
10
|
+
interface LogClient {
|
|
11
|
+
call<T>(method: string, path: string, body?: unknown, query?: Record<string, string>): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
/** The line for this log, or null when the check is clean, still running, or absent. */
|
|
14
|
+
export declare function describeReferenceCheck(log: DeployLogRead | null): string | null;
|
|
15
|
+
/** Read the live release's log once and return the line to print, if any. A failed read says so. */
|
|
16
|
+
export declare function referenceCheckNote(client: () => LogClient, projectId: string): Promise<string | null>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// `somewhere test` starts with one line about the live release's background reference check, only when it is not
|
|
2
|
+
// clean: the deploy can only say the check is running, and its result is otherwise read by hand (bench-1115c:
|
|
3
|
+
// three builders never saw it).
|
|
4
|
+
/** The line for this log, or null when the check is clean, still running, or absent. */
|
|
5
|
+
export function describeReferenceCheck(log) {
|
|
6
|
+
const check = log?.reference_check;
|
|
7
|
+
if (!check || typeof log?.version !== 'number')
|
|
8
|
+
return null;
|
|
9
|
+
const read = `somewhere call project_deploy_log '${JSON.stringify({ version: log.version })}'`;
|
|
10
|
+
if (check.status === 'checked' && (check.findings ?? 0) > 0) {
|
|
11
|
+
return `The last deploy's background reference check found ${check.findings} warning${check.findings === 1 ? '' : 's'}; read them with: ${read}`;
|
|
12
|
+
}
|
|
13
|
+
if (check.status === 'unavailable') {
|
|
14
|
+
return `The last deploy's background reference check ${check.reason === 'not_finished' ? 'never finished' : 'could not run'}, so its warnings are unknown: ${read}`;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
/** Read the live release's log once and return the line to print, if any. A failed read says so. */
|
|
19
|
+
export async function referenceCheckNote(client, projectId) {
|
|
20
|
+
try {
|
|
21
|
+
return describeReferenceCheck(await client().call('GET', '/deploy/log', undefined, { project_id: projectId }));
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return `Could not read the last deploy's background reference check: ${error instanceof Error ? error.message : String(error)}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=reference-check-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-check-note.js","sourceRoot":"","sources":["../../src/lib/reference-check-note.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,8GAA8G;AAC9G,gCAAgC;AAMhC,wFAAwF;AACxF,MAAM,UAAU,sBAAsB,CAAC,GAAyB;IAC9D,MAAM,KAAK,GAAG,GAAG,EAAE,eAAe,CAAC;IACnC,IAAI,CAAC,KAAK,IAAI,OAAO,GAAG,EAAE,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC5D,MAAM,IAAI,GAAG,sCAAsC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC;IAC/F,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5D,OAAO,sDAAsD,KAAK,CAAC,QAAQ,WAAW,KAAK,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,qBAAqB,IAAI,EAAE,CAAC;IACnJ,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;QACnC,OAAO,gDAAgD,KAAK,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,kCAAkC,IAAI,EAAE,CAAC;IACtK,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB,EAAE,SAAiB;IACjF,IAAI,CAAC;QACH,OAAO,sBAAsB,CAAC,MAAM,MAAM,EAAE,CAAC,IAAI,CAAgB,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CA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