Skip to content

UI kit 7e: /kit review workbench (#461) - #480

Open
silverbackdan wants to merge 200 commits into
feat/236-kit-7-in-pagefrom
feat/236-kit-7e-kit-workbench
Open

silverbackdan wants to merge 200 commits into
feat/236-kit-7-in-pagefrom
feat/236-kit-7e-kit-workbench

Conversation

@silverbackdan

@silverbackdan silverbackdan commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Turns the playground's /kit into a review workbench for #461 (#236), so the kit can be checked by flipping states rather than reading code. All of it lives in playground/app/kit/; pages/kit.vue changes only to mount the workbench, the tabs and the remount key. src/ is untouched except one spec (FormGroup.spec.ts), which now raises its form error through the fake form's next Save.

/kit runs without the page's own CWA

  • /kit keeps cwa: { disabled: true } (no route fetch) and is given layout: false by the playground's pages:extend hook, so no CwaRootLayout, no edit mode and no resource manager react to clicks on the samples.
  • The same hook still removes /kit from production builds; it stays in dev and test builds. entry-bundle-markers.mjs reports it absent.
  • Spec kit/kit-page.spec.ts: navigating to /kit never calls fetchRoute, and a click or right-click on a sample, with edit mode on, leaves resourceStackManager empty with no manager shown. Mutation-checked: removing either opt-out fails it.

Toolbar (sticky, applies to both tabs)

  • View: Kit / In practice (?tab=practice, bookmarkable)
  • Sections: a table of contents built from the tab's sections
  • Theme: Auto / Light / Dark, applied the kit's way (kitThemeStyle). Auto follows prefers-color-scheme.
  • Width: Full / 1280 / 768 / 390. The page goes into a resizable iframe with a px readout; settings reach the frame by postMessage.
  • Touch: emulates a coarse pointer by rewriting CSSOM media rules and wrapping matchMedia
  • Reduced motion: the same mechanism
  • Settings are kept in localStorage, wrapped in try/catch.

Kit tab: simulations

Each one uses the real components and the real field-state functions (admin/field-states.ts), through a fake save adapter (fake-save-server.ts). Every demo has a caption naming the component and its state.

  • Field states: every field type in one forced state (idle, pending, saving, saved, error, conflict, disabled), placed on the page, in a manager row or in a dialog.
  • Failures: the next save answers 422 with field errors, 500, offline or a 412 conflict; Offline and Slow (4 s) toggles; "Make the next route action fail" on a route tree whose actions go through the adapter.
  • Presence: Mia in chosen fields, "Mia edits Title", "Mia's save lands as you type", "Type a sentence for me", "Mia leaves".
  • Search: type-for-me (gal, galery, map, text); answers with results, empty or error; loading slow (4 s), once (7 s) or held, with Release.
  • Lists: loading, empty, no match, error with Retry, and paging (6 or 95 rows).
  • Dialogs:
    • page static or dynamic, page data reachable or not, a nested depth chain;
    • adding or editing;
    • "Change three fields" and a dirty close;
    • the next Save succeeds, or fails with errors, a server error, offline or a conflict;
    • "Save from the Info tab, and it fails".
  • Resource stack: shallow (3), deep (9), with Show more; opened at the centre, the corners and the edges, or via the path selector.
  • Toasts: each kind, Stack all five, the same toast twice.

In practice tab

A mock site page held in the real store. The header, ResourceManager and the layout/page overlay are mounted by the tab itself, never by a layout. While the tab is open it borrows $cwa:

  • cwaFetch.fetch is swapped for practice-transport.ts: writes go through the same fake adapter, /usage answers locally, and no GET reaches an API;
  • a fake admin user is set;
  • edit mode is on and presence starts with its send stubbed.

Everything is restored on unmount.

Controls:

  • Selected: Draft, Draft in a full group, Live, New publishable, New not publishable, Group, Empty group. This is the manager bar in each component state.
  • Next save: succeeds, or fails as above; Slow (4 s).
  • Editing the layout: the overlay switches.
  • Mia edits the text: peer outline and name flag.
  • Cloning the title: the clone bar, the source and target highlight.
  • Type a sentence for me, and Reselect.

Indicators:

  • Made:
    • the selection outline;
    • the shared-instance outline (the title is in two positions; the badge reads "Shared · 2 places");
    • peer outlines;
    • the page and layout overlay;
    • the empty-group placeholder;
    • the clone target highlight.
  • Not in the module yet: the save-state outline on the selection (saving band, and saved, error and conflict tints). ComponentFocus does not read field states, so this is a marked slot.

Slots left for 7b, 7c and 7d (KitSlot, data-kit-slot)

  • Search: the page type select (7b or 7d)
  • Dialogs: the page type line in the header (not in the module yet); the confirm dialog on the kit, and the phone sheet (7c)
  • In practice: the save-state outline (module); inline editing on the phone sheet and the confirm dialog on the kit (7c)

Left out, and why

  • The ClonePlacementMenu and the add component dialog: both wait on getComponentMetadata, which needs API docs the kit doesn't have.
  • Mercure: there is no hub. Presence is driven through Presence.receive.
  • CwaUiTextarea in the manager-row placement: the bar refuses it by design (a dev error), so the kit's manager-row placement leaves it out.

In practice: made usable without explanation

In practice was close to impossible to try out. What was wrong, and what changed:

  • It reset mid-use. Vite found new dependencies as admin modules loaded lazily, and reloaded the page. Fix: the playground's vite.optimizeDeps.include lists them; a clean-cache walk finds none.
  • The mock site was below the fold. Fix: the site comes first, with a side panel at 1024px and up, a "Try:" line per control, and the title selected from the start.
  • The status line didn't follow the selection. Fix: a live role="status" line follows it and shows the next-save setting.
  • A 412 showed a generic toast. Fix: RemoteChanges is connected, so it shows the real conflict popover ("changed by Mia", Use Mia's / Keep mine).
  • Page settings couldn't be opened. Fix: the displayed page is set, GETs return copies, and collection GETs list members; "Open page settings" opens the slide-over.
  • Smaller fixes: a dark site palette (the HTML component uses prose-invert), selecting the Group state through the stack index, and "Type a sentence for me" now typing into the bar.
  • Browser test: test/browser/kit-practice.spec.mjs (KIT_BASE) walks, at 1280 and 390: select, edit, Saved, a 500, Retry, right-click stack, page settings, close. It fails on any console error.

Kit problems the workbench exposed: all fixed here

  1. disabledReason on every kit field, through Field, first behind the field's ⓘ in the dark infoPanel popover. Select's reason moved there from the line under it. Spec: ui/disabled-reason.spec.ts, every field, bar and dialog.
  2. Dialog alert labels: a refused field on a tab not yet opened is listed by the label its tab declares (DialogTab.fields). It opens and marks that tab. The page dialog declares its Details and Routes fields.
  3. Segmented overflow: fixed by 7f. Rechecked: it fits in the sims' controls.
  4. ManagerTab overflow, fixed at the source. The scrolling row was static, so its fields' status lines and sr-only text took the tab root as their containing block and escaped the row's clipping (the page was 1096px wide at 390). The row is now relative. The kit's overflow-x: clip workarounds are gone, and bar-only demos (ImageSlots, InlineHandoff) sit in bar rows. A browser test checks the kit never scrolls sideways at 1280 or 390 with every sim in a manager row.
  5. Dialog type line: fixed by 7d. The dialog sim now shows it as a right slide-over, with the page type select in the header.
  6. Save-state outline, built in the module. ComponentFocus reads the selection's fieldStates, draft and live as one, through admin/save-outline.ts:
    • nothing while pending;
    • one clockwise sweep from the first send;
    • saved, held 1.18 s;
    • a held red error or amber conflict;
    • colour sets for a light or dark site behind it;
    • with reduced motion, colour only.
      It shows live in In practice. The segment's growth into the end colour is approximated by a glow, because the strips remount per phase.
  7. ClonePlacementMenu and AddComponentDialog without API docs: still left out (see above).
  8. The CwaUiTextarea error: it came only from the kit putting it in a bar. A spec now guards that InlineHandoff's Edit… dialog inside a manager tab renders the text area with no error.

The slots are filled with the page type select (search sim), the dialog's type line, the kit confirm (Delete page in the dialog sim) and the stack's phone sheet (Width 390).

Seen, not changed (outside this PR)

  • A 500 while the component is selected still raises the "Oops! There was a problem." toast (RequestErrors). Proposal §7.1 says no toast while selected.
  • The ResourceManager's dev check warns that the Title and Group tabs don't render CwaUiManagerTab at their root, though they do.
  • reka warns "DialogContent requires a DialogTitle" when a kit dialog opens. CwaUiDialog labels by aria-labelledby, not reka's DialogTitle.
  • vuejs-confirm-dialog's TransitionGroup warns "non-element root node" for the kit confirm.
  • /kit still boots auth, so GET <api>/me fails without the API.
  • Browser scenarios 56–59 (from the 7b merge) have no rehearsals yet.

Checks

  • pnpm run lint:fix: 0 errors.
  • pnpm run test: 338 files, 5956 passed.
  • Changed files type-check clean. test:types in this worktree also picks up the parent checkout, so its total says nothing about this branch.
  • pnpm run test:e2e: every guard passes. Entry is 164164 of 164702 B gzip; visitor preloads are 184633 of 185388 B.
  • pnpm run test:browser:
    • 54 passed;
    • 56–59 have no rehearsals (pre-existing);
    • 54 failed once in the full run and passed twice alone;
    • the kit specs (KIT_BASE): 17 passed.

No toast for a field's failed save (§7.1)

  • A save that fails through a field model's or an upload's onRequest shows in the field, the bar status and the selection's outline only. RequestErrors skips an error whose event carries onRequest, and every other failed request still toasts.
  • Spec in RequestErrors.spec.ts, mutation-checked: with the guard broken it fails.
  • In practice, kit-practice.spec.mjs covers a 500 from the bar Title field and one from the in-page title editor. Both show a red outline and "1 not saved" with no toast. With the guard broken, both fail with two "Oops!" matches.

Clicking an in-page editor starts the edit

  • Clicking CwaUiInlineEdit's text on a page used to ask "Edit the shared layout?", and the edit never started. The editor's click handler swaps the text for an input, and Vue redraws before the root's bubble listener runs. By then the clicked element is no longer in the page, so contains(e.target) read the click as a layout click.
  • CwaRootLayout (and In practice's mock site) now record page membership in a capture listener, while the target is still attached. They don't use composedPath(): happy-dom computes it live, so no unit spec could hold it.
  • New spec in CwaRootLayout.spec.ts: a click whose target its own handler removes is still page, for both click and contextmenu, plus a control case. It fails with the old check.
  • The In practice browser test now really clicks the in-page title and expects the input focused, with no confirm. With the old inSite it fails.

🤖 Generated with Claude Code

The sign-in, forgot password, reset password, verify email and confirm new
email pages use CwaUiInput, CwaUiButton and CwaUiAlert on the page surface.
CwaUiInput takes name, autocomplete and required, keeps a value the browser
filled in before hydration when it has autocomplete (#386), and shows invalid
as the error line below on a page or modal surface. The auth InputField is
removed. Budgets raised for the auth routes' new chunk names.
…success focused, autofill kept for v-model inputs only, AuthTemplate main optional, sentence-case copy (#471, #461)
# Conflicts:
#	CHANGELOG.md
#	test/e2e/entry-bundle-markers.mjs
#	test/e2e/visitor-page-preloads.mjs
…low sm the stack opens as a modal bottom sheet with its header and Close, the page behind inert, sharing the tree and its keys (#461)
…ayout/page switch, a file's delete, Purge this page's cache and the stranded group merge use the kit confirm; Delete for a component in several places is one confirm with Remove from this location only as its second, focused action; the stranded groups modal is a kit dialog with a kit select and buttons. ConfirmDialog and DeleteLocationsDialog are removed, and so are useCwaResourceUpload's bind and filenameInputModel (#461)
…the click point, with the title and notes as its header and each disabled option's reasons behind its ⓘ item; the scope question is the kit confirm; clone mode's Escape also leaves an open alertdialog or menu alone (#461)
…ata reachability again (solid 3px line in its colour, and the words beside the title), following the local page type before Save; the page type reads Static / Dynamic (#461)
…b's no-route state, saved with the page; a parent route's hold reads Inherited scheduled or Inherited not live (#461)
…e top again, instantly under reduced motion (#461)
…andoff in the bar opens the field's registered editor on the page (or a dialog with a textarea when there is none), useCwaInlineEditor registers an editor; CwaUiEditPlaceholder for an empty group, position or field in edit mode. The playground's Title, Image, HtmlContent and TipTap reference use them (#461)
…gs and Enable Navigation, the Cloning bar and the outdated notice use kit buttons and tokens; every loading spinner is CwaUiSpinner; list rows get Edit and View icon actions and round type dots; no dashed or dotted lines; the path selector keeps the whole clicked stack, anchors its innermost name over the selector's and opens without moving; the old CwaUiForm* components, DialogBox, the old admin form/list parts, usePopper, useCwaSelectInput, @headlessui/vue, @popperjs/core and vue-input-autowidth are removed (#461)
… the group placeholder snapshot shows CwaUiSpinner (#461)
# Conflicts:
#	src/runtime/templates/assets/cwa.css
#	src/runtime/templates/components/core/ComponentPlaceholder.vue
#	src/runtime/templates/components/core/ui/ResourceStack.vue
#	src/runtime/templates/components/main/ComponentGroup.spec.ts.snap
#	src/runtime/templates/components/main/ComponentGroup.vue
…der with its round dot, every kit dialog's header has its solid line (neutral unless the page type or page data reachability colours it), the depth chain sits under the header on every tab, and page data with no template says so (#461)
… motion and sections; fake save adapter on the real field-state functions (#461)
… or a /path or https URL, and Open in a new tab), replacing the TipTap reference's window.prompt; new links open in the same tab unless chosen (#461)
…he path selector on a phone while live editing is paused: the left group did not centre its items, so the 44px paused glyph pulled Edit 4px up; scenario 58 measures height and centre at 1280 and 390 with fine and coarse pointers (#461)
…d says close once it has; while its resource loads the header's colour line sweeps and then settles into the kind's colour, or danger when the load fails (#461)
# Conflicts:
#	CHANGELOG.md
#	src/runtime/templates/assets/cwa.css
#	src/runtime/templates/components/ui/Dialog.vue
#	src/tailwind/tailwind-cwa.css
…olidated branch, renumber 7c's new header scenario 58 to 63, and keep one changelog line per step
…reen: kit buttons grew to the 44px hit size on a coarse pointer and the selector stayed 36px (scenario 63)
…ment, clear of sticky rows, never on opening or for data, focus unchanged: CwaReveal in the page, page data, users and site settings dialogs, the Routes go-live date, Publish's schedule, a dynamic slot's field and either/or options (#461)
…ite settings, where CwaReveal keep leaves the crawler toggles mounted so a hidden change still counts (#461)
…out field wrap its label above its control, and the ImageAlt samples sit in a manager row (#461)
…ocus into the menu, closes on Escape (focus back to it) and on tabbing out; the header's focus order follows what is seen; Done asks before discarding a component not yet added; the hot spot is still under reduced motion; sign-in failures read in plain words, never the server's (#461)
…card the unpublished changes; the route at / is never offered a recommended path; an empty new route path asks for one and a path with a space is flagged and can't be saved; dialogs announce a save or create that worked; adding a route in page data's Routes tab no longer opens the route in the dialog's place (#461)
…a tablist, and editable editors are named (#461)

In edit mode a component's element is a tab stop named "<name> component": Enter or Space selects it through the click path, Shift+F10 or ContextMenu opens its resource stack, and F6 moves between it and the manager bar's selected tab. The bar's tabs are a named tablist with arrow, Home and End keys, controlling a tabpanel. useCwaInlineEditor names an unnamed editable editor as a multi-line textbox ("Content, Body Text"), which names the TipTap reference editor. A click inside a focusable component no longer counts as focus leaving the editor, so selecting still focuses TipTap and presence goes straight to editing. Browser scenario 64 reaches a rich-text component's Publish tab by keyboard alone; entry and visitor budgets rise 40 B for the keyboard access in ManageableResource.
# Conflicts:
#	CHANGELOG.md
#	test/e2e/entry-bundle-markers.mjs
#	test/e2e/visitor-page-preloads.mjs
…oins the Yjs session once it is added, so it never asks /_/collaboration_states for __new__, which the API answers with a 500 (#461)
… content's own section, so a depth tab loading a nested child page never scrolls the page dialog to its Parent page (#461)
…d no longer reads as filled in, and a spec keeps the placeholder at least 1.5:1 from the value (#461)
…e inline editor for multi-line text; beside its label, the label lines up with its first line (#461)
…a darker field fill with a darker hover, and a disabled field's value and placeholder stay readable at 3:1 instead of fading (#461)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant