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

Update npm

This commit is contained in:
Daniel Neto 2024-04-03 15:54:35 -03:00
parent 8341712d58
commit 1bd85100b9
5320 changed files with 58396 additions and 344722 deletions

View file

@ -22,6 +22,7 @@ class Text {
Replace a range of the text with the given content.
*/
replace(from, to, text) {
[from, to] = clip(this, from, to);
let parts = [];
this.decompose(0, from, parts, 2 /* Open.To */);
if (text.length)
@ -39,6 +40,7 @@ class Text {
Retrieve the text between the given points.
*/
slice(from, to = this.length) {
[from, to] = clip(this, from, to);
let parts = [];
this.decompose(from, to, parts, 0);
return TextNode.from(parts, to - from);
@ -165,6 +167,7 @@ class TextLeaf extends Text {
replace(from, to, text) {
if (!(text instanceof TextLeaf))
return super.replace(from, to, text);
[from, to] = clip(this, from, to);
let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);
let newLen = this.length + text.length - (to - from);
if (lines.length <= 32 /* Tree.Branch */)
@ -172,6 +175,7 @@ class TextLeaf extends Text {
return TextNode.from(TextLeaf.split(lines, []), newLen);
}
sliceString(from, to = this.length, lineSep = "\n") {
[from, to] = clip(this, from, to);
let result = "";
for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {
let line = this.text[i], end = pos + line.length;
@ -240,6 +244,7 @@ class TextNode extends Text {
}
}
replace(from, to, text) {
[from, to] = clip(this, from, to);
if (text.lines < this.lines)
for (let i = 0, pos = 0; i < this.children.length; i++) {
let child = this.children[i], end = pos + child.length;
@ -262,6 +267,7 @@ class TextNode extends Text {
return super.replace(from, to, text);
}
sliceString(from, to = this.length, lineSep = "\n") {
[from, to] = clip(this, from, to);
let result = "";
for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {
let child = this.children[i], end = pos + child.length;
@ -483,7 +489,11 @@ class LineCursor {
}
next(skip = 0) {
let { done, lineBreak, value } = this.inner.next(skip);
if (done) {
if (done && this.afterBreak) {
this.value = "";
this.afterBreak = false;
}
else if (done) {
this.done = true;
this.value = "";
}
@ -545,6 +555,10 @@ class Line {
*/
get length() { return this.to - this.from; }
}
function clip(text, from, to) {
from = Math.max(0, Math.min(text.length, from));
return [from, Math.max(from, Math.min(text.length, to))];
}
// Compressed representation of the Grapheme_Cluster_Break=Extend
// information from
@ -1312,12 +1326,12 @@ class SelectionRange {
The anchor of the rangethe side that doesn't move when you
extend it.
*/
get anchor() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.to : this.from; }
get anchor() { return this.flags & 32 /* RangeFlag.Inverted */ ? this.to : this.from; }
/**
The head of the range, which is moved when the range is
[extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).
*/
get head() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.from : this.to; }
get head() { return this.flags & 32 /* RangeFlag.Inverted */ ? this.from : this.to; }
/**
True when `anchor` and `head` are at the same position.
*/
@ -1328,14 +1342,14 @@ class SelectionRange {
the character before its position, 1 the character after, and 0
means no association.
*/
get assoc() { return this.flags & 4 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 8 /* RangeFlag.AssocAfter */ ? 1 : 0; }
get assoc() { return this.flags & 8 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 16 /* RangeFlag.AssocAfter */ ? 1 : 0; }
/**
The bidirectional text level associated with this cursor, if
any.
*/
get bidiLevel() {
let level = this.flags & 3 /* RangeFlag.BidiLevelMask */;
return level == 3 ? null : level;
let level = this.flags & 7 /* RangeFlag.BidiLevelMask */;
return level == 7 ? null : level;
}
/**
The goal column (stored vertical offset) associated with a
@ -1344,8 +1358,8 @@ class SelectionRange {
lines of different length.
*/
get goalColumn() {
let value = this.flags >> 5 /* RangeFlag.GoalColumnOffset */;
return value == 33554431 /* RangeFlag.NoGoalColumn */ ? undefined : value;
let value = this.flags >> 6 /* RangeFlag.GoalColumnOffset */;
return value == 16777215 /* RangeFlag.NoGoalColumn */ ? undefined : value;
}
/**
Map this range through a change, producing a valid range in the
@ -1374,8 +1388,9 @@ class SelectionRange {
/**
Compare this range to another range.
*/
eq(other) {
return this.anchor == other.anchor && this.head == other.head;
eq(other, includeAssoc = false) {
return this.anchor == other.anchor && this.head == other.head &&
(!includeAssoc || !this.empty || this.assoc == other.assoc);
}
/**
Return a JSON-serializable object representing the range.
@ -1425,14 +1440,17 @@ class EditorSelection {
return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex);
}
/**
Compare this selection to another selection.
Compare this selection to another selection. By default, ranges
are compared only by position. When `includeAssoc` is true,
cursor ranges must also have the same
[`assoc`](https://codemirror.net/6/docs/ref/#state.SelectionRange.assoc) value.
*/
eq(other) {
eq(other, includeAssoc = false) {
if (this.ranges.length != other.ranges.length ||
this.mainIndex != other.mainIndex)
return false;
for (let i = 0; i < this.ranges.length; i++)
if (!this.ranges[i].eq(other.ranges[i]))
if (!this.ranges[i].eq(other.ranges[i], includeAssoc))
return false;
return true;
}
@ -1505,18 +1523,18 @@ class EditorSelection {
safely ignore the optional arguments in most situations.
*/
static cursor(pos, assoc = 0, bidiLevel, goalColumn) {
return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 /* RangeFlag.AssocBefore */ : 8 /* RangeFlag.AssocAfter */) |
(bidiLevel == null ? 3 : Math.min(2, bidiLevel)) |
((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */));
return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 8 /* RangeFlag.AssocBefore */ : 16 /* RangeFlag.AssocAfter */) |
(bidiLevel == null ? 7 : Math.min(6, bidiLevel)) |
((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */));
}
/**
Create a selection range.
*/
static range(anchor, head, goalColumn, bidiLevel) {
let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
(bidiLevel == null ? 3 : Math.min(2, bidiLevel));
return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
: SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */) |
(bidiLevel == null ? 7 : Math.min(6, bidiLevel));
return head < anchor ? SelectionRange.create(head, anchor, 32 /* RangeFlag.Inverted */ | 16 /* RangeFlag.AssocAfter */ | flags)
: SelectionRange.create(anchor, head, (head > anchor ? 8 /* RangeFlag.AssocBefore */ : 0) | flags);
}
/**
@internal
@ -1553,6 +1571,9 @@ Examples of uses of facets are the [tab
size](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor
attributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update
listeners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener).
Note that `Facet` instances can be used anywhere where
[`FacetReader`](https://codemirror.net/6/docs/ref/#state.FacetReader) is expected.
*/
class Facet {
constructor(
@ -1580,6 +1601,11 @@ class Facet {
this.extensions = typeof enables == "function" ? enables(this) : enables;
}
/**
Returns a facet reader for this facet, which can be used to
[read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it.
*/
get reader() { return this; }
/**
Define a new facet.
*/
static define(config = {}) {
@ -2631,7 +2657,8 @@ class EditorState {
else {
startValues = tr.startState.values.slice();
}
new EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr);
let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle();
new EditorState(conf, tr.newDoc, selection, startValues, (state, slot) => slot.update(state, tr), tr);
}
/**
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
@ -3365,7 +3392,9 @@ class RangeSet {
let curTo = Math.min(cursor.to, to);
if (cursor.point) {
let active = cursor.activeForPoint(cursor.to);
let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);
let openCount = cursor.pointFrom < from ? active.length + 1
: cursor.point.startSide < 0 ? active.length
: Math.min(active.length, openRanges);
iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);
openRanges = Math.min(cursor.openEnd(curTo), active.length);
}
@ -3392,6 +3421,19 @@ class RangeSet {
build.add(range.from, range.to, range.value);
return build.finish();
}
/**
Join an array of range sets into a single set.
*/
static join(sets) {
if (!sets.length)
return RangeSet.empty;
let result = sets[sets.length - 1];
for (let i = sets.length - 2; i >= 0; i--) {
for (let layer = sets[i]; layer != RangeSet.empty; layer = layer.nextLayer)
result = new RangeSet(layer.chunkPos, layer.chunk, result, Math.max(layer.maxPoint, result.maxPoint));
}
return result;
}
}
/**
The empty set of ranges.
@ -3709,7 +3751,8 @@ class SpanCursor {
}
addActive(trackOpen) {
let i = 0, { value, to, rank } = this.cursor;
while (i < this.activeRank.length && this.activeRank[i] <= rank)
// Organize active marks by rank first, then by size
while (i < this.activeRank.length && (rank - this.activeRank[i] || to - this.activeTo[i]) > 0)
i++;
insert(this.active, i, value);
insert(this.activeTo, i, to);