@decky/ui 4.5.0 → 4.6.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.
@@ -3,7 +3,8 @@ export interface ClassModule {
3
3
  [name: string]: string;
4
4
  }
5
5
  export declare const classModuleMap: Map<ModuleID, ClassModule>;
6
- export declare const classMap: IterableIterator<ClassModule>;
6
+ export declare const classMap: ClassModule[];
7
7
  export declare function findClass(id: string, name: string): string | void;
8
+ export declare function findClassByName(name: string): string | void;
8
9
  export declare function findClassModule(filter: (module: any) => boolean): ClassModule | void;
9
10
  export declare function unminifyClass(minifiedClass: string): string | void;
@@ -10,12 +10,15 @@ export const classModuleMap = createModuleMapping((m) => {
10
10
  }
11
11
  return false;
12
12
  });
13
- export const classMap = classModuleMap.values();
13
+ export const classMap = [...classModuleMap.values()];
14
14
  export function findClass(id, name) {
15
15
  return classModuleMap.get(id)?.[name];
16
16
  }
17
+ export function findClassByName(name) {
18
+ return classMap.find((m) => m[name])?.[name];
19
+ }
17
20
  export function findClassModule(filter) {
18
- return [...classModuleMap.values()].find((m) => filter(m));
21
+ return classMap.find((m) => filter(m));
19
22
  }
20
23
  export function unminifyClass(minifiedClass) {
21
24
  for (let m of classModuleMap.values()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decky/ui",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "A library for interacting with the Steam frontend in Decky plugins and elsewhere.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,15 +17,18 @@ export const classModuleMap: Map<ModuleID, ClassModule> = createModuleMapping((m
17
17
  return false;
18
18
  });
19
19
 
20
- export const classMap = classModuleMap.values();
20
+ export const classMap = [...classModuleMap.values()];
21
21
 
22
22
  export function findClass(id: string, name: string): string | void {
23
23
  return classModuleMap.get(id)?.[name];
24
24
  }
25
25
 
26
+ export function findClassByName(name: string): string | void {
27
+ return classMap.find((m) => m[name])?.[name];
28
+ }
29
+
26
30
  export function findClassModule(filter: (module: any) => boolean): ClassModule | void {
27
- // TODO optimize
28
- return [...classModuleMap.values()].find((m) => filter(m));
31
+ return classMap.find((m) => filter(m));
29
32
  }
30
33
 
31
34
  export function unminifyClass(minifiedClass: string): string | void {
@@ -11,12 +11,14 @@ function getQuickAccessWindow(): Window | null {
11
11
 
12
12
  /**
13
13
  * Returns state indicating the visibility of quick access menu.
14
+ *
15
+ * @deprecated moved to @decky/api
14
16
  *
15
17
  * @returns `true` if quick access menu is visible and `false` otherwise.
16
18
  *
17
19
  * @example
18
20
  * import { FC, useEffect } from "react";
19
- * import { useQuickAccessVisible } from "decky-frontend-lib";
21
+ * import { useQuickAccessVisible } from "@decky/ui";
20
22
  *
21
23
  * export const PluginPanelView: FC<{}> = ({ }) => {
22
24
  * const isVisible = useQuickAccessVisible();