jac-client 0.2.3__py3-none-any.whl → 0.2.8__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 (224) hide show
  1. jac_client/examples/all-in-one/app.jac +494 -347
  2. jac_client/examples/all-in-one/assets/workers/worker.py +5 -0
  3. jac_client/examples/all-in-one/button.jac +1 -1
  4. jac_client/examples/all-in-one/components/CategoryFilter.jac +35 -0
  5. jac_client/examples/all-in-one/components/Header.jac +13 -0
  6. jac_client/examples/all-in-one/components/ProfitOverview.jac +50 -0
  7. jac_client/examples/all-in-one/components/Summary.jac +53 -0
  8. jac_client/examples/all-in-one/components/TransactionForm.jac +158 -0
  9. jac_client/examples/all-in-one/components/TransactionItem.jac +55 -0
  10. jac_client/examples/all-in-one/components/TransactionList.jac +37 -0
  11. jac_client/examples/all-in-one/components/button.jac +1 -1
  12. jac_client/examples/all-in-one/components/navigation.jac +132 -0
  13. jac_client/examples/all-in-one/constants/categories.jac +37 -0
  14. jac_client/examples/all-in-one/constants/clients.jac +13 -0
  15. jac_client/examples/all-in-one/context/BudgetContext.jac +28 -0
  16. jac_client/examples/all-in-one/hooks/useBudget.jac +116 -0
  17. jac_client/examples/all-in-one/hooks/useLocalStorage.jac +36 -0
  18. jac_client/examples/all-in-one/pages/BudgetPlanner.cl.jac +70 -0
  19. jac_client/examples/all-in-one/pages/BudgetPlanner.jac +126 -0
  20. jac_client/examples/all-in-one/pages/FeaturesTest.cl.jac +552 -0
  21. jac_client/examples/all-in-one/pages/FeaturesTest.jac +126 -0
  22. jac_client/examples/all-in-one/pages/LandingPage.jac +101 -0
  23. jac_client/examples/all-in-one/pages/loginPage.jac +132 -0
  24. jac_client/examples/all-in-one/pages/nestedDemo.jac +61 -0
  25. jac_client/examples/all-in-one/pages/notFound.jac +24 -0
  26. jac_client/examples/all-in-one/pages/signupPage.jac +133 -0
  27. jac_client/examples/all-in-one/utils/formatters.jac +52 -0
  28. jac_client/examples/asset-serving/css-with-image/{app.jac → src/app.jac} +4 -4
  29. jac_client/examples/asset-serving/image-asset/{app.jac → src/app.jac} +4 -4
  30. jac_client/examples/asset-serving/import-alias/{app.jac → src/app.jac} +5 -5
  31. jac_client/examples/basic/{app.jac → src/app.jac} +4 -4
  32. jac_client/examples/basic-auth/src/app.jac +371 -0
  33. jac_client/examples/basic-auth-with-router/{app.jac → src/app.jac} +28 -28
  34. jac_client/examples/basic-full-stack/{app.jac → src/app.jac} +166 -127
  35. jac_client/examples/css-styling/js-styling/{app.jac → src/app.jac} +7 -7
  36. jac_client/examples/css-styling/material-ui/{app.jac → src/app.jac} +6 -6
  37. jac_client/examples/css-styling/pure-css/{app.jac → src/app.jac} +7 -7
  38. jac_client/examples/css-styling/sass-example/{app.jac → src/app.jac} +7 -7
  39. jac_client/examples/css-styling/styled-components/{app.jac → src/app.jac} +6 -6
  40. jac_client/examples/css-styling/tailwind-example/{app.jac → src/app.jac} +7 -7
  41. jac_client/examples/full-stack-with-auth/{app.jac → src/app.jac} +47 -47
  42. jac_client/examples/little-x/{app.jac → src/app.jac} +27 -32
  43. jac_client/examples/little-x/src/submit-button.jac +16 -0
  44. jac_client/examples/nested-folders/nested-advance/{ButtonRoot.jac → src/ButtonRoot.jac} +1 -1
  45. jac_client/examples/nested-folders/nested-advance/{app.jac → src/app.jac} +1 -1
  46. jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/ButtonSecondL.jac +1 -1
  47. jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/Card.jac +1 -1
  48. jac_client/examples/nested-folders/nested-advance/{level1 → src/level1}/level2/ButtonThirdL.jac +1 -1
  49. jac_client/examples/nested-folders/nested-basic/{app.jac → src/app.jac} +2 -2
  50. jac_client/examples/nested-folders/nested-basic/{button.jac → src/button.jac} +1 -1
  51. jac_client/examples/nested-folders/nested-basic/{components → src/components}/button.jac +1 -1
  52. jac_client/examples/ts-support/src/app.jac +35 -0
  53. jac_client/examples/with-router/{app.jac → src/app.jac} +15 -15
  54. jac_client/plugin/cli.jac +504 -0
  55. jac_client/plugin/client.jac +45 -0
  56. jac_client/plugin/client_runtime.cl.jac +42 -0
  57. jac_client/plugin/impl/client.impl.jac +193 -0
  58. jac_client/plugin/impl/client_runtime.impl.jac +195 -0
  59. jac_client/plugin/impl/vite_client_bundle.impl.jac +72 -0
  60. jac_client/plugin/plugin_config.jac +195 -0
  61. jac_client/plugin/src/__init__.jac +20 -0
  62. jac_client/plugin/src/asset_processor.jac +33 -0
  63. jac_client/plugin/src/babel_processor.jac +18 -0
  64. jac_client/plugin/src/compiler.jac +67 -0
  65. jac_client/plugin/src/config_loader.jac +32 -0
  66. jac_client/plugin/src/impl/asset_processor.impl.jac +127 -0
  67. jac_client/plugin/src/impl/babel_processor.impl.jac +89 -0
  68. jac_client/plugin/src/impl/compiler.impl.jac +288 -0
  69. jac_client/plugin/src/impl/config_loader.impl.jac +119 -0
  70. jac_client/plugin/src/impl/import_processor.impl.jac +33 -0
  71. jac_client/plugin/src/impl/jac_to_js.impl.jac +41 -0
  72. jac_client/plugin/src/impl/package_installer.impl.jac +105 -0
  73. jac_client/plugin/src/impl/vite_bundler.impl.jac +626 -0
  74. jac_client/plugin/src/import_processor.jac +19 -0
  75. jac_client/plugin/src/jac_to_js.jac +35 -0
  76. jac_client/plugin/src/package_installer.jac +26 -0
  77. jac_client/plugin/src/vite_bundler.jac +44 -0
  78. jac_client/plugin/vite_client_bundle.jac +31 -0
  79. jac_client/tests/conftest.py +283 -0
  80. jac_client/tests/fixtures/basic-app/app.jac +2 -2
  81. jac_client/tests/fixtures/cl_file/app.cl.jac +2 -2
  82. jac_client/tests/fixtures/client_app_with_antd/app.jac +1 -1
  83. jac_client/tests/fixtures/js_import/app.jac +5 -5
  84. jac_client/tests/fixtures/spawn_test/app.jac +15 -18
  85. jac_client/tests/fixtures/with-ts/app.jac +35 -0
  86. jac_client/tests/test_cli.py +811 -0
  87. jac_client/tests/test_it.py +592 -97
  88. {jac_client-0.2.3.dist-info → jac_client-0.2.8.dist-info}/METADATA +41 -34
  89. jac_client-0.2.8.dist-info/RECORD +97 -0
  90. {jac_client-0.2.3.dist-info → jac_client-0.2.8.dist-info}/WHEEL +2 -1
  91. jac_client-0.2.8.dist-info/entry_points.txt +4 -0
  92. jac_client-0.2.8.dist-info/top_level.txt +1 -0
  93. jac_client/docs/README.md +0 -689
  94. jac_client/docs/advanced-state.md +0 -1265
  95. jac_client/docs/asset-serving/intro.md +0 -209
  96. jac_client/docs/assets/pipe_line-v2.svg +0 -32
  97. jac_client/docs/assets/pipe_line.png +0 -0
  98. jac_client/docs/file-system/app.jac.md +0 -121
  99. jac_client/docs/file-system/backend-frontend.md +0 -217
  100. jac_client/docs/file-system/intro.md +0 -72
  101. jac_client/docs/file-system/nested-imports.md +0 -348
  102. jac_client/docs/guide-example/intro.md +0 -115
  103. jac_client/docs/guide-example/step-01-setup.md +0 -270
  104. jac_client/docs/guide-example/step-02-components.md +0 -416
  105. jac_client/docs/guide-example/step-03-styling.md +0 -478
  106. jac_client/docs/guide-example/step-04-todo-ui.md +0 -477
  107. jac_client/docs/guide-example/step-05-local-state.md +0 -530
  108. jac_client/docs/guide-example/step-06-events.md +0 -749
  109. jac_client/docs/guide-example/step-07-effects.md +0 -468
  110. jac_client/docs/guide-example/step-08-walkers.md +0 -534
  111. jac_client/docs/guide-example/step-09-authentication.md +0 -586
  112. jac_client/docs/guide-example/step-10-routing.md +0 -539
  113. jac_client/docs/guide-example/step-11-final.md +0 -963
  114. jac_client/docs/imports.md +0 -1141
  115. jac_client/docs/lifecycle-hooks.md +0 -773
  116. jac_client/docs/routing.md +0 -659
  117. jac_client/docs/styling/intro.md +0 -249
  118. jac_client/docs/styling/js-styling.md +0 -367
  119. jac_client/docs/styling/material-ui.md +0 -341
  120. jac_client/docs/styling/pure-css.md +0 -299
  121. jac_client/docs/styling/sass.md +0 -403
  122. jac_client/docs/styling/styled-components.md +0 -395
  123. jac_client/docs/styling/tailwind.md +0 -298
  124. jac_client/examples/all-in-one/.babelrc +0 -9
  125. jac_client/examples/all-in-one/README.md +0 -16
  126. jac_client/examples/all-in-one/assets/burger.png +0 -0
  127. jac_client/examples/all-in-one/package.json +0 -29
  128. jac_client/examples/all-in-one/styles.css +0 -26
  129. jac_client/examples/all-in-one/vite.config.js +0 -28
  130. jac_client/examples/asset-serving/css-with-image/.babelrc +0 -9
  131. jac_client/examples/asset-serving/css-with-image/README.md +0 -91
  132. jac_client/examples/asset-serving/css-with-image/assets/burger.png +0 -0
  133. jac_client/examples/asset-serving/css-with-image/package.json +0 -28
  134. jac_client/examples/asset-serving/css-with-image/styles.css +0 -26
  135. jac_client/examples/asset-serving/css-with-image/vite.config.js +0 -28
  136. jac_client/examples/asset-serving/image-asset/.babelrc +0 -9
  137. jac_client/examples/asset-serving/image-asset/README.md +0 -119
  138. jac_client/examples/asset-serving/image-asset/assets/burger.png +0 -0
  139. jac_client/examples/asset-serving/image-asset/package.json +0 -28
  140. jac_client/examples/asset-serving/image-asset/styles.css +0 -26
  141. jac_client/examples/asset-serving/image-asset/vite.config.js +0 -28
  142. jac_client/examples/asset-serving/import-alias/.babelrc +0 -9
  143. jac_client/examples/asset-serving/import-alias/README.md +0 -83
  144. jac_client/examples/asset-serving/import-alias/assets/burger.png +0 -0
  145. jac_client/examples/asset-serving/import-alias/package.json +0 -28
  146. jac_client/examples/asset-serving/import-alias/vite.config.js +0 -28
  147. jac_client/examples/basic/.babelrc +0 -9
  148. jac_client/examples/basic/README.md +0 -16
  149. jac_client/examples/basic/package.json +0 -27
  150. jac_client/examples/basic/vite.config.js +0 -27
  151. jac_client/examples/basic-auth/.babelrc +0 -9
  152. jac_client/examples/basic-auth/README.md +0 -16
  153. jac_client/examples/basic-auth/app.jac +0 -308
  154. jac_client/examples/basic-auth/package.json +0 -27
  155. jac_client/examples/basic-auth/vite.config.js +0 -27
  156. jac_client/examples/basic-auth-with-router/.babelrc +0 -9
  157. jac_client/examples/basic-auth-with-router/README.md +0 -60
  158. jac_client/examples/basic-auth-with-router/package.json +0 -28
  159. jac_client/examples/basic-auth-with-router/vite.config.js +0 -27
  160. jac_client/examples/basic-full-stack/.babelrc +0 -9
  161. jac_client/examples/basic-full-stack/README.md +0 -18
  162. jac_client/examples/basic-full-stack/package.json +0 -28
  163. jac_client/examples/basic-full-stack/vite.config.js +0 -27
  164. jac_client/examples/css-styling/js-styling/.babelrc +0 -9
  165. jac_client/examples/css-styling/js-styling/README.md +0 -183
  166. jac_client/examples/css-styling/js-styling/package.json +0 -28
  167. jac_client/examples/css-styling/js-styling/styles.js +0 -100
  168. jac_client/examples/css-styling/js-styling/vite.config.js +0 -27
  169. jac_client/examples/css-styling/material-ui/.babelrc +0 -9
  170. jac_client/examples/css-styling/material-ui/README.md +0 -16
  171. jac_client/examples/css-styling/material-ui/package.json +0 -32
  172. jac_client/examples/css-styling/material-ui/vite.config.js +0 -27
  173. jac_client/examples/css-styling/pure-css/.babelrc +0 -9
  174. jac_client/examples/css-styling/pure-css/README.md +0 -16
  175. jac_client/examples/css-styling/pure-css/package.json +0 -28
  176. jac_client/examples/css-styling/pure-css/styles.css +0 -111
  177. jac_client/examples/css-styling/pure-css/vite.config.js +0 -27
  178. jac_client/examples/css-styling/sass-example/.babelrc +0 -9
  179. jac_client/examples/css-styling/sass-example/README.md +0 -16
  180. jac_client/examples/css-styling/sass-example/package.json +0 -29
  181. jac_client/examples/css-styling/sass-example/styles.scss +0 -153
  182. jac_client/examples/css-styling/sass-example/vite.config.js +0 -27
  183. jac_client/examples/css-styling/styled-components/.babelrc +0 -9
  184. jac_client/examples/css-styling/styled-components/README.md +0 -16
  185. jac_client/examples/css-styling/styled-components/package.json +0 -29
  186. jac_client/examples/css-styling/styled-components/styled.js +0 -90
  187. jac_client/examples/css-styling/styled-components/vite.config.js +0 -27
  188. jac_client/examples/css-styling/tailwind-example/.babelrc +0 -9
  189. jac_client/examples/css-styling/tailwind-example/README.md +0 -16
  190. jac_client/examples/css-styling/tailwind-example/global.css +0 -1
  191. jac_client/examples/css-styling/tailwind-example/package.json +0 -30
  192. jac_client/examples/css-styling/tailwind-example/vite.config.js +0 -29
  193. jac_client/examples/full-stack-with-auth/.babelrc +0 -9
  194. jac_client/examples/full-stack-with-auth/README.md +0 -16
  195. jac_client/examples/full-stack-with-auth/package.json +0 -28
  196. jac_client/examples/full-stack-with-auth/vite.config.js +0 -29
  197. jac_client/examples/little-x/package.json +0 -23
  198. jac_client/examples/little-x/submit-button.jac +0 -8
  199. jac_client/examples/nested-folders/nested-advance/.babelrc +0 -9
  200. jac_client/examples/nested-folders/nested-advance/README.md +0 -77
  201. jac_client/examples/nested-folders/nested-advance/package.json +0 -29
  202. jac_client/examples/nested-folders/nested-advance/vite.config.js +0 -28
  203. jac_client/examples/nested-folders/nested-basic/.babelrc +0 -9
  204. jac_client/examples/nested-folders/nested-basic/README.md +0 -183
  205. jac_client/examples/nested-folders/nested-basic/app.js +0 -7
  206. jac_client/examples/nested-folders/nested-basic/package.json +0 -28
  207. jac_client/examples/nested-folders/nested-basic/vite.config.js +0 -27
  208. jac_client/examples/with-router/.babelrc +0 -9
  209. jac_client/examples/with-router/README.md +0 -17
  210. jac_client/examples/with-router/package.json +0 -28
  211. jac_client/examples/with-router/vite.config.js +0 -27
  212. jac_client/plugin/cli.py +0 -244
  213. jac_client/plugin/client.py +0 -152
  214. jac_client/plugin/client_runtime.jac +0 -234
  215. jac_client/plugin/vite_client_bundle.py +0 -503
  216. jac_client/tests/fixtures/js_import/utils.js +0 -21
  217. jac_client/tests/fixtures/package-lock.json +0 -329
  218. jac_client/tests/fixtures/package.json +0 -11
  219. jac_client/tests/test_asset_examples.py +0 -322
  220. jac_client/tests/test_cl.py +0 -530
  221. jac_client/tests/test_create_jac_app.py +0 -131
  222. jac_client/tests/test_nested_file.py +0 -374
  223. jac_client-0.2.3.dist-info/RECORD +0 -171
  224. jac_client-0.2.3.dist-info/entry_points.txt +0 -4
@@ -1,67 +1,69 @@
1
1
  # Todo App
2
- cl import from react {useState, useEffect}
2
+ cl import from react { useEffect }
3
3
 
4
4
  node Todo {
5
- has text: str;
6
- has done: bool = False;
5
+ has text: str,
6
+ done: bool = False;
7
7
  }
8
8
 
9
9
  walker create_todo {
10
- has text:str;
10
+ has text: str;
11
+
11
12
  can create with `root entry {
12
- new_todo = here ++> Todo(text= self.text);
13
- report new_todo;
13
+ new_todo = here ++> Todo(text=self.text);
14
+ report new_todo ;
14
15
  }
15
16
  }
17
+
16
18
  walker toggle_todo {
17
19
  can toggle with Todo entry {
18
20
  here.done = not here.done;
19
- report here;
21
+ report here ;
20
22
  }
21
23
  }
24
+
22
25
  walker read_todos {
23
26
  can read with `root entry {
24
27
  visit [-->(`?Todo)];
25
28
  }
29
+
26
30
  can report_todos with exit {
27
- report here;
31
+ report here ;
28
32
  }
29
33
  }
30
34
 
31
35
  cl {
32
- def app() -> any {
33
- let [todos, setTodos] = useState([]);
34
- let [inputValue, setInputValue] = useState("");
35
- let [filter, setFilter] = useState("all");
36
+ def:pub app -> any {
37
+ has todos: list = [];
38
+ has inputValue: str = "";
39
+ has filter: str = "all";
36
40
 
37
- useEffect(lambda -> None {
38
- async def loadTodos() -> None {
39
- todos = root spawn read_todos();
40
- setTodos(todos.reports);
41
- }
42
- loadTodos();
43
- }, []);
41
+ useEffect(
42
+ lambda -> None{ async def loadTodos -> None {
43
+ result = root spawn read_todos();
44
+ todos = result.reports;
45
+ } loadTodos();} ,
46
+ []
47
+ );
44
48
 
45
49
  # Add a new todo
46
- async def addTodo() -> None {
47
- if not inputValue.trim() { return; }
48
- newTodo = {
49
- "id": Date.now(),
50
- "text": inputValue.trim(),
51
- "done": False
52
- };
50
+ async def addTodo -> None {
51
+ if not inputValue.trim() {
52
+ return;
53
+ }
54
+ newTodo = {"id": Date.now(), "text": inputValue.trim(), "done": False};
53
55
  response = root spawn create_todo(text=inputValue.trim());
54
56
  newTodos = todos.concat([response.reports[0][0]]);
55
- setTodos(newTodos);
56
- setInputValue("");
57
+ todos = newTodos;
58
+ inputValue = "";
57
59
  }
58
60
 
59
61
  # Toggle todo completion status
60
62
  async def toggleTodo(id: any) -> None {
61
63
  console.log("toggleTodo", id);
62
64
  id spawn toggle_todo();
63
- setTodos(todos.map(lambda todo: any -> any {
64
- if todo._jac_id == id {
65
+ todos = todos.map(
66
+ lambda todo: any -> any{ if todo._jac_id == id {
65
67
  updatedTodo = {
66
68
  "_jac_id": todo._jac_id,
67
69
  "text": todo.text,
@@ -69,70 +71,79 @@ cl {
69
71
  "id": todo.id
70
72
  };
71
73
  return updatedTodo;
72
- }
73
- return todo;
74
- }));
74
+ }return todo; }
75
+ );
75
76
  }
76
77
 
77
78
  # Delete a todo
78
79
  def deleteTodo(id: any) -> None {
79
- setTodos(todos.filter(lambda todo: any -> bool { return todo.id != id; }));
80
+ todos = todos.filter(lambda todo: any -> bool{ return todo.id != id; } );
80
81
  }
81
82
 
82
83
  # Clear all completed todos
83
- def clearCompleted() -> None {
84
- setTodos(todos.filter(lambda todo: any -> bool { return not todo.done; }));
84
+ def clearCompleted -> None {
85
+ todos = todos.filter(lambda todo: any -> bool{ return not todo.done; } );
85
86
  }
86
87
 
87
88
  # Filter todos based on current filter
88
- def getFilteredTodos() -> list {
89
+ def getFilteredTodos -> list {
89
90
  if filter == "active" {
90
- return todos.filter(lambda todo: any -> bool { return not todo.done; });
91
+ return todos.filter(
92
+ lambda todo: any -> bool{ return not todo.done; }
93
+ );
91
94
  } elif filter == "completed" {
92
- return todos.filter(lambda todo: any -> bool { return todo.done; });
95
+ return todos.filter(lambda todo: any -> bool{ return todo.done; } );
93
96
  }
94
97
  return todos;
95
98
  }
96
99
 
97
100
  # Count active todos
98
- activeCount = todos.filter(lambda todo: any -> bool { return not todo.done; }).length;
101
+ activeCount = todos.filter(
102
+ lambda todo: any -> bool{ return not todo.done; }
103
+ ).length;
99
104
 
100
105
  filteredTodos = getFilteredTodos();
101
106
 
102
-
103
- return <div style={{
104
- "maxWidth": "600px",
105
- "margin": "40px auto",
106
- "padding": "24px",
107
- "fontFamily": "system-ui, -apple-system, sans-serif",
108
- "background": "#f9fafb",
109
- "minHeight": "100vh"
110
- }}>
111
- <h1 style={{
112
- "textAlign": "center",
113
- "color": "#1f2937",
114
- "marginBottom": "32px",
115
- "fontSize": "2.5rem",
116
- "fontWeight": "700"
117
- }}>📝 My Todo App</h1>
118
-
107
+ return <div
108
+ style={{
109
+ "maxWidth": "600px",
110
+ "margin": "40px auto",
111
+ "padding": "24px",
112
+ "fontFamily": "system-ui, -apple-system, sans-serif",
113
+ "background": "#f9fafb",
114
+ "minHeight": "100vh"
115
+ }}
116
+ >
117
+ <h1
118
+ style={{
119
+ "textAlign": "center",
120
+ "color": "#1f2937",
121
+ "marginBottom": "32px",
122
+ "fontSize": "2.5rem",
123
+ "fontWeight": "700"
124
+ }}
125
+ >
126
+ 📝 My Todo App
127
+ </h1>
119
128
  # Add todo form
120
- <div style={{
121
- "display": "flex",
122
- "gap": "8px",
123
- "marginBottom": "24px",
124
- "background": "#ffffff",
125
- "padding": "16px",
126
- "borderRadius": "12px",
127
- "boxShadow": "0 1px 3px rgba(0,0,0,0.1)"
128
- }}>
129
+ <div
130
+ style={{
131
+ "display": "flex",
132
+ "gap": "8px",
133
+ "marginBottom": "24px",
134
+ "background": "#ffffff",
135
+ "padding": "16px",
136
+ "borderRadius": "12px",
137
+ "boxShadow": "0 1px 3px rgba(0,0,0,0.1)"
138
+ }}
139
+ >
129
140
  <input
130
141
  type="text"
131
142
  value={inputValue}
132
- onChange={lambda e: any -> None { setInputValue(e.target.value); }}
133
- onKeyPress={lambda e: any -> None {
134
- if e.key == "Enter" { addTodo(); }
135
- }}
143
+ onChange={lambda e: any -> None{ inputValue = e.target.value;} }
144
+ onKeyPress={lambda e: any -> None{ if e.key == "Enter" {
145
+ addTodo();
146
+ }} }
136
147
  placeholder="What needs to be done?"
137
148
  style={{
138
149
  "flex": "1",
@@ -160,16 +171,17 @@ cl {
160
171
  Add
161
172
  </button>
162
173
  </div>
163
-
164
174
  # Filter buttons
165
- <div style={{
166
- "display": "flex",
167
- "gap": "8px",
168
- "marginBottom": "24px",
169
- "justifyContent": "center"
170
- }}>
175
+ <div
176
+ style={{
177
+ "display": "flex",
178
+ "gap": "8px",
179
+ "marginBottom": "24px",
180
+ "justifyContent": "center"
181
+ }}
182
+ >
171
183
  <button
172
- onClick={lambda -> None { setFilter("all"); }}
184
+ onClick={lambda -> None{ filter = "all";} }
173
185
  style={{
174
186
  "padding": "8px 16px",
175
187
  "background": ("#3b82f6" if filter == "all" else "#ffffff"),
@@ -184,7 +196,7 @@ cl {
184
196
  All
185
197
  </button>
186
198
  <button
187
- onClick={lambda -> None { setFilter("active"); }}
199
+ onClick={lambda -> None{ filter = "active";} }
188
200
  style={{
189
201
  "padding": "8px 16px",
190
202
  "background": ("#3b82f6" if filter == "active" else "#ffffff"),
@@ -199,10 +211,12 @@ cl {
199
211
  Active
200
212
  </button>
201
213
  <button
202
- onClick={lambda -> None { setFilter("completed"); }}
214
+ onClick={lambda -> None{ filter = "completed";} }
203
215
  style={{
204
216
  "padding": "8px 16px",
205
- "background": ("#3b82f6" if filter == "completed" else "#ffffff"),
217
+ "background": (
218
+ "#3b82f6" if filter == "completed" else "#ffffff"
219
+ ),
206
220
  "color": ("#ffffff" if filter == "completed" else "#3b82f6"),
207
221
  "border": "1px solid #3b82f6",
208
222
  "borderRadius": "6px",
@@ -214,25 +228,38 @@ cl {
214
228
  Completed
215
229
  </button>
216
230
  </div>
217
-
218
231
  # Todo list
219
- <div style={{
220
- "background": "#ffffff",
221
- "borderRadius": "12px",
222
- "boxShadow": "0 1px 3px rgba(0,0,0,0.1)",
223
- "overflow": "hidden"
224
- }}>
225
- {(<div style={{
226
- "padding": "40px",
227
- "textAlign": "center",
228
- "color": "#9ca3af"
229
- }}>
230
- {("No todos yet. Add one above!" if filter == "all" else
231
- ("No active todos!" if filter == "active" else
232
- "No completed todos!"))}
233
- </div>) if filteredTodos.length == 0 else (
234
- filteredTodos.map(lambda todo: any -> any {
235
- return <div
232
+ <div
233
+ style={{
234
+ "background": "#ffffff",
235
+ "borderRadius": "12px",
236
+ "boxShadow": "0 1px 3px rgba(0,0,0,0.1)",
237
+ "overflow": "hidden"
238
+ }}
239
+ >
240
+ {(
241
+ <div
242
+ style={{
243
+ "padding": "40px",
244
+ "textAlign": "center",
245
+ "color": "#9ca3af"
246
+ }}
247
+ >
248
+ {(
249
+ "No todos yet. Add one above!"
250
+ if filter == "all"
251
+ else (
252
+ "No active todos!"
253
+ if filter == "active"
254
+ else "No completed todos!"
255
+ )
256
+ )}
257
+ </div>
258
+ )
259
+ if filteredTodos.length == 0
260
+ else (
261
+ filteredTodos.map(
262
+ lambda todo: any -> any{ return <div
236
263
  key={todo._jac_id}
237
264
  style={{
238
265
  "display": "flex",
@@ -246,23 +273,27 @@ cl {
246
273
  <input
247
274
  type="checkbox"
248
275
  checked={todo.done}
249
- onChange={lambda -> None { toggleTodo(todo._jac_id); }}
276
+ onChange={lambda -> None{ toggleTodo(todo._jac_id);} }
250
277
  style={{
251
278
  "width": "20px",
252
279
  "height": "20px",
253
280
  "cursor": "pointer"
254
281
  }}
255
282
  />
256
- <span style={{
257
- "flex": "1",
258
- "textDecoration": ("line-through" if todo.done else "none"),
259
- "color": ("#9ca3af" if todo.done else "#1f2937"),
260
- "fontSize": "16px"
261
- }}>
283
+ <span
284
+ style={{
285
+ "flex": "1",
286
+ "textDecoration": (
287
+ "line-through" if todo.done else "none"
288
+ ),
289
+ "color": ("#9ca3af" if todo.done else "#1f2937"),
290
+ "fontSize": "16px"
291
+ }}
292
+ >
262
293
  {todo.text}
263
294
  </span>
264
295
  <button
265
- onClick={lambda -> None { deleteTodo(todo.__jac_id); }}
296
+ onClick={lambda -> None{ deleteTodo(todo.__jac_id);} }
266
297
  style={{
267
298
  "padding": "6px 12px",
268
299
  "background": "#ef4444",
@@ -277,29 +308,31 @@ cl {
277
308
  >
278
309
  Delete
279
310
  </button>
280
- </div>;
281
- })
311
+ </div>; }
312
+ )
282
313
  )}
283
314
  </div>
284
-
285
315
  # Stats and clear completed button
286
- {(<div style={{
287
- "display": "flex",
288
- "justifyContent": "space-between",
289
- "alignItems": "center",
290
- "marginTop": "24px",
291
- "padding": "16px",
292
- "background": "#ffffff",
293
- "borderRadius": "12px",
294
- "boxShadow": "0 1px 3px rgba(0,0,0,0.1)"
295
- }}>
296
- <span style={{
297
- "color": "#6b7280",
298
- "fontSize": "14px"
299
- }}>
316
+ {(
317
+ <div
318
+ style={{
319
+ "display": "flex",
320
+ "justifyContent": "space-between",
321
+ "alignItems": "center",
322
+ "marginTop": "24px",
323
+ "padding": "16px",
324
+ "background": "#ffffff",
325
+ "borderRadius": "12px",
326
+ "boxShadow": "0 1px 3px rgba(0,0,0,0.1)"
327
+ }}
328
+ >
329
+ <span
330
+ style={{"color": "#6b7280", "fontSize": "14px"}}
331
+ >
300
332
  {activeCount} {"item" if activeCount == 1 else "items"} left
301
333
  </span>
302
- {(<button
334
+ {(
335
+ <button
303
336
  onClick={clearCompleted}
304
337
  style={{
305
338
  "padding": "8px 16px",
@@ -313,8 +346,14 @@ cl {
313
346
  }}
314
347
  >
315
348
  Clear Completed
316
- </button>) if todos.some(lambda todo: any -> bool { return todo.done; }) else None}
317
- </div>) if todos.length > 0 else None}
349
+ </button>
350
+ )
351
+ if todos.some(lambda todo: any -> bool{ return todo.done; } )
352
+ else None}
353
+ </div>
354
+ )
355
+ if todos.length > 0
356
+ else None}
318
357
  </div>;
319
358
  }
320
359
  }
@@ -1,20 +1,20 @@
1
1
  # Pages
2
- cl import from react { useState, useEffect }
2
+ cl import from react { useEffect }
3
3
  cl import from .styles { default as styles }
4
4
 
5
5
  cl {
6
- def app() -> any {
7
- let [count, setCount] = useState(0);
6
+ def:pub app -> any {
7
+ has count: int = 0;
8
8
 
9
9
  useEffect(lambda -> None{ console.log("Count changed: ", count);} , [count]);
10
10
 
11
- let handleIncrement = lambda e: any -> None{ setCount(count + 1);} ;
11
+ handleIncrement = lambda e: any -> None{ count = count + 1;} ;
12
12
 
13
- let handleDecrement = lambda e: any -> None{ setCount(count - 1);} ;
13
+ handleDecrement = lambda e: any -> None{ count = count - 1;} ;
14
14
 
15
- let handleReset = lambda e: any -> None{ setCount(0);} ;
15
+ handleReset = lambda e: any -> None{ count = 0;} ;
16
16
 
17
- let countStyle = styles.countDisplayZero
17
+ countStyle = styles.countDisplayZero
18
18
  if count == 0
19
19
  else (
20
20
  styles.countDisplayPositive if count > 0 else styles.countDisplayNegative
@@ -1,4 +1,4 @@
1
- cl import from react { useState, useEffect }
1
+ cl import from react { useEffect }
2
2
  cl import from '@mui/material/Button' { default as Button }
3
3
  cl import from '@mui/material/Card' { default as Card }
4
4
  cl import from '@mui/material/CardContent' { default as CardContent }
@@ -12,16 +12,16 @@ cl import from '@mui/icons-material/Remove' { default as RemoveIcon }
12
12
  cl import from '@mui/icons-material/Refresh' { default as RefreshIcon }
13
13
 
14
14
  cl {
15
- def app() -> any {
16
- let [count, setCount] = useState(0);
15
+ def:pub app -> any {
16
+ has count: int = 0;
17
17
 
18
18
  useEffect(lambda -> None{ console.log("Count changed: ", count);} , [count]);
19
19
 
20
- let handleIncrement = lambda e: any -> None{ setCount(count + 1);} ;
20
+ handleIncrement = lambda e: any -> None{ count = count + 1;} ;
21
21
 
22
- let handleDecrement = lambda e: any -> None{ setCount(count - 1);} ;
22
+ handleDecrement = lambda e: any -> None{ count = count - 1;} ;
23
23
 
24
- let handleReset = lambda e: any -> None{ setCount(0);} ;
24
+ handleReset = lambda e: any -> None{ count = 0;} ;
25
25
 
26
26
  return <Box
27
27
  sx={{
@@ -1,20 +1,20 @@
1
1
  # Pages
2
- cl import from react { useState, useEffect }
2
+ cl import from react { useEffect }
3
3
  cl import ".styles.css";
4
4
 
5
5
  cl {
6
- def app() -> any {
7
- let [count, setCount] = useState(0);
6
+ def:pub app -> any {
7
+ has count: int = 0;
8
8
 
9
9
  useEffect(lambda -> None{ console.log("Count changed: ", count);} , [count]);
10
10
 
11
- let handleIncrement = lambda e: any -> None{ setCount(count + 1);} ;
11
+ handleIncrement = lambda e: any -> None{ count = count + 1;} ;
12
12
 
13
- let handleDecrement = lambda e: any -> None{ setCount(count - 1);} ;
13
+ handleDecrement = lambda e: any -> None{ count = count - 1;} ;
14
14
 
15
- let handleReset = lambda e: any -> None{ setCount(0);} ;
15
+ handleReset = lambda e: any -> None{ count = 0;} ;
16
16
 
17
- let countClass = "countDisplay " + (
17
+ countClass = "countDisplay " + (
18
18
  "positive" if count > 0 else "negative" if count < 0 else "zero"
19
19
  );
20
20
 
@@ -1,20 +1,20 @@
1
1
  # Pages
2
- cl import from react { useState, useEffect }
2
+ cl import from react { useEffect }
3
3
  cl import ".styles.scss";
4
4
 
5
5
  cl {
6
- def app() -> any {
7
- let [count, setCount] = useState(0);
6
+ def:pub app -> any {
7
+ has count: int = 0;
8
8
 
9
9
  useEffect(lambda -> None{ console.log("Count changed: ", count);} , [count]);
10
10
 
11
- let handleIncrement = lambda e: any -> None{ setCount(count + 1);} ;
11
+ handleIncrement = lambda e: any -> None{ count = count + 1;} ;
12
12
 
13
- let handleDecrement = lambda e: any -> None{ setCount(count - 1);} ;
13
+ handleDecrement = lambda e: any -> None{ count = count - 1;} ;
14
14
 
15
- let handleReset = lambda e: any -> None{ setCount(0);} ;
15
+ handleReset = lambda e: any -> None{ count = 0;} ;
16
16
 
17
- let countClass = "countDisplay " + (
17
+ countClass = "countDisplay " + (
18
18
  "positive" if count > 0 else "negative" if count < 0 else "zero"
19
19
  );
20
20
 
@@ -1,5 +1,5 @@
1
1
  # Pages
2
- cl import from react { useState, useEffect }
2
+ cl import from react { useEffect }
3
3
  cl import from .styled {
4
4
  Container,
5
5
  Card,
@@ -14,16 +14,16 @@ cl import from .styled {
14
14
  }
15
15
 
16
16
  cl {
17
- def app() -> any {
18
- let [count, setCount] = useState(0);
17
+ def:pub app -> any {
18
+ has count: int = 0;
19
19
 
20
20
  useEffect(lambda -> None{ console.log("Count changed: ", count);} , [count]);
21
21
 
22
- let handleIncrement = lambda e: any -> None{ setCount(count + 1);} ;
22
+ handleIncrement = lambda e: any -> None{ count = count + 1;} ;
23
23
 
24
- let handleDecrement = lambda e: any -> None{ setCount(count - 1);} ;
24
+ handleDecrement = lambda e: any -> None{ count = count - 1;} ;
25
25
 
26
- let handleReset = lambda e: any -> None{ setCount(0);} ;
26
+ handleReset = lambda e: any -> None{ count = 0;} ;
27
27
 
28
28
  return <Container>
29
29
  <Card>
@@ -1,19 +1,19 @@
1
1
  # Pages
2
- cl import from react { useState, useEffect }
2
+ cl import from react { useEffect }
3
3
  cl import ".global.css";
4
4
  cl {
5
- def app() -> any {
6
- let [count, setCount] = useState(0);
5
+ def:pub app -> any {
6
+ has count: int = 0;
7
7
 
8
8
  useEffect(lambda -> None{ console.log("Count changed: ", count);} , [count]);
9
9
 
10
- let handleIncrement = lambda e: any -> None{ setCount(count + 1);} ;
10
+ handleIncrement = lambda e: any -> None{ count = count + 1;} ;
11
11
 
12
- let handleDecrement = lambda e: any -> None{ setCount(count - 1);} ;
12
+ handleDecrement = lambda e: any -> None{ count = count - 1;} ;
13
13
 
14
- let handleReset = lambda e: any -> None{ setCount(0);} ;
14
+ handleReset = lambda e: any -> None{ count = 0;} ;
15
15
 
16
- let countColorClass = "text-gray-800"
16
+ countColorClass = "text-gray-800"
17
17
  if count == 0
18
18
  else ("text-green-600" if count > 0 else "text-red-600");
19
19