mirror of
https://github.com/zadam/trilium.git
synced 2026-02-28 17:43:36 +01:00
Merge branch 'main' of https://github.com/TriliumNext/Trilium into feat/ui/general-improvements
This commit is contained in:
commit
655b016efa
@ -13,6 +13,8 @@ import FlexContainer from "./flex_container.js";
|
||||
*
|
||||
* For convenience, the root container has a few class selectors that can be used to target some global state:
|
||||
*
|
||||
* - `#root-container.light-theme`, indicates whether the current color scheme is light.
|
||||
* - `#root-container.dark-theme`, indicates whether the current color scheme is dark.
|
||||
* - `#root-container.virtual-keyboard-opened`, on mobile devices if the virtual keyboard is open.
|
||||
* - `#root-container.horizontal-layout`, if the current layout is horizontal.
|
||||
* - `#root-container.vertical-layout`, if the current layout is horizontal.
|
||||
@ -34,6 +36,7 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
|
||||
window.visualViewport?.addEventListener("resize", () => this.#onMobileResize());
|
||||
}
|
||||
|
||||
this.#initTheme();
|
||||
this.#setDeviceSpecificClasses();
|
||||
this.#setMaxContentWidth();
|
||||
this.#setMotion();
|
||||
@ -67,6 +70,21 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
#initTheme() {
|
||||
const colorSchemeChangeObserver = matchMedia("(prefers-color-scheme: dark)")
|
||||
colorSchemeChangeObserver.addEventListener("change", () => this.#updateColorScheme());
|
||||
this.#updateColorScheme();
|
||||
|
||||
document.body.setAttribute("data-theme-id", options.get("theme"));
|
||||
}
|
||||
|
||||
#updateColorScheme() {
|
||||
const colorScheme = readCssVar(document.body, "theme-style").asString();
|
||||
|
||||
document.body.classList.toggle("light-theme", colorScheme === "light");
|
||||
document.body.classList.toggle("dark-theme", colorScheme === "dark");
|
||||
}
|
||||
|
||||
#onMobileResize() {
|
||||
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
||||
const windowHeight = Math.max(window.innerHeight, this.originalWindowHeight); // inner height changes when keyboard is opened, we need to compare with the original height to detect it.
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
"@types/serve-favicon": "2.5.7",
|
||||
"@types/serve-static": "2.2.0",
|
||||
"@types/stream-throttle": "0.1.4",
|
||||
"@types/supertest": "6.0.3",
|
||||
"@types/supertest": "7.2.0",
|
||||
"@types/tmp": "0.2.6",
|
||||
"@types/turndown": "5.0.6",
|
||||
"@types/ws": "8.18.1",
|
||||
|
||||
18
pnpm-lock.yaml
generated
18
pnpm-lock.yaml
generated
@ -620,8 +620,8 @@ importers:
|
||||
specifier: 0.1.4
|
||||
version: 0.1.4
|
||||
'@types/supertest':
|
||||
specifier: 6.0.3
|
||||
version: 6.0.3
|
||||
specifier: 7.2.0
|
||||
version: 7.2.0
|
||||
'@types/tmp':
|
||||
specifier: 0.2.6
|
||||
version: 0.2.6
|
||||
@ -6049,8 +6049,8 @@ packages:
|
||||
'@types/supercluster@7.1.3':
|
||||
resolution: {integrity: sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA==}
|
||||
|
||||
'@types/supertest@6.0.3':
|
||||
resolution: {integrity: sha512-8WzXq62EXFhJ7QsH3Ocb/iKQ/Ty9ZVWnVzoTKc9tyyFRRF3a74Tk2+TLFgaFFw364Ere+npzHKEJ6ga2LzIL7w==}
|
||||
'@types/supertest@7.2.0':
|
||||
resolution: {integrity: sha512-uh2Lv57xvggst6lCqNdFAmDSvoMG7M/HDtX4iUCquxQ5EGPtaPM5PL5Hmi7LCvOG8db7YaCPNJEeoI8s/WzIQw==}
|
||||
|
||||
'@types/tabulator-tables@6.3.1':
|
||||
resolution: {integrity: sha512-qL05wGXVy0yfWcF8LCE9+9uSeUIpeKdgpm8YmOAPTjLd3FaoZziPOhVxIiLzEhLTFfOvbuwnaWDm4v4i87diRQ==}
|
||||
@ -16415,6 +16415,8 @@ snapshots:
|
||||
'@ckeditor/ckeditor5-utils': 47.4.0
|
||||
ckeditor5: 47.4.0
|
||||
es-toolkit: 1.39.5
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@ckeditor/ckeditor5-editor-multi-root@47.4.0':
|
||||
dependencies:
|
||||
@ -16437,6 +16439,8 @@ snapshots:
|
||||
'@ckeditor/ckeditor5-table': 47.4.0
|
||||
'@ckeditor/ckeditor5-utils': 47.4.0
|
||||
ckeditor5: 47.4.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@ckeditor/ckeditor5-emoji@47.4.0':
|
||||
dependencies:
|
||||
@ -21541,7 +21545,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/geojson': 7946.0.16
|
||||
|
||||
'@types/supertest@6.0.3':
|
||||
'@types/supertest@7.2.0':
|
||||
dependencies:
|
||||
'@types/methods': 1.1.4
|
||||
'@types/superagent': 8.1.9
|
||||
@ -28087,7 +28091,7 @@ snapshots:
|
||||
|
||||
minipass-fetch@5.0.0:
|
||||
dependencies:
|
||||
minipass: 7.1.2
|
||||
minipass: 7.1.3
|
||||
minipass-sized: 1.0.3
|
||||
minizlib: 3.1.0
|
||||
optionalDependencies:
|
||||
@ -31037,7 +31041,7 @@ snapshots:
|
||||
|
||||
ssri@13.0.0:
|
||||
dependencies:
|
||||
minipass: 7.1.2
|
||||
minipass: 7.1.3
|
||||
|
||||
ssri@8.0.1:
|
||||
dependencies:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user