@ni/nimble-components 27.2.0 → 27.2.2
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.
|
@@ -16333,7 +16333,7 @@
|
|
|
16333
16333
|
|
|
16334
16334
|
/**
|
|
16335
16335
|
* Do not edit directly
|
|
16336
|
-
* Generated on Wed, 01 May 2024
|
|
16336
|
+
* Generated on Wed, 01 May 2024 21:32:12 GMT
|
|
16337
16337
|
*/
|
|
16338
16338
|
|
|
16339
16339
|
const Information100DarkUi = "#a46eff";
|
|
@@ -26708,8 +26708,6 @@
|
|
|
26708
26708
|
function insertInto(content, dist, insert, parent) {
|
|
26709
26709
|
let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
|
|
26710
26710
|
if (offset == dist || child.isText) {
|
|
26711
|
-
if (parent && !parent.canReplace(index, index, insert))
|
|
26712
|
-
return null;
|
|
26713
26711
|
return content.cut(0, dist).append(insert).append(content.cut(dist));
|
|
26714
26712
|
}
|
|
26715
26713
|
let inner = insertInto(child.content, dist - offset - 1, insert);
|
|
@@ -35253,7 +35251,7 @@
|
|
|
35253
35251
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
35254
35252
|
let text = view.someProp("clipboardTextSerializer", f => f(slice, view)) ||
|
|
35255
35253
|
slice.content.textBetween(0, slice.content.size, "\n\n");
|
|
35256
|
-
return { dom: wrap, text };
|
|
35254
|
+
return { dom: wrap, text, slice };
|
|
35257
35255
|
}
|
|
35258
35256
|
// Read a slice of content from the clipboard (or drop data).
|
|
35259
35257
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
@@ -35638,8 +35636,7 @@
|
|
|
35638
35636
|
if (!view.focused)
|
|
35639
35637
|
view.focus();
|
|
35640
35638
|
let tr = view.state.tr.setSelection(selection);
|
|
35641
|
-
|
|
35642
|
-
tr.setMeta("pointer", true);
|
|
35639
|
+
tr.setMeta("pointer", true);
|
|
35643
35640
|
view.dispatch(tr);
|
|
35644
35641
|
}
|
|
35645
35642
|
function selectClickedLeaf(view, inside) {
|
|
@@ -35647,7 +35644,7 @@
|
|
|
35647
35644
|
return false;
|
|
35648
35645
|
let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
|
|
35649
35646
|
if (node && node.isAtom && NodeSelection.isSelectable(node)) {
|
|
35650
|
-
updateSelection(view, new NodeSelection($pos)
|
|
35647
|
+
updateSelection(view, new NodeSelection($pos));
|
|
35651
35648
|
return true;
|
|
35652
35649
|
}
|
|
35653
35650
|
return false;
|
|
@@ -35671,7 +35668,7 @@
|
|
|
35671
35668
|
}
|
|
35672
35669
|
}
|
|
35673
35670
|
if (selectAt != null) {
|
|
35674
|
-
updateSelection(view, NodeSelection.create(view.state.doc, selectAt)
|
|
35671
|
+
updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
|
|
35675
35672
|
return true;
|
|
35676
35673
|
}
|
|
35677
35674
|
else {
|
|
@@ -35698,7 +35695,7 @@
|
|
|
35698
35695
|
let doc = view.state.doc;
|
|
35699
35696
|
if (inside == -1) {
|
|
35700
35697
|
if (doc.inlineContent) {
|
|
35701
|
-
updateSelection(view, TextSelection.create(doc, 0, doc.content.size)
|
|
35698
|
+
updateSelection(view, TextSelection.create(doc, 0, doc.content.size));
|
|
35702
35699
|
return true;
|
|
35703
35700
|
}
|
|
35704
35701
|
return false;
|
|
@@ -35708,9 +35705,9 @@
|
|
|
35708
35705
|
let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
|
|
35709
35706
|
let nodePos = $pos.before(i);
|
|
35710
35707
|
if (node.inlineContent)
|
|
35711
|
-
updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size)
|
|
35708
|
+
updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size));
|
|
35712
35709
|
else if (NodeSelection.isSelectable(node))
|
|
35713
|
-
updateSelection(view, NodeSelection.create(doc, nodePos)
|
|
35710
|
+
updateSelection(view, NodeSelection.create(doc, nodePos));
|
|
35714
35711
|
else
|
|
35715
35712
|
continue;
|
|
35716
35713
|
return true;
|
|
@@ -35838,7 +35835,7 @@
|
|
|
35838
35835
|
// works around that.
|
|
35839
35836
|
(chrome && !this.view.state.selection.visible &&
|
|
35840
35837
|
Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2))) {
|
|
35841
|
-
updateSelection(this.view, Selection$2.near(this.view.state.doc.resolve(pos.pos))
|
|
35838
|
+
updateSelection(this.view, Selection$2.near(this.view.state.doc.resolve(pos.pos)));
|
|
35842
35839
|
event.preventDefault();
|
|
35843
35840
|
}
|
|
35844
35841
|
else {
|
|
@@ -35968,7 +35965,7 @@
|
|
|
35968
35965
|
return textAfter;
|
|
35969
35966
|
}
|
|
35970
35967
|
}
|
|
35971
|
-
return textBefore;
|
|
35968
|
+
return textBefore || textAfter;
|
|
35972
35969
|
}
|
|
35973
35970
|
function timestampFromCustomEvent() {
|
|
35974
35971
|
let event = document.createEvent("Event");
|
|
@@ -36125,7 +36122,8 @@
|
|
|
36125
36122
|
if (desc && desc.node.type.spec.draggable && desc != view.docView)
|
|
36126
36123
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
36127
36124
|
}
|
|
36128
|
-
let
|
|
36125
|
+
let draggedSlice = (node || view.state.selection).content();
|
|
36126
|
+
let { dom, text, slice } = serializeForClipboard(view, draggedSlice);
|
|
36129
36127
|
event.dataTransfer.clearData();
|
|
36130
36128
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
36131
36129
|
// See https://github.com/ProseMirror/prosemirror/issues/1156
|
|
@@ -42584,7 +42582,7 @@ img.ProseMirror-separator {
|
|
|
42584
42582
|
}`;
|
|
42585
42583
|
|
|
42586
42584
|
function createStyleTag(style, nonce, suffix) {
|
|
42587
|
-
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${
|
|
42585
|
+
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${''}]`);
|
|
42588
42586
|
if (tiptapStyleTag !== null) {
|
|
42589
42587
|
return tiptapStyleTag;
|
|
42590
42588
|
}
|
|
@@ -42592,7 +42590,7 @@ img.ProseMirror-separator {
|
|
|
42592
42590
|
if (nonce) {
|
|
42593
42591
|
styleNode.setAttribute('nonce', nonce);
|
|
42594
42592
|
}
|
|
42595
|
-
styleNode.setAttribute(`data-tiptap-style${
|
|
42593
|
+
styleNode.setAttribute(`data-tiptap-style${''}`, '');
|
|
42596
42594
|
styleNode.innerHTML = style;
|
|
42597
42595
|
document.getElementsByTagName('head')[0].appendChild(styleNode);
|
|
42598
42596
|
return styleNode;
|
|
@@ -60674,7 +60672,7 @@ img.ProseMirror-separator {
|
|
|
60674
60672
|
var _row$getValue;
|
|
60675
60673
|
return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
|
|
60676
60674
|
},
|
|
60677
|
-
subRows:
|
|
60675
|
+
subRows: [],
|
|
60678
60676
|
getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
|
|
60679
60677
|
getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,
|
|
60680
60678
|
getParentRows: () => {
|
|
@@ -65188,12 +65186,19 @@ img.ProseMirror-separator {
|
|
|
65188
65186
|
}
|
|
65189
65187
|
function notUndefined(value, msg) {
|
|
65190
65188
|
if (value === void 0) {
|
|
65191
|
-
throw new Error(`Unexpected undefined${
|
|
65189
|
+
throw new Error(`Unexpected undefined${""}`);
|
|
65192
65190
|
} else {
|
|
65193
65191
|
return value;
|
|
65194
65192
|
}
|
|
65195
65193
|
}
|
|
65196
65194
|
const approxEqual = (a, b) => Math.abs(a - b) < 1;
|
|
65195
|
+
const debounce = (fn, ms) => {
|
|
65196
|
+
let timeoutId;
|
|
65197
|
+
return function(...args) {
|
|
65198
|
+
clearTimeout(timeoutId);
|
|
65199
|
+
timeoutId = setTimeout(() => fn.apply(this, args), ms);
|
|
65200
|
+
};
|
|
65201
|
+
};
|
|
65197
65202
|
|
|
65198
65203
|
const defaultKeyExtractor = (index) => index;
|
|
65199
65204
|
const defaultRangeExtractor = (range) => {
|
|
@@ -65235,20 +65240,32 @@ img.ProseMirror-separator {
|
|
|
65235
65240
|
observer.unobserve(element);
|
|
65236
65241
|
};
|
|
65237
65242
|
};
|
|
65243
|
+
const addEventListenerOptions = {
|
|
65244
|
+
passive: true
|
|
65245
|
+
};
|
|
65246
|
+
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
65238
65247
|
const observeElementOffset = (instance, cb) => {
|
|
65239
65248
|
const element = instance.scrollElement;
|
|
65240
65249
|
if (!element) {
|
|
65241
65250
|
return;
|
|
65242
65251
|
}
|
|
65243
|
-
|
|
65244
|
-
|
|
65252
|
+
let offset = 0;
|
|
65253
|
+
const fallback = supportsScrollend ? () => void 0 : debounce(() => {
|
|
65254
|
+
cb(offset, false);
|
|
65255
|
+
}, instance.options.isScrollingResetDelay);
|
|
65256
|
+
const createHandler = (isScrolling) => () => {
|
|
65257
|
+
offset = element[instance.options.horizontal ? "scrollLeft" : "scrollTop"];
|
|
65258
|
+
fallback();
|
|
65259
|
+
cb(offset, isScrolling);
|
|
65245
65260
|
};
|
|
65246
|
-
handler();
|
|
65247
|
-
|
|
65248
|
-
|
|
65249
|
-
|
|
65261
|
+
const handler = createHandler(true);
|
|
65262
|
+
const endHandler = createHandler(false);
|
|
65263
|
+
endHandler();
|
|
65264
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
65265
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
65250
65266
|
return () => {
|
|
65251
65267
|
element.removeEventListener("scroll", handler);
|
|
65268
|
+
element.removeEventListener("scrollend", endHandler);
|
|
65252
65269
|
};
|
|
65253
65270
|
};
|
|
65254
65271
|
const measureElement = (element, entry, instance) => {
|
|
@@ -65281,7 +65298,6 @@ img.ProseMirror-separator {
|
|
|
65281
65298
|
this.unsubs = [];
|
|
65282
65299
|
this.scrollElement = null;
|
|
65283
65300
|
this.isScrolling = false;
|
|
65284
|
-
this.isScrollingTimeoutId = null;
|
|
65285
65301
|
this.scrollToIndexTimeoutId = null;
|
|
65286
65302
|
this.measurementsCache = [];
|
|
65287
65303
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
@@ -65342,39 +65358,24 @@ img.ProseMirror-separator {
|
|
|
65342
65358
|
initialRect: { width: 0, height: 0 },
|
|
65343
65359
|
scrollMargin: 0,
|
|
65344
65360
|
gap: 0,
|
|
65345
|
-
scrollingDelay: 150,
|
|
65346
65361
|
indexAttribute: "data-index",
|
|
65347
65362
|
initialMeasurementsCache: [],
|
|
65348
65363
|
lanes: 1,
|
|
65364
|
+
isScrollingResetDelay: 150,
|
|
65349
65365
|
...opts2
|
|
65350
65366
|
};
|
|
65351
65367
|
};
|
|
65352
|
-
this.notify = (sync) => {
|
|
65368
|
+
this.notify = (force, sync) => {
|
|
65353
65369
|
var _a, _b;
|
|
65354
|
-
|
|
65355
|
-
|
|
65356
|
-
|
|
65357
|
-
|
|
65358
|
-
|
|
65359
|
-
|
|
65360
|
-
|
|
65361
|
-
this.range ? this.range.startIndex : null,
|
|
65362
|
-
this.range ? this.range.endIndex : null
|
|
65363
|
-
];
|
|
65364
|
-
},
|
|
65365
|
-
(isScrolling) => {
|
|
65366
|
-
this.notify(isScrolling);
|
|
65367
|
-
},
|
|
65368
|
-
{
|
|
65369
|
-
key: "maybeNotify",
|
|
65370
|
-
debug: () => this.options.debug,
|
|
65371
|
-
initialDeps: [
|
|
65372
|
-
this.isScrolling,
|
|
65373
|
-
this.range ? this.range.startIndex : null,
|
|
65374
|
-
this.range ? this.range.endIndex : null
|
|
65375
|
-
]
|
|
65370
|
+
const { startIndex, endIndex } = this.range ?? {
|
|
65371
|
+
startIndex: void 0,
|
|
65372
|
+
endIndex: void 0
|
|
65373
|
+
};
|
|
65374
|
+
const range = this.calculateRange();
|
|
65375
|
+
if (force || startIndex !== (range == null ? void 0 : range.startIndex) || endIndex !== (range == null ? void 0 : range.endIndex)) {
|
|
65376
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
65376
65377
|
}
|
|
65377
|
-
|
|
65378
|
+
};
|
|
65378
65379
|
this.cleanup = () => {
|
|
65379
65380
|
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
65380
65381
|
this.unsubs = [];
|
|
@@ -65399,29 +65400,17 @@ img.ProseMirror-separator {
|
|
|
65399
65400
|
this.unsubs.push(
|
|
65400
65401
|
this.options.observeElementRect(this, (rect) => {
|
|
65401
65402
|
this.scrollRect = rect;
|
|
65402
|
-
this.
|
|
65403
|
+
this.notify(false, false);
|
|
65403
65404
|
})
|
|
65404
65405
|
);
|
|
65405
65406
|
this.unsubs.push(
|
|
65406
|
-
this.options.observeElementOffset(this, (offset) => {
|
|
65407
|
+
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
65407
65408
|
this.scrollAdjustments = 0;
|
|
65408
|
-
|
|
65409
|
-
return;
|
|
65410
|
-
}
|
|
65411
|
-
if (this.isScrollingTimeoutId !== null) {
|
|
65412
|
-
clearTimeout(this.isScrollingTimeoutId);
|
|
65413
|
-
this.isScrollingTimeoutId = null;
|
|
65414
|
-
}
|
|
65415
|
-
this.isScrolling = true;
|
|
65416
|
-
this.scrollDirection = this.scrollOffset < offset ? "forward" : "backward";
|
|
65409
|
+
this.scrollDirection = isScrolling ? this.scrollOffset < offset ? "forward" : "backward" : null;
|
|
65417
65410
|
this.scrollOffset = offset;
|
|
65418
|
-
this.
|
|
65419
|
-
this.
|
|
65420
|
-
|
|
65421
|
-
this.isScrolling = false;
|
|
65422
|
-
this.scrollDirection = null;
|
|
65423
|
-
this.maybeNotify();
|
|
65424
|
-
}, this.options.scrollingDelay);
|
|
65411
|
+
const prevIsScrolling = this.isScrolling;
|
|
65412
|
+
this.isScrolling = isScrolling;
|
|
65413
|
+
this.notify(prevIsScrolling !== isScrolling, isScrolling);
|
|
65425
65414
|
})
|
|
65426
65415
|
);
|
|
65427
65416
|
}
|
|
@@ -65429,7 +65418,7 @@ img.ProseMirror-separator {
|
|
|
65429
65418
|
this.getSize = () => {
|
|
65430
65419
|
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
65431
65420
|
};
|
|
65432
|
-
this.
|
|
65421
|
+
this.getMeasurementOptions = memo(
|
|
65433
65422
|
() => [
|
|
65434
65423
|
this.options.count,
|
|
65435
65424
|
this.options.paddingStart,
|
|
@@ -65477,7 +65466,7 @@ img.ProseMirror-separator {
|
|
|
65477
65466
|
})[0] : void 0;
|
|
65478
65467
|
};
|
|
65479
65468
|
this.getMeasurements = memo(
|
|
65480
|
-
() => [this.
|
|
65469
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
65481
65470
|
({ count, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => {
|
|
65482
65471
|
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
65483
65472
|
this.pendingMeasuredCacheIndexes = [];
|
|
@@ -65530,7 +65519,8 @@ img.ProseMirror-separator {
|
|
|
65530
65519
|
],
|
|
65531
65520
|
(rangeExtractor, range, overscan, count) => {
|
|
65532
65521
|
return range === null ? [] : rangeExtractor({
|
|
65533
|
-
|
|
65522
|
+
startIndex: range.startIndex,
|
|
65523
|
+
endIndex: range.endIndex,
|
|
65534
65524
|
overscan,
|
|
65535
65525
|
count
|
|
65536
65526
|
});
|
|
@@ -65588,7 +65578,7 @@ img.ProseMirror-separator {
|
|
|
65588
65578
|
}
|
|
65589
65579
|
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
65590
65580
|
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
65591
|
-
this.notify(false);
|
|
65581
|
+
this.notify(true, false);
|
|
65592
65582
|
}
|
|
65593
65583
|
};
|
|
65594
65584
|
this.measureElement = (node) => {
|
|
@@ -65740,8 +65730,9 @@ img.ProseMirror-separator {
|
|
|
65740
65730
|
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
65741
65731
|
};
|
|
65742
65732
|
this.measure = () => {
|
|
65733
|
+
var _a, _b;
|
|
65743
65734
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
65744
|
-
this.
|
|
65735
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, false);
|
|
65745
65736
|
};
|
|
65746
65737
|
this.setOptions(opts);
|
|
65747
65738
|
this.scrollRect = this.options.initialRect;
|
|
@@ -65750,7 +65741,7 @@ img.ProseMirror-separator {
|
|
|
65750
65741
|
this.measurementsCache.forEach((item) => {
|
|
65751
65742
|
this.itemSizeCache.set(item.key, item.size);
|
|
65752
65743
|
});
|
|
65753
|
-
this.
|
|
65744
|
+
this.notify(false, false);
|
|
65754
65745
|
}
|
|
65755
65746
|
};
|
|
65756
65747
|
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|