Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

7.7 KB
Raw Blame
// ============================================
// COMMAND PALETTE (Ctrl+K)
// ============================================

.command-palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: $z-modal;
    display: flex;
    justify-content: center;
    padding-top: 15vh;
}

.command-palette {
    width: 560px;
    max-height: 460px;
    background: $bg-card;
    border: 1px solid $border-subtle;
    border-radius: $radius-overlay;
    box-shadow: $shadow-overlay;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: palette-enter 0.15s ease-out;

    @keyframes palette-enter {
        from {
            opacity: 0;
            transform: scale(0.96) translateY(-8px);
        }
        to {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }

    &__input-wrapper {
        display: flex;
        align-items: center;
        gap: $space-3;
        padding: $space-4 $space-5;
        border-bottom: 1px solid $border-subtle;
        color: $text-tertiary;

        svg {
            flex-shrink: 0;
        }
    }

    &__input {
        flex: 1;
        background: none;
        border: none;
        outline: none;
        font-size: $text-md;
        color: $text-primary;
        font-family: $font-main;

        &::placeholder {
            color: $text-tertiary;
        }
    }

    &__kbd {
        font-size: $text-xs;
        font-family: $font-main;
        padding: $space-hair $space-tight;
        background: $bg-hover;
        border: 1px solid $border-subtle;
        border-radius: $radius-badge;
        color: $text-tertiary;
        flex-shrink: 0;
    }

    &__results {
        flex: 1;
        overflow-y: auto;
        padding: $space-2 0;
    }

    &__empty {
        padding: $space-8 $space-5;
        text-align: center;
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__group {
        &:not(:first-child) {
            margin-top: $space-2;
        }
    }

    &__group-label {
        padding: $space-2 $space-5;
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        color: $text-tertiary;
    }

    &__item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: $space-2 $space-5;
        background: none;
        border: none;
        cursor: pointer;
        font-size: $text-base;
        color: $text-secondary;
        text-align: left;
        transition: background $transition-fast, color $transition-fast;

        &:hover,
        &--active {
            background: $bg-hover;
            color: $text-primary;
        }

        &--active {
            background: $bg-hover;
        }
    }

    &__item-label {
        font-weight: $font-weight-medium;
    }

    &__item-path {
        font-size: $text-xs;
        color: $text-tertiary;
        font-family: $font-mono;
    }
}

// --------------------------------------------
// Palette v2: omnisearch item rows rendered inside the cmdk
// .ui-command-item. Icon + label/sublabel body + optional external marker.
// --------------------------------------------
.command-palette__item-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: $text-tertiary;
}

.command-palette__item-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.command-palette__item-sublabel {
    font-size: $text-xs;
    color: $text-tertiary;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-palette__item-ext {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: $text-tertiary;
    opacity: 0.7;
}

.command-palette__footer {
    display: flex;
    align-items: center;
    gap: $space-4;
    padding: $space-2 $space-3;
    border-top: 1px solid $border-subtle;
    background: $bg-secondary;
}

.command-palette__hint {
    display: inline-flex;
    align-items: center;
    gap: $space-1;
    font-size: $text-xs;
    color: $text-tertiary;

    kbd {
        min-width: 16px;
        padding: 1px $space-tight;
        text-align: center;
        font-size: $text-xs;
        font-family: $font-mono;
        color: $text-secondary;
        background: $bg-hover;
        border: 1px solid $border-subtle;
        border-radius: $radius-badge;
    }
}

// The selected item's icon should follow the highlighted text color.
.ui-command-item[data-selected='true'] .command-palette__item-icon {
    color: $text-primary;
}

// Right-aligned mono annotation (e.g. a recipe's "5 steps").
.command-palette__item-meta {
    flex-shrink: 0;
    margin-inline-start: auto;
    color: $text-tertiary;
    font-size: $text-xs;
}

// --------------------------------------------
// Create tile grid — the palette's empty state leads with create targets as
// prototype pal-grid tiles, then the "+ n more" shelf expander.
// --------------------------------------------
.command-palette__create {
    [cmdk-group-items] {
        display: flex;
        flex-wrap: wrap;
        gap: $space-tight;
        padding: $space-hair $space-1 $space-2;
    }
}

.ui-command-item.command-palette__tile {
    position: relative;
    display: flex;
    flex: 0 0 118px;
    flex-direction: column;
    align-items: flex-start;
    gap: $space-2;
    padding: $space-3 $space-3 $space-3;
    border: 1px solid $border-subtle;
    border-radius: $radius-control;
    background: var(--surface);
    color: $text-secondary;
    font-size: $text-xs;

    &[data-selected='true'] {
        @include status-variant(var(--accent-bright), var(--accent-bg), var(--accent-dim));
    }

    .command-palette__tile-icon {
        display: grid;
        place-items: center;
        color: $text-tertiary;

        svg { width: 18px; height: 18px; }
    }

    &[data-selected='true'] .command-palette__tile-icon { color: var(--accent-bright); }

    .command-palette__tile-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .command-palette__tile-ext {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 11px;
        height: 11px;
        color: $text-tertiary;
    }

    &[data-selected='true'] .command-palette__tile-ext {
        color: var(--accent-bright);
        opacity: 0.65;
    }
}

.command-palette__more {
    display: flex;
    width: calc(100% - 8px);
    height: $control-sm;
    align-items: center;
    justify-content: center;
    gap: $space-2;
    margin: 0 $space-1 $space-tight;
    border: 1px dashed $border-default;
    border-radius: $radius-control;
    background: transparent;
    color: $text-tertiary;
    font-size: $text-xs;
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
    @include focus-ring();

    &:hover {
        border-color: $border-active;
        background: var(--surface);
        color: $text-primary;
    }
}

// --------------------------------------------
// Settings deep-link flash: a palette result lands on the
// exact card via ?focus=setting:<id>; useSettingFocus scrolls it into view and
// adds .is-setting-focused for ~2s. Token-based ring + brief background wash.
// --------------------------------------------
.is-setting-focused {
    scroll-margin-top: $space-6;
    animation: setting-focus-flash 2s ease-out;
    border-radius: $radius-control;
}

@keyframes setting-focus-flash {
    0% {
        box-shadow: $focus-ring;
        background-color: var(--accent-bg-soft);
    }
    70% {
        box-shadow: $focus-ring;
        background-color: var(--accent-bg-soft);
    }
    100% {
        box-shadow: 0 0 0 0 transparent; // geometry: end frame of the focus-ring flash
        background-color: transparent;
    }
}