refactor(background): deprecate bgcolor prop

This commit is contained in:
braks
2024-02-05 12:00:32 +01:00
committed by Braks
parent 6c638b8e27
commit d288a9b842
2 changed files with 15 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ const {
y = 0,
bgColor,
patternColor: initialPatternColor,
color: _patternColor,
offset = 2,
} = defineProps<BackgroundProps>()
@@ -44,7 +45,7 @@ const background = computed(() => {
// when there are multiple flows on a page we need to make sure that every background gets its own pattern.
const patternId = toRef(() => `pattern-${vueFlowId}${id ? `-${id}` : ''}`)
const patternColor = toRef(() => initialPatternColor || DefaultBgColors[variant || BackgroundVariant.Dots])
const patternColor = toRef(() => _patternColor || initialPatternColor || DefaultBgColors[variant || BackgroundVariant.Dots])
</script>
<script lang="ts">

View File

@@ -1,4 +1,6 @@
// todo: replace with a simple string type
/**
* @deprecated - will be removed in the next major version. You can use simple string values for `variant` prop instead, i.e. `lines` or `dots`
*/
export enum BackgroundVariant {
Lines = 'lines',
Dots = 'dots',
@@ -15,9 +17,17 @@ export interface BackgroundProps {
/** Background pattern size */
size?: number
lineWidth?: number
/** Background pattern color */
/**
* @deprecated - will be removed in the next major version. Use `color` instead
* Background pattern color
*/
patternColor?: string
/** Background color */
/** Background pattern color */
color?: string
/**
* @deprecated - will be removed in the next major version. You can assign a bg color to `<VueFlow />` directly instead.
* Background color
*/
bgColor?: string
/** @deprecated Background height */
height?: number