Skip to content

Build your personal knowledge base with Trilium Notes

chore(zen): move zen mode styles into their own stylesheet

Elian Doranc7d442eb4cb6
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 2e55524bd8..b68dc8df34 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -2,6 +2,7 @@
@import "./adaptive-colors.css";
@import "./menus.css";
@import "./buttons.css";
+@import "./zen.css";
@font-face {
font-family: Montserrat;
@@ -2260,168 +2261,6 @@ body.electron:not(.platform-darwin) .tab-row-container {
color: var(--hover-item-text-color);
}
-body.zen {
- --tab-bar-height: 0;
-}
-
-body.zen .gutter,
-body.zen #launcher-container,
-body.zen #launcher-pane,
-body.zen #left-pane,
-body.zen #right-pane,
-body.zen .right-pane-peek-button,
-body.zen #mobile-sidebar-wrapper,
-body.zen .tab-row-container,
-body.zen .tab-row-widget,
-body.zen .title-row .icon-action,
-body.zen .note-badges > *:not(.read-only-badge),
-body.zen .note-actions-bar,
-body.zen .inline-title,
-body.zen .promoted-attributes-widget,
-body.zen .action-button,
-body.zen .tooltip.content-hint, /* content-area hints (task states, collapsible summaries, drag handles) */
-body.zen .note-split:not(.type-book) .note-list-widget {
- display: none !important;
-}
-
-body.zen #vertical-main-container {
- /* Remove the placeholder for the right pane peek button */
- --right-pane-peek-button-gutter: 0 !important;
-}
-
-body.zen .split-note-container-widget > .gutter {
- display: unset !important;
-}
-
-body.zen #launcher-pane {
- position: absolute !important;
- top: 0 !important;
- inset-inline-end: 0 !important;
- width: 64px !important;
- height: 64px !important;
- background: transparent !important;
- border: 0 !important;
-}
-
-body.zen .title-row {
- height: unset !important;
- -webkit-app-region: drag;
- padding-inline-start: env(titlebar-area-x);
- padding-inline-end: calc(100vw - env(titlebar-area-width, 100vw) + 2.5em);
- border-bottom: none !important;
-}
-
-body.zen .note-title-widget,
-body.zen .note-title-widget input {
- font-size: 1rem !important;
-}
-
-body.zen #detail-container {
- width: 100%;
-}
-
-body.zen .note-split:not(.full-content-width) .scrolling-container {
- display: flex;
- flex-direction: column;
- scroll-behavior: unset !important;
-}
-
-body.zen .note-split:not(.full-content-width) .note-detail {
- margin: auto;
- padding-bottom: 25vh;
- max-width: var(--max-content-width);
- width: 100%;
-}
-
-body.zen .note-split:not(.full-content-width) .scroll-padding-widget {
- display: none;
-}
-
-body.zen .note-split.type-text {
- position: relative;
- font-size: 1.15em;
-}
-
-body.zen:not(.backdrop-effects-disabled) .note-split.type-text .title-row {
- --start-color: var(--main-background-color);
-
- position: absolute;
- width: 100%;
- background: linear-gradient(var(--start-color) 30%, transparent 100%);
- z-index: 1000;
-}
-
-@supports (background: color-mix(in srgb, white, transparent)) {
- body.zen .note-split.type-text .title-row {
- --start-color: color-mix(in srgb, var(--main-background-color), transparent 10%);
- }
-}
-
-body.zen .note-split.type-text .scrolling-container {
- --padding-bottom: 130px; /* Should be enough to avoid caret being hidden by the formatting toolbar */
-
- /* (Usually) keeps the caret above the fixed toolbar */
- scroll-padding-bottom: var(--padding-bottom);
-}
-
-body.zen:not(.backdrop-effects-disabled) .note-split.type-text .scrolling-container {
- --padding-top: 50px; /* Should be enough to cover the title row */
-
- padding-top: var(--padding-top);
- scroll-padding-top: var(--padding-top);
-}
-
-/* Fixed formatting toolbar */
-
-body.zen {
- .status-bar {
- display: none;
- }
-
- .classic-toolbar-widget {
- position: fixed;
- left: 50%;
- bottom: 20px;
- z-index: 1000;
- opacity: 0; /* Hidden unless the current note split is focused */
- pointer-events: none;
- transition: opacity 100ms linear;
- width: fit-content;
- box-shadow: 0px 10px 20px rgba(0, 0, 0, .1);
- border-radius: 8px;
- border: 1px solid var(--main-border-color);
- padding: 4px;
- background: var(--menu-background-color) !important;
- transform: translateX(-50%);
- backdrop-filter: blur(6px);
- }
-
- /* An open dropdown holds the toolbar up: hovering its submenu takes focus out of the split. */
- #root-widget:has(.note-split.type-text:focus-within) .classic-toolbar-widget,
- .classic-toolbar-widget:focus-within,
- .classic-toolbar-widget:has(.ck-dropdown__panel-visible) {
- opacity: 1; /* Show when the note split is focused */
- pointer-events: all;
- }
-
- @media (max-width: 1300px) {
- .classic-toolbar-widget {
- /* Set the toolbar to full with */
- width: 100%;
- }
-
- .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,
- .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw,
- .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw,
- .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme,
- .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s {
- /* Force toolbar items overflow dropdowns open upwards */
- top: auto;
- bottom: 100%;
- }
- }
-}
-
/* Content renderer */
footer.file-footer,
diff --git a/apps/client/src/stylesheets/zen.css b/apps/client/src/stylesheets/zen.css
new file mode 100644
index 0000000000..cfd17a7329
--- /dev/null
+++ b/apps/client/src/stylesheets/zen.css
@@ -0,0 +1,161 @@
+body.zen {
+ --tab-bar-height: 0;
+}
+
+body.zen .gutter,
+body.zen #launcher-container,
+body.zen #launcher-pane,
+body.zen #left-pane,
+body.zen #right-pane,
+body.zen .right-pane-peek-button,
+body.zen #mobile-sidebar-wrapper,
+body.zen .tab-row-container,
+body.zen .tab-row-widget,
+body.zen .title-row .icon-action,
+body.zen .note-badges > *:not(.read-only-badge),
+body.zen .note-actions-bar,
+body.zen .inline-title,
+body.zen .promoted-attributes-widget,
+body.zen .action-button,
+body.zen .tooltip.content-hint, /* content-area hints (task states, collapsible summaries, drag handles) */
+body.zen .note-split:not(.type-book) .note-list-widget {
+ display: none !important;
+}
+
+body.zen #vertical-main-container {
+ /* Remove the placeholder for the right pane peek button */
+ --right-pane-peek-button-gutter: 0 !important;
+}
+
+body.zen .split-note-container-widget > .gutter {
+ display: unset !important;
+}
+
+body.zen #launcher-pane {
+ position: absolute !important;
+ top: 0 !important;
+ inset-inline-end: 0 !important;
+ width: 64px !important;
+ height: 64px !important;
+ background: transparent !important;
+ border: 0 !important;
+}
+
+body.zen .title-row {
+ height: unset !important;
+ -webkit-app-region: drag;
+ padding-inline-start: env(titlebar-area-x);
+ padding-inline-end: calc(100vw - env(titlebar-area-width, 100vw) + 2.5em);
+ border-bottom: none !important;
+}
+
+body.zen .note-title-widget,
+body.zen .note-title-widget input {
+ font-size: 1rem !important;
+}
+
+body.zen #detail-container {
+ width: 100%;
+}
+
+body.zen .note-split:not(.full-content-width) .scrolling-container {
+ display: flex;
+ flex-direction: column;
+ scroll-behavior: unset !important;
+}
+
+body.zen .note-split:not(.full-content-width) .note-detail {
+ margin: auto;
+ padding-bottom: 25vh;
+ max-width: var(--max-content-width);
+ width: 100%;
+}
+
+body.zen .note-split:not(.full-content-width) .scroll-padding-widget {
+ display: none;
+}
+
+body.zen .note-split.type-text {
+ position: relative;
+ font-size: 1.15em;
+}
+
+body.zen:not(.backdrop-effects-disabled) .note-split.type-text .title-row {
+ --start-color: var(--main-background-color);
+
+ position: absolute;
+ width: 100%;
+ background: linear-gradient(var(--start-color) 30%, transparent 100%);
+ z-index: 1000;
+}
+
+@supports (background: color-mix(in srgb, white, transparent)) {
+ body.zen .note-split.type-text .title-row {
+ --start-color: color-mix(in srgb, var(--main-background-color), transparent 10%);
+ }
+}
+
+body.zen .note-split.type-text .scrolling-container {
+ --padding-bottom: 130px; /* Should be enough to avoid caret being hidden by the formatting toolbar */
+
+ /* (Usually) keeps the caret above the fixed toolbar */
+ scroll-padding-bottom: var(--padding-bottom);
+}
+
+body.zen:not(.backdrop-effects-disabled) .note-split.type-text .scrolling-container {
+ --padding-top: 50px; /* Should be enough to cover the title row */
+
+ padding-top: var(--padding-top);
+ scroll-padding-top: var(--padding-top);
+}
+
+/* Fixed formatting toolbar */
+
+body.zen {
+ .status-bar {
+ display: none;
+ }
+
+ .classic-toolbar-widget {
+ position: fixed;
+ left: 50%;
+ bottom: 20px;
+ z-index: 1000;
+ opacity: 0; /* Hidden unless the current note split is focused */
+ pointer-events: none;
+ transition: opacity 100ms linear;
+ width: fit-content;
+ box-shadow: 0px 10px 20px rgba(0, 0, 0, .1);
+ border-radius: 8px;
+ border: 1px solid var(--main-border-color);
+ padding: 4px;
+ background: var(--menu-background-color) !important;
+ transform: translateX(-50%);
+ backdrop-filter: blur(6px);
+ }
+
+ /* An open dropdown holds the toolbar up: hovering its submenu takes focus out of the split. */
+ #root-widget:has(.note-split.type-text:focus-within) .classic-toolbar-widget,
+ .classic-toolbar-widget:focus-within,
+ .classic-toolbar-widget:has(.ck-dropdown__panel-visible) {
+ opacity: 1; /* Show when the note split is focused */
+ pointer-events: all;
+ }
+
+ @media (max-width: 1300px) {
+ .classic-toolbar-widget {
+ /* Set the toolbar to full with */
+ width: 100%;
+ }
+
+ .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,
+ .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw,
+ .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw,
+ .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme,
+ .classic-toolbar-widget .ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s {
+ /* Force toolbar items overflow dropdowns open upwards */
+ top: auto;
+ bottom: 100%;
+ }
+ }
+}