baraqex 1.0.76 → 2.0.1

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 (182) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +268 -315
  3. package/bin/baraqex.js +150 -12
  4. package/dist/browser.d.ts +1 -1
  5. package/dist/browser.d.ts.map +1 -1
  6. package/dist/browser.js +2319 -205
  7. package/dist/browser.js.map +4 -4
  8. package/dist/core/batch.d.ts +10 -0
  9. package/dist/core/batch.d.ts.map +1 -0
  10. package/dist/core/component.d.ts +69 -0
  11. package/dist/core/component.d.ts.map +1 -0
  12. package/dist/core/context.d.ts +22 -0
  13. package/dist/core/context.d.ts.map +1 -0
  14. package/dist/core/errors.d.ts +125 -0
  15. package/dist/core/errors.d.ts.map +1 -0
  16. package/dist/core/event-bus.d.ts +29 -0
  17. package/dist/core/event-bus.d.ts.map +1 -0
  18. package/dist/core/forms.d.ts +128 -0
  19. package/dist/core/forms.d.ts.map +1 -0
  20. package/dist/core/hooks.d.ts +84 -0
  21. package/dist/core/hooks.d.ts.map +1 -0
  22. package/dist/core/index.d.ts +23 -0
  23. package/dist/core/index.d.ts.map +1 -0
  24. package/dist/core/jsx-runtime.d.ts +45 -0
  25. package/dist/core/jsx-runtime.d.ts.map +1 -0
  26. package/dist/core/lifecycle-events.d.ts +71 -0
  27. package/dist/core/lifecycle-events.d.ts.map +1 -0
  28. package/dist/core/renderer.d.ts +39 -0
  29. package/dist/core/renderer.d.ts.map +1 -0
  30. package/dist/core/router.d.ts +108 -0
  31. package/dist/core/router.d.ts.map +1 -0
  32. package/dist/core/server-renderer.d.ts +26 -0
  33. package/dist/core/server-renderer.d.ts.map +1 -0
  34. package/dist/core/store.d.ts +102 -0
  35. package/dist/core/store.d.ts.map +1 -0
  36. package/dist/core/types.d.ts +66 -0
  37. package/dist/core/types.d.ts.map +1 -0
  38. package/dist/core/utils.d.ts +153 -0
  39. package/dist/core/utils.d.ts.map +1 -0
  40. package/dist/core/vdom.d.ts +29 -0
  41. package/dist/core/vdom.d.ts.map +1 -0
  42. package/dist/index.d.ts +39 -35
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +2596 -508
  45. package/dist/index.js.map +4 -4
  46. package/dist/server/auth.d.ts +8 -3
  47. package/dist/server/auth.d.ts.map +1 -1
  48. package/dist/server/index.d.ts +2 -2
  49. package/dist/server/index.d.ts.map +1 -1
  50. package/dist/server/index.js +173 -112
  51. package/dist/server/index.js.map +4 -4
  52. package/dist/server/middleware.d.ts +10 -1
  53. package/dist/server/middleware.d.ts.map +1 -1
  54. package/package.json +224 -124
  55. package/templates/basic-app/src/main.jsx +336 -0
  56. package/templates/complete-app/api/hello.js +0 -0
  57. package/templates/complete-app/client.js +58 -0
  58. package/templates/complete-app/lib/frontend-hamroun.js +182 -0
  59. package/templates/complete-app/package.json +18 -0
  60. package/templates/complete-app/pages/about.js +119 -0
  61. package/templates/complete-app/pages/about.jsx +0 -0
  62. package/templates/complete-app/pages/index.js +157 -0
  63. package/templates/complete-app/pages/index.jsx +0 -0
  64. package/templates/complete-app/pages/wasm-demo.js +290 -0
  65. package/templates/complete-app/pages/wasm-demo.jsx +0 -0
  66. package/templates/complete-app/public/client.js +89 -0
  67. package/templates/complete-app/public/index.html +118 -0
  68. package/templates/complete-app/public/styles.css +76 -0
  69. package/templates/complete-app/readme.md +188 -0
  70. package/templates/complete-app/server.js +226 -0
  71. package/templates/complete-app/server.ts +275 -0
  72. package/templates/complete-app/src/App.tsx +59 -0
  73. package/templates/complete-app/src/client.ts +61 -0
  74. package/templates/complete-app/src/client.tsx +18 -0
  75. package/templates/complete-app/src/pages/index.tsx +51 -0
  76. package/templates/complete-app/src/server.ts +218 -0
  77. package/templates/complete-app/tsconfig.json +22 -0
  78. package/templates/complete-app/tsconfig.server.json +19 -0
  79. package/templates/complete-app/vite.config.js +57 -0
  80. package/templates/complete-app/vite.config.ts +30 -0
  81. package/templates/complete-app/wasm/build.bat +0 -0
  82. package/templates/complete-app/wasm/build.sh +0 -0
  83. package/templates/complete-app/wasm/example.go +0 -0
  84. package/templates/fullstack-app/README.md +37 -0
  85. package/templates/fullstack-app/api/hello.js +11 -0
  86. package/templates/fullstack-app/api/hello.ts +18 -0
  87. package/templates/fullstack-app/api/users/[id].ts +73 -0
  88. package/templates/fullstack-app/api/users/index.ts +32 -0
  89. package/templates/fullstack-app/build/main.css +874 -0
  90. package/templates/fullstack-app/build/main.css.map +7 -0
  91. package/templates/fullstack-app/build/main.js +967 -0
  92. package/templates/fullstack-app/build/main.js.map +7 -0
  93. package/templates/fullstack-app/build.ts +210 -0
  94. package/templates/fullstack-app/index.html +36 -0
  95. package/templates/fullstack-app/package.json +35 -0
  96. package/templates/fullstack-app/postcss.config.js +6 -0
  97. package/templates/fullstack-app/process-tailwind.js +45 -0
  98. package/templates/fullstack-app/public/_redirects +1 -0
  99. package/templates/fullstack-app/public/route-handler.js +47 -0
  100. package/templates/fullstack-app/public/spa-fix.html +17 -0
  101. package/templates/fullstack-app/public/styles.css +975 -0
  102. package/templates/fullstack-app/public/tailwind.css +15 -0
  103. package/templates/fullstack-app/server.js +267 -0
  104. package/templates/fullstack-app/server.ts +474 -0
  105. package/templates/fullstack-app/src/README.md +55 -0
  106. package/templates/fullstack-app/src/client.js +87 -0
  107. package/templates/fullstack-app/src/components/ClientHome.tsx +0 -0
  108. package/templates/fullstack-app/src/components/ErrorBoundary.tsx +36 -0
  109. package/templates/fullstack-app/src/components/Layout.tsx +42 -0
  110. package/templates/fullstack-app/src/components/StateDemo.tsx +207 -0
  111. package/templates/fullstack-app/src/components/UserList.tsx +44 -0
  112. package/templates/fullstack-app/src/config.ts +42 -0
  113. package/templates/fullstack-app/src/data/api.ts +206 -0
  114. package/templates/fullstack-app/src/main.tsx +155 -0
  115. package/templates/fullstack-app/src/middleware.ts +28 -0
  116. package/templates/fullstack-app/src/pages/404.tsx +28 -0
  117. package/templates/fullstack-app/src/pages/[id].tsx +0 -0
  118. package/templates/fullstack-app/src/pages/_app.tsx +11 -0
  119. package/templates/fullstack-app/src/pages/_document.tsx +25 -0
  120. package/templates/fullstack-app/src/pages/_error.tsx +45 -0
  121. package/templates/fullstack-app/src/pages/about/index.tsx +67 -0
  122. package/templates/fullstack-app/src/pages/about.tsx +71 -0
  123. package/templates/fullstack-app/src/pages/api/users/[id].ts +73 -0
  124. package/templates/fullstack-app/src/pages/api/users/index.ts +43 -0
  125. package/templates/fullstack-app/src/pages/index.tsx +110 -0
  126. package/templates/fullstack-app/src/pages/users/[id].tsx +153 -0
  127. package/templates/fullstack-app/src/pages/users.tsx +60 -0
  128. package/templates/fullstack-app/src/pages/wasm-demo.tsx +1 -0
  129. package/templates/fullstack-app/src/router.ts +255 -0
  130. package/templates/fullstack-app/src/styles.css +5 -0
  131. package/templates/fullstack-app/tailwind.config.js +11 -0
  132. package/templates/fullstack-app/tsconfig.json +18 -0
  133. package/templates/fullstack-app/vite.config.js +87 -0
  134. package/templates/go/build.bat +36 -0
  135. package/templates/go/build.sh +43 -0
  136. package/templates/go/example.go +205 -0
  137. package/templates/go-wasm-app/README.md +38 -0
  138. package/templates/go-wasm-app/babel.config.js +21 -0
  139. package/templates/go-wasm-app/build-client.js +49 -0
  140. package/templates/go-wasm-app/build-wasm.js +237 -0
  141. package/templates/go-wasm-app/build.config.js +62 -0
  142. package/templates/go-wasm-app/build.js +218 -0
  143. package/templates/go-wasm-app/package.json +32 -0
  144. package/templates/go-wasm-app/public/index.html +128 -0
  145. package/templates/go-wasm-app/public/styles.css +197 -0
  146. package/templates/go-wasm-app/public/wasm/example.wasm +0 -0
  147. package/templates/go-wasm-app/public/wasm/wasm_exec.js +561 -0
  148. package/templates/go-wasm-app/public/wasm/wasm_exec_node.js +39 -0
  149. package/templates/go-wasm-app/server.js +70 -0
  150. package/templates/go-wasm-app/src/App.jsx +38 -0
  151. package/templates/go-wasm-app/src/app.js +173 -0
  152. package/templates/go-wasm-app/src/client.js +57 -0
  153. package/templates/go-wasm-app/src/components/Footer.jsx +13 -0
  154. package/templates/go-wasm-app/src/components/Header.jsx +19 -0
  155. package/templates/go-wasm-app/src/components/WasmDemo.jsx +120 -0
  156. package/templates/go-wasm-app/src/main.jsx +12 -0
  157. package/templates/go-wasm-app/src/wasm/example.go +75 -0
  158. package/templates/go-wasm-app/tsconfig.server.json +18 -0
  159. package/templates/go-wasm-app/vite.config.js +45 -0
  160. package/dist/forms/index.d.ts +0 -2
  161. package/dist/forms/index.d.ts.map +0 -1
  162. package/dist/forms/types.d.ts +0 -2
  163. package/dist/forms/types.d.ts.map +0 -1
  164. package/dist/frontend/components/WasmLoader.d.ts +0 -2
  165. package/dist/frontend/components/WasmLoader.d.ts.map +0 -1
  166. package/dist/frontend/hooks/useWasm.d.ts +0 -2
  167. package/dist/frontend/hooks/useWasm.d.ts.map +0 -1
  168. package/dist/frontend/index.d.ts +0 -2
  169. package/dist/frontend/index.d.ts.map +0 -1
  170. package/dist/router/index.d.ts +0 -2
  171. package/dist/router/index.d.ts.map +0 -1
  172. package/dist/router/types.d.ts +0 -2
  173. package/dist/router/types.d.ts.map +0 -1
  174. package/dist/store/index.d.ts +0 -2
  175. package/dist/store/index.d.ts.map +0 -1
  176. package/dist/store/types.d.ts +0 -2
  177. package/dist/store/types.d.ts.map +0 -1
  178. package/templates/basic-app/package-lock.json +0 -7173
  179. package/templates/fullstack-template/package-lock.json +0 -3558
  180. package/templates/ssr-template/package-lock.json +0 -5380
  181. package/templates/wasm/package-lock.json +0 -5347
  182. package/templates/wasm/public/example.wasm +0 -0
@@ -0,0 +1,218 @@
1
+ // Support both ESM and CommonJS imports
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ const esbuild = require('esbuild');
5
+ const { execSync } = require('child_process');
6
+ const config = require('./build.config.js');
7
+
8
+ // Define colors for console output
9
+ const colors = {
10
+ reset: "\x1b[0m",
11
+ bright: "\x1b[1m",
12
+ dim: "\x1b[2m",
13
+ underscore: "\x1b[4m",
14
+ blink: "\x1b[5m",
15
+ cyan: "\x1b[36m",
16
+ green: "\x1b[32m",
17
+ yellow: "\x1b[33m",
18
+ red: "\x1b[31m"
19
+ };
20
+
21
+ // Helper for formatted console logs
22
+ function log(message, type = 'info') {
23
+ const timestamp = new Date().toISOString().split('T')[1].split('.')[0];
24
+ const prefix = {
25
+ info: `${colors.bright}${colors.cyan}[INFO]${colors.reset}`,
26
+ success: `${colors.bright}${colors.green}[SUCCESS]${colors.reset}`,
27
+ warning: `${colors.bright}${colors.yellow}[WARNING]${colors.reset}`,
28
+ error: `${colors.bright}${colors.red}[ERROR]${colors.reset}`
29
+ };
30
+
31
+ console.log(`${colors.dim}[${timestamp}]${colors.reset} ${prefix[type] || prefix.info} ${message}`);
32
+ }
33
+
34
+ // Main build function
35
+ async function build() {
36
+ try {
37
+ log(`Starting build process (${process.env.NODE_ENV || 'development'} mode)`);
38
+
39
+ // Ensure output directories
40
+ ensureDir(path.join(__dirname, 'dist'));
41
+ ensureDir(path.join(__dirname, 'dist/server'));
42
+ ensureDir(path.join(__dirname, 'dist/assets'));
43
+ ensureDir(path.join(__dirname, 'public/wasm'));
44
+
45
+ // Build the WASM modules if enabled
46
+ if (config.wasm.enabled) {
47
+ await buildWasmModules();
48
+ }
49
+
50
+ // Build the client code
51
+ await buildClient();
52
+
53
+ // Build the server code if it exists
54
+ if (fs.existsSync(path.join(__dirname, config.entryPoints.server))) {
55
+ await buildServer();
56
+ }
57
+
58
+ log('Build completed successfully', 'success');
59
+ } catch (error) {
60
+ log(`Build failed: ${error.message}`, 'error');
61
+ console.error(error);
62
+ process.exit(1);
63
+ }
64
+ }
65
+
66
+ // Build WebAssembly modules
67
+ async function buildWasmModules() {
68
+ const sourceDir = path.join(__dirname, config.wasm.sourceDir);
69
+ const outputDir = path.join(__dirname, config.wasm.outputDir);
70
+
71
+ if (!fs.existsSync(sourceDir)) {
72
+ log(`WASM source directory not found: ${sourceDir}`, 'warning');
73
+ return;
74
+ }
75
+
76
+ log('Building WebAssembly modules...');
77
+
78
+ // Get all .go files that need to be compiled
79
+ const goFiles = fs.readdirSync(sourceDir)
80
+ .filter(file => file.endsWith('.go'));
81
+
82
+ if (goFiles.length === 0) {
83
+ log('No Go files found to compile', 'warning');
84
+ return;
85
+ }
86
+
87
+ // Compile each Go file to WASM
88
+ for (const goFile of goFiles) {
89
+ const goFilePath = path.join(sourceDir, goFile);
90
+ const wasmFileName = goFile.replace('.go', '.wasm');
91
+ const wasmFilePath = path.join(outputDir, wasmFileName);
92
+
93
+ log(`Compiling ${goFile} to WebAssembly...`);
94
+
95
+ try {
96
+ // Set environment variables for Go WASM compilation
97
+ const env = {
98
+ ...process.env,
99
+ GOOS: 'js',
100
+ GOARCH: 'wasm'
101
+ };
102
+
103
+ // Compile Go to WASM
104
+ execSync(`${config.wasm.goBinaryPath} build -o "${wasmFilePath}" "${goFilePath}"`, {
105
+ env,
106
+ stdio: 'inherit'
107
+ });
108
+
109
+ log(`Successfully compiled ${goFile} to ${wasmFileName}`, 'success');
110
+ } catch (error) {
111
+ log(`Failed to compile ${goFile}: ${error.message}`, 'error');
112
+ throw error;
113
+ }
114
+ }
115
+
116
+ // Copy wasm_exec.js from Go installation to public folder
117
+ if (config.wasm.copyGoRuntime) {
118
+ try {
119
+ const goRoot = execSync(`${config.wasm.goBinaryPath} env GOROOT`, { encoding: 'utf8' }).trim();
120
+ const wasmExecSrc = path.join(goRoot, 'misc', 'wasm', 'wasm_exec.js');
121
+ const wasmExecDest = path.join(outputDir, 'wasm_exec.js');
122
+
123
+ fs.copyFileSync(wasmExecSrc, wasmExecDest);
124
+ log('Copied wasm_exec.js runtime to public folder', 'success');
125
+ } catch (error) {
126
+ log(`Failed to copy wasm_exec.js: ${error.message}`, 'warning');
127
+ }
128
+ }
129
+ }
130
+
131
+ // Build client code with esbuild
132
+ async function buildClient() {
133
+ const formats = config.dualModuleSupport ? config.outputFormats : ['esm'];
134
+
135
+ for (const format of formats) {
136
+ const outfile = path.join(
137
+ __dirname,
138
+ 'dist',
139
+ config.output.client[format].replace('[name]', 'client')
140
+ );
141
+
142
+ log(`Building client bundle (${format})...`);
143
+
144
+ await esbuild.build({
145
+ entryPoints: [path.join(__dirname, config.entryPoints.client)],
146
+ bundle: true,
147
+ outfile,
148
+ format,
149
+ platform: 'browser',
150
+ target: config.options.target,
151
+ minify: config.options.minify,
152
+ sourcemap: config.options.sourcemap,
153
+ define: {
154
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
155
+ '__ESM__': format === 'esm' ? 'true' : 'false'
156
+ },
157
+ jsxFactory: 'jsx',
158
+ jsxFragment: 'Fragment',
159
+ banner: {
160
+ js: format === 'esm'
161
+ ? `import { jsx, Fragment } from 'frontend-hamroun/jsx-runtime';`
162
+ : `const { jsx, Fragment } = require('frontend-hamroun/jsx-runtime');`
163
+ }
164
+ });
165
+ }
166
+
167
+ log('Client build completed', 'success');
168
+ }
169
+
170
+ // Build server code with esbuild
171
+ async function buildServer() {
172
+ const formats = config.dualModuleSupport ? config.outputFormats : ['cjs'];
173
+
174
+ for (const format of formats) {
175
+ const outfile = path.join(
176
+ __dirname,
177
+ 'dist',
178
+ config.output.server[format].replace('[name]', 'server')
179
+ );
180
+
181
+ log(`Building server bundle (${format})...`);
182
+
183
+ await esbuild.build({
184
+ entryPoints: [path.join(__dirname, config.entryPoints.server)],
185
+ bundle: true,
186
+ outfile,
187
+ format,
188
+ platform: 'node',
189
+ target: config.options.target,
190
+ minify: config.options.minify,
191
+ sourcemap: config.options.sourcemap,
192
+ external: ['express', 'cors', 'path', 'fs', 'frontend-hamroun', 'frontend-hamroun/*'],
193
+ define: {
194
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
195
+ '__ESM__': format === 'esm' ? 'true' : 'false'
196
+ }
197
+ });
198
+ }
199
+
200
+ log('Server build completed', 'success');
201
+ }
202
+
203
+ // Utility to ensure directory exists
204
+ function ensureDir(dir) {
205
+ if (!fs.existsSync(dir)) {
206
+ fs.mkdirSync(dir, { recursive: true });
207
+ }
208
+ }
209
+
210
+ // Execute the build
211
+ build();
212
+
213
+ // Support both CommonJS and ESM
214
+ if (typeof module !== 'undefined' && module.exports) {
215
+ module.exports = { build };
216
+ }
217
+
218
+ export { build };
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "go-wasm-app",
3
+ "version": "1.0.0",
4
+ "type": "commonjs",
5
+ "description": "Frontend Hamroun app with Go WebAssembly integration",
6
+ "scripts": {
7
+ "dev": "cross-env NODE_ENV=development node server.js",
8
+ "build": "cross-env NODE_ENV=production node build.js",
9
+ "build:wasm": "node build.js --wasm-only",
10
+ "start": "cross-env NODE_ENV=production node dist/server/server.js",
11
+ "test": "vitest run"
12
+ },
13
+ "dependencies": {
14
+ "express": "^4.18.2",
15
+ "frontend-hamroun": "latest"
16
+ },
17
+ "devDependencies": {
18
+ "cross-env": "^7.0.3",
19
+ "esbuild": "^0.19.5",
20
+ "nodemon": "^3.0.1",
21
+ "vitest": "^0.34.6"
22
+ },
23
+ "engines": {
24
+ "node": ">=16.0.0"
25
+ },
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/assets/client.mjs",
29
+ "require": "./dist/assets/client.js"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,128 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Frontend Hamroun + Go WebAssembly</title>
7
+ <style>
8
+ :root {
9
+ --primary-color: #0070f3;
10
+ --secondary-color: #0051cc;
11
+ --background: #f9f9f9;
12
+ --text-color: #333;
13
+ --card-background: #fff;
14
+ --border-color: #eaeaea;
15
+ --error-color: #f44336;
16
+ --success-color: #4caf50;
17
+ }
18
+
19
+ * {
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ body {
24
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
25
+ max-width: 800px;
26
+ margin: 0 auto;
27
+ padding: 2rem;
28
+ line-height: 1.6;
29
+ color: #333;
30
+ }
31
+
32
+ .app {
33
+ max-width: 900px;
34
+ margin: 0 auto;
35
+ padding: 20px;
36
+ }
37
+
38
+ header {
39
+ text-align: center;
40
+ margin-bottom: 2rem;
41
+ }
42
+
43
+ header h1 {
44
+ margin-bottom: 0.5rem;
45
+ color: var(--primary-color);
46
+ }
47
+
48
+ header p {
49
+ color: #666;
50
+ }
51
+
52
+ .card {
53
+ background-color: var(--card-background);
54
+ border: 1px solid var(--border-color);
55
+ border-radius: 8px;
56
+ padding: 1.5rem;
57
+ margin-bottom: 2rem;
58
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
59
+ }
60
+
61
+ pre {
62
+ background-color: #f5f5f5;
63
+ padding: 1rem;
64
+ border-radius: 4px;
65
+ overflow-x: auto;
66
+ }
67
+
68
+ footer {
69
+ margin-top: 3rem;
70
+ text-align: center;
71
+ color: #666;
72
+ padding: 1rem 0;
73
+ border-top: 1px solid var(--border-color);
74
+ }
75
+
76
+ .warning {
77
+ display: none;
78
+ background-color: #fff3cd;
79
+ border: 1px solid #ffecb5;
80
+ color: #856404;
81
+ padding: 1rem;
82
+ border-radius: 4px;
83
+ margin-bottom: 1rem;
84
+ }
85
+
86
+ code {
87
+ background-color: #f5f5f5;
88
+ padding: 0.2rem 0.4rem;
89
+ border-radius: 3px;
90
+ }
91
+
92
+ .loading {
93
+ text-align: center;
94
+ padding: 3rem 1rem;
95
+ color: #666;
96
+ }
97
+ </style>
98
+ <script src="/wasm/wasm_exec.js" defer></script>
99
+ </head>
100
+ <body>
101
+ <div id="root">
102
+ <!-- Server-rendered content will be inserted here -->
103
+ <div class="loading">
104
+ <h2>Loading...</h2>
105
+ <p>Please wait while the server starts.</p>
106
+ <p>If this message persists, there might be an issue with the server.</p>
107
+ </div>
108
+ </div>
109
+ <script type="module" src="/src/client.js"></script>
110
+ <script>
111
+ // The server should replace this entire page with server-rendered content
112
+ // If you're seeing this, something is wrong with the server-side rendering
113
+ setTimeout(() => {
114
+ if (document.querySelector('.loading')) {
115
+ document.querySelector('#root').innerHTML = `
116
+ <div class="warning" style="display:block; background-color: #fff3cd; border: 1px solid #ffecb5; color: #856404; padding: 1rem; border-radius: 4px; margin-bottom: 1rem;">
117
+ <h2>Server Not Responding</h2>
118
+ <p>The server is not responding with the expected server-rendered content.</p>
119
+ <p>Please make sure the server is running properly with:</p>
120
+ <code>npm run dev</code>
121
+ <p>This static HTML file should be replaced by server-rendered content.</p>
122
+ </div>
123
+ `;
124
+ }
125
+ }, 2000);
126
+ </script>
127
+ </body>
128
+ </html>
@@ -0,0 +1,197 @@
1
+ :root {
2
+ --primary-color: #0070f3;
3
+ --secondary-color: #0051cc;
4
+ --background: #f9f9f9;
5
+ --text-color: #333;
6
+ --card-background: #fff;
7
+ --border-color: #eaeaea;
8
+ --error-color: #f44336;
9
+ --success-color: #4caf50;
10
+ }
11
+
12
+ * {
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
18
+ background-color: var(--background);
19
+ color: var(--text-color);
20
+ margin: 0;
21
+ padding: 0;
22
+ line-height: 1.6;
23
+ }
24
+
25
+ .app {
26
+ max-width: 900px;
27
+ margin: 0 auto;
28
+ padding: 20px;
29
+ }
30
+
31
+ header {
32
+ text-align: center;
33
+ margin-bottom: 2rem;
34
+ }
35
+
36
+ header h1 {
37
+ margin-bottom: 0.5rem;
38
+ color: var(--primary-color);
39
+ }
40
+
41
+ header p {
42
+ color: #666;
43
+ }
44
+
45
+ .rendering-info {
46
+ display: flex;
47
+ gap: 10px;
48
+ justify-content: center;
49
+ margin-top: 10px;
50
+ }
51
+
52
+ .badge {
53
+ display: inline-block;
54
+ padding: 4px 8px;
55
+ border-radius: 4px;
56
+ background-color: #eaeaea;
57
+ color: #666;
58
+ font-size: 0.8rem;
59
+ }
60
+
61
+ .badge.active {
62
+ background-color: var(--success-color);
63
+ color: white;
64
+ }
65
+
66
+ footer {
67
+ margin-top: 3rem;
68
+ text-align: center;
69
+ color: #666;
70
+ padding: 1rem 0;
71
+ border-top: 1px solid var(--border-color);
72
+ }
73
+
74
+ footer a {
75
+ color: var(--primary-color);
76
+ text-decoration: none;
77
+ }
78
+
79
+ .loading {
80
+ text-align: center;
81
+ padding: 2rem;
82
+ }
83
+
84
+ .error {
85
+ background-color: rgba(244, 67, 54, 0.1);
86
+ border: 1px solid var(--error-color);
87
+ border-radius: 8px;
88
+ padding: 1rem;
89
+ margin: 1rem 0;
90
+ }
91
+
92
+ .error-message {
93
+ background-color: rgba(244, 67, 54, 0.1);
94
+ color: var(--error-color);
95
+ padding: 1rem;
96
+ border-radius: 8px;
97
+ margin-bottom: 1rem;
98
+ }
99
+
100
+ .card {
101
+ background-color: var(--card-background);
102
+ border: 1px solid var(--border-color);
103
+ border-radius: 8px;
104
+ padding: 1.5rem;
105
+ margin-bottom: 2rem;
106
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
107
+ }
108
+
109
+ .demo-section {
110
+ background-color: var(--card-background);
111
+ border: 1px solid var(--border-color);
112
+ border-radius: 8px;
113
+ padding: 1.5rem;
114
+ margin-bottom: 2rem;
115
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
116
+ }
117
+
118
+ .input-row {
119
+ display: flex;
120
+ align-items: center;
121
+ gap: 0.5rem;
122
+ margin-bottom: 1rem;
123
+ }
124
+
125
+ .input-row input {
126
+ width: 80px;
127
+ padding: 0.5rem;
128
+ border: 1px solid var(--border-color);
129
+ border-radius: 4px;
130
+ font-size: 1rem;
131
+ }
132
+
133
+ .input-row .operator {
134
+ font-size: 1.5rem;
135
+ margin: 0 0.5rem;
136
+ }
137
+
138
+ button {
139
+ background-color: var(--primary-color);
140
+ color: white;
141
+ border: none;
142
+ border-radius: 4px;
143
+ padding: 0.5rem 1rem;
144
+ cursor: pointer;
145
+ font-size: 1rem;
146
+ transition: background-color 0.2s;
147
+ }
148
+
149
+ button:hover {
150
+ background-color: var(--secondary-color);
151
+ }
152
+
153
+ .json-editor {
154
+ display: flex;
155
+ flex-direction: column;
156
+ gap: 1rem;
157
+ }
158
+
159
+ .json-editor textarea {
160
+ width: 100%;
161
+ padding: 0.5rem;
162
+ border: 1px solid var(--border-color);
163
+ border-radius: 4px;
164
+ font-family: monospace;
165
+ font-size: 0.9rem;
166
+ resize: vertical;
167
+ }
168
+
169
+ .result {
170
+ background-color: #f0f7ff;
171
+ padding: 1rem;
172
+ border-radius: 4px;
173
+ margin-top: 1rem;
174
+ }
175
+
176
+ .result pre {
177
+ margin: 0;
178
+ white-space: pre-wrap;
179
+ font-family: monospace;
180
+ font-size: 0.9rem;
181
+ }
182
+
183
+ .info-section {
184
+ background-color: #f0f7ff;
185
+ border: 1px solid #e1e7fd;
186
+ border-radius: 8px;
187
+ padding: 1.5rem;
188
+ }
189
+
190
+ .info-section h2 {
191
+ color: var(--primary-color);
192
+ margin-top: 0;
193
+ }
194
+
195
+ .info-section ol {
196
+ padding-left: 1.5rem;
197
+ }