jac-client 0.2.8__py3-none-any.whl → 0.2.11__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/button.jac +4 -3
- jac_client/examples/all-in-one/components/CategoryFilter.jac +36 -24
- jac_client/examples/all-in-one/components/Header.jac +12 -8
- jac_client/examples/all-in-one/components/ProfitOverview.jac +49 -35
- jac_client/examples/all-in-one/components/Summary.jac +59 -36
- jac_client/examples/all-in-one/components/TransactionForm.jac +142 -112
- jac_client/examples/all-in-one/components/TransactionItem.jac +37 -30
- jac_client/examples/all-in-one/components/TransactionList.jac +33 -26
- jac_client/examples/all-in-one/components/button.jac +4 -3
- jac_client/examples/all-in-one/components/navigation.jac +111 -117
- jac_client/examples/all-in-one/constants/categories.jac +23 -24
- jac_client/examples/all-in-one/constants/clients.jac +7 -8
- jac_client/examples/all-in-one/context/BudgetContext.jac +9 -6
- jac_client/examples/all-in-one/hooks/useBudget.jac +18 -12
- jac_client/examples/all-in-one/hooks/useLocalStorage.jac +14 -13
- jac_client/examples/all-in-one/main.jac +542 -0
- jac_client/examples/all-in-one/pages/BudgetPlanner.jac +26 -12
- jac_client/examples/all-in-one/pages/FeaturesTest.jac +43 -12
- jac_client/examples/all-in-one/pages/LandingPage.jac +113 -90
- jac_client/examples/all-in-one/pages/budget_planner_ui.cl.jac +65 -0
- jac_client/examples/all-in-one/pages/features_test_ui.cl.jac +675 -0
- jac_client/examples/all-in-one/pages/loginPage.jac +114 -119
- jac_client/examples/all-in-one/pages/nestedDemo.jac +44 -51
- jac_client/examples/all-in-one/pages/notFound.jac +15 -21
- jac_client/examples/all-in-one/pages/signupPage.jac +113 -119
- jac_client/examples/all-in-one/utils/formatters.jac +5 -8
- jac_client/examples/asset-serving/css-with-image/main.jac +92 -0
- jac_client/examples/asset-serving/image-asset/main.jac +56 -0
- jac_client/examples/asset-serving/import-alias/main.jac +109 -0
- jac_client/examples/basic/main.jac +23 -0
- jac_client/examples/basic-auth/main.jac +363 -0
- jac_client/examples/basic-auth-with-router/main.jac +451 -0
- jac_client/examples/basic-full-stack/main.jac +362 -0
- jac_client/examples/css-styling/js-styling/main.jac +63 -0
- jac_client/examples/css-styling/material-ui/main.jac +122 -0
- jac_client/examples/css-styling/pure-css/main.jac +55 -0
- jac_client/examples/css-styling/sass-example/main.jac +55 -0
- jac_client/examples/css-styling/styled-components/main.jac +62 -0
- jac_client/examples/css-styling/tailwind-example/main.jac +74 -0
- jac_client/examples/full-stack-with-auth/main.jac +696 -0
- jac_client/examples/little-x/main.jac +681 -0
- jac_client/examples/little-x/src/submit-button.jac +15 -14
- jac_client/examples/nested-folders/nested-advance/main.jac +26 -0
- jac_client/examples/nested-folders/nested-advance/src/ButtonRoot.jac +4 -6
- jac_client/examples/nested-folders/nested-advance/src/level1/ButtonSecondL.jac +9 -13
- jac_client/examples/nested-folders/nested-advance/src/level1/Card.jac +29 -32
- jac_client/examples/nested-folders/nested-advance/src/level1/level2/ButtonThirdL.jac +12 -18
- jac_client/examples/nested-folders/nested-basic/{src/app.jac → main.jac} +7 -5
- jac_client/examples/nested-folders/nested-basic/src/button.jac +4 -3
- jac_client/examples/nested-folders/nested-basic/src/components/button.jac +4 -3
- jac_client/examples/ts-support/main.jac +35 -0
- jac_client/examples/with-router/main.jac +286 -0
- jac_client/plugin/cli.jac +491 -411
- jac_client/plugin/client.jac +25 -0
- jac_client/plugin/client_runtime.cl.jac +10 -4
- jac_client/plugin/impl/client.impl.jac +96 -55
- jac_client/plugin/impl/client_runtime.impl.jac +155 -1
- jac_client/plugin/plugin_config.jac +211 -29
- jac_client/plugin/src/__init__.jac +0 -2
- jac_client/plugin/src/compiler.jac +0 -1
- jac_client/plugin/src/config_loader.jac +1 -0
- jac_client/plugin/src/desktop_config.jac +31 -0
- jac_client/plugin/src/impl/compiler.impl.jac +49 -17
- jac_client/plugin/src/impl/config_loader.impl.jac +8 -0
- jac_client/plugin/src/impl/desktop_config.impl.jac +191 -0
- jac_client/plugin/src/impl/jac_to_js.impl.jac +5 -1
- jac_client/plugin/src/impl/package_installer.impl.jac +20 -20
- jac_client/plugin/src/impl/vite_bundler.impl.jac +191 -64
- jac_client/plugin/src/targets/desktop/sidecar/main.py +144 -0
- jac_client/plugin/src/targets/desktop_target.jac +37 -0
- jac_client/plugin/src/targets/impl/desktop_target.impl.jac +2347 -0
- jac_client/plugin/src/targets/impl/registry.impl.jac +64 -0
- jac_client/plugin/src/targets/impl/web_target.impl.jac +157 -0
- jac_client/plugin/src/targets/register.jac +21 -0
- jac_client/plugin/src/targets/registry.jac +87 -0
- jac_client/plugin/src/targets/web_target.jac +35 -0
- jac_client/plugin/src/vite_bundler.jac +6 -0
- jac_client/plugin/utils/__init__.jac +3 -0
- jac_client/plugin/utils/bun_installer.jac +16 -0
- jac_client/plugin/utils/impl/bun_installer.impl.jac +99 -0
- jac_client/templates/client.jacpack +72 -0
- jac_client/templates/fullstack.jacpack +61 -0
- jac_client/tests/conftest.py +103 -47
- jac_client/tests/fixtures/spawn_test/app.jac +49 -52
- jac_client/tests/fixtures/with-ts/app.jac +27 -27
- jac_client/tests/test_cli.py +182 -71
- jac_client/tests/test_e2e.py +232 -0
- jac_client/tests/test_helpers.py +58 -0
- jac_client/tests/test_it.py +91 -135
- jac_client/tests/test_it_desktop.py +891 -0
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/METADATA +6 -6
- jac_client-0.2.11.dist-info/RECORD +113 -0
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/WHEEL +1 -1
- jac_client/examples/all-in-one/app.jac +0 -573
- jac_client/examples/all-in-one/pages/BudgetPlanner.cl.jac +0 -70
- jac_client/examples/all-in-one/pages/FeaturesTest.cl.jac +0 -552
- jac_client/examples/asset-serving/css-with-image/src/app.jac +0 -88
- jac_client/examples/asset-serving/image-asset/src/app.jac +0 -55
- jac_client/examples/asset-serving/import-alias/src/app.jac +0 -111
- jac_client/examples/basic/src/app.jac +0 -21
- jac_client/examples/basic-auth/src/app.jac +0 -371
- jac_client/examples/basic-auth-with-router/src/app.jac +0 -464
- jac_client/examples/basic-full-stack/src/app.jac +0 -359
- jac_client/examples/css-styling/js-styling/src/app.jac +0 -84
- jac_client/examples/css-styling/material-ui/src/app.jac +0 -122
- jac_client/examples/css-styling/pure-css/src/app.jac +0 -64
- jac_client/examples/css-styling/sass-example/src/app.jac +0 -64
- jac_client/examples/css-styling/styled-components/src/app.jac +0 -71
- jac_client/examples/css-styling/tailwind-example/src/app.jac +0 -63
- jac_client/examples/full-stack-with-auth/src/app.jac +0 -722
- jac_client/examples/little-x/src/app.jac +0 -719
- jac_client/examples/nested-folders/nested-advance/src/app.jac +0 -35
- jac_client/examples/ts-support/src/app.jac +0 -35
- jac_client/examples/with-router/src/app.jac +0 -323
- jac_client/plugin/src/babel_processor.jac +0 -18
- jac_client/plugin/src/impl/babel_processor.impl.jac +0 -89
- jac_client-0.2.8.dist-info/RECORD +0 -97
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/entry_points.txt +0 -0
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
# # Features Test Page - Client-side UI
|
|
2
|
+
# # Demonstrates: props, exports, cl files, TypeScript imports, string methods,
|
|
3
|
+
# # imports from JAC/JS/TS, spawning walkers from cl file
|
|
4
|
+
import from "@jac/runtime" {
|
|
5
|
+
Link,
|
|
6
|
+
useNavigate
|
|
7
|
+
}
|
|
8
|
+
import from react { useState }
|
|
9
|
+
|
|
10
|
+
# # Import TypeScript component
|
|
11
|
+
# import from ..components.PieChart { PieChart }
|
|
12
|
+
|
|
13
|
+
# # Import JavaScript helpers
|
|
14
|
+
import from ..utils.helpers {
|
|
15
|
+
generateId,
|
|
16
|
+
calculatePercentage,
|
|
17
|
+
sumBy
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# # Import from other JAC files
|
|
21
|
+
import from ..utils.formatters { formatCurrency }
|
|
22
|
+
|
|
23
|
+
# Import walkers from server module
|
|
24
|
+
sv import from .FeaturesTest {
|
|
25
|
+
create_test_data,
|
|
26
|
+
read_test_data,
|
|
27
|
+
update_test_data,
|
|
28
|
+
delete_test_data,
|
|
29
|
+
test_string_methods,
|
|
30
|
+
test_list_operations,
|
|
31
|
+
process_complex_data
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# ============================================================================
|
|
35
|
+
# REUSABLE COMPONENTS WITH PROPS
|
|
36
|
+
# ============================================================================
|
|
37
|
+
|
|
38
|
+
# Button component demonstrating props - NEW PATTERN: Direct parameters
|
|
39
|
+
def:pub TestButton(
|
|
40
|
+
text: str, onClick: any, variant: str
|
|
41
|
+
) -> any {
|
|
42
|
+
bg_color = "#3b82f6" if variant == "primary" else "#6b7280";
|
|
43
|
+
hover_color = "#2563eb" if variant == "primary" else "#4b5563";
|
|
44
|
+
|
|
45
|
+
return
|
|
46
|
+
<button
|
|
47
|
+
onClick={onClick}
|
|
48
|
+
style={{
|
|
49
|
+
"padding": "10px 20px",
|
|
50
|
+
"backgroundColor": bg_color,
|
|
51
|
+
"color": "white",
|
|
52
|
+
"border": "none",
|
|
53
|
+
"borderRadius": "6px",
|
|
54
|
+
"cursor": "pointer",
|
|
55
|
+
"fontSize": "14px",
|
|
56
|
+
"fontWeight": "600",
|
|
57
|
+
"transition": "all 0.2s"
|
|
58
|
+
}}
|
|
59
|
+
onMouseOver={lambda e: any -> None { e.target.style.backgroundColor = hover_color;}}
|
|
60
|
+
onMouseOut={lambda e: any -> None { e.target.style.backgroundColor = bg_color;}}
|
|
61
|
+
>
|
|
62
|
+
{text}
|
|
63
|
+
</button>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# # Card component with props - NEW PATTERN: Direct parameters
|
|
67
|
+
def:pub TestCard(
|
|
68
|
+
title: str, children: any, color: str
|
|
69
|
+
) -> any {
|
|
70
|
+
return
|
|
71
|
+
<div
|
|
72
|
+
style={{
|
|
73
|
+
"backgroundColor": "white",
|
|
74
|
+
"border": "1px solid #e5e7eb",
|
|
75
|
+
"borderRadius": "8px",
|
|
76
|
+
"padding": "20px",
|
|
77
|
+
"marginBottom": "20px",
|
|
78
|
+
"boxShadow": "0 1px 3px rgba(0,0,0,0.1)"
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<div
|
|
82
|
+
style={{
|
|
83
|
+
"backgroundColor": color,
|
|
84
|
+
"padding": "10px",
|
|
85
|
+
"borderRadius": "6px",
|
|
86
|
+
"marginBottom": "15px"
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<h3
|
|
90
|
+
style={{
|
|
91
|
+
"margin": "0",
|
|
92
|
+
"fontSize": "18px",
|
|
93
|
+
"fontWeight": "600",
|
|
94
|
+
"color": "#1f2937"
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
{title}
|
|
98
|
+
</h3>
|
|
99
|
+
</div>
|
|
100
|
+
<div>
|
|
101
|
+
{children}
|
|
102
|
+
</div>
|
|
103
|
+
</div>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Result display component - NEW PATTERN: Direct parameters
|
|
107
|
+
def:pub ResultDisplay(
|
|
108
|
+
data: any, label: str
|
|
109
|
+
) -> any {
|
|
110
|
+
if not data {
|
|
111
|
+
return
|
|
112
|
+
<div style={{"color": "#9ca3af", "fontStyle": "italic"}}>
|
|
113
|
+
No data to display
|
|
114
|
+
</div>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return
|
|
118
|
+
<div
|
|
119
|
+
style={{
|
|
120
|
+
"backgroundColor": "#f9fafb",
|
|
121
|
+
"padding": "15px",
|
|
122
|
+
"borderRadius": "6px",
|
|
123
|
+
"border": "1px solid #e5e7eb"
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<strong style={{"color": "#374151"}}>
|
|
127
|
+
{label}:
|
|
128
|
+
</strong>
|
|
129
|
+
<pre
|
|
130
|
+
style={{
|
|
131
|
+
"marginTop": "10px",
|
|
132
|
+
"padding": "10px",
|
|
133
|
+
"backgroundColor": "#1f2937",
|
|
134
|
+
"color": "#10b981",
|
|
135
|
+
"borderRadius": "4px",
|
|
136
|
+
"overflow": "auto",
|
|
137
|
+
"fontSize": "12px",
|
|
138
|
+
"fontFamily": "monospace"
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{JSON.stringify(data, None, 2)}
|
|
142
|
+
</pre>
|
|
143
|
+
</div>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# ============================================================================
|
|
147
|
+
# MAIN PAGE COMPONENT
|
|
148
|
+
# ============================================================================
|
|
149
|
+
def:pub FeaturesTest -> any {
|
|
150
|
+
navigate = useNavigate();
|
|
151
|
+
|
|
152
|
+
# State management
|
|
153
|
+
has testMessage: str = "",
|
|
154
|
+
testData: list = [],
|
|
155
|
+
stringInput: str = "Hello JAC World!",
|
|
156
|
+
stringResult: any = None,
|
|
157
|
+
numberList: str = "1,2,3,4,5",
|
|
158
|
+
listResult: any = None,
|
|
159
|
+
complexResult: any = None,
|
|
160
|
+
loading: bool = false;
|
|
161
|
+
|
|
162
|
+
# Load test data on mount
|
|
163
|
+
async can with entry {
|
|
164
|
+
try {
|
|
165
|
+
result = root spawn read_test_data();
|
|
166
|
+
testData = result.reports if result.reports[0] else [];
|
|
167
|
+
} except Exception as e {
|
|
168
|
+
console.log("Error loading data:", e);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# ========================================================================
|
|
173
|
+
# EVENT HANDLERS - Demonstrating Walker Spawning from CL
|
|
174
|
+
# ========================================================================
|
|
175
|
+
|
|
176
|
+
# Create test data
|
|
177
|
+
async def handleCreate -> None {
|
|
178
|
+
if not testMessage.trim() {
|
|
179
|
+
alert("Please enter a message");
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
loading = true;
|
|
184
|
+
try {
|
|
185
|
+
response = root spawn create_test_data(message=testMessage.trim());
|
|
186
|
+
new_item = response.reports[0][0];
|
|
187
|
+
testData = testData.concat([new_item]);
|
|
188
|
+
testMessage = "";
|
|
189
|
+
alert("Data created successfully!");
|
|
190
|
+
} except Exception as e {
|
|
191
|
+
console.error("Error creating data:", e);
|
|
192
|
+
alert("Error creating data: " + e.toString());
|
|
193
|
+
}
|
|
194
|
+
loading = false;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# Update test data
|
|
198
|
+
async def handleUpdate(item_id: any) -> None {
|
|
199
|
+
new_msg = prompt("Enter new message:");
|
|
200
|
+
if not new_msg {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
loading = true;
|
|
205
|
+
try {
|
|
206
|
+
item_id spawn update_test_data(new_message=new_msg);
|
|
207
|
+
# Reload data
|
|
208
|
+
result = root spawn read_test_data();
|
|
209
|
+
testData = result.reports if result.reports[0] else [];
|
|
210
|
+
alert("Data updated successfully!");
|
|
211
|
+
} except Exception as e {
|
|
212
|
+
console.error("Error updating data:", e);
|
|
213
|
+
alert("Error updating data: " + e.toString());
|
|
214
|
+
}
|
|
215
|
+
loading = false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
# Delete test data
|
|
219
|
+
async def handleDelete(item_id: any) -> None {
|
|
220
|
+
if not confirm("Are you sure you want to delete this item?") {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
loading = true;
|
|
225
|
+
try {
|
|
226
|
+
item_id spawn delete_test_data();
|
|
227
|
+
# Remove from local state
|
|
228
|
+
testData = testData.filter(
|
|
229
|
+
lambda item: any -> bool { return item._jac_id != item_id; }
|
|
230
|
+
);
|
|
231
|
+
alert("Data deleted successfully!");
|
|
232
|
+
} except Exception as e {
|
|
233
|
+
console.error("Error deleting data:", e);
|
|
234
|
+
alert("Error deleting data: " + e.toString());
|
|
235
|
+
}
|
|
236
|
+
loading = false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
# Test string methods via walker
|
|
240
|
+
async def handleStringTest -> None {
|
|
241
|
+
loading = true;
|
|
242
|
+
try {
|
|
243
|
+
response = root spawn test_string_methods(input_text=stringInput);
|
|
244
|
+
result = response.reports[0];
|
|
245
|
+
stringResult = result;
|
|
246
|
+
} except Exception as e {
|
|
247
|
+
console.error("Error testing strings:", e);
|
|
248
|
+
alert("Error testing strings: " + e.toString());
|
|
249
|
+
}
|
|
250
|
+
loading = false;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
# Test list operations via walker
|
|
254
|
+
async def handleListTest -> None {
|
|
255
|
+
loading = true;
|
|
256
|
+
try {
|
|
257
|
+
# Parse number list
|
|
258
|
+
numbers = numberList.split(",").map(
|
|
259
|
+
lambda x: str -> int { return parseInt(x.trim()); }
|
|
260
|
+
).filter(
|
|
261
|
+
lambda x: any -> bool { return not isNaN(x); }
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
response = root spawn test_list_operations(numbers=numbers);
|
|
265
|
+
result = response.reports[0];
|
|
266
|
+
listResult = result;
|
|
267
|
+
} except Exception as e {
|
|
268
|
+
console.error("Error testing lists:", e);
|
|
269
|
+
alert("Error testing lists: " + e.toString());
|
|
270
|
+
}
|
|
271
|
+
loading = false;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
# Test complex data processing
|
|
275
|
+
async def handleComplexTest -> None {
|
|
276
|
+
loading = true;
|
|
277
|
+
try {
|
|
278
|
+
# Generate sample data using JS helper
|
|
279
|
+
sample_items = [
|
|
280
|
+
{"id": generateId(), "name": "apple", "value": 10},
|
|
281
|
+
{"id": generateId(), "name": "banana", "value": 20},
|
|
282
|
+
{"id": generateId(), "name": "cherry", "value": 30}
|
|
283
|
+
];
|
|
284
|
+
|
|
285
|
+
response = root spawn process_complex_data(items=sample_items);
|
|
286
|
+
result = response.reports[0];
|
|
287
|
+
complexResult = result;
|
|
288
|
+
} except Exception as e {
|
|
289
|
+
console.error("Error processing complex data:", e);
|
|
290
|
+
alert("Error processing complex data: " + e.toString());
|
|
291
|
+
}
|
|
292
|
+
loading = false;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
# ========================================================================
|
|
296
|
+
# DEMONSTRATION OF STRING METHODS (CLIENT-SIDE)
|
|
297
|
+
# ========================================================================
|
|
298
|
+
demo_text = "JAC Language Features";
|
|
299
|
+
string_demos = {
|
|
300
|
+
"Original": demo_text,
|
|
301
|
+
"Uppercase": demo_text.toUpperCase(),
|
|
302
|
+
"Lowercase": demo_text.toLowerCase(),
|
|
303
|
+
"Length": demo_text.length.toString(),
|
|
304
|
+
"Split by space": demo_text.split(" ").join(", ")
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
# Demo chart data for TypeScript component
|
|
308
|
+
chart_data = [
|
|
309
|
+
{"name": "Walker Tests", "value": 5},
|
|
310
|
+
{"name": "String Methods", "value": 8},
|
|
311
|
+
{"name": "List Operations", "value": 7},
|
|
312
|
+
{"name": "Components", "value": 4}
|
|
313
|
+
];
|
|
314
|
+
|
|
315
|
+
# Calculate total using JS helper
|
|
316
|
+
total_tests = sumBy(chart_data, "value");
|
|
317
|
+
|
|
318
|
+
# ========================================================================
|
|
319
|
+
# RENDER
|
|
320
|
+
# ========================================================================
|
|
321
|
+
return
|
|
322
|
+
<div
|
|
323
|
+
style={{
|
|
324
|
+
"maxWidth": "1200px",
|
|
325
|
+
"margin": "0 auto",
|
|
326
|
+
"padding": "20px",
|
|
327
|
+
"fontFamily": "system-ui, -apple-system, sans-serif"
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
330
|
+
# Header
|
|
331
|
+
<div
|
|
332
|
+
style={{
|
|
333
|
+
"display": "flex",
|
|
334
|
+
"justifyContent": "space-between",
|
|
335
|
+
"alignItems": "center",
|
|
336
|
+
"marginBottom": "30px"
|
|
337
|
+
}}
|
|
338
|
+
>
|
|
339
|
+
<h1 style={{"color": "#1f2937", "margin": "0"}}>
|
|
340
|
+
JAC Features Test Suite
|
|
341
|
+
</h1>
|
|
342
|
+
<Link to="/">
|
|
343
|
+
<TestButton
|
|
344
|
+
text="← Back Home"
|
|
345
|
+
onClick={lambda -> None { }}
|
|
346
|
+
variant="secondary"
|
|
347
|
+
/>
|
|
348
|
+
</Link>
|
|
349
|
+
</div>
|
|
350
|
+
# Loading indicator
|
|
351
|
+
{loading
|
|
352
|
+
and <div
|
|
353
|
+
style={{
|
|
354
|
+
"position": "fixed",
|
|
355
|
+
"top": "20px",
|
|
356
|
+
"right": "20px",
|
|
357
|
+
"backgroundColor": "#3b82f6",
|
|
358
|
+
"color": "white",
|
|
359
|
+
"padding": "10px 20px",
|
|
360
|
+
"borderRadius": "6px",
|
|
361
|
+
"boxShadow": "0 4px 6px rgba(0,0,0,0.2)",
|
|
362
|
+
"zIndex": "1000"
|
|
363
|
+
}}
|
|
364
|
+
>
|
|
365
|
+
Processing...
|
|
366
|
+
</div>}
|
|
367
|
+
# Section 1: Walker CRUD Operations
|
|
368
|
+
<TestCard
|
|
369
|
+
title="1. Walker CRUD Operations (Spawn from CL)"
|
|
370
|
+
color="#dbeafe"
|
|
371
|
+
>
|
|
372
|
+
<div style={{"marginBottom": "15px"}}>
|
|
373
|
+
<p style={{"color": "#4b5563", "marginBottom": "10px"}}>
|
|
374
|
+
Test creating, reading, updating, and deleting data using walkers spawned from client code.
|
|
375
|
+
</p>
|
|
376
|
+
<div
|
|
377
|
+
style={{
|
|
378
|
+
"display": "flex",
|
|
379
|
+
"gap": "10px",
|
|
380
|
+
"marginBottom": "15px"
|
|
381
|
+
}}
|
|
382
|
+
>
|
|
383
|
+
<input
|
|
384
|
+
type="text"
|
|
385
|
+
value={testMessage}
|
|
386
|
+
onChange={lambda e: any -> None { testMessage = e.target.value;}}
|
|
387
|
+
placeholder="Enter test message..."
|
|
388
|
+
style={{
|
|
389
|
+
"flex": "1",
|
|
390
|
+
"padding": "10px",
|
|
391
|
+
"border": "1px solid #d1d5db",
|
|
392
|
+
"borderRadius": "6px",
|
|
393
|
+
"fontSize": "14px"
|
|
394
|
+
}}
|
|
395
|
+
/>
|
|
396
|
+
<TestButton
|
|
397
|
+
text="Create"
|
|
398
|
+
onClick={lambda -> None { handleCreate();}}
|
|
399
|
+
variant="primary"
|
|
400
|
+
/>
|
|
401
|
+
</div>
|
|
402
|
+
<div style={{"marginTop": "20px"}}>
|
|
403
|
+
<strong style={{"color": "#374151"}}>
|
|
404
|
+
Stored Data ({testData.length}items):
|
|
405
|
+
</strong>
|
|
406
|
+
{testData.length == 0
|
|
407
|
+
and <p style={{"color": "#9ca3af", "fontStyle": "italic"}}>
|
|
408
|
+
No data yet. Create some!
|
|
409
|
+
</p>}
|
|
410
|
+
{testData.map(
|
|
411
|
+
lambda item: any -> any { return
|
|
412
|
+
<div
|
|
413
|
+
key={item._jac_id}
|
|
414
|
+
style={{
|
|
415
|
+
"backgroundColor": "#f9fafb",
|
|
416
|
+
"padding": "12px",
|
|
417
|
+
"borderRadius": "6px",
|
|
418
|
+
"marginTop": "8px",
|
|
419
|
+
"display": "flex",
|
|
420
|
+
"justifyContent": "space-between",
|
|
421
|
+
"alignItems": "center"
|
|
422
|
+
}}
|
|
423
|
+
>
|
|
424
|
+
<div>
|
|
425
|
+
<div
|
|
426
|
+
style={{
|
|
427
|
+
"fontWeight": "600",
|
|
428
|
+
"color": "#1f2937"
|
|
429
|
+
}}
|
|
430
|
+
>
|
|
431
|
+
{item.message}
|
|
432
|
+
</div>
|
|
433
|
+
<div
|
|
434
|
+
style={{
|
|
435
|
+
"fontSize": "12px",
|
|
436
|
+
"color": "#6b7280"
|
|
437
|
+
}}
|
|
438
|
+
>
|
|
439
|
+
Count: {item.count}| Created: {item.created_at}
|
|
440
|
+
</div>
|
|
441
|
+
</div>
|
|
442
|
+
<div style={{"display": "flex", "gap": "8px"}}>
|
|
443
|
+
<TestButton
|
|
444
|
+
text="Edit"
|
|
445
|
+
onClick={lambda -> None { handleUpdate(
|
|
446
|
+
item._jac_id
|
|
447
|
+
);}}
|
|
448
|
+
variant="secondary"
|
|
449
|
+
/>
|
|
450
|
+
<TestButton
|
|
451
|
+
text="Delete"
|
|
452
|
+
onClick={lambda -> None { handleDelete(
|
|
453
|
+
item._jac_id
|
|
454
|
+
);}}
|
|
455
|
+
variant="secondary"
|
|
456
|
+
/>
|
|
457
|
+
</div>
|
|
458
|
+
</div>; }
|
|
459
|
+
)}
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
</TestCard>
|
|
463
|
+
# # Section 2: String Methods
|
|
464
|
+
<TestCard title="2. String Methods (Client & Walker)" color="#fce7f3">
|
|
465
|
+
<div>
|
|
466
|
+
<p style={{"color": "#4b5563", "marginBottom": "10px"}}>
|
|
467
|
+
Client-side string manipulation and walker-based string processing.
|
|
468
|
+
</p>
|
|
469
|
+
# Client-side demo
|
|
470
|
+
<div style={{"marginBottom": "20px"}}>
|
|
471
|
+
<strong style={{"color": "#374151"}}>
|
|
472
|
+
Client-side String Demo:
|
|
473
|
+
</strong>
|
|
474
|
+
<div
|
|
475
|
+
style={{
|
|
476
|
+
"backgroundColor": "#fef3c7",
|
|
477
|
+
"padding": "10px",
|
|
478
|
+
"borderRadius": "6px",
|
|
479
|
+
"marginTop": "8px"
|
|
480
|
+
}}
|
|
481
|
+
>
|
|
482
|
+
{Object.keys(string_demos).map(
|
|
483
|
+
lambda key: str -> any { return
|
|
484
|
+
<div key={key} style={{"marginBottom": "5px"}}>
|
|
485
|
+
<span style={{"fontWeight": "600"}}>
|
|
486
|
+
{key}:
|
|
487
|
+
</span>
|
|
488
|
+
{string_demos[key]}
|
|
489
|
+
</div>; }
|
|
490
|
+
)}
|
|
491
|
+
</div>
|
|
492
|
+
</div>
|
|
493
|
+
# Walker-based test
|
|
494
|
+
<div>
|
|
495
|
+
<strong style={{"color": "#374151"}}>
|
|
496
|
+
Walker String Processing:
|
|
497
|
+
</strong>
|
|
498
|
+
<div
|
|
499
|
+
style={{
|
|
500
|
+
"display": "flex",
|
|
501
|
+
"gap": "10px",
|
|
502
|
+
"marginTop": "10px"
|
|
503
|
+
}}
|
|
504
|
+
>
|
|
505
|
+
<input
|
|
506
|
+
type="text"
|
|
507
|
+
value={stringInput}
|
|
508
|
+
onChange={lambda e: any -> None { stringInput = e.target.value;}}
|
|
509
|
+
style={{
|
|
510
|
+
"flex": "1",
|
|
511
|
+
"padding": "10px",
|
|
512
|
+
"border": "1px solid #d1d5db",
|
|
513
|
+
"borderRadius": "6px",
|
|
514
|
+
"fontSize": "14px"
|
|
515
|
+
}}
|
|
516
|
+
/>
|
|
517
|
+
<TestButton
|
|
518
|
+
text="Process with Walker"
|
|
519
|
+
onClick={lambda -> None { handleStringTest();}}
|
|
520
|
+
variant="primary"
|
|
521
|
+
/>
|
|
522
|
+
</div>
|
|
523
|
+
{stringResult
|
|
524
|
+
and <ResultDisplay data={stringResult} label="Walker Result" />}
|
|
525
|
+
</div>
|
|
526
|
+
</div>
|
|
527
|
+
</TestCard>
|
|
528
|
+
# # Section 3: List Operations
|
|
529
|
+
<TestCard title="3. List/Array Operations" color="#ddd6fe">
|
|
530
|
+
<div>
|
|
531
|
+
<p style={{"color": "#4b5563", "marginBottom": "10px"}}>
|
|
532
|
+
Process arrays/lists using walker operations.
|
|
533
|
+
</p>
|
|
534
|
+
<div
|
|
535
|
+
style={{"display": "flex", "gap": "10px", "marginTop": "10px"}}
|
|
536
|
+
>
|
|
537
|
+
<input
|
|
538
|
+
type="text"
|
|
539
|
+
value={numberList}
|
|
540
|
+
onChange={lambda e: any -> None { numberList = e.target.value;}}
|
|
541
|
+
placeholder="Enter numbers (comma-separated)"
|
|
542
|
+
style={{
|
|
543
|
+
"flex": "1",
|
|
544
|
+
"padding": "10px",
|
|
545
|
+
"border": "1px solid #d1d5db",
|
|
546
|
+
"borderRadius": "6px",
|
|
547
|
+
"fontSize": "14px"
|
|
548
|
+
}}
|
|
549
|
+
/>
|
|
550
|
+
<TestButton
|
|
551
|
+
text="Process List"
|
|
552
|
+
onClick={lambda -> None { handleListTest();}}
|
|
553
|
+
variant="primary"
|
|
554
|
+
/>
|
|
555
|
+
</div>
|
|
556
|
+
{listResult
|
|
557
|
+
and <ResultDisplay
|
|
558
|
+
data={listResult}
|
|
559
|
+
label="List Operations Result"
|
|
560
|
+
/>}
|
|
561
|
+
</div>
|
|
562
|
+
</TestCard>
|
|
563
|
+
# # Section 4: TypeScript Component Integration
|
|
564
|
+
# <TestCard title="4. TypeScript Component (PieChart.tsx)" color="#ccfbf1">
|
|
565
|
+
# <div>
|
|
566
|
+
# <p style={{"color": "#4b5563", "marginBottom": "10px"}}>
|
|
567
|
+
# Imported TypeScript React component with data from JAC.
|
|
568
|
+
# </p>
|
|
569
|
+
# # <PieChart data={chart_data} title="Feature Test Distribution" />
|
|
570
|
+
# <p style={{"marginTop": "10px", "color": "#6b7280", "fontSize": "14px"}}>
|
|
571
|
+
# Total tests: {total_tests} (calculated using JS helper: sumBy)
|
|
572
|
+
# </p>
|
|
573
|
+
# </div>
|
|
574
|
+
# </TestCard>
|
|
575
|
+
|
|
576
|
+
# # Section 5: Import Demonstrations
|
|
577
|
+
<TestCard title="5. Import Demonstrations" color="#fed7aa">
|
|
578
|
+
<div>
|
|
579
|
+
<p style={{"color": "#4b5563", "marginBottom": "15px"}}>
|
|
580
|
+
This page demonstrates various import types:
|
|
581
|
+
</p>
|
|
582
|
+
<ul style={{"color": "#374151", "lineHeight": "1.8"}}>
|
|
583
|
+
<li>
|
|
584
|
+
<strong>
|
|
585
|
+
JAC-Client Utils:
|
|
586
|
+
</strong>
|
|
587
|
+
Router components (Link, useNavigate)
|
|
588
|
+
</li>
|
|
589
|
+
<li>
|
|
590
|
+
<strong>
|
|
591
|
+
React:
|
|
592
|
+
</strong>
|
|
593
|
+
Hooks (useState, useEffect)
|
|
594
|
+
</li>
|
|
595
|
+
# <li><strong>TypeScript:</strong> PieChart component from .tsx file</li>
|
|
596
|
+
<li>
|
|
597
|
+
<strong>
|
|
598
|
+
JavaScript:
|
|
599
|
+
</strong>
|
|
600
|
+
Helper functions from .js file (generateId, sumBy)
|
|
601
|
+
</li>
|
|
602
|
+
<li>
|
|
603
|
+
<strong>
|
|
604
|
+
JAC Files:
|
|
605
|
+
</strong>
|
|
606
|
+
for
|
|
607
|
+
matCurrency from utils/formatters.jac
|
|
608
|
+
</li>
|
|
609
|
+
</ul>
|
|
610
|
+
<div
|
|
611
|
+
style={{
|
|
612
|
+
"backgroundColor": "#f0fdf4",
|
|
613
|
+
"padding": "15px",
|
|
614
|
+
"borderRadius": "6px",
|
|
615
|
+
"marginTop": "15px"
|
|
616
|
+
}}
|
|
617
|
+
>
|
|
618
|
+
<strong style={{"color": "#065f46"}}>
|
|
619
|
+
Examples:
|
|
620
|
+
</strong>
|
|
621
|
+
<div
|
|
622
|
+
style={{
|
|
623
|
+
"marginTop": "8px",
|
|
624
|
+
"fontSize": "14px",
|
|
625
|
+
"color": "#047857"
|
|
626
|
+
}}
|
|
627
|
+
>
|
|
628
|
+
<div>
|
|
629
|
+
Generated ID: {generateId()}
|
|
630
|
+
</div>
|
|
631
|
+
<div>
|
|
632
|
+
Formatted Currency: {formatCurrency(1234.56)}
|
|
633
|
+
</div>
|
|
634
|
+
<div>
|
|
635
|
+
Percentage Calc: {calculatePercentage(75, 100)}%
|
|
636
|
+
</div>
|
|
637
|
+
</div>
|
|
638
|
+
</div>
|
|
639
|
+
</div>
|
|
640
|
+
</TestCard>
|
|
641
|
+
# # Section 6: Complex Data Processing
|
|
642
|
+
<TestCard title="6. Complex Data Processing" color="#e0e7ff">
|
|
643
|
+
<div>
|
|
644
|
+
<p style={{"color": "#4b5563", "marginBottom": "10px"}}>
|
|
645
|
+
Process complex nested data structures with walkers.
|
|
646
|
+
</p>
|
|
647
|
+
<TestButton
|
|
648
|
+
text="Process Sample Data"
|
|
649
|
+
onClick={lambda -> None { handleComplexTest();}}
|
|
650
|
+
variant="primary"
|
|
651
|
+
/>
|
|
652
|
+
{complexResult
|
|
653
|
+
and <ResultDisplay
|
|
654
|
+
data={complexResult}
|
|
655
|
+
label="Complex Processing Result"
|
|
656
|
+
/>}
|
|
657
|
+
</div>
|
|
658
|
+
</TestCard>
|
|
659
|
+
# Footer
|
|
660
|
+
<div
|
|
661
|
+
style={{
|
|
662
|
+
"marginTop": "30px",
|
|
663
|
+
"padding": "20px",
|
|
664
|
+
"backgroundColor": "#f9fafb",
|
|
665
|
+
"borderRadius": "8px",
|
|
666
|
+
"textAlign": "center",
|
|
667
|
+
"color": "#6b7280"
|
|
668
|
+
}}
|
|
669
|
+
>
|
|
670
|
+
<p style={{"margin": "0"}}>
|
|
671
|
+
✅ All features tested: Props, Exports, CL Files, TypeScript, JavaScript, JAC Imports, String Methods, Walker Spawning
|
|
672
|
+
</p>
|
|
673
|
+
</div>
|
|
674
|
+
</div>;
|
|
675
|
+
}
|