UNPKG

@ant-design/pro-flow

Version:
29 lines 846 B
import { memo } from 'react'; import { ReactFlowProvider } from 'reactflow'; import { createFlowEditorStore, Provider, useStoreApi } from "../store"; import { Fragment as _Fragment } from "react/jsx-runtime"; import { jsx as _jsx } from "react/jsx-runtime"; export var FlowEditorProvider = /*#__PURE__*/memo(function (_ref) { var children = _ref.children, showDevtools = _ref.showDevtools; var isWrapped = true; var Content = /*#__PURE__*/_jsx(_Fragment, { children: children }); try { useStoreApi(); } catch (e) { isWrapped = false; } if (isWrapped) { return Content; } return /*#__PURE__*/_jsx(ReactFlowProvider, { children: /*#__PURE__*/_jsx(Provider, { createStore: function createStore() { return createFlowEditorStore(showDevtools); }, children: Content }) }); });