+ utilities: load the button lib on the dev page - #244
Merged
Conversation
`scripts/dev/config-server.ts:145` skips the automatic `@zui/utilities` injection for `utilities` itself, and the lib had no `dev.ts`, so the harness fell back to `src/main.ts` and `@zui/button` never loaded. The seven `<button class="btn">` examples that `README.md` uses to demonstrate `state`, `active`, `selected` and `disabled` rendered with a transparent background and no radius — exactly what those examples exist to show. Add a `dev.ts` following `lib/label/dev.ts`, and declare `@zui/button` as a devDependency. This closes a workspace dependency cycle (`utilities` -> `button` -> `utilities`), so `pnpm install` now warns about cyclic workspace dependencies. The edge is dev-only and the declaration is accurate: the playground really does import the lib. `pnpm-lock.yaml` was hand-patched with only the `lib/utilities` -> `@zui/button` link rather than regenerated, since a bare `pnpm install` on this repo resolves unrelated floating ranges to newer versions.
`README.md` carried a `.blocks > .btn {padding: 0 0.75rem; height: 2rem}` rule
in its inline `<style>` block, hand-reproducing button geometry because
`@zui/button` never loaded on the dev page. The values match what the real lib
applies — `btn.css:2` sets `-px-3` and `-h-[--btn-height]`, with
`--btn-height: 2rem` — so the workaround is redundant now that `dev.ts` loads
the lib, and would otherwise fight `--btn-height` for any sized button.
catouse
marked this pull request as ready for review
August 31, 2026 02:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up B out of #240, whose follow-up list read: "
dev.tsis missing from 6 further libs (base,breadcrumb,button,checkbox,form-control,utilities)."That list was wrong. A missing
dev.tsis not a defect on its own —scripts/dev/config-server.ts:133-135falls back tosrc/main.ts, so a lib's own styles always load.dev.tsmatters only when a playground needs a demo dependency. Measured on the dev server:.btnon its dev pagebase,breadcrumb,checkbox,form-controlbuttonutilitiesFive of the six were phantom. This PR is the one that survives.
The defect
config-server.ts:145skips the automatic@zui/utilitiesinjection forutilitiesitself, and the lib had nodev.ts. So@zui/buttonnever loaded, and the seven<button class="btn">examples thatREADME.md:11-16,31uses to demonstratestate/active/selected/disabledrendered with a transparent background and no radius — exactly what those examples exist to show.README.md:701-704also carried a.blocks > .btn {padding: 0 0.75rem; height: 2rem}rule in its inline<style>, hand-faking the geometry. Those values are precisely what the real lib applies (btn.css:2→-px-3,-h-[--btn-height];vars.css:5→--btn-height: 2rem), so it is a workaround, and it would fight--btn-heightfor any sized button.After
::beforebtnrgb(241,245,249)btn activergb(241,245,249)btn selectedrgb(241,245,249)btn primaryrgb(59,130,246)btn primary activergb(59,130,246)rgba(0,0,0,.1)btn primary selectedrgb(59,130,246)rgba(255,255,255,.1)btn [disabled]rgb(241,245,249)display: none, opacity .7, cursornot-allowedBefore: transparent background, radius 0,
--btn-heightunset. The state effect is painted on::before(state.css), not the element background, which is where theactive/selecteddistinction lives. 0 console errors.Known cost: workspace dependency cycles
Declaring
@zui/buttoncloses a loop, becauseutilitiesis the base CSS layerbuttonbuilds on. The workspace goes from 0 cycles to 3:pnpm installnow prints[WARN] There are cyclic workspace dependencies: lib/avatar, lib/utilities, lib/buttonon every run. Confirmed absent ondev_optimizebefore this change.This was a deliberate choice.
vite.shared.ts:66aliases@zui/*tolib/*unconditionally, sodev.tsresolves@zui/buttonwith or without the declaration — the page renders identically either way, measured. Declaring it keeps the manifest honest and matcheslabel,formandtable, which all declare@zui/buttonfor exactly this purpose. All the edges are devDependencies.Lockfile
Hand-patched with only the
lib/utilities→@zui/buttonlink (+3 lines), thenpnpm install --frozen-lockfile, which accepted it with no drift. A barepnpm installon this repo resolves unrelated floating ranges to newer versions — 35 packages are currently behind, several by a major.Validation
pnpm checkgreen (lint, typecheck, 9 test files / 60 tests, 4 skill tests). Dev page verified in Chromium.Independent of #240 and of the other follow-ups — no file overlap.