@paroicms/internal-link-plugin 0.13.1 → 0.14.1

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,54 +1,54 @@
1
- const dt = (t, e) => t === e, B = {
2
- equals: dt
1
+ const ht = (t, e) => t === e, O = {
2
+ equals: ht
3
3
  };
4
- let nt = st;
5
- const E = 1, O = 2, it = {
4
+ let it = ot;
5
+ const E = 1, V = 2, lt = {
6
6
  owned: null,
7
7
  cleanups: null,
8
8
  context: null,
9
9
  owner: null
10
10
  };
11
11
  var k = null;
12
- let U = null, ht = null, w = null, b = null, I = null, j = 0;
13
- function pt(t, e) {
14
- const n = w, i = k, l = t.length === 0, r = i, o = l ? it : {
12
+ let H = null, pt = null, w = null, b = null, I = null, U = 0;
13
+ function gt(t, e) {
14
+ const n = w, i = k, l = t.length === 0, r = i, o = l ? lt : {
15
15
  owned: null,
16
16
  cleanups: null,
17
17
  context: r ? r.context : null,
18
18
  owner: r
19
- }, s = l ? t : () => t(() => C(() => A(o)));
19
+ }, s = l ? t : () => t(() => A(() => T(o)));
20
20
  k = o, w = null;
21
21
  try {
22
- return N(s, !0);
22
+ return B(s, !0);
23
23
  } finally {
24
24
  w = n, k = i;
25
25
  }
26
26
  }
27
27
  function S(t, e) {
28
- e = e ? Object.assign({}, B, e) : B;
28
+ e = e ? Object.assign({}, O, e) : O;
29
29
  const n = {
30
30
  value: t,
31
31
  observers: null,
32
32
  observerSlots: null,
33
33
  comparator: e.equals || void 0
34
- }, i = (l) => (typeof l == "function" && (l = l(n.value)), rt(n, l));
35
- return [lt.bind(n), i];
34
+ }, i = (l) => (typeof l == "function" && (l = l(n.value)), st(n, l));
35
+ return [rt.bind(n), i];
36
36
  }
37
- function P(t, e, n) {
38
- const i = G(t, e, !1, E);
39
- x(i);
37
+ function C(t, e, n) {
38
+ const i = q(t, e, !1, E);
39
+ N(i);
40
40
  }
41
- function F(t, e, n) {
42
- nt = mt;
43
- const i = G(t, e, !1, E);
44
- i.user = !0, I ? I.push(i) : x(i);
41
+ function G(t, e, n) {
42
+ it = yt;
43
+ const i = q(t, e, !1, E);
44
+ i.user = !0, I ? I.push(i) : N(i);
45
45
  }
46
- function _(t, e, n) {
47
- n = n ? Object.assign({}, B, n) : B;
48
- const i = G(t, e, !0, 0);
49
- return i.observers = null, i.observerSlots = null, i.comparator = n.equals || void 0, x(i), lt.bind(i);
46
+ function P(t, e, n) {
47
+ n = n ? Object.assign({}, O, n) : O;
48
+ const i = q(t, e, !0, 0);
49
+ return i.observers = null, i.observerSlots = null, i.comparator = n.equals || void 0, N(i), rt.bind(i);
50
50
  }
51
- function C(t) {
51
+ function A(t) {
52
52
  if (w === null) return t();
53
53
  const e = w;
54
54
  w = null;
@@ -58,12 +58,12 @@ function C(t) {
58
58
  w = e;
59
59
  }
60
60
  }
61
- function lt() {
61
+ function rt() {
62
62
  if (this.sources && this.state)
63
- if (this.state === E) x(this);
63
+ if (this.state === E) N(this);
64
64
  else {
65
65
  const t = b;
66
- b = null, N(() => R(this), !1), b = t;
66
+ b = null, B(() => M(this), !1), b = t;
67
67
  }
68
68
  if (w) {
69
69
  const t = this.observers ? this.observers.length : 0;
@@ -71,41 +71,37 @@ function lt() {
71
71
  }
72
72
  return this.value;
73
73
  }
74
- function rt(t, e, n) {
74
+ function st(t, e, n) {
75
75
  let i = t.value;
76
- return (!t.comparator || !t.comparator(i, e)) && (t.value = e, t.observers && t.observers.length && N(() => {
76
+ return (!t.comparator || !t.comparator(i, e)) && (t.value = e, t.observers && t.observers.length && B(() => {
77
77
  for (let l = 0; l < t.observers.length; l += 1) {
78
- const r = t.observers[l], o = U && U.running;
79
- o && U.disposed.has(r), (o ? !r.tState : !r.state) && (r.pure ? b.push(r) : I.push(r), r.observers && ot(r)), o || (r.state = E);
78
+ const r = t.observers[l], o = H && H.running;
79
+ o && H.disposed.has(r), (o ? !r.tState : !r.state) && (r.pure ? b.push(r) : I.push(r), r.observers && ct(r)), o || (r.state = E);
80
80
  }
81
81
  if (b.length > 1e6)
82
82
  throw b = [], new Error();
83
83
  }, !1)), e;
84
84
  }
85
- function x(t) {
85
+ function N(t) {
86
86
  if (!t.fn) return;
87
- A(t);
88
- const e = j;
89
- gt(
90
- t,
91
- t.value,
92
- e
93
- );
94
- }
95
- function gt(t, e, n) {
87
+ T(t);
88
+ const e = U;
89
+ $t(t, t.value, e);
90
+ }
91
+ function $t(t, e, n) {
96
92
  let i;
97
93
  const l = k, r = w;
98
94
  w = k = t;
99
95
  try {
100
96
  i = t.fn(e);
101
97
  } catch (o) {
102
- return t.pure && (t.state = E, t.owned && t.owned.forEach(A), t.owned = null), t.updatedAt = n + 1, ct(o);
98
+ return t.pure && (t.state = E, t.owned && t.owned.forEach(T), t.owned = null), t.updatedAt = n + 1, ut(o);
103
99
  } finally {
104
100
  w = r, k = l;
105
101
  }
106
- (!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? rt(t, i) : t.value = i, t.updatedAt = n);
102
+ (!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? st(t, i) : t.value = i, t.updatedAt = n);
107
103
  }
108
- function G(t, e, n, i = E, l) {
104
+ function q(t, e, n, i = E, l) {
109
105
  const r = {
110
106
  fn: t,
111
107
  state: i,
@@ -119,67 +115,67 @@ function G(t, e, n, i = E, l) {
119
115
  context: k ? k.context : null,
120
116
  pure: n
121
117
  };
122
- return k === null || k !== it && (k.owned ? k.owned.push(r) : k.owned = [r]), r;
118
+ return k === null || k !== lt && (k.owned ? k.owned.push(r) : k.owned = [r]), r;
123
119
  }
124
- function V(t) {
120
+ function R(t) {
125
121
  if (t.state === 0) return;
126
- if (t.state === O) return R(t);
127
- if (t.suspense && C(t.suspense.inFallback)) return t.suspense.effects.push(t);
122
+ if (t.state === V) return M(t);
123
+ if (t.suspense && A(t.suspense.inFallback)) return t.suspense.effects.push(t);
128
124
  const e = [t];
129
- for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < j); )
125
+ for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < U); )
130
126
  t.state && e.push(t);
131
127
  for (let n = e.length - 1; n >= 0; n--)
132
128
  if (t = e[n], t.state === E)
133
- x(t);
134
- else if (t.state === O) {
129
+ N(t);
130
+ else if (t.state === V) {
135
131
  const i = b;
136
- b = null, N(() => R(t, e[0]), !1), b = i;
132
+ b = null, B(() => M(t, e[0]), !1), b = i;
137
133
  }
138
134
  }
139
- function N(t, e) {
135
+ function B(t, e) {
140
136
  if (b) return t();
141
137
  let n = !1;
142
- e || (b = []), I ? n = !0 : I = [], j++;
138
+ e || (b = []), I ? n = !0 : I = [], U++;
143
139
  try {
144
140
  const i = t();
145
- return $t(n), i;
141
+ return mt(n), i;
146
142
  } catch (i) {
147
- n || (I = null), b = null, ct(i);
143
+ n || (I = null), b = null, ut(i);
148
144
  }
149
145
  }
150
- function $t(t) {
151
- if (b && (st(b), b = null), t) return;
146
+ function mt(t) {
147
+ if (b && (ot(b), b = null), t) return;
152
148
  const e = I;
153
- I = null, e.length && N(() => nt(e), !1);
149
+ I = null, e.length && B(() => it(e), !1);
154
150
  }
155
- function st(t) {
156
- for (let e = 0; e < t.length; e++) V(t[e]);
151
+ function ot(t) {
152
+ for (let e = 0; e < t.length; e++) R(t[e]);
157
153
  }
158
- function mt(t) {
154
+ function yt(t) {
159
155
  let e, n = 0;
160
156
  for (e = 0; e < t.length; e++) {
161
157
  const i = t[e];
162
- i.user ? t[n++] = i : V(i);
158
+ i.user ? t[n++] = i : R(i);
163
159
  }
164
- for (e = 0; e < n; e++) V(t[e]);
160
+ for (e = 0; e < n; e++) R(t[e]);
165
161
  }
166
- function R(t, e) {
162
+ function M(t, e) {
167
163
  t.state = 0;
168
164
  for (let n = 0; n < t.sources.length; n += 1) {
169
165
  const i = t.sources[n];
170
166
  if (i.sources) {
171
167
  const l = i.state;
172
- l === E ? i !== e && (!i.updatedAt || i.updatedAt < j) && V(i) : l === O && R(i, e);
168
+ l === E ? i !== e && (!i.updatedAt || i.updatedAt < U) && R(i) : l === V && M(i, e);
173
169
  }
174
170
  }
175
171
  }
176
- function ot(t) {
172
+ function ct(t) {
177
173
  for (let e = 0; e < t.observers.length; e += 1) {
178
174
  const n = t.observers[e];
179
- n.state || (n.state = O, n.pure ? b.push(n) : I.push(n), n.observers && ot(n));
175
+ n.state || (n.state = V, n.pure ? b.push(n) : I.push(n), n.observers && ct(n));
180
176
  }
181
177
  }
182
- function A(t) {
178
+ function T(t) {
183
179
  let e;
184
180
  if (t.sources)
185
181
  for (; t.sources.length; ) {
@@ -190,11 +186,11 @@ function A(t) {
190
186
  }
191
187
  }
192
188
  if (t.tOwned) {
193
- for (e = t.tOwned.length - 1; e >= 0; e--) A(t.tOwned[e]);
189
+ for (e = t.tOwned.length - 1; e >= 0; e--) T(t.tOwned[e]);
194
190
  delete t.tOwned;
195
191
  }
196
192
  if (t.owned) {
197
- for (e = t.owned.length - 1; e >= 0; e--) A(t.owned[e]);
193
+ for (e = t.owned.length - 1; e >= 0; e--) T(t.owned[e]);
198
194
  t.owned = null;
199
195
  }
200
196
  if (t.cleanups) {
@@ -203,43 +199,36 @@ function A(t) {
203
199
  }
204
200
  t.state = 0;
205
201
  }
206
- function yt(t) {
202
+ function wt(t) {
207
203
  return t instanceof Error ? t : new Error(typeof t == "string" ? t : "Unknown error", {
208
204
  cause: t
209
205
  });
210
206
  }
211
- function ct(t, e = k) {
212
- throw yt(t);
207
+ function ut(t, e = k) {
208
+ throw wt(t);
213
209
  }
214
- function T(t, e) {
215
- return C(() => t(e || {}));
210
+ function x(t, e) {
211
+ return A(() => t(e || {}));
216
212
  }
217
- const wt = (t) => `Stale read from <${t}>.`;
218
- function Z(t) {
219
- const e = t.keyed, n = _(() => t.when, void 0, void 0), i = e ? n : _(n, void 0, {
213
+ const bt = (t) => `Stale read from <${t}>.`;
214
+ function W(t) {
215
+ const e = t.keyed, n = P(() => t.when, void 0, void 0), i = e ? n : P(n, void 0, {
220
216
  equals: (l, r) => !l == !r
221
217
  });
222
- return _(
223
- () => {
224
- const l = i();
225
- if (l) {
226
- const r = t.children;
227
- return typeof r == "function" && r.length > 0 ? C(
228
- () => r(
229
- e ? l : () => {
230
- if (!C(i)) throw wt("Show");
231
- return n();
232
- }
233
- )
234
- ) : r;
235
- }
236
- return t.fallback;
237
- },
238
- void 0,
239
- void 0
240
- );
218
+ return P(() => {
219
+ const l = i();
220
+ if (l) {
221
+ const r = t.children;
222
+ return typeof r == "function" && r.length > 0 ? A(() => r(e ? l : () => {
223
+ if (!A(i)) throw bt("Show");
224
+ return n();
225
+ })) : r;
226
+ }
227
+ return t.fallback;
228
+ }, void 0, void 0);
241
229
  }
242
- function bt(t, e, n) {
230
+ const L = (t) => P(() => t());
231
+ function kt(t, e, n) {
243
232
  let i = n.length, l = e.length, r = i, o = 0, s = 0, u = e[l - 1].nextSibling, $ = null;
244
233
  for (; o < l || s < r; ) {
245
234
  if (e[o] === n[s]) {
@@ -249,36 +238,36 @@ function bt(t, e, n) {
249
238
  for (; e[l - 1] === n[r - 1]; )
250
239
  l--, r--;
251
240
  if (l === o) {
252
- const a = r < i ? s ? n[s - 1].nextSibling : n[r - s] : u;
253
- for (; s < r; ) t.insertBefore(n[s++], a);
241
+ const f = r < i ? s ? n[s - 1].nextSibling : n[r - s] : u;
242
+ for (; s < r; ) t.insertBefore(n[s++], f);
254
243
  } else if (r === s)
255
244
  for (; o < l; )
256
245
  (!$ || !$.has(e[o])) && e[o].remove(), o++;
257
246
  else if (e[o] === n[r - 1] && n[s] === e[l - 1]) {
258
- const a = e[--l].nextSibling;
259
- t.insertBefore(n[s++], e[o++].nextSibling), t.insertBefore(n[--r], a), e[l] = n[r];
247
+ const f = e[--l].nextSibling;
248
+ t.insertBefore(n[s++], e[o++].nextSibling), t.insertBefore(n[--r], f), e[l] = n[r];
260
249
  } else {
261
250
  if (!$) {
262
251
  $ = /* @__PURE__ */ new Map();
263
252
  let h = s;
264
253
  for (; h < r; ) $.set(n[h], h++);
265
254
  }
266
- const a = $.get(e[o]);
267
- if (a != null)
268
- if (s < a && a < r) {
255
+ const f = $.get(e[o]);
256
+ if (f != null)
257
+ if (s < f && f < r) {
269
258
  let h = o, m = 1, c;
270
- for (; ++h < l && h < r && !((c = $.get(e[h])) == null || c !== a + m); )
259
+ for (; ++h < l && h < r && !((c = $.get(e[h])) == null || c !== f + m); )
271
260
  m++;
272
- if (m > a - s) {
273
- const f = e[o];
274
- for (; s < a; ) t.insertBefore(n[s++], f);
261
+ if (m > f - s) {
262
+ const a = e[o];
263
+ for (; s < f; ) t.insertBefore(n[s++], a);
275
264
  } else t.replaceChild(n[s++], e[o++]);
276
265
  } else o++;
277
266
  else e[o++].remove();
278
267
  }
279
268
  }
280
269
  }
281
- const W = "_$DX_DELEGATE";
270
+ const X = "_$DX_DELEGATE";
282
271
  function y(t, e, n, i) {
283
272
  let l;
284
273
  const r = () => {
@@ -287,21 +276,21 @@ function y(t, e, n, i) {
287
276
  }, o = () => (l || (l = r())).cloneNode(!0);
288
277
  return o.cloneNode = o, o;
289
278
  }
290
- function q(t, e = window.document) {
291
- const n = e[W] || (e[W] = /* @__PURE__ */ new Set());
279
+ function K(t, e = window.document) {
280
+ const n = e[X] || (e[X] = /* @__PURE__ */ new Set());
292
281
  for (let i = 0, l = t.length; i < l; i++) {
293
282
  const r = t[i];
294
- n.has(r) || (n.add(r), e.addEventListener(r, _t));
283
+ n.has(r) || (n.add(r), e.addEventListener(r, vt));
295
284
  }
296
285
  }
297
- function kt(t, e) {
286
+ function _t(t, e) {
298
287
  e == null ? t.removeAttribute("class") : t.className = e;
299
288
  }
300
289
  function p(t, e, n, i) {
301
- if (n !== void 0 && !i && (i = []), typeof e != "function") return M(t, e, i, n);
302
- P((l) => M(t, e(), l, n), i);
290
+ if (n !== void 0 && !i && (i = []), typeof e != "function") return j(t, e, i, n);
291
+ C((l) => j(t, e(), l, n), i);
303
292
  }
304
- function _t(t) {
293
+ function vt(t) {
305
294
  let e = t.target;
306
295
  const n = `$$${t.type}`, i = t.target, l = t.currentTarget, r = (u) => Object.defineProperty(t, "target", {
307
296
  configurable: !0,
@@ -335,7 +324,7 @@ function _t(t) {
335
324
  } else s();
336
325
  r(i);
337
326
  }
338
- function M(t, e, n, i, l) {
327
+ function j(t, e, n, i, l) {
339
328
  for (; typeof n == "function"; ) n = n();
340
329
  if (e === n) return n;
341
330
  const r = typeof e, o = i !== void 0;
@@ -351,18 +340,18 @@ function M(t, e, n, i, l) {
351
340
  n = D(t, n, i);
352
341
  else {
353
342
  if (r === "function")
354
- return P(() => {
343
+ return C(() => {
355
344
  let s = e();
356
345
  for (; typeof s == "function"; ) s = s();
357
- n = M(t, s, n, i);
346
+ n = j(t, s, n, i);
358
347
  }), () => n;
359
348
  if (Array.isArray(e)) {
360
349
  const s = [], u = n && Array.isArray(n);
361
- if (H(s, e, n, l))
362
- return P(() => n = M(t, s, n, i, !0)), () => n;
350
+ if (F(s, e, n, l))
351
+ return C(() => n = j(t, s, n, i, !0)), () => n;
363
352
  if (s.length === 0) {
364
353
  if (n = D(t, n, i), o) return n;
365
- } else u ? n.length === 0 ? X(t, s, i) : bt(t, n, s) : (n && D(t), X(t, s));
354
+ } else u ? n.length === 0 ? J(t, s, i) : kt(t, n, s) : (n && D(t), J(t, s));
366
355
  n = s;
367
356
  } else if (e.nodeType) {
368
357
  if (Array.isArray(n)) {
@@ -374,32 +363,28 @@ function M(t, e, n, i, l) {
374
363
  }
375
364
  return n;
376
365
  }
377
- function H(t, e, n, i) {
366
+ function F(t, e, n, i) {
378
367
  let l = !1;
379
368
  for (let r = 0, o = e.length; r < o; r++) {
380
369
  let s = e[r], u = n && n[t.length], $;
381
370
  if (!(s == null || s === !0 || s === !1)) if (($ = typeof s) == "object" && s.nodeType)
382
371
  t.push(s);
383
372
  else if (Array.isArray(s))
384
- l = H(t, s, u) || l;
373
+ l = F(t, s, u) || l;
385
374
  else if ($ === "function")
386
375
  if (i) {
387
376
  for (; typeof s == "function"; ) s = s();
388
- l = H(
389
- t,
390
- Array.isArray(s) ? s : [s],
391
- Array.isArray(u) ? u : [u]
392
- ) || l;
377
+ l = F(t, Array.isArray(s) ? s : [s], Array.isArray(u) ? u : [u]) || l;
393
378
  } else
394
379
  t.push(s), l = !0;
395
380
  else {
396
- const a = String(s);
397
- u && u.nodeType === 3 && u.data === a ? t.push(u) : t.push(document.createTextNode(a));
381
+ const f = String(s);
382
+ u && u.nodeType === 3 && u.data === f ? t.push(u) : t.push(document.createTextNode(f));
398
383
  }
399
384
  }
400
385
  return l;
401
386
  }
402
- function X(t, e, n = null) {
387
+ function J(t, e, n = null) {
403
388
  for (let i = 0, l = e.length; i < l; i++) t.insertBefore(e[i], n);
404
389
  }
405
390
  function D(t, e, n, i) {
@@ -417,21 +402,21 @@ function D(t, e, n, i) {
417
402
  } else t.insertBefore(l, n);
418
403
  return [l];
419
404
  }
420
- const ut = (t) => t != null && (t = Object.getPrototypeOf(t), t === Array.prototype || t === Object.prototype);
421
- function at(t, e, n) {
405
+ const at = (t) => t != null && (t = Object.getPrototypeOf(t), t === Array.prototype || t === Object.prototype);
406
+ function ft(t, e, n) {
422
407
  for (const [i, l] of Object.entries(e)) {
423
408
  const r = `${n}.${i}`;
424
- t[r] = l, ut(l) && at(t, l, r);
409
+ t[r] = l, at(l) && ft(t, l, r);
425
410
  }
426
411
  }
427
- function vt(t) {
412
+ function Lt(t) {
428
413
  const e = { ...t };
429
414
  for (const [n, i] of Object.entries(t))
430
- ut(i) && at(e, i, n);
415
+ at(i) && ft(e, i, n);
431
416
  return e;
432
417
  }
433
- const Lt = (t) => t;
434
- function It(t, e = Lt) {
418
+ const It = (t) => t;
419
+ function St(t, e = It) {
435
420
  return (n, ...i) => {
436
421
  n[0] === "." && (n = n.slice(1));
437
422
  const l = t()?.[n];
@@ -445,90 +430,90 @@ function It(t, e = Lt) {
445
430
  }
446
431
  };
447
432
  }
448
- const St = { insertLink: "Insert link", change: "Change", editor: { noResult: "No results found", draft: "Draft", published: "Published", sheduled: "Sheduled" }, dialog: { title: "Insert an internal link", removeLink: "Remove link", changeLink: "Find another link", ok: "OK" } }, Et = {
449
- InternalLink: St
450
- }, Dt = { insertLink: "Insérer un lien", change: "Modifier", editor: { noResult: "Aucun résultat trouvé", draft: "Brouillon", published: "Publié", sheduled: "Programmé" }, dialog: { title: "Insérer un lien interne", removeLink: "Supprimer le lien", changeLink: "Trouver un autre lien", ok: "OK" } }, Pt = {
451
- InternalLink: Dt
452
- }, J = { en: Et, fr: Pt };
453
- function K(t) {
454
- const e = _(() => {
455
- const i = t(), l = i in J ? i : "en";
456
- return vt(J[l]);
433
+ const Et = { insertLink: "Insert link", change: "Change", editor: { noResult: "No results found", draft: "Draft", published: "Published", sheduled: "Sheduled" }, dialog: { title: "Insert an internal link", removeLink: "Remove link", changeLink: "Find another link", ok: "OK" } }, Dt = {
434
+ InternalLink: Et
435
+ }, Pt = { insertLink: "Insérer un lien", change: "Modifier", editor: { noResult: "Aucun résultat trouvé", draft: "Brouillon", published: "Publié", sheduled: "Programmé" }, dialog: { title: "Insérer un lien interne", removeLink: "Supprimer le lien", changeLink: "Trouver un autre lien", ok: "OK" } }, Ct = {
436
+ InternalLink: Pt
437
+ }, Y = { en: Dt, fr: Ct };
438
+ function Q(t) {
439
+ const e = P(() => {
440
+ const i = t(), l = i in Y ? i : "en";
441
+ return Lt(Y[l]);
457
442
  });
458
- return { t: It(e) };
443
+ return { t: St(e) };
459
444
  }
460
- function Y(t) {
445
+ function z(t) {
461
446
  return t.varName ? ` for '${t.varName}'` : "";
462
447
  }
463
- function z(t, e = {}) {
448
+ function tt(t, e = {}) {
464
449
  if (t instanceof Date)
465
450
  return t;
466
451
  if (t == null || t === "")
467
- throw new Error(`Missing number value${Y(e)}`);
452
+ throw new Error(`Missing number value${z(e)}`);
468
453
  if (typeof t == "string") {
469
454
  const n = t.includes("Z") || t.includes("+");
470
455
  return new Date(n ? t : `${t}Z`);
471
456
  }
472
457
  if (typeof t == "number")
473
458
  return new Date(t);
474
- throw new Error(`Cannot convert to date the value of type '${typeof t}'${Y(e)}`);
459
+ throw new Error(`Cannot convert to date the value of type '${typeof t}'${z(e)}`);
475
460
  }
476
- var Ct = /* @__PURE__ */ y("<div class=ILResult>"), At = /* @__PURE__ */ y('<div class=ILNoResult><span class=ILNoResult-message></span><span class="pi pi-exclamation-circle">'), Tt = /* @__PURE__ */ y("<div class=InternalLinkEditor><form class=ILForm><input class=InternalLinkEditor-input type=text placeholder=Search>"), xt = /* @__PURE__ */ y("<div class=ILResultItem><div class=ILResultItem-title></div><span>");
477
- function ft(t) {
461
+ var At = /* @__PURE__ */ y("<div class=ILResult>"), Tt = /* @__PURE__ */ y('<div class=ILNoResult><span class=ILNoResult-message></span><span class="pi pi-exclamation-circle">'), xt = /* @__PURE__ */ y("<div class=InternalLinkEditor><form class=ILForm><input class=InternalLinkEditor-input type=text placeholder=Search>"), Nt = /* @__PURE__ */ y("<div class=ILResultItem><div class=ILResultItem-title></div><span>");
462
+ function dt(t) {
478
463
  const {
479
464
  value: e,
480
465
  setValue: n,
481
466
  service: i
482
467
  } = t, [l, r] = S(""), [o, s] = S([]), {
483
468
  t: u
484
- } = K(t.language);
485
- F(async () => {
486
- const a = e();
487
- if (!a) return;
488
- const h = await i.getDocument(a);
489
- r(h.title ?? ""), await $();
469
+ } = Q(t.language);
470
+ G(async () => {
471
+ const f = e();
472
+ if (!f) return;
473
+ const h = await i.getDocument(f);
474
+ r(h?.title ?? ""), await $();
490
475
  });
491
- const $ = async (a) => {
492
- if (a?.preventDefault(), l().length < 3) return;
476
+ const $ = async (f) => {
477
+ if (f?.preventDefault(), l().length < 3) return;
493
478
  const h = await i.searchDocuments({
494
479
  searchString: l()
495
480
  });
496
481
  s(h);
497
482
  };
498
483
  return (() => {
499
- var a = Tt(), h = a.firstChild, m = h.firstChild;
500
- return h.addEventListener("submit", $), m.$$input = (c) => r(c.currentTarget.value), p(a, T(Z, {
484
+ var f = xt(), h = f.firstChild, m = h.firstChild;
485
+ return h.addEventListener("submit", $), m.$$input = (c) => r(c.currentTarget.value), p(f, x(W, {
501
486
  when: o,
502
487
  get children() {
503
- var c = Ct();
504
- return p(c, () => o().map((f) => (
488
+ var c = At();
489
+ return p(c, () => o().map((a) => (
505
490
  // biome-ignore lint/correctness/useJsxKeyInIterable: no need key here
506
491
  (() => {
507
- var d = xt(), g = d.firstChild, L = g.nextSibling;
492
+ var d = Nt(), g = d.firstChild, v = g.nextSibling;
508
493
  return d.$$click = () => {
509
- n(f.id);
510
- }, p(g, () => f.title), p(L, (() => {
511
- var v = _(() => !!f.ready);
512
- return () => v() ? _(() => z(f.publishDate).getTime() < (/* @__PURE__ */ new Date()).getTime())() ? u("InternalLink.editor.published") : u("InternalLink.editor.sheduled") : u("InternalLink.editor.draft");
513
- })()), P(() => kt(L, `ILResultItem-status
514
- ${f.ready ? z(f.publishDate).getTime() < (/* @__PURE__ */ new Date()).getTime() ? "published" : "sheduled" : "draft"}`)), d;
494
+ n(a.id);
495
+ }, p(g, () => a.title), p(v, (() => {
496
+ var _ = L(() => !!a.ready);
497
+ return () => _() ? L(() => tt(a.publishDate).getTime() < (/* @__PURE__ */ new Date()).getTime())() ? u("InternalLink.editor.published") : u("InternalLink.editor.sheduled") : u("InternalLink.editor.draft");
498
+ })()), C(() => _t(v, `ILResultItem-status
499
+ ${a.ready ? tt(a.publishDate).getTime() < (/* @__PURE__ */ new Date()).getTime() ? "published" : "sheduled" : "draft"}`)), d;
515
500
  })()
516
501
  ))), c;
517
502
  }
518
- }), null), p(a, T(Z, {
503
+ }), null), p(f, x(W, {
519
504
  get when() {
520
505
  return !o() || o().length === 0;
521
506
  },
522
507
  get children() {
523
- var c = At(), f = c.firstChild;
524
- return p(f, () => u("InternalLink.editor.noResult")), c;
508
+ var c = Tt(), a = c.firstChild;
509
+ return p(a, () => u("InternalLink.editor.noResult")), c;
525
510
  }
526
- }), null), P(() => m.value = l()), a;
511
+ }), null), C(() => m.value = l()), f;
527
512
  })();
528
513
  }
529
- q(["input", "click"]);
530
- var Nt = /* @__PURE__ */ y("<div class=InternalLinkDialog-header><span class=InternalLinkDialog-title>"), Bt = /* @__PURE__ */ y('<button class="PlgBtn pi pi-arrow-left"type=button>'), Ot = /* @__PURE__ */ y("<div class=InternalLinkDialog-content>"), Vt = /* @__PURE__ */ y('<div class=ILPreview><div class=ILPreview-title></div><button class="PlgBtn outlined iconBtn pi pi-pencil"type=button>'), tt = /* @__PURE__ */ y("<div>"), Rt = /* @__PURE__ */ y('<div><button class="PlgBtn primary"type=button>'), Mt = /* @__PURE__ */ y('<button type=button class="PlgBtn danger outlined">'), et = /* @__PURE__ */ y("<button class=PlgBtn type=button>"), jt = /* @__PURE__ */ y('<button class="PlgBtn primary"type=button>'), Ut = /* @__PURE__ */ y('<div class=InternalLinkDialog-linkPreview><div></div><button class="PlgBtn iconBtn pi pi-pencil"type=button>');
531
- function Ht({
514
+ K(["input", "click"]);
515
+ var Bt = /* @__PURE__ */ y("<div class=InternalLinkDialog-header><span class=InternalLinkDialog-title>"), Ot = /* @__PURE__ */ y('<button class="PlgBtn pi pi-arrow-left"type=button>'), Vt = /* @__PURE__ */ y("<div class=InternalLinkDialog-content>"), Rt = /* @__PURE__ */ y('<div class=ILPreview><div class=ILPreview-title></div><button class="PlgBtn outlined iconBtn pi pi-pencil"type=button>'), et = /* @__PURE__ */ y("<div>"), Mt = /* @__PURE__ */ y('<div><button class="PlgBtn primary"type=button>'), jt = /* @__PURE__ */ y('<button type=button class="PlgBtn danger outlined">'), nt = /* @__PURE__ */ y("<button class=PlgBtn type=button>"), Ut = /* @__PURE__ */ y('<button class="PlgBtn primary"type=button>'), Ht = /* @__PURE__ */ y('<div class=InternalLinkDialog-linkPreview><div></div><button class="PlgBtn iconBtn pi pi-pencil"type=button>');
516
+ function Ft({
532
517
  service: t,
533
518
  setValue: e,
534
519
  value: n,
@@ -536,41 +521,43 @@ function Ht({
536
521
  }) {
537
522
  const {
538
523
  t: l
539
- } = K(i), [r, o] = S(), [s, u] = S(!!n());
540
- F(async () => {
524
+ } = Q(i), [r, o] = S(), [s, u] = S(!!n());
525
+ G(async () => {
541
526
  const c = n();
542
527
  if (!c) return;
528
+ const a = await t.getDocument(c);
529
+ if (!a) return;
543
530
  const {
544
- title: f,
545
- typeName: d
546
- } = await t.getDocument(c);
531
+ title: d,
532
+ typeName: g
533
+ } = a;
547
534
  o({
548
- title: f,
549
- typeName: d
535
+ title: d,
536
+ typeName: g
550
537
  });
551
538
  });
552
539
  const $ = (() => {
553
- var c = Nt(), f = c.firstChild;
540
+ var c = Bt(), a = c.firstChild;
554
541
  return p(c, (() => {
555
- var d = _(() => !!(n() && !s()));
542
+ var d = L(() => !!(n() && !s()));
556
543
  return () => d() && (() => {
557
- var g = Bt();
544
+ var g = Ot();
558
545
  return g.$$click = () => {
559
546
  u(!0);
560
547
  }, g;
561
548
  })();
562
- })(), f), p(f, () => l("InternalLink.dialog.title")), c;
563
- })(), a = (() => {
564
- var c = Ot();
549
+ })(), a), p(a, () => l("InternalLink.dialog.title")), c;
550
+ })(), f = (() => {
551
+ var c = Vt();
565
552
  return p(c, (() => {
566
- var f = _(() => !!(s() && n()));
567
- return () => f() ? (() => {
568
- var d = Vt(), g = d.firstChild, L = g.nextSibling;
569
- return p(g, () => r()?.title), L.$$click = () => {
570
- const v = n(), Q = r()?.typeName;
571
- !v || !Q || (m.close(), t.openDocumentEdition(v, Q));
553
+ var a = L(() => !!(s() && n()));
554
+ return () => a() ? (() => {
555
+ var d = Rt(), g = d.firstChild, v = g.nextSibling;
556
+ return p(g, () => r()?.title), v.$$click = () => {
557
+ const _ = n(), Z = r()?.typeName;
558
+ !_ || !Z || (m.close(), t.openDocumentEdition(_, Z));
572
559
  }, d;
573
- })() : T(ft, {
560
+ })() : x(dt, {
574
561
  service: t,
575
562
  language: i,
576
563
  value: n,
@@ -580,146 +567,148 @@ function Ht({
580
567
  });
581
568
  })()), c;
582
569
  })(), h = (() => {
583
- var c = tt();
570
+ var c = et();
584
571
  return p(c, (() => {
585
- var f = _(() => !!s());
586
- return () => f() ? (() => {
587
- var d = Rt(), g = d.firstChild;
572
+ var a = L(() => !!s());
573
+ return () => a() ? (() => {
574
+ var d = Mt(), g = d.firstChild;
588
575
  return p(d, (() => {
589
- var L = _(() => !!n());
590
- return () => L() && [(() => {
591
- var v = Mt();
592
- return v.$$click = () => {
576
+ var v = L(() => !!n());
577
+ return () => v() && [(() => {
578
+ var _ = jt();
579
+ return _.$$click = () => {
593
580
  e(void 0), m.hide();
594
- }, p(v, () => l("InternalLink.dialog.removeLink")), v;
581
+ }, p(_, () => l("InternalLink.dialog.removeLink")), _;
595
582
  })(), (() => {
596
- var v = et();
597
- return v.$$click = () => u(!1), p(v, () => l("InternalLink.dialog.changeLink")), v;
583
+ var _ = nt();
584
+ return _.$$click = () => u(!1), p(_, () => l("InternalLink.dialog.changeLink")), _;
598
585
  })()];
599
586
  })(), g), g.$$click = () => {
600
587
  m.hide();
601
588
  }, p(g, () => l("InternalLink.dialog.ok")), d;
602
589
  })() : (() => {
603
- var d = jt();
590
+ var d = Ut();
604
591
  return d.$$click = () => {
605
592
  m.hide();
606
593
  }, p(d, () => l("InternalLink.dialog.ok")), d;
607
594
  })();
608
595
  })()), c;
609
596
  })(), m = t.createModalDialog({
610
- content: a,
597
+ content: f,
611
598
  footer: h,
612
599
  header: $
613
600
  });
614
601
  return (() => {
615
- var c = tt();
602
+ var c = et();
616
603
  return p(c, (() => {
617
- var f = _(() => !!n());
618
- return () => f() ? (() => {
619
- var d = Ut(), g = d.firstChild, L = g.nextSibling;
620
- return p(g, () => r()?.title), L.$$click = () => m.show(), d;
604
+ var a = L(() => !!n());
605
+ return () => a() ? (() => {
606
+ var d = Ht(), g = d.firstChild, v = g.nextSibling;
607
+ return p(g, () => r()?.title), v.$$click = () => m.show(), d;
621
608
  })() : (() => {
622
- var d = et();
609
+ var d = nt();
623
610
  return d.$$click = () => m.show(), p(d, () => l("InternalLink.insertLink")), d;
624
611
  })();
625
612
  })()), c;
626
613
  })();
627
614
  }
628
- q(["click"]);
629
- var Ft = /* @__PURE__ */ y("<div class=InternalLinkDialog-header><span class=InternalLinkDialog-title>"), Gt = /* @__PURE__ */ y('<button class="PlgBtn pi pi-arrow-left"type=button>'), qt = /* @__PURE__ */ y("<div>"), Kt = /* @__PURE__ */ y('<div><button class="PlgBtn primary"type=button>'), Qt = /* @__PURE__ */ y('<button type=button class="PlgBtn danger outlined">'), Zt = /* @__PURE__ */ y("<button class=PlgBtn type=button>"), Wt = /* @__PURE__ */ y('<button class="PlgBtn primary"type=button>'), Xt = /* @__PURE__ */ y("<div class=InternalLinkDialog-content>"), Jt = /* @__PURE__ */ y('<div class=ILPreview><div class=ILPreview-title></div><button class="PlgBtn outlined iconBtn pi pi-pencil"type=button>');
630
- async function Yt({
615
+ K(["click"]);
616
+ var Gt = /* @__PURE__ */ y("<div class=InternalLinkDialog-header><span class=InternalLinkDialog-title>"), qt = /* @__PURE__ */ y('<button class="PlgBtn pi pi-arrow-left"type=button>'), Kt = /* @__PURE__ */ y("<div>"), Qt = /* @__PURE__ */ y('<div><button class="PlgBtn primary"type=button>'), Zt = /* @__PURE__ */ y('<button type=button class="PlgBtn danger outlined">'), Wt = /* @__PURE__ */ y("<button class=PlgBtn type=button>"), Xt = /* @__PURE__ */ y('<button class="PlgBtn primary"type=button>'), Jt = /* @__PURE__ */ y("<div class=InternalLinkDialog-content>"), Yt = /* @__PURE__ */ y('<div class=ILPreview><div class=ILPreview-title></div><button class="PlgBtn outlined iconBtn pi pi-pencil"type=button>');
617
+ async function zt({
631
618
  value: t,
632
619
  getLanguage: e,
633
620
  service: n
634
621
  }) {
635
622
  const [i, l] = S(), {
636
623
  t: r
637
- } = K(e), [o, s] = S(!!t());
638
- F(async () => {
624
+ } = Q(e), [o, s] = S(!!t());
625
+ G(async () => {
639
626
  const h = t();
640
627
  if (!h) return;
628
+ const m = await n.getDocument(h);
629
+ if (!m) return;
641
630
  const {
642
- title: m,
643
- typeName: c
644
- } = await n.getDocument(h);
631
+ title: c,
632
+ typeName: a
633
+ } = m;
645
634
  l({
646
- title: m,
647
- typeName: c
635
+ title: c,
636
+ typeName: a
648
637
  });
649
638
  });
650
639
  const u = (() => {
651
- var h = Ft(), m = h.firstChild;
640
+ var h = Gt(), m = h.firstChild;
652
641
  return p(h, (() => {
653
- var c = _(() => !!(t() && !o()));
642
+ var c = L(() => !!(t() && !o()));
654
643
  return () => c() && (() => {
655
- var f = Gt();
656
- return f.$$click = () => {
644
+ var a = qt();
645
+ return a.$$click = () => {
657
646
  s(!0);
658
- }, f;
647
+ }, a;
659
648
  })();
660
649
  })(), m), p(m, () => r("InternalLink.dialog.title")), h;
661
650
  })(), $ = (() => {
662
- var h = qt();
651
+ var h = Kt();
663
652
  return p(h, (() => {
664
- var m = _(() => !!o());
653
+ var m = L(() => !!o());
665
654
  return () => m() ? (() => {
666
- var c = Kt(), f = c.firstChild;
655
+ var c = Qt(), a = c.firstChild;
667
656
  return p(c, (() => {
668
- var d = _(() => !!t());
657
+ var d = L(() => !!t());
669
658
  return () => d() && [(() => {
670
- var g = Qt();
671
- return g.$$click = () => a.close("remove"), p(g, () => r("InternalLink.dialog.removeLink")), g;
672
- })(), (() => {
673
659
  var g = Zt();
660
+ return g.$$click = () => f.close("remove"), p(g, () => r("InternalLink.dialog.removeLink")), g;
661
+ })(), (() => {
662
+ var g = Wt();
674
663
  return g.$$click = () => s(!1), p(g, () => r("InternalLink.dialog.changeLink")), g;
675
664
  })()];
676
- })(), f), f.$$click = () => a.close(), p(f, () => r("InternalLink.dialog.ok")), c;
665
+ })(), a), a.$$click = () => f.close(), p(a, () => r("InternalLink.dialog.ok")), c;
677
666
  })() : (() => {
678
- var c = Wt();
679
- return c.$$click = () => a.close(), p(c, () => r("InternalLink.dialog.ok")), c;
667
+ var c = Xt();
668
+ return c.$$click = () => f.close(), p(c, () => r("InternalLink.dialog.ok")), c;
680
669
  })();
681
670
  })()), h;
682
- })(), a = n.createModalDialog({
671
+ })(), f = n.createModalDialog({
683
672
  content: (() => {
684
- var h = Xt();
673
+ var h = Jt();
685
674
  return p(h, (() => {
686
- var m = _(() => !!(o() && t()));
675
+ var m = L(() => !!(o() && t()));
687
676
  return () => m() ? (() => {
688
- var c = Jt(), f = c.firstChild, d = f.nextSibling;
689
- return p(f, () => i()?.title), d.$$click = () => {
690
- const g = t(), L = i()?.typeName;
691
- !g || !L || (a.close(), n.openDocumentEdition(g, L));
677
+ var c = Yt(), a = c.firstChild, d = a.nextSibling;
678
+ return p(a, () => i()?.title), d.$$click = () => {
679
+ const g = t(), v = i()?.typeName;
680
+ !g || !v || (f.close(), n.openDocumentEdition(g, v));
692
681
  }, c;
693
- })() : T(ft, {
682
+ })() : x(dt, {
694
683
  service: n,
695
684
  language: e,
696
685
  value: t,
697
- setValue: (c) => a.close(c)
686
+ setValue: (c) => f.close(c)
698
687
  });
699
688
  })()), h;
700
689
  })(),
701
690
  header: u,
702
691
  footer: $
703
692
  });
704
- return await a.open();
693
+ return await f.open();
705
694
  }
706
- q(["click"]);
707
- const ie = {
708
- create: ne,
709
- init: ee
695
+ K(["click"]);
696
+ const le = {
697
+ create: ie,
698
+ init: ne
710
699
  };
711
- function zt(t) {
700
+ function te(t) {
712
701
  t.executeHook("htmlEditorServiceProvider").forEach((n) => {
713
- n.registerInternalLinkPlugin(te(t));
702
+ n.registerInternalLinkPlugin(ee(t));
714
703
  });
715
704
  }
716
- function te(t) {
705
+ function ee(t) {
717
706
  return {
718
707
  async getDocumentTitle(e) {
719
- return (await t.getDocument(e)).title;
708
+ return (await t.getDocument(e))?.title;
720
709
  },
721
710
  async openDialog(e, n) {
722
- const i = await Yt({
711
+ const i = await zt({
723
712
  value: () => e,
724
713
  getLanguage: n.getLanguage,
725
714
  service: t
@@ -736,14 +725,14 @@ function te(t) {
736
725
  }
737
726
  };
738
727
  }
739
- function ee({
728
+ function ne({
740
729
  pluginBaseUrl: t,
741
730
  addAfterInitListener: e
742
731
  }) {
743
732
  const n = `${t}/bo-plugin.css`, i = document.createElement("link");
744
- i.rel = "stylesheet", i.href = n, document.head.appendChild(i), e(zt);
733
+ i.rel = "stylesheet", i.href = n, document.head.appendChild(i), e(te);
745
734
  }
746
- function ne(t) {
735
+ function ie(t) {
747
736
  const {
748
737
  fieldType: e,
749
738
  initialValue: n
@@ -752,10 +741,10 @@ function ne(t) {
752
741
  throw new Error(`field type '${e.name}' is incompatible with internal-link plugin, needs data type 'string'`);
753
742
  if (n !== void 0 && typeof n != "string")
754
743
  throw new Error(`field type '${e.name}' is incompatible, should be a string, got '${typeof n}'`);
755
- return pt((i) => {
744
+ return gt((i) => {
756
745
  const [l, r] = S(n ?? ""), [o, s] = S(t.language);
757
746
  return {
758
- element: T(Ht, {
747
+ element: x(Ft, {
759
748
  language: o,
760
749
  value: l,
761
750
  setValue: (u) => {
@@ -773,5 +762,5 @@ function ne(t) {
773
762
  });
774
763
  }
775
764
  export {
776
- ie as default
765
+ le as default
777
766
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/internal-link-plugin",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "Internal link plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -30,20 +30,19 @@
30
30
  "@paroicms/public-server-lib": "0"
31
31
  },
32
32
  "devDependencies": {
33
- "@paroicms/public-anywhere-lib": "0.21.1",
34
- "@paroicms/public-bo-lib": "0.22.1",
35
- "@paroicms/public-server-lib": "0.31.3",
36
- "@paroicms/quill-editor-plugin": "1.32.2",
37
- "@solid-primitives/i18n": "~2.2.0",
38
- "@types/node": "~22.14.1",
33
+ "@paroicms/public-anywhere-lib": "0.23.1",
34
+ "@paroicms/public-bo-lib": "0.24.1",
35
+ "@paroicms/public-server-lib": "0.34.1",
36
+ "@paroicms/quill-editor-plugin": "1.33.1",
37
+ "@solid-primitives/i18n": "~2.2.1",
38
+ "@types/node": "~24.0.1",
39
39
  "primeicons": "^7.0.0",
40
40
  "rimraf": "~6.0.1",
41
- "sass": "~1.86.3",
42
- "solid-devtools": "~0.33.0",
43
- "solid-js": "1.9.5",
44
- "sortablejs": "^1.15.2",
41
+ "sass": "~1.89.2",
42
+ "solid-devtools": "~0.34.0",
43
+ "solid-js": "1.9.7",
45
44
  "typescript": "~5.8.3",
46
- "vite": "~6.2.6",
45
+ "vite": "~6.3.5",
47
46
  "vite-plugin-solid": "~2.11.6"
48
47
  },
49
48
  "type": "module",