@uipath/apollo-wind 2.46.0 → 2.47.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/ui/avatar.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/command.d.ts +13 -13
- package/dist/components/ui/index.cjs +30 -30
- package/dist/components/ui/prompt-editor/components/EditorToolbar.cjs +101 -68
- package/dist/components/ui/prompt-editor/components/EditorToolbar.d.ts +16 -2
- package/dist/components/ui/prompt-editor/components/EditorToolbar.js +101 -68
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.cjs +13 -8
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.d.ts +13 -1
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.js +13 -8
- package/dist/components/ui/prompt-editor/components/PromptEditorAutocompleteMenu.cjs +22 -11
- package/dist/components/ui/prompt-editor/components/PromptEditorAutocompleteMenu.js +23 -12
- package/dist/components/ui/prompt-editor/components/TokenPill.cjs +4 -2
- package/dist/components/ui/prompt-editor/components/TokenPill.js +4 -2
- package/dist/components/ui/prompt-editor/components/TokenPillSlot.cjs +58 -0
- package/dist/components/ui/prompt-editor/components/TokenPillSlot.d.ts +7 -0
- package/dist/components/ui/prompt-editor/components/TokenPillSlot.js +24 -0
- package/dist/components/ui/prompt-editor/components/TokenPillWithTooltip.cjs +8 -9
- package/dist/components/ui/prompt-editor/components/TokenPillWithTooltip.js +8 -9
- package/dist/components/ui/prompt-editor/index.cjs +152 -9
- package/dist/components/ui/prompt-editor/index.d.ts +13 -1
- package/dist/components/ui/prompt-editor/index.js +11 -1
- package/dist/components/ui/prompt-editor/nodes/InputTokenNode.cjs +2 -2
- package/dist/components/ui/prompt-editor/nodes/InputTokenNode.d.ts +1 -1
- package/dist/components/ui/prompt-editor/nodes/InputTokenNode.js +2 -2
- package/dist/components/ui/prompt-editor/nodes/OutputTokenNode.cjs +2 -2
- package/dist/components/ui/prompt-editor/nodes/OutputTokenNode.d.ts +1 -1
- package/dist/components/ui/prompt-editor/nodes/OutputTokenNode.js +2 -2
- package/dist/components/ui/prompt-editor/nodes/ResourceTokenNode.cjs +2 -2
- package/dist/components/ui/prompt-editor/nodes/ResourceTokenNode.d.ts +1 -1
- package/dist/components/ui/prompt-editor/nodes/ResourceTokenNode.js +2 -2
- package/dist/components/ui/prompt-editor/nodes/StateTokenNode.cjs +2 -2
- package/dist/components/ui/prompt-editor/nodes/StateTokenNode.d.ts +1 -1
- package/dist/components/ui/prompt-editor/nodes/StateTokenNode.js +2 -2
- package/dist/components/ui/prompt-editor/nodes/index.cjs +1 -1
- package/dist/components/ui/prompt-editor/nodes/index.d.ts +5 -5
- package/dist/components/ui/prompt-editor/nodes/index.js +1 -1
- package/dist/components/ui/prompt-editor/plugins/AutocompletePlugin.cjs +11 -5
- package/dist/components/ui/prompt-editor/plugins/AutocompletePlugin.d.ts +8 -1
- package/dist/components/ui/prompt-editor/plugins/AutocompletePlugin.js +12 -6
- package/dist/components/ui/prompt-editor/plugins/CopyPastePlugin.cjs +1 -1
- package/dist/components/ui/prompt-editor/plugins/CopyPastePlugin.js +1 -1
- package/dist/components/ui/prompt-editor/plugins/EditorRefPlugin.cjs +1 -1
- package/dist/components/ui/prompt-editor/plugins/EditorRefPlugin.js +1 -1
- package/dist/components/ui/prompt-editor/plugins/MultilinePlugin.cjs +1 -1
- package/dist/components/ui/prompt-editor/plugins/MultilinePlugin.js +1 -1
- package/dist/components/ui/prompt-editor/plugins/NodeSelectionFixPlugin.cjs +12 -6
- package/dist/components/ui/prompt-editor/plugins/NodeSelectionFixPlugin.js +13 -7
- package/dist/components/ui/prompt-editor/plugins/ToolbarActionsPlugin.cjs +64 -3
- package/dist/components/ui/prompt-editor/plugins/ToolbarActionsPlugin.d.ts +6 -2
- package/dist/components/ui/prompt-editor/plugins/ToolbarActionsPlugin.js +65 -4
- package/dist/components/ui/prompt-editor/plugins/ValidateTokensPlugin.cjs +4 -9
- package/dist/components/ui/prompt-editor/plugins/ValidateTokensPlugin.js +4 -9
- package/dist/components/ui/prompt-editor/plugins/ValueSyncPlugin.cjs +10 -5
- package/dist/components/ui/prompt-editor/plugins/ValueSyncPlugin.d.ts +3 -1
- package/dist/components/ui/prompt-editor/plugins/ValueSyncPlugin.js +10 -5
- package/dist/components/ui/prompt-editor/plugins/VariableDropPlugin.cjs +1 -1
- package/dist/components/ui/prompt-editor/plugins/VariableDropPlugin.js +2 -2
- package/dist/components/ui/prompt-editor/plugins/shared/token-nodes.cjs +10 -1
- package/dist/components/ui/prompt-editor/plugins/shared/token-nodes.d.ts +4 -1
- package/dist/components/ui/prompt-editor/plugins/shared/token-nodes.js +8 -2
- package/dist/components/ui/prompt-editor/prompt-editor-config.cjs +69 -0
- package/dist/components/ui/prompt-editor/prompt-editor-config.d.ts +70 -0
- package/dist/components/ui/prompt-editor/prompt-editor-config.js +29 -0
- package/dist/components/ui/prompt-editor/prompt-editor.cjs +198 -88
- package/dist/components/ui/prompt-editor/prompt-editor.d.ts +46 -1
- package/dist/components/ui/prompt-editor/prompt-editor.js +199 -89
- package/dist/components/ui/prompt-editor/types.cjs +5 -5
- package/dist/components/ui/prompt-editor/types.d.ts +18 -2
- package/dist/components/ui/prompt-editor/types.js +5 -5
- package/dist/components/ui/prompt-editor/utils/autocomplete-segments.cjs +10 -5
- package/dist/components/ui/prompt-editor/utils/autocomplete-segments.d.ts +13 -0
- package/dist/components/ui/prompt-editor/utils/autocomplete-segments.js +8 -6
- package/dist/components/ui/prompt-editor/utils/index.cjs +1 -1
- package/dist/components/ui/prompt-editor/utils/index.d.ts +1 -1
- package/dist/components/ui/prompt-editor/utils/index.js +1 -1
- package/dist/components/ui/prompt-editor/utils/insert-token.d.ts +1 -1
- package/dist/components/ui/prompt-editor/utils/rich-serialization.cjs +186 -0
- package/dist/components/ui/prompt-editor/utils/rich-serialization.d.ts +38 -0
- package/dist/components/ui/prompt-editor/utils/rich-serialization.js +140 -0
- package/dist/components/ui/prompt-editor/utils/serialization.cjs +13 -5
- package/dist/components/ui/prompt-editor/utils/serialization.js +14 -6
- package/dist/components/ui/sheet.d.ts +1 -1
- package/dist/components/ui/spinner.d.ts +1 -1
- package/dist/components/ui/switch.d.ts +2 -2
- package/dist/components/ui/toggle-group.d.ts +2 -2
- package/dist/components/ui/toggle.d.ts +2 -2
- package/dist/index.cjs +136 -61
- package/dist/index.d.ts +89 -89
- package/dist/index.js +61 -61
- package/dist/styles.css +15 -0
- package/package.json +3 -1
|
@@ -2,16 +2,18 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Bold, Italic, List, ListOrdered, Maximize2, Strikethrough } from "lucide-react";
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../tooltip.js";
|
|
4
4
|
import { cn } from "../../../../lib/index.js";
|
|
5
|
-
|
|
5
|
+
import { DEFAULT_PROMPT_EDITOR_STRINGS } from "../prompt-editor-config.js";
|
|
6
|
+
const ToolbarButton = ({ icon: Icon, label, disabled, onClick, pressed })=>/*#__PURE__*/ jsxs(Tooltip, {
|
|
6
7
|
children: [
|
|
7
8
|
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
8
9
|
asChild: true,
|
|
9
10
|
children: /*#__PURE__*/ jsx("button", {
|
|
10
11
|
type: "button",
|
|
11
12
|
"aria-label": label,
|
|
13
|
+
"aria-pressed": pressed,
|
|
12
14
|
disabled: disabled,
|
|
13
15
|
onClick: onClick,
|
|
14
|
-
className: cn('inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground', 'hover:bg-accent hover:text-accent-foreground', 'disabled:opacity-50 disabled:pointer-events-none'),
|
|
16
|
+
className: cn('inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded text-muted-foreground', 'hover:bg-accent hover:text-accent-foreground', 'disabled:opacity-50 disabled:pointer-events-none', pressed && 'bg-accent text-accent-foreground'),
|
|
15
17
|
children: /*#__PURE__*/ jsx(Icon, {
|
|
16
18
|
className: "h-3.5 w-3.5"
|
|
17
19
|
})
|
|
@@ -30,14 +32,65 @@ const ToolbarSeparator = ()=>/*#__PURE__*/ jsx("span", {
|
|
|
30
32
|
"aria-hidden": true,
|
|
31
33
|
className: "mx-1 h-4 w-px bg-border/60"
|
|
32
34
|
});
|
|
33
|
-
const EditorToolbar = ({ mode, onModeChange, disabled, error, actionsRef, onFullscreen })=>{
|
|
34
|
-
const isEditMode = 'edit' === mode;
|
|
35
|
+
const EditorToolbar = ({ mode, onModeChange, disabled, error, actionsRef, onFullscreen, showModeToggle = true, trailing, strings = DEFAULT_PROMPT_EDITOR_STRINGS, activeFormats })=>{
|
|
36
|
+
const isEditMode = !showModeToggle || 'edit' === mode;
|
|
35
37
|
const handleFormat = (actionName)=>()=>{
|
|
36
38
|
if (!disabled && isEditMode) {
|
|
37
39
|
const fn = actionsRef?.current?.[actionName];
|
|
38
40
|
if ('function' == typeof fn) fn();
|
|
39
41
|
}
|
|
40
42
|
};
|
|
43
|
+
const formattingCluster = /*#__PURE__*/ jsxs(Fragment, {
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
46
|
+
icon: Bold,
|
|
47
|
+
pressed: activeFormats?.bold,
|
|
48
|
+
label: strings.bold,
|
|
49
|
+
disabled: disabled || !isEditMode,
|
|
50
|
+
onClick: handleFormat('formatBold')
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
53
|
+
icon: Italic,
|
|
54
|
+
pressed: activeFormats?.italic,
|
|
55
|
+
label: strings.italic,
|
|
56
|
+
disabled: disabled || !isEditMode,
|
|
57
|
+
onClick: handleFormat('formatItalic')
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
60
|
+
icon: Strikethrough,
|
|
61
|
+
pressed: activeFormats?.strikethrough,
|
|
62
|
+
label: strings.strikethrough,
|
|
63
|
+
disabled: disabled || !isEditMode,
|
|
64
|
+
onClick: handleFormat('formatStrikethrough')
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ jsx(ToolbarSeparator, {}),
|
|
67
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
68
|
+
icon: ListOrdered,
|
|
69
|
+
pressed: activeFormats?.orderedList,
|
|
70
|
+
label: strings.numberedList,
|
|
71
|
+
disabled: disabled || !isEditMode,
|
|
72
|
+
onClick: handleFormat('formatNumberedList')
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
75
|
+
icon: List,
|
|
76
|
+
pressed: activeFormats?.bulletedList,
|
|
77
|
+
label: strings.bulletedList,
|
|
78
|
+
disabled: disabled || !isEditMode,
|
|
79
|
+
onClick: handleFormat('formatBulletedList')
|
|
80
|
+
}),
|
|
81
|
+
onFullscreen && /*#__PURE__*/ jsxs(Fragment, {
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ jsx(ToolbarSeparator, {}),
|
|
84
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
85
|
+
icon: Maximize2,
|
|
86
|
+
label: strings.expand,
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
onClick: onFullscreen
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
});
|
|
41
94
|
return /*#__PURE__*/ jsxs("div", {
|
|
42
95
|
className: cn('relative flex items-center justify-between gap-1 overflow-hidden rounded-t-md border border-b-0 bg-background px-2 py-1 future:rounded-t-xl future:border-0 future:bg-surface-overlay', error && 'border-error ring-1 ring-error/20 future:ring-error/40'),
|
|
43
96
|
"data-testid": "editor-toolbar",
|
|
@@ -47,77 +100,57 @@ const EditorToolbar = ({ mode, onModeChange, disabled, error, actionsRef, onFull
|
|
|
47
100
|
"data-testid": "editor-toolbar-separator",
|
|
48
101
|
className: "pointer-events-none absolute bottom-0 left-0 h-px w-full bg-border/40"
|
|
49
102
|
}),
|
|
50
|
-
/*#__PURE__*/
|
|
51
|
-
className: "flex items-center gap-1 shrink-0",
|
|
52
|
-
children: /*#__PURE__*/ jsxs("fieldset", {
|
|
53
|
-
"aria-label": "Editor mode",
|
|
54
|
-
className: "m-0 flex items-center rounded-md border-0 bg-muted p-0.5",
|
|
55
|
-
children: [
|
|
56
|
-
/*#__PURE__*/ jsx("button", {
|
|
57
|
-
type: "button",
|
|
58
|
-
"aria-pressed": 'edit' === mode,
|
|
59
|
-
className: cn('rounded px-2 py-0.5 text-[11px] font-semibold transition-colors', 'edit' === mode ? 'bg-primary/20 text-primary' : 'text-foreground hover:bg-accent'),
|
|
60
|
-
disabled: disabled,
|
|
61
|
-
onClick: ()=>onModeChange('edit'),
|
|
62
|
-
children: "Edit"
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ jsx("button", {
|
|
65
|
-
type: "button",
|
|
66
|
-
"aria-pressed": 'preview' === mode,
|
|
67
|
-
className: cn('rounded px-2 py-0.5 text-[11px] font-semibold transition-colors', 'preview' === mode ? 'bg-primary/20 text-primary' : 'text-foreground hover:bg-accent'),
|
|
68
|
-
disabled: disabled,
|
|
69
|
-
onClick: ()=>onModeChange('preview'),
|
|
70
|
-
children: "Preview"
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
})
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ jsxs("div", {
|
|
76
|
-
className: "flex items-center gap-0.5 overflow-hidden",
|
|
103
|
+
showModeToggle ? /*#__PURE__*/ jsxs(Fragment, {
|
|
77
104
|
children: [
|
|
78
|
-
/*#__PURE__*/ jsx(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}),
|
|
103
|
-
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
104
|
-
icon: List,
|
|
105
|
-
label: "Bulleted List",
|
|
106
|
-
disabled: disabled || !isEditMode,
|
|
107
|
-
onClick: handleFormat('formatBulletedList')
|
|
105
|
+
/*#__PURE__*/ jsx("div", {
|
|
106
|
+
className: "flex items-center gap-1 shrink-0",
|
|
107
|
+
children: /*#__PURE__*/ jsxs("fieldset", {
|
|
108
|
+
"aria-label": strings.editorModeLabel,
|
|
109
|
+
className: "m-0 flex items-center rounded-md border-0 bg-muted p-0.5",
|
|
110
|
+
children: [
|
|
111
|
+
/*#__PURE__*/ jsx("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
"aria-pressed": 'edit' === mode,
|
|
114
|
+
className: cn('cursor-pointer rounded px-2 py-0.5 text-[11px] font-semibold transition-colors', 'edit' === mode ? 'bg-primary/20 text-primary' : 'text-foreground hover:bg-accent'),
|
|
115
|
+
disabled: disabled,
|
|
116
|
+
onClick: ()=>onModeChange('edit'),
|
|
117
|
+
children: strings.edit
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ jsx("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
"aria-pressed": 'preview' === mode,
|
|
122
|
+
className: cn('cursor-pointer rounded px-2 py-0.5 text-[11px] font-semibold transition-colors', 'preview' === mode ? 'bg-primary/20 text-primary' : 'text-foreground hover:bg-accent'),
|
|
123
|
+
disabled: disabled,
|
|
124
|
+
onClick: ()=>onModeChange('preview'),
|
|
125
|
+
children: strings.preview
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
})
|
|
108
129
|
}),
|
|
109
|
-
|
|
130
|
+
/*#__PURE__*/ jsxs("div", {
|
|
131
|
+
className: "flex items-center gap-0.5 overflow-hidden",
|
|
110
132
|
children: [
|
|
111
|
-
|
|
112
|
-
/*#__PURE__*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
133
|
+
formattingCluster,
|
|
134
|
+
trailing && /*#__PURE__*/ jsxs(Fragment, {
|
|
135
|
+
children: [
|
|
136
|
+
/*#__PURE__*/ jsx(ToolbarSeparator, {}),
|
|
137
|
+
trailing
|
|
138
|
+
]
|
|
117
139
|
})
|
|
118
140
|
]
|
|
119
141
|
})
|
|
120
142
|
]
|
|
143
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ jsx("div", {
|
|
146
|
+
className: "flex items-center gap-0.5 overflow-hidden",
|
|
147
|
+
children: formattingCluster
|
|
148
|
+
}),
|
|
149
|
+
trailing && /*#__PURE__*/ jsx("div", {
|
|
150
|
+
className: "flex items-center gap-0.5 shrink-0",
|
|
151
|
+
children: trailing
|
|
152
|
+
})
|
|
153
|
+
]
|
|
121
154
|
})
|
|
122
155
|
]
|
|
123
156
|
});
|
|
@@ -40,6 +40,7 @@ const external_dompurify_namespaceObject = require("dompurify");
|
|
|
40
40
|
var external_dompurify_default = /*#__PURE__*/ __webpack_require__.n(external_dompurify_namespaceObject);
|
|
41
41
|
const external_marked_namespaceObject = require("marked");
|
|
42
42
|
const external_react_namespaceObject = require("react");
|
|
43
|
+
const external_prompt_editor_config_cjs_namespaceObject = require("../prompt-editor-config.cjs");
|
|
43
44
|
const external_token_icon_markup_cjs_namespaceObject = require("./token-icon-markup.cjs");
|
|
44
45
|
const marked = new external_marked_namespaceObject.Marked({
|
|
45
46
|
async: false,
|
|
@@ -154,26 +155,30 @@ const PURIFY_CONFIG = {
|
|
|
154
155
|
]
|
|
155
156
|
};
|
|
156
157
|
const escapeHtml = (str)=>str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
157
|
-
const tokensToMarkdownWithPills = (tokens)=>{
|
|
158
|
+
const tokensToMarkdownWithPills = (tokens, previewToken)=>{
|
|
158
159
|
let md = '';
|
|
159
160
|
for (const token of tokens)if ('text' === token.type) md += token.value;
|
|
160
161
|
else {
|
|
161
|
-
const
|
|
162
|
-
|
|
162
|
+
const override = previewToken?.(token);
|
|
163
|
+
const iconSvg = override?.iconSvg ?? (0, external_token_icon_markup_cjs_namespaceObject.buildTokenIconSvgMarkup)(token.type);
|
|
164
|
+
md += `<span class="token-pill">${iconSvg}${escapeHtml(override?.label ?? token.value)}</span>`;
|
|
163
165
|
}
|
|
164
166
|
return md;
|
|
165
167
|
};
|
|
166
168
|
const LINE_HEIGHT = 20;
|
|
167
169
|
const VERTICAL_PADDING = 8;
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
+
const MarkdownPreview = ({ tokens, minRows = 4, previewToken })=>{
|
|
171
|
+
const { strings } = (0, external_prompt_editor_config_cjs_namespaceObject.usePromptEditorConfig)();
|
|
172
|
+
const emptyMessage = strings.nothingToPreview;
|
|
170
173
|
const html = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
171
|
-
if (0 === tokens.length) return `<p class="prompt-editor-preview-empty">${escapeHtml(
|
|
172
|
-
const md = tokensToMarkdownWithPills(tokens);
|
|
174
|
+
if (0 === tokens.length) return `<p class="prompt-editor-preview-empty">${escapeHtml(emptyMessage)}</p>`;
|
|
175
|
+
const md = tokensToMarkdownWithPills(tokens, previewToken);
|
|
173
176
|
const rawHtml = marked.parse(md);
|
|
174
177
|
return external_dompurify_default().sanitize(rawHtml, PURIFY_CONFIG);
|
|
175
178
|
}, [
|
|
176
|
-
tokens
|
|
179
|
+
tokens,
|
|
180
|
+
previewToken,
|
|
181
|
+
emptyMessage
|
|
177
182
|
]);
|
|
178
183
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
179
184
|
children: [
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { type PromptEditorToken } from '../types';
|
|
2
|
+
/** Host override for a variable pill's preview rendering (icon markup and/or label). */
|
|
3
|
+
export interface MarkdownPreviewTokenOverride {
|
|
4
|
+
/** Raw SVG markup for the leading icon (sanitized through the same DOMPurify allowlist). */
|
|
5
|
+
iconSvg?: string;
|
|
6
|
+
/** Label text (HTML-escaped before insertion). Defaults to the token's value. */
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
2
9
|
export interface MarkdownPreviewProps {
|
|
3
10
|
tokens: PromptEditorToken[];
|
|
4
11
|
minRows?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Per-token pill override so preview pills can match the host's edit-mode pills (e.g. flow shows
|
|
14
|
+
* the variable's TYPE icon and `$`-prefixed path, not the token-role icon / raw value).
|
|
15
|
+
*/
|
|
16
|
+
previewToken?: (token: PromptEditorToken) => MarkdownPreviewTokenOverride | undefined;
|
|
5
17
|
}
|
|
6
18
|
/**
|
|
7
19
|
* Renders the prompt tokens as sanitized markdown for preview mode.
|
|
@@ -11,4 +23,4 @@ export interface MarkdownPreviewProps {
|
|
|
11
23
|
* stale/unknown tokens as invalid — preview does not receive the option set and so does not reflect
|
|
12
24
|
* token validity. Switch to edit mode to see validation state.
|
|
13
25
|
*/
|
|
14
|
-
export declare const MarkdownPreview: ({ tokens, minRows }: MarkdownPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare const MarkdownPreview: ({ tokens, minRows, previewToken }: MarkdownPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import dompurify from "dompurify";
|
|
3
3
|
import { Marked } from "marked";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
+
import { usePromptEditorConfig } from "../prompt-editor-config.js";
|
|
5
6
|
import { buildTokenIconSvgMarkup } from "./token-icon-markup.js";
|
|
6
7
|
const marked = new Marked({
|
|
7
8
|
async: false,
|
|
@@ -116,26 +117,30 @@ const PURIFY_CONFIG = {
|
|
|
116
117
|
]
|
|
117
118
|
};
|
|
118
119
|
const escapeHtml = (str)=>str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
119
|
-
const tokensToMarkdownWithPills = (tokens)=>{
|
|
120
|
+
const tokensToMarkdownWithPills = (tokens, previewToken)=>{
|
|
120
121
|
let md = '';
|
|
121
122
|
for (const token of tokens)if ('text' === token.type) md += token.value;
|
|
122
123
|
else {
|
|
123
|
-
const
|
|
124
|
-
|
|
124
|
+
const override = previewToken?.(token);
|
|
125
|
+
const iconSvg = override?.iconSvg ?? buildTokenIconSvgMarkup(token.type);
|
|
126
|
+
md += `<span class="token-pill">${iconSvg}${escapeHtml(override?.label ?? token.value)}</span>`;
|
|
125
127
|
}
|
|
126
128
|
return md;
|
|
127
129
|
};
|
|
128
130
|
const LINE_HEIGHT = 20;
|
|
129
131
|
const VERTICAL_PADDING = 8;
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
+
const MarkdownPreview = ({ tokens, minRows = 4, previewToken })=>{
|
|
133
|
+
const { strings } = usePromptEditorConfig();
|
|
134
|
+
const emptyMessage = strings.nothingToPreview;
|
|
132
135
|
const html = useMemo(()=>{
|
|
133
|
-
if (0 === tokens.length) return `<p class="prompt-editor-preview-empty">${escapeHtml(
|
|
134
|
-
const md = tokensToMarkdownWithPills(tokens);
|
|
136
|
+
if (0 === tokens.length) return `<p class="prompt-editor-preview-empty">${escapeHtml(emptyMessage)}</p>`;
|
|
137
|
+
const md = tokensToMarkdownWithPills(tokens, previewToken);
|
|
135
138
|
const rawHtml = marked.parse(md);
|
|
136
139
|
return dompurify.sanitize(rawHtml, PURIFY_CONFIG);
|
|
137
140
|
}, [
|
|
138
|
-
tokens
|
|
141
|
+
tokens,
|
|
142
|
+
previewToken,
|
|
143
|
+
emptyMessage
|
|
139
144
|
]);
|
|
140
145
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
141
146
|
children: [
|
|
@@ -31,8 +31,24 @@ const external_lucide_react_namespaceObject = require("lucide-react");
|
|
|
31
31
|
const external_react_namespaceObject = require("react");
|
|
32
32
|
const external_react_dom_namespaceObject = require("react-dom");
|
|
33
33
|
const external_command_cjs_namespaceObject = require("../../command.cjs");
|
|
34
|
+
const external_prompt_editor_config_cjs_namespaceObject = require("../prompt-editor-config.cjs");
|
|
34
35
|
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
35
36
|
const autocomplete_segments_cjs_namespaceObject = require("../utils/autocomplete-segments.cjs");
|
|
37
|
+
const renderInsertFreeForm = (label, path)=>{
|
|
38
|
+
const [before, after = ''] = label.includes('{path}') ? label.split('{path}', 2) : [
|
|
39
|
+
`${label} `
|
|
40
|
+
];
|
|
41
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
42
|
+
children: [
|
|
43
|
+
before,
|
|
44
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
45
|
+
className: "font-medium",
|
|
46
|
+
children: path
|
|
47
|
+
}),
|
|
48
|
+
after
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
36
52
|
const MENU_WIDTH = 320;
|
|
37
53
|
const VIEWPORT_MARGIN = 8;
|
|
38
54
|
const OPTION_ICON = {
|
|
@@ -49,6 +65,7 @@ function resolvePortalTarget(contextElement) {
|
|
|
49
65
|
const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options, onSelect, onCommitFreeForm, onClose })=>{
|
|
50
66
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
51
67
|
const [search, setSearch] = (0, external_react_namespaceObject.useState)(initialSearch);
|
|
68
|
+
const { strings } = (0, external_prompt_editor_config_cjs_namespaceObject.usePromptEditorConfig)();
|
|
52
69
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
53
70
|
if (open) setSearch(initialSearch);
|
|
54
71
|
}, [
|
|
@@ -132,13 +149,13 @@ const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options,
|
|
|
132
149
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandInput, {
|
|
133
150
|
value: search,
|
|
134
151
|
onValueChange: setSearch,
|
|
135
|
-
placeholder:
|
|
152
|
+
placeholder: strings.searchVariablesPlaceholder,
|
|
136
153
|
autoFocus: true
|
|
137
154
|
}),
|
|
138
155
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandList, {
|
|
139
156
|
children: [
|
|
140
157
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandEmpty, {
|
|
141
|
-
children:
|
|
158
|
+
children: strings.noVariablesFound
|
|
142
159
|
}),
|
|
143
160
|
options.map((option)=>{
|
|
144
161
|
const Icon = OPTION_ICON[option.type];
|
|
@@ -155,7 +172,7 @@ const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options,
|
|
|
155
172
|
}),
|
|
156
173
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
157
174
|
className: "ml-auto pl-2 text-xs text-muted-foreground",
|
|
158
|
-
children: (0, external_types_cjs_namespaceObject.getPromptEditorTokenTypeLabel)(option.type)
|
|
175
|
+
children: (0, external_types_cjs_namespaceObject.getPromptEditorTokenTypeLabel)(option.type, strings)
|
|
159
176
|
})
|
|
160
177
|
]
|
|
161
178
|
}, `${option.type}:${option.value}`);
|
|
@@ -167,15 +184,9 @@ const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options,
|
|
|
167
184
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Variable, {
|
|
168
185
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
169
186
|
}),
|
|
170
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
187
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
171
188
|
className: "truncate",
|
|
172
|
-
children:
|
|
173
|
-
"Insert ",
|
|
174
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
175
|
-
className: "font-medium",
|
|
176
|
-
children: freeFormPath
|
|
177
|
-
})
|
|
178
|
-
]
|
|
189
|
+
children: renderInsertFreeForm(strings.insertFreeForm, freeFormPath)
|
|
179
190
|
})
|
|
180
191
|
]
|
|
181
192
|
})
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Database, Paperclip, SquareFunction, Variable } from "lucide-react";
|
|
3
3
|
import { useEffect, useReducer, useRef, useState } from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "../../command.js";
|
|
6
|
+
import { usePromptEditorConfig } from "../prompt-editor-config.js";
|
|
6
7
|
import { getPromptEditorTokenTypeLabel } from "../types.js";
|
|
7
8
|
import { VARIABLE_PATH_REGEX } from "../utils/autocomplete-segments.js";
|
|
9
|
+
const renderInsertFreeForm = (label, path)=>{
|
|
10
|
+
const [before, after = ''] = label.includes('{path}') ? label.split('{path}', 2) : [
|
|
11
|
+
`${label} `
|
|
12
|
+
];
|
|
13
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
14
|
+
children: [
|
|
15
|
+
before,
|
|
16
|
+
/*#__PURE__*/ jsx("span", {
|
|
17
|
+
className: "font-medium",
|
|
18
|
+
children: path
|
|
19
|
+
}),
|
|
20
|
+
after
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
8
24
|
const MENU_WIDTH = 320;
|
|
9
25
|
const VIEWPORT_MARGIN = 8;
|
|
10
26
|
const OPTION_ICON = {
|
|
@@ -21,6 +37,7 @@ function resolvePortalTarget(contextElement) {
|
|
|
21
37
|
const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options, onSelect, onCommitFreeForm, onClose })=>{
|
|
22
38
|
const containerRef = useRef(null);
|
|
23
39
|
const [search, setSearch] = useState(initialSearch);
|
|
40
|
+
const { strings } = usePromptEditorConfig();
|
|
24
41
|
useEffect(()=>{
|
|
25
42
|
if (open) setSearch(initialSearch);
|
|
26
43
|
}, [
|
|
@@ -104,13 +121,13 @@ const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options,
|
|
|
104
121
|
/*#__PURE__*/ jsx(CommandInput, {
|
|
105
122
|
value: search,
|
|
106
123
|
onValueChange: setSearch,
|
|
107
|
-
placeholder:
|
|
124
|
+
placeholder: strings.searchVariablesPlaceholder,
|
|
108
125
|
autoFocus: true
|
|
109
126
|
}),
|
|
110
127
|
/*#__PURE__*/ jsxs(CommandList, {
|
|
111
128
|
children: [
|
|
112
129
|
/*#__PURE__*/ jsx(CommandEmpty, {
|
|
113
|
-
children:
|
|
130
|
+
children: strings.noVariablesFound
|
|
114
131
|
}),
|
|
115
132
|
options.map((option)=>{
|
|
116
133
|
const Icon = OPTION_ICON[option.type];
|
|
@@ -127,7 +144,7 @@ const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options,
|
|
|
127
144
|
}),
|
|
128
145
|
/*#__PURE__*/ jsx("span", {
|
|
129
146
|
className: "ml-auto pl-2 text-xs text-muted-foreground",
|
|
130
|
-
children: getPromptEditorTokenTypeLabel(option.type)
|
|
147
|
+
children: getPromptEditorTokenTypeLabel(option.type, strings)
|
|
131
148
|
})
|
|
132
149
|
]
|
|
133
150
|
}, `${option.type}:${option.value}`);
|
|
@@ -139,15 +156,9 @@ const PromptEditorAutocompleteMenu = ({ open, anchorEl, initialSearch, options,
|
|
|
139
156
|
/*#__PURE__*/ jsx(Variable, {
|
|
140
157
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
141
158
|
}),
|
|
142
|
-
/*#__PURE__*/
|
|
159
|
+
/*#__PURE__*/ jsx("span", {
|
|
143
160
|
className: "truncate",
|
|
144
|
-
children:
|
|
145
|
-
"Insert ",
|
|
146
|
-
/*#__PURE__*/ jsx("span", {
|
|
147
|
-
className: "font-medium",
|
|
148
|
-
children: freeFormPath
|
|
149
|
-
})
|
|
150
|
-
]
|
|
161
|
+
children: renderInsertFreeForm(strings.insertFreeForm, freeFormPath)
|
|
151
162
|
})
|
|
152
163
|
]
|
|
153
164
|
})
|
|
@@ -27,8 +27,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
TokenPill: ()=>TokenPill
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const external_react_namespaceObject = require("react");
|
|
31
30
|
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const external_prompt_editor_config_cjs_namespaceObject = require("../prompt-editor-config.cjs");
|
|
32
33
|
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
33
34
|
const TOKEN_TYPE_ICON = {
|
|
34
35
|
input: external_lucide_react_namespaceObject.Variable,
|
|
@@ -38,6 +39,7 @@ const TOKEN_TYPE_ICON = {
|
|
|
38
39
|
text: external_lucide_react_namespaceObject.Variable
|
|
39
40
|
};
|
|
40
41
|
const TokenPillBase = ({ value, tokenType, onRemove, diffType, readonly, isInvalid, isSelected, onMouseDown })=>{
|
|
42
|
+
const { strings } = (0, external_prompt_editor_config_cjs_namespaceObject.usePromptEditorConfig)();
|
|
41
43
|
const PROMPT_EDITOR_TOKEN_COLORS = (0, external_types_cjs_namespaceObject.getPromptEditorTokenColors)();
|
|
42
44
|
const colors = isInvalid && !diffType ? PROMPT_EDITOR_TOKEN_COLORS.invalid : PROMPT_EDITOR_TOKEN_COLORS.valid;
|
|
43
45
|
const Icon = TOKEN_TYPE_ICON[tokenType];
|
|
@@ -84,7 +86,7 @@ const TokenPillBase = ({ value, tokenType, onRemove, diffType, readonly, isInval
|
|
|
84
86
|
}),
|
|
85
87
|
!readonly && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
86
88
|
type: "button",
|
|
87
|
-
"aria-label":
|
|
89
|
+
"aria-label": strings.removeToken,
|
|
88
90
|
className: "inline-flex items-center justify-center p-px border-0 bg-transparent cursor-pointer rounded-[2px] w-4 h-4",
|
|
89
91
|
style: {
|
|
90
92
|
color: colors.text
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "react";
|
|
3
2
|
import { Database, Paperclip, SquareFunction, Variable } from "lucide-react";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { usePromptEditorConfig } from "../prompt-editor-config.js";
|
|
4
5
|
import { getPromptEditorTokenColors } from "../types.js";
|
|
5
6
|
const TOKEN_TYPE_ICON = {
|
|
6
7
|
input: Variable,
|
|
@@ -10,6 +11,7 @@ const TOKEN_TYPE_ICON = {
|
|
|
10
11
|
text: Variable
|
|
11
12
|
};
|
|
12
13
|
const TokenPillBase = ({ value, tokenType, onRemove, diffType, readonly, isInvalid, isSelected, onMouseDown })=>{
|
|
14
|
+
const { strings } = usePromptEditorConfig();
|
|
13
15
|
const PROMPT_EDITOR_TOKEN_COLORS = getPromptEditorTokenColors();
|
|
14
16
|
const colors = isInvalid && !diffType ? PROMPT_EDITOR_TOKEN_COLORS.invalid : PROMPT_EDITOR_TOKEN_COLORS.valid;
|
|
15
17
|
const Icon = TOKEN_TYPE_ICON[tokenType];
|
|
@@ -56,7 +58,7 @@ const TokenPillBase = ({ value, tokenType, onRemove, diffType, readonly, isInval
|
|
|
56
58
|
}),
|
|
57
59
|
!readonly && /*#__PURE__*/ jsx("button", {
|
|
58
60
|
type: "button",
|
|
59
|
-
"aria-label":
|
|
61
|
+
"aria-label": strings.removeToken,
|
|
60
62
|
className: "inline-flex items-center justify-center p-px border-0 bg-transparent cursor-pointer rounded-[2px] w-4 h-4",
|
|
61
63
|
style: {
|
|
62
64
|
color: colors.text
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
TokenPillSlot: ()=>TokenPillSlot
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_prompt_editor_config_cjs_namespaceObject = require("../prompt-editor-config.cjs");
|
|
31
|
+
const external_TokenPillWithTooltip_cjs_namespaceObject = require("./TokenPillWithTooltip.cjs");
|
|
32
|
+
const TokenPillSlot = (props)=>{
|
|
33
|
+
const { renderTokenPill } = (0, external_prompt_editor_config_cjs_namespaceObject.usePromptEditorConfig)();
|
|
34
|
+
const { value, tokenType, nodeKey, diffType, readonly, isInvalid, onRemove } = props;
|
|
35
|
+
const defaultPill = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_TokenPillWithTooltip_cjs_namespaceObject.TokenPillWithTooltip, {
|
|
36
|
+
value: value,
|
|
37
|
+
tokenType: tokenType,
|
|
38
|
+
nodeKey: nodeKey,
|
|
39
|
+
diffType: diffType,
|
|
40
|
+
readonly: readonly,
|
|
41
|
+
isInvalid: isInvalid,
|
|
42
|
+
onRemove: onRemove
|
|
43
|
+
});
|
|
44
|
+
if (!renderTokenPill) return defaultPill;
|
|
45
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
46
|
+
children: renderTokenPill({
|
|
47
|
+
...props,
|
|
48
|
+
defaultPill
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.TokenPillSlot = __webpack_exports__.TokenPillSlot;
|
|
53
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
54
|
+
"TokenPillSlot"
|
|
55
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
56
|
+
Object.defineProperty(exports, '__esModule', {
|
|
57
|
+
value: true
|
|
58
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptEditorTokenPillSlotProps } from '../prompt-editor-config';
|
|
2
|
+
/**
|
|
3
|
+
* Indirection between a token decorator node and its rendered pill. Renders the built-in
|
|
4
|
+
* `TokenPillWithTooltip` unless the host supplied `renderTokenPill` on the editor, in which case
|
|
5
|
+
* that renderer decides (and receives the built-in pill as `defaultPill` so it can decorate it).
|
|
6
|
+
*/
|
|
7
|
+
export declare const TokenPillSlot: (props: Omit<PromptEditorTokenPillSlotProps, "defaultPill">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { usePromptEditorConfig } from "../prompt-editor-config.js";
|
|
3
|
+
import { TokenPillWithTooltip } from "./TokenPillWithTooltip.js";
|
|
4
|
+
const TokenPillSlot = (props)=>{
|
|
5
|
+
const { renderTokenPill } = usePromptEditorConfig();
|
|
6
|
+
const { value, tokenType, nodeKey, diffType, readonly, isInvalid, onRemove } = props;
|
|
7
|
+
const defaultPill = /*#__PURE__*/ jsx(TokenPillWithTooltip, {
|
|
8
|
+
value: value,
|
|
9
|
+
tokenType: tokenType,
|
|
10
|
+
nodeKey: nodeKey,
|
|
11
|
+
diffType: diffType,
|
|
12
|
+
readonly: readonly,
|
|
13
|
+
isInvalid: isInvalid,
|
|
14
|
+
onRemove: onRemove
|
|
15
|
+
});
|
|
16
|
+
if (!renderTokenPill) return defaultPill;
|
|
17
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
18
|
+
children: renderTokenPill({
|
|
19
|
+
...props,
|
|
20
|
+
defaultPill
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export { TokenPillSlot };
|