Docs: fill in the gaps (#200)

* Add note about underscore

* Add note about `script` tags

* List event listeners

* Add Contributing guidelines
This commit is contained in:
Ben Croker 2024-11-01 10:53:18 +01:00 committed by GitHub
parent fe71830ffc
commit b7baab20b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 2 deletions

21
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,21 @@
# Contributing to Datastar
Thanks for thinking about contributing to Datastar 🚀
## Before You Contribute
Before you contribute, please consider that Datastar is a lightweight JavaScript framework that aims to simplify real-time, interactive web apps by using a minimalist, attribute-based approach for state management and event handling directly in HTML.
Anything outside of this scope may not be accepted. If you have a need for a feature that is not within the scope of Datastar, consider using a Web Component or writing your own Datastar plugin [needs further explanation].
## Bug Reports & Feature Requests
Before submitting bug reports and feature requests, please search the [open issues](https://github.com/delaneyj/datastar/issues) and the _#help_ channel in the [Discord server](https://discord.gg/bnRNgZjgPh) to see if it has already been addressed. When submitting a [new issue](https://github.com/delaneyj/datastar/issues/new), please use a descriptive title and include a clear description and as much relevant information as possible.
## Documentation
Datastars documentation is under active development. All the markdown files live in [this folder](https://github.com/delaneyj/datastar/tree/main/backends/go/site/static/md). Improvements to them can be submitted via pull requests.
## Pull Requests
If youre unsure about whether a pull request is within the scope of Datastar, please open an issue to discuss your idea first. Pull requests should have a descriptive title and clearly describe the problem and solution. If the pull request adds or changes behaviour, documentation should be updated accordingly.

View File

@ -22,7 +22,7 @@ Allows any valid attribute to be bound to an expression. This is useful for maki
Sets up two-way data-binding on an element.
**Note:** Always binds to a signal and therefore should exclude the `$` prefix from the signal name. Only allowed on `input`,`textarea`, `select`, `checkbox` and `radio` elements.
**Note:** Always binds to a signal and therefore should exclude the `$` prefix from the signal name. Event listeners are added for `change`, `input` and `keydown` events on `input`,`textarea`, `select`, `checkbox` and `radio` elements.
### Text

View File

@ -18,7 +18,7 @@ Request for data from the server via SSE and merge with the page.
Makes an HTML_VERB request to the server and merges the response with the current DOM and store. The URL can be any valid URL but the response must be a Datastar formatted SSE event.
Every request will be sent with a `{datastar: *}` object containing the current store. When using `$$get` the store will be sent as a query parameter, otherwise it will be sent as a JSON body.
Every request will be sent with a `{datastar: *}` object containing the current store (except for store keys beginning with an underscore). When using `$$get` the store will be sent as a query parameter, otherwise it will be sent as a JSON body.
## Datastar SSE Event
@ -58,6 +58,8 @@ Additional `data` lines can be added to the response to override the default beh
| `data: vt false` | Turns off View-Transitions on Datastar messages. Defaults to `true`. |
| `data: fragment` | The HTML fragment to merge into the DOM. |
**Note:** `script` tags are not executed by the browser when merged into the DOM in this way. You should use signals and event listeners to instead.
### datastar-signal
```go