@uipath/apollo-wind 2.22.0 → 2.24.0
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/components/forms/metadata-form.cjs +2 -2
- package/dist/components/forms/metadata-form.js +2 -2
- package/dist/components/ui/index.cjs +92 -82
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/prompt-editor/components/EditorToolbar.cjs +156 -0
- package/dist/components/ui/prompt-editor/components/EditorToolbar.d.ts +9 -0
- package/dist/components/ui/prompt-editor/components/EditorToolbar.js +122 -0
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.cjs +205 -0
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.d.ts +14 -0
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.js +161 -0
- package/dist/components/ui/prompt-editor/components/PromptEditorAutocompleteMenu.cjs +194 -0
- package/dist/components/ui/prompt-editor/components/PromptEditorAutocompleteMenu.d.ts +28 -0
- package/dist/components/ui/prompt-editor/components/PromptEditorAutocompleteMenu.js +160 -0
- package/dist/components/ui/prompt-editor/components/TokenPill.cjs +119 -0
- package/dist/components/ui/prompt-editor/components/TokenPill.d.ts +15 -0
- package/dist/components/ui/prompt-editor/components/TokenPill.js +85 -0
- package/dist/components/ui/prompt-editor/components/TokenPillWithTooltip.cjs +138 -0
- package/dist/components/ui/prompt-editor/components/TokenPillWithTooltip.d.ts +13 -0
- package/dist/components/ui/prompt-editor/components/TokenPillWithTooltip.js +104 -0
- package/dist/components/ui/prompt-editor/components/token-icon-markup.cjs +138 -0
- package/dist/components/ui/prompt-editor/components/token-icon-markup.d.ts +16 -0
- package/dist/components/ui/prompt-editor/components/token-icon-markup.js +104 -0
- package/dist/components/ui/prompt-editor/index.cjs +40 -0
- package/dist/components/ui/prompt-editor/index.d.ts +4 -0
- package/dist/components/ui/prompt-editor/index.js +3 -0
- package/dist/components/ui/prompt-editor/nodes/InputTokenNode.cjs +145 -0
- package/dist/components/ui/prompt-editor/nodes/InputTokenNode.d.ts +30 -0
- package/dist/components/ui/prompt-editor/nodes/InputTokenNode.js +105 -0
- package/dist/components/ui/prompt-editor/nodes/OutputTokenNode.cjs +145 -0
- package/dist/components/ui/prompt-editor/nodes/OutputTokenNode.d.ts +30 -0
- package/dist/components/ui/prompt-editor/nodes/OutputTokenNode.js +105 -0
- package/dist/components/ui/prompt-editor/nodes/ResourceTokenNode.cjs +145 -0
- package/dist/components/ui/prompt-editor/nodes/ResourceTokenNode.d.ts +30 -0
- package/dist/components/ui/prompt-editor/nodes/ResourceTokenNode.js +105 -0
- package/dist/components/ui/prompt-editor/nodes/StateTokenNode.cjs +145 -0
- package/dist/components/ui/prompt-editor/nodes/StateTokenNode.d.ts +30 -0
- package/dist/components/ui/prompt-editor/nodes/StateTokenNode.js +105 -0
- package/dist/components/ui/prompt-editor/nodes/index.cjs +72 -0
- package/dist/components/ui/prompt-editor/nodes/index.d.ts +8 -0
- package/dist/components/ui/prompt-editor/nodes/index.js +5 -0
- package/dist/components/ui/prompt-editor/plugins/AutocompletePlugin.cjs +242 -0
- package/dist/components/ui/prompt-editor/plugins/AutocompletePlugin.d.ts +15 -0
- package/dist/components/ui/prompt-editor/plugins/AutocompletePlugin.js +208 -0
- package/dist/components/ui/prompt-editor/plugins/CopyPastePlugin.cjs +164 -0
- package/dist/components/ui/prompt-editor/plugins/CopyPastePlugin.d.ts +1 -0
- package/dist/components/ui/prompt-editor/plugins/CopyPastePlugin.js +130 -0
- package/dist/components/ui/prompt-editor/plugins/EditorRefPlugin.cjs +50 -0
- package/dist/components/ui/prompt-editor/plugins/EditorRefPlugin.d.ts +4 -0
- package/dist/components/ui/prompt-editor/plugins/EditorRefPlugin.js +16 -0
- package/dist/components/ui/prompt-editor/plugins/MultilinePlugin.cjs +108 -0
- package/dist/components/ui/prompt-editor/plugins/MultilinePlugin.d.ts +3 -0
- package/dist/components/ui/prompt-editor/plugins/MultilinePlugin.js +74 -0
- package/dist/components/ui/prompt-editor/plugins/NodeSelectionFixPlugin.cjs +313 -0
- package/dist/components/ui/prompt-editor/plugins/NodeSelectionFixPlugin.d.ts +7 -0
- package/dist/components/ui/prompt-editor/plugins/NodeSelectionFixPlugin.js +276 -0
- package/dist/components/ui/prompt-editor/plugins/RenameTokensPlugin.cjs +186 -0
- package/dist/components/ui/prompt-editor/plugins/RenameTokensPlugin.d.ts +7 -0
- package/dist/components/ui/prompt-editor/plugins/RenameTokensPlugin.js +152 -0
- package/dist/components/ui/prompt-editor/plugins/ToolbarActionsPlugin.cjs +132 -0
- package/dist/components/ui/prompt-editor/plugins/ToolbarActionsPlugin.d.ts +7 -0
- package/dist/components/ui/prompt-editor/plugins/ToolbarActionsPlugin.js +98 -0
- package/dist/components/ui/prompt-editor/plugins/ValidateTokensPlugin.cjs +85 -0
- package/dist/components/ui/prompt-editor/plugins/ValidateTokensPlugin.d.ts +4 -0
- package/dist/components/ui/prompt-editor/plugins/ValidateTokensPlugin.js +51 -0
- package/dist/components/ui/prompt-editor/plugins/ValueSyncPlugin.cjs +98 -0
- package/dist/components/ui/prompt-editor/plugins/ValueSyncPlugin.d.ts +8 -0
- package/dist/components/ui/prompt-editor/plugins/ValueSyncPlugin.js +64 -0
- package/dist/components/ui/prompt-editor/plugins/VariableDropPlugin.cjs +137 -0
- package/dist/components/ui/prompt-editor/plugins/VariableDropPlugin.d.ts +19 -0
- package/dist/components/ui/prompt-editor/plugins/VariableDropPlugin.js +100 -0
- package/dist/components/ui/prompt-editor/plugins/shared/token-nodes.cjs +49 -0
- package/dist/components/ui/prompt-editor/plugins/shared/token-nodes.d.ts +8 -0
- package/dist/components/ui/prompt-editor/plugins/shared/token-nodes.js +12 -0
- package/dist/components/ui/prompt-editor/prompt-editor.cjs +402 -0
- package/dist/components/ui/prompt-editor/prompt-editor.d.ts +35 -0
- package/dist/components/ui/prompt-editor/prompt-editor.js +368 -0
- package/dist/components/ui/prompt-editor/types.cjs +74 -0
- package/dist/components/ui/prompt-editor/types.d.ts +58 -0
- package/dist/components/ui/prompt-editor/types.js +31 -0
- package/dist/components/ui/prompt-editor/utils/autocomplete-segments.cjs +60 -0
- package/dist/components/ui/prompt-editor/utils/autocomplete-segments.d.ts +29 -0
- package/dist/components/ui/prompt-editor/utils/autocomplete-segments.js +20 -0
- package/dist/components/ui/prompt-editor/utils/comparison.cjs +39 -0
- package/dist/components/ui/prompt-editor/utils/comparison.d.ts +3 -0
- package/dist/components/ui/prompt-editor/utils/comparison.js +5 -0
- package/dist/components/ui/prompt-editor/utils/index.cjs +68 -0
- package/dist/components/ui/prompt-editor/utils/index.d.ts +3 -0
- package/dist/components/ui/prompt-editor/utils/index.js +4 -0
- package/dist/components/ui/prompt-editor/utils/insert-token.cjs +103 -0
- package/dist/components/ui/prompt-editor/utils/insert-token.d.ts +12 -0
- package/dist/components/ui/prompt-editor/utils/insert-token.js +66 -0
- package/dist/components/ui/prompt-editor/utils/serialization.cjs +255 -0
- package/dist/components/ui/prompt-editor/utils/serialization.d.ts +16 -0
- package/dist/components/ui/prompt-editor/utils/serialization.js +200 -0
- package/dist/editor-themes/monaco.cjs +2 -2
- package/dist/editor-themes/monaco.js +2 -2
- package/dist/index.cjs +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/styles.css +44 -16
- package/dist/tailwind.utilities.css +1 -1
- package/package.json +7 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
TokenPillWithTooltip: ()=>TokenPillWithTooltip
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const LexicalComposerContext_namespaceObject = require("@lexical/react/LexicalComposerContext");
|
|
32
|
+
const useLexicalNodeSelection_namespaceObject = require("@lexical/react/useLexicalNodeSelection");
|
|
33
|
+
const external_lexical_namespaceObject = require("lexical");
|
|
34
|
+
const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
|
|
35
|
+
const external_TokenPill_cjs_namespaceObject = require("./TokenPill.cjs");
|
|
36
|
+
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
37
|
+
const TokenPillWithTooltip = ({ nodeKey, ...props })=>{
|
|
38
|
+
const { value: pillValue, tokenType, readonly, diffType, isInvalid, onRemove } = props;
|
|
39
|
+
const typeLabel = (0, external_types_cjs_namespaceObject.getPromptEditorTokenTypeLabel)(tokenType);
|
|
40
|
+
const [editor] = (0, LexicalComposerContext_namespaceObject.useLexicalComposerContext)();
|
|
41
|
+
const [isSelected] = (0, useLexicalNodeSelection_namespaceObject.useLexicalNodeSelection)(nodeKey);
|
|
42
|
+
const handleMouseDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
43
|
+
if (readonly) return;
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
editor.update(()=>{
|
|
47
|
+
const sel = (0, external_lexical_namespaceObject.$createNodeSelection)();
|
|
48
|
+
sel.add(nodeKey);
|
|
49
|
+
(0, external_lexical_namespaceObject.$setSelection)(sel);
|
|
50
|
+
});
|
|
51
|
+
const rootElement = editor.getRootElement();
|
|
52
|
+
if (rootElement) {
|
|
53
|
+
rootElement.focus({
|
|
54
|
+
preventScroll: true
|
|
55
|
+
});
|
|
56
|
+
globalThis.getSelection()?.removeAllRanges();
|
|
57
|
+
}
|
|
58
|
+
}, [
|
|
59
|
+
editor,
|
|
60
|
+
nodeKey,
|
|
61
|
+
readonly
|
|
62
|
+
]);
|
|
63
|
+
const pillProps = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
64
|
+
value: pillValue,
|
|
65
|
+
tokenType,
|
|
66
|
+
readonly,
|
|
67
|
+
diffType,
|
|
68
|
+
isInvalid,
|
|
69
|
+
onRemove,
|
|
70
|
+
isSelected,
|
|
71
|
+
onMouseDown: handleMouseDown
|
|
72
|
+
}), [
|
|
73
|
+
pillValue,
|
|
74
|
+
tokenType,
|
|
75
|
+
readonly,
|
|
76
|
+
diffType,
|
|
77
|
+
isInvalid,
|
|
78
|
+
onRemove,
|
|
79
|
+
isSelected,
|
|
80
|
+
handleMouseDown
|
|
81
|
+
]);
|
|
82
|
+
if (diffType) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_TokenPill_cjs_namespaceObject.TokenPill, {
|
|
83
|
+
...pillProps
|
|
84
|
+
});
|
|
85
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
86
|
+
delayDuration: 250,
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
89
|
+
asChild: true,
|
|
90
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
91
|
+
className: "inline-flex",
|
|
92
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_TokenPill_cjs_namespaceObject.TokenPill, {
|
|
93
|
+
...pillProps
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
98
|
+
side: "top",
|
|
99
|
+
align: "start",
|
|
100
|
+
children: isInvalid ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
101
|
+
className: "flex w-[280px] flex-col gap-1 text-xs",
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
104
|
+
className: "font-medium",
|
|
105
|
+
children: "Variable not found"
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
108
|
+
className: "break-words opacity-80",
|
|
109
|
+
children: [
|
|
110
|
+
pillValue,
|
|
111
|
+
" isn't available in this scope. Fix or remove this reference before publishing."
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
116
|
+
className: "flex max-w-[320px] flex-col gap-0.5 text-xs",
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
119
|
+
className: "font-mono opacity-95",
|
|
120
|
+
children: pillValue
|
|
121
|
+
}),
|
|
122
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
123
|
+
className: "opacity-70",
|
|
124
|
+
children: typeLabel
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
exports.TokenPillWithTooltip = __webpack_exports__.TokenPillWithTooltip;
|
|
133
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
134
|
+
"TokenPillWithTooltip"
|
|
135
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
136
|
+
Object.defineProperty(exports, '__esModule', {
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type NodeKey } from 'lexical';
|
|
2
|
+
import { type TokenPillProps } from './TokenPill';
|
|
3
|
+
export interface TokenPillWithTooltipProps extends TokenPillProps {
|
|
4
|
+
/** Lexical node key for the underlying decorator — drives `NodeSelection` click-to-focus. */
|
|
5
|
+
nodeKey: NodeKey;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Wraps `TokenPill` with a hover tooltip showing the token's path and type label. Invalid chips
|
|
9
|
+
* (not present in the editor's autocomplete options) surface a "not found" message paired with the
|
|
10
|
+
* red-invalid pill styling. Suppressed when the chip is in a diff state so it doesn't clash with the
|
|
11
|
+
* diff styling.
|
|
12
|
+
*/
|
|
13
|
+
export declare const TokenPillWithTooltip: ({ nodeKey, ...props }: TokenPillWithTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
5
|
+
import { $createNodeSelection, $setSelection } from "lexical";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../../tooltip.js";
|
|
7
|
+
import { TokenPill } from "./TokenPill.js";
|
|
8
|
+
import { getPromptEditorTokenTypeLabel } from "../types.js";
|
|
9
|
+
const TokenPillWithTooltip = ({ nodeKey, ...props })=>{
|
|
10
|
+
const { value: pillValue, tokenType, readonly, diffType, isInvalid, onRemove } = props;
|
|
11
|
+
const typeLabel = getPromptEditorTokenTypeLabel(tokenType);
|
|
12
|
+
const [editor] = useLexicalComposerContext();
|
|
13
|
+
const [isSelected] = useLexicalNodeSelection(nodeKey);
|
|
14
|
+
const handleMouseDown = useCallback((e)=>{
|
|
15
|
+
if (readonly) return;
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
editor.update(()=>{
|
|
19
|
+
const sel = $createNodeSelection();
|
|
20
|
+
sel.add(nodeKey);
|
|
21
|
+
$setSelection(sel);
|
|
22
|
+
});
|
|
23
|
+
const rootElement = editor.getRootElement();
|
|
24
|
+
if (rootElement) {
|
|
25
|
+
rootElement.focus({
|
|
26
|
+
preventScroll: true
|
|
27
|
+
});
|
|
28
|
+
globalThis.getSelection()?.removeAllRanges();
|
|
29
|
+
}
|
|
30
|
+
}, [
|
|
31
|
+
editor,
|
|
32
|
+
nodeKey,
|
|
33
|
+
readonly
|
|
34
|
+
]);
|
|
35
|
+
const pillProps = useMemo(()=>({
|
|
36
|
+
value: pillValue,
|
|
37
|
+
tokenType,
|
|
38
|
+
readonly,
|
|
39
|
+
diffType,
|
|
40
|
+
isInvalid,
|
|
41
|
+
onRemove,
|
|
42
|
+
isSelected,
|
|
43
|
+
onMouseDown: handleMouseDown
|
|
44
|
+
}), [
|
|
45
|
+
pillValue,
|
|
46
|
+
tokenType,
|
|
47
|
+
readonly,
|
|
48
|
+
diffType,
|
|
49
|
+
isInvalid,
|
|
50
|
+
onRemove,
|
|
51
|
+
isSelected,
|
|
52
|
+
handleMouseDown
|
|
53
|
+
]);
|
|
54
|
+
if (diffType) return /*#__PURE__*/ jsx(TokenPill, {
|
|
55
|
+
...pillProps
|
|
56
|
+
});
|
|
57
|
+
return /*#__PURE__*/ jsxs(Tooltip, {
|
|
58
|
+
delayDuration: 250,
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
61
|
+
asChild: true,
|
|
62
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
63
|
+
className: "inline-flex",
|
|
64
|
+
children: /*#__PURE__*/ jsx(TokenPill, {
|
|
65
|
+
...pillProps
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
70
|
+
side: "top",
|
|
71
|
+
align: "start",
|
|
72
|
+
children: isInvalid ? /*#__PURE__*/ jsxs("div", {
|
|
73
|
+
className: "flex w-[280px] flex-col gap-1 text-xs",
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ jsx("div", {
|
|
76
|
+
className: "font-medium",
|
|
77
|
+
children: "Variable not found"
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ jsxs("div", {
|
|
80
|
+
className: "break-words opacity-80",
|
|
81
|
+
children: [
|
|
82
|
+
pillValue,
|
|
83
|
+
" isn't available in this scope. Fix or remove this reference before publishing."
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
88
|
+
className: "flex max-w-[320px] flex-col gap-0.5 text-xs",
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ jsx("span", {
|
|
91
|
+
className: "font-mono opacity-95",
|
|
92
|
+
children: pillValue
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ jsx("span", {
|
|
95
|
+
className: "opacity-70",
|
|
96
|
+
children: typeLabel
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
export { TokenPillWithTooltip };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
buildTokenIconSvgMarkup: ()=>buildTokenIconSvgMarkup
|
|
28
|
+
});
|
|
29
|
+
const VARIABLE_ICON = [
|
|
30
|
+
{
|
|
31
|
+
kind: 'path',
|
|
32
|
+
d: 'M8 21s-4-3-4-9 4-9 4-9'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
kind: 'path',
|
|
36
|
+
d: 'M16 3s4 3 4 9-4 9-4 9'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
kind: 'line',
|
|
40
|
+
x1: '15',
|
|
41
|
+
x2: '9',
|
|
42
|
+
y1: '9',
|
|
43
|
+
y2: '15'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
kind: 'line',
|
|
47
|
+
x1: '9',
|
|
48
|
+
x2: '15',
|
|
49
|
+
y1: '9',
|
|
50
|
+
y2: '15'
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
const SQUARE_FUNCTION_ICON = [
|
|
54
|
+
{
|
|
55
|
+
kind: 'rect',
|
|
56
|
+
x: '3',
|
|
57
|
+
y: '3',
|
|
58
|
+
width: '18',
|
|
59
|
+
height: '18',
|
|
60
|
+
rx: '2',
|
|
61
|
+
ry: '2'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
kind: 'path',
|
|
65
|
+
d: 'M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
kind: 'path',
|
|
69
|
+
d: 'M9 11.2h5.7'
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
const DATABASE_ICON = [
|
|
73
|
+
{
|
|
74
|
+
kind: 'ellipse',
|
|
75
|
+
cx: '12',
|
|
76
|
+
cy: '5',
|
|
77
|
+
rx: '9',
|
|
78
|
+
ry: '3'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
kind: 'path',
|
|
82
|
+
d: 'M3 5V19A9 3 0 0 0 21 19V5'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
kind: 'path',
|
|
86
|
+
d: 'M3 12A9 3 0 0 0 21 12'
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
const PAPERCLIP_ICON = [
|
|
90
|
+
{
|
|
91
|
+
kind: 'path',
|
|
92
|
+
d: 'm16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551'
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
const TOKEN_TYPE_ICON = {
|
|
96
|
+
input: {
|
|
97
|
+
name: 'variable',
|
|
98
|
+
body: VARIABLE_ICON
|
|
99
|
+
},
|
|
100
|
+
output: {
|
|
101
|
+
name: 'square-function',
|
|
102
|
+
body: SQUARE_FUNCTION_ICON
|
|
103
|
+
},
|
|
104
|
+
state: {
|
|
105
|
+
name: 'database',
|
|
106
|
+
body: DATABASE_ICON
|
|
107
|
+
},
|
|
108
|
+
resource: {
|
|
109
|
+
name: 'paperclip',
|
|
110
|
+
body: PAPERCLIP_ICON
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const renderElement = (el)=>{
|
|
114
|
+
switch(el.kind){
|
|
115
|
+
case 'path':
|
|
116
|
+
return `<path d="${el.d}"/>`;
|
|
117
|
+
case 'line':
|
|
118
|
+
return `<line x1="${el.x1}" x2="${el.x2}" y1="${el.y1}" y2="${el.y2}"/>`;
|
|
119
|
+
case 'circle':
|
|
120
|
+
return `<circle cx="${el.cx}" cy="${el.cy}" r="${el.r}"/>`;
|
|
121
|
+
case 'ellipse':
|
|
122
|
+
return `<ellipse cx="${el.cx}" cy="${el.cy}" rx="${el.rx}" ry="${el.ry}"/>`;
|
|
123
|
+
case 'rect':
|
|
124
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}"${el.rx ? ` rx="${el.rx}"` : ''}${el.ry ? ` ry="${el.ry}"` : ''}/>`;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const wrapSvg = (iconName, body)=>`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-${iconName}">${body.map(renderElement).join('')}</svg>`;
|
|
128
|
+
function buildTokenIconSvgMarkup(type) {
|
|
129
|
+
const choice = 'text' === type ? TOKEN_TYPE_ICON.input : TOKEN_TYPE_ICON[type];
|
|
130
|
+
return wrapSvg(choice.name, choice.body);
|
|
131
|
+
}
|
|
132
|
+
exports.buildTokenIconSvgMarkup = __webpack_exports__.buildTokenIconSvgMarkup;
|
|
133
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
134
|
+
"buildTokenIconSvgMarkup"
|
|
135
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
136
|
+
Object.defineProperty(exports, '__esModule', {
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-mirrored SVG markup for the lucide icons the token pills render in edit mode. Used by
|
|
3
|
+
* `MarkdownPreview` so a chip's leading icon can be inlined into the sanitised HTML without going
|
|
4
|
+
* through `react-dom/server`'s `renderToStaticMarkup` (which couples to React reconciler internals
|
|
5
|
+
* and can crash depending on the host bundle).
|
|
6
|
+
*
|
|
7
|
+
* The element data is copied verbatim from `lucide-react@0.577.0`'s `__iconNode` arrays
|
|
8
|
+
* (`dist/esm/icons/<name>.js`) so the preview SVGs match exactly what `<TokenPill>` renders.
|
|
9
|
+
*/
|
|
10
|
+
import type { PromptEditorTokenType } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* Build the inline SVG markup for a token chip's leading icon, keyed by token type. Output mirrors
|
|
13
|
+
* what `<TokenPill>` renders in edit mode (lucide v0.577.0), suitable for embedding in a markdown
|
|
14
|
+
* HTML string. Non-variable token types fall back to the input (`variable`) glyph.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildTokenIconSvgMarkup(type: PromptEditorTokenType): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const VARIABLE_ICON = [
|
|
2
|
+
{
|
|
3
|
+
kind: 'path',
|
|
4
|
+
d: 'M8 21s-4-3-4-9 4-9 4-9'
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
kind: 'path',
|
|
8
|
+
d: 'M16 3s4 3 4 9-4 9-4 9'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
kind: 'line',
|
|
12
|
+
x1: '15',
|
|
13
|
+
x2: '9',
|
|
14
|
+
y1: '9',
|
|
15
|
+
y2: '15'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
kind: 'line',
|
|
19
|
+
x1: '9',
|
|
20
|
+
x2: '15',
|
|
21
|
+
y1: '9',
|
|
22
|
+
y2: '15'
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
const SQUARE_FUNCTION_ICON = [
|
|
26
|
+
{
|
|
27
|
+
kind: 'rect',
|
|
28
|
+
x: '3',
|
|
29
|
+
y: '3',
|
|
30
|
+
width: '18',
|
|
31
|
+
height: '18',
|
|
32
|
+
rx: '2',
|
|
33
|
+
ry: '2'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
kind: 'path',
|
|
37
|
+
d: 'M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: 'path',
|
|
41
|
+
d: 'M9 11.2h5.7'
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
const DATABASE_ICON = [
|
|
45
|
+
{
|
|
46
|
+
kind: 'ellipse',
|
|
47
|
+
cx: '12',
|
|
48
|
+
cy: '5',
|
|
49
|
+
rx: '9',
|
|
50
|
+
ry: '3'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
kind: 'path',
|
|
54
|
+
d: 'M3 5V19A9 3 0 0 0 21 19V5'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
kind: 'path',
|
|
58
|
+
d: 'M3 12A9 3 0 0 0 21 12'
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
const PAPERCLIP_ICON = [
|
|
62
|
+
{
|
|
63
|
+
kind: 'path',
|
|
64
|
+
d: 'm16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551'
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
const TOKEN_TYPE_ICON = {
|
|
68
|
+
input: {
|
|
69
|
+
name: 'variable',
|
|
70
|
+
body: VARIABLE_ICON
|
|
71
|
+
},
|
|
72
|
+
output: {
|
|
73
|
+
name: 'square-function',
|
|
74
|
+
body: SQUARE_FUNCTION_ICON
|
|
75
|
+
},
|
|
76
|
+
state: {
|
|
77
|
+
name: 'database',
|
|
78
|
+
body: DATABASE_ICON
|
|
79
|
+
},
|
|
80
|
+
resource: {
|
|
81
|
+
name: 'paperclip',
|
|
82
|
+
body: PAPERCLIP_ICON
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const renderElement = (el)=>{
|
|
86
|
+
switch(el.kind){
|
|
87
|
+
case 'path':
|
|
88
|
+
return `<path d="${el.d}"/>`;
|
|
89
|
+
case 'line':
|
|
90
|
+
return `<line x1="${el.x1}" x2="${el.x2}" y1="${el.y1}" y2="${el.y2}"/>`;
|
|
91
|
+
case 'circle':
|
|
92
|
+
return `<circle cx="${el.cx}" cy="${el.cy}" r="${el.r}"/>`;
|
|
93
|
+
case 'ellipse':
|
|
94
|
+
return `<ellipse cx="${el.cx}" cy="${el.cy}" rx="${el.rx}" ry="${el.ry}"/>`;
|
|
95
|
+
case 'rect':
|
|
96
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}"${el.rx ? ` rx="${el.rx}"` : ''}${el.ry ? ` ry="${el.ry}"` : ''}/>`;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const wrapSvg = (iconName, body)=>`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-${iconName}">${body.map(renderElement).join('')}</svg>`;
|
|
100
|
+
function buildTokenIconSvgMarkup(type) {
|
|
101
|
+
const choice = 'text' === type ? TOKEN_TYPE_ICON.input : TOKEN_TYPE_ICON[type];
|
|
102
|
+
return wrapSvg(choice.name, choice.body);
|
|
103
|
+
}
|
|
104
|
+
export { buildTokenIconSvgMarkup };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
VARIABLE_DRAG_MIME: ()=>VariableDropPlugin_cjs_namespaceObject.VARIABLE_DRAG_MIME,
|
|
28
|
+
PromptEditor: ()=>external_prompt_editor_cjs_namespaceObject.PromptEditor
|
|
29
|
+
});
|
|
30
|
+
const VariableDropPlugin_cjs_namespaceObject = require("./plugins/VariableDropPlugin.cjs");
|
|
31
|
+
const external_prompt_editor_cjs_namespaceObject = require("./prompt-editor.cjs");
|
|
32
|
+
exports.PromptEditor = __webpack_exports__.PromptEditor;
|
|
33
|
+
exports.VARIABLE_DRAG_MIME = __webpack_exports__.VARIABLE_DRAG_MIME;
|
|
34
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
|
+
"PromptEditor",
|
|
36
|
+
"VARIABLE_DRAG_MIME"
|
|
37
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
38
|
+
Object.defineProperty(exports, '__esModule', {
|
|
39
|
+
value: true
|
|
40
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { VARIABLE_DRAG_MIME } from './plugins/VariableDropPlugin';
|
|
2
|
+
export type { PromptEditorProps, PromptEditorRef } from './prompt-editor';
|
|
3
|
+
export { PromptEditor } from './prompt-editor';
|
|
4
|
+
export type { PromptEditorAutoCompleteOption, PromptEditorMode, PromptEditorToken, PromptEditorTokenType, } from './types';
|