Skip to content

Commit

Permalink
pulled upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDepies committed Jan 30, 2025
2 parents 27cf62c + 95f4d14 commit 85096c8
Show file tree
Hide file tree
Showing 143 changed files with 5,558 additions and 285 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

```html
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@v1.0.0-beta.1/bundles/datastar.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

version: "3"

interval: 100ms
interval: 1000ms

vars:
VERSION:
Expand Down
8 changes: 7 additions & 1 deletion build/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ type ConstTemplateData struct {
var Consts = &ConstTemplateData{
DoNotEdit: "This is auto-generated by Datastar. DO NOT EDIT.",
SDKLanguages: []Language{
{
FileExtension: "clojure",
Name: "Clojure",
Icon: "vscode-icons:file-type-clojure",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/clojure",
},
{
FileExtension: "dotnet",
Name: "Dotnet",
Expand Down Expand Up @@ -99,7 +105,7 @@ var Consts = &ConstTemplateData{
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/python",
},
{
FileExtension: "rs",
FileExtension: "rust",
Name: "Rust",
Icon: "vscode-icons:file-type-rust",
SdkUrl: "https://github.com/starfederation/datastar/tree/main/sdk/rust",
Expand Down
79 changes: 79 additions & 0 deletions build/consts_clojure.qtpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{%- func clojureConsts(data *ConstTemplateData) -%}
;; {%s data.DoNotEdit %}
(ns starfederation.datastar.clojure.consts
(:require
[clojure.string :as string]))


(def datastar-key "{%s data.DatastarKey %}")
(def version "{%s data.Version %}")
(def version-client-byte-size {%d data.VersionClientByteSize %})
(def version-client-byte-size-gzip {%d data.VersionClientByteSizeGzip %})


;; -----------------------------------------------------------------------------
;; Default durations
;; -----------------------------------------------------------------------------
{%- for _, d := range data.DefaultDurations -%}
(def default-{%s d.Name.Kebab %}
"{%s= d.Description %}"
{%d durationToMs(d.Duration) %})

{%- endfor -%}

;; -----------------------------------------------------------------------------
;; Default values
;; -----------------------------------------------------------------------------
{%- for _, s := range data.DefaultStrings -%}
(def default-{%s s.Name.Kebab %}
"{%s= s.Description %}"
(-> "{%s s.Value %}"
(string/split #" ")
(update 0 keyword)
(->> (apply array-map))))

{%- endfor -%}

;; -----------------------------------------------------------------------------
;; Dataline literals
;; -----------------------------------------------------------------------------
{%- for _, literal := range data.DatalineLiterals -%}
(def {%s literal.Kebab %}-dataline-literal "{%s literal.Camel %} ")
{%- endfor -%}


;; -----------------------------------------------------------------------------
;; Default booleans
;; -----------------------------------------------------------------------------
{%- for _, b := range data.DefaultBools -%}
(def default-{%s b.Name.Kebab %}
"{%s= b.Description %}"
{%v b.Value %})

{%- endfor -%}


;; -----------------------------------------------------------------------------
;; Enums
;; -----------------------------------------------------------------------------
{%- for _, enum := range data.Enums -%}
;; {%s enum.Name.Pascal %}

{%- for _, entry := range enum.Values -%}
(def {%s enum.Name.Kebab %}-{%s entry.Name.Kebab %}
"{%s= entry.Description %}"
"{%s entry.Value %}")

{%- endfor -%}

{%- if enum.Default != nil -%}
(def default-{%s enum.Name.Kebab %}
"Default value for {%s enum.Name.Pascal %}.
{%s= enum.Default.Description %}"
{%s enum.Name.Kebab %}-{%s enum.Default.Name.Kebab %})
{%- endif -%}


{%- endfor -%}

{%- endfunc -%}
20 changes: 11 additions & 9 deletions build/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,24 @@ 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/clojure/sdk/src/main/starfederation/datastar/clojure/consts.clj": clojureConsts,
"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/core/src/main/java/starfederation/datastar/Consts.java": javaConsts,
"sdk/java/core/src/main/java/starfederation/datastar/enums/EventType.java": javaEventType,
"sdk/java/core/src/main/java/starfederation/datastar/enums/FragmentMergeMode.java": javaFragmentMergeMode,
"sdk/python/src/datastar_py/consts.py": pythonConsts,
"sdk/typescript/src/consts.ts": typescriptConsts,
"sdk/rust/src/consts.rs": rustConsts,
"sdk/zig/src/consts.zig": zigConsts,
"examples/clojure/hello-world/resources/public/hello-world.html": helloWorldExample,
"examples/dotnet/HelloWorld/wwwroot/hello-world.html": helloWorldExample,
"examples/go/hello-world/hello-world.html": helloWorldExample,
"examples/php/hello-world/public/hello-world.html": helloWorldExamplePHP,
Expand Down
Loading

0 comments on commit 85096c8

Please sign in to comment.