mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
refactor: separate application UI state owners
This commit is contained in:
1 parent
ddc1edf3af
commit
dc81cf585c
34 files changed
+3378
-2201
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { StyleManager } from '../ui/applicationShell.js';
|
||||
import { NavigationController } from '../ui/navigationController.js';
|
||||
import { ShareRestoration } from '../ui/shareRestoration.js';
|
||||
import { VisualSettings } from '../ui/visualSettings.js';
|
||||
import { PanelChrome } from '../ui/panelChrome.js';
|
||||
|
||||
/** Read the state owners as well as the compatibility/composition facade. */
|
||||
export function readShellSource() {
|
||||
return [
|
||||
'navigationController',
|
||||
'shareRestoration',
|
||||
'visualSettings',
|
||||
'panelChrome',
|
||||
'applicationShell',
|
||||
]
|
||||
.map((name) =>
|
||||
readFileSync(new URL(`../ui/${name}.js`, import.meta.url), 'utf8'),
|
||||
)
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
/** Select the implementation owner instead of testing a forwarding facade. */
|
||||
export function shellMethod(name) {
|
||||
for (const owner of [
|
||||
NavigationController,
|
||||
ShareRestoration,
|
||||
VisualSettings,
|
||||
PanelChrome,
|
||||
StyleManager,
|
||||
]) {
|
||||
const method = Object.getOwnPropertyDescriptor(
|
||||
owner.prototype,
|
||||
name,
|
||||
)?.value;
|
||||
if (typeof method === 'function') return method;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user