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