jac-client 0.1.0__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 (33) hide show
  1. jac_client/docs/README.md +629 -0
  2. jac_client/docs/advanced-state.md +706 -0
  3. jac_client/docs/imports.md +650 -0
  4. jac_client/docs/lifecycle-hooks.md +554 -0
  5. jac_client/docs/routing.md +530 -0
  6. jac_client/examples/little-x/app.jac +615 -0
  7. jac_client/examples/little-x/package-lock.json +2840 -0
  8. jac_client/examples/little-x/package.json +23 -0
  9. jac_client/examples/little-x/submit-button.jac +8 -0
  10. jac_client/examples/todo-app/README.md +82 -0
  11. jac_client/examples/todo-app/app.jac +683 -0
  12. jac_client/examples/todo-app/package-lock.json +999 -0
  13. jac_client/examples/todo-app/package.json +22 -0
  14. jac_client/plugin/cli.py +328 -0
  15. jac_client/plugin/client.py +41 -0
  16. jac_client/plugin/client_runtime.jac +941 -0
  17. jac_client/plugin/vite_client_bundle.py +470 -0
  18. jac_client/tests/__init__.py +2 -0
  19. jac_client/tests/fixtures/button.jac +6 -0
  20. jac_client/tests/fixtures/client_app.jac +18 -0
  21. jac_client/tests/fixtures/client_app_with_antd.jac +21 -0
  22. jac_client/tests/fixtures/js_import.jac +30 -0
  23. jac_client/tests/fixtures/package-lock.json +329 -0
  24. jac_client/tests/fixtures/package.json +11 -0
  25. jac_client/tests/fixtures/relative_import.jac +13 -0
  26. jac_client/tests/fixtures/test_fragments_spread.jac +44 -0
  27. jac_client/tests/fixtures/utils.js +22 -0
  28. jac_client/tests/test_cl.py +360 -0
  29. jac_client/tests/test_create_jac_app.py +139 -0
  30. jac_client-0.1.0.dist-info/METADATA +126 -0
  31. jac_client-0.1.0.dist-info/RECORD +33 -0
  32. jac_client-0.1.0.dist-info/WHEEL +4 -0
  33. jac_client-0.1.0.dist-info/entry_points.txt +4 -0
@@ -0,0 +1,329 @@
1
+ {
2
+ "name": "test-client",
3
+ "version": "0.0.1",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "test-client",
9
+ "version": "0.0.1",
10
+ "dependencies": {
11
+ "react": "^18.0.0",
12
+ "react-dom": "^18.0.0"
13
+ },
14
+ "devDependencies": {
15
+ "vite": "^5.0.0"
16
+ }
17
+ },
18
+ "node_modules/@esbuild/linux-x64": {
19
+ "version": "0.21.5",
20
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
21
+ "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
22
+ "cpu": [
23
+ "x64"
24
+ ],
25
+ "dev": true,
26
+ "license": "MIT",
27
+ "optional": true,
28
+ "os": [
29
+ "linux"
30
+ ],
31
+ "engines": {
32
+ "node": ">=12"
33
+ }
34
+ },
35
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
36
+ "version": "4.52.5",
37
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.5.tgz",
38
+ "integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==",
39
+ "cpu": [
40
+ "x64"
41
+ ],
42
+ "dev": true,
43
+ "license": "MIT",
44
+ "optional": true,
45
+ "os": [
46
+ "linux"
47
+ ]
48
+ },
49
+ "node_modules/@rollup/rollup-linux-x64-musl": {
50
+ "version": "4.52.5",
51
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.5.tgz",
52
+ "integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==",
53
+ "cpu": [
54
+ "x64"
55
+ ],
56
+ "dev": true,
57
+ "license": "MIT",
58
+ "optional": true,
59
+ "os": [
60
+ "linux"
61
+ ]
62
+ },
63
+ "node_modules/@types/estree": {
64
+ "version": "1.0.8",
65
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
66
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
67
+ "dev": true,
68
+ "license": "MIT"
69
+ },
70
+ "node_modules/esbuild": {
71
+ "version": "0.21.5",
72
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
73
+ "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
74
+ "dev": true,
75
+ "hasInstallScript": true,
76
+ "license": "MIT",
77
+ "bin": {
78
+ "esbuild": "bin/esbuild"
79
+ },
80
+ "engines": {
81
+ "node": ">=12"
82
+ },
83
+ "optionalDependencies": {
84
+ "@esbuild/aix-ppc64": "0.21.5",
85
+ "@esbuild/android-arm": "0.21.5",
86
+ "@esbuild/android-arm64": "0.21.5",
87
+ "@esbuild/android-x64": "0.21.5",
88
+ "@esbuild/darwin-arm64": "0.21.5",
89
+ "@esbuild/darwin-x64": "0.21.5",
90
+ "@esbuild/freebsd-arm64": "0.21.5",
91
+ "@esbuild/freebsd-x64": "0.21.5",
92
+ "@esbuild/linux-arm": "0.21.5",
93
+ "@esbuild/linux-arm64": "0.21.5",
94
+ "@esbuild/linux-ia32": "0.21.5",
95
+ "@esbuild/linux-loong64": "0.21.5",
96
+ "@esbuild/linux-mips64el": "0.21.5",
97
+ "@esbuild/linux-ppc64": "0.21.5",
98
+ "@esbuild/linux-riscv64": "0.21.5",
99
+ "@esbuild/linux-s390x": "0.21.5",
100
+ "@esbuild/linux-x64": "0.21.5",
101
+ "@esbuild/netbsd-x64": "0.21.5",
102
+ "@esbuild/openbsd-x64": "0.21.5",
103
+ "@esbuild/sunos-x64": "0.21.5",
104
+ "@esbuild/win32-arm64": "0.21.5",
105
+ "@esbuild/win32-ia32": "0.21.5",
106
+ "@esbuild/win32-x64": "0.21.5"
107
+ }
108
+ },
109
+ "node_modules/js-tokens": {
110
+ "version": "4.0.0",
111
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
112
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
113
+ "license": "MIT"
114
+ },
115
+ "node_modules/loose-envify": {
116
+ "version": "1.4.0",
117
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
118
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
119
+ "license": "MIT",
120
+ "dependencies": {
121
+ "js-tokens": "^3.0.0 || ^4.0.0"
122
+ },
123
+ "bin": {
124
+ "loose-envify": "cli.js"
125
+ }
126
+ },
127
+ "node_modules/nanoid": {
128
+ "version": "3.3.11",
129
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
130
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
131
+ "dev": true,
132
+ "funding": [
133
+ {
134
+ "type": "github",
135
+ "url": "https://github.com/sponsors/ai"
136
+ }
137
+ ],
138
+ "license": "MIT",
139
+ "bin": {
140
+ "nanoid": "bin/nanoid.cjs"
141
+ },
142
+ "engines": {
143
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
144
+ }
145
+ },
146
+ "node_modules/picocolors": {
147
+ "version": "1.1.1",
148
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
149
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
150
+ "dev": true,
151
+ "license": "ISC"
152
+ },
153
+ "node_modules/postcss": {
154
+ "version": "8.5.6",
155
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
156
+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
157
+ "dev": true,
158
+ "funding": [
159
+ {
160
+ "type": "opencollective",
161
+ "url": "https://opencollective.com/postcss/"
162
+ },
163
+ {
164
+ "type": "tidelift",
165
+ "url": "https://tidelift.com/funding/github/npm/postcss"
166
+ },
167
+ {
168
+ "type": "github",
169
+ "url": "https://github.com/sponsors/ai"
170
+ }
171
+ ],
172
+ "license": "MIT",
173
+ "dependencies": {
174
+ "nanoid": "^3.3.11",
175
+ "picocolors": "^1.1.1",
176
+ "source-map-js": "^1.2.1"
177
+ },
178
+ "engines": {
179
+ "node": "^10 || ^12 || >=14"
180
+ }
181
+ },
182
+ "node_modules/react": {
183
+ "version": "18.3.1",
184
+ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
185
+ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
186
+ "license": "MIT",
187
+ "dependencies": {
188
+ "loose-envify": "^1.1.0"
189
+ },
190
+ "engines": {
191
+ "node": ">=0.10.0"
192
+ }
193
+ },
194
+ "node_modules/react-dom": {
195
+ "version": "18.3.1",
196
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
197
+ "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
198
+ "license": "MIT",
199
+ "dependencies": {
200
+ "loose-envify": "^1.1.0",
201
+ "scheduler": "^0.23.2"
202
+ },
203
+ "peerDependencies": {
204
+ "react": "^18.3.1"
205
+ }
206
+ },
207
+ "node_modules/rollup": {
208
+ "version": "4.52.5",
209
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.5.tgz",
210
+ "integrity": "sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==",
211
+ "dev": true,
212
+ "license": "MIT",
213
+ "dependencies": {
214
+ "@types/estree": "1.0.8"
215
+ },
216
+ "bin": {
217
+ "rollup": "dist/bin/rollup"
218
+ },
219
+ "engines": {
220
+ "node": ">=18.0.0",
221
+ "npm": ">=8.0.0"
222
+ },
223
+ "optionalDependencies": {
224
+ "@rollup/rollup-android-arm-eabi": "4.52.5",
225
+ "@rollup/rollup-android-arm64": "4.52.5",
226
+ "@rollup/rollup-darwin-arm64": "4.52.5",
227
+ "@rollup/rollup-darwin-x64": "4.52.5",
228
+ "@rollup/rollup-freebsd-arm64": "4.52.5",
229
+ "@rollup/rollup-freebsd-x64": "4.52.5",
230
+ "@rollup/rollup-linux-arm-gnueabihf": "4.52.5",
231
+ "@rollup/rollup-linux-arm-musleabihf": "4.52.5",
232
+ "@rollup/rollup-linux-arm64-gnu": "4.52.5",
233
+ "@rollup/rollup-linux-arm64-musl": "4.52.5",
234
+ "@rollup/rollup-linux-loong64-gnu": "4.52.5",
235
+ "@rollup/rollup-linux-ppc64-gnu": "4.52.5",
236
+ "@rollup/rollup-linux-riscv64-gnu": "4.52.5",
237
+ "@rollup/rollup-linux-riscv64-musl": "4.52.5",
238
+ "@rollup/rollup-linux-s390x-gnu": "4.52.5",
239
+ "@rollup/rollup-linux-x64-gnu": "4.52.5",
240
+ "@rollup/rollup-linux-x64-musl": "4.52.5",
241
+ "@rollup/rollup-openharmony-arm64": "4.52.5",
242
+ "@rollup/rollup-win32-arm64-msvc": "4.52.5",
243
+ "@rollup/rollup-win32-ia32-msvc": "4.52.5",
244
+ "@rollup/rollup-win32-x64-gnu": "4.52.5",
245
+ "@rollup/rollup-win32-x64-msvc": "4.52.5",
246
+ "fsevents": "~2.3.2"
247
+ }
248
+ },
249
+ "node_modules/scheduler": {
250
+ "version": "0.23.2",
251
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
252
+ "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
253
+ "license": "MIT",
254
+ "dependencies": {
255
+ "loose-envify": "^1.1.0"
256
+ }
257
+ },
258
+ "node_modules/source-map-js": {
259
+ "version": "1.2.1",
260
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
261
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
262
+ "dev": true,
263
+ "license": "BSD-3-Clause",
264
+ "engines": {
265
+ "node": ">=0.10.0"
266
+ }
267
+ },
268
+ "node_modules/vite": {
269
+ "version": "5.4.21",
270
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
271
+ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
272
+ "dev": true,
273
+ "license": "MIT",
274
+ "dependencies": {
275
+ "esbuild": "^0.21.3",
276
+ "postcss": "^8.4.43",
277
+ "rollup": "^4.20.0"
278
+ },
279
+ "bin": {
280
+ "vite": "bin/vite.js"
281
+ },
282
+ "engines": {
283
+ "node": "^18.0.0 || >=20.0.0"
284
+ },
285
+ "funding": {
286
+ "url": "https://github.com/vitejs/vite?sponsor=1"
287
+ },
288
+ "optionalDependencies": {
289
+ "fsevents": "~2.3.3"
290
+ },
291
+ "peerDependencies": {
292
+ "@types/node": "^18.0.0 || >=20.0.0",
293
+ "less": "*",
294
+ "lightningcss": "^1.21.0",
295
+ "sass": "*",
296
+ "sass-embedded": "*",
297
+ "stylus": "*",
298
+ "sugarss": "*",
299
+ "terser": "^5.4.0"
300
+ },
301
+ "peerDependenciesMeta": {
302
+ "@types/node": {
303
+ "optional": true
304
+ },
305
+ "less": {
306
+ "optional": true
307
+ },
308
+ "lightningcss": {
309
+ "optional": true
310
+ },
311
+ "sass": {
312
+ "optional": true
313
+ },
314
+ "sass-embedded": {
315
+ "optional": true
316
+ },
317
+ "stylus": {
318
+ "optional": true
319
+ },
320
+ "sugarss": {
321
+ "optional": true
322
+ },
323
+ "terser": {
324
+ "optional": true
325
+ }
326
+ }
327
+ }
328
+ }
329
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "test-client",
3
+ "version": "0.0.1",
4
+ "dependencies": {
5
+ "react": "^18.0.0",
6
+ "react-dom": "^18.0.0"
7
+ },
8
+ "devDependencies": {
9
+ "vite": "^5.0.0"
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ cl import from .button {
2
+ CustomButton
3
+ }
4
+
5
+ cl def RelativeImport() -> any {
6
+ return <div>
7
+ <CustomButton />
8
+ </div>;
9
+ }
10
+
11
+ cl def main() -> any {
12
+ return <RelativeImport />;
13
+ }
@@ -0,0 +1,44 @@
1
+ """Test fixture for JSX fragments and spread props functionality."""
2
+
3
+ cl def FragmentTest() {
4
+ # Test that fragments work
5
+ return <>
6
+ <h1>{"Fragment Title"}</h1>
7
+ <p>{"Fragment content"}</p>
8
+ </>;
9
+ }
10
+
11
+ cl def SpreadPropsTest() {
12
+ # Test spread props
13
+ unwrapped = {"id": "my-div", "class": "container", "data-role": "main"};
14
+
15
+ return <div {...unwrapped}>
16
+ <span>{"Spread props work!"}</span>
17
+ </div>;
18
+ }
19
+
20
+ cl def MixedTest() {
21
+ # Test mixing spread props with regular props
22
+ baseStyle = {"id": "base-id", "color": "blue"};
23
+
24
+ return <>
25
+ <div {...baseStyle} class="override">
26
+ {"Mixed test"}
27
+ </div>
28
+ <div class="normal">
29
+ {"No spread"}
30
+ </div>
31
+ </>;
32
+ }
33
+
34
+ cl def NestedFragments() {
35
+ return <div class="wrapper">
36
+ <>
37
+ <h2>{"Nested Fragment 1"}</h2>
38
+ </>
39
+ <>
40
+ <p>{"Nested Fragment 2"}</p>
41
+ </>
42
+ </div>;
43
+ }
44
+
@@ -0,0 +1,22 @@
1
+ // JavaScript utility functions for testing JS imports in Jac
2
+
3
+ export function formatMessage(name) {
4
+ return `Hello, ${name}!`;
5
+ }
6
+
7
+ export function calculateSum(a, b) {
8
+ return a + b;
9
+ }
10
+
11
+ export const JS_CONSTANT = "Imported from JavaScript";
12
+
13
+ export class MessageFormatter {
14
+ constructor(prefix) {
15
+ this.prefix = prefix;
16
+ }
17
+
18
+ format(text) {
19
+ return `${this.prefix}: ${text}`;
20
+ }
21
+ }
22
+