frontend-hamroun 1.2.14 → 1.2.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.2.14",
3
+ "version": "1.2.15",
4
4
  "description": "A lightweight frontend and backend framework for building modern web applications",
5
5
  "type": "module",
6
6
  "main": "dist/frontend-hamroun.umd.js",
@@ -10,9 +10,6 @@
10
10
  "resolveJsonModule": true,
11
11
  "isolatedModules": true,
12
12
  "noEmit": true,
13
- "jsx": "react-jsx",
14
- "jsxFactory": "jsx",
15
- "jsxFragmentFactory": "Fragment",
16
13
  "strict": true,
17
14
  "noUnusedLocals": true,
18
15
  "noUnusedParameters": true,
@@ -1,12 +1,12 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>My Frontend App</title>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Frontend Hamroun App</title>
7
7
  </head>
8
- <body class="bg-gray-100 min-h-screen">
9
- <div id="root"></div>
10
- <script type="module" src="/src/main.tsx"></script>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.js"></script>
11
11
  </body>
12
12
  </html>
@@ -0,0 +1,105 @@
1
+ import { useState, useRef } from 'frontend-hamroun';
2
+
3
+ export function App() {
4
+ const [count, setCount] = useState(0);
5
+ const renderCount = useRef(0);
6
+
7
+ renderCount.current++;
8
+
9
+ // Using plain JS objects instead of JSX
10
+ return {
11
+ type: 'div',
12
+ props: {
13
+ style: {
14
+ fontFamily: 'Arial, sans-serif',
15
+ maxWidth: '600px',
16
+ margin: '0 auto',
17
+ padding: '2rem'
18
+ },
19
+ children: [
20
+ {
21
+ type: 'h1',
22
+ props: {
23
+ style: { textAlign: 'center' },
24
+ children: 'Frontend Hamroun App'
25
+ }
26
+ },
27
+ {
28
+ type: 'p',
29
+ props: {
30
+ style: { textAlign: 'center' },
31
+ children: `Render count: ${renderCount.current}`
32
+ }
33
+ },
34
+ {
35
+ type: 'div',
36
+ props: {
37
+ style: {
38
+ display: 'flex',
39
+ flexDirection: 'column',
40
+ alignItems: 'center',
41
+ padding: '1rem',
42
+ border: '1px solid #ccc',
43
+ borderRadius: '8px'
44
+ },
45
+ children: [
46
+ {
47
+ type: 'h2',
48
+ props: {
49
+ children: 'Counter Example'
50
+ }
51
+ },
52
+ {
53
+ type: 'p',
54
+ props: {
55
+ children: `Count: ${count}`
56
+ }
57
+ },
58
+ {
59
+ type: 'div',
60
+ props: {
61
+ style: {
62
+ display: 'flex',
63
+ gap: '8px'
64
+ },
65
+ children: [
66
+ {
67
+ type: 'button',
68
+ props: {
69
+ onClick: () => setCount(count - 1),
70
+ style: {
71
+ padding: '8px 16px',
72
+ backgroundColor: '#ff4d4d',
73
+ color: 'white',
74
+ border: 'none',
75
+ borderRadius: '4px',
76
+ cursor: 'pointer'
77
+ },
78
+ children: 'Decrement'
79
+ }
80
+ },
81
+ {
82
+ type: 'button',
83
+ props: {
84
+ onClick: () => setCount(count + 1),
85
+ style: {
86
+ padding: '8px 16px',
87
+ backgroundColor: '#4d79ff',
88
+ color: 'white',
89
+ border: 'none',
90
+ borderRadius: '4px',
91
+ cursor: 'pointer'
92
+ },
93
+ children: 'Increment'
94
+ }
95
+ }
96
+ ]
97
+ }
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ ]
103
+ }
104
+ };
105
+ }
@@ -0,0 +1,10 @@
1
+ import { render } from 'frontend-hamroun';
2
+ import { App } from './App.js';
3
+
4
+ document.addEventListener('DOMContentLoaded', () => {
5
+ const rootElement = document.getElementById('app');
6
+ if (rootElement) {
7
+ render(App(), rootElement);
8
+ console.log('App rendered successfully');
9
+ }
10
+ });
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from 'vite';
2
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
3
+
4
+ export default defineConfig({
5
+ // No JSX-specific configuration
6
+ build: {
7
+ outDir: 'dist',
8
+ emptyOutDir: true
9
+ },
10
+ server: {
11
+ port: 3000,
12
+ open: true
13
+ },
14
+ optimizeDeps: {
15
+ include: ['frontend-hamroun']
16
+ },
17
+ plugins: [
18
+ nodePolyfills({
19
+ protocolImports: true,
20
+ }),
21
+ ]
22
+ });
@@ -10,9 +10,6 @@
10
10
  "resolveJsonModule": true,
11
11
  "isolatedModules": true,
12
12
  "noEmit": true,
13
- "jsx": "react-jsx",
14
- "jsxFactory": "jsx",
15
- "jsxFragmentFactory": "Fragment",
16
13
  "strict": true,
17
14
  "noUnusedLocals": true,
18
15
  "noUnusedParameters": true,