@ni/ok-components 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14893,6 +14893,7 @@
|
|
|
14893
14893
|
calendarEventBackgroundTransportOrderColor: 'calendar-event-background-transport-order-color',
|
|
14894
14894
|
calendarEventBackgroundHoverTransportOrderColor: 'calendar-event-background-hover-transport-order-color',
|
|
14895
14895
|
calendarEventBorderTransportOrderColor: 'calendar-event-border-transport-order-color',
|
|
14896
|
+
calendarEventBorderWorkOrderColor: 'calendar-event-border-work-order-color',
|
|
14896
14897
|
calendarEventBackgroundAggregateAvailabilityColor: 'calendar-event-background-aggregate-availability-color',
|
|
14897
14898
|
calendarEventBorderAggregateAvailabilityColor: 'calendar-event-border-aggregate-availability-color'
|
|
14898
14899
|
};
|
|
@@ -16387,6 +16388,7 @@
|
|
|
16387
16388
|
calendarEventBackgroundTransportOrderColor: createThemeColor(BrownLight10, BrownDark10, BrownDark10),
|
|
16388
16389
|
calendarEventBackgroundHoverTransportOrderColor: createThemeColor(BrownLight20, BrownDark20, BrownDark20),
|
|
16389
16390
|
calendarEventBorderTransportOrderColor: createThemeColor(BrownLight, BrownDark, BrownDark),
|
|
16391
|
+
calendarEventBorderWorkOrderColor: createThemeColor(NiIndigo, NiIndigo, NiIndigo),
|
|
16390
16392
|
calendarEventBackgroundAggregateAvailabilityColor: createThemeColor(Black91V10, Black82, Black82),
|
|
16391
16393
|
calendarEventBorderAggregateAvailabilityColor: hexToRgbaCssThemeColor(createThemeColor(Black91, Black82V100, Black82V100), 0.5, 1, 1),
|
|
16392
16394
|
controlHeight: '32px',
|
|
@@ -16563,6 +16565,7 @@
|
|
|
16563
16565
|
createThemeColorToken(tokenNames.calendarEventBackgroundTransportOrderColor, tokenValues.calendarEventBackgroundTransportOrderColor);
|
|
16564
16566
|
createThemeColorToken(tokenNames.calendarEventBackgroundHoverTransportOrderColor, tokenValues.calendarEventBackgroundHoverTransportOrderColor);
|
|
16565
16567
|
const calendarEventBorderTransportOrderColor = createThemeColorToken(tokenNames.calendarEventBorderTransportOrderColor, tokenValues.calendarEventBorderTransportOrderColor);
|
|
16568
|
+
createThemeColorToken(tokenNames.calendarEventBorderWorkOrderColor, tokenValues.calendarEventBorderWorkOrderColor);
|
|
16566
16569
|
createThemeColorToken(tokenNames.calendarEventBackgroundAggregateAvailabilityColor, tokenValues.calendarEventBackgroundAggregateAvailabilityColor);
|
|
16567
16570
|
createThemeColorToken(tokenNames.calendarEventBorderAggregateAvailabilityColor, tokenValues.calendarEventBorderAggregateAvailabilityColor);
|
|
16568
16571
|
// #endregion
|
|
@@ -29164,7 +29167,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29164
29167
|
return Fragment.empty;
|
|
29165
29168
|
if (!Array.isArray(value))
|
|
29166
29169
|
throw new RangeError("Invalid input for Fragment.fromJSON");
|
|
29167
|
-
return
|
|
29170
|
+
return Fragment.fromArray(value.map(schema.nodeFromJSON));
|
|
29168
29171
|
}
|
|
29169
29172
|
/**
|
|
29170
29173
|
Build a fragment from an array of nodes. Ensures that adjacent
|
|
@@ -29398,17 +29401,6 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29398
29401
|
*/
|
|
29399
29402
|
class ReplaceError extends Error {
|
|
29400
29403
|
}
|
|
29401
|
-
/*
|
|
29402
|
-
ReplaceError = function(this: any, message: string) {
|
|
29403
|
-
let err = Error.call(this, message)
|
|
29404
|
-
;(err as any).__proto__ = ReplaceError.prototype
|
|
29405
|
-
return err
|
|
29406
|
-
} as any
|
|
29407
|
-
|
|
29408
|
-
ReplaceError.prototype = Object.create(Error.prototype)
|
|
29409
|
-
ReplaceError.prototype.constructor = ReplaceError
|
|
29410
|
-
ReplaceError.prototype.name = "ReplaceError"
|
|
29411
|
-
*/
|
|
29412
29404
|
/**
|
|
29413
29405
|
A slice represents a piece cut out of a larger document. It
|
|
29414
29406
|
stores not only a fragment, but also the depth up to which nodes on
|
|
@@ -29454,7 +29446,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29454
29446
|
@internal
|
|
29455
29447
|
*/
|
|
29456
29448
|
insertAt(pos, fragment) {
|
|
29457
|
-
let content = insertInto(this.content, pos + this.openStart, fragment);
|
|
29449
|
+
let content = insertInto(this.content, pos + this.openStart, fragment, this.openStart + 1, this.openEnd + 1);
|
|
29458
29450
|
return content && new Slice(content, this.openStart, this.openEnd);
|
|
29459
29451
|
}
|
|
29460
29452
|
/**
|
|
@@ -29528,14 +29520,14 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29528
29520
|
throw new RangeError("Removing non-flat range");
|
|
29529
29521
|
return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
|
|
29530
29522
|
}
|
|
29531
|
-
function insertInto(content, dist, insert, parent) {
|
|
29523
|
+
function insertInto(content, dist, insert, openStart, openEnd, parent) {
|
|
29532
29524
|
let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
|
|
29533
29525
|
if (offset == dist || child.isText) {
|
|
29534
|
-
if (parent && !parent.canReplace(index, index, insert))
|
|
29526
|
+
if (parent && openStart <= 0 && openEnd <= 0 && !parent.canReplace(index, index, insert))
|
|
29535
29527
|
return null;
|
|
29536
29528
|
return content.cut(0, dist).append(insert).append(content.cut(dist));
|
|
29537
29529
|
}
|
|
29538
|
-
let inner = insertInto(child.content, dist - offset - 1, insert, child);
|
|
29530
|
+
let inner = insertInto(child.content, dist - offset - 1, insert, index == 0 ? openStart - 1 : 0, index == content.childCount - 1 ? openEnd - 1 : 0, child);
|
|
29539
29531
|
return inner && content.replaceChild(index, child.copy(inner));
|
|
29540
29532
|
}
|
|
29541
29533
|
function replace$1($from, $to, slice) {
|
|
@@ -30065,10 +30057,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30065
30057
|
*/
|
|
30066
30058
|
forEach(f) { this.content.forEach(f); }
|
|
30067
30059
|
/**
|
|
30068
|
-
Invoke a callback for all descendant nodes recursively
|
|
30060
|
+
Invoke a callback for all descendant nodes recursively overlapping
|
|
30069
30061
|
the given two positions that are relative to start of this
|
|
30070
|
-
node's content.
|
|
30071
|
-
|
|
30062
|
+
node's content. This includes all ancestors of the nodes
|
|
30063
|
+
containing the two positions. The callback is invoked with the
|
|
30064
|
+
node, its position relative to the original node (method receiver),
|
|
30072
30065
|
its parent node, and its child index. When the callback returns
|
|
30073
30066
|
false for a given node, that node's children will not be
|
|
30074
30067
|
recursed over. The last parameter can be used to specify a
|
|
@@ -32156,6 +32149,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32156
32149
|
@internal
|
|
32157
32150
|
*/
|
|
32158
32151
|
serializeNodeInner(node, options) {
|
|
32152
|
+
if (node.isText)
|
|
32153
|
+
return doc$1(options).createTextNode(node.text);
|
|
32159
32154
|
let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
|
|
32160
32155
|
if (contentDOM) {
|
|
32161
32156
|
if (node.isLeaf)
|
|
@@ -32190,6 +32185,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32190
32185
|
return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
|
|
32191
32186
|
}
|
|
32192
32187
|
static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {
|
|
32188
|
+
// Kludge for backwards-compatibility with accidental original behavious
|
|
32189
|
+
if (typeof structure == "string")
|
|
32190
|
+
return { dom: doc.createTextNode(structure) };
|
|
32193
32191
|
return renderSpec(doc, structure, xmlNS, blockArraysIn);
|
|
32194
32192
|
}
|
|
32195
32193
|
/**
|
|
@@ -32261,11 +32259,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32261
32259
|
return result;
|
|
32262
32260
|
}
|
|
32263
32261
|
function renderSpec(doc, structure, xmlNS, blockArraysIn) {
|
|
32264
|
-
if (
|
|
32265
|
-
return { dom: doc.createTextNode(structure) };
|
|
32266
|
-
if (structure.nodeType != null)
|
|
32262
|
+
if (structure.nodeType == 1)
|
|
32267
32263
|
return { dom: structure };
|
|
32268
|
-
if (structure.dom && structure.dom.nodeType
|
|
32264
|
+
if (structure.dom && structure.dom.nodeType == 1)
|
|
32269
32265
|
return structure;
|
|
32270
32266
|
let tagName = structure[0], suspicious;
|
|
32271
32267
|
if (typeof tagName != "string")
|
|
@@ -32301,6 +32297,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32301
32297
|
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32302
32298
|
return { dom, contentDOM: dom };
|
|
32303
32299
|
}
|
|
32300
|
+
else if (typeof child == "string") {
|
|
32301
|
+
dom.appendChild(doc.createTextNode(child));
|
|
32302
|
+
}
|
|
32304
32303
|
else {
|
|
32305
32304
|
let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);
|
|
32306
32305
|
dom.appendChild(inner);
|
|
@@ -42781,8 +42780,44 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42781
42780
|
}
|
|
42782
42781
|
return true;
|
|
42783
42782
|
};
|
|
42783
|
+
|
|
42784
|
+
// src/commands/deleteSelection.ts
|
|
42785
|
+
var hasTextContent = (nodeSpec) => {
|
|
42786
|
+
if (!nodeSpec.content) {
|
|
42787
|
+
return false;
|
|
42788
|
+
}
|
|
42789
|
+
const textRegex = /^text(\*|\+)/;
|
|
42790
|
+
return textRegex.test(nodeSpec.content);
|
|
42791
|
+
};
|
|
42792
|
+
var expandSelectionForSide = ($pos, schema, side) => {
|
|
42793
|
+
if (!$pos.parent.isInline) {
|
|
42794
|
+
return $pos.pos;
|
|
42795
|
+
}
|
|
42796
|
+
if (side === "left" && $pos.pos > $pos.start() || side === "right" && $pos.pos < $pos.end()) {
|
|
42797
|
+
return $pos.pos;
|
|
42798
|
+
}
|
|
42799
|
+
const parentContent = schema.nodes[$pos.parent.type.name].spec;
|
|
42800
|
+
if (!hasTextContent(parentContent)) {
|
|
42801
|
+
return $pos.pos;
|
|
42802
|
+
}
|
|
42803
|
+
return side === "left" ? $pos.start() - 1 : $pos.end() + 1;
|
|
42804
|
+
};
|
|
42805
|
+
var expandSelectionForInlineText = ($from, $to, schema) => {
|
|
42806
|
+
const from = expandSelectionForSide($from, schema, "left");
|
|
42807
|
+
const to = expandSelectionForSide($to, schema, "right");
|
|
42808
|
+
return { from, to };
|
|
42809
|
+
};
|
|
42784
42810
|
var deleteSelection = () => ({ state, dispatch }) => {
|
|
42785
|
-
|
|
42811
|
+
const { $from, $to } = state.selection;
|
|
42812
|
+
if (state.selection.empty) {
|
|
42813
|
+
return false;
|
|
42814
|
+
}
|
|
42815
|
+
const { from, to } = expandSelectionForInlineText($from, $to, state.schema);
|
|
42816
|
+
if (dispatch) {
|
|
42817
|
+
state.tr.deleteRange(from, to).scrollIntoView();
|
|
42818
|
+
dispatch(state.tr);
|
|
42819
|
+
}
|
|
42820
|
+
return true;
|
|
42786
42821
|
};
|
|
42787
42822
|
|
|
42788
42823
|
// src/commands/enter.ts
|
|
@@ -45442,6 +45477,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45442
45477
|
});
|
|
45443
45478
|
extension.name = this.name;
|
|
45444
45479
|
extension.parent = this.parent;
|
|
45480
|
+
this.child = null;
|
|
45445
45481
|
return extension;
|
|
45446
45482
|
}
|
|
45447
45483
|
extend(extendedConfig = {}) {
|
|
@@ -45977,6 +46013,36 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45977
46013
|
})
|
|
45978
46014
|
);
|
|
45979
46015
|
}
|
|
46016
|
+
/**
|
|
46017
|
+
* Destroy the extension manager and clean up all extension references
|
|
46018
|
+
* to prevent memory leaks through parent/child extension chains.
|
|
46019
|
+
*
|
|
46020
|
+
* Walks each extension's full parent chain and nulls every forward
|
|
46021
|
+
* `parent.child → current` link where the parent still points to the
|
|
46022
|
+
* current node. This breaks the retention path from module-scope
|
|
46023
|
+
* singleton roots through deep extend() chains.
|
|
46024
|
+
*
|
|
46025
|
+
* Only ancestor `.child` links matching the current chain are cleared.
|
|
46026
|
+
* The `.parent` pointer on ancestors is never touched — extensions
|
|
46027
|
+
* may be shared across live editors, so their own backward references
|
|
46028
|
+
* and non-matching forward links must remain intact.
|
|
46029
|
+
*/
|
|
46030
|
+
destroy() {
|
|
46031
|
+
this.extensions.forEach((extension) => {
|
|
46032
|
+
let current = extension;
|
|
46033
|
+
while (current.parent) {
|
|
46034
|
+
const parent = current.parent;
|
|
46035
|
+
if (parent.child === current) {
|
|
46036
|
+
parent.child = null;
|
|
46037
|
+
}
|
|
46038
|
+
current = parent;
|
|
46039
|
+
}
|
|
46040
|
+
});
|
|
46041
|
+
this.extensions = [];
|
|
46042
|
+
this.baseExtensions = [];
|
|
46043
|
+
this.schema = null;
|
|
46044
|
+
this.editor = null;
|
|
46045
|
+
}
|
|
45980
46046
|
/**
|
|
45981
46047
|
* Go through all extensions, create extension storages & setup marks
|
|
45982
46048
|
* & bind editor event listener.
|
|
@@ -46390,12 +46456,23 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46390
46456
|
});
|
|
46391
46457
|
var Tabindex = Extension.create({
|
|
46392
46458
|
name: "tabindex",
|
|
46459
|
+
addOptions() {
|
|
46460
|
+
return {
|
|
46461
|
+
value: void 0
|
|
46462
|
+
};
|
|
46463
|
+
},
|
|
46393
46464
|
addProseMirrorPlugins() {
|
|
46394
46465
|
return [
|
|
46395
46466
|
new Plugin({
|
|
46396
46467
|
key: new PluginKey("tabindex"),
|
|
46397
46468
|
props: {
|
|
46398
|
-
attributes: () =>
|
|
46469
|
+
attributes: () => {
|
|
46470
|
+
var _a;
|
|
46471
|
+
if (!this.editor.isEditable && this.options.value === void 0) {
|
|
46472
|
+
return {};
|
|
46473
|
+
}
|
|
46474
|
+
return { tabindex: (_a = this.options.value) != null ? _a : "0" };
|
|
46475
|
+
}
|
|
46399
46476
|
}
|
|
46400
46477
|
})
|
|
46401
46478
|
];
|
|
@@ -46734,6 +46811,7 @@ img.ProseMirror-separator {
|
|
|
46734
46811
|
this.className = "tiptap";
|
|
46735
46812
|
this.editorView = null;
|
|
46736
46813
|
this.isFocused = false;
|
|
46814
|
+
this.destroyed = false;
|
|
46737
46815
|
/**
|
|
46738
46816
|
* The editor is considered initialized after the `create` event has been emitted.
|
|
46739
46817
|
*/
|
|
@@ -47025,7 +47103,7 @@ img.ProseMirror-separator {
|
|
|
47025
47103
|
* Creates an extension manager.
|
|
47026
47104
|
*/
|
|
47027
47105
|
createExtensionManager() {
|
|
47028
|
-
var _a, _b;
|
|
47106
|
+
var _a, _b, _c, _d;
|
|
47029
47107
|
const coreExtensions = this.options.enableCoreExtensions ? [
|
|
47030
47108
|
Editable,
|
|
47031
47109
|
ClipboardTextSerializer.configure({
|
|
@@ -47034,7 +47112,9 @@ img.ProseMirror-separator {
|
|
|
47034
47112
|
Commands,
|
|
47035
47113
|
FocusEvents,
|
|
47036
47114
|
Keymap,
|
|
47037
|
-
Tabindex
|
|
47115
|
+
Tabindex.configure({
|
|
47116
|
+
value: (_d = (_c = this.options.coreExtensionOptions) == null ? void 0 : _c.tabindex) == null ? void 0 : _d.value
|
|
47117
|
+
}),
|
|
47038
47118
|
Drop,
|
|
47039
47119
|
Paste,
|
|
47040
47120
|
Delete,
|
|
@@ -47271,9 +47351,18 @@ img.ProseMirror-separator {
|
|
|
47271
47351
|
* Destroy the editor.
|
|
47272
47352
|
*/
|
|
47273
47353
|
destroy() {
|
|
47354
|
+
if (this.destroyed) {
|
|
47355
|
+
return;
|
|
47356
|
+
}
|
|
47357
|
+
this.destroyed = true;
|
|
47274
47358
|
this.emit("destroy");
|
|
47275
47359
|
this.unmount();
|
|
47276
47360
|
this.removeAllListeners();
|
|
47361
|
+
this.extensionManager.destroy();
|
|
47362
|
+
this.extensionManager = null;
|
|
47363
|
+
this.schema = null;
|
|
47364
|
+
this.commandManager = null;
|
|
47365
|
+
this.extensionStorage = {};
|
|
47277
47366
|
}
|
|
47278
47367
|
/**
|
|
47279
47368
|
* Check if the editor is already destroyed.
|
|
@@ -47292,7 +47381,8 @@ img.ProseMirror-separator {
|
|
|
47292
47381
|
}
|
|
47293
47382
|
$pos(pos) {
|
|
47294
47383
|
const $pos = this.state.doc.resolve(pos);
|
|
47295
|
-
|
|
47384
|
+
const node = pos > 0 && $pos.nodeAfter && !$pos.nodeAfter.isText ? $pos.nodeAfter : null;
|
|
47385
|
+
return new NodePos($pos, this, false, node);
|
|
47296
47386
|
}
|
|
47297
47387
|
get $doc() {
|
|
47298
47388
|
return this.$pos(0);
|
|
@@ -49890,6 +49980,15 @@ ${indentedChild}`;
|
|
|
49890
49980
|
function decodeHTML(str, mode = DecodingMode.Legacy) {
|
|
49891
49981
|
return htmlDecoder(str, mode);
|
|
49892
49982
|
}
|
|
49983
|
+
/**
|
|
49984
|
+
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
|
|
49985
|
+
*
|
|
49986
|
+
* @param str The string to decode.
|
|
49987
|
+
* @returns The decoded string.
|
|
49988
|
+
*/
|
|
49989
|
+
function decodeHTMLStrict(str) {
|
|
49990
|
+
return htmlDecoder(str, DecodingMode.Strict);
|
|
49991
|
+
}
|
|
49893
49992
|
|
|
49894
49993
|
// Utilities
|
|
49895
49994
|
//
|
|
@@ -50069,6 +50168,10 @@ ${indentedChild}`;
|
|
|
50069
50168
|
return P.test(ch) || regex.test(ch)
|
|
50070
50169
|
}
|
|
50071
50170
|
|
|
50171
|
+
function isPunctCharCode (code) {
|
|
50172
|
+
return isPunctChar(fromCodePoint(code))
|
|
50173
|
+
}
|
|
50174
|
+
|
|
50072
50175
|
// Markdown ASCII punctuation characters.
|
|
50073
50176
|
//
|
|
50074
50177
|
// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
|
|
@@ -50130,6 +50233,7 @@ ${indentedChild}`;
|
|
|
50130
50233
|
// (remove this when node v10 is no longer supported).
|
|
50131
50234
|
//
|
|
50132
50235
|
if ('ẞ'.toLowerCase() === 'Ṿ') {
|
|
50236
|
+
/* c8 ignore next 2 */
|
|
50133
50237
|
str = str.replace(/ẞ/g, 'ß');
|
|
50134
50238
|
}
|
|
50135
50239
|
|
|
@@ -50168,6 +50272,28 @@ ${indentedChild}`;
|
|
|
50168
50272
|
return str.toLowerCase().toUpperCase()
|
|
50169
50273
|
}
|
|
50170
50274
|
|
|
50275
|
+
function isAsciiTrimmable (c) {
|
|
50276
|
+
return c === 0x20 || c === 0x09 || c === 0x0a || c === 0x0d
|
|
50277
|
+
}
|
|
50278
|
+
|
|
50279
|
+
// "Light" .trim() for blocks (headers, paragraphs), where unicode spaces
|
|
50280
|
+
// should be preserved.
|
|
50281
|
+
function asciiTrim (str) {
|
|
50282
|
+
let start = 0;
|
|
50283
|
+
for (; start < str.length; start++) {
|
|
50284
|
+
if (!isAsciiTrimmable(str.charCodeAt(start))) {
|
|
50285
|
+
break
|
|
50286
|
+
}
|
|
50287
|
+
}
|
|
50288
|
+
let end = str.length - 1;
|
|
50289
|
+
for (; end >= start; end--) {
|
|
50290
|
+
if (!isAsciiTrimmable(str.charCodeAt(end))) {
|
|
50291
|
+
break
|
|
50292
|
+
}
|
|
50293
|
+
}
|
|
50294
|
+
return str.slice(start, end + 1)
|
|
50295
|
+
}
|
|
50296
|
+
|
|
50171
50297
|
// Re-export libraries commonly used in both markdown-it and its plugins,
|
|
50172
50298
|
// so plugins won't have to depend on them explicitly, which reduces their
|
|
50173
50299
|
// bundled size (e.g. a browser build).
|
|
@@ -50177,6 +50303,7 @@ ${indentedChild}`;
|
|
|
50177
50303
|
var utils = /*#__PURE__*/Object.freeze({
|
|
50178
50304
|
__proto__: null,
|
|
50179
50305
|
arrayReplaceAt: arrayReplaceAt,
|
|
50306
|
+
asciiTrim: asciiTrim,
|
|
50180
50307
|
assign: assign$1,
|
|
50181
50308
|
escapeHtml: escapeHtml,
|
|
50182
50309
|
escapeRE: escapeRE$1,
|
|
@@ -50184,6 +50311,7 @@ ${indentedChild}`;
|
|
|
50184
50311
|
has: has,
|
|
50185
50312
|
isMdAsciiPunct: isMdAsciiPunct,
|
|
50186
50313
|
isPunctChar: isPunctChar,
|
|
50314
|
+
isPunctCharCode: isPunctCharCode,
|
|
50187
50315
|
isSpace: isSpace,
|
|
50188
50316
|
isString: isString$1,
|
|
50189
50317
|
isValidEntityCode: isValidEntityCode,
|
|
@@ -51547,14 +51675,36 @@ ${indentedChild}`;
|
|
|
51547
51675
|
const QUOTE_RE = /['"]/g;
|
|
51548
51676
|
const APOSTROPHE$1 = '\u2019'; /* ’ */
|
|
51549
51677
|
|
|
51550
|
-
function
|
|
51551
|
-
|
|
51678
|
+
function addReplacement (replacements, tokenIdx, pos, ch) {
|
|
51679
|
+
if (!replacements[tokenIdx]) {
|
|
51680
|
+
replacements[tokenIdx] = [];
|
|
51681
|
+
}
|
|
51682
|
+
|
|
51683
|
+
replacements[tokenIdx].push({ pos, ch });
|
|
51684
|
+
}
|
|
51685
|
+
|
|
51686
|
+
function applyReplacements (str, replacements) {
|
|
51687
|
+
let result = '';
|
|
51688
|
+
let lastPos = 0;
|
|
51689
|
+
|
|
51690
|
+
replacements.sort((a, b) => a.pos - b.pos);
|
|
51691
|
+
|
|
51692
|
+
for (let i = 0; i < replacements.length; i++) {
|
|
51693
|
+
const replacement = replacements[i];
|
|
51694
|
+
|
|
51695
|
+
result += str.slice(lastPos, replacement.pos) + replacement.ch;
|
|
51696
|
+
lastPos = replacement.pos + 1;
|
|
51697
|
+
}
|
|
51698
|
+
|
|
51699
|
+
return result + str.slice(lastPos)
|
|
51552
51700
|
}
|
|
51553
51701
|
|
|
51554
51702
|
function process_inlines (tokens, state) {
|
|
51555
51703
|
let j;
|
|
51556
51704
|
|
|
51557
51705
|
const stack = [];
|
|
51706
|
+
// token index -> list of replacements in the original token content
|
|
51707
|
+
const replacements = {};
|
|
51558
51708
|
|
|
51559
51709
|
for (let i = 0; i < tokens.length; i++) {
|
|
51560
51710
|
const token = tokens[i];
|
|
@@ -51568,9 +51718,9 @@ ${indentedChild}`;
|
|
|
51568
51718
|
|
|
51569
51719
|
if (token.type !== 'text') { continue }
|
|
51570
51720
|
|
|
51571
|
-
|
|
51721
|
+
const text = token.content;
|
|
51572
51722
|
let pos = 0;
|
|
51573
|
-
|
|
51723
|
+
const max = text.length;
|
|
51574
51724
|
|
|
51575
51725
|
/* eslint no-labels:0,block-scoped-var:0 */
|
|
51576
51726
|
OUTER:
|
|
@@ -51618,8 +51768,8 @@ ${indentedChild}`;
|
|
|
51618
51768
|
}
|
|
51619
51769
|
}
|
|
51620
51770
|
|
|
51621
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
51622
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
51771
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
51772
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
51623
51773
|
|
|
51624
51774
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
51625
51775
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
@@ -51662,7 +51812,7 @@ ${indentedChild}`;
|
|
|
51662
51812
|
if (!canOpen && !canClose) {
|
|
51663
51813
|
// middle of word
|
|
51664
51814
|
if (isSingle) {
|
|
51665
|
-
|
|
51815
|
+
addReplacement(replacements, i, t.index, APOSTROPHE$1);
|
|
51666
51816
|
}
|
|
51667
51817
|
continue
|
|
51668
51818
|
}
|
|
@@ -51685,18 +51835,8 @@ ${indentedChild}`;
|
|
|
51685
51835
|
closeQuote = state.md.options.quotes[1];
|
|
51686
51836
|
}
|
|
51687
51837
|
|
|
51688
|
-
|
|
51689
|
-
|
|
51690
|
-
// could mess up indices when quote length != 1
|
|
51691
|
-
token.content = replaceAt(token.content, t.index, closeQuote);
|
|
51692
|
-
tokens[item.token].content = replaceAt(
|
|
51693
|
-
tokens[item.token].content, item.pos, openQuote);
|
|
51694
|
-
|
|
51695
|
-
pos += closeQuote.length - 1;
|
|
51696
|
-
if (item.token === i) { pos += openQuote.length - 1; }
|
|
51697
|
-
|
|
51698
|
-
text = token.content;
|
|
51699
|
-
max = text.length;
|
|
51838
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
51839
|
+
addReplacement(replacements, item.token, item.pos, openQuote);
|
|
51700
51840
|
|
|
51701
51841
|
stack.length = j;
|
|
51702
51842
|
continue OUTER
|
|
@@ -51712,10 +51852,14 @@ ${indentedChild}`;
|
|
|
51712
51852
|
level: thisLevel
|
|
51713
51853
|
});
|
|
51714
51854
|
} else if (canClose && isSingle) {
|
|
51715
|
-
|
|
51855
|
+
addReplacement(replacements, i, t.index, APOSTROPHE$1);
|
|
51716
51856
|
}
|
|
51717
51857
|
}
|
|
51718
51858
|
}
|
|
51859
|
+
|
|
51860
|
+
Object.keys(replacements).forEach(function (tokenIdx) {
|
|
51861
|
+
tokens[tokenIdx].content = applyReplacements(tokens[tokenIdx].content, replacements[tokenIdx]);
|
|
51862
|
+
});
|
|
51719
51863
|
}
|
|
51720
51864
|
|
|
51721
51865
|
function smartquotes (state) {
|
|
@@ -53319,11 +53463,22 @@ ${indentedChild}`;
|
|
|
53319
53463
|
|
|
53320
53464
|
let nextLine = startLine + 1;
|
|
53321
53465
|
|
|
53466
|
+
// Block types 6 and 7 (the only ones whose end condition is a blank line)
|
|
53467
|
+
// have `/^$/` as their closing regexp. For all other types (1-5, e.g.
|
|
53468
|
+
// `<!--` comments), a blank line is regular content and must not terminate
|
|
53469
|
+
// the block - it ends only when its closing sequence is found.
|
|
53470
|
+
const endsOnBlankLine = HTML_SEQUENCES[i][1].test('');
|
|
53471
|
+
|
|
53322
53472
|
// If we are here - we detected HTML block.
|
|
53323
53473
|
// Let's roll down till block end.
|
|
53324
53474
|
if (!HTML_SEQUENCES[i][1].test(lineText)) {
|
|
53325
53475
|
for (; nextLine < endLine; nextLine++) {
|
|
53326
|
-
if (state.sCount[nextLine] < state.blkIndent) {
|
|
53476
|
+
if (state.sCount[nextLine] < state.blkIndent) {
|
|
53477
|
+
// An outdented blank line shouldn't end a block that doesn't end on a
|
|
53478
|
+
// blank line (e.g. a `<!--` comment inside a list item). Such blocks
|
|
53479
|
+
// must continue until their closing sequence regardless of indent.
|
|
53480
|
+
if (endsOnBlankLine || !state.isEmpty(nextLine)) { break }
|
|
53481
|
+
}
|
|
53327
53482
|
|
|
53328
53483
|
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
53329
53484
|
max = state.eMarks[nextLine];
|
|
@@ -53386,7 +53541,7 @@ ${indentedChild}`;
|
|
|
53386
53541
|
token_o.map = [startLine, state.line];
|
|
53387
53542
|
|
|
53388
53543
|
const token_i = state.push('inline', '', 0);
|
|
53389
|
-
token_i.content = state.src.slice(pos, max)
|
|
53544
|
+
token_i.content = asciiTrim(state.src.slice(pos, max));
|
|
53390
53545
|
token_i.map = [startLine, state.line];
|
|
53391
53546
|
token_i.children = [];
|
|
53392
53547
|
|
|
@@ -53398,6 +53553,7 @@ ${indentedChild}`;
|
|
|
53398
53553
|
|
|
53399
53554
|
// lheading (---, ===)
|
|
53400
53555
|
|
|
53556
|
+
|
|
53401
53557
|
function lheading (state, startLine, endLine/*, silent */) {
|
|
53402
53558
|
const terminatorRules = state.md.block.ruler.getRules('paragraph');
|
|
53403
53559
|
|
|
@@ -53455,10 +53611,11 @@ ${indentedChild}`;
|
|
|
53455
53611
|
|
|
53456
53612
|
if (!level) {
|
|
53457
53613
|
// Didn't find valid underline
|
|
53614
|
+
state.parentType = oldParentType;
|
|
53458
53615
|
return false
|
|
53459
53616
|
}
|
|
53460
53617
|
|
|
53461
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
53618
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
53462
53619
|
|
|
53463
53620
|
state.line = nextLine + 1;
|
|
53464
53621
|
|
|
@@ -53481,6 +53638,7 @@ ${indentedChild}`;
|
|
|
53481
53638
|
|
|
53482
53639
|
// Paragraph
|
|
53483
53640
|
|
|
53641
|
+
|
|
53484
53642
|
function paragraph (state, startLine, endLine) {
|
|
53485
53643
|
const terminatorRules = state.md.block.ruler.getRules('paragraph');
|
|
53486
53644
|
const oldParentType = state.parentType;
|
|
@@ -53507,7 +53665,7 @@ ${indentedChild}`;
|
|
|
53507
53665
|
if (terminate) { break }
|
|
53508
53666
|
}
|
|
53509
53667
|
|
|
53510
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
53668
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
53511
53669
|
|
|
53512
53670
|
state.line = nextLine;
|
|
53513
53671
|
|
|
@@ -53734,8 +53892,30 @@ ${indentedChild}`;
|
|
|
53734
53892
|
const max = this.posMax;
|
|
53735
53893
|
const marker = this.src.charCodeAt(start);
|
|
53736
53894
|
|
|
53737
|
-
//
|
|
53738
|
-
|
|
53895
|
+
// Astral characters below are combined manually, because .codePointAt()
|
|
53896
|
+
// does not guarantee numeric type output. And we don't wish JIT cache issues.
|
|
53897
|
+
// The broken surrogate pairs are evaluated as U+FFFD to prevent possible
|
|
53898
|
+
// crashes.
|
|
53899
|
+
|
|
53900
|
+
let lastChar;
|
|
53901
|
+
if (start === 0) {
|
|
53902
|
+
// treat beginning of the line as a whitespace
|
|
53903
|
+
lastChar = 0x20;
|
|
53904
|
+
} else if (start === 1) {
|
|
53905
|
+
lastChar = this.src.charCodeAt(0);
|
|
53906
|
+
if ((lastChar & 0xF800) === 0xD800) { lastChar = 0xFFFD; }
|
|
53907
|
+
} else {
|
|
53908
|
+
lastChar = this.src.charCodeAt(start - 1);
|
|
53909
|
+
if ((lastChar & 0xFC00) === 0xDC00) {
|
|
53910
|
+
// low surrogate => add high one, replace broken pair with U+FFFD
|
|
53911
|
+
const highSurr = this.src.charCodeAt(start - 2);
|
|
53912
|
+
lastChar = (highSurr & 0xFC00) === 0xD800
|
|
53913
|
+
? 0x10000 + ((highSurr - 0xD800) << 10) + (lastChar - 0xDC00)
|
|
53914
|
+
: 0xFFFD;
|
|
53915
|
+
} else if ((lastChar & 0xFC00) === 0xD800) {
|
|
53916
|
+
lastChar = 0xFFFD;
|
|
53917
|
+
}
|
|
53918
|
+
}
|
|
53739
53919
|
|
|
53740
53920
|
let pos = start;
|
|
53741
53921
|
while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
|
|
@@ -53743,10 +53923,19 @@ ${indentedChild}`;
|
|
|
53743
53923
|
const count = pos - start;
|
|
53744
53924
|
|
|
53745
53925
|
// treat end of the line as a whitespace
|
|
53746
|
-
|
|
53926
|
+
let nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
|
|
53927
|
+
if ((nextChar & 0xFC00) === 0xD800) {
|
|
53928
|
+
// high surrogate => add low one, replace broken pair with U+FFFD
|
|
53929
|
+
const lowSurr = this.src.charCodeAt(pos + 1);
|
|
53930
|
+
nextChar = (lowSurr & 0xFC00) === 0xDC00
|
|
53931
|
+
? 0x10000 + ((nextChar - 0xD800) << 10) + (lowSurr - 0xDC00)
|
|
53932
|
+
: 0xFFFD;
|
|
53933
|
+
} else if ((nextChar & 0xFC00) === 0xDC00) {
|
|
53934
|
+
nextChar = 0xFFFD;
|
|
53935
|
+
}
|
|
53747
53936
|
|
|
53748
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
53749
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
53937
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
53938
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
53750
53939
|
|
|
53751
53940
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
53752
53941
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
@@ -54773,7 +54962,7 @@ ${indentedChild}`;
|
|
|
54773
54962
|
} else {
|
|
54774
54963
|
const match = state.src.slice(pos).match(NAMED_RE);
|
|
54775
54964
|
if (match) {
|
|
54776
|
-
const decoded =
|
|
54965
|
+
const decoded = decodeHTMLStrict(match[0]);
|
|
54777
54966
|
if (decoded !== match[0]) {
|
|
54778
54967
|
if (!silent) {
|
|
54779
54968
|
const token = state.push('text_special', '', 0);
|
|
@@ -55435,11 +55624,6 @@ ${indentedChild}`;
|
|
|
55435
55624
|
// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
|
|
55436
55625
|
const tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
|
55437
55626
|
|
|
55438
|
-
function resetScanCache (self) {
|
|
55439
|
-
self.__index__ = -1;
|
|
55440
|
-
self.__text_cache__ = '';
|
|
55441
|
-
}
|
|
55442
|
-
|
|
55443
55627
|
function createValidator (re) {
|
|
55444
55628
|
return function (text, pos) {
|
|
55445
55629
|
const tail = text.slice(pos);
|
|
@@ -55478,8 +55662,11 @@ ${indentedChild}`;
|
|
|
55478
55662
|
function untpl (tpl) { return tpl.replace('%TLDS%', re.src_tlds) }
|
|
55479
55663
|
|
|
55480
55664
|
re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');
|
|
55665
|
+
re.email_fuzzy_global = RegExp(untpl(re.tpl_email_fuzzy), 'ig');
|
|
55481
55666
|
re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');
|
|
55667
|
+
re.link_fuzzy_global = RegExp(untpl(re.tpl_link_fuzzy), 'ig');
|
|
55482
55668
|
re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
|
|
55669
|
+
re.link_no_ip_fuzzy_global = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'ig');
|
|
55483
55670
|
re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
|
|
55484
55671
|
|
|
55485
55672
|
//
|
|
@@ -55573,12 +55760,6 @@ ${indentedChild}`;
|
|
|
55573
55760
|
'(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',
|
|
55574
55761
|
'i'
|
|
55575
55762
|
);
|
|
55576
|
-
|
|
55577
|
-
//
|
|
55578
|
-
// Cleanup
|
|
55579
|
-
//
|
|
55580
|
-
|
|
55581
|
-
resetScanCache(self);
|
|
55582
55763
|
}
|
|
55583
55764
|
|
|
55584
55765
|
/**
|
|
@@ -55586,55 +55767,45 @@ ${indentedChild}`;
|
|
|
55586
55767
|
*
|
|
55587
55768
|
* Match result. Single element of array, returned by [[LinkifyIt#match]]
|
|
55588
55769
|
**/
|
|
55589
|
-
function Match (
|
|
55590
|
-
const
|
|
55591
|
-
const end = self.__last_index__;
|
|
55592
|
-
const text = self.__text_cache__.slice(start, end);
|
|
55770
|
+
function Match (text, schema, index, lastIndex) {
|
|
55771
|
+
const raw = text.slice(index, lastIndex);
|
|
55593
55772
|
|
|
55594
55773
|
/**
|
|
55595
55774
|
* Match#schema -> String
|
|
55596
55775
|
*
|
|
55597
55776
|
* Prefix (protocol) for matched string.
|
|
55598
55777
|
**/
|
|
55599
|
-
this.schema =
|
|
55778
|
+
this.schema = schema.toLowerCase();
|
|
55600
55779
|
/**
|
|
55601
55780
|
* Match#index -> Number
|
|
55602
55781
|
*
|
|
55603
55782
|
* First position of matched string.
|
|
55604
55783
|
**/
|
|
55605
|
-
this.index =
|
|
55784
|
+
this.index = index;
|
|
55606
55785
|
/**
|
|
55607
55786
|
* Match#lastIndex -> Number
|
|
55608
55787
|
*
|
|
55609
55788
|
* Next position after matched string.
|
|
55610
55789
|
**/
|
|
55611
|
-
this.lastIndex =
|
|
55790
|
+
this.lastIndex = lastIndex;
|
|
55612
55791
|
/**
|
|
55613
55792
|
* Match#raw -> String
|
|
55614
55793
|
*
|
|
55615
55794
|
* Matched string.
|
|
55616
55795
|
**/
|
|
55617
|
-
this.raw =
|
|
55796
|
+
this.raw = raw;
|
|
55618
55797
|
/**
|
|
55619
55798
|
* Match#text -> String
|
|
55620
55799
|
*
|
|
55621
55800
|
* Notmalized text of matched string.
|
|
55622
55801
|
**/
|
|
55623
|
-
this.text =
|
|
55802
|
+
this.text = raw;
|
|
55624
55803
|
/**
|
|
55625
55804
|
* Match#url -> String
|
|
55626
55805
|
*
|
|
55627
55806
|
* Normalized url of matched string.
|
|
55628
55807
|
**/
|
|
55629
|
-
this.url =
|
|
55630
|
-
}
|
|
55631
|
-
|
|
55632
|
-
function createMatch (self, shift) {
|
|
55633
|
-
const match = new Match(self, shift);
|
|
55634
|
-
|
|
55635
|
-
self.__compiled__[match.schema].normalize(match, self);
|
|
55636
|
-
|
|
55637
|
-
return match
|
|
55808
|
+
this.url = raw;
|
|
55638
55809
|
}
|
|
55639
55810
|
|
|
55640
55811
|
/**
|
|
@@ -55689,12 +55860,6 @@ ${indentedChild}`;
|
|
|
55689
55860
|
|
|
55690
55861
|
this.__opts__ = assign({}, defaultOptions, options);
|
|
55691
55862
|
|
|
55692
|
-
// Cache last tested result. Used to skip repeating steps on next `match` call.
|
|
55693
|
-
this.__index__ = -1;
|
|
55694
|
-
this.__last_index__ = -1; // Next scan position
|
|
55695
|
-
this.__schema__ = '';
|
|
55696
|
-
this.__text_cache__ = '';
|
|
55697
|
-
|
|
55698
55863
|
this.__schemas__ = assign({}, defaultSchemas, schemas);
|
|
55699
55864
|
this.__compiled__ = {};
|
|
55700
55865
|
|
|
@@ -55736,69 +55901,38 @@ ${indentedChild}`;
|
|
|
55736
55901
|
* Searches linkifiable pattern and returns `true` on success or `false` on fail.
|
|
55737
55902
|
**/
|
|
55738
55903
|
LinkifyIt.prototype.test = function test (text) {
|
|
55739
|
-
// Reset scan cache
|
|
55740
|
-
this.__text_cache__ = text;
|
|
55741
|
-
this.__index__ = -1;
|
|
55742
|
-
|
|
55743
55904
|
if (!text.length) { return false }
|
|
55744
55905
|
|
|
55745
|
-
let m,
|
|
55906
|
+
let m, re;
|
|
55746
55907
|
|
|
55747
55908
|
// try to scan for link with schema - that's the most simple rule
|
|
55748
55909
|
if (this.re.schema_test.test(text)) {
|
|
55749
55910
|
re = this.re.schema_search;
|
|
55750
55911
|
re.lastIndex = 0;
|
|
55751
55912
|
while ((m = re.exec(text)) !== null) {
|
|
55752
|
-
|
|
55753
|
-
if (len) {
|
|
55754
|
-
this.__schema__ = m[2];
|
|
55755
|
-
this.__index__ = m.index + m[1].length;
|
|
55756
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
55757
|
-
break
|
|
55758
|
-
}
|
|
55913
|
+
if (this.testSchemaAt(text, m[2], re.lastIndex)) { return true }
|
|
55759
55914
|
}
|
|
55760
55915
|
}
|
|
55761
55916
|
|
|
55762
55917
|
if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
|
|
55763
55918
|
// guess schemaless links
|
|
55764
|
-
|
|
55765
|
-
|
|
55766
|
-
|
|
55767
|
-
if (this.__index__ < 0 || tld_pos < this.__index__) {
|
|
55768
|
-
if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
|
|
55769
|
-
shift = ml.index + ml[1].length;
|
|
55770
|
-
|
|
55771
|
-
if (this.__index__ < 0 || shift < this.__index__) {
|
|
55772
|
-
this.__schema__ = '';
|
|
55773
|
-
this.__index__ = shift;
|
|
55774
|
-
this.__last_index__ = ml.index + ml[0].length;
|
|
55775
|
-
}
|
|
55776
|
-
}
|
|
55919
|
+
if (text.search(this.re.host_fuzzy_test) >= 0) {
|
|
55920
|
+
if (text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy) !== null) {
|
|
55921
|
+
return true
|
|
55777
55922
|
}
|
|
55778
55923
|
}
|
|
55779
55924
|
}
|
|
55780
55925
|
|
|
55781
55926
|
if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
|
|
55782
55927
|
// guess schemaless emails
|
|
55783
|
-
|
|
55784
|
-
if (at_pos >= 0) {
|
|
55928
|
+
if (text.indexOf('@') >= 0) {
|
|
55785
55929
|
// We can't skip this check, because this cases are possible:
|
|
55786
55930
|
// 192.168.1.1@gmail.com, my.in@example.com
|
|
55787
|
-
if (
|
|
55788
|
-
shift = me.index + me[1].length;
|
|
55789
|
-
next = me.index + me[0].length;
|
|
55790
|
-
|
|
55791
|
-
if (this.__index__ < 0 || shift < this.__index__ ||
|
|
55792
|
-
(shift === this.__index__ && next > this.__last_index__)) {
|
|
55793
|
-
this.__schema__ = 'mailto:';
|
|
55794
|
-
this.__index__ = shift;
|
|
55795
|
-
this.__last_index__ = next;
|
|
55796
|
-
}
|
|
55797
|
-
}
|
|
55931
|
+
if (text.match(this.re.email_fuzzy) !== null) { return true }
|
|
55798
55932
|
}
|
|
55799
55933
|
}
|
|
55800
55934
|
|
|
55801
|
-
return
|
|
55935
|
+
return false
|
|
55802
55936
|
};
|
|
55803
55937
|
|
|
55804
55938
|
/**
|
|
@@ -55847,23 +55981,88 @@ ${indentedChild}`;
|
|
|
55847
55981
|
**/
|
|
55848
55982
|
LinkifyIt.prototype.match = function match (text) {
|
|
55849
55983
|
const result = [];
|
|
55850
|
-
|
|
55984
|
+
const type_schemed = [];
|
|
55985
|
+
const type_fuzzy_link = [];
|
|
55986
|
+
const type_fuzzy_email = [];
|
|
55987
|
+
let m, len, re;
|
|
55851
55988
|
|
|
55852
|
-
|
|
55853
|
-
|
|
55854
|
-
|
|
55855
|
-
|
|
55989
|
+
function choose (a, b) {
|
|
55990
|
+
if (!a) { return b }
|
|
55991
|
+
if (!b) { return a }
|
|
55992
|
+
if (a.index !== b.index) { return a.index < b.index ? a : b }
|
|
55993
|
+
return a.lastIndex >= b.lastIndex ? a : b
|
|
55856
55994
|
}
|
|
55857
55995
|
|
|
55858
|
-
|
|
55859
|
-
let tail = shift ? text.slice(shift) : text;
|
|
55996
|
+
if (!text.length) { return null }
|
|
55860
55997
|
|
|
55861
|
-
//
|
|
55862
|
-
|
|
55863
|
-
|
|
55998
|
+
// scan for links with schema
|
|
55999
|
+
if (this.re.schema_test.test(text)) {
|
|
56000
|
+
re = this.re.schema_search;
|
|
56001
|
+
re.lastIndex = 0;
|
|
56002
|
+
while ((m = re.exec(text)) !== null) {
|
|
56003
|
+
len = this.testSchemaAt(text, m[2], re.lastIndex);
|
|
56004
|
+
if (len) {
|
|
56005
|
+
type_schemed.push({
|
|
56006
|
+
schema: m[2],
|
|
56007
|
+
index: m.index + m[1].length,
|
|
56008
|
+
lastIndex: m.index + m[0].length + len
|
|
56009
|
+
});
|
|
56010
|
+
}
|
|
56011
|
+
}
|
|
56012
|
+
}
|
|
55864
56013
|
|
|
55865
|
-
|
|
55866
|
-
|
|
56014
|
+
if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
|
|
56015
|
+
re = this.__opts__.fuzzyIP ? this.re.link_fuzzy_global : this.re.link_no_ip_fuzzy_global;
|
|
56016
|
+
re.lastIndex = 0;
|
|
56017
|
+
while ((m = re.exec(text)) !== null) {
|
|
56018
|
+
type_fuzzy_link.push({
|
|
56019
|
+
schema: '',
|
|
56020
|
+
index: m.index + m[1].length,
|
|
56021
|
+
lastIndex: m.index + m[0].length
|
|
56022
|
+
});
|
|
56023
|
+
}
|
|
56024
|
+
}
|
|
56025
|
+
|
|
56026
|
+
if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
|
|
56027
|
+
re = this.re.email_fuzzy_global;
|
|
56028
|
+
re.lastIndex = 0;
|
|
56029
|
+
while ((m = re.exec(text)) !== null) {
|
|
56030
|
+
type_fuzzy_email.push({
|
|
56031
|
+
schema: 'mailto:',
|
|
56032
|
+
index: m.index + m[1].length,
|
|
56033
|
+
lastIndex: m.index + m[0].length
|
|
56034
|
+
});
|
|
56035
|
+
}
|
|
56036
|
+
}
|
|
56037
|
+
|
|
56038
|
+
const indexes = [0, 0, 0];
|
|
56039
|
+
let lastIndex = 0;
|
|
56040
|
+
|
|
56041
|
+
for (;;) {
|
|
56042
|
+
const candidates = [
|
|
56043
|
+
type_schemed[indexes[0]],
|
|
56044
|
+
type_fuzzy_email[indexes[1]],
|
|
56045
|
+
type_fuzzy_link[indexes[2]]
|
|
56046
|
+
];
|
|
56047
|
+
|
|
56048
|
+
const candidate = choose(choose(candidates[0], candidates[1]), candidates[2]);
|
|
56049
|
+
|
|
56050
|
+
if (!candidate) { break }
|
|
56051
|
+
|
|
56052
|
+
if (candidate === candidates[0]) {
|
|
56053
|
+
indexes[0]++;
|
|
56054
|
+
} else if (candidate === candidates[1]) {
|
|
56055
|
+
indexes[1]++;
|
|
56056
|
+
} else {
|
|
56057
|
+
indexes[2]++;
|
|
56058
|
+
}
|
|
56059
|
+
|
|
56060
|
+
if (candidate.index < lastIndex) { continue }
|
|
56061
|
+
|
|
56062
|
+
const match = new Match(text, candidate.schema, candidate.index, candidate.lastIndex);
|
|
56063
|
+
this.__compiled__[match.schema].normalize(match, this);
|
|
56064
|
+
result.push(match);
|
|
56065
|
+
lastIndex = candidate.lastIndex;
|
|
55867
56066
|
}
|
|
55868
56067
|
|
|
55869
56068
|
if (result.length) {
|
|
@@ -55880,10 +56079,6 @@ ${indentedChild}`;
|
|
|
55880
56079
|
* of the string, and null otherwise.
|
|
55881
56080
|
**/
|
|
55882
56081
|
LinkifyIt.prototype.matchAtStart = function matchAtStart (text) {
|
|
55883
|
-
// Reset scan cache
|
|
55884
|
-
this.__text_cache__ = text;
|
|
55885
|
-
this.__index__ = -1;
|
|
55886
|
-
|
|
55887
56082
|
if (!text.length) return null
|
|
55888
56083
|
|
|
55889
56084
|
const m = this.re.schema_at_start.exec(text);
|
|
@@ -55892,11 +56087,10 @@ ${indentedChild}`;
|
|
|
55892
56087
|
const len = this.testSchemaAt(text, m[2], m[0].length);
|
|
55893
56088
|
if (!len) return null
|
|
55894
56089
|
|
|
55895
|
-
|
|
55896
|
-
this.__index__ = m.index + m[1].length;
|
|
55897
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
56090
|
+
const match = new Match(text, m[2], m.index + m[1].length, m.index + m[0].length + len);
|
|
55898
56091
|
|
|
55899
|
-
|
|
56092
|
+
this.__compiled__[match.schema].normalize(match, this);
|
|
56093
|
+
return match
|
|
55900
56094
|
};
|
|
55901
56095
|
|
|
55902
56096
|
/** chainable
|
|
@@ -56948,7 +57142,7 @@ ${indentedChild}`;
|
|
|
56948
57142
|
* ```javascript
|
|
56949
57143
|
* var md = require('markdown-it')()
|
|
56950
57144
|
* .set({ html: true, breaks: true })
|
|
56951
|
-
* .set({ typographer
|
|
57145
|
+
* .set({ typographer: true });
|
|
56952
57146
|
* ```
|
|
56953
57147
|
*
|
|
56954
57148
|
* __Note:__ To achieve the best possible performance, don't modify a
|
|
@@ -58896,7 +59090,7 @@ ${indentedChild}`;
|
|
|
58896
59090
|
// THIS FILE IS AUTOMATICALLY GENERATED DO NOT EDIT DIRECTLY
|
|
58897
59091
|
// See update-tlds.js for encoding/decoding format
|
|
58898
59092
|
// https://data.iana.org/TLD/tlds-alpha-by-domain.txt
|
|
58899
|
-
const encodedTlds = '
|
|
59093
|
+
const encodedTlds = 'aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2';
|
|
58900
59094
|
// Internationalized domain names containing non-ASCII
|
|
58901
59095
|
const encodedUtlds = 'ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2';
|
|
58902
59096
|
|
|
@@ -60288,11 +60482,6 @@ ${indentedChild}`;
|
|
|
60288
60482
|
tt(Email$1, DOT, EmailDomainDot);
|
|
60289
60483
|
tt(Email$1, HYPHEN, EmailDomainHyphen);
|
|
60290
60484
|
|
|
60291
|
-
// Final possible email states
|
|
60292
|
-
const EmailColon = tt(Email$1, COLON); // URL followed by colon (potential port number here)
|
|
60293
|
-
/*const EmailColonPort = */
|
|
60294
|
-
ta(EmailColon, groups.numeric, Email); // URL followed by colon and port number
|
|
60295
|
-
|
|
60296
60485
|
// Account for dots and hyphens. Hyphens are usually parts of domain names
|
|
60297
60486
|
// (but not TLDs)
|
|
60298
60487
|
const DomainHyphen = tt(Domain, HYPHEN); // domain followed by hyphen
|
|
@@ -60375,16 +60564,18 @@ ${indentedChild}`;
|
|
|
60375
60564
|
// Continue not accepting for open brackets
|
|
60376
60565
|
tt(UrlNonaccept, OPEN, UrlOpen);
|
|
60377
60566
|
|
|
60378
|
-
//
|
|
60379
|
-
tt(UrlOpen, CLOSE, Url$1);
|
|
60380
|
-
|
|
60381
|
-
// URL that beings with an opening bracket, followed by a symbols.
|
|
60567
|
+
// URL that begins with an opening bracket, followed by a symbols.
|
|
60382
60568
|
// Note that the final state can still be `UrlOpen` (if the URL has a
|
|
60383
60569
|
// single opening bracket for some reason).
|
|
60384
60570
|
const UrlOpenQ = makeState(Url);
|
|
60385
60571
|
ta(UrlOpen, qsAccepting, UrlOpenQ);
|
|
60386
60572
|
const UrlOpenSyms = makeState(); // UrlOpen followed by some symbols it cannot end it
|
|
60387
|
-
ta(UrlOpen, qsNonAccepting);
|
|
60573
|
+
ta(UrlOpen, qsNonAccepting, UrlOpenSyms);
|
|
60574
|
+
|
|
60575
|
+
// Closing bracket component. This character WILL be included in the URL.
|
|
60576
|
+
// Must come after qsNonAccepting (which includes all close-bracket tokens)
|
|
60577
|
+
// so that CLOSE -> Url wins over CLOSE -> UrlOpenSyms.
|
|
60578
|
+
tt(UrlOpen, CLOSE, Url$1);
|
|
60388
60579
|
|
|
60389
60580
|
// URL that begins with an opening bracket, followed by some symbols
|
|
60390
60581
|
ta(UrlOpenQ, qsAccepting, UrlOpenQ);
|
|
@@ -61138,6 +61329,25 @@ ${indentedChild}`;
|
|
|
61138
61329
|
return [inputRule];
|
|
61139
61330
|
}
|
|
61140
61331
|
});
|
|
61332
|
+
function isSameLineOrderedListToken(token) {
|
|
61333
|
+
var _a, _b;
|
|
61334
|
+
const nestedToken = (_a = token.tokens) == null ? void 0 : _a[0];
|
|
61335
|
+
return Boolean(
|
|
61336
|
+
token.text && ((_b = token.tokens) == null ? void 0 : _b.length) === 1 && (nestedToken == null ? void 0 : nestedToken.type) === "list" && nestedToken.ordered && nestedToken.raw === token.text
|
|
61337
|
+
);
|
|
61338
|
+
}
|
|
61339
|
+
function parseSameLineOrderedListText(text, helpers) {
|
|
61340
|
+
if (helpers.tokenizeInline) {
|
|
61341
|
+
return helpers.parseInline(helpers.tokenizeInline(text));
|
|
61342
|
+
}
|
|
61343
|
+
return helpers.parseInline([
|
|
61344
|
+
{
|
|
61345
|
+
type: "text",
|
|
61346
|
+
raw: text,
|
|
61347
|
+
text
|
|
61348
|
+
}
|
|
61349
|
+
]);
|
|
61350
|
+
}
|
|
61141
61351
|
var ListItem = Node3.create({
|
|
61142
61352
|
name: "listItem",
|
|
61143
61353
|
addOptions() {
|
|
@@ -61168,6 +61378,17 @@ ${indentedChild}`;
|
|
|
61168
61378
|
const parseBlockChildren = (_a = helpers.parseBlockChildren) != null ? _a : helpers.parseChildren;
|
|
61169
61379
|
let content = [];
|
|
61170
61380
|
if (token.tokens && token.tokens.length > 0) {
|
|
61381
|
+
if (isSameLineOrderedListToken(token)) {
|
|
61382
|
+
return {
|
|
61383
|
+
type: "listItem",
|
|
61384
|
+
content: [
|
|
61385
|
+
{
|
|
61386
|
+
type: "paragraph",
|
|
61387
|
+
content: parseSameLineOrderedListText(token.text || "", helpers)
|
|
61388
|
+
}
|
|
61389
|
+
]
|
|
61390
|
+
};
|
|
61391
|
+
}
|
|
61171
61392
|
const hasParagraphTokens = token.tokens.some((t) => t.type === "paragraph");
|
|
61172
61393
|
if (hasParagraphTokens) {
|
|
61173
61394
|
content = parseBlockChildren(token.tokens);
|
|
@@ -63811,6 +64032,7 @@ ${indentedChild}`;
|
|
|
63811
64032
|
addOptions() {
|
|
63812
64033
|
return {
|
|
63813
64034
|
limit: null,
|
|
64035
|
+
autoTrim: true,
|
|
63814
64036
|
mode: "textSize",
|
|
63815
64037
|
textCounter: (text) => text.length,
|
|
63816
64038
|
wordCounter: (text) => text.split(" ").filter((word) => word !== "").length
|
|
@@ -63848,7 +64070,8 @@ ${indentedChild}`;
|
|
|
63848
64070
|
return;
|
|
63849
64071
|
}
|
|
63850
64072
|
const limit = this.options.limit;
|
|
63851
|
-
|
|
64073
|
+
const autoTrim = this.options.autoTrim;
|
|
64074
|
+
if (limit === null || limit === void 0 || limit === 0 || autoTrim === false) {
|
|
63852
64075
|
initialEvaluationDone = true;
|
|
63853
64076
|
return;
|
|
63854
64077
|
}
|
|
@@ -63991,10 +64214,114 @@ ${indentedChild}`;
|
|
|
63991
64214
|
};
|
|
63992
64215
|
}
|
|
63993
64216
|
});
|
|
64217
|
+
function createPlaceholderDecoration(options) {
|
|
64218
|
+
const {
|
|
64219
|
+
editor,
|
|
64220
|
+
placeholder,
|
|
64221
|
+
dataAttribute,
|
|
64222
|
+
pos,
|
|
64223
|
+
node,
|
|
64224
|
+
isEmptyDoc,
|
|
64225
|
+
hasAnchor,
|
|
64226
|
+
classes: { emptyNode, emptyEditor }
|
|
64227
|
+
} = options;
|
|
64228
|
+
const classes = [emptyNode];
|
|
64229
|
+
if (isEmptyDoc) {
|
|
64230
|
+
classes.push(emptyEditor);
|
|
64231
|
+
}
|
|
64232
|
+
return Decoration.node(pos, pos + node.nodeSize, {
|
|
64233
|
+
class: classes.join(" "),
|
|
64234
|
+
[dataAttribute]: typeof placeholder === "function" ? placeholder({
|
|
64235
|
+
editor,
|
|
64236
|
+
node,
|
|
64237
|
+
pos,
|
|
64238
|
+
hasAnchor
|
|
64239
|
+
}) : placeholder
|
|
64240
|
+
});
|
|
64241
|
+
}
|
|
64242
|
+
|
|
64243
|
+
// src/placeholder/utils/findScrollParent.ts
|
|
64244
|
+
function isScrollable(el) {
|
|
64245
|
+
const style = getComputedStyle(el);
|
|
64246
|
+
const overflow = `${style.overflow} ${style.overflowY} ${style.overflowX}`;
|
|
64247
|
+
return /auto|scroll|overlay/.test(overflow);
|
|
64248
|
+
}
|
|
64249
|
+
function findScrollParent(element) {
|
|
64250
|
+
let el = element;
|
|
64251
|
+
while (el) {
|
|
64252
|
+
if (isScrollable(el)) {
|
|
64253
|
+
return el;
|
|
64254
|
+
}
|
|
64255
|
+
const parent = el.parentElement;
|
|
64256
|
+
if (!parent) {
|
|
64257
|
+
const root = el.getRootNode();
|
|
64258
|
+
if (root instanceof ShadowRoot) {
|
|
64259
|
+
el = root.host;
|
|
64260
|
+
continue;
|
|
64261
|
+
}
|
|
64262
|
+
return window;
|
|
64263
|
+
}
|
|
64264
|
+
el = parent;
|
|
64265
|
+
}
|
|
64266
|
+
return window;
|
|
64267
|
+
}
|
|
64268
|
+
|
|
64269
|
+
// src/placeholder/utils/getViewportBoundaryPositions.ts
|
|
64270
|
+
function getContainerRect(container) {
|
|
64271
|
+
if (container === window) {
|
|
64272
|
+
return { top: 0, bottom: window.innerHeight };
|
|
64273
|
+
}
|
|
64274
|
+
return container.getBoundingClientRect();
|
|
64275
|
+
}
|
|
64276
|
+
function getViewportBoundaryPositions({
|
|
64277
|
+
doc,
|
|
64278
|
+
view,
|
|
64279
|
+
scrollContainer
|
|
64280
|
+
}) {
|
|
64281
|
+
const editorRect = view.dom.getBoundingClientRect();
|
|
64282
|
+
const containerRect = scrollContainer ? getContainerRect(scrollContainer) : { top: 0, bottom: window.innerHeight };
|
|
64283
|
+
const visibleTop = Math.max(editorRect.top, containerRect.top);
|
|
64284
|
+
const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom);
|
|
64285
|
+
if (visibleTop >= visibleBottom) {
|
|
64286
|
+
return { top: 0, bottom: doc.content.size };
|
|
64287
|
+
}
|
|
64288
|
+
const isRTL = getComputedStyle(view.dom).direction === "rtl";
|
|
64289
|
+
const x = isRTL ? Math.max(editorRect.right - 2, editorRect.left + 2) : editorRect.left + 2;
|
|
64290
|
+
const topPos = view.posAtCoords({ left: x, top: visibleTop + 2 });
|
|
64291
|
+
const bottomPos = view.posAtCoords({ left: x, top: visibleBottom - 2 });
|
|
64292
|
+
return {
|
|
64293
|
+
top: topPos ? topPos.pos : 0,
|
|
64294
|
+
bottom: bottomPos ? bottomPos.pos : doc.content.size
|
|
64295
|
+
};
|
|
64296
|
+
}
|
|
64297
|
+
|
|
64298
|
+
// src/placeholder/utils/throttle.ts
|
|
64299
|
+
function throttle(fn, delay) {
|
|
64300
|
+
let timer = null;
|
|
64301
|
+
const call = ((...args) => {
|
|
64302
|
+
if (timer) {
|
|
64303
|
+
return;
|
|
64304
|
+
}
|
|
64305
|
+
fn(...args);
|
|
64306
|
+
timer = setTimeout(() => {
|
|
64307
|
+
timer = null;
|
|
64308
|
+
}, delay);
|
|
64309
|
+
});
|
|
64310
|
+
const cancel = () => {
|
|
64311
|
+
if (timer) {
|
|
64312
|
+
clearTimeout(timer);
|
|
64313
|
+
timer = null;
|
|
64314
|
+
}
|
|
64315
|
+
};
|
|
64316
|
+
return { call, cancel };
|
|
64317
|
+
}
|
|
64318
|
+
|
|
64319
|
+
// src/placeholder/placeholder.ts
|
|
63994
64320
|
var DEFAULT_DATA_ATTRIBUTE = "placeholder";
|
|
63995
64321
|
function preparePlaceholderAttribute(attr) {
|
|
63996
64322
|
return attr.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
63997
64323
|
}
|
|
64324
|
+
var PLUGIN_KEY = new PluginKey("tiptap__placeholder");
|
|
63998
64325
|
var Placeholder = Extension.create({
|
|
63999
64326
|
name: "placeholder",
|
|
64000
64327
|
addOptions() {
|
|
@@ -64012,40 +64339,124 @@ ${indentedChild}`;
|
|
|
64012
64339
|
const dataAttribute = this.options.dataAttribute ? `data-${preparePlaceholderAttribute(this.options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;
|
|
64013
64340
|
return [
|
|
64014
64341
|
new Plugin({
|
|
64015
|
-
|
|
64342
|
+
state: {
|
|
64343
|
+
init() {
|
|
64344
|
+
return {
|
|
64345
|
+
// null means "no viewport info yet" — decoration callback falls
|
|
64346
|
+
// back to full document scan until the scroll handler fires.
|
|
64347
|
+
topPos: null,
|
|
64348
|
+
bottomPos: null
|
|
64349
|
+
};
|
|
64350
|
+
},
|
|
64351
|
+
apply(tr, prev) {
|
|
64352
|
+
const meta = tr.getMeta(PLUGIN_KEY);
|
|
64353
|
+
if (meta == null ? void 0 : meta.positions) {
|
|
64354
|
+
return {
|
|
64355
|
+
topPos: meta.positions.top,
|
|
64356
|
+
bottomPos: meta.positions.bottom
|
|
64357
|
+
};
|
|
64358
|
+
}
|
|
64359
|
+
if (!tr.docChanged) {
|
|
64360
|
+
return prev;
|
|
64361
|
+
}
|
|
64362
|
+
return {
|
|
64363
|
+
topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
|
|
64364
|
+
bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
|
|
64365
|
+
};
|
|
64366
|
+
}
|
|
64367
|
+
},
|
|
64368
|
+
key: PLUGIN_KEY,
|
|
64369
|
+
view(view) {
|
|
64370
|
+
const scrollContainer = findScrollParent(view.dom);
|
|
64371
|
+
const computeAndDispatch = () => {
|
|
64372
|
+
const positions = getViewportBoundaryPositions({
|
|
64373
|
+
view,
|
|
64374
|
+
doc: view.state.doc,
|
|
64375
|
+
scrollContainer
|
|
64376
|
+
});
|
|
64377
|
+
const prev = PLUGIN_KEY.getState(view.state);
|
|
64378
|
+
if (prev.topPos === positions.top && prev.bottomPos === positions.bottom) {
|
|
64379
|
+
return;
|
|
64380
|
+
}
|
|
64381
|
+
const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions }).setMeta("tiptap__viewportUpdate", true);
|
|
64382
|
+
view.dispatch(tr);
|
|
64383
|
+
};
|
|
64384
|
+
const { call: throttledUpdate, cancel: cancelThrottle } = throttle(computeAndDispatch, 250);
|
|
64385
|
+
const scrollParent = scrollContainer;
|
|
64386
|
+
scrollParent.addEventListener("scroll", throttledUpdate, { passive: true });
|
|
64387
|
+
computeAndDispatch();
|
|
64388
|
+
return {
|
|
64389
|
+
update(_, prevState) {
|
|
64390
|
+
if (view.state.doc.content.size !== prevState.doc.content.size) {
|
|
64391
|
+
computeAndDispatch();
|
|
64392
|
+
}
|
|
64393
|
+
},
|
|
64394
|
+
destroy: () => {
|
|
64395
|
+
cancelThrottle();
|
|
64396
|
+
scrollParent.removeEventListener("scroll", throttledUpdate);
|
|
64397
|
+
}
|
|
64398
|
+
};
|
|
64399
|
+
},
|
|
64016
64400
|
props: {
|
|
64017
64401
|
decorations: ({ doc, selection }) => {
|
|
64402
|
+
var _a, _b;
|
|
64018
64403
|
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
64019
|
-
const { anchor } = selection;
|
|
64020
|
-
const decorations = [];
|
|
64021
64404
|
if (!active) {
|
|
64022
64405
|
return null;
|
|
64023
64406
|
}
|
|
64407
|
+
const { anchor } = selection;
|
|
64408
|
+
const decorations = [];
|
|
64024
64409
|
const isEmptyDoc = this.editor.isEmpty;
|
|
64025
|
-
|
|
64026
|
-
|
|
64027
|
-
const
|
|
64028
|
-
if (
|
|
64029
|
-
|
|
64410
|
+
const useResolvedPath = this.options.showOnlyCurrent && !this.options.includeChildren;
|
|
64411
|
+
if (useResolvedPath) {
|
|
64412
|
+
const resolved = doc.resolve(anchor);
|
|
64413
|
+
if (resolved.depth > 0) {
|
|
64414
|
+
const node = resolved.node(1);
|
|
64415
|
+
const nodeStart = resolved.before(1);
|
|
64416
|
+
if (node.type.isTextblock && isNodeEmpty(node)) {
|
|
64417
|
+
const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
|
|
64418
|
+
const decoration = createPlaceholderDecoration({
|
|
64419
|
+
node,
|
|
64420
|
+
dataAttribute,
|
|
64421
|
+
hasAnchor,
|
|
64422
|
+
placeholder: this.options.placeholder,
|
|
64423
|
+
classes: {
|
|
64424
|
+
emptyEditor: this.options.emptyEditorClass,
|
|
64425
|
+
emptyNode: this.options.emptyNodeClass
|
|
64426
|
+
},
|
|
64427
|
+
editor: this.editor,
|
|
64428
|
+
isEmptyDoc,
|
|
64429
|
+
pos: resolved.before(1)
|
|
64430
|
+
});
|
|
64431
|
+
decorations.push(decoration);
|
|
64432
|
+
}
|
|
64030
64433
|
}
|
|
64031
|
-
|
|
64032
|
-
|
|
64033
|
-
|
|
64034
|
-
|
|
64434
|
+
} else {
|
|
64435
|
+
const pluginState = PLUGIN_KEY.getState(this.editor.state);
|
|
64436
|
+
const from = (_a = pluginState.topPos) != null ? _a : 0;
|
|
64437
|
+
const to = (_b = pluginState.bottomPos) != null ? _b : doc.content.size;
|
|
64438
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
64439
|
+
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
64440
|
+
const isEmpty = !node.isLeaf && isNodeEmpty(node);
|
|
64441
|
+
if (!node.type.isTextblock) {
|
|
64442
|
+
return this.options.includeChildren;
|
|
64035
64443
|
}
|
|
64036
|
-
|
|
64037
|
-
|
|
64038
|
-
|
|
64444
|
+
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
64445
|
+
const decoration = createPlaceholderDecoration({
|
|
64446
|
+
classes: { emptyEditor: this.options.emptyEditorClass, emptyNode: this.options.emptyNodeClass },
|
|
64039
64447
|
editor: this.editor,
|
|
64448
|
+
isEmptyDoc,
|
|
64449
|
+
dataAttribute,
|
|
64450
|
+
hasAnchor,
|
|
64451
|
+
placeholder: this.options.placeholder,
|
|
64040
64452
|
node,
|
|
64041
|
-
pos
|
|
64042
|
-
|
|
64043
|
-
|
|
64044
|
-
}
|
|
64045
|
-
|
|
64046
|
-
}
|
|
64047
|
-
|
|
64048
|
-
});
|
|
64453
|
+
pos
|
|
64454
|
+
});
|
|
64455
|
+
decorations.push(decoration);
|
|
64456
|
+
}
|
|
64457
|
+
return this.options.includeChildren;
|
|
64458
|
+
});
|
|
64459
|
+
}
|
|
64049
64460
|
return DecorationSet.create(doc, decorations);
|
|
64050
64461
|
}
|
|
64051
64462
|
}
|
|
@@ -72782,24 +73193,56 @@ focus outline in that case.
|
|
|
72782
73193
|
</template>
|
|
72783
73194
|
`;
|
|
72784
73195
|
|
|
73196
|
+
function createLazyMeasurementsView(count, flat, getItemKey) {
|
|
73197
|
+
const cache = new Array(count);
|
|
73198
|
+
return new Proxy(cache, {
|
|
73199
|
+
get(target, prop, receiver) {
|
|
73200
|
+
if (typeof prop === "string") {
|
|
73201
|
+
const c = prop.charCodeAt(0);
|
|
73202
|
+
if (c >= 48 && c <= 57) {
|
|
73203
|
+
const i = +prop;
|
|
73204
|
+
if (Number.isInteger(i) && i >= 0 && i < count) {
|
|
73205
|
+
let v = target[i];
|
|
73206
|
+
if (!v) {
|
|
73207
|
+
const s = flat[i * 2];
|
|
73208
|
+
v = target[i] = {
|
|
73209
|
+
index: i,
|
|
73210
|
+
key: getItemKey(i),
|
|
73211
|
+
start: s,
|
|
73212
|
+
size: flat[i * 2 + 1],
|
|
73213
|
+
end: s + flat[i * 2 + 1],
|
|
73214
|
+
lane: 0
|
|
73215
|
+
};
|
|
73216
|
+
}
|
|
73217
|
+
return v;
|
|
73218
|
+
}
|
|
73219
|
+
}
|
|
73220
|
+
if (prop === "length") return count;
|
|
73221
|
+
}
|
|
73222
|
+
return Reflect.get(target, prop, receiver);
|
|
73223
|
+
}
|
|
73224
|
+
});
|
|
73225
|
+
}
|
|
73226
|
+
|
|
72785
73227
|
function memo(getDeps, fn, opts) {
|
|
72786
73228
|
let deps = opts.initialDeps ?? [];
|
|
72787
73229
|
let result;
|
|
72788
73230
|
let isInitial = true;
|
|
72789
73231
|
function memoizedFunction() {
|
|
72790
|
-
var _a
|
|
72791
|
-
|
|
72792
|
-
|
|
73232
|
+
var _a;
|
|
73233
|
+
const debugEnabled = !!opts.key && !!((_a = opts.debug) == null ? void 0 : _a.call(opts));
|
|
73234
|
+
let depTime = 0;
|
|
73235
|
+
if (debugEnabled) depTime = Date.now();
|
|
72793
73236
|
const newDeps = getDeps();
|
|
72794
73237
|
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
72795
73238
|
if (!depsChanged) {
|
|
72796
73239
|
return result;
|
|
72797
73240
|
}
|
|
72798
73241
|
deps = newDeps;
|
|
72799
|
-
let resultTime;
|
|
72800
|
-
if (
|
|
73242
|
+
let resultTime = 0;
|
|
73243
|
+
if (debugEnabled) resultTime = Date.now();
|
|
72801
73244
|
result = fn(...newDeps);
|
|
72802
|
-
if (
|
|
73245
|
+
if (debugEnabled) {
|
|
72803
73246
|
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
72804
73247
|
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
72805
73248
|
const resultFpsPercentage = resultEndTime / 16;
|
|
@@ -72849,6 +73292,14 @@ focus outline in that case.
|
|
|
72849
73292
|
};
|
|
72850
73293
|
};
|
|
72851
73294
|
|
|
73295
|
+
let _isIOSResult;
|
|
73296
|
+
const isIOSWebKit = () => {
|
|
73297
|
+
if (_isIOSResult !== void 0) return _isIOSResult;
|
|
73298
|
+
if (typeof navigator === "undefined") return _isIOSResult = false;
|
|
73299
|
+
if (/iP(hone|od|ad)/.test(navigator.userAgent)) return _isIOSResult = true;
|
|
73300
|
+
const mtp = navigator.maxTouchPoints;
|
|
73301
|
+
return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
|
|
73302
|
+
};
|
|
72852
73303
|
const getRect = (element) => {
|
|
72853
73304
|
const { offsetWidth, offsetHeight } = element;
|
|
72854
73305
|
return { width: offsetWidth, height: offsetHeight };
|
|
@@ -72857,9 +73308,10 @@ focus outline in that case.
|
|
|
72857
73308
|
const defaultRangeExtractor = (range) => {
|
|
72858
73309
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
72859
73310
|
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
72860
|
-
const
|
|
72861
|
-
|
|
72862
|
-
|
|
73311
|
+
const len = end - start + 1;
|
|
73312
|
+
const arr = new Array(len);
|
|
73313
|
+
for (let i = 0; i < len; i++) {
|
|
73314
|
+
arr[i] = start + i;
|
|
72863
73315
|
}
|
|
72864
73316
|
return arr;
|
|
72865
73317
|
};
|
|
@@ -72904,7 +73356,7 @@ focus outline in that case.
|
|
|
72904
73356
|
passive: true
|
|
72905
73357
|
};
|
|
72906
73358
|
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
72907
|
-
const
|
|
73359
|
+
const observeOffset = (instance, cb, readOffset) => {
|
|
72908
73360
|
const element = instance.scrollElement;
|
|
72909
73361
|
if (!element) {
|
|
72910
73362
|
return;
|
|
@@ -72913,24 +73365,21 @@ focus outline in that case.
|
|
|
72913
73365
|
if (!targetWindow) {
|
|
72914
73366
|
return;
|
|
72915
73367
|
}
|
|
73368
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
72916
73369
|
let offset = 0;
|
|
72917
|
-
const fallback =
|
|
73370
|
+
const fallback = registerScrollendEvent ? null : debounce(
|
|
72918
73371
|
targetWindow,
|
|
72919
|
-
() =>
|
|
72920
|
-
cb(offset, false);
|
|
72921
|
-
},
|
|
73372
|
+
() => cb(offset, false),
|
|
72922
73373
|
instance.options.isScrollingResetDelay
|
|
72923
73374
|
);
|
|
72924
73375
|
const createHandler = (isScrolling) => () => {
|
|
72925
|
-
|
|
72926
|
-
|
|
72927
|
-
fallback();
|
|
73376
|
+
offset = readOffset(element);
|
|
73377
|
+
fallback == null ? void 0 : fallback();
|
|
72928
73378
|
cb(offset, isScrolling);
|
|
72929
73379
|
};
|
|
72930
73380
|
const handler = createHandler(true);
|
|
72931
73381
|
const endHandler = createHandler(false);
|
|
72932
73382
|
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
72933
|
-
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
72934
73383
|
if (registerScrollendEvent) {
|
|
72935
73384
|
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
72936
73385
|
}
|
|
@@ -72941,6 +73390,10 @@ focus outline in that case.
|
|
|
72941
73390
|
}
|
|
72942
73391
|
};
|
|
72943
73392
|
};
|
|
73393
|
+
const observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
|
|
73394
|
+
const { horizontal, isRtl } = instance.options;
|
|
73395
|
+
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
73396
|
+
});
|
|
72944
73397
|
const measureElement = (element, entry, instance) => {
|
|
72945
73398
|
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
72946
73399
|
const box = entry.borderBoxSize[0];
|
|
@@ -72953,17 +73406,17 @@ focus outline in that case.
|
|
|
72953
73406
|
}
|
|
72954
73407
|
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
72955
73408
|
};
|
|
72956
|
-
const
|
|
73409
|
+
const scrollWithAdjustments = (offset, {
|
|
72957
73410
|
adjustments = 0,
|
|
72958
73411
|
behavior
|
|
72959
73412
|
}, instance) => {
|
|
72960
73413
|
var _a, _b;
|
|
72961
|
-
const toOffset = offset + adjustments;
|
|
72962
73414
|
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
72963
|
-
[instance.options.horizontal ? "left" : "top"]:
|
|
73415
|
+
[instance.options.horizontal ? "left" : "top"]: offset + adjustments,
|
|
72964
73416
|
behavior
|
|
72965
73417
|
});
|
|
72966
73418
|
};
|
|
73419
|
+
const elementScroll = scrollWithAdjustments;
|
|
72967
73420
|
let Virtualizer$1 = class Virtualizer {
|
|
72968
73421
|
constructor(opts) {
|
|
72969
73422
|
this.unsubs = [];
|
|
@@ -72972,16 +73425,24 @@ focus outline in that case.
|
|
|
72972
73425
|
this.isScrolling = false;
|
|
72973
73426
|
this.scrollState = null;
|
|
72974
73427
|
this.measurementsCache = [];
|
|
73428
|
+
this._flatMeasurements = null;
|
|
72975
73429
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
73430
|
+
this.itemSizeCacheVersion = 0;
|
|
72976
73431
|
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
72977
|
-
this.
|
|
73432
|
+
this.pendingMin = null;
|
|
72978
73433
|
this.prevLanes = void 0;
|
|
72979
73434
|
this.lanesChangedFlag = false;
|
|
72980
73435
|
this.lanesSettling = false;
|
|
73436
|
+
this.pendingScrollAnchor = null;
|
|
72981
73437
|
this.scrollRect = null;
|
|
72982
73438
|
this.scrollOffset = null;
|
|
72983
73439
|
this.scrollDirection = null;
|
|
72984
73440
|
this.scrollAdjustments = 0;
|
|
73441
|
+
this._iosDeferredAdjustment = 0;
|
|
73442
|
+
this._iosTouching = false;
|
|
73443
|
+
this._iosJustTouchEnded = false;
|
|
73444
|
+
this._iosTouchEndTimerId = null;
|
|
73445
|
+
this._intendedScrollOffset = null;
|
|
72985
73446
|
this.elementsCache = /* @__PURE__ */ new Map();
|
|
72986
73447
|
this.now = () => {
|
|
72987
73448
|
var _a, _b, _c;
|
|
@@ -73003,6 +73464,12 @@ focus outline in that case.
|
|
|
73003
73464
|
const index = this.indexFromElement(node);
|
|
73004
73465
|
if (!node.isConnected) {
|
|
73005
73466
|
this.observer.unobserve(node);
|
|
73467
|
+
for (const [cacheKey, cachedNode] of this.elementsCache) {
|
|
73468
|
+
if (cachedNode === node) {
|
|
73469
|
+
this.elementsCache.delete(cacheKey);
|
|
73470
|
+
break;
|
|
73471
|
+
}
|
|
73472
|
+
}
|
|
73006
73473
|
return;
|
|
73007
73474
|
}
|
|
73008
73475
|
if (this.shouldMeasureDuringScroll(index)) {
|
|
@@ -73034,10 +73501,8 @@ focus outline in that case.
|
|
|
73034
73501
|
})();
|
|
73035
73502
|
this.range = null;
|
|
73036
73503
|
this.setOptions = (opts2) => {
|
|
73037
|
-
|
|
73038
|
-
|
|
73039
|
-
});
|
|
73040
|
-
this.options = {
|
|
73504
|
+
var _a, _b;
|
|
73505
|
+
const merged = {
|
|
73041
73506
|
debug: false,
|
|
73042
73507
|
initialOffset: 0,
|
|
73043
73508
|
overscan: 1,
|
|
@@ -73057,14 +73522,50 @@ focus outline in that case.
|
|
|
73057
73522
|
indexAttribute: "data-index",
|
|
73058
73523
|
initialMeasurementsCache: [],
|
|
73059
73524
|
lanes: 1,
|
|
73525
|
+
anchorTo: "start",
|
|
73526
|
+
followOnAppend: false,
|
|
73527
|
+
scrollEndThreshold: 1,
|
|
73060
73528
|
isScrollingResetDelay: 150,
|
|
73061
73529
|
enabled: true,
|
|
73062
73530
|
isRtl: false,
|
|
73063
73531
|
useScrollendEvent: false,
|
|
73064
73532
|
useAnimationFrameWithResizeObserver: false,
|
|
73065
|
-
laneAssignmentMode: "estimate"
|
|
73066
|
-
...opts2
|
|
73533
|
+
laneAssignmentMode: "estimate"
|
|
73067
73534
|
};
|
|
73535
|
+
for (const key in opts2) {
|
|
73536
|
+
const v = opts2[key];
|
|
73537
|
+
if (v !== void 0) merged[key] = v;
|
|
73538
|
+
}
|
|
73539
|
+
const prevOptions = this.options;
|
|
73540
|
+
let anchor = null;
|
|
73541
|
+
let followOnAppend = null;
|
|
73542
|
+
if (prevOptions !== void 0 && prevOptions.enabled && merged.enabled && merged.anchorTo === "end" && this.scrollElement !== null) {
|
|
73543
|
+
const prevCount = prevOptions.count;
|
|
73544
|
+
const nextCount = merged.count;
|
|
73545
|
+
const measurements = this.getMeasurements();
|
|
73546
|
+
const prevFirstKey = prevCount > 0 ? ((_a = measurements[0]) == null ? void 0 : _a.key) ?? prevOptions.getItemKey(0) : null;
|
|
73547
|
+
const prevLastKey = prevCount > 0 ? ((_b = measurements[prevCount - 1]) == null ? void 0 : _b.key) ?? prevOptions.getItemKey(prevCount - 1) : null;
|
|
73548
|
+
const didCountChange = nextCount !== prevCount;
|
|
73549
|
+
const didEdgeKeysChange = didCountChange || prevCount > 0 && nextCount > 0 && (merged.getItemKey(0) !== prevFirstKey || merged.getItemKey(nextCount - 1) !== prevLastKey);
|
|
73550
|
+
if (didEdgeKeysChange) {
|
|
73551
|
+
const item = prevCount > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0] : null;
|
|
73552
|
+
if (item) {
|
|
73553
|
+
anchor = [item.key, this.getScrollOffset() - item.start];
|
|
73554
|
+
}
|
|
73555
|
+
const behavior = merged.followOnAppend === true ? "auto" : merged.followOnAppend || null;
|
|
73556
|
+
if (behavior && nextCount > prevCount && this.isAtEnd(prevOptions.scrollEndThreshold) && (prevCount === 0 || merged.getItemKey(nextCount - 1) !== prevLastKey)) {
|
|
73557
|
+
followOnAppend = behavior;
|
|
73558
|
+
}
|
|
73559
|
+
}
|
|
73560
|
+
}
|
|
73561
|
+
this.options = merged;
|
|
73562
|
+
if (anchor || followOnAppend) {
|
|
73563
|
+
this.pendingScrollAnchor = [
|
|
73564
|
+
(anchor == null ? void 0 : anchor[0]) ?? null,
|
|
73565
|
+
(anchor == null ? void 0 : anchor[1]) ?? 0,
|
|
73566
|
+
followOnAppend
|
|
73567
|
+
];
|
|
73568
|
+
}
|
|
73068
73569
|
};
|
|
73069
73570
|
this.notify = (sync) => {
|
|
73070
73571
|
var _a, _b;
|
|
@@ -73135,21 +73636,104 @@ focus outline in that case.
|
|
|
73135
73636
|
);
|
|
73136
73637
|
this.unsubs.push(
|
|
73137
73638
|
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
73639
|
+
if (this._intendedScrollOffset !== null && Math.abs(offset - this._intendedScrollOffset) < 1.5) {
|
|
73640
|
+
offset = this._intendedScrollOffset;
|
|
73641
|
+
}
|
|
73642
|
+
this._intendedScrollOffset = null;
|
|
73138
73643
|
this.scrollAdjustments = 0;
|
|
73139
73644
|
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
73140
73645
|
this.scrollOffset = offset;
|
|
73141
73646
|
this.isScrolling = isScrolling;
|
|
73647
|
+
this._flushIosDeferredIfReady();
|
|
73142
73648
|
if (this.scrollState) {
|
|
73143
73649
|
this.scheduleScrollReconcile();
|
|
73144
73650
|
}
|
|
73145
73651
|
this.maybeNotify();
|
|
73146
73652
|
})
|
|
73147
73653
|
);
|
|
73654
|
+
if ("addEventListener" in this.scrollElement) {
|
|
73655
|
+
const scrollEl = this.scrollElement;
|
|
73656
|
+
const onTouchStart = () => {
|
|
73657
|
+
this._iosTouching = true;
|
|
73658
|
+
this._iosJustTouchEnded = false;
|
|
73659
|
+
if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
|
|
73660
|
+
this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
|
|
73661
|
+
this._iosTouchEndTimerId = null;
|
|
73662
|
+
}
|
|
73663
|
+
};
|
|
73664
|
+
const onTouchEnd = () => {
|
|
73665
|
+
this._iosTouching = false;
|
|
73666
|
+
if (!isIOSWebKit() || this.targetWindow == null) {
|
|
73667
|
+
return;
|
|
73668
|
+
}
|
|
73669
|
+
this._iosJustTouchEnded = true;
|
|
73670
|
+
this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
|
|
73671
|
+
this._iosJustTouchEnded = false;
|
|
73672
|
+
this._iosTouchEndTimerId = null;
|
|
73673
|
+
this._flushIosDeferredIfReady();
|
|
73674
|
+
}, 150);
|
|
73675
|
+
};
|
|
73676
|
+
scrollEl.addEventListener(
|
|
73677
|
+
"touchstart",
|
|
73678
|
+
onTouchStart,
|
|
73679
|
+
addEventListenerOptions
|
|
73680
|
+
);
|
|
73681
|
+
scrollEl.addEventListener(
|
|
73682
|
+
"touchend",
|
|
73683
|
+
onTouchEnd,
|
|
73684
|
+
addEventListenerOptions
|
|
73685
|
+
);
|
|
73686
|
+
this.unsubs.push(() => {
|
|
73687
|
+
scrollEl.removeEventListener("touchstart", onTouchStart);
|
|
73688
|
+
scrollEl.removeEventListener("touchend", onTouchEnd);
|
|
73689
|
+
if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
|
|
73690
|
+
this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
|
|
73691
|
+
this._iosTouchEndTimerId = null;
|
|
73692
|
+
}
|
|
73693
|
+
});
|
|
73694
|
+
}
|
|
73148
73695
|
this._scrollToOffset(this.getScrollOffset(), {
|
|
73149
73696
|
adjustments: void 0,
|
|
73150
73697
|
behavior: void 0
|
|
73151
73698
|
});
|
|
73152
73699
|
}
|
|
73700
|
+
const anchor = this.pendingScrollAnchor;
|
|
73701
|
+
this.pendingScrollAnchor = null;
|
|
73702
|
+
if (anchor && this.scrollElement && this.options.enabled) {
|
|
73703
|
+
const [key, offset, followOnAppend] = anchor;
|
|
73704
|
+
if (key !== null) {
|
|
73705
|
+
const { count, getItemKey } = this.options;
|
|
73706
|
+
let index = 0;
|
|
73707
|
+
while (index < count && getItemKey(index) !== key) {
|
|
73708
|
+
index++;
|
|
73709
|
+
}
|
|
73710
|
+
const item = index < count ? this.getMeasurements()[index] : void 0;
|
|
73711
|
+
if (item) {
|
|
73712
|
+
const delta = item.start + offset - this.getScrollOffset();
|
|
73713
|
+
if (!approxEqual(delta, 0)) {
|
|
73714
|
+
this.applyScrollAdjustment(delta);
|
|
73715
|
+
}
|
|
73716
|
+
}
|
|
73717
|
+
}
|
|
73718
|
+
if (followOnAppend) {
|
|
73719
|
+
this.scrollToEnd({ behavior: followOnAppend });
|
|
73720
|
+
}
|
|
73721
|
+
}
|
|
73722
|
+
};
|
|
73723
|
+
this._flushIosDeferredIfReady = () => {
|
|
73724
|
+
if (this._iosDeferredAdjustment === 0) return;
|
|
73725
|
+
if (this.isScrolling) return;
|
|
73726
|
+
if (this._iosTouching) return;
|
|
73727
|
+
if (this._iosJustTouchEnded) return;
|
|
73728
|
+
const cur = this.getScrollOffset();
|
|
73729
|
+
const max = this.getMaxScrollOffset();
|
|
73730
|
+
if (cur < 0 || cur > max) return;
|
|
73731
|
+
const delta = this._iosDeferredAdjustment;
|
|
73732
|
+
this._iosDeferredAdjustment = 0;
|
|
73733
|
+
this._scrollToOffset(cur, {
|
|
73734
|
+
adjustments: this.scrollAdjustments += delta,
|
|
73735
|
+
behavior: void 0
|
|
73736
|
+
});
|
|
73153
73737
|
};
|
|
73154
73738
|
this.rafId = null;
|
|
73155
73739
|
this.getSize = () => {
|
|
@@ -73211,7 +73795,7 @@ focus outline in that case.
|
|
|
73211
73795
|
this.lanesChangedFlag = true;
|
|
73212
73796
|
}
|
|
73213
73797
|
this.prevLanes = lanes;
|
|
73214
|
-
this.
|
|
73798
|
+
this.pendingMin = null;
|
|
73215
73799
|
return {
|
|
73216
73800
|
count,
|
|
73217
73801
|
paddingStart,
|
|
@@ -73227,7 +73811,7 @@ focus outline in that case.
|
|
|
73227
73811
|
}
|
|
73228
73812
|
);
|
|
73229
73813
|
this.getMeasurements = memo(
|
|
73230
|
-
() => [this.getMeasurementOptions(), this.
|
|
73814
|
+
() => [this.getMeasurementOptions(), this.itemSizeCacheVersion],
|
|
73231
73815
|
({
|
|
73232
73816
|
count,
|
|
73233
73817
|
paddingStart,
|
|
@@ -73236,7 +73820,8 @@ focus outline in that case.
|
|
|
73236
73820
|
enabled,
|
|
73237
73821
|
lanes,
|
|
73238
73822
|
laneAssignmentMode
|
|
73239
|
-
},
|
|
73823
|
+
}, _itemSizeCacheVersion) => {
|
|
73824
|
+
const itemSizeCache = this.itemSizeCache;
|
|
73240
73825
|
if (!enabled) {
|
|
73241
73826
|
this.measurementsCache = [];
|
|
73242
73827
|
this.itemSizeCache.clear();
|
|
@@ -73256,7 +73841,7 @@ focus outline in that case.
|
|
|
73256
73841
|
this.measurementsCache = [];
|
|
73257
73842
|
this.itemSizeCache.clear();
|
|
73258
73843
|
this.laneAssignments.clear();
|
|
73259
|
-
this.
|
|
73844
|
+
this.pendingMin = null;
|
|
73260
73845
|
}
|
|
73261
73846
|
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
73262
73847
|
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
@@ -73264,11 +73849,40 @@ focus outline in that case.
|
|
|
73264
73849
|
this.itemSizeCache.set(item.key, item.size);
|
|
73265
73850
|
});
|
|
73266
73851
|
}
|
|
73267
|
-
const min = this.lanesSettling ? 0 : this.
|
|
73268
|
-
this.
|
|
73852
|
+
const min = this.lanesSettling ? 0 : this.pendingMin ?? 0;
|
|
73853
|
+
this.pendingMin = null;
|
|
73269
73854
|
if (this.lanesSettling && this.measurementsCache.length === count) {
|
|
73270
73855
|
this.lanesSettling = false;
|
|
73271
73856
|
}
|
|
73857
|
+
if (lanes === 1) {
|
|
73858
|
+
const gap = this.options.gap;
|
|
73859
|
+
const need = count * 2;
|
|
73860
|
+
let flat = this._flatMeasurements;
|
|
73861
|
+
if (!flat || flat.length < need) {
|
|
73862
|
+
const next = new Float64Array(need);
|
|
73863
|
+
if (flat && min > 0) next.set(flat.subarray(0, min * 2));
|
|
73864
|
+
flat = next;
|
|
73865
|
+
this._flatMeasurements = flat;
|
|
73866
|
+
}
|
|
73867
|
+
let runningStart;
|
|
73868
|
+
if (min === 0) {
|
|
73869
|
+
runningStart = paddingStart + scrollMargin;
|
|
73870
|
+
} else {
|
|
73871
|
+
const prevIdx = min - 1;
|
|
73872
|
+
runningStart = flat[prevIdx * 2] + flat[prevIdx * 2 + 1] + gap;
|
|
73873
|
+
}
|
|
73874
|
+
for (let i = min; i < count; i++) {
|
|
73875
|
+
const key = getItemKey(i);
|
|
73876
|
+
const measuredSize = itemSizeCache.get(key);
|
|
73877
|
+
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
73878
|
+
flat[i * 2] = runningStart;
|
|
73879
|
+
flat[i * 2 + 1] = size;
|
|
73880
|
+
runningStart += size + gap;
|
|
73881
|
+
}
|
|
73882
|
+
const view = createLazyMeasurementsView(count, flat, getItemKey);
|
|
73883
|
+
this.measurementsCache = view;
|
|
73884
|
+
return view;
|
|
73885
|
+
}
|
|
73272
73886
|
const measurements = this.measurementsCache.slice(0, min);
|
|
73273
73887
|
const laneLastIndex = new Array(lanes).fill(
|
|
73274
73888
|
void 0
|
|
@@ -73331,7 +73945,11 @@ focus outline in that case.
|
|
|
73331
73945
|
measurements,
|
|
73332
73946
|
outerSize,
|
|
73333
73947
|
scrollOffset,
|
|
73334
|
-
lanes
|
|
73948
|
+
lanes,
|
|
73949
|
+
// Pass the typed array so binary search + forward-walk can
|
|
73950
|
+
// read start/end directly from Float64Array, skipping the
|
|
73951
|
+
// Proxy traps that materialize a full VirtualItem per probe.
|
|
73952
|
+
flat: lanes === 1 && this._flatMeasurements != null ? this._flatMeasurements : null
|
|
73335
73953
|
}) : null;
|
|
73336
73954
|
},
|
|
73337
73955
|
{
|
|
@@ -73426,23 +74044,60 @@ focus outline in that case.
|
|
|
73426
74044
|
}
|
|
73427
74045
|
};
|
|
73428
74046
|
this.resizeItem = (index, size) => {
|
|
73429
|
-
var _a;
|
|
73430
|
-
|
|
73431
|
-
|
|
73432
|
-
|
|
74047
|
+
var _a, _b;
|
|
74048
|
+
if (index < 0 || index >= this.options.count) return;
|
|
74049
|
+
let cachedSize;
|
|
74050
|
+
let itemStart;
|
|
74051
|
+
let key;
|
|
74052
|
+
const flat = this._flatMeasurements;
|
|
74053
|
+
if (this.options.lanes === 1 && flat !== null) {
|
|
74054
|
+
key = this.options.getItemKey(index);
|
|
74055
|
+
itemStart = flat[index * 2];
|
|
74056
|
+
cachedSize = flat[index * 2 + 1];
|
|
74057
|
+
} else {
|
|
74058
|
+
const item = this.measurementsCache[index];
|
|
74059
|
+
if (!item) return;
|
|
74060
|
+
key = item.key;
|
|
74061
|
+
itemStart = item.start;
|
|
74062
|
+
cachedSize = item.size;
|
|
74063
|
+
}
|
|
74064
|
+
const itemSize = this.itemSizeCache.get(key) ?? cachedSize;
|
|
73433
74065
|
const delta = size - itemSize;
|
|
73434
74066
|
if (delta !== 0) {
|
|
73435
|
-
|
|
73436
|
-
|
|
73437
|
-
|
|
73438
|
-
|
|
73439
|
-
|
|
73440
|
-
|
|
73441
|
-
|
|
73442
|
-
|
|
74067
|
+
const wasAtEnd = this.options.anchorTo === "end" && ((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold;
|
|
74068
|
+
const prevTotalSize = wasAtEnd ? this.getTotalSize() : 0;
|
|
74069
|
+
const shouldAdjustScroll = ((_b = this.scrollState) == null ? void 0 : _b.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(
|
|
74070
|
+
// The callback expects a VirtualItem; build one lazily only
|
|
74071
|
+
// when the consumer actually supplied a custom predicate.
|
|
74072
|
+
this.measurementsCache[index] ?? {
|
|
74073
|
+
index,
|
|
74074
|
+
key,
|
|
74075
|
+
start: itemStart,
|
|
74076
|
+
size: cachedSize,
|
|
74077
|
+
end: itemStart + cachedSize,
|
|
74078
|
+
lane: 0
|
|
74079
|
+
},
|
|
74080
|
+
delta,
|
|
74081
|
+
this
|
|
74082
|
+
) : (
|
|
74083
|
+
// Default: adjust scrollTop only when the resize is an above-
|
|
74084
|
+
// viewport item AND we're not actively scrolling backward.
|
|
74085
|
+
// Adjusting during backward scroll fights the user's scroll
|
|
74086
|
+
// direction and produces the "items jump while scrolling up"
|
|
74087
|
+
// jank reported across many issues. Users who want the old
|
|
74088
|
+
// behavior can pass shouldAdjustScrollPositionOnItemSizeChange.
|
|
74089
|
+
itemStart < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
|
|
74090
|
+
));
|
|
74091
|
+
if (this.pendingMin === null || index < this.pendingMin) {
|
|
74092
|
+
this.pendingMin = index;
|
|
74093
|
+
}
|
|
74094
|
+
this.itemSizeCache.set(key, size);
|
|
74095
|
+
this.itemSizeCacheVersion++;
|
|
74096
|
+
if (wasAtEnd) {
|
|
74097
|
+
this.applyScrollAdjustment(this.getTotalSize() - prevTotalSize);
|
|
74098
|
+
} else if (shouldAdjustScroll) {
|
|
74099
|
+
this.applyScrollAdjustment(delta);
|
|
73443
74100
|
}
|
|
73444
|
-
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
73445
|
-
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
73446
74101
|
this.notify(false);
|
|
73447
74102
|
}
|
|
73448
74103
|
};
|
|
@@ -73467,14 +74122,15 @@ focus outline in that case.
|
|
|
73467
74122
|
if (measurements.length === 0) {
|
|
73468
74123
|
return void 0;
|
|
73469
74124
|
}
|
|
73470
|
-
|
|
73471
|
-
|
|
73472
|
-
|
|
73473
|
-
|
|
73474
|
-
|
|
73475
|
-
|
|
73476
|
-
|
|
74125
|
+
const flat = this._flatMeasurements;
|
|
74126
|
+
const useFlat = this.options.lanes === 1 && flat != null;
|
|
74127
|
+
const idx = findNearestBinarySearch(
|
|
74128
|
+
0,
|
|
74129
|
+
measurements.length - 1,
|
|
74130
|
+
useFlat ? (i) => flat[i * 2] : (i) => notUndefined(measurements[i]).start,
|
|
74131
|
+
offset
|
|
73477
74132
|
);
|
|
74133
|
+
return notUndefined(measurements[idx]);
|
|
73478
74134
|
};
|
|
73479
74135
|
this.getMaxScrollOffset = () => {
|
|
73480
74136
|
if (!this.scrollElement) return 0;
|
|
@@ -73485,6 +74141,18 @@ focus outline in that case.
|
|
|
73485
74141
|
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
73486
74142
|
}
|
|
73487
74143
|
};
|
|
74144
|
+
this.getVirtualDistanceFromEnd = () => {
|
|
74145
|
+
return Math.max(
|
|
74146
|
+
this.getTotalSize() - this.getSize() - this.getScrollOffset(),
|
|
74147
|
+
0
|
|
74148
|
+
);
|
|
74149
|
+
};
|
|
74150
|
+
this.getDistanceFromEnd = () => {
|
|
74151
|
+
return Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0);
|
|
74152
|
+
};
|
|
74153
|
+
this.isAtEnd = (threshold = this.options.scrollEndThreshold) => {
|
|
74154
|
+
return this.getDistanceFromEnd() <= threshold;
|
|
74155
|
+
};
|
|
73488
74156
|
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
73489
74157
|
if (!this.scrollElement) return 0;
|
|
73490
74158
|
const size = this.getSize();
|
|
@@ -73574,6 +74242,18 @@ focus outline in that case.
|
|
|
73574
74242
|
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
73575
74243
|
this.scheduleScrollReconcile();
|
|
73576
74244
|
};
|
|
74245
|
+
this.scrollToEnd = ({ behavior = "auto" } = {}) => {
|
|
74246
|
+
if (this.options.count > 0) {
|
|
74247
|
+
this.scrollToIndex(this.options.count - 1, {
|
|
74248
|
+
align: "end",
|
|
74249
|
+
behavior
|
|
74250
|
+
});
|
|
74251
|
+
return;
|
|
74252
|
+
}
|
|
74253
|
+
this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), {
|
|
74254
|
+
behavior
|
|
74255
|
+
});
|
|
74256
|
+
};
|
|
73577
74257
|
this.getTotalSize = () => {
|
|
73578
74258
|
var _a;
|
|
73579
74259
|
const measurements = this.getMeasurements();
|
|
@@ -73581,7 +74261,13 @@ focus outline in that case.
|
|
|
73581
74261
|
if (measurements.length === 0) {
|
|
73582
74262
|
end = this.options.paddingStart;
|
|
73583
74263
|
} else if (this.options.lanes === 1) {
|
|
73584
|
-
|
|
74264
|
+
const lastIdx = measurements.length - 1;
|
|
74265
|
+
const flat = this._flatMeasurements;
|
|
74266
|
+
if (flat != null) {
|
|
74267
|
+
end = flat[lastIdx * 2] + flat[lastIdx * 2 + 1];
|
|
74268
|
+
} else {
|
|
74269
|
+
end = ((_a = measurements[lastIdx]) == null ? void 0 : _a.end) ?? 0;
|
|
74270
|
+
}
|
|
73585
74271
|
} else {
|
|
73586
74272
|
const endByLane = Array(this.options.lanes).fill(null);
|
|
73587
74273
|
let endIndex = measurements.length - 1;
|
|
@@ -73599,19 +74285,54 @@ focus outline in that case.
|
|
|
73599
74285
|
0
|
|
73600
74286
|
);
|
|
73601
74287
|
};
|
|
74288
|
+
this.takeSnapshot = () => {
|
|
74289
|
+
const snapshot = [];
|
|
74290
|
+
if (this.itemSizeCache.size === 0) return snapshot;
|
|
74291
|
+
const m = this.getMeasurements();
|
|
74292
|
+
for (const item of m) {
|
|
74293
|
+
if (item && this.itemSizeCache.has(item.key)) {
|
|
74294
|
+
snapshot.push({
|
|
74295
|
+
index: item.index,
|
|
74296
|
+
key: item.key,
|
|
74297
|
+
start: item.start,
|
|
74298
|
+
size: item.size,
|
|
74299
|
+
end: item.end,
|
|
74300
|
+
lane: item.lane
|
|
74301
|
+
});
|
|
74302
|
+
}
|
|
74303
|
+
}
|
|
74304
|
+
return snapshot;
|
|
74305
|
+
};
|
|
73602
74306
|
this._scrollToOffset = (offset, {
|
|
73603
74307
|
adjustments,
|
|
73604
74308
|
behavior
|
|
73605
74309
|
}) => {
|
|
74310
|
+
this._intendedScrollOffset = offset + (adjustments ?? 0);
|
|
73606
74311
|
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
73607
74312
|
};
|
|
73608
74313
|
this.measure = () => {
|
|
73609
|
-
this.
|
|
73610
|
-
this.
|
|
74314
|
+
this.pendingMin = null;
|
|
74315
|
+
this.itemSizeCache.clear();
|
|
74316
|
+
this.laneAssignments.clear();
|
|
74317
|
+
this.itemSizeCacheVersion++;
|
|
73611
74318
|
this.notify(false);
|
|
73612
74319
|
};
|
|
73613
74320
|
this.setOptions(opts);
|
|
73614
74321
|
}
|
|
74322
|
+
applyScrollAdjustment(delta, behavior) {
|
|
74323
|
+
if (delta === 0) return;
|
|
74324
|
+
if (this.options.debug) {
|
|
74325
|
+
console.info("correction", delta);
|
|
74326
|
+
}
|
|
74327
|
+
if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
|
|
74328
|
+
this._iosDeferredAdjustment += delta;
|
|
74329
|
+
} else {
|
|
74330
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
74331
|
+
adjustments: this.scrollAdjustments += delta,
|
|
74332
|
+
behavior
|
|
74333
|
+
});
|
|
74334
|
+
}
|
|
74335
|
+
}
|
|
73615
74336
|
scheduleScrollReconcile() {
|
|
73616
74337
|
if (!this.targetWindow) {
|
|
73617
74338
|
this.scrollState = null;
|
|
@@ -73639,17 +74360,28 @@ focus outline in that case.
|
|
|
73639
74360
|
if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
|
|
73640
74361
|
this.scrollState.stableFrames++;
|
|
73641
74362
|
if (this.scrollState.stableFrames >= STABLE_FRAMES) {
|
|
74363
|
+
if (this.getScrollOffset() !== targetOffset) {
|
|
74364
|
+
this._scrollToOffset(targetOffset, {
|
|
74365
|
+
adjustments: void 0,
|
|
74366
|
+
behavior: "auto"
|
|
74367
|
+
});
|
|
74368
|
+
}
|
|
73642
74369
|
this.scrollState = null;
|
|
73643
74370
|
return;
|
|
73644
74371
|
}
|
|
73645
74372
|
} else {
|
|
73646
74373
|
this.scrollState.stableFrames = 0;
|
|
73647
74374
|
if (targetChanged) {
|
|
74375
|
+
const viewport = this.getSize() || 600;
|
|
74376
|
+
const distance = Math.abs(targetOffset - this.getScrollOffset());
|
|
74377
|
+
const keepSmooth = this.scrollState.behavior === "smooth" && distance > viewport;
|
|
73648
74378
|
this.scrollState.lastTargetOffset = targetOffset;
|
|
73649
|
-
|
|
74379
|
+
if (!keepSmooth) {
|
|
74380
|
+
this.scrollState.behavior = "auto";
|
|
74381
|
+
}
|
|
73650
74382
|
this._scrollToOffset(targetOffset, {
|
|
73651
74383
|
adjustments: void 0,
|
|
73652
|
-
behavior: "auto"
|
|
74384
|
+
behavior: keepSmooth ? "smooth" : "auto"
|
|
73653
74385
|
});
|
|
73654
74386
|
}
|
|
73655
74387
|
}
|
|
@@ -73678,25 +74410,22 @@ focus outline in that case.
|
|
|
73678
74410
|
measurements,
|
|
73679
74411
|
outerSize,
|
|
73680
74412
|
scrollOffset,
|
|
73681
|
-
lanes
|
|
74413
|
+
lanes,
|
|
74414
|
+
flat
|
|
73682
74415
|
}) {
|
|
73683
74416
|
const lastIndex = measurements.length - 1;
|
|
73684
|
-
const
|
|
74417
|
+
const getStart = flat ? (index) => flat[index * 2] : (index) => measurements[index].start;
|
|
74418
|
+
const getEnd = flat ? (index) => flat[index * 2] + flat[index * 2 + 1] : (index) => measurements[index].end;
|
|
73685
74419
|
if (measurements.length <= lanes) {
|
|
73686
74420
|
return {
|
|
73687
74421
|
startIndex: 0,
|
|
73688
74422
|
endIndex: lastIndex
|
|
73689
74423
|
};
|
|
73690
74424
|
}
|
|
73691
|
-
let startIndex = findNearestBinarySearch(
|
|
73692
|
-
0,
|
|
73693
|
-
lastIndex,
|
|
73694
|
-
getOffset,
|
|
73695
|
-
scrollOffset
|
|
73696
|
-
);
|
|
74425
|
+
let startIndex = findNearestBinarySearch(0, lastIndex, getStart, scrollOffset);
|
|
73697
74426
|
let endIndex = startIndex;
|
|
73698
74427
|
if (lanes === 1) {
|
|
73699
|
-
while (endIndex < lastIndex &&
|
|
74428
|
+
while (endIndex < lastIndex && getEnd(endIndex) < scrollOffset + outerSize) {
|
|
73700
74429
|
endIndex++;
|
|
73701
74430
|
}
|
|
73702
74431
|
} else if (lanes > 1) {
|