|
1 | 1 | # simple-stack-query |
2 | 2 |
|
| 3 | +## 0.2.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#77](https://github.com/bholmesdev/simple-stack/pull/77) [`f1431d5`](https://github.com/bholmesdev/simple-stack/commit/f1431d56e6a25b8854b749614e5d8af865e33c82) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Revamps APIs to fix bugs and unlock a new suite of features. |
| 8 | + |
| 9 | + ```astro |
| 10 | + <RootElement> |
| 11 | + <button data-target="btn">Click me</button> |
| 12 | + </RootElement> |
| 13 | +
|
| 14 | + <script> |
| 15 | + RootElement.ready(($) => { |
| 16 | + $('btn').addEventListener('click', () => { |
| 17 | + console.log("It's like JQuery but not!"); |
| 18 | + }); |
| 19 | + }); |
| 20 | + </script> |
| 21 | + ``` |
| 22 | + |
| 23 | + - Support multiple instances of the same component. Before, only the first instance would become interactive. |
| 24 | + - Enable data passing from the server to your client script using the `data` property. |
| 25 | + - Add an `effect()` utility to interact with the [Signal polyfill](https://github.com/proposal-signals/signal-polyfill?tab=readme-ov-file#creating-a-simple-effect) for state management. |
| 26 | + |
| 27 | + [Visit revamped documentation page](https://simple-stack.dev/query) to learn how to use the new features. |
| 28 | + |
| 29 | + ## Migration for v0.1 |
| 30 | + |
| 31 | + If you were an early adopter of v0.1, thank you! You'll a few small updates to use the new APIs: |
| 32 | + |
| 33 | + - Wrap any HTML you want to target with the global `RootElement` component. |
| 34 | + - Remove the `# simple-stack-query from your `data-target` selector (`data-target={$('btn')}`->`data-target="btn"`). Scoping is now handled automatically. |
| 35 | + - Change `$.ready()` to `RootElement.ready()`, and retrieve the `# simple-stack-query selector from the first function argument. The `# simple-stack-query selector is no longer a global. |
| 36 | + |
| 37 | + ```diff |
| 38 | + + <RootElement> |
| 39 | + - <button data=target={$('btn')}> |
| 40 | + + <button data-target="btn"> |
| 41 | + Click me |
| 42 | + </button> |
| 43 | + + </RootElement> |
| 44 | + |
| 45 | + <script> |
| 46 | + - $.ready(() => { |
| 47 | + + RootElement.ready(($) => { |
| 48 | + $('btn').addEventListener('click', () => { |
| 49 | + console.log("It's like JQuery but not!"); |
| 50 | + }); |
| 51 | + }); |
| 52 | + </script> |
| 53 | + ``` |
| 54 | + |
| 55 | + Since the syntax for `data-target` is now simpler, we have also **removed the VS Code snippets prompt.** We recommend deleting the snippets file created by v0.1: `.vscode/simple-query.code-snippets`. |
| 56 | + |
3 | 57 | ## 0.1.1 |
4 | 58 |
|
5 | 59 | ### Patch Changes |
|
0 commit comments