@spicetify/kit 0.1.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.
Files changed (115) hide show
  1. package/bin/spicetify-kit.js +4 -0
  2. package/dist/build.js +335 -0
  3. package/dist/check.js +284 -0
  4. package/dist/classmap.js +187 -0
  5. package/dist/cli.js +53 -0
  6. package/dist/create.js +429 -0
  7. package/dist/dev.js +100 -0
  8. package/dist/from-theme.js +96 -0
  9. package/dist/install.js +60 -0
  10. package/dist/launch.js +122 -0
  11. package/dist/pack.js +31 -0
  12. package/dist/push.js +211 -0
  13. package/dist/vault.js +108 -0
  14. package/package.json +49 -0
  15. package/vendor/classmaps/1020096/classmap-19f856aefd5.json +109 -0
  16. package/vendor/shims/chunks.d.ts +10 -0
  17. package/vendor/shims/remote-modules.d.ts +6 -0
  18. package/vendor/shims/spicetify.d.ts +2437 -0
  19. package/vendor/stdlib/deps.ts +24 -0
  20. package/vendor/stdlib/index.ts +24 -0
  21. package/vendor/stdlib/lib/modal.tsx +128 -0
  22. package/vendor/stdlib/lib/popover.ts +84 -0
  23. package/vendor/stdlib/lib/primitives-classes.ts +66 -0
  24. package/vendor/stdlib/lib/primitives-vanilla.ts +277 -0
  25. package/vendor/stdlib/lib/primitives.tsx +314 -0
  26. package/vendor/stdlib/load.ts +17 -0
  27. package/vendor/stdlib/metadata.json +18 -0
  28. package/vendor/stdlib/mixin.ts +32 -0
  29. package/vendor/stdlib/mod.ts +26 -0
  30. package/vendor/stdlib/src/chunks.d.ts +10 -0
  31. package/vendor/stdlib/src/client.ts +114 -0
  32. package/vendor/stdlib/src/createIconComponent.tsx +29 -0
  33. package/vendor/stdlib/src/events.mix.ts +55 -0
  34. package/vendor/stdlib/src/events.ts +58 -0
  35. package/vendor/stdlib/src/expose/GraphQL.ts +40 -0
  36. package/vendor/stdlib/src/expose/Platform.ts +48 -0
  37. package/vendor/stdlib/src/expose/React.ts +95 -0
  38. package/vendor/stdlib/src/expose/ReactFlipToolkitSpring.ts +27 -0
  39. package/vendor/stdlib/src/expose/ReduxStore.ts +39 -0
  40. package/vendor/stdlib/src/expose/SettingsSection.ts +60 -0
  41. package/vendor/stdlib/src/expose/Snackbar.ts +34 -0
  42. package/vendor/stdlib/src/expose/Tippy.ts +26 -0
  43. package/vendor/stdlib/src/expose/enqueueImageSnackbar.ts +25 -0
  44. package/vendor/stdlib/src/expose/index.ts +14 -0
  45. package/vendor/stdlib/src/expose/jsx-runtime.ts +46 -0
  46. package/vendor/stdlib/src/expose/react-dom-shim.ts +50 -0
  47. package/vendor/stdlib/src/expose/react-shim.ts +116 -0
  48. package/vendor/stdlib/src/logger.ts +35 -0
  49. package/vendor/stdlib/src/playbar-compat.tsx +136 -0
  50. package/vendor/stdlib/src/registers/index.ts +176 -0
  51. package/vendor/stdlib/src/registers/menu.ts +160 -0
  52. package/vendor/stdlib/src/registers/mount.ts +307 -0
  53. package/vendor/stdlib/src/registers/nativeAnchors.ts +49 -0
  54. package/vendor/stdlib/src/registers/navlink.tsx +165 -0
  55. package/vendor/stdlib/src/registers/order.ts +22 -0
  56. package/vendor/stdlib/src/registers/panel.ts +168 -0
  57. package/vendor/stdlib/src/registers/playbarButton.tsx +93 -0
  58. package/vendor/stdlib/src/registers/playbarWidget.tsx +71 -0
  59. package/vendor/stdlib/src/registers/registry.ts +12 -0
  60. package/vendor/stdlib/src/registers/root.ts +101 -0
  61. package/vendor/stdlib/src/registers/route.ts +123 -0
  62. package/vendor/stdlib/src/registers/settingsRow.tsx +56 -0
  63. package/vendor/stdlib/src/registers/settingsSection.ts +59 -0
  64. package/vendor/stdlib/src/registers/topbarLeftButton.tsx +86 -0
  65. package/vendor/stdlib/src/registers/topbarRightButton.tsx +87 -0
  66. package/vendor/stdlib/src/storage.ts +163 -0
  67. package/vendor/stdlib/src/util.ts +62 -0
  68. package/vendor/stdlib/src/utils/index.ts +16 -0
  69. package/vendor/stdlib/src/webpack/ClassNames.gen.ts +10 -0
  70. package/vendor/stdlib/src/webpack/ClassNames.ts +6 -0
  71. package/vendor/stdlib/src/webpack/ClassNames.xpui.ts +16 -0
  72. package/vendor/stdlib/src/webpack/ComponentLibrary.gen.ts +10 -0
  73. package/vendor/stdlib/src/webpack/ComponentLibrary.ts +6 -0
  74. package/vendor/stdlib/src/webpack/ComponentLibrary.xpui.ts +18 -0
  75. package/vendor/stdlib/src/webpack/FilterContext.gen.ts +10 -0
  76. package/vendor/stdlib/src/webpack/FilterContext.ts +6 -0
  77. package/vendor/stdlib/src/webpack/FilterContext.xpui.ts +10 -0
  78. package/vendor/stdlib/src/webpack/Mousetrap.gen.ts +10 -0
  79. package/vendor/stdlib/src/webpack/Mousetrap.ts +6 -0
  80. package/vendor/stdlib/src/webpack/Mousetrap.xpui.ts +12 -0
  81. package/vendor/stdlib/src/webpack/React.gen.ts +14 -0
  82. package/vendor/stdlib/src/webpack/React.ts +6 -0
  83. package/vendor/stdlib/src/webpack/React.xpui.ts +15 -0
  84. package/vendor/stdlib/src/webpack/ReactComponents.desktop.ts +17 -0
  85. package/vendor/stdlib/src/webpack/ReactComponents.gen.ts +74 -0
  86. package/vendor/stdlib/src/webpack/ReactComponents.panel.ts +19 -0
  87. package/vendor/stdlib/src/webpack/ReactComponents.ts +50 -0
  88. package/vendor/stdlib/src/webpack/ReactComponents.xpui.ts +164 -0
  89. package/vendor/stdlib/src/webpack/ReactFlipToolkit.gen.ts +12 -0
  90. package/vendor/stdlib/src/webpack/ReactFlipToolkit.ts +6 -0
  91. package/vendor/stdlib/src/webpack/ReactFlipToolkit.xpui.ts +14 -0
  92. package/vendor/stdlib/src/webpack/ReactHooks.fullscreen.ts +15 -0
  93. package/vendor/stdlib/src/webpack/ReactHooks.gen.ts +32 -0
  94. package/vendor/stdlib/src/webpack/ReactHooks.ts +6 -0
  95. package/vendor/stdlib/src/webpack/ReactHooks.xpui.ts +38 -0
  96. package/vendor/stdlib/src/webpack/ReactQuery.gen.ts +26 -0
  97. package/vendor/stdlib/src/webpack/ReactQuery.ts +6 -0
  98. package/vendor/stdlib/src/webpack/ReactQuery.xpui.ts +46 -0
  99. package/vendor/stdlib/src/webpack/ReactRouter.gen.ts +12 -0
  100. package/vendor/stdlib/src/webpack/ReactRouter.ts +6 -0
  101. package/vendor/stdlib/src/webpack/ReactRouter.xpui.ts +22 -0
  102. package/vendor/stdlib/src/webpack/Snackbar.gen.ts +12 -0
  103. package/vendor/stdlib/src/webpack/Snackbar.ts +6 -0
  104. package/vendor/stdlib/src/webpack/Snackbar.xpui.ts +27 -0
  105. package/vendor/stdlib/src/webpack/URI.gen.ts +26 -0
  106. package/vendor/stdlib/src/webpack/URI.ts +82 -0
  107. package/vendor/stdlib/src/webpack/URI.xpui.ts +111 -0
  108. package/vendor/stdlib/src/webpack/capture-readiness.ts +49 -0
  109. package/vendor/stdlib/src/webpack/index.ts +186 -0
  110. package/vendor/stdlib/src/webpack/misc.gen.ts +16 -0
  111. package/vendor/stdlib/src/webpack/misc.ts +6 -0
  112. package/vendor/stdlib/src/webpack/misc.xpui.ts +27 -0
  113. package/vendor/stdlib/src/wpunpk.mix.ts +104 -0
  114. package/vendor/stdlib/src/wpunpk.ts +36 -0
  115. package/vendor/stdlib/vendor/rxjs.d.ts +5 -0
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as ReactComponents_desktop_ts from "./ReactComponents.desktop.ts";
7
+ export let Settings: typeof ReactComponents_desktop_ts.Settings;
8
+ import("./ReactComponents.desktop.ts").then(m => {
9
+ Settings = m.Settings;
10
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactComponents.desktop.ts failed:", e));
11
+
12
+ import type * as ReactComponents_panel_ts from "./ReactComponents.panel.ts";
13
+ export let PanelContainer: typeof ReactComponents_panel_ts.PanelContainer;
14
+ export let PanelContent: typeof ReactComponents_panel_ts.PanelContent;
15
+ export let PanelHeader: typeof ReactComponents_panel_ts.PanelHeader;
16
+ import("./ReactComponents.panel.ts").then(m => {
17
+ PanelContainer = m.PanelContainer;
18
+ PanelContent = m.PanelContent;
19
+ PanelHeader = m.PanelHeader;
20
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactComponents.panel.ts failed:", e));
21
+
22
+ import type * as ReactComponents_xpui_ts from "./ReactComponents.xpui.ts";
23
+ export let Menus: typeof ReactComponents_xpui_ts.Menus;
24
+ export let Cards: typeof ReactComponents_xpui_ts.Cards;
25
+ export let RemoteConfigProviderComponent: typeof ReactComponents_xpui_ts.RemoteConfigProviderComponent;
26
+ export let Nav: typeof ReactComponents_xpui_ts.Nav;
27
+ export let NavTo: typeof ReactComponents_xpui_ts.NavTo;
28
+ export let InstrumentedRedirect: typeof ReactComponents_xpui_ts.InstrumentedRedirect;
29
+ export let SnackbarProvider: typeof ReactComponents_xpui_ts.SnackbarProvider;
30
+ export let ContextMenu: typeof ReactComponents_xpui_ts.ContextMenu;
31
+ export let RightClickMenu: typeof ReactComponents_xpui_ts.RightClickMenu;
32
+ export let Tooltip: typeof ReactComponents_xpui_ts.Tooltip;
33
+ export let Menu: typeof ReactComponents_xpui_ts.Menu;
34
+ export let MenuItem: typeof ReactComponents_xpui_ts.MenuItem;
35
+ export let MenuItemSubMenu: typeof ReactComponents_xpui_ts.MenuItemSubMenu;
36
+ export let RemoteConfigProvider: typeof ReactComponents_xpui_ts.RemoteConfigProvider;
37
+ export let Snackbar: typeof ReactComponents_xpui_ts.Snackbar;
38
+ export let FilterBox: typeof ReactComponents_xpui_ts.FilterBox;
39
+ export let ScrollableContainer: typeof ReactComponents_xpui_ts.ScrollableContainer;
40
+ export let ScrollableText: typeof ReactComponents_xpui_ts.ScrollableText;
41
+ export let Router: typeof ReactComponents_xpui_ts.Router;
42
+ export let Routes: typeof ReactComponents_xpui_ts.Routes;
43
+ export let Route: typeof ReactComponents_xpui_ts.Route;
44
+ export let StoreProvider: typeof ReactComponents_xpui_ts.StoreProvider;
45
+ export let GenericModal: typeof ReactComponents_xpui_ts.GenericModal;
46
+ export let Tracklist: typeof ReactComponents_xpui_ts.Tracklist;
47
+ export let TracklistColumnsContextProvider: typeof ReactComponents_xpui_ts.TracklistColumnsContextProvider;
48
+ import("./ReactComponents.xpui.ts").then(m => {
49
+ Menus = m.Menus;
50
+ Cards = m.Cards;
51
+ RemoteConfigProviderComponent = m.RemoteConfigProviderComponent;
52
+ Nav = m.Nav;
53
+ NavTo = m.NavTo;
54
+ InstrumentedRedirect = m.InstrumentedRedirect;
55
+ SnackbarProvider = m.SnackbarProvider;
56
+ ContextMenu = m.ContextMenu;
57
+ RightClickMenu = m.RightClickMenu;
58
+ Tooltip = m.Tooltip;
59
+ Menu = m.Menu;
60
+ MenuItem = m.MenuItem;
61
+ MenuItemSubMenu = m.MenuItemSubMenu;
62
+ RemoteConfigProvider = m.RemoteConfigProvider;
63
+ Snackbar = m.Snackbar;
64
+ FilterBox = m.FilterBox;
65
+ ScrollableContainer = m.ScrollableContainer;
66
+ ScrollableText = m.ScrollableText;
67
+ Router = m.Router;
68
+ Routes = m.Routes;
69
+ Route = m.Route;
70
+ StoreProvider = m.StoreProvider;
71
+ GenericModal = m.GenericModal;
72
+ Tracklist = m.Tracklist;
73
+ TracklistColumnsContextProvider = m.TracklistColumnsContextProvider;
74
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactComponents.xpui.ts failed:", e));
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { analyzeWebpackRequire, src } from "./index.ts";
7
+ import { webpackRequire } from "../wpunpk.mix.ts";
8
+
9
+ await (CHUNKS["/dwp-panel-section.js"] ??= Promise.withResolvers()).promise;
10
+
11
+ const { exportedFunctions, exportedForwardRefs } = analyzeWebpackRequire(webpackRequire);
12
+
13
+ export const PanelContainer: React.FC<any> = exportedFunctions.find((f) =>
14
+ src(f).includes('"Desktop_PanelContainer_Id"'),
15
+ );
16
+
17
+ export const PanelContent: React.FC<any> = exportedForwardRefs.find((f) => src(f.render).includes("fixedHeader"));
18
+
19
+ export const PanelHeader: React.FC<any> = exportedFunctions.find((m) => src(m).includes("PanelHeader_CloseButton"))!;
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { webpackRequire } from "../wpunpk.mix.ts";
7
+ import { matchWebpackModule } from "../wpunpk.ts";
8
+
9
+ export * from "./ReactComponents.gen.ts";
10
+
11
+ export let Slider: React.FC<any>;
12
+ export let Toggle: React.FC<any>;
13
+ export let TracklistRow: React.FC<any>;
14
+
15
+ // postWebpackRequireHooks.push($ => {
16
+ matchWebpackModule(
17
+ (id, module) => {
18
+ const moduleStr = module.toString();
19
+ return moduleStr.includes('"data-testid":"progress-bar"');
20
+ },
21
+ (id, _$) => {
22
+ const module = webpackRequire(id);
23
+ Slider = Object.values<any>(module)[0];
24
+ },
25
+ );
26
+
27
+ matchWebpackModule(
28
+ (id, module) => {
29
+ const moduleStr = module.toString();
30
+ return moduleStr.includes('"JWYoNAyrIIdW30u4PSGE"');
31
+ },
32
+ (id, _$) => {
33
+ const module = webpackRequire(id);
34
+ Toggle = Object.values<any>(module)[0];
35
+ },
36
+ );
37
+
38
+ matchWebpackModule(
39
+ (id, module) => {
40
+ const moduleStr = module.toString();
41
+ return moduleStr.includes('"data-testid":"track-icon"');
42
+ },
43
+ async (id, _$) => {
44
+ //! HACKY ALERT (this module depennds on chunks that aren't loaded yet)
45
+ await new Promise((resolve) => setTimeout(resolve));
46
+ const module = webpackRequire(id);
47
+ TracklistRow = Object.values<any>(module)[0];
48
+ },
49
+ );
50
+ // })
@@ -0,0 +1,164 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { findBy, toPascalCase } from "../util.ts";
7
+
8
+ import { warn } from "../logger.ts";
9
+
10
+ import { Platform } from "../expose/Platform.ts";
11
+ import { exportedFunctions, exportedMemos, modules, src } from "./index.ts";
12
+ import { webpackRequire } from "../wpunpk.mix.ts";
13
+ import { React } from "../expose/React.ts";
14
+
15
+ type SnackbarProviderT = any;
16
+
17
+ await CHUNKS.xpui.promise;
18
+
19
+ export const Menus: any = Object.fromEntries(
20
+ exportedMemos.flatMap((m) => {
21
+ const str = src((m as any).type);
22
+ const match = str.match(/value:"([\w-]+)"/);
23
+ const name = match?.[1] ?? "";
24
+ const type = {
25
+ album: "Album",
26
+ show: "PodcastShow",
27
+ artist: "Artist",
28
+ track: "Track",
29
+ }[name];
30
+ return type ? [[type, m]] : [];
31
+ }),
32
+ );
33
+
34
+ // Needle misses are version drift, not fatal errors: a miss costs one
35
+ // surface member (undefined), never the whole stdlib barrel. The warning
36
+ // names the needle so a needle refresh can target it.
37
+ const findModuleId = (needle: string, pred: (source: string) => boolean) => {
38
+ const hit = modules.find(([, v]) => pred(v.toString()));
39
+ if (!hit) warn("[stdlib] webpack needle miss:", needle);
40
+ return hit?.[0];
41
+ };
42
+ const requireExports = (id: ReturnType<typeof findModuleId>): Record<string, any> =>
43
+ id === undefined ? {} : (webpackRequire(id) as Record<string, any>);
44
+
45
+ const ContextMenuModuleID = findModuleId("toggleContextMenu", (s) => s.includes("toggleContextMenu"));
46
+ // Dead since 1.2.9x: no module carries value:"playlist" + canView +
47
+ // permissions anymore; Menus.Playlist stays undefined until re-needled.
48
+ const playlistMenuModuleID = findModuleId(
49
+ 'value:"playlist" + canView + permissions',
50
+ (s) => s.includes('value:"playlist"') && s.includes("canView") && s.includes("permissions"),
51
+ );
52
+
53
+ Menus.Playlist = Object.values(requireExports(playlistMenuModuleID)).find(
54
+ (m) => typeof m === "function" || typeof m === "object",
55
+ );
56
+
57
+ export const Cards: any = Object.assign(
58
+ {
59
+ Generic: exportedFunctions.find(
60
+ (f) =>
61
+ src(f).includes("OnMouseDown") &&
62
+ src(f).match(/^[^;]*headerText/) &&
63
+ src(f).match(/^[^;]*featureIdentifier/) &&
64
+ src(f).match(/^[^;]*renderCardImage/),
65
+ ),
66
+ HeroGeneric: findBy("cardPlayButtonFactory", "featureIdentifier", "getSignifierContent")(exportedFunctions),
67
+ CardImage: findBy('"card-image"')(exportedFunctions),
68
+ },
69
+ Object.fromEntries(
70
+ [
71
+ exportedFunctions.map((m) => {
72
+ try {
73
+ const str = m.toString();
74
+ const match = str.match(/featureIdentifier:"(.+?)"/);
75
+ if (!match) return [];
76
+ const name = match[1];
77
+ return [[toPascalCase(name), m]];
78
+ } catch (e) {
79
+ return [];
80
+ }
81
+ }),
82
+ exportedMemos.map((m) => {
83
+ try {
84
+ const str = (m as any).type.toString();
85
+ const match = str.match(/featureIdentifier:"(.+?)"/);
86
+ if (!match) return [];
87
+ const name = match[1];
88
+ return [[toPascalCase(name), m]];
89
+ } catch (e) {
90
+ return [];
91
+ }
92
+ }),
93
+ ].flat(2),
94
+ ),
95
+ );
96
+
97
+ export const RemoteConfigProviderComponent: React.FC<any> = findBy(
98
+ "resolveSuspense",
99
+ "configuration",
100
+ )(exportedFunctions);
101
+
102
+ const exportedMemoFRefs = exportedMemos.filter((m) => (m as any).type.$$typeof === Symbol.for("react.forward_ref"));
103
+ export const Nav: React.NamedExoticComponent<any> = exportedMemoFRefs.find((m) =>
104
+ src((m as any).type.render).includes("navigationalRoot"),
105
+ )!;
106
+ export const NavTo: React.NamedExoticComponent<any> = exportedMemoFRefs.find((m) =>
107
+ src((m as any).type.render).includes("pageId"),
108
+ )!;
109
+
110
+ export const InstrumentedRedirect: React.FC<any> = exportedFunctions.find(
111
+ (f) => src(f).includes("getInteractionId") && /\bto:/.test(src(f)),
112
+ );
113
+
114
+ export const SnackbarProvider: SnackbarProviderT = findBy("enqueueSnackbar called with invalid argument")(
115
+ exportedFunctions,
116
+ ) as unknown as SnackbarProviderT;
117
+
118
+ export const ContextMenu: any = Object.values(requireExports(ContextMenuModuleID))[0];
119
+ export const RightClickMenu: React.FC<any> = findBy("action", "open", "trigger", "right-click")(exportedFunctions);
120
+
121
+ // export const ConfirmDialog: React.FC<any> = findBy(
122
+ // "isOpen",
123
+ // "shouldCloseOnEsc",
124
+ // "onClose",
125
+ // )(exportedFunctions);
126
+ export const Tooltip: React.FC<any> = findBy("hover-or-focus", "tooltip")(exportedFunctions);
127
+
128
+ export const Menu: React.FC<any> = findBy("getInitialFocusElement", "children")(exportedFunctions);
129
+ export const MenuItem: React.FC<any> = findBy("handleMouseEnter", "onClick")(exportedFunctions);
130
+ export const MenuItemSubMenu: React.FC<any> = findBy("subMenuIcon")(exportedFunctions);
131
+
132
+ export const RemoteConfigProvider = ({
133
+ configuration = Platform.getRemoteConfiguration(),
134
+ children = undefined as React.ReactNode,
135
+ }) => React.createElement(RemoteConfigProviderComponent, { configuration }, children);
136
+ export const Snackbar = {
137
+ wrapper: findBy("encore-light-theme", "elevated")(exportedFunctions),
138
+ simpleLayout: findBy("leading", "center", "trailing")(exportedFunctions),
139
+ ctaText: findBy("ctaText")(exportedFunctions),
140
+ styledImage: findBy("placeholderSrc")(exportedFunctions),
141
+ };
142
+
143
+ export const FilterBox: React.NamedExoticComponent = exportedMemos.find((f) =>
144
+ src((f as any).type).includes("filterBoxApiRef"),
145
+ )!;
146
+ export const ScrollableContainer: React.FC<any> = findBy("scrollLeft", "showButtons")(exportedFunctions);
147
+ export const ScrollableText: React.FC<any> = findBy("scrollLeft", "pauseAtEndEdgeDurationMs")(exportedFunctions);
148
+ export const Router: React.FC<any> = findBy("navigationType", "static")(exportedFunctions);
149
+ export const Routes: React.FC<any> = findBy(
150
+ /\([a-zA-Z_\$][\w\$]*\)\{let\{children:[a-zA-Z_\$][\w\$]*,location:[a-zA-Z_\$][\w\$]*\}=[a-zA-Z_\$][\w\$]*/,
151
+ )(exportedFunctions);
152
+ export const Route: React.FC<any> = findBy(
153
+ /^function [a-zA-Z_\$][\w\$]*\([a-zA-Z_\$][\w\$]*\)\{\(0,[a-zA-Z_\$][\w\$]*\.[a-zA-Z_\$][\w\$]*\)\(\!1\)\}$/,
154
+ )(exportedFunctions);
155
+ export const StoreProvider: React.FC<any> = findBy("notifyNestedSubs", "serverState")(exportedFunctions);
156
+
157
+ export const GenericModal: React.FC<any> = findBy("isOpen", "contentLabel")(exportedFunctions);
158
+
159
+ export const Tracklist: React.FC<any> = exportedMemos.find((f) => src((f as any).type).includes("nrValidItems"))!;
160
+ export const TracklistColumnsContextProvider: React.FC<any> = findBy(
161
+ "columns",
162
+ "visibleColumns",
163
+ "toggleVisible",
164
+ )(exportedFunctions);
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as ReactFlipToolkit_xpui_ts from "./ReactFlipToolkit.xpui.ts";
7
+ export let Flipper: typeof ReactFlipToolkit_xpui_ts.Flipper;
8
+ export let Flipped: typeof ReactFlipToolkit_xpui_ts.Flipped;
9
+ import("./ReactFlipToolkit.xpui.ts").then(m => {
10
+ Flipper = m.Flipper;
11
+ Flipped = m.Flipped;
12
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactFlipToolkit.xpui.ts failed:", e));
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ export * from "./ReactFlipToolkit.gen.ts";
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { exportedFunctions } from "./index.ts";
7
+
8
+ type FlippedT = any;
9
+ type FlipperT = any;
10
+
11
+ await CHUNKS.xpui.promise;
12
+
13
+ export const Flipper: FlipperT = exportedFunctions.find((m) => m.prototype?.getSnapshotBeforeUpdate)!;
14
+ export const Flipped: FlippedT = exportedFunctions.find((m) => (m as any).displayName === "Flipped")!;
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { webpackRequire } from "../wpunpk.mix.ts";
7
+ import { analyzeWebpackRequire, src } from "./index.ts";
8
+
9
+ await (CHUNKS["/dwp-full-screen-mode-container.js"] ??= Promise.withResolvers()).promise;
10
+
11
+ const { exportedFunctions } = analyzeWebpackRequire(webpackRequire);
12
+
13
+ export const useExtractedColor: Function = exportedFunctions.find(
14
+ (m) => src(m).includes("extracted-color") || (src(m).includes("colorRaw") && src(m).includes("useEffect")),
15
+ )!;
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as ReactHooks_fullscreen_ts from "./ReactHooks.fullscreen.ts";
7
+ export let useExtractedColor: typeof ReactHooks_fullscreen_ts.useExtractedColor;
8
+ import("./ReactHooks.fullscreen.ts").then(m => {
9
+ useExtractedColor = m.useExtractedColor;
10
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactHooks.fullscreen.ts failed:", e));
11
+
12
+ import type * as ReactHooks_xpui_ts from "./ReactHooks.xpui.ts";
13
+ export let DragHandler: typeof ReactHooks_xpui_ts.DragHandler;
14
+ export let usePanelAPI: typeof ReactHooks_xpui_ts.usePanelAPI;
15
+ export let useContextMenuState: typeof ReactHooks_xpui_ts.useContextMenuState;
16
+ export let imageAnalysis: typeof ReactHooks_xpui_ts.imageAnalysis;
17
+ export let fallbackPreset: typeof ReactHooks_xpui_ts.fallbackPreset;
18
+ export let getPlayContext: typeof ReactHooks_xpui_ts.getPlayContext;
19
+ export let useTrackListColumns: typeof ReactHooks_xpui_ts.useTrackListColumns;
20
+ export let usePanelStateMachine: typeof ReactHooks_xpui_ts.usePanelStateMachine;
21
+ export let extractColorPreset: typeof ReactHooks_xpui_ts.extractColorPreset;
22
+ import("./ReactHooks.xpui.ts").then(m => {
23
+ DragHandler = m.DragHandler;
24
+ usePanelAPI = m.usePanelAPI;
25
+ useContextMenuState = m.useContextMenuState;
26
+ imageAnalysis = m.imageAnalysis;
27
+ fallbackPreset = m.fallbackPreset;
28
+ getPlayContext = m.getPlayContext;
29
+ useTrackListColumns = m.useTrackListColumns;
30
+ usePanelStateMachine = m.usePanelStateMachine;
31
+ extractColorPreset = m.extractColorPreset;
32
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactHooks.xpui.ts failed:", e));
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ export * from "./ReactHooks.gen.ts";
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { Platform } from "../expose/Platform.ts";
7
+ import { exported, exportedFunctions } from "./index.ts";
8
+ import { findBy } from "../util.ts";
9
+
10
+ await CHUNKS.xpui.promise;
11
+
12
+ export const DragHandler: Function = findBy("dataTransfer", "data-dragging")(exportedFunctions);
13
+
14
+ export const usePanelAPI: Function = findBy("panelSend", "context")(exportedFunctions);
15
+
16
+ export const useContextMenuState: Function = findBy("useContextMenuState")(exportedFunctions);
17
+
18
+ export const imageAnalysis: Function = findBy(/\![a-zA-Z_\$][\w\$]*\.isFallback|\{extractColor/)(exportedFunctions);
19
+
20
+ export const fallbackPreset: any = exported.find((m) => m.colorDark && Object.hasOwn(m, "colorDark"));
21
+
22
+ export const getPlayContext: Function = findBy("referrerIdentifier", "usePlayContextItem")(exportedFunctions);
23
+
24
+ export const useTrackListColumns: Function = findBy("useTrackListColumns")(exportedFunctions);
25
+
26
+ export const usePanelStateMachine: () => [state: any, actor: any, machine: any] =
27
+ findBy("usePanelStateMachine")(exportedFunctions);
28
+
29
+ export const extractColorPreset = async (image: any) => {
30
+ const analysis = await imageAnalysis(Platform.getGraphQLLoader(), image);
31
+ // for (const result of analysis) {
32
+ // if (!("isFallback" in result)) {
33
+ // result.isFallback = fallbackPreset === result;
34
+ // }
35
+ // }
36
+
37
+ return analysis;
38
+ };
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as ReactQuery_xpui_ts from "./ReactQuery.xpui.ts";
7
+ export let QueryClient: typeof ReactQuery_xpui_ts.QueryClient;
8
+ export let PersistQueryClientProvider: typeof ReactQuery_xpui_ts.PersistQueryClientProvider;
9
+ export let QueryClientProvider: typeof ReactQuery_xpui_ts.QueryClientProvider;
10
+ export let notifyManager: typeof ReactQuery_xpui_ts.notifyManager;
11
+ export let useMutation: typeof ReactQuery_xpui_ts.useMutation;
12
+ export let useQuery: typeof ReactQuery_xpui_ts.useQuery;
13
+ export let useQueryClient: typeof ReactQuery_xpui_ts.useQueryClient;
14
+ export let useSuspenseQuery: typeof ReactQuery_xpui_ts.useSuspenseQuery;
15
+ export let useInfiniteQuery: typeof ReactQuery_xpui_ts.useInfiniteQuery;
16
+ import("./ReactQuery.xpui.ts").then(m => {
17
+ QueryClient = m.QueryClient;
18
+ PersistQueryClientProvider = m.PersistQueryClientProvider;
19
+ QueryClientProvider = m.QueryClientProvider;
20
+ notifyManager = m.notifyManager;
21
+ useMutation = m.useMutation;
22
+ useQuery = m.useQuery;
23
+ useQueryClient = m.useQueryClient;
24
+ useSuspenseQuery = m.useSuspenseQuery;
25
+ useInfiniteQuery = m.useInfiniteQuery;
26
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactQuery.xpui.ts failed:", e));
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ export * from "./ReactQuery.gen.ts";
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { exported, exportedFunctions, modules } from "./index.ts";
7
+
8
+ import type {
9
+ notifyManager as notifyManagerT,
10
+ QueryClient as QueryClientT,
11
+ QueryClientProvider as QueryClientProviderT,
12
+ useInfiniteQuery as useInfiniteQueryT,
13
+ useMutation as useMutationT,
14
+ useQuery as useQueryT,
15
+ useQueryClient as useQueryClientT,
16
+ useSuspenseQuery as useSuspenseQueryT,
17
+ } from "npm:@tanstack/react-query";
18
+ import { findBy } from "../util.ts";
19
+ import { webpackRequire } from "../wpunpk.mix.ts";
20
+
21
+ await CHUNKS.xpui.promise;
22
+
23
+ export const QueryClient: typeof QueryClientT = findBy("defaultMutationOptions")(exportedFunctions);
24
+ export const PersistQueryClientProvider = findBy("persistOptions")(exportedFunctions);
25
+ export const QueryClientProvider: typeof QueryClientProviderT = findBy("use QueryClientProvider")(exportedFunctions);
26
+ export const notifyManager: typeof notifyManagerT = exported.find(
27
+ (m) => typeof m.setBatchNotifyFunction === "function",
28
+ );
29
+ export const useMutation: typeof useMutationT = findBy("mutateAsync")(exportedFunctions);
30
+ export const useQuery: typeof useQueryT = findBy(
31
+ /^function [a-zA-Z_\$][\w\$]*\(([a-zA-Z_\$][\w\$]*),([a-zA-Z_\$][\w\$]*)\)\{return\(0,[a-zA-Z_\$][\w\$]*\.[a-zA-Z_\$][\w\$]*\)\(\1,[a-zA-Z_\$][\w\$]*\.[a-zA-Z_\$][\w\$]*,\2\)\}$/,
32
+ )(exportedFunctions);
33
+ export const useQueryClient: typeof useQueryClientT = findBy("client", "Provider", "mount")(exportedFunctions);
34
+ export const useSuspenseQuery: typeof useSuspenseQueryT = findBy(
35
+ "throwOnError",
36
+ "suspense",
37
+ "enabled",
38
+ "placeholderData",
39
+ )(exportedFunctions);
40
+
41
+ const [infiniteQueryModuleID] = modules.find(
42
+ ([_, v]) => v.toString().includes("fetchPreviousPage") && v.toString().includes("getOptimisticResult"),
43
+ )!;
44
+ export const useInfiniteQuery: typeof useInfiniteQueryT = Object.values(webpackRequire(infiniteQueryModuleID)).find(
45
+ (m) => typeof m === "function",
46
+ );
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as ReactRouter_xpui_ts from "./ReactRouter.xpui.ts";
7
+ export let useMatch: typeof ReactRouter_xpui_ts.useMatch;
8
+ export let useLocation: typeof ReactRouter_xpui_ts.useLocation;
9
+ import("./ReactRouter.xpui.ts").then(m => {
10
+ useMatch = m.useMatch;
11
+ useLocation = m.useLocation;
12
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./ReactRouter.xpui.ts failed:", e));
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ export * from "./ReactRouter.gen.ts";
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { findBy } from "../util.ts";
7
+ import { exportedFunctions, modules, src } from "./index.ts";
8
+
9
+ import type { useLocation as useLocationT, useMatch as useMatchT } from "npm:react-router";
10
+ import { webpackRequire } from "../wpunpk.mix.ts";
11
+
12
+ await CHUNKS.xpui.promise;
13
+
14
+ const [ReactRouterModuleID] = modules.find(([_, v]) => v.toString().includes("React Router"))!;
15
+ const ReactRouterModule = Object.values(webpackRequire(ReactRouterModuleID));
16
+
17
+ // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L131
18
+ export const useMatch: typeof useMatchT = ReactRouterModule.find(
19
+ (f) => src(f).includes("let{pathname:") && !src(f).includes(".createElement("),
20
+ );
21
+
22
+ export const useLocation: typeof useLocationT = findBy("location", "useContext")(exportedFunctions);
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as Snackbar_xpui_ts from "./Snackbar.xpui.ts";
7
+ export let useSnackbar: typeof Snackbar_xpui_ts.useSnackbar;
8
+ export let enqueueCustomSnackbar: typeof Snackbar_xpui_ts.enqueueCustomSnackbar;
9
+ import("./Snackbar.xpui.ts").then(m => {
10
+ useSnackbar = m.useSnackbar;
11
+ enqueueCustomSnackbar = m.enqueueCustomSnackbar;
12
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./Snackbar.xpui.ts failed:", e));
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ export * from "./Snackbar.gen.ts";
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import { exportedFunctions } from "./index.ts";
7
+ import { findBy } from "../util.ts";
8
+
9
+ // notistack ships inside the client bundle; these aliases stand in
10
+ // for its types, which cannot be resolved from the npm: URL.
11
+ type EnqueueSnackbarT = (...args: any[]) => any;
12
+ type OptionsObjectT = Record<string, any>;
13
+ type useSnackbarT = () => any;
14
+
15
+ await CHUNKS.xpui.promise;
16
+
17
+ export const useSnackbar: useSnackbarT = findBy(
18
+ /^function\(\)\{return\(0,[a-zA-Z_\$][\w\$]*\.useContext\)\([a-zA-Z_\$][\w\$]*\)\}$/,
19
+ )(exportedFunctions);
20
+
21
+ type FN_enqueueCustomSnackbar_OPTS =
22
+ | (Omit<OptionsObjectT, "key"> & { keyPrefix: string })
23
+ | (OptionsObjectT & { identifier: string });
24
+ export const enqueueCustomSnackbar: (
25
+ element: React.ReactElement,
26
+ opts: FN_enqueueCustomSnackbar_OPTS,
27
+ ) => ReturnType<EnqueueSnackbarT> = findBy("enqueueCustomSnackbar", "headless")(exportedFunctions);
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (C) 2024 Delusoire
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+
6
+ import type * as URI_xpui_ts from "./URI.xpui.ts";
7
+ export let Types: typeof URI_xpui_ts.Types;
8
+ export let is: typeof URI_xpui_ts.is;
9
+ export let create: typeof URI_xpui_ts.create;
10
+ export let isSameIdentity: typeof URI_xpui_ts.isSameIdentity;
11
+ export let urlEncode: typeof URI_xpui_ts.urlEncode;
12
+ export let idToHex: typeof URI_xpui_ts.idToHex;
13
+ export let hexToId: typeof URI_xpui_ts.hexToId;
14
+ export let from: typeof URI_xpui_ts.from;
15
+ export let fromString: typeof URI_xpui_ts.fromString;
16
+ import("./URI.xpui.ts").then(m => {
17
+ Types = m.Types;
18
+ is = m.is;
19
+ create = m.create;
20
+ isSameIdentity = m.isSameIdentity;
21
+ urlEncode = m.urlEncode;
22
+ idToHex = m.idToHex;
23
+ hexToId = m.hexToId;
24
+ from = m.from;
25
+ fromString = m.fromString;
26
+ }).catch((e) => console.warn("[stdlib] lazy webpack surface ./URI.xpui.ts failed:", e));