@ni/nimble-components 35.7.0 → 35.8.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.
@@ -19064,6 +19064,10 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19064
19064
  name: 'sparkles_16_x_16',
19065
19065
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M11.498 2a2.85 2.85 0 0 1-.811 1.69A2.85 2.85 0 0 1 9 4.498a2.85 2.85 0 0 1 1.69.809c.477.476.739 1.076.812 1.693a2.85 2.85 0 0 1 .811-1.69A2.85 2.85 0 0 1 14 4.502a2.85 2.85 0 0 1-1.69-.809A2.84 2.84 0 0 1 11.497 2M7.495 3c-.163 1.355-.737 2.674-1.784 3.719C4.668 7.76 3.352 8.332 2 8.496c1.355.163 2.674.736 3.72 1.78C6.768 11.321 7.343 12.642 7.505 14c.162-1.355.736-2.674 1.784-3.719C10.332 9.24 11.648 8.668 13 8.504c-1.356-.163-2.674-.736-3.72-1.78C8.231 5.679 7.656 4.358 7.495 3" class="cls-1"/></svg>`,
19066
19066
  };
19067
+ const sparklesNested16X16 = {
19068
+ name: 'sparkles_nested_16_x_16',
19069
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m14.21 7.52-.11-.06a14.05 14.05 0 0 1-5.59-5.59l-.06-.11a.51.51 0 0 0-.9 0l-.06.11A14.05 14.05 0 0 1 1.9 7.46l-.11.06a.51.51 0 0 0 0 .9l.11.06a14.05 14.05 0 0 1 5.59 5.59l.06.11c.19.36.7.36.9 0l.06-.11a14.05 14.05 0 0 1 5.59-5.59l.11-.06a.51.51 0 0 0 0-.9m-1.71.36-.08.04a9.46 9.46 0 0 0-3.75 3.75l-.04.08a.34.34 0 0 1-.6 0l-.04-.08a9.46 9.46 0 0 0-3.75-3.75l-.08-.04a.34.34 0 0 1 0-.6l.08-.04a9.46 9.46 0 0 0 3.75-3.75l.04-.08a.34.34 0 0 1 .6 0l.04.08a9.46 9.46 0 0 0 3.75 3.75l.08.04c.24.13.24.47 0 .6" class="cls-1"/><path d="m11.36 7.6-.03.02a6.63 6.63 0 0 0-2.65 2.65l-.02.03c-.1.18-.35.18-.45 0l-.02-.03a6.63 6.63 0 0 0-2.65-2.65l-.03-.02a.255.255 0 0 1 0-.45l.03-.02a6.63 6.63 0 0 0 2.65-2.65l.02-.03c.1-.18.35-.18.45 0l.02.03a6.63 6.63 0 0 0 2.65 2.65l.03.02c.18.1.18.35 0 .45" class="cls-1"/></svg>`,
19070
+ };
19067
19071
  const spinner = {
19068
19072
  name: 'spinner',
19069
19073
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3.967 7.143h-.762a4.885 4.885 0 0 1 3.938-3.94v.771a4.12 4.12 0 0 0-3.176 3.169M8 2v1.875A4.125 4.125 0 1 1 3.875 8H2a6 6 0 1 0 6-6" class="cls-1"/></svg>`,
@@ -25880,6 +25884,18 @@ so this becomes the fallback color for the slot */ ''}
25880
25884
  }
25881
25885
  registerIconSvg('icon-sparkles', IconSparkles);
25882
25886
 
25887
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
25888
+ // See generation source in nimble-components/build/generate-icons
25889
+ /**
25890
+ * The icon component for the 'sparklesNested' icon
25891
+ */
25892
+ class IconSparklesNested extends IconSvg {
25893
+ constructor() {
25894
+ super(sparklesNested16X16);
25895
+ }
25896
+ }
25897
+ registerIconSvg('icon-sparkles-nested', IconSparklesNested);
25898
+
25883
25899
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
25884
25900
  // See generation source in nimble-components/build/generate-icons
25885
25901
  /**
@@ -39623,8 +39639,8 @@ so this becomes the fallback color for the slot */ ''}
39623
39639
  this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
39624
39640
  let { selection } = view.state;
39625
39641
  if (event.button == 0 &&
39626
- targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
39627
- selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
39642
+ (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
39643
+ selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos))
39628
39644
  this.mightDrag = {
39629
39645
  node: targetNode,
39630
39646
  pos: targetPos,
@@ -39973,8 +39989,9 @@ so this becomes the fallback color for the slot */ ''}
39973
39989
  }
39974
39990
  const dragCopyModifier = mac$2 ? "altKey" : "ctrlKey";
39975
39991
  function dragMoves(view, event) {
39976
- let moves = view.someProp("dragCopies", test => !test(event));
39977
- return moves != null ? moves : !event[dragCopyModifier];
39992
+ let copy;
39993
+ view.someProp("dragCopies", test => { copy = copy || test(event); });
39994
+ return copy != null ? !copy : !event[dragCopyModifier];
39978
39995
  }
39979
39996
  handlers.dragstart = (view, _event) => {
39980
39997
  let event = _event;
@@ -40001,7 +40018,7 @@ so this becomes the fallback color for the slot */ ''}
40001
40018
  if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)
40002
40019
  event.dataTransfer.clearData();
40003
40020
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
40004
- // See https://github.com/ProseMirror/prosemirror/issues/1156
40021
+ // See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1156
40005
40022
  event.dataTransfer.effectAllowed = "copyMove";
40006
40023
  if (!brokenClipboardAPI)
40007
40024
  event.dataTransfer.setData("text/plain", text);
@@ -41626,7 +41643,7 @@ so this becomes the fallback color for the slot */ ''}
41626
41643
  this.pluginViews = [];
41627
41644
  /**
41628
41645
  Holds `true` when a hack node is needed in Firefox to prevent the
41629
- [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
41646
+ [space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)
41630
41647
  @internal
41631
41648
  */
41632
41649
  this.requiresGeckoHackNode = false;
@@ -43167,7 +43184,7 @@ so this becomes the fallback color for the slot */ ''}
43167
43184
  const fromSelectionAtStart = $from.parentOffset === 0;
43168
43185
  const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
43169
43186
  const hasContent = $fromNode.content.size > 0;
43170
- if (fromSelectionAtStart && isTextSelection2 && hasContent) {
43187
+ if (fromSelectionAtStart && isTextSelection2 && hasContent && isOnlyBlockContent) {
43171
43188
  from = Math.max(0, from - 1);
43172
43189
  }
43173
43190
  tr.replaceWith(from, to, newContent);
@@ -44784,6 +44801,16 @@ so this becomes the fallback color for the slot */ ''}
44784
44801
  tr.join(after);
44785
44802
  return true;
44786
44803
  };
44804
+ function createInnerSelectionForWholeDocList(tr) {
44805
+ const doc = tr.doc;
44806
+ const list = doc.firstChild;
44807
+ if (!list) {
44808
+ return null;
44809
+ }
44810
+ const $start = doc.resolve(1);
44811
+ const $end = doc.resolve(list.nodeSize - 1);
44812
+ return TextSelection.between($start, $end);
44813
+ }
44787
44814
  var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {
44788
44815
  const { extensions, splittableMarks } = editor.extensionManager;
44789
44816
  const listType = getNodeType(listTypeOrName, state.schema);
@@ -44796,13 +44823,35 @@ so this becomes the fallback color for the slot */ ''}
44796
44823
  return false;
44797
44824
  }
44798
44825
  const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
44799
- if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
44800
- if (parentList.node.type === listType) {
44826
+ const isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;
44827
+ const topLevelNodes = state.doc.content.content;
44828
+ const soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;
44829
+ const allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {
44830
+ node: soleTopLevelNode,
44831
+ pos: 0} : null;
44832
+ const currentList = parentList != null ? parentList : allSelectionList;
44833
+ const isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;
44834
+ const hasWholeDocSelectedList = !!allSelectionList;
44835
+ if ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {
44836
+ if (currentList.node.type === listType) {
44837
+ if (isAllSelection && hasWholeDocSelectedList) {
44838
+ return chain().command(({ tr: trx, dispatch: disp }) => {
44839
+ const nextSelection = createInnerSelectionForWholeDocList(trx);
44840
+ if (!nextSelection) {
44841
+ return false;
44842
+ }
44843
+ trx.setSelection(nextSelection);
44844
+ if (disp) {
44845
+ disp(trx);
44846
+ }
44847
+ return true;
44848
+ }).liftListItem(itemType).run();
44849
+ }
44801
44850
  return commands.liftListItem(itemType);
44802
44851
  }
44803
- if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
44852
+ if (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) {
44804
44853
  return chain().command(() => {
44805
- tr.setNodeMarkup(parentList.pos, listType);
44854
+ tr.setNodeMarkup(currentList.pos, listType);
44806
44855
  return true;
44807
44856
  }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
44808
44857
  }
@@ -47883,7 +47932,10 @@ ${indentedChild}`;
47883
47932
  }
47884
47933
  markEnd = range.from + startSpaces + captureGroup.length;
47885
47934
  tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
47886
- tr.removeStoredMark(config.type);
47935
+ const isMatchAtEndOfText = match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length;
47936
+ if (!isMatchAtEndOfText) {
47937
+ tr.removeStoredMark(config.type);
47938
+ }
47887
47939
  }
47888
47940
  }
47889
47941
  });
@@ -61410,6 +61462,36 @@ ${indentedChild}`;
61410
61462
  // src/ordered-list/utils.ts
61411
61463
  var ORDERED_LIST_ITEM_REGEX = /^(\s*)(\d+)\.\s+(.*)$/;
61412
61464
  var INDENTED_LINE_REGEX = /^\s/;
61465
+ function isBlockContentLine(line) {
61466
+ const trimmedLine = line.trimStart();
61467
+ return /^[-+*]\s+/.test(trimmedLine) || /^\d+\.\s+/.test(trimmedLine) || /^>\s?/.test(trimmedLine) || /^```/.test(trimmedLine) || /^~~~/.test(trimmedLine);
61468
+ }
61469
+ function splitItemContent(contentLines) {
61470
+ const paragraphLines = [];
61471
+ const blockLines = [];
61472
+ let reachedBlockBoundary = false;
61473
+ contentLines.forEach((line) => {
61474
+ if (reachedBlockBoundary) {
61475
+ blockLines.push(line);
61476
+ return;
61477
+ }
61478
+ if (line.trim() === "") {
61479
+ reachedBlockBoundary = true;
61480
+ blockLines.push(line);
61481
+ return;
61482
+ }
61483
+ if (paragraphLines.length > 0 && isBlockContentLine(line)) {
61484
+ reachedBlockBoundary = true;
61485
+ blockLines.push(line);
61486
+ return;
61487
+ }
61488
+ paragraphLines.push(line);
61489
+ });
61490
+ return {
61491
+ paragraphLines,
61492
+ blockLines
61493
+ };
61494
+ }
61413
61495
  function collectOrderedListItems(lines) {
61414
61496
  const listItems = [];
61415
61497
  let currentLineIndex = 0;
@@ -61422,9 +61504,10 @@ ${indentedChild}`;
61422
61504
  }
61423
61505
  const [, indent, number, content] = match;
61424
61506
  const indentLevel = indent.length;
61425
- let itemContent = content;
61507
+ const itemContentLines = [content];
61426
61508
  let nextLineIndex = currentLineIndex + 1;
61427
61509
  const itemLines = [line];
61510
+ let sawBlankLine = false;
61428
61511
  while (nextLineIndex < lines.length) {
61429
61512
  const nextLine = lines[nextLineIndex];
61430
61513
  const nextMatch = nextLine.match(ORDERED_LIST_ITEM_REGEX);
@@ -61433,21 +61516,27 @@ ${indentedChild}`;
61433
61516
  }
61434
61517
  if (nextLine.trim() === "") {
61435
61518
  itemLines.push(nextLine);
61436
- itemContent += "\n";
61519
+ itemContentLines.push("");
61520
+ sawBlankLine = true;
61437
61521
  nextLineIndex += 1;
61438
61522
  } else if (nextLine.match(INDENTED_LINE_REGEX)) {
61439
61523
  itemLines.push(nextLine);
61440
- itemContent += `
61441
- ${nextLine.slice(indentLevel + 2)}`;
61524
+ itemContentLines.push(nextLine.slice(indentLevel + 2));
61442
61525
  nextLineIndex += 1;
61443
61526
  } else {
61444
- break;
61527
+ if (sawBlankLine) {
61528
+ break;
61529
+ }
61530
+ itemLines.push(nextLine);
61531
+ itemContentLines.push(nextLine);
61532
+ nextLineIndex += 1;
61445
61533
  }
61446
61534
  }
61447
61535
  listItems.push({
61448
61536
  indent: indentLevel,
61449
61537
  number: parseInt(number, 10),
61450
- content: itemContent.trim(),
61538
+ content: itemContentLines.join("\n").trim(),
61539
+ contentLines: itemContentLines,
61451
61540
  raw: itemLines.join("\n")
61452
61541
  });
61453
61542
  consumed = nextLineIndex;
@@ -61456,14 +61545,13 @@ ${nextLine.slice(indentLevel + 2)}`;
61456
61545
  return [listItems, consumed];
61457
61546
  }
61458
61547
  function buildNestedStructure(items, baseIndent, lexer) {
61459
- var _a;
61460
61548
  const result = [];
61461
61549
  let currentIndex = 0;
61462
61550
  while (currentIndex < items.length) {
61463
61551
  const item = items[currentIndex];
61464
61552
  if (item.indent === baseIndent) {
61465
- const contentLines = item.content.split("\n");
61466
- const mainText = ((_a = contentLines[0]) == null ? void 0 : _a.trim()) || "";
61553
+ const { paragraphLines, blockLines } = splitItemContent(item.contentLines);
61554
+ const mainText = paragraphLines.join("\n").trim();
61467
61555
  const tokens = [];
61468
61556
  if (mainText) {
61469
61557
  tokens.push({
@@ -61472,7 +61560,7 @@ ${nextLine.slice(indentLevel + 2)}`;
61472
61560
  tokens: lexer.inlineTokens(mainText)
61473
61561
  });
61474
61562
  }
61475
- const additionalContent = contentLines.slice(1).join("\n").trim();
61563
+ const additionalContent = blockLines.join("\n").trim();
61476
61564
  if (additionalContent) {
61477
61565
  const blockTokens = lexer.blockTokens(additionalContent);
61478
61566
  tokens.push(...blockTokens);
@@ -72944,6 +73032,7 @@ focus outline in that case.
72944
73032
  isRtl: false,
72945
73033
  useScrollendEvent: false,
72946
73034
  useAnimationFrameWithResizeObserver: false,
73035
+ laneAssignmentMode: "estimate",
72947
73036
  ...opts2
72948
73037
  };
72949
73038
  };
@@ -73083,9 +73172,10 @@ focus outline in that case.
73083
73172
  this.options.scrollMargin,
73084
73173
  this.options.getItemKey,
73085
73174
  this.options.enabled,
73086
- this.options.lanes
73175
+ this.options.lanes,
73176
+ this.options.laneAssignmentMode
73087
73177
  ],
73088
- (count, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
73178
+ (count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode) => {
73089
73179
  const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
73090
73180
  if (lanesChanged) {
73091
73181
  this.lanesChangedFlag = true;
@@ -73098,7 +73188,8 @@ focus outline in that case.
73098
73188
  scrollMargin,
73099
73189
  getItemKey,
73100
73190
  enabled,
73101
- lanes
73191
+ lanes,
73192
+ laneAssignmentMode
73102
73193
  };
73103
73194
  },
73104
73195
  {
@@ -73107,7 +73198,15 @@ focus outline in that case.
73107
73198
  );
73108
73199
  this.getMeasurements = memo(
73109
73200
  () => [this.getMeasurementOptions(), this.itemSizeCache],
73110
- ({ count, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
73201
+ ({
73202
+ count,
73203
+ paddingStart,
73204
+ scrollMargin,
73205
+ getItemKey,
73206
+ enabled,
73207
+ lanes,
73208
+ laneAssignmentMode
73209
+ }, itemSizeCache) => {
73111
73210
  if (!enabled) {
73112
73211
  this.measurementsCache = [];
73113
73212
  this.itemSizeCache.clear();
@@ -73155,6 +73254,7 @@ focus outline in that case.
73155
73254
  const cachedLane = this.laneAssignments.get(i);
73156
73255
  let lane;
73157
73256
  let start;
73257
+ const shouldCacheLane = laneAssignmentMode === "estimate" || itemSizeCache.has(key);
73158
73258
  if (cachedLane !== void 0 && this.options.lanes > 1) {
73159
73259
  lane = cachedLane;
73160
73260
  const prevIndex = laneLastIndex[lane];
@@ -73164,7 +73264,7 @@ focus outline in that case.
73164
73264
  const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
73165
73265
  start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
73166
73266
  lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
73167
- if (this.options.lanes > 1) {
73267
+ if (this.options.lanes > 1 && shouldCacheLane) {
73168
73268
  this.laneAssignments.set(i, lane);
73169
73269
  }
73170
73270
  }