@ni/nimble-components 35.5.2 → 35.5.4

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.
@@ -17712,13 +17712,14 @@
17712
17712
  background-color: transparent;
17713
17713
  cursor: pointer;
17714
17714
  outline: none;
17715
- --ni-private-step-icon-background-full-size: 100% 100%;
17716
- ${'' /* 6px = (2px icon border + 1px inset) * 2 sides */}
17717
- --ni-private-step-icon-background-inset-size: calc(100% - 6px) calc(100% - 6px);
17718
- --ni-private-step-icon-background-none-size: 0% 0%;
17715
+ --ni-private-step-icon-background-full-size: scale(1,1);
17716
+ ${'' /* (32px - 2 * (2px focus border + 1px inset gap)) / 32px = .8125 */}
17717
+ --ni-private-step-icon-background-inset-size: scale(0.8125, 0.8125);
17718
+ --ni-private-step-icon-background-none-size: scale(0,0);
17719
17719
 
17720
17720
  --ni-private-step-icon-color: ${buttonLabelFontColor};
17721
17721
  --ni-private-step-icon-border-color: transparent;
17722
+ --ni-private-step-icon-border-width: 1px;
17722
17723
  --ni-private-step-icon-background-color: rgba(${borderRgbPartialColor}, 0.1);
17723
17724
  --ni-private-step-icon-background-size: var(--ni-private-step-icon-background-full-size);
17724
17725
  --ni-private-step-icon-outline-inset-color: transparent;
@@ -17821,6 +17822,20 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17821
17822
  --ni-private-step-line-color: ${borderHoverColor};
17822
17823
  }
17823
17824
 
17825
+ .icon-background {
17826
+ grid-area: icon;
17827
+ display: inline-block;
17828
+ height: ${controlHeight};
17829
+ width: ${controlHeight};
17830
+ ${userSelectNone};
17831
+ background-color: var(--ni-private-step-icon-background-color);
17832
+ transform: var(--ni-private-step-icon-background-size);
17833
+ border: none;
17834
+ border-radius: 100%;
17835
+ transition:
17836
+ transform ${smallDelay} ease-in-out;
17837
+ }
17838
+
17824
17839
  .icon {
17825
17840
  grid-area: icon;
17826
17841
  display: inline-flex;
@@ -17833,31 +17848,16 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17833
17848
  font: ${buttonLabelFont};
17834
17849
  color: var(--ni-private-step-icon-color);
17835
17850
  ${iconColor.cssCustomProperty}: var(--ni-private-step-icon-color);
17836
- border-style: solid;
17851
+ border: none;
17837
17852
  border-radius: 100%;
17838
- border-color: var(--ni-private-step-icon-border-color);
17839
- border-width: 1px;
17840
- background-image: radial-gradient(
17841
- closest-side,
17842
- ${'' /* Workaround to prevent aliasing on radial-gradient boundaries, see:
17843
- https://frontendmasters.com/blog/obsessing-over-smooth-radial-gradient-disc-edges
17844
- */}
17845
- var(--ni-private-step-icon-background-color) calc(100% - 1px/var(--ni-private-device-pixel-ratio, 1)),
17846
- transparent 100%
17847
- );
17848
- background-origin: border-box;
17849
- background-size: var(--ni-private-step-icon-background-size);
17850
- background-repeat: no-repeat;
17851
- background-position: center center;
17853
+ box-shadow: inset 0px 0px 0px var(--ni-private-step-icon-border-width) var(--ni-private-step-icon-border-color);
17852
17854
  position: relative;
17853
17855
  transition:
17854
- border-color ${smallDelay} ease-in-out,
17855
- border-width ${smallDelay} ease-in-out,
17856
- background-size ${smallDelay} ease-out;
17856
+ box-shadow ${smallDelay} ease-in-out;
17857
17857
  }
17858
17858
 
17859
17859
  :host([selected]) .icon {
17860
- border-width: 2px;
17860
+ --ni-private-step-icon-border-width: 2px;
17861
17861
  }
17862
17862
 
17863
17863
  .icon::before {
@@ -17870,10 +17870,9 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17870
17870
  outline-style: solid;
17871
17871
  outline-width: 0px;
17872
17872
  outline-offset: 0px;
17873
- border: 1px solid transparent;
17873
+ border: none;
17874
17874
  border-radius: 100%;
17875
17875
  color: transparent;
17876
- background-clip: border-box;
17877
17876
  transition:
17878
17877
  outline-color ${smallDelay} ease-in-out,
17879
17878
  outline-width ${smallDelay} ease-in-out,
@@ -18025,7 +18024,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18025
18024
  }
18026
18025
 
18027
18026
  .control:hover .icon {
18028
- border-width: 2px;
18027
+ --ni-private-step-icon-border-width: 2px;
18029
18028
  }
18030
18029
 
18031
18030
  .control:hover .line {
@@ -18076,12 +18075,13 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18076
18075
  }
18077
18076
 
18078
18077
  .control${focusVisible} .icon {
18079
- border-width: 2px;
18078
+ --ni-private-step-icon-border-width: 2px;
18080
18079
  }
18081
18080
 
18082
18081
  .control${focusVisible} .icon::before {
18083
18082
  outline-width: ${borderWidth};
18084
- outline-offset: -2px;
18083
+ ${'' /* -1px control to outline edge -2px focus border -1px inset gap */}
18084
+ outline-offset: -4px;
18085
18085
  }
18086
18086
 
18087
18087
  .control${focusVisible} .line {
@@ -18128,7 +18128,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18128
18128
  }
18129
18129
 
18130
18130
  .control:active .icon {
18131
- border-width: 2px;
18131
+ --ni-private-step-icon-border-width: 2px;
18132
18132
  }
18133
18133
 
18134
18134
  .control:active .icon::before {
@@ -19462,6 +19462,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19462
19462
  aria-roledescription="${x => x.ariaRoledescription}"
19463
19463
  ${ref('control')}
19464
19464
  >
19465
+ <div class="icon-background"></div>
19465
19466
  <div class="icon">
19466
19467
  <span class="current-label">${x => (x.selected ? popupIconCurrentLabel.getValueFor(x) : '')}</span>
19467
19468
  <div class="step-indicator"><slot name="step-indicator"><span aria-hidden="true">${x => x.stepInternals.position}</span></slot></div>
@@ -32800,7 +32801,8 @@ so this becomes the fallback color for the slot */ ''}
32800
32801
  return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
32801
32802
  }
32802
32803
  map(mapping) {
32803
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
32804
+ let to = mapping.mapResult(this.to, -1);
32805
+ let from = this.from == this.to && ReplaceStep.MAP_BIAS < 0 ? to : mapping.mapResult(this.from, 1);
32804
32806
  if (from.deletedAcross && to.deletedAcross)
32805
32807
  return null;
32806
32808
  return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
@@ -32839,6 +32841,15 @@ so this becomes the fallback color for the slot */ ''}
32839
32841
  return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);
32840
32842
  }
32841
32843
  }
32844
+ /**
32845
+ By default, for backwards compatibility, an inserting step
32846
+ mapped over an insertion at that same position fill move after
32847
+ the inserted content. In a collaborative editing situation, that
32848
+ can make redone insertions appear in unexpected places. You can
32849
+ set this to -1 to make such mapping keep the step before the
32850
+ insertion instead.
32851
+ */
32852
+ ReplaceStep.MAP_BIAS = 1;
32842
32853
  Step$1.jsonID("replace", ReplaceStep);
32843
32854
  /**
32844
32855
  Replace a part of the document with a slice of content, but
@@ -33825,6 +33836,26 @@ so this becomes the fallback color for the slot */ ''}
33825
33836
  }
33826
33837
  function deleteRange$1(tr, from, to) {
33827
33838
  let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
33839
+ // When the deleted range spans from the start of one textblock to
33840
+ // the start of another one, move out of the start of both blocks.
33841
+ if ($from.parent.isTextblock && $to.parent.isTextblock && $from.start() != $to.start() &&
33842
+ $from.parentOffset == 0 && $to.parentOffset == 0) {
33843
+ let shared = $from.sharedDepth(to), isolated = false;
33844
+ for (let d = $from.depth; d > shared; d--)
33845
+ if ($from.node(d).type.spec.isolating)
33846
+ isolated = true;
33847
+ for (let d = $to.depth; d > shared; d--)
33848
+ if ($to.node(d).type.spec.isolating)
33849
+ isolated = true;
33850
+ if (!isolated) {
33851
+ for (let d = $from.depth; d > 0 && from == $from.start(d); d--)
33852
+ from = $from.before(d);
33853
+ for (let d = $to.depth; d > 0 && to == $to.start(d); d--)
33854
+ to = $to.before(d);
33855
+ $from = tr.doc.resolve(from);
33856
+ $to = tr.doc.resolve(to);
33857
+ }
33858
+ }
33828
33859
  let covered = coveredDepths($from, $to);
33829
33860
  for (let i = 0; i < covered.length; i++) {
33830
33861
  let depth = covered[i], last = i == covered.length - 1;
@@ -40791,8 +40822,13 @@ so this becomes the fallback color for the slot */ ''}
40791
40822
  for (let node of added)
40792
40823
  if (node.nodeName == "BR" && node.parentNode) {
40793
40824
  let after = node.nextSibling;
40794
- if (after && after.nodeType == 1 && after.contentEditable == "false")
40795
- node.parentNode.removeChild(node);
40825
+ while (after && after.nodeType == 1) {
40826
+ if (after.contentEditable == "false") {
40827
+ node.parentNode.removeChild(node);
40828
+ break;
40829
+ }
40830
+ after = after.firstChild;
40831
+ }
40796
40832
  }
40797
40833
  }
40798
40834
  else if (gecko && added.length) {
@@ -41630,12 +41666,12 @@ so this becomes the fallback color for the slot */ ''}
41630
41666
  }
41631
41667
  updateDraggedNode(dragging, prev) {
41632
41668
  let sel = dragging.node, found = -1;
41633
- if (this.state.doc.nodeAt(sel.from) == sel.node) {
41669
+ if (sel.from < this.state.doc.content.size && this.state.doc.nodeAt(sel.from) == sel.node) {
41634
41670
  found = sel.from;
41635
41671
  }
41636
41672
  else {
41637
41673
  let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);
41638
- let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos);
41674
+ let moved = movedPos > 0 && movedPos < this.state.doc.content.size && this.state.doc.nodeAt(movedPos);
41639
41675
  if (moved == sel.node)
41640
41676
  found = movedPos;
41641
41677
  }
@@ -42568,7 +42604,6 @@ so this becomes the fallback color for the slot */ ''}
42568
42604
  return !!findMarkInSet(marks, type, attributes);
42569
42605
  }
42570
42606
  function getMarkRange($pos, type, attributes) {
42571
- var _a;
42572
42607
  if (!$pos || !type) {
42573
42608
  return;
42574
42609
  }
@@ -42579,7 +42614,12 @@ so this becomes the fallback color for the slot */ ''}
42579
42614
  if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
42580
42615
  return;
42581
42616
  }
42582
- attributes = attributes || ((_a = start.node.marks[0]) == null ? void 0 : _a.attrs);
42617
+ if (!attributes) {
42618
+ const firstMark = start.node.marks.find((mark2) => mark2.type === type);
42619
+ if (firstMark) {
42620
+ attributes = firstMark.attrs;
42621
+ }
42622
+ }
42583
42623
  const mark = findMarkInSet([...start.node.marks], type, attributes);
42584
42624
  if (!mark) {
42585
42625
  return;
@@ -42614,7 +42654,7 @@ so this becomes the fallback color for the slot */ ''}
42614
42654
  }
42615
42655
 
42616
42656
  // src/commands/extendMarkRange.ts
42617
- var extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
42657
+ var extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
42618
42658
  const type = getMarkType(typeOrName, state.schema);
42619
42659
  const { doc, selection } = tr;
42620
42660
  const { $from, from, to } = selection;
@@ -43507,6 +43547,67 @@ so this becomes the fallback color for the slot */ ''}
43507
43547
  }
43508
43548
 
43509
43549
  // src/utilities/mergeAttributes.ts
43550
+ function splitStyleDeclarations(styles) {
43551
+ const result = [];
43552
+ let current = "";
43553
+ let inSingleQuote = false;
43554
+ let inDoubleQuote = false;
43555
+ let parenDepth = 0;
43556
+ const length = styles.length;
43557
+ for (let i = 0; i < length; i += 1) {
43558
+ const char = styles[i];
43559
+ if (char === "'" && !inDoubleQuote) {
43560
+ inSingleQuote = !inSingleQuote;
43561
+ current += char;
43562
+ continue;
43563
+ }
43564
+ if (char === '"' && !inSingleQuote) {
43565
+ inDoubleQuote = !inDoubleQuote;
43566
+ current += char;
43567
+ continue;
43568
+ }
43569
+ if (!inSingleQuote && !inDoubleQuote) {
43570
+ if (char === "(") {
43571
+ parenDepth += 1;
43572
+ current += char;
43573
+ continue;
43574
+ }
43575
+ if (char === ")" && parenDepth > 0) {
43576
+ parenDepth -= 1;
43577
+ current += char;
43578
+ continue;
43579
+ }
43580
+ if (char === ";" && parenDepth === 0) {
43581
+ result.push(current);
43582
+ current = "";
43583
+ continue;
43584
+ }
43585
+ }
43586
+ current += char;
43587
+ }
43588
+ if (current) {
43589
+ result.push(current);
43590
+ }
43591
+ return result;
43592
+ }
43593
+ function parseStyleEntries(styles) {
43594
+ const pairs = [];
43595
+ const declarations = splitStyleDeclarations(styles || "");
43596
+ const numDeclarations = declarations.length;
43597
+ for (let i = 0; i < numDeclarations; i += 1) {
43598
+ const declaration = declarations[i];
43599
+ const firstColonIndex = declaration.indexOf(":");
43600
+ if (firstColonIndex === -1) {
43601
+ continue;
43602
+ }
43603
+ const property = declaration.slice(0, firstColonIndex).trim();
43604
+ const value = declaration.slice(firstColonIndex + 1).trim();
43605
+ if (property && value) {
43606
+ pairs.push([property, value]);
43607
+ }
43608
+ }
43609
+ return pairs;
43610
+ }
43510
43611
  function mergeAttributes(...objects) {
43511
43612
  return objects.filter((item) => !!item).reduce((items, item) => {
43512
43613
  const mergedAttributes = { ...items };
@@ -43522,17 +43623,7 @@ so this becomes the fallback color for the slot */ ''}
43522
43623
  const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
43523
43624
  mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
43524
43625
  } else if (key === "style") {
43525
- const newStyles = value ? value.split(";").map((style2) => style2.trim()).filter(Boolean) : [];
43526
- const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style2) => style2.trim()).filter(Boolean) : [];
43527
- const styleMap = /* @__PURE__ */ new Map();
43528
- existingStyles.forEach((style2) => {
43529
- const [property, val] = style2.split(":").map((part) => part.trim());
43530
- styleMap.set(property, val);
43531
- });
43532
- newStyles.forEach((style2) => {
43533
- const [property, val] = style2.split(":").map((part) => part.trim());
43534
- styleMap.set(property, val);
43535
- });
43626
+ const styleMap = new Map([...parseStyleEntries(mergedAttributes[key]), ...parseStyleEntries(value)]);
43536
43627
  mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
43537
43628
  } else {
43538
43629
  mergedAttributes[key] = value;
@@ -44119,7 +44210,7 @@ so this becomes the fallback color for the slot */ ''}
44119
44210
  return true;
44120
44211
  }
44121
44212
  if (node.isText) {
44122
- return /^\s*$/m.test((_a = node.text) != null ? _a : "");
44213
+ return !/\S/.test((_a = node.text) != null ? _a : "");
44123
44214
  }
44124
44215
  }
44125
44216
  if (node.isText) {
@@ -45818,7 +45909,7 @@ so this becomes the fallback color for the slot */ ''}
45818
45909
  const newEnd = mapping.slice(index).map(step.to);
45819
45910
  const oldStart = mapping.invert().map(newStart, -1);
45820
45911
  const oldEnd = mapping.invert().map(newEnd);
45821
- const foundBeforeMark = (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark));
45912
+ const foundBeforeMark = newStart > 0 ? (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark)) : false;
45822
45913
  const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));
45823
45914
  this.editor.emit("delete", {
45824
45915
  type: "mark",
@@ -47504,17 +47595,21 @@ ${renderedContent}
47504
47595
  const prefix = typeof prefixOrGenerator === "function" ? prefixOrGenerator(ctx) : prefixOrGenerator;
47505
47596
  const [content, ...children] = node.content;
47506
47597
  const mainContent = h2.renderChildren([content]);
47507
- const output = [`${prefix}${mainContent}`];
47598
+ let output = `${prefix}${mainContent}`;
47508
47599
  if (children && children.length > 0) {
47509
- children.forEach((child) => {
47510
- const childContent = h2.renderChildren([child]);
47511
- if (childContent) {
47512
- const indentedChild = childContent.split("\n").map((line) => line ? h2.indent(line) : "").join("\n");
47513
- output.push(indentedChild);
47600
+ children.forEach((child, index) => {
47601
+ var _a, _b;
47602
+ const childContent = (_b = (_a = h2.renderChild) == null ? void 0 : _a.call(h2, child, index + 1)) != null ? _b : h2.renderChildren([child]);
47603
+ if (childContent !== void 0 && childContent !== null) {
47604
+ const indentedChild = childContent.split("\n").map((line) => line ? h2.indent(line) : h2.indent("")).join("\n");
47605
+ output += child.type === "paragraph" ? `
47606
+
47607
+ ${indentedChild}` : `
47608
+ ${indentedChild}`;
47514
47609
  }
47515
47610
  });
47516
47611
  }
47517
- return output.join("\n");
47612
+ return output;
47518
47613
  }
47519
47614
 
47520
47615
  // src/MarkView.ts
@@ -58371,6 +58466,12 @@ ${renderedContent}
58371
58466
  parseMarkdown: (token, helpers) => {
58372
58467
  return helpers.applyMark("bold", helpers.parseInline(token.tokens || []));
58373
58468
  },
58469
+ markdownOptions: {
58470
+ htmlReopen: {
58471
+ open: "<strong>",
58472
+ close: "</strong>"
58473
+ }
58474
+ },
58374
58475
  renderMarkdown: (node, h) => {
58375
58476
  return `**${h.renderChildren(node)}**`;
58376
58477
  },
@@ -58488,6 +58589,12 @@ ${renderedContent}
58488
58589
  parseMarkdown: (token, helpers) => {
58489
58590
  return helpers.applyMark("italic", helpers.parseInline(token.tokens || []));
58490
58591
  },
58592
+ markdownOptions: {
58593
+ htmlReopen: {
58594
+ open: "<em>",
58595
+ close: "</em>"
58596
+ }
58597
+ },
58491
58598
  renderMarkdown: (node, h) => {
58492
58599
  return `*${h.renderChildren(node)}*`;
58493
58600
  },
@@ -60794,14 +60901,16 @@ ${renderedContent}
60794
60901
  },
60795
60902
  markdownTokenName: "list_item",
60796
60903
  parseMarkdown: (token, helpers) => {
60904
+ var _a;
60797
60905
  if (token.type !== "list_item") {
60798
60906
  return [];
60799
60907
  }
60908
+ const parseBlockChildren = (_a = helpers.parseBlockChildren) != null ? _a : helpers.parseChildren;
60800
60909
  let content = [];
60801
60910
  if (token.tokens && token.tokens.length > 0) {
60802
60911
  const hasParagraphTokens = token.tokens.some((t) => t.type === "paragraph");
60803
60912
  if (hasParagraphTokens) {
60804
- content = helpers.parseChildren(token.tokens);
60913
+ content = parseBlockChildren(token.tokens);
60805
60914
  } else {
60806
60915
  const firstToken = token.tokens[0];
60807
60916
  if (firstToken && firstToken.type === "text" && firstToken.tokens && firstToken.tokens.length > 0) {
@@ -60814,11 +60923,11 @@ ${renderedContent}
60814
60923
  ];
60815
60924
  if (token.tokens.length > 1) {
60816
60925
  const remainingTokens = token.tokens.slice(1);
60817
- const additionalContent = helpers.parseChildren(remainingTokens);
60926
+ const additionalContent = parseBlockChildren(remainingTokens);
60818
60927
  content.push(...additionalContent);
60819
60928
  }
60820
60929
  } else {
60821
- content = helpers.parseChildren(token.tokens);
60930
+ content = parseBlockChildren(token.tokens);
60822
60931
  }
60823
60932
  }
60824
60933
  }
@@ -61781,6 +61890,19 @@ ${nextLine.slice(indentLevel + 2)}`;
61781
61890
  }
61782
61891
 
61783
61892
  // src/suggestion.ts
61893
+ function hasInsertedWhitespace(transaction) {
61894
+ if (!transaction.docChanged) {
61895
+ return false;
61896
+ }
61897
+ return transaction.steps.some((step) => {
61898
+ const slice = step.slice;
61899
+ if (!(slice == null ? void 0 : slice.content)) {
61900
+ return false;
61901
+ }
61902
+ const inserted = slice.content.textBetween(0, slice.content.size, "\n");
61903
+ return /\s/.test(inserted);
61904
+ });
61905
+ }
61784
61906
  var SuggestionPluginKey = new PluginKey("suggestion");
61785
61907
  function Suggestion({
61786
61908
  pluginKey = SuggestionPluginKey,
@@ -61799,10 +61921,12 @@ ${nextLine.slice(indentLevel + 2)}`;
61799
61921
  render = () => ({}),
61800
61922
  allow = () => true,
61801
61923
  findSuggestionMatch: findSuggestionMatch2 = findSuggestionMatch,
61802
- shouldShow
61924
+ shouldShow,
61925
+ shouldResetDismissed
61803
61926
  }) {
61804
61927
  let props;
61805
61928
  const renderer = render == null ? void 0 : render();
61929
+ const effectiveAllowSpaces = allowSpaces && !allowToIncludeChar;
61806
61930
  const getAnchorClientRect = () => {
61807
61931
  const pos = editor.state.selection.$anchor.pos;
61808
61932
  const coords = editor.view.coordsAtPos(pos);
@@ -61824,6 +61948,27 @@ ${nextLine.slice(indentLevel + 2)}`;
61824
61948
  return (currentDecorationNode == null ? void 0 : currentDecorationNode.getBoundingClientRect()) || null;
61825
61949
  };
61826
61950
  };
61951
+ const shouldKeepDismissed = ({
61952
+ match,
61953
+ dismissedRange,
61954
+ state,
61955
+ transaction
61956
+ }) => {
61957
+ if (shouldResetDismissed == null ? void 0 : shouldResetDismissed({
61958
+ editor,
61959
+ state,
61960
+ range: dismissedRange,
61961
+ match,
61962
+ transaction,
61963
+ allowSpaces: effectiveAllowSpaces
61964
+ })) {
61965
+ return false;
61966
+ }
61967
+ if (effectiveAllowSpaces) {
61968
+ return match.range.from === dismissedRange.from;
61969
+ }
61970
+ return match.range.from === dismissedRange.from && !hasInsertedWhitespace(transaction);
61971
+ };
61827
61972
  function dispatchExit(view, pluginKeyRef) {
61828
61973
  var _a;
61829
61974
  try {
@@ -61926,7 +62071,8 @@ ${nextLine.slice(indentLevel + 2)}`;
61926
62071
  },
61927
62072
  query: null,
61928
62073
  text: null,
61929
- composing: false
62074
+ composing: false,
62075
+ dismissedRange: null
61930
62076
  };
61931
62077
  return state;
61932
62078
  },
@@ -61944,9 +62090,16 @@ ${nextLine.slice(indentLevel + 2)}`;
61944
62090
  next.range = { from: 0, to: 0 };
61945
62091
  next.query = null;
61946
62092
  next.text = null;
62093
+ next.dismissedRange = prev.active ? { ...prev.range } : prev.dismissedRange;
61947
62094
  return next;
61948
62095
  }
61949
62096
  next.composing = composing;
62097
+ if (transaction.docChanged && next.dismissedRange !== null) {
62098
+ next.dismissedRange = {
62099
+ from: transaction.mapping.map(next.dismissedRange.from),
62100
+ to: transaction.mapping.map(next.dismissedRange.to)
62101
+ };
62102
+ }
61950
62103
  if (isEditable && (empty || editor.view.composing)) {
61951
62104
  if ((from < prev.range.from || from > prev.range.to) && !composing && !prev.composing) {
61952
62105
  next.active = false;
@@ -61972,12 +62125,27 @@ ${nextLine.slice(indentLevel + 2)}`;
61972
62125
  text: match.text,
61973
62126
  transaction
61974
62127
  }))) {
61975
- next.active = true;
61976
- next.decorationId = prev.decorationId ? prev.decorationId : decorationId;
61977
- next.range = match.range;
61978
- next.query = match.query;
61979
- next.text = match.text;
62128
+ if (next.dismissedRange !== null && !shouldKeepDismissed({
62129
+ match,
62130
+ dismissedRange: next.dismissedRange,
62131
+ state,
62132
+ transaction
62133
+ })) {
62134
+ next.dismissedRange = null;
62135
+ }
62136
+ if (next.dismissedRange === null) {
62137
+ next.active = true;
62138
+ next.decorationId = prev.decorationId ? prev.decorationId : decorationId;
62139
+ next.range = match.range;
62140
+ next.query = match.query;
62141
+ next.text = match.text;
62142
+ } else {
62143
+ next.active = false;
62144
+ }
61980
62145
  } else {
62146
+ if (!match) {
62147
+ next.dismissedRange = null;
62148
+ }
61981
62149
  next.active = false;
61982
62150
  }
61983
62151
  } else {
@@ -61995,41 +62163,18 @@ ${nextLine.slice(indentLevel + 2)}`;
61995
62163
  props: {
61996
62164
  // Call the keydown hook if suggestion is active.
61997
62165
  handleKeyDown(view, event) {
61998
- var _a, _b, _c, _d;
62166
+ var _a, _b;
61999
62167
  const { active, range } = plugin.getState(view.state);
62000
62168
  if (!active) {
62001
62169
  return false;
62002
62170
  }
62003
62171
  if (event.key === "Escape" || event.key === "Esc") {
62004
62172
  const state = plugin.getState(view.state);
62005
- const cachedNode = (_a = props == null ? void 0 : props.decorationNode) != null ? _a : null;
62006
- const decorationNode = cachedNode != null ? cachedNode : (state == null ? void 0 : state.decorationId) ? view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`) : null;
62007
- const handledByKeyDown = ((_b = renderer == null ? void 0 : renderer.onKeyDown) == null ? void 0 : _b.call(renderer, { view, event, range: state.range })) || false;
62008
- if (handledByKeyDown) {
62009
- return true;
62010
- }
62011
- const exitProps = {
62012
- editor,
62013
- range: state.range,
62014
- query: state.query,
62015
- text: state.text,
62016
- items: [],
62017
- command: (commandProps) => {
62018
- return command({ editor, range: state.range, props: commandProps });
62019
- },
62020
- decorationNode,
62021
- // If we have a cached decoration node, use it for the clientRect
62022
- // to avoid another DOM lookup. If not, leave clientRect null and
62023
- // let consumer decide if they want to query.
62024
- clientRect: decorationNode ? () => {
62025
- return decorationNode.getBoundingClientRect() || null;
62026
- } : null
62027
- };
62028
- (_c = renderer == null ? void 0 : renderer.onExit) == null ? void 0 : _c.call(renderer, exitProps);
62173
+ (_a = renderer == null ? void 0 : renderer.onKeyDown) == null ? void 0 : _a.call(renderer, { view, event, range: state.range });
62029
62174
  dispatchExit(view, pluginKey);
62030
62175
  return true;
62031
62176
  }
62032
- const handled = ((_d = renderer == null ? void 0 : renderer.onKeyDown) == null ? void 0 : _d.call(renderer, { view, event, range })) || false;
62177
+ const handled = ((_b = renderer == null ? void 0 : renderer.onKeyDown) == null ? void 0 : _b.call(renderer, { view, event, range })) || false;
62033
62178
  return handled;
62034
62179
  },
62035
62180
  // Setup decorator on the currently active suggestion.
@@ -62322,18 +62467,22 @@ ${nextLine.slice(indentLevel + 2)}`;
62322
62467
  return helpers.parseChildren([tokens[0]]);
62323
62468
  }
62324
62469
  const content = helpers.parseInline(tokens);
62325
- if (content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) {
62470
+ const hasExplicitEmptyParagraphMarker = tokens.length === 1 && tokens[0].type === "text" && (tokens[0].raw === EMPTY_PARAGRAPH_MARKDOWN || tokens[0].text === EMPTY_PARAGRAPH_MARKDOWN || tokens[0].raw === NBSP_CHAR || tokens[0].text === NBSP_CHAR);
62471
+ if (hasExplicitEmptyParagraphMarker && content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) {
62326
62472
  return helpers.createNode("paragraph", void 0, []);
62327
62473
  }
62328
62474
  return helpers.createNode("paragraph", void 0, content);
62329
62475
  },
62330
- renderMarkdown: (node, h) => {
62476
+ renderMarkdown: (node, h, ctx) => {
62477
+ var _a, _b;
62331
62478
  if (!node) {
62332
62479
  return "";
62333
62480
  }
62334
62481
  const content = Array.isArray(node.content) ? node.content : [];
62335
62482
  if (content.length === 0) {
62336
- return EMPTY_PARAGRAPH_MARKDOWN;
62483
+ const previousContent = Array.isArray((_a = ctx == null ? void 0 : ctx.previousNode) == null ? void 0 : _a.content) ? ctx.previousNode.content : [];
62484
+ const previousNodeIsEmptyParagraph = ((_b = ctx == null ? void 0 : ctx.previousNode) == null ? void 0 : _b.type) === "paragraph" && previousContent.length === 0;
62485
+ return previousNodeIsEmptyParagraph ? EMPTY_PARAGRAPH_MARKDOWN : "";
62337
62486
  }
62338
62487
  return h.renderChildren(content);
62339
62488
  },
@@ -62551,7 +62700,7 @@ ${nextLine.slice(indentLevel + 2)}`;
62551
62700
  */
62552
62701
  static valid($pos) {
62553
62702
  let parent = $pos.parent;
62554
- if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos))
62703
+ if (parent.inlineContent || !closedBefore($pos) || !closedAfter($pos))
62555
62704
  return false;
62556
62705
  let override = parent.type.spec.allowGapCursor;
62557
62706
  if (override != null)
@@ -63580,6 +63729,9 @@ ${nextLine.slice(indentLevel + 2)}`;
63580
63729
  doc.descendants((node, pos) => {
63581
63730
  const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
63582
63731
  const isEmpty = !node.isLeaf && isNodeEmpty(node);
63732
+ if (!node.type.isTextblock) {
63733
+ return this.options.includeChildren;
63734
+ }
63583
63735
  if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
63584
63736
  const classes = [this.options.emptyNodeClass];
63585
63737
  if (isEmptyDoc) {
@@ -63633,6 +63785,7 @@ ${nextLine.slice(indentLevel + 2)}`;
63633
63785
  ];
63634
63786
  }
63635
63787
  });
63788
+ var skipTrailingNodeMeta = "skipTrailingNode";
63636
63789
  function nodeEqualsType({ types, node }) {
63637
63790
  return node && Array.isArray(types) && types.includes(node.type) || (node == null ? void 0 : node.type) === types;
63638
63791
  }
@@ -63652,11 +63805,14 @@ ${nextLine.slice(indentLevel + 2)}`;
63652
63805
  return [
63653
63806
  new Plugin({
63654
63807
  key: plugin,
63655
- appendTransaction: (_, __, state) => {
63808
+ appendTransaction: (transactions, __, state) => {
63656
63809
  const { doc, tr, schema } = state;
63657
63810
  const shouldInsertNodeAtEnd = plugin.getState(state);
63658
63811
  const endPosition = doc.content.size;
63659
63812
  const type = schema.nodes[defaultNode];
63813
+ if (transactions.some((transaction) => transaction.getMeta(skipTrailingNodeMeta))) {
63814
+ return;
63815
+ }
63660
63816
  if (!shouldInsertNodeAtEnd) {
63661
63817
  return;
63662
63818
  }
@@ -66371,6 +66527,7 @@ ${nextLine.slice(indentLevel + 2)}`;
66371
66527
  aria-roledescription="${x => x.ariaRoledescription}"
66372
66528
  ${ref('control')}
66373
66529
  >
66530
+ <div class="icon-background"></div>
66374
66531
  <div class="icon">
66375
66532
  <span class="current-label">${x => (x.selected ? popupIconCurrentLabel.getValueFor(x) : '')}</span>
66376
66533
  <div class="step-indicator"><slot name="step-indicator"><span aria-hidden="true">${x => x.stepInternals.position}</span></slot></div>
@@ -66469,28 +66626,7 @@ ${nextLine.slice(indentLevel + 2)}`;
66469
66626
  }
66470
66627
  `;
66471
66628
 
66472
- /**
66473
- * Observable class to subscribe to changes in the page's device pixel ratio
66474
- * Based on: https://frontendmasters.com/blog/obsessing-over-smooth-radial-gradient-disc-edges/#the-less-code-and-more-flexible-js-solution
66475
- */
66476
- class DevicePixelRatio {
66477
- constructor() {
66478
- const update = () => {
66479
- this.current = window.devicePixelRatio;
66480
- window
66481
- .matchMedia(`(resolution: ${this.current}x)`)
66482
- .addEventListener('change', update, { once: true });
66483
- };
66484
- update();
66485
- }
66486
- }
66487
- __decorate([
66488
- observable
66489
- ], DevicePixelRatio.prototype, "current", void 0);
66490
- const devicePixelRatio = new DevicePixelRatio();
66491
-
66492
66629
  const template$n = html `<ol><slot
66493
- style="--ni-private-device-pixel-ratio: ${() => devicePixelRatio.current};"
66494
66630
  name="step"
66495
66631
  ${slotted('steps')}
66496
66632
  ></slot></ol>`;
@@ -72380,7 +72516,7 @@ focus outline in that case.
72380
72516
  this.scrollElement = null;
72381
72517
  this.targetWindow = null;
72382
72518
  this.isScrolling = false;
72383
- this.currentScrollToIndex = null;
72519
+ this.scrollState = null;
72384
72520
  this.measurementsCache = [];
72385
72521
  this.itemSizeCache = /* @__PURE__ */ new Map();
72386
72522
  this.laneAssignments = /* @__PURE__ */ new Map();
@@ -72393,6 +72529,10 @@ focus outline in that case.
72393
72529
  this.scrollDirection = null;
72394
72530
  this.scrollAdjustments = 0;
72395
72531
  this.elementsCache = /* @__PURE__ */ new Map();
72532
+ this.now = () => {
72533
+ var _a, _b, _c;
72534
+ return ((_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) ?? Date.now();
72535
+ };
72396
72536
  this.observer = /* @__PURE__ */ (() => {
72397
72537
  let _ro = null;
72398
72538
  const get = () => {
@@ -72405,7 +72545,18 @@ focus outline in that case.
72405
72545
  return _ro = new this.targetWindow.ResizeObserver((entries) => {
72406
72546
  entries.forEach((entry) => {
72407
72547
  const run = () => {
72408
- this._measureElement(entry.target, entry);
72548
+ const node = entry.target;
72549
+ const index = this.indexFromElement(node);
72550
+ if (!node.isConnected) {
72551
+ this.observer.unobserve(node);
72552
+ return;
72553
+ }
72554
+ if (this.shouldMeasureDuringScroll(index)) {
72555
+ this.resizeItem(
72556
+ index,
72557
+ this.options.measureElement(node, entry, this)
72558
+ );
72559
+ }
72409
72560
  };
72410
72561
  this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
72411
72562
  });
@@ -72490,6 +72641,11 @@ focus outline in that case.
72490
72641
  this.unsubs.filter(Boolean).forEach((d) => d());
72491
72642
  this.unsubs = [];
72492
72643
  this.observer.disconnect();
72644
+ if (this.rafId != null && this.targetWindow) {
72645
+ this.targetWindow.cancelAnimationFrame(this.rafId);
72646
+ this.rafId = null;
72647
+ }
72648
+ this.scrollState = null;
72493
72649
  this.scrollElement = null;
72494
72650
  this.targetWindow = null;
72495
72651
  };
@@ -72528,6 +72684,9 @@ focus outline in that case.
72528
72684
  this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
72529
72685
  this.scrollOffset = offset;
72530
72686
  this.isScrolling = isScrolling;
72687
+ if (this.scrollState) {
72688
+ this.scheduleScrollReconcile();
72689
+ }
72531
72690
  this.maybeNotify();
72532
72691
  })
72533
72692
  );
@@ -72537,6 +72696,7 @@ focus outline in that case.
72537
72696
  });
72538
72697
  }
72539
72698
  };
72699
+ this.rafId = null;
72540
72700
  this.getSize = () => {
72541
72701
  if (!this.options.enabled) {
72542
72702
  this.scrollRect = null;
@@ -72755,13 +72915,38 @@ focus outline in that case.
72755
72915
  }
72756
72916
  return parseInt(indexStr, 10);
72757
72917
  };
72758
- this._measureElement = (node, entry) => {
72759
- const index = this.indexFromElement(node);
72760
- const item = this.measurementsCache[index];
72761
- if (!item) {
72918
+ this.shouldMeasureDuringScroll = (index) => {
72919
+ var _a;
72920
+ if (!this.scrollState || this.scrollState.behavior !== "smooth") {
72921
+ return true;
72922
+ }
72923
+ const scrollIndex = this.scrollState.index ?? ((_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index);
72924
+ if (scrollIndex !== void 0 && this.range) {
72925
+ const bufferSize = Math.max(
72926
+ this.options.overscan,
72927
+ Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
72928
+ );
72929
+ const minIndex = Math.max(0, scrollIndex - bufferSize);
72930
+ const maxIndex = Math.min(
72931
+ this.options.count - 1,
72932
+ scrollIndex + bufferSize
72933
+ );
72934
+ return index >= minIndex && index <= maxIndex;
72935
+ }
72936
+ return true;
72937
+ };
72938
+ this.measureElement = (node) => {
72939
+ if (!node) {
72940
+ this.elementsCache.forEach((cached, key2) => {
72941
+ if (!cached.isConnected) {
72942
+ this.observer.unobserve(cached);
72943
+ this.elementsCache.delete(key2);
72944
+ }
72945
+ });
72762
72946
  return;
72763
72947
  }
72764
- const key = item.key;
72948
+ const index = this.indexFromElement(node);
72949
+ const key = this.options.getItemKey(index);
72765
72950
  const prevNode = this.elementsCache.get(key);
72766
72951
  if (prevNode !== node) {
72767
72952
  if (prevNode) {
@@ -72770,19 +72955,18 @@ focus outline in that case.
72770
72955
  this.observer.observe(node);
72771
72956
  this.elementsCache.set(key, node);
72772
72957
  }
72773
- if (node.isConnected) {
72774
- this.resizeItem(index, this.options.measureElement(node, entry, this));
72958
+ if ((!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(index)) {
72959
+ this.resizeItem(index, this.options.measureElement(node, void 0, this));
72775
72960
  }
72776
72961
  };
72777
72962
  this.resizeItem = (index, size) => {
72963
+ var _a;
72778
72964
  const item = this.measurementsCache[index];
72779
- if (!item) {
72780
- return;
72781
- }
72965
+ if (!item) return;
72782
72966
  const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
72783
72967
  const delta = size - itemSize;
72784
72968
  if (delta !== 0) {
72785
- if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
72969
+ if (((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments)) {
72786
72970
  if (this.options.debug) {
72787
72971
  console.info("correction", delta);
72788
72972
  }
@@ -72796,18 +72980,6 @@ focus outline in that case.
72796
72980
  this.notify(false);
72797
72981
  }
72798
72982
  };
72799
- this.measureElement = (node) => {
72800
- if (!node) {
72801
- this.elementsCache.forEach((cached, key) => {
72802
- if (!cached.isConnected) {
72803
- this.observer.unobserve(cached);
72804
- this.elementsCache.delete(key);
72805
- }
72806
- });
72807
- return;
72808
- }
72809
- this._measureElement(node, void 0);
72810
- };
72811
72983
  this.getVirtualItems = memo(
72812
72984
  () => [this.getVirtualIndexes(), this.getMeasurements()],
72813
72985
  (indexes, measurements) => {
@@ -72864,12 +73036,10 @@ focus outline in that case.
72864
73036
  };
72865
73037
  this.getOffsetForIndex = (index, align = "auto") => {
72866
73038
  index = Math.max(0, Math.min(index, this.options.count - 1));
72867
- const item = this.measurementsCache[index];
72868
- if (!item) {
72869
- return void 0;
72870
- }
72871
73039
  const size = this.getSize();
72872
73040
  const scrollOffset = this.getScrollOffset();
73041
+ const item = this.measurementsCache[index];
73042
+ if (!item) return;
72873
73043
  if (align === "auto") {
72874
73044
  if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
72875
73045
  align = "end";
@@ -72888,85 +73058,55 @@ focus outline in that case.
72888
73058
  align
72889
73059
  ];
72890
73060
  };
72891
- this.isDynamicMode = () => this.elementsCache.size > 0;
72892
- this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
72893
- if (behavior === "smooth" && this.isDynamicMode()) {
72894
- console.warn(
72895
- "The `smooth` scroll behavior is not fully supported with dynamic size."
72896
- );
72897
- }
72898
- this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
72899
- adjustments: void 0,
72900
- behavior
72901
- });
73061
+ this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
73062
+ const offset = this.getOffsetForAlignment(toOffset, align);
73063
+ const now = this.now();
73064
+ this.scrollState = {
73065
+ index: null,
73066
+ align,
73067
+ behavior,
73068
+ startedAt: now,
73069
+ lastTargetOffset: offset,
73070
+ stableFrames: 0
73071
+ };
73072
+ this._scrollToOffset(offset, { adjustments: void 0, behavior });
73073
+ this.scheduleScrollReconcile();
72902
73074
  };
72903
- this.scrollToIndex = (index, { align: initialAlign = "auto", behavior } = {}) => {
72904
- if (behavior === "smooth" && this.isDynamicMode()) {
72905
- console.warn(
72906
- "The `smooth` scroll behavior is not fully supported with dynamic size."
72907
- );
72908
- }
73075
+ this.scrollToIndex = (index, {
73076
+ align: initialAlign = "auto",
73077
+ behavior = "auto"
73078
+ } = {}) => {
72909
73079
  index = Math.max(0, Math.min(index, this.options.count - 1));
72910
- this.currentScrollToIndex = index;
72911
- let attempts = 0;
72912
- const maxAttempts = 10;
72913
- const tryScroll = (currentAlign) => {
72914
- if (!this.targetWindow) return;
72915
- const offsetInfo = this.getOffsetForIndex(index, currentAlign);
72916
- if (!offsetInfo) {
72917
- console.warn("Failed to get offset for index:", index);
72918
- return;
72919
- }
72920
- const [offset, align] = offsetInfo;
72921
- this._scrollToOffset(offset, { adjustments: void 0, behavior });
72922
- this.targetWindow.requestAnimationFrame(() => {
72923
- if (!this.targetWindow) return;
72924
- const verify = () => {
72925
- if (this.currentScrollToIndex !== index) return;
72926
- const currentOffset = this.getScrollOffset();
72927
- const afterInfo = this.getOffsetForIndex(index, align);
72928
- if (!afterInfo) {
72929
- console.warn("Failed to get offset for index:", index);
72930
- return;
72931
- }
72932
- if (!approxEqual(afterInfo[0], currentOffset)) {
72933
- scheduleRetry(align);
72934
- }
72935
- };
72936
- if (this.isDynamicMode()) {
72937
- this.targetWindow.requestAnimationFrame(verify);
72938
- } else {
72939
- verify();
72940
- }
72941
- });
72942
- };
72943
- const scheduleRetry = (align) => {
72944
- if (!this.targetWindow) return;
72945
- if (this.currentScrollToIndex !== index) return;
72946
- attempts++;
72947
- if (attempts < maxAttempts) {
72948
- if (this.options.debug) {
72949
- console.info("Schedule retry", attempts, maxAttempts);
72950
- }
72951
- this.targetWindow.requestAnimationFrame(() => tryScroll(align));
72952
- } else {
72953
- console.warn(
72954
- `Failed to scroll to index ${index} after ${maxAttempts} attempts.`
72955
- );
72956
- }
73080
+ const offsetInfo = this.getOffsetForIndex(index, initialAlign);
73081
+ if (!offsetInfo) {
73082
+ return;
73083
+ }
73084
+ const [offset, align] = offsetInfo;
73085
+ const now = this.now();
73086
+ this.scrollState = {
73087
+ index,
73088
+ align,
73089
+ behavior,
73090
+ startedAt: now,
73091
+ lastTargetOffset: offset,
73092
+ stableFrames: 0
72957
73093
  };
72958
- tryScroll(initialAlign);
73094
+ this._scrollToOffset(offset, { adjustments: void 0, behavior });
73095
+ this.scheduleScrollReconcile();
72959
73096
  };
72960
- this.scrollBy = (delta, { behavior } = {}) => {
72961
- if (behavior === "smooth" && this.isDynamicMode()) {
72962
- console.warn(
72963
- "The `smooth` scroll behavior is not fully supported with dynamic size."
72964
- );
72965
- }
72966
- this._scrollToOffset(this.getScrollOffset() + delta, {
72967
- adjustments: void 0,
72968
- behavior
72969
- });
73097
+ this.scrollBy = (delta, { behavior = "auto" } = {}) => {
73098
+ const offset = this.getScrollOffset() + delta;
73099
+ const now = this.now();
73100
+ this.scrollState = {
73101
+ index: null,
73102
+ align: "start",
73103
+ behavior,
73104
+ startedAt: now,
73105
+ lastTargetOffset: offset,
73106
+ stableFrames: 0
73107
+ };
73108
+ this._scrollToOffset(offset, { adjustments: void 0, behavior });
73109
+ this.scheduleScrollReconcile();
72970
73110
  };
72971
73111
  this.getTotalSize = () => {
72972
73112
  var _a;
@@ -73006,6 +73146,49 @@ focus outline in that case.
73006
73146
  };
73007
73147
  this.setOptions(opts);
73008
73148
  }
73149
+ scheduleScrollReconcile() {
73150
+ if (!this.targetWindow) {
73151
+ this.scrollState = null;
73152
+ return;
73153
+ }
73154
+ if (this.rafId != null) return;
73155
+ this.rafId = this.targetWindow.requestAnimationFrame(() => {
73156
+ this.rafId = null;
73157
+ this.reconcileScroll();
73158
+ });
73159
+ }
73160
+ reconcileScroll() {
73161
+ if (!this.scrollState) return;
73162
+ const el = this.scrollElement;
73163
+ if (!el) return;
73164
+ const MAX_RECONCILE_MS = 5e3;
73165
+ if (this.now() - this.scrollState.startedAt > MAX_RECONCILE_MS) {
73166
+ this.scrollState = null;
73167
+ return;
73168
+ }
73169
+ const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
73170
+ const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
73171
+ const STABLE_FRAMES = 1;
73172
+ const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
73173
+ if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
73174
+ this.scrollState.stableFrames++;
73175
+ if (this.scrollState.stableFrames >= STABLE_FRAMES) {
73176
+ this.scrollState = null;
73177
+ return;
73178
+ }
73179
+ } else {
73180
+ this.scrollState.stableFrames = 0;
73181
+ if (targetChanged) {
73182
+ this.scrollState.lastTargetOffset = targetOffset;
73183
+ this.scrollState.behavior = "auto";
73184
+ this._scrollToOffset(targetOffset, {
73185
+ adjustments: void 0,
73186
+ behavior: "auto"
73187
+ });
73188
+ }
73189
+ }
73190
+ this.scheduleScrollReconcile();
73191
+ }
73009
73192
  };
73010
73193
  const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
73011
73194
  while (low <= high) {