GitHub

Example: UI kit and motion

Dialogs, menus, pickers, toasts, a data table and charts from pyweb.ui, plus staggered, layout, drag and shared-element animations.

  • 319 lines of Python
  • 1 page
  • 1 server function
  • 10393 B page JS (gzip)
localhost:8000 · live, 10393 B of page codeOpen ↗

#Source

examples/ui/app.pyweb
"""The UI kit and motion in one page: components, animations and data, all from Python.

Every component is a `.pyweb` file inside PyWeb: `pyweb ui add Dialog` copies one into your
app to change it. Colours come from the theme (`App(theme=...)`), animations from `Motion(...)`.
"""

from pyweb import App, server
from pyweb.motion import Motion
from pyweb.ui import *
from pyweb.ui import Theme, toast

app = App(title="UI kit and motion", stylesheets=["/static/app.css"], theme=Theme(accent="#6d5dfc", radius=10),
          motion=Motion(feel="snappy"))

FRAMEWORKS = ["PyWeb", "Django", "Flask", "FastAPI", "Streamlit", "Reflex"]
SALES = [{"month": "Jan", "revenue": 42}, {"month": "Feb", "revenue": 58}, {"month": "Mar", "revenue": 51},
         {"month": "Apr", "revenue": 74}, {"month": "May", "revenue": 69}, {"month": "Jun", "revenue": 91}]
PEOPLE = [{"id": 1, "name": "Ada Lovelace", "role": "Owner", "tasks": 12},
          {"id": 2, "name": "Grace Hopper", "role": "Admin", "tasks": 9},
          {"id": 3, "name": "Alan Turing", "role": "Member", "tasks": 15},
          {"id": 4, "name": "Katherine Johnson", "role": "Member", "tasks": 7},
          {"id": 5, "name": "Guido van Rossum", "role": "Viewer", "tasks": 3}]


@server
def notify(kind: str) -> None:
    """Toasts can come from the server: they ride on the answer to this call."""
    if kind == "saved":
        toast("Changes saved", "Your settings are up to date.", tone="success")
    else:
        toast("Something went wrong", "Nothing was changed. Try again.", tone="danger")


@app.page("/")
def Tour():
    dark = False
    volume = 40
    shown = True
    order = ["Plan", "Build", "Ship", "Learn"]
    picked = "Overview"
    framework = ""
    ran = ""

    def toggle_dark(e):
        dark = e.target.checked
        document.documentElement.dataset.theme = "dark" if dark else "light"

    def set_volume(e):
        volume = e.detail["value"]

    def pick_framework(e):
        framework = e.detail["value"]

    def run(name):
        ran = name

    def replay():
        shown = not shown

    def rotate():
        order = order[1:] + order[:1]

    def choose(name):
        picked = name

    <main>
        <header class="top">
            <div>
                <h1>UI kit and motion</h1>
                <p class="muted">Components like shadcn/ui, behaviour like Radix, animation like motion.dev: all Python.</p>
            </div>
            <div class="row">
                <Switch id="dark" label="Dark" onchange={toggle_dark} />
                <Tooltip text="Open the command palette">
                    <Kbd>⌘K</Kbd>
                </Tooltip>
            </div>
        </header>

        <Tabs default="components">
            <TabsList>
                <TabsTrigger value="components">Components</TabsTrigger>
                <TabsTrigger value="motion">Motion</TabsTrigger>
                <TabsTrigger value="data">Data</TabsTrigger>
            </TabsList>

            <TabsContent value="components">
                <div class="grid">
                    <Card>
                        <CardHeader>
                            <CardTitle>Buttons</CardTitle>
                            <CardDescription>Six variants, four sizes, links that look like buttons.</CardDescription>
                        </CardHeader>
                        <CardContent class_="row">
                            <Button>Default</Button>
                            <Button variant="secondary">Secondary</Button>
                            <Button variant="outline">Outline</Button>
                            <Button variant="ghost">Ghost</Button>
                            <Button variant="destructive">Delete</Button>
                            <Button loading={True}>Saving</Button>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Overlays</CardTitle>
                            <CardDescription>Focus is trapped and returned; Escape and outside clicks close.</CardDescription>
                        </CardHeader>
                        <CardContent class_="row">
                            <Dialog>
                                <DialogTrigger id="open-dialog">Open dialog</DialogTrigger>
                                <DialogContent>
                                    <DialogHeader>
                                        <DialogTitle>Edit profile</DialogTitle>
                                        <DialogDescription>Make changes here, then save.</DialogDescription>
                                    </DialogHeader>
                                    <label class="pw-field">Name <input class="pw-control" value="Ada Lovelace" /></label>
                                    <DialogFooter>
                                        <DialogClose>Cancel</DialogClose>
                                        <DialogClose variant="default" onclick={lambda: notify("saved")}>Save</DialogClose>
                                    </DialogFooter>
                                </DialogContent>
                            </Dialog>
                            <DropdownMenu>
                                <DropdownMenuTrigger>Menu</DropdownMenuTrigger>
                                <DropdownMenuContent>
                                    <MenuLabel>My account</MenuLabel>
                                    <MenuItem shortcut="⌘P">Profile</MenuItem>
                                    <MenuItem shortcut="⌘,">Settings</MenuItem>
                                    <MenuSeparator />
                                    <MenuItem>Sign out</MenuItem>
                                </DropdownMenuContent>
                            </DropdownMenu>
                            <Popover>
                                <PopoverTrigger>Popover</PopoverTrigger>
                                <PopoverContent arrow={True}>
                                    <p><b>Dimensions</b></p>
                                    <p class="muted">Placed next to its trigger; it flips when there's no room.</p>
                                </PopoverContent>
                            </Popover>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Toasts</CardTitle>
                            <CardDescription>From a server function, with ui.toast(...).</CardDescription>
                        </CardHeader>
                        <CardContent class_="row">
                            <Button id="toast-ok" variant="outline" onclick={lambda: notify("saved")}>Success</Button>
                            <Button variant="outline" onclick={lambda: notify("failed")}>Error</Button>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Pickers</CardTitle>
                            <CardDescription>Type to filter; arrows, Enter and Escape work.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <Combobox placeholder="Pick a framework…" onvaluechange={pick_framework} aria-label="Framework">
                                for f in FRAMEWORKS:
                                    <ComboboxOption value={f}>{f}</ComboboxOption>
                            </Combobox>
                            <p class="muted">Picked: <b id="framework">{framework or "nothing yet"}</b></p>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Controls</CardTitle>
                            <CardDescription>Real form fields underneath, so forms post them.</CardDescription>
                        </CardHeader>
                        <CardContent class_="stack">
                            <Slider value={volume} label="Volume" show_value={True} onvaluechange={set_volume} />
                            <Progress value={volume} label="Volume level" />
                            <Checkbox label="Email me about releases" checked={True} />
                            <RadioGroup name="plan" value="pro" options={[("free", "Free"), ("pro", "Pro"), ("team", "Team")]}
                                        orientation="horizontal" label="Plan" />
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Disclosure</CardTitle>
                            <CardDescription>Built on details and summary: it works without JavaScript.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <Accordion>
                                <AccordionItem value="a11y">
                                    <AccordionTrigger>Is it accessible?</AccordionTrigger>
                                    <AccordionContent>Yes: every part follows the WAI-ARIA patterns.</AccordionContent>
                                </AccordionItem>
                                <AccordionItem value="change">
                                    <AccordionTrigger>Can I change it?</AccordionTrigger>
                                    <AccordionContent>Theme, props, variants, CSS, or copy the source with pyweb ui add.</AccordionContent>
                                </AccordionItem>
                            </Accordion>
                        </CardContent>
                    </Card>
                </div>
            </TabsContent>

            <TabsContent value="motion">
                <div class="grid">
                    <Card>
                        <CardHeader>
                            <CardTitle>Stagger</CardTitle>
                            <CardDescription>A parent's label flows to its children, one after another.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <ul class="stagger" initial="hidden" animate={"show" if shown else "hidden"}
                                variants={{"hidden": {}, "show": {}}} transition={{"stagger_children": 0.06}}>
                                for step in ["Design", "Build", "Test", "Ship"]:
                                    <li variants={{"hidden": {"opacity": 0, "x": -16}, "show": {"opacity": 1, "x": 0}}}>{step}</li>
                            </ul>
                            <Button id="replay" variant="outline" size="sm" onclick={replay}>{"Hide" if shown else "Show"}</Button>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Gestures</CardTitle>
                            <CardDescription>Hover, press, and drag within the box.</CardDescription>
                        </CardHeader>
                        <CardContent class_="row">
                            <div class="tile" while_hover={{"scale": 1.08, "rotate": 3}} while_tap={{"scale": 0.94}}>Hover me</div>
                            <div class="drag-area">
                                <div id="ball" class="ball" drag drag_constraints="parent" drag_elastic={0.4}
                                     tabindex="0" aria-label="Drag me">Drag</div>
                            </div>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Layout</CardTitle>
                            <CardDescription>Rows glide to their new places when the order changes.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <ul id="order" class="order">
                                for step in order:
                                    <li layout>{step}</li>
                            </ul>
                            <Button id="rotate" variant="outline" size="sm" onclick={rotate}>Move the first to the end</Button>
                        </CardContent>
                    </Card>

                    <Card>
                        <CardHeader>
                            <CardTitle>Shared element</CardTitle>
                            <CardDescription>One underline, moving between tabs with layout_id.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <div class="seg" role="group" aria-label="Section">
                                for name in ["Overview", "Activity", "Settings"]:
                                    <button type="button" class="seg-item" aria-pressed={"true" if picked == name else "false"}
                                            onclick={lambda: choose(name)}>
                                        {name}
                                        if picked == name:
                                            <span class="underline" layout_id="underline"></span>
                                    </button>
                            </div>
                        </CardContent>
                    </Card>
                </div>
            </TabsContent>

            <TabsContent value="data">
                <div class="grid">
                    <Card class_="wide">
                        <CardHeader>
                            <CardTitle>Team</CardTitle>
                            <CardDescription>Search, sort and pages run in the browser; the first page is server-rendered.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <DataTable rows={PEOPLE} page_size={4} label="Team" columns={[
                                {"key": "name", "label": "Name"},
                                {"key": "role", "label": "Role"},
                                {"key": "tasks", "label": "Open tasks", "align": "end"},
                            ]} />
                        </CardContent>
                    </Card>
                    <Card>
                        <CardHeader>
                            <CardTitle>Revenue</CardTitle>
                            <CardDescription>SVG charts with no JavaScript.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <BarChart data={SALES} x="month" y="revenue" height={180} label="Revenue by month" />
                        </CardContent>
                    </Card>
                    <Card>
                        <CardHeader>
                            <CardTitle>Trend</CardTitle>
                            <CardDescription>A sparkline for small spaces.</CardDescription>
                        </CardHeader>
                        <CardContent>
                            <Sparkline values={[s["revenue"] for s in SALES]} width={240} height={60} area={True}
                                       label="Revenue trend" />
                        </CardContent>
                    </Card>
                </div>
            </TabsContent>
        </Tabs>

        <CommandDialog>
            <CommandInput placeholder="Search components…" />
            <CommandList>
                <CommandEmpty>Nothing found.</CommandEmpty>
                <CommandGroup heading="Components">
                    for name in ["Dialog", "Popover", "Combobox", "Data table", "Toast"]:
                        <CommandItem value={name} onclick={lambda: run(name)}>{name}</CommandItem>
                </CommandGroup>
            </CommandList>
        </CommandDialog>
        if ran:
            <p class="muted" id="ran">Command palette: {ran}</p>
    </main>

#What runs where

Output of pyweb inspect: every page variable, handler and server function, where it runs and why.

Output
page Tour  route=/
  browser  dark           reactive state: assigned in toggle_dark(); literal initial value
  browser  volume         reactive state: assigned in set_volume(); literal initial value
  browser  shown          reactive state: assigned in replay(); literal initial value
  browser  order          reactive state: assigned in rotate(); literal initial value
  browser  picked         reactive state: assigned in choose(); literal initial value
  browser  framework      reactive state: assigned in pick_framework(); literal initial value
  browser  ran            reactive state: assigned in run(); literal initial value
  browser  toggle_dark    event handler (compiled to JavaScript)
  browser  set_volume     event handler (compiled to JavaScript)
  browser  pick_framework event handler (compiled to JavaScript)
  browser  run            event handler (compiled to JavaScript)
  browser  replay         event handler (compiled to JavaScript)
  browser  rotate         event handler (compiled to JavaScript)
  browser  choose         event handler (compiled to JavaScript)
rpc POST /__pyweb/rpc/notify  (kind: str) -> None

#Generated JavaScript

The browser modules the compiler wrote (before minification). They import the shared runtime.

JavaScript
// Tour.js
import { h as $h, t as $t, dyn as $dyn, list as $list, when as $when, signal as $signal, computed as $computed, mount as $mount, onMount as $onMount, py as $py, rpc as $rpc, slot as $slot, onCleanup as $onCleanup, spreadProps as $spreadProps } from "./runtime.js";
// controls.pyweb
const { Switch, Slider, Checkbox, RadioGroup } = (() => {
  function _num(x) {
    return ($py.eq(x, $py.int(x)) ? $py.str($py.int(x)) : $py.str($py.round(x, 2)));
  }
  function _options(options) {
    let o, out;
    out = [];
    for (o of $py.iter($py.or(options, () => []))) {
      if ($py.isinstance(o, ["list", "tuple"])) {
        $py.m(out, "append", [$py.str($py.at(o, 0)), $py.str($py.at(o, 1))]);
      } else {
        $py.m(out, "append", [$py.str(o), $py.str(o)]);
      }
    }
    return out;
  }
  function Switch($p) {
    const label = $p["label"] || (() => null);
    const checked = $p["checked"] || (() => false);
    const name = $p["name"] || (() => null);
    const value = $p["value"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const size = $p["size"] || (() => "md");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("label", {"class": "pw-check", "data-part": "root", "data-disabled": () => ($py.truth(disabled()) ? "" : null)}, () => [
        $h("input", {"type": "checkbox", "role": "switch", "class": "pw-switch", "data-part": "switch", "data-size": () => size(), "name": () => name(), "value": () => value(), "checked": () => checked(), "disabled": () => disabled(), "$spread9": () => attrs()}),
        $when(() => $py.truth(label()), () => [$h("span", {"data-part": "label"}, () => [$dyn(() => label())])]),
        $dyn(() => children())
      ])];
  }
  function Slider($p) {
    const value = $p["value"] || (() => 50);
    const min = $p["min"] || (() => 0);
    const max = $p["max"] || (() => 100);
    const step = $p["step"] || (() => 1);
    const name = $p["name"] || (() => null);
    const label = $p["label"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const show_value = $p["show_value"] || (() => false);
    const attrs = $p["$rest"] || (() => ({}));
    const fill = $computed(() => ((max() > min()) ? $py.mul($py.div((value() - min()), (max() - min())), 100) : 0));
    return [$h("div", {"class": "pw-slider", "data-pw-ui": "slider", "data-part": "root", "style": () => ({"--pw-fill": $py.add(_num(fill()), "%")})}, () => [
        $h("input", {"type": "range", "data-part": "input", "min": () => min(), "max": () => max(), "step": () => step(), "value": () => value(), "name": () => name(), "aria-label": () => label(), "disabled": () => disabled(), "$spread9": () => attrs()}),
        $when(() => $py.truth(show_value()), () => [$h("output", {"data-part": "value"}, () => [$dyn(() => value())])])
      ])];
  }
  function Checkbox($p) {
    const label = $p["label"] || (() => null);
    const checked = $p["checked"] || (() => false);
    const indeterminate = $p["indeterminate"] || (() => false);
    const name = $p["name"] || (() => null);
    const value = $p["value"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("label", {"class": "pw-check", "data-part": "root", "data-disabled": () => ($py.truth(disabled()) ? "" : null)}, () => [
        $h("input", {"type": "checkbox", "class": "pw-checkbox", "data-pw-ui": "checkbox", "data-part": "checkbox", "name": () => name(), "value": () => value(), "checked": () => checked(), "disabled": () => disabled(), "data-indeterminate": () => ($py.truth(indeterminate()) ? "true" : null), "$spread9": () => attrs()}),
        $when(() => $py.truth(label()), () => [$h("span", {"data-part": "label"}, () => [$dyn(() => label())])]),
        $dyn(() => children())
      ])];
  }
  function RadioGroup($p) {
    const name = $p["name"] || (() => null);
    const value = $p["value"] || (() => null);
    const options = $p["options"] || (() => null);
    const orientation = $p["orientation"] || (() => "vertical");
    const label = $p["label"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-radio-group", "data-pw-ui": "radio-group", "data-part": "root", "role": "radiogroup", "data-name": () => name(), "data-value": () => value(), "data-orientation": () => orientation(), "aria-label": () => label(), "$spread8": () => attrs()}, () => [
        $list(() => _options(options()), (o) => [$h("label", {"class": "pw-check", "data-part": "item"}, () => [
            $h("input", {"type": "radio", "class": "pw-radio", "name": () => name(), "value": $py.at(o, 0), "checked": () => $py.eq($py.at(o, 0), $py.str(value()))}),
            $h("span", {"data-part": "label"}, () => [$t($py.text($py.at(o, 1)))])
          ])]),
        $dyn(() => children())
      ])];
  }
  return { Switch, Slider, Checkbox, RadioGroup };
})();
// overlay.pyweb
const { Tooltip, Popover, PopoverTrigger, PopoverContent } = (() => {
  function Tooltip($p) {
    const text = $p["text"] || (() => null);
    const side = $p["side"] || (() => "top");
    const align = $p["align"] || (() => "center");
    const delay = $p["delay"] || (() => 500);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("span", {"class": "pw-tooltip-root", "data-pw-ui": "tooltip", "data-part": "root", "data-state": "closed", "data-side": () => side(), "data-align": () => align(), "data-delay": () => delay(), "$spread7": () => attrs()}, () => [
        $dyn(() => children()),
        $when(() => $py.truth(text()), () => [$h("span", {"class": "pw-tooltip", "data-part": "content", "data-state": "closed", "hidden": true}, () => [$dyn(() => text())])])
      ])];
  }
  function Popover($p) {
    const open = $p["open"] || (() => null);
    const side = $p["side"] || (() => "bottom");
    const align = $p["align"] || (() => "center");
    const offset = $p["offset"] || (() => 6);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    const state = $computed(() => ((open() == null) ? null : ($py.truth(open()) ? "true" : "false")));
    return [$h("div", {"class": "pw-popover-root", "data-pw-ui": "popover", "data-part": "root", "data-state": "closed", "data-open": () => state(), "data-side": () => side(), "data-align": () => align(), "data-offset": () => offset(), "$spread8": () => attrs()}, () => [$dyn(() => children())])];
  }
  function PopoverTrigger($p) {
    const variant = $p["variant"] || (() => "outline");
    const size = $p["size"] || (() => "md");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("button", {"type": "button", "class": "pw-button", "data-part": "trigger", "data-variant": () => variant(), "data-size": () => size(), "$spread5": () => attrs()}, () => [$dyn(() => children())])];
  }
  function PopoverContent($p) {
    const arrow = $p["arrow"] || (() => false);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-popover", "data-part": "content", "data-state": "closed", "tabindex": "-1", "hidden": true, "$spread5": () => attrs()}, () => [
        $dyn(() => children()),
        $when(() => $py.truth(arrow()), () => [$h("span", {"class": "pw-arrow", "data-part": "arrow", "aria-hidden": "true"})])
      ])];
  }
  return { Tooltip, Popover, PopoverTrigger, PopoverContent };
})();
// display.pyweb
const { Kbd, Progress } = (() => {
  function Kbd($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("kbd", {"class": "pw-kbd", "data-part": "kbd", "$spread2": () => attrs()}, () => [$dyn(() => children())])];
  }
  function Progress($p) {
    const value = $p["value"] || (() => null);
    const max = $p["max"] || (() => 100);
    const label = $p["label"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("progress", {"class": "pw-progress", "data-part": "progress", "value": () => value(), "max": () => max(), "aria-label": () => label(), "data-state": () => ((value() == null) ? "indeterminate" : "loading"), "$spread6": () => attrs()})];
  }
  return { Kbd, Progress };
})();
// disclosure.pyweb
const { Tabs, TabsList, TabsTrigger, TabsContent, Accordion, AccordionItem, AccordionTrigger, AccordionContent } = (() => {
  function _csv(value) {
    if ((value == null)) {
      return null;
    }
    if ($py.isinstance(value, ["list", "tuple"])) {
      return $py.m(",", "join", $py.iter(value).map((v) => ($py.str(v))));
    }
    return $py.str(value);
  }
  function Tabs($p) {
    const default_ = $p["default"] || (() => null);
    const value = $p["value"] || (() => null);
    const orientation = $p["orientation"] || (() => "horizontal");
    const activation = $p["activation"] || (() => "auto");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-tabs", "data-pw-ui": "tabs", "data-part": "root", "data-default": () => default_(), "data-value": () => value(), "data-controlled": () => ((value() == null) ? null : ""), "data-orientation": () => orientation(), "data-activation": () => activation(), "$spread8": () => attrs()}, () => [$dyn(() => children())])];
  }
  function TabsList($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-tabs-list", "data-part": "list", "role": "tablist", "$spread3": () => attrs()}, () => [$dyn(() => children())])];
  }
  function TabsTrigger($p) {
    const value = $p["value"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("button", {"type": "button", "class": "pw-tabs-trigger", "data-part": "trigger", "role": "tab", "data-value": () => value(), "disabled": () => disabled(), "$spread6": () => attrs()}, () => [$dyn(() => children())])];
  }
  function TabsContent($p) {
    const value = $p["value"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-tabs-content", "data-part": "content", "role": "tabpanel", "data-value": () => value(), "$spread4": () => attrs()}, () => [$dyn(() => children())])];
  }
  function Accordion($p) {
    const type = $p["type"] || (() => "single");
    const default_ = $p["default"] || (() => null);
    const value = $p["value"] || (() => null);
    const collapsible = $p["collapsible"] || (() => true);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-accordion", "data-pw-ui": "accordion", "data-part": "root", "data-type": () => type(), "data-default": () => _csv(default_()), "data-value": () => _csv(value()), "data-collapsible": () => ($py.truth(collapsible()) ? null : "false"), "$spread7": () => attrs()}, () => [$dyn(() => children())])];
  }
  function AccordionItem($p) {
    const value = $p["value"] || (() => null);
    const open = $p["open"] || (() => false);
    const disabled = $p["disabled"] || (() => false);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("details", {"class": "pw-accordion-item", "data-part": "item", "data-value": () => value(), "open": () => open(), "data-state": () => ($py.truth(open()) ? "open" : "closed"), "data-disabled": () => ($py.truth(disabled()) ? "" : null), "$spread6": () => attrs()}, () => [$dyn(() => children())])];
  }
  function AccordionTrigger($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("summary", {"class": "pw-accordion-trigger", "data-part": "trigger", "$spread2": () => attrs()}, () => [
        $h("span", null, () => [$dyn(() => children())]),
        $h("svg", {"class": "pw-chevron", "width": "14", "height": "14", "viewBox": "0 0 15 15", "aria-hidden": "true"}, () => [$h("path", {"d": "M4 6l3.5 3.5L11 6", "fill": "none", "stroke": "currentColor", "stroke-width": "1.5"})])
      ])];
  }
  function AccordionContent($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-accordion-content", "data-part": "content", "$spread2": () => attrs()}, () => [$h("div", {"data-part": "body"}, () => [$dyn(() => children())])])];
  }
  return { Tabs, TabsList, TabsTrigger, TabsContent, Accordion, AccordionItem, AccordionTrigger, AccordionContent };
})();
// card.pyweb
const { Card, CardHeader, CardTitle, CardDescription, CardContent } = (() => {
  function Card($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-card", "data-pw-ui": "card", "data-part": "card", "$spread3": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CardHeader($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"data-part": "header", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CardTitle($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("h3", {"data-part": "title", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CardDescription($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("p", {"data-part": "description", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CardContent($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"data-part": "content", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  return { Card, CardHeader, CardTitle, CardDescription, CardContent };
})();
// button.pyweb
const { Button } = (() => {
  function Button($p) {
    const variant = $p["variant"] || (() => "default");
    const size = $p["size"] || (() => "md");
    const type = $p["type"] || (() => "button");
    const href = $p["href"] || (() => null);
    const loading = $p["loading"] || (() => false);
    const disabled = $p["disabled"] || (() => false);
    const onclick = $p["onclick"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    const busy = $computed(() => ($py.truth(loading()) ? "true" : null));
    const part = $computed(() => $py.or($py.m(attrs(), "get", "data-part"), () => "button"));
    return [$when(() => $py.truth(href()), () => [$h("a", {"class": "pw-button", "data-part": () => part(), "data-variant": () => variant(), "data-size": () => size(), "href": () => href(), "aria-disabled": () => ($py.truth(disabled()) ? "true" : null), "onclick": (e) => { const f = onclick(); return f ? f(e) : undefined; }, "$spread7": () => attrs()}, () => [$dyn(() => children())])], () => [$h("button", {"class": "pw-button", "data-part": () => part(), "data-variant": () => variant(), "data-size": () => size(), "type": () => type(), "disabled": () => $py.or(disabled(), () => loading()), "aria-busy": () => busy(), "onclick": (e) => { const f = onclick(); return f ? f(e) : undefined; }, "$spread8": () => attrs()}, () => [
          $when(() => $py.truth(loading()), () => [$h("span", {"class": "pw-spinner", "aria-hidden": "true"})]),
          $dyn(() => children())
        ])])];
  }
  return { Button };
})();
// dialog.pyweb
const { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } = (() => {
  function Dialog($p) {
    const open = $p["open"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    const state = $computed(() => ((open() == null) ? null : ($py.truth(open()) ? "true" : "false")));
    return [$h("div", {"class": "pw-dialog-root", "data-pw-ui": "dialog", "data-part": "root", "data-state": "closed", "data-open": () => state(), "$spread5": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DialogTrigger($p) {
    const variant = $p["variant"] || (() => "default");
    const size = $p["size"] || (() => "md");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("button", {"type": "button", "class": "pw-button", "data-part": "trigger", "data-variant": () => variant(), "data-size": () => size(), "$spread5": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DialogContent($p) {
    const close_button = $p["close_button"] || (() => true);
    const size = $p["size"] || (() => "md");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("dialog", {"class": "pw-dialog", "data-part": "content", "data-state": "closed", "data-size": () => size(), "$spread4": () => attrs()}, () => [
        $dyn(() => children()),
        $when(() => $py.truth(close_button()), () => [$h("button", {"type": "button", "class": "pw-dialog-x", "data-part": "close", "aria-label": "Close"}, () => [$h("svg", {"width": "15", "height": "15", "viewBox": "0 0 15 15", "aria-hidden": "true"}, () => [$h("path", {"d": "M11.8 3.2 3.2 11.8M3.2 3.2l8.6 8.6", "stroke": "currentColor", "stroke-width": "1.5", "stroke-linecap": "round"})])])])
      ])];
  }
  function DialogHeader($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"data-part": "header", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DialogTitle($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("h2", {"data-part": "title", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DialogDescription($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("p", {"data-part": "description", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DialogFooter($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"data-part": "footer", "$spread1": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DialogClose($p) {
    const variant = $p["variant"] || (() => "outline");
    const size = $p["size"] || (() => "md");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("button", {"type": "button", "class": "pw-button", "data-part": "close", "data-variant": () => variant(), "data-size": () => size(), "$spread5": () => attrs()}, () => [$dyn(() => children())])];
  }
  return { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose };
})();
// menu.pyweb
const { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, MenuLabel, MenuItem, MenuSeparator } = (() => {
  function DropdownMenu($p) {
    const side = $p["side"] || (() => "bottom");
    const align = $p["align"] || (() => "start");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-menu-root", "data-pw-ui": "menu", "data-part": "root", "data-state": "closed", "data-side": () => side(), "data-align": () => align(), "$spread6": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DropdownMenuTrigger($p) {
    const variant = $p["variant"] || (() => "outline");
    const size = $p["size"] || (() => "md");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("button", {"type": "button", "class": "pw-button", "data-part": "trigger", "data-variant": () => variant(), "data-size": () => size(), "$spread5": () => attrs()}, () => [$dyn(() => children())])];
  }
  function DropdownMenuContent($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-menu", "data-part": "content", "data-state": "closed", "hidden": true, "$spread4": () => attrs()}, () => [$dyn(() => children())])];
  }
  function MenuLabel($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-menu-label", "data-part": "label", "role": "presentation", "$spread3": () => attrs()}, () => [$dyn(() => children())])];
  }
  function MenuItem($p) {
    const shortcut = $p["shortcut"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const keep_open = $p["keep_open"] || (() => false);
    const href = $p["href"] || (() => null);
    const onclick = $p["onclick"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$when(() => $py.truth(href()), () => [$h("a", {"class": "pw-menu-item", "data-part": "item", "href": () => href(), "aria-disabled": () => ($py.truth(disabled()) ? "true" : null), "onclick": (e) => { const f = onclick(); return f ? f(e) : undefined; }, "$spread5": () => attrs()}, () => [
          $dyn(() => children()),
          $when(() => $py.truth(shortcut()), () => [$h("span", {"class": "pw-menu-shortcut", "data-part": "shortcut"}, () => [$dyn(() => shortcut())])])
        ])], () => [$h("div", {"class": "pw-menu-item", "data-part": "item", "aria-disabled": () => ($py.truth(disabled()) ? "true" : null), "data-keep-open": () => ($py.truth(keep_open()) ? "" : null), "onclick": (e) => { const f = onclick(); return f ? f(e) : undefined; }, "$spread5": () => attrs()}, () => [
          $dyn(() => children()),
          $when(() => $py.truth(shortcut()), () => [$h("span", {"class": "pw-menu-shortcut", "data-part": "shortcut"}, () => [$dyn(() => shortcut())])])
        ])])];
  }
  function MenuSeparator($p) {
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-menu-separator", "data-part": "separator", "role": "separator", "$spread3": () => attrs()})];
  }
  return { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, MenuLabel, MenuItem, MenuSeparator };
})();
// command.pyweb
const { Combobox, ComboboxOption, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } = (() => {
  function Combobox($p) {
    const name = $p["name"] || (() => null);
    const value = $p["value"] || (() => null);
    const placeholder = $p["placeholder"] || (() => "Search\u2026");
    const filter = $p["filter"] || (() => "client");
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-combobox", "data-pw-ui": "combobox", "data-part": "root", "data-state": "closed", "data-value": () => value(), "data-filter": () => filter(), "$spread6": () => attrs()}, () => [
        $h("input", {"class": "pw-control", "data-part": "input", "placeholder": () => placeholder()}),
        $when(() => $py.truth(name()), () => [$h("input", {"type": "hidden", "data-part": "value-input", "name": () => name(), "value": () => $py.or(value(), () => "")})]),
        $h("div", {"class": "pw-menu pw-listbox", "data-part": "content", "data-state": "closed", "hidden": true}, () => [$dyn(() => children())])
      ])];
  }
  function ComboboxOption($p) {
    const value = $p["value"] || (() => null);
    const label = $p["label"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-option", "data-part": "option", "data-value": () => value(), "data-label": () => label(), "aria-disabled": () => ($py.truth(disabled()) ? "true" : null), "$spread5": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CommandDialog($p) {
    const shortcut = $p["shortcut"] || (() => "k");
    const open = $p["open"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    const state = $computed(() => ((open() == null) ? null : ($py.truth(open()) ? "true" : "false")));
    return [$h("div", {"class": "pw-dialog-root", "data-pw-ui": "dialog", "data-part": "root", "data-state": "closed", "data-open": () => state(), "data-shortcut": () => shortcut(), "$spread6": () => attrs()}, () => [$h("dialog", {"class": "pw-dialog pw-command-dialog", "data-part": "content", "data-state": "closed"}, () => [$h("div", {"class": "pw-command", "data-pw-ui": "command", "data-part": "command"}, () => [$dyn(() => children())])])])];
  }
  function CommandInput($p) {
    const placeholder = $p["placeholder"] || (() => "Type a command or search\u2026");
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-command-search", "data-part": "search"}, () => [
        $h("svg", {"width": "15", "height": "15", "viewBox": "0 0 15 15", "aria-hidden": "true"}, () => [
          $h("circle", {"cx": "6.5", "cy": "6.5", "r": "4.5", "fill": "none", "stroke": "currentColor", "stroke-width": "1.5"}),
          $h("path", {"d": "M10 10l3 3", "stroke": "currentColor", "stroke-width": "1.5"})
        ]),
        $h("input", {"data-part": "input", "placeholder": () => placeholder(), "aria-label": () => placeholder(), "$spread3": () => attrs()})
      ])];
  }
  function CommandList($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-command-list", "data-part": "list", "$spread2": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CommandEmpty($p) {
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-command-empty", "data-part": "empty", "hidden": true, "$spread3": () => attrs()}, () => [$dyn(() => children())])];
  }
  function CommandGroup($p) {
    const heading = $p["heading"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-command-group", "data-part": "group", "role": "group", "aria-label": () => heading(), "$spread4": () => attrs()}, () => [
        $when(() => $py.truth(heading()), () => [$h("div", {"class": "pw-menu-label", "data-part": "heading", "aria-hidden": "true"}, () => [$dyn(() => heading())])]),
        $dyn(() => children())
      ])];
  }
  function CommandItem($p) {
    const value = $p["value"] || (() => null);
    const keywords = $p["keywords"] || (() => null);
    const shortcut = $p["shortcut"] || (() => null);
    const disabled = $p["disabled"] || (() => false);
    const keep_open = $p["keep_open"] || (() => false);
    const onclick = $p["onclick"] || (() => null);
    const children = $p["children"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    return [$h("div", {"class": "pw-option", "data-part": "item", "data-value": () => value(), "data-keywords": () => keywords(), "aria-disabled": () => ($py.truth(disabled()) ? "true" : null), "data-keep-open": () => ($py.truth(keep_open()) ? "" : null), "onclick": (e) => { const f = onclick(); return f ? f(e) : undefined; }, "$spread7": () => attrs()}, () => [
        $dyn(() => children()),
        $when(() => $py.truth(shortcut()), () => [$h("span", {"class": "pw-menu-shortcut", "data-part": "shortcut"}, () => [$dyn(() => shortcut())])])
      ])];
  }
  return { Combobox, ComboboxOption, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem };
})();
// data.pyweb
const { DataTable } = (() => {
  function _columns(columns) {
    let c, key, out;
    out = [];
    for (c of $py.iter($py.or(columns, () => []))) {
      if ($py.isinstance(c, ["str"])) {
        c = {"key": c};
      }
      key = $py.at(c, "key");
      $py.m(out, "append", {"key": key, "label": $py.or($py.m(c, "get", "label"), () => $py.m($py.m($py.str(key), "replace", "_", " "), "capitalize")), "sortable": $py.m(c, "get", "sortable", true), "align": $py.or($py.m(c, "get", "align"), () => "start"), "format": $py.m(c, "get", "format"), "width": $py.m(c, "get", "width")});
    }
    return out;
  }
  function _text(value) {
    return ((value == null) ? "" : $py.str(value));
  }
  function _cell(row, col) {
    let f, value;
    value = $py.m(row, "get", $py.at(col, "key"));
    f = $py.at(col, "format");
    return _text(($py.truth(f) ? f(value) : value));
  }
  function _matches(row, cols, needle) {
    let c;
    for (c of $py.iter(cols)) {
      if ($py.contains($py.m(_cell(row, c), "lower"), needle)) {
        return true;
      }
    }
    return false;
  }
  function _sort_value(row, key) {
    let value;
    value = $py.m(row, "get", key);
    return [(value == null), ((value == null) ? 0 : value)];
  }
  function _csv_field(text) {
    if ($py.contains(["=", "+", "-", "@", "\t", "\r"], $py.slice(text, null, 1, null))) {
      text = $py.add("'", text);
    }
    if ($py.any($py.iter(",\"\n\r").map((ch) => ($py.contains(text, ch))))) {
      return $py.add($py.add("\"", $py.m(text, "replace", "\"", "\"\"")), "\"");
    }
    return text;
  }
  function _csv(rows, cols) {
    let lines, r;
    lines = [$py.m(",", "join", $py.iter(cols).map((c) => (_csv_field($py.at(c, "label")))))];
    for (r of $py.iter(rows)) {
      $py.m(lines, "append", $py.m(",", "join", $py.iter(cols).map((c) => (_csv_field(_cell(r, c))))));
    }
    return $py.add($py.m("\r\n", "join", lines), "\r\n");
  }
  function DataTable($p) {
    const rows = $p["rows"] || (() => null);
    const columns = $p["columns"] || (() => null);
    const key = $p["key"] || (() => "id");
    const page_size = $p["page_size"] || (() => 10);
    const search = $p["search"] || (() => true);
    const placeholder = $p["placeholder"] || (() => "Search\u2026");
    const selectable = $p["selectable"] || (() => false);
    const onselect = $p["onselect"] || (() => null);
    const empty = $p["empty"] || (() => "No results.");
    const caption = $p["caption"] || (() => null);
    const label = $p["label"] || (() => "Table");
    const export_ = $p["export"] || (() => null);
    const filename = $p["filename"] || (() => "export.csv");
    const attrs = $p["$rest"] || (() => ({}));
    const query = $signal("", "DataTable.query");
    const sort_key = $signal(null, "DataTable.sort_key");
    const descending = $signal(false, "DataTable.descending");
    const page = $signal(1, "DataTable.page");
    const picked = $signal([], "DataTable.picked");
    const cols = $computed(() => _columns(columns()));
    const needle = $computed(() => $py.m($py.m(query(), "strip"), "lower"));
    const shown = $computed(() => ($py.truth(needle()) ? $py.iter($py.or(rows(), () => [])).filter((r) => $py.truth(_matches(r, cols(), needle()))) : $py.list($py.or(rows(), () => []))));
    const ordered = $computed(() => ($py.truth(sort_key()) ? $py.sorted(shown(), $py.kw({"key": ((r) => (_sort_value(r, sort_key()))), "reverse": descending()})) : shown()));
    const pages = $computed(() => $py.max(1, $py.floordiv(($py.add($py.len(ordered()), page_size()) - 1), page_size())));
    const current = $computed(() => $py.min(page(), pages()));
    const visible = $computed(() => $py.slice(ordered(), $py.mul((current() - 1), page_size()), $py.mul(current(), page_size()), null));
    const page_keys = $computed(() => $py.iter(visible()).map((r) => ($py.m(r, "get", key()))));
    const on_page = $computed(() => $py.len($py.iter(page_keys()).filter((k) => $py.contains(picked(), k))));
    const first = $computed(() => ($py.truth(ordered()) ? $py.add($py.mul((current() - 1), page_size()), 1) : 0));
    const last = $computed(() => $py.min($py.mul(current(), page_size()), $py.len(ordered())));
    function sort_by(k) {
      if ($py.eq(sort_key(), k)) {
        if ($py.truth(descending())) {
          sort_key(null);
          descending(false);
        } else {
          descending(true);
        }
      } else {
        sort_key(k);
        descending(false);
      }
      page(1);
    }
    function search_for(e) {
      query(e.target.value);
      page(1);
    }
    function go(n) {
      page(n);
    }
    function download() {
      let link;
      link = document.createElement("a");
      link.href = URL.createObjectURL(new Blob([_csv(ordered(), cols())], {"type": "text/csv;charset=utf-8"}));
      link.download = filename();
      link.click();
    }
    function choose(keys) {
      picked(keys);
      if ($py.truth(onselect())) {
        onselect()(keys);
      }
    }
    function toggle(k) {
      choose(($py.contains(picked(), k) ? $py.iter(picked()).filter((x) => !$py.eq(x, k)) : $py.add(picked(), [k])));
    }
    function toggle_page() {
      let keys;
      keys = $py.iter(visible()).map((r) => ($py.m(r, "get", key())));
      if ($py.all($py.iter(keys).map((k) => ($py.contains(picked(), k))))) {
        choose($py.iter(picked()).filter((x) => !$py.contains(keys, x)));
      } else {
        choose($py.add(picked(), $py.iter(keys).filter((k) => !$py.contains(picked(), k))));
      }
    }
    return [$h("div", {"class": "pw-data-table", "data-part": "data-table", "$spread2": () => attrs()}, () => [
        $when(() => ($py.truth(search()) || $py.truth(export_())), () => [$h("div", {"data-part": "toolbar"}, () => [
            $when(() => $py.truth(search()), () => [$h("input", {"class": "pw-control", "data-part": "search", "type": "search", "placeholder": () => placeholder(), "aria-label": () => placeholder(), "value": () => query(), "oninput": search_for})]),
            $when(() => ($py.truth(selectable()) && $py.truth(picked())), () => [$h("span", {"class": "pw-muted", "data-part": "selection"}, () => [
                $dyn(() => $py.len(picked())),
                $t(" selected")
              ])]),
            $when(() => (export_() === "csv"), () => [$h("button", {"type": "button", "class": "pw-button", "data-variant": "outline", "data-size": "sm", "data-part": "export", "onclick": download}, () => [$t("Download CSV")])])
          ])]),
        $h("div", {"class": "pw-table-wrap", "data-pw-ui": "table", "data-part": "table-wrap"}, () => [$h("table", {"class": "pw-table", "data-part": "table", "aria-label": () => ($py.truth(caption()) ? null : label())}, () => [
            $when(() => $py.truth(caption()), () => [$h("caption", null, () => [$dyn(() => caption())])]),
            $h("thead", {"data-part": "header"}, () => [$h("tr", {"data-part": "row"}, () => [
                $when(() => $py.truth(selectable()), () => [$h("th", {"scope": "col", "data-part": "select", "class": "pw-table-select"}, () => [$h("input", {"type": "checkbox", "class": "pw-checkbox", "aria-label": "Select this page", "checked": () => ($py.bool(page_keys()) && $py.eq(on_page(), $py.len(page_keys()))), "data-indeterminate": () => (((0 < on_page()) && (on_page() < $py.len(page_keys()))) ? "true" : "false"), "data-pw-ui": "checkbox", "onclick": toggle_page})])]),
                $list(() => cols(), (c) => [$h("th", {"scope": "col", "data-part": "head", "data-align": $py.at(c, "align"), "style": ($py.truth($py.at(c, "width")) ? {"width": $py.at(c, "width")} : null), "aria-sort": () => ($py.eq(sort_key(), $py.at(c, "key")) ? ($py.truth(descending()) ? "descending" : "ascending") : null)}, () => [$when(() => $py.truth($py.at(c, "sortable")), () => [$h("button", {"type": "button", "class": "pw-table-sort", "data-part": "sort", "onclick": ((c) => (() => (sort_by($py.at(c, "key")))))(c)}, () => [
                        $t($py.text($py.at(c, "label"))),
                        $h("span", {"data-part": "sort-icon", "aria-hidden": "true"}, () => [$dyn(() => ($py.eq(sort_key(), $py.at(c, "key")) ? ($py.truth(descending()) ? "\u2193" : "\u2191") : "\u2195"))])
                      ])], () => [$t($py.text($py.at(c, "label")))])])])
              ])]),
            $h("tbody", {"data-part": "body"}, () => [
              $list(() => visible(), (r) => [$h("tr", {"data-part": "row", "data-state": () => ($py.contains(picked(), $py.m(r, "get", key())) ? "selected" : null)}, () => [
                  $when(() => $py.truth(selectable()), () => [$h("td", {"data-part": "select", "class": "pw-table-select"}, () => [$h("input", {"type": "checkbox", "class": "pw-checkbox", "aria-label": "Select row", "checked": () => $py.contains(picked(), $py.m(r, "get", key())), "onclick": ((r) => (() => (toggle($py.m(r, "get", key())))))(r)})])]),
                  $list(() => cols(), (c) => [$h("td", {"data-part": "cell", "data-align": $py.at(c, "align")}, () => [$t($py.text(_cell(r, c)))])])
                ])]),
              $when(() => !$py.truth(visible()), () => [$h("tr", {"data-part": "empty"}, () => [$h("td", {"colspan": () => $py.add($py.len(cols()), ($py.truth(selectable()) ? 1 : 0))}, () => [$dyn(() => empty())])])])
            ])
          ])]),
        $when(() => ((pages() > 1) || $py.truth(search())), () => [$h("div", {"data-part": "footer"}, () => [
            $h("span", {"class": "pw-muted", "aria-live": "polite"}, () => [
              $dyn(() => first()),
              $t("\u2013"),
              $dyn(() => last()),
              $t(" of "),
              $dyn(() => $py.len(ordered()))
            ]),
            $when(() => (pages() > 1), () => [$h("div", {"data-part": "pages"}, () => [
                $h("button", {"type": "button", "class": "pw-button", "data-variant": "outline", "data-size": "sm", "disabled": () => (current() <= 1), "onclick": (() => (go((current() - 1))))}, () => [$t("Previous")]),
                $h("span", {"class": "pw-muted"}, () => [
                  $t("Page "),
                  $dyn(() => current()),
                  $t(" of "),
                  $dyn(() => pages())
                ]),
                $h("button", {"type": "button", "class": "pw-button", "data-variant": "outline", "data-size": "sm", "disabled": () => (current() >= pages()), "onclick": (() => (go($py.add(current(), 1))))}, () => [$t("Next")])
              ])])
          ])])
      ])];
  }
  return { DataTable };
})();
// chart.pyweb
const { BarChart, Sparkline } = (() => {
  function _keys(y) {
    return ($py.isinstance(y, ["str"]) ? [y] : $py.list(y));
  }
  function _num(v) {
    return (($py.isinstance(v, ["int", "float"]) && !$py.isinstance(v, ["bool"])) ? v : 0);
  }
  function _nice(top) {
    let m, mag;
    if ((top <= 0)) {
      return 1;
    }
    mag = (10 ** Math.floor(Math.log10(top)));
    for (m of $py.iter([1, 2, 2.5, 5, 10])) {
      if ((top <= $py.mul(m, mag))) {
        return $py.mul(m, mag);
      }
    }
    return $py.mul(10, mag);
  }
  function _top(rows, keys, stacked) {
    let best, k, r;
    best = 0;
    for (r of $py.iter(rows)) {
      if ($py.truth(stacked)) {
        best = $py.max(best, $py.sum($py.iter(keys).map((k) => ($py.max(0, _num($py.m(r, "get", k)))))));
      } else {
        for (k of $py.iter(keys)) {
          best = $py.max(best, _num($py.m(r, "get", k)));
        }
      }
    }
    return _nice(best);
  }
  function _n(x) {
    let r;
    r = $py.round(x, 2);
    return ($py.eq(r, $py.int(r)) ? $py.str($py.int(r)) : $py.str(r));
  }
  function _pct(x) {
    return $py.add(_n(x), "%");
  }
  function _label(v, fmt) {
    return ($py.truth(fmt) ? $py.str(fmt(v)) : _n(v));
  }
  function _ticks(top, fmt, count = 4) {
    return $py.iter($py.range($py.add(count, 1))).map((i) => ({"pos": _n((100 - $py.div($py.mul(i, 100), count))), "y": _pct((100 - $py.div($py.mul(i, 100), count))), "text": _label($py.div($py.mul(top, i), count), fmt)}));
  }
  function _color(i, colors) {
    if ($py.truth(colors)) {
      return $py.at(colors, $py.mod(i, $py.len(colors)));
    }
    return $py.add($py.add("var(--pw-chart-", $py.str($py.add($py.mod(i, 5), 1))), ")");
  }
  function _bars(rows, x, keys, top, stacked, colors, fmt) {
    let band, base, h, i, j, left, n, out, r, v, width, y;
    n = $py.max(1, $py.len(rows));
    band = $py.div(100, n);
    width = ($py.truth(stacked) ? $py.mul(band, 0.7) : $py.div($py.mul(band, 0.7), $py.len(keys)));
    out = [];
    for (i of $py.iter($py.range($py.len(rows)))) {
      r = $py.at(rows, i);
      base = 0;
      for (j of $py.iter($py.range($py.len(keys)))) {
        v = $py.max(0, _num($py.m(r, "get", $py.at(keys, j))));
        h = $py.mul($py.div(v, top), 100);
        left = $py.add($py.add($py.mul(i, band), $py.mul(band, 0.15)), ($py.truth(stacked) ? 0 : $py.mul(j, width)));
        y = ((100 - base) - h);
        $py.m(out, "append", {"x": _n(left), "y": _n(y), "w": _n(width), "h": _n(h), "color": _color(j, colors), "title": $py.add($py.add($py.add($py.add($py.str($py.m(r, "get", x, "")), " \u00b7 "), $py.str($py.at(keys, j))), ": "), _label(v, fmt))});
        if ($py.truth(stacked)) {
          base = $py.add(base, h);
        }
      }
    }
    return out;
  }
  function _x_labels(rows, x, edge) {
    let every, i, n, out, pos;
    n = $py.len(rows);
    every = $py.max(1, Math.ceil((n / 10)));
    out = [];
    for (i of $py.iter($py.range(n))) {
      if (($py.mod(i, every) === 0)) {
        pos = ($py.truth(edge) ? ((n > 1) ? $py.mul($py.div(i, (n - 1)), 100) : 50) : $py.div($py.mul($py.add(i, 0.5), 100), n));
        $py.m(out, "append", {"x": _pct(pos), "text": $py.str($py.m($py.at(rows, i), "get", x, ""))});
      }
    }
    return out;
  }
  function BarChart($p) {
    const data = $p["data"] || (() => null);
    const x = $p["x"] || (() => "x");
    const y = $p["y"] || (() => "y");
    const height = $p["height"] || (() => 240);
    const stacked = $p["stacked"] || (() => false);
    const colors = $p["colors"] || (() => null);
    const label = $p["label"] || (() => null);
    const format = $p["format"] || (() => null);
    const legend = $p["legend"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    const rows = $computed(() => $py.list($py.or(data(), () => [])));
    const keys = $computed(() => _keys(y()));
    const top = $computed(() => _top(rows(), keys(), stacked()));
    const show_legend = $computed(() => ((legend() == null) ? ($py.len(keys()) > 1) : legend()));
    return [$h("figure", {"class": "pw-chart", "data-part": "chart", "data-kind": "bar", "style": () => ({"--pw-chart-height": $py.add($py.str(height()), "px")}), "$spread4": () => attrs()}, () => [
        $h("div", {"data-part": "plot"}, () => [
          $h("div", {"data-part": "y-axis", "aria-hidden": "true"}, () => [$list(() => _ticks(top(), format()), (t) => [$h("span", {"style": {"top": $py.at(t, "y")}}, () => [$t($py.text($py.at(t, "text")))])])]),
          $h("svg", {"viewBox": "0 0 100 100", "preserveAspectRatio": "none", "role": "img", "aria-label": () => $py.or(label(), () => "Bar chart")}, () => [
            $list(() => _ticks(top(), format()), (t) => [$h("line", {"data-part": "grid", "x1": "0", "x2": "100", "y1": $py.at(t, "pos"), "y2": $py.at(t, "pos")})]),
            $list(() => _bars(rows(), x(), keys(), top(), stacked(), colors(), format()), (b) => [$h("rect", {"data-part": "bar", "x": $py.at(b, "x"), "y": $py.at(b, "y"), "width": $py.at(b, "w"), "height": $py.at(b, "h"), "fill": $py.at(b, "color")}, () => [$h("title", null, () => [$t($py.text($py.at(b, "title")))])])])
          ]),
          $h("div", {"data-part": "x-axis", "aria-hidden": "true"}, () => [$list(() => _x_labels(rows(), x(), false), (t) => [$h("span", {"style": {"left": $py.at(t, "x")}}, () => [$t($py.text($py.at(t, "text")))])])])
        ]),
        $when(() => $py.truth(show_legend()), () => [$h("ul", {"class": "pw-chart-legend", "data-part": "legend"}, () => [$list(() => $py.range($py.len(keys())), (i) => [$h("li", null, () => [
                $h("span", {"data-part": "swatch", "style": () => ({"background": _color(i, colors())})}),
                $dyn(() => $py.at(keys(), i))
              ])])])]),
        $h("table", {"class": "pw-sr-only"}, () => [
          $h("caption", null, () => [$dyn(() => $py.or(label(), () => "Bar chart"))]),
          $h("thead", null, () => [$h("tr", null, () => [
              $h("th", {"scope": "col"}, () => [$dyn(() => x())]),
              $list(() => keys(), (k) => [$h("th", {"scope": "col"}, () => [$t($py.text(k))])])
            ])]),
          $h("tbody", null, () => [$list(() => rows(), (r) => [$h("tr", null, () => [
                $h("th", {"scope": "row"}, () => [$dyn(() => $py.m(r, "get", x(), ""))]),
                $list(() => keys(), (k) => [$h("td", null, () => [$dyn(() => _label(_num($py.m(r, "get", k)), format()))])])
              ])])])
        ])
      ])];
  }
  function Sparkline($p) {
    const values = $p["values"] || (() => null);
    const width = $p["width"] || (() => 120);
    const height = $p["height"] || (() => 32);
    const area = $p["area"] || (() => false);
    const color = $p["color"] || (() => null);
    const label = $p["label"] || (() => null);
    const attrs = $p["$rest"] || (() => ({}));
    const vals = $computed(() => $py.iter($py.or(values(), () => [])).map((v) => (_num(v))));
    const lo = $computed(() => ($py.truth(vals()) ? $py.min(vals()) : 0));
    const hi = $computed(() => ($py.truth(vals()) ? $py.max(vals()) : 1));
    const span = $computed(() => $py.or((hi() - lo()), () => 1));
    const n = $computed(() => $py.len(vals()));
    const d = $computed(() => $py.m(" ", "join", $py.iter($py.range(n())).map((i) => ($py.add($py.add($py.add(((i === 0) ? "M" : "L"), _n(((n() > 1) ? $py.mul($py.div(i, (n() - 1)), 100) : 50))), " "), _n((92 - $py.mul($py.div(($py.at(vals(), i) - lo()), span()), 84))))))));
    return [$h("svg", {"class": "pw-sparkline", "data-part": "sparkline", "width": () => width(), "height": () => height(), "viewBox": "0 0 100 100", "preserveAspectRatio": "none", "role": "img", "aria-label": () => $py.or(label(), () => $py.add("Trend: ", $py.m(", ", "join", $py.iter(vals()).map((v) => (_n(v)))))), "style": () => ($py.truth(color()) ? {"color": color()} : null), "$spread9": () => attrs()}, () => [
        $when(() => ($py.truth(area()) && (n() > 1)), () => [$h("path", {"data-part": "area", "d": () => $py.add(d(), " L100 100 L0 100 Z")})]),
        $h("path", {"data-part": "line", "d": () => d()})
      ])];
  }
  return { BarChart, Sparkline };
})();
const FRAMEWORKS = ["PyWeb", "Django", "Flask", "FastAPI", "Streamlit", "Reflex"];
const PEOPLE = [{"id": 1, "name": "Ada Lovelace", "role": "Owner", "tasks": 12}, {"id": 2, "name": "Grace Hopper", "role": "Admin", "tasks": 9}, {"id": 3, "name": "Alan Turing", "role": "Member", "tasks": 15}, {"id": 4, "name": "Katherine Johnson", "role": "Member", "tasks": 7}, {"id": 5, "name": "Guido van Rossum", "role": "Viewer", "tasks": 3}];
const SALES = [{"month": "Jan", "revenue": 42}, {"month": "Feb", "revenue": 58}, {"month": "Mar", "revenue": 51}, {"month": "Apr", "revenue": 74}, {"month": "May", "revenue": 69}, {"month": "Jun", "revenue": 91}];
function Tour($s) {
  const dark = $signal("dark" in $s ? $s["dark"] : false, "dark");
  const volume = $signal("volume" in $s ? $s["volume"] : 40, "volume");
  const shown = $signal("shown" in $s ? $s["shown"] : true, "shown");
  const order = $signal("order" in $s ? $s["order"] : ["Plan", "Build", "Ship", "Learn"], "order");
  const picked = $signal("picked" in $s ? $s["picked"] : "Overview", "picked");
  const framework = $signal("framework" in $s ? $s["framework"] : "", "framework");
  const ran = $signal("ran" in $s ? $s["ran"] : "", "ran");
  function toggle_dark(e) {
    dark(e.target.checked);
    document.documentElement.dataset.theme = ($py.truth(dark()) ? "dark" : "light");
  }
  function set_volume(e) {
    volume($py.at(e.detail, "value"));
  }
  function pick_framework(e) {
    framework($py.at(e.detail, "value"));
  }
  function run(name) {
    ran(name);
  }
  function replay() {
    shown(!$py.truth(shown()));
  }
  function rotate() {
    order($py.add($py.slice(order(), 1, null, null), $py.slice(order(), null, 1, null)));
  }
  function choose(name) {
    picked(name);
  }
  return [$h("main", null, () => [
      $h("header", {"class": "top"}, () => [
        $h("div", null, () => [
          $h("h1", null, () => [$t("UI kit and motion")]),
          $h("p", {"class": "muted"}, () => [$t("Components like shadcn/ui, behaviour like Radix, animation like motion.dev: all Python.")])
        ]),
        $h("div", {"class": "row"}, () => [
          Switch({"label": () => "Dark", "$rest": () => ({"id": "dark", "onchange": toggle_dark})}),
          Tooltip({"text": () => "Open the command palette", "children": () => [Kbd({"children": () => [$t("\u2318K")]})]})
        ])
      ]),
      Tabs({"default": () => "components", "children": () => [
        TabsList({"children": () => [
          TabsTrigger({"value": () => "components", "children": () => [$t("Components")]}),
          TabsTrigger({"value": () => "motion", "children": () => [$t("Motion")]}),
          TabsTrigger({"value": () => "data", "children": () => [$t("Data")]})
        ]}),
        TabsContent({"value": () => "components", "children": () => [$h("div", {"class": "grid"}, () => [
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Buttons")]}),
                CardDescription({"children": () => [$t("Six variants, four sizes, links that look like buttons.")]})
              ]}),
              CardContent({"children": () => [
                Button({"children": () => [$t("Default")]}),
                Button({"variant": () => "secondary", "children": () => [$t("Secondary")]}),
                Button({"variant": () => "outline", "children": () => [$t("Outline")]}),
                Button({"variant": () => "ghost", "children": () => [$t("Ghost")]}),
                Button({"variant": () => "destructive", "children": () => [$t("Delete")]}),
                Button({"loading": () => true, "children": () => [$t("Saving")]})
              ], "$rest": () => ({"class_": "row"})})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Overlays")]}),
                CardDescription({"children": () => [$t("Focus is trapped and returned; Escape and outside clicks close.")]})
              ]}),
              CardContent({"children": () => [
                Dialog({"children": () => [
                  DialogTrigger({"children": () => [$t("Open dialog")], "$rest": () => ({"id": "open-dialog"})}),
                  DialogContent({"children": () => [
                    DialogHeader({"children": () => [
                      DialogTitle({"children": () => [$t("Edit profile")]}),
                      DialogDescription({"children": () => [$t("Make changes here, then save.")]})
                    ]}),
                    $h("label", {"class": "pw-field"}, () => [
                      $t("Name "),
                      $h("input", {"class": "pw-control", "value": "Ada Lovelace"})
                    ]),
                    DialogFooter({"children": () => [
                      DialogClose({"children": () => [$t("Cancel")]}),
                      DialogClose({"variant": () => "default", "children": () => [$t("Save")], "$rest": () => ({"onclick": (() => (window.pywebUI.toast({"title": "Changes saved", "description": "Your settings are up to date.", "tone": "success"})))})})
                    ]})
                  ]})
                ]}),
                DropdownMenu({"children": () => [
                  DropdownMenuTrigger({"children": () => [$t("Menu")]}),
                  DropdownMenuContent({"children": () => [
                    MenuLabel({"children": () => [$t("My account")]}),
                    MenuItem({"shortcut": () => "\u2318P", "children": () => [$t("Profile")]}),
                    MenuItem({"shortcut": () => "\u2318,", "children": () => [$t("Settings")]}),
                    MenuSeparator({}),
                    MenuItem({"children": () => [$t("Sign out")]})
                  ]})
                ]}),
                Popover({"children": () => [
                  PopoverTrigger({"children": () => [$t("Popover")]}),
                  PopoverContent({"arrow": () => true, "children": () => [
                    $h("p", null, () => [$h("b", null, () => [$t("Dimensions")])]),
                    $h("p", {"class": "muted"}, () => [$t("Placed next to its trigger; it flips when there's no room.")])
                  ]})
                ]})
              ], "$rest": () => ({"class_": "row"})})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Toasts")]}),
                CardDescription({"children": () => [$t("From a server function, with ui.toast(...).")]})
              ]}),
              CardContent({"children": () => [
                Button({"variant": () => "outline", "onclick": () => (() => (window.pywebUI.toast({"title": "Changes saved", "description": "Your settings are up to date.", "tone": "success"}))), "children": () => [$t("Success")], "$rest": () => ({"id": "toast-ok"})}),
                Button({"variant": () => "outline", "onclick": () => (() => (window.pywebUI.toast({"title": "Something went wrong", "description": "Nothing was changed. Try again.", "tone": "danger"}))), "children": () => [$t("Error")]})
              ], "$rest": () => ({"class_": "row"})})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Pickers")]}),
                CardDescription({"children": () => [$t("Type to filter; arrows, Enter and Escape work.")]})
              ]}),
              CardContent({"children": () => [
                Combobox({"placeholder": () => "Pick a framework\u2026", "children": () => [$list(() => FRAMEWORKS, (f) => [ComboboxOption({"value": () => f, "children": () => [$t($py.text(f))]})])], "$rest": () => ({"onvaluechange": pick_framework, "aria-label": "Framework"})}),
                $h("p", {"class": "muted"}, () => [
                  $t("Picked: "),
                  $h("b", {"id": "framework"}, () => [$dyn(() => $py.or(framework(), () => "nothing yet"))])
                ])
              ]})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Controls")]}),
                CardDescription({"children": () => [$t("Real form fields underneath, so forms post them.")]})
              ]}),
              CardContent({"children": () => [
                Slider({"value": () => volume(), "label": () => "Volume", "show_value": () => true, "$rest": () => ({"onvaluechange": set_volume})}),
                Progress({"value": () => volume(), "label": () => "Volume level"}),
                Checkbox({"label": () => "Email me about releases", "checked": () => true}),
                RadioGroup({"name": () => "plan", "value": () => "pro", "options": () => [["free", "Free"], ["pro", "Pro"], ["team", "Team"]], "orientation": () => "horizontal", "label": () => "Plan"})
              ], "$rest": () => ({"class_": "stack"})})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Disclosure")]}),
                CardDescription({"children": () => [$t("Built on details and summary: it works without JavaScript.")]})
              ]}),
              CardContent({"children": () => [Accordion({"children": () => [
                  AccordionItem({"value": () => "a11y", "children": () => [
                    AccordionTrigger({"children": () => [$t("Is it accessible?")]}),
                    AccordionContent({"children": () => [$t("Yes: every part follows the WAI-ARIA patterns.")]})
                  ]}),
                  AccordionItem({"value": () => "change", "children": () => [
                    AccordionTrigger({"children": () => [$t("Can I change it?")]}),
                    AccordionContent({"children": () => [$t("Theme, props, variants, CSS, or copy the source with pyweb ui add.")]})
                  ]})
                ]})]})
            ]})
          ])]}),
        TabsContent({"value": () => "motion", "children": () => [$h("div", {"class": "grid"}, () => [
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Stagger")]}),
                CardDescription({"children": () => [$t("A parent's label flows to its children, one after another.")]})
              ]}),
              CardContent({"children": () => [
                $h("ul", {"class": "stagger", "data-pw-motion": () => JSON.stringify({"initial": "hidden", "animate": ($py.truth(shown()) ? "show" : "hidden"), "variants": {"hidden": {}, "show": {}}, "transition": {"stagger_children": 0.06}}), "style": () => ((i, s) => s)("hidden", null, {"hidden": {}, "show": {}}, ($py.truth(shown()) ? "show" : "hidden"))}, () => [$list(() => ["Design", "Build", "Test", "Ship"], (step) => [$h("li", {"data-pw-motion": JSON.stringify({"variants": {"hidden": {"opacity": 0, "x": (-16)}, "show": {"opacity": 1, "x": 0}}})}, () => [$t($py.text(step))])])]),
                Button({"variant": () => "outline", "size": () => "sm", "onclick": () => replay, "children": () => [$dyn(() => ($py.truth(shown()) ? "Hide" : "Show"))], "$rest": () => ({"id": "replay"})})
              ]})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Gestures")]}),
                CardDescription({"children": () => [$t("Hover, press, and drag within the box.")]})
              ]}),
              CardContent({"children": () => [
                $h("div", {"class": "tile", "data-pw-motion": JSON.stringify({"while_hover": {"scale": 1.08, "rotate": 3}, "while_tap": {"scale": 0.94}})}, () => [$t("Hover me")]),
                $h("div", {"class": "drag-area"}, () => [$h("div", {"id": "ball", "class": "ball", "data-pw-motion": JSON.stringify({"drag": true, "drag_constraints": "parent", "drag_elastic": 0.4}), "tabindex": "0", "aria-label": "Drag me"}, () => [$t("Drag")])])
              ], "$rest": () => ({"class_": "row"})})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Layout")]}),
                CardDescription({"children": () => [$t("Rows glide to their new places when the order changes.")]})
              ]}),
              CardContent({"children": () => [
                $h("ul", {"id": "order", "class": "order"}, () => [$list(() => order(), (step) => [$h("li", {"data-pw-motion": JSON.stringify({"layout": true})}, () => [$t($py.text(step))])])]),
                Button({"variant": () => "outline", "size": () => "sm", "onclick": () => rotate, "children": () => [$t("Move the first to the end")], "$rest": () => ({"id": "rotate"})})
              ]})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Shared element")]}),
                CardDescription({"children": () => [$t("One underline, moving between tabs with layout_id.")]})
              ]}),
              CardContent({"children": () => [$h("div", {"class": "seg", "role": "group", "aria-label": "Section"}, () => [$list(() => ["Overview", "Activity", "Settings"], (name) => [$h("button", {"type": "button", "class": "seg-item", "aria-pressed": () => ($py.eq(picked(), name) ? "true" : "false"), "onclick": (() => (choose(name)))}, () => [
                      $t($py.text(name)),
                      $when(() => $py.eq(picked(), name), () => [$h("span", {"class": "underline", "data-pw-motion": JSON.stringify({"layout_id": "underline"})})])
                    ])])])]})
            ]})
          ])]}),
        TabsContent({"value": () => "data", "children": () => [$h("div", {"class": "grid"}, () => [
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Team")]}),
                CardDescription({"children": () => [$t("Search, sort and pages run in the browser; the first page is server-rendered.")]})
              ]}),
              CardContent({"children": () => [DataTable({"rows": () => PEOPLE, "page_size": () => 4, "label": () => "Team", "columns": () => [{"key": "name", "label": "Name"}, {"key": "role", "label": "Role"}, {"key": "tasks", "label": "Open tasks", "align": "end"}]})]})
            ], "$rest": () => ({"class_": "wide"})}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Revenue")]}),
                CardDescription({"children": () => [$t("SVG charts with no JavaScript.")]})
              ]}),
              CardContent({"children": () => [BarChart({"data": () => SALES, "x": () => "month", "y": () => "revenue", "height": () => 180, "label": () => "Revenue by month"})]})
            ]}),
            Card({"children": () => [
              CardHeader({"children": () => [
                CardTitle({"children": () => [$t("Trend")]}),
                CardDescription({"children": () => [$t("A sparkline for small spaces.")]})
              ]}),
              CardContent({"children": () => [Sparkline({"values": () => $py.iter(SALES).map((s) => ($py.at(s, "revenue"))), "width": () => 240, "height": () => 60, "area": () => true, "label": () => "Revenue trend"})]})
            ]})
          ])]})
      ]}),
      CommandDialog({"children": () => [
        CommandInput({"placeholder": () => "Search components\u2026"}),
        CommandList({"children": () => [
          CommandEmpty({"children": () => [$t("Nothing found.")]}),
          CommandGroup({"heading": () => "Components", "children": () => [$list(() => ["Dialog", "Popover", "Combobox", "Data table", "Toast"], (name) => [CommandItem({"value": () => name, "onclick": () => (() => (run(name))), "children": () => [$t($py.text(name))]})])]})
        ]})
      ]}),
      $when(() => $py.truth(ran()), () => [$h("p", {"class": "muted", "id": "ran"}, () => [
          $t("Command palette: "),
          $dyn(() => ran())
        ])])
    ])];
}
$mount("Tour", Tour);
Edit this page on GitHub