Skip to content

Commit e50f6e2

Browse files
rxriDelusoire
andauthored
fix(wrapper): find correct classnames for 1.2.40 (#3071)
Co-authored-by: Delusoire <deluso7re@outlook.com>
1 parent c1493ae commit e50f6e2

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

jsHelper/spicetifyWrapper.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,11 @@ window.Spicetify = {
512512
ReactJSX: cache.find(m => m?.jsx),
513513
ReactDOM: cache.find(m => m?.createPortal),
514514
ReactDOMServer: cache.find(m => m?.renderToString),
515-
// classnames for 1.2.13
516-
classnames: cache
517-
.filter(module => typeof module === "function")
518-
.find(module => module.toString().includes('"string"') && module.toString().includes("[native code]")),
515+
// https://github.com/JedWatson/classnames/
516+
classnames: chunks
517+
.filter(([_, v]) => v.toString().includes("[native code]"))
518+
.map(([i]) => require(i))
519+
.find(e => typeof e === "function"),
519520
Color: functionModules.find(m => m.toString().includes("static fromHex") || m.toString().includes("this.rgb")),
520521
Player: {
521522
...Spicetify.Player,
@@ -696,16 +697,6 @@ window.Spicetify = {
696697
}
697698
});
698699

699-
// classnames
700-
// https://github.com/JedWatson/classnames/
701-
const classnamesChunk = chunks.find(
702-
([_, value]) =>
703-
value.toString().includes("[native code]") && !value.toString().includes("<anonymous>") && !value.toString().includes("Super expression")
704-
);
705-
if (classnamesChunk && !Spicetify.classnames) {
706-
Spicetify.classnames = Object.values(require(classnamesChunk[0])).find(m => typeof m === "function");
707-
}
708-
709700
const contextMenuChunk = chunks.find(([, value]) => value.toString().includes("toggleContextMenu"));
710701
if (contextMenuChunk) {
711702
Spicetify.ReactComponent.ContextMenu = Object.values(require(contextMenuChunk[0])).find(m => typeof m === "function");
@@ -1045,7 +1036,7 @@ Spicetify._getStyledClassName = (args, component) => {
10451036
}
10461037
}
10471038

1048-
const excludedKeys = ["children", "className", "style", "dir", "key", "ref", "as", "$autoMirror", "$hasFocus", ""];
1039+
const excludedKeys = ["children", "className", "style", "dir", "key", "ref", "as", "$autoMirror", "autoMirror", "$hasFocus", ""];
10491040
const excludedPrefix = ["aria-"];
10501041

10511042
const childrenProps = ["iconLeading", "iconTrailing", "iconOnly", "$iconOnly", "$iconLeading", "$iconTrailing"];

0 commit comments

Comments
 (0)