laif-ds 0.2.80 → 0.2.84
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/CHANGELOG.md +40 -0
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.js +2 -5
- package/dist/agent-docs/adoption-report.json +17 -13
- package/dist/agent-docs/components/AppEditor.md +117 -7
- package/dist/agent-docs/components/Chat.md +1 -0
- package/dist/agent-docs/components/FileUploader.md +8 -3
- package/dist/agent-docs/manifest.json +125 -19
- package/dist/components/editor/nodes/mention-node.js +113 -0
- package/dist/components/editor/plugins/mention-plugin.js +215 -0
- package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +41 -0
- package/dist/components/ui/app-editor.js +150 -112
- package/dist/components/ui/chat.js +35 -33
- package/dist/components/ui/file-previewer.js +66 -61
- package/dist/components/ui/file-uploader.js +116 -112
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/index.d.ts +44 -5
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +5 -5
- package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +220 -0
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/lexical/Lexical.prod.js +314 -303
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
- /package/dist/agent-docs/{truncated-cell.md → components/truncated-cell.md} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { useLexicalComposerContext as m } from "../../../node_modules/@lexical/react/LexicalComposerContext.prod.js";
|
|
4
|
+
import { DecoratorNode as u, $getNodeByKey as c } from "../../../node_modules/lexical/Lexical.prod.js";
|
|
5
|
+
import { Icon as _ } from "../../ui/icon.js";
|
|
6
|
+
const p = "bg-d-primary/10 text-d-primary inline-flex items-center gap-0.5 rounded-md py-0.5 pr-0.5 pl-1.5 text-sm font-medium align-baseline", d = "ml-0.5 inline-flex size-5 items-center justify-center rounded-sm hover:bg-d-primary/20 cursor-pointer";
|
|
7
|
+
function b({ nodeKey: n, data: e }) {
|
|
8
|
+
const [i] = m(), a = () => {
|
|
9
|
+
i.update(() => {
|
|
10
|
+
const r = c(n);
|
|
11
|
+
f(r) && r.remove();
|
|
12
|
+
});
|
|
13
|
+
}, l = e.value ? `Mention: ${e.label}, ${e.value}` : `Mention: ${e.label}`;
|
|
14
|
+
return /* @__PURE__ */ s(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
className: p,
|
|
18
|
+
"data-mention-id": e.id,
|
|
19
|
+
"aria-roledescription": "mention",
|
|
20
|
+
"aria-label": l,
|
|
21
|
+
children: [
|
|
22
|
+
"@",
|
|
23
|
+
e.label,
|
|
24
|
+
/* @__PURE__ */ o(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
className: d,
|
|
29
|
+
"aria-label": `Remove mention ${e.label}`,
|
|
30
|
+
onClick: a,
|
|
31
|
+
children: /* @__PURE__ */ o(_, { name: "X", size: "xs", "aria-hidden": !0 })
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
class t extends u {
|
|
39
|
+
__mentionId;
|
|
40
|
+
__mentionLabel;
|
|
41
|
+
__mentionValue;
|
|
42
|
+
static getType() {
|
|
43
|
+
return "mention";
|
|
44
|
+
}
|
|
45
|
+
static clone(e) {
|
|
46
|
+
return new t(
|
|
47
|
+
{
|
|
48
|
+
id: e.__mentionId,
|
|
49
|
+
label: e.__mentionLabel,
|
|
50
|
+
value: e.__mentionValue
|
|
51
|
+
},
|
|
52
|
+
e.__key
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
constructor(e, i) {
|
|
56
|
+
super(i), this.__mentionId = e.id, this.__mentionLabel = e.label, this.__mentionValue = e.value;
|
|
57
|
+
}
|
|
58
|
+
static importJSON(e) {
|
|
59
|
+
return h({
|
|
60
|
+
id: e.mentionId,
|
|
61
|
+
label: e.mentionLabel,
|
|
62
|
+
value: e.mentionValue
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exportJSON() {
|
|
66
|
+
return {
|
|
67
|
+
...super.exportJSON(),
|
|
68
|
+
type: "mention",
|
|
69
|
+
version: 1,
|
|
70
|
+
mentionId: this.__mentionId,
|
|
71
|
+
mentionLabel: this.__mentionLabel,
|
|
72
|
+
mentionValue: this.__mentionValue
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
static importDOM() {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
getMentionData() {
|
|
79
|
+
return {
|
|
80
|
+
id: this.__mentionId,
|
|
81
|
+
label: this.__mentionLabel,
|
|
82
|
+
value: this.__mentionValue
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// Plain-text representation (used by $rootTextContent, copy/paste, counters).
|
|
86
|
+
// Intentionally returns the human-readable `@label`, NOT the markdown token —
|
|
87
|
+
// the token is the markdown-serialization concern (see MENTION_TRANSFORMER),
|
|
88
|
+
// while plain-text consumers want readable text.
|
|
89
|
+
getTextContent() {
|
|
90
|
+
return `@${this.__mentionLabel}`;
|
|
91
|
+
}
|
|
92
|
+
createDOM() {
|
|
93
|
+
const e = document.createElement("span");
|
|
94
|
+
return e.setAttribute("data-slot", "mention-node"), e;
|
|
95
|
+
}
|
|
96
|
+
updateDOM() {
|
|
97
|
+
return !1;
|
|
98
|
+
}
|
|
99
|
+
decorate() {
|
|
100
|
+
return /* @__PURE__ */ o(b, { nodeKey: this.getKey(), data: this.getMentionData() });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function h(n) {
|
|
104
|
+
return new t(n);
|
|
105
|
+
}
|
|
106
|
+
function f(n) {
|
|
107
|
+
return n instanceof t;
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
h as $createMentionNode,
|
|
111
|
+
f as $isMentionNode,
|
|
112
|
+
t as MentionNode
|
|
113
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d, jsxs as C } from "react/jsx-runtime";
|
|
3
|
+
import { useLexicalComposerContext as I } from "../../../node_modules/@lexical/react/LexicalComposerContext.prod.js";
|
|
4
|
+
import { useBasicTypeaheadTriggerMatch as P, LexicalTypeaheadMenuPlugin as U, MenuOption as q } from "../../../node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js";
|
|
5
|
+
import { $createTextNode as F } from "../../../node_modules/lexical/Lexical.prod.js";
|
|
6
|
+
import { useState as N, useRef as L, useEffect as x, useMemo as Q, useCallback as _ } from "react";
|
|
7
|
+
import { createPortal as j } from "react-dom";
|
|
8
|
+
import { MentionNode as z, $createMentionNode as T, $isMentionNode as B } from "../nodes/mention-node.js";
|
|
9
|
+
import { cn as $ } from "../../../lib/utils.js";
|
|
10
|
+
const w = "app-editor-mention-menu", E = (e) => `${w}-option-${e}`;
|
|
11
|
+
class H extends q {
|
|
12
|
+
item;
|
|
13
|
+
constructor(t) {
|
|
14
|
+
super(String(t.id)), this.item = t;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function V(e, t) {
|
|
18
|
+
const o = t.trim().toLowerCase();
|
|
19
|
+
return o ? e.filter(
|
|
20
|
+
(n) => n.label.toLowerCase().split(/\s+/).some((i) => i.startsWith(o))
|
|
21
|
+
) : e;
|
|
22
|
+
}
|
|
23
|
+
const v = (e) => {
|
|
24
|
+
try {
|
|
25
|
+
return decodeURIComponent(e);
|
|
26
|
+
} catch {
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
}, ne = {
|
|
30
|
+
dependencies: [z],
|
|
31
|
+
export: (e) => {
|
|
32
|
+
if (!B(e)) return null;
|
|
33
|
+
const { id: t, label: o, value: n } = e.getMentionData(), i = encodeURIComponent(o), a = encodeURIComponent(String(t)), m = n ? `?v=${encodeURIComponent(n)}` : "";
|
|
34
|
+
return `@[${i}](mention:${a}${m})`;
|
|
35
|
+
},
|
|
36
|
+
importRegExp: /@\[([^\]]*)\]\(mention:([^?)]+)(?:\?v=([^)]*))?\)/,
|
|
37
|
+
regExp: /@\[([^\]]*)\]\(mention:([^?)]+)(?:\?v=([^)]*))?\)$/,
|
|
38
|
+
replace: (e, t) => {
|
|
39
|
+
const [, o, n, i] = t, a = T({
|
|
40
|
+
id: v(n),
|
|
41
|
+
label: v(o),
|
|
42
|
+
value: i ? v(i) : void 0
|
|
43
|
+
});
|
|
44
|
+
e.replace(a);
|
|
45
|
+
},
|
|
46
|
+
trigger: ")",
|
|
47
|
+
type: "text-match"
|
|
48
|
+
};
|
|
49
|
+
function oe({ source: e, trigger: t }) {
|
|
50
|
+
const [o] = I(), [n, i] = N(null), a = typeof e == "function", [m, f] = N([]), [l, r] = N("idle"), c = L(e);
|
|
51
|
+
c.current = e;
|
|
52
|
+
const y = L(!0);
|
|
53
|
+
x(
|
|
54
|
+
() => () => {
|
|
55
|
+
y.current = !1;
|
|
56
|
+
},
|
|
57
|
+
[]
|
|
58
|
+
), x(() => {
|
|
59
|
+
if (n === null || l !== "idle") return;
|
|
60
|
+
const s = c.current;
|
|
61
|
+
typeof s == "function" && (r("loading"), Promise.resolve(s()).then(
|
|
62
|
+
(u) => {
|
|
63
|
+
y.current && (f(u), r("ready"));
|
|
64
|
+
},
|
|
65
|
+
() => {
|
|
66
|
+
y.current && r("error");
|
|
67
|
+
}
|
|
68
|
+
));
|
|
69
|
+
}, [n, l]), x(() => {
|
|
70
|
+
n === null && l === "error" && r("idle");
|
|
71
|
+
}, [n, l]);
|
|
72
|
+
const R = a ? m : e, p = a ? l : "ready", O = t.length === 1 ? t : "@", k = P(O, {
|
|
73
|
+
minLength: 0
|
|
74
|
+
}), g = Q(
|
|
75
|
+
() => V(R, n ?? "").map(
|
|
76
|
+
(s) => new H(s)
|
|
77
|
+
),
|
|
78
|
+
[R, n]
|
|
79
|
+
), A = _(
|
|
80
|
+
(s, u, M) => {
|
|
81
|
+
o.update(() => {
|
|
82
|
+
const h = T({
|
|
83
|
+
id: s.item.id,
|
|
84
|
+
label: s.item.label,
|
|
85
|
+
value: s.item.value
|
|
86
|
+
});
|
|
87
|
+
u && u.replace(h);
|
|
88
|
+
const b = F(" ");
|
|
89
|
+
h.insertAfter(b), b.select(), M();
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
[o]
|
|
93
|
+
);
|
|
94
|
+
return /* @__PURE__ */ d(
|
|
95
|
+
U,
|
|
96
|
+
{
|
|
97
|
+
onQueryChange: i,
|
|
98
|
+
onSelectOption: A,
|
|
99
|
+
triggerFn: k,
|
|
100
|
+
options: g,
|
|
101
|
+
menuRenderFn: (s, { selectedIndex: u, selectOptionAndCleanUp: M, setHighlightedIndex: h }) => {
|
|
102
|
+
if (s.current === null)
|
|
103
|
+
return null;
|
|
104
|
+
const b = p === "loading" || p === "error", D = (n ?? "").length > 0, S = p === "ready" && D && g.length === 0;
|
|
105
|
+
return !b && g.length === 0 && !S ? null : j(
|
|
106
|
+
/* @__PURE__ */ d(
|
|
107
|
+
W,
|
|
108
|
+
{
|
|
109
|
+
options: g,
|
|
110
|
+
selectedIndex: u,
|
|
111
|
+
status: p,
|
|
112
|
+
showEmptyState: S,
|
|
113
|
+
query: n ?? "",
|
|
114
|
+
onHighlight: h,
|
|
115
|
+
onSelect: M
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
s.current
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function W({
|
|
125
|
+
options: e,
|
|
126
|
+
selectedIndex: t,
|
|
127
|
+
status: o,
|
|
128
|
+
showEmptyState: n,
|
|
129
|
+
query: i,
|
|
130
|
+
onHighlight: a,
|
|
131
|
+
onSelect: m
|
|
132
|
+
}) {
|
|
133
|
+
const [f] = I(), l = o === "ready" && !n && e.length > 0;
|
|
134
|
+
return x(() => {
|
|
135
|
+
const r = f.getRootElement();
|
|
136
|
+
if (r)
|
|
137
|
+
return l && t !== null ? r.setAttribute(
|
|
138
|
+
"aria-activedescendant",
|
|
139
|
+
E(t)
|
|
140
|
+
) : r.removeAttribute("aria-activedescendant"), () => {
|
|
141
|
+
r.removeAttribute("aria-activedescendant");
|
|
142
|
+
};
|
|
143
|
+
}, [f, t, l]), /* @__PURE__ */ d(
|
|
144
|
+
"ul",
|
|
145
|
+
{
|
|
146
|
+
id: w,
|
|
147
|
+
role: "listbox",
|
|
148
|
+
"aria-label": "People you can mention",
|
|
149
|
+
"aria-busy": o === "loading",
|
|
150
|
+
"data-slot": "mention-menu",
|
|
151
|
+
className: $(
|
|
152
|
+
"border-d-border bg-d-background z-50 max-h-60 min-w-52 overflow-auto rounded-md border p-1 shadow-md"
|
|
153
|
+
),
|
|
154
|
+
children: o === "loading" ? /* @__PURE__ */ d(
|
|
155
|
+
"li",
|
|
156
|
+
{
|
|
157
|
+
role: "presentation",
|
|
158
|
+
className: "text-d-muted-foreground px-2 py-1.5 text-sm",
|
|
159
|
+
children: "Loading…"
|
|
160
|
+
}
|
|
161
|
+
) : o === "error" ? /* @__PURE__ */ d(
|
|
162
|
+
"li",
|
|
163
|
+
{
|
|
164
|
+
role: "presentation",
|
|
165
|
+
className: "text-d-muted-foreground px-2 py-1.5 text-sm",
|
|
166
|
+
children: "Couldn't load mentions"
|
|
167
|
+
}
|
|
168
|
+
) : n ? /* @__PURE__ */ C(
|
|
169
|
+
"li",
|
|
170
|
+
{
|
|
171
|
+
role: "presentation",
|
|
172
|
+
className: "text-d-muted-foreground px-2 py-1.5 text-sm",
|
|
173
|
+
children: [
|
|
174
|
+
'No matches for "',
|
|
175
|
+
i,
|
|
176
|
+
'"'
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
) : e.map((r, c) => /* @__PURE__ */ C(
|
|
180
|
+
"li",
|
|
181
|
+
{
|
|
182
|
+
id: E(c),
|
|
183
|
+
role: "option",
|
|
184
|
+
"aria-selected": t === c,
|
|
185
|
+
ref: r.setRefElement,
|
|
186
|
+
tabIndex: -1,
|
|
187
|
+
className: $(
|
|
188
|
+
"flex cursor-pointer flex-col rounded-sm px-2 py-1.5 text-sm",
|
|
189
|
+
t === c ? "bg-d-accent text-d-accent-foreground" : "text-d-foreground"
|
|
190
|
+
),
|
|
191
|
+
onMouseEnter: () => a(c),
|
|
192
|
+
onClick: () => m(r),
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ d("span", { className: "font-medium", children: r.item.label }),
|
|
195
|
+
r.item.sublabel && /* @__PURE__ */ d("span", { className: "text-d-muted-foreground text-xs", children: r.item.sublabel })
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
r.key
|
|
199
|
+
))
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
function re(e) {
|
|
204
|
+
const t = /* @__PURE__ */ new Set(), o = [];
|
|
205
|
+
for (const n of e) {
|
|
206
|
+
const i = n.getMentionData(), a = String(i.id);
|
|
207
|
+
t.has(a) || (t.add(a), o.push(i));
|
|
208
|
+
}
|
|
209
|
+
return o;
|
|
210
|
+
}
|
|
211
|
+
export {
|
|
212
|
+
ne as MENTION_TRANSFORMER,
|
|
213
|
+
oe as MentionPlugin,
|
|
214
|
+
re as collectMentions
|
|
215
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { $getSelection as i, $isRangeSelection as c, $getRoot as a } from "../../../../node_modules/lexical/Lexical.prod.js";
|
|
4
|
+
import { useToolbarContext as f } from "../../context/toolbar-context.js";
|
|
5
|
+
import { Toggle as m } from "../../../ui/toggle.js";
|
|
6
|
+
import p from "../../../../node_modules/lucide-react/dist/esm/icons/at-sign.js";
|
|
7
|
+
function l(n, t) {
|
|
8
|
+
const { anchor: o } = n;
|
|
9
|
+
let e = "";
|
|
10
|
+
return o.type === "text" && (e = o.getNode().getTextContent().slice(0, o.offset).slice(-1)), e !== "" && !/[\s(]/.test(e) ? ` ${t}` : t;
|
|
11
|
+
}
|
|
12
|
+
function T({ trigger: n }) {
|
|
13
|
+
const { activeEditor: t } = f();
|
|
14
|
+
return /* @__PURE__ */ r(
|
|
15
|
+
m,
|
|
16
|
+
{
|
|
17
|
+
"aria-label": "Insert mention",
|
|
18
|
+
variant: "outline",
|
|
19
|
+
size: "sm",
|
|
20
|
+
pressed: !1,
|
|
21
|
+
onClick: () => {
|
|
22
|
+
t.focus(), t.update(() => {
|
|
23
|
+
const e = i();
|
|
24
|
+
if (c(e)) {
|
|
25
|
+
e.insertText(l(e, n));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
a().selectEnd();
|
|
29
|
+
const s = i();
|
|
30
|
+
c(s) && s.insertText(
|
|
31
|
+
l(s, n)
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
children: /* @__PURE__ */ r(p, { className: "h-4 w-4" })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
T as MentionInsertToolbarPlugin
|
|
41
|
+
};
|