jac-client 0.1.0__tar.gz → 0.2.0__tar.gz

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.
Files changed (83) hide show
  1. {jac_client-0.1.0 → jac_client-0.2.0}/PKG-INFO +72 -16
  2. {jac_client-0.1.0 → jac_client-0.2.0}/README.md +70 -14
  3. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/docs/README.md +201 -171
  4. jac_client-0.2.0/jac_client/docs/advanced-state.md +1266 -0
  5. jac_client-0.2.0/jac_client/docs/assets/pipe_line.png +0 -0
  6. jac_client-0.2.0/jac_client/docs/guide-example/intro.md +117 -0
  7. jac_client-0.2.0/jac_client/docs/guide-example/step-01-setup.md +260 -0
  8. jac_client-0.2.0/jac_client/docs/guide-example/step-02-components.md +416 -0
  9. jac_client-0.2.0/jac_client/docs/guide-example/step-03-styling.md +478 -0
  10. jac_client-0.2.0/jac_client/docs/guide-example/step-04-todo-ui.md +477 -0
  11. jac_client-0.2.0/jac_client/docs/guide-example/step-05-local-state.md +530 -0
  12. jac_client-0.2.0/jac_client/docs/guide-example/step-06-events.md +750 -0
  13. jac_client-0.2.0/jac_client/docs/guide-example/step-07-effects.md +469 -0
  14. jac_client-0.2.0/jac_client/docs/guide-example/step-08-walkers.md +534 -0
  15. jac_client-0.2.0/jac_client/docs/guide-example/step-09-authentication.md +586 -0
  16. jac_client-0.2.0/jac_client/docs/guide-example/step-10-routing.md +540 -0
  17. jac_client-0.2.0/jac_client/docs/guide-example/step-11-final.md +964 -0
  18. jac_client-0.2.0/jac_client/docs/imports.md +1142 -0
  19. jac_client-0.2.0/jac_client/docs/lifecycle-hooks.md +774 -0
  20. jac_client-0.2.0/jac_client/docs/routing.md +660 -0
  21. jac_client-0.2.0/jac_client/examples/basic/.babelrc +9 -0
  22. jac_client-0.2.0/jac_client/examples/basic/README.md +16 -0
  23. jac_client-0.2.0/jac_client/examples/basic/app.jac +16 -0
  24. jac_client-0.2.0/jac_client/examples/basic/package.json +27 -0
  25. jac_client-0.2.0/jac_client/examples/basic/vite.config.js +28 -0
  26. jac_client-0.2.0/jac_client/examples/basic-auth/.babelrc +9 -0
  27. jac_client-0.2.0/jac_client/examples/basic-auth/README.md +16 -0
  28. jac_client-0.2.0/jac_client/examples/basic-auth/app.jac +308 -0
  29. jac_client-0.2.0/jac_client/examples/basic-auth/package.json +27 -0
  30. jac_client-0.2.0/jac_client/examples/basic-auth/vite.config.js +28 -0
  31. jac_client-0.2.0/jac_client/examples/basic-auth-with-router/.babelrc +9 -0
  32. jac_client-0.2.0/jac_client/examples/basic-auth-with-router/README.md +60 -0
  33. jac_client-0.2.0/jac_client/examples/basic-auth-with-router/app.jac +464 -0
  34. jac_client-0.2.0/jac_client/examples/basic-auth-with-router/package.json +28 -0
  35. jac_client-0.2.0/jac_client/examples/basic-auth-with-router/vite.config.js +28 -0
  36. jac_client-0.2.0/jac_client/examples/basic-full-stack/.babelrc +9 -0
  37. jac_client-0.2.0/jac_client/examples/basic-full-stack/README.md +18 -0
  38. jac_client-0.2.0/jac_client/examples/basic-full-stack/app.jac +320 -0
  39. jac_client-0.2.0/jac_client/examples/basic-full-stack/package.json +28 -0
  40. jac_client-0.2.0/jac_client/examples/basic-full-stack/vite.config.js +28 -0
  41. jac_client-0.2.0/jac_client/examples/full-stack-with-auth/.babelrc +9 -0
  42. jac_client-0.2.0/jac_client/examples/full-stack-with-auth/README.md +16 -0
  43. jac_client-0.2.0/jac_client/examples/full-stack-with-auth/app.jac +735 -0
  44. jac_client-0.2.0/jac_client/examples/full-stack-with-auth/package.json +28 -0
  45. jac_client-0.2.0/jac_client/examples/full-stack-with-auth/vite.config.js +30 -0
  46. jac_client-0.2.0/jac_client/examples/with-router/.babelrc +9 -0
  47. jac_client-0.2.0/jac_client/examples/with-router/README.md +17 -0
  48. jac_client-0.2.0/jac_client/examples/with-router/app.jac +323 -0
  49. jac_client-0.2.0/jac_client/examples/with-router/package.json +28 -0
  50. jac_client-0.2.0/jac_client/examples/with-router/vite.config.js +28 -0
  51. jac_client-0.2.0/jac_client/plugin/cli.py +239 -0
  52. jac_client-0.2.0/jac_client/plugin/client.py +89 -0
  53. jac_client-0.2.0/jac_client/plugin/client_runtime.jac +234 -0
  54. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/plugin/vite_client_bundle.py +90 -205
  55. jac_client-0.1.0/jac_client/tests/fixtures/client_app.jac → jac_client-0.2.0/jac_client/tests/fixtures/basic-app/app.jac +1 -1
  56. jac_client-0.1.0/jac_client/tests/fixtures/client_app_with_antd.jac → jac_client-0.2.0/jac_client/tests/fixtures/client_app_with_antd/app.jac +7 -0
  57. jac_client-0.1.0/jac_client/tests/fixtures/js_import.jac → jac_client-0.2.0/jac_client/tests/fixtures/js_import/app.jac +1 -1
  58. jac_client-0.1.0/jac_client/tests/fixtures/relative_import.jac → jac_client-0.2.0/jac_client/tests/fixtures/relative_import/app.jac +1 -1
  59. jac_client-0.2.0/jac_client/tests/fixtures/spawn_test/app.jac +133 -0
  60. jac_client-0.1.0/jac_client/tests/fixtures/test_fragments_spread.jac → jac_client-0.2.0/jac_client/tests/fixtures/test_fragments_spread/app.jac +9 -0
  61. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/tests/test_cl.py +208 -92
  62. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/tests/test_create_jac_app.py +1 -1
  63. {jac_client-0.1.0 → jac_client-0.2.0}/pyproject.toml +2 -2
  64. jac_client-0.1.0/jac_client/docs/advanced-state.md +0 -706
  65. jac_client-0.1.0/jac_client/docs/imports.md +0 -650
  66. jac_client-0.1.0/jac_client/docs/lifecycle-hooks.md +0 -554
  67. jac_client-0.1.0/jac_client/docs/routing.md +0 -530
  68. jac_client-0.1.0/jac_client/examples/little-x/package-lock.json +0 -2840
  69. jac_client-0.1.0/jac_client/examples/todo-app/README.md +0 -82
  70. jac_client-0.1.0/jac_client/examples/todo-app/app.jac +0 -683
  71. jac_client-0.1.0/jac_client/examples/todo-app/package-lock.json +0 -999
  72. jac_client-0.1.0/jac_client/examples/todo-app/package.json +0 -22
  73. jac_client-0.1.0/jac_client/plugin/cli.py +0 -328
  74. jac_client-0.1.0/jac_client/plugin/client.py +0 -41
  75. jac_client-0.1.0/jac_client/plugin/client_runtime.jac +0 -941
  76. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/examples/little-x/app.jac +0 -0
  77. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/examples/little-x/package.json +0 -0
  78. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/examples/little-x/submit-button.jac +0 -0
  79. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/tests/__init__.py +0 -0
  80. {jac_client-0.1.0/jac_client/tests/fixtures → jac_client-0.2.0/jac_client/tests/fixtures/js_import}/utils.js +0 -0
  81. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/tests/fixtures/package-lock.json +0 -0
  82. {jac_client-0.1.0 → jac_client-0.2.0}/jac_client/tests/fixtures/package.json +0 -0
  83. {jac_client-0.1.0/jac_client/tests/fixtures → jac_client-0.2.0/jac_client/tests/fixtures/relative_import}/button.jac +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jac-client
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary:
5
5
  Author: Jason Mars
6
6
  Author-email: jason@mars.ninja
@@ -9,7 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Programming Language :: Python :: 3.13
11
11
  Classifier: Programming Language :: Python :: 3.14
12
- Requires-Dist: jaclang (==0.8.10)
12
+ Requires-Dist: jaclang (==0.9.0)
13
13
  Description-Content-Type: text/markdown
14
14
 
15
15
  # Jac Client
@@ -23,8 +23,8 @@ Jac Client enables you to write React-like components, manage state, and build i
23
23
  ## ✨ Features
24
24
 
25
25
  - **Single Language**: Write frontend and backend in Jac
26
- - **No HTTP Client**: Use `__jacSpawn()` instead of fetch/axios
27
- - **Reactive State**: Built-in state management with `createState()`
26
+ - **No HTTP Client**: Use `jacSpawn()` instead of fetch/axios
27
+ - **React Hooks**: Use standard React `useState` and `useEffect` hooks
28
28
  - **Component-Based**: Build reusable UI components with JSX
29
29
  - **Graph Database**: Built-in graph data model eliminates need for SQL/NoSQL
30
30
  - **Type Safety**: Type checking across frontend and backend
@@ -48,7 +48,7 @@ cd my-app
48
48
  jac serve app.jac
49
49
  ```
50
50
 
51
- Visit `http://localhost:8000` to see your app!
51
+ Visit `http://localhost:8000/page/app` to see your app!
52
52
 
53
53
  ---
54
54
 
@@ -57,37 +57,93 @@ Visit `http://localhost:8000` to see your app!
57
57
  For detailed guides and tutorials, see the **[docs folder](jac_client/docs/)**:
58
58
 
59
59
  - **[Getting Started Guide](jac_client/docs/README.md)** - Complete beginner's guide
60
- - **[Routing](jac_client/docs/routing.md)** - Multi-page applications with `initRouter()`
61
- - **[Lifecycle Hooks](jac_client/docs/lifecycle-hooks.md)** - Using `onMount()` for initialization
62
- - **[Advanced State](jac_client/docs/advanced-state.md)** - Managing complex state
63
- - **[Imports](jac_client/docs/imports.md)** - Importing libraries, Jac files, and JavaScript modules
60
+ - **[Routing](jac_client/docs/routing.md)** - Multi-page applications with declarative routing (`<Router>`, `<Routes>`, `<Route>`)
61
+ - **[Lifecycle Hooks](jac_client/docs/lifecycle-hooks.md)** - Using React hooks (`useState`, `useEffect`)
62
+ - **[Advanced State](jac_client/docs/advanced-state.md)** - Managing complex state with React hooks
63
+ - **[Imports](jac_client/docs/imports.md)** - Importing third-party libraries (React, Ant Design, Lodash), Jac files, and JavaScript modules
64
64
 
65
65
  ---
66
66
 
67
67
  ## 💡 Example
68
68
 
69
+ ### Simple Counter with React Hooks
70
+
69
71
  ```jac
70
- cl {
71
- let [count, setCount] = createState({"value": 0});
72
+ cl import from react { useState, useEffect }
72
73
 
74
+ cl {
73
75
  def Counter() -> any {
74
- s = count();
76
+ let [count, setCount] = useState(0);
77
+
78
+ useEffect(lambda -> None {
79
+ console.log("Count changed:", count);
80
+ }, [count]);
81
+
75
82
  return <div>
76
- <h1>Count: {s.value}</h1>
77
- <button onClick={lambda -> None {
78
- setCount({"value": s.value + 1});
83
+ <h1>Count: {count}</h1>
84
+ <button onClick={lambda e: any -> None {
85
+ setCount(count + 1);
79
86
  }}>
80
87
  Increment
81
88
  </button>
82
89
  </div>;
83
90
  }
84
91
 
85
- def jac_app() -> any {
92
+ def app() -> any {
86
93
  return Counter();
87
94
  }
88
95
  }
89
96
  ```
90
97
 
98
+ ### Full-Stack Todo App
99
+
100
+ ```jac
101
+ cl import from react { useState, useEffect }
102
+ cl import from '@jac-client/utils' { jacSpawn }
103
+
104
+ # Backend: Jac nodes and walkers
105
+ node Todo {
106
+ has text: str;
107
+ has done: bool = False;
108
+ }
109
+
110
+ walker create_todo {
111
+ has text: str;
112
+ can create with `root entry {
113
+ new_todo = here ++> Todo(text=self.text);
114
+ report new_todo;
115
+ }
116
+ }
117
+
118
+ walker read_todos {
119
+ can read with `root entry {
120
+ visit [-->(`?Todo)];
121
+ }
122
+ }
123
+
124
+ # Frontend: React component
125
+ cl {
126
+ def app() -> any {
127
+ let [todos, setTodos] = useState([]);
128
+
129
+ useEffect(lambda -> None {
130
+ async def loadTodos() -> None {
131
+ result = await jacSpawn("read_todos", "", {});
132
+ setTodos(result.reports);
133
+ }
134
+ loadTodos();
135
+ }, []);
136
+
137
+ return <div>
138
+ <h1>My Todos</h1>
139
+ {todos.map(lambda todo: any -> any {
140
+ return <div key={todo._jac_id}>{todo.text}</div>;
141
+ })}
142
+ </div>;
143
+ }
144
+ }
145
+ ```
146
+
91
147
  ---
92
148
 
93
149
  ## 🔧 Requirements
@@ -9,8 +9,8 @@ Jac Client enables you to write React-like components, manage state, and build i
9
9
  ## ✨ Features
10
10
 
11
11
  - **Single Language**: Write frontend and backend in Jac
12
- - **No HTTP Client**: Use `__jacSpawn()` instead of fetch/axios
13
- - **Reactive State**: Built-in state management with `createState()`
12
+ - **No HTTP Client**: Use `jacSpawn()` instead of fetch/axios
13
+ - **React Hooks**: Use standard React `useState` and `useEffect` hooks
14
14
  - **Component-Based**: Build reusable UI components with JSX
15
15
  - **Graph Database**: Built-in graph data model eliminates need for SQL/NoSQL
16
16
  - **Type Safety**: Type checking across frontend and backend
@@ -34,7 +34,7 @@ cd my-app
34
34
  jac serve app.jac
35
35
  ```
36
36
 
37
- Visit `http://localhost:8000` to see your app!
37
+ Visit `http://localhost:8000/page/app` to see your app!
38
38
 
39
39
  ---
40
40
 
@@ -43,37 +43,93 @@ Visit `http://localhost:8000` to see your app!
43
43
  For detailed guides and tutorials, see the **[docs folder](jac_client/docs/)**:
44
44
 
45
45
  - **[Getting Started Guide](jac_client/docs/README.md)** - Complete beginner's guide
46
- - **[Routing](jac_client/docs/routing.md)** - Multi-page applications with `initRouter()`
47
- - **[Lifecycle Hooks](jac_client/docs/lifecycle-hooks.md)** - Using `onMount()` for initialization
48
- - **[Advanced State](jac_client/docs/advanced-state.md)** - Managing complex state
49
- - **[Imports](jac_client/docs/imports.md)** - Importing libraries, Jac files, and JavaScript modules
46
+ - **[Routing](jac_client/docs/routing.md)** - Multi-page applications with declarative routing (`<Router>`, `<Routes>`, `<Route>`)
47
+ - **[Lifecycle Hooks](jac_client/docs/lifecycle-hooks.md)** - Using React hooks (`useState`, `useEffect`)
48
+ - **[Advanced State](jac_client/docs/advanced-state.md)** - Managing complex state with React hooks
49
+ - **[Imports](jac_client/docs/imports.md)** - Importing third-party libraries (React, Ant Design, Lodash), Jac files, and JavaScript modules
50
50
 
51
51
  ---
52
52
 
53
53
  ## 💡 Example
54
54
 
55
+ ### Simple Counter with React Hooks
56
+
55
57
  ```jac
56
- cl {
57
- let [count, setCount] = createState({"value": 0});
58
+ cl import from react { useState, useEffect }
58
59
 
60
+ cl {
59
61
  def Counter() -> any {
60
- s = count();
62
+ let [count, setCount] = useState(0);
63
+
64
+ useEffect(lambda -> None {
65
+ console.log("Count changed:", count);
66
+ }, [count]);
67
+
61
68
  return <div>
62
- <h1>Count: {s.value}</h1>
63
- <button onClick={lambda -> None {
64
- setCount({"value": s.value + 1});
69
+ <h1>Count: {count}</h1>
70
+ <button onClick={lambda e: any -> None {
71
+ setCount(count + 1);
65
72
  }}>
66
73
  Increment
67
74
  </button>
68
75
  </div>;
69
76
  }
70
77
 
71
- def jac_app() -> any {
78
+ def app() -> any {
72
79
  return Counter();
73
80
  }
74
81
  }
75
82
  ```
76
83
 
84
+ ### Full-Stack Todo App
85
+
86
+ ```jac
87
+ cl import from react { useState, useEffect }
88
+ cl import from '@jac-client/utils' { jacSpawn }
89
+
90
+ # Backend: Jac nodes and walkers
91
+ node Todo {
92
+ has text: str;
93
+ has done: bool = False;
94
+ }
95
+
96
+ walker create_todo {
97
+ has text: str;
98
+ can create with `root entry {
99
+ new_todo = here ++> Todo(text=self.text);
100
+ report new_todo;
101
+ }
102
+ }
103
+
104
+ walker read_todos {
105
+ can read with `root entry {
106
+ visit [-->(`?Todo)];
107
+ }
108
+ }
109
+
110
+ # Frontend: React component
111
+ cl {
112
+ def app() -> any {
113
+ let [todos, setTodos] = useState([]);
114
+
115
+ useEffect(lambda -> None {
116
+ async def loadTodos() -> None {
117
+ result = await jacSpawn("read_todos", "", {});
118
+ setTodos(result.reports);
119
+ }
120
+ loadTodos();
121
+ }, []);
122
+
123
+ return <div>
124
+ <h1>My Todos</h1>
125
+ {todos.map(lambda todo: any -> any {
126
+ return <div key={todo._jac_id}>{todo.text}</div>;
127
+ })}
128
+ </div>;
129
+ }
130
+ }
131
+ ```
132
+
77
133
  ---
78
134
 
79
135
  ## 🔧 Requirements