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