Skip to content

Build your personal knowledge base with Trilium Notes

3.0 KB
Raw Blame
/*
 * The kind of an attribute, as the icon of what it is (a label or a relation), worn by the rows of
 * the attributes panel and by the rows of every list of attribute names, which are portalled to the
 * body and so scoped by the row rather than by a widget root.
 */
:is(.attribute-list-panel, .attr-name-suggestion) .attribute-kind {
    /* What the badge on the corner is punched out of: the surface the icon stands on. */
    --attribute-kind-cutout: var(--card-background-color, var(--main-background-color));
    position: relative;
    display: flex;
    flex-shrink: 0;
    color: var(--muted-text-color);
}

/*
 * A badge on the corner of the icon: a cog for the names Trilium reads for itself (settings of the note
 * rather than a word for it), a chevron for a definition of a promoted field (one lifted out of the
 * attributes and into the note's promoted attributes section). A second glyph rather than an icon of its own, so
 * `cssClass` still reads as the label it is, and a promoted date field as the date field it defines.
 */
:is(.attribute-list-panel, .attr-name-suggestion) .attribute-kind.marker-system::after,
:is(.attribute-list-panel, .attr-name-suggestion) .attribute-kind.marker-promoted::after {
    position: absolute;
    inset-inline-end: -3px;
    bottom: -2px;
    font-family: boxicons;
    font-size: 0.62em;
    font-weight: normal;
    line-height: 1;
    /* Punched out of the icon it sits on, so the two glyphs stay legible where they overlap. */
    text-shadow:
        0 0 2px var(--attribute-kind-cutout),
        0 0 2px var(--attribute-kind-cutout);
}

:is(.attribute-list-panel, .attr-name-suggestion) .attribute-kind.marker-system::after {
    content: "\ea6e"; /* lookup code for "cog" in boxicons.css */
}

:is(.attribute-list-panel, .attr-name-suggestion) .attribute-kind.marker-promoted::after {
    content: "\ea57"; /* lookup code for "chevron-up" in boxicons.css */
    /* A single stroke where the cog is a whole shape, so it is drawn a size up to weigh the same. */
    font-size: 0.8em;
    inset-inline-end: -4px;
    bottom: -4px;
}

/* One row of an attribute name completion: the kind, then the name. */
.attr-name-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attr-name-suggestion .attr-name-suggestion-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-autocomplete-dropdown .attr-name-suggestion .attribute-kind {
    --attribute-kind-cutout: var(--menu-background-color);
}

.form-autocomplete-dropdown .form-autocomplete-item.active .attr-name-suggestion .attribute-kind {
    --attribute-kind-cutout: var(--suggestion-active-background-color);
}

/* The text typed, as `.note-autocomplete-menu` shows the search's matches in NoteAutocomplete.css. */
.attr-name-suggestion .attr-name-suggestion-name b {
    background: var(--note-list-view-search-result-highlight-background, transparent);
    color: var(--note-list-view-search-result-highlight-color, var(--admonition-warning-accent-color));
    font-weight: inherit;
    text-decoration: underline;
}