mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			12 Commits
		
	
	
		
			feat/impro
			...
			feat/ui-op
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d35dbca18b | ||
|  | 7468d6147a | ||
|  | 7c78d749de | ||
|  | 85dd99a3c4 | ||
|  | 0a9c0234e2 | ||
|  | 3e3cc8c541 | ||
|  | d1538508e8 | ||
|  | 9b1da8c311 | ||
|  | e4a8258acf | ||
|  | 5e88043c7b | ||
|  | bedf9112fb | ||
|  | 03681d23c5 | 
| @@ -28,6 +28,21 @@ | ||||
|     --ck-mention-list-max-height: 500px; | ||||
| } | ||||
|  | ||||
| body#trilium-app.motion-disabled *, | ||||
| body#trilium-app.motion-disabled *::before, | ||||
| body#trilium-app.motion-disabled *::after { | ||||
|     /* Disable transitions and animations */ | ||||
|     transition: none !important; | ||||
|     animation: none !important; | ||||
| } | ||||
|  | ||||
| body#trilium-app.shadows-disabled *, | ||||
| body#trilium-app.shadows-disabled *::before, | ||||
| body#trilium-app.shadows-disabled *::after { | ||||
|     /* Disable shadows */ | ||||
|     box-shadow: none !important; | ||||
| } | ||||
|  | ||||
| .table { | ||||
|     --bs-table-bg: transparent !important; | ||||
| } | ||||
| @@ -355,7 +370,7 @@ body.desktop .tabulator-popup-container { | ||||
|  | ||||
| @supports (animation-fill-mode: forwards) { | ||||
|     /* Delay the opening of submenus */ | ||||
|     body.desktop .dropdown-submenu .dropdown-menu { | ||||
|     body.desktop:not(.motion-disabled) .dropdown-submenu .dropdown-menu { | ||||
|         opacity: 0; | ||||
|         animation-fill-mode: forwards; | ||||
|         animation-delay: var(--submenu-opening-delay); | ||||
|   | ||||
| @@ -1113,6 +1113,11 @@ | ||||
|     "layout-vertical-description": "launcher bar is on the left (default)", | ||||
|     "layout-horizontal-description": "launcher bar is underneath the tab bar, the tab bar is now full width." | ||||
|   }, | ||||
|   "ui-performance": { | ||||
|     "title": "Performance", | ||||
|     "enable-motion": "Enable transitions and animations", | ||||
|     "enable-shadows": "Enable shadows" | ||||
|   }, | ||||
|   "ai_llm": { | ||||
|     "not_started": "Not started", | ||||
|     "title": "AI Settings", | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| import utils from "../../services/utils.js"; | ||||
| import type BasicWidget from "../basic_widget.js"; | ||||
| import { EventData } from "../../components/app_context.js"; | ||||
| import FlexContainer from "./flex_container.js"; | ||||
| import options from "../../services/options.js"; | ||||
| import type BasicWidget from "../basic_widget.js"; | ||||
| import utils from "../../services/utils.js"; | ||||
|  | ||||
| /** | ||||
|  * The root container is the top-most widget/container, from which the entire layout derives. | ||||
| @@ -20,6 +22,7 @@ export default class RootContainer extends FlexContainer<BasicWidget> { | ||||
|         this.id("root-widget"); | ||||
|         this.css("height", "100dvh"); | ||||
|         this.originalViewportHeight = getViewportHeight(); | ||||
|          | ||||
|     } | ||||
|  | ||||
|     render(): JQuery<HTMLElement> { | ||||
| @@ -27,15 +30,36 @@ export default class RootContainer extends FlexContainer<BasicWidget> { | ||||
|             window.visualViewport?.addEventListener("resize", () => this.#onMobileResize()); | ||||
|         } | ||||
|  | ||||
|         this.#setMotion(options.is("motionEnabled")); | ||||
|         this.#setShadows(options.is("shadowsEnabled")); | ||||
|  | ||||
|         return super.render(); | ||||
|     } | ||||
|  | ||||
|     entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { | ||||
|         if (loadResults.isOptionReloaded("motionEnabled")) { | ||||
|             this.#setMotion(options.is("motionEnabled")); | ||||
|         } | ||||
|  | ||||
|         if (loadResults.isOptionReloaded("shadowsEnabled")) { | ||||
|             this.#setShadows(options.is("shadowsEnabled")); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     #onMobileResize() { | ||||
|         const currentViewportHeight = getViewportHeight(); | ||||
|         const isKeyboardOpened = (currentViewportHeight < this.originalViewportHeight); | ||||
|         this.$widget.toggleClass("virtual-keyboard-opened", isKeyboardOpened); | ||||
|     } | ||||
|  | ||||
|     #setMotion(enabled: boolean) { | ||||
|         document.body.classList.toggle("motion-disabled", !enabled); | ||||
|         jQuery.fx.off = !enabled; | ||||
|     } | ||||
|  | ||||
|     #setShadows(enabled: boolean) { | ||||
|         document.body.classList.toggle("shadows-disabled", !enabled); | ||||
|     } | ||||
| } | ||||
|  | ||||
| function getViewportHeight() { | ||||
|   | ||||
| @@ -88,6 +88,7 @@ export default function AppearanceSettings() { | ||||
|             <ApplicationTheme /> | ||||
|             {overrideThemeFonts === "true" && <Fonts />} | ||||
|             {isElectron() && <ElectronIntegration /> } | ||||
|             <Performance /> | ||||
|             <MaxContentWidth /> | ||||
|             <RelatedSettings items={[ | ||||
|                 { | ||||
| @@ -245,6 +246,28 @@ function ElectronIntegration() { | ||||
|     ) | ||||
| } | ||||
|  | ||||
| function Performance() { | ||||
|     const [ motionEnabled, setMotionEnabled ] = useTriliumOptionBool("motionEnabled"); | ||||
|     const [ shadowsEnabled, setShadowsEnabled ] = useTriliumOptionBool("shadowsEnabled"); | ||||
|  | ||||
|  | ||||
|     return <OptionsSection title={t("ui-performance.title")}> | ||||
|         <FormGroup name="motion-enabled"> | ||||
|             <FormCheckbox | ||||
|                 label={t("ui-performance.enable-motion")} | ||||
|                 currentValue={motionEnabled} onChange={setMotionEnabled} | ||||
|             /> | ||||
|         </FormGroup> | ||||
|         <FormGroup name="shadows-enabled"> | ||||
|             <FormCheckbox | ||||
|                 label={t("ui-performance.enable-shadows")} | ||||
|                 currentValue={shadowsEnabled} onChange={setShadowsEnabled} | ||||
|             /> | ||||
|         </FormGroup> | ||||
|     </OptionsSection> | ||||
| } | ||||
|  | ||||
|  | ||||
| function MaxContentWidth() { | ||||
|     const [ maxContentWidth, setMaxContentWidth ] = useTriliumOption("maxContentWidth"); | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|     <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> | ||||
|     <title>Trilium Notes</title> | ||||
| </head> | ||||
| <body class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>"> | ||||
| <body id="trilium-app" class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>"> | ||||
| <noscript><%= t("javascript-required") %></noscript> | ||||
|  | ||||
| <script> | ||||
|   | ||||
| @@ -63,6 +63,8 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([ | ||||
|     "dailyBackupEnabled", | ||||
|     "weeklyBackupEnabled", | ||||
|     "monthlyBackupEnabled", | ||||
|     "motionEnabled", | ||||
|     "shadowsEnabled", | ||||
|     "maxContentWidth", | ||||
|     "compressImages", | ||||
|     "downloadImagesAutomatically", | ||||
|   | ||||
| @@ -152,6 +152,9 @@ const defaultOptions: DefaultOption[] = [ | ||||
|         }, | ||||
|         isSynced: false | ||||
|     }, | ||||
|     { name: "motionEnabled", value: "true", isSynced: false }, | ||||
|     { name: "shadowsEnabled", value: "true", isSynced: false }, | ||||
|  | ||||
|  | ||||
|     // Internationalization | ||||
|     { name: "locale", value: "en", isSynced: true }, | ||||
|   | ||||
| @@ -93,6 +93,8 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi | ||||
|  | ||||
|     // Appearance | ||||
|     splitEditorOrientation: "horziontal" | "vertical"; | ||||
|     motionEnabled: boolean; | ||||
|     shadowsEnabled: boolean; | ||||
|     codeNoteTheme: string; | ||||
|  | ||||
|     initialized: boolean; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user