Three separate problems, all traceable to `git add -A` sweeping up a working
tree I had not inspected.
Commit 69020b25 ("docs: make the component sections executable") committed far
more than docs: 79 files of a half-scaffolded inter-app example, and four of
those files were truncated mid-statement. That broke `bun run typecheck` on
main. The example is reverted to its last green six-file form. The truncated
fragments and the fuller working copy are NOT in this commit -- if any of that
workspace was wanted, it needs to be reconstructed deliberately and committed on
its own, not as a side effect of a docs change.
Separately, `scripts/generate-ui-complete-catalog.mjs` was run while checking
which helper scripts still work. It rewrites components in place, so it
flattened six of them to stubs, deleted 24 more and lower-cased four filenames
before crashing. Contents were restored from HEAD, but the renames survived
that restore: Windows is case-insensitive, so `git status` reported clean while
Card, Container, Divider and Grid sat on disk under the wrong names. The index
now tracks the capitalised names, which is what the components declare and what
ui-redesign-contract.test.ts reads -- that test would have failed on any
case-sensitive checkout.
Documented both as 4.7 and 4.8 in the remediation plan, with the general rule:
no script that rewrites packages/ui/components/ may write in place. Also fixes
the heading level on 4.6, which was rendering outside section 4.
bun run check is green: 1,433 pass, 0 fail.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
163 lines
3.9 KiB
Plaintext
163 lines
3.9 KiB
Plaintext
// Container -- a centred, width-limited page wrapper.
|
|
//
|
|
// <Container maxWidth="lg">...</Container>
|
|
//
|
|
// It also accepts columns and gap, because it always has and applications
|
|
// depend on it. Reach for Grid when a grid is the point; reach for Container
|
|
// when the point is the reading width.
|
|
//
|
|
// NOTE: the style block uses /* */ comments only -- // is not a CSS comment
|
|
// and silently swallows the rule that follows it.
|
|
component Container {
|
|
props {
|
|
size: string = "default"
|
|
color: string = "primary"
|
|
// Stays 2 to match what shipped. A published default cannot be changed
|
|
// without silently reflowing every Container already in use.
|
|
columns: number = 2
|
|
gap: string = "md"
|
|
maxWidth: string = "xl"
|
|
centered: boolean = true
|
|
class: string = ""
|
|
}
|
|
|
|
functions {
|
|
shared function columnCount() {
|
|
var value = Number(columns)
|
|
if (!value || value < 1) {
|
|
return 1
|
|
}
|
|
return Math.min(6, value)
|
|
}
|
|
}
|
|
|
|
view {
|
|
<div
|
|
{...attrs}
|
|
data-ui-component="Container"
|
|
class='wire-container {class}'
|
|
data-size='{size}'
|
|
data-color='{color}'
|
|
data-gap='{gap}'
|
|
data-max-width='{maxWidth}'
|
|
data-centered='{centered}'
|
|
data-columns='{columnCount()}'
|
|
>
|
|
<slot></slot>
|
|
</div>
|
|
}
|
|
|
|
style {
|
|
.wire-container {
|
|
--container-gap: 1.25rem;
|
|
width: 100%;
|
|
min-width: 0;
|
|
padding-inline: 1rem;
|
|
}
|
|
|
|
.wire-container[data-centered="true"] {
|
|
margin-inline: auto;
|
|
}
|
|
|
|
/* Reading widths, not breakpoints: the cap is about line length. */
|
|
.wire-container[data-max-width="md"] {
|
|
max-width: 48rem;
|
|
}
|
|
|
|
.wire-container[data-max-width="lg"] {
|
|
max-width: 64rem;
|
|
}
|
|
|
|
.wire-container[data-max-width="xl"],
|
|
.wire-container[data-max-width="wide"] {
|
|
max-width: 80rem;
|
|
}
|
|
|
|
.wire-container[data-max-width="2xl"] {
|
|
max-width: 96rem;
|
|
}
|
|
|
|
.wire-container[data-max-width="full"] {
|
|
max-width: none;
|
|
}
|
|
|
|
.wire-container[data-size="compact"] {
|
|
padding-inline: 1rem;
|
|
}
|
|
|
|
.wire-container[data-size="comfortable"] {
|
|
padding-inline: 1.25rem;
|
|
}
|
|
|
|
.wire-container[data-size="spacious"] {
|
|
padding-inline: 1.5rem;
|
|
}
|
|
|
|
.wire-container[data-gap="xs"] {
|
|
--container-gap: 0.5rem;
|
|
}
|
|
|
|
.wire-container[data-gap="sm"] {
|
|
--container-gap: 0.75rem;
|
|
}
|
|
|
|
.wire-container[data-gap="lg"] {
|
|
--container-gap: 2rem;
|
|
}
|
|
|
|
.wire-container[data-gap="xl"] {
|
|
--container-gap: 2.5rem;
|
|
}
|
|
|
|
/*
|
|
* Columns are opt-in. One column stays plain flow so a container does not
|
|
* quietly turn every page into a grid.
|
|
*/
|
|
.wire-container:not([data-columns="1"]) {
|
|
display: grid;
|
|
gap: var(--container-gap);
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
@media (min-width: 640px) {
|
|
.wire-container[data-columns="2"],
|
|
.wire-container[data-columns="3"],
|
|
.wire-container[data-columns="4"],
|
|
.wire-container[data-columns="5"],
|
|
.wire-container[data-columns="6"] {
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
}
|
|
|
|
.wire-container[data-size="default"],
|
|
.wire-container[data-size="comfortable"],
|
|
.wire-container[data-size="spacious"] {
|
|
padding-inline: 1.5rem;
|
|
}
|
|
}
|
|
|
|
@media (min-width: 1024px) {
|
|
.wire-container[data-columns="3"] {
|
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
}
|
|
|
|
.wire-container[data-columns="4"] {
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
}
|
|
|
|
.wire-container[data-columns="5"] {
|
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
}
|
|
|
|
.wire-container[data-columns="6"] {
|
|
grid-template-columns: repeat(6, minmax(0, 1fr));
|
|
}
|
|
|
|
.wire-container[data-size="default"],
|
|
.wire-container[data-size="comfortable"],
|
|
.wire-container[data-size="spacious"] {
|
|
padding-inline: 2rem;
|
|
}
|
|
}
|
|
}
|
|
}
|