@flowgram.ai/editor 0.1.0-alpha.3 → 0.1.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +76 -76
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +99 -27
- package/dist/index.d.ts +99 -27
- package/dist/index.js +90 -91
- package/dist/index.js.map +1 -1
- package/package.json +28 -29
package/dist/index.d.ts
CHANGED
|
@@ -1,74 +1,93 @@
|
|
|
1
|
+
import { NodeFormProps } from '@flowgram.ai/node';
|
|
1
2
|
export * from '@flowgram.ai/node';
|
|
2
3
|
export { FormModelV2 as FormModel } from '@flowgram.ai/node';
|
|
3
4
|
export * from '@flowgram.ai/utils';
|
|
4
5
|
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
5
|
-
import { PluginContext, Plugin, PluginsProvider,
|
|
6
|
+
import { PluginContext, Plugin, PluginsProvider, Playground, PlaygroundConfigRevealOpts } from '@flowgram.ai/core';
|
|
6
7
|
export * from '@flowgram.ai/core';
|
|
7
8
|
export { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';
|
|
8
|
-
import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON
|
|
9
|
+
import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON } from '@flowgram.ai/document';
|
|
9
10
|
export * from '@flowgram.ai/document';
|
|
10
11
|
export * from '@flowgram.ai/renderer';
|
|
11
|
-
import { VariablePluginOptions } from '@flowgram.ai/variable-plugin';
|
|
12
|
+
import { FlowNodeScope, VariablePluginOptions } from '@flowgram.ai/variable-plugin';
|
|
12
13
|
export * from '@flowgram.ai/variable-plugin';
|
|
13
14
|
export * from '@flowgram.ai/shortcuts-plugin';
|
|
14
15
|
import { NodeCorePluginOptions } from '@flowgram.ai/node-core-plugin';
|
|
15
16
|
export * from '@flowgram.ai/node-core-plugin';
|
|
16
17
|
import { I18nPluginOptions } from '@flowgram.ai/i18n-plugin';
|
|
17
18
|
export * from '@flowgram.ai/i18n-plugin';
|
|
19
|
+
export { ReactiveBaseState, ReactiveState, Tracker, observe, useObserve, useReactiveState, useReadonlyReactiveState } from '@flowgram.ai/reactive';
|
|
20
|
+
export { AsyncContainerModule, Container, ContainerModule, inject, injectable, interfaces, multiInject, named, postConstruct } from 'inversify';
|
|
18
21
|
import { FormMetaOrFormMetaGenerator, FormItem, FormModel } from '@flowgram.ai/form-core';
|
|
19
22
|
export { FlowNodeFormData, NodeRender, NodeRenderProps } from '@flowgram.ai/form-core';
|
|
20
|
-
export { Errors, Field, FieldArray, FieldArrayRenderProps, FieldError, FieldName, FieldRenderProps, FieldState, FieldWarning, Form, FormControl, FormRenderProps, FormState, IField, IFieldArray, IForm, Validate, ValidateTrigger, Warnings, useCurrentField, useCurrentFieldState, useField, useFieldValidate, useForm, useWatch } from '@flowgram.ai/form';
|
|
23
|
+
export { Errors, FeedbackLevel, Field, FieldArray, FieldArrayRenderProps, FieldError, FieldName, FieldRenderProps, FieldState, FieldWarning, Form, FormControl, FormRenderProps, FormState, IField, IFieldArray, IForm, Validate, ValidateTrigger, Warnings, useCurrentField, useCurrentFieldState, useField, useFieldValidate, useForm, useWatch } from '@flowgram.ai/form';
|
|
21
24
|
import { ReduxDevToolPluginOptions } from '@flowgram.ai/redux-devtool-plugin';
|
|
22
25
|
import { SelectionService, PlaygroundReactProps } from '@flowgram.ai/playground-react';
|
|
26
|
+
export { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';
|
|
23
27
|
import { MaterialsPluginOptions } from '@flowgram.ai/materials-plugin';
|
|
24
28
|
import { HistoryPluginOptions } from '@flowgram.ai/history';
|
|
25
29
|
import * as React from 'react';
|
|
26
30
|
import React__default from 'react';
|
|
27
31
|
export * from '@flowgram.ai/node-variable-plugin';
|
|
28
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
35
|
+
* SPDX-License-Identifier: MIT
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
declare module '@flowgram.ai/document' {
|
|
39
|
+
interface FlowNodeEntity {
|
|
40
|
+
form: NodeFormProps<any> | undefined;
|
|
41
|
+
scope: FlowNodeScope | undefined;
|
|
42
|
+
privateScope: FlowNodeScope | undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
29
45
|
interface EditorPluginContext extends PluginContext {
|
|
30
46
|
document: FlowDocument;
|
|
31
47
|
selection: SelectionService;
|
|
32
48
|
}
|
|
33
|
-
/**
|
|
34
|
-
* 固定布局配置
|
|
35
|
-
*/
|
|
36
49
|
interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
|
|
37
50
|
/**
|
|
51
|
+
* Initialize data
|
|
38
52
|
* 初始化数据
|
|
39
53
|
*/
|
|
40
54
|
initialData?: JSON;
|
|
41
55
|
/**
|
|
56
|
+
* whether it is readonly
|
|
42
57
|
* 是否为 readonly
|
|
43
58
|
*/
|
|
44
59
|
readonly?: boolean;
|
|
45
60
|
/**
|
|
61
|
+
* node registries
|
|
46
62
|
* 节点定义
|
|
47
63
|
*/
|
|
48
64
|
nodeRegistries?: FlowNodeRegistry[];
|
|
49
65
|
/**
|
|
50
|
-
*
|
|
66
|
+
* Get the default node registry, which will be merged with the 'nodeRegistries'
|
|
67
|
+
* 提供默认的节点注册,这个会和 nodeRegistries 做合并
|
|
51
68
|
*/
|
|
52
69
|
getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
|
|
53
70
|
/**
|
|
54
|
-
*
|
|
71
|
+
* Node engine configuration
|
|
55
72
|
*/
|
|
56
73
|
nodeEngine?: NodeCorePluginOptions & {
|
|
57
74
|
/**
|
|
58
|
-
*
|
|
75
|
+
* Default formMeta
|
|
59
76
|
*/
|
|
60
77
|
createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
|
|
61
78
|
/**
|
|
62
|
-
*
|
|
79
|
+
* Enable node engine
|
|
63
80
|
*/
|
|
64
81
|
enable?: boolean;
|
|
65
82
|
};
|
|
66
83
|
/**
|
|
84
|
+
* By default, all nodes are expanded
|
|
67
85
|
* 默认是否展开所有节点
|
|
68
86
|
*/
|
|
69
87
|
allNodesDefaultExpanded?: boolean;
|
|
70
88
|
/**
|
|
71
|
-
*
|
|
89
|
+
* Canvas material, Used to customize react components
|
|
90
|
+
* 画布物料, 用于自定义 react 组件
|
|
72
91
|
*/
|
|
73
92
|
materials?: MaterialsPluginOptions;
|
|
74
93
|
/**
|
|
@@ -78,41 +97,50 @@ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSO
|
|
|
78
97
|
onLoad?: (ctx: CTX) => void;
|
|
79
98
|
/**
|
|
80
99
|
* 是否开启变量引擎
|
|
100
|
+
* Variable engine enable
|
|
81
101
|
*/
|
|
82
102
|
variableEngine?: VariablePluginOptions;
|
|
83
103
|
/**
|
|
84
|
-
*
|
|
104
|
+
* Redo/Undo enable
|
|
85
105
|
*/
|
|
86
106
|
history?: HistoryPluginOptions<CTX> & {
|
|
87
107
|
disableShortcuts?: boolean;
|
|
88
108
|
};
|
|
89
109
|
/**
|
|
90
|
-
* redux
|
|
110
|
+
* redux devtool configuration
|
|
91
111
|
*/
|
|
92
112
|
reduxDevTool?: ReduxDevToolPluginOptions;
|
|
113
|
+
/**
|
|
114
|
+
* Scroll configuration
|
|
115
|
+
* 滚动配置
|
|
116
|
+
*/
|
|
93
117
|
scroll?: {
|
|
94
|
-
|
|
118
|
+
enableScrollLimit?: boolean;
|
|
95
119
|
disableScrollBar?: boolean;
|
|
120
|
+
disableScroll?: boolean;
|
|
96
121
|
};
|
|
97
122
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): void;
|
|
103
|
-
/**
|
|
104
|
-
* 画布内部常量自定义
|
|
123
|
+
* Node data transformation, called by ctx.document.fromJSON
|
|
124
|
+
* 节点数据转换, 由 ctx.document.fromJSON 调用
|
|
125
|
+
* @param node - current node
|
|
126
|
+
* @param json - Current node json data
|
|
105
127
|
*/
|
|
106
|
-
|
|
128
|
+
toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;
|
|
107
129
|
/**
|
|
108
|
-
*
|
|
130
|
+
* Node data transformation, called by ctx.document.toJSON
|
|
131
|
+
* 节点数据转换, 由 ctx.document.toJSON 调用
|
|
132
|
+
* @param node - current node
|
|
133
|
+
* @param json - Current node json data
|
|
134
|
+
* @param isFirstCreate - Whether it is created for the first time, If document.fromJSON is recalled, but the node already exists, isFirstCreate is false
|
|
109
135
|
*/
|
|
110
|
-
|
|
136
|
+
fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;
|
|
111
137
|
/**
|
|
112
|
-
*
|
|
138
|
+
* Canvas internal constant customization
|
|
139
|
+
* 画布内部常量自定义
|
|
113
140
|
*/
|
|
114
|
-
|
|
141
|
+
constants?: Record<string, any>;
|
|
115
142
|
/**
|
|
143
|
+
* i18n
|
|
116
144
|
* 国际化
|
|
117
145
|
*/
|
|
118
146
|
i18n?: I18nPluginOptions;
|
|
@@ -124,10 +152,25 @@ declare namespace EditorProps {
|
|
|
124
152
|
const DEFAULT: EditorProps;
|
|
125
153
|
}
|
|
126
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
157
|
+
* SPDX-License-Identifier: MIT
|
|
158
|
+
*/
|
|
159
|
+
|
|
127
160
|
declare function createDefaultPreset<CTX extends EditorPluginContext = EditorPluginContext>(opts: EditorProps<CTX>, plugins?: Plugin[]): PluginsProvider<CTX>;
|
|
128
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
164
|
+
* SPDX-License-Identifier: MIT
|
|
165
|
+
*/
|
|
166
|
+
|
|
129
167
|
declare const EditorProvider: React__default.FC<EditorProps>;
|
|
130
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
171
|
+
* SPDX-License-Identifier: MIT
|
|
172
|
+
*/
|
|
173
|
+
|
|
131
174
|
/**
|
|
132
175
|
* 画布编辑器
|
|
133
176
|
* @param props
|
|
@@ -135,6 +178,11 @@ declare const EditorProvider: React__default.FC<EditorProps>;
|
|
|
135
178
|
*/
|
|
136
179
|
declare const Editor: React__default.FC<EditorProps>;
|
|
137
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
183
|
+
* SPDX-License-Identifier: MIT
|
|
184
|
+
*/
|
|
185
|
+
|
|
138
186
|
interface HighLightOptions {
|
|
139
187
|
padding?: number;
|
|
140
188
|
overlayClassName?: string;
|
|
@@ -147,6 +195,11 @@ interface HighlightProps {
|
|
|
147
195
|
}
|
|
148
196
|
declare function useHighlight(props: HighlightProps): React.MutableRefObject<any> | null;
|
|
149
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
200
|
+
* SPDX-License-Identifier: MIT
|
|
201
|
+
*/
|
|
202
|
+
|
|
150
203
|
type FocusNodeCanvasOptions = PlaygroundConfigRevealOpts;
|
|
151
204
|
interface FocusNodeFormItemOptions {
|
|
152
205
|
canvas?: FocusNodeCanvasOptions;
|
|
@@ -160,10 +213,20 @@ declare class NodeFocusService {
|
|
|
160
213
|
focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): Promise<void>;
|
|
161
214
|
}
|
|
162
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
218
|
+
* SPDX-License-Identifier: MIT
|
|
219
|
+
*/
|
|
220
|
+
|
|
163
221
|
declare class NodeClient {
|
|
164
222
|
nodeFocusService: NodeFocusService;
|
|
165
223
|
}
|
|
166
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
227
|
+
* SPDX-License-Identifier: MIT
|
|
228
|
+
*/
|
|
229
|
+
|
|
167
230
|
interface FocusNodeOptions {
|
|
168
231
|
zoom?: PlaygroundConfigRevealOpts['zoom'];
|
|
169
232
|
easing?: PlaygroundConfigRevealOpts['easing'];
|
|
@@ -177,9 +240,18 @@ declare class FlowEditorClient {
|
|
|
177
240
|
focusNode(node: FlowNodeEntity, options?: FocusNodeOptions): void;
|
|
178
241
|
}
|
|
179
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
245
|
+
* SPDX-License-Identifier: MIT
|
|
246
|
+
*/
|
|
180
247
|
declare const createFlowEditorClientPlugin: _flowgram_ai_core.PluginCreator<{}>;
|
|
181
248
|
declare const createFlowEditorClientPlugins: () => _flowgram_ai_core.Plugin<{}>[];
|
|
182
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
252
|
+
* SPDX-License-Identifier: MIT
|
|
253
|
+
*/
|
|
254
|
+
|
|
183
255
|
declare function useFlowEditor(): FlowEditorClient;
|
|
184
256
|
|
|
185
257
|
export { Editor, type EditorPluginContext, EditorProps, EditorProvider, FlowEditorClient, type FocusNodeCanvasOptions, type FocusNodeFormItemOptions, type HighLightOptions, NodeClient, NodeFocusService, createDefaultPreset, createFlowEditorClientPlugin, createFlowEditorClientPlugins, highlightFormItem, useFlowEditor, useHighlight };
|
package/dist/index.js
CHANGED
|
@@ -37,26 +37,40 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
// src/index.ts
|
|
40
|
-
var
|
|
41
|
-
__export(
|
|
40
|
+
var index_exports = {};
|
|
41
|
+
__export(index_exports, {
|
|
42
|
+
AsyncContainerModule: () => import_inversify4.AsyncContainerModule,
|
|
43
|
+
Container: () => import_inversify4.Container,
|
|
44
|
+
ContainerModule: () => import_inversify4.ContainerModule,
|
|
42
45
|
Editor: () => Editor,
|
|
43
46
|
EditorProps: () => EditorProps,
|
|
44
47
|
EditorProvider: () => EditorProvider,
|
|
45
48
|
EditorRenderer: () => import_core8.PlaygroundReactRenderer,
|
|
49
|
+
FeedbackLevel: () => import_form.FeedbackLevel,
|
|
46
50
|
Field: () => import_form.Field,
|
|
47
51
|
FieldArray: () => import_form.FieldArray,
|
|
48
52
|
FlowEditorClient: () => FlowEditorClient,
|
|
49
|
-
FlowNodeFormData: () =>
|
|
53
|
+
FlowNodeFormData: () => import_form_core.FlowNodeFormData,
|
|
50
54
|
Form: () => import_form.Form,
|
|
51
|
-
FormModel: () =>
|
|
55
|
+
FormModel: () => import_node2.FormModelV2,
|
|
52
56
|
NodeClient: () => NodeClient,
|
|
53
57
|
NodeFocusService: () => NodeFocusService,
|
|
54
|
-
NodeRender: () =>
|
|
58
|
+
NodeRender: () => import_form_core.NodeRender,
|
|
59
|
+
ReactiveBaseState: () => import_reactive.ReactiveBaseState,
|
|
60
|
+
ReactiveState: () => import_reactive.ReactiveState,
|
|
61
|
+
Tracker: () => import_reactive.Tracker,
|
|
55
62
|
ValidateTrigger: () => import_form.ValidateTrigger,
|
|
56
63
|
createDefaultPreset: () => createDefaultPreset,
|
|
57
64
|
createFlowEditorClientPlugin: () => createFlowEditorClientPlugin,
|
|
58
65
|
createFlowEditorClientPlugins: () => createFlowEditorClientPlugins,
|
|
66
|
+
createPlaygroundReactPreset: () => import_playground_react.createPlaygroundReactPreset,
|
|
59
67
|
highlightFormItem: () => highlightFormItem,
|
|
68
|
+
inject: () => import_inversify4.inject,
|
|
69
|
+
injectable: () => import_inversify4.injectable,
|
|
70
|
+
multiInject: () => import_inversify4.multiInject,
|
|
71
|
+
named: () => import_inversify4.named,
|
|
72
|
+
observe: () => import_reactive.observe,
|
|
73
|
+
postConstruct: () => import_inversify4.postConstruct,
|
|
60
74
|
useCurrentField: () => import_form.useCurrentField,
|
|
61
75
|
useCurrentFieldState: () => import_form.useCurrentFieldState,
|
|
62
76
|
useField: () => import_form.useField,
|
|
@@ -64,99 +78,49 @@ __export(src_exports, {
|
|
|
64
78
|
useFlowEditor: () => useFlowEditor,
|
|
65
79
|
useForm: () => import_form.useForm,
|
|
66
80
|
useHighlight: () => useHighlight,
|
|
81
|
+
useObserve: () => import_reactive.useObserve,
|
|
82
|
+
useReactiveState: () => import_reactive.useReactiveState,
|
|
83
|
+
useReadonlyReactiveState: () => import_reactive.useReadonlyReactiveState,
|
|
67
84
|
useWatch: () => import_form.useWatch
|
|
68
85
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
86
|
+
module.exports = __toCommonJS(index_exports);
|
|
70
87
|
var import_reflect_metadata = require("reflect-metadata");
|
|
71
|
-
var
|
|
72
|
-
__reExport(
|
|
73
|
-
__reExport(
|
|
74
|
-
__reExport(
|
|
75
|
-
__reExport(
|
|
76
|
-
__reExport(
|
|
77
|
-
__reExport(
|
|
78
|
-
__reExport(
|
|
79
|
-
__reExport(
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
__reExport(src_exports, require("@flowgram.ai/node"), module.exports);
|
|
83
|
-
|
|
84
|
-
// src/preset/editor-props.ts
|
|
88
|
+
var import_node2 = require("@flowgram.ai/node");
|
|
89
|
+
__reExport(index_exports, require("@flowgram.ai/utils"), module.exports);
|
|
90
|
+
__reExport(index_exports, require("@flowgram.ai/core"), module.exports);
|
|
91
|
+
__reExport(index_exports, require("@flowgram.ai/document"), module.exports);
|
|
92
|
+
__reExport(index_exports, require("@flowgram.ai/renderer"), module.exports);
|
|
93
|
+
__reExport(index_exports, require("@flowgram.ai/variable-plugin"), module.exports);
|
|
94
|
+
__reExport(index_exports, require("@flowgram.ai/shortcuts-plugin"), module.exports);
|
|
95
|
+
__reExport(index_exports, require("@flowgram.ai/node-core-plugin"), module.exports);
|
|
96
|
+
__reExport(index_exports, require("@flowgram.ai/i18n-plugin"), module.exports);
|
|
97
|
+
var import_reactive = require("@flowgram.ai/reactive");
|
|
98
|
+
var import_inversify4 = require("inversify");
|
|
85
99
|
var import_form_core = require("@flowgram.ai/form-core");
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var EditorOptions = Symbol("EditorOptions");
|
|
100
|
+
var import_form = require("@flowgram.ai/form");
|
|
101
|
+
__reExport(index_exports, require("@flowgram.ai/node"), module.exports);
|
|
89
102
|
|
|
90
103
|
// src/preset/editor-props.ts
|
|
91
104
|
var EditorProps;
|
|
92
105
|
((EditorProps3) => {
|
|
93
106
|
EditorProps3.DEFAULT = {
|
|
94
|
-
background: {}
|
|
95
|
-
fromNodeJSON(node, json) {
|
|
96
|
-
const formData = node.getData(import_form_core.FlowNodeFormData);
|
|
97
|
-
if (!formData) {
|
|
98
|
-
if (json.data) {
|
|
99
|
-
node.updateExtInfo(json.data);
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
const defaultFormMeta = node.getService(EditorOptions).nodeEngine?.createDefaultFormMeta?.(node);
|
|
103
|
-
const formMeta = node.getNodeRegistry()?.formMeta || defaultFormMeta;
|
|
104
|
-
if (formMeta) {
|
|
105
|
-
formData.createForm(formMeta, json.data);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
toNodeJSON(node) {
|
|
110
|
-
const nodesMap = {};
|
|
111
|
-
let startNodeJSON;
|
|
112
|
-
node.document.traverse((node2) => {
|
|
113
|
-
const isSystemNode = node2.id.startsWith("$");
|
|
114
|
-
if (isSystemNode) return;
|
|
115
|
-
const formData = node2.getData(import_form_core.FlowNodeFormData);
|
|
116
|
-
let formJSON = formData && formData.formModel && formData.formModel.initialized ? formData.toJSON() : void 0;
|
|
117
|
-
const nodeJSON = {
|
|
118
|
-
id: node2.id,
|
|
119
|
-
type: node2.flowNodeType,
|
|
120
|
-
data: formData ? formJSON : node2.getExtInfo(),
|
|
121
|
-
blocks: []
|
|
122
|
-
};
|
|
123
|
-
if (!startNodeJSON) startNodeJSON = nodeJSON;
|
|
124
|
-
let { parent } = node2;
|
|
125
|
-
if (parent && parent.id.startsWith("$")) {
|
|
126
|
-
parent = parent.originParent;
|
|
127
|
-
}
|
|
128
|
-
const parentJSON = parent ? nodesMap[parent.id] : void 0;
|
|
129
|
-
if (parentJSON) {
|
|
130
|
-
parentJSON.blocks?.push(nodeJSON);
|
|
131
|
-
}
|
|
132
|
-
nodesMap[node2.id] = nodeJSON;
|
|
133
|
-
}, node);
|
|
134
|
-
return startNodeJSON;
|
|
135
|
-
}
|
|
107
|
+
background: {}
|
|
136
108
|
};
|
|
137
109
|
})(EditorProps || (EditorProps = {}));
|
|
138
110
|
|
|
139
111
|
// src/preset/editor-default-preset.ts
|
|
112
|
+
var import_variable_plugin = require("@flowgram.ai/variable-plugin");
|
|
140
113
|
var import_renderer = require("@flowgram.ai/renderer");
|
|
141
114
|
var import_redux_devtool_plugin = require("@flowgram.ai/redux-devtool-plugin");
|
|
142
|
-
var import_playground_react = require("@flowgram.ai/playground-react");
|
|
143
115
|
var import_node_variable_plugin = require("@flowgram.ai/node-variable-plugin");
|
|
144
116
|
var import_node_core_plugin = require("@flowgram.ai/node-core-plugin");
|
|
117
|
+
var import_node = require("@flowgram.ai/node");
|
|
145
118
|
var import_materials_plugin = require("@flowgram.ai/materials-plugin");
|
|
146
119
|
var import_i18n_plugin = require("@flowgram.ai/i18n-plugin");
|
|
147
120
|
var import_history_node_plugin = require("@flowgram.ai/history-node-plugin");
|
|
148
121
|
var import_document2 = require("@flowgram.ai/document");
|
|
149
122
|
var import_core6 = require("@flowgram.ai/core");
|
|
150
123
|
|
|
151
|
-
// src/utils/compose.ts
|
|
152
|
-
var compose = (fnList) => (node, data) => {
|
|
153
|
-
const list = fnList.filter(Boolean);
|
|
154
|
-
if (!list.length) {
|
|
155
|
-
return data;
|
|
156
|
-
}
|
|
157
|
-
return list.reduce((acc, fn) => fn(node, acc), data);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
124
|
// src/clients/flow-editor-client-plugins.ts
|
|
161
125
|
var import_core5 = require("@flowgram.ai/core");
|
|
162
126
|
|
|
@@ -351,7 +315,6 @@ var createFlowEditorClientPlugins = () => [
|
|
|
351
315
|
function createDefaultPreset(opts, plugins = []) {
|
|
352
316
|
return (ctx) => {
|
|
353
317
|
opts = { ...EditorProps.DEFAULT, ...opts };
|
|
354
|
-
ctx.container.bind(EditorOptions).toConstantValue(opts);
|
|
355
318
|
if (opts.i18n) {
|
|
356
319
|
plugins.push((0, import_i18n_plugin.createI18nPlugin)(opts.i18n));
|
|
357
320
|
}
|
|
@@ -371,7 +334,7 @@ function createDefaultPreset(opts, plugins = []) {
|
|
|
371
334
|
if (opts.variableEngine?.enable) {
|
|
372
335
|
plugins.push((0, import_node_variable_plugin.createNodeVariablePlugin)({}));
|
|
373
336
|
}
|
|
374
|
-
if (opts.history?.enable) {
|
|
337
|
+
if (opts.history?.enable && opts.history?.enableChangeNode !== false) {
|
|
375
338
|
plugins.push((0, import_history_node_plugin.createHistoryNodePlugin)({}));
|
|
376
339
|
}
|
|
377
340
|
}
|
|
@@ -384,21 +347,39 @@ function createDefaultPreset(opts, plugins = []) {
|
|
|
384
347
|
if (opts.constants) {
|
|
385
348
|
ctx2.document.options.constants = opts.constants;
|
|
386
349
|
}
|
|
387
|
-
if (opts.formatNodeLines) {
|
|
388
|
-
ctx2.document.options.formatNodeLines = compose([
|
|
389
|
-
ctx2.document.options.formatNodeLines,
|
|
390
|
-
opts.formatNodeLines
|
|
391
|
-
]);
|
|
392
|
-
}
|
|
393
|
-
if (opts.formatNodeLabels) {
|
|
394
|
-
ctx2.document.options.formatNodeLabels = compose([
|
|
395
|
-
ctx2.document.options.formatNodeLabels,
|
|
396
|
-
opts.formatNodeLabels
|
|
397
|
-
]);
|
|
398
|
-
}
|
|
399
350
|
if (opts.getNodeDefaultRegistry) {
|
|
400
351
|
ctx2.document.options.getNodeDefaultRegistry = opts.getNodeDefaultRegistry;
|
|
401
352
|
}
|
|
353
|
+
ctx2.document.options.preNodeCreate = (node) => {
|
|
354
|
+
if (opts.nodeEngine && opts.nodeEngine.enable !== false) {
|
|
355
|
+
let cache;
|
|
356
|
+
Object.defineProperty(node, "form", {
|
|
357
|
+
get: () => {
|
|
358
|
+
if (cache) return cache;
|
|
359
|
+
cache = (0, import_node.getNodeForm)(node);
|
|
360
|
+
return cache;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
if (opts.variableEngine && opts.variableEngine.enable !== false) {
|
|
365
|
+
let cache;
|
|
366
|
+
let privateCache;
|
|
367
|
+
Object.defineProperty(node, "scope", {
|
|
368
|
+
get: () => {
|
|
369
|
+
if (cache) return cache;
|
|
370
|
+
cache = (0, import_variable_plugin.getNodeScope)(node);
|
|
371
|
+
return cache;
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
Object.defineProperty(node, "privateScope", {
|
|
375
|
+
get: () => {
|
|
376
|
+
if (privateCache) return privateCache;
|
|
377
|
+
privateCache = (0, import_variable_plugin.getNodePrivateScope)(node);
|
|
378
|
+
return privateCache;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
};
|
|
402
383
|
ctx2.get(import_renderer.FlowRendererRegistry).init();
|
|
403
384
|
},
|
|
404
385
|
onReady(ctx2) {
|
|
@@ -418,7 +399,7 @@ function createDefaultPreset(opts, plugins = []) {
|
|
|
418
399
|
containerModules: defaultContainerModules
|
|
419
400
|
})
|
|
420
401
|
);
|
|
421
|
-
return
|
|
402
|
+
return plugins;
|
|
422
403
|
};
|
|
423
404
|
}
|
|
424
405
|
|
|
@@ -461,13 +442,18 @@ function useFlowEditor() {
|
|
|
461
442
|
}
|
|
462
443
|
|
|
463
444
|
// src/index.ts
|
|
464
|
-
__reExport(
|
|
445
|
+
__reExport(index_exports, require("@flowgram.ai/node-variable-plugin"), module.exports);
|
|
446
|
+
var import_playground_react = require("@flowgram.ai/playground-react");
|
|
465
447
|
// Annotate the CommonJS export names for ESM import in node:
|
|
466
448
|
0 && (module.exports = {
|
|
449
|
+
AsyncContainerModule,
|
|
450
|
+
Container,
|
|
451
|
+
ContainerModule,
|
|
467
452
|
Editor,
|
|
468
453
|
EditorProps,
|
|
469
454
|
EditorProvider,
|
|
470
455
|
EditorRenderer,
|
|
456
|
+
FeedbackLevel,
|
|
471
457
|
Field,
|
|
472
458
|
FieldArray,
|
|
473
459
|
FlowEditorClient,
|
|
@@ -477,11 +463,21 @@ __reExport(src_exports, require("@flowgram.ai/node-variable-plugin"), module.exp
|
|
|
477
463
|
NodeClient,
|
|
478
464
|
NodeFocusService,
|
|
479
465
|
NodeRender,
|
|
466
|
+
ReactiveBaseState,
|
|
467
|
+
ReactiveState,
|
|
468
|
+
Tracker,
|
|
480
469
|
ValidateTrigger,
|
|
481
470
|
createDefaultPreset,
|
|
482
471
|
createFlowEditorClientPlugin,
|
|
483
472
|
createFlowEditorClientPlugins,
|
|
473
|
+
createPlaygroundReactPreset,
|
|
484
474
|
highlightFormItem,
|
|
475
|
+
inject,
|
|
476
|
+
injectable,
|
|
477
|
+
multiInject,
|
|
478
|
+
named,
|
|
479
|
+
observe,
|
|
480
|
+
postConstruct,
|
|
485
481
|
useCurrentField,
|
|
486
482
|
useCurrentFieldState,
|
|
487
483
|
useField,
|
|
@@ -489,6 +485,9 @@ __reExport(src_exports, require("@flowgram.ai/node-variable-plugin"), module.exp
|
|
|
489
485
|
useFlowEditor,
|
|
490
486
|
useForm,
|
|
491
487
|
useHighlight,
|
|
488
|
+
useObserve,
|
|
489
|
+
useReactiveState,
|
|
490
|
+
useReadonlyReactiveState,
|
|
492
491
|
useWatch,
|
|
493
492
|
...require("@flowgram.ai/utils"),
|
|
494
493
|
...require("@flowgram.ai/core"),
|