zotero/scss/components/_item-tree.scss

341 lines
6.9 KiB
SCSS
Raw Normal View History

2023-10-06 12:08:44 +00:00
@use "sass:map";
#zotero-items-pane-container {
min-width: $min-width-items-pane;
height: 150px;
min-height: $min-height-items-pane;
}
#zotero-items-pane {
min-width: $min-width-items-pane;
}
2023-11-28 08:29:55 +00:00
#zotero-items-tree {
.virtualized-table-body, .drag-image-container {
padding: 4px 8px 8px;
2023-11-28 08:29:55 +00:00
}
.virtualized-table-body {
scrollbar-color: var(--color-scrollbar) var(--color-scrollbar-background);
}
2023-11-28 08:29:55 +00:00
.virtualized-table-header {
2024-01-11 06:46:10 +00:00
padding-inline-start: 8px;
padding-inline-end: calc(8px + var(--scrollbar-width, 0px));
2023-11-28 08:29:55 +00:00
box-sizing: border-box;
.cell.hasAttachment,
.cell.numNotes {
padding: 0;
text-align: center;
&.first-column {
padding-inline-start: 32px;
}
}
.first-column {
padding-inline-start: 36px;
&::before {
content: "";
display: inline-block;
width: 8px;
height: 100%;
background: transparent;
position: absolute;
inset-inline-start: -8px;
@include state(".first-column:hover") {
background: var(--material-mix-quinary);
}
@include state(".first-column.dragging") {
background: var(--material-mix-quarternary);
}
}
}
.cell:last-child {
&::after {
content: "";
display: inline-block;
width: calc(var(--scrollbar-width, 0px) + 8px);
height: 100%;
background: transparent;
position: absolute;
inset-inline-end: calc(-1 * var(--scrollbar-width, 0px) - 8px);
@include state(".cell:hover") {
background: var(--material-mix-quinary);
}
@include state(".cell.dragging") {
background: var(--material-mix-quarternary);
}
}
}
2021-04-09 09:00:34 +00:00
}
2021-09-17 10:02:25 +00:00
.virtualized-table, .drag-image-container {
2023-11-28 08:29:55 +00:00
.row {
&.odd:not(.selected) {
background-color: var(--material-stripe);
2023-11-28 08:29:55 +00:00
}
&.even:not(.selected) {
2024-01-13 09:19:36 +00:00
background-color: var(--material-background);
2023-11-28 08:29:55 +00:00
}
&.selected {
border-radius: 0;
&.first-selected {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
&.last-selected {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
}
2024-01-11 06:46:10 +00:00
.colored-tag-swatches {
display: flex;
:root:-moz-locale-dir(rtl) & {
transform: scaleX(-1);
flex-direction: row-reverse;
}
2024-01-11 06:46:10 +00:00
}
.icon-item-type + .tag-swatch,
.icon-item-type + .colored-tag-swatches {
margin-inline-start: 4px;
}
.emoji + .emoji,
.emoji + .colored-tag-swatches,
.colored-tag-swatches + .emoji {
margin-inline-start: 4px;
}
2024-01-11 06:46:10 +00:00
2023-11-28 08:29:55 +00:00
.tag-swatch {
display: inline-block;
&.colored {
-moz-context-properties: fill, fill-opacity, stroke, stroke-opacity;
width: 0.92307692em;
height: 0.92307692em;
2023-11-28 08:29:55 +00:00
background:
url("chrome://zotero/skin/tag-circle.svg") no-repeat center/100%,
2023-11-28 08:29:55 +00:00
url("chrome://zotero/skin/tag-circle-border.svg") no-repeat center/0;
fill: currentcolor;
@each $colorHex, $colorVar in $tagColorsLookup {
&[data-color="#{$colorHex}"] {
fill: var($colorVar);
}
}
@include focus-states using($color) {
@if $color =="white" {
background: url("chrome://zotero/skin/tag-circle-border.svg") no-repeat center/contain;
stroke: var(--accent-white);
}
}
}
&.colored + .colored {
background:
url("chrome://zotero/skin/tag-crescent.svg") no-repeat center/100%,
2023-11-28 08:29:55 +00:00
url("chrome://zotero/skin/tag-crescent-border.svg") no-repeat center/0;
// RTL: Parent is flipped, so margin can always be on logical left
margin-left: -0.38461538em;
2023-11-28 08:29:55 +00:00
@include focus-states using($color) {
@if $color =="white" {
background: url("chrome://zotero/skin/tag-crescent-border.svg") no-repeat center/contain;
}
}
}
}
2021-09-17 10:02:25 +00:00
}
2023-11-28 08:29:55 +00:00
2021-09-17 10:02:25 +00:00
2023-11-28 08:29:55 +00:00
.cell.primary {
.retracted {
width: 12px;
margin-inline-start: 3px;
}
}
.cell.no-padding {
padding: 0;
}
2023-11-28 08:29:55 +00:00
.cell.hasAttachment {
text-overflow: unset;
align-items: center;
display: flex;
justify-content: center;
.cell-text {
text-overflow: unset;
align-items: center;
display: flex;
justify-content: center;
}
2023-11-28 08:29:55 +00:00
.icon-missing-file {
opacity: 0.4;
}
}
.numNotes, .hasAttachment {
2023-11-28 08:29:55 +00:00
text-align: center;
.cell-text {
text-align: center;
}
}
2021-09-17 10:02:25 +00:00
}
}
2023-10-06 12:08:44 +00:00
$-itemTypesIcons: (
2023-10-06 12:08:44 +00:00
artwork,
attachment-epub,
attachment-epub-link,
2023-10-06 12:08:44 +00:00
attachment-file, // mapped to document below
attachment-link,
attachment-pdf-link,
attachment-pdf,
attachment-snapshot,
attachment-web-link,
attachment-image,
attachment-image-link,
attachment-video,
attachment-video-link,
2023-10-06 12:08:44 +00:00
audio-recording,
bill,
blog-post,
book-section,
book,
case,
computer-program,
conference-paper,
dataset,
dictionary-entry,
document,
email,
encyclopedia-article,
epub,
film,
forum-post,
hearing,
instant-message,
interview,
journal-article,
letter,
magazine-article,
manuscript,
map,
newspaper-article,
note,
patent,
podcast,
preprint,
presentation,
radio-broadcast,
report,
standard,
statute,
thesis,
tv-broadcast,
video-recording,
webpage
);
$-itemTypesMap: (
2023-10-06 12:08:44 +00:00
"attachment-file": "document"
);
2023-11-28 08:29:55 +00:00
$-attachmentIcons: (
attachment-epub,
attachment-epub-link,
attachment-link,
attachment-pdf-link,
attachment-pdf,
attachment-snapshot,
attachment-web-link,
attachment-file,
attachment-image,
attachment-video
2023-11-28 08:29:55 +00:00
);
// Non-item objects that can appear in the trash
$-trashableObjectIcons: (
"collection",
"search"
);
.icon-item-type {
width: 16px;
height: 16px;
}
2023-11-28 08:29:55 +00:00
.icon-attachment-type {
width: 12px;
height: 12px;
padding: 1px;
box-sizing: content-box;
}
// Due to quirks of the state() mixin, we need two sets of .icon-item-type rules:
// one when the icon is within a virtualized-table, and one when it isn't. We declare
// a mixin here to avoid duplication.
@mixin -icon-item-type-rules($color) {
.icon-item-type {
// default icon, for known item types more specific selectors below will apply
@include svgicon("document", $color, "16", "item-type", true);
}
@each $itemTypeIcon in $-itemTypesIcons {
$itemType: camelCase(str-replace(str-replace($itemTypeIcon, "pdf", "PDF"), "epub", "EPUB"));
@if map.has-key($-itemTypesMap, $itemTypeIcon) {
$itemTypeIcon: map.get($-itemTypesMap, $itemTypeIcon);
2023-10-06 12:08:44 +00:00
}
.icon-item-type[data-item-type=#{$itemType}] {
@include svgicon($itemTypeIcon, $color, "16", "item-type", true);
2023-10-06 12:08:44 +00:00
}
}
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
}
@include focus-states using($color) {
@include -icon-item-type-rules($color);
}
.virtualized-table .row {
@include focus-states using($color) {
@include -icon-item-type-rules($color);
@each $itemAttachmentIcon in $-attachmentIcons {
$itemType: camelCase(str-replace(str-replace($itemAttachmentIcon, "pdf", "PDF"), "epub", "EPUB"));
.icon-attachment-type[data-item-type=#{$itemType}] {
@include svgicon($itemAttachmentIcon, $color, "12", "item-type", false);
background-origin: content-box;
}
}
@each $icon in $-trashableObjectIcons {
.icon-css.icon-#{$icon} {
@include svgicon($icon, $color, "16", "collection-tree");
}
}
}
}