ziex 0.1.0-dev.1252 → 0.1.0-dev.1309
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -42
- package/cloudflare/index.js +8 -7
- package/package.json +3 -3
- package/wasm/index.d.ts +2 -1
- package/wasm/index.js +8 -7
- package/wasm/init.dev.js +1230 -0
- package/wasm/init.js +2 -1229
package/README.md
CHANGED
|
@@ -1,37 +1,47 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/ziex-dev/branding/main/banner.svg" alt="Ziex banner" width="100%" />
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ziex-dev/branding/main/banner-animated.svg" alt="Ziex banner" width="100%" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
A full-stack web framework for Zig.
|
|
5
|
+
A full-stack web framework for Zig. Declarative UI components using familiar patterns, with full access to Zig's control flow.
|
|
6
6
|
|
|
7
|
-
Ziex combines the power and performance of Zig with the expressiveness of
|
|
7
|
+
Ziex combines the power and performance of Zig with the expressiveness and simplicity of declarative UI, enabling you to build fast, type-safe web applications.
|
|
8
8
|
|
|
9
9
|
**[Documentation →](https://ziex.dev/learn)**
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
> **Note:** Most of the API and syntax are finalized and stable, and server-side rendering (SSR) features are production-ready, Ziex continues to evolve with ongoing improvements to client-side rendering and state management, see the [roadmap](#roadmap). You can start using the documented features today, as they are stable and unlikely to change. Areas still under development are not yet documented and will be added as they mature. See [versions](#versions) for Zig and Ziex versions compatibility.
|
|
12
13
|
|
|
13
|
-
> **Note:** Most of the API and syntax are finalized and stable, and server-side rendering (SSR) features are production-ready, Ziex continues to evolve with ongoing improvements to client-side rendering and state management. You can start using the documented features today, as they are stable and unlikely to change. Areas still under development are not yet documented and will be added as they mature.
|
|
14
14
|
|
|
15
|
+
## Getting Started
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
### 1. Installing CLI (optional)
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
macOS/Linux
|
|
19
20
|
```bash
|
|
20
21
|
curl -fsSL https://ziex.dev/install | bash
|
|
21
22
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```powershell
|
|
23
|
+
Windows
|
|
24
|
+
```
|
|
25
25
|
powershell -c "irm ziex.dev/install.ps1 | iex"
|
|
26
|
+
```
|
|
26
27
|
|
|
28
|
+
### 2. Initializing Project
|
|
29
|
+
```powershell
|
|
30
|
+
zx init
|
|
31
|
+
# or
|
|
32
|
+
npm init ziex
|
|
27
33
|
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
|
|
35
|
+
### 3. Running Project
|
|
36
|
+
```powershell
|
|
37
|
+
zx dev
|
|
38
|
+
# or
|
|
39
|
+
npm run dev
|
|
32
40
|
```
|
|
33
|
-
[_See for other platforms →_](https://ziglang.org/learn/getting-started/)
|
|
34
41
|
|
|
42
|
+
You will need [compatible](#versions) Zig version when using zx CLI or you can use the `Node` template from `npm init ziex`
|
|
43
|
+
|
|
44
|
+
Read [Getting Started →](https://ziex.dev/learn) for more details.
|
|
35
45
|
|
|
36
46
|
## At a Glance
|
|
37
47
|
|
|
@@ -149,36 +159,34 @@ const zx = @import("zx");
|
|
|
149
159
|
</details>
|
|
150
160
|
|
|
151
161
|
## Features
|
|
152
|
-
- **
|
|
153
|
-
- **Full-Stack Capabilities**: Build both frontend and backend of
|
|
154
|
-
- **
|
|
155
|
-
- **Compile-time Safety**: Zig's type system catches bugs at compile time. No runtime surprises, no GC.
|
|
162
|
+
- **Declarative UI**: Declarative UI components using with full access to Zig's control flow.
|
|
163
|
+
- **Full-Stack Capabilities**: Build both frontend and backend of web application.
|
|
164
|
+
- **Fast**: Significantly faster at SSR than many other frameworks.
|
|
156
165
|
- **Familiar Syntax**: Familiar JSX-like syntax, or plain HTML-style markup, with full access to Zig's control flow.
|
|
157
166
|
- **Server-side Rendering**: Render per request on the server for dynamic data, auth, and personalized pages for best performance and SEO.
|
|
158
167
|
- **Static Site Generation**: Pre-render pages at build/export time into static HTML for fast CDN delivery.
|
|
159
|
-
- **File System Routing**: Folder structure defines routes.
|
|
160
|
-
- **Client-side Rendering**:
|
|
161
|
-
- **Control Flow in Zig's Syntax**: if/else, for/while, and switch all work as expected. It's just Zig.
|
|
168
|
+
- **File System Routing**: Folder structure defines routes.
|
|
169
|
+
- **Client-side Rendering**: Client-side rendering with Zig for building interactive experiences.
|
|
162
170
|
- **Developer Tooling**: CLI, hot reload, and editor extensions for the best DX.
|
|
163
171
|
|
|
164
|
-
## Roadmap
|
|
165
|
-
|
|
166
|
-
We track our feature roadmap and bugs using GitHub Issues.
|
|
167
|
-
You can view our current progress and planned features here:
|
|
168
|
-
|
|
169
|
-
**[Check out the Ziex Issue Tracker →](https://github.com/ziex-dev/ziex/issues)**
|
|
170
|
-
|
|
171
172
|
## Versions
|
|
172
173
|
| Zig | Ziex | Branch | Status |
|
|
173
174
|
|-------------|---------------------|-------------------|----------------|
|
|
174
|
-
| `0.17.
|
|
175
|
-
| `0.16.
|
|
176
|
-
| `0.15.
|
|
175
|
+
| `0.17.x` | | `main` | Development |
|
|
176
|
+
| `0.16.x` | `0.1.0-dev.1259` | `zig-0.16` | **Latest** |
|
|
177
|
+
| `0.15.x` | `0.1.0-dev-1050` | `zig-0.15` | Latest (`Zig 0.15.x`) |
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
## Roadmap
|
|
181
|
+
[Ziex 0.1.0](https://github.com/ziex-dev/ziex/milestone/2) is planned for release after `Zig 0.17.0` is available. You can view the [roadmap](https://github.com/ziex-dev/ziex/milestone) to learn more.
|
|
182
|
+
|
|
183
|
+
The `0.1.0` release will indicate that Ziex is production-ready, with all major features fully implemented, and will receive patch releases for bug fixes.
|
|
177
184
|
|
|
185
|
+
The `1.0.0` release will signify long-term support for that major version, receiving bug fixes and minor updates.
|
|
178
186
|
|
|
179
187
|
## Editor Support
|
|
180
188
|
|
|
181
|
-
* [VSCode](https://marketplace.visualstudio.com/items?itemName=ziex.ziex)/[VSCode Forks](https://open-vsx.org/extension/ziex/ziex)
|
|
189
|
+
* [VSCode](https://marketplace.visualstudio.com/items?itemName=ziex.ziex)/[VSCode Forks](https://open-vsx.org/extension/ziex/ziex)
|
|
182
190
|
* [Neovim](/ide/neovim/)
|
|
183
191
|
* [Helix](/ide/helix/)
|
|
184
192
|
* [Zed](/ide/zed/)
|
|
@@ -188,16 +196,9 @@ You can view our current progress and planned features here:
|
|
|
188
196
|
- [Discord](https://ziex.dev/r/discord)
|
|
189
197
|
- [Topic on Ziggit](https://ziex.dev/r/ziggit)
|
|
190
198
|
- [Project on Zig Discord Community](https://ziex.dev/r/zig-discord) (Join Zig Discord first: https://discord.gg/zig)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## Links
|
|
194
|
-
|
|
195
|
-
* [Codeberg Mirror](https://codeberg.org/ziex/ziex) - ZX repository mirror on Codeberg
|
|
196
|
-
* [ziex.dev](https://github.com/ziex-dev/ziex/tree/main/site) - Official documentation site of ZX made using ZX.
|
|
197
|
-
* [example-blog](https://github.com/ziex-dev/example-blog) - Demo blog web application built with ZX
|
|
198
|
-
* [zx-numbers-game](https://github.com/Andrew-Velox/zx-numbers-game) - ZX numbers game
|
|
199
|
-
* [Comparision with other frameworks](https://ziex.dev/vs)
|
|
199
|
+
- [Codeberg Mirror](https://codeberg.org/ziex/ziex) - Ziex repository mirror on Codeberg
|
|
200
|
+
- [ziex.dev](https://github.com/ziex-dev/ziex/tree/main/site) - Official documentation site of Ziex made using Ziex.
|
|
200
201
|
|
|
201
202
|
## Contributing
|
|
202
203
|
|
|
203
|
-
Contributions are welcome! Currently trying out
|
|
204
|
+
Contributions are welcome! Currently trying out Ziex and reporting issues for edge cases and providing feedback are greatly appreciated.
|
package/cloudflare/index.js
CHANGED
|
@@ -682,12 +682,12 @@ class ZxBridge extends ZxBridgeCore {
|
|
|
682
682
|
clearEventHandlerModes(velementId) {
|
|
683
683
|
eventHandlerModes.delete(velementId);
|
|
684
684
|
}
|
|
685
|
-
submitFormActionAsync(form, statesJson, fetchId) {
|
|
685
|
+
submitFormActionAsync(form, actionId, statesJson, fetchId) {
|
|
686
686
|
const formData = new FormData(form);
|
|
687
687
|
formData.append("__$states", statesJson);
|
|
688
688
|
fetch(window.location.href, {
|
|
689
689
|
method: "POST",
|
|
690
|
-
headers: { "
|
|
690
|
+
headers: { "x-action": String(actionId >>> 0) },
|
|
691
691
|
body: formData
|
|
692
692
|
}).then(async (response) => {
|
|
693
693
|
const text = await response.text();
|
|
@@ -911,23 +911,23 @@ class ZxBridge extends ZxBridgeCore {
|
|
|
911
911
|
writeBytes(bufPtr, bytes.subarray(0, len));
|
|
912
912
|
return len;
|
|
913
913
|
},
|
|
914
|
-
_submitFormAction: (vnodeId) => {
|
|
914
|
+
_submitFormAction: (vnodeId, actionId) => {
|
|
915
915
|
const form = domNodes.get(vnodeId);
|
|
916
916
|
if (!form || !(form instanceof HTMLFormElement))
|
|
917
917
|
return;
|
|
918
918
|
const formData = new FormData(form);
|
|
919
919
|
fetch(window.location.href, {
|
|
920
920
|
method: "POST",
|
|
921
|
-
headers: { "
|
|
921
|
+
headers: { "x-action": String(actionId >>> 0) },
|
|
922
922
|
body: formData
|
|
923
923
|
}).catch(() => {});
|
|
924
924
|
},
|
|
925
|
-
_submitFormActionAsync: (vnodeId, statesPtr, statesLen, fetchId) => {
|
|
925
|
+
_submitFormActionAsync: (vnodeId, actionId, statesPtr, statesLen, fetchId) => {
|
|
926
926
|
const form = domNodes.get(vnodeId);
|
|
927
927
|
if (!form || !(form instanceof HTMLFormElement))
|
|
928
928
|
return;
|
|
929
929
|
const statesJson = statesLen > 0 ? readString(statesPtr, statesLen) : "[]";
|
|
930
|
-
bridgeRef.current?.submitFormActionAsync(form, statesJson, fetchId);
|
|
930
|
+
bridgeRef.current?.submitFormActionAsync(form, actionId, statesJson, fetchId);
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
};
|
|
@@ -1259,7 +1259,8 @@ async function init(options = {}) {
|
|
|
1259
1259
|
domNodes.clear();
|
|
1260
1260
|
}
|
|
1261
1261
|
};
|
|
1262
|
-
|
|
1262
|
+
if (true)
|
|
1263
|
+
registerDevReinit(normalizedOptions);
|
|
1263
1264
|
return { source, bridge };
|
|
1264
1265
|
}
|
|
1265
1266
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziex",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-dev.1309",
|
|
4
|
+
"description": "Ziex is a framework for building web applications with Zig.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"scripts": {},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ziex/cli": "0.1.0-dev.
|
|
40
|
+
"@ziex/cli": "0.1.0-dev.1309"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"react": {
|
package/wasm/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare class ZxBridge extends ZxBridgeCore {
|
|
|
14
14
|
setEventHandlerMode(velementId: bigint, eventTypeId: number, maySuspend: boolean): void;
|
|
15
15
|
clearEventHandlerModes(velementId: bigint): void;
|
|
16
16
|
/** Submit a form action with bound-state round-trip. */
|
|
17
|
-
submitFormActionAsync(form: HTMLFormElement, statesJson: string, fetchId: bigint): void;
|
|
17
|
+
submitFormActionAsync(form: HTMLFormElement, actionId: number, statesJson: string, fetchId: bigint): void;
|
|
18
18
|
/**
|
|
19
19
|
* Create and connect a WebSocket.
|
|
20
20
|
* Calls __zx_ws_onopen, __zx_ws_onmessage, __zx_ws_onerror, __zx_ws_onclose.
|
|
@@ -58,6 +58,7 @@ export declare function init(options?: InitOptions): Promise<{
|
|
|
58
58
|
bridge: ZxBridge;
|
|
59
59
|
}>;
|
|
60
60
|
declare global {
|
|
61
|
+
const __DEV__: boolean;
|
|
61
62
|
interface HTMLElement {
|
|
62
63
|
__zx_ref?: number;
|
|
63
64
|
}
|
package/wasm/index.js
CHANGED
|
@@ -682,12 +682,12 @@ class ZxBridge extends ZxBridgeCore {
|
|
|
682
682
|
clearEventHandlerModes(velementId) {
|
|
683
683
|
eventHandlerModes.delete(velementId);
|
|
684
684
|
}
|
|
685
|
-
submitFormActionAsync(form, statesJson, fetchId) {
|
|
685
|
+
submitFormActionAsync(form, actionId, statesJson, fetchId) {
|
|
686
686
|
const formData = new FormData(form);
|
|
687
687
|
formData.append("__$states", statesJson);
|
|
688
688
|
fetch(window.location.href, {
|
|
689
689
|
method: "POST",
|
|
690
|
-
headers: { "
|
|
690
|
+
headers: { "x-action": String(actionId >>> 0) },
|
|
691
691
|
body: formData
|
|
692
692
|
}).then(async (response) => {
|
|
693
693
|
const text = await response.text();
|
|
@@ -911,23 +911,23 @@ class ZxBridge extends ZxBridgeCore {
|
|
|
911
911
|
writeBytes(bufPtr, bytes.subarray(0, len));
|
|
912
912
|
return len;
|
|
913
913
|
},
|
|
914
|
-
_submitFormAction: (vnodeId) => {
|
|
914
|
+
_submitFormAction: (vnodeId, actionId) => {
|
|
915
915
|
const form = domNodes.get(vnodeId);
|
|
916
916
|
if (!form || !(form instanceof HTMLFormElement))
|
|
917
917
|
return;
|
|
918
918
|
const formData = new FormData(form);
|
|
919
919
|
fetch(window.location.href, {
|
|
920
920
|
method: "POST",
|
|
921
|
-
headers: { "
|
|
921
|
+
headers: { "x-action": String(actionId >>> 0) },
|
|
922
922
|
body: formData
|
|
923
923
|
}).catch(() => {});
|
|
924
924
|
},
|
|
925
|
-
_submitFormActionAsync: (vnodeId, statesPtr, statesLen, fetchId) => {
|
|
925
|
+
_submitFormActionAsync: (vnodeId, actionId, statesPtr, statesLen, fetchId) => {
|
|
926
926
|
const form = domNodes.get(vnodeId);
|
|
927
927
|
if (!form || !(form instanceof HTMLFormElement))
|
|
928
928
|
return;
|
|
929
929
|
const statesJson = statesLen > 0 ? readString(statesPtr, statesLen) : "[]";
|
|
930
|
-
bridgeRef.current?.submitFormActionAsync(form, statesJson, fetchId);
|
|
930
|
+
bridgeRef.current?.submitFormActionAsync(form, actionId, statesJson, fetchId);
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
};
|
|
@@ -1259,7 +1259,8 @@ async function init(options = {}) {
|
|
|
1259
1259
|
domNodes.clear();
|
|
1260
1260
|
}
|
|
1261
1261
|
};
|
|
1262
|
-
|
|
1262
|
+
if (true)
|
|
1263
|
+
registerDevReinit(normalizedOptions);
|
|
1263
1264
|
return { source, bridge };
|
|
1264
1265
|
}
|
|
1265
1266
|
export {
|