@flowgram.ai/editor 0.1.0-alpha.2

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,185 @@
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
+ import { FormMetaOrFormMetaGenerator, FormItem, FormModel } from '@flowgram.ai/form-core';
19
+ 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';
21
+ import { ReduxDevToolPluginOptions } from '@flowgram.ai/redux-devtool-plugin';
22
+ import { SelectionService, PlaygroundReactProps } from '@flowgram.ai/playground-react';
23
+ import { MaterialsPluginOptions } from '@flowgram.ai/materials-plugin';
24
+ import { HistoryPluginOptions } from '@flowgram.ai/history';
25
+ import * as React from 'react';
26
+ import React__default from 'react';
27
+ export * from '@flowgram.ai/node-variable-plugin';
28
+
29
+ interface EditorPluginContext extends PluginContext {
30
+ document: FlowDocument;
31
+ selection: SelectionService;
32
+ }
33
+ /**
34
+ * 固定布局配置
35
+ */
36
+ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
37
+ /**
38
+ * 初始化数据
39
+ */
40
+ initialData?: JSON;
41
+ /**
42
+ * 是否为 readonly
43
+ */
44
+ readonly?: boolean;
45
+ /**
46
+ * 节点定义
47
+ */
48
+ nodeRegistries?: FlowNodeRegistry[];
49
+ /**
50
+ * 获取默认的节点配置
51
+ */
52
+ getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
53
+ /**
54
+ * 节点引擎配置
55
+ */
56
+ nodeEngine?: NodeCorePluginOptions & {
57
+ /**
58
+ * 默认FormMeta
59
+ */
60
+ createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
61
+ /**
62
+ * 开启
63
+ */
64
+ enable?: boolean;
65
+ };
66
+ /**
67
+ * 默认是否展开所有节点
68
+ */
69
+ allNodesDefaultExpanded?: boolean;
70
+ /**
71
+ * 画布物料
72
+ */
73
+ materials?: MaterialsPluginOptions;
74
+ /**
75
+ * 画布数据加载完成, 请使用 onAllLayersRendered 替代
76
+ * @deprecated
77
+ * */
78
+ onLoad?: (ctx: CTX) => void;
79
+ /**
80
+ * 是否开启变量引擎
81
+ */
82
+ variableEngine?: VariablePluginOptions;
83
+ /**
84
+ * 是否开启历史
85
+ */
86
+ history?: HistoryPluginOptions<CTX> & {
87
+ disableShortcuts?: boolean;
88
+ };
89
+ /**
90
+ * redux 开发者工具配置
91
+ */
92
+ reduxDevTool?: ReduxDevToolPluginOptions;
93
+ scroll?: {
94
+ disableScrollLimit?: boolean;
95
+ disableScrollBar?: boolean;
96
+ };
97
+ /**
98
+ * 节点转
99
+ * @param node
100
+ */
101
+ toNodeJSON?(node: FlowNodeEntity): FlowNodeJSON;
102
+ fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): void;
103
+ /**
104
+ * 画布内部常量自定义
105
+ */
106
+ constants?: Record<string, any>;
107
+ /**
108
+ * 自定义节点线条
109
+ */
110
+ formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];
111
+ /**
112
+ * 自定义节点 label
113
+ */
114
+ formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];
115
+ /**
116
+ * 国际化
117
+ */
118
+ i18n?: I18nPluginOptions;
119
+ }
120
+ declare namespace EditorProps {
121
+ /**
122
+ * 默认配置
123
+ */
124
+ const DEFAULT: EditorProps;
125
+ }
126
+
127
+ declare function createDefaultPreset<CTX extends EditorPluginContext = EditorPluginContext>(opts: EditorProps<CTX>, plugins?: Plugin[]): PluginsProvider<CTX>;
128
+
129
+ declare const EditorProvider: React__default.FC<EditorProps>;
130
+
131
+ /**
132
+ * 画布编辑器
133
+ * @param props
134
+ * @constructor
135
+ */
136
+ declare const Editor: React__default.FC<EditorProps>;
137
+
138
+ interface HighLightOptions {
139
+ padding?: number;
140
+ overlayClassName?: string;
141
+ }
142
+ declare function highlightFormItem(formItem: FormItem, options?: HighLightOptions): HTMLDivElement | undefined;
143
+
144
+ interface HighlightProps {
145
+ form: FormModel;
146
+ path: string;
147
+ }
148
+ declare function useHighlight(props: HighlightProps): React.MutableRefObject<any> | null;
149
+
150
+ type FocusNodeCanvasOptions = PlaygroundConfigRevealOpts;
151
+ interface FocusNodeFormItemOptions {
152
+ canvas?: FocusNodeCanvasOptions;
153
+ highlight?: boolean | HighLightOptions;
154
+ }
155
+ declare class NodeFocusService {
156
+ readonly playground: Playground;
157
+ protected previousOverlay: HTMLDivElement | undefined;
158
+ protected currentPromise: Promise<void> | undefined;
159
+ highlightNodeFormItem(formItem: FormItem, options?: HighLightOptions): void;
160
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): Promise<void>;
161
+ }
162
+
163
+ declare class NodeClient {
164
+ nodeFocusService: NodeFocusService;
165
+ }
166
+
167
+ interface FocusNodeOptions {
168
+ zoom?: PlaygroundConfigRevealOpts['zoom'];
169
+ easing?: PlaygroundConfigRevealOpts['easing'];
170
+ easingDuration?: PlaygroundConfigRevealOpts['easingDuration'];
171
+ scrollToCenter?: PlaygroundConfigRevealOpts['scrollToCenter'];
172
+ }
173
+ declare class FlowEditorClient {
174
+ readonly nodeClient: NodeClient;
175
+ readonly playground: Playground;
176
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): void;
177
+ focusNode(node: FlowNodeEntity, options?: FocusNodeOptions): void;
178
+ }
179
+
180
+ declare const createFlowEditorClientPlugin: _flowgram_ai_core.PluginCreator<{}>;
181
+ declare const createFlowEditorClientPlugins: () => _flowgram_ai_core.Plugin<{}>[];
182
+
183
+ declare function useFlowEditor(): FlowEditorClient;
184
+
185
+ export { Editor, type EditorPluginContext, EditorProps, EditorProvider, FlowEditorClient, type FocusNodeCanvasOptions, type FocusNodeFormItemOptions, type HighLightOptions, NodeClient, NodeFocusService, createDefaultPreset, createFlowEditorClientPlugin, createFlowEditorClientPlugins, highlightFormItem, useFlowEditor, useHighlight };
@@ -0,0 +1,185 @@
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
+ import { FormMetaOrFormMetaGenerator, FormItem, FormModel } from '@flowgram.ai/form-core';
19
+ 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';
21
+ import { ReduxDevToolPluginOptions } from '@flowgram.ai/redux-devtool-plugin';
22
+ import { SelectionService, PlaygroundReactProps } from '@flowgram.ai/playground-react';
23
+ import { MaterialsPluginOptions } from '@flowgram.ai/materials-plugin';
24
+ import { HistoryPluginOptions } from '@flowgram.ai/history';
25
+ import * as React from 'react';
26
+ import React__default from 'react';
27
+ export * from '@flowgram.ai/node-variable-plugin';
28
+
29
+ interface EditorPluginContext extends PluginContext {
30
+ document: FlowDocument;
31
+ selection: SelectionService;
32
+ }
33
+ /**
34
+ * 固定布局配置
35
+ */
36
+ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
37
+ /**
38
+ * 初始化数据
39
+ */
40
+ initialData?: JSON;
41
+ /**
42
+ * 是否为 readonly
43
+ */
44
+ readonly?: boolean;
45
+ /**
46
+ * 节点定义
47
+ */
48
+ nodeRegistries?: FlowNodeRegistry[];
49
+ /**
50
+ * 获取默认的节点配置
51
+ */
52
+ getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
53
+ /**
54
+ * 节点引擎配置
55
+ */
56
+ nodeEngine?: NodeCorePluginOptions & {
57
+ /**
58
+ * 默认FormMeta
59
+ */
60
+ createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
61
+ /**
62
+ * 开启
63
+ */
64
+ enable?: boolean;
65
+ };
66
+ /**
67
+ * 默认是否展开所有节点
68
+ */
69
+ allNodesDefaultExpanded?: boolean;
70
+ /**
71
+ * 画布物料
72
+ */
73
+ materials?: MaterialsPluginOptions;
74
+ /**
75
+ * 画布数据加载完成, 请使用 onAllLayersRendered 替代
76
+ * @deprecated
77
+ * */
78
+ onLoad?: (ctx: CTX) => void;
79
+ /**
80
+ * 是否开启变量引擎
81
+ */
82
+ variableEngine?: VariablePluginOptions;
83
+ /**
84
+ * 是否开启历史
85
+ */
86
+ history?: HistoryPluginOptions<CTX> & {
87
+ disableShortcuts?: boolean;
88
+ };
89
+ /**
90
+ * redux 开发者工具配置
91
+ */
92
+ reduxDevTool?: ReduxDevToolPluginOptions;
93
+ scroll?: {
94
+ disableScrollLimit?: boolean;
95
+ disableScrollBar?: boolean;
96
+ };
97
+ /**
98
+ * 节点转
99
+ * @param node
100
+ */
101
+ toNodeJSON?(node: FlowNodeEntity): FlowNodeJSON;
102
+ fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): void;
103
+ /**
104
+ * 画布内部常量自定义
105
+ */
106
+ constants?: Record<string, any>;
107
+ /**
108
+ * 自定义节点线条
109
+ */
110
+ formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];
111
+ /**
112
+ * 自定义节点 label
113
+ */
114
+ formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];
115
+ /**
116
+ * 国际化
117
+ */
118
+ i18n?: I18nPluginOptions;
119
+ }
120
+ declare namespace EditorProps {
121
+ /**
122
+ * 默认配置
123
+ */
124
+ const DEFAULT: EditorProps;
125
+ }
126
+
127
+ declare function createDefaultPreset<CTX extends EditorPluginContext = EditorPluginContext>(opts: EditorProps<CTX>, plugins?: Plugin[]): PluginsProvider<CTX>;
128
+
129
+ declare const EditorProvider: React__default.FC<EditorProps>;
130
+
131
+ /**
132
+ * 画布编辑器
133
+ * @param props
134
+ * @constructor
135
+ */
136
+ declare const Editor: React__default.FC<EditorProps>;
137
+
138
+ interface HighLightOptions {
139
+ padding?: number;
140
+ overlayClassName?: string;
141
+ }
142
+ declare function highlightFormItem(formItem: FormItem, options?: HighLightOptions): HTMLDivElement | undefined;
143
+
144
+ interface HighlightProps {
145
+ form: FormModel;
146
+ path: string;
147
+ }
148
+ declare function useHighlight(props: HighlightProps): React.MutableRefObject<any> | null;
149
+
150
+ type FocusNodeCanvasOptions = PlaygroundConfigRevealOpts;
151
+ interface FocusNodeFormItemOptions {
152
+ canvas?: FocusNodeCanvasOptions;
153
+ highlight?: boolean | HighLightOptions;
154
+ }
155
+ declare class NodeFocusService {
156
+ readonly playground: Playground;
157
+ protected previousOverlay: HTMLDivElement | undefined;
158
+ protected currentPromise: Promise<void> | undefined;
159
+ highlightNodeFormItem(formItem: FormItem, options?: HighLightOptions): void;
160
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): Promise<void>;
161
+ }
162
+
163
+ declare class NodeClient {
164
+ nodeFocusService: NodeFocusService;
165
+ }
166
+
167
+ interface FocusNodeOptions {
168
+ zoom?: PlaygroundConfigRevealOpts['zoom'];
169
+ easing?: PlaygroundConfigRevealOpts['easing'];
170
+ easingDuration?: PlaygroundConfigRevealOpts['easingDuration'];
171
+ scrollToCenter?: PlaygroundConfigRevealOpts['scrollToCenter'];
172
+ }
173
+ declare class FlowEditorClient {
174
+ readonly nodeClient: NodeClient;
175
+ readonly playground: Playground;
176
+ focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): void;
177
+ focusNode(node: FlowNodeEntity, options?: FocusNodeOptions): void;
178
+ }
179
+
180
+ declare const createFlowEditorClientPlugin: _flowgram_ai_core.PluginCreator<{}>;
181
+ declare const createFlowEditorClientPlugins: () => _flowgram_ai_core.Plugin<{}>[];
182
+
183
+ declare function useFlowEditor(): FlowEditorClient;
184
+
185
+ export { Editor, type EditorPluginContext, EditorProps, EditorProvider, FlowEditorClient, type FocusNodeCanvasOptions, type FocusNodeFormItemOptions, type HighLightOptions, NodeClient, NodeFocusService, createDefaultPreset, createFlowEditorClientPlugin, createFlowEditorClientPlugins, highlightFormItem, useFlowEditor, useHighlight };