@ni/nimble-components 35.9.1 → 35.9.3
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.
- package/dist/all-components-bundle.js +985 -259
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +3011 -2907
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +243 -243
- package/dist/custom-elements.md +50 -50
- package/package.json +4 -4
|
@@ -18379,7 +18379,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
|
|
|
18379
18379
|
};
|
|
18380
18380
|
const arrowRightThin16X16 = {
|
|
18381
18381
|
name: 'arrow_right_thin_16_x_16',
|
|
18382
|
-
data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m7.
|
|
18382
|
+
data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m7.97 4.37-.68 1.12 3.09 1.86H2v1.3h8.38l-3.09 1.86.68 1.12L14 8z" class="cls-1"/></svg>`,
|
|
18383
18383
|
};
|
|
18384
18384
|
const arrowRightToLine16X16 = {
|
|
18385
18385
|
name: 'arrow_right_to_line_16_x_16',
|
|
@@ -29156,7 +29156,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29156
29156
|
return Fragment.empty;
|
|
29157
29157
|
if (!Array.isArray(value))
|
|
29158
29158
|
throw new RangeError("Invalid input for Fragment.fromJSON");
|
|
29159
|
-
return
|
|
29159
|
+
return Fragment.fromArray(value.map(schema.nodeFromJSON));
|
|
29160
29160
|
}
|
|
29161
29161
|
/**
|
|
29162
29162
|
Build a fragment from an array of nodes. Ensures that adjacent
|
|
@@ -29390,17 +29390,6 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29390
29390
|
*/
|
|
29391
29391
|
class ReplaceError extends Error {
|
|
29392
29392
|
}
|
|
29393
|
-
/*
|
|
29394
|
-
ReplaceError = function(this: any, message: string) {
|
|
29395
|
-
let err = Error.call(this, message)
|
|
29396
|
-
;(err as any).__proto__ = ReplaceError.prototype
|
|
29397
|
-
return err
|
|
29398
|
-
} as any
|
|
29399
|
-
|
|
29400
|
-
ReplaceError.prototype = Object.create(Error.prototype)
|
|
29401
|
-
ReplaceError.prototype.constructor = ReplaceError
|
|
29402
|
-
ReplaceError.prototype.name = "ReplaceError"
|
|
29403
|
-
*/
|
|
29404
29393
|
/**
|
|
29405
29394
|
A slice represents a piece cut out of a larger document. It
|
|
29406
29395
|
stores not only a fragment, but also the depth up to which nodes on
|
|
@@ -29446,7 +29435,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29446
29435
|
@internal
|
|
29447
29436
|
*/
|
|
29448
29437
|
insertAt(pos, fragment) {
|
|
29449
|
-
let content = insertInto(this.content, pos + this.openStart, fragment);
|
|
29438
|
+
let content = insertInto(this.content, pos + this.openStart, fragment, this.openStart + 1, this.openEnd + 1);
|
|
29450
29439
|
return content && new Slice(content, this.openStart, this.openEnd);
|
|
29451
29440
|
}
|
|
29452
29441
|
/**
|
|
@@ -29520,14 +29509,14 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29520
29509
|
throw new RangeError("Removing non-flat range");
|
|
29521
29510
|
return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
|
|
29522
29511
|
}
|
|
29523
|
-
function insertInto(content, dist, insert, parent) {
|
|
29512
|
+
function insertInto(content, dist, insert, openStart, openEnd, parent) {
|
|
29524
29513
|
let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
|
|
29525
29514
|
if (offset == dist || child.isText) {
|
|
29526
|
-
if (parent && !parent.canReplace(index, index, insert))
|
|
29515
|
+
if (parent && openStart <= 0 && openEnd <= 0 && !parent.canReplace(index, index, insert))
|
|
29527
29516
|
return null;
|
|
29528
29517
|
return content.cut(0, dist).append(insert).append(content.cut(dist));
|
|
29529
29518
|
}
|
|
29530
|
-
let inner = insertInto(child.content, dist - offset - 1, insert, child);
|
|
29519
|
+
let inner = insertInto(child.content, dist - offset - 1, insert, index == 0 ? openStart - 1 : 0, index == content.childCount - 1 ? openEnd - 1 : 0, child);
|
|
29531
29520
|
return inner && content.replaceChild(index, child.copy(inner));
|
|
29532
29521
|
}
|
|
29533
29522
|
function replace$1($from, $to, slice) {
|
|
@@ -30057,10 +30046,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30057
30046
|
*/
|
|
30058
30047
|
forEach(f) { this.content.forEach(f); }
|
|
30059
30048
|
/**
|
|
30060
|
-
Invoke a callback for all descendant nodes recursively
|
|
30049
|
+
Invoke a callback for all descendant nodes recursively overlapping
|
|
30061
30050
|
the given two positions that are relative to start of this
|
|
30062
|
-
node's content.
|
|
30063
|
-
|
|
30051
|
+
node's content. This includes all ancestors of the nodes
|
|
30052
|
+
containing the two positions. The callback is invoked with the
|
|
30053
|
+
node, its position relative to the original node (method receiver),
|
|
30064
30054
|
its parent node, and its child index. When the callback returns
|
|
30065
30055
|
false for a given node, that node's children will not be
|
|
30066
30056
|
recursed over. The last parameter can be used to specify a
|
|
@@ -32148,6 +32138,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32148
32138
|
@internal
|
|
32149
32139
|
*/
|
|
32150
32140
|
serializeNodeInner(node, options) {
|
|
32141
|
+
if (node.isText)
|
|
32142
|
+
return doc$1(options).createTextNode(node.text);
|
|
32151
32143
|
let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
|
|
32152
32144
|
if (contentDOM) {
|
|
32153
32145
|
if (node.isLeaf)
|
|
@@ -32182,6 +32174,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32182
32174
|
return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
|
|
32183
32175
|
}
|
|
32184
32176
|
static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {
|
|
32177
|
+
// Kludge for backwards-compatibility with accidental original behavious
|
|
32178
|
+
if (typeof structure == "string")
|
|
32179
|
+
return { dom: doc.createTextNode(structure) };
|
|
32185
32180
|
return renderSpec(doc, structure, xmlNS, blockArraysIn);
|
|
32186
32181
|
}
|
|
32187
32182
|
/**
|
|
@@ -32253,11 +32248,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32253
32248
|
return result;
|
|
32254
32249
|
}
|
|
32255
32250
|
function renderSpec(doc, structure, xmlNS, blockArraysIn) {
|
|
32256
|
-
if (
|
|
32257
|
-
return { dom: doc.createTextNode(structure) };
|
|
32258
|
-
if (structure.nodeType != null)
|
|
32251
|
+
if (structure.nodeType == 1)
|
|
32259
32252
|
return { dom: structure };
|
|
32260
|
-
if (structure.dom && structure.dom.nodeType
|
|
32253
|
+
if (structure.dom && structure.dom.nodeType == 1)
|
|
32261
32254
|
return structure;
|
|
32262
32255
|
let tagName = structure[0], suspicious;
|
|
32263
32256
|
if (typeof tagName != "string")
|
|
@@ -32293,6 +32286,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32293
32286
|
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32294
32287
|
return { dom, contentDOM: dom };
|
|
32295
32288
|
}
|
|
32289
|
+
else if (typeof child == "string") {
|
|
32290
|
+
dom.appendChild(doc.createTextNode(child));
|
|
32291
|
+
}
|
|
32296
32292
|
else {
|
|
32297
32293
|
let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);
|
|
32298
32294
|
dom.appendChild(inner);
|
|
@@ -42773,8 +42769,44 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42773
42769
|
}
|
|
42774
42770
|
return true;
|
|
42775
42771
|
};
|
|
42772
|
+
|
|
42773
|
+
// src/commands/deleteSelection.ts
|
|
42774
|
+
var hasTextContent = (nodeSpec) => {
|
|
42775
|
+
if (!nodeSpec.content) {
|
|
42776
|
+
return false;
|
|
42777
|
+
}
|
|
42778
|
+
const textRegex = /^text(\*|\+)/;
|
|
42779
|
+
return textRegex.test(nodeSpec.content);
|
|
42780
|
+
};
|
|
42781
|
+
var expandSelectionForSide = ($pos, schema, side) => {
|
|
42782
|
+
if (!$pos.parent.isInline) {
|
|
42783
|
+
return $pos.pos;
|
|
42784
|
+
}
|
|
42785
|
+
if (side === "left" && $pos.pos > $pos.start() || side === "right" && $pos.pos < $pos.end()) {
|
|
42786
|
+
return $pos.pos;
|
|
42787
|
+
}
|
|
42788
|
+
const parentContent = schema.nodes[$pos.parent.type.name].spec;
|
|
42789
|
+
if (!hasTextContent(parentContent)) {
|
|
42790
|
+
return $pos.pos;
|
|
42791
|
+
}
|
|
42792
|
+
return side === "left" ? $pos.start() - 1 : $pos.end() + 1;
|
|
42793
|
+
};
|
|
42794
|
+
var expandSelectionForInlineText = ($from, $to, schema) => {
|
|
42795
|
+
const from = expandSelectionForSide($from, schema, "left");
|
|
42796
|
+
const to = expandSelectionForSide($to, schema, "right");
|
|
42797
|
+
return { from, to };
|
|
42798
|
+
};
|
|
42776
42799
|
var deleteSelection = () => ({ state, dispatch }) => {
|
|
42777
|
-
|
|
42800
|
+
const { $from, $to } = state.selection;
|
|
42801
|
+
if (state.selection.empty) {
|
|
42802
|
+
return false;
|
|
42803
|
+
}
|
|
42804
|
+
const { from, to } = expandSelectionForInlineText($from, $to, state.schema);
|
|
42805
|
+
if (dispatch) {
|
|
42806
|
+
state.tr.deleteRange(from, to).scrollIntoView();
|
|
42807
|
+
dispatch(state.tr);
|
|
42808
|
+
}
|
|
42809
|
+
return true;
|
|
42778
42810
|
};
|
|
42779
42811
|
|
|
42780
42812
|
// src/commands/enter.ts
|
|
@@ -45434,6 +45466,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45434
45466
|
});
|
|
45435
45467
|
extension.name = this.name;
|
|
45436
45468
|
extension.parent = this.parent;
|
|
45469
|
+
this.child = null;
|
|
45437
45470
|
return extension;
|
|
45438
45471
|
}
|
|
45439
45472
|
extend(extendedConfig = {}) {
|
|
@@ -45969,6 +46002,36 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
45969
46002
|
})
|
|
45970
46003
|
);
|
|
45971
46004
|
}
|
|
46005
|
+
/**
|
|
46006
|
+
* Destroy the extension manager and clean up all extension references
|
|
46007
|
+
* to prevent memory leaks through parent/child extension chains.
|
|
46008
|
+
*
|
|
46009
|
+
* Walks each extension's full parent chain and nulls every forward
|
|
46010
|
+
* `parent.child → current` link where the parent still points to the
|
|
46011
|
+
* current node. This breaks the retention path from module-scope
|
|
46012
|
+
* singleton roots through deep extend() chains.
|
|
46013
|
+
*
|
|
46014
|
+
* Only ancestor `.child` links matching the current chain are cleared.
|
|
46015
|
+
* The `.parent` pointer on ancestors is never touched — extensions
|
|
46016
|
+
* may be shared across live editors, so their own backward references
|
|
46017
|
+
* and non-matching forward links must remain intact.
|
|
46018
|
+
*/
|
|
46019
|
+
destroy() {
|
|
46020
|
+
this.extensions.forEach((extension) => {
|
|
46021
|
+
let current = extension;
|
|
46022
|
+
while (current.parent) {
|
|
46023
|
+
const parent = current.parent;
|
|
46024
|
+
if (parent.child === current) {
|
|
46025
|
+
parent.child = null;
|
|
46026
|
+
}
|
|
46027
|
+
current = parent;
|
|
46028
|
+
}
|
|
46029
|
+
});
|
|
46030
|
+
this.extensions = [];
|
|
46031
|
+
this.baseExtensions = [];
|
|
46032
|
+
this.schema = null;
|
|
46033
|
+
this.editor = null;
|
|
46034
|
+
}
|
|
45972
46035
|
/**
|
|
45973
46036
|
* Go through all extensions, create extension storages & setup marks
|
|
45974
46037
|
* & bind editor event listener.
|
|
@@ -46382,12 +46445,23 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
46382
46445
|
});
|
|
46383
46446
|
var Tabindex = Extension.create({
|
|
46384
46447
|
name: "tabindex",
|
|
46448
|
+
addOptions() {
|
|
46449
|
+
return {
|
|
46450
|
+
value: void 0
|
|
46451
|
+
};
|
|
46452
|
+
},
|
|
46385
46453
|
addProseMirrorPlugins() {
|
|
46386
46454
|
return [
|
|
46387
46455
|
new Plugin({
|
|
46388
46456
|
key: new PluginKey("tabindex"),
|
|
46389
46457
|
props: {
|
|
46390
|
-
attributes: () =>
|
|
46458
|
+
attributes: () => {
|
|
46459
|
+
var _a;
|
|
46460
|
+
if (!this.editor.isEditable && this.options.value === void 0) {
|
|
46461
|
+
return {};
|
|
46462
|
+
}
|
|
46463
|
+
return { tabindex: (_a = this.options.value) != null ? _a : "0" };
|
|
46464
|
+
}
|
|
46391
46465
|
}
|
|
46392
46466
|
})
|
|
46393
46467
|
];
|
|
@@ -46726,6 +46800,7 @@ img.ProseMirror-separator {
|
|
|
46726
46800
|
this.className = "tiptap";
|
|
46727
46801
|
this.editorView = null;
|
|
46728
46802
|
this.isFocused = false;
|
|
46803
|
+
this.destroyed = false;
|
|
46729
46804
|
/**
|
|
46730
46805
|
* The editor is considered initialized after the `create` event has been emitted.
|
|
46731
46806
|
*/
|
|
@@ -47017,7 +47092,7 @@ img.ProseMirror-separator {
|
|
|
47017
47092
|
* Creates an extension manager.
|
|
47018
47093
|
*/
|
|
47019
47094
|
createExtensionManager() {
|
|
47020
|
-
var _a, _b;
|
|
47095
|
+
var _a, _b, _c, _d;
|
|
47021
47096
|
const coreExtensions = this.options.enableCoreExtensions ? [
|
|
47022
47097
|
Editable,
|
|
47023
47098
|
ClipboardTextSerializer.configure({
|
|
@@ -47026,7 +47101,9 @@ img.ProseMirror-separator {
|
|
|
47026
47101
|
Commands,
|
|
47027
47102
|
FocusEvents,
|
|
47028
47103
|
Keymap,
|
|
47029
|
-
Tabindex
|
|
47104
|
+
Tabindex.configure({
|
|
47105
|
+
value: (_d = (_c = this.options.coreExtensionOptions) == null ? void 0 : _c.tabindex) == null ? void 0 : _d.value
|
|
47106
|
+
}),
|
|
47030
47107
|
Drop,
|
|
47031
47108
|
Paste,
|
|
47032
47109
|
Delete,
|
|
@@ -47263,9 +47340,18 @@ img.ProseMirror-separator {
|
|
|
47263
47340
|
* Destroy the editor.
|
|
47264
47341
|
*/
|
|
47265
47342
|
destroy() {
|
|
47343
|
+
if (this.destroyed) {
|
|
47344
|
+
return;
|
|
47345
|
+
}
|
|
47346
|
+
this.destroyed = true;
|
|
47266
47347
|
this.emit("destroy");
|
|
47267
47348
|
this.unmount();
|
|
47268
47349
|
this.removeAllListeners();
|
|
47350
|
+
this.extensionManager.destroy();
|
|
47351
|
+
this.extensionManager = null;
|
|
47352
|
+
this.schema = null;
|
|
47353
|
+
this.commandManager = null;
|
|
47354
|
+
this.extensionStorage = {};
|
|
47269
47355
|
}
|
|
47270
47356
|
/**
|
|
47271
47357
|
* Check if the editor is already destroyed.
|
|
@@ -47284,7 +47370,8 @@ img.ProseMirror-separator {
|
|
|
47284
47370
|
}
|
|
47285
47371
|
$pos(pos) {
|
|
47286
47372
|
const $pos = this.state.doc.resolve(pos);
|
|
47287
|
-
|
|
47373
|
+
const node = pos > 0 && $pos.nodeAfter && !$pos.nodeAfter.isText ? $pos.nodeAfter : null;
|
|
47374
|
+
return new NodePos($pos, this, false, node);
|
|
47288
47375
|
}
|
|
47289
47376
|
get $doc() {
|
|
47290
47377
|
return this.$pos(0);
|
|
@@ -49882,6 +49969,15 @@ ${indentedChild}`;
|
|
|
49882
49969
|
function decodeHTML(str, mode = DecodingMode.Legacy) {
|
|
49883
49970
|
return htmlDecoder(str, mode);
|
|
49884
49971
|
}
|
|
49972
|
+
/**
|
|
49973
|
+
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
|
|
49974
|
+
*
|
|
49975
|
+
* @param str The string to decode.
|
|
49976
|
+
* @returns The decoded string.
|
|
49977
|
+
*/
|
|
49978
|
+
function decodeHTMLStrict(str) {
|
|
49979
|
+
return htmlDecoder(str, DecodingMode.Strict);
|
|
49980
|
+
}
|
|
49885
49981
|
|
|
49886
49982
|
// Utilities
|
|
49887
49983
|
//
|
|
@@ -50061,6 +50157,10 @@ ${indentedChild}`;
|
|
|
50061
50157
|
return P.test(ch) || regex.test(ch)
|
|
50062
50158
|
}
|
|
50063
50159
|
|
|
50160
|
+
function isPunctCharCode (code) {
|
|
50161
|
+
return isPunctChar(fromCodePoint(code))
|
|
50162
|
+
}
|
|
50163
|
+
|
|
50064
50164
|
// Markdown ASCII punctuation characters.
|
|
50065
50165
|
//
|
|
50066
50166
|
// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
|
|
@@ -50122,6 +50222,7 @@ ${indentedChild}`;
|
|
|
50122
50222
|
// (remove this when node v10 is no longer supported).
|
|
50123
50223
|
//
|
|
50124
50224
|
if ('ẞ'.toLowerCase() === 'Ṿ') {
|
|
50225
|
+
/* c8 ignore next 2 */
|
|
50125
50226
|
str = str.replace(/ẞ/g, 'ß');
|
|
50126
50227
|
}
|
|
50127
50228
|
|
|
@@ -50160,6 +50261,28 @@ ${indentedChild}`;
|
|
|
50160
50261
|
return str.toLowerCase().toUpperCase()
|
|
50161
50262
|
}
|
|
50162
50263
|
|
|
50264
|
+
function isAsciiTrimmable (c) {
|
|
50265
|
+
return c === 0x20 || c === 0x09 || c === 0x0a || c === 0x0d
|
|
50266
|
+
}
|
|
50267
|
+
|
|
50268
|
+
// "Light" .trim() for blocks (headers, paragraphs), where unicode spaces
|
|
50269
|
+
// should be preserved.
|
|
50270
|
+
function asciiTrim (str) {
|
|
50271
|
+
let start = 0;
|
|
50272
|
+
for (; start < str.length; start++) {
|
|
50273
|
+
if (!isAsciiTrimmable(str.charCodeAt(start))) {
|
|
50274
|
+
break
|
|
50275
|
+
}
|
|
50276
|
+
}
|
|
50277
|
+
let end = str.length - 1;
|
|
50278
|
+
for (; end >= start; end--) {
|
|
50279
|
+
if (!isAsciiTrimmable(str.charCodeAt(end))) {
|
|
50280
|
+
break
|
|
50281
|
+
}
|
|
50282
|
+
}
|
|
50283
|
+
return str.slice(start, end + 1)
|
|
50284
|
+
}
|
|
50285
|
+
|
|
50163
50286
|
// Re-export libraries commonly used in both markdown-it and its plugins,
|
|
50164
50287
|
// so plugins won't have to depend on them explicitly, which reduces their
|
|
50165
50288
|
// bundled size (e.g. a browser build).
|
|
@@ -50169,6 +50292,7 @@ ${indentedChild}`;
|
|
|
50169
50292
|
var utils = /*#__PURE__*/Object.freeze({
|
|
50170
50293
|
__proto__: null,
|
|
50171
50294
|
arrayReplaceAt: arrayReplaceAt,
|
|
50295
|
+
asciiTrim: asciiTrim,
|
|
50172
50296
|
assign: assign$1,
|
|
50173
50297
|
escapeHtml: escapeHtml,
|
|
50174
50298
|
escapeRE: escapeRE$1,
|
|
@@ -50176,6 +50300,7 @@ ${indentedChild}`;
|
|
|
50176
50300
|
has: has,
|
|
50177
50301
|
isMdAsciiPunct: isMdAsciiPunct,
|
|
50178
50302
|
isPunctChar: isPunctChar,
|
|
50303
|
+
isPunctCharCode: isPunctCharCode,
|
|
50179
50304
|
isSpace: isSpace,
|
|
50180
50305
|
isString: isString$1,
|
|
50181
50306
|
isValidEntityCode: isValidEntityCode,
|
|
@@ -51539,14 +51664,36 @@ ${indentedChild}`;
|
|
|
51539
51664
|
const QUOTE_RE = /['"]/g;
|
|
51540
51665
|
const APOSTROPHE$1 = '\u2019'; /* ’ */
|
|
51541
51666
|
|
|
51542
|
-
function
|
|
51543
|
-
|
|
51667
|
+
function addReplacement (replacements, tokenIdx, pos, ch) {
|
|
51668
|
+
if (!replacements[tokenIdx]) {
|
|
51669
|
+
replacements[tokenIdx] = [];
|
|
51670
|
+
}
|
|
51671
|
+
|
|
51672
|
+
replacements[tokenIdx].push({ pos, ch });
|
|
51673
|
+
}
|
|
51674
|
+
|
|
51675
|
+
function applyReplacements (str, replacements) {
|
|
51676
|
+
let result = '';
|
|
51677
|
+
let lastPos = 0;
|
|
51678
|
+
|
|
51679
|
+
replacements.sort((a, b) => a.pos - b.pos);
|
|
51680
|
+
|
|
51681
|
+
for (let i = 0; i < replacements.length; i++) {
|
|
51682
|
+
const replacement = replacements[i];
|
|
51683
|
+
|
|
51684
|
+
result += str.slice(lastPos, replacement.pos) + replacement.ch;
|
|
51685
|
+
lastPos = replacement.pos + 1;
|
|
51686
|
+
}
|
|
51687
|
+
|
|
51688
|
+
return result + str.slice(lastPos)
|
|
51544
51689
|
}
|
|
51545
51690
|
|
|
51546
51691
|
function process_inlines (tokens, state) {
|
|
51547
51692
|
let j;
|
|
51548
51693
|
|
|
51549
51694
|
const stack = [];
|
|
51695
|
+
// token index -> list of replacements in the original token content
|
|
51696
|
+
const replacements = {};
|
|
51550
51697
|
|
|
51551
51698
|
for (let i = 0; i < tokens.length; i++) {
|
|
51552
51699
|
const token = tokens[i];
|
|
@@ -51560,9 +51707,9 @@ ${indentedChild}`;
|
|
|
51560
51707
|
|
|
51561
51708
|
if (token.type !== 'text') { continue }
|
|
51562
51709
|
|
|
51563
|
-
|
|
51710
|
+
const text = token.content;
|
|
51564
51711
|
let pos = 0;
|
|
51565
|
-
|
|
51712
|
+
const max = text.length;
|
|
51566
51713
|
|
|
51567
51714
|
/* eslint no-labels:0,block-scoped-var:0 */
|
|
51568
51715
|
OUTER:
|
|
@@ -51610,8 +51757,8 @@ ${indentedChild}`;
|
|
|
51610
51757
|
}
|
|
51611
51758
|
}
|
|
51612
51759
|
|
|
51613
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
51614
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
51760
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
51761
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
51615
51762
|
|
|
51616
51763
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
51617
51764
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
@@ -51654,7 +51801,7 @@ ${indentedChild}`;
|
|
|
51654
51801
|
if (!canOpen && !canClose) {
|
|
51655
51802
|
// middle of word
|
|
51656
51803
|
if (isSingle) {
|
|
51657
|
-
|
|
51804
|
+
addReplacement(replacements, i, t.index, APOSTROPHE$1);
|
|
51658
51805
|
}
|
|
51659
51806
|
continue
|
|
51660
51807
|
}
|
|
@@ -51677,18 +51824,8 @@ ${indentedChild}`;
|
|
|
51677
51824
|
closeQuote = state.md.options.quotes[1];
|
|
51678
51825
|
}
|
|
51679
51826
|
|
|
51680
|
-
|
|
51681
|
-
|
|
51682
|
-
// could mess up indices when quote length != 1
|
|
51683
|
-
token.content = replaceAt(token.content, t.index, closeQuote);
|
|
51684
|
-
tokens[item.token].content = replaceAt(
|
|
51685
|
-
tokens[item.token].content, item.pos, openQuote);
|
|
51686
|
-
|
|
51687
|
-
pos += closeQuote.length - 1;
|
|
51688
|
-
if (item.token === i) { pos += openQuote.length - 1; }
|
|
51689
|
-
|
|
51690
|
-
text = token.content;
|
|
51691
|
-
max = text.length;
|
|
51827
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
51828
|
+
addReplacement(replacements, item.token, item.pos, openQuote);
|
|
51692
51829
|
|
|
51693
51830
|
stack.length = j;
|
|
51694
51831
|
continue OUTER
|
|
@@ -51704,10 +51841,14 @@ ${indentedChild}`;
|
|
|
51704
51841
|
level: thisLevel
|
|
51705
51842
|
});
|
|
51706
51843
|
} else if (canClose && isSingle) {
|
|
51707
|
-
|
|
51844
|
+
addReplacement(replacements, i, t.index, APOSTROPHE$1);
|
|
51708
51845
|
}
|
|
51709
51846
|
}
|
|
51710
51847
|
}
|
|
51848
|
+
|
|
51849
|
+
Object.keys(replacements).forEach(function (tokenIdx) {
|
|
51850
|
+
tokens[tokenIdx].content = applyReplacements(tokens[tokenIdx].content, replacements[tokenIdx]);
|
|
51851
|
+
});
|
|
51711
51852
|
}
|
|
51712
51853
|
|
|
51713
51854
|
function smartquotes (state) {
|
|
@@ -53311,11 +53452,22 @@ ${indentedChild}`;
|
|
|
53311
53452
|
|
|
53312
53453
|
let nextLine = startLine + 1;
|
|
53313
53454
|
|
|
53455
|
+
// Block types 6 and 7 (the only ones whose end condition is a blank line)
|
|
53456
|
+
// have `/^$/` as their closing regexp. For all other types (1-5, e.g.
|
|
53457
|
+
// `<!--` comments), a blank line is regular content and must not terminate
|
|
53458
|
+
// the block - it ends only when its closing sequence is found.
|
|
53459
|
+
const endsOnBlankLine = HTML_SEQUENCES[i][1].test('');
|
|
53460
|
+
|
|
53314
53461
|
// If we are here - we detected HTML block.
|
|
53315
53462
|
// Let's roll down till block end.
|
|
53316
53463
|
if (!HTML_SEQUENCES[i][1].test(lineText)) {
|
|
53317
53464
|
for (; nextLine < endLine; nextLine++) {
|
|
53318
|
-
if (state.sCount[nextLine] < state.blkIndent) {
|
|
53465
|
+
if (state.sCount[nextLine] < state.blkIndent) {
|
|
53466
|
+
// An outdented blank line shouldn't end a block that doesn't end on a
|
|
53467
|
+
// blank line (e.g. a `<!--` comment inside a list item). Such blocks
|
|
53468
|
+
// must continue until their closing sequence regardless of indent.
|
|
53469
|
+
if (endsOnBlankLine || !state.isEmpty(nextLine)) { break }
|
|
53470
|
+
}
|
|
53319
53471
|
|
|
53320
53472
|
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
53321
53473
|
max = state.eMarks[nextLine];
|
|
@@ -53378,7 +53530,7 @@ ${indentedChild}`;
|
|
|
53378
53530
|
token_o.map = [startLine, state.line];
|
|
53379
53531
|
|
|
53380
53532
|
const token_i = state.push('inline', '', 0);
|
|
53381
|
-
token_i.content = state.src.slice(pos, max)
|
|
53533
|
+
token_i.content = asciiTrim(state.src.slice(pos, max));
|
|
53382
53534
|
token_i.map = [startLine, state.line];
|
|
53383
53535
|
token_i.children = [];
|
|
53384
53536
|
|
|
@@ -53390,6 +53542,7 @@ ${indentedChild}`;
|
|
|
53390
53542
|
|
|
53391
53543
|
// lheading (---, ===)
|
|
53392
53544
|
|
|
53545
|
+
|
|
53393
53546
|
function lheading (state, startLine, endLine/*, silent */) {
|
|
53394
53547
|
const terminatorRules = state.md.block.ruler.getRules('paragraph');
|
|
53395
53548
|
|
|
@@ -53447,10 +53600,11 @@ ${indentedChild}`;
|
|
|
53447
53600
|
|
|
53448
53601
|
if (!level) {
|
|
53449
53602
|
// Didn't find valid underline
|
|
53603
|
+
state.parentType = oldParentType;
|
|
53450
53604
|
return false
|
|
53451
53605
|
}
|
|
53452
53606
|
|
|
53453
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
53607
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
53454
53608
|
|
|
53455
53609
|
state.line = nextLine + 1;
|
|
53456
53610
|
|
|
@@ -53473,6 +53627,7 @@ ${indentedChild}`;
|
|
|
53473
53627
|
|
|
53474
53628
|
// Paragraph
|
|
53475
53629
|
|
|
53630
|
+
|
|
53476
53631
|
function paragraph (state, startLine, endLine) {
|
|
53477
53632
|
const terminatorRules = state.md.block.ruler.getRules('paragraph');
|
|
53478
53633
|
const oldParentType = state.parentType;
|
|
@@ -53499,7 +53654,7 @@ ${indentedChild}`;
|
|
|
53499
53654
|
if (terminate) { break }
|
|
53500
53655
|
}
|
|
53501
53656
|
|
|
53502
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
53657
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
53503
53658
|
|
|
53504
53659
|
state.line = nextLine;
|
|
53505
53660
|
|
|
@@ -53726,8 +53881,30 @@ ${indentedChild}`;
|
|
|
53726
53881
|
const max = this.posMax;
|
|
53727
53882
|
const marker = this.src.charCodeAt(start);
|
|
53728
53883
|
|
|
53729
|
-
//
|
|
53730
|
-
|
|
53884
|
+
// Astral characters below are combined manually, because .codePointAt()
|
|
53885
|
+
// does not guarantee numeric type output. And we don't wish JIT cache issues.
|
|
53886
|
+
// The broken surrogate pairs are evaluated as U+FFFD to prevent possible
|
|
53887
|
+
// crashes.
|
|
53888
|
+
|
|
53889
|
+
let lastChar;
|
|
53890
|
+
if (start === 0) {
|
|
53891
|
+
// treat beginning of the line as a whitespace
|
|
53892
|
+
lastChar = 0x20;
|
|
53893
|
+
} else if (start === 1) {
|
|
53894
|
+
lastChar = this.src.charCodeAt(0);
|
|
53895
|
+
if ((lastChar & 0xF800) === 0xD800) { lastChar = 0xFFFD; }
|
|
53896
|
+
} else {
|
|
53897
|
+
lastChar = this.src.charCodeAt(start - 1);
|
|
53898
|
+
if ((lastChar & 0xFC00) === 0xDC00) {
|
|
53899
|
+
// low surrogate => add high one, replace broken pair with U+FFFD
|
|
53900
|
+
const highSurr = this.src.charCodeAt(start - 2);
|
|
53901
|
+
lastChar = (highSurr & 0xFC00) === 0xD800
|
|
53902
|
+
? 0x10000 + ((highSurr - 0xD800) << 10) + (lastChar - 0xDC00)
|
|
53903
|
+
: 0xFFFD;
|
|
53904
|
+
} else if ((lastChar & 0xFC00) === 0xD800) {
|
|
53905
|
+
lastChar = 0xFFFD;
|
|
53906
|
+
}
|
|
53907
|
+
}
|
|
53731
53908
|
|
|
53732
53909
|
let pos = start;
|
|
53733
53910
|
while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
|
|
@@ -53735,10 +53912,19 @@ ${indentedChild}`;
|
|
|
53735
53912
|
const count = pos - start;
|
|
53736
53913
|
|
|
53737
53914
|
// treat end of the line as a whitespace
|
|
53738
|
-
|
|
53915
|
+
let nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
|
|
53916
|
+
if ((nextChar & 0xFC00) === 0xD800) {
|
|
53917
|
+
// high surrogate => add low one, replace broken pair with U+FFFD
|
|
53918
|
+
const lowSurr = this.src.charCodeAt(pos + 1);
|
|
53919
|
+
nextChar = (lowSurr & 0xFC00) === 0xDC00
|
|
53920
|
+
? 0x10000 + ((nextChar - 0xD800) << 10) + (lowSurr - 0xDC00)
|
|
53921
|
+
: 0xFFFD;
|
|
53922
|
+
} else if ((nextChar & 0xFC00) === 0xDC00) {
|
|
53923
|
+
nextChar = 0xFFFD;
|
|
53924
|
+
}
|
|
53739
53925
|
|
|
53740
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
53741
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
53926
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
53927
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
53742
53928
|
|
|
53743
53929
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
53744
53930
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
@@ -54765,7 +54951,7 @@ ${indentedChild}`;
|
|
|
54765
54951
|
} else {
|
|
54766
54952
|
const match = state.src.slice(pos).match(NAMED_RE);
|
|
54767
54953
|
if (match) {
|
|
54768
|
-
const decoded =
|
|
54954
|
+
const decoded = decodeHTMLStrict(match[0]);
|
|
54769
54955
|
if (decoded !== match[0]) {
|
|
54770
54956
|
if (!silent) {
|
|
54771
54957
|
const token = state.push('text_special', '', 0);
|
|
@@ -55427,11 +55613,6 @@ ${indentedChild}`;
|
|
|
55427
55613
|
// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
|
|
55428
55614
|
const tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
|
55429
55615
|
|
|
55430
|
-
function resetScanCache (self) {
|
|
55431
|
-
self.__index__ = -1;
|
|
55432
|
-
self.__text_cache__ = '';
|
|
55433
|
-
}
|
|
55434
|
-
|
|
55435
55616
|
function createValidator (re) {
|
|
55436
55617
|
return function (text, pos) {
|
|
55437
55618
|
const tail = text.slice(pos);
|
|
@@ -55470,8 +55651,11 @@ ${indentedChild}`;
|
|
|
55470
55651
|
function untpl (tpl) { return tpl.replace('%TLDS%', re.src_tlds) }
|
|
55471
55652
|
|
|
55472
55653
|
re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');
|
|
55654
|
+
re.email_fuzzy_global = RegExp(untpl(re.tpl_email_fuzzy), 'ig');
|
|
55473
55655
|
re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');
|
|
55656
|
+
re.link_fuzzy_global = RegExp(untpl(re.tpl_link_fuzzy), 'ig');
|
|
55474
55657
|
re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
|
|
55658
|
+
re.link_no_ip_fuzzy_global = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'ig');
|
|
55475
55659
|
re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
|
|
55476
55660
|
|
|
55477
55661
|
//
|
|
@@ -55565,12 +55749,6 @@ ${indentedChild}`;
|
|
|
55565
55749
|
'(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',
|
|
55566
55750
|
'i'
|
|
55567
55751
|
);
|
|
55568
|
-
|
|
55569
|
-
//
|
|
55570
|
-
// Cleanup
|
|
55571
|
-
//
|
|
55572
|
-
|
|
55573
|
-
resetScanCache(self);
|
|
55574
55752
|
}
|
|
55575
55753
|
|
|
55576
55754
|
/**
|
|
@@ -55578,55 +55756,45 @@ ${indentedChild}`;
|
|
|
55578
55756
|
*
|
|
55579
55757
|
* Match result. Single element of array, returned by [[LinkifyIt#match]]
|
|
55580
55758
|
**/
|
|
55581
|
-
function Match (
|
|
55582
|
-
const
|
|
55583
|
-
const end = self.__last_index__;
|
|
55584
|
-
const text = self.__text_cache__.slice(start, end);
|
|
55759
|
+
function Match (text, schema, index, lastIndex) {
|
|
55760
|
+
const raw = text.slice(index, lastIndex);
|
|
55585
55761
|
|
|
55586
55762
|
/**
|
|
55587
55763
|
* Match#schema -> String
|
|
55588
55764
|
*
|
|
55589
55765
|
* Prefix (protocol) for matched string.
|
|
55590
55766
|
**/
|
|
55591
|
-
this.schema =
|
|
55767
|
+
this.schema = schema.toLowerCase();
|
|
55592
55768
|
/**
|
|
55593
55769
|
* Match#index -> Number
|
|
55594
55770
|
*
|
|
55595
55771
|
* First position of matched string.
|
|
55596
55772
|
**/
|
|
55597
|
-
this.index =
|
|
55773
|
+
this.index = index;
|
|
55598
55774
|
/**
|
|
55599
55775
|
* Match#lastIndex -> Number
|
|
55600
55776
|
*
|
|
55601
55777
|
* Next position after matched string.
|
|
55602
55778
|
**/
|
|
55603
|
-
this.lastIndex =
|
|
55779
|
+
this.lastIndex = lastIndex;
|
|
55604
55780
|
/**
|
|
55605
55781
|
* Match#raw -> String
|
|
55606
55782
|
*
|
|
55607
55783
|
* Matched string.
|
|
55608
55784
|
**/
|
|
55609
|
-
this.raw =
|
|
55785
|
+
this.raw = raw;
|
|
55610
55786
|
/**
|
|
55611
55787
|
* Match#text -> String
|
|
55612
55788
|
*
|
|
55613
55789
|
* Notmalized text of matched string.
|
|
55614
55790
|
**/
|
|
55615
|
-
this.text =
|
|
55791
|
+
this.text = raw;
|
|
55616
55792
|
/**
|
|
55617
55793
|
* Match#url -> String
|
|
55618
55794
|
*
|
|
55619
55795
|
* Normalized url of matched string.
|
|
55620
55796
|
**/
|
|
55621
|
-
this.url =
|
|
55622
|
-
}
|
|
55623
|
-
|
|
55624
|
-
function createMatch (self, shift) {
|
|
55625
|
-
const match = new Match(self, shift);
|
|
55626
|
-
|
|
55627
|
-
self.__compiled__[match.schema].normalize(match, self);
|
|
55628
|
-
|
|
55629
|
-
return match
|
|
55797
|
+
this.url = raw;
|
|
55630
55798
|
}
|
|
55631
55799
|
|
|
55632
55800
|
/**
|
|
@@ -55681,12 +55849,6 @@ ${indentedChild}`;
|
|
|
55681
55849
|
|
|
55682
55850
|
this.__opts__ = assign({}, defaultOptions, options);
|
|
55683
55851
|
|
|
55684
|
-
// Cache last tested result. Used to skip repeating steps on next `match` call.
|
|
55685
|
-
this.__index__ = -1;
|
|
55686
|
-
this.__last_index__ = -1; // Next scan position
|
|
55687
|
-
this.__schema__ = '';
|
|
55688
|
-
this.__text_cache__ = '';
|
|
55689
|
-
|
|
55690
55852
|
this.__schemas__ = assign({}, defaultSchemas, schemas);
|
|
55691
55853
|
this.__compiled__ = {};
|
|
55692
55854
|
|
|
@@ -55728,69 +55890,38 @@ ${indentedChild}`;
|
|
|
55728
55890
|
* Searches linkifiable pattern and returns `true` on success or `false` on fail.
|
|
55729
55891
|
**/
|
|
55730
55892
|
LinkifyIt.prototype.test = function test (text) {
|
|
55731
|
-
// Reset scan cache
|
|
55732
|
-
this.__text_cache__ = text;
|
|
55733
|
-
this.__index__ = -1;
|
|
55734
|
-
|
|
55735
55893
|
if (!text.length) { return false }
|
|
55736
55894
|
|
|
55737
|
-
let m,
|
|
55895
|
+
let m, re;
|
|
55738
55896
|
|
|
55739
55897
|
// try to scan for link with schema - that's the most simple rule
|
|
55740
55898
|
if (this.re.schema_test.test(text)) {
|
|
55741
55899
|
re = this.re.schema_search;
|
|
55742
55900
|
re.lastIndex = 0;
|
|
55743
55901
|
while ((m = re.exec(text)) !== null) {
|
|
55744
|
-
|
|
55745
|
-
if (len) {
|
|
55746
|
-
this.__schema__ = m[2];
|
|
55747
|
-
this.__index__ = m.index + m[1].length;
|
|
55748
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
55749
|
-
break
|
|
55750
|
-
}
|
|
55902
|
+
if (this.testSchemaAt(text, m[2], re.lastIndex)) { return true }
|
|
55751
55903
|
}
|
|
55752
55904
|
}
|
|
55753
55905
|
|
|
55754
55906
|
if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
|
|
55755
55907
|
// guess schemaless links
|
|
55756
|
-
|
|
55757
|
-
|
|
55758
|
-
|
|
55759
|
-
if (this.__index__ < 0 || tld_pos < this.__index__) {
|
|
55760
|
-
if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
|
|
55761
|
-
shift = ml.index + ml[1].length;
|
|
55762
|
-
|
|
55763
|
-
if (this.__index__ < 0 || shift < this.__index__) {
|
|
55764
|
-
this.__schema__ = '';
|
|
55765
|
-
this.__index__ = shift;
|
|
55766
|
-
this.__last_index__ = ml.index + ml[0].length;
|
|
55767
|
-
}
|
|
55768
|
-
}
|
|
55908
|
+
if (text.search(this.re.host_fuzzy_test) >= 0) {
|
|
55909
|
+
if (text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy) !== null) {
|
|
55910
|
+
return true
|
|
55769
55911
|
}
|
|
55770
55912
|
}
|
|
55771
55913
|
}
|
|
55772
55914
|
|
|
55773
55915
|
if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
|
|
55774
55916
|
// guess schemaless emails
|
|
55775
|
-
|
|
55776
|
-
if (at_pos >= 0) {
|
|
55917
|
+
if (text.indexOf('@') >= 0) {
|
|
55777
55918
|
// We can't skip this check, because this cases are possible:
|
|
55778
55919
|
// 192.168.1.1@gmail.com, my.in@example.com
|
|
55779
|
-
if (
|
|
55780
|
-
shift = me.index + me[1].length;
|
|
55781
|
-
next = me.index + me[0].length;
|
|
55782
|
-
|
|
55783
|
-
if (this.__index__ < 0 || shift < this.__index__ ||
|
|
55784
|
-
(shift === this.__index__ && next > this.__last_index__)) {
|
|
55785
|
-
this.__schema__ = 'mailto:';
|
|
55786
|
-
this.__index__ = shift;
|
|
55787
|
-
this.__last_index__ = next;
|
|
55788
|
-
}
|
|
55789
|
-
}
|
|
55920
|
+
if (text.match(this.re.email_fuzzy) !== null) { return true }
|
|
55790
55921
|
}
|
|
55791
55922
|
}
|
|
55792
55923
|
|
|
55793
|
-
return
|
|
55924
|
+
return false
|
|
55794
55925
|
};
|
|
55795
55926
|
|
|
55796
55927
|
/**
|
|
@@ -55839,23 +55970,88 @@ ${indentedChild}`;
|
|
|
55839
55970
|
**/
|
|
55840
55971
|
LinkifyIt.prototype.match = function match (text) {
|
|
55841
55972
|
const result = [];
|
|
55842
|
-
|
|
55973
|
+
const type_schemed = [];
|
|
55974
|
+
const type_fuzzy_link = [];
|
|
55975
|
+
const type_fuzzy_email = [];
|
|
55976
|
+
let m, len, re;
|
|
55843
55977
|
|
|
55844
|
-
|
|
55845
|
-
|
|
55846
|
-
|
|
55847
|
-
|
|
55978
|
+
function choose (a, b) {
|
|
55979
|
+
if (!a) { return b }
|
|
55980
|
+
if (!b) { return a }
|
|
55981
|
+
if (a.index !== b.index) { return a.index < b.index ? a : b }
|
|
55982
|
+
return a.lastIndex >= b.lastIndex ? a : b
|
|
55848
55983
|
}
|
|
55849
55984
|
|
|
55850
|
-
|
|
55851
|
-
let tail = shift ? text.slice(shift) : text;
|
|
55985
|
+
if (!text.length) { return null }
|
|
55852
55986
|
|
|
55853
|
-
//
|
|
55854
|
-
|
|
55855
|
-
|
|
55987
|
+
// scan for links with schema
|
|
55988
|
+
if (this.re.schema_test.test(text)) {
|
|
55989
|
+
re = this.re.schema_search;
|
|
55990
|
+
re.lastIndex = 0;
|
|
55991
|
+
while ((m = re.exec(text)) !== null) {
|
|
55992
|
+
len = this.testSchemaAt(text, m[2], re.lastIndex);
|
|
55993
|
+
if (len) {
|
|
55994
|
+
type_schemed.push({
|
|
55995
|
+
schema: m[2],
|
|
55996
|
+
index: m.index + m[1].length,
|
|
55997
|
+
lastIndex: m.index + m[0].length + len
|
|
55998
|
+
});
|
|
55999
|
+
}
|
|
56000
|
+
}
|
|
56001
|
+
}
|
|
55856
56002
|
|
|
55857
|
-
|
|
55858
|
-
|
|
56003
|
+
if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
|
|
56004
|
+
re = this.__opts__.fuzzyIP ? this.re.link_fuzzy_global : this.re.link_no_ip_fuzzy_global;
|
|
56005
|
+
re.lastIndex = 0;
|
|
56006
|
+
while ((m = re.exec(text)) !== null) {
|
|
56007
|
+
type_fuzzy_link.push({
|
|
56008
|
+
schema: '',
|
|
56009
|
+
index: m.index + m[1].length,
|
|
56010
|
+
lastIndex: m.index + m[0].length
|
|
56011
|
+
});
|
|
56012
|
+
}
|
|
56013
|
+
}
|
|
56014
|
+
|
|
56015
|
+
if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
|
|
56016
|
+
re = this.re.email_fuzzy_global;
|
|
56017
|
+
re.lastIndex = 0;
|
|
56018
|
+
while ((m = re.exec(text)) !== null) {
|
|
56019
|
+
type_fuzzy_email.push({
|
|
56020
|
+
schema: 'mailto:',
|
|
56021
|
+
index: m.index + m[1].length,
|
|
56022
|
+
lastIndex: m.index + m[0].length
|
|
56023
|
+
});
|
|
56024
|
+
}
|
|
56025
|
+
}
|
|
56026
|
+
|
|
56027
|
+
const indexes = [0, 0, 0];
|
|
56028
|
+
let lastIndex = 0;
|
|
56029
|
+
|
|
56030
|
+
for (;;) {
|
|
56031
|
+
const candidates = [
|
|
56032
|
+
type_schemed[indexes[0]],
|
|
56033
|
+
type_fuzzy_email[indexes[1]],
|
|
56034
|
+
type_fuzzy_link[indexes[2]]
|
|
56035
|
+
];
|
|
56036
|
+
|
|
56037
|
+
const candidate = choose(choose(candidates[0], candidates[1]), candidates[2]);
|
|
56038
|
+
|
|
56039
|
+
if (!candidate) { break }
|
|
56040
|
+
|
|
56041
|
+
if (candidate === candidates[0]) {
|
|
56042
|
+
indexes[0]++;
|
|
56043
|
+
} else if (candidate === candidates[1]) {
|
|
56044
|
+
indexes[1]++;
|
|
56045
|
+
} else {
|
|
56046
|
+
indexes[2]++;
|
|
56047
|
+
}
|
|
56048
|
+
|
|
56049
|
+
if (candidate.index < lastIndex) { continue }
|
|
56050
|
+
|
|
56051
|
+
const match = new Match(text, candidate.schema, candidate.index, candidate.lastIndex);
|
|
56052
|
+
this.__compiled__[match.schema].normalize(match, this);
|
|
56053
|
+
result.push(match);
|
|
56054
|
+
lastIndex = candidate.lastIndex;
|
|
55859
56055
|
}
|
|
55860
56056
|
|
|
55861
56057
|
if (result.length) {
|
|
@@ -55872,10 +56068,6 @@ ${indentedChild}`;
|
|
|
55872
56068
|
* of the string, and null otherwise.
|
|
55873
56069
|
**/
|
|
55874
56070
|
LinkifyIt.prototype.matchAtStart = function matchAtStart (text) {
|
|
55875
|
-
// Reset scan cache
|
|
55876
|
-
this.__text_cache__ = text;
|
|
55877
|
-
this.__index__ = -1;
|
|
55878
|
-
|
|
55879
56071
|
if (!text.length) return null
|
|
55880
56072
|
|
|
55881
56073
|
const m = this.re.schema_at_start.exec(text);
|
|
@@ -55884,11 +56076,10 @@ ${indentedChild}`;
|
|
|
55884
56076
|
const len = this.testSchemaAt(text, m[2], m[0].length);
|
|
55885
56077
|
if (!len) return null
|
|
55886
56078
|
|
|
55887
|
-
|
|
55888
|
-
this.__index__ = m.index + m[1].length;
|
|
55889
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
56079
|
+
const match = new Match(text, m[2], m.index + m[1].length, m.index + m[0].length + len);
|
|
55890
56080
|
|
|
55891
|
-
|
|
56081
|
+
this.__compiled__[match.schema].normalize(match, this);
|
|
56082
|
+
return match
|
|
55892
56083
|
};
|
|
55893
56084
|
|
|
55894
56085
|
/** chainable
|
|
@@ -56940,7 +57131,7 @@ ${indentedChild}`;
|
|
|
56940
57131
|
* ```javascript
|
|
56941
57132
|
* var md = require('markdown-it')()
|
|
56942
57133
|
* .set({ html: true, breaks: true })
|
|
56943
|
-
* .set({ typographer
|
|
57134
|
+
* .set({ typographer: true });
|
|
56944
57135
|
* ```
|
|
56945
57136
|
*
|
|
56946
57137
|
* __Note:__ To achieve the best possible performance, don't modify a
|
|
@@ -58888,7 +59079,7 @@ ${indentedChild}`;
|
|
|
58888
59079
|
// THIS FILE IS AUTOMATICALLY GENERATED DO NOT EDIT DIRECTLY
|
|
58889
59080
|
// See update-tlds.js for encoding/decoding format
|
|
58890
59081
|
// https://data.iana.org/TLD/tlds-alpha-by-domain.txt
|
|
58891
|
-
const encodedTlds = '
|
|
59082
|
+
const encodedTlds = 'aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2';
|
|
58892
59083
|
// Internationalized domain names containing non-ASCII
|
|
58893
59084
|
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';
|
|
58894
59085
|
|
|
@@ -60280,11 +60471,6 @@ ${indentedChild}`;
|
|
|
60280
60471
|
tt(Email$1, DOT, EmailDomainDot);
|
|
60281
60472
|
tt(Email$1, HYPHEN, EmailDomainHyphen);
|
|
60282
60473
|
|
|
60283
|
-
// Final possible email states
|
|
60284
|
-
const EmailColon = tt(Email$1, COLON); // URL followed by colon (potential port number here)
|
|
60285
|
-
/*const EmailColonPort = */
|
|
60286
|
-
ta(EmailColon, groups.numeric, Email); // URL followed by colon and port number
|
|
60287
|
-
|
|
60288
60474
|
// Account for dots and hyphens. Hyphens are usually parts of domain names
|
|
60289
60475
|
// (but not TLDs)
|
|
60290
60476
|
const DomainHyphen = tt(Domain, HYPHEN); // domain followed by hyphen
|
|
@@ -60367,16 +60553,18 @@ ${indentedChild}`;
|
|
|
60367
60553
|
// Continue not accepting for open brackets
|
|
60368
60554
|
tt(UrlNonaccept, OPEN, UrlOpen);
|
|
60369
60555
|
|
|
60370
|
-
//
|
|
60371
|
-
tt(UrlOpen, CLOSE, Url$1);
|
|
60372
|
-
|
|
60373
|
-
// URL that beings with an opening bracket, followed by a symbols.
|
|
60556
|
+
// URL that begins with an opening bracket, followed by a symbols.
|
|
60374
60557
|
// Note that the final state can still be `UrlOpen` (if the URL has a
|
|
60375
60558
|
// single opening bracket for some reason).
|
|
60376
60559
|
const UrlOpenQ = makeState(Url);
|
|
60377
60560
|
ta(UrlOpen, qsAccepting, UrlOpenQ);
|
|
60378
60561
|
const UrlOpenSyms = makeState(); // UrlOpen followed by some symbols it cannot end it
|
|
60379
|
-
ta(UrlOpen, qsNonAccepting);
|
|
60562
|
+
ta(UrlOpen, qsNonAccepting, UrlOpenSyms);
|
|
60563
|
+
|
|
60564
|
+
// Closing bracket component. This character WILL be included in the URL.
|
|
60565
|
+
// Must come after qsNonAccepting (which includes all close-bracket tokens)
|
|
60566
|
+
// so that CLOSE -> Url wins over CLOSE -> UrlOpenSyms.
|
|
60567
|
+
tt(UrlOpen, CLOSE, Url$1);
|
|
60380
60568
|
|
|
60381
60569
|
// URL that begins with an opening bracket, followed by some symbols
|
|
60382
60570
|
ta(UrlOpenQ, qsAccepting, UrlOpenQ);
|
|
@@ -61130,6 +61318,25 @@ ${indentedChild}`;
|
|
|
61130
61318
|
return [inputRule];
|
|
61131
61319
|
}
|
|
61132
61320
|
});
|
|
61321
|
+
function isSameLineOrderedListToken(token) {
|
|
61322
|
+
var _a, _b;
|
|
61323
|
+
const nestedToken = (_a = token.tokens) == null ? void 0 : _a[0];
|
|
61324
|
+
return Boolean(
|
|
61325
|
+
token.text && ((_b = token.tokens) == null ? void 0 : _b.length) === 1 && (nestedToken == null ? void 0 : nestedToken.type) === "list" && nestedToken.ordered && nestedToken.raw === token.text
|
|
61326
|
+
);
|
|
61327
|
+
}
|
|
61328
|
+
function parseSameLineOrderedListText(text, helpers) {
|
|
61329
|
+
if (helpers.tokenizeInline) {
|
|
61330
|
+
return helpers.parseInline(helpers.tokenizeInline(text));
|
|
61331
|
+
}
|
|
61332
|
+
return helpers.parseInline([
|
|
61333
|
+
{
|
|
61334
|
+
type: "text",
|
|
61335
|
+
raw: text,
|
|
61336
|
+
text
|
|
61337
|
+
}
|
|
61338
|
+
]);
|
|
61339
|
+
}
|
|
61133
61340
|
var ListItem = Node3.create({
|
|
61134
61341
|
name: "listItem",
|
|
61135
61342
|
addOptions() {
|
|
@@ -61160,6 +61367,17 @@ ${indentedChild}`;
|
|
|
61160
61367
|
const parseBlockChildren = (_a = helpers.parseBlockChildren) != null ? _a : helpers.parseChildren;
|
|
61161
61368
|
let content = [];
|
|
61162
61369
|
if (token.tokens && token.tokens.length > 0) {
|
|
61370
|
+
if (isSameLineOrderedListToken(token)) {
|
|
61371
|
+
return {
|
|
61372
|
+
type: "listItem",
|
|
61373
|
+
content: [
|
|
61374
|
+
{
|
|
61375
|
+
type: "paragraph",
|
|
61376
|
+
content: parseSameLineOrderedListText(token.text || "", helpers)
|
|
61377
|
+
}
|
|
61378
|
+
]
|
|
61379
|
+
};
|
|
61380
|
+
}
|
|
61163
61381
|
const hasParagraphTokens = token.tokens.some((t) => t.type === "paragraph");
|
|
61164
61382
|
if (hasParagraphTokens) {
|
|
61165
61383
|
content = parseBlockChildren(token.tokens);
|
|
@@ -63803,6 +64021,7 @@ ${indentedChild}`;
|
|
|
63803
64021
|
addOptions() {
|
|
63804
64022
|
return {
|
|
63805
64023
|
limit: null,
|
|
64024
|
+
autoTrim: true,
|
|
63806
64025
|
mode: "textSize",
|
|
63807
64026
|
textCounter: (text) => text.length,
|
|
63808
64027
|
wordCounter: (text) => text.split(" ").filter((word) => word !== "").length
|
|
@@ -63840,7 +64059,8 @@ ${indentedChild}`;
|
|
|
63840
64059
|
return;
|
|
63841
64060
|
}
|
|
63842
64061
|
const limit = this.options.limit;
|
|
63843
|
-
|
|
64062
|
+
const autoTrim = this.options.autoTrim;
|
|
64063
|
+
if (limit === null || limit === void 0 || limit === 0 || autoTrim === false) {
|
|
63844
64064
|
initialEvaluationDone = true;
|
|
63845
64065
|
return;
|
|
63846
64066
|
}
|
|
@@ -63983,10 +64203,114 @@ ${indentedChild}`;
|
|
|
63983
64203
|
};
|
|
63984
64204
|
}
|
|
63985
64205
|
});
|
|
64206
|
+
function createPlaceholderDecoration(options) {
|
|
64207
|
+
const {
|
|
64208
|
+
editor,
|
|
64209
|
+
placeholder,
|
|
64210
|
+
dataAttribute,
|
|
64211
|
+
pos,
|
|
64212
|
+
node,
|
|
64213
|
+
isEmptyDoc,
|
|
64214
|
+
hasAnchor,
|
|
64215
|
+
classes: { emptyNode, emptyEditor }
|
|
64216
|
+
} = options;
|
|
64217
|
+
const classes = [emptyNode];
|
|
64218
|
+
if (isEmptyDoc) {
|
|
64219
|
+
classes.push(emptyEditor);
|
|
64220
|
+
}
|
|
64221
|
+
return Decoration.node(pos, pos + node.nodeSize, {
|
|
64222
|
+
class: classes.join(" "),
|
|
64223
|
+
[dataAttribute]: typeof placeholder === "function" ? placeholder({
|
|
64224
|
+
editor,
|
|
64225
|
+
node,
|
|
64226
|
+
pos,
|
|
64227
|
+
hasAnchor
|
|
64228
|
+
}) : placeholder
|
|
64229
|
+
});
|
|
64230
|
+
}
|
|
64231
|
+
|
|
64232
|
+
// src/placeholder/utils/findScrollParent.ts
|
|
64233
|
+
function isScrollable(el) {
|
|
64234
|
+
const style = getComputedStyle(el);
|
|
64235
|
+
const overflow = `${style.overflow} ${style.overflowY} ${style.overflowX}`;
|
|
64236
|
+
return /auto|scroll|overlay/.test(overflow);
|
|
64237
|
+
}
|
|
64238
|
+
function findScrollParent(element) {
|
|
64239
|
+
let el = element;
|
|
64240
|
+
while (el) {
|
|
64241
|
+
if (isScrollable(el)) {
|
|
64242
|
+
return el;
|
|
64243
|
+
}
|
|
64244
|
+
const parent = el.parentElement;
|
|
64245
|
+
if (!parent) {
|
|
64246
|
+
const root = el.getRootNode();
|
|
64247
|
+
if (root instanceof ShadowRoot) {
|
|
64248
|
+
el = root.host;
|
|
64249
|
+
continue;
|
|
64250
|
+
}
|
|
64251
|
+
return window;
|
|
64252
|
+
}
|
|
64253
|
+
el = parent;
|
|
64254
|
+
}
|
|
64255
|
+
return window;
|
|
64256
|
+
}
|
|
64257
|
+
|
|
64258
|
+
// src/placeholder/utils/getViewportBoundaryPositions.ts
|
|
64259
|
+
function getContainerRect(container) {
|
|
64260
|
+
if (container === window) {
|
|
64261
|
+
return { top: 0, bottom: window.innerHeight };
|
|
64262
|
+
}
|
|
64263
|
+
return container.getBoundingClientRect();
|
|
64264
|
+
}
|
|
64265
|
+
function getViewportBoundaryPositions({
|
|
64266
|
+
doc,
|
|
64267
|
+
view,
|
|
64268
|
+
scrollContainer
|
|
64269
|
+
}) {
|
|
64270
|
+
const editorRect = view.dom.getBoundingClientRect();
|
|
64271
|
+
const containerRect = scrollContainer ? getContainerRect(scrollContainer) : { top: 0, bottom: window.innerHeight };
|
|
64272
|
+
const visibleTop = Math.max(editorRect.top, containerRect.top);
|
|
64273
|
+
const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom);
|
|
64274
|
+
if (visibleTop >= visibleBottom) {
|
|
64275
|
+
return { top: 0, bottom: doc.content.size };
|
|
64276
|
+
}
|
|
64277
|
+
const isRTL = getComputedStyle(view.dom).direction === "rtl";
|
|
64278
|
+
const x = isRTL ? Math.max(editorRect.right - 2, editorRect.left + 2) : editorRect.left + 2;
|
|
64279
|
+
const topPos = view.posAtCoords({ left: x, top: visibleTop + 2 });
|
|
64280
|
+
const bottomPos = view.posAtCoords({ left: x, top: visibleBottom - 2 });
|
|
64281
|
+
return {
|
|
64282
|
+
top: topPos ? topPos.pos : 0,
|
|
64283
|
+
bottom: bottomPos ? bottomPos.pos : doc.content.size
|
|
64284
|
+
};
|
|
64285
|
+
}
|
|
64286
|
+
|
|
64287
|
+
// src/placeholder/utils/throttle.ts
|
|
64288
|
+
function throttle(fn, delay) {
|
|
64289
|
+
let timer = null;
|
|
64290
|
+
const call = ((...args) => {
|
|
64291
|
+
if (timer) {
|
|
64292
|
+
return;
|
|
64293
|
+
}
|
|
64294
|
+
fn(...args);
|
|
64295
|
+
timer = setTimeout(() => {
|
|
64296
|
+
timer = null;
|
|
64297
|
+
}, delay);
|
|
64298
|
+
});
|
|
64299
|
+
const cancel = () => {
|
|
64300
|
+
if (timer) {
|
|
64301
|
+
clearTimeout(timer);
|
|
64302
|
+
timer = null;
|
|
64303
|
+
}
|
|
64304
|
+
};
|
|
64305
|
+
return { call, cancel };
|
|
64306
|
+
}
|
|
64307
|
+
|
|
64308
|
+
// src/placeholder/placeholder.ts
|
|
63986
64309
|
var DEFAULT_DATA_ATTRIBUTE = "placeholder";
|
|
63987
64310
|
function preparePlaceholderAttribute(attr) {
|
|
63988
64311
|
return attr.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
63989
64312
|
}
|
|
64313
|
+
var PLUGIN_KEY = new PluginKey("tiptap__placeholder");
|
|
63990
64314
|
var Placeholder = Extension.create({
|
|
63991
64315
|
name: "placeholder",
|
|
63992
64316
|
addOptions() {
|
|
@@ -64004,40 +64328,124 @@ ${indentedChild}`;
|
|
|
64004
64328
|
const dataAttribute = this.options.dataAttribute ? `data-${preparePlaceholderAttribute(this.options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;
|
|
64005
64329
|
return [
|
|
64006
64330
|
new Plugin({
|
|
64007
|
-
|
|
64331
|
+
state: {
|
|
64332
|
+
init() {
|
|
64333
|
+
return {
|
|
64334
|
+
// null means "no viewport info yet" — decoration callback falls
|
|
64335
|
+
// back to full document scan until the scroll handler fires.
|
|
64336
|
+
topPos: null,
|
|
64337
|
+
bottomPos: null
|
|
64338
|
+
};
|
|
64339
|
+
},
|
|
64340
|
+
apply(tr, prev) {
|
|
64341
|
+
const meta = tr.getMeta(PLUGIN_KEY);
|
|
64342
|
+
if (meta == null ? void 0 : meta.positions) {
|
|
64343
|
+
return {
|
|
64344
|
+
topPos: meta.positions.top,
|
|
64345
|
+
bottomPos: meta.positions.bottom
|
|
64346
|
+
};
|
|
64347
|
+
}
|
|
64348
|
+
if (!tr.docChanged) {
|
|
64349
|
+
return prev;
|
|
64350
|
+
}
|
|
64351
|
+
return {
|
|
64352
|
+
topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
|
|
64353
|
+
bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
|
|
64354
|
+
};
|
|
64355
|
+
}
|
|
64356
|
+
},
|
|
64357
|
+
key: PLUGIN_KEY,
|
|
64358
|
+
view(view) {
|
|
64359
|
+
const scrollContainer = findScrollParent(view.dom);
|
|
64360
|
+
const computeAndDispatch = () => {
|
|
64361
|
+
const positions = getViewportBoundaryPositions({
|
|
64362
|
+
view,
|
|
64363
|
+
doc: view.state.doc,
|
|
64364
|
+
scrollContainer
|
|
64365
|
+
});
|
|
64366
|
+
const prev = PLUGIN_KEY.getState(view.state);
|
|
64367
|
+
if (prev.topPos === positions.top && prev.bottomPos === positions.bottom) {
|
|
64368
|
+
return;
|
|
64369
|
+
}
|
|
64370
|
+
const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions }).setMeta("tiptap__viewportUpdate", true);
|
|
64371
|
+
view.dispatch(tr);
|
|
64372
|
+
};
|
|
64373
|
+
const { call: throttledUpdate, cancel: cancelThrottle } = throttle(computeAndDispatch, 250);
|
|
64374
|
+
const scrollParent = scrollContainer;
|
|
64375
|
+
scrollParent.addEventListener("scroll", throttledUpdate, { passive: true });
|
|
64376
|
+
computeAndDispatch();
|
|
64377
|
+
return {
|
|
64378
|
+
update(_, prevState) {
|
|
64379
|
+
if (view.state.doc.content.size !== prevState.doc.content.size) {
|
|
64380
|
+
computeAndDispatch();
|
|
64381
|
+
}
|
|
64382
|
+
},
|
|
64383
|
+
destroy: () => {
|
|
64384
|
+
cancelThrottle();
|
|
64385
|
+
scrollParent.removeEventListener("scroll", throttledUpdate);
|
|
64386
|
+
}
|
|
64387
|
+
};
|
|
64388
|
+
},
|
|
64008
64389
|
props: {
|
|
64009
64390
|
decorations: ({ doc, selection }) => {
|
|
64391
|
+
var _a, _b;
|
|
64010
64392
|
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
64011
|
-
const { anchor } = selection;
|
|
64012
|
-
const decorations = [];
|
|
64013
64393
|
if (!active) {
|
|
64014
64394
|
return null;
|
|
64015
64395
|
}
|
|
64396
|
+
const { anchor } = selection;
|
|
64397
|
+
const decorations = [];
|
|
64016
64398
|
const isEmptyDoc = this.editor.isEmpty;
|
|
64017
|
-
|
|
64018
|
-
|
|
64019
|
-
const
|
|
64020
|
-
if (
|
|
64021
|
-
|
|
64399
|
+
const useResolvedPath = this.options.showOnlyCurrent && !this.options.includeChildren;
|
|
64400
|
+
if (useResolvedPath) {
|
|
64401
|
+
const resolved = doc.resolve(anchor);
|
|
64402
|
+
if (resolved.depth > 0) {
|
|
64403
|
+
const node = resolved.node(1);
|
|
64404
|
+
const nodeStart = resolved.before(1);
|
|
64405
|
+
if (node.type.isTextblock && isNodeEmpty(node)) {
|
|
64406
|
+
const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
|
|
64407
|
+
const decoration = createPlaceholderDecoration({
|
|
64408
|
+
node,
|
|
64409
|
+
dataAttribute,
|
|
64410
|
+
hasAnchor,
|
|
64411
|
+
placeholder: this.options.placeholder,
|
|
64412
|
+
classes: {
|
|
64413
|
+
emptyEditor: this.options.emptyEditorClass,
|
|
64414
|
+
emptyNode: this.options.emptyNodeClass
|
|
64415
|
+
},
|
|
64416
|
+
editor: this.editor,
|
|
64417
|
+
isEmptyDoc,
|
|
64418
|
+
pos: resolved.before(1)
|
|
64419
|
+
});
|
|
64420
|
+
decorations.push(decoration);
|
|
64421
|
+
}
|
|
64022
64422
|
}
|
|
64023
|
-
|
|
64024
|
-
|
|
64025
|
-
|
|
64026
|
-
|
|
64423
|
+
} else {
|
|
64424
|
+
const pluginState = PLUGIN_KEY.getState(this.editor.state);
|
|
64425
|
+
const from = (_a = pluginState.topPos) != null ? _a : 0;
|
|
64426
|
+
const to = (_b = pluginState.bottomPos) != null ? _b : doc.content.size;
|
|
64427
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
64428
|
+
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
64429
|
+
const isEmpty = !node.isLeaf && isNodeEmpty(node);
|
|
64430
|
+
if (!node.type.isTextblock) {
|
|
64431
|
+
return this.options.includeChildren;
|
|
64027
64432
|
}
|
|
64028
|
-
|
|
64029
|
-
|
|
64030
|
-
|
|
64433
|
+
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
64434
|
+
const decoration = createPlaceholderDecoration({
|
|
64435
|
+
classes: { emptyEditor: this.options.emptyEditorClass, emptyNode: this.options.emptyNodeClass },
|
|
64031
64436
|
editor: this.editor,
|
|
64437
|
+
isEmptyDoc,
|
|
64438
|
+
dataAttribute,
|
|
64439
|
+
hasAnchor,
|
|
64440
|
+
placeholder: this.options.placeholder,
|
|
64032
64441
|
node,
|
|
64033
|
-
pos
|
|
64034
|
-
|
|
64035
|
-
|
|
64036
|
-
}
|
|
64037
|
-
|
|
64038
|
-
}
|
|
64039
|
-
|
|
64040
|
-
});
|
|
64442
|
+
pos
|
|
64443
|
+
});
|
|
64444
|
+
decorations.push(decoration);
|
|
64445
|
+
}
|
|
64446
|
+
return this.options.includeChildren;
|
|
64447
|
+
});
|
|
64448
|
+
}
|
|
64041
64449
|
return DecorationSet.create(doc, decorations);
|
|
64042
64450
|
}
|
|
64043
64451
|
}
|
|
@@ -72774,24 +73182,56 @@ focus outline in that case.
|
|
|
72774
73182
|
</template>
|
|
72775
73183
|
`;
|
|
72776
73184
|
|
|
73185
|
+
function createLazyMeasurementsView(count, flat, getItemKey) {
|
|
73186
|
+
const cache = new Array(count);
|
|
73187
|
+
return new Proxy(cache, {
|
|
73188
|
+
get(target, prop, receiver) {
|
|
73189
|
+
if (typeof prop === "string") {
|
|
73190
|
+
const c = prop.charCodeAt(0);
|
|
73191
|
+
if (c >= 48 && c <= 57) {
|
|
73192
|
+
const i = +prop;
|
|
73193
|
+
if (Number.isInteger(i) && i >= 0 && i < count) {
|
|
73194
|
+
let v = target[i];
|
|
73195
|
+
if (!v) {
|
|
73196
|
+
const s = flat[i * 2];
|
|
73197
|
+
v = target[i] = {
|
|
73198
|
+
index: i,
|
|
73199
|
+
key: getItemKey(i),
|
|
73200
|
+
start: s,
|
|
73201
|
+
size: flat[i * 2 + 1],
|
|
73202
|
+
end: s + flat[i * 2 + 1],
|
|
73203
|
+
lane: 0
|
|
73204
|
+
};
|
|
73205
|
+
}
|
|
73206
|
+
return v;
|
|
73207
|
+
}
|
|
73208
|
+
}
|
|
73209
|
+
if (prop === "length") return count;
|
|
73210
|
+
}
|
|
73211
|
+
return Reflect.get(target, prop, receiver);
|
|
73212
|
+
}
|
|
73213
|
+
});
|
|
73214
|
+
}
|
|
73215
|
+
|
|
72777
73216
|
function memo(getDeps, fn, opts) {
|
|
72778
73217
|
let deps = opts.initialDeps ?? [];
|
|
72779
73218
|
let result;
|
|
72780
73219
|
let isInitial = true;
|
|
72781
73220
|
function memoizedFunction() {
|
|
72782
|
-
var _a
|
|
72783
|
-
|
|
72784
|
-
|
|
73221
|
+
var _a;
|
|
73222
|
+
const debugEnabled = !!opts.key && !!((_a = opts.debug) == null ? void 0 : _a.call(opts));
|
|
73223
|
+
let depTime = 0;
|
|
73224
|
+
if (debugEnabled) depTime = Date.now();
|
|
72785
73225
|
const newDeps = getDeps();
|
|
72786
73226
|
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
72787
73227
|
if (!depsChanged) {
|
|
72788
73228
|
return result;
|
|
72789
73229
|
}
|
|
72790
73230
|
deps = newDeps;
|
|
72791
|
-
let resultTime;
|
|
72792
|
-
if (
|
|
73231
|
+
let resultTime = 0;
|
|
73232
|
+
if (debugEnabled) resultTime = Date.now();
|
|
72793
73233
|
result = fn(...newDeps);
|
|
72794
|
-
if (
|
|
73234
|
+
if (debugEnabled) {
|
|
72795
73235
|
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
72796
73236
|
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
72797
73237
|
const resultFpsPercentage = resultEndTime / 16;
|
|
@@ -72841,6 +73281,14 @@ focus outline in that case.
|
|
|
72841
73281
|
};
|
|
72842
73282
|
};
|
|
72843
73283
|
|
|
73284
|
+
let _isIOSResult;
|
|
73285
|
+
const isIOSWebKit = () => {
|
|
73286
|
+
if (_isIOSResult !== void 0) return _isIOSResult;
|
|
73287
|
+
if (typeof navigator === "undefined") return _isIOSResult = false;
|
|
73288
|
+
if (/iP(hone|od|ad)/.test(navigator.userAgent)) return _isIOSResult = true;
|
|
73289
|
+
const mtp = navigator.maxTouchPoints;
|
|
73290
|
+
return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
|
|
73291
|
+
};
|
|
72844
73292
|
const getRect = (element) => {
|
|
72845
73293
|
const { offsetWidth, offsetHeight } = element;
|
|
72846
73294
|
return { width: offsetWidth, height: offsetHeight };
|
|
@@ -72849,9 +73297,10 @@ focus outline in that case.
|
|
|
72849
73297
|
const defaultRangeExtractor = (range) => {
|
|
72850
73298
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
72851
73299
|
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
72852
|
-
const
|
|
72853
|
-
|
|
72854
|
-
|
|
73300
|
+
const len = end - start + 1;
|
|
73301
|
+
const arr = new Array(len);
|
|
73302
|
+
for (let i = 0; i < len; i++) {
|
|
73303
|
+
arr[i] = start + i;
|
|
72855
73304
|
}
|
|
72856
73305
|
return arr;
|
|
72857
73306
|
};
|
|
@@ -72896,7 +73345,7 @@ focus outline in that case.
|
|
|
72896
73345
|
passive: true
|
|
72897
73346
|
};
|
|
72898
73347
|
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
72899
|
-
const
|
|
73348
|
+
const observeOffset = (instance, cb, readOffset) => {
|
|
72900
73349
|
const element = instance.scrollElement;
|
|
72901
73350
|
if (!element) {
|
|
72902
73351
|
return;
|
|
@@ -72905,24 +73354,21 @@ focus outline in that case.
|
|
|
72905
73354
|
if (!targetWindow) {
|
|
72906
73355
|
return;
|
|
72907
73356
|
}
|
|
73357
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
72908
73358
|
let offset = 0;
|
|
72909
|
-
const fallback =
|
|
73359
|
+
const fallback = registerScrollendEvent ? null : debounce(
|
|
72910
73360
|
targetWindow,
|
|
72911
|
-
() =>
|
|
72912
|
-
cb(offset, false);
|
|
72913
|
-
},
|
|
73361
|
+
() => cb(offset, false),
|
|
72914
73362
|
instance.options.isScrollingResetDelay
|
|
72915
73363
|
);
|
|
72916
73364
|
const createHandler = (isScrolling) => () => {
|
|
72917
|
-
|
|
72918
|
-
|
|
72919
|
-
fallback();
|
|
73365
|
+
offset = readOffset(element);
|
|
73366
|
+
fallback == null ? void 0 : fallback();
|
|
72920
73367
|
cb(offset, isScrolling);
|
|
72921
73368
|
};
|
|
72922
73369
|
const handler = createHandler(true);
|
|
72923
73370
|
const endHandler = createHandler(false);
|
|
72924
73371
|
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
72925
|
-
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
72926
73372
|
if (registerScrollendEvent) {
|
|
72927
73373
|
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
72928
73374
|
}
|
|
@@ -72933,6 +73379,10 @@ focus outline in that case.
|
|
|
72933
73379
|
}
|
|
72934
73380
|
};
|
|
72935
73381
|
};
|
|
73382
|
+
const observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
|
|
73383
|
+
const { horizontal, isRtl } = instance.options;
|
|
73384
|
+
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
73385
|
+
});
|
|
72936
73386
|
const measureElement = (element, entry, instance) => {
|
|
72937
73387
|
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
72938
73388
|
const box = entry.borderBoxSize[0];
|
|
@@ -72945,17 +73395,17 @@ focus outline in that case.
|
|
|
72945
73395
|
}
|
|
72946
73396
|
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
72947
73397
|
};
|
|
72948
|
-
const
|
|
73398
|
+
const scrollWithAdjustments = (offset, {
|
|
72949
73399
|
adjustments = 0,
|
|
72950
73400
|
behavior
|
|
72951
73401
|
}, instance) => {
|
|
72952
73402
|
var _a, _b;
|
|
72953
|
-
const toOffset = offset + adjustments;
|
|
72954
73403
|
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
72955
|
-
[instance.options.horizontal ? "left" : "top"]:
|
|
73404
|
+
[instance.options.horizontal ? "left" : "top"]: offset + adjustments,
|
|
72956
73405
|
behavior
|
|
72957
73406
|
});
|
|
72958
73407
|
};
|
|
73408
|
+
const elementScroll = scrollWithAdjustments;
|
|
72959
73409
|
let Virtualizer$1 = class Virtualizer {
|
|
72960
73410
|
constructor(opts) {
|
|
72961
73411
|
this.unsubs = [];
|
|
@@ -72964,16 +73414,24 @@ focus outline in that case.
|
|
|
72964
73414
|
this.isScrolling = false;
|
|
72965
73415
|
this.scrollState = null;
|
|
72966
73416
|
this.measurementsCache = [];
|
|
73417
|
+
this._flatMeasurements = null;
|
|
72967
73418
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
73419
|
+
this.itemSizeCacheVersion = 0;
|
|
72968
73420
|
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
72969
|
-
this.
|
|
73421
|
+
this.pendingMin = null;
|
|
72970
73422
|
this.prevLanes = void 0;
|
|
72971
73423
|
this.lanesChangedFlag = false;
|
|
72972
73424
|
this.lanesSettling = false;
|
|
73425
|
+
this.pendingScrollAnchor = null;
|
|
72973
73426
|
this.scrollRect = null;
|
|
72974
73427
|
this.scrollOffset = null;
|
|
72975
73428
|
this.scrollDirection = null;
|
|
72976
73429
|
this.scrollAdjustments = 0;
|
|
73430
|
+
this._iosDeferredAdjustment = 0;
|
|
73431
|
+
this._iosTouching = false;
|
|
73432
|
+
this._iosJustTouchEnded = false;
|
|
73433
|
+
this._iosTouchEndTimerId = null;
|
|
73434
|
+
this._intendedScrollOffset = null;
|
|
72977
73435
|
this.elementsCache = /* @__PURE__ */ new Map();
|
|
72978
73436
|
this.now = () => {
|
|
72979
73437
|
var _a, _b, _c;
|
|
@@ -72995,6 +73453,12 @@ focus outline in that case.
|
|
|
72995
73453
|
const index = this.indexFromElement(node);
|
|
72996
73454
|
if (!node.isConnected) {
|
|
72997
73455
|
this.observer.unobserve(node);
|
|
73456
|
+
for (const [cacheKey, cachedNode] of this.elementsCache) {
|
|
73457
|
+
if (cachedNode === node) {
|
|
73458
|
+
this.elementsCache.delete(cacheKey);
|
|
73459
|
+
break;
|
|
73460
|
+
}
|
|
73461
|
+
}
|
|
72998
73462
|
return;
|
|
72999
73463
|
}
|
|
73000
73464
|
if (this.shouldMeasureDuringScroll(index)) {
|
|
@@ -73026,10 +73490,8 @@ focus outline in that case.
|
|
|
73026
73490
|
})();
|
|
73027
73491
|
this.range = null;
|
|
73028
73492
|
this.setOptions = (opts2) => {
|
|
73029
|
-
|
|
73030
|
-
|
|
73031
|
-
});
|
|
73032
|
-
this.options = {
|
|
73493
|
+
var _a, _b;
|
|
73494
|
+
const merged = {
|
|
73033
73495
|
debug: false,
|
|
73034
73496
|
initialOffset: 0,
|
|
73035
73497
|
overscan: 1,
|
|
@@ -73049,14 +73511,50 @@ focus outline in that case.
|
|
|
73049
73511
|
indexAttribute: "data-index",
|
|
73050
73512
|
initialMeasurementsCache: [],
|
|
73051
73513
|
lanes: 1,
|
|
73514
|
+
anchorTo: "start",
|
|
73515
|
+
followOnAppend: false,
|
|
73516
|
+
scrollEndThreshold: 1,
|
|
73052
73517
|
isScrollingResetDelay: 150,
|
|
73053
73518
|
enabled: true,
|
|
73054
73519
|
isRtl: false,
|
|
73055
73520
|
useScrollendEvent: false,
|
|
73056
73521
|
useAnimationFrameWithResizeObserver: false,
|
|
73057
|
-
laneAssignmentMode: "estimate"
|
|
73058
|
-
...opts2
|
|
73522
|
+
laneAssignmentMode: "estimate"
|
|
73059
73523
|
};
|
|
73524
|
+
for (const key in opts2) {
|
|
73525
|
+
const v = opts2[key];
|
|
73526
|
+
if (v !== void 0) merged[key] = v;
|
|
73527
|
+
}
|
|
73528
|
+
const prevOptions = this.options;
|
|
73529
|
+
let anchor = null;
|
|
73530
|
+
let followOnAppend = null;
|
|
73531
|
+
if (prevOptions !== void 0 && prevOptions.enabled && merged.enabled && merged.anchorTo === "end" && this.scrollElement !== null) {
|
|
73532
|
+
const prevCount = prevOptions.count;
|
|
73533
|
+
const nextCount = merged.count;
|
|
73534
|
+
const measurements = this.getMeasurements();
|
|
73535
|
+
const prevFirstKey = prevCount > 0 ? ((_a = measurements[0]) == null ? void 0 : _a.key) ?? prevOptions.getItemKey(0) : null;
|
|
73536
|
+
const prevLastKey = prevCount > 0 ? ((_b = measurements[prevCount - 1]) == null ? void 0 : _b.key) ?? prevOptions.getItemKey(prevCount - 1) : null;
|
|
73537
|
+
const didCountChange = nextCount !== prevCount;
|
|
73538
|
+
const didEdgeKeysChange = didCountChange || prevCount > 0 && nextCount > 0 && (merged.getItemKey(0) !== prevFirstKey || merged.getItemKey(nextCount - 1) !== prevLastKey);
|
|
73539
|
+
if (didEdgeKeysChange) {
|
|
73540
|
+
const item = prevCount > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? measurements[0] : null;
|
|
73541
|
+
if (item) {
|
|
73542
|
+
anchor = [item.key, this.getScrollOffset() - item.start];
|
|
73543
|
+
}
|
|
73544
|
+
const behavior = merged.followOnAppend === true ? "auto" : merged.followOnAppend || null;
|
|
73545
|
+
if (behavior && nextCount > prevCount && this.isAtEnd(prevOptions.scrollEndThreshold) && (prevCount === 0 || merged.getItemKey(nextCount - 1) !== prevLastKey)) {
|
|
73546
|
+
followOnAppend = behavior;
|
|
73547
|
+
}
|
|
73548
|
+
}
|
|
73549
|
+
}
|
|
73550
|
+
this.options = merged;
|
|
73551
|
+
if (anchor || followOnAppend) {
|
|
73552
|
+
this.pendingScrollAnchor = [
|
|
73553
|
+
(anchor == null ? void 0 : anchor[0]) ?? null,
|
|
73554
|
+
(anchor == null ? void 0 : anchor[1]) ?? 0,
|
|
73555
|
+
followOnAppend
|
|
73556
|
+
];
|
|
73557
|
+
}
|
|
73060
73558
|
};
|
|
73061
73559
|
this.notify = (sync) => {
|
|
73062
73560
|
var _a, _b;
|
|
@@ -73127,21 +73625,104 @@ focus outline in that case.
|
|
|
73127
73625
|
);
|
|
73128
73626
|
this.unsubs.push(
|
|
73129
73627
|
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
73628
|
+
if (this._intendedScrollOffset !== null && Math.abs(offset - this._intendedScrollOffset) < 1.5) {
|
|
73629
|
+
offset = this._intendedScrollOffset;
|
|
73630
|
+
}
|
|
73631
|
+
this._intendedScrollOffset = null;
|
|
73130
73632
|
this.scrollAdjustments = 0;
|
|
73131
73633
|
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
73132
73634
|
this.scrollOffset = offset;
|
|
73133
73635
|
this.isScrolling = isScrolling;
|
|
73636
|
+
this._flushIosDeferredIfReady();
|
|
73134
73637
|
if (this.scrollState) {
|
|
73135
73638
|
this.scheduleScrollReconcile();
|
|
73136
73639
|
}
|
|
73137
73640
|
this.maybeNotify();
|
|
73138
73641
|
})
|
|
73139
73642
|
);
|
|
73643
|
+
if ("addEventListener" in this.scrollElement) {
|
|
73644
|
+
const scrollEl = this.scrollElement;
|
|
73645
|
+
const onTouchStart = () => {
|
|
73646
|
+
this._iosTouching = true;
|
|
73647
|
+
this._iosJustTouchEnded = false;
|
|
73648
|
+
if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
|
|
73649
|
+
this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
|
|
73650
|
+
this._iosTouchEndTimerId = null;
|
|
73651
|
+
}
|
|
73652
|
+
};
|
|
73653
|
+
const onTouchEnd = () => {
|
|
73654
|
+
this._iosTouching = false;
|
|
73655
|
+
if (!isIOSWebKit() || this.targetWindow == null) {
|
|
73656
|
+
return;
|
|
73657
|
+
}
|
|
73658
|
+
this._iosJustTouchEnded = true;
|
|
73659
|
+
this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
|
|
73660
|
+
this._iosJustTouchEnded = false;
|
|
73661
|
+
this._iosTouchEndTimerId = null;
|
|
73662
|
+
this._flushIosDeferredIfReady();
|
|
73663
|
+
}, 150);
|
|
73664
|
+
};
|
|
73665
|
+
scrollEl.addEventListener(
|
|
73666
|
+
"touchstart",
|
|
73667
|
+
onTouchStart,
|
|
73668
|
+
addEventListenerOptions
|
|
73669
|
+
);
|
|
73670
|
+
scrollEl.addEventListener(
|
|
73671
|
+
"touchend",
|
|
73672
|
+
onTouchEnd,
|
|
73673
|
+
addEventListenerOptions
|
|
73674
|
+
);
|
|
73675
|
+
this.unsubs.push(() => {
|
|
73676
|
+
scrollEl.removeEventListener("touchstart", onTouchStart);
|
|
73677
|
+
scrollEl.removeEventListener("touchend", onTouchEnd);
|
|
73678
|
+
if (this._iosTouchEndTimerId !== null && this.targetWindow != null) {
|
|
73679
|
+
this.targetWindow.clearTimeout(this._iosTouchEndTimerId);
|
|
73680
|
+
this._iosTouchEndTimerId = null;
|
|
73681
|
+
}
|
|
73682
|
+
});
|
|
73683
|
+
}
|
|
73140
73684
|
this._scrollToOffset(this.getScrollOffset(), {
|
|
73141
73685
|
adjustments: void 0,
|
|
73142
73686
|
behavior: void 0
|
|
73143
73687
|
});
|
|
73144
73688
|
}
|
|
73689
|
+
const anchor = this.pendingScrollAnchor;
|
|
73690
|
+
this.pendingScrollAnchor = null;
|
|
73691
|
+
if (anchor && this.scrollElement && this.options.enabled) {
|
|
73692
|
+
const [key, offset, followOnAppend] = anchor;
|
|
73693
|
+
if (key !== null) {
|
|
73694
|
+
const { count, getItemKey } = this.options;
|
|
73695
|
+
let index = 0;
|
|
73696
|
+
while (index < count && getItemKey(index) !== key) {
|
|
73697
|
+
index++;
|
|
73698
|
+
}
|
|
73699
|
+
const item = index < count ? this.getMeasurements()[index] : void 0;
|
|
73700
|
+
if (item) {
|
|
73701
|
+
const delta = item.start + offset - this.getScrollOffset();
|
|
73702
|
+
if (!approxEqual(delta, 0)) {
|
|
73703
|
+
this.applyScrollAdjustment(delta);
|
|
73704
|
+
}
|
|
73705
|
+
}
|
|
73706
|
+
}
|
|
73707
|
+
if (followOnAppend) {
|
|
73708
|
+
this.scrollToEnd({ behavior: followOnAppend });
|
|
73709
|
+
}
|
|
73710
|
+
}
|
|
73711
|
+
};
|
|
73712
|
+
this._flushIosDeferredIfReady = () => {
|
|
73713
|
+
if (this._iosDeferredAdjustment === 0) return;
|
|
73714
|
+
if (this.isScrolling) return;
|
|
73715
|
+
if (this._iosTouching) return;
|
|
73716
|
+
if (this._iosJustTouchEnded) return;
|
|
73717
|
+
const cur = this.getScrollOffset();
|
|
73718
|
+
const max = this.getMaxScrollOffset();
|
|
73719
|
+
if (cur < 0 || cur > max) return;
|
|
73720
|
+
const delta = this._iosDeferredAdjustment;
|
|
73721
|
+
this._iosDeferredAdjustment = 0;
|
|
73722
|
+
this._scrollToOffset(cur, {
|
|
73723
|
+
adjustments: this.scrollAdjustments += delta,
|
|
73724
|
+
behavior: void 0
|
|
73725
|
+
});
|
|
73145
73726
|
};
|
|
73146
73727
|
this.rafId = null;
|
|
73147
73728
|
this.getSize = () => {
|
|
@@ -73203,7 +73784,7 @@ focus outline in that case.
|
|
|
73203
73784
|
this.lanesChangedFlag = true;
|
|
73204
73785
|
}
|
|
73205
73786
|
this.prevLanes = lanes;
|
|
73206
|
-
this.
|
|
73787
|
+
this.pendingMin = null;
|
|
73207
73788
|
return {
|
|
73208
73789
|
count,
|
|
73209
73790
|
paddingStart,
|
|
@@ -73219,7 +73800,7 @@ focus outline in that case.
|
|
|
73219
73800
|
}
|
|
73220
73801
|
);
|
|
73221
73802
|
this.getMeasurements = memo(
|
|
73222
|
-
() => [this.getMeasurementOptions(), this.
|
|
73803
|
+
() => [this.getMeasurementOptions(), this.itemSizeCacheVersion],
|
|
73223
73804
|
({
|
|
73224
73805
|
count,
|
|
73225
73806
|
paddingStart,
|
|
@@ -73228,7 +73809,8 @@ focus outline in that case.
|
|
|
73228
73809
|
enabled,
|
|
73229
73810
|
lanes,
|
|
73230
73811
|
laneAssignmentMode
|
|
73231
|
-
},
|
|
73812
|
+
}, _itemSizeCacheVersion) => {
|
|
73813
|
+
const itemSizeCache = this.itemSizeCache;
|
|
73232
73814
|
if (!enabled) {
|
|
73233
73815
|
this.measurementsCache = [];
|
|
73234
73816
|
this.itemSizeCache.clear();
|
|
@@ -73248,7 +73830,7 @@ focus outline in that case.
|
|
|
73248
73830
|
this.measurementsCache = [];
|
|
73249
73831
|
this.itemSizeCache.clear();
|
|
73250
73832
|
this.laneAssignments.clear();
|
|
73251
|
-
this.
|
|
73833
|
+
this.pendingMin = null;
|
|
73252
73834
|
}
|
|
73253
73835
|
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
73254
73836
|
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
@@ -73256,11 +73838,40 @@ focus outline in that case.
|
|
|
73256
73838
|
this.itemSizeCache.set(item.key, item.size);
|
|
73257
73839
|
});
|
|
73258
73840
|
}
|
|
73259
|
-
const min = this.lanesSettling ? 0 : this.
|
|
73260
|
-
this.
|
|
73841
|
+
const min = this.lanesSettling ? 0 : this.pendingMin ?? 0;
|
|
73842
|
+
this.pendingMin = null;
|
|
73261
73843
|
if (this.lanesSettling && this.measurementsCache.length === count) {
|
|
73262
73844
|
this.lanesSettling = false;
|
|
73263
73845
|
}
|
|
73846
|
+
if (lanes === 1) {
|
|
73847
|
+
const gap = this.options.gap;
|
|
73848
|
+
const need = count * 2;
|
|
73849
|
+
let flat = this._flatMeasurements;
|
|
73850
|
+
if (!flat || flat.length < need) {
|
|
73851
|
+
const next = new Float64Array(need);
|
|
73852
|
+
if (flat && min > 0) next.set(flat.subarray(0, min * 2));
|
|
73853
|
+
flat = next;
|
|
73854
|
+
this._flatMeasurements = flat;
|
|
73855
|
+
}
|
|
73856
|
+
let runningStart;
|
|
73857
|
+
if (min === 0) {
|
|
73858
|
+
runningStart = paddingStart + scrollMargin;
|
|
73859
|
+
} else {
|
|
73860
|
+
const prevIdx = min - 1;
|
|
73861
|
+
runningStart = flat[prevIdx * 2] + flat[prevIdx * 2 + 1] + gap;
|
|
73862
|
+
}
|
|
73863
|
+
for (let i = min; i < count; i++) {
|
|
73864
|
+
const key = getItemKey(i);
|
|
73865
|
+
const measuredSize = itemSizeCache.get(key);
|
|
73866
|
+
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
73867
|
+
flat[i * 2] = runningStart;
|
|
73868
|
+
flat[i * 2 + 1] = size;
|
|
73869
|
+
runningStart += size + gap;
|
|
73870
|
+
}
|
|
73871
|
+
const view = createLazyMeasurementsView(count, flat, getItemKey);
|
|
73872
|
+
this.measurementsCache = view;
|
|
73873
|
+
return view;
|
|
73874
|
+
}
|
|
73264
73875
|
const measurements = this.measurementsCache.slice(0, min);
|
|
73265
73876
|
const laneLastIndex = new Array(lanes).fill(
|
|
73266
73877
|
void 0
|
|
@@ -73323,7 +73934,11 @@ focus outline in that case.
|
|
|
73323
73934
|
measurements,
|
|
73324
73935
|
outerSize,
|
|
73325
73936
|
scrollOffset,
|
|
73326
|
-
lanes
|
|
73937
|
+
lanes,
|
|
73938
|
+
// Pass the typed array so binary search + forward-walk can
|
|
73939
|
+
// read start/end directly from Float64Array, skipping the
|
|
73940
|
+
// Proxy traps that materialize a full VirtualItem per probe.
|
|
73941
|
+
flat: lanes === 1 && this._flatMeasurements != null ? this._flatMeasurements : null
|
|
73327
73942
|
}) : null;
|
|
73328
73943
|
},
|
|
73329
73944
|
{
|
|
@@ -73418,23 +74033,60 @@ focus outline in that case.
|
|
|
73418
74033
|
}
|
|
73419
74034
|
};
|
|
73420
74035
|
this.resizeItem = (index, size) => {
|
|
73421
|
-
var _a;
|
|
73422
|
-
|
|
73423
|
-
|
|
73424
|
-
|
|
74036
|
+
var _a, _b;
|
|
74037
|
+
if (index < 0 || index >= this.options.count) return;
|
|
74038
|
+
let cachedSize;
|
|
74039
|
+
let itemStart;
|
|
74040
|
+
let key;
|
|
74041
|
+
const flat = this._flatMeasurements;
|
|
74042
|
+
if (this.options.lanes === 1 && flat !== null) {
|
|
74043
|
+
key = this.options.getItemKey(index);
|
|
74044
|
+
itemStart = flat[index * 2];
|
|
74045
|
+
cachedSize = flat[index * 2 + 1];
|
|
74046
|
+
} else {
|
|
74047
|
+
const item = this.measurementsCache[index];
|
|
74048
|
+
if (!item) return;
|
|
74049
|
+
key = item.key;
|
|
74050
|
+
itemStart = item.start;
|
|
74051
|
+
cachedSize = item.size;
|
|
74052
|
+
}
|
|
74053
|
+
const itemSize = this.itemSizeCache.get(key) ?? cachedSize;
|
|
73425
74054
|
const delta = size - itemSize;
|
|
73426
74055
|
if (delta !== 0) {
|
|
73427
|
-
|
|
73428
|
-
|
|
73429
|
-
|
|
73430
|
-
|
|
73431
|
-
|
|
73432
|
-
|
|
73433
|
-
|
|
73434
|
-
|
|
74056
|
+
const wasAtEnd = this.options.anchorTo === "end" && ((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold;
|
|
74057
|
+
const prevTotalSize = wasAtEnd ? this.getTotalSize() : 0;
|
|
74058
|
+
const shouldAdjustScroll = ((_b = this.scrollState) == null ? void 0 : _b.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(
|
|
74059
|
+
// The callback expects a VirtualItem; build one lazily only
|
|
74060
|
+
// when the consumer actually supplied a custom predicate.
|
|
74061
|
+
this.measurementsCache[index] ?? {
|
|
74062
|
+
index,
|
|
74063
|
+
key,
|
|
74064
|
+
start: itemStart,
|
|
74065
|
+
size: cachedSize,
|
|
74066
|
+
end: itemStart + cachedSize,
|
|
74067
|
+
lane: 0
|
|
74068
|
+
},
|
|
74069
|
+
delta,
|
|
74070
|
+
this
|
|
74071
|
+
) : (
|
|
74072
|
+
// Default: adjust scrollTop only when the resize is an above-
|
|
74073
|
+
// viewport item AND we're not actively scrolling backward.
|
|
74074
|
+
// Adjusting during backward scroll fights the user's scroll
|
|
74075
|
+
// direction and produces the "items jump while scrolling up"
|
|
74076
|
+
// jank reported across many issues. Users who want the old
|
|
74077
|
+
// behavior can pass shouldAdjustScrollPositionOnItemSizeChange.
|
|
74078
|
+
itemStart < this.getScrollOffset() + this.scrollAdjustments && this.scrollDirection !== "backward"
|
|
74079
|
+
));
|
|
74080
|
+
if (this.pendingMin === null || index < this.pendingMin) {
|
|
74081
|
+
this.pendingMin = index;
|
|
74082
|
+
}
|
|
74083
|
+
this.itemSizeCache.set(key, size);
|
|
74084
|
+
this.itemSizeCacheVersion++;
|
|
74085
|
+
if (wasAtEnd) {
|
|
74086
|
+
this.applyScrollAdjustment(this.getTotalSize() - prevTotalSize);
|
|
74087
|
+
} else if (shouldAdjustScroll) {
|
|
74088
|
+
this.applyScrollAdjustment(delta);
|
|
73435
74089
|
}
|
|
73436
|
-
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
73437
|
-
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
73438
74090
|
this.notify(false);
|
|
73439
74091
|
}
|
|
73440
74092
|
};
|
|
@@ -73459,14 +74111,15 @@ focus outline in that case.
|
|
|
73459
74111
|
if (measurements.length === 0) {
|
|
73460
74112
|
return void 0;
|
|
73461
74113
|
}
|
|
73462
|
-
|
|
73463
|
-
|
|
73464
|
-
|
|
73465
|
-
|
|
73466
|
-
|
|
73467
|
-
|
|
73468
|
-
|
|
74114
|
+
const flat = this._flatMeasurements;
|
|
74115
|
+
const useFlat = this.options.lanes === 1 && flat != null;
|
|
74116
|
+
const idx = findNearestBinarySearch(
|
|
74117
|
+
0,
|
|
74118
|
+
measurements.length - 1,
|
|
74119
|
+
useFlat ? (i) => flat[i * 2] : (i) => notUndefined(measurements[i]).start,
|
|
74120
|
+
offset
|
|
73469
74121
|
);
|
|
74122
|
+
return notUndefined(measurements[idx]);
|
|
73470
74123
|
};
|
|
73471
74124
|
this.getMaxScrollOffset = () => {
|
|
73472
74125
|
if (!this.scrollElement) return 0;
|
|
@@ -73477,6 +74130,18 @@ focus outline in that case.
|
|
|
73477
74130
|
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
73478
74131
|
}
|
|
73479
74132
|
};
|
|
74133
|
+
this.getVirtualDistanceFromEnd = () => {
|
|
74134
|
+
return Math.max(
|
|
74135
|
+
this.getTotalSize() - this.getSize() - this.getScrollOffset(),
|
|
74136
|
+
0
|
|
74137
|
+
);
|
|
74138
|
+
};
|
|
74139
|
+
this.getDistanceFromEnd = () => {
|
|
74140
|
+
return Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0);
|
|
74141
|
+
};
|
|
74142
|
+
this.isAtEnd = (threshold = this.options.scrollEndThreshold) => {
|
|
74143
|
+
return this.getDistanceFromEnd() <= threshold;
|
|
74144
|
+
};
|
|
73480
74145
|
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
73481
74146
|
if (!this.scrollElement) return 0;
|
|
73482
74147
|
const size = this.getSize();
|
|
@@ -73566,6 +74231,18 @@ focus outline in that case.
|
|
|
73566
74231
|
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
73567
74232
|
this.scheduleScrollReconcile();
|
|
73568
74233
|
};
|
|
74234
|
+
this.scrollToEnd = ({ behavior = "auto" } = {}) => {
|
|
74235
|
+
if (this.options.count > 0) {
|
|
74236
|
+
this.scrollToIndex(this.options.count - 1, {
|
|
74237
|
+
align: "end",
|
|
74238
|
+
behavior
|
|
74239
|
+
});
|
|
74240
|
+
return;
|
|
74241
|
+
}
|
|
74242
|
+
this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), {
|
|
74243
|
+
behavior
|
|
74244
|
+
});
|
|
74245
|
+
};
|
|
73569
74246
|
this.getTotalSize = () => {
|
|
73570
74247
|
var _a;
|
|
73571
74248
|
const measurements = this.getMeasurements();
|
|
@@ -73573,7 +74250,13 @@ focus outline in that case.
|
|
|
73573
74250
|
if (measurements.length === 0) {
|
|
73574
74251
|
end = this.options.paddingStart;
|
|
73575
74252
|
} else if (this.options.lanes === 1) {
|
|
73576
|
-
|
|
74253
|
+
const lastIdx = measurements.length - 1;
|
|
74254
|
+
const flat = this._flatMeasurements;
|
|
74255
|
+
if (flat != null) {
|
|
74256
|
+
end = flat[lastIdx * 2] + flat[lastIdx * 2 + 1];
|
|
74257
|
+
} else {
|
|
74258
|
+
end = ((_a = measurements[lastIdx]) == null ? void 0 : _a.end) ?? 0;
|
|
74259
|
+
}
|
|
73577
74260
|
} else {
|
|
73578
74261
|
const endByLane = Array(this.options.lanes).fill(null);
|
|
73579
74262
|
let endIndex = measurements.length - 1;
|
|
@@ -73591,19 +74274,54 @@ focus outline in that case.
|
|
|
73591
74274
|
0
|
|
73592
74275
|
);
|
|
73593
74276
|
};
|
|
74277
|
+
this.takeSnapshot = () => {
|
|
74278
|
+
const snapshot = [];
|
|
74279
|
+
if (this.itemSizeCache.size === 0) return snapshot;
|
|
74280
|
+
const m = this.getMeasurements();
|
|
74281
|
+
for (const item of m) {
|
|
74282
|
+
if (item && this.itemSizeCache.has(item.key)) {
|
|
74283
|
+
snapshot.push({
|
|
74284
|
+
index: item.index,
|
|
74285
|
+
key: item.key,
|
|
74286
|
+
start: item.start,
|
|
74287
|
+
size: item.size,
|
|
74288
|
+
end: item.end,
|
|
74289
|
+
lane: item.lane
|
|
74290
|
+
});
|
|
74291
|
+
}
|
|
74292
|
+
}
|
|
74293
|
+
return snapshot;
|
|
74294
|
+
};
|
|
73594
74295
|
this._scrollToOffset = (offset, {
|
|
73595
74296
|
adjustments,
|
|
73596
74297
|
behavior
|
|
73597
74298
|
}) => {
|
|
74299
|
+
this._intendedScrollOffset = offset + (adjustments ?? 0);
|
|
73598
74300
|
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
73599
74301
|
};
|
|
73600
74302
|
this.measure = () => {
|
|
73601
|
-
this.
|
|
73602
|
-
this.
|
|
74303
|
+
this.pendingMin = null;
|
|
74304
|
+
this.itemSizeCache.clear();
|
|
74305
|
+
this.laneAssignments.clear();
|
|
74306
|
+
this.itemSizeCacheVersion++;
|
|
73603
74307
|
this.notify(false);
|
|
73604
74308
|
};
|
|
73605
74309
|
this.setOptions(opts);
|
|
73606
74310
|
}
|
|
74311
|
+
applyScrollAdjustment(delta, behavior) {
|
|
74312
|
+
if (delta === 0) return;
|
|
74313
|
+
if (this.options.debug) {
|
|
74314
|
+
console.info("correction", delta);
|
|
74315
|
+
}
|
|
74316
|
+
if (isIOSWebKit() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) {
|
|
74317
|
+
this._iosDeferredAdjustment += delta;
|
|
74318
|
+
} else {
|
|
74319
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
74320
|
+
adjustments: this.scrollAdjustments += delta,
|
|
74321
|
+
behavior
|
|
74322
|
+
});
|
|
74323
|
+
}
|
|
74324
|
+
}
|
|
73607
74325
|
scheduleScrollReconcile() {
|
|
73608
74326
|
if (!this.targetWindow) {
|
|
73609
74327
|
this.scrollState = null;
|
|
@@ -73631,17 +74349,28 @@ focus outline in that case.
|
|
|
73631
74349
|
if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
|
|
73632
74350
|
this.scrollState.stableFrames++;
|
|
73633
74351
|
if (this.scrollState.stableFrames >= STABLE_FRAMES) {
|
|
74352
|
+
if (this.getScrollOffset() !== targetOffset) {
|
|
74353
|
+
this._scrollToOffset(targetOffset, {
|
|
74354
|
+
adjustments: void 0,
|
|
74355
|
+
behavior: "auto"
|
|
74356
|
+
});
|
|
74357
|
+
}
|
|
73634
74358
|
this.scrollState = null;
|
|
73635
74359
|
return;
|
|
73636
74360
|
}
|
|
73637
74361
|
} else {
|
|
73638
74362
|
this.scrollState.stableFrames = 0;
|
|
73639
74363
|
if (targetChanged) {
|
|
74364
|
+
const viewport = this.getSize() || 600;
|
|
74365
|
+
const distance = Math.abs(targetOffset - this.getScrollOffset());
|
|
74366
|
+
const keepSmooth = this.scrollState.behavior === "smooth" && distance > viewport;
|
|
73640
74367
|
this.scrollState.lastTargetOffset = targetOffset;
|
|
73641
|
-
|
|
74368
|
+
if (!keepSmooth) {
|
|
74369
|
+
this.scrollState.behavior = "auto";
|
|
74370
|
+
}
|
|
73642
74371
|
this._scrollToOffset(targetOffset, {
|
|
73643
74372
|
adjustments: void 0,
|
|
73644
|
-
behavior: "auto"
|
|
74373
|
+
behavior: keepSmooth ? "smooth" : "auto"
|
|
73645
74374
|
});
|
|
73646
74375
|
}
|
|
73647
74376
|
}
|
|
@@ -73670,25 +74399,22 @@ focus outline in that case.
|
|
|
73670
74399
|
measurements,
|
|
73671
74400
|
outerSize,
|
|
73672
74401
|
scrollOffset,
|
|
73673
|
-
lanes
|
|
74402
|
+
lanes,
|
|
74403
|
+
flat
|
|
73674
74404
|
}) {
|
|
73675
74405
|
const lastIndex = measurements.length - 1;
|
|
73676
|
-
const
|
|
74406
|
+
const getStart = flat ? (index) => flat[index * 2] : (index) => measurements[index].start;
|
|
74407
|
+
const getEnd = flat ? (index) => flat[index * 2] + flat[index * 2 + 1] : (index) => measurements[index].end;
|
|
73677
74408
|
if (measurements.length <= lanes) {
|
|
73678
74409
|
return {
|
|
73679
74410
|
startIndex: 0,
|
|
73680
74411
|
endIndex: lastIndex
|
|
73681
74412
|
};
|
|
73682
74413
|
}
|
|
73683
|
-
let startIndex = findNearestBinarySearch(
|
|
73684
|
-
0,
|
|
73685
|
-
lastIndex,
|
|
73686
|
-
getOffset,
|
|
73687
|
-
scrollOffset
|
|
73688
|
-
);
|
|
74414
|
+
let startIndex = findNearestBinarySearch(0, lastIndex, getStart, scrollOffset);
|
|
73689
74415
|
let endIndex = startIndex;
|
|
73690
74416
|
if (lanes === 1) {
|
|
73691
|
-
while (endIndex < lastIndex &&
|
|
74417
|
+
while (endIndex < lastIndex && getEnd(endIndex) < scrollOffset + outerSize) {
|
|
73692
74418
|
endIndex++;
|
|
73693
74419
|
}
|
|
73694
74420
|
} else if (lanes > 1) {
|