Update 0BDFDB.plugin.js

This commit is contained in:
Mirco Wittrien 2022-10-21 11:58:01 +02:00
parent a96ab7c523
commit 7290276271
1 changed files with 20 additions and 26 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.8.3
* @version 2.8.4
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -8102,24 +8102,6 @@ module.exports = (_ => {
let extraDefaultProps = {};
for (let type of newBadges) extraDefaultProps[`${type}Width`] = 16;
const getLeftBadgePositionInterpolation = function (leftBadge, newValue) {
return void 0 === newValue && (newValue = 1), leftBadge.springs.spring.to([0, 1], [20, 0]).to(value => "translate(" + value * -1 + " " + value * newValue + ")");
};
const getLowerLeftBadgeStyles = function () {
const spring = this.state.lowerLeftBadgeMask.springs.spring;
return {
opacity: spring.to([0, .5, 1], [0, 0, 1]),
transform: spring.to(value => "translate(" + -1 * (16 - 16 * value) + "px, " + (16 - 16 * value) + "px)")
};
};
const getUpperLeftBadgeStyles = function () {
const spring = this.state.upperLeftBadgeMask.springs.spring;
return {
opacity: spring.to([0, .5, 1], [0, 0, 1]),
transform: spring.to(value => "translate(" + -1 * (16 - 16 * value) + "px, " + -1 * (16 - 16 * value) + "px)")
};
};
BDFDB.PatchUtils.patch(BDFDB, e.component.prototype, "render", {
before: e2 => {
e2.instance.props = Object.assign({}, e.component.defaultProps, extraDefaultProps, e2.instance.props);
@ -8131,13 +8113,25 @@ module.exports = (_ => {
tChildren[tIndex].props.children.push(!e2.instance.props.lowerLeftBadge ? null : BDFDB.ReactUtils.createElement(Internal.LibraryComponents.BadgeAnimationContainer, {
className: BDFDB.disCN.guildlowerleftbadge,
key: "lower-left-badge",
animatedStyle: getLowerLeftBadgeStyles(),
animatedStyle: _ => {
const spring = e2.instance.state.lowerLeftBadgeMask.springs.spring;
return {
opacity: spring.to([0, .5, 1], [0, 0, 1]),
transform: spring.to(value => "translate(" + -1 * (16 - 16 * value) + "px, " + (16 - 16 * value) + "px)")
};
},
children: e2.instance.props.lowerLeftBadge
}));
tChildren[tIndex].props.children.push(!e2.instance.props.upperLeftBadge ? null : BDFDB.ReactUtils.createElement(Internal.LibraryComponents.BadgeAnimationContainer, {
className: BDFDB.disCN.guildupperleftbadge,
key: "upper-left-badge",
animatedStyle: getUpperLeftBadgeStyles(),
animatedStyle: _ => {
const spring = e2.instance.state.upperLeftBadgeMask.springs.spring;
return {
opacity: spring.to([0, .5, 1], [0, 0, 1]),
transform: spring.to(value => "translate(" + -1 * (16 - 16 * value) + "px, " + -1 * (16 - 16 * value) + "px)")
};
},
children: e2.instance.props.upperLeftBadge
}));
}
@ -8150,7 +8144,7 @@ module.exports = (_ => {
height: 24,
rx: 12,
ry: 12,
transform: getLeftBadgePositionInterpolation(e2.instance.state.upperLeftBadgeMask, -1),
transform: e2.instance.state.upperLeftBadgeMask.springs.spring.to([0, 1], [20, 0]).to(value => `translate(${value * -1} ${value * -1})`),
fill: "black"
}));
mChildren[mIndex].props.children.push(BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Animations.animated.rect, {
@ -8160,12 +8154,12 @@ module.exports = (_ => {
height: 24,
rx: 12,
ry: 12,
transform: getLeftBadgePositionInterpolation(e2.instance.state.lowerLeftBadgeMask),
transform: e2.instance.state.lowerLeftBadgeMask.springs.spring.to([0, 1], [20, 0]).to(value => `translate(${value * -1} ${value * 1})`),
fill: "black"
}));
}
}
});
}, {name: "BlobMask"});
BDFDB.PatchUtils.patch(BDFDB, e.component.prototype, "componentDidMount", {
after: e2 => {
for (let type of newBadges) e2.instance.state[`${type}Mask`].update({
@ -8173,7 +8167,7 @@ module.exports = (_ => {
immediate: true
}).start();
}
});
}, {name: "BlobMask"});
BDFDB.PatchUtils.patch(BDFDB, e.component.prototype, "componentWillUnmount", {
after: e2 => {
for (let type of newBadges) if (e2.instance.state[`${type}Mask`]) e2.instance.state[`${type}Mask`].dispose();
@ -8196,7 +8190,7 @@ module.exports = (_ => {
}).start();
}
}
});
}, {name: "BlobMask"});
};
Internal.processDiscordTag = function (e) {
if (e.instance && e.instance.props && e.returnvalue && e.instance.props.user) e.returnvalue.props.user = e.instance.props.user;