@levo-so/studio 0.3.9 → 0.3.10

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/index.js CHANGED
@@ -3800,7 +3800,7 @@ var Di = (e, t) => {
3800
3800
  getAllBlocks() {
3801
3801
  return this.blocks;
3802
3802
  }
3803
- }, yo = vo.getInstance(), bo = nt(() => import("./kbChat-QDHdRejh.js"), { ssr: !1 }), xo = () => {
3803
+ }, yo = vo.getInstance(), bo = nt(() => import("./kbChat-BLHDnA-T.js"), { ssr: !1 }), xo = () => {
3804
3804
  let e = rt(), [t, n] = R(void 0), r = e?.events;
3805
3805
  return F(() => {
3806
3806
  if (typeof window > "u" || !r) return;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { a as e, c as t, f as n, h as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u, u as d, y as f } from "./pillChrome-CYoMtUAv.js";
2
+ import { S as e, a as t, c as n, f as r, h as i, l as a, m as o, n as s, o as c, p as l, r as u, t as d, u as f } from "./pillChrome-wmdnlFIE.js";
3
3
  import { useEffect as p, useRef as m, useState as h } from "react";
4
4
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
5
5
  import { ArrowUp as v, Sparkles as y } from "lucide-react";
6
6
  //#region ../../libraries/ai-chat/src/useActiveAgent.ts
7
- var b = (e) => f("active_agent", e), x = (e) => {
7
+ var b = (t) => e("active_agent", t), x = (e) => {
8
8
  let t = b(e);
9
9
  if (!t || typeof window > "u") return null;
10
10
  try {
@@ -64,7 +64,7 @@ var b = (e) => f("active_agent", e), x = (e) => {
64
64
  e,
65
65
  r
66
66
  ]), i;
67
- }, w = (...e) => e.filter(Boolean).join(" "), T = () => import("./KBChatWidget-Cgsubvuk.js"), E = (e) => {
67
+ }, w = (...e) => e.filter(Boolean).join(" "), T = () => import("./KBChatWidget-ChIYlltB.js"), E = (e) => {
68
68
  let [t, n] = h(null), [r, i] = h(!1), [a, o] = h("");
69
69
  return t ? /* @__PURE__ */ g(t, {
70
70
  initialOpen: !0,
@@ -87,27 +87,27 @@ var b = (e) => f("active_agent", e), x = (e) => {
87
87
  }, D = () => /* @__PURE__ */ g("span", {
88
88
  "aria-hidden": !0,
89
89
  className: "h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent"
90
- }), O = ({ siteName: f, draft: p, loading: b, onDraftChange: x, onActivate: S, onPrefetch: C }) => {
91
- let T = m(null), E = m(null), O = r(f), [k, A] = h(!1);
90
+ }), O = ({ siteName: e, draft: p, loading: b, onDraftChange: x, onActivate: S, onPrefetch: C }) => {
91
+ let T = m(null), E = m(null), O = i(e), [k, A] = h(!1);
92
92
  return /* @__PURE__ */ g("div", {
93
93
  onPointerEnter: C,
94
- className: w("ai-chat-launcher fixed bottom-8 left-1/2 z-[60] -translate-x-1/2", c),
94
+ className: w("ai-chat-launcher fixed bottom-8 left-1/2 z-[60] -translate-x-1/2", l),
95
95
  children: /* @__PURE__ */ g("div", {
96
- className: w(o, t, "ai-chat-intro-morph"),
96
+ className: w(s, n, "ai-chat-intro-morph"),
97
97
  children: /* @__PURE__ */ _("div", {
98
98
  ref: E,
99
- className: w(d, k && "ai-chat-pill-surface--stacked"),
99
+ className: w(f, k && "ai-chat-pill-surface--stacked"),
100
100
  children: [
101
101
  /* @__PURE__ */ g("button", {
102
102
  type: "button",
103
103
  onClick: S,
104
104
  onFocus: C,
105
105
  "aria-label": "Open AI chat",
106
- className: i,
106
+ className: a,
107
107
  children: b ? /* @__PURE__ */ g(D, {}) : /* @__PURE__ */ g(y, { className: "h-5 w-5" })
108
108
  }),
109
109
  /* @__PURE__ */ _("div", {
110
- className: l,
110
+ className: u,
111
111
  children: [/* @__PURE__ */ g("textarea", {
112
112
  ref: T,
113
113
  rows: 1,
@@ -120,9 +120,9 @@ var b = (e) => f("active_agent", e), x = (e) => {
120
120
  onFocus: S,
121
121
  onChange: (e) => {
122
122
  let t = e.currentTarget;
123
- x(t.value), E.current && A(a(E.current, t));
123
+ x(t.value), E.current && A(o(E.current, t));
124
124
  },
125
- className: n
125
+ className: r
126
126
  }), !p && /* @__PURE__ */ g("span", {
127
127
  className: w("ai-chat-pill-label pointer-events-none absolute inset-y-0 left-0 flex max-w-full items-center truncate bg-clip-text font-semibold text-[15px] text-transparent", "ai-chat-intro-label"),
128
128
  "aria-hidden": !0,
@@ -130,13 +130,13 @@ var b = (e) => f("active_agent", e), x = (e) => {
130
130
  })]
131
131
  }),
132
132
  /* @__PURE__ */ g("div", {
133
- className: u,
133
+ className: d,
134
134
  children: /* @__PURE__ */ g("button", {
135
135
  type: "button",
136
136
  onClick: S,
137
137
  "aria-label": "Open AI chat",
138
- className: e,
139
- style: s,
138
+ className: t,
139
+ style: c,
140
140
  children: b ? /* @__PURE__ */ g(D, {}) : /* @__PURE__ */ g(v, { className: "h-5 w-5 stroke-[2.5px]" })
141
141
  })
142
142
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/studio",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo Studio components and utilities for building block-based pages",
6
6
  "type": "module",
@@ -123,8 +123,8 @@
123
123
  "react": ">=19",
124
124
  "next": ">=14",
125
125
  "react-dom": ">=19",
126
- "@levo-so/core": "0.3.9",
127
- "@levo-so/insights": "0.3.9",
128
- "@levo-so/react": "0.3.9"
126
+ "@levo-so/core": "0.3.10",
127
+ "@levo-so/react": "0.3.10",
128
+ "@levo-so/insights": "0.3.10"
129
129
  }
130
130
  }
@@ -0,0 +1,50 @@
1
+ //#region ../../libraries/ai-chat/src/helpers.ts
2
+ var e = "disabled:cursor-not-allowed disabled:opacity-40", t = (e) => {
3
+ if (!e) return null;
4
+ let t = e instanceof Date ? e : new Date(e);
5
+ return Number.isNaN(t.getTime()) ? null : t;
6
+ }, n = (e, n = {
7
+ hour: "numeric",
8
+ minute: "2-digit"
9
+ }) => t(e)?.toLocaleTimeString([], n) ?? "", r = (e, r) => {
10
+ let i = t(e);
11
+ if (!i) return "";
12
+ let a = /* @__PURE__ */ new Date();
13
+ if (i.toDateString() === a.toDateString()) return n(i, r);
14
+ let o = i.toLocaleTimeString([], {
15
+ hour: "numeric",
16
+ minute: "2-digit"
17
+ });
18
+ return `${i.toLocaleDateString([], {
19
+ month: "short",
20
+ day: "numeric",
21
+ ...i.getFullYear() !== a.getFullYear() && { year: "numeric" }
22
+ })} · ${o}`;
23
+ }, i = (e) => {
24
+ let n = t(e);
25
+ return n ? `${n.toLocaleDateString([], { dateStyle: "medium" })} · ${n.toLocaleTimeString([], { timeStyle: "short" })}` : "";
26
+ }, a = (e) => {
27
+ let t = e.metadata?.custom?.createdAt;
28
+ return typeof t == "string" || t instanceof Date ? t : e.createdAt;
29
+ }, o = (e, t) => t ? `levo.site_chat.${e}.${t}` : null, s = (e, t) => {
30
+ e.style.height = "auto", e.style.height = t === void 0 ? `${e.scrollHeight}px` : `${Math.min(e.scrollHeight, t)}px`;
31
+ }, c = (e, t) => {
32
+ e.setText(t);
33
+ let n = document.activeElement?.closest("[data-ai-chat-root]") ?? document;
34
+ requestAnimationFrame(() => {
35
+ let e = n.querySelector("textarea[data-ai-chat-composer]");
36
+ if (!e) return;
37
+ e.focus();
38
+ let t = e.value.length;
39
+ e.setSelectionRange(t, t);
40
+ });
41
+ }, l = "w-72", u = "ai-chat-pill-gradient relative rounded-[30px] p-[2px] transition-shadow duration-300", d = "shadow-lg shadow-zinc-950/10", f = "shadow-md", p = "ai-chat-pill-surface min-h-14 w-full rounded-[28px] bg-white p-1.5", m = "ai-chat-pill-surface--stacked", h = "ai-chat-pill-input relative min-w-0", g = "ai-chat-pill-actions flex items-center gap-1.5", _ = "ai-chat-pill-spark flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full text-blue-500 transition-[background-color,transform] duration-150 hover:bg-zinc-50 active:scale-95", v = "flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-[transform,box-shadow] duration-150 hover:scale-105 hover:shadow-md active:scale-95", y = "block h-6 max-h-[120px] w-full resize-none overflow-y-auto bg-transparent text-base text-zinc-900 leading-6 placeholder:text-zinc-400 focus:outline-none", b = 24, x = (e, t) => {
42
+ e.classList.remove(m), t.style.height = "auto";
43
+ let n = t.scrollHeight > b + 4;
44
+ return e.classList.toggle(m, n), s(t, 120), n;
45
+ }, S = "ai-chat-pill-label pointer-events-none absolute inset-y-0 left-0 flex max-w-full items-center truncate bg-clip-text font-semibold text-[15px] text-transparent", C = {
46
+ backgroundColor: "var(--color-brand, #0a0a0a)",
47
+ color: "var(--color-brand-foreground, #fff)"
48
+ }, w = (e) => e ? `Ask ${e}` : "Ask AI";
49
+ //#endregion
50
+ export { o as S, s as _, v as a, r as b, d as c, m as d, y as f, e as g, w as h, S as i, _ as l, x as m, u as n, C as o, l as p, h as r, f as s, g as t, p as u, c as v, a as x, i as y };