agentic-ui-libs 1.0.0-beta.11 → 1.0.0-beta.13
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":"SlashMenu.d.ts","sourceRoot":"","sources":["../../../../src/features/md-editor/components/SlashMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoF,MAAM,OAAO,CAAC;AACzG,OAAO,KAAK,EAKV,cAAc,EACf,MAAM,UAAU,CAAC;AAwJlB,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC;CAC9C;AAED,UAAU,sBAAuB,SAAQ,cAAc;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"SlashMenu.d.ts","sourceRoot":"","sources":["../../../../src/features/md-editor/components/SlashMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoF,MAAM,OAAO,CAAC;AACzG,OAAO,KAAK,EAKV,cAAc,EACf,MAAM,UAAU,CAAC;AAwJlB,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC;CAC9C;AAED,UAAU,sBAAuB,SAAQ,cAAc;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,eAAO,MAAM,SAAS,6FAypBrB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -69158,6 +69158,7 @@ const SlashMenu = forwardRef(
|
|
|
69158
69158
|
const [activeCategory, setActiveCategory] = useState(null);
|
|
69159
69159
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
69160
69160
|
const [subcategorySearch, setSubcategorySearch] = useState("");
|
|
69161
|
+
const [nestedPath, setNestedPath] = useState([]);
|
|
69161
69162
|
const menuRef = useRef(null);
|
|
69162
69163
|
const blockItemsRef = useRef(null);
|
|
69163
69164
|
const categoryListRef = useRef(null);
|
|
@@ -69261,6 +69262,12 @@ const SlashMenu = forwardRef(
|
|
|
69261
69262
|
items = contentVariables;
|
|
69262
69263
|
break;
|
|
69263
69264
|
}
|
|
69265
|
+
if (nestedPath.length > 0) {
|
|
69266
|
+
const lastInPath = nestedPath[nestedPath.length - 1];
|
|
69267
|
+
if (lastInPath.children && lastInPath.children.length > 0) {
|
|
69268
|
+
items = lastInPath.children;
|
|
69269
|
+
}
|
|
69270
|
+
}
|
|
69264
69271
|
const searchTerm = subcategorySearch.toLowerCase();
|
|
69265
69272
|
if (searchTerm) {
|
|
69266
69273
|
items = items.filter((item) => {
|
|
@@ -69277,7 +69284,7 @@ const SlashMenu = forwardRef(
|
|
|
69277
69284
|
});
|
|
69278
69285
|
}
|
|
69279
69286
|
return items;
|
|
69280
|
-
}, [activeCategory, subcategorySearch, agents2, tools2, knowledge2, envVariables2, memoryVariables, systemVariables2, contentVariables, allCategories]);
|
|
69287
|
+
}, [activeCategory, subcategorySearch, nestedPath, agents2, tools2, knowledge2, envVariables2, memoryVariables, systemVariables2, contentVariables, allCategories]);
|
|
69281
69288
|
const currentItems = getCurrentItems();
|
|
69282
69289
|
const getAllNavigableItems = useCallback(() => {
|
|
69283
69290
|
if (activeCategory) {
|
|
@@ -69299,7 +69306,7 @@ const SlashMenu = forwardRef(
|
|
|
69299
69306
|
const navigableItems = getAllNavigableItems();
|
|
69300
69307
|
useEffect(() => {
|
|
69301
69308
|
setSelectedIndex(0);
|
|
69302
|
-
}, [navigableItems.length, activeCategory, query, subcategorySearch]);
|
|
69309
|
+
}, [navigableItems.length, activeCategory, query, subcategorySearch, nestedPath.length]);
|
|
69303
69310
|
useEffect(() => {
|
|
69304
69311
|
const itemElement = itemRefs.current.get(selectedIndex);
|
|
69305
69312
|
if (itemElement) {
|
|
@@ -69352,6 +69359,11 @@ const SlashMenu = forwardRef(
|
|
|
69352
69359
|
return true;
|
|
69353
69360
|
}
|
|
69354
69361
|
if (event.key === "Escape") {
|
|
69362
|
+
if (nestedPath.length > 0) {
|
|
69363
|
+
setNestedPath((prev) => prev.slice(0, -1));
|
|
69364
|
+
setSubcategorySearch("");
|
|
69365
|
+
return true;
|
|
69366
|
+
}
|
|
69355
69367
|
if (activeCategory) {
|
|
69356
69368
|
setActiveCategory(null);
|
|
69357
69369
|
setSubcategorySearch("");
|
|
@@ -69359,14 +69371,19 @@ const SlashMenu = forwardRef(
|
|
|
69359
69371
|
}
|
|
69360
69372
|
return false;
|
|
69361
69373
|
}
|
|
69362
|
-
if (event.key === "Backspace" && !query && !subcategorySearch
|
|
69363
|
-
|
|
69364
|
-
|
|
69365
|
-
|
|
69374
|
+
if (event.key === "Backspace" && !query && !subcategorySearch) {
|
|
69375
|
+
if (nestedPath.length > 0) {
|
|
69376
|
+
setNestedPath((prev) => prev.slice(0, -1));
|
|
69377
|
+
return true;
|
|
69378
|
+
}
|
|
69379
|
+
if (activeCategory) {
|
|
69380
|
+
setActiveCategory(null);
|
|
69381
|
+
return true;
|
|
69382
|
+
}
|
|
69366
69383
|
}
|
|
69367
69384
|
return false;
|
|
69368
69385
|
},
|
|
69369
|
-
[navigableItems, selectedIndex, activeCategory, query, findNextEnabledIndex]
|
|
69386
|
+
[navigableItems, selectedIndex, activeCategory, query, nestedPath, findNextEnabledIndex]
|
|
69370
69387
|
);
|
|
69371
69388
|
useImperativeHandle(ref, () => ({
|
|
69372
69389
|
onKeyDown
|
|
@@ -69384,6 +69401,7 @@ const SlashMenu = forwardRef(
|
|
|
69384
69401
|
setActiveCategory(item.id);
|
|
69385
69402
|
setSelectedIndex(0);
|
|
69386
69403
|
setSubcategorySearch("");
|
|
69404
|
+
setNestedPath([]);
|
|
69387
69405
|
return;
|
|
69388
69406
|
}
|
|
69389
69407
|
if ("action" in item && typeof item.action === "function") {
|
|
@@ -69410,12 +69428,24 @@ const SlashMenu = forwardRef(
|
|
|
69410
69428
|
}
|
|
69411
69429
|
if ("path" in item && "type" in item) {
|
|
69412
69430
|
const variable = item;
|
|
69431
|
+
if (variable.children && variable.children.length > 0) {
|
|
69432
|
+
setNestedPath((prev) => [...prev, variable]);
|
|
69433
|
+
setSelectedIndex(0);
|
|
69434
|
+
setSubcategorySearch("");
|
|
69435
|
+
return;
|
|
69436
|
+
}
|
|
69413
69437
|
deleteSlashTrigger();
|
|
69438
|
+
let fullPath = variable.path;
|
|
69439
|
+
if (nestedPath.length > 0) {
|
|
69440
|
+
const pathParts = nestedPath.map((v) => v.name);
|
|
69441
|
+
pathParts.push(variable.name);
|
|
69442
|
+
fullPath = pathParts.join(".");
|
|
69443
|
+
}
|
|
69414
69444
|
editor.chain().focus().insertContent({
|
|
69415
69445
|
type: "variableChip",
|
|
69416
69446
|
attrs: {
|
|
69417
69447
|
variableType: variable.type,
|
|
69418
|
-
path:
|
|
69448
|
+
path: fullPath,
|
|
69419
69449
|
displayName: variable.name
|
|
69420
69450
|
}
|
|
69421
69451
|
}).insertContent(" ").run();
|
|
@@ -69424,6 +69454,12 @@ const SlashMenu = forwardRef(
|
|
|
69424
69454
|
command2(item);
|
|
69425
69455
|
};
|
|
69426
69456
|
const handleBack = () => {
|
|
69457
|
+
if (nestedPath.length > 0) {
|
|
69458
|
+
setNestedPath((prev) => prev.slice(0, -1));
|
|
69459
|
+
setSelectedIndex(0);
|
|
69460
|
+
setSubcategorySearch("");
|
|
69461
|
+
return;
|
|
69462
|
+
}
|
|
69427
69463
|
setActiveCategory(null);
|
|
69428
69464
|
setSelectedIndex(0);
|
|
69429
69465
|
setSubcategorySearch("");
|
|
@@ -69462,7 +69498,12 @@ const SlashMenu = forwardRef(
|
|
|
69462
69498
|
const getTitle = () => {
|
|
69463
69499
|
if (!activeCategory) return "Insert from:";
|
|
69464
69500
|
const category = categories.find((c3) => c3.id === activeCategory);
|
|
69465
|
-
|
|
69501
|
+
const categoryLabel = (category == null ? void 0 : category.label) || activeCategory;
|
|
69502
|
+
if (nestedPath.length > 0) {
|
|
69503
|
+
const pathNames = nestedPath.map((v) => v.name);
|
|
69504
|
+
return `${categoryLabel} › ${pathNames.join(" › ")}`;
|
|
69505
|
+
}
|
|
69506
|
+
return categoryLabel;
|
|
69466
69507
|
};
|
|
69467
69508
|
const blocksSource = showBlocks ? BLOCK_ITEMS : [];
|
|
69468
69509
|
const filteredBlockItems = query ? blocksSource.filter((item) => {
|
|
@@ -71804,7 +71845,7 @@ const AIRefinePanel = ({
|
|
|
71804
71845
|
"data-id": "md-editor-ai-selection-box",
|
|
71805
71846
|
children: [
|
|
71806
71847
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `shrink-0 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide rounded-md transition-all duration-300 ${showSelectionHighlight ? "text-white bg-gradient-to-r from-violet-500 to-indigo-500 scale-105 shadow-md" : isDark ? "text-violet-400 bg-violet-500/20" : "text-violet-600 bg-violet-500/10"}`, children: context.type === "selection" ? "Selection" : "Full" }),
|
|
71807
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs leading-snug break-words
|
|
71848
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs leading-snug break-words ${isDark ? "text-gray-300" : "text-gray-600"} ${isContentExpanded ? "" : "line-clamp-4"}`, children: context.originalText || "(No content selected)" }) }),
|
|
71808
71849
|
context.originalText && context.originalText.length > 100 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
71809
71850
|
"button",
|
|
71810
71851
|
{
|
|
@@ -73119,13 +73160,13 @@ const MDEditor = forwardRef(
|
|
|
73119
73160
|
agentContext,
|
|
73120
73161
|
theme,
|
|
73121
73162
|
hideCloseButton: mergedAIConfig.alwaysShowPanel,
|
|
73122
|
-
envVariables:
|
|
73123
|
-
memoryVariables,
|
|
73124
|
-
systemVariables:
|
|
73125
|
-
contentVariables,
|
|
73126
|
-
agents:
|
|
73127
|
-
tools:
|
|
73128
|
-
knowledge:
|
|
73163
|
+
envVariables: mergedEnvVariables,
|
|
73164
|
+
memoryVariables: mergedMemoryVariables,
|
|
73165
|
+
systemVariables: mergedSystemVariables,
|
|
73166
|
+
contentVariables: mergedContentVariables,
|
|
73167
|
+
agents: mergedAgents,
|
|
73168
|
+
tools: mergedTools,
|
|
73169
|
+
knowledge: mergedKnowledge
|
|
73129
73170
|
}
|
|
73130
73171
|
)
|
|
73131
73172
|
]
|
package/dist/ui-libs.umd.js
CHANGED
|
@@ -69176,6 +69176,7 @@ ${code2}
|
|
|
69176
69176
|
const [activeCategory, setActiveCategory] = React.useState(null);
|
|
69177
69177
|
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
69178
69178
|
const [subcategorySearch, setSubcategorySearch] = React.useState("");
|
|
69179
|
+
const [nestedPath, setNestedPath] = React.useState([]);
|
|
69179
69180
|
const menuRef = React.useRef(null);
|
|
69180
69181
|
const blockItemsRef = React.useRef(null);
|
|
69181
69182
|
const categoryListRef = React.useRef(null);
|
|
@@ -69279,6 +69280,12 @@ ${code2}
|
|
|
69279
69280
|
items = contentVariables;
|
|
69280
69281
|
break;
|
|
69281
69282
|
}
|
|
69283
|
+
if (nestedPath.length > 0) {
|
|
69284
|
+
const lastInPath = nestedPath[nestedPath.length - 1];
|
|
69285
|
+
if (lastInPath.children && lastInPath.children.length > 0) {
|
|
69286
|
+
items = lastInPath.children;
|
|
69287
|
+
}
|
|
69288
|
+
}
|
|
69282
69289
|
const searchTerm = subcategorySearch.toLowerCase();
|
|
69283
69290
|
if (searchTerm) {
|
|
69284
69291
|
items = items.filter((item) => {
|
|
@@ -69295,7 +69302,7 @@ ${code2}
|
|
|
69295
69302
|
});
|
|
69296
69303
|
}
|
|
69297
69304
|
return items;
|
|
69298
|
-
}, [activeCategory, subcategorySearch, agents2, tools2, knowledge2, envVariables2, memoryVariables, systemVariables2, contentVariables, allCategories]);
|
|
69305
|
+
}, [activeCategory, subcategorySearch, nestedPath, agents2, tools2, knowledge2, envVariables2, memoryVariables, systemVariables2, contentVariables, allCategories]);
|
|
69299
69306
|
const currentItems = getCurrentItems();
|
|
69300
69307
|
const getAllNavigableItems = React.useCallback(() => {
|
|
69301
69308
|
if (activeCategory) {
|
|
@@ -69317,7 +69324,7 @@ ${code2}
|
|
|
69317
69324
|
const navigableItems = getAllNavigableItems();
|
|
69318
69325
|
React.useEffect(() => {
|
|
69319
69326
|
setSelectedIndex(0);
|
|
69320
|
-
}, [navigableItems.length, activeCategory, query, subcategorySearch]);
|
|
69327
|
+
}, [navigableItems.length, activeCategory, query, subcategorySearch, nestedPath.length]);
|
|
69321
69328
|
React.useEffect(() => {
|
|
69322
69329
|
const itemElement = itemRefs.current.get(selectedIndex);
|
|
69323
69330
|
if (itemElement) {
|
|
@@ -69370,6 +69377,11 @@ ${code2}
|
|
|
69370
69377
|
return true;
|
|
69371
69378
|
}
|
|
69372
69379
|
if (event.key === "Escape") {
|
|
69380
|
+
if (nestedPath.length > 0) {
|
|
69381
|
+
setNestedPath((prev) => prev.slice(0, -1));
|
|
69382
|
+
setSubcategorySearch("");
|
|
69383
|
+
return true;
|
|
69384
|
+
}
|
|
69373
69385
|
if (activeCategory) {
|
|
69374
69386
|
setActiveCategory(null);
|
|
69375
69387
|
setSubcategorySearch("");
|
|
@@ -69377,14 +69389,19 @@ ${code2}
|
|
|
69377
69389
|
}
|
|
69378
69390
|
return false;
|
|
69379
69391
|
}
|
|
69380
|
-
if (event.key === "Backspace" && !query && !subcategorySearch
|
|
69381
|
-
|
|
69382
|
-
|
|
69383
|
-
|
|
69392
|
+
if (event.key === "Backspace" && !query && !subcategorySearch) {
|
|
69393
|
+
if (nestedPath.length > 0) {
|
|
69394
|
+
setNestedPath((prev) => prev.slice(0, -1));
|
|
69395
|
+
return true;
|
|
69396
|
+
}
|
|
69397
|
+
if (activeCategory) {
|
|
69398
|
+
setActiveCategory(null);
|
|
69399
|
+
return true;
|
|
69400
|
+
}
|
|
69384
69401
|
}
|
|
69385
69402
|
return false;
|
|
69386
69403
|
},
|
|
69387
|
-
[navigableItems, selectedIndex, activeCategory, query, findNextEnabledIndex]
|
|
69404
|
+
[navigableItems, selectedIndex, activeCategory, query, nestedPath, findNextEnabledIndex]
|
|
69388
69405
|
);
|
|
69389
69406
|
React.useImperativeHandle(ref, () => ({
|
|
69390
69407
|
onKeyDown
|
|
@@ -69402,6 +69419,7 @@ ${code2}
|
|
|
69402
69419
|
setActiveCategory(item.id);
|
|
69403
69420
|
setSelectedIndex(0);
|
|
69404
69421
|
setSubcategorySearch("");
|
|
69422
|
+
setNestedPath([]);
|
|
69405
69423
|
return;
|
|
69406
69424
|
}
|
|
69407
69425
|
if ("action" in item && typeof item.action === "function") {
|
|
@@ -69428,12 +69446,24 @@ ${code2}
|
|
|
69428
69446
|
}
|
|
69429
69447
|
if ("path" in item && "type" in item) {
|
|
69430
69448
|
const variable = item;
|
|
69449
|
+
if (variable.children && variable.children.length > 0) {
|
|
69450
|
+
setNestedPath((prev) => [...prev, variable]);
|
|
69451
|
+
setSelectedIndex(0);
|
|
69452
|
+
setSubcategorySearch("");
|
|
69453
|
+
return;
|
|
69454
|
+
}
|
|
69431
69455
|
deleteSlashTrigger();
|
|
69456
|
+
let fullPath = variable.path;
|
|
69457
|
+
if (nestedPath.length > 0) {
|
|
69458
|
+
const pathParts = nestedPath.map((v) => v.name);
|
|
69459
|
+
pathParts.push(variable.name);
|
|
69460
|
+
fullPath = pathParts.join(".");
|
|
69461
|
+
}
|
|
69432
69462
|
editor.chain().focus().insertContent({
|
|
69433
69463
|
type: "variableChip",
|
|
69434
69464
|
attrs: {
|
|
69435
69465
|
variableType: variable.type,
|
|
69436
|
-
path:
|
|
69466
|
+
path: fullPath,
|
|
69437
69467
|
displayName: variable.name
|
|
69438
69468
|
}
|
|
69439
69469
|
}).insertContent(" ").run();
|
|
@@ -69442,6 +69472,12 @@ ${code2}
|
|
|
69442
69472
|
command2(item);
|
|
69443
69473
|
};
|
|
69444
69474
|
const handleBack = () => {
|
|
69475
|
+
if (nestedPath.length > 0) {
|
|
69476
|
+
setNestedPath((prev) => prev.slice(0, -1));
|
|
69477
|
+
setSelectedIndex(0);
|
|
69478
|
+
setSubcategorySearch("");
|
|
69479
|
+
return;
|
|
69480
|
+
}
|
|
69445
69481
|
setActiveCategory(null);
|
|
69446
69482
|
setSelectedIndex(0);
|
|
69447
69483
|
setSubcategorySearch("");
|
|
@@ -69480,7 +69516,12 @@ ${code2}
|
|
|
69480
69516
|
const getTitle = () => {
|
|
69481
69517
|
if (!activeCategory) return "Insert from:";
|
|
69482
69518
|
const category = categories.find((c2) => c2.id === activeCategory);
|
|
69483
|
-
|
|
69519
|
+
const categoryLabel = (category == null ? void 0 : category.label) || activeCategory;
|
|
69520
|
+
if (nestedPath.length > 0) {
|
|
69521
|
+
const pathNames = nestedPath.map((v) => v.name);
|
|
69522
|
+
return `${categoryLabel} › ${pathNames.join(" › ")}`;
|
|
69523
|
+
}
|
|
69524
|
+
return categoryLabel;
|
|
69484
69525
|
};
|
|
69485
69526
|
const blocksSource = showBlocks ? BLOCK_ITEMS : [];
|
|
69486
69527
|
const filteredBlockItems = query ? blocksSource.filter((item) => {
|
|
@@ -71822,7 +71863,7 @@ ${code2}
|
|
|
71822
71863
|
"data-id": "md-editor-ai-selection-box",
|
|
71823
71864
|
children: [
|
|
71824
71865
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `shrink-0 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide rounded-md transition-all duration-300 ${showSelectionHighlight ? "text-white bg-gradient-to-r from-violet-500 to-indigo-500 scale-105 shadow-md" : isDark ? "text-violet-400 bg-violet-500/20" : "text-violet-600 bg-violet-500/10"}`, children: context.type === "selection" ? "Selection" : "Full" }),
|
|
71825
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs leading-snug break-words
|
|
71866
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs leading-snug break-words ${isDark ? "text-gray-300" : "text-gray-600"} ${isContentExpanded ? "" : "line-clamp-4"}`, children: context.originalText || "(No content selected)" }) }),
|
|
71826
71867
|
context.originalText && context.originalText.length > 100 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
71827
71868
|
"button",
|
|
71828
71869
|
{
|
|
@@ -73137,13 +73178,13 @@ ${code2}
|
|
|
73137
73178
|
agentContext,
|
|
73138
73179
|
theme,
|
|
73139
73180
|
hideCloseButton: mergedAIConfig.alwaysShowPanel,
|
|
73140
|
-
envVariables:
|
|
73141
|
-
memoryVariables,
|
|
73142
|
-
systemVariables:
|
|
73143
|
-
contentVariables,
|
|
73144
|
-
agents:
|
|
73145
|
-
tools:
|
|
73146
|
-
knowledge:
|
|
73181
|
+
envVariables: mergedEnvVariables,
|
|
73182
|
+
memoryVariables: mergedMemoryVariables,
|
|
73183
|
+
systemVariables: mergedSystemVariables,
|
|
73184
|
+
contentVariables: mergedContentVariables,
|
|
73185
|
+
agents: mergedAgents,
|
|
73186
|
+
tools: mergedTools,
|
|
73187
|
+
knowledge: mergedKnowledge
|
|
73147
73188
|
}
|
|
73148
73189
|
)
|
|
73149
73190
|
]
|