minimize inline style usage

This commit is contained in:
peterkogo
2025-04-15 12:57:34 +02:00
parent 2ca682c6f2
commit 1fa3b50366
18 changed files with 65 additions and 91 deletions
@@ -37,8 +37,8 @@
zoomable = true,
inversePan,
zoomStep,
style = '',
class: className
class: className,
...rest
}: MiniMapProps = $props();
let store = useStore();
@@ -83,9 +83,10 @@
<Panel
{position}
style={style + (bgColor ? `;--xy-minimap-background-color-props:${bgColor}` : '')}
class={['svelte-flow__minimap', className]}
data-testid="svelte-flow__minimap"
--xy-minimap-background-color-props={bgColor}
{...rest}
>
{#if store.panZoom}
<svg
@@ -37,8 +37,8 @@
ry={borderRadius}
{width}
{height}
style={`${color ? `fill: ${color};` : ''}${strokeColor ? `stroke: ${strokeColor};` : ''}${
strokeWidth ? `stroke-width: ${strokeWidth};` : ''
}`}
style:fill={color}
style:stroke={strokeColor}
style:stroke-width={strokeWidth}
shape-rendering={shapeRendering}
/>
@@ -1,5 +1,5 @@
import type { PanelPosition } from '@xyflow/system';
import type { ClassValue } from 'svelte/elements';
import type { ClassValue, HTMLAttributes } from 'svelte/elements';
import type { Node } from '$lib/types';
export type GetMiniMapNodeAttribute = (node: Node) => string;
@@ -46,4 +46,4 @@ export type MiniMapProps = {
inversePan?: boolean;
/** Step size for zooming in/out */
zoomStep?: number;
};
} & HTMLAttributes<HTMLDivElement>;