import { Nine, Theme } from "base.slint";
import { Pieces } from "pieces.slint";

// style `frame` (l.5280): the raised window / panel surface, 4-px light-top ramp, 35 % black glow outside.
export component Frame {
    in property <bool> glow: true;
    if root.glow: Nine { x: -4px; y: -4px; width: root.width + 8px; height: root.height + 8px; source: Pieces.frame-default-shadow; }
    Nine { width: root.width; height: root.height; source: Pieces.frame-default-base; }
    @children
}

// Raised panel inside a window: the same graphical set without the outer glow.
export component Panel {
    Nine { width: root.width; height: root.height; source: Pieces.frame-default-base; }
}

// `inside_deep_frame` (l.5922): dark `#242324` well. Outer ramp 4 px outside the box, inner shadow over the face.
export component InsetPanel {
    Rectangle { width: root.width; height: root.height; background: Theme.list-bg; }
    Nine { x: -4px; y: -4px; width: root.width + 8px; height: root.height + 8px; source: Pieces.inside-deep-frame-default-base; }
    @children
    Nine { width: root.width; height: root.height; source: Pieces.inside-deep-frame-default-shadow; }
}

// `inside_shallow_frame` (l.6009): the details pane, `#403f40` face.
export component ShallowPanel {
    Nine { x: -4px; y: -4px; width: root.width + 8px; height: root.height + 8px; source: Pieces.inside-shallow-frame-default-base; }
    @children
    Nine { width: root.width; height: root.height; source: Pieces.inside-shallow-frame-default-shadow; }
}

// `scroll_pane` graphics (A(85,0)): the list frame inside the tabbed pane, same construction as InsetPanel.
export component ListFrame {
    in property <bool> inner-shadow: true;
    Rectangle { width: root.width; height: root.height; background: Theme.list-bg; }
    Nine { x: -4px; y: -4px; width: root.width + 8px; height: root.height + 8px; source: Pieces.mod-thumbnail-image-default-base; }
    @children
    if root.inner-shadow: Nine { width: root.width; height: root.height; source: Pieces.scroll-pane-default-shadow; }
}

// `subheader_frame` (l.5679): 36-px `#242324` strip with a dark bottom ramp and a soft shadow below it.
export component SubheaderFrame {
    Nine { y: 0px; width: root.width; height: root.height + 4px; source: Pieces.subheader-frame-default-shadow; }
    Nine { width: root.width; height: root.height; source: Pieces.subheader-frame-default-base; }
    @children
}

// `tabbed_pane_frame` (l.8433): the `#403f40` pane the tabs sit on; ramps top and bottom, glow above.
export component TabbedPaneFrame {
    Nine { y: -4px; width: root.width; height: root.height + 4px; source: Pieces.tabbed-pane-frame-default-shadow; }
    Nine { width: root.width; height: root.height; source: Pieces.tabbed-pane-frame-default-base; }
    @children
}

// `draggable_space(_header)` (l.8807): ribs, period 4 px (2 dark, 2 light), whole periods only, with the dirt glow
// 4 px around the whole box. Heights 24 (window title) and 32 (footer, same height as Back/Confirm) have cut tiles.
export component RibStrip {
    in property <bool> header: false;
    Nine { x: -4px; y: -4px; width: root.width + 8px; height: root.height + 8px; source: root.header ? Pieces.draggable-space-header-default-shadow : Pieces.draggable-space-default-shadow; }
    Image {
        x: 0px; y: 0px;
        width: floor(root.width / 4px) * 4px; height: root.height;
        source: root.height >= 32px ? Pieces.draggable-space-32-base : Pieces.draggable-space-24-base;
        horizontal-tiling: repeat;
        horizontal-alignment: left;
        image-fit: fill;
    }
}

// The window title: `frame_title` = heading-1 (Titillium Bold 18) in the caption colour.
export component FrameTitle inherits Text {
    color: Theme.caption;
    font-family: Theme.font;
    font-size: 18px;
    font-weight: 700;
    vertical-alignment: top;
    wrap: no-wrap;
}
