Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Feb 9, 2025
2 parents bad3fcb + 0a00bed commit dff91de
Show file tree
Hide file tree
Showing 327 changed files with 8,558 additions and 3,372 deletions.
46 changes: 7 additions & 39 deletions .github/workflows/sdk-dotnet-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,31 @@ name: Build & Publish NuGet to GitHub Registry
on:
workflow_dispatch:

env:
NuGetDirectory: ${{ github.workspace }}/nuget

jobs:
build:
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion # step id used as reference for output values

- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
fetch-depth: 0

# Build/pack the project
- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Build and Pack NuGet package with versioning
run: dotnet pack sdk/dotnet/src/Datastar.fsproj -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release
run: dotnet pack sdk/dotnet/src/Datastar.fsproj --configuration Release --output ${{ env.NuGetDirectory }}

- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: sdk/dotnet/src/bin/Release/*.nupkg
path: ${{ env.NuGetDirectory }}/*.nupkg

release:
runs-on: ubuntu-latest
Expand All @@ -56,22 +41,5 @@ jobs:
name: nugetPackage
path: nugetPackage

- name: Prep packages
run: dotnet nuget add source --username starfederation --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/starfederation/index.json"

- name: Push package to GitHub packages
if: needs.build.outputs.CommitsSinceVersionSource > 0 # Only release if there has been a commit/version change
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate

- name: Publish to NuGet.org
if: needs.build.outputs.CommitsSinceVersionSource > 0 # Only release if there has been a commit/version change
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

- name: Create Release
if: needs.build.outputs.CommitsSinceVersionSource > 0 # Only release if there has been a commit/version change
uses: ncipollo/[email protected]
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
artifacts: "nugetPackage/*"
token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ datastar-website
*.pyc
__pycache__
sdk/test/**/**/testOutput.txt
__debug_bin*
__debug_bin*

# search index
/data-star.bleve
30 changes: 14 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# WIP Release Notes for Datastar

## v1.0.0-beta.3
## v1.0.0-beta.4

In this release we tuned the engine, added the ability to react to specific signal changes, and added some new modifiers. Idiomorph got an upgrade, and a few bugs were squashed.

The most exciting part of this beta release is that it marks the final round of planned changes before we move to a stable v1 release 🚀

### Added

- Added the ability to use an alias prefix when using the [bundler](https://data-star.dev/bundler). This makes it possible to use `data-customPrefix-*` attributes instead of `data-*`.
- Added the ability to add a signal path to the `data-on-signals-change-*` attribute ([#587](https://github.com/starfederation/datastar/issues/587)).
- Added a `__viewtransition` modifier to the `data-on-*` attribute that wraps the expression in `document.startViewTransition()` when the View Transition API is available ([#627](https://github.com/starfederation/datastar/issues/627)).
- Added a `__case` modifier to the `data-signals-*`, `data-computed-*`, `data-ref-*`, `data-indicator-*`, `data-persist-*`, `data-bind-*`, `data-class-*`, and `data-on-*` attributes, allowing you to modify the casing of the key by adding `.kebab`, `.snake` or `.pascal`.
- Added a `retrying` event type that is dispatched when the SSE plugin is trying to reconnect ([#583](https://github.com/starfederation/datastar/issues/583)).

### Changed

- Changed the `data-on-interval` attribute to accept a `__duration` modifier instead of a `__delay` modifier ([#513](https://github.com/starfederation/datastar/issues/513)).
- The `data-custom-validity` attribute can now be used on `select` and `textarea` elements, in addition to `input` elements ([534](https://github.com/starfederation/datastar/issues/534)).
- Changed how plugins are applied and cleaned up to use `MutationObserver` ([#528](https://github.com/starfederation/datastar/issues/528)).
- Changed the parsing of Datastar expressions so that only semicolons can be used to explicitly indicate a statement delimiter ([#525](https://github.com/starfederation/datastar/issues/525)).
- Idiomorph was updated to version 0.5.0 (pre-release) and is now imported as a module, making it easier to import future versions ([#608](https://github.com/starfederation/datastar/issues/608), [#633](https://github.com/starfederation/datastar/issues/633)).
- Class names are no longer converted to kebab case when used in the `data-class-*` attribute ([#610](https://github.com/starfederation/datastar/issues/610)).
- Event names are no longer converted to kebab case when used in the `data-on-*` attribute.

### Fixed

- Fixed a bug when using the `__delay` modifier on the `data-on-load` attribute ([#511](https://github.com/starfederation/datastar/issues/511)).
- Fixed how Datastar expressions are evaluated to allow regular expressions and strings that contain semicolons and new lines ([#508](https://github.com/starfederation/datastar/issues/508)).
- Fixed a bug with the `inner` merge mode that was causing only the inner HTML of a fragment to be merged ([#524](https://github.com/starfederation/datastar/issues/524)).
- Fixed a bug in which signal values could get out of sync when populated by an input element by Chrome’s back/forward cache ([#530](https://github.com/starfederation/datastar/pull/530)).
- Fixed a bug when generating IDs for elements that could result in duplicate IDs ([#533](https://github.com/starfederation/datastar/issues/533)).

### Removed

- Removed the `apply` function from the JavaScript API ([#528](https://github.com/starfederation/datastar/issues/528)).
- Removed the `version` property from the JavaScript API ([#545](https://github.com/starfederation/datastar/issues/545)).
- Fixed a bug in which signals were being cleared when merge fragments were sending down `data-signals` attributes ([#588](https://github.com/starfederation/datastar/issues/588)).
- Fixed a bug in which using the `__ifmissing` modifier with the `data-signals-*` attribute was not having any effect ([#605](https://github.com/starfederation/datastar/issues/605)).
20 changes: 19 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,25 @@ Before submitting bug reports and feature requests, please search the [open issu

## Pull Requests

Always open an issue to discuss your idea _before_ submitting a pull request. Pull requests must have a descriptive title and clearly describe the problem and solution. If the pull request adds or changes behaviour, documentation and examples should be updated accordingly.
Always open an issue to discuss your idea _before_ submitting a pull request. Pull requests must have a descriptive title and clearly describe the problem and solution. If the pull request adds or changes behavior, documentation and examples should be updated accordingly.

## Documentation

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

## SDKs

We are currently only accepting SDKs from people willing to contribute _and maintain_ them.

SDKs must follow the [Architecture Decision Record](https://github.com/starfederation/datastar/blob/develop/sdk/README.md). Pull requests for new SDKs must also include the following:

- A README file that explains how to use the SDK.
- An entry in the [SDKs reference guide](https://github.com/starfederation/datastar/blob/develop/site/static/md/reference/sdks.md).
- A value in `SDKLanguages` in [`consts.go`](https://github.com/starfederation/datastar/blob/develop/build/consts.go).
- A `consts_[language].qtpl` file for generating [constants and defaults](https://github.com/starfederation/datastar/blob/develop/build).
- Sample [code snippets](https://github.com/starfederation/datastar/tree/develop/site/static/code_snippets) in the language of your SDK.
- An implementation of each of the [examples](https://github.com/starfederation/datastar/tree/develop/examples).
- Template values for consts and examples in [`run.go`](https://github.com/starfederation/datastar/blob/develop/build/run.go).

## Documentation

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

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 13.3 KiB script tag to your HTML.
Getting started is as easy as adding a single 14.3 KiB script tag to your HTML.

```html
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/[email protected].3/bundles/datastar.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/[email protected].4/bundles/datastar.js"></script>
```

Then start adding frontend reactivity using declarative <code>data-*</code> attributes.
Expand All @@ -26,6 +26,8 @@ Then start adding frontend reactivity using declarative <code>data-*</code> attr

Visit the [Datastar Website »](https://data-star.dev/)

Watch the [Videos »](https://www.youtube.com/@data-star)

Join the [Discord Server »](https://discord.com/channels/1296224603642925098/1296224603642925102)

## Getting Started
Expand Down
8 changes: 6 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ tasks:
- curl https://purge.jsdelivr.net/gh/starfederation/datastar/sdk/typescript/npm/esm/node/serverSentEventGenerator.js
- git push origin --tags

idiomorph:
dir: library/src/vendored
cmds:
- wget -O idiomorph.esm.js https://raw.githubusercontent.com/bigskysoftware/idiomorph/refs/heads/main/dist/idiomorph.esm.js
- npx -p typescript tsc *.js --declaration --allowJs --emitDeclarationOnly --outDir .
css:
dir: site
sources:
Expand Down Expand Up @@ -161,11 +166,10 @@ tasks:
- fly deploy --local-only

test:
dir: site/smoketests
deps:
- support
cmds:
- go test -v
- go test -v github.com/starfederation/datastar/site/smoketests -count=1 -timeout=1m

default:
cmds:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-beta.3
1.0.0-beta.4
12 changes: 12 additions & 0 deletions build/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ var Consts = &ConstTemplateData{
Icon: "vscode-icons:file-type-go-gopher",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/go",
},
{
FileExtension: "haskell",
Name: "Haskell",
Icon: "vscode-icons:file-type-haskell",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/haskell",
},
{
FileExtension: "java",
Name: "Java",
Expand All @@ -104,6 +110,12 @@ var Consts = &ConstTemplateData{
Icon: "vscode-icons:file-type-rust",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/rust",
},
{
FileExtension: "ruby",
Name: "Ruby",
Icon: "vscode-icons:file-type-ruby",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/ruby",
},
{
FileExtension: "ts",
Name: "TypeScript",
Expand Down
4 changes: 3 additions & 1 deletion build/consts_datastar_readme.qtpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Datastar helps you build reactive web applications with the simplicity of server
Getting started is as easy as adding a single {%s humanize.CommafWithDigits( float64(data.VersionClientByteSizeGzip) / 1024.0, 1) %} KiB script tag to your HTML.

```html
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@v1.0.0-beta.3/bundles/datastar.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@v{%s data.Version %}/bundles/datastar.js"></script>
```

Then start adding frontend reactivity using declarative <code>data-*</code> attributes.
Expand All @@ -30,6 +30,8 @@ Then start adding frontend reactivity using declarative <code>data-*</code> attr

Visit the [Datastar Website »](https://data-star.dev/)

Watch the [Videos »](https://www.youtube.com/@data-star)

Join the [Discord Server »](https://discord.com/channels/1296224603642925098/1296224603642925102)

## Getting Started
Expand Down
76 changes: 76 additions & 0 deletions build/consts_haskell.qtpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{% import "strings" %}
{% import "strconv" %}
{% import "fmt" %}
{% func PadRight(s string, maxLen int) %}{% stripspace %}
{%s s %}{%s strings.Repeat(" ", maxLen-len(s)) %}
{% endstripspace %}{% endfunc %}
{%- func haskellConsts(data *ConstTemplateData) -%}
-- {%s data.DoNotEdit %}
module ServerSentEventGenerator.Constants where

import Prelude
import ServerSentEventGenerator.Class (StringLike)

-- taken from consts.ts
-- why?
-- functions must start with a lower case letter
-- I could have used a type class, but it would have required
-- a function call in front of each data constructor, so I
-- decided to just use the prefix "c"

cDatastarKey :: StringLike a => a
cDatastarKey = "{%s data.DatastarKey %}"
cVersion :: StringLike a => a
cVersion = "{%s data.Version %}"
cVersionClientByteSize :: Int
cVersionClientByteSize = {%d data.VersionClientByteSize %}
cVersionClientByteSizeGzip :: Int
cVersionClientByteSizeGzip = {%d data.VersionClientByteSizeGzip %}
{%- for _, d := range data.DefaultDurations -%}
{%s PadRight(fmt.Sprintf("cDefault%s", d.Name.Pascal), 40) %} :: Int
{%s PadRight(fmt.Sprintf("cDefault%s", d.Name.Pascal), 40) %} = {%d durationToMs(d.Duration) %} -- milliseconds
{%- endfor -%}
{%- for _, s := range data.DefaultStrings -%}
{%s PadRight(fmt.Sprintf("c%s", s.Name.Pascal), 40) %} :: StringLike a => a
{%s PadRight(fmt.Sprintf("c%s", s.Name.Pascal), 40) %} = "{%s s.Value %}"
{%- endfor -%}
{%- for _, literal := range data.DatalineLiterals -%}
{%s PadRight(fmt.Sprintf("c%s", literal.Pascal), 40) %} :: StringLike a => a
{%s PadRight(fmt.Sprintf("c%s", literal.Pascal), 40) %} = "{%s literal.Camel %}"
{%- endfor -%}
{%- for _, b := range data.DefaultBools -%}
{% code
boolStr := strconv.FormatBool(b.Value)
capitalizedBool := strings.ToUpper(boolStr[:1]) + boolStr[1:]
-%}
{%s PadRight(fmt.Sprintf("cDefault%s", b.Name.Pascal), 40) %} :: Bool
{%s PadRight(fmt.Sprintf("cDefault%s", b.Name.Pascal), 40) %} = {%s capitalizedBool %}
{%- endfor -%}
{%- for _, enum := range data.Enums -%}
{%- for _, entry := range enum.Values -%}
{%s PadRight(fmt.Sprintf("c%s", entry.Name.Pascal), 40) %} :: StringLike a => a
{%s PadRight(fmt.Sprintf("c%s", entry.Name.Pascal), 40) %} = "{%v entry.Value %}"
{%- endfor -%}
{%- endfor -%}
-- Added by Henry
cData :: StringLike a => a
cData = "data"
cEvent :: StringLike a => a
cEvent = "event"
cEventId :: StringLike a => a
cEventId = "id"
cRetryDuration :: StringLike a => a
cRetryDuration = "retry"
cSColon :: StringLike a => a
cSColon = ": "
cSpace :: StringLike a => a
cSpace = " "
cDefaultSelector :: StringLike a => a
cDefaultSelector = ""
cDefaultEventId :: StringLike a => a
cDefaultEventId = ""
cDefaultOnlyIfMissing :: Bool
cDefaultOnlyIfMissing = False
cDefaultAttributes :: StringLike a => a
cDefaultAttributes = ""
{%- endfunc -%}
45 changes: 45 additions & 0 deletions build/consts_ruby.qtpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{%- func rubyConsts(data *ConstTemplateData) -%}
# frozen_string_literal: true

# {%s data.DoNotEdit %}
module Datastar
module Consts
DATASTAR_KEY = '{%s data.DatastarKey %}'
VERSION = '{%s data.Version %}'
{%- for _, d := range data.DefaultDurations %}
# {%s= d.Description %}
DEFAULT_{%s d.Name.ScreamingSnake %} = {%d durationToMs(d.Duration) %}
{%- endfor -%}
{%- for _, b := range data.DefaultBools %}
# {%s= b.Description %}
DEFAULT_{%s b.Name.ScreamingSnake %} = {%v b.Value %}
{%- endfor -%}
{%- for _, s := range data.DefaultStrings %}
# {%s= s.Description %}}
DEFAULT_{%s s.Name.ScreamingSnake %} = '{%s s.Value %}'
{%- endfor -%}

{%- for _, enum := range data.Enums -%}
{%- if enum.Name.Pascal == "FragmentMergeMode" -%}
module FragmentMergeMode
{%- for _, entry := range enum.Values %}
# {%s entry.Description %}
{%s entry.Name.ScreamingSnake %} = '{%s entry.Value %}'
{%- endfor -%}
end
{%- endif -%}
{%- endfor -%}
{%- for _, enum := range data.Enums -%}
{%- if enum.Default != nil %}
# {%s= enum.Description %}
DEFAULT_{%s enum.Name.ScreamingSnake %} = {%s enum.Name.Pascal %}::{%s enum.Default.Name.ScreamingSnake %}
{%- endif -%}
{%- endfor -%}

# Dataline literals.
{%- for _, literal := range data.DatalineLiterals -%}
{%s literal.ScreamingSnake %}_DATALINE_LITERAL = '{%s literal.Camel %}'
{%- endfor -%}
end
end
{%- endfunc -%}
4 changes: 2 additions & 2 deletions build/consts_rust.qtpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{%- func rustConsts(data *ConstTemplateData) -%}
// {%s data.DoNotEdit %}

pub const DATASTAR_KEY: &str = "{%s data.DatastarKey %}";
pub const VERSION: &str = "{%s data.Version %}";
pub const _DATASTAR_KEY: &str = "{%s data.DatastarKey %}";
pub const _VERSION: &str = "{%s data.Version %}";

// #region Defaults

Expand Down
Loading

0 comments on commit dff91de

Please sign in to comment.