@flowgram.ai/editor 0.3.5 → 0.3.6
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 +0 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +30 -26
- package/dist/index.d.ts +30 -26
- package/dist/index.js +0 -21
- package/dist/index.js.map +1 -1
- package/package.json +22 -22
package/dist/esm/index.js
CHANGED
|
@@ -65,15 +65,6 @@ import { createHistoryNodePlugin } from "@flowgram.ai/history-node-plugin";
|
|
|
65
65
|
import { FlowDocumentContainerModule } from "@flowgram.ai/document";
|
|
66
66
|
import { createPlaygroundPlugin } from "@flowgram.ai/core";
|
|
67
67
|
|
|
68
|
-
// src/utils/compose.ts
|
|
69
|
-
var compose = (fnList) => (node, data) => {
|
|
70
|
-
const list = fnList.filter(Boolean);
|
|
71
|
-
if (!list.length) {
|
|
72
|
-
return data;
|
|
73
|
-
}
|
|
74
|
-
return list.reduce((acc, fn) => fn(node, acc), data);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
68
|
// src/clients/flow-editor-client-plugins.ts
|
|
78
69
|
import { definePluginCreator as definePluginCreator3 } from "@flowgram.ai/core";
|
|
79
70
|
|
|
@@ -300,18 +291,6 @@ function createDefaultPreset(opts, plugins = []) {
|
|
|
300
291
|
if (opts.constants) {
|
|
301
292
|
ctx2.document.options.constants = opts.constants;
|
|
302
293
|
}
|
|
303
|
-
if (opts.formatNodeLines) {
|
|
304
|
-
ctx2.document.options.formatNodeLines = compose([
|
|
305
|
-
ctx2.document.options.formatNodeLines,
|
|
306
|
-
opts.formatNodeLines
|
|
307
|
-
]);
|
|
308
|
-
}
|
|
309
|
-
if (opts.formatNodeLabels) {
|
|
310
|
-
ctx2.document.options.formatNodeLabels = compose([
|
|
311
|
-
ctx2.document.options.formatNodeLabels,
|
|
312
|
-
opts.formatNodeLabels
|
|
313
|
-
]);
|
|
314
|
-
}
|
|
315
294
|
if (opts.getNodeDefaultRegistry) {
|
|
316
295
|
ctx2.document.options.getNodeDefaultRegistry = opts.getNodeDefaultRegistry;
|
|
317
296
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/preset/editor-props.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":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport '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';\nexport {\n type interfaces,\n injectable,\n postConstruct,\n named,\n Container,\n ContainerModule,\n AsyncContainerModule,\n inject,\n multiInject,\n} from 'inversify';\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 IForm,\n Errors,\n Warnings,\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 FeedbackLevel,\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\nexport { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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 { 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\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 enableScrollLimit?: boolean; // 开启滚动限制\n disableScrollBar?: boolean; // 关闭滚动条\n disableScroll?: boolean; // 禁止滚动\n };\n\n /**\n * 节点数据导出\n * - node 当前节点\n * - json 当前节点数据\n */\n toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;\n /**\n * 节点数据导入\n * - node 当前节点\n * - json 当前节点数据\n * - isFirstCreate 是否是第一次创建\n */\n fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;\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 };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { interfaces } from 'inversify';\nimport { FlowRendererContainerModule, FlowRendererRegistry } from '@flowgram.ai/renderer';\nimport { createReduxDevToolPlugin } from '@flowgram.ai/redux-devtool-plugin';\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 { 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 /**\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 plugins;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const DEFAULT_HIGHLIGHT_COLOR = 'rgba(238, 245, 40, 0.5)';\nexport const DEFAULT_HIGHLIGHT_PADDING = 0;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable, inject } from 'inversify';\n\nimport { NodeFocusService } from './node-focus-service';\n\n@injectable()\nexport class NodeClient {\n @inject(NodeFocusService) nodeFocusService: NodeFocusService;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { FlowEditorClient } from '../clients';\n\nexport function useFlowEditor(): FlowEditorClient {\n return useService(FlowEditorClient);\n}\n"],"mappings":";;;;;;;;;;;;AAKA,OAAO;AACP,SAAS,mBAAmB;AAG5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd;AAAA,EAEE,cAAAA;AAAA,EACA;AAAA,EACA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AAK,OAAOA,IAAG;AAAA,UAClC,CAAC;AAAA,QACH;AAAA,QACA,UAAUA,MAAK;AACb,UAAAA,KAAI,SAAS,QAAQ;AAAA,QACvB;AAAA,QACA,kBAAkB;AAAA,MACpB,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;;;AY1HA,OAAO,SAAS,SAAS,mBAAmB;AAG5C,SAAS,oBAAoB;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;;;AjBkEA,cAAc;AAEd,SAAS,mCAAmC;","names":["injectable","inject","EditorProps","definePluginCreator","definePluginCreator","injectable","inject","inject","injectable","definePluginCreator","injectable","inject","Playground","inject","Playground","injectable","definePluginCreator","ctx","React","React"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/preset/editor-props.ts","../../src/preset/editor-default-preset.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":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport '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';\nexport {\n type interfaces,\n injectable,\n postConstruct,\n named,\n Container,\n ContainerModule,\n AsyncContainerModule,\n inject,\n multiInject,\n} from 'inversify';\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 IForm,\n Errors,\n Warnings,\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 FeedbackLevel,\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\nexport { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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 { FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';\nimport {\n FlowDocument,\n FlowDocumentJSON,\n FlowNodeEntity,\n type FlowNodeJSON,\n FlowNodeRegistry,\n FlowNodeType,\n} from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\n\nexport interface EditorPluginContext extends PluginContext {\n document: FlowDocument;\n selection: SelectionService;\n}\n\nexport interface EditorProps<\n CTX extends EditorPluginContext = EditorPluginContext,\n JSON = FlowDocumentJSON\n> extends PlaygroundReactProps<CTX> {\n /**\n * Initialize data\n * 初始化数据\n */\n initialData?: JSON;\n /**\n * whether it is readonly\n * 是否为 readonly\n */\n readonly?: boolean;\n /**\n * node registries\n * 节点定义\n */\n nodeRegistries?: FlowNodeRegistry[];\n /**\n * Get the default node registry, which will be merged with the 'nodeRegistries'\n * 提供默认的节点注册,这个会和 nodeRegistries 做合并\n */\n getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;\n /**\n * Node engine configuration\n */\n nodeEngine?: NodeCorePluginOptions & {\n /**\n * Default formMeta\n */\n createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;\n /**\n * Enable node engine\n */\n enable?: boolean;\n };\n /**\n * By default, all nodes are expanded\n * 默认是否展开所有节点\n */\n allNodesDefaultExpanded?: boolean;\n /**\n * Canvas material, Used to customize react components\n * 画布物料, 用于自定义 react 组件\n */\n materials?: MaterialsPluginOptions;\n /**\n * 画布数据加载完成, 请使用 onAllLayersRendered 替代\n * @deprecated\n * */\n onLoad?: (ctx: CTX) => void;\n /**\n * 是否开启变量引擎\n * Variable engine enable\n */\n variableEngine?: VariablePluginOptions;\n /**\n * Redo/Undo enable\n */\n history?: HistoryPluginOptions<CTX> & { disableShortcuts?: boolean };\n\n /**\n * redux devtool configuration\n */\n reduxDevTool?: ReduxDevToolPluginOptions;\n\n /**\n * Scroll configuration\n * 滚动配置\n */\n scroll?: {\n enableScrollLimit?: boolean; // 开启滚动限制\n disableScrollBar?: boolean; // 关闭滚动条\n disableScroll?: boolean; // 禁止滚动\n };\n\n /**\n * Node data transformation, called by ctx.document.fromJSON\n * 节点数据转换, 由 ctx.document.fromJSON 调用\n * @param node - current node\n * @param json - Current node json data\n */\n toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;\n /**\n * Node data transformation, called by ctx.document.toJSON\n * 节点数据转换, 由 ctx.document.toJSON 调用\n * @param node - current node\n * @param json - Current node json data\n * @param isFirstCreate - Whether it is created for the first time, If document.fromJSON is recalled, but the node already exists, isFirstCreate is false\n */\n fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;\n /**\n * Canvas internal constant customization\n * 画布内部常量自定义\n */\n constants?: Record<string, any>;\n /**\n * i18n\n * 国际化\n */\n i18n?: I18nPluginOptions;\n}\n\nexport namespace EditorProps {\n /**\n * 默认配置\n */\n export const DEFAULT: EditorProps = {\n background: {},\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { interfaces } from 'inversify';\nimport { FlowRendererContainerModule, FlowRendererRegistry } from '@flowgram.ai/renderer';\nimport { createReduxDevToolPlugin } from '@flowgram.ai/redux-devtool-plugin';\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 { 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 /**\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 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 plugins;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const DEFAULT_HIGHLIGHT_COLOR = 'rgba(238, 245, 40, 0.5)';\nexport const DEFAULT_HIGHLIGHT_PADDING = 0;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable, inject } from 'inversify';\n\nimport { NodeFocusService } from './node-focus-service';\n\n@injectable()\nexport class NodeClient {\n @inject(NodeFocusService) nodeFocusService: NodeFocusService;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { FlowEditorClient } from '../clients';\n\nexport function useFlowEditor(): FlowEditorClient {\n return useService(FlowEditorClient);\n}\n"],"mappings":";;;;;;;;;;;;AAKA,OAAO;AACP,SAAS,mBAAmB;AAG5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd;AAAA,EAEE,cAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAC;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kBAAkB,kBAAwC;AAoBnE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;;;ACsEP,IAAU;AAAA,CAAV,CAAUC,iBAAV;AAIE,EAAMA,aAAA,UAAuB;AAAA,IAClC,YAAY,CAAC;AAAA,EACf;AAAA,GANe;;;AC9HjB,SAAS,6BAA6B,4BAA4B;AAClE,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,mCAAmC;AAC5C,SAAS,8BAAuD;;;ACThE,SAAS,uBAAAC,4BAA2B;;;ACApC,SAAS,uBAAAC,4BAA2B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AACA,UAAAA,KAAI,SAAS,KAAK,EAAE,KAAK,MAAM;AAC7B,gBAAI,KAAK,OAAQ,MAAK,OAAOA,IAAG;AAAA,UAClC,CAAC;AAAA,QACH;AAAA,QACA,UAAUA,MAAK;AACb,UAAAA,KAAI,SAAS,QAAQ;AAAA,QACvB;AAAA,QACA,kBAAkB;AAAA,MACpB,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;;;AW3GA,OAAO,SAAS,SAAS,mBAAmB;AAG5C,SAAS,oBAAoB;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;;;AhBkEA,cAAc;AAEd,SAAS,mCAAmC;","names":["injectable","inject","EditorProps","definePluginCreator","definePluginCreator","injectable","inject","inject","injectable","definePluginCreator","injectable","inject","Playground","inject","Playground","injectable","definePluginCreator","ctx","React","React"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
|
5
5
|
import { PluginContext, Plugin, PluginsProvider, PlaygroundConfigRevealOpts, Playground } from '@flowgram.ai/core';
|
|
6
6
|
export * from '@flowgram.ai/core';
|
|
7
7
|
export { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';
|
|
8
|
-
import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON
|
|
8
|
+
import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON } from '@flowgram.ai/document';
|
|
9
9
|
export * from '@flowgram.ai/document';
|
|
10
10
|
export * from '@flowgram.ai/renderer';
|
|
11
11
|
import { VariablePluginOptions } from '@flowgram.ai/variable-plugin';
|
|
@@ -37,45 +37,48 @@ interface EditorPluginContext extends PluginContext {
|
|
|
37
37
|
document: FlowDocument;
|
|
38
38
|
selection: SelectionService;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* 固定布局配置
|
|
42
|
-
*/
|
|
43
40
|
interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
|
|
44
41
|
/**
|
|
42
|
+
* Initialize data
|
|
45
43
|
* 初始化数据
|
|
46
44
|
*/
|
|
47
45
|
initialData?: JSON;
|
|
48
46
|
/**
|
|
47
|
+
* whether it is readonly
|
|
49
48
|
* 是否为 readonly
|
|
50
49
|
*/
|
|
51
50
|
readonly?: boolean;
|
|
52
51
|
/**
|
|
52
|
+
* node registries
|
|
53
53
|
* 节点定义
|
|
54
54
|
*/
|
|
55
55
|
nodeRegistries?: FlowNodeRegistry[];
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Get the default node registry, which will be merged with the 'nodeRegistries'
|
|
58
|
+
* 提供默认的节点注册,这个会和 nodeRegistries 做合并
|
|
58
59
|
*/
|
|
59
60
|
getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
|
|
60
61
|
/**
|
|
61
|
-
*
|
|
62
|
+
* Node engine configuration
|
|
62
63
|
*/
|
|
63
64
|
nodeEngine?: NodeCorePluginOptions & {
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* Default formMeta
|
|
66
67
|
*/
|
|
67
68
|
createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
|
|
68
69
|
/**
|
|
69
|
-
*
|
|
70
|
+
* Enable node engine
|
|
70
71
|
*/
|
|
71
72
|
enable?: boolean;
|
|
72
73
|
};
|
|
73
74
|
/**
|
|
75
|
+
* By default, all nodes are expanded
|
|
74
76
|
* 默认是否展开所有节点
|
|
75
77
|
*/
|
|
76
78
|
allNodesDefaultExpanded?: boolean;
|
|
77
79
|
/**
|
|
78
|
-
*
|
|
80
|
+
* Canvas material, Used to customize react components
|
|
81
|
+
* 画布物料, 用于自定义 react 组件
|
|
79
82
|
*/
|
|
80
83
|
materials?: MaterialsPluginOptions;
|
|
81
84
|
/**
|
|
@@ -85,49 +88,50 @@ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSO
|
|
|
85
88
|
onLoad?: (ctx: CTX) => void;
|
|
86
89
|
/**
|
|
87
90
|
* 是否开启变量引擎
|
|
91
|
+
* Variable engine enable
|
|
88
92
|
*/
|
|
89
93
|
variableEngine?: VariablePluginOptions;
|
|
90
94
|
/**
|
|
91
|
-
*
|
|
95
|
+
* Redo/Undo enable
|
|
92
96
|
*/
|
|
93
97
|
history?: HistoryPluginOptions<CTX> & {
|
|
94
98
|
disableShortcuts?: boolean;
|
|
95
99
|
};
|
|
96
100
|
/**
|
|
97
|
-
* redux
|
|
101
|
+
* redux devtool configuration
|
|
98
102
|
*/
|
|
99
103
|
reduxDevTool?: ReduxDevToolPluginOptions;
|
|
104
|
+
/**
|
|
105
|
+
* Scroll configuration
|
|
106
|
+
* 滚动配置
|
|
107
|
+
*/
|
|
100
108
|
scroll?: {
|
|
101
109
|
enableScrollLimit?: boolean;
|
|
102
110
|
disableScrollBar?: boolean;
|
|
103
111
|
disableScroll?: boolean;
|
|
104
112
|
};
|
|
105
113
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* -
|
|
114
|
+
* Node data transformation, called by ctx.document.fromJSON
|
|
115
|
+
* 节点数据转换, 由 ctx.document.fromJSON 调用
|
|
116
|
+
* @param node - current node
|
|
117
|
+
* @param json - Current node json data
|
|
109
118
|
*/
|
|
110
119
|
toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;
|
|
111
120
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* -
|
|
115
|
-
* -
|
|
121
|
+
* Node data transformation, called by ctx.document.toJSON
|
|
122
|
+
* 节点数据转换, 由 ctx.document.toJSON 调用
|
|
123
|
+
* @param node - current node
|
|
124
|
+
* @param json - Current node json data
|
|
125
|
+
* @param isFirstCreate - Whether it is created for the first time, If document.fromJSON is recalled, but the node already exists, isFirstCreate is false
|
|
116
126
|
*/
|
|
117
127
|
fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;
|
|
118
128
|
/**
|
|
129
|
+
* Canvas internal constant customization
|
|
119
130
|
* 画布内部常量自定义
|
|
120
131
|
*/
|
|
121
132
|
constants?: Record<string, any>;
|
|
122
133
|
/**
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];
|
|
126
|
-
/**
|
|
127
|
-
* 自定义节点 label
|
|
128
|
-
*/
|
|
129
|
-
formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];
|
|
130
|
-
/**
|
|
134
|
+
* i18n
|
|
131
135
|
* 国际化
|
|
132
136
|
*/
|
|
133
137
|
i18n?: I18nPluginOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
|
5
5
|
import { PluginContext, Plugin, PluginsProvider, PlaygroundConfigRevealOpts, Playground } from '@flowgram.ai/core';
|
|
6
6
|
export * from '@flowgram.ai/core';
|
|
7
7
|
export { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';
|
|
8
|
-
import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON
|
|
8
|
+
import { FlowDocument, FlowDocumentJSON, FlowNodeRegistry, FlowNodeType, FlowNodeEntity, FlowNodeJSON } from '@flowgram.ai/document';
|
|
9
9
|
export * from '@flowgram.ai/document';
|
|
10
10
|
export * from '@flowgram.ai/renderer';
|
|
11
11
|
import { VariablePluginOptions } from '@flowgram.ai/variable-plugin';
|
|
@@ -37,45 +37,48 @@ interface EditorPluginContext extends PluginContext {
|
|
|
37
37
|
document: FlowDocument;
|
|
38
38
|
selection: SelectionService;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* 固定布局配置
|
|
42
|
-
*/
|
|
43
40
|
interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSON = FlowDocumentJSON> extends PlaygroundReactProps<CTX> {
|
|
44
41
|
/**
|
|
42
|
+
* Initialize data
|
|
45
43
|
* 初始化数据
|
|
46
44
|
*/
|
|
47
45
|
initialData?: JSON;
|
|
48
46
|
/**
|
|
47
|
+
* whether it is readonly
|
|
49
48
|
* 是否为 readonly
|
|
50
49
|
*/
|
|
51
50
|
readonly?: boolean;
|
|
52
51
|
/**
|
|
52
|
+
* node registries
|
|
53
53
|
* 节点定义
|
|
54
54
|
*/
|
|
55
55
|
nodeRegistries?: FlowNodeRegistry[];
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Get the default node registry, which will be merged with the 'nodeRegistries'
|
|
58
|
+
* 提供默认的节点注册,这个会和 nodeRegistries 做合并
|
|
58
59
|
*/
|
|
59
60
|
getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;
|
|
60
61
|
/**
|
|
61
|
-
*
|
|
62
|
+
* Node engine configuration
|
|
62
63
|
*/
|
|
63
64
|
nodeEngine?: NodeCorePluginOptions & {
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* Default formMeta
|
|
66
67
|
*/
|
|
67
68
|
createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;
|
|
68
69
|
/**
|
|
69
|
-
*
|
|
70
|
+
* Enable node engine
|
|
70
71
|
*/
|
|
71
72
|
enable?: boolean;
|
|
72
73
|
};
|
|
73
74
|
/**
|
|
75
|
+
* By default, all nodes are expanded
|
|
74
76
|
* 默认是否展开所有节点
|
|
75
77
|
*/
|
|
76
78
|
allNodesDefaultExpanded?: boolean;
|
|
77
79
|
/**
|
|
78
|
-
*
|
|
80
|
+
* Canvas material, Used to customize react components
|
|
81
|
+
* 画布物料, 用于自定义 react 组件
|
|
79
82
|
*/
|
|
80
83
|
materials?: MaterialsPluginOptions;
|
|
81
84
|
/**
|
|
@@ -85,49 +88,50 @@ interface EditorProps<CTX extends EditorPluginContext = EditorPluginContext, JSO
|
|
|
85
88
|
onLoad?: (ctx: CTX) => void;
|
|
86
89
|
/**
|
|
87
90
|
* 是否开启变量引擎
|
|
91
|
+
* Variable engine enable
|
|
88
92
|
*/
|
|
89
93
|
variableEngine?: VariablePluginOptions;
|
|
90
94
|
/**
|
|
91
|
-
*
|
|
95
|
+
* Redo/Undo enable
|
|
92
96
|
*/
|
|
93
97
|
history?: HistoryPluginOptions<CTX> & {
|
|
94
98
|
disableShortcuts?: boolean;
|
|
95
99
|
};
|
|
96
100
|
/**
|
|
97
|
-
* redux
|
|
101
|
+
* redux devtool configuration
|
|
98
102
|
*/
|
|
99
103
|
reduxDevTool?: ReduxDevToolPluginOptions;
|
|
104
|
+
/**
|
|
105
|
+
* Scroll configuration
|
|
106
|
+
* 滚动配置
|
|
107
|
+
*/
|
|
100
108
|
scroll?: {
|
|
101
109
|
enableScrollLimit?: boolean;
|
|
102
110
|
disableScrollBar?: boolean;
|
|
103
111
|
disableScroll?: boolean;
|
|
104
112
|
};
|
|
105
113
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* -
|
|
114
|
+
* Node data transformation, called by ctx.document.fromJSON
|
|
115
|
+
* 节点数据转换, 由 ctx.document.fromJSON 调用
|
|
116
|
+
* @param node - current node
|
|
117
|
+
* @param json - Current node json data
|
|
109
118
|
*/
|
|
110
119
|
toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;
|
|
111
120
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* -
|
|
115
|
-
* -
|
|
121
|
+
* Node data transformation, called by ctx.document.toJSON
|
|
122
|
+
* 节点数据转换, 由 ctx.document.toJSON 调用
|
|
123
|
+
* @param node - current node
|
|
124
|
+
* @param json - Current node json data
|
|
125
|
+
* @param isFirstCreate - Whether it is created for the first time, If document.fromJSON is recalled, but the node already exists, isFirstCreate is false
|
|
116
126
|
*/
|
|
117
127
|
fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;
|
|
118
128
|
/**
|
|
129
|
+
* Canvas internal constant customization
|
|
119
130
|
* 画布内部常量自定义
|
|
120
131
|
*/
|
|
121
132
|
constants?: Record<string, any>;
|
|
122
133
|
/**
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
formatNodeLines?: (node: FlowNodeEntity, lines: FlowTransitionLine[]) => FlowTransitionLine[];
|
|
126
|
-
/**
|
|
127
|
-
* 自定义节点 label
|
|
128
|
-
*/
|
|
129
|
-
formatNodeLabels?: (node: FlowNodeEntity, lines: FlowTransitionLabel[]) => FlowTransitionLabel[];
|
|
130
|
-
/**
|
|
134
|
+
* i18n
|
|
131
135
|
* 国际化
|
|
132
136
|
*/
|
|
133
137
|
i18n?: I18nPluginOptions;
|
package/dist/index.js
CHANGED
|
@@ -111,15 +111,6 @@ var import_history_node_plugin = require("@flowgram.ai/history-node-plugin");
|
|
|
111
111
|
var import_document2 = require("@flowgram.ai/document");
|
|
112
112
|
var import_core6 = require("@flowgram.ai/core");
|
|
113
113
|
|
|
114
|
-
// src/utils/compose.ts
|
|
115
|
-
var compose = (fnList) => (node, data) => {
|
|
116
|
-
const list = fnList.filter(Boolean);
|
|
117
|
-
if (!list.length) {
|
|
118
|
-
return data;
|
|
119
|
-
}
|
|
120
|
-
return list.reduce((acc, fn) => fn(node, acc), data);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
114
|
// src/clients/flow-editor-client-plugins.ts
|
|
124
115
|
var import_core5 = require("@flowgram.ai/core");
|
|
125
116
|
|
|
@@ -346,18 +337,6 @@ function createDefaultPreset(opts, plugins = []) {
|
|
|
346
337
|
if (opts.constants) {
|
|
347
338
|
ctx2.document.options.constants = opts.constants;
|
|
348
339
|
}
|
|
349
|
-
if (opts.formatNodeLines) {
|
|
350
|
-
ctx2.document.options.formatNodeLines = compose([
|
|
351
|
-
ctx2.document.options.formatNodeLines,
|
|
352
|
-
opts.formatNodeLines
|
|
353
|
-
]);
|
|
354
|
-
}
|
|
355
|
-
if (opts.formatNodeLabels) {
|
|
356
|
-
ctx2.document.options.formatNodeLabels = compose([
|
|
357
|
-
ctx2.document.options.formatNodeLabels,
|
|
358
|
-
opts.formatNodeLabels
|
|
359
|
-
]);
|
|
360
|
-
}
|
|
361
340
|
if (opts.getNodeDefaultRegistry) {
|
|
362
341
|
ctx2.document.options.getNodeDefaultRegistry = opts.getNodeDefaultRegistry;
|
|
363
342
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/preset/editor-props.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":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport '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';\nexport {\n type interfaces,\n injectable,\n postConstruct,\n named,\n Container,\n ContainerModule,\n AsyncContainerModule,\n inject,\n multiInject,\n} from 'inversify';\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 IForm,\n Errors,\n Warnings,\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 FeedbackLevel,\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\nexport { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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 { 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\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 enableScrollLimit?: boolean; // 开启滚动限制\n disableScrollBar?: boolean; // 关闭滚动条\n disableScroll?: boolean; // 禁止滚动\n };\n\n /**\n * 节点数据导出\n * - node 当前节点\n * - json 当前节点数据\n */\n toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;\n /**\n * 节点数据导入\n * - node 当前节点\n * - json 当前节点数据\n * - isFirstCreate 是否是第一次创建\n */\n fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;\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 };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { interfaces } from 'inversify';\nimport { FlowRendererContainerModule, FlowRendererRegistry } from '@flowgram.ai/renderer';\nimport { createReduxDevToolPlugin } from '@flowgram.ai/redux-devtool-plugin';\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 { 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 /**\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 plugins;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const DEFAULT_HIGHLIGHT_COLOR = 'rgba(238, 245, 40, 0.5)';\nexport const DEFAULT_HIGHLIGHT_PADDING = 0;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable, inject } from 'inversify';\n\nimport { NodeFocusService } from './node-focus-service';\n\n@injectable()\nexport class NodeClient {\n @inject(NodeFocusService) nodeFocusService: NodeFocusService;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { FlowEditorClient } from '../clients';\n\nexport function useFlowEditor(): FlowEditorClient {\n return useService(FlowEditorClient);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,8BAAO;AACP,kBAA4B;AAG5B,wBAAc,+BATd;AAUA,wBAAc,8BAVd;AAWA,wBAAc,kCAXd;AAYA,wBAAc,kCAZd;AAaA,wBAAc,yCAbd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B,IAAAC,eAIO;AAIA,IAAM,iBAAwC,CAAC,UAAuB;AAC3E,QAAM,EAAE,UAAU,GAAG,OAAO,IAAI;AAChC,QAAM,aAAS,uBAAQ,MAAM,oBAAoB,MAAM,GAAG,CAAC,CAAC;AAC5D,QAAM,0BAAsB;AAAA,IAC1B,CAAC,eACE;AAAA,MACC,OAAG,yCAA2B,SAAS;AAAA,MACvC,IAAI,WAAyB;AAC3B,eAAO,UAAU,IAAkB,6BAAY;AAAA,MACjD;AAAA,MACA,IAAI,YAA8B;AAChC,eAAO,UAAU,IAAsB,6BAAgB;AAAA,MACzD;AAAA,IACF;AAAA,IACF,CAAC;AAAA,EACH;AACA,SACE,8BAAAC,QAAA,cAAC,wCAAwB,SAAS,QAAQ,uBACvC,QACH;AAEJ;;;ACjCA,IAAAC,eAA0D;;;ACA1D,IAAAC,gBAAkB;AAWX,IAAM,SAAgC,CAAC,UAAuB;AACnE,QAAM,EAAE,UAAU,GAAG,WAAW,IAAI;AACpC,SACE,8BAAAC,QAAA,cAAC,kBAAgB,GAAG,cAClB,8BAAAA,QAAA,cAAC,4CAAgB,QAAS,CAC5B;AAEJ;;;AClBA,IAAAC,eAA2B;AAIpB,SAAS,gBAAkC;AAChD,aAAO,yBAAW,gBAAgB;AACpC;;;AjBkEA,wBAAc,8CA7Ed;AA+EA,8BAA4C;","names":["import_inversify","EditorProps","import_document","import_core","import_core","import_core","import_inversify","import_core","import_inversify","import_core","ctx","import_react","import_document","import_core","React","import_core","import_react","React","import_core"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/preset/editor-props.ts","../src/preset/editor-default-preset.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":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport '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';\nexport {\n type interfaces,\n injectable,\n postConstruct,\n named,\n Container,\n ContainerModule,\n AsyncContainerModule,\n inject,\n multiInject,\n} from 'inversify';\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 IForm,\n Errors,\n Warnings,\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 FeedbackLevel,\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\nexport { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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 { FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';\nimport {\n FlowDocument,\n FlowDocumentJSON,\n FlowNodeEntity,\n type FlowNodeJSON,\n FlowNodeRegistry,\n FlowNodeType,\n} from '@flowgram.ai/document';\nimport { PluginContext } from '@flowgram.ai/core';\n\nexport interface EditorPluginContext extends PluginContext {\n document: FlowDocument;\n selection: SelectionService;\n}\n\nexport interface EditorProps<\n CTX extends EditorPluginContext = EditorPluginContext,\n JSON = FlowDocumentJSON\n> extends PlaygroundReactProps<CTX> {\n /**\n * Initialize data\n * 初始化数据\n */\n initialData?: JSON;\n /**\n * whether it is readonly\n * 是否为 readonly\n */\n readonly?: boolean;\n /**\n * node registries\n * 节点定义\n */\n nodeRegistries?: FlowNodeRegistry[];\n /**\n * Get the default node registry, which will be merged with the 'nodeRegistries'\n * 提供默认的节点注册,这个会和 nodeRegistries 做合并\n */\n getNodeDefaultRegistry?: (type: FlowNodeType) => FlowNodeRegistry;\n /**\n * Node engine configuration\n */\n nodeEngine?: NodeCorePluginOptions & {\n /**\n * Default formMeta\n */\n createDefaultFormMeta?: (node: FlowNodeEntity) => FormMetaOrFormMetaGenerator;\n /**\n * Enable node engine\n */\n enable?: boolean;\n };\n /**\n * By default, all nodes are expanded\n * 默认是否展开所有节点\n */\n allNodesDefaultExpanded?: boolean;\n /**\n * Canvas material, Used to customize react components\n * 画布物料, 用于自定义 react 组件\n */\n materials?: MaterialsPluginOptions;\n /**\n * 画布数据加载完成, 请使用 onAllLayersRendered 替代\n * @deprecated\n * */\n onLoad?: (ctx: CTX) => void;\n /**\n * 是否开启变量引擎\n * Variable engine enable\n */\n variableEngine?: VariablePluginOptions;\n /**\n * Redo/Undo enable\n */\n history?: HistoryPluginOptions<CTX> & { disableShortcuts?: boolean };\n\n /**\n * redux devtool configuration\n */\n reduxDevTool?: ReduxDevToolPluginOptions;\n\n /**\n * Scroll configuration\n * 滚动配置\n */\n scroll?: {\n enableScrollLimit?: boolean; // 开启滚动限制\n disableScrollBar?: boolean; // 关闭滚动条\n disableScroll?: boolean; // 禁止滚动\n };\n\n /**\n * Node data transformation, called by ctx.document.fromJSON\n * 节点数据转换, 由 ctx.document.fromJSON 调用\n * @param node - current node\n * @param json - Current node json data\n */\n toNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON): FlowNodeJSON;\n /**\n * Node data transformation, called by ctx.document.toJSON\n * 节点数据转换, 由 ctx.document.toJSON 调用\n * @param node - current node\n * @param json - Current node json data\n * @param isFirstCreate - Whether it is created for the first time, If document.fromJSON is recalled, but the node already exists, isFirstCreate is false\n */\n fromNodeJSON?(node: FlowNodeEntity, json: FlowNodeJSON, isFirstCreate: boolean): FlowNodeJSON;\n /**\n * Canvas internal constant customization\n * 画布内部常量自定义\n */\n constants?: Record<string, any>;\n /**\n * i18n\n * 国际化\n */\n i18n?: I18nPluginOptions;\n}\n\nexport namespace EditorProps {\n /**\n * 默认配置\n */\n export const DEFAULT: EditorProps = {\n background: {},\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { interfaces } from 'inversify';\nimport { FlowRendererContainerModule, FlowRendererRegistry } from '@flowgram.ai/renderer';\nimport { createReduxDevToolPlugin } from '@flowgram.ai/redux-devtool-plugin';\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 { 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 /**\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 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 plugins;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const DEFAULT_HIGHLIGHT_COLOR = 'rgba(238, 245, 40, 0.5)';\nexport const DEFAULT_HIGHLIGHT_PADDING = 0;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable, inject } from 'inversify';\n\nimport { NodeFocusService } from './node-focus-service';\n\n@injectable()\nexport class NodeClient {\n @inject(NodeFocusService) nodeFocusService: NodeFocusService;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport { PlaygroundReactRenderer as EditorRenderer } from '@flowgram.ai/core';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport 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","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram.ai/core';\n\nimport { FlowEditorClient } from '../clients';\n\nexport function useFlowEditor(): FlowEditorClient {\n return useService(FlowEditorClient);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,8BAAO;AACP,kBAA4B;AAG5B,wBAAc,+BATd;AAUA,wBAAc,8BAVd;AAWA,wBAAc,kCAXd;AAYA,wBAAc,kCAZd;AAaA,wBAAc,yCAbd;AAcA,wBAAc,0CAdd;AAeA,wBAAc,0CAfd;AAgBA,wBAAc,qCAhBd;AAiBA,IAAAA,oBAUO;AAEP,uBAAmE;AAoBnE,kBAYO;AACP,wBAAc,8BA9Dd;;;ACoIO,IAAU;AAAA,CAAV,CAAUC,iBAAV;AAIE,EAAMA,aAAA,UAAuB;AAAA,IAClC,YAAY,CAAC;AAAA,EACf;AAAA,GANe;;;AC9HjB,sBAAkE;AAClE,kCAAyC;AACzC,kCAAyC;AACzC,8BAAqC;AACrC,8BAAsC;AACtC,yBAAiC;AACjC,iCAAwC;AACxC,IAAAC,mBAA4C;AAC5C,IAAAC,eAAgE;;;ACThE,IAAAC,eAAoC;;;ACApC,IAAAC,eAAoC;;;ACApC,uBAAmC;AAEnC,kBAAuD;;;ACDvD,sBAAmC;;;ACD5B,IAAM,sBAAsB;AAEnC,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAiBf,mBAAmB;AAAA;AAAA;AAAA;AA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C,IAAAC,mBAA6B;AAC7B,IAAAC,eAIO;AAIA,IAAM,iBAAwC,CAAC,UAAuB;AAC3E,QAAM,EAAE,UAAU,GAAG,OAAO,IAAI;AAChC,QAAM,aAAS,uBAAQ,MAAM,oBAAoB,MAAM,GAAG,CAAC,CAAC;AAC5D,QAAM,0BAAsB;AAAA,IAC1B,CAAC,eACE;AAAA,MACC,OAAG,yCAA2B,SAAS;AAAA,MACvC,IAAI,WAAyB;AAC3B,eAAO,UAAU,IAAkB,6BAAY;AAAA,MACjD;AAAA,MACA,IAAI,YAA8B;AAChC,eAAO,UAAU,IAAsB,6BAAgB;AAAA,MACzD;AAAA,IACF;AAAA,IACF,CAAC;AAAA,EACH;AACA,SACE,8BAAAC,QAAA,cAAC,wCAAwB,SAAS,QAAQ,uBACvC,QACH;AAEJ;;;ACjCA,IAAAC,eAA0D;;;ACA1D,IAAAC,gBAAkB;AAWX,IAAM,SAAgC,CAAC,UAAuB;AACnE,QAAM,EAAE,UAAU,GAAG,WAAW,IAAI;AACpC,SACE,8BAAAC,QAAA,cAAC,kBAAgB,GAAG,cAClB,8BAAAA,QAAA,cAAC,4CAAgB,QAAS,CAC5B;AAEJ;;;AClBA,IAAAC,eAA2B;AAIpB,SAAS,gBAAkC;AAChD,aAAO,yBAAW,gBAAgB;AACpC;;;AhBkEA,wBAAc,8CA7Ed;AA+EA,8BAA4C;","names":["import_inversify","EditorProps","import_document","import_core","import_core","import_core","import_inversify","import_core","import_inversify","import_core","ctx","import_react","import_document","import_core","React","import_core","import_react","React","import_core"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/editor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,25 +18,25 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"inversify": "^6.0.1",
|
|
20
20
|
"reflect-metadata": "~0.2.2",
|
|
21
|
-
"@flowgram.ai/
|
|
22
|
-
"@flowgram.ai/
|
|
23
|
-
"@flowgram.ai/document": "0.3.
|
|
24
|
-
"@flowgram.ai/form
|
|
25
|
-
"@flowgram.ai/form": "0.3.
|
|
26
|
-
"@flowgram.ai/group-plugin": "0.3.
|
|
27
|
-
"@flowgram.ai/history": "0.3.
|
|
28
|
-
"@flowgram.ai/
|
|
29
|
-
"@flowgram.ai/
|
|
30
|
-
"@flowgram.ai/
|
|
31
|
-
"@flowgram.ai/node": "0.3.
|
|
32
|
-
"@flowgram.ai/node-
|
|
33
|
-
"@flowgram.ai/
|
|
34
|
-
"@flowgram.ai/
|
|
35
|
-
"@flowgram.ai/
|
|
36
|
-
"@flowgram.ai/
|
|
37
|
-
"@flowgram.ai/
|
|
38
|
-
"@flowgram.ai/utils": "0.3.
|
|
39
|
-
"@flowgram.ai/variable-plugin": "0.3.
|
|
21
|
+
"@flowgram.ai/background-plugin": "0.3.6",
|
|
22
|
+
"@flowgram.ai/core": "0.3.6",
|
|
23
|
+
"@flowgram.ai/document": "0.3.6",
|
|
24
|
+
"@flowgram.ai/form": "0.3.6",
|
|
25
|
+
"@flowgram.ai/form-core": "0.3.6",
|
|
26
|
+
"@flowgram.ai/group-plugin": "0.3.6",
|
|
27
|
+
"@flowgram.ai/history": "0.3.6",
|
|
28
|
+
"@flowgram.ai/i18n-plugin": "0.3.6",
|
|
29
|
+
"@flowgram.ai/materials-plugin": "0.3.6",
|
|
30
|
+
"@flowgram.ai/node": "0.3.6",
|
|
31
|
+
"@flowgram.ai/history-node-plugin": "0.3.6",
|
|
32
|
+
"@flowgram.ai/node-core-plugin": "0.3.6",
|
|
33
|
+
"@flowgram.ai/playground-react": "0.3.6",
|
|
34
|
+
"@flowgram.ai/node-variable-plugin": "0.3.6",
|
|
35
|
+
"@flowgram.ai/redux-devtool-plugin": "0.3.6",
|
|
36
|
+
"@flowgram.ai/renderer": "0.3.6",
|
|
37
|
+
"@flowgram.ai/shortcuts-plugin": "0.3.6",
|
|
38
|
+
"@flowgram.ai/utils": "0.3.6",
|
|
39
|
+
"@flowgram.ai/variable-plugin": "0.3.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/bezier-js": "4.1.3",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"tsup": "^8.0.1",
|
|
51
51
|
"typescript": "^5.8.3",
|
|
52
52
|
"vitest": "^0.34.6",
|
|
53
|
-
"@flowgram.ai/
|
|
54
|
-
"@flowgram.ai/
|
|
53
|
+
"@flowgram.ai/ts-config": "0.3.6",
|
|
54
|
+
"@flowgram.ai/eslint-config": "0.3.6"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": ">=16.8",
|