Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 79dbf8e

Browse files
committed
refactor: remove explicit interface declarations, and move them directly into defineProps<> and defineEmits<>
refactor: use Vue 3.3 new emit declaration syntax feat(BLink): add new link helpers (icon, offset, underline, opacity, etc)
1 parent 512de8d commit 79dbf8e

File tree

88 files changed

+2584
-2478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2584
-2478
lines changed

packages/bootstrap-vue-next/src/components/BAccordion/BAccordion.vue

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,24 @@ import {accordionInjectionKey} from '../../utils'
1111
import {useBooleanish, useId} from '../../composables'
1212
import {useVModel} from '@vueuse/core'
1313
14-
interface BAccordionProps {
15-
flush?: Booleanish
16-
free?: Booleanish
17-
id?: string
18-
modelValue?: string
19-
}
20-
21-
interface BAccordionEmits {
22-
(e: 'update:modelValue', value: string): void
23-
}
24-
25-
const props = withDefaults(defineProps<BAccordionProps>(), {
26-
flush: false,
27-
free: false,
28-
id: undefined,
29-
modelValue: undefined,
30-
})
31-
32-
const emit = defineEmits<BAccordionEmits>()
14+
const props = withDefaults(
15+
defineProps<{
16+
flush?: Booleanish
17+
free?: Booleanish
18+
id?: string
19+
modelValue?: string
20+
}>(),
21+
{
22+
flush: false,
23+
free: false,
24+
id: undefined,
25+
modelValue: undefined,
26+
}
27+
)
28+
29+
const emit = defineEmits<{
30+
'update:modelValue': [value: string]
31+
}>()
3332
3433
defineSlots<{
3534
// eslint-disable-next-line @typescript-eslint/no-explicit-any

packages/bootstrap-vue-next/src/components/BAccordion/BAccordionItem.vue

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,40 @@ defineOptions({
4646
inheritAttrs: false,
4747
})
4848
49-
interface BAccordionItemProps {
50-
id?: string
51-
title?: string
52-
modelValue?: Booleanish
53-
headerTag?: string
54-
tag?: string
55-
toggle?: Booleanish
56-
horizontal?: Booleanish
57-
visible?: Booleanish
58-
isNav?: Booleanish
59-
}
60-
61-
interface BAccordionItemEmits {
62-
(e: 'show', value: BvTriggerableEvent): void
63-
(e: 'shown', value: BvTriggerableEvent): void
64-
(e: 'hide', value: BvTriggerableEvent): void
65-
(e: 'hidden', value: BvTriggerableEvent): void
66-
(e: 'hide-prevented'): void
67-
(e: 'show-prevented'): void
68-
(e: 'update:modelValue', value: boolean): void
69-
}
70-
71-
const props = withDefaults(defineProps<BAccordionItemProps>(), {
72-
headerTag: 'h2',
73-
id: undefined,
74-
title: undefined,
75-
tag: undefined,
76-
horizontal: undefined,
77-
toggle: undefined,
78-
isNav: undefined,
79-
modelValue: false,
80-
visible: false,
81-
})
49+
const props = withDefaults(
50+
defineProps<{
51+
id?: string
52+
title?: string
53+
modelValue?: Booleanish
54+
headerTag?: string
55+
tag?: string
56+
toggle?: Booleanish
57+
horizontal?: Booleanish
58+
visible?: Booleanish
59+
isNav?: Booleanish
60+
}>(),
61+
{
62+
headerTag: 'h2',
63+
id: undefined,
64+
title: undefined,
65+
tag: undefined,
66+
horizontal: undefined,
67+
toggle: undefined,
68+
isNav: undefined,
69+
modelValue: false,
70+
visible: false,
71+
}
72+
)
8273
83-
const emit = defineEmits<BAccordionItemEmits>()
74+
const emit = defineEmits<{
75+
'show': [value: BvTriggerableEvent]
76+
'shown': [value: BvTriggerableEvent]
77+
'hide': [value: BvTriggerableEvent]
78+
'hidden': [value: BvTriggerableEvent]
79+
'hide-prevented': []
80+
'show-prevented': []
81+
'update:modelValue': [value: boolean]
82+
}>()
8483
8584
defineSlots<{
8685
// eslint-disable-next-line @typescript-eslint/no-explicit-any

packages/bootstrap-vue-next/src/components/BAlert/BAlert.vue

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,41 +39,40 @@ import {useBooleanish, useCountdown} from '../../composables'
3939
import {isEmptySlot} from '../../utils'
4040
import {useVModel} from '@vueuse/core'
4141
42-
interface BAlertProps {
43-
noHoverPause?: Booleanish
44-
dismissLabel?: string
45-
dismissible?: Booleanish
46-
fade?: Booleanish
47-
closeVariant?: ButtonVariant | null
48-
modelValue?: boolean | number
49-
variant?: ColorVariant | null
50-
closeContent?: string
51-
immediate?: Booleanish
52-
interval?: number
53-
showOnPause?: Booleanish
54-
}
55-
56-
interface BAlertEmits {
57-
(e: 'closed'): void
58-
(e: 'close-countdown', value: number): void
59-
(e: 'update:modelValue', value: boolean | number): void
60-
}
61-
62-
const props = withDefaults(defineProps<BAlertProps>(), {
63-
closeContent: undefined,
64-
closeVariant: 'secondary',
65-
noHoverPause: false,
66-
interval: 1000,
67-
dismissLabel: 'Close',
68-
dismissible: false,
69-
fade: false,
70-
modelValue: false,
71-
variant: 'info',
72-
immediate: true,
73-
showOnPause: true,
74-
})
42+
const props = withDefaults(
43+
defineProps<{
44+
noHoverPause?: Booleanish
45+
dismissLabel?: string
46+
dismissible?: Booleanish
47+
fade?: Booleanish
48+
closeVariant?: ButtonVariant | null
49+
modelValue?: boolean | number
50+
variant?: ColorVariant | null
51+
closeContent?: string
52+
immediate?: Booleanish
53+
interval?: number
54+
showOnPause?: Booleanish
55+
}>(),
56+
{
57+
closeContent: undefined,
58+
closeVariant: 'secondary',
59+
noHoverPause: false,
60+
interval: 1000,
61+
dismissLabel: 'Close',
62+
dismissible: false,
63+
fade: false,
64+
modelValue: false,
65+
variant: 'info',
66+
immediate: true,
67+
showOnPause: true,
68+
}
69+
)
7570
76-
const emit = defineEmits<BAlertEmits>()
71+
const emit = defineEmits<{
72+
'closed': []
73+
'close-countdown': [value: number]
74+
'update:modelValue': [value: boolean | number]
75+
}>()
7776
7877
defineSlots<{
7978
// eslint-disable-next-line @typescript-eslint/no-explicit-any

packages/bootstrap-vue-next/src/components/BAvatar/BAvatar.vue

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,53 @@ import {computed, type CSSProperties, inject, type StyleValue, useSlots} from 'v
2929
import type {Booleanish, ButtonType, ColorVariant, Size, TextColorVariant} from '../../types'
3030
import {useBooleanish} from '../../composables'
3131
32-
interface BAvatarProps {
33-
alt?: string
34-
ariaLabel?: string
35-
badge?: boolean | string
36-
badgeLeft?: Booleanish
37-
badgeOffset?: string
38-
badgeTop?: Booleanish
39-
badgeVariant?: ColorVariant | null
40-
button?: Booleanish
41-
buttonType?: ButtonType
42-
disabled?: Booleanish
43-
icon?: string
44-
rounded?: boolean | string
45-
size?: Size | string // TODO number --> compat
46-
square?: Booleanish
47-
src?: string
48-
text?: string
49-
textVariant?: TextColorVariant | null
50-
variant?: ColorVariant | null
51-
}
52-
53-
interface BAvatarEmits {
54-
(e: 'click', value: MouseEvent): void
55-
(e: 'img-error', value: Event): void
56-
}
57-
58-
const props = withDefaults(defineProps<BAvatarProps>(), {
59-
ariaLabel: undefined,
60-
badgeOffset: undefined,
61-
icon: undefined,
62-
size: undefined,
63-
src: undefined,
64-
text: undefined,
65-
textVariant: null,
66-
alt: 'avatar',
67-
badge: false,
68-
badgeLeft: false,
69-
badgeTop: false,
70-
badgeVariant: 'primary',
71-
button: false,
72-
buttonType: 'button',
73-
disabled: false,
74-
rounded: 'circle',
75-
square: false,
76-
variant: 'secondary',
77-
})
32+
const props = withDefaults(
33+
defineProps<{
34+
alt?: string
35+
ariaLabel?: string
36+
badge?: boolean | string
37+
badgeLeft?: Booleanish
38+
badgeOffset?: string
39+
badgeTop?: Booleanish
40+
badgeVariant?: ColorVariant | null
41+
button?: Booleanish
42+
buttonType?: ButtonType
43+
disabled?: Booleanish
44+
icon?: string
45+
rounded?: boolean | string
46+
size?: Size | string // TODO number --> compat
47+
square?: Booleanish
48+
src?: string
49+
text?: string
50+
textVariant?: TextColorVariant | null
51+
variant?: ColorVariant | null
52+
}>(),
53+
{
54+
ariaLabel: undefined,
55+
badgeOffset: undefined,
56+
icon: undefined,
57+
size: undefined,
58+
src: undefined,
59+
text: undefined,
60+
textVariant: null,
61+
alt: 'avatar',
62+
badge: false,
63+
badgeLeft: false,
64+
badgeTop: false,
65+
badgeVariant: 'primary',
66+
button: false,
67+
buttonType: 'button',
68+
disabled: false,
69+
rounded: 'circle',
70+
square: false,
71+
variant: 'secondary',
72+
}
73+
)
7874
79-
const emit = defineEmits<BAvatarEmits>()
75+
const emit = defineEmits<{
76+
'click': [value: MouseEvent]
77+
'img-error': [value: Event]
78+
}>()
8079
8180
defineSlots<{
8281
// eslint-disable-next-line @typescript-eslint/no-explicit-any

packages/bootstrap-vue-next/src/components/BAvatar/BAvatarGroup.vue

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,24 @@ import {avatarGroupInjectionKey, isNumeric, toFloat} from '../../utils'
1313
import {useBooleanish} from '../../composables'
1414
import {computeSize} from './BAvatar.vue'
1515
16-
interface BAvatarGroupProps {
17-
overlap?: number | string
18-
rounded?: boolean | string
19-
size?: Size | string
20-
square?: Booleanish
21-
tag?: string
22-
variant?: ColorVariant | null
23-
}
24-
25-
const props = withDefaults(defineProps<BAvatarGroupProps>(), {
26-
overlap: 0.3,
27-
rounded: false,
28-
square: false,
29-
tag: 'div',
30-
size: undefined,
31-
variant: null,
32-
})
16+
const props = withDefaults(
17+
defineProps<{
18+
overlap?: number | string
19+
rounded?: boolean | string
20+
size?: Size | string
21+
square?: Booleanish
22+
tag?: string
23+
variant?: ColorVariant | null
24+
}>(),
25+
{
26+
overlap: 0.3,
27+
rounded: false,
28+
square: false,
29+
tag: 'div',
30+
size: undefined,
31+
variant: null,
32+
}
33+
)
3334
3435
defineSlots<{
3536
// eslint-disable-next-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)