File tree Expand file tree Collapse file tree 10 files changed +82
-79
lines changed Expand file tree Collapse file tree 10 files changed +82
-79
lines changed Original file line number Diff line number Diff line change 1
1
# Release Notes for Datastar
2
2
3
- ## 1.0.0-RC.1 - Unreleased
3
+ ## 1.0.0-RC.1 - 2025-07-15
4
4
5
- - The plugin now requires Datastar [ v1.0.0-RC.1] ( https://github.com/starfederation/datastar/releases/tag/v1.0.0-RC.1 ) .
5
+ - The plugin now requires Datastar [ 1.0.0-RC.1] ( https://github.com/starfederation/datastar/releases/tag/v1.0.0-RC.1 ) or later, and Craft CMS 5.4.0 or later.
6
+ - Added the ` patchsignals ` Twig tag.
7
+ - Added the ` removeelements ` Twig tag.
6
8
- Renamed the ` fragments ` Twig tag to ` patchelements ` .
7
- - Renamed the ` removefragments ` Twig tag to ` removeelements ` .
8
9
- Renamed the ` defaultFragmentOptions ` config setting to ` defaultElementOptions ` .
10
+ - Removed the ` datastar.signals() ` and ` datastar.signalsFromClass() ` methods. Use the ` |json_encode ` filter instead.
11
+ - Removed the ` SignalsModel ` class. The ` signals ` variable passed into Datastar templates is now a regular array. Use the ` patchsignals ` Twig tag to update and remove signals.
9
12
10
13
## 1.0.0-beta.9 - 2025-03-29
11
14
Original file line number Diff line number Diff line change @@ -27,14 +27,14 @@ This plugin is licensed for free under the MIT License.
27
27
28
28
## Requirements
29
29
30
- This plugin requires [ Craft CMS] ( https://craftcms.com/ ) 5.0 .0 or later.
30
+ This plugin requires [ Craft CMS] ( https://craftcms.com/ ) 5.4 .0 or later.
31
31
32
32
## Installation
33
33
34
34
To install the plugin, search for “Datastar” in the Craft Plugin Store, or install manually using composer.
35
35
36
36
``` shell
37
- composer require putyourlightson/craft-datastar:^1.0.0-beta .1
37
+ composer require putyourlightson/craft-datastar:^1.0.0-RC .1
38
38
```
39
39
40
40
---
Original file line number Diff line number Diff line change 6
6
"license" : " mit" ,
7
7
"require" : {
8
8
"php" : " ^8.2" ,
9
- "craftcms/cms" : " ^5.0 " ,
9
+ "craftcms/cms" : " ^5.4 " ,
10
10
"putyourlightson/craft-datastar-module" : " ^1.0.0-RC.1"
11
11
},
12
12
"require-dev" : {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- {% set delay = signals .delay * 1000 %}
1
+ {% set delay = ( signals .delay ?? 1 ) * 1000 %}
2
2
{% set message = ' Hello, world!' %}
3
3
4
4
{% for i in range (0 , message |length - 1 ) %}
Original file line number Diff line number Diff line change
1
+ {% set response = datastar.runAction (' entries/save-entry' , {
2
+ entryId : signals .entryId ,
3
+ title : signals .title ,
4
+ }) %}
5
+
6
+ {% if response .isSuccessful %}
7
+ {% patchelements %}
8
+ {# https://daisyui.com/components/alert/#success-color #}
9
+ <div id =" alert" data-show =" alert.value" role =" alert" class =" alert alert-success" >
10
+ <svg
11
+ xmlns =" http://www.w3.org/2000/svg"
12
+ class =" h-6 w-6 shrink-0 stroke-current"
13
+ fill =" none"
14
+ viewBox =" 0 0 24 24" >
15
+ <path
16
+ stroke-linecap =" round"
17
+ stroke-linejoin =" round"
18
+ stroke-width =" 2"
19
+ d =" M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
20
+ </svg >
21
+ <span >
22
+ Entry successfully saved!
23
+ </span >
24
+ </div >
25
+ <div id =" title-{{ signals .entryId }}" >
26
+ {{ signals .title }}
27
+ </div >
28
+ <button id =" edit-{{ signals .entryId }}" data-on-click =" entryId.value = {{ signals .entryId }}; title..value = '{{ signals .title }}'" data-show =" entryId.value != {{ signals .entryId }}" class =" btn" >
29
+ Edit
30
+ </button >
31
+ {% endpatchelements %}
32
+ {% patchsignals {entryId : 0 } %}
33
+ {% else %}
34
+ {% patchelements %}
35
+ {# https://daisyui.com/components/alert/#error-color #}
36
+ <div id =" alert" data-show =" alert.value" role =" alert" class =" alert alert-error" >
37
+ <svg
38
+ xmlns =" http://www.w3.org/2000/svg"
39
+ class =" h-6 w-6 shrink-0 stroke-current"
40
+ fill =" none"
41
+ viewBox =" 0 0 24 24" >
42
+ <path
43
+ stroke-linecap =" round"
44
+ stroke-linejoin =" round"
45
+ stroke-width =" 2"
46
+ d =" M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
47
+ </svg >
48
+ <span >
49
+ Error!
50
+ {% for error in response .data .errors %}
51
+ {{ error | first }}
52
+ {% endfor %}
53
+ </span >
54
+ </div >
55
+ {% endpatchelements %}
56
+ {% endif %}
57
+
58
+ {% patchsignals {alert : true } %}
Original file line number Diff line number Diff line change 10
10
<h1 class =" text-gray-900 dark:text-white text-3xl font-semibold" >
11
11
Datastar SDK Demo
12
12
</h1 >
13
- <img src =" https://data-star.dev/static/images/rocket.png " alt =" Rocket " width =" 64" height =" 64" />
13
+ <img src =" https://putyourlightson.com/assets/logos/datastar.svg " alt =" Datastar Logo " width =" 64" height =" 64" />
14
14
</div >
15
15
<p class =" mt-2" >
16
16
SSE events will be streamed from the backend to the frontend.
21
21
</label >
22
22
<input data-bind-delay id =" delay" type =" number" step =" 100" min =" 0" class =" w-36 rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-sky-500 focus:outline focus:outline-sky-500 dark:disabled:border-gray-700 dark:disabled:bg-gray-800/20" />
23
23
</div >
24
- <button data-on-click =" {{ datastar.get (' _datastar /hello-world' ) }}" class =" rounded-md bg-sky-500 px-5 py-2.5 leading-5 font-semibold text-white hover:bg-sky-700 hover:text-gray-100 cursor-pointer" >
24
+ <button data-on-click =" {{ datastar.get (' _partials /hello-world' ) }}" class =" rounded-md bg-sky-500 px-5 py-2.5 leading-5 font-semibold text-white hover:bg-sky-700 hover:text-gray-100 cursor-pointer" >
25
25
Start
26
26
</button >
27
27
</div >
Original file line number Diff line number Diff line change 26
26
<tr >
27
27
<td >{{ entry .id }}</td >
28
28
<td >
29
- <div data-show =" entryId.value != {{ entry .id }}" >
29
+ <div data-show =" $ entryId != {{ entry .id }}" >
30
30
<div id =" title-{{ entry .id }}" >
31
31
{{ entry .title }}
32
32
</div >
33
33
</div >
34
- <div data-show =" entryId.value == {{ entry .id }}" style =" display: none" >
35
- <input data-bind-title data-on-keydown =" evt.key == 'Enter' && save.value.click() " type =" text" class =" input input-bordered w-full" >
34
+ <div data-show =" $ entryId == {{ entry .id }}" style =" display: none" >
35
+ <input data-bind-title data-on-keydown =" evt.key == 'Enter' && confirm('Are you sure?') && {{ datastar. post ( ' _partials/save-entry.twig ' ) }} " type =" text" class =" input input-bordered w-full" >
36
36
</div >
37
37
</td >
38
38
<td >{{ entry .author .username }}</td >
39
39
<td >
40
- <button id =" edit-{{ entry .id }}" data-on-click =" alert.value = false; entryId.value = {{ entry .id }}; title.value = '{{ entry .title }}'" data-show =" entryId.value != {{ entry .id }}" class =" btn" >
40
+ <button id =" edit-{{ entry .id }}" data-on-click =" $ alert = false; $ entryId = {{ entry .id }}; $ title = '{{ entry .title }}'" data-show =" $ entryId != {{ entry .id }}" class =" btn" >
41
41
Edit
42
42
</button >
43
- <button data-on-click =" alert.value = false; entryId.value = 0" data-show =" entryId.value == {{ entry .id }}" class =" btn" style =" display: none" >
43
+ <button data-on-click =" $ alert = false; $ entryId = 0" data-show =" $ entryId == {{ entry .id }}" class =" btn" style =" display: none" >
44
44
Cancel
45
45
</button >
46
- <button data-ref-save data- on-click =" confirm('Are you sure?') && {{ datastar.post (' _datastar /save-entry.twig' ) }}" data-show =" entryId.value == {{ entry .id }}" class =" btn btn-primary" style =" display: none" >
46
+ <button data-on-click =" confirm('Are you sure?') && {{ datastar.post (' _partials /save-entry.twig' ) }}" data-show =" $ entryId == {{ entry .id }}" class =" btn btn-primary" style =" display: none" >
47
47
Save
48
48
</button >
49
49
</td >
Original file line number Diff line number Diff line change 9
9
<body >
10
10
{# https://tailwindcss.com/docs/container #}
11
11
<div class =" container mx-auto max-w-xl py-16" >
12
- <div data-signals =" {reversed: ''}" data-on-reverse __window=" reversed.value = evt.detail.value" class =" flex flex-col space-y-8" >
12
+ <div data-signals =" {reversed: ''}" data-on-reverse __window=" $ reversed = evt.detail.value" class =" flex flex-col space-y-8" >
13
13
<div class =" space-y-2" >
14
14
<label >Name</label >
15
- <input data-bind-name data-on-input =" reverse(name.value )" class =" input input-bordered w-full" >
15
+ <input data-bind-name data-on-input =" reverse($ name)" class =" input input-bordered w-full" >
16
16
</div >
17
17
<div class =" space-y-2" >
18
18
<label >Reversed</label >
19
19
<div class =" alert h-14" >
20
- <span data-text =" reversed.value " ></span >
20
+ <span data-text =" $ reversed" ></span >
21
21
</div >
22
22
</div >
23
23
</div >
Original file line number Diff line number Diff line change 17
17
<div class =" space-y-2" >
18
18
<label >Reversed</label >
19
19
<div class =" alert h-14" >
20
- <span data-text =" reversed.value " ></span >
20
+ <span data-text =" $ reversed" ></span >
21
21
</div >
22
22
</div >
23
23
<reverse -component
24
- data-attributes-name =" name.value "
25
- data-on-reverse =" reversed.value = evt.detail.value"
24
+ data-attributes-name =" $ name"
25
+ data-on-reverse =" $ reversed = evt.detail.value"
26
26
></reverse -component >
27
27
</div >
28
28
</div >
You can’t perform that action at this time.
0 commit comments