@kerebron/legacy-compat 0.8.1 → 0.8.3

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/kerebron.js CHANGED
@@ -1,15 +1,4 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create, __defProp$1 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), __copyProps = (e, t, n, r) => {
3
- if (t && typeof t == "object" || typeof t == "function") for (var a = __getOwnPropNames(t), o = 0, s = a.length, c; o < s; o++) c = a[o], !__hasOwnProp.call(e, c) && c !== n && __defProp$1(e, c, {
4
- get: ((e) => t[e]).bind(null, c),
5
- enumerable: !(r = __getOwnPropDesc(t, c)) || r.enumerable
6
- });
7
- return e;
8
- }, __toESM = (e, t, n) => (n = e == null ? {} : __create(__getProtoOf(e)), __copyProps(t || !e || !e.__esModule ? __defProp$1(n, "default", {
9
- value: e,
10
- enumerable: !0
11
- }) : n, e));
12
- //#endregion
1
+ import { n as __toESM, t as __commonJSMin } from "./rolldown-runtime-3b4jIN3o.js";
13
2
  //#region ../../node_modules/.deno/orderedmap@2.1.1/node_modules/orderedmap/dist/index.js
14
3
  function OrderedMap(e) {
15
4
  this.content = e;
@@ -76,7 +65,7 @@ OrderedMap.prototype = {
76
65
  return new OrderedMap(t);
77
66
  };
78
67
  //#endregion
79
- //#region ../../node_modules/.deno/prosemirror-model@1.25.3/node_modules/prosemirror-model/dist/index.js
68
+ //#region ../../node_modules/.deno/prosemirror-model@1.25.9/node_modules/prosemirror-model/dist/index.js
80
69
  function findDiffStart(e, t, n) {
81
70
  for (let r = 0;; r++) {
82
71
  if (r == e.childCount || r == t.childCount) return e.childCount == t.childCount ? null : n;
@@ -87,8 +76,9 @@ function findDiffStart(e, t, n) {
87
76
  }
88
77
  if (!a.sameMarkup(o)) return n;
89
78
  if (a.isText && a.text != o.text) {
90
- for (let e = 0; a.text[e] == o.text[e]; e++) n++;
91
- return n;
79
+ let e = a.text, t = o.text, r = 0;
80
+ for (; e[r] == t[r]; r++) n++;
81
+ return r && r < e.length && r < t.length && surrogateHigh(e.charCodeAt(r - 1)) && surrogateLow(e.charCodeAt(r)) && n--, n;
92
82
  }
93
83
  if (a.content.size || o.content.size) {
94
84
  let e = findDiffStart(a.content, o.content, n + 1);
@@ -113,9 +103,9 @@ function findDiffEnd(e, t, n, r) {
113
103
  b: r
114
104
  };
115
105
  if (s.isText && s.text != c.text) {
116
- let e = 0, t = Math.min(s.text.length, c.text.length);
117
- for (; e < t && s.text[s.text.length - e - 1] == c.text[c.text.length - e - 1];) e++, n--, r--;
118
- return {
106
+ let e = s.text, t = c.text, a = e.length, o = t.length;
107
+ for (; a > 0 && o > 0 && e[a - 1] == t[o - 1];) a--, o--, n--, r--;
108
+ return a && o && a < e.length && surrogateHigh(e.charCodeAt(a - 1)) && surrogateLow(e.charCodeAt(a)) && (n++, r++), {
119
109
  a: n,
120
110
  b: r
121
111
  };
@@ -127,6 +117,12 @@ function findDiffEnd(e, t, n, r) {
127
117
  n -= l, r -= l;
128
118
  }
129
119
  }
120
+ function surrogateLow(e) {
121
+ return e >= 56320 && e < 57344;
122
+ }
123
+ function surrogateHigh(e) {
124
+ return e >= 55296 && e < 56320;
125
+ }
130
126
  var Fragment = class e {
131
127
  constructor(e, t) {
132
128
  if (this.content = e, this.size = t || 0, t == null) for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize;
@@ -238,7 +234,7 @@ var Fragment = class e {
238
234
  static fromJSON(t, n) {
239
235
  if (!n) return e.empty;
240
236
  if (!Array.isArray(n)) throw RangeError("Invalid input for Fragment.fromJSON");
241
- return new e(n.map(t.nodeFromJSON));
237
+ return e.fromArray(n.map(t.nodeFromJSON));
242
238
  }
243
239
  static fromArray(t) {
244
240
  if (!t.length) return e.empty;
@@ -342,7 +338,7 @@ var ReplaceError = class extends Error {}, Slice = class e {
342
338
  return this.content.size - this.openStart - this.openEnd;
343
339
  }
344
340
  insertAt(t, n) {
345
- let r = insertInto(this.content, t + this.openStart, n);
341
+ let r = insertInto(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
346
342
  return r && new e(r, this.openStart, this.openEnd);
347
343
  }
348
344
  removeBetween(t, n) {
@@ -382,11 +378,11 @@ function removeRange(e, t, n) {
382
378
  if (r != s) throw RangeError("Removing non-flat range");
383
379
  return e.replaceChild(r, o.copy(removeRange(o.content, t - a - 1, n - a - 1)));
384
380
  }
385
- function insertInto(e, t, n, r) {
386
- let { index: a, offset: o } = e.findIndex(t), s = e.maybeChild(a);
387
- if (o == t || s.isText) return r && !r.canReplace(a, a, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
388
- let c = insertInto(s.content, t - o - 1, n, s);
389
- return c && e.replaceChild(a, s.copy(c));
381
+ function insertInto(e, t, n, r, a, o) {
382
+ let { index: s, offset: c } = e.findIndex(t), l = e.maybeChild(s);
383
+ if (c == t || l.isText) return o && r <= 0 && a <= 0 && !o.canReplace(s, s, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
384
+ let u = insertInto(l.content, t - c - 1, n, s == 0 ? r - 1 : 0, s == e.childCount - 1 ? a - 1 : 0, l);
385
+ return u && e.replaceChild(s, l.copy(u));
390
386
  }
391
387
  function replace(e, t, n) {
392
388
  if (n.openStart > e.depth) throw new ReplaceError("Inserted content deeper than insertion position");
@@ -425,7 +421,8 @@ function addRange(e, t, n, r) {
425
421
  t && t.depth == n && t.textOffset && addNode(t.nodeBefore, r);
426
422
  }
427
423
  function close(e, t) {
428
- return e.type.checkContent(t), e.copy(t);
424
+ if (!e.type.validContent(t)) throw new ReplaceError("Invalid content for node " + e.type.name);
425
+ return e.copy(t);
429
426
  }
430
427
  function replaceThreeWay(e, t, n, r, a) {
431
428
  let o = e.depth > a && joinable$1(e, t, a + 1), s = r.depth > a && joinable$1(n, r, a + 1), c = [];
@@ -1127,11 +1124,8 @@ function computeAttrs(e, t) {
1127
1124
  return n;
1128
1125
  }
1129
1126
  function checkAttrs(e, t, n, r) {
1130
- for (let r in t) if (!(r in e)) throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);
1131
- for (let n in e) {
1132
- let r = e[n];
1133
- r.validate && r.validate(t[n]);
1134
- }
1127
+ for (let a in t) if (!(a in e)) throw RangeError(`Unsupported attribute ${a} for ${n} of type ${r}`);
1128
+ for (let n in e) e[n].validate && e[n].validate(t[n]);
1135
1129
  }
1136
1130
  function initAttrs(e, t) {
1137
1131
  let n = Object.create(null);
@@ -1490,14 +1484,20 @@ var NodeContext = class {
1490
1484
  e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
1491
1485
  }
1492
1486
  addTextNode(e, t) {
1493
- let n = e.nodeValue, r = this.top, a = r.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (r.options & OPT_PRESERVE_WS) > 0;
1487
+ let n = e.nodeValue, r = this.top, a = r.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (r.options & OPT_PRESERVE_WS) > 0, { schema: o } = this.parser;
1494
1488
  if (a === "full" || r.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
1495
- if (a) n = a === "full" ? n.replace(/\r\n?/g, "\n") : n.replace(/\r?\n|\r/g, " ");
1496
- else if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
1497
- let t = r.content[r.content.length - 1], a = e.previousSibling;
1498
- (!t || a && a.nodeName == "BR" || t.isText && /[ \t\r\n\u000c]$/.test(t.text)) && (n = n.slice(1));
1499
- }
1500
- n && this.insertNode(this.parser.schema.text(n), t, !/\S/.test(n)), this.findInText(e);
1489
+ if (!a) {
1490
+ if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
1491
+ let t = r.content[r.content.length - 1], a = e.previousSibling;
1492
+ (!t || a && a.nodeName == "BR" || t.isText && /[ \t\r\n\u000c]$/.test(t.text)) && (n = n.slice(1));
1493
+ }
1494
+ } else if (a === "full") n = n.replace(/\r\n?/g, "\n");
1495
+ else if (o.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(o.linebreakReplacement.create())) {
1496
+ let e = n.split(/\r?\n|\r/);
1497
+ for (let n = 0; n < e.length; n++) n && this.insertNode(o.linebreakReplacement.create(), t, !0), e[n] && this.insertNode(o.text(e[n]), t, !/\S/.test(e[n]));
1498
+ n = "";
1499
+ } else n = n.replace(/\r?\n|\r/g, " ");
1500
+ n && this.insertNode(o.text(n), t, !/\S/.test(n)), this.findInText(e);
1501
1501
  } else this.findInside(e);
1502
1502
  }
1503
1503
  addElement(e, t, n) {
@@ -1739,6 +1739,7 @@ var DOMSerializer = class e {
1739
1739
  }), n;
1740
1740
  }
1741
1741
  serializeNodeInner(e, t) {
1742
+ if (e.isText) return doc$1(t).createTextNode(e.text);
1742
1743
  let { dom: n, contentDOM: r } = renderSpec(doc$1(t), this.nodes[e.type.name](e), null, e.attrs);
1743
1744
  if (r) {
1744
1745
  if (e.isLeaf) throw RangeError("Content hole not allowed in a leaf node spec");
@@ -1759,7 +1760,7 @@ var DOMSerializer = class e {
1759
1760
  return r && renderSpec(doc$1(n), r(e, t), null, e.attrs);
1760
1761
  }
1761
1762
  static renderSpec(e, t, n = null, r) {
1762
- return renderSpec(e, t, n, r);
1763
+ return typeof t == "string" ? { dom: e.createTextNode(t) } : renderSpec(e, t, n, r);
1763
1764
  }
1764
1765
  static fromSchema(t) {
1765
1766
  return t.cached.domSerializer || (t.cached.domSerializer = new e(this.nodesFromSchema(t), this.marksFromSchema(t)));
@@ -1798,9 +1799,8 @@ function suspiciousAttributesInner(e) {
1798
1799
  return n(e), t;
1799
1800
  }
1800
1801
  function renderSpec(e, t, n, r) {
1801
- if (typeof t == "string") return { dom: e.createTextNode(t) };
1802
- if (t.nodeType != null) return { dom: t };
1803
- if (t.dom && t.dom.nodeType != null) return t;
1802
+ if (t.nodeType == 1) return { dom: t };
1803
+ if (t.dom && t.dom.nodeType == 1) return t;
1804
1804
  let a = t[0], o;
1805
1805
  if (typeof a != "string") throw RangeError("Invalid array passed to renderSpec");
1806
1806
  if (r && (o = suspiciousAttributes(r)) && o.indexOf(t) > -1) throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
@@ -1822,7 +1822,8 @@ function renderSpec(e, t, n, r) {
1822
1822
  dom: l,
1823
1823
  contentDOM: l
1824
1824
  };
1825
- } else {
1825
+ } else if (typeof o == "string") l.appendChild(e.createTextNode(o));
1826
+ else {
1826
1827
  let { dom: t, contentDOM: a } = renderSpec(e, o, n, r);
1827
1828
  if (l.appendChild(t), a) {
1828
1829
  if (c) throw RangeError("Multiple content holes");
@@ -11749,7 +11750,7 @@ var LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/, Language = class e {
11749
11750
  static async load(t) {
11750
11751
  let n;
11751
11752
  if (t instanceof Uint8Array) n = t;
11752
- else if (globalThis.process?.versions.node) n = await (await import("./__vite-browser-external-MOXaNQ5J.js").then((e) => /* @__PURE__ */ __toESM(e.default, 1))).readFile(t);
11753
+ else if (globalThis.process?.versions.node) n = await (await import("./__vite-browser-external-BXJKwL9l.js").then((e) => /* @__PURE__ */ __toESM(e.default, 1))).readFile(t);
11753
11754
  else {
11754
11755
  let e = await fetch(t);
11755
11756
  if (!e.ok) {
@@ -11774,7 +11775,7 @@ ${JSON.stringify(a, null, 2)}`), Error("Language.load failed: no language functi
11774
11775
  async function Module2(moduleArg = {}) {
11775
11776
  var moduleRtn, Module = moduleArg, ENVIRONMENT_IS_WEB = typeof window == "object", ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope < "u", ENVIRONMENT_IS_NODE = typeof process == "object" && process.versions?.node && process.type != "renderer";
11776
11777
  if (ENVIRONMENT_IS_NODE) {
11777
- let { createRequire: e } = await import("./__vite-browser-external-MOXaNQ5J.js").then((e) => /* @__PURE__ */ __toESM(e.default, 1));
11778
+ let { createRequire: e } = await import("./__vite-browser-external-BXJKwL9l.js").then((e) => /* @__PURE__ */ __toESM(e.default, 1));
11778
11779
  var require = e(import.meta.url);
11779
11780
  }
11780
11781
  Module.currentQueryProgressCallback = null, Module.currentProgressCallback = null, Module.currentLogCallback = null, Module.currentParseCallback = null;
@@ -24811,7 +24812,7 @@ var CSS_PREFIX = "kb-custom-menu", STORAGE_KEY = "kb-custom-menu-order", OVERFLO
24811
24812
  }
24812
24813
  };
24813
24814
  //#endregion
24814
- //#region ../odt-wasm/lib.js
24815
+ //#region \0deno::JavaScript::@kerebron/odt-wasm::/home/runner/work/kerebron/kerebron/packages/odt-wasm/lib.js
24815
24816
  async function init(e) {
24816
24817
  let t = await import("./odt_parser.internal-PfZhgDYB.js"), n = await WebAssembly.instantiate(e, { "./odt_parser.internal.js": t });
24817
24818
  return t.__wbg_set_wasm(n.instance.exports), n.instance.exports.__wbindgen_start(), t.init_debug(), n.instance, t;
@@ -27983,6 +27984,6 @@ var undo = buildCommand(!1, !0), redo = buildCommand(!0, !0), undoNoScroll = bui
27983
27984
  }
27984
27985
  };
27985
27986
  //#endregion
27986
- export { AdvancedEditorKit, CoreEditor, ExtensionHistory, createAssetLoad, __commonJSMin as t };
27987
+ export { AdvancedEditorKit, CoreEditor, ExtensionHistory, createAssetLoad };
27987
27988
 
27988
27989
  //# sourceMappingURL=kerebron.js.map