frontend-hamroun 1.2.84 → 1.2.88

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 (310) hide show
  1. package/dist/batch.d.ts +4 -0
  2. package/dist/batch.d.ts.map +1 -0
  3. package/dist/batch.js +22 -0
  4. package/dist/client-router.d.ts +61 -0
  5. package/dist/client-router.d.ts.map +1 -0
  6. package/dist/client-router.js +209 -0
  7. package/dist/component.d.ts +15 -0
  8. package/dist/component.d.ts.map +1 -0
  9. package/dist/component.js +84 -0
  10. package/dist/components/Counter.d.ts +1 -0
  11. package/dist/components/Counter.d.ts.map +1 -0
  12. package/dist/components/Counter.js +2 -0
  13. package/dist/context.d.ts +5 -0
  14. package/dist/context.d.ts.map +1 -0
  15. package/dist/context.js +23 -0
  16. package/dist/event-bus.d.ts +24 -0
  17. package/dist/event-bus.d.ts.map +1 -0
  18. package/dist/event-bus.js +74 -0
  19. package/dist/forms.d.ts +41 -0
  20. package/dist/forms.d.ts.map +1 -0
  21. package/dist/forms.js +147 -0
  22. package/dist/hooks.d.ts +12 -0
  23. package/dist/hooks.d.ts.map +1 -0
  24. package/dist/hooks.js +142 -0
  25. package/dist/index.cjs +1118 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.client.d.ts +13 -0
  28. package/dist/index.client.d.ts.map +1 -0
  29. package/dist/index.client.js +12 -25
  30. package/dist/index.d.ts +65 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +1040 -264
  33. package/dist/index.js.map +1 -1
  34. package/dist/jsx-dev-runtime.cjs +102 -0
  35. package/dist/jsx-dev-runtime.cjs.map +1 -0
  36. package/dist/jsx-dev-runtime.d.ts +3 -0
  37. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  38. package/dist/jsx-dev-runtime.js +96 -0
  39. package/dist/jsx-dev-runtime.js.map +1 -0
  40. package/dist/jsx-runtime/jsx-runtime.d.ts +5 -0
  41. package/dist/jsx-runtime/jsx-runtime.d.ts.map +1 -0
  42. package/dist/jsx-runtime/jsx-runtime.js +40 -0
  43. package/dist/jsx-runtime.cjs +112 -1
  44. package/dist/jsx-runtime.cjs.map +1 -1
  45. package/dist/jsx-runtime.d.ts +18 -0
  46. package/dist/jsx-runtime.d.ts.map +1 -0
  47. package/dist/jsx-runtime.js +90 -79
  48. package/dist/jsx-runtime.js.map +1 -1
  49. package/dist/lifecycle-events.d.ts +109 -0
  50. package/dist/lifecycle-events.d.ts.map +1 -0
  51. package/dist/lifecycle-events.js +176 -0
  52. package/dist/renderComponent.d.ts +14 -0
  53. package/dist/renderComponent.d.ts.map +1 -0
  54. package/dist/renderComponent.js +29 -0
  55. package/dist/renderer.d.ts +4 -0
  56. package/dist/renderer.d.ts.map +1 -0
  57. package/dist/renderer.js +49 -0
  58. package/dist/router.d.ts +56 -0
  59. package/dist/router.d.ts.map +1 -0
  60. package/dist/router.js +165 -0
  61. package/dist/server-renderer.d.ts +2 -0
  62. package/dist/server-renderer.d.ts.map +1 -0
  63. package/dist/server-renderer.js +111 -5
  64. package/dist/server-types.d.ts +43 -0
  65. package/dist/server-types.d.ts.map +1 -0
  66. package/dist/server-types.js +5 -0
  67. package/dist/store.d.ts +42 -0
  68. package/dist/store.d.ts.map +1 -0
  69. package/dist/store.js +98 -0
  70. package/dist/types.d.ts +272 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +2 -0
  73. package/dist/utils.d.ts +47 -0
  74. package/dist/utils.d.ts.map +1 -0
  75. package/dist/utils.js +143 -0
  76. package/dist/vdom.d.ts +9 -0
  77. package/dist/vdom.d.ts.map +1 -0
  78. package/dist/vdom.js +21 -0
  79. package/dist/wasm.d.ts +37 -0
  80. package/dist/wasm.d.ts.map +1 -0
  81. package/dist/wasm.js +158 -0
  82. package/package.json +54 -83
  83. package/templates/basic-app/build.d.ts +2 -0
  84. package/templates/basic-app/build.d.ts.map +1 -0
  85. package/templates/basic-app/dev.d.ts +2 -0
  86. package/templates/basic-app/dev.d.ts.map +1 -0
  87. package/templates/basic-app/esbuild.config.d.ts +2 -0
  88. package/templates/basic-app/esbuild.config.d.ts.map +1 -0
  89. package/templates/basic-app/postcss.config.d.ts +8 -0
  90. package/templates/basic-app/postcss.config.d.ts.map +1 -0
  91. package/templates/basic-app/server.d.ts +2 -0
  92. package/templates/basic-app/server.d.ts.map +1 -0
  93. package/templates/basic-app/src/App.d.ts +2 -0
  94. package/templates/basic-app/src/App.d.ts.map +1 -0
  95. package/templates/basic-app/src/App.js +148 -0
  96. package/templates/basic-app/src/client.d.ts +2 -0
  97. package/templates/basic-app/src/client.d.ts.map +1 -0
  98. package/templates/basic-app/src/client.js +6 -0
  99. package/templates/basic-app/src/components/Counter.d.ts +4 -0
  100. package/templates/basic-app/src/components/Counter.d.ts.map +1 -0
  101. package/templates/basic-app/src/components/Counter.js +9 -0
  102. package/templates/basic-app/src/jsx-shim.d.ts +8 -0
  103. package/templates/basic-app/src/jsx-shim.d.ts.map +1 -0
  104. package/templates/basic-app/src/main.d.ts +2 -0
  105. package/templates/basic-app/src/main.d.ts.map +1 -0
  106. package/templates/basic-app/src/main.js +57 -0
  107. package/templates/basic-app/src/server.d.ts +2 -0
  108. package/templates/basic-app/src/server.d.ts.map +1 -0
  109. package/templates/basic-app/tailwind.config.d.ts +9 -0
  110. package/templates/basic-app/tailwind.config.d.ts.map +1 -0
  111. package/templates/basic-app/vite.config.d.ts +3 -0
  112. package/templates/basic-app/vite.config.d.ts.map +1 -0
  113. package/templates/basic-app/vite.config.js +7 -0
  114. package/templates/complete-app/api/hello.d.ts +1 -0
  115. package/templates/complete-app/api/hello.d.ts.map +1 -0
  116. package/templates/complete-app/client.d.ts +2 -0
  117. package/templates/complete-app/client.d.ts.map +1 -0
  118. package/templates/complete-app/lib/frontend-hamroun.d.ts +18 -0
  119. package/templates/complete-app/lib/frontend-hamroun.d.ts.map +1 -0
  120. package/templates/complete-app/pages/about.d.ts +7 -0
  121. package/templates/complete-app/pages/about.d.ts.map +1 -0
  122. package/templates/complete-app/pages/index.d.ts +7 -0
  123. package/templates/complete-app/pages/index.d.ts.map +1 -0
  124. package/templates/complete-app/pages/wasm-demo.d.ts +7 -0
  125. package/templates/complete-app/pages/wasm-demo.d.ts.map +1 -0
  126. package/templates/complete-app/public/client.d.ts +17 -0
  127. package/templates/complete-app/public/client.d.ts.map +1 -0
  128. package/templates/complete-app/server.d.ts +2 -0
  129. package/templates/complete-app/server.d.ts.map +1 -0
  130. package/templates/complete-app/server.js +236 -218
  131. package/templates/complete-app/src/App.d.ts +2 -0
  132. package/templates/complete-app/src/App.d.ts.map +1 -0
  133. package/templates/complete-app/src/App.js +27 -0
  134. package/templates/complete-app/src/client.d.ts +2 -0
  135. package/templates/complete-app/src/client.d.ts.map +1 -0
  136. package/templates/complete-app/src/client.js +52 -0
  137. package/templates/complete-app/src/pages/index.d.ts +2 -0
  138. package/templates/complete-app/src/pages/index.d.ts.map +1 -0
  139. package/templates/complete-app/src/pages/index.js +19 -0
  140. package/templates/complete-app/src/server.d.ts +2 -0
  141. package/templates/complete-app/src/server.d.ts.map +1 -0
  142. package/templates/complete-app/src/server.js +192 -0
  143. package/templates/complete-app/vite.config.d.ts +3 -0
  144. package/templates/complete-app/vite.config.d.ts.map +1 -0
  145. package/templates/complete-app/vite.config.js +29 -57
  146. package/templates/fullstack-app/api/hello.d.ts +4 -0
  147. package/templates/fullstack-app/api/hello.d.ts.map +1 -0
  148. package/templates/fullstack-app/api/hello.js +14 -11
  149. package/templates/fullstack-app/api/users/[id].d.ts +5 -0
  150. package/templates/fullstack-app/api/users/[id].d.ts.map +1 -0
  151. package/templates/fullstack-app/api/users/[id].js +52 -0
  152. package/templates/fullstack-app/api/users/index.d.ts +4 -0
  153. package/templates/fullstack-app/api/users/index.d.ts.map +1 -0
  154. package/templates/fullstack-app/api/users/index.js +25 -0
  155. package/templates/fullstack-app/build/main.d.ts +211 -0
  156. package/templates/fullstack-app/build/main.d.ts.map +1 -0
  157. package/templates/fullstack-app/build.d.ts +2 -0
  158. package/templates/fullstack-app/build.d.ts.map +1 -0
  159. package/templates/fullstack-app/build.js +190 -0
  160. package/templates/fullstack-app/postcss.config.d.ts +5 -0
  161. package/templates/fullstack-app/postcss.config.d.ts.map +1 -0
  162. package/templates/fullstack-app/process-tailwind.d.ts +2 -0
  163. package/templates/fullstack-app/process-tailwind.d.ts.map +1 -0
  164. package/templates/fullstack-app/public/route-handler.d.ts +1 -0
  165. package/templates/fullstack-app/public/route-handler.d.ts.map +1 -0
  166. package/templates/fullstack-app/server.d.ts +2 -0
  167. package/templates/fullstack-app/server.d.ts.map +1 -0
  168. package/templates/fullstack-app/server.js +428 -266
  169. package/templates/fullstack-app/src/client.d.ts +2 -0
  170. package/templates/fullstack-app/src/client.d.ts.map +1 -0
  171. package/templates/fullstack-app/src/components/ClientHome.d.ts +1 -0
  172. package/templates/fullstack-app/src/components/ClientHome.d.ts.map +1 -0
  173. package/templates/fullstack-app/src/components/ClientHome.js +1 -0
  174. package/templates/fullstack-app/src/components/ErrorBoundary.d.ts +7 -0
  175. package/templates/fullstack-app/src/components/ErrorBoundary.d.ts.map +1 -0
  176. package/templates/fullstack-app/src/components/ErrorBoundary.js +12 -0
  177. package/templates/fullstack-app/src/components/Layout.d.ts +7 -0
  178. package/templates/fullstack-app/src/components/Layout.d.ts.map +1 -0
  179. package/templates/fullstack-app/src/components/Layout.js +4 -0
  180. package/templates/fullstack-app/src/components/StateDemo.d.ts +2 -0
  181. package/templates/fullstack-app/src/components/StateDemo.d.ts.map +1 -0
  182. package/templates/fullstack-app/src/components/StateDemo.js +86 -0
  183. package/templates/fullstack-app/src/components/UserList.d.ts +11 -0
  184. package/templates/fullstack-app/src/components/UserList.d.ts.map +1 -0
  185. package/templates/fullstack-app/src/components/UserList.js +7 -0
  186. package/templates/fullstack-app/src/config.d.ts +29 -0
  187. package/templates/fullstack-app/src/config.d.ts.map +1 -0
  188. package/templates/fullstack-app/src/config.js +36 -0
  189. package/templates/fullstack-app/src/data/api.d.ts +35 -0
  190. package/templates/fullstack-app/src/data/api.d.ts.map +1 -0
  191. package/templates/fullstack-app/src/data/api.js +173 -0
  192. package/templates/fullstack-app/src/main.d.ts +7 -0
  193. package/templates/fullstack-app/src/main.d.ts.map +1 -0
  194. package/templates/fullstack-app/src/main.js +130 -0
  195. package/templates/fullstack-app/src/middleware.d.ts +10 -0
  196. package/templates/fullstack-app/src/middleware.d.ts.map +1 -0
  197. package/templates/fullstack-app/src/middleware.js +14 -0
  198. package/templates/fullstack-app/src/pages/404.d.ts +4 -0
  199. package/templates/fullstack-app/src/pages/404.d.ts.map +1 -0
  200. package/templates/fullstack-app/src/pages/404.js +4 -0
  201. package/templates/fullstack-app/src/pages/[id].d.ts +1 -0
  202. package/templates/fullstack-app/src/pages/[id].d.ts.map +1 -0
  203. package/templates/fullstack-app/src/pages/[id].js +1 -0
  204. package/templates/fullstack-app/src/pages/_app.d.ts +6 -0
  205. package/templates/fullstack-app/src/pages/_app.d.ts.map +1 -0
  206. package/templates/fullstack-app/src/pages/_app.js +6 -0
  207. package/templates/fullstack-app/src/pages/_document.d.ts +7 -0
  208. package/templates/fullstack-app/src/pages/_document.d.ts.map +1 -0
  209. package/templates/fullstack-app/src/pages/_document.js +4 -0
  210. package/templates/fullstack-app/src/pages/_error.d.ts +4 -0
  211. package/templates/fullstack-app/src/pages/_error.d.ts.map +1 -0
  212. package/templates/fullstack-app/src/pages/_error.js +8 -0
  213. package/templates/fullstack-app/src/pages/about/index.d.ts +5 -0
  214. package/templates/fullstack-app/src/pages/about/index.d.ts.map +1 -0
  215. package/templates/fullstack-app/src/pages/about/index.js +6 -0
  216. package/templates/fullstack-app/src/pages/about.d.ts +10 -0
  217. package/templates/fullstack-app/src/pages/about.d.ts.map +1 -0
  218. package/templates/fullstack-app/src/pages/about.js +21 -0
  219. package/templates/fullstack-app/src/pages/api/users/[id].d.ts +6 -0
  220. package/templates/fullstack-app/src/pages/api/users/[id].d.ts.map +1 -0
  221. package/templates/fullstack-app/src/pages/api/users/[id].js +51 -0
  222. package/templates/fullstack-app/src/pages/api/users/index.d.ts +4 -0
  223. package/templates/fullstack-app/src/pages/api/users/index.d.ts.map +1 -0
  224. package/templates/fullstack-app/src/pages/api/users/index.js +33 -0
  225. package/templates/fullstack-app/src/pages/index.d.ts +21 -0
  226. package/templates/fullstack-app/src/pages/index.d.ts.map +1 -0
  227. package/templates/fullstack-app/src/pages/index.js +66 -0
  228. package/templates/fullstack-app/src/pages/users/[id].d.ts +38 -0
  229. package/templates/fullstack-app/src/pages/users/[id].d.ts.map +1 -0
  230. package/templates/fullstack-app/src/pages/users/[id].js +79 -0
  231. package/templates/fullstack-app/src/pages/users.d.ts +14 -0
  232. package/templates/fullstack-app/src/pages/users.d.ts.map +1 -0
  233. package/templates/fullstack-app/src/pages/users.js +14 -0
  234. package/templates/fullstack-app/src/pages/wasm-demo.d.ts +1 -0
  235. package/templates/fullstack-app/src/pages/wasm-demo.d.ts.map +1 -0
  236. package/templates/fullstack-app/src/pages/wasm-demo.js +2 -0
  237. package/templates/fullstack-app/src/router.d.ts +22 -0
  238. package/templates/fullstack-app/src/router.d.ts.map +1 -0
  239. package/templates/fullstack-app/src/router.js +210 -0
  240. package/templates/fullstack-app/tailwind.config.d.ts +3 -0
  241. package/templates/fullstack-app/tailwind.config.d.ts.map +1 -0
  242. package/templates/fullstack-app/vite.config.d.ts +3 -0
  243. package/templates/fullstack-app/vite.config.d.ts.map +1 -0
  244. package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts +2 -0
  245. package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts.map +1 -0
  246. package/templates/ssr-template/dist/client.d.ts +85 -0
  247. package/templates/ssr-template/dist/client.d.ts.map +1 -0
  248. package/templates/ssr-template/dist/server.d.ts +2 -0
  249. package/templates/ssr-template/dist/server.d.ts.map +1 -0
  250. package/templates/ssr-template/esbuild.config.d.ts +2 -0
  251. package/templates/ssr-template/esbuild.config.d.ts.map +1 -0
  252. package/templates/ssr-template/jsx-shim.d.ts +2 -0
  253. package/templates/ssr-template/jsx-shim.d.ts.map +1 -0
  254. package/templates/ssr-template/src/App.d.ts +2 -0
  255. package/templates/ssr-template/src/App.d.ts.map +1 -0
  256. package/templates/ssr-template/src/App.js +625 -0
  257. package/templates/ssr-template/src/client.d.ts +2 -0
  258. package/templates/ssr-template/src/client.d.ts.map +1 -0
  259. package/templates/ssr-template/src/client.js +3 -0
  260. package/templates/ssr-template/src/server.d.ts +2 -0
  261. package/templates/ssr-template/src/server.d.ts.map +1 -0
  262. package/templates/ssr-template/src/server.js +29 -0
  263. package/templates/ssr-template/vite.config.d.ts +3 -0
  264. package/templates/ssr-template/vite.config.d.ts.map +1 -0
  265. package/templates/ssr-template/vite.config.js +30 -0
  266. package/templates/wasm/build-wasm.d.ts +2 -0
  267. package/templates/wasm/build-wasm.d.ts.map +1 -0
  268. package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts +30 -0
  269. package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts.map +1 -0
  270. package/templates/wasm/dist/wasm_exec.d.ts +1 -0
  271. package/templates/wasm/dist/wasm_exec.d.ts.map +1 -0
  272. package/templates/wasm/esbuild.config.d.ts +2 -0
  273. package/templates/wasm/esbuild.config.d.ts.map +1 -0
  274. package/templates/wasm/go/wasm_exec.d.ts +1 -0
  275. package/templates/wasm/go/wasm_exec.d.ts.map +1 -0
  276. package/templates/wasm/jsx-shim.d.ts +5 -0
  277. package/templates/wasm/jsx-shim.d.ts.map +1 -0
  278. package/templates/wasm/public/wasm_exec.d.ts +1 -0
  279. package/templates/wasm/public/wasm_exec.d.ts.map +1 -0
  280. package/templates/wasm/src/App.d.ts +2 -0
  281. package/templates/wasm/src/App.d.ts.map +1 -0
  282. package/templates/wasm/src/App.js +381 -0
  283. package/templates/wasm/src/client.d.ts +2 -0
  284. package/templates/wasm/src/client.d.ts.map +1 -0
  285. package/templates/wasm/src/client.js +210 -0
  286. package/templates/wasm/src/index.d.ts +2 -0
  287. package/templates/wasm/src/index.d.ts.map +1 -0
  288. package/templates/wasm/src/index.js +20 -0
  289. package/templates/wasm/src/server.d.ts +2 -0
  290. package/templates/wasm/src/server.d.ts.map +1 -0
  291. package/templates/wasm/src/server.js +131 -0
  292. package/templates/wasm/vite.config.d.ts +3 -0
  293. package/templates/wasm/vite.config.d.ts.map +1 -0
  294. package/templates/wasm/vite.config.js +36 -0
  295. package/templates/wasm/wasm-loader.d.ts +6 -0
  296. package/templates/wasm/wasm-loader.d.ts.map +1 -0
  297. package/dist/index.client.cjs +0 -2
  298. package/dist/index.client.cjs.map +0 -1
  299. package/dist/index.client.js.map +0 -1
  300. package/dist/renderer-DaVfBeVi.cjs +0 -2
  301. package/dist/renderer-DaVfBeVi.cjs.map +0 -1
  302. package/dist/renderer-nfT7XSpo.js +0 -61
  303. package/dist/renderer-nfT7XSpo.js.map +0 -1
  304. package/dist/server-renderer-B5b0Q0ck.cjs +0 -2
  305. package/dist/server-renderer-B5b0Q0ck.cjs.map +0 -1
  306. package/dist/server-renderer-C4MB-jAp.js +0 -248
  307. package/dist/server-renderer-C4MB-jAp.js.map +0 -1
  308. package/dist/server-renderer.cjs +0 -2
  309. package/dist/server-renderer.cjs.map +0 -1
  310. package/dist/server-renderer.js.map +0 -1
package/dist/wasm.js ADDED
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Go WebAssembly Integration Utilities
3
+ *
4
+ * This module provides tools for loading and interacting with Go WASM modules
5
+ * in browser and server environments.
6
+ */
7
+ const DEFAULT_GO_WASM_PATH = '/wasm_exec.js';
8
+ /**
9
+ * Load a Go WASM module from a URL
10
+ */
11
+ export async function loadGoWasm(wasmUrl, options = {}) {
12
+ const { importObject = {}, goWasmPath = DEFAULT_GO_WASM_PATH, loadGo = true, onLoad, debug = false } = options;
13
+ // In browser environment, load the Go WASM runtime
14
+ if (typeof window !== 'undefined' && loadGo) {
15
+ await loadGoRuntime(goWasmPath);
16
+ }
17
+ try {
18
+ // Create Go instance for WASM
19
+ // @ts-ignore - Go is loaded from the global scope
20
+ const go = typeof Go !== 'undefined' ? new Go() : null;
21
+ // Fetch and instantiate the WASM module
22
+ if (debug)
23
+ console.log(`[WASM] Loading module from ${wasmUrl}`);
24
+ const response = await fetch(wasmUrl);
25
+ if (!response.ok) {
26
+ throw new Error(`Failed to fetch WASM module: ${response.statusText}`);
27
+ }
28
+ const buffer = await response.arrayBuffer();
29
+ const module = await WebAssembly.compile(buffer);
30
+ // Create imports object, combining Go runtime with custom imports
31
+ const finalImportObject = go ? {
32
+ ...go.importObject,
33
+ ...importObject
34
+ } : importObject;
35
+ // Instantiate the WASM module
36
+ const instance = await WebAssembly.instantiate(module, finalImportObject);
37
+ // Initialize Go runtime if available
38
+ if (go) {
39
+ go.run(instance);
40
+ }
41
+ // Extract exported functions
42
+ const exports = instance.exports;
43
+ const functions = {};
44
+ // Generate wrapper functions for all exports that are functions
45
+ for (const key in exports) {
46
+ if (typeof exports[key] === 'function') {
47
+ // Type assertion to ensure the exports[key] is callable
48
+ const exportedFn = exports[key];
49
+ functions[key] = (...args) => exportedFn(...args);
50
+ if (debug) {
51
+ const originalFn = functions[key];
52
+ functions[key] = (...args) => {
53
+ console.log(`[WASM] Calling ${key}(${args.join(', ')})`);
54
+ const result = originalFn(...args);
55
+ console.log(`[WASM] ${key} returned:`, result);
56
+ return result;
57
+ };
58
+ }
59
+ }
60
+ }
61
+ // Add any globally exported functions from Go
62
+ if (typeof window !== 'undefined') {
63
+ for (const key in window) {
64
+ if (key.startsWith('go') && typeof window[key] === 'function') {
65
+ // Type assertion to ensure the window[key] is callable
66
+ const globalFn = window[key];
67
+ functions[key] = (...args) => globalFn(...args);
68
+ if (debug) {
69
+ const originalFn = functions[key];
70
+ functions[key] = (...args) => {
71
+ console.log(`[WASM] Calling global ${key}(${args.join(', ')})`);
72
+ const result = originalFn(...args);
73
+ console.log(`[WASM] ${key} returned:`, result);
74
+ return result;
75
+ };
76
+ }
77
+ }
78
+ }
79
+ }
80
+ const wasmInstance = {
81
+ instance,
82
+ module,
83
+ exports,
84
+ functions
85
+ };
86
+ // Run onLoad callback if provided
87
+ if (onLoad) {
88
+ onLoad(wasmInstance);
89
+ }
90
+ return wasmInstance;
91
+ }
92
+ catch (error) {
93
+ console.error('[WASM] Failed to load Go WASM module:', error);
94
+ throw error;
95
+ }
96
+ }
97
+ /**
98
+ * Load the Go WASM runtime script
99
+ */
100
+ async function loadGoRuntime(path = DEFAULT_GO_WASM_PATH) {
101
+ if (typeof window === 'undefined')
102
+ return;
103
+ // Check if Go runtime is already loaded
104
+ if (typeof window.Go !== 'undefined') {
105
+ return;
106
+ }
107
+ // Load the Go WASM runtime script
108
+ return new Promise((resolve, reject) => {
109
+ const script = document.createElement('script');
110
+ script.src = path;
111
+ script.onload = () => resolve();
112
+ script.onerror = () => reject(new Error(`Failed to load Go WASM runtime from ${path}`));
113
+ document.head.appendChild(script);
114
+ });
115
+ }
116
+ /**
117
+ * Create a TypeScript-friendly wrapper for Go WASM functions
118
+ */
119
+ export function createTypedWasmFunction(instance, functionName) {
120
+ if (!instance.functions[functionName]) {
121
+ throw new Error(`WASM function "${functionName}" not found`);
122
+ }
123
+ return instance.functions[functionName];
124
+ }
125
+ /**
126
+ * Helper to convert JavaScript values to Go-compatible formats
127
+ */
128
+ export const goValues = {
129
+ // Convert JS string to Go string (returns memory pointer)
130
+ stringToGo: (instance, str) => {
131
+ if (!instance.functions.__stringToGo) {
132
+ throw new Error('__stringToGo function not found in WASM module');
133
+ }
134
+ return instance.functions.__stringToGo(str);
135
+ },
136
+ // Convert Go string (memory pointer) to JS string
137
+ stringFromGo: (instance, ptr) => {
138
+ if (!instance.functions.__stringFromGo) {
139
+ throw new Error('__stringFromGo function not found in WASM module');
140
+ }
141
+ return instance.functions.__stringFromGo(ptr);
142
+ },
143
+ // Convert JS object to Go (returns memory pointer)
144
+ objectToGo: (instance, obj) => {
145
+ if (!instance.functions.__objectToGo) {
146
+ throw new Error('__objectToGo function not found in WASM module');
147
+ }
148
+ return instance.functions.__objectToGo(JSON.stringify(obj));
149
+ },
150
+ // Convert Go object (memory pointer) to JS object
151
+ objectFromGo: (instance, ptr) => {
152
+ if (!instance.functions.__objectFromGo) {
153
+ throw new Error('__objectFromGo function not found in WASM module');
154
+ }
155
+ const str = instance.functions.__objectFromGo(ptr);
156
+ return JSON.parse(str);
157
+ }
158
+ };
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.2.84",
4
- "description": "A lightweight full-stack JavaScript framework",
5
- "type": "module",
6
- "main": "dist/index.cjs",
3
+ "version": "1.2.88",
4
+ "description": "A lightweight frontend JavaScript framework with React-like syntax",
5
+ "main": "dist/index.js",
7
6
  "module": "dist/index.js",
8
7
  "types": "dist/index.d.ts",
8
+ "type": "module",
9
9
  "exports": {
10
10
  ".": {
11
+ "types": "./dist/index.d.ts",
11
12
  "import": "./dist/index.js",
12
13
  "require": "./dist/index.cjs",
13
- "types": "./dist/index.d.ts"
14
- },
15
- "./client": {
16
- "import": "./dist/index.client.js",
17
- "require": "./dist/index.client.cjs",
18
- "types": "./dist/index.client.d.ts"
19
- },
20
- "./server": {
21
- "import": "./dist/server-renderer.js",
22
- "require": "./dist/server-renderer.cjs",
23
- "types": "./dist/server-renderer.d.ts"
14
+ "default": "./dist/index.js"
24
15
  },
25
16
  "./jsx-runtime": {
17
+ "types": "./dist/jsx-runtime.d.ts",
26
18
  "import": "./dist/jsx-runtime.js",
27
- "require": "./dist/jsx-runtime.cjs",
28
- "types": "./dist/jsx-runtime.d.ts"
19
+ "default": "./dist/jsx-runtime.js"
20
+ },
21
+ "./jsx-dev-runtime": {
22
+ "types": "./dist/jsx-runtime.d.ts",
23
+ "import": "./dist/jsx-runtime.js",
24
+ "default": "./dist/jsx-runtime.js"
25
+ },
26
+ "./types": {
27
+ "types": "./dist/types.d.ts",
28
+ "default": "./dist/types.d.ts"
29
29
  }
30
30
  },
31
- "bin": {
32
- "frontend-hamroun": "./bin/cli.js"
33
- },
34
31
  "files": [
35
32
  "dist",
36
- "bin",
37
33
  "templates",
34
+ "bin",
38
35
  "README.md",
39
36
  "LICENSE"
40
37
  ],
38
+ "bin": {
39
+ "frontend-hamroun": "./bin/cli.js"
40
+ },
41
41
  "scripts": {
42
- "build": "tsc && vite build",
43
- "dev": "vite",
42
+ "build": "npm run clean && npm run build:main && npm run build:rollup",
43
+ "build:main": "tsc --project tsconfig.json",
44
+ "build:rollup": "rollup -c",
45
+ "dev": "tsc --watch",
44
46
  "test": "jest",
45
- "test:watch": "jest --watch",
46
- "test:coverage": "jest --coverage",
47
47
  "lint": "eslint src --ext .ts,.tsx",
48
- "lint:fix": "eslint src --ext .ts,.tsx --fix",
49
- "format": "prettier --write src/**/*.{ts,tsx}",
50
- "type-check": "tsc --noEmit",
51
- "prepublishOnly": "npm run build",
52
- "clean": "rimraf dist"
48
+ "prepare": "npm run build",
49
+ "clean": "rimraf dist",
50
+ "prepublishOnly": "npm run build"
53
51
  },
54
52
  "keywords": [
55
- "javascript",
56
53
  "frontend",
57
54
  "framework",
58
- "ssr",
59
- "reactive",
55
+ "react",
56
+ "jsx",
57
+ "hooks",
58
+ "spa",
59
+ "client-side",
60
60
  "lightweight"
61
61
  ],
62
- "author": "Hamroun",
62
+ "author": "Frontend Hamroun Team",
63
63
  "license": "MIT",
64
64
  "repository": {
65
65
  "type": "git",
@@ -69,59 +69,30 @@
69
69
  "url": "https://github.com/hamroun/frontend-hamroun/issues"
70
70
  },
71
71
  "homepage": "https://github.com/hamroun/frontend-hamroun#readme",
72
- "devDependencies": {
73
- "@types/cors": "^2.8.18",
74
- "@types/express": "^5.0.2",
75
- "@types/jest": "^29.5.5",
76
- "@types/jsonwebtoken": "^9.0.9",
77
- "@types/node": "^20.6.3",
78
- "@types/pg": "^8.15.2",
79
- "@typescript-eslint/eslint-plugin": "^6.7.2",
80
- "@typescript-eslint/parser": "^6.7.2",
81
- "eslint": "^8.49.0",
82
- "eslint-config-prettier": "^9.0.0",
83
- "eslint-plugin-prettier": "^5.0.0",
84
- "jest": "^29.7.0",
85
- "prettier": "^3.0.3",
86
- "rimraf": "^5.0.1",
87
- "terser": "^5.19.4",
88
- "ts-jest": "^29.1.1",
89
- "typescript": "^5.2.2",
90
- "vite": "^5.0.0"
91
- },
92
- "dependencies": {
93
- "bcryptjs": "^3.0.2",
94
- "boxen": "^7.1.1",
95
- "chalk": "^5.3.0",
96
- "commander": "^11.0.0",
97
- "express": "^5.1.0",
98
- "figlet": "^1.6.0",
99
- "fs-extra": "^11.1.1",
100
- "gradient-string": "^2.0.2",
101
- "inquirer": "^9.2.11",
102
- "jsonwebtoken": "^9.0.2",
103
- "mongodb": "^6.16.0",
104
- "mysql2": "^3.14.1",
105
- "nanospinner": "^1.1.0",
106
- "ora": "^7.0.1",
107
- "pg": "^8.16.0",
108
- "terminal-link": "^3.0.0",
109
- "update-notifier": "^7.0.0"
110
- },
111
72
  "peerDependencies": {
112
- "react": ">=16.8.0",
113
- "react-dom": ">=16.8.0"
73
+ "typescript": "^4.0.0 || ^5.0.0"
114
74
  },
115
75
  "peerDependenciesMeta": {
116
- "react": {
117
- "optional": true
118
- },
119
- "react-dom": {
76
+ "typescript": {
120
77
  "optional": true
121
78
  }
122
79
  },
123
- "engines": {
124
- "node": ">=18.0.0",
125
- "npm": ">=8.0.0"
80
+ "devDependencies": {
81
+ "@types/node": "^20.0.0",
82
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
83
+ "@typescript-eslint/parser": "^6.0.0",
84
+ "eslint": "^8.0.0",
85
+ "jest": "^29.0.0",
86
+ "rimraf": "^5.0.0",
87
+ "rollup": "^3.0.0",
88
+ "rollup-plugin-typescript2": "^0.36.0",
89
+ "typescript": "^5.0.0"
90
+ },
91
+ "dependencies": {
92
+ "commander": "^11.0.0",
93
+ "inquirer": "^9.0.0",
94
+ "chalk": "^5.0.0",
95
+ "boxen": "^7.0.0",
96
+ "nanospinner": "^1.1.0"
126
97
  }
127
- }
98
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["build.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["dev.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=esbuild.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.config.d.ts","sourceRoot":"","sources":["esbuild.config.js"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ declare namespace _default {
2
+ namespace plugins {
3
+ let tailwindcss: {};
4
+ let autoprefixer: {};
5
+ }
6
+ }
7
+ export default _default;
8
+ //# sourceMappingURL=postcss.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postcss.config.d.ts","sourceRoot":"","sources":["postcss.config.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["server.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function App(): JSX.Element;
2
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["App.tsx"],"names":[],"mappings":"AAwFA,wBAAgB,GAAG,gBA2TlB"}
@@ -0,0 +1,148 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "frontend-hamroun/jsx-runtime";
2
+ import { useState, useEffect, useMemo, useErrorBoundary, useForm } from 'frontend-hamroun';
3
+ // Todo Item Component
4
+ function TodoItem({ todo, onToggle, onDelete }) {
5
+ return (_jsxs("div", { className: `todo-item ${todo.completed ? 'completed' : ''}`, children: [_jsx("input", { type: "checkbox", checked: todo.completed, onChange: () => onToggle(todo.id), className: "todo-checkbox" }), _jsx("span", { className: "todo-text", children: todo.text }), _jsxs("span", { className: `todo-priority priority-${todo.priority}`, children: [todo.priority === 'high' && '🔴', todo.priority === 'medium' && '🟡', todo.priority === 'low' && '🟢', todo.priority] }), _jsx("div", { className: "todo-actions", children: _jsx("button", { onClick: () => onDelete(todo.id), className: "btn btn-sm btn-danger", title: "Delete todo", children: "\uD83D\uDDD1\uFE0F" }) })] }));
6
+ }
7
+ // Theme Toggle Button Component
8
+ function ThemeToggleButton({ theme, onToggle }) {
9
+ return (_jsx("button", { onClick: onToggle, className: "btn btn-secondary theme-toggle", title: "Toggle theme", children: theme === 'light' ? '🌙' : '☀️' }));
10
+ }
11
+ // App Footer Component
12
+ function AppFooter({ theme }) {
13
+ return (_jsx("footer", { className: "app-footer", children: _jsxs("div", { className: "container", children: [_jsx("p", { children: "Built with Frontend Hamroun \u2022 Hooks: useState, useEffect, useMemo, useErrorBoundary, useForm" }), _jsxs("p", { children: ["Theme: ", _jsx("strong", { children: theme }), " \u2022 Environment: ", _jsx("strong", { children: "Client" })] })] }) }));
14
+ }
15
+ export function App() {
16
+ // State hooks with proper typing
17
+ const [todos, setTodos] = useState([
18
+ { id: 1, text: 'Learn Frontend Hamroun hooks', completed: false, priority: 'high' },
19
+ { id: 2, text: 'Build a todo app', completed: false, priority: 'medium' },
20
+ { id: 3, text: 'Master client-side concepts', completed: true, priority: 'low' }
21
+ ]);
22
+ const [theme, setTheme] = useState('light');
23
+ const [taskFilter, setTaskFilter] = useState('all');
24
+ // Error boundary hook
25
+ const [error, resetError] = useErrorBoundary();
26
+ // Form hook for adding new todos
27
+ const addTodoForm = useForm({
28
+ initialValues: {
29
+ text: '',
30
+ priority: 'medium'
31
+ },
32
+ validate: (values) => {
33
+ const errors = {};
34
+ if (!values.text.trim()) {
35
+ errors.text = 'Todo text is required';
36
+ }
37
+ return errors;
38
+ },
39
+ onSubmit: (values) => {
40
+ const newTodo = {
41
+ id: Date.now(),
42
+ text: values.text.trim(),
43
+ completed: false,
44
+ priority: values.priority
45
+ };
46
+ setTodos(prev => [...prev, newTodo]);
47
+ addTodoForm.resetForm();
48
+ }
49
+ });
50
+ // Mount effect
51
+ useEffect(() => {
52
+ console.log('Todo App mounted');
53
+ // Load saved todos from localStorage
54
+ const savedTodos = localStorage.getItem('todos');
55
+ const savedTheme = localStorage.getItem('theme');
56
+ if (savedTodos) {
57
+ try {
58
+ setTodos(JSON.parse(savedTodos));
59
+ }
60
+ catch (e) {
61
+ console.error('Failed to load saved todos');
62
+ }
63
+ }
64
+ if (savedTheme) {
65
+ setTheme(savedTheme);
66
+ }
67
+ return () => {
68
+ console.log('Todo App unmounting');
69
+ };
70
+ }, []);
71
+ // Theme effect
72
+ useEffect(() => {
73
+ document.body.className = `theme-${theme}`;
74
+ document.documentElement.setAttribute('data-theme', theme);
75
+ localStorage.setItem('theme', theme);
76
+ }, [theme]);
77
+ // Save todos effect
78
+ useEffect(() => {
79
+ if (todos.length === 0)
80
+ return;
81
+ localStorage.setItem('todos', JSON.stringify(todos));
82
+ }, [todos]);
83
+ // Memoized filtered todos
84
+ const filteredTodos = useMemo(() => {
85
+ console.log('Filtering todos - memoized computation');
86
+ return todos.filter(todo => {
87
+ if (taskFilter === 'completed')
88
+ return todo.completed;
89
+ if (taskFilter === 'active')
90
+ return !todo.completed;
91
+ if (taskFilter === 'high')
92
+ return todo.priority === 'high';
93
+ if (taskFilter === 'medium')
94
+ return todo.priority === 'medium';
95
+ if (taskFilter === 'low')
96
+ return todo.priority === 'low';
97
+ return true;
98
+ });
99
+ }, [todos, taskFilter]);
100
+ // Memoized todo stats
101
+ const todoStats = useMemo(() => {
102
+ const total = todos.length;
103
+ const completed = todos.filter(t => t.completed).length;
104
+ const active = total - completed;
105
+ const highPriority = todos.filter(t => t.priority === 'high' && !t.completed).length;
106
+ return { total, completed, active, highPriority };
107
+ }, [todos]);
108
+ // Todo action handlers
109
+ const handleToggleTodo = (id) => {
110
+ console.log('Toggling todo:', id);
111
+ setTodos(prev => prev.map(todo => todo.id === id ? { ...todo, completed: !todo.completed } : todo));
112
+ };
113
+ const handleDeleteTodo = (id) => {
114
+ console.log('Deleting todo:', id);
115
+ setTodos(prev => prev.filter(todo => todo.id !== id));
116
+ };
117
+ // Event handlers
118
+ const clearCompleted = () => {
119
+ setTodos(prev => prev.filter(todo => !todo.completed));
120
+ };
121
+ const markAllComplete = () => {
122
+ setTodos(prev => prev.map(todo => ({ ...todo, completed: true })));
123
+ };
124
+ const toggleTheme = () => {
125
+ setTheme(prev => prev === 'light' ? 'dark' : 'light');
126
+ };
127
+ const simulateError = () => {
128
+ throw new Error('Simulated error for testing error boundary');
129
+ };
130
+ if (error) {
131
+ return (_jsxs("div", { className: "error-container", children: [_jsx("h2", { children: "Something went wrong!" }), _jsx("p", { children: error.message }), _jsx("button", { onClick: resetError, className: "btn btn-primary", children: "Try Again" })] }));
132
+ }
133
+ return (_jsxs("div", { className: `app theme-${theme}`, children: [_jsx("header", { className: "app-header", children: _jsxs("div", { className: "container", children: [_jsxs("h1", { className: "app-title", children: ["\uD83D\uDCDD Todo App", _jsx("span", { className: "subtitle", children: "Built with Frontend Hamroun" })] }), _jsxs("div", { className: "header-controls", children: [_jsx(ThemeToggleButton, { theme: theme, onToggle: toggleTheme }), _jsxs("div", { className: "stats", children: [_jsxs("span", { className: "stat", children: ["Total: ", _jsx("strong", { children: todoStats.total })] }), _jsxs("span", { className: "stat", children: ["Active: ", _jsx("strong", { children: todoStats.active })] }), _jsxs("span", { className: "stat", children: ["Done: ", _jsx("strong", { children: todoStats.completed })] })] })] })] }) }), _jsx("main", { className: "main-content", children: _jsxs("div", { className: "container", children: [_jsxs("section", { className: "card add-todo-section", children: [_jsx("h2", { children: "\u2795 Add New Todo" }), _jsxs("form", { onSubmit: addTodoForm.handleSubmit, className: "add-todo-form", children: [_jsx("input", { type: "text", name: "text", value: addTodoForm.values.text, onChange: addTodoForm.handleChange, onBlur: addTodoForm.handleBlur, placeholder: "What needs to be done?", className: `input todo-input ${addTodoForm.errors.text && addTodoForm.touched.text ? 'error' : ''}` }), _jsxs("select", { name: "priority", value: addTodoForm.values.priority, onChange: addTodoForm.handleChange, className: "select priority-select", children: [_jsx("option", { value: "low", children: "\uD83D\uDFE2 Low Priority" }), _jsx("option", { value: "medium", children: "\uD83D\uDFE1 Medium Priority" }), _jsx("option", { value: "high", children: "\uD83D\uDD34 High Priority" })] }), _jsx("button", { type: "submit", className: `btn btn-primary add-btn ${addTodoForm.isSubmitting ? 'loading' : ''}`, disabled: addTodoForm.isSubmitting || !addTodoForm.values.text.trim(), children: addTodoForm.isSubmitting ? '⏳ Adding...' : '➕ Add Todo' })] }), addTodoForm.errors.text && addTodoForm.touched.text && (_jsx("div", { className: "error-message", children: addTodoForm.errors.text }))] }), _jsxs("section", { className: "card filters-section", children: [_jsx("h2", { children: "\uD83D\uDD0D Filter Todos" }), _jsx("div", { className: "filters", children: ['all', 'active', 'completed', 'high', 'medium', 'low'].map(filterType => (_jsxs("button", { onClick: () => setTaskFilter(filterType), className: `btn btn-sm filter-btn ${taskFilter === filterType ? 'btn-primary' : 'btn-outline'}`, children: [filterType === 'all' && '📋 All', filterType === 'active' && '⏳ Active', filterType === 'completed' && '✅ Completed', filterType === 'high' && '🔴 High Priority', filterType === 'medium' && '🟡 Medium Priority', filterType === 'low' && '🟢 Low Priority'] }, filterType))) }), _jsxs("div", { className: "bulk-actions", children: [_jsx("button", { onClick: markAllComplete, className: "btn btn-success btn-sm", disabled: todoStats.active === 0, children: "\u2705 Mark All Complete" }), _jsx("button", { onClick: clearCompleted, className: "btn btn-warning btn-sm", disabled: todoStats.completed === 0, children: "\uD83D\uDDD1\uFE0F Clear Completed" })] })] }), _jsxs("section", { className: "card todos-section", children: [_jsxs("div", { className: "section-header", children: [_jsx("h2", { children: "\uD83D\uDCCB Todo List" }), _jsxs("div", { className: "filter-info", children: ["Showing ", _jsx("strong", { children: filteredTodos.length }), " of ", _jsx("strong", { children: todoStats.total }), " todos", taskFilter !== 'all' && _jsx("span", { className: "filter-badge", children: taskFilter })] })] }), _jsx("div", { className: "todos-list", children: filteredTodos.length > 0 ? (filteredTodos.map(todo => (_jsx(TodoItem, { todo: todo, onToggle: handleToggleTodo, onDelete: handleDeleteTodo }, todo.id)))) : (_jsx("div", { className: "empty-state", children: _jsx("p", { children: taskFilter === 'all' ? '🎉 No todos yet. Add one above!' :
134
+ taskFilter === 'completed' ? '📝 No completed todos yet.' :
135
+ taskFilter === 'active' ? '🎯 No active todos. Great job!' :
136
+ `🔍 No ${taskFilter} priority todos found.` }) })) })] }), _jsxs("section", { className: "card actions-section", children: [_jsx("h2", { children: "\u2699\uFE0F Actions" }), _jsx("div", { className: "action-buttons", children: _jsx("button", { onClick: simulateError, className: "btn btn-danger", children: "\uD83D\uDCA5 Test Error Boundary" }) })] })] }) }), _jsx(AppFooter, { theme: theme }), _jsx("style", { children: `
137
+ /* ...existing styles... */
138
+ .error-message {
139
+ color: #e74c3c;
140
+ font-size: 0.875rem;
141
+ margin-top: 0.5rem;
142
+ }
143
+
144
+ .input.error {
145
+ border-color: #e74c3c;
146
+ }
147
+ ` })] }));
148
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "frontend-hamroun/jsx-runtime";
2
+ import { hydrate } from 'frontend-hamroun';
3
+ import { App } from './App';
4
+ document.addEventListener('DOMContentLoaded', () => {
5
+ hydrate(_jsx(App, {}), document.getElementById('root'));
6
+ });
@@ -0,0 +1,4 @@
1
+ export declare function Counter({ initial }: {
2
+ initial?: number | undefined;
3
+ }): JSX.Element;
4
+ //# sourceMappingURL=Counter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Counter.d.ts","sourceRoot":"","sources":["Counter.tsx"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CAAC,EAAE,OAAW,EAAE;;CAAA,eAetC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "frontend-hamroun/jsx-runtime";
2
+ import { useState, useEffect } from 'frontend-hamroun';
3
+ export function Counter({ initial = 0 }) {
4
+ const [count, setCount] = useState(initial);
5
+ useEffect(() => {
6
+ document.title = `Count: ${count}`;
7
+ }, [count]);
8
+ return (_jsxs("div", { children: [_jsx("h2", { children: "Counter Component" }), _jsx("button", { onClick: () => setCount(count - 1), children: "-" }), _jsx("span", { style: { margin: '0 10px' }, children: count }), _jsx("button", { onClick: () => setCount(count + 1), children: "+" })] }));
9
+ }
@@ -0,0 +1,8 @@
1
+ import { jsx as createElement, Fragment } from 'frontend-hamroun';
2
+ declare global {
3
+ interface Window {
4
+ createElement: typeof createElement;
5
+ Fragment: typeof Fragment;
6
+ }
7
+ }
8
+ //# sourceMappingURL=jsx-shim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-shim.d.ts","sourceRoot":"","sources":["jsx-shim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,EAAE,OAAO,aAAa,CAAC;QACpC,QAAQ,EAAE,OAAO,QAAQ,CAAC;KAC3B;CACF"}
@@ -0,0 +1,2 @@
1
+ import './main.css';
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.tsx"],"names":[],"mappings":"AACA,OAAO,YAAY,CAAC"}