component Badge { outputs { dismiss(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) } props { label: string = "Badge" size: string = "md" color: string = "primary" variant: string = "solid" shape: string = "pill" class: string = "" icon: string = "" iconPosition: string = "start" dot: boolean = false dotOnly: boolean = false dotLabel: string = "Status" animated: boolean = false avatarSrc: string = "" avatarAlt: string = "" dismissible: boolean = false dismissLabel: string = "Remove badge" truncate: boolean = false maxWidth: string = "12rem" anchorLabel: string = "" anchorIcon: string = "" placement: string = "inline" anchorLabelText: string = "Badge anchor" } state visible: boolean = true functions { // output.dismiss reaches a parent @dismiss binding; a raw dispatchEvent on // the root does not. The runtime registers parent handlers in a registry // that only the output proxy consults, so the CustomEvent this used to // build bubbled past every binding and was never seen by anyone. client function dismissBadge() { visible = false output.dismiss({ component: "Badge", label: label }) } } view { {#if anchorLabel || anchorIcon} {/if} {#if animated} {/if} {#if avatarSrc} {avatarAlt} {/if} {#if dot || dotOnly} {/if} {#if icon && iconPosition === "start"} {/if} {#if !dotOnly} {label} {/if} {#if icon && iconPosition === "end"} {/if} {#if dismissible} {/if} } }