chore(a11y): pass LabelConfig values through store SvelteFlow
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { page } from '$app/stores';
|
||||
|
||||
const routes = [
|
||||
'a11y',
|
||||
'add-node-on-drop',
|
||||
'color-mode',
|
||||
'custom-connection-line',
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
SvelteFlow,
|
||||
Controls,
|
||||
Background,
|
||||
MiniMap,
|
||||
} from '@xyflow/svelte';
|
||||
|
||||
import '@xyflow/svelte/dist/style.css';
|
||||
|
||||
|
||||
let nodes = $state.raw([
|
||||
{
|
||||
id: 'A',
|
||||
position: { x: 0, y: 0 },
|
||||
data: { label: 'A' },
|
||||
|
||||
},
|
||||
{ id: 'B', position: { x: -100, y: 150 }, data: { label: 'B' } },
|
||||
{ id: 'C', position: { x: 100, y: 150 }, data: { label: 'C' } },
|
||||
{ id: 'D', position: { x: 0, y: 260 }, data: { label: 'D' } }
|
||||
]);
|
||||
|
||||
let edges = $state.raw([
|
||||
{ id: 'A-B', source: 'A', target: 'B' },
|
||||
{ id: 'A-C', source: 'A', target: 'C' },
|
||||
{ id: 'A-D', source: 'A', target: 'D' }
|
||||
]);
|
||||
|
||||
</script>
|
||||
|
||||
<SvelteFlow bind:nodes bind:edges fitView labelConfig={{
|
||||
'a11yDescription.node.default': 'Svelte Custom node description',
|
||||
'a11yDescription.node.keyboardDisabled': 'Svelte Custom keyboard-disabled node description',
|
||||
'a11yDescription.edge.default': 'Svelte Custom edge description',
|
||||
}}>
|
||||
<Controls />
|
||||
<Background />
|
||||
<MiniMap />
|
||||
</SvelteFlow>
|
||||
@@ -220,11 +220,6 @@
|
||||
console.log('on selection changed via prop', { nodes, edges });
|
||||
}}
|
||||
selectNodesOnDrag
|
||||
labelConfig={{
|
||||
'a11yDescription.node.default': 'Svelte Custom Node Description.',
|
||||
'a11yDescription.node.keyboardDisabled': 'Svelte Custom Keyboard Description',
|
||||
'a11yDescription.edge.default': 'Svelte Custom Edge Desc.',
|
||||
}}
|
||||
>
|
||||
<Controls orientation="horizontal" {fitViewOptions}>
|
||||
{#snippet before()}
|
||||
|
||||
Reference in New Issue
Block a user