├── .github
├── ISSUE_TEMPLATE
│ └── bug_report.md
└── workflows
│ ├── gh-page.yml
│ ├── npmpublish.yml
│ └── pull_request.yml
├── .gitignore
├── .vscode
└── launch.json
├── README.md
├── packages
├── example
│ ├── .gitignore
│ ├── index.html
│ ├── need-publish.sh
│ ├── package.json
│ ├── public
│ │ ├── .nojekyll
│ │ ├── favicon.ico
│ │ └── logo.png
│ ├── src
│ │ ├── App.vue
│ │ ├── assets
│ │ │ └── logo.png
│ │ ├── components
│ │ │ └── AlertsComponent.vue
│ │ ├── index.css
│ │ ├── main.ts
│ │ └── shims-vue.d.ts
│ ├── tsconfig.json
│ └── vite.config.ts
└── vue-sweetalert2
│ ├── .babelrc.json
│ ├── .editorconfig
│ ├── .eslintignore
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── CODE_OF_CONDUCT.md
│ ├── LICENSE
│ ├── README.md
│ ├── __mocks__
│ └── styleMock.js
│ ├── __tests__
│ ├── swal-methods.spec.ts
│ └── swal.spec.ts
│ ├── assets
│ ├── logo.png
│ └── vue-sweetalert2.gif
│ ├── ignore-utils.js
│ ├── need-publish.sh
│ ├── nuxt
│ ├── index.js
│ ├── index.mjs
│ ├── no-css.js
│ ├── no-css.mjs
│ ├── plugin.js
│ └── plugin.no-css.js
│ ├── package.json
│ ├── src
│ ├── index.ts
│ └── shims-vue.d.ts
│ ├── tsconfig.json
│ ├── vite.config.ts
│ └── vitest.config.ts
└── tsconfig.json
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 | Please attach a link to a sandbox from [stackblitz.com](https://stackblitz.com/edit/vue-9e8haq?) that reproduce your bug. Without the sandbox, it can be verry difficult to recreate your environment and fix the bug.
13 | [example](https://stackblitz.com/edit/vue-9e8haq?)
14 |
15 | **To Reproduce**
16 | Steps to reproduce the behavior:
17 | 1. Go to '...'
18 | 2. Click on '....'
19 | 3. See error
20 |
21 | **I also want to know**
22 | - Version:
23 | - Platform:
24 | - Subsystem:
25 |
--------------------------------------------------------------------------------
/.github/workflows/gh-page.yml:
--------------------------------------------------------------------------------
1 | name: gh-page
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | defaults:
9 | run:
10 | shell: bash
11 | working-directory: packages/example
12 |
13 | jobs:
14 | publish-example-site:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v1
18 |
19 | - uses: actions/setup-node@v1
20 | with:
21 | node-version: 20
22 | registry-url: https://registry.npmjs.org/
23 |
24 | # Проверяем изменилась ли версия
25 | - name: Set NEED_PUBLISH
26 | run: echo "NEED_PUBLISH=$(./need-publish.sh)" >> $GITHUB_ENV
27 |
28 | - name: Install and Build - ⌛&🏗️
29 | if: ${{ env.NEED_PUBLISH }}
30 | run: |
31 | npm i
32 | npm run build
33 |
34 | # - name: Deploy 🚀.🚀.🚀
35 | # if: ${{ env.NEED_PUBLISH }}
36 | # uses: JamesIves/github-pages-deploy-action@releases/v3
37 | # with:
38 | # ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
39 | # BRANCH: gh-pages # The branch the action should deploy to.
40 | # FOLDER: packages/example/dist # The folder the action should deploy.
41 | # CLEAN: true
42 |
--------------------------------------------------------------------------------
/.github/workflows/npmpublish.yml:
--------------------------------------------------------------------------------
1 | name: publish npm
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | defaults:
9 | run:
10 | shell: bash
11 | working-directory: packages/vue-sweetalert2
12 |
13 | jobs:
14 | test:
15 | name: Testing job
16 | runs-on: ubuntu-latest
17 | steps:
18 | - uses: actions/checkout@v1
19 | - uses: actions/setup-node@v1
20 | with:
21 | node-version: 14
22 | - run: yarn install --frozen-lockfile
23 | - run: yarn test
24 |
25 | publish-npm:
26 | needs: test
27 | runs-on: ubuntu-latest
28 | steps:
29 | - uses: actions/checkout@v1
30 | - uses: actions/setup-node@v1
31 | with:
32 | node-version: 14
33 | registry-url: https://registry.npmjs.org/
34 | # Проверяем изменилась ли версия
35 | - name: Set NEED_PUBLISH
36 | run: echo "NEED_PUBLISH=$(./need-publish.sh)" >> $GITHUB_ENV
37 |
38 | - run: yarn install --frozen-lockfile
39 | if: ${{ env.NEED_PUBLISH }}
40 |
41 | - run: yarn publish
42 | if: ${{ env.NEED_PUBLISH }}
43 | env:
44 | NODE_AUTH_TOKEN: ${{secrets.npm_token}}
45 | COVERALLS_REPO_TOKEN: "${{ secrets.COVERALLS_REPO_TOKEN }}"
46 | COVERALLS_GIT_BRANCH: "${{ github.ref }}"
47 |
--------------------------------------------------------------------------------
/.github/workflows/pull_request.yml:
--------------------------------------------------------------------------------
1 | defaults:
2 | run:
3 | shell: bash
4 | working-directory: packages/vue-sweetalert2
5 |
6 | on: pull_request
7 |
8 | name: Pull Request
9 | jobs:
10 | test:
11 | name: Run tests
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/checkout@v1
15 | - uses: actions/setup-node@v1
16 | with:
17 | node-version: 12
18 | - run: yarn
19 | - run: yarn test
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | npm-shrinkwrap.json
4 |
5 | .DS_Store
6 | node_modules/
7 | dist/
8 | npm-debug.log
9 | yarn-error.log
10 |
11 | yarn.lock
12 | package-lock.json
13 |
14 | # Editor directories and files
15 | .idea
16 | *.suo
17 | *.ntvs*
18 | *.njsproj
19 | *.sln
20 |
21 | .vscode/settings.json
22 | coverage
23 |
24 | .npmrc
25 |
26 | dist
27 | .yalc
28 | yalc.lock
29 |
30 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "name": "vscode-jest-tests",
10 | "request": "launch",
11 | "args": [
12 | "--runInBand"
13 | ],
14 | "cwd": "${workspaceFolder}",
15 | "console": "integratedTerminal",
16 | "internalConsoleOptions": "neverOpen",
17 | "program": "${workspaceFolder}/node_modules/jest/bin/jest"
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | packages/vue-sweetalert2/README.md
--------------------------------------------------------------------------------
/packages/example/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | dist
4 | *.local
5 | package-lock.json
6 | !yarn.lock
7 |
--------------------------------------------------------------------------------
/packages/example/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | vue-sweetalert2 example
9 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/packages/example/need-publish.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # PKG=$(node -p -e "require('./package.json').name")
4 | PKG="vue-sweetalert2"
5 |
6 | # we get the version of the package in a branch
7 | CURRENT_VERSION=$(node -p -e "require('./package.json').version")
8 | PUBLIC_VERSION=$(npm show ${PKG} version)
9 |
10 |
11 | if [[ $CURRENT_VERSION != $PUBLIC_VERSION ]];
12 | then
13 | echo 'TRUE';
14 | fi
15 |
--------------------------------------------------------------------------------
/packages/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-sweetalert2-example",
3 | "version": "4.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vite",
7 | "build": "vue-tsc --noEmit && vite build --base=/vue-sweetalert2"
8 | },
9 | "dependencies": {
10 | "vue": "^3.4.27",
11 | "vue-sweetalert2": "5.*"
12 | },
13 | "devDependencies": {
14 | "@vitejs/plugin-vue": "^5.0.4",
15 | "@vue/compiler-sfc": "^3.4.27",
16 | "typescript": "^5.4.5",
17 | "vite": "^5.2.11",
18 | "vue-tsc": "^2.0.17"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/packages/example/public/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avil13/vue-sweetalert2/00552b8813308bceccb7323ff4ead4c51fd92f2a/packages/example/public/.nojekyll
--------------------------------------------------------------------------------
/packages/example/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avil13/vue-sweetalert2/00552b8813308bceccb7323ff4ead4c51fd92f2a/packages/example/public/favicon.ico
--------------------------------------------------------------------------------
/packages/example/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avil13/vue-sweetalert2/00552b8813308bceccb7323ff4ead4c51fd92f2a/packages/example/public/logo.png
--------------------------------------------------------------------------------
/packages/example/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
20 |
--------------------------------------------------------------------------------
/packages/example/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avil13/vue-sweetalert2/00552b8813308bceccb7323ff4ead4c51fd92f2a/packages/example/src/assets/logo.png
--------------------------------------------------------------------------------
/packages/example/src/components/AlertsComponent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
{{ description }}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Sweetalert2 documentation
16 |
17 |
18 |
19 |
66 |
--------------------------------------------------------------------------------
/packages/example/src/index.css:
--------------------------------------------------------------------------------
1 | #app {
2 | font-family: Avenir, Helvetica, Arial, sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | -moz-osx-font-smoothing: grayscale;
5 | text-align: center;
6 | color: #2c3e50;
7 | margin-top: 60px;
8 | }
9 |
10 | html,
11 | body {
12 | height: 100%;
13 | }
14 | body {
15 | display: flex;
16 | flex-direction: column;
17 | }
18 | *,
19 | ::after,
20 | ::before {
21 | box-sizing: border-box;
22 | }
23 | a {
24 | color: #41b882;
25 | text-decoration: none;
26 | background-color: transparent;
27 | -webkit-text-decoration-skip: objects;
28 | }
29 | a:hover {
30 | text-decoration: underline;
31 | }
32 | .content {
33 | flex: 1 0 auto;
34 | }
35 | .footer {
36 | flex-shrink: 0;
37 | display: flex;
38 | flex-direction: row-reverse;
39 | }
40 | .gh-icon {
41 | margin: 1rem 2rem;
42 | opacity: 0.6;
43 | transition: opacity 500ms ease-in-out;
44 | }
45 | .gh-icon:hover {
46 | opacity: 1;
47 | }
48 | /* */
49 | .doc-link {
50 | margin: 32px auto 0;
51 | display: block;
52 | }
53 | #app {
54 | font-family: 'Avenir', Helvetica, Arial, sans-serif;
55 | -webkit-font-smoothing: antialiased;
56 | -moz-osx-font-smoothing: grayscale;
57 | text-align: center;
58 | color: #2c3e50;
59 | margin-top: 60px;
60 | }
61 | h1,
62 | h2 {
63 | font-weight: normal;
64 | }
65 | a {
66 | color: #42b983;
67 | }
68 |
69 | .btn {
70 | border-radius: 0.25rem;
71 | border: 1px solid transparent;
72 | display: inline-block;
73 | font-size: 1rem;
74 | font-weight: 400;
75 | line-height: 1.5;
76 | padding: 0.475rem 0.75rem;
77 | text-align: center;
78 | transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
79 | user-select: none;
80 | vertical-align: middle;
81 | white-space: nowrap;
82 | }
83 | .row .btn.col {
84 | padding: 0.475rem 0.75rem;
85 | }
86 |
87 | .btn:focus,
88 | .btn:hover {
89 | text-decoration: none;
90 | }
91 | .btn:focus {
92 | outline: 0;
93 | box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
94 | }
95 | .btn:disabled {
96 | opacity: 0.65;
97 | }
98 | .btn:not(:disabled):not(.disabled) {
99 | cursor: pointer;
100 | }
101 | .btn-outline-primary {
102 | background-color: transparent;
103 | background-image: none;
104 | border-color: #41b882;
105 | color: #41b882;
106 | }
107 | .btn-outline-primary:hover {
108 | background-color: #41b882;
109 | border-color: #41b882;
110 | color: #fff;
111 | }
112 | .btn-outline-primary:focus {
113 | box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
114 | }
115 | .btn-outline-primary:disabled {
116 | background-color: transparent;
117 | color: #41b882;
118 | }
119 |
120 | /* */
121 | .responsive {
122 | height: auto;
123 | min-width: auto;
124 | max-width: 100%;
125 | }
126 | .container {
127 | margin: 0 auto;
128 | max-width: 1280px;
129 | width: 90%;
130 | }
131 |
132 | @media screen and (prefers-reduced-motion: reduce) {
133 | .btn {
134 | transition: none;
135 | }
136 | }
137 | @media print {
138 | *,
139 | ::after,
140 | ::before {
141 | text-shadow: none !important;
142 | box-shadow: none !important;
143 | }
144 | }
145 | @media only screen and (min-width: 601px) {
146 | .container {
147 | width: 85%;
148 | }
149 | }
150 | @media only screen and (min-width: 993px) {
151 | .container {
152 | width: 70%;
153 | }
154 | }
155 | @media only screen and (max-width: 800px) {
156 | .h1 {
157 | font-size: 4vw;
158 | margin-bottom: 20px;
159 | }
160 | }
161 |
162 | .row .col {
163 | box-sizing: border-box;
164 | margin: 2px 4px;
165 | min-height: 1px;
166 | padding: 0 12px;
167 | padding: 0 0.75rem;
168 | }
169 | .row .col.s12 {
170 | margin-left: auto;
171 | left: auto;
172 | right: auto;
173 | }
174 | .row .col.s12 {
175 | width: 100%;
176 | }
177 |
178 | @media only screen and (min-width: 601px) {
179 | .row .col.m8 {
180 | margin-left: auto;
181 | left: auto;
182 | right: auto;
183 | }
184 | .row .col.m8 {
185 | width: 66.6666666667%;
186 | }
187 | .row .col.offset-m2 {
188 | margin-left: 16.6666666667%;
189 | }
190 | }
191 |
192 | @media only screen and (min-width: 601px) {
193 | .row .col.m3 {
194 | width: 22%;
195 | }
196 | .row .col.m3 {
197 | margin-left: auto;
198 | left: auto;
199 | right: auto;
200 | }
201 | .row .col.m8 {
202 | margin-left: auto;
203 | left: auto;
204 | right: auto;
205 | }
206 | .row .col.m8 {
207 | width: 66.6666666667%;
208 | }
209 | .row .col.offset-m2 {
210 | margin-left: 16.6666666667%;
211 | }
212 | }
213 | .logo-img {
214 | max-width: 90%;
215 | }
--------------------------------------------------------------------------------
/packages/example/src/main.ts:
--------------------------------------------------------------------------------
1 | //@ts-check
2 | import { createApp } from 'vue'
3 | import App from './App.vue'
4 | import './index.css'
5 |
6 | // SweetAlert2
7 | import VueSweetalert2 from 'vue-sweetalert2';
8 | import 'sweetalert2/dist/sweetalert2.min.css';
9 |
10 | const app = createApp(App);
11 |
12 | app.use(VueSweetalert2);
13 |
14 | app.mount('#app');
15 |
--------------------------------------------------------------------------------
/packages/example/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.vue' {
2 | import { defineComponent } from 'vue';
3 | const Component: ReturnType;
4 | export default Component;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/example/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2019",
4 | "lib": [
5 | "es2017",
6 | "es2018",
7 | "es2019",
8 | "es2020",
9 | "es7",
10 | "es6",
11 | "dom"
12 | ],
13 | "module": "ESNext",
14 | "moduleResolution": "node",
15 | "outDir": "dist",
16 | "declaration": false,
17 | "strict": true,
18 | "esModuleInterop": true,
19 | "experimentalDecorators": true,
20 | "noImplicitAny": false,
21 | "noImplicitThis": false,
22 | "strictNullChecks": false,
23 | "removeComments": true,
24 | "allowSyntheticDefaultImports": true,
25 | "skipLibCheck": true,
26 | "sourceMap": true,
27 | "paths": {
28 | // "vue-sweetaler2": [
29 | // "../vue-sweetalert2/"
30 | // ]
31 | }
32 | },
33 | "include": [
34 | "./src/*.vue",
35 | "./src/*.ts",
36 | "./src/*.js"
37 | ]
38 | }
--------------------------------------------------------------------------------
/packages/example/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 | import vue from '@vitejs/plugin-vue';
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [vue()]
7 | })
8 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/ .babelrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env"]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | insert_final_newline = true
7 | indent_style = space
8 | indent_size = 2
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
14 | [*.yml]
15 | indent_size = 2
16 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/.eslintignore:
--------------------------------------------------------------------------------
1 | # don't ever lint node_modules
2 | node_modules
3 | # don't lint build output (make sure it's set to your correct build folder name)
4 | dist
5 | # don't lint nyc coverage output
6 | coverage
7 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | npm-shrinkwrap.json
4 |
5 | .DS_Store
6 | node_modules/
7 | dist/
8 | npm-debug.log
9 | yarn-error.log
10 |
11 | yarn.lock
12 | package-lock.json
13 |
14 | # Editor directories and files
15 | .idea
16 | *.suo
17 | *.ntvs*
18 | *.njsproj
19 | *.sln
20 |
21 | .vscode/settings.json
22 | coverage
23 |
24 | .npmrc
25 |
26 | dist
27 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [5.0.7](https://github.com/avil13/vue-sweetalert2/compare/v5.0.4...v5.0.7) (2022-05-10)
2 |
3 |
4 | ### chore
5 |
6 | * 🤖 updated build scripts ([71b7bb0](https://github.com/avil13/vue-sweetalert2/commit/71b7bb055977a1ee31920613b66e7d699095c839))
7 |
8 |
9 | ### Features
10 |
11 | * 5.0.5 update deps ([374ccb7](https://github.com/avil13/vue-sweetalert2/commit/374ccb74fab9794a604802dba733bf711585385e))
12 | * 5.0.6 ([0b7dfcd](https://github.com/avil13/vue-sweetalert2/commit/0b7dfcd545859314f27ea920cc0f2489736fc038))
13 | * change changelog builder to conventional-changelog ([01420ea](https://github.com/avil13/vue-sweetalert2/commit/01420ea6bc8dce27d4182bccd122b50e08353f27))
14 |
15 |
16 | ### BREAKING CHANGES
17 |
18 | * 🧨 removed shim-tsx
19 |
20 |
21 |
22 | ## [5.0.6](https://github.com/avil13/vue-sweetalert2/compare/v5.0.4...v5.0.6) (2022-05-10)
23 |
24 |
25 | ### Features
26 |
27 | * 5.0.5 update deps ([374ccb7](https://github.com/avil13/vue-sweetalert2/commit/374ccb74fab9794a604802dba733bf711585385e))
28 | * 5.0.6 ([0b7dfcd](https://github.com/avil13/vue-sweetalert2/commit/0b7dfcd545859314f27ea920cc0f2489736fc038))
29 | * change changelog builder to conventional-changelog ([01420ea](https://github.com/avil13/vue-sweetalert2/commit/01420ea6bc8dce27d4182bccd122b50e08353f27))
30 |
31 |
32 |
33 | ## [5.0.6](https://github.com/avil13/vue-sweetalert2/compare/v5.0.4...v5.0.6) (2022-05-10)
34 |
35 |
36 | ### Features
37 |
38 | * 5.0.5 update deps ([374ccb7](https://github.com/avil13/vue-sweetalert2/commit/374ccb74fab9794a604802dba733bf711585385e))
39 | * change changelog builder to conventional-changelog ([01420ea](https://github.com/avil13/vue-sweetalert2/commit/01420ea6bc8dce27d4182bccd122b50e08353f27))
40 |
41 |
42 |
43 | ## [5.0.5](https://github.com/avil13/vue-sweetalert2/compare/v5.0.4...v5.0.5) (2022-05-10)
44 |
45 |
46 | ### Features
47 |
48 | * 5.0.5 update deps ([374ccb7](https://github.com/avil13/vue-sweetalert2/commit/374ccb74fab9794a604802dba733bf711585385e))
49 | * change changelog builder to conventional-changelog ([442b56b](https://github.com/avil13/vue-sweetalert2/commit/442b56b5b17bdccbb627275ce1e6d8e52a832154))
50 |
51 |
52 |
53 | ## [5.0.4](https://github.com/avil13/vue-sweetalert2/compare/v5.0.3...v5.0.4) (2022-02-06)
54 |
55 |
56 | ### Bug Fixes
57 |
58 | * Tags are used again to display release versions - close [#138](https://github.com/avil13/vue-sweetalert2/issues/138) ([5af9bee](https://github.com/avil13/vue-sweetalert2/commit/5af9bee92bcc44ad7d185176096571ef7093acee))
59 |
60 |
61 |
62 | ## [5.0.3](https://github.com/avil13/vue-sweetalert2/compare/v4.2.1...v5.0.3) (2021-10-25)
63 |
64 |
65 | ### Bug Fixes
66 |
67 | * gh-pages ([3d585be](https://github.com/avil13/vue-sweetalert2/commit/3d585bec489744c116290cae94728f2b91314c9c))
68 | * gh-pages ([d28395e](https://github.com/avil13/vue-sweetalert2/commit/d28395e5d508df43d3d075a0bb67fa2e597a2f23))
69 | * issue report ([c28efae](https://github.com/avil13/vue-sweetalert2/commit/c28efae1fb51b5317e73c9d041c110eb87ad6608))
70 | * module ([7b316d3](https://github.com/avil13/vue-sweetalert2/commit/7b316d3977f292e2810fda4a2a4ed47f8010bc15))
71 | * package modules ([ec5964f](https://github.com/avil13/vue-sweetalert2/commit/ec5964f65a909d1aa295be69eee56dc834a91517))
72 | * pull_request - gh actions fix ([66a5d0a](https://github.com/avil13/vue-sweetalert2/commit/66a5d0a11d95d9026bb287f6027108a8b72f9623))
73 | * up gh-pages ([3775f4f](https://github.com/avil13/vue-sweetalert2/commit/3775f4f11b45e88af0f4d16f5441b35e7a424161))
74 |
75 |
76 | ### Features
77 |
78 | * upgrade to version 5 ([1c624df](https://github.com/avil13/vue-sweetalert2/commit/1c624df27303ff558ee1b1cfff869822a9cb4790))
79 | * version 4.3.0 ([dac456b](https://github.com/avil13/vue-sweetalert2/commit/dac456b8109532991dbef75009169537ce00efc8))
80 |
81 |
82 |
83 | ## [4.2.1](https://github.com/avil13/vue-sweetalert2/compare/v4.2.0...v4.2.1) (2021-03-18)
84 |
85 |
86 | ### Bug Fixes
87 |
88 | * added different theme in nuxt - fixed [#129](https://github.com/avil13/vue-sweetalert2/issues/129) ([2341b0b](https://github.com/avil13/vue-sweetalert2/commit/2341b0b5055bcc16ebf7ab8ccbcc3aaec5604fcf))
89 | * test ([0496979](https://github.com/avil13/vue-sweetalert2/commit/04969792d0c02e9dac2323f0196835aed81235e3))
90 |
91 |
92 |
93 | # [4.2.0](https://github.com/avil13/vue-sweetalert2/compare/v3.0.8...v4.2.0) (2021-01-28)
94 |
95 |
96 | ### Bug Fixes
97 |
98 | * audit ([1a3a7b3](https://github.com/avil13/vue-sweetalert2/commit/1a3a7b3f458f5e4059ad90476a4b8a277443ab97))
99 | * Fixed method call closes [#120](https://github.com/avil13/vue-sweetalert2/issues/120) [#121](https://github.com/avil13/vue-sweetalert2/issues/121) ([2cad309](https://github.com/avil13/vue-sweetalert2/commit/2cad3095525388680cb489714de67d49c482f0dc))
100 | * gh-pages ([ee7c23f](https://github.com/avil13/vue-sweetalert2/commit/ee7c23f2f2ed61df31013075b189bb06422fdec1))
101 | * gh-pages build ([0285198](https://github.com/avil13/vue-sweetalert2/commit/0285198caa799383ec6849b3e036043e43ea1243))
102 | * readme image ([9c2945d](https://github.com/avil13/vue-sweetalert2/commit/9c2945d051a850e9c337695c0a95a3f9a65a5d64))
103 | * tests params ([9fade68](https://github.com/avil13/vue-sweetalert2/commit/9fade68f97ff8c3861eb553803bc1a6f96e2c4ce))
104 |
105 |
106 | ### Features
107 |
108 | * add vue-3 supports ([6cde439](https://github.com/avil13/vue-sweetalert2/commit/6cde43969f1dee4a58995767c8444196a3e94603))
109 | * bump version 4.0.1 ([87372f5](https://github.com/avil13/vue-sweetalert2/commit/87372f5e67908e4baa7e371add8404b65becd49e))
110 | * example page ([3ba010e](https://github.com/avil13/vue-sweetalert2/commit/3ba010ebd31bf5fc72efa341081b11ad6f0aec94))
111 | * github workflow push version ([2f528c1](https://github.com/avil13/vue-sweetalert2/commit/2f528c18c4099dd71e028397fd72f19299a2861a))
112 | * monorepo ([4b0bc73](https://github.com/avil13/vue-sweetalert2/commit/4b0bc73fb3864001d73ea11bf844c57ba80e39f8))
113 | * monorepo workspaces ([a44858b](https://github.com/avil13/vue-sweetalert2/commit/a44858b4f28dab08b27d4e3486eca8b2b42756fe))
114 | * Prevent auto import of sweetalert style closes [#116](https://github.com/avil13/vue-sweetalert2/issues/116) ([a2820b6](https://github.com/avil13/vue-sweetalert2/commit/a2820b66df9c7417dbb6cc3cf02d58ba33797b09))
115 | * update sweetalert2 to v10 ([1a785bb](https://github.com/avil13/vue-sweetalert2/commit/1a785bb9f5a5150efdc35fff66c3d2b7f05e40be))
116 |
117 |
118 |
119 | ## [3.0.8](https://github.com/avil13/vue-sweetalert2/compare/v3.0.6...v3.0.8) (2020-08-29)
120 |
121 |
122 | ### Bug Fixes
123 |
124 | * fix types close[#104](https://github.com/avil13/vue-sweetalert2/issues/104) close[#105](https://github.com/avil13/vue-sweetalert2/issues/105) ([d372032](https://github.com/avil13/vue-sweetalert2/commit/d37203222612b31789bd34367b7697e289bdadc7))
125 | * **packages:** removed unused packages ([7181a00](https://github.com/avil13/vue-sweetalert2/commit/7181a00fd5c02cbe42203f406475389627d672b9))
126 | * prettier ([942f6dd](https://github.com/avil13/vue-sweetalert2/commit/942f6dd52be32fb170c64ffeb502b44342969127))
127 | * updated types fix[#105](https://github.com/avil13/vue-sweetalert2/issues/105) ([dda8d74](https://github.com/avil13/vue-sweetalert2/commit/dda8d74d8af44dbde83c80eb881e8961aeaab480))
128 |
129 |
130 | ### Features
131 |
132 | * added auto-changelog ([415404b](https://github.com/avil13/vue-sweetalert2/commit/415404b2f280e823abb16e35e34b1ad1e2765283))
133 | * update versions ([7ab4f55](https://github.com/avil13/vue-sweetalert2/commit/7ab4f552f0ef5c760b900be2c19bded8016d5229))
134 |
135 |
136 |
137 | ## [3.0.6](https://github.com/avil13/vue-sweetalert2/compare/v3.0.5...v3.0.6) (2020-06-29)
138 |
139 |
140 | ### Bug Fixes
141 |
142 | * version after revert ([f1e14db](https://github.com/avil13/vue-sweetalert2/commit/f1e14db9d96f285e4749772f94ad67be3d875237))
143 |
144 |
145 | ### Reverts
146 |
147 | * Revert "Disable force css including" ([90d691b](https://github.com/avil13/vue-sweetalert2/commit/90d691b0182a953d87a5d2159e5bc355e88a6f61))
148 |
149 |
150 |
151 | ## [3.0.5](https://github.com/avil13/vue-sweetalert2/compare/v1.6.3...v3.0.5) (2020-05-06)
152 |
153 |
154 |
155 | ## [1.6.3](https://github.com/avil13/vue-sweetalert2/compare/v1.6.2...v1.6.3) (2018-12-18)
156 |
157 |
158 |
159 | ## [1.6.2](https://github.com/avil13/vue-sweetalert2/compare/v1.4.2...v1.6.2) (2018-12-18)
160 |
161 |
162 |
163 | ## 1.4.2 (2018-06-14)
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4 |
5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6 |
7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8 |
9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10 |
11 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
12 |
13 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
14 |
15 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.1.0, available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/)
16 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Aleksey Pivkin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/README.md:
--------------------------------------------------------------------------------
1 | # vue-sweetalert2
2 |
3 | [](https://www.npmjs.com/package/vue-sweetalert2)
4 |
5 | [](https://coveralls.io/github/avil13/vue-sweetalert2?branch=master)
6 |
7 | Vue.js wrapper for SweetAlert2. With support SSR.
8 |
9 | [changelog](https://github.com/avil13/vue-sweetalert2/blob/master/packages/vue-sweetalert2/CHANGELOG.md)
10 |
11 | ---
12 |
13 | ## Attention:
14 |
15 | When using "Vue3: Composition API" it is better **not to use** this wrapper.
16 | It is more practical to call sweetalert2 directly.
17 |
18 | Also, it is better to do it to get feedback faster, and be closer to the documentation.
19 |
20 | ---
21 |
22 |
23 | 
24 |
25 |
26 |
27 | # [Demo](https://avil13.github.io/vue-sweetalert2/)
28 |
29 |
30 |
31 | 
32 |
33 | ---
34 |
35 | ## Get started
36 |
37 | ### Basics
38 |
39 | #### Bash
40 | ```bash
41 | npm install -S vue-sweetalert2
42 | ```
43 |
44 | ### Add types to TypeScript project
45 |
46 | ```js
47 | {
48 | //...tsconfig.json
49 | "types": [
50 | "vue-sweetalert2"
51 | ],
52 | }
53 | ```
54 |
55 | ## vue 2
56 |
57 | ```js
58 | // main.js
59 | import Vue from 'vue';
60 | import VueSweetalert2 from 'vue-sweetalert2';
61 |
62 | // If you don't need the styles, do not connect
63 | import 'sweetalert2/dist/sweetalert2.min.css';
64 |
65 | Vue.use(VueSweetalert2);
66 | ```
67 |
68 | ## vue 3
69 |
70 | ```js
71 | // main.js
72 | import { createApp } from 'vue'
73 | import App from './App.vue'
74 | import './index.css'
75 |
76 | import VueSweetalert2 from 'vue-sweetalert2';
77 | import 'sweetalert2/dist/sweetalert2.min.css';
78 |
79 | const app = createApp(App)
80 |
81 | app.use(VueSweetalert2);
82 |
83 | app.mount('#app');
84 | ```
85 |
86 | Now in the global object, you can access all the methods of [sweetalert2](https://github.com/limonte/sweetalert2).
87 |
88 | ```html
89 | // example-vue-component.vue
90 |
91 |
92 |
93 |
94 |
104 | ```
105 |
106 | // Or
107 |
108 | ```js
109 | Vue.swal('Hello Vue world!!!');
110 | ```
111 |
112 | ### Global options
113 |
114 | If you want to add global options like button colors, do something like this:
115 |
116 | ```js
117 | // main.js
118 | import Vue from 'vue';
119 | import VueSweetalert2 from 'vue-sweetalert2';
120 |
121 | const options = {
122 | confirmButtonColor: '#41b882',
123 | cancelButtonColor: '#ff7674',
124 | };
125 |
126 | Vue.use(VueSweetalert2, options);
127 | ```
128 |
129 | ### Custom styling
130 |
131 | Using scss styles are loaded so
132 |
133 | ```js
134 | // main.js
135 | import Vue from 'vue';
136 | import VueSweetalert2 from 'vue-sweetalert2';
137 |
138 | Vue.use(VueSweetalert2);
139 | ```
140 |
141 | ```scss
142 | // style.scss
143 | @import '~sweetalert2/src/variables';
144 |
145 | $swal2-background: #990000;
146 |
147 | @import '~sweetalert2/src/sweetalert2';
148 | ```
149 |
150 | ## Nuxt.js
151 |
152 | Install dependencies:
153 |
154 | ```bash
155 | npm install -S vue-sweetalert2
156 | ```
157 |
158 | Add `vue-sweetalert2/nuxt` to modules section of `nuxt.config.js`
159 |
160 | ```js
161 | {
162 | modules: ['vue-sweetalert2/nuxt'];
163 | }
164 | ```
165 |
166 | Or pass in global options like this:
167 |
168 | ```js
169 | {
170 | modules: [
171 | 'vue-sweetalert2/nuxt',
172 | ],
173 | sweetalert: {
174 | confirmButtonColor: '#41b882',
175 | cancelButtonColor: '#ff7674'
176 | }
177 | }
178 | ```
179 |
180 | ### Using a different theme in Nuxt
181 |
182 | Add `vue-sweetalert2/nuxt` to modules section of `nuxt.config.js`
183 |
184 | ```js
185 | {
186 | // Before doing so, install the "@sweetalert2/theme-dark"
187 | css: [ '@sweetalert2/theme-dark' ],
188 | modules: ['vue-sweetalert2/nuxt/no-css'];
189 | }
190 | ```
191 |
192 |
193 |
194 |
195 | ## The documentation for `sweetalert2`, you can find [here](https://sweetalert2.github.io/).
196 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/__mocks__/styleMock.js:
--------------------------------------------------------------------------------
1 | module.exports = {};
2 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/__tests__/swal-methods.spec.ts:
--------------------------------------------------------------------------------
1 | import { mount } from '@vue/test-utils';
2 | import Swal from 'sweetalert2';
3 |
4 | import VueSweetalert2 from '../src';
5 |
6 | import { beforeAll, describe, expect, it } from 'vitest';
7 | import { h } from 'vue';
8 |
9 | const factory = () => {
10 | return mount(
11 | {
12 | render() {
13 | return h('div');
14 | },
15 | },
16 | {
17 | global: {
18 | plugins: [VueSweetalert2]
19 | }
20 | },
21 | );
22 | };
23 |
24 | /**
25 | * Return list of all methods name in array: [ ['methodName'] ]
26 | * need for each list methods testing
27 | */
28 | function getAllMethodsNames(): (keyof typeof Swal)[][] {
29 | const keys = Object.keys(Swal) as (keyof typeof Swal)[];
30 |
31 | return keys
32 | .filter(name => typeof Swal[name] === 'function')
33 | .map(methodName => [methodName]);
34 | }
35 |
36 | const allMethodsNames = getAllMethodsNames();
37 |
38 | beforeAll(() => {
39 | // jest (or more precisely, jsdom) doesn't implement `window.scrollTo` so we need to mock it
40 | // eslint-disable-next-line @typescript-eslint/no-empty-function
41 | window.scrollTo = () => {}
42 | })
43 |
44 | describe('Vue-SweetAlert2 swal methods v.8.x', () => {
45 | // it.skip('should fire onOpen option key', async () => {
46 | // const Vue = factory({ title: 'Test title'});
47 | // const didOpenMock = jest.fn();
48 |
49 | // await Vue.swal.fire({
50 | // showClass: {
51 | // popup: '',
52 | // container: ''
53 | // },
54 | // didOpen: () => {
55 | // Vue.swal.clickConfirm();
56 | // didOpenMock();
57 | // }
58 | // });
59 |
60 | // expect(didOpenMock).toBeCalled();
61 | // });
62 |
63 | /*
64 | it.each(allMethodsNames)('should check methods "%s"', method => {
65 | const Vue = factory();
66 |
67 | expect(Vue.swal[method]).toBeTruthy();
68 | });
69 | */
70 |
71 | it.skip('isLoading()', () => {
72 | const comp = factory();
73 |
74 | expect('$swal' in comp).toBe(true);
75 | expect(typeof comp.swal.isLoading).toBe('function');
76 | })
77 | });
78 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/__tests__/swal.spec.ts:
--------------------------------------------------------------------------------
1 | import { mount } from '@vue/test-utils';
2 | import { describe, expect, it } from 'vitest';
3 | import { h } from 'vue';
4 | import VueSweetalert2 from '../src';
5 |
6 | const factoryComponent = () => {
7 | return mount(
8 | {
9 | render() {
10 | return h('div');
11 | },
12 | },
13 | {
14 | global: {
15 | plugins: [VueSweetalert2]
16 | }
17 | },
18 | );
19 | };
20 |
21 | describe('Vue-SweetAlert2 vm', () => {
22 | it('should vm', () => {
23 | const wrapper = factoryComponent();
24 |
25 | //@ts-ignore
26 | expect(typeof wrapper.vm.$swal).toBe('function');
27 | });
28 |
29 | it('should vm has', () => {
30 | const wrapper = factoryComponent();
31 | //@ts-ignore
32 | const pr = wrapper.vm.$swal('Test');
33 | expect(pr.then).toBeTruthy();
34 | });
35 |
36 | it('should vm has 2', () => {
37 | const wrapper = factoryComponent();
38 | //@ts-ignore
39 | const pr = wrapper.vm.$swal.fire('Test');
40 | expect(pr.then).toBeTruthy();
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avil13/vue-sweetalert2/00552b8813308bceccb7323ff4ead4c51fd92f2a/packages/vue-sweetalert2/assets/logo.png
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/assets/vue-sweetalert2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avil13/vue-sweetalert2/00552b8813308bceccb7323ff4ead4c51fd92f2a/packages/vue-sweetalert2/assets/vue-sweetalert2.gif
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/ignore-utils.js:
--------------------------------------------------------------------------------
1 | import requireHacker from 'require-hacker';
2 |
3 | requireHacker.hook('png', () => 'module.exports = ""');
4 | requireHacker.hook('css', () => 'module.exports = ""');
5 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/need-publish.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | PKG=$(node -p -e "require('./package.json').name")
4 |
5 | # we get the version of the package in a branch
6 | CURRENT_VERSION=$(node -p -e "require('./package.json').version")
7 | PUBLIC_VERSION=$(npm show ${PKG} version)
8 |
9 |
10 | if [[ $CURRENT_VERSION != $PUBLIC_VERSION ]];
11 | then
12 | echo 'TRUE';
13 | fi
14 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/nuxt/index.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-var-requires
2 | const {resolve} = require('path');
3 |
4 | module.exports = function nuxtVueSweetalert2(moduleOptions) {
5 | const options = Object.assign({}, this.options.sweetalert, moduleOptions);
6 |
7 | // Register plugin
8 | this.addPlugin({
9 | src: resolve(__dirname, 'plugin.js'),
10 | fileName: 'vue-sweetalert2.js',
11 | options,
12 | ssr: false,
13 | });
14 | };
15 |
16 | module.exports.meta = require('../package.json');
17 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/nuxt/index.mjs:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-var-requires
2 | import { resolve } from 'path';
3 |
4 | export default function nuxtVueSweetalert2(moduleOptions) {
5 | const options = Object.assign({}, this.options.sweetalert, moduleOptions);
6 |
7 | // Register plugin
8 | this.addPlugin({
9 | src: resolve(__dirname, 'plugin.js'),
10 | fileName: 'vue-sweetalert2.js',
11 | options,
12 | ssr: false,
13 | });
14 | };
15 |
16 | export const meta = require('../package.json');
17 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/nuxt/no-css.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | const {resolve} = require('path');
3 |
4 | module.exports = function nuxtVueSweetalert2(moduleOptions) {
5 | const options = Object.assign({}, this.options.sweetalert, moduleOptions);
6 |
7 | // Register plugin
8 | this.addPlugin({
9 | src: resolve(__dirname, 'plugin.no-css.js'),
10 | fileName: 'vue-sweetalert2.js',
11 | options,
12 | ssr: false,
13 | });
14 | };
15 |
16 | module.exports.meta = require('../package.json');
17 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/nuxt/no-css.mjs:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | import { resolve } from 'path';
3 |
4 | export default function nuxtVueSweetalert2(moduleOptions) {
5 | const options = Object.assign({}, this.options.sweetalert, moduleOptions);
6 |
7 | // Register plugin
8 | this.addPlugin({
9 | src: resolve(__dirname, 'plugin.no-css.js'),
10 | fileName: 'vue-sweetalert2.js',
11 | options,
12 | ssr: false,
13 | });
14 | };
15 |
16 | export const meta = require('../package.json');
17 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/nuxt/plugin.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import VueSweetalert2 from 'vue-sweetalert2';
3 |
4 | import 'sweetalert2/dist/sweetalert2.min.css';
5 |
6 | Vue.use(VueSweetalert2, <%= JSON.stringify(options, null, 2) %>);
7 |
8 | export default ({}, inject) => {
9 | inject('swal', Vue.swal)
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/nuxt/plugin.no-css.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import VueSweetalert2 from 'vue-sweetalert2';
3 |
4 | Vue.use(VueSweetalert2, <%= JSON.stringify(options, null, 2) %>);
5 |
6 | export default ({}, inject) => {
7 | inject('swal', Vue.swal)
8 | }
9 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-sweetalert2",
3 | "version": "5.0.11",
4 | "description": "Simple Vue sweetalert2 package",
5 | "main": "dist/vue-sweetalert.js",
6 | "module": "dist/vue-sweetalert.mjs",
7 | "browser": "dist/vue-sweetalert.umd.js",
8 | "types": "dist/index.d.ts",
9 | "exports": {
10 | ".": {
11 | "import": "./dist/vue-sweetalert.mjs",
12 | "require": "./dist/vue-sweetalert.umd.js",
13 | "types": "./dist/index.d.ts",
14 | "default": "./dist/vue-sweetalert.js"
15 | },
16 | "./nuxt": {
17 | "import": "./nuxt/index.mjs",
18 | "require": "./nuxt/index.js",
19 | "default": "./nuxt/index.js"
20 | },
21 | "./nuxt/no-css": {
22 | "import": "./nuxt/no-css.mjs",
23 | "require": "./nuxt/no-css.js",
24 | "default": "./nuxt/no-css.js"
25 | }
26 | },
27 | "files": [
28 | "src",
29 | "nuxt",
30 | "dist"
31 | ],
32 | "scripts": {
33 | "build": "vite build && tsc",
34 | "test": "vitest run",
35 | "test:watch": "vitest --watch",
36 | "test:coveralls": "vitest run --coverage && cat ./coverage/lcov.info | coveralls",
37 | "lint:prettier": "prettier --write src/*.ts",
38 | "lint:ts": "tsc --noEmit --skipLibCheck",
39 | "lint": "npm run lint:prettier && npm run lint:ts",
40 | "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
41 | "version": "npm run changelog && git add CHANGELOG.md",
42 | "prepublishOnly": "npm test && npm run build"
43 | },
44 | "keywords": [
45 | "sweetalert",
46 | "sweetalert2",
47 | "alert",
48 | "prompt",
49 | "ssr"
50 | ],
51 | "author": "Aleksey Pivkin @avil13",
52 | "license": "MIT",
53 | "homepage": "https://avil13.github.io/vue-sweetalert2/",
54 | "repository": {
55 | "type": "git",
56 | "url": "git+https://github.com/avil13/vue-sweetalert2.git"
57 | },
58 | "nodemonConfig": {
59 | "watch": [
60 | "src"
61 | ],
62 | "exec": "npm run prepublishOnly",
63 | "delay": 2500
64 | },
65 | "dependencies": {
66 | "sweetalert2": "11.4.4"
67 | },
68 | "peerDependencies": {
69 | "vue": "*"
70 | },
71 | "devDependencies": {
72 | "@babel/types": "^7.21.2",
73 | "@vue/test-utils": "^2.3.0",
74 | "conventional-changelog-cli": "^2.2.2",
75 | "jsdom": "^21.1.0",
76 | "typescript": "^4.9.5",
77 | "vite": "^4.1.4",
78 | "vitest": "^0.29.1",
79 | "vue": "3.*",
80 | "vue-tsc": "^1.2.0"
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/src/index.ts:
--------------------------------------------------------------------------------
1 | import {SweetAlertOptions} from 'sweetalert2';
2 | import Swal from 'sweetalert2/dist/sweetalert2.js';
3 |
4 | type TVueSwalInstance = typeof Swal & typeof Swal.fire;
5 |
6 | //@ts-ignore
7 | declare module 'vue/types/vue' {
8 | interface Vue {
9 | $swal: TVueSwalInstance;
10 | }
11 |
12 | interface VueConstructor {
13 | swal: TVueSwalInstance;
14 | }
15 | }
16 |
17 | class VueSweetalert2 {
18 | static install(vue: any, options: SweetAlertOptions = {}): void {
19 | const swalLocalInstance: typeof Swal = Swal.mixin(options);
20 |
21 | const swalFunction = function(...args: Parameters) {
22 | return swalLocalInstance.fire.call(swalLocalInstance, ...args);
23 | };
24 |
25 | Object.assign(swalFunction, Swal);
26 |
27 | Object.keys(Swal)
28 | //@ts-ignore
29 | .filter(key => typeof Swal[key] === 'function')
30 | .forEach(methodName => {
31 | //@ts-ignore
32 | swalFunction[methodName] = swalLocalInstance[methodName].bind(swalLocalInstance);
33 | })
34 |
35 |
36 | // add the instance method
37 | if (vue.config?.globalProperties && !vue.config.globalProperties.$swal) {
38 | // vue 3
39 | vue.config.globalProperties.$swal = swalFunction;
40 | vue.provide('$swal', swalFunction);
41 | } else if (!Object.prototype.hasOwnProperty.call(vue, '$swal')) {
42 | // vue 2
43 |
44 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment
45 | //@ts-ignore
46 | vue.prototype.$swal = swalFunction;
47 | vue['swal'] = swalFunction;
48 | }
49 | }
50 | }
51 |
52 | export default VueSweetalert2;
53 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.vue' {
2 | import Vue from 'vue';
3 | export default Vue;
4 | }
5 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2019",
4 | "module": "ESNext",
5 | "lib": ["ESNext", "DOM"],
6 | "moduleResolution": "Node",
7 | "strict": true,
8 | "sourceMap": true,
9 | "resolveJsonModule": true,
10 | "esModuleInterop": true,
11 | "noEmit": false,
12 | "noUnusedLocals": true,
13 | "noUnusedParameters": true,
14 | "noImplicitReturns": true,
15 | "declaration": true,
16 | "allowSyntheticDefaultImports": true,
17 | "outDir": "dist"
18 | },
19 | "include": ["./src"]
20 | }
21 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/vite.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 |
3 | import { defineConfig } from 'vite';
4 |
5 | //@ts-ignore
6 | const isDev = process.env.IS_DEV === 'dev';
7 |
8 | // https://vitejs.dev/config/
9 | export default defineConfig({
10 | build: {
11 | lib: {
12 | entry: 'src/index.ts',
13 | formats: ['umd', 'es', 'cjs'],
14 | name: 'vueSweetalert',
15 | fileName: 'vue-sweetalert',
16 | },
17 | minify: true,
18 | rollupOptions: {
19 | // external: /^lit-element/,
20 | },
21 | },
22 | });
23 |
--------------------------------------------------------------------------------
/packages/vue-sweetalert2/vitest.config.ts:
--------------------------------------------------------------------------------
1 | ///
2 | import { defineConfig } from 'vite'
3 |
4 | export default defineConfig({
5 | test: {
6 | environment: 'jsdom',
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "es2017",
6 | "es7",
7 | "es6",
8 | "dom"
9 | ],
10 | "module": "es2015",
11 | "moduleResolution": "node",
12 | "outDir": "dist",
13 | "declaration": true,
14 | "strict": true,
15 | "esModuleInterop": true,
16 | "experimentalDecorators": true,
17 | "noImplicitAny": false,
18 | "noImplicitThis": false,
19 | "strictNullChecks": true,
20 | "removeComments": true,
21 | "suppressImplicitAnyIndexErrors": true,
22 | "allowSyntheticDefaultImports": true,
23 | "baseUrl": ".",
24 | "sourceMap": true,
25 | "types": ["node"],
26 | "paths": {
27 | "@/*": [
28 | "packages/vue-sweetalert2/src/*"
29 | ]
30 | }
31 | },
32 | "include": [
33 | "packages/vue-sweetalert2/src/**/*.ts",
34 | "packages/vue-sweetalert2/src/**/*.vue"
35 | ],
36 | "exclude": ["node_modules", "dist", "example"]
37 | }
38 |
--------------------------------------------------------------------------------