baraqex 1.0.47 โ†’ 1.0.49

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 (28) hide show
  1. package/dist/index.js +236 -189
  2. package/dist/index.js.map +4 -4
  3. package/dist/server.js +1282 -864
  4. package/dist/server.js.map +4 -4
  5. package/package.json +1 -1
  6. package/templates/fullstack-template/package-lock.json +931 -4
  7. package/templates/fullstack-template/package.json +7 -5
  8. package/templates/fullstack-template/server.js +548 -15
  9. package/templates/fullstack-template/src/api/hello.js +9 -11
  10. package/templates/fullstack-template/src/pages/index.js +196 -114
  11. package/templates/fullstack-app/package-lock.json +0 -3683
  12. package/templates/fullstack-app/package.json +0 -26
  13. package/templates/fullstack-app/public/client.js +0 -139
  14. package/templates/fullstack-app/public/fullstack-styles.css +0 -445
  15. package/templates/fullstack-app/server.js +0 -32
  16. package/templates/fullstack-app/src/api/auth.js +0 -48
  17. package/templates/fullstack-app/src/api/users.js +0 -85
  18. package/templates/fullstack-app/src/pages/index.js +0 -0
  19. package/templates/fullstack-app/src/pages/index.jsx +0 -181
  20. package/templates/fullstack-app/src/pages/login.js +0 -139
  21. package/templates/fullstack-app/src/pages/login.jsx +0 -150
  22. package/templates/fullstack-template/public/client.js +0 -17
  23. package/templates/fullstack-template/src/api/users/index.js +0 -43
  24. package/templates/go-wasm-app/package.json +0 -24
  25. package/templates/go-wasm-app/public/wasm-styles.css +0 -184
  26. package/templates/go-wasm-app/server.js +0 -36
  27. package/templates/go-wasm-app/src/pages/index.jsx +0 -161
  28. package/templates/go-wasm-app/src/wasm/main.go +0 -164
@@ -1,124 +1,206 @@
1
- import { jsx } from 'baraqex';
1
+ import { jsx, useState } from 'frontend-hamroun';
2
2
 
3
3
  export default function HomePage(props) {
4
- return jsx('div', {
5
- style: {
6
- fontFamily: 'Arial, sans-serif',
4
+ const [count, setCount] = useState(0);
5
+
6
+ return jsx('div', {
7
+ style: {
8
+ padding: '2rem',
9
+ textAlign: 'center',
10
+ fontFamily: 'system-ui',
7
11
  maxWidth: '800px',
8
- margin: '0 auto',
9
- padding: '20px',
10
- lineHeight: '1.6'
12
+ margin: '0 auto'
13
+ }
14
+ },
15
+ jsx('h1', {
16
+ style: {
17
+ color: '#2c3e50',
18
+ marginBottom: '1rem',
19
+ fontSize: '2.5rem'
20
+ }
21
+ }, 'Welcome to Your Baraqex Full-Stack App! ๐Ÿš€'),
22
+
23
+ jsx('div', {
24
+ style: {
25
+ background: '#f8f9fa',
26
+ padding: '2rem',
27
+ borderRadius: '12px',
28
+ margin: '2rem 0',
29
+ border: '1px solid #dee2e6'
30
+ }
11
31
  },
12
- children: [
13
- jsx('h1', {
14
- style: { color: '#333', textAlign: 'center' },
15
- children: '๐Ÿš€ Baraqex Fullstack App'
16
- }),
32
+ jsx('p', {
33
+ style: {
34
+ fontSize: '1.5rem',
35
+ fontWeight: 'bold',
36
+ color: '#495057',
37
+ margin: '0 0 1rem 0'
38
+ }
39
+ }, `Counter: ${count}`),
17
40
 
18
- jsx('p', {
19
- style: { textAlign: 'center', color: '#666', fontSize: '18px' },
20
- children: 'Welcome to your fullstack application!'
21
- }),
22
-
23
- jsx('div', {
41
+ jsx('div', { style: { margin: '1rem 0' } },
42
+ jsx('button', {
43
+ onclick: () => setCount(count + 1),
44
+ style: {
45
+ padding: '0.75rem 1.5rem',
46
+ margin: '0.5rem',
47
+ background: '#007acc',
48
+ color: 'white',
49
+ border: 'none',
50
+ borderRadius: '6px',
51
+ cursor: 'pointer',
52
+ fontSize: '1rem',
53
+ fontWeight: '500',
54
+ transition: 'all 0.2s ease'
55
+ }
56
+ }, 'Increment'),
57
+ jsx('button', {
58
+ onclick: () => setCount(count - 1),
59
+ style: {
60
+ padding: '0.75rem 1.5rem',
61
+ margin: '0.5rem',
62
+ background: '#e74c3c',
63
+ color: 'white',
64
+ border: 'none',
65
+ borderRadius: '6px',
66
+ cursor: 'pointer',
67
+ fontSize: '1rem',
68
+ fontWeight: '500',
69
+ transition: 'all 0.2s ease'
70
+ }
71
+ }, 'Decrement'),
72
+ jsx('button', {
73
+ onclick: () => setCount(0),
74
+ style: {
75
+ padding: '0.75rem 1.5rem',
76
+ margin: '0.5rem',
77
+ background: '#95a5a6',
78
+ color: 'white',
79
+ border: 'none',
80
+ borderRadius: '6px',
81
+ cursor: 'pointer',
82
+ fontSize: '1rem',
83
+ fontWeight: '500',
84
+ transition: 'all 0.2s ease'
85
+ }
86
+ }, 'Reset')
87
+ )
88
+ ),
89
+
90
+ jsx('div', {
91
+ style: {
92
+ marginTop: '2rem',
93
+ padding: '1.5rem',
94
+ background: '#e8f5e8',
95
+ borderRadius: '8px',
96
+ border: '1px solid #c3e6c3'
97
+ }
98
+ },
99
+ jsx('h3', {
100
+ style: {
101
+ margin: '0 0 1rem 0',
102
+ color: '#155724'
103
+ }
104
+ }, '๐ŸŽฏ Features Included:'),
105
+ jsx('ul', {
106
+ style: {
107
+ textAlign: 'left',
108
+ maxWidth: '500px',
109
+ margin: '0 auto',
110
+ listStyle: 'none',
111
+ padding: 0
112
+ }
113
+ },
114
+ jsx('li', {
115
+ style: {
116
+ padding: '0.5rem 0',
117
+ borderBottom: '1px solid rgba(0,0,0,0.1)'
118
+ }
119
+ }, 'โœ… Server-side rendering with ESBuild'),
120
+ jsx('li', {
121
+ style: {
122
+ padding: '0.5rem 0',
123
+ borderBottom: '1px solid rgba(0,0,0,0.1)'
124
+ }
125
+ }, 'โœ… API routes in src/api/'),
126
+ jsx('li', {
127
+ style: {
128
+ padding: '0.5rem 0',
129
+ borderBottom: '1px solid rgba(0,0,0,0.1)'
130
+ }
131
+ }, 'โœ… Page-based routing'),
132
+ jsx('li', {
133
+ style: {
134
+ padding: '0.5rem 0',
135
+ borderBottom: '1px solid rgba(0,0,0,0.1)'
136
+ }
137
+ }, 'โœ… Client-side hydration'),
138
+ jsx('li', {
139
+ style: {
140
+ padding: '0.5rem 0'
141
+ }
142
+ }, 'โœ… Frontend Hamroun hooks')
143
+ )
144
+ ),
145
+
146
+ jsx('div', {
147
+ style: {
148
+ marginTop: '2rem',
149
+ padding: '1.5rem',
150
+ background: '#fff3cd',
151
+ borderRadius: '8px',
152
+ border: '1px solid #ffeaa7'
153
+ }
154
+ },
155
+ jsx('h3', {
24
156
  style: {
25
- display: 'grid',
26
- gap: '20px',
27
- gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
28
- marginTop: '30px'
29
- },
30
- children: [
31
- jsx('div', {
32
- style: {
33
- border: '1px solid #ddd',
34
- borderRadius: '8px',
35
- padding: '20px',
36
- backgroundColor: '#f9f9f9'
37
- },
38
- children: [
39
- jsx('h3', { children: '๐Ÿ“ก API Routes' }),
40
- jsx('p', { children: 'Your API endpoints are ready:' }),
41
- jsx('ul', {
42
- children: [
43
- jsx('li', { children: jsx('code', { children: 'GET /api/hello' }) }),
44
- jsx('li', { children: jsx('code', { children: 'POST /api/hello' }) }),
45
- jsx('li', { children: jsx('code', { children: 'GET /api/users' }) }),
46
- jsx('li', { children: jsx('code', { children: 'POST /api/users' }) })
47
- ]
48
- })
49
- ]
50
- }),
51
-
52
- jsx('div', {
53
- style: {
54
- border: '1px solid #ddd',
55
- borderRadius: '8px',
56
- padding: '20px',
57
- backgroundColor: '#f9f9f9'
58
- },
59
- children: [
60
- jsx('h3', { children: '๐Ÿ“„ Server-Side Rendering' }),
61
- jsx('p', { children: 'This page is rendered on the server!' }),
62
- jsx('p', {
63
- children: `Server time: ${props.api?.serverTime || 'N/A'}`
64
- })
65
- ]
66
- }),
67
-
68
- jsx('div', {
69
- style: {
70
- border: '1px solid #ddd',
71
- borderRadius: '8px',
72
- padding: '20px',
73
- backgroundColor: '#f9f9f9'
74
- },
75
- children: [
76
- jsx('h3', { children: '๐Ÿ› ๏ธ Features' }),
77
- jsx('ul', {
78
- children: [
79
- jsx('li', { children: 'Express.js backend' }),
80
- jsx('li', { children: 'File-based API routing' }),
81
- jsx('li', { children: 'Server-side rendering' }),
82
- jsx('li', { children: 'Static file serving' }),
83
- jsx('li', { children: 'CORS enabled' })
84
- ]
85
- })
86
- ]
87
- })
88
- ]
89
- }),
90
-
157
+ margin: '0 0 1rem 0',
158
+ color: '#856404'
159
+ }
160
+ }, '๐Ÿ”— Quick Links:'),
91
161
  jsx('div', {
92
162
  style: {
93
- marginTop: '40px',
94
- textAlign: 'center',
95
- padding: '20px',
96
- backgroundColor: '#e3f2fd',
97
- borderRadius: '8px'
98
- },
99
- children: [
100
- jsx('h3', { children: '๐Ÿงช Test Your API' }),
101
- jsx('p', { children: 'Try these commands in your terminal:' }),
102
- jsx('pre', {
103
- style: {
104
- backgroundColor: '#333',
105
- color: '#fff',
106
- padding: '10px',
107
- borderRadius: '4px',
108
- textAlign: 'left',
109
- overflow: 'auto'
110
- },
111
- children: `curl http://localhost:3000/api/hello
112
- curl -X POST http://localhost:3000/api/hello \\
113
- -H "Content-Type: application/json" \\
114
- -d '{"name":"Developer"}'`
115
- })
116
- ]
117
- })
118
- ]
119
- });
163
+ display: 'flex',
164
+ gap: '1rem',
165
+ justifyContent: 'center',
166
+ flexWrap: 'wrap'
167
+ }
168
+ },
169
+ jsx('a', {
170
+ href: '/api/hello',
171
+ style: {
172
+ padding: '0.5rem 1rem',
173
+ background: '#17a2b8',
174
+ color: 'white',
175
+ textDecoration: 'none',
176
+ borderRadius: '4px',
177
+ fontSize: '0.9rem'
178
+ }
179
+ }, 'API Hello'),
180
+ jsx('a', {
181
+ href: '/api-docs',
182
+ style: {
183
+ padding: '0.5rem 1rem',
184
+ background: '#6f42c1',
185
+ color: 'white',
186
+ textDecoration: 'none',
187
+ borderRadius: '4px',
188
+ fontSize: '0.9rem'
189
+ }
190
+ }, 'API Docs')
191
+ )
192
+ ),
193
+
194
+ jsx('p', {
195
+ style: {
196
+ marginTop: '2rem',
197
+ color: '#6c757d',
198
+ fontSize: '0.9rem'
199
+ }
200
+ }, 'Edit src/pages/index.js to customize this page')
201
+ );
120
202
  }
121
203
 
122
- // Optional: Add metadata for the page
123
- HomePage.getTitle = () => 'Baraqex Fullstack App';
124
- HomePage.getDescription = () => 'A fullstack application with API routes and server-side rendering';
204
+ // Optional: Add metadata for SEO
205
+ HomePage.title = 'Baraqex Full-Stack App';
206
+ HomePage.description = 'A complete full-stack application built with Baraqex framework';