chore(svelte): add id prop

This commit is contained in:
moklick
2023-10-16 11:22:05 +02:00
parent 3c30fa4087
commit 92a06d25db
3 changed files with 7 additions and 3 deletions
@@ -16,6 +16,7 @@
type $$Props = BackgroundProps;
export let id: $$Props['id'] = undefined;
export let variant: $$Props['variant'] = BackgroundVariant.Dots;
export let gap: $$Props['gap'] = 20;
export let size: $$Props['size'] = 1;
@@ -32,7 +33,7 @@
const isCross = variant === BackgroundVariant.Cross;
const gapXY: number[] = Array.isArray(gap!) ? gap! : [gap!, gap!];
$: patternId = `background-pattern-${$flowId}`;
$: patternId = `background-pattern-${$flowId}-${id ? id : ''}`;
$: scaledGap = [gapXY[0] * $viewport.zoom || 1, gapXY[1] * $viewport.zoom || 1];
$: scaledSize = patternSize * $viewport.zoom;
$: patternDimensions = (isCross ? [scaledSize, scaledSize] : scaledGap) as [number, number];
@@ -5,6 +5,7 @@ export enum BackgroundVariant {
}
export type BackgroundProps = {
id?: string;
bgColor?: string;
patternColor?: string;
patternClass?: string;