frontend-hamroun 1.1.8 → 1.1.10
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/README.md +20 -25
- package/dist/jsx-runtime/jsx-dev-runtime.d.ts +0 -0
- package/dist/jsx-runtime/jsx-runtime.d.ts +0 -0
- package/package.json +9 -3
- package/dist/test.d.ts +0 -1
- package/templates/spa/index.html +0 -12
- package/templates/spa/package.json +0 -18
- package/templates/spa/src/App.ts +0 -26
- package/templates/spa/src/main.ts +0 -4
package/README.md
CHANGED
@@ -1,45 +1,39 @@
|
|
1
|
-
#
|
1
|
+
# Your Package Name
|
2
2
|
|
3
|
-
A
|
4
|
-
|
5
|
-
## Features
|
6
|
-
- 🎯 Hooks-based Components
|
7
|
-
- 🔄 Virtual DOM Diffing
|
8
|
-
- 📦 Batch Updates
|
9
|
-
- 🌍 Context API
|
10
|
-
- 💾 Memoization
|
11
|
-
- ⚡ Async Rendering
|
12
|
-
- 🛡️ Error Boundaries
|
13
|
-
- 🎨 Style Management
|
14
|
-
- 🔌 Event Handling
|
3
|
+
A lightweight Virtual DOM and hooks implementation with JSX support.
|
15
4
|
|
16
5
|
## Installation
|
17
6
|
|
18
7
|
```bash
|
19
|
-
npm install
|
8
|
+
npm install your-package-name
|
20
9
|
```
|
21
10
|
|
22
|
-
##
|
11
|
+
## Usage
|
23
12
|
|
24
|
-
```
|
25
|
-
import { render, useState } from '
|
13
|
+
```jsx
|
14
|
+
import { render, useState } from 'your-package-name';
|
26
15
|
|
27
|
-
function
|
16
|
+
function App() {
|
28
17
|
const [count, setCount] = useState(0);
|
29
|
-
|
30
18
|
return (
|
31
19
|
<div>
|
32
20
|
<h1>Count: {count}</h1>
|
33
|
-
<button onClick={() => setCount(count + 1)}>
|
34
|
-
Increment
|
35
|
-
</button>
|
21
|
+
<button onClick={() => setCount(count + 1)}>Increment</button>
|
36
22
|
</div>
|
37
23
|
);
|
38
24
|
}
|
39
25
|
|
40
|
-
render(<
|
26
|
+
render(<App />, document.getElementById('root'));
|
41
27
|
```
|
42
28
|
|
29
|
+
## Features
|
30
|
+
|
31
|
+
- Virtual DOM with efficient diffing
|
32
|
+
- Hooks (useState, useEffect, useMemo, useRef)
|
33
|
+
- Context API
|
34
|
+
- Batch updates
|
35
|
+
- Hydration support
|
36
|
+
|
43
37
|
## Hooks
|
44
38
|
|
45
39
|
### useState
|
@@ -110,7 +104,7 @@ function Child() {
|
|
110
104
|
Group multiple state updates together.
|
111
105
|
|
112
106
|
```tsx
|
113
|
-
import { batchUpdates } from '
|
107
|
+
import { batchUpdates } from 'your-package-name';
|
114
108
|
|
115
109
|
batchUpdates(() => {
|
116
110
|
setValue1(newValue1);
|
@@ -130,7 +124,7 @@ const MemoizedComponent = useMemo(() => (
|
|
130
124
|
## Server-Side Rendering
|
131
125
|
|
132
126
|
```tsx
|
133
|
-
import { hydrate } from '
|
127
|
+
import { hydrate } from 'your-package-name';
|
134
128
|
|
135
129
|
// On the client
|
136
130
|
hydrate(<App />, document.getElementById('root'));
|
@@ -226,3 +220,4 @@ MIT License - feel free to use in any project.
|
|
226
220
|
## Contributing
|
227
221
|
|
228
222
|
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
|
223
|
+
````
|
File without changes
|
File without changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "frontend-hamroun",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.10",
|
4
4
|
"description": "A lightweight frontend framework with hooks and virtual DOM",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./dist/index.js",
|
@@ -28,14 +28,17 @@
|
|
28
28
|
"scripts": {
|
29
29
|
"build": "vite build && tsc --emitDeclarationOnly",
|
30
30
|
"clean": "node -e \"if(require('fs').existsSync('dist')) require('fs').rmSync('dist',{recursive:true})\"",
|
31
|
-
"prepublishOnly": "npm run clean && npm run build"
|
31
|
+
"prepublishOnly": "npm run clean && npm run build",
|
32
|
+
"dev": "vite",
|
33
|
+
"test": "jest"
|
32
34
|
},
|
33
35
|
"keywords": [
|
34
36
|
"frontend",
|
35
37
|
"framework",
|
36
38
|
"jsx",
|
37
39
|
"hooks",
|
38
|
-
"virtual-dom"
|
40
|
+
"virtual-dom",
|
41
|
+
"vdom"
|
39
42
|
],
|
40
43
|
"author": "Hamroun",
|
41
44
|
"license": "MIT",
|
@@ -62,5 +65,8 @@
|
|
62
65
|
"fs-extra": "^11.1.1",
|
63
66
|
"inquirer": "^9.2.10",
|
64
67
|
"nanospinner": "^1.1.0"
|
68
|
+
},
|
69
|
+
"peerDependencies": {
|
70
|
+
"typescript": ">=4.0.0"
|
65
71
|
}
|
66
72
|
}
|
package/dist/test.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/templates/spa/index.html
DELETED
@@ -1,12 +0,0 @@
|
|
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 App</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<div id="app"></div>
|
10
|
-
<script type="module" src="/src/main.ts"></script>
|
11
|
-
</body>
|
12
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "frontend-app",
|
3
|
-
"private": true,
|
4
|
-
"version": "0.0.0",
|
5
|
-
"type": "module",
|
6
|
-
"scripts": {
|
7
|
-
"dev": "vite",
|
8
|
-
"build": "vite build",
|
9
|
-
"preview": "vite preview"
|
10
|
-
},
|
11
|
-
"dependencies": {
|
12
|
-
"frontend-hamroun": "^1.0.0"
|
13
|
-
},
|
14
|
-
"devDependencies": {
|
15
|
-
"vite": "^4.4.9",
|
16
|
-
"typescript": "^5.0.0"
|
17
|
-
}
|
18
|
-
}
|
package/templates/spa/src/App.ts
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
import { useState } from 'frontend-hamroun';
|
2
|
-
|
3
|
-
export default function App() {
|
4
|
-
const [count, setCount] = useState(0);
|
5
|
-
|
6
|
-
return {
|
7
|
-
type: 'div',
|
8
|
-
props: {
|
9
|
-
children: [
|
10
|
-
{
|
11
|
-
type: 'h1',
|
12
|
-
props: {
|
13
|
-
children: 'Frontend Hamroun App'
|
14
|
-
}
|
15
|
-
},
|
16
|
-
{
|
17
|
-
type: 'button',
|
18
|
-
props: {
|
19
|
-
onClick: () => setCount(count + 1),
|
20
|
-
children: `Count: ${count}`
|
21
|
-
}
|
22
|
-
}
|
23
|
-
]
|
24
|
-
}
|
25
|
-
};
|
26
|
-
}
|