-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: non-conflicting dependency updates (#1016)
* use package-lock to ensure devs are using the same versions of dependencies * update sqlite * update genius-lyrics * update @googleapis/drive * add prettier in dev deps so the config is actually used * update @rollup/plugin-commonjs * update @rollup/plugin-typescript * update rollup
- Loading branch information
1 parent
3b0affd
commit 5cdc75d
Showing
29 changed files
with
10,550 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
*.env | ||
|
||
.DS_Store | ||
package-lock.json | ||
|
||
test-output/ | ||
test-results/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,92 @@ | ||
// Credit to Liam (Stack Overflow) | ||
// https://stackoverflow.com/a/41034697/3480193 | ||
export class Cursor { | ||
static getCurrentCursorPosition(parentElement: any) { | ||
var selection = window.getSelection(), | ||
charCount = -1, | ||
node | ||
static getCurrentCursorPosition(parentElement: any) { | ||
var selection = window.getSelection(), | ||
charCount = -1, | ||
node | ||
|
||
if (selection?.focusNode) { | ||
if (Cursor._isChildOf(selection.focusNode, parentElement)) { | ||
node = selection.focusNode | ||
charCount = selection.focusOffset | ||
if (selection?.focusNode) { | ||
if (Cursor._isChildOf(selection.focusNode, parentElement)) { | ||
node = selection.focusNode | ||
charCount = selection.focusOffset | ||
|
||
while (node) { | ||
if (node === parentElement) { | ||
break | ||
} | ||
while (node) { | ||
if (node === parentElement) { | ||
break | ||
} | ||
|
||
if (node.previousSibling) { | ||
node = node.previousSibling | ||
charCount += node.textContent!.length | ||
} else { | ||
node = node.parentNode | ||
if (node === null) { | ||
break | ||
if (node.previousSibling) { | ||
node = node.previousSibling | ||
charCount += node.textContent!.length | ||
} else { | ||
node = node.parentNode | ||
if (node === null) { | ||
break | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return charCount | ||
} | ||
return charCount | ||
} | ||
|
||
static setCurrentCursorPosition(chars: number, element: any) { | ||
if (chars >= 0) { | ||
var selection = window.getSelection() | ||
static setCurrentCursorPosition(chars: number, element: any) { | ||
if (chars >= 0) { | ||
var selection = window.getSelection() | ||
|
||
let range = Cursor._createRange(element, { count: chars }) | ||
let range = Cursor._createRange(element, { count: chars }) | ||
|
||
if (range) { | ||
range.collapse(false) | ||
selection!.removeAllRanges() | ||
selection!.addRange(range) | ||
} | ||
if (range) { | ||
range.collapse(false) | ||
selection!.removeAllRanges() | ||
selection!.addRange(range) | ||
} | ||
} | ||
} | ||
} | ||
|
||
static _createRange(node: any, chars: any, range: any = null) { | ||
if (!range) { | ||
range = document.createRange() | ||
range.selectNode(node) | ||
range.setStart(node, 0) | ||
} | ||
static _createRange(node: any, chars: any, range: any = null) { | ||
if (!range) { | ||
range = document.createRange() | ||
range.selectNode(node) | ||
range.setStart(node, 0) | ||
} | ||
|
||
console.log(range, node, chars) | ||
console.log(range, node, chars) | ||
|
||
if (chars.count === 0) { | ||
range.setEnd(node, chars.count) | ||
} else if (node && chars.count > 0) { | ||
if (node.nodeType === Node.TEXT_NODE) { | ||
if (node.textContent.length < chars.count) { | ||
chars.count -= node.textContent.length | ||
} else { | ||
range.setEnd(node, chars.count) | ||
chars.count = 0 | ||
} | ||
} else { | ||
for (var lp = 0; lp < node.childNodes.length; lp++) { | ||
range = Cursor._createRange(node.childNodes[lp], chars, range) | ||
if (chars.count === 0) { | ||
range.setEnd(node, chars.count) | ||
} else if (node && chars.count > 0) { | ||
if (node.nodeType === Node.TEXT_NODE) { | ||
if (node.textContent.length < chars.count) { | ||
chars.count -= node.textContent.length | ||
} else { | ||
range.setEnd(node, chars.count) | ||
chars.count = 0 | ||
} | ||
} else { | ||
for (var lp = 0; lp < node.childNodes.length; lp++) { | ||
range = Cursor._createRange(node.childNodes[lp], chars, range) | ||
|
||
if (chars.count === 0) { | ||
break | ||
} | ||
if (chars.count === 0) { | ||
break | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return range | ||
} | ||
|
||
return range | ||
} | ||
static _isChildOf(node: any, parentElement: any) { | ||
while (node !== null) { | ||
if (node === parentElement) { | ||
return true | ||
} | ||
node = node.parentNode | ||
} | ||
|
||
static _isChildOf(node: any, parentElement: any) { | ||
while (node !== null) { | ||
if (node === parentElement) { | ||
return true | ||
} | ||
node = node.parentNode | ||
return false | ||
} | ||
|
||
return false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export function formatBytes(bytes: number, decimals: number = 0): string { | ||
if (bytes === 0) return "0 Bytes" | ||
const k = 1024 | ||
const dm: number = decimals < 0 ? 0 : decimals | ||
const sizes: string[] = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] | ||
const i: number = Math.floor(Math.log(bytes) / Math.log(k)) | ||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i] | ||
if (bytes === 0) return "0 Bytes" | ||
const k = 1024 | ||
const dm: number = decimals < 0 ? 0 : decimals | ||
const sizes: string[] = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] | ||
const i: number = Math.floor(Math.log(bytes) / Math.log(k)) | ||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
/** Selects the text inside a text node when the node is focused */ | ||
export function selectTextOnFocus(node: any) { | ||
const handleFocus = () => { | ||
node && typeof node.select === "function" && node.select() | ||
} | ||
const handleFocus = () => { | ||
node && typeof node.select === "function" && node.select() | ||
} | ||
|
||
node.addEventListener("focus", handleFocus) | ||
node.addEventListener("focus", handleFocus) | ||
|
||
return { | ||
destroy() { | ||
node.removeEventListener("focus", handleFocus) | ||
}, | ||
} | ||
return { | ||
destroy() { | ||
node.removeEventListener("focus", handleFocus) | ||
}, | ||
} | ||
} | ||
|
||
/** Blurs the node when Escape is pressed */ | ||
export function blurOnEscape(node: any) { | ||
const handleKey = (event: any) => { | ||
if (event.key === "Escape" && node && typeof node.blur === "function") node.blur() | ||
} | ||
const handleKey = (event: any) => { | ||
if (event.key === "Escape" && node && typeof node.blur === "function") node.blur() | ||
} | ||
|
||
node.addEventListener("keydown", handleKey) | ||
node.addEventListener("keydown", handleKey) | ||
|
||
return { | ||
destroy() { | ||
node.removeEventListener("keydown", handleKey) | ||
}, | ||
} | ||
return { | ||
destroy() { | ||
node.removeEventListener("keydown", handleKey) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export function autoscroll(scrollElem: any, index: number, grid: number = 1) { | ||
if (!scrollElem || index === undefined || index === null) return 0 | ||
return scrollElem.querySelector(".ParentBlock").children[Math.max(0, index)]?.offsetTop - scrollElem.offsetTop | ||
console.log(grid) | ||
if (!scrollElem || index === undefined || index === null) return 0 | ||
return scrollElem.querySelector(".ParentBlock").children[Math.max(0, index)]?.offsetTop - scrollElem.offsetTop | ||
console.log(grid) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.