@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
package/dist/webpack.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import Logger from './logger';
|
|
2
|
-
const logger = new Logger('Webpack');
|
|
3
|
-
export let modules = new Map();
|
|
4
|
-
function initModuleCache() {
|
|
5
|
-
const startTime = performance.now();
|
|
6
|
-
logger.group('Webpack Module Init');
|
|
7
|
-
const id = Symbol("@decky/ui");
|
|
8
|
-
let webpackRequire;
|
|
9
|
-
window.webpackChunksteamui.push([
|
|
10
|
-
[id],
|
|
11
|
-
{},
|
|
12
|
-
(r) => {
|
|
13
|
-
webpackRequire = r;
|
|
14
|
-
},
|
|
15
|
-
]);
|
|
16
|
-
logger.log('Initializing all modules. Errors here likely do not matter, as they are usually just failing module side effects.');
|
|
17
|
-
for (let id of Object.keys(webpackRequire.m)) {
|
|
18
|
-
try {
|
|
19
|
-
const module = webpackRequire(id);
|
|
20
|
-
if (module) {
|
|
21
|
-
modules.set(id, module);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
logger.debug('Ignoring require error for module', id, e);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
logger.groupEnd(`Modules initialized in ${performance.now() - startTime}ms...`);
|
|
29
|
-
}
|
|
30
|
-
initModuleCache();
|
|
31
|
-
export const findModule = (filter) => {
|
|
32
|
-
for (const m of modules.values()) {
|
|
33
|
-
if (m.default && filter(m.default))
|
|
34
|
-
return m.default;
|
|
35
|
-
if (filter(m))
|
|
36
|
-
return m;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const findModuleDetailsByExport = (filter, minExports) => {
|
|
40
|
-
for (const [id, m] of modules) {
|
|
41
|
-
if (!m)
|
|
42
|
-
continue;
|
|
43
|
-
for (const mod of [m.default, m]) {
|
|
44
|
-
if (typeof mod !== 'object')
|
|
45
|
-
continue;
|
|
46
|
-
if (mod == window)
|
|
47
|
-
continue;
|
|
48
|
-
if (minExports && Object.keys(mod).length < minExports)
|
|
49
|
-
continue;
|
|
50
|
-
for (let exportName in mod) {
|
|
51
|
-
if (mod?.[exportName]) {
|
|
52
|
-
try {
|
|
53
|
-
const filterRes = filter(mod[exportName], exportName);
|
|
54
|
-
if (filterRes) {
|
|
55
|
-
return [mod, mod[exportName], exportName, id];
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
logger.warn("Webpack filter threw exception: ", e, "Filter: ", filter);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return [undefined, undefined, undefined, undefined];
|
|
69
|
-
};
|
|
70
|
-
export const findModuleByExport = (filter, minExports) => {
|
|
71
|
-
return findModuleDetailsByExport(filter, minExports)?.[0];
|
|
72
|
-
};
|
|
73
|
-
export const findModuleExport = (filter, minExports) => {
|
|
74
|
-
return findModuleDetailsByExport(filter, minExports)?.[1];
|
|
75
|
-
};
|
|
76
|
-
export const findModuleChild = (filter) => {
|
|
77
|
-
logger.warn("findModuleChild is deprecated and will be removed soon. Use findModuleExport instead. Used in:", new Error().stack?.substring(5));
|
|
78
|
-
for (const m of modules.values()) {
|
|
79
|
-
for (const mod of [m.default, m]) {
|
|
80
|
-
const filterRes = filter(mod);
|
|
81
|
-
if (filterRes) {
|
|
82
|
-
return filterRes;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
export const findAllModules = (filter) => {
|
|
91
|
-
logger.warn("findAllModules is deprecated and will be removed soon. Use createModuleMapping instead. Used in:", new Error().stack?.substring(5));
|
|
92
|
-
const out = [];
|
|
93
|
-
for (const m of modules.values()) {
|
|
94
|
-
if (m.default && filter(m.default))
|
|
95
|
-
out.push(m.default);
|
|
96
|
-
if (filter(m))
|
|
97
|
-
out.push(m);
|
|
98
|
-
}
|
|
99
|
-
return out;
|
|
100
|
-
};
|
|
101
|
-
export const createModuleMapping = (filter) => {
|
|
102
|
-
const mapping = new Map();
|
|
103
|
-
for (const [id, m] of modules) {
|
|
104
|
-
if (m.default && filter(m.default))
|
|
105
|
-
mapping.set(id, m.default);
|
|
106
|
-
if (filter(m))
|
|
107
|
-
mapping.set(id, m);
|
|
108
|
-
}
|
|
109
|
-
return mapping;
|
|
110
|
-
};
|
|
111
|
-
export const CommonUIModule = findModule((m) => {
|
|
112
|
-
if (typeof m !== 'object')
|
|
113
|
-
return false;
|
|
114
|
-
for (let prop in m) {
|
|
115
|
-
if (m[prop]?.contextType?._currentValue && Object.keys(m).length > 60)
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
});
|
|
120
|
-
export const IconsModule = findModuleByExport((e) => e?.toString && /Spinner\),children:\[\(0,\w+\.jsx\)\("path",\{d:"M18 /.test(e.toString?.()) || /Spinner\)}\)?,.\.createElement\(\"path\",{d:\"M18 /.test(e.toString?.()));
|
|
121
|
-
export const ReactRouter = findModuleByExport((e) => e.computeRootMatch);
|
package/src/webpack.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import Logger from './logger';
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
interface Window {
|
|
5
|
-
webpackChunksteamui: any;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const logger = new Logger('Webpack');
|
|
10
|
-
|
|
11
|
-
// In most case an object with getters for each property. Look for the first call to r.d in the module, usually near or at the top.
|
|
12
|
-
export type ModuleID = string; // number string
|
|
13
|
-
export type Module = any;
|
|
14
|
-
export type Export = any;
|
|
15
|
-
type FilterFn = (module: any) => boolean;
|
|
16
|
-
type ExportFilterFn = (moduleExport: any, exportName?: any) => boolean;
|
|
17
|
-
type FindFn = (module: any) => any;
|
|
18
|
-
|
|
19
|
-
export let modules = new Map<ModuleID, Module>();
|
|
20
|
-
|
|
21
|
-
function initModuleCache() {
|
|
22
|
-
const startTime = performance.now();
|
|
23
|
-
logger.group('Webpack Module Init');
|
|
24
|
-
// Webpack 5
|
|
25
|
-
// Generate a fake module ID
|
|
26
|
-
const id = Symbol("@decky/ui");
|
|
27
|
-
let webpackRequire!: ((id: any) => Module) & { m: object };
|
|
28
|
-
// Insert our module in a new chunk.
|
|
29
|
-
// The module will then be called with webpack's internal require function as its first argument
|
|
30
|
-
window.webpackChunksteamui.push([
|
|
31
|
-
[id],
|
|
32
|
-
{},
|
|
33
|
-
(r: any) => {
|
|
34
|
-
webpackRequire = r;
|
|
35
|
-
},
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
logger.log(
|
|
39
|
-
'Initializing all modules. Errors here likely do not matter, as they are usually just failing module side effects.',
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
// Loop over every module ID
|
|
43
|
-
for (let id of Object.keys(webpackRequire.m)) {
|
|
44
|
-
try {
|
|
45
|
-
const module = webpackRequire(id);
|
|
46
|
-
if (module) {
|
|
47
|
-
modules.set(id, module);
|
|
48
|
-
}
|
|
49
|
-
} catch (e) {
|
|
50
|
-
logger.debug('Ignoring require error for module', id, e);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
logger.groupEnd(`Modules initialized in ${performance.now() - startTime}ms...`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
initModuleCache();
|
|
58
|
-
|
|
59
|
-
export const findModule = (filter: FilterFn) => {
|
|
60
|
-
for (const m of modules.values()) {
|
|
61
|
-
if (m.default && filter(m.default)) return m.default;
|
|
62
|
-
if (filter(m)) return m;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const findModuleDetailsByExport = (
|
|
67
|
-
filter: ExportFilterFn,
|
|
68
|
-
minExports?: number,
|
|
69
|
-
): [module: Module | undefined, moduleExport: any, exportName: any, moduleID: string | undefined] => {
|
|
70
|
-
for (const [id, m] of modules) {
|
|
71
|
-
if (!m) continue;
|
|
72
|
-
for (const mod of [m.default, m]) {
|
|
73
|
-
// special cases
|
|
74
|
-
if (typeof mod !== 'object') continue;
|
|
75
|
-
if (mod == window) continue; // wtf
|
|
76
|
-
if (minExports && Object.keys(mod).length < minExports) continue;
|
|
77
|
-
|
|
78
|
-
for (let exportName in mod) {
|
|
79
|
-
if (mod?.[exportName]) {
|
|
80
|
-
try {
|
|
81
|
-
const filterRes = filter(mod[exportName], exportName);
|
|
82
|
-
if (filterRes) {
|
|
83
|
-
return [mod, mod[exportName], exportName, id];
|
|
84
|
-
} else {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
} catch (e) {
|
|
88
|
-
logger.warn("Webpack filter threw exception: ", e, "Filter: ", filter);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return [undefined, undefined, undefined, undefined];
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const findModuleByExport = (filter: ExportFilterFn, minExports?: number) => {
|
|
98
|
-
return findModuleDetailsByExport(filter, minExports)?.[0];
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const findModuleExport = (filter: ExportFilterFn, minExports?: number) => {
|
|
102
|
-
return findModuleDetailsByExport(filter, minExports)?.[1];
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated use findModuleExport instead
|
|
107
|
-
*/
|
|
108
|
-
export const findModuleChild = (filter: FindFn) => {
|
|
109
|
-
logger.warn("findModuleChild is deprecated and will be removed soon. Use findModuleExport instead. Used in:", new Error().stack?.substring(5))
|
|
110
|
-
for (const m of modules.values()) {
|
|
111
|
-
for (const mod of [m.default, m]) {
|
|
112
|
-
const filterRes = filter(mod);
|
|
113
|
-
if (filterRes) {
|
|
114
|
-
return filterRes;
|
|
115
|
-
} else {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @deprecated use createModuleMapping instead
|
|
124
|
-
*/
|
|
125
|
-
export const findAllModules = (filter: FilterFn) => {
|
|
126
|
-
logger.warn("findAllModules is deprecated and will be removed soon. Use createModuleMapping instead. Used in:", new Error().stack?.substring(5))
|
|
127
|
-
const out = [];
|
|
128
|
-
|
|
129
|
-
for (const m of modules.values()) {
|
|
130
|
-
if (m.default && filter(m.default)) out.push(m.default);
|
|
131
|
-
if (filter(m)) out.push(m);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return out;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export const createModuleMapping = (filter: FilterFn) => {
|
|
138
|
-
const mapping = new Map<ModuleID, Module>();
|
|
139
|
-
|
|
140
|
-
for (const [id, m] of modules) {
|
|
141
|
-
if (m.default && filter(m.default)) mapping.set(id, m.default);
|
|
142
|
-
if (filter(m)) mapping.set(id, m);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return mapping;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export const CommonUIModule = findModule((m: Module) => {
|
|
149
|
-
if (typeof m !== 'object') return false;
|
|
150
|
-
for (let prop in m) {
|
|
151
|
-
if (m[prop]?.contextType?._currentValue && Object.keys(m).length > 60) return true;
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
export const IconsModule = findModuleByExport(
|
|
157
|
-
(e) => e?.toString && /Spinner\),children:\[\(0,\w+\.jsx\)\("path",\{d:"M18 /.test(e.toString?.()) || /Spinner\)}\)?,.\.createElement\(\"path\",{d:\"M18 /.test(e.toString?.()),
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
export const ReactRouter = findModuleByExport((e) => e.computeRootMatch);
|