1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 18:29:39 +02:00

npm update

This commit is contained in:
Daniel Neto 2023-08-12 10:32:47 -03:00
parent 0cdd3e9fee
commit 4696ba952f
1437 changed files with 32727 additions and 1248226 deletions

View file

@ -12,7 +12,7 @@ Comment or uncomment the current selection. Will use line comments
if available, otherwise falling back to block comments.
*/
const toggleComment = target => {
let config = getConfig(target.state);
let { state } = target, line = state.doc.lineAt(state.selection.main.from), config = getConfig(target.state, line.from);
return config.line ? toggleLineComment(target) : config.block ? toggleBlockCommentByLine(target) : false;
};
function command(f, option) {
@ -61,7 +61,7 @@ Comment or uncomment the lines around the current selection using
block comments.
*/
const toggleBlockCommentByLine = command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0 /* CommentOption.Toggle */);
function getConfig(state, pos = state.selection.main.head) {
function getConfig(state, pos) {
let data = state.languageDataAt("commentTokens", pos);
return data.length ? data[0] : {};
}
@ -108,7 +108,7 @@ function selectedLineRanges(state) {
if (last >= 0 && ranges[last].to > fromLine.from)
ranges[last].to = toLine.to;
else
ranges.push({ from: fromLine.from, to: toLine.to });
ranges.push({ from: fromLine.from + /^\s*/.exec(fromLine.text)[0].length, to: toLine.to });
}
return ranges;
}
@ -143,13 +143,13 @@ function changeLineComment(option, state, ranges = state.selection.ranges) {
let prevLine = -1;
for (let { from, to } of ranges) {
let startI = lines.length, minIndent = 1e9;
let token = getConfig(state, from).line;
if (!token)
continue;
for (let pos = from; pos <= to;) {
let line = state.doc.lineAt(pos);
if (line.from > prevLine && (from == to || to > line.from)) {
prevLine = line.from;
let token = getConfig(state, pos).line;
if (!token)
continue;
let indent = /^\s*/.exec(line.text)[0].length;
let empty = indent == line.length;
let comment = line.text.slice(indent, indent + token.length) == token ? indent : -1;
@ -631,6 +631,8 @@ function moveBySubword(view, range, forward) {
return false;
pos += forward ? next.length : -next.length;
let nextCat = categorize(next), ahead;
if (nextCat == state.CharCategory.Word && next.charCodeAt(0) < 128 && /[\W_]/.test(next))
nextCat = -1; // Treat word punctuation specially
if (cat == state.CharCategory.Space)
cat = nextCat;
if (cat != nextCat)
@ -721,21 +723,41 @@ const cursorLineUp = view => cursorByLine(view, false);
Move the selection one line down.
*/
const cursorLineDown = view => cursorByLine(view, true);
function pageHeight(view) {
return Math.max(view.defaultLineHeight, Math.min(view.dom.clientHeight, innerHeight) - 5);
function pageInfo(view$1) {
let selfScroll = view$1.scrollDOM.clientHeight < view$1.scrollDOM.scrollHeight - 2;
let marginTop = 0, marginBottom = 0, height;
if (selfScroll) {
for (let source of view$1.state.facet(view.EditorView.scrollMargins)) {
let margins = source(view$1);
if (margins === null || margins === void 0 ? void 0 : margins.top)
marginTop = Math.max(margins === null || margins === void 0 ? void 0 : margins.top, marginTop);
if (margins === null || margins === void 0 ? void 0 : margins.bottom)
marginBottom = Math.max(margins === null || margins === void 0 ? void 0 : margins.bottom, marginBottom);
}
height = view$1.scrollDOM.clientHeight - marginTop - marginBottom;
}
else {
height = (view$1.dom.ownerDocument.defaultView || window).innerHeight;
}
return { marginTop, marginBottom, selfScroll,
height: Math.max(view$1.defaultLineHeight, height - 5) };
}
function cursorByPage(view$1, forward) {
let page = pageInfo(view$1);
let { state } = view$1, selection = updateSel(state.selection, range => {
return range.empty ? view$1.moveVertically(range, forward, pageHeight(view$1)) : rangeEnd(range, forward);
return range.empty ? view$1.moveVertically(range, forward, page.height)
: rangeEnd(range, forward);
});
if (selection.eq(state.selection))
return false;
let startPos = view$1.coordsAtPos(state.selection.main.head);
let scrollRect = view$1.scrollDOM.getBoundingClientRect();
let effect;
if (startPos && startPos.top > scrollRect.top && startPos.bottom < scrollRect.bottom &&
startPos.top - scrollRect.top <= view$1.scrollDOM.scrollHeight - view$1.scrollDOM.scrollTop - view$1.scrollDOM.clientHeight)
effect = view.EditorView.scrollIntoView(selection.main.head, { y: "start", yMargin: startPos.top - scrollRect.top });
if (page.selfScroll) {
let startPos = view$1.coordsAtPos(state.selection.main.head);
let scrollRect = view$1.scrollDOM.getBoundingClientRect();
let scrollTop = scrollRect.top + page.marginTop, scrollBottom = scrollRect.bottom - page.marginBottom;
if (startPos && startPos.top > scrollTop && startPos.bottom < scrollBottom)
effect = view.EditorView.scrollIntoView(selection.main.head, { y: "start", yMargin: startPos.top - scrollTop });
}
view$1.dispatch(setSel(state, selection), { effects: effect });
return true;
}
@ -894,7 +916,7 @@ Move the selection head one line down.
*/
const selectLineDown = view => selectByLine(view, true);
function selectByPage(view, forward) {
return extendSel(view, range => view.moveVertically(range, forward, pageHeight(view)));
return extendSel(view, range => view.moveVertically(range, forward, pageInfo(view).height));
}
/**
Move the selection head one page up.
@ -1534,7 +1556,7 @@ The default keymap. Includes all bindings from
- Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)
- Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)
- Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)
- Ctrl-Enter (Comd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)
- Ctrl-Enter (Cmd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)
- Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)
- Ctrl-i (Cmd-i on macOS): [`selectParentSyntax`](https://codemirror.net/6/docs/ref/#commands.selectParentSyntax)
- Ctrl-[ (Cmd-[ on macOS): [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess)