@ikdao/hyp 0.1.0 → 0.1.12
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/LICENSE +7 -0
- package/doc.md +26 -26
- package/index.js +8 -8
- package/jsr.json +14 -0
- package/license.md +3 -2
- package/mod.js +12 -0
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Hemang Tewari
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/doc.md
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
The **HYP UI Framework** is a lightweight, hyperscript-driven UI framework that emphasizes declarative construction, reactive state management, and lifecycle organization. It is structured around the **HYP Triad Architectural Pattern**:
|
|
11
11
|
|
|
12
|
-
1. **Scheduler (s)**
|
|
13
|
-
2. **Organiser (o)**
|
|
14
|
-
3. **Executor (e)**
|
|
12
|
+
1. **Scheduler (s)** - Temporal layer for efficient task queuing and execution.
|
|
13
|
+
2. **Organiser (o)** - Structural layer for managing component identities, lifecycles, and contexts.
|
|
14
|
+
3. **Executor (e)** - Execution layer for rendering, updating, and unmounting components.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
## Core Modules
|
|
19
19
|
|
|
20
|
-
### 1. Hyperscript Function
|
|
20
|
+
### 1. Hyperscript Function - `h()`
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
23
|
h(ty, prp, ...chd)
|
|
@@ -27,9 +27,9 @@ Creates a virtual node (VNode) representation of a UI element. Similar in concep
|
|
|
27
27
|
|
|
28
28
|
**Parameters:**
|
|
29
29
|
|
|
30
|
-
* `ty`
|
|
31
|
-
* `prp`
|
|
32
|
-
* `...chd`
|
|
30
|
+
* `ty` - Element type or functional component.
|
|
31
|
+
* `prp` - Properties (attributes, event handlers, styles, refs).
|
|
32
|
+
* `...chd` - Children (strings, numbers, arrays, other VNodes, or Actors).
|
|
33
33
|
|
|
34
34
|
**Returns:**
|
|
35
35
|
A virtual node object or component output.
|
|
@@ -42,7 +42,7 @@ A virtual node object or component output.
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
### 2. Scheduler
|
|
45
|
+
### 2. Scheduler - `s`
|
|
46
46
|
|
|
47
47
|
Responsible for queuing and flushing asynchronous tasks efficiently using `queueMicrotask`.
|
|
48
48
|
|
|
@@ -61,7 +61,7 @@ s.clear(ei)
|
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
|
-
### 3. Organiser
|
|
64
|
+
### 3. Organiser - `o`
|
|
65
65
|
|
|
66
66
|
Manages **Organs**, the internal representation of component instances. Each organ maintains its state, lifecycle hooks, and effects.
|
|
67
67
|
|
|
@@ -91,7 +91,7 @@ o.isAlive(ei)
|
|
|
91
91
|
|
|
92
92
|
---
|
|
93
93
|
|
|
94
|
-
### 4. Executor
|
|
94
|
+
### 4. Executor - `e`
|
|
95
95
|
|
|
96
96
|
Handles rendering, updating, and unmounting of components.
|
|
97
97
|
|
|
@@ -105,9 +105,9 @@ e.unmount(vnode, ei)
|
|
|
105
105
|
|
|
106
106
|
**Core Functions:**
|
|
107
107
|
|
|
108
|
-
* `render()`
|
|
109
|
-
* `patch()`
|
|
110
|
-
* `unmount()`
|
|
108
|
+
* `render()` - Creates DOM from virtual nodes.
|
|
109
|
+
* `patch()` - Efficiently updates DOM trees.
|
|
110
|
+
* `unmount()` - Safely removes elements and triggers cleanup.
|
|
111
111
|
|
|
112
112
|
**Utilities:**
|
|
113
113
|
|
|
@@ -115,7 +115,7 @@ e.unmount(vnode, ei)
|
|
|
115
115
|
|
|
116
116
|
---
|
|
117
117
|
|
|
118
|
-
### 5. Actor
|
|
118
|
+
### 5. Actor - `a()` and `Actor` class
|
|
119
119
|
|
|
120
120
|
Reactive primitive for state management. Similar to signals or observables.
|
|
121
121
|
|
|
@@ -129,13 +129,13 @@ count.set(1);
|
|
|
129
129
|
|
|
130
130
|
**Methods:**
|
|
131
131
|
|
|
132
|
-
* `get()`
|
|
133
|
-
* `set(next)`
|
|
134
|
-
* `subscribe(fn)`
|
|
132
|
+
* `get()` - Returns current value.
|
|
133
|
+
* `set(next)` - Updates value and triggers subscriptions.
|
|
134
|
+
* `subscribe(fn)` - Registers reactive listeners.
|
|
135
135
|
|
|
136
136
|
---
|
|
137
137
|
|
|
138
|
-
### 6. Derived Actor
|
|
138
|
+
### 6. Derived Actor - `dA()`
|
|
139
139
|
|
|
140
140
|
Creates computed signals that reactively derive from other actors.
|
|
141
141
|
|
|
@@ -151,7 +151,7 @@ Automatically re-evaluates when dependencies change.
|
|
|
151
151
|
|
|
152
152
|
---
|
|
153
153
|
|
|
154
|
-
### 7. Side Actor
|
|
154
|
+
### 7. Side Actor - `sA()`
|
|
155
155
|
|
|
156
156
|
Manages reactive side effects (similar to `useEffect` in React).
|
|
157
157
|
|
|
@@ -172,7 +172,7 @@ sA(() => {
|
|
|
172
172
|
|
|
173
173
|
---
|
|
174
174
|
|
|
175
|
-
## Design Pattern
|
|
175
|
+
## Design Pattern - HYP Triad
|
|
176
176
|
|
|
177
177
|
| Layer | Name | Role |
|
|
178
178
|
| ---------- | ----------------- | ------------------------------------------ |
|
|
@@ -210,14 +210,14 @@ e.render(h(Counter), document.body);
|
|
|
210
210
|
|
|
211
211
|
## Key Features
|
|
212
212
|
|
|
213
|
-
* **Declarative Virtual DOM**
|
|
214
|
-
* **Reactive Core**
|
|
215
|
-
* **Lifecycle Management**
|
|
216
|
-
* **Scheduler Optimization**
|
|
217
|
-
* **Composable Effects**
|
|
213
|
+
* **Declarative Virtual DOM** - Hyperscript-based structure for UI creation.
|
|
214
|
+
* **Reactive Core** - Lightweight Actor model for state.
|
|
215
|
+
* **Lifecycle Management** - Fine-grained mount/update/unmount hooks.
|
|
216
|
+
* **Scheduler Optimization** - Microtask-based async task management.
|
|
217
|
+
* **Composable Effects** - Derived and side actors for complex reactivity.
|
|
218
218
|
|
|
219
219
|
---
|
|
220
220
|
|
|
221
221
|
## License
|
|
222
222
|
|
|
223
|
-
Licensed under the **Zero One One License (011sl)**
|
|
223
|
+
Licensed under the **Zero One One License (011sl)** - see [legal/ikdao.org/license/011sl](https://legal.ikdao.org/license/011sl).
|
package/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Zero One Self License - 01SL
|
|
3
3
|
// HYP Framework - Hemang Tewari
|
|
4
4
|
|
|
5
|
-
export { HYP as default } from "
|
|
6
|
-
export { h } from "
|
|
7
|
-
export { e } from "
|
|
8
|
-
export { o } from "
|
|
9
|
-
export { s } from "
|
|
10
|
-
export { a } from "
|
|
11
|
-
export { r } from "
|
|
12
|
-
export { i } from "
|
|
5
|
+
export { HYP as default } from "./src/hyp.js";
|
|
6
|
+
export { h } from "./src/h.js";
|
|
7
|
+
export { e } from ",/src/e.js";
|
|
8
|
+
export { o } from "./src/o.js";
|
|
9
|
+
export { s } from "./src/s.js";
|
|
10
|
+
export { a } from "./src/a.js";
|
|
11
|
+
export { r } from "./src/r.js";
|
|
12
|
+
export { i } from "./src/i.js";
|
package/jsr.json
ADDED
package/license.md
CHANGED
package/mod.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// HYP UI/UX Framework
|
|
2
|
+
// Zero One Self License - 01SL
|
|
3
|
+
// HYP Framework - Hemang Tewari
|
|
4
|
+
|
|
5
|
+
export { HYP as default } from "./src/hyp.js";
|
|
6
|
+
export { h } from "./src/h.js";
|
|
7
|
+
export { e } from "./src/e.js";
|
|
8
|
+
export { o } from "./src/o.js";
|
|
9
|
+
export { s } from "./src/s.js";
|
|
10
|
+
export { a } from "./src/a.js";
|
|
11
|
+
export { r } from "./src/r.js";
|
|
12
|
+
export { i } from "./src/i.js";
|