jac-client 0.2.7__py3-none-any.whl → 0.2.9__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 (72) hide show
  1. jac_client/examples/all-in-one/{src/app.jac → main.jac} +5 -5
  2. jac_client/examples/all-in-one/{src/pages → pages}/BudgetPlanner.jac +8 -1
  3. jac_client/examples/all-in-one/{src/pages → pages}/FeaturesTest.jac +16 -1
  4. jac_client/examples/all-in-one/{src/pages/FeaturesTest.cl.jac → pages/features_test_ui.cl.jac} +11 -0
  5. jac_client/examples/all-in-one/{src/pages → pages}/nestedDemo.jac +1 -1
  6. jac_client/examples/all-in-one/{src/pages → pages}/notFound.jac +2 -7
  7. jac_client/plugin/cli.jac +162 -430
  8. jac_client/plugin/client.jac +30 -12
  9. jac_client/plugin/client_runtime.cl.jac +19 -15
  10. jac_client/plugin/impl/client.impl.jac +107 -69
  11. jac_client/plugin/impl/client_runtime.impl.jac +181 -9
  12. jac_client/plugin/plugin_config.jac +243 -15
  13. jac_client/plugin/src/config_loader.jac +1 -0
  14. jac_client/plugin/src/impl/compiler.impl.jac +2 -4
  15. jac_client/plugin/src/impl/config_loader.impl.jac +8 -0
  16. jac_client/plugin/src/impl/vite_bundler.impl.jac +241 -11
  17. jac_client/plugin/src/vite_bundler.jac +14 -1
  18. jac_client/plugin/utils/__init__.jac +1 -0
  19. jac_client/plugin/utils/impl/node_installer.impl.jac +249 -0
  20. jac_client/plugin/utils/node_installer.jac +41 -0
  21. jac_client/templates/client.jacpack +72 -0
  22. jac_client/templates/fullstack.jacpack +61 -0
  23. jac_client/tests/conftest.py +48 -7
  24. jac_client/tests/test_cli.py +189 -73
  25. jac_client/tests/test_e2e.py +232 -0
  26. jac_client/tests/test_helpers.py +65 -0
  27. jac_client/tests/test_it.py +97 -137
  28. {jac_client-0.2.7.dist-info → jac_client-0.2.9.dist-info}/METADATA +4 -4
  29. jac_client-0.2.9.dist-info/RECORD +104 -0
  30. {jac_client-0.2.7.dist-info → jac_client-0.2.9.dist-info}/WHEEL +1 -1
  31. jac_client-0.2.7.dist-info/RECORD +0 -97
  32. /jac_client/examples/all-in-one/{src/button.jac → button.jac} +0 -0
  33. /jac_client/examples/all-in-one/{src/components → components}/CategoryFilter.jac +0 -0
  34. /jac_client/examples/all-in-one/{src/components → components}/Header.jac +0 -0
  35. /jac_client/examples/all-in-one/{src/components → components}/ProfitOverview.jac +0 -0
  36. /jac_client/examples/all-in-one/{src/components → components}/Summary.jac +0 -0
  37. /jac_client/examples/all-in-one/{src/components → components}/TransactionForm.jac +0 -0
  38. /jac_client/examples/all-in-one/{src/components → components}/TransactionItem.jac +0 -0
  39. /jac_client/examples/all-in-one/{src/components → components}/TransactionList.jac +0 -0
  40. /jac_client/examples/all-in-one/{src/components → components}/button.jac +0 -0
  41. /jac_client/examples/all-in-one/{src/components → components}/navigation.jac +0 -0
  42. /jac_client/examples/all-in-one/{src/constants → constants}/categories.jac +0 -0
  43. /jac_client/examples/all-in-one/{src/constants → constants}/clients.jac +0 -0
  44. /jac_client/examples/all-in-one/{src/context → context}/BudgetContext.jac +0 -0
  45. /jac_client/examples/all-in-one/{src/hooks → hooks}/useBudget.jac +0 -0
  46. /jac_client/examples/all-in-one/{src/hooks → hooks}/useLocalStorage.jac +0 -0
  47. /jac_client/examples/all-in-one/{src/pages → pages}/LandingPage.jac +0 -0
  48. /jac_client/examples/all-in-one/{src/pages/BudgetPlanner.cl.jac → pages/budget_planner_ui.cl.jac} +0 -0
  49. /jac_client/examples/all-in-one/{src/pages → pages}/loginPage.jac +0 -0
  50. /jac_client/examples/all-in-one/{src/pages → pages}/signupPage.jac +0 -0
  51. /jac_client/examples/all-in-one/{src/utils → utils}/formatters.jac +0 -0
  52. /jac_client/examples/asset-serving/css-with-image/{src/app.jac → main.jac} +0 -0
  53. /jac_client/examples/asset-serving/image-asset/{src/app.jac → main.jac} +0 -0
  54. /jac_client/examples/asset-serving/import-alias/{src/app.jac → main.jac} +0 -0
  55. /jac_client/examples/basic/{src/app.jac → main.jac} +0 -0
  56. /jac_client/examples/basic-auth/{src/app.jac → main.jac} +0 -0
  57. /jac_client/examples/basic-auth-with-router/{src/app.jac → main.jac} +0 -0
  58. /jac_client/examples/basic-full-stack/{src/app.jac → main.jac} +0 -0
  59. /jac_client/examples/css-styling/js-styling/{src/app.jac → main.jac} +0 -0
  60. /jac_client/examples/css-styling/material-ui/{src/app.jac → main.jac} +0 -0
  61. /jac_client/examples/css-styling/pure-css/{src/app.jac → main.jac} +0 -0
  62. /jac_client/examples/css-styling/sass-example/{src/app.jac → main.jac} +0 -0
  63. /jac_client/examples/css-styling/styled-components/{src/app.jac → main.jac} +0 -0
  64. /jac_client/examples/css-styling/tailwind-example/{src/app.jac → main.jac} +0 -0
  65. /jac_client/examples/full-stack-with-auth/{src/app.jac → main.jac} +0 -0
  66. /jac_client/examples/little-x/{src/app.jac → main.jac} +0 -0
  67. /jac_client/examples/nested-folders/nested-advance/{src/app.jac → main.jac} +0 -0
  68. /jac_client/examples/nested-folders/nested-basic/{src/app.jac → main.jac} +0 -0
  69. /jac_client/examples/ts-support/{src/app.jac → main.jac} +0 -0
  70. /jac_client/examples/with-router/{src/app.jac → main.jac} +0 -0
  71. {jac_client-0.2.7.dist-info → jac_client-0.2.9.dist-info}/entry_points.txt +0 -0
  72. {jac_client-0.2.7.dist-info → jac_client-0.2.9.dist-info}/top_level.txt +0 -0
@@ -18,14 +18,29 @@ glob JsonValue: TypeAlias = None | str | int | float | bool | list['JsonValue']
18
18
  ],
19
19
  StatusCode: TypeAlias = Literal[(200, 201, 400, 401, 404, 503)];
20
20
 
21
- """Jac Client Module Introspector."""
22
- class JacClientModuleIntrospector(ModuleIntrospector) {
23
- def render_page(
24
- self: JacClientModuleIntrospector,
21
+ """Builds HTML head content from meta data."""
22
+ obj HeaderBuilder {
23
+ has meta_data: dict,
25
24
  function_name: str,
26
- args: dict[(str, Any)],
27
- username: str
28
- ) -> dict[str, Any];
25
+ DEFAULTS: dict = {
26
+ "charset": "UTF-8",
27
+ "viewport": "width=device-width,initial-scale=1"
28
+ },
29
+ standard_tags: list = [
30
+ "description",
31
+ "keywords",
32
+ "author",
33
+ "robots",
34
+ "theme_color"
35
+ ];
36
+
37
+ def build_head -> str;
38
+ def _get_value(key: str) -> str;
39
+ def _build_special_tags -> list[str];
40
+ def _build_meta_tags -> list[str];
41
+ def _build_og_tags -> list[str];
42
+ def _build_link_tags -> list[str];
43
+ def _build_generic_meta_tags -> list[str];
29
44
  }
30
45
 
31
46
  """Jac Client."""
@@ -38,15 +53,18 @@ class JacClient {
38
53
  module: types.ModuleType, force: bool = False
39
54
  ) -> ClientBundle;
40
55
 
41
- @hookimpl
42
- static def get_module_introspector(
43
- module_name: str, base_path: (str | None)
44
- ) -> ModuleIntrospector;
45
-
46
56
  @hookimpl
47
57
  static def send_static_file(
48
58
  handler: BaseHTTPRequestHandler,
49
59
  file_path: Path,
50
60
  content_type: (str | None) = None
51
61
  ) -> None;
62
+
63
+ @hookimpl
64
+ static def render_page(
65
+ introspector: ModuleIntrospector,
66
+ function_name: str,
67
+ args: dict[(str, Any)],
68
+ username: str
69
+ ) -> dict[str, Any];
52
70
  }
@@ -13,11 +13,12 @@ import from 'react-router-dom' {
13
13
  useLocation as reactRouterUseLocation,
14
14
  useParams as reactRouterUseParams
15
15
  }
16
+ import from 'react-error-boundary' { ErrorBoundary }
16
17
 
17
- def : pub __jacJsx(tag: any, props: dict = {}, children: any = []) -> any;
18
+ def:pub __jacJsx(tag: any, props: dict = {}, children: any = []) -> any;
18
19
 
19
20
  # React hooks re-exported for auto-injection by `has` variables
20
- glob : pub useState = reactUseState,
21
+ glob:pub useState = reactUseState,
21
22
  Router = ReactRouterHashRouter,
22
23
  Routes = ReactRouterRoutes,
23
24
  Route = ReactRouterRoute,
@@ -25,18 +26,21 @@ glob : pub useState = reactUseState,
25
26
  Navigate = ReactRouterNavigate,
26
27
  useNavigate = reactRouterUseNavigate,
27
28
  useLocation = reactRouterUseLocation,
28
- useParams = reactRouterUseParams;
29
+ useParams = reactRouterUseParams,
30
+ JacClientErrorBoundary = ErrorBoundary;
29
31
 
30
- def : pub useRouter -> dict;
31
- def : pub navigate(path: str) -> None;
32
- async def : pub __jacSpawn(left: str, right: str = "", fields: dict = {}) -> any;
33
- def : pub jacSpawn(left: str, right: str = "", fields: dict = {}) -> any;
34
- async def : pub __jacCallFunction(function_name: str, args: dict = {}) -> any;
35
- async def : pub jacSignup(username: str, password: str) -> dict;
36
- async def : pub jacLogin(username: str, password: str) -> bool;
37
- def : pub jacLogout -> None;
38
- def : pub jacIsLoggedIn -> bool;
39
- def : pub __getLocalStorage(key: str) -> str;
40
- def : pub __setLocalStorage(key: str, value: str) -> None;
41
- def : pub __removeLocalStorage(key: str) -> None;
32
+ def:pub useRouter -> dict;
33
+ def:pub navigate(path: str) -> None;
34
+ async def:pub __jacSpawn(left: str, right: str = "", fields: dict = {}) -> any;
35
+ def:pub jacSpawn(left: str, right: str = "", fields: dict = {}) -> any;
36
+ async def:pub __jacCallFunction(function_name: str, args: dict = {}) -> any;
37
+ async def:pub jacSignup(username: str, password: str) -> dict;
38
+ async def:pub jacLogin(username: str, password: str) -> bool;
39
+ def:pub jacLogout -> None;
40
+ def:pub jacIsLoggedIn -> bool;
41
+ def:pub __getLocalStorage(key: str) -> str;
42
+ def:pub __setLocalStorage(key: str, value: str) -> None;
43
+ def:pub __removeLocalStorage(key: str) -> None;
44
+ def:pub ErrorFallback(error: str, resetErrorBoundary: any) -> any;
45
+ def:pub errorOverlay(filePath: str, errors: str) -> any;
42
46
  # React Router components
@@ -30,13 +30,6 @@ impl JacClient.send_static_file(
30
30
  }
31
31
  }
32
32
 
33
- """Get a module introspector for the supplied module."""
34
- impl JacClient.get_module_introspector(
35
- module_name: str, base_path: (str | None)
36
- ) -> ModuleIntrospector {
37
- return JacClientModuleIntrospector(module_name, base_path);
38
- }
39
-
40
33
  """Build a client bundle for the supplied module."""
41
34
  impl JacClient.build_client_bundle(
42
35
  module: types.ModuleType, force: bool = False
@@ -92,21 +85,21 @@ impl JacClient.get_client_bundle_builder -> ViteClientBundleBuilder {
92
85
  }
93
86
 
94
87
  """Render HTML page for client function using the Vite bundle."""
95
- impl JacClientModuleIntrospector.render_page(
96
- self: JacClientModuleIntrospector,
88
+ impl JacClient.render_page(
89
+ introspector: ModuleIntrospector,
97
90
  function_name: str,
98
91
  args: dict[(str, Any)],
99
92
  username: str
100
93
  ) -> dict[str, Any] {
101
- self.load();
94
+ introspector.load();
102
95
  available_exports = (
103
- set(self._client_manifest.get('exports', []))
104
- or set(self.get_client_functions().keys())
96
+ set(introspector._client_manifest.get('exports', []))
97
+ or set(introspector.get_client_functions().keys())
105
98
  );
106
99
  if (function_name not in available_exports) {
107
100
  raise ValueError(f"Client function '{function_name}' not found") ;
108
101
  }
109
- bundle_hash = self.ensure_bundle();
102
+ bundle_hash = introspector.ensure_bundle();
110
103
  import from jaclang.project.config { find_project_root, get_config }
111
104
  # Find project root by looking for jac.toml (base_path_dir might be src/ for entry files)
112
105
  base_path_dir = Path(Jac.base_path_dir);
@@ -133,64 +126,109 @@ impl JacClientModuleIntrospector.render_page(
133
126
  # Get meta data from config
134
127
  client_cfg = config.get_plugin_config("client") if config else None;
135
128
  meta_data = client_cfg.get("app_meta_data", {}) if client_cfg else {};
136
- charset = meta_data.get("charset", "UTF-8");
137
- title = meta_data.get("title", function_name);
138
- viewport = meta_data.get("viewport", "width=device-width, initial-scale=1");
139
- description = meta_data.get("description", None);
140
- robots = meta_data.get("robots", "index, follow");
141
- canonical = meta_data.get("canonical", None);
142
- og_type = meta_data.get("og_type", "website");
143
- og_title = meta_data.get("og_title", title);
144
- og_description = meta_data.get("og_description", None);
145
- og_url = meta_data.get("og_url", None);
146
- og_image = meta_data.get("og_image", None);
147
- theme_color = meta_data.get("theme_color", "#ffffff");
148
- icon = meta_data.get("icon", None);
149
- # Build head content from TOML metadata
150
- head_content = f'<meta charset="{html.escape(charset)}"/>\n <meta name="viewport" content="{html.escape(
151
- viewport
152
- )}"/>\n <title>{html.escape(title)}</title>';
153
- head_content += f'\n <meta name="robots" content="{html.escape(robots)}"/>';
154
- head_content += f'\n <meta name="theme-color" content="{html.escape(
155
- theme_color
156
- )}"/>';
157
- head_content += f'\n <meta property="og:type" content="{html.escape(
158
- og_type
159
- )}"/>';
160
- head_content += f'\n <meta property="og:title" content="{html.escape(
161
- og_title
162
- )}"/>';
163
- if description {
164
- head_content += f'\n <meta name="description" content="{html.escape(
165
- description
166
- )}"/>';
167
- }
168
- if canonical {
169
- head_content += f'\n <link rel="canonical" href="{html.escape(
170
- canonical
171
- )}"/>';
172
- }
173
- if icon {
174
- head_content += f'\n <link rel="icon" href="{html.escape(icon)}"/>';
175
- }
176
- if og_url {
177
- head_content += f'\n <meta property="og:url" content="{html.escape(
178
- og_url
179
- )}"/>';
180
- }
181
- if og_image {
182
- head_content += f'\n <meta property="og:image" content="{html.escape(
183
- og_image
184
- )}"/>';
185
- }
186
- if og_description {
187
- head_content += f'\n <meta property="og:description" content="{html.escape(
188
- og_description
189
- )}"/>';
190
- }
129
+ head_builder = HeaderBuilder(meta_data, function_name);
130
+ head_content = head_builder.build_head();
191
131
  if css_link {
192
132
  head_content += f"\n {css_link}";
193
133
  }
194
134
  page = f'<!DOCTYPE html><html lang="en"><head>{head_content}</head><body><div id="root"></div><script src="/static/client.js?hash={bundle_hash}" defer></script></body></html>';
195
- return {'html': page, 'bundle_hash': bundle_hash, 'bundle_code': self._bundle.code};
135
+ return {
136
+ 'html': page,
137
+ 'bundle_hash': bundle_hash,
138
+ 'bundle_code': introspector._bundle.code
139
+ };
140
+ }
141
+
142
+ """Build complete HTML head."""
143
+ impl HeaderBuilder.build_head -> str {
144
+ lines: list = [];
145
+ lines.extend(self._build_special_tags()); # charset, viewport, title
146
+ lines.extend(self._build_meta_tags()); # description, robots, etc
147
+ lines.extend(self._build_og_tags()); # Open Graph
148
+ lines.extend(self._build_link_tags()); # canonical, icon, etc
149
+ lines.extend(self._build_generic_meta_tags()); # custom meta_* tags
150
+ return "\n ".join(lines);
151
+ }
152
+
153
+ """Build generic meta tags (meta_* prefix for any custom metadata)."""
154
+ impl HeaderBuilder._build_generic_meta_tags -> list[str] {
155
+ lines: list = [];
156
+ for (key, val) in self.meta_data.items() {
157
+ if key.startswith("meta_") and val {
158
+ # meta_custom_field → name="custom-field"
159
+ name = key[5:].replace("_", "-");
160
+ lines.append(f'<meta name={name} content={html.escape(str(val))} />');
161
+ }
162
+ }
163
+ return lines;
164
+ }
165
+
166
+ """Build link tags (link_* prefix or special cases)."""
167
+ impl HeaderBuilder._build_link_tags -> list[str] {
168
+ lines: list = [];
169
+ special_links = {
170
+ "canonical": "canonical",
171
+ "icon": "icon",
172
+ "apple_touch_icon": "apple-touch-icon",
173
+ "manifest": "manifest"
174
+ };
175
+ for (key, rel) in special_links.items() {
176
+ if val := self._get_value(key) {
177
+ lines.append(f'<link rel={rel} href={html.escape(str(val))} />');
178
+ }
179
+ }
180
+ for (key, val) in self.meta_data.items() {
181
+ if key.startswith("link_") and val {
182
+ # link_preconnect_google → rel="preconnect"
183
+ rel = key[5:].replace("_", "-");
184
+ lines.append(f'<link rel={rel} href={html.escape(str(val))} />');
185
+ }
186
+ }
187
+ return lines;
188
+ }
189
+
190
+ """Build Open Graph tags (og_* prefix)."""
191
+ impl HeaderBuilder._build_og_tags -> list[str] {
192
+ lines: list = [];
193
+ for (key, val) in self.meta_data.items() {
194
+ if key.startswith("og_") and val {
195
+ property_name = key[3:].replace("_", ":");
196
+ lines.append(
197
+ f'<meta property=og:{property_name} content={html.escape(str(val))} />'
198
+ );
199
+ }
200
+ }
201
+ return lines;
202
+ }
203
+
204
+ """Build standard meta tags (description, robots, keywords, author, etc)."""
205
+ impl HeaderBuilder._build_meta_tags -> list[str] {
206
+ lines: list = [];
207
+ for key in self.standard_tags {
208
+ if val := self._get_value(key) {
209
+ # Convert underscore to dash (theme_color → theme-color)
210
+ name = key.replace("_", "-");
211
+ lines.append(f'<meta name={name} content={html.escape(val)} />');
212
+ }
213
+ }
214
+ return lines;
215
+ }
216
+
217
+ """Build special tags (charset, viewport, title)."""
218
+ impl HeaderBuilder._build_special_tags -> list[str] {
219
+ lines: list = [];
220
+ if charset := self._get_value("charset") {
221
+ lines.append(f'<meta charset={html.escape(charset)} />');
222
+ }
223
+ if viewport := self._get_value("viewport") {
224
+ lines.append(f'<meta name="viewport" content={html.escape(viewport)} />');
225
+ }
226
+ title = self._get_value("title") or self.function_name;
227
+ lines.append(f'<title>{html.escape(title)}</title>');
228
+ return lines;
229
+ }
230
+
231
+ """Get value with fallback to defaults."""
232
+ impl HeaderBuilder._get_value(key: str) -> str {
233
+ return self.meta_data.get(key) or self.DEFAULTS.get(key);
196
234
  }
@@ -65,9 +65,11 @@ impl __jacSpawn(left: str, right: str = "", fields: dict = {}) -> any {
65
65
  );
66
66
  if not response.ok {
67
67
  error_text = await response.json();
68
- raise Exception(f"Walker {walker} failed: {error_text}") ;
68
+ walker_name = f"{left}/{right}" if right else left;
69
+ raise Exception(f"Walker {walker_name} failed: {error_text}") ;
69
70
  }
70
- return await response.json();
71
+ payload = await response.json();
72
+ return payload["data"] if payload["data"] else {};
71
73
  }
72
74
 
73
75
  impl jacSpawn(left: str, right: str = "", fields: dict = {}) -> any {
@@ -87,12 +89,18 @@ impl __jacCallFunction(function_name: str, args: dict = {}) -> any {
87
89
  "body": JSON.stringify({"args": args})
88
90
  }
89
91
  );
90
- if not response.ok {
91
- error_text = await response.text();
92
- raise Exception(f"Function {function_name} failed: {error_text}") ;
92
+ payload = await response.json();
93
+ if not payload["ok"] {
94
+ error_msg = payload["error"] if payload["error"] else "Unknown error";
95
+ raise Exception(f"Function {function_name} failed: {error_msg}") ;
93
96
  }
94
- data = JSON.parse(await response.text());
95
- return data["result"];
97
+ result = None;
98
+ try {
99
+ if payload["data"] and payload["data"]["result"] {
100
+ result = payload["data"]["result"];
101
+ }
102
+ } except Exception { }
103
+ return result;
96
104
  }
97
105
 
98
106
  impl jacSignup(username: str, password: str) -> dict {
@@ -106,7 +114,10 @@ impl jacSignup(username: str, password: str) -> dict {
106
114
  );
107
115
  if response.ok {
108
116
  data = JSON.parse(await response.text());
109
- token = data["token"];
117
+ token = None;
118
+ if data["data"] and data["data"]["token"] {
119
+ token = data["data"]["token"];
120
+ }
110
121
  if token {
111
122
  __setLocalStorage("jac_token", token);
112
123
  return {"success": True, "token": token, "username": username};
@@ -139,7 +150,14 @@ impl jacLogin(username: str, password: str) -> bool {
139
150
  );
140
151
  if response.ok {
141
152
  data = JSON.parse(await response.text());
142
- token = data["token"];
153
+ console.log("data", data);
154
+ token = None;
155
+ try {
156
+ if data["data"] and data["data"]["token"] {
157
+ token = data["data"]["token"];
158
+ }
159
+ } except Exception { }
160
+ console.log("token", token);
143
161
  if token {
144
162
  __setLocalStorage("jac_token", token);
145
163
  return True;
@@ -175,3 +193,157 @@ impl __removeLocalStorage(key: str) -> None {
175
193
  storage.removeItem(key);
176
194
  }
177
195
  }
196
+
197
+ impl ErrorFallback(error: str, resetErrorBoundary: any) -> any {
198
+ return
199
+ <div
200
+ role="alert"
201
+ style={{
202
+ minHeight: "100vh",
203
+ display: "flex",
204
+ justifyContent: "center",
205
+ alignItems: "center",
206
+ backgroundColor: "#f9fafb",
207
+ fontFamily: "system-ui, sans-serif",
208
+
209
+ }}
210
+ >
211
+ <div
212
+ role="alert"
213
+ style={{
214
+ minHeight: "100vh",
215
+ display: "flex",
216
+ flexDirection: "column",
217
+ justifyContent: "center",
218
+ alignItems: "center",
219
+ backgroundColor: "#f9fafb",
220
+ fontFamily: "system-ui, sans-serif",
221
+
222
+ }}
223
+ >
224
+ <h2 style={{color: "#dc2626", marginBottom: "12px"}}>
225
+ 🚨 Something went wrong
226
+ </h2>
227
+ <p style={{color: "#374151", marginBottom: "16px"}}>
228
+ An unexpected error occurred. Please try again.
229
+ </p>
230
+ <pre
231
+ style={{
232
+ color: "#991b1b",
233
+ background: "#fee2e2",
234
+ padding: "12px",
235
+ borderRadius: "8px",
236
+ fontSize: "14px",
237
+ overflowX: "auto",
238
+ marginBottom: "16px",
239
+
240
+ }}
241
+ >
242
+ {error.error.message}
243
+ </pre>
244
+ <button
245
+ onClick={lambda -> None { error.resetErrorBoundary();}}
246
+ style={{
247
+ backgroundColor: "#2563eb",
248
+ color: "#fff",
249
+ padding: "10px 16px",
250
+ borderRadius: "8px",
251
+ border: "none",
252
+ cursor: "pointer",
253
+ fontSize: "14px",
254
+
255
+ }}
256
+ >
257
+ 🔄 Try again
258
+ </button>
259
+ </div>
260
+ </div>;
261
+ }
262
+
263
+ impl errorOverlay(filePath: str, errors: str) -> any {
264
+ return (
265
+ <div
266
+ style={{
267
+ position: "fixed",
268
+ top: 0,
269
+ left: 0,
270
+ width: "100%",
271
+ height: "100%",
272
+ background: "rgba(0, 0, 0, 0.85)",
273
+ color: "#fff",
274
+ fontFamily: "'Monaco', 'Menlo', 'Ubuntu Mono', monospace",
275
+ fontSize: 14,
276
+ zIndex: 999999,
277
+ overflow: "auto",
278
+ padding: 20,
279
+ boxSizing: "border-box",
280
+
281
+ }}
282
+ >
283
+ <div style={{maxWidth: 1200, margin: "0 auto"}}>
284
+ <div
285
+ style={{
286
+ background: "#d32f2f",
287
+ color: "white",
288
+ padding: "16px 24px",
289
+ borderRadius: "8px 8px 0 0",
290
+ fontSize: 18,
291
+ fontWeight: "bold",
292
+
293
+ }}
294
+ >
295
+ ⚠️ Compilation Error
296
+ </div>
297
+ <div
298
+ style={{
299
+ background: "#1e1e1e",
300
+ padding: 24,
301
+ borderRadius: "0 0 8px 8px",
302
+
303
+ }}
304
+ >
305
+ <div style={{marginBottom: 16}}>
306
+ <div style={{color: "#888", marginBottom: 8}}>
307
+ File:
308
+ </div>
309
+ <div style={{color: "#64b5f6", fontWeight: "bold"}}>
310
+ {filePath}
311
+ </div>
312
+ </div>
313
+ <div>
314
+ <div style={{color: "#888", marginBottom: 8}}>
315
+ Error:
316
+ </div>
317
+ <pre
318
+ style={{
319
+ background: "#2d2d2d",
320
+ padding: 16,
321
+ borderRadius: 4,
322
+ overflowX: "auto",
323
+ margin: 0,
324
+ borderLeft: "4px solid #d32f2f",
325
+ lineHeight: 1.6,
326
+ color: "#ff6b6b",
327
+
328
+ }}
329
+ >
330
+ {errors}
331
+ </pre>
332
+ </div>
333
+ <div
334
+ style={{
335
+ marginTop: 24,
336
+ paddingTop: 16,
337
+ borderTop: "1px solid #444",
338
+ color: "#888",
339
+ fontSize: 13,
340
+
341
+ }}
342
+ >
343
+ 💡 Fix the error and save the file to continue development.
344
+ </div>
345
+ </div>
346
+ </div>
347
+ </div>
348
+ );
349
+ }