update examples
This commit is contained in:
@@ -198,20 +198,22 @@ const initialEdges: Edge[] = [
|
|||||||
id: 'e4-11',
|
id: 'e4-11',
|
||||||
source: '4',
|
source: '4',
|
||||||
target: '11',
|
target: '11',
|
||||||
label: 'Explicit Red Color (should override CSS)',
|
label: 'Explicit Blue Prop Color (should override CSS)',
|
||||||
|
className: 'css-variable-edge',
|
||||||
markerEnd: {
|
markerEnd: {
|
||||||
type: MarkerType.ArrowClosed,
|
type: MarkerType.ArrowClosed,
|
||||||
color: '#ff0000',
|
color: '#0000ff',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e4-12',
|
id: 'e4-12',
|
||||||
source: '4',
|
source: '4',
|
||||||
target: '12',
|
target: '12',
|
||||||
label: 'No Explicit Color (should use CSS variable)',
|
label: 'Marker No Prop Color (should use CSS variable)',
|
||||||
|
className: 'css-variable-edge',
|
||||||
markerEnd: {
|
markerEnd: {
|
||||||
type: MarkerType.ArrowClosed,
|
type: MarkerType.ArrowClosed,
|
||||||
color: null,
|
color: undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -240,10 +242,12 @@ const EdgesFlow = () => {
|
|||||||
<div style={{ height: '100vh' }}>
|
<div style={{ height: '100vh' }}>
|
||||||
<style>
|
<style>
|
||||||
{`
|
{`
|
||||||
|
/* Test CSS variables on specific edges */
|
||||||
.react-flow {
|
.react-flow {
|
||||||
--xy-edge-stroke-width: 4;
|
--xy-edge-stroke-width: 1;
|
||||||
--xy-edge-stroke: #00ff00;
|
--xy-edge-stroke: #00ff00;
|
||||||
}
|
}
|
||||||
|
|
||||||
`}
|
`}
|
||||||
</style>
|
</style>
|
||||||
<ReactFlow
|
<ReactFlow
|
||||||
|
|||||||
@@ -146,20 +146,19 @@
|
|||||||
id: 'e4-10',
|
id: 'e4-10',
|
||||||
source: '4',
|
source: '4',
|
||||||
target: '10',
|
target: '10',
|
||||||
label: 'Explicit Red Color (should override CSS)',
|
label: 'Explicit Prop Blue Color (should override CSS)',
|
||||||
markerEnd: {
|
markerEnd: {
|
||||||
type: MarkerType.ArrowClosed,
|
type: MarkerType.ArrowClosed,
|
||||||
color: '#ff0000'
|
color: '#0000ff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e4-11',
|
id: 'e4-11',
|
||||||
source: '4',
|
source: '4',
|
||||||
target: '11',
|
target: '11',
|
||||||
label: 'No Explicit Color (should use CSS variable)',
|
label: 'Marker No Prop Color (should use CSS variable)',
|
||||||
markerEnd: {
|
markerEnd: {
|
||||||
type: MarkerType.ArrowClosed,
|
type: MarkerType.ArrowClosed,
|
||||||
// To use CSS variable, set color to null
|
|
||||||
color: null
|
color: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,6 +173,15 @@
|
|||||||
return `edge-${connection.source}-${connection.target}}`;
|
return `edge-${connection.source}-${connection.target}}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultEdgeOptions = {
|
||||||
|
markerEnd: {
|
||||||
|
type: MarkerType.ArrowClosed,
|
||||||
|
color: 'red',
|
||||||
|
width: 20,
|
||||||
|
height: 20
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$inspect(edges);
|
$inspect(edges);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -182,6 +190,7 @@
|
|||||||
bind:edges
|
bind:edges
|
||||||
{edgeTypes}
|
{edgeTypes}
|
||||||
fitView
|
fitView
|
||||||
|
{defaultEdgeOptions}
|
||||||
nodeDragThreshold={2}
|
nodeDragThreshold={2}
|
||||||
onbeforeconnect={(connection) => {
|
onbeforeconnect={(connection) => {
|
||||||
console.log('on edge create', connection);
|
console.log('on edge create', connection);
|
||||||
@@ -198,8 +207,9 @@
|
|||||||
</SvelteFlow>
|
</SvelteFlow>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
/* Test CSS variables on the marker SVG container */
|
||||||
:global(.svelte-flow) {
|
:global(.svelte-flow) {
|
||||||
--xy-edge-stroke-width: 4;
|
--xy-edge-stroke-width: 1;
|
||||||
--xy-edge-stroke: #00ff00;
|
--xy-edge-stroke: #00ff00;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user