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