@levo-so/site-runtime 0.2.2 → 0.2.3
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/CollectionField-CzS-34zx.js +270 -0
- package/DateTimeWidget-C1jHOtz7.js +255 -0
- package/Dialog-CzVhHLEY.js +145 -0
- package/KBChatWidget-h3xW6Q4I.js +1067 -0
- package/{PhoneWidget-vtDO9CFq.js → PhoneWidget-_nw97rkI.js} +5 -5
- package/{Popover-B76-bN-a.js → Popover-q5dL7y0W.js} +1 -1
- package/PopupRenderer-Bncp54gB-DuCULkBK.js +3514 -0
- package/RichTextWidget-D-mGlES0.js +758 -0
- package/ThemeProvider-BQmIB5tr.js +116 -0
- package/Tooltip-BIgrpetu.js +67 -0
- package/VerifyButton-BkP98H17.js +191 -0
- package/dist-CJknSbJK.js +80 -0
- package/dist-DBbiX2ST.js +3556 -0
- package/index.d.ts +146 -13
- package/index.js +717 -4219
- package/inlineBaseTheme-DS-AfUHi.js +9 -0
- package/inlineCollectionTheme-D2w17LHX.js +86 -0
- package/kbChat-DHujgETt.js +163 -0
- package/nodeAlignment-Cn6xNtOP.js +166 -0
- package/package.json +15 -3
- package/pillChrome-DWHpfbDk.js +16 -0
- package/popups.d.ts +47 -0
- package/popups.js +5 -0
- package/rolldown-runtime-CAFD8bLK.js +11 -0
- package/styles.css +1 -1
- package/theme.cssm-2YTdd8Yh.js +15 -0
- package/DateTimeWidget-CARoq7bQ.js +0 -254
- package/RichTextWidget-CafZBEKI.js +0 -912
- package/ThemeProvider-Cm2jJC7a.js +0 -381
- package/Tooltip-Bx-BfR7T.js +0 -78
- package/VerifyButton-D1Mwk04d.js +0 -299
- /package/{CollectionInput-5QMoXahu.js → CollectionInput-B1qV4QEH.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { i as e, r as t } from "./inlineCollectionTheme-D2w17LHX.js";
|
|
2
|
+
import { n } from "./theme.cssm-2YTdd8Yh.js";
|
|
3
|
+
//#region ../../libraries/levocn/dist/styles/inlineBaseTheme.js
|
|
4
|
+
var r = n(e), i = (e) => e ? e.radius && !e.radiusScale ? r({
|
|
5
|
+
...e,
|
|
6
|
+
radiusScale: t(e.radius)
|
|
7
|
+
}) : r(e) : {};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { i as t };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { n as e } from "./theme.cssm-2YTdd8Yh.js";
|
|
2
|
+
//#region ../../libraries/levocn/dist/styles/theme/themeVars.cssm.js
|
|
3
|
+
var t = {
|
|
4
|
+
colors: {
|
|
5
|
+
background: "var(--_1i5egzy0)",
|
|
6
|
+
foreground: "var(--_1i5egzy1)",
|
|
7
|
+
text: "var(--_1i5egzy2)",
|
|
8
|
+
heading: "var(--_1i5egzy3)",
|
|
9
|
+
card: "var(--_1i5egzy4)",
|
|
10
|
+
cardForeground: "var(--_1i5egzy5)",
|
|
11
|
+
popover: "var(--_1i5egzy6)",
|
|
12
|
+
popoverForeground: "var(--_1i5egzy7)",
|
|
13
|
+
primary: "var(--_1i5egzy8)",
|
|
14
|
+
primaryForeground: "var(--_1i5egzy9)",
|
|
15
|
+
secondary: "var(--_1i5egzya)",
|
|
16
|
+
secondaryForeground: "var(--_1i5egzyb)",
|
|
17
|
+
muted: "var(--_1i5egzyc)",
|
|
18
|
+
mutedForeground: "var(--_1i5egzyd)",
|
|
19
|
+
accent: "var(--_1i5egzye)",
|
|
20
|
+
accentForeground: "var(--_1i5egzyf)",
|
|
21
|
+
destructive: "var(--_1i5egzyg)",
|
|
22
|
+
border: "var(--_1i5egzyh)",
|
|
23
|
+
input: "var(--_1i5egzyi)",
|
|
24
|
+
inputForeground: "var(--_1i5egzyj)",
|
|
25
|
+
ring: "var(--_1i5egzyk)"
|
|
26
|
+
},
|
|
27
|
+
radius: "var(--_1i5egzyl)",
|
|
28
|
+
radiusScale: {
|
|
29
|
+
sm: "var(--_1i5egzym)",
|
|
30
|
+
base: "var(--_1i5egzyn)",
|
|
31
|
+
md: "var(--_1i5egzyo)",
|
|
32
|
+
lg: "var(--_1i5egzyp)",
|
|
33
|
+
xl: "var(--_1i5egzyq)",
|
|
34
|
+
"2xl": "var(--_1i5egzyr)",
|
|
35
|
+
"3xl": "var(--_1i5egzys)",
|
|
36
|
+
"4xl": "var(--_1i5egzyt)",
|
|
37
|
+
"5xl": "var(--_1i5egzyu)",
|
|
38
|
+
"6xl": "var(--_1i5egzyv)",
|
|
39
|
+
"7xl": "var(--_1i5egzyw)",
|
|
40
|
+
"8xl": "var(--_1i5egzyx)",
|
|
41
|
+
full: "var(--_1i5egzyy)"
|
|
42
|
+
},
|
|
43
|
+
baseFontSize: "var(--_1i5egzyz)",
|
|
44
|
+
fonts: {
|
|
45
|
+
body: "var(--_1i5egzy10)",
|
|
46
|
+
heading: "var(--_1i5egzy11)"
|
|
47
|
+
},
|
|
48
|
+
shadow: {
|
|
49
|
+
xs: "var(--_1i5egzy12)",
|
|
50
|
+
sm: "var(--_1i5egzy13)",
|
|
51
|
+
md: "var(--_1i5egzy14)",
|
|
52
|
+
lg: "var(--_1i5egzy15)",
|
|
53
|
+
xl: "var(--_1i5egzy16)",
|
|
54
|
+
inner: "var(--_1i5egzy17)"
|
|
55
|
+
}
|
|
56
|
+
}, n = (e) => ({
|
|
57
|
+
sm: `calc(${e} * 0.5)`,
|
|
58
|
+
base: e,
|
|
59
|
+
md: `calc(${e} * 1.5)`,
|
|
60
|
+
lg: `calc(${e} * 2)`,
|
|
61
|
+
xl: `calc(${e} * 3)`,
|
|
62
|
+
"2xl": `calc(${e} * 4)`,
|
|
63
|
+
"3xl": `calc(${e} * 6)`,
|
|
64
|
+
"4xl": `calc(${e} * 8)`,
|
|
65
|
+
"5xl": `calc(${e} * 12)`,
|
|
66
|
+
"6xl": `calc(${e} * 16)`,
|
|
67
|
+
"7xl": `calc(${e} * 20)`,
|
|
68
|
+
"8xl": `calc(${e} * 24)`,
|
|
69
|
+
full: "100%"
|
|
70
|
+
}), r = {
|
|
71
|
+
form: {
|
|
72
|
+
maxWidth: "var(--_1092q7b0)",
|
|
73
|
+
gap: "var(--_1092q7b1)",
|
|
74
|
+
borderRadius: "var(--_1092q7b2)",
|
|
75
|
+
labelFontSize: "var(--_1092q7b3)",
|
|
76
|
+
helpFontSize: "var(--_1092q7b4)"
|
|
77
|
+
},
|
|
78
|
+
input: {
|
|
79
|
+
fontSize: "var(--_1092q7b5)",
|
|
80
|
+
height: "var(--_1092q7b6)",
|
|
81
|
+
borderRadius: "var(--_1092q7b7)"
|
|
82
|
+
},
|
|
83
|
+
checkbox: { labelFontSize: "var(--_1092q7b8)" }
|
|
84
|
+
}, i = e(r);
|
|
85
|
+
//#endregion
|
|
86
|
+
export { t as i, r as n, n as r, i as t };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, n as s, p as c, s as l, t as u, u as d } from "./pillChrome-DWHpfbDk.js";
|
|
3
|
+
import { useEffect as f, useRef as p, useState as m } from "react";
|
|
4
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
import { ArrowUp as _, Sparkles as v } from "lucide-react";
|
|
6
|
+
//#region ../../libraries/ai-chat/src/useActiveAgent.ts
|
|
7
|
+
var y = (e) => i("active_agent", e), b = (e) => {
|
|
8
|
+
let t = y(e);
|
|
9
|
+
if (!t || typeof window > "u") return null;
|
|
10
|
+
try {
|
|
11
|
+
let e = window.sessionStorage.getItem(t);
|
|
12
|
+
if (!e) return null;
|
|
13
|
+
let n = JSON.parse(e);
|
|
14
|
+
return typeof n?.id != "string" || n.id.length === 0 ? null : n;
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}, x = (e, t) => {
|
|
19
|
+
let n = y(e);
|
|
20
|
+
if (!(!n || typeof window > "u")) try {
|
|
21
|
+
t === null ? window.sessionStorage.removeItem(n) : window.sessionStorage.setItem(n, JSON.stringify(t));
|
|
22
|
+
} catch {}
|
|
23
|
+
}, S = ({ url: e, workspaceId: t, headers: n }) => {
|
|
24
|
+
let [r, i] = m({ status: "loading" });
|
|
25
|
+
f(() => {
|
|
26
|
+
let e = b(t);
|
|
27
|
+
i(e ? {
|
|
28
|
+
status: "ready",
|
|
29
|
+
agent: e
|
|
30
|
+
} : (e) => e.status === "ready" ? { status: "loading" } : e);
|
|
31
|
+
}, [t]);
|
|
32
|
+
let a = p(n);
|
|
33
|
+
return a.current = n, f(() => {
|
|
34
|
+
if (!t || !e) return;
|
|
35
|
+
let n = new AbortController();
|
|
36
|
+
return (async () => {
|
|
37
|
+
try {
|
|
38
|
+
let r = await fetch(e, {
|
|
39
|
+
method: "GET",
|
|
40
|
+
credentials: "include",
|
|
41
|
+
headers: a.current,
|
|
42
|
+
signal: n.signal
|
|
43
|
+
});
|
|
44
|
+
if (!r.ok) {
|
|
45
|
+
x(t, null), i({ status: "missing" });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let o = (await r.json())?.content?.data;
|
|
49
|
+
if (!o || typeof o.id != "string" || o.id.length === 0) {
|
|
50
|
+
x(t, null), i({ status: "missing" });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
x(t, o), i({
|
|
54
|
+
status: "ready",
|
|
55
|
+
agent: o
|
|
56
|
+
});
|
|
57
|
+
} catch (e) {
|
|
58
|
+
if (e?.name === "AbortError") return;
|
|
59
|
+
console.warn("[levo-kb-chat] active-agent boot failed:", e), i({ status: "error" });
|
|
60
|
+
}
|
|
61
|
+
})(), () => n.abort();
|
|
62
|
+
}, [t, e]), r;
|
|
63
|
+
}, C = (...e) => e.filter(Boolean).join(" "), w = () => import("./KBChatWidget-h3xW6Q4I.js"), T = (e) => {
|
|
64
|
+
let [t, n] = m(null), [r, i] = m(!1), [a, o] = m("");
|
|
65
|
+
return t ? /* @__PURE__ */ h(t, {
|
|
66
|
+
initialOpen: !0,
|
|
67
|
+
initialDraft: a,
|
|
68
|
+
...e
|
|
69
|
+
}) : /* @__PURE__ */ h(D, {
|
|
70
|
+
siteName: e.siteName,
|
|
71
|
+
draft: a,
|
|
72
|
+
loading: r,
|
|
73
|
+
onDraftChange: o,
|
|
74
|
+
onActivate: () => {
|
|
75
|
+
r || t || (i(!0), w().then((e) => n(() => e.KBChatWidget)).catch((e) => {
|
|
76
|
+
i(!1), console.warn("[levo-kb-chat] widget load failed:", e);
|
|
77
|
+
}));
|
|
78
|
+
},
|
|
79
|
+
onPrefetch: () => {
|
|
80
|
+
w().catch(() => {});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, E = () => /* @__PURE__ */ h("span", {
|
|
84
|
+
"aria-hidden": !0,
|
|
85
|
+
className: "h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
86
|
+
}), D = ({ siteName: i, draft: f, loading: m, onDraftChange: y, onActivate: b, onPrefetch: x }) => {
|
|
87
|
+
let S = p(null), w = r(i);
|
|
88
|
+
return /* @__PURE__ */ h("div", {
|
|
89
|
+
onPointerEnter: x,
|
|
90
|
+
className: C("ai-chat-launcher fixed bottom-8 left-1/2 z-[60] -translate-x-1/2", n),
|
|
91
|
+
children: /* @__PURE__ */ h("div", {
|
|
92
|
+
className: C(u, l, "ai-chat-intro-morph"),
|
|
93
|
+
children: /* @__PURE__ */ g("div", {
|
|
94
|
+
className: o,
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ h("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
onClick: b,
|
|
99
|
+
onFocus: x,
|
|
100
|
+
"aria-label": "Open AI chat",
|
|
101
|
+
className: t,
|
|
102
|
+
children: m ? /* @__PURE__ */ h(E, {}) : /* @__PURE__ */ h(v, { className: "h-5 w-5" })
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ g("div", {
|
|
105
|
+
className: s,
|
|
106
|
+
children: [/* @__PURE__ */ h("textarea", {
|
|
107
|
+
ref: S,
|
|
108
|
+
rows: 1,
|
|
109
|
+
autoComplete: "off",
|
|
110
|
+
autoCorrect: "off",
|
|
111
|
+
autoCapitalize: "none",
|
|
112
|
+
inputMode: "text",
|
|
113
|
+
value: f,
|
|
114
|
+
"aria-label": w,
|
|
115
|
+
onFocus: b,
|
|
116
|
+
onChange: (e) => {
|
|
117
|
+
y(e.currentTarget.value), c(e.currentTarget, 120);
|
|
118
|
+
},
|
|
119
|
+
className: d
|
|
120
|
+
}), !f && /* @__PURE__ */ h("span", {
|
|
121
|
+
className: C("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"),
|
|
122
|
+
"aria-hidden": !0,
|
|
123
|
+
children: w
|
|
124
|
+
})]
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ h("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
onClick: b,
|
|
129
|
+
"aria-label": "Open AI chat",
|
|
130
|
+
className: a,
|
|
131
|
+
style: e,
|
|
132
|
+
children: m ? /* @__PURE__ */ h(E, {}) : /* @__PURE__ */ h(_, { className: "h-5 w-5 stroke-[2.5px]" })
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
}, O = "/.levo/public/api/v1/agents/kb-chat/public", k = (e) => e.replace(/\/v1\/agents\/kb-chat\/public\/?$/, ""), A = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, apiBaseUrl: i = O, authHeaders: a, showBranding: o, siteSlug: s }) => {
|
|
139
|
+
let c = S({
|
|
140
|
+
url: `${k(i)}/v1/intelligence/site-agent/get-active`,
|
|
141
|
+
workspaceId: e,
|
|
142
|
+
headers: e ? {
|
|
143
|
+
...a,
|
|
144
|
+
"Levo-Workspace": e
|
|
145
|
+
} : a
|
|
146
|
+
});
|
|
147
|
+
return c.status === "ready" ? /* @__PURE__ */ h("div", {
|
|
148
|
+
"data-ai-chat-root": !0,
|
|
149
|
+
children: /* @__PURE__ */ h(T, {
|
|
150
|
+
workspaceId: e,
|
|
151
|
+
siteName: t,
|
|
152
|
+
siteLogo: n,
|
|
153
|
+
siteIcon: r,
|
|
154
|
+
agentId: c.agent.id,
|
|
155
|
+
apiBaseUrl: i,
|
|
156
|
+
authHeaders: a,
|
|
157
|
+
showBranding: o,
|
|
158
|
+
siteSlug: s
|
|
159
|
+
})
|
|
160
|
+
}) : null;
|
|
161
|
+
};
|
|
162
|
+
//#endregion
|
|
163
|
+
export { A as default };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { n as e } from "./theme.cssm-2YTdd8Yh.js";
|
|
2
|
+
import { Extension as t, findParentNodeClosestToPos as n } from "@tiptap/core";
|
|
3
|
+
import { NodeSelection as r } from "@tiptap/pm/state";
|
|
4
|
+
import { CellSelection as i, cellAround as a } from "@tiptap/pm/tables";
|
|
5
|
+
//#region ../../libraries/editor-core/dist/styles/content.cssm.js
|
|
6
|
+
var o = "_12oclrg0", s = "u2k86a0", c = e({
|
|
7
|
+
baseSpacing: "var(--_1q6hy0o0)",
|
|
8
|
+
highlight: "var(--_1q6hy0o1)",
|
|
9
|
+
highlightForeground: "var(--_1q6hy0o2)"
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ../../libraries/editor-core/dist/utils/getSelectedNodeOfType.js
|
|
13
|
+
function l(e, t) {
|
|
14
|
+
let o = [], s = new Set(t);
|
|
15
|
+
if (e instanceof i) return e.forEachCell((e, t) => {
|
|
16
|
+
s.has(e.type.name) && o.push({
|
|
17
|
+
node: e,
|
|
18
|
+
pos: t
|
|
19
|
+
});
|
|
20
|
+
}), o;
|
|
21
|
+
if (e instanceof r) {
|
|
22
|
+
let { node: t, from: n } = e;
|
|
23
|
+
return t && s.has(t.type.name) && o.push({
|
|
24
|
+
node: t,
|
|
25
|
+
pos: n
|
|
26
|
+
}), o;
|
|
27
|
+
}
|
|
28
|
+
let { $anchor: c } = e, l = a(c);
|
|
29
|
+
if (l) {
|
|
30
|
+
let t = e.$anchor.doc.nodeAt(l.pos);
|
|
31
|
+
if (t && s.has(t.type.name)) return o.push({
|
|
32
|
+
node: t,
|
|
33
|
+
pos: l.pos
|
|
34
|
+
}), o;
|
|
35
|
+
}
|
|
36
|
+
let u = n(c, (e) => s.has(e.type.name));
|
|
37
|
+
return u && o.push({
|
|
38
|
+
node: u.node,
|
|
39
|
+
pos: u.pos
|
|
40
|
+
}), o;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region ../../libraries/editor-core/dist/utils/updateNodesAttr.js
|
|
44
|
+
function u(e, t, n, r) {
|
|
45
|
+
if (!t.length) return !1;
|
|
46
|
+
let i = !1;
|
|
47
|
+
for (let { pos: a } of t) {
|
|
48
|
+
let t = e.doc.nodeAt(a);
|
|
49
|
+
if (!t) continue;
|
|
50
|
+
let o = t.attrs[n], s = typeof r == "function" ? r(o) : r;
|
|
51
|
+
if (o === s) continue;
|
|
52
|
+
let c = { ...t.attrs };
|
|
53
|
+
s === void 0 ? delete c[n] : c[n] = s, e.setNodeMarkup(a, void 0, c), i = !0;
|
|
54
|
+
}
|
|
55
|
+
return i;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region ../../libraries/editor-core/dist/extensions/nodeStyling/nodeAlignment.js
|
|
59
|
+
function d(e, t, n) {
|
|
60
|
+
if (e.length === 0) return null;
|
|
61
|
+
for (let r of e) if ((r.node.attrs?.[t] ?? null) !== n) return n;
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
var f = t.create({
|
|
65
|
+
name: "textAlign",
|
|
66
|
+
addOptions() {
|
|
67
|
+
return {
|
|
68
|
+
types: [
|
|
69
|
+
"paragraph",
|
|
70
|
+
"heading",
|
|
71
|
+
"quote",
|
|
72
|
+
"blockquoteFigure",
|
|
73
|
+
"tableCell",
|
|
74
|
+
"tableHeader"
|
|
75
|
+
],
|
|
76
|
+
useStyle: !0,
|
|
77
|
+
textAlignValues: [
|
|
78
|
+
"left",
|
|
79
|
+
"center",
|
|
80
|
+
"right",
|
|
81
|
+
"justify"
|
|
82
|
+
],
|
|
83
|
+
verticalAlignValues: [
|
|
84
|
+
"top",
|
|
85
|
+
"middle",
|
|
86
|
+
"bottom"
|
|
87
|
+
]
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
addGlobalAttributes() {
|
|
91
|
+
return [{
|
|
92
|
+
types: this.options.types,
|
|
93
|
+
attributes: {
|
|
94
|
+
textAlign: {
|
|
95
|
+
default: null,
|
|
96
|
+
parseHTML: (e) => {
|
|
97
|
+
let t = e.style?.textAlign;
|
|
98
|
+
if (t && this.options.textAlignValues.includes(t)) return t;
|
|
99
|
+
let n = e.getAttribute("data-text-align");
|
|
100
|
+
return n && this.options.textAlignValues.includes(n) ? n : null;
|
|
101
|
+
},
|
|
102
|
+
renderHTML: (e) => {
|
|
103
|
+
let t = e.textAlign;
|
|
104
|
+
return !t || !this.options.textAlignValues.includes(t) ? {} : this.options.useStyle ? { style: `text-align: ${t}` } : { "data-text-align": t };
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
nodeVerticalAlign: {
|
|
108
|
+
default: null,
|
|
109
|
+
parseHTML: (e) => {
|
|
110
|
+
let t = e.style?.verticalAlign;
|
|
111
|
+
if (t && this.options.verticalAlignValues.includes(t)) return t;
|
|
112
|
+
let n = e.getAttribute("data-vertical-align");
|
|
113
|
+
return n && this.options.verticalAlignValues.includes(n) ? n : null;
|
|
114
|
+
},
|
|
115
|
+
renderHTML: (e) => {
|
|
116
|
+
let t = e.nodeVerticalAlign;
|
|
117
|
+
return !t || !this.options.verticalAlignValues.includes(t) ? {} : this.options.useStyle ? { style: `vertical-align: ${t}` } : { "data-vertical-align": t };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}];
|
|
122
|
+
},
|
|
123
|
+
addCommands() {
|
|
124
|
+
let e = (e, t) => (n) => ({ state: r, tr: i }) => {
|
|
125
|
+
let a = l(r.selection, this.options.types);
|
|
126
|
+
return a.length === 0 ? !1 : u(i, a, e, t(a, n));
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
setNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : t),
|
|
130
|
+
unsetNodeTextAlign: e("textAlign", () => null),
|
|
131
|
+
toggleNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : d(e, "textAlign", t)),
|
|
132
|
+
setNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : t),
|
|
133
|
+
unsetNodeVAlign: e("nodeVerticalAlign", () => null),
|
|
134
|
+
toggleNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : d(e, "nodeVerticalAlign", t)),
|
|
135
|
+
setNodeAlignment: (e, t) => ({ state: n, tr: r }) => {
|
|
136
|
+
let i = l(n.selection, this.options.types);
|
|
137
|
+
if (i.length === 0) return !1;
|
|
138
|
+
let a = !1;
|
|
139
|
+
for (let { node: n, pos: o } of i) {
|
|
140
|
+
let i = { ...n.attrs };
|
|
141
|
+
e && this.options.textAlignValues.includes(e) && (i.textAlign = e, a = !0), t && this.options.verticalAlignValues.includes(t) && (i.nodeVerticalAlign = t, a = !0), a && r.setNodeMarkup(o, void 0, i);
|
|
142
|
+
}
|
|
143
|
+
return a;
|
|
144
|
+
},
|
|
145
|
+
unsetNodeAlignment: () => ({ state: e, tr: t }) => {
|
|
146
|
+
let n = l(e.selection, this.options.types);
|
|
147
|
+
if (n.length === 0) return !1;
|
|
148
|
+
let r = !1;
|
|
149
|
+
for (let { node: e, pos: i } of n) {
|
|
150
|
+
let n = e.attrs?.textAlign ?? null, a = e.attrs?.nodeVerticalAlign ?? null;
|
|
151
|
+
if (n || a) {
|
|
152
|
+
let n = {
|
|
153
|
+
...e.attrs,
|
|
154
|
+
textAlign: null,
|
|
155
|
+
nodeVerticalAlign: null
|
|
156
|
+
};
|
|
157
|
+
t.setNodeMarkup(i, void 0, n), r = !0;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return r;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
//#endregion
|
|
166
|
+
export { o as i, c as n, s as r, f as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levo-so/site-runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Runtime for Levo Studio v3 sites — the editor preview inspector, page head metadata, and the Levo data client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"types": "./index.d.ts",
|
|
18
18
|
"default": "./index.js"
|
|
19
19
|
},
|
|
20
|
+
"./popups": {
|
|
21
|
+
"types": "./popups.d.ts",
|
|
22
|
+
"default": "./popups.js"
|
|
23
|
+
},
|
|
20
24
|
"./setup.css": "./styles.css"
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
@@ -63,15 +67,23 @@
|
|
|
63
67
|
"lowlight": "3.1.0",
|
|
64
68
|
"@vanilla-extract/dynamic": "2.1.5",
|
|
65
69
|
"sonner": "2.0.7",
|
|
70
|
+
"@assistant-ui/react": "0.12.14",
|
|
71
|
+
"@assistant-ui/react-ai-sdk": "1.3.10",
|
|
72
|
+
"@assistant-ui/react-markdown": "0.12.5",
|
|
73
|
+
"@assistant-ui/core": "0.1.5",
|
|
74
|
+
"@assistant-ui/store": "0.2.2",
|
|
75
|
+
"@assistant-ui/tap": "0.5.2",
|
|
76
|
+
"remark-gfm": "4.0.1",
|
|
66
77
|
"@stripe/react-stripe-js": "^3.1.1",
|
|
67
78
|
"@stripe/stripe-js": "^5.5.0",
|
|
68
79
|
"react-razorpay": "^3.0.1",
|
|
69
|
-
"@levo-so/
|
|
70
|
-
"@levo-so/
|
|
80
|
+
"@levo-so/core": "0.2.1",
|
|
81
|
+
"@levo-so/insights": "0.2.1"
|
|
71
82
|
},
|
|
72
83
|
"peerDependencies": {
|
|
73
84
|
"@base-ui/react": "^1.5.0",
|
|
74
85
|
"@tanstack/react-query": ">=5",
|
|
86
|
+
"@tanstack/react-router": ">=1.170.0",
|
|
75
87
|
"lucide-react": ">=0.4",
|
|
76
88
|
"react": ">=19",
|
|
77
89
|
"react-dom": ">=19"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../libraries/ai-chat/src/helpers.ts
|
|
2
|
+
var e = (e, t = {
|
|
3
|
+
hour: "numeric",
|
|
4
|
+
minute: "2-digit"
|
|
5
|
+
}) => {
|
|
6
|
+
if (!e) return "";
|
|
7
|
+
let n = e instanceof Date ? e : new Date(e);
|
|
8
|
+
return Number.isNaN(n.getTime()) ? "" : n.toLocaleTimeString([], t);
|
|
9
|
+
}, t = (e, t) => t ? `levo.site_chat.${e}.${t}` : null, n = (e, t) => {
|
|
10
|
+
e.style.height = "auto", e.style.height = t === void 0 ? `${e.scrollHeight}px` : `${Math.min(e.scrollHeight, t)}px`;
|
|
11
|
+
}, r = "w-72", i = "ai-chat-pill-gradient relative rounded-full p-[2px] transition-shadow duration-300", a = "shadow-lg shadow-zinc-950/10", o = "shadow-md", s = "flex min-h-14 w-full items-end gap-1.5 rounded-full bg-white p-1.5", c = "relative min-w-0 flex-1 py-2.5", l = "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", u = "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", d = "block h-6 max-h-[120px] w-full resize-none overflow-hidden bg-transparent text-base text-zinc-900 leading-6 placeholder:text-zinc-400 focus:outline-none", f = "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", p = {
|
|
12
|
+
backgroundColor: "var(--color-brand, #0a0a0a)",
|
|
13
|
+
color: "var(--color-brand-foreground, #fff)"
|
|
14
|
+
}, m = (e) => e ? `Ask ${e}` : "Ask AI";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { p as a, l as c, r as d, m as f, t as h, u as i, s as l, e as m, c as n, o, n as p, f as r, a as s, i as t, d as u };
|
package/popups.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `usePopup` — imperative open/close for the site's popups.
|
|
3
|
+
*
|
|
4
|
+
* This is its OWN package entry (`@levo-so/site-runtime/popups`), deliberately not part of
|
|
5
|
+
* the main barrel. Upstream, the popup store is emitted into the same chunk as the tiptap
|
|
6
|
+
* content renderer, so any static import of this hook drags ~100 kB of renderer with it
|
|
7
|
+
* (see levo-turbo#4545). Exporting it from the barrel would put that on the eager graph of
|
|
8
|
+
* EVERY page of EVERY site — including sites with no popups — and on every SSR render.
|
|
9
|
+
* From a separate entry, only a page that actually imports it pays.
|
|
10
|
+
*
|
|
11
|
+
* Static (not lazy) by necessity: a hook must be callable during render, and it has to read
|
|
12
|
+
* the SAME nanostores store the mounted `<LevoPopups>` writes to — a lazily-loaded second
|
|
13
|
+
* copy would never see the loaded popups.
|
|
14
|
+
*
|
|
15
|
+
* When #4545 lands a store-only entry upstream, re-point the import at it; consumers keep
|
|
16
|
+
* this import path and just get lighter.
|
|
17
|
+
*/
|
|
18
|
+
/** The slice of a loaded popup a site can act on. Matching by `id` is the contract. */
|
|
19
|
+
export declare interface ILevoPopup {
|
|
20
|
+
/** Stable popup id (`PU…`) — what `openPopup` takes. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** The name the popup was given in the dashboard. */
|
|
23
|
+
title: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare interface ILevoPopupControls {
|
|
28
|
+
/** Active popups loaded for this site. Empty until the fetch resolves. */
|
|
29
|
+
popups: ILevoPopup[];
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Open a popup by id. Force-opens — bypasses cooldown and display-frequency caps,
|
|
33
|
+
* because a click is an explicit request. No-op if that popup isn't loaded.
|
|
34
|
+
*/
|
|
35
|
+
openPopup: (id: string) => void;
|
|
36
|
+
/** Close whatever popup is currently open. No-op if none is. */
|
|
37
|
+
closePopup: () => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Explicit return type on purpose: it keeps the rolled-up `.d.ts` self-contained. A bare
|
|
42
|
+
* `export { usePopup } from "@levo.libraries/popups"` emits a re-export of a PRIVATE
|
|
43
|
+
* package that a generated site can't resolve.
|
|
44
|
+
*/
|
|
45
|
+
export declare const usePopup: () => ILevoPopupControls;
|
|
46
|
+
|
|
47
|
+
export { }
|
package/popups.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t };
|