@ni/spright-components 6.4.21 → 6.4.22
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.
|
@@ -46336,9 +46336,15 @@ ${renderedContent}
|
|
|
46336
46336
|
return attrs;
|
|
46337
46337
|
}
|
|
46338
46338
|
const filtered = {};
|
|
46339
|
-
allowedAttributes.forEach((
|
|
46340
|
-
|
|
46341
|
-
|
|
46339
|
+
allowedAttributes.forEach((attr) => {
|
|
46340
|
+
const attrName = typeof attr === "string" ? attr : attr.name;
|
|
46341
|
+
const skipIfDefault = typeof attr === "string" ? void 0 : attr.skipIfDefault;
|
|
46342
|
+
if (attrName in attrs) {
|
|
46343
|
+
const value = attrs[attrName];
|
|
46344
|
+
if (skipIfDefault !== void 0 && value === skipIfDefault) {
|
|
46345
|
+
return;
|
|
46346
|
+
}
|
|
46347
|
+
filtered[attrName] = value;
|
|
46342
46348
|
}
|
|
46343
46349
|
});
|
|
46344
46350
|
return filtered;
|
|
@@ -59348,32 +59354,36 @@ ${renderedContent}
|
|
|
59348
59354
|
if (!view.editable) {
|
|
59349
59355
|
return false;
|
|
59350
59356
|
}
|
|
59351
|
-
let
|
|
59352
|
-
if (event.target instanceof HTMLAnchorElement) {
|
|
59353
|
-
link = event.target;
|
|
59354
|
-
} else {
|
|
59355
|
-
let a = event.target;
|
|
59356
|
-
const els = [];
|
|
59357
|
-
while (a.nodeName !== "DIV") {
|
|
59358
|
-
els.push(a);
|
|
59359
|
-
a = a.parentNode;
|
|
59360
|
-
}
|
|
59361
|
-
link = els.find((value) => value.nodeName === "A");
|
|
59362
|
-
}
|
|
59363
|
-
if (!link) {
|
|
59364
|
-
return false;
|
|
59365
|
-
}
|
|
59366
|
-
const attrs = getAttributes(view.state, options.type.name);
|
|
59367
|
-
const href = (_a = link == null ? void 0 : link.href) != null ? _a : attrs.href;
|
|
59368
|
-
const target = (_b = link == null ? void 0 : link.target) != null ? _b : attrs.target;
|
|
59357
|
+
let handled = false;
|
|
59369
59358
|
if (options.enableClickSelection) {
|
|
59370
|
-
options.editor.commands.extendMarkRange(options.type.name);
|
|
59359
|
+
const commandResult = options.editor.commands.extendMarkRange(options.type.name);
|
|
59360
|
+
handled = commandResult;
|
|
59371
59361
|
}
|
|
59372
|
-
if (
|
|
59373
|
-
|
|
59374
|
-
|
|
59362
|
+
if (options.openOnClick) {
|
|
59363
|
+
let link = null;
|
|
59364
|
+
if (event.target instanceof HTMLAnchorElement) {
|
|
59365
|
+
link = event.target;
|
|
59366
|
+
} else {
|
|
59367
|
+
let a = event.target;
|
|
59368
|
+
const els = [];
|
|
59369
|
+
while (a.nodeName !== "DIV") {
|
|
59370
|
+
els.push(a);
|
|
59371
|
+
a = a.parentNode;
|
|
59372
|
+
}
|
|
59373
|
+
link = els.find((value) => value.nodeName === "A");
|
|
59374
|
+
}
|
|
59375
|
+
if (!link) {
|
|
59376
|
+
return handled;
|
|
59377
|
+
}
|
|
59378
|
+
const attrs = getAttributes(view.state, options.type.name);
|
|
59379
|
+
const href = (_a = link == null ? void 0 : link.href) != null ? _a : attrs.href;
|
|
59380
|
+
const target = (_b = link == null ? void 0 : link.target) != null ? _b : attrs.target;
|
|
59381
|
+
if (link && href) {
|
|
59382
|
+
window.open(href, target);
|
|
59383
|
+
handled = true;
|
|
59384
|
+
}
|
|
59375
59385
|
}
|
|
59376
|
-
return
|
|
59386
|
+
return handled;
|
|
59377
59387
|
}
|
|
59378
59388
|
}
|
|
59379
59389
|
});
|
|
@@ -59614,15 +59624,14 @@ ${renderedContent}
|
|
|
59614
59624
|
})
|
|
59615
59625
|
);
|
|
59616
59626
|
}
|
|
59617
|
-
|
|
59618
|
-
|
|
59619
|
-
|
|
59620
|
-
|
|
59621
|
-
|
|
59622
|
-
|
|
59623
|
-
|
|
59624
|
-
|
|
59625
|
-
}
|
|
59627
|
+
plugins.push(
|
|
59628
|
+
clickHandler({
|
|
59629
|
+
type: this.type,
|
|
59630
|
+
editor: this.editor,
|
|
59631
|
+
openOnClick: this.options.openOnClick === "whenNotEditable" ? true : this.options.openOnClick,
|
|
59632
|
+
enableClickSelection: this.options.enableClickSelection
|
|
59633
|
+
})
|
|
59634
|
+
);
|
|
59626
59635
|
if (this.options.linkOnPaste) {
|
|
59627
59636
|
plugins.push(
|
|
59628
59637
|
pasteHandler({
|
|
@@ -61143,7 +61152,25 @@ ${nextLine.slice(indentLevel + 2)}`;
|
|
|
61143
61152
|
nodeName: "mention",
|
|
61144
61153
|
name: "@",
|
|
61145
61154
|
selfClosing: true,
|
|
61146
|
-
allowedAttributes: ["id", "label"]
|
|
61155
|
+
allowedAttributes: ["id", "label", { name: "mentionSuggestionChar", skipIfDefault: "@" }],
|
|
61156
|
+
parseAttributes: (attrString) => {
|
|
61157
|
+
const attrs = {};
|
|
61158
|
+
const regex = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
|
|
61159
|
+
let match = regex.exec(attrString);
|
|
61160
|
+
while (match !== null) {
|
|
61161
|
+
const [, key, doubleQuoted, singleQuoted] = match;
|
|
61162
|
+
const value = doubleQuoted != null ? doubleQuoted : singleQuoted;
|
|
61163
|
+
attrs[key === "char" ? "mentionSuggestionChar" : key] = value;
|
|
61164
|
+
match = regex.exec(attrString);
|
|
61165
|
+
}
|
|
61166
|
+
return attrs;
|
|
61167
|
+
},
|
|
61168
|
+
serializeAttributes: (attrs) => {
|
|
61169
|
+
return Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => {
|
|
61170
|
+
const serializedKey = key === "mentionSuggestionChar" ? "char" : key;
|
|
61171
|
+
return `${serializedKey}="${value}"`;
|
|
61172
|
+
}).join(" ");
|
|
61173
|
+
}
|
|
61147
61174
|
}),
|
|
61148
61175
|
renderText({ node }) {
|
|
61149
61176
|
const args = {
|
|
@@ -70801,8 +70828,9 @@ focus outline in that case.
|
|
|
70801
70828
|
function memo(getDeps, fn, opts) {
|
|
70802
70829
|
let deps = opts.initialDeps ?? [];
|
|
70803
70830
|
let result;
|
|
70831
|
+
let isInitial = true;
|
|
70804
70832
|
function memoizedFunction() {
|
|
70805
|
-
var _a, _b, _c
|
|
70833
|
+
var _a, _b, _c;
|
|
70806
70834
|
let depTime;
|
|
70807
70835
|
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
|
|
70808
70836
|
const newDeps = getDeps();
|
|
@@ -70837,7 +70865,10 @@ focus outline in that case.
|
|
|
70837
70865
|
opts == null ? void 0 : opts.key
|
|
70838
70866
|
);
|
|
70839
70867
|
}
|
|
70840
|
-
(
|
|
70868
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
|
|
70869
|
+
opts.onChange(result);
|
|
70870
|
+
}
|
|
70871
|
+
isInitial = false;
|
|
70841
70872
|
return result;
|
|
70842
70873
|
}
|
|
70843
70874
|
memoizedFunction.updateDeps = (newDeps) => {
|
|
@@ -70985,7 +71016,11 @@ focus outline in that case.
|
|
|
70985
71016
|
this.isScrolling = false;
|
|
70986
71017
|
this.measurementsCache = [];
|
|
70987
71018
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
71019
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
70988
71020
|
this.pendingMeasuredCacheIndexes = [];
|
|
71021
|
+
this.prevLanes = void 0;
|
|
71022
|
+
this.lanesChangedFlag = false;
|
|
71023
|
+
this.lanesSettling = false;
|
|
70989
71024
|
this.scrollRect = null;
|
|
70990
71025
|
this.scrollOffset = null;
|
|
70991
71026
|
this.scrollDirection = null;
|
|
@@ -71184,47 +71219,99 @@ focus outline in that case.
|
|
|
71184
71219
|
this.options.paddingStart,
|
|
71185
71220
|
this.options.scrollMargin,
|
|
71186
71221
|
this.options.getItemKey,
|
|
71187
|
-
this.options.enabled
|
|
71222
|
+
this.options.enabled,
|
|
71223
|
+
this.options.lanes
|
|
71188
71224
|
],
|
|
71189
|
-
(count, paddingStart, scrollMargin, getItemKey, enabled) => {
|
|
71225
|
+
(count, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
|
|
71226
|
+
const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
|
|
71227
|
+
if (lanesChanged) {
|
|
71228
|
+
this.lanesChangedFlag = true;
|
|
71229
|
+
}
|
|
71230
|
+
this.prevLanes = lanes;
|
|
71190
71231
|
this.pendingMeasuredCacheIndexes = [];
|
|
71191
71232
|
return {
|
|
71192
71233
|
count,
|
|
71193
71234
|
paddingStart,
|
|
71194
71235
|
scrollMargin,
|
|
71195
71236
|
getItemKey,
|
|
71196
|
-
enabled
|
|
71237
|
+
enabled,
|
|
71238
|
+
lanes
|
|
71197
71239
|
};
|
|
71198
71240
|
},
|
|
71199
71241
|
{
|
|
71200
|
-
key: false
|
|
71242
|
+
key: false,
|
|
71243
|
+
skipInitialOnChange: true,
|
|
71244
|
+
onChange: () => {
|
|
71245
|
+
this.notify(this.isScrolling);
|
|
71246
|
+
}
|
|
71201
71247
|
}
|
|
71202
71248
|
);
|
|
71203
71249
|
this.getMeasurements = memo(
|
|
71204
71250
|
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
71205
|
-
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
|
71251
|
+
({ count, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
|
|
71206
71252
|
if (!enabled) {
|
|
71207
71253
|
this.measurementsCache = [];
|
|
71208
71254
|
this.itemSizeCache.clear();
|
|
71255
|
+
this.laneAssignments.clear();
|
|
71209
71256
|
return [];
|
|
71210
71257
|
}
|
|
71258
|
+
if (this.laneAssignments.size > count) {
|
|
71259
|
+
for (const index of this.laneAssignments.keys()) {
|
|
71260
|
+
if (index >= count) {
|
|
71261
|
+
this.laneAssignments.delete(index);
|
|
71262
|
+
}
|
|
71263
|
+
}
|
|
71264
|
+
}
|
|
71265
|
+
if (this.lanesChangedFlag) {
|
|
71266
|
+
this.lanesChangedFlag = false;
|
|
71267
|
+
this.lanesSettling = true;
|
|
71268
|
+
this.measurementsCache = [];
|
|
71269
|
+
this.itemSizeCache.clear();
|
|
71270
|
+
this.laneAssignments.clear();
|
|
71271
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
71272
|
+
}
|
|
71211
71273
|
if (this.measurementsCache.length === 0) {
|
|
71212
71274
|
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
71213
71275
|
this.measurementsCache.forEach((item) => {
|
|
71214
71276
|
this.itemSizeCache.set(item.key, item.size);
|
|
71215
71277
|
});
|
|
71216
71278
|
}
|
|
71217
|
-
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
71279
|
+
const min = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
71218
71280
|
this.pendingMeasuredCacheIndexes = [];
|
|
71281
|
+
if (this.lanesSettling && this.measurementsCache.length === count) {
|
|
71282
|
+
this.lanesSettling = false;
|
|
71283
|
+
}
|
|
71219
71284
|
const measurements = this.measurementsCache.slice(0, min);
|
|
71285
|
+
const laneLastIndex = new Array(lanes).fill(
|
|
71286
|
+
void 0
|
|
71287
|
+
);
|
|
71288
|
+
for (let m = 0; m < min; m++) {
|
|
71289
|
+
const item = measurements[m];
|
|
71290
|
+
if (item) {
|
|
71291
|
+
laneLastIndex[item.lane] = m;
|
|
71292
|
+
}
|
|
71293
|
+
}
|
|
71220
71294
|
for (let i = min; i < count; i++) {
|
|
71221
71295
|
const key = getItemKey(i);
|
|
71222
|
-
const
|
|
71223
|
-
|
|
71296
|
+
const cachedLane = this.laneAssignments.get(i);
|
|
71297
|
+
let lane;
|
|
71298
|
+
let start;
|
|
71299
|
+
if (cachedLane !== void 0 && this.options.lanes > 1) {
|
|
71300
|
+
lane = cachedLane;
|
|
71301
|
+
const prevIndex = laneLastIndex[lane];
|
|
71302
|
+
const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
|
|
71303
|
+
start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
|
|
71304
|
+
} else {
|
|
71305
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
71306
|
+
start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
71307
|
+
lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
71308
|
+
if (this.options.lanes > 1) {
|
|
71309
|
+
this.laneAssignments.set(i, lane);
|
|
71310
|
+
}
|
|
71311
|
+
}
|
|
71224
71312
|
const measuredSize = itemSizeCache.get(key);
|
|
71225
71313
|
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
71226
71314
|
const end = start + size;
|
|
71227
|
-
const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
71228
71315
|
measurements[i] = {
|
|
71229
71316
|
index: i,
|
|
71230
71317
|
start,
|
|
@@ -71233,6 +71320,7 @@ focus outline in that case.
|
|
|
71233
71320
|
key,
|
|
71234
71321
|
lane
|
|
71235
71322
|
};
|
|
71323
|
+
laneLastIndex[lane] = i;
|
|
71236
71324
|
}
|
|
71237
71325
|
this.measurementsCache = measurements;
|
|
71238
71326
|
return measurements;
|
|
@@ -71526,6 +71614,7 @@ focus outline in that case.
|
|
|
71526
71614
|
};
|
|
71527
71615
|
this.measure = () => {
|
|
71528
71616
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
71617
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
71529
71618
|
this.notify(false);
|
|
71530
71619
|
};
|
|
71531
71620
|
this.setOptions(opts);
|