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

Commit

Permalink
Upgrading to Stimulus 3 and bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumebriday committed Dec 27, 2021
1 parent 9490147 commit 0b670c3
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 282 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.3
16.13.1
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0] - 2021-12-27

### Chore

- **Breaking** Upgrading Stimulus to `3.x` and change namespace from `stimulus` to `@hotwired/stimulus`.
- Upgrading dependencies
- Upgrading Node to 16.13.1.


## [1.0.0] - 2021-07-14

### Added
Expand Down
7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="description"
content="A Stimulus controller for showing notifications."
/>
<meta name="description" content="A Stimulus controller for showing notifications." />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://unpkg.com/tailwindcss@^2.0/dist/tailwind.min.css" rel="stylesheet" />

<title>Stimulus Notification</title>

<script type="module" defer>
import { Application } from 'stimulus'
import { Application } from '@hotwired/stimulus'
import Notification from './src/index'

const application = Application.start()
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
"np": "np --no-2fa --no-tests"
},
"dependencies": {
"stimulus-use": "^0.25.3"
"stimulus-use": "^0.50.0-2"
},
"devDependencies": {
"@babel/core": "^7.14.0",
"@babel/preset-typescript": "^7.13.0",
"np": "^7.5.0",
"@babel/core": "^7.16.5",
"@babel/preset-typescript": "^7.16.5",
"@hotwired/stimulus": "^3.0.1",
"np": "^7.6.0",
"prettier-standard": "16.4.1",
"stimulus": "^2.0.0",
"typescript": "^4.2.4",
"vite": "^2.2.4"
"typescript": "^4.5.4",
"vite": "^2.7.7"
},
"peerDependencies": {
"stimulus": "^2.0.0"
"@hotwired/stimulus": "^3.0.1"
}
}
13 changes: 8 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Controller } from 'stimulus'
import { useTransition } from 'stimulus-use/dist/use-transition'
import { Controller } from '@hotwired/stimulus'
import { useTransition } from 'stimulus-use'

export default class extends Controller {
timeout: number
enter: (event?: Event) => void
leave: (event?: Event) => void
transitioned: false
delayValue: false
delayValue: number

static values = {
delay: Number
delay: {
type: Number,
default: 3000
}
}

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

this.enter()

this.timeout = setTimeout(this.hide, this.delayValue || 3000)
this.timeout = setTimeout(this.hide, this.delayValue)
}

async hide () {
Expand Down
6 changes: 3 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module.exports = {
name: 'stimulus-notification'
},
rollupOptions: {
external: ['stimulus-use/dist/use-transition', 'stimulus'],
external: ['stimulus-use', '@hotwired/stimulus'],
output: {
globals: {
stimulus: 'Stimulus',
'stimulus-use/dist/use-transition': 'useTransition'
'@hotwired/stimulus': 'Stimulus',
'stimulus-use': 'useTransition'
}
}
}
Expand Down
Loading

0 comments on commit 0b670c3

Please sign in to comment.