wcl_wdoc 0.11.2-alpha

WCL documentation format — build structured docs with WCL, render to HTML
1
2
3
4
5
6
7
8
9
10
11
12
    export let widget_toggle = (b) => {
        let w = attr_or(b, "width", 44)
        let h = attr_or(b, "height", 24)
        let on = attr_or(b, "on", "false") == "true"
        let bg = on ? attr_or(b, "on_fill", "var(--color-link)") : attr_or(b, "off_fill", "var(--color-nav-border)")
        let knob_fill = attr_or(b, "knob_fill", "#fff")
        let knob_x = on ? w - h + 2 : 2
        [
            { kind = "rect", x = 0, y = 0, width = w, height = h, rx = h / 2, fill = bg },
            { kind = "circle", x = knob_x, y = 2, r = (h - 6) / 2, fill = knob_fill }
        ]
    }