Skip to content

Commit 1b0f4dc

Browse files
delaneyjbencroker
andauthored
Delaneyj/issue270 (#282)
* Start work on data-model removal #270 * move files #270 * move all test and examples to data-bind from data-model * merge consts * Add release note --------- Co-authored-by: Ben Croker <[email protected]>
1 parent 5a4020d commit 1b0f4dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+547
-526
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"go.coverOnSingleTestFile": true,
44
"go.coverOnSingleTest": true,
55
"editor.foldingStrategy": "indentation",
6-
"makefile.configureOnOpen": false
6+
"makefile.configureOnOpen": false,
7+
"editor.formatOnSave": true
78
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
### Changed
66

77
- Renamed the `data-store` attribute to `data-merge-signals`.
8+
- Renamed the `data-model` attribute to `data-bind`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Datastar helps you build real-time web applications with the simplicity of serve
1515
Here’s what frontend reactivity looks like using Datastar:
1616

1717
```html
18-
<input data-model="input" type="text">
18+
<input data-bind="input" type="text">
1919
<div data-text="$input.toUpperCase()"></div>
2020
<button data-on-click="$post('/endpoint')">Save</button>
2121
```

bundles/datastar.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/datastar.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/dotnet/README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,35 @@
33
Real-time Hypermedia first Library and Framework for dotnet
44

55
# HTML Frontend
6+
67
```html
78
<html lang="en">
8-
<head>
9-
<script type="module" defer src="https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js"></script>
9+
<head>
10+
<script
11+
type="module"
12+
defer
13+
src="https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js"
14+
></script>
1015
<title>D* Demo</title>
11-
</head>
12-
<body>
13-
<main class="container" id="main" data-merge-signals="{'input':'','output':''}">
14-
<button data-on-click="$get('/displayDate')">Display Date</button>
15-
<div id="target"></div>
16-
<input type="text" placeholder="input:" data-model="input"/><br>
17-
<span data-model="output"></span>
18-
<button data-on-click="$post('/changeOutput')">Change Output</button>
19-
</main>
20-
</body>
16+
</head>
17+
<body>
18+
<main
19+
class="container"
20+
id="main"
21+
data-merge-signals="{'input':'','output':''}"
22+
>
23+
<button data-on-click="$get('/displayDate')">Display Date</button>
24+
<div id="target"></div>
25+
<input type="text" placeholder="input:" data-bind="input" /><br />
26+
<span data-bind="output"></span>
27+
<button data-on-click="$post('/changeOutput')">Change Output</button>
28+
</main>
29+
</body>
2130
</html>
2231
```
2332

2433
# C# Backend
34+
2535
```csharp
2636
using StarFederation.Datastar;
2737
using StarFederation.Datastar.DependencyInjection;
Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,59 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
3+
<head>
44
<title>dotnet Example</title>
5-
<script type="module" defer src="https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js"></script>
6-
<link href="style.css" rel="stylesheet">
7-
</head>
8-
<body>
9-
10-
<main class="container" id="main" data-merge-signals="{'input':'','output':'','show':true}">
11-
<div class="grid-container">
12-
<div class="item1"><h2><span id="language" data-on-load="$get('/language/dotnet')">___</span> + D* Example</h2></div>
5+
<script
6+
type="module"
7+
defer
8+
src="https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js"
9+
></script>
10+
<link href="style.css" rel="stylesheet" />
11+
</head>
12+
<body>
13+
<main
14+
class="container"
15+
id="main"
16+
data-merge-signals="{'input':'','output':'','show':true}"
17+
>
18+
<div class="grid-container">
19+
<div class="item1">
20+
<h2>
21+
<span id="language" data-on-load="$get('/language/dotnet')"
22+
>___</span
23+
>
24+
+ D* Example
25+
</h2>
26+
</div>
1327
<div class="item2">
14-
<div data-show="$show">
15-
<span style="font-size: 9em">
16-
&#x1F680;
17-
</span>
18-
<hr>
19-
<span style="font-family: 'Courier',serif">
20-
<span id="feed" data-on-load="$get('/feed')">5999999999999999999</span>
21-
</span>
22-
</div>
28+
<div data-show="$show">
29+
<span style="font-size: 9em"> &#x1F680; </span>
30+
<hr />
31+
<span style="font-family: 'Courier', serif">
32+
<span id="feed" data-on-load="$get('/feed')"
33+
>5999999999999999999</span
34+
>
35+
</span>
36+
</div>
2337
</div>
2438
<div class="item3">
25-
<input type="text" placeholder="input:" data-model="input"/><br>
26-
<br>
27-
<button class="button-69" data-on-click="$get('/patch')">Patch State</button><br>
28-
<button class="button-69" data-on-click="$get('/target')">Target HTML Element</button><br>
29-
<button class="button-69" data-on-click="$show=!$show">Toggle Rocket</button><br>
30-
<div id="output" data-text="$output"></div>
31-
<div id="target"></div>
39+
<input type="text" placeholder="input:" data-bind="input" /><br />
40+
<br />
41+
<button class="button-69" data-on-click="$get('/patch')">
42+
Patch State</button
43+
><br />
44+
<button class="button-69" data-on-click="$get('/target')">
45+
Target HTML Element</button
46+
><br />
47+
<button class="button-69" data-on-click="$show=!$show">
48+
Toggle Rocket</button
49+
><br />
50+
<div id="output" data-text="$output"></div>
51+
<div id="target"></div>
3252
</div>
3353
<div class="item4">
34-
<pre data-text="JSON.stringify(ctx.store(),null,2)"></pre>
54+
<pre data-text="JSON.stringify(ctx.store(),null,2)"></pre>
3555
</div>
36-
</div>
37-
</main>
38-
</body>
56+
</div>
57+
</main>
58+
</body>
3959
</html>

code/dotnet/sdk/src/Consts.fs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/go/sdk/consts.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/go/site/routes_bundler.templ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ templ PageBundler(r *http.Request, manifest PluginManifest, store *BundlerStore)
5050
<div class="flex flex-wrap items-center gap-4 justify-between">
5151
<div class="flex gap-4 items-center text-xl">
5252
@icon(plugin.Icon)
53-
<input class="toggle toggle-success" type="checkbox" data-model={ signal }/>
53+
<input class="toggle toggle-success" type="checkbox" data-bind={ signal }/>
5454
<div class="flex item-center font-mono">
5555
<div>{ plugin.Label }</div>
5656
</div>

0 commit comments

Comments
 (0)