@epam/ai-dial-skill-editor 1.1.0-dev.298 → 1.1.0-dev.300
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillEditor.d.ts","sourceRoot":"","sources":["../../../src/components/SkillEditor/SkillEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SkillEditor.d.ts","sourceRoot":"","sources":["../../../src/components/SkillEditor/SkillEditor.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAEL,EAAE,EASH,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,iCAAiC,CAAC;AAqBzC,qFAAqF;AACrF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2c5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillFileDropOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/SkillFileDropOverlay/SkillFileDropOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SkillFileDropOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/SkillFileDropOverlay/SkillFileDropOverlay.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,wCAAwC;AACxC,MAAM,WAAW,yBAAyB;IACxC,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,MAAM,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,qBAAqB,CAAC,CAAC;CAC9E;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA+B9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillFileUploadDialog.d.ts","sourceRoot":"","sources":["../../../src/components/SkillFileUploadDialog/SkillFileUploadDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SkillFileUploadDialog.d.ts","sourceRoot":"","sources":["../../../src/components/SkillFileUploadDialog/SkillFileUploadDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EAGlB,MAAM,iCAAiC,CAAC;AAOzC,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IACzC,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,0FAA0F;IAC1F,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sDAAsD;IACtD,WAAW,EAAE,IAAI,CAAC,sBAAsB,EAAE,eAAe,GAAG,aAAa,CAAC,CAAC;IAC3E;;;OAGG;IACH,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAWD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAoPhE,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { buildCssVars as e, formatFileSize as t, mergeClasses as n } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { DialFileNodeType as r, DialFoldersTree as i } from "@epam/ai-dial-react-file-manager";
|
|
3
|
-
import { Accordion as a, CaptionText as o, DIAL_ICON_SIZE as s,
|
|
4
|
-
import { IconFileText as ne, IconPlus as re, IconTrashX as ie, IconUpload as
|
|
5
|
-
import { Suspense as
|
|
6
|
-
import { Fragment as
|
|
3
|
+
import { Accordion as a, CaptionText as o, DIAL_ICON_SIZE as s, DIAL_KIT_ICON_STROKE as c, EditorThemes as l, ErrorText as u, FileDropzone as ee, GhostButton as d, GhostIconButton as f, Input as p, LazyMarkdownEditor as m, NeutralButton as h, Popup as g, PopupSize as te, PrimaryButton as _, Spinner as v, Textarea as y } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { IconFileText as ne, IconPlus as re, IconTrashX as ie, IconUpload as b } from "@tabler/icons-react";
|
|
5
|
+
import { Suspense as x, lazy as S, useCallback as C, useEffect as w, useId as T, useMemo as E, useRef as D, useState as O } from "react";
|
|
6
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
7
7
|
//#region src/hooks/useSkillFileDropZone.ts
|
|
8
|
-
var
|
|
9
|
-
let [t, n] =
|
|
8
|
+
var M = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
|
|
9
|
+
let [t, n] = O(!1), r = D(0);
|
|
10
10
|
return {
|
|
11
11
|
isDragActive: t,
|
|
12
12
|
dropZoneHandlers: {
|
|
13
|
-
onDragEnter:
|
|
14
|
-
|
|
13
|
+
onDragEnter: C((e) => {
|
|
14
|
+
M(e) && (e.preventDefault(), r.current += 1, n(!0));
|
|
15
15
|
}, []),
|
|
16
|
-
onDragLeave:
|
|
17
|
-
|
|
16
|
+
onDragLeave: C((e) => {
|
|
17
|
+
M(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
|
|
18
18
|
}, []),
|
|
19
|
-
onDragOver:
|
|
20
|
-
|
|
19
|
+
onDragOver: C((e) => {
|
|
20
|
+
M(e) && e.preventDefault();
|
|
21
21
|
}, []),
|
|
22
|
-
onDrop:
|
|
23
|
-
if (!
|
|
22
|
+
onDrop: C((t) => {
|
|
23
|
+
if (!M(t)) return;
|
|
24
24
|
t.preventDefault(), r.current = 0, n(!1);
|
|
25
25
|
let i = Array.from(t.dataTransfer?.files ?? []);
|
|
26
26
|
i.length > 0 && e(i);
|
|
27
27
|
}, [e])
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
},
|
|
30
|
+
}, N = "SKILL.md", P = /* @__PURE__ */ function(e) {
|
|
31
31
|
return e.File = "file", e.Folder = "folder", e;
|
|
32
|
-
}({}),
|
|
32
|
+
}({}), F = (e) => {
|
|
33
33
|
let t = e.lastIndexOf("/");
|
|
34
34
|
return t === -1 ? null : e.slice(0, t);
|
|
35
|
-
},
|
|
35
|
+
}, I = (e) => {
|
|
36
36
|
let t = e.lastIndexOf("/");
|
|
37
37
|
return t === -1 ? e : e.slice(t + 1);
|
|
38
38
|
}, oe = (e) => {
|
|
@@ -41,16 +41,16 @@ var j = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
|
|
|
41
41
|
if (n) return n;
|
|
42
42
|
let i = {
|
|
43
43
|
path: e,
|
|
44
|
-
name:
|
|
44
|
+
name: I(e),
|
|
45
45
|
nodeType: r.FOLDER,
|
|
46
|
-
parentPath:
|
|
46
|
+
parentPath: F(e),
|
|
47
47
|
folderId: e,
|
|
48
48
|
items: []
|
|
49
49
|
};
|
|
50
50
|
return t.set(e, i), i;
|
|
51
51
|
};
|
|
52
52
|
for (let i of e) {
|
|
53
|
-
if (i.kind ===
|
|
53
|
+
if (i.kind === P.Folder) {
|
|
54
54
|
n(i.path);
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
@@ -58,13 +58,13 @@ var j = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
|
|
|
58
58
|
path: i.path,
|
|
59
59
|
name: i.name,
|
|
60
60
|
nodeType: r.ITEM,
|
|
61
|
-
parentPath:
|
|
62
|
-
folderId:
|
|
61
|
+
parentPath: F(i.path),
|
|
62
|
+
folderId: F(i.path) ?? ""
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
for (let t of [...e]) {
|
|
66
|
-
let e =
|
|
67
|
-
for (; e != null;) n(e), e =
|
|
66
|
+
let e = F(t.path);
|
|
67
|
+
for (; e != null;) n(e), e = F(e);
|
|
68
68
|
}
|
|
69
69
|
let i = [];
|
|
70
70
|
for (let e of t.values()) {
|
|
@@ -79,158 +79,161 @@ var j = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
|
|
|
79
79
|
}, se = ({ isVisible: e, labels: t }) => {
|
|
80
80
|
if (!e) return null;
|
|
81
81
|
let r = t ?? {};
|
|
82
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ A("div", {
|
|
83
83
|
role: "status",
|
|
84
84
|
"aria-live": "polite",
|
|
85
85
|
className: n("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
|
|
86
|
-
children: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ j("div", {
|
|
87
87
|
className: "flex flex-col items-center text-center",
|
|
88
88
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ A(b, {
|
|
90
90
|
size: 100,
|
|
91
91
|
className: "text-accent-primary",
|
|
92
|
-
"aria-hidden": !0
|
|
92
|
+
"aria-hidden": !0,
|
|
93
|
+
stroke: c
|
|
93
94
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ A("span", {
|
|
95
96
|
className: "dial-h3-text mt-5",
|
|
96
97
|
children: r.dropOverlayTitle ?? "Upload files"
|
|
97
98
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ A("span", {
|
|
99
100
|
className: "dial-small-text mt-4",
|
|
100
101
|
children: r.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
|
|
101
102
|
})
|
|
102
103
|
]
|
|
103
104
|
})
|
|
104
105
|
});
|
|
105
|
-
},
|
|
106
|
+
}, L = /* @__PURE__ */ function(e) {
|
|
106
107
|
return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
|
|
107
|
-
}({}),
|
|
108
|
+
}({}), R = /* @__PURE__ */ function(e) {
|
|
108
109
|
return e.Valid = "valid", e.Invalid = "invalid", e;
|
|
109
|
-
}({}),
|
|
110
|
-
let o = a ?? {}, [s,
|
|
110
|
+
}({}), z = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), ce = 0, B = () => `skill-file-candidate-${++ce}`, le = ({ isOpen: e, onClose: n, fileActions: r, initialFiles: i, labels: a }) => {
|
|
111
|
+
let o = a ?? {}, [s, l] = O([]), [p, m] = O(/* @__PURE__ */ new Map()), [h, y] = O([]), [re, b] = O(!1), [x, S] = O(), [C, E] = O(!1), D = T(), M = (e) => {
|
|
111
112
|
let t = e.map((e) => ({
|
|
112
|
-
id:
|
|
113
|
+
id: B(),
|
|
113
114
|
file: e,
|
|
114
|
-
path:
|
|
115
|
+
path: z(e)
|
|
115
116
|
}));
|
|
116
|
-
|
|
117
|
+
S(void 0), l((e) => [...e, ...t]);
|
|
117
118
|
}, ae = (e) => {
|
|
118
|
-
|
|
119
|
+
l((t) => t.filter((t) => t.id !== e));
|
|
119
120
|
};
|
|
120
|
-
|
|
121
|
-
e && (
|
|
122
|
-
id:
|
|
121
|
+
w(() => {
|
|
122
|
+
e && (l((i ?? []).map((e) => ({
|
|
123
|
+
id: B(),
|
|
123
124
|
file: e,
|
|
124
|
-
path:
|
|
125
|
-
}))),
|
|
126
|
-
}, [e]),
|
|
125
|
+
path: z(e)
|
|
126
|
+
}))), m(/* @__PURE__ */ new Map()), y([]), S(void 0));
|
|
127
|
+
}, [e]), w(() => {
|
|
127
128
|
if (!e) return;
|
|
128
129
|
let t = !1;
|
|
129
130
|
if (s.length === 0) {
|
|
130
|
-
|
|
131
|
+
m(/* @__PURE__ */ new Map()), y([]);
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
133
|
-
return
|
|
134
|
-
t || (
|
|
134
|
+
return b(!0), r.validateBatch(s).then(({ results: e, batchErrors: n }) => {
|
|
135
|
+
t || (m(new Map(e.map((e) => [e.candidateId, e]))), y(n.map((e) => e.message)));
|
|
135
136
|
}).finally(() => {
|
|
136
|
-
t ||
|
|
137
|
+
t || b(!1);
|
|
137
138
|
}), () => {
|
|
138
139
|
t = !0;
|
|
139
140
|
};
|
|
140
141
|
}, [s, e]);
|
|
141
|
-
let
|
|
142
|
-
|
|
142
|
+
let N = s.some((e) => p.get(e.id)?.status === R.Invalid), P = s.length > 0 && s.every((e) => p.get(e.id)?.status === R.Invalid), F = s.length > 0 && !N && h.length === 0 && !re && !C, I = async () => {
|
|
143
|
+
E(!0), S(void 0);
|
|
143
144
|
try {
|
|
144
145
|
let { results: e, batchErrors: t } = await r.validateBatch(s), i = new Map(e.map((e) => [e.candidateId, e]));
|
|
145
|
-
if (
|
|
146
|
+
if (m(i), y(t.map((e) => e.message)), s.some((e) => i.get(e.id)?.status === R.Invalid) || t.length > 0) return;
|
|
146
147
|
let a = await r.commitBatch(s);
|
|
147
148
|
if (a.error) {
|
|
148
|
-
|
|
149
|
+
S(a.error);
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
152
|
n();
|
|
152
153
|
} finally {
|
|
153
|
-
|
|
154
|
+
E(!1);
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ A(g, {
|
|
157
158
|
open: e,
|
|
158
159
|
header: o.uploadDialogTitle ?? "Upload files from device",
|
|
159
160
|
size: te.Sm,
|
|
160
161
|
closeAriaLabel: o.uploadDialogCloseAriaLabel ?? "Close",
|
|
161
162
|
onClose: n,
|
|
162
|
-
footer: /* @__PURE__ */
|
|
163
|
+
footer: /* @__PURE__ */ j("div", {
|
|
163
164
|
className: "flex min-h-[44px] items-center justify-end gap-2 px-6 py-4",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
165
|
+
children: [/* @__PURE__ */ A(d, {
|
|
165
166
|
label: o.uploadCancelLabel ?? "Cancel",
|
|
166
167
|
onClick: n
|
|
167
|
-
}), /* @__PURE__ */
|
|
168
|
+
}), /* @__PURE__ */ A(_, {
|
|
168
169
|
label: o.uploadConfirmLabel ?? "Add",
|
|
169
|
-
iconBefore:
|
|
170
|
+
iconBefore: C ? /* @__PURE__ */ A(v, {
|
|
170
171
|
size: 16,
|
|
171
172
|
ariaLabel: ""
|
|
172
173
|
}) : void 0,
|
|
173
|
-
onClick: () => void
|
|
174
|
-
disabled: !
|
|
174
|
+
onClick: () => void I(),
|
|
175
|
+
disabled: !F
|
|
175
176
|
})]
|
|
176
177
|
}),
|
|
177
|
-
children: /* @__PURE__ */
|
|
178
|
+
children: /* @__PURE__ */ j("div", {
|
|
178
179
|
className: "flex flex-col gap-4 px-6 py-4",
|
|
179
180
|
children: [
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
label: /* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ A(ee, {
|
|
182
|
+
label: /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A("span", {
|
|
182
183
|
className: "desktop:hidden",
|
|
183
184
|
children: o.uploadDropZoneMobileLabel ?? "Click here to upload"
|
|
184
|
-
}), /* @__PURE__ */
|
|
185
|
+
}), /* @__PURE__ */ A("span", {
|
|
185
186
|
className: "hidden desktop:inline",
|
|
186
187
|
children: o.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
|
|
187
188
|
})] }),
|
|
188
189
|
ariaLabel: o.uploadDropZoneAriaLabel ?? "Upload files",
|
|
189
190
|
multiple: !0,
|
|
190
|
-
className:
|
|
191
|
-
onChange:
|
|
191
|
+
className: P ? "border-error hover:border-error" : void 0,
|
|
192
|
+
onChange: M
|
|
192
193
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ A("span", {
|
|
194
195
|
role: "status",
|
|
195
196
|
"aria-live": "polite",
|
|
196
197
|
className: "sr-only",
|
|
197
|
-
id:
|
|
198
|
-
children:
|
|
198
|
+
id: D,
|
|
199
|
+
children: h.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
|
|
199
200
|
}),
|
|
200
|
-
|
|
201
|
-
s.length > 0 && /* @__PURE__ */
|
|
201
|
+
h.map((e) => /* @__PURE__ */ A(u, { text: e }, e)),
|
|
202
|
+
s.length > 0 && /* @__PURE__ */ A("ul", {
|
|
202
203
|
className: "flex flex-col gap-2",
|
|
203
204
|
children: s.map((e) => {
|
|
204
|
-
let n =
|
|
205
|
-
return /* @__PURE__ */
|
|
205
|
+
let n = p.get(e.id), r = n?.kind === L.Manifest, i = n?.status === R.Invalid;
|
|
206
|
+
return /* @__PURE__ */ j("li", {
|
|
206
207
|
className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
|
|
207
208
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ A(ne, {
|
|
209
210
|
size: 20,
|
|
210
|
-
"aria-hidden": !0
|
|
211
|
+
"aria-hidden": !0,
|
|
212
|
+
stroke: c
|
|
211
213
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ j("div", {
|
|
213
215
|
className: "flex min-w-0 flex-1 flex-col",
|
|
214
216
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ A("span", {
|
|
216
218
|
className: "dial-small-text truncate",
|
|
217
219
|
children: e.path
|
|
218
220
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ A("span", {
|
|
220
222
|
className: "dial-tiny-text text-secondary",
|
|
221
223
|
children: t(e.file.size)
|
|
222
224
|
}),
|
|
223
|
-
i && n?.error && /* @__PURE__ */
|
|
224
|
-
r && !i && /* @__PURE__ */
|
|
225
|
+
i && n?.error && /* @__PURE__ */ A(u, { text: n.error }),
|
|
226
|
+
r && !i && /* @__PURE__ */ A("span", {
|
|
225
227
|
className: "dial-tiny-text text-secondary",
|
|
226
228
|
children: o.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
|
|
227
229
|
})
|
|
228
230
|
]
|
|
229
231
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
icon: /* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ A(f, {
|
|
233
|
+
icon: /* @__PURE__ */ A(ie, {
|
|
232
234
|
size: 16,
|
|
233
|
-
"aria-hidden": !0
|
|
235
|
+
"aria-hidden": !0,
|
|
236
|
+
stroke: c
|
|
234
237
|
}),
|
|
235
238
|
"aria-label": o.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
|
|
236
239
|
onClick: () => ae(e.id)
|
|
@@ -239,280 +242,282 @@ var j = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
|
|
|
239
242
|
}, e.id);
|
|
240
243
|
})
|
|
241
244
|
}),
|
|
242
|
-
|
|
245
|
+
x && /* @__PURE__ */ A(u, { text: x })
|
|
243
246
|
]
|
|
244
247
|
})
|
|
245
248
|
});
|
|
246
|
-
},
|
|
249
|
+
}, V = {
|
|
247
250
|
title: "_title_l82ak_1",
|
|
248
251
|
helperText: "_helperText_l82ak_5",
|
|
249
252
|
headerBorder: "_headerBorder_l82ak_9",
|
|
250
253
|
sidebarBorder: "_sidebarBorder_l82ak_13",
|
|
251
254
|
actionBarBorder: "_actionBarBorder_l82ak_17"
|
|
252
|
-
}, ue =
|
|
253
|
-
let { MarkdownEditor: e } = await
|
|
255
|
+
}, ue = S(async () => {
|
|
256
|
+
let { MarkdownEditor: e } = await m();
|
|
254
257
|
return { default: e };
|
|
255
|
-
}), de = ({ initialValues: t, files: r, selectedPath: ee, onSelectedPathChange:
|
|
256
|
-
let [
|
|
258
|
+
}), de = ({ initialValues: t, files: r, selectedPath: ee, onSelectedPathChange: f, expandedPaths: m, onExpandedPathsChange: g, isLoading: te = !1, hasLoadError: ne = !1, isSubmitting: b = !1, errors: S, submitError: M, conflict: F, onReloadLatest: I, isNameReadOnly: L = !1, onDirtyChange: R, fileActions: z, headerContent: ce, supportingFileContent: B, onSubmit: de, onCancel: fe, onRetry: pe, labels: H, styles: me, dir: he, instructionsEditorTheme: ge = l.light }) => {
|
|
259
|
+
let [U, W] = O({
|
|
257
260
|
name: t?.name ?? "",
|
|
258
261
|
description: t?.description ?? "",
|
|
259
262
|
instructions: t?.instructions ?? ""
|
|
260
|
-
}), _e =
|
|
261
|
-
|
|
262
|
-
_e.current = t,
|
|
263
|
+
}), _e = D(t), ve = _e.current !== t, ye = D(r);
|
|
264
|
+
w(() => {
|
|
265
|
+
_e.current = t, W({
|
|
263
266
|
name: t?.name ?? "",
|
|
264
267
|
description: t?.description ?? "",
|
|
265
268
|
instructions: t?.instructions ?? ""
|
|
266
269
|
}), ye.current = r;
|
|
267
270
|
}, [t]);
|
|
268
|
-
let be = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), xe =
|
|
269
|
-
|
|
271
|
+
let be = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), xe = D(!1);
|
|
272
|
+
w(() => {
|
|
270
273
|
if (ve) return;
|
|
271
274
|
let e = {
|
|
272
275
|
name: t?.name ?? "",
|
|
273
276
|
description: t?.description ?? "",
|
|
274
277
|
instructions: t?.instructions ?? ""
|
|
275
|
-
}, n = JSON.stringify(
|
|
276
|
-
n !== xe.current && (xe.current = n,
|
|
278
|
+
}, n = JSON.stringify(U) !== JSON.stringify(e) || be(r) !== be(ye.current);
|
|
279
|
+
n !== xe.current && (xe.current = n, R?.(n));
|
|
277
280
|
}, [
|
|
278
|
-
|
|
281
|
+
U,
|
|
279
282
|
r,
|
|
280
283
|
t,
|
|
281
284
|
ve,
|
|
282
|
-
|
|
285
|
+
R
|
|
283
286
|
]);
|
|
284
|
-
let [Se, Ce] =
|
|
285
|
-
Ce(e),
|
|
286
|
-
}, [
|
|
287
|
+
let [Se, Ce] = O(N), G = ee ?? Se, K = C((e) => {
|
|
288
|
+
Ce(e), f?.(e);
|
|
289
|
+
}, [f]), [we, Te] = O([]), Ee = m ?? we, De = E(() => new Set(Ee), [Ee]), Oe = C((e) => {
|
|
287
290
|
let t = [...e];
|
|
288
|
-
Te(t),
|
|
289
|
-
}, [
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
"--se-title-color":
|
|
293
|
-
"--se-helper-text-color":
|
|
294
|
-
"--se-border-color":
|
|
295
|
-
}),
|
|
296
|
-
path:
|
|
297
|
-
name:
|
|
298
|
-
kind:
|
|
299
|
-
}, ...r]), [r]), $ =
|
|
300
|
-
|
|
301
|
-
}, [
|
|
302
|
-
|
|
291
|
+
Te(t), g?.(t);
|
|
292
|
+
}, [g]), [q, J] = O(!1), [ke, Y] = O(), [Ae, je] = O(!0), { isDragActive: Me, dropZoneHandlers: Ne } = ae(C((e) => {
|
|
293
|
+
q || (Y(e), J(!0));
|
|
294
|
+
}, [q])), X = H ?? {}, Z = me?.colors, Q = me?.typography ?? {}, Pe = Q.titleClassName ?? "dial-body-semi-text", Fe = Q.helperTextClassName ?? "dial-tiny-semi-text", Ie = Q.removeIconClassName ?? "text-secondary", Le = e({
|
|
295
|
+
"--se-title-color": Z?.title,
|
|
296
|
+
"--se-helper-text-color": Z?.helperText,
|
|
297
|
+
"--se-border-color": Z?.border
|
|
298
|
+
}), Re = E(() => oe([{
|
|
299
|
+
path: N,
|
|
300
|
+
name: N,
|
|
301
|
+
kind: P.File
|
|
302
|
+
}, ...r]), [r]), $ = E(() => r.find((e) => e.path === G), [r, G]), ze = C((e) => {
|
|
303
|
+
K(e.path);
|
|
304
|
+
}, [K]), Be = C((e) => {
|
|
305
|
+
z.onRemoveNode(e), G === e && K(N);
|
|
303
306
|
}, [
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
]),
|
|
307
|
+
z,
|
|
308
|
+
G,
|
|
309
|
+
K
|
|
310
|
+
]), Ve = C((e) => e.path === "SKILL.md" ? [] : [{
|
|
308
311
|
key: "remove",
|
|
309
|
-
label:
|
|
310
|
-
icon: /* @__PURE__ */
|
|
312
|
+
label: X.removeLabel ?? "Remove",
|
|
313
|
+
icon: /* @__PURE__ */ A(ie, {
|
|
311
314
|
size: s.SM,
|
|
312
|
-
className:
|
|
313
|
-
"aria-hidden": !0
|
|
315
|
+
className: Ie,
|
|
316
|
+
"aria-hidden": !0,
|
|
317
|
+
stroke: c
|
|
314
318
|
}),
|
|
315
|
-
onClick: () =>
|
|
319
|
+
onClick: () => Be(e.path)
|
|
316
320
|
}], [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
]),
|
|
321
|
+
X.removeLabel,
|
|
322
|
+
Ie,
|
|
323
|
+
Be
|
|
324
|
+
]), He = T(), Ue = T(), We = /* @__PURE__ */ j("div", {
|
|
321
325
|
className: "flex flex-col gap-2 desktop:gap-5",
|
|
322
|
-
children: [/* @__PURE__ */
|
|
326
|
+
children: [/* @__PURE__ */ j("div", {
|
|
323
327
|
className: "flex items-center justify-between",
|
|
324
|
-
children: [/* @__PURE__ */
|
|
325
|
-
className: n(
|
|
326
|
-
children:
|
|
327
|
-
}), /* @__PURE__ */
|
|
328
|
-
label:
|
|
329
|
-
iconBefore: /* @__PURE__ */
|
|
328
|
+
children: [/* @__PURE__ */ A("span", {
|
|
329
|
+
className: n(V.title, Pe),
|
|
330
|
+
children: X.filesHeading ?? "Files"
|
|
331
|
+
}), /* @__PURE__ */ A(h, {
|
|
332
|
+
label: X.addUploadLabel ?? "Upload from device",
|
|
333
|
+
iconBefore: /* @__PURE__ */ A(re, {
|
|
330
334
|
size: 16,
|
|
331
|
-
"aria-hidden": !0
|
|
335
|
+
"aria-hidden": !0,
|
|
336
|
+
stroke: c
|
|
332
337
|
}),
|
|
333
338
|
onClick: () => {
|
|
334
|
-
|
|
339
|
+
Y(void 0), J(!0);
|
|
335
340
|
}
|
|
336
341
|
})]
|
|
337
|
-
}), /* @__PURE__ */
|
|
338
|
-
id:
|
|
342
|
+
}), /* @__PURE__ */ A("div", {
|
|
343
|
+
id: He,
|
|
339
344
|
role: "tree",
|
|
340
|
-
"aria-label":
|
|
341
|
-
children: /* @__PURE__ */
|
|
342
|
-
items:
|
|
345
|
+
"aria-label": X.filesTreeAriaLabel ?? "Skill files",
|
|
346
|
+
children: /* @__PURE__ */ A(i, {
|
|
347
|
+
items: Re,
|
|
343
348
|
showFiles: !0,
|
|
344
|
-
selectedPath:
|
|
349
|
+
selectedPath: G,
|
|
345
350
|
expandedPaths: De,
|
|
346
351
|
onExpandedPathsChange: Oe,
|
|
347
|
-
onItemClick:
|
|
348
|
-
getContextMenuItems:
|
|
352
|
+
onItemClick: ze,
|
|
353
|
+
getContextMenuItems: Ve,
|
|
349
354
|
rootItemPath: ""
|
|
350
355
|
})
|
|
351
356
|
})]
|
|
352
|
-
}),
|
|
353
|
-
label:
|
|
357
|
+
}), Ge = b ? X.savingStatusLabel ?? "Saving" : "", Ke = /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(d, {
|
|
358
|
+
label: X.cancelLabel ?? "Cancel",
|
|
354
359
|
onClick: fe,
|
|
355
|
-
disabled:
|
|
356
|
-
}), /* @__PURE__ */
|
|
357
|
-
label:
|
|
358
|
-
iconBefore:
|
|
360
|
+
disabled: b
|
|
361
|
+
}), /* @__PURE__ */ A(_, {
|
|
362
|
+
label: X.createLabel ?? "Create",
|
|
363
|
+
iconBefore: b ? /* @__PURE__ */ A(v, {
|
|
359
364
|
size: 16,
|
|
360
365
|
ariaLabel: ""
|
|
361
366
|
}) : void 0,
|
|
362
|
-
onClick: () => de(
|
|
363
|
-
disabled:
|
|
367
|
+
onClick: () => de(U),
|
|
368
|
+
disabled: b
|
|
364
369
|
})] });
|
|
365
|
-
return te ? /* @__PURE__ */
|
|
370
|
+
return te ? /* @__PURE__ */ A("div", {
|
|
366
371
|
className: "flex h-full items-center justify-center",
|
|
367
|
-
children: /* @__PURE__ */
|
|
368
|
-
}) : ne ? /* @__PURE__ */
|
|
372
|
+
children: /* @__PURE__ */ A(v, { ariaLabel: X.loadingAriaLabel ?? "Loading skill" })
|
|
373
|
+
}) : ne ? /* @__PURE__ */ j("div", {
|
|
369
374
|
role: "alert",
|
|
370
375
|
className: "flex flex-col items-center gap-4 p-8",
|
|
371
|
-
children: [/* @__PURE__ */
|
|
372
|
-
label:
|
|
376
|
+
children: [/* @__PURE__ */ A(u, { text: X.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ A(_, {
|
|
377
|
+
label: X.retryLabel ?? "Retry",
|
|
373
378
|
onClick: pe
|
|
374
379
|
})]
|
|
375
|
-
}) : /* @__PURE__ */
|
|
380
|
+
}) : /* @__PURE__ */ j("div", {
|
|
376
381
|
dir: he,
|
|
377
382
|
className: "relative flex h-full flex-col",
|
|
378
|
-
style:
|
|
383
|
+
style: Le,
|
|
379
384
|
...Ne,
|
|
380
385
|
children: [
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
isVisible: Me && !
|
|
383
|
-
labels:
|
|
386
|
+
/* @__PURE__ */ A(se, {
|
|
387
|
+
isVisible: Me && !q,
|
|
388
|
+
labels: H
|
|
384
389
|
}),
|
|
385
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ A("span", {
|
|
386
391
|
role: "status",
|
|
387
392
|
"aria-live": "polite",
|
|
388
393
|
className: "sr-only",
|
|
389
|
-
id:
|
|
390
|
-
children:
|
|
394
|
+
id: Ue,
|
|
395
|
+
children: Ge
|
|
391
396
|
}),
|
|
392
|
-
|
|
397
|
+
M && /* @__PURE__ */ A("div", {
|
|
393
398
|
role: "alert",
|
|
394
399
|
className: "px-4 pt-2",
|
|
395
|
-
children: /* @__PURE__ */
|
|
400
|
+
children: /* @__PURE__ */ A(u, { text: M })
|
|
396
401
|
}),
|
|
397
|
-
|
|
402
|
+
F && /* @__PURE__ */ j("div", {
|
|
398
403
|
role: "alert",
|
|
399
404
|
className: "flex items-center gap-2 px-4 pt-2",
|
|
400
|
-
children: [/* @__PURE__ */
|
|
401
|
-
label:
|
|
402
|
-
onClick:
|
|
405
|
+
children: [/* @__PURE__ */ A(u, { text: F.message }), /* @__PURE__ */ A(d, {
|
|
406
|
+
label: X.reloadLatestLabel ?? "Reload latest",
|
|
407
|
+
onClick: I
|
|
403
408
|
})]
|
|
404
409
|
}),
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
className: n("hidden items-center justify-between gap-2 border-b px-4 py-2 desktop:flex desktop:px-8 desktop:pb-3 desktop:pt-3",
|
|
407
|
-
children: [/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ j("div", {
|
|
411
|
+
className: n("hidden items-center justify-between gap-2 border-b px-4 py-2 desktop:flex desktop:px-8 desktop:pb-3 desktop:pt-3", V.headerBorder),
|
|
412
|
+
children: [/* @__PURE__ */ A("div", {
|
|
408
413
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
409
414
|
children: ce
|
|
410
|
-
}), /* @__PURE__ */
|
|
415
|
+
}), /* @__PURE__ */ A("div", {
|
|
411
416
|
className: "flex shrink-0 items-center gap-2",
|
|
412
|
-
children:
|
|
417
|
+
children: Ke
|
|
413
418
|
})]
|
|
414
419
|
}),
|
|
415
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ j("div", {
|
|
416
421
|
className: "flex flex-1 flex-col gap-4 overflow-y-auto px-4 pb-20 desktop:flex-row desktop:gap-0 desktop:px-0 desktop:pb-0",
|
|
417
422
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ A("div", {
|
|
419
424
|
className: "desktop:hidden",
|
|
420
|
-
children: /* @__PURE__ */
|
|
421
|
-
title:
|
|
425
|
+
children: /* @__PURE__ */ A(a, {
|
|
426
|
+
title: X.editingFileLabel ?? "Editing file",
|
|
422
427
|
description: $?.name ?? "SKILL.md",
|
|
423
428
|
expanded: Ae,
|
|
424
429
|
onToggle: je,
|
|
425
|
-
ariaLabel:
|
|
426
|
-
children:
|
|
430
|
+
ariaLabel: X.editingFileLabel ?? "Editing file",
|
|
431
|
+
children: We
|
|
427
432
|
})
|
|
428
433
|
}),
|
|
429
|
-
/* @__PURE__ */ k("div", {
|
|
430
|
-
className: n("hidden border-e desktop:block desktop:w-[360px] desktop:shrink-0 desktop:px-8 desktop:py-6", B.sidebarBorder),
|
|
431
|
-
children: Ue
|
|
432
|
-
}),
|
|
433
434
|
/* @__PURE__ */ A("div", {
|
|
435
|
+
className: n("hidden border-e desktop:block desktop:w-[360px] desktop:shrink-0 desktop:px-8 desktop:py-6", V.sidebarBorder),
|
|
436
|
+
children: We
|
|
437
|
+
}),
|
|
438
|
+
/* @__PURE__ */ j("div", {
|
|
434
439
|
className: "flex min-w-0 flex-1 flex-col gap-4 desktop:gap-5 desktop:px-8 desktop:py-6",
|
|
435
|
-
children: [/* @__PURE__ */
|
|
436
|
-
className: n(
|
|
437
|
-
children:
|
|
438
|
-
}),
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
+
children: [/* @__PURE__ */ A("h2", {
|
|
441
|
+
className: n(V.title, Pe),
|
|
442
|
+
children: G === "SKILL.md" ? N : X.selectedFileHeading?.($?.name ?? G) ?? $?.name ?? G
|
|
443
|
+
}), G === "SKILL.md" ? /* @__PURE__ */ j(k, { children: [
|
|
444
|
+
/* @__PURE__ */ A(p, {
|
|
440
445
|
labelProps: {
|
|
441
|
-
label:
|
|
446
|
+
label: X.nameLabel ?? "Name",
|
|
442
447
|
required: !0
|
|
443
448
|
},
|
|
444
|
-
value:
|
|
445
|
-
onChange: (e) =>
|
|
449
|
+
value: U.name,
|
|
450
|
+
onChange: (e) => W((t) => ({
|
|
446
451
|
...t,
|
|
447
452
|
name: e ?? ""
|
|
448
453
|
})),
|
|
449
|
-
placeholder:
|
|
450
|
-
caption:
|
|
451
|
-
error:
|
|
452
|
-
invalid: !!
|
|
453
|
-
disabled:
|
|
454
|
+
placeholder: X.namePlaceholder ?? "good-morning-breakfast",
|
|
455
|
+
caption: S?.name ? void 0 : X.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
|
|
456
|
+
error: S?.name,
|
|
457
|
+
invalid: !!S?.name,
|
|
458
|
+
disabled: L
|
|
454
459
|
}),
|
|
455
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ A(y, {
|
|
456
461
|
labelProps: {
|
|
457
|
-
label:
|
|
462
|
+
label: X.descriptionLabel ?? "Description",
|
|
458
463
|
required: !0
|
|
459
464
|
},
|
|
460
|
-
value:
|
|
461
|
-
placeholder:
|
|
462
|
-
onChange: (e) =>
|
|
465
|
+
value: U.description,
|
|
466
|
+
placeholder: X.descriptionPlaceholder ?? "What this skill does and when to use it",
|
|
467
|
+
onChange: (e) => W((t) => ({
|
|
463
468
|
...t,
|
|
464
469
|
description: e
|
|
465
470
|
})),
|
|
466
|
-
error:
|
|
467
|
-
invalid: !!
|
|
471
|
+
error: S?.description,
|
|
472
|
+
invalid: !!S?.description
|
|
468
473
|
}),
|
|
469
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ j("div", {
|
|
470
475
|
className: "flex flex-1 flex-col gap-2",
|
|
471
476
|
children: [
|
|
472
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ j("span", {
|
|
473
478
|
className: "flex items-center gap-0.5",
|
|
474
|
-
children: [/* @__PURE__ */
|
|
475
|
-
className: n(
|
|
476
|
-
children:
|
|
477
|
-
}), /* @__PURE__ */
|
|
479
|
+
children: [/* @__PURE__ */ A("span", {
|
|
480
|
+
className: n(V.helperText, Fe),
|
|
481
|
+
children: X.instructionsLabel ?? "Instructions"
|
|
482
|
+
}), /* @__PURE__ */ A("span", {
|
|
478
483
|
className: "dial-tiny-text text-error",
|
|
479
484
|
children: "*"
|
|
480
485
|
})]
|
|
481
486
|
}),
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
fallback: /* @__PURE__ */
|
|
484
|
-
children: /* @__PURE__ */
|
|
485
|
-
value:
|
|
486
|
-
onChange: (e) =>
|
|
487
|
+
/* @__PURE__ */ A(x, {
|
|
488
|
+
fallback: /* @__PURE__ */ A(v, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
|
|
489
|
+
children: /* @__PURE__ */ A(ue, {
|
|
490
|
+
value: U.instructions,
|
|
491
|
+
onChange: (e) => W((t) => ({
|
|
487
492
|
...t,
|
|
488
493
|
instructions: e
|
|
489
494
|
})),
|
|
490
495
|
theme: ge,
|
|
491
|
-
placeholder:
|
|
496
|
+
placeholder: X.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
|
|
492
497
|
})
|
|
493
498
|
}),
|
|
494
|
-
|
|
499
|
+
S?.instructions && /* @__PURE__ */ A(u, { text: S.instructions })
|
|
495
500
|
]
|
|
496
501
|
})
|
|
497
|
-
] }) : $?.kind ===
|
|
502
|
+
] }) : $?.kind === P.File && (B ?? /* @__PURE__ */ A(o, { text: X.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." }))]
|
|
498
503
|
})
|
|
499
504
|
]
|
|
500
505
|
}),
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
className: n("fixed inset-x-0 bottom-0 flex items-center gap-2 border-t p-3 desktop:hidden",
|
|
503
|
-
children:
|
|
506
|
+
/* @__PURE__ */ A("div", {
|
|
507
|
+
className: n("fixed inset-x-0 bottom-0 flex items-center gap-2 border-t p-3 desktop:hidden", V.actionBarBorder),
|
|
508
|
+
children: Ke
|
|
504
509
|
}),
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
isOpen:
|
|
510
|
+
/* @__PURE__ */ A(le, {
|
|
511
|
+
isOpen: q,
|
|
507
512
|
onClose: () => {
|
|
508
|
-
|
|
513
|
+
J(!1), Y(void 0);
|
|
509
514
|
},
|
|
510
|
-
fileActions:
|
|
515
|
+
fileActions: z,
|
|
511
516
|
initialFiles: ke,
|
|
512
|
-
labels:
|
|
517
|
+
labels: H
|
|
513
518
|
})
|
|
514
519
|
]
|
|
515
520
|
});
|
|
516
521
|
};
|
|
517
522
|
//#endregion
|
|
518
|
-
export { de as SkillEditor,
|
|
523
|
+
export { de as SkillEditor, L as SkillFileCandidateKind, P as SkillFileNodeKind, R as SkillFileValidationStatus };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-skill-editor",
|
|
3
3
|
"description": "Host-agnostic form for authoring a DIAL Skill, with an inline supporting-file tree",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.300",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
19
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.300",
|
|
20
20
|
"@epam/ai-dial-ui-kit": "*",
|
|
21
|
-
"@epam/ai-dial-react-file-manager": "^0.2.0-dev.
|
|
21
|
+
"@epam/ai-dial-react-file-manager": "^0.2.0-dev.9",
|
|
22
22
|
"@tabler/icons-react": "^3.0.0",
|
|
23
23
|
"react": "^19.0.0"
|
|
24
24
|
},
|