@flowgram.ai/form-materials 0.2.32 → 0.3.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/bin/index.ts +11 -5
- package/bin/materials.ts +9 -1
- package/dist/esm/index.js +1229 -1308
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +162 -125
- package/dist/index.d.ts +162 -125
- package/dist/index.js +1380 -1463
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/components/batch-variable-selector/config.json +6 -2
- package/src/components/batch-variable-selector/index.tsx +1 -1
- package/src/components/code-editor/theme/light.ts +1 -1
- package/src/components/code-editor-mini/config.json +7 -0
- package/src/components/code-editor-mini/index.tsx +31 -0
- package/src/components/condition-row/config.json +10 -2
- package/src/components/condition-row/constants.ts +4 -0
- package/src/components/condition-row/hooks/useRule.ts +2 -2
- package/src/components/condition-row/index.tsx +1 -1
- package/src/components/condition-row/types.ts +3 -1
- package/src/components/constant-input/config.json +6 -3
- package/src/components/constant-input/index.tsx +10 -71
- package/src/components/constant-input/types.ts +6 -10
- package/src/components/display-flow-value/config.json +8 -0
- package/src/components/display-flow-value/index.tsx +59 -0
- package/src/components/display-inputs-values/config.json +9 -0
- package/src/components/display-inputs-values/index.tsx +27 -0
- package/src/components/display-inputs-values/styles.ts +12 -0
- package/src/components/display-outputs/config.json +10 -0
- package/src/components/display-outputs/index.tsx +58 -0
- package/src/components/display-outputs/styles.ts +12 -0
- package/src/components/display-schema-tag/config.json +10 -0
- package/src/components/display-schema-tag/index.tsx +44 -0
- package/src/components/display-schema-tag/styles.ts +28 -0
- package/src/components/display-schema-tree/config.json +11 -0
- package/src/components/display-schema-tree/index.tsx +74 -0
- package/src/components/display-schema-tree/styles.tsx +90 -0
- package/src/components/dynamic-value-input/config.json +11 -2
- package/src/components/dynamic-value-input/hooks.ts +53 -0
- package/src/components/dynamic-value-input/index.tsx +30 -28
- package/src/components/index.ts +6 -0
- package/src/components/inputs-values/config.json +2 -1
- package/src/components/inputs-values/types.ts +3 -1
- package/src/components/json-schema-editor/config.json +2 -2
- package/src/components/json-schema-editor/default-value.tsx +1 -1
- package/src/components/json-schema-editor/hooks.tsx +1 -1
- package/src/components/json-schema-editor/index.tsx +1 -1
- package/src/components/json-schema-editor/types.ts +1 -1
- package/src/components/type-selector/config.json +6 -2
- package/src/components/type-selector/index.tsx +47 -11
- package/src/components/variable-selector/config.json +6 -2
- package/src/components/variable-selector/index.tsx +1 -1
- package/src/components/variable-selector/use-variable-tree.tsx +14 -20
- package/src/effects/provide-json-schema-outputs/config.json +4 -5
- package/src/effects/provide-json-schema-outputs/index.ts +1 -3
- package/src/effects/sync-variable-title/index.ts +1 -0
- package/src/form-plugins/infer-inputs-plugin/config.json +3 -1
- package/src/form-plugins/infer-inputs-plugin/index.ts +2 -2
- package/src/index.ts +2 -1
- package/src/{typings/json-schema → plugins/disable-declaration-plugin}/config.json +1 -1
- package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +31 -0
- package/src/plugins/disable-declaration-plugin/index.tsx +6 -0
- package/src/plugins/index.ts +7 -0
- package/src/plugins/json-schema-preset/config.json +9 -0
- package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +28 -0
- package/src/plugins/json-schema-preset/index.tsx +39 -0
- package/src/plugins/json-schema-preset/manager.ts +18 -0
- package/src/plugins/json-schema-preset/type-definition/array.tsx +23 -0
- package/src/plugins/json-schema-preset/type-definition/boolean.tsx +32 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +24 -0
- package/src/plugins/json-schema-preset/type-definition/integer.tsx +24 -0
- package/src/plugins/json-schema-preset/type-definition/number.tsx +24 -0
- package/src/plugins/json-schema-preset/type-definition/object.tsx +23 -0
- package/src/plugins/json-schema-preset/type-definition/string.tsx +18 -0
- package/src/{utils → shared}/index.ts +0 -1
- package/src/typings/flow-value/config.json +4 -4
- package/src/typings/flow-value/index.ts +1 -1
- package/src/typings/index.ts +0 -1
- package/src/components/type-selector/constants.tsx +0 -364
- package/src/typings/json-schema/index.ts +0 -36
- package/src/utils/json-schema/config.json +0 -5
- package/src/utils/json-schema/index.ts +0 -180
- /package/src/{utils → shared}/format-legacy-refs/config.json +0 -0
- /package/src/{utils → shared}/format-legacy-refs/index.ts +0 -0
- /package/src/{utils → shared}/format-legacy-refs/readme.md +0 -0
package/dist/index.js
CHANGED
|
@@ -30,31 +30,37 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
-
ArrayIcons: () => ArrayIcons,
|
|
34
33
|
BatchOutputs: () => BatchOutputs,
|
|
35
34
|
BatchVariableSelector: () => BatchVariableSelector,
|
|
36
35
|
CodeEditor: () => CodeEditor,
|
|
36
|
+
CodeEditorMini: () => CodeEditorMini,
|
|
37
37
|
ConditionRow: () => ConditionRow,
|
|
38
38
|
ConstantInput: () => ConstantInput,
|
|
39
|
+
DisplayFlowValue: () => DisplayFlowValue,
|
|
40
|
+
DisplayInputsValues: () => DisplayInputsValues,
|
|
41
|
+
DisplayOutputs: () => DisplayOutputs,
|
|
42
|
+
DisplaySchemaTag: () => DisplaySchemaTag,
|
|
43
|
+
DisplaySchemaTree: () => DisplaySchemaTree,
|
|
39
44
|
DynamicValueInput: () => DynamicValueInput,
|
|
40
45
|
InputsValues: () => InputsValues,
|
|
41
46
|
JsonEditorWithVariables: () => JsonEditorWithVariables,
|
|
42
47
|
JsonSchemaEditor: () => JsonSchemaEditor,
|
|
43
|
-
|
|
48
|
+
JsonSchemaTypePresetProvider: () => JsonSchemaTypePresetProvider,
|
|
49
|
+
JsonSchemaUtils: () => import_json_schema3.JsonSchemaUtils,
|
|
44
50
|
PromptEditor: () => PromptEditor,
|
|
45
51
|
PromptEditorWithInputs: () => PromptEditorWithInputs,
|
|
46
52
|
PromptEditorWithVariables: () => PromptEditorWithVariables,
|
|
47
53
|
TypeSelector: () => TypeSelector,
|
|
48
54
|
VariableSelector: () => VariableSelector,
|
|
49
|
-
VariableTypeIcons: () => VariableTypeIcons,
|
|
50
55
|
autoRenameRefEffect: () => autoRenameRefEffect,
|
|
51
56
|
createBatchOutputsFormPlugin: () => createBatchOutputsFormPlugin,
|
|
57
|
+
createDisableDeclarationPlugin: () => createDisableDeclarationPlugin,
|
|
52
58
|
createInferInputsPlugin: () => createInferInputsPlugin,
|
|
59
|
+
createTypePresetPlugin: () => createTypePresetPlugin,
|
|
53
60
|
formatLegacyRefOnInit: () => formatLegacyRefOnInit,
|
|
54
61
|
formatLegacyRefOnSubmit: () => formatLegacyRefOnSubmit,
|
|
55
62
|
formatLegacyRefToNewRef: () => formatLegacyRefToNewRef,
|
|
56
63
|
formatNewRefToLegacyRef: () => formatNewRefToLegacyRef,
|
|
57
|
-
getSchemaIcon: () => getSchemaIcon,
|
|
58
64
|
getTypeSelectValue: () => getTypeSelectValue,
|
|
59
65
|
isLegacyFlowRefValueSchema: () => isLegacyFlowRefValueSchema,
|
|
60
66
|
isNewFlowRefValueSchema: () => isNewFlowRefValueSchema,
|
|
@@ -63,6 +69,7 @@ __export(src_exports, {
|
|
|
63
69
|
provideBatchOutputsEffect: () => provideBatchOutputsEffect,
|
|
64
70
|
provideJsonSchemaOutputs: () => provideJsonSchemaOutputs,
|
|
65
71
|
syncVariableTitle: () => syncVariableTitle,
|
|
72
|
+
useTypeManager: () => useTypeManager,
|
|
66
73
|
useVariableTree: () => useVariableTree
|
|
67
74
|
});
|
|
68
75
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -72,554 +79,554 @@ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${_
|
|
|
72
79
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
73
80
|
|
|
74
81
|
// src/components/variable-selector/index.tsx
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
var
|
|
82
|
+
var import_react12 = __toESM(require("react"));
|
|
83
|
+
var import_semi_ui7 = require("@douyinfe/semi-ui");
|
|
84
|
+
var import_semi_icons = require("@douyinfe/semi-icons");
|
|
78
85
|
|
|
79
86
|
// src/components/variable-selector/use-variable-tree.tsx
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
87
|
+
var import_react11 = __toESM(require("react"));
|
|
88
|
+
var import_json_schema4 = require("@flowgram.ai/json-schema");
|
|
89
|
+
var import_editor4 = require("@flowgram.ai/editor");
|
|
90
|
+
var import_semi_ui5 = require("@douyinfe/semi-ui");
|
|
91
|
+
|
|
92
|
+
// src/plugins/json-schema-preset/index.tsx
|
|
93
|
+
var import_react10 = __toESM(require("react"));
|
|
94
|
+
var import_json_schema3 = require("@flowgram.ai/json-schema");
|
|
95
|
+
|
|
96
|
+
// src/plugins/json-schema-preset/type-definition/index.tsx
|
|
97
|
+
var import_json_schema = require("@flowgram.ai/json-schema");
|
|
83
98
|
|
|
84
|
-
// src/
|
|
99
|
+
// src/plugins/json-schema-preset/type-definition/string.tsx
|
|
85
100
|
var import_react = __toESM(require("react"));
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
var import_semi_ui = require("@douyinfe/semi-ui");
|
|
102
|
+
var stringRegistry = {
|
|
103
|
+
type: "string",
|
|
104
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react.default.createElement(import_semi_ui.Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/plugins/json-schema-preset/type-definition/object.tsx
|
|
108
|
+
var import_react5 = __toESM(require("react"));
|
|
109
|
+
|
|
110
|
+
// src/components/code-editor-mini/index.tsx
|
|
111
|
+
var import_react4 = __toESM(require("react"));
|
|
112
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
113
|
+
|
|
114
|
+
// src/components/code-editor/index.tsx
|
|
115
|
+
var import_react2 = __toESM(require("react"));
|
|
116
|
+
var import_react3 = require("@coze-editor/editor/react");
|
|
117
|
+
var import_preset_code5 = __toESM(require("@coze-editor/editor/preset-code"));
|
|
118
|
+
var import_view = require("@codemirror/view");
|
|
119
|
+
|
|
120
|
+
// src/components/code-editor/utils.ts
|
|
121
|
+
function getSuffixByLanguageId(languageId) {
|
|
122
|
+
if (languageId === "python") {
|
|
123
|
+
return ".py";
|
|
124
|
+
}
|
|
125
|
+
if (languageId === "typescript") {
|
|
126
|
+
return ".ts";
|
|
127
|
+
}
|
|
128
|
+
if (languageId === "shell") {
|
|
129
|
+
return ".sh";
|
|
130
|
+
}
|
|
131
|
+
if (languageId === "json") {
|
|
132
|
+
return ".json";
|
|
133
|
+
}
|
|
134
|
+
return "";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/components/code-editor/language-features.ts
|
|
138
|
+
var import_preset_code = require("@coze-editor/editor/preset-code");
|
|
139
|
+
var import_language_typescript = require("@coze-editor/editor/language-typescript");
|
|
140
|
+
var import_language_shell = require("@coze-editor/editor/language-shell");
|
|
141
|
+
var import_language_python = require("@coze-editor/editor/language-python");
|
|
142
|
+
var import_language_json = require("@coze-editor/editor/language-json");
|
|
143
|
+
var import_editor = require("@coze-editor/editor");
|
|
144
|
+
import_preset_code.languages.register("python", import_language_python.python);
|
|
145
|
+
import_preset_code.languages.register("shell", import_language_shell.shell);
|
|
146
|
+
import_preset_code.languages.register("typescript", import_language_typescript.typescript);
|
|
147
|
+
import_preset_code.languages.register("json", {
|
|
148
|
+
// mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
|
|
149
|
+
language: (0, import_editor.mixLanguages)({
|
|
150
|
+
outerLanguage: import_language_json.json.language
|
|
151
|
+
}),
|
|
152
|
+
languageService: import_language_json.json.languageService
|
|
153
|
+
});
|
|
154
|
+
var tsWorkerInit = false;
|
|
155
|
+
var initTsWorker = () => {
|
|
156
|
+
if (tsWorkerInit) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
tsWorkerInit = true;
|
|
160
|
+
const tsWorker = new Worker(
|
|
161
|
+
new URL(`@coze-editor/editor/language-typescript/worker`, importMetaUrl),
|
|
162
|
+
{ type: "module" }
|
|
163
|
+
);
|
|
164
|
+
import_language_typescript.typescript.languageService.initialize(tsWorker, {
|
|
165
|
+
compilerOptions: {
|
|
166
|
+
// eliminate Promise error
|
|
167
|
+
lib: ["es2015", "dom"],
|
|
168
|
+
noImplicitAny: false
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/components/code-editor/theme/index.ts
|
|
174
|
+
var import_preset_code4 = require("@coze-editor/editor/preset-code");
|
|
175
|
+
|
|
176
|
+
// src/components/code-editor/theme/light.ts
|
|
177
|
+
var import_preset_code2 = require("@coze-editor/editor/preset-code");
|
|
178
|
+
var colors = {
|
|
179
|
+
background: "#F7F7FC",
|
|
180
|
+
// syntax
|
|
181
|
+
comment: "#000A298A",
|
|
182
|
+
key: "#00818C",
|
|
183
|
+
string: "#D1009D",
|
|
184
|
+
number: "#C74200",
|
|
185
|
+
boolean: "#2B57D9",
|
|
186
|
+
null: "#2B57D9",
|
|
187
|
+
separator: "#0F1529D1"
|
|
188
|
+
};
|
|
189
|
+
var lightTheme = (0, import_preset_code2.createTheme)({
|
|
190
|
+
variant: "light",
|
|
191
|
+
settings: {
|
|
192
|
+
background: "#fff",
|
|
193
|
+
foreground: "#000",
|
|
194
|
+
caret: "#000",
|
|
195
|
+
selection: "#d9d9d9",
|
|
196
|
+
gutterBackground: "#f0f0f0",
|
|
197
|
+
gutterForeground: "#666",
|
|
198
|
+
gutterBorderColor: "transparent",
|
|
199
|
+
gutterBorderWidth: 0,
|
|
200
|
+
lineHighlight: "#e1e1e180",
|
|
201
|
+
bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
|
|
202
|
+
tooltip: {
|
|
203
|
+
backgroundColor: "#f0f0f0",
|
|
204
|
+
color: "#000",
|
|
205
|
+
border: "1px solid #ccc"
|
|
98
206
|
},
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
{
|
|
102
|
-
fillRule: "evenodd",
|
|
103
|
-
clipRule: "evenodd",
|
|
104
|
-
d: "M5.1 18L4.5032 20.1702C4.24999 21.0909 4.94281 22 5.89773 22C6.54881 22 7.11964 21.565 7.29227 20.9372L8.1 18H12.1L11.5032 20.1702C11.25 21.0909 11.9428 22 12.8977 22C13.5488 22 14.1196 21.565 14.2923 20.9372L15.1 18H19.5C20.3284 18 21 17.3284 21 16.5C21 15.6716 20.3284 15 19.5 15H15.925L17.575 9H20.5C21.3284 9 22 8.32843 22 7.5C22 6.67157 21.3284 6 20.5 6H18.4L18.9968 3.8298C19.25 2.90906 18.5572 2 17.6023 2C16.9512 2 16.3804 2.43504 16.2077 3.06281L15.4 6H11.4L11.9968 3.8298C12.25 2.90906 11.5572 2 10.6023 2C9.95119 2 9.38036 2.43504 9.20773 3.06281L8.4 6H4.5C3.67157 6 3 6.67157 3 7.5C3 8.32843 3.67157 9 4.5 9H7.575L5.925 15H3.5C2.67157 15 2 15.6716 2 16.5C2 17.3284 2.67157 18 3.5 18H5.1ZM8.925 15L10.575 9H14.575L12.925 15H8.925Z",
|
|
105
|
-
fill: "currentColor"
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
),
|
|
109
|
-
object: /* @__PURE__ */ import_react.default.createElement(
|
|
110
|
-
"svg",
|
|
111
|
-
{
|
|
112
|
-
width: "1em",
|
|
113
|
-
height: "1em",
|
|
114
|
-
viewBox: "0 0 16 16",
|
|
115
|
-
fill: "none",
|
|
116
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
207
|
+
link: {
|
|
208
|
+
color: "#007bff"
|
|
117
209
|
},
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
{
|
|
121
|
-
d: "M5.33893 1.5835C5.66613 1.5835 5.93137 1.88142 5.93137 2.20862C5.93137 2.53582 5.66613 2.76838 5.33893 2.76838H4.9099C4.34717 2.76838 4.08062 3.07557 4.08062 3.71921V6.58633C4.08062 7.30996 3.80723 7.84734 3.26798 8.19105C3.11426 8.28902 3.10884 8.55273 3.26068 8.65359C3.80476 9.01503 4.08062 9.53994 4.08062 10.2434V13.1251C4.08062 13.7395 4.34717 14.0613 4.9099 14.0613H5.33893C5.66613 14.0613 5.93137 14.3435 5.93137 14.6707C5.93137 14.9979 5.66613 15.2462 5.33893 15.2462H4.64335C3.99177 15.2462 3.48828 15.0268 3.13287 14.6172C2.80708 14.2369 2.64419 13.7103 2.64419 13.0666V10.3165C2.64419 9.8923 2.55534 9.58511 2.37764 9.39494C2.26816 9.27135 1.80618 9.17938 1.38154 9.11602C1.02726 9.06315 0.759057 8.76744 0.765747 8.4093C0.772379 8.0543 1.03439 7.7566 1.38545 7.70346C1.80778 7.63952 2.26906 7.54968 2.37764 7.43477C2.55534 7.22997 2.64419 6.92278 2.64419 6.51319V3.77772C2.64419 3.11945 2.80708 2.59284 3.13287 2.21251C3.48828 1.78829 3.99177 1.5835 4.64335 1.5835H5.33893Z",
|
|
122
|
-
fill: "currentColor"
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
126
|
-
"path",
|
|
127
|
-
{
|
|
128
|
-
d: "M10.962 15.2463C10.6348 15.2463 10.3696 14.9483 10.3696 14.6211C10.3696 14.2939 10.6348 14.0614 10.962 14.0614H11.391C11.9538 14.0614 12.2203 13.7542 12.2203 13.1105V10.2434C12.2203 9.51979 12.4937 8.98241 13.033 8.6387C13.1867 8.54073 13.1921 8.27703 13.0403 8.17616C12.4962 7.81472 12.2203 7.28982 12.2203 6.58638V3.70463C12.2203 3.09024 11.9538 2.76842 11.391 2.76842L10.962 2.76842C10.6348 2.76842 10.3696 2.48627 10.3696 2.15907C10.3696 1.83188 10.6348 1.58354 10.962 1.58354L11.6576 1.58354C12.3092 1.58354 12.8127 1.80296 13.1681 2.21255C13.4939 2.59289 13.6568 3.1195 13.6568 3.76314V6.51324C13.6568 6.93745 13.7456 7.24464 13.9233 7.43481C14.03 7.5553 14.4328 7.64858 14.8186 7.71393C15.1718 7.77376 15.4401 8.06977 15.4334 8.42791C15.4268 8.78291 15.1646 9.08018 14.814 9.13633C14.4306 9.19774 14.0291 9.28303 13.9233 9.39499C13.7456 9.59978 13.6568 9.90697 13.6568 10.3166V13.052C13.6568 13.7103 13.4939 14.2369 13.1681 14.6172C12.8127 15.0415 12.3092 15.2463 11.6576 15.2463H10.962Z",
|
|
129
|
-
fill: "currentColor"
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
),
|
|
133
|
-
boolean: /* @__PURE__ */ import_react.default.createElement(
|
|
134
|
-
"svg",
|
|
135
|
-
{
|
|
136
|
-
width: "1em",
|
|
137
|
-
height: "1em",
|
|
138
|
-
viewBox: "0 0 16 16",
|
|
139
|
-
fill: "none",
|
|
140
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
210
|
+
completionItemHover: {
|
|
211
|
+
backgroundColor: "#f0f0f0"
|
|
141
212
|
},
|
|
142
|
-
|
|
143
|
-
"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
),
|
|
161
|
-
string: /* @__PURE__ */ import_react.default.createElement(
|
|
162
|
-
"svg",
|
|
213
|
+
completionItemSelected: {
|
|
214
|
+
backgroundColor: "#e0e0e0"
|
|
215
|
+
},
|
|
216
|
+
completionItemIcon: {
|
|
217
|
+
color: "#333"
|
|
218
|
+
},
|
|
219
|
+
completionItemLabel: {
|
|
220
|
+
color: "#333"
|
|
221
|
+
},
|
|
222
|
+
completionItemInfo: {
|
|
223
|
+
color: "#333"
|
|
224
|
+
},
|
|
225
|
+
completionItemDetail: {
|
|
226
|
+
color: "#666"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
styles: [
|
|
230
|
+
// JSON
|
|
163
231
|
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
viewBox: "0 0 16 16",
|
|
167
|
-
fill: "none",
|
|
168
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
232
|
+
tag: import_preset_code2.tags.comment,
|
|
233
|
+
color: colors.comment
|
|
169
234
|
},
|
|
170
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
171
|
-
"path",
|
|
172
|
-
{
|
|
173
|
-
d: "M9.3342 3.33321C8.96601 3.33321 8.66753 3.63169 8.66753 3.99988C8.66753 4.36807 8.96601 4.66655 9.3342 4.66655H14.6675C15.0357 4.66655 15.3342 4.36807 15.3342 3.99988C15.3342 3.63169 15.0357 3.33321 14.6675 3.33321H9.3342Z",
|
|
174
|
-
fill: "currentColor"
|
|
175
|
-
}
|
|
176
|
-
),
|
|
177
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
178
|
-
"path",
|
|
179
|
-
{
|
|
180
|
-
d: "M10.0009 7.99988C10.0009 7.63169 10.2993 7.33321 10.6675 7.33321H14.6675C15.0357 7.33321 15.3342 7.63169 15.3342 7.99988C15.3342 8.36807 15.0357 8.66655 14.6675 8.66655H10.6675C10.2993 8.66655 10.0009 8.36807 10.0009 7.99988Z",
|
|
181
|
-
fill: "currentColor"
|
|
182
|
-
}
|
|
183
|
-
),
|
|
184
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
185
|
-
"path",
|
|
186
|
-
{
|
|
187
|
-
d: "M12.0009 11.3332C11.6327 11.3332 11.3342 11.6317 11.3342 11.9999C11.3342 12.3681 11.6327 12.6665 12.0009 12.6665H14.6675C15.0357 12.6665 15.3342 12.3681 15.3342 11.9999C15.3342 11.6317 15.0357 11.3332 14.6675 11.3332H12.0009Z",
|
|
188
|
-
fill: "currentColor"
|
|
189
|
-
}
|
|
190
|
-
),
|
|
191
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
192
|
-
"path",
|
|
193
|
-
{
|
|
194
|
-
d: "M9.86659 14.1482L8.23444 10.1844H3.18136C3.13868 10.1844 3.09685 10.1808 3.05616 10.1738L1.66589 14.1129C1.53049 14.4965 1.10971 14.6978 0.726058 14.5624C0.342408 14.427 0.141166 14.0062 0.276572 13.6225L4.37566 2.00848C4.71323 1.05202 6.05321 1.01763 6.4394 1.95552L11.2289 13.5872C11.3838 13.9634 11.2044 14.394 10.8282 14.5489C10.452 14.7038 10.0215 14.5244 9.86659 14.1482ZM5.44412 3.40791L3.57241 8.71109H7.62778L5.44412 3.40791Z",
|
|
195
|
-
fill: "currentColor"
|
|
196
|
-
}
|
|
197
|
-
)
|
|
198
|
-
),
|
|
199
|
-
integer: /* @__PURE__ */ import_react.default.createElement(
|
|
200
|
-
"svg",
|
|
201
235
|
{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
viewBox: "0 0 16 16",
|
|
205
|
-
fill: "none",
|
|
206
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
236
|
+
tag: [import_preset_code2.tags.propertyName],
|
|
237
|
+
color: colors.key
|
|
207
238
|
},
|
|
208
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
209
|
-
"path",
|
|
210
|
-
{
|
|
211
|
-
d: "M15.132 11.4601C15.644 11.0121 15.9 10.3921 15.9 9.60007C15.9 8.60807 15.5 7.93607 14.7 7.58407C15.412 7.23207 15.768 6.62407 15.768 5.76007C15.768 5.05607 15.536 4.48007 15.072 4.03207C14.608 3.59207 14.012 3.37207 13.284 3.37207C12.588 3.37207 12.008 3.58007 11.544 3.99607C11.064 4.42007 10.808 4.98807 10.776 5.70007H12C12.064 4.88407 12.492 4.47607 13.284 4.47607C14.124 4.47607 14.544 4.91607 14.544 5.79607C14.544 6.66007 14.112 7.09207 13.248 7.09207H13.044V8.16007H13.248C14.2 8.16007 14.676 8.62807 14.676 9.56407C14.676 10.5081 14.212 10.9801 13.284 10.9801C12.9 10.9801 12.584 10.8761 12.336 10.6681C12.064 10.4441 11.916 10.1161 11.892 9.68407H10.668C10.692 10.4761 10.964 11.0841 11.484 11.5081C11.948 11.8921 12.548 12.0841 13.284 12.0841C14.036 12.0841 14.652 11.8761 15.132 11.4601Z",
|
|
212
|
-
fill: "currentColor"
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
216
|
-
"path",
|
|
217
|
-
{
|
|
218
|
-
d: "M4.46875 12.0003V10.9083L7.75675 6.91228C8.06075 6.54428 8.21275 6.16428 8.21275 5.77228C8.21275 4.90828 7.79675 4.47628 6.96475 4.47628C6.60475 4.47628 6.31275 4.57628 6.08875 4.77628C5.83275 5.00828 5.70475 5.34828 5.70475 5.79628H4.48075C4.48075 5.07628 4.71275 4.49228 5.17675 4.04428C5.64075 3.60428 6.23675 3.38428 6.96475 3.38428C7.70075 3.38428 8.29675 3.60028 8.75275 4.03228C9.20875 4.47228 9.43675 5.05628 9.43675 5.78428C9.43675 6.13628 9.36875 6.45628 9.23275 6.74428C9.12075 6.97628 8.92075 7.27228 8.63275 7.63228L5.95675 10.9083H9.43675V12.0003H4.46875Z",
|
|
219
|
-
fill: "currentColor"
|
|
220
|
-
}
|
|
221
|
-
),
|
|
222
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
223
|
-
"path",
|
|
224
|
-
{
|
|
225
|
-
d: "M1.668 12.0001V4.78805L0 6.25205V4.89605L1.668 3.45605H2.892V12.0001H1.668Z",
|
|
226
|
-
fill: "currentColor"
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
),
|
|
230
|
-
number: /* @__PURE__ */ import_react.default.createElement(
|
|
231
|
-
"svg",
|
|
232
239
|
{
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
viewBox: "0 0 16 16",
|
|
236
|
-
fill: "none",
|
|
237
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
240
|
+
tag: [import_preset_code2.tags.string],
|
|
241
|
+
color: colors.string
|
|
238
242
|
},
|
|
239
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
240
|
-
"path",
|
|
241
|
-
{
|
|
242
|
-
d: "M3.44151 5.3068C3.44151 3.83404 4.71542 2.64014 6.18818 2.64014C7.66094 2.64014 8.93484 3.83404 8.93484 5.3068V10.6135C8.93484 12.0862 7.66094 13.2801 6.18818 13.2801C4.71542 13.2801 3.44151 12.0862 3.44151 10.6135V5.3068ZM7.60151 5.3068C7.60151 4.57042 6.92456 3.97347 6.18818 3.97347C5.4518 3.97347 4.77484 4.57042 4.77484 5.3068V10.6135C4.77484 11.3498 5.4518 11.9468 6.18818 11.9468C6.92456 11.9468 7.60151 11.3498 7.60151 10.6135V5.3068Z",
|
|
243
|
-
fill: "currentColor"
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
247
|
-
"path",
|
|
248
|
-
{
|
|
249
|
-
d: "M12.9882 2.64014C11.5154 2.64014 10.2415 3.83404 10.2415 5.3068V10.6135C10.2415 12.0862 11.5154 13.2801 12.9882 13.2801C14.4609 13.2801 15.7348 12.0862 15.7348 10.6135V5.3068C15.7348 3.83404 14.4609 2.64014 12.9882 2.64014ZM14.4015 10.6135C14.4015 11.3498 13.7246 11.9468 12.9882 11.9468C12.2518 11.9468 11.5748 11.3498 11.5748 10.6135V5.3068C11.5748 4.57042 12.2518 3.97347 12.9882 3.97347C13.7246 3.97347 14.4015 4.57042 14.4015 5.3068V10.6135Z",
|
|
250
|
-
fill: "currentColor"
|
|
251
|
-
}
|
|
252
|
-
),
|
|
253
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
254
|
-
"path",
|
|
255
|
-
{
|
|
256
|
-
d: "M1.21484 13.2001C1.76713 13.2001 2.21484 12.7524 2.21484 12.2001C2.21484 11.6479 1.76713 11.2001 1.21484 11.2001C0.662559 11.2001 0.214844 11.6479 0.214844 12.2001C0.214844 12.7524 0.662559 13.2001 1.21484 13.2001Z",
|
|
257
|
-
fill: "currentColor"
|
|
258
|
-
}
|
|
259
|
-
)
|
|
260
|
-
),
|
|
261
|
-
array: /* @__PURE__ */ import_react.default.createElement(
|
|
262
|
-
"svg",
|
|
263
243
|
{
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
viewBox: "0 0 16 16",
|
|
267
|
-
fill: "none",
|
|
268
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
244
|
+
tag: [import_preset_code2.tags.number],
|
|
245
|
+
color: colors.number
|
|
269
246
|
},
|
|
270
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
271
|
-
"path",
|
|
272
|
-
{
|
|
273
|
-
d: "M5.23759 1.00342H2.00391V14.997H5.23759V13.6251H3.35127V2.37534H5.23759V1.00342Z",
|
|
274
|
-
fill: "currentColor"
|
|
275
|
-
}
|
|
276
|
-
),
|
|
277
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
278
|
-
"path",
|
|
279
|
-
{
|
|
280
|
-
d: "M10.7624 1.00342H13.9961V14.997H10.7624V13.6251H12.6487V2.37534H10.7624V1.00342Z",
|
|
281
|
-
fill: "currentColor"
|
|
282
|
-
}
|
|
283
|
-
)
|
|
284
|
-
),
|
|
285
|
-
stream: /* @__PURE__ */ import_react.default.createElement(
|
|
286
|
-
"svg",
|
|
287
247
|
{
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
291
|
-
width: "1em",
|
|
292
|
-
height: "1em"
|
|
248
|
+
tag: [import_preset_code2.tags.bool],
|
|
249
|
+
color: colors.boolean
|
|
293
250
|
},
|
|
294
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
295
|
-
"path",
|
|
296
|
-
{
|
|
297
|
-
d: "M879.674 544.51l-158.254-0.221c-8.534 2.287-17.305-2.776-19.588-11.307l-23.862-75.877-74.742 350.891c0 0-1.523 18.507-11.518 18.507s-26.9 0.281-26.9 0.281c-8.259 2.213-16.748-2.687-18.961-10.949l-92.741-457.648-70.305 330.634c-2.261 8.291-11.94 15.206-20.385 12.986l-24.876 0.339c-8.723 2.293-17.685-2.789-20.023-11.349L270.629 544.51 143.993 544.51c-8.831 0-15.993-7.159-15.993-15.993l0-31.986c0-8.831 7.162-15.993 15.993-15.993l157.429-0.516c9.565-0.304 17.685 0.788 20.023 9.351l24.386 76.092 68.642-358.907c0 0 3.4-10.894 14.397-10.894 10.994 0 34.107-0.448 34.107-0.448 8.262-2.213 16.751 2.687 18.965 10.949l91.912 454.126 67.948-326.182c2.213-8.262 8.707-15.161 16.965-12.948l27.316-0.333c8.531-2.287 17.301 2.776 19.588 11.31l46.665 148.4 127.337 0c8.835 0 15.993 7.162 15.993 15.993l0 31.986C895.667 537.352 888.508 544.51 879.674 544.51z",
|
|
298
|
-
fill: "currentColor"
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
),
|
|
302
|
-
map: /* @__PURE__ */ import_react.default.createElement(
|
|
303
|
-
"svg",
|
|
304
251
|
{
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
308
|
-
width: "1em",
|
|
309
|
-
height: "1em"
|
|
252
|
+
tag: [import_preset_code2.tags.null],
|
|
253
|
+
color: colors.null
|
|
310
254
|
},
|
|
311
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
312
|
-
"path",
|
|
313
|
-
{
|
|
314
|
-
d: "M877.860571 938.642286h-645.851428c-27.574857 0-54.052571-11.337143-73.508572-31.744a110.957714 110.957714 0 0 1-30.500571-76.8V193.828571c0-28.745143 10.971429-56.32 30.500571-76.726857a101.888 101.888 0 0 1 73.508572-31.817143h574.171428c27.501714 0 53.979429 11.337143 73.508572 31.744 19.529143 20.333714 30.500571 48.054857 30.500571 76.8v522.020572a34.157714 34.157714 0 0 1-6.948571 22.820571c-37.156571 19.382857-57.636571 39.350857-57.636572 72.630857 0 39.716571 19.894857 50.029714 57.636572 72.777143a34.816 34.816 0 0 1-8.045714 49.298286 32.256 32.256 0 0 1-17.334858 5.193143z m-32.256-254.537143V193.828571a40.228571 40.228571 0 0 0-39.497142-41.179428H232.009143a40.301714 40.301714 0 0 0-39.497143 41.252571V699.245714c17.773714-9.874286 37.449143-14.994286 57.417143-14.921143h595.675428v-0.073142z m-595.675428 187.245714h566.198857c-22.893714-11.190857-27.940571-39.497143-28.013714-59.977143 0-20.260571 3.218286-43.885714 28.013714-59.904h-566.125714c-31.670857 0-57.417143 26.843429-57.417143 59.977143 0 33.060571 25.746286 59.904 57.344 59.904z",
|
|
315
|
-
fill: "currentColor"
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
319
|
-
"path",
|
|
320
|
-
{
|
|
321
|
-
d: "M320 128m32.036571 0l-0.073142 0q32.036571 0 32.036571 32.036571l0 511.926858q0 32.036571-32.036571 32.036571l0.073142 0q-32.036571 0-32.036571-32.036571l0-511.926858q0-32.036571 32.036571-32.036571Z",
|
|
322
|
-
fill: "currentColor"
|
|
323
|
-
}
|
|
324
|
-
)
|
|
325
|
-
)
|
|
326
|
-
};
|
|
327
|
-
var ArrayIcons = {
|
|
328
|
-
object: /* @__PURE__ */ import_react.default.createElement(
|
|
329
|
-
"svg",
|
|
330
255
|
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
viewBox: "0 0 16 16",
|
|
334
|
-
fill: "none",
|
|
335
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
256
|
+
tag: [import_preset_code2.tags.separator],
|
|
257
|
+
color: colors.separator
|
|
336
258
|
},
|
|
337
|
-
|
|
338
|
-
"path",
|
|
339
|
-
{
|
|
340
|
-
fillRule: "evenodd",
|
|
341
|
-
clipRule: "evenodd",
|
|
342
|
-
d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM3.82031 5.9091C3.82031 5.18535 4.40703 4.59863 5.13078 4.59863C5.85453 4.59863 6.44124 5.18535 6.44124 5.9091C6.44124 6.56485 5.9596 7.1081 5.33078 7.2044V8.70018H5.32877C5.32982 8.75093 5.33078 8.80912 5.33078 8.87034V9.72111C5.33078 10.0195 5.57268 10.2614 5.87109 10.2614H6.24124C6.55613 10.2614 6.8114 10.5167 6.8114 10.8316C6.8114 11.1465 6.55613 11.4017 6.24124 11.4017H5.87109C4.94291 11.4017 4.19047 10.6493 4.19047 9.72111V6.82186C3.96158 6.58607 3.82031 6.26397 3.82031 5.9091ZM7.33679 5.9091C7.33679 5.59421 7.59205 5.33894 7.90694 5.33894H11.6085C11.9234 5.33894 12.1786 5.59421 12.1786 5.9091C12.1786 6.22399 11.9234 6.47925 11.6085 6.47925H7.90694C7.59205 6.47925 7.33679 6.22399 7.33679 5.9091ZM7.33679 9.86846C7.33679 9.55357 7.59205 9.2983 7.90694 9.2983H11.6085C11.9234 9.2983 12.1786 9.55357 12.1786 9.86846C12.1786 10.1833 11.9234 10.4386 11.6085 10.4386H7.90694C7.59205 10.4386 7.33679 10.1833 7.33679 9.86846Z",
|
|
343
|
-
fill: "currentColor"
|
|
344
|
-
}
|
|
345
|
-
)
|
|
346
|
-
),
|
|
347
|
-
boolean: /* @__PURE__ */ import_react.default.createElement(
|
|
348
|
-
"svg",
|
|
259
|
+
// markdown
|
|
349
260
|
{
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
viewBox: "0 0 16 16",
|
|
353
|
-
fill: "none",
|
|
354
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
261
|
+
tag: [import_preset_code2.tags.heading],
|
|
262
|
+
color: "#3e76ef"
|
|
355
263
|
},
|
|
356
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
357
|
-
"path",
|
|
358
|
-
{
|
|
359
|
-
fillRule: "evenodd",
|
|
360
|
-
clipRule: "evenodd",
|
|
361
|
-
d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM2.75 7.99993C2.75 6.14518 4.25358 4.6416 6.10833 4.6416H9.775C11.6298 4.6416 13.1333 6.14518 13.1333 7.99993C13.1333 9.85469 11.6298 11.3583 9.775 11.3583H6.10833C4.25358 11.3583 2.75 9.85469 2.75 7.99993ZM6.10833 5.85827C4.92552 5.85827 3.96667 6.81713 3.96667 7.99993C3.96667 9.18274 4.92552 10.1416 6.10833 10.1416H9.775C10.9578 10.1416 11.9167 9.18274 11.9167 7.99993C11.9167 6.81713 10.9578 5.85827 9.775 5.85827H6.10833ZM8.25 7.99993C8.25 7.1577 8.93277 6.47493 9.775 6.47493C10.6172 6.47493 11.3 7.1577 11.3 7.99993C11.3 8.84217 10.6172 9.52493 9.775 9.52493C8.93277 9.52493 8.25 8.84217 8.25 7.99993ZM9.775 7.6916C9.60471 7.6916 9.46667 7.82965 9.46667 7.99993C9.46667 8.17022 9.60471 8.30827 9.775 8.30827C9.94529 8.30827 10.0833 8.17022 10.0833 7.99993C10.0833 7.82965 9.94529 7.6916 9.775 7.6916Z",
|
|
362
|
-
fill: "currentColor"
|
|
363
|
-
}
|
|
364
|
-
)
|
|
365
|
-
),
|
|
366
|
-
string: /* @__PURE__ */ import_react.default.createElement(
|
|
367
|
-
"svg",
|
|
368
264
|
{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
viewBox: "0 0 16 16",
|
|
372
|
-
fill: "none",
|
|
373
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
265
|
+
tag: [import_preset_code2.tags.processingInstruction],
|
|
266
|
+
color: "#3e76ef"
|
|
374
267
|
},
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
{
|
|
378
|
-
fillRule: "evenodd",
|
|
379
|
-
clipRule: "evenodd",
|
|
380
|
-
d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM5.23701 4.07158C5.50364 3.3161 6.56205 3.28894 6.86709 4.02974L10 11.6383C10.1329 11.9609 9.979 12.3302 9.65631 12.4631C9.33363 12.596 8.96434 12.4421 8.83147 12.1194L7.8021 9.61951H4.61903L3.7474 12.0891C3.63126 12.4182 3.27034 12.5908 2.94127 12.4747C2.6122 12.3585 2.43958 11.9976 2.55573 11.6685L5.23701 4.07158ZM6.08814 5.45704L5.06505 8.35579H7.28174L6.08814 5.45704ZM8.81938 6.07534C8.81938 5.75166 9.08177 5.48926 9.40545 5.48926H12.8941C13.2178 5.48926 13.4802 5.75166 13.4802 6.07534C13.4802 6.39902 13.2178 6.66142 12.8941 6.66142H9.40545C9.08177 6.66142 8.81938 6.39902 8.81938 6.07534ZM10.2668 9.69181C10.2668 9.36812 10.5292 9.10573 10.8529 9.10573H12.8941C13.2178 9.10573 13.4802 9.36812 13.4802 9.69181C13.4802 10.0155 13.2178 10.2779 12.8941 10.2779H10.8529C10.5292 10.2779 10.2668 10.0155 10.2668 9.69181Z",
|
|
381
|
-
fill: "currentColor"
|
|
382
|
-
}
|
|
383
|
-
)
|
|
384
|
-
),
|
|
385
|
-
integer: /* @__PURE__ */ import_react.default.createElement(
|
|
386
|
-
"svg",
|
|
268
|
+
// shell
|
|
269
|
+
// curl
|
|
387
270
|
{
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
viewBox: "0 0 16 16",
|
|
391
|
-
fill: "none",
|
|
392
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
271
|
+
tag: [import_preset_code2.tags.standard(import_preset_code2.tags.variableName)],
|
|
272
|
+
color: "#00804A"
|
|
393
273
|
},
|
|
394
|
-
|
|
395
|
-
"path",
|
|
396
|
-
{
|
|
397
|
-
fillRule: "evenodd",
|
|
398
|
-
clipRule: "evenodd",
|
|
399
|
-
d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM10.3614 5.22374C10.7161 4.90585 11.1581 4.75 11.6762 4.75C12.2173 4.75 12.6723 4.91467 13.0281 5.25207L13.0291 5.253C13.3852 5.59688 13.561 6.03946 13.561 6.56767C13.561 6.89 13.4945 7.17448 13.3539 7.41445C13.2572 7.57972 13.1279 7.71948 12.9685 7.83428C13.1575 7.95643 13.3099 8.11182 13.4225 8.30109C13.5793 8.5644 13.6531 8.88311 13.6531 9.24936C13.6531 9.83787 13.4612 10.3151 13.0656 10.6612C12.6982 10.9795 12.2305 11.1341 11.6762 11.1341C11.1356 11.1341 10.6805 10.9925 10.324 10.6977C9.92124 10.3691 9.71723 9.90026 9.69942 9.31256L9.69473 9.15802H10.846L10.8539 9.2997C10.8689 9.5698 10.9591 9.75553 11.1096 9.87941L11.1106 9.88027C11.2519 9.99882 11.4365 10.0631 11.6762 10.0631C11.9765 10.0631 12.1743 9.98692 12.2984 9.86071C12.4229 9.73404 12.4984 9.53136 12.4984 9.22422C12.4984 8.92116 12.4215 8.72127 12.2939 8.59581C12.1658 8.46989 11.961 8.39373 11.6511 8.39373H11.3586V7.34788H11.6511C11.9297 7.34788 12.111 7.27834 12.2238 7.16555C12.3366 7.05276 12.4062 6.87138 12.4062 6.59281C12.4062 6.30696 12.3378 6.12041 12.2277 6.00501C12.1188 5.89092 11.9446 5.82098 11.6762 5.82098C11.4248 5.82098 11.2539 5.88537 11.1407 5.99325C11.0268 6.10185 10.9497 6.27522 10.9291 6.5375L10.9183 6.67577H9.76788L9.77492 6.51904C9.79886 5.98644 9.99237 5.54989 10.3614 5.22374ZM5.91032 5.26037C6.26612 4.92297 6.72112 4.7583 7.26219 4.7583C7.80751 4.7583 8.26297 4.91938 8.61401 5.25194L8.61501 5.25289C8.96719 5.59272 9.13852 6.04185 9.13852 6.58435C9.13852 6.84997 9.08709 7.09565 8.9817 7.31883L8.98114 7.31999C8.89563 7.49712 8.74775 7.71415 8.54418 7.96862L8.54322 7.96981L6.87446 10.0127H9.13852V11.0753H5.36909V10.1089L7.69946 7.27679C7.89456 7.04062 7.98374 6.80773 7.98374 6.57597C7.98374 6.29602 7.91626 6.11385 7.8078 6.00122C7.70036 5.88964 7.52811 5.8209 7.26219 5.8209C7.04017 5.8209 6.87439 5.88173 6.75075 5.99193C6.61227 6.11766 6.53226 6.30918 6.53226 6.59273V6.74273H5.37747V6.59273C5.37747 6.05443 5.55248 5.60586 5.90934 5.2613L5.91032 5.26037ZM3.50907 4.80865H4.56964V11.0754H3.41486V6.2201L2.25 7.24249V5.89561L3.50907 4.80865Z",
|
|
400
|
-
fill: "currentColor"
|
|
401
|
-
}
|
|
402
|
-
)
|
|
403
|
-
),
|
|
404
|
-
number: /* @__PURE__ */ import_react.default.createElement(
|
|
405
|
-
"svg",
|
|
274
|
+
// -X
|
|
406
275
|
{
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
viewBox: "0 0 16 16",
|
|
410
|
-
fill: "none",
|
|
411
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
276
|
+
tag: [import_preset_code2.tags.attributeName],
|
|
277
|
+
color: "#C74200"
|
|
412
278
|
},
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
)
|
|
423
|
-
};
|
|
424
|
-
var getSchemaIcon = (value) => {
|
|
425
|
-
if (value?.type === "array") {
|
|
426
|
-
return ArrayIcons[value.items?.type || "object"];
|
|
427
|
-
}
|
|
428
|
-
return VariableTypeIcons[value?.type || "object"];
|
|
429
|
-
};
|
|
430
|
-
var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
|
|
431
|
-
var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
432
|
-
var baseOptions = [
|
|
433
|
-
{
|
|
434
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "string" }) }), firstUppercase("string")),
|
|
435
|
-
value: "string"
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "integer" }) }), firstUppercase("integer")),
|
|
439
|
-
value: "integer"
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "number" }) }), firstUppercase("number")),
|
|
443
|
-
value: "number"
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "boolean" }) }), firstUppercase("boolean")),
|
|
447
|
-
value: "boolean"
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "object" }) }), firstUppercase("object")),
|
|
451
|
-
value: "object"
|
|
452
|
-
}
|
|
453
|
-
];
|
|
454
|
-
var options = [
|
|
455
|
-
...baseOptions,
|
|
456
|
-
{
|
|
457
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(import_semi_icons.default, { size: "small", svg: getSchemaIcon({ type: "array" }) }), firstUppercase("array")),
|
|
458
|
-
value: "array",
|
|
459
|
-
children: baseOptions.map((_opt) => ({
|
|
460
|
-
..._opt,
|
|
461
|
-
value: `${_opt.value}`,
|
|
462
|
-
label: /* @__PURE__ */ import_react.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react.default.createElement(
|
|
463
|
-
import_semi_icons.default,
|
|
464
|
-
{
|
|
465
|
-
size: "small",
|
|
466
|
-
svg: getSchemaIcon({ type: "array", items: { type: _opt.value } })
|
|
467
|
-
}
|
|
468
|
-
), firstUppercase(_opt.value))
|
|
469
|
-
}))
|
|
470
|
-
}
|
|
471
|
-
];
|
|
279
|
+
// url in string (includes quotes), e.g. "https://..."
|
|
280
|
+
{
|
|
281
|
+
tag: [import_preset_code2.tags.special(import_preset_code2.tags.string)],
|
|
282
|
+
color: "#2B57D9"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
});
|
|
472
286
|
|
|
473
|
-
// src/
|
|
474
|
-
var
|
|
475
|
-
var
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
287
|
+
// src/components/code-editor/theme/dark.ts
|
|
288
|
+
var import_preset_code3 = require("@coze-editor/editor/preset-code");
|
|
289
|
+
var colors2 = {
|
|
290
|
+
background: "#151B27",
|
|
291
|
+
// syntax
|
|
292
|
+
comment: "#FFFFFF63",
|
|
293
|
+
key: "#39E5D7",
|
|
294
|
+
string: "#FF94D2",
|
|
295
|
+
number: "#FF9933",
|
|
296
|
+
boolean: "#78B0FF",
|
|
297
|
+
null: "#78B0FF",
|
|
298
|
+
separator: "#FFFFFFC9"
|
|
299
|
+
};
|
|
300
|
+
var darkTheme = (0, import_preset_code3.createTheme)({
|
|
301
|
+
variant: "dark",
|
|
302
|
+
settings: {
|
|
303
|
+
background: colors2.background,
|
|
304
|
+
foreground: "#fff",
|
|
305
|
+
caret: "#AEAFAD",
|
|
306
|
+
selection: "#d9d9d942",
|
|
307
|
+
gutterBackground: colors2.background,
|
|
308
|
+
gutterForeground: "#FFFFFF63",
|
|
309
|
+
gutterBorderColor: "transparent",
|
|
310
|
+
gutterBorderWidth: 0,
|
|
311
|
+
lineHighlight: "#272e3d36",
|
|
312
|
+
bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
|
|
313
|
+
tooltip: {
|
|
314
|
+
backgroundColor: "#363D4D",
|
|
315
|
+
color: "#fff",
|
|
316
|
+
border: "none"
|
|
317
|
+
},
|
|
318
|
+
link: {
|
|
319
|
+
color: "#4daafc"
|
|
320
|
+
},
|
|
321
|
+
completionItemHover: {
|
|
322
|
+
backgroundColor: "#FFFFFF0F"
|
|
323
|
+
},
|
|
324
|
+
completionItemSelected: {
|
|
325
|
+
backgroundColor: "#FFFFFF17"
|
|
326
|
+
},
|
|
327
|
+
completionItemIcon: {
|
|
328
|
+
color: "#FFFFFFC9"
|
|
329
|
+
},
|
|
330
|
+
completionItemLabel: {
|
|
331
|
+
color: "#FFFFFFC9"
|
|
332
|
+
},
|
|
333
|
+
completionItemInfo: {
|
|
334
|
+
color: "#FFFFFFC9"
|
|
335
|
+
},
|
|
336
|
+
completionItemDetail: {
|
|
337
|
+
color: "#FFFFFF63"
|
|
483
338
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
339
|
+
},
|
|
340
|
+
styles: [
|
|
341
|
+
// json
|
|
342
|
+
{
|
|
343
|
+
tag: import_preset_code3.tags.comment,
|
|
344
|
+
color: colors2.comment
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
tag: [import_preset_code3.tags.propertyName],
|
|
348
|
+
color: colors2.key
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
tag: [import_preset_code3.tags.string],
|
|
352
|
+
color: colors2.string
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
tag: [import_preset_code3.tags.number],
|
|
356
|
+
color: colors2.number
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
tag: [import_preset_code3.tags.bool],
|
|
360
|
+
color: colors2.boolean
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
tag: [import_preset_code3.tags.null],
|
|
364
|
+
color: colors2.null
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
tag: [import_preset_code3.tags.separator],
|
|
368
|
+
color: colors2.separator
|
|
369
|
+
},
|
|
370
|
+
// markdown
|
|
371
|
+
{
|
|
372
|
+
tag: [import_preset_code3.tags.heading],
|
|
373
|
+
color: "#6b6bff"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
tag: [import_preset_code3.tags.processingInstruction],
|
|
377
|
+
color: "#6b6bff"
|
|
378
|
+
},
|
|
379
|
+
// shell
|
|
380
|
+
// curl
|
|
381
|
+
{
|
|
382
|
+
tag: [import_preset_code3.tags.standard(import_preset_code3.tags.variableName)],
|
|
383
|
+
color: "#3BEB84"
|
|
384
|
+
},
|
|
385
|
+
// -X
|
|
386
|
+
{
|
|
387
|
+
tag: [import_preset_code3.tags.attributeName],
|
|
388
|
+
color: "#FF9933"
|
|
389
|
+
},
|
|
390
|
+
// url in string (includes quotes), e.g. "https://..."
|
|
391
|
+
{
|
|
392
|
+
tag: [import_preset_code3.tags.special(import_preset_code3.tags.string)],
|
|
393
|
+
color: "#78B0FF"
|
|
532
394
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
395
|
+
]
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// src/components/code-editor/theme/index.ts
|
|
399
|
+
import_preset_code4.themes.register("dark", darkTheme);
|
|
400
|
+
import_preset_code4.themes.register("light", lightTheme);
|
|
401
|
+
|
|
402
|
+
// src/components/code-editor/index.tsx
|
|
403
|
+
var OriginCodeEditor = (0, import_react3.createRenderer)(import_preset_code5.default, [
|
|
404
|
+
import_view.EditorView.theme({
|
|
405
|
+
"&.cm-focused": {
|
|
406
|
+
outline: "none"
|
|
537
407
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
408
|
+
})
|
|
409
|
+
]);
|
|
410
|
+
function CodeEditor({
|
|
411
|
+
value,
|
|
412
|
+
onChange,
|
|
413
|
+
languageId = "python",
|
|
414
|
+
theme = "light",
|
|
415
|
+
children,
|
|
416
|
+
placeholder,
|
|
417
|
+
activeLinePlaceholder,
|
|
418
|
+
options,
|
|
419
|
+
readonly
|
|
420
|
+
}) {
|
|
421
|
+
const editorRef = (0, import_react2.useRef)(null);
|
|
422
|
+
(0, import_react2.useEffect)(() => {
|
|
423
|
+
if (languageId === "typescript") {
|
|
424
|
+
initTsWorker();
|
|
542
425
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
426
|
+
}, [languageId]);
|
|
427
|
+
(0, import_react2.useEffect)(() => {
|
|
428
|
+
if (editorRef.current?.getValue() !== value) {
|
|
429
|
+
editorRef.current?.setValue(String(value || ""));
|
|
547
430
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
431
|
+
}, [value]);
|
|
432
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react3.EditorProvider, null, /* @__PURE__ */ import_react2.default.createElement(
|
|
433
|
+
OriginCodeEditor,
|
|
434
|
+
{
|
|
435
|
+
defaultValue: value,
|
|
436
|
+
options: {
|
|
437
|
+
uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
|
|
438
|
+
languageId,
|
|
439
|
+
theme,
|
|
440
|
+
placeholder,
|
|
441
|
+
readOnly: readonly,
|
|
442
|
+
editable: !readonly,
|
|
443
|
+
...options || {}
|
|
444
|
+
},
|
|
445
|
+
didMount: (editor) => {
|
|
446
|
+
editorRef.current = editor;
|
|
447
|
+
},
|
|
448
|
+
onChange: (e) => onChange?.(e.value)
|
|
449
|
+
},
|
|
450
|
+
activeLinePlaceholder && /* @__PURE__ */ import_react2.default.createElement(import_react3.ActiveLinePlaceholder, null, activeLinePlaceholder),
|
|
451
|
+
children
|
|
452
|
+
));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// src/components/code-editor-mini/index.tsx
|
|
456
|
+
var UIMini = import_styled_components.default.div`
|
|
457
|
+
.ͼ1 .cm-content {
|
|
458
|
+
padding: 0;
|
|
459
|
+
}
|
|
460
|
+
`;
|
|
461
|
+
function CodeEditorMini(props) {
|
|
462
|
+
return /* @__PURE__ */ import_react4.default.createElement(UIMini, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
463
|
+
CodeEditor,
|
|
464
|
+
{
|
|
465
|
+
...props,
|
|
466
|
+
options: {
|
|
467
|
+
lineNumbersGutter: false,
|
|
468
|
+
foldGutter: false,
|
|
469
|
+
...props.options || {}
|
|
470
|
+
}
|
|
564
471
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
472
|
+
));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/plugins/json-schema-preset/type-definition/object.tsx
|
|
476
|
+
var objectRegistry = {
|
|
477
|
+
type: "object",
|
|
478
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react5.default.createElement(
|
|
479
|
+
CodeEditorMini,
|
|
480
|
+
{
|
|
481
|
+
value: props.value,
|
|
482
|
+
onChange: (v) => props.onChange?.(v),
|
|
483
|
+
languageId: "json",
|
|
484
|
+
placeholder: "Please Input Object",
|
|
485
|
+
readonly: props.readonly
|
|
570
486
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
487
|
+
)
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
// src/plugins/json-schema-preset/type-definition/number.tsx
|
|
491
|
+
var import_react6 = __toESM(require("react"));
|
|
492
|
+
var import_semi_ui2 = require("@douyinfe/semi-ui");
|
|
493
|
+
var numberRegistry = {
|
|
494
|
+
type: "number",
|
|
495
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react6.default.createElement(
|
|
496
|
+
import_semi_ui2.InputNumber,
|
|
497
|
+
{
|
|
498
|
+
placeholder: "Please Input Number",
|
|
499
|
+
size: "small",
|
|
500
|
+
disabled: props.readonly,
|
|
501
|
+
hideButtons: true,
|
|
502
|
+
...props
|
|
576
503
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
504
|
+
)
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
// src/plugins/json-schema-preset/type-definition/integer.tsx
|
|
508
|
+
var import_react7 = __toESM(require("react"));
|
|
509
|
+
var import_semi_ui3 = require("@douyinfe/semi-ui");
|
|
510
|
+
var integerRegistry = {
|
|
511
|
+
type: "integer",
|
|
512
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react7.default.createElement(
|
|
513
|
+
import_semi_ui3.InputNumber,
|
|
514
|
+
{
|
|
515
|
+
placeholder: "Please Input Integer",
|
|
516
|
+
size: "small",
|
|
517
|
+
disabled: props.readonly,
|
|
518
|
+
precision: 0,
|
|
519
|
+
...props
|
|
581
520
|
}
|
|
582
|
-
|
|
521
|
+
)
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
// src/plugins/json-schema-preset/type-definition/boolean.tsx
|
|
525
|
+
var import_react8 = __toESM(require("react"));
|
|
526
|
+
var import_semi_ui4 = require("@douyinfe/semi-ui");
|
|
527
|
+
var booleanRegistry = {
|
|
528
|
+
type: "boolean",
|
|
529
|
+
ConstantRenderer: (props) => {
|
|
530
|
+
const { value, onChange, ...rest } = props;
|
|
531
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
532
|
+
import_semi_ui4.Select,
|
|
533
|
+
{
|
|
534
|
+
placeholder: "Please Select Boolean",
|
|
535
|
+
size: "small",
|
|
536
|
+
disabled: props.readonly,
|
|
537
|
+
optionList: [
|
|
538
|
+
{ label: "True", value: 1 },
|
|
539
|
+
{ label: "False", value: 0 }
|
|
540
|
+
],
|
|
541
|
+
value: value ? 1 : 0,
|
|
542
|
+
onChange: (value2) => onChange?.(!!value2),
|
|
543
|
+
...rest
|
|
544
|
+
}
|
|
545
|
+
);
|
|
583
546
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// src/plugins/json-schema-preset/type-definition/array.tsx
|
|
550
|
+
var import_react9 = __toESM(require("react"));
|
|
551
|
+
var arrayRegistry = {
|
|
552
|
+
type: "array",
|
|
553
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react9.default.createElement(
|
|
554
|
+
CodeEditorMini,
|
|
555
|
+
{
|
|
556
|
+
value: props.value,
|
|
557
|
+
languageId: "json",
|
|
558
|
+
onChange: (v) => props.onChange?.(v),
|
|
559
|
+
placeholder: "Please Input Array",
|
|
560
|
+
readonly: props.readonly
|
|
592
561
|
}
|
|
593
|
-
|
|
562
|
+
)
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
// src/plugins/json-schema-preset/type-definition/index.tsx
|
|
566
|
+
var jsonSchemaTypePreset = [
|
|
567
|
+
stringRegistry,
|
|
568
|
+
objectRegistry,
|
|
569
|
+
numberRegistry,
|
|
570
|
+
integerRegistry,
|
|
571
|
+
booleanRegistry,
|
|
572
|
+
arrayRegistry
|
|
573
|
+
];
|
|
574
|
+
jsonSchemaTypePreset.forEach((_type) => import_json_schema.jsonSchemaTypeManager.register(_type));
|
|
575
|
+
|
|
576
|
+
// src/plugins/json-schema-preset/create-type-preset-plugin.tsx
|
|
577
|
+
var import_json_schema2 = require("@flowgram.ai/json-schema");
|
|
578
|
+
var import_editor2 = require("@flowgram.ai/editor");
|
|
579
|
+
var createTypePresetPlugin = (0, import_editor2.definePluginCreator)({
|
|
580
|
+
onInit(ctx, opts) {
|
|
581
|
+
const typeManager = ctx.get(import_json_schema2.BaseTypeManager);
|
|
582
|
+
jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
|
|
583
|
+
opts.types?.forEach((_type) => typeManager.register(_type));
|
|
584
|
+
opts.unregisterTypes?.forEach((_type) => typeManager.unregister(_type));
|
|
585
|
+
},
|
|
586
|
+
containerModules: [import_json_schema2.jsonSchemaContainerModule]
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
// src/plugins/json-schema-preset/index.tsx
|
|
590
|
+
var useTypeManager = () => (0, import_json_schema3.useTypeManager)();
|
|
591
|
+
var JsonSchemaTypePresetProvider = ({
|
|
592
|
+
types = [],
|
|
593
|
+
children
|
|
594
|
+
}) => /* @__PURE__ */ import_react10.default.createElement(import_json_schema3.TypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
|
|
595
|
+
|
|
596
|
+
// src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts
|
|
597
|
+
var import_editor3 = require("@flowgram.ai/editor");
|
|
598
|
+
var createDisableDeclarationPlugin = (0, import_editor3.definePluginCreator)({
|
|
599
|
+
onInit(ctx) {
|
|
600
|
+
const variableEngine = ctx.get(import_editor3.VariableEngine);
|
|
601
|
+
const handleEvent = (action) => {
|
|
602
|
+
if (import_editor3.ASTMatch.isVariableDeclaration(action.ast)) {
|
|
603
|
+
if (!action.ast.meta?.disabled) {
|
|
604
|
+
action.ast.updateMeta({
|
|
605
|
+
...action.ast.meta || {},
|
|
606
|
+
disabled: true
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
variableEngine.onGlobalEvent("NewAST", handleEvent);
|
|
612
|
+
variableEngine.onGlobalEvent("UpdateAST", handleEvent);
|
|
594
613
|
}
|
|
595
|
-
|
|
596
|
-
})(JsonSchemaUtils || (JsonSchemaUtils = {}));
|
|
614
|
+
});
|
|
597
615
|
|
|
598
616
|
// src/components/variable-selector/use-variable-tree.tsx
|
|
599
617
|
function useVariableTree(params) {
|
|
600
618
|
const { includeSchema, excludeSchema, customSkip } = params;
|
|
601
|
-
const
|
|
602
|
-
const
|
|
619
|
+
const typeManager = useTypeManager();
|
|
620
|
+
const variables = (0, import_editor4.useAvailableVariables)();
|
|
621
|
+
const getVariableTypeIcon = (0, import_react11.useCallback)((variable) => {
|
|
603
622
|
if (variable.meta?.icon) {
|
|
604
623
|
if (typeof variable.meta.icon === "string") {
|
|
605
|
-
return /* @__PURE__ */
|
|
624
|
+
return /* @__PURE__ */ import_react11.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
|
|
606
625
|
}
|
|
607
626
|
return variable.meta.icon;
|
|
608
627
|
}
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
612
|
-
import_semi_ui.Icon,
|
|
613
|
-
{
|
|
614
|
-
size: "small",
|
|
615
|
-
svg: ArrayIcons[_type.items?.kind.toLowerCase()] || VariableTypeIcons.array
|
|
616
|
-
}
|
|
617
|
-
);
|
|
618
|
-
}
|
|
619
|
-
if (import_editor2.ASTMatch.isCustomType(_type)) {
|
|
620
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_semi_ui.Icon, { size: "small", svg: VariableTypeIcons[_type.typeName.toLowerCase()] });
|
|
621
|
-
}
|
|
622
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_semi_ui.Icon, { size: "small", svg: VariableTypeIcons[variable.type?.kind.toLowerCase()] });
|
|
628
|
+
const schema = import_json_schema4.JsonSchemaUtils.astToSchema(variable.type, { drilldownObject: false });
|
|
629
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_semi_ui5.Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
|
|
623
630
|
}, []);
|
|
624
631
|
const renderVariable = (variable, parentFields = []) => {
|
|
625
632
|
let type = variable?.type;
|
|
@@ -627,15 +634,16 @@ function useVariableTree(params) {
|
|
|
627
634
|
return null;
|
|
628
635
|
}
|
|
629
636
|
let children;
|
|
630
|
-
if (
|
|
637
|
+
if (import_editor4.ASTMatch.isObject(type)) {
|
|
631
638
|
children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
|
|
632
639
|
}
|
|
633
640
|
const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
|
|
634
641
|
const key = keyPath.join(".");
|
|
635
|
-
const isSchemaInclude = includeSchema ? JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
|
|
636
|
-
const isSchemaExclude = excludeSchema ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
|
|
642
|
+
const isSchemaInclude = includeSchema ? import_json_schema4.JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
|
|
643
|
+
const isSchemaExclude = excludeSchema ? import_json_schema4.JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
|
|
637
644
|
const isCustomSkip = customSkip ? customSkip(variable) : false;
|
|
638
|
-
const
|
|
645
|
+
const isMetaDisabled = variable.meta?.disabled;
|
|
646
|
+
const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
|
|
639
647
|
if (!isSchemaMatch && !children?.length) {
|
|
640
648
|
return null;
|
|
641
649
|
}
|
|
@@ -655,9 +663,9 @@ function useVariableTree(params) {
|
|
|
655
663
|
}
|
|
656
664
|
|
|
657
665
|
// src/components/variable-selector/styles.tsx
|
|
658
|
-
var
|
|
659
|
-
var
|
|
660
|
-
var UIRootTitle =
|
|
666
|
+
var import_styled_components2 = __toESM(require("styled-components"));
|
|
667
|
+
var import_semi_ui6 = require("@douyinfe/semi-ui");
|
|
668
|
+
var UIRootTitle = import_styled_components2.default.div`
|
|
661
669
|
margin-right: 4px;
|
|
662
670
|
min-width: 20px;
|
|
663
671
|
overflow: hidden;
|
|
@@ -665,16 +673,16 @@ var UIRootTitle = import_styled_components.default.div`
|
|
|
665
673
|
white-space: nowrap;
|
|
666
674
|
color: var(--semi-color-text-2);
|
|
667
675
|
`;
|
|
668
|
-
var UIVarName =
|
|
676
|
+
var UIVarName = import_styled_components2.default.div`
|
|
669
677
|
overflow: hidden;
|
|
670
678
|
text-overflow: ellipsis;
|
|
671
679
|
white-space: nowrap;
|
|
672
680
|
|
|
673
|
-
${({ $inSelector }) => $inSelector &&
|
|
681
|
+
${({ $inSelector }) => $inSelector && import_styled_components2.css`
|
|
674
682
|
min-width: 50%;
|
|
675
683
|
`}
|
|
676
684
|
`;
|
|
677
|
-
var UITag = (0,
|
|
685
|
+
var UITag = (0, import_styled_components2.default)(import_semi_ui6.Tag)`
|
|
678
686
|
width: 100%;
|
|
679
687
|
display: flex;
|
|
680
688
|
align-items: center;
|
|
@@ -689,7 +697,7 @@ var UITag = (0, import_styled_components.default)(import_semi_ui2.Tag)`
|
|
|
689
697
|
height: 22px;
|
|
690
698
|
}
|
|
691
699
|
`;
|
|
692
|
-
var UITreeSelect = (0,
|
|
700
|
+
var UITreeSelect = (0, import_styled_components2.default)(import_semi_ui6.TreeSelect)`
|
|
693
701
|
outline: ${({ $error }) => $error ? "1px solid red" : "none"};
|
|
694
702
|
|
|
695
703
|
& .semi-tree-select-selection {
|
|
@@ -705,7 +713,7 @@ var UITreeSelect = (0, import_styled_components.default)(import_semi_ui2.TreeSel
|
|
|
705
713
|
padding-left: 10px;
|
|
706
714
|
}
|
|
707
715
|
`;
|
|
708
|
-
var UIPopoverContent =
|
|
716
|
+
var UIPopoverContent = import_styled_components2.default.div`
|
|
709
717
|
padding: 10px;
|
|
710
718
|
display: inline-flex;
|
|
711
719
|
align-items: center;
|
|
@@ -726,7 +734,7 @@ var VariableSelector = ({
|
|
|
726
734
|
triggerRender
|
|
727
735
|
}) => {
|
|
728
736
|
const treeData = useVariableTree({ includeSchema, excludeSchema });
|
|
729
|
-
const treeValue = (0,
|
|
737
|
+
const treeValue = (0, import_react12.useMemo)(() => {
|
|
730
738
|
if (typeof value === "string") {
|
|
731
739
|
console.warn(
|
|
732
740
|
"The Value of VariableSelector is a string, it should be an ARRAY. \n",
|
|
@@ -738,11 +746,11 @@ var VariableSelector = ({
|
|
|
738
746
|
}, [value]);
|
|
739
747
|
const renderIcon = (icon) => {
|
|
740
748
|
if (typeof icon === "string") {
|
|
741
|
-
return /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ import_react12.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
742
750
|
}
|
|
743
751
|
return icon;
|
|
744
752
|
};
|
|
745
|
-
return /* @__PURE__ */
|
|
753
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement(
|
|
746
754
|
UITreeSelect,
|
|
747
755
|
{
|
|
748
756
|
dropdownMatchSelectWidth: false,
|
|
@@ -759,10 +767,10 @@ var VariableSelector = ({
|
|
|
759
767
|
},
|
|
760
768
|
renderSelectedItem: (_option) => {
|
|
761
769
|
if (!_option?.keyPath) {
|
|
762
|
-
return /* @__PURE__ */
|
|
770
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
763
771
|
UITag,
|
|
764
772
|
{
|
|
765
|
-
prefixIcon: /* @__PURE__ */
|
|
773
|
+
prefixIcon: /* @__PURE__ */ import_react12.default.createElement(import_semi_icons.IconIssueStroked, null),
|
|
766
774
|
color: "amber",
|
|
767
775
|
closable: !readonly,
|
|
768
776
|
onClose: () => onChange(void 0)
|
|
@@ -771,13 +779,13 @@ var VariableSelector = ({
|
|
|
771
779
|
);
|
|
772
780
|
}
|
|
773
781
|
const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
|
|
774
|
-
const rootTitle = /* @__PURE__ */
|
|
775
|
-
return /* @__PURE__ */
|
|
776
|
-
|
|
782
|
+
const rootTitle = /* @__PURE__ */ import_react12.default.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
|
|
783
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement(
|
|
784
|
+
import_semi_ui7.Popover,
|
|
777
785
|
{
|
|
778
|
-
content: /* @__PURE__ */
|
|
786
|
+
content: /* @__PURE__ */ import_react12.default.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ import_react12.default.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
|
|
779
787
|
},
|
|
780
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
781
789
|
UITag,
|
|
782
790
|
{
|
|
783
791
|
prefixIcon: rootIcon,
|
|
@@ -785,12 +793,12 @@ var VariableSelector = ({
|
|
|
785
793
|
onClose: () => onChange(void 0)
|
|
786
794
|
},
|
|
787
795
|
rootTitle,
|
|
788
|
-
!_option.isRoot && /* @__PURE__ */
|
|
796
|
+
!_option.isRoot && /* @__PURE__ */ import_react12.default.createElement(UIVarName, { $inSelector: true }, _option.label)
|
|
789
797
|
)
|
|
790
798
|
));
|
|
791
799
|
},
|
|
792
800
|
showClear: false,
|
|
793
|
-
arrowIcon: /* @__PURE__ */
|
|
801
|
+
arrowIcon: /* @__PURE__ */ import_react12.default.createElement(import_semi_icons.IconChevronDownStroked, { size: "small" }),
|
|
794
802
|
triggerRender,
|
|
795
803
|
placeholder: config?.placeholder ?? "Select Variable..."
|
|
796
804
|
}
|
|
@@ -798,8 +806,10 @@ var VariableSelector = ({
|
|
|
798
806
|
};
|
|
799
807
|
|
|
800
808
|
// src/components/type-selector/index.tsx
|
|
801
|
-
var
|
|
802
|
-
var
|
|
809
|
+
var import_react13 = __toESM(require("react"));
|
|
810
|
+
var import_semi_ui8 = require("@douyinfe/semi-ui");
|
|
811
|
+
var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
|
|
812
|
+
var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
803
813
|
var getTypeSelectValue = (value) => {
|
|
804
814
|
if (value?.type === "array" && value?.items) {
|
|
805
815
|
return [value.type, ...getTypeSelectValue(value.items) || []];
|
|
@@ -815,21 +825,38 @@ var parseTypeSelectValue = (value) => {
|
|
|
815
825
|
};
|
|
816
826
|
function TypeSelector(props) {
|
|
817
827
|
const { value, onChange, readonly, disabled, style } = props;
|
|
818
|
-
const selectValue = (0,
|
|
819
|
-
|
|
820
|
-
|
|
828
|
+
const selectValue = (0, import_react13.useMemo)(() => getTypeSelectValue(value), [value]);
|
|
829
|
+
const typeManager = useTypeManager();
|
|
830
|
+
const icon = typeManager.getDisplayIcon(value || {});
|
|
831
|
+
const options = (0, import_react13.useMemo)(
|
|
832
|
+
() => typeManager.getTypeRegistriesWithParentType().map((_type) => {
|
|
833
|
+
const isArray2 = _type.type === "array";
|
|
834
|
+
return {
|
|
835
|
+
label: /* @__PURE__ */ import_react13.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react13.default.createElement(import_semi_ui8.Icon, { size: "small", svg: _type.icon }), firstUppercase(_type.type)),
|
|
836
|
+
value: _type.type,
|
|
837
|
+
children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
|
|
838
|
+
label: /* @__PURE__ */ import_react13.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react13.default.createElement(
|
|
839
|
+
import_semi_ui8.Icon,
|
|
840
|
+
{
|
|
841
|
+
size: "small",
|
|
842
|
+
svg: typeManager.getDisplayIcon({
|
|
843
|
+
type: "array",
|
|
844
|
+
items: { type: _type2.type }
|
|
845
|
+
})
|
|
846
|
+
}
|
|
847
|
+
), firstUppercase(_type2.type)),
|
|
848
|
+
value: _type2.type
|
|
849
|
+
})) : []
|
|
850
|
+
};
|
|
851
|
+
}),
|
|
852
|
+
[]
|
|
853
|
+
);
|
|
854
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
855
|
+
import_semi_ui8.Cascader,
|
|
821
856
|
{
|
|
822
857
|
disabled: readonly || disabled,
|
|
823
858
|
size: "small",
|
|
824
|
-
triggerRender: () => /* @__PURE__ */
|
|
825
|
-
import_semi_ui4.IconButton,
|
|
826
|
-
{
|
|
827
|
-
size: "small",
|
|
828
|
-
style,
|
|
829
|
-
disabled: readonly || disabled,
|
|
830
|
-
icon: getSchemaIcon(value)
|
|
831
|
-
}
|
|
832
|
-
),
|
|
859
|
+
triggerRender: () => /* @__PURE__ */ import_react13.default.createElement(import_semi_ui8.IconButton, { size: "small", style, disabled: readonly || disabled, icon }),
|
|
833
860
|
treeData: options,
|
|
834
861
|
value: selectValue,
|
|
835
862
|
leafOnly: true,
|
|
@@ -841,50 +868,50 @@ function TypeSelector(props) {
|
|
|
841
868
|
}
|
|
842
869
|
|
|
843
870
|
// src/components/json-schema-editor/index.tsx
|
|
844
|
-
var
|
|
845
|
-
var
|
|
846
|
-
var
|
|
871
|
+
var import_react19 = __toESM(require("react"));
|
|
872
|
+
var import_semi_ui11 = require("@douyinfe/semi-ui");
|
|
873
|
+
var import_semi_icons4 = require("@douyinfe/semi-icons");
|
|
847
874
|
|
|
848
875
|
// src/components/json-schema-editor/styles.tsx
|
|
849
|
-
var
|
|
850
|
-
var
|
|
851
|
-
var
|
|
852
|
-
var UIContainer =
|
|
876
|
+
var import_react14 = __toESM(require("react"));
|
|
877
|
+
var import_styled_components3 = __toESM(require("styled-components"));
|
|
878
|
+
var import_semi_icons2 = __toESM(require("@douyinfe/semi-icons"));
|
|
879
|
+
var UIContainer = import_styled_components3.default.div`
|
|
853
880
|
/* & .semi-input {
|
|
854
881
|
background-color: #fff;
|
|
855
882
|
border-radius: 6px;
|
|
856
883
|
height: 24px;
|
|
857
884
|
} */
|
|
858
885
|
`;
|
|
859
|
-
var UIRow =
|
|
886
|
+
var UIRow = import_styled_components3.default.div`
|
|
860
887
|
display: flex;
|
|
861
888
|
align-items: center;
|
|
862
889
|
gap: 6px;
|
|
863
890
|
`;
|
|
864
|
-
var UICollapseTrigger =
|
|
891
|
+
var UICollapseTrigger = import_styled_components3.default.div`
|
|
865
892
|
cursor: pointer;
|
|
866
893
|
margin-right: 5px;
|
|
867
894
|
`;
|
|
868
|
-
var UIExpandDetail =
|
|
895
|
+
var UIExpandDetail = import_styled_components3.default.div`
|
|
869
896
|
display: flex;
|
|
870
897
|
flex-direction: column;
|
|
871
898
|
`;
|
|
872
|
-
var UILabel =
|
|
899
|
+
var UILabel = import_styled_components3.default.div`
|
|
873
900
|
font-size: 12px;
|
|
874
901
|
color: #999;
|
|
875
902
|
font-weight: 400;
|
|
876
903
|
margin-bottom: 2px;
|
|
877
904
|
`;
|
|
878
|
-
var UIProperties =
|
|
905
|
+
var UIProperties = import_styled_components3.default.div`
|
|
879
906
|
display: grid;
|
|
880
907
|
grid-template-columns: auto 1fr;
|
|
881
908
|
|
|
882
|
-
${({ $shrink }) => $shrink &&
|
|
909
|
+
${({ $shrink }) => $shrink && import_styled_components3.css`
|
|
883
910
|
padding-left: 10px;
|
|
884
911
|
margin-top: 10px;
|
|
885
912
|
`}
|
|
886
913
|
`;
|
|
887
|
-
var UIPropertyLeft =
|
|
914
|
+
var UIPropertyLeft = import_styled_components3.default.div`
|
|
888
915
|
grid-column: 1;
|
|
889
916
|
position: relative;
|
|
890
917
|
width: 16px;
|
|
@@ -894,7 +921,7 @@ var UIPropertyLeft = import_styled_components2.default.div`
|
|
|
894
921
|
if ($parentType && $isLast) {
|
|
895
922
|
height = "24px";
|
|
896
923
|
}
|
|
897
|
-
return $showLine &&
|
|
924
|
+
return $showLine && import_styled_components3.css`
|
|
898
925
|
&::before {
|
|
899
926
|
/* 竖线 */
|
|
900
927
|
content: '';
|
|
@@ -921,7 +948,7 @@ var UIPropertyLeft = import_styled_components2.default.div`
|
|
|
921
948
|
`;
|
|
922
949
|
}}
|
|
923
950
|
`;
|
|
924
|
-
var UIPropertyRight =
|
|
951
|
+
var UIPropertyRight = import_styled_components3.default.div`
|
|
925
952
|
grid-column: 2;
|
|
926
953
|
margin-bottom: 10px;
|
|
927
954
|
|
|
@@ -929,7 +956,7 @@ var UIPropertyRight = import_styled_components2.default.div`
|
|
|
929
956
|
margin-bottom: 0px;
|
|
930
957
|
}
|
|
931
958
|
`;
|
|
932
|
-
var UIPropertyMain =
|
|
959
|
+
var UIPropertyMain = import_styled_components3.default.div`
|
|
933
960
|
display: flex;
|
|
934
961
|
flex-direction: column;
|
|
935
962
|
gap: 10px;
|
|
@@ -948,33 +975,33 @@ var UIPropertyMain = import_styled_components2.default.div`
|
|
|
948
975
|
background: #d9d9d9;
|
|
949
976
|
display: block;
|
|
950
977
|
}`;
|
|
951
|
-
return $expand &&
|
|
978
|
+
return $expand && import_styled_components3.css`
|
|
952
979
|
background-color: #f5f5f5;
|
|
953
980
|
padding: 10px;
|
|
954
981
|
border-radius: 4px;
|
|
955
982
|
|
|
956
|
-
${$showCollapse && $collapse && (type === "array" || type === "object") &&
|
|
983
|
+
${$showCollapse && $collapse && (type === "array" || type === "object") && import_styled_components3.css`
|
|
957
984
|
${beforeElement}
|
|
958
985
|
`}
|
|
959
986
|
`;
|
|
960
987
|
}}
|
|
961
988
|
`;
|
|
962
|
-
var UICollapsible =
|
|
989
|
+
var UICollapsible = import_styled_components3.default.div`
|
|
963
990
|
display: none;
|
|
964
991
|
|
|
965
|
-
${({ $collapse }) => $collapse &&
|
|
992
|
+
${({ $collapse }) => $collapse && import_styled_components3.css`
|
|
966
993
|
display: block;
|
|
967
994
|
`}
|
|
968
995
|
`;
|
|
969
|
-
var UIName =
|
|
996
|
+
var UIName = import_styled_components3.default.div`
|
|
970
997
|
flex-grow: 1;
|
|
971
998
|
`;
|
|
972
|
-
var UIType =
|
|
973
|
-
var UIRequired =
|
|
974
|
-
var UIActions =
|
|
999
|
+
var UIType = import_styled_components3.default.div``;
|
|
1000
|
+
var UIRequired = import_styled_components3.default.div``;
|
|
1001
|
+
var UIActions = import_styled_components3.default.div`
|
|
975
1002
|
white-space: nowrap;
|
|
976
1003
|
`;
|
|
977
|
-
var iconAddChildrenSvg = /* @__PURE__ */
|
|
1004
|
+
var iconAddChildrenSvg = /* @__PURE__ */ import_react14.default.createElement(
|
|
978
1005
|
"svg",
|
|
979
1006
|
{
|
|
980
1007
|
className: "icon-icon icon-icon-coz_add_node ",
|
|
@@ -984,7 +1011,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ import_react5.default.createElement(
|
|
|
984
1011
|
fill: "currentColor",
|
|
985
1012
|
xmlns: "http://www.w3.org/2000/svg"
|
|
986
1013
|
},
|
|
987
|
-
/* @__PURE__ */
|
|
1014
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
988
1015
|
"path",
|
|
989
1016
|
{
|
|
990
1017
|
fillRule: "evenodd",
|
|
@@ -992,19 +1019,19 @@ var iconAddChildrenSvg = /* @__PURE__ */ import_react5.default.createElement(
|
|
|
992
1019
|
d: "M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
|
|
993
1020
|
}
|
|
994
1021
|
),
|
|
995
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ import_react14.default.createElement("path", { d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z" })
|
|
996
1023
|
);
|
|
997
|
-
var IconAddChildren = () => /* @__PURE__ */
|
|
998
|
-
var DefaultValueWrapper =
|
|
1024
|
+
var IconAddChildren = () => /* @__PURE__ */ import_react14.default.createElement(import_semi_icons2.default, { size: "small", svg: iconAddChildrenSvg });
|
|
1025
|
+
var DefaultValueWrapper = import_styled_components3.default.div`
|
|
999
1026
|
margin: 0;
|
|
1000
1027
|
`;
|
|
1001
|
-
var JSONViewerWrapper =
|
|
1028
|
+
var JSONViewerWrapper = import_styled_components3.default.div`
|
|
1002
1029
|
padding: 0 0 24px;
|
|
1003
1030
|
&:first-child {
|
|
1004
1031
|
margin-top: 0px;
|
|
1005
1032
|
}
|
|
1006
1033
|
`;
|
|
1007
|
-
var JSONHeader =
|
|
1034
|
+
var JSONHeader = import_styled_components3.default.div`
|
|
1008
1035
|
display: flex;
|
|
1009
1036
|
justify-content: space-between;
|
|
1010
1037
|
align-items: center;
|
|
@@ -1013,17 +1040,17 @@ var JSONHeader = import_styled_components2.default.div`
|
|
|
1013
1040
|
height: 36px;
|
|
1014
1041
|
padding: 0 8px 0 12px;
|
|
1015
1042
|
`;
|
|
1016
|
-
var JSONHeaderLeft =
|
|
1043
|
+
var JSONHeaderLeft = import_styled_components3.default.div`
|
|
1017
1044
|
display: flex;
|
|
1018
1045
|
align-items: center;
|
|
1019
1046
|
gap: 10px;
|
|
1020
1047
|
`;
|
|
1021
|
-
var JSONHeaderRight =
|
|
1048
|
+
var JSONHeaderRight = import_styled_components3.default.div`
|
|
1022
1049
|
display: flex;
|
|
1023
1050
|
align-items: center;
|
|
1024
1051
|
gap: 10px;
|
|
1025
1052
|
`;
|
|
1026
|
-
var ConstantInputWrapper =
|
|
1053
|
+
var ConstantInputWrapper = import_styled_components3.default.div`
|
|
1027
1054
|
flex-grow: 1;
|
|
1028
1055
|
|
|
1029
1056
|
& .semi-tree-select,
|
|
@@ -1034,8 +1061,8 @@ var ConstantInputWrapper = import_styled_components2.default.div`
|
|
|
1034
1061
|
`;
|
|
1035
1062
|
|
|
1036
1063
|
// src/components/json-schema-editor/hooks.tsx
|
|
1037
|
-
var
|
|
1038
|
-
var
|
|
1064
|
+
var import_react15 = require("react");
|
|
1065
|
+
var import_lodash = require("lodash");
|
|
1039
1066
|
var _id = 0;
|
|
1040
1067
|
function genId() {
|
|
1041
1068
|
return _id++;
|
|
@@ -1050,9 +1077,9 @@ function getDrilldownSchema(value, path) {
|
|
|
1050
1077
|
return { schema: value, path };
|
|
1051
1078
|
}
|
|
1052
1079
|
function usePropertiesEdit(value, onChange) {
|
|
1053
|
-
const drilldown = (0,
|
|
1080
|
+
const drilldown = (0, import_react15.useMemo)(() => getDrilldownSchema(value), [value, value?.type, value?.items]);
|
|
1054
1081
|
const isDrilldownObject = drilldown.schema?.type === "object";
|
|
1055
|
-
const initPropertyList = (0,
|
|
1082
|
+
const initPropertyList = (0, import_react15.useMemo)(
|
|
1056
1083
|
() => isDrilldownObject ? Object.entries(drilldown.schema?.properties || {}).sort(([, a], [, b]) => (a.extra?.index ?? 0) - (b.extra?.index ?? 0)).map(
|
|
1057
1084
|
([name, _value], index) => ({
|
|
1058
1085
|
key: genId(),
|
|
@@ -1067,9 +1094,9 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1067
1094
|
) : [],
|
|
1068
1095
|
[isDrilldownObject]
|
|
1069
1096
|
);
|
|
1070
|
-
const [propertyList, setPropertyList] = (0,
|
|
1071
|
-
const mountRef = (0,
|
|
1072
|
-
(0,
|
|
1097
|
+
const [propertyList, setPropertyList] = (0, import_react15.useState)(initPropertyList);
|
|
1098
|
+
const mountRef = (0, import_react15.useRef)(false);
|
|
1099
|
+
(0, import_react15.useEffect)(() => {
|
|
1073
1100
|
if (mountRef.current) {
|
|
1074
1101
|
setPropertyList((_list) => {
|
|
1075
1102
|
const nameMap = /* @__PURE__ */ new Map();
|
|
@@ -1108,7 +1135,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1108
1135
|
if (!_property.name) {
|
|
1109
1136
|
continue;
|
|
1110
1137
|
}
|
|
1111
|
-
nextProperties[_property.name] = (0,
|
|
1138
|
+
nextProperties[_property.name] = (0, import_lodash.omit)(_property, ["key", "name", "isPropertyRequired"]);
|
|
1112
1139
|
if (_property.isPropertyRequired) {
|
|
1113
1140
|
nextRequired.push(_property.name);
|
|
1114
1141
|
}
|
|
@@ -1137,7 +1164,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1137
1164
|
(_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
|
|
1138
1165
|
);
|
|
1139
1166
|
};
|
|
1140
|
-
(0,
|
|
1167
|
+
(0, import_react15.useEffect)(() => {
|
|
1141
1168
|
if (!isDrilldownObject) {
|
|
1142
1169
|
setPropertyList([]);
|
|
1143
1170
|
}
|
|
@@ -1152,9 +1179,9 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1152
1179
|
}
|
|
1153
1180
|
|
|
1154
1181
|
// src/components/json-schema-editor/default-value.tsx
|
|
1155
|
-
var
|
|
1156
|
-
var
|
|
1157
|
-
var
|
|
1182
|
+
var import_react17 = __toESM(require("react"));
|
|
1183
|
+
var import_semi_ui10 = require("@douyinfe/semi-ui");
|
|
1184
|
+
var import_semi_icons3 = require("@douyinfe/semi-icons");
|
|
1158
1185
|
|
|
1159
1186
|
// src/components/json-schema-editor/utils.ts
|
|
1160
1187
|
function getValueType(value) {
|
|
@@ -1176,117 +1203,54 @@ function getValueType(value) {
|
|
|
1176
1203
|
}
|
|
1177
1204
|
|
|
1178
1205
|
// src/components/constant-input/index.tsx
|
|
1179
|
-
var
|
|
1180
|
-
var
|
|
1181
|
-
var defaultStrategies = [
|
|
1182
|
-
{
|
|
1183
|
-
hit: (schema) => schema?.type === "string",
|
|
1184
|
-
Renderer: (props) => /* @__PURE__ */ import_react7.default.createElement(import_semi_ui5.Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
|
|
1185
|
-
},
|
|
1186
|
-
{
|
|
1187
|
-
hit: (schema) => schema?.type === "number",
|
|
1188
|
-
Renderer: (props) => /* @__PURE__ */ import_react7.default.createElement(
|
|
1189
|
-
import_semi_ui5.InputNumber,
|
|
1190
|
-
{
|
|
1191
|
-
placeholder: "Please Input Number",
|
|
1192
|
-
size: "small",
|
|
1193
|
-
disabled: props.readonly,
|
|
1194
|
-
hideButtons: true,
|
|
1195
|
-
...props
|
|
1196
|
-
}
|
|
1197
|
-
)
|
|
1198
|
-
},
|
|
1199
|
-
{
|
|
1200
|
-
hit: (schema) => schema?.type === "integer",
|
|
1201
|
-
Renderer: (props) => /* @__PURE__ */ import_react7.default.createElement(
|
|
1202
|
-
import_semi_ui5.InputNumber,
|
|
1203
|
-
{
|
|
1204
|
-
placeholder: "Please Input Integer",
|
|
1205
|
-
size: "small",
|
|
1206
|
-
disabled: props.readonly,
|
|
1207
|
-
hideButtons: true,
|
|
1208
|
-
precision: 0,
|
|
1209
|
-
...props
|
|
1210
|
-
}
|
|
1211
|
-
)
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
hit: (schema) => schema?.type === "boolean",
|
|
1215
|
-
Renderer: (props) => {
|
|
1216
|
-
const { value, onChange, ...rest } = props;
|
|
1217
|
-
return /* @__PURE__ */ import_react7.default.createElement(
|
|
1218
|
-
import_semi_ui5.Select,
|
|
1219
|
-
{
|
|
1220
|
-
placeholder: "Please Select Boolean",
|
|
1221
|
-
size: "small",
|
|
1222
|
-
disabled: props.readonly,
|
|
1223
|
-
optionList: [
|
|
1224
|
-
{ label: "True", value: 1 },
|
|
1225
|
-
{ label: "False", value: 0 }
|
|
1226
|
-
],
|
|
1227
|
-
value: value ? 1 : 0,
|
|
1228
|
-
onChange: (value2) => onChange?.(!!value2),
|
|
1229
|
-
...rest
|
|
1230
|
-
}
|
|
1231
|
-
);
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
];
|
|
1206
|
+
var import_react16 = __toESM(require("react"));
|
|
1207
|
+
var import_semi_ui9 = require("@douyinfe/semi-ui");
|
|
1235
1208
|
function ConstantInput(props) {
|
|
1236
|
-
const {
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
schema
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
...rest
|
|
1244
|
-
} = props;
|
|
1245
|
-
const strategies = (0, import_react7.useMemo)(
|
|
1246
|
-
// user's extraStrategies first
|
|
1247
|
-
() => [...extraStrategies || [], ...defaultStrategies],
|
|
1248
|
-
[extraStrategies]
|
|
1249
|
-
);
|
|
1250
|
-
const Renderer2 = (0, import_react7.useMemo)(() => {
|
|
1251
|
-
const strategy = strategies.find((_strategy) => _strategy.hit(schema));
|
|
1209
|
+
const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
|
|
1210
|
+
const typeManager = useTypeManager();
|
|
1211
|
+
const Renderer2 = (0, import_react16.useMemo)(() => {
|
|
1212
|
+
const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
|
|
1213
|
+
if (!strategy) {
|
|
1214
|
+
return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
|
|
1215
|
+
}
|
|
1252
1216
|
return strategy?.Renderer;
|
|
1253
1217
|
}, [strategies, schema]);
|
|
1254
1218
|
if (!Renderer2) {
|
|
1255
1219
|
if (fallbackRenderer) {
|
|
1256
|
-
return
|
|
1220
|
+
return import_react16.default.createElement(fallbackRenderer, {
|
|
1257
1221
|
value,
|
|
1258
1222
|
onChange,
|
|
1259
1223
|
readonly,
|
|
1260
1224
|
...rest
|
|
1261
1225
|
});
|
|
1262
1226
|
}
|
|
1263
|
-
return /* @__PURE__ */
|
|
1227
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_semi_ui9.Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
|
|
1264
1228
|
}
|
|
1265
|
-
return /* @__PURE__ */
|
|
1229
|
+
return /* @__PURE__ */ import_react16.default.createElement(Renderer2, { value, onChange, readonly, ...rest });
|
|
1266
1230
|
}
|
|
1267
1231
|
|
|
1268
1232
|
// src/components/json-schema-editor/default-value.tsx
|
|
1269
1233
|
function DefaultValue(props) {
|
|
1270
1234
|
const { value, schema, type, onChange, placeholder, jsonFormatText } = props;
|
|
1271
|
-
const wrapperRef = (0,
|
|
1272
|
-
const JsonViewerRef = (0,
|
|
1273
|
-
const [internalJsonValue, setInternalJsonValue] = (0,
|
|
1235
|
+
const wrapperRef = (0, import_react17.useRef)(null);
|
|
1236
|
+
const JsonViewerRef = (0, import_react17.useRef)(null);
|
|
1237
|
+
const [internalJsonValue, setInternalJsonValue] = (0, import_react17.useState)(
|
|
1274
1238
|
getValueType(value) === "string" ? value : ""
|
|
1275
1239
|
);
|
|
1276
|
-
const handleJsonChange = (0,
|
|
1240
|
+
const handleJsonChange = (0, import_react17.useCallback)((val) => {
|
|
1277
1241
|
if (val !== internalJsonValue) {
|
|
1278
1242
|
setInternalJsonValue(val);
|
|
1279
1243
|
}
|
|
1280
1244
|
}, []);
|
|
1281
|
-
const handleEditComplete = (0,
|
|
1245
|
+
const handleEditComplete = (0, import_react17.useCallback)(() => {
|
|
1282
1246
|
onChange(internalJsonValue);
|
|
1283
1247
|
requestAnimationFrame(() => {
|
|
1284
1248
|
wrapperRef.current?.blur();
|
|
1285
1249
|
});
|
|
1286
1250
|
setJsonReadOnly(true);
|
|
1287
1251
|
}, [internalJsonValue, onChange]);
|
|
1288
|
-
const [jsonReadOnly, setJsonReadOnly] = (0,
|
|
1289
|
-
const handleFormatJson = (0,
|
|
1252
|
+
const [jsonReadOnly, setJsonReadOnly] = (0, import_react17.useState)(true);
|
|
1253
|
+
const handleFormatJson = (0, import_react17.useCallback)(() => {
|
|
1290
1254
|
try {
|
|
1291
1255
|
const parsed = JSON.parse(internalJsonValue);
|
|
1292
1256
|
const formatted = JSON.stringify(parsed, null, 4);
|
|
@@ -1296,16 +1260,16 @@ function DefaultValue(props) {
|
|
|
1296
1260
|
console.error("Invalid JSON:", error);
|
|
1297
1261
|
}
|
|
1298
1262
|
}, [internalJsonValue, onChange]);
|
|
1299
|
-
return type === "object" ? /* @__PURE__ */
|
|
1300
|
-
|
|
1263
|
+
return type === "object" ? /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(JSONHeader, null, /* @__PURE__ */ import_react17.default.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ import_react17.default.createElement(JSONHeaderRight, null, /* @__PURE__ */ import_react17.default.createElement(import_semi_ui10.Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
1264
|
+
import_semi_ui10.IconButton,
|
|
1301
1265
|
{
|
|
1302
|
-
icon: /* @__PURE__ */
|
|
1266
|
+
icon: /* @__PURE__ */ import_react17.default.createElement(import_semi_icons3.IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
|
|
1303
1267
|
size: "small",
|
|
1304
1268
|
type: "tertiary",
|
|
1305
1269
|
theme: "borderless",
|
|
1306
1270
|
onClick: handleFormatJson
|
|
1307
1271
|
}
|
|
1308
|
-
)))), /* @__PURE__ */
|
|
1272
|
+
)))), /* @__PURE__ */ import_react17.default.createElement(
|
|
1309
1273
|
JSONViewerWrapper,
|
|
1310
1274
|
{
|
|
1311
1275
|
ref: wrapperRef,
|
|
@@ -1319,8 +1283,8 @@ function DefaultValue(props) {
|
|
|
1319
1283
|
setJsonReadOnly(false);
|
|
1320
1284
|
}
|
|
1321
1285
|
},
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
|
|
1286
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
1287
|
+
import_semi_ui10.JsonViewer,
|
|
1324
1288
|
{
|
|
1325
1289
|
ref: JsonViewerRef,
|
|
1326
1290
|
value: getValueType(value) === "string" ? value : "",
|
|
@@ -1337,7 +1301,7 @@ function DefaultValue(props) {
|
|
|
1337
1301
|
onChange: handleJsonChange
|
|
1338
1302
|
}
|
|
1339
1303
|
)
|
|
1340
|
-
)) : /* @__PURE__ */
|
|
1304
|
+
)) : /* @__PURE__ */ import_react17.default.createElement(ConstantInputWrapper, null, /* @__PURE__ */ import_react17.default.createElement(
|
|
1341
1305
|
ConstantInput,
|
|
1342
1306
|
{
|
|
1343
1307
|
value,
|
|
@@ -1349,14 +1313,14 @@ function DefaultValue(props) {
|
|
|
1349
1313
|
}
|
|
1350
1314
|
|
|
1351
1315
|
// src/components/json-schema-editor/components/blur-input.tsx
|
|
1352
|
-
var
|
|
1316
|
+
var import_react18 = __toESM(require("react"));
|
|
1353
1317
|
var import_input = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
|
|
1354
1318
|
function BlurInput(props) {
|
|
1355
|
-
const [value, setValue] = (0,
|
|
1356
|
-
(0,
|
|
1319
|
+
const [value, setValue] = (0, import_react18.useState)("");
|
|
1320
|
+
(0, import_react18.useEffect)(() => {
|
|
1357
1321
|
setValue(props.value);
|
|
1358
1322
|
}, [props.value]);
|
|
1359
|
-
return /* @__PURE__ */
|
|
1323
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1360
1324
|
import_input.default,
|
|
1361
1325
|
{
|
|
1362
1326
|
...props,
|
|
@@ -1376,7 +1340,7 @@ function JsonSchemaEditor(props) {
|
|
|
1376
1340
|
value,
|
|
1377
1341
|
onChangeProps
|
|
1378
1342
|
);
|
|
1379
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ import_react19.default.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ import_react19.default.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ import_react19.default.createElement(
|
|
1380
1344
|
PropertyEdit,
|
|
1381
1345
|
{
|
|
1382
1346
|
readonly,
|
|
@@ -1391,13 +1355,13 @@ function JsonSchemaEditor(props) {
|
|
|
1391
1355
|
onRemoveProperty(_property.key);
|
|
1392
1356
|
}
|
|
1393
1357
|
}
|
|
1394
|
-
))), /* @__PURE__ */
|
|
1395
|
-
|
|
1358
|
+
))), /* @__PURE__ */ import_react19.default.createElement(
|
|
1359
|
+
import_semi_ui11.Button,
|
|
1396
1360
|
{
|
|
1397
1361
|
disabled: readonly,
|
|
1398
1362
|
size: "small",
|
|
1399
1363
|
style: { marginTop: 10, marginLeft: 16 },
|
|
1400
|
-
icon: /* @__PURE__ */
|
|
1364
|
+
icon: /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconPlus, null),
|
|
1401
1365
|
onClick: onAddProperty
|
|
1402
1366
|
},
|
|
1403
1367
|
config?.addButtonText ?? "Add"
|
|
@@ -1418,10 +1382,10 @@ function PropertyEdit(props) {
|
|
|
1418
1382
|
$parentType = "",
|
|
1419
1383
|
$showLine
|
|
1420
1384
|
} = props;
|
|
1421
|
-
const [expand, setExpand] = (0,
|
|
1422
|
-
const [collapse, setCollapse] = (0,
|
|
1385
|
+
const [expand, setExpand] = (0, import_react19.useState)(false);
|
|
1386
|
+
const [collapse, setCollapse] = (0, import_react19.useState)(false);
|
|
1423
1387
|
const { name, type, items, default: defaultValue, description, isPropertyRequired } = value || {};
|
|
1424
|
-
const typeSelectorValue = (0,
|
|
1388
|
+
const typeSelectorValue = (0, import_react19.useMemo)(() => ({ type, items }), [type, items]);
|
|
1425
1389
|
const { propertyList, isDrilldownObject, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
|
|
1426
1390
|
const onChange = (key, _value) => {
|
|
1427
1391
|
onChangeProps?.({
|
|
@@ -1430,7 +1394,7 @@ function PropertyEdit(props) {
|
|
|
1430
1394
|
});
|
|
1431
1395
|
};
|
|
1432
1396
|
const showCollapse = isDrilldownObject && propertyList.length > 0;
|
|
1433
|
-
return /* @__PURE__ */
|
|
1397
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1434
1398
|
UIPropertyLeft,
|
|
1435
1399
|
{
|
|
1436
1400
|
type,
|
|
@@ -1442,8 +1406,8 @@ function PropertyEdit(props) {
|
|
|
1442
1406
|
$parentExpand,
|
|
1443
1407
|
$parentType
|
|
1444
1408
|
},
|
|
1445
|
-
showCollapse && /* @__PURE__ */
|
|
1446
|
-
), /* @__PURE__ */
|
|
1409
|
+
showCollapse && /* @__PURE__ */ import_react19.default.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconChevronRight, { size: "small" }))
|
|
1410
|
+
), /* @__PURE__ */ import_react19.default.createElement(UIPropertyRight, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1447
1411
|
UIPropertyMain,
|
|
1448
1412
|
{
|
|
1449
1413
|
$showCollapse: showCollapse,
|
|
@@ -1451,7 +1415,7 @@ function PropertyEdit(props) {
|
|
|
1451
1415
|
$expand: expand,
|
|
1452
1416
|
type
|
|
1453
1417
|
},
|
|
1454
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ import_react19.default.createElement(UIRow, null, /* @__PURE__ */ import_react19.default.createElement(UIName, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1455
1419
|
BlurInput,
|
|
1456
1420
|
{
|
|
1457
1421
|
disabled: readonly,
|
|
@@ -1460,7 +1424,7 @@ function PropertyEdit(props) {
|
|
|
1460
1424
|
value: name,
|
|
1461
1425
|
onChange: (value2) => onChange("name", value2)
|
|
1462
1426
|
}
|
|
1463
|
-
)), /* @__PURE__ */
|
|
1427
|
+
)), /* @__PURE__ */ import_react19.default.createElement(UIType, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1464
1428
|
TypeSelector,
|
|
1465
1429
|
{
|
|
1466
1430
|
value: typeSelectorValue,
|
|
@@ -1472,47 +1436,47 @@ function PropertyEdit(props) {
|
|
|
1472
1436
|
});
|
|
1473
1437
|
}
|
|
1474
1438
|
}
|
|
1475
|
-
)), /* @__PURE__ */
|
|
1476
|
-
|
|
1439
|
+
)), /* @__PURE__ */ import_react19.default.createElement(UIRequired, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1440
|
+
import_semi_ui11.Checkbox,
|
|
1477
1441
|
{
|
|
1478
1442
|
disabled: readonly,
|
|
1479
1443
|
checked: isPropertyRequired,
|
|
1480
1444
|
onChange: (e) => onChange("isPropertyRequired", e.target.checked)
|
|
1481
1445
|
}
|
|
1482
|
-
)), /* @__PURE__ */
|
|
1483
|
-
|
|
1446
|
+
)), /* @__PURE__ */ import_react19.default.createElement(UIActions, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1447
|
+
import_semi_ui11.IconButton,
|
|
1484
1448
|
{
|
|
1485
1449
|
disabled: readonly,
|
|
1486
1450
|
size: "small",
|
|
1487
1451
|
theme: "borderless",
|
|
1488
|
-
icon: expand ? /* @__PURE__ */
|
|
1452
|
+
icon: expand ? /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconShrink, { size: "small" }) : /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconExpand, { size: "small" }),
|
|
1489
1453
|
onClick: () => {
|
|
1490
1454
|
setExpand((_expand) => !_expand);
|
|
1491
1455
|
}
|
|
1492
1456
|
}
|
|
1493
|
-
), isDrilldownObject && /* @__PURE__ */
|
|
1494
|
-
|
|
1457
|
+
), isDrilldownObject && /* @__PURE__ */ import_react19.default.createElement(
|
|
1458
|
+
import_semi_ui11.IconButton,
|
|
1495
1459
|
{
|
|
1496
1460
|
disabled: readonly,
|
|
1497
1461
|
size: "small",
|
|
1498
1462
|
theme: "borderless",
|
|
1499
|
-
icon: /* @__PURE__ */
|
|
1463
|
+
icon: /* @__PURE__ */ import_react19.default.createElement(IconAddChildren, null),
|
|
1500
1464
|
onClick: () => {
|
|
1501
1465
|
onAddProperty();
|
|
1502
1466
|
setCollapse(true);
|
|
1503
1467
|
}
|
|
1504
1468
|
}
|
|
1505
|
-
), /* @__PURE__ */
|
|
1506
|
-
|
|
1469
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
1470
|
+
import_semi_ui11.IconButton,
|
|
1507
1471
|
{
|
|
1508
1472
|
disabled: readonly,
|
|
1509
1473
|
size: "small",
|
|
1510
1474
|
theme: "borderless",
|
|
1511
|
-
icon: /* @__PURE__ */
|
|
1475
|
+
icon: /* @__PURE__ */ import_react19.default.createElement(import_semi_icons4.IconMinus, { size: "small" }),
|
|
1512
1476
|
onClick: onRemove
|
|
1513
1477
|
}
|
|
1514
1478
|
))),
|
|
1515
|
-
expand && /* @__PURE__ */
|
|
1479
|
+
expand && /* @__PURE__ */ import_react19.default.createElement(UIExpandDetail, null, /* @__PURE__ */ import_react19.default.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ import_react19.default.createElement(
|
|
1516
1480
|
BlurInput,
|
|
1517
1481
|
{
|
|
1518
1482
|
disabled: readonly,
|
|
@@ -1521,7 +1485,7 @@ function PropertyEdit(props) {
|
|
|
1521
1485
|
onChange: (value2) => onChange("description", value2),
|
|
1522
1486
|
placeholder: config?.descPlaceholder ?? "Help LLM to understand the property"
|
|
1523
1487
|
}
|
|
1524
|
-
), $level === 0 && type && type !== "array" && /* @__PURE__ */
|
|
1488
|
+
), $level === 0 && type && type !== "array" && /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ import_react19.default.createElement(DefaultValueWrapper, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
1525
1489
|
DefaultValue,
|
|
1526
1490
|
{
|
|
1527
1491
|
value: defaultValue,
|
|
@@ -1532,7 +1496,7 @@ function PropertyEdit(props) {
|
|
|
1532
1496
|
onChange: (value2) => onChange("default", value2)
|
|
1533
1497
|
}
|
|
1534
1498
|
))))
|
|
1535
|
-
), showCollapse && /* @__PURE__ */
|
|
1499
|
+
), showCollapse && /* @__PURE__ */ import_react19.default.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ import_react19.default.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ import_react19.default.createElement(
|
|
1536
1500
|
PropertyEdit,
|
|
1537
1501
|
{
|
|
1538
1502
|
readonly,
|
|
@@ -1557,87 +1521,25 @@ function PropertyEdit(props) {
|
|
|
1557
1521
|
}
|
|
1558
1522
|
|
|
1559
1523
|
// src/components/batch-variable-selector/index.tsx
|
|
1560
|
-
var
|
|
1561
|
-
var
|
|
1524
|
+
var import_react20 = __toESM(require("react"));
|
|
1525
|
+
var import_editor5 = require("@flowgram.ai/editor");
|
|
1562
1526
|
var batchVariableSchema = {
|
|
1563
1527
|
type: "array",
|
|
1564
1528
|
extra: { weak: true }
|
|
1565
1529
|
};
|
|
1566
1530
|
function BatchVariableSelector(props) {
|
|
1567
|
-
return /* @__PURE__ */
|
|
1531
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_editor5.PrivateScopeProvider, null, /* @__PURE__ */ import_react20.default.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
|
|
1568
1532
|
}
|
|
1569
1533
|
|
|
1570
1534
|
// src/components/dynamic-value-input/index.tsx
|
|
1571
|
-
var
|
|
1572
|
-
var
|
|
1573
|
-
var
|
|
1574
|
-
var
|
|
1575
|
-
|
|
1576
|
-
// src/utils/format-legacy-refs/index.ts
|
|
1577
|
-
var import_lodash3 = require("lodash");
|
|
1578
|
-
function formatLegacyRefOnSubmit(value) {
|
|
1579
|
-
if ((0, import_lodash3.isObject)(value)) {
|
|
1580
|
-
if (isLegacyFlowRefValueSchema(value)) {
|
|
1581
|
-
return formatLegacyRefToNewRef(value);
|
|
1582
|
-
}
|
|
1583
|
-
return Object.fromEntries(
|
|
1584
|
-
Object.entries(value).map(([key, value2]) => [
|
|
1585
|
-
key,
|
|
1586
|
-
formatLegacyRefOnSubmit(value2)
|
|
1587
|
-
])
|
|
1588
|
-
);
|
|
1589
|
-
}
|
|
1590
|
-
if (Array.isArray(value)) {
|
|
1591
|
-
return value.map(formatLegacyRefOnSubmit);
|
|
1592
|
-
}
|
|
1593
|
-
return value;
|
|
1594
|
-
}
|
|
1595
|
-
function formatLegacyRefOnInit(value) {
|
|
1596
|
-
if ((0, import_lodash3.isObject)(value)) {
|
|
1597
|
-
if (isNewFlowRefValueSchema(value)) {
|
|
1598
|
-
return formatNewRefToLegacyRef(value);
|
|
1599
|
-
}
|
|
1600
|
-
return Object.fromEntries(
|
|
1601
|
-
Object.entries(value).map(([key, value2]) => [
|
|
1602
|
-
key,
|
|
1603
|
-
formatLegacyRefOnInit(value2)
|
|
1604
|
-
])
|
|
1605
|
-
);
|
|
1606
|
-
}
|
|
1607
|
-
if (Array.isArray(value)) {
|
|
1608
|
-
return value.map(formatLegacyRefOnInit);
|
|
1609
|
-
}
|
|
1610
|
-
return value;
|
|
1611
|
-
}
|
|
1612
|
-
function isLegacyFlowRefValueSchema(value) {
|
|
1613
|
-
return (0, import_lodash3.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
|
|
1614
|
-
}
|
|
1615
|
-
function isNewFlowRefValueSchema(value) {
|
|
1616
|
-
return (0, import_lodash3.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
|
|
1617
|
-
}
|
|
1618
|
-
function formatLegacyRefToNewRef(value) {
|
|
1619
|
-
const keyPath = value.content.split(".");
|
|
1620
|
-
if (keyPath[1] === "outputs") {
|
|
1621
|
-
return {
|
|
1622
|
-
type: "ref",
|
|
1623
|
-
content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
|
|
1624
|
-
};
|
|
1625
|
-
}
|
|
1626
|
-
return {
|
|
1627
|
-
type: "ref",
|
|
1628
|
-
content: keyPath
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
|
-
function formatNewRefToLegacyRef(value) {
|
|
1632
|
-
return {
|
|
1633
|
-
type: "ref",
|
|
1634
|
-
content: value.content.join(".")
|
|
1635
|
-
};
|
|
1636
|
-
}
|
|
1535
|
+
var import_react22 = __toESM(require("react"));
|
|
1536
|
+
var import_json_schema5 = require("@flowgram.ai/json-schema");
|
|
1537
|
+
var import_semi_ui12 = require("@douyinfe/semi-ui");
|
|
1538
|
+
var import_semi_icons5 = require("@douyinfe/semi-icons");
|
|
1637
1539
|
|
|
1638
1540
|
// src/components/dynamic-value-input/styles.tsx
|
|
1639
|
-
var
|
|
1640
|
-
var UIContainer2 =
|
|
1541
|
+
var import_styled_components4 = __toESM(require("styled-components"));
|
|
1542
|
+
var UIContainer2 = import_styled_components4.default.div`
|
|
1641
1543
|
display: flex;
|
|
1642
1544
|
align-items: center;
|
|
1643
1545
|
border-radius: 4px;
|
|
@@ -1647,7 +1549,7 @@ var UIContainer2 = import_styled_components3.default.div`
|
|
|
1647
1549
|
|
|
1648
1550
|
background-color: var(--semi-color-fill-0);
|
|
1649
1551
|
`;
|
|
1650
|
-
var UIMain =
|
|
1552
|
+
var UIMain = import_styled_components4.default.div`
|
|
1651
1553
|
flex-grow: 1;
|
|
1652
1554
|
overflow: hidden;
|
|
1653
1555
|
min-width: 0;
|
|
@@ -1665,14 +1567,14 @@ var UIMain = import_styled_components3.default.div`
|
|
|
1665
1567
|
border-radius: 0;
|
|
1666
1568
|
}
|
|
1667
1569
|
`;
|
|
1668
|
-
var UIType2 =
|
|
1570
|
+
var UIType2 = import_styled_components4.default.div`
|
|
1669
1571
|
border-right: 1px solid #e5e5e5;
|
|
1670
1572
|
|
|
1671
1573
|
& .semi-button {
|
|
1672
1574
|
border-radius: 0;
|
|
1673
1575
|
}
|
|
1674
1576
|
`;
|
|
1675
|
-
var UITrigger =
|
|
1577
|
+
var UITrigger = import_styled_components4.default.div`
|
|
1676
1578
|
border-left: 1px solid #e5e5e5;
|
|
1677
1579
|
|
|
1678
1580
|
& .semi-button {
|
|
@@ -1680,6 +1582,39 @@ var UITrigger = import_styled_components3.default.div`
|
|
|
1680
1582
|
}
|
|
1681
1583
|
`;
|
|
1682
1584
|
|
|
1585
|
+
// src/components/dynamic-value-input/hooks.ts
|
|
1586
|
+
var import_react21 = require("react");
|
|
1587
|
+
var import_editor6 = require("@flowgram.ai/editor");
|
|
1588
|
+
function useRefVariable(value) {
|
|
1589
|
+
const available = (0, import_editor6.useScopeAvailable)();
|
|
1590
|
+
const refVariable = (0, import_react21.useMemo)(() => {
|
|
1591
|
+
if (value?.type === "ref") {
|
|
1592
|
+
return available.getByKeyPath(value.content);
|
|
1593
|
+
}
|
|
1594
|
+
}, [value, available]);
|
|
1595
|
+
return refVariable;
|
|
1596
|
+
}
|
|
1597
|
+
function useSelectSchema(schemaFromProps, constantProps, value) {
|
|
1598
|
+
let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: "string" };
|
|
1599
|
+
if (value?.type === "constant") {
|
|
1600
|
+
defaultSelectSchema = value?.schema || defaultSelectSchema;
|
|
1601
|
+
}
|
|
1602
|
+
const [selectSchema, setSelectSchema] = (0, import_react21.useState)(defaultSelectSchema);
|
|
1603
|
+
return [selectSchema, setSelectSchema];
|
|
1604
|
+
}
|
|
1605
|
+
function useIncludeSchema(schemaFromProps) {
|
|
1606
|
+
const includeSchema = (0, import_react21.useMemo)(() => {
|
|
1607
|
+
if (!schemaFromProps) {
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
if (schemaFromProps?.type === "number") {
|
|
1611
|
+
return [schemaFromProps, { type: "integer" }];
|
|
1612
|
+
}
|
|
1613
|
+
return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
|
|
1614
|
+
}, [schemaFromProps]);
|
|
1615
|
+
return includeSchema;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1683
1618
|
// src/components/dynamic-value-input/index.tsx
|
|
1684
1619
|
function DynamicValueInput({
|
|
1685
1620
|
value,
|
|
@@ -1689,44 +1624,46 @@ function DynamicValueInput({
|
|
|
1689
1624
|
schema: schemaFromProps,
|
|
1690
1625
|
constantProps
|
|
1691
1626
|
}) {
|
|
1692
|
-
const
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1695
|
-
return available.getByKeyPath(value.content);
|
|
1696
|
-
}
|
|
1697
|
-
}, [value, available]);
|
|
1698
|
-
const [selectSchema, setSelectSchema] = (0, import_react12.useState)(
|
|
1699
|
-
schemaFromProps || constantProps?.schema || { type: "string" }
|
|
1700
|
-
);
|
|
1627
|
+
const refVariable = useRefVariable(value);
|
|
1628
|
+
const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
|
|
1629
|
+
const includeSchema = useIncludeSchema(schemaFromProps);
|
|
1701
1630
|
const renderTypeSelector = () => {
|
|
1702
1631
|
if (schemaFromProps) {
|
|
1703
|
-
return /* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ import_react22.default.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
|
|
1704
1633
|
}
|
|
1705
1634
|
if (value?.type === "ref") {
|
|
1706
|
-
const schema = refVariable?.type ? JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
|
|
1707
|
-
return /* @__PURE__ */
|
|
1635
|
+
const schema = refVariable?.type ? import_json_schema5.JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
|
|
1636
|
+
return /* @__PURE__ */ import_react22.default.createElement(TypeSelector, { value: schema, readonly: true });
|
|
1708
1637
|
}
|
|
1709
|
-
return /* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
1710
1639
|
TypeSelector,
|
|
1711
1640
|
{
|
|
1712
1641
|
value: selectSchema,
|
|
1713
|
-
onChange: (_v) =>
|
|
1642
|
+
onChange: (_v) => {
|
|
1643
|
+
setSelectSchema(_v || { type: "string" });
|
|
1644
|
+
let content;
|
|
1645
|
+
if (_v?.type === "object") {
|
|
1646
|
+
content = "{}";
|
|
1647
|
+
}
|
|
1648
|
+
if (_v?.type === "array") {
|
|
1649
|
+
content = "[]";
|
|
1650
|
+
}
|
|
1651
|
+
if (_v?.type === "boolean") {
|
|
1652
|
+
content = false;
|
|
1653
|
+
}
|
|
1654
|
+
onChange({
|
|
1655
|
+
type: "constant",
|
|
1656
|
+
content,
|
|
1657
|
+
schema: _v || { type: "string" }
|
|
1658
|
+
});
|
|
1659
|
+
},
|
|
1714
1660
|
readonly
|
|
1715
1661
|
}
|
|
1716
1662
|
);
|
|
1717
1663
|
};
|
|
1718
|
-
const includeSchema = (0, import_react12.useMemo)(() => {
|
|
1719
|
-
if (!schemaFromProps) {
|
|
1720
|
-
return;
|
|
1721
|
-
}
|
|
1722
|
-
if (schemaFromProps?.type === "number") {
|
|
1723
|
-
return [schemaFromProps, { type: "integer" }];
|
|
1724
|
-
}
|
|
1725
|
-
return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
|
|
1726
|
-
}, [schemaFromProps]);
|
|
1727
1664
|
const renderMain = () => {
|
|
1728
1665
|
if (value?.type === "ref") {
|
|
1729
|
-
return /* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
1730
1667
|
VariableSelector,
|
|
1731
1668
|
{
|
|
1732
1669
|
style: { width: "100%" },
|
|
@@ -1738,7 +1675,7 @@ function DynamicValueInput({
|
|
|
1738
1675
|
);
|
|
1739
1676
|
}
|
|
1740
1677
|
const constantSchema = schemaFromProps || selectSchema || { type: "string" };
|
|
1741
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
1742
1679
|
ConstantInput,
|
|
1743
1680
|
{
|
|
1744
1681
|
value: value?.content,
|
|
@@ -1746,7 +1683,7 @@ function DynamicValueInput({
|
|
|
1746
1683
|
schema: constantSchema || { type: "string" },
|
|
1747
1684
|
readonly,
|
|
1748
1685
|
strategies: [...constantProps?.strategies || []],
|
|
1749
|
-
fallbackRenderer: () => /* @__PURE__ */
|
|
1686
|
+
fallbackRenderer: () => /* @__PURE__ */ import_react22.default.createElement(
|
|
1750
1687
|
VariableSelector,
|
|
1751
1688
|
{
|
|
1752
1689
|
style: { width: "100%" },
|
|
@@ -1759,7 +1696,7 @@ function DynamicValueInput({
|
|
|
1759
1696
|
}
|
|
1760
1697
|
);
|
|
1761
1698
|
};
|
|
1762
|
-
const renderTrigger = () => /* @__PURE__ */
|
|
1699
|
+
const renderTrigger = () => /* @__PURE__ */ import_react22.default.createElement(
|
|
1763
1700
|
VariableSelector,
|
|
1764
1701
|
{
|
|
1765
1702
|
style: { width: "100%" },
|
|
@@ -1767,31 +1704,31 @@ function DynamicValueInput({
|
|
|
1767
1704
|
onChange: (_v) => onChange({ type: "ref", content: _v }),
|
|
1768
1705
|
includeSchema,
|
|
1769
1706
|
readonly,
|
|
1770
|
-
triggerRender: () => /* @__PURE__ */
|
|
1707
|
+
triggerRender: () => /* @__PURE__ */ import_react22.default.createElement(import_semi_ui12.IconButton, { disabled: readonly, size: "small", icon: /* @__PURE__ */ import_react22.default.createElement(import_semi_icons5.IconSetting, { size: "small" }) })
|
|
1771
1708
|
}
|
|
1772
1709
|
);
|
|
1773
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ import_react22.default.createElement(UIContainer2, { style }, /* @__PURE__ */ import_react22.default.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ import_react22.default.createElement(UIMain, null, renderMain()), /* @__PURE__ */ import_react22.default.createElement(UITrigger, null, renderTrigger()));
|
|
1774
1711
|
}
|
|
1775
1712
|
|
|
1776
1713
|
// src/components/condition-row/index.tsx
|
|
1777
|
-
var
|
|
1778
|
-
var
|
|
1714
|
+
var import_react25 = __toESM(require("react"));
|
|
1715
|
+
var import_semi_ui14 = require("@douyinfe/semi-ui");
|
|
1779
1716
|
|
|
1780
1717
|
// src/components/condition-row/styles.tsx
|
|
1781
|
-
var
|
|
1782
|
-
var UIContainer3 =
|
|
1718
|
+
var import_styled_components5 = __toESM(require("styled-components"));
|
|
1719
|
+
var UIContainer3 = import_styled_components5.default.div`
|
|
1783
1720
|
display: flex;
|
|
1784
1721
|
align-items: center;
|
|
1785
1722
|
gap: 4px;
|
|
1786
1723
|
`;
|
|
1787
|
-
var UIOperator =
|
|
1788
|
-
var UILeft =
|
|
1724
|
+
var UIOperator = import_styled_components5.default.div``;
|
|
1725
|
+
var UILeft = import_styled_components5.default.div`
|
|
1789
1726
|
width: 100%;
|
|
1790
1727
|
`;
|
|
1791
|
-
var UIRight =
|
|
1728
|
+
var UIRight = import_styled_components5.default.div`
|
|
1792
1729
|
width: 100%;
|
|
1793
1730
|
`;
|
|
1794
|
-
var UIValues =
|
|
1731
|
+
var UIValues = import_styled_components5.default.div`
|
|
1795
1732
|
flex-grow: 1;
|
|
1796
1733
|
display: flex;
|
|
1797
1734
|
flex-direction: column;
|
|
@@ -1800,8 +1737,9 @@ var UIValues = import_styled_components4.default.div`
|
|
|
1800
1737
|
`;
|
|
1801
1738
|
|
|
1802
1739
|
// src/components/condition-row/hooks/useRule.ts
|
|
1803
|
-
var
|
|
1804
|
-
var
|
|
1740
|
+
var import_react23 = require("react");
|
|
1741
|
+
var import_json_schema6 = require("@flowgram.ai/json-schema");
|
|
1742
|
+
var import_editor7 = require("@flowgram.ai/editor");
|
|
1805
1743
|
|
|
1806
1744
|
// src/components/condition-row/constants.ts
|
|
1807
1745
|
var rules = {
|
|
@@ -1849,7 +1787,11 @@ var rules = {
|
|
|
1849
1787
|
},
|
|
1850
1788
|
array: {
|
|
1851
1789
|
["is_empty" /* IS_EMPTY */]: null,
|
|
1852
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1790
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null,
|
|
1791
|
+
["contains" /* CONTAINS */]: "array",
|
|
1792
|
+
["not_contains" /* NOT_CONTAINS */]: "array",
|
|
1793
|
+
["eq" /* EQ */]: "array",
|
|
1794
|
+
["neq" /* NEQ */]: "array"
|
|
1853
1795
|
},
|
|
1854
1796
|
map: {
|
|
1855
1797
|
["is_empty" /* IS_EMPTY */]: null,
|
|
@@ -1921,44 +1863,44 @@ var opConfigs = {
|
|
|
1921
1863
|
|
|
1922
1864
|
// src/components/condition-row/hooks/useRule.ts
|
|
1923
1865
|
function useRule(left) {
|
|
1924
|
-
const available = (0,
|
|
1925
|
-
const variable = (0,
|
|
1866
|
+
const available = (0, import_editor7.useScopeAvailable)();
|
|
1867
|
+
const variable = (0, import_react23.useMemo)(() => {
|
|
1926
1868
|
if (!left) return void 0;
|
|
1927
1869
|
return available.getByKeyPath(left.content);
|
|
1928
1870
|
}, [available, left]);
|
|
1929
|
-
const rule = (0,
|
|
1871
|
+
const rule = (0, import_react23.useMemo)(() => {
|
|
1930
1872
|
if (!variable) return void 0;
|
|
1931
|
-
const schema = JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
|
|
1873
|
+
const schema = import_json_schema6.JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
|
|
1932
1874
|
return rules[schema?.type];
|
|
1933
1875
|
}, [variable?.type]);
|
|
1934
1876
|
return { rule };
|
|
1935
1877
|
}
|
|
1936
1878
|
|
|
1937
1879
|
// src/components/condition-row/hooks/useOp.tsx
|
|
1938
|
-
var
|
|
1939
|
-
var
|
|
1940
|
-
var
|
|
1880
|
+
var import_react24 = __toESM(require("react"));
|
|
1881
|
+
var import_semi_ui13 = require("@douyinfe/semi-ui");
|
|
1882
|
+
var import_semi_icons6 = require("@douyinfe/semi-icons");
|
|
1941
1883
|
function useOp({ rule, op, onChange, readonly }) {
|
|
1942
|
-
const
|
|
1884
|
+
const options = (0, import_react24.useMemo)(
|
|
1943
1885
|
() => Object.keys(rule || {}).map((_op) => ({
|
|
1944
1886
|
...opConfigs[_op] || {},
|
|
1945
1887
|
value: _op
|
|
1946
1888
|
})),
|
|
1947
1889
|
[rule]
|
|
1948
1890
|
);
|
|
1949
|
-
const opConfig = (0,
|
|
1950
|
-
const renderOpSelect = () => /* @__PURE__ */
|
|
1951
|
-
|
|
1891
|
+
const opConfig = (0, import_react24.useMemo)(() => opConfigs[op], [op]);
|
|
1892
|
+
const renderOpSelect = () => /* @__PURE__ */ import_react24.default.createElement(
|
|
1893
|
+
import_semi_ui13.Select,
|
|
1952
1894
|
{
|
|
1953
1895
|
style: { height: 22 },
|
|
1954
1896
|
disabled: readonly,
|
|
1955
1897
|
size: "small",
|
|
1956
1898
|
value: op,
|
|
1957
|
-
optionList:
|
|
1899
|
+
optionList: options,
|
|
1958
1900
|
onChange: (v) => {
|
|
1959
1901
|
onChange(v);
|
|
1960
1902
|
},
|
|
1961
|
-
triggerRender: ({ value }) => /* @__PURE__ */
|
|
1903
|
+
triggerRender: ({ value }) => /* @__PURE__ */ import_react24.default.createElement(import_semi_ui13.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react24.default.createElement(import_semi_icons6.IconChevronDownStroked, { size: "small" }))
|
|
1962
1904
|
}
|
|
1963
1905
|
);
|
|
1964
1906
|
return { renderOpSelect, opConfig };
|
|
@@ -1974,11 +1916,11 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
1974
1916
|
onChange: (v) => onChange({ ...value, operator: v }),
|
|
1975
1917
|
readonly
|
|
1976
1918
|
});
|
|
1977
|
-
const targetSchema = (0,
|
|
1919
|
+
const targetSchema = (0, import_react25.useMemo)(() => {
|
|
1978
1920
|
const targetType = rule?.[operator] || null;
|
|
1979
1921
|
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
1980
1922
|
}, [rule, opConfig]);
|
|
1981
|
-
return /* @__PURE__ */
|
|
1923
|
+
return /* @__PURE__ */ import_react25.default.createElement(UIContainer3, { style }, /* @__PURE__ */ import_react25.default.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ import_react25.default.createElement(UIValues, null, /* @__PURE__ */ import_react25.default.createElement(UILeft, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1982
1924
|
VariableSelector,
|
|
1983
1925
|
{
|
|
1984
1926
|
readonly,
|
|
@@ -1992,7 +1934,7 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
1992
1934
|
}
|
|
1993
1935
|
})
|
|
1994
1936
|
}
|
|
1995
|
-
)), /* @__PURE__ */
|
|
1937
|
+
)), /* @__PURE__ */ import_react25.default.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ import_react25.default.createElement(
|
|
1996
1938
|
DynamicValueInput,
|
|
1997
1939
|
{
|
|
1998
1940
|
readonly: readonly || !rule,
|
|
@@ -2000,8 +1942,8 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
2000
1942
|
schema: targetSchema,
|
|
2001
1943
|
onChange: (v) => onChange({ ...value, right: v })
|
|
2002
1944
|
}
|
|
2003
|
-
) : /* @__PURE__ */
|
|
2004
|
-
|
|
1945
|
+
) : /* @__PURE__ */ import_react25.default.createElement(
|
|
1946
|
+
import_semi_ui14.Input,
|
|
2005
1947
|
{
|
|
2006
1948
|
size: "small",
|
|
2007
1949
|
disabled: true,
|
|
@@ -2012,14 +1954,14 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
2012
1954
|
}
|
|
2013
1955
|
|
|
2014
1956
|
// src/components/batch-outputs/index.tsx
|
|
2015
|
-
var
|
|
2016
|
-
var
|
|
2017
|
-
var
|
|
1957
|
+
var import_react27 = __toESM(require("react"));
|
|
1958
|
+
var import_semi_ui15 = require("@douyinfe/semi-ui");
|
|
1959
|
+
var import_semi_icons7 = require("@douyinfe/semi-icons");
|
|
2018
1960
|
|
|
2019
1961
|
// src/hooks/use-object-list/index.tsx
|
|
2020
|
-
var
|
|
1962
|
+
var import_react26 = require("react");
|
|
2021
1963
|
var import_nanoid = require("nanoid");
|
|
2022
|
-
var
|
|
1964
|
+
var import_lodash2 = require("lodash");
|
|
2023
1965
|
function genId2() {
|
|
2024
1966
|
return (0, import_nanoid.nanoid)();
|
|
2025
1967
|
}
|
|
@@ -2028,12 +1970,12 @@ function useObjectList({
|
|
|
2028
1970
|
onChange,
|
|
2029
1971
|
sortIndexKey
|
|
2030
1972
|
}) {
|
|
2031
|
-
const [list, setList] = (0,
|
|
2032
|
-
(0,
|
|
1973
|
+
const [list, setList] = (0, import_react26.useState)([]);
|
|
1974
|
+
(0, import_react26.useEffect)(() => {
|
|
2033
1975
|
setList((_prevList) => {
|
|
2034
|
-
const newKeys = Object.entries(value || {}).sort((a, b) => (0,
|
|
1976
|
+
const newKeys = Object.entries(value || {}).sort((a, b) => (0, import_lodash2.get)(a[1], sortIndexKey || 0) - (0, import_lodash2.get)(b[1], sortIndexKey || 0)).map(([key]) => key);
|
|
2035
1977
|
const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
|
|
2036
|
-
const addKeys = (0,
|
|
1978
|
+
const addKeys = (0, import_lodash2.difference)(newKeys, oldKeys);
|
|
2037
1979
|
return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
|
|
2038
1980
|
id: item.id,
|
|
2039
1981
|
key: item.key,
|
|
@@ -2069,8 +2011,8 @@ function useObjectList({
|
|
|
2069
2011
|
onChange(
|
|
2070
2012
|
Object.fromEntries(
|
|
2071
2013
|
nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
|
|
2072
|
-
if ((0,
|
|
2073
|
-
(0,
|
|
2014
|
+
if ((0, import_lodash2.isObject)(_res[1]) && sortIndexKey) {
|
|
2015
|
+
(0, import_lodash2.set)(_res[1], sortIndexKey, idx);
|
|
2074
2016
|
}
|
|
2075
2017
|
return _res;
|
|
2076
2018
|
})
|
|
@@ -2113,14 +2055,14 @@ function useObjectList({
|
|
|
2113
2055
|
}
|
|
2114
2056
|
|
|
2115
2057
|
// src/components/batch-outputs/styles.tsx
|
|
2116
|
-
var
|
|
2117
|
-
var UIRows =
|
|
2058
|
+
var import_styled_components6 = __toESM(require("styled-components"));
|
|
2059
|
+
var UIRows = import_styled_components6.default.div`
|
|
2118
2060
|
display: flex;
|
|
2119
2061
|
flex-direction: column;
|
|
2120
2062
|
gap: 10px;
|
|
2121
2063
|
margin-bottom: 10px;
|
|
2122
2064
|
`;
|
|
2123
|
-
var UIRow2 =
|
|
2065
|
+
var UIRow2 = import_styled_components6.default.div`
|
|
2124
2066
|
display: flex;
|
|
2125
2067
|
align-items: center;
|
|
2126
2068
|
gap: 5px;
|
|
@@ -2130,8 +2072,8 @@ var UIRow2 = import_styled_components5.default.div`
|
|
|
2130
2072
|
function BatchOutputs(props) {
|
|
2131
2073
|
const { readonly, style } = props;
|
|
2132
2074
|
const { list, add, updateKey, updateValue, remove } = useObjectList(props);
|
|
2133
|
-
return /* @__PURE__ */
|
|
2134
|
-
|
|
2075
|
+
return /* @__PURE__ */ import_react27.default.createElement("div", null, /* @__PURE__ */ import_react27.default.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ import_react27.default.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ import_react27.default.createElement(
|
|
2076
|
+
import_semi_ui15.Input,
|
|
2135
2077
|
{
|
|
2136
2078
|
style: { width: 100 },
|
|
2137
2079
|
disabled: readonly,
|
|
@@ -2139,7 +2081,7 @@ function BatchOutputs(props) {
|
|
|
2139
2081
|
value: item.key,
|
|
2140
2082
|
onChange: (v) => updateKey(item.id, v)
|
|
2141
2083
|
}
|
|
2142
|
-
), /* @__PURE__ */
|
|
2084
|
+
), /* @__PURE__ */ import_react27.default.createElement(
|
|
2143
2085
|
VariableSelector,
|
|
2144
2086
|
{
|
|
2145
2087
|
style: { flexGrow: 1 },
|
|
@@ -2147,44 +2089,44 @@ function BatchOutputs(props) {
|
|
|
2147
2089
|
value: item.value?.content,
|
|
2148
2090
|
onChange: (v) => updateValue(item.id, { type: "ref", content: v })
|
|
2149
2091
|
}
|
|
2150
|
-
), /* @__PURE__ */
|
|
2151
|
-
|
|
2092
|
+
), /* @__PURE__ */ import_react27.default.createElement(
|
|
2093
|
+
import_semi_ui15.Button,
|
|
2152
2094
|
{
|
|
2153
2095
|
disabled: readonly,
|
|
2154
|
-
icon: /* @__PURE__ */
|
|
2096
|
+
icon: /* @__PURE__ */ import_react27.default.createElement(import_semi_icons7.IconDelete, null),
|
|
2155
2097
|
size: "small",
|
|
2156
2098
|
onClick: () => remove(item.id)
|
|
2157
2099
|
}
|
|
2158
|
-
)))), /* @__PURE__ */
|
|
2100
|
+
)))), /* @__PURE__ */ import_react27.default.createElement(import_semi_ui15.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react27.default.createElement(import_semi_icons7.IconPlus, null), size: "small", onClick: add }, "Add"));
|
|
2159
2101
|
}
|
|
2160
2102
|
|
|
2161
2103
|
// src/components/prompt-editor/index.tsx
|
|
2162
|
-
var
|
|
2163
|
-
var
|
|
2104
|
+
var import_react34 = __toESM(require("react"));
|
|
2105
|
+
var import_react35 = require("@coze-editor/editor/react");
|
|
2164
2106
|
var import_preset_prompt2 = __toESM(require("@coze-editor/editor/preset-prompt"));
|
|
2165
2107
|
|
|
2166
2108
|
// src/components/prompt-editor/styles.tsx
|
|
2167
|
-
var
|
|
2168
|
-
var UIContainer4 =
|
|
2109
|
+
var import_styled_components7 = __toESM(require("styled-components"));
|
|
2110
|
+
var UIContainer4 = import_styled_components7.default.div`
|
|
2169
2111
|
background-color: var(--semi-color-fill-0);
|
|
2170
2112
|
padding-left: 10px;
|
|
2171
2113
|
padding-right: 6px;
|
|
2172
2114
|
|
|
2173
|
-
${({ $hasError }) => $hasError &&
|
|
2115
|
+
${({ $hasError }) => $hasError && import_styled_components7.css`
|
|
2174
2116
|
border: 1px solid var(--semi-color-danger-6);
|
|
2175
2117
|
`}
|
|
2176
2118
|
`;
|
|
2177
2119
|
|
|
2178
2120
|
// src/components/prompt-editor/extensions/markdown.tsx
|
|
2179
|
-
var
|
|
2180
|
-
var
|
|
2181
|
-
var
|
|
2182
|
-
var
|
|
2121
|
+
var import_react28 = require("react");
|
|
2122
|
+
var import_react29 = require("@coze-editor/editor/react");
|
|
2123
|
+
var import_editor8 = require("@coze-editor/editor");
|
|
2124
|
+
var import_view2 = require("@codemirror/view");
|
|
2183
2125
|
function MarkdownHighlight() {
|
|
2184
|
-
const injector = (0,
|
|
2185
|
-
(0,
|
|
2126
|
+
const injector = (0, import_react29.useInjector)();
|
|
2127
|
+
(0, import_react28.useLayoutEffect)(
|
|
2186
2128
|
() => injector.inject([
|
|
2187
|
-
|
|
2129
|
+
import_editor8.astDecorator.whole.of((cursor) => {
|
|
2188
2130
|
if (cursor.name.startsWith("ATXHeading")) {
|
|
2189
2131
|
return {
|
|
2190
2132
|
type: "className",
|
|
@@ -2210,7 +2152,7 @@ function MarkdownHighlight() {
|
|
|
2210
2152
|
};
|
|
2211
2153
|
}
|
|
2212
2154
|
}),
|
|
2213
|
-
|
|
2155
|
+
import_view2.EditorView.theme({
|
|
2214
2156
|
".heading": {
|
|
2215
2157
|
color: "#00818C",
|
|
2216
2158
|
fontWeight: "bold"
|
|
@@ -2233,26 +2175,26 @@ function MarkdownHighlight() {
|
|
|
2233
2175
|
var markdown_default = MarkdownHighlight;
|
|
2234
2176
|
|
|
2235
2177
|
// src/components/prompt-editor/extensions/language-support.tsx
|
|
2236
|
-
var
|
|
2237
|
-
var
|
|
2178
|
+
var import_react30 = require("react");
|
|
2179
|
+
var import_react31 = require("@coze-editor/editor/react");
|
|
2238
2180
|
var import_preset_prompt = require("@coze-editor/editor/preset-prompt");
|
|
2239
2181
|
function LanguageSupport() {
|
|
2240
|
-
const injector = (0,
|
|
2241
|
-
(0,
|
|
2182
|
+
const injector = (0, import_react31.useInjector)();
|
|
2183
|
+
(0, import_react30.useLayoutEffect)(() => injector.inject([import_preset_prompt.languageSupport]), [injector]);
|
|
2242
2184
|
return null;
|
|
2243
2185
|
}
|
|
2244
2186
|
var language_support_default = LanguageSupport;
|
|
2245
2187
|
|
|
2246
2188
|
// src/components/prompt-editor/extensions/jinja.tsx
|
|
2247
|
-
var
|
|
2248
|
-
var
|
|
2249
|
-
var
|
|
2250
|
-
var
|
|
2189
|
+
var import_react32 = require("react");
|
|
2190
|
+
var import_react33 = require("@coze-editor/editor/react");
|
|
2191
|
+
var import_editor9 = require("@coze-editor/editor");
|
|
2192
|
+
var import_view3 = require("@codemirror/view");
|
|
2251
2193
|
function JinjaHighlight() {
|
|
2252
|
-
const injector = (0,
|
|
2253
|
-
(0,
|
|
2194
|
+
const injector = (0, import_react33.useInjector)();
|
|
2195
|
+
(0, import_react32.useLayoutEffect)(
|
|
2254
2196
|
() => injector.inject([
|
|
2255
|
-
|
|
2197
|
+
import_editor9.astDecorator.whole.of((cursor) => {
|
|
2256
2198
|
if (cursor.name === "JinjaStatementStart" || cursor.name === "JinjaStatementEnd") {
|
|
2257
2199
|
return {
|
|
2258
2200
|
type: "className",
|
|
@@ -2272,7 +2214,7 @@ function JinjaHighlight() {
|
|
|
2272
2214
|
};
|
|
2273
2215
|
}
|
|
2274
2216
|
}),
|
|
2275
|
-
|
|
2217
|
+
import_view3.EditorView.theme({
|
|
2276
2218
|
".jinja-statement-bracket": {
|
|
2277
2219
|
color: "#D1009D"
|
|
2278
2220
|
},
|
|
@@ -2303,14 +2245,14 @@ function PromptEditor(props) {
|
|
|
2303
2245
|
children,
|
|
2304
2246
|
disableMarkdownHighlight
|
|
2305
2247
|
} = props || {};
|
|
2306
|
-
const editorRef = (0,
|
|
2307
|
-
(0,
|
|
2248
|
+
const editorRef = (0, import_react34.useRef)(null);
|
|
2249
|
+
(0, import_react34.useEffect)(() => {
|
|
2308
2250
|
if (editorRef.current?.getValue() !== value?.content) {
|
|
2309
2251
|
editorRef.current?.setValue(String(value?.content || ""));
|
|
2310
2252
|
}
|
|
2311
2253
|
}, [value]);
|
|
2312
|
-
return /* @__PURE__ */
|
|
2313
|
-
|
|
2254
|
+
return /* @__PURE__ */ import_react34.default.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ import_react34.default.createElement(import_react35.EditorProvider, null, /* @__PURE__ */ import_react34.default.createElement(
|
|
2255
|
+
import_react35.Renderer,
|
|
2314
2256
|
{
|
|
2315
2257
|
didMount: (editor) => {
|
|
2316
2258
|
editorRef.current = editor;
|
|
@@ -2326,23 +2268,23 @@ function PromptEditor(props) {
|
|
|
2326
2268
|
onChange({ type: "template", content: e.value });
|
|
2327
2269
|
}
|
|
2328
2270
|
}
|
|
2329
|
-
), activeLinePlaceholder && /* @__PURE__ */
|
|
2271
|
+
), activeLinePlaceholder && /* @__PURE__ */ import_react34.default.createElement(import_react35.ActiveLinePlaceholder, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ import_react34.default.createElement(markdown_default, null), /* @__PURE__ */ import_react34.default.createElement(language_support_default, null), /* @__PURE__ */ import_react34.default.createElement(jinja_default, null), children));
|
|
2330
2272
|
}
|
|
2331
2273
|
|
|
2332
2274
|
// src/components/prompt-editor-with-variables/index.tsx
|
|
2333
|
-
var
|
|
2275
|
+
var import_react40 = __toESM(require("react"));
|
|
2334
2276
|
|
|
2335
2277
|
// src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
|
|
2336
|
-
var
|
|
2337
|
-
var
|
|
2338
|
-
var
|
|
2278
|
+
var import_react36 = __toESM(require("react"));
|
|
2279
|
+
var import_semi_ui16 = require("@douyinfe/semi-ui");
|
|
2280
|
+
var import_react37 = require("@coze-editor/editor/react");
|
|
2339
2281
|
function VariableTree() {
|
|
2340
|
-
const [posKey, setPosKey] = (0,
|
|
2341
|
-
const [visible, setVisible] = (0,
|
|
2342
|
-
const [position, setPosition] = (0,
|
|
2343
|
-
const editor = (0,
|
|
2282
|
+
const [posKey, setPosKey] = (0, import_react36.useState)("");
|
|
2283
|
+
const [visible, setVisible] = (0, import_react36.useState)(false);
|
|
2284
|
+
const [position, setPosition] = (0, import_react36.useState)(-1);
|
|
2285
|
+
const editor = (0, import_react37.useEditor)();
|
|
2344
2286
|
function insert(variablePath) {
|
|
2345
|
-
const range = (0,
|
|
2287
|
+
const range = (0, import_react37.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
2346
2288
|
if (!range) {
|
|
2347
2289
|
return;
|
|
2348
2290
|
}
|
|
@@ -2356,21 +2298,21 @@ function VariableTree() {
|
|
|
2356
2298
|
setPosition(e.state.selection.main.head);
|
|
2357
2299
|
setVisible(e.value);
|
|
2358
2300
|
}
|
|
2359
|
-
(0,
|
|
2301
|
+
(0, import_react36.useEffect)(() => {
|
|
2360
2302
|
if (!editor) {
|
|
2361
2303
|
return;
|
|
2362
2304
|
}
|
|
2363
2305
|
}, [editor, visible]);
|
|
2364
2306
|
const treeData = useVariableTree({});
|
|
2365
|
-
return /* @__PURE__ */
|
|
2366
|
-
|
|
2307
|
+
return /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(import_react37.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react36.default.createElement(
|
|
2308
|
+
import_semi_ui16.Popover,
|
|
2367
2309
|
{
|
|
2368
2310
|
visible,
|
|
2369
2311
|
trigger: "custom",
|
|
2370
2312
|
position: "topLeft",
|
|
2371
2313
|
rePosKey: posKey,
|
|
2372
|
-
content: /* @__PURE__ */
|
|
2373
|
-
|
|
2314
|
+
content: /* @__PURE__ */ import_react36.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react36.default.createElement(
|
|
2315
|
+
import_semi_ui16.Tree,
|
|
2374
2316
|
{
|
|
2375
2317
|
treeData,
|
|
2376
2318
|
onSelect: (v) => {
|
|
@@ -2379,8 +2321,8 @@ function VariableTree() {
|
|
|
2379
2321
|
}
|
|
2380
2322
|
))
|
|
2381
2323
|
},
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
|
|
2324
|
+
/* @__PURE__ */ import_react36.default.createElement(
|
|
2325
|
+
import_react37.PositionMirror,
|
|
2384
2326
|
{
|
|
2385
2327
|
position,
|
|
2386
2328
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -2391,18 +2333,18 @@ function VariableTree() {
|
|
|
2391
2333
|
|
|
2392
2334
|
// src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
|
|
2393
2335
|
var import_react_dom = __toESM(require("react-dom"));
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2396
|
-
var
|
|
2397
|
-
var
|
|
2398
|
-
var
|
|
2399
|
-
var
|
|
2400
|
-
var
|
|
2336
|
+
var import_react38 = __toESM(require("react"));
|
|
2337
|
+
var import_lodash3 = require("lodash");
|
|
2338
|
+
var import_editor10 = require("@flowgram.ai/editor");
|
|
2339
|
+
var import_semi_ui18 = require("@douyinfe/semi-ui");
|
|
2340
|
+
var import_semi_icons8 = require("@douyinfe/semi-icons");
|
|
2341
|
+
var import_react39 = require("@coze-editor/editor/react");
|
|
2342
|
+
var import_view4 = require("@codemirror/view");
|
|
2401
2343
|
|
|
2402
2344
|
// src/components/prompt-editor-with-variables/styles.tsx
|
|
2403
|
-
var
|
|
2404
|
-
var
|
|
2405
|
-
var UIRootTitle2 =
|
|
2345
|
+
var import_styled_components8 = __toESM(require("styled-components"));
|
|
2346
|
+
var import_semi_ui17 = require("@douyinfe/semi-ui");
|
|
2347
|
+
var UIRootTitle2 = import_styled_components8.default.div`
|
|
2406
2348
|
margin-right: 4px;
|
|
2407
2349
|
min-width: 20px;
|
|
2408
2350
|
overflow: hidden;
|
|
@@ -2410,12 +2352,12 @@ var UIRootTitle2 = import_styled_components7.default.div`
|
|
|
2410
2352
|
white-space: nowrap;
|
|
2411
2353
|
color: var(--semi-color-text-2);
|
|
2412
2354
|
`;
|
|
2413
|
-
var UIVarName2 =
|
|
2355
|
+
var UIVarName2 = import_styled_components8.default.div`
|
|
2414
2356
|
overflow: hidden;
|
|
2415
2357
|
text-overflow: ellipsis;
|
|
2416
2358
|
white-space: nowrap;
|
|
2417
2359
|
`;
|
|
2418
|
-
var UITag2 = (0,
|
|
2360
|
+
var UITag2 = (0, import_styled_components8.default)(import_semi_ui17.Tag)`
|
|
2419
2361
|
display: inline-flex;
|
|
2420
2362
|
align-items: center;
|
|
2421
2363
|
justify-content: flex-start;
|
|
@@ -2429,7 +2371,7 @@ var UITag2 = (0, import_styled_components7.default)(import_semi_ui13.Tag)`
|
|
|
2429
2371
|
margin: 0 5px;
|
|
2430
2372
|
}
|
|
2431
2373
|
`;
|
|
2432
|
-
var UIPopoverContent2 =
|
|
2374
|
+
var UIPopoverContent2 = import_styled_components8.default.div`
|
|
2433
2375
|
padding: 10px;
|
|
2434
2376
|
display: inline-flex;
|
|
2435
2377
|
align-items: center;
|
|
@@ -2437,13 +2379,13 @@ var UIPopoverContent2 = import_styled_components7.default.div`
|
|
|
2437
2379
|
`;
|
|
2438
2380
|
|
|
2439
2381
|
// src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
|
|
2440
|
-
var VariableTagWidget = class extends
|
|
2382
|
+
var VariableTagWidget = class extends import_view4.WidgetType {
|
|
2441
2383
|
constructor({ keyPath, scope }) {
|
|
2442
2384
|
super();
|
|
2443
|
-
this.toDispose = new
|
|
2385
|
+
this.toDispose = new import_editor10.DisposableCollection();
|
|
2444
2386
|
this.renderIcon = (icon) => {
|
|
2445
2387
|
if (typeof icon === "string") {
|
|
2446
|
-
return /* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ import_react38.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
2447
2389
|
}
|
|
2448
2390
|
return icon;
|
|
2449
2391
|
};
|
|
@@ -2456,21 +2398,21 @@ var VariableTagWidget = class extends import_view3.WidgetType {
|
|
|
2456
2398
|
renderVariable(v) {
|
|
2457
2399
|
if (!v) {
|
|
2458
2400
|
this.renderReact(
|
|
2459
|
-
/* @__PURE__ */
|
|
2401
|
+
/* @__PURE__ */ import_react38.default.createElement(UITag2, { prefixIcon: /* @__PURE__ */ import_react38.default.createElement(import_semi_icons8.IconIssueStroked, null), color: "amber" }, "Unknown")
|
|
2460
2402
|
);
|
|
2461
2403
|
return;
|
|
2462
2404
|
}
|
|
2463
|
-
const rootField = (0,
|
|
2405
|
+
const rootField = (0, import_lodash3.last)(v.parentFields) || v;
|
|
2464
2406
|
const isRoot = v.parentFields.length === 0;
|
|
2465
|
-
const rootTitle = /* @__PURE__ */
|
|
2407
|
+
const rootTitle = /* @__PURE__ */ import_react38.default.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
|
|
2466
2408
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
2467
2409
|
this.renderReact(
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
|
|
2410
|
+
/* @__PURE__ */ import_react38.default.createElement(
|
|
2411
|
+
import_semi_ui18.Popover,
|
|
2470
2412
|
{
|
|
2471
|
-
content: /* @__PURE__ */
|
|
2413
|
+
content: /* @__PURE__ */ import_react38.default.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ import_react38.default.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
|
|
2472
2414
|
},
|
|
2473
|
-
/* @__PURE__ */
|
|
2415
|
+
/* @__PURE__ */ import_react38.default.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ import_react38.default.createElement(UIVarName2, null, v?.key))
|
|
2474
2416
|
)
|
|
2475
2417
|
);
|
|
2476
2418
|
}
|
|
@@ -2478,7 +2420,7 @@ var VariableTagWidget = class extends import_view3.WidgetType {
|
|
|
2478
2420
|
const dom = document.createElement("span");
|
|
2479
2421
|
this.rootDOM = dom;
|
|
2480
2422
|
this.toDispose.push(
|
|
2481
|
-
|
|
2423
|
+
import_editor10.Disposable.create(() => {
|
|
2482
2424
|
import_react_dom.default.unmountComponentAtNode(this.rootDOM);
|
|
2483
2425
|
})
|
|
2484
2426
|
);
|
|
@@ -2495,7 +2437,7 @@ var VariableTagWidget = class extends import_view3.WidgetType {
|
|
|
2495
2437
|
return dom;
|
|
2496
2438
|
}
|
|
2497
2439
|
eq(other) {
|
|
2498
|
-
return (0,
|
|
2440
|
+
return (0, import_lodash3.isEqual)(this.keyPath, other.keyPath);
|
|
2499
2441
|
}
|
|
2500
2442
|
ignoreEvent() {
|
|
2501
2443
|
return false;
|
|
@@ -2505,12 +2447,12 @@ var VariableTagWidget = class extends import_view3.WidgetType {
|
|
|
2505
2447
|
}
|
|
2506
2448
|
};
|
|
2507
2449
|
function VariableTagInject() {
|
|
2508
|
-
const injector = (0,
|
|
2509
|
-
const scope = (0,
|
|
2510
|
-
(0,
|
|
2511
|
-
const atMatcher = new
|
|
2450
|
+
const injector = (0, import_react39.useInjector)();
|
|
2451
|
+
const scope = (0, import_editor10.useCurrentScope)();
|
|
2452
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
2453
|
+
const atMatcher = new import_view4.MatchDecorator({
|
|
2512
2454
|
regexp: /\{\{([^\}]+)\}\}/g,
|
|
2513
|
-
decoration: (match) =>
|
|
2455
|
+
decoration: (match) => import_view4.Decoration.replace({
|
|
2514
2456
|
widget: new VariableTagWidget({
|
|
2515
2457
|
keyPath: match[1]?.split(".") ?? [],
|
|
2516
2458
|
scope
|
|
@@ -2518,7 +2460,7 @@ function VariableTagInject() {
|
|
|
2518
2460
|
})
|
|
2519
2461
|
});
|
|
2520
2462
|
return injector.inject([
|
|
2521
|
-
|
|
2463
|
+
import_view4.ViewPlugin.fromClass(
|
|
2522
2464
|
class {
|
|
2523
2465
|
constructor(view) {
|
|
2524
2466
|
this.view = view;
|
|
@@ -2531,8 +2473,8 @@ function VariableTagInject() {
|
|
|
2531
2473
|
{
|
|
2532
2474
|
decorations: (p) => p.decorations,
|
|
2533
2475
|
provide(p) {
|
|
2534
|
-
return
|
|
2535
|
-
(view) => view.plugin(p)?.decorations ??
|
|
2476
|
+
return import_view4.EditorView.atomicRanges.of(
|
|
2477
|
+
(view) => view.plugin(p)?.decorations ?? import_view4.Decoration.none
|
|
2536
2478
|
);
|
|
2537
2479
|
}
|
|
2538
2480
|
}
|
|
@@ -2544,29 +2486,29 @@ function VariableTagInject() {
|
|
|
2544
2486
|
|
|
2545
2487
|
// src/components/prompt-editor-with-variables/index.tsx
|
|
2546
2488
|
function PromptEditorWithVariables(props) {
|
|
2547
|
-
return /* @__PURE__ */
|
|
2489
|
+
return /* @__PURE__ */ import_react40.default.createElement(PromptEditor, { ...props }, /* @__PURE__ */ import_react40.default.createElement(VariableTree, null), /* @__PURE__ */ import_react40.default.createElement(VariableTagInject, null));
|
|
2548
2490
|
}
|
|
2549
2491
|
|
|
2550
2492
|
// src/components/prompt-editor-with-inputs/index.tsx
|
|
2551
|
-
var
|
|
2493
|
+
var import_react44 = __toESM(require("react"));
|
|
2552
2494
|
|
|
2553
2495
|
// src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
2556
|
-
var
|
|
2496
|
+
var import_react42 = __toESM(require("react"));
|
|
2497
|
+
var import_semi_ui20 = require("@douyinfe/semi-ui");
|
|
2498
|
+
var import_react43 = require("@coze-editor/editor/react");
|
|
2557
2499
|
|
|
2558
2500
|
// src/components/prompt-editor-with-inputs/inputs-picker.tsx
|
|
2559
|
-
var
|
|
2560
|
-
var
|
|
2561
|
-
var
|
|
2562
|
-
var
|
|
2501
|
+
var import_react41 = __toESM(require("react"));
|
|
2502
|
+
var import_lodash4 = require("lodash");
|
|
2503
|
+
var import_editor11 = require("@flowgram.ai/editor");
|
|
2504
|
+
var import_semi_ui19 = require("@douyinfe/semi-ui");
|
|
2563
2505
|
function InputsPicker({
|
|
2564
2506
|
inputsValues,
|
|
2565
2507
|
onSelect
|
|
2566
2508
|
}) {
|
|
2567
|
-
const available = (0,
|
|
2509
|
+
const available = (0, import_editor11.useScopeAvailable)();
|
|
2568
2510
|
const getArrayDrilldown = (type, depth = 1) => {
|
|
2569
|
-
if (
|
|
2511
|
+
if (import_editor11.ASTMatch.isArray(type.items)) {
|
|
2570
2512
|
return getArrayDrilldown(type.items, depth + 1);
|
|
2571
2513
|
}
|
|
2572
2514
|
return { type: type.items, depth };
|
|
@@ -2574,12 +2516,12 @@ function InputsPicker({
|
|
|
2574
2516
|
const renderVariable = (variable, keyPath) => {
|
|
2575
2517
|
let type = variable?.type;
|
|
2576
2518
|
let children;
|
|
2577
|
-
if (
|
|
2519
|
+
if (import_editor11.ASTMatch.isObject(type)) {
|
|
2578
2520
|
children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
|
|
2579
2521
|
}
|
|
2580
|
-
if (
|
|
2522
|
+
if (import_editor11.ASTMatch.isArray(type)) {
|
|
2581
2523
|
const drilldown = getArrayDrilldown(type);
|
|
2582
|
-
if (
|
|
2524
|
+
if (import_editor11.ASTMatch.isObject(drilldown.type)) {
|
|
2583
2525
|
children = (drilldown.type.properties || []).map(
|
|
2584
2526
|
(_property) => renderVariable(_property, [
|
|
2585
2527
|
...keyPath,
|
|
@@ -2592,12 +2534,12 @@ function InputsPicker({
|
|
|
2592
2534
|
const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
|
|
2593
2535
|
return {
|
|
2594
2536
|
key,
|
|
2595
|
-
label: (0,
|
|
2537
|
+
label: (0, import_lodash4.last)(keyPath),
|
|
2596
2538
|
value: key,
|
|
2597
2539
|
children
|
|
2598
2540
|
};
|
|
2599
2541
|
};
|
|
2600
|
-
const treeData = (0,
|
|
2542
|
+
const treeData = (0, import_react41.useMemo)(
|
|
2601
2543
|
() => Object.entries(inputsValues).map(([key, value]) => {
|
|
2602
2544
|
if (value?.type === "ref") {
|
|
2603
2545
|
const variable = available.getByKeyPath(value.content || []);
|
|
@@ -2607,429 +2549,88 @@ function InputsPicker({
|
|
|
2607
2549
|
}
|
|
2608
2550
|
return {
|
|
2609
2551
|
key,
|
|
2610
|
-
value: key,
|
|
2611
|
-
label: key
|
|
2612
|
-
};
|
|
2613
|
-
}),
|
|
2614
|
-
[]
|
|
2615
|
-
);
|
|
2616
|
-
return /* @__PURE__ */
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
// src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
|
|
2620
|
-
function InputsTree({ inputsValues }) {
|
|
2621
|
-
const [posKey, setPosKey] = (0, import_react32.useState)("");
|
|
2622
|
-
const [visible, setVisible] = (0, import_react32.useState)(false);
|
|
2623
|
-
const [position, setPosition] = (0, import_react32.useState)(-1);
|
|
2624
|
-
const editor = (0, import_react33.useEditor)();
|
|
2625
|
-
function insert(variablePath) {
|
|
2626
|
-
const range = (0, import_react33.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
2627
|
-
if (!range) {
|
|
2628
|
-
return;
|
|
2629
|
-
}
|
|
2630
|
-
editor.replaceText({
|
|
2631
|
-
...range,
|
|
2632
|
-
text: "{{" + variablePath + "}}"
|
|
2633
|
-
});
|
|
2634
|
-
setVisible(false);
|
|
2635
|
-
}
|
|
2636
|
-
function handleOpenChange(e) {
|
|
2637
|
-
setPosition(e.state.selection.main.head);
|
|
2638
|
-
setVisible(e.value);
|
|
2639
|
-
}
|
|
2640
|
-
(0, import_react32.useEffect)(() => {
|
|
2641
|
-
if (!editor) {
|
|
2642
|
-
return;
|
|
2643
|
-
}
|
|
2644
|
-
}, [editor, visible]);
|
|
2645
|
-
return /* @__PURE__ */ import_react32.default.createElement(import_react32.default.Fragment, null, /* @__PURE__ */ import_react32.default.createElement(import_react33.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react32.default.createElement(
|
|
2646
|
-
import_semi_ui16.Popover,
|
|
2647
|
-
{
|
|
2648
|
-
visible,
|
|
2649
|
-
trigger: "custom",
|
|
2650
|
-
position: "topLeft",
|
|
2651
|
-
rePosKey: posKey,
|
|
2652
|
-
content: /* @__PURE__ */ import_react32.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react32.default.createElement(
|
|
2653
|
-
InputsPicker,
|
|
2654
|
-
{
|
|
2655
|
-
inputsValues,
|
|
2656
|
-
onSelect: (v) => {
|
|
2657
|
-
insert(v);
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
))
|
|
2661
|
-
},
|
|
2662
|
-
/* @__PURE__ */ import_react32.default.createElement(
|
|
2663
|
-
import_react33.PositionMirror,
|
|
2664
|
-
{
|
|
2665
|
-
position,
|
|
2666
|
-
onChange: () => setPosKey(String(Math.random()))
|
|
2667
|
-
}
|
|
2668
|
-
)
|
|
2669
|
-
));
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
|
-
// src/components/prompt-editor-with-inputs/index.tsx
|
|
2673
|
-
function PromptEditorWithInputs({ inputsValues, ...restProps }) {
|
|
2674
|
-
return /* @__PURE__ */ import_react34.default.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ import_react34.default.createElement(InputsTree, { inputsValues }));
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2677
|
-
// src/components/code-editor/index.tsx
|
|
2678
|
-
var import_react35 = __toESM(require("react"));
|
|
2679
|
-
var import_react36 = require("@coze-editor/editor/react");
|
|
2680
|
-
var import_preset_code5 = __toESM(require("@coze-editor/editor/preset-code"));
|
|
2681
|
-
var import_view4 = require("@codemirror/view");
|
|
2682
|
-
|
|
2683
|
-
// src/components/code-editor/utils.ts
|
|
2684
|
-
function getSuffixByLanguageId(languageId) {
|
|
2685
|
-
if (languageId === "python") {
|
|
2686
|
-
return ".py";
|
|
2687
|
-
}
|
|
2688
|
-
if (languageId === "typescript") {
|
|
2689
|
-
return ".ts";
|
|
2690
|
-
}
|
|
2691
|
-
if (languageId === "shell") {
|
|
2692
|
-
return ".sh";
|
|
2693
|
-
}
|
|
2694
|
-
if (languageId === "json") {
|
|
2695
|
-
return ".json";
|
|
2696
|
-
}
|
|
2697
|
-
return "";
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
// src/components/code-editor/language-features.ts
|
|
2701
|
-
var import_preset_code = require("@coze-editor/editor/preset-code");
|
|
2702
|
-
var import_language_typescript = require("@coze-editor/editor/language-typescript");
|
|
2703
|
-
var import_language_shell = require("@coze-editor/editor/language-shell");
|
|
2704
|
-
var import_language_python = require("@coze-editor/editor/language-python");
|
|
2705
|
-
var import_language_json = require("@coze-editor/editor/language-json");
|
|
2706
|
-
var import_editor10 = require("@coze-editor/editor");
|
|
2707
|
-
import_preset_code.languages.register("python", import_language_python.python);
|
|
2708
|
-
import_preset_code.languages.register("shell", import_language_shell.shell);
|
|
2709
|
-
import_preset_code.languages.register("typescript", import_language_typescript.typescript);
|
|
2710
|
-
import_preset_code.languages.register("json", {
|
|
2711
|
-
// mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
|
|
2712
|
-
language: (0, import_editor10.mixLanguages)({
|
|
2713
|
-
outerLanguage: import_language_json.json.language
|
|
2714
|
-
}),
|
|
2715
|
-
languageService: import_language_json.json.languageService
|
|
2716
|
-
});
|
|
2717
|
-
var tsWorkerInit = false;
|
|
2718
|
-
var initTsWorker = () => {
|
|
2719
|
-
if (tsWorkerInit) {
|
|
2720
|
-
return;
|
|
2721
|
-
}
|
|
2722
|
-
tsWorkerInit = true;
|
|
2723
|
-
const tsWorker = new Worker(
|
|
2724
|
-
new URL(`@coze-editor/editor/language-typescript/worker`, importMetaUrl),
|
|
2725
|
-
{ type: "module" }
|
|
2726
|
-
);
|
|
2727
|
-
import_language_typescript.typescript.languageService.initialize(tsWorker, {
|
|
2728
|
-
compilerOptions: {
|
|
2729
|
-
// eliminate Promise error
|
|
2730
|
-
lib: ["es2015", "dom"],
|
|
2731
|
-
noImplicitAny: false
|
|
2732
|
-
}
|
|
2733
|
-
});
|
|
2734
|
-
};
|
|
2735
|
-
|
|
2736
|
-
// src/components/code-editor/theme/index.ts
|
|
2737
|
-
var import_preset_code4 = require("@coze-editor/editor/preset-code");
|
|
2738
|
-
|
|
2739
|
-
// src/components/code-editor/theme/light.ts
|
|
2740
|
-
var import_preset_code2 = require("@coze-editor/editor/preset-code");
|
|
2741
|
-
var colors = {
|
|
2742
|
-
background: "#F7F7FC",
|
|
2743
|
-
// syntax
|
|
2744
|
-
comment: "#000A298A",
|
|
2745
|
-
key: "#00818C",
|
|
2746
|
-
string: "#D1009D",
|
|
2747
|
-
number: "#C74200",
|
|
2748
|
-
boolean: "#2B57D9",
|
|
2749
|
-
null: "#2B57D9",
|
|
2750
|
-
separator: "#0F1529D1"
|
|
2751
|
-
};
|
|
2752
|
-
var lightTheme = (0, import_preset_code2.createTheme)({
|
|
2753
|
-
variant: "light",
|
|
2754
|
-
settings: {
|
|
2755
|
-
background: "#fff",
|
|
2756
|
-
foreground: "#000",
|
|
2757
|
-
caret: "#000",
|
|
2758
|
-
selection: "#d9d9d9",
|
|
2759
|
-
gutterBackground: "#f0f0f0",
|
|
2760
|
-
gutterForeground: "#666",
|
|
2761
|
-
gutterBorderColor: "transparent",
|
|
2762
|
-
gutterBorderWidth: 0,
|
|
2763
|
-
lineHighlight: "#f0f0f0",
|
|
2764
|
-
bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
|
|
2765
|
-
tooltip: {
|
|
2766
|
-
backgroundColor: "#f0f0f0",
|
|
2767
|
-
color: "#000",
|
|
2768
|
-
border: "1px solid #ccc"
|
|
2769
|
-
},
|
|
2770
|
-
link: {
|
|
2771
|
-
color: "#007bff"
|
|
2772
|
-
},
|
|
2773
|
-
completionItemHover: {
|
|
2774
|
-
backgroundColor: "#f0f0f0"
|
|
2775
|
-
},
|
|
2776
|
-
completionItemSelected: {
|
|
2777
|
-
backgroundColor: "#e0e0e0"
|
|
2778
|
-
},
|
|
2779
|
-
completionItemIcon: {
|
|
2780
|
-
color: "#333"
|
|
2781
|
-
},
|
|
2782
|
-
completionItemLabel: {
|
|
2783
|
-
color: "#333"
|
|
2784
|
-
},
|
|
2785
|
-
completionItemInfo: {
|
|
2786
|
-
color: "#333"
|
|
2787
|
-
},
|
|
2788
|
-
completionItemDetail: {
|
|
2789
|
-
color: "#666"
|
|
2790
|
-
}
|
|
2791
|
-
},
|
|
2792
|
-
styles: [
|
|
2793
|
-
// JSON
|
|
2794
|
-
{
|
|
2795
|
-
tag: import_preset_code2.tags.comment,
|
|
2796
|
-
color: colors.comment
|
|
2797
|
-
},
|
|
2798
|
-
{
|
|
2799
|
-
tag: [import_preset_code2.tags.propertyName],
|
|
2800
|
-
color: colors.key
|
|
2801
|
-
},
|
|
2802
|
-
{
|
|
2803
|
-
tag: [import_preset_code2.tags.string],
|
|
2804
|
-
color: colors.string
|
|
2805
|
-
},
|
|
2806
|
-
{
|
|
2807
|
-
tag: [import_preset_code2.tags.number],
|
|
2808
|
-
color: colors.number
|
|
2809
|
-
},
|
|
2810
|
-
{
|
|
2811
|
-
tag: [import_preset_code2.tags.bool],
|
|
2812
|
-
color: colors.boolean
|
|
2813
|
-
},
|
|
2814
|
-
{
|
|
2815
|
-
tag: [import_preset_code2.tags.null],
|
|
2816
|
-
color: colors.null
|
|
2817
|
-
},
|
|
2818
|
-
{
|
|
2819
|
-
tag: [import_preset_code2.tags.separator],
|
|
2820
|
-
color: colors.separator
|
|
2821
|
-
},
|
|
2822
|
-
// markdown
|
|
2823
|
-
{
|
|
2824
|
-
tag: [import_preset_code2.tags.heading],
|
|
2825
|
-
color: "#3e76ef"
|
|
2826
|
-
},
|
|
2827
|
-
{
|
|
2828
|
-
tag: [import_preset_code2.tags.processingInstruction],
|
|
2829
|
-
color: "#3e76ef"
|
|
2830
|
-
},
|
|
2831
|
-
// shell
|
|
2832
|
-
// curl
|
|
2833
|
-
{
|
|
2834
|
-
tag: [import_preset_code2.tags.standard(import_preset_code2.tags.variableName)],
|
|
2835
|
-
color: "#00804A"
|
|
2836
|
-
},
|
|
2837
|
-
// -X
|
|
2838
|
-
{
|
|
2839
|
-
tag: [import_preset_code2.tags.attributeName],
|
|
2840
|
-
color: "#C74200"
|
|
2841
|
-
},
|
|
2842
|
-
// url in string (includes quotes), e.g. "https://..."
|
|
2843
|
-
{
|
|
2844
|
-
tag: [import_preset_code2.tags.special(import_preset_code2.tags.string)],
|
|
2845
|
-
color: "#2B57D9"
|
|
2846
|
-
}
|
|
2847
|
-
]
|
|
2848
|
-
});
|
|
2849
|
-
|
|
2850
|
-
// src/components/code-editor/theme/dark.ts
|
|
2851
|
-
var import_preset_code3 = require("@coze-editor/editor/preset-code");
|
|
2852
|
-
var colors2 = {
|
|
2853
|
-
background: "#151B27",
|
|
2854
|
-
// syntax
|
|
2855
|
-
comment: "#FFFFFF63",
|
|
2856
|
-
key: "#39E5D7",
|
|
2857
|
-
string: "#FF94D2",
|
|
2858
|
-
number: "#FF9933",
|
|
2859
|
-
boolean: "#78B0FF",
|
|
2860
|
-
null: "#78B0FF",
|
|
2861
|
-
separator: "#FFFFFFC9"
|
|
2862
|
-
};
|
|
2863
|
-
var darkTheme = (0, import_preset_code3.createTheme)({
|
|
2864
|
-
variant: "dark",
|
|
2865
|
-
settings: {
|
|
2866
|
-
background: colors2.background,
|
|
2867
|
-
foreground: "#fff",
|
|
2868
|
-
caret: "#AEAFAD",
|
|
2869
|
-
selection: "#d9d9d942",
|
|
2870
|
-
gutterBackground: colors2.background,
|
|
2871
|
-
gutterForeground: "#FFFFFF63",
|
|
2872
|
-
gutterBorderColor: "transparent",
|
|
2873
|
-
gutterBorderWidth: 0,
|
|
2874
|
-
lineHighlight: "#272e3d36",
|
|
2875
|
-
bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
|
|
2876
|
-
tooltip: {
|
|
2877
|
-
backgroundColor: "#363D4D",
|
|
2878
|
-
color: "#fff",
|
|
2879
|
-
border: "none"
|
|
2880
|
-
},
|
|
2881
|
-
link: {
|
|
2882
|
-
color: "#4daafc"
|
|
2883
|
-
},
|
|
2884
|
-
completionItemHover: {
|
|
2885
|
-
backgroundColor: "#FFFFFF0F"
|
|
2886
|
-
},
|
|
2887
|
-
completionItemSelected: {
|
|
2888
|
-
backgroundColor: "#FFFFFF17"
|
|
2889
|
-
},
|
|
2890
|
-
completionItemIcon: {
|
|
2891
|
-
color: "#FFFFFFC9"
|
|
2892
|
-
},
|
|
2893
|
-
completionItemLabel: {
|
|
2894
|
-
color: "#FFFFFFC9"
|
|
2895
|
-
},
|
|
2896
|
-
completionItemInfo: {
|
|
2897
|
-
color: "#FFFFFFC9"
|
|
2898
|
-
},
|
|
2899
|
-
completionItemDetail: {
|
|
2900
|
-
color: "#FFFFFF63"
|
|
2901
|
-
}
|
|
2902
|
-
},
|
|
2903
|
-
styles: [
|
|
2904
|
-
// json
|
|
2905
|
-
{
|
|
2906
|
-
tag: import_preset_code3.tags.comment,
|
|
2907
|
-
color: colors2.comment
|
|
2908
|
-
},
|
|
2909
|
-
{
|
|
2910
|
-
tag: [import_preset_code3.tags.propertyName],
|
|
2911
|
-
color: colors2.key
|
|
2912
|
-
},
|
|
2913
|
-
{
|
|
2914
|
-
tag: [import_preset_code3.tags.string],
|
|
2915
|
-
color: colors2.string
|
|
2916
|
-
},
|
|
2917
|
-
{
|
|
2918
|
-
tag: [import_preset_code3.tags.number],
|
|
2919
|
-
color: colors2.number
|
|
2920
|
-
},
|
|
2921
|
-
{
|
|
2922
|
-
tag: [import_preset_code3.tags.bool],
|
|
2923
|
-
color: colors2.boolean
|
|
2924
|
-
},
|
|
2925
|
-
{
|
|
2926
|
-
tag: [import_preset_code3.tags.null],
|
|
2927
|
-
color: colors2.null
|
|
2928
|
-
},
|
|
2929
|
-
{
|
|
2930
|
-
tag: [import_preset_code3.tags.separator],
|
|
2931
|
-
color: colors2.separator
|
|
2932
|
-
},
|
|
2933
|
-
// markdown
|
|
2934
|
-
{
|
|
2935
|
-
tag: [import_preset_code3.tags.heading],
|
|
2936
|
-
color: "#6b6bff"
|
|
2937
|
-
},
|
|
2938
|
-
{
|
|
2939
|
-
tag: [import_preset_code3.tags.processingInstruction],
|
|
2940
|
-
color: "#6b6bff"
|
|
2941
|
-
},
|
|
2942
|
-
// shell
|
|
2943
|
-
// curl
|
|
2944
|
-
{
|
|
2945
|
-
tag: [import_preset_code3.tags.standard(import_preset_code3.tags.variableName)],
|
|
2946
|
-
color: "#3BEB84"
|
|
2947
|
-
},
|
|
2948
|
-
// -X
|
|
2949
|
-
{
|
|
2950
|
-
tag: [import_preset_code3.tags.attributeName],
|
|
2951
|
-
color: "#FF9933"
|
|
2952
|
-
},
|
|
2953
|
-
// url in string (includes quotes), e.g. "https://..."
|
|
2954
|
-
{
|
|
2955
|
-
tag: [import_preset_code3.tags.special(import_preset_code3.tags.string)],
|
|
2956
|
-
color: "#78B0FF"
|
|
2957
|
-
}
|
|
2958
|
-
]
|
|
2959
|
-
});
|
|
2960
|
-
|
|
2961
|
-
// src/components/code-editor/theme/index.ts
|
|
2962
|
-
import_preset_code4.themes.register("dark", darkTheme);
|
|
2963
|
-
import_preset_code4.themes.register("light", lightTheme);
|
|
2552
|
+
value: key,
|
|
2553
|
+
label: key
|
|
2554
|
+
};
|
|
2555
|
+
}),
|
|
2556
|
+
[]
|
|
2557
|
+
);
|
|
2558
|
+
return /* @__PURE__ */ import_react41.default.createElement(import_semi_ui19.Tree, { treeData, onSelect: (v) => onSelect(v) });
|
|
2559
|
+
}
|
|
2964
2560
|
|
|
2965
|
-
// src/components/
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
onChange,
|
|
2976
|
-
languageId = "python",
|
|
2977
|
-
theme = "light",
|
|
2978
|
-
children,
|
|
2979
|
-
placeholder,
|
|
2980
|
-
activeLinePlaceholder,
|
|
2981
|
-
options: options2,
|
|
2982
|
-
readonly
|
|
2983
|
-
}) {
|
|
2984
|
-
const editorRef = (0, import_react35.useRef)(null);
|
|
2985
|
-
(0, import_react35.useEffect)(() => {
|
|
2986
|
-
if (languageId === "typescript") {
|
|
2987
|
-
initTsWorker();
|
|
2561
|
+
// src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
|
|
2562
|
+
function InputsTree({ inputsValues }) {
|
|
2563
|
+
const [posKey, setPosKey] = (0, import_react42.useState)("");
|
|
2564
|
+
const [visible, setVisible] = (0, import_react42.useState)(false);
|
|
2565
|
+
const [position, setPosition] = (0, import_react42.useState)(-1);
|
|
2566
|
+
const editor = (0, import_react43.useEditor)();
|
|
2567
|
+
function insert(variablePath) {
|
|
2568
|
+
const range = (0, import_react43.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
2569
|
+
if (!range) {
|
|
2570
|
+
return;
|
|
2988
2571
|
}
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2572
|
+
editor.replaceText({
|
|
2573
|
+
...range,
|
|
2574
|
+
text: "{{" + variablePath + "}}"
|
|
2575
|
+
});
|
|
2576
|
+
setVisible(false);
|
|
2577
|
+
}
|
|
2578
|
+
function handleOpenChange(e) {
|
|
2579
|
+
setPosition(e.state.selection.main.head);
|
|
2580
|
+
setVisible(e.value);
|
|
2581
|
+
}
|
|
2582
|
+
(0, import_react42.useEffect)(() => {
|
|
2583
|
+
if (!editor) {
|
|
2584
|
+
return;
|
|
2993
2585
|
}
|
|
2994
|
-
}, [
|
|
2995
|
-
return /* @__PURE__ */
|
|
2996
|
-
|
|
2586
|
+
}, [editor, visible]);
|
|
2587
|
+
return /* @__PURE__ */ import_react42.default.createElement(import_react42.default.Fragment, null, /* @__PURE__ */ import_react42.default.createElement(import_react43.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react42.default.createElement(
|
|
2588
|
+
import_semi_ui20.Popover,
|
|
2997
2589
|
{
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
onChange: (e) => onChange?.(e.value)
|
|
2590
|
+
visible,
|
|
2591
|
+
trigger: "custom",
|
|
2592
|
+
position: "topLeft",
|
|
2593
|
+
rePosKey: posKey,
|
|
2594
|
+
content: /* @__PURE__ */ import_react42.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react42.default.createElement(
|
|
2595
|
+
InputsPicker,
|
|
2596
|
+
{
|
|
2597
|
+
inputsValues,
|
|
2598
|
+
onSelect: (v) => {
|
|
2599
|
+
insert(v);
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
))
|
|
3012
2603
|
},
|
|
3013
|
-
|
|
3014
|
-
|
|
2604
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
2605
|
+
import_react43.PositionMirror,
|
|
2606
|
+
{
|
|
2607
|
+
position,
|
|
2608
|
+
onChange: () => setPosKey(String(Math.random()))
|
|
2609
|
+
}
|
|
2610
|
+
)
|
|
3015
2611
|
));
|
|
3016
2612
|
}
|
|
3017
2613
|
|
|
2614
|
+
// src/components/prompt-editor-with-inputs/index.tsx
|
|
2615
|
+
function PromptEditorWithInputs({ inputsValues, ...restProps }) {
|
|
2616
|
+
return /* @__PURE__ */ import_react44.default.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ import_react44.default.createElement(InputsTree, { inputsValues }));
|
|
2617
|
+
}
|
|
2618
|
+
|
|
3018
2619
|
// src/components/json-editor-with-variables/index.tsx
|
|
3019
|
-
var
|
|
2620
|
+
var import_react49 = __toESM(require("react"));
|
|
3020
2621
|
var import_preset_code6 = require("@coze-editor/editor/preset-code");
|
|
3021
2622
|
|
|
3022
2623
|
// src/components/json-editor-with-variables/extensions/variable-tree.tsx
|
|
3023
|
-
var
|
|
3024
|
-
var
|
|
3025
|
-
var
|
|
2624
|
+
var import_react45 = __toESM(require("react"));
|
|
2625
|
+
var import_semi_ui21 = require("@douyinfe/semi-ui");
|
|
2626
|
+
var import_react46 = require("@coze-editor/editor/react");
|
|
3026
2627
|
function VariableTree2() {
|
|
3027
|
-
const [posKey, setPosKey] = (0,
|
|
3028
|
-
const [visible, setVisible] = (0,
|
|
3029
|
-
const [position, setPosition] = (0,
|
|
3030
|
-
const editor = (0,
|
|
2628
|
+
const [posKey, setPosKey] = (0, import_react45.useState)("");
|
|
2629
|
+
const [visible, setVisible] = (0, import_react45.useState)(false);
|
|
2630
|
+
const [position, setPosition] = (0, import_react45.useState)(-1);
|
|
2631
|
+
const editor = (0, import_react46.useEditor)();
|
|
3031
2632
|
function insert(variablePath) {
|
|
3032
|
-
const range = (0,
|
|
2633
|
+
const range = (0, import_react46.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
3033
2634
|
if (!range) {
|
|
3034
2635
|
return;
|
|
3035
2636
|
}
|
|
@@ -3043,21 +2644,21 @@ function VariableTree2() {
|
|
|
3043
2644
|
setPosition(e.state.selection.main.head);
|
|
3044
2645
|
setVisible(e.value);
|
|
3045
2646
|
}
|
|
3046
|
-
(0,
|
|
2647
|
+
(0, import_react45.useEffect)(() => {
|
|
3047
2648
|
if (!editor) {
|
|
3048
2649
|
return;
|
|
3049
2650
|
}
|
|
3050
2651
|
}, [editor, visible]);
|
|
3051
2652
|
const treeData = useVariableTree({});
|
|
3052
|
-
return /* @__PURE__ */
|
|
3053
|
-
|
|
2653
|
+
return /* @__PURE__ */ import_react45.default.createElement(import_react45.default.Fragment, null, /* @__PURE__ */ import_react45.default.createElement(import_react46.Mention, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react45.default.createElement(
|
|
2654
|
+
import_semi_ui21.Popover,
|
|
3054
2655
|
{
|
|
3055
2656
|
visible,
|
|
3056
2657
|
trigger: "custom",
|
|
3057
2658
|
position: "topLeft",
|
|
3058
2659
|
rePosKey: posKey,
|
|
3059
|
-
content: /* @__PURE__ */
|
|
3060
|
-
|
|
2660
|
+
content: /* @__PURE__ */ import_react45.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react45.default.createElement(
|
|
2661
|
+
import_semi_ui21.Tree,
|
|
3061
2662
|
{
|
|
3062
2663
|
treeData,
|
|
3063
2664
|
onSelect: (v) => {
|
|
@@ -3066,8 +2667,8 @@ function VariableTree2() {
|
|
|
3066
2667
|
}
|
|
3067
2668
|
))
|
|
3068
2669
|
},
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
|
|
2670
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
|
2671
|
+
import_react46.PositionMirror,
|
|
3071
2672
|
{
|
|
3072
2673
|
position,
|
|
3073
2674
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -3077,19 +2678,19 @@ function VariableTree2() {
|
|
|
3077
2678
|
}
|
|
3078
2679
|
|
|
3079
2680
|
// src/components/json-editor-with-variables/extensions/variable-tag.tsx
|
|
3080
|
-
var
|
|
2681
|
+
var import_react47 = __toESM(require("react"));
|
|
3081
2682
|
var import_client = require("react-dom/client");
|
|
3082
|
-
var
|
|
3083
|
-
var
|
|
3084
|
-
var
|
|
3085
|
-
var
|
|
3086
|
-
var
|
|
2683
|
+
var import_lodash5 = require("lodash");
|
|
2684
|
+
var import_editor12 = require("@flowgram.ai/editor");
|
|
2685
|
+
var import_semi_ui23 = require("@douyinfe/semi-ui");
|
|
2686
|
+
var import_semi_icons9 = require("@douyinfe/semi-icons");
|
|
2687
|
+
var import_react48 = require("@coze-editor/editor/react");
|
|
3087
2688
|
var import_view5 = require("@codemirror/view");
|
|
3088
2689
|
|
|
3089
2690
|
// src/components/json-editor-with-variables/styles.tsx
|
|
3090
|
-
var
|
|
3091
|
-
var
|
|
3092
|
-
var UIRootTitle3 =
|
|
2691
|
+
var import_styled_components9 = __toESM(require("styled-components"));
|
|
2692
|
+
var import_semi_ui22 = require("@douyinfe/semi-ui");
|
|
2693
|
+
var UIRootTitle3 = import_styled_components9.default.div`
|
|
3093
2694
|
margin-right: 4px;
|
|
3094
2695
|
min-width: 20px;
|
|
3095
2696
|
overflow: hidden;
|
|
@@ -3097,12 +2698,12 @@ var UIRootTitle3 = import_styled_components8.default.div`
|
|
|
3097
2698
|
white-space: nowrap;
|
|
3098
2699
|
color: var(--semi-color-text-2);
|
|
3099
2700
|
`;
|
|
3100
|
-
var UIVarName3 =
|
|
2701
|
+
var UIVarName3 = import_styled_components9.default.div`
|
|
3101
2702
|
overflow: hidden;
|
|
3102
2703
|
text-overflow: ellipsis;
|
|
3103
2704
|
white-space: nowrap;
|
|
3104
2705
|
`;
|
|
3105
|
-
var UITag3 = (0,
|
|
2706
|
+
var UITag3 = (0, import_styled_components9.default)(import_semi_ui22.Tag)`
|
|
3106
2707
|
display: inline-flex;
|
|
3107
2708
|
align-items: center;
|
|
3108
2709
|
justify-content: flex-start;
|
|
@@ -3116,7 +2717,7 @@ var UITag3 = (0, import_styled_components8.default)(import_semi_ui18.Tag)`
|
|
|
3116
2717
|
margin: 0 5px;
|
|
3117
2718
|
}
|
|
3118
2719
|
`;
|
|
3119
|
-
var UIPopoverContent3 =
|
|
2720
|
+
var UIPopoverContent3 = import_styled_components9.default.div`
|
|
3120
2721
|
padding: 10px;
|
|
3121
2722
|
display: inline-flex;
|
|
3122
2723
|
align-items: center;
|
|
@@ -3127,10 +2728,10 @@ var UIPopoverContent3 = import_styled_components8.default.div`
|
|
|
3127
2728
|
var VariableTagWidget2 = class extends import_view5.WidgetType {
|
|
3128
2729
|
constructor({ keyPath, scope }) {
|
|
3129
2730
|
super();
|
|
3130
|
-
this.toDispose = new
|
|
2731
|
+
this.toDispose = new import_editor12.DisposableCollection();
|
|
3131
2732
|
this.renderIcon = (icon) => {
|
|
3132
2733
|
if (typeof icon === "string") {
|
|
3133
|
-
return /* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ import_react47.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
3134
2735
|
}
|
|
3135
2736
|
return icon;
|
|
3136
2737
|
};
|
|
@@ -3140,20 +2741,20 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
|
|
|
3140
2741
|
renderVariable(v) {
|
|
3141
2742
|
if (!v) {
|
|
3142
2743
|
this.root.render(
|
|
3143
|
-
/* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ import_react47.default.createElement(UITag3, { prefixIcon: /* @__PURE__ */ import_react47.default.createElement(import_semi_icons9.IconIssueStroked, null), color: "amber" }, "Unknown")
|
|
3144
2745
|
);
|
|
3145
2746
|
return;
|
|
3146
2747
|
}
|
|
3147
|
-
const rootField = (0,
|
|
3148
|
-
const rootTitle = /* @__PURE__ */
|
|
2748
|
+
const rootField = (0, import_lodash5.last)(v.parentFields);
|
|
2749
|
+
const rootTitle = /* @__PURE__ */ import_react47.default.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
|
|
3149
2750
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
3150
2751
|
this.root.render(
|
|
3151
|
-
/* @__PURE__ */
|
|
3152
|
-
|
|
2752
|
+
/* @__PURE__ */ import_react47.default.createElement(
|
|
2753
|
+
import_semi_ui23.Popover,
|
|
3153
2754
|
{
|
|
3154
|
-
content: /* @__PURE__ */
|
|
2755
|
+
content: /* @__PURE__ */ import_react47.default.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ import_react47.default.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
|
|
3155
2756
|
},
|
|
3156
|
-
/* @__PURE__ */
|
|
2757
|
+
/* @__PURE__ */ import_react47.default.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react47.default.createElement(UIVarName3, null, v?.key))
|
|
3157
2758
|
)
|
|
3158
2759
|
);
|
|
3159
2760
|
}
|
|
@@ -3161,7 +2762,7 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
|
|
|
3161
2762
|
const dom = document.createElement("span");
|
|
3162
2763
|
this.root = (0, import_client.createRoot)(dom);
|
|
3163
2764
|
this.toDispose.push(
|
|
3164
|
-
|
|
2765
|
+
import_editor12.Disposable.create(() => {
|
|
3165
2766
|
this.root.unmount();
|
|
3166
2767
|
})
|
|
3167
2768
|
);
|
|
@@ -3178,7 +2779,7 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
|
|
|
3178
2779
|
return dom;
|
|
3179
2780
|
}
|
|
3180
2781
|
eq(other) {
|
|
3181
|
-
return (0,
|
|
2782
|
+
return (0, import_lodash5.isEqual)(this.keyPath, other.keyPath);
|
|
3182
2783
|
}
|
|
3183
2784
|
ignoreEvent() {
|
|
3184
2785
|
return false;
|
|
@@ -3188,9 +2789,9 @@ var VariableTagWidget2 = class extends import_view5.WidgetType {
|
|
|
3188
2789
|
}
|
|
3189
2790
|
};
|
|
3190
2791
|
function VariableTagInject2() {
|
|
3191
|
-
const injector = (0,
|
|
3192
|
-
const scope = (0,
|
|
3193
|
-
(0,
|
|
2792
|
+
const injector = (0, import_react48.useInjector)();
|
|
2793
|
+
const scope = (0, import_editor12.useCurrentScope)();
|
|
2794
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
3194
2795
|
const atMatcher = new import_view5.MatchDecorator({
|
|
3195
2796
|
regexp: /\{\{([^\}]+)\}\}/g,
|
|
3196
2797
|
decoration: (match) => import_view5.Decoration.replace({
|
|
@@ -3255,7 +2856,7 @@ var transformer = (0, import_preset_code6.transformerCreator)((text) => {
|
|
|
3255
2856
|
return text;
|
|
3256
2857
|
});
|
|
3257
2858
|
function JsonEditorWithVariables(props) {
|
|
3258
|
-
return /* @__PURE__ */
|
|
2859
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
3259
2860
|
CodeEditor,
|
|
3260
2861
|
{
|
|
3261
2862
|
languageId: "json",
|
|
@@ -3266,39 +2867,39 @@ function JsonEditorWithVariables(props) {
|
|
|
3266
2867
|
...props.options || {}
|
|
3267
2868
|
}
|
|
3268
2869
|
},
|
|
3269
|
-
/* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ import_react49.default.createElement(VariableTree2, null),
|
|
2871
|
+
/* @__PURE__ */ import_react49.default.createElement(VariableTagInject2, null)
|
|
3271
2872
|
);
|
|
3272
2873
|
}
|
|
3273
2874
|
|
|
3274
2875
|
// src/components/inputs-values/index.tsx
|
|
3275
|
-
var
|
|
3276
|
-
var
|
|
3277
|
-
var
|
|
2876
|
+
var import_react51 = __toESM(require("react"));
|
|
2877
|
+
var import_semi_ui24 = require("@douyinfe/semi-ui");
|
|
2878
|
+
var import_semi_icons10 = require("@douyinfe/semi-icons");
|
|
3278
2879
|
|
|
3279
2880
|
// src/components/inputs-values/styles.tsx
|
|
3280
|
-
var
|
|
3281
|
-
var UIRows2 =
|
|
2881
|
+
var import_styled_components10 = __toESM(require("styled-components"));
|
|
2882
|
+
var UIRows2 = import_styled_components10.default.div`
|
|
3282
2883
|
display: flex;
|
|
3283
2884
|
flex-direction: column;
|
|
3284
2885
|
gap: 10px;
|
|
3285
2886
|
margin-bottom: 10px;
|
|
3286
2887
|
`;
|
|
3287
|
-
var UIRow3 =
|
|
2888
|
+
var UIRow3 = import_styled_components10.default.div`
|
|
3288
2889
|
display: flex;
|
|
3289
2890
|
align-items: center;
|
|
3290
2891
|
gap: 5px;
|
|
3291
2892
|
`;
|
|
3292
2893
|
|
|
3293
2894
|
// src/components/inputs-values/components/blur-input.tsx
|
|
3294
|
-
var
|
|
2895
|
+
var import_react50 = __toESM(require("react"));
|
|
3295
2896
|
var import_input2 = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
|
|
3296
2897
|
function BlurInput2(props) {
|
|
3297
|
-
const [value, setValue] = (0,
|
|
3298
|
-
(0,
|
|
2898
|
+
const [value, setValue] = (0, import_react50.useState)("");
|
|
2899
|
+
(0, import_react50.useEffect)(() => {
|
|
3299
2900
|
setValue(props.value);
|
|
3300
2901
|
}, [props.value]);
|
|
3301
|
-
return /* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ import_react50.default.createElement(
|
|
3302
2903
|
import_input2.default,
|
|
3303
2904
|
{
|
|
3304
2905
|
...props,
|
|
@@ -3326,7 +2927,7 @@ function InputsValues({
|
|
|
3326
2927
|
onChange,
|
|
3327
2928
|
sortIndexKey: "extra.index"
|
|
3328
2929
|
});
|
|
3329
|
-
return /* @__PURE__ */
|
|
2930
|
+
return /* @__PURE__ */ import_react51.default.createElement("div", null, /* @__PURE__ */ import_react51.default.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ import_react51.default.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ import_react51.default.createElement(
|
|
3330
2931
|
BlurInput2,
|
|
3331
2932
|
{
|
|
3332
2933
|
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
@@ -3336,7 +2937,7 @@ function InputsValues({
|
|
|
3336
2937
|
onChange: (v) => updateKey(item.id, v),
|
|
3337
2938
|
placeholder: "Input Key"
|
|
3338
2939
|
}
|
|
3339
|
-
), /* @__PURE__ */
|
|
2940
|
+
), /* @__PURE__ */ import_react51.default.createElement(
|
|
3340
2941
|
DynamicValueInput,
|
|
3341
2942
|
{
|
|
3342
2943
|
style: { flexGrow: 1 },
|
|
@@ -3350,42 +2951,286 @@ function InputsValues({
|
|
|
3350
2951
|
strategies: [...constantProps?.strategies || []]
|
|
3351
2952
|
}
|
|
3352
2953
|
}
|
|
3353
|
-
), /* @__PURE__ */
|
|
3354
|
-
|
|
2954
|
+
), /* @__PURE__ */ import_react51.default.createElement(
|
|
2955
|
+
import_semi_ui24.IconButton,
|
|
3355
2956
|
{
|
|
3356
2957
|
disabled: readonly,
|
|
3357
2958
|
theme: "borderless",
|
|
3358
|
-
icon: /* @__PURE__ */
|
|
2959
|
+
icon: /* @__PURE__ */ import_react51.default.createElement(import_semi_icons10.IconDelete, { size: "small" }),
|
|
3359
2960
|
size: "small",
|
|
3360
2961
|
onClick: () => remove(item.id)
|
|
3361
2962
|
}
|
|
3362
|
-
)))), /* @__PURE__ */
|
|
2963
|
+
)))), /* @__PURE__ */ import_react51.default.createElement(import_semi_ui24.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react51.default.createElement(import_semi_icons10.IconPlus, null), size: "small", onClick: add }, "Add"));
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
// src/components/display-schema-tree/index.tsx
|
|
2967
|
+
var import_react52 = __toESM(require("react"));
|
|
2968
|
+
|
|
2969
|
+
// src/components/display-schema-tree/styles.tsx
|
|
2970
|
+
var import_styled_components11 = __toESM(require("styled-components"));
|
|
2971
|
+
var TreeRow = import_styled_components11.default.div`
|
|
2972
|
+
display: flex;
|
|
2973
|
+
align-items: center;
|
|
2974
|
+
|
|
2975
|
+
.tree-icon {
|
|
2976
|
+
margin-right: 8px;
|
|
2977
|
+
width: 14px;
|
|
2978
|
+
height: 14px;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
height: 27px;
|
|
2982
|
+
white-space: nowrap;
|
|
2983
|
+
`;
|
|
2984
|
+
var HorizontalLine = import_styled_components11.default.div`
|
|
2985
|
+
position: relative;
|
|
2986
|
+
|
|
2987
|
+
&::before,
|
|
2988
|
+
&::after {
|
|
2989
|
+
content: '';
|
|
2990
|
+
position: absolute;
|
|
2991
|
+
background-color: var(--semi-color-text-3);
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
&::after {
|
|
2995
|
+
top: 0px;
|
|
2996
|
+
right: 6px;
|
|
2997
|
+
width: 15px;
|
|
2998
|
+
height: 1px;
|
|
2999
|
+
}
|
|
3000
|
+
`;
|
|
3001
|
+
var TreeTitle = import_styled_components11.default.div`
|
|
3002
|
+
// overflow: hidden;
|
|
3003
|
+
// text-overflow: ellipsis;
|
|
3004
|
+
`;
|
|
3005
|
+
var TreeLevel = import_styled_components11.default.div`
|
|
3006
|
+
padding-left: 30px;
|
|
3007
|
+
position: relative;
|
|
3008
|
+
|
|
3009
|
+
/* &::before {
|
|
3010
|
+
content: '';
|
|
3011
|
+
position: absolute;
|
|
3012
|
+
background-color: var(--semi-color-text-3);
|
|
3013
|
+
top: 0px;
|
|
3014
|
+
bottom: 0px;
|
|
3015
|
+
left: -22px;
|
|
3016
|
+
width: 1px;
|
|
3017
|
+
} */
|
|
3018
|
+
`;
|
|
3019
|
+
var TreeItem = import_styled_components11.default.div`
|
|
3020
|
+
position: relative;
|
|
3021
|
+
|
|
3022
|
+
&::before {
|
|
3023
|
+
content: '';
|
|
3024
|
+
position: absolute;
|
|
3025
|
+
background-color: var(--semi-color-text-3);
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
&:not(:last-child)::before {
|
|
3029
|
+
width: 1px;
|
|
3030
|
+
top: 0;
|
|
3031
|
+
bottom: 0;
|
|
3032
|
+
left: -22px;
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
&:last-child::before {
|
|
3036
|
+
width: 1px;
|
|
3037
|
+
top: 0;
|
|
3038
|
+
height: 14px;
|
|
3039
|
+
left: -22px;
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
${(props) => props.depth === 0 && import_styled_components11.css`
|
|
3043
|
+
&::before {
|
|
3044
|
+
width: 0px !important;
|
|
3045
|
+
}
|
|
3046
|
+
`}
|
|
3047
|
+
`;
|
|
3048
|
+
|
|
3049
|
+
// src/components/display-schema-tree/index.tsx
|
|
3050
|
+
function DisplaySchemaTree(props) {
|
|
3051
|
+
return /* @__PURE__ */ import_react52.default.createElement(SchemaTree, { ...props });
|
|
3052
|
+
}
|
|
3053
|
+
function SchemaTree(props) {
|
|
3054
|
+
const {
|
|
3055
|
+
value: schema = {},
|
|
3056
|
+
drilldown = true,
|
|
3057
|
+
depth = 0,
|
|
3058
|
+
showIcon = true,
|
|
3059
|
+
parentKey = ""
|
|
3060
|
+
} = props || {};
|
|
3061
|
+
const typeManager = useTypeManager();
|
|
3062
|
+
const config = typeManager.getTypeBySchema(schema);
|
|
3063
|
+
const title = typeManager.getComplexText(schema);
|
|
3064
|
+
const icon = typeManager?.getDisplayIcon(schema);
|
|
3065
|
+
let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
|
|
3066
|
+
const childEntries = Object.entries(properties || {});
|
|
3067
|
+
return /* @__PURE__ */ import_react52.default.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ import_react52.default.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ import_react52.default.createElement(HorizontalLine, null), showIcon && icon && import_react52.default.cloneElement(icon, {
|
|
3068
|
+
className: "tree-icon"
|
|
3069
|
+
}), /* @__PURE__ */ import_react52.default.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ import_react52.default.createElement(import_react52.default.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ import_react52.default.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ import_react52.default.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
// src/components/display-outputs/index.tsx
|
|
3073
|
+
var import_react54 = __toESM(require("react"));
|
|
3074
|
+
var import_json_schema7 = require("@flowgram.ai/json-schema");
|
|
3075
|
+
var import_editor13 = require("@flowgram.ai/editor");
|
|
3076
|
+
|
|
3077
|
+
// src/components/display-schema-tag/index.tsx
|
|
3078
|
+
var import_react53 = __toESM(require("react"));
|
|
3079
|
+
var import_semi_ui26 = require("@douyinfe/semi-ui");
|
|
3080
|
+
|
|
3081
|
+
// src/components/display-schema-tag/styles.ts
|
|
3082
|
+
var import_styled_components12 = __toESM(require("styled-components"));
|
|
3083
|
+
var import_semi_ui25 = require("@douyinfe/semi-ui");
|
|
3084
|
+
var PopoverContent = import_styled_components12.default.div`
|
|
3085
|
+
padding: 10px;
|
|
3086
|
+
`;
|
|
3087
|
+
var StyledTag = (0, import_styled_components12.default)(import_semi_ui25.Tag)`
|
|
3088
|
+
padding: 4px;
|
|
3089
|
+
|
|
3090
|
+
.tag-icon {
|
|
3091
|
+
width: 12px;
|
|
3092
|
+
height: 12px;
|
|
3093
|
+
}
|
|
3094
|
+
`;
|
|
3095
|
+
var TitleSpan = import_styled_components12.default.span`
|
|
3096
|
+
display: inline-block;
|
|
3097
|
+
margin-left: 4px;
|
|
3098
|
+
margin-top: -1px;
|
|
3099
|
+
overflow: hidden;
|
|
3100
|
+
text-overflow: ellipsis;
|
|
3101
|
+
`;
|
|
3102
|
+
|
|
3103
|
+
// src/components/display-schema-tag/index.tsx
|
|
3104
|
+
function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
|
|
3105
|
+
const typeManager = useTypeManager();
|
|
3106
|
+
const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
|
|
3107
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
3108
|
+
import_semi_ui26.Popover,
|
|
3109
|
+
{
|
|
3110
|
+
content: /* @__PURE__ */ import_react53.default.createElement(PopoverContent, null, /* @__PURE__ */ import_react53.default.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
|
|
3111
|
+
},
|
|
3112
|
+
/* @__PURE__ */ import_react53.default.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && import_react53.default.cloneElement(icon, {
|
|
3113
|
+
className: "tag-icon"
|
|
3114
|
+
}), title && /* @__PURE__ */ import_react53.default.createElement(TitleSpan, null, title))
|
|
3115
|
+
);
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
// src/components/display-outputs/styles.ts
|
|
3119
|
+
var import_styled_components13 = __toESM(require("styled-components"));
|
|
3120
|
+
var DisplayOutputsWrapper = import_styled_components13.default.div`
|
|
3121
|
+
display: flex;
|
|
3122
|
+
gap: 5px;
|
|
3123
|
+
flex-wrap: wrap;
|
|
3124
|
+
`;
|
|
3125
|
+
|
|
3126
|
+
// src/components/display-outputs/index.tsx
|
|
3127
|
+
function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
3128
|
+
const scope = (0, import_editor13.useCurrentScope)();
|
|
3129
|
+
const refresh = (0, import_editor13.useRefresh)();
|
|
3130
|
+
(0, import_react54.useEffect)(() => {
|
|
3131
|
+
if (!displayFromScope) {
|
|
3132
|
+
return () => null;
|
|
3133
|
+
}
|
|
3134
|
+
const disposable = scope.output.onListOrAnyVarChange(() => {
|
|
3135
|
+
refresh();
|
|
3136
|
+
});
|
|
3137
|
+
return () => {
|
|
3138
|
+
disposable.dispose();
|
|
3139
|
+
};
|
|
3140
|
+
}, [displayFromScope]);
|
|
3141
|
+
const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
|
|
3142
|
+
acm = {
|
|
3143
|
+
...acm,
|
|
3144
|
+
...import_json_schema7.JsonSchemaUtils.astToSchema(curr.type)?.properties || {}
|
|
3145
|
+
};
|
|
3146
|
+
return acm;
|
|
3147
|
+
}, {}) : value?.properties || {};
|
|
3148
|
+
const childEntries = Object.entries(properties || {});
|
|
3149
|
+
return /* @__PURE__ */ import_react54.default.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ import_react54.default.createElement(DisplaySchemaTag, { key, title: key, value: schema, showIconInTree })));
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
// src/components/display-flow-value/index.tsx
|
|
3153
|
+
var import_react55 = __toESM(require("react"));
|
|
3154
|
+
var import_json_schema8 = require("@flowgram.ai/json-schema");
|
|
3155
|
+
var import_editor14 = require("@flowgram.ai/editor");
|
|
3156
|
+
function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
3157
|
+
const available = (0, import_editor14.useScopeAvailable)();
|
|
3158
|
+
const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
|
|
3159
|
+
const schema = (0, import_react55.useMemo)(() => {
|
|
3160
|
+
if (value?.type === "ref") {
|
|
3161
|
+
return import_json_schema8.JsonSchemaUtils.astToSchema(variable?.type);
|
|
3162
|
+
}
|
|
3163
|
+
if (value?.type === "template") {
|
|
3164
|
+
return { type: "string" };
|
|
3165
|
+
}
|
|
3166
|
+
if (value?.type === "constant") {
|
|
3167
|
+
if (value?.schema) {
|
|
3168
|
+
return value?.schema;
|
|
3169
|
+
}
|
|
3170
|
+
if (typeof value?.content === "string") {
|
|
3171
|
+
return { type: "string" };
|
|
3172
|
+
}
|
|
3173
|
+
if (typeof value?.content === "number") {
|
|
3174
|
+
return { type: "number" };
|
|
3175
|
+
}
|
|
3176
|
+
if (typeof value?.content === "boolean") {
|
|
3177
|
+
return { type: "boolean" };
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
return { type: "unknown" };
|
|
3181
|
+
}, [value, variable?.hash]);
|
|
3182
|
+
return /* @__PURE__ */ import_react55.default.createElement(
|
|
3183
|
+
DisplaySchemaTag,
|
|
3184
|
+
{
|
|
3185
|
+
title,
|
|
3186
|
+
value: schema,
|
|
3187
|
+
showIconInTree,
|
|
3188
|
+
warning: value?.type === "ref" && !variable
|
|
3189
|
+
}
|
|
3190
|
+
);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
// src/components/display-inputs-values/index.tsx
|
|
3194
|
+
var import_react56 = __toESM(require("react"));
|
|
3195
|
+
|
|
3196
|
+
// src/components/display-inputs-values/styles.ts
|
|
3197
|
+
var import_styled_components14 = __toESM(require("styled-components"));
|
|
3198
|
+
var DisplayInputsWrapper = import_styled_components14.default.div`
|
|
3199
|
+
display: flex;
|
|
3200
|
+
gap: 5px;
|
|
3201
|
+
flex-wrap: wrap;
|
|
3202
|
+
`;
|
|
3203
|
+
|
|
3204
|
+
// src/components/display-inputs-values/index.tsx
|
|
3205
|
+
function DisplayInputsValues({ value, showIconInTree }) {
|
|
3206
|
+
const childEntries = Object.entries(value || {});
|
|
3207
|
+
return /* @__PURE__ */ import_react56.default.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => /* @__PURE__ */ import_react56.default.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree })));
|
|
3363
3208
|
}
|
|
3364
3209
|
|
|
3365
3210
|
// src/effects/provide-batch-input/index.ts
|
|
3366
|
-
var
|
|
3367
|
-
var provideBatchInputEffect = (0,
|
|
3211
|
+
var import_editor15 = require("@flowgram.ai/editor");
|
|
3212
|
+
var provideBatchInputEffect = (0, import_editor15.createEffectFromVariableProvider)({
|
|
3368
3213
|
private: true,
|
|
3369
3214
|
parse: (value, ctx) => [
|
|
3370
|
-
|
|
3215
|
+
import_editor15.ASTFactory.createVariableDeclaration({
|
|
3371
3216
|
key: `${ctx.node.id}_locals`,
|
|
3372
3217
|
meta: {
|
|
3373
|
-
title: (0,
|
|
3218
|
+
title: (0, import_editor15.getNodeForm)(ctx.node)?.getValueIn("title"),
|
|
3374
3219
|
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3375
3220
|
},
|
|
3376
|
-
type:
|
|
3221
|
+
type: import_editor15.ASTFactory.createObject({
|
|
3377
3222
|
properties: [
|
|
3378
|
-
|
|
3223
|
+
import_editor15.ASTFactory.createProperty({
|
|
3379
3224
|
key: "item",
|
|
3380
|
-
initializer:
|
|
3381
|
-
enumerateFor:
|
|
3225
|
+
initializer: import_editor15.ASTFactory.createEnumerateExpression({
|
|
3226
|
+
enumerateFor: import_editor15.ASTFactory.createKeyPathExpression({
|
|
3382
3227
|
keyPath: value.content || []
|
|
3383
3228
|
})
|
|
3384
3229
|
})
|
|
3385
3230
|
}),
|
|
3386
|
-
|
|
3231
|
+
import_editor15.ASTFactory.createProperty({
|
|
3387
3232
|
key: "index",
|
|
3388
|
-
type:
|
|
3233
|
+
type: import_editor15.ASTFactory.createNumber()
|
|
3389
3234
|
})
|
|
3390
3235
|
]
|
|
3391
3236
|
})
|
|
@@ -3394,14 +3239,14 @@ var provideBatchInputEffect = (0, import_editor12.createEffectFromVariableProvid
|
|
|
3394
3239
|
});
|
|
3395
3240
|
|
|
3396
3241
|
// src/effects/auto-rename-ref/index.ts
|
|
3397
|
-
var
|
|
3398
|
-
var
|
|
3242
|
+
var import_lodash6 = require("lodash");
|
|
3243
|
+
var import_editor16 = require("@flowgram.ai/editor");
|
|
3399
3244
|
var autoRenameRefEffect = [
|
|
3400
3245
|
{
|
|
3401
|
-
event:
|
|
3246
|
+
event: import_editor16.DataEvent.onValueInit,
|
|
3402
3247
|
effect: (params) => {
|
|
3403
3248
|
const { context, form, name } = params;
|
|
3404
|
-
const renameService = context.node.getService(
|
|
3249
|
+
const renameService = context.node.getService(import_editor16.VariableFieldKeyRenameService);
|
|
3405
3250
|
const disposable = renameService.onRename(({ before, after }) => {
|
|
3406
3251
|
const beforeKeyPath = [
|
|
3407
3252
|
...before.parentFields.map((_field) => _field.key).reverse(),
|
|
@@ -3450,7 +3295,7 @@ function isKeyPathMatch(keyPath = [], targetKeyPath) {
|
|
|
3450
3295
|
}
|
|
3451
3296
|
function getTemplateKeyPaths(value) {
|
|
3452
3297
|
const keyPathReg = /{{(.*?)}}/g;
|
|
3453
|
-
return (0,
|
|
3298
|
+
return (0, import_lodash6.uniq)(value.content?.match(keyPathReg) || []).map(
|
|
3454
3299
|
(_keyPath) => _keyPath.slice(2, -2).split(".")
|
|
3455
3300
|
);
|
|
3456
3301
|
}
|
|
@@ -3461,7 +3306,7 @@ function isTemplate(value) {
|
|
|
3461
3306
|
return value?.type === "template" && typeof value?.content === "string";
|
|
3462
3307
|
}
|
|
3463
3308
|
function traverseRef(name, value, cb) {
|
|
3464
|
-
if ((0,
|
|
3309
|
+
if ((0, import_lodash6.isObject)(value)) {
|
|
3465
3310
|
if (isRef(value)) {
|
|
3466
3311
|
cb(name, value);
|
|
3467
3312
|
return;
|
|
@@ -3475,7 +3320,7 @@ function traverseRef(name, value, cb) {
|
|
|
3475
3320
|
});
|
|
3476
3321
|
return;
|
|
3477
3322
|
}
|
|
3478
|
-
if ((0,
|
|
3323
|
+
if ((0, import_lodash6.isArray)(value)) {
|
|
3479
3324
|
value.forEach((_value, idx) => {
|
|
3480
3325
|
traverseRef(`${name}[${idx}]`, _value, cb);
|
|
3481
3326
|
});
|
|
@@ -3485,29 +3330,31 @@ function traverseRef(name, value, cb) {
|
|
|
3485
3330
|
}
|
|
3486
3331
|
|
|
3487
3332
|
// src/effects/provide-json-schema-outputs/index.ts
|
|
3488
|
-
var
|
|
3489
|
-
var
|
|
3333
|
+
var import_json_schema9 = require("@flowgram.ai/json-schema");
|
|
3334
|
+
var import_editor17 = require("@flowgram.ai/editor");
|
|
3335
|
+
var provideJsonSchemaOutputs = (0, import_editor17.createEffectFromVariableProvider)({
|
|
3490
3336
|
parse: (value, ctx) => [
|
|
3491
|
-
|
|
3337
|
+
import_editor17.ASTFactory.createVariableDeclaration({
|
|
3492
3338
|
key: `${ctx.node.id}`,
|
|
3493
3339
|
meta: {
|
|
3494
|
-
title: (0,
|
|
3340
|
+
title: (0, import_editor17.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
|
|
3495
3341
|
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3496
3342
|
},
|
|
3497
|
-
type: JsonSchemaUtils.schemaToAST(value)
|
|
3343
|
+
type: import_json_schema9.JsonSchemaUtils.schemaToAST(value)
|
|
3498
3344
|
})
|
|
3499
3345
|
]
|
|
3500
3346
|
});
|
|
3501
3347
|
|
|
3502
3348
|
// src/effects/sync-variable-title/index.ts
|
|
3503
|
-
var
|
|
3349
|
+
var import_editor18 = require("@flowgram.ai/editor");
|
|
3504
3350
|
var syncVariableTitle = [
|
|
3505
3351
|
{
|
|
3506
|
-
event:
|
|
3352
|
+
event: import_editor18.DataEvent.onValueChange,
|
|
3507
3353
|
effect: ({ value, context }) => {
|
|
3508
|
-
context.node.getData(
|
|
3354
|
+
context.node.getData(import_editor18.FlowNodeVariableData).allScopes.forEach((_scope) => {
|
|
3509
3355
|
_scope.output.variables.forEach((_var) => {
|
|
3510
3356
|
_var.updateMeta({
|
|
3357
|
+
..._var.meta || {},
|
|
3511
3358
|
title: value || context.node.id,
|
|
3512
3359
|
icon: context.node.getNodeRegistry().info?.icon
|
|
3513
3360
|
});
|
|
@@ -3517,22 +3364,84 @@ var syncVariableTitle = [
|
|
|
3517
3364
|
}
|
|
3518
3365
|
];
|
|
3519
3366
|
|
|
3367
|
+
// src/shared/format-legacy-refs/index.ts
|
|
3368
|
+
var import_lodash7 = require("lodash");
|
|
3369
|
+
function formatLegacyRefOnSubmit(value) {
|
|
3370
|
+
if ((0, import_lodash7.isObject)(value)) {
|
|
3371
|
+
if (isLegacyFlowRefValueSchema(value)) {
|
|
3372
|
+
return formatLegacyRefToNewRef(value);
|
|
3373
|
+
}
|
|
3374
|
+
return Object.fromEntries(
|
|
3375
|
+
Object.entries(value).map(([key, value2]) => [
|
|
3376
|
+
key,
|
|
3377
|
+
formatLegacyRefOnSubmit(value2)
|
|
3378
|
+
])
|
|
3379
|
+
);
|
|
3380
|
+
}
|
|
3381
|
+
if (Array.isArray(value)) {
|
|
3382
|
+
return value.map(formatLegacyRefOnSubmit);
|
|
3383
|
+
}
|
|
3384
|
+
return value;
|
|
3385
|
+
}
|
|
3386
|
+
function formatLegacyRefOnInit(value) {
|
|
3387
|
+
if ((0, import_lodash7.isObject)(value)) {
|
|
3388
|
+
if (isNewFlowRefValueSchema(value)) {
|
|
3389
|
+
return formatNewRefToLegacyRef(value);
|
|
3390
|
+
}
|
|
3391
|
+
return Object.fromEntries(
|
|
3392
|
+
Object.entries(value).map(([key, value2]) => [
|
|
3393
|
+
key,
|
|
3394
|
+
formatLegacyRefOnInit(value2)
|
|
3395
|
+
])
|
|
3396
|
+
);
|
|
3397
|
+
}
|
|
3398
|
+
if (Array.isArray(value)) {
|
|
3399
|
+
return value.map(formatLegacyRefOnInit);
|
|
3400
|
+
}
|
|
3401
|
+
return value;
|
|
3402
|
+
}
|
|
3403
|
+
function isLegacyFlowRefValueSchema(value) {
|
|
3404
|
+
return (0, import_lodash7.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
|
|
3405
|
+
}
|
|
3406
|
+
function isNewFlowRefValueSchema(value) {
|
|
3407
|
+
return (0, import_lodash7.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
|
|
3408
|
+
}
|
|
3409
|
+
function formatLegacyRefToNewRef(value) {
|
|
3410
|
+
const keyPath = value.content.split(".");
|
|
3411
|
+
if (keyPath[1] === "outputs") {
|
|
3412
|
+
return {
|
|
3413
|
+
type: "ref",
|
|
3414
|
+
content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3417
|
+
return {
|
|
3418
|
+
type: "ref",
|
|
3419
|
+
content: keyPath
|
|
3420
|
+
};
|
|
3421
|
+
}
|
|
3422
|
+
function formatNewRefToLegacyRef(value) {
|
|
3423
|
+
return {
|
|
3424
|
+
type: "ref",
|
|
3425
|
+
content: value.content.join(".")
|
|
3426
|
+
};
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3520
3429
|
// src/form-plugins/batch-outputs-plugin/index.ts
|
|
3521
|
-
var
|
|
3522
|
-
var provideBatchOutputsEffect = (0,
|
|
3430
|
+
var import_editor19 = require("@flowgram.ai/editor");
|
|
3431
|
+
var provideBatchOutputsEffect = (0, import_editor19.createEffectFromVariableProvider)({
|
|
3523
3432
|
parse: (value, ctx) => [
|
|
3524
|
-
|
|
3433
|
+
import_editor19.ASTFactory.createVariableDeclaration({
|
|
3525
3434
|
key: `${ctx.node.id}`,
|
|
3526
3435
|
meta: {
|
|
3527
|
-
title: (0,
|
|
3436
|
+
title: (0, import_editor19.getNodeForm)(ctx.node)?.getValueIn("title"),
|
|
3528
3437
|
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3529
3438
|
},
|
|
3530
|
-
type:
|
|
3439
|
+
type: import_editor19.ASTFactory.createObject({
|
|
3531
3440
|
properties: Object.entries(value).map(
|
|
3532
|
-
([_key, value2]) =>
|
|
3441
|
+
([_key, value2]) => import_editor19.ASTFactory.createProperty({
|
|
3533
3442
|
key: _key,
|
|
3534
|
-
initializer:
|
|
3535
|
-
wrapFor:
|
|
3443
|
+
initializer: import_editor19.ASTFactory.createWrapArrayExpression({
|
|
3444
|
+
wrapFor: import_editor19.ASTFactory.createKeyPathExpression({
|
|
3536
3445
|
keyPath: value2?.content || []
|
|
3537
3446
|
})
|
|
3538
3447
|
})
|
|
@@ -3542,7 +3451,7 @@ var provideBatchOutputsEffect = (0, import_editor16.createEffectFromVariableProv
|
|
|
3542
3451
|
})
|
|
3543
3452
|
]
|
|
3544
3453
|
});
|
|
3545
|
-
var createBatchOutputsFormPlugin = (0,
|
|
3454
|
+
var createBatchOutputsFormPlugin = (0, import_editor19.defineFormPluginCreator)({
|
|
3546
3455
|
name: "batch-outputs-plugin",
|
|
3547
3456
|
onSetupFormMeta({ mergeEffect }, { outputKey }) {
|
|
3548
3457
|
mergeEffect({
|
|
@@ -3550,7 +3459,7 @@ var createBatchOutputsFormPlugin = (0, import_editor16.defineFormPluginCreator)(
|
|
|
3550
3459
|
});
|
|
3551
3460
|
},
|
|
3552
3461
|
onInit(ctx, { outputKey }) {
|
|
3553
|
-
const chainTransformService = ctx.node.getService(
|
|
3462
|
+
const chainTransformService = ctx.node.getService(import_editor19.ScopeChainTransformService);
|
|
3554
3463
|
const batchNodeType = ctx.node.flowNodeType;
|
|
3555
3464
|
const transformerId = `${batchNodeType}-outputs`;
|
|
3556
3465
|
if (chainTransformService.hasTransformer(transformerId)) {
|
|
@@ -3560,21 +3469,21 @@ var createBatchOutputsFormPlugin = (0, import_editor16.defineFormPluginCreator)(
|
|
|
3560
3469
|
transformCovers: (covers, ctx2) => {
|
|
3561
3470
|
const node = ctx2.scope.meta?.node;
|
|
3562
3471
|
if (node?.parent?.flowNodeType === batchNodeType) {
|
|
3563
|
-
return [...covers, (0,
|
|
3472
|
+
return [...covers, (0, import_editor19.getNodeScope)(node.parent)];
|
|
3564
3473
|
}
|
|
3565
3474
|
return covers;
|
|
3566
3475
|
},
|
|
3567
3476
|
transformDeps(scopes, ctx2) {
|
|
3568
3477
|
const scopeMeta = ctx2.scope.meta;
|
|
3569
|
-
if (scopeMeta?.type ===
|
|
3478
|
+
if (scopeMeta?.type === import_editor19.FlowNodeScopeType.private) {
|
|
3570
3479
|
return scopes;
|
|
3571
3480
|
}
|
|
3572
3481
|
const node = scopeMeta?.node;
|
|
3573
3482
|
if (node?.flowNodeType === batchNodeType) {
|
|
3574
3483
|
const childBlocks = node.blocks;
|
|
3575
3484
|
return [
|
|
3576
|
-
(0,
|
|
3577
|
-
...childBlocks.map((_childBlock) => (0,
|
|
3485
|
+
(0, import_editor19.getNodePrivateScope)(node),
|
|
3486
|
+
...childBlocks.map((_childBlock) => (0, import_editor19.getNodeScope)(_childBlock))
|
|
3578
3487
|
];
|
|
3579
3488
|
}
|
|
3580
3489
|
return scopes;
|
|
@@ -3584,20 +3493,21 @@ var createBatchOutputsFormPlugin = (0, import_editor16.defineFormPluginCreator)(
|
|
|
3584
3493
|
});
|
|
3585
3494
|
|
|
3586
3495
|
// src/form-plugins/infer-inputs-plugin/index.ts
|
|
3587
|
-
var
|
|
3588
|
-
var
|
|
3589
|
-
var
|
|
3496
|
+
var import_lodash8 = require("lodash");
|
|
3497
|
+
var import_json_schema10 = require("@flowgram.ai/json-schema");
|
|
3498
|
+
var import_editor20 = require("@flowgram.ai/editor");
|
|
3499
|
+
var createInferInputsPlugin = (0, import_editor20.defineFormPluginCreator)({
|
|
3590
3500
|
onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
|
|
3591
3501
|
if (!sourceKey || !targetKey) {
|
|
3592
3502
|
return;
|
|
3593
3503
|
}
|
|
3594
3504
|
addFormatOnSubmit((formData, ctx) => {
|
|
3595
|
-
(0,
|
|
3505
|
+
(0, import_lodash8.set)(
|
|
3596
3506
|
formData,
|
|
3597
3507
|
targetKey,
|
|
3598
3508
|
infer(
|
|
3599
|
-
(0,
|
|
3600
|
-
scope === "private" ? (0,
|
|
3509
|
+
(0, import_lodash8.get)(formData, sourceKey),
|
|
3510
|
+
scope === "private" ? (0, import_editor20.getNodePrivateScope)(ctx.node) : (0, import_editor20.getNodeScope)(ctx.node)
|
|
3601
3511
|
)
|
|
3602
3512
|
);
|
|
3603
3513
|
return formData;
|
|
@@ -3637,7 +3547,7 @@ var infer = (values, scope) => {
|
|
|
3637
3547
|
}
|
|
3638
3548
|
if (isRef2(values)) {
|
|
3639
3549
|
const variable = scope.available.getByKeyPath(values?.content);
|
|
3640
|
-
const schema = variable?.type ? JsonSchemaUtils.astToSchema(variable?.type) : void 0;
|
|
3550
|
+
const schema = variable?.type ? import_json_schema10.JsonSchemaUtils.astToSchema(variable?.type) : void 0;
|
|
3641
3551
|
return schema;
|
|
3642
3552
|
}
|
|
3643
3553
|
if (isTemplate2(values)) {
|
|
@@ -3659,31 +3569,37 @@ var infer = (values, scope) => {
|
|
|
3659
3569
|
};
|
|
3660
3570
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3661
3571
|
0 && (module.exports = {
|
|
3662
|
-
ArrayIcons,
|
|
3663
3572
|
BatchOutputs,
|
|
3664
3573
|
BatchVariableSelector,
|
|
3665
3574
|
CodeEditor,
|
|
3575
|
+
CodeEditorMini,
|
|
3666
3576
|
ConditionRow,
|
|
3667
3577
|
ConstantInput,
|
|
3578
|
+
DisplayFlowValue,
|
|
3579
|
+
DisplayInputsValues,
|
|
3580
|
+
DisplayOutputs,
|
|
3581
|
+
DisplaySchemaTag,
|
|
3582
|
+
DisplaySchemaTree,
|
|
3668
3583
|
DynamicValueInput,
|
|
3669
3584
|
InputsValues,
|
|
3670
3585
|
JsonEditorWithVariables,
|
|
3671
3586
|
JsonSchemaEditor,
|
|
3587
|
+
JsonSchemaTypePresetProvider,
|
|
3672
3588
|
JsonSchemaUtils,
|
|
3673
3589
|
PromptEditor,
|
|
3674
3590
|
PromptEditorWithInputs,
|
|
3675
3591
|
PromptEditorWithVariables,
|
|
3676
3592
|
TypeSelector,
|
|
3677
3593
|
VariableSelector,
|
|
3678
|
-
VariableTypeIcons,
|
|
3679
3594
|
autoRenameRefEffect,
|
|
3680
3595
|
createBatchOutputsFormPlugin,
|
|
3596
|
+
createDisableDeclarationPlugin,
|
|
3681
3597
|
createInferInputsPlugin,
|
|
3598
|
+
createTypePresetPlugin,
|
|
3682
3599
|
formatLegacyRefOnInit,
|
|
3683
3600
|
formatLegacyRefOnSubmit,
|
|
3684
3601
|
formatLegacyRefToNewRef,
|
|
3685
3602
|
formatNewRefToLegacyRef,
|
|
3686
|
-
getSchemaIcon,
|
|
3687
3603
|
getTypeSelectValue,
|
|
3688
3604
|
isLegacyFlowRefValueSchema,
|
|
3689
3605
|
isNewFlowRefValueSchema,
|
|
@@ -3692,6 +3608,7 @@ var infer = (values, scope) => {
|
|
|
3692
3608
|
provideBatchOutputsEffect,
|
|
3693
3609
|
provideJsonSchemaOutputs,
|
|
3694
3610
|
syncVariableTitle,
|
|
3611
|
+
useTypeManager,
|
|
3695
3612
|
useVariableTree
|
|
3696
3613
|
});
|
|
3697
3614
|
//# sourceMappingURL=index.js.map
|