jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
This commit is contained in:
+11
-8
@@ -9,8 +9,9 @@ import { state } from './state.mjs';
|
||||
import { banner } from './chrome.mjs';
|
||||
import { navigate } from './router.mjs';
|
||||
|
||||
let pkg = null; // the picked package -- the view owns it
|
||||
/** @type {?{ display: string, name: string }} */ let pkg = null; // the picked package -- the view owns it
|
||||
|
||||
/** @param {?string} arg @param {number} seq @returns {Promise<void>} */
|
||||
export async function enter(arg, seq) {
|
||||
$('package-pick').hidden = false;
|
||||
$('create-form').hidden = true;
|
||||
@@ -29,25 +30,27 @@ export async function enter(arg, seq) {
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {{ display: string, name: string }} p */
|
||||
async function pickPackage(p) {
|
||||
pkg = p;
|
||||
$('package-pick').hidden = true;
|
||||
$('create-form').hidden = false;
|
||||
$('create-title').textContent = `start -- ${p.display}`;
|
||||
$('create-name').value = p.display;
|
||||
$('create-pc').value = '';
|
||||
$('create-pc').placeholder = 'rolling a name...';
|
||||
$('create-pc').focus();
|
||||
/** @type {HTMLInputElement} */ ($('create-name')).value = p.display;
|
||||
const pcInp = /** @type {HTMLInputElement} */ ($('create-pc'));
|
||||
pcInp.value = '';
|
||||
pcInp.placeholder = 'rolling a name...';
|
||||
pcInp.focus();
|
||||
const roll = await api('/names').catch(() => null);
|
||||
if (state.view !== 'new' || $('create-form').hidden) return;
|
||||
if ($('create-pc').value === '' && roll?.name) $('create-pc').value = roll.name;
|
||||
if (pcInp.value === '' && roll?.name) pcInp.value = roll.name;
|
||||
}
|
||||
|
||||
$('create-back').addEventListener('click', () => { $('create-form').hidden = true; $('package-pick').hidden = false; });
|
||||
$('create-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const name = $('create-name').value.trim();
|
||||
const pc = $('create-pc').value.trim();
|
||||
const name = /** @type {HTMLInputElement} */ ($('create-name')).value.trim();
|
||||
const pc = /** @type {HTMLInputElement} */ ($('create-pc')).value.trim();
|
||||
if (!name) return banner('the package needs a display name');
|
||||
if (!pc) return banner('the main character needs a name');
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user