chore(svelte/selection): add class name and styles

This commit is contained in:
moklick
2025-10-28 15:44:39 +01:00
parent 2a2857852d
commit 3c609e0122
2 changed files with 11 additions and 3 deletions
@@ -85,7 +85,7 @@
onkeydown={store.disableKeyboardA11y ? undefined : onkeydown} onkeydown={store.disableKeyboardA11y ? undefined : onkeydown}
bind:this={ref} bind:this={ref}
> >
<Selection width="100%" height="100%" x={0} y={0} /> <Selection width="100%" height="100%" x={0} y={0} class="svelte-flow__nodesselection-rect" />
</div> </div>
{/if} {/if}
@@ -97,4 +97,9 @@
z-index: 2000; z-index: 2000;
pointer-events: all; pointer-events: all;
} }
.svelte-flow__selection-wrapper:focus,
.svelte-flow__selection-wrapper:focus-visible {
outline: none;
}
</style> </style>
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import type { ClassValue } from 'svelte/elements';
import { toPxString } from '$lib/utils'; import { toPxString } from '$lib/utils';
let { let {
@@ -6,19 +7,21 @@
y = 0, y = 0,
width = 0, width = 0,
height = 0, height = 0,
isVisible = true isVisible = true,
...props
}: { }: {
x?: number; x?: number;
y?: number; y?: number;
width?: number | string; width?: number | string;
height?: number | string; height?: number | string;
isVisible?: boolean; isVisible?: boolean;
class?: ClassValue;
} = $props(); } = $props();
</script> </script>
{#if isVisible} {#if isVisible}
<div <div
class="svelte-flow__selection" class={['svelte-flow__selection', props.class]}
style:width={typeof width === 'string' ? width : toPxString(width)} style:width={typeof width === 'string' ? width : toPxString(width)}
style:height={typeof height === 'string' ? height : toPxString(height)} style:height={typeof height === 'string' ? height : toPxString(height)}
style:transform={`translate(${x}px, ${y}px)`} style:transform={`translate(${x}px, ${y}px)`}