Skip to content

Commit

Permalink
Release/0.21.0 (#348)
Browse files Browse the repository at this point in the history
* scratch no longer has a /tmp dir, move to alpine
we need all the files cause Docker COPY doesn't support glob

* Update routes_home.templ (#319)

Remove two typos

* toggleAll & setAll use path instead of regex (#318)

* toggleAll & setAll use path instead of regex
Fixes #317

* Fix wording

---------

Co-authored-by: Ben Croker <[email protected]>

* Update release note

* Update go_deeper.md (#320)

Minor edits to Signals section, for grammar, clarity

* Make retries and backoff configurable (#316)

Fixes #190

* Fix links to SDKs

* Tweak intro code

* Improve getting started guide

* Fix and improve getting started guide

* Add web components

* evt.detail.value not working for third party libs (#326)

* evt.detail.value not working for third party libs
Fixes #324

* regex is never fun

* fix possible xss on errors

* Add circular logo

* fix clipboard usage on front page

* Support closing SSE connection from client side (#327)

Fixes #276

* Fix link in readme

* refactor: `nodejs`, `npm`, and `pnpm` are needed for the `libpub` task

* data-ref bug (#333)

* data-ref bug
Fixes #331

* Merge branch 'develop' of github.com:starfederation/datastar into delaneyj/issue331

* adds context.WithTimeout to site smoketests (#334)

removes got lib refs

* Java SDK (#321)

* Examples

* SDK and Readme

* Added build files

* Fixed Readme

* add SDKs to frontpage

* TODONE: BEN!

* Importing Datastar (#335)

Fixes #329

* bad link

* Rename default constant (#330)

* Rename default constant

* Fix PHP usage

* Build

* Remove Teleport from docs

* Bundler bug (#347)

Fixes #339

* make modifiers spec compliant (#346)

* make modifiers spec compliant
Fixes #345

* `_` for modifier args is now back to `.`. Please let it end

* remove unused error

* bump version

* Release notes and VSCode release

* Update VSCode version number

* Fix up modifier docs

---------

Co-authored-by: Wm Talcott <[email protected]>
Co-authored-by: Ben Croker <[email protected]>
Co-authored-by: Ben Croker <[email protected]>
Co-authored-by: Andrew Welch <[email protected]>
Co-authored-by: zangster300 <[email protected]>
Co-authored-by: Peter Humulock <[email protected]>
  • Loading branch information
7 people authored Dec 10, 2024
1 parent 06fb18f commit 20ad2ff
Show file tree
Hide file tree
Showing 122 changed files with 2,941 additions and 458 deletions.
11 changes: 2 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,15 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/code/go/cmd/site/main.go",
"program": "${workspaceFolder}/site/cmd/site/main.go",
"preLaunchTask": "build datastar"
},
{
"name": "Smoke Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/code/go/cmd/sitesmoketests/main.go"
},
{
"name": "Build Library",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/code/go/cmd/build/main.go",
"program": "${workspaceFolder}/build/cmd/build/main.go",
"cwd": "${workspaceFolder}"
}
]
Expand Down
14 changes: 8 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# WIP Release Notes for Datastar

## 0.21.0-beta - 2024-12-06
## 0.21.0 - 2024-12-10

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.

The new [Datastar VSCode extension](https://marketplace.visualstudio.com/items?itemName=starfederation.datastar-vscode) has autocomplete for all v0.21.0 `data-*` attributes and the `sse` action, and we’ve painstakingly added error pages for every error that can be thrown.
The new [Datastar VSCode extension](https://marketplace.visualstudio.com/items?itemName=starfederation.datastar-vscode) has autocomplete for all v0.21.0 `data-*`, and we’ve painstakingly added error pages for every error that can be thrown.

This should be the final round of API changes before v1.0.0 🚀

Expand All @@ -16,6 +16,7 @@ This should be the final round of API changes before v1.0.0 🚀
- 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.
- Retries and backoff are now configurable for SSE connections.

### Changed

Expand All @@ -24,11 +25,12 @@ This should be the final round of API changes before v1.0.0 🚀
- 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: 'post'})`), defaulting to `get`.
- The `setAll()` and `toggleAll` plugins now accept a dot-delimited path format, instead of a regular expression.
- Changed the `data-*` attribute modifier delimiter from `.` to `__` for modifiers and from `_` to `.` for arguments. This is to be spec compliant while still parseable with new nested signal syntax (`data-on-keydown__debounce.100ms__throttle.noLead="value"`).
- The the `get()`, `post()`, `put()`, `patch()` and `delete()` plugins have been replaced by a single `sse()` plugin that accepts a method as an option (`sse(url, {method: 'post'})`), defaulting to `get`.
- The `setAll()` and `toggleAll` plugins now accept a path prefix, instead of a regular expression.
- Nested signals no longer allow `__` in the key. It causes a conflict with modifiers.

### Fixed

- Fixed headers not merging correctly.
- Fixed new lines in the SDK protocol for paths.
- Fixed new lines in the SDK protocol for paths.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ RUN apk add --no-cache upx
ENV PORT=8080

WORKDIR /src
COPY go.* *.go ./
COPY . .
RUN go mod download
COPY site ./site
RUN --mount=type=cache,target=/root/.cache/go-build \
go build -ldflags="-s" -o /out/site site/cmd/site/main.go
RUN upx -9 -k /out/site

FROM scratch
FROM alpine
RUN chmod a=rwx,u+t /tmp
COPY --from=build /out/site /
ENTRYPOINT ["/site"]
6 changes: 6 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ RUN apt update && sudo apt upgrade \
git-lfs \
jq \
rsync \
nodejs \
npm \
# Needed for headless chrome/tests
libglib2.0-dev \
libnss3-dev \
Expand All @@ -32,6 +34,10 @@ RUN apt update && sudo apt upgrade \
# Clean out directories that don't need to be part of the image
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& \
# Install node packages \
npm install -g npm@^10.0.0 \
npm install -g pnpm \
&& \
# Install needed Go tooling \
go install github.com/go-task/task/v3/cmd/task@latest \
&& \
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Read the [Getting Started Guide »](https://data-star.dev/guide/getting_started)

## Contributing

Read the [Contribution Guidelines »](CONTRIBUTING.md)
Read the [Contribution Guidelines »](https://github.com/starfederation/datastar/blob/develop/CONTRIBUTING.md)

## Custom Plugins

Expand All @@ -51,10 +51,10 @@ You can manually add your own plugins to the core:
}
</script>
<script type="module">
import {Datastar} from 'datastar'
import {Datastar} from 'datastar'
Datastar.load(
// I can make my own plugins!
)
</script>
Datastar.load(
// I can make my own plugins!
)
</script>
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.21.0-beta1
0.21.0
20 changes: 16 additions & 4 deletions build/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,25 @@ var Consts = &ConstTemplateData{
FileExtension: "go",
Name: "Go",
Icon: "vscode-icons:file-type-go-gopher",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/code/go/sdk",
SdkUrl: "https://github.com/starfederation/datastar/tree/develop/sdk/go",
},
{
FileExtension: "php",
Name: "PHP",
Icon: "vscode-icons:file-type-php2",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/code/php/sdk",
SdkUrl: "https://github.com/starfederation/datastar/tree/develop/sdk/php",
},
{
FileExtension: "fs",
Name: "Dotnet",
Icon: "vscode-icons:file-type-fsharp2",
SdkUrl: "https://github.com/starfederation/datastar/tree/develop/sdk/dotnet",
},
{
FileExtension: "java",
Name: "Java",
Icon: "vscode-icons:file-type-java",
SdkUrl: "https://github.com/starfederation/datastar/tree/develop/sdk/java",
},
},
DatastarKey: "datastar",
Expand All @@ -95,8 +107,8 @@ var Consts = &ConstTemplateData{
},
DefaultDurations: []*DefaultDuration{
{
Name: toolbelt.ToCasedString("settleDuration"),
Description: "The default duration for settling during merges. Allows for CSS transitions to complete.",
Name: toolbelt.ToCasedString("fragmentsSettleDuration"),
Description: "The default duration for settling during fragment merges. Allows for CSS transitions to complete.",
Duration: 300 * time.Millisecond,
},
{
Expand Down
12 changes: 6 additions & 6 deletions build/consts_datastar_readme.qtpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Read the [Getting Started Guide »](https://data-star.dev/guide/getting_started)

## Contributing

Read the [Contribution Guidelines »](CONTRIBUTING.md)
Read the [Contribution Guidelines »](https://github.com/starfederation/datastar/blob/develop/CONTRIBUTING.md)

## Custom Plugins

Expand All @@ -53,12 +53,12 @@ You can manually add your own plugins to the core:
}
</script>
<script type="module">
import {Datastar} from 'datastar'
import {Datastar} from 'datastar'

Datastar.load(
// I can make my own plugins!
)
</script>
Datastar.load(
// I can make my own plugins!
)
</script>
```

{%- endfunc -%}
133 changes: 133 additions & 0 deletions build/consts_java.qtpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{%- func javaConsts(data *ConstTemplateData) -%}
package starfederation.datastar;

import starfederation.datastar.enums.FragmentMergeMode;

/**
* {%s data.DoNotEdit %}
*/
public final class Consts {
public static final String DATASTAR_KEY = "{%s data.DatastarKey %}";
public static final String VERSION = "{%s data.Version %}";
public static final int VERSION_CLIENT_BYTE_SIZE = {%d data.VersionClientByteSize %};
public static final int VERSION_CLIENT_BYTE_SIZE_GZIP = {%d data.VersionClientByteSizeGzip %};
{%- for _, d := range data.DefaultDurations %}
// {%s= d.Description %}
public static final int DEFAULT_{%s d.Name.ScreamingSnake %} = {%d durationToMs(d.Duration) %};
{%- endfor -%}
{%- for _, b := range data.DefaultBools %}
// {%s= b.Description %}
public static final boolean DEFAULT_{%s b.Name.ScreamingSnake %} = {%v b.Value %};
{%- endfor -%}
{%- for _, s := range data.DefaultStrings %}
// {%s= s.Description %}
public static final String DEFAULT_{%s s.Name.ScreamingSnake %} = "{%s s.Value %}";
{%- endfor -%}
{%- for _, enum := range data.Enums -%}
{%- if enum.Default != nil %}
// {%s= enum.Description %}
public static final FragmentMergeMode DEFAULT_{%s enum.Name.ScreamingSnake %} = FragmentMergeMode.{%s enum.Default.Name.Pascal %};
{%- endif -%}
{%- endfor -%}

// Dataline literals.
{%- for _, literal := range data.DatalineLiterals -%}
public static final String {%s literal.ScreamingSnake %}_DATALINE_LITERAL = "{%s literal.Camel %} ";
{%- endfor -%}
}
{%- endfunc -%}

{%- func javaEventType(data *ConstTemplateData) -%}
package starfederation.datastar.enums;

/**
* {%s data.DoNotEdit %}
*/
public enum EventType {
{%- for _, enum := range data.Enums -%}
{%- if enum.Name.Pascal == "EventType" -%}
{%- for i, entry := range enum.Values %}{% if i < len(enum.Values) - 1 %}
// {%s entry.Description %}
{%s entry.Name.Pascal %}("{%s entry.Value %}"),
{%- else -%}

// {%s entry.Description %}
{%s entry.Name.Pascal %}("{%s entry.Value %}");
{%- endif -%}
{%- endfor -%}

private final String value;

EventType(String value) {
this.value = value;
}

public String getValue() {
return value;
}
{%- endif -%}
{%- endfor -%}
}
{%- endfunc -%}

{%- func javaFragmentMergeMode(data *ConstTemplateData) -%}
package starfederation.datastar.enums;

/**
* {%s data.DoNotEdit %}
*/
public enum FragmentMergeMode {
{%- for _, enum := range data.Enums -%}
{%- if enum.Name.Pascal == "FragmentMergeMode" -%}
{%- for i, entry := range enum.Values %}{% if i < len(enum.Values) - 1 %}
// {%s entry.Description %}
{%s entry.Name.Pascal %}("{%s entry.Value %}"),
{%- else -%}

// {%s entry.Description %}
{%s entry.Name.Pascal %}("{%s entry.Value %}");
{%- endif -%}
{%- endfor -%}

private final String value;

FragmentMergeMode(String value) {
this.value = value;
}

public String getValue() {
return value;
}
{%- endif -%}
{%- endfor -%}
}
{%- endfunc -%}

{%- func javaConsoleMode(data *ConstTemplateData) -%}
package starfederation.datastar.enums;

/**
* {%s data.DoNotEdit %}
*/
public enum ConsoleMode {
{%- for _, enum := range data.Enums -%}
{%- if enum.Name.Pascal == "ConsoleMode" -%}
{%- for _, entry := range enum.Values %}
// {%s entry.Description %}
{%s entry.Name.Pascal %}("{%s entry.Value %}"),
{%- endfor -%}
;

private final String value;

ConsoleMode(String value) {
this.value = value;
}

public String getValue() {
return value;
}
{%- endif -%}
{%- endfor -%}
}
{%- endfunc -%}
21 changes: 12 additions & 9 deletions build/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,18 @@ func writeOutConsts(version string) error {
})

templates := map[string]func(data *ConstTemplateData) string{
"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,
"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,
"sdk/java/src/main/java/StarFederation/Datastar/Consts.java": javaConsts,
"sdk/java/src/main/java/StarFederation/Datastar/enums/EventType.java": javaEventType,
"sdk/java/src/main/java/StarFederation/Datastar/enums/FragmentMergeMode.java": javaFragmentMergeMode,
}

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

0 comments on commit 20ad2ff

Please sign in to comment.