Skip to content

Commit 5f08140

Browse files
author
issayah
committed
2 parents b3750c4 + 2955fdd commit 5f08140

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

.github/workflows/release-please.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ jobs:
1010
- uses: google-github-actions/release-please-action@v3
1111
with:
1212
release-type: node
13-
package-name: release-please-action
13+
package-name: bootstrap-vue-3
14+
bump-minor-pre-major: true
15+
bump-patch-for-minor-pre-major: true

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ The workflow `.github/workflows/npm-publish.yml` will then auto-publish at <http
8484
One could also manually create a release PR using the cli, directions [here](https://github.com/googleapis/release-please/blob/main/docs/cli.md#running-release-please-cli). Follow the directions for bootstrapping and creating a release, then it will auto generate a PR containing the new release notes
8585

8686
It will then auto-publish as stated before
87+
88+
Collaborators can also manually release by:
89+
90+
increase version in package.json, commit
91+
https://github.com/cdmoro/bootstrap-vue-3/releases/new (create new tag)

docs/.vuepress/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineClientConfig({
99
if (!__VUEPRESS_SSR__) {
1010
const {BootstrapVue3, BToastPlugin} = await import('../../dist/bootstrap-vue-3.es')
1111
app.use(BootstrapVue3)
12-
app.use(BToastPlugin)
12+
app.use(BToastPlugin, {BToast: {injectkey: 'toast'}})
1313
app.component('doc-reference', DocReference)
1414
}
1515
},

docs/components/Toast.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,13 @@ Toasts can be displayed as variants thru various helper methods or be set in `To
135135
</ClientOnly>
136136

137137
<script lang='ts' setup>
138-
import {ref, computed} from 'vue';
138+
import {ref, computed, inject} from 'vue';
139139
import {useToast} from 'bootstrap-vue-3';
140+
let toast = null
141+
142+
if (!__VUEPRESS_SSR__) {
143+
toast = inject("toast").useToast()
140144

141-
// let toast = useToast()
142145

143146
let show1 = () => {toast.show({title: 'example title'})};
144147
let show2 = () => {toast.show({title: 'example title', body: "This is a toast"}, {variant: 'info'})};
@@ -147,4 +150,5 @@ Toasts can be displayed as variants thru various helper methods or be set in `To
147150
let variantshow2 = () => {toast.show({title: 'New Message', body: "This is a toast"}, {pos: 'bottom-right', variant: 'info'})};
148151
let variantshow3 = () => {toast.show({title: 'Warning for Item', body: "Please check list"},{pos: 'bottom-right', variant: 'warning'})};
149152
let variantshow4 = () => {toast.show({title: 'Event Created!', body: "Bootstrap Event"},{pos: 'bottom-right', variant: 'success'})};
153+
}
150154
</script>

src/components/BToast/plugin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,20 @@ export class ToastController {
179179

180180
// default global inject key to fetch the controller
181181
const injectkey = Symbol()
182+
const fetchKey = Symbol()
183+
182184
const rootkey = 'root' // TODO: I guess this variable is not used in any place...
183185

184186
const defaults = {
185187
container: undefined,
186188
toasts: [],
187189
root: false,
188190
}
191+
192+
export function getKey(): any {
193+
return inject(fetchKey)
194+
}
195+
189196
export function useToast(): ToastInstance | undefined
190197
export function useToast(vm: {id: symbol}, key?: symbol): ToastInstance | undefined
191198
export function useToast(
@@ -195,7 +202,7 @@ export function useToast(
195202

196203
export function useToast(vm?: any, key: symbol = injectkey): ToastInstance | undefined {
197204
//let's get our controller to fetch the toast instance
198-
const controller = inject(key !== null ? key : injectkey) as ToastController
205+
const controller = inject(getKey()) as ToastController
199206

200207
// not parameters passed, use root if defined
201208
if (!vm) {
@@ -211,6 +218,7 @@ export function useToast(vm?: any, key: symbol = injectkey): ToastInstance | und
211218

212219
export const BToastPlugin: Plugin = {
213220
install: (app: App, options: BootstrapVueOptions = {}) => {
221+
app.provide(fetchKey, options?.BToast?.injectkey ?? injectkey)
214222
app.provide(options?.BToast?.injectkey ?? injectkey, new ToastController())
215223
},
216224
}

0 commit comments

Comments
 (0)