@roudanio/awesome-comment 0.10.7 → 0.10.8

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
- import { i as N, r as $, c as Y, w as G, d as D, o as se, q as de, v, x as ce, y as A, z as Me, A as I, B as m, C as Pe, D as we, E, G as me, F as M, H, I as f, J as j, f as B, K as je, L as Be, M as De, N as Se, O as Ue } from "./vendor-vue-BTtW1k2s.js";
1
+ import { i as N, r as $, c as Y, w as G, d as U, o as se, q as de, v, x as ce, y as A, z as Me, A as I, B as d, C as Pe, D as we, E, G as me, F as P, H, I as f, J as B, f as D, K as je, L as Be, M as De, N as Se, O as Ue } from "./vendor-vue-BTtW1k2s.js";
2
2
  import { d as Te, c as Fe } from "./vendor-pinia-Dzo8X_0B.js";
3
3
  import { E as Ke, G as Le } from "./vendor-auth0-DkqbqvnH.js";
4
- import { u as U, c as ze } from "./vendor-i18n-B4UB934p.js";
4
+ import { u as F, c as ze } from "./vendor-i18n-B4UB934p.js";
5
5
  import { o as Ve } from "./vendor-lodash-CKuyBgAy.js";
6
6
  import { T as Ge, a as He, R as Je, B as We } from "./vendor-lucide-Cl8oS5sQ.js";
7
7
  import { d as Ye } from "./vendor-marked-B6IoMkOX.js";
@@ -41,8 +41,8 @@ function dt(e, s = {}) {
41
41
  return { valid: !1, errors: ["Content is required"] };
42
42
  const i = e.trim();
43
43
  i.length < t.minLength && n.push(`Content must be at least ${t.minLength} characters`), i.length > t.maxLength && n.push(`Content must not exceed ${t.maxLength} characters`);
44
- const d = mt(i, t.maxConsecutivePunctuation);
45
- d.valid || n.push(...d.errors), /^\w{35,}$/.test(i) && n.push("Content contains too many consecutive letters");
44
+ const m = mt(i, t.maxConsecutivePunctuation);
45
+ m.valid || n.push(...m.errors), /^\w{35,}$/.test(i) && n.push("Content contains too many consecutive letters");
46
46
  const u = pt(i, t.maxConsecutiveSpaces);
47
47
  u.valid || n.push(...u.errors);
48
48
  const l = ft(i, t.maxConsecutiveNewlines);
@@ -63,8 +63,8 @@ function mt(e, s) {
63
63
  const l = new RegExp(`\\${u}{${s + 1},}`, "g"), o = e.match(l);
64
64
  o && t.push(`Too many consecutive "${u}" (max ${s}). Found: ${o[0]}`);
65
65
  }
66
- const i = new RegExp(`[${n.join("")}]{${s + 1},}`, "g"), d = e.match(i);
67
- return d && t.push(`Too many consecutive punctuation marks (max ${s}). Found: ${d[0]}`), {
66
+ const i = new RegExp(`[${n.join("")}]{${s + 1},}`, "g"), m = e.match(i);
67
+ return m && t.push(`Too many consecutive punctuation marks (max ${s}). Found: ${m[0]}`), {
68
68
  valid: t.length === 0,
69
69
  errors: t
70
70
  };
@@ -135,31 +135,31 @@ function yt(e) {
135
135
  created_at: t,
136
136
  parent_id: n,
137
137
  ancestor_id: i,
138
- post_id: d,
138
+ post_id: m,
139
139
  user_id: u,
140
140
  ...l
141
- } = e;
141
+ } = e, o = t || l.createdAt || "", r = n ?? e.parentId, a = i ?? e.ancestorId, c = m || e.postId || "";
142
142
  return {
143
143
  ...l,
144
144
  id: Number(s),
145
145
  user_id: u,
146
146
  userId: u,
147
- parentId: Number(n),
148
- post_id: d,
149
- postId: d,
150
- ancestorId: Number(i),
147
+ parentId: Number(r),
148
+ post_id: c,
149
+ postId: c,
150
+ ancestorId: Number(a),
151
151
  status: Number(e.status),
152
- createdAt: Ne(t || l.createdAt || "")
152
+ createdAt: Ne(o)
153
153
  };
154
154
  }
155
155
  const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? JSON.parse(Ie) : {}, J = Te("store", () => {
156
- const e = N("postId"), s = N("siteId"), t = N("comments"), n = N("total"), i = $(!!t?.length), d = $(0), u = $(""), l = $([]), o = $(n || 0), r = N("ApiBaseUrl"), a = $(!1), c = $(!1);
156
+ const e = N("postId"), s = N("siteId"), t = N("comments"), n = N("total"), i = $(!!t?.length), m = $(0), u = $(""), l = $([]), o = $(n || 0), r = N("ApiBaseUrl"), a = $(!1), c = $(!1);
157
157
  function k(b) {
158
158
  const h = {}, x = [];
159
159
  b.forEach((w) => {
160
160
  p(Number(w.id));
161
- const C = yt(w);
162
- !w.ancestor_id || Number(w.ancestor_id) === 0 ? h[w.id] = C : x.push(C);
161
+ const C = yt(w), M = w.ancestor_id ?? w.ancestorId;
162
+ !M || Number(M) === 0 ? h[w.id] = C : x.push(C);
163
163
  });
164
164
  const y = V[e];
165
165
  y && (y.createdAt = new Date(y.createdAt), !y.ancestorId || Number(y.ancestorId) === 0 ? h[y.id] = y : x.push(y)), x.forEach((w) => {
@@ -170,7 +170,7 @@ const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? J
170
170
  });
171
171
  for (const w in h) {
172
172
  const C = h[w];
173
- C.children && (C.children = C.children.sort((F, K) => F.id - K.id));
173
+ C.children && (C.children = C.children.sort((M, K) => M.id - K.id));
174
174
  }
175
175
  return h;
176
176
  }
@@ -182,7 +182,7 @@ const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? J
182
182
  h = k(t);
183
183
  else {
184
184
  const x = new URLSearchParams();
185
- x.append("postId", e), s && x.append("siteId", s), x.append("start", d.value.toString());
185
+ x.append("postId", e), s && x.append("siteId", s), x.append("start", m.value.toString());
186
186
  const y = await fetch(`${r}/api/comments?${x}`);
187
187
  if (!y.ok) {
188
188
  u.value = "Load comments failed. " + y.statusText, i.value = !0, a.value = !1;
@@ -198,7 +198,7 @@ const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? J
198
198
  c.value = Object.keys(h).length > 20, c.value && delete h[Object.keys(h)[0]], Object.assign(l.value, h), i.value = !0, a.value = !1;
199
199
  }
200
200
  function _(b, h, x, y = te.Pending, w, C) {
201
- const { sub: F = "", name: K = "", picture: q = "", email: ae = "", nickname: Z = "" } = x, O = {
201
+ const { sub: M = "", name: K = "", picture: q = "", email: ae = "", nickname: Z = "" } = x, O = {
202
202
  id: b,
203
203
  post_id: e,
204
204
  postId: e,
@@ -209,19 +209,19 @@ const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? J
209
209
  email: ae,
210
210
  name: Z || K
211
211
  },
212
- user_id: F,
213
- userId: F,
212
+ user_id: M,
213
+ userId: M,
214
214
  status: y,
215
215
  isNew: !0
216
216
  };
217
217
  if (w || C) {
218
218
  O.ancestorId = w, O.parentId = C;
219
- const P = l.value[w];
220
- if (P.children || (P.children = []), w === C)
221
- P.children.unshift(O);
219
+ const j = l.value[w];
220
+ if (j.children || (j.children = []), w === C)
221
+ j.children.unshift(O);
222
222
  else {
223
- const re = P.children.findIndex((T) => Number(T.id) === C);
224
- P.children.splice(re + 1, 0, O);
223
+ const re = j.children.findIndex((T) => Number(T.id) === C);
224
+ j.children.splice(re + 1, 0, O);
225
225
  }
226
226
  } else
227
227
  O.ancestorId = 0, O.parentId = 0, l.value = { [b]: O, ...l.value };
@@ -245,7 +245,7 @@ const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? J
245
245
  postId: e,
246
246
  comments: l,
247
247
  total: o,
248
- start: d,
248
+ start: m,
249
249
  hasMore: c,
250
250
  loadingMore: a,
251
251
  loadComments: g,
@@ -263,7 +263,7 @@ function bt() {
263
263
  function i(o, r, a) {
264
264
  this.fn = o, this.context = r, this.once = a || !1;
265
265
  }
266
- function d(o, r, a, c, k) {
266
+ function m(o, r, a, c, k) {
267
267
  if (typeof a != "function")
268
268
  throw new TypeError("The listener must be a function");
269
269
  var g = new i(a, c || o, k), _ = t ? t + r : r;
@@ -337,9 +337,9 @@ function bt() {
337
337
  }
338
338
  return !0;
339
339
  }, l.prototype.on = function(o, r, a) {
340
- return d(this, o, r, a, !1);
340
+ return m(this, o, r, a, !1);
341
341
  }, l.prototype.once = function(o, r, a) {
342
- return d(this, o, r, a, !0);
342
+ return m(this, o, r, a, !0);
343
343
  }, l.prototype.removeListener = function(o, r, a, c) {
344
344
  var k = t ? t + o : o;
345
345
  if (!this._events[k]) return this;
@@ -369,7 +369,7 @@ oe && oe.toStringTag;
369
369
  oe && oe.toStringTag;
370
370
  var Q = /* @__PURE__ */ ((e) => (e.INIT = "init", e.VERIFYING = "verifying", e.VERIFIED = "verified", e.REFRESH = "refresh", e.ERROR = "error", e))(Q || {});
371
371
  const he = Te("auth", () => {
372
- const e = N("awesomeAuth"), s = !e && Ke(), t = $(!1), n = $(!1), i = $(), d = !!e, u = Y(() => e ? e.root : "");
372
+ const e = N("awesomeAuth"), s = !e && Ke(), t = $(!1), n = $(!1), i = $(), m = !!e, u = Y(() => e ? e.root : "");
373
373
  async function l() {
374
374
  return e ? e.accessToken : s ? await s.getAccessTokenSilently() : "";
375
375
  }
@@ -408,7 +408,7 @@ const he = Te("auth", () => {
408
408
  { immediate: !0 }
409
409
  )), {
410
410
  isAuthenticated: t,
411
- isAwesomeAuth: d,
411
+ isAwesomeAuth: m,
412
412
  isLoading: n,
413
413
  authEndpoint: u,
414
414
  user: i,
@@ -428,7 +428,7 @@ const he = Te("auth", () => {
428
428
  class: "ac-loading ac-loading-spinner"
429
429
  }, Lt = {
430
430
  name: "CommentForm"
431
- }, ee = /* @__PURE__ */ D({
431
+ }, ee = /* @__PURE__ */ U({
432
432
  ...Lt,
433
433
  props: {
434
434
  noVersion: { type: Boolean },
@@ -440,9 +440,9 @@ const he = Te("auth", () => {
440
440
  },
441
441
  emits: ["close", "update"],
442
442
  setup(e, { emit: s }) {
443
- const t = e, n = s, i = he(), d = J(), { t: u } = U(), l = N("ApiBaseUrl"), o = N("Auth0Domain"), r = N("siteId"), a = N("TurnstileSiteKey"), c = N("AutoFocus"), k = "0.10.7", g = $(), _ = $(), p = $(!1), S = $(t.content || ""), b = $(""), h = $(!1), x = $(""), y = $(""), w = Y(() => !i.isAuthenticated);
443
+ const t = e, n = s, i = he(), m = J(), { t: u } = F(), l = N("ApiBaseUrl"), o = N("Auth0Domain"), r = N("siteId"), a = N("TurnstileSiteKey"), c = N("AutoFocus"), k = "0.10.8", g = $(), _ = $(), p = $(!1), S = $(t.content || ""), b = $(""), h = $(!1), x = $(""), y = $(""), w = Y(() => !i.isAuthenticated);
444
444
  let C = null;
445
- function F() {
445
+ function M() {
446
446
  if (typeof window > "u") return Promise.reject(new Error("Turnstile 仅支持浏览器环境"));
447
447
  if (window.turnstile) return Promise.resolve();
448
448
  if (C) return C;
@@ -462,7 +462,7 @@ const he = Te("auth", () => {
462
462
  }
463
463
  async function K() {
464
464
  if (!(!a || !_.value)) {
465
- if (await F(), !window.turnstile) {
465
+ if (await M(), !window.turnstile) {
466
466
  b.value = "Turnstile initialization failed";
467
467
  return;
468
468
  }
@@ -545,7 +545,7 @@ const he = Te("auth", () => {
545
545
  headers: X,
546
546
  body: JSON.stringify({
547
547
  comment: L,
548
- postId: d.postId,
548
+ postId: m.postId,
549
549
  siteId: r,
550
550
  domain: o,
551
551
  ancestorId: t.ancestorId ? Number(t.ancestorId) : void 0,
@@ -562,7 +562,7 @@ const he = Te("auth", () => {
562
562
  return;
563
563
  }
564
564
  const { id: ye, status: be } = ie.data, _e = ae();
565
- t.ancestorId || t.parentId ? d.addComment(ye, L, _e, be, t.ancestorId, t.parentId) : t.currentId ? n("update", L) : d.addComment(ye, L, _e, be), S.value = "", n("close"), w.value && (q(), h.value = !1);
565
+ t.ancestorId || t.parentId ? m.addComment(ye, L, _e, be, t.ancestorId, t.parentId) : t.currentId ? n("update", L) : m.addComment(ye, L, _e, be), S.value = "", n("close"), w.value && (q(), h.value = !1);
566
566
  } catch (R) {
567
567
  b.value = R.message || String(R);
568
568
  }
@@ -571,7 +571,7 @@ const he = Te("auth", () => {
571
571
  function O() {
572
572
  i.login();
573
573
  }
574
- function P(T) {
574
+ function j(T) {
575
575
  lt(T, "Enter") && Z(T);
576
576
  }
577
577
  function re() {
@@ -594,20 +594,20 @@ const he = Te("auth", () => {
594
594
  onSubmit: ce(Z, ["prevent"])
595
595
  }, [
596
596
  A("div", At, [
597
- A("label", It, I(m(u)("your_comment")), 1),
597
+ A("label", It, I(d(u)("your_comment")), 1),
598
598
  Me(A("textarea", {
599
599
  id: "ac-comment",
600
600
  ref_key: "textarea",
601
601
  ref: g,
602
602
  "onUpdate:modelValue": L[0] || (L[0] = (z) => S.value = z),
603
- placeholder: m(u)("placeholder"),
603
+ placeholder: d(u)("placeholder"),
604
604
  class: "ac-textarea ac-textarea-bordered bg-base-200 rounded-b-none focus:outline-none",
605
605
  required: "",
606
606
  rows: "3",
607
607
  onKeydown: [
608
608
  L[1] || (L[1] = ce(() => {
609
609
  }, ["stop"])),
610
- we(P, ["enter"]),
610
+ we(j, ["enter"]),
611
611
  we(re, ["esc"])
612
612
  ],
613
613
  onKeyup: L[2] || (L[2] = ce(() => {
@@ -619,16 +619,16 @@ const he = Te("auth", () => {
619
619
  e.noVersion ? E("", !0) : (f(), v("div", {
620
620
  key: 0,
621
621
  class: me(["text-xs text-neutral-400/40", { "me-auto": !b.value }])
622
- }, " v" + I(m(k)), 3)),
622
+ }, " v" + I(d(k)), 3)),
623
623
  b.value ? (f(), v("div", Et, I(b.value), 1)) : E("", !0),
624
- h.value && !m(i).isAuthenticated ? (f(), v(M, { key: 2 }, [
625
- m(i).isAwesomeAuth ? E("", !0) : (f(), v("button", {
624
+ h.value && !d(i).isAuthenticated ? (f(), v(P, { key: 2 }, [
625
+ d(i).isAwesomeAuth ? E("", !0) : (f(), v("button", {
626
626
  key: 0,
627
627
  class: "ac-btn ac-btn-secondary ac-btn-xs mx-4",
628
628
  type: "button",
629
629
  onClick: O
630
- }, I(m(u)("login")), 1)),
631
- m(a) ? (f(), v("div", {
630
+ }, I(d(u)("login")), 1)),
631
+ d(a) ? (f(), v("div", {
632
632
  key: 1,
633
633
  ref_key: "turnstileContainer",
634
634
  ref: _,
@@ -636,16 +636,16 @@ const he = Te("auth", () => {
636
636
  }, null, 512)) : E("", !0)
637
637
  ], 64)) : E("", !0),
638
638
  A("button", {
639
- disabled: p.value || h.value && !m(i).isAuthenticated && !x.value,
639
+ disabled: p.value || h.value && !d(i).isAuthenticated && !x.value,
640
640
  class: "ac-btn ac-btn-primary ac-btn-sm"
641
641
  }, [
642
642
  p.value ? (f(), v("span", Tt)) : E("", !0),
643
- e.currentId ? (f(), v(M, { key: 1 }, [
644
- H(I(m(u)("save_editing")), 1)
645
- ], 64)) : e.parentId ? (f(), v(M, { key: 2 }, [
646
- H(I(m(u)("post_reply")), 1)
647
- ], 64)) : (f(), v(M, { key: 3 }, [
648
- H(I(m(u)("post_comment")), 1)
643
+ e.currentId ? (f(), v(P, { key: 1 }, [
644
+ H(I(d(u)("save_editing")), 1)
645
+ ], 64)) : e.parentId ? (f(), v(P, { key: 2 }, [
646
+ H(I(d(u)("post_reply")), 1)
647
+ ], 64)) : (f(), v(P, { key: 3 }, [
648
+ H(I(d(u)("post_comment")), 1)
649
649
  ], 64))
650
650
  ], 8, St)
651
651
  ])
@@ -658,14 +658,14 @@ const he = Te("auth", () => {
658
658
  }, Mt = { class: "text-sm text-gray-500 dark:text-gray-400" }, Pt = ["aria-label", "title", "disabled"], jt = {
659
659
  key: 0,
660
660
  class: "ac-loading ac-loading-spinner"
661
- }, Bt = ["aria-label", "title"], le = "awesome-comment-likes", Dt = /* @__PURE__ */ D({
661
+ }, Bt = ["aria-label", "title"], le = "awesome-comment-likes", Dt = /* @__PURE__ */ U({
662
662
  __name: "comment-actions",
663
663
  props: {
664
664
  comment: {}
665
665
  },
666
666
  emits: ["reply"],
667
667
  setup(e, { emit: s }) {
668
- const t = e, n = s, i = J(), { t: d } = U(), u = N("ApiBaseUrl"), l = N("siteId"), o = $(0);
668
+ const t = e, n = s, i = J(), { t: m } = F(), u = N("ApiBaseUrl"), l = N("siteId"), o = $(0);
669
669
  async function r(a = !0) {
670
670
  if (o.value) return;
671
671
  const c = localStorage.getItem(le);
@@ -697,71 +697,71 @@ const he = Te("auth", () => {
697
697
  }
698
698
  return (a, c) => (f(), v("div", Nt, [
699
699
  A("button", {
700
- "aria-label": m(d)("like"),
701
- title: m(d)("like"),
700
+ "aria-label": d(m)("like"),
701
+ title: d(m)("like"),
702
702
  class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none",
703
703
  disabled: o.value !== 0,
704
704
  type: "button",
705
705
  onClick: c[0] || (c[0] = (k) => r())
706
706
  }, [
707
- o.value > 0 ? (f(), v("span", Ot)) : (f(), j(m(Ge), {
707
+ o.value > 0 ? (f(), v("span", Ot)) : (f(), B(d(Ge), {
708
708
  key: 1,
709
709
  size: 16
710
710
  }))
711
711
  ], 8, Rt),
712
712
  A("span", Mt, I(e.comment.like || 0), 1),
713
713
  A("button", {
714
- "aria-label": m(d)("dislike"),
715
- title: m(d)("dislike"),
714
+ "aria-label": d(m)("dislike"),
715
+ title: d(m)("dislike"),
716
716
  class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none",
717
717
  disabled: o.value !== 0,
718
718
  type: "button",
719
719
  onClick: c[1] || (c[1] = (k) => r(!1))
720
720
  }, [
721
- o.value < 0 ? (f(), v("span", jt)) : (f(), j(m(He), {
721
+ o.value < 0 ? (f(), v("span", jt)) : (f(), B(d(He), {
722
722
  key: 1,
723
723
  size: 16
724
724
  }))
725
725
  ], 8, Pt),
726
726
  A("button", {
727
- "aria-label": m(d)("reply"),
728
- title: m(d)("reply"),
727
+ "aria-label": d(m)("reply"),
728
+ title: d(m)("reply"),
729
729
  class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none -me-1.5",
730
730
  type: "button",
731
731
  onClick: c[2] || (c[2] = (k) => n("reply"))
732
732
  }, [
733
- B(m(Je), { size: 16 })
733
+ D(d(Je), { size: 16 })
734
734
  ], 8, Bt)
735
735
  ]));
736
736
  }
737
737
  }), Ut = ["href"], Ft = ["innerHTML"], Kt = {
738
738
  key: 1,
739
739
  class: "text-gray-500 break-words overflow-x-auto whitespace-pre-line pb-3 mb-0 dark:text-gray-400"
740
- }, zt = ["href"], Vt = /* @__PURE__ */ D({
740
+ }, zt = ["href"], Vt = /* @__PURE__ */ U({
741
741
  __name: "comment-content",
742
742
  props: {
743
743
  ancestorId: {},
744
744
  comment: {}
745
745
  },
746
746
  setup(e) {
747
- const s = e, { t } = U(), n = J();
747
+ const s = e, { t } = F(), n = J();
748
748
  function i(u) {
749
749
  return Ye(u).replace(/<a/g, '<a target="_blank"');
750
750
  }
751
- function d(u) {
751
+ function m(u) {
752
752
  if (s.ancestorId) {
753
753
  const o = n.comments[s.ancestorId]?.children?.find((r) => Number(r.id) === Number(u));
754
754
  return o?.isAdmin ? t("admin") : o?.user?.name || o?.user?.email || "";
755
755
  }
756
756
  return "";
757
757
  }
758
- return (u, l) => e.comment.isAdmin ? (f(), v(M, { key: 0 }, [
758
+ return (u, l) => e.comment.isAdmin ? (f(), v(P, { key: 0 }, [
759
759
  e.comment.parentId && e.comment.parentId !== e.comment.ancestorId ? (f(), v("a", {
760
760
  key: 0,
761
761
  href: `#awcm-${e.comment.parentId}`,
762
762
  class: "inline-block px-2 py-1 rounded-lg mt-2 bg-base-300 text-gray-500 dark:bg-neutral-400/20 dark:text-gray-400",
763
763
  target: "_self"
764
- }, "@" + I(d(e.comment.parentId)), 9, Ut)) : E("", !0),
764
+ }, "@" + I(m(e.comment.parentId)), 9, Ut)) : E("", !0),
765
765
  A("article", {
766
766
  class: "text-gray-500 break-words overflow-x-auto dark:text-gray-400",
767
767
  innerHTML: i(e.comment.content)
@@ -772,7 +772,7 @@ const he = Te("auth", () => {
772
772
  href: `#awcm-${e.comment.parentId}`,
773
773
  class: "inline-block px-2 py-1 rounded-lg me-1 bg-base-300 text-gray-500 dark:bg-neutral-400/20 dark:text-gray-400",
774
774
  target: "_self"
775
- }, "@" + I(d(e.comment.parentId)), 9, zt)) : E("", !0),
775
+ }, "@" + I(m(e.comment.parentId)), 9, zt)) : E("", !0),
776
776
  H(I(e.comment.content), 1)
777
777
  ]));
778
778
  }
@@ -791,7 +791,7 @@ function Gt(e) {
791
791
  const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text-white" }, Jt = { class: "ac-avatar" }, Wt = {
792
792
  key: 0,
793
793
  class: "w-6 h-6"
794
- }, Yt = ["alt", "src"], qt = { class: "text-neutral-content mix-blend-color-dodge uppercase font-bold leading-6" }, Zt = ["data-tip"], Xt = ["href"], Qt = ["datetime", "title"], en = /* @__PURE__ */ D({
794
+ }, Yt = ["alt", "src"], qt = { class: "text-neutral-content mix-blend-color-dodge uppercase font-bold leading-6" }, Zt = ["data-tip"], Xt = ["href"], Qt = ["datetime", "title"], en = /* @__PURE__ */ U({
795
795
  __name: "comment-header",
796
796
  props: {
797
797
  comment: {},
@@ -800,7 +800,7 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
800
800
  },
801
801
  emits: ["edit"],
802
802
  setup(e, { emit: s }) {
803
- const t = e, n = s, { t: i } = U(), d = Y(() => {
803
+ const t = e, n = s, { t: i } = F(), m = Y(() => {
804
804
  if (t.comment.isAdmin) return i("admin");
805
805
  let l = t.comment.user?.name || i("anonymous");
806
806
  return l = l.replace(gt, ""), l;
@@ -812,25 +812,25 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
812
812
  A("div", Jt, [
813
813
  e.comment.user?.avatar ? (f(), v("div", Wt, [
814
814
  A("img", {
815
- alt: d.value,
815
+ alt: m.value,
816
816
  src: e.comment.user?.avatar,
817
817
  class: "rounded-full max-w-full max-h-full"
818
818
  }, null, 8, Yt)
819
819
  ])) : (f(), v("div", {
820
820
  key: 1,
821
- style: je({ "background-color": m(Gt)(d.value) }),
821
+ style: je({ "background-color": d(Gt)(m.value) }),
822
822
  class: "avatar-char rounded-full w-6 h-6 text-center"
823
823
  }, [
824
- A("span", qt, I(d.value.substring(0, 1)), 1)
824
+ A("span", qt, I(m.value.substring(0, 1)), 1)
825
825
  ], 4))
826
826
  ]),
827
- H(" " + I(d.value) + " ", 1),
827
+ H(" " + I(m.value) + " ", 1),
828
828
  e.comment.isAdmin ? (f(), v("div", {
829
829
  key: 0,
830
- "data-tip": m(i)("admin"),
830
+ "data-tip": d(i)("admin"),
831
831
  class: "ac-tooltip text-success"
832
832
  }, [
833
- B(m(We), {
833
+ D(d(We), {
834
834
  class: "block",
835
835
  size: 18
836
836
  })
@@ -841,16 +841,16 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
841
841
  }, [
842
842
  A("time", {
843
843
  datetime: e.comment.createdAt.toISOString(),
844
- title: m(Ae)(e.comment.createdAt),
844
+ title: d(Ae)(e.comment.createdAt),
845
845
  class: "text-xs text-gray-600 dark:text-gray-400"
846
- }, I(m(Ae)(e.comment.createdAt)), 9, Qt)
846
+ }, I(d(Ae)(e.comment.createdAt)), 9, Qt)
847
847
  ], 8, Xt),
848
848
  e.isEditable ? (f(), v("button", {
849
849
  key: 1,
850
850
  class: "ac-btn ac-btn-link ac-btn-xs hover:no-underline",
851
851
  type: "button",
852
852
  onClick: o[0] || (o[0] = (r) => n("edit"))
853
- }, I(m(i)("edit")), 1)) : E("", !0)
853
+ }, I(d(i)("edit")), 1)) : E("", !0)
854
854
  ]));
855
855
  }
856
856
  }), tn = ["id"], nn = { class: "flex justify-between items-center font-sans" }, on = {
@@ -858,7 +858,7 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
858
858
  class: "italic mt-4 text-emerald-600 mb-0 text-sm dark:text-emerald-300"
859
859
  }, sn = {
860
860
  name: "CommentItem"
861
- }, an = /* @__PURE__ */ D({
861
+ }, an = /* @__PURE__ */ U({
862
862
  ...sn,
863
863
  props: {
864
864
  comment: {},
@@ -868,44 +868,44 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
868
868
  ancestorId: {}
869
869
  },
870
870
  setup(e) {
871
- const s = e, { t } = U(), n = J(), i = he();
872
- let d;
871
+ const s = e, { t } = F(), n = J(), i = he();
872
+ let m;
873
873
  const u = $(Date.now()), l = $(!1), o = $(!1), r = Y(() => s.comment.userId === i.user?.sub && u.value - s.comment.createdAt.getTime() < 36e5);
874
874
  return se(() => {
875
- r.value && (d = setInterval(() => {
876
- u.value = Date.now(), r.value || clearInterval(d);
875
+ r.value && (m = setInterval(() => {
876
+ u.value = Date.now(), r.value || clearInterval(m);
877
877
  }, 1e3));
878
878
  }), Be(() => {
879
- clearInterval(d);
879
+ clearInterval(m);
880
880
  }), (a, c) => {
881
881
  const k = De("comment-item", !0);
882
882
  return f(), v("div", {
883
883
  id: "awcm-" + e.comment.id,
884
884
  class: me([[{ "animated flash": e.comment.isNew }, e.isFirstLevel ? "mb-4" : e.isFirst ? "-mt-4" : "mt-1"], "comment-item target:outline target:outline-green-500 target:outline-2 dark:target:outline-1"]),
885
- onAnimationend: c[6] || (c[6] = (g) => m(n).updateComment(e.comment.id, { isNew: !1 }))
885
+ onAnimationend: c[6] || (c[6] = (g) => d(n).updateComment(e.comment.id, { isNew: !1 }))
886
886
  }, [
887
887
  A("div", {
888
888
  class: me(["pt-2 px-4 text-base bg-base-200 dark:bg-gray-900", [{ "rounded-lg": e.isFirstLevel, "rounded-b-lg": e.isLast, "rounded-t-lg shadow-outline-md": e.isFirst }, e.comment.children?.length ? "pb-6" : "pb-3"]])
889
889
  }, [
890
890
  A("header", nn, [
891
- B(en, {
891
+ D(en, {
892
892
  comment: e.comment,
893
893
  "is-editable": r.value,
894
894
  "is-editing": l.value,
895
895
  onEdit: c[0] || (c[0] = (g) => l.value = !l.value)
896
896
  }, null, 8, ["comment", "is-editable", "is-editing"]),
897
- B(Dt, {
897
+ D(Dt, {
898
898
  comment: e.comment,
899
899
  onReply: c[1] || (c[1] = (g) => o.value = !o.value)
900
900
  }, null, 8, ["comment"])
901
901
  ]),
902
- B(Vt, {
902
+ D(Vt, {
903
903
  "ancestor-id": e.ancestorId,
904
904
  comment: e.comment
905
905
  }, null, 8, ["ancestor-id", "comment"]),
906
- e.comment.status === m(te).Pending ? (f(), v("p", on, I(m(t)("approve_hint")), 1)) : E("", !0)
906
+ e.comment.status === d(te).Pending ? (f(), v("p", on, I(d(t)("approve_hint")), 1)) : E("", !0)
907
907
  ], 2),
908
- l.value ? (f(), j(ee, {
908
+ l.value ? (f(), B(ee, {
909
909
  key: 0,
910
910
  content: e.comment.content,
911
911
  "current-id": e.comment.id,
@@ -913,9 +913,9 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
913
913
  class: "mt-3",
914
914
  "no-version": "",
915
915
  onClose: c[2] || (c[2] = (g) => l.value = !1),
916
- onUpdate: c[3] || (c[3] = (g) => m(n).updateComment(e.comment.id, { content: g }))
916
+ onUpdate: c[3] || (c[3] = (g) => d(n).updateComment(e.comment.id, { content: g }))
917
917
  }, null, 8, ["content", "current-id", "status"])) : E("", !0),
918
- o.value && e.isFirstLevel ? (f(), j(ee, {
918
+ o.value && e.isFirstLevel ? (f(), B(ee, {
919
919
  key: 1,
920
920
  "ancestor-id": e.ancestorId,
921
921
  "parent-id": Number(e.comment.id),
@@ -923,7 +923,7 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
923
923
  "no-version": "",
924
924
  onClose: c[4] || (c[4] = (g) => o.value = !1)
925
925
  }, null, 8, ["ancestor-id", "parent-id"])) : E("", !0),
926
- e.comment.children?.length ? (f(!0), v(M, { key: 2 }, Se(e.comment.children, (g, _) => (f(), j(k, {
926
+ e.comment.children?.length ? (f(!0), v(P, { key: 2 }, Se(e.comment.children, (g, _) => (f(), B(k, {
927
927
  key: g.id,
928
928
  "ancestor-id": e.ancestorId,
929
929
  comment: g,
@@ -932,7 +932,7 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
932
932
  "is-last": _ === e.comment.children.length - 1,
933
933
  class: "ms-7"
934
934
  }, null, 8, ["ancestor-id", "comment", "is-first", "is-last"]))), 128)) : E("", !0),
935
- o.value && !e.isFirstLevel ? (f(), j(ee, {
935
+ o.value && !e.isFirstLevel ? (f(), B(ee, {
936
936
  key: 3,
937
937
  "ancestor-id": e.ancestorId,
938
938
  "parent-id": e.comment.id,
@@ -954,34 +954,34 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
954
954
  class: "py-8 text-center"
955
955
  }, dn = {
956
956
  name: "CommentSections"
957
- }, mn = /* @__PURE__ */ D({
957
+ }, mn = /* @__PURE__ */ U({
958
958
  ...dn,
959
959
  setup(e) {
960
- const { t: s } = U(), t = J();
960
+ const { t: s } = F(), t = J();
961
961
  function n() {
962
962
  t.start += 20, t.loadComments();
963
963
  }
964
964
  return se(() => {
965
965
  t.isLoaded || t.loadComments();
966
- }), (i, d) => m(t).isLoaded ? (f(), v("div", rn, [
967
- (f(!0), v(M, null, Se(Object.values(m(t).comments).reverse(), (u) => (f(), j(an, {
966
+ }), (i, m) => d(t).isLoaded ? (f(), v("div", rn, [
967
+ (f(!0), v(P, null, Se(Object.values(d(t).comments).reverse(), (u) => (f(), B(an, {
968
968
  key: u.id,
969
969
  "ancestor-id": u.id,
970
970
  comment: u,
971
971
  "parent-id": u.parentId,
972
972
  "is-first-level": ""
973
973
  }, null, 8, ["ancestor-id", "comment", "parent-id"]))), 128)),
974
- m(t).hasMore ? (f(), v("button", {
974
+ d(t).hasMore ? (f(), v("button", {
975
975
  key: 0,
976
- disabled: m(t).loadingMore,
976
+ disabled: d(t).loadingMore,
977
977
  class: "ac-btn h-11 min-h-fit ac-btn-block text-white border-0 bg-green-middle hover:bg-green-middle/75 hover:text-white",
978
978
  type: "button",
979
979
  onClick: n
980
980
  }, [
981
- m(t).loadingMore ? (f(), v("span", ln)) : E("", !0),
982
- H(" " + I(m(s)("load_more")), 1)
981
+ d(t).loadingMore ? (f(), v("span", ln)) : E("", !0),
982
+ H(" " + I(d(s)("load_more")), 1)
983
983
  ], 8, cn)) : E("", !0)
984
- ])) : (f(), v("div", un, [...d[0] || (d[0] = [
984
+ ])) : (f(), v("div", un, [...m[0] || (m[0] = [
985
985
  A("span", { class: "ac-loading ac-loading-spinner text-base-content" }, null, -1)
986
986
  ])]));
987
987
  }
@@ -1008,10 +1008,10 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
1008
1008
  }, An = {
1009
1009
  key: 0,
1010
1010
  class: "border-b border-neutral pb-2 mb-2 pointer-events-none"
1011
- }, In = { class: "text-base-content" }, $n = ["disabled"], Cn = ["disabled"], En = /* @__PURE__ */ D({
1011
+ }, In = { class: "text-base-content" }, $n = ["disabled"], Cn = ["disabled"], En = /* @__PURE__ */ U({
1012
1012
  __name: "App",
1013
1013
  setup(e) {
1014
- const s = J(), { t } = U(), n = he(), i = $(), d = Y(() => {
1014
+ const s = J(), { t } = F(), n = he(), i = $(), m = Y(() => {
1015
1015
  const r = s.hasMore ? s.total + "+" : s.total;
1016
1016
  if (s.total === 0) return "0";
1017
1017
  const a = new CustomEvent("AwesomeComment:total", {
@@ -1051,51 +1051,51 @@ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text
1051
1051
  r || o();
1052
1052
  }
1053
1053
  ), (r, a) => (f(), v("div", pn, [
1054
- m(s).message ? (f(), v("div", fn, [
1055
- A("p", null, I(m(s).message), 1)
1054
+ d(s).message ? (f(), v("div", fn, [
1055
+ A("p", null, I(d(s).message), 1)
1056
1056
  ])) : E("", !0),
1057
1057
  A("header", hn, [
1058
- A("h2", vn, I(m(t)("discussion")) + " (" + I(d.value) + ") ", 1),
1059
- m(n).isLoading ? (f(), v("span", gn)) : m(n).isAuthenticated && m(n).user ? (f(), v("div", yn, [
1060
- m(n).user.picture ? (f(), v("label", bn, [
1058
+ A("h2", vn, I(d(t)("discussion")) + " (" + I(m.value) + ") ", 1),
1059
+ d(n).isLoading ? (f(), v("span", gn)) : d(n).isAuthenticated && d(n).user ? (f(), v("div", yn, [
1060
+ d(n).user.picture ? (f(), v("label", bn, [
1061
1061
  A("span", _n, [
1062
1062
  A("img", {
1063
- alt: m(n).user.name || m(n).user.email,
1064
- src: m(n).user.picture,
1063
+ alt: d(n).user.name || d(n).user.email,
1064
+ src: d(n).user.picture,
1065
1065
  class: "w-full h-full block"
1066
1066
  }, null, 8, wn)
1067
1067
  ])
1068
- ])) : (f(), v("label", kn, I(m(n).user.email), 1)),
1068
+ ])) : (f(), v("label", kn, I(d(n).user.email), 1)),
1069
1069
  A("ul", xn, [
1070
- m(n).user.picture ? (f(), v("li", An, [
1071
- A("span", In, I(m(n).user.email), 1)
1070
+ d(n).user.picture ? (f(), v("li", An, [
1071
+ A("span", In, I(d(n).user.email), 1)
1072
1072
  ])) : E("", !0),
1073
1073
  A("li", null, [
1074
1074
  A("button", {
1075
- disabled: m(n).isLoading,
1075
+ disabled: d(n).isLoading,
1076
1076
  class: "border-0 bg-base-100",
1077
1077
  type: "button",
1078
1078
  onClick: l
1079
- }, I(m(t)("logout")), 9, $n)
1079
+ }, I(d(t)("logout")), 9, $n)
1080
1080
  ])
1081
1081
  ])
1082
- ])) : (f(), v(M, { key: 2 }, [
1083
- m(n).isAwesomeAuth ? (f(), v("div", {
1082
+ ])) : (f(), v(P, { key: 2 }, [
1083
+ d(n).isAwesomeAuth ? (f(), v("div", {
1084
1084
  key: 0,
1085
1085
  ref_key: "googleButton",
1086
1086
  ref: i,
1087
1087
  class: "g-id-signin"
1088
1088
  }, null, 512)) : (f(), v("button", {
1089
1089
  key: 1,
1090
- disabled: m(n).isLoading,
1090
+ disabled: d(n).isLoading,
1091
1091
  class: "ac-btn ac-btn-secondary ac-btn-xs",
1092
1092
  type: "button",
1093
1093
  onClick: u
1094
- }, I(m(t)("login")), 9, Cn))
1094
+ }, I(d(t)("login")), 9, Cn))
1095
1095
  ], 64))
1096
1096
  ]),
1097
- B(ee),
1098
- B(mn)
1097
+ D(ee),
1098
+ D(mn)
1099
1099
  ]));
1100
1100
  }
1101
1101
  }), Ee = [];
@@ -1105,7 +1105,7 @@ function Sn({
1105
1105
  clientId: s,
1106
1106
  locale: t = navigator.language
1107
1107
  }) {
1108
- const n = Ue(En), i = Fe(), d = fe || e && s && Le({
1108
+ const n = Ue(En), i = Fe(), m = fe || e && s && Le({
1109
1109
  domain: e,
1110
1110
  clientId: s,
1111
1111
  authorizationParams: {
@@ -1120,7 +1120,7 @@ function Sn({
1120
1120
  "zh-CN": ke.cn
1121
1121
  }
1122
1122
  });
1123
- return d && n.use(d), n.use(i), n.use(u), n;
1123
+ return m && n.use(m), n.use(i), n.use(u), n;
1124
1124
  }
1125
1125
  const jn = {
1126
1126
  postId: "",
@@ -1135,15 +1135,15 @@ const jn = {
1135
1135
  apiUrl: t,
1136
1136
  domain: n,
1137
1137
  clientId: i,
1138
- awesomeAuth: d,
1138
+ awesomeAuth: m,
1139
1139
  turnstileSiteKey: u,
1140
1140
  locale: l = navigator.language,
1141
1141
  siteId: o,
1142
1142
  autoFocus: r
1143
1143
  } = {}) {
1144
- s ??= this.postId, t ??= this.apiUrl, n ??= this.domain || "", i ??= this.clientId, d ??= this.awesomeAuth, u ??= this.turnstileSiteKey, o ??= this.siteId;
1144
+ s ??= this.postId, t ??= this.apiUrl, n ??= this.domain || "", i ??= this.clientId, m ??= this.awesomeAuth, u ??= this.turnstileSiteKey, o ??= this.siteId;
1145
1145
  const a = Sn({ domain: n, clientId: i, locale: l });
1146
- a.provide("ApiBaseUrl", t), a.provide("postId", s), a.provide("Auth0Domain", n), a.provide("comments", Ee), a.provide("total", ue), a.provide("awesomeAuth", d), a.provide("TurnstileSiteKey", u), a.provide("siteId", o), a.provide("AutoFocus", r || !1), a.mount(e);
1146
+ a.provide("ApiBaseUrl", t), a.provide("postId", s), a.provide("Auth0Domain", n), a.provide("comments", Ee), a.provide("total", ue), a.provide("awesomeAuth", m), a.provide("TurnstileSiteKey", u), a.provide("siteId", o), a.provide("AutoFocus", r || !1), a.mount(e);
1147
1147
  },
1148
1148
  async preload({
1149
1149
  postId: e,
@@ -1151,10 +1151,10 @@ const jn = {
1151
1151
  domain: t,
1152
1152
  clientId: n,
1153
1153
  awesomeAuth: i,
1154
- turnstileSiteKey: d,
1154
+ turnstileSiteKey: m,
1155
1155
  siteId: u
1156
1156
  }) {
1157
- if (this.postId = e || "", this.apiUrl = s || "", this.domain = t || "", this.clientId = n || "", this.turnstileSiteKey = d || "", this.siteId = u || "", t && n && (fe = Le({
1157
+ if (this.postId = e || "", this.apiUrl = s || "", this.domain = t || "", this.clientId = n || "", this.turnstileSiteKey = m || "", this.siteId = u || "", t && n && (fe = Le({
1158
1158
  domain: t,
1159
1159
  clientId: n,
1160
1160
  authorizationParams: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roudanio/awesome-comment",
3
- "version": "0.10.7",
3
+ "version": "0.10.8",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@auth0/auth0-vue": "^2.5.0",