wcl_wdoc 0.11.2-alpha

WCL documentation format — build structured docs with WCL, render to HTML
    export let widget_action_panel_button = (x, y, w, h, label, variant) => {
        let fill = variant == "primary" ? "var(--color-link)" : (variant == "outline" ? "none" : "var(--color-nav-bg)")
        let stroke = variant == "primary" ? "var(--color-link)" : (variant == "outline" ? "var(--color-link)" : "var(--color-nav-border)")
        let label_fill = variant == "primary" ? "#fff" : (variant == "outline" ? "var(--color-link)" : "currentColor")
        [
            { kind = "rect", x = x, y = y, width = w, height = h, rx = 6,
              fill = fill, stroke = stroke, stroke_width = 1.5 },
            { kind = "text", x = x, y = y, width = w, height = h,
              content = label, font_size = 13, fill = label_fill }
        ]
    }

    export let widget_action_panel = (b) => {
        let w = attr_or(b, "width", 220)
        let h = attr_or(b, "height", 220)
        let title = attr_or(b, "title", "Actions")
        let primary_label = attr_or(b, "primary_label", "Primary")
        let secondary_label = attr_or(b, "secondary_label", "")
        let tertiary_label = attr_or(b, "tertiary_label", "")
        let primary_variant = attr_or(b, "primary_variant", "primary")
        let secondary_variant = attr_or(b, "secondary_variant", "secondary")
        let tertiary_variant = attr_or(b, "tertiary_variant", "outline")
        let surface_fill = attr_or(b, "surface_fill", "var(--color-bg)")
        let border_stroke = attr_or(b, "border_stroke", "var(--color-nav-border)")
        let title_fill = attr_or(b, "title_fill", "currentColor")
        let radius = attr_or(b, "radius", 8)
        let button_x = attr_or(b, "button_x", 15)
        let button_y = attr_or(b, "button_y", 45)
        let button_w = attr_or(b, "button_width", w - 30)
        let button_h = attr_or(b, "button_height", 34)
        let button_gap = attr_or(b, "button_gap", 11)
        let primary = primary_label != "" ? wdoc::widget_action_panel_button(button_x, button_y, button_w, button_h, primary_label, primary_variant) : []
        let secondary = secondary_label != "" ? wdoc::widget_action_panel_button(button_x, button_y + button_h + button_gap, button_w, button_h, secondary_label, secondary_variant) : []
        let tertiary = tertiary_label != "" ? wdoc::widget_action_panel_button(button_x, button_y + (button_h + button_gap) * 2, button_w, button_h, tertiary_label, tertiary_variant) : []
        concat(concat(concat([
            { kind = "rect", x = 0, y = 0, width = w, height = h, rx = radius,
              fill = surface_fill, stroke = border_stroke, stroke_width = 1.5 },
            { kind = "text", x = 12, y = 6, width = w - 24, height = 20,
              content = title, font_size = 14, anchor = "start", fill = title_fill },
            { kind = "line", x1 = 0, y1 = 30, x2 = w, y2 = 30,
              stroke = border_stroke, stroke_width = 1 }
        ], primary), secondary), tertiary)
    }