Repository: t4t5/sweetalert
Branch: master
Commit: d927c9bbc66b
Files: 111
Total size: 4.8 MB
Directory structure:
gitextract_94viukuh/
├── .babelrc
├── .editorconfig
├── .github/
│ └── ISSUE_TEMPLATE.md
├── .gitignore
├── .travis.yml
├── LICENSE.md
├── README.md
├── docs/
│ ├── CNAME
│ ├── assets/
│ │ ├── css/
│ │ │ ├── app.css
│ │ │ ├── guide.css
│ │ │ ├── header.css
│ │ │ ├── highlight.css
│ │ │ ├── index.css
│ │ │ ├── normalize.css
│ │ │ ├── table.css
│ │ │ └── variables.css
│ │ └── js/
│ │ ├── add-preview-buttons.js
│ │ ├── index.js
│ │ └── landing-text-rotater.js
│ ├── docs/
│ │ └── index.html
│ ├── guides/
│ │ └── index.html
│ └── index.html
├── docs-src/
│ ├── assets/
│ │ ├── css/
│ │ │ ├── app.styl
│ │ │ ├── guide.styl
│ │ │ ├── header.styl
│ │ │ ├── highlight.styl
│ │ │ ├── index.styl
│ │ │ ├── normalize.styl
│ │ │ ├── table.styl
│ │ │ └── variables.styl
│ │ └── js/
│ │ ├── add-preview-buttons.js
│ │ ├── index.js
│ │ └── landing-text-rotater.js
│ ├── docs/
│ │ └── index.md
│ ├── guides/
│ │ └── index.md
│ ├── index.hbs
│ ├── layout-docs.hbs
│ ├── layout-guides.hbs
│ └── layout.hbs
├── package.json
├── postcss.config.js
├── src/
│ ├── core.ts
│ ├── css/
│ │ ├── button-loader.css
│ │ ├── buttons.css
│ │ ├── content.css
│ │ ├── icons/
│ │ │ ├── error.css
│ │ │ ├── info.css
│ │ │ ├── success.css
│ │ │ └── warning.css
│ │ ├── icons.css
│ │ └── text.css
│ ├── modules/
│ │ ├── actions.ts
│ │ ├── class-list/
│ │ │ └── index.ts
│ │ ├── event-listeners.ts
│ │ ├── init/
│ │ │ ├── buttons.ts
│ │ │ ├── content.ts
│ │ │ ├── icon.ts
│ │ │ ├── index.ts
│ │ │ ├── modal.ts
│ │ │ ├── overlay.ts
│ │ │ └── text.ts
│ │ ├── markup/
│ │ │ ├── buttons.ts
│ │ │ ├── content.ts
│ │ │ ├── icons.ts
│ │ │ ├── index.ts
│ │ │ ├── modal.ts
│ │ │ └── overlay.ts
│ │ ├── options/
│ │ │ ├── buttons.ts
│ │ │ ├── content.ts
│ │ │ ├── deprecations.ts
│ │ │ └── index.ts
│ │ ├── state.ts
│ │ └── utils.ts
│ ├── polyfills.js
│ ├── sweetalert.css
│ ├── sweetalert.d.ts
│ └── sweetalert.js
├── test/
│ ├── actions.test.ts
│ ├── button-options.test.ts
│ ├── buttons.test.ts
│ ├── content.test.ts
│ ├── icons.test.ts
│ ├── index.test.ts
│ └── utils.ts
├── tsconfig.json
├── tslint.json
├── typings/
│ ├── core.d.ts
│ ├── modules/
│ │ ├── actions.d.ts
│ │ ├── class-list/
│ │ │ └── index.d.ts
│ │ ├── event-listeners.d.ts
│ │ ├── init/
│ │ │ ├── buttons.d.ts
│ │ │ ├── content.d.ts
│ │ │ ├── icon.d.ts
│ │ │ ├── index.d.ts
│ │ │ ├── modal.d.ts
│ │ │ ├── overlay.d.ts
│ │ │ └── text.d.ts
│ │ ├── markup/
│ │ │ ├── buttons.d.ts
│ │ │ ├── content.d.ts
│ │ │ ├── icons.d.ts
│ │ │ ├── index.d.ts
│ │ │ ├── modal.d.ts
│ │ │ └── overlay.d.ts
│ │ ├── options/
│ │ │ ├── buttons.d.ts
│ │ │ ├── content.d.ts
│ │ │ ├── deprecations.d.ts
│ │ │ └── index.d.ts
│ │ ├── state.d.ts
│ │ └── utils.d.ts
│ └── sweetalert.d.ts
└── webpack.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": ["env"],
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]
}
================================================
FILE: .editorconfig
================================================
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
================================================
FILE: .gitignore
================================================
*.codekit
*.sass-cache
*.DS_STORE
node_modules
npm-debug.log
types
dist
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- "6.9.1"
script: npm run buildtest
================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)
Copyright (c) 2014-present Tristan Edwards
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
A beautiful replacement for JavaScript's "alert"
## Installation
```bash
$ npm install --save sweetalert
```
## Usage
```javascript
import swal from 'sweetalert';
swal("Hello world!");
```
## Upgrading from 1.X
Many improvements and breaking changes have been introduced in the 2.0 release. Make sure you read the [upgrade guide](https://sweetalert.js.org/guides/#upgrading-from-1x) to avoid nasty surprises!
## Guides
- [Installation](https://sweetalert.js.org/guides/#installation)
- [Getting started](https://sweetalert.js.org/guides/#getting-started)
- [Advanced examples](https://sweetalert.js.org/guides/#advanced-examples)
- [Using with libraries](https://sweetalert.js.org/guides/#using-with-libraries)
- [Upgrading from 1.X](https://sweetalert.js.org/guides/#upgrading-from-1x)
## Documentation
- [Configuration](https://sweetalert.js.org/docs/#configuration)
- [Methods](https://sweetalert.js.org/docs/#methods)
- [Theming](https://sweetalert.js.org/docs/#theming)
## Examples
### An error message:
```javascript
swal("Oops!", "Something went wrong!", "error");
```
### A warning message, with a function attached to the confirm message:
- Using promises:
```javascript
swal({
title: "Are you sure?",
text: "Are you sure that you want to leave this page?",
icon: "warning",
dangerMode: true,
})
.then(willDelete => {
if (willDelete) {
swal("Deleted!", "Your imaginary file has been deleted!", "success");
}
});
```
- Using async/await:
```javascript
const willDelete = await swal({
title: "Are you sure?",
text: "Are you sure that you want to delete this file?",
icon: "warning",
dangerMode: true,
});
if (willDelete) {
swal("Deleted!", "Your imaginary file has been deleted!", "success");
}
```
### A prompt modal, where the user's input is logged:
- Using promises:
```javascript
swal("Type something:", {
content: "input",
})
.then((value) => {
swal(`You typed: ${value}`);
});
```
- Using async/await:
```javascript
const value = await swal("Type something:", {
content: "input",
});
swal(`You typed: ${value}`);
```
### In combination with Fetch:
- Using promises:
```javascript
swal({
text: "Wanna log some information about Bulbasaur?",
button: {
text: "Search!",
closeModal: false,
},
})
.then(willSearch => {
if (willSearch) {
return fetch("http://pokeapi.co/api/v2/pokemon/1");
}
})
.then(result => result.json())
.then(json => console.log(json))
.catch(err => {
swal("Oops!", "Seems like we couldn't fetch the info", "error");
});
```
- Using async/await:
```javascript
const willSearch = await swal({
text: "Wanna log some information about Bulbasaur?",
button: {
text: "Search!",
closeModal: false,
},
});
if (willSearch) {
try {
const result = await fetch("http://pokeapi.co/api/v2/pokemon/1");
const json = await result.json();
console.log(json);
} catch (err) {
swal("Oops!", "Seems like we couldn't fetch the info", "error");
}
}
```
## Using with React
SweetAlert has tools for [integrating with your favourite rendering library.](https://sweetalert.js.org/guides/#using-with-libraries).
If you're using React, you can install [SweetAlert with React](https://www.npmjs.com/package/@sweetalert/with-react) in addition to the main library, and easily add React components to your alerts like this:
```javascript
import React from 'react'
import swal from '@sweetalert/with-react'
swal(
Hello world!
This is now rendered with JSX!
)
```
[Read more about integrating with React](https://sweetalert.js.org/guides/#using-react)
## Contributing
### If you're changing the core library:
1. Make changes in the `src` folder.
2. Preview changes by running `npm run docs`
3. Submit pull request
### If you're changing the documentation:
1. Make changes in the `docs-src` folder.
2. Preview changes by running `npm run docs`
3. Run `npm run builddocs` to compile the changes to the `docs` folder
4. Submit pull request
## Contributors
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/t4t5/sweetalert#contributing)].
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/SweetAlert#backer)]
## Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/SweetAlert#sponsor)]
================================================
FILE: docs/CNAME
================================================
sweetalert.js.org
================================================
FILE: docs/assets/css/app.css
================================================
body {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: #f27474;
}
p a:hover {
text-decoration: underline;
}
button {
cursor: pointer;
}
button:focus {
outline: none;
}
ul {
list-style-type: none;
margin: 0;
}
.global-header {
background-color: #fff;
box-shadow: 0 1px 15px 0 rgba(192,72,25,0.32);
height: 80px;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
}
.global-header .logo {
width: 162px;
height: 36px;
background-image: url("/assets/images/logo.svg");
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
float: left;
margin-top: 22px;
margin-left: 15px;
}
@media all and (max-width: 600px) {
.global-header .logo {
float: none;
height: 29px;
display: block;
margin: 0 auto;
margin-top: 10px;
}
}
.global-header nav {
font-size: 17px;
color: #f27474;
float: right;
margin-top: 29px;
}
@media all and (max-width: 600px) {
.global-header nav {
float: none;
text-align: center;
font-size: 16px;
margin-top: 10px;
}
}
.global-header nav a {
position: relative;
cursor: pointer;
}
.global-header nav a::before {
content: "";
background-color: #f27474;
height: 3px;
border-radius: 2px;
position: absolute;
left: 0;
right: 0;
bottom: -5px;
display: none;
}
.global-header nav a:hover::before {
display: block;
}
.global-header nav .github-icon {
width: 26px;
height: 25px;
background-image: url("/assets/images/github.svg");
display: inline-block;
vertical-align: middle;
position: relative;
top: -3px;
}
.global-header ul {
white-space: nowrap;
padding: 0;
}
.global-header ul li {
display: inline-block;
margin: 0 15px;
}
.highlight {
background-color: #f8f8f8;
padding: 10px 23px;
font-size: 14px;
line-height: normal;
color: rgba(0,0,0,0.62);
overflow-x: auto;
}
.highlight .editor {
font-family: 'Inconsolata', monospace;
}
.highlight .line {
margin: 6px 0;
}
.highlight.bash .line::before {
content: "$ ";
opacity: 0.5;
}
.highlight .string {
color: #8858d2;
}
.highlight .html.name.tag {
color: #4ac14a;
}
.highlight .html.attribute-name {
color: #b646c1;
}
.highlight .js.name.function {
color: #f27474;
}
.highlight .js.boolean,
.highlight .js.numeric {
color: #4ac14a;
}
.highlight .js.control,
.highlight .js.assignment {
color: #b646c1;
}
.highlight .js.storage,
.highlight .js.variable {
color: #00a9ff;
}
.highlight .js.comment {
color: rgba(0,0,0,0.3);
}
.highlight .js.function {
color: inherit;
}
.highlight .js.variable.other,
.highlight .js.variable.parameter {
color: inherit;
}
.highlight .js.storage.class,
.highlight .js.class + * + .storage.modifier {
color: #b646c1;
}
.highlight .css.selector {
color: #4ac14a;
}
.highlight .css.property-name {
color: #00a9ff;
}
.highlight .css.property-value {
color: #8858d2;
}
.highlight .css.separator,
.highlight .css.terminator {
color: rgba(0,0,0,0.62);
}
.landing-top {
height: 370px;
position: relative;
padding-top: 80px;
}
@media all and (max-width: 1000px) {
.landing-top {
height: 600px;
}
}
.landing-top .bg {
background-image: linear-gradient(-132deg, #ff7d79 0%, #f28b74 92%);
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
-webkit-clip-path: url("#top-transition-clip-shape");
clip-path: url("#top-transition-clip-shape");
will-change: transform; /* For Safari */
/*
* For some reason, clip path makes the whole page
* flicker in Mobile Safari.
* So we disable it for mobile.
*/
}
@media all and (max-width: 600px) {
.landing-top .bg {
-webkit-clip-path: none;
clip-path: none;
}
}
.landing-top .swal-modal-example {
transform: none;
opacity: 1;
height: 292px;
width: 409px;
margin: 20px;
background-color: #fff;
box-shadow: 0 5px 22px 0 rgba(0,0,0,0.2);
border-radius: 8px;
margin-top: 59px;
text-align: center;
display: inline-block;
vertical-align: middle;
overflow: hidden;
transition: height 0.3s;
position: absolute;
z-index: 10;
top: 0;
left: 0;
}
@media all and (max-width: 1000px) {
.landing-top .swal-modal-example {
position: relative;
display: block;
margin: 20px auto;
}
}
@media all and (max-width: 450px) {
.landing-top .swal-modal-example {
width: 100%;
}
}
.landing-top .swal-modal-example[data-type="success"] {
height: 292px;
}
.landing-top .swal-modal-example[data-type="warning"] {
height: 325px;
}
.landing-top .swal-modal-example .swal-title {
padding-top: 10px;
}
.landing-top .swal-modal-example .swal-text {
color: rgba(0,0,0,0.48);
margin-top: 6px;
}
.landing-top .modal-content-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
z-index: 2;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s;
}
.landing-top .modal-content-overlay.show {
opacity: 1;
}
.landing-top .example-content {
display: none;
}
.landing-top .example-content.show {
display: block;
}
.landing-top .desc {
display: inline-block;
position: relative;
color: #fff;
margin-left: 50px;
max-width: calc(100% - 409px - 112px);
vertical-align: middle;
margin-top: 61px;
padding-left: 473px;
}
@media all and (max-width: 1000px) {
.landing-top .desc {
display: block;
max-width: none;
padding-left: 0;
margin-left: 0;
text-align: center;
}
}
.landing-top h2 {
font-size: 30px;
line-height: 51px;
font-weight: 300;
}
@media all and (max-width: 380px) {
.landing-top h2 {
font-size: 25px;
margin-top: -20px;
}
}
.landing-top .text-rotater {
display: block;
height: 57px;
overflow: hidden;
}
.landing-top .text-rotater span {
display: block;
transition: transform 0.4s;
}
.landing-top .text-rotater.slide-up span {
transform: translateY(-51px);
}
.landing-top .install {
background: rgba(120,40,40,0.32);
border-radius: 7px;
max-width: 357px;
padding: 12px;
}
@media all and (max-width: 1000px) {
.landing-top .install {
margin: 0 auto;
text-align: left;
}
}
.landing-top .install .button {
background: rgba(255,255,255,0.39);
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
}
.landing-top .install .command {
font-family: 'Inconsolata', monospace;
padding: 12px;
padding-left: 30px;
}
.landing-top .install .command::before {
content: "$";
opacity: 0.5;
transform: rotate(8deg);
font-size: 20px;
position: absolute;
margin-left: -27px;
margin-top: -2px;
}
.comparison-container {
padding-bottom: 70px;
text-align: center;
}
.comparison-container h3 {
font-size: 22px;
color: #b49993;
font-weight: 400;
display: block;
text-align: center;
margin-top: 93px;
margin-bottom: 80px;
}
.comparison-container .code-container {
text-align: center;
width: calc(50% - 60px);
display: inline-block;
vertical-align: middle;
}
@media all and (max-width: 600px) {
.comparison-container .code-container {
width: 100%;
}
}
.comparison-container .versus {
width: 35px;
height: 33px;
background-image: url("/assets/images/vs.svg");
display: inline-block;
vertical-align: middle;
margin: 0 30px;
}
@media all and (max-width: 600px) {
.comparison-container .versus {
margin: 30px;
margin-bottom: -10px;
}
}
.comparison-container h5 {
font-size: 13px;
color: rgba(0,0,0,0.21);
text-transform: uppercase;
text-align: left;
margin-bottom: 15px;
}
.comparison-container h5.swal-logo {
text-indent: -9999999px;
margin-top: 2px;
}
.comparison-container h5.swal-logo::after {
content: "";
background-image: url("/assets/images/logo-small.svg");
width: 91px;
height: 20px;
display: block;
}
.comparison-container .highlight {
text-align: left;
padding: 16px 23px;
}
.comparison-container .highlight span {
margin: 0 -4px;
}
.comparison-container .remark {
font-size: 20px;
color: #f27474;
margin-top: 80px;
}
.comparison-container .get-started-button {
background-color: #f27474;
color: #fff;
border-radius: 8px;
font-size: 22px;
padding: 14px 55px;
margin: 20px 0;
display: inline-block;
}
.customize-container {
background-color: #999eaf;
text-align: center;
color: #fff;
text-align: center;
background-image: url("/assets/images/pattern.png");
background-image: -webkit-image-set(url("/assets/images/pattern.png") 1x, url("/assets/images/pattern@2x.png") 2x);
padding: 40px 0;
-webkit-clip-path: url("#customization-transition-clip-shape");
clip-path: url("#customization-transition-clip-shape");
will-change: transform; /* For Safari */
}
@media all and (max-width: 600px) {
.customize-container {
-webkit-clip-path: none;
clip-path: none;
}
}
.customize-container h3 {
font-weight: 400;
font-size: 20px;
padding: 50px 0;
}
.customize-container .example-modals {
background-image: url("/assets/images/modal-examples.png");
background-image: -webkit-image-set(url("/assets/images/modal-examples.png") 1x, url("/assets/images/modal-examples@2x.png") 2x);
height: 284px;
background-size: auto 100%;
background-position: 0 0;
animation: scrollExamples 80s infinite linear;
}
.customize-container .view-api-button {
border: 3px solid #fff;
border-radius: 6px;
color: #fff;
padding: 12px 52px;
font-size: 18px;
margin-top: 60px;
display: inline-block;
}
@-moz-keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
@-webkit-keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
@-o-keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
@keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
.page-content {
$mobile-breakpoint: 880px;
}
.page-content table {
border-collapse: collapse;
border: none;
width: 100%;
}
.page-content th {
font-size: 17px;
color: rgba(0,0,0,0.34);
padding: 20px 15px;
text-transform: capitalize;
font-weight: 400;
}
.page-content thead > tr {
border-bottom: 2px solid rgba(0,0,0,0.1);
}
.page-content tr {
text-align: left;
box-shadow: 0px -1px 0px rgba(0,0,0,0.15);
}
.page-content tr:first-child {
box-shadow: none;
}
.page-content td {
padding: 17px;
}
.page-content td:first-child > code {
color: #2e9fef;
background: none;
border: none;
font-size: 16px;
padding: 0;
}
@media all and (min-width: mobile-breakpoint) {
.page-content tbody tr:nth-child(1) {
box-shadow: none;
}
}
@media all and (max-width: mobile-breakpoint) {
.page-content table,
.page-content thead,
.page-content tbody,
.page-content th,
.page-content td,
.page-content tr {
display: block;
}
.page-content thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
.page-content tr {
margin-top: -1px;
box-shadow: 0px -1px 0px 0px rgba(0,0,0,0.27);
}
.page-content td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: mobile-padding;
min-height: 20px;
}
.page-content td::before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 15px;
left: 15px;
width: mobile-padding;
width: calc((mobile-padding - 35px));
overflow: hidden;
text-overflow: ellipsis;
padding-right: 10px;
white-space: nowrap;
color: rgba(0,0,0,0.54);
font-family: page-font;
font-size: 16px;
text-transform: capitalize;
content: attr(data-name);
}
}
.doc-container {
overflow: hidden;
}
.side-menu {
width: 225px;
float: left;
padding-left: 20px;
position: fixed;
top: 88px;
}
@media all and (max-width: 600px) {
.side-menu {
float: none;
position: static;
margin-top: 120px;
text-align: center;
width: 100%;
margin-bottom: -60px;
padding-left: 0;
}
}
.side-menu .title {
font-size: 20px;
color: rgba(0,0,0,0.63);
font-weight: 600;
margin-top: 50px;
margin-bottom: 36px;
}
.side-menu a {
font-size: 17px;
color: rgba(0,0,0,0.42);
display: block;
margin: 18px 0;
}
.side-menu a:hover {
color: rgba(0,0,0,0.6);
}
.page-content {
float: left;
width: calc(100% - 225px - 20px);
margin-left: 225px;
min-height: 220px;
margin-top: 16px;
font-size: 16px;
color: rgba(0,0,0,0.59);
line-height: 29px;
}
@media all and (max-width: 600px) {
.page-content {
float: none;
margin-left: 0;
width: 100%;
}
}
.page-content h1 {
padding-top: 90px;
border-bottom: 1px solid rgba(0,0,0,0.15);
padding-bottom: 20px;
margin-bottom: 0;
}
.page-content h1::before {
content: "#";
position: absolute;
margin-left: -23px;
font-size: 24px;
margin-top: 3px;
color: #f38270;
font-weight: 500;
}
.page-content h1 a {
font-size: 30px;
color: rgba(0,0,0,0.85);
font-weight: 600;
}
.page-content h2,
.page-content h3 {
font-size: 20px;
margin-top: -70px;
padding-top: 100px;
}
.page-content h2 a,
.page-content h3 a {
color: rgba(0,0,0,0.7);
}
.page-content ul {
list-style-type: disc;
margin-bottom: 20px;
}
.page-content ul li {
margin: 5px 0;
}
.page-content img {
max-width: 100%;
}
.page-content.api > ul {
list-style-type: none;
padding-left: 30px;
}
.page-content.api > ul > li h3::before {
content: "";
width: 8px;
height: 8px;
position: absolute;
border-radius: 50%;
background-color: #f27474;
margin-left: -27px;
margin-top: 12px;
}
.page-content code {
font-family: 'Inconsolata', monospace;
padding: 3px 6px;
border-radius: 2px;
border: 1px solid rgba(0,0,0,0.12);
background: #f8f8f8;
font-size: 14px;
color: #f27474;
}
.page-content kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #444d56;
vertical-align: middle;
background-color: #fafbfc;
border: solid 1px #c6cbd1;
border-bottom-color: #959da5;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #959da5;
font-family: sans-serif;
}
.page-content preview-button {
/* Matches the "real" button's height: */
display: block;
height: 44px;
}
.page-content button.preview {
margin: 20px auto;
width: 110px;
display: block;
position: relative;
z-index: 2;
}
.page-content figcaption {
font-style: italic;
}
.swal-modal.red-bg {
background-color: rgba(255,0,0,0.28);
}
.mood-btn {
background: none;
border: none;
width: 28px;
height: 28px;
background-image: url("/assets/images/mood-sad.png");
background-size: 28px 28px;
padding: 4px;
background-position: center center;
box-sizing: content-box;
background-repeat: no-repeat;
margin: 0 7px;
position: relative;
overflow: hidden;
border-radius: 3px;
}
.mood-btn:hover::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.03);
}
.mood-btn[data-rating="2"] {
background-image: url("/assets/images/mood-neutral.png");
}
.mood-btn[data-rating="3"] {
background-image: url("/assets/images/mood-happy.png");
}
body {
font-family: 'Lato', 'Helvetica Neue', Helvetica, sans-serif;
}
svg.hidden {
display: block;
}
.page-container {
max-width: 1000px;
margin: 0 auto;
padding: 0 10px;
position: relative;
}
.preview {
background-color: #a3dd82;
box-shadow: 0 2px 8px 0 rgba(0,0,0,0.07);
border-radius: 4px;
border: none;
color: #fff;
font-size: 15px;
color: #fff;
padding: 9px 18px;
margin-top: 20px;
}
.preview::before {
content: "";
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 10px solid #fff;
display: inline-block;
margin-right: 5px;
}
.preview:hover {
background-color: #98d973;
}
footer {
padding: 40px 20px;
text-align: center;
color: #728194;
}
footer .love-icon {
background-image: url("/assets/images/heart-icon.svg");
width: 22px;
height: 20px;
display: inline-block;
vertical-align: middle;
margin: 0 5px;
position: relative;
top: -2px;
}
================================================
FILE: docs/assets/css/guide.css
================================================
.page-content {
$mobile-breakpoint: 880px;
}
.page-content table {
border-collapse: collapse;
border: none;
width: 100%;
}
.page-content th {
font-size: 17px;
color: rgba(0,0,0,0.34);
padding: 20px 15px;
text-transform: capitalize;
font-weight: 400;
}
.page-content thead > tr {
border-bottom: 2px solid rgba(0,0,0,0.1);
}
.page-content tr {
text-align: left;
box-shadow: 0px -1px 0px rgba(0,0,0,0.15);
}
.page-content tr:first-child {
box-shadow: none;
}
.page-content td {
padding: 17px;
}
.page-content td:first-child > code {
color: #2e9fef;
background: none;
border: none;
font-size: 16px;
padding: 0;
}
@media all and (min-width: mobile-breakpoint) {
.page-content tbody tr:nth-child(1) {
box-shadow: none;
}
}
@media all and (max-width: mobile-breakpoint) {
.page-content table,
.page-content thead,
.page-content tbody,
.page-content th,
.page-content td,
.page-content tr {
display: block;
}
.page-content thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
.page-content tr {
margin-top: -1px;
box-shadow: 0px -1px 0px 0px rgba(0,0,0,0.27);
}
.page-content td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: mobile-padding;
min-height: 20px;
}
.page-content td::before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 15px;
left: 15px;
width: mobile-padding;
width: calc((mobile-padding - 35px));
overflow: hidden;
text-overflow: ellipsis;
padding-right: 10px;
white-space: nowrap;
color: rgba(0,0,0,0.54);
font-family: page-font;
font-size: 16px;
text-transform: capitalize;
content: attr(data-name);
}
}
.doc-container {
overflow: hidden;
}
.side-menu {
width: 225px;
float: left;
padding-left: 20px;
position: fixed;
top: 88px;
}
@media all and (max-width: $phablet-width) {
.side-menu {
float: none;
position: static;
margin-top: 120px;
text-align: center;
width: 100%;
margin-bottom: -60px;
padding-left: 0;
}
}
.side-menu .title {
font-size: 20px;
color: rgba(0,0,0,0.63);
font-weight: 600;
margin-top: 50px;
margin-bottom: 36px;
}
.side-menu a {
font-size: 17px;
color: rgba(0,0,0,0.42);
display: block;
margin: 18px 0;
}
.side-menu a:hover {
color: rgba(0,0,0,0.6);
}
.page-content {
float: left;
width: calc(100% - 225px - 20px);
margin-left: 225px;
min-height: 220px;
margin-top: 16px;
font-size: 16px;
color: rgba(0,0,0,0.59);
line-height: 29px;
}
@media all and (max-width: $phablet-width) {
.page-content {
float: none;
margin-left: 0;
width: 100%;
}
}
.page-content h1 {
padding-top: 90px;
border-bottom: 1px solid rgba(0,0,0,0.15);
padding-bottom: 20px;
margin-bottom: 0;
}
.page-content h1::before {
content: "#";
position: absolute;
margin-left: -23px;
font-size: 24px;
margin-top: 3px;
color: #f38270;
font-weight: 500;
}
.page-content h1 a {
font-size: 30px;
color: rgba(0,0,0,0.85);
font-weight: 600;
}
.page-content h2,
.page-content h3 {
font-size: 20px;
margin-top: -70px;
padding-top: 100px;
}
.page-content h2 a,
.page-content h3 a {
color: rgba(0,0,0,0.7);
}
.page-content ul {
list-style-type: disc;
margin-bottom: 20px;
}
.page-content ul li {
margin: 5px 0;
}
.page-content img {
max-width: 100%;
}
.page-content.api > ul {
list-style-type: none;
padding-left: 30px;
}
.page-content.api > ul > li h3::before {
content: "";
width: 8px;
height: 8px;
position: absolute;
border-radius: 50%;
background-color: $main-color;
margin-left: -27px;
margin-top: 12px;
}
.page-content code {
font-family: $code-font;
padding: 3px 6px;
border-radius: 2px;
border: 1px solid rgba(0,0,0,0.12);
background: #f8f8f8;
font-size: 14px;
color: $main-color;
}
.page-content kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #444d56;
vertical-align: middle;
background-color: #fafbfc;
border: solid 1px #c6cbd1;
border-bottom-color: #959da5;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #959da5;
font-family: sans-serif;
}
.page-content preview-button {
/* Matches the "real" button's height: */
display: block;
height: 44px;
}
.page-content button.preview {
margin: 20px auto;
width: 110px;
display: block;
position: relative;
z-index: 2;
}
.page-content figcaption {
font-style: italic;
}
.swal-modal.red-bg {
background-color: rgba(255,0,0,0.28);
}
.mood-btn {
background: none;
border: none;
width: 28px;
height: 28px;
background-image: url("/assets/images/mood-sad.png");
background-size: 28px 28px;
padding: 4px;
background-position: center center;
box-sizing: content-box;
background-repeat: no-repeat;
margin: 0 7px;
position: relative;
overflow: hidden;
border-radius: 3px;
}
.mood-btn:hover::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.03);
}
.mood-btn[data-rating="2"] {
background-image: url("/assets/images/mood-neutral.png");
}
.mood-btn[data-rating="3"] {
background-image: url("/assets/images/mood-happy.png");
}
================================================
FILE: docs/assets/css/header.css
================================================
.global-header {
background-color: #fff;
box-shadow: 0 1px 15px 0 rgba(192,72,25,0.32);
height: $header-height;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
}
.global-header .logo {
width: 162px;
height: 36px;
background-image: url("/assets/images/logo.svg");
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
float: left;
margin-top: 22px;
margin-left: 15px;
}
@media all and (max-width: $phablet-width) {
.global-header .logo {
float: none;
height: 29px;
display: block;
margin: 0 auto;
margin-top: 10px;
}
}
.global-header nav {
font-size: 17px;
color: $main-color;
float: right;
margin-top: 29px;
}
@media all and (max-width: $phablet-width) {
.global-header nav {
float: none;
text-align: center;
font-size: 16px;
margin-top: 10px;
}
}
.global-header nav a {
position: relative;
cursor: pointer;
}
.global-header nav a::before {
content: "";
background-color: $main-color;
height: 3px;
border-radius: 2px;
position: absolute;
left: 0;
right: 0;
bottom: -5px;
display: none;
}
.global-header nav a:hover::before {
display: block;
}
.global-header nav .github-icon {
width: 26px;
height: 25px;
background-image: url("/assets/images/github.svg");
display: inline-block;
vertical-align: middle;
position: relative;
top: -3px;
}
.global-header ul {
white-space: nowrap;
padding: 0;
}
.global-header ul li {
display: inline-block;
margin: 0 15px;
}
================================================
FILE: docs/assets/css/highlight.css
================================================
.highlight {
background-color: #f8f8f8;
padding: 10px 23px;
font-size: 14px;
line-height: normal;
color: rgba(0,0,0,0.62);
overflow-x: auto;
}
.highlight .editor {
font-family: $code-font;
}
.highlight .line {
margin: 6px 0;
}
.highlight.bash .line::before {
content: "$ ";
opacity: 0.5;
}
.highlight .string {
color: #8858d2;
}
.highlight .html.name.tag {
color: #4ac14a;
}
.highlight .html.attribute-name {
color: #b646c1;
}
.highlight .js.name.function {
color: $main-color;
}
.highlight .js.boolean,
.highlight .js.numeric {
color: #4ac14a;
}
.highlight .js.control,
.highlight .js.assignment {
color: #b646c1;
}
.highlight .js.storage,
.highlight .js.variable {
color: #00a9ff;
}
.highlight .js.comment {
color: rgba(0,0,0,0.3);
}
.highlight .js.function {
color: inherit;
}
.highlight .js.variable.other,
.highlight .js.variable.parameter {
color: inherit;
}
.highlight .js.storage.class,
.highlight .js.class + * + .storage.modifier {
color: #b646c1;
}
.highlight .css.selector {
color: #4ac14a;
}
.highlight .css.property-name {
color: #00a9ff;
}
.highlight .css.property-value {
color: #8858d2;
}
.highlight .css.separator,
.highlight .css.terminator {
color: rgba(0,0,0,0.62);
}
================================================
FILE: docs/assets/css/index.css
================================================
.landing-top {
height: 370px;
position: relative;
padding-top: $header-height;
}
@media all and (max-width: $tablet-width) {
.landing-top {
height: 600px;
}
}
.landing-top .bg {
background-image: linear-gradient(-132deg, #ff7d79 0%, #f28b74 92%);
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
-webkit-clip-path: url("#top-transition-clip-shape");
clip-path: url("#top-transition-clip-shape");
will-change: transform; /* For Safari */
/*
* For some reason, clip path makes the whole page
* flicker in Mobile Safari.
* So we disable it for mobile.
*/
}
@media all and (max-width: $phablet-width) {
.landing-top .bg {
-webkit-clip-path: none;
clip-path: none;
}
}
.landing-top .swal-modal-example {
transform: none;
opacity: 1;
height: 292px;
width: 409px;
margin: 20px;
background-color: #fff;
box-shadow: 0 5px 22px 0 rgba(0,0,0,0.2);
border-radius: 8px;
margin-top: 59px;
text-align: center;
display: inline-block;
vertical-align: middle;
overflow: hidden;
transition: height 0.3s;
position: absolute;
z-index: 10;
top: 0;
left: 0;
}
@media all and (max-width: $tablet-width) {
.landing-top .swal-modal-example {
position: relative;
display: block;
margin: 20px auto;
}
}
@media all and (max-width: $mobile-width) {
.landing-top .swal-modal-example {
width: 100%;
}
}
.landing-top .swal-modal-example[data-type="success"] {
height: 292px;
}
.landing-top .swal-modal-example[data-type="warning"] {
height: 325px;
}
.landing-top .swal-modal-example .swal-title {
padding-top: 10px;
}
.landing-top .swal-modal-example .swal-text {
color: rgba(0,0,0,0.48);
margin-top: 6px;
}
.landing-top .modal-content-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
z-index: 2;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s;
}
.landing-top .modal-content-overlay.show {
opacity: 1;
}
.landing-top .example-content {
display: none;
}
.landing-top .example-content.show {
display: block;
}
.landing-top .desc {
display: inline-block;
position: relative;
color: #fff;
margin-left: 50px;
max-width: calc(100% - 409px - 112px);
vertical-align: middle;
margin-top: 61px;
padding-left: 473px;
}
@media all and (max-width: $tablet-width) {
.landing-top .desc {
display: block;
max-width: none;
padding-left: 0;
margin-left: 0;
text-align: center;
}
}
.landing-top h2 {
font-size: 30px;
line-height: 51px;
font-weight: 300;
}
@media all and (max-width: $small-width) {
.landing-top h2 {
font-size: 25px;
margin-top: -20px;
}
}
.landing-top .text-rotater {
display: block;
height: 57px;
overflow: hidden;
}
.landing-top .text-rotater span {
display: block;
transition: transform 0.4s;
}
.landing-top .text-rotater.slide-up span {
transform: translateY(-51px);
}
.landing-top .install {
background: rgba(120,40,40,0.32);
border-radius: 7px;
max-width: 357px;
padding: 12px;
}
@media all and (max-width: $tablet-width) {
.landing-top .install {
margin: 0 auto;
text-align: left;
}
}
.landing-top .install .button {
background: rgba(255,255,255,0.39);
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
}
.landing-top .install .command {
font-family: $code-font;
padding: 12px;
padding-left: 30px;
}
.landing-top .install .command::before {
content: "$";
opacity: 0.5;
transform: rotate(8deg);
font-size: 20px;
position: absolute;
margin-left: -27px;
margin-top: -2px;
}
.comparison-container {
padding-bottom: 70px;
text-align: center;
}
.comparison-container h3 {
font-size: 22px;
color: #b49993;
font-weight: 400;
display: block;
text-align: center;
margin-top: 93px;
margin-bottom: 80px;
}
.comparison-container .code-container {
text-align: center;
width: calc(50% - 60px);
display: inline-block;
vertical-align: middle;
}
@media all and (max-width: $phablet-width) {
.comparison-container .code-container {
width: 100%;
}
}
.comparison-container .versus {
width: 35px;
height: 33px;
background-image: url("/assets/images/vs.svg");
display: inline-block;
vertical-align: middle;
margin: 0 30px;
}
@media all and (max-width: $phablet-width) {
.comparison-container .versus {
margin: 30px;
margin-bottom: -10px;
}
}
.comparison-container h5 {
font-size: 13px;
color: rgba(0,0,0,0.21);
text-transform: uppercase;
text-align: left;
margin-bottom: 15px;
}
.comparison-container h5.swal-logo {
text-indent: -9999999px;
margin-top: 2px;
}
.comparison-container h5.swal-logo::after {
content: "";
background-image: url("/assets/images/logo-small.svg");
width: 91px;
height: 20px;
display: block;
}
.comparison-container .highlight {
text-align: left;
padding: 16px 23px;
}
.comparison-container .highlight span {
margin: 0 -4px;
}
.comparison-container .remark {
font-size: 20px;
color: $main-color;
margin-top: 80px;
}
.comparison-container .get-started-button {
background-color: $main-color;
color: #fff;
border-radius: 8px;
font-size: 22px;
padding: 14px 55px;
margin: 20px 0;
display: inline-block;
}
.customize-container {
background-color: #999eaf;
text-align: center;
color: #fff;
text-align: center;
background-image: url("/assets/images/pattern.png");
background-image: -webkit-image-set(url("/assets/images/pattern.png") 1x, url("/assets/images/pattern@2x.png") 2x);
padding: 40px 0;
-webkit-clip-path: url("#customization-transition-clip-shape");
clip-path: url("#customization-transition-clip-shape");
will-change: transform; /* For Safari */
}
@media all and (max-width: $phablet-width) {
.customize-container {
-webkit-clip-path: none;
clip-path: none;
}
}
.customize-container h3 {
font-weight: 400;
font-size: 20px;
padding: 50px 0;
}
.customize-container .example-modals {
background-image: url("/assets/images/modal-examples.png");
background-image: -webkit-image-set(url("/assets/images/modal-examples.png") 1x, url("/assets/images/modal-examples@2x.png") 2x);
height: 284px;
background-size: auto 100%;
background-position: 0 0;
animation: scrollExamples 80s infinite linear;
}
.customize-container .view-api-button {
border: 3px solid #fff;
border-radius: 6px;
color: #fff;
padding: 12px 52px;
font-size: 18px;
margin-top: 60px;
display: inline-block;
}
@-moz-keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
@-webkit-keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
@-o-keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
@keyframes scrollExamples {
0% {
background-position: 0 0;
}
100% {
background-position: -2146px 0;
}
}
================================================
FILE: docs/assets/css/normalize.css
================================================
body {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: $main-color;
}
p a:hover {
text-decoration: underline;
}
button {
cursor: pointer;
}
button:focus {
outline: none;
}
ul {
list-style-type: none;
margin: 0;
}
================================================
FILE: docs/assets/css/table.css
================================================
.page-content {
$mobile-breakpoint: 880px;
}
.page-content table {
border-collapse: collapse;
border: none;
width: 100%;
}
.page-content th {
font-size: 17px;
color: rgba(0,0,0,0.34);
padding: 20px 15px;
text-transform: capitalize;
font-weight: 400;
}
.page-content thead > tr {
border-bottom: 2px solid rgba(0,0,0,0.1);
}
.page-content tr {
text-align: left;
box-shadow: 0px -1px 0px rgba(0,0,0,0.15);
}
.page-content tr:first-child {
box-shadow: none;
}
.page-content td {
padding: 17px;
}
.page-content td:first-child > code {
color: #2e9fef;
background: none;
border: none;
font-size: 16px;
padding: 0;
}
@media all and (min-width: mobile-breakpoint) {
.page-content tbody tr:nth-child(1) {
box-shadow: none;
}
}
@media all and (max-width: mobile-breakpoint) {
.page-content table,
.page-content thead,
.page-content tbody,
.page-content th,
.page-content td,
.page-content tr {
display: block;
}
.page-content thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
.page-content tr {
margin-top: -1px;
box-shadow: 0px -1px 0px 0px rgba(0,0,0,0.27);
}
.page-content td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: mobile-padding;
min-height: 20px;
}
.page-content td::before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 15px;
left: 15px;
width: mobile-padding;
width: calc((mobile-padding - 35px));
overflow: hidden;
text-overflow: ellipsis;
padding-right: 10px;
white-space: nowrap;
color: rgba(0,0,0,0.54);
font-family: page-font;
font-size: 16px;
text-transform: capitalize;
content: attr(data-name);
}
}
================================================
FILE: docs/assets/css/variables.css
================================================
================================================
FILE: docs/assets/js/add-preview-buttons.js
================================================
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o tags.
* We want to transform these into button.preview,
* which onclick will run the JS code right above them!
*/
var previewPlaceholders = document.querySelectorAll('preview-button');
var createButton = function createButton(placeholder) {
var button = document.createElement('button');
button.className = "preview";
button.innerText = "Preview";
// Add button right above placeholder
placeholder.parentNode.insertBefore(button, placeholder);
return button;
};
var getCodeEl = function getCodeEl(placeholder) {
return placeholder.parentNode.previousSibling.previousSibling;
};
var getCode = function getCode(highlightEl) {
return highlightEl.innerText.trim();
};
var resetStyles = function resetStyles() {
var swalOverlay = document.querySelector('.swal-overlay');
var allSwalEls = swalOverlay.querySelectorAll('*');
swalOverlay.removeAttribute('style');
allSwalEls.forEach(function (el) {
el.removeAttribute('style');
});
};
var setStyles = function setStyles(code) {
var array = code.split(/[{}]/g);
var selector = array[0].trim();
var el = document.querySelector(selector);
var css = array[1].trim();
css = css.replace(/\s+/g, ' ');
css = css.replace(/;\s?/g, '; ');
css = css.replace(/:\s?/g, ': ');
el.style.cssText = css;
};
previewPlaceholders.forEach(function (placeholder) {
var highlightEl = getCodeEl(placeholder);
var code = getCode(highlightEl);
var button = createButton(placeholder);
var givenFunction = placeholder.dataset.function;
var lang = highlightEl.classList[1];
/*
* If there's a specified data-function on , call that.
* Othwerwise, just use the code from the highlightjs above it:
*/
button.addEventListener('click', function () {
if (givenFunction) {
window[givenFunction]();
} else if (lang === "css") {
swal("Sweet!", "I like customizing!");
resetStyles();
setStyles(code);
} else {
var transpiledCode = Babel.transform(code, { presets: ['es2015'] }).code;
eval(transpiledCode);
}
});
placeholder.remove();
});
},{"babel-standalone":2}],2:[function(require,module,exports){
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Babel"] = factory();
else
root["Babel"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ((function(modules) {
// Check all modules for deduplicated modules
for(var i in modules) {
if(Object.prototype.hasOwnProperty.call(modules, i)) {
switch(typeof modules[i]) {
case "function": break;
case "object":
// Module can be created from a template
modules[i] = (function(_m) {
var args = _m.slice(1), fn = modules[_m[0]];
return function (a,b,c) {
fn.apply(this, [a,b,c].concat(args));
};
}(modules[i]));
break;
default:
// Module is a copy of another module
modules[i] = modules[modules[i]];
break;
}
}
}
return modules;
}([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.version = exports.buildExternalHelpers = exports.availablePresets = exports.availablePlugins = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.transform = transform;
exports.transformFromAst = transformFromAst;
exports.registerPlugin = registerPlugin;
exports.registerPlugins = registerPlugins;
exports.registerPreset = registerPreset;
exports.registerPresets = registerPresets;
exports.transformScriptTags = transformScriptTags;
exports.disableScriptTags = disableScriptTags;
var _babelCore = __webpack_require__(290);
var Babel = _interopRequireWildcard(_babelCore);
var _transformScriptTags = __webpack_require__(629);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var isArray = Array.isArray || function (arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
/**
* Loads the given name (or [name, options] pair) from the given table object
* holding the available presets or plugins.
*
* Returns undefined if the preset or plugin is not available; passes through
* name unmodified if it (or the first element of the pair) is not a string.
*/
function loadBuiltin(builtinTable, name) {
if (isArray(name) && typeof name[0] === 'string') {
if (builtinTable.hasOwnProperty(name[0])) {
return [builtinTable[name[0]]].concat(name.slice(1));
}
return;
} else if (typeof name === 'string') {
return builtinTable[name];
}
// Could be an actual preset/plugin module
return name;
}
/**
* Parses plugin names and presets from the specified options.
*/
function processOptions(options) {
// Parse preset names
var presets = (options.presets || []).map(function (presetName) {
var preset = loadBuiltin(availablePresets, presetName);
if (preset) {
// workaround for babel issue
// at some point, babel copies the preset, losing the non-enumerable
// buildPreset key; convert it into an enumerable key.
if (isArray(preset) && _typeof(preset[0]) === 'object' && preset[0].hasOwnProperty('buildPreset')) {
preset[0] = _extends({}, preset[0], { buildPreset: preset[0].buildPreset });
}
} else {
throw new Error('Invalid preset specified in Babel options: "' + presetName + '"');
}
return preset;
});
// Parse plugin names
var plugins = (options.plugins || []).map(function (pluginName) {
var plugin = loadBuiltin(availablePlugins, pluginName);
if (!plugin) {
throw new Error('Invalid plugin specified in Babel options: "' + pluginName + '"');
}
return plugin;
});
return _extends({
babelrc: false
}, options, {
presets: presets,
plugins: plugins
});
}
function transform(code, options) {
return Babel.transform(code, processOptions(options));
}
function transformFromAst(ast, code, options) {
return Babel.transformFromAst(ast, code, processOptions(options));
}
var availablePlugins = exports.availablePlugins = {};
var availablePresets = exports.availablePresets = {};
var buildExternalHelpers = exports.buildExternalHelpers = Babel.buildExternalHelpers;
/**
* Registers a named plugin for use with Babel.
*/
function registerPlugin(name, plugin) {
if (availablePlugins.hasOwnProperty(name)) {
console.warn('A plugin named "' + name + '" is already registered, it will be overridden');
}
availablePlugins[name] = plugin;
}
/**
* Registers multiple plugins for use with Babel. `newPlugins` should be an object where the key
* is the name of the plugin, and the value is the plugin itself.
*/
function registerPlugins(newPlugins) {
Object.keys(newPlugins).forEach(function (name) {
return registerPlugin(name, newPlugins[name]);
});
}
/**
* Registers a named preset for use with Babel.
*/
function registerPreset(name, preset) {
if (availablePresets.hasOwnProperty(name)) {
console.warn('A preset named "' + name + '" is already registered, it will be overridden');
}
availablePresets[name] = preset;
}
/**
* Registers multiple presets for use with Babel. `newPresets` should be an object where the key
* is the name of the preset, and the value is the preset itself.
*/
function registerPresets(newPresets) {
Object.keys(newPresets).forEach(function (name) {
return registerPreset(name, newPresets[name]);
});
}
// All the plugins we should bundle
registerPlugins({
'check-es2015-constants': __webpack_require__(66),
'external-helpers': __webpack_require__(322),
'inline-replace-variables': __webpack_require__(323),
'syntax-async-functions': __webpack_require__(67),
'syntax-async-generators': __webpack_require__(195),
'syntax-class-constructor-call': __webpack_require__(196),
'syntax-class-properties': __webpack_require__(197),
'syntax-decorators': __webpack_require__(125),
'syntax-do-expressions': __webpack_require__(198),
'syntax-exponentiation-operator': __webpack_require__(199),
'syntax-export-extensions': __webpack_require__(200),
'syntax-flow': __webpack_require__(126),
'syntax-function-bind': __webpack_require__(201),
'syntax-function-sent': __webpack_require__(325),
'syntax-jsx': __webpack_require__(127),
'syntax-object-rest-spread': __webpack_require__(202),
'syntax-trailing-function-commas': __webpack_require__(128),
'transform-async-functions': __webpack_require__(326),
'transform-async-to-generator': __webpack_require__(129),
'transform-async-to-module-method': __webpack_require__(328),
'transform-class-constructor-call': __webpack_require__(203),
'transform-class-properties': __webpack_require__(204),
'transform-decorators': __webpack_require__(205),
'transform-decorators-legacy': __webpack_require__(329).default, // <- No clue. Nope.
'transform-do-expressions': __webpack_require__(206),
'transform-es2015-arrow-functions': __webpack_require__(68),
'transform-es2015-block-scoped-functions': __webpack_require__(69),
'transform-es2015-block-scoping': __webpack_require__(70),
'transform-es2015-classes': __webpack_require__(71),
'transform-es2015-computed-properties': __webpack_require__(72),
'transform-es2015-destructuring': __webpack_require__(73),
'transform-es2015-duplicate-keys': __webpack_require__(130),
'transform-es2015-for-of': __webpack_require__(74),
'transform-es2015-function-name': __webpack_require__(75),
'transform-es2015-instanceof': __webpack_require__(332),
'transform-es2015-literals': __webpack_require__(76),
'transform-es2015-modules-amd': __webpack_require__(131),
'transform-es2015-modules-commonjs': __webpack_require__(77),
'transform-es2015-modules-systemjs': __webpack_require__(208),
'transform-es2015-modules-umd': __webpack_require__(209),
'transform-es2015-object-super': __webpack_require__(78),
'transform-es2015-parameters': __webpack_require__(79),
'transform-es2015-shorthand-properties': __webpack_require__(80),
'transform-es2015-spread': __webpack_require__(81),
'transform-es2015-sticky-regex': __webpack_require__(82),
'transform-es2015-template-literals': __webpack_require__(83),
'transform-es2015-typeof-symbol': __webpack_require__(84),
'transform-es2015-unicode-regex': __webpack_require__(85),
'transform-es3-member-expression-literals': __webpack_require__(336),
'transform-es3-property-literals': __webpack_require__(337),
'transform-es5-property-mutators': __webpack_require__(338),
'transform-eval': __webpack_require__(339),
'transform-exponentiation-operator': __webpack_require__(132),
'transform-export-extensions': __webpack_require__(210),
'transform-flow-comments': __webpack_require__(340),
'transform-flow-strip-types': __webpack_require__(211),
'transform-function-bind': __webpack_require__(212),
'transform-jscript': __webpack_require__(341),
'transform-object-assign': __webpack_require__(342),
'transform-object-rest-spread': __webpack_require__(213),
'transform-object-set-prototype-of-to-assign': __webpack_require__(343),
'transform-proto-to-assign': __webpack_require__(344),
'transform-react-constant-elements': __webpack_require__(345),
'transform-react-display-name': __webpack_require__(214),
'transform-react-inline-elements': __webpack_require__(346),
'transform-react-jsx': __webpack_require__(215),
'transform-react-jsx-compat': __webpack_require__(347),
'transform-react-jsx-self': __webpack_require__(349),
'transform-react-jsx-source': __webpack_require__(350),
'transform-regenerator': __webpack_require__(86),
'transform-runtime': __webpack_require__(353),
'transform-strict-mode': __webpack_require__(216),
'undeclared-variables-check': __webpack_require__(354)
});
// All the presets we should bundle
registerPresets({
es2015: __webpack_require__(217),
es2016: __webpack_require__(218),
es2017: __webpack_require__(219),
latest: __webpack_require__(356),
react: __webpack_require__(357),
'stage-0': __webpack_require__(358),
'stage-1': __webpack_require__(220),
'stage-2': __webpack_require__(221),
'stage-3': __webpack_require__(222),
// ES2015 preset with es2015-modules-commonjs removed
// Plugin list copied from babel-preset-es2015/index.js
'es2015-no-commonjs': {
plugins: [__webpack_require__(83), __webpack_require__(76), __webpack_require__(75), __webpack_require__(68), __webpack_require__(69), __webpack_require__(71), __webpack_require__(78), __webpack_require__(80), __webpack_require__(72), __webpack_require__(74), __webpack_require__(82), __webpack_require__(85), __webpack_require__(66), __webpack_require__(81), __webpack_require__(79), __webpack_require__(73), __webpack_require__(70), __webpack_require__(84), [__webpack_require__(86), { async: false, asyncGenerators: false }]]
},
// ES2015 preset with plugins set to loose mode.
// Based off https://github.com/bkonkle/babel-preset-es2015-loose/blob/master/index.js
'es2015-loose': {
plugins: [[__webpack_require__(83), { loose: true }], __webpack_require__(76), __webpack_require__(75), __webpack_require__(68), __webpack_require__(69), [__webpack_require__(71), { loose: true }], __webpack_require__(78), __webpack_require__(80), __webpack_require__(130), [__webpack_require__(72), { loose: true }], [__webpack_require__(74), { loose: true }], __webpack_require__(82), __webpack_require__(85), __webpack_require__(66), [__webpack_require__(81), { loose: true }], __webpack_require__(79), [__webpack_require__(73), { loose: true }], __webpack_require__(70), __webpack_require__(84), [__webpack_require__(77), { loose: true }], [__webpack_require__(86), { async: false, asyncGenerators: false }]]
}
});
var version = exports.version = ("6.26.0");
// Listen for load event if we're in a browser and then kick off finding and
// running of scripts with "text/babel" type.
if (typeof window !== 'undefined' && window && window.addEventListener) {
window.addEventListener('DOMContentLoaded', function () {
return transformScriptTags();
}, false);
}
/**
* Transform
-
Type: string
Default: "" (empty string)
Description:
The modal's text. It can either be added as a configuration under the key text (as in the example below), or passed as the first and only parameter (e.g. swal("Hello world!")), or the second one if you have multiple string parameters (e.g. swal("A title", "Hello world!")).
Example:
swal({
text: "Hello world!",
});
-
Type: string
Default: "" (empty string)
Description:
The title of the modal. It can either be added as a configuration under the key title (as in the example below), or passed as the first string parameter – as long as it's not the only one – of the swal function (e.g. swal("Here's a title!", "Here's some text")).
Example:
swal({
title: "Here's a title!",
});
-
Type: string
Default: "" (empty string)
Description:
An icon for the modal. SweetAlert comes with 4 built-in icons that you can use:
"warning"
"error"
"success"
"info"
It can either be added as a configuration under the key icon, or passed as the third string parameter of the swal function (e.g. swal("Title", "Text", "success")).
Example:
swal({
icon: "success",
});
-
Type: string|boolean|ButtonOptions
Default:
{
text: "OK",
value: true,
visible: true,
className: "",
closeModal: true,
}
Description:
The confirm button that's shown by default. You can change its text by setting button to a string, or you can tweak more setting by passing a ButtonOptions object. Setting it to false hides the button.
Examples:
swal({
button: "Coolio",
});
swal({
button: {
text: "Hey ho!",
},
});
swal("Hello world!", {
button: false,
});
-
Type: boolean|string[]|ButtonOptions[]|ButtonList
Default:
{
cancel: {
text: "Cancel",
value: null,
visible: false,
className: "",
closeModal: true,
},
confirm: {
text: "OK",
value: true,
visible: true,
className: "",
closeModal: true
}
}
Description:
Specify the exact amount of buttons and their behaviour. If you use an array, you can set the elements as strings (to set only the text), a list of ButtonOptions, or a combination of both. You can also set one of the elements to true to simply get the default options.
If you want more than just the predefined cancel and confirm buttons, you need to specify a ButtonList object, with keys (the button's namespace) pointing to ButtonOptions.
You can also specify false to hide all buttons (same behaviour as the button option).
Examples:
swal({
buttons: ["Stop", "Do it!"],
});
swal({
buttons: [true, "Do it!"],
});
swal("Hello world!", {
buttons: false,
});
swal({
buttons: {
cancel: true,
confirm: true,
},
});
swal({
buttons: {
cancel: true,
confirm: "Confirm",
roll: {
text: "Do a barrell roll!",
value: "roll",
},
},
});
-
Type: string
Default: "" (empty string)
Description:
Add a custom class to the SweetAlert modal. This is handy for changing the appearance.
Example:
swal("Hello world!", {
className: "red-bg",
});
-
Type: boolean
Default: true
Description:
Decide whether the user should be able to dismiss the modal by clicking outside of it, or not.
Example:
swal({
closeOnClickOutside: false,
});
-
Type: boolean
Default: true
Description:
Decide whether the user should be able to dismiss the modal by hitting the ESC key, or not.
Example:
swal({
closeOnEsc: false,
});
| Name |
Description |
Example |
close |
Closes the currently open SweetAlert, as if you pressed the cancel button. |
swal.close() |
getState |
Get the state of the current SweetAlert modal. |
swal.getState() |
setActionValue |
Change the promised value of one of the modal's buttons. You can either pass in just a string (by default it changes the value of the confirm button), or an object. |
swal.setActionValue({ confirm: 'Text from input' }) |
stopLoading |
Removes all loading states on the modal's buttons. Use it in combination with the button option closeModal: false. |
swal.stopLoading() |