@caspeco/casper-ui-library 10.0.2 → 10.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { Mark as x, markPasteRule as b, mergeAttributes as v, combineTransactionSteps as w, getChangedRanges as T, findChildrenInRange as _, getMarksBetween as O, getAttributes as R } from "../../core/dist/index.js";
2
2
  import { registerCustomProtocol as C, tokenize as H, find as M, reset as U } from "../../../linkifyjs/dist/linkify.js";
3
3
  import { Plugin as g, PluginKey as A } from "../../../prosemirror-state/dist/index.js";
4
- var P = "[\0-   ᠎ -\u2029  ]", B = new RegExp(P), I = new RegExp(`${P}$`), W = new RegExp(P, "g");
5
- function $(t) {
4
+ var P = "[\0-   ᠎ -\u2029  ]", B = new RegExp(P), I = new RegExp(`${P}$`), $ = new RegExp(P, "g");
5
+ function W(t) {
6
6
  return t.length === 1 ? t[0].isLink : t.length === 3 && t[1].isLink ? ["()", "[]"].includes(t[0].value + t[2].value) : !1;
7
7
  }
8
8
  function z(t) {
@@ -14,18 +14,18 @@ function z(t) {
14
14
  );
15
15
  if (!n || l)
16
16
  return;
17
- const { tr: i } = o, d = w(r.doc, [...e]);
18
- if (T(d).forEach(({ newRange: a }) => {
17
+ const { tr: i } = o, c = w(r.doc, [...e]);
18
+ if (T(c).forEach(({ newRange: a }) => {
19
19
  const f = _(
20
20
  o.doc,
21
21
  a,
22
22
  (h) => h.isTextblock
23
23
  );
24
- let c, k;
24
+ let d, k;
25
25
  if (f.length > 1)
26
- c = f[0], k = o.doc.textBetween(
27
- c.pos,
28
- c.pos + c.node.nodeSize,
26
+ d = f[0], k = o.doc.textBetween(
27
+ d.pos,
28
+ d.pos + d.node.nodeSize,
29
29
  void 0,
30
30
  " "
31
31
  );
@@ -33,24 +33,24 @@ function z(t) {
33
33
  const h = o.doc.textBetween(a.from, a.to, " ", " ");
34
34
  if (!I.test(h))
35
35
  return;
36
- c = f[0], k = o.doc.textBetween(
37
- c.pos,
36
+ d = f[0], k = o.doc.textBetween(
37
+ d.pos,
38
38
  a.to,
39
39
  void 0,
40
40
  " "
41
41
  );
42
42
  }
43
- if (c && k) {
43
+ if (d && k) {
44
44
  const h = k.split(B).filter(Boolean);
45
45
  if (h.length <= 0)
46
46
  return !1;
47
- const m = h[h.length - 1], E = c.pos + k.lastIndexOf(m);
47
+ const m = h[h.length - 1], E = d.pos + k.lastIndexOf(m);
48
48
  if (!m)
49
49
  return !1;
50
50
  const L = H(m).map(
51
51
  (s) => s.toObject(t.defaultProtocol)
52
52
  );
53
- if (!$(L))
53
+ if (!W(L))
54
54
  return !1;
55
55
  L.filter((s) => s.isLink).map((s) => ({
56
56
  ...s,
@@ -93,12 +93,12 @@ function N(t) {
93
93
  }
94
94
  if (!i)
95
95
  return !1;
96
- let d = !1;
97
- if (t.enableClickSelection && (d = t.editor.commands.extendMarkRange(t.type.name)), t.openOnClick) {
96
+ let c = !1;
97
+ if (t.enableClickSelection && (c = t.editor.commands.extendMarkRange(t.type.name)), t.openOnClick) {
98
98
  const u = R(e.state, t.type.name), a = (n = i.href) != null ? n : u.href, f = (l = i.target) != null ? l : u.target;
99
- a && (window.open(a, f), d = !0);
99
+ a && (window.open(a, f), c = !0);
100
100
  }
101
- return d;
101
+ return c;
102
102
  }
103
103
  }
104
104
  });
@@ -108,8 +108,8 @@ function V(t) {
108
108
  key: new A("handlePasteLink"),
109
109
  props: {
110
110
  handlePaste: (e, r, o) => {
111
- const { shouldAutoLink: n } = t, { state: l } = e, { selection: i } = l, { empty: d } = i;
112
- if (d)
111
+ const { shouldAutoLink: n } = t, { state: l } = e, { selection: i } = l, { empty: c } = i;
112
+ if (c)
113
113
  return !1;
114
114
  let u = "";
115
115
  o.content.forEach((f) => {
@@ -141,10 +141,9 @@ function p(t, e) {
141
141
  return e && e.forEach((o) => {
142
142
  const n = typeof o == "string" ? o : o.scheme;
143
143
  n && r.push(n);
144
- }), !t || t.replace(W, "").match(
144
+ }), !t || t.replace($, "").match(
145
145
  new RegExp(
146
- // oxlint-disable-next-line no-useless-escape
147
- `^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
146
+ `^(?:(?:${r.map((o) => o.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,
148
147
  "i"
149
148
  )
150
149
  );
@@ -246,8 +245,8 @@ var X = x.create({
246
245
  }),
247
246
  renderMarkdown: (t, e) => {
248
247
  var r, o, n, l;
249
- const i = (o = (r = t.attrs) == null ? void 0 : r.href) != null ? o : "", d = (l = (n = t.attrs) == null ? void 0 : n.title) != null ? l : "", u = e.renderChildren(t);
250
- return d ? `[${u}](${i} "${d}")` : `[${u}](${i})`;
248
+ const i = (o = (r = t.attrs) == null ? void 0 : r.href) != null ? o : "", c = (l = (n = t.attrs) == null ? void 0 : n.title) != null ? l : "", u = e.renderChildren(t);
249
+ return c ? `[${u}](${i} "${c}")` : `[${u}](${i})`;
251
250
  },
252
251
  addCommands() {
253
252
  return {