jac-client 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl

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 (70) hide show
  1. jac_client/examples/all-in-one/src/app.jac +841 -0
  2. jac_client/examples/all-in-one/src/button.jac +7 -0
  3. jac_client/examples/all-in-one/src/components/button.jac +7 -0
  4. jac_client/examples/asset-serving/css-with-image/src/app.jac +88 -0
  5. jac_client/examples/asset-serving/image-asset/src/app.jac +55 -0
  6. jac_client/examples/asset-serving/import-alias/src/app.jac +111 -0
  7. jac_client/examples/basic/src/app.jac +21 -0
  8. jac_client/examples/basic-auth/src/app.jac +377 -0
  9. jac_client/examples/basic-auth-with-router/src/app.jac +464 -0
  10. jac_client/examples/basic-full-stack/src/app.jac +365 -0
  11. jac_client/examples/css-styling/js-styling/src/app.jac +84 -0
  12. jac_client/examples/css-styling/material-ui/src/app.jac +122 -0
  13. jac_client/examples/css-styling/pure-css/src/app.jac +64 -0
  14. jac_client/examples/css-styling/sass-example/src/app.jac +64 -0
  15. jac_client/examples/css-styling/styled-components/src/app.jac +71 -0
  16. jac_client/examples/css-styling/tailwind-example/src/app.jac +63 -0
  17. jac_client/examples/full-stack-with-auth/src/app.jac +722 -0
  18. jac_client/examples/little-x/src/app.jac +719 -0
  19. jac_client/examples/little-x/src/submit-button.jac +16 -0
  20. jac_client/examples/nested-folders/nested-advance/src/ButtonRoot.jac +11 -0
  21. jac_client/examples/nested-folders/nested-advance/src/app.jac +35 -0
  22. jac_client/examples/nested-folders/nested-advance/src/level1/ButtonSecondL.jac +19 -0
  23. jac_client/examples/nested-folders/nested-advance/src/level1/Card.jac +43 -0
  24. jac_client/examples/nested-folders/nested-advance/src/level1/level2/ButtonThirdL.jac +25 -0
  25. jac_client/examples/nested-folders/nested-basic/src/app.jac +13 -0
  26. jac_client/examples/nested-folders/nested-basic/src/button.jac +7 -0
  27. jac_client/examples/nested-folders/nested-basic/src/components/button.jac +7 -0
  28. jac_client/examples/ts-support/src/app.jac +35 -0
  29. jac_client/examples/with-router/src/app.jac +323 -0
  30. jac_client/plugin/cli.jac +547 -0
  31. jac_client/plugin/client.jac +52 -0
  32. jac_client/plugin/client_runtime.cl.jac +38 -0
  33. jac_client/plugin/impl/client.impl.jac +134 -0
  34. jac_client/plugin/impl/client_runtime.impl.jac +177 -0
  35. jac_client/plugin/impl/vite_client_bundle.impl.jac +72 -0
  36. jac_client/plugin/plugin_config.jac +195 -0
  37. jac_client/plugin/src/__init__.jac +20 -0
  38. jac_client/plugin/src/asset_processor.jac +33 -0
  39. jac_client/plugin/src/babel_processor.jac +18 -0
  40. jac_client/plugin/src/compiler.jac +66 -0
  41. jac_client/plugin/src/config_loader.jac +32 -0
  42. jac_client/plugin/src/impl/asset_processor.impl.jac +127 -0
  43. jac_client/plugin/src/impl/babel_processor.impl.jac +84 -0
  44. jac_client/plugin/src/impl/compiler.impl.jac +251 -0
  45. jac_client/plugin/src/impl/config_loader.impl.jac +119 -0
  46. jac_client/plugin/src/impl/import_processor.impl.jac +33 -0
  47. jac_client/plugin/src/impl/jac_to_js.impl.jac +41 -0
  48. jac_client/plugin/src/impl/package_installer.impl.jac +105 -0
  49. jac_client/plugin/src/impl/vite_bundler.impl.jac +513 -0
  50. jac_client/plugin/src/import_processor.jac +19 -0
  51. jac_client/plugin/src/jac_to_js.jac +35 -0
  52. jac_client/plugin/src/package_installer.jac +26 -0
  53. jac_client/plugin/src/vite_bundler.jac +36 -0
  54. jac_client/plugin/vite_client_bundle.jac +31 -0
  55. jac_client/tests/fixtures/basic-app/app.jac +23 -0
  56. jac_client/tests/fixtures/cl_file/app.cl.jac +48 -0
  57. jac_client/tests/fixtures/cl_file/app.jac +15 -0
  58. jac_client/tests/fixtures/client_app_with_antd/app.jac +34 -0
  59. jac_client/tests/fixtures/js_import/app.jac +34 -0
  60. jac_client/tests/fixtures/relative_import/app.jac +11 -0
  61. jac_client/tests/fixtures/relative_import/button.jac +7 -0
  62. jac_client/tests/fixtures/spawn_test/app.jac +129 -0
  63. jac_client/tests/fixtures/test_fragments_spread/app.jac +67 -0
  64. jac_client/tests/fixtures/with-ts/app.jac +35 -0
  65. {jac_client-0.2.4.dist-info → jac_client-0.2.5.dist-info}/METADATA +2 -2
  66. jac_client-0.2.5.dist-info/RECORD +74 -0
  67. jac_client-0.2.4.dist-info/RECORD +0 -10
  68. {jac_client-0.2.4.dist-info → jac_client-0.2.5.dist-info}/WHEEL +0 -0
  69. {jac_client-0.2.4.dist-info → jac_client-0.2.5.dist-info}/entry_points.txt +0 -0
  70. {jac_client-0.2.4.dist-info → jac_client-0.2.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,16 @@
1
+ cl def:pub SubmitButton -> any {
2
+ return <button
3
+ type="submit"
4
+ style={{
5
+ "width": "100%",
6
+ "padding": "10px",
7
+ "backgroundColor": "#1da1f2",
8
+ "color": "white",
9
+ "border": "none",
10
+ "borderRadius": "4px",
11
+ "cursor": "pointer"
12
+ }}
13
+ >
14
+ Sign Up
15
+ </button>;
16
+ }
@@ -0,0 +1,11 @@
1
+ # Root Level Button
2
+ cl import from antd { Button }
3
+
4
+ cl def:pub ButtonRoot -> any {
5
+ return <Button
6
+ type="primary"
7
+ size="large"
8
+ >
9
+ Root Level Button
10
+ </Button>;
11
+ }
@@ -0,0 +1,35 @@
1
+ # Nested Folder Levels Example
2
+ cl import from .ButtonRoot { ButtonRoot }
3
+ cl import from .level1.ButtonSecondL { ButtonSecondL }
4
+ cl import from .level1.level2.ButtonThirdL { ButtonThirdL }
5
+ cl import from .level1.Card { Card }
6
+
7
+ cl def:pub app -> any {
8
+ return <div
9
+ style={{padding: "20px"}}
10
+ >
11
+ <h1>
12
+ Nested Folder Levels Demo
13
+ </h1>
14
+ <div
15
+ style={{margin: "10px 0"}}
16
+ >
17
+ <ButtonRoot />
18
+ </div>
19
+ <div
20
+ style={{margin: "10px 0"}}
21
+ >
22
+ <ButtonSecondL />
23
+ </div>
24
+ <div
25
+ style={{margin: "10px 0"}}
26
+ >
27
+ <ButtonThirdL />
28
+ </div>
29
+ <div
30
+ style={{margin: "10px 0"}}
31
+ >
32
+ <Card />
33
+ </div>
34
+ </div>;
35
+ }
@@ -0,0 +1,19 @@
1
+ # Second Level Button (level1/)
2
+ cl import from antd { Button }
3
+ cl import from ..ButtonRoot { ButtonRoot }
4
+
5
+ cl def:pub ButtonSecondL -> any {
6
+ return <div>
7
+ <Button
8
+ type="default"
9
+ size="large"
10
+ >
11
+ Second Level Button (imports from root)
12
+ </Button>
13
+ <div
14
+ style={{marginTop: "10px"}}
15
+ >
16
+ <ButtonRoot />
17
+ </div>
18
+ </div>;
19
+ }
@@ -0,0 +1,43 @@
1
+ # Card Component on Second Level
2
+ # Imports from both above (root) and below (level2)
3
+ cl import from ..ButtonRoot {
4
+ ButtonRoot
5
+ }
6
+ cl import from .level2.ButtonThirdL { ButtonThirdL }
7
+
8
+ cl def:pub Card -> any {
9
+ return <div
10
+ style={{
11
+ border: "2px solid #007bff",
12
+ borderRadius: "8px",
13
+ padding: "20px",
14
+ margin: "10px 0",
15
+ backgroundColor: "#f8f9fa"
16
+ }}
17
+ >
18
+ <h3>
19
+ Card Component (Second Level)
20
+ </h3>
21
+ <p>
22
+ This card imports from:
23
+ </p>
24
+ <ul>
25
+ <li>
26
+ Root level: ButtonRoot (using ..)
27
+ </li>
28
+ <li>
29
+ Third level: ButtonThirdL (using .level2)
30
+ </li>
31
+ </ul>
32
+ <div
33
+ style={{marginTop: "15px"}}
34
+ >
35
+ <ButtonRoot />
36
+ </div>
37
+ <div
38
+ style={{marginTop: "10px"}}
39
+ >
40
+ <ButtonThirdL />
41
+ </div>
42
+ </div>;
43
+ }
@@ -0,0 +1,25 @@
1
+ # Third Level Button (level1/level2/)
2
+ cl import from antd { Button }
3
+ cl import from ...ButtonRoot { ButtonRoot }
4
+ cl import from ..ButtonSecondL { ButtonSecondL }
5
+
6
+ cl def:pub ButtonThirdL -> any {
7
+ return <div>
8
+ <Button
9
+ type="dashed"
10
+ size="large"
11
+ >
12
+ Third Level Button (imports from root and second level)
13
+ </Button>
14
+ <div
15
+ style={{marginTop: "10px"}}
16
+ >
17
+ <ButtonRoot />
18
+ </div>
19
+ <div
20
+ style={{marginTop: "10px"}}
21
+ >
22
+ <ButtonSecondL />
23
+ </div>
24
+ </div>;
25
+ }
@@ -0,0 +1,13 @@
1
+ cl import from .components.button { CustomButton }
2
+ cl import from .button { CustomButtonRoot }
3
+
4
+ cl def RelativeImport -> any {
5
+ return <div>
6
+ <CustomButton />
7
+ <CustomButtonRoot />
8
+ </div>;
9
+ }
10
+
11
+ cl def:pub app -> any {
12
+ return <RelativeImport />;
13
+ }
@@ -0,0 +1,7 @@
1
+ cl import from antd { Button }
2
+
3
+ cl def:pub CustomButtonRoot -> any {
4
+ return <Button>
5
+ Click Me
6
+ </Button>;
7
+ }
@@ -0,0 +1,7 @@
1
+ cl import from antd { Button }
2
+
3
+ cl def:pub CustomButton -> any {
4
+ return <Button>
5
+ Click Me
6
+ </Button>;
7
+ }
@@ -0,0 +1,35 @@
1
+
2
+ # Pages
3
+ cl import from react { useState, useEffect }
4
+ cl import from ".components/Button.tsx" { Button }
5
+
6
+ cl {
7
+ def:pub app -> any {
8
+ [count, setCount] = useState(0);
9
+ useEffect(lambda -> None{ console.log("Count: ", count);} , [count]);
10
+ return <div
11
+ style={{padding: "2rem", fontFamily: "Arial, sans-serif"}}
12
+ >
13
+ <h1>
14
+ Hello, World!
15
+ </h1>
16
+ <p>
17
+ Count: {count}
18
+ </p>
19
+ <div
20
+ style={{display: "flex", gap: "1rem", marginTop: "1rem"}}
21
+ >
22
+ <Button
23
+ label="Increment"
24
+ onClick={lambda -> None{ setCount(count + 1);} }
25
+ variant="primary"
26
+ />
27
+ <Button
28
+ label="Reset"
29
+ onClick={lambda -> None{ setCount(0);} }
30
+ variant="secondary"
31
+ />
32
+ </div>
33
+ </div>;
34
+ }
35
+ }
@@ -0,0 +1,323 @@
1
+ # React Router HashRouter Example
2
+ cl import from react { useState, useEffect }
3
+ cl import from "@jac-client/utils" {
4
+ Router,
5
+ Routes,
6
+ Route,
7
+ Link,
8
+ useNavigate,
9
+ useLocation,
10
+ useParams
11
+ }
12
+
13
+ cl {
14
+ # Home Page Component
15
+ def Home -> any {
16
+ location = useLocation();
17
+ navigate = useNavigate();
18
+
19
+ def goToAbout(e: any) -> None {
20
+ navigate("/about");
21
+ }
22
+
23
+ return <div>
24
+ <h1>
25
+ 🏠 Home Page
26
+ </h1>
27
+ <p>
28
+ Welcome to the home page!
29
+ </p>
30
+ <p>
31
+ This example uses React Router's
32
+ <strong>
33
+ HashRouter
34
+ </strong>
35
+ # for client-side routing.
36
+ </p>
37
+ <p>
38
+ Current path:
39
+ <code>
40
+ {location.pathname}
41
+ </code>
42
+ </p>
43
+ <button
44
+ onClick={goToAbout}
45
+ >
46
+ Go to About →
47
+ </button>
48
+ </div>;
49
+ }
50
+
51
+ # About Page Component
52
+ def About -> any {
53
+ location = useLocation();
54
+
55
+ return <div>
56
+ <h1>
57
+ ℹ️ About Page
58
+ </h1>
59
+ <p>
60
+ This is the about page.
61
+ </p>
62
+ <p>
63
+ Learn more about our application here.
64
+ </p>
65
+ <p>
66
+ Current path:
67
+ <code>
68
+ {location.pathname}
69
+ </code>
70
+ </p>
71
+ <div
72
+ style={{"marginTop": "1rem"}}
73
+ >
74
+ <Link to="/about/team">
75
+ View Team →
76
+ </Link>
77
+ </div>
78
+ </div>;
79
+ }
80
+
81
+ # Team Page Component (nested route example)
82
+ def Team -> any {
83
+ return <div>
84
+ <h1>
85
+ 👥 Our Team
86
+ </h1>
87
+ <p>
88
+ Meet the amazing team behind this project!
89
+ </p>
90
+ <Link to="/about">
91
+ ← Back to About
92
+ </Link>
93
+ </div>;
94
+ }
95
+
96
+ # User Profile Component (with URL parameters)
97
+ def UserProfile -> any {
98
+ params = useParams();
99
+ userId = params.id if params.id else "Unknown";
100
+
101
+ return <div>
102
+ <h1>
103
+ 👤 User Profile
104
+ </h1>
105
+ <p>
106
+ Viewing profile for user:
107
+ <strong>
108
+ {userId}
109
+ </strong>
110
+ </p>
111
+ <p>
112
+ This demonstrates URL parameters using
113
+ <code>
114
+ /user/:id
115
+ </code>
116
+ </p>
117
+ <Link to="/">
118
+ ← Back to Home
119
+ </Link>
120
+ </div>;
121
+ }
122
+
123
+ # Contact Page Component
124
+ def Contact -> any {
125
+ [submitted, setSubmitted] = useState(False);
126
+
127
+ def handleSubmit(e: any) -> None {
128
+ e.preventDefault();
129
+ setSubmitted(True);
130
+ }
131
+
132
+ def resetForm(e: any) -> None {
133
+ setSubmitted(False);
134
+ }
135
+
136
+ if submitted {
137
+ return <div>
138
+ <h1>
139
+ 📧 Contact Page
140
+ </h1>
141
+ <div
142
+ style={{"color": "green"}}
143
+ >
144
+ <p>
145
+ ✓ Thank you! Your message has been sent.
146
+ </p>
147
+ <button
148
+ onClick={resetForm}
149
+ >
150
+ Send another
151
+ </button>
152
+ </div>
153
+ </div>;
154
+ }
155
+
156
+ return <div>
157
+ <h1>
158
+ 📧 Contact Page
159
+ </h1>
160
+ <p>
161
+ Get in touch with us!
162
+ </p>
163
+ <form
164
+ onSubmit={handleSubmit}
165
+ >
166
+ <input
167
+ type="text"
168
+ placeholder="Your name"
169
+ style={{"margin": "0.5rem 0", "display": "block"}}
170
+ />
171
+ <input
172
+ type="text"
173
+ placeholder="Your username"
174
+ style={{"margin": "0.5rem 0", "display": "block"}}
175
+ />
176
+ <textarea
177
+ placeholder="Your message"
178
+ style={{"margin": "0.5rem 0", "display": "block"}}
179
+ ></textarea>
180
+ <button type="submit">
181
+ Send Message
182
+ </button>
183
+ </form>
184
+ </div>;
185
+ }
186
+
187
+ # 404 Not Found Component
188
+ def NotFound -> any {
189
+ location = useLocation();
190
+ navigate = useNavigate();
191
+
192
+ def goHome(e: any) -> None {
193
+ navigate("/");
194
+ }
195
+
196
+ return <div
197
+ style={{"textAlign": "center", "padding": "2rem"}}
198
+ >
199
+ <h1>
200
+ 🔍 404 - Page Not Found
201
+ </h1>
202
+ <p>
203
+ The page
204
+ <code>
205
+ {location.pathname}
206
+ </code>
207
+ does not exist.
208
+ </p>
209
+ <button
210
+ onClick={goHome}
211
+ >
212
+ Go Home
213
+ </button>
214
+ </div>;
215
+ }
216
+
217
+ # Navigation Component with active link styling
218
+ def Navigation -> any {
219
+ location = useLocation();
220
+
221
+ def linkStyle(path: str) -> dict {
222
+ isActive = location.pathname == path;
223
+ return {
224
+ "padding": "0.5rem 1rem",
225
+ "textDecoration": "none",
226
+ "color": "#0066cc" if isActive else "#333",
227
+ "fontWeight": "bold" if isActive else "normal",
228
+ "backgroundColor": "#e3f2fd" if isActive else "transparent",
229
+ "borderRadius": "4px",
230
+ "display": "inline-block"
231
+ };
232
+ }
233
+
234
+ return <nav
235
+ style={{
236
+ "padding": "1rem",
237
+ "backgroundColor": "#f5f5f5",
238
+ "marginBottom": "2rem",
239
+ "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
240
+ }}
241
+ >
242
+ <div
243
+ style={{
244
+ "maxWidth": "1200px",
245
+ "margin": "0 auto",
246
+ "display": "flex",
247
+ "gap": "1rem",
248
+ "alignItems": "center"
249
+ }}
250
+ >
251
+ <Link
252
+ to="/"
253
+ style={linkStyle("/")}
254
+ >
255
+ Home
256
+ </Link>
257
+ <Link
258
+ to="/about"
259
+ style={linkStyle("/about")}
260
+ >
261
+ About
262
+ </Link>
263
+ <Link
264
+ to="/contact"
265
+ style={linkStyle("/contact")}
266
+ >
267
+ Contact
268
+ </Link>
269
+ <Link
270
+ to="/user/123"
271
+ style={linkStyle("/user/123")}
272
+ >
273
+ Profile Demo
274
+ </Link>
275
+ </div>
276
+ </nav>;
277
+ }
278
+
279
+ # Main App Component with React Router HashRouter
280
+ def:pub app -> any {
281
+ return <Router>
282
+ <div
283
+ style={{"fontFamily": "system-ui, -apple-system, sans-serif"}}
284
+ >
285
+ <Navigation />
286
+ <div
287
+ style={{
288
+ "maxWidth": "1200px",
289
+ "margin": "0 auto",
290
+ "padding": "0 1rem"
291
+ }}
292
+ >
293
+ <Routes>
294
+ <Route
295
+ path="/"
296
+ element={<Home />}
297
+ />
298
+ <Route
299
+ path="/about"
300
+ element={<About />}
301
+ />
302
+ <Route
303
+ path="/about/team"
304
+ element={<Team />}
305
+ />
306
+ <Route
307
+ path="/contact"
308
+ element={<Contact />}
309
+ />
310
+ <Route
311
+ path="/user/:id"
312
+ element={<UserProfile />}
313
+ />
314
+ <Route
315
+ path="*"
316
+ element={<NotFound />}
317
+ />
318
+ </Routes>
319
+ </div>
320
+ </div>
321
+ </Router>;
322
+ }
323
+ }