jac-client 0.2.2__py3-none-any.whl → 0.2.6__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.
- jac_client/examples/all-in-one/assets/workers/worker.py +5 -0
- jac_client/examples/all-in-one/src/app.jac +841 -0
- jac_client/examples/all-in-one/{button.jac → src/button.jac} +1 -1
- jac_client/examples/all-in-one/{components → src/components}/button.jac +1 -1
- jac_client/examples/asset-serving/css-with-image/{app.jac → src/app.jac} +2 -2
- jac_client/examples/asset-serving/image-asset/{app.jac → src/app.jac} +2 -2
- jac_client/examples/asset-serving/import-alias/{app.jac → src/app.jac} +7 -7
- jac_client/examples/basic/{app.jac → src/app.jac} +2 -2
- jac_client/examples/basic-auth/src/app.jac +377 -0
- jac_client/examples/basic-auth-with-router/{app.jac → src/app.jac} +18 -18
- jac_client/examples/basic-full-stack/{app.jac → src/app.jac} +175 -130
- jac_client/examples/css-styling/js-styling/{app.jac → src/app.jac} +6 -6
- jac_client/examples/css-styling/material-ui/{app.jac → src/app.jac} +5 -5
- jac_client/examples/css-styling/pure-css/{app.jac → src/app.jac} +6 -6
- jac_client/examples/css-styling/sass-example/{app.jac → src/app.jac} +6 -6
- jac_client/examples/css-styling/styled-components/{app.jac → src/app.jac} +5 -5
- jac_client/examples/css-styling/tailwind-example/{app.jac → src/app.jac} +6 -6
- jac_client/examples/full-stack-with-auth/{app.jac → src/app.jac} +37 -37
- jac_client/examples/little-x/{app.jac → src/app.jac} +27 -32
- jac_client/examples/little-x/src/submit-button.jac +16 -0
- jac_client/examples/nested-folders/nested-advance/{ButtonRoot.jac → src/ButtonRoot.jac} +1 -1
- jac_client/examples/nested-folders/nested-advance/{app.jac → src/app.jac} +1 -1
- jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/ButtonSecondL.jac +1 -1
- jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/Card.jac +1 -1
- jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/level2/ButtonThirdL.jac +1 -1
- jac_client/examples/nested-folders/nested-basic/{app.jac → src/app.jac} +2 -2
- jac_client/examples/nested-folders/nested-basic/{button.jac → src/button.jac} +1 -1
- jac_client/examples/nested-folders/nested-basic/{components → src/components}/button.jac +1 -1
- jac_client/examples/ts-support/src/app.jac +35 -0
- jac_client/examples/with-router/{app.jac → src/app.jac} +11 -11
- jac_client/plugin/cli.jac +547 -0
- jac_client/plugin/client.jac +52 -0
- jac_client/plugin/client_runtime.cl.jac +38 -0
- jac_client/plugin/impl/client.impl.jac +134 -0
- jac_client/plugin/impl/client_runtime.impl.jac +177 -0
- jac_client/plugin/impl/vite_client_bundle.impl.jac +72 -0
- jac_client/plugin/plugin_config.jac +195 -0
- jac_client/plugin/src/__init__.jac +20 -0
- jac_client/plugin/src/asset_processor.jac +33 -0
- jac_client/plugin/src/babel_processor.jac +18 -0
- jac_client/plugin/src/compiler.jac +66 -0
- jac_client/plugin/src/config_loader.jac +32 -0
- jac_client/plugin/src/impl/asset_processor.impl.jac +127 -0
- jac_client/plugin/src/impl/babel_processor.impl.jac +84 -0
- jac_client/plugin/src/impl/compiler.impl.jac +251 -0
- jac_client/plugin/src/impl/config_loader.impl.jac +119 -0
- jac_client/plugin/src/impl/import_processor.impl.jac +33 -0
- jac_client/plugin/src/impl/jac_to_js.impl.jac +41 -0
- jac_client/plugin/src/impl/package_installer.impl.jac +105 -0
- jac_client/plugin/src/impl/vite_bundler.impl.jac +513 -0
- jac_client/plugin/src/import_processor.jac +19 -0
- jac_client/plugin/src/jac_to_js.jac +35 -0
- jac_client/plugin/src/package_installer.jac +26 -0
- jac_client/plugin/src/vite_bundler.jac +36 -0
- jac_client/plugin/vite_client_bundle.jac +31 -0
- jac_client/tests/conftest.py +281 -0
- jac_client/tests/fixtures/basic-app/app.jac +2 -2
- jac_client/tests/fixtures/cl_file/app.cl.jac +2 -2
- jac_client/tests/fixtures/client_app_with_antd/app.jac +1 -1
- jac_client/tests/fixtures/js_import/app.jac +5 -5
- jac_client/tests/fixtures/spawn_test/app.jac +7 -7
- jac_client/tests/fixtures/with-ts/app.jac +35 -0
- jac_client/tests/test_cli.py +755 -0
- jac_client/tests/test_it.py +347 -67
- {jac_client-0.2.2.dist-info → jac_client-0.2.6.dist-info}/METADATA +30 -24
- jac_client-0.2.6.dist-info/RECORD +74 -0
- {jac_client-0.2.2.dist-info → jac_client-0.2.6.dist-info}/WHEEL +2 -1
- jac_client-0.2.6.dist-info/entry_points.txt +4 -0
- jac_client-0.2.6.dist-info/top_level.txt +1 -0
- jac_client/docs/README.md +0 -689
- jac_client/docs/advanced-state.md +0 -1265
- jac_client/docs/asset-serving/intro.md +0 -209
- jac_client/docs/assets/pipe_line-v2.svg +0 -32
- jac_client/docs/assets/pipe_line.png +0 -0
- jac_client/docs/file-system/app.jac.md +0 -121
- jac_client/docs/file-system/backend-frontend.md +0 -217
- jac_client/docs/file-system/intro.md +0 -72
- jac_client/docs/file-system/nested-imports.md +0 -348
- jac_client/docs/guide-example/intro.md +0 -115
- jac_client/docs/guide-example/step-01-setup.md +0 -270
- jac_client/docs/guide-example/step-02-components.md +0 -416
- jac_client/docs/guide-example/step-03-styling.md +0 -478
- jac_client/docs/guide-example/step-04-todo-ui.md +0 -477
- jac_client/docs/guide-example/step-05-local-state.md +0 -530
- jac_client/docs/guide-example/step-06-events.md +0 -749
- jac_client/docs/guide-example/step-07-effects.md +0 -468
- jac_client/docs/guide-example/step-08-walkers.md +0 -534
- jac_client/docs/guide-example/step-09-authentication.md +0 -586
- jac_client/docs/guide-example/step-10-routing.md +0 -539
- jac_client/docs/guide-example/step-11-final.md +0 -963
- jac_client/docs/imports.md +0 -1141
- jac_client/docs/lifecycle-hooks.md +0 -773
- jac_client/docs/routing.md +0 -659
- jac_client/docs/styling/intro.md +0 -249
- jac_client/docs/styling/js-styling.md +0 -367
- jac_client/docs/styling/material-ui.md +0 -341
- jac_client/docs/styling/pure-css.md +0 -299
- jac_client/docs/styling/sass.md +0 -403
- jac_client/docs/styling/styled-components.md +0 -395
- jac_client/docs/styling/tailwind.md +0 -298
- jac_client/examples/all-in-one/.babelrc +0 -9
- jac_client/examples/all-in-one/README.md +0 -16
- jac_client/examples/all-in-one/app.jac +0 -426
- jac_client/examples/all-in-one/assets/burger.png +0 -0
- jac_client/examples/all-in-one/package.json +0 -29
- jac_client/examples/all-in-one/styles.css +0 -26
- jac_client/examples/all-in-one/vite.config.js +0 -28
- jac_client/examples/asset-serving/css-with-image/.babelrc +0 -9
- jac_client/examples/asset-serving/css-with-image/README.md +0 -91
- jac_client/examples/asset-serving/css-with-image/assets/burger.png +0 -0
- jac_client/examples/asset-serving/css-with-image/package.json +0 -28
- jac_client/examples/asset-serving/css-with-image/styles.css +0 -26
- jac_client/examples/asset-serving/css-with-image/vite.config.js +0 -28
- jac_client/examples/asset-serving/image-asset/.babelrc +0 -9
- jac_client/examples/asset-serving/image-asset/README.md +0 -119
- jac_client/examples/asset-serving/image-asset/assets/burger.png +0 -0
- jac_client/examples/asset-serving/image-asset/package.json +0 -28
- jac_client/examples/asset-serving/image-asset/styles.css +0 -26
- jac_client/examples/asset-serving/image-asset/vite.config.js +0 -28
- jac_client/examples/asset-serving/import-alias/.babelrc +0 -9
- jac_client/examples/asset-serving/import-alias/README.md +0 -83
- jac_client/examples/asset-serving/import-alias/assets/burger.png +0 -0
- jac_client/examples/asset-serving/import-alias/package.json +0 -28
- jac_client/examples/asset-serving/import-alias/vite.config.js +0 -28
- jac_client/examples/basic/.babelrc +0 -9
- jac_client/examples/basic/README.md +0 -16
- jac_client/examples/basic/package.json +0 -27
- jac_client/examples/basic/vite.config.js +0 -27
- jac_client/examples/basic-auth/.babelrc +0 -9
- jac_client/examples/basic-auth/README.md +0 -16
- jac_client/examples/basic-auth/app.jac +0 -308
- jac_client/examples/basic-auth/package.json +0 -27
- jac_client/examples/basic-auth/vite.config.js +0 -27
- jac_client/examples/basic-auth-with-router/.babelrc +0 -9
- jac_client/examples/basic-auth-with-router/README.md +0 -60
- jac_client/examples/basic-auth-with-router/package.json +0 -28
- jac_client/examples/basic-auth-with-router/vite.config.js +0 -27
- jac_client/examples/basic-full-stack/.babelrc +0 -9
- jac_client/examples/basic-full-stack/README.md +0 -18
- jac_client/examples/basic-full-stack/package.json +0 -28
- jac_client/examples/basic-full-stack/vite.config.js +0 -27
- jac_client/examples/css-styling/js-styling/.babelrc +0 -9
- jac_client/examples/css-styling/js-styling/README.md +0 -183
- jac_client/examples/css-styling/js-styling/package.json +0 -28
- jac_client/examples/css-styling/js-styling/styles.js +0 -100
- jac_client/examples/css-styling/js-styling/vite.config.js +0 -27
- jac_client/examples/css-styling/material-ui/.babelrc +0 -9
- jac_client/examples/css-styling/material-ui/README.md +0 -16
- jac_client/examples/css-styling/material-ui/package.json +0 -32
- jac_client/examples/css-styling/material-ui/vite.config.js +0 -27
- jac_client/examples/css-styling/pure-css/.babelrc +0 -9
- jac_client/examples/css-styling/pure-css/README.md +0 -16
- jac_client/examples/css-styling/pure-css/package.json +0 -28
- jac_client/examples/css-styling/pure-css/styles.css +0 -111
- jac_client/examples/css-styling/pure-css/vite.config.js +0 -27
- jac_client/examples/css-styling/sass-example/.babelrc +0 -9
- jac_client/examples/css-styling/sass-example/README.md +0 -16
- jac_client/examples/css-styling/sass-example/package.json +0 -29
- jac_client/examples/css-styling/sass-example/styles.scss +0 -153
- jac_client/examples/css-styling/sass-example/vite.config.js +0 -27
- jac_client/examples/css-styling/styled-components/.babelrc +0 -9
- jac_client/examples/css-styling/styled-components/README.md +0 -16
- jac_client/examples/css-styling/styled-components/package.json +0 -29
- jac_client/examples/css-styling/styled-components/styled.js +0 -90
- jac_client/examples/css-styling/styled-components/vite.config.js +0 -27
- jac_client/examples/css-styling/tailwind-example/.babelrc +0 -9
- jac_client/examples/css-styling/tailwind-example/README.md +0 -16
- jac_client/examples/css-styling/tailwind-example/global.css +0 -1
- jac_client/examples/css-styling/tailwind-example/package.json +0 -30
- jac_client/examples/css-styling/tailwind-example/vite.config.js +0 -29
- jac_client/examples/full-stack-with-auth/.babelrc +0 -9
- jac_client/examples/full-stack-with-auth/README.md +0 -16
- jac_client/examples/full-stack-with-auth/package.json +0 -28
- jac_client/examples/full-stack-with-auth/vite.config.js +0 -29
- jac_client/examples/little-x/package.json +0 -23
- jac_client/examples/little-x/submit-button.jac +0 -8
- jac_client/examples/nested-folders/nested-advance/.babelrc +0 -9
- jac_client/examples/nested-folders/nested-advance/README.md +0 -77
- jac_client/examples/nested-folders/nested-advance/package.json +0 -29
- jac_client/examples/nested-folders/nested-advance/vite.config.js +0 -28
- jac_client/examples/nested-folders/nested-basic/.babelrc +0 -9
- jac_client/examples/nested-folders/nested-basic/README.md +0 -183
- jac_client/examples/nested-folders/nested-basic/app.js +0 -7
- jac_client/examples/nested-folders/nested-basic/package.json +0 -28
- jac_client/examples/nested-folders/nested-basic/vite.config.js +0 -27
- jac_client/examples/with-router/.babelrc +0 -9
- jac_client/examples/with-router/README.md +0 -17
- jac_client/examples/with-router/package.json +0 -28
- jac_client/examples/with-router/vite.config.js +0 -27
- jac_client/plugin/cli.py +0 -244
- jac_client/plugin/client.py +0 -152
- jac_client/plugin/client_runtime.jac +0 -234
- jac_client/plugin/vite_client_bundle.py +0 -503
- jac_client/tests/fixtures/js_import/utils.js +0 -21
- jac_client/tests/fixtures/package-lock.json +0 -329
- jac_client/tests/fixtures/package.json +0 -11
- jac_client/tests/test_asset_examples.py +0 -322
- jac_client/tests/test_cl.py +0 -530
- jac_client/tests/test_create_jac_app.py +0 -131
- jac_client/tests/test_nested_file.py +0 -374
- jac_client-0.2.2.dist-info/RECORD +0 -171
- jac_client-0.2.2.dist-info/entry_points.txt +0 -4
|
@@ -19,8 +19,8 @@ cl import from "@jac-client/utils" {
|
|
|
19
19
|
|
|
20
20
|
# Backend - Todo Node
|
|
21
21
|
node Todo {
|
|
22
|
-
has text: str
|
|
23
|
-
|
|
22
|
+
has text: str,
|
|
23
|
+
done: bool = False;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
# Backend - Walkers
|
|
@@ -53,9 +53,9 @@ walker toggle_todo {
|
|
|
53
53
|
# Frontend Components
|
|
54
54
|
cl {
|
|
55
55
|
# Navigation
|
|
56
|
-
def Navigation
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
def Navigation -> any {
|
|
57
|
+
isLoggedIn = jacIsLoggedIn();
|
|
58
|
+
navigate = useNavigate();
|
|
59
59
|
|
|
60
60
|
def handleLogout(e: any) -> None {
|
|
61
61
|
e.preventDefault();
|
|
@@ -138,11 +138,11 @@ cl {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
# Login Page
|
|
141
|
-
def LoginPage
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
def LoginPage -> any {
|
|
142
|
+
[username, setUsername] = useState("");
|
|
143
|
+
[password, setPassword] = useState("");
|
|
144
|
+
[error, setError] = useState("");
|
|
145
|
+
navigate = useNavigate();
|
|
146
146
|
|
|
147
147
|
async def handleLogin(e: any) -> None {
|
|
148
148
|
e.preventDefault();
|
|
@@ -167,7 +167,7 @@ cl {
|
|
|
167
167
|
setPassword(e.target.value);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
errorDisplay = None;
|
|
171
171
|
if error {
|
|
172
172
|
errorDisplay = <div
|
|
173
173
|
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "10px"}}
|
|
@@ -264,11 +264,11 @@ cl {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
# Signup Page
|
|
267
|
-
def SignupPage
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
def SignupPage -> any {
|
|
268
|
+
[username, setUsername] = useState("");
|
|
269
|
+
[password, setPassword] = useState("");
|
|
270
|
+
[error, setError] = useState("");
|
|
271
|
+
navigate = useNavigate();
|
|
272
272
|
|
|
273
273
|
async def handleSignup(e: any) -> None {
|
|
274
274
|
e.preventDefault();
|
|
@@ -293,7 +293,7 @@ cl {
|
|
|
293
293
|
setPassword(e.target.value);
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
errorDisplay = None;
|
|
297
297
|
if error {
|
|
298
298
|
errorDisplay = <div
|
|
299
299
|
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "10px"}}
|
|
@@ -391,9 +391,9 @@ cl {
|
|
|
391
391
|
|
|
392
392
|
# TodoInput Component
|
|
393
393
|
def TodoInput(props: any) -> any {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
input = props.input;
|
|
395
|
+
setInput = props.setInput;
|
|
396
|
+
addTodo = props.addTodo;
|
|
397
397
|
|
|
398
398
|
return <div
|
|
399
399
|
style={{"display": "flex", "gap": "8px", "marginBottom": "16px"}}
|
|
@@ -432,8 +432,8 @@ cl {
|
|
|
432
432
|
|
|
433
433
|
# TodoFilters Component
|
|
434
434
|
def TodoFilters(props: any) -> any {
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
filter = props.filter;
|
|
436
|
+
setFilter = props.setFilter;
|
|
437
437
|
|
|
438
438
|
return <div
|
|
439
439
|
style={{"display": "flex", "gap": "8px", "marginBottom": "16px"}}
|
|
@@ -485,9 +485,9 @@ cl {
|
|
|
485
485
|
|
|
486
486
|
# TodoItem Component
|
|
487
487
|
def TodoItem(props: any) -> any {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
todo = props.todo;
|
|
489
|
+
toggleTodo = props.toggleTodo;
|
|
490
|
+
deleteTodo = props.deleteTodo;
|
|
491
491
|
|
|
492
492
|
return <div
|
|
493
493
|
key={todo._jac_id}
|
|
@@ -533,9 +533,9 @@ cl {
|
|
|
533
533
|
|
|
534
534
|
# TodoList Component
|
|
535
535
|
def TodoList(props: any) -> any {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
536
|
+
filteredTodos = props.filteredTodos;
|
|
537
|
+
toggleTodo = props.toggleTodo;
|
|
538
|
+
deleteTodo = props.deleteTodo;
|
|
539
539
|
|
|
540
540
|
if filteredTodos.length == 0 {
|
|
541
541
|
return <div
|
|
@@ -558,19 +558,19 @@ cl {
|
|
|
558
558
|
}
|
|
559
559
|
|
|
560
560
|
# Todos Page (Protected)
|
|
561
|
-
def TodosPage
|
|
561
|
+
def TodosPage -> any {
|
|
562
562
|
# Check if user is logged in, redirect if not
|
|
563
563
|
if not jacIsLoggedIn() {
|
|
564
564
|
return <Navigate to="/login" />;
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
567
|
+
[todos, setTodos] = useState([]);
|
|
568
|
+
[input, setInput] = useState("");
|
|
569
|
+
[filter, setFilter] = useState("all");
|
|
570
570
|
|
|
571
571
|
# Load todos on mount
|
|
572
572
|
useEffect(
|
|
573
|
-
lambda -> None{ async def loadTodos
|
|
573
|
+
lambda -> None{ async def loadTodos -> None {
|
|
574
574
|
result = root spawn read_todos();
|
|
575
575
|
setTodos(result.reports if result.reports else []);
|
|
576
576
|
} loadTodos();} ,
|
|
@@ -578,7 +578,7 @@ cl {
|
|
|
578
578
|
);
|
|
579
579
|
|
|
580
580
|
# Add todo
|
|
581
|
-
async def addTodo
|
|
581
|
+
async def addTodo -> None {
|
|
582
582
|
if not input.trim() {
|
|
583
583
|
return;
|
|
584
584
|
}
|
|
@@ -612,7 +612,7 @@ cl {
|
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
# Filter todos
|
|
615
|
-
def getFilteredTodos
|
|
615
|
+
def getFilteredTodos -> list {
|
|
616
616
|
if filter == "active" {
|
|
617
617
|
return todos.filter(
|
|
618
618
|
lambda todo: any -> bool{ return not todo.done; }
|
|
@@ -677,7 +677,7 @@ cl {
|
|
|
677
677
|
}
|
|
678
678
|
|
|
679
679
|
# Home/Landing Page - auto-redirect
|
|
680
|
-
def HomePage
|
|
680
|
+
def HomePage -> any {
|
|
681
681
|
if jacIsLoggedIn() {
|
|
682
682
|
return <Navigate to="/todos" />;
|
|
683
683
|
}
|
|
@@ -685,7 +685,7 @@ cl {
|
|
|
685
685
|
}
|
|
686
686
|
|
|
687
687
|
# Main App with React Router
|
|
688
|
-
def app
|
|
688
|
+
def:pub app -> any {
|
|
689
689
|
return <Router>
|
|
690
690
|
<div
|
|
691
691
|
style={{"fontFamily": "system-ui, sans-serif"}}
|
|
@@ -34,18 +34,18 @@ node Profile {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
obj TweetInfo {
|
|
37
|
-
has username: str
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
has username: str,
|
|
38
|
+
id: str,
|
|
39
|
+
content: str,
|
|
40
|
+
embedding: list,
|
|
41
|
+
likes: list,
|
|
42
|
+
comments: list;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
node Tweet {
|
|
46
|
-
has content: str
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
has content: str,
|
|
47
|
+
embedding: list,
|
|
48
|
+
created_at: str = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S");
|
|
49
49
|
|
|
50
50
|
can update with update_tweet exit {
|
|
51
51
|
self.content = visitor.updated_content;
|
|
@@ -80,7 +80,7 @@ node Tweet {
|
|
|
80
80
|
report comment_node[0] ;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
def get_info
|
|
83
|
+
def get_info -> TweetInfo {
|
|
84
84
|
return TweetInfo(
|
|
85
85
|
username=[self<-:Post:<-][0].username,
|
|
86
86
|
id=jid(self),
|
|
@@ -188,8 +188,8 @@ walker update_comment {
|
|
|
188
188
|
walker remove_comment {}
|
|
189
189
|
|
|
190
190
|
walker load_feed(visit_profile) {
|
|
191
|
-
has search_query: str = ""
|
|
192
|
-
|
|
191
|
+
has search_query: str = "",
|
|
192
|
+
results: list = [];
|
|
193
193
|
|
|
194
194
|
can load with Profile entry {
|
|
195
195
|
visit [-->(`?Tweet)];
|
|
@@ -206,25 +206,20 @@ walker load_feed(visit_profile) {
|
|
|
206
206
|
# Client-side UI Components (marked with 'cl' for browser execution)
|
|
207
207
|
# ===================================================================
|
|
208
208
|
|
|
209
|
-
# Reactive state management
|
|
210
|
-
cl let [appState, setAppState] = createState(
|
|
211
|
-
{"tweets": [], "loading": False}
|
|
212
|
-
);
|
|
213
|
-
|
|
214
209
|
# Manual routing functions removed - now using reactive createRouter
|
|
215
210
|
|
|
216
211
|
# Shared data model for client/server
|
|
217
212
|
cl obj ClientTweet {
|
|
218
|
-
has username: str = ""
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
213
|
+
has username: str = "",
|
|
214
|
+
id: str = "",
|
|
215
|
+
content: str = "",
|
|
216
|
+
likes: list = [],
|
|
217
|
+
comments: list = [];
|
|
223
218
|
}
|
|
224
219
|
|
|
225
220
|
cl obj ClientProfile {
|
|
226
|
-
has username: str = ""
|
|
227
|
-
|
|
221
|
+
has username: str = "",
|
|
222
|
+
id: str = "";
|
|
228
223
|
}
|
|
229
224
|
|
|
230
225
|
# UI Components - Render a single tweet card
|
|
@@ -307,7 +302,7 @@ cl def FeedView(tweets: list) -> any {
|
|
|
307
302
|
}
|
|
308
303
|
|
|
309
304
|
# Render login form
|
|
310
|
-
cl def LoginForm
|
|
305
|
+
cl def LoginForm -> any {
|
|
311
306
|
suggestions = ['good luck', 'have fun', 'enjoy the ride'];
|
|
312
307
|
randomSuggestion = _.sample(suggestions);
|
|
313
308
|
result = "Good luck with your journey!";
|
|
@@ -421,7 +416,7 @@ cl async def handle_login(event: any) -> None {
|
|
|
421
416
|
}
|
|
422
417
|
|
|
423
418
|
# Render signup form
|
|
424
|
-
cl def SignupForm
|
|
419
|
+
cl def SignupForm -> any {
|
|
425
420
|
return <div
|
|
426
421
|
class="signup-container"
|
|
427
422
|
style={{
|
|
@@ -545,7 +540,7 @@ cl async def handle_signup(event: any) -> None {
|
|
|
545
540
|
alert("Password must be at least 6 characters long.");
|
|
546
541
|
return;
|
|
547
542
|
}
|
|
548
|
-
# Use runtime auth function - no need to know about /user/
|
|
543
|
+
# Use runtime auth function - no need to know about /user/register endpoint!
|
|
549
544
|
result = await jacSignup(username, password);
|
|
550
545
|
if result["success"] if "success" in result else False {
|
|
551
546
|
alert("Account created successfully! Welcome to LittleX!");
|
|
@@ -556,13 +551,13 @@ cl async def handle_signup(event: any) -> None {
|
|
|
556
551
|
}
|
|
557
552
|
|
|
558
553
|
# Handle logout
|
|
559
|
-
cl def logout_action
|
|
554
|
+
cl def logout_action -> None {
|
|
560
555
|
jacLogout();
|
|
561
556
|
navigate("/login");
|
|
562
557
|
}
|
|
563
558
|
|
|
564
559
|
# Main App component with declarative router
|
|
565
|
-
cl def App
|
|
560
|
+
cl def:pub App -> any {
|
|
566
561
|
# Create routes array manually (workaround for JS compiler bug with named args)
|
|
567
562
|
login_route = {
|
|
568
563
|
"path": "/login",
|
|
@@ -665,7 +660,7 @@ cl def build_nav_bar(route: str) -> any {
|
|
|
665
660
|
}
|
|
666
661
|
|
|
667
662
|
# Home view - simplified for testing reactive routing
|
|
668
|
-
cl def HomeView
|
|
663
|
+
cl def HomeView -> any {
|
|
669
664
|
if not jacIsLoggedIn() {
|
|
670
665
|
navigate("/login");
|
|
671
666
|
return <div></div>;
|
|
@@ -687,7 +682,7 @@ cl def HomeView() -> any {
|
|
|
687
682
|
}
|
|
688
683
|
|
|
689
684
|
# Profile view
|
|
690
|
-
cl def ProfileView
|
|
685
|
+
cl def ProfileView -> any {
|
|
691
686
|
if not jacIsLoggedIn() {
|
|
692
687
|
navigate("/login");
|
|
693
688
|
return <div></div>;
|
|
@@ -719,6 +714,6 @@ cl def ProfileView() -> any {
|
|
|
719
714
|
}
|
|
720
715
|
|
|
721
716
|
# Main SPA entry point - simplified with reactive routing
|
|
722
|
-
cl def jac_app
|
|
717
|
+
cl def:pub jac_app -> any {
|
|
723
718
|
return App();
|
|
724
719
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
cl import from .components.button { CustomButton }
|
|
2
2
|
cl import from .button { CustomButtonRoot }
|
|
3
3
|
|
|
4
|
-
cl def RelativeImport
|
|
4
|
+
cl def RelativeImport -> any {
|
|
5
5
|
return <div>
|
|
6
6
|
<CustomButton />
|
|
7
7
|
<CustomButtonRoot />
|
|
8
8
|
</div>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
cl def app
|
|
11
|
+
cl def:pub app -> any {
|
|
12
12
|
return <RelativeImport />;
|
|
13
13
|
}
|
|
@@ -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
|
+
}
|
|
@@ -12,7 +12,7 @@ cl import from "@jac-client/utils" {
|
|
|
12
12
|
|
|
13
13
|
cl {
|
|
14
14
|
# Home Page Component
|
|
15
|
-
def Home
|
|
15
|
+
def Home -> any {
|
|
16
16
|
location = useLocation();
|
|
17
17
|
navigate = useNavigate();
|
|
18
18
|
|
|
@@ -49,7 +49,7 @@ cl {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
# About Page Component
|
|
52
|
-
def About
|
|
52
|
+
def About -> any {
|
|
53
53
|
location = useLocation();
|
|
54
54
|
|
|
55
55
|
return <div>
|
|
@@ -79,7 +79,7 @@ cl {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
# Team Page Component (nested route example)
|
|
82
|
-
def Team
|
|
82
|
+
def Team -> any {
|
|
83
83
|
return <div>
|
|
84
84
|
<h1>
|
|
85
85
|
👥 Our Team
|
|
@@ -94,7 +94,7 @@ cl {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
# User Profile Component (with URL parameters)
|
|
97
|
-
def UserProfile
|
|
97
|
+
def UserProfile -> any {
|
|
98
98
|
params = useParams();
|
|
99
99
|
userId = params.id if params.id else "Unknown";
|
|
100
100
|
|
|
@@ -121,7 +121,7 @@ cl {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
# Contact Page Component
|
|
124
|
-
def Contact
|
|
124
|
+
def Contact -> any {
|
|
125
125
|
[submitted, setSubmitted] = useState(False);
|
|
126
126
|
|
|
127
127
|
def handleSubmit(e: any) -> None {
|
|
@@ -169,8 +169,8 @@ cl {
|
|
|
169
169
|
style={{"margin": "0.5rem 0", "display": "block"}}
|
|
170
170
|
/>
|
|
171
171
|
<input
|
|
172
|
-
type="
|
|
173
|
-
placeholder="Your
|
|
172
|
+
type="text"
|
|
173
|
+
placeholder="Your username"
|
|
174
174
|
style={{"margin": "0.5rem 0", "display": "block"}}
|
|
175
175
|
/>
|
|
176
176
|
<textarea
|
|
@@ -185,7 +185,7 @@ cl {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
# 404 Not Found Component
|
|
188
|
-
def NotFound
|
|
188
|
+
def NotFound -> any {
|
|
189
189
|
location = useLocation();
|
|
190
190
|
navigate = useNavigate();
|
|
191
191
|
|
|
@@ -204,7 +204,7 @@ cl {
|
|
|
204
204
|
<code>
|
|
205
205
|
{location.pathname}
|
|
206
206
|
</code>
|
|
207
|
-
|
|
207
|
+
does not exist.
|
|
208
208
|
</p>
|
|
209
209
|
<button
|
|
210
210
|
onClick={goHome}
|
|
@@ -215,7 +215,7 @@ cl {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
# Navigation Component with active link styling
|
|
218
|
-
def Navigation
|
|
218
|
+
def Navigation -> any {
|
|
219
219
|
location = useLocation();
|
|
220
220
|
|
|
221
221
|
def linkStyle(path: str) -> dict {
|
|
@@ -277,7 +277,7 @@ cl {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
# Main App Component with React Router HashRouter
|
|
280
|
-
def app
|
|
280
|
+
def:pub app -> any {
|
|
281
281
|
return <Router>
|
|
282
282
|
<div
|
|
283
283
|
style={{"fontFamily": "system-ui, -apple-system, sans-serif"}}
|