@ni/spright-components 4.1.6 → 4.1.8
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.
|
@@ -26334,6 +26334,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
26334
26334
|
border-bottom-color: ${borderHoverColor};
|
|
26335
26335
|
}
|
|
26336
26336
|
|
|
26337
|
+
:host([readonly]) .root,
|
|
26337
26338
|
:host([disabled]) .root {
|
|
26338
26339
|
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
26339
26340
|
}
|
|
@@ -26375,6 +26376,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
26375
26376
|
width: 100%;
|
|
26376
26377
|
}
|
|
26377
26378
|
|
|
26379
|
+
:host([readonly]:hover) .root::after,
|
|
26378
26380
|
:host([disabled]:hover) .root::after {
|
|
26379
26381
|
width: 0px;
|
|
26380
26382
|
}
|
|
@@ -26455,11 +26457,20 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
26455
26457
|
}
|
|
26456
26458
|
|
|
26457
26459
|
:host(:hover) .root {
|
|
26460
|
+
border-bottom-width: ${borderWidth};
|
|
26458
26461
|
padding-bottom: 0;
|
|
26459
26462
|
}
|
|
26460
26463
|
|
|
26464
|
+
:host([readonly]) .root,
|
|
26461
26465
|
:host([disabled]) .root {
|
|
26462
26466
|
background-color: rgba(${borderRgbPartialColor}, 0.07);
|
|
26467
|
+
border-color: transparent;
|
|
26468
|
+
}
|
|
26469
|
+
|
|
26470
|
+
:host([error-visible][readonly]) .root,
|
|
26471
|
+
:host([error-visible][disabled]) .root {
|
|
26472
|
+
padding-bottom: 0;
|
|
26473
|
+
border-bottom-color: ${failColor};
|
|
26463
26474
|
}
|
|
26464
26475
|
`), appearanceBehavior(NumberFieldAppearance.outline, css `
|
|
26465
26476
|
.root {
|
|
@@ -35240,6 +35251,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
35240
35251
|
return true;
|
|
35241
35252
|
}
|
|
35242
35253
|
else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {
|
|
35254
|
+
this.destroyBetween(this.index, i);
|
|
35243
35255
|
this.top.children[this.index] = updated;
|
|
35244
35256
|
if (updated.contentDOM) {
|
|
35245
35257
|
updated.dirty = CONTENT_DIRTY;
|
|
@@ -35259,7 +35271,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
35259
35271
|
// identical content, move over its children.
|
|
35260
35272
|
recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {
|
|
35261
35273
|
if (next.dirty || node.isAtom || !next.children.length ||
|
|
35262
|
-
!next.node.content.eq(node.content)
|
|
35274
|
+
!next.node.content.eq(node.content) ||
|
|
35275
|
+
!sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))
|
|
35263
35276
|
return null;
|
|
35264
35277
|
let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
|
|
35265
35278
|
if (wrapper.contentDOM) {
|
|
@@ -35530,9 +35543,9 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
35530
35543
|
let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);
|
|
35531
35544
|
if (head < 0)
|
|
35532
35545
|
return null;
|
|
35533
|
-
let $head = doc.resolve(head),
|
|
35546
|
+
let $head = doc.resolve(head), anchor, selection;
|
|
35534
35547
|
if (selectionCollapsed(domSel)) {
|
|
35535
|
-
|
|
35548
|
+
anchor = head;
|
|
35536
35549
|
while (nearestDesc && !nearestDesc.node)
|
|
35537
35550
|
nearestDesc = nearestDesc.parent;
|
|
35538
35551
|
let nearestDescNode = nearestDesc.node;
|
|
@@ -35543,11 +35556,25 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
35543
35556
|
}
|
|
35544
35557
|
}
|
|
35545
35558
|
else {
|
|
35546
|
-
|
|
35559
|
+
if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
|
|
35560
|
+
let min = head, max = head;
|
|
35561
|
+
for (let i = 0; i < domSel.rangeCount; i++) {
|
|
35562
|
+
let range = domSel.getRangeAt(i);
|
|
35563
|
+
min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));
|
|
35564
|
+
max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));
|
|
35565
|
+
}
|
|
35566
|
+
if (min < 0)
|
|
35567
|
+
return null;
|
|
35568
|
+
[anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];
|
|
35569
|
+
$head = doc.resolve(head);
|
|
35570
|
+
}
|
|
35571
|
+
else {
|
|
35572
|
+
anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);
|
|
35573
|
+
}
|
|
35547
35574
|
if (anchor < 0)
|
|
35548
35575
|
return null;
|
|
35549
|
-
$anchor = doc.resolve(anchor);
|
|
35550
35576
|
}
|
|
35577
|
+
let $anchor = doc.resolve(anchor);
|
|
35551
35578
|
if (!selection) {
|
|
35552
35579
|
let bias = origin == "pointer" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;
|
|
35553
35580
|
selection = selectionBetween(view, $anchor, $head, bias);
|
|
@@ -40365,7 +40392,18 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
40365
40392
|
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(' ');
|
|
40366
40393
|
}
|
|
40367
40394
|
else if (key === 'style') {
|
|
40368
|
-
|
|
40395
|
+
const newStyles = value ? value.split(';').map((style) => style.trim()).filter(Boolean) : [];
|
|
40396
|
+
const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(';').map((style) => style.trim()).filter(Boolean) : [];
|
|
40397
|
+
const styleMap = new Map();
|
|
40398
|
+
existingStyles.forEach(style => {
|
|
40399
|
+
const [property, val] = style.split(':').map(part => part.trim());
|
|
40400
|
+
styleMap.set(property, val);
|
|
40401
|
+
});
|
|
40402
|
+
newStyles.forEach(style => {
|
|
40403
|
+
const [property, val] = style.split(':').map(part => part.trim());
|
|
40404
|
+
styleMap.set(property, val);
|
|
40405
|
+
});
|
|
40406
|
+
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join('; ');
|
|
40369
40407
|
}
|
|
40370
40408
|
else {
|
|
40371
40409
|
mergedAttributes[key] = value;
|
|
@@ -40377,6 +40415,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
40377
40415
|
|
|
40378
40416
|
function getRenderedAttributes(nodeOrMark, extensionAttributes) {
|
|
40379
40417
|
return extensionAttributes
|
|
40418
|
+
.filter(attribute => attribute.type === nodeOrMark.type.name)
|
|
40380
40419
|
.filter(item => item.attribute.rendered)
|
|
40381
40420
|
.map(item => {
|
|
40382
40421
|
if (!item.attribute.renderHTML) {
|
|
@@ -41196,15 +41235,19 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41196
41235
|
if (!addNodeView) {
|
|
41197
41236
|
return [];
|
|
41198
41237
|
}
|
|
41199
|
-
const nodeview = (node, view, getPos, decorations) => {
|
|
41238
|
+
const nodeview = (node, view, getPos, decorations, innerDecorations) => {
|
|
41200
41239
|
const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);
|
|
41201
41240
|
return addNodeView()({
|
|
41202
|
-
|
|
41241
|
+
// pass-through
|
|
41203
41242
|
node,
|
|
41204
|
-
|
|
41243
|
+
view,
|
|
41244
|
+
getPos: getPos,
|
|
41205
41245
|
decorations,
|
|
41206
|
-
|
|
41246
|
+
innerDecorations,
|
|
41247
|
+
// tiptap-specific
|
|
41248
|
+
editor,
|
|
41207
41249
|
extension,
|
|
41250
|
+
HTMLAttributes,
|
|
41208
41251
|
});
|
|
41209
41252
|
};
|
|
41210
41253
|
return [extension.name, nodeview];
|
|
@@ -43169,10 +43212,17 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43169
43212
|
const type = getNodeType(typeOrName, state.schema);
|
|
43170
43213
|
const toggleType = getNodeType(toggleTypeOrName, state.schema);
|
|
43171
43214
|
const isActive = isNodeActive(state, type, attributes);
|
|
43215
|
+
let attributesToCopy;
|
|
43216
|
+
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
43217
|
+
// only copy attributes if the selection is pointing to a node of the same type
|
|
43218
|
+
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
43219
|
+
}
|
|
43172
43220
|
if (isActive) {
|
|
43173
|
-
return commands.setNode(toggleType);
|
|
43221
|
+
return commands.setNode(toggleType, attributesToCopy);
|
|
43174
43222
|
}
|
|
43175
|
-
|
|
43223
|
+
// If the node is not active, we want to set the new node type with the given attributes
|
|
43224
|
+
// Copying over the attributes from the current node if the selection is pointing to a node of the same type
|
|
43225
|
+
return commands.setNode(type, { ...attributesToCopy, ...attributes });
|
|
43176
43226
|
};
|
|
43177
43227
|
|
|
43178
43228
|
const toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {
|
|
@@ -43506,7 +43556,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43506
43556
|
appendTransaction: (transactions, oldState, newState) => {
|
|
43507
43557
|
const docChanges = transactions.some(transaction => transaction.docChanged)
|
|
43508
43558
|
&& !oldState.doc.eq(newState.doc);
|
|
43509
|
-
|
|
43559
|
+
const ignoreTr = transactions.some(transaction => transaction.getMeta('preventClearDocument'));
|
|
43560
|
+
if (!docChanges || ignoreTr) {
|
|
43510
43561
|
return;
|
|
43511
43562
|
}
|
|
43512
43563
|
const { empty, from, to } = oldState.selection;
|
|
@@ -43516,7 +43567,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43516
43567
|
if (empty || !allWasSelected) {
|
|
43517
43568
|
return;
|
|
43518
43569
|
}
|
|
43519
|
-
const isEmpty =
|
|
43570
|
+
const isEmpty = isNodeEmpty(newState.doc);
|
|
43520
43571
|
if (!isEmpty) {
|
|
43521
43572
|
return;
|
|
43522
43573
|
}
|
|
@@ -43730,6 +43781,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43730
43781
|
}
|
|
43731
43782
|
}
|
|
43732
43783
|
|
|
43784
|
+
const DropPlugin = (onDrop) => {
|
|
43785
|
+
return new Plugin({
|
|
43786
|
+
key: new PluginKey('tiptapDrop'),
|
|
43787
|
+
props: {
|
|
43788
|
+
handleDrop: (_, e, slice, moved) => {
|
|
43789
|
+
onDrop(e, slice, moved);
|
|
43790
|
+
},
|
|
43791
|
+
},
|
|
43792
|
+
});
|
|
43793
|
+
};
|
|
43794
|
+
|
|
43795
|
+
const PastePlugin = (onPaste) => {
|
|
43796
|
+
return new Plugin({
|
|
43797
|
+
key: new PluginKey('tiptapPaste'),
|
|
43798
|
+
props: {
|
|
43799
|
+
handlePaste: (_view, e, slice) => {
|
|
43800
|
+
onPaste(e, slice);
|
|
43801
|
+
},
|
|
43802
|
+
},
|
|
43803
|
+
});
|
|
43804
|
+
};
|
|
43805
|
+
|
|
43733
43806
|
const style = `.ProseMirror {
|
|
43734
43807
|
position: relative;
|
|
43735
43808
|
}
|
|
@@ -43854,6 +43927,8 @@ img.ProseMirror-separator {
|
|
|
43854
43927
|
onBlur: () => null,
|
|
43855
43928
|
onDestroy: () => null,
|
|
43856
43929
|
onContentError: ({ error }) => { throw error; },
|
|
43930
|
+
onPaste: () => null,
|
|
43931
|
+
onDrop: () => null,
|
|
43857
43932
|
};
|
|
43858
43933
|
this.isCapturingTransaction = false;
|
|
43859
43934
|
this.capturedTransaction = null;
|
|
@@ -43873,6 +43948,12 @@ img.ProseMirror-separator {
|
|
|
43873
43948
|
this.on('focus', this.options.onFocus);
|
|
43874
43949
|
this.on('blur', this.options.onBlur);
|
|
43875
43950
|
this.on('destroy', this.options.onDestroy);
|
|
43951
|
+
if (this.options.onPaste) {
|
|
43952
|
+
this.registerPlugin(PastePlugin(this.options.onPaste));
|
|
43953
|
+
}
|
|
43954
|
+
if (this.options.onDrop) {
|
|
43955
|
+
this.registerPlugin(DropPlugin(this.options.onDrop));
|
|
43956
|
+
}
|
|
43876
43957
|
window.setTimeout(() => {
|
|
43877
43958
|
if (this.isDestroyed) {
|
|
43878
43959
|
return;
|
|
@@ -43961,6 +44042,7 @@ img.ProseMirror-separator {
|
|
|
43961
44042
|
*
|
|
43962
44043
|
* @param plugin A ProseMirror plugin
|
|
43963
44044
|
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
44045
|
+
* @returns The new editor state
|
|
43964
44046
|
*/
|
|
43965
44047
|
registerPlugin(plugin, handlePlugins) {
|
|
43966
44048
|
const plugins = isFunction$3(handlePlugins)
|
|
@@ -43968,15 +44050,17 @@ img.ProseMirror-separator {
|
|
|
43968
44050
|
: [...this.state.plugins, plugin];
|
|
43969
44051
|
const state = this.state.reconfigure({ plugins });
|
|
43970
44052
|
this.view.updateState(state);
|
|
44053
|
+
return state;
|
|
43971
44054
|
}
|
|
43972
44055
|
/**
|
|
43973
44056
|
* Unregister a ProseMirror plugin.
|
|
43974
44057
|
*
|
|
43975
44058
|
* @param nameOrPluginKey The plugins name
|
|
44059
|
+
* @returns The new editor state or undefined if the editor is destroyed
|
|
43976
44060
|
*/
|
|
43977
44061
|
unregisterPlugin(nameOrPluginKey) {
|
|
43978
44062
|
if (this.isDestroyed) {
|
|
43979
|
-
return;
|
|
44063
|
+
return undefined;
|
|
43980
44064
|
}
|
|
43981
44065
|
// @ts-ignore
|
|
43982
44066
|
const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
@@ -43985,6 +44069,7 @@ img.ProseMirror-separator {
|
|
|
43985
44069
|
plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(name)),
|
|
43986
44070
|
});
|
|
43987
44071
|
this.view.updateState(state);
|
|
44072
|
+
return state;
|
|
43988
44073
|
}
|
|
43989
44074
|
/**
|
|
43990
44075
|
* Creates an extension manager.
|
|
@@ -44000,7 +44085,12 @@ img.ProseMirror-separator {
|
|
|
44000
44085
|
FocusEvents,
|
|
44001
44086
|
Keymap,
|
|
44002
44087
|
Tabindex,
|
|
44003
|
-
]
|
|
44088
|
+
].filter(ext => {
|
|
44089
|
+
if (typeof this.options.enableCoreExtensions === 'object') {
|
|
44090
|
+
return this.options.enableCoreExtensions[ext.name] !== false;
|
|
44091
|
+
}
|
|
44092
|
+
return true;
|
|
44093
|
+
}) : [];
|
|
44004
44094
|
const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {
|
|
44005
44095
|
return ['extension', 'node', 'mark'].includes(extension === null || extension === void 0 ? void 0 : extension.type);
|
|
44006
44096
|
});
|
|
@@ -44212,6 +44302,12 @@ img.ProseMirror-separator {
|
|
|
44212
44302
|
destroy() {
|
|
44213
44303
|
this.emit('destroy');
|
|
44214
44304
|
if (this.view) {
|
|
44305
|
+
// Cleanup our reference to prevent circular references which caused memory leaks
|
|
44306
|
+
// @ts-ignore
|
|
44307
|
+
const dom = this.view.dom;
|
|
44308
|
+
if (dom && dom.editor) {
|
|
44309
|
+
delete dom.editor;
|
|
44310
|
+
}
|
|
44215
44311
|
this.view.destroy();
|
|
44216
44312
|
}
|
|
44217
44313
|
this.removeAllListeners();
|
|
@@ -58614,7 +58710,7 @@ img.ProseMirror-separator {
|
|
|
58614
58710
|
char: '@',
|
|
58615
58711
|
pluginKey: MentionPluginKey,
|
|
58616
58712
|
command: ({ editor, range, props }) => {
|
|
58617
|
-
var _a, _b;
|
|
58713
|
+
var _a, _b, _c;
|
|
58618
58714
|
// increase range.to by one when the next node is of type "text"
|
|
58619
58715
|
// and starts with a space character
|
|
58620
58716
|
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
@@ -58636,7 +58732,8 @@ img.ProseMirror-separator {
|
|
|
58636
58732
|
},
|
|
58637
58733
|
])
|
|
58638
58734
|
.run();
|
|
58639
|
-
|
|
58735
|
+
// get reference to `window` object from editor element, to support cross-frame JS usage
|
|
58736
|
+
(_c = (_b = editor.view.dom.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.getSelection()) === null || _c === void 0 ? void 0 : _c.collapseToEnd();
|
|
58640
58737
|
},
|
|
58641
58738
|
allow: ({ state, range }) => {
|
|
58642
58739
|
const $from = state.doc.resolve(range.from);
|
|
@@ -67419,7 +67516,8 @@ focus outline in that case.
|
|
|
67419
67516
|
return {
|
|
67420
67517
|
disconnect: () => {
|
|
67421
67518
|
var _a;
|
|
67422
|
-
|
|
67519
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
67520
|
+
_ro = null;
|
|
67423
67521
|
},
|
|
67424
67522
|
observe: (target) => {
|
|
67425
67523
|
var _a;
|
|
@@ -67491,10 +67589,9 @@ focus outline in that case.
|
|
|
67491
67589
|
this.cleanup = () => {
|
|
67492
67590
|
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
67493
67591
|
this.unsubs = [];
|
|
67592
|
+
this.observer.disconnect();
|
|
67494
67593
|
this.scrollElement = null;
|
|
67495
67594
|
this.targetWindow = null;
|
|
67496
|
-
this.observer.disconnect();
|
|
67497
|
-
this.elementsCache.clear();
|
|
67498
67595
|
};
|
|
67499
67596
|
this._didMount = () => {
|
|
67500
67597
|
return () => {
|
|
@@ -67516,6 +67613,9 @@ focus outline in that case.
|
|
|
67516
67613
|
} else {
|
|
67517
67614
|
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
67518
67615
|
}
|
|
67616
|
+
this.elementsCache.forEach((cached) => {
|
|
67617
|
+
this.observer.observe(cached);
|
|
67618
|
+
});
|
|
67519
67619
|
this._scrollToOffset(this.getScrollOffset(), {
|
|
67520
67620
|
adjustments: void 0,
|
|
67521
67621
|
behavior: void 0
|
|
@@ -67889,7 +67989,10 @@ focus outline in that case.
|
|
|
67889
67989
|
...measurements.slice(-this.options.lanes).map((m) => m.end)
|
|
67890
67990
|
);
|
|
67891
67991
|
}
|
|
67892
|
-
return
|
|
67992
|
+
return Math.max(
|
|
67993
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
67994
|
+
0
|
|
67995
|
+
);
|
|
67893
67996
|
};
|
|
67894
67997
|
this._scrollToOffset = (offset, {
|
|
67895
67998
|
adjustments,
|