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.
- package/dist/batch.d.ts +4 -0
- package/dist/batch.d.ts.map +1 -0
- package/dist/batch.js +22 -0
- package/dist/client-router.d.ts +61 -0
- package/dist/client-router.d.ts.map +1 -0
- package/dist/client-router.js +209 -0
- package/dist/component.d.ts +15 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +84 -0
- package/dist/components/Counter.d.ts +1 -0
- package/dist/components/Counter.d.ts.map +1 -0
- package/dist/components/Counter.js +2 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +23 -0
- package/dist/event-bus.d.ts +24 -0
- package/dist/event-bus.d.ts.map +1 -0
- package/dist/event-bus.js +74 -0
- package/dist/forms.d.ts +41 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +147 -0
- package/dist/hooks.d.ts +12 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +142 -0
- package/dist/index.cjs +1118 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.client.d.ts +13 -0
- package/dist/index.client.d.ts.map +1 -0
- package/dist/index.client.js +12 -25
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1040 -264
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +102 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +3 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +96 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime/jsx-runtime.d.ts +5 -0
- package/dist/jsx-runtime/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime/jsx-runtime.js +40 -0
- package/dist/jsx-runtime.cjs +112 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.ts +18 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +90 -79
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/lifecycle-events.d.ts +109 -0
- package/dist/lifecycle-events.d.ts.map +1 -0
- package/dist/lifecycle-events.js +176 -0
- package/dist/renderComponent.d.ts +14 -0
- package/dist/renderComponent.d.ts.map +1 -0
- package/dist/renderComponent.js +29 -0
- package/dist/renderer.d.ts +4 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +49 -0
- package/dist/router.d.ts +56 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +165 -0
- package/dist/server-renderer.d.ts +2 -0
- package/dist/server-renderer.d.ts.map +1 -0
- package/dist/server-renderer.js +111 -5
- package/dist/server-types.d.ts +43 -0
- package/dist/server-types.d.ts.map +1 -0
- package/dist/server-types.js +5 -0
- package/dist/store.d.ts +42 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +98 -0
- package/dist/types.d.ts +272 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/utils.d.ts +47 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +143 -0
- package/dist/vdom.d.ts +9 -0
- package/dist/vdom.d.ts.map +1 -0
- package/dist/vdom.js +21 -0
- package/dist/wasm.d.ts +37 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +158 -0
- package/package.json +54 -83
- package/templates/basic-app/build.d.ts +2 -0
- package/templates/basic-app/build.d.ts.map +1 -0
- package/templates/basic-app/dev.d.ts +2 -0
- package/templates/basic-app/dev.d.ts.map +1 -0
- package/templates/basic-app/esbuild.config.d.ts +2 -0
- package/templates/basic-app/esbuild.config.d.ts.map +1 -0
- package/templates/basic-app/postcss.config.d.ts +8 -0
- package/templates/basic-app/postcss.config.d.ts.map +1 -0
- package/templates/basic-app/server.d.ts +2 -0
- package/templates/basic-app/server.d.ts.map +1 -0
- package/templates/basic-app/src/App.d.ts +2 -0
- package/templates/basic-app/src/App.d.ts.map +1 -0
- package/templates/basic-app/src/App.js +148 -0
- package/templates/basic-app/src/client.d.ts +2 -0
- package/templates/basic-app/src/client.d.ts.map +1 -0
- package/templates/basic-app/src/client.js +6 -0
- package/templates/basic-app/src/components/Counter.d.ts +4 -0
- package/templates/basic-app/src/components/Counter.d.ts.map +1 -0
- package/templates/basic-app/src/components/Counter.js +9 -0
- package/templates/basic-app/src/jsx-shim.d.ts +8 -0
- package/templates/basic-app/src/jsx-shim.d.ts.map +1 -0
- package/templates/basic-app/src/main.d.ts +2 -0
- package/templates/basic-app/src/main.d.ts.map +1 -0
- package/templates/basic-app/src/main.js +57 -0
- package/templates/basic-app/src/server.d.ts +2 -0
- package/templates/basic-app/src/server.d.ts.map +1 -0
- package/templates/basic-app/tailwind.config.d.ts +9 -0
- package/templates/basic-app/tailwind.config.d.ts.map +1 -0
- package/templates/basic-app/vite.config.d.ts +3 -0
- package/templates/basic-app/vite.config.d.ts.map +1 -0
- package/templates/basic-app/vite.config.js +7 -0
- package/templates/complete-app/api/hello.d.ts +1 -0
- package/templates/complete-app/api/hello.d.ts.map +1 -0
- package/templates/complete-app/client.d.ts +2 -0
- package/templates/complete-app/client.d.ts.map +1 -0
- package/templates/complete-app/lib/frontend-hamroun.d.ts +18 -0
- package/templates/complete-app/lib/frontend-hamroun.d.ts.map +1 -0
- package/templates/complete-app/pages/about.d.ts +7 -0
- package/templates/complete-app/pages/about.d.ts.map +1 -0
- package/templates/complete-app/pages/index.d.ts +7 -0
- package/templates/complete-app/pages/index.d.ts.map +1 -0
- package/templates/complete-app/pages/wasm-demo.d.ts +7 -0
- package/templates/complete-app/pages/wasm-demo.d.ts.map +1 -0
- package/templates/complete-app/public/client.d.ts +17 -0
- package/templates/complete-app/public/client.d.ts.map +1 -0
- package/templates/complete-app/server.d.ts +2 -0
- package/templates/complete-app/server.d.ts.map +1 -0
- package/templates/complete-app/server.js +236 -218
- package/templates/complete-app/src/App.d.ts +2 -0
- package/templates/complete-app/src/App.d.ts.map +1 -0
- package/templates/complete-app/src/App.js +27 -0
- package/templates/complete-app/src/client.d.ts +2 -0
- package/templates/complete-app/src/client.d.ts.map +1 -0
- package/templates/complete-app/src/client.js +52 -0
- package/templates/complete-app/src/pages/index.d.ts +2 -0
- package/templates/complete-app/src/pages/index.d.ts.map +1 -0
- package/templates/complete-app/src/pages/index.js +19 -0
- package/templates/complete-app/src/server.d.ts +2 -0
- package/templates/complete-app/src/server.d.ts.map +1 -0
- package/templates/complete-app/src/server.js +192 -0
- package/templates/complete-app/vite.config.d.ts +3 -0
- package/templates/complete-app/vite.config.d.ts.map +1 -0
- package/templates/complete-app/vite.config.js +29 -57
- package/templates/fullstack-app/api/hello.d.ts +4 -0
- package/templates/fullstack-app/api/hello.d.ts.map +1 -0
- package/templates/fullstack-app/api/hello.js +14 -11
- package/templates/fullstack-app/api/users/[id].d.ts +5 -0
- package/templates/fullstack-app/api/users/[id].d.ts.map +1 -0
- package/templates/fullstack-app/api/users/[id].js +52 -0
- package/templates/fullstack-app/api/users/index.d.ts +4 -0
- package/templates/fullstack-app/api/users/index.d.ts.map +1 -0
- package/templates/fullstack-app/api/users/index.js +25 -0
- package/templates/fullstack-app/build/main.d.ts +211 -0
- package/templates/fullstack-app/build/main.d.ts.map +1 -0
- package/templates/fullstack-app/build.d.ts +2 -0
- package/templates/fullstack-app/build.d.ts.map +1 -0
- package/templates/fullstack-app/build.js +190 -0
- package/templates/fullstack-app/postcss.config.d.ts +5 -0
- package/templates/fullstack-app/postcss.config.d.ts.map +1 -0
- package/templates/fullstack-app/process-tailwind.d.ts +2 -0
- package/templates/fullstack-app/process-tailwind.d.ts.map +1 -0
- package/templates/fullstack-app/public/route-handler.d.ts +1 -0
- package/templates/fullstack-app/public/route-handler.d.ts.map +1 -0
- package/templates/fullstack-app/server.d.ts +2 -0
- package/templates/fullstack-app/server.d.ts.map +1 -0
- package/templates/fullstack-app/server.js +428 -266
- package/templates/fullstack-app/src/client.d.ts +2 -0
- package/templates/fullstack-app/src/client.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/ClientHome.d.ts +1 -0
- package/templates/fullstack-app/src/components/ClientHome.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/ClientHome.js +1 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.d.ts +7 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/ErrorBoundary.js +12 -0
- package/templates/fullstack-app/src/components/Layout.d.ts +7 -0
- package/templates/fullstack-app/src/components/Layout.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/Layout.js +4 -0
- package/templates/fullstack-app/src/components/StateDemo.d.ts +2 -0
- package/templates/fullstack-app/src/components/StateDemo.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/StateDemo.js +86 -0
- package/templates/fullstack-app/src/components/UserList.d.ts +11 -0
- package/templates/fullstack-app/src/components/UserList.d.ts.map +1 -0
- package/templates/fullstack-app/src/components/UserList.js +7 -0
- package/templates/fullstack-app/src/config.d.ts +29 -0
- package/templates/fullstack-app/src/config.d.ts.map +1 -0
- package/templates/fullstack-app/src/config.js +36 -0
- package/templates/fullstack-app/src/data/api.d.ts +35 -0
- package/templates/fullstack-app/src/data/api.d.ts.map +1 -0
- package/templates/fullstack-app/src/data/api.js +173 -0
- package/templates/fullstack-app/src/main.d.ts +7 -0
- package/templates/fullstack-app/src/main.d.ts.map +1 -0
- package/templates/fullstack-app/src/main.js +130 -0
- package/templates/fullstack-app/src/middleware.d.ts +10 -0
- package/templates/fullstack-app/src/middleware.d.ts.map +1 -0
- package/templates/fullstack-app/src/middleware.js +14 -0
- package/templates/fullstack-app/src/pages/404.d.ts +4 -0
- package/templates/fullstack-app/src/pages/404.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/404.js +4 -0
- package/templates/fullstack-app/src/pages/[id].d.ts +1 -0
- package/templates/fullstack-app/src/pages/[id].d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/[id].js +1 -0
- package/templates/fullstack-app/src/pages/_app.d.ts +6 -0
- package/templates/fullstack-app/src/pages/_app.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/_app.js +6 -0
- package/templates/fullstack-app/src/pages/_document.d.ts +7 -0
- package/templates/fullstack-app/src/pages/_document.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/_document.js +4 -0
- package/templates/fullstack-app/src/pages/_error.d.ts +4 -0
- package/templates/fullstack-app/src/pages/_error.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/_error.js +8 -0
- package/templates/fullstack-app/src/pages/about/index.d.ts +5 -0
- package/templates/fullstack-app/src/pages/about/index.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/about/index.js +6 -0
- package/templates/fullstack-app/src/pages/about.d.ts +10 -0
- package/templates/fullstack-app/src/pages/about.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/about.js +21 -0
- package/templates/fullstack-app/src/pages/api/users/[id].d.ts +6 -0
- package/templates/fullstack-app/src/pages/api/users/[id].d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/api/users/[id].js +51 -0
- package/templates/fullstack-app/src/pages/api/users/index.d.ts +4 -0
- package/templates/fullstack-app/src/pages/api/users/index.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/api/users/index.js +33 -0
- package/templates/fullstack-app/src/pages/index.d.ts +21 -0
- package/templates/fullstack-app/src/pages/index.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/index.js +66 -0
- package/templates/fullstack-app/src/pages/users/[id].d.ts +38 -0
- package/templates/fullstack-app/src/pages/users/[id].d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/users/[id].js +79 -0
- package/templates/fullstack-app/src/pages/users.d.ts +14 -0
- package/templates/fullstack-app/src/pages/users.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/users.js +14 -0
- package/templates/fullstack-app/src/pages/wasm-demo.d.ts +1 -0
- package/templates/fullstack-app/src/pages/wasm-demo.d.ts.map +1 -0
- package/templates/fullstack-app/src/pages/wasm-demo.js +2 -0
- package/templates/fullstack-app/src/router.d.ts +22 -0
- package/templates/fullstack-app/src/router.d.ts.map +1 -0
- package/templates/fullstack-app/src/router.js +210 -0
- package/templates/fullstack-app/tailwind.config.d.ts +3 -0
- package/templates/fullstack-app/tailwind.config.d.ts.map +1 -0
- package/templates/fullstack-app/vite.config.d.ts +3 -0
- package/templates/fullstack-app/vite.config.d.ts.map +1 -0
- package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts +2 -0
- package/templates/ssr-template/dist/client/assets/main-D-VH3xOb.d.ts.map +1 -0
- package/templates/ssr-template/dist/client.d.ts +85 -0
- package/templates/ssr-template/dist/client.d.ts.map +1 -0
- package/templates/ssr-template/dist/server.d.ts +2 -0
- package/templates/ssr-template/dist/server.d.ts.map +1 -0
- package/templates/ssr-template/esbuild.config.d.ts +2 -0
- package/templates/ssr-template/esbuild.config.d.ts.map +1 -0
- package/templates/ssr-template/jsx-shim.d.ts +2 -0
- package/templates/ssr-template/jsx-shim.d.ts.map +1 -0
- package/templates/ssr-template/src/App.d.ts +2 -0
- package/templates/ssr-template/src/App.d.ts.map +1 -0
- package/templates/ssr-template/src/App.js +625 -0
- package/templates/ssr-template/src/client.d.ts +2 -0
- package/templates/ssr-template/src/client.d.ts.map +1 -0
- package/templates/ssr-template/src/client.js +3 -0
- package/templates/ssr-template/src/server.d.ts +2 -0
- package/templates/ssr-template/src/server.d.ts.map +1 -0
- package/templates/ssr-template/src/server.js +29 -0
- package/templates/ssr-template/vite.config.d.ts +3 -0
- package/templates/ssr-template/vite.config.d.ts.map +1 -0
- package/templates/ssr-template/vite.config.js +30 -0
- package/templates/wasm/build-wasm.d.ts +2 -0
- package/templates/wasm/build-wasm.d.ts.map +1 -0
- package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts +30 -0
- package/templates/wasm/dist/assets/index-BNqTDBdE.d.ts.map +1 -0
- package/templates/wasm/dist/wasm_exec.d.ts +1 -0
- package/templates/wasm/dist/wasm_exec.d.ts.map +1 -0
- package/templates/wasm/esbuild.config.d.ts +2 -0
- package/templates/wasm/esbuild.config.d.ts.map +1 -0
- package/templates/wasm/go/wasm_exec.d.ts +1 -0
- package/templates/wasm/go/wasm_exec.d.ts.map +1 -0
- package/templates/wasm/jsx-shim.d.ts +5 -0
- package/templates/wasm/jsx-shim.d.ts.map +1 -0
- package/templates/wasm/public/wasm_exec.d.ts +1 -0
- package/templates/wasm/public/wasm_exec.d.ts.map +1 -0
- package/templates/wasm/src/App.d.ts +2 -0
- package/templates/wasm/src/App.d.ts.map +1 -0
- package/templates/wasm/src/App.js +381 -0
- package/templates/wasm/src/client.d.ts +2 -0
- package/templates/wasm/src/client.d.ts.map +1 -0
- package/templates/wasm/src/client.js +210 -0
- package/templates/wasm/src/index.d.ts +2 -0
- package/templates/wasm/src/index.d.ts.map +1 -0
- package/templates/wasm/src/index.js +20 -0
- package/templates/wasm/src/server.d.ts +2 -0
- package/templates/wasm/src/server.d.ts.map +1 -0
- package/templates/wasm/src/server.js +131 -0
- package/templates/wasm/vite.config.d.ts +3 -0
- package/templates/wasm/vite.config.d.ts.map +1 -0
- package/templates/wasm/vite.config.js +36 -0
- package/templates/wasm/wasm-loader.d.ts +6 -0
- package/templates/wasm/wasm-loader.d.ts.map +1 -0
- package/dist/index.client.cjs +0 -2
- package/dist/index.client.cjs.map +0 -1
- package/dist/index.client.js.map +0 -1
- package/dist/renderer-DaVfBeVi.cjs +0 -2
- package/dist/renderer-DaVfBeVi.cjs.map +0 -1
- package/dist/renderer-nfT7XSpo.js +0 -61
- package/dist/renderer-nfT7XSpo.js.map +0 -1
- package/dist/server-renderer-B5b0Q0ck.cjs +0 -2
- package/dist/server-renderer-B5b0Q0ck.cjs.map +0 -1
- package/dist/server-renderer-C4MB-jAp.js +0 -248
- package/dist/server-renderer-C4MB-jAp.js.map +0 -1
- package/dist/server-renderer.cjs +0 -2
- package/dist/server-renderer.cjs.map +0 -1
- 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.
|
4
|
-
"description": "A lightweight
|
5
|
-
"
|
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
|
-
"
|
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
|
-
"
|
28
|
-
|
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": "
|
43
|
-
"
|
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
|
-
"
|
49
|
-
"
|
50
|
-
"
|
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
|
-
"
|
59
|
-
"
|
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
|
-
"
|
113
|
-
"react-dom": ">=16.8.0"
|
73
|
+
"typescript": "^4.0.0 || ^5.0.0"
|
114
74
|
},
|
115
75
|
"peerDependenciesMeta": {
|
116
|
-
"
|
117
|
-
"optional": true
|
118
|
-
},
|
119
|
-
"react-dom": {
|
76
|
+
"typescript": {
|
120
77
|
"optional": true
|
121
78
|
}
|
122
79
|
},
|
123
|
-
"
|
124
|
-
"node": "
|
125
|
-
"
|
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 @@
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["build.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["dev.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"esbuild.config.d.ts","sourceRoot":"","sources":["esbuild.config.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"postcss.config.d.ts","sourceRoot":"","sources":["postcss.config.js"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["server.js"],"names":[],"mappings":""}
|
@@ -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 @@
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.tsx"],"names":[],"mappings":""}
|
@@ -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 @@
|
|
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 @@
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.tsx"],"names":[],"mappings":"AACA,OAAO,YAAY,CAAC"}
|