diff --git a/CHANGELOG.md b/CHANGELOG.md index c497951..78e3e8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Datastar +## 1.0.0-beta.1 - Unreleased + +- Require Datastar 0.21.3. + ## 1.0.0-alpha.3 - 2024-11-26 - Require Datastar 0.20.1. diff --git a/README.md b/README.md index bb87ef9..70e7917 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ # Datastar Plugin for Craft CMS -### A real-time, template-driven hypermedia framework for Craft CMS. +### A reactive, template-driven hypermedia framework for Craft CMS. -**This plugin is in alpha and its API may change.** +**This plugin is in beta and its API may change.** -This plugin integrates the [Datastar framework](https://data-star.dev/) into [Craft CMS](https://craftcms.com/), allowing you to create real-time front-ends driven by Twig templates. It aims to replace the need for front-end frameworks such as React, Vue.js and Alpine.js + htmx, and instead lets you manage state and run logic all within your Twig templates. +This plugin integrates [Datastar](https://data-star.dev/) with [Craft CMS](https://craftcms.com/), allowing you to create reactive frontends driven by Twig templates. It aims to replace the need for front-end frameworks such as React, Vue.js and Alpine.js + htmx, and instead lets you manage state and run logic within your Twig templates. With Datastar, you have the ability to define state and manipulate the DOM in real-time on the front-end, while modify the DOM with templates rendered on the back-end. Use-cases: @@ -38,7 +38,7 @@ This plugin requires [Craft CMS](https://craftcms.com/) 5.0.0 or later. To install the plugin, search for “Datastar” in the Craft Plugin Store, or install manually using composer. ```shell -composer require putyourlightson/craft-datastar:^1.0.0-alpha.2 +composer require putyourlightson/craft-datastar:^1.0.0-beta.1 ``` --- diff --git a/composer.json b/composer.json index e5d7d9f..68be073 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { "name": "putyourlightson/craft-datastar", "description": "A real-time, template-driven hypermedia framework for Craft.", - "version": "1.0.0-alpha.3", + "version": "1.0.0-beta.1", "type": "craft-plugin", "license": "mit", "require": { "php": "^8.2", "craftcms/cms": "^5.0", - "putyourlightson/craft-datastar-module": "1.0.0-alpha.3" + "putyourlightson/craft-datastar-module": "1.0.0-beta.1" }, "require-dev": { "craftcms/ecs": "dev-main", diff --git a/examples/_datastar/save-entry.twig b/examples/_datastar/save-entry.twig new file mode 100644 index 0000000..465a831 --- /dev/null +++ b/examples/_datastar/save-entry.twig @@ -0,0 +1,58 @@ +{% set response = datastar.runAction('entries/save-entry', { + entryId: signals.entryId, + title: signals.title, +}) %} + +{% if response.isSuccessful %} + {% fragment %} + {# https://daisyui.com/components/alert/#success-color #} + +
+ {{ signals.title }} +
+ + {% endfragment %} + {% do signals.entryId(0) %} +{% else %} + {% fragment %} + {# https://daisyui.com/components/alert/#error-color #} + + {% endfragment %} +{% endif %} + +{% do signals.alert(true) %} diff --git a/examples/_spark/save-entry.twig b/examples/_spark/save-entry.twig deleted file mode 100644 index 01e03c9..0000000 --- a/examples/_spark/save-entry.twig +++ /dev/null @@ -1,53 +0,0 @@ -{% set response = datastar.runAction('entries/save-entry', { - entryId: store.entryId, - title: store.title, -}) %} -{% if response.isSuccessful %} - {# https://daisyui.com/components/alert/#success-color #} - -
- {{ store.title }} -
- - {% do store.entryId(0) %} -{% else %} - {# https://daisyui.com/components/alert/#error-color #} - -{% endif %} - -{% do store.alert(true) %} diff --git a/examples/inline-entry-editing.twig b/examples/inline-entry-editing.twig index ca9c7c1..c6014d6 100644 --- a/examples/inline-entry-editing.twig +++ b/examples/inline-entry-editing.twig @@ -12,7 +12,7 @@
{# https://daisyui.com/components/table/ #}
- +
@@ -22,28 +22,28 @@ - {% for entry in craft.entries.all() %} + {% for entry in craft.entries.section('listings').all() %} diff --git a/examples/two-way-binding-function.twig b/examples/two-way-binding-function.twig index 86f065c..9d78e11 100644 --- a/examples/two-way-binding-function.twig +++ b/examples/two-way-binding-function.twig @@ -9,15 +9,15 @@ {# https://tailwindcss.com/docs/container #}
-
+
- +
- +
diff --git a/examples/two-way-binding-web-component.twig b/examples/two-way-binding-web-component.twig index 54914f0..b462e74 100644 --- a/examples/two-way-binding-web-component.twig +++ b/examples/two-way-binding-web-component.twig @@ -9,20 +9,20 @@ {# https://tailwindcss.com/docs/container #}
-
+
- +
- +
ID
{{ entry.id }} -
+
{{ entry.title }}
-
- +
+
{{ entry.author.username }} - - -