@flowgram.ai/editor 0.1.0
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 +451 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +185 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +504 -0
- package/dist/index.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/index.ts
|
|
13
|
+
import "reflect-metadata";
|
|
14
|
+
import { FormModelV2 } from "@flowgram.ai/node";
|
|
15
|
+
export * from "@flowgram.ai/utils";
|
|
16
|
+
export * from "@flowgram.ai/core";
|
|
17
|
+
export * from "@flowgram.ai/document";
|
|
18
|
+
export * from "@flowgram.ai/renderer";
|
|
19
|
+
export * from "@flowgram.ai/variable-plugin";
|
|
20
|
+
export * from "@flowgram.ai/shortcuts-plugin";
|
|
21
|
+
export * from "@flowgram.ai/node-core-plugin";
|
|
22
|
+
export * from "@flowgram.ai/i18n-plugin";
|
|
23
|
+
import { FlowNodeFormData as FlowNodeFormData2, NodeRender } from "@flowgram.ai/form-core";
|
|
24
|
+
import {
|
|
25
|
+
Form,
|
|
26
|
+
Field,
|
|
27
|
+
FieldArray,
|
|
28
|
+
useForm,
|
|
29
|
+
useField,
|
|
30
|
+
useCurrentField,
|
|
31
|
+
useCurrentFieldState,
|
|
32
|
+
useFieldValidate,
|
|
33
|
+
useWatch,
|
|
34
|
+
ValidateTrigger
|
|
35
|
+
} from "@flowgram.ai/form";
|
|
36
|
+
export * from "@flowgram.ai/node";
|
|
37
|
+
|
|
38
|
+
// src/preset/editor-props.ts
|
|
39
|
+
import { FlowNodeFormData } from "@flowgram.ai/form-core";
|
|
40
|
+
|
|
41
|
+
// src/constants.ts
|
|
42
|
+
var EditorOptions = Symbol("EditorOptions");
|
|
43
|
+
|
|
44
|
+
// src/preset/editor-props.ts
|
|
45
|
+
var EditorProps;
|
|
46
|
+
((EditorProps3) => {
|
|
47
|
+
EditorProps3.DEFAULT = {
|
|
48
|
+
background: {},
|
|
49
|
+
fromNodeJSON(node, json) {
|
|
50
|
+
const formData = node.getData(FlowNodeFormData);
|
|
51
|
+
if (!formData) {
|
|
52
|
+
if (json.data) {
|
|
53
|
+
node.updateExtInfo(json.data);
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
const defaultFormMeta = node.getService(EditorOptions).nodeEngine?.createDefaultFormMeta?.(node);
|
|
57
|
+
const formMeta = node.getNodeRegistry()?.formMeta || defaultFormMeta;
|
|
58
|
+
if (formMeta) {
|
|
59
|
+
formData.createForm(formMeta, json.data);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
toNodeJSON(node) {
|
|
64
|
+
const nodesMap = {};
|
|
65
|
+
let startNodeJSON;
|
|
66
|
+
node.document.traverse((node2) => {
|
|
67
|
+
const isSystemNode = node2.id.startsWith("$");
|
|
68
|
+
if (isSystemNode) return;
|
|
69
|
+
const formData = node2.getData(FlowNodeFormData);
|
|
70
|
+
let formJSON = formData && formData.formModel && formData.formModel.initialized ? formData.toJSON() : void 0;
|
|
71
|
+
const nodeJSON = {
|
|
72
|
+
id: node2.id,
|
|
73
|
+
type: node2.flowNodeType,
|
|
74
|
+
data: formData ? formJSON : node2.getExtInfo(),
|
|
75
|
+
blocks: []
|
|
76
|
+
};
|
|
77
|
+
if (!startNodeJSON) startNodeJSON = nodeJSON;
|
|
78
|
+
let { parent } = node2;
|
|
79
|
+
if (parent && parent.id.startsWith("$")) {
|
|
80
|
+
parent = parent.originParent;
|
|
81
|
+
}
|
|
82
|
+
const parentJSON = parent ? nodesMap[parent.id] : void 0;
|
|
83
|
+
if (parentJSON) {
|
|
84
|
+
parentJSON.blocks?.push(nodeJSON);
|
|
85
|
+
}
|
|
86
|
+
nodesMap[node2.id] = nodeJSON;
|
|
87
|
+
}, node);
|
|
88
|
+
return startNodeJSON;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
})(EditorProps || (EditorProps = {}));
|
|
92
|
+
|
|
93
|
+
// src/preset/editor-default-preset.ts
|
|
94
|
+
import { FlowRendererContainerModule, FlowRendererRegistry } from "@flowgram.ai/renderer";
|
|
95
|
+
import { createReduxDevToolPlugin } from "@flowgram.ai/redux-devtool-plugin";
|
|
96
|
+
import { createPlaygroundReactPreset } from "@flowgram.ai/playground-react";
|
|
97
|
+
import { createNodeVariablePlugin } from "@flowgram.ai/node-variable-plugin";
|
|
98
|
+
import { createNodeCorePlugin } from "@flowgram.ai/node-core-plugin";
|
|
99
|
+
import { createMaterialsPlugin } from "@flowgram.ai/materials-plugin";
|
|
100
|
+
import { createI18nPlugin } from "@flowgram.ai/i18n-plugin";
|
|
101
|
+
import { createHistoryNodePlugin } from "@flowgram.ai/history-node-plugin";
|
|
102
|
+
import { FlowDocumentContainerModule } from "@flowgram.ai/document";
|
|
103
|
+
import { createPlaygroundPlugin } from "@flowgram.ai/core";
|
|
104
|
+
|
|
105
|
+
// src/utils/compose.ts
|
|
106
|
+
var compose = (fnList) => (node, data) => {
|
|
107
|
+
const list = fnList.filter(Boolean);
|
|
108
|
+
if (!list.length) {
|
|
109
|
+
return data;
|
|
110
|
+
}
|
|
111
|
+
return list.reduce((acc, fn) => fn(node, acc), data);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/clients/flow-editor-client-plugins.ts
|
|
115
|
+
import { definePluginCreator as definePluginCreator3 } from "@flowgram.ai/core";
|
|
116
|
+
|
|
117
|
+
// src/clients/node-client/create-node-client-plugins.ts
|
|
118
|
+
import { definePluginCreator as definePluginCreator2 } from "@flowgram.ai/core";
|
|
119
|
+
|
|
120
|
+
// src/clients/node-client/node-focus-service.ts
|
|
121
|
+
import { injectable, inject } from "inversify";
|
|
122
|
+
import { Playground } from "@flowgram.ai/core";
|
|
123
|
+
|
|
124
|
+
// src/clients/node-client/highlight/highlight-form-item.ts
|
|
125
|
+
import { FlowNodeRenderData } from "@flowgram.ai/document";
|
|
126
|
+
|
|
127
|
+
// src/clients/node-client/highlight/highlight-style.ts
|
|
128
|
+
var HIGHLIGHT_CLASSNAME = "flowide-highlight";
|
|
129
|
+
var styleText = `
|
|
130
|
+
@keyframes flowide-fade {
|
|
131
|
+
from {
|
|
132
|
+
opacity: 1.0;
|
|
133
|
+
}
|
|
134
|
+
to {
|
|
135
|
+
opacity: 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
@-webkit-keyframes flowide-fade {
|
|
139
|
+
from {
|
|
140
|
+
opacity: 1.0;
|
|
141
|
+
}
|
|
142
|
+
to {
|
|
143
|
+
opacity: 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
.${HIGHLIGHT_CLASSNAME} {
|
|
147
|
+
background-color: rgba(238, 245, 40, 0.5);
|
|
148
|
+
animation: flowide-fade 2s 1 forwards;
|
|
149
|
+
-webkit-animation: flowide-fade 2s 1 forwards;
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
var styleDom;
|
|
153
|
+
function createHighlightStyle() {
|
|
154
|
+
if (styleDom) return;
|
|
155
|
+
styleDom = document.createElement("style");
|
|
156
|
+
styleDom.innerHTML = styleText;
|
|
157
|
+
document.head.appendChild(styleDom);
|
|
158
|
+
}
|
|
159
|
+
function removeHighlightStyle() {
|
|
160
|
+
styleDom?.remove();
|
|
161
|
+
styleDom = void 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/clients/node-client/highlight/constants.ts
|
|
165
|
+
var DEFAULT_HIGHLIGHT_PADDING = 0;
|
|
166
|
+
|
|
167
|
+
// src/clients/node-client/highlight/highlight-form-item.ts
|
|
168
|
+
function highlightFormItem(formItem, options) {
|
|
169
|
+
const parent = formItem.formModel.flowNodeEntity.getData(FlowNodeRenderData).node;
|
|
170
|
+
const target = formItem.domRef.current;
|
|
171
|
+
if (!target) {
|
|
172
|
+
return void 0;
|
|
173
|
+
}
|
|
174
|
+
const overlay = document.createElement("div");
|
|
175
|
+
const { padding = DEFAULT_HIGHLIGHT_PADDING, overlayClassName } = options || {};
|
|
176
|
+
overlay.style.position = "absolute";
|
|
177
|
+
overlay.style.top = "0";
|
|
178
|
+
overlay.style.left = "0";
|
|
179
|
+
overlay.style.width = "100%";
|
|
180
|
+
overlay.style.height = "100%";
|
|
181
|
+
overlay.style.zIndex = "9999";
|
|
182
|
+
parent.appendChild(overlay);
|
|
183
|
+
const parentRect = parent.getBoundingClientRect();
|
|
184
|
+
const targetRect = target.getBoundingClientRect();
|
|
185
|
+
overlay.style.top = targetRect.top - parentRect.top - padding + "px";
|
|
186
|
+
overlay.style.left = targetRect.left - parentRect.left - padding + "px";
|
|
187
|
+
overlay.style.width = targetRect.width + padding * 2 + "px";
|
|
188
|
+
overlay.style.height = targetRect.height + padding * 2 + "px";
|
|
189
|
+
overlay.className = overlayClassName || HIGHLIGHT_CLASSNAME;
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
overlay.remove();
|
|
192
|
+
}, 2e3);
|
|
193
|
+
return overlay;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/clients/node-client/highlight/use-highlight.ts
|
|
197
|
+
import { useRef } from "react";
|
|
198
|
+
function useHighlight(props) {
|
|
199
|
+
const ref = useRef(null);
|
|
200
|
+
const { form, path } = props;
|
|
201
|
+
const formItem = form.getFormItemByPath(path);
|
|
202
|
+
if (!formItem) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
formItem.domRef = ref;
|
|
206
|
+
return ref;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// src/clients/node-client/node-focus-service.ts
|
|
210
|
+
var NodeFocusService = class {
|
|
211
|
+
highlightNodeFormItem(formItem, options) {
|
|
212
|
+
this.previousOverlay = highlightFormItem(formItem, options);
|
|
213
|
+
}
|
|
214
|
+
focusNodeFormItem(formItem, options) {
|
|
215
|
+
const node = formItem.formModel.flowNodeEntity;
|
|
216
|
+
const { canvas = {}, highlight } = options || {};
|
|
217
|
+
if (this.previousOverlay) {
|
|
218
|
+
this.previousOverlay.remove();
|
|
219
|
+
this.previousOverlay = void 0;
|
|
220
|
+
}
|
|
221
|
+
const currentPromise = this.playground.scrollToView({ entities: [node], scrollToCenter: true, ...canvas }).then(() => {
|
|
222
|
+
if (!formItem || !highlight || this.currentPromise !== currentPromise) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this.highlightNodeFormItem(formItem, typeof highlight === "boolean" ? {} : highlight);
|
|
226
|
+
});
|
|
227
|
+
this.currentPromise = currentPromise;
|
|
228
|
+
return this.currentPromise;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
__decorateClass([
|
|
232
|
+
inject(Playground)
|
|
233
|
+
], NodeFocusService.prototype, "playground", 2);
|
|
234
|
+
NodeFocusService = __decorateClass([
|
|
235
|
+
injectable()
|
|
236
|
+
], NodeFocusService);
|
|
237
|
+
|
|
238
|
+
// src/clients/node-client/node-client.ts
|
|
239
|
+
import { injectable as injectable2, inject as inject2 } from "inversify";
|
|
240
|
+
var NodeClient = class {
|
|
241
|
+
};
|
|
242
|
+
__decorateClass([
|
|
243
|
+
inject2(NodeFocusService)
|
|
244
|
+
], NodeClient.prototype, "nodeFocusService", 2);
|
|
245
|
+
NodeClient = __decorateClass([
|
|
246
|
+
injectable2()
|
|
247
|
+
], NodeClient);
|
|
248
|
+
|
|
249
|
+
// src/clients/node-client/highlight/create-node-highlight-plugin.ts
|
|
250
|
+
import { definePluginCreator } from "@flowgram.ai/core";
|
|
251
|
+
var createNodeHighlightPlugin = definePluginCreator({
|
|
252
|
+
onInit() {
|
|
253
|
+
createHighlightStyle();
|
|
254
|
+
},
|
|
255
|
+
onDispose() {
|
|
256
|
+
removeHighlightStyle();
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// src/clients/node-client/create-node-client-plugins.ts
|
|
261
|
+
var createNodeClientPlugin = definePluginCreator2({
|
|
262
|
+
onBind({ bind }) {
|
|
263
|
+
bind(NodeFocusService).toSelf().inSingletonScope();
|
|
264
|
+
bind(NodeClient).toSelf().inSingletonScope();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
var createNodeClientPlugins = () => [
|
|
268
|
+
createNodeHighlightPlugin({}),
|
|
269
|
+
createNodeClientPlugin({})
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
// src/clients/flow-editor-client.ts
|
|
273
|
+
import { injectable as injectable3, inject as inject3 } from "inversify";
|
|
274
|
+
import { Playground as Playground2 } from "@flowgram.ai/core";
|
|
275
|
+
var FlowEditorClient = class {
|
|
276
|
+
focusNodeFormItem(formItem, options) {
|
|
277
|
+
this.nodeClient.nodeFocusService.focusNodeFormItem(formItem, options);
|
|
278
|
+
}
|
|
279
|
+
focusNode(node, options) {
|
|
280
|
+
this.playground.scrollToView({ entities: [node], ...options });
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
__decorateClass([
|
|
284
|
+
inject3(NodeClient)
|
|
285
|
+
], FlowEditorClient.prototype, "nodeClient", 2);
|
|
286
|
+
__decorateClass([
|
|
287
|
+
inject3(Playground2)
|
|
288
|
+
], FlowEditorClient.prototype, "playground", 2);
|
|
289
|
+
FlowEditorClient = __decorateClass([
|
|
290
|
+
injectable3()
|
|
291
|
+
], FlowEditorClient);
|
|
292
|
+
|
|
293
|
+
// src/clients/flow-editor-client-plugins.ts
|
|
294
|
+
var createFlowEditorClientPlugin = definePluginCreator3({
|
|
295
|
+
onBind({ bind }) {
|
|
296
|
+
bind(FlowEditorClient).toSelf().inSingletonScope();
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
var createFlowEditorClientPlugins = () => [
|
|
300
|
+
...createNodeClientPlugins(),
|
|
301
|
+
createFlowEditorClientPlugin({})
|
|
302
|
+
];
|
|
303
|
+
|
|
304
|
+
// src/preset/editor-default-preset.ts
|
|
305
|
+
function createDefaultPreset(opts, plugins = []) {
|
|
306
|
+
return (ctx) => {
|
|
307
|
+
opts = { ...EditorProps.DEFAULT, ...opts };
|
|
308
|
+
ctx.container.bind(EditorOptions).toConstantValue(opts);
|
|
309
|
+
if (opts.i18n) {
|
|
310
|
+
plugins.push(createI18nPlugin(opts.i18n));
|
|
311
|
+
}
|
|
312
|
+
plugins.push(...createFlowEditorClientPlugins());
|
|
313
|
+
if (opts.reduxDevTool?.enable) {
|
|
314
|
+
plugins.push(createReduxDevToolPlugin(opts.reduxDevTool));
|
|
315
|
+
}
|
|
316
|
+
const defaultContainerModules = [
|
|
317
|
+
FlowDocumentContainerModule,
|
|
318
|
+
// 默认文档
|
|
319
|
+
FlowRendererContainerModule
|
|
320
|
+
// 默认渲染
|
|
321
|
+
];
|
|
322
|
+
plugins.push(createMaterialsPlugin(opts.materials || {}));
|
|
323
|
+
if (opts.nodeEngine && opts.nodeEngine.enable !== false) {
|
|
324
|
+
plugins.push(createNodeCorePlugin({ materials: opts.nodeEngine.materials }));
|
|
325
|
+
if (opts.variableEngine?.enable) {
|
|
326
|
+
plugins.push(createNodeVariablePlugin({}));
|
|
327
|
+
}
|
|
328
|
+
if (opts.history?.enable) {
|
|
329
|
+
plugins.push(createHistoryNodePlugin({}));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
plugins.push(
|
|
333
|
+
createPlaygroundPlugin({
|
|
334
|
+
onInit: (ctx2) => {
|
|
335
|
+
if (opts.nodeRegistries) {
|
|
336
|
+
ctx2.document.registerFlowNodes(...opts.nodeRegistries);
|
|
337
|
+
}
|
|
338
|
+
if (opts.constants) {
|
|
339
|
+
ctx2.document.options.constants = opts.constants;
|
|
340
|
+
}
|
|
341
|
+
if (opts.formatNodeLines) {
|
|
342
|
+
ctx2.document.options.formatNodeLines = compose([
|
|
343
|
+
ctx2.document.options.formatNodeLines,
|
|
344
|
+
opts.formatNodeLines
|
|
345
|
+
]);
|
|
346
|
+
}
|
|
347
|
+
if (opts.formatNodeLabels) {
|
|
348
|
+
ctx2.document.options.formatNodeLabels = compose([
|
|
349
|
+
ctx2.document.options.formatNodeLabels,
|
|
350
|
+
opts.formatNodeLabels
|
|
351
|
+
]);
|
|
352
|
+
}
|
|
353
|
+
if (opts.getNodeDefaultRegistry) {
|
|
354
|
+
ctx2.document.options.getNodeDefaultRegistry = opts.getNodeDefaultRegistry;
|
|
355
|
+
}
|
|
356
|
+
ctx2.get(FlowRendererRegistry).init();
|
|
357
|
+
},
|
|
358
|
+
onReady(ctx2) {
|
|
359
|
+
if (opts.initialData) {
|
|
360
|
+
ctx2.document.fromJSON(opts.initialData);
|
|
361
|
+
}
|
|
362
|
+
if (opts.readonly) {
|
|
363
|
+
ctx2.playground.config.readonly = opts.readonly;
|
|
364
|
+
}
|
|
365
|
+
ctx2.document.load().then(() => {
|
|
366
|
+
if (opts.onLoad) opts.onLoad(ctx2);
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
onDispose(ctx2) {
|
|
370
|
+
ctx2.document.dispose();
|
|
371
|
+
},
|
|
372
|
+
containerModules: defaultContainerModules
|
|
373
|
+
})
|
|
374
|
+
);
|
|
375
|
+
return createPlaygroundReactPreset(opts, plugins)(ctx);
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/components/editor-provider.tsx
|
|
380
|
+
import React, { useMemo, useCallback } from "react";
|
|
381
|
+
import { FlowDocument } from "@flowgram.ai/document";
|
|
382
|
+
import {
|
|
383
|
+
PlaygroundReactProvider,
|
|
384
|
+
createPluginContextDefault,
|
|
385
|
+
SelectionService
|
|
386
|
+
} from "@flowgram.ai/core";
|
|
387
|
+
var EditorProvider = (props) => {
|
|
388
|
+
const { children, ...others } = props;
|
|
389
|
+
const preset = useMemo(() => createDefaultPreset(others), []);
|
|
390
|
+
const customPluginContext = useCallback(
|
|
391
|
+
(container) => ({
|
|
392
|
+
...createPluginContextDefault(container),
|
|
393
|
+
get document() {
|
|
394
|
+
return container.get(FlowDocument);
|
|
395
|
+
},
|
|
396
|
+
get selection() {
|
|
397
|
+
return container.get(SelectionService);
|
|
398
|
+
}
|
|
399
|
+
}),
|
|
400
|
+
[]
|
|
401
|
+
);
|
|
402
|
+
return /* @__PURE__ */ React.createElement(PlaygroundReactProvider, { plugins: preset, customPluginContext }, children);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// src/components/editor-renderer.tsx
|
|
406
|
+
import { PlaygroundReactRenderer } from "@flowgram.ai/core";
|
|
407
|
+
|
|
408
|
+
// src/components/editor.tsx
|
|
409
|
+
import React2 from "react";
|
|
410
|
+
var Editor = (props) => {
|
|
411
|
+
const { children, ...otherProps } = props;
|
|
412
|
+
return /* @__PURE__ */ React2.createElement(EditorProvider, { ...otherProps }, /* @__PURE__ */ React2.createElement(PlaygroundReactRenderer, null, children));
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
// src/hooks/use-flow-editor.ts
|
|
416
|
+
import { useService } from "@flowgram.ai/core";
|
|
417
|
+
function useFlowEditor() {
|
|
418
|
+
return useService(FlowEditorClient);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// src/index.ts
|
|
422
|
+
export * from "@flowgram.ai/node-variable-plugin";
|
|
423
|
+
export {
|
|
424
|
+
Editor,
|
|
425
|
+
EditorProps,
|
|
426
|
+
EditorProvider,
|
|
427
|
+
PlaygroundReactRenderer as EditorRenderer,
|
|
428
|
+
Field,
|
|
429
|
+
FieldArray,
|
|
430
|
+
FlowEditorClient,
|
|
431
|
+
FlowNodeFormData2 as FlowNodeFormData,
|
|
432
|
+
Form,
|
|
433
|
+
FormModelV2 as FormModel,
|
|
434
|
+
NodeClient,
|
|
435
|
+
NodeFocusService,
|
|
436
|
+
NodeRender,
|
|
437
|
+
ValidateTrigger,
|
|
438
|
+
createDefaultPreset,
|
|
439
|
+
createFlowEditorClientPlugin,
|
|
440
|
+
createFlowEditorClientPlugins,
|
|
441
|
+
highlightFormItem,
|
|
442
|
+
useCurrentField,
|
|
443
|
+
useCurrentFieldState,
|
|
444
|
+
useField,
|
|
445
|
+
useFieldValidate,
|
|
446
|
+
useFlowEditor,
|
|
447
|
+
useForm,
|
|
448
|
+
useHighlight,
|
|
449
|
+
useWatch
|
|
450
|
+
};
|
|
451
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/preset/editor-props.ts","../../src/constants.ts","../../src/preset/editor-default-preset.ts","../../src/utils/compose.ts","../../src/clients/flow-editor-client-plugins.ts","../../src/clients/node-client/create-node-client-plugins.ts","../../src/clients/node-client/node-focus-service.ts","../../src/clients/node-client/highlight/highlight-form-item.ts","../../src/clients/node-client/highlight/highlight-style.ts","../../src/clients/node-client/highlight/constants.ts","../../src/clients/node-client/highlight/use-highlight.ts","../../src/clients/node-client/node-client.ts","../../src/clients/node-client/highlight/create-node-highlight-plugin.ts","../../src/clients/flow-editor-client.ts","../../src/components/editor-provider.tsx","../../src/components/editor-renderer.tsx","../../src/components/editor.tsx","../../src/hooks/use-flow-editor.ts"],"sourcesContent":["import 'reflect-metadata';\nimport { FormModelV2 } from '@flowgram.ai/node';\n\n/* 核心 模块导出 */\nexport * from '@flowgram.ai/utils';\nexport * from '@flowgram.ai/core';\nexport * from '@flowgram.ai/document';\nexport * from '@flowgram.ai/renderer';\nexport * from '@flowgram.ai/variable-plugin';\nexport * from '@flowgram.ai/shortcuts-plugin';\nexport * from '@flowgram.ai/node-core-plugin';\nexport * from '@flowgram.ai/i18n-plugin';\n\nexport { FlowNodeFormData, NodeRender, type NodeRenderProps } from '@flowgram.ai/form-core';\n\nexport type {\n FormState,\n FieldState,\n FieldArrayRenderProps,\n FieldRenderProps,\n FormRenderProps,\n Validate,\n FormControl,\n FieldName,\n FieldError,\n FieldWarning,\n IField,\n IFieldArray,\n} from '@flowgram.ai/form';\n\nexport {\n Form,\n Field,\n FieldArray,\n useForm,\n useField,\n useCurrentField,\n useCurrentFieldState,\n useFieldValidate,\n useWatch,\n ValidateTrigger,\n} from '@flowgram.ai/form';\nexport * from '@flowgram.ai/node';\nexport { FormModelV2 as FormModel };\n\n/**\n * 固定布局模块导出\n */\nexport * from './preset';\nexport * from './components';\nexport * from './hooks';\nexport * from './clients';\n\n/**\n * Plugin 导出\n */\n\nexport * from '@flowgram.ai/node-variable-plugin';\n","import { VariablePluginOptions } from '@flowgram.ai/variable-plugin';\nimport { ReduxDevToolPluginOptions } from '@flowgram.ai/redux-devtool-plugin';\nimport { PlaygroundReactProps, SelectionService } from '@flowgram.ai/playground-react';\nimport { NodeCorePluginOptions } from '@flowgram.ai/node-core-plugin';\nimport { MaterialsPluginOptions } from '@flowgram.ai/materials-plugin';\nimport { I18nPluginOptions } from '@flowgram.ai/i18n-plugin';\nimport { HistoryPluginOptions } from '@flowgram.ai/history';\nimport { FlowNodeFormData, FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';\nimport {\n FlowDocument,\n FlowDocumentJSON,\n FlowNodeEntity,\n type FlowNodeJSON,\n FlowNodeRegistry,\n FlowNodeType,\n FlowTransitionLabel,\n FlowTransitionLine,\n} from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\n\nimport { EditorOptions } from '../constants';\n\nexport interface EditorPluginContext extends PluginContext {\n document: FlowDocument;\n selection: SelectionService;\n}\n\n/**\n * 固定布局配置\n */\nexport interface EditorProps<\n CTX extends EditorPluginContext = EditorPluginContext,\n JSON = FlowDocumentJSON\n> extends PlaygroundReactProps<CTX> {\n /**\n * 初始化数据\n */\n initialData?: JSON;\n /**\n * 是否为 readonly\n */\n readonly?: boolean;\n /**\n * 节点定义\n */\n nodeRegistries?: FlowNodeRegistry[];\n /**\n * 获取默认的节点配置\n */\n getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;\n /**\n * 节点引擎配置\n */\n nodeEngine?: NodeCorePluginOptions & {\n /**\n * 默认FormMeta\n */\n createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;\n /**\n * 开启\n */\n enable?: boolean;\n };\n /**\n * 默认是否展开所有节点\n */\n allNodesDefaultExpanded?: boolean;\n /**\n * 画布物料\n */\n materials?: MaterialsPluginOptions;\n /**\n * 画布数据加载完成, 请使用 onAllLayersRendered 替代\n * @deprecated\n * */\n onLoad?: (ctx: CTX) => void;\n /**\n * 是否开启变量引擎\n */\n variableEngine?: VariablePluginOptions;\n /**\n * 是否开启历史\n */\n history?: HistoryPluginOptions<CTX> & { disableShortcuts?: boolean };\n\n /**\n * redux 开发者工具配置\n */\n reduxDevTool?: ReduxDevToolPluginOptions;\n\n scroll?: {\n disableScrollLimit?: boolean; // 关闭滚动限制\n disableScrollBar?: boolean; // 关闭滚动条\n };\n\n /**\n * 节点转\n * @param node\n */\n toNodeJSON?(node: FlowNodeEntity): FlowNodeJSON;\n fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): void;\n\n /**\n * 画布内部常量自定义\n */\n constants?: Record<string, any>;\n /**\n * 自定义节点线条\n */\n formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];\n /**\n * 自定义节点 label\n */\n formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];\n /**\n * 国际化\n */\n i18n?: I18nPluginOptions;\n}\n\nexport namespace EditorProps {\n /**\n * 默认配置\n */\n export const DEFAULT: EditorProps = {\n background: {},\n fromNodeJSON(node: FlowNodeEntity, json: FlowNodeJSON) {\n const formData = node.getData(FlowNodeFormData)!;\n // 如果没有使用表单引擎,将 data 数据填入 extInfo\n if (!formData) {\n if (json.data) {\n node.updateExtInfo(json.data);\n }\n } else {\n const defaultFormMeta = node\n .getService<EditorProps>(EditorOptions)\n .nodeEngine?.createDefaultFormMeta?.(node);\n\n const formMeta = node.getNodeRegistry()?.formMeta || defaultFormMeta;\n\n if (formMeta) {\n formData.createForm(formMeta, json.data);\n }\n }\n },\n toNodeJSON(node: FlowNodeEntity): FlowNodeJSON {\n const nodesMap: Record<string, FlowNodeJSON> = {};\n let startNodeJSON: FlowNodeJSON;\n node.document.traverse((node) => {\n const isSystemNode = node.id.startsWith('$');\n if (isSystemNode) return;\n const formData = node.getData(FlowNodeFormData);\n let formJSON =\n formData && formData.formModel && formData.formModel.initialized\n ? formData.toJSON()\n : undefined;\n const nodeJSON = {\n id: node.id,\n type: node.flowNodeType,\n data: formData ? formJSON : node.getExtInfo(),\n blocks: [],\n };\n if (!startNodeJSON) startNodeJSON = nodeJSON;\n let { parent } = node;\n if (parent && parent.id.startsWith('$')) {\n parent = parent.originParent;\n }\n const parentJSON = parent ? nodesMap[parent.id] : undefined;\n if (parentJSON) {\n parentJSON.blocks?.push(nodeJSON);\n }\n nodesMap[node.id] = nodeJSON;\n }, node);\n return startNodeJSON!;\n },\n };\n}\n","export const EditorOptions = Symbol('EditorOptions');\n","import { interfaces } from 'inversify';\nimport { FlowRendererContainerModule, FlowRendererRegistry } from '@flowgram.ai/renderer';\nimport { createReduxDevToolPlugin } from '@flowgram.ai/redux-devtool-plugin';\nimport { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';\nimport { createNodeVariablePlugin } from '@flowgram.ai/node-variable-plugin';\nimport { createNodeCorePlugin } from '@flowgram.ai/node-core-plugin';\nimport { createMaterialsPlugin } from '@flowgram.ai/materials-plugin';\nimport { createI18nPlugin } from '@flowgram.ai/i18n-plugin';\nimport { createHistoryNodePlugin } from '@flowgram.ai/history-node-plugin';\nimport { FlowDocumentContainerModule } from '@flowgram.ai/document';\nimport { createPlaygroundPlugin, Plugin, PluginsProvider } from '@flowgram.ai/core';\n\nimport { compose } from '../utils/compose';\nimport { EditorOptions } from '../constants';\nimport { createFlowEditorClientPlugins } from '../clients/flow-editor-client-plugins';\nimport { EditorPluginContext, EditorProps } from './editor-props';\n\nexport function createDefaultPreset<CTX extends EditorPluginContext = EditorPluginContext>(\n opts: EditorProps<CTX>,\n plugins: Plugin[] = []\n): PluginsProvider<CTX> {\n return (ctx: CTX) => {\n opts = { ...EditorProps.DEFAULT, ...opts };\n ctx.container.bind(EditorOptions).toConstantValue(opts);\n /**\n * i18n support\n */\n if (opts.i18n) {\n plugins.push(createI18nPlugin(opts.i18n));\n }\n /**\n * 默认注册顶层 flow editor client plugin\n */\n plugins.push(...createFlowEditorClientPlugins());\n\n /**\n * 注册 Redux 开发者工具\n */\n if (opts.reduxDevTool?.enable) {\n plugins.push(createReduxDevToolPlugin(opts.reduxDevTool));\n }\n\n /**\n * 注册画布模块\n */\n const defaultContainerModules: interfaces.ContainerModule[] = [\n FlowDocumentContainerModule, // 默认文档\n FlowRendererContainerModule, // 默认渲染\n ];\n /**\n * 注册物料\n */\n plugins.push(createMaterialsPlugin(opts.materials || {}));\n\n /**\n * 注册节点引擎\n */\n if (opts.nodeEngine && opts.nodeEngine.enable !== false) {\n plugins.push(createNodeCorePlugin({ materials: opts.nodeEngine.materials }));\n\n if (opts.variableEngine?.enable) {\n plugins.push(createNodeVariablePlugin({}));\n }\n\n if (opts.history?.enable) {\n plugins.push(createHistoryNodePlugin({}));\n }\n }\n /**\n * 画布生命周期注册\n */\n plugins.push(\n createPlaygroundPlugin<CTX>({\n onInit: (ctx) => {\n if (opts.nodeRegistries) {\n ctx.document.registerFlowNodes(...opts.nodeRegistries);\n }\n // 自定义画布内部常量\n if (opts.constants) {\n ctx.document.options.constants = opts.constants;\n }\n // 劫持节点线条\n if (opts.formatNodeLines) {\n ctx.document.options.formatNodeLines = compose([\n ctx.document.options.formatNodeLines,\n opts.formatNodeLines,\n ]);\n }\n // 劫持节点 label\n if (opts.formatNodeLabels) {\n ctx.document.options.formatNodeLabels = compose([\n ctx.document.options.formatNodeLabels,\n opts.formatNodeLabels,\n ]);\n }\n if (opts.getNodeDefaultRegistry) {\n ctx.document.options.getNodeDefaultRegistry = opts.getNodeDefaultRegistry;\n }\n // TODO\n // if (opts.onContentChange) {\n // ctx.document.onContentChange(event => opts.onContentChange!(ctx, event));\n // }\n // TODO 这个会触发组件注册,后续要废弃这个,通过 materials 插件来做\n ctx.get<FlowRendererRegistry>(FlowRendererRegistry).init();\n },\n onReady(ctx) {\n if (opts.initialData) {\n ctx.document.fromJSON(opts.initialData);\n }\n if (opts.readonly) {\n ctx.playground.config.readonly = opts.readonly;\n }\n ctx.document.load().then(() => {\n if (opts.onLoad) opts.onLoad(ctx);\n });\n },\n onDispose(ctx) {\n ctx.document.dispose();\n },\n containerModules: defaultContainerModules,\n })\n );\n\n return createPlaygroundReactPreset<CTX>(opts, plugins)(ctx);\n };\n}\n","import { FlowNodeEntity } from '@flowgram.ai/document';\n\nexport type ComposeListItem<T> = (node: FlowNodeEntity, data: T[]) => T[];\n\nexport const compose =\n <T>(fnList: (ComposeListItem<T> | undefined)[]) =>\n (node: FlowNodeEntity, data: T[]): T[] => {\n const list = fnList.filter(Boolean) as ComposeListItem<T>[];\n if (!list.length) {\n return data;\n }\n return list.reduce((acc: T[], fn) => fn(node, acc), data);\n };\n","import { definePluginCreator } from '@flowgram.ai/core';\n\nimport { createNodeClientPlugins } from './node-client/create-node-client-plugins';\nimport { FlowEditorClient } from './flow-editor-client';\n\nexport const createFlowEditorClientPlugin = definePluginCreator<{}>({\n onBind({ bind }) {\n bind(FlowEditorClient).toSelf().inSingletonScope();\n },\n});\n\nexport const createFlowEditorClientPlugins = () => [\n ...createNodeClientPlugins(),\n createFlowEditorClientPlugin({}),\n];\n","import { definePluginCreator } from '@flowgram.ai/core';\n\nimport { NodeFocusService } from './node-focus-service';\nimport { NodeClient } from './node-client';\nimport { createNodeHighlightPlugin } from './highlight/create-node-highlight-plugin';\n\nexport const createNodeClientPlugin = definePluginCreator<{}>({\n onBind({ bind }) {\n bind(NodeFocusService).toSelf().inSingletonScope();\n bind(NodeClient).toSelf().inSingletonScope();\n },\n});\n\nexport const createNodeClientPlugins = () => [\n createNodeHighlightPlugin({}),\n createNodeClientPlugin({}),\n];\n","import { injectable, inject } from 'inversify';\nimport { type FormItem } from '@flowgram.ai/form-core';\nimport { Playground, PlaygroundConfigRevealOpts } from '@flowgram.ai/core';\n\nimport { highlightFormItem, HighLightOptions } from './highlight';\n\nexport type FocusNodeCanvasOptions = PlaygroundConfigRevealOpts;\n\nexport interface FocusNodeFormItemOptions {\n canvas?: FocusNodeCanvasOptions;\n highlight?: boolean | HighLightOptions;\n}\n\n@injectable()\nexport class NodeFocusService {\n @inject(Playground) readonly playground: Playground;\n\n protected previousOverlay: HTMLDivElement | undefined;\n\n protected currentPromise: Promise<void> | undefined;\n\n highlightNodeFormItem(formItem: FormItem, options?: HighLightOptions) {\n this.previousOverlay = highlightFormItem(formItem, options);\n }\n\n focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions): Promise<void> {\n const node = formItem.formModel.flowNodeEntity;\n const { canvas = {}, highlight } = options || {};\n if (this.previousOverlay) {\n this.previousOverlay.remove();\n this.previousOverlay = undefined;\n }\n const currentPromise = this.playground\n .scrollToView({ entities: [node], scrollToCenter: true, ...canvas })\n .then(() => {\n if (!formItem || !highlight || this.currentPromise !== currentPromise) {\n return;\n }\n this.highlightNodeFormItem(formItem, typeof highlight === 'boolean' ? {} : highlight);\n });\n this.currentPromise = currentPromise;\n return this.currentPromise;\n }\n}\n","import { FormItem } from '@flowgram.ai/form-core';\nimport { FlowNodeRenderData } from '@flowgram.ai/document';\n\nimport { HIGHLIGHT_CLASSNAME } from './highlight-style';\nimport { DEFAULT_HIGHLIGHT_PADDING } from './constants';\n\nexport interface HighLightOptions {\n padding?: number;\n overlayClassName?: string;\n}\n\nexport function highlightFormItem(\n formItem: FormItem,\n options?: HighLightOptions,\n): HTMLDivElement | undefined {\n const parent =\n formItem.formModel.flowNodeEntity.getData<FlowNodeRenderData>(FlowNodeRenderData).node;\n const target = formItem.domRef.current;\n\n if (!target) {\n return undefined;\n }\n\n const overlay = document.createElement('div');\n\n const { padding = DEFAULT_HIGHLIGHT_PADDING, overlayClassName } = options || {};\n\n overlay.style.position = 'absolute';\n overlay.style.top = '0';\n overlay.style.left = '0';\n overlay.style.width = '100%';\n overlay.style.height = '100%';\n overlay.style.zIndex = '9999';\n\n parent.appendChild(overlay);\n\n const parentRect = parent.getBoundingClientRect();\n const targetRect = target.getBoundingClientRect();\n\n overlay.style.top = targetRect.top - parentRect.top - padding + 'px';\n overlay.style.left = targetRect.left - parentRect.left - padding + 'px';\n overlay.style.width = targetRect.width + padding * 2 + 'px';\n overlay.style.height = targetRect.height + padding * 2 + 'px';\n\n overlay.className = overlayClassName || HIGHLIGHT_CLASSNAME;\n setTimeout(() => {\n overlay.remove();\n }, 2000);\n return overlay;\n}\n","export const HIGHLIGHT_CLASSNAME = 'flowide-highlight';\n\nconst styleText = `\n@keyframes flowide-fade {\n from {\n opacity: 1.0;\n }\n to {\n opacity: 0;\n }\n}\n@-webkit-keyframes flowide-fade {\n from {\n opacity: 1.0;\n }\n to {\n opacity: 0;\n }\n}\n.${HIGHLIGHT_CLASSNAME} {\n background-color: rgba(238, 245, 40, 0.5);\n animation: flowide-fade 2s 1 forwards;\n -webkit-animation: flowide-fade 2s 1 forwards;\n}\n`;\n\nlet styleDom: HTMLStyleElement | undefined;\n\nexport function createHighlightStyle(): void {\n if (styleDom) return;\n styleDom = document.createElement('style');\n styleDom.innerHTML = styleText;\n document.head.appendChild(styleDom);\n}\n\nexport function removeHighlightStyle(): void {\n styleDom?.remove();\n styleDom = undefined;\n}\n","export const DEFAULT_HIGHLIGHT_COLOR = 'rgba(238, 245, 40, 0.5)';\nexport const DEFAULT_HIGHLIGHT_PADDING = 0;\n","import { useRef } from 'react';\n\nimport { FormModel } from '@flowgram.ai/form-core';\n\ninterface HighlightProps {\n form: FormModel;\n path: string;\n}\n\nexport function useHighlight(props: HighlightProps) {\n const ref = useRef<any>(null);\n const { form, path } = props;\n const formItem = form.getFormItemByPath(path);\n if (!formItem) {\n return null;\n }\n formItem.domRef = ref;\n return ref;\n}\n","import { injectable, inject } from 'inversify';\n\nimport { NodeFocusService } from './node-focus-service';\n\n@injectable()\nexport class NodeClient {\n @inject(NodeFocusService) nodeFocusService: NodeFocusService;\n}\n","import { definePluginCreator } from '@flowgram.ai/core';\n\nimport { createHighlightStyle, removeHighlightStyle } from './highlight-style';\n\nexport const createNodeHighlightPlugin = definePluginCreator<{}>({\n onInit() {\n createHighlightStyle();\n },\n onDispose() {\n removeHighlightStyle();\n },\n});\n","import { injectable, inject } from 'inversify';\nimport { type FormItem } from '@flowgram.ai/form-core';\nimport { FlowNodeEntity } from '@flowgram.ai/document';\nimport { Playground, PlaygroundConfigRevealOpts } from '@flowgram.ai/core';\n\nimport { FocusNodeFormItemOptions, NodeClient } from './node-client';\n\ninterface FocusNodeOptions {\n zoom?: PlaygroundConfigRevealOpts['zoom'];\n easing?: PlaygroundConfigRevealOpts['easing']; // 是否开启缓动,默认开启\n easingDuration?: PlaygroundConfigRevealOpts['easingDuration']; // 默认 500 ms\n scrollToCenter?: PlaygroundConfigRevealOpts['scrollToCenter']; // 是否滚动到中心\n}\n\n@injectable()\nexport class FlowEditorClient {\n @inject(NodeClient) readonly nodeClient: NodeClient;\n\n @inject(Playground) readonly playground: Playground;\n\n focusNodeFormItem(formItem: FormItem, options?: FocusNodeFormItemOptions) {\n this.nodeClient.nodeFocusService.focusNodeFormItem(formItem, options);\n }\n\n focusNode(node: FlowNodeEntity, options?: FocusNodeOptions) {\n this.playground.scrollToView({ entities: [node], ...options });\n }\n}\n","import React, { useMemo, useCallback } from 'react';\n\nimport { interfaces } from 'inversify';\nimport { FlowDocument } from '@flowgram.ai/document';\nimport {\n PlaygroundReactProvider,\n createPluginContextDefault,\n SelectionService,\n} from '@flowgram.ai/core';\n\nimport { EditorPluginContext, EditorProps, createDefaultPreset } from '../preset';\n\nexport const EditorProvider: React.FC<EditorProps> = (props: EditorProps) => {\n const { children, ...others } = props;\n const preset = useMemo(() => createDefaultPreset(others), []);\n const customPluginContext = useCallback(\n (container: interfaces.Container) =>\n ({\n ...createPluginContextDefault(container),\n get document(): FlowDocument {\n return container.get<FlowDocument>(FlowDocument);\n },\n get selection(): SelectionService {\n return container.get<SelectionService>(SelectionService);\n },\n } as EditorPluginContext),\n []\n );\n return (\n <PlaygroundReactProvider plugins={preset} customPluginContext={customPluginContext}>\n {children}\n </PlaygroundReactProvider>\n );\n};\n","export { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';\n","import React from 'react';\n\nimport { EditorProps } from '../preset';\nimport { EditorRenderer } from './editor-renderer';\nimport { EditorProvider } from './editor-provider';\n\n/**\n * 画布编辑器\n * @param props\n * @constructor\n */\nexport const Editor: React.FC<EditorProps> = (props: EditorProps) => {\n const { children, ...otherProps } = props;\n return (\n <EditorProvider {...otherProps}>\n <EditorRenderer>{children}</EditorRenderer>\n </EditorProvider>\n );\n};\n","import { useService } from '@flowgram.ai/core';\n\nimport { FlowEditorClient } from '../clients';\n\nexport function useFlowEditor(): FlowEditorClient {\n return useService(FlowEditorClient);\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO;AACP,SAAS,mBAAmB;AAG5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,oBAAAA,mBAAkB,kBAAwC;AAiBnE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;;;ACnCd,SAAS,wBAAqD;;;ACPvD,IAAM,gBAAgB,OAAO,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AoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBAAwC,CAAC,UAAuB;AAC3E,QAAM,EAAE,UAAU,GAAG,OAAO,IAAI;AAChC,QAAM,SAAS,QAAQ,MAAM,oBAAoB,MAAM,GAAG,CAAC,CAAC;AAC5D,QAAM,sBAAsB;AAAA,IAC1B,CAAC,eACE;AAAA,MACC,GAAG,2BAA2B,SAAS;AAAA,MACvC,IAAI,WAAyB;AAC3B,eAAO,UAAU,IAAkB,YAAY;AAAA,MACjD;AAAA,MACA,IAAI,YAA8B;AAChC,eAAO,UAAU,IAAsB,gBAAgB;AAAA,MACzD;AAAA,IACF;AAAA,IACF,CAAC;AAAA,EACH;AACA,SACE,oCAAC,2BAAwB,SAAS,QAAQ,uBACvC,QACH;AAEJ;;;ACjCA,SAAoC,+BAAsB;;;ACA1D,OAAOC,YAAW;AAWX,IAAM,SAAgC,CAAC,UAAuB;AACnE,QAAM,EAAE,UAAU,GAAG,WAAW,IAAI;AACpC,SACE,gBAAAC,OAAA,cAAC,kBAAgB,GAAG,cAClB,gBAAAA,OAAA,cAAC,+BAAgB,QAAS,CAC5B;AAEJ;;;AClBA,SAAS,kBAAkB;AAIpB,SAAS,gBAAkC;AAChD,SAAO,WAAW,gBAAgB;AACpC;;;AlBmDA,cAAc;","names":["FlowNodeFormData","EditorProps","node","definePluginCreator","definePluginCreator","injectable","inject","inject","injectable","definePluginCreator","injectable","inject","Playground","inject","Playground","injectable","definePluginCreator","ctx","React","React"]}
|