@wpic/ui 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wpic-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as X, openBlock as e, createBlock as O, resolveDynamicComponent as $1, normalizeClass as p, withCtx as h1, createElementVNode as a, createCommentVNode as m, renderSlot as q, createElementBlock as l, createVNode as w, unref as f, Fragment as W, renderList as a1, toDisplayString as z, useModel as G1, useSlots as Q2, computed as M, ref as F, mergeProps as h2, createTextVNode as b1, withDirectives as P1, vModelDynamic as b0, mergeModels as _1, vModelCheckbox as Y0, watch as L1, normalizeStyle as f1, withModifiers as p1, onMounted as P2, onBeforeUnmount as p2, withKeys as M2, inject as J2, provide as s2, isRef as q0, nextTick as H1, Teleport as W1, vShow as Q0, Transition as X1, vModelText as c2, useAttrs as J0, getCurrentInstance as X0, onUnmounted as G0, TransitionGroup as _0, useCssVars as n3, vModelSelect as e3, createStaticVNode as A1 } from "vue";
1
+ import { defineComponent as X, openBlock as e, createBlock as O, resolveDynamicComponent as $1, normalizeClass as p, withCtx as h1, createElementVNode as a, createCommentVNode as m, renderSlot as q, createElementBlock as l, createVNode as w, unref as f, Fragment as W, renderList as a1, toDisplayString as z, useModel as G1, useSlots as Q2, computed as M, ref as F, mergeProps as h2, createTextVNode as b1, withDirectives as P1, vModelDynamic as b0, mergeModels as _1, vModelCheckbox as Y0, watch as M1, normalizeStyle as f1, withModifiers as p1, onMounted as P2, onBeforeUnmount as p2, withKeys as M2, inject as J2, provide as s2, isRef as q0, nextTick as H1, Teleport as W1, vShow as Q0, Transition as X1, vModelText as c2, useAttrs as J0, getCurrentInstance as X0, onUnmounted as G0, TransitionGroup as _0, useCssVars as n3, vModelSelect as e3, createStaticVNode as A1 } from "vue";
2
2
  import { Loader2 as i2, Calendar as p0, DollarSign as t3, X as B1, Check as K1, Search as T2, ChevronUp as g0, ChevronDown as U1, ChevronsUpDown as X2, ChevronRight as T1, ChevronLeft as g2, Download as l3, Minimize as a3, Expand as c3, CalendarDays as j2, FolderSymlink as i3, Minimize2 as o3, Maximize2 as s3, Plus as w2, Trash2 as r3, Folder as v0, MoreHorizontal as d3, Bot as u3, Paperclip as O2, ThumbsUp as h3, ThumbsDown as v3, Copy as m3, Pencil as f3, MessageSquarePlus as z3, Square as b3, ArrowUp as p3, CircleAlert as g3, CircleCheck as C3, ShieldAlert as k3, Lightbulb as x3, PanelLeftOpen as y3, PanelLeftClose as w3, AlertTriangle as M3, Tag as F2, Clock as V3, RefreshCw as L3 } from "lucide-vue-next";
3
3
  import { offset as v2, flip as m2, shift as f2, size as G2, useFloating as z2, autoUpdate as b2 } from "@floating-ui/vue";
4
4
  import { defineStore as B3 } from "pinia";
@@ -26,7 +26,7 @@ const $3 = {
26
26
  "data-variant": t.variant ?? "primary",
27
27
  "data-size": t.size ?? "md",
28
28
  "data-active": n.active ? "true" : void 0,
29
- onClick: c[0] || (c[0] = (o) => !n.href && s("click", o)),
29
+ onClick: c[0] || (c[0] = (o) => s("click", o)),
30
30
  class: p([
31
31
  "wpic-button",
32
32
  "relative inline-flex items-center justify-center font-medium transition-all duration-150 cursor-pointer select-none",
@@ -352,8 +352,8 @@ const $3 = {
352
352
  if (x.value) {
353
353
  const J = x.value;
354
354
  H = [...H].sort((I, Q) => {
355
- const c1 = I[J] ?? "", w1 = Q[J] ?? "", M1 = typeof c1 == "number" && typeof w1 == "number" ? c1 - w1 : String(c1).toLowerCase().localeCompare(String(w1).toLowerCase());
356
- return i.value === "asc" ? M1 : -M1;
355
+ const c1 = I[J] ?? "", w1 = Q[J] ?? "", V1 = typeof c1 == "number" && typeof w1 == "number" ? c1 - w1 : String(c1).toLowerCase().localeCompare(String(w1).toLowerCase());
356
+ return i.value === "asc" ? V1 : -V1;
357
357
  });
358
358
  }
359
359
  return H;
@@ -363,7 +363,7 @@ const $3 = {
363
363
  k.value ? u("update:serverPage", H) : V.value = H;
364
364
  }
365
365
  }), r1 = M(() => k.value ? s.serverTotal ?? 0 : S.value.length), g1 = M(() => Math.max(1, Math.ceil(r1.value / C.value)));
366
- L1([$, () => s.data], () => {
366
+ M1([$, () => s.data], () => {
367
367
  k.value || (K.value = 1), c.value.clear();
368
368
  });
369
369
  const Z = M(() => {
@@ -393,7 +393,7 @@ const $3 = {
393
393
  if (H <= 7) return Array.from({ length: H }, (c1, w1) => w1 + 1);
394
394
  const d1 = K.value, J = [], I = new Set([1, H, d1 - 1, d1, d1 + 1].filter((c1) => c1 >= 1 && c1 <= H));
395
395
  let Q = 0;
396
- for (const c1 of [...I].sort((w1, M1) => w1 - M1))
396
+ for (const c1 of [...I].sort((w1, V1) => w1 - V1))
397
397
  c1 - Q > 1 && J.push("…"), J.push(c1), Q = c1;
398
398
  return J;
399
399
  }), l1 = (H) => H === "right" ? "text-right" : H === "center" ? "text-center" : "text-left", z1 = (H, d1) => [
@@ -682,9 +682,9 @@ const $3 = {
682
682
  console.debug(`[WSpreadsheet] ${B ? "expand" : "minimize"} painted in ${(performance.now() - N).toFixed(1)}ms`);
683
683
  }));
684
684
  }
685
- L1(() => s.expanded, (B) => {
685
+ M1(() => s.expanded, (B) => {
686
686
  B != null && K(B, !1);
687
- }), L1(() => s.downloadRequest, (B, U) => {
687
+ }), M1(() => s.downloadRequest, (B, U) => {
688
688
  B != null && B !== U && k();
689
689
  }), h({
690
690
  expand: () => {
@@ -820,7 +820,7 @@ const $3 = {
820
820
  B.class || ""
821
821
  ];
822
822
  }
823
- function M1(B, U, N) {
823
+ function V1(B, U, N) {
824
824
  const u1 = N.target.value;
825
825
  u("cell-change", { rowKey: B.key, cellKey: U.key, value: u1, row: B, cell: U });
826
826
  }
@@ -940,7 +940,7 @@ const $3 = {
940
940
  value: s1.value ?? "",
941
941
  min: s1.min,
942
942
  placeholder: s1.placeholder,
943
- onInput: (Y) => M1(N, s1, Y)
943
+ onInput: (Y) => V1(N, s1, Y)
944
944
  }, null, 42, M4),
945
945
  s1.inputType === "date" ? (e(), l("button", {
946
946
  key: 0,
@@ -1171,13 +1171,13 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1171
1171
  function A() {
1172
1172
  D && (document.removeEventListener("pointerdown", r1, !0), document.removeEventListener("keydown", g1, !0), D = !1);
1173
1173
  }
1174
- L1(() => t.open, (j) => {
1174
+ M1(() => t.open, (j) => {
1175
1175
  j ? H1(() => {
1176
1176
  Z || !t.open || (V(), T());
1177
1177
  }) : (i.value = null, A());
1178
- }, { immediate: !0 }), L1(x, (j, e1) => {
1178
+ }, { immediate: !0 }), M1(x, (j, e1) => {
1179
1179
  e1 && o?.remove(e1), j && o?.add(j);
1180
- }), L1(k, (j) => {
1180
+ }), M1(k, (j) => {
1181
1181
  j && t.open && t.freezePositionOnOpen && !i.value && (i.value = S.value);
1182
1182
  }), p2(() => {
1183
1183
  Z = !0, A(), x.value && o?.remove(x.value);
@@ -1392,13 +1392,13 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1392
1392
  }
1393
1393
  return d;
1394
1394
  }
1395
- function M1(r, d) {
1395
+ function V1(r, d) {
1396
1396
  return r.match(new RegExp(`${d}=["']([^"']+)["']`, "i"))?.[1];
1397
1397
  }
1398
1398
  function n2(r) {
1399
1399
  const d = {};
1400
1400
  for (const y of r.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)) {
1401
- const g = y[1] ?? "", L = M1(g, "key"), n1 = M1(g, "value") ?? y[2]?.trim();
1401
+ const g = y[1] ?? "", L = V1(g, "key"), n1 = V1(g, "value") ?? y[2]?.trim();
1402
1402
  if (!(!L || !n1))
1403
1403
  if (L === "duration" || L === "fps" || L === "count") {
1404
1404
  const o1 = Number(n1);
@@ -1432,7 +1432,7 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1432
1432
  function B(r) {
1433
1433
  const d = r.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);
1434
1434
  if (d) {
1435
- const y = (M1(d[1] ?? "", "value") ?? d[2]?.trim())?.toLowerCase();
1435
+ const y = (V1(d[1] ?? "", "value") ?? d[2]?.trim())?.toLowerCase();
1436
1436
  if (["image", "video", "audio", "text"].includes(String(y))) return y;
1437
1437
  }
1438
1438
  const v = r.split(/\r?\n/).map((y) => y.replace(/^[\s>*-]+/, "").trim()).filter(Boolean);
@@ -1718,7 +1718,7 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1718
1718
  function S0(r) {
1719
1719
  if (r.role === "assistant" && r.streaming && E(r.content))
1720
1720
  return "<p>Preparing image...</p>";
1721
- const d = [], v = r.content.replace(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/gi, (V1, F1) => {
1721
+ const d = [], v = r.content.replace(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/gi, (L1, F1) => {
1722
1722
  const S1 = e2(F1).trim();
1723
1723
  if (!S1) return F1;
1724
1724
  const S2 = d.push(S1) - 1;
@@ -1736,12 +1736,12 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1736
1736
  }, E1 = () => {
1737
1737
  L && (g.push(`<pre><code>${D1(n1.join(`
1738
1738
  `))}</code></pre>`), n1 = [], L = !1);
1739
- }, Q1 = (V1) => {
1740
- const F1 = V1.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((S1) => S1.trim());
1739
+ }, Q1 = (L1) => {
1740
+ const F1 = L1.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((S1) => S1.trim());
1741
1741
  return F1.length > 1 && F1.every((S1) => /^:?-{3,}:?$/.test(S1));
1742
- }, R1 = (V1) => V1.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((F1) => F1.trim());
1743
- for (let V1 = 0; V1 < y.length; V1 += 1) {
1744
- const F1 = y[V1];
1742
+ }, R1 = (L1) => L1.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((F1) => F1.trim());
1743
+ for (let L1 = 0; L1 < y.length; L1 += 1) {
1744
+ const F1 = y[L1];
1745
1745
  if (F1.trim().startsWith("```")) {
1746
1746
  L ? E1() : (y1(), x1(), L = !0, n1 = []);
1747
1747
  continue;
@@ -1761,10 +1761,10 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1761
1761
  y1(), x1();
1762
1762
  continue;
1763
1763
  }
1764
- if (!m1 && S1.includes("|") && y[V1 + 1] && Q1(y[V1 + 1])) {
1764
+ if (!m1 && S1.includes("|") && y[L1 + 1] && Q1(y[L1 + 1])) {
1765
1765
  x1();
1766
1766
  const N1 = R1(S1);
1767
- g.push('<div class="wpic-chat-table-wrap"><table><thead><tr>'), g.push(N1.map((U2) => `<th>${k2(U2, r)}</th>`).join("")), g.push("</tr></thead><tbody>"), m1 = !0, V1 += 1;
1767
+ g.push('<div class="wpic-chat-table-wrap"><table><thead><tr>'), g.push(N1.map((U2) => `<th>${k2(U2, r)}</th>`).join("")), g.push("</tr></thead><tbody>"), m1 = !0, L1 += 1;
1768
1768
  continue;
1769
1769
  }
1770
1770
  if (m1) {
@@ -1790,13 +1790,13 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
1790
1790
  y1(), x1(), g.push(`<p>${k2(S1, r)}</p>`);
1791
1791
  }
1792
1792
  E1(), y1(), x1();
1793
- const a2 = W2(r).find((V1) => V1.type === "apply_all" && !V1.exactText), Z1 = q1(r);
1793
+ const a2 = W2(r).find((L1) => L1.type === "apply_all" && !L1.exactText), Z1 = q1(r);
1794
1794
  if (!(r.role === "assistant" && s1(r.content))) {
1795
1795
  if (a2)
1796
1796
  g.push(`<p class="wpic-chat-actions-end">${t0(a2, t.applyAllLabel)}</p>`);
1797
1797
  else if (r.role === "assistant" && !r.streaming && !r.error && Z1) {
1798
- const V1 = [];
1799
- Z1.prompt && !N(r.content) && V1.push(t2(t.applyPromptLabel, "prompt")), (Z1.settings || Z1.taskType && u1(r.content)) && V1.push(t2(t.applyAllLabel, "all")), V1.length && g.push(`<p class="wpic-chat-actions-end">${V1.join(" ")}</p>`);
1798
+ const L1 = [];
1799
+ Z1.prompt && !N(r.content) && L1.push(t2(t.applyPromptLabel, "prompt")), (Z1.settings || Z1.taskType && u1(r.content)) && L1.push(t2(t.applyAllLabel, "all")), L1.length && g.push(`<p class="wpic-chat-actions-end">${L1.join(" ")}</p>`);
1800
1800
  }
1801
1801
  }
1802
1802
  return g.join("");
@@ -2022,8 +2022,8 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
2022
2022
  r1.value = !0;
2023
2023
  const y = r.clientX, g = r.clientY, L = v.width, n1 = v.height, o1 = v.left, m1 = v.top, x1 = (E1) => {
2024
2024
  const Q1 = E1.clientX - y, R1 = E1.clientY - g;
2025
- let a2 = L, Z1 = n1, V1 = o1, F1 = m1;
2026
- d.includes("e") && (a2 = Math.max(t.minWidth, L + Q1)), d.includes("s") && (Z1 = Math.max(t.minHeight, n1 + R1)), d.includes("w") && (a2 = Math.max(t.minWidth, L - Q1), V1 = o1 + (L - a2)), d.includes("n") && (Z1 = Math.max(t.minHeight, n1 - R1), F1 = Math.max(t.topOffset, m1 + (n1 - Z1))), s("update:width", Math.min(a2, window.innerWidth)), s("update:height", Math.min(Z1, window.innerHeight - t.topOffset)), t.docked || (s("update:x", Math.max(0, V1)), s("update:y", Math.max(t.topOffset, F1)));
2025
+ let a2 = L, Z1 = n1, L1 = o1, F1 = m1;
2026
+ d.includes("e") && (a2 = Math.max(t.minWidth, L + Q1)), d.includes("s") && (Z1 = Math.max(t.minHeight, n1 + R1)), d.includes("w") && (a2 = Math.max(t.minWidth, L - Q1), L1 = o1 + (L - a2)), d.includes("n") && (Z1 = Math.max(t.minHeight, n1 - R1), F1 = Math.max(t.topOffset, m1 + (n1 - Z1))), s("update:width", Math.min(a2, window.innerWidth)), s("update:height", Math.min(Z1, window.innerHeight - t.topOffset)), t.docked || (s("update:x", Math.max(0, L1)), s("update:y", Math.max(t.topOffset, F1)));
2027
2027
  }, y1 = () => {
2028
2028
  r1.value = !1, document.removeEventListener("mousemove", x1), document.removeEventListener("mouseup", y1);
2029
2029
  };
@@ -2035,10 +2035,10 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
2035
2035
  r && (r.scrollTop = r.scrollHeight);
2036
2036
  });
2037
2037
  }
2038
- return L1(() => t.messages.map((r) => r.content).join(`
2039
- `), u0), L1([() => t.selectedSessionId, () => t.loading, () => t.messages.length], () => {
2038
+ return M1(() => t.messages.map((r) => r.content).join(`
2039
+ `), u0), M1([() => t.selectedSessionId, () => t.loading, () => t.messages.length], () => {
2040
2040
  A.value && t.selectedSessionId === A.value && !t.loading && (A.value = null);
2041
- }), L1(() => t.modelValue, x2), L1(() => t.open, (r) => {
2041
+ }), M1(() => t.modelValue, x2), M1(() => t.open, (r) => {
2042
2042
  r && (u0(), x2(), H1(() => {
2043
2043
  b.value?.focus(), e1();
2044
2044
  }));
@@ -2775,7 +2775,7 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
2775
2775
  }
2776
2776
  P2(() => {
2777
2777
  c = window.location.pathname, R(), window.addEventListener("popstate", R);
2778
- }), p2(() => window.removeEventListener("popstate", R)), L1(
2778
+ }), p2(() => window.removeEventListener("popstate", R)), M1(
2779
2779
  () => t.modelValue,
2780
2780
  (S) => {
2781
2781
  const V = x();
@@ -2900,9 +2900,9 @@ const H4 = ["data-wpic-theme"], r2 = /* @__PURE__ */ X({
2900
2900
  emits: ["update:modelValue", "open-change"],
2901
2901
  setup(n, { emit: h }) {
2902
2902
  const t = n, s = h, u = (D) => typeof D == "object" && D !== null ? D : { value: D, label: String(D), icon: void 0, iconKey: void 0, meta: void 0, metaVariant: void 0 }, c = F(!1), o = F(null), b = F(null), C = F(""), x = F(t.multiple ? [...t.modelValue ?? []] : []);
2903
- L1(() => t.modelValue, (D) => {
2903
+ M1(() => t.modelValue, (D) => {
2904
2904
  t.multiple && (x.value = [...D ?? []]);
2905
- }, { deep: !0 }), L1(c, (D) => {
2905
+ }, { deep: !0 }), M1(c, (D) => {
2906
2906
  s("open-change", D), D && t.searchable && H1(() => b.value?.focus()), D || (C.value = "");
2907
2907
  });
2908
2908
  const i = M(() => (t.options ?? []).map(u)), R = M(() => {
@@ -3302,7 +3302,7 @@ const H6 = {
3302
3302
  function P() {
3303
3303
  t.disabled || (t.checkable ? s("update:checked", !t.checked) : t.editable && (b.value = !b.value));
3304
3304
  }
3305
- return L1(() => [t.disabled, t.checkable, t.editable], () => {
3305
+ return M1(() => [t.disabled, t.checkable, t.editable], () => {
3306
3306
  (t.disabled || t.checkable || !t.editable) && (b.value = !1);
3307
3307
  }), (S, V) => (e(), l(W, null, [
3308
3308
  (e(), O($1(C.value && !n.removable ? "button" : "span"), h2({
@@ -3675,7 +3675,7 @@ const _l = /* @__PURE__ */ X({
3675
3675
  const t = n, s = h;
3676
3676
  s2("wpic-pagination-url-sync", !1);
3677
3677
  let u = !1;
3678
- return L1(() => t.open, (c) => {
3678
+ return M1(() => t.open, (c) => {
3679
3679
  c !== u && (u = c, c ? (J1++, J1 === 1 && (document.body.style.overflow = "hidden")) : (J1 = Math.max(0, J1 - 1), J1 === 0 && (document.body.style.overflow = "")));
3680
3680
  }, { immediate: !0 }), G0(() => {
3681
3681
  u && (u = !1, J1 = Math.max(0, J1 - 1), J1 === 0 && (document.body.style.overflow = ""));
@@ -4195,10 +4195,10 @@ const ia = /* @__PURE__ */ O1(n7, [["render", t7]]), l7 = ["placeholder", "rows"
4195
4195
  middleware: [v2(4), m2({ padding: 8 }), f2({ padding: 8 })],
4196
4196
  whileElementsMounted: b2
4197
4197
  }), x = /* @__PURE__ */ new Date(), i = F(x.getFullYear()), R = F(x.getMonth()), $ = M(() => R.value === 11 ? i.value + 1 : i.value), P = M(() => R.value === 11 ? 0 : R.value + 1), S = F(null), V = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], k = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], K = (I, Q) => {
4198
- const w1 = (new Date(I, Q, 1).getDay() + 6) % 7, M1 = new Date(I, Q + 1, 0).getDate(), n2 = new Date(I, Q, 0).getDate(), B = [];
4198
+ const w1 = (new Date(I, Q, 1).getDay() + 6) % 7, V1 = new Date(I, Q + 1, 0).getDate(), n2 = new Date(I, Q, 0).getDate(), B = [];
4199
4199
  for (let N = w1 - 1; N >= 0; N--)
4200
4200
  B.push({ day: n2 - N, month: Q - 1, year: I, outside: !0 });
4201
- for (let N = 1; N <= M1; N++)
4201
+ for (let N = 1; N <= V1; N++)
4202
4202
  B.push({ day: N, month: Q, year: I, outside: !1 });
4203
4203
  const U = 42 - B.length;
4204
4204
  for (let N = 1; N <= U; N++)
@@ -4249,9 +4249,9 @@ const ia = /* @__PURE__ */ O1(n7, [["render", t7]]), l7 = ["placeholder", "rows"
4249
4249
  const I = t.modelValue;
4250
4250
  return I?.start ? `${H(I.start)} → ${I.end ? H(I.end) : "..."}` : "";
4251
4251
  });
4252
- L1(c, (I) => {
4252
+ M1(c, (I) => {
4253
4253
  I || (S.value = null);
4254
- }), L1(c, (I) => {
4254
+ }), M1(c, (I) => {
4255
4255
  if (!I || !T.value) return;
4256
4256
  const [Q, c1] = T.value.split("-").map(Number);
4257
4257
  i.value = Q, R.value = c1 - 1;
@@ -4323,9 +4323,9 @@ const ia = /* @__PURE__ */ O1(n7, [["render", t7]]), l7 = ["placeholder", "rows"
4323
4323
  a("div", f7, [
4324
4324
  (e(!0), l(W, null, a1(r1.value, (c1, w1) => (e(), l("button", {
4325
4325
  key: w1,
4326
- onClick: (M1) => i1(c1),
4327
- onMouseenter: (M1) => j.value = Z(c1),
4328
- onMouseleave: Q[1] || (Q[1] = (M1) => j.value = null),
4326
+ onClick: (V1) => i1(c1),
4327
+ onMouseenter: (V1) => j.value = Z(c1),
4328
+ onMouseleave: Q[1] || (Q[1] = (V1) => j.value = null),
4329
4329
  type: "button",
4330
4330
  class: p(["h-8 w-full flex items-center justify-center rounded-lg transition cursor-pointer", J(c1)])
4331
4331
  }, z(c1.day), 43, z7))), 128))
@@ -4354,9 +4354,9 @@ const ia = /* @__PURE__ */ O1(n7, [["render", t7]]), l7 = ["placeholder", "rows"
4354
4354
  a("div", k7, [
4355
4355
  (e(!0), l(W, null, a1(g1.value, (c1, w1) => (e(), l("button", {
4356
4356
  key: w1,
4357
- onClick: (M1) => i1(c1),
4358
- onMouseenter: (M1) => j.value = Z(c1),
4359
- onMouseleave: Q[2] || (Q[2] = (M1) => j.value = null),
4357
+ onClick: (V1) => i1(c1),
4358
+ onMouseenter: (V1) => j.value = Z(c1),
4359
+ onMouseleave: Q[2] || (Q[2] = (V1) => j.value = null),
4360
4360
  type: "button",
4361
4361
  class: p(["h-8 w-full flex items-center justify-center rounded-lg transition cursor-pointer", J(c1)])
4362
4362
  }, z(c1.day), 43, x7))), 128))
@@ -4769,7 +4769,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
4769
4769
  function w1(E) {
4770
4770
  E.key === "Enter" && (j && clearTimeout(j), n2()), E.key === "Escape" && (U(), T.value = !1);
4771
4771
  }
4772
- async function M1(E) {
4772
+ async function V1(E) {
4773
4773
  if (z1(E)) return;
4774
4774
  S.value = "confirming", T.value = !1;
4775
4775
  const Y = t.modelValue ?? [];
@@ -4789,7 +4789,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
4789
4789
  (_) => Object.values(_.translations ?? {}).some((k1) => k1.value?.toLowerCase() === E.toLowerCase()) || _.slug === E.toLowerCase()
4790
4790
  );
4791
4791
  if (Y) {
4792
- M1(Y);
4792
+ V1(Y);
4793
4793
  return;
4794
4794
  }
4795
4795
  if (t.resolveFn) {
@@ -4797,7 +4797,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
4797
4797
  try {
4798
4798
  const _ = await t.resolveFn(E, t.locale);
4799
4799
  if (V.value = _, _.existed && !z1(_)) {
4800
- await M1(_), V.value = null;
4800
+ await V1(_), V.value = null;
4801
4801
  return;
4802
4802
  }
4803
4803
  S.value = "preview";
@@ -4960,7 +4960,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
4960
4960
  (e(!0), l(W, null, a1(H.value, (_) => (e(), l("button", {
4961
4961
  key: _.tag_id,
4962
4962
  class: p(["w-full text-left px-3 py-2 hover:bg-black/5 dark:hover:bg-white/5 cursor-pointer transition flex items-center gap-2", z1(_) ? "opacity-40 cursor-default" : "text-zinc-600 dark:text-zinc-400"]),
4963
- onMousedown: p1((k1) => !z1(_) && M1(_), ["prevent"])
4963
+ onMousedown: p1((k1) => !z1(_) && V1(_), ["prevent"])
4964
4964
  }, [
4965
4965
  w(f(F2), {
4966
4966
  size: 11,
@@ -5156,7 +5156,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
5156
5156
  ],
5157
5157
  whileElementsMounted: b2
5158
5158
  });
5159
- L1(u, (j) => {
5159
+ M1(u, (j) => {
5160
5160
  j ? H1(() => x.value?.focus()) : o.value = null;
5161
5161
  });
5162
5162
  const S = M(() => {
@@ -5394,7 +5394,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
5394
5394
  function x() {
5395
5395
  o && clearTimeout(o), c.value = !1;
5396
5396
  }
5397
- return p2(x), L1(() => h.disabled, (i) => {
5397
+ return p2(x), M1(() => h.disabled, (i) => {
5398
5398
  i && x();
5399
5399
  }), (i, R) => (e(), l(W, null, [
5400
5400
  a("span", {
@@ -5839,22 +5839,27 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
5839
5839
  size: {}
5840
5840
  },
5841
5841
  setup(n) {
5842
- const h = n, t = M(() => ({
5842
+ const h = n, t = F(!1);
5843
+ M1(() => h.src, () => {
5844
+ t.value = !1;
5845
+ });
5846
+ const s = M(() => !!h.src && !t.value), u = M(() => ({
5843
5847
  sm: "w-6 h-6 text-sm",
5844
5848
  md: "w-8 h-8 text-sm",
5845
5849
  lg: "w-10 h-10 text-base"
5846
- })[h.size ?? "md"]), s = M(
5847
- () => h.name.split(" ").map((u) => u[0]).join("").toUpperCase().substring(0, 2)
5850
+ })[h.size ?? "md"]), c = M(
5851
+ () => h.name.trim().split(/\s+/).filter(Boolean).map((o) => o[0]).join("").toUpperCase().substring(0, 2) || "?"
5848
5852
  );
5849
- return (u, c) => (e(), l("div", {
5850
- class: p(["wpic-avatar flex items-center justify-center rounded-full overflow-hidden font-medium shrink-0", [t.value, n.src ? "" : "bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300"]])
5853
+ return (o, b) => (e(), l("div", {
5854
+ class: p(["wpic-avatar flex items-center justify-center rounded-full overflow-hidden font-medium shrink-0", [u.value, s.value ? "" : "bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300"]])
5851
5855
  }, [
5852
- n.src ? (e(), l("img", {
5856
+ s.value ? (e(), l("img", {
5853
5857
  key: 0,
5858
+ onError: b[0] || (b[0] = (C) => t.value = !0),
5854
5859
  src: n.src,
5855
5860
  alt: n.name,
5856
5861
  class: "w-full h-full object-cover"
5857
- }, null, 8, vn)) : (e(), l("span", mn, z(s.value), 1))
5862
+ }, null, 40, vn)) : (e(), l("span", mn, z(c.value), 1))
5858
5863
  ], 2));
5859
5864
  }
5860
5865
  }), $a = /* @__PURE__ */ X({
@@ -5973,7 +5978,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
5973
5978
  function g1(Z) {
5974
5979
  return Z.iso === t.modelValue ? "bg-[var(--wpic-primary)] text-white font-semibold" : V(Z.iso) ? "cursor-not-allowed text-zinc-200 dark:text-zinc-700" : Z.inMonth ? Z.iso === x(o) ? "text-[var(--wpic-primary)] ring-1 ring-[var(--wpic-primary)]/40 hover:bg-zinc-100 dark:hover:bg-zinc-800" : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-200 dark:hover:bg-zinc-800" : "text-zinc-300 hover:bg-zinc-100 dark:text-zinc-600 dark:hover:bg-zinc-800";
5975
5980
  }
5976
- return L1(u, (Z) => {
5981
+ return M1(u, (Z) => {
5977
5982
  if (!Z) return;
5978
5983
  const D = C(t.modelValue), T = C(t.max) ?? o, A = D ?? T;
5979
5984
  b.value = new Date(A.getFullYear(), A.getMonth(), 1);
@@ -6853,7 +6858,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
6853
6858
  function t1() {
6854
6859
  o.value = null, b.value = "", C.value = "", s("update:modelValue", null), u.value = !1;
6855
6860
  }
6856
- return L1(() => t.modelValue, (G) => {
6861
+ return M1(() => t.modelValue, (G) => {
6857
6862
  o.value = G?.preset ?? null, b.value = G?.since ?? "", C.value = G?.until ?? "", R.value = "from";
6858
6863
  }), (G, i1) => (e(), l("div", Dn, [
6859
6864
  a("button", {
@@ -7010,7 +7015,7 @@ const U7 = { class: "wpic-tag-input" }, O7 = {
7010
7015
  function S(V) {
7011
7016
  P(V) || (s("update:modelValue", V), s("change", V), u.value = !1);
7012
7017
  }
7013
- return L1(u, (V) => {
7018
+ return M1(u, (V) => {
7014
7019
  V && (b.value = C(t.modelValue)?.getFullYear() ?? o.getFullYear());
7015
7020
  }), (V, k) => (e(), l("div", ae, [
7016
7021
  a("button", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpic/ui",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "description": "WPIC shared Vue 3 component library",
6
6
  "publishConfig": {