Files
WRNexusJS/packages/ui/components/Section.wrn
T
ClintchizandClaude Opus 5 c7ab605e85
Quality / quality (ubuntu-latest) (push) Failing after 12m21s
Quality / quality (windows-latest) (push) Canceled after 0s
feat(ui): migrate the page and section components, add the layout tour
Section, SectionHeader and PublicPageShell move onto wire-* classes with
local style blocks, variants as data attributes. SectionHeader loses 38
utility lines, and Section stops spending one line per variant and colour
pairing: tinted and solid now select on two attributes. PageHeader was already
on the convention and only needed the audit.

examples/basic-app/app/pages/layout.wrn composes the whole set into one page.

Building it surfaced a library-wide bug. Ten custom properties were referenced
by components and defined by nothing: --wire-color-focus, --wire-color-surface-soft,
--wire-color-on-danger, --wire-color-surface-subtle and the input-* family,
plus hover and contrast for every semantic colour except primary and
secondary. An undefined custom property does not warn, it resolves to nothing,
so focus rings drew with no colour and every soft surface rendered
transparent -- 27 components referenced surface-soft alone. They are derived
in the theme now, and a test checks every token a component references against
the rendered theme CSS rather than the source, since most are generated.

The semantic spread also had to move ahead of the primary and secondary
entries so the palette keeps winning for those two.

Known and unresolved: LayoutSplitter emits its sizeChange output and the
component does fire it, but a parent binding on the tag is not invoked. The
tour page therefore points at the handle aria-valuenow rather than wiring a
handler that would never update. Outputs work elsewhere, so this is narrower
than an outputs-are-broken problem and needs its own investigation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 15:50:33 +05:30

133 lines
3.2 KiB
Plaintext

import Container from "./Container.wrn"
component Section {
props {
id: string = ""
size: string = "default"
color: string = "primary"
variant: string = "default"
spacing: string = "lg"
maxWidth: string = "xl"
fullWidth: boolean = false
borderTop: boolean = false
borderBottom: boolean = false
class: string = ""
}
view {
<section
{...attrs}
data-ui-component="Section"
class='wire-section {class}'
id='{id}'
data-size='{size}'
data-color='{color}'
data-variant='{variant}'
data-spacing='{spacing}'
data-border-top='{borderTop}'
data-border-bottom='{borderBottom}'
>
{#if fullWidth}
<slot></slot>
{:else}
<Container
columns="1"
gap="md"
maxWidth='{maxWidth}'
size='{size}'
color='{color}'
>
<slot></slot>
</Container>
{/if}
</section>
}
style {
.wire-section {
--section-tint: transparent;
--section-ink: inherit;
position: relative;
isolation: isolate;
width: 100%;
min-width: 0;
padding-block: 3rem;
background: var(--section-tint);
color: var(--section-ink);
}
.wire-section[data-spacing="sm"] {
padding-block: 2rem;
}
.wire-section[data-spacing="md"] {
padding-block: 3rem;
}
.wire-section[data-spacing="xl"] {
padding-block: 5rem;
}
.wire-section[data-variant="soft"] {
--section-tint: var(--wire-color-surface-soft);
}
.wire-section[data-variant="raised"] {
--section-tint: var(--wire-color-surface-raised);
}
/*
* tinted and solid pick their fill from the component colour, which is
* why these are two attributes rather than one class per pairing. The
* previous version spent a line on every variant and colour combination.
*/
.wire-section[data-variant="tinted"][data-color="primary"] {
--section-tint: var(--wire-color-primary-soft);
}
.wire-section[data-variant="tinted"][data-color="success"] {
--section-tint: var(--wire-color-success-soft);
}
.wire-section[data-variant="tinted"][data-color="warning"] {
--section-tint: var(--wire-color-warning-soft);
}
.wire-section[data-variant="tinted"][data-color="danger"] {
--section-tint: var(--wire-color-danger-soft);
}
.wire-section[data-variant="tinted"][data-color="info"] {
--section-tint: var(--wire-color-info-soft);
}
.wire-section[data-variant="solid"][data-color="primary"] {
--section-tint: var(--wire-color-primary);
--section-ink: var(--wire-color-on-primary);
}
.wire-section[data-variant="solid"][data-color="danger"] {
--section-tint: var(--wire-color-danger);
--section-ink: var(--wire-color-on-danger);
}
.wire-section[data-border-top="true"] {
border-top: 1px solid var(--wire-color-border);
}
.wire-section[data-border-bottom="true"] {
border-bottom: 1px solid var(--wire-color-border);
}
@media (min-width: 640px) {
.wire-section[data-spacing="lg"] {
padding-block: 5rem;
}
.wire-section[data-spacing="xl"] {
padding-block: 6rem;
}
}
}
}