(core) Improve dark mode

Summary:
Enhances dark mode support for the formula editor, and adds support to
the color select popup. Also fixes some bugs with dark mode.

Test Plan: Tested manually.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3847
This commit is contained in:
George Gevoian
2023-04-11 01:00:28 -04:00
parent 9d0e6694fc
commit 8a0bb4d4fe
27 changed files with 537 additions and 107 deletions

View File

@@ -108,7 +108,7 @@ div:hover > .kf_tooltip {
box-shadow: 0 1px 1px 1px rgba(0,0,0,0.15);
line-height: 1.1rem;
font-size: 1rem;
color: #606060;
color: var(--grist-theme-prompt-fg, #606060);
z-index: 10;
}

View File

@@ -0,0 +1,41 @@
import {IDisposableOwner, Observable} from 'grainjs';
export interface PausableObservable<T> extends Observable<T> {
pause(shouldPause?: boolean): void;
}
/**
* Creates and returns an `Observable` that can be paused, effectively causing all
* calls to `set` to become noops until unpaused, at which point the last value
* passed to set, if any, will be applied.
*
* NOTE: It's only advisable to use this when there are no other alternatives; pausing
* updates and notifications to subscribers increases the chances of introducing bugs.
*/
export function createPausableObs<T>(
owner: IDisposableOwner|null,
value: T,
): PausableObservable<T> {
let _isPaused = false;
let _lastValue: T | undefined = undefined;
const obs = Observable.create<T>(owner, value);
const set = Symbol('set');
return Object.assign(obs, {
pause(shouldPause: boolean = true) {
_isPaused = shouldPause;
if (shouldPause) {
_lastValue = undefined;
} else if (_lastValue) {
obs.set(_lastValue);
_lastValue = undefined;
}
},
[set]: obs.set,
set(val: T) {
_lastValue = val;
if (_isPaused) { return; }
this[set](val);
}
});
}