@ni/nimble-components 32.3.2 → 32.4.1

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.
@@ -16035,6 +16035,7 @@
16035
16035
  const PowerGreen = "#32eb96";
16036
16036
  const PowerGreen10 = "#364941";
16037
16037
  const PowerGreen30 = "#356d54";
16038
+ const PowerGreenDark50 = "#98f5ca";
16038
16039
  const Black22 = "#e6e6e6";
16039
16040
  const Black82 = "#434445";
16040
16041
  const NiHoneyLight = "#ffe76b";
@@ -16658,7 +16659,7 @@
16658
16659
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBackgroundTransientColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark105, DigitalGreenDark, DigitalGreenDark));
16659
16660
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBorderStaticColor)).withDefault((element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, DigitalGreenLight));
16660
16661
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBorderTransientColor)).withDefault((element) => getColorForTheme(element, DigitalGreenLight, hexToRgbaCssColor(PowerGreen, 0.85), hexToRgbaCssColor(PowerGreen, 0.85)));
16661
- DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventStaticFontColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark110, White, White));
16662
+ DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventStaticFontColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark110, PowerGreenDark50, PowerGreenDark50));
16662
16663
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventDynamicFontColor)).withDefault((element) => getColorForTheme(element, White, White, White));
16663
16664
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventTransientFontColor)).withDefault((element) => getColorForTheme(element, White, White, White));
16664
16665
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBackgroundHoverStaticColor)).withDefault((element) => getColorForTheme(element, DigitalGreenLight30, PowerGreen30, PowerGreen30));
@@ -28723,7 +28724,7 @@ so this becomes the fallback color for the slot */ ''}
28723
28724
  let result = [];
28724
28725
  for (let typeName in types) {
28725
28726
  let type = types[typeName];
28726
- if (type.groups.indexOf(name) > -1)
28727
+ if (type.isInGroup(name))
28727
28728
  result.push(type);
28728
28729
  }
28729
28730
  if (result.length == 0)
@@ -29002,6 +29003,13 @@ so this becomes the fallback color for the slot */ ''}
29002
29003
  */
29003
29004
  get isAtom() { return this.isLeaf || !!this.spec.atom; }
29004
29005
  /**
29006
+ Return true when this node type is part of the given
29007
+ [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
29008
+ */
29009
+ isInGroup(group) {
29010
+ return this.groups.indexOf(group) > -1;
29011
+ }
29012
+ /**
29005
29013
  The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
29006
29014
  */
29007
29015
  get whitespace() {
@@ -29834,6 +29842,7 @@ so this becomes the fallback color for the slot */ ''}
29834
29842
  contentDOM = rule.contentElement;
29835
29843
  this.findAround(dom, contentDOM, true);
29836
29844
  this.addAll(contentDOM, marks);
29845
+ this.findAround(dom, contentDOM, false);
29837
29846
  }
29838
29847
  if (sync && this.sync(startIn))
29839
29848
  this.open--;
@@ -30012,7 +30021,7 @@ so this becomes the fallback color for the slot */ ''}
30012
30021
  let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type
30013
30022
  : option && depth >= minDepth ? option.node(depth - minDepth).type
30014
30023
  : null;
30015
- if (!next || (next.name != part && next.groups.indexOf(part) == -1))
30024
+ if (!next || (next.name != part && !next.isInGroup(part)))
30016
30025
  return false;
30017
30026
  depth--;
30018
30027
  }
@@ -41777,12 +41786,16 @@ so this becomes the fallback color for the slot */ ''}
41777
41786
  return;
41778
41787
  }
41779
41788
  let start = $pos.parent.childAfter($pos.parentOffset);
41780
- if ($pos.parentOffset === start.offset && start.offset !== 0) {
41789
+ // If the cursor is at the start of a text node that does not have the mark, look backward
41790
+ if (!start.node || !start.node.marks.some(mark => mark.type === type)) {
41781
41791
  start = $pos.parent.childBefore($pos.parentOffset);
41782
41792
  }
41783
- if (!start.node) {
41793
+ // If there is no text node with the mark even backward, return undefined
41794
+ if (!start.node || !start.node.marks.some(mark => mark.type === type)) {
41784
41795
  return;
41785
41796
  }
41797
+ // We now know that the cursor is either at the start, middle or end of a text node with the specified mark
41798
+ // so we can look it up on the targeted mark
41786
41799
  const mark = findMarkInSet([...start.node.marks], type, attributes);
41787
41800
  if (!mark) {
41788
41801
  return;
@@ -42072,7 +42085,7 @@ so this becomes the fallback color for the slot */ ''}
42072
42085
  var _a;
42073
42086
  if (dispatch) {
42074
42087
  options = {
42075
- parseOptions: {},
42088
+ parseOptions: editor.options.parseOptions,
42076
42089
  updateSelection: true,
42077
42090
  applyInputRules: false,
42078
42091
  applyPasteRules: false,
@@ -42093,7 +42106,9 @@ so this becomes the fallback color for the slot */ ''}
42093
42106
  editor,
42094
42107
  error: e,
42095
42108
  disableCollaboration: () => {
42096
- console.error('[tiptap error]: Unable to disable collaboration at this point in time');
42109
+ if (editor.storage.collaboration) {
42110
+ editor.storage.collaboration.isDisabled = true;
42111
+ }
42097
42112
  },
42098
42113
  });
42099
42114
  return false;
@@ -43867,7 +43882,8 @@ so this becomes the fallback color for the slot */ ''}
43867
43882
  const children = [];
43868
43883
  this.node.content.forEach((node, offset) => {
43869
43884
  const isBlock = node.isBlock && !node.isTextblock;
43870
- const targetPos = this.pos + offset + 1;
43885
+ const isNonTextAtom = node.isAtom && !node.isText;
43886
+ const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
43871
43887
  const $pos = this.resolvedPos.doc.resolve(targetPos);
43872
43888
  if (!isBlock && $pos.depth <= this.depth) {
43873
43889
  return;
@@ -43943,9 +43959,12 @@ so this becomes the fallback color for the slot */ ''}
43943
43959
  return nodes;
43944
43960
  }
43945
43961
  setAttribute(attributes) {
43946
- const oldSelection = this.editor.state.selection;
43947
- this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, attributes).setTextSelection(oldSelection.from)
43948
- .run();
43962
+ const { tr } = this.editor.state;
43963
+ tr.setNodeMarkup(this.from, undefined, {
43964
+ ...this.node.attrs,
43965
+ ...attributes,
43966
+ });
43967
+ this.editor.view.dispatch(tr);
43949
43968
  }
43950
43969
  }
43951
43970
 
@@ -44197,18 +44216,27 @@ img.ProseMirror-separator {
44197
44216
  /**
44198
44217
  * Unregister a ProseMirror plugin.
44199
44218
  *
44200
- * @param nameOrPluginKey The plugins name
44219
+ * @param nameOrPluginKeyToRemove The plugins name
44201
44220
  * @returns The new editor state or undefined if the editor is destroyed
44202
44221
  */
44203
- unregisterPlugin(nameOrPluginKey) {
44222
+ unregisterPlugin(nameOrPluginKeyToRemove) {
44204
44223
  if (this.isDestroyed) {
44205
44224
  return undefined;
44206
44225
  }
44207
- // @ts-ignore
44208
- const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
44209
- const state = this.state.reconfigure({
44226
+ const prevPlugins = this.state.plugins;
44227
+ let plugins = prevPlugins;
44228
+ [].concat(nameOrPluginKeyToRemove).forEach(nameOrPluginKey => {
44210
44229
  // @ts-ignore
44211
- plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(name)),
44230
+ const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
44231
+ // @ts-ignore
44232
+ plugins = prevPlugins.filter(plugin => !plugin.key.startsWith(name));
44233
+ });
44234
+ if (prevPlugins.length === plugins.length) {
44235
+ // No plugin was removed, so we don’t need to update the state
44236
+ return undefined;
44237
+ }
44238
+ const state = this.state.reconfigure({
44239
+ plugins,
44212
44240
  });
44213
44241
  this.view.updateState(state);
44214
44242
  return state;
@@ -44271,6 +44299,9 @@ img.ProseMirror-separator {
44271
44299
  editor: this,
44272
44300
  error: e,
44273
44301
  disableCollaboration: () => {
44302
+ if (this.storage.collaboration) {
44303
+ this.storage.collaboration.isDisabled = true;
44304
+ }
44274
44305
  // To avoid syncing back invalid content, reinitialize the extensions without the collaboration extension
44275
44306
  this.options.extensions = this.options.extensions.filter(extension => extension.name !== 'collaboration');
44276
44307
  // Restart the initialization process by recreating the extension manager with the new set of extensions
@@ -44289,6 +44320,12 @@ img.ProseMirror-separator {
44289
44320
  selection: selection || undefined,
44290
44321
  }),
44291
44322
  });
44323
+ // add `role="textbox"` to the editor element
44324
+ this.view.dom.setAttribute('role', 'textbox');
44325
+ // add aria-label to the editor element
44326
+ if (!this.view.dom.getAttribute('aria-label')) {
44327
+ this.view.dom.setAttribute('aria-label', 'Rich-Text Editor');
44328
+ }
44292
44329
  // `editor.view` is not yet available at this time.
44293
44330
  // Therefore we will add all plugins and node views directly afterwards.
44294
44331
  const newState = this.state.reconfigure({
@@ -55421,6 +55458,10 @@ img.ProseMirror-separator {
55421
55458
  tag: 'b',
55422
55459
  getAttrs: node => node.style.fontWeight !== 'normal' && null,
55423
55460
  },
55461
+ {
55462
+ style: 'font-weight=400',
55463
+ clearMark: mark => mark.type.name === this.name,
55464
+ },
55424
55465
  {
55425
55466
  style: 'font-weight',
55426
55467
  getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
@@ -56326,6 +56367,10 @@ img.ProseMirror-separator {
56326
56367
  tag: 'i',
56327
56368
  getAttrs: node => node.style.fontStyle !== 'normal' && null,
56328
56369
  },
56370
+ {
56371
+ style: 'font-style=normal',
56372
+ clearMark: mark => mark.type.name === this.name,
56373
+ },
56329
56374
  {
56330
56375
  style: 'font-style=italic',
56331
56376
  },
@@ -58711,6 +58756,7 @@ img.ProseMirror-separator {
58711
58756
  */
58712
58757
  const Mention = Node$1.create({
58713
58758
  name: 'mention',
58759
+ priority: 101,
58714
58760
  addOptions() {
58715
58761
  return {
58716
58762
  HTMLAttributes: {},