@decky/ui 4.16.4 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/class-mapper.d.ts +1 -1
- package/dist/class-mapper.js +3 -3
- package/dist/common-modules.d.ts +3 -0
- package/dist/common-modules.js +12 -0
- package/dist/components/ButtonItem.js +3 -3
- package/dist/components/Carousel.js +2 -2
- package/dist/components/ControlsList.js +2 -2
- package/dist/components/Dialog.js +10 -9
- package/dist/components/DialogCheckbox.js +2 -3
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/ErrorBoundary.js +1 -1
- package/dist/components/Field.js +2 -2
- package/dist/components/FocusRing.js +1 -1
- package/dist/components/Focusable.js +1 -1
- package/dist/components/Marquee.js +2 -2
- package/dist/components/Menu.js +7 -5
- package/dist/components/Modal.js +9 -4
- package/dist/components/Panel.d.ts +2 -4
- package/dist/components/Panel.js +5 -4
- package/dist/components/ProgressBar.d.ts +3 -3
- package/dist/components/ProgressBar.js +4 -4
- package/dist/components/Scroll.js +3 -3
- package/dist/components/SidebarNavigation.js +2 -2
- package/dist/components/SliderField.js +2 -2
- package/dist/components/Spinner.js +2 -2
- package/dist/components/SteamSpinner.js +2 -2
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +4 -3
- package/dist/components/TextField.js +1 -1
- package/dist/components/Toggle.js +1 -1
- package/dist/components/ToggleField.js +2 -2
- package/dist/components/Wrappers.d.ts +2 -0
- package/dist/components/Wrappers.js +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/custom-components/ColorPickerModal.js +5 -6
- package/dist/deck-hooks/useParams.js +1 -1
- package/dist/globals/stores/appstore.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/{webpack.d.ts → module-system.d.ts} +12 -3
- package/dist/module-system.js +244 -0
- package/dist/modules/Router.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/classData/index.d.ts +811 -0
- package/dist/utils/classData/index.js +1645 -0
- package/dist/utils/react/react.js +1 -1
- package/dist/utils/react/treepatcher.js +1 -1
- package/dist/utils/static-classes.d.ts +1 -46
- package/dist/utils/static-classes.js +1 -24
- package/package.json +1 -1
- package/src/class-mapper.ts +3 -3
- package/src/common-modules.ts +15 -0
- package/src/components/ButtonItem.ts +3 -3
- package/src/components/Carousel.ts +2 -2
- package/src/components/ControlsList.ts +2 -2
- package/src/components/Dialog.ts +12 -14
- package/src/components/DialogCheckbox.ts +2 -5
- package/src/components/Dropdown.tsx +1 -1
- package/src/components/ErrorBoundary.ts +1 -1
- package/src/components/Field.ts +2 -2
- package/src/components/FocusRing.ts +1 -1
- package/src/components/Focusable.ts +1 -1
- package/src/components/Marquee.ts +3 -3
- package/src/components/Menu.ts +20 -6
- package/src/components/Modal.ts +23 -7
- package/src/components/Panel.ts +12 -10
- package/src/components/ProgressBar.ts +12 -15
- package/src/components/Scroll.ts +3 -3
- package/src/components/SidebarNavigation.ts +3 -3
- package/src/components/SliderField.ts +2 -3
- package/src/components/Spinner.ts +2 -2
- package/src/components/SteamSpinner.ts +3 -3
- package/src/components/Tabs.ts +4 -3
- package/src/components/TextField.ts +2 -1
- package/src/components/Toggle.ts +1 -1
- package/src/components/ToggleField.ts +2 -3
- package/src/components/Wrappers.ts +12 -0
- package/src/components/index.ts +1 -0
- package/src/custom-components/ColorPickerModal.tsx +5 -6
- package/src/deck-hooks/useParams.ts +1 -1
- package/src/globals/stores/appstore.ts +1 -1
- package/src/index.ts +3 -1
- package/src/module-system.ts +309 -0
- package/src/modules/Router.ts +1 -1
- package/src/utils/classData/index.ts +1680 -0
- package/src/utils/react/react.ts +1 -1
- package/src/utils/react/treepatcher.ts +1 -1
- package/src/utils/static-classes.ts +1 -984
- package/dist/webpack.js +0 -121
- package/src/webpack.ts +0 -160
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import Logger from './logger';
|
|
2
|
+
const logger = new Logger('Modules');
|
|
3
|
+
let resolveModuleScope;
|
|
4
|
+
export let processedModules = [];
|
|
5
|
+
export let modules = new Map();
|
|
6
|
+
export let moduleScopes = new Map();
|
|
7
|
+
async function processModuleDeps(depsArr) {
|
|
8
|
+
const deps = [];
|
|
9
|
+
logger.debug("Processing module deps", depsArr);
|
|
10
|
+
for (let e of depsArr.filter(m => m.includes(".js"))) {
|
|
11
|
+
const modStr = e.replace("./", "https://steamloopback.host/");
|
|
12
|
+
if (!processedModules.includes(modStr)) {
|
|
13
|
+
processedModules.push(modStr);
|
|
14
|
+
deps.push(processModule(modStr));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
;
|
|
18
|
+
await Promise.allSettled(deps);
|
|
19
|
+
}
|
|
20
|
+
async function processScope(file, mod) {
|
|
21
|
+
const startTime = performance.now();
|
|
22
|
+
try {
|
|
23
|
+
let tries = 0;
|
|
24
|
+
for (let expKey in mod) {
|
|
25
|
+
if (tries > 4) {
|
|
26
|
+
logger.debug(`No scope found for ${file} in ${performance.now() - startTime}ms out of tries`);
|
|
27
|
+
}
|
|
28
|
+
const exp = mod[expKey];
|
|
29
|
+
if (typeof exp == "function" && exp.toString().length > 15) {
|
|
30
|
+
const scope = await resolveModuleScope(exp, file);
|
|
31
|
+
if (scope) {
|
|
32
|
+
logger.debug(`Scope resolved for ${file} in ${performance.now() - startTime}ms`);
|
|
33
|
+
moduleScopes.set(file, scope?.object);
|
|
34
|
+
if (scope?.object?.__vite__mapDeps)
|
|
35
|
+
await processModuleDeps(scope.object.__vite__mapDeps.f);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
logger.debug(`No scope found for ${file} try ${tries} in ${performance.now() - startTime}ms export used:`, exp);
|
|
40
|
+
tries++;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
logger.debug(`Failed to process scope of ${file}`, e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function processModule(path) {
|
|
50
|
+
const startTime = performance.now();
|
|
51
|
+
try {
|
|
52
|
+
const mod = await import(path);
|
|
53
|
+
logger.debug(`Processed exports for ${path} in ${performance.now() - startTime}ms`, path);
|
|
54
|
+
const file = path.replace("https://steamloopback.host/", "");
|
|
55
|
+
modules.set(file, mod);
|
|
56
|
+
const scope = processScope(file, mod);
|
|
57
|
+
const cjsStartTime = performance.now();
|
|
58
|
+
let cjsFound = false;
|
|
59
|
+
for (let expKey in mod) {
|
|
60
|
+
try {
|
|
61
|
+
const exp = mod[expKey];
|
|
62
|
+
if (typeof exp == "function" && exp?.toString?.()?.includes("={exports:{}}).exports,")) {
|
|
63
|
+
const cjsKey = `${file}#cjs_${expKey}`;
|
|
64
|
+
cjsFound = true;
|
|
65
|
+
modules.set(cjsKey, mod[expKey]());
|
|
66
|
+
logger.debug(`Processed CommonJS module ${cjsKey}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
logger.debug(`Ignoring CommonJS module import error for ${path}.${expKey}`, e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (cjsFound)
|
|
74
|
+
logger.debug(`CommonJS module imports for ${file} finished in ${performance.now() - cjsStartTime}ms`);
|
|
75
|
+
await scope;
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
logger.debug(`Ignoring module error for ${path}`, e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export async function initModules(resolveModuleScopeFn) {
|
|
82
|
+
resolveModuleScope = resolveModuleScopeFn;
|
|
83
|
+
const startTime = performance.now();
|
|
84
|
+
logger.group('Module System Init');
|
|
85
|
+
for (let node of document.querySelectorAll("script[type=module]")) {
|
|
86
|
+
const path = node.src;
|
|
87
|
+
if (!path.startsWith("https://steamloopback.host"))
|
|
88
|
+
continue;
|
|
89
|
+
await processModule(path);
|
|
90
|
+
}
|
|
91
|
+
logger.groupEnd(`Modules initialized in ${performance.now() - startTime}ms...`);
|
|
92
|
+
}
|
|
93
|
+
export const findModule = (filter) => {
|
|
94
|
+
for (const m of modules.values()) {
|
|
95
|
+
if (m.default && filter(m.default))
|
|
96
|
+
return m.default;
|
|
97
|
+
if (filter(m))
|
|
98
|
+
return m;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
export const findModuleDetailsByExport = (filter, minExports) => {
|
|
102
|
+
for (const [id, m] of modules) {
|
|
103
|
+
if (!m)
|
|
104
|
+
continue;
|
|
105
|
+
for (const mod of [m.default, m]) {
|
|
106
|
+
if (typeof mod !== 'object')
|
|
107
|
+
continue;
|
|
108
|
+
if (mod == window)
|
|
109
|
+
continue;
|
|
110
|
+
if (minExports && Object.keys(mod).length < minExports)
|
|
111
|
+
continue;
|
|
112
|
+
for (let exportName in mod) {
|
|
113
|
+
if (mod?.[exportName]) {
|
|
114
|
+
try {
|
|
115
|
+
const filterRes = filter(mod[exportName], exportName);
|
|
116
|
+
if (filterRes) {
|
|
117
|
+
return [mod, mod[exportName], exportName, id];
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
logger.warn("Module filter threw exception: ", e, "Filter: ", filter);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return [undefined, undefined, undefined, undefined];
|
|
131
|
+
};
|
|
132
|
+
export const findModuleByExport = (filter, minExports) => {
|
|
133
|
+
return findModuleDetailsByExport(filter, minExports)?.[0];
|
|
134
|
+
};
|
|
135
|
+
export const findModuleExport = (filter, minExports) => {
|
|
136
|
+
return findModuleDetailsByExport(filter, minExports)?.[1];
|
|
137
|
+
};
|
|
138
|
+
export const findScope = (filter) => {
|
|
139
|
+
for (const m of moduleScopes.values()) {
|
|
140
|
+
if (m.default && filter(m.default))
|
|
141
|
+
return m.default;
|
|
142
|
+
if (filter(m))
|
|
143
|
+
return m;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
export const findScopeDetailsByVar = (filter, minExports) => {
|
|
147
|
+
for (const [id, m] of moduleScopes) {
|
|
148
|
+
if (!m)
|
|
149
|
+
continue;
|
|
150
|
+
for (const mod of [m.default, m]) {
|
|
151
|
+
if (typeof mod !== 'object')
|
|
152
|
+
continue;
|
|
153
|
+
if (mod == window)
|
|
154
|
+
continue;
|
|
155
|
+
if (minExports && Object.keys(mod).length < minExports)
|
|
156
|
+
continue;
|
|
157
|
+
for (let varName in mod) {
|
|
158
|
+
if (mod?.[varName]) {
|
|
159
|
+
try {
|
|
160
|
+
const filterRes = filter(mod[varName], varName);
|
|
161
|
+
if (filterRes) {
|
|
162
|
+
return [mod, mod[varName], varName, id];
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
if (!e?.startsWith?.("TypeError: Function.prototype.toString requires that 'this' be a Function"))
|
|
170
|
+
logger.warn("Scope filter threw exception:", e, "Filter: ", filter, mod?.[varName]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return [undefined, undefined, undefined, undefined];
|
|
177
|
+
};
|
|
178
|
+
export const findModuleScopeByVar = (filter, minVars) => {
|
|
179
|
+
return findScopeDetailsByVar(filter, minVars)?.[0];
|
|
180
|
+
};
|
|
181
|
+
export const findVar = (filter, minVars) => {
|
|
182
|
+
return findScopeDetailsByVar(filter, minVars)?.[1];
|
|
183
|
+
};
|
|
184
|
+
export const findModuleChild = (filter) => {
|
|
185
|
+
logger.warn("findModuleChild is deprecated and will be removed soon. Use findModuleExport instead. Used in:", new Error().stack?.substring(5));
|
|
186
|
+
for (const m of modules.values()) {
|
|
187
|
+
for (const mod of [m.default, m]) {
|
|
188
|
+
const filterRes = filter(mod);
|
|
189
|
+
if (filterRes) {
|
|
190
|
+
return filterRes;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
export const findAllModules = (filter) => {
|
|
199
|
+
logger.warn("findAllModules is deprecated and will be removed soon. Use createModuleMapping instead. Used in:", new Error().stack?.substring(5));
|
|
200
|
+
const out = [];
|
|
201
|
+
for (const m of modules.values()) {
|
|
202
|
+
if (m.default && filter(m.default))
|
|
203
|
+
out.push(m.default);
|
|
204
|
+
if (filter(m))
|
|
205
|
+
out.push(m);
|
|
206
|
+
}
|
|
207
|
+
return out;
|
|
208
|
+
};
|
|
209
|
+
export const createModuleMapping = (filter) => {
|
|
210
|
+
const mapping = new Map();
|
|
211
|
+
for (const [id, m] of modules) {
|
|
212
|
+
if (m.default && filter(m.default))
|
|
213
|
+
mapping.set(id, m.default);
|
|
214
|
+
if (filter(m))
|
|
215
|
+
mapping.set(id, m);
|
|
216
|
+
}
|
|
217
|
+
return mapping;
|
|
218
|
+
};
|
|
219
|
+
export const createScopeMapping = (filter) => {
|
|
220
|
+
const mapping = new Map();
|
|
221
|
+
for (const [id, m] of moduleScopes) {
|
|
222
|
+
if (m.default && filter(m.default))
|
|
223
|
+
mapping.set(id, m.default);
|
|
224
|
+
if (filter(m))
|
|
225
|
+
mapping.set(id, m);
|
|
226
|
+
}
|
|
227
|
+
return mapping;
|
|
228
|
+
};
|
|
229
|
+
export const createVarMapping = (filter) => {
|
|
230
|
+
const mapping = new Map();
|
|
231
|
+
for (const [id, m] of moduleScopes) {
|
|
232
|
+
for (const key in m) {
|
|
233
|
+
try {
|
|
234
|
+
const val = m[key];
|
|
235
|
+
if (filter(val))
|
|
236
|
+
mapping.set(id + "#." + key, val);
|
|
237
|
+
}
|
|
238
|
+
catch (e) {
|
|
239
|
+
logger.warn("Var mapping error", e);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return mapping;
|
|
244
|
+
};
|
package/dist/modules/Router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Logger from "../logger";
|
|
2
|
-
import { findModuleExport } from "../
|
|
2
|
+
import { findModuleExport } from "../module-system";
|
|
3
3
|
export const Router = findModuleExport((e) => e.Navigate && e.NavigationManager);
|
|
4
4
|
export let Navigation = {};
|
|
5
5
|
const logger = new Logger("Navigation");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/class-mapper.ts","../src/index.ts","../src/logger.ts","../src/
|
|
1
|
+
{"root":["../src/class-mapper.ts","../src/common-modules.ts","../src/index.ts","../src/logger.ts","../src/module-system.ts","../src/components/Button.ts","../src/components/ButtonItem.ts","../src/components/Carousel.ts","../src/components/ControlsList.ts","../src/components/Dialog.ts","../src/components/DialogCheckbox.ts","../src/components/Dropdown.tsx","../src/components/ErrorBoundary.ts","../src/components/Field.ts","../src/components/FocusRing.ts","../src/components/Focusable.ts","../src/components/FooterLegend.ts","../src/components/Item.ts","../src/components/Marquee.ts","../src/components/Menu.ts","../src/components/Modal.ts","../src/components/Panel.ts","../src/components/ProgressBar.ts","../src/components/Scroll.ts","../src/components/SidebarNavigation.ts","../src/components/SliderField.ts","../src/components/Spinner.ts","../src/components/SteamSpinner.ts","../src/components/Tabs.ts","../src/components/TextField.ts","../src/components/Toggle.ts","../src/components/ToggleField.ts","../src/components/Wrappers.ts","../src/components/index.ts","../src/custom-components/ColorPickerModal.tsx","../src/custom-components/ReorderableList.tsx","../src/custom-components/SuspensefulImage.tsx","../src/custom-components/index.ts","../src/custom-hooks/index.ts","../src/custom-hooks/useQuickAccessVisible.ts","../src/deck-hooks/index.ts","../src/deck-hooks/useParams.ts","../src/globals/index.ts","../src/globals/shared/cm.ts","../src/globals/shared/enums.ts","../src/globals/shared/history.ts","../src/globals/shared/index.ts","../src/globals/shared/interfaces.ts","../src/globals/shared/navigation.ts","../src/globals/shared/steamid.ts","../src/globals/shared/storage.ts","../src/globals/steam-client/App.ts","../src/globals/steam-client/Auth.ts","../src/globals/steam-client/Broadcast.ts","../src/globals/steam-client/Browser.ts","../src/globals/steam-client/ClientNotifications.ts","../src/globals/steam-client/Cloud.ts","../src/globals/steam-client/CommunityItems.ts","../src/globals/steam-client/Console.ts","../src/globals/steam-client/Customization.ts","../src/globals/steam-client/Downloads.ts","../src/globals/steam-client/FamilySharing.ts","../src/globals/steam-client/FriendSettings.ts","../src/globals/steam-client/Friends.ts","../src/globals/steam-client/GameNotes.ts","../src/globals/steam-client/GameRecording.ts","../src/globals/steam-client/GameSessions.ts","../src/globals/steam-client/Input.ts","../src/globals/steam-client/InstallFolder.ts","../src/globals/steam-client/Installs.ts","../src/globals/steam-client/Messaging.ts","../src/globals/steam-client/Music.ts","../src/globals/steam-client/Notifications.ts","../src/globals/steam-client/OpenVR.ts","../src/globals/steam-client/Overlay.ts","../src/globals/steam-client/Parental.ts","../src/globals/steam-client/RemotePlay.ts","../src/globals/steam-client/Screenshots.ts","../src/globals/steam-client/ServerBrowser.ts","../src/globals/steam-client/Settings.ts","../src/globals/steam-client/SharedConnection.ts","../src/globals/steam-client/Stats.ts","../src/globals/steam-client/SteamChina.ts","../src/globals/steam-client/Storage.ts","../src/globals/steam-client/Streaming.ts","../src/globals/steam-client/UI.ts","../src/globals/steam-client/URL.ts","../src/globals/steam-client/Updates.ts","../src/globals/steam-client/User.ts","../src/globals/steam-client/WebChat.ts","../src/globals/steam-client/WebUITransport.ts","../src/globals/steam-client/Window.ts","../src/globals/steam-client/index.ts","../src/globals/steam-client/shared.ts","../src/globals/steam-client/browser-view/BrowserViewPopup.ts","../src/globals/steam-client/browser-view/index.ts","../src/globals/steam-client/system/Audio.ts","../src/globals/steam-client/system/AudioDevice.ts","../src/globals/steam-client/system/Bluetooth.ts","../src/globals/steam-client/system/Devkit.ts","../src/globals/steam-client/system/Display.ts","../src/globals/steam-client/system/DisplayManager.ts","../src/globals/steam-client/system/Dock.ts","../src/globals/steam-client/system/Perf.ts","../src/globals/steam-client/system/Report.ts","../src/globals/steam-client/system/UI.ts","../src/globals/steam-client/system/index.ts","../src/globals/steam-client/system/network/Device.ts","../src/globals/steam-client/system/network/index.ts","../src/globals/stores/app.ts","../src/globals/stores/appdetailsstore.ts","../src/globals/stores/appinfostore.ts","../src/globals/stores/appstore.ts","../src/globals/stores/badgestore.ts","../src/globals/stores/collectionstore.ts","../src/globals/stores/consolestore.ts","../src/globals/stores/focusnavcontroller.ts","../src/globals/stores/gamerecordingstore.ts","../src/globals/stores/index.ts","../src/globals/stores/libraryuistore.ts","../src/globals/stores/localizationmanager.ts","../src/globals/stores/mainwindowbrowsermanager.ts","../src/globals/stores/notificationstore.ts","../src/globals/stores/popupmanager.ts","../src/globals/stores/securitystore.ts","../src/globals/stores/settingsstore.ts","../src/globals/stores/storeitemcache.ts","../src/globals/stores/urlstore.ts","../src/globals/stores/friendstore/clanstore.ts","../src/globals/stores/friendstore/friendchat.ts","../src/globals/stores/friendstore/friendgroupstore.ts","../src/globals/stores/friendstore/friendingamenotificationstore.ts","../src/globals/stores/friendstore/friendslistfavoritesstore.ts","../src/globals/stores/friendstore/friendsuifriendstore.ts","../src/globals/stores/friendstore/index.ts","../src/globals/stores/friendstore/shared.ts","../src/globals/stores/steamuistore/gamepadbrowserview.ts","../src/globals/stores/steamuistore/gamepaduiaudio.ts","../src/globals/stores/steamuistore/index.ts","../src/globals/stores/steamuistore/menu.ts","../src/globals/stores/steamuistore/window.ts","../src/modules/Router.ts","../src/modules/index.ts","../src/utils/index.ts","../src/utils/patcher.ts","../src/utils/static-classes.ts","../src/utils/classData/index.ts","../src/utils/react/fc.ts","../src/utils/react/react.ts","../src/utils/react/treepatcher.ts"],"version":"5.9.2"}
|