Small changes, fixing linux build

This commit is contained in:
Jean Ouina 2020-08-01 11:05:17 +02:00
parent 80b2b93b51
commit 0ca1af9b74
21 changed files with 560 additions and 438 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -289,13 +289,13 @@
left: 25px;
display: block !important;
cursor: pointer;
color: #FFF;
color: var(--header-primary);
position: fixed;
}
#removemenu ul a {
text-decoration: none;
color: #FFF;
color: var(--header-primary);
padding: 3px;
}
@ -370,7 +370,7 @@
background: var(--background-secondary);
box-shadow: rgba(0, 0, 0, 0.1) 1px 0 0 0;
flex-grow: 1;
color: #FFF;
color: var(--header-primary);
}
.theme-light #bda-qem button {
@ -413,7 +413,7 @@
.theme-light #bda-qem button.active,
.theme-light #bda-qem button.active:hover {
color: #ffffff;
color: var(--header-primary);
}
#bda-qem-twitch-container,
@ -459,8 +459,8 @@
#bd-pub-button {
border-radius: 4px;
background-color: rgb(47, 49, 54);
color: #b9bbbe;
background-color: var(--background-secondary);
color: var(--header-secondary);
text-align: center;
font-size: 12px;
line-height: 20px;
@ -475,7 +475,7 @@
width: 0;
line-height: 24px;
font-size: 12px;
color: #b9bbbe;
color: var(--header-secondary);
font-weight: 700;
margin-right: 10px;
}
@ -588,7 +588,7 @@
}
#pubslayer .ui-tab-bar-item.selected {
color: #fff;
color: var(--header-primary);
background-color: var(--background-modifier-selected);
}
@ -626,7 +626,7 @@
#pubslayer button {
background: var(--bd-blue);
color: #FFF;
color: var(--header-primary);
font-size: 14px;
font-weight: 500;
line-height: 16px;
@ -949,7 +949,7 @@
.bd-pfbtn {
background: var(--bd-blue);
color: #FFF;
color: #fff;
border-radius: 5px;
margin-left: 10px;
}
@ -983,7 +983,7 @@
.theme-dark .ui-tab-bar-item.selected {
background-color: var(--background-modifier-selected);
color: #fff;
color: var(--header-primary);
}
.theme-light .ui-tab-bar-item {
@ -997,7 +997,7 @@
.theme-light .ui-tab-bar-item.selected {
background-color: var(--background-modifier-selected);
color: #fff;
color: var(--header-primary);
}
.ui-tab-bar-header {
@ -1287,7 +1287,7 @@
.bd-addon-list .bd-card-footer button {
background: var(--bd-blue);
color: #FFF;
color: #fff;
border-radius: 5px;
display: block;
margin-left: auto;
@ -1421,7 +1421,7 @@
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, .2);
padding: 12px 20px;
z-index: 1;
color: #fff;
color: var(--header-primary);
font-size: 16px;
font-weight: 700;
line-height: 19px;
@ -1429,7 +1429,7 @@
.bd-modal-wrapper .bd-modal-body {
background-color: var(--background-primary);
color: #fff;
color: var(--header-primary);
flex-direction: row;
overflow: hidden;
display: flex;
@ -1459,7 +1459,7 @@
.bd-modal-wrapper .footer button {
background-color: var(--bd-blue);
color: #fff;
color: var(--header-primary);
min-height: 32px;
min-width: 60px;
align-items: center;
@ -1504,20 +1504,20 @@
.bd-modal-wrapper .tab-bar-container .tab-bar-item {
margin: 0 15px;
padding: 15px 0;
color: #fff !important;
color: var(--header-primary) !important;
opacity: 0.5;
transition: opacity 200ms ease;
border-bottom: 2px solid transparent;
}
.bd-modal-wrapper .tab-bar-container .tab-bar-item:hover {
border-color: #fff;
border-color: var(--header-primary);
cursor: pointer;
}
.bd-modal-wrapper .tab-bar-container .tab-bar-item.selected {
opacity: 1;
border-color: #fff;
border-color: var(--header-primary);
}
.bd-modal-wrapper .tab-bar.TOP .tab-bar-item+.tab-bar-item {
@ -1527,7 +1527,7 @@
.bd-modal-wrapper .table-header {
display: flex;
justify-content: space-between;
color: #fff;
color: var(--header-primary);
font-weight: 700;
padding-bottom: 10px;
margin: 3px 15px 0 15px;
@ -1557,7 +1557,7 @@
.bd-modal-wrapper .error {
display: flex;
color: #fff;
color: var(--header-primary);
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
padding: 15px 0;
align-items: center;
@ -1600,7 +1600,7 @@
border-radius: 5px;
box-shadow: 0 0 0 1px rgba(32, 34, 37, .6), 0 2px 10px 0 rgba(0, 0, 0, .2);
font-weight: 500;
color: #fff;
color: var(--header-primary);
user-select: text;
font-size: 14px;
opacity: 1;
@ -1608,6 +1608,18 @@
pointer-events: none;
user-select: none;
}
.theme-light .bd-toast.toast-error,
.theme-light .bd-toast.toast-danger,
.theme-light .bd-toast.toast-warning,
.theme-light .bd-toast.toast-warn,
.theme-light .bd-toast.toast-success,
.theme-light .bd-toast.toast-info {
color: #fff;
}
.theme-light .bd-toast {
box-shadow: 0 0 0 1px rgba(223, 221, 218, .6), 0 2px 10px 0 rgba(255, 255, 255, .2);
}
@keyframes bd-toast-down {
to {
@ -2068,7 +2080,7 @@
content: "";
display: block;
position: absolute;
background-color: #fff;
background-color: var(--header-primary);
z-index: 1;
width: 18px;
margin: 3px;
@ -2210,9 +2222,15 @@
white-space: pre;
}
.bd-select .bd-select-option:hover,
.bd-select .bd-select-option:hover {
background: var(--background-modifier-hover);
}
.bd-select .bd-select-option:active {
background: var(--background-modifier-active);
}
.bd-select .bd-select-option.selected {
background: #26272B;
background: var(--background-modifier-selected);
}
@ -2223,17 +2241,20 @@
border-radius: 3px;
outline: none;
border: 0;
background-color: #202225;
color: #fff;
background-color: var(--background-secondary);
color: var(--text-normal);
display: flex;
align-items: center;
}
.bd-search-wrapper.focused {
background-color: var(--background-modifier-selected)
}
.bd-search {
padding: 2px 3px;
background: none;
border: 0;
color: #fff;
color: var(--header-primary);
flex: 1;
}

File diff suppressed because one or more lines are too long

View File

@ -3702,7 +3702,8 @@
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
"dev": true
},
"jsesc": {
"version": "2.5.2",
@ -3886,6 +3887,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
"dev": true,
"requires": {
"js-tokens": "^3.0.0 || ^4.0.0"
}
@ -4278,7 +4280,8 @@
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"dev": true
},
"object-copy": {
"version": "0.1.0",
@ -4676,16 +4679,6 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true
},
"prop-types": {
"version": "15.7.2",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
"integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
"requires": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
"react-is": "^16.8.1"
}
},
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@ -4772,21 +4765,6 @@
"safe-buffer": "^5.1.0"
}
},
"react": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz",
"integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==",
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"prop-types": "^15.6.2"
}
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"read-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",

View File

@ -145,6 +145,7 @@ Core.prototype.patchPopoutWindow = async function() {
.then(popoutModule => {
if(canceled)return
/*
// Not a good idea to do it like that.
const interceptor = window.Lightcord.DiscordModules.dispatcher._interceptor
window.Lightcord.DiscordModules.dispatcher.setInterceptor(function(action){
@ -173,7 +174,7 @@ Core.prototype.patchPopoutWindow = async function() {
const window = popoutModule.default.getWindow(ev.key)
console.log(window)
})
})
})*/
})
};

View File

@ -201,26 +201,22 @@ export default class Utils {
static showToast(content, options = {}) {
if (!document.querySelector(".bd-toasts")) {
const container = document.querySelector("."+removeDa(BDModules.get(e => e.sidebar && e.hasNotice)[0].sidebar)+" + div") || null;
const memberlist = container ? container.querySelector("."+removeDa(BDModules.get(e => e.membersWrap)[0].membersWrap)) : null;
const form = container ? container.querySelector("form") : null;
const left = container ? container.getBoundingClientRect().left : 310;
const right = memberlist ? memberlist.getBoundingClientRect().left : 0;
const width = right ? right - container.getBoundingClientRect().left : Utils.screenWidth - left - 240;
const bottom = form ? form.offsetHeight : 80;
const toastWrapper = document.createElement("div");
toastWrapper.classList.add("bd-toasts");
toastWrapper.style.setProperty("left", left + "px");
toastWrapper.style.setProperty("width", width + "px");
toastWrapper.style.setProperty("bottom", bottom + "px");
toastWrapper.style.setProperty("bottom", bottom+"px");
document.querySelector("#app-mount").appendChild(toastWrapper);
}
const toastWrapper = document.querySelector(".bd-toasts")
const {type = "", icon = true, timeout = 3000} = options;
const toastElem = document.createElement("div");
toastElem.classList.add("bd-toast");
if (type) toastElem.classList.add("toast-" + type);
if (type && icon) toastElem.classList.add("icon");
toastElem.innerText = content;
document.querySelector(".bd-toasts").appendChild(toastElem);
toastWrapper.appendChild(toastElem);
toastWrapper.style.setProperty("left", `calc(50% - ${toastWrapper.offsetWidth / 2}px)`);
setTimeout(() => {
toastElem.classList.add("closing");
setTimeout(() => {

View File

@ -289,13 +289,13 @@
left: 25px;
display: block !important;
cursor: pointer;
color: #FFF;
color: var(--header-primary);
position: fixed;
}
#removemenu ul a {
text-decoration: none;
color: #FFF;
color: var(--header-primary);
padding: 3px;
}
@ -370,7 +370,7 @@
background: var(--background-secondary);
box-shadow: rgba(0, 0, 0, 0.1) 1px 0 0 0;
flex-grow: 1;
color: #FFF;
color: var(--header-primary);
}
.theme-light #bda-qem button {
@ -413,7 +413,7 @@
.theme-light #bda-qem button.active,
.theme-light #bda-qem button.active:hover {
color: #ffffff;
color: var(--header-primary);
}
#bda-qem-twitch-container,
@ -459,8 +459,8 @@
#bd-pub-button {
border-radius: 4px;
background-color: rgb(47, 49, 54);
color: #b9bbbe;
background-color: var(--background-secondary);
color: var(--header-secondary);
text-align: center;
font-size: 12px;
line-height: 20px;
@ -475,7 +475,7 @@
width: 0;
line-height: 24px;
font-size: 12px;
color: #b9bbbe;
color: var(--header-secondary);
font-weight: 700;
margin-right: 10px;
}
@ -588,7 +588,7 @@
}
#pubslayer .ui-tab-bar-item.selected {
color: #fff;
color: var(--header-primary);
background-color: var(--background-modifier-selected);
}
@ -626,7 +626,7 @@
#pubslayer button {
background: var(--bd-blue);
color: #FFF;
color: var(--header-primary);
font-size: 14px;
font-weight: 500;
line-height: 16px;
@ -949,7 +949,7 @@
.bd-pfbtn {
background: var(--bd-blue);
color: #FFF;
color: #fff;
border-radius: 5px;
margin-left: 10px;
}
@ -983,7 +983,7 @@
.theme-dark .ui-tab-bar-item.selected {
background-color: var(--background-modifier-selected);
color: #fff;
color: var(--header-primary);
}
.theme-light .ui-tab-bar-item {
@ -997,7 +997,7 @@
.theme-light .ui-tab-bar-item.selected {
background-color: var(--background-modifier-selected);
color: #fff;
color: var(--header-primary);
}
.ui-tab-bar-header {
@ -1287,7 +1287,7 @@
.bd-addon-list .bd-card-footer button {
background: var(--bd-blue);
color: #FFF;
color: #fff;
border-radius: 5px;
display: block;
margin-left: auto;
@ -1421,7 +1421,7 @@
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, .2);
padding: 12px 20px;
z-index: 1;
color: #fff;
color: var(--header-primary);
font-size: 16px;
font-weight: 700;
line-height: 19px;
@ -1429,7 +1429,7 @@
.bd-modal-wrapper .bd-modal-body {
background-color: var(--background-primary);
color: #fff;
color: var(--header-primary);
flex-direction: row;
overflow: hidden;
display: flex;
@ -1459,7 +1459,7 @@
.bd-modal-wrapper .footer button {
background-color: var(--bd-blue);
color: #fff;
color: var(--header-primary);
min-height: 32px;
min-width: 60px;
align-items: center;
@ -1504,20 +1504,20 @@
.bd-modal-wrapper .tab-bar-container .tab-bar-item {
margin: 0 15px;
padding: 15px 0;
color: #fff !important;
color: var(--header-primary) !important;
opacity: 0.5;
transition: opacity 200ms ease;
border-bottom: 2px solid transparent;
}
.bd-modal-wrapper .tab-bar-container .tab-bar-item:hover {
border-color: #fff;
border-color: var(--header-primary);
cursor: pointer;
}
.bd-modal-wrapper .tab-bar-container .tab-bar-item.selected {
opacity: 1;
border-color: #fff;
border-color: var(--header-primary);
}
.bd-modal-wrapper .tab-bar.TOP .tab-bar-item+.tab-bar-item {
@ -1527,7 +1527,7 @@
.bd-modal-wrapper .table-header {
display: flex;
justify-content: space-between;
color: #fff;
color: var(--header-primary);
font-weight: 700;
padding-bottom: 10px;
margin: 3px 15px 0 15px;
@ -1557,7 +1557,7 @@
.bd-modal-wrapper .error {
display: flex;
color: #fff;
color: var(--header-primary);
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
padding: 15px 0;
align-items: center;
@ -1600,7 +1600,7 @@
border-radius: 5px;
box-shadow: 0 0 0 1px rgba(32, 34, 37, .6), 0 2px 10px 0 rgba(0, 0, 0, .2);
font-weight: 500;
color: #fff;
color: var(--header-primary);
user-select: text;
font-size: 14px;
opacity: 1;
@ -1608,6 +1608,18 @@
pointer-events: none;
user-select: none;
}
.theme-light .bd-toast.toast-error,
.theme-light .bd-toast.toast-danger,
.theme-light .bd-toast.toast-warning,
.theme-light .bd-toast.toast-warn,
.theme-light .bd-toast.toast-success,
.theme-light .bd-toast.toast-info {
color: #fff;
}
.theme-light .bd-toast {
box-shadow: 0 0 0 1px rgba(223, 221, 218, .6), 0 2px 10px 0 rgba(255, 255, 255, .2);
}
@keyframes bd-toast-down {
to {
@ -2068,7 +2080,7 @@
content: "";
display: block;
position: absolute;
background-color: #fff;
background-color: var(--header-primary);
z-index: 1;
width: 18px;
margin: 3px;
@ -2210,9 +2222,15 @@
white-space: pre;
}
.bd-select .bd-select-option:hover,
.bd-select .bd-select-option:hover {
background: var(--background-modifier-hover);
}
.bd-select .bd-select-option:active {
background: var(--background-modifier-active);
}
.bd-select .bd-select-option.selected {
background: #26272B;
background: var(--background-modifier-selected);
}
@ -2223,17 +2241,20 @@
border-radius: 3px;
outline: none;
border: 0;
background-color: #202225;
color: #fff;
background-color: var(--background-secondary);
color: var(--text-normal);
display: flex;
align-items: center;
}
.bd-search-wrapper.focused {
background-color: var(--background-modifier-selected)
}
.bd-search {
padding: 2px 3px;
background: none;
border: 0;
color: #fff;
color: var(--header-primary);
flex: 1;
}

View File

@ -15,6 +15,7 @@ import BdApi from "../modules/bdApi";
import Utils from "../modules/utils";
import TooltipWrap from "./tooltipWrap";
import bdEvents from "../modules/bdEvents";
import EmulatedTooltip from "./tooltip";
const Tooltip = WebpackModules.findByDisplayName("Tooltip");
@ -174,9 +175,14 @@ export default class CardList extends BDV2.reactComponent {
if(typeof window.PluginUpdates.checkAll !== "function")return null
if(!this.isPlugins)return null
let tooltipIsShowing = false
let tooltip
return <TooltipWrap text="Checks for updates of plugins that support this feature. Right-click for a list.">
<span style={{marginLeft: "10px"}}>
<Lightcord.Api.Components.inputs.Button color="brand" look="filled" size="min" hoverColor="default" onClick={() => {
<span style={{marginLeft: "10px"}} onMouseLeave={() => {
tooltipIsShowing = false
tooltip.hide()
}}>
<Lightcord.Api.Components.inputs.Button ref="checkUpdateButton" color="brand" look="filled" size="min" hoverColor="default" onClick={() => {
try{
Utils.showToast("Plugin update check in progress.", {type: "info"})
window.PluginUpdates.checkAll()
@ -190,7 +196,17 @@ export default class CardList extends BDV2.reactComponent {
console.error(e)
Utils.showToast("An error occured while checking update.", {type: "error"})
}
}} wrapper={false} disabled={false}>
}} wrapper={false} disabled={false} onRightClick={() => {
if(!this.refs.checkUpdateButton)return
if (!window.PluginUpdates || !window.PluginUpdates.plugins) return;
if(tooltipIsShowing)return
tooltip = new EmulatedTooltip(this.refs.checkUpdateButton.refs.original.refs.button, Object.values(window.PluginUpdates.plugins).map(p => p.name).join(", "), {
side: "bottom",
attachEvents: false
})
tooltip.show()
tooltipIsShowing = true
}}>
Check for Updates
</Lightcord.Api.Components.inputs.Button>
</span>
@ -209,7 +225,13 @@ export default class CardList extends BDV2.reactComponent {
const addonCards = this.getAddons();
return <ContentColumn title={`${this.props.type.toUpperCase()}${addonCards.length}`}>
<button key="folder-button" className="bd-button bd-pfbtn" onClick={this.openFolder.bind(this)}>Open {this.isPlugins ? "Plugin" : "Theme"} Folder</button>
<Lightcord.Api.Components.inputs.Button key="folder-button" color="brand"
look="filled" size="min" hoverColor="default" onClick={this.openFolder.bind(this)} wrapper={false}
style={{
marginLeft: "10px"
}}>
Open {this.isPlugins ? "Plugin" : "Theme"} Folder
</Lightcord.Api.Components.inputs.Button>
{this.renderCheckUpdates()}
{!settingsCookie["fork-ps-5"] && refreshIcon}
<div className="bd-controls bd-addon-controls">

View File

@ -1,13 +1,27 @@
import BDV2 from "../../modules/v2";
import SearchIcon from "../icons/search";
const React = BDV2.React;
export default class Search extends React.Component {
render() {
return <div className="bd-search-wrapper">
<input onChange={this.props.onChange} onKeyDown={this.props.onKeyDown} type="text" className="bd-search" placeholder={this.props.placeholder} maxLength="50" />
<SearchIcon />
</div>;
}
import BDV2 from "../../modules/v2";
import SearchIcon from "../icons/search";
const React = BDV2.React;
export default class Search extends React.Component {
constructor(props){
super(props)
this.state = {
focused: false
}
}
render() {
const className = ["bd-search-wrapper"]
if(this.state.focused)className.push("focused")
return <div className={className.join(" ")}>
<input onChange={this.props.onChange} onKeyDown={this.props.onKeyDown} type="text"
className="bd-search" placeholder={this.props.placeholder} maxLength="50"
onFocus={() => {
this.setState({focused: true})
}} onBlur={() => {
this.setState({focused: false})
}}/>
<SearchIcon />
</div>;
}
}

View File

@ -1,21 +1,22 @@
import BDV2 from "../../modules/v2";
const React = BDV2.React;
export default class Switch extends React.Component {
constructor(props) {
super(props);
this.state = {checked: this.props.checked};
this.onChange = this.onChange.bind(this);
}
onChange(value) {
if (this.props.disabled) return;
this.props.onChange(value);
this.setState({checked: value});
}
render() {
return <Lightcord.Api.Components.inputs.Switch onChange={this.onChange} value={this.state.checked} />
}
import BDV2 from "../../modules/v2";
const React = BDV2.React;
export default class Switch extends React.Component {
constructor(props) {
super(props);
this.state = {checked: this.props.checked};
this.onChange = this.onChange.bind(this);
this.switch = <Lightcord.Api.Components.inputs.Switch onChange={this.onChange} value={this.state.checked} />
}
onChange(value) {
if (this.props.disabled) return;
this.props.onChange(value);
this.setState({checked: value});
}
render() {
return this.switch
}
}

View File

@ -35,8 +35,8 @@ export default class SwitchItem extends BDV2.reactComponent {
}
return BDV2.react.createElement("div", {className: "ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},
BDV2.react.createElement("div", {className: "ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},
BDV2.react.createElement("h3", {className: "ui-form-title h3 margin-reset margin-reset ui-flex-child"}, text),
BDV2.react.createElement(Switch, {onChange: this.onChange, checked: this.props.checked})
BDV2.react.createElement("h3", {key: "title", className: "ui-form-title h3 margin-reset margin-reset ui-flex-child"}, text),
BDV2.react.createElement(Switch, {key: "switch", onChange: this.onChange, checked: this.props.checked})
),
BDV2.react.createElement("div", {className: "ui-form-text style-description margin-top-4", style: {flex: "1 1 auto"}}, info)
);

View File

@ -38,13 +38,6 @@ const toPx = function(value) {
return `${value}px`;
};
/* <div class="layer-v9HyYc da-layer" style="left: 234.5px; bottom: 51px;">
<div class="tooltip-2QfLtc da-tooltip tooltipTop-XDDSxx tooltipBlack-PPG47z">
<div class="tooltipPointer-3ZfirK da-tooltipPointer"></div>
User Settings
</div>
</div> */
export default class EmulatedTooltip {
/**
*
@ -56,9 +49,10 @@ export default class EmulatedTooltip {
* @param {string} [options.side=top] - can be any of top, right, bottom, left
* @param {boolean} [options.preventFlip=false] - prevents moving the tooltip to the opposite side if it is too big or goes offscreen
* @param {boolean} [options.disabled=false] - whether the tooltip should be disabled from showing on hover
* @param {boolean} [options.attachEvents=true] - whether the tooltip should listen to mouseenter and mouseleave events.
*/
constructor(node, text, options = {}) {
const {style = "black", side = "top", preventFlip = false, disabled = false} = options;
const {style = "black", side = "top", preventFlip = false, disabled = false, attachEvents = true} = options;
this.node = node instanceof jQuery ? node[0] : node;
this.label = text;
this.style = style.toLowerCase();
@ -85,28 +79,30 @@ export default class EmulatedTooltip {
this.tooltipElement.append(this.labelElement);
this.element.append(this.tooltipElement);
this.node.addEventListener("mouseenter", () => {
if (this.disabled) return;
this.show();
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
const nodes = Array.from(mutation.removedNodes);
const directMatch = nodes.indexOf(this.node) > -1;
const parentMatch = nodes.some(parent => parent.contains(this.node));
if (directMatch || parentMatch) {
this.hide();
observer.disconnect();
}
if(attachEvents){
this.node.addEventListener("mouseenter", () => {
if (this.disabled) return;
this.show();
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
const nodes = Array.from(mutation.removedNodes);
const directMatch = nodes.indexOf(this.node) > -1;
const parentMatch = nodes.some(parent => parent.contains(this.node));
if (directMatch || parentMatch) {
this.hide();
observer.disconnect();
}
});
});
observer.observe(document.body, {subtree: true, childList: true});
});
observer.observe(document.body, {subtree: true, childList: true});
});
this.node.addEventListener("mouseleave", () => {
this.hide();
});
this.node.addEventListener("mouseleave", () => {
this.hide();
});
}
}
/** Container where the tooltip will be appended. */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,190 +1,203 @@
import WebpackLoader from "../../modules/WebpackLoader"
import { MouseEventHandler, ReactNode } from "react"
let ButtonModules
type ButtonProps = {
children?: ReactNode,
onClick?: MouseEventHandler,
color?: ButtonColor,
wrapper?: boolean,
look?: ButtonLook,
size?: ButtonSize,
hoverColor?: ButtonHovers,
disabled?: boolean
}
export default class Button extends React.Component<ButtonProps, {hover: boolean}> {
constructor(props:ButtonProps){
super(props)
this.state = {
hover: false
}
}
static Colors:ButtonColor[] = ["brand", "grey", "red", "green", "yellow", "primary", "link", "white", "black", "transparent"]
static Looks:ButtonLook[] = ["filled", "inverted", "outlined", "ghost", "link", "blank"]
static Sizes:ButtonSize[] = ["small", "medium", "large", "xlarge", "min", "max", "icon", "none"]
static HoverColors: ButtonHovers[] = ["default", ...Button.Colors]
get modules(){ // caching modules
return ButtonModules || (ButtonModules = [
WebpackLoader.findByUniqueProperties(["_horizontal"]),
WebpackLoader.findByUniqueProperties(["colorTransparent"]),
WebpackLoader.findByUniqueProperties(["buttonWrapper"]),
WebpackLoader.findByUniqueProperties(["ButtonColors"]),
])
}
render(){
let [
flexModule,
euhModule1,
buttonModule,
colorsModule,
] = this.modules
let props:ButtonProps = {}
if(this.props){
if("color" in this.props){
props.color = this.props.color
}
if("children" in this.props){
props.children = this.props.children
}
if("onClick" in this.props){
props.onClick = this.props.onClick
}
if("wrapper" in this.props){
props.wrapper = !!this.props.wrapper
}
if("look" in this.props){
props.look = this.props.look
}
if("size" in this.props){
props.size = this.props.size
}
if("hoverColor" in this.props){
props.hoverColor = this.props.hoverColor
}
if("disabled" in this.props){
props.disabled = this.props.disabled
}else{
props.disabled = false
}
}
if(props.color){
props.color = props.color.toLowerCase() as ButtonColor
if(!Button.Colors.includes(props.color)){
props.color = Button.Colors[0]
}
}else{
props.color = Button.Colors[0]
}
if(props.look){
props.look = props.look.toLowerCase() as ButtonLook
if(!Button.Looks.includes(props.look)){
props.look = Button.Looks[0]
}
}else{
props.look = Button.Looks[0]
}
if(props.size){
props.size = props.size.toLowerCase() as ButtonSize
if(!Button.Sizes.includes(props.size)){
props.size = Button.Sizes[0]
}
}else{
props.size = Button.Sizes[0]
}
if(props.hoverColor){
props.hoverColor = props.hoverColor.toLowerCase() as ButtonHovers
if(!Button.HoverColors.includes(props.hoverColor)){
props.hoverColor = Button.HoverColors[0]
}
}else{
props.hoverColor = Button.HoverColors[0]
}
let buttonSize = props.size ? colorsModule.ButtonSizes[props.size.toUpperCase()] || "" : ""
if(buttonSize)buttonSize = " " + buttonSize
let hoverColor = props.hoverColor ? colorsModule.ButtonHovers[props.hoverColor.toUpperCase()] || "" : ""
if(hoverColor)hoverColor = " " + hoverColor
props.onClick = typeof props.onClick === "function" ? props.onClick : () => {}
if(typeof props.wrapper !== "boolean")props.wrapper = true
let hover = this.state.hover ? euhModule1.hasHover : ""
if(hover)hover = " " + hover
let button = <button type="button"
className={`${flexModule.flexChild} ${euhModule1.button} ${colorsModule.ButtonLooks[props.look.toUpperCase()]} ${colorsModule.ButtonColors[props.color.toUpperCase()]}${buttonSize}${hoverColor}${hover} ${euhModule1.grow}`}
style={{flex: "0 1 auto"}} onClick={this.props.onClick} onMouseEnter={(ev) => {
if(!hoverColor)return
this.setState({hover: true})
}} onMouseLeave={(ev) => {
if(!hoverColor)return
this.setState({hover: false})
}} disabled={props.disabled}>
<div className={euhModule1.contents}>{props.children}</div>
</button>
if(props.wrapper){
return <div className={buttonModule.buttonWrapper}>
{button}
</div>
}
return button
}
static get AllPreviews(){
return AllPreviews || (() => {
AllPreviews = []
let colors = []
for(let color of Button.Colors){
colors.push({
color: color
})
}
AllPreviews.push(colors)
let looks = []
for(let look of Button.Looks){
looks.push({
look: look
})
}
AllPreviews.push(looks)
let sizes = []
for(let size of Button.Sizes){
sizes.push({
size: size
})
}
AllPreviews.push(sizes)
let hovers = []
for(let hover of Button.HoverColors){
hovers.push({
hoverColor: hover
})
}
AllPreviews.push(hovers)
AllPreviews.push([{children: "Test Button"}])
AllPreviews.push([{onClick: () => {}}])
AllPreviews.push([{wrapper: false}])
AllPreviews.push([{disabled: false}, {disabled: true}])
return AllPreviews
})()
}
}
let AllPreviews
export type ButtonColor = "brand" | "grey" | "red" | "green" | "yellow" | "primary" | "link" | "white" | "black" | "transparent"
export type ButtonLook = "filled" | "inverted" | "outlined" | "ghost" | "link" | "blank"
export type ButtonSize = "none" | "small" | "medium" | "large" | "xlarge" | "min" | "max" | "icon"
import WebpackLoader from "../../modules/WebpackLoader"
import { ReactNode, CSSProperties } from "react"
import NOOP from "../../modules/noop"
let ButtonModules
type ButtonProps = {
children?: ReactNode,
onClick?: () => void,
color?: ButtonColor,
wrapper?: boolean,
look?: ButtonLook,
size?: ButtonSize,
hoverColor?: ButtonHovers,
disabled?: boolean,
style?: CSSProperties,
onRightClick?: () => void
}
export default class Button extends React.Component<ButtonProps, {hover: boolean}> {
constructor(props:ButtonProps){
super(props)
this.state = {
hover: false
}
}
static Colors:ButtonColor[] = ["brand", "grey", "red", "green", "yellow", "primary", "link", "white", "black", "transparent"]
static Looks:ButtonLook[] = ["filled", "inverted", "outlined", "ghost", "link", "blank"]
static Sizes:ButtonSize[] = ["small", "medium", "large", "xlarge", "min", "max", "icon", "none"]
static HoverColors: ButtonHovers[] = ["default", ...Button.Colors]
get modules(){ // caching modules
return ButtonModules || (ButtonModules = [
WebpackLoader.findByUniqueProperties(["_horizontal"]),
WebpackLoader.findByUniqueProperties(["colorTransparent"]),
WebpackLoader.findByUniqueProperties(["buttonWrapper"]),
WebpackLoader.findByUniqueProperties(["ButtonColors"]),
])
}
render(){
let [
flexModule,
euhModule1,
buttonModule,
colorsModule,
] = this.modules
let props:ButtonProps = {}
if(this.props){
if("color" in this.props){
props.color = this.props.color
}
if("children" in this.props){
props.children = this.props.children
}
if("onClick" in this.props){
props.onClick = this.props.onClick
}
if("wrapper" in this.props){
props.wrapper = !!this.props.wrapper
}
if("look" in this.props){
props.look = this.props.look
}
if("size" in this.props){
props.size = this.props.size
}
if("hoverColor" in this.props){
props.hoverColor = this.props.hoverColor
}
if("disabled" in this.props){
props.disabled = this.props.disabled
}else{
props.disabled = false
}
if("style" in this.props){
props.style = this.props.style
}else{
props.style = {}
}
if("onRightClick" in this.props){
props.onRightClick = this.props.onRightClick
}else{
props.onRightClick = NOOP
}
}
if(props.color){
props.color = props.color.toLowerCase() as ButtonColor
if(!Button.Colors.includes(props.color)){
props.color = Button.Colors[0]
}
}else{
props.color = Button.Colors[0]
}
if(props.look){
props.look = props.look.toLowerCase() as ButtonLook
if(!Button.Looks.includes(props.look)){
props.look = Button.Looks[0]
}
}else{
props.look = Button.Looks[0]
}
if(props.size){
props.size = props.size.toLowerCase() as ButtonSize
if(!Button.Sizes.includes(props.size)){
props.size = Button.Sizes[0]
}
}else{
props.size = Button.Sizes[0]
}
if(props.hoverColor){
props.hoverColor = props.hoverColor.toLowerCase() as ButtonHovers
if(!Button.HoverColors.includes(props.hoverColor)){
props.hoverColor = Button.HoverColors[0]
}
}else{
props.hoverColor = Button.HoverColors[0]
}
let buttonSize = props.size ? colorsModule.ButtonSizes[props.size.toUpperCase()] || "" : ""
if(buttonSize)buttonSize = " " + buttonSize
let hoverColor = props.hoverColor ? colorsModule.ButtonHovers[props.hoverColor.toUpperCase()] || "" : ""
if(hoverColor)hoverColor = " " + hoverColor
props.onClick = typeof props.onClick === "function" ? props.onClick : () => {}
if(typeof props.wrapper !== "boolean")props.wrapper = true
let hover = this.state.hover ? euhModule1.hasHover : ""
if(hover)hover = " " + hover
let button = <button type="button"
ref="button" className={`${flexModule.flexChild} ${euhModule1.button} ${colorsModule.ButtonLooks[props.look.toUpperCase()]} ${colorsModule.ButtonColors[props.color.toUpperCase()]}${buttonSize}${hoverColor}${hover} ${euhModule1.grow}`}
style={{flex: "0 1 auto", ...props.style}} onClick={() => props.onClick()} onMouseEnter={(ev) => {
if(!hoverColor)return
this.setState({hover: true})
}} onMouseLeave={(ev) => {
if(!hoverColor)return
this.setState({hover: false})
}} disabled={props.disabled} onContextMenu={() => props.onRightClick()}>
<div className={euhModule1.contents}>{props.children}</div>
</button>
if(props.wrapper){
return <div ref="wrapper" className={buttonModule.buttonWrapper}>
{button}
</div>
}
return button
}
static get AllPreviews(){
return AllPreviews || (() => {
AllPreviews = []
let colors = []
for(let color of Button.Colors){
colors.push({
color: color
})
}
AllPreviews.push(colors)
let looks = []
for(let look of Button.Looks){
looks.push({
look: look
})
}
AllPreviews.push(looks)
let sizes = []
for(let size of Button.Sizes){
sizes.push({
size: size
})
}
AllPreviews.push(sizes)
let hovers = []
for(let hover of Button.HoverColors){
hovers.push({
hoverColor: hover
})
}
AllPreviews.push(hovers)
AllPreviews.push([{children: "Test Button"}])
AllPreviews.push([{onClick: () => {}}])
AllPreviews.push([{wrapper: false}])
AllPreviews.push([{disabled: false}, {disabled: true}])
return AllPreviews
})()
}
}
let AllPreviews
export type ButtonColor = "brand" | "grey" | "red" | "green" | "yellow" | "primary" | "link" | "white" | "black" | "transparent"
export type ButtonLook = "filled" | "inverted" | "outlined" | "ghost" | "link" | "blank"
export type ButtonSize = "none" | "small" | "medium" | "large" | "xlarge" | "min" | "max" | "icon"
export type ButtonHovers = "default" | ButtonColor

View File

@ -79,7 +79,7 @@ export function createProxyErrorCatcherClass<base = Function>(Class:base):base &
const ClassCopy = (class Proxied extends React.Component {
render(){
return <ErrorCatcher key={uuid()}>
{React.createElement(Class as any, {...this.props, key: uuid()})}
{React.createElement(Class as any, {ref: "original", ...this.props, key: uuid()})}
</ErrorCatcher>
}

View File

@ -442,7 +442,7 @@ async function privateInit(){
data.friend_suggestion_count = data.friend_suggestion_count || 0
data.presences = data.presences || []
}else{
logger.log(`Logged in as an user. Skipping`)
logger.log(`Logged in as an user. Skipping user spoofing.`)
}
}
let returnValue = _handleDispatch.call(this, ...arguments)

View File

@ -15,6 +15,7 @@ function forwardToCurrentWebview(event){
}]
}
/** discord_desktop_core Stable */
ipc.on(...forwardToCurrentWebview("MAIN_WINDOW_FOCUS"))
ipc.on(...forwardToCurrentWebview("MAIN_WINDOW_BLUR"))
ipc.on(...forwardToCurrentWebview("SYSTEM_TRAY_OPEN_VOICE_SETTINGS"))
@ -37,6 +38,10 @@ ipc.on(...forwardToCurrentWebview("ACCESSIBILITY_SUPPORT_CHANGED"))
ipc.on(...forwardToCurrentWebview("HELP_OPEN"))
ipc.on(...forwardToCurrentWebview("USER_SETTINGS_OPEN"))
ipc.on(...forwardToCurrentWebview("MAIN_WINDOW_PATH"))
/** discord_desktop_core Development */
ipc.on(...forwardToCurrentWebview("NAVIGATE_BACK"))
ipc.on(...forwardToCurrentWebview("NAVIGATE_FORWARD"))
ipc.on("RELOAD", () => {
let webview = webviews.get(document.querySelector(".chrome-tab[active]"))
if(!webview)return

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "lightcord",
"version": "0.1.3",
"version": "0.1.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -14,7 +14,8 @@
"build:minify": "node build.js",
"build:after": "node afterbuild.js",
"devInstall": "npm i --save-dev --arch=ia32 electron@8.4.0 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\"",
"devInstall:64": "npm i --save-dev --arch=x64 electron@8.4.0 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\""
"devInstall:64": "npm i --save-dev --arch=x64 electron@8.4.0 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\"",
"versions": "echo Electron: && electron -v && echo Typescript: && tsc -v"
},
"author": "",
"license": "ISC",