Skip to content

Commit 2bd71dc

Browse files
committed
refactor: state when item is exported in main
This explicitly states that an item is @external when it is exported from BootstrapVue.ts. This includes types, composables, and directives, and a util class
1 parent 4fc3389 commit 2bd71dc

Some content is hidden

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

51 files changed

+486
-36
lines changed

packages/bootstrap-vue-3/src/BootstrapVue.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Directives from './directives'
44
import {BootstrapVueOptions} from './types'
55
import {createBreadcrumb, useBreadcrumb} from './composables'
66
import './styles/styles.scss'
7+
78
// All available components
89
// Keep this list in sync with /components/index.ts please
910
import BAccordion from './components/BAccordion/BAccordion.vue'
@@ -98,14 +99,7 @@ import BToastContainer from './components/BToast/BToaster.vue'
9899
import BTransition from './components/BTransition/BTransition.vue'
99100

100101
// Export available composables
101-
export {useToast}
102-
103-
// Export available plugins
104-
// Not to be confused with the above main app plugin
105-
export {BToastPlugin}
106-
107-
// Export available composables
108-
export {useBreadcrumb}
102+
export {useToast, useBreadcrumb}
109103

110104
// Export available directives
111105
export {
@@ -115,6 +109,10 @@ export {
115109
BVisible as VBVisible,
116110
} from './directives'
117111

112+
// Export available plugins
113+
// Not to be confused with the main app plugin
114+
export {BToastPlugin}
115+
118116
// Export available utils
119117
export {BvEvent} from './utils'
120118

packages/bootstrap-vue-3/src/components/BToast/plugin.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export interface Toast {
3131
content: ToastContent
3232
}
3333

34+
/**
35+
* @external
36+
*/
3437
export type BodyProp = ToastContent['body']
3538

3639
// Toast ViewModel, Each toast instance controls one view model
@@ -193,6 +196,9 @@ export function getKey(): any {
193196
return inject(fetchKey)
194197
}
195198

199+
/**
200+
* @external
201+
*/
196202
export function useToast(): ToastInstance | undefined
197203
export function useToast(vm: {id: symbol}, key?: symbol): ToastInstance | undefined
198204
export function useToast(
@@ -216,6 +222,9 @@ export function useToast(vm?: any, key: symbol = injectkey): ToastInstance | und
216222
return new ToastInstance(vm_instance)
217223
}
218224

225+
/**
226+
* @external
227+
*/
219228
export const BToastPlugin: Plugin = {
220229
install: (app: App, options: BootstrapVueOptions = {}) => {
221230
app.provide(fetchKey, options?.BToast?.injectkey ?? injectkey)

packages/bootstrap-vue-3/src/composables/useAlignment.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import {computed, ComputedRef} from 'vue'
22

33
import type {Alignment} from '../types'
44

5+
/**
6+
*
7+
* @param props
8+
* @returns
9+
*/
510
export default (props: {align: Alignment}): ComputedRef<string> =>
611
computed(() => {
712
if (props.align === 'center') {

packages/bootstrap-vue-3/src/composables/useBreadcrumb.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ const BREADCRUMB_OBJECT: UseBreadcrumbI = {
1515
},
1616
}
1717

18+
/**
19+
* @param app
20+
*/
1821
export const createBreadcrumb = (app: App): void => {
1922
app.provide(BREADCRUMB_SYMBOL, BREADCRUMB_OBJECT)
2023
}
2124

25+
/**
26+
* @external
27+
*
28+
* @returns
29+
*/
2230
export const useBreadcrumb = (): UseBreadcrumbI => {
2331
const context = inject(BREADCRUMB_SYMBOL)
2432

packages/bootstrap-vue-3/src/composables/useEventListener.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import {onBeforeUnmount, onMounted, Ref} from 'vue'
22

3+
/**
4+
* @param element
5+
* @param event
6+
* @param callback
7+
*/
38
export default (
49
element: Ref<HTMLElement | undefined>,
510
event: string,

packages/bootstrap-vue-3/src/composables/useFormCheck.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {computed, ComputedRef} from 'vue'
22

3+
/**
4+
* @param props
5+
* @returns
6+
*/
37
const _getComputedAriaInvalid = (props: any): ComputedRef =>
48
computed(() => {
59
if (props.ariaInvalid === true || props.ariaInvalid === 'true' || props.ariaInvalid === '') {
@@ -10,6 +14,10 @@ const _getComputedAriaInvalid = (props: any): ComputedRef =>
1014
return computedState === false ? 'true' : props.ariaInvalid
1115
})
1216

17+
/**
18+
* @param props
19+
* @returns
20+
*/
1321
const getClasses = (props: any): ComputedRef =>
1422
computed(() => ({
1523
'form-check': !props.plain && !props.button,
@@ -18,6 +26,10 @@ const getClasses = (props: any): ComputedRef =>
1826
[`form-control-${props.size}`]: props.size && props.size !== 'md',
1927
}))
2028

29+
/**
30+
* @param props
31+
* @returns
32+
*/
2133
const getInputClasses = (props: any): ComputedRef =>
2234
computed(() => ({
2335
'form-check-input': !props.plain && !props.button,
@@ -26,6 +38,10 @@ const getInputClasses = (props: any): ComputedRef =>
2638
'btn-check': props.button,
2739
}))
2840

41+
/**
42+
* @param props
43+
* @returns
44+
*/
2945
const getLabelClasses = (props: any): ComputedRef =>
3046
computed(() => ({
3147
'form-check-label': !props.plain && !props.button,
@@ -34,12 +50,20 @@ const getLabelClasses = (props: any): ComputedRef =>
3450
[`btn-${props.size}`]: props.button && props.size && props.size !== 'md',
3551
}))
3652

53+
/**
54+
* @param props
55+
* @returns
56+
*/
3757
const getGroupAttr = (props: any): ComputedRef =>
3858
computed(() => ({
3959
'aria-invalid': _getComputedAriaInvalid(props).value,
4060
'aria-required': props.required.toString() === 'true' ? 'true' : null,
4161
}))
4262

63+
/**
64+
* @param props
65+
* @returns
66+
*/
4367
const getGroupClasses = (props: any): ComputedRef =>
4468
computed(() => ({
4569
'was-validated': props.validated,
@@ -48,6 +72,12 @@ const getGroupClasses = (props: any): ComputedRef =>
4872
[`btn-group-${props.size}`]: props.size,
4973
}))
5074

75+
/**
76+
* @param slots
77+
* @param nodeType
78+
* @param disabled
79+
* @returns
80+
*/
5181
const slotsToElements = (slots: Array<any>, nodeType: string, disabled: boolean) =>
5282
slots
5383
.filter((e: any) => e.type.name === nodeType)
@@ -65,6 +95,11 @@ const slotsToElements = (slots: Array<any>, nodeType: string, disabled: boolean)
6595
}
6696
})
6797

98+
/**
99+
* @param option
100+
* @param props
101+
* @returns
102+
*/
68103
const optionToElement = (option: any, props: any): any => {
69104
if (typeof option === 'string') {
70105
return {
@@ -87,6 +122,14 @@ const optionToElement = (option: any, props: any): any => {
87122
}
88123
}
89124

125+
/**
126+
* @param el
127+
* @param idx
128+
* @param props
129+
* @param computedName
130+
* @param computedId
131+
* @returns
132+
*/
90133
const bindGroupProps = (
91134
el: any,
92135
idx: number,

packages/bootstrap-vue-3/src/composables/useFormInput.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ type InputEmitType = (
4343
...args: any[]
4444
) => void
4545

46+
/**
47+
* @param props
48+
* @param emit
49+
* @returns
50+
*/
4651
export default (props: Readonly<InputProps>, emit: InputEmitType) => {
4752
const input = ref<HTMLInputElement>()
4853
let inputValue: string | null = null

packages/bootstrap-vue-3/src/composables/useFormSelect.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ const _normalizeOption = (
4141
}
4242
}
4343

44+
/**
45+
* @param options
46+
* @param componentName
47+
* @param props
48+
* @returns
49+
*/
4450
const normalizeOptions = (options: any[], componentName: string, props: any): any => {
4551
if (Array.isArray(options)) {
4652
return options.map((option) => _normalizeOption(option, null, componentName, props))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import {getID} from '../utils'
22
import {computed, ComputedRef} from 'vue'
33

4+
/**
5+
* @param id
6+
* @param suffix
7+
* @returns
8+
*/
49
export default (id?: string, suffix?: string): ComputedRef<string> =>
510
computed(() => id || getID(suffix))

packages/bootstrap-vue-3/src/directives/BModal.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import {DirectiveBinding} from 'vue'
22

3+
/**
4+
* This is not marked as external, but in the future I think it may be
5+
*/
36
export default {
47
mounted(el: HTMLElement, binding: DirectiveBinding): void {
58
let target: string = binding.value

0 commit comments

Comments
 (0)