@ni/spright-components 5.2.0 → 5.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.
@@ -26381,7 +26381,10 @@ so this becomes the fallback color for the slot */ ''}
26381
26381
 
26382
26382
  :host([disabled]) {
26383
26383
  color: ${bodyDisabledFontColor};
26384
- cursor: default;
26384
+ }
26385
+
26386
+ :host([disabled][appearance-readonly]) {
26387
+ color: ${bodyFontColor};
26385
26388
  }
26386
26389
 
26387
26390
  .label {
@@ -26394,6 +26397,10 @@ so this becomes the fallback color for the slot */ ''}
26394
26397
  color: ${controlLabelDisabledFontColor};
26395
26398
  }
26396
26399
 
26400
+ :host([disabled][appearance-readonly]) .label {
26401
+ color: ${controlLabelFontColor};
26402
+ }
26403
+
26397
26404
  .root {
26398
26405
  position: relative;
26399
26406
  display: flex;
@@ -26479,14 +26486,22 @@ so this becomes the fallback color for the slot */ ''}
26479
26486
  outline: none;
26480
26487
  }
26481
26488
 
26489
+ :host([disabled][appearance-readonly]) .control {
26490
+ cursor: text;
26491
+ }
26492
+
26482
26493
  .control::placeholder {
26483
26494
  color: ${controlLabelFontColor};
26484
26495
  }
26485
26496
 
26486
- .control[disabled]::placeholder {
26497
+ :host([disabled]) .control::placeholder {
26487
26498
  color: ${bodyDisabledFontColor};
26488
26499
  }
26489
26500
 
26501
+ :host([disabled][appearance-readonly]) .control::placeholder {
26502
+ color: ${controlLabelFontColor};
26503
+ }
26504
+
26490
26505
  .controls {
26491
26506
  display: contents;
26492
26507
  }
@@ -26648,6 +26663,7 @@ so this becomes the fallback color for the slot */ ''}
26648
26663
  constructor() {
26649
26664
  super(...arguments);
26650
26665
  this.appearance = NumberFieldAppearance.underline;
26666
+ this.appearanceReadOnly = false;
26651
26667
  }
26652
26668
  connectedCallback() {
26653
26669
  super.connectedCallback();
@@ -26658,6 +26674,9 @@ so this becomes the fallback color for the slot */ ''}
26658
26674
  __decorate([
26659
26675
  attr
26660
26676
  ], NumberField.prototype, "appearance", void 0);
26677
+ __decorate([
26678
+ attr({ attribute: 'appearance-readonly', mode: 'boolean' })
26679
+ ], NumberField.prototype, "appearanceReadOnly", void 0);
26661
26680
  /**
26662
26681
  * A function that returns a number-field registration for configuring the component with a DesignSystem.
26663
26682
  *
@@ -29876,7 +29895,7 @@ so this becomes the fallback color for the slot */ ''}
29876
29895
  value = value.replace(/\r\n?/g, "\n");
29877
29896
  }
29878
29897
  if (value)
29879
- this.insertNode(this.parser.schema.text(value), marks);
29898
+ this.insertNode(this.parser.schema.text(value), marks, !/\S/.test(value));
29880
29899
  this.findInText(dom);
29881
29900
  }
29882
29901
  else {
@@ -29940,7 +29959,7 @@ so this becomes the fallback color for the slot */ ''}
29940
29959
  ignoreFallback(dom, marks) {
29941
29960
  // Ignored BR nodes should at least create an inline context
29942
29961
  if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
29943
- this.findPlace(this.parser.schema.text("-"), marks);
29962
+ this.findPlace(this.parser.schema.text("-"), marks, true);
29944
29963
  }
29945
29964
  // Run any style parser associated with the node's styles. Either
29946
29965
  // return an updated array of marks, or null to indicate some of the
@@ -29988,7 +30007,7 @@ so this becomes the fallback color for the slot */ ''}
29988
30007
  marks = inner;
29989
30008
  }
29990
30009
  }
29991
- else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {
30010
+ else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == "BR")) {
29992
30011
  this.leafFallback(dom, marks);
29993
30012
  }
29994
30013
  }
@@ -30005,7 +30024,7 @@ so this becomes the fallback color for the slot */ ''}
30005
30024
  }
30006
30025
  else if (rule.getContent) {
30007
30026
  this.findInside(dom);
30008
- rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks));
30027
+ rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks, false));
30009
30028
  }
30010
30029
  else {
30011
30030
  let contentDOM = dom;
@@ -30036,19 +30055,22 @@ so this becomes the fallback color for the slot */ ''}
30036
30055
  // Try to find a way to fit the given node type into the current
30037
30056
  // context. May add intermediate wrappers and/or leave non-solid
30038
30057
  // nodes that we're in.
30039
- findPlace(node, marks) {
30058
+ findPlace(node, marks, cautious) {
30040
30059
  let route, sync;
30041
- for (let depth = this.open; depth >= 0; depth--) {
30060
+ for (let depth = this.open, penalty = 0; depth >= 0; depth--) {
30042
30061
  let cx = this.nodes[depth];
30043
30062
  let found = cx.findWrapping(node);
30044
- if (found && (!route || route.length > found.length)) {
30063
+ if (found && (!route || route.length > found.length + penalty)) {
30045
30064
  route = found;
30046
30065
  sync = cx;
30047
30066
  if (!found.length)
30048
30067
  break;
30049
30068
  }
30050
- if (cx.solid)
30051
- break;
30069
+ if (cx.solid) {
30070
+ if (cautious)
30071
+ break;
30072
+ penalty += 2;
30073
+ }
30052
30074
  }
30053
30075
  if (!route)
30054
30076
  return null;
@@ -30058,13 +30080,13 @@ so this becomes the fallback color for the slot */ ''}
30058
30080
  return marks;
30059
30081
  }
30060
30082
  // Try to insert the given node, adjusting the context when needed.
30061
- insertNode(node, marks) {
30083
+ insertNode(node, marks, cautious) {
30062
30084
  if (node.isInline && this.needsBlock && !this.top.type) {
30063
30085
  let block = this.textblockFromContext();
30064
30086
  if (block)
30065
30087
  marks = this.enterInner(block, null, marks);
30066
30088
  }
30067
- let innerMarks = this.findPlace(node, marks);
30089
+ let innerMarks = this.findPlace(node, marks, cautious);
30068
30090
  if (innerMarks) {
30069
30091
  this.closeExtra();
30070
30092
  let top = this.top;
@@ -30082,7 +30104,7 @@ so this becomes the fallback color for the slot */ ''}
30082
30104
  // Try to start a node of the given type, adjusting the context when
30083
30105
  // necessary.
30084
30106
  enter(type, attrs, marks, preserveWS) {
30085
- let innerMarks = this.findPlace(type.create(attrs), marks);
30107
+ let innerMarks = this.findPlace(type.create(attrs), marks, false);
30086
30108
  if (innerMarks)
30087
30109
  innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
30088
30110
  return innerMarks;
@@ -31216,7 +31238,7 @@ so this becomes the fallback color for the slot */ ''}
31216
31238
  let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
31217
31239
  if (from.deletedAcross && to.deletedAcross)
31218
31240
  return null;
31219
- return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice);
31241
+ return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
31220
31242
  }
31221
31243
  merge(other) {
31222
31244
  if (!(other instanceof ReplaceStep) || other.structure || this.structure)
@@ -32593,19 +32615,26 @@ so this becomes the fallback color for the slot */ ''}
32593
32615
  return this;
32594
32616
  }
32595
32617
  /**
32596
- Remove a mark (or a mark of the given type) from the node at
32618
+ Remove a mark (or all marks of the given type) from the node at
32597
32619
  position `pos`.
32598
32620
  */
32599
32621
  removeNodeMark(pos, mark) {
32600
- if (!(mark instanceof Mark$1)) {
32601
- let node = this.doc.nodeAt(pos);
32602
- if (!node)
32603
- throw new RangeError("No node at position " + pos);
32604
- mark = mark.isInSet(node.marks);
32605
- if (!mark)
32606
- return this;
32622
+ let node = this.doc.nodeAt(pos);
32623
+ if (!node)
32624
+ throw new RangeError("No node at position " + pos);
32625
+ if (mark instanceof Mark$1) {
32626
+ if (mark.isInSet(node.marks))
32627
+ this.step(new RemoveNodeMarkStep(pos, mark));
32628
+ }
32629
+ else {
32630
+ let set = node.marks, found, steps = [];
32631
+ while (found = mark.isInSet(set)) {
32632
+ steps.push(new RemoveNodeMarkStep(pos, found));
32633
+ set = found.removeFromSet(set);
32634
+ }
32635
+ for (let i = steps.length - 1; i >= 0; i--)
32636
+ this.step(steps[i]);
32607
32637
  }
32608
- this.step(new RemoveNodeMarkStep(pos, mark));
32609
32638
  return this;
32610
32639
  }
32611
32640
  /**
@@ -36629,7 +36658,7 @@ so this becomes the fallback color for the slot */ ''}
36629
36658
  // innerHTML, even on a detached document. This wraps the string in
36630
36659
  // a way that makes the browser allow us to use its parser again.
36631
36660
  if (!_policy)
36632
- _policy = trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
36661
+ _policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
36633
36662
  return _policy.createHTML(html);
36634
36663
  }
36635
36664
  function readHTML(html) {
@@ -37320,6 +37349,10 @@ so this becomes the fallback color for the slot */ ''}
37320
37349
  }
37321
37350
  }
37322
37351
  const dragCopyModifier = mac$2 ? "altKey" : "ctrlKey";
37352
+ function dragMoves(view, event) {
37353
+ let moves = view.someProp("dragCopies", test => !test(event));
37354
+ return moves != null ? moves : !event[dragCopyModifier];
37355
+ }
37323
37356
  handlers.dragstart = (view, _event) => {
37324
37357
  let event = _event;
37325
37358
  let mouseDown = view.input.mouseDown;
@@ -37349,7 +37382,7 @@ so this becomes the fallback color for the slot */ ''}
37349
37382
  event.dataTransfer.effectAllowed = "copyMove";
37350
37383
  if (!brokenClipboardAPI)
37351
37384
  event.dataTransfer.setData("text/plain", text);
37352
- view.dragging = new Dragging(slice, !event[dragCopyModifier], node);
37385
+ view.dragging = new Dragging(slice, dragMoves(view, event), node);
37353
37386
  };
37354
37387
  handlers.dragend = view => {
37355
37388
  let dragging = view.dragging;
@@ -37376,7 +37409,7 @@ so this becomes the fallback color for the slot */ ''}
37376
37409
  else {
37377
37410
  slice = parseFromClipboard(view, getText$1(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
37378
37411
  }
37379
- let move = !!(dragging && !event[dragCopyModifier]);
37412
+ let move = !!(dragging && dragMoves(view, event));
37380
37413
  if (view.someProp("handleDrop", f => f(view, event, slice || Slice.empty, move))) {
37381
37414
  event.preventDefault();
37382
37415
  return;
@@ -38661,9 +38694,11 @@ so this becomes the fallback color for the slot */ ''}
38661
38694
  // as being an iOS enter press), just dispatch an Enter key instead.
38662
38695
  if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&
38663
38696
  (!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
38664
- (!inlineChange && $from.pos < parse.doc.content.size && !$from.sameParent($to) &&
38697
+ (!inlineChange && $from.pos < parse.doc.content.size &&
38698
+ (!$from.sameParent($to) || !$from.parent.inlineContent) &&
38699
+ !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) &&
38665
38700
  (nextSel = Selection$2.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&
38666
- nextSel.head == $to.pos)) &&
38701
+ nextSel.head > $from.pos)) &&
38667
38702
  view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
38668
38703
  view.input.lastIOSEnter = 0;
38669
38704
  return;
@@ -40116,6 +40151,8 @@ so this becomes the fallback color for the slot */ ''}
40116
40151
  types[0] = deflt ? { type: deflt } : null;
40117
40152
  can = canSplit(tr.doc, splitPos, types.length, types);
40118
40153
  }
40154
+ if (!can)
40155
+ return false;
40119
40156
  tr.split(splitPos, types.length, types);
40120
40157
  if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
40121
40158
  let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
@@ -44730,7 +44767,7 @@ img.ProseMirror-separator {
44730
44767
  // @ts-ignore
44731
44768
  const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
44732
44769
  // @ts-ignore
44733
- plugins = prevPlugins.filter(plugin => !plugin.key.startsWith(name));
44770
+ plugins = plugins.filter(plugin => !plugin.key.startsWith(name));
44734
44771
  });
44735
44772
  if (prevPlugins.length === plugins.length) {
44736
44773
  // No plugin was removed, so we don’t need to update the state
@@ -63767,6 +63804,10 @@ img.ProseMirror-separator {
63767
63804
  }
63768
63805
  };
63769
63806
 
63807
+ function safelyAccessDocument(_document) {
63808
+ return _document || (typeof document !== 'undefined' ? document : null);
63809
+ }
63810
+
63770
63811
  //
63771
63812
 
63772
63813
  //
@@ -63906,7 +63947,7 @@ img.ProseMirror-separator {
63906
63947
  columnSizingStart: []
63907
63948
  }));
63908
63949
  };
63909
- const contextDocument = _contextDocument || typeof document !== 'undefined' ? document : null;
63950
+ const contextDocument = safelyAccessDocument(_contextDocument);
63910
63951
  const mouseEvents = {
63911
63952
  moveHandler: e => onMove(e.clientX),
63912
63953
  upHandler: e => {
@@ -74849,6 +74890,7 @@ focus outline in that case.
74849
74890
  frameless: 'frameless'
74850
74891
  };
74851
74892
 
74893
+ // prettier-ignore
74852
74894
  const styles$8 = css `
74853
74895
  ${display$1('inline-block')}
74854
74896
  ${styles$Q}
@@ -74863,12 +74905,17 @@ focus outline in that case.
74863
74905
  --ni-private-height-within-border: calc(
74864
74906
  ${controlHeight} - 2 * ${borderWidth}
74865
74907
  );
74908
+ --ni-private-default-start-slot-opacity: 0.6;
74866
74909
  }
74867
74910
 
74868
74911
  :host([disabled]) {
74869
74912
  color: ${bodyDisabledFontColor};
74870
74913
  }
74871
74914
 
74915
+ :host([disabled][appearance-readonly]) {
74916
+ color: ${bodyFontColor};
74917
+ }
74918
+
74872
74919
  .label {
74873
74920
  display: flex;
74874
74921
  color: ${controlLabelFontColor};
@@ -74879,6 +74926,10 @@ focus outline in that case.
74879
74926
  color: ${controlLabelDisabledFontColor};
74880
74927
  }
74881
74928
 
74929
+ :host([disabled][appearance-readonly]) .label {
74930
+ color: ${controlLabelFontColor};
74931
+ }
74932
+
74882
74933
  .root {
74883
74934
  position: relative;
74884
74935
  display: flex;
@@ -74944,7 +74995,7 @@ focus outline in that case.
74944
74995
 
74945
74996
  slot[name='start']::slotted(*) {
74946
74997
  flex: none;
74947
- opacity: 0.6;
74998
+ opacity: var(--ni-private-default-start-slot-opacity);
74948
74999
  margin-right: ${smallPadding};
74949
75000
  }
74950
75001
 
@@ -74952,6 +75003,10 @@ focus outline in that case.
74952
75003
  opacity: 0.3;
74953
75004
  }
74954
75005
 
75006
+ :host([disabled][appearance-readonly]) slot[name='start']::slotted(*) {
75007
+ opacity: var(--ni-private-default-start-slot-opacity);
75008
+ }
75009
+
74955
75010
  .control {
74956
75011
  -webkit-appearance: none;
74957
75012
  font: inherit;
@@ -74981,14 +75036,22 @@ focus outline in that case.
74981
75036
  text-overflow: clip;
74982
75037
  }
74983
75038
 
75039
+ :host([disabled][appearance-readonly]) .control {
75040
+ cursor: text;
75041
+ }
75042
+
74984
75043
  .control::placeholder {
74985
75044
  color: ${controlLabelFontColor};
74986
75045
  }
74987
75046
 
74988
- .control[disabled]::placeholder {
75047
+ :host([disabled]) .control::placeholder {
74989
75048
  color: ${bodyDisabledFontColor};
74990
75049
  }
74991
75050
 
75051
+ :host([disabled][appearance-readonly]) .control::placeholder {
75052
+ color: ${controlLabelFontColor};
75053
+ }
75054
+
74992
75055
  [part='end'] {
74993
75056
  display: contents;
74994
75057
  }
@@ -75175,6 +75238,7 @@ focus outline in that case.
75175
75238
  */
75176
75239
  this.appearance = TextFieldAppearance.underline;
75177
75240
  this.fullBleed = false;
75241
+ this.appearanceReadOnly = false;
75178
75242
  }
75179
75243
  }
75180
75244
  __decorate([
@@ -75183,6 +75247,9 @@ focus outline in that case.
75183
75247
  __decorate([
75184
75248
  attr({ attribute: 'full-bleed', mode: 'boolean' })
75185
75249
  ], TextField.prototype, "fullBleed", void 0);
75250
+ __decorate([
75251
+ attr({ attribute: 'appearance-readonly', mode: 'boolean' })
75252
+ ], TextField.prototype, "appearanceReadOnly", void 0);
75186
75253
  const nimbleTextField = TextField.compose({
75187
75254
  baseName: 'text-field',
75188
75255
  baseClass: TextField$1,