An output only reaches a parent @binding when the component calls output.<name>(). Two separate faults meant most of the library never got there, and both failed silently at each end. HTML lowercases attribute names, so a parent's @sizeChange registered under "sizechange" while the component emitted "sizeChange". The lookup missed, fell through to a DOM dispatch, and the binding was never invoked. That made all 17 camelCase outputs undeliverable -- DataTable.pageChange and .rowClick, Map.markerClick, ChatBubble.messageClick, LayoutSplitter.sizeChange and the rest. invokeComponentOutput now falls back to a case-insensitive lookup, and a csr test fails without it. Separately, 18 components dispatched hand-built CustomEvents rather than calling output.*. A bubbling event on the component's own root never reaches a binding, because parent handlers live in a registry only the output proxy reads. Card, Footer, Breadcrumb, Accordion, alert, Badge, AnnouncementBar, AvatarGroup, ToggleCount and InputNumber now emit properly; Marquee, Map, Timeline, List and SearchBox additionally declare the outputs they were already firing. Dispatches on window are left alone -- that is how Toaster, Modal and DataTable signal across component boundaries. Verified in a browser both ways before and after: an AnnouncementBar dispatching its own bubbling "dismiss" never reached a page-level @dismiss, and reached it immediately once it called output.dismiss(). This corrects the audit, which called the LayoutSplitter failure "narrow and unexplained" and read 32 dead outputs as 16 components needing a rebuild. "Outputs work elsewhere" was an assumption; the components that worked happened to use lowercase names and output.*. The dead-output ratchet drops from 32 to 22, and a new test forbids the raw-CustomEvent pattern outright. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
324 lines
9.9 KiB
Plaintext
324 lines
9.9 KiB
Plaintext
component Breadcrumb {
|
|
outputs {
|
|
select(payload: { value?: string | number | boolean | null; values?: Array<string | number | boolean | null | object>; sourceEvent?: Event; [key: string]: string | number | boolean | null | object } | string | number | boolean | null)
|
|
}
|
|
|
|
props {
|
|
label: string = "Breadcrumb"
|
|
items: unknown[] = []
|
|
active: string = ""
|
|
separator: string = "chevron"
|
|
showHome: boolean = false
|
|
homeLabel: string = "Home"
|
|
homeHref: string = "/"
|
|
homeIcon: string = "icon-[lucide--house]"
|
|
size: string = "default"
|
|
color: string = "primary"
|
|
variant: string = "minimal"
|
|
class: string = ""
|
|
}
|
|
|
|
view {
|
|
<nav
|
|
{...attrs}
|
|
data-ui-component="Breadcrumb"
|
|
data-size='{size}'
|
|
data-color='{color}'
|
|
data-variant='{variant}'
|
|
aria-label='{label}'
|
|
class='wire-breadcrumb {class}'
|
|
>
|
|
<ol class="wire-breadcrumb__list">
|
|
{#if showHome}
|
|
<li class="wire-breadcrumb__item wire-breadcrumb__item--home">
|
|
<a
|
|
href='{homeHref || "/"}'
|
|
class="wire-breadcrumb__link wire-breadcrumb__home"
|
|
@click='output.select({ item: { label: homeLabel, href: homeHref || "/", value: "home" }, itemIndex: -1 })'
|
|
>
|
|
{#if homeIcon === "icon-[lucide--house]"}
|
|
<span class="icon-[lucide--house] wire-breadcrumb__icon" aria-hidden="true"></span>
|
|
{:else if homeIcon}
|
|
<span class='{homeIcon} wire-breadcrumb__icon' aria-hidden="true"></span>
|
|
{/if}
|
|
|
|
<span class="wire-breadcrumb__home-label">{homeLabel}</span>
|
|
</a>
|
|
</li>
|
|
{/if}
|
|
|
|
{#each items as item, itemIndex}
|
|
<li
|
|
class="wire-breadcrumb__item"
|
|
data-current='{item.active || item.current || (active && active === (item.value || item.label || item.title)) || (!active && itemIndex === items.length - 1) ? "true" : "false"}'
|
|
>
|
|
{#if showHome || itemIndex > 0}
|
|
<span class="wire-breadcrumb__separator" aria-hidden="true">
|
|
{#if separator === "slash"}
|
|
<span>/</span>
|
|
{:else if separator === "dot"}
|
|
<span>•</span>
|
|
{:else if separator === "arrow"}
|
|
<span>→</span>
|
|
{:else}
|
|
<span class="icon-[lucide--chevron-right] wire-breadcrumb__separator-icon"></span>
|
|
{/if}
|
|
</span>
|
|
{/if}
|
|
|
|
{#if item.href && !item.disabled && !(item.active || item.current || (active && active === (item.value || item.label || item.title)) || (!active && itemIndex === items.length - 1))}
|
|
<a
|
|
href='{item.href}'
|
|
target='{item.target || ""}'
|
|
rel='{item.external ? "noopener noreferrer" : (item.rel || "")}'
|
|
class="wire-breadcrumb__link"
|
|
@click='output.select({ item: item, itemIndex: itemIndex })'
|
|
>
|
|
{#if item.icon}
|
|
<span class='{item.icon} wire-breadcrumb__icon' aria-hidden="true"></span>
|
|
{/if}
|
|
|
|
<span class="wire-breadcrumb__label">{item.label || item.title}</span>
|
|
|
|
{#if item.external}
|
|
<span class="icon-[lucide--arrow-up-right] wire-breadcrumb__external" aria-hidden="true"></span>
|
|
{/if}
|
|
</a>
|
|
{:else}
|
|
<span
|
|
class="wire-breadcrumb__current"
|
|
aria-current='{item.active || item.current || (active && active === (item.value || item.label || item.title)) || (!active && itemIndex === items.length - 1) ? "page" : "false"}'
|
|
aria-disabled='{item.disabled ? "true" : "false"}'
|
|
>
|
|
{#if item.icon}
|
|
<span class='{item.icon} wire-breadcrumb__icon' aria-hidden="true"></span>
|
|
{/if}
|
|
|
|
<span class="wire-breadcrumb__label">{item.label || item.title}</span>
|
|
</span>
|
|
{/if}
|
|
</li>
|
|
{/each}
|
|
</ol>
|
|
</nav>
|
|
}
|
|
|
|
style {
|
|
.wire-breadcrumb {
|
|
--breadcrumb-accent: var(--wire-color-primary);
|
|
--breadcrumb-soft: var(--wire-color-primary-soft);
|
|
--breadcrumb-muted: var(--wire-color-primary-muted);
|
|
--breadcrumb-text: var(--wire-color-primary-text);
|
|
|
|
min-width: 0;
|
|
color: var(--wire-color-text-muted);
|
|
}
|
|
|
|
.wire-breadcrumb[data-color="secondary"] {
|
|
--breadcrumb-accent: var(--wire-color-secondary);
|
|
--breadcrumb-soft: var(--wire-color-secondary-soft);
|
|
--breadcrumb-muted: var(--wire-color-secondary-muted);
|
|
--breadcrumb-text: var(--wire-color-secondary-text);
|
|
}
|
|
|
|
.wire-breadcrumb[data-color="info"] {
|
|
--breadcrumb-accent: var(--wire-color-info);
|
|
--breadcrumb-soft: var(--wire-color-info-soft);
|
|
--breadcrumb-muted: var(--wire-color-info-muted);
|
|
--breadcrumb-text: var(--wire-color-info-text);
|
|
}
|
|
|
|
.wire-breadcrumb[data-color="success"] {
|
|
--breadcrumb-accent: var(--wire-color-success);
|
|
--breadcrumb-soft: var(--wire-color-success-soft);
|
|
--breadcrumb-muted: var(--wire-color-success-muted);
|
|
--breadcrumb-text: var(--wire-color-success-text);
|
|
}
|
|
|
|
.wire-breadcrumb[data-color="warning"] {
|
|
--breadcrumb-accent: var(--wire-color-warning);
|
|
--breadcrumb-soft: var(--wire-color-warning-soft);
|
|
--breadcrumb-muted: var(--wire-color-warning-muted);
|
|
--breadcrumb-text: var(--wire-color-warning-text);
|
|
}
|
|
|
|
.wire-breadcrumb[data-color="danger"] {
|
|
--breadcrumb-accent: var(--wire-color-danger);
|
|
--breadcrumb-soft: var(--wire-color-danger-soft);
|
|
--breadcrumb-muted: var(--wire-color-danger-muted);
|
|
--breadcrumb-text: var(--wire-color-danger-text);
|
|
}
|
|
|
|
.wire-breadcrumb[data-variant="soft"] {
|
|
width: fit-content;
|
|
max-width: 100%;
|
|
padding: 0.45rem 0.65rem;
|
|
background: var(--breadcrumb-soft);
|
|
border: 1px solid var(--breadcrumb-muted);
|
|
border-radius: 0.75rem;
|
|
}
|
|
|
|
.wire-breadcrumb[data-variant="outline"] {
|
|
width: fit-content;
|
|
max-width: 100%;
|
|
padding: 0.45rem 0.65rem;
|
|
background: var(--wire-color-surface-raised);
|
|
border: 1px solid var(--wire-color-border);
|
|
border-radius: 0.75rem;
|
|
box-shadow: var(--wire-shadow-sm);
|
|
}
|
|
|
|
.wire-breadcrumb[data-variant="contrast"] {
|
|
color: rgba(255, 255, 255, 0.78);
|
|
}
|
|
|
|
.wire-breadcrumb__list {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0;
|
|
min-width: 0;
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow-x: auto;
|
|
list-style: none;
|
|
scrollbar-width: none;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.wire-breadcrumb__list::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.wire-breadcrumb__item {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
min-width: 0;
|
|
flex: 0 0 auto;
|
|
}
|
|
|
|
.wire-breadcrumb__separator {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-inline: 0.45rem;
|
|
color: var(--wire-color-text-subtle);
|
|
font-size: 0.75rem;
|
|
opacity: 0.72;
|
|
}
|
|
|
|
.wire-breadcrumb__separator-icon {
|
|
width: 0.9rem;
|
|
height: 0.9rem;
|
|
}
|
|
|
|
.wire-breadcrumb__link,
|
|
.wire-breadcrumb__current {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.4rem;
|
|
min-width: 0;
|
|
min-height: 2rem;
|
|
padding: 0.25rem 0.4rem;
|
|
border-radius: 0.55rem;
|
|
font-size: 0.8125rem;
|
|
line-height: 1.25rem;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.wire-breadcrumb[data-size="sm"] .wire-breadcrumb__link,
|
|
.wire-breadcrumb[data-size="sm"] .wire-breadcrumb__current {
|
|
min-height: 1.75rem;
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.wire-breadcrumb[data-size="lg"] .wire-breadcrumb__link,
|
|
.wire-breadcrumb[data-size="lg"] .wire-breadcrumb__current {
|
|
min-height: 2.25rem;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.wire-breadcrumb__link {
|
|
color: var(--wire-color-text-muted);
|
|
font-weight: 600;
|
|
transition:
|
|
color 160ms ease,
|
|
background 160ms ease;
|
|
}
|
|
|
|
.wire-breadcrumb__link:hover {
|
|
color: var(--breadcrumb-accent);
|
|
background: var(--breadcrumb-soft);
|
|
}
|
|
|
|
.wire-breadcrumb__link:focus-visible {
|
|
color: var(--breadcrumb-accent);
|
|
outline: 2px solid var(--breadcrumb-accent);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
.wire-breadcrumb__current {
|
|
max-width: 22rem;
|
|
color: var(--wire-color-text);
|
|
font-weight: 750;
|
|
}
|
|
|
|
.wire-breadcrumb__item[data-current="true"] .wire-breadcrumb__current {
|
|
color: var(--breadcrumb-text);
|
|
background: var(--breadcrumb-soft);
|
|
}
|
|
|
|
.wire-breadcrumb__current[aria-disabled="true"] {
|
|
opacity: 0.58;
|
|
}
|
|
|
|
.wire-breadcrumb__icon,
|
|
.wire-breadcrumb__external {
|
|
flex: 0 0 auto;
|
|
width: 0.95rem;
|
|
height: 0.95rem;
|
|
}
|
|
|
|
.wire-breadcrumb__home {
|
|
color: var(--breadcrumb-accent);
|
|
}
|
|
|
|
.wire-breadcrumb__label {
|
|
min-width: 0;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.wire-breadcrumb[data-variant="contrast"] .wire-breadcrumb__link,
|
|
.wire-breadcrumb[data-variant="contrast"] .wire-breadcrumb__current,
|
|
.wire-breadcrumb[data-variant="contrast"] .wire-breadcrumb__home {
|
|
color: inherit;
|
|
}
|
|
|
|
.wire-breadcrumb[data-variant="contrast"] .wire-breadcrumb__link:hover,
|
|
.wire-breadcrumb[data-variant="contrast"] .wire-breadcrumb__item[data-current="true"] .wire-breadcrumb__current {
|
|
color: #ffffff;
|
|
background: rgba(255, 255, 255, 0.12);
|
|
}
|
|
|
|
.wire-breadcrumb[data-variant="contrast"] .wire-breadcrumb__separator {
|
|
color: rgba(255, 255, 255, 0.62);
|
|
}
|
|
|
|
@media (max-width: 639px) {
|
|
.wire-breadcrumb__home-label {
|
|
display: none;
|
|
}
|
|
|
|
.wire-breadcrumb__current {
|
|
max-width: 13rem;
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.wire-breadcrumb__link {
|
|
transition: none;
|
|
}
|
|
}
|
|
}
|
|
}
|