@paroicms/internal-link-plugin 0.5.0 → 0.6.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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
4
3
  const node_path_1 = require("node:path");
4
+ const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
5
5
  const projectDir = (0, node_path_1.dirname)(__dirname);
6
6
  const packageDir = (0, node_path_1.dirname)(projectDir);
7
7
  const version = (0, data_formatters_lib_1.strVal)(require((0, node_path_1.join)(packageDir, "package.json")).version);
@@ -240,7 +240,7 @@ function Z(t) {
240
240
  );
241
241
  }
242
242
  function bt(t, e, n) {
243
- let l = n.length, i = e.length, r = l, o = 0, s = 0, a = e[i - 1].nextSibling, $ = null;
243
+ let l = n.length, i = e.length, r = l, o = 0, s = 0, u = e[i - 1].nextSibling, $ = null;
244
244
  for (; o < i || s < r; ) {
245
245
  if (e[o] === n[s]) {
246
246
  o++, s++;
@@ -249,29 +249,29 @@ function bt(t, e, n) {
249
249
  for (; e[i - 1] === n[r - 1]; )
250
250
  i--, r--;
251
251
  if (i === o) {
252
- const u = r < l ? s ? n[s - 1].nextSibling : n[r - s] : a;
253
- for (; s < r; ) t.insertBefore(n[s++], u);
252
+ const a = r < l ? s ? n[s - 1].nextSibling : n[r - s] : u;
253
+ for (; s < r; ) t.insertBefore(n[s++], a);
254
254
  } else if (r === s)
255
255
  for (; o < i; )
256
256
  (!$ || !$.has(e[o])) && e[o].remove(), o++;
257
257
  else if (e[o] === n[r - 1] && n[s] === e[i - 1]) {
258
- const u = e[--i].nextSibling;
259
- t.insertBefore(n[s++], e[o++].nextSibling), t.insertBefore(n[--r], u), e[i] = n[r];
258
+ const a = e[--i].nextSibling;
259
+ t.insertBefore(n[s++], e[o++].nextSibling), t.insertBefore(n[--r], a), e[i] = n[r];
260
260
  } else {
261
261
  if (!$) {
262
262
  $ = /* @__PURE__ */ new Map();
263
263
  let h = s;
264
264
  for (; h < r; ) $.set(n[h], h++);
265
265
  }
266
- const u = $.get(e[o]);
267
- if (u != null)
268
- if (s < u && u < r) {
266
+ const a = $.get(e[o]);
267
+ if (a != null)
268
+ if (s < a && a < r) {
269
269
  let h = o, m = 1, c;
270
- for (; ++h < i && h < r && !((c = $.get(e[h])) == null || c !== u + m); )
270
+ for (; ++h < i && h < r && !((c = $.get(e[h])) == null || c !== a + m); )
271
271
  m++;
272
- if (m > u - s) {
272
+ if (m > a - s) {
273
273
  const f = e[o];
274
- for (; s < u; ) t.insertBefore(n[s++], f);
274
+ for (; s < a; ) t.insertBefore(n[s++], f);
275
275
  } else t.replaceChild(n[s++], e[o++]);
276
276
  } else o++;
277
277
  else e[o++].remove();
@@ -303,14 +303,14 @@ function p(t, e, n, l) {
303
303
  }
304
304
  function _t(t) {
305
305
  let e = t.target;
306
- const n = `$$${t.type}`, l = t.target, i = t.currentTarget, r = (a) => Object.defineProperty(t, "target", {
306
+ const n = `$$${t.type}`, l = t.target, i = t.currentTarget, r = (u) => Object.defineProperty(t, "target", {
307
307
  configurable: !0,
308
- value: a
308
+ value: u
309
309
  }), o = () => {
310
- const a = e[n];
311
- if (a && !e.disabled) {
310
+ const u = e[n];
311
+ if (u && !e.disabled) {
312
312
  const $ = e[`${n}Data`];
313
- if ($ !== void 0 ? a.call(e, $, t) : a.call(e, t), t.cancelBubble) return;
313
+ if ($ !== void 0 ? u.call(e, $, t) : u.call(e, t), t.cancelBubble) return;
314
314
  }
315
315
  return e.host && typeof e.host != "string" && !e.host._$host && e.contains(t.target) && r(e.host), !0;
316
316
  }, s = () => {
@@ -322,9 +322,9 @@ function _t(t) {
322
322
  return e || document;
323
323
  }
324
324
  }), t.composedPath) {
325
- const a = t.composedPath();
326
- r(a[0]);
327
- for (let $ = 0; $ < a.length - 2 && (e = a[$], !!o()); $++) {
325
+ const u = t.composedPath();
326
+ r(u[0]);
327
+ for (let $ = 0; $ < u.length - 2 && (e = u[$], !!o()); $++) {
328
328
  if (e._$host) {
329
329
  e = e._$host, s();
330
330
  break;
@@ -357,12 +357,12 @@ function M(t, e, n, l, i) {
357
357
  n = M(t, s, n, l);
358
358
  }), () => n;
359
359
  if (Array.isArray(e)) {
360
- const s = [], a = n && Array.isArray(n);
360
+ const s = [], u = n && Array.isArray(n);
361
361
  if (F(s, e, n, i))
362
362
  return P(() => n = M(t, s, n, l, !0)), () => n;
363
363
  if (s.length === 0) {
364
364
  if (n = D(t, n, l), o) return n;
365
- } else a ? n.length === 0 ? X(t, s, l) : bt(t, n, s) : (n && D(t), X(t, s));
365
+ } else u ? n.length === 0 ? X(t, s, l) : bt(t, n, s) : (n && D(t), X(t, s));
366
366
  n = s;
367
367
  } else if (e.nodeType) {
368
368
  if (Array.isArray(n)) {
@@ -377,24 +377,24 @@ function M(t, e, n, l, i) {
377
377
  function F(t, e, n, l) {
378
378
  let i = !1;
379
379
  for (let r = 0, o = e.length; r < o; r++) {
380
- let s = e[r], a = n && n[t.length], $;
380
+ let s = e[r], u = n && n[t.length], $;
381
381
  if (!(s == null || s === !0 || s === !1)) if (($ = typeof s) == "object" && s.nodeType)
382
382
  t.push(s);
383
383
  else if (Array.isArray(s))
384
- i = F(t, s, a) || i;
384
+ i = F(t, s, u) || i;
385
385
  else if ($ === "function")
386
386
  if (l) {
387
387
  for (; typeof s == "function"; ) s = s();
388
388
  i = F(
389
389
  t,
390
390
  Array.isArray(s) ? s : [s],
391
- Array.isArray(a) ? a : [a]
391
+ Array.isArray(u) ? u : [u]
392
392
  ) || i;
393
393
  } else
394
394
  t.push(s), i = !0;
395
395
  else {
396
- const u = String(s);
397
- a && a.nodeType === 3 && a.data === u ? t.push(a) : t.push(document.createTextNode(u));
396
+ const a = String(s);
397
+ u && u.nodeType === 3 && u.data === a ? t.push(u) : t.push(document.createTextNode(a));
398
398
  }
399
399
  }
400
400
  return i;
@@ -410,24 +410,24 @@ function D(t, e, n, l) {
410
410
  for (let o = e.length - 1; o >= 0; o--) {
411
411
  const s = e[o];
412
412
  if (i !== s) {
413
- const a = s.parentNode === t;
414
- !r && !o ? a ? t.replaceChild(i, s) : t.insertBefore(i, n) : a && s.remove();
413
+ const u = s.parentNode === t;
414
+ !r && !o ? u ? t.replaceChild(i, s) : t.insertBefore(i, n) : u && s.remove();
415
415
  } else r = !0;
416
416
  }
417
417
  } else t.insertBefore(i, n);
418
418
  return [i];
419
419
  }
420
- var at = (t) => t != null && (t = Object.getPrototypeOf(t), t === Array.prototype || t === Object.prototype);
421
- function ut(t, e, n) {
420
+ var ut = (t) => t != null && (t = Object.getPrototypeOf(t), t === Array.prototype || t === Object.prototype);
421
+ function at(t, e, n) {
422
422
  for (const [l, i] of Object.entries(e)) {
423
423
  const r = `${n}.${l}`;
424
- t[r] = i, at(i) && ut(t, i, r);
424
+ t[r] = i, ut(i) && at(t, i, r);
425
425
  }
426
426
  }
427
427
  function vt(t) {
428
428
  const e = { ...t };
429
429
  for (const [n, l] of Object.entries(t))
430
- at(l) && ut(e, l, n);
430
+ ut(l) && at(e, l, n);
431
431
  return e;
432
432
  }
433
433
  var Lt = (t) => t;
@@ -445,39 +445,9 @@ function It(t, e = Lt) {
445
445
  }
446
446
  };
447
447
  }
448
- const St = {
449
- insertLink: "Insert link",
450
- change: "Change",
451
- editor: {
452
- noResult: "No results found",
453
- draft: "Draft",
454
- published: "Published",
455
- sheduled: "Sheduled"
456
- },
457
- dialog: {
458
- title: "Insert an internal link",
459
- removeLink: "Remove link",
460
- changeLink: "Find another link",
461
- ok: "OK"
462
- }
463
- }, Et = {
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 = {
464
449
  InternalLink: St
465
- }, Dt = {
466
- insertLink: "Insérer un lien",
467
- change: "Modifier",
468
- editor: {
469
- noResult: "Aucun résultat trouvé",
470
- draft: "Brouillon",
471
- published: "Publié",
472
- sheduled: "Programmé"
473
- },
474
- dialog: {
475
- title: "Insérer un lien interne",
476
- removeLink: "Supprimer le lien",
477
- changeLink: "Trouver un autre lien",
478
- ok: "OK"
479
- }
480
- }, Pt = {
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 = {
481
451
  InternalLink: Dt
482
452
  }, J = { en: Et, fr: Pt };
483
453
  function Q(t) {
@@ -510,24 +480,24 @@ function ft(t) {
510
480
  setValue: n,
511
481
  service: l
512
482
  } = t, [i, r] = S(""), [o, s] = S([]), {
513
- t: a
483
+ t: u
514
484
  } = Q(t.language);
515
485
  G(async () => {
516
- const u = e();
517
- if (!u) return;
518
- const h = await l.getDocument(u);
486
+ const a = e();
487
+ if (!a) return;
488
+ const h = await l.getDocument(a);
519
489
  r(h.title ?? ""), await $();
520
490
  });
521
- const $ = async (u) => {
522
- if (u?.preventDefault(), i().length < 3) return;
491
+ const $ = async (a) => {
492
+ if (a?.preventDefault(), i().length < 3) return;
523
493
  const h = await l.searchDocuments({
524
494
  searchString: i()
525
495
  });
526
496
  s(h);
527
497
  };
528
498
  return (() => {
529
- var u = At(), h = u.firstChild, m = h.firstChild;
530
- return h.addEventListener("submit", $), m.$$input = (c) => r(c.currentTarget.value), p(u, A(Z, {
499
+ var a = At(), h = a.firstChild, m = h.firstChild;
500
+ return h.addEventListener("submit", $), m.$$input = (c) => r(c.currentTarget.value), p(a, A(Z, {
531
501
  when: o,
532
502
  get children() {
533
503
  var c = Ct();
@@ -541,22 +511,22 @@ function ft(t) {
541
511
  var v = _(() => !!f.ready);
542
512
  return () => v() ? (() => {
543
513
  var B = _(() => z(f.publishDate).getTime() < (/* @__PURE__ */ new Date()).getTime());
544
- return () => B() ? a("InternalLink.editor.published") : a("InternalLink.editor.sheduled");
545
- })() : a("InternalLink.editor.draft");
514
+ return () => B() ? u("InternalLink.editor.published") : u("InternalLink.editor.sheduled");
515
+ })() : u("InternalLink.editor.draft");
546
516
  })()), P(() => kt(L, `ILResultItem-status
547
517
  ${f.ready ? z(f.publishDate).getTime() < (/* @__PURE__ */ new Date()).getTime() ? "published" : "sheduled" : "draft"}`)), d;
548
518
  })()
549
519
  ))), c;
550
520
  }
551
- }), null), p(u, A(Z, {
521
+ }), null), p(a, A(Z, {
552
522
  get when() {
553
523
  return !o() || o().length === 0;
554
524
  },
555
525
  get children() {
556
526
  var c = Tt(), f = c.firstChild;
557
- return p(f, () => a("InternalLink.editor.noResult")), c;
527
+ return p(f, () => u("InternalLink.editor.noResult")), c;
558
528
  }
559
- }), null), P(() => m.value = i()), u;
529
+ }), null), P(() => m.value = i()), a;
560
530
  })();
561
531
  }
562
532
  K(["input", "click"]);
@@ -569,7 +539,7 @@ function Ht({
569
539
  }) {
570
540
  const {
571
541
  t: i
572
- } = Q(l), [r, o] = S(), [s, a] = S(!!n());
542
+ } = Q(l), [r, o] = S(), [s, u] = S(!!n());
573
543
  G(async () => {
574
544
  const c = n();
575
545
  if (!c) return;
@@ -589,11 +559,11 @@ function Ht({
589
559
  return () => d() && (() => {
590
560
  var g = Bt();
591
561
  return g.$$click = () => {
592
- a(!0);
562
+ u(!0);
593
563
  }, g;
594
564
  })();
595
565
  })(), f), p(f, () => i("InternalLink.dialog.title")), c;
596
- })(), u = (() => {
566
+ })(), a = (() => {
597
567
  var c = Ot();
598
568
  return p(c, (() => {
599
569
  var f = _(() => !!(s() && n()));
@@ -608,7 +578,7 @@ function Ht({
608
578
  language: l,
609
579
  value: n,
610
580
  setValue: (d) => {
611
- e(d), a(!0), m.hide();
581
+ e(d), u(!0), m.hide();
612
582
  }
613
583
  });
614
584
  })()), c;
@@ -627,7 +597,7 @@ function Ht({
627
597
  }, p(v, () => i("InternalLink.dialog.removeLink")), v;
628
598
  })(), (() => {
629
599
  var v = et();
630
- return v.$$click = () => a(!1), p(v, () => i("InternalLink.dialog.changeLink")), v;
600
+ return v.$$click = () => u(!1), p(v, () => i("InternalLink.dialog.changeLink")), v;
631
601
  })()];
632
602
  })(), g), g.$$click = () => {
633
603
  m.hide();
@@ -640,7 +610,7 @@ function Ht({
640
610
  })();
641
611
  })()), c;
642
612
  })(), m = t.createModalDialog({
643
- content: u,
613
+ content: a,
644
614
  footer: h,
645
615
  header: $
646
616
  });
@@ -680,7 +650,7 @@ async function Yt({
680
650
  typeName: c
681
651
  });
682
652
  });
683
- const a = (() => {
653
+ const u = (() => {
684
654
  var h = Ft(), m = h.firstChild;
685
655
  return p(h, (() => {
686
656
  var c = _(() => !!(t() && !o()));
@@ -701,18 +671,18 @@ async function Yt({
701
671
  var d = _(() => !!t());
702
672
  return () => d() && [(() => {
703
673
  var g = Qt();
704
- return g.$$click = () => u.close("remove"), p(g, () => r("InternalLink.dialog.removeLink")), g;
674
+ return g.$$click = () => a.close("remove"), p(g, () => r("InternalLink.dialog.removeLink")), g;
705
675
  })(), (() => {
706
676
  var g = Zt();
707
677
  return g.$$click = () => s(!1), p(g, () => r("InternalLink.dialog.changeLink")), g;
708
678
  })()];
709
- })(), f), f.$$click = () => u.close(), p(f, () => r("InternalLink.dialog.ok")), c;
679
+ })(), f), f.$$click = () => a.close(), p(f, () => r("InternalLink.dialog.ok")), c;
710
680
  })() : (() => {
711
681
  var c = Wt();
712
- return c.$$click = () => u.close(), p(c, () => r("InternalLink.dialog.ok")), c;
682
+ return c.$$click = () => a.close(), p(c, () => r("InternalLink.dialog.ok")), c;
713
683
  })();
714
684
  })()), h;
715
- })(), u = n.createModalDialog({
685
+ })(), a = n.createModalDialog({
716
686
  content: (() => {
717
687
  var h = Xt();
718
688
  return p(h, (() => {
@@ -721,20 +691,20 @@ async function Yt({
721
691
  var c = Jt(), f = c.firstChild, d = f.nextSibling;
722
692
  return p(f, () => l()?.title), d.$$click = () => {
723
693
  const g = t(), L = l()?.typeName;
724
- !g || !L || (u.close(), n.openDocumentEdition(g, L));
694
+ !g || !L || (a.close(), n.openDocumentEdition(g, L));
725
695
  }, c;
726
696
  })() : A(ft, {
727
697
  service: n,
728
698
  language: e,
729
699
  value: t,
730
- setValue: (c) => u.close(c)
700
+ setValue: (c) => a.close(c)
731
701
  });
732
702
  })()), h;
733
703
  })(),
734
- header: a,
704
+ header: u,
735
705
  footer: $
736
706
  });
737
- return await u.open();
707
+ return await a.open();
738
708
  }
739
709
  K(["click"]);
740
710
  const le = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/internal-link-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Internal link plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -30,21 +30,21 @@
30
30
  "@paroicms/public-server-lib": "0"
31
31
  },
32
32
  "devDependencies": {
33
- "@paroicms/public-anywhere-lib": "0.12.0",
34
- "@paroicms/public-bo-lib": "0.18.0",
35
- "@paroicms/public-server-lib": "0.20.0",
36
- "@paroicms/quill-editor-plugin": "^1.21.0",
33
+ "@paroicms/public-anywhere-lib": "0.14.0",
34
+ "@paroicms/public-bo-lib": "0.19.0",
35
+ "@paroicms/public-server-lib": "0.22.1",
36
+ "@paroicms/quill-editor-plugin": "^1.23.1",
37
37
  "@solid-primitives/i18n": "~2.1.1",
38
- "@types/node": "~20.14.8",
38
+ "@types/node": "~22.10.7",
39
39
  "primeicons": "^7.0.0",
40
40
  "rimraf": "~6.0.1",
41
- "sass": "~1.82.0",
42
- "solid-devtools": "~0.30.1",
43
- "solid-js": "1.9.3",
41
+ "sass": "~1.83.4",
42
+ "solid-devtools": "~0.33.0",
43
+ "solid-js": "1.9.4",
44
44
  "sortablejs": "^1.15.2",
45
- "typescript": "~5.7.2",
46
- "vite": "~5.4.11",
47
- "vite-plugin-solid": "~2.10.2"
45
+ "typescript": "~5.7.3",
46
+ "vite": "~6.0.7",
47
+ "vite-plugin-solid": "~2.11.0"
48
48
  },
49
49
  "main": "backend/dist/plugin.js",
50
50
  "files": [