@ni/nimble-components 35.0.3 → 35.1.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.
@@ -18291,6 +18291,10 @@
18291
18291
  name: 'folder_open_16_x_16',
18292
18292
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M7 3v1.002h6V6h-1V5H3v1H2V3ZM2 13h11l1-6H2Z" class="cls-1"/></svg>`,
18293
18293
  };
18294
+ const forklift16X16 = {
18295
+ name: 'forklift_16_x_16',
18296
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M13 11V4c0-.55-.45-1-1-1h-1v4.24l-1.53-3.3C9.24 3.37 8.69 3 8.08 3H4.01l1 1v3h-2v2.19c-.31.35-.5.81-.5 1.31 0 1.1.9 2 2 2 .5 0 .96-.19 1.31-.5h3.04c.39.32.88.52 1.42.52s1.04-.2 1.42-.52H15zm-8.5.25c-.41 0-.75-.34-.75-.75s.34-.75.75-.75.75.34.75.75-.34.75-.75.75m4.18-2.57L7 7H6V4h2.07c.21 0 .39.12.47.34l1.71 3.68c-.62 0-1.18.25-1.58.66Zm1.59 2.59c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1" class="cls-1"/></svg>`,
18297
+ };
18294
18298
  const forwardSlash16X16 = {
18295
18299
  name: 'forward_slash_16_x_16',
18296
18300
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m6.027 14 2.5-12h1.5l-2.5 12z" class="cls-1"/></svg>`,
@@ -24027,6 +24031,18 @@ so this becomes the fallback color for the slot */ ''}
24027
24031
  }
24028
24032
  registerIconSvg('icon-folder-open', IconFolderOpen);
24029
24033
 
24034
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
24035
+ // See generation source in nimble-components/build/generate-icons
24036
+ /**
24037
+ * The icon component for the 'forklift' icon
24038
+ */
24039
+ class IconForklift extends IconSvg {
24040
+ constructor() {
24041
+ super(forklift16X16);
24042
+ }
24043
+ }
24044
+ registerIconSvg('icon-forklift', IconForklift);
24045
+
24030
24046
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
24031
24047
  // See generation source in nimble-components/build/generate-icons
24032
24048
  /**
@@ -33173,6 +33189,27 @@ so this becomes the fallback color for the slot */ ''}
33173
33189
  return this.steps.length > 0;
33174
33190
  }
33175
33191
  /**
33192
+ Return a single range, in post-transform document positions,
33193
+ that covers all content changed by this transform. Returns null
33194
+ if no replacements are made. Note that this will ignore changes
33195
+ that add/remove marks without replacing the underlying content.
33196
+ */
33197
+ changedRange() {
33198
+ let from = 1e9, to = -1e9;
33199
+ for (let i = 0; i < this.mapping.maps.length; i++) {
33200
+ let map = this.mapping.maps[i];
33201
+ if (i) {
33202
+ from = map.map(from, 1);
33203
+ to = map.map(to, -1);
33204
+ }
33205
+ map.forEach((_f, _t, fromB, toB) => {
33206
+ from = Math.min(from, fromB);
33207
+ to = Math.max(to, toB);
33208
+ });
33209
+ }
33210
+ return from == 1e9 ? null : { from, to };
33211
+ }
33212
+ /**
33176
33213
  @internal
33177
33214
  */
33178
33215
  addStep(step, doc) {
@@ -41824,8 +41861,12 @@ so this becomes the fallback color for the slot */ ''}
41824
41861
  }
41825
41862
  });
41826
41863
  };
41827
- if (view.hasFocus() && position === null || position === false) {
41828
- return true;
41864
+ try {
41865
+ if (view.hasFocus() && position === null || position === false) {
41866
+ return true;
41867
+ }
41868
+ } catch {
41869
+ return false;
41829
41870
  }
41830
41871
  if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
41831
41872
  delayedFocus();
@@ -45270,19 +45311,20 @@ so this becomes the fallback color for the slot */ ''}
45270
45311
  this.node.content.forEach((node, offset) => {
45271
45312
  const isBlock = node.isBlock && !node.isTextblock;
45272
45313
  const isNonTextAtom = node.isAtom && !node.isText;
45314
+ const isInline = node.isInline;
45273
45315
  const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
45274
45316
  if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) {
45275
45317
  return;
45276
45318
  }
45277
45319
  const $pos = this.resolvedPos.doc.resolve(targetPos);
45278
- if (!isBlock && $pos.depth <= this.depth) {
45320
+ if (!isBlock && !isInline && $pos.depth <= this.depth) {
45279
45321
  return;
45280
45322
  }
45281
- const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock ? node : null);
45323
+ const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);
45282
45324
  if (isBlock) {
45283
45325
  childNodePos.actualDepth = this.depth + 1;
45284
45326
  }
45285
- children.push(new _NodePos($pos, this.editor, isBlock, isBlock ? node : null));
45327
+ children.push(childNodePos);
45286
45328
  });
45287
45329
  return children;
45288
45330
  }
@@ -56570,8 +56612,7 @@ ${renderedContent}
56570
56612
  }
56571
56613
  if (node && node.isText && marks.some(mark => {
56572
56614
  let info = this.getMark(mark.type.name);
56573
- return info && info.expelEnclosingWhitespace &&
56574
- (index == parent.childCount - 1 || !mark.isInSet(parent.child(index + 1).marks));
56615
+ return info && info.expelEnclosingWhitespace && !this.isMarkAhead(parent, index + 1, mark);
56575
56616
  })) {
56576
56617
  let [_, rest, trail] = /^(.*?)(\s*)$/m.exec(node.text);
56577
56618
  if (trail) {
@@ -56715,6 +56756,19 @@ ${renderedContent}
56715
56756
  trailing: (text.match(/(\s+)$/) || [undefined])[0]
56716
56757
  };
56717
56758
  }
56759
+ /**
56760
+ @internal
56761
+ */
56762
+ isMarkAhead(parent, index, mark) {
56763
+ for (;; index++) {
56764
+ if (index == parent.childCount)
56765
+ return false;
56766
+ let next = parent.child(index);
56767
+ if (next.type.name != this.options.hardBreakNodeName)
56768
+ return mark.isInSet(next.marks);
56769
+ index++;
56770
+ }
56771
+ }
56718
56772
  }
56719
56773
 
56720
56774
  var _a$4;
@@ -59413,31 +59467,33 @@ ${renderedContent}
59413
59467
  if (!view.editable) {
59414
59468
  return false;
59415
59469
  }
59470
+ let link = null;
59471
+ if (event.target instanceof HTMLAnchorElement) {
59472
+ link = event.target;
59473
+ } else {
59474
+ const target = event.target;
59475
+ if (!target) {
59476
+ return false;
59477
+ }
59478
+ const root = options.editor.view.dom;
59479
+ link = target.closest("a");
59480
+ if (link && !root.contains(link)) {
59481
+ link = null;
59482
+ }
59483
+ }
59484
+ if (!link) {
59485
+ return false;
59486
+ }
59416
59487
  let handled = false;
59417
59488
  if (options.enableClickSelection) {
59418
59489
  const commandResult = options.editor.commands.extendMarkRange(options.type.name);
59419
59490
  handled = commandResult;
59420
59491
  }
59421
59492
  if (options.openOnClick) {
59422
- let link = null;
59423
- if (event.target instanceof HTMLAnchorElement) {
59424
- link = event.target;
59425
- } else {
59426
- let a = event.target;
59427
- const els = [];
59428
- while (a.nodeName !== "DIV") {
59429
- els.push(a);
59430
- a = a.parentNode;
59431
- }
59432
- link = els.find((value) => value.nodeName === "A");
59433
- }
59434
- if (!link) {
59435
- return handled;
59436
- }
59437
59493
  const attrs = getAttributes(view.state, options.type.name);
59438
- const href = (_a = link == null ? void 0 : link.href) != null ? _a : attrs.href;
59439
- const target = (_b = link == null ? void 0 : link.target) != null ? _b : attrs.target;
59440
- if (link && href) {
59494
+ const href = (_a = link.href) != null ? _a : attrs.href;
59495
+ const target = (_b = link.target) != null ? _b : attrs.target;
59496
+ if (href) {
59441
59497
  window.open(href, target);
59442
59498
  handled = true;
59443
59499
  }
@@ -59874,11 +59930,13 @@ ${renderedContent}
59874
59930
  node,
59875
59931
  h,
59876
59932
  (context) => {
59933
+ var _a, _b;
59877
59934
  if (context.parentType === "bulletList") {
59878
59935
  return "- ";
59879
59936
  }
59880
59937
  if (context.parentType === "orderedList") {
59881
- return `${context.index + 1}. `;
59938
+ const start = ((_b = (_a = context.meta) == null ? void 0 : _a.parentAttrs) == null ? void 0 : _b.start) || 1;
59939
+ return `${start + context.index}. `;
59882
59940
  }
59883
59941
  return "- ";
59884
59942
  },
@@ -61330,6 +61388,8 @@ ${nextLine.slice(indentLevel + 2)}`;
61330
61388
  var index_default$2 = Mention;
61331
61389
 
61332
61390
  // src/paragraph.ts
61391
+ var EMPTY_PARAGRAPH_MARKDOWN = "&nbsp;";
61392
+ var NBSP_CHAR = "\xA0";
61333
61393
  var Paragraph = Node3.create({
61334
61394
  name: "paragraph",
61335
61395
  priority: 1e3,
@@ -61351,18 +61411,21 @@ ${nextLine.slice(indentLevel + 2)}`;
61351
61411
  if (tokens.length === 1 && tokens[0].type === "image") {
61352
61412
  return helpers.parseChildren([tokens[0]]);
61353
61413
  }
61354
- return helpers.createNode(
61355
- "paragraph",
61356
- void 0,
61357
- // no attributes for paragraph
61358
- helpers.parseInline(tokens)
61359
- );
61414
+ const content = helpers.parseInline(tokens);
61415
+ if (content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) {
61416
+ return helpers.createNode("paragraph", void 0, []);
61417
+ }
61418
+ return helpers.createNode("paragraph", void 0, content);
61360
61419
  },
61361
61420
  renderMarkdown: (node, h) => {
61362
- if (!node || !Array.isArray(node.content)) {
61421
+ if (!node) {
61363
61422
  return "";
61364
61423
  }
61365
- return h.renderChildren(node.content);
61424
+ const content = Array.isArray(node.content) ? node.content : [];
61425
+ if (content.length === 0) {
61426
+ return EMPTY_PARAGRAPH_MARKDOWN;
61427
+ }
61428
+ return h.renderChildren(content);
61366
61429
  },
61367
61430
  addCommands() {
61368
61431
  return {
@@ -62573,12 +62636,17 @@ ${nextLine.slice(indentLevel + 2)}`;
62573
62636
  };
62574
62637
  }
62575
62638
  });
62639
+ var DEFAULT_DATA_ATTRIBUTE = "placeholder";
62640
+ function preparePlaceholderAttribute(attr) {
62641
+ return attr.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
62642
+ }
62576
62643
  var Placeholder = Extension.create({
62577
62644
  name: "placeholder",
62578
62645
  addOptions() {
62579
62646
  return {
62580
62647
  emptyEditorClass: "is-editor-empty",
62581
62648
  emptyNodeClass: "is-empty",
62649
+ dataAttribute: DEFAULT_DATA_ATTRIBUTE,
62582
62650
  placeholder: "Write something \u2026",
62583
62651
  showOnlyWhenEditable: true,
62584
62652
  showOnlyCurrent: true,
@@ -62586,6 +62654,7 @@ ${nextLine.slice(indentLevel + 2)}`;
62586
62654
  };
62587
62655
  },
62588
62656
  addProseMirrorPlugins() {
62657
+ const dataAttribute = this.options.dataAttribute ? `data-${preparePlaceholderAttribute(this.options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;
62589
62658
  return [
62590
62659
  new Plugin({
62591
62660
  key: new PluginKey("placeholder"),
@@ -62608,7 +62677,7 @@ ${nextLine.slice(indentLevel + 2)}`;
62608
62677
  }
62609
62678
  const decoration = Decoration.node(pos, pos + node.nodeSize, {
62610
62679
  class: classes.join(" "),
62611
- "data-placeholder": typeof this.options.placeholder === "function" ? this.options.placeholder({
62680
+ [dataAttribute]: typeof this.options.placeholder === "function" ? this.options.placeholder({
62612
62681
  editor: this.editor,
62613
62682
  node,
62614
62683
  pos,