@ni/ok-components 1.1.0 → 1.1.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.
@@ -14764,6 +14764,7 @@
14764
14764
  const tokenNames = {
14765
14765
  actionRgbPartialColor: 'action-rgb-partial-color',
14766
14766
  applicationBackgroundColor: 'application-background-color',
14767
+ containerBackgroundColor: 'container-background-color',
14767
14768
  dividerBackgroundColor: 'divider-background-color',
14768
14769
  dividerBackgroundDynamicColor: 'divider-background-dynamic-color',
14769
14770
  headerBackgroundColor: 'header-background-color',
@@ -16301,6 +16302,7 @@
16301
16302
  const tokenValues = {
16302
16303
  actionRgbPartialColor: hexToRgbPartialThemeColor(createThemeColor(Black91, Black15, White)),
16303
16304
  applicationBackgroundColor: createThemeColor(White, Black85, ForestGreen),
16305
+ containerBackgroundColor: hexToRgbaCssThemeColor(createThemeColor(Black91, Black15, White), 0.07, 0.1, 0.1),
16304
16306
  headerBackgroundColor: createThemeColor(Black7, Black88, ForestGreen),
16305
16307
  sectionBackgroundColor: createThemeColor(Black15, Black80, ForestGreen),
16306
16308
  sectionBackgroundImage: createThemeColor(`linear-gradient(${Black15}, ${hexToRgbaCssColor(Black15, 0)})`, `linear-gradient(${Black82}, ${hexToRgbaCssColor(Black82, 0)})`, `linear-gradient(${ForestGreen}, ${hexToRgbaCssColor(ForestGreen, 0)})`),
@@ -16474,6 +16476,7 @@
16474
16476
  // #region color tokens
16475
16477
  const actionRgbPartialColor = createThemeColorToken(tokenNames.actionRgbPartialColor, tokenValues.actionRgbPartialColor);
16476
16478
  const applicationBackgroundColor = createThemeColorToken(tokenNames.applicationBackgroundColor, tokenValues.applicationBackgroundColor);
16479
+ createThemeColorToken(tokenNames.containerBackgroundColor, tokenValues.containerBackgroundColor);
16477
16480
  createThemeColorToken(tokenNames.headerBackgroundColor, tokenValues.headerBackgroundColor);
16478
16481
  createThemeColorToken(tokenNames.sectionBackgroundColor, tokenValues.sectionBackgroundColor);
16479
16482
  const sectionBackgroundImage = createThemeColorToken(tokenNames.sectionBackgroundImage, tokenValues.sectionBackgroundImage);
@@ -39622,8 +39625,8 @@ so this becomes the fallback color for the slot */ ''}
39622
39625
  this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
39623
39626
  let { selection } = view.state;
39624
39627
  if (event.button == 0 &&
39625
- targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
39626
- selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
39628
+ (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
39629
+ selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos))
39627
39630
  this.mightDrag = {
39628
39631
  node: targetNode,
39629
39632
  pos: targetPos,
@@ -39972,8 +39975,9 @@ so this becomes the fallback color for the slot */ ''}
39972
39975
  }
39973
39976
  const dragCopyModifier = mac$2 ? "altKey" : "ctrlKey";
39974
39977
  function dragMoves(view, event) {
39975
- let moves = view.someProp("dragCopies", test => !test(event));
39976
- return moves != null ? moves : !event[dragCopyModifier];
39978
+ let copy;
39979
+ view.someProp("dragCopies", test => { copy = copy || test(event); });
39980
+ return copy != null ? !copy : !event[dragCopyModifier];
39977
39981
  }
39978
39982
  handlers.dragstart = (view, _event) => {
39979
39983
  let event = _event;
@@ -40000,7 +40004,7 @@ so this becomes the fallback color for the slot */ ''}
40000
40004
  if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)
40001
40005
  event.dataTransfer.clearData();
40002
40006
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
40003
- // See https://github.com/ProseMirror/prosemirror/issues/1156
40007
+ // See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1156
40004
40008
  event.dataTransfer.effectAllowed = "copyMove";
40005
40009
  if (!brokenClipboardAPI)
40006
40010
  event.dataTransfer.setData("text/plain", text);
@@ -41625,7 +41629,7 @@ so this becomes the fallback color for the slot */ ''}
41625
41629
  this.pluginViews = [];
41626
41630
  /**
41627
41631
  Holds `true` when a hack node is needed in Firefox to prevent the
41628
- [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
41632
+ [space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)
41629
41633
  @internal
41630
41634
  */
41631
41635
  this.requiresGeckoHackNode = false;
@@ -43166,7 +43170,7 @@ so this becomes the fallback color for the slot */ ''}
43166
43170
  const fromSelectionAtStart = $from.parentOffset === 0;
43167
43171
  const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
43168
43172
  const hasContent = $fromNode.content.size > 0;
43169
- if (fromSelectionAtStart && isTextSelection2 && hasContent) {
43173
+ if (fromSelectionAtStart && isTextSelection2 && hasContent && isOnlyBlockContent) {
43170
43174
  from = Math.max(0, from - 1);
43171
43175
  }
43172
43176
  tr.replaceWith(from, to, newContent);
@@ -44783,6 +44787,16 @@ so this becomes the fallback color for the slot */ ''}
44783
44787
  tr.join(after);
44784
44788
  return true;
44785
44789
  };
44790
+ function createInnerSelectionForWholeDocList(tr) {
44791
+ const doc = tr.doc;
44792
+ const list = doc.firstChild;
44793
+ if (!list) {
44794
+ return null;
44795
+ }
44796
+ const $start = doc.resolve(1);
44797
+ const $end = doc.resolve(list.nodeSize - 1);
44798
+ return TextSelection.between($start, $end);
44799
+ }
44786
44800
  var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {
44787
44801
  const { extensions, splittableMarks } = editor.extensionManager;
44788
44802
  const listType = getNodeType(listTypeOrName, state.schema);
@@ -44795,13 +44809,35 @@ so this becomes the fallback color for the slot */ ''}
44795
44809
  return false;
44796
44810
  }
44797
44811
  const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
44798
- if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
44799
- if (parentList.node.type === listType) {
44812
+ const isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;
44813
+ const topLevelNodes = state.doc.content.content;
44814
+ const soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;
44815
+ const allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {
44816
+ node: soleTopLevelNode,
44817
+ pos: 0} : null;
44818
+ const currentList = parentList != null ? parentList : allSelectionList;
44819
+ const isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;
44820
+ const hasWholeDocSelectedList = !!allSelectionList;
44821
+ if ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {
44822
+ if (currentList.node.type === listType) {
44823
+ if (isAllSelection && hasWholeDocSelectedList) {
44824
+ return chain().command(({ tr: trx, dispatch: disp }) => {
44825
+ const nextSelection = createInnerSelectionForWholeDocList(trx);
44826
+ if (!nextSelection) {
44827
+ return false;
44828
+ }
44829
+ trx.setSelection(nextSelection);
44830
+ if (disp) {
44831
+ disp(trx);
44832
+ }
44833
+ return true;
44834
+ }).liftListItem(itemType).run();
44835
+ }
44800
44836
  return commands.liftListItem(itemType);
44801
44837
  }
44802
- if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
44838
+ if (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) {
44803
44839
  return chain().command(() => {
44804
- tr.setNodeMarkup(parentList.pos, listType);
44840
+ tr.setNodeMarkup(currentList.pos, listType);
44805
44841
  return true;
44806
44842
  }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
44807
44843
  }
@@ -47882,7 +47918,10 @@ ${indentedChild}`;
47882
47918
  }
47883
47919
  markEnd = range.from + startSpaces + captureGroup.length;
47884
47920
  tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
47885
- tr.removeStoredMark(config.type);
47921
+ const isMatchAtEndOfText = match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length;
47922
+ if (!isMatchAtEndOfText) {
47923
+ tr.removeStoredMark(config.type);
47924
+ }
47886
47925
  }
47887
47926
  }
47888
47927
  });
@@ -61409,6 +61448,36 @@ ${indentedChild}`;
61409
61448
  // src/ordered-list/utils.ts
61410
61449
  var ORDERED_LIST_ITEM_REGEX = /^(\s*)(\d+)\.\s+(.*)$/;
61411
61450
  var INDENTED_LINE_REGEX = /^\s/;
61451
+ function isBlockContentLine(line) {
61452
+ const trimmedLine = line.trimStart();
61453
+ return /^[-+*]\s+/.test(trimmedLine) || /^\d+\.\s+/.test(trimmedLine) || /^>\s?/.test(trimmedLine) || /^```/.test(trimmedLine) || /^~~~/.test(trimmedLine);
61454
+ }
61455
+ function splitItemContent(contentLines) {
61456
+ const paragraphLines = [];
61457
+ const blockLines = [];
61458
+ let reachedBlockBoundary = false;
61459
+ contentLines.forEach((line) => {
61460
+ if (reachedBlockBoundary) {
61461
+ blockLines.push(line);
61462
+ return;
61463
+ }
61464
+ if (line.trim() === "") {
61465
+ reachedBlockBoundary = true;
61466
+ blockLines.push(line);
61467
+ return;
61468
+ }
61469
+ if (paragraphLines.length > 0 && isBlockContentLine(line)) {
61470
+ reachedBlockBoundary = true;
61471
+ blockLines.push(line);
61472
+ return;
61473
+ }
61474
+ paragraphLines.push(line);
61475
+ });
61476
+ return {
61477
+ paragraphLines,
61478
+ blockLines
61479
+ };
61480
+ }
61412
61481
  function collectOrderedListItems(lines) {
61413
61482
  const listItems = [];
61414
61483
  let currentLineIndex = 0;
@@ -61421,9 +61490,10 @@ ${indentedChild}`;
61421
61490
  }
61422
61491
  const [, indent, number, content] = match;
61423
61492
  const indentLevel = indent.length;
61424
- let itemContent = content;
61493
+ const itemContentLines = [content];
61425
61494
  let nextLineIndex = currentLineIndex + 1;
61426
61495
  const itemLines = [line];
61496
+ let sawBlankLine = false;
61427
61497
  while (nextLineIndex < lines.length) {
61428
61498
  const nextLine = lines[nextLineIndex];
61429
61499
  const nextMatch = nextLine.match(ORDERED_LIST_ITEM_REGEX);
@@ -61432,21 +61502,27 @@ ${indentedChild}`;
61432
61502
  }
61433
61503
  if (nextLine.trim() === "") {
61434
61504
  itemLines.push(nextLine);
61435
- itemContent += "\n";
61505
+ itemContentLines.push("");
61506
+ sawBlankLine = true;
61436
61507
  nextLineIndex += 1;
61437
61508
  } else if (nextLine.match(INDENTED_LINE_REGEX)) {
61438
61509
  itemLines.push(nextLine);
61439
- itemContent += `
61440
- ${nextLine.slice(indentLevel + 2)}`;
61510
+ itemContentLines.push(nextLine.slice(indentLevel + 2));
61441
61511
  nextLineIndex += 1;
61442
61512
  } else {
61443
- break;
61513
+ if (sawBlankLine) {
61514
+ break;
61515
+ }
61516
+ itemLines.push(nextLine);
61517
+ itemContentLines.push(nextLine);
61518
+ nextLineIndex += 1;
61444
61519
  }
61445
61520
  }
61446
61521
  listItems.push({
61447
61522
  indent: indentLevel,
61448
61523
  number: parseInt(number, 10),
61449
- content: itemContent.trim(),
61524
+ content: itemContentLines.join("\n").trim(),
61525
+ contentLines: itemContentLines,
61450
61526
  raw: itemLines.join("\n")
61451
61527
  });
61452
61528
  consumed = nextLineIndex;
@@ -61455,14 +61531,13 @@ ${nextLine.slice(indentLevel + 2)}`;
61455
61531
  return [listItems, consumed];
61456
61532
  }
61457
61533
  function buildNestedStructure(items, baseIndent, lexer) {
61458
- var _a;
61459
61534
  const result = [];
61460
61535
  let currentIndex = 0;
61461
61536
  while (currentIndex < items.length) {
61462
61537
  const item = items[currentIndex];
61463
61538
  if (item.indent === baseIndent) {
61464
- const contentLines = item.content.split("\n");
61465
- const mainText = ((_a = contentLines[0]) == null ? void 0 : _a.trim()) || "";
61539
+ const { paragraphLines, blockLines } = splitItemContent(item.contentLines);
61540
+ const mainText = paragraphLines.join("\n").trim();
61466
61541
  const tokens = [];
61467
61542
  if (mainText) {
61468
61543
  tokens.push({
@@ -61471,7 +61546,7 @@ ${nextLine.slice(indentLevel + 2)}`;
61471
61546
  tokens: lexer.inlineTokens(mainText)
61472
61547
  });
61473
61548
  }
61474
- const additionalContent = contentLines.slice(1).join("\n").trim();
61549
+ const additionalContent = blockLines.join("\n").trim();
61475
61550
  if (additionalContent) {
61476
61551
  const blockTokens = lexer.blockTokens(additionalContent);
61477
61552
  tokens.push(...blockTokens);
@@ -72943,6 +73018,7 @@ focus outline in that case.
72943
73018
  isRtl: false,
72944
73019
  useScrollendEvent: false,
72945
73020
  useAnimationFrameWithResizeObserver: false,
73021
+ laneAssignmentMode: "estimate",
72946
73022
  ...opts2
72947
73023
  };
72948
73024
  };
@@ -73082,9 +73158,10 @@ focus outline in that case.
73082
73158
  this.options.scrollMargin,
73083
73159
  this.options.getItemKey,
73084
73160
  this.options.enabled,
73085
- this.options.lanes
73161
+ this.options.lanes,
73162
+ this.options.laneAssignmentMode
73086
73163
  ],
73087
- (count, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
73164
+ (count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode) => {
73088
73165
  const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
73089
73166
  if (lanesChanged) {
73090
73167
  this.lanesChangedFlag = true;
@@ -73097,7 +73174,8 @@ focus outline in that case.
73097
73174
  scrollMargin,
73098
73175
  getItemKey,
73099
73176
  enabled,
73100
- lanes
73177
+ lanes,
73178
+ laneAssignmentMode
73101
73179
  };
73102
73180
  },
73103
73181
  {
@@ -73106,7 +73184,15 @@ focus outline in that case.
73106
73184
  );
73107
73185
  this.getMeasurements = memo(
73108
73186
  () => [this.getMeasurementOptions(), this.itemSizeCache],
73109
- ({ count, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
73187
+ ({
73188
+ count,
73189
+ paddingStart,
73190
+ scrollMargin,
73191
+ getItemKey,
73192
+ enabled,
73193
+ lanes,
73194
+ laneAssignmentMode
73195
+ }, itemSizeCache) => {
73110
73196
  if (!enabled) {
73111
73197
  this.measurementsCache = [];
73112
73198
  this.itemSizeCache.clear();
@@ -73154,6 +73240,7 @@ focus outline in that case.
73154
73240
  const cachedLane = this.laneAssignments.get(i);
73155
73241
  let lane;
73156
73242
  let start;
73243
+ const shouldCacheLane = laneAssignmentMode === "estimate" || itemSizeCache.has(key);
73157
73244
  if (cachedLane !== void 0 && this.options.lanes > 1) {
73158
73245
  lane = cachedLane;
73159
73246
  const prevIndex = laneLastIndex[lane];
@@ -73163,7 +73250,7 @@ focus outline in that case.
73163
73250
  const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
73164
73251
  start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
73165
73252
  lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
73166
- if (this.options.lanes > 1) {
73253
+ if (this.options.lanes > 1 && shouldCacheLane) {
73167
73254
  this.laneAssignments.set(i, lane);
73168
73255
  }
73169
73256
  }