Skip to content

Commit

Permalink
feat: upgrade ecosystem (#86)
Browse files Browse the repository at this point in the history
- poi > vite
- esbuild > tsup
  • Loading branch information
2nthony authored Jul 31, 2022
1 parent b12ee5b commit 0fd6b42
Show file tree
Hide file tree
Showing 17 changed files with 2,000 additions and 9,526 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- name: Checkout
Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache: "pnpm"

- run: pnpm install

Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
pnpm-lock.yaml
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# vercel-toast

> Framework-agnostic vercel design's toast component
[![NPM version](https://badgen.net/npm/v/vercel-toast?label=&color=29BC9B)](https://npmjs.com/package/vercel-toast)
[![NPM download](https://badgen.net/npm/dm/vercel-toast?label=&color=29BC9B)](https://npmjs.com/package/vercel-toast)

[![NPM version](https://badgen.net/npm/v/vercel-toast?label=)](https://npmjs.com/package/vercel-toast)
[![License](https://badgen.net/npm/license/vercel-toast?label=)](./LICENSE)
[![NPM download](https://badgen.net/npm/dm/vercel-toast?label=)](https://npmjs.com/package/vercel-toast)
Framework-agnostic vercel design's toast component

![](media/toast2.gif)

## Install
## Usage

```console
yarn add vercel-toast
npm i vercel-toast
```

```ts
// in js file
import "vercel-toast/css";
import { createToast } from "vercel-toast";

createToast("Hi from vercel toast!");
```

## Documentation
Expand All @@ -34,10 +41,6 @@ https://vercel-toast.vercel.app

[![sponsors](https://cdn.jsdelivr.net/gh/2nthony/sponsors-image/sponsors.svg)](https://github.com/sponsors/2nthony)

## Author

**vercel-toast** © [2nthony](https://github.com/2nthony), Released under the [MIT](./LICENSE) License.

Authored and maintained by **2nthony** with help from contributors ([list](https://github.com/2nthony/vercel-toast/contributors)).
## License

> GitHub [@2nthony](https://github.com/2nthony) · Twitter [@\_2nthony](https://twitter.com/_2nthony)
MIT © [2nthony](https://github.com/sponsors/2nthony)
18 changes: 18 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/saika@latest/dist/saika.css"
/>
<title>vercel-toast</title>
</head>
<body>
<div id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/saika@latest"></script>
<script src="index.js" type="module"></script>
</body>
</html>
26 changes: 13 additions & 13 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import ghCorner from '@saika/github-corner'
import '../src/style.css'
import { createToast, destroyAllToasts } from '../src'
import { copyCode } from 'saika-code-block-buttons'
import ghCorner from "@saika/github-corner";
import "../src/style.css";
import { createToast, destroyAllToasts } from "../src";
import { copyCode } from "saika-code-block-buttons";

window.createToast = createToast
window.destroyAllToasts = destroyAllToasts
window.createToast = createToast;
window.destroyAllToasts = destroyAllToasts;

new Saika({
target: 'app',
highlight: ['bash'],
target: "app",
highlight: ["bash"],
nav: [
{
title: 'GitHub',
link: 'https://github.com/2nthony/vercel-toast',
title: "GitHub",
link: "https://github.com/2nthony/vercel-toast",
},
],
router: {
mode: 'history',
mode: "history",
},

plugins: [
ghCorner({
repo: '2nthony/vercel-toast',
repo: "2nthony/vercel-toast",
pinned: true,
}),
],
Expand All @@ -31,4 +31,4 @@ new Saika({
footer: `© {{ new Date().getFullYear() }} Made with <font color="#f04">❤</font> by
<a href="https://github.com/2nthony">2nthony</a>.
Powered by <a href="https://saika.vercel.app">Saika</a>.`,
})
});
11 changes: 0 additions & 11 deletions example/poi.config.js

This file was deleted.

81 changes: 41 additions & 40 deletions example/public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ Framework-agnostic vercel design's toast component (≈1KB Gzipped).
## Use via bundler

```bash
npm install vercel-toast
npm i vercel-toast
```

```js
import 'vercel-toast/dist/vercel-toast.css'
import { createToast } from 'vercel-toast'
import "vercel-toast/css";
// import "vercel-toast/dist/vercel-toast.css";
import { createToast } from "vercel-toast";

createToast('The Evil Rabbit jumped over the fence.')
createToast("The Evil Rabbit jumped over the fence.");
```

## Use via CDN
Expand All @@ -26,7 +27,7 @@ createToast('The Evil Rabbit jumped over the fence.')
<script src="https://unpkg.com/vercel-toast"></script>

<script>
toast.createToast('The Evil Rabbit jumped over the fence.')
toast.createToast("The Evil Rabbit jumped over the fence.");
</script>
```

Expand All @@ -41,115 +42,115 @@ createToast('The Evil Rabbit jumped over the fence.')
### Destroy all toasts

```js
import { destroyAllToasts } from 'vercel-toast'
import { destroyAllToasts } from "vercel-toast";

destroyAllToasts()
destroyAllToasts();
```

<button @click="destroyAllToasts">Destroy all toast</button>

### Default

```js
import { createToast } from 'vercel-toast'
import { createToast } from "vercel-toast";

createToast('The Evil Rabbit jumped over the fence.', {
createToast("The Evil Rabbit jumped over the fence.", {
timeout: 3000, // in 3 seconds
})
});
```

<button @click="showDefault">Show Toast</button>

### Multiline

```js
import { createToast } from 'vercel-toast'
import { createToast } from "vercel-toast";

createToast(
'The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence.',
"The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence.",
{
timeout: 3000,
},
)
);
```

<button @click="multiline">Show Toast</button>

### Use a DOM node as message

```js
const message = document.createElement('div')
message.innerHTML = `<i style="color:magenta;">The Evil Rabbit jumped over the fence.</i>`
const message = document.createElement("div");
message.innerHTML = `<i style="color:magenta;">The Evil Rabbit jumped over the fence.</i>`;

createToast(message, {
timeout: 3000,
})
});
```

<button @click="domNode">Show Toast</button>

### Action

```js
import { createToast } from 'vercel-toast'
import { createToast } from "vercel-toast";

createToast('The Evil Rabbit jumped over the fence.', {
createToast("The Evil Rabbit jumped over the fence.", {
action: {
text: 'Undo',
text: "Undo",
callback(toast) {
toast.destroy()
toast.destroy();
},
},
})
});
```

<button @click="action">Show Toast</button>

### Action + Cancel

```js
import { createToast } from 'vercel-toast'
import { createToast } from "vercel-toast";

createToast(
'The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence again.',
"The Evil Rabbit jumped over the fence. The Evil Rabbit jumped over the fence again.",
{
action: {
text: 'Undo',
text: "Undo",
callback(toast) {
toast.destroy()
toast.destroy();
},
},
cancel: 'Cancel',
cancel: "Cancel",
},
)
);
```

<button @click="actionAndCancel">Show Toast</button>

### With types

```js
import { createToast } from 'vercel-toast'
import { createToast } from "vercel-toast";

createToast('The Evil Rabbit jumped over the fence.', {
createToast("The Evil Rabbit jumped over the fence.", {
timeout: 3000,
type: 'success',
})
type: "success",
});

createToast('The Evil Rabbit jumped over the fence.', {
createToast("The Evil Rabbit jumped over the fence.", {
timeout: 3000,
type: 'warning',
})
type: "warning",
});

createToast('The Evil Rabbit jumped over the fence.', {
createToast("The Evil Rabbit jumped over the fence.", {
timeout: 3000,
type: 'error',
})
type: "error",
});

createToast('The Evil Rabbit jumped over the fence.', {
createToast("The Evil Rabbit jumped over the fence.", {
timeout: 3000,
type: 'dark',
})
type: "dark",
});
```

<button @click="withType('success')">Show Success</button>
Expand Down
14 changes: 0 additions & 14 deletions example/public/index.html

This file was deleted.

Loading

1 comment on commit 0fd6b42

@vercel
Copy link

@vercel vercel bot commented on 0fd6b42 Jul 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vercel-toast – ./

vercel-toast-2nthony.vercel.app
vercel-toast-git-master-2nthony.vercel.app
vercel-toast.vercel.app

Please sign in to comment.