Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 0b670c3

Browse files
Upgrading to Stimulus 3 and bump dependencies
1 parent 9490147 commit 0b670c3

File tree

7 files changed

+410
-282
lines changed

7 files changed

+410
-282
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.17.3
1+
16.13.1

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.0.0] - 2021-12-27
10+
11+
### Chore
12+
13+
- **Breaking** Upgrading Stimulus to `3.x` and change namespace from `stimulus` to `@hotwired/stimulus`.
14+
- Upgrading dependencies
15+
- Upgrading Node to 16.13.1.
16+
17+
918
## [1.0.0] - 2021-07-14
1019

1120
### Added

index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<meta
6-
name="description"
7-
content="A Stimulus controller for showing notifications."
8-
/>
5+
<meta name="description" content="A Stimulus controller for showing notifications." />
96
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
107
<link href="https://unpkg.com/tailwindcss@^2.0/dist/tailwind.min.css" rel="stylesheet" />
118

129
<title>Stimulus Notification</title>
1310

1411
<script type="module" defer>
15-
import { Application } from 'stimulus'
12+
import { Application } from '@hotwired/stimulus'
1613
import Notification from './src/index'
1714

1815
const application = Application.start()

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
"np": "np --no-2fa --no-tests"
3030
},
3131
"dependencies": {
32-
"stimulus-use": "^0.25.3"
32+
"stimulus-use": "^0.50.0-2"
3333
},
3434
"devDependencies": {
35-
"@babel/core": "^7.14.0",
36-
"@babel/preset-typescript": "^7.13.0",
37-
"np": "^7.5.0",
35+
"@babel/core": "^7.16.5",
36+
"@babel/preset-typescript": "^7.16.5",
37+
"@hotwired/stimulus": "^3.0.1",
38+
"np": "^7.6.0",
3839
"prettier-standard": "16.4.1",
39-
"stimulus": "^2.0.0",
40-
"typescript": "^4.2.4",
41-
"vite": "^2.2.4"
40+
"typescript": "^4.5.4",
41+
"vite": "^2.7.7"
4242
},
4343
"peerDependencies": {
44-
"stimulus": "^2.0.0"
44+
"@hotwired/stimulus": "^3.0.1"
4545
}
4646
}

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import { Controller } from 'stimulus'
2-
import { useTransition } from 'stimulus-use/dist/use-transition'
1+
import { Controller } from '@hotwired/stimulus'
2+
import { useTransition } from 'stimulus-use'
33

44
export default class extends Controller {
55
timeout: number
66
enter: (event?: Event) => void
77
leave: (event?: Event) => void
88
transitioned: false
9-
delayValue: false
9+
delayValue: number
1010

1111
static values = {
12-
delay: Number
12+
delay: {
13+
type: Number,
14+
default: 3000
15+
}
1316
}
1417

1518
initialize () {
@@ -21,7 +24,7 @@ export default class extends Controller {
2124

2225
this.enter()
2326

24-
this.timeout = setTimeout(this.hide, this.delayValue || 3000)
27+
this.timeout = setTimeout(this.hide, this.delayValue)
2528
}
2629

2730
async hide () {

vite.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ module.exports = {
77
name: 'stimulus-notification'
88
},
99
rollupOptions: {
10-
external: ['stimulus-use/dist/use-transition', 'stimulus'],
10+
external: ['stimulus-use', '@hotwired/stimulus'],
1111
output: {
1212
globals: {
13-
stimulus: 'Stimulus',
14-
'stimulus-use/dist/use-transition': 'useTransition'
13+
'@hotwired/stimulus': 'Stimulus',
14+
'stimulus-use': 'useTransition'
1515
}
1616
}
1717
}

0 commit comments

Comments
 (0)