@flowgram.ai/editor 0.1.0-alpha.10

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.
@@ -0,0 +1,243 @@
1
+ export * from '@flowgram.ai/node';
2
+ export { FormModelV2 as FormModel } from '@flowgram.ai/node';
3
+ export * from '@flowgram.ai/utils';
4
+ import * as _flowgram_ai_core from '@flowgram.ai/core';
5
+ import { PluginContext, Plugin, PluginsProvider, PlaygroundConfigRevealOpts, Playground } from '@flowgram.ai/core';
6
+ export * from '@flowgram.ai/core';
7
+ export { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';
8
+ import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON, FlowTransitionLine, FlowTransitionLabel } from '@flowgram.ai/document';
9
+ export * from '@flowgram.ai/document';
10
+ export * from '@flowgram.ai/renderer';
11
+ import { VariablePluginOptions } from '@flowgram.ai/variable-plugin';
12
+ export * from '@flowgram.ai/variable-plugin';
13
+ export * from '@flowgram.ai/shortcuts-plugin';
14
+ import { NodeCorePluginOptions } from '@flowgram.ai/node-core-plugin';
15
+ export * from '@flowgram.ai/node-core-plugin';
16
+ import { I18nPluginOptions } from '@flowgram.ai/i18n-plugin';
17
+ export * from '@flowgram.ai/i18n-plugin';
18
+ export { AsyncContainerModule, Container, ContainerModule, inject, injectable, interfaces, multiInject, named, postConstruct } from 'inversify';
19
+ import { FormMetaOrFormMetaGenerator, FormItem, FormModel } from '@flowgram.ai/form-core';
20
+ export { FlowNodeFormData, NodeRender, NodeRenderProps } from '@flowgram.ai/form-core';
21
+ 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';
22
+ import { ReduxDevToolPluginOptions } from '@flowgram.ai/redux-devtool-plugin';
23
+ import { SelectionService, PlaygroundReactProps } from '@flowgram.ai/playground-react';
24
+ export { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';
25
+ import { MaterialsPluginOptions } from '@flowgram.ai/materials-plugin';
26
+ import { HistoryPluginOptions } from '@flowgram.ai/history';
27
+ import * as React from 'react';
28
+ import React__default from 'react';
29
+ export * from '@flowgram.ai/node-variable-plugin';
30
+
31
+ /**
32
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
33
+ * SPDX-License-Identifier: MIT
34
+ */
35
+
36
+ interface EditorPluginContext extends PluginContext {
37
+ document: FlowDocument;
38
+ selection: SelectionService;
39
+ }
40
+ /**
41
+ * 固定布局配置
42
+ */
43
+ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
44
+ /**
45
+ * 初始化数据
46
+ */
47
+ initialData?: JSON;
48
+ /**
49
+ * 是否为 readonly
50
+ */
51
+ readonly?: boolean;
52
+ /**
53
+ * 节点定义
54
+ */
55
+ nodeRegistries?: FlowNodeRegistry[];
56
+ /**
57
+ * 获取默认的节点配置
58
+ */
59
+ getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
60
+ /**
61
+ * 节点引擎配置
62
+ */
63
+ nodeEngine?: NodeCorePluginOptions & {
64
+ /**
65
+ * 默认FormMeta
66
+ */
67
+ createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
68
+ /**
69
+ * 开启
70
+ */
71
+ enable?: boolean;
72
+ };
73
+ /**
74
+ * 默认是否展开所有节点
75
+ */
76
+ allNodesDefaultExpanded?: boolean;
77
+ /**
78
+ * 画布物料
79
+ */
80
+ materials?: MaterialsPluginOptions;
81
+ /**
82
+ * 画布数据加载完成, 请使用 onAllLayersRendered 替代
83
+ * @deprecated
84
+ * */
85
+ onLoad?: (ctx: CTX) => void;
86
+ /**
87
+ * 是否开启变量引擎
88
+ */
89
+ variableEngine?: VariablePluginOptions;
90
+ /**
91
+ * 是否开启历史
92
+ */
93
+ history?: HistoryPluginOptions<CTX> & {
94
+ disableShortcuts?: boolean;
95
+ };
96
+ /**
97
+ * redux 开发者工具配置
98
+ */
99
+ reduxDevTool?: ReduxDevToolPluginOptions;
100
+ scroll?: {
101
+ enableScrollLimit?: boolean;
102
+ disableScrollBar?: boolean;
103
+ };
104
+ /**
105
+ * 节点数据导出
106
+ * - node 当前节点
107
+ * - json 当前节点数据
108
+ */
109
+ toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;
110
+ /**
111
+ * 节点数据导入
112
+ * - node 当前节点
113
+ * - json 当前节点数据
114
+ * - isFirstCreate 是否是第一次创建
115
+ */
116
+ fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;
117
+ /**
118
+ * 画布内部常量自定义
119
+ */
120
+ constants?: Record<string, any>;
121
+ /**
122
+ * 自定义节点线条
123
+ */
124
+ formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];
125
+ /**
126
+ * 自定义节点 label
127
+ */
128
+ formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];
129
+ /**
130
+ * 国际化
131
+ */
132
+ i18n?: I18nPluginOptions;
133
+ }
134
+ declare namespace EditorProps {
135
+ /**
136
+ * 默认配置
137
+ */
138
+ const DEFAULT: EditorProps;
139
+ }
140
+
141
+ /**
142
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
143
+ * SPDX-License-Identifier: MIT
144
+ */
145
+
146
+ declare function createDefaultPreset<CTX extends EditorPluginContext = EditorPluginContext>(opts: EditorProps<CTX>, plugins?: Plugin[]): PluginsProvider<CTX>;
147
+
148
+ /**
149
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
150
+ * SPDX-License-Identifier: MIT
151
+ */
152
+
153
+ declare const EditorProvider: React__default.FC<EditorProps>;
154
+
155
+ /**
156
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
157
+ * SPDX-License-Identifier: MIT
158
+ */
159
+
160
+ /**
161
+ * 画布编辑器
162
+ * @param props
163
+ * @constructor
164
+ */
165
+ declare const Editor: React__default.FC<EditorProps>;
166
+
167
+ /**
168
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
169
+ * SPDX-License-Identifier: MIT
170
+ */
171
+
172
+ interface HighLightOptions {
173
+ padding?: number;
174
+ overlayClassName?: string;
175
+ }
176
+ declare function highlightFormItem(formItem: FormItem, options?: HighLightOptions): HTMLDivElement | undefined;
177
+
178
+ interface HighlightProps {
179
+ form: FormModel;
180
+ path: string;
181
+ }
182
+ declare function useHighlight(props: HighlightProps): React.MutableRefObject<any> | null;
183
+
184
+ /**
185
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
186
+ * SPDX-License-Identifier: MIT
187
+ */
188
+
189
+ type FocusNodeCanvasOptions = PlaygroundConfigRevealOpts;
190
+ interface FocusNodeFormItemOptions {
191
+ canvas?: FocusNodeCanvasOptions;
192
+ highlight?: boolean | HighLightOptions;
193
+ }
194
+ declare class NodeFocusService {
195
+ readonly playground: Playground;
196
+ protected previousOverlay: HTMLDivElement | undefined;
197
+ protected currentPromise: Promise<void> | undefined;
198
+ highlightNodeFormItem(formItem: FormItem, options?: HighLightOptions): void;
199
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): Promise<void>;
200
+ }
201
+
202
+ /**
203
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
204
+ * SPDX-License-Identifier: MIT
205
+ */
206
+
207
+ declare class NodeClient {
208
+ nodeFocusService: NodeFocusService;
209
+ }
210
+
211
+ /**
212
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
213
+ * SPDX-License-Identifier: MIT
214
+ */
215
+
216
+ interface FocusNodeOptions {
217
+ zoom?: PlaygroundConfigRevealOpts['zoom'];
218
+ easing?: PlaygroundConfigRevealOpts['easing'];
219
+ easingDuration?: PlaygroundConfigRevealOpts['easingDuration'];
220
+ scrollToCenter?: PlaygroundConfigRevealOpts['scrollToCenter'];
221
+ }
222
+ declare class FlowEditorClient {
223
+ readonly nodeClient: NodeClient;
224
+ readonly playground: Playground;
225
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): void;
226
+ focusNode(node: FlowNodeEntity, options?: FocusNodeOptions): void;
227
+ }
228
+
229
+ /**
230
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
231
+ * SPDX-License-Identifier: MIT
232
+ */
233
+ declare const createFlowEditorClientPlugin: _flowgram_ai_core.PluginCreator<{}>;
234
+ declare const createFlowEditorClientPlugins: () => _flowgram_ai_core.Plugin<{}>[];
235
+
236
+ /**
237
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
238
+ * SPDX-License-Identifier: MIT
239
+ */
240
+
241
+ declare function useFlowEditor(): FlowEditorClient;
242
+
243
+ export { Editor, type EditorPluginContext, EditorProps, EditorProvider, FlowEditorClient, type FocusNodeCanvasOptions, type FocusNodeFormItemOptions, type HighLightOptions, NodeClient, NodeFocusService, createDefaultPreset, createFlowEditorClientPlugin, createFlowEditorClientPlugins, highlightFormItem, useFlowEditor, useHighlight };
@@ -0,0 +1,243 @@
1
+ export * from '@flowgram.ai/node';
2
+ export { FormModelV2 as FormModel } from '@flowgram.ai/node';
3
+ export * from '@flowgram.ai/utils';
4
+ import * as _flowgram_ai_core from '@flowgram.ai/core';
5
+ import { PluginContext, Plugin, PluginsProvider, PlaygroundConfigRevealOpts, Playground } from '@flowgram.ai/core';
6
+ export * from '@flowgram.ai/core';
7
+ export { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';
8
+ import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON, FlowTransitionLine, FlowTransitionLabel } from '@flowgram.ai/document';
9
+ export * from '@flowgram.ai/document';
10
+ export * from '@flowgram.ai/renderer';
11
+ import { VariablePluginOptions } from '@flowgram.ai/variable-plugin';
12
+ export * from '@flowgram.ai/variable-plugin';
13
+ export * from '@flowgram.ai/shortcuts-plugin';
14
+ import { NodeCorePluginOptions } from '@flowgram.ai/node-core-plugin';
15
+ export * from '@flowgram.ai/node-core-plugin';
16
+ import { I18nPluginOptions } from '@flowgram.ai/i18n-plugin';
17
+ export * from '@flowgram.ai/i18n-plugin';
18
+ export { AsyncContainerModule, Container, ContainerModule, inject, injectable, interfaces, multiInject, named, postConstruct } from 'inversify';
19
+ import { FormMetaOrFormMetaGenerator, FormItem, FormModel } from '@flowgram.ai/form-core';
20
+ export { FlowNodeFormData, NodeRender, NodeRenderProps } from '@flowgram.ai/form-core';
21
+ 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';
22
+ import { ReduxDevToolPluginOptions } from '@flowgram.ai/redux-devtool-plugin';
23
+ import { SelectionService, PlaygroundReactProps } from '@flowgram.ai/playground-react';
24
+ export { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';
25
+ import { MaterialsPluginOptions } from '@flowgram.ai/materials-plugin';
26
+ import { HistoryPluginOptions } from '@flowgram.ai/history';
27
+ import * as React from 'react';
28
+ import React__default from 'react';
29
+ export * from '@flowgram.ai/node-variable-plugin';
30
+
31
+ /**
32
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
33
+ * SPDX-License-Identifier: MIT
34
+ */
35
+
36
+ interface EditorPluginContext extends PluginContext {
37
+ document: FlowDocument;
38
+ selection: SelectionService;
39
+ }
40
+ /**
41
+ * 固定布局配置
42
+ */
43
+ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
44
+ /**
45
+ * 初始化数据
46
+ */
47
+ initialData?: JSON;
48
+ /**
49
+ * 是否为 readonly
50
+ */
51
+ readonly?: boolean;
52
+ /**
53
+ * 节点定义
54
+ */
55
+ nodeRegistries?: FlowNodeRegistry[];
56
+ /**
57
+ * 获取默认的节点配置
58
+ */
59
+ getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
60
+ /**
61
+ * 节点引擎配置
62
+ */
63
+ nodeEngine?: NodeCorePluginOptions & {
64
+ /**
65
+ * 默认FormMeta
66
+ */
67
+ createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
68
+ /**
69
+ * 开启
70
+ */
71
+ enable?: boolean;
72
+ };
73
+ /**
74
+ * 默认是否展开所有节点
75
+ */
76
+ allNodesDefaultExpanded?: boolean;
77
+ /**
78
+ * 画布物料
79
+ */
80
+ materials?: MaterialsPluginOptions;
81
+ /**
82
+ * 画布数据加载完成, 请使用 onAllLayersRendered 替代
83
+ * @deprecated
84
+ * */
85
+ onLoad?: (ctx: CTX) => void;
86
+ /**
87
+ * 是否开启变量引擎
88
+ */
89
+ variableEngine?: VariablePluginOptions;
90
+ /**
91
+ * 是否开启历史
92
+ */
93
+ history?: HistoryPluginOptions<CTX> & {
94
+ disableShortcuts?: boolean;
95
+ };
96
+ /**
97
+ * redux 开发者工具配置
98
+ */
99
+ reduxDevTool?: ReduxDevToolPluginOptions;
100
+ scroll?: {
101
+ enableScrollLimit?: boolean;
102
+ disableScrollBar?: boolean;
103
+ };
104
+ /**
105
+ * 节点数据导出
106
+ * - node 当前节点
107
+ * - json 当前节点数据
108
+ */
109
+ toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;
110
+ /**
111
+ * 节点数据导入
112
+ * - node 当前节点
113
+ * - json 当前节点数据
114
+ * - isFirstCreate 是否是第一次创建
115
+ */
116
+ fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;
117
+ /**
118
+ * 画布内部常量自定义
119
+ */
120
+ constants?: Record<string, any>;
121
+ /**
122
+ * 自定义节点线条
123
+ */
124
+ formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];
125
+ /**
126
+ * 自定义节点 label
127
+ */
128
+ formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];
129
+ /**
130
+ * 国际化
131
+ */
132
+ i18n?: I18nPluginOptions;
133
+ }
134
+ declare namespace EditorProps {
135
+ /**
136
+ * 默认配置
137
+ */
138
+ const DEFAULT: EditorProps;
139
+ }
140
+
141
+ /**
142
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
143
+ * SPDX-License-Identifier: MIT
144
+ */
145
+
146
+ declare function createDefaultPreset<CTX extends EditorPluginContext = EditorPluginContext>(opts: EditorProps<CTX>, plugins?: Plugin[]): PluginsProvider<CTX>;
147
+
148
+ /**
149
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
150
+ * SPDX-License-Identifier: MIT
151
+ */
152
+
153
+ declare const EditorProvider: React__default.FC<EditorProps>;
154
+
155
+ /**
156
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
157
+ * SPDX-License-Identifier: MIT
158
+ */
159
+
160
+ /**
161
+ * 画布编辑器
162
+ * @param props
163
+ * @constructor
164
+ */
165
+ declare const Editor: React__default.FC<EditorProps>;
166
+
167
+ /**
168
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
169
+ * SPDX-License-Identifier: MIT
170
+ */
171
+
172
+ interface HighLightOptions {
173
+ padding?: number;
174
+ overlayClassName?: string;
175
+ }
176
+ declare function highlightFormItem(formItem: FormItem, options?: HighLightOptions): HTMLDivElement | undefined;
177
+
178
+ interface HighlightProps {
179
+ form: FormModel;
180
+ path: string;
181
+ }
182
+ declare function useHighlight(props: HighlightProps): React.MutableRefObject<any> | null;
183
+
184
+ /**
185
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
186
+ * SPDX-License-Identifier: MIT
187
+ */
188
+
189
+ type FocusNodeCanvasOptions = PlaygroundConfigRevealOpts;
190
+ interface FocusNodeFormItemOptions {
191
+ canvas?: FocusNodeCanvasOptions;
192
+ highlight?: boolean | HighLightOptions;
193
+ }
194
+ declare class NodeFocusService {
195
+ readonly playground: Playground;
196
+ protected previousOverlay: HTMLDivElement | undefined;
197
+ protected currentPromise: Promise<void> | undefined;
198
+ highlightNodeFormItem(formItem: FormItem, options?: HighLightOptions): void;
199
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): Promise<void>;
200
+ }
201
+
202
+ /**
203
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
204
+ * SPDX-License-Identifier: MIT
205
+ */
206
+
207
+ declare class NodeClient {
208
+ nodeFocusService: NodeFocusService;
209
+ }
210
+
211
+ /**
212
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
213
+ * SPDX-License-Identifier: MIT
214
+ */
215
+
216
+ interface FocusNodeOptions {
217
+ zoom?: PlaygroundConfigRevealOpts['zoom'];
218
+ easing?: PlaygroundConfigRevealOpts['easing'];
219
+ easingDuration?: PlaygroundConfigRevealOpts['easingDuration'];
220
+ scrollToCenter?: PlaygroundConfigRevealOpts['scrollToCenter'];
221
+ }
222
+ declare class FlowEditorClient {
223
+ readonly nodeClient: NodeClient;
224
+ readonly playground: Playground;
225
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): void;
226
+ focusNode(node: FlowNodeEntity, options?: FocusNodeOptions): void;
227
+ }
228
+
229
+ /**
230
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
231
+ * SPDX-License-Identifier: MIT
232
+ */
233
+ declare const createFlowEditorClientPlugin: _flowgram_ai_core.PluginCreator<{}>;
234
+ declare const createFlowEditorClientPlugins: () => _flowgram_ai_core.Plugin<{}>[];
235
+
236
+ /**
237
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
238
+ * SPDX-License-Identifier: MIT
239
+ */
240
+
241
+ declare function useFlowEditor(): FlowEditorClient;
242
+
243
+ export { Editor, type EditorPluginContext, EditorProps, EditorProvider, FlowEditorClient, type FocusNodeCanvasOptions, type FocusNodeFormItemOptions, type HighLightOptions, NodeClient, NodeFocusService, createDefaultPreset, createFlowEditorClientPlugin, createFlowEditorClientPlugins, highlightFormItem, useFlowEditor, useHighlight };