@ni/nimble-components 33.1.1 → 33.2.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 +75 -31
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +2379 -2354
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/text-field/index.d.ts +1 -0
- package/dist/esm/text-field/index.js +4 -0
- package/dist/esm/text-field/index.js.map +1 -1
- package/dist/esm/text-field/styles.js +20 -2
- package/dist/esm/text-field/styles.js.map +1 -1
- package/package.json +2 -2
|
@@ -29876,7 +29876,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29876
29876
|
value = value.replace(/\r\n?/g, "\n");
|
|
29877
29877
|
}
|
|
29878
29878
|
if (value)
|
|
29879
|
-
this.insertNode(this.parser.schema.text(value), marks);
|
|
29879
|
+
this.insertNode(this.parser.schema.text(value), marks, !/\S/.test(value));
|
|
29880
29880
|
this.findInText(dom);
|
|
29881
29881
|
}
|
|
29882
29882
|
else {
|
|
@@ -29940,7 +29940,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29940
29940
|
ignoreFallback(dom, marks) {
|
|
29941
29941
|
// Ignored BR nodes should at least create an inline context
|
|
29942
29942
|
if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
|
|
29943
|
-
this.findPlace(this.parser.schema.text("-"), marks);
|
|
29943
|
+
this.findPlace(this.parser.schema.text("-"), marks, true);
|
|
29944
29944
|
}
|
|
29945
29945
|
// Run any style parser associated with the node's styles. Either
|
|
29946
29946
|
// return an updated array of marks, or null to indicate some of the
|
|
@@ -29988,7 +29988,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
29988
29988
|
marks = inner;
|
|
29989
29989
|
}
|
|
29990
29990
|
}
|
|
29991
|
-
else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {
|
|
29991
|
+
else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == "BR")) {
|
|
29992
29992
|
this.leafFallback(dom, marks);
|
|
29993
29993
|
}
|
|
29994
29994
|
}
|
|
@@ -30005,7 +30005,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30005
30005
|
}
|
|
30006
30006
|
else if (rule.getContent) {
|
|
30007
30007
|
this.findInside(dom);
|
|
30008
|
-
rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks));
|
|
30008
|
+
rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks, false));
|
|
30009
30009
|
}
|
|
30010
30010
|
else {
|
|
30011
30011
|
let contentDOM = dom;
|
|
@@ -30036,19 +30036,22 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30036
30036
|
// Try to find a way to fit the given node type into the current
|
|
30037
30037
|
// context. May add intermediate wrappers and/or leave non-solid
|
|
30038
30038
|
// nodes that we're in.
|
|
30039
|
-
findPlace(node, marks) {
|
|
30039
|
+
findPlace(node, marks, cautious) {
|
|
30040
30040
|
let route, sync;
|
|
30041
|
-
for (let depth = this.open; depth >= 0; depth--) {
|
|
30041
|
+
for (let depth = this.open, penalty = 0; depth >= 0; depth--) {
|
|
30042
30042
|
let cx = this.nodes[depth];
|
|
30043
30043
|
let found = cx.findWrapping(node);
|
|
30044
|
-
if (found && (!route || route.length > found.length)) {
|
|
30044
|
+
if (found && (!route || route.length > found.length + penalty)) {
|
|
30045
30045
|
route = found;
|
|
30046
30046
|
sync = cx;
|
|
30047
30047
|
if (!found.length)
|
|
30048
30048
|
break;
|
|
30049
30049
|
}
|
|
30050
|
-
if (cx.solid)
|
|
30051
|
-
|
|
30050
|
+
if (cx.solid) {
|
|
30051
|
+
if (cautious)
|
|
30052
|
+
break;
|
|
30053
|
+
penalty += 2;
|
|
30054
|
+
}
|
|
30052
30055
|
}
|
|
30053
30056
|
if (!route)
|
|
30054
30057
|
return null;
|
|
@@ -30058,13 +30061,13 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30058
30061
|
return marks;
|
|
30059
30062
|
}
|
|
30060
30063
|
// Try to insert the given node, adjusting the context when needed.
|
|
30061
|
-
insertNode(node, marks) {
|
|
30064
|
+
insertNode(node, marks, cautious) {
|
|
30062
30065
|
if (node.isInline && this.needsBlock && !this.top.type) {
|
|
30063
30066
|
let block = this.textblockFromContext();
|
|
30064
30067
|
if (block)
|
|
30065
30068
|
marks = this.enterInner(block, null, marks);
|
|
30066
30069
|
}
|
|
30067
|
-
let innerMarks = this.findPlace(node, marks);
|
|
30070
|
+
let innerMarks = this.findPlace(node, marks, cautious);
|
|
30068
30071
|
if (innerMarks) {
|
|
30069
30072
|
this.closeExtra();
|
|
30070
30073
|
let top = this.top;
|
|
@@ -30082,7 +30085,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
30082
30085
|
// Try to start a node of the given type, adjusting the context when
|
|
30083
30086
|
// necessary.
|
|
30084
30087
|
enter(type, attrs, marks, preserveWS) {
|
|
30085
|
-
let innerMarks = this.findPlace(type.create(attrs), marks);
|
|
30088
|
+
let innerMarks = this.findPlace(type.create(attrs), marks, false);
|
|
30086
30089
|
if (innerMarks)
|
|
30087
30090
|
innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
|
|
30088
30091
|
return innerMarks;
|
|
@@ -31216,7 +31219,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
31216
31219
|
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
31217
31220
|
if (from.deletedAcross && to.deletedAcross)
|
|
31218
31221
|
return null;
|
|
31219
|
-
return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice);
|
|
31222
|
+
return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
|
|
31220
31223
|
}
|
|
31221
31224
|
merge(other) {
|
|
31222
31225
|
if (!(other instanceof ReplaceStep) || other.structure || this.structure)
|
|
@@ -32593,19 +32596,26 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
32593
32596
|
return this;
|
|
32594
32597
|
}
|
|
32595
32598
|
/**
|
|
32596
|
-
Remove a mark (or
|
|
32599
|
+
Remove a mark (or all marks of the given type) from the node at
|
|
32597
32600
|
position `pos`.
|
|
32598
32601
|
*/
|
|
32599
32602
|
removeNodeMark(pos, mark) {
|
|
32600
|
-
|
|
32601
|
-
|
|
32602
|
-
|
|
32603
|
-
|
|
32604
|
-
|
|
32605
|
-
|
|
32606
|
-
|
|
32603
|
+
let node = this.doc.nodeAt(pos);
|
|
32604
|
+
if (!node)
|
|
32605
|
+
throw new RangeError("No node at position " + pos);
|
|
32606
|
+
if (mark instanceof Mark$1) {
|
|
32607
|
+
if (mark.isInSet(node.marks))
|
|
32608
|
+
this.step(new RemoveNodeMarkStep(pos, mark));
|
|
32609
|
+
}
|
|
32610
|
+
else {
|
|
32611
|
+
let set = node.marks, found, steps = [];
|
|
32612
|
+
while (found = mark.isInSet(set)) {
|
|
32613
|
+
steps.push(new RemoveNodeMarkStep(pos, found));
|
|
32614
|
+
set = found.removeFromSet(set);
|
|
32615
|
+
}
|
|
32616
|
+
for (let i = steps.length - 1; i >= 0; i--)
|
|
32617
|
+
this.step(steps[i]);
|
|
32607
32618
|
}
|
|
32608
|
-
this.step(new RemoveNodeMarkStep(pos, mark));
|
|
32609
32619
|
return this;
|
|
32610
32620
|
}
|
|
32611
32621
|
/**
|
|
@@ -36629,7 +36639,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
36629
36639
|
// innerHTML, even on a detached document. This wraps the string in
|
|
36630
36640
|
// a way that makes the browser allow us to use its parser again.
|
|
36631
36641
|
if (!_policy)
|
|
36632
|
-
_policy = trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
|
|
36642
|
+
_policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
|
|
36633
36643
|
return _policy.createHTML(html);
|
|
36634
36644
|
}
|
|
36635
36645
|
function readHTML(html) {
|
|
@@ -37320,6 +37330,10 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
37320
37330
|
}
|
|
37321
37331
|
}
|
|
37322
37332
|
const dragCopyModifier = mac$2 ? "altKey" : "ctrlKey";
|
|
37333
|
+
function dragMoves(view, event) {
|
|
37334
|
+
let moves = view.someProp("dragCopies", test => !test(event));
|
|
37335
|
+
return moves != null ? moves : !event[dragCopyModifier];
|
|
37336
|
+
}
|
|
37323
37337
|
handlers.dragstart = (view, _event) => {
|
|
37324
37338
|
let event = _event;
|
|
37325
37339
|
let mouseDown = view.input.mouseDown;
|
|
@@ -37349,7 +37363,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
37349
37363
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
37350
37364
|
if (!brokenClipboardAPI)
|
|
37351
37365
|
event.dataTransfer.setData("text/plain", text);
|
|
37352
|
-
view.dragging = new Dragging(slice,
|
|
37366
|
+
view.dragging = new Dragging(slice, dragMoves(view, event), node);
|
|
37353
37367
|
};
|
|
37354
37368
|
handlers.dragend = view => {
|
|
37355
37369
|
let dragging = view.dragging;
|
|
@@ -37376,7 +37390,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
37376
37390
|
else {
|
|
37377
37391
|
slice = parseFromClipboard(view, getText$1(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
|
|
37378
37392
|
}
|
|
37379
|
-
let move = !!(dragging &&
|
|
37393
|
+
let move = !!(dragging && dragMoves(view, event));
|
|
37380
37394
|
if (view.someProp("handleDrop", f => f(view, event, slice || Slice.empty, move))) {
|
|
37381
37395
|
event.preventDefault();
|
|
37382
37396
|
return;
|
|
@@ -38661,9 +38675,11 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
38661
38675
|
// as being an iOS enter press), just dispatch an Enter key instead.
|
|
38662
38676
|
if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&
|
|
38663
38677
|
(!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
|
|
38664
|
-
(!inlineChange && $from.pos < parse.doc.content.size &&
|
|
38678
|
+
(!inlineChange && $from.pos < parse.doc.content.size &&
|
|
38679
|
+
(!$from.sameParent($to) || !$from.parent.inlineContent) &&
|
|
38680
|
+
!/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) &&
|
|
38665
38681
|
(nextSel = Selection$2.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&
|
|
38666
|
-
nextSel.head
|
|
38682
|
+
nextSel.head > $from.pos)) &&
|
|
38667
38683
|
view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
|
|
38668
38684
|
view.input.lastIOSEnter = 0;
|
|
38669
38685
|
return;
|
|
@@ -40116,6 +40132,8 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
40116
40132
|
types[0] = deflt ? { type: deflt } : null;
|
|
40117
40133
|
can = canSplit(tr.doc, splitPos, types.length, types);
|
|
40118
40134
|
}
|
|
40135
|
+
if (!can)
|
|
40136
|
+
return false;
|
|
40119
40137
|
tr.split(splitPos, types.length, types);
|
|
40120
40138
|
if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
|
|
40121
40139
|
let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
|
|
@@ -44730,7 +44748,7 @@ img.ProseMirror-separator {
|
|
|
44730
44748
|
// @ts-ignore
|
|
44731
44749
|
const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
44732
44750
|
// @ts-ignore
|
|
44733
|
-
plugins =
|
|
44751
|
+
plugins = plugins.filter(plugin => !plugin.key.startsWith(name));
|
|
44734
44752
|
});
|
|
44735
44753
|
if (prevPlugins.length === plugins.length) {
|
|
44736
44754
|
// No plugin was removed, so we don’t need to update the state
|
|
@@ -63767,6 +63785,10 @@ img.ProseMirror-separator {
|
|
|
63767
63785
|
}
|
|
63768
63786
|
};
|
|
63769
63787
|
|
|
63788
|
+
function safelyAccessDocument(_document) {
|
|
63789
|
+
return _document || (typeof document !== 'undefined' ? document : null);
|
|
63790
|
+
}
|
|
63791
|
+
|
|
63770
63792
|
//
|
|
63771
63793
|
|
|
63772
63794
|
//
|
|
@@ -63906,7 +63928,7 @@ img.ProseMirror-separator {
|
|
|
63906
63928
|
columnSizingStart: []
|
|
63907
63929
|
}));
|
|
63908
63930
|
};
|
|
63909
|
-
const contextDocument = _contextDocument
|
|
63931
|
+
const contextDocument = safelyAccessDocument(_contextDocument);
|
|
63910
63932
|
const mouseEvents = {
|
|
63911
63933
|
moveHandler: e => onMove(e.clientX),
|
|
63912
63934
|
upHandler: e => {
|
|
@@ -74849,6 +74871,7 @@ focus outline in that case.
|
|
|
74849
74871
|
frameless: 'frameless'
|
|
74850
74872
|
};
|
|
74851
74873
|
|
|
74874
|
+
// prettier-ignore
|
|
74852
74875
|
const styles$5 = css `
|
|
74853
74876
|
${display('inline-block')}
|
|
74854
74877
|
${styles$N}
|
|
@@ -74863,12 +74886,17 @@ focus outline in that case.
|
|
|
74863
74886
|
--ni-private-height-within-border: calc(
|
|
74864
74887
|
${controlHeight} - 2 * ${borderWidth}
|
|
74865
74888
|
);
|
|
74889
|
+
--ni-private-default-start-slot-opacity: 0.6;
|
|
74866
74890
|
}
|
|
74867
74891
|
|
|
74868
74892
|
:host([disabled]) {
|
|
74869
74893
|
color: ${bodyDisabledFontColor};
|
|
74870
74894
|
}
|
|
74871
74895
|
|
|
74896
|
+
:host([disabled][appearance-readonly]) {
|
|
74897
|
+
color: ${bodyFontColor};
|
|
74898
|
+
}
|
|
74899
|
+
|
|
74872
74900
|
.label {
|
|
74873
74901
|
display: flex;
|
|
74874
74902
|
color: ${controlLabelFontColor};
|
|
@@ -74879,6 +74907,10 @@ focus outline in that case.
|
|
|
74879
74907
|
color: ${controlLabelDisabledFontColor};
|
|
74880
74908
|
}
|
|
74881
74909
|
|
|
74910
|
+
:host([disabled][appearance-readonly]) .label {
|
|
74911
|
+
color: ${controlLabelFontColor};
|
|
74912
|
+
}
|
|
74913
|
+
|
|
74882
74914
|
.root {
|
|
74883
74915
|
position: relative;
|
|
74884
74916
|
display: flex;
|
|
@@ -74944,7 +74976,7 @@ focus outline in that case.
|
|
|
74944
74976
|
|
|
74945
74977
|
slot[name='start']::slotted(*) {
|
|
74946
74978
|
flex: none;
|
|
74947
|
-
opacity:
|
|
74979
|
+
opacity: var(--ni-private-default-start-slot-opacity);
|
|
74948
74980
|
margin-right: ${smallPadding};
|
|
74949
74981
|
}
|
|
74950
74982
|
|
|
@@ -74952,6 +74984,10 @@ focus outline in that case.
|
|
|
74952
74984
|
opacity: 0.3;
|
|
74953
74985
|
}
|
|
74954
74986
|
|
|
74987
|
+
:host([disabled][appearance-readonly]) slot[name='start']::slotted(*) {
|
|
74988
|
+
opacity: var(--ni-private-default-start-slot-opacity);
|
|
74989
|
+
}
|
|
74990
|
+
|
|
74955
74991
|
.control {
|
|
74956
74992
|
-webkit-appearance: none;
|
|
74957
74993
|
font: inherit;
|
|
@@ -74985,10 +75021,14 @@ focus outline in that case.
|
|
|
74985
75021
|
color: ${controlLabelFontColor};
|
|
74986
75022
|
}
|
|
74987
75023
|
|
|
74988
|
-
|
|
75024
|
+
:host([disabled]) .control::placeholder {
|
|
74989
75025
|
color: ${bodyDisabledFontColor};
|
|
74990
75026
|
}
|
|
74991
75027
|
|
|
75028
|
+
:host([disabled][appearance-readonly]) .control::placeholder {
|
|
75029
|
+
color: ${controlLabelFontColor};
|
|
75030
|
+
}
|
|
75031
|
+
|
|
74992
75032
|
[part='end'] {
|
|
74993
75033
|
display: contents;
|
|
74994
75034
|
}
|
|
@@ -75175,6 +75215,7 @@ focus outline in that case.
|
|
|
75175
75215
|
*/
|
|
75176
75216
|
this.appearance = TextFieldAppearance.underline;
|
|
75177
75217
|
this.fullBleed = false;
|
|
75218
|
+
this.appearanceReadOnly = false;
|
|
75178
75219
|
}
|
|
75179
75220
|
}
|
|
75180
75221
|
__decorate([
|
|
@@ -75183,6 +75224,9 @@ focus outline in that case.
|
|
|
75183
75224
|
__decorate([
|
|
75184
75225
|
attr({ attribute: 'full-bleed', mode: 'boolean' })
|
|
75185
75226
|
], TextField.prototype, "fullBleed", void 0);
|
|
75227
|
+
__decorate([
|
|
75228
|
+
attr({ attribute: 'appearance-readonly', mode: 'boolean' })
|
|
75229
|
+
], TextField.prototype, "appearanceReadOnly", void 0);
|
|
75186
75230
|
const nimbleTextField = TextField.compose({
|
|
75187
75231
|
baseName: 'text-field',
|
|
75188
75232
|
baseClass: TextField$1,
|