@uipath/apollo-react 3.52.0 → 3.52.1
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.
|
@@ -43,52 +43,6 @@ const react_namespaceObject = require("@emotion/react");
|
|
|
43
43
|
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
|
|
44
44
|
const external_react_namespaceObject = require("react");
|
|
45
45
|
const BaseCanvas_constants_cjs_namespaceObject = require("../../BaseCanvas/BaseCanvas.constants.cjs");
|
|
46
|
-
const getReactFlowCSS = ()=>{
|
|
47
|
-
const stylesheets = Array.from(document.styleSheets);
|
|
48
|
-
let reactFlowCSS = '';
|
|
49
|
-
for (const stylesheet of stylesheets)try {
|
|
50
|
-
if (stylesheet.cssRules) {
|
|
51
|
-
const rules = Array.from(stylesheet.cssRules);
|
|
52
|
-
const reactFlowRules = rules.filter((rule)=>{
|
|
53
|
-
if (rule instanceof CSSStyleRule) return rule.selectorText && rule.selectorText.includes('react-flow');
|
|
54
|
-
return false;
|
|
55
|
-
});
|
|
56
|
-
if (reactFlowRules.length > 0) reactFlowCSS += reactFlowRules.map((rule)=>rule.cssText).join('\n');
|
|
57
|
-
}
|
|
58
|
-
} catch {}
|
|
59
|
-
return reactFlowCSS;
|
|
60
|
-
};
|
|
61
|
-
const injectReactFlowStyles = (container)=>{
|
|
62
|
-
const existingStyle = container.querySelector('style[data-reactflow-style="true"]');
|
|
63
|
-
if (existingStyle) return;
|
|
64
|
-
const style = document.createElement('style');
|
|
65
|
-
style.dataset.reactflowStyle = 'true';
|
|
66
|
-
style.textContent = getReactFlowCSS();
|
|
67
|
-
if (container.firstChild) container.insertBefore(style, container.firstChild);
|
|
68
|
-
else container.append(style);
|
|
69
|
-
};
|
|
70
|
-
const injectCSSVariables = (container)=>{
|
|
71
|
-
const existingVars = container.querySelector('style[data-css-variables="true"]');
|
|
72
|
-
if (existingVars) return;
|
|
73
|
-
const rootStyles = getComputedStyle(document.documentElement);
|
|
74
|
-
const cssVariables = [];
|
|
75
|
-
const varPrefixes = [
|
|
76
|
-
'--color',
|
|
77
|
-
'--spacing',
|
|
78
|
-
'--font',
|
|
79
|
-
'--shadow',
|
|
80
|
-
'--border'
|
|
81
|
-
];
|
|
82
|
-
for (const property of Array.from(rootStyles))if (varPrefixes.some((prefix)=>property.startsWith(prefix))) {
|
|
83
|
-
const value = rootStyles.getPropertyValue(property);
|
|
84
|
-
if (value) cssVariables.push(`${property}: ${value};`);
|
|
85
|
-
}
|
|
86
|
-
const style = document.createElement('style');
|
|
87
|
-
style.dataset.cssVariables = 'true';
|
|
88
|
-
style.textContent = `:host { ${cssVariables.join(' ')} }`;
|
|
89
|
-
if (container.firstChild) container.insertBefore(style, container.firstChild);
|
|
90
|
-
else container.append(style);
|
|
91
|
-
};
|
|
92
46
|
const AgentFlowProviderContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(null);
|
|
93
47
|
const AgentVisualizationFlowProviderInner = ({ children, styleContainer, fitViewOptions })=>{
|
|
94
48
|
const reactFlow = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
@@ -101,14 +55,6 @@ const AgentVisualizationFlowProviderInner = ({ children, styleContainer, fitView
|
|
|
101
55
|
}, [
|
|
102
56
|
styleContainer
|
|
103
57
|
]);
|
|
104
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
105
|
-
if (styleContainer) {
|
|
106
|
-
injectCSSVariables(styleContainer);
|
|
107
|
-
injectReactFlowStyles(styleContainer);
|
|
108
|
-
}
|
|
109
|
-
}, [
|
|
110
|
-
styleContainer
|
|
111
|
-
]);
|
|
112
58
|
const resetViewport = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
113
59
|
reactFlow.fitView(fitViewOptions ?? BaseCanvas_constants_cjs_namespaceObject.BASE_CANVAS_DEFAULTS.fitViewOptions);
|
|
114
60
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentFlowProvider.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/AgentCanvas/providers/AgentFlowProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"AgentFlowProvider.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/AgentCanvas/providers/AgentFlowProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAEhG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF,UAAU,4BAA4B;IACpC,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AA0CD,UAAU,mCAAoC,SAAQ,iBAAiB;IAMrE,cAAc,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IAC1C,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C;AAED,eAAO,MAAM,8BAA8B,GAAI,8CAI5C,mCAAmC,4CAQrC,CAAC;AAEF,eAAO,MAAM,YAAY,oCAMxB,CAAC"}
|
|
@@ -2,54 +2,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import cache from "@emotion/cache";
|
|
3
3
|
import { CacheProvider } from "@emotion/react";
|
|
4
4
|
import { ReactFlowProvider, useReactFlow } from "../../../xyflow/react.js";
|
|
5
|
-
import { createContext, useCallback, useContext,
|
|
5
|
+
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
6
6
|
import { BASE_CANVAS_DEFAULTS } from "../../BaseCanvas/BaseCanvas.constants.js";
|
|
7
|
-
const getReactFlowCSS = ()=>{
|
|
8
|
-
const stylesheets = Array.from(document.styleSheets);
|
|
9
|
-
let reactFlowCSS = '';
|
|
10
|
-
for (const stylesheet of stylesheets)try {
|
|
11
|
-
if (stylesheet.cssRules) {
|
|
12
|
-
const rules = Array.from(stylesheet.cssRules);
|
|
13
|
-
const reactFlowRules = rules.filter((rule)=>{
|
|
14
|
-
if (rule instanceof CSSStyleRule) return rule.selectorText && rule.selectorText.includes('react-flow');
|
|
15
|
-
return false;
|
|
16
|
-
});
|
|
17
|
-
if (reactFlowRules.length > 0) reactFlowCSS += reactFlowRules.map((rule)=>rule.cssText).join('\n');
|
|
18
|
-
}
|
|
19
|
-
} catch {}
|
|
20
|
-
return reactFlowCSS;
|
|
21
|
-
};
|
|
22
|
-
const injectReactFlowStyles = (container)=>{
|
|
23
|
-
const existingStyle = container.querySelector('style[data-reactflow-style="true"]');
|
|
24
|
-
if (existingStyle) return;
|
|
25
|
-
const style = document.createElement('style');
|
|
26
|
-
style.dataset.reactflowStyle = 'true';
|
|
27
|
-
style.textContent = getReactFlowCSS();
|
|
28
|
-
if (container.firstChild) container.insertBefore(style, container.firstChild);
|
|
29
|
-
else container.append(style);
|
|
30
|
-
};
|
|
31
|
-
const injectCSSVariables = (container)=>{
|
|
32
|
-
const existingVars = container.querySelector('style[data-css-variables="true"]');
|
|
33
|
-
if (existingVars) return;
|
|
34
|
-
const rootStyles = getComputedStyle(document.documentElement);
|
|
35
|
-
const cssVariables = [];
|
|
36
|
-
const varPrefixes = [
|
|
37
|
-
'--color',
|
|
38
|
-
'--spacing',
|
|
39
|
-
'--font',
|
|
40
|
-
'--shadow',
|
|
41
|
-
'--border'
|
|
42
|
-
];
|
|
43
|
-
for (const property of Array.from(rootStyles))if (varPrefixes.some((prefix)=>property.startsWith(prefix))) {
|
|
44
|
-
const value = rootStyles.getPropertyValue(property);
|
|
45
|
-
if (value) cssVariables.push(`${property}: ${value};`);
|
|
46
|
-
}
|
|
47
|
-
const style = document.createElement('style');
|
|
48
|
-
style.dataset.cssVariables = 'true';
|
|
49
|
-
style.textContent = `:host { ${cssVariables.join(' ')} }`;
|
|
50
|
-
if (container.firstChild) container.insertBefore(style, container.firstChild);
|
|
51
|
-
else container.append(style);
|
|
52
|
-
};
|
|
53
7
|
const AgentFlowProviderContext = /*#__PURE__*/ createContext(null);
|
|
54
8
|
const AgentVisualizationFlowProviderInner = ({ children, styleContainer, fitViewOptions })=>{
|
|
55
9
|
const reactFlow = useReactFlow();
|
|
@@ -62,14 +16,6 @@ const AgentVisualizationFlowProviderInner = ({ children, styleContainer, fitView
|
|
|
62
16
|
}, [
|
|
63
17
|
styleContainer
|
|
64
18
|
]);
|
|
65
|
-
useEffect(()=>{
|
|
66
|
-
if (styleContainer) {
|
|
67
|
-
injectCSSVariables(styleContainer);
|
|
68
|
-
injectReactFlowStyles(styleContainer);
|
|
69
|
-
}
|
|
70
|
-
}, [
|
|
71
|
-
styleContainer
|
|
72
|
-
]);
|
|
73
19
|
const resetViewport = useCallback(()=>{
|
|
74
20
|
reactFlow.fitView(fitViewOptions ?? BASE_CANVAS_DEFAULTS.fitViewOptions);
|
|
75
21
|
}, [
|