Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.21.0 #308

Merged
merged 17 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ datastar_site
data
.task
.idea
.DS_Store
node_modules
datastar-website
*_bin
.DS_Store
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/code/go/cmd/tsbuild/main.go",
"program": "${workspaceFolder}/code/go/cmd/build/main.go",
"cwd": "${workspaceFolder}"
}
]
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"go.coverOnSingleTestFile": true,
"go.coverOnSingleTest": true,
"editor.foldingStrategy": "indentation",
"makefile.configureOnOpen": false
"makefile.configureOnOpen": false,
"editor.formatOnSave": true
}
63 changes: 24 additions & 39 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,30 @@
# Release Notes for Datastar
# WIP Release Notes for Datastar

## 0.20.1 - 2024-11-25
## 0.21.0 - Unreleased

VersionClientByteSize = 35970->35789
VersionClientByteSizeGzip = 12647->12568
We’ve overhauled Datastar in v0.21.0, doubling down on making nestable signals declarative. To that end, we’ve removed special characters, made the API more explicit and consistent, and fixed some restrictions to nested signals that we discovered. Signal values are now accessed in expressions using the syntax `signalName.value`, actions no longer have a prefix, and attribute keys support nested signals using dot-delimited paths.

### Added
- SDKs
- .NET
- Initial SDK release! #231
- PHP
- Allow KV pairs
- Author
- DevOps
- added `make test` & `make clean` to development Dockerfile

- Added the ability to merge one-off signals using the syntax `data-signals-foo="value"`.
- Added the ability to use dot-delimited paths to denote nested signals in applicable attribute keys (`data-signals-foo.bar="value"`).
- Added the ability to use multiple attributes using the syntax `data-attributes="{attrName1: value1, attrName2: value2}"`.
- Added the ability to use a single classes using the syntax `data-class-hidden="foo.value"`.
- Added the ability to use a key instead of a value to denote a signal name in the `data-bind`, `data-indicator` and `data-ref` attributes (`data-bind-foo`, `data-indicator-foo`, `data-ref-foo`).
- Added error codes and links to descriptions in the console for every error thrown.

### Changed
- Client
- Function expression optimizations #234
- Truthy Attributes were not getting set correctly #234
- Fix invalid headers sent via SSE #241
- Added hooks so NPM will package the correct files
- SDKs
- updated README for clarity around contributing
- Go
- Fix inverted logic for ViewTransitions #238
- PHP
- tagged SDK 1.0.0-alpha.1
- fixed retry duration
- general cleanup
- Website
- Bundler getting create valid zip for Windows #228
- General site improvements
- Actions section in getting started
- Fixed broken links for SDKs and CDN #225
- Try to fix Safari bug around caching SSE connections #239
- Devops
- fix `make dev` to work cross-platform
- moved development Dockerfile from Alpine to Ubuntu


### Removed
- DevOps
- Removed broken Github Actions

- Signals no longer have the `$` prefix and must be acessed using a `.value` suffix (`signalName.value`).
- Action plugins no longer have the `$` prefix.
- Renamed the `data-store` attribute to `data-signals`.
- Renamed the `data-bind` attribute to `data-attributes`.
- Renamed the `data-model` attribute to `data-bind`.
- Changed the `data-*` attribute modifier delimiter from `.` to `:` (`data-on-keydown:debounce_100ms:throttle_lead="value"`).
- The the `get()`, `post()`, `put()`, and `delete()` plugins have been replaced by a single `sse()` plugin that accepts the method as an option (`sse(url, {method="get"})`).
- The `setAll()` and `toggleAll` plugins now accept a dot-delimited path format, instead of a regular expression.

### Fixed

- Fixed headers not merging correctly.
- Fixed new lines in the SDK protocol for paths.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Anything outside of this scope may not be accepted. If you have a need for a fea

Before submitting bug reports and feature requests, please search the [open issues](https://github.com/starfederation/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/starfederation/datastar/issues/new), please use a descriptive title and include a clear description and as much relevant information as possible.

## Documentation
## Documentation

Datastar’s documentation is under active development. All the markdown files live in [this folder](https://github.com/starfederation/datastar/tree/develop/code/go/site/static/md). Improvements to them can be submitted via pull requests.
Datastar’s documentation is under active development. All the markdown files live in [this folder](https://github.com/starfederation/datastar/tree/develop/site/static/md). Improvements to them can be submitted via pull requests.

## Pull Requests

Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,29 @@
![Discord](https://img.shields.io/discord/1296224603642925098)
![GitHub Repo stars](https://img.shields.io/github/stars/starfederation/datastar?style=flat)

<p align="center"><img width="200" src="https://media.githubusercontent.com/media/starfederation/datastar/refs/heads/main/code/go/site/static/images/rocket.gif"></p>
<p align="center"><img width="200" src="https://media.githubusercontent.com/media/starfederation/datastar/refs/heads/main/site/static/images/rocket.gif"></p>

# Datastar

### A real-time hypermedia framework.
### The hypermedia framework.

Datastar helps you build real-time web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.
Datastar helps you build reactive web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.

Getting started is as easy as adding a single script tag to your HTML.

```html
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js"></script>
```

Then start adding frontend reactivity using declarative `data-*` attributes.
Datastar helps you build reactive web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.

Here’s what frontend reactivity looks like using Datastar:

```html
<input data-model="input" type="text">
<div data-text="$input.toUpperCase()"></div>
<button data-on-click="$post('/endpoint')">Save</button>
<input data-bind-input type="text">
<div data-text="input.value.toUpperCase()"></div>
<button data-on-click="sse('/endpoint', {method: 'post'})">Save</button>
```

Visit the [Datastar Website »](https://data-star.dev/)
Expand Down
46 changes: 23 additions & 23 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ tasks:
cmds:
- go install github.com/go-task/task/v3/cmd/task@latest
- go install github.com/a-h/templ/cmd/templ@latest
- cmd: test -f code/go/site/tailwindcli || wget -O code/go/site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-linux-x64
- cmd: test -f site/tailwindcli || wget -O site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-linux-x64
platforms: [linux/amd64]
- cmd: test -f code/go/site/tailwindcli || wget -O code/go/site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-linux-arm64
- cmd: test -f site/tailwindcli || wget -O site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-linux-arm64
platforms: [linux/arm64]
- cmd: test -f code/go/site/tailwindcli || wget -O code/go/site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-macos-arm64
- cmd: test -f site/tailwindcli || wget -O site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-macos-arm64
platforms: [darwin/arm64]
- cmd: test -f code/go/site/tailwindcli || wget -O code/go/site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-macos-x64
- cmd: test -f site/tailwindcli || wget -O site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-macos-x64
platforms: [darwin/amd64]
- cmd: test -f code/go/site/tailwindcli || wget -O code/go/site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-windows-x64.exe
- cmd: test -f site/tailwindcli || wget -O site/tailwindcli https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/v1.7.21/tailwindcss-extra-windows-x64.exe
platforms: [windows]
- chmod +x code/go/site/tailwindcli
- chmod +x site/tailwindcli
- go install github.com/valyala/quicktemplate/qtc@latest

version:
Expand All @@ -39,7 +39,7 @@ tasks:
cmds:
- qtc

tsbuild:
build:
deps:
- qtc
sources:
Expand All @@ -50,20 +50,20 @@ tasks:
generates:
- "bundles/**/*"
cmds:
- go run code/go/cmd/tsbuild/main.go
- cp -r bundles/* code/go/site/static/js/
- mkdir -p code/ts/library/dist/
- cp -r bundles/* code/ts/library/dist/
- mkdir -p code/go/site/static/librarySource
- rm -rf code/go/site/static/librarySource/*
- cp -r code/ts/library/src/* code/go/site/static/librarySource/
- go run build/cmd/build/main.go
- cp -r bundles/* site/static/js/
- mkdir -p library/dist/
- cp -r bundles/* library/dist/
- mkdir -p site/static/librarySource
- rm -rf site/static/librarySource/*
- cp -r library/src/* site/static/librarySource/

libpub:
dir: code/ts/library
requires:
vars: [VERSION]
deps:
- tsbuild
- build
cmds:
- git push origin
- git tag v{{.VERSION}}
Expand All @@ -77,7 +77,7 @@ tasks:
- task: deploy

css:
dir: code/go/site
dir: site
sources:
- "**/*.templ"
- "**/*.md"
Expand Down Expand Up @@ -105,15 +105,15 @@ tasks:

support:
sources:
- code/go/**/*.templ
- code/go/**/*.go
- code/go/**/*.md
- code/go/site/static/**/*
- "**/*.templ"
- "**/*.go"
- "**/*.md"
- site/static/**/*
generates:
- ./datastar-website
deps:
- kill
- tsbuild
- build
- templ
- css

Expand All @@ -124,7 +124,7 @@ tasks:
- support
cmds:
- go mod tidy
- go build -o ./datastar-website code/go/cmd/site/main.go
- go build -o ./datastar-website "site/cmd/site/main.go"

deploy:
method: none
Expand All @@ -134,7 +134,7 @@ tasks:
- fly deploy --local-only

test:
dir: code/go/site/smoketests
dir: site/smoketests
deps:
- support
cmds:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20.1
0.21.0-beta1
File renamed without changes.
4 changes: 2 additions & 2 deletions code/go/cmd/tsbuild/main.go → build/cmd/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/starfederation/datastar/code/go/tsbuild"
build "github.com/starfederation/datastar/build"
)

func main() {
Expand All @@ -14,7 +14,7 @@ func main() {
log.Printf("Datastar built in %s", time.Since(start))
}()

if err := tsbuild.Build(); err != nil {
if err := build.Build(); err != nil {
log.Fatal(err)
}

Expand Down
8 changes: 4 additions & 4 deletions code/go/tsbuild/consts.go → build/consts.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tsbuild
package build

import (
"time"
Expand Down Expand Up @@ -84,7 +84,7 @@ var Consts = &ConstTemplateData{
},
{
Name: toolbelt.ToCasedString("mergeSignalsOnlyIfMissing"),
Description: "Should a given set of signals merge if they are missing from the store?",
Description: "Should a given set of signals merge if they are missing?",
Value: false,
},
{
Expand Down Expand Up @@ -187,7 +187,7 @@ var Consts = &ConstTemplateData{
},
{
Name: toolbelt.ToCasedString("MergeSignals"),
Description: "An event for merging signals into the store.",
Description: "An event for merging signals.",
Value: "datastar-merge-signals",
},
{
Expand All @@ -197,7 +197,7 @@ var Consts = &ConstTemplateData{
},
{
Name: toolbelt.ToCasedString("RemoveSignals"),
Description: "An event for removing signals from the store.",
Description: "An event for removing signals.",
Value: "datastar-remove-signals",
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,29 @@
![Discord](https://img.shields.io/discord/1296224603642925098)
![GitHub Repo stars](https://img.shields.io/github/stars/starfederation/datastar?style=flat)

<p align="center"><img width="200" src="https://media.githubusercontent.com/media/starfederation/datastar/refs/heads/main/code/go/site/static/images/rocket.gif"></p>
<p align="center"><img width="200" src="https://media.githubusercontent.com/media/starfederation/datastar/refs/heads/main/site/static/images/rocket.gif"></p>

# Datastar

### A real-time hypermedia framework.
### The hypermedia framework.

Datastar helps you build real-time web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.
Datastar helps you build reactive web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.

Getting started is as easy as adding a single script tag to your HTML.

```html
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js"></script>
```

Then start adding frontend reactivity using declarative `data-*` attributes.
Datastar helps you build reactive web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.

Here’s what frontend reactivity looks like using Datastar:

```html
<input data-model="input" type="text">
<div data-text="$input.toUpperCase()"></div>
<button data-on-click="$post('/endpoint')">Save</button>
<input data-bind-input type="text">
<div data-text="input.value.toUpperCase()"></div>
<button data-on-click="sse('/endpoint', {method: 'post'})">Save</button>
```

Visit the [Datastar Website »](https://data-star.dev/)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 13 additions & 13 deletions code/go/tsbuild/run.go → build/run.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tsbuild
package build

import (
"compress/gzip"
Expand Down Expand Up @@ -42,7 +42,7 @@ func extractVersion() (string, error) {
version := strings.TrimSpace(string(versionBytes))

// Write out the version to the version file.
versionPath := "code/ts/library/src/engine/version.ts"
versionPath := "library/src/engine/version.ts"
versionContents := fmt.Sprintf("export const VERSION = '%s';\n", version)
if err := os.WriteFile(versionPath, []byte(versionContents), 0644); err != nil {
return "", fmt.Errorf("error writing version file: %w", err)
Expand All @@ -60,8 +60,8 @@ func createBundles() error {

result := api.Build(api.BuildOptions{
EntryPoints: []string{
"code/ts/library/src/bundles/datastar-core.ts",
"code/ts/library/src/bundles/datastar.ts",
"library/src/bundles/datastar-core.ts",
"library/src/bundles/datastar.ts",
},
Outdir: outDir,
Bundle: true,
Expand Down Expand Up @@ -127,15 +127,15 @@ func writeOutConsts(version string) error {
})

templates := map[string]func(data *ConstTemplateData) string{
"README.md": datastarREADME,
"code/ts/library/README.md": datastarREADME,
"code/ts/library/src/engine/consts.ts": datastarClientConsts,
"code/ts/library/package.json": datastarClientPackageJSON,
"code/go/sdk/consts.go": goConsts,
"code/dotnet/sdk/src/Consts.fs": dotnetConsts,
"code/php/sdk/src/Consts.php": phpConsts,
"code/php/sdk/src/enums/EventType.php": phpEventType,
"code/php/sdk/src/enums/FragmentMergeMode.php": phpFragmentMergeMode,
"README.md": datastarREADME,
"library/README.md": datastarREADME,
"library/src/engine/consts.ts": datastarClientConsts,
"library/package.json": datastarClientPackageJSON,
"sdk/go/consts.go": goConsts,
"sdk/dotnet/src/Consts.fs": dotnetConsts,
"sdk/php/src/Consts.php": phpConsts,
"sdk/php/src/enums/EventType.php": phpEventType,
"sdk/php/src/enums/FragmentMergeMode.php": phpFragmentMergeMode,
}

for path, tmplFn := range templates {
Expand Down
Loading
Loading