Portable UI schema: confirmPhrase, open-URL action, file input, breadcrumbs — types, validation, web renderer #34
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Core half of OpsDeck/mobile#1. The schema contract lives here, so this lands first — the Android renderer (mobile#1) and module adoption (OpsDeck/module_filebrowser#1) build on it.
Each addition touches three core surfaces:
packages/sdk/ui.ts, the contract modules compile against.packages/server/src/modules/ui-schema.ts. The zod discriminated union over literal block types means a module declaring an unknown block or input kind fails validation, and an invalid schema disables the module at load. Additive fields fare no better: zod strips unknown keys, so aconfirmPhraseshipped before validation knows it would be silently removed from the served schema and no client would ever see it.packages/shell/src/schema/SchemaPage.svelte+blocks/*.svelte. The schema is also the web UI for schema-only modules, so the web renderer needs the same four or parity breaks in the other direction.The four additions (priority order, rationale in mobile#1)
confirmPhrase?: stringonUiActionbesideconfirm(sdk/ui.ts:293-294). Client shows a text field and enables the confirming button only on exact match — the schema equivalent ofConfirmDialog.confirmPhrasefrom #31. Web renderer:blocks/ActionsBlock.sveltecan pass it straight toConfirmDialog. Degradation note: a client that ignores the field falls back to one-tap confirm, so dangerous actions should keep theirconfirmtext scary regardless.fileas aUiInputKind(sdk/ui.ts:324-330, currently text/number/password/toggle/select/chips). The upload half. Bigger lift: form submit today posts JSON, so this needs a defined wire shape for binary bodies (multipart or streamed PUT) plus progress reporting.Breadcrumbs) or a page-level parent affordance. Kills filebrowser'sup/:predirect-page workaround (module_filebrowser backend/ui.ts:175-200).Sequencing
version: 1— optional fields and new members of existing unions/enums. No version bump needed if old clients tolerate unknowns (mobile's renderer has a graceful unknown-block fallback; verify the web renderer does too before adding a new block type).docs/modules.mdblock-type and input-kind lists alongside — the doc was just rewritten in #32 and currently matchessdk/ui.tsexactly.