@flowgram.ai/form-materials 0.1.0-alpha.11 → 0.1.0-alpha.12
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 +10 -1
- package/dist/esm/index.js +1917 -1371
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +320 -113
- package/dist/index.d.ts +320 -113
- package/dist/index.js +2023 -1484
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/components/assign-row/components/blur-input.tsx +27 -0
- package/src/components/assign-row/config.json +11 -0
- package/src/components/assign-row/index.tsx +84 -0
- package/src/components/assign-row/types.ts +25 -0
- package/src/components/assign-rows/config.json +11 -0
- package/src/components/assign-rows/index.tsx +59 -0
- package/src/components/batch-outputs/config.json +2 -1
- package/src/components/batch-outputs/index.tsx +4 -12
- 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/index.tsx +7 -0
- package/src/components/code-editor/language-features.ts +22 -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 +6 -8
- package/src/components/condition-row/hooks/useOp.tsx +3 -1
- package/src/components/condition-row/hooks/useRule.ts +2 -2
- package/src/components/condition-row/index.tsx +2 -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 +18 -62
- package/src/components/constant-input/types.ts +6 -9
- 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 +64 -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 +64 -13
- package/src/components/dynamic-value-input/styles.tsx +28 -2
- package/src/components/index.ts +9 -0
- package/src/components/inputs-values/components/blur-input.tsx +27 -0
- package/src/components/inputs-values/config.json +13 -0
- package/src/components/inputs-values/index.tsx +73 -0
- package/src/components/inputs-values/styles.tsx +19 -0
- package/src/components/inputs-values/types.ts +22 -0
- 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 +15 -2
- package/src/components/json-schema-editor/types.ts +1 -1
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +1 -1
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +6 -3
- package/src/components/type-selector/config.json +6 -2
- package/src/components/type-selector/index.tsx +55 -12
- package/src/components/variable-selector/config.json +6 -2
- package/src/components/variable-selector/index.tsx +34 -13
- package/src/components/variable-selector/styles.tsx +18 -8
- package/src/components/variable-selector/use-variable-tree.tsx +19 -22
- package/src/effects/index.ts +3 -1
- package/src/effects/listen-ref-schema-change/config.json +10 -0
- package/src/effects/listen-ref-schema-change/index.ts +56 -0
- package/src/effects/listen-ref-value-change/config.json +9 -0
- package/src/effects/listen-ref-value-change/index.ts +53 -0
- 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/effects/validate-when-variable-sync/config.json +5 -0
- package/src/effects/validate-when-variable-sync/index.ts +35 -0
- package/src/form-plugins/index.ts +3 -1
- package/src/form-plugins/infer-assign-plugin/config.json +7 -0
- package/src/form-plugins/infer-assign-plugin/index.ts +90 -0
- package/src/form-plugins/infer-inputs-plugin/config.json +9 -0
- package/src/form-plugins/infer-inputs-plugin/index.ts +108 -0
- package/src/hooks/index.tsx +6 -0
- package/src/hooks/use-object-list/config.json +8 -0
- package/src/hooks/use-object-list/index.tsx +136 -0
- package/src/index.ts +3 -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 +41 -0
- package/src/plugins/json-schema-preset/manager.ts +18 -0
- package/src/plugins/json-schema-preset/type-definition/array.tsx +24 -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 +24 -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 +3 -1
- package/src/typings/flow-value/index.ts +11 -0
- package/src/typings/index.ts +0 -1
- package/src/validate/index.tsx +6 -0
- package/src/validate/validate-flow-value/config.json +7 -0
- package/src/validate/validate-flow-value/index.tsx +73 -0
- package/src/components/batch-outputs/use-list.ts +0 -86
- package/src/components/type-selector/constants.tsx +0 -364
- package/src/effects/provide-batch-outputs/config.json +0 -5
- package/src/effects/provide-batch-outputs/index.ts +0 -38
- 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/esm/index.js
CHANGED
|
@@ -1,551 +1,567 @@
|
|
|
1
1
|
// src/components/variable-selector/index.tsx
|
|
2
|
-
import
|
|
2
|
+
import React11, { useMemo } from "react";
|
|
3
|
+
import { Popover } from "@douyinfe/semi-ui";
|
|
3
4
|
import { IconChevronDownStroked, IconIssueStroked } from "@douyinfe/semi-icons";
|
|
4
5
|
|
|
5
6
|
// src/components/variable-selector/use-variable-tree.tsx
|
|
6
|
-
import
|
|
7
|
+
import React10, { useCallback } from "react";
|
|
8
|
+
import { JsonSchemaUtils as JsonSchemaUtils2 } from "@flowgram.ai/json-schema";
|
|
7
9
|
import { ASTMatch as ASTMatch2, useAvailableVariables } from "@flowgram.ai/editor";
|
|
8
|
-
import { Icon
|
|
10
|
+
import { Icon } from "@douyinfe/semi-ui";
|
|
9
11
|
|
|
10
|
-
// src/
|
|
12
|
+
// src/plugins/json-schema-preset/index.tsx
|
|
13
|
+
import React9 from "react";
|
|
14
|
+
import {
|
|
15
|
+
JsonSchemaUtils,
|
|
16
|
+
useTypeManager as useOriginTypeManager,
|
|
17
|
+
TypePresetProvider as OriginTypePresetProvider
|
|
18
|
+
} from "@flowgram.ai/json-schema";
|
|
19
|
+
|
|
20
|
+
// src/plugins/json-schema-preset/type-definition/index.tsx
|
|
21
|
+
import { jsonSchemaTypeManager } from "@flowgram.ai/json-schema";
|
|
22
|
+
|
|
23
|
+
// src/plugins/json-schema-preset/type-definition/string.tsx
|
|
11
24
|
import React from "react";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
import { Input } from "@douyinfe/semi-ui";
|
|
26
|
+
var stringRegistry = {
|
|
27
|
+
type: "string",
|
|
28
|
+
ConstantRenderer: (props) => /* @__PURE__ */ React.createElement(Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/plugins/json-schema-preset/type-definition/object.tsx
|
|
32
|
+
import React4 from "react";
|
|
33
|
+
|
|
34
|
+
// src/components/code-editor-mini/index.tsx
|
|
35
|
+
import React3 from "react";
|
|
36
|
+
import styled from "styled-components";
|
|
37
|
+
|
|
38
|
+
// src/components/code-editor/index.tsx
|
|
39
|
+
import React2, { useEffect, useRef } from "react";
|
|
40
|
+
import {
|
|
41
|
+
ActiveLinePlaceholder,
|
|
42
|
+
createRenderer,
|
|
43
|
+
EditorProvider
|
|
44
|
+
} from "@coze-editor/editor/react";
|
|
45
|
+
import preset from "@coze-editor/editor/preset-code";
|
|
46
|
+
import { EditorView } from "@codemirror/view";
|
|
47
|
+
|
|
48
|
+
// src/components/code-editor/utils.ts
|
|
49
|
+
function getSuffixByLanguageId(languageId) {
|
|
50
|
+
if (languageId === "python") {
|
|
51
|
+
return ".py";
|
|
52
|
+
}
|
|
53
|
+
if (languageId === "typescript") {
|
|
54
|
+
return ".ts";
|
|
55
|
+
}
|
|
56
|
+
if (languageId === "shell") {
|
|
57
|
+
return ".sh";
|
|
58
|
+
}
|
|
59
|
+
if (languageId === "json") {
|
|
60
|
+
return ".json";
|
|
61
|
+
}
|
|
62
|
+
return "";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/components/code-editor/language-features.ts
|
|
66
|
+
import { languages } from "@coze-editor/editor/preset-code";
|
|
67
|
+
import { typescript } from "@coze-editor/editor/language-typescript";
|
|
68
|
+
import { shell } from "@coze-editor/editor/language-shell";
|
|
69
|
+
import { python } from "@coze-editor/editor/language-python";
|
|
70
|
+
import { json } from "@coze-editor/editor/language-json";
|
|
71
|
+
import { mixLanguages } from "@coze-editor/editor";
|
|
72
|
+
languages.register("python", python);
|
|
73
|
+
languages.register("shell", shell);
|
|
74
|
+
languages.register("typescript", typescript);
|
|
75
|
+
languages.register("json", {
|
|
76
|
+
// mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
|
|
77
|
+
language: mixLanguages({
|
|
78
|
+
outerLanguage: json.language
|
|
79
|
+
}),
|
|
80
|
+
languageService: json.languageService
|
|
81
|
+
});
|
|
82
|
+
var tsWorkerInit = false;
|
|
83
|
+
var initTsWorker = () => {
|
|
84
|
+
if (tsWorkerInit) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
tsWorkerInit = true;
|
|
88
|
+
const tsWorker = new Worker(
|
|
89
|
+
new URL(`@coze-editor/editor/language-typescript/worker`, import.meta.url),
|
|
90
|
+
{ type: "module" }
|
|
91
|
+
);
|
|
92
|
+
typescript.languageService.initialize(tsWorker, {
|
|
93
|
+
compilerOptions: {
|
|
94
|
+
// eliminate Promise error
|
|
95
|
+
lib: ["es2015", "dom"],
|
|
96
|
+
noImplicitAny: false
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/components/code-editor/theme/index.ts
|
|
102
|
+
import { themes } from "@coze-editor/editor/preset-code";
|
|
103
|
+
|
|
104
|
+
// src/components/code-editor/theme/light.ts
|
|
105
|
+
import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
|
|
106
|
+
var colors = {
|
|
107
|
+
background: "#F7F7FC",
|
|
108
|
+
// syntax
|
|
109
|
+
comment: "#000A298A",
|
|
110
|
+
key: "#00818C",
|
|
111
|
+
string: "#D1009D",
|
|
112
|
+
number: "#C74200",
|
|
113
|
+
boolean: "#2B57D9",
|
|
114
|
+
null: "#2B57D9",
|
|
115
|
+
separator: "#0F1529D1"
|
|
116
|
+
};
|
|
117
|
+
var lightTheme = createTheme({
|
|
118
|
+
variant: "light",
|
|
119
|
+
settings: {
|
|
120
|
+
background: "#fff",
|
|
121
|
+
foreground: "#000",
|
|
122
|
+
caret: "#000",
|
|
123
|
+
selection: "#d9d9d9",
|
|
124
|
+
gutterBackground: "#f0f0f0",
|
|
125
|
+
gutterForeground: "#666",
|
|
126
|
+
gutterBorderColor: "transparent",
|
|
127
|
+
gutterBorderWidth: 0,
|
|
128
|
+
lineHighlight: "#e1e1e180",
|
|
129
|
+
bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
|
|
130
|
+
tooltip: {
|
|
131
|
+
backgroundColor: "#f0f0f0",
|
|
132
|
+
color: "#000",
|
|
133
|
+
border: "1px solid #ccc"
|
|
24
134
|
},
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
{
|
|
28
|
-
fillRule: "evenodd",
|
|
29
|
-
clipRule: "evenodd",
|
|
30
|
-
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",
|
|
31
|
-
fill: "currentColor"
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
),
|
|
35
|
-
object: /* @__PURE__ */ React.createElement(
|
|
36
|
-
"svg",
|
|
37
|
-
{
|
|
38
|
-
width: "1em",
|
|
39
|
-
height: "1em",
|
|
40
|
-
viewBox: "0 0 16 16",
|
|
41
|
-
fill: "none",
|
|
42
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
135
|
+
link: {
|
|
136
|
+
color: "#007bff"
|
|
43
137
|
},
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
{
|
|
47
|
-
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",
|
|
48
|
-
fill: "currentColor"
|
|
49
|
-
}
|
|
50
|
-
),
|
|
51
|
-
/* @__PURE__ */ React.createElement(
|
|
52
|
-
"path",
|
|
53
|
-
{
|
|
54
|
-
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",
|
|
55
|
-
fill: "currentColor"
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
),
|
|
59
|
-
boolean: /* @__PURE__ */ React.createElement(
|
|
60
|
-
"svg",
|
|
61
|
-
{
|
|
62
|
-
width: "1em",
|
|
63
|
-
height: "1em",
|
|
64
|
-
viewBox: "0 0 16 16",
|
|
65
|
-
fill: "none",
|
|
66
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
138
|
+
completionItemHover: {
|
|
139
|
+
backgroundColor: "#f0f0f0"
|
|
67
140
|
},
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
{
|
|
71
|
-
fillRule: "evenodd",
|
|
72
|
-
clipRule: "evenodd",
|
|
73
|
-
d: "M10.668 4.66683H5.33463C3.49369 4.66683 2.0013 6.15921 2.0013 8.00016C2.0013 9.84111 3.49369 11.3335 5.33463 11.3335H10.668C12.5089 11.3335 14.0013 9.84111 14.0013 8.00016C14.0013 6.15921 12.5089 4.66683 10.668 4.66683ZM5.33463 3.3335C2.75731 3.3335 0.667969 5.42283 0.667969 8.00016C0.667969 10.5775 2.75731 12.6668 5.33463 12.6668H10.668C13.2453 12.6668 15.3346 10.5775 15.3346 8.00016C15.3346 5.42283 13.2453 3.3335 10.668 3.3335H5.33463Z",
|
|
74
|
-
fill: "currentColor"
|
|
75
|
-
}
|
|
76
|
-
),
|
|
77
|
-
/* @__PURE__ */ React.createElement(
|
|
78
|
-
"path",
|
|
79
|
-
{
|
|
80
|
-
fillRule: "evenodd",
|
|
81
|
-
clipRule: "evenodd",
|
|
82
|
-
d: "M8.66797 8.00016C8.66797 6.89559 9.5634 6.00016 10.668 6.00016C11.7725 6.00016 12.668 6.89559 12.668 8.00016C12.668 9.10473 11.7725 10.0002 10.668 10.0002C9.5634 10.0002 8.66797 9.10473 8.66797 8.00016ZM10.668 7.3335C10.2998 7.3335 10.0013 7.63197 10.0013 8.00016C10.0013 8.36835 10.2998 8.66683 10.668 8.66683C11.0362 8.66683 11.3346 8.36835 11.3346 8.00016C11.3346 7.63197 11.0362 7.3335 10.668 7.3335Z",
|
|
83
|
-
fill: "currentColor"
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
),
|
|
87
|
-
string: /* @__PURE__ */ React.createElement(
|
|
88
|
-
"svg",
|
|
89
|
-
{
|
|
90
|
-
width: "1em",
|
|
91
|
-
height: "1em",
|
|
92
|
-
viewBox: "0 0 16 16",
|
|
93
|
-
fill: "none",
|
|
94
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
141
|
+
completionItemSelected: {
|
|
142
|
+
backgroundColor: "#e0e0e0"
|
|
95
143
|
},
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
{
|
|
99
|
-
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",
|
|
100
|
-
fill: "currentColor"
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
/* @__PURE__ */ React.createElement(
|
|
104
|
-
"path",
|
|
105
|
-
{
|
|
106
|
-
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",
|
|
107
|
-
fill: "currentColor"
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
/* @__PURE__ */ React.createElement(
|
|
111
|
-
"path",
|
|
112
|
-
{
|
|
113
|
-
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",
|
|
114
|
-
fill: "currentColor"
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
/* @__PURE__ */ React.createElement(
|
|
118
|
-
"path",
|
|
119
|
-
{
|
|
120
|
-
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",
|
|
121
|
-
fill: "currentColor"
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
),
|
|
125
|
-
integer: /* @__PURE__ */ React.createElement(
|
|
126
|
-
"svg",
|
|
127
|
-
{
|
|
128
|
-
width: "1em",
|
|
129
|
-
height: "1em",
|
|
130
|
-
viewBox: "0 0 16 16",
|
|
131
|
-
fill: "none",
|
|
132
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
144
|
+
completionItemIcon: {
|
|
145
|
+
color: "#333"
|
|
133
146
|
},
|
|
134
|
-
|
|
135
|
-
"
|
|
136
|
-
{
|
|
137
|
-
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",
|
|
138
|
-
fill: "currentColor"
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
/* @__PURE__ */ React.createElement(
|
|
142
|
-
"path",
|
|
143
|
-
{
|
|
144
|
-
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",
|
|
145
|
-
fill: "currentColor"
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ React.createElement(
|
|
149
|
-
"path",
|
|
150
|
-
{
|
|
151
|
-
d: "M1.668 12.0001V4.78805L0 6.25205V4.89605L1.668 3.45605H2.892V12.0001H1.668Z",
|
|
152
|
-
fill: "currentColor"
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
),
|
|
156
|
-
number: /* @__PURE__ */ React.createElement(
|
|
157
|
-
"svg",
|
|
158
|
-
{
|
|
159
|
-
width: "1em",
|
|
160
|
-
height: "1em",
|
|
161
|
-
viewBox: "0 0 16 16",
|
|
162
|
-
fill: "none",
|
|
163
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
147
|
+
completionItemLabel: {
|
|
148
|
+
color: "#333"
|
|
164
149
|
},
|
|
165
|
-
|
|
166
|
-
"
|
|
167
|
-
{
|
|
168
|
-
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",
|
|
169
|
-
fill: "currentColor"
|
|
170
|
-
}
|
|
171
|
-
),
|
|
172
|
-
/* @__PURE__ */ React.createElement(
|
|
173
|
-
"path",
|
|
174
|
-
{
|
|
175
|
-
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",
|
|
176
|
-
fill: "currentColor"
|
|
177
|
-
}
|
|
178
|
-
),
|
|
179
|
-
/* @__PURE__ */ React.createElement(
|
|
180
|
-
"path",
|
|
181
|
-
{
|
|
182
|
-
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",
|
|
183
|
-
fill: "currentColor"
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
),
|
|
187
|
-
array: /* @__PURE__ */ React.createElement(
|
|
188
|
-
"svg",
|
|
189
|
-
{
|
|
190
|
-
width: "1em",
|
|
191
|
-
height: "1em",
|
|
192
|
-
viewBox: "0 0 16 16",
|
|
193
|
-
fill: "none",
|
|
194
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
150
|
+
completionItemInfo: {
|
|
151
|
+
color: "#333"
|
|
195
152
|
},
|
|
196
|
-
|
|
197
|
-
"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
{
|
|
206
|
-
d: "M10.7624 1.00342H13.9961V14.997H10.7624V13.6251H12.6487V2.37534H10.7624V1.00342Z",
|
|
207
|
-
fill: "currentColor"
|
|
208
|
-
}
|
|
209
|
-
)
|
|
210
|
-
),
|
|
211
|
-
stream: /* @__PURE__ */ React.createElement(
|
|
212
|
-
"svg",
|
|
213
|
-
{
|
|
214
|
-
viewBox: "0 0 1024 1024",
|
|
215
|
-
version: "1.1",
|
|
216
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
217
|
-
width: "1em",
|
|
218
|
-
height: "1em"
|
|
153
|
+
completionItemDetail: {
|
|
154
|
+
color: "#666"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
styles: [
|
|
158
|
+
// JSON
|
|
159
|
+
{
|
|
160
|
+
tag: t.comment,
|
|
161
|
+
color: colors.comment
|
|
219
162
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
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",
|
|
224
|
-
fill: "currentColor"
|
|
225
|
-
}
|
|
226
|
-
)
|
|
227
|
-
),
|
|
228
|
-
map: /* @__PURE__ */ React.createElement(
|
|
229
|
-
"svg",
|
|
230
|
-
{
|
|
231
|
-
viewBox: "0 0 1024 1024",
|
|
232
|
-
version: "1.1",
|
|
233
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
234
|
-
width: "1em",
|
|
235
|
-
height: "1em"
|
|
163
|
+
{
|
|
164
|
+
tag: [t.propertyName],
|
|
165
|
+
color: colors.key
|
|
236
166
|
},
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
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",
|
|
241
|
-
fill: "currentColor"
|
|
242
|
-
}
|
|
243
|
-
),
|
|
244
|
-
/* @__PURE__ */ React.createElement(
|
|
245
|
-
"path",
|
|
246
|
-
{
|
|
247
|
-
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",
|
|
248
|
-
fill: "currentColor"
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
)
|
|
252
|
-
};
|
|
253
|
-
var ArrayIcons = {
|
|
254
|
-
object: /* @__PURE__ */ React.createElement(
|
|
255
|
-
"svg",
|
|
256
|
-
{
|
|
257
|
-
width: "1em",
|
|
258
|
-
height: "1em",
|
|
259
|
-
viewBox: "0 0 16 16",
|
|
260
|
-
fill: "none",
|
|
261
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
167
|
+
{
|
|
168
|
+
tag: [t.string],
|
|
169
|
+
color: colors.string
|
|
262
170
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
fillRule: "evenodd",
|
|
267
|
-
clipRule: "evenodd",
|
|
268
|
-
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",
|
|
269
|
-
fill: "currentColor"
|
|
270
|
-
}
|
|
271
|
-
)
|
|
272
|
-
),
|
|
273
|
-
boolean: /* @__PURE__ */ React.createElement(
|
|
274
|
-
"svg",
|
|
275
|
-
{
|
|
276
|
-
width: "1em",
|
|
277
|
-
height: "1em",
|
|
278
|
-
viewBox: "0 0 16 16",
|
|
279
|
-
fill: "none",
|
|
280
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
171
|
+
{
|
|
172
|
+
tag: [t.number],
|
|
173
|
+
color: colors.number
|
|
281
174
|
},
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
fillRule: "evenodd",
|
|
286
|
-
clipRule: "evenodd",
|
|
287
|
-
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",
|
|
288
|
-
fill: "currentColor"
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
),
|
|
292
|
-
string: /* @__PURE__ */ React.createElement(
|
|
293
|
-
"svg",
|
|
294
|
-
{
|
|
295
|
-
width: "1em",
|
|
296
|
-
height: "1em",
|
|
297
|
-
viewBox: "0 0 16 16",
|
|
298
|
-
fill: "none",
|
|
299
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
175
|
+
{
|
|
176
|
+
tag: [t.bool],
|
|
177
|
+
color: colors.boolean
|
|
300
178
|
},
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
fillRule: "evenodd",
|
|
305
|
-
clipRule: "evenodd",
|
|
306
|
-
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",
|
|
307
|
-
fill: "currentColor"
|
|
308
|
-
}
|
|
309
|
-
)
|
|
310
|
-
),
|
|
311
|
-
integer: /* @__PURE__ */ React.createElement(
|
|
312
|
-
"svg",
|
|
313
|
-
{
|
|
314
|
-
width: "1em",
|
|
315
|
-
height: "1em",
|
|
316
|
-
viewBox: "0 0 16 16",
|
|
317
|
-
fill: "none",
|
|
318
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
179
|
+
{
|
|
180
|
+
tag: [t.null],
|
|
181
|
+
color: colors.null
|
|
319
182
|
},
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
fillRule: "evenodd",
|
|
324
|
-
clipRule: "evenodd",
|
|
325
|
-
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",
|
|
326
|
-
fill: "currentColor"
|
|
327
|
-
}
|
|
328
|
-
)
|
|
329
|
-
),
|
|
330
|
-
number: /* @__PURE__ */ React.createElement(
|
|
331
|
-
"svg",
|
|
332
|
-
{
|
|
333
|
-
width: "1em",
|
|
334
|
-
height: "1em",
|
|
335
|
-
viewBox: "0 0 16 16",
|
|
336
|
-
fill: "none",
|
|
337
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
183
|
+
{
|
|
184
|
+
tag: [t.separator],
|
|
185
|
+
color: colors.separator
|
|
338
186
|
},
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
{
|
|
364
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "integer" }) }), firstUppercase("integer")),
|
|
365
|
-
value: "integer"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "number" }) }), firstUppercase("number")),
|
|
369
|
-
value: "number"
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "boolean" }) }), firstUppercase("boolean")),
|
|
373
|
-
value: "boolean"
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "object" }) }), firstUppercase("object")),
|
|
377
|
-
value: "object"
|
|
378
|
-
}
|
|
379
|
-
];
|
|
380
|
-
var options = [
|
|
381
|
-
...baseOptions,
|
|
382
|
-
{
|
|
383
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "array" }) }), firstUppercase("array")),
|
|
384
|
-
value: "array",
|
|
385
|
-
children: baseOptions.map((_opt) => ({
|
|
386
|
-
..._opt,
|
|
387
|
-
value: `${_opt.value}`,
|
|
388
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(
|
|
389
|
-
Icon,
|
|
390
|
-
{
|
|
391
|
-
size: "small",
|
|
392
|
-
svg: getSchemaIcon({ type: "array", items: { type: _opt.value } })
|
|
393
|
-
}
|
|
394
|
-
), firstUppercase(_opt.value))
|
|
395
|
-
}))
|
|
396
|
-
}
|
|
397
|
-
];
|
|
398
|
-
|
|
399
|
-
// src/utils/json-schema/index.ts
|
|
400
|
-
import { get } from "lodash";
|
|
401
|
-
import { ASTFactory, ASTKind, ASTMatch } from "@flowgram.ai/editor";
|
|
402
|
-
var JsonSchemaUtils;
|
|
403
|
-
((JsonSchemaUtils2) => {
|
|
404
|
-
function schemaToAST(jsonSchema) {
|
|
405
|
-
const { type, extra } = jsonSchema || {};
|
|
406
|
-
const { weak = false } = extra || {};
|
|
407
|
-
if (!type) {
|
|
408
|
-
return void 0;
|
|
187
|
+
// markdown
|
|
188
|
+
{
|
|
189
|
+
tag: [t.heading],
|
|
190
|
+
color: "#3e76ef"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
tag: [t.processingInstruction],
|
|
194
|
+
color: "#3e76ef"
|
|
195
|
+
},
|
|
196
|
+
// shell
|
|
197
|
+
// curl
|
|
198
|
+
{
|
|
199
|
+
tag: [t.standard(t.variableName)],
|
|
200
|
+
color: "#00804A"
|
|
201
|
+
},
|
|
202
|
+
// -X
|
|
203
|
+
{
|
|
204
|
+
tag: [t.attributeName],
|
|
205
|
+
color: "#C74200"
|
|
206
|
+
},
|
|
207
|
+
// url in string (includes quotes), e.g. "https://..."
|
|
208
|
+
{
|
|
209
|
+
tag: [t.special(t.string)],
|
|
210
|
+
color: "#2B57D9"
|
|
409
211
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// src/components/code-editor/theme/dark.ts
|
|
216
|
+
import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
|
|
217
|
+
var colors2 = {
|
|
218
|
+
background: "#151B27",
|
|
219
|
+
// syntax
|
|
220
|
+
comment: "#FFFFFF63",
|
|
221
|
+
key: "#39E5D7",
|
|
222
|
+
string: "#FF94D2",
|
|
223
|
+
number: "#FF9933",
|
|
224
|
+
boolean: "#78B0FF",
|
|
225
|
+
null: "#78B0FF",
|
|
226
|
+
separator: "#FFFFFFC9"
|
|
227
|
+
};
|
|
228
|
+
var darkTheme = createTheme2({
|
|
229
|
+
variant: "dark",
|
|
230
|
+
settings: {
|
|
231
|
+
background: colors2.background,
|
|
232
|
+
foreground: "#fff",
|
|
233
|
+
caret: "#AEAFAD",
|
|
234
|
+
selection: "#d9d9d942",
|
|
235
|
+
gutterBackground: colors2.background,
|
|
236
|
+
gutterForeground: "#FFFFFF63",
|
|
237
|
+
gutterBorderColor: "transparent",
|
|
238
|
+
gutterBorderWidth: 0,
|
|
239
|
+
lineHighlight: "#272e3d36",
|
|
240
|
+
bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
|
|
241
|
+
tooltip: {
|
|
242
|
+
backgroundColor: "#363D4D",
|
|
243
|
+
color: "#fff",
|
|
244
|
+
border: "none"
|
|
245
|
+
},
|
|
246
|
+
link: {
|
|
247
|
+
color: "#4daafc"
|
|
248
|
+
},
|
|
249
|
+
completionItemHover: {
|
|
250
|
+
backgroundColor: "#FFFFFF0F"
|
|
251
|
+
},
|
|
252
|
+
completionItemSelected: {
|
|
253
|
+
backgroundColor: "#FFFFFF17"
|
|
254
|
+
},
|
|
255
|
+
completionItemIcon: {
|
|
256
|
+
color: "#FFFFFFC9"
|
|
257
|
+
},
|
|
258
|
+
completionItemLabel: {
|
|
259
|
+
color: "#FFFFFFC9"
|
|
260
|
+
},
|
|
261
|
+
completionItemInfo: {
|
|
262
|
+
color: "#FFFFFFC9"
|
|
263
|
+
},
|
|
264
|
+
completionItemDetail: {
|
|
265
|
+
color: "#FFFFFF63"
|
|
458
266
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
267
|
+
},
|
|
268
|
+
styles: [
|
|
269
|
+
// json
|
|
270
|
+
{
|
|
271
|
+
tag: t2.comment,
|
|
272
|
+
color: colors2.comment
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
tag: [t2.propertyName],
|
|
276
|
+
color: colors2.key
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
tag: [t2.string],
|
|
280
|
+
color: colors2.string
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
tag: [t2.number],
|
|
284
|
+
color: colors2.number
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
tag: [t2.bool],
|
|
288
|
+
color: colors2.boolean
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
tag: [t2.null],
|
|
292
|
+
color: colors2.null
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
tag: [t2.separator],
|
|
296
|
+
color: colors2.separator
|
|
297
|
+
},
|
|
298
|
+
// markdown
|
|
299
|
+
{
|
|
300
|
+
tag: [t2.heading],
|
|
301
|
+
color: "#6b6bff"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
tag: [t2.processingInstruction],
|
|
305
|
+
color: "#6b6bff"
|
|
306
|
+
},
|
|
307
|
+
// shell
|
|
308
|
+
// curl
|
|
309
|
+
{
|
|
310
|
+
tag: [t2.standard(t2.variableName)],
|
|
311
|
+
color: "#3BEB84"
|
|
312
|
+
},
|
|
313
|
+
// -X
|
|
314
|
+
{
|
|
315
|
+
tag: [t2.attributeName],
|
|
316
|
+
color: "#FF9933"
|
|
317
|
+
},
|
|
318
|
+
// url in string (includes quotes), e.g. "https://..."
|
|
319
|
+
{
|
|
320
|
+
tag: [t2.special(t2.string)],
|
|
321
|
+
color: "#78B0FF"
|
|
463
322
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
323
|
+
]
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// src/components/code-editor/theme/index.ts
|
|
327
|
+
themes.register("dark", darkTheme);
|
|
328
|
+
themes.register("light", lightTheme);
|
|
329
|
+
|
|
330
|
+
// src/components/code-editor/index.tsx
|
|
331
|
+
var OriginCodeEditor = createRenderer(preset, [
|
|
332
|
+
EditorView.theme({
|
|
333
|
+
"&.cm-focused": {
|
|
334
|
+
outline: "none"
|
|
468
335
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
336
|
+
})
|
|
337
|
+
]);
|
|
338
|
+
function CodeEditor({
|
|
339
|
+
value,
|
|
340
|
+
onChange,
|
|
341
|
+
languageId = "python",
|
|
342
|
+
theme = "light",
|
|
343
|
+
children,
|
|
344
|
+
placeholder,
|
|
345
|
+
activeLinePlaceholder,
|
|
346
|
+
options,
|
|
347
|
+
readonly
|
|
348
|
+
}) {
|
|
349
|
+
const editorRef = useRef(null);
|
|
350
|
+
useEffect(() => {
|
|
351
|
+
if (languageId === "typescript") {
|
|
352
|
+
initTsWorker();
|
|
473
353
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
typeAST.properties.map((property) => {
|
|
479
|
-
const schema = astToSchema(property.type);
|
|
480
|
-
if (property.meta?.title && schema) {
|
|
481
|
-
schema.title = property.meta.title;
|
|
482
|
-
}
|
|
483
|
-
if (property.meta?.description && schema) {
|
|
484
|
-
schema.description = property.meta.description;
|
|
485
|
-
}
|
|
486
|
-
return [property.key, schema];
|
|
487
|
-
})
|
|
488
|
-
) : {}
|
|
489
|
-
};
|
|
354
|
+
}, [languageId]);
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
if (editorRef.current?.getValue() !== value) {
|
|
357
|
+
editorRef.current?.setValue(String(value || ""));
|
|
490
358
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
359
|
+
}, [value]);
|
|
360
|
+
return /* @__PURE__ */ React2.createElement(EditorProvider, null, /* @__PURE__ */ React2.createElement(
|
|
361
|
+
OriginCodeEditor,
|
|
362
|
+
{
|
|
363
|
+
defaultValue: value,
|
|
364
|
+
options: {
|
|
365
|
+
uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
|
|
366
|
+
languageId,
|
|
367
|
+
theme,
|
|
368
|
+
placeholder,
|
|
369
|
+
readOnly: readonly,
|
|
370
|
+
editable: !readonly,
|
|
371
|
+
...options || {}
|
|
372
|
+
},
|
|
373
|
+
didMount: (editor) => {
|
|
374
|
+
editorRef.current = editor;
|
|
375
|
+
},
|
|
376
|
+
onChange: (e) => onChange?.(e.value)
|
|
377
|
+
},
|
|
378
|
+
activeLinePlaceholder && /* @__PURE__ */ React2.createElement(ActiveLinePlaceholder, null, activeLinePlaceholder),
|
|
379
|
+
children
|
|
380
|
+
));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/components/code-editor-mini/index.tsx
|
|
384
|
+
var UIMini = styled.div`
|
|
385
|
+
.ͼ1 .cm-content {
|
|
386
|
+
padding: 0;
|
|
387
|
+
}
|
|
388
|
+
`;
|
|
389
|
+
function CodeEditorMini(props) {
|
|
390
|
+
return /* @__PURE__ */ React3.createElement(UIMini, null, /* @__PURE__ */ React3.createElement(
|
|
391
|
+
CodeEditor,
|
|
392
|
+
{
|
|
393
|
+
...props,
|
|
394
|
+
options: {
|
|
395
|
+
lineNumbersGutter: false,
|
|
396
|
+
foldGutter: false,
|
|
397
|
+
...props.options || {}
|
|
398
|
+
}
|
|
496
399
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
400
|
+
));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// src/plugins/json-schema-preset/type-definition/object.tsx
|
|
404
|
+
var objectRegistry = {
|
|
405
|
+
type: "object",
|
|
406
|
+
ConstantRenderer: (props) => /* @__PURE__ */ React4.createElement(
|
|
407
|
+
CodeEditorMini,
|
|
408
|
+
{
|
|
409
|
+
value: props.value,
|
|
410
|
+
onChange: (v) => props.onChange?.(v),
|
|
411
|
+
languageId: "json",
|
|
412
|
+
placeholder: "Please Input Object",
|
|
413
|
+
readonly: props.readonly
|
|
502
414
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
415
|
+
)
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/plugins/json-schema-preset/type-definition/number.tsx
|
|
419
|
+
import React5 from "react";
|
|
420
|
+
import { InputNumber } from "@douyinfe/semi-ui";
|
|
421
|
+
var numberRegistry = {
|
|
422
|
+
type: "number",
|
|
423
|
+
ConstantRenderer: (props) => /* @__PURE__ */ React5.createElement(
|
|
424
|
+
InputNumber,
|
|
425
|
+
{
|
|
426
|
+
placeholder: "Please Input Number",
|
|
427
|
+
size: "small",
|
|
428
|
+
disabled: props.readonly,
|
|
429
|
+
hideButtons: true,
|
|
430
|
+
...props
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
// src/plugins/json-schema-preset/type-definition/integer.tsx
|
|
436
|
+
import React6 from "react";
|
|
437
|
+
import { InputNumber as InputNumber2 } from "@douyinfe/semi-ui";
|
|
438
|
+
var integerRegistry = {
|
|
439
|
+
type: "integer",
|
|
440
|
+
ConstantRenderer: (props) => /* @__PURE__ */ React6.createElement(
|
|
441
|
+
InputNumber2,
|
|
442
|
+
{
|
|
443
|
+
placeholder: "Please Input Integer",
|
|
444
|
+
size: "small",
|
|
445
|
+
disabled: props.readonly,
|
|
446
|
+
precision: 0,
|
|
447
|
+
...props
|
|
507
448
|
}
|
|
508
|
-
|
|
449
|
+
)
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// src/plugins/json-schema-preset/type-definition/boolean.tsx
|
|
453
|
+
import React7 from "react";
|
|
454
|
+
import { Select } from "@douyinfe/semi-ui";
|
|
455
|
+
var booleanRegistry = {
|
|
456
|
+
type: "boolean",
|
|
457
|
+
ConstantRenderer: (props) => {
|
|
458
|
+
const { value, onChange, ...rest } = props;
|
|
459
|
+
return /* @__PURE__ */ React7.createElement(
|
|
460
|
+
Select,
|
|
461
|
+
{
|
|
462
|
+
placeholder: "Please Select Boolean",
|
|
463
|
+
size: "small",
|
|
464
|
+
disabled: props.readonly,
|
|
465
|
+
optionList: [
|
|
466
|
+
{ label: "True", value: 1 },
|
|
467
|
+
{ label: "False", value: 0 }
|
|
468
|
+
],
|
|
469
|
+
value: value ? 1 : 0,
|
|
470
|
+
onChange: (value2) => onChange?.(!!value2),
|
|
471
|
+
...rest
|
|
472
|
+
}
|
|
473
|
+
);
|
|
509
474
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// src/plugins/json-schema-preset/type-definition/array.tsx
|
|
478
|
+
import React8 from "react";
|
|
479
|
+
var arrayRegistry = {
|
|
480
|
+
type: "array",
|
|
481
|
+
ConstantRenderer: (props) => /* @__PURE__ */ React8.createElement(
|
|
482
|
+
CodeEditorMini,
|
|
483
|
+
{
|
|
484
|
+
value: props.value,
|
|
485
|
+
languageId: "json",
|
|
486
|
+
onChange: (v) => props.onChange?.(v),
|
|
487
|
+
placeholder: "Please Input Array",
|
|
488
|
+
readonly: props.readonly
|
|
518
489
|
}
|
|
519
|
-
|
|
490
|
+
)
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// src/plugins/json-schema-preset/type-definition/index.tsx
|
|
494
|
+
var jsonSchemaTypePreset = [
|
|
495
|
+
stringRegistry,
|
|
496
|
+
objectRegistry,
|
|
497
|
+
numberRegistry,
|
|
498
|
+
integerRegistry,
|
|
499
|
+
booleanRegistry,
|
|
500
|
+
arrayRegistry
|
|
501
|
+
];
|
|
502
|
+
jsonSchemaTypePreset.forEach((_type) => jsonSchemaTypeManager.register(_type));
|
|
503
|
+
|
|
504
|
+
// src/plugins/json-schema-preset/create-type-preset-plugin.tsx
|
|
505
|
+
import {
|
|
506
|
+
BaseTypeManager,
|
|
507
|
+
jsonSchemaContainerModule
|
|
508
|
+
} from "@flowgram.ai/json-schema";
|
|
509
|
+
import { definePluginCreator } from "@flowgram.ai/editor";
|
|
510
|
+
var createTypePresetPlugin = definePluginCreator({
|
|
511
|
+
onInit(ctx, opts) {
|
|
512
|
+
const typeManager = ctx.get(BaseTypeManager);
|
|
513
|
+
jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
|
|
514
|
+
opts.types?.forEach((_type) => typeManager.register(_type));
|
|
515
|
+
opts.unregisterTypes?.forEach((_type) => typeManager.unregister(_type));
|
|
516
|
+
},
|
|
517
|
+
containerModules: [jsonSchemaContainerModule]
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// src/plugins/json-schema-preset/index.tsx
|
|
521
|
+
var useTypeManager = () => useOriginTypeManager();
|
|
522
|
+
var JsonSchemaTypePresetProvider = ({
|
|
523
|
+
types = [],
|
|
524
|
+
children
|
|
525
|
+
}) => /* @__PURE__ */ React9.createElement(OriginTypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
|
|
526
|
+
|
|
527
|
+
// src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts
|
|
528
|
+
import {
|
|
529
|
+
ASTMatch,
|
|
530
|
+
definePluginCreator as definePluginCreator2,
|
|
531
|
+
VariableEngine
|
|
532
|
+
} from "@flowgram.ai/editor";
|
|
533
|
+
var createDisableDeclarationPlugin = definePluginCreator2({
|
|
534
|
+
onInit(ctx) {
|
|
535
|
+
const variableEngine = ctx.get(VariableEngine);
|
|
536
|
+
const handleEvent = (action) => {
|
|
537
|
+
if (ASTMatch.isVariableDeclaration(action.ast)) {
|
|
538
|
+
if (!action.ast.meta?.disabled) {
|
|
539
|
+
action.ast.updateMeta({
|
|
540
|
+
...action.ast.meta || {},
|
|
541
|
+
disabled: true
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
variableEngine.onGlobalEvent("NewAST", handleEvent);
|
|
547
|
+
variableEngine.onGlobalEvent("UpdateAST", handleEvent);
|
|
520
548
|
}
|
|
521
|
-
|
|
522
|
-
})(JsonSchemaUtils || (JsonSchemaUtils = {}));
|
|
549
|
+
});
|
|
523
550
|
|
|
524
551
|
// src/components/variable-selector/use-variable-tree.tsx
|
|
525
552
|
function useVariableTree(params) {
|
|
526
|
-
const { includeSchema, excludeSchema } = params;
|
|
553
|
+
const { includeSchema, excludeSchema, customSkip } = params;
|
|
554
|
+
const typeManager = useTypeManager();
|
|
527
555
|
const variables = useAvailableVariables();
|
|
528
556
|
const getVariableTypeIcon = useCallback((variable) => {
|
|
529
557
|
if (variable.meta?.icon) {
|
|
530
558
|
if (typeof variable.meta.icon === "string") {
|
|
531
|
-
return /* @__PURE__ */
|
|
559
|
+
return /* @__PURE__ */ React10.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
|
|
532
560
|
}
|
|
533
561
|
return variable.meta.icon;
|
|
534
562
|
}
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
return /* @__PURE__ */ React2.createElement(
|
|
538
|
-
Icon2,
|
|
539
|
-
{
|
|
540
|
-
size: "small",
|
|
541
|
-
svg: ArrayIcons[_type.items?.kind.toLowerCase()] || VariableTypeIcons.array
|
|
542
|
-
}
|
|
543
|
-
);
|
|
544
|
-
}
|
|
545
|
-
if (ASTMatch2.isCustomType(_type)) {
|
|
546
|
-
return /* @__PURE__ */ React2.createElement(Icon2, { size: "small", svg: VariableTypeIcons[_type.typeName.toLowerCase()] });
|
|
547
|
-
}
|
|
548
|
-
return /* @__PURE__ */ React2.createElement(Icon2, { size: "small", svg: VariableTypeIcons[variable.type?.kind.toLowerCase()] });
|
|
563
|
+
const schema = JsonSchemaUtils2.astToSchema(variable.type, { drilldownObject: false });
|
|
564
|
+
return /* @__PURE__ */ React10.createElement(Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
|
|
549
565
|
}, []);
|
|
550
566
|
const renderVariable = (variable, parentFields = []) => {
|
|
551
567
|
let type = variable?.type;
|
|
@@ -558,9 +574,11 @@ function useVariableTree(params) {
|
|
|
558
574
|
}
|
|
559
575
|
const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
|
|
560
576
|
const key = keyPath.join(".");
|
|
561
|
-
const isSchemaInclude = includeSchema ?
|
|
562
|
-
const isSchemaExclude = excludeSchema ?
|
|
563
|
-
const
|
|
577
|
+
const isSchemaInclude = includeSchema ? JsonSchemaUtils2.isASTMatchSchema(type, includeSchema) : true;
|
|
578
|
+
const isSchemaExclude = excludeSchema ? JsonSchemaUtils2.isASTMatchSchema(type, excludeSchema) : false;
|
|
579
|
+
const isCustomSkip = customSkip ? customSkip(variable) : false;
|
|
580
|
+
const isMetaDisabled = variable.meta?.disabled;
|
|
581
|
+
const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
|
|
564
582
|
if (!isSchemaMatch && !children?.length) {
|
|
565
583
|
return null;
|
|
566
584
|
}
|
|
@@ -572,16 +590,17 @@ function useVariableTree(params) {
|
|
|
572
590
|
icon: getVariableTypeIcon(variable),
|
|
573
591
|
children,
|
|
574
592
|
disabled: !isSchemaMatch,
|
|
575
|
-
rootMeta: parentFields[0]?.meta
|
|
593
|
+
rootMeta: parentFields[0]?.meta || variable.meta,
|
|
594
|
+
isRoot: !parentFields?.length
|
|
576
595
|
};
|
|
577
596
|
};
|
|
578
597
|
return [...variables.slice(0).reverse()].map((_variable) => renderVariable(_variable)).filter(Boolean);
|
|
579
598
|
}
|
|
580
599
|
|
|
581
600
|
// src/components/variable-selector/styles.tsx
|
|
582
|
-
import
|
|
601
|
+
import styled2, { css } from "styled-components";
|
|
583
602
|
import { Tag, TreeSelect } from "@douyinfe/semi-ui";
|
|
584
|
-
var UIRootTitle =
|
|
603
|
+
var UIRootTitle = styled2.div`
|
|
585
604
|
margin-right: 4px;
|
|
586
605
|
min-width: 20px;
|
|
587
606
|
overflow: hidden;
|
|
@@ -589,13 +608,16 @@ var UIRootTitle = styled.div`
|
|
|
589
608
|
white-space: nowrap;
|
|
590
609
|
color: var(--semi-color-text-2);
|
|
591
610
|
`;
|
|
592
|
-
var UIVarName =
|
|
611
|
+
var UIVarName = styled2.div`
|
|
593
612
|
overflow: hidden;
|
|
594
613
|
text-overflow: ellipsis;
|
|
595
614
|
white-space: nowrap;
|
|
596
|
-
|
|
615
|
+
|
|
616
|
+
${({ $inSelector }) => $inSelector && css`
|
|
617
|
+
min-width: 50%;
|
|
618
|
+
`}
|
|
597
619
|
`;
|
|
598
|
-
var UITag =
|
|
620
|
+
var UITag = styled2(Tag)`
|
|
599
621
|
width: 100%;
|
|
600
622
|
display: flex;
|
|
601
623
|
align-items: center;
|
|
@@ -607,17 +629,14 @@ var UITag = styled(Tag)`
|
|
|
607
629
|
|
|
608
630
|
&.semi-tag {
|
|
609
631
|
margin: 0;
|
|
632
|
+
height: 22px;
|
|
610
633
|
}
|
|
611
634
|
`;
|
|
612
|
-
var UITreeSelect =
|
|
635
|
+
var UITreeSelect = styled2(TreeSelect)`
|
|
613
636
|
outline: ${({ $error }) => $error ? "1px solid red" : "none"};
|
|
614
637
|
|
|
615
|
-
height: 22px;
|
|
616
|
-
min-height: 22px;
|
|
617
|
-
line-height: 22px;
|
|
618
|
-
|
|
619
638
|
& .semi-tree-select-selection {
|
|
620
|
-
padding:
|
|
639
|
+
padding: 0px;
|
|
621
640
|
height: 22px;
|
|
622
641
|
}
|
|
623
642
|
|
|
@@ -629,6 +648,13 @@ var UITreeSelect = styled(TreeSelect)`
|
|
|
629
648
|
padding-left: 10px;
|
|
630
649
|
}
|
|
631
650
|
`;
|
|
651
|
+
var UIPopoverContent = styled2.div`
|
|
652
|
+
padding: 10px;
|
|
653
|
+
display: inline-flex;
|
|
654
|
+
align-items: center;
|
|
655
|
+
justify-content: flex-start;
|
|
656
|
+
white-space: nowrap;
|
|
657
|
+
`;
|
|
632
658
|
|
|
633
659
|
// src/components/variable-selector/index.tsx
|
|
634
660
|
var VariableSelector = ({
|
|
@@ -655,11 +681,11 @@ var VariableSelector = ({
|
|
|
655
681
|
}, [value]);
|
|
656
682
|
const renderIcon = (icon) => {
|
|
657
683
|
if (typeof icon === "string") {
|
|
658
|
-
return /* @__PURE__ */
|
|
684
|
+
return /* @__PURE__ */ React11.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
659
685
|
}
|
|
660
686
|
return icon;
|
|
661
687
|
};
|
|
662
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
663
689
|
UITreeSelect,
|
|
664
690
|
{
|
|
665
691
|
dropdownMatchSelectWidth: false,
|
|
@@ -676,10 +702,10 @@ var VariableSelector = ({
|
|
|
676
702
|
},
|
|
677
703
|
renderSelectedItem: (_option) => {
|
|
678
704
|
if (!_option?.keyPath) {
|
|
679
|
-
return /* @__PURE__ */
|
|
705
|
+
return /* @__PURE__ */ React11.createElement(
|
|
680
706
|
UITag,
|
|
681
707
|
{
|
|
682
|
-
prefixIcon: /* @__PURE__ */
|
|
708
|
+
prefixIcon: /* @__PURE__ */ React11.createElement(IconIssueStroked, null),
|
|
683
709
|
color: "amber",
|
|
684
710
|
closable: !readonly,
|
|
685
711
|
onClose: () => onChange(void 0)
|
|
@@ -687,28 +713,38 @@ var VariableSelector = ({
|
|
|
687
713
|
config?.notFoundContent ?? "Undefined"
|
|
688
714
|
);
|
|
689
715
|
}
|
|
690
|
-
|
|
691
|
-
|
|
716
|
+
const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
|
|
717
|
+
const rootTitle = /* @__PURE__ */ React11.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
|
|
718
|
+
return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement(
|
|
719
|
+
Popover,
|
|
692
720
|
{
|
|
693
|
-
|
|
694
|
-
closable: !readonly,
|
|
695
|
-
onClose: () => onChange(void 0)
|
|
721
|
+
content: /* @__PURE__ */ React11.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ React11.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
|
|
696
722
|
},
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
723
|
+
/* @__PURE__ */ React11.createElement(
|
|
724
|
+
UITag,
|
|
725
|
+
{
|
|
726
|
+
prefixIcon: rootIcon,
|
|
727
|
+
closable: !readonly,
|
|
728
|
+
onClose: () => onChange(void 0)
|
|
729
|
+
},
|
|
730
|
+
rootTitle,
|
|
731
|
+
!_option.isRoot && /* @__PURE__ */ React11.createElement(UIVarName, { $inSelector: true }, _option.label)
|
|
732
|
+
)
|
|
733
|
+
));
|
|
734
|
+
},
|
|
735
|
+
showClear: false,
|
|
736
|
+
arrowIcon: /* @__PURE__ */ React11.createElement(IconChevronDownStroked, { size: "small" }),
|
|
703
737
|
triggerRender,
|
|
704
|
-
placeholder: config?.placeholder ?? "Select Variable
|
|
738
|
+
placeholder: config?.placeholder ?? "Select Variable"
|
|
705
739
|
}
|
|
706
740
|
));
|
|
707
741
|
};
|
|
708
742
|
|
|
709
743
|
// src/components/type-selector/index.tsx
|
|
710
|
-
import
|
|
711
|
-
import {
|
|
744
|
+
import React12, { useMemo as useMemo2 } from "react";
|
|
745
|
+
import { Cascader, Icon as Icon2, IconButton } from "@douyinfe/semi-ui";
|
|
746
|
+
var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
|
|
747
|
+
var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
712
748
|
var getTypeSelectValue = (value) => {
|
|
713
749
|
if (value?.type === "array" && value?.items) {
|
|
714
750
|
return [value.type, ...getTypeSelectValue(value.items) || []];
|
|
@@ -723,27 +759,52 @@ var parseTypeSelectValue = (value) => {
|
|
|
723
759
|
return { type };
|
|
724
760
|
};
|
|
725
761
|
function TypeSelector(props) {
|
|
726
|
-
const { value, onChange, disabled, style } = props;
|
|
762
|
+
const { value, onChange, readonly, disabled, style } = props;
|
|
727
763
|
const selectValue = useMemo2(() => getTypeSelectValue(value), [value]);
|
|
728
|
-
|
|
764
|
+
const typeManager = useTypeManager();
|
|
765
|
+
const icon = typeManager.getDisplayIcon(value || {});
|
|
766
|
+
const options = useMemo2(
|
|
767
|
+
() => typeManager.getTypeRegistriesWithParentType().map((_type) => {
|
|
768
|
+
const isArray2 = _type.type === "array";
|
|
769
|
+
return {
|
|
770
|
+
label: /* @__PURE__ */ React12.createElement("div", { style: labelStyle }, /* @__PURE__ */ React12.createElement(Icon2, { size: "small", svg: _type.icon }), firstUppercase(_type.type)),
|
|
771
|
+
value: _type.type,
|
|
772
|
+
children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
|
|
773
|
+
label: /* @__PURE__ */ React12.createElement("div", { style: labelStyle }, /* @__PURE__ */ React12.createElement(
|
|
774
|
+
Icon2,
|
|
775
|
+
{
|
|
776
|
+
size: "small",
|
|
777
|
+
svg: typeManager.getDisplayIcon({
|
|
778
|
+
type: "array",
|
|
779
|
+
items: { type: _type2.type }
|
|
780
|
+
})
|
|
781
|
+
}
|
|
782
|
+
), firstUppercase(_type2.type)),
|
|
783
|
+
value: _type2.type
|
|
784
|
+
})) : []
|
|
785
|
+
};
|
|
786
|
+
}),
|
|
787
|
+
[]
|
|
788
|
+
);
|
|
789
|
+
return /* @__PURE__ */ React12.createElement(
|
|
729
790
|
Cascader,
|
|
730
791
|
{
|
|
731
|
-
disabled,
|
|
792
|
+
disabled: readonly || disabled,
|
|
732
793
|
size: "small",
|
|
733
|
-
triggerRender: () => /* @__PURE__ */
|
|
794
|
+
triggerRender: () => /* @__PURE__ */ React12.createElement(IconButton, { size: "small", style, disabled: readonly || disabled, icon }),
|
|
734
795
|
treeData: options,
|
|
735
796
|
value: selectValue,
|
|
736
797
|
leafOnly: true,
|
|
737
798
|
onChange: (value2) => {
|
|
738
|
-
onChange(parseTypeSelectValue(value2));
|
|
799
|
+
onChange?.(parseTypeSelectValue(value2));
|
|
739
800
|
}
|
|
740
801
|
}
|
|
741
802
|
);
|
|
742
803
|
}
|
|
743
804
|
|
|
744
805
|
// src/components/json-schema-editor/index.tsx
|
|
745
|
-
import
|
|
746
|
-
import { Button
|
|
806
|
+
import React17, { useMemo as useMemo5, useState as useState4 } from "react";
|
|
807
|
+
import { Button, Checkbox, IconButton as IconButton3 } from "@douyinfe/semi-ui";
|
|
747
808
|
import {
|
|
748
809
|
IconExpand,
|
|
749
810
|
IconShrink,
|
|
@@ -754,45 +815,45 @@ import {
|
|
|
754
815
|
} from "@douyinfe/semi-icons";
|
|
755
816
|
|
|
756
817
|
// src/components/json-schema-editor/styles.tsx
|
|
757
|
-
import
|
|
758
|
-
import
|
|
818
|
+
import React13 from "react";
|
|
819
|
+
import styled3, { css as css2 } from "styled-components";
|
|
759
820
|
import Icon3 from "@douyinfe/semi-icons";
|
|
760
|
-
var UIContainer =
|
|
821
|
+
var UIContainer = styled3.div`
|
|
761
822
|
/* & .semi-input {
|
|
762
823
|
background-color: #fff;
|
|
763
824
|
border-radius: 6px;
|
|
764
825
|
height: 24px;
|
|
765
826
|
} */
|
|
766
827
|
`;
|
|
767
|
-
var UIRow =
|
|
828
|
+
var UIRow = styled3.div`
|
|
768
829
|
display: flex;
|
|
769
830
|
align-items: center;
|
|
770
831
|
gap: 6px;
|
|
771
832
|
`;
|
|
772
|
-
var UICollapseTrigger =
|
|
833
|
+
var UICollapseTrigger = styled3.div`
|
|
773
834
|
cursor: pointer;
|
|
774
835
|
margin-right: 5px;
|
|
775
836
|
`;
|
|
776
|
-
var UIExpandDetail =
|
|
837
|
+
var UIExpandDetail = styled3.div`
|
|
777
838
|
display: flex;
|
|
778
839
|
flex-direction: column;
|
|
779
840
|
`;
|
|
780
|
-
var UILabel =
|
|
841
|
+
var UILabel = styled3.div`
|
|
781
842
|
font-size: 12px;
|
|
782
843
|
color: #999;
|
|
783
844
|
font-weight: 400;
|
|
784
845
|
margin-bottom: 2px;
|
|
785
846
|
`;
|
|
786
|
-
var UIProperties =
|
|
847
|
+
var UIProperties = styled3.div`
|
|
787
848
|
display: grid;
|
|
788
849
|
grid-template-columns: auto 1fr;
|
|
789
850
|
|
|
790
|
-
${({ $shrink }) => $shrink &&
|
|
851
|
+
${({ $shrink }) => $shrink && css2`
|
|
791
852
|
padding-left: 10px;
|
|
792
853
|
margin-top: 10px;
|
|
793
854
|
`}
|
|
794
855
|
`;
|
|
795
|
-
var UIPropertyLeft =
|
|
856
|
+
var UIPropertyLeft = styled3.div`
|
|
796
857
|
grid-column: 1;
|
|
797
858
|
position: relative;
|
|
798
859
|
width: 16px;
|
|
@@ -802,7 +863,7 @@ var UIPropertyLeft = styled2.div`
|
|
|
802
863
|
if ($parentType && $isLast) {
|
|
803
864
|
height = "24px";
|
|
804
865
|
}
|
|
805
|
-
return $showLine &&
|
|
866
|
+
return $showLine && css2`
|
|
806
867
|
&::before {
|
|
807
868
|
/* 竖线 */
|
|
808
869
|
content: '';
|
|
@@ -829,7 +890,7 @@ var UIPropertyLeft = styled2.div`
|
|
|
829
890
|
`;
|
|
830
891
|
}}
|
|
831
892
|
`;
|
|
832
|
-
var UIPropertyRight =
|
|
893
|
+
var UIPropertyRight = styled3.div`
|
|
833
894
|
grid-column: 2;
|
|
834
895
|
margin-bottom: 10px;
|
|
835
896
|
|
|
@@ -837,7 +898,7 @@ var UIPropertyRight = styled2.div`
|
|
|
837
898
|
margin-bottom: 0px;
|
|
838
899
|
}
|
|
839
900
|
`;
|
|
840
|
-
var UIPropertyMain =
|
|
901
|
+
var UIPropertyMain = styled3.div`
|
|
841
902
|
display: flex;
|
|
842
903
|
flex-direction: column;
|
|
843
904
|
gap: 10px;
|
|
@@ -856,33 +917,33 @@ var UIPropertyMain = styled2.div`
|
|
|
856
917
|
background: #d9d9d9;
|
|
857
918
|
display: block;
|
|
858
919
|
}`;
|
|
859
|
-
return $expand &&
|
|
920
|
+
return $expand && css2`
|
|
860
921
|
background-color: #f5f5f5;
|
|
861
922
|
padding: 10px;
|
|
862
923
|
border-radius: 4px;
|
|
863
924
|
|
|
864
|
-
${$showCollapse && $collapse && (type === "array" || type === "object") &&
|
|
925
|
+
${$showCollapse && $collapse && (type === "array" || type === "object") && css2`
|
|
865
926
|
${beforeElement}
|
|
866
927
|
`}
|
|
867
928
|
`;
|
|
868
929
|
}}
|
|
869
930
|
`;
|
|
870
|
-
var UICollapsible =
|
|
931
|
+
var UICollapsible = styled3.div`
|
|
871
932
|
display: none;
|
|
872
933
|
|
|
873
|
-
${({ $collapse }) => $collapse &&
|
|
934
|
+
${({ $collapse }) => $collapse && css2`
|
|
874
935
|
display: block;
|
|
875
936
|
`}
|
|
876
937
|
`;
|
|
877
|
-
var UIName =
|
|
938
|
+
var UIName = styled3.div`
|
|
878
939
|
flex-grow: 1;
|
|
879
940
|
`;
|
|
880
|
-
var UIType =
|
|
881
|
-
var UIRequired =
|
|
882
|
-
var UIActions =
|
|
941
|
+
var UIType = styled3.div``;
|
|
942
|
+
var UIRequired = styled3.div``;
|
|
943
|
+
var UIActions = styled3.div`
|
|
883
944
|
white-space: nowrap;
|
|
884
945
|
`;
|
|
885
|
-
var iconAddChildrenSvg = /* @__PURE__ */
|
|
946
|
+
var iconAddChildrenSvg = /* @__PURE__ */ React13.createElement(
|
|
886
947
|
"svg",
|
|
887
948
|
{
|
|
888
949
|
className: "icon-icon icon-icon-coz_add_node ",
|
|
@@ -892,7 +953,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
|
|
|
892
953
|
fill: "currentColor",
|
|
893
954
|
xmlns: "http://www.w3.org/2000/svg"
|
|
894
955
|
},
|
|
895
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ React13.createElement(
|
|
896
957
|
"path",
|
|
897
958
|
{
|
|
898
959
|
fillRule: "evenodd",
|
|
@@ -900,19 +961,19 @@ var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
|
|
|
900
961
|
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"
|
|
901
962
|
}
|
|
902
963
|
),
|
|
903
|
-
/* @__PURE__ */
|
|
964
|
+
/* @__PURE__ */ React13.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" })
|
|
904
965
|
);
|
|
905
|
-
var IconAddChildren = () => /* @__PURE__ */
|
|
906
|
-
var DefaultValueWrapper =
|
|
966
|
+
var IconAddChildren = () => /* @__PURE__ */ React13.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
|
|
967
|
+
var DefaultValueWrapper = styled3.div`
|
|
907
968
|
margin: 0;
|
|
908
969
|
`;
|
|
909
|
-
var JSONViewerWrapper =
|
|
970
|
+
var JSONViewerWrapper = styled3.div`
|
|
910
971
|
padding: 0 0 24px;
|
|
911
972
|
&:first-child {
|
|
912
973
|
margin-top: 0px;
|
|
913
974
|
}
|
|
914
975
|
`;
|
|
915
|
-
var JSONHeader =
|
|
976
|
+
var JSONHeader = styled3.div`
|
|
916
977
|
display: flex;
|
|
917
978
|
justify-content: space-between;
|
|
918
979
|
align-items: center;
|
|
@@ -921,17 +982,17 @@ var JSONHeader = styled2.div`
|
|
|
921
982
|
height: 36px;
|
|
922
983
|
padding: 0 8px 0 12px;
|
|
923
984
|
`;
|
|
924
|
-
var JSONHeaderLeft =
|
|
985
|
+
var JSONHeaderLeft = styled3.div`
|
|
925
986
|
display: flex;
|
|
926
987
|
align-items: center;
|
|
927
988
|
gap: 10px;
|
|
928
989
|
`;
|
|
929
|
-
var JSONHeaderRight =
|
|
990
|
+
var JSONHeaderRight = styled3.div`
|
|
930
991
|
display: flex;
|
|
931
992
|
align-items: center;
|
|
932
993
|
gap: 10px;
|
|
933
994
|
`;
|
|
934
|
-
var ConstantInputWrapper =
|
|
995
|
+
var ConstantInputWrapper = styled3.div`
|
|
935
996
|
flex-grow: 1;
|
|
936
997
|
|
|
937
998
|
& .semi-tree-select,
|
|
@@ -942,7 +1003,7 @@ var ConstantInputWrapper = styled2.div`
|
|
|
942
1003
|
`;
|
|
943
1004
|
|
|
944
1005
|
// src/components/json-schema-editor/hooks.tsx
|
|
945
|
-
import { useEffect, useMemo as useMemo3, useRef, useState } from "react";
|
|
1006
|
+
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2, useState } from "react";
|
|
946
1007
|
import { omit } from "lodash";
|
|
947
1008
|
var _id = 0;
|
|
948
1009
|
function genId() {
|
|
@@ -976,8 +1037,8 @@ function usePropertiesEdit(value, onChange) {
|
|
|
976
1037
|
[isDrilldownObject]
|
|
977
1038
|
);
|
|
978
1039
|
const [propertyList, setPropertyList] = useState(initPropertyList);
|
|
979
|
-
const mountRef =
|
|
980
|
-
|
|
1040
|
+
const mountRef = useRef2(false);
|
|
1041
|
+
useEffect2(() => {
|
|
981
1042
|
if (mountRef.current) {
|
|
982
1043
|
setPropertyList((_list) => {
|
|
983
1044
|
const nameMap = /* @__PURE__ */ new Map();
|
|
@@ -1045,7 +1106,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1045
1106
|
(_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
|
|
1046
1107
|
);
|
|
1047
1108
|
};
|
|
1048
|
-
|
|
1109
|
+
useEffect2(() => {
|
|
1049
1110
|
if (!isDrilldownObject) {
|
|
1050
1111
|
setPropertyList([]);
|
|
1051
1112
|
}
|
|
@@ -1060,8 +1121,8 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1060
1121
|
}
|
|
1061
1122
|
|
|
1062
1123
|
// src/components/json-schema-editor/default-value.tsx
|
|
1063
|
-
import
|
|
1064
|
-
import { IconButton, JsonViewer, Tooltip } from "@douyinfe/semi-ui";
|
|
1124
|
+
import React15, { useRef as useRef3, useState as useState2, useCallback as useCallback2 } from "react";
|
|
1125
|
+
import { IconButton as IconButton2, JsonViewer, Tooltip } from "@douyinfe/semi-ui";
|
|
1065
1126
|
import { IconBrackets } from "@douyinfe/semi-icons";
|
|
1066
1127
|
|
|
1067
1128
|
// src/components/json-schema-editor/utils.ts
|
|
@@ -1084,83 +1145,37 @@ function getValueType(value) {
|
|
|
1084
1145
|
}
|
|
1085
1146
|
|
|
1086
1147
|
// src/components/constant-input/index.tsx
|
|
1087
|
-
import
|
|
1088
|
-
import { Input
|
|
1089
|
-
var defaultStrategies = [
|
|
1090
|
-
{
|
|
1091
|
-
hit: (schema) => schema?.type === "string",
|
|
1092
|
-
Renderer: (props) => /* @__PURE__ */ React6.createElement(Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
|
|
1093
|
-
},
|
|
1094
|
-
{
|
|
1095
|
-
hit: (schema) => schema?.type === "number",
|
|
1096
|
-
Renderer: (props) => /* @__PURE__ */ React6.createElement(
|
|
1097
|
-
InputNumber,
|
|
1098
|
-
{
|
|
1099
|
-
placeholder: "Please Input Number",
|
|
1100
|
-
size: "small",
|
|
1101
|
-
disabled: props.readonly,
|
|
1102
|
-
hideButtons: true,
|
|
1103
|
-
...props
|
|
1104
|
-
}
|
|
1105
|
-
)
|
|
1106
|
-
},
|
|
1107
|
-
{
|
|
1108
|
-
hit: (schema) => schema?.type === "integer",
|
|
1109
|
-
Renderer: (props) => /* @__PURE__ */ React6.createElement(
|
|
1110
|
-
InputNumber,
|
|
1111
|
-
{
|
|
1112
|
-
placeholder: "Please Input Integer",
|
|
1113
|
-
size: "small",
|
|
1114
|
-
disabled: props.readonly,
|
|
1115
|
-
hideButtons: true,
|
|
1116
|
-
precision: 0,
|
|
1117
|
-
...props
|
|
1118
|
-
}
|
|
1119
|
-
)
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
hit: (schema) => schema?.type === "boolean",
|
|
1123
|
-
Renderer: (props) => {
|
|
1124
|
-
const { value, onChange, ...rest } = props;
|
|
1125
|
-
return /* @__PURE__ */ React6.createElement(
|
|
1126
|
-
Select,
|
|
1127
|
-
{
|
|
1128
|
-
placeholder: "Please Select Boolean",
|
|
1129
|
-
size: "small",
|
|
1130
|
-
disabled: props.readonly,
|
|
1131
|
-
optionList: [
|
|
1132
|
-
{ label: "True", value: 1 },
|
|
1133
|
-
{ label: "False", value: 0 }
|
|
1134
|
-
],
|
|
1135
|
-
value: value ? 1 : 0,
|
|
1136
|
-
onChange: (value2) => onChange?.(!!value2),
|
|
1137
|
-
...rest
|
|
1138
|
-
}
|
|
1139
|
-
);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
];
|
|
1148
|
+
import React14, { useMemo as useMemo4 } from "react";
|
|
1149
|
+
import { Input as Input2 } from "@douyinfe/semi-ui";
|
|
1143
1150
|
function ConstantInput(props) {
|
|
1144
|
-
const { value, onChange, schema, strategies
|
|
1145
|
-
const
|
|
1146
|
-
() => [...defaultStrategies, ...extraStrategies || []],
|
|
1147
|
-
[extraStrategies]
|
|
1148
|
-
);
|
|
1151
|
+
const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
|
|
1152
|
+
const typeManager = useTypeManager();
|
|
1149
1153
|
const Renderer2 = useMemo4(() => {
|
|
1150
|
-
const strategy = strategies.find((_strategy) => _strategy.hit(schema));
|
|
1154
|
+
const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
|
|
1155
|
+
if (!strategy) {
|
|
1156
|
+
return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
|
|
1157
|
+
}
|
|
1151
1158
|
return strategy?.Renderer;
|
|
1152
1159
|
}, [strategies, schema]);
|
|
1153
1160
|
if (!Renderer2) {
|
|
1154
|
-
|
|
1161
|
+
if (fallbackRenderer) {
|
|
1162
|
+
return React14.createElement(fallbackRenderer, {
|
|
1163
|
+
value,
|
|
1164
|
+
onChange,
|
|
1165
|
+
readonly,
|
|
1166
|
+
...rest
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
return /* @__PURE__ */ React14.createElement(Input2, { size: "small", disabled: true, placeholder: "Unsupported type" });
|
|
1155
1170
|
}
|
|
1156
|
-
return /* @__PURE__ */
|
|
1171
|
+
return /* @__PURE__ */ React14.createElement(Renderer2, { value, onChange, readonly, ...rest });
|
|
1157
1172
|
}
|
|
1158
1173
|
|
|
1159
1174
|
// src/components/json-schema-editor/default-value.tsx
|
|
1160
1175
|
function DefaultValue(props) {
|
|
1161
1176
|
const { value, schema, type, onChange, placeholder, jsonFormatText } = props;
|
|
1162
|
-
const wrapperRef =
|
|
1163
|
-
const JsonViewerRef =
|
|
1177
|
+
const wrapperRef = useRef3(null);
|
|
1178
|
+
const JsonViewerRef = useRef3(null);
|
|
1164
1179
|
const [internalJsonValue, setInternalJsonValue] = useState2(
|
|
1165
1180
|
getValueType(value) === "string" ? value : ""
|
|
1166
1181
|
);
|
|
@@ -1187,16 +1202,16 @@ function DefaultValue(props) {
|
|
|
1187
1202
|
console.error("Invalid JSON:", error);
|
|
1188
1203
|
}
|
|
1189
1204
|
}, [internalJsonValue, onChange]);
|
|
1190
|
-
return type === "object" ? /* @__PURE__ */
|
|
1191
|
-
|
|
1205
|
+
return type === "object" ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(JSONHeader, null, /* @__PURE__ */ React15.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ React15.createElement(JSONHeaderRight, null, /* @__PURE__ */ React15.createElement(Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ React15.createElement(
|
|
1206
|
+
IconButton2,
|
|
1192
1207
|
{
|
|
1193
|
-
icon: /* @__PURE__ */
|
|
1208
|
+
icon: /* @__PURE__ */ React15.createElement(IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
|
|
1194
1209
|
size: "small",
|
|
1195
1210
|
type: "tertiary",
|
|
1196
1211
|
theme: "borderless",
|
|
1197
1212
|
onClick: handleFormatJson
|
|
1198
1213
|
}
|
|
1199
|
-
)))), /* @__PURE__ */
|
|
1214
|
+
)))), /* @__PURE__ */ React15.createElement(
|
|
1200
1215
|
JSONViewerWrapper,
|
|
1201
1216
|
{
|
|
1202
1217
|
ref: wrapperRef,
|
|
@@ -1210,7 +1225,7 @@ function DefaultValue(props) {
|
|
|
1210
1225
|
setJsonReadOnly(false);
|
|
1211
1226
|
}
|
|
1212
1227
|
},
|
|
1213
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ React15.createElement(
|
|
1214
1229
|
JsonViewer,
|
|
1215
1230
|
{
|
|
1216
1231
|
ref: JsonViewerRef,
|
|
@@ -1228,7 +1243,7 @@ function DefaultValue(props) {
|
|
|
1228
1243
|
onChange: handleJsonChange
|
|
1229
1244
|
}
|
|
1230
1245
|
)
|
|
1231
|
-
)) : /* @__PURE__ */
|
|
1246
|
+
)) : /* @__PURE__ */ React15.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React15.createElement(
|
|
1232
1247
|
ConstantInput,
|
|
1233
1248
|
{
|
|
1234
1249
|
value,
|
|
@@ -1240,15 +1255,15 @@ function DefaultValue(props) {
|
|
|
1240
1255
|
}
|
|
1241
1256
|
|
|
1242
1257
|
// src/components/json-schema-editor/components/blur-input.tsx
|
|
1243
|
-
import
|
|
1244
|
-
import
|
|
1258
|
+
import React16, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
1259
|
+
import Input3 from "@douyinfe/semi-ui/lib/es/input";
|
|
1245
1260
|
function BlurInput(props) {
|
|
1246
1261
|
const [value, setValue] = useState3("");
|
|
1247
|
-
|
|
1262
|
+
useEffect3(() => {
|
|
1248
1263
|
setValue(props.value);
|
|
1249
1264
|
}, [props.value]);
|
|
1250
|
-
return /* @__PURE__ */
|
|
1251
|
-
|
|
1265
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1266
|
+
Input3,
|
|
1252
1267
|
{
|
|
1253
1268
|
...props,
|
|
1254
1269
|
value,
|
|
@@ -1262,14 +1277,15 @@ function BlurInput(props) {
|
|
|
1262
1277
|
|
|
1263
1278
|
// src/components/json-schema-editor/index.tsx
|
|
1264
1279
|
function JsonSchemaEditor(props) {
|
|
1265
|
-
const { value = { type: "object" }, config = {}, onChange: onChangeProps } = props;
|
|
1280
|
+
const { value = { type: "object" }, config = {}, onChange: onChangeProps, readonly } = props;
|
|
1266
1281
|
const { propertyList, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(
|
|
1267
1282
|
value,
|
|
1268
1283
|
onChangeProps
|
|
1269
1284
|
);
|
|
1270
|
-
return /* @__PURE__ */
|
|
1285
|
+
return /* @__PURE__ */ React17.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React17.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React17.createElement(
|
|
1271
1286
|
PropertyEdit,
|
|
1272
1287
|
{
|
|
1288
|
+
readonly,
|
|
1273
1289
|
key: _property.key,
|
|
1274
1290
|
value: _property,
|
|
1275
1291
|
config,
|
|
@@ -1281,12 +1297,13 @@ function JsonSchemaEditor(props) {
|
|
|
1281
1297
|
onRemoveProperty(_property.key);
|
|
1282
1298
|
}
|
|
1283
1299
|
}
|
|
1284
|
-
))), /* @__PURE__ */
|
|
1285
|
-
|
|
1300
|
+
))), /* @__PURE__ */ React17.createElement(
|
|
1301
|
+
Button,
|
|
1286
1302
|
{
|
|
1303
|
+
disabled: readonly,
|
|
1287
1304
|
size: "small",
|
|
1288
1305
|
style: { marginTop: 10, marginLeft: 16 },
|
|
1289
|
-
icon: /* @__PURE__ */
|
|
1306
|
+
icon: /* @__PURE__ */ React17.createElement(IconPlus, null),
|
|
1290
1307
|
onClick: onAddProperty
|
|
1291
1308
|
},
|
|
1292
1309
|
config?.addButtonText ?? "Add"
|
|
@@ -1296,6 +1313,7 @@ function PropertyEdit(props) {
|
|
|
1296
1313
|
const {
|
|
1297
1314
|
value,
|
|
1298
1315
|
config,
|
|
1316
|
+
readonly,
|
|
1299
1317
|
$level = 0,
|
|
1300
1318
|
onChange: onChangeProps,
|
|
1301
1319
|
onRemove,
|
|
@@ -1318,7 +1336,7 @@ function PropertyEdit(props) {
|
|
|
1318
1336
|
});
|
|
1319
1337
|
};
|
|
1320
1338
|
const showCollapse = isDrilldownObject && propertyList.length > 0;
|
|
1321
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1322
1340
|
UIPropertyLeft,
|
|
1323
1341
|
{
|
|
1324
1342
|
type,
|
|
@@ -1330,8 +1348,8 @@ function PropertyEdit(props) {
|
|
|
1330
1348
|
$parentExpand,
|
|
1331
1349
|
$parentType
|
|
1332
1350
|
},
|
|
1333
|
-
showCollapse && /* @__PURE__ */
|
|
1334
|
-
), /* @__PURE__ */
|
|
1351
|
+
showCollapse && /* @__PURE__ */ React17.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React17.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React17.createElement(IconChevronRight, { size: "small" }))
|
|
1352
|
+
), /* @__PURE__ */ React17.createElement(UIPropertyRight, null, /* @__PURE__ */ React17.createElement(
|
|
1335
1353
|
UIPropertyMain,
|
|
1336
1354
|
{
|
|
1337
1355
|
$showCollapse: showCollapse,
|
|
@@ -1339,18 +1357,20 @@ function PropertyEdit(props) {
|
|
|
1339
1357
|
$expand: expand,
|
|
1340
1358
|
type
|
|
1341
1359
|
},
|
|
1342
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ React17.createElement(UIRow, null, /* @__PURE__ */ React17.createElement(UIName, null, /* @__PURE__ */ React17.createElement(
|
|
1343
1361
|
BlurInput,
|
|
1344
1362
|
{
|
|
1363
|
+
disabled: readonly,
|
|
1345
1364
|
placeholder: config?.placeholder ?? "Input Variable Name",
|
|
1346
1365
|
size: "small",
|
|
1347
1366
|
value: name,
|
|
1348
1367
|
onChange: (value2) => onChange("name", value2)
|
|
1349
1368
|
}
|
|
1350
|
-
)), /* @__PURE__ */
|
|
1369
|
+
)), /* @__PURE__ */ React17.createElement(UIType, null, /* @__PURE__ */ React17.createElement(
|
|
1351
1370
|
TypeSelector,
|
|
1352
1371
|
{
|
|
1353
1372
|
value: typeSelectorValue,
|
|
1373
|
+
readonly,
|
|
1354
1374
|
onChange: (_value) => {
|
|
1355
1375
|
onChangeProps?.({
|
|
1356
1376
|
...value || {},
|
|
@@ -1358,51 +1378,56 @@ function PropertyEdit(props) {
|
|
|
1358
1378
|
});
|
|
1359
1379
|
}
|
|
1360
1380
|
}
|
|
1361
|
-
)), /* @__PURE__ */
|
|
1381
|
+
)), /* @__PURE__ */ React17.createElement(UIRequired, null, /* @__PURE__ */ React17.createElement(
|
|
1362
1382
|
Checkbox,
|
|
1363
1383
|
{
|
|
1384
|
+
disabled: readonly,
|
|
1364
1385
|
checked: isPropertyRequired,
|
|
1365
1386
|
onChange: (e) => onChange("isPropertyRequired", e.target.checked)
|
|
1366
1387
|
}
|
|
1367
|
-
)), /* @__PURE__ */
|
|
1368
|
-
|
|
1388
|
+
)), /* @__PURE__ */ React17.createElement(UIActions, null, /* @__PURE__ */ React17.createElement(
|
|
1389
|
+
IconButton3,
|
|
1369
1390
|
{
|
|
1391
|
+
disabled: readonly,
|
|
1370
1392
|
size: "small",
|
|
1371
1393
|
theme: "borderless",
|
|
1372
|
-
icon: expand ? /* @__PURE__ */
|
|
1394
|
+
icon: expand ? /* @__PURE__ */ React17.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React17.createElement(IconExpand, { size: "small" }),
|
|
1373
1395
|
onClick: () => {
|
|
1374
1396
|
setExpand((_expand) => !_expand);
|
|
1375
1397
|
}
|
|
1376
1398
|
}
|
|
1377
|
-
), isDrilldownObject && /* @__PURE__ */
|
|
1378
|
-
|
|
1399
|
+
), isDrilldownObject && /* @__PURE__ */ React17.createElement(
|
|
1400
|
+
IconButton3,
|
|
1379
1401
|
{
|
|
1402
|
+
disabled: readonly,
|
|
1380
1403
|
size: "small",
|
|
1381
1404
|
theme: "borderless",
|
|
1382
|
-
icon: /* @__PURE__ */
|
|
1405
|
+
icon: /* @__PURE__ */ React17.createElement(IconAddChildren, null),
|
|
1383
1406
|
onClick: () => {
|
|
1384
1407
|
onAddProperty();
|
|
1385
1408
|
setCollapse(true);
|
|
1386
1409
|
}
|
|
1387
1410
|
}
|
|
1388
|
-
), /* @__PURE__ */
|
|
1389
|
-
|
|
1411
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1412
|
+
IconButton3,
|
|
1390
1413
|
{
|
|
1414
|
+
disabled: readonly,
|
|
1391
1415
|
size: "small",
|
|
1392
1416
|
theme: "borderless",
|
|
1393
|
-
icon: /* @__PURE__ */
|
|
1417
|
+
icon: /* @__PURE__ */ React17.createElement(IconMinus, { size: "small" }),
|
|
1394
1418
|
onClick: onRemove
|
|
1395
1419
|
}
|
|
1396
1420
|
))),
|
|
1397
|
-
expand && /* @__PURE__ */
|
|
1421
|
+
expand && /* @__PURE__ */ React17.createElement(UIExpandDetail, null, /* @__PURE__ */ React17.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ React17.createElement(
|
|
1398
1422
|
BlurInput,
|
|
1399
1423
|
{
|
|
1424
|
+
disabled: readonly,
|
|
1400
1425
|
size: "small",
|
|
1401
1426
|
value: description,
|
|
1402
1427
|
onChange: (value2) => onChange("description", value2),
|
|
1403
1428
|
placeholder: config?.descPlaceholder ?? "Help LLM to understand the property"
|
|
1404
1429
|
}
|
|
1405
|
-
), $level === 0 && type && type !== "array" && /* @__PURE__ */
|
|
1430
|
+
), $level === 0 && type && type !== "array" && /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ React17.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React17.createElement(
|
|
1406
1431
|
DefaultValue,
|
|
1407
1432
|
{
|
|
1408
1433
|
value: defaultValue,
|
|
@@ -1413,9 +1438,10 @@ function PropertyEdit(props) {
|
|
|
1413
1438
|
onChange: (value2) => onChange("default", value2)
|
|
1414
1439
|
}
|
|
1415
1440
|
))))
|
|
1416
|
-
), showCollapse && /* @__PURE__ */
|
|
1441
|
+
), showCollapse && /* @__PURE__ */ React17.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React17.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React17.createElement(
|
|
1417
1442
|
PropertyEdit,
|
|
1418
1443
|
{
|
|
1444
|
+
readonly,
|
|
1419
1445
|
key: _property.key,
|
|
1420
1446
|
value: _property,
|
|
1421
1447
|
config,
|
|
@@ -1437,29 +1463,35 @@ function PropertyEdit(props) {
|
|
|
1437
1463
|
}
|
|
1438
1464
|
|
|
1439
1465
|
// src/components/batch-variable-selector/index.tsx
|
|
1440
|
-
import
|
|
1466
|
+
import React18 from "react";
|
|
1441
1467
|
import { PrivateScopeProvider } from "@flowgram.ai/editor";
|
|
1442
1468
|
var batchVariableSchema = {
|
|
1443
1469
|
type: "array",
|
|
1444
1470
|
extra: { weak: true }
|
|
1445
1471
|
};
|
|
1446
1472
|
function BatchVariableSelector(props) {
|
|
1447
|
-
return /* @__PURE__ */
|
|
1473
|
+
return /* @__PURE__ */ React18.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React18.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
|
|
1448
1474
|
}
|
|
1449
1475
|
|
|
1450
1476
|
// src/components/dynamic-value-input/index.tsx
|
|
1451
|
-
import
|
|
1452
|
-
import {
|
|
1477
|
+
import React19 from "react";
|
|
1478
|
+
import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
|
|
1479
|
+
import { IconButton as IconButton4 } from "@douyinfe/semi-ui";
|
|
1453
1480
|
import { IconSetting } from "@douyinfe/semi-icons";
|
|
1454
1481
|
|
|
1455
1482
|
// src/components/dynamic-value-input/styles.tsx
|
|
1456
|
-
import
|
|
1457
|
-
var UIContainer2 =
|
|
1483
|
+
import styled4 from "styled-components";
|
|
1484
|
+
var UIContainer2 = styled4.div`
|
|
1458
1485
|
display: flex;
|
|
1459
1486
|
align-items: center;
|
|
1460
|
-
|
|
1487
|
+
border-radius: 4px;
|
|
1488
|
+
border: 1px solid var(--semi-color-border);
|
|
1489
|
+
|
|
1490
|
+
overflow: hidden;
|
|
1491
|
+
|
|
1492
|
+
background-color: var(--semi-color-fill-0);
|
|
1461
1493
|
`;
|
|
1462
|
-
var UIMain =
|
|
1494
|
+
var UIMain = styled4.div`
|
|
1463
1495
|
flex-grow: 1;
|
|
1464
1496
|
overflow: hidden;
|
|
1465
1497
|
min-width: 0;
|
|
@@ -1468,9 +1500,62 @@ var UIMain = styled3.div`
|
|
|
1468
1500
|
& .semi-input-number,
|
|
1469
1501
|
& .semi-select {
|
|
1470
1502
|
width: 100%;
|
|
1503
|
+
border: none;
|
|
1504
|
+
border-radius: 0;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
& .semi-input-wrapper {
|
|
1508
|
+
border: none;
|
|
1509
|
+
border-radius: 0;
|
|
1510
|
+
}
|
|
1511
|
+
`;
|
|
1512
|
+
var UIType2 = styled4.div`
|
|
1513
|
+
border-right: 1px solid #e5e5e5;
|
|
1514
|
+
|
|
1515
|
+
& .semi-button {
|
|
1516
|
+
border-radius: 0;
|
|
1517
|
+
}
|
|
1518
|
+
`;
|
|
1519
|
+
var UITrigger = styled4.div`
|
|
1520
|
+
border-left: 1px solid #e5e5e5;
|
|
1521
|
+
|
|
1522
|
+
& .semi-button {
|
|
1523
|
+
border-radius: 0;
|
|
1471
1524
|
}
|
|
1472
1525
|
`;
|
|
1473
|
-
|
|
1526
|
+
|
|
1527
|
+
// src/components/dynamic-value-input/hooks.ts
|
|
1528
|
+
import { useMemo as useMemo6, useState as useState5 } from "react";
|
|
1529
|
+
import { useScopeAvailable } from "@flowgram.ai/editor";
|
|
1530
|
+
function useRefVariable(value) {
|
|
1531
|
+
const available = useScopeAvailable();
|
|
1532
|
+
const refVariable = useMemo6(() => {
|
|
1533
|
+
if (value?.type === "ref") {
|
|
1534
|
+
return available.getByKeyPath(value.content);
|
|
1535
|
+
}
|
|
1536
|
+
}, [value, available]);
|
|
1537
|
+
return refVariable;
|
|
1538
|
+
}
|
|
1539
|
+
function useSelectSchema(schemaFromProps, constantProps, value) {
|
|
1540
|
+
let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: "string" };
|
|
1541
|
+
if (value?.type === "constant") {
|
|
1542
|
+
defaultSelectSchema = value?.schema || defaultSelectSchema;
|
|
1543
|
+
}
|
|
1544
|
+
const [selectSchema, setSelectSchema] = useState5(defaultSelectSchema);
|
|
1545
|
+
return [selectSchema, setSelectSchema];
|
|
1546
|
+
}
|
|
1547
|
+
function useIncludeSchema(schemaFromProps) {
|
|
1548
|
+
const includeSchema = useMemo6(() => {
|
|
1549
|
+
if (!schemaFromProps) {
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
if (schemaFromProps?.type === "number") {
|
|
1553
|
+
return [schemaFromProps, { type: "integer" }];
|
|
1554
|
+
}
|
|
1555
|
+
return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
|
|
1556
|
+
}, [schemaFromProps]);
|
|
1557
|
+
return includeSchema;
|
|
1558
|
+
}
|
|
1474
1559
|
|
|
1475
1560
|
// src/components/dynamic-value-input/index.tsx
|
|
1476
1561
|
function DynamicValueInput({
|
|
@@ -1478,18 +1563,49 @@ function DynamicValueInput({
|
|
|
1478
1563
|
onChange,
|
|
1479
1564
|
readonly,
|
|
1480
1565
|
style,
|
|
1481
|
-
schema,
|
|
1566
|
+
schema: schemaFromProps,
|
|
1482
1567
|
constantProps
|
|
1483
1568
|
}) {
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
|
|
1569
|
+
const refVariable = useRefVariable(value);
|
|
1570
|
+
const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
|
|
1571
|
+
const includeSchema = useIncludeSchema(schemaFromProps);
|
|
1572
|
+
const renderTypeSelector = () => {
|
|
1573
|
+
if (schemaFromProps) {
|
|
1574
|
+
return /* @__PURE__ */ React19.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
|
|
1575
|
+
}
|
|
1576
|
+
if (value?.type === "ref") {
|
|
1577
|
+
const schema = refVariable?.type ? JsonSchemaUtils3.astToSchema(refVariable?.type) : void 0;
|
|
1578
|
+
return /* @__PURE__ */ React19.createElement(TypeSelector, { value: schema, readonly: true });
|
|
1487
1579
|
}
|
|
1488
|
-
return
|
|
1489
|
-
|
|
1580
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1581
|
+
TypeSelector,
|
|
1582
|
+
{
|
|
1583
|
+
value: selectSchema,
|
|
1584
|
+
onChange: (_v) => {
|
|
1585
|
+
setSelectSchema(_v || { type: "string" });
|
|
1586
|
+
let content;
|
|
1587
|
+
if (_v?.type === "object") {
|
|
1588
|
+
content = "{}";
|
|
1589
|
+
}
|
|
1590
|
+
if (_v?.type === "array") {
|
|
1591
|
+
content = "[]";
|
|
1592
|
+
}
|
|
1593
|
+
if (_v?.type === "boolean") {
|
|
1594
|
+
content = false;
|
|
1595
|
+
}
|
|
1596
|
+
onChange({
|
|
1597
|
+
type: "constant",
|
|
1598
|
+
content,
|
|
1599
|
+
schema: _v || { type: "string" }
|
|
1600
|
+
});
|
|
1601
|
+
},
|
|
1602
|
+
readonly
|
|
1603
|
+
}
|
|
1604
|
+
);
|
|
1605
|
+
};
|
|
1490
1606
|
const renderMain = () => {
|
|
1491
1607
|
if (value?.type === "ref") {
|
|
1492
|
-
return /* @__PURE__ */
|
|
1608
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1493
1609
|
VariableSelector,
|
|
1494
1610
|
{
|
|
1495
1611
|
style: { width: "100%" },
|
|
@@ -1500,18 +1616,29 @@ function DynamicValueInput({
|
|
|
1500
1616
|
}
|
|
1501
1617
|
);
|
|
1502
1618
|
}
|
|
1503
|
-
|
|
1619
|
+
const constantSchema = schemaFromProps || selectSchema || { type: "string" };
|
|
1620
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1504
1621
|
ConstantInput,
|
|
1505
1622
|
{
|
|
1506
1623
|
value: value?.content,
|
|
1507
|
-
onChange: (_v) => onChange({ type: "constant", content: _v }),
|
|
1508
|
-
schema:
|
|
1624
|
+
onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema }),
|
|
1625
|
+
schema: constantSchema || { type: "string" },
|
|
1509
1626
|
readonly,
|
|
1627
|
+
strategies: [...constantProps?.strategies || []],
|
|
1628
|
+
fallbackRenderer: () => /* @__PURE__ */ React19.createElement(
|
|
1629
|
+
VariableSelector,
|
|
1630
|
+
{
|
|
1631
|
+
style: { width: "100%" },
|
|
1632
|
+
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : void 0),
|
|
1633
|
+
includeSchema,
|
|
1634
|
+
readonly
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1510
1637
|
...constantProps
|
|
1511
1638
|
}
|
|
1512
1639
|
);
|
|
1513
1640
|
};
|
|
1514
|
-
const renderTrigger = () => /* @__PURE__ */
|
|
1641
|
+
const renderTrigger = () => /* @__PURE__ */ React19.createElement(
|
|
1515
1642
|
VariableSelector,
|
|
1516
1643
|
{
|
|
1517
1644
|
style: { width: "100%" },
|
|
@@ -1519,31 +1646,31 @@ function DynamicValueInput({
|
|
|
1519
1646
|
onChange: (_v) => onChange({ type: "ref", content: _v }),
|
|
1520
1647
|
includeSchema,
|
|
1521
1648
|
readonly,
|
|
1522
|
-
triggerRender: () => /* @__PURE__ */
|
|
1649
|
+
triggerRender: () => /* @__PURE__ */ React19.createElement(IconButton4, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React19.createElement(IconSetting, { size: "small" }) })
|
|
1523
1650
|
}
|
|
1524
1651
|
);
|
|
1525
|
-
return /* @__PURE__ */
|
|
1652
|
+
return /* @__PURE__ */ React19.createElement(UIContainer2, { style }, /* @__PURE__ */ React19.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React19.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React19.createElement(UITrigger, null, renderTrigger()));
|
|
1526
1653
|
}
|
|
1527
1654
|
|
|
1528
1655
|
// src/components/condition-row/index.tsx
|
|
1529
|
-
import
|
|
1530
|
-
import { Input as
|
|
1656
|
+
import React21, { useMemo as useMemo9 } from "react";
|
|
1657
|
+
import { Input as Input4 } from "@douyinfe/semi-ui";
|
|
1531
1658
|
|
|
1532
1659
|
// src/components/condition-row/styles.tsx
|
|
1533
|
-
import
|
|
1534
|
-
var UIContainer3 =
|
|
1660
|
+
import styled5 from "styled-components";
|
|
1661
|
+
var UIContainer3 = styled5.div`
|
|
1535
1662
|
display: flex;
|
|
1536
1663
|
align-items: center;
|
|
1537
1664
|
gap: 4px;
|
|
1538
1665
|
`;
|
|
1539
|
-
var UIOperator =
|
|
1540
|
-
var UILeft =
|
|
1666
|
+
var UIOperator = styled5.div``;
|
|
1667
|
+
var UILeft = styled5.div`
|
|
1541
1668
|
width: 100%;
|
|
1542
1669
|
`;
|
|
1543
|
-
var UIRight =
|
|
1670
|
+
var UIRight = styled5.div`
|
|
1544
1671
|
width: 100%;
|
|
1545
1672
|
`;
|
|
1546
|
-
var UIValues =
|
|
1673
|
+
var UIValues = styled5.div`
|
|
1547
1674
|
flex-grow: 1;
|
|
1548
1675
|
display: flex;
|
|
1549
1676
|
flex-direction: column;
|
|
@@ -1553,7 +1680,8 @@ var UIValues = styled4.div`
|
|
|
1553
1680
|
|
|
1554
1681
|
// src/components/condition-row/hooks/useRule.ts
|
|
1555
1682
|
import { useMemo as useMemo7 } from "react";
|
|
1556
|
-
import {
|
|
1683
|
+
import { JsonSchemaUtils as JsonSchemaUtils4 } from "@flowgram.ai/json-schema";
|
|
1684
|
+
import { useScopeAvailable as useScopeAvailable2 } from "@flowgram.ai/editor";
|
|
1557
1685
|
|
|
1558
1686
|
// src/components/condition-row/constants.ts
|
|
1559
1687
|
var rules = {
|
|
@@ -1564,8 +1692,8 @@ var rules = {
|
|
|
1564
1692
|
["not_contains" /* NOT_CONTAINS */]: "string",
|
|
1565
1693
|
["in" /* IN */]: "array",
|
|
1566
1694
|
["nin" /* NIN */]: "array",
|
|
1567
|
-
["is_empty" /* IS_EMPTY */]:
|
|
1568
|
-
["is_not_empty" /* IS_NOT_EMPTY */]:
|
|
1695
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1696
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1569
1697
|
},
|
|
1570
1698
|
number: {
|
|
1571
1699
|
["eq" /* EQ */]: "number",
|
|
@@ -1575,9 +1703,7 @@ var rules = {
|
|
|
1575
1703
|
["lt" /* LT */]: "number",
|
|
1576
1704
|
["lte" /* LTE */]: "number",
|
|
1577
1705
|
["in" /* IN */]: "array",
|
|
1578
|
-
["nin" /* NIN */]: "array"
|
|
1579
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
1580
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1706
|
+
["nin" /* NIN */]: "array"
|
|
1581
1707
|
},
|
|
1582
1708
|
integer: {
|
|
1583
1709
|
["eq" /* EQ */]: "number",
|
|
@@ -1587,9 +1713,7 @@ var rules = {
|
|
|
1587
1713
|
["lt" /* LT */]: "number",
|
|
1588
1714
|
["lte" /* LTE */]: "number",
|
|
1589
1715
|
["in" /* IN */]: "array",
|
|
1590
|
-
["nin" /* NIN */]: "array"
|
|
1591
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
1592
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1716
|
+
["nin" /* NIN */]: "array"
|
|
1593
1717
|
},
|
|
1594
1718
|
boolean: {
|
|
1595
1719
|
["eq" /* EQ */]: "boolean",
|
|
@@ -1597,9 +1721,7 @@ var rules = {
|
|
|
1597
1721
|
["is_true" /* IS_TRUE */]: null,
|
|
1598
1722
|
["is_false" /* IS_FALSE */]: null,
|
|
1599
1723
|
["in" /* IN */]: "array",
|
|
1600
|
-
["nin" /* NIN */]: "array"
|
|
1601
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
1602
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1724
|
+
["nin" /* NIN */]: "array"
|
|
1603
1725
|
},
|
|
1604
1726
|
object: {
|
|
1605
1727
|
["is_empty" /* IS_EMPTY */]: null,
|
|
@@ -1607,7 +1729,11 @@ var rules = {
|
|
|
1607
1729
|
},
|
|
1608
1730
|
array: {
|
|
1609
1731
|
["is_empty" /* IS_EMPTY */]: null,
|
|
1610
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1732
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null,
|
|
1733
|
+
["contains" /* CONTAINS */]: "array",
|
|
1734
|
+
["not_contains" /* NOT_CONTAINS */]: "array",
|
|
1735
|
+
["eq" /* EQ */]: "array",
|
|
1736
|
+
["neq" /* NEQ */]: "array"
|
|
1611
1737
|
},
|
|
1612
1738
|
map: {
|
|
1613
1739
|
["is_empty" /* IS_EMPTY */]: null,
|
|
@@ -1677,89 +1803,27 @@ var opConfigs = {
|
|
|
1677
1803
|
}
|
|
1678
1804
|
};
|
|
1679
1805
|
|
|
1680
|
-
// src/utils/format-legacy-refs/index.ts
|
|
1681
|
-
import { isObject } from "lodash";
|
|
1682
|
-
function formatLegacyRefOnSubmit(value) {
|
|
1683
|
-
if (isObject(value)) {
|
|
1684
|
-
if (isLegacyFlowRefValueSchema(value)) {
|
|
1685
|
-
return formatLegacyRefToNewRef(value);
|
|
1686
|
-
}
|
|
1687
|
-
return Object.fromEntries(
|
|
1688
|
-
Object.entries(value).map(([key, value2]) => [
|
|
1689
|
-
key,
|
|
1690
|
-
formatLegacyRefOnSubmit(value2)
|
|
1691
|
-
])
|
|
1692
|
-
);
|
|
1693
|
-
}
|
|
1694
|
-
if (Array.isArray(value)) {
|
|
1695
|
-
return value.map(formatLegacyRefOnSubmit);
|
|
1696
|
-
}
|
|
1697
|
-
return value;
|
|
1698
|
-
}
|
|
1699
|
-
function formatLegacyRefOnInit(value) {
|
|
1700
|
-
if (isObject(value)) {
|
|
1701
|
-
if (isNewFlowRefValueSchema(value)) {
|
|
1702
|
-
return formatNewRefToLegacyRef(value);
|
|
1703
|
-
}
|
|
1704
|
-
return Object.fromEntries(
|
|
1705
|
-
Object.entries(value).map(([key, value2]) => [
|
|
1706
|
-
key,
|
|
1707
|
-
formatLegacyRefOnInit(value2)
|
|
1708
|
-
])
|
|
1709
|
-
);
|
|
1710
|
-
}
|
|
1711
|
-
if (Array.isArray(value)) {
|
|
1712
|
-
return value.map(formatLegacyRefOnInit);
|
|
1713
|
-
}
|
|
1714
|
-
return value;
|
|
1715
|
-
}
|
|
1716
|
-
function isLegacyFlowRefValueSchema(value) {
|
|
1717
|
-
return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
|
|
1718
|
-
}
|
|
1719
|
-
function isNewFlowRefValueSchema(value) {
|
|
1720
|
-
return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
|
|
1721
|
-
}
|
|
1722
|
-
function formatLegacyRefToNewRef(value) {
|
|
1723
|
-
const keyPath = value.content.split(".");
|
|
1724
|
-
if (keyPath[1] === "outputs") {
|
|
1725
|
-
return {
|
|
1726
|
-
type: "ref",
|
|
1727
|
-
content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
|
|
1728
|
-
};
|
|
1729
|
-
}
|
|
1730
|
-
return {
|
|
1731
|
-
type: "ref",
|
|
1732
|
-
content: keyPath
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
function formatNewRefToLegacyRef(value) {
|
|
1736
|
-
return {
|
|
1737
|
-
type: "ref",
|
|
1738
|
-
content: value.content.join(".")
|
|
1739
|
-
};
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
1806
|
// src/components/condition-row/hooks/useRule.ts
|
|
1743
1807
|
function useRule(left) {
|
|
1744
|
-
const available =
|
|
1808
|
+
const available = useScopeAvailable2();
|
|
1745
1809
|
const variable = useMemo7(() => {
|
|
1746
1810
|
if (!left) return void 0;
|
|
1747
1811
|
return available.getByKeyPath(left.content);
|
|
1748
1812
|
}, [available, left]);
|
|
1749
1813
|
const rule = useMemo7(() => {
|
|
1750
1814
|
if (!variable) return void 0;
|
|
1751
|
-
const schema =
|
|
1815
|
+
const schema = JsonSchemaUtils4.astToSchema(variable.type, { drilldown: false });
|
|
1752
1816
|
return rules[schema?.type];
|
|
1753
1817
|
}, [variable?.type]);
|
|
1754
1818
|
return { rule };
|
|
1755
1819
|
}
|
|
1756
1820
|
|
|
1757
1821
|
// src/components/condition-row/hooks/useOp.tsx
|
|
1758
|
-
import
|
|
1759
|
-
import { Button as
|
|
1822
|
+
import React20, { useMemo as useMemo8 } from "react";
|
|
1823
|
+
import { Button as Button2, Select as Select2 } from "@douyinfe/semi-ui";
|
|
1760
1824
|
import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
|
|
1761
|
-
function useOp({ rule, op, onChange }) {
|
|
1762
|
-
const
|
|
1825
|
+
function useOp({ rule, op, onChange, readonly }) {
|
|
1826
|
+
const options = useMemo8(
|
|
1763
1827
|
() => Object.keys(rule || {}).map((_op) => ({
|
|
1764
1828
|
...opConfigs[_op] || {},
|
|
1765
1829
|
value: _op
|
|
@@ -1767,17 +1831,18 @@ function useOp({ rule, op, onChange }) {
|
|
|
1767
1831
|
[rule]
|
|
1768
1832
|
);
|
|
1769
1833
|
const opConfig = useMemo8(() => opConfigs[op], [op]);
|
|
1770
|
-
const renderOpSelect = () => /* @__PURE__ */
|
|
1834
|
+
const renderOpSelect = () => /* @__PURE__ */ React20.createElement(
|
|
1771
1835
|
Select2,
|
|
1772
1836
|
{
|
|
1773
1837
|
style: { height: 22 },
|
|
1838
|
+
disabled: readonly,
|
|
1774
1839
|
size: "small",
|
|
1775
1840
|
value: op,
|
|
1776
|
-
optionList:
|
|
1841
|
+
optionList: options,
|
|
1777
1842
|
onChange: (v) => {
|
|
1778
1843
|
onChange(v);
|
|
1779
1844
|
},
|
|
1780
|
-
triggerRender: ({ value }) => /* @__PURE__ */
|
|
1845
|
+
triggerRender: ({ value }) => /* @__PURE__ */ React20.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React20.createElement(IconChevronDownStroked2, { size: "small" }))
|
|
1781
1846
|
}
|
|
1782
1847
|
);
|
|
1783
1848
|
return { renderOpSelect, opConfig };
|
|
@@ -1790,13 +1855,14 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
1790
1855
|
const { renderOpSelect, opConfig } = useOp({
|
|
1791
1856
|
rule,
|
|
1792
1857
|
op: operator,
|
|
1793
|
-
onChange: (v) => onChange({ ...value, operator: v })
|
|
1858
|
+
onChange: (v) => onChange({ ...value, operator: v }),
|
|
1859
|
+
readonly
|
|
1794
1860
|
});
|
|
1795
1861
|
const targetSchema = useMemo9(() => {
|
|
1796
1862
|
const targetType = rule?.[operator] || null;
|
|
1797
1863
|
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
1798
1864
|
}, [rule, opConfig]);
|
|
1799
|
-
return /* @__PURE__ */
|
|
1865
|
+
return /* @__PURE__ */ React21.createElement(UIContainer3, { style }, /* @__PURE__ */ React21.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React21.createElement(UIValues, null, /* @__PURE__ */ React21.createElement(UILeft, null, /* @__PURE__ */ React21.createElement(
|
|
1800
1866
|
VariableSelector,
|
|
1801
1867
|
{
|
|
1802
1868
|
readonly,
|
|
@@ -1810,7 +1876,7 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
1810
1876
|
}
|
|
1811
1877
|
})
|
|
1812
1878
|
}
|
|
1813
|
-
)), /* @__PURE__ */
|
|
1879
|
+
)), /* @__PURE__ */ React21.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React21.createElement(
|
|
1814
1880
|
DynamicValueInput,
|
|
1815
1881
|
{
|
|
1816
1882
|
readonly: readonly || !rule,
|
|
@@ -1818,8 +1884,8 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
1818
1884
|
schema: targetSchema,
|
|
1819
1885
|
onChange: (v) => onChange({ ...value, right: v })
|
|
1820
1886
|
}
|
|
1821
|
-
) : /* @__PURE__ */
|
|
1822
|
-
|
|
1887
|
+
) : /* @__PURE__ */ React21.createElement(
|
|
1888
|
+
Input4,
|
|
1823
1889
|
{
|
|
1824
1890
|
size: "small",
|
|
1825
1891
|
disabled: true,
|
|
@@ -1830,28 +1896,32 @@ function ConditionRow({ style, value, onChange, readonly }) {
|
|
|
1830
1896
|
}
|
|
1831
1897
|
|
|
1832
1898
|
// src/components/batch-outputs/index.tsx
|
|
1833
|
-
import
|
|
1834
|
-
import { Button as
|
|
1899
|
+
import React22 from "react";
|
|
1900
|
+
import { Button as Button3, Input as Input5 } from "@douyinfe/semi-ui";
|
|
1835
1901
|
import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
|
|
1836
1902
|
|
|
1837
|
-
// src/
|
|
1838
|
-
import { useEffect as
|
|
1839
|
-
import {
|
|
1840
|
-
|
|
1903
|
+
// src/hooks/use-object-list/index.tsx
|
|
1904
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1905
|
+
import { nanoid } from "nanoid";
|
|
1906
|
+
import { difference, get, isObject, set } from "lodash";
|
|
1841
1907
|
function genId2() {
|
|
1842
|
-
return
|
|
1908
|
+
return nanoid();
|
|
1843
1909
|
}
|
|
1844
|
-
function
|
|
1845
|
-
|
|
1846
|
-
|
|
1910
|
+
function useObjectList({
|
|
1911
|
+
value,
|
|
1912
|
+
onChange,
|
|
1913
|
+
sortIndexKey
|
|
1914
|
+
}) {
|
|
1915
|
+
const [list, setList] = useState6([]);
|
|
1916
|
+
useEffect4(() => {
|
|
1847
1917
|
setList((_prevList) => {
|
|
1848
|
-
const newKeys = Object.
|
|
1918
|
+
const newKeys = Object.entries(value || {}).sort((a, b) => get(a[1], sortIndexKey || 0) - get(b[1], sortIndexKey || 0)).map(([key]) => key);
|
|
1849
1919
|
const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
|
|
1850
1920
|
const addKeys = difference(newKeys, oldKeys);
|
|
1851
1921
|
return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
|
|
1852
1922
|
id: item.id,
|
|
1853
1923
|
key: item.key,
|
|
1854
|
-
value: item.key ? value?.[item.key] :
|
|
1924
|
+
value: item.key ? value?.[item.key] : item.value
|
|
1855
1925
|
})).concat(
|
|
1856
1926
|
addKeys.map((_key) => ({
|
|
1857
1927
|
id: genId2(),
|
|
@@ -1869,17 +1939,44 @@ function useList({ value, onChange }) {
|
|
|
1869
1939
|
}
|
|
1870
1940
|
]);
|
|
1871
1941
|
};
|
|
1872
|
-
const
|
|
1942
|
+
const updateValue = (itemId, value2) => {
|
|
1943
|
+
setList((prevList) => {
|
|
1944
|
+
const nextList = prevList.map((_item) => {
|
|
1945
|
+
if (_item.id === itemId) {
|
|
1946
|
+
return {
|
|
1947
|
+
..._item,
|
|
1948
|
+
value: value2
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
return _item;
|
|
1952
|
+
});
|
|
1953
|
+
onChange(
|
|
1954
|
+
Object.fromEntries(
|
|
1955
|
+
nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
|
|
1956
|
+
if (isObject(_res[1]) && sortIndexKey) {
|
|
1957
|
+
set(_res[1], sortIndexKey, idx);
|
|
1958
|
+
}
|
|
1959
|
+
return _res;
|
|
1960
|
+
})
|
|
1961
|
+
)
|
|
1962
|
+
);
|
|
1963
|
+
return nextList;
|
|
1964
|
+
});
|
|
1965
|
+
};
|
|
1966
|
+
const updateKey = (itemId, key) => {
|
|
1873
1967
|
setList((prevList) => {
|
|
1874
1968
|
const nextList = prevList.map((_item) => {
|
|
1875
|
-
if (_item.id ===
|
|
1876
|
-
return
|
|
1969
|
+
if (_item.id === itemId) {
|
|
1970
|
+
return {
|
|
1971
|
+
..._item,
|
|
1972
|
+
key
|
|
1973
|
+
};
|
|
1877
1974
|
}
|
|
1878
1975
|
return _item;
|
|
1879
1976
|
});
|
|
1880
1977
|
onChange(
|
|
1881
1978
|
Object.fromEntries(
|
|
1882
|
-
nextList.filter((
|
|
1979
|
+
nextList.filter((item) => item.key).map((item) => [item.key, item.value])
|
|
1883
1980
|
)
|
|
1884
1981
|
);
|
|
1885
1982
|
return nextList;
|
|
@@ -1896,18 +1993,18 @@ function useList({ value, onChange }) {
|
|
|
1896
1993
|
return nextList;
|
|
1897
1994
|
});
|
|
1898
1995
|
};
|
|
1899
|
-
return { list, add,
|
|
1996
|
+
return { list, add, updateKey, updateValue, remove };
|
|
1900
1997
|
}
|
|
1901
1998
|
|
|
1902
1999
|
// src/components/batch-outputs/styles.tsx
|
|
1903
|
-
import
|
|
1904
|
-
var UIRows =
|
|
2000
|
+
import styled6 from "styled-components";
|
|
2001
|
+
var UIRows = styled6.div`
|
|
1905
2002
|
display: flex;
|
|
1906
2003
|
flex-direction: column;
|
|
1907
2004
|
gap: 10px;
|
|
1908
2005
|
margin-bottom: 10px;
|
|
1909
2006
|
`;
|
|
1910
|
-
var UIRow2 =
|
|
2007
|
+
var UIRow2 = styled6.div`
|
|
1911
2008
|
display: flex;
|
|
1912
2009
|
align-items: center;
|
|
1913
2010
|
gap: 5px;
|
|
@@ -1916,54 +2013,48 @@ var UIRow2 = styled5.div`
|
|
|
1916
2013
|
// src/components/batch-outputs/index.tsx
|
|
1917
2014
|
function BatchOutputs(props) {
|
|
1918
2015
|
const { readonly, style } = props;
|
|
1919
|
-
const { list, add,
|
|
1920
|
-
return /* @__PURE__ */
|
|
1921
|
-
|
|
2016
|
+
const { list, add, updateKey, updateValue, remove } = useObjectList(props);
|
|
2017
|
+
return /* @__PURE__ */ React22.createElement("div", null, /* @__PURE__ */ React22.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React22.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React22.createElement(
|
|
2018
|
+
Input5,
|
|
1922
2019
|
{
|
|
1923
2020
|
style: { width: 100 },
|
|
1924
2021
|
disabled: readonly,
|
|
1925
2022
|
size: "small",
|
|
1926
2023
|
value: item.key,
|
|
1927
|
-
onChange: (v) =>
|
|
2024
|
+
onChange: (v) => updateKey(item.id, v)
|
|
1928
2025
|
}
|
|
1929
|
-
), /* @__PURE__ */
|
|
2026
|
+
), /* @__PURE__ */ React22.createElement(
|
|
1930
2027
|
VariableSelector,
|
|
1931
2028
|
{
|
|
1932
2029
|
style: { flexGrow: 1 },
|
|
1933
2030
|
readonly,
|
|
1934
2031
|
value: item.value?.content,
|
|
1935
|
-
onChange: (v) =>
|
|
1936
|
-
...item,
|
|
1937
|
-
value: {
|
|
1938
|
-
type: "ref",
|
|
1939
|
-
content: v
|
|
1940
|
-
}
|
|
1941
|
-
})
|
|
2032
|
+
onChange: (v) => updateValue(item.id, { type: "ref", content: v })
|
|
1942
2033
|
}
|
|
1943
|
-
), /* @__PURE__ */
|
|
1944
|
-
|
|
2034
|
+
), /* @__PURE__ */ React22.createElement(
|
|
2035
|
+
Button3,
|
|
1945
2036
|
{
|
|
1946
2037
|
disabled: readonly,
|
|
1947
|
-
icon: /* @__PURE__ */
|
|
2038
|
+
icon: /* @__PURE__ */ React22.createElement(IconDelete, null),
|
|
1948
2039
|
size: "small",
|
|
1949
2040
|
onClick: () => remove(item.id)
|
|
1950
2041
|
}
|
|
1951
|
-
)))), /* @__PURE__ */
|
|
2042
|
+
)))), /* @__PURE__ */ React22.createElement(Button3, { disabled: readonly, icon: /* @__PURE__ */ React22.createElement(IconPlus2, null), size: "small", onClick: add }, "Add"));
|
|
1952
2043
|
}
|
|
1953
2044
|
|
|
1954
2045
|
// src/components/prompt-editor/index.tsx
|
|
1955
|
-
import
|
|
1956
|
-
import { Renderer, EditorProvider, ActiveLinePlaceholder } from "@coze-editor/editor/react";
|
|
1957
|
-
import
|
|
2046
|
+
import React23, { useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
2047
|
+
import { Renderer, EditorProvider as EditorProvider2, ActiveLinePlaceholder as ActiveLinePlaceholder2 } from "@coze-editor/editor/react";
|
|
2048
|
+
import preset2 from "@coze-editor/editor/preset-prompt";
|
|
1958
2049
|
|
|
1959
2050
|
// src/components/prompt-editor/styles.tsx
|
|
1960
|
-
import
|
|
1961
|
-
var UIContainer4 =
|
|
2051
|
+
import styled7, { css as css3 } from "styled-components";
|
|
2052
|
+
var UIContainer4 = styled7.div`
|
|
1962
2053
|
background-color: var(--semi-color-fill-0);
|
|
1963
2054
|
padding-left: 10px;
|
|
1964
2055
|
padding-right: 6px;
|
|
1965
2056
|
|
|
1966
|
-
${({ $hasError }) => $hasError &&
|
|
2057
|
+
${({ $hasError }) => $hasError && css3`
|
|
1967
2058
|
border: 1px solid var(--semi-color-danger-6);
|
|
1968
2059
|
`}
|
|
1969
2060
|
`;
|
|
@@ -1972,7 +2063,7 @@ var UIContainer4 = styled6.div`
|
|
|
1972
2063
|
import { useLayoutEffect } from "react";
|
|
1973
2064
|
import { useInjector } from "@coze-editor/editor/react";
|
|
1974
2065
|
import { astDecorator } from "@coze-editor/editor";
|
|
1975
|
-
import { EditorView } from "@codemirror/view";
|
|
2066
|
+
import { EditorView as EditorView2 } from "@codemirror/view";
|
|
1976
2067
|
function MarkdownHighlight() {
|
|
1977
2068
|
const injector = useInjector();
|
|
1978
2069
|
useLayoutEffect(
|
|
@@ -2003,7 +2094,7 @@ function MarkdownHighlight() {
|
|
|
2003
2094
|
};
|
|
2004
2095
|
}
|
|
2005
2096
|
}),
|
|
2006
|
-
|
|
2097
|
+
EditorView2.theme({
|
|
2007
2098
|
".heading": {
|
|
2008
2099
|
color: "#00818C",
|
|
2009
2100
|
fontWeight: "bold"
|
|
@@ -2040,7 +2131,7 @@ var language_support_default = LanguageSupport;
|
|
|
2040
2131
|
import { useLayoutEffect as useLayoutEffect3 } from "react";
|
|
2041
2132
|
import { useInjector as useInjector3 } from "@coze-editor/editor/react";
|
|
2042
2133
|
import { astDecorator as astDecorator2 } from "@coze-editor/editor";
|
|
2043
|
-
import { EditorView as
|
|
2134
|
+
import { EditorView as EditorView3 } from "@codemirror/view";
|
|
2044
2135
|
function JinjaHighlight() {
|
|
2045
2136
|
const injector = useInjector3();
|
|
2046
2137
|
useLayoutEffect3(
|
|
@@ -2065,7 +2156,7 @@ function JinjaHighlight() {
|
|
|
2065
2156
|
};
|
|
2066
2157
|
}
|
|
2067
2158
|
}),
|
|
2068
|
-
|
|
2159
|
+
EditorView3.theme({
|
|
2069
2160
|
".jinja-statement-bracket": {
|
|
2070
2161
|
color: "#D1009D"
|
|
2071
2162
|
},
|
|
@@ -2096,19 +2187,19 @@ function PromptEditor(props) {
|
|
|
2096
2187
|
children,
|
|
2097
2188
|
disableMarkdownHighlight
|
|
2098
2189
|
} = props || {};
|
|
2099
|
-
const editorRef =
|
|
2100
|
-
|
|
2190
|
+
const editorRef = useRef4(null);
|
|
2191
|
+
useEffect5(() => {
|
|
2101
2192
|
if (editorRef.current?.getValue() !== value?.content) {
|
|
2102
2193
|
editorRef.current?.setValue(String(value?.content || ""));
|
|
2103
2194
|
}
|
|
2104
2195
|
}, [value]);
|
|
2105
|
-
return /* @__PURE__ */
|
|
2196
|
+
return /* @__PURE__ */ React23.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ React23.createElement(EditorProvider2, null, /* @__PURE__ */ React23.createElement(
|
|
2106
2197
|
Renderer,
|
|
2107
2198
|
{
|
|
2108
2199
|
didMount: (editor) => {
|
|
2109
2200
|
editorRef.current = editor;
|
|
2110
2201
|
},
|
|
2111
|
-
plugins:
|
|
2202
|
+
plugins: preset2,
|
|
2112
2203
|
defaultValue: String(value?.content),
|
|
2113
2204
|
options: {
|
|
2114
2205
|
readOnly: readonly,
|
|
@@ -2119,15 +2210,15 @@ function PromptEditor(props) {
|
|
|
2119
2210
|
onChange({ type: "template", content: e.value });
|
|
2120
2211
|
}
|
|
2121
2212
|
}
|
|
2122
|
-
), activeLinePlaceholder && /* @__PURE__ */
|
|
2213
|
+
), activeLinePlaceholder && /* @__PURE__ */ React23.createElement(ActiveLinePlaceholder2, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ React23.createElement(markdown_default, null), /* @__PURE__ */ React23.createElement(language_support_default, null), /* @__PURE__ */ React23.createElement(jinja_default, null), children));
|
|
2123
2214
|
}
|
|
2124
2215
|
|
|
2125
2216
|
// src/components/prompt-editor-with-variables/index.tsx
|
|
2126
|
-
import
|
|
2217
|
+
import React26 from "react";
|
|
2127
2218
|
|
|
2128
2219
|
// src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
|
|
2129
|
-
import
|
|
2130
|
-
import { Popover, Tree } from "@douyinfe/semi-ui";
|
|
2220
|
+
import React24, { useEffect as useEffect6, useState as useState7 } from "react";
|
|
2221
|
+
import { Popover as Popover2, Tree } from "@douyinfe/semi-ui";
|
|
2131
2222
|
import {
|
|
2132
2223
|
Mention,
|
|
2133
2224
|
getCurrentMentionReplaceRange,
|
|
@@ -2135,9 +2226,9 @@ import {
|
|
|
2135
2226
|
PositionMirror
|
|
2136
2227
|
} from "@coze-editor/editor/react";
|
|
2137
2228
|
function VariableTree() {
|
|
2138
|
-
const [posKey, setPosKey] =
|
|
2139
|
-
const [visible, setVisible] =
|
|
2140
|
-
const [position, setPosition] =
|
|
2229
|
+
const [posKey, setPosKey] = useState7("");
|
|
2230
|
+
const [visible, setVisible] = useState7(false);
|
|
2231
|
+
const [position, setPosition] = useState7(-1);
|
|
2141
2232
|
const editor = useEditor();
|
|
2142
2233
|
function insert(variablePath) {
|
|
2143
2234
|
const range = getCurrentMentionReplaceRange(editor.$view.state);
|
|
@@ -2154,20 +2245,20 @@ function VariableTree() {
|
|
|
2154
2245
|
setPosition(e.state.selection.main.head);
|
|
2155
2246
|
setVisible(e.value);
|
|
2156
2247
|
}
|
|
2157
|
-
|
|
2248
|
+
useEffect6(() => {
|
|
2158
2249
|
if (!editor) {
|
|
2159
2250
|
return;
|
|
2160
2251
|
}
|
|
2161
2252
|
}, [editor, visible]);
|
|
2162
2253
|
const treeData = useVariableTree({});
|
|
2163
|
-
return /* @__PURE__ */
|
|
2164
|
-
|
|
2254
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React24.createElement(
|
|
2255
|
+
Popover2,
|
|
2165
2256
|
{
|
|
2166
2257
|
visible,
|
|
2167
2258
|
trigger: "custom",
|
|
2168
2259
|
position: "topLeft",
|
|
2169
2260
|
rePosKey: posKey,
|
|
2170
|
-
content: /* @__PURE__ */
|
|
2261
|
+
content: /* @__PURE__ */ React24.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React24.createElement(
|
|
2171
2262
|
Tree,
|
|
2172
2263
|
{
|
|
2173
2264
|
treeData,
|
|
@@ -2177,7 +2268,7 @@ function VariableTree() {
|
|
|
2177
2268
|
}
|
|
2178
2269
|
))
|
|
2179
2270
|
},
|
|
2180
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ React24.createElement(
|
|
2181
2272
|
PositionMirror,
|
|
2182
2273
|
{
|
|
2183
2274
|
position,
|
|
@@ -2189,28 +2280,28 @@ function VariableTree() {
|
|
|
2189
2280
|
|
|
2190
2281
|
// src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
|
|
2191
2282
|
import ReactDOM from "react-dom";
|
|
2192
|
-
import
|
|
2283
|
+
import React25, { useLayoutEffect as useLayoutEffect4 } from "react";
|
|
2193
2284
|
import { isEqual, last } from "lodash";
|
|
2194
2285
|
import {
|
|
2195
2286
|
Disposable,
|
|
2196
2287
|
DisposableCollection,
|
|
2197
2288
|
useCurrentScope
|
|
2198
2289
|
} from "@flowgram.ai/editor";
|
|
2199
|
-
import { Popover as
|
|
2290
|
+
import { Popover as Popover3 } from "@douyinfe/semi-ui";
|
|
2200
2291
|
import { IconIssueStroked as IconIssueStroked2 } from "@douyinfe/semi-icons";
|
|
2201
2292
|
import { useInjector as useInjector4 } from "@coze-editor/editor/react";
|
|
2202
2293
|
import {
|
|
2203
2294
|
Decoration,
|
|
2204
|
-
EditorView as
|
|
2295
|
+
EditorView as EditorView4,
|
|
2205
2296
|
MatchDecorator,
|
|
2206
2297
|
ViewPlugin,
|
|
2207
2298
|
WidgetType
|
|
2208
2299
|
} from "@codemirror/view";
|
|
2209
2300
|
|
|
2210
2301
|
// src/components/prompt-editor-with-variables/styles.tsx
|
|
2211
|
-
import
|
|
2302
|
+
import styled8 from "styled-components";
|
|
2212
2303
|
import { Tag as Tag2 } from "@douyinfe/semi-ui";
|
|
2213
|
-
var UIRootTitle2 =
|
|
2304
|
+
var UIRootTitle2 = styled8.div`
|
|
2214
2305
|
margin-right: 4px;
|
|
2215
2306
|
min-width: 20px;
|
|
2216
2307
|
overflow: hidden;
|
|
@@ -2218,12 +2309,12 @@ var UIRootTitle2 = styled7.div`
|
|
|
2218
2309
|
white-space: nowrap;
|
|
2219
2310
|
color: var(--semi-color-text-2);
|
|
2220
2311
|
`;
|
|
2221
|
-
var UIVarName2 =
|
|
2312
|
+
var UIVarName2 = styled8.div`
|
|
2222
2313
|
overflow: hidden;
|
|
2223
2314
|
text-overflow: ellipsis;
|
|
2224
2315
|
white-space: nowrap;
|
|
2225
2316
|
`;
|
|
2226
|
-
var UITag2 =
|
|
2317
|
+
var UITag2 = styled8(Tag2)`
|
|
2227
2318
|
display: inline-flex;
|
|
2228
2319
|
align-items: center;
|
|
2229
2320
|
justify-content: flex-start;
|
|
@@ -2237,7 +2328,7 @@ var UITag2 = styled7(Tag2)`
|
|
|
2237
2328
|
margin: 0 5px;
|
|
2238
2329
|
}
|
|
2239
2330
|
`;
|
|
2240
|
-
var
|
|
2331
|
+
var UIPopoverContent2 = styled8.div`
|
|
2241
2332
|
padding: 10px;
|
|
2242
2333
|
display: inline-flex;
|
|
2243
2334
|
align-items: center;
|
|
@@ -2251,7 +2342,7 @@ var VariableTagWidget = class extends WidgetType {
|
|
|
2251
2342
|
this.toDispose = new DisposableCollection();
|
|
2252
2343
|
this.renderIcon = (icon) => {
|
|
2253
2344
|
if (typeof icon === "string") {
|
|
2254
|
-
return /* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ React25.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
2255
2346
|
}
|
|
2256
2347
|
return icon;
|
|
2257
2348
|
};
|
|
@@ -2264,20 +2355,21 @@ var VariableTagWidget = class extends WidgetType {
|
|
|
2264
2355
|
renderVariable(v) {
|
|
2265
2356
|
if (!v) {
|
|
2266
2357
|
this.renderReact(
|
|
2267
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ React25.createElement(UITag2, { prefixIcon: /* @__PURE__ */ React25.createElement(IconIssueStroked2, null), color: "amber" }, "Unknown")
|
|
2268
2359
|
);
|
|
2269
2360
|
return;
|
|
2270
2361
|
}
|
|
2271
|
-
const rootField = last(v.parentFields);
|
|
2272
|
-
const
|
|
2362
|
+
const rootField = last(v.parentFields) || v;
|
|
2363
|
+
const isRoot = v.parentFields.length === 0;
|
|
2364
|
+
const rootTitle = /* @__PURE__ */ React25.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
|
|
2273
2365
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
2274
2366
|
this.renderReact(
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
|
|
2367
|
+
/* @__PURE__ */ React25.createElement(
|
|
2368
|
+
Popover3,
|
|
2277
2369
|
{
|
|
2278
|
-
content: /* @__PURE__ */
|
|
2370
|
+
content: /* @__PURE__ */ React25.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ React25.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
|
|
2279
2371
|
},
|
|
2280
|
-
/* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ React25.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ React25.createElement(UIVarName2, null, v?.key))
|
|
2281
2373
|
)
|
|
2282
2374
|
);
|
|
2283
2375
|
}
|
|
@@ -2338,7 +2430,7 @@ function VariableTagInject() {
|
|
|
2338
2430
|
{
|
|
2339
2431
|
decorations: (p) => p.decorations,
|
|
2340
2432
|
provide(p) {
|
|
2341
|
-
return
|
|
2433
|
+
return EditorView4.atomicRanges.of(
|
|
2342
2434
|
(view) => view.plugin(p)?.decorations ?? Decoration.none
|
|
2343
2435
|
);
|
|
2344
2436
|
}
|
|
@@ -2351,15 +2443,15 @@ function VariableTagInject() {
|
|
|
2351
2443
|
|
|
2352
2444
|
// src/components/prompt-editor-with-variables/index.tsx
|
|
2353
2445
|
function PromptEditorWithVariables(props) {
|
|
2354
|
-
return /* @__PURE__ */
|
|
2446
|
+
return /* @__PURE__ */ React26.createElement(PromptEditor, { ...props }, /* @__PURE__ */ React26.createElement(VariableTree, null), /* @__PURE__ */ React26.createElement(VariableTagInject, null));
|
|
2355
2447
|
}
|
|
2356
2448
|
|
|
2357
2449
|
// src/components/prompt-editor-with-inputs/index.tsx
|
|
2358
|
-
import
|
|
2450
|
+
import React29 from "react";
|
|
2359
2451
|
|
|
2360
2452
|
// src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
|
|
2361
|
-
import
|
|
2362
|
-
import { Popover as
|
|
2453
|
+
import React28, { useEffect as useEffect7, useState as useState8 } from "react";
|
|
2454
|
+
import { Popover as Popover4 } from "@douyinfe/semi-ui";
|
|
2363
2455
|
import {
|
|
2364
2456
|
Mention as Mention2,
|
|
2365
2457
|
getCurrentMentionReplaceRange as getCurrentMentionReplaceRange2,
|
|
@@ -2368,18 +2460,18 @@ import {
|
|
|
2368
2460
|
} from "@coze-editor/editor/react";
|
|
2369
2461
|
|
|
2370
2462
|
// src/components/prompt-editor-with-inputs/inputs-picker.tsx
|
|
2371
|
-
import
|
|
2463
|
+
import React27, { useMemo as useMemo10 } from "react";
|
|
2372
2464
|
import { last as last2 } from "lodash";
|
|
2373
2465
|
import {
|
|
2374
2466
|
ASTMatch as ASTMatch3,
|
|
2375
|
-
useScopeAvailable as
|
|
2467
|
+
useScopeAvailable as useScopeAvailable3
|
|
2376
2468
|
} from "@flowgram.ai/editor";
|
|
2377
2469
|
import { Tree as Tree2 } from "@douyinfe/semi-ui";
|
|
2378
2470
|
function InputsPicker({
|
|
2379
2471
|
inputsValues,
|
|
2380
2472
|
onSelect
|
|
2381
2473
|
}) {
|
|
2382
|
-
const available =
|
|
2474
|
+
const available = useScopeAvailable3();
|
|
2383
2475
|
const getArrayDrilldown = (type, depth = 1) => {
|
|
2384
2476
|
if (ASTMatch3.isArray(type.items)) {
|
|
2385
2477
|
return getArrayDrilldown(type.items, depth + 1);
|
|
@@ -2414,7 +2506,7 @@ function InputsPicker({
|
|
|
2414
2506
|
};
|
|
2415
2507
|
const treeData = useMemo10(
|
|
2416
2508
|
() => Object.entries(inputsValues).map(([key, value]) => {
|
|
2417
|
-
if (value
|
|
2509
|
+
if (value?.type === "ref") {
|
|
2418
2510
|
const variable = available.getByKeyPath(value.content || []);
|
|
2419
2511
|
if (variable) {
|
|
2420
2512
|
return renderVariable(variable, [key]);
|
|
@@ -2428,14 +2520,14 @@ function InputsPicker({
|
|
|
2428
2520
|
}),
|
|
2429
2521
|
[]
|
|
2430
2522
|
);
|
|
2431
|
-
return /* @__PURE__ */
|
|
2523
|
+
return /* @__PURE__ */ React27.createElement(Tree2, { treeData, onSelect: (v) => onSelect(v) });
|
|
2432
2524
|
}
|
|
2433
2525
|
|
|
2434
2526
|
// src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
|
|
2435
2527
|
function InputsTree({ inputsValues }) {
|
|
2436
|
-
const [posKey, setPosKey] =
|
|
2437
|
-
const [visible, setVisible] =
|
|
2438
|
-
const [position, setPosition] =
|
|
2528
|
+
const [posKey, setPosKey] = useState8("");
|
|
2529
|
+
const [visible, setVisible] = useState8(false);
|
|
2530
|
+
const [position, setPosition] = useState8(-1);
|
|
2439
2531
|
const editor = useEditor2();
|
|
2440
2532
|
function insert(variablePath) {
|
|
2441
2533
|
const range = getCurrentMentionReplaceRange2(editor.$view.state);
|
|
@@ -2443,381 +2535,59 @@ function InputsTree({ inputsValues }) {
|
|
|
2443
2535
|
return;
|
|
2444
2536
|
}
|
|
2445
2537
|
editor.replaceText({
|
|
2446
|
-
...range,
|
|
2447
|
-
text: "{{" + variablePath + "}}"
|
|
2448
|
-
});
|
|
2449
|
-
setVisible(false);
|
|
2450
|
-
}
|
|
2451
|
-
function handleOpenChange(e) {
|
|
2452
|
-
setPosition(e.state.selection.main.head);
|
|
2453
|
-
setVisible(e.value);
|
|
2454
|
-
}
|
|
2455
|
-
useEffect6(() => {
|
|
2456
|
-
if (!editor) {
|
|
2457
|
-
return;
|
|
2458
|
-
}
|
|
2459
|
-
}, [editor, visible]);
|
|
2460
|
-
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React20.createElement(
|
|
2461
|
-
Popover3,
|
|
2462
|
-
{
|
|
2463
|
-
visible,
|
|
2464
|
-
trigger: "custom",
|
|
2465
|
-
position: "topLeft",
|
|
2466
|
-
rePosKey: posKey,
|
|
2467
|
-
content: /* @__PURE__ */ React20.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React20.createElement(
|
|
2468
|
-
InputsPicker,
|
|
2469
|
-
{
|
|
2470
|
-
inputsValues,
|
|
2471
|
-
onSelect: (v) => {
|
|
2472
|
-
insert(v);
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
))
|
|
2476
|
-
},
|
|
2477
|
-
/* @__PURE__ */ React20.createElement(
|
|
2478
|
-
PositionMirror2,
|
|
2479
|
-
{
|
|
2480
|
-
position,
|
|
2481
|
-
onChange: () => setPosKey(String(Math.random()))
|
|
2482
|
-
}
|
|
2483
|
-
)
|
|
2484
|
-
));
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
// src/components/prompt-editor-with-inputs/index.tsx
|
|
2488
|
-
function PromptEditorWithInputs({ inputsValues, ...restProps }) {
|
|
2489
|
-
return /* @__PURE__ */ React21.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React21.createElement(InputsTree, { inputsValues }));
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
// src/components/code-editor/index.tsx
|
|
2493
|
-
import React22, { useEffect as useEffect7, useRef as useRef4 } from "react";
|
|
2494
|
-
import {
|
|
2495
|
-
ActiveLinePlaceholder as ActiveLinePlaceholder2,
|
|
2496
|
-
createRenderer,
|
|
2497
|
-
EditorProvider as EditorProvider2
|
|
2498
|
-
} from "@coze-editor/editor/react";
|
|
2499
|
-
import preset2 from "@coze-editor/editor/preset-code";
|
|
2500
|
-
import { EditorView as EditorView4 } from "@codemirror/view";
|
|
2501
|
-
|
|
2502
|
-
// src/components/code-editor/utils.ts
|
|
2503
|
-
function getSuffixByLanguageId(languageId) {
|
|
2504
|
-
if (languageId === "python") {
|
|
2505
|
-
return ".py";
|
|
2506
|
-
}
|
|
2507
|
-
if (languageId === "typescript") {
|
|
2508
|
-
return ".ts";
|
|
2509
|
-
}
|
|
2510
|
-
if (languageId === "shell") {
|
|
2511
|
-
return ".sh";
|
|
2512
|
-
}
|
|
2513
|
-
if (languageId === "json") {
|
|
2514
|
-
return ".json";
|
|
2515
|
-
}
|
|
2516
|
-
return "";
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
// src/components/code-editor/theme/index.ts
|
|
2520
|
-
import { themes } from "@coze-editor/editor/preset-code";
|
|
2521
|
-
|
|
2522
|
-
// src/components/code-editor/theme/light.ts
|
|
2523
|
-
import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
|
|
2524
|
-
var colors = {
|
|
2525
|
-
background: "#F7F7FC",
|
|
2526
|
-
// syntax
|
|
2527
|
-
comment: "#000A298A",
|
|
2528
|
-
key: "#00818C",
|
|
2529
|
-
string: "#D1009D",
|
|
2530
|
-
number: "#C74200",
|
|
2531
|
-
boolean: "#2B57D9",
|
|
2532
|
-
null: "#2B57D9",
|
|
2533
|
-
separator: "#0F1529D1"
|
|
2534
|
-
};
|
|
2535
|
-
var lightTheme = createTheme({
|
|
2536
|
-
variant: "light",
|
|
2537
|
-
settings: {
|
|
2538
|
-
background: "#fff",
|
|
2539
|
-
foreground: "#000",
|
|
2540
|
-
caret: "#000",
|
|
2541
|
-
selection: "#d9d9d9",
|
|
2542
|
-
gutterBackground: "#f0f0f0",
|
|
2543
|
-
gutterForeground: "#666",
|
|
2544
|
-
gutterBorderColor: "transparent",
|
|
2545
|
-
gutterBorderWidth: 0,
|
|
2546
|
-
lineHighlight: "#f0f0f0",
|
|
2547
|
-
bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
|
|
2548
|
-
tooltip: {
|
|
2549
|
-
backgroundColor: "#f0f0f0",
|
|
2550
|
-
color: "#000",
|
|
2551
|
-
border: "1px solid #ccc"
|
|
2552
|
-
},
|
|
2553
|
-
link: {
|
|
2554
|
-
color: "#007bff"
|
|
2555
|
-
},
|
|
2556
|
-
completionItemHover: {
|
|
2557
|
-
backgroundColor: "#f0f0f0"
|
|
2558
|
-
},
|
|
2559
|
-
completionItemSelected: {
|
|
2560
|
-
backgroundColor: "#e0e0e0"
|
|
2561
|
-
},
|
|
2562
|
-
completionItemIcon: {
|
|
2563
|
-
color: "#333"
|
|
2564
|
-
},
|
|
2565
|
-
completionItemLabel: {
|
|
2566
|
-
color: "#333"
|
|
2567
|
-
},
|
|
2568
|
-
completionItemInfo: {
|
|
2569
|
-
color: "#333"
|
|
2570
|
-
},
|
|
2571
|
-
completionItemDetail: {
|
|
2572
|
-
color: "#666"
|
|
2573
|
-
}
|
|
2574
|
-
},
|
|
2575
|
-
styles: [
|
|
2576
|
-
// JSON
|
|
2577
|
-
{
|
|
2578
|
-
tag: t.comment,
|
|
2579
|
-
color: colors.comment
|
|
2580
|
-
},
|
|
2581
|
-
{
|
|
2582
|
-
tag: [t.propertyName],
|
|
2583
|
-
color: colors.key
|
|
2584
|
-
},
|
|
2585
|
-
{
|
|
2586
|
-
tag: [t.string],
|
|
2587
|
-
color: colors.string
|
|
2588
|
-
},
|
|
2589
|
-
{
|
|
2590
|
-
tag: [t.number],
|
|
2591
|
-
color: colors.number
|
|
2592
|
-
},
|
|
2593
|
-
{
|
|
2594
|
-
tag: [t.bool],
|
|
2595
|
-
color: colors.boolean
|
|
2596
|
-
},
|
|
2597
|
-
{
|
|
2598
|
-
tag: [t.null],
|
|
2599
|
-
color: colors.null
|
|
2600
|
-
},
|
|
2601
|
-
{
|
|
2602
|
-
tag: [t.separator],
|
|
2603
|
-
color: colors.separator
|
|
2604
|
-
},
|
|
2605
|
-
// markdown
|
|
2606
|
-
{
|
|
2607
|
-
tag: [t.heading],
|
|
2608
|
-
color: "#3e76ef"
|
|
2609
|
-
},
|
|
2610
|
-
{
|
|
2611
|
-
tag: [t.processingInstruction],
|
|
2612
|
-
color: "#3e76ef"
|
|
2613
|
-
},
|
|
2614
|
-
// shell
|
|
2615
|
-
// curl
|
|
2616
|
-
{
|
|
2617
|
-
tag: [t.standard(t.variableName)],
|
|
2618
|
-
color: "#00804A"
|
|
2619
|
-
},
|
|
2620
|
-
// -X
|
|
2621
|
-
{
|
|
2622
|
-
tag: [t.attributeName],
|
|
2623
|
-
color: "#C74200"
|
|
2624
|
-
},
|
|
2625
|
-
// url in string (includes quotes), e.g. "https://..."
|
|
2626
|
-
{
|
|
2627
|
-
tag: [t.special(t.string)],
|
|
2628
|
-
color: "#2B57D9"
|
|
2629
|
-
}
|
|
2630
|
-
]
|
|
2631
|
-
});
|
|
2632
|
-
|
|
2633
|
-
// src/components/code-editor/theme/dark.ts
|
|
2634
|
-
import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
|
|
2635
|
-
var colors2 = {
|
|
2636
|
-
background: "#151B27",
|
|
2637
|
-
// syntax
|
|
2638
|
-
comment: "#FFFFFF63",
|
|
2639
|
-
key: "#39E5D7",
|
|
2640
|
-
string: "#FF94D2",
|
|
2641
|
-
number: "#FF9933",
|
|
2642
|
-
boolean: "#78B0FF",
|
|
2643
|
-
null: "#78B0FF",
|
|
2644
|
-
separator: "#FFFFFFC9"
|
|
2645
|
-
};
|
|
2646
|
-
var darkTheme = createTheme2({
|
|
2647
|
-
variant: "dark",
|
|
2648
|
-
settings: {
|
|
2649
|
-
background: colors2.background,
|
|
2650
|
-
foreground: "#fff",
|
|
2651
|
-
caret: "#AEAFAD",
|
|
2652
|
-
selection: "#d9d9d942",
|
|
2653
|
-
gutterBackground: colors2.background,
|
|
2654
|
-
gutterForeground: "#FFFFFF63",
|
|
2655
|
-
gutterBorderColor: "transparent",
|
|
2656
|
-
gutterBorderWidth: 0,
|
|
2657
|
-
lineHighlight: "#272e3d36",
|
|
2658
|
-
bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
|
|
2659
|
-
tooltip: {
|
|
2660
|
-
backgroundColor: "#363D4D",
|
|
2661
|
-
color: "#fff",
|
|
2662
|
-
border: "none"
|
|
2663
|
-
},
|
|
2664
|
-
link: {
|
|
2665
|
-
color: "#4daafc"
|
|
2666
|
-
},
|
|
2667
|
-
completionItemHover: {
|
|
2668
|
-
backgroundColor: "#FFFFFF0F"
|
|
2669
|
-
},
|
|
2670
|
-
completionItemSelected: {
|
|
2671
|
-
backgroundColor: "#FFFFFF17"
|
|
2672
|
-
},
|
|
2673
|
-
completionItemIcon: {
|
|
2674
|
-
color: "#FFFFFFC9"
|
|
2675
|
-
},
|
|
2676
|
-
completionItemLabel: {
|
|
2677
|
-
color: "#FFFFFFC9"
|
|
2678
|
-
},
|
|
2679
|
-
completionItemInfo: {
|
|
2680
|
-
color: "#FFFFFFC9"
|
|
2681
|
-
},
|
|
2682
|
-
completionItemDetail: {
|
|
2683
|
-
color: "#FFFFFF63"
|
|
2684
|
-
}
|
|
2685
|
-
},
|
|
2686
|
-
styles: [
|
|
2687
|
-
// json
|
|
2688
|
-
{
|
|
2689
|
-
tag: t2.comment,
|
|
2690
|
-
color: colors2.comment
|
|
2691
|
-
},
|
|
2692
|
-
{
|
|
2693
|
-
tag: [t2.propertyName],
|
|
2694
|
-
color: colors2.key
|
|
2695
|
-
},
|
|
2696
|
-
{
|
|
2697
|
-
tag: [t2.string],
|
|
2698
|
-
color: colors2.string
|
|
2699
|
-
},
|
|
2700
|
-
{
|
|
2701
|
-
tag: [t2.number],
|
|
2702
|
-
color: colors2.number
|
|
2703
|
-
},
|
|
2704
|
-
{
|
|
2705
|
-
tag: [t2.bool],
|
|
2706
|
-
color: colors2.boolean
|
|
2707
|
-
},
|
|
2708
|
-
{
|
|
2709
|
-
tag: [t2.null],
|
|
2710
|
-
color: colors2.null
|
|
2711
|
-
},
|
|
2712
|
-
{
|
|
2713
|
-
tag: [t2.separator],
|
|
2714
|
-
color: colors2.separator
|
|
2715
|
-
},
|
|
2716
|
-
// markdown
|
|
2717
|
-
{
|
|
2718
|
-
tag: [t2.heading],
|
|
2719
|
-
color: "#6b6bff"
|
|
2720
|
-
},
|
|
2721
|
-
{
|
|
2722
|
-
tag: [t2.processingInstruction],
|
|
2723
|
-
color: "#6b6bff"
|
|
2724
|
-
},
|
|
2725
|
-
// shell
|
|
2726
|
-
// curl
|
|
2727
|
-
{
|
|
2728
|
-
tag: [t2.standard(t2.variableName)],
|
|
2729
|
-
color: "#3BEB84"
|
|
2730
|
-
},
|
|
2731
|
-
// -X
|
|
2732
|
-
{
|
|
2733
|
-
tag: [t2.attributeName],
|
|
2734
|
-
color: "#FF9933"
|
|
2735
|
-
},
|
|
2736
|
-
// url in string (includes quotes), e.g. "https://..."
|
|
2737
|
-
{
|
|
2738
|
-
tag: [t2.special(t2.string)],
|
|
2739
|
-
color: "#78B0FF"
|
|
2740
|
-
}
|
|
2741
|
-
]
|
|
2742
|
-
});
|
|
2743
|
-
|
|
2744
|
-
// src/components/code-editor/theme/index.ts
|
|
2745
|
-
themes.register("dark", darkTheme);
|
|
2746
|
-
themes.register("light", lightTheme);
|
|
2747
|
-
|
|
2748
|
-
// src/components/code-editor/language-features.ts
|
|
2749
|
-
import { languages } from "@coze-editor/editor/preset-code";
|
|
2750
|
-
import { typescript } from "@coze-editor/editor/language-typescript";
|
|
2751
|
-
import { shell } from "@coze-editor/editor/language-shell";
|
|
2752
|
-
import { python } from "@coze-editor/editor/language-python";
|
|
2753
|
-
import { json } from "@coze-editor/editor/language-json";
|
|
2754
|
-
import { mixLanguages } from "@coze-editor/editor";
|
|
2755
|
-
languages.register("python", python);
|
|
2756
|
-
languages.register("typescript", typescript);
|
|
2757
|
-
languages.register("shell", shell);
|
|
2758
|
-
languages.register("json", {
|
|
2759
|
-
// mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
|
|
2760
|
-
language: mixLanguages({
|
|
2761
|
-
outerLanguage: json.language
|
|
2762
|
-
}),
|
|
2763
|
-
languageService: json.languageService
|
|
2764
|
-
});
|
|
2765
|
-
|
|
2766
|
-
// src/components/code-editor/index.tsx
|
|
2767
|
-
var OriginCodeEditor = createRenderer(preset2, [
|
|
2768
|
-
EditorView4.theme({
|
|
2769
|
-
"&.cm-focused": {
|
|
2770
|
-
outline: "none"
|
|
2771
|
-
}
|
|
2772
|
-
})
|
|
2773
|
-
]);
|
|
2774
|
-
function CodeEditor({
|
|
2775
|
-
value,
|
|
2776
|
-
onChange,
|
|
2777
|
-
languageId = "python",
|
|
2778
|
-
theme = "light",
|
|
2779
|
-
children,
|
|
2780
|
-
placeholder,
|
|
2781
|
-
activeLinePlaceholder,
|
|
2782
|
-
options: options2,
|
|
2783
|
-
readonly
|
|
2784
|
-
}) {
|
|
2785
|
-
const editorRef = useRef4(null);
|
|
2538
|
+
...range,
|
|
2539
|
+
text: "{{" + variablePath + "}}"
|
|
2540
|
+
});
|
|
2541
|
+
setVisible(false);
|
|
2542
|
+
}
|
|
2543
|
+
function handleOpenChange(e) {
|
|
2544
|
+
setPosition(e.state.selection.main.head);
|
|
2545
|
+
setVisible(e.value);
|
|
2546
|
+
}
|
|
2786
2547
|
useEffect7(() => {
|
|
2787
|
-
if (
|
|
2788
|
-
|
|
2548
|
+
if (!editor) {
|
|
2549
|
+
return;
|
|
2789
2550
|
}
|
|
2790
|
-
}, [
|
|
2791
|
-
return /* @__PURE__ */
|
|
2792
|
-
|
|
2551
|
+
}, [editor, visible]);
|
|
2552
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React28.createElement(
|
|
2553
|
+
Popover4,
|
|
2793
2554
|
{
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
onChange: (e) => onChange?.(e.value)
|
|
2555
|
+
visible,
|
|
2556
|
+
trigger: "custom",
|
|
2557
|
+
position: "topLeft",
|
|
2558
|
+
rePosKey: posKey,
|
|
2559
|
+
content: /* @__PURE__ */ React28.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React28.createElement(
|
|
2560
|
+
InputsPicker,
|
|
2561
|
+
{
|
|
2562
|
+
inputsValues,
|
|
2563
|
+
onSelect: (v) => {
|
|
2564
|
+
insert(v);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
))
|
|
2808
2568
|
},
|
|
2809
|
-
|
|
2810
|
-
|
|
2569
|
+
/* @__PURE__ */ React28.createElement(
|
|
2570
|
+
PositionMirror2,
|
|
2571
|
+
{
|
|
2572
|
+
position,
|
|
2573
|
+
onChange: () => setPosKey(String(Math.random()))
|
|
2574
|
+
}
|
|
2575
|
+
)
|
|
2811
2576
|
));
|
|
2812
2577
|
}
|
|
2813
2578
|
|
|
2579
|
+
// src/components/prompt-editor-with-inputs/index.tsx
|
|
2580
|
+
function PromptEditorWithInputs({ inputsValues, ...restProps }) {
|
|
2581
|
+
return /* @__PURE__ */ React29.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React29.createElement(InputsTree, { inputsValues }));
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2814
2584
|
// src/components/json-editor-with-variables/index.tsx
|
|
2815
|
-
import
|
|
2585
|
+
import React32 from "react";
|
|
2816
2586
|
import { transformerCreator } from "@coze-editor/editor/preset-code";
|
|
2817
2587
|
|
|
2818
2588
|
// src/components/json-editor-with-variables/extensions/variable-tree.tsx
|
|
2819
|
-
import
|
|
2820
|
-
import { Popover as
|
|
2589
|
+
import React30, { useEffect as useEffect8, useState as useState9 } from "react";
|
|
2590
|
+
import { Popover as Popover5, Tree as Tree3 } from "@douyinfe/semi-ui";
|
|
2821
2591
|
import {
|
|
2822
2592
|
Mention as Mention3,
|
|
2823
2593
|
getCurrentMentionReplaceRange as getCurrentMentionReplaceRange3,
|
|
@@ -2825,9 +2595,9 @@ import {
|
|
|
2825
2595
|
PositionMirror as PositionMirror3
|
|
2826
2596
|
} from "@coze-editor/editor/react";
|
|
2827
2597
|
function VariableTree2() {
|
|
2828
|
-
const [posKey, setPosKey] =
|
|
2829
|
-
const [visible, setVisible] =
|
|
2830
|
-
const [position, setPosition] =
|
|
2598
|
+
const [posKey, setPosKey] = useState9("");
|
|
2599
|
+
const [visible, setVisible] = useState9(false);
|
|
2600
|
+
const [position, setPosition] = useState9(-1);
|
|
2831
2601
|
const editor = useEditor3();
|
|
2832
2602
|
function insert(variablePath) {
|
|
2833
2603
|
const range = getCurrentMentionReplaceRange3(editor.$view.state);
|
|
@@ -2850,14 +2620,14 @@ function VariableTree2() {
|
|
|
2850
2620
|
}
|
|
2851
2621
|
}, [editor, visible]);
|
|
2852
2622
|
const treeData = useVariableTree({});
|
|
2853
|
-
return /* @__PURE__ */
|
|
2854
|
-
|
|
2623
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(Mention3, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React30.createElement(
|
|
2624
|
+
Popover5,
|
|
2855
2625
|
{
|
|
2856
2626
|
visible,
|
|
2857
2627
|
trigger: "custom",
|
|
2858
2628
|
position: "topLeft",
|
|
2859
2629
|
rePosKey: posKey,
|
|
2860
|
-
content: /* @__PURE__ */
|
|
2630
|
+
content: /* @__PURE__ */ React30.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React30.createElement(
|
|
2861
2631
|
Tree3,
|
|
2862
2632
|
{
|
|
2863
2633
|
treeData,
|
|
@@ -2867,7 +2637,7 @@ function VariableTree2() {
|
|
|
2867
2637
|
}
|
|
2868
2638
|
))
|
|
2869
2639
|
},
|
|
2870
|
-
/* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ React30.createElement(
|
|
2871
2641
|
PositionMirror3,
|
|
2872
2642
|
{
|
|
2873
2643
|
position,
|
|
@@ -2878,7 +2648,7 @@ function VariableTree2() {
|
|
|
2878
2648
|
}
|
|
2879
2649
|
|
|
2880
2650
|
// src/components/json-editor-with-variables/extensions/variable-tag.tsx
|
|
2881
|
-
import
|
|
2651
|
+
import React31, { useLayoutEffect as useLayoutEffect5 } from "react";
|
|
2882
2652
|
import { createRoot } from "react-dom/client";
|
|
2883
2653
|
import { isEqual as isEqual2, last as last3 } from "lodash";
|
|
2884
2654
|
import {
|
|
@@ -2886,7 +2656,7 @@ import {
|
|
|
2886
2656
|
DisposableCollection as DisposableCollection2,
|
|
2887
2657
|
useCurrentScope as useCurrentScope2
|
|
2888
2658
|
} from "@flowgram.ai/editor";
|
|
2889
|
-
import { Popover as
|
|
2659
|
+
import { Popover as Popover6 } from "@douyinfe/semi-ui";
|
|
2890
2660
|
import { IconIssueStroked as IconIssueStroked3 } from "@douyinfe/semi-icons";
|
|
2891
2661
|
import { useInjector as useInjector5 } from "@coze-editor/editor/react";
|
|
2892
2662
|
import {
|
|
@@ -2898,9 +2668,9 @@ import {
|
|
|
2898
2668
|
} from "@codemirror/view";
|
|
2899
2669
|
|
|
2900
2670
|
// src/components/json-editor-with-variables/styles.tsx
|
|
2901
|
-
import
|
|
2671
|
+
import styled9 from "styled-components";
|
|
2902
2672
|
import { Tag as Tag3 } from "@douyinfe/semi-ui";
|
|
2903
|
-
var UIRootTitle3 =
|
|
2673
|
+
var UIRootTitle3 = styled9.div`
|
|
2904
2674
|
margin-right: 4px;
|
|
2905
2675
|
min-width: 20px;
|
|
2906
2676
|
overflow: hidden;
|
|
@@ -2908,12 +2678,12 @@ var UIRootTitle3 = styled8.div`
|
|
|
2908
2678
|
white-space: nowrap;
|
|
2909
2679
|
color: var(--semi-color-text-2);
|
|
2910
2680
|
`;
|
|
2911
|
-
var UIVarName3 =
|
|
2681
|
+
var UIVarName3 = styled9.div`
|
|
2912
2682
|
overflow: hidden;
|
|
2913
2683
|
text-overflow: ellipsis;
|
|
2914
2684
|
white-space: nowrap;
|
|
2915
2685
|
`;
|
|
2916
|
-
var UITag3 =
|
|
2686
|
+
var UITag3 = styled9(Tag3)`
|
|
2917
2687
|
display: inline-flex;
|
|
2918
2688
|
align-items: center;
|
|
2919
2689
|
justify-content: flex-start;
|
|
@@ -2927,7 +2697,7 @@ var UITag3 = styled8(Tag3)`
|
|
|
2927
2697
|
margin: 0 5px;
|
|
2928
2698
|
}
|
|
2929
2699
|
`;
|
|
2930
|
-
var
|
|
2700
|
+
var UIPopoverContent3 = styled9.div`
|
|
2931
2701
|
padding: 10px;
|
|
2932
2702
|
display: inline-flex;
|
|
2933
2703
|
align-items: center;
|
|
@@ -2941,7 +2711,7 @@ var VariableTagWidget2 = class extends WidgetType2 {
|
|
|
2941
2711
|
this.toDispose = new DisposableCollection2();
|
|
2942
2712
|
this.renderIcon = (icon) => {
|
|
2943
2713
|
if (typeof icon === "string") {
|
|
2944
|
-
return /* @__PURE__ */
|
|
2714
|
+
return /* @__PURE__ */ React31.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
2945
2715
|
}
|
|
2946
2716
|
return icon;
|
|
2947
2717
|
};
|
|
@@ -2951,20 +2721,20 @@ var VariableTagWidget2 = class extends WidgetType2 {
|
|
|
2951
2721
|
renderVariable(v) {
|
|
2952
2722
|
if (!v) {
|
|
2953
2723
|
this.root.render(
|
|
2954
|
-
/* @__PURE__ */
|
|
2724
|
+
/* @__PURE__ */ React31.createElement(UITag3, { prefixIcon: /* @__PURE__ */ React31.createElement(IconIssueStroked3, null), color: "amber" }, "Unknown")
|
|
2955
2725
|
);
|
|
2956
2726
|
return;
|
|
2957
2727
|
}
|
|
2958
2728
|
const rootField = last3(v.parentFields);
|
|
2959
|
-
const rootTitle = /* @__PURE__ */
|
|
2729
|
+
const rootTitle = /* @__PURE__ */ React31.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
|
|
2960
2730
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
2961
2731
|
this.root.render(
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
|
|
2732
|
+
/* @__PURE__ */ React31.createElement(
|
|
2733
|
+
Popover6,
|
|
2964
2734
|
{
|
|
2965
|
-
content: /* @__PURE__ */
|
|
2735
|
+
content: /* @__PURE__ */ React31.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ React31.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
|
|
2966
2736
|
},
|
|
2967
|
-
/* @__PURE__ */
|
|
2737
|
+
/* @__PURE__ */ React31.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React31.createElement(UIVarName3, null, v?.key))
|
|
2968
2738
|
)
|
|
2969
2739
|
);
|
|
2970
2740
|
}
|
|
@@ -3048,68 +2818,533 @@ function findAllMatches(inputString, regex) {
|
|
|
3048
2818
|
if (match.index === globalRegex.lastIndex) {
|
|
3049
2819
|
globalRegex.lastIndex++;
|
|
3050
2820
|
}
|
|
3051
|
-
matches.push({
|
|
3052
|
-
match: match[0],
|
|
3053
|
-
range: [match.index, match.index + match[0].length]
|
|
3054
|
-
});
|
|
3055
|
-
}
|
|
3056
|
-
return matches;
|
|
2821
|
+
matches.push({
|
|
2822
|
+
match: match[0],
|
|
2823
|
+
range: [match.index, match.index + match[0].length]
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
return matches;
|
|
2827
|
+
}
|
|
2828
|
+
var transformer = transformerCreator((text) => {
|
|
2829
|
+
const originalSource = text.toString();
|
|
2830
|
+
const matches = findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
|
|
2831
|
+
if (matches.length > 0) {
|
|
2832
|
+
matches.forEach(({ range }) => {
|
|
2833
|
+
text.replaceRange(range[0], range[1], "null");
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2836
|
+
return text;
|
|
2837
|
+
});
|
|
2838
|
+
function JsonEditorWithVariables(props) {
|
|
2839
|
+
return /* @__PURE__ */ React32.createElement(
|
|
2840
|
+
CodeEditor,
|
|
2841
|
+
{
|
|
2842
|
+
languageId: "json",
|
|
2843
|
+
activeLinePlaceholder: "Press '@' to Select variable",
|
|
2844
|
+
...props,
|
|
2845
|
+
options: {
|
|
2846
|
+
transformer,
|
|
2847
|
+
...props.options || {}
|
|
2848
|
+
}
|
|
2849
|
+
},
|
|
2850
|
+
/* @__PURE__ */ React32.createElement(VariableTree2, null),
|
|
2851
|
+
/* @__PURE__ */ React32.createElement(VariableTagInject2, null)
|
|
2852
|
+
);
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
// src/components/inputs-values/index.tsx
|
|
2856
|
+
import React34 from "react";
|
|
2857
|
+
import { Button as Button4, IconButton as IconButton5 } from "@douyinfe/semi-ui";
|
|
2858
|
+
import { IconDelete as IconDelete2, IconPlus as IconPlus3 } from "@douyinfe/semi-icons";
|
|
2859
|
+
|
|
2860
|
+
// src/components/inputs-values/styles.tsx
|
|
2861
|
+
import styled10 from "styled-components";
|
|
2862
|
+
var UIRows2 = styled10.div`
|
|
2863
|
+
display: flex;
|
|
2864
|
+
flex-direction: column;
|
|
2865
|
+
gap: 10px;
|
|
2866
|
+
margin-bottom: 10px;
|
|
2867
|
+
`;
|
|
2868
|
+
var UIRow3 = styled10.div`
|
|
2869
|
+
display: flex;
|
|
2870
|
+
align-items: center;
|
|
2871
|
+
gap: 5px;
|
|
2872
|
+
`;
|
|
2873
|
+
|
|
2874
|
+
// src/components/inputs-values/components/blur-input.tsx
|
|
2875
|
+
import React33, { useEffect as useEffect9, useState as useState10 } from "react";
|
|
2876
|
+
import Input6 from "@douyinfe/semi-ui/lib/es/input";
|
|
2877
|
+
function BlurInput2(props) {
|
|
2878
|
+
const [value, setValue] = useState10("");
|
|
2879
|
+
useEffect9(() => {
|
|
2880
|
+
setValue(props.value);
|
|
2881
|
+
}, [props.value]);
|
|
2882
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2883
|
+
Input6,
|
|
2884
|
+
{
|
|
2885
|
+
...props,
|
|
2886
|
+
value,
|
|
2887
|
+
onChange: (value2) => {
|
|
2888
|
+
setValue(value2);
|
|
2889
|
+
},
|
|
2890
|
+
onBlur: (e) => props.onChange?.(value, e)
|
|
2891
|
+
}
|
|
2892
|
+
);
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
// src/components/inputs-values/index.tsx
|
|
2896
|
+
function InputsValues({
|
|
2897
|
+
value,
|
|
2898
|
+
onChange,
|
|
2899
|
+
style,
|
|
2900
|
+
readonly,
|
|
2901
|
+
constantProps,
|
|
2902
|
+
schema,
|
|
2903
|
+
hasError
|
|
2904
|
+
}) {
|
|
2905
|
+
const { list, updateKey, updateValue, remove, add } = useObjectList({
|
|
2906
|
+
value,
|
|
2907
|
+
onChange,
|
|
2908
|
+
sortIndexKey: "extra.index"
|
|
2909
|
+
});
|
|
2910
|
+
return /* @__PURE__ */ React34.createElement("div", null, /* @__PURE__ */ React34.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React34.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React34.createElement(
|
|
2911
|
+
BlurInput2,
|
|
2912
|
+
{
|
|
2913
|
+
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
2914
|
+
disabled: readonly,
|
|
2915
|
+
size: "small",
|
|
2916
|
+
value: item.key,
|
|
2917
|
+
onChange: (v) => updateKey(item.id, v),
|
|
2918
|
+
placeholder: "Input Key"
|
|
2919
|
+
}
|
|
2920
|
+
), /* @__PURE__ */ React34.createElement(
|
|
2921
|
+
DynamicValueInput,
|
|
2922
|
+
{
|
|
2923
|
+
style: { flexGrow: 1 },
|
|
2924
|
+
readonly,
|
|
2925
|
+
value: item.value,
|
|
2926
|
+
onChange: (v) => updateValue(item.id, v),
|
|
2927
|
+
schema,
|
|
2928
|
+
hasError,
|
|
2929
|
+
constantProps: {
|
|
2930
|
+
...constantProps,
|
|
2931
|
+
strategies: [...constantProps?.strategies || []]
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
), /* @__PURE__ */ React34.createElement(
|
|
2935
|
+
IconButton5,
|
|
2936
|
+
{
|
|
2937
|
+
disabled: readonly,
|
|
2938
|
+
theme: "borderless",
|
|
2939
|
+
icon: /* @__PURE__ */ React34.createElement(IconDelete2, { size: "small" }),
|
|
2940
|
+
size: "small",
|
|
2941
|
+
onClick: () => remove(item.id)
|
|
2942
|
+
}
|
|
2943
|
+
)))), /* @__PURE__ */ React34.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React34.createElement(IconPlus3, null), size: "small", onClick: add }, "Add"));
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
// src/components/display-schema-tree/index.tsx
|
|
2947
|
+
import React35 from "react";
|
|
2948
|
+
|
|
2949
|
+
// src/components/display-schema-tree/styles.tsx
|
|
2950
|
+
import styled11, { css as css4 } from "styled-components";
|
|
2951
|
+
var TreeRow = styled11.div`
|
|
2952
|
+
display: flex;
|
|
2953
|
+
align-items: center;
|
|
2954
|
+
|
|
2955
|
+
.tree-icon {
|
|
2956
|
+
margin-right: 8px;
|
|
2957
|
+
width: 14px;
|
|
2958
|
+
height: 14px;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
height: 27px;
|
|
2962
|
+
white-space: nowrap;
|
|
2963
|
+
`;
|
|
2964
|
+
var HorizontalLine = styled11.div`
|
|
2965
|
+
position: relative;
|
|
2966
|
+
|
|
2967
|
+
&::before,
|
|
2968
|
+
&::after {
|
|
2969
|
+
content: '';
|
|
2970
|
+
position: absolute;
|
|
2971
|
+
background-color: var(--semi-color-text-3);
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
&::after {
|
|
2975
|
+
top: 0px;
|
|
2976
|
+
right: 6px;
|
|
2977
|
+
width: 15px;
|
|
2978
|
+
height: 1px;
|
|
2979
|
+
}
|
|
2980
|
+
`;
|
|
2981
|
+
var TreeTitle = styled11.div`
|
|
2982
|
+
// overflow: hidden;
|
|
2983
|
+
// text-overflow: ellipsis;
|
|
2984
|
+
`;
|
|
2985
|
+
var TreeLevel = styled11.div`
|
|
2986
|
+
padding-left: 30px;
|
|
2987
|
+
position: relative;
|
|
2988
|
+
|
|
2989
|
+
/* &::before {
|
|
2990
|
+
content: '';
|
|
2991
|
+
position: absolute;
|
|
2992
|
+
background-color: var(--semi-color-text-3);
|
|
2993
|
+
top: 0px;
|
|
2994
|
+
bottom: 0px;
|
|
2995
|
+
left: -22px;
|
|
2996
|
+
width: 1px;
|
|
2997
|
+
} */
|
|
2998
|
+
`;
|
|
2999
|
+
var TreeItem = styled11.div`
|
|
3000
|
+
position: relative;
|
|
3001
|
+
|
|
3002
|
+
&::before {
|
|
3003
|
+
content: '';
|
|
3004
|
+
position: absolute;
|
|
3005
|
+
background-color: var(--semi-color-text-3);
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
&:not(:last-child)::before {
|
|
3009
|
+
width: 1px;
|
|
3010
|
+
top: 0;
|
|
3011
|
+
bottom: 0;
|
|
3012
|
+
left: -22px;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
&:last-child::before {
|
|
3016
|
+
width: 1px;
|
|
3017
|
+
top: 0;
|
|
3018
|
+
height: 14px;
|
|
3019
|
+
left: -22px;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
${(props) => props.depth === 0 && css4`
|
|
3023
|
+
&::before {
|
|
3024
|
+
width: 0px !important;
|
|
3025
|
+
}
|
|
3026
|
+
`}
|
|
3027
|
+
`;
|
|
3028
|
+
|
|
3029
|
+
// src/components/display-schema-tree/index.tsx
|
|
3030
|
+
function DisplaySchemaTree(props) {
|
|
3031
|
+
return /* @__PURE__ */ React35.createElement(SchemaTree, { ...props });
|
|
3032
|
+
}
|
|
3033
|
+
function SchemaTree(props) {
|
|
3034
|
+
const {
|
|
3035
|
+
value: schema = {},
|
|
3036
|
+
drilldown = true,
|
|
3037
|
+
depth = 0,
|
|
3038
|
+
showIcon = true,
|
|
3039
|
+
parentKey = ""
|
|
3040
|
+
} = props || {};
|
|
3041
|
+
const typeManager = useTypeManager();
|
|
3042
|
+
const config = typeManager.getTypeBySchema(schema);
|
|
3043
|
+
const title = typeManager.getComplexText(schema);
|
|
3044
|
+
const icon = typeManager?.getDisplayIcon(schema);
|
|
3045
|
+
let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
|
|
3046
|
+
const childEntries = Object.entries(properties || {});
|
|
3047
|
+
return /* @__PURE__ */ React35.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ React35.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ React35.createElement(HorizontalLine, null), showIcon && icon && React35.cloneElement(icon, {
|
|
3048
|
+
className: "tree-icon"
|
|
3049
|
+
}), /* @__PURE__ */ React35.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ React35.createElement(React35.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ React35.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ React35.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
// src/components/display-outputs/index.tsx
|
|
3053
|
+
import React37, { useEffect as useEffect10 } from "react";
|
|
3054
|
+
import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
|
|
3055
|
+
import { useCurrentScope as useCurrentScope3, useRefresh } from "@flowgram.ai/editor";
|
|
3056
|
+
|
|
3057
|
+
// src/components/display-schema-tag/index.tsx
|
|
3058
|
+
import React36 from "react";
|
|
3059
|
+
import { Popover as Popover7 } from "@douyinfe/semi-ui";
|
|
3060
|
+
|
|
3061
|
+
// src/components/display-schema-tag/styles.ts
|
|
3062
|
+
import styled12 from "styled-components";
|
|
3063
|
+
import { Tag as Tag4 } from "@douyinfe/semi-ui";
|
|
3064
|
+
var PopoverContent = styled12.div`
|
|
3065
|
+
padding: 10px;
|
|
3066
|
+
`;
|
|
3067
|
+
var StyledTag = styled12(Tag4)`
|
|
3068
|
+
padding: 4px;
|
|
3069
|
+
|
|
3070
|
+
.tag-icon {
|
|
3071
|
+
width: 12px;
|
|
3072
|
+
height: 12px;
|
|
3073
|
+
}
|
|
3074
|
+
`;
|
|
3075
|
+
var TitleSpan = styled12.span`
|
|
3076
|
+
display: inline-block;
|
|
3077
|
+
margin-left: 4px;
|
|
3078
|
+
margin-top: -1px;
|
|
3079
|
+
overflow: hidden;
|
|
3080
|
+
text-overflow: ellipsis;
|
|
3081
|
+
`;
|
|
3082
|
+
|
|
3083
|
+
// src/components/display-schema-tag/index.tsx
|
|
3084
|
+
function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
|
|
3085
|
+
const typeManager = useTypeManager();
|
|
3086
|
+
const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
|
|
3087
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3088
|
+
Popover7,
|
|
3089
|
+
{
|
|
3090
|
+
content: /* @__PURE__ */ React36.createElement(PopoverContent, null, /* @__PURE__ */ React36.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
|
|
3091
|
+
},
|
|
3092
|
+
/* @__PURE__ */ React36.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React36.cloneElement(icon, {
|
|
3093
|
+
className: "tag-icon"
|
|
3094
|
+
}), title && /* @__PURE__ */ React36.createElement(TitleSpan, null, title))
|
|
3095
|
+
);
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
// src/components/display-outputs/styles.ts
|
|
3099
|
+
import styled13 from "styled-components";
|
|
3100
|
+
var DisplayOutputsWrapper = styled13.div`
|
|
3101
|
+
display: flex;
|
|
3102
|
+
gap: 5px;
|
|
3103
|
+
flex-wrap: wrap;
|
|
3104
|
+
`;
|
|
3105
|
+
|
|
3106
|
+
// src/components/display-outputs/index.tsx
|
|
3107
|
+
function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
3108
|
+
const scope = useCurrentScope3();
|
|
3109
|
+
const refresh = useRefresh();
|
|
3110
|
+
useEffect10(() => {
|
|
3111
|
+
if (!displayFromScope) {
|
|
3112
|
+
return () => null;
|
|
3113
|
+
}
|
|
3114
|
+
const disposable = scope.output.onListOrAnyVarChange(() => {
|
|
3115
|
+
refresh();
|
|
3116
|
+
});
|
|
3117
|
+
return () => {
|
|
3118
|
+
disposable.dispose();
|
|
3119
|
+
};
|
|
3120
|
+
}, [displayFromScope]);
|
|
3121
|
+
const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
|
|
3122
|
+
acm = {
|
|
3123
|
+
...acm,
|
|
3124
|
+
...JsonSchemaUtils5.astToSchema(curr.type)?.properties || {}
|
|
3125
|
+
};
|
|
3126
|
+
return acm;
|
|
3127
|
+
}, {}) : value?.properties || {};
|
|
3128
|
+
const childEntries = Object.entries(properties || {});
|
|
3129
|
+
return /* @__PURE__ */ React37.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React37.createElement(
|
|
3130
|
+
DisplaySchemaTag,
|
|
3131
|
+
{
|
|
3132
|
+
key,
|
|
3133
|
+
title: key,
|
|
3134
|
+
value: schema,
|
|
3135
|
+
showIconInTree,
|
|
3136
|
+
warning: !schema
|
|
3137
|
+
}
|
|
3138
|
+
)));
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
// src/components/display-flow-value/index.tsx
|
|
3142
|
+
import React38, { useMemo as useMemo11 } from "react";
|
|
3143
|
+
import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
|
|
3144
|
+
import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
|
|
3145
|
+
function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
3146
|
+
const available = useScopeAvailable4();
|
|
3147
|
+
const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
|
|
3148
|
+
const schema = useMemo11(() => {
|
|
3149
|
+
if (value?.type === "ref") {
|
|
3150
|
+
return JsonSchemaUtils6.astToSchema(variable?.type);
|
|
3151
|
+
}
|
|
3152
|
+
if (value?.type === "template") {
|
|
3153
|
+
return { type: "string" };
|
|
3154
|
+
}
|
|
3155
|
+
if (value?.type === "constant") {
|
|
3156
|
+
if (value?.schema) {
|
|
3157
|
+
return value?.schema;
|
|
3158
|
+
}
|
|
3159
|
+
if (typeof value?.content === "string") {
|
|
3160
|
+
return { type: "string" };
|
|
3161
|
+
}
|
|
3162
|
+
if (typeof value?.content === "number") {
|
|
3163
|
+
return { type: "number" };
|
|
3164
|
+
}
|
|
3165
|
+
if (typeof value?.content === "boolean") {
|
|
3166
|
+
return { type: "boolean" };
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
return { type: "unknown" };
|
|
3170
|
+
}, [value, variable?.hash]);
|
|
3171
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3172
|
+
DisplaySchemaTag,
|
|
3173
|
+
{
|
|
3174
|
+
title,
|
|
3175
|
+
value: schema,
|
|
3176
|
+
showIconInTree,
|
|
3177
|
+
warning: value?.type === "ref" && !variable
|
|
3178
|
+
}
|
|
3179
|
+
);
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
// src/components/display-inputs-values/index.tsx
|
|
3183
|
+
import React39 from "react";
|
|
3184
|
+
|
|
3185
|
+
// src/components/display-inputs-values/styles.ts
|
|
3186
|
+
import styled14 from "styled-components";
|
|
3187
|
+
var DisplayInputsWrapper = styled14.div`
|
|
3188
|
+
display: flex;
|
|
3189
|
+
gap: 5px;
|
|
3190
|
+
flex-wrap: wrap;
|
|
3191
|
+
`;
|
|
3192
|
+
|
|
3193
|
+
// src/components/display-inputs-values/index.tsx
|
|
3194
|
+
function DisplayInputsValues({ value, showIconInTree }) {
|
|
3195
|
+
const childEntries = Object.entries(value || {});
|
|
3196
|
+
return /* @__PURE__ */ React39.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => /* @__PURE__ */ React39.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree })));
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
// src/components/assign-rows/index.tsx
|
|
3200
|
+
import React42 from "react";
|
|
3201
|
+
import { FieldArray } from "@flowgram.ai/editor";
|
|
3202
|
+
import { Button as Button5 } from "@douyinfe/semi-ui";
|
|
3203
|
+
import { IconPlus as IconPlus4 } from "@douyinfe/semi-icons";
|
|
3204
|
+
|
|
3205
|
+
// src/components/assign-row/index.tsx
|
|
3206
|
+
import React41 from "react";
|
|
3207
|
+
import { IconButton as IconButton6 } from "@douyinfe/semi-ui";
|
|
3208
|
+
import { IconMinus as IconMinus2 } from "@douyinfe/semi-icons";
|
|
3209
|
+
|
|
3210
|
+
// src/components/assign-row/components/blur-input.tsx
|
|
3211
|
+
import React40, { useEffect as useEffect11, useState as useState11 } from "react";
|
|
3212
|
+
import Input7 from "@douyinfe/semi-ui/lib/es/input";
|
|
3213
|
+
function BlurInput3(props) {
|
|
3214
|
+
const [value, setValue] = useState11("");
|
|
3215
|
+
useEffect11(() => {
|
|
3216
|
+
setValue(props.value);
|
|
3217
|
+
}, [props.value]);
|
|
3218
|
+
return /* @__PURE__ */ React40.createElement(
|
|
3219
|
+
Input7,
|
|
3220
|
+
{
|
|
3221
|
+
...props,
|
|
3222
|
+
value,
|
|
3223
|
+
onChange: (value2) => {
|
|
3224
|
+
setValue(value2);
|
|
3225
|
+
},
|
|
3226
|
+
onBlur: (e) => props.onChange?.(value, e)
|
|
3227
|
+
}
|
|
3228
|
+
);
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
// src/components/assign-row/index.tsx
|
|
3232
|
+
function AssignRow(props) {
|
|
3233
|
+
const {
|
|
3234
|
+
value = {
|
|
3235
|
+
operator: "assign"
|
|
3236
|
+
},
|
|
3237
|
+
onChange,
|
|
3238
|
+
onDelete,
|
|
3239
|
+
readonly
|
|
3240
|
+
} = props;
|
|
3241
|
+
return /* @__PURE__ */ React41.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ React41.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ React41.createElement(
|
|
3242
|
+
VariableSelector,
|
|
3243
|
+
{
|
|
3244
|
+
style: { width: "100%", height: 26 },
|
|
3245
|
+
value: value?.left?.content,
|
|
3246
|
+
config: { placeholder: "Select Left" },
|
|
3247
|
+
onChange: (v) => onChange?.({
|
|
3248
|
+
...value,
|
|
3249
|
+
left: { type: "ref", content: v }
|
|
3250
|
+
})
|
|
3251
|
+
}
|
|
3252
|
+
) : /* @__PURE__ */ React41.createElement(
|
|
3253
|
+
BlurInput3,
|
|
3254
|
+
{
|
|
3255
|
+
style: { height: 26 },
|
|
3256
|
+
size: "small",
|
|
3257
|
+
placeholder: "Input Name",
|
|
3258
|
+
value: value?.left,
|
|
3259
|
+
onChange: (v) => onChange?.({
|
|
3260
|
+
...value,
|
|
3261
|
+
left: v
|
|
3262
|
+
})
|
|
3263
|
+
}
|
|
3264
|
+
)), /* @__PURE__ */ React41.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ React41.createElement(
|
|
3265
|
+
DynamicValueInput,
|
|
3266
|
+
{
|
|
3267
|
+
readonly,
|
|
3268
|
+
value: value?.right,
|
|
3269
|
+
onChange: (v) => onChange?.({
|
|
3270
|
+
...value,
|
|
3271
|
+
right: v
|
|
3272
|
+
})
|
|
3273
|
+
}
|
|
3274
|
+
)), onDelete && /* @__PURE__ */ React41.createElement("div", null, /* @__PURE__ */ React41.createElement(
|
|
3275
|
+
IconButton6,
|
|
3276
|
+
{
|
|
3277
|
+
size: "small",
|
|
3278
|
+
theme: "borderless",
|
|
3279
|
+
icon: /* @__PURE__ */ React41.createElement(IconMinus2, null),
|
|
3280
|
+
onClick: () => onDelete?.()
|
|
3281
|
+
}
|
|
3282
|
+
)));
|
|
3057
3283
|
}
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
});
|
|
3065
|
-
}
|
|
3066
|
-
return text;
|
|
3067
|
-
});
|
|
3068
|
-
function JsonEditorWithVariables(props) {
|
|
3069
|
-
return /* @__PURE__ */ React25.createElement(
|
|
3070
|
-
CodeEditor,
|
|
3284
|
+
|
|
3285
|
+
// src/components/assign-rows/index.tsx
|
|
3286
|
+
function AssignRows(props) {
|
|
3287
|
+
const { name, readonly } = props;
|
|
3288
|
+
return /* @__PURE__ */ React42.createElement(FieldArray, { name }, ({ field }) => /* @__PURE__ */ React42.createElement(React42.Fragment, null, field.map((childField, index) => /* @__PURE__ */ React42.createElement(
|
|
3289
|
+
AssignRow,
|
|
3071
3290
|
{
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3291
|
+
key: childField.key,
|
|
3292
|
+
readonly,
|
|
3293
|
+
value: childField.value,
|
|
3294
|
+
onChange: (value) => {
|
|
3295
|
+
childField.onChange(value);
|
|
3296
|
+
},
|
|
3297
|
+
onDelete: () => field.remove(index)
|
|
3298
|
+
}
|
|
3299
|
+
)), /* @__PURE__ */ React42.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ React42.createElement(
|
|
3300
|
+
Button5,
|
|
3301
|
+
{
|
|
3302
|
+
size: "small",
|
|
3303
|
+
theme: "borderless",
|
|
3304
|
+
icon: /* @__PURE__ */ React42.createElement(IconPlus4, null),
|
|
3305
|
+
onClick: () => field.append({ operator: "assign" })
|
|
3079
3306
|
},
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3307
|
+
"Assign"
|
|
3308
|
+
), /* @__PURE__ */ React42.createElement(
|
|
3309
|
+
Button5,
|
|
3310
|
+
{
|
|
3311
|
+
size: "small",
|
|
3312
|
+
theme: "borderless",
|
|
3313
|
+
icon: /* @__PURE__ */ React42.createElement(IconPlus4, null),
|
|
3314
|
+
onClick: () => field.append({ operator: "declare" })
|
|
3315
|
+
},
|
|
3316
|
+
"Declaration"
|
|
3317
|
+
))));
|
|
3083
3318
|
}
|
|
3084
3319
|
|
|
3085
3320
|
// src/effects/provide-batch-input/index.ts
|
|
3086
3321
|
import {
|
|
3087
|
-
ASTFactory
|
|
3322
|
+
ASTFactory,
|
|
3088
3323
|
createEffectFromVariableProvider,
|
|
3089
3324
|
getNodeForm
|
|
3090
3325
|
} from "@flowgram.ai/editor";
|
|
3091
3326
|
var provideBatchInputEffect = createEffectFromVariableProvider({
|
|
3092
3327
|
private: true,
|
|
3093
3328
|
parse: (value, ctx) => [
|
|
3094
|
-
|
|
3329
|
+
ASTFactory.createVariableDeclaration({
|
|
3095
3330
|
key: `${ctx.node.id}_locals`,
|
|
3096
3331
|
meta: {
|
|
3097
3332
|
title: getNodeForm(ctx.node)?.getValueIn("title"),
|
|
3098
3333
|
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3099
3334
|
},
|
|
3100
|
-
type:
|
|
3335
|
+
type: ASTFactory.createObject({
|
|
3101
3336
|
properties: [
|
|
3102
|
-
|
|
3337
|
+
ASTFactory.createProperty({
|
|
3103
3338
|
key: "item",
|
|
3104
|
-
initializer:
|
|
3105
|
-
enumerateFor:
|
|
3339
|
+
initializer: ASTFactory.createEnumerateExpression({
|
|
3340
|
+
enumerateFor: ASTFactory.createKeyPathExpression({
|
|
3106
3341
|
keyPath: value.content || []
|
|
3107
3342
|
})
|
|
3108
3343
|
})
|
|
3109
3344
|
}),
|
|
3110
|
-
|
|
3345
|
+
ASTFactory.createProperty({
|
|
3111
3346
|
key: "index",
|
|
3112
|
-
type:
|
|
3347
|
+
type: ASTFactory.createNumber()
|
|
3113
3348
|
})
|
|
3114
3349
|
]
|
|
3115
3350
|
})
|
|
@@ -3117,36 +3352,6 @@ var provideBatchInputEffect = createEffectFromVariableProvider({
|
|
|
3117
3352
|
]
|
|
3118
3353
|
});
|
|
3119
3354
|
|
|
3120
|
-
// src/effects/provide-batch-outputs/index.ts
|
|
3121
|
-
import {
|
|
3122
|
-
ASTFactory as ASTFactory3,
|
|
3123
|
-
createEffectFromVariableProvider as createEffectFromVariableProvider2,
|
|
3124
|
-
getNodeForm as getNodeForm2
|
|
3125
|
-
} from "@flowgram.ai/editor";
|
|
3126
|
-
var provideBatchOutputsEffect = createEffectFromVariableProvider2({
|
|
3127
|
-
parse: (value, ctx) => [
|
|
3128
|
-
ASTFactory3.createVariableDeclaration({
|
|
3129
|
-
key: `${ctx.node.id}`,
|
|
3130
|
-
meta: {
|
|
3131
|
-
title: getNodeForm2(ctx.node)?.getValueIn("title"),
|
|
3132
|
-
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3133
|
-
},
|
|
3134
|
-
type: ASTFactory3.createObject({
|
|
3135
|
-
properties: Object.entries(value).map(
|
|
3136
|
-
([_key, value2]) => ASTFactory3.createProperty({
|
|
3137
|
-
key: _key,
|
|
3138
|
-
initializer: ASTFactory3.createWrapArrayExpression({
|
|
3139
|
-
wrapFor: ASTFactory3.createKeyPathExpression({
|
|
3140
|
-
keyPath: value2.content || []
|
|
3141
|
-
})
|
|
3142
|
-
})
|
|
3143
|
-
})
|
|
3144
|
-
)
|
|
3145
|
-
})
|
|
3146
|
-
})
|
|
3147
|
-
]
|
|
3148
|
-
});
|
|
3149
|
-
|
|
3150
3355
|
// src/effects/auto-rename-ref/index.ts
|
|
3151
3356
|
import { isArray, isObject as isObject2, uniq } from "lodash";
|
|
3152
3357
|
import {
|
|
@@ -3242,20 +3447,21 @@ function traverseRef(name, value, cb) {
|
|
|
3242
3447
|
}
|
|
3243
3448
|
|
|
3244
3449
|
// src/effects/provide-json-schema-outputs/index.ts
|
|
3450
|
+
import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
|
|
3245
3451
|
import {
|
|
3246
|
-
ASTFactory as
|
|
3247
|
-
createEffectFromVariableProvider as
|
|
3248
|
-
getNodeForm as
|
|
3452
|
+
ASTFactory as ASTFactory2,
|
|
3453
|
+
createEffectFromVariableProvider as createEffectFromVariableProvider2,
|
|
3454
|
+
getNodeForm as getNodeForm2
|
|
3249
3455
|
} from "@flowgram.ai/editor";
|
|
3250
|
-
var provideJsonSchemaOutputs =
|
|
3456
|
+
var provideJsonSchemaOutputs = createEffectFromVariableProvider2({
|
|
3251
3457
|
parse: (value, ctx) => [
|
|
3252
|
-
|
|
3458
|
+
ASTFactory2.createVariableDeclaration({
|
|
3253
3459
|
key: `${ctx.node.id}`,
|
|
3254
3460
|
meta: {
|
|
3255
|
-
title:
|
|
3461
|
+
title: getNodeForm2(ctx.node)?.getValueIn("title") || ctx.node.id,
|
|
3256
3462
|
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3257
3463
|
},
|
|
3258
|
-
type:
|
|
3464
|
+
type: JsonSchemaUtils7.schemaToAST(value)
|
|
3259
3465
|
})
|
|
3260
3466
|
]
|
|
3261
3467
|
});
|
|
@@ -3272,6 +3478,7 @@ var syncVariableTitle = [
|
|
|
3272
3478
|
context.node.getData(FlowNodeVariableData).allScopes.forEach((_scope) => {
|
|
3273
3479
|
_scope.output.variables.forEach((_var) => {
|
|
3274
3480
|
_var.updateMeta({
|
|
3481
|
+
..._var.meta || {},
|
|
3275
3482
|
title: value || context.node.id,
|
|
3276
3483
|
icon: context.node.getNodeRegistry().info?.icon
|
|
3277
3484
|
});
|
|
@@ -3281,31 +3488,173 @@ var syncVariableTitle = [
|
|
|
3281
3488
|
}
|
|
3282
3489
|
];
|
|
3283
3490
|
|
|
3491
|
+
// src/effects/validate-when-variable-sync/index.ts
|
|
3492
|
+
import { isEmpty } from "lodash";
|
|
3493
|
+
import {
|
|
3494
|
+
DataEvent as DataEvent3,
|
|
3495
|
+
getNodeScope,
|
|
3496
|
+
getNodePrivateScope
|
|
3497
|
+
} from "@flowgram.ai/editor";
|
|
3498
|
+
var validateWhenVariableSync = ({
|
|
3499
|
+
scope
|
|
3500
|
+
} = {}) => [
|
|
3501
|
+
{
|
|
3502
|
+
event: DataEvent3.onValueInit,
|
|
3503
|
+
effect: ({ context, form }) => {
|
|
3504
|
+
const nodeScope = scope === "private" ? getNodePrivateScope(context.node) : getNodeScope(context.node);
|
|
3505
|
+
const disposable = nodeScope.available.onListOrAnyVarChange(() => {
|
|
3506
|
+
if (!isEmpty(form.state.errors)) {
|
|
3507
|
+
form.validate();
|
|
3508
|
+
}
|
|
3509
|
+
});
|
|
3510
|
+
return () => disposable.dispose();
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
];
|
|
3514
|
+
|
|
3515
|
+
// src/effects/listen-ref-value-change/index.ts
|
|
3516
|
+
import {
|
|
3517
|
+
DataEvent as DataEvent4,
|
|
3518
|
+
getNodeScope as getNodeScope2
|
|
3519
|
+
} from "@flowgram.ai/editor";
|
|
3520
|
+
var listenRefValueChange = (cb) => [
|
|
3521
|
+
{
|
|
3522
|
+
event: DataEvent4.onValueInitOrChange,
|
|
3523
|
+
effect: (params) => {
|
|
3524
|
+
const { context, value } = params;
|
|
3525
|
+
if (value?.type !== "ref") {
|
|
3526
|
+
return () => null;
|
|
3527
|
+
}
|
|
3528
|
+
const disposable = getNodeScope2(context.node).available.trackByKeyPath(
|
|
3529
|
+
value?.content || [],
|
|
3530
|
+
(v) => {
|
|
3531
|
+
cb({ ...params, variable: v });
|
|
3532
|
+
}
|
|
3533
|
+
);
|
|
3534
|
+
return () => {
|
|
3535
|
+
disposable.dispose();
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
];
|
|
3540
|
+
|
|
3541
|
+
// src/effects/listen-ref-schema-change/index.ts
|
|
3542
|
+
import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
|
|
3543
|
+
import {
|
|
3544
|
+
DataEvent as DataEvent5,
|
|
3545
|
+
getNodeScope as getNodeScope3
|
|
3546
|
+
} from "@flowgram.ai/editor";
|
|
3547
|
+
var listenRefSchemaChange = (cb) => [
|
|
3548
|
+
{
|
|
3549
|
+
event: DataEvent5.onValueInitOrChange,
|
|
3550
|
+
effect: (params) => {
|
|
3551
|
+
const { context, value } = params;
|
|
3552
|
+
if (value?.type !== "ref") {
|
|
3553
|
+
return () => null;
|
|
3554
|
+
}
|
|
3555
|
+
const disposable = getNodeScope3(context.node).available.trackByKeyPath(
|
|
3556
|
+
value?.content || [],
|
|
3557
|
+
(_type) => {
|
|
3558
|
+
cb({ ...params, schema: JsonSchemaUtils8.astToSchema(_type) });
|
|
3559
|
+
},
|
|
3560
|
+
{
|
|
3561
|
+
selector: (_v) => _v?.type
|
|
3562
|
+
}
|
|
3563
|
+
);
|
|
3564
|
+
return () => {
|
|
3565
|
+
disposable.dispose();
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
];
|
|
3570
|
+
|
|
3571
|
+
// src/shared/format-legacy-refs/index.ts
|
|
3572
|
+
import { isObject as isObject3 } from "lodash";
|
|
3573
|
+
function formatLegacyRefOnSubmit(value) {
|
|
3574
|
+
if (isObject3(value)) {
|
|
3575
|
+
if (isLegacyFlowRefValueSchema(value)) {
|
|
3576
|
+
return formatLegacyRefToNewRef(value);
|
|
3577
|
+
}
|
|
3578
|
+
return Object.fromEntries(
|
|
3579
|
+
Object.entries(value).map(([key, value2]) => [
|
|
3580
|
+
key,
|
|
3581
|
+
formatLegacyRefOnSubmit(value2)
|
|
3582
|
+
])
|
|
3583
|
+
);
|
|
3584
|
+
}
|
|
3585
|
+
if (Array.isArray(value)) {
|
|
3586
|
+
return value.map(formatLegacyRefOnSubmit);
|
|
3587
|
+
}
|
|
3588
|
+
return value;
|
|
3589
|
+
}
|
|
3590
|
+
function formatLegacyRefOnInit(value) {
|
|
3591
|
+
if (isObject3(value)) {
|
|
3592
|
+
if (isNewFlowRefValueSchema(value)) {
|
|
3593
|
+
return formatNewRefToLegacyRef(value);
|
|
3594
|
+
}
|
|
3595
|
+
return Object.fromEntries(
|
|
3596
|
+
Object.entries(value).map(([key, value2]) => [
|
|
3597
|
+
key,
|
|
3598
|
+
formatLegacyRefOnInit(value2)
|
|
3599
|
+
])
|
|
3600
|
+
);
|
|
3601
|
+
}
|
|
3602
|
+
if (Array.isArray(value)) {
|
|
3603
|
+
return value.map(formatLegacyRefOnInit);
|
|
3604
|
+
}
|
|
3605
|
+
return value;
|
|
3606
|
+
}
|
|
3607
|
+
function isLegacyFlowRefValueSchema(value) {
|
|
3608
|
+
return isObject3(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
|
|
3609
|
+
}
|
|
3610
|
+
function isNewFlowRefValueSchema(value) {
|
|
3611
|
+
return isObject3(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
|
|
3612
|
+
}
|
|
3613
|
+
function formatLegacyRefToNewRef(value) {
|
|
3614
|
+
const keyPath = value.content.split(".");
|
|
3615
|
+
if (keyPath[1] === "outputs") {
|
|
3616
|
+
return {
|
|
3617
|
+
type: "ref",
|
|
3618
|
+
content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
|
|
3619
|
+
};
|
|
3620
|
+
}
|
|
3621
|
+
return {
|
|
3622
|
+
type: "ref",
|
|
3623
|
+
content: keyPath
|
|
3624
|
+
};
|
|
3625
|
+
}
|
|
3626
|
+
function formatNewRefToLegacyRef(value) {
|
|
3627
|
+
return {
|
|
3628
|
+
type: "ref",
|
|
3629
|
+
content: value.content.join(".")
|
|
3630
|
+
};
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3284
3633
|
// src/form-plugins/batch-outputs-plugin/index.ts
|
|
3285
3634
|
import {
|
|
3286
|
-
ASTFactory as
|
|
3287
|
-
createEffectFromVariableProvider as
|
|
3635
|
+
ASTFactory as ASTFactory3,
|
|
3636
|
+
createEffectFromVariableProvider as createEffectFromVariableProvider3,
|
|
3288
3637
|
defineFormPluginCreator,
|
|
3289
|
-
getNodeForm as
|
|
3290
|
-
getNodePrivateScope,
|
|
3291
|
-
getNodeScope,
|
|
3638
|
+
getNodeForm as getNodeForm3,
|
|
3639
|
+
getNodePrivateScope as getNodePrivateScope2,
|
|
3640
|
+
getNodeScope as getNodeScope4,
|
|
3292
3641
|
ScopeChainTransformService,
|
|
3293
3642
|
FlowNodeScopeType
|
|
3294
3643
|
} from "@flowgram.ai/editor";
|
|
3295
|
-
var
|
|
3644
|
+
var provideBatchOutputsEffect = createEffectFromVariableProvider3({
|
|
3296
3645
|
parse: (value, ctx) => [
|
|
3297
|
-
|
|
3646
|
+
ASTFactory3.createVariableDeclaration({
|
|
3298
3647
|
key: `${ctx.node.id}`,
|
|
3299
3648
|
meta: {
|
|
3300
|
-
title:
|
|
3649
|
+
title: getNodeForm3(ctx.node)?.getValueIn("title"),
|
|
3301
3650
|
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3302
3651
|
},
|
|
3303
|
-
type:
|
|
3652
|
+
type: ASTFactory3.createObject({
|
|
3304
3653
|
properties: Object.entries(value).map(
|
|
3305
|
-
([_key, value2]) =>
|
|
3654
|
+
([_key, value2]) => ASTFactory3.createProperty({
|
|
3306
3655
|
key: _key,
|
|
3307
|
-
initializer:
|
|
3308
|
-
wrapFor:
|
|
3656
|
+
initializer: ASTFactory3.createWrapArrayExpression({
|
|
3657
|
+
wrapFor: ASTFactory3.createKeyPathExpression({
|
|
3309
3658
|
keyPath: value2?.content || []
|
|
3310
3659
|
})
|
|
3311
3660
|
})
|
|
@@ -3319,7 +3668,7 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
|
|
|
3319
3668
|
name: "batch-outputs-plugin",
|
|
3320
3669
|
onSetupFormMeta({ mergeEffect }, { outputKey }) {
|
|
3321
3670
|
mergeEffect({
|
|
3322
|
-
[outputKey]:
|
|
3671
|
+
[outputKey]: provideBatchOutputsEffect
|
|
3323
3672
|
});
|
|
3324
3673
|
},
|
|
3325
3674
|
onInit(ctx, { outputKey }) {
|
|
@@ -3333,7 +3682,7 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
|
|
|
3333
3682
|
transformCovers: (covers, ctx2) => {
|
|
3334
3683
|
const node = ctx2.scope.meta?.node;
|
|
3335
3684
|
if (node?.parent?.flowNodeType === batchNodeType) {
|
|
3336
|
-
return [...covers,
|
|
3685
|
+
return [...covers, getNodeScope4(node.parent)];
|
|
3337
3686
|
}
|
|
3338
3687
|
return covers;
|
|
3339
3688
|
},
|
|
@@ -3346,8 +3695,8 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
|
|
|
3346
3695
|
if (node?.flowNodeType === batchNodeType) {
|
|
3347
3696
|
const childBlocks = node.blocks;
|
|
3348
3697
|
return [
|
|
3349
|
-
|
|
3350
|
-
...childBlocks.map((_childBlock) =>
|
|
3698
|
+
getNodePrivateScope2(node),
|
|
3699
|
+
...childBlocks.map((_childBlock) => getNodeScope4(_childBlock))
|
|
3351
3700
|
];
|
|
3352
3701
|
}
|
|
3353
3702
|
return scopes;
|
|
@@ -3355,38 +3704,235 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
|
|
|
3355
3704
|
});
|
|
3356
3705
|
}
|
|
3357
3706
|
});
|
|
3707
|
+
|
|
3708
|
+
// src/form-plugins/infer-inputs-plugin/index.ts
|
|
3709
|
+
import { get as get2, set as set2 } from "lodash";
|
|
3710
|
+
import { JsonSchemaUtils as JsonSchemaUtils9 } from "@flowgram.ai/json-schema";
|
|
3711
|
+
import {
|
|
3712
|
+
defineFormPluginCreator as defineFormPluginCreator2,
|
|
3713
|
+
getNodePrivateScope as getNodePrivateScope3,
|
|
3714
|
+
getNodeScope as getNodeScope5
|
|
3715
|
+
} from "@flowgram.ai/editor";
|
|
3716
|
+
var createInferInputsPlugin = defineFormPluginCreator2({
|
|
3717
|
+
onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
|
|
3718
|
+
if (!sourceKey || !targetKey) {
|
|
3719
|
+
return;
|
|
3720
|
+
}
|
|
3721
|
+
addFormatOnSubmit((formData, ctx) => {
|
|
3722
|
+
set2(
|
|
3723
|
+
formData,
|
|
3724
|
+
targetKey,
|
|
3725
|
+
infer(
|
|
3726
|
+
get2(formData, sourceKey),
|
|
3727
|
+
scope === "private" ? getNodePrivateScope3(ctx.node) : getNodeScope5(ctx.node)
|
|
3728
|
+
)
|
|
3729
|
+
);
|
|
3730
|
+
return formData;
|
|
3731
|
+
});
|
|
3732
|
+
}
|
|
3733
|
+
});
|
|
3734
|
+
function isRef2(value) {
|
|
3735
|
+
return value?.type === "ref" && Array.isArray(value?.content) && typeof value?.content[0] === "string";
|
|
3736
|
+
}
|
|
3737
|
+
function isTemplate2(value) {
|
|
3738
|
+
return value?.type === "template" && typeof value?.content === "string";
|
|
3739
|
+
}
|
|
3740
|
+
function isConstant(value) {
|
|
3741
|
+
return value?.type === "constant" && typeof value?.content !== "undefined";
|
|
3742
|
+
}
|
|
3743
|
+
var infer = (values, scope) => {
|
|
3744
|
+
if (typeof values === "object") {
|
|
3745
|
+
if (isConstant(values)) {
|
|
3746
|
+
if (values?.schema) {
|
|
3747
|
+
return values.schema;
|
|
3748
|
+
}
|
|
3749
|
+
if (typeof values.content === "string") {
|
|
3750
|
+
return {
|
|
3751
|
+
type: "string"
|
|
3752
|
+
};
|
|
3753
|
+
}
|
|
3754
|
+
if (typeof values.content === "number") {
|
|
3755
|
+
return {
|
|
3756
|
+
type: "number"
|
|
3757
|
+
};
|
|
3758
|
+
}
|
|
3759
|
+
if (typeof values.content === "boolean") {
|
|
3760
|
+
return {
|
|
3761
|
+
type: "boolean"
|
|
3762
|
+
};
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
if (isRef2(values)) {
|
|
3766
|
+
const variable = scope.available.getByKeyPath(values?.content);
|
|
3767
|
+
const schema = variable?.type ? JsonSchemaUtils9.astToSchema(variable?.type) : void 0;
|
|
3768
|
+
return schema;
|
|
3769
|
+
}
|
|
3770
|
+
if (isTemplate2(values)) {
|
|
3771
|
+
return {
|
|
3772
|
+
type: "string"
|
|
3773
|
+
};
|
|
3774
|
+
}
|
|
3775
|
+
return {
|
|
3776
|
+
type: "object",
|
|
3777
|
+
properties: Object.keys(values).reduce((acc, key) => {
|
|
3778
|
+
const schema = infer(values[key], scope);
|
|
3779
|
+
if (schema) {
|
|
3780
|
+
acc[key] = schema;
|
|
3781
|
+
}
|
|
3782
|
+
return acc;
|
|
3783
|
+
}, {})
|
|
3784
|
+
};
|
|
3785
|
+
}
|
|
3786
|
+
};
|
|
3787
|
+
|
|
3788
|
+
// src/form-plugins/infer-assign-plugin/index.ts
|
|
3789
|
+
import { set as set3, uniqBy } from "lodash";
|
|
3790
|
+
import { JsonSchemaUtils as JsonSchemaUtils10 } from "@flowgram.ai/json-schema";
|
|
3791
|
+
import {
|
|
3792
|
+
ASTFactory as ASTFactory4,
|
|
3793
|
+
createEffectFromVariableProvider as createEffectFromVariableProvider4,
|
|
3794
|
+
defineFormPluginCreator as defineFormPluginCreator3,
|
|
3795
|
+
getNodeForm as getNodeForm4,
|
|
3796
|
+
getNodeScope as getNodeScope6
|
|
3797
|
+
} from "@flowgram.ai/editor";
|
|
3798
|
+
var createInferAssignPlugin = defineFormPluginCreator3({
|
|
3799
|
+
onSetupFormMeta({ addFormatOnSubmit, mergeEffect }, { assignKey, outputKey }) {
|
|
3800
|
+
if (!assignKey || !outputKey) {
|
|
3801
|
+
return;
|
|
3802
|
+
}
|
|
3803
|
+
mergeEffect({
|
|
3804
|
+
[assignKey]: createEffectFromVariableProvider4({
|
|
3805
|
+
parse: (value, ctx) => {
|
|
3806
|
+
const declareRows = uniqBy(
|
|
3807
|
+
value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
|
|
3808
|
+
"left"
|
|
3809
|
+
);
|
|
3810
|
+
return [
|
|
3811
|
+
ASTFactory4.createVariableDeclaration({
|
|
3812
|
+
key: `${ctx.node.id}`,
|
|
3813
|
+
meta: {
|
|
3814
|
+
title: getNodeForm4(ctx.node)?.getValueIn("title"),
|
|
3815
|
+
icon: ctx.node.getNodeRegistry().info?.icon
|
|
3816
|
+
},
|
|
3817
|
+
type: ASTFactory4.createObject({
|
|
3818
|
+
properties: declareRows.map(
|
|
3819
|
+
(_v) => ASTFactory4.createProperty({
|
|
3820
|
+
key: _v.left,
|
|
3821
|
+
type: _v.right?.type === "constant" ? JsonSchemaUtils10.schemaToAST(_v.right?.schema || {}) : void 0,
|
|
3822
|
+
initializer: _v.right?.type === "ref" ? ASTFactory4.createKeyPathExpression({
|
|
3823
|
+
keyPath: _v.right?.content || []
|
|
3824
|
+
}) : {}
|
|
3825
|
+
})
|
|
3826
|
+
)
|
|
3827
|
+
})
|
|
3828
|
+
})
|
|
3829
|
+
];
|
|
3830
|
+
}
|
|
3831
|
+
})
|
|
3832
|
+
});
|
|
3833
|
+
addFormatOnSubmit((formData, ctx) => {
|
|
3834
|
+
set3(
|
|
3835
|
+
formData,
|
|
3836
|
+
outputKey,
|
|
3837
|
+
JsonSchemaUtils10.astToSchema(getNodeScope6(ctx.node).output.variables?.[0]?.type)
|
|
3838
|
+
);
|
|
3839
|
+
return formData;
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
|
|
3844
|
+
// src/validate/validate-flow-value/index.tsx
|
|
3845
|
+
import { isNil, uniq as uniq2 } from "lodash";
|
|
3846
|
+
import { FeedbackLevel, getNodeScope as getNodeScope7 } from "@flowgram.ai/editor";
|
|
3847
|
+
function validateFlowValue(value, ctx) {
|
|
3848
|
+
const { node, required, errorMessages } = ctx;
|
|
3849
|
+
const {
|
|
3850
|
+
required: requiredMessage = "Field is required",
|
|
3851
|
+
unknownVariable: unknownVariableMessage = "Unknown Variable"
|
|
3852
|
+
} = errorMessages || {};
|
|
3853
|
+
if (required && (isNil(value) || isNil(value?.content) || value?.content === "")) {
|
|
3854
|
+
return {
|
|
3855
|
+
level: FeedbackLevel.Error,
|
|
3856
|
+
message: requiredMessage
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
if (value?.type === "ref") {
|
|
3860
|
+
const variable = getNodeScope7(node).available.getByKeyPath(value?.content || []);
|
|
3861
|
+
if (!variable) {
|
|
3862
|
+
return {
|
|
3863
|
+
level: FeedbackLevel.Error,
|
|
3864
|
+
message: unknownVariableMessage
|
|
3865
|
+
};
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
if (value?.type === "template") {
|
|
3869
|
+
const allRefs = getTemplateKeyPaths2(value);
|
|
3870
|
+
for (const ref of allRefs) {
|
|
3871
|
+
const variable = getNodeScope7(node).available.getByKeyPath(ref);
|
|
3872
|
+
if (!variable) {
|
|
3873
|
+
return {
|
|
3874
|
+
level: FeedbackLevel.Error,
|
|
3875
|
+
message: unknownVariableMessage
|
|
3876
|
+
};
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
return void 0;
|
|
3881
|
+
}
|
|
3882
|
+
function getTemplateKeyPaths2(value) {
|
|
3883
|
+
const keyPathReg = /{{(.*?)}}/g;
|
|
3884
|
+
return uniq2(value.content?.match(keyPathReg) || []).map(
|
|
3885
|
+
(_keyPath) => _keyPath.slice(2, -2).split(".")
|
|
3886
|
+
);
|
|
3887
|
+
}
|
|
3358
3888
|
export {
|
|
3359
|
-
|
|
3889
|
+
AssignRow,
|
|
3890
|
+
AssignRows,
|
|
3360
3891
|
BatchOutputs,
|
|
3361
3892
|
BatchVariableSelector,
|
|
3362
3893
|
CodeEditor,
|
|
3894
|
+
CodeEditorMini,
|
|
3363
3895
|
ConditionRow,
|
|
3364
3896
|
ConstantInput,
|
|
3897
|
+
DisplayFlowValue,
|
|
3898
|
+
DisplayInputsValues,
|
|
3899
|
+
DisplayOutputs,
|
|
3900
|
+
DisplaySchemaTag,
|
|
3901
|
+
DisplaySchemaTree,
|
|
3365
3902
|
DynamicValueInput,
|
|
3903
|
+
InputsValues,
|
|
3366
3904
|
JsonEditorWithVariables,
|
|
3367
3905
|
JsonSchemaEditor,
|
|
3906
|
+
JsonSchemaTypePresetProvider,
|
|
3368
3907
|
JsonSchemaUtils,
|
|
3369
3908
|
PromptEditor,
|
|
3370
3909
|
PromptEditorWithInputs,
|
|
3371
3910
|
PromptEditorWithVariables,
|
|
3372
3911
|
TypeSelector,
|
|
3373
3912
|
VariableSelector,
|
|
3374
|
-
VariableTypeIcons,
|
|
3375
3913
|
autoRenameRefEffect,
|
|
3376
3914
|
createBatchOutputsFormPlugin,
|
|
3915
|
+
createDisableDeclarationPlugin,
|
|
3916
|
+
createInferAssignPlugin,
|
|
3917
|
+
createInferInputsPlugin,
|
|
3918
|
+
createTypePresetPlugin,
|
|
3377
3919
|
formatLegacyRefOnInit,
|
|
3378
3920
|
formatLegacyRefOnSubmit,
|
|
3379
3921
|
formatLegacyRefToNewRef,
|
|
3380
3922
|
formatNewRefToLegacyRef,
|
|
3381
|
-
getSchemaIcon,
|
|
3382
3923
|
getTypeSelectValue,
|
|
3383
3924
|
isLegacyFlowRefValueSchema,
|
|
3384
3925
|
isNewFlowRefValueSchema,
|
|
3926
|
+
listenRefSchemaChange,
|
|
3927
|
+
listenRefValueChange,
|
|
3385
3928
|
parseTypeSelectValue,
|
|
3386
3929
|
provideBatchInputEffect,
|
|
3387
3930
|
provideBatchOutputsEffect,
|
|
3388
3931
|
provideJsonSchemaOutputs,
|
|
3389
3932
|
syncVariableTitle,
|
|
3390
|
-
|
|
3933
|
+
useTypeManager,
|
|
3934
|
+
useVariableTree,
|
|
3935
|
+
validateFlowValue,
|
|
3936
|
+
validateWhenVariableSync
|
|
3391
3937
|
};
|
|
3392
3938
|
//# sourceMappingURL=index.js.map
|