├── .babelrc
├── .editorconfig
├── .eslintrc.js
├── .github
└── workflows
│ └── test-javascript.yml
├── .gitignore
├── dist
├── demo.html
├── tv-toast.common.js
├── tv-toast.umd.js
└── tv-toast.umd.min.js
├── jest.config.js
├── license
├── media
├── action.gif
├── actions.gif
├── custom.gif
├── error.gif
├── simple.gif
├── success.gif
└── toast.png
├── package.json
├── readme.md
├── src
├── .eslintrc.js
├── index.js
├── tv-toast.vue
└── utils.js
└── test
└── tv-toast.spec.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "test": {
4 | "presets": [
5 | [
6 | "@babel/preset-env",
7 | {
8 | "targets": {
9 | "node": "current"
10 | }
11 | }
12 | ]
13 | ]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | browser: true,
5 | node: true
6 | },
7 | parserOptions: {
8 | parser: 'babel-eslint'
9 | },
10 | extends: [
11 | // 'plugin:vue/recommended'
12 | ],
13 | plugins: [
14 | ],
15 | // add your custom rules here
16 | rules: {}
17 | }
18 |
--------------------------------------------------------------------------------
/.github/workflows/test-javascript.yml:
--------------------------------------------------------------------------------
1 | name: Test Javascript
2 | on: [push]
3 | jobs:
4 | test:
5 | runs-on: ubuntu-latest
6 | steps:
7 | -
8 | uses: actions/checkout@v2
9 | - name: Get yarn cache directory path
10 | id: yarn-cache-dir-path
11 | run: echo "::set-output name=dir::$(yarn cache dir)"
12 | - uses: actions/cache@v1
13 | id: yarn-cache
14 | with:
15 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
16 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
17 | restore-keys: |
18 | ${{ runner.os }}-yarn-
19 | -
20 | name: Install our dependencies
21 | run: yarn
22 | -
23 | name: Run Jest
24 | run: yarn test --color --all
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | .DS_Store
3 | .idea/
4 | *.map
5 | node_modules/
6 | npm-debug.log
7 | yarn.lock
8 | coverage/
9 |
--------------------------------------------------------------------------------
/dist/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
tv-toast demo
3 |
4 |
5 |
6 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/dist/tv-toast.umd.min.js:
--------------------------------------------------------------------------------
1 | (function(t,a){"object"===typeof exports&&"object"===typeof module?module.exports=a():"function"===typeof define&&define.amd?define([],a):"object"===typeof exports?exports["tv-toast"]=a():t["tv-toast"]=a()})("undefined"!==typeof self?self:this,(function(){return function(t){var a={};function r(n){if(a[n])return a[n].exports;var e=a[n]={i:n,l:!1,exports:{}};return t[n].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=a,r.d=function(t,a,n){r.o(t,a)||Object.defineProperty(t,a,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,a){if(1&a&&(t=r(t)),8&a)return t;if(4&a&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&a&&"string"!=typeof t)for(var e in t)r.d(n,e,function(a){return t[a]}.bind(null,e));return n},r.n=function(t){var a=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(a,"a",a),a},r.o=function(t,a){return Object.prototype.hasOwnProperty.call(t,a)},r.p="",r(r.s="fb15")}({8875:function(t,a,r){var n,e,l;(function(r,s){e=[],n=s,l="function"===typeof n?n.apply(a,e):n,void 0===l||(t.exports=l)})("undefined"!==typeof self&&self,(function(){function t(){var a=Object.getOwnPropertyDescriptor(document,"currentScript");if(!a&&"currentScript"in document&&document.currentScript)return document.currentScript;if(a&&a.get!==t&&document.currentScript)return document.currentScript;try{throw new Error}catch(v){var r,n,e,l=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,s=/@([^@]*):(\d+):(\d+)\s*$/gi,c=l.exec(v.stack)||s.exec(v.stack),i=c&&c[1]||!1,o=c&&c[2]||!1,u=document.location.href.replace(document.location.hash,""),h=document.getElementsByTagName("script");i===u&&(r=document.documentElement.outerHTML,n=new RegExp("(?:[^\\n]+?\\n){0,"+(o-2)+"}[^<]*
326 |
--------------------------------------------------------------------------------
/src/utils.js:
--------------------------------------------------------------------------------
1 | /*
2 | * utils.js
3 | * Copyright (C) 2019 kevin olson
4 | *
5 | * Distributed under terms of the APACHE license.
6 | */
7 | export function removeElement (el) {
8 | if (typeof (el).remove !== 'undefined')
9 | el.remove()
10 | else
11 | el.parentNode.removeChild(el)
12 | }
13 |
14 | // add the component w/ the specified props
15 | export function spawn (id, propsData, Component, Vue, options) {
16 | if (propsData) {
17 | if (options) {
18 | if (options.defaults) {
19 | propsData.defaults = options.defaults
20 | }
21 | if (options.defaultProps) {
22 | propsData = {...options.defaultProps, ...propsData}
23 | }
24 | }
25 | }
26 | const Instance = Vue.extend(Component)
27 | return new Instance({
28 | el: document.getElementById(id).appendChild(document.createElement('div')),
29 | propsData,
30 | })
31 | }
32 |
--------------------------------------------------------------------------------
/test/tv-toast.spec.js:
--------------------------------------------------------------------------------
1 | import { mount } from '@vue/test-utils'
2 | import TvToast from '@/tv-toast'
3 |
4 | describe('tv-toast', () => {
5 | test('is a Vue instance', () => {
6 | const wrapper = mount(TvToast)
7 | expect(wrapper.vm).toBeTruthy()
8 | })
9 | })
10 |
--------------------------------------------------------------------------------