DataTable replaces the 20-line Table scaffold entirely: columns, sorting, filtering, pagination, selection, bulk actions, comparison layout, sticky first column, custom HTML cells, and a remote source driven by a `request` output rather than a function prop (props travel as HTML attributes, so a function arrives as its own source text). Toaster replaces the hand-rolled status div: tone icons, actions, hover pause/resume and a progress bar. Overlays audit -- Modal and Drawer declared aria-modal="true" but nothing ever moved focus into the panel, so the @keydown handler on their root never ran and closeOnEscape did nothing. Focus, focus restore, a Tab trap and a body scroll lock now live in the reactive runtime, shared by both. ContextMenu placed pointer menus by subtracting a guessed 340x420 from the viewport, which pushed every menu that was not that size away from the pointer; it now positions at the pointer and lets the anchored clamp pull it back once it can be measured. The reactive runtime size budget moves 150k -> 175k to cover anchored overlays, dialog behaviour, the toaster and the DataTable client half. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
110 lines
16 KiB
Plaintext
110 lines
16 KiB
Plaintext
// Generated by scripts/generate-showcase.mjs. Do not edit directly.
|
|
page ToasterDetail {
|
|
layout = "showcase"
|
|
state playground_color = ctx.url.searchParams.get("pg_color") ?? "info"
|
|
state playground_size = ctx.url.searchParams.get("pg_size") ?? "default"
|
|
state playground_position = ctx.url.searchParams.get("pg_position") ?? "bottom-right"
|
|
state playground_duration = Number(ctx.url.searchParams.get("pg_duration") ?? "4500")
|
|
state playground_max = Number(ctx.url.searchParams.get("pg_max") ?? "4")
|
|
state playground_pauseOnHover = (ctx.url.searchParams.get("pg_pauseOnHover") ?? "true") === "true"
|
|
state playground_showIcon = (ctx.url.searchParams.get("pg_showIcon") ?? "true") === "true"
|
|
state playground_successIcon = ctx.url.searchParams.get("pg_successIcon") ?? ""
|
|
state playground_dangerIcon = ctx.url.searchParams.get("pg_dangerIcon") ?? ""
|
|
state playground_warningIcon = ctx.url.searchParams.get("pg_warningIcon") ?? ""
|
|
state playground_infoIcon = ctx.url.searchParams.get("pg_infoIcon") ?? ""
|
|
state playground_closable = (ctx.url.searchParams.get("pg_closable") ?? "true") === "true"
|
|
state playground_showProgress = (ctx.url.searchParams.get("pg_showProgress") ?? "true") === "true"
|
|
state playground_closeLabel = ctx.url.searchParams.get("pg_closeLabel") ?? "Toaster"
|
|
state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1"
|
|
seo {
|
|
title = "Toaster"
|
|
description = "Reusable toaster component."
|
|
}
|
|
view {
|
|
<nav class="docs-breadcrumbs" aria-label="Breadcrumb">
|
|
<a href="/">Components</a><span aria-hidden="true">/</span><a href="/core">Core</a><span aria-hidden="true">/</span><span>Toaster</span>
|
|
</nav>
|
|
<header class="detail-hero">
|
|
<div class="detail-hero-copy">
|
|
<span class="showcase-eyebrow">Core component</span>
|
|
<h1>Toaster</h1>
|
|
<p>Reusable toaster component.</p>
|
|
<div class="detail-badges"><span>15 props</span><span>0 slots</span><span>3 outputs</span><span>Theme ready</span><span>Responsive</span></div>
|
|
</div>
|
|
<div class="detail-hero-icon"><span class="icon-[lucide--component] size-10" aria-hidden="true"></span></div>
|
|
</header>
|
|
<section id="playground" class="detail-section playground-section" data-playground data-playground-component="Toaster" data-playground-public-tag="true" data-playground-has-slot="false" data-playground-events="show,dismiss,action">
|
|
<div class="detail-section-heading"><span>Interactive playground</span><h2>Configure Toaster</h2><p>Change any prop and inspect the server-rendered component immediately.</p></div>
|
|
<div class="playground-workbench">
|
|
<div class="playground-preview">
|
|
<div class="demo-browser-chrome"><span></span><span></span><span></span><small>Live preview</small></div>
|
|
<div class="playground-preview-source" data-playground-preview><Toaster color='{playground_color}' size='{playground_size}' position='{playground_position}' duration='{playground_duration}' max='{playground_max}' pauseOnHover='{playground_pauseOnHover}' showIcon='{playground_showIcon}' successIcon='{playground_successIcon}' dangerIcon='{playground_dangerIcon}' warningIcon='{playground_warningIcon}' infoIcon='{playground_infoIcon}' closable='{playground_closable}' showProgress='{playground_showProgress}' closeLabel='{playground_closeLabel}' class='{playground_class}' /></div>
|
|
<section class="playground-code" aria-label="Current component code">
|
|
<header><span><span class="icon-[lucide--code-2] size-4" aria-hidden="true"></span>Component code</span><button type="button" data-playground-copy><span class="icon-[lucide--copy] size-4" aria-hidden="true"></span>Copy</button></header>
|
|
<pre><code data-playground-code><Toaster
|
|
closeLabel="Toaster"
|
|
/></code></pre>
|
|
</section>
|
|
<div class="playground-status" data-playground-status aria-live="polite"></div>
|
|
<div class="playground-event-log" data-playground-event-log aria-live="polite"><strong>Event output</strong><span>Interact with the preview to inspect the typed <code>payload</code>.</span></div>
|
|
</div>
|
|
<form class="playground-controls" data-playground-form>
|
|
<header><div><span>Component props</span><strong>15 controls</strong></div><button type="reset"><span class="icon-[lucide--rotate-ccw] size-4" aria-hidden="true"></span>Reset</button></header>
|
|
<div class="playground-fields"><label class="playground-field" for="playground-toaster-color"><span><strong>color</strong><small>string</small></span><select id="playground-toaster-color" name="pg_color"><option value="info" selected>info</option><option value="primary">primary</option><option value="secondary">secondary</option><option value="success">success</option><option value="warning">warning</option><option value="danger">danger</option></select></label><label class="playground-field" for="playground-toaster-size"><span><strong>size</strong><small>string</small></span><select id="playground-toaster-size" name="pg_size"><option value="default" selected>default</option><option value="sm">sm</option><option value="lg">lg</option><option value="xs">xs</option><option value="md">md</option><option value="xl">xl</option><option value="icon">icon</option><option value="icon-xs">icon-xs</option><option value="icon-sm">icon-sm</option><option value="icon-lg">icon-lg</option></select></label><label class="playground-field" for="playground-toaster-position"><span><strong>position</strong><small>string</small></span><select id="playground-toaster-position" name="pg_position"><option value="bottom-right" selected>bottom-right</option><option value="top-left">top-left</option><option value="top-center">top-center</option><option value="top-right">top-right</option><option value="bottom-left">bottom-left</option><option value="bottom-center">bottom-center</option><option value="top">top</option><option value="right">right</option><option value="bottom">bottom</option><option value="left">left</option><option value="start">start</option><option value="end">end</option><option value="center">center</option></select></label><label class="playground-field" for="playground-toaster-duration"><span><strong>duration</strong><small>number</small></span><input id="playground-toaster-duration" name="pg_duration" type="number" value="4500" /></label><label class="playground-field" for="playground-toaster-max"><span><strong>max</strong><small>number</small></span><input id="playground-toaster-max" name="pg_max" type="number" value="4" /></label><label class="playground-toggle" for="playground-toaster-pauseOnHover"><span><strong>pause On Hover</strong><small>boolean</small></span><input id="playground-toaster-pauseOnHover" name="pg_pauseOnHover" type="checkbox" value="true" checked data-playground-boolean /><i aria-hidden="true"></i></label><label class="playground-toggle" for="playground-toaster-showIcon"><span><strong>show Icon</strong><small>boolean</small></span><input id="playground-toaster-showIcon" name="pg_showIcon" type="checkbox" value="true" checked data-playground-boolean /><i aria-hidden="true"></i></label><label class="playground-field" for="playground-toaster-successIcon"><span><strong>success Icon</strong><small>string</small></span><input id="playground-toaster-successIcon" name="pg_successIcon" type="text" value="" /></label><label class="playground-field" for="playground-toaster-dangerIcon"><span><strong>danger Icon</strong><small>string</small></span><input id="playground-toaster-dangerIcon" name="pg_dangerIcon" type="text" value="" /></label><label class="playground-field" for="playground-toaster-warningIcon"><span><strong>warning Icon</strong><small>string</small></span><input id="playground-toaster-warningIcon" name="pg_warningIcon" type="text" value="" /></label><label class="playground-field" for="playground-toaster-infoIcon"><span><strong>info Icon</strong><small>string</small></span><input id="playground-toaster-infoIcon" name="pg_infoIcon" type="text" value="" /></label><label class="playground-toggle" for="playground-toaster-closable"><span><strong>closable</strong><small>boolean</small></span><input id="playground-toaster-closable" name="pg_closable" type="checkbox" value="true" checked data-playground-boolean /><i aria-hidden="true"></i></label><label class="playground-toggle" for="playground-toaster-showProgress"><span><strong>show Progress</strong><small>boolean</small></span><input id="playground-toaster-showProgress" name="pg_showProgress" type="checkbox" value="true" checked data-playground-boolean /><i aria-hidden="true"></i></label><label class="playground-field" for="playground-toaster-closeLabel"><span><strong>close Label</strong><small>string</small></span><input id="playground-toaster-closeLabel" name="pg_closeLabel" type="text" value="Toaster" /></label><label class="playground-field" for="playground-toaster-class"><span><strong>class</strong><small>string</small></span><input id="playground-toaster-class" name="pg_class" type="text" value="showcase-instance showcase-instance--1" /></label></div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
<div class="detail-layout">
|
|
<main class="detail-content">
|
|
<section class="detail-section"><div class="detail-section-heading"><span>Live examples</span><h2>Designed for real product surfaces</h2><p>Compare configurations and resize the browser to check responsive behavior.</p></div><div class="demo-list">
|
|
<article class="demo-case">
|
|
<header class="demo-case-header">
|
|
<div><span class="demo-case-eyebrow">Recommended</span><h2>Raise notifications from anywhere</h2><p>Mount one host, then call toast() from any client function. Each tone brings its own icon and colour, and hovering the stack holds a toast open while you read it. Actions here show label-only for brevity; attach onClick/onAction handlers from a functions{} block.</p></div>
|
|
<span class="demo-case-number">01</span>
|
|
</header>
|
|
<div class="demo-workbench">
|
|
<div id="toaster-demo-1" class="demo-canvas demo-canvas--1">
|
|
<div class="demo-browser-chrome"><span></span><span></span><span></span><small>Live preview</small></div>
|
|
|
|
<div class="demo-render"><div class="showcase-toast-demo"><button type="button" @click='toast.success("Your changes are live", { title: "Published" })'>success</button><button type="button" @click='toast.error("We could not reach the server", { title: "Network error" })'>danger</button><button type="button" @click='toast.warning("Your trial ends in 3 days", { title: "Heads up", icon: "icon-[lucide--hourglass]" })'>warning + custom icon</button><button type="button" @click='toast.info("Export queued")'>info</button><button type="button" @click='toast("Note deleted", { title: "Deleted", actionLabel: "Undo" })'>one action</button><button type="button" @click='toast.warning("This file changed elsewhere", { title: "Conflict", duration: 0, actions: [{ label: "Keep mine" }, { label: "Discard", tone: "danger" }] })'>two actions (sticky)</button><button type="button" @click='toast("No icon on this one", { icon: false })'>icon suppressed</button><button type="button" @click='toast.success("Gone in 1.5s", { duration: 1500 })'>short duration</button><button type="button" @click='toast.clear()'>clear all</button></div><Toaster size="default" position="bottom-right" duration="4500" max="4" pauseOnHover="true" showIcon="true" closable="true" showProgress="true" closeLabel="Toaster" class="showcase-instance showcase-instance--1" /></div>
|
|
</div>
|
|
<section class="demo-code" aria-label="Raise notifications from anywhere usage">
|
|
<header><span><span class="icon-[lucide--code-2] size-4" aria-hidden="true"></span>Component usage</span><small>.wrn</small></header>
|
|
<pre><code><Toaster
|
|
closeLabel="Toaster"
|
|
/></code></pre>
|
|
</section>
|
|
</div>
|
|
</article></div></section>
|
|
<section id="events" class="detail-section"><div class="detail-section-heading"><span>Component outputs</span><h2>Receive every typed component output</h2><p>Use declarative output handlers in <code>.wrn</code> files or register a direct output handler from JavaScript. The canonical API exposes <code>payload</code> and does not require <code>event.detail</code>.</p></div><div class="detail-events-grid"><div class="detail-events-list"><div><code>@show</code><span>Fires when the component emits the show event.</span></div><div><code>@dismiss</code><span>Fires after the announcement or feedback surface is dismissed.</span></div><div><code>@action</code><span>Fires when the component's primary or item action is activated.</span></div></div><div class="detail-event-examples"><section class="demo-code"><header><span><span class="icon-[lucide--braces] size-4" aria-hidden="true"></span>Declarative handlers</span><small>.wrn</small></header><pre><code><Toaster
|
|
@show='console.log(payload)'
|
|
@dismiss='console.log(payload)'
|
|
@action='console.log(payload)'
|
|
/></code></pre></section><section class="demo-code"><header><span><span class="icon-[lucide--radio] size-4" aria-hidden="true"></span>Direct output handlers</span><small>.js</small></header><pre><code>import <span>{</span> registerOutputHandler <span>}</span> from "@wrnexus/csr/outputs"
|
|
|
|
const component = document.querySelector("[data-ui-component=\"Toaster\"], [data-component=\"Toaster\"]")
|
|
|
|
if (component) registerOutputHandler(component, "show", (payload) => <span>{</span>
|
|
console.log("show", payload)
|
|
<span>}</span>)
|
|
|
|
if (component) registerOutputHandler(component, "dismiss", (payload) => <span>{</span>
|
|
console.log("dismiss", payload)
|
|
<span>}</span>)
|
|
|
|
if (component) registerOutputHandler(component, "action", (payload) => <span>{</span>
|
|
console.log("action", payload)
|
|
<span>}</span>)</code></pre></section></div></div></section>
|
|
<section id="api" class="detail-section"><div class="detail-section-heading"><span>Component API</span><h2>Props and configuration</h2><p>All content and behavior shown above is supplied through these props and slots.</p></div><div class="docs-table-wrap"><table class="docs-table"><thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td><code>color</code></td><td>string</td><td><code>"info"</code></td><td>No</td></tr><tr><td><code>size</code></td><td>string</td><td><code>"default"</code></td><td>No</td></tr><tr><td><code>position</code></td><td>string</td><td><code>"bottom-right"</code></td><td>No</td></tr><tr><td><code>duration</code></td><td>number</td><td><code>4500</code></td><td>No</td></tr><tr><td><code>max</code></td><td>number</td><td><code>4</code></td><td>No</td></tr><tr><td><code>pauseOnHover</code></td><td>boolean</td><td><code>true</code></td><td>No</td></tr><tr><td><code>showIcon</code></td><td>boolean</td><td><code>true</code></td><td>No</td></tr><tr><td><code>successIcon</code></td><td>string</td><td><code>""</code></td><td>No</td></tr><tr><td><code>dangerIcon</code></td><td>string</td><td><code>""</code></td><td>No</td></tr><tr><td><code>warningIcon</code></td><td>string</td><td><code>""</code></td><td>No</td></tr><tr><td><code>infoIcon</code></td><td>string</td><td><code>""</code></td><td>No</td></tr><tr><td><code>closable</code></td><td>boolean</td><td><code>true</code></td><td>No</td></tr><tr><td><code>showProgress</code></td><td>boolean</td><td><code>true</code></td><td>No</td></tr><tr><td><code>closeLabel</code></td><td>string</td><td><code>"Dismiss notification"</code></td><td>No</td></tr><tr><td><code>class</code></td><td>string</td><td><code>""</code></td><td>No</td></tr></tbody></table></div></section>
|
|
</main>
|
|
<aside class="detail-aside">
|
|
<div class="detail-toc"><strong>On this page</strong><a href="#playground">Playground</a><a href="#toaster-demo-1">Raise notifications from anywhere</a><a href="#events">Outputs</a><a href="#api">Props API</a></div>
|
|
</aside>
|
|
</div>
|
|
<nav class="detail-pagination">
|
|
<a href="/components/preference-switcher"><small>Previous</small><strong>← Preference Switcher</strong></a>
|
|
<span></span>
|
|
</nav>
|
|
}
|
|
}
|