@uipath/apollo-wind 2.46.0 → 2.47.1
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/field-renderer.cjs +9 -5
- package/dist/components/forms/field-renderer.js +9 -5
- package/dist/components/forms/form-state-viewer.cjs +8 -4
- package/dist/components/forms/form-state-viewer.d.ts +1 -1
- package/dist/components/forms/form-state-viewer.js +8 -4
- package/dist/components/forms/metadata-form.cjs +129 -60
- package/dist/components/forms/metadata-form.js +121 -62
- 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 +34 -34
- 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
|
@@ -27,16 +27,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
TokenPillWithTooltip: ()=>TokenPillWithTooltip
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const external_react_namespaceObject = require("react");
|
|
31
30
|
const LexicalComposerContext_namespaceObject = require("@lexical/react/LexicalComposerContext");
|
|
32
31
|
const useLexicalNodeSelection_namespaceObject = require("@lexical/react/useLexicalNodeSelection");
|
|
33
32
|
const external_lexical_namespaceObject = require("lexical");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
34
|
const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
|
|
35
|
-
const
|
|
35
|
+
const external_prompt_editor_config_cjs_namespaceObject = require("../prompt-editor-config.cjs");
|
|
36
36
|
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
37
|
+
const external_TokenPill_cjs_namespaceObject = require("./TokenPill.cjs");
|
|
37
38
|
const TokenPillWithTooltip = ({ nodeKey, ...props })=>{
|
|
38
39
|
const { value: pillValue, tokenType, readonly, diffType, isInvalid, onRemove } = props;
|
|
39
|
-
const
|
|
40
|
+
const { strings } = (0, external_prompt_editor_config_cjs_namespaceObject.usePromptEditorConfig)();
|
|
41
|
+
const typeLabel = (0, external_types_cjs_namespaceObject.getPromptEditorTokenTypeLabel)(tokenType, strings);
|
|
40
42
|
const [editor] = (0, LexicalComposerContext_namespaceObject.useLexicalComposerContext)();
|
|
41
43
|
const [isSelected] = (0, useLexicalNodeSelection_namespaceObject.useLexicalNodeSelection)(nodeKey);
|
|
42
44
|
const handleMouseDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
@@ -102,14 +104,11 @@ const TokenPillWithTooltip = ({ nodeKey, ...props })=>{
|
|
|
102
104
|
children: [
|
|
103
105
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
104
106
|
className: "font-medium",
|
|
105
|
-
children:
|
|
107
|
+
children: strings.invalidTokenTitle
|
|
106
108
|
}),
|
|
107
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
109
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
108
110
|
className: "break-words opacity-80",
|
|
109
|
-
children:
|
|
110
|
-
pillValue,
|
|
111
|
-
" isn't available in this scope. Fix or remove this reference before publishing."
|
|
112
|
-
]
|
|
111
|
+
children: strings.invalidTokenDescription.replace('{path}', pillValue)
|
|
113
112
|
})
|
|
114
113
|
]
|
|
115
114
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo } from "react";
|
|
3
2
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
3
|
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
5
4
|
import { $createNodeSelection, $setSelection } from "lexical";
|
|
5
|
+
import { useCallback, useMemo } from "react";
|
|
6
6
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../tooltip.js";
|
|
7
|
-
import {
|
|
7
|
+
import { usePromptEditorConfig } from "../prompt-editor-config.js";
|
|
8
8
|
import { getPromptEditorTokenTypeLabel } from "../types.js";
|
|
9
|
+
import { TokenPill } from "./TokenPill.js";
|
|
9
10
|
const TokenPillWithTooltip = ({ nodeKey, ...props })=>{
|
|
10
11
|
const { value: pillValue, tokenType, readonly, diffType, isInvalid, onRemove } = props;
|
|
11
|
-
const
|
|
12
|
+
const { strings } = usePromptEditorConfig();
|
|
13
|
+
const typeLabel = getPromptEditorTokenTypeLabel(tokenType, strings);
|
|
12
14
|
const [editor] = useLexicalComposerContext();
|
|
13
15
|
const [isSelected] = useLexicalNodeSelection(nodeKey);
|
|
14
16
|
const handleMouseDown = useCallback((e)=>{
|
|
@@ -74,14 +76,11 @@ const TokenPillWithTooltip = ({ nodeKey, ...props })=>{
|
|
|
74
76
|
children: [
|
|
75
77
|
/*#__PURE__*/ jsx("div", {
|
|
76
78
|
className: "font-medium",
|
|
77
|
-
children:
|
|
79
|
+
children: strings.invalidTokenTitle
|
|
78
80
|
}),
|
|
79
|
-
/*#__PURE__*/
|
|
81
|
+
/*#__PURE__*/ jsx("div", {
|
|
80
82
|
className: "break-words opacity-80",
|
|
81
|
-
children:
|
|
82
|
-
pillValue,
|
|
83
|
-
" isn't available in this scope. Fix or remove this reference before publishing."
|
|
84
|
-
]
|
|
83
|
+
children: strings.invalidTokenDescription.replace('{path}', pillValue)
|
|
85
84
|
})
|
|
86
85
|
]
|
|
87
86
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./components/TokenPill" (module) {
|
|
4
|
+
module.exports = require("./components/TokenPill.cjs");
|
|
5
|
+
},
|
|
6
|
+
"./components/TokenPillWithTooltip" (module) {
|
|
7
|
+
module.exports = require("./components/TokenPillWithTooltip.cjs");
|
|
8
|
+
},
|
|
9
|
+
"./nodes" (module) {
|
|
10
|
+
module.exports = require("./nodes/index.cjs");
|
|
11
|
+
},
|
|
12
|
+
"./plugins/VariableDropPlugin" (module) {
|
|
13
|
+
module.exports = require("./plugins/VariableDropPlugin.cjs");
|
|
14
|
+
},
|
|
15
|
+
"./plugins/shared/token-nodes" (module) {
|
|
16
|
+
module.exports = require("./plugins/shared/token-nodes.cjs");
|
|
17
|
+
},
|
|
18
|
+
"./prompt-editor-config" (module) {
|
|
19
|
+
module.exports = require("./prompt-editor-config.cjs");
|
|
20
|
+
},
|
|
21
|
+
"./prompt-editor?d9b9" (module) {
|
|
22
|
+
module.exports = require("./prompt-editor.cjs");
|
|
23
|
+
},
|
|
24
|
+
"./types" (module) {
|
|
25
|
+
module.exports = require("./types.cjs");
|
|
26
|
+
},
|
|
27
|
+
"./utils/autocomplete-segments" (module) {
|
|
28
|
+
module.exports = require("./utils/autocomplete-segments.cjs");
|
|
29
|
+
},
|
|
30
|
+
"./utils/insert-token" (module) {
|
|
31
|
+
module.exports = require("./utils/insert-token.cjs");
|
|
32
|
+
},
|
|
33
|
+
"./utils/rich-serialization" (module) {
|
|
34
|
+
module.exports = require("./utils/rich-serialization.cjs");
|
|
35
|
+
},
|
|
36
|
+
"./utils/serialization" (module) {
|
|
37
|
+
module.exports = require("./utils/serialization.cjs");
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var __webpack_module_cache__ = {};
|
|
41
|
+
function __webpack_require__(moduleId) {
|
|
42
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
43
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
44
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
45
|
+
exports: {}
|
|
46
|
+
};
|
|
47
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
48
|
+
return module.exports;
|
|
49
|
+
}
|
|
50
|
+
(()=>{
|
|
51
|
+
__webpack_require__.n = (module)=>{
|
|
52
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
53
|
+
__webpack_require__.d(getter, {
|
|
54
|
+
a: getter
|
|
55
|
+
});
|
|
56
|
+
return getter;
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
3
59
|
(()=>{
|
|
4
60
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
61
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -22,18 +78,105 @@ var __webpack_require__ = {};
|
|
|
22
78
|
};
|
|
23
79
|
})();
|
|
24
80
|
var __webpack_exports__ = {};
|
|
25
|
-
|
|
26
|
-
__webpack_require__.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
81
|
+
(()=>{
|
|
82
|
+
__webpack_require__.r(__webpack_exports__);
|
|
83
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
84
|
+
$insertTokenAtCursor: ()=>_utils_insert_token__rspack_import_9.$insertTokenAtCursor,
|
|
85
|
+
DEFAULT_PROMPT_EDITOR_STRINGS: ()=>_prompt_editor_config__rspack_import_6.DEFAULT_PROMPT_EDITOR_STRINGS,
|
|
86
|
+
PROMPT_EDITOR_RICH_TRANSFORMERS: ()=>_utils_rich_serialization__rspack_import_10.PROMPT_EDITOR_RICH_TRANSFORMERS,
|
|
87
|
+
PromptEditor: ()=>_prompt_editor__rspack_import_5.PromptEditor,
|
|
88
|
+
TokenPill: ()=>_components_TokenPill__rspack_import_0.TokenPill,
|
|
89
|
+
TokenPillWithTooltip: ()=>_components_TokenPillWithTooltip__rspack_import_1.TokenPillWithTooltip,
|
|
90
|
+
VARIABLE_DRAG_MIME: ()=>_plugins_VariableDropPlugin__rspack_import_4.VARIABLE_DRAG_MIME,
|
|
91
|
+
VARIABLE_PATH_REGEX: ()=>_utils_autocomplete_segments__rspack_import_8.VARIABLE_PATH_REGEX,
|
|
92
|
+
WORD_JOINER: ()=>_utils_serialization__rspack_import_11.WORD_JOINER,
|
|
93
|
+
createTokenNodeForOption: ()=>_utils_insert_token__rspack_import_9.createTokenNodeForOption,
|
|
94
|
+
getAllPromptTokenNodes: ()=>_plugins_shared_token_nodes__rspack_import_3.getAllPromptTokenNodes,
|
|
95
|
+
getEditorTokens: ()=>_utils_serialization__rspack_import_11.getEditorTokens,
|
|
96
|
+
getPromptEditorTokenColors: ()=>_types__rspack_import_7.getPromptEditorTokenColors,
|
|
97
|
+
getPromptEditorTokenTypeLabel: ()=>_types__rspack_import_7.getPromptEditorTokenTypeLabel,
|
|
98
|
+
inferTokenTypeFromPath: ()=>_utils_autocomplete_segments__rspack_import_8.inferTokenTypeFromPath,
|
|
99
|
+
isPromptTokenNode: ()=>_plugins_shared_token_nodes__rspack_import_3.isPromptTokenNode,
|
|
100
|
+
normalizeRichTextTokens: ()=>_utils_rich_serialization__rspack_import_10.normalizeRichTextTokens,
|
|
101
|
+
normalizeVariablePath: ()=>_utils_autocomplete_segments__rspack_import_8.normalizeVariablePath,
|
|
102
|
+
setEditorTokens: ()=>_utils_serialization__rspack_import_11.setEditorTokens
|
|
103
|
+
});
|
|
104
|
+
var _components_TokenPill__rspack_import_0 = __webpack_require__("./components/TokenPill");
|
|
105
|
+
var _components_TokenPillWithTooltip__rspack_import_1 = __webpack_require__("./components/TokenPillWithTooltip");
|
|
106
|
+
var _nodes__rspack_import_2 = __webpack_require__("./nodes");
|
|
107
|
+
var __rspack_reexport = {};
|
|
108
|
+
for(const __rspack_import_key in _nodes__rspack_import_2)if ([
|
|
109
|
+
"TokenPill",
|
|
110
|
+
"DEFAULT_PROMPT_EDITOR_STRINGS",
|
|
111
|
+
"getEditorTokens",
|
|
112
|
+
"PromptEditor",
|
|
113
|
+
"getPromptEditorTokenColors",
|
|
114
|
+
"VARIABLE_DRAG_MIME",
|
|
115
|
+
"getPromptEditorTokenTypeLabel",
|
|
116
|
+
"$insertTokenAtCursor",
|
|
117
|
+
"VARIABLE_PATH_REGEX",
|
|
118
|
+
"inferTokenTypeFromPath",
|
|
119
|
+
"normalizeRichTextTokens",
|
|
120
|
+
"getAllPromptTokenNodes",
|
|
121
|
+
"default",
|
|
122
|
+
"normalizeVariablePath",
|
|
123
|
+
"PROMPT_EDITOR_RICH_TRANSFORMERS",
|
|
124
|
+
"setEditorTokens",
|
|
125
|
+
"TokenPillWithTooltip",
|
|
126
|
+
"isPromptTokenNode",
|
|
127
|
+
"createTokenNodeForOption",
|
|
128
|
+
"WORD_JOINER"
|
|
129
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_nodes__rspack_import_2[__rspack_import_key];
|
|
130
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
131
|
+
var _plugins_shared_token_nodes__rspack_import_3 = __webpack_require__("./plugins/shared/token-nodes");
|
|
132
|
+
var _plugins_VariableDropPlugin__rspack_import_4 = __webpack_require__("./plugins/VariableDropPlugin");
|
|
133
|
+
var _prompt_editor__rspack_import_5 = __webpack_require__("./prompt-editor?d9b9");
|
|
134
|
+
var _prompt_editor_config__rspack_import_6 = __webpack_require__("./prompt-editor-config");
|
|
135
|
+
var _types__rspack_import_7 = __webpack_require__("./types");
|
|
136
|
+
var _utils_autocomplete_segments__rspack_import_8 = __webpack_require__("./utils/autocomplete-segments");
|
|
137
|
+
var _utils_insert_token__rspack_import_9 = __webpack_require__("./utils/insert-token");
|
|
138
|
+
var _utils_rich_serialization__rspack_import_10 = __webpack_require__("./utils/rich-serialization");
|
|
139
|
+
var _utils_serialization__rspack_import_11 = __webpack_require__("./utils/serialization");
|
|
140
|
+
})();
|
|
141
|
+
exports.$insertTokenAtCursor = __webpack_exports__.$insertTokenAtCursor;
|
|
142
|
+
exports.DEFAULT_PROMPT_EDITOR_STRINGS = __webpack_exports__.DEFAULT_PROMPT_EDITOR_STRINGS;
|
|
143
|
+
exports.PROMPT_EDITOR_RICH_TRANSFORMERS = __webpack_exports__.PROMPT_EDITOR_RICH_TRANSFORMERS;
|
|
32
144
|
exports.PromptEditor = __webpack_exports__.PromptEditor;
|
|
145
|
+
exports.TokenPill = __webpack_exports__.TokenPill;
|
|
146
|
+
exports.TokenPillWithTooltip = __webpack_exports__.TokenPillWithTooltip;
|
|
33
147
|
exports.VARIABLE_DRAG_MIME = __webpack_exports__.VARIABLE_DRAG_MIME;
|
|
148
|
+
exports.VARIABLE_PATH_REGEX = __webpack_exports__.VARIABLE_PATH_REGEX;
|
|
149
|
+
exports.WORD_JOINER = __webpack_exports__.WORD_JOINER;
|
|
150
|
+
exports.createTokenNodeForOption = __webpack_exports__.createTokenNodeForOption;
|
|
151
|
+
exports.getAllPromptTokenNodes = __webpack_exports__.getAllPromptTokenNodes;
|
|
152
|
+
exports.getEditorTokens = __webpack_exports__.getEditorTokens;
|
|
153
|
+
exports.getPromptEditorTokenColors = __webpack_exports__.getPromptEditorTokenColors;
|
|
154
|
+
exports.getPromptEditorTokenTypeLabel = __webpack_exports__.getPromptEditorTokenTypeLabel;
|
|
155
|
+
exports.inferTokenTypeFromPath = __webpack_exports__.inferTokenTypeFromPath;
|
|
156
|
+
exports.isPromptTokenNode = __webpack_exports__.isPromptTokenNode;
|
|
157
|
+
exports.normalizeRichTextTokens = __webpack_exports__.normalizeRichTextTokens;
|
|
158
|
+
exports.normalizeVariablePath = __webpack_exports__.normalizeVariablePath;
|
|
159
|
+
exports.setEditorTokens = __webpack_exports__.setEditorTokens;
|
|
34
160
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
161
|
+
"$insertTokenAtCursor",
|
|
162
|
+
"DEFAULT_PROMPT_EDITOR_STRINGS",
|
|
163
|
+
"PROMPT_EDITOR_RICH_TRANSFORMERS",
|
|
35
164
|
"PromptEditor",
|
|
36
|
-
"
|
|
165
|
+
"TokenPill",
|
|
166
|
+
"TokenPillWithTooltip",
|
|
167
|
+
"VARIABLE_DRAG_MIME",
|
|
168
|
+
"VARIABLE_PATH_REGEX",
|
|
169
|
+
"WORD_JOINER",
|
|
170
|
+
"createTokenNodeForOption",
|
|
171
|
+
"getAllPromptTokenNodes",
|
|
172
|
+
"getEditorTokens",
|
|
173
|
+
"getPromptEditorTokenColors",
|
|
174
|
+
"getPromptEditorTokenTypeLabel",
|
|
175
|
+
"inferTokenTypeFromPath",
|
|
176
|
+
"isPromptTokenNode",
|
|
177
|
+
"normalizeRichTextTokens",
|
|
178
|
+
"normalizeVariablePath",
|
|
179
|
+
"setEditorTokens"
|
|
37
180
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
38
181
|
Object.defineProperty(exports, '__esModule', {
|
|
39
182
|
value: true
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export type { MarkdownPreviewTokenOverride } from './components/MarkdownPreview';
|
|
2
|
+
export type { PromptEditorAutocompleteMenuProps } from './components/PromptEditorAutocompleteMenu';
|
|
3
|
+
export { TokenPill, type TokenPillProps } from './components/TokenPill';
|
|
4
|
+
export { TokenPillWithTooltip, type TokenPillWithTooltipProps, } from './components/TokenPillWithTooltip';
|
|
5
|
+
export * from './nodes';
|
|
6
|
+
export { getAllPromptTokenNodes, isPromptTokenNode, type PromptTokenNode, } from './plugins/shared/token-nodes';
|
|
1
7
|
export { VARIABLE_DRAG_MIME } from './plugins/VariableDropPlugin';
|
|
2
8
|
export type { PromptEditorProps, PromptEditorRef } from './prompt-editor';
|
|
3
9
|
export { PromptEditor } from './prompt-editor';
|
|
4
|
-
export
|
|
10
|
+
export { DEFAULT_PROMPT_EDITOR_STRINGS, type PromptEditorRenderTokenPill, type PromptEditorStrings, type PromptEditorTokenPillSlotProps, } from './prompt-editor-config';
|
|
11
|
+
export type { PromptEditorAutoCompleteOption, PromptEditorDiffType, PromptEditorMode, PromptEditorToken, PromptEditorTokenType, PromptEditorToolbarActiveFormats, } from './types';
|
|
12
|
+
export { getPromptEditorTokenColors, getPromptEditorTokenTypeLabel, } from './types';
|
|
13
|
+
export { inferTokenTypeFromPath, normalizeVariablePath, VARIABLE_PATH_REGEX, } from './utils/autocomplete-segments';
|
|
14
|
+
export { $insertTokenAtCursor, createTokenNodeForOption, } from './utils/insert-token';
|
|
15
|
+
export { normalizeRichTextTokens, PROMPT_EDITOR_RICH_TRANSFORMERS, } from './utils/rich-serialization';
|
|
16
|
+
export { getEditorTokens, setEditorTokens, WORD_JOINER, } from './utils/serialization';
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { TokenPill } from "./components/TokenPill.js";
|
|
2
|
+
import { TokenPillWithTooltip } from "./components/TokenPillWithTooltip.js";
|
|
3
|
+
import { getAllPromptTokenNodes, isPromptTokenNode } from "./plugins/shared/token-nodes.js";
|
|
1
4
|
import { VARIABLE_DRAG_MIME } from "./plugins/VariableDropPlugin.js";
|
|
2
5
|
import { PromptEditor } from "./prompt-editor.js";
|
|
3
|
-
|
|
6
|
+
import { DEFAULT_PROMPT_EDITOR_STRINGS } from "./prompt-editor-config.js";
|
|
7
|
+
import { getPromptEditorTokenColors, getPromptEditorTokenTypeLabel } from "./types.js";
|
|
8
|
+
import { VARIABLE_PATH_REGEX, inferTokenTypeFromPath, normalizeVariablePath } from "./utils/autocomplete-segments.js";
|
|
9
|
+
import { $insertTokenAtCursor, createTokenNodeForOption } from "./utils/insert-token.js";
|
|
10
|
+
import { PROMPT_EDITOR_RICH_TRANSFORMERS, normalizeRichTextTokens } from "./utils/rich-serialization.js";
|
|
11
|
+
import { WORD_JOINER, getEditorTokens, setEditorTokens } from "./utils/serialization.js";
|
|
12
|
+
export * from "./nodes/index.js";
|
|
13
|
+
export { $insertTokenAtCursor, DEFAULT_PROMPT_EDITOR_STRINGS, PROMPT_EDITOR_RICH_TRANSFORMERS, PromptEditor, TokenPill, TokenPillWithTooltip, VARIABLE_DRAG_MIME, VARIABLE_PATH_REGEX, WORD_JOINER, createTokenNodeForOption, getAllPromptTokenNodes, getEditorTokens, getPromptEditorTokenColors, getPromptEditorTokenTypeLabel, inferTokenTypeFromPath, isPromptTokenNode, normalizeRichTextTokens, normalizeVariablePath, setEditorTokens };
|
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
});
|
|
31
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
32
|
const external_lexical_namespaceObject = require("lexical");
|
|
33
|
-
const
|
|
33
|
+
const TokenPillSlot_cjs_namespaceObject = require("../components/TokenPillSlot.cjs");
|
|
34
34
|
class InputTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
35
35
|
__value;
|
|
36
36
|
__diffType;
|
|
@@ -115,7 +115,7 @@ class InputTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
|
115
115
|
}
|
|
116
116
|
decorate(editor) {
|
|
117
117
|
const readonly = !editor.isEditable();
|
|
118
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
118
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TokenPillSlot_cjs_namespaceObject.TokenPillSlot, {
|
|
119
119
|
value: this.__value,
|
|
120
120
|
tokenType: "input",
|
|
121
121
|
nodeKey: this.getKey(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from 'lexical';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
import type { PromptEditorDiffType } from '../types';
|
|
4
4
|
export type SerializedInputTokenNode = Spread<{
|
|
5
5
|
value: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { $applyNodeReplacement, DecoratorNode } from "lexical";
|
|
3
|
-
import {
|
|
3
|
+
import { TokenPillSlot } from "../components/TokenPillSlot.js";
|
|
4
4
|
class InputTokenNode extends DecoratorNode {
|
|
5
5
|
__value;
|
|
6
6
|
__diffType;
|
|
@@ -85,7 +85,7 @@ class InputTokenNode extends DecoratorNode {
|
|
|
85
85
|
}
|
|
86
86
|
decorate(editor) {
|
|
87
87
|
const readonly = !editor.isEditable();
|
|
88
|
-
return /*#__PURE__*/ jsx(
|
|
88
|
+
return /*#__PURE__*/ jsx(TokenPillSlot, {
|
|
89
89
|
value: this.__value,
|
|
90
90
|
tokenType: "input",
|
|
91
91
|
nodeKey: this.getKey(),
|
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
});
|
|
31
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
32
|
const external_lexical_namespaceObject = require("lexical");
|
|
33
|
-
const
|
|
33
|
+
const TokenPillSlot_cjs_namespaceObject = require("../components/TokenPillSlot.cjs");
|
|
34
34
|
class OutputTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
35
35
|
__value;
|
|
36
36
|
__diffType;
|
|
@@ -115,7 +115,7 @@ class OutputTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
|
115
115
|
}
|
|
116
116
|
decorate(editor) {
|
|
117
117
|
const readonly = !editor.isEditable();
|
|
118
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
118
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TokenPillSlot_cjs_namespaceObject.TokenPillSlot, {
|
|
119
119
|
value: this.__value,
|
|
120
120
|
tokenType: "output",
|
|
121
121
|
nodeKey: this.getKey(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from 'lexical';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
import type { PromptEditorDiffType } from '../types';
|
|
4
4
|
export type SerializedOutputTokenNode = Spread<{
|
|
5
5
|
value: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { $applyNodeReplacement, DecoratorNode } from "lexical";
|
|
3
|
-
import {
|
|
3
|
+
import { TokenPillSlot } from "../components/TokenPillSlot.js";
|
|
4
4
|
class OutputTokenNode extends DecoratorNode {
|
|
5
5
|
__value;
|
|
6
6
|
__diffType;
|
|
@@ -85,7 +85,7 @@ class OutputTokenNode extends DecoratorNode {
|
|
|
85
85
|
}
|
|
86
86
|
decorate(editor) {
|
|
87
87
|
const readonly = !editor.isEditable();
|
|
88
|
-
return /*#__PURE__*/ jsx(
|
|
88
|
+
return /*#__PURE__*/ jsx(TokenPillSlot, {
|
|
89
89
|
value: this.__value,
|
|
90
90
|
tokenType: "output",
|
|
91
91
|
nodeKey: this.getKey(),
|
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
});
|
|
31
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
32
|
const external_lexical_namespaceObject = require("lexical");
|
|
33
|
-
const
|
|
33
|
+
const TokenPillSlot_cjs_namespaceObject = require("../components/TokenPillSlot.cjs");
|
|
34
34
|
class ResourceTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
35
35
|
__value;
|
|
36
36
|
__diffType;
|
|
@@ -115,7 +115,7 @@ class ResourceTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
|
115
115
|
}
|
|
116
116
|
decorate(editor) {
|
|
117
117
|
const readonly = !editor.isEditable();
|
|
118
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
118
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TokenPillSlot_cjs_namespaceObject.TokenPillSlot, {
|
|
119
119
|
value: this.__value,
|
|
120
120
|
tokenType: "resource",
|
|
121
121
|
nodeKey: this.getKey(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from 'lexical';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
import type { PromptEditorDiffType } from '../types';
|
|
4
4
|
export type SerializedResourceTokenNode = Spread<{
|
|
5
5
|
value: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { $applyNodeReplacement, DecoratorNode } from "lexical";
|
|
3
|
-
import {
|
|
3
|
+
import { TokenPillSlot } from "../components/TokenPillSlot.js";
|
|
4
4
|
class ResourceTokenNode extends DecoratorNode {
|
|
5
5
|
__value;
|
|
6
6
|
__diffType;
|
|
@@ -85,7 +85,7 @@ class ResourceTokenNode extends DecoratorNode {
|
|
|
85
85
|
}
|
|
86
86
|
decorate(editor) {
|
|
87
87
|
const readonly = !editor.isEditable();
|
|
88
|
-
return /*#__PURE__*/ jsx(
|
|
88
|
+
return /*#__PURE__*/ jsx(TokenPillSlot, {
|
|
89
89
|
value: this.__value,
|
|
90
90
|
tokenType: "resource",
|
|
91
91
|
nodeKey: this.getKey(),
|
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
});
|
|
31
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
32
|
const external_lexical_namespaceObject = require("lexical");
|
|
33
|
-
const
|
|
33
|
+
const TokenPillSlot_cjs_namespaceObject = require("../components/TokenPillSlot.cjs");
|
|
34
34
|
class StateTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
35
35
|
__value;
|
|
36
36
|
__diffType;
|
|
@@ -115,7 +115,7 @@ class StateTokenNode extends external_lexical_namespaceObject.DecoratorNode {
|
|
|
115
115
|
}
|
|
116
116
|
decorate(editor) {
|
|
117
117
|
const readonly = !editor.isEditable();
|
|
118
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
118
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TokenPillSlot_cjs_namespaceObject.TokenPillSlot, {
|
|
119
119
|
value: this.__value,
|
|
120
120
|
tokenType: "state",
|
|
121
121
|
nodeKey: this.getKey(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from 'lexical';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
import type { PromptEditorDiffType } from '../types';
|
|
4
4
|
export type SerializedStateTokenNode = Spread<{
|
|
5
5
|
value: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { $applyNodeReplacement, DecoratorNode } from "lexical";
|
|
3
|
-
import {
|
|
3
|
+
import { TokenPillSlot } from "../components/TokenPillSlot.js";
|
|
4
4
|
class StateTokenNode extends DecoratorNode {
|
|
5
5
|
__value;
|
|
6
6
|
__diffType;
|
|
@@ -85,7 +85,7 @@ class StateTokenNode extends DecoratorNode {
|
|
|
85
85
|
}
|
|
86
86
|
decorate(editor) {
|
|
87
87
|
const readonly = !editor.isEditable();
|
|
88
|
-
return /*#__PURE__*/ jsx(
|
|
88
|
+
return /*#__PURE__*/ jsx(TokenPillSlot, {
|
|
89
89
|
value: this.__value,
|
|
90
90
|
tokenType: "state",
|
|
91
91
|
nodeKey: this.getKey(),
|
|
@@ -39,8 +39,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
});
|
|
40
40
|
const external_InputTokenNode_cjs_namespaceObject = require("./InputTokenNode.cjs");
|
|
41
41
|
const external_OutputTokenNode_cjs_namespaceObject = require("./OutputTokenNode.cjs");
|
|
42
|
-
const external_StateTokenNode_cjs_namespaceObject = require("./StateTokenNode.cjs");
|
|
43
42
|
const external_ResourceTokenNode_cjs_namespaceObject = require("./ResourceTokenNode.cjs");
|
|
43
|
+
const external_StateTokenNode_cjs_namespaceObject = require("./StateTokenNode.cjs");
|
|
44
44
|
exports.InputTokenNode = __webpack_exports__.InputTokenNode;
|
|
45
45
|
exports.OutputTokenNode = __webpack_exports__.OutputTokenNode;
|
|
46
46
|
exports.ResourceTokenNode = __webpack_exports__.ResourceTokenNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createInputTokenNode, InputTokenNode, isInputTokenNode } from './InputTokenNode';
|
|
2
1
|
export type { SerializedInputTokenNode } from './InputTokenNode';
|
|
3
|
-
export {
|
|
2
|
+
export { createInputTokenNode, InputTokenNode, isInputTokenNode } from './InputTokenNode';
|
|
4
3
|
export type { SerializedOutputTokenNode } from './OutputTokenNode';
|
|
5
|
-
export {
|
|
6
|
-
export type { SerializedStateTokenNode } from './StateTokenNode';
|
|
7
|
-
export { createResourceTokenNode, isResourceTokenNode, ResourceTokenNode, } from './ResourceTokenNode';
|
|
4
|
+
export { createOutputTokenNode, isOutputTokenNode, OutputTokenNode } from './OutputTokenNode';
|
|
8
5
|
export type { SerializedResourceTokenNode } from './ResourceTokenNode';
|
|
6
|
+
export { createResourceTokenNode, isResourceTokenNode, ResourceTokenNode, } from './ResourceTokenNode';
|
|
7
|
+
export type { SerializedStateTokenNode } from './StateTokenNode';
|
|
8
|
+
export { createStateTokenNode, isStateTokenNode, StateTokenNode } from './StateTokenNode';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputTokenNode, createInputTokenNode, isInputTokenNode } from "./InputTokenNode.js";
|
|
2
2
|
import { OutputTokenNode, createOutputTokenNode, isOutputTokenNode } from "./OutputTokenNode.js";
|
|
3
|
-
import { StateTokenNode, createStateTokenNode, isStateTokenNode } from "./StateTokenNode.js";
|
|
4
3
|
import { ResourceTokenNode, createResourceTokenNode, isResourceTokenNode } from "./ResourceTokenNode.js";
|
|
4
|
+
import { StateTokenNode, createStateTokenNode, isStateTokenNode } from "./StateTokenNode.js";
|
|
5
5
|
export { InputTokenNode, OutputTokenNode, ResourceTokenNode, StateTokenNode, createInputTokenNode, createOutputTokenNode, createResourceTokenNode, createStateTokenNode, isInputTokenNode, isOutputTokenNode, isResourceTokenNode, isStateTokenNode };
|
|
@@ -63,7 +63,7 @@ const getCaretRectForEditor = (editor)=>{
|
|
|
63
63
|
if (0 === rect.width && 0 === rect.height) return fallbackRect;
|
|
64
64
|
return rect;
|
|
65
65
|
};
|
|
66
|
-
const AutocompletePlugin = ({ options })=>{
|
|
66
|
+
const AutocompletePlugin = ({ options, renderMenu })=>{
|
|
67
67
|
const [editor] = (0, LexicalComposerContext_namespaceObject.useLexicalComposerContext)();
|
|
68
68
|
const [open, setOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
69
69
|
const [anchorEl, setAnchorEl] = (0, external_react_namespaceObject.useState)(null);
|
|
@@ -223,14 +223,20 @@ const AutocompletePlugin = ({ options })=>{
|
|
|
223
223
|
}, [
|
|
224
224
|
commitChip
|
|
225
225
|
]);
|
|
226
|
-
|
|
227
|
-
open
|
|
228
|
-
anchorEl
|
|
226
|
+
const menuProps = {
|
|
227
|
+
open,
|
|
228
|
+
anchorEl,
|
|
229
229
|
initialSearch: query,
|
|
230
|
-
options
|
|
230
|
+
options,
|
|
231
231
|
onSelect: handleVariablePickerSelect,
|
|
232
232
|
onCommitFreeForm: handleVariablePickerSelect,
|
|
233
233
|
onClose: ()=>closeMenu(true)
|
|
234
|
+
};
|
|
235
|
+
if (renderMenu) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
236
|
+
children: renderMenu(menuProps)
|
|
237
|
+
});
|
|
238
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PromptEditorAutocompleteMenu_cjs_namespaceObject.PromptEditorAutocompleteMenu, {
|
|
239
|
+
...menuProps
|
|
234
240
|
});
|
|
235
241
|
};
|
|
236
242
|
exports.AutocompletePlugin = __webpack_exports__.AutocompletePlugin;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PromptEditorAutocompleteMenuProps } from '../components/PromptEditorAutocompleteMenu';
|
|
1
2
|
import type { PromptEditorAutoCompleteOption } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Drives the `$`-trigger flow: detects when the user has typed a `$` in a valid trigger context,
|
|
@@ -10,6 +11,12 @@ import type { PromptEditorAutoCompleteOption } from '../types';
|
|
|
10
11
|
* the Lexical editor: trigger detection, dismissal sentinel, free-form Enter fallback after
|
|
11
12
|
* dismissal, and refocusing the editor when the picker closes.
|
|
12
13
|
*/
|
|
13
|
-
export declare const AutocompletePlugin: ({ options }: {
|
|
14
|
+
export declare const AutocompletePlugin: ({ options, renderMenu, }: {
|
|
14
15
|
options: PromptEditorAutoCompleteOption[];
|
|
16
|
+
/**
|
|
17
|
+
* Replace the built-in cmdk menu with a consumer-supplied one (e.g. a schema-aware variable
|
|
18
|
+
* picker). Receives the exact props the built-in menu would get; the consumer's menu owns search
|
|
19
|
+
* and keyboard navigation while open and reports back through `onSelect`/`onClose`.
|
|
20
|
+
*/
|
|
21
|
+
renderMenu?: (props: PromptEditorAutocompleteMenuProps) => React.ReactNode;
|
|
15
22
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
3
|
import { mergeRegister } from "@lexical/utils";
|
|
4
4
|
import { $createTextNode, $getRoot, $getSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_HIGH, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, getDOMSelectionFromTarget } from "lexical";
|
|
@@ -35,7 +35,7 @@ const getCaretRectForEditor = (editor)=>{
|
|
|
35
35
|
if (0 === rect.width && 0 === rect.height) return fallbackRect;
|
|
36
36
|
return rect;
|
|
37
37
|
};
|
|
38
|
-
const AutocompletePlugin = ({ options })=>{
|
|
38
|
+
const AutocompletePlugin = ({ options, renderMenu })=>{
|
|
39
39
|
const [editor] = useLexicalComposerContext();
|
|
40
40
|
const [open, setOpen] = useState(false);
|
|
41
41
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -195,14 +195,20 @@ const AutocompletePlugin = ({ options })=>{
|
|
|
195
195
|
}, [
|
|
196
196
|
commitChip
|
|
197
197
|
]);
|
|
198
|
-
|
|
199
|
-
open
|
|
200
|
-
anchorEl
|
|
198
|
+
const menuProps = {
|
|
199
|
+
open,
|
|
200
|
+
anchorEl,
|
|
201
201
|
initialSearch: query,
|
|
202
|
-
options
|
|
202
|
+
options,
|
|
203
203
|
onSelect: handleVariablePickerSelect,
|
|
204
204
|
onCommitFreeForm: handleVariablePickerSelect,
|
|
205
205
|
onClose: ()=>closeMenu(true)
|
|
206
|
+
};
|
|
207
|
+
if (renderMenu) return /*#__PURE__*/ jsx(Fragment, {
|
|
208
|
+
children: renderMenu(menuProps)
|
|
209
|
+
});
|
|
210
|
+
return /*#__PURE__*/ jsx(PromptEditorAutocompleteMenu, {
|
|
211
|
+
...menuProps
|
|
206
212
|
});
|
|
207
213
|
};
|
|
208
214
|
export { AutocompletePlugin };
|
|
@@ -26,11 +26,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
CopyPastePlugin: ()=>CopyPastePlugin
|
|
28
28
|
});
|
|
29
|
-
const external_react_namespaceObject = require("react");
|
|
30
29
|
const clipboard_namespaceObject = require("@lexical/clipboard");
|
|
31
30
|
const LexicalComposerContext_namespaceObject = require("@lexical/react/LexicalComposerContext");
|
|
32
31
|
const utils_namespaceObject = require("@lexical/utils");
|
|
33
32
|
const external_lexical_namespaceObject = require("lexical");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
34
|
const index_cjs_namespaceObject = require("../nodes/index.cjs");
|
|
35
35
|
const external_utils_index_cjs_namespaceObject = require("../utils/index.cjs");
|
|
36
36
|
const LEXICAL_MIME = 'application/x-lexical-editor';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
1
|
import { $generateNodesFromSerializedNodes, $getLexicalContent, $insertGeneratedNodes } from "@lexical/clipboard";
|
|
3
2
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
3
|
import { mergeRegister } from "@lexical/utils";
|
|
5
4
|
import { $createRangeSelectionFromDom, $getSelection, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COPY_COMMAND, CUT_COMMAND, PASTE_COMMAND } from "lexical";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
6
|
import { createInputTokenNode, createOutputTokenNode, createResourceTokenNode, createStateTokenNode } from "../nodes/index.js";
|
|
7
7
|
import { clipboardStringToTokens, getEditorTokensFromSelection, tokensToClipboardString } from "../utils/index.js";
|
|
8
8
|
const LEXICAL_MIME = 'application/x-lexical-editor';
|