@bagelink/vue 0.0.518 → 0.0.522

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.
package/dist/index.cjs CHANGED
@@ -112,21 +112,12 @@ function getPaddingObject(padding) {
112
112
  };
113
113
  }
114
114
  function rectToClientRect$1(rect) {
115
- const {
116
- x: x2,
117
- y: y2,
118
- width,
119
- height
120
- } = rect;
121
115
  return {
122
- width,
123
- height,
124
- top: y2,
125
- left: x2,
126
- right: x2 + width,
127
- bottom: y2 + height,
128
- x: x2,
129
- y: y2
116
+ ...rect,
117
+ top: rect.y,
118
+ left: rect.x,
119
+ right: rect.x + rect.width,
120
+ bottom: rect.y + rect.height
130
121
  };
131
122
  }
132
123
  function computeCoordsFromPlacement(_ref, placement, rtl) {
@@ -297,10 +288,9 @@ async function detectOverflow$1(state2, options) {
297
288
  strategy
298
289
  }));
299
290
  const rect = elementContext === "floating" ? {
291
+ ...rects.floating,
300
292
  x: x2,
301
- y: y2,
302
- width: rects.floating.width,
303
- height: rects.floating.height
293
+ y: y2
304
294
  } : rects.reference;
305
295
  const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
306
296
  const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
@@ -747,16 +737,16 @@ const size = function(options) {
747
737
  widthSide = side;
748
738
  heightSide = alignment === "end" ? "top" : "bottom";
749
739
  }
750
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
751
- const maximumClippingWidth = width - overflow.left - overflow.right;
752
- const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
753
- const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
740
+ const overflowAvailableHeight = height - overflow[heightSide];
741
+ const overflowAvailableWidth = width - overflow[widthSide];
754
742
  const noShift = !state2.middlewareData.shift;
755
743
  let availableHeight = overflowAvailableHeight;
756
744
  let availableWidth = overflowAvailableWidth;
757
745
  if (isYAxis) {
746
+ const maximumClippingWidth = width - overflow.left - overflow.right;
758
747
  availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
759
748
  } else {
749
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
760
750
  availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
761
751
  }
762
752
  if (noShift && !alignment) {
@@ -5130,6 +5120,7 @@ function txtField(id, label, options) {
5130
5120
  required: options == null ? void 0 : options.required,
5131
5121
  id,
5132
5122
  label,
5123
+ disabled: options == null ? void 0 : options.disabled,
5133
5124
  placeholder: options == null ? void 0 : options.placeholder,
5134
5125
  defaultValue: options == null ? void 0 : options.defaultValue,
5135
5126
  attrs: {
@@ -5165,6 +5156,20 @@ function checkField(id, label, options) {
5165
5156
  label
5166
5157
  };
5167
5158
  }
5159
+ function dateField(id, label, options) {
5160
+ return {
5161
+ $el: "date",
5162
+ class: options == null ? void 0 : options.class,
5163
+ required: options == null ? void 0 : options.required,
5164
+ id,
5165
+ disabled: options == null ? void 0 : options.disabled,
5166
+ label,
5167
+ defaultValue: options == null ? void 0 : options.defaultValue,
5168
+ attrs: {
5169
+ disabled: options == null ? void 0 : options.disabled
5170
+ }
5171
+ };
5172
+ }
5168
5173
  function numField(id, label, options) {
5169
5174
  return {
5170
5175
  $el: "text",
@@ -5173,6 +5178,7 @@ function numField(id, label, options) {
5173
5178
  defaultValue: options == null ? void 0 : options.defaultValue,
5174
5179
  id,
5175
5180
  label,
5181
+ disabled: options == null ? void 0 : options.disabled,
5176
5182
  placeholder: options == null ? void 0 : options.placeholder,
5177
5183
  helptext: options == null ? void 0 : options.helptext,
5178
5184
  attrs: {
@@ -5195,6 +5201,7 @@ function frmRow(...children2) {
5195
5201
  const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5196
5202
  __proto__: null,
5197
5203
  checkField,
5204
+ dateField,
5198
5205
  frmRow,
5199
5206
  numField,
5200
5207
  richText,
@@ -5900,7 +5907,7 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
5900
5907
  });
5901
5908
  const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-b862dfb8"]]);
5902
5909
  const _sfc_main$G = {};
5903
- const _hoisted_1$D = { class: "list-wrap bgl_card thin grid overflow-hidden h-100 p-0" };
5910
+ const _hoisted_1$D = { class: "list-wrap bgl_card thin grid overflow-hidden h-100 pt-0 pb-05 px-0" };
5904
5911
  const _hoisted_2$u = { class: "p-1" };
5905
5912
  const _hoisted_3$k = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
5906
5913
  function _sfc_render$2(_ctx, _cache) {
@@ -5914,7 +5921,7 @@ function _sfc_render$2(_ctx, _cache) {
5914
5921
  ]);
5915
5922
  }
5916
5923
  const ListView = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$2]]);
5917
- const _hoisted_1$C = { class: "no-margin ellipsis line-height-14" };
5924
+ const _hoisted_1$C = { class: "no-margin ellipsis line-height-14 pb-025" };
5918
5925
  const _hoisted_2$t = { class: "txt12 no-margin txt-gray ellipsis" };
5919
5926
  const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5920
5927
  __name: "ListItem",
@@ -6145,7 +6152,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
6145
6152
  };
6146
6153
  }
6147
6154
  });
6148
- const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-fd12de23"]]);
6155
+ const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-8113163b"]]);
6149
6156
  const _sfc_main$C = {};
6150
6157
  const _hoisted_1$z = { class: "flex space-between" };
6151
6158
  function _sfc_render$1(_ctx, _cache) {
@@ -6681,17 +6688,23 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
6681
6688
  ], 34),
6682
6689
  vue.createElementVNode("div", _hoisted_2$n, [
6683
6690
  vue.createElementVNode("span", { onClick: prev }, [
6684
- vue.renderSlot(_ctx.$slots, "prev", { index: vue.unref(activeSlideIndex) }, void 0, true)
6691
+ vue.renderSlot(_ctx.$slots, "prev", {
6692
+ index: vue.unref(activeSlideIndex),
6693
+ prev
6694
+ }, void 0, true)
6685
6695
  ]),
6686
6696
  vue.createElementVNode("span", { onClick: next }, [
6687
- vue.renderSlot(_ctx.$slots, "next", { index: vue.unref(activeSlideIndex) }, void 0, true)
6697
+ vue.renderSlot(_ctx.$slots, "next", {
6698
+ index: vue.unref(activeSlideIndex),
6699
+ next
6700
+ }, void 0, true)
6688
6701
  ])
6689
6702
  ])
6690
6703
  ], 6);
6691
6704
  };
6692
6705
  }
6693
6706
  });
6694
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-da91fb96"]]);
6707
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-f21373a1"]]);
6695
6708
  const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
6696
6709
  __name: "ModalConfirm",
6697
6710
  props: {
@@ -30757,7 +30770,7 @@ let NodeType$1 = class NodeType2 {
30757
30770
  }
30758
30771
  /**
30759
30772
  Returns true if the given fragment is valid content for this node
30760
- type.
30773
+ type with the given attributes.
30761
30774
  */
30762
30775
  validContent(content) {
30763
30776
  let result2 = this.contentMatch.matchFragment(content);
@@ -30901,7 +30914,6 @@ class Schema {
30901
30914
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
30902
30915
  */
30903
30916
  constructor(spec) {
30904
- this.linebreakReplacement = null;
30905
30917
  this.cached = /* @__PURE__ */ Object.create(null);
30906
30918
  let instanceSpec = this.spec = {};
30907
30919
  for (let prop3 in spec)
@@ -30915,13 +30927,6 @@ class Schema {
30915
30927
  let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
30916
30928
  type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
30917
30929
  type3.inlineContent = type3.contentMatch.inlineContent;
30918
- if (type3.spec.linebreakReplacement) {
30919
- if (this.linebreakReplacement)
30920
- throw new RangeError("Multiple linebreak nodes defined");
30921
- if (!type3.isInline || !type3.isLeaf)
30922
- throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
30923
- this.linebreakReplacement = type3;
30924
- }
30925
30930
  type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
30926
30931
  }
30927
30932
  for (let prop3 in this.marks) {
@@ -31006,12 +31011,6 @@ function gatherMarks(schema, marks) {
31006
31011
  }
31007
31012
  return found2;
31008
31013
  }
31009
- function isTagRule(rule) {
31010
- return rule.tag != null;
31011
- }
31012
- function isStyleRule(rule) {
31013
- return rule.style != null;
31014
- }
31015
31014
  class DOMParser {
31016
31015
  /**
31017
31016
  Create a parser that targets the given schema, using the given
@@ -31023,9 +31022,9 @@ class DOMParser {
31023
31022
  this.tags = [];
31024
31023
  this.styles = [];
31025
31024
  rules.forEach((rule) => {
31026
- if (isTagRule(rule))
31025
+ if (rule.tag)
31027
31026
  this.tags.push(rule);
31028
- else if (isStyleRule(rule))
31027
+ else if (rule.style)
31029
31028
  this.styles.push(rule);
31030
31029
  });
31031
31030
  this.normalizeLists = !this.tags.some((r2) => {
@@ -31286,10 +31285,10 @@ class ParseContext {
31286
31285
  this.addElement(dom);
31287
31286
  }
31288
31287
  withStyleRules(dom, f2) {
31289
- let style2 = dom.style;
31290
- if (!style2 || !style2.length)
31288
+ let style2 = dom.getAttribute("style");
31289
+ if (!style2)
31291
31290
  return f2();
31292
- let marks = this.readStyles(dom.style);
31291
+ let marks = this.readStyles(parseStyles(style2));
31293
31292
  if (!marks)
31294
31293
  return;
31295
31294
  let [addMarks, removeMarks] = marks, top2 = this.top;
@@ -31383,10 +31382,9 @@ class ParseContext {
31383
31382
  // had a rule with `ignore` set.
31384
31383
  readStyles(styles) {
31385
31384
  let add2 = Mark$1.none, remove2 = Mark$1.none;
31386
- for (let i2 = 0, l2 = styles.length; i2 < l2; i2++) {
31387
- let name = styles.item(i2);
31385
+ for (let i2 = 0; i2 < styles.length; i2 += 2) {
31388
31386
  for (let after = void 0; ; ) {
31389
- let rule = this.parser.matchStyle(name, styles.getPropertyValue(name), this, after);
31387
+ let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after);
31390
31388
  if (!rule)
31391
31389
  break;
31392
31390
  if (rule.ignore)
@@ -31673,6 +31671,12 @@ function normalizeList(dom) {
31673
31671
  function matches(dom, selector2) {
31674
31672
  return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
31675
31673
  }
31674
+ function parseStyles(style2) {
31675
+ let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
31676
+ while (m2 = re2.exec(style2))
31677
+ result2.push(m2[1], m2[2].trim());
31678
+ return result2;
31679
+ }
31676
31680
  function copy$2(obj) {
31677
31681
  let copy2 = {};
31678
31682
  for (let prop3 in obj)
@@ -32540,8 +32544,7 @@ class ReplaceAroundStep extends Step$1 {
32540
32544
  }
32541
32545
  map(mapping) {
32542
32546
  let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
32543
- let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
32544
- let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
32547
+ let gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);
32545
32548
  if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
32546
32549
  return null;
32547
32550
  return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
@@ -32654,7 +32657,7 @@ function removeMark(tr2, from2, to2, mark) {
32654
32657
  });
32655
32658
  matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
32656
32659
  }
32657
- function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
32660
+ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
32658
32661
  let node = tr2.doc.nodeAt(pos);
32659
32662
  let replSteps = [], cur = pos + 1;
32660
32663
  for (let i2 = 0; i2 < node.childCount; i2++) {
@@ -32667,7 +32670,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
32667
32670
  for (let j = 0; j < child.marks.length; j++)
32668
32671
  if (!parentType.allowsMarkType(child.marks[j].type))
32669
32672
  tr2.step(new RemoveMarkStep(cur, end2, child.marks[j]));
32670
- if (clearNewlines && child.isText && parentType.whitespace != "pre") {
32673
+ if (child.isText && !parentType.spec.code) {
32671
32674
  let m2, newline = /\r?\n|\r/g, slice4;
32672
32675
  while (m2 = newline.exec(child.text)) {
32673
32676
  if (!slice4)
@@ -32776,45 +32779,14 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
32776
32779
  let mapFrom = tr2.steps.length;
32777
32780
  tr2.doc.nodesBetween(from2, to2, (node, pos) => {
32778
32781
  if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
32779
- let convertNewlines = null;
32780
- if (type3.schema.linebreakReplacement) {
32781
- let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
32782
- if (pre && !supportLinebreak)
32783
- convertNewlines = false;
32784
- else if (!pre && supportLinebreak)
32785
- convertNewlines = true;
32786
- }
32787
- if (convertNewlines === false)
32788
- replaceLinebreaks(tr2, node, pos, mapFrom);
32789
- clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
32782
+ tr2.clearIncompatible(tr2.mapping.slice(mapFrom).map(pos, 1), type3);
32790
32783
  let mapping = tr2.mapping.slice(mapFrom);
32791
32784
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
32792
32785
  tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
32793
- if (convertNewlines === true)
32794
- replaceNewlines(tr2, node, pos, mapFrom);
32795
32786
  return false;
32796
32787
  }
32797
32788
  });
32798
32789
  }
32799
- function replaceNewlines(tr2, node, pos, mapFrom) {
32800
- node.forEach((child, offset2) => {
32801
- if (child.isText) {
32802
- let m2, newline = /\r?\n|\r/g;
32803
- while (m2 = newline.exec(child.text)) {
32804
- let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
32805
- tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
32806
- }
32807
- }
32808
- });
32809
- }
32810
- function replaceLinebreaks(tr2, node, pos, mapFrom) {
32811
- node.forEach((child, offset2) => {
32812
- if (child.type == child.type.schema.linebreakReplacement) {
32813
- let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
32814
- tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
32815
- }
32816
- });
32817
- }
32818
32790
  function canChangeType(doc2, pos, type3) {
32819
32791
  let $pos = doc2.resolve(pos), index2 = $pos.index();
32820
32792
  return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
@@ -34580,9 +34552,6 @@ const textRange = function(node, from2, to2) {
34580
34552
  range2.setStart(node, from2 || 0);
34581
34553
  return range2;
34582
34554
  };
34583
- const clearReusedRange = function() {
34584
- reusedRange = null;
34585
- };
34586
34555
  const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
34587
34556
  return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
34588
34557
  };
@@ -34610,40 +34579,6 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
34610
34579
  function nodeSize(node) {
34611
34580
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
34612
34581
  }
34613
- function textNodeBefore$1(node, offset2) {
34614
- for (; ; ) {
34615
- if (node.nodeType == 3 && offset2)
34616
- return node;
34617
- if (node.nodeType == 1 && offset2 > 0) {
34618
- if (node.contentEditable == "false")
34619
- return null;
34620
- node = node.childNodes[offset2 - 1];
34621
- offset2 = nodeSize(node);
34622
- } else if (node.parentNode && !hasBlockDesc(node)) {
34623
- offset2 = domIndex(node);
34624
- node = node.parentNode;
34625
- } else {
34626
- return null;
34627
- }
34628
- }
34629
- }
34630
- function textNodeAfter$1(node, offset2) {
34631
- for (; ; ) {
34632
- if (node.nodeType == 3 && offset2 < node.nodeValue.length)
34633
- return node;
34634
- if (node.nodeType == 1 && offset2 < node.childNodes.length) {
34635
- if (node.contentEditable == "false")
34636
- return null;
34637
- node = node.childNodes[offset2];
34638
- offset2 = 0;
34639
- } else if (node.parentNode && !hasBlockDesc(node)) {
34640
- offset2 = domIndex(node) + 1;
34641
- node = node.parentNode;
34642
- } else {
34643
- return null;
34644
- }
34645
- }
34646
- }
34647
34582
  function isOnEdge(node, offset2, parent) {
34648
34583
  for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
34649
34584
  if (node == parent)
@@ -34715,14 +34650,6 @@ const android = /Android \d/.test(agent);
34715
34650
  const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
34716
34651
  const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
34717
34652
  function windowRect(doc2) {
34718
- let vp = doc2.defaultView && doc2.defaultView.visualViewport;
34719
- if (vp)
34720
- return {
34721
- left: 0,
34722
- right: vp.width,
34723
- top: 0,
34724
- bottom: vp.height
34725
- };
34726
34653
  return {
34727
34654
  left: 0,
34728
34655
  right: doc2.documentElement.clientWidth,
@@ -34924,14 +34851,14 @@ function posFromCaret(view, node, offset2, coords) {
34924
34851
  let desc = view.docView.nearestDesc(cur, true);
34925
34852
  if (!desc)
34926
34853
  return null;
34927
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
34854
+ if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) {
34928
34855
  let rect = desc.dom.getBoundingClientRect();
34929
- if (desc.node.isBlock && desc.parent) {
34930
- if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
34856
+ if (desc.node.isBlock && desc.parent && !sawBlock) {
34857
+ sawBlock = true;
34858
+ if (rect.left > coords.left || rect.top > coords.top)
34931
34859
  outsideBlock = desc.posBefore;
34932
- else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
34860
+ else if (rect.right < coords.left || rect.bottom < coords.top)
34933
34861
  outsideBlock = desc.posAfter;
34934
- sawBlock = true;
34935
34862
  }
34936
34863
  if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
34937
34864
  let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
@@ -35546,9 +35473,6 @@ class ViewDesc {
35546
35473
  get ignoreForCoords() {
35547
35474
  return false;
35548
35475
  }
35549
- isText(text) {
35550
- return false;
35551
- }
35552
35476
  }
35553
35477
  class WidgetViewDesc extends ViewDesc {
35554
35478
  constructor(parent, widget, view, pos) {
@@ -35787,7 +35711,8 @@ class NodeViewDesc extends ViewDesc {
35787
35711
  let { from: from2, to: to2 } = view.state.selection;
35788
35712
  if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
35789
35713
  return null;
35790
- let textNode = view.input.compositionNode;
35714
+ let sel = view.domSelectionRange();
35715
+ let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
35791
35716
  if (!textNode || !this.dom.contains(textNode.parentNode))
35792
35717
  return null;
35793
35718
  if (this.node.inlineContent) {
@@ -35853,11 +35778,10 @@ class NodeViewDesc extends ViewDesc {
35853
35778
  }
35854
35779
  // Remove selected node marking from this node.
35855
35780
  deselectNode() {
35856
- if (this.nodeDOM.nodeType == 1) {
35781
+ if (this.nodeDOM.nodeType == 1)
35857
35782
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
35858
- if (this.contentDOM || !this.node.type.spec.draggable)
35859
- this.dom.removeAttribute("draggable");
35860
- }
35783
+ if (this.contentDOM || !this.node.type.spec.draggable)
35784
+ this.dom.removeAttribute("draggable");
35861
35785
  }
35862
35786
  get domAtom() {
35863
35787
  return this.node.isAtom;
@@ -35923,9 +35847,6 @@ class TextViewDesc extends NodeViewDesc {
35923
35847
  get domAtom() {
35924
35848
  return false;
35925
35849
  }
35926
- isText(text) {
35927
- return this.node.text == text;
35928
- }
35929
35850
  }
35930
35851
  class TrailingHackViewDesc extends ViewDesc {
35931
35852
  parseRule() {
@@ -36441,6 +36362,23 @@ function iosHacks(dom) {
36441
36362
  dom.style.cssText = oldCSS;
36442
36363
  }
36443
36364
  }
36365
+ function nearbyTextNode(node, offset2) {
36366
+ for (; ; ) {
36367
+ if (node.nodeType == 3)
36368
+ return node;
36369
+ if (node.nodeType == 1 && offset2 > 0) {
36370
+ if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
36371
+ return node.childNodes[offset2];
36372
+ node = node.childNodes[offset2 - 1];
36373
+ offset2 = nodeSize(node);
36374
+ } else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
36375
+ node = node.childNodes[offset2];
36376
+ offset2 = 0;
36377
+ } else {
36378
+ return null;
36379
+ }
36380
+ }
36381
+ }
36444
36382
  function findTextInFragment(frag, text, from2, to2) {
36445
36383
  for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
36446
36384
  let child = frag.child(i2++), childStart = pos;
@@ -37015,7 +36953,7 @@ function serializeForClipboard(view, slice4) {
37015
36953
  if (firstChild && firstChild.nodeType == 1)
37016
36954
  firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
37017
36955
  let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
37018
- return { dom: wrap2, text, slice: slice4 };
36956
+ return { dom: wrap2, text };
37019
36957
  }
37020
36958
  function parseFromClipboard(view, text, html, plainText, $context) {
37021
36959
  let inCode = $context.parent.type.spec.code;
@@ -37235,7 +37173,6 @@ class InputState {
37235
37173
  this.lastTouch = 0;
37236
37174
  this.lastAndroidDelete = 0;
37237
37175
  this.composing = false;
37238
- this.compositionNode = null;
37239
37176
  this.composingTimeout = -1;
37240
37177
  this.compositionNodes = [];
37241
37178
  this.compositionEndedAt = -2e8;
@@ -37484,7 +37421,7 @@ class MouseDown {
37484
37421
  }
37485
37422
  const target = flushed ? null : event.target;
37486
37423
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
37487
- this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
37424
+ this.target = targetDesc ? targetDesc.dom : null;
37488
37425
  let { selection } = view.state;
37489
37426
  if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
37490
37427
  this.mightDrag = {
@@ -37616,7 +37553,6 @@ editHandlers.compositionend = (view, event) => {
37616
37553
  view.input.composing = false;
37617
37554
  view.input.compositionEndedAt = event.timeStamp;
37618
37555
  view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
37619
- view.input.compositionNode = null;
37620
37556
  if (view.input.compositionPendingChanges)
37621
37557
  Promise.resolve().then(() => view.domObserver.flush());
37622
37558
  view.input.compositionID++;
@@ -37636,24 +37572,6 @@ function clearComposition(view) {
37636
37572
  while (view.input.compositionNodes.length > 0)
37637
37573
  view.input.compositionNodes.pop().markParentsDirty();
37638
37574
  }
37639
- function findCompositionNode(view) {
37640
- let sel = view.domSelectionRange();
37641
- if (!sel.focusNode)
37642
- return null;
37643
- let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
37644
- let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
37645
- if (textBefore && textAfter && textBefore != textAfter) {
37646
- let descAfter = textAfter.pmViewDesc;
37647
- if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
37648
- return textAfter;
37649
- } else if (view.input.compositionNode == textAfter) {
37650
- let descBefore = textBefore.pmViewDesc;
37651
- if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
37652
- return textAfter;
37653
- }
37654
- }
37655
- return textBefore || textAfter;
37656
- }
37657
37575
  function timestampFromCustomEvent() {
37658
37576
  let event = document.createEvent("Event");
37659
37577
  event.initEvent("event", true, true);
@@ -37788,8 +37706,7 @@ handlers.dragstart = (view, _event) => {
37788
37706
  if (desc && desc.node.type.spec.draggable && desc != view.docView)
37789
37707
  node = NodeSelection.create(view.state.doc, desc.posBefore);
37790
37708
  }
37791
- let draggedSlice = (node || view.state.selection).content();
37792
- let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
37709
+ let slice4 = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice4);
37793
37710
  event.dataTransfer.clearData();
37794
37711
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
37795
37712
  event.dataTransfer.effectAllowed = "copyMove";
@@ -38209,6 +38126,9 @@ class DecorationSet {
38209
38126
  return this;
38210
38127
  return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
38211
38128
  }
38129
+ /**
38130
+ @internal
38131
+ */
38212
38132
  forChild(offset2, node) {
38213
38133
  if (this == empty$1)
38214
38134
  return this;
@@ -38687,21 +38607,14 @@ class DOMObserver {
38687
38607
  }
38688
38608
  }
38689
38609
  }
38690
- if (gecko && added.length) {
38610
+ if (gecko && added.length > 1) {
38691
38611
  let brs = added.filter((n2) => n2.nodeName == "BR");
38692
38612
  if (brs.length == 2) {
38693
- let [a2, b2] = brs;
38613
+ let a2 = brs[0], b2 = brs[1];
38694
38614
  if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
38695
38615
  b2.remove();
38696
38616
  else
38697
38617
  a2.remove();
38698
- } else {
38699
- let { focusNode } = this.currentSelection;
38700
- for (let br2 of brs) {
38701
- let parent = br2.parentNode;
38702
- if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
38703
- br2.remove();
38704
- }
38705
38618
  }
38706
38619
  }
38707
38620
  let readSel = null;
@@ -38781,20 +38694,7 @@ function checkCSS(view) {
38781
38694
  cssCheckWarned = true;
38782
38695
  }
38783
38696
  }
38784
- function rangeToSelectionRange(view, range2) {
38785
- let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
38786
- let focusNode = range2.endContainer, focusOffset = range2.endOffset;
38787
- let currentAnchor = view.domAtPos(view.state.selection.anchor);
38788
- if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
38789
- [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
38790
- return { anchorNode, anchorOffset, focusNode, focusOffset };
38791
- }
38792
- function safariShadowSelectionRange(view, selection) {
38793
- if (selection.getComposedRanges) {
38794
- let range2 = selection.getComposedRanges(view.root)[0];
38795
- if (range2)
38796
- return rangeToSelectionRange(view, range2);
38797
- }
38697
+ function safariShadowSelectionRange(view) {
38798
38698
  let found2;
38799
38699
  function read2(event) {
38800
38700
  event.preventDefault();
@@ -38804,15 +38704,12 @@ function safariShadowSelectionRange(view, selection) {
38804
38704
  view.dom.addEventListener("beforeinput", read2, true);
38805
38705
  document.execCommand("indent");
38806
38706
  view.dom.removeEventListener("beforeinput", read2, true);
38807
- return found2 ? rangeToSelectionRange(view, found2) : null;
38808
- }
38809
- function blockParent(view, node) {
38810
- for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
38811
- let desc = view.docView.nearestDesc(p2, true);
38812
- if (desc && desc.node.isBlock)
38813
- return p2;
38814
- }
38815
- return null;
38707
+ let anchorNode = found2.startContainer, anchorOffset = found2.startOffset;
38708
+ let focusNode = found2.endContainer, focusOffset = found2.endOffset;
38709
+ let currentAnchor = view.domAtPos(view.state.selection.anchor);
38710
+ if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
38711
+ [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
38712
+ return { anchorNode, anchorOffset, focusNode, focusOffset };
38816
38713
  }
38817
38714
  function parseBetween(view, from_, to_) {
38818
38715
  let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
@@ -38932,6 +38829,10 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
38932
38829
  return;
38933
38830
  }
38934
38831
  }
38832
+ if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
38833
+ let size2 = change.endB - change.start;
38834
+ parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
38835
+ }
38935
38836
  view.input.domChangeCount++;
38936
38837
  if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
38937
38838
  if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
@@ -38955,7 +38856,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
38955
38856
  view.input.lastIOSEnter = 0;
38956
38857
  return;
38957
38858
  }
38958
- if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
38859
+ if (view.state.selection.anchor > change.start && looksLikeJoin(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
38959
38860
  if (android && chrome)
38960
38861
  view.domObserver.suppressSelectionUpdates();
38961
38862
  return;
@@ -39039,18 +38940,12 @@ function isMarkChange(cur, prev) {
39039
38940
  if (Fragment.from(updated).eq(cur))
39040
38941
  return { mark, type: type3 };
39041
38942
  }
39042
- function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
39043
- if (
39044
- // The content must have shrunk
39045
- end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39046
- skipClosingAndOpening($newStart, true, false) < $newEnd.pos
39047
- )
38943
+ function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
38944
+ if (!$newStart.parent.isTextblock || // The content must have shrunk
38945
+ end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
38946
+ skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
39048
38947
  return false;
39049
38948
  let $start = old.resolve(start2);
39050
- if (!$newStart.parent.isTextblock) {
39051
- let after = $start.nodeAfter;
39052
- return after != null && end2 == start2 + after.nodeSize;
39053
- }
39054
38949
  if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
39055
38950
  return false;
39056
38951
  let $next = old.resolve(skipClosingAndOpening($start, true, true));
@@ -39239,10 +39134,8 @@ class EditorView {
39239
39134
  let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
39240
39135
  if (updateDoc) {
39241
39136
  let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
39242
- if (this.composing)
39243
- this.input.compositionNode = findCompositionNode(this);
39244
39137
  if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
39245
- this.docView.updateOuterDeco(outerDeco);
39138
+ this.docView.updateOuterDeco([]);
39246
39139
  this.docView.destroy();
39247
39140
  this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
39248
39141
  }
@@ -39501,7 +39394,6 @@ class EditorView {
39501
39394
  }
39502
39395
  this.docView.destroy();
39503
39396
  this.docView = null;
39504
- clearReusedRange();
39505
39397
  }
39506
39398
  /**
39507
39399
  This is true when the view has been
@@ -39537,8 +39429,7 @@ class EditorView {
39537
39429
  @internal
39538
39430
  */
39539
39431
  domSelectionRange() {
39540
- let sel = this.domSelection();
39541
- return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
39432
+ return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom ? safariShadowSelectionRange(this) : this.domSelection();
39542
39433
  }
39543
39434
  /**
39544
39435
  @internal
@@ -45501,16 +45392,16 @@ function mapRanges(ranges, mapping) {
45501
45392
  }
45502
45393
  return result2;
45503
45394
  }
45504
- function histTransaction(history2, state2, redo2) {
45395
+ function histTransaction(history2, state2, dispatch, redo2) {
45505
45396
  let preserveItems = mustPreserveItems(state2);
45506
45397
  let histOptions = historyKey.get(state2).spec.config;
45507
45398
  let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
45508
45399
  if (!pop)
45509
- return null;
45400
+ return;
45510
45401
  let selection = pop.selection.resolve(pop.transform.doc);
45511
45402
  let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
45512
45403
  let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
45513
- return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
45404
+ dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist }).scrollIntoView());
45514
45405
  }
45515
45406
  let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
45516
45407
  function mustPreserveItems(state2) {
@@ -45558,21 +45449,22 @@ function history(config = {}) {
45558
45449
  }
45559
45450
  });
45560
45451
  }
45561
- function buildCommand(redo2, scroll) {
45562
- return (state2, dispatch) => {
45563
- let hist = historyKey.getState(state2);
45564
- if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
45565
- return false;
45566
- if (dispatch) {
45567
- let tr2 = histTransaction(hist, state2, redo2);
45568
- if (tr2)
45569
- dispatch(scroll ? tr2.scrollIntoView() : tr2);
45570
- }
45571
- return true;
45572
- };
45573
- }
45574
- const undo = buildCommand(false, true);
45575
- const redo = buildCommand(true, true);
45452
+ const undo = (state2, dispatch) => {
45453
+ let hist = historyKey.getState(state2);
45454
+ if (!hist || hist.done.eventCount == 0)
45455
+ return false;
45456
+ if (dispatch)
45457
+ histTransaction(hist, state2, dispatch, false);
45458
+ return true;
45459
+ };
45460
+ const redo = (state2, dispatch) => {
45461
+ let hist = historyKey.getState(state2);
45462
+ if (!hist || hist.undone.eventCount == 0)
45463
+ return false;
45464
+ if (dispatch)
45465
+ histTransaction(hist, state2, dispatch, true);
45466
+ return true;
45467
+ };
45576
45468
  const History = Extension.create({
45577
45469
  name: "history",
45578
45470
  addOptions() {