@floegence/floe-webapp-core 0.86.49 → 0.86.50

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,5 +1,7 @@
1
1
  function X(k) {
2
- let L = 0, b = [], C = 0, I = !1, l = [], p = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), R = 1, o = 0, g, O, S = !1, M = 0, W = 0;
2
+ let L = 0, b = [], C = 0, I = !1;
3
+ const a = [];
4
+ let d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), R = 1, o = 0, g, O, S = !1, M = 0, W = 0;
3
5
  const m = /* @__PURE__ */ new Map();
4
6
  function U(e) {
5
7
  let t = 0, n = b.length;
@@ -8,7 +10,7 @@ function X(k) {
8
10
  b[s].start <= e ? t = s + 1 : n = s;
9
11
  }
10
12
  const i = Math.max(0, t - 1);
11
- return b.slice(i).map((s, a) => a === 0 ? s.text.slice(e - s.start) : s.text).join("");
13
+ return b.slice(i).map((s, l) => l === 0 ? s.text.slice(e - s.start) : s.text).join("");
12
14
  }
13
15
  function F(e, t) {
14
16
  W += e.length;
@@ -16,7 +18,7 @@ function X(k) {
16
18
  return n.tokens.links = { ...t }, n.lex(e);
17
19
  }
18
20
  function w(e) {
19
- return { changes: e, links: p, sourceLength: C };
21
+ return { changes: e, links: d, sourceLength: C };
20
22
  }
21
23
  function $(e) {
22
24
  return { id: e.id, start: e.start, token: structuredClone(e.token) };
@@ -51,8 +53,8 @@ function X(k) {
51
53
  if (n.length < t.inline.length) return !0;
52
54
  const i = new k.Lexer({ ...k.defaults });
53
55
  return n.some((s) => {
54
- const a = s.call({ lexer: i }, e);
55
- return typeof a == "number" && a >= 0;
56
+ const l = s.call({ lexer: i }, e);
57
+ return typeof l == "number" && l >= 0;
56
58
  });
57
59
  }
58
60
  function _(e, t = 0) {
@@ -67,11 +69,11 @@ function X(k) {
67
69
  }
68
70
  let s = i >= 0 ? i : Math.max(t, n.length - 1);
69
71
  s > t && n[s]?.type === "text" && !/\s/u.test(n[s].raw) && n[s - 1]?.type === "link" && s--;
70
- const a = n[s];
71
- if (i < 0 && a?.type === "text" && a.raw === a.text) {
72
- const f = a.raw.lastIndexOf(" ");
72
+ const l = n[s];
73
+ if (i < 0 && l?.type === "text" && l.raw === l.text) {
74
+ const f = l.raw.lastIndexOf(" ");
73
75
  if (f > 0) {
74
- const u = a;
76
+ const u = l;
75
77
  n.splice(
76
78
  s,
77
79
  1,
@@ -80,24 +82,24 @@ function X(k) {
80
82
  ), s++;
81
83
  }
82
84
  }
83
- const d = n.slice(s).map((f) => f.raw).join("");
85
+ const p = n.slice(s).map((f) => f.raw).join("");
84
86
  O = {
85
87
  from: s,
86
- source: d,
88
+ source: p,
87
89
  unresolved: i >= 0,
88
- extensionPending: z(d),
89
- lastChar: d.slice(-1)
90
+ extensionPending: z(p),
91
+ lastChar: p.slice(-1)
90
92
  };
91
93
  }
92
94
  function G() {
93
95
  g = void 0, O = void 0, S = !1;
94
- const e = l.at(-1)?.token;
96
+ const e = a.at(-1)?.token;
95
97
  if (e?.type === "paragraph") {
96
98
  _(e);
97
- const a = e.raw.lastIndexOf(`
98
- `) + 1, d = e.raw.slice(a, a + 32);
99
+ const l = e.raw.lastIndexOf(`
100
+ `) + 1, p = e.raw.slice(l, l + 32);
99
101
  S = !e.raw.endsWith(`
100
- `) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(d);
102
+ `) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(p);
101
103
  }
102
104
  if (e?.type !== "code") return;
103
105
  const t = /^(\x60{3,}|~{3,})[^\n]*\n/.exec(e.raw);
@@ -114,48 +116,48 @@ function X(k) {
114
116
  E(i, s) || (g = s);
115
117
  }
116
118
  function N(e = !1) {
117
- const t = l[o]?.start ?? 0, n = l.splice(o);
119
+ const t = a[o]?.start ?? 0, n = a.splice(o);
118
120
  for (const r of n) B(r);
119
- const i = F(U(t), v), s = p;
120
- p = Object.freeze(
121
+ const i = F(U(t), v), s = d;
122
+ d = Object.freeze(
121
123
  Object.fromEntries(
122
124
  Object.entries(i.links).map(([r, c]) => [r, Object.freeze({ ...c })])
123
125
  )
124
126
  );
125
- const a = [];
126
- let d = t;
127
+ const l = [];
128
+ let p = t;
127
129
  for (let r = 0; r < i.length; r++) {
128
130
  const c = i[r], h = n[r], x = {
129
- id: h?.start === d ? h.id : R++,
130
- start: d,
131
+ id: h?.start === p ? h.id : R++,
132
+ start: p,
131
133
  token: c,
132
134
  references: /* @__PURE__ */ new Set()
133
135
  };
134
- l.push(x), q(x), r === i.length - 1 && c.type === "paragraph" && _(c), (!e || !h || JSON.stringify(h.token) !== JSON.stringify(c)) && a.push({ kind: "replace", block: $(x) }), d += c.raw.length;
136
+ a.push(x), q(x), r === i.length - 1 && c.type === "paragraph" && _(c), (!e || !h || JSON.stringify(h.token) !== JSON.stringify(c)) && l.push({ kind: "replace", block: $(x) }), p += c.raw.length;
135
137
  }
136
- const f = new Set(l.slice(o).map((r) => r.id));
138
+ const f = new Set(a.slice(o).map((r) => r.id));
137
139
  for (const r of n)
138
- f.has(r.id) || a.push({ kind: "remove", id: r.id });
140
+ f.has(r.id) || l.push({ kind: "remove", id: r.id });
139
141
  const u = /* @__PURE__ */ new Set();
140
- for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(p)]))
141
- if (!(s[r]?.href === p[r]?.href && s[r]?.title === p[r]?.title))
142
+ for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(d)]))
143
+ if (!(s[r]?.href === d[r]?.href && s[r]?.title === d[r]?.title))
142
144
  for (const c of m.get(r) ?? [])
143
145
  c.start < t && u.add(c);
144
146
  for (const r of u) {
145
- const c = F(r.token.raw, p);
146
- c.length === 1 && (r.token = c[0], a.push({ kind: "replace", block: $(r) }));
147
+ const c = F(r.token.raw, d);
148
+ c.length === 1 && (r.token = c[0], l.push({ kind: "replace", block: $(r) }));
147
149
  }
148
150
  const P = o;
149
- o = Math.max(0, l.length - 1), l[o]?.token.type === "space" ? o = Math.max(0, o - 1) : o > 0 && !l[o - 1].token.raw.endsWith(`
151
+ o = Math.max(0, a.length - 1), a[o]?.token.type === "space" ? o = Math.max(0, o - 1) : o > 0 && !a[o - 1].token.raw.endsWith(`
150
152
 
151
- `) && (l[o - 1]?.token.type !== "space" ? o-- : /\n[ \t]*\n/u.test(l[o - 1].token.raw) || (o = Math.max(0, o - 2)));
152
- const y = l.at(-1)?.token;
153
- o > 1 && l[o - 1]?.token.type === "space" && l[o - 2]?.token.type === "list" && (y?.type === "list" || y?.type === "paragraph" && /^ {0,3}(?:[0-9]{1,9}[.)]?|[-+*])[ \t]*$/u.test(y.raw)) && (o -= 2);
153
+ `) && (a[o - 1]?.token.type !== "space" ? o-- : /\n[ \t]*\n/u.test(a[o - 1].token.raw) || (o = Math.max(0, o - 2)));
154
+ const y = a.at(-1)?.token;
155
+ o > 1 && a[o - 1]?.token.type === "space" && a[o - 2]?.token.type === "list" && (y?.type === "list" || y?.type === "paragraph" && /^ {0,3}(?:[0-9]{1,9}[.)]?|[-+*])[ \t]*$/u.test(y.raw)) && (o -= 2);
154
156
  for (let r = P; r < o; r++) {
155
- const c = l[r].token;
157
+ const c = a[r].token;
156
158
  c.type === "def" && !v[c.tag] && (v[c.tag] = { href: c.href, title: c.title });
157
159
  }
158
- return G(), w(a);
160
+ return G(), w(l);
159
161
  }
160
162
  function J(e) {
161
163
  const t = I && e.startsWith(`
@@ -167,8 +169,8 @@ function X(k) {
167
169
  if (!e) return w([]);
168
170
  if (C += e.length, e = J(e), !e) return w([]);
169
171
  b.push({ start: L, text: e }), L += e.length;
170
- const t = l.at(-1), n = t?.token;
171
- if (t && o === l.length - 1 && n?.type === "code" && g && !e.includes("\r") && !E(e, g)) {
172
+ const t = a.at(-1), n = t?.token;
173
+ if (t && o === a.length - 1 && n?.type === "code" && g && !e.includes("\r") && !E(e, g)) {
172
174
  const s = (g.pendingNewline ? `
173
175
  ` : "") + (e.endsWith(`
174
176
  `) ? e.slice(0, -1) : e);
@@ -176,10 +178,10 @@ function X(k) {
176
178
  `), n.raw += e, n.text += s, w(s ? [{ kind: "append_text", id: t.id, text: s, code: !0 }] : []);
177
179
  }
178
180
  const i = n?.type === "paragraph" ? n : void 0;
179
- if (t && o === l.length - 1 && i && O && S && !/[\n\r]/u.test(e)) {
180
- const s = O, a = i.tokens.at(-1), d = a?.type === "text" && s.from === i.tokens.length - 1 && !z(e) && !s.extensionPending && !/[\\\x60*_[\]<>~&:/.@;|="'()-]/u.test(e) && !/[\\\x60*_[\]<>~&:/.@;|="'()-]$/u.test(s.lastChar);
181
- if (i.raw += e, i.text += e, d) {
182
- const c = a, h = s.unresolved ? -1 : e.lastIndexOf(" "), x = h > 0 ? e.slice(0, h) : h === 0 ? "" : e, T = [], A = i.tokens.length - 1;
181
+ if (t && o === a.length - 1 && i && O && S && !/[\n\r]/u.test(e)) {
182
+ const s = O, l = i.tokens.at(-1), p = l?.type === "text" && s.from === i.tokens.length - 1 && !z(e) && !s.extensionPending && !/[\\\x60*_[\]<>~&:/.@;|="'()-]/u.test(e) && !/[\\\x60*_[\]<>~&:/.@;|="'()-]$/u.test(s.lastChar);
183
+ if (i.raw += e, i.text += e, p) {
184
+ const c = l, h = s.unresolved ? -1 : e.lastIndexOf(" "), x = h > 0 ? e.slice(0, h) : h === 0 ? "" : e, T = [], A = i.tokens.length - 1;
183
185
  if (x && (c.raw += x, c.text += x, T.push({
184
186
  kind: "append_text",
185
187
  id: t.id,
@@ -206,7 +208,7 @@ function X(k) {
206
208
  return w(T);
207
209
  }
208
210
  const f = new k.Lexer({ ...k.defaults });
209
- f.tokens.links = p;
211
+ f.tokens.links = d;
210
212
  const u = s.source + e;
211
213
  W += u.length;
212
214
  const P = f.inlineTokens(u), y = i.tokens.length - s.from;
@@ -225,19 +227,13 @@ function X(k) {
225
227
  return N();
226
228
  }
227
229
  function K(e = "") {
228
- const t = l.map((s) => ({
229
- kind: "remove",
230
- id: s.id
231
- }));
232
230
  C = e.length, I = !1;
233
- const n = J(e);
234
- L = n.length, b = n ? [{ start: 0, text: n }] : [], l = [], p = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), m.clear(), o = 0, g = void 0, M++;
235
- const i = N();
236
- return { ...i, changes: [...t, ...i.changes] };
231
+ const t = J(e);
232
+ return L = t.length, b = t ? [{ start: 0, text: t }] : [], d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), m.clear(), o = 0, g = void 0, M++, N(!0);
237
233
  }
238
234
  function Q() {
239
- const e = l.map((t) => structuredClone(t.token));
240
- return e.links = { ...p }, e;
235
+ const e = a.map((t) => structuredClone(t.token));
236
+ return e.links = { ...d }, e;
241
237
  }
242
238
  function V() {
243
239
  return M++, o = 0, v = /* @__PURE__ */ Object.create(null), N(!0);
@@ -250,7 +246,7 @@ function X(k) {
250
246
  get sourceLength() {
251
247
  return C;
252
248
  },
253
- diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks: l.length })
249
+ diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks: a.length })
254
250
  };
255
251
  }
256
252
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.86.49",
3
+ "version": "0.86.50",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",