
Research
/Security News
Toptalβs GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptalβs GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
vue-dk-toast
Advanced tools
vue-dk-toast
Lightweight toast-notification plugin for Vue 3 π
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββ ββ
ββ ββββββββββββββββββββββββββββββββββ ββ
ββ ββββββββββββββββββββββββββββββββββ ββ
ββ ββββββββββββββββββββββββββββββββββ ββ
ββ ββββββββββββββββββββββββββββββββββ ββ
ββ ββββββββββββββββββββββββββββββββββ ββ
ββ ββββββββββββββββββββββββββββββββββ ββ
ββββββββββββββββββββββββββββββββββ
ββ ββ
ββ ββ
ββ ββ
ββ ββ
ββββ ββββ
CLI
npm i vue-dk-toast
or...
yarn add vue-dk-toast
CDN
<script src="https://unpkg.com/vue-dk-toast"></script>
It's recommended you use a specific version number to guard against breaking changes and load the script faster:
<script src="https://unpkg.com/vue-dk-toast@2.0.6"></script>
CLI
import { createApp } from 'vue'
import App from './App.vue'
import DKToast from 'vue-dk-toast'
createApp(App).use(DKToast).mount('#app')
CDN
const app = Vue.createApp({})
app.use(DKToast)
app.mount('#app')
Options API:
this.$toast('Simple!')
or...
@click="$toast('Simple!')"
Composition API:
<script>
import { inject } from 'vue'
export default {
setup() {
const toast = inject('$toast')
toast('Simple!')
}
}
</script>
Option | Type | Default | Description |
---|---|---|---|
class | String | None | Custom CSS class to be added to every toast (alongside .dk__toast ). |
disableClick | Boolean | false | Disable toast removal on click. |
duration | Number | 5000 | Milliseconds before hiding toast. |
max | Number | None | Max number of toasts allowed on the page at any one time. Removes oldest existing toast first. |
positionX | String | right | Position of container on the X axis - 'left' , 'right' or 'center' . |
positionY | String | bottom | Position of container on the Y axis - 'top' , or 'bottom' . |
styles | Object | None | CSS key/value pairs - supports vendor prefixes. |
EXAMPLE:
createApp(App)
.use(DKToast, {
duration: 5000,
positionY: 'bottom', // 'top' or 'bottom'
positionX: 'right', // 'left', 'right' or 'center'
disableClick: true,
styles: {
color: '#000',
backgroundColor: '#fff'
// Vendor prefixes also supported
},
class: 'custom-class', // Added to each toast,
max: 10
})
.mount('#app')
Option | Type | Default | Description |
---|---|---|---|
class | String | None | CSS class to be added to this toast only (alongside .dk__toast and any globally set custom-class). |
disableClick | Boolean | false | Disable individual toast removal on click. |
duration | Number | 5000 | Milliseconds before hiding toast. Overrides global duration . |
link | { href: string, targetBlank?: boolean } | none | Turns the toast into an <a> element which has a href of the one provided and optional target="_blank" . |
positionX | String | right | Position of container on the X axis - 'left' , 'right' or 'center' . Overrides global positionX . |
positionY | String | bottom | Position of container on the Y axis - 'top' , or 'bottom' . Overrides global positionY . |
slotLeft | String | None | Any valid HTML as a string. Displays left of text. |
slotRight | String | None | Any valid HTML as a string. Displays right of text. |
styles | Object | None | CSS key/value pairs. Supports vendor prefixes. |
type | String | None | Default helper class - success , error or passive . |
EXAMPLE:
this.$toast('Simple!', {
duration: 1000,
styles: {
borderRadius: '25px'
},
link: {
href: 'https://vue-dk-toast.netlify.app/',
targetBlank: true
},
// Any valid HTML, intended for icons
slotLeft: '<i class="fa fa-user"></i>', // Add icon to left
slotRight: '<i class="fa fa-thumbs-up"></i>', // Add icon to right
class: 'local-class', // Added to this toast only
type: 'success', // Default classes: 'success', 'error' and 'passive'
positionX: 'center',
positionY: 'top',
disableClick: true
})
vue-dk-toast
comes with it's own built-in types for most cases, the exception being with the Composition API:
<script lang="ts">
import { defineComponent, inject } from 'vue'
import type { Toast } from 'vue-dk-toast'
export default defineComponent({
setup() {
const toast = inject<Toast>('$toast')
if (toast) toast('Simple!')
}
})
</script>
For slotRight
and slotLeft
to work, it uses innerHTML
to set the content. innerHTML
is not secure as it adds the possibility for XSS attacks. If you set any user-inputted tags with these options, make sure you sanitise the string beforehand, else, adding something like <img src=x onerror="alert("XSS Attack!")" />
would run. You can use a library like DOMPurify
to handle this for you.
Contributions welcome!
FAQs
Lightweight toast notification plugin for Vue 3
The npm package vue-dk-toast receives a total of 339 weekly downloads. As such, vue-dk-toast popularity was classified as not popular.
We found that vue-dk-toast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptalβs GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.