Skip to content

Commit c82743e

Browse files
Adding support for Stimulus 2.0
1 parent 86d2565 commit c82743e

File tree

5 files changed

+46
-28
lines changed

5 files changed

+46
-28
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.0.0] - 2020-12-05
10+
11+
### Added
12+
13+
- Support for Stimulus 2.0
14+
15+
### Changed
16+
17+
- **Breaking** Using the new `values` static property
18+
19+
```diff
20+
- <form data-controller="nested-form" data-nested-form-wrapper-selector=".nested-form-wrapper">
21+
+ <form data-controller="nested-form" data-nested-form-wrapper-selector-value=".nested-form-wrapper">
22+
```
23+
924
## [1.1.0] - 2020-10-31
1025

1126
## Changed

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
133133
<div class="relative h-full max-w-5xl mx-auto px-4">
134134
<section class="mt-16">
135135
<form data-controller="nested-form">
136-
<template data-target="nested-form.template">
136+
<template data-nested-form-target="template">
137137
<div class="mt-4 nested-form-wrapper" data-new-record="true">
138138
<label for="NEW_RECORD" class="block text-sm font-medium leading-5 text-gray-700">New todo</label>
139139
<div class="mt-1 flex relative rounded-md shadow-sm">
@@ -181,7 +181,7 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
181181
</div>
182182
</div>
183183

184-
<div id="nested-form-target" data-target="nested-form.target"></div>
184+
<div id="nested-form-target" data-nested-form-target="target"></div>
185185

186186
<button
187187
id="nested-form-button"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"version": "yarn build"
3535
},
3636
"dependencies": {
37-
"stimulus": "^1.1.1"
37+
"stimulus": "^2.0.0"
3838
},
3939
"devDependencies": {
4040
"@babel/core": "7.11.6",

src/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { Controller } from 'stimulus'
22

33
export default class extends Controller {
44
static targets = ['target', 'template']
5+
static values = {
6+
wrapperSelector: String
7+
}
58

69
initialize () {
7-
this.wrapperSelector = this.data.get('wrapperSelector') || '.nested-form-wrapper'
10+
this.wrapperSelector = this.wrapperSelectorValue || '.nested-form-wrapper'
811
}
912

1013
add (e) {

yarn.lock

+24-24
Original file line numberDiff line numberDiff line change
@@ -1470,29 +1470,29 @@
14701470
execa "^4.0.3"
14711471
npm-run-path "^4.0.1"
14721472

1473-
"@stimulus/core@^1.1.1":
1474-
version "1.1.1"
1475-
resolved "https://registry.yarnpkg.com/@stimulus/core/-/core-1.1.1.tgz#42b0cfe5b73ca492f41de64b77a03980bae92c82"
1476-
integrity sha512-PVJv7IpuQx0MVPCBblXc6O2zbCmU8dlxXNH4bC9KK6LsvGaE+PCXXrXQfXUwAsse1/CmRu/iQG7Ov58himjiGg==
1473+
"@stimulus/core@^2.0.0":
1474+
version "2.0.0"
1475+
resolved "https://registry.yarnpkg.com/@stimulus/core/-/core-2.0.0.tgz#140c85318d6a8a8210c0faf182223b8459348877"
1476+
integrity sha512-ff70GafKtzc8zQ1/cG+UvL06GcifPWovf2wBEdjLMh9xO2GOYURO3y2RYgzIGYUIBefQwyfX2CLfJdZFJrEPTw==
14771477
dependencies:
1478-
"@stimulus/mutation-observers" "^1.1.1"
1478+
"@stimulus/mutation-observers" "^2.0.0"
14791479

1480-
"@stimulus/multimap@^1.1.1":
1481-
version "1.1.1"
1482-
resolved "https://registry.yarnpkg.com/@stimulus/multimap/-/multimap-1.1.1.tgz#b95e3fd607345ab36e5d5b55486ee1a12d56b331"
1483-
integrity sha512-26R1fI3a8uUj0WlMmta4qcfIQGlagegdP4PTz6lz852q/dXlG6r+uPS/bx+H8GtfyS+OOXVr3SkZ0Zg0iRqRfQ==
1480+
"@stimulus/multimap@^2.0.0":
1481+
version "2.0.0"
1482+
resolved "https://registry.yarnpkg.com/@stimulus/multimap/-/multimap-2.0.0.tgz#420cfa096ed6538df4a91dbd2b2842c1779952b2"
1483+
integrity sha512-pMBCewkZCFVB3e5mEMoyO9+9aKzHDITmf3OnPun51YWxlcPdHcwbjqm1ylK63fsoduIE+RowBpFwFqd3poEz4w==
14841484

1485-
"@stimulus/mutation-observers@^1.1.1":
1486-
version "1.1.1"
1487-
resolved "https://registry.yarnpkg.com/@stimulus/mutation-observers/-/mutation-observers-1.1.1.tgz#0f6c6f081308427fed2a26360dda0c173b79cfc0"
1488-
integrity sha512-/zCnnw1KJlWO2mrx0yxYaRFZWMGnDMdOgSnI4hxDLxdWVuL2HMROU8FpHWVBLjKY3T9A+lGkcrmPGDHF3pfS9w==
1485+
"@stimulus/mutation-observers@^2.0.0":
1486+
version "2.0.0"
1487+
resolved "https://registry.yarnpkg.com/@stimulus/mutation-observers/-/mutation-observers-2.0.0.tgz#3dbe37453bda47a6c795a90204ee8d77a799fb87"
1488+
integrity sha512-kx4VAJdPhIGBQKGIoUDC2tupEKorG3A+ckc2b1UiwInKTMAC1axOHU8ebcwhaJIxRqIrs8//4SJo9YAAOx6FEg==
14891489
dependencies:
1490-
"@stimulus/multimap" "^1.1.1"
1490+
"@stimulus/multimap" "^2.0.0"
14911491

1492-
"@stimulus/webpack-helpers@^1.1.1":
1493-
version "1.1.1"
1494-
resolved "https://registry.yarnpkg.com/@stimulus/webpack-helpers/-/webpack-helpers-1.1.1.tgz#eff60cd4e58b921d1a2764dc5215f5141510f2c2"
1495-
integrity sha512-XOkqSw53N9072FLHvpLM25PIwy+ndkSSbnTtjKuyzsv8K5yfkFB2rv68jU1pzqYa9FZLcvZWP4yazC0V38dx9A==
1492+
"@stimulus/webpack-helpers@^2.0.0":
1493+
version "2.0.0"
1494+
resolved "https://registry.yarnpkg.com/@stimulus/webpack-helpers/-/webpack-helpers-2.0.0.tgz#54296d2a2dffd4f962d2e802d99a3fdd84b8845f"
1495+
integrity sha512-D6tJWsAC024MwGEIKlUVYU8Ln87mlrmiwHvYAjipg+s8H4eLxUMQ3PZkWyPevfipH+oR3leuHsjYsK1gN5ViQA==
14961496

14971497
"@szmarczak/http-timer@^1.1.2":
14981498
version "1.1.2"
@@ -7589,13 +7589,13 @@ stealthy-require@^1.1.1:
75897589
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
75907590
integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=
75917591

7592-
stimulus@^1.1.1:
7593-
version "1.1.1"
7594-
resolved "https://registry.yarnpkg.com/stimulus/-/stimulus-1.1.1.tgz#53c2fded6849e7b85eed3ed8dd76e33abd74bec5"
7595-
integrity sha512-R0mBqKp48YnRDZOxZ8hiOH4Ilph3Yj78CIFTBkCwyHs4iGCpe7xlEdQ7cjIxb+7qVCSxFKgxO+mAQbsNgt/5XQ==
7592+
stimulus@^2.0.0:
7593+
version "2.0.0"
7594+
resolved "https://registry.yarnpkg.com/stimulus/-/stimulus-2.0.0.tgz#713c8b91a72ef90914b90955f0e705f004403047"
7595+
integrity sha512-xipy7BS5TVpg4fX6S8LhrYZp7cmHGjmk09WSAiVx1gF5S5g43IWsuetfUhIk8HfHUG+4MQ9nY0FQz4dRFLs/8w==
75967596
dependencies:
7597-
"@stimulus/core" "^1.1.1"
7598-
"@stimulus/webpack-helpers" "^1.1.1"
7597+
"@stimulus/core" "^2.0.0"
7598+
"@stimulus/webpack-helpers" "^2.0.0"
75997599

76007600
string-argv@^0.3.0:
76017601
version "0.3.1"

0 commit comments

Comments
 (0)