repoutils replacement
This commit is contained in:
parent
e057c7190f
commit
04861a82ef
17
.eslintrc
17
.eslintrc
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
"extends": "eslint:recommended",
|
||||
"extends": ["eslint:recommended", "plugin:react/recommended"],
|
||||
"plugins": [
|
||||
"react"
|
||||
],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
|
@ -7,7 +10,10 @@
|
|||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 8,
|
||||
"sourceType": "module"
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"semi": 2,
|
||||
|
@ -24,7 +30,12 @@
|
|||
"quote-props": ["error", "consistent-as-needed", {"keywords": true}],
|
||||
"object-curly-spacing": ["error", "never", { "objectsInObjects": false }],
|
||||
"no-var": "error",
|
||||
"prefer-const": "error"
|
||||
"prefer-const": "error",
|
||||
"react/jsx-uses-react": "error",
|
||||
"react/jsx-uses-vars": "error",
|
||||
"react/prop-types": "off",
|
||||
"react/jsx-no-target-blank": "error",
|
||||
"react/jsx-key": "off"
|
||||
},
|
||||
"globals": {
|
||||
"webpackJsonp": false,
|
||||
|
|
248
css/main.css
248
css/main.css
|
@ -1074,11 +1074,11 @@ body .ace_closeButton:active {
|
|||
display: flex;
|
||||
}
|
||||
|
||||
.bda-slist {
|
||||
.bd-addon-list {
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.bda-slist li {
|
||||
.bd-addon-list .bd-addon-card {
|
||||
max-height: 175px;
|
||||
margin-bottom: 20px;
|
||||
padding: 5px 8px;
|
||||
|
@ -1086,23 +1086,23 @@ body .ace_closeButton:active {
|
|||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.theme-dark .bda-slist li {
|
||||
.theme-dark .bd-addon-list .bd-addon-card {
|
||||
background-color: rgba(32,34,37,.6);
|
||||
color: #f6f6f7;
|
||||
border-color: #202225;
|
||||
}
|
||||
.theme-light .bda-slist li {
|
||||
.theme-light .bd-addon-list .bd-addon-card {
|
||||
background-color: #f8f9f9;
|
||||
color: #4f545c;
|
||||
border-color: #dcddde;
|
||||
}
|
||||
|
||||
.bda-slist li.settings-open {
|
||||
.bd-addon-list .bd-addon-card.settings-open {
|
||||
max-height: 800px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.bda-slist .bda-header {
|
||||
.bd-addon-list .bda-header {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
|
@ -1112,36 +1112,36 @@ body .ace_closeButton:active {
|
|||
border-bottom: 1px solid transparent;
|
||||
overflow: hidden;
|
||||
}
|
||||
.theme-dark .bda-slist .bda-header {
|
||||
.theme-dark .bd-addon-list .bda-header {
|
||||
color: #f6f6f7;
|
||||
border-bottom-color: rgba(114,118,125,.3);
|
||||
}
|
||||
.theme-light .bda-slist .bda-header {
|
||||
.theme-light .bd-addon-list .bda-header {
|
||||
color: #4f545c;
|
||||
border-bottom-color: rgba(185,187,190,.3);
|
||||
}
|
||||
|
||||
.bda-slist .bda-description {
|
||||
.bd-addon-list .bda-description {
|
||||
word-break: break-word;
|
||||
max-height: 100px;
|
||||
margin: 5px 0;
|
||||
padding: 5px 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.theme-dark .bda-slist .bda-description {
|
||||
.theme-dark .bd-addon-list .bda-description {
|
||||
color: #b9bbbe;
|
||||
}
|
||||
.theme-light .bda-slist .bda-description {
|
||||
.theme-light .bd-addon-list .bda-description {
|
||||
color: #72767d;
|
||||
}
|
||||
|
||||
.bda-slist .scroller::-webkit-scrollbar-track-piece,
|
||||
.bda-slist .scroller::-webkit-scrollbar-thumb {
|
||||
.bd-addon-list .scroller::-webkit-scrollbar-track-piece,
|
||||
.bd-addon-list .scroller::-webkit-scrollbar-thumb {
|
||||
border-radius:0 !important;
|
||||
border-color:transparent;
|
||||
}
|
||||
|
||||
.bda-slist .bda-footer {
|
||||
.bd-addon-list .bda-footer {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
|
@ -1151,14 +1151,14 @@ body .ace_closeButton:active {
|
|||
border-top: 1px solid transparent;
|
||||
overflow: hidden;
|
||||
}
|
||||
.theme-dark .bda-slist .bda-footer {
|
||||
.theme-dark .bd-addon-list .bda-footer {
|
||||
border-top-color: rgba(114,118,125,.3);
|
||||
}
|
||||
.theme-light .bda-slist .bda-footer {
|
||||
.theme-light .bd-addon-list .bda-footer {
|
||||
border-top-color: rgba(185,187,190,.3);
|
||||
}
|
||||
|
||||
.bda-slist .bda-footer button {
|
||||
.bd-addon-list .bda-footer button {
|
||||
background: #7289da;
|
||||
color: #FFF;
|
||||
border-radius: 5px;
|
||||
|
@ -1168,15 +1168,15 @@ body .ace_closeButton:active {
|
|||
transition: opacity 250ms ease;
|
||||
}
|
||||
|
||||
.bda-slist .bda-footer button:disabled {
|
||||
.bd-addon-list .bda-footer button:disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.bda-slist .bda-footer a {
|
||||
.bd-addon-list .bda-footer a {
|
||||
color: #7289da;
|
||||
}
|
||||
|
||||
.bda-slist .bda-footer a:hover {
|
||||
.bd-addon-list .bda-footer a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
/* ======================= */
|
||||
|
@ -1834,3 +1834,211 @@ body .ace_closeButton:active {
|
|||
|
||||
/* =============== */
|
||||
/* END DARK MODE */
|
||||
|
||||
|
||||
|
||||
.bd-switch {
|
||||
background-color: #72767d;
|
||||
border-radius: 14px;
|
||||
width: 42px;
|
||||
height: 24px;
|
||||
opacity: 1;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
position: relative;
|
||||
display: block;
|
||||
flex: 0 0 auto;
|
||||
transition: background .15s ease-in-out,box-shadow .15s ease-in-out,border .15s ease-in-out,opacity .15s ease-in-out;
|
||||
margin-left: 10px;
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.15);
|
||||
}
|
||||
|
||||
.bd-switch::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 0;
|
||||
opacity: 0;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.bd-switch::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
z-index: 1;
|
||||
width: 18px;
|
||||
margin: 3px;
|
||||
border-radius: 9px;
|
||||
height: 18px;
|
||||
left: 0;
|
||||
transition: transform .15s ease-in-out,width .1s ease-in-out,left .1s ease-in-out;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,.3);
|
||||
}
|
||||
|
||||
.bd-switch .bd-checkbox {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bd-switch-checked {
|
||||
background-color: #3E82E5;
|
||||
}
|
||||
|
||||
.bd-switch-checked::after {
|
||||
transform: translate3d(18px,0,0);
|
||||
}
|
||||
|
||||
.bd-switch-disabled {
|
||||
opacity: .3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.bd-addon-button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bd-addon-button + .bd-addon-button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
|
||||
.bd-addon-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.bd-addon-controls .bd-search {
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.bd-addon-dropdowns {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.bd-select-wrapper + .bd-select-wrapper {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.bd-select-wrapper {
|
||||
color: #f6f6f7;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.bd-select-wrapper label {
|
||||
opacity: .3;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.bd-select {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
color: #f6f6f7;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
border-radius: 3px;
|
||||
padding: 5px 5px 5px 0;
|
||||
}
|
||||
|
||||
.bd-select.bd-select-transparent {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.bd-select-value {
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.bd-select-arrow {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.bd-select .bd-select-options {
|
||||
position: absolute;
|
||||
background: #2F3136;
|
||||
border-radius: 0 0 3px 3px;
|
||||
max-height: 300px;
|
||||
min-width: calc(100% + 2px);
|
||||
overflow-y: auto;
|
||||
box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 5px 0px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
border-top: 0;
|
||||
margin-top: -1px;
|
||||
margin-left: -1px;
|
||||
z-index: 3;
|
||||
top: 100%;
|
||||
}
|
||||
|
||||
.bd-select-transparent .bd-select-options {
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
margin-top: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.bd-select .bd-select-option {
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.bd-select .bd-select-option:hover,
|
||||
.bd-select .bd-select-option.selected {
|
||||
background: #26272B;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.bd-search-wrapper {
|
||||
padding: 3px;
|
||||
border-radius: 3px;
|
||||
outline: none;
|
||||
border: 0;
|
||||
background-color: #202225;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.bd-search {
|
||||
padding: 2px 3px;
|
||||
background: none;
|
||||
border: 0;
|
||||
color: #fff;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.bd-search-wrapper > svg {
|
||||
margin-right: 2px;
|
||||
}
|
File diff suppressed because one or more lines are too long
134
js/main.js
134
js/main.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -8,7 +8,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
|
||||
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/highlight": "^7.8.3"
|
||||
}
|
||||
|
@ -28,7 +27,6 @@
|
|||
"version": "7.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.4.tgz",
|
||||
"integrity": "sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.8.3",
|
||||
"@babel/generator": "^7.8.4",
|
||||
|
@ -51,7 +49,6 @@
|
|||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
|
||||
"integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.1"
|
||||
}
|
||||
|
@ -60,7 +57,6 @@
|
|||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
|
@ -68,8 +64,7 @@
|
|||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -77,7 +72,6 @@
|
|||
"version": "7.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.4.tgz",
|
||||
"integrity": "sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "^7.8.3",
|
||||
"jsesc": "^2.5.1",
|
||||
|
@ -173,7 +167,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz",
|
||||
"integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-get-function-arity": "^7.8.3",
|
||||
"@babel/template": "^7.8.3",
|
||||
|
@ -184,7 +177,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz",
|
||||
"integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "^7.8.3"
|
||||
}
|
||||
|
@ -293,7 +285,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz",
|
||||
"integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "^7.8.3"
|
||||
}
|
||||
|
@ -314,7 +305,6 @@
|
|||
"version": "7.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.4.tgz",
|
||||
"integrity": "sha512-VPbe7wcQ4chu4TDQjimHv/5tj73qz88o12EPkO2ValS2QiQS/1F2SsjyIGNnAD0vF/nZS6Cf9i+vW6HIlnaR8w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/template": "^7.8.3",
|
||||
"@babel/traverse": "^7.8.4",
|
||||
|
@ -325,7 +315,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz",
|
||||
"integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.0.0",
|
||||
"esutils": "^2.0.2",
|
||||
|
@ -335,8 +324,7 @@
|
|||
"@babel/parser": {
|
||||
"version": "7.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.4.tgz",
|
||||
"integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw=="
|
||||
},
|
||||
"@babel/plugin-proposal-async-generator-functions": {
|
||||
"version": "7.8.3",
|
||||
|
@ -942,7 +930,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.3.tgz",
|
||||
"integrity": "sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.8.3",
|
||||
"@babel/parser": "^7.8.3",
|
||||
|
@ -953,7 +940,6 @@
|
|||
"version": "7.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.4.tgz",
|
||||
"integrity": "sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.8.3",
|
||||
"@babel/generator": "^7.8.4",
|
||||
|
@ -970,7 +956,6 @@
|
|||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
|
@ -978,8 +963,7 @@
|
|||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -987,7 +971,6 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz",
|
||||
"integrity": "sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.13",
|
||||
|
@ -1216,7 +1199,6 @@
|
|||
"version": "1.1.0",
|
||||
"resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
|
||||
"integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-wrap": "^0.1.0"
|
||||
}
|
||||
|
@ -1258,7 +1240,6 @@
|
|||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
|
@ -1266,8 +1247,7 @@
|
|||
"ansi-wrap": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
|
||||
"integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=",
|
||||
"dev": true
|
||||
"integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768="
|
||||
},
|
||||
"anymatch": {
|
||||
"version": "2.0.0",
|
||||
|
@ -1303,8 +1283,7 @@
|
|||
"arr-diff": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
|
||||
"integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
|
||||
"dev": true
|
||||
"integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA="
|
||||
},
|
||||
"arr-filter": {
|
||||
"version": "1.1.2",
|
||||
|
@ -1333,8 +1312,7 @@
|
|||
"arr-union": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
|
||||
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
|
||||
"dev": true
|
||||
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ="
|
||||
},
|
||||
"array-each": {
|
||||
"version": "1.0.1",
|
||||
|
@ -1449,8 +1427,7 @@
|
|||
"assign-symbols": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
|
||||
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
|
||||
"dev": true
|
||||
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c="
|
||||
},
|
||||
"async-done": {
|
||||
"version": "1.3.1",
|
||||
|
@ -1493,6 +1470,41 @@
|
|||
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
|
||||
"dev": true
|
||||
},
|
||||
"babel-helper-evaluate-path": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.5.0.tgz",
|
||||
"integrity": "sha512-mUh0UhS607bGh5wUMAQfOpt2JX2ThXMtppHRdRU1kL7ZLRWIXxoV2UIV1r2cAeeNeU1M5SB5/RSUgUxrK8yOkA=="
|
||||
},
|
||||
"babel-helper-flip-expressions": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz",
|
||||
"integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0="
|
||||
},
|
||||
"babel-helper-is-nodes-equiv": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz",
|
||||
"integrity": "sha1-NOmzALFHnd2Y7HfqC76TQt/jloQ="
|
||||
},
|
||||
"babel-helper-is-void-0": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.4.3.tgz",
|
||||
"integrity": "sha1-fZwBtFYee5Xb2g9u7kj1tg5nMT4="
|
||||
},
|
||||
"babel-helper-mark-eval-scopes": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz",
|
||||
"integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI="
|
||||
},
|
||||
"babel-helper-remove-or-void": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz",
|
||||
"integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA="
|
||||
},
|
||||
"babel-helper-to-multiple-sequence-expressions": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.5.0.tgz",
|
||||
"integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA=="
|
||||
},
|
||||
"babel-loader": {
|
||||
"version": "8.0.6",
|
||||
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz",
|
||||
|
@ -1514,6 +1526,180 @@
|
|||
"object.assign": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-builtins": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz",
|
||||
"integrity": "sha512-wpqbN7Ov5hsNwGdzuzvFcjgRlzbIeVv1gMIlICbPj0xkexnfoIDe7q+AZHMkQmAE/F9R5jkrB6TLfTegImlXag=="
|
||||
},
|
||||
"babel-plugin-minify-constant-folding": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.5.0.tgz",
|
||||
"integrity": "sha512-Vj97CTn/lE9hR1D+jKUeHfNy+m1baNiJ1wJvoGyOBUx7F7kJqDZxr9nCHjO/Ad+irbR3HzR6jABpSSA29QsrXQ==",
|
||||
"requires": {
|
||||
"babel-helper-evaluate-path": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-dead-code-elimination": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.1.tgz",
|
||||
"integrity": "sha512-x8OJOZIrRmQBcSqxBcLbMIK8uPmTvNWPXH2bh5MDCW1latEqYiRMuUkPImKcfpo59pTUB2FT7HfcgtG8ZlR5Qg==",
|
||||
"requires": {
|
||||
"babel-helper-evaluate-path": "^0.5.0",
|
||||
"babel-helper-mark-eval-scopes": "^0.4.3",
|
||||
"babel-helper-remove-or-void": "^0.4.3",
|
||||
"lodash": "^4.17.11"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-flip-comparisons": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.4.3.tgz",
|
||||
"integrity": "sha1-AMqHDLjxO0XAOLPB68DyJyk8llo=",
|
||||
"requires": {
|
||||
"babel-helper-is-void-0": "^0.4.3"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-guarded-expressions": {
|
||||
"version": "0.4.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.4.4.tgz",
|
||||
"integrity": "sha512-RMv0tM72YuPPfLT9QLr3ix9nwUIq+sHT6z8Iu3sLbqldzC1Dls8DPCywzUIzkTx9Zh1hWX4q/m9BPoPed9GOfA==",
|
||||
"requires": {
|
||||
"babel-helper-evaluate-path": "^0.5.0",
|
||||
"babel-helper-flip-expressions": "^0.4.3"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-infinity": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.3.tgz",
|
||||
"integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco="
|
||||
},
|
||||
"babel-plugin-minify-mangle-names": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.5.0.tgz",
|
||||
"integrity": "sha512-3jdNv6hCAw6fsX1p2wBGPfWuK69sfOjfd3zjUXkbq8McbohWy23tpXfy5RnToYWggvqzuMOwlId1PhyHOfgnGw==",
|
||||
"requires": {
|
||||
"babel-helper-mark-eval-scopes": "^0.4.3"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-numeric-literals": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz",
|
||||
"integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw="
|
||||
},
|
||||
"babel-plugin-minify-replace": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.5.0.tgz",
|
||||
"integrity": "sha512-aXZiaqWDNUbyNNNpWs/8NyST+oU7QTpK7J9zFEFSA0eOmtUNMU3fczlTTTlnCxHmq/jYNFEmkkSG3DDBtW3Y4Q=="
|
||||
},
|
||||
"babel-plugin-minify-simplify": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.5.1.tgz",
|
||||
"integrity": "sha512-OSYDSnoCxP2cYDMk9gxNAed6uJDiDz65zgL6h8d3tm8qXIagWGMLWhqysT6DY3Vs7Fgq7YUDcjOomhVUb+xX6A==",
|
||||
"requires": {
|
||||
"babel-helper-evaluate-path": "^0.5.0",
|
||||
"babel-helper-flip-expressions": "^0.4.3",
|
||||
"babel-helper-is-nodes-equiv": "^0.0.1",
|
||||
"babel-helper-to-multiple-sequence-expressions": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-minify-type-constructors": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.4.3.tgz",
|
||||
"integrity": "sha1-G8bxW4f3qxCF1CszC3F2V6IVZQA=",
|
||||
"requires": {
|
||||
"babel-helper-is-void-0": "^0.4.3"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-inline-consecutive-adds": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz",
|
||||
"integrity": "sha1-Mj1Ho+pjqDp6w8gRro5pQfrysNE="
|
||||
},
|
||||
"babel-plugin-transform-member-expression-literals": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz",
|
||||
"integrity": "sha1-NwOcmgwzE6OUlfqsL/OmtbnQOL8="
|
||||
},
|
||||
"babel-plugin-transform-merge-sibling-variables": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz",
|
||||
"integrity": "sha1-hbQi/DN3tEnJ0c3kQIcgNTJAHa4="
|
||||
},
|
||||
"babel-plugin-transform-minify-booleans": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.4.tgz",
|
||||
"integrity": "sha1-rLs+VqNVXdI5KOS1gtKFFi3SsZg="
|
||||
},
|
||||
"babel-plugin-transform-property-literals": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.4.tgz",
|
||||
"integrity": "sha1-mMHSHiVXNlc/k+zlRFn2ziSYXTk=",
|
||||
"requires": {
|
||||
"esutils": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-regexp-constructors": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz",
|
||||
"integrity": "sha1-WLd3W2OvzzMyj66aX4j71PsLSWU="
|
||||
},
|
||||
"babel-plugin-transform-remove-console": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz",
|
||||
"integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A="
|
||||
},
|
||||
"babel-plugin-transform-remove-debugger": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.4.tgz",
|
||||
"integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI="
|
||||
},
|
||||
"babel-plugin-transform-remove-undefined": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.5.0.tgz",
|
||||
"integrity": "sha512-+M7fJYFaEE/M9CXa0/IRkDbiV3wRELzA1kKQFCJ4ifhrzLKn/9VCCgj9OFmYWwBd8IB48YdgPkHYtbYq+4vtHQ==",
|
||||
"requires": {
|
||||
"babel-helper-evaluate-path": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-simplify-comparison-operators": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz",
|
||||
"integrity": "sha1-9ir+CWyrDh9ootdT/fKDiIRxzrk="
|
||||
},
|
||||
"babel-plugin-transform-undefined-to-void": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz",
|
||||
"integrity": "sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA="
|
||||
},
|
||||
"babel-preset-minify": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.5.1.tgz",
|
||||
"integrity": "sha512-1IajDumYOAPYImkHbrKeiN5AKKP9iOmRoO2IPbIuVp0j2iuCcj0n7P260z38siKMZZ+85d3mJZdtW8IgOv+Tzg==",
|
||||
"requires": {
|
||||
"babel-plugin-minify-builtins": "^0.5.0",
|
||||
"babel-plugin-minify-constant-folding": "^0.5.0",
|
||||
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
|
||||
"babel-plugin-minify-flip-comparisons": "^0.4.3",
|
||||
"babel-plugin-minify-guarded-expressions": "^0.4.4",
|
||||
"babel-plugin-minify-infinity": "^0.4.3",
|
||||
"babel-plugin-minify-mangle-names": "^0.5.0",
|
||||
"babel-plugin-minify-numeric-literals": "^0.4.3",
|
||||
"babel-plugin-minify-replace": "^0.5.0",
|
||||
"babel-plugin-minify-simplify": "^0.5.1",
|
||||
"babel-plugin-minify-type-constructors": "^0.4.3",
|
||||
"babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
|
||||
"babel-plugin-transform-member-expression-literals": "^6.9.4",
|
||||
"babel-plugin-transform-merge-sibling-variables": "^6.9.4",
|
||||
"babel-plugin-transform-minify-booleans": "^6.9.4",
|
||||
"babel-plugin-transform-property-literals": "^6.9.4",
|
||||
"babel-plugin-transform-regexp-constructors": "^0.4.3",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"babel-plugin-transform-remove-debugger": "^6.9.4",
|
||||
"babel-plugin-transform-remove-undefined": "^0.5.0",
|
||||
"babel-plugin-transform-simplify-comparison-operators": "^6.9.4",
|
||||
"babel-plugin-transform-undefined-to-void": "^6.9.4",
|
||||
"lodash": "^4.17.11"
|
||||
}
|
||||
},
|
||||
"bach": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz",
|
||||
|
@ -1866,7 +2052,6 @@
|
|||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
|
@ -2054,7 +2239,6 @@
|
|||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
|
@ -2062,8 +2246,7 @@
|
|||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
},
|
||||
"color-support": {
|
||||
"version": "1.1.3",
|
||||
|
@ -2179,8 +2362,7 @@
|
|||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"create-ecdh": {
|
||||
"version": "4.0.3",
|
||||
|
@ -2575,8 +2757,7 @@
|
|||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "4.0.3",
|
||||
|
@ -2606,8 +2787,7 @@
|
|||
"esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"dev": true
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
||||
},
|
||||
"events": {
|
||||
"version": "3.1.0",
|
||||
|
@ -2694,7 +2874,6 @@
|
|||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
|
||||
"integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"assign-symbols": "^1.0.0",
|
||||
"is-extendable": "^1.0.1"
|
||||
|
@ -2704,7 +2883,6 @@
|
|||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
|
||||
"integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-plain-object": "^2.0.4"
|
||||
}
|
||||
|
@ -3519,8 +3697,7 @@
|
|||
"gensync": {
|
||||
"version": "1.0.0-beta.1",
|
||||
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz",
|
||||
"integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg=="
|
||||
},
|
||||
"get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
|
@ -3637,8 +3814,7 @@
|
|||
"globals": {
|
||||
"version": "11.12.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
|
||||
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
|
||||
},
|
||||
"glogg": {
|
||||
"version": "1.0.2",
|
||||
|
@ -3810,6 +3986,18 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"gulp-babel-minify": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-babel-minify/-/gulp-babel-minify-0.5.1.tgz",
|
||||
"integrity": "sha512-qrwtUEbB64nADUUyEciNHGPQ4jYQyDEgorV2NrY3wItISjAhvQ3L2DH/twGNh8rGsEXpCsqItry5RmdVrfCoMg==",
|
||||
"requires": {
|
||||
"@babel/core": "^7.1.0",
|
||||
"babel-preset-minify": "^0.5.1",
|
||||
"plugin-error": "^1.0.1",
|
||||
"through2": "^2.0.3",
|
||||
"vinyl-sourcemaps-apply": "^0.2.1"
|
||||
}
|
||||
},
|
||||
"gulp-csso": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-csso/-/gulp-csso-3.0.1.tgz",
|
||||
|
@ -3891,8 +4079,7 @@
|
|||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.0",
|
||||
|
@ -4031,8 +4218,7 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -4208,7 +4394,6 @@
|
|||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isobject": "^3.0.1"
|
||||
}
|
||||
|
@ -4276,20 +4461,17 @@
|
|||
"isobject": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
||||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
|
||||
},
|
||||
"jsesc": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
|
||||
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
|
||||
},
|
||||
"json-parse-better-errors": {
|
||||
"version": "1.0.2",
|
||||
|
@ -4313,7 +4495,6 @@
|
|||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz",
|
||||
"integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.0"
|
||||
}
|
||||
|
@ -4460,8 +4641,7 @@
|
|||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
||||
"dev": true
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
||||
},
|
||||
"loose-envify": {
|
||||
"version": "1.4.0",
|
||||
|
@ -4664,8 +4844,7 @@
|
|||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"mississippi": {
|
||||
"version": "3.0.0",
|
||||
|
@ -5187,8 +5366,7 @@
|
|||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
|
||||
},
|
||||
"path-root": {
|
||||
"version": "0.1.1",
|
||||
|
@ -5276,6 +5454,17 @@
|
|||
"find-up": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"plugin-error": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz",
|
||||
"integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==",
|
||||
"requires": {
|
||||
"ansi-colors": "^1.0.1",
|
||||
"arr-diff": "^4.0.0",
|
||||
"arr-union": "^3.1.0",
|
||||
"extend-shallow": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"posix-character-classes": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
||||
|
@ -5303,8 +5492,7 @@
|
|||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
|
||||
},
|
||||
"promise-inflight": {
|
||||
"version": "1.0.1",
|
||||
|
@ -5622,7 +5810,6 @@
|
|||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz",
|
||||
"integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.5"
|
||||
}
|
||||
|
@ -5704,8 +5891,7 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safe-regex": {
|
||||
"version": "1.1.0",
|
||||
|
@ -5730,8 +5916,7 @@
|
|||
"semver": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA=="
|
||||
},
|
||||
"semver-greatest-satisfied-range": {
|
||||
"version": "1.1.0",
|
||||
|
@ -5930,8 +6115,7 @@
|
|||
"source-map": {
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
|
||||
"dev": true
|
||||
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
|
||||
},
|
||||
"source-map-resolve": {
|
||||
"version": "0.5.2",
|
||||
|
@ -6163,7 +6347,6 @@
|
|||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
|
@ -6232,7 +6415,6 @@
|
|||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz",
|
||||
"integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "^2.1.5",
|
||||
"xtend": "~4.0.1"
|
||||
|
@ -6241,14 +6423,12 @@
|
|||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||
"dev": true
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
|
@ -6263,7 +6443,6 @@
|
|||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
|
@ -6314,8 +6493,7 @@
|
|||
"to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
|
||||
"dev": true
|
||||
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4="
|
||||
},
|
||||
"to-object-path": {
|
||||
"version": "0.3.0",
|
||||
|
@ -6580,8 +6758,7 @@
|
|||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.0.3",
|
||||
|
@ -6672,7 +6849,6 @@
|
|||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz",
|
||||
"integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"source-map": "^0.5.1"
|
||||
}
|
||||
|
@ -6895,8 +7071,7 @@
|
|||
"xtend": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
||||
"dev": true
|
||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
|
||||
},
|
||||
"y18n": {
|
||||
"version": "4.0.0",
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
"gulp": "^4.0.0",
|
||||
"gulp-csso": "^3.0.1",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-babel-minify": "^0.5.1",
|
||||
"webpack": "^4.29.6",
|
||||
"webpack-cli": "^3.2.3"
|
||||
}
|
||||
|
|
|
@ -126,8 +126,12 @@ export default new class ContentManager {
|
|||
let content = fs.readFileSync(filename, "utf8");
|
||||
content = Utils.stripBOM(content);
|
||||
|
||||
const stats = fs.statSync(filename);
|
||||
const meta = self.extractMeta(content);
|
||||
meta.filename = path.basename(filename);
|
||||
meta.added = stats.atimeMs;
|
||||
meta.modified = stats.mtimeMs;
|
||||
meta.size = stats.size;
|
||||
if (!isPlugin) {
|
||||
meta.css = content;
|
||||
if (meta.format == "json") meta.css = meta.css.split("\n").slice(1).join("\n");
|
||||
|
|
|
@ -98,6 +98,10 @@ PluginModule.prototype.togglePlugin = function (plugin) {
|
|||
else this.enablePlugin(plugin);
|
||||
};
|
||||
|
||||
PluginModule.prototype.toggle = function (plugin, reload = false) {
|
||||
return this.togglePlugin(plugin, reload);
|
||||
};
|
||||
|
||||
PluginModule.prototype.loadPlugin = function(filename) {
|
||||
const error = ContentManager.loadContent(filename, "plugin");
|
||||
if (error) {
|
||||
|
@ -130,6 +134,14 @@ PluginModule.prototype.unloadPlugin = function(filenameOrName) {
|
|||
BDEvents.dispatch("plugin-unloaded", plugin);
|
||||
};
|
||||
|
||||
PluginModule.prototype.delete = function(filenameOrName) {
|
||||
const bdplugin = Object.values(bdplugins).find(p => p.filename == filenameOrName) || bdplugins[filenameOrName];
|
||||
if (!bdplugin) return;
|
||||
this.unloadPlugin(bdplugin.filename);
|
||||
const fullPath = require("path").resolve(ContentManager.pluginsFolder, bdplugin.filename);
|
||||
require("fs").unlinkSync(fullPath);
|
||||
};
|
||||
|
||||
PluginModule.prototype.reloadPlugin = function(filenameOrName) {
|
||||
const bdplugin = Object.values(bdplugins).find(p => p.filename == filenameOrName) || bdplugins[filenameOrName];
|
||||
if (!bdplugin) return this.loadPlugin(filenameOrName);
|
||||
|
@ -153,6 +165,15 @@ PluginModule.prototype.reload = function(name) {
|
|||
return this.reloadPlugin(name);
|
||||
};
|
||||
|
||||
PluginModule.prototype.edit = function(filenameOrName) {
|
||||
console.log("Edit " + filenameOrName);
|
||||
const bdplugin = Object.values(bdplugins).find(p => p.filename == filenameOrName) || bdplugins[filenameOrName];
|
||||
if (!bdplugin) return;
|
||||
const fullPath = require("path").resolve(ContentManager.pluginsFolder, bdplugin.filename);
|
||||
console.log("Edit " + fullPath);
|
||||
require("electron").shell.openItem(`${fullPath}`);
|
||||
};
|
||||
|
||||
PluginModule.prototype.updatePluginList = function() {
|
||||
const results = ContentManager.loadNewContent("plugin");
|
||||
for (const filename of results.added) this.loadPlugin(filename);
|
||||
|
|
|
@ -30,6 +30,8 @@ import CssEditor from "../ui/cssEditor";
|
|||
import ContentColumn from "../ui/contentColumn";
|
||||
import ErrorBoundary from "../ui/errorBoundary";
|
||||
|
||||
import CardList from "../ui/addonlist";
|
||||
|
||||
export default new class V2_SettingsPanel {
|
||||
|
||||
constructor() {
|
||||
|
@ -38,6 +40,7 @@ export default new class V2_SettingsPanel {
|
|||
self.onChange = self.onChange.bind(self);
|
||||
self.updateSettings = this.updateSettings.bind(self);
|
||||
self.sidebar = new V2_SettingsPanel_Sidebar(self.sideBarOnClick);
|
||||
this.buildPluginProps = this.buildPluginProps.bind(this);
|
||||
}
|
||||
|
||||
get root() {
|
||||
|
@ -261,7 +264,7 @@ export default new class V2_SettingsPanel {
|
|||
}
|
||||
|
||||
contentComponent(type) {
|
||||
const componentElement = type == "plugins" ? this.pluginsComponent : this.themesComponent;
|
||||
const componentElement = this.getAddonList(type);
|
||||
const prefix = type.replace("s", "");
|
||||
const settingsList = this;
|
||||
class ContentList extends BDV2.react.Component {
|
||||
|
@ -291,6 +294,28 @@ export default new class V2_SettingsPanel {
|
|||
return BDV2.react.createElement(ContentList);
|
||||
}
|
||||
|
||||
getString(value) {
|
||||
if (!value) return "???";
|
||||
return typeof value == "string" ? value : value.toString();
|
||||
}
|
||||
|
||||
buildPluginProps(key) {
|
||||
const plugin = bdplugins[key].plugin;
|
||||
return Object.assign({}, {
|
||||
name: this.getString(plugin.getName()),
|
||||
author: this.getString(plugin.getAuthor()),
|
||||
description: this.getString(plugin.getDescription()),
|
||||
version: this.getString(plugin.getVersion()),
|
||||
getSettingsPanel: plugin.getSettingsPanel && plugin.getSettingsPanel.bind(plugin)
|
||||
}, bdplugins[key]);
|
||||
}
|
||||
|
||||
getAddonList(type) {
|
||||
const isPlugins = type === "plugins";
|
||||
const list = isPlugins ? Object.keys(bdplugins).map(this.buildPluginProps) : Object.values(bdthemes);
|
||||
return BDV2.react.createElement(CardList, {type, list});
|
||||
}
|
||||
|
||||
get pluginsComponent() {
|
||||
const plugins = Object.keys(bdplugins).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())).reduce((arr, key) => {
|
||||
arr.push(BDV2.react.createElement(ErrorBoundary, null, BDV2.react.createElement(PluginCard, {key: key, plugin: bdplugins[key].plugin})));return arr;
|
||||
|
@ -302,7 +327,8 @@ export default new class V2_SettingsPanel {
|
|||
}});
|
||||
const pfBtn = BDV2.react.createElement("button", {key: "folder-button", className: "bd-pfbtn", onClick: () => { require("electron").shell.openItem(ContentManager.pluginsFolder); }}, "Open Plugin Folder");
|
||||
const contentColumn = BDV2.react.createElement(ContentColumn, {key: "pcolumn", title: "Plugins", children: [refreshIcon, pfBtn, list]});
|
||||
return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, BDV2.react.createElement(Tools, {key: "tools"})]});
|
||||
// return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, BDV2.react.createElement(Tools, {key: "tools"})]});
|
||||
return BDV2.react.createElement(CardList, {type: "plugins"});
|
||||
}
|
||||
|
||||
get themesComponent() {
|
||||
|
@ -316,7 +342,8 @@ export default new class V2_SettingsPanel {
|
|||
}});
|
||||
const tfBtn = BDV2.react.createElement("button", {key: "folder-button", className: "bd-pfbtn", onClick: () => { require("electron").shell.openItem(ContentManager.themesFolder); }}, "Open Theme Folder");
|
||||
const contentColumn = BDV2.react.createElement(ContentColumn, {key: "tcolumn", title: "Themes", children: [refreshIcon, tfBtn, list]});
|
||||
return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, BDV2.react.createElement(Tools, {key: "tools"})]});
|
||||
// return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, BDV2.react.createElement(Tools, {key: "tools"})]});
|
||||
return BDV2.react.createElement(CardList, {type: "themes"});
|
||||
}
|
||||
|
||||
renderCoreSettings() {
|
||||
|
|
|
@ -54,6 +54,10 @@ ThemeModule.prototype.toggleTheme = function(theme) {
|
|||
else this.enableTheme(theme);
|
||||
};
|
||||
|
||||
ThemeModule.prototype.toggle = function (name, reload = false) {
|
||||
return this.toggleTheme(name, reload);
|
||||
};
|
||||
|
||||
ThemeModule.prototype.loadTheme = function(filename) {
|
||||
const error = ContentManager.loadContent(filename, "theme");
|
||||
if (error) {
|
||||
|
@ -84,6 +88,14 @@ ThemeModule.prototype.unloadTheme = function(filenameOrName) {
|
|||
BDEvents.dispatch("theme-unloaded", theme);
|
||||
};
|
||||
|
||||
ThemeModule.prototype.delete = function(filenameOrName) {
|
||||
const bdplugin = Object.values(bdthemes).find(p => p.filename == filenameOrName) || bdthemes[filenameOrName];
|
||||
if (!bdplugin) return;
|
||||
this.unloadTheme(bdplugin.filename);
|
||||
const fullPath = require("path").resolve(ContentManager.pluginsFolder, bdplugin.filename);
|
||||
require("fs").unlinkSync(fullPath);
|
||||
};
|
||||
|
||||
ThemeModule.prototype.reloadTheme = function(filenameOrName) {
|
||||
const bdtheme = Object.values(bdthemes).find(p => p.filename == filenameOrName) || bdthemes[filenameOrName];
|
||||
if (!bdtheme) return this.loadTheme(filenameOrName);
|
||||
|
@ -104,6 +116,13 @@ ThemeModule.prototype.reload = function(name) {
|
|||
return this.reloadTheme(name);
|
||||
};
|
||||
|
||||
ThemeModule.prototype.edit = function(filenameOrName) {
|
||||
const bdplugin = Object.values(bdthemes).find(p => p.filename == filenameOrName) || bdthemes[filenameOrName];
|
||||
if (!bdplugin) return;
|
||||
const fullPath = require("path").resolve(ContentManager.themesFolder, bdplugin.filename);
|
||||
require("electron").shell.openItem(`${fullPath}`);
|
||||
};
|
||||
|
||||
ThemeModule.prototype.updateThemeList = function() {
|
||||
const results = ContentManager.loadNewContent("theme");
|
||||
for (const filename of results.added) this.loadTheme(filename);
|
||||
|
|
|
@ -0,0 +1,229 @@
|
|||
import {settingsCookie} from "../0globals";
|
||||
import BDV2 from "../modules/v2";
|
||||
import Utils from "../modules/utils";
|
||||
|
||||
import XSvg from "./xSvg";
|
||||
import ReloadIcon from "./reloadIcon";
|
||||
import EditIcon from "./icons/edit";
|
||||
import DeleteIcon from "./icons/delete";
|
||||
import Switch from "./components/switch";
|
||||
import TooltipWrap from "./tooltipWrap";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
export default class V2C_PluginCard extends BDV2.reactComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onChange = this.onChange.bind(this);
|
||||
this.showSettings = this.showSettings.bind(this);
|
||||
this.setInitialState();
|
||||
this.hasSettings = typeof this.props.addon.getSettingsPanel === "function";
|
||||
this.settingsPanel = "";
|
||||
|
||||
this.edit = this.edit.bind(this);
|
||||
this.delete = this.delete.bind(this);
|
||||
this.reload = this.reload.bind(this);
|
||||
}
|
||||
|
||||
setInitialState() {
|
||||
this.state = {
|
||||
checked: this.props.enabled,
|
||||
settings: false,
|
||||
reloads: 0
|
||||
};
|
||||
}
|
||||
|
||||
showSettings() {
|
||||
if (!this.hasSettings) return;
|
||||
this.setState({settings: true});
|
||||
}
|
||||
|
||||
closeSettings() {
|
||||
this.panelRef.current.innerHTML = "";
|
||||
this.setState({settingsOpen: false});
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
if (!this.state.settings) return;
|
||||
if (typeof this.settingsPanel === "object") {
|
||||
this.refs.settingspanel.appendChild(this.settingsPanel);
|
||||
}
|
||||
|
||||
if (!settingsCookie["fork-ps-3"]) return;
|
||||
const isHidden = (container, element) => {
|
||||
const cTop = container.scrollTop;
|
||||
const cBottom = cTop + container.clientHeight;
|
||||
const eTop = element.offsetTop;
|
||||
const eBottom = eTop + element.clientHeight;
|
||||
return (eTop < cTop || eBottom > cBottom);
|
||||
};
|
||||
|
||||
const thisNode = $(BDV2.reactDom.findDOMNode(this));
|
||||
const container = thisNode.parents(".scroller");
|
||||
if (!isHidden(container[0], thisNode[0])) return;
|
||||
container.animate({
|
||||
scrollTop: thisNode.offset().top - container.offset().top + container.scrollTop() - 30
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
||||
getString(value) {
|
||||
if (!value) return "???";
|
||||
return typeof value == "string" ? value : value.toString();
|
||||
}
|
||||
|
||||
get settingsComponent() {
|
||||
const name = this.getString(this.props.addon.name);
|
||||
|
||||
try { this.settingsPanel = this.props.addon.getSettingsPanel(); }
|
||||
catch (err) { Utils.err("Plugins", "Unable to get settings panel for " + this.props.addon.name + ".", err); }
|
||||
|
||||
return BDV2.react.createElement("div", {className: "bd-card bd-addon-card settings-open ui-switch-item"},
|
||||
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
||||
this.refs.settingspanel.innerHTML = "";
|
||||
this.setState({settings: false});
|
||||
}},
|
||||
BDV2.react.createElement(XSvg, null)
|
||||
),
|
||||
typeof this.settingsPanel === "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel"}),
|
||||
typeof this.settingsPanel !== "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: this.settingsPanel}})
|
||||
);
|
||||
}
|
||||
|
||||
buildTitle(name, version, author) {
|
||||
const title = "{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/);
|
||||
const nameIndex = title.findIndex(s => s == "{{name}}");
|
||||
if (nameIndex) title[nameIndex] = React.createElement("span", {className: "name bda-name"}, name);
|
||||
const versionIndex = title.findIndex(s => s == "{{version}}");
|
||||
if (nameIndex) title[versionIndex] = React.createElement("span", {className: "version bda-version"}, version);
|
||||
const authorIndex = title.findIndex(s => s == "{{author}}");
|
||||
if (nameIndex) {
|
||||
const props = {className: "author bda-author"};
|
||||
if (author.link || author.id) {
|
||||
props.className += ` ${BDV2.anchorClasses.anchor} ${BDV2.anchorClasses.anchorUnderlineOnHover}`;
|
||||
props.target = "_blank";
|
||||
|
||||
if (author.link) props.href = author.link;
|
||||
if (author.id) props.onClick = () => {BDV2.LayerStack.popLayer(); BDV2.openDM(author.id);};
|
||||
}
|
||||
title[authorIndex] = React.createElement(author.link || author.id ? "a" : "span", props, author.name);
|
||||
}
|
||||
return title.flat();
|
||||
}
|
||||
|
||||
makeLink(title, url) {
|
||||
const props = {className: "bda-link bda-link-website", target: "_blank"};
|
||||
if (typeof(url) == "string") props.href = url;
|
||||
if (typeof(url) == "function") props.onClick = (event) => {event.preventDefault(); event.stopPropagation(); url();};
|
||||
return BDV2.react.createElement("a", props, title);
|
||||
}
|
||||
|
||||
makeButton(title, children, action) {
|
||||
return <TooltipWrap color="black" side="top" text={title}>
|
||||
<div className="bd-addon-button" onClick={action}>{children}</div>
|
||||
</TooltipWrap>;
|
||||
// return <Tooltip color="black" position="top" text={title}>
|
||||
// {(props) => {
|
||||
// return <div {...props} className="bd-icon" onClick={action}>{children}</div>;
|
||||
// }}
|
||||
// </Tooltip>;
|
||||
}
|
||||
|
||||
get links() {
|
||||
const links = [];
|
||||
const addon = this.props.addon;
|
||||
if (addon.website) links.push(this.makeLink("Website", addon.website));
|
||||
if (addon.source) links.push(this.makeLink("Source", addon.source));
|
||||
if (addon.invite) {
|
||||
links.push(this.makeLink("Support Server", () => {
|
||||
const tester = /\.gg\/(.*)$/;
|
||||
let code = addon.invite;
|
||||
if (tester.test(code)) code = code.match(tester)[1];
|
||||
BDV2.LayerStack.popLayer();
|
||||
BDV2.InviteActions.acceptInviteAndTransitionToInviteChannel(code);
|
||||
}));
|
||||
}
|
||||
if (addon.donate) links.push(this.makeLink("Donate", addon.donate));
|
||||
if (addon.patreon) links.push(this.makeLink("Patreon", addon.patreon));
|
||||
return links;
|
||||
}
|
||||
|
||||
get footer() {
|
||||
const links = this.links;
|
||||
return (links.length || this.hasSettings) && BDV2.react.createElement("div", {className: "bd-card-footer bda-footer"},
|
||||
BDV2.react.createElement("span", {className: "bd-addon-links bda-links"},
|
||||
...(links.map((element, index) => index < links.length - 1 ? [element, " | "] : element).flat())
|
||||
),
|
||||
this.hasSettings && BDV2.react.createElement("button", {onClick: this.showSettings, className: "bd-button bda-settings-button", disabled: !this.state.checked}, "Settings")
|
||||
);
|
||||
}
|
||||
|
||||
onChange() {
|
||||
this.props.toggle && this.props.toggle(this.props.addon.name);
|
||||
this.props.enabled = !this.props.enabled;
|
||||
}
|
||||
|
||||
edit() {this.props.edit(this.props.addon.name);}
|
||||
delete() {this.props.remove(this.props.addon.name);}
|
||||
reload() {this.props.reload(this.props.addon.name);}
|
||||
|
||||
render() {
|
||||
if (this.state.settings) return this.settingsComponent;
|
||||
|
||||
const {name, author, description, version, authorId, authorLink} = this.props.addon;
|
||||
|
||||
return BDV2.react.createElement("div", {className: "bd-card bd-addon-card settings-closed ui-switch-item"},
|
||||
BDV2.react.createElement("div", {className: "bd-addon-header bda-header"},
|
||||
BDV2.react.createElement("div", {className: "bd-card-title bda-header-title"}, this.buildTitle(name, version, {name: author, id: authorId, link: authorLink})),
|
||||
BDV2.react.createElement("div", {className: "bd-addon-controls bda-controls"},
|
||||
this.props.edit && this.makeButton("Edit", <EditIcon className="bd-icon" />, this.edit),
|
||||
this.props.remove && this.makeButton("Delete", <DeleteIcon className="bd-icon" />, this.delete),
|
||||
this.props.reload && this.makeButton("Reload", <ReloadIcon className="bd-icon" />, this.reload),
|
||||
React.createElement(Switch, {onChange: this.onChange, checked: this.props.enabled})
|
||||
)
|
||||
),
|
||||
BDV2.react.createElement("div", {className: "bd-scroller-wrap bda-description-wrap scroller-wrap fade"},
|
||||
BDV2.react.createElement("div", {className: "bd-scroller bd-addon-description bda-description scroller"}, description)
|
||||
),
|
||||
this.footer
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get settingsComponent() {
|
||||
// const addon = this.props.addon;
|
||||
// const name = this.getString(addon.name);
|
||||
// try { this.settingsPanel = this.props.getSettingsPanel(); }
|
||||
// catch (err) { Logger.stacktrace("Addon Settings", "Unable to get settings panel for " + name + ".", err); }
|
||||
|
||||
// const props = {id: `${name}-settings`, className: "addon-settings", ref: this.panelRef};
|
||||
// if (typeof(settingsPanel) == "string") props.dangerouslySetInnerHTML = this.settingsPanel;
|
||||
|
||||
// return <div className="bd-addon-card settings-open bd-switch-item">
|
||||
// <div className="bd-close" onClick={this.closeSettings}><CloseButton /></div>
|
||||
// <div {...props}>{this.settingsPanel instanceof React.Component ? this.settingsPanel : null}</div>
|
||||
// </div>;
|
||||
// }
|
||||
|
||||
// componentDidUpdate() {
|
||||
// if (!this.state.settingsOpen) return;
|
||||
// if (this.settingsPanel instanceof Node) this.panelRef.current.appendChild(this.settingsPanel);
|
||||
|
||||
// // if (!SettingsCookie["fork-ps-3"]) return;
|
||||
// const isHidden = (container, element) => {
|
||||
// const cTop = container.scrollTop;
|
||||
// const cBottom = cTop + container.clientHeight;
|
||||
// const eTop = element.offsetTop;
|
||||
// const eBottom = eTop + element.clientHeight;
|
||||
// return (eTop < cTop || eBottom > cBottom);
|
||||
// };
|
||||
|
||||
// const panel = $(this.panelRef.current);
|
||||
// const container = panel.parents(".scroller-2FKFPG");
|
||||
// if (!isHidden(container[0], panel[0])) return;
|
||||
// container.animate({
|
||||
// scrollTop: panel.offset().top - container.offset().top + container.scrollTop() - 30
|
||||
// }, 300);
|
||||
// }
|
|
@ -0,0 +1,160 @@
|
|||
import ErrorBoundary from "./errorBoundary";
|
||||
import ContentColumn from "./contentColumn";
|
||||
import Tools from "./tools";
|
||||
import ReloadIcon from "./reloadIcon";
|
||||
import AddonCard from "./addoncard";
|
||||
import Scroller from "./scroller";
|
||||
import Dropdown from "./components/dropdown";
|
||||
import Search from "./components/search";
|
||||
|
||||
import {settingsCookie, pluginCookie, themeCookie} from "../0globals";
|
||||
import ContentManager from "../modules/contentManager";
|
||||
import BDV2 from "../modules/v2";
|
||||
import pluginModule from "../modules/pluginModule";
|
||||
import themeModule from "../modules/themeModule";
|
||||
import WebpackModules from "../modules/webpackModules";
|
||||
import BdApi from "../modules/bdApi";
|
||||
|
||||
const Tooltip = WebpackModules.findByDisplayName("Tooltip");
|
||||
|
||||
const React = BDV2.react;
|
||||
|
||||
export default class CardList extends BDV2.reactComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {sort: "name", ascending: true, query: ""};
|
||||
this.isPlugins = this.props.type == "plugins";
|
||||
this.cookie = this.isPlugins ? pluginCookie : themeCookie;
|
||||
this.manager = this.isPlugins ? pluginModule : themeModule;
|
||||
|
||||
this.sort = this.sort.bind(this);
|
||||
this.reverse = this.reverse.bind(this);
|
||||
this.search = this.search.bind(this);
|
||||
}
|
||||
|
||||
openFolder() {
|
||||
require("electron").shell.openItem(this.isPlugins ? ContentManager.pluginsFolder : ContentManager.themesFolder);
|
||||
}
|
||||
|
||||
edit(name) {
|
||||
console.log(name);
|
||||
this.manager.edit(name);
|
||||
}
|
||||
|
||||
async delete(name) {
|
||||
const shouldDelete = await this.confirmDelete(name);
|
||||
if (!shouldDelete) return;
|
||||
this.manager.delete(name);
|
||||
}
|
||||
|
||||
confirmDelete(name) {
|
||||
return new Promise(resolve => {
|
||||
BdApi.showConfirmationModal("Are You Sure?", `Are you sure you want to delete ${name}?`, {
|
||||
danger: true,
|
||||
confirmText: "Delete",
|
||||
onConfirm: () => {resolve(true);},
|
||||
onCancel: () => {resolve(false);}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
get sortOptions() {
|
||||
return [
|
||||
{label: "Name", value: "name"},
|
||||
{label: "Author", value: "author"},
|
||||
{label: "Version", value: "version"},
|
||||
{label: "Recently Added", value: "added"},
|
||||
{label: "Last Modified", value: "modified"},
|
||||
{label: "File Size", value: "size"},
|
||||
];
|
||||
}
|
||||
|
||||
get directions() {
|
||||
return [
|
||||
{label: "Ascending", value: true},
|
||||
{label: "Descending", value: false}
|
||||
];
|
||||
}
|
||||
|
||||
reverse(value) {
|
||||
this.setState({ascending: value});
|
||||
}
|
||||
|
||||
sort(value) {
|
||||
this.setState({sort: value});
|
||||
}
|
||||
|
||||
search(event) {
|
||||
this.setState({query: event.target.value.toLocaleLowerCase()});
|
||||
}
|
||||
|
||||
getProps(addon) {
|
||||
return {
|
||||
key: addon.name,
|
||||
enabled: this.cookie[addon.name],
|
||||
toggle: this.manager.toggle.bind(this.manager),
|
||||
edit: this.edit.bind(this),
|
||||
remove: this.delete.bind(this),
|
||||
addon: addon
|
||||
};
|
||||
}
|
||||
|
||||
getAddons() {
|
||||
const sortedAddons = this.props.list.sort((a, b) => {
|
||||
const first = a[this.state.sort];
|
||||
const second = b[this.state.sort];
|
||||
if (typeof(first) == "string") return first.toLocaleLowerCase().localeCompare(second.toLocaleLowerCase());
|
||||
if (first > second) return 1;
|
||||
if (second > first) return -1;
|
||||
return 0;
|
||||
});
|
||||
if (!this.state.ascending) sortedAddons.reverse();
|
||||
const rendered = sortedAddons.map((addon) => {
|
||||
if (this.state.query) {
|
||||
let matches = addon.name.toLocaleLowerCase().includes(this.state.query);
|
||||
matches = matches || addon.author.toLocaleLowerCase().includes(this.state.query);
|
||||
matches = matches || addon.description.toLocaleLowerCase().includes(this.state.query);
|
||||
matches = matches || addon.version.toLocaleLowerCase().includes(this.state.query);
|
||||
if (!matches) return null;
|
||||
}
|
||||
const props = this.getProps(addon);
|
||||
return <ErrorBoundary><AddonCard {...props} reload={!settingsCookie["fork-ps-5"] && this.manager.reload.bind(this.manager)} /></ErrorBoundary>;
|
||||
});
|
||||
return rendered;
|
||||
}
|
||||
|
||||
render() {
|
||||
const refreshIcon = <Tooltip color="black" position="top" text="Reload List">
|
||||
{(props) =>
|
||||
<ReloadIcon {...props} className="bd-icon bd-reload bd-reload-header" size="18px" onClick={async () => {
|
||||
if (this.isPlugins) pluginModule.updatePluginList();
|
||||
else themeModule.updateThemeList();
|
||||
this.forceUpdate();
|
||||
}} />
|
||||
}</Tooltip>;
|
||||
const addonCards = this.getAddons().filter(c => c);
|
||||
|
||||
return <Scroller contentColumn={true} fade={true} dark={true}>
|
||||
<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>
|
||||
{!settingsCookie["fork-ps-5"] && refreshIcon}
|
||||
<div className="bd-controls bd-addon-controls">
|
||||
<Search onChange={this.search} placeholder={`Search ${this.props.type}...`} />
|
||||
<div className="bd-addon-dropdowns">
|
||||
<div className="bd-select-wrapper">
|
||||
<label className="bd-label">Sort by:</label>
|
||||
<Dropdown options={this.sortOptions} onChange={this.sort} style="transparent" />
|
||||
</div>
|
||||
<div className="bd-select-wrapper">
|
||||
<label className="bd-label">Order:</label>
|
||||
<Dropdown options={this.directions} onChange={this.reverse} style="transparent" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div className="bda-slist bd-addon-list">{addonCards}</div>
|
||||
</ContentColumn>
|
||||
<Tools key="tools" />
|
||||
</Scroller>;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
import BDV2 from "../../modules/v2";
|
||||
import Arrow from "../icons/downarrow";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
|
||||
export default class Select extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {open: false, value: this.props.value || this.props.options[0].value};
|
||||
this.dropdown = React.createRef();
|
||||
this.onChange = this.onChange.bind(this);
|
||||
this.showMenu = this.showMenu.bind(this);
|
||||
this.hideMenu = this.hideMenu.bind(this);
|
||||
}
|
||||
|
||||
showMenu(event) {
|
||||
event.preventDefault();
|
||||
this.setState({open: true}, () => {
|
||||
document.addEventListener("click", this.hideMenu);
|
||||
});
|
||||
}
|
||||
|
||||
hideMenu() {
|
||||
this.setState({open: false}, () => {
|
||||
document.removeEventListener("click", this.hideMenu);
|
||||
});
|
||||
}
|
||||
|
||||
onChange(value) {
|
||||
this.setState({value});
|
||||
if (this.props.onChange) this.props.onChange(value);
|
||||
}
|
||||
|
||||
get selected() {return this.props.options.find(o => o.value == this.state.value);}
|
||||
|
||||
get options() {
|
||||
const selected = this.selected;
|
||||
return <div className="bd-select-options">
|
||||
{this.props.options.map(opt =>
|
||||
<div className={`bd-select-option${selected.value == opt.value ? " selected" : ""}`} onClick={this.onChange.bind(this, opt.value)}>{opt.label}</div>
|
||||
)}
|
||||
</div>;
|
||||
}
|
||||
|
||||
render() {
|
||||
const style = this.props.style == "transparent" ? " bd-select-transparent" : "";
|
||||
const isOpen = this.state.open ? " menu-open" : "";
|
||||
return <div className={`bd-select${style}${isOpen}`} onClick={this.showMenu} ref={this.dropdown}>
|
||||
<div className="bd-select-value">{this.selected.label}</div>
|
||||
<Arrow className="bd-select-arrow" />
|
||||
{this.state.open && this.options}
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
||||
// return <div className="bd-select-wrap">
|
||||
// <label className="bd-label">{this.props.label}</label>
|
||||
// <div className={`bd-select${style}${isOpen}`} onClick={this.showMenu} ref={this.dropdown}>
|
||||
// <div className="bd-select-controls">
|
||||
// <div className="bd-select-value">{this.selected.label}</div>
|
||||
// <Arrow className="bd-select-arrow" />
|
||||
// </div>
|
||||
// </div>
|
||||
// {this.state.open && this.options}
|
||||
// </div>;
|
|
@ -0,0 +1,13 @@
|
|||
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>;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
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() {
|
||||
if (this.props.disabled) return;
|
||||
this.props.onChange(!this.state.checked);
|
||||
this.setState({checked: !this.state.checked});
|
||||
}
|
||||
|
||||
render() {
|
||||
const enabledClass = this.props.disabled ? " bd-switch-disabled" : "";
|
||||
const checkedClass = this.state.checked ? " bd-switch-checked" : "";
|
||||
return <div className={`bd-switch` + enabledClass + checkedClass}>
|
||||
<input type="checkbox" id={this.props.id} className={`bd-checkbox`} disabled={this.props.disabled} checked={this.state.checked} onChange={this.onChange} />
|
||||
</div>;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import BDV2 from "../../modules/v2";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
export default class Delete extends React.Component {
|
||||
render() {
|
||||
const size = this.props.size || "24px";
|
||||
return <svg className={this.props.className || ""} fill="#FFFFFF" viewBox="0 0 24 24" style={{width: size, height: size}} onClick={this.props.onClick}>
|
||||
<path fill="none" d="M0 0h24v24H0V0z"/><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"/>
|
||||
<path fill="none" d="M0 0h24v24H0z"/>
|
||||
</svg>;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
import BDV2 from "../../modules/v2";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
export default class DownArrow extends React.Component {
|
||||
render() {
|
||||
const size = this.props.size || "16px";
|
||||
return <svg className={this.props.className || ""} fill="#FFFFFF" viewBox="0 0 24 24" style={{width: size, height: size}}>
|
||||
<path d="M8.12 9.29L12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z"/>
|
||||
</svg>;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import BDV2 from "../../modules/v2";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
export default class Edit extends React.Component {
|
||||
render() {
|
||||
const size = this.props.size || "24px";
|
||||
return <svg viewBox="0 0 24 24" fill="#FFFFFF" style={{width: size, height: size}} onClick={this.props.onClick}>
|
||||
<path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" />
|
||||
<path d="M0 0h24v24H0z" fill="none" />
|
||||
</svg>;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import BDV2 from "../../modules/v2";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
export default class Search extends React.Component {
|
||||
render() {
|
||||
const size = this.props.size || "16px";
|
||||
return <svg className={this.props.className || ""} fill="#FFFFFF" viewBox="0 0 24 24" style={{width: size, height: size}}>
|
||||
<path fill="none" d="M0 0h24v24H0V0z"/>
|
||||
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
||||
</svg>;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,9 @@ import Utils from "../modules/utils";
|
|||
import XSvg from "./xSvg";
|
||||
import ReloadIcon from "./reloadIcon";
|
||||
import TooltipWrap from "./tooltipWrap";
|
||||
import Switch from "./components/switch";
|
||||
|
||||
const React = BDV2.React;
|
||||
|
||||
export default class V2C_PluginCard extends BDV2.reactComponent {
|
||||
|
||||
|
@ -82,6 +85,47 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
return typeof value == "string" ? value : value.toString();
|
||||
}
|
||||
|
||||
get settingsComponent() {
|
||||
const self = this;
|
||||
const {plugin} = this.props;
|
||||
const name = this.getString(plugin.getName());
|
||||
|
||||
try { self.settingsPanel = plugin.getSettingsPanel(); }
|
||||
catch (err) { Utils.err("Plugins", "Unable to get settings panel for " + plugin.getName() + ".", err); }
|
||||
|
||||
return BDV2.react.createElement("div", {className: "settings-open ui-switch-item bd-addon-card"},
|
||||
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
||||
this.refs.settingspanel.innerHTML = "";
|
||||
self.setState({settings: false});
|
||||
}},
|
||||
BDV2.react.createElement(XSvg, null)
|
||||
),
|
||||
typeof self.settingsPanel === "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel"}),
|
||||
typeof self.settingsPanel !== "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: self.settingsPanel}})
|
||||
);
|
||||
}
|
||||
|
||||
buildTitle(name, version, author) {
|
||||
const title = "{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/);
|
||||
const nameIndex = title.findIndex(s => s == "{{name}}");
|
||||
if (nameIndex) title[nameIndex] = React.createElement("span", {className: "bd-name bda-name"}, name);
|
||||
const versionIndex = title.findIndex(s => s == "{{version}}");
|
||||
if (nameIndex) title[versionIndex] = React.createElement("span", {className: "bd-version bda-version"}, version);
|
||||
const authorIndex = title.findIndex(s => s == "{{author}}");
|
||||
if (nameIndex) {
|
||||
const props = {className: "bd-author bda-author"};
|
||||
if (author.link || author.id) {
|
||||
props.className += ` ${BDV2.anchorClasses.anchor} ${BDV2.anchorClasses.anchorUnderlineOnHover}`;
|
||||
props.target = "_blank";
|
||||
|
||||
if (author.link) props.href = author.link;
|
||||
if (author.id) props.onClick = () => {BDV2.LayerStack.popLayer(); BDV2.openDM(author.id);};
|
||||
}
|
||||
title[authorIndex] = React.createElement(author.link || author.id ? "a" : "span", props, author.name);
|
||||
}
|
||||
return title.flat();
|
||||
}
|
||||
|
||||
makeLink(title, url) {
|
||||
const props = {className: "bda-link bda-link-website", target: "_blank"};
|
||||
if (typeof(url) == "string") props.href = url;
|
||||
|
@ -89,32 +133,15 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
return BDV2.react.createElement("a", props, title);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const self = this;
|
||||
const {plugin} = this.props;
|
||||
const name = this.getString(plugin.getName());
|
||||
const author = this.getString(plugin.getAuthor());
|
||||
const description = this.getString(plugin.getDescription());
|
||||
const version = this.getString(plugin.getVersion());
|
||||
const meta = bdplugins[name];
|
||||
|
||||
if (this.state.settings) {
|
||||
try { self.settingsPanel = plugin.getSettingsPanel(); }
|
||||
catch (err) { Utils.err("Plugins", "Unable to get settings panel for " + plugin.getName() + ".", err); }
|
||||
|
||||
return BDV2.react.createElement("li", {className: "settings-open ui-switch-item"},
|
||||
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
||||
this.refs.settingspanel.innerHTML = "";
|
||||
self.setState({settings: false});
|
||||
}},
|
||||
BDV2.react.createElement(XSvg, null)
|
||||
),
|
||||
typeof self.settingsPanel === "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel"}),
|
||||
typeof self.settingsPanel !== "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: self.settingsPanel}})
|
||||
);
|
||||
}
|
||||
makeButton(title, children, action) {
|
||||
return <TooltipWrap color="black" position="top" text={title}>
|
||||
{(props) => {
|
||||
return <div {...props} className="bd-addon-button" onClick={action}>{children}</div>;
|
||||
}}
|
||||
</TooltipWrap>;
|
||||
}
|
||||
|
||||
getLinks(meta) {
|
||||
const links = [];
|
||||
if (meta.website) links.push(this.makeLink("Website", meta.website));
|
||||
if (meta.source) links.push(this.makeLink("Source", meta.source));
|
||||
|
@ -129,43 +156,45 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
}
|
||||
if (meta.donate) links.push(this.makeLink("Donate", meta.donate));
|
||||
if (meta.patreon) links.push(this.makeLink("Patreon", meta.patreon));
|
||||
return links;
|
||||
}
|
||||
|
||||
const authorProps = {className: "bda-author"};
|
||||
if (meta.authorLink || meta.authorId) {
|
||||
authorProps.className += ` ${BDV2.anchorClasses.anchor} ${BDV2.anchorClasses.anchorUnderlineOnHover}`;
|
||||
authorProps.target = "_blank";
|
||||
getFooter(meta) {
|
||||
const links = this.getLinks(meta);
|
||||
return (links.length || this.hasSettings) && BDV2.react.createElement("div", {className: "bda-footer"},
|
||||
BDV2.react.createElement("span", {className: "bda-links"},
|
||||
...(links.map((element, index) => index < links.length - 1 ? [element, " | "] : element).flat())
|
||||
),
|
||||
this.hasSettings && BDV2.react.createElement("button", {onClick: this.showSettings, className: "bda-settings-button", disabled: !this.state.checked}, "Settings")
|
||||
);
|
||||
}
|
||||
|
||||
if (meta.authorLink) authorProps.href = meta.authorLink;
|
||||
if (meta.authorId) authorProps.onClick = () => {BDV2.LayerStack.popLayer(); BDV2.openDM(meta.authorId);};
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.settings) return this.settingsComponent;
|
||||
|
||||
return BDV2.react.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"},
|
||||
BDV2.react.createElement("div", {className: "bda-header"},
|
||||
BDV2.react.createElement("span", {className: "bda-header-title"},
|
||||
BDV2.react.createElement("span", {className: "bda-name"}, name),
|
||||
" v",
|
||||
BDV2.react.createElement("span", {className: "bda-version"}, version),
|
||||
" by ",
|
||||
BDV2.react.createElement(meta.authorLink || meta.authorId ? "a" : "span", authorProps, author)
|
||||
),
|
||||
BDV2.react.createElement("div", {className: "bda-controls"},
|
||||
const {plugin} = this.props;
|
||||
const name = this.getString(plugin.getName());
|
||||
const author = this.getString(plugin.getAuthor());
|
||||
const description = this.getString(plugin.getDescription());
|
||||
const version = this.getString(plugin.getVersion());
|
||||
const meta = bdplugins[name];
|
||||
|
||||
return BDV2.react.createElement("div", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item bd-addon-card"},
|
||||
BDV2.react.createElement("div", {className: "bd-addon-header bda-header"},
|
||||
BDV2.react.createElement("div", {className: "bd-title bda-header-title"}, this.buildTitle(name, version, {name: author, id: meta.authorId, link: meta.authorLink})),
|
||||
BDV2.react.createElement("div", {className: "bd-addon-controls bda-controls"},
|
||||
!settingsCookie["fork-ps-5"] && BDV2.react.createElement(TooltipWrap(ReloadIcon, {color: "black", side: "top", text: "Reload"}), {className: "bd-reload-card", onClick: this.reload}),
|
||||
BDV2.react.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}},
|
||||
BDV2.react.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}),
|
||||
BDV2.react.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"})
|
||||
)
|
||||
React.createElement(Switch, {onChange: this.onChange, checked: this.state.checked})
|
||||
// BDV2.react.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}},
|
||||
// BDV2.react.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}),
|
||||
// BDV2.react.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"})
|
||||
// )
|
||||
)
|
||||
),
|
||||
BDV2.react.createElement("div", {className: "bda-description-wrap scroller-wrap fade"},
|
||||
BDV2.react.createElement("div", {className: "bda-description scroller"}, description)
|
||||
BDV2.react.createElement("div", {className: "bd-scroller-wrap bda-description-wrap scroller-wrap fade"},
|
||||
BDV2.react.createElement("div", {className: "bd-addon-description bda-description scroller"}, description)
|
||||
),
|
||||
(links.length || this.hasSettings) && BDV2.react.createElement("div", {className: "bda-footer"},
|
||||
BDV2.react.createElement("span", {className: "bda-links"},
|
||||
...(links.map((element, index) => index < links.length - 1 ? [element, " | "] : element).flat())
|
||||
),
|
||||
this.hasSettings && BDV2.react.createElement("button", {onClick: this.showSettings, className: "bda-settings-button", disabled: !this.state.checked}, "Settings")
|
||||
)
|
||||
this.getFooter(meta)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -178,4 +207,51 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
if (!this.hasSettings) return;
|
||||
this.setState({settings: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// <div className="bd-controls">
|
||||
// {this.props.editAddon && this.makeButton(Strings.Addons.editAddon, <EditIcon />, this.props.editAddon)}
|
||||
// {this.props.deleteAddon && this.makeButton(Strings.Addons.deleteAddon, <DeleteIcon />, this.props.deleteAddon)}
|
||||
// {this.props.showReloadIcon && this.makeButton(Strings.Addons.reload, <ReloadIcon className="bd-reload bd-reload-card" />, this.reload)}
|
||||
// <Switch checked={this.props.enabled} onChange={this.onChange} />
|
||||
// </div>
|
||||
|
||||
|
||||
|
||||
// componentDidUpdate() {
|
||||
// if (!this.state.settingsOpen) return;
|
||||
// if (this.settingsPanel instanceof Node) this.panelRef.current.appendChild(this.settingsPanel);
|
||||
|
||||
// // if (!SettingsCookie["fork-ps-3"]) return;
|
||||
// const isHidden = (container, element) => {
|
||||
// const cTop = container.scrollTop;
|
||||
// const cBottom = cTop + container.clientHeight;
|
||||
// const eTop = element.offsetTop;
|
||||
// const eBottom = eTop + element.clientHeight;
|
||||
// return (eTop < cTop || eBottom > cBottom);
|
||||
// };
|
||||
|
||||
// const panel = $(this.panelRef.current);
|
||||
// const container = panel.parents(".scroller-2FKFPG");
|
||||
// if (!isHidden(container[0], panel[0])) return;
|
||||
// container.animate({
|
||||
// scrollTop: panel.offset().top - container.offset().top + container.scrollTop() - 30
|
||||
// }, 300);
|
||||
// }
|
||||
|
||||
|
||||
// get settingsComponent() {
|
||||
// const addon = this.props.addon;
|
||||
// const name = this.getString(addon.name);
|
||||
// try { this.settingsPanel = this.props.getSettingsPanel(); }
|
||||
// catch (err) { Logger.stacktrace("Addon Settings", "Unable to get settings panel for " + name + ".", err); }
|
||||
|
||||
// const props = {id: `${name}-settings`, className: "addon-settings", ref: this.panelRef};
|
||||
// if (typeof(settingsPanel) == "string") props.dangerouslySetInnerHTML = this.settingsPanel;
|
||||
|
||||
// return <div className="bd-addon-card settings-open bd-switch-item">
|
||||
// <div className="bd-close" onClick={this.closeSettings}><CloseButton /></div>
|
||||
// <div {...props}>{this.settingsPanel instanceof React.Component ? this.settingsPanel : null}</div>
|
||||
// </div>;
|
||||
// }
|
|
@ -1,7 +1,7 @@
|
|||
import {settingsCookie, themeCookie, bdthemes} from "../0globals";
|
||||
import Utils from "../modules/utils";
|
||||
import BDV2 from "../modules/v2";
|
||||
import themeModule from "../modules/pluginModule";
|
||||
import themeModule from "../modules/themeModule";
|
||||
|
||||
import ReloadIcon from "./reloadIcon";
|
||||
import TooltipWrap from "./tooltipWrap";
|
||||
|
@ -84,7 +84,7 @@ export default class V2C_ThemeCard extends BDV2.reactComponent {
|
|||
if (meta.authorId) authorProps.onClick = () => {BDV2.LayerStack.popLayer(); BDV2.openDM(meta.authorId);};
|
||||
}
|
||||
|
||||
return BDV2.react.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"},
|
||||
return BDV2.react.createElement("div", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item bd-addon-card"},
|
||||
BDV2.react.createElement("div", {className: "bda-header"},
|
||||
BDV2.react.createElement("span", {className: "bda-header-title"},
|
||||
BDV2.react.createElement("span", {className: "bda-name"}, name),
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
/**
|
||||
* Tooltip that automatically show and hide themselves on mouseenter and mouseleave events.
|
||||
* Will also remove themselves if the node to watch is removed from DOM through
|
||||
* a MutationObserver.
|
||||
*
|
||||
* Note this is not using Discord's internals but normal DOM manipulation and emulates
|
||||
* Discord's own tooltips as closely as possible.
|
||||
*
|
||||
* @module EmulatedTooltip
|
||||
* @version 0.0.1
|
||||
*/
|
||||
|
||||
import Utils from "../modules/utils";
|
||||
import WebpackModules from "../modules/webpackModules";
|
||||
|
||||
const TooltipClasses = WebpackModules.findByProps("tooltip", "tooltipBlack");
|
||||
const TooltipLayers = WebpackModules.findByProps("layer", "layerContainer");
|
||||
|
||||
const getClass = function(sideOrColor) {
|
||||
const upperCase = sideOrColor[0].toUpperCase() + sideOrColor.slice(1);
|
||||
const tooltipClass = TooltipClasses[`tooltip${upperCase}`];
|
||||
if (tooltipClass) return tooltipClass;
|
||||
return null;
|
||||
};
|
||||
|
||||
const classExists = function(sideOrColor) {
|
||||
return getClass(sideOrColor) ? true : false;
|
||||
};
|
||||
|
||||
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 {
|
||||
/**
|
||||
*
|
||||
* @constructor
|
||||
* @param {(HTMLElement|jQuery)} node - DOM node to monitor and show the tooltip on
|
||||
* @param {string} tip - string to show in the tooltip
|
||||
* @param {object} options - additional options for the tooltip
|
||||
* @param {string} [options.style=black] - correlates to the discord styling/colors (black, brand, green, grey, red, yellow)
|
||||
* @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
|
||||
*/
|
||||
constructor(node, text, options = {}) {
|
||||
const {style = "black", side = "top", preventFlip = false, disabled = false} = options;
|
||||
this.node = node instanceof jQuery ? node[0] : node;
|
||||
this.label = text;
|
||||
this.style = style.toLowerCase();
|
||||
this.side = side.toLowerCase();
|
||||
this.preventFlip = preventFlip;
|
||||
this.disabled = disabled;
|
||||
|
||||
if (!classExists(this.side)) return Utils.err("EmulatedTooltip", `Side ${this.side} does not exist.`);
|
||||
if (!classExists(this.style)) return Utils.err("EmulatedTooltip", `Style ${this.style} does not exist.`);
|
||||
|
||||
this.element = $(`<div class="${TooltipLayers.layer}">`)[0];
|
||||
this.tooltipElement = $(`<div class="${TooltipClasses.tooltip} ${getClass(this.style)}"><div class="${TooltipClasses.tooltipPointer}"></div>${this.label}</div>`)[0];
|
||||
this.labelElement = this.tooltipElement.childNodes[1];
|
||||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, {subtree: true, childList: true});
|
||||
});
|
||||
|
||||
this.node.addEventListener("mouseleave", () => {
|
||||
this.hide();
|
||||
});
|
||||
}
|
||||
|
||||
/** Container where the tooltip will be appended. */
|
||||
get container() { return document.querySelector(".popouts-2bnG9Z ~ .layerContainer-yqaFcK"); }
|
||||
/** Boolean representing if the tooltip will fit on screen above the element */
|
||||
get canShowAbove() { return this.node.getBoundingClientRect().top - this.element.offsetHeight >= 0; }
|
||||
/** Boolean representing if the tooltip will fit on screen below the element */
|
||||
get canShowBelow() { return this.node.getBoundingClientRect().top + this.node.offsetHeight + this.element.offsetHeight <= Utils.screenHeight; }
|
||||
/** Boolean representing if the tooltip will fit on screen to the left of the element */
|
||||
get canShowLeft() { return this.node.getBoundingClientRect().left - this.element.offsetWidth >= 0; }
|
||||
/** Boolean representing if the tooltip will fit on screen to the right of the element */
|
||||
get canShowRight() { return this.node.getBoundingClientRect().left + this.node.offsetWidth + this.element.offsetWidth <= Utils.screenWidth; }
|
||||
|
||||
/** Hides the tooltip. Automatically called on mouseleave. */
|
||||
hide() {
|
||||
this.element.remove();
|
||||
this.tooltipElement.className = this._className;
|
||||
}
|
||||
|
||||
/** Shows the tooltip. Automatically called on mouseenter. Will attempt to flip if position was wrong. */
|
||||
show() {
|
||||
this.tooltipElement.className = `${TooltipClasses.tooltip} ${getClass(this.style)}`;
|
||||
this.labelElement.textContent = this.label;
|
||||
this.element.appendTo(this.container);
|
||||
|
||||
if (this.side == "top") {
|
||||
if (this.canShowAbove || (!this.canShowAbove && this.preventFlip)) this.showAbove();
|
||||
else this.showBelow();
|
||||
}
|
||||
|
||||
if (this.side == "bottom") {
|
||||
if (this.canShowBelow || (!this.canShowBelow && this.preventFlip)) this.showBelow();
|
||||
else this.showAbove();
|
||||
}
|
||||
|
||||
if (this.side == "left") {
|
||||
if (this.canShowLeft || (!this.canShowLeft && this.preventFlip)) this.showLeft();
|
||||
else this.showRight();
|
||||
}
|
||||
|
||||
if (this.side == "right") {
|
||||
if (this.canShowRight || (!this.canShowRight && this.preventFlip)) this.showRight();
|
||||
else this.showLeft();
|
||||
}
|
||||
}
|
||||
|
||||
/** Force showing the tooltip above the node. */
|
||||
showAbove() {
|
||||
this.tooltipElement.addClass(getClass("top"));
|
||||
this.element.style.setProperty("top", toPx(this.node.getBoundingClientRect().top - this.element.offsetHeight - 10));
|
||||
this.centerHorizontally();
|
||||
}
|
||||
|
||||
/** Force showing the tooltip below the node. */
|
||||
showBelow() {
|
||||
this.tooltipElement.addClass(getClass("bottom"));
|
||||
this.element.style.setProperty("top", toPx(this.node.getBoundingClientRect().top + this.node.offsetHeight + 10));
|
||||
this.centerHorizontally();
|
||||
}
|
||||
|
||||
/** Force showing the tooltip to the left of the node. */
|
||||
showLeft() {
|
||||
this.tooltipElement.addClass(getClass("left"));
|
||||
this.element.style.setProperty("left", toPx(this.node.getBoundingClientRect().left - this.element.offsetWidth - 10));
|
||||
this.centerVertically();
|
||||
}
|
||||
|
||||
/** Force showing the tooltip to the right of the node. */
|
||||
showRight() {
|
||||
this.tooltipElement.addClass(getClass("right"));
|
||||
this.element.style.setProperty("left", toPx(this.node.getBoundingClientRect().left + this.node.offsetWidth + 10));
|
||||
this.centerVertically();
|
||||
}
|
||||
|
||||
centerHorizontally() {
|
||||
const nodecenter = this.node.getBoundingClientRect().left + (this.node.offsetWidth / 2);
|
||||
this.element.style.setProperty("left", toPx(nodecenter - (this.element.offsetWidth / 2)));
|
||||
}
|
||||
|
||||
centerVertically() {
|
||||
const nodecenter = this.node.getBoundingClientRect().top + (this.node.offsetHeight / 2);
|
||||
this.element.style.setProperty("top", toPx(nodecenter - (this.element.offsetHeight / 2)));
|
||||
}
|
||||
}
|
|
@ -1,65 +1,37 @@
|
|||
import BDV2 from "../modules/v2";
|
||||
import Utils from "../modules/utils";
|
||||
import Tooltip from "./tooltip";
|
||||
|
||||
export default function(Component, options) {
|
||||
const {style = "black", side = "top", text = ""} = options;
|
||||
const id = BDV2.KeyGenerator();
|
||||
export default class extends BDV2.reactComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onMouseEnter = this.onMouseEnter.bind(this);
|
||||
this.onMouseLeave = this.onMouseLeave.bind(this);
|
||||
}
|
||||
|
||||
return class extends BDV2.reactComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onMouseEnter = this.onMouseEnter.bind(this);
|
||||
this.onMouseLeave = this.onMouseLeave.bind(this);
|
||||
}
|
||||
componentDidMount() {
|
||||
const {style = "black", side = "top", text = ""} = this.props;
|
||||
this.node = BDV2.reactDom.findDOMNode(this);
|
||||
// this.node.addEventListener("mouseenter", this.onMouseEnter);
|
||||
// this.node.addEventListener("mouseleave", this.onMouseLeave);
|
||||
this.tooltip = new Tooltip(this.node, text, {style, side});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.node = BDV2.reactDom.findDOMNode(this);
|
||||
this.node.addEventListener("mouseenter", this.onMouseEnter);
|
||||
this.node.addEventListener("mouseleave", this.onMouseLeave);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
// this.node.removeEventListener("mouseenter", this.onMouseEnter);
|
||||
// this.node.removeEventListener("mouseleave", this.onMouseLeave);
|
||||
this.tooltip.hide();
|
||||
delete this.tooltip;
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.node.removeEventListener("mouseenter", this.onMouseEnter);
|
||||
this.node.removeEventListener("mouseleave", this.onMouseLeave);
|
||||
}
|
||||
onMouseEnter() {
|
||||
|
||||
onMouseEnter() {
|
||||
if (!BDV2.Tooltips) return;
|
||||
const {left, top, width, height} = this.node.getBoundingClientRect();
|
||||
BDV2.Tooltips.show(id, {
|
||||
position: side,
|
||||
text: text,
|
||||
color: style,
|
||||
targetWidth: width,
|
||||
targetHeight: height,
|
||||
windowWidth: Utils.screenWidth,
|
||||
windowHeight: Utils.screenHeight,
|
||||
x: left,
|
||||
y: top
|
||||
});
|
||||
}
|
||||
|
||||
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.onMouseLeave();
|
||||
observer.disconnect();
|
||||
}
|
||||
});
|
||||
});
|
||||
onMouseLeave() {
|
||||
|
||||
}
|
||||
|
||||
observer.observe(document.body, {subtree: true, childList: true});
|
||||
}
|
||||
|
||||
onMouseLeave() {
|
||||
if (!BDV2.Tooltips) return;
|
||||
BDV2.Tooltips.hide(id);
|
||||
}
|
||||
|
||||
render() {
|
||||
return BDV2.react.createElement(Component, this.props);
|
||||
}
|
||||
};
|
||||
render() {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue