@ni/spright-components 4.0.0 → 4.0.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.
@@ -15,7 +15,7 @@
15
15
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
16
  PERFORMANCE OF THIS SOFTWARE.
17
17
  ***************************************************************************** */
18
- /* global Reflect, Promise, SuppressedError, Symbol */
18
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
19
19
 
20
20
 
21
21
  function __decorate$1(decorators, target, key, desc) {
@@ -54,7 +54,7 @@
54
54
  function __asyncGenerator(thisArg, _arguments, generator) {
55
55
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
56
56
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
57
- return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
57
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
58
58
  function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
59
59
  function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
60
60
  function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
@@ -16053,6 +16053,7 @@
16053
16053
  const ForestGreen = "#074023";
16054
16054
  const DigitalGreenLight = "#009b65";
16055
16055
  const DigitalGreenLight10 = "#e6f5f0";
16056
+ const DigitalGreenLight30 = "#b3e1d1";
16056
16057
  const NiSky = "#3cb4e7";
16057
16058
  const BannerFail100DarkUi = "#d63434";
16058
16059
  const Warning100LightUi = "#ff4b00";
@@ -16061,6 +16062,7 @@
16061
16062
  const DigitalGreenDark110 = "#00613f";
16062
16063
  const PowerGreen = "#32eb96";
16063
16064
  const PowerGreen10 = "#364941";
16065
+ const PowerGreen30 = "#356d54";
16064
16066
  const Black22 = "#e6e6e6";
16065
16067
  const Black82 = "#434445";
16066
16068
  const NiHoneyLight = "#ffe76b";
@@ -16679,7 +16681,7 @@
16679
16681
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventStaticFontColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark110, White, White));
16680
16682
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventDynamicFontColor)).withDefault((element) => getColorForTheme(element, White, White, White));
16681
16683
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventTransientFontColor)).withDefault((element) => getColorForTheme(element, White, White, White));
16682
- DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBackgroundHoverStaticColor)).withDefault((element) => getColorForTheme(element, hexToRgbaCssColor(DigitalGreenLight, 0.3), hexToRgbaCssColor(PowerGreen, 0.3), hexToRgbaCssColor(PowerGreen, 0.3)));
16684
+ DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBackgroundHoverStaticColor)).withDefault((element) => getColorForTheme(element, DigitalGreenLight30, PowerGreen30, PowerGreen30));
16683
16685
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBackgroundHoverDynamicColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark110, DigitalGreenDark105, DigitalGreenDark105));
16684
16686
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarEventBackgroundHoverTransientColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark110, DigitalGreenDark105, DigitalGreenDark105));
16685
16687
  DesignToken.create(styleNameFromTokenName(tokenNames.calendarRowBackgroundSelectedColor)).withDefault((element) => getColorForTheme(element, hexToRgbaCssColor(DigitalGreenLight, 0.2), hexToRgbaCssColor(PowerGreen, 0.2), hexToRgbaCssColor(PowerGreen, 0.2)));
@@ -29371,7 +29373,7 @@ so this becomes the fallback color for the slot */ ''}
29371
29373
  */
29372
29374
  parse(dom, options = {}) {
29373
29375
  let context = new ParseContext(this, options, false);
29374
- context.addAll(dom, options.from, options.to);
29376
+ context.addAll(dom, Mark$1.none, options.from, options.to);
29375
29377
  return context.finish();
29376
29378
  }
29377
29379
  /**
@@ -29384,7 +29386,7 @@ so this becomes the fallback color for the slot */ ''}
29384
29386
  */
29385
29387
  parseSlice(dom, options = {}) {
29386
29388
  let context = new ParseContext(this, options, true);
29387
- context.addAll(dom, options.from, options.to);
29389
+ context.addAll(dom, Mark$1.none, options.from, options.to);
29388
29390
  return Slice.maxOpen(context.finish());
29389
29391
  }
29390
29392
  /**
@@ -29493,22 +29495,15 @@ so this becomes the fallback color for the slot */ ''}
29493
29495
  return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;
29494
29496
  }
29495
29497
  class NodeContext {
29496
- constructor(type, attrs,
29497
- // Marks applied to this node itself
29498
- marks,
29499
- // Marks that can't apply here, but will be used in children if possible
29500
- pendingMarks, solid, match, options) {
29498
+ constructor(type, attrs, marks, solid, match, options) {
29501
29499
  this.type = type;
29502
29500
  this.attrs = attrs;
29503
29501
  this.marks = marks;
29504
- this.pendingMarks = pendingMarks;
29505
29502
  this.solid = solid;
29506
29503
  this.options = options;
29507
29504
  this.content = [];
29508
29505
  // Marks applied to the node's children
29509
29506
  this.activeMarks = Mark$1.none;
29510
- // Nested Marks with same type
29511
- this.stashMarks = [];
29512
29507
  this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
29513
29508
  }
29514
29509
  findWrapping(node) {
@@ -29548,21 +29543,6 @@ so this becomes the fallback color for the slot */ ''}
29548
29543
  content = content.append(this.match.fillBefore(Fragment.empty, true));
29549
29544
  return this.type ? this.type.create(this.attrs, content, this.marks) : content;
29550
29545
  }
29551
- popFromStashMark(mark) {
29552
- for (let i = this.stashMarks.length - 1; i >= 0; i--)
29553
- if (mark.eq(this.stashMarks[i]))
29554
- return this.stashMarks.splice(i, 1)[0];
29555
- }
29556
- applyPending(nextType) {
29557
- for (let i = 0, pending = this.pendingMarks; i < pending.length; i++) {
29558
- let mark = pending[i];
29559
- if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) &&
29560
- !mark.isInSet(this.activeMarks)) {
29561
- this.activeMarks = mark.addToSet(this.activeMarks);
29562
- this.pendingMarks = mark.removeFromSet(this.pendingMarks);
29563
- }
29564
- }
29565
- }
29566
29546
  inlineContext(node) {
29567
29547
  if (this.type)
29568
29548
  return this.type.inlineContent;
@@ -29584,11 +29564,11 @@ so this becomes the fallback color for the slot */ ''}
29584
29564
  let topNode = options.topNode, topContext;
29585
29565
  let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
29586
29566
  if (topNode)
29587
- topContext = new NodeContext(topNode.type, topNode.attrs, Mark$1.none, Mark$1.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
29567
+ topContext = new NodeContext(topNode.type, topNode.attrs, Mark$1.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
29588
29568
  else if (isOpen)
29589
- topContext = new NodeContext(null, null, Mark$1.none, Mark$1.none, true, null, topOptions);
29569
+ topContext = new NodeContext(null, null, Mark$1.none, true, null, topOptions);
29590
29570
  else
29591
- topContext = new NodeContext(parser.schema.topNodeType, null, Mark$1.none, Mark$1.none, true, null, topOptions);
29571
+ topContext = new NodeContext(parser.schema.topNodeType, null, Mark$1.none, true, null, topOptions);
29592
29572
  this.nodes = [topContext];
29593
29573
  this.find = options.findPositions;
29594
29574
  this.needsBlock = false;
@@ -29599,31 +29579,13 @@ so this becomes the fallback color for the slot */ ''}
29599
29579
  // Add a DOM node to the content. Text is inserted as text node,
29600
29580
  // otherwise, the node is passed to `addElement` or, if it has a
29601
29581
  // `style` attribute, `addElementWithStyles`.
29602
- addDOM(dom) {
29582
+ addDOM(dom, marks) {
29603
29583
  if (dom.nodeType == 3)
29604
- this.addTextNode(dom);
29584
+ this.addTextNode(dom, marks);
29605
29585
  else if (dom.nodeType == 1)
29606
- this.addElement(dom);
29607
- }
29608
- withStyleRules(dom, f) {
29609
- let style = dom.style;
29610
- if (!style || !style.length)
29611
- return f();
29612
- let marks = this.readStyles(dom.style);
29613
- if (!marks)
29614
- return; // A style with ignore: true
29615
- let [addMarks, removeMarks] = marks, top = this.top;
29616
- for (let i = 0; i < removeMarks.length; i++)
29617
- this.removePendingMark(removeMarks[i], top);
29618
- for (let i = 0; i < addMarks.length; i++)
29619
- this.addPendingMark(addMarks[i]);
29620
- f();
29621
- for (let i = 0; i < addMarks.length; i++)
29622
- this.removePendingMark(addMarks[i], top);
29623
- for (let i = 0; i < removeMarks.length; i++)
29624
- this.addPendingMark(removeMarks[i]);
29586
+ this.addElement(dom, marks);
29625
29587
  }
29626
- addTextNode(dom) {
29588
+ addTextNode(dom, marks) {
29627
29589
  let value = dom.nodeValue;
29628
29590
  let top = this.top;
29629
29591
  if (top.options & OPT_PRESERVE_WS_FULL ||
@@ -29650,7 +29612,7 @@ so this becomes the fallback color for the slot */ ''}
29650
29612
  value = value.replace(/\r\n?/g, "\n");
29651
29613
  }
29652
29614
  if (value)
29653
- this.insertNode(this.parser.schema.text(value));
29615
+ this.insertNode(this.parser.schema.text(value), marks);
29654
29616
  this.findInText(dom);
29655
29617
  }
29656
29618
  else {
@@ -29659,7 +29621,7 @@ so this becomes the fallback color for the slot */ ''}
29659
29621
  }
29660
29622
  // Try to find a handler for the given tag and use that to parse. If
29661
29623
  // none is found, the element's content nodes are added directly.
29662
- addElement(dom, matchAfter) {
29624
+ addElement(dom, marks, matchAfter) {
29663
29625
  let name = dom.nodeName.toLowerCase(), ruleID;
29664
29626
  if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)
29665
29627
  normalizeList(dom);
@@ -29667,7 +29629,7 @@ so this becomes the fallback color for the slot */ ''}
29667
29629
  (ruleID = this.parser.matchTag(dom, this, matchAfter));
29668
29630
  if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
29669
29631
  this.findInside(dom);
29670
- this.ignoreFallback(dom);
29632
+ this.ignoreFallback(dom, marks);
29671
29633
  }
29672
29634
  else if (!rule || rule.skip || rule.closeParent) {
29673
29635
  if (rule && rule.closeParent)
@@ -29685,45 +29647,44 @@ so this becomes the fallback color for the slot */ ''}
29685
29647
  this.needsBlock = true;
29686
29648
  }
29687
29649
  else if (!dom.firstChild) {
29688
- this.leafFallback(dom);
29650
+ this.leafFallback(dom, marks);
29689
29651
  return;
29690
29652
  }
29691
- if (rule && rule.skip)
29692
- this.addAll(dom);
29693
- else
29694
- this.withStyleRules(dom, () => this.addAll(dom));
29653
+ let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
29654
+ if (innerMarks)
29655
+ this.addAll(dom, innerMarks);
29695
29656
  if (sync)
29696
29657
  this.sync(top);
29697
29658
  this.needsBlock = oldNeedsBlock;
29698
29659
  }
29699
29660
  else {
29700
- this.withStyleRules(dom, () => {
29701
- this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : undefined);
29702
- });
29661
+ let innerMarks = this.readStyles(dom, marks);
29662
+ if (innerMarks)
29663
+ this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);
29703
29664
  }
29704
29665
  }
29705
29666
  // Called for leaf DOM nodes that would otherwise be ignored
29706
- leafFallback(dom) {
29667
+ leafFallback(dom, marks) {
29707
29668
  if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent)
29708
- this.addTextNode(dom.ownerDocument.createTextNode("\n"));
29669
+ this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
29709
29670
  }
29710
29671
  // Called for ignored nodes
29711
- ignoreFallback(dom) {
29672
+ ignoreFallback(dom, marks) {
29712
29673
  // Ignored BR nodes should at least create an inline context
29713
29674
  if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
29714
- this.findPlace(this.parser.schema.text("-"));
29675
+ this.findPlace(this.parser.schema.text("-"), marks);
29715
29676
  }
29716
29677
  // Run any style parser associated with the node's styles. Either
29717
- // return an array of marks, or null to indicate some of the styles
29718
- // had a rule with `ignore` set.
29719
- readStyles(styles) {
29720
- let add = Mark$1.none, remove = Mark$1.none;
29678
+ // return an updated array of marks, or null to indicate some of the
29679
+ // styles had a rule with `ignore` set.
29680
+ readStyles(dom, marks) {
29681
+ let styles = dom.style;
29721
29682
  // Because many properties will only show up in 'normalized' form
29722
29683
  // in `style.item` (i.e. text-decoration becomes
29723
29684
  // text-decoration-line, text-decoration-color, etc), we directly
29724
29685
  // query the styles mentioned in our rules instead of iterating
29725
29686
  // over the items.
29726
- if (styles.length)
29687
+ if (styles && styles.length)
29727
29688
  for (let i = 0; i < this.parser.matchedStyles.length; i++) {
29728
29689
  let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);
29729
29690
  if (value)
@@ -29733,52 +29694,50 @@ so this becomes the fallback color for the slot */ ''}
29733
29694
  break;
29734
29695
  if (rule.ignore)
29735
29696
  return null;
29736
- if (rule.clearMark) {
29737
- this.top.pendingMarks.concat(this.top.activeMarks).forEach(m => {
29738
- if (rule.clearMark(m))
29739
- remove = m.addToSet(remove);
29740
- });
29741
- }
29742
- else {
29743
- add = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add);
29744
- }
29697
+ if (rule.clearMark)
29698
+ marks = marks.filter(m => !rule.clearMark(m));
29699
+ else
29700
+ marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
29745
29701
  if (rule.consuming === false)
29746
29702
  after = rule;
29747
29703
  else
29748
29704
  break;
29749
29705
  }
29750
29706
  }
29751
- return [add, remove];
29707
+ return marks;
29752
29708
  }
29753
29709
  // Look up a handler for the given node. If none are found, return
29754
29710
  // false. Otherwise, apply it, use its return value to drive the way
29755
29711
  // the node's content is wrapped, and return true.
29756
- addElementByRule(dom, rule, continueAfter) {
29757
- let sync, nodeType, mark;
29712
+ addElementByRule(dom, rule, marks, continueAfter) {
29713
+ let sync, nodeType;
29758
29714
  if (rule.node) {
29759
29715
  nodeType = this.parser.schema.nodes[rule.node];
29760
29716
  if (!nodeType.isLeaf) {
29761
- sync = this.enter(nodeType, rule.attrs || null, rule.preserveWhitespace);
29717
+ let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
29718
+ if (inner) {
29719
+ sync = true;
29720
+ marks = inner;
29721
+ }
29762
29722
  }
29763
- else if (!this.insertNode(nodeType.create(rule.attrs))) {
29764
- this.leafFallback(dom);
29723
+ else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {
29724
+ this.leafFallback(dom, marks);
29765
29725
  }
29766
29726
  }
29767
29727
  else {
29768
29728
  let markType = this.parser.schema.marks[rule.mark];
29769
- mark = markType.create(rule.attrs);
29770
- this.addPendingMark(mark);
29729
+ marks = marks.concat(markType.create(rule.attrs));
29771
29730
  }
29772
29731
  let startIn = this.top;
29773
29732
  if (nodeType && nodeType.isLeaf) {
29774
29733
  this.findInside(dom);
29775
29734
  }
29776
29735
  else if (continueAfter) {
29777
- this.addElement(dom, continueAfter);
29736
+ this.addElement(dom, marks, continueAfter);
29778
29737
  }
29779
29738
  else if (rule.getContent) {
29780
29739
  this.findInside(dom);
29781
- rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node));
29740
+ rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks));
29782
29741
  }
29783
29742
  else {
29784
29743
  let contentDOM = dom;
@@ -29789,28 +29748,26 @@ so this becomes the fallback color for the slot */ ''}
29789
29748
  else if (rule.contentElement)
29790
29749
  contentDOM = rule.contentElement;
29791
29750
  this.findAround(dom, contentDOM, true);
29792
- this.addAll(contentDOM);
29751
+ this.addAll(contentDOM, marks);
29793
29752
  }
29794
29753
  if (sync && this.sync(startIn))
29795
29754
  this.open--;
29796
- if (mark)
29797
- this.removePendingMark(mark, startIn);
29798
29755
  }
29799
29756
  // Add all child nodes between `startIndex` and `endIndex` (or the
29800
29757
  // whole node, if not given). If `sync` is passed, use it to
29801
29758
  // synchronize after every block element.
29802
- addAll(parent, startIndex, endIndex) {
29759
+ addAll(parent, marks, startIndex, endIndex) {
29803
29760
  let index = startIndex || 0;
29804
29761
  for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {
29805
29762
  this.findAtPoint(parent, index);
29806
- this.addDOM(dom);
29763
+ this.addDOM(dom, marks);
29807
29764
  }
29808
29765
  this.findAtPoint(parent, index);
29809
29766
  }
29810
29767
  // Try to find a way to fit the given node type into the current
29811
29768
  // context. May add intermediate wrappers and/or leave non-solid
29812
29769
  // nodes that we're in.
29813
- findPlace(node) {
29770
+ findPlace(node, marks) {
29814
29771
  let route, sync;
29815
29772
  for (let depth = this.open; depth >= 0; depth--) {
29816
29773
  let cx = this.nodes[depth];
@@ -29825,53 +29782,61 @@ so this becomes the fallback color for the slot */ ''}
29825
29782
  break;
29826
29783
  }
29827
29784
  if (!route)
29828
- return false;
29785
+ return null;
29829
29786
  this.sync(sync);
29830
29787
  for (let i = 0; i < route.length; i++)
29831
- this.enterInner(route[i], null, false);
29832
- return true;
29788
+ marks = this.enterInner(route[i], null, marks, false);
29789
+ return marks;
29833
29790
  }
29834
29791
  // Try to insert the given node, adjusting the context when needed.
29835
- insertNode(node) {
29792
+ insertNode(node, marks) {
29836
29793
  if (node.isInline && this.needsBlock && !this.top.type) {
29837
29794
  let block = this.textblockFromContext();
29838
29795
  if (block)
29839
- this.enterInner(block);
29796
+ marks = this.enterInner(block, null, marks);
29840
29797
  }
29841
- if (this.findPlace(node)) {
29798
+ let innerMarks = this.findPlace(node, marks);
29799
+ if (innerMarks) {
29842
29800
  this.closeExtra();
29843
29801
  let top = this.top;
29844
- top.applyPending(node.type);
29845
29802
  if (top.match)
29846
29803
  top.match = top.match.matchType(node.type);
29847
- let marks = top.activeMarks;
29848
- for (let i = 0; i < node.marks.length; i++)
29849
- if (!top.type || top.type.allowsMarkType(node.marks[i].type))
29850
- marks = node.marks[i].addToSet(marks);
29851
- top.content.push(node.mark(marks));
29804
+ let nodeMarks = Mark$1.none;
29805
+ for (let m of innerMarks.concat(node.marks))
29806
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))
29807
+ nodeMarks = m.addToSet(nodeMarks);
29808
+ top.content.push(node.mark(nodeMarks));
29852
29809
  return true;
29853
29810
  }
29854
29811
  return false;
29855
29812
  }
29856
29813
  // Try to start a node of the given type, adjusting the context when
29857
29814
  // necessary.
29858
- enter(type, attrs, preserveWS) {
29859
- let ok = this.findPlace(type.create(attrs));
29860
- if (ok)
29861
- this.enterInner(type, attrs, true, preserveWS);
29862
- return ok;
29815
+ enter(type, attrs, marks, preserveWS) {
29816
+ let innerMarks = this.findPlace(type.create(attrs), marks);
29817
+ if (innerMarks)
29818
+ innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
29819
+ return innerMarks;
29863
29820
  }
29864
29821
  // Open a node of the given type
29865
- enterInner(type, attrs = null, solid = false, preserveWS) {
29822
+ enterInner(type, attrs, marks, solid = false, preserveWS) {
29866
29823
  this.closeExtra();
29867
29824
  let top = this.top;
29868
- top.applyPending(type);
29869
29825
  top.match = top.match && top.match.matchType(type);
29870
29826
  let options = wsOptionsFor(type, preserveWS, top.options);
29871
29827
  if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0)
29872
29828
  options |= OPT_OPEN_LEFT;
29873
- this.nodes.push(new NodeContext(type, attrs, top.activeMarks, top.pendingMarks, solid, null, options));
29829
+ let applyMarks = Mark$1.none;
29830
+ marks = marks.filter(m => {
29831
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
29832
+ applyMarks = m.addToSet(applyMarks);
29833
+ return false;
29834
+ }
29835
+ return true;
29836
+ });
29837
+ this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
29874
29838
  this.open++;
29839
+ return marks;
29875
29840
  }
29876
29841
  // Make sure all nodes above this.open are finished and added to
29877
29842
  // their parents
@@ -29985,29 +29950,6 @@ so this becomes the fallback color for the slot */ ''}
29985
29950
  return type;
29986
29951
  }
29987
29952
  }
29988
- addPendingMark(mark) {
29989
- let found = findSameMarkInSet(mark, this.top.pendingMarks);
29990
- if (found)
29991
- this.top.stashMarks.push(found);
29992
- this.top.pendingMarks = mark.addToSet(this.top.pendingMarks);
29993
- }
29994
- removePendingMark(mark, upto) {
29995
- for (let depth = this.open; depth >= 0; depth--) {
29996
- let level = this.nodes[depth];
29997
- let found = level.pendingMarks.lastIndexOf(mark);
29998
- if (found > -1) {
29999
- level.pendingMarks = mark.removeFromSet(level.pendingMarks);
30000
- }
30001
- else {
30002
- level.activeMarks = mark.removeFromSet(level.activeMarks);
30003
- let stashMark = level.popFromStashMark(mark);
30004
- if (stashMark && level.type && level.type.allowsMarkType(stashMark.type))
30005
- level.activeMarks = stashMark.addToSet(level.activeMarks);
30006
- }
30007
- if (level == upto)
30008
- break;
30009
- }
30010
- }
30011
29953
  }
30012
29954
  // Kludge to work around directly nested list nodes produced by some
30013
29955
  // tools and allowed by browsers to mean that the nested list is
@@ -30060,12 +30002,6 @@ so this becomes the fallback color for the slot */ ''}
30060
30002
  return true;
30061
30003
  }
30062
30004
  }
30063
- function findSameMarkInSet(mark, set) {
30064
- for (let i = 0; i < set.length; i++) {
30065
- if (mark.eq(set[i]))
30066
- return set[i];
30067
- }
30068
- }
30069
30005
 
30070
30006
  /**
30071
30007
  A DOM serializer knows how to convert ProseMirror nodes and
@@ -31368,7 +31304,9 @@ so this becomes the fallback color for the slot */ ''}
31368
31304
  throw new RangeError("Type given to setBlockType should be a textblock");
31369
31305
  let mapFrom = tr.steps.length;
31370
31306
  tr.doc.nodesBetween(from, to, (node, pos) => {
31371
- if (node.isTextblock && !node.hasMarkup(type, attrs) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
31307
+ let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
31308
+ if (node.isTextblock && !node.hasMarkup(type, attrsHere) &&
31309
+ canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
31372
31310
  let convertNewlines = null;
31373
31311
  if (type.schema.linebreakReplacement) {
31374
31312
  let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
@@ -31383,7 +31321,7 @@ so this becomes the fallback color for the slot */ ''}
31383
31321
  clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);
31384
31322
  let mapping = tr.mapping.slice(mapFrom);
31385
31323
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
31386
- tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrs, null, node.marks)), 0, 0), 1, true));
31324
+ tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
31387
31325
  if (convertNewlines === true)
31388
31326
  replaceNewlines(tr, node, pos, mapFrom);
31389
31327
  return false;
@@ -33533,15 +33471,18 @@ so this becomes the fallback color for the slot */ ''}
33533
33471
  if (doc.caretPositionFromPoint) {
33534
33472
  try { // Firefox throws for this call in hard-to-predict circumstances (#994)
33535
33473
  let pos = doc.caretPositionFromPoint(x, y);
33474
+ // Clip the offset, because Chrome will return a text offset
33475
+ // into <input> nodes, which can't be treated as a regular DOM
33476
+ // offset
33536
33477
  if (pos)
33537
- return { node: pos.offsetNode, offset: pos.offset };
33478
+ return { node: pos.offsetNode, offset: Math.min(nodeSize(pos.offsetNode), pos.offset) };
33538
33479
  }
33539
33480
  catch (_) { }
33540
33481
  }
33541
33482
  if (doc.caretRangeFromPoint) {
33542
33483
  let range = doc.caretRangeFromPoint(x, y);
33543
33484
  if (range)
33544
- return { node: range.startContainer, offset: range.startOffset };
33485
+ return { node: range.startContainer, offset: Math.min(nodeSize(range.startContainer), range.startOffset) };
33545
33486
  }
33546
33487
  }
33547
33488
 
@@ -34053,6 +33994,8 @@ so this becomes the fallback color for the slot */ ''}
34053
33994
  return false;
34054
33995
  let offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;
34055
33996
  let sel = view.domSelection();
33997
+ if (!sel)
33998
+ return $head.pos == $head.start() || $head.pos == $head.end();
34056
33999
  // If the textblock is all LTR, or the browser doesn't support
34057
34000
  // Selection.modify (Edge), fall back to a primitive approach
34058
34001
  if (!maybeRTL.test($head.parent.textContent) || !sel.modify)
@@ -35675,12 +35618,14 @@ so this becomes the fallback color for the slot */ ''}
35675
35618
  }
35676
35619
  function selectCursorWrapper(view) {
35677
35620
  let domSel = view.domSelection(), range = document.createRange();
35621
+ if (!domSel)
35622
+ return;
35678
35623
  let node = view.cursorWrapper.dom, img = node.nodeName == "IMG";
35679
35624
  if (img)
35680
- range.setEnd(node.parentNode, domIndex(node) + 1);
35625
+ range.setStart(node.parentNode, domIndex(node) + 1);
35681
35626
  else
35682
- range.setEnd(node, 0);
35683
- range.collapse(false);
35627
+ range.setStart(node, 0);
35628
+ range.collapse(true);
35684
35629
  domSel.removeAllRanges();
35685
35630
  domSel.addRange(range);
35686
35631
  // Kludge to kill 'control selection' in IE11 when selecting an
@@ -35968,6 +35913,8 @@ so this becomes the fallback color for the slot */ ''}
35968
35913
  }
35969
35914
  }
35970
35915
  let sel = view.domSelection();
35916
+ if (!sel)
35917
+ return;
35971
35918
  if (selectionCollapsed(sel)) {
35972
35919
  let range = document.createRange();
35973
35920
  range.setEnd(node, offset);
@@ -36322,6 +36269,15 @@ so this becomes the fallback color for the slot */ ''}
36322
36269
  function detachedDoc() {
36323
36270
  return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
36324
36271
  }
36272
+ function maybeWrapTrusted(html) {
36273
+ let trustedTypes = window.trustedTypes;
36274
+ if (!trustedTypes)
36275
+ return html;
36276
+ // With the require-trusted-types-for CSP, Chrome will block
36277
+ // innerHTML, even on a detached document. This wraps the string in
36278
+ // a way that makes the browser allow us to use its parser again.
36279
+ return trustedTypes.createPolicy("detachedDocument", { createHTML: (s) => s }).createHTML(html);
36280
+ }
36325
36281
  function readHTML(html) {
36326
36282
  let metas = /^(\s*<meta [^>]*>)*/.exec(html);
36327
36283
  if (metas)
@@ -36330,7 +36286,7 @@ so this becomes the fallback color for the slot */ ''}
36330
36286
  let firstTag = /<([a-z][^>\s]+)/i.exec(html), wrap;
36331
36287
  if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()])
36332
36288
  html = wrap.map(n => "<" + n + ">").join("") + html + wrap.map(n => "</" + n + ">").reverse().join("");
36333
- elt.innerHTML = html;
36289
+ elt.innerHTML = maybeWrapTrusted(html);
36334
36290
  if (wrap)
36335
36291
  for (let i = 0; i < wrap.length; i++)
36336
36292
  elt = elt.querySelector(wrap[i]) || elt;
@@ -36471,7 +36427,9 @@ so this becomes the fallback color for the slot */ ''}
36471
36427
  // and handling them eagerly tends to corrupt the input.
36472
36428
  if (android && chrome && event.keyCode == 13)
36473
36429
  return;
36474
- if (event.keyCode != 229)
36430
+ if (view.domObserver.selectionChanged(view.domSelectionRange()))
36431
+ view.domObserver.flush();
36432
+ else if (event.keyCode != 229)
36475
36433
  view.domObserver.forceFlush();
36476
36434
  // On iOS, if we preventDefault enter key presses, the virtual
36477
36435
  // keyboard gets confused. So the hack here is to set a flag that
@@ -36534,6 +36492,8 @@ so this becomes the fallback color for the slot */ ''}
36534
36492
  function updateSelection(view, selection, origin) {
36535
36493
  if (!view.focused)
36536
36494
  view.focus();
36495
+ if (view.state.selection.eq(selection))
36496
+ return;
36537
36497
  let tr = view.state.tr.setSelection(selection);
36538
36498
  tr.setMeta("pointer", true);
36539
36499
  view.dispatch(tr);
@@ -36787,8 +36747,8 @@ so this becomes the fallback color for the slot */ ''}
36787
36747
  editHandlers.compositionstart = editHandlers.compositionupdate = view => {
36788
36748
  if (!view.composing) {
36789
36749
  view.domObserver.flush();
36790
- let { state } = view, $pos = state.selection.$from;
36791
- if (state.selection.empty &&
36750
+ let { state } = view, $pos = state.selection.$to;
36751
+ if (state.selection instanceof TextSelection &&
36792
36752
  (state.storedMarks ||
36793
36753
  (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)))) {
36794
36754
  // Need to wrap the cursor in mark nodes different from the ones in the DOM context
@@ -36797,7 +36757,7 @@ so this becomes the fallback color for the slot */ ''}
36797
36757
  view.markCursor = null;
36798
36758
  }
36799
36759
  else {
36800
- endComposition(view);
36760
+ endComposition(view, !state.selection.empty);
36801
36761
  // In firefox, if the cursor is after but outside a marked node,
36802
36762
  // the inserted text won't inherit the marks. So this moves it
36803
36763
  // inside if necessary.
@@ -36808,7 +36768,9 @@ so this becomes the fallback color for the slot */ ''}
36808
36768
  if (!before)
36809
36769
  break;
36810
36770
  if (before.nodeType == 3) {
36811
- view.domSelection().collapse(before, before.nodeValue.length);
36771
+ let sel = view.domSelection();
36772
+ if (sel)
36773
+ sel.collapse(before, before.nodeValue.length);
36812
36774
  break;
36813
36775
  }
36814
36776
  else {
@@ -36876,15 +36838,17 @@ so this becomes the fallback color for the slot */ ''}
36876
36838
  /**
36877
36839
  @internal
36878
36840
  */
36879
- function endComposition(view, forceUpdate = false) {
36841
+ function endComposition(view, restarting = false) {
36880
36842
  if (android && view.domObserver.flushingSoon >= 0)
36881
36843
  return;
36882
36844
  view.domObserver.forceFlush();
36883
36845
  clearComposition(view);
36884
- if (forceUpdate || view.docView && view.docView.dirty) {
36846
+ if (restarting || view.docView && view.docView.dirty) {
36885
36847
  let sel = selectionFromDOM(view);
36886
36848
  if (sel && !sel.eq(view.state.selection))
36887
36849
  view.dispatch(view.state.tr.setSelection(sel));
36850
+ else if ((view.markCursor || restarting) && !view.state.selection.empty)
36851
+ view.dispatch(view.state.tr.deleteSelection());
36888
36852
  else
36889
36853
  view.updateState(view.state);
36890
36854
  return true;
@@ -37541,6 +37505,7 @@ so this becomes the fallback color for the slot */ ''}
37541
37505
  }
37542
37506
  return result;
37543
37507
  }
37508
+ forEachSet(f) { f(this); }
37544
37509
  }
37545
37510
  /**
37546
37511
  The empty set of decorations.
@@ -37616,6 +37581,10 @@ so this becomes the fallback color for the slot */ ''}
37616
37581
  members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));
37617
37582
  }
37618
37583
  }
37584
+ forEachSet(f) {
37585
+ for (let i = 0; i < this.members.length; i++)
37586
+ this.members[i].forEachSet(f);
37587
+ }
37619
37588
  }
37620
37589
  function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {
37621
37590
  let children = oldChildren.slice();
@@ -37982,6 +37951,9 @@ so this becomes the fallback color for the slot */ ''}
37982
37951
  this.queue.push(mut);
37983
37952
  return this.queue;
37984
37953
  }
37954
+ selectionChanged(sel) {
37955
+ return !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(this.view) && !this.ignoreSelectionChange(sel);
37956
+ }
37985
37957
  flush() {
37986
37958
  let { view } = this;
37987
37959
  if (!view.docView || this.flushingSoon > -1)
@@ -37989,8 +37961,7 @@ so this becomes the fallback color for the slot */ ''}
37989
37961
  let mutations = this.pendingRecords();
37990
37962
  if (mutations.length)
37991
37963
  this.queue = [];
37992
- let sel = view.domSelectionRange();
37993
- let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
37964
+ let sel = view.domSelectionRange(), newSel = this.selectionChanged(sel);
37994
37965
  let from = -1, to = -1, typeOver = false, added = [];
37995
37966
  if (view.editable) {
37996
37967
  for (let i = 0; i < mutations.length; i++) {
@@ -38278,6 +38249,8 @@ so this becomes the fallback color for the slot */ ''}
38278
38249
  }
38279
38250
  view.input.lastKeyCode = null;
38280
38251
  let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
38252
+ if (change)
38253
+ view.input.domChangeCount++;
38281
38254
  if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) &&
38282
38255
  addedNodes.some(n => n.nodeType == 1 && !isInline.test(n.nodeName)) &&
38283
38256
  (!change || change.endA >= change.endB) &&
@@ -38303,7 +38276,6 @@ so this becomes the fallback color for the slot */ ''}
38303
38276
  return;
38304
38277
  }
38305
38278
  }
38306
- view.input.domChangeCount++;
38307
38279
  // Handle the case where overwriting a selection by typing matches
38308
38280
  // the start or end of the selected content, creating a change
38309
38281
  // that's smaller than what was actually overwritten.
@@ -39026,6 +38998,8 @@ so this becomes the fallback color for the slot */ ''}
39026
38998
  */
39027
38999
  domSelectionRange() {
39028
39000
  let sel = this.domSelection();
39001
+ if (!sel)
39002
+ return { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
39029
39003
  return safari && this.root.nodeType === 11 &&
39030
39004
  deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
39031
39005
  }
@@ -39063,7 +39037,7 @@ so this becomes the fallback color for the slot */ ''}
39063
39037
  dom.className = "ProseMirror-separator";
39064
39038
  dom.setAttribute("mark-placeholder", "true");
39065
39039
  dom.setAttribute("alt", "");
39066
- view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.head, dom, { raw: true, marks: view.markCursor }) };
39040
+ view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.from, dom, { raw: true, marks: view.markCursor }) };
39067
39041
  }
39068
39042
  else {
39069
39043
  view.cursorWrapper = null;
@@ -40998,7 +40972,7 @@ so this becomes the fallback color for the slot */ ''}
40998
40972
 
40999
40973
  function findDuplicates(items) {
41000
40974
  const filtered = items.filter((el, index) => items.indexOf(el) !== index);
41001
- return [...new Set(filtered)];
40975
+ return Array.from(new Set(filtered));
41002
40976
  }
41003
40977
 
41004
40978
  class ExtensionManager {
@@ -41800,7 +41774,11 @@ so this becomes the fallback color for the slot */ ''}
41800
41774
  if (isArrayContent) {
41801
41775
  return Fragment.fromArray(content.map(item => schema.nodeFromJSON(item)));
41802
41776
  }
41803
- return schema.nodeFromJSON(content);
41777
+ const node = schema.nodeFromJSON(content);
41778
+ if (options.errorOnInvalidContent) {
41779
+ node.check();
41780
+ }
41781
+ return node;
41804
41782
  }
41805
41783
  catch (error) {
41806
41784
  if (options.errorOnInvalidContent) {
@@ -42561,7 +42539,7 @@ so this becomes the fallback color for the slot */ ''}
42561
42539
  .resolve(from)
42562
42540
  .marks()
42563
42541
  .forEach(mark => {
42564
- const $pos = doc.resolve(from - 1);
42542
+ const $pos = doc.resolve(from);
42565
42543
  const range = getMarkRange($pos, mark.type);
42566
42544
  if (!range) {
42567
42545
  return;
@@ -42703,31 +42681,40 @@ so this becomes the fallback color for the slot */ ''}
42703
42681
  }
42704
42682
 
42705
42683
  /**
42706
- * Returns true if the given node is empty.
42707
- * When `checkChildren` is true (default), it will also check if all children are empty.
42684
+ * Returns true if the given prosemirror node is empty.
42708
42685
  */
42709
- function isNodeEmpty(node, { checkChildren } = { checkChildren: true }) {
42686
+ function isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false, } = {}) {
42687
+ var _a;
42688
+ if (ignoreWhitespace) {
42689
+ if (node.type.name === 'hardBreak') {
42690
+ // Hard breaks are considered empty
42691
+ return true;
42692
+ }
42693
+ if (node.isText) {
42694
+ return /^\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : '');
42695
+ }
42696
+ }
42710
42697
  if (node.isText) {
42711
42698
  return !node.text;
42712
42699
  }
42700
+ if (node.isAtom || node.isLeaf) {
42701
+ return false;
42702
+ }
42713
42703
  if (node.content.childCount === 0) {
42714
42704
  return true;
42715
42705
  }
42716
- if (node.isLeaf) {
42717
- return false;
42718
- }
42719
42706
  if (checkChildren) {
42720
- let hasSameContent = true;
42707
+ let isContentEmpty = true;
42721
42708
  node.content.forEach(childNode => {
42722
- if (hasSameContent === false) {
42709
+ if (isContentEmpty === false) {
42723
42710
  // Exit early for perf
42724
42711
  return;
42725
42712
  }
42726
- if (!isNodeEmpty(childNode)) {
42727
- hasSameContent = false;
42713
+ if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {
42714
+ isContentEmpty = false;
42728
42715
  }
42729
42716
  });
42730
- return hasSameContent;
42717
+ return isContentEmpty;
42731
42718
  }
42732
42719
  return false;
42733
42720
  }
@@ -42940,7 +42927,7 @@ so this becomes the fallback color for the slot */ ''}
42940
42927
  return can;
42941
42928
  };
42942
42929
 
42943
- const splitListItem = typeOrName => ({ tr, state, dispatch, editor, }) => {
42930
+ const splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor, }) => {
42944
42931
  var _a;
42945
42932
  const type = getNodeType(typeOrName, state.schema);
42946
42933
  const { $from, $to } = state.selection;
@@ -42976,7 +42963,10 @@ so this becomes the fallback color for the slot */ ''}
42976
42963
  // eslint-disable-next-line
42977
42964
  const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
42978
42965
  // Add a second list item with an empty default start node
42979
- const newNextTypeAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
42966
+ const newNextTypeAttributes = {
42967
+ ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
42968
+ ...overrideAttrs,
42969
+ };
42980
42970
  const nextType = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes)) || undefined;
42981
42971
  wrap = wrap.append(Fragment.from(type.createAndFill(null, nextType) || undefined));
42982
42972
  const start = $from.before($from.depth - (depthBefore - 1));
@@ -42998,8 +42988,14 @@ so this becomes the fallback color for the slot */ ''}
42998
42988
  return true;
42999
42989
  }
43000
42990
  const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
43001
- const newTypeAttributes = getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs);
43002
- const newNextTypeAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
42991
+ const newTypeAttributes = {
42992
+ ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
42993
+ ...overrideAttrs,
42994
+ };
42995
+ const newNextTypeAttributes = {
42996
+ ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
42997
+ ...overrideAttrs,
42998
+ };
43003
42999
  tr.delete($from.pos, $to.pos);
43004
43000
  const types = nextType
43005
43001
  ? [
@@ -43725,8 +43721,8 @@ img.ProseMirror-separator {
43725
43721
  display: inline !important;
43726
43722
  border: none !important;
43727
43723
  margin: 0 !important;
43728
- width: 1px !important;
43729
- height: 1px !important;
43724
+ width: 0 !important;
43725
+ height: 0 !important;
43730
43726
  }
43731
43727
 
43732
43728
  .ProseMirror-gapcursor {
@@ -43791,6 +43787,10 @@ img.ProseMirror-separator {
43791
43787
  constructor(options = {}) {
43792
43788
  super();
43793
43789
  this.isFocused = false;
43790
+ /**
43791
+ * The editor is considered initialized after the `create` event has been emitted.
43792
+ */
43793
+ this.isInitialized = false;
43794
43794
  this.extensionStorage = {};
43795
43795
  this.options = {
43796
43796
  element: document.createElement('div'),
@@ -43841,6 +43841,7 @@ img.ProseMirror-separator {
43841
43841
  }
43842
43842
  this.commands.focus(this.options.autofocus);
43843
43843
  this.emit('create', { editor: this });
43844
+ this.isInitialized = true;
43844
43845
  }, 0);
43845
43846
  }
43846
43847
  /**
@@ -55326,6 +55327,7 @@ img.ProseMirror-separator {
55326
55327
  */
55327
55328
  const TextStyle$1 = Mark.create({
55328
55329
  name: 'textStyle',
55330
+ priority: 101,
55329
55331
  addOptions() {
55330
55332
  return {
55331
55333
  HTMLAttributes: {},
@@ -58110,10 +58112,20 @@ img.ProseMirror-separator {
58110
58112
  }
58111
58113
  // From DOMPurify
58112
58114
  // https://github.com/cure53/DOMPurify/blob/main/src/regexp.js
58113
- const ATTR_WHITESPACE = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g; // eslint-disable-line no-control-regex
58114
- const IS_ALLOWED_URI = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
58115
- function isAllowedUri(uri) {
58116
- return !uri || uri.replace(ATTR_WHITESPACE, '').match(IS_ALLOWED_URI);
58115
+ // eslint-disable-next-line no-control-regex
58116
+ const ATTR_WHITESPACE = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
58117
+ function isAllowedUri(uri, protocols) {
58118
+ const allowedProtocols = ['http', 'https', 'ftp', 'ftps', 'mailto', 'tel', 'callto', 'sms', 'cid', 'xmpp'];
58119
+ if (protocols) {
58120
+ protocols.forEach(protocol => {
58121
+ const nextProtocol = (typeof protocol === 'string' ? protocol : protocol.scheme);
58122
+ if (nextProtocol) {
58123
+ allowedProtocols.push(nextProtocol);
58124
+ }
58125
+ });
58126
+ }
58127
+ // eslint-disable-next-line no-useless-escape
58128
+ return !uri || uri.replace(ATTR_WHITESPACE, '').match(new RegExp(`^(?:(?:${allowedProtocols.join('|')}):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))`, 'i'));
58117
58129
  }
58118
58130
  /**
58119
58131
  * This extension allows you to create links.
@@ -58158,6 +58170,9 @@ img.ProseMirror-separator {
58158
58170
  return {
58159
58171
  href: {
58160
58172
  default: null,
58173
+ parseHTML(element) {
58174
+ return element.getAttribute('href');
58175
+ },
58161
58176
  },
58162
58177
  target: {
58163
58178
  default: this.options.HTMLAttributes.target,
@@ -58176,16 +58191,16 @@ img.ProseMirror-separator {
58176
58191
  getAttrs: dom => {
58177
58192
  const href = dom.getAttribute('href');
58178
58193
  // prevent XSS attacks
58179
- if (!href || !isAllowedUri(href)) {
58194
+ if (!href || !isAllowedUri(href, this.options.protocols)) {
58180
58195
  return false;
58181
58196
  }
58182
- return { href };
58197
+ return null;
58183
58198
  },
58184
58199
  }];
58185
58200
  },
58186
58201
  renderHTML({ HTMLAttributes }) {
58187
58202
  // prevent XSS attacks
58188
- if (!isAllowedUri(HTMLAttributes.href)) {
58203
+ if (!isAllowedUri(HTMLAttributes.href, this.options.protocols)) {
58189
58204
  // strip out the href
58190
58205
  return ['a', mergeAttributes(this.options.HTMLAttributes, { ...HTMLAttributes, href: '' }), 0];
58191
58206
  }
@@ -58368,9 +58383,9 @@ img.ProseMirror-separator {
58368
58383
  const started = !prev.active && next.active;
58369
58384
  const stopped = prev.active && !next.active;
58370
58385
  const changed = !started && !stopped && prev.query !== next.query;
58371
- const handleStart = started;
58386
+ const handleStart = started || (moved && changed);
58372
58387
  const handleChange = changed || moved;
58373
- const handleExit = stopped;
58388
+ const handleExit = stopped || (moved && changed);
58374
58389
  // Cancel when suggestion isn't active
58375
58390
  if (!handleStart && !handleChange && !handleExit) {
58376
58391
  return;
@@ -58744,6 +58759,7 @@ img.ProseMirror-separator {
58744
58759
  */
58745
58760
  const TextStyle = Mark.create({
58746
58761
  name: 'textStyle',
58762
+ priority: 101,
58747
58763
  addOptions() {
58748
58764
  return {
58749
58765
  HTMLAttributes: {},
@@ -58814,6 +58830,10 @@ img.ProseMirror-separator {
58814
58830
  : 1;
58815
58831
  },
58816
58832
  },
58833
+ type: {
58834
+ default: undefined,
58835
+ parseHTML: element => element.getAttribute('type'),
58836
+ },
58817
58837
  };
58818
58838
  },
58819
58839
  parseHTML() {
@@ -62051,7 +62071,7 @@ img.ProseMirror-separator {
62051
62071
  ...columnDef
62052
62072
  };
62053
62073
  const accessorKey = resolvedColumnDef.accessorKey;
62054
- let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace('.', '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
62074
+ let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
62055
62075
  let accessorFn;
62056
62076
  if (resolvedColumnDef.accessorFn) {
62057
62077
  accessorFn = resolvedColumnDef.accessorFn;
@@ -62460,8 +62480,8 @@ img.ProseMirror-separator {
62460
62480
  };
62461
62481
 
62462
62482
  const includesString = (row, columnId, filterValue) => {
62463
- var _row$getValue;
62464
- const search = filterValue.toLowerCase();
62483
+ var _filterValue$toString, _row$getValue;
62484
+ const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase();
62465
62485
  return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));
62466
62486
  };
62467
62487
  includesString.autoRemove = val => testFalsey(val);
@@ -67245,7 +67265,8 @@ focus outline in that case.
67245
67265
  instance.options.isScrollingResetDelay
67246
67266
  );
67247
67267
  const createHandler = (isScrolling) => () => {
67248
- offset = element[instance.options.horizontal ? "scrollLeft" : "scrollTop"];
67268
+ const { horizontal, isRtl } = instance.options;
67269
+ offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
67249
67270
  fallback();
67250
67271
  cb(offset, isScrolling);
67251
67272
  };
@@ -67356,20 +67377,36 @@ focus outline in that case.
67356
67377
  lanes: 1,
67357
67378
  isScrollingResetDelay: 150,
67358
67379
  enabled: true,
67380
+ isRtl: false,
67359
67381
  ...opts2
67360
67382
  };
67361
67383
  };
67362
- this.notify = (force, sync) => {
67384
+ this.notify = (sync) => {
67363
67385
  var _a, _b;
67364
- const { startIndex, endIndex } = this.range ?? {
67365
- startIndex: void 0,
67366
- endIndex: void 0
67367
- };
67368
- const range = this.calculateRange();
67369
- if (force || startIndex !== (range == null ? void 0 : range.startIndex) || endIndex !== (range == null ? void 0 : range.endIndex)) {
67370
- (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
67371
- }
67386
+ (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
67372
67387
  };
67388
+ this.maybeNotify = memo(
67389
+ () => {
67390
+ this.calculateRange();
67391
+ return [
67392
+ this.isScrolling,
67393
+ this.range ? this.range.startIndex : null,
67394
+ this.range ? this.range.endIndex : null
67395
+ ];
67396
+ },
67397
+ (isScrolling) => {
67398
+ this.notify(isScrolling);
67399
+ },
67400
+ {
67401
+ key: "maybeNotify",
67402
+ debug: () => this.options.debug,
67403
+ initialDeps: [
67404
+ this.isScrolling,
67405
+ this.range ? this.range.startIndex : null,
67406
+ this.range ? this.range.endIndex : null
67407
+ ]
67408
+ }
67409
+ );
67373
67410
  this.cleanup = () => {
67374
67411
  this.unsubs.filter(Boolean).forEach((d) => d());
67375
67412
  this.unsubs = [];
@@ -67389,7 +67426,7 @@ focus outline in that case.
67389
67426
  if (this.scrollElement !== scrollElement) {
67390
67427
  this.cleanup();
67391
67428
  if (!scrollElement) {
67392
- this.notify(false, false);
67429
+ this.maybeNotify();
67393
67430
  return;
67394
67431
  }
67395
67432
  this.scrollElement = scrollElement;
@@ -67405,7 +67442,7 @@ focus outline in that case.
67405
67442
  this.unsubs.push(
67406
67443
  this.options.observeElementRect(this, (rect) => {
67407
67444
  this.scrollRect = rect;
67408
- this.notify(false, false);
67445
+ this.maybeNotify();
67409
67446
  })
67410
67447
  );
67411
67448
  this.unsubs.push(
@@ -67413,9 +67450,8 @@ focus outline in that case.
67413
67450
  this.scrollAdjustments = 0;
67414
67451
  this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
67415
67452
  this.scrollOffset = offset;
67416
- const prevIsScrolling = this.isScrolling;
67417
67453
  this.isScrolling = isScrolling;
67418
- this.notify(prevIsScrolling !== isScrolling, isScrolling);
67454
+ this.maybeNotify();
67419
67455
  })
67420
67456
  );
67421
67457
  }
@@ -67488,7 +67524,6 @@ focus outline in that case.
67488
67524
  this.getMeasurements = memo(
67489
67525
  () => [this.getMeasurementOptions(), this.itemSizeCache],
67490
67526
  ({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
67491
- var _a;
67492
67527
  if (!enabled) {
67493
67528
  this.measurementsCache = [];
67494
67529
  this.itemSizeCache.clear();
@@ -67504,33 +67539,6 @@ focus outline in that case.
67504
67539
  this.pendingMeasuredCacheIndexes = [];
67505
67540
  const measurements = this.measurementsCache.slice(0, min);
67506
67541
  for (let i = min; i < count; i++) {
67507
- let measureElement2 = (_a = this.measurementsCache[i]) == null ? void 0 : _a.measureElement;
67508
- if (!measureElement2) {
67509
- measureElement2 = (node) => {
67510
- const key2 = getItemKey(i);
67511
- const prevNode = this.elementsCache.get(key2);
67512
- if (!node) {
67513
- if (prevNode) {
67514
- this.observer.unobserve(prevNode);
67515
- this.elementsCache.delete(key2);
67516
- }
67517
- return;
67518
- }
67519
- if (prevNode !== node) {
67520
- if (prevNode) {
67521
- this.observer.unobserve(prevNode);
67522
- }
67523
- this.observer.observe(node);
67524
- this.elementsCache.set(key2, node);
67525
- }
67526
- if (node.isConnected) {
67527
- this.resizeItem(
67528
- i,
67529
- this.options.measureElement(node, void 0, this)
67530
- );
67531
- }
67532
- };
67533
- }
67534
67542
  const key = getItemKey(i);
67535
67543
  const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
67536
67544
  const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
@@ -67544,8 +67552,7 @@ focus outline in that case.
67544
67552
  size,
67545
67553
  end,
67546
67554
  key,
67547
- lane,
67548
- measureElement: measureElement2
67555
+ lane
67549
67556
  };
67550
67557
  }
67551
67558
  this.measurementsCache = measurements;
@@ -67602,29 +67609,26 @@ focus outline in that case.
67602
67609
  return parseInt(indexStr, 10);
67603
67610
  };
67604
67611
  this._measureElement = (node, entry) => {
67605
- const i = this.indexFromElement(node);
67606
- const item = this.getMeasurements()[i];
67607
- if (!item || !node.isConnected) {
67608
- this.elementsCache.forEach((cached, key) => {
67609
- if (cached === node) {
67610
- this.observer.unobserve(node);
67611
- this.elementsCache.delete(key);
67612
- }
67613
- });
67612
+ const index = this.indexFromElement(node);
67613
+ const item = this.measurementsCache[index];
67614
+ if (!item) {
67614
67615
  return;
67615
67616
  }
67616
- const prevNode = this.elementsCache.get(item.key);
67617
+ const key = item.key;
67618
+ const prevNode = this.elementsCache.get(key);
67617
67619
  if (prevNode !== node) {
67618
67620
  if (prevNode) {
67619
67621
  this.observer.unobserve(prevNode);
67620
67622
  }
67621
67623
  this.observer.observe(node);
67622
- this.elementsCache.set(item.key, node);
67624
+ this.elementsCache.set(key, node);
67625
+ }
67626
+ if (node.isConnected) {
67627
+ this.resizeItem(index, this.options.measureElement(node, entry, this));
67623
67628
  }
67624
- this.resizeItem(i, this.options.measureElement(node, entry, this));
67625
67629
  };
67626
67630
  this.resizeItem = (index, size) => {
67627
- const item = this.getMeasurements()[index];
67631
+ const item = this.measurementsCache[index];
67628
67632
  if (!item) {
67629
67633
  return;
67630
67634
  }
@@ -67642,11 +67646,17 @@ focus outline in that case.
67642
67646
  }
67643
67647
  this.pendingMeasuredCacheIndexes.push(item.index);
67644
67648
  this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
67645
- this.notify(true, false);
67649
+ this.notify(false);
67646
67650
  }
67647
67651
  };
67648
67652
  this.measureElement = (node) => {
67649
67653
  if (!node) {
67654
+ this.elementsCache.forEach((cached, key) => {
67655
+ if (!cached.isConnected) {
67656
+ this.observer.unobserve(cached);
67657
+ this.elementsCache.delete(key);
67658
+ }
67659
+ });
67650
67660
  return;
67651
67661
  }
67652
67662
  this._measureElement(node, void 0);
@@ -67663,7 +67673,7 @@ focus outline in that case.
67663
67673
  return virtualItems;
67664
67674
  },
67665
67675
  {
67666
- key: "getIndexes",
67676
+ key: "getVirtualItems",
67667
67677
  debug: () => this.options.debug
67668
67678
  }
67669
67679
  );
@@ -67707,7 +67717,7 @@ focus outline in that case.
67707
67717
  };
67708
67718
  this.getOffsetForIndex = (index, align = "auto") => {
67709
67719
  index = Math.max(0, Math.min(index, this.options.count - 1));
67710
- const item = this.getMeasurements()[index];
67720
+ const item = this.measurementsCache[index];
67711
67721
  if (!item) {
67712
67722
  return void 0;
67713
67723
  }
@@ -67807,9 +67817,8 @@ focus outline in that case.
67807
67817
  this.options.scrollToFn(offset, { behavior, adjustments }, this);
67808
67818
  };
67809
67819
  this.measure = () => {
67810
- var _a, _b;
67811
67820
  this.itemSizeCache = /* @__PURE__ */ new Map();
67812
- (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, false);
67821
+ this.notify(false);
67813
67822
  };
67814
67823
  this.setOptions(opts);
67815
67824
  }