0d36daacca
Almost to the root node!
246 lines
14 KiB
TypeScript
246 lines
14 KiB
TypeScript
import * as electronRemote from '@electron/remote';
|
|
const electronConsole = electronRemote.getGlobal('console') as Console;
|
|
import Logger from '../../../../logger/logger';
|
|
const LOG = Logger.create(__filename, electronConsole);
|
|
|
|
import React from 'react';
|
|
|
|
export interface HTMLElementWithRemoveSelf extends HTMLElement {
|
|
removeSelf: (() => void);
|
|
}
|
|
|
|
export default class BaseElements {
|
|
// Scraped directly from discord (#)
|
|
static TEXT_CHANNEL_ICON = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
<path fill="currentColor" fillRule="evenodd" clipRule="evenodd"
|
|
d="M5.88657 21C5.57547 21 5.3399 20.7189 5.39427 20.4126L6.00001 17H2.59511C2.28449 17 2.04905 16.7198 2.10259 16.4138L2.27759 15.4138C2.31946 15.1746 2.52722 15 2.77011 15H6.35001L7.41001 9H4.00511C3.69449 9 3.45905 8.71977 3.51259 8.41381L3.68759 7.41381C3.72946 7.17456 3.93722 7 4.18011 7H7.76001L8.39677 3.41262C8.43914 3.17391 8.64664 3 8.88907 3H9.87344C10.1845 3 10.4201 3.28107 10.3657 3.58738L9.76001 7H15.76L16.3968 3.41262C16.4391 3.17391 16.6466 3 16.8891 3H17.8734C18.1845 3 18.4201 3.28107 18.3657 3.58738L17.76 7H21.1649C21.4755 7 21.711 7.28023 21.6574 7.58619L21.4824 8.58619C21.4406 8.82544 21.2328 9 20.9899 9H17.41L16.35 15H19.7549C20.0655 15 20.301 15.2802 20.2474 15.5862L20.0724 16.5862C20.0306 16.8254 19.8228 17 19.5799 17H16L15.3632 20.5874C15.3209 20.8261 15.1134 21 14.8709 21H13.8866C13.5755 21 13.3399 20.7189 13.3943 20.4126L14 17H8.00001L7.36325 20.5874C7.32088 20.8261 7.11337 21 6.87094 21H5.88657ZM9.41045 9L8.35045 15H14.3504L15.4104 9H9.41045Z"
|
|
></path>
|
|
</svg>
|
|
);
|
|
static Q_TEXT_CHANNEL_ICON = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 24, height: 24, viewBox: '0 0 24 24', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: 'M5.88657 21C5.57547 21 5.3399 20.7189 5.39427 20.4126L6.00001 17H2.59511C2.28449 17 2.04905 16.7198 2.10259 16.4138L2.27759 15.4138C2.31946 15.1746 2.52722 15 2.77011 15H6.35001L7.41001 9H4.00511C3.69449 9 3.45905 8.71977 3.51259 8.41381L3.68759 7.41381C3.72946 7.17456 3.93722 7 4.18011 7H7.76001L8.39677 3.41262C8.43914 3.17391 8.64664 3 8.88907 3H9.87344C10.1845 3 10.4201 3.28107 10.3657 3.58738L9.76001 7H15.76L16.3968 3.41262C16.4391 3.17391 16.6466 3 16.8891 3H17.8734C18.1845 3 18.4201 3.28107 18.3657 3.58738L17.76 7H21.1649C21.4755 7 21.711 7.28023 21.6574 7.58619L21.4824 8.58619C21.4406 8.82544 21.2328 9 20.9899 9H17.41L16.35 15H19.7549C20.0655 15 20.301 15.2802 20.2474 15.5862L20.0724 16.5862C20.0306 16.8254 19.8228 17 19.5799 17H16L15.3632 20.5874C15.3209 20.8261 15.1134 21 14.8709 21H13.8866C13.5755 21 13.3399 20.7189 13.3943 20.4126L14 17H8.00001L7.36325 20.5874C7.32088 20.8261 7.11337 21 6.87094 21H5.88657ZM9.41045 9L8.35045 15H14.3504L15.4104 9H9.41045Z' }
|
|
};
|
|
|
|
// Scraped from discord (settings cog)
|
|
static COG = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
|
|
<path fill="currentColor" fillRule="evenodd" clipRule="evenodd"
|
|
d="
|
|
M 12.00,5.00
|
|
C 12.00,5.00 12.00,7.00 12.00,7.00
|
|
12.00,7.00 10.59,7.00 10.57,7.01
|
|
10.42,7.59 10.17,8.13 9.84,8.61
|
|
9.84,8.61 10.74,9.51 10.74,9.51
|
|
10.74,9.51 9.49,10.75 9.49,10.75
|
|
9.49,10.75 8.59,9.85 8.59,9.85
|
|
8.11,10.19 7.57,10.44 6.99,10.59
|
|
6.99,10.59 6.99,12.00 6.99,12.00
|
|
6.99,12.00 4.99,12.00 4.99,12.00
|
|
4.99,12.00 4.99,10.58 4.99,10.58
|
|
4.41,10.43 3.87,10.18 3.39,9.85
|
|
3.39,9.85 2.49,10.75 2.49,10.75
|
|
2.49,10.75 1.25,9.50 1.25,9.50
|
|
1.25,9.50 2.15,8.60 2.15,8.60
|
|
1.81,8.13 1.56,7.58 1.41,7.00
|
|
1.41,7.00 0.00,7.00 0.00,7.00
|
|
0.00,7.00 0.00,5.00 0.00,5.00
|
|
0.00,5.00 1.41,5.00 1.41,5.00
|
|
1.56,4.42 1.81,3.88 2.15,3.40
|
|
2.15,3.40 1.25,2.50 1.25,2.50
|
|
1.25,2.50 2.50,1.25 2.50,1.25
|
|
2.50,1.25 3.40,2.15 3.40,2.15
|
|
3.87,1.81 4.42,1.56 5.00,1.41
|
|
5.00,1.41 5.00,0.00 5.00,0.00
|
|
5.00,0.00 7.00,0.00 7.00,0.00
|
|
7.00,0.00 7.00,1.41 7.00,1.41
|
|
7.58,1.57 8.12,1.81 8.60,2.15
|
|
8.60,2.15 9.51,1.25 9.51,1.25
|
|
9.51,1.25 10.75,2.50 10.75,2.50
|
|
10.75,2.50 9.85,3.40 9.85,3.40
|
|
10.19,3.87 10.44,4.42 10.59,5.00
|
|
10.59,5.00 12.00,5.00 12.00,5.00 Z
|
|
M 6.00,8.00
|
|
C 7.10,8.00 8.00,7.10 8.00,6.00
|
|
8.00,4.90 7.10,4.00 6.00,4.00
|
|
4.90,4.00 4.00,4.90 4.00,6.00
|
|
4.00,7.10 4.90,8.00 6.00,8.00 Z"
|
|
></path>
|
|
</svg>
|
|
);
|
|
static Q_COG = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 12, height: 12, viewBox: '0 0 12 12', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: `
|
|
M 12.00,5.00
|
|
C 12.00,5.00 12.00,7.00 12.00,7.00
|
|
12.00,7.00 10.59,7.00 10.57,7.01
|
|
10.42,7.59 10.17,8.13 9.84,8.61
|
|
9.84,8.61 10.74,9.51 10.74,9.51
|
|
10.74,9.51 9.49,10.75 9.49,10.75
|
|
9.49,10.75 8.59,9.85 8.59,9.85
|
|
8.11,10.19 7.57,10.44 6.99,10.59
|
|
6.99,10.59 6.99,12.00 6.99,12.00
|
|
6.99,12.00 4.99,12.00 4.99,12.00
|
|
4.99,12.00 4.99,10.58 4.99,10.58
|
|
4.41,10.43 3.87,10.18 3.39,9.85
|
|
3.39,9.85 2.49,10.75 2.49,10.75
|
|
2.49,10.75 1.25,9.50 1.25,9.50
|
|
1.25,9.50 2.15,8.60 2.15,8.60
|
|
1.81,8.13 1.56,7.58 1.41,7.00
|
|
1.41,7.00 0.00,7.00 0.00,7.00
|
|
0.00,7.00 0.00,5.00 0.00,5.00
|
|
0.00,5.00 1.41,5.00 1.41,5.00
|
|
1.56,4.42 1.81,3.88 2.15,3.40
|
|
2.15,3.40 1.25,2.50 1.25,2.50
|
|
1.25,2.50 2.50,1.25 2.50,1.25
|
|
2.50,1.25 3.40,2.15 3.40,2.15
|
|
3.87,1.81 4.42,1.56 5.00,1.41
|
|
5.00,1.41 5.00,0.00 5.00,0.00
|
|
5.00,0.00 7.00,0.00 7.00,0.00
|
|
7.00,0.00 7.00,1.41 7.00,1.41
|
|
7.58,1.57 8.12,1.81 8.60,2.15
|
|
8.60,2.15 9.51,1.25 9.51,1.25
|
|
9.51,1.25 10.75,2.50 10.75,2.50
|
|
10.75,2.50 9.85,3.40 9.85,3.40
|
|
10.19,3.87 10.44,4.42 10.59,5.00
|
|
10.59,5.00 12.00,5.00 12.00,5.00 Z
|
|
M 6.00,8.00
|
|
C 7.10,8.00 8.00,7.10 8.00,6.00
|
|
8.00,4.90 7.10,4.00 6.00,4.00
|
|
4.90,4.00 4.00,4.90 4.00,6.00
|
|
4.00,7.10 4.90,8.00 6.00,8.00 Z` }
|
|
};
|
|
|
|
static TRASHCAN = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 64 64">
|
|
<path fill="currentColor" fillRule="evenodd" clipRule="evenodd"
|
|
d="M 11 12 C 9.338 12 8 13.338 8 15 L 8 61 C 8 62.662 9.338 64 11 64 L 53 64 C 54.662 64 56 62.662 56 61 L 56 15 C 56 13.338 54.662 12 53 12 L 11 12 z M 17 18 C 18.662 18 20 19.338 20 21 L 20 55 C 20 56.662 18.662 58 17 58 C 15.338 58 14 56.662 14 55 L 14 21 C 14 19.338 15.338 18 17 18 z M 32 18 C 33.662 18 35 19.338 35 21 L 35 55 C 35 56.662 33.662 58 32 58 C 30.338 58 29 56.662 29 55 L 29 21 C 29 19.338 30.338 18 32 18 z M 47 18 C 48.662 18 50 19.338 50 21 L 50 55 C 50 56.662 48.662 58 47 58 C 45.338 58 44 56.662 44 55 L 44 21 C 44 19.338 45.338 18 47 18 z"
|
|
></path>
|
|
<rect fill="currentColor" fillRule="evenodd" clipRule="evenodd" width="56" height="6" x="4" y="3" rx="3" ry="3" />
|
|
<rect fill="currentColor" fillRule="evenodd" clipRule="evenodd" width="16" height="6" x="24" y="0" rx="3" ry="3" />
|
|
</svg>
|
|
);
|
|
static Q_TRASHCAN = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 16, height: 16, viewBox: '0 0 64 64', content: [
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: 'M 11 12 C 9.338 12 8 13.338 8 15 L 8 61 C 8 62.662 9.338 64 11 64 L 53 64 C 54.662 64 56 62.662 56 61 L 56 15 C 56 13.338 54.662 12 53 12 L 11 12 z M 17 18 C 18.662 18 20 19.338 20 21 L 20 55 C 20 56.662 18.662 58 17 58 C 15.338 58 14 56.662 14 55 L 14 21 C 14 19.338 15.338 18 17 18 z M 32 18 C 33.662 18 35 19.338 35 21 L 35 55 C 35 56.662 33.662 58 32 58 C 30.338 58 29 56.662 29 55 L 29 21 C 29 19.338 30.338 18 32 18 z M 47 18 C 48.662 18 50 19.338 50 21 L 50 55 C 50 56.662 48.662 58 47 58 C 45.338 58 44 56.662 44 55 L 44 21 C 44 19.338 45.338 18 47 18 z' },
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'rect', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
width: '56', height: '6', x: '4', y: '3', rx: '3', ry: '3' },
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'rect', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
width: '16', height: '6', x: '24', y: '0', rx: '3', ry: '3' },
|
|
]
|
|
}
|
|
|
|
static DOWNLOAD = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 64 64">
|
|
<path fill="currentColor" fillRule="evenodd" clipRule="evenodd"
|
|
d="M 32 0 A 32 32 0 0 0 0 32 A 32 32 0 0 0 32 64 A 32 32 0 0 0 64 32 A 32 32 0 0 0 32 0 z M 27 11.5 L 37 11.5 L 37 39.5 L 46 39.5 L 32 52.5 L 18 39.5 L 27 39.5 L 27 11.5 z"
|
|
></path>
|
|
</svg>
|
|
);
|
|
static Q_DOWNLOAD = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 16, height: 16, viewBox: '0 0 64 64', content: [
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: 'M 32 0 A 32 32 0 0 0 0 32 A 32 32 0 0 0 32 64 A 32 32 0 0 0 64 32 A 32 32 0 0 0 32 0 z M 27 11.5 L 37 11.5 L 37 39.5 L 46 39.5 L 32 52.5 L 18 39.5 L 27 39.5 L 27 11.5 z' },
|
|
]
|
|
}
|
|
|
|
static TOKEN = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
<path fill="currentColor" fillRule="evenodd" clipRule="evenodd"
|
|
d="M 7.9160156 0 A 8.0000004 8.0000004 0 0 0 1.8710938 2.8574219 A 8.0000004 8.0000004 0 0 0 2.8574219 14.128906 A 8.0000004 8.0000004 0 0 0 14.128906 13.142578 A 8.0000004 8.0000004 0 0 0 13.142578 1.8710938 A 8.0000004 8.0000004 0 0 0 7.9160156 0 z M 5.2324219 3.2851562 A 2.4000002 2.4000002 0 0 1 6.7851562 3.8476562 A 2.4000002 2.4000002 0 0 1 7.6054688 6.1015625 L 13.367188 10.9375 L 12.595703 11.857422 L 10.90625 12.003906 L 10.445312 11.619141 L 10.373047 10.773438 L 9.9121094 10.388672 L 9.0664062 10.462891 L 8.6074219 10.076172 L 8.5332031 9.2304688 L 8.0742188 8.8457031 L 7.2285156 8.9199219 L 6.0625 7.9414062 A 2.4000002 2.4000002 0 0 1 3.6992188 7.5253906 A 2.4000002 2.4000002 0 0 1 3.4042969 4.1425781 A 2.4000002 2.4000002 0 0 1 5.2324219 3.2851562 z"
|
|
></path>
|
|
</svg>
|
|
);
|
|
static Q_TOKEN = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 16, height: 16, viewBox: '0 0 16 16', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: 'M 7.9160156 0 A 8.0000004 8.0000004 0 0 0 1.8710938 2.8574219 A 8.0000004 8.0000004 0 0 0 2.8574219 14.128906 A 8.0000004 8.0000004 0 0 0 14.128906 13.142578 A 8.0000004 8.0000004 0 0 0 13.142578 1.8710938 A 8.0000004 8.0000004 0 0 0 7.9160156 0 z M 5.2324219 3.2851562 A 2.4000002 2.4000002 0 0 1 6.7851562 3.8476562 A 2.4000002 2.4000002 0 0 1 7.6054688 6.1015625 L 13.367188 10.9375 L 12.595703 11.857422 L 10.90625 12.003906 L 10.445312 11.619141 L 10.373047 10.773438 L 9.9121094 10.388672 L 9.0664062 10.462891 L 8.6074219 10.076172 L 8.5332031 9.2304688 L 8.0742188 8.8457031 L 7.2285156 8.9199219 L 6.0625 7.9414062 A 2.4000002 2.4000002 0 0 1 3.6992188 7.5253906 A 2.4000002 2.4000002 0 0 1 3.4042969 4.1425781 A 2.4000002 2.4000002 0 0 1 5.2324219 3.2851562 z' }
|
|
}
|
|
|
|
static CREATE = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
<path fill="currentColor" fillRule="evenodd" clipRule="evenodd"
|
|
d="M 8 0 A 8 8 0 0 0 0 8 A 8 8 0 0 0 8 16 A 8 8 0 0 0 16 8 A 8 8 0 0 0 8 0 z M 7 4 L 9 4 L 9 7 L 12 7 L 12 9 L 9 9 L 9 12 L 7 12 L 7 9 L 4 9 L 4 7 L 7 7 L 7 4 z"
|
|
></path>
|
|
</svg>
|
|
);
|
|
static Q_CREATE = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 16, height: 16, viewBox: '0 0 16 16', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: `M 8 0 A 8 8 0 0 0 0 8 A 8 8 0 0 0 8 16 A 8 8 0 0 0 16 8 A 8 8 0 0 0 8 0 z M 7 4 L 9 4 L 9 7 L 12 7 L 12 9 L 9 9 L 9 12 L 7 12 L 7 9 L 4 9 L 4 7 L 7 7 L 7 4 z` }
|
|
}
|
|
|
|
static Q_UP_DOWN_ARROW = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 16, height: 16, viewBox: '0 0 16 16', content: [
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: 'M 3,1 V 11 H 2 0 l 4,4 4,-4 h -2 -1 V 1 Z' },
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', 'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: 'M 11,15 V 5 H 10 8 l 4,-4 4,4 H 14 13 V 15 Z' }
|
|
]
|
|
}
|
|
|
|
static Q_TAB_ABOVE = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 12, height: 8, viewBox: '0 0 12 8', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', //'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: `
|
|
M 6,0
|
|
L 12,8
|
|
L 0,8
|
|
Z` }
|
|
};
|
|
|
|
static Q_TAB_BELOW = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 12, height: 8, viewBox: '0 0 12 8', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', //'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: `
|
|
M 6,8
|
|
L 12,0
|
|
L 0,0
|
|
Z` }
|
|
};
|
|
|
|
static TAB_LEFT = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="20" viewBox="0 0 8 12">
|
|
<path fill="currentColor" d="M 0,6 L 8,12 L 8,0 Z"></path>
|
|
</svg>
|
|
);
|
|
static Q_TAB_LEFT = {
|
|
ns: 'http://www.w3.org/2000/svg', tag: 'svg', width: 10, height: 20, viewBox: '0 0 8 12', content:
|
|
{ ns: 'http://www.w3.org/2000/svg', tag: 'path', fill: 'currentColor', //'fill-rule': 'evenodd', 'clip-rule': 'evenodd',
|
|
d: `
|
|
M 0,6
|
|
L 8,12
|
|
L 8,0
|
|
Z` }
|
|
}
|
|
|
|
static SEND_MESSAGE_ATTACH = (
|
|
// Yoinked directly from Discord
|
|
<svg viewBox="0 0 24 24">
|
|
<path fill="currentColor" d="M12 2.00098C6.486 2.00098 2 6.48698 2 12.001C2 17.515 6.486 22.001 12 22.001C17.514 22.001 22 17.515 22 12.001C22 6.48698 17.514 2.00098 12 2.00098ZM17 13.001H13V17.001H11V13.001H7V11.001H11V7.00098H13V11.001H17V13.001Z" />
|
|
</svg>
|
|
);
|
|
|
|
static REMOVE_ATTACHMENT_X = (
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
<circle fill="currentColor" cx="8" cy="8" r="8" />
|
|
<rect fill="#ffffff"
|
|
width="2"
|
|
height="10"
|
|
x="-1"
|
|
y="6.3137083"
|
|
transform="rotate(-45)" />
|
|
<rect fill="#ffffff"
|
|
width="2"
|
|
height="10"
|
|
x="-12.313708"
|
|
y="-5"
|
|
transform="rotate(-135)" />
|
|
</svg>
|
|
);
|
|
}
|