@ikdao/hyp 0.1.0
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 +119 -0
- package/doc.md +223 -0
- package/example/counter/index.html +84 -0
- package/example/hello-world/index.html +37 -0
- package/helper/file-loader.js +19 -0
- package/index.js +12 -0
- package/license.md +4 -0
- package/package.json +31 -0
- package/src/a.js +26 -0
- package/src/dA.js +12 -0
- package/src/e.js +255 -0
- package/src/h.js +56 -0
- package/src/hyp.js +671 -0
- package/src/i.js +20 -0
- package/src/n.js +190 -0
- package/src/o.js +75 -0
- package/src/r.js +16 -0
- package/src/s.js +39 -0
- package/src/sA.js +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Hyp UI Framework(in dev)
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
**Hyp** (by [ikdao](https://ikdao.org)) is an **Indie Indic UI/UX/IX Framework** built to experiment with minimal functional UI design patterns, inspired by hyperscript, reactive state, and virtual DOM execution.
|
|
5
|
+
|
|
6
|
+
* **Lightweight**: Pure JS, minimal abstractions.
|
|
7
|
+
|
|
8
|
+
* **Reactive**: Built-in Actor/state, derived Act, and side Act.
|
|
9
|
+
|
|
10
|
+
* **Composable**: Functions are the building blocks.
|
|
11
|
+
|
|
12
|
+
* **Experimental**: Targets SPA, SVG, AR/VR, and beyond.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
HYP Core and Essentials
|
|
16
|
+
----------
|
|
17
|
+
|
|
18
|
+
## h() — Hyperscript
|
|
19
|
+
|
|
20
|
+
The h() function structure organs, organelles **virtual DOM node (VNode)**.
|
|
21
|
+
|
|
22
|
+
Plain text
|
|
23
|
+
` import { h } from "hyp"; const vnode = h("div", { class: "box" }, "Hello Hyp"); `
|
|
24
|
+
|
|
25
|
+
* ty → element type (string tag or component function)
|
|
26
|
+
|
|
27
|
+
* prp → props (attributes, events, class, style, etc.)
|
|
28
|
+
|
|
29
|
+
* chd → children (string, number, VNode, or array)
|
|
30
|
+
|
|
31
|
+
## Triad E,O,S - living interface
|
|
32
|
+
-----
|
|
33
|
+
### Orchestrater & Directors
|
|
34
|
+
|
|
35
|
+
**o (Organiser)** - identity and spatial manager, for awaring
|
|
36
|
+
create and organise organs
|
|
37
|
+
|
|
38
|
+
### e() — Executor - behaviour and renderer
|
|
39
|
+
render, redo organs(vDOM)
|
|
40
|
+
|
|
41
|
+
**s (Scheduler)** - Temporal Manager, for attending
|
|
42
|
+
run, clear organs, actors lifecycle
|
|
43
|
+
|
|
44
|
+
Plain text
|
|
45
|
+
` import { h, e } from "hyp"; const App = () => h("h1", null, "Hello World"); e(h(App), document.getElementById("root")); `
|
|
46
|
+
|
|
47
|
+
Handles:
|
|
48
|
+
|
|
49
|
+
* Mounting / unmounting components
|
|
50
|
+
|
|
51
|
+
* Props & event binding
|
|
52
|
+
|
|
53
|
+
* Child diffing (keyed + index-based)
|
|
54
|
+
|
|
55
|
+
* SVG namespace support
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Necessaries
|
|
59
|
+
-----------
|
|
60
|
+
|
|
61
|
+
These are the **core reactive orchestration primitives**.
|
|
62
|
+
|
|
63
|
+
Hyp States - Actors/Reactor/Interactor
|
|
64
|
+
|
|
65
|
+
a()
|
|
66
|
+
actors are active primitive
|
|
67
|
+
|
|
68
|
+
dA()/r()
|
|
69
|
+
derived Actor that act in response to existing act
|
|
70
|
+
sA()/i()
|
|
71
|
+
side actor that act in relation to existing act
|
|
72
|
+
|
|
73
|
+
n()
|
|
74
|
+
navigator that match path/query param and route to navigate or for navigating app
|
|
75
|
+
|
|
76
|
+
* const counter = a(0);console.log(counter.get()); // 0counter.set(1);
|
|
77
|
+
|
|
78
|
+
* const double = dA(() => counter.get() \* 2);
|
|
79
|
+
|
|
80
|
+
* sA(() => { console.log("Counter updated:", counter.get());}, () => \[counter.get()\]);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Future Possibilities
|
|
84
|
+
--------------------
|
|
85
|
+
|
|
86
|
+
The roadmap includes evolving Hyp into a **full SPA framework**:
|
|
87
|
+
|
|
88
|
+
* **m()** → custom class modules / extensible components
|
|
89
|
+
|
|
90
|
+
* **hX() / eX()** → AR/VR (XR) support
|
|
91
|
+
|
|
92
|
+
* **SVG rendering** → already supported in e()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
Example Counter App
|
|
96
|
+
-------------------
|
|
97
|
+
|
|
98
|
+
Plain text
|
|
99
|
+
` import HYP from "hyp"; const { h, e, a, sA } = HYP; const Counter = () => { const count = a(0); return h("div", { class: "counter" }, h("h1", null, () => "Count: " + count.get()), h("button", { onClick: () => count.set(count.get() + 1) }, "+"), h("button", { onClick: () => count.set(count.get() - 1) }, "-") ); }; e(h(Counter), document.getElementById("root")); `
|
|
100
|
+
|
|
101
|
+
Support Development
|
|
102
|
+
-------------------
|
|
103
|
+
|
|
104
|
+
* **UPI**: hemangtewari@upi
|
|
105
|
+
|
|
106
|
+
* **ETH**: 0x43ffd7C1Ea8AAfdc768c0883F35b2AE433EE4726
|
|
107
|
+
|
|
108
|
+
* **BTC**: bc1qgk84f0dfddqfcww58ftse832udksf2wslnd3cd
|
|
109
|
+
|
|
110
|
+
* **SOL**: DQr1t5uSriiwdu1NwTigJdbNg6WVHSFHijmyHFV27VC1
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
License
|
|
114
|
+
-------
|
|
115
|
+
|
|
116
|
+
**Open Source** under [Zero One One Self License - 011sl](https://legal.ikdao.org/license/011sl)
|
|
117
|
+
|
|
118
|
+
Plain text
|
|
119
|
+
` Hyp UI Framework - Hemang Tewari License: 011sl `
|
package/doc.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# HYP UI Framework Documentation
|
|
2
|
+
|
|
3
|
+
**License:** Zero One One License - [011sl](https://legal/ikdao.org/license/011sl)
|
|
4
|
+
**Author:** Hemang Tewari
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
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
|
+
|
|
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
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Core Modules
|
|
19
|
+
|
|
20
|
+
### 1. Hyperscript Function — `h()`
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
h(ty, prp, ...chd)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Creates a virtual node (VNode) representation of a UI element. Similar in concept to React's `createElement`.
|
|
27
|
+
|
|
28
|
+
**Parameters:**
|
|
29
|
+
|
|
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
|
+
|
|
34
|
+
**Returns:**
|
|
35
|
+
A virtual node object or component output.
|
|
36
|
+
|
|
37
|
+
**Behavior:**
|
|
38
|
+
|
|
39
|
+
* Normalizes properties and children.
|
|
40
|
+
* Supports nested arrays and function-based children.
|
|
41
|
+
* If `ty` is a function, executes it as a component.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### 2. Scheduler — `s`
|
|
46
|
+
|
|
47
|
+
Responsible for queuing and flushing asynchronous tasks efficiently using `queueMicrotask`.
|
|
48
|
+
|
|
49
|
+
**API:**
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
s.add(fn, ei)
|
|
53
|
+
s.flush()
|
|
54
|
+
s.clear(ei)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Usage:**
|
|
58
|
+
|
|
59
|
+
* Schedules lifecycle hooks, updates, and reactivity changes.
|
|
60
|
+
* Clears scheduled tasks for destroyed components.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### 3. Organiser — `o`
|
|
65
|
+
|
|
66
|
+
Manages **Organs**, the internal representation of component instances. Each organ maintains its state, lifecycle hooks, and effects.
|
|
67
|
+
|
|
68
|
+
**API:**
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
o.create(hi, body)
|
|
72
|
+
o.addLifecycle(ei, phase, fn)
|
|
73
|
+
o.runLifecycle(ei, phase, bodyRef)
|
|
74
|
+
o.addEffect(ei, clear)
|
|
75
|
+
o.destroy(ei)
|
|
76
|
+
o.get(ei)
|
|
77
|
+
o.isAlive(ei)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Lifecycle Phases:**
|
|
81
|
+
|
|
82
|
+
* `willMount`, `didMount`
|
|
83
|
+
* `willUpdate`, `didUpdate`
|
|
84
|
+
* `willUnmount`, `didUnmount`
|
|
85
|
+
|
|
86
|
+
**Responsibilities:**
|
|
87
|
+
|
|
88
|
+
* Assigns unique execution identities (`ei`).
|
|
89
|
+
* Tracks lifecycles and effects.
|
|
90
|
+
* Cleans up resources upon destruction.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 4. Executor — `e`
|
|
95
|
+
|
|
96
|
+
Handles rendering, updating, and unmounting of components.
|
|
97
|
+
|
|
98
|
+
**API:**
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
e.render(vnode, body)
|
|
102
|
+
e.patch(dom, oldVNode, newVNode, ei)
|
|
103
|
+
e.unmount(vnode, ei)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Core Functions:**
|
|
107
|
+
|
|
108
|
+
* `render()` — Creates DOM from virtual nodes.
|
|
109
|
+
* `patch()` — Efficiently updates DOM trees.
|
|
110
|
+
* `unmount()` — Safely removes elements and triggers cleanup.
|
|
111
|
+
|
|
112
|
+
**Utilities:**
|
|
113
|
+
|
|
114
|
+
* `pushEI()`, `popEI()`, `currentEI()` for managing execution context.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### 5. Actor — `a()` and `Actor` class
|
|
119
|
+
|
|
120
|
+
Reactive primitive for state management. Similar to signals or observables.
|
|
121
|
+
|
|
122
|
+
**Example:**
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
const count = a(0);
|
|
126
|
+
count.subscribe(() => console.log(count.get()));
|
|
127
|
+
count.set(1);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Methods:**
|
|
131
|
+
|
|
132
|
+
* `get()` — Returns current value.
|
|
133
|
+
* `set(next)` — Updates value and triggers subscriptions.
|
|
134
|
+
* `subscribe(fn)` — Registers reactive listeners.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### 6. Derived Actor — `dA()`
|
|
139
|
+
|
|
140
|
+
Creates computed signals that reactively derive from other actors.
|
|
141
|
+
|
|
142
|
+
**Example:**
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
const first = a('John');
|
|
146
|
+
const last = a('Doe');
|
|
147
|
+
const fullName = dA(() => `${first.get()} ${last.get()}`);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Automatically re-evaluates when dependencies change.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### 7. Side Actor — `sA()`
|
|
155
|
+
|
|
156
|
+
Manages reactive side effects (similar to `useEffect` in React).
|
|
157
|
+
|
|
158
|
+
**Usage:**
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
sA(() => {
|
|
162
|
+
console.log('Effect ran');
|
|
163
|
+
return () => console.log('Cleanup');
|
|
164
|
+
}, () => [someActor]);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Features:**
|
|
168
|
+
|
|
169
|
+
* Dependency-based re-execution.
|
|
170
|
+
* Automatic cleanup.
|
|
171
|
+
* Tied to component lifecycle.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Design Pattern — HYP Triad
|
|
176
|
+
|
|
177
|
+
| Layer | Name | Role |
|
|
178
|
+
| ---------- | ----------------- | ------------------------------------------ |
|
|
179
|
+
| Temporal | **Scheduler (s)** | Queues and executes microtasks efficiently |
|
|
180
|
+
| Structural | **Organiser (o)** | Manages organs, lifecycles, and effects |
|
|
181
|
+
| Execution | **Executor (e)** | Handles rendering, patching, and teardown |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Example Usage
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
import HYP, { h, e, a, dA, sA } from './hyp.js';
|
|
189
|
+
|
|
190
|
+
function Counter() {
|
|
191
|
+
const count = a(0);
|
|
192
|
+
const double = dA(() => count.get() * 2);
|
|
193
|
+
|
|
194
|
+
sA(() => {
|
|
195
|
+
console.log('Mounted');
|
|
196
|
+
return () => console.log('Unmounted');
|
|
197
|
+
}, []);
|
|
198
|
+
|
|
199
|
+
return h('div', {},
|
|
200
|
+
h('h1', {}, 'Count: ', count),
|
|
201
|
+
h('p', {}, 'Double: ', double),
|
|
202
|
+
h('button', { onClick: () => count.set(count.get() + 1) }, 'Increment')
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
e.render(h(Counter), document.body);
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Key Features
|
|
212
|
+
|
|
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
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
Licensed under the **Zero One One License (011sl)** — see [legal/ikdao.org/license/011sl](https://legal.ikdao.org/license/011sl).
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>HYP Counter</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: sans-serif;
|
|
10
|
+
background: #f9f9f9;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
}
|
|
16
|
+
.counter {
|
|
17
|
+
background: #fff;
|
|
18
|
+
padding: 24px;
|
|
19
|
+
border-radius: 12px;
|
|
20
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
.counter button {
|
|
24
|
+
margin: 6px;
|
|
25
|
+
padding: 8px 16px;
|
|
26
|
+
font-size: 16px;
|
|
27
|
+
border-radius: 6px;
|
|
28
|
+
border: none;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
transition: background 0.2s;
|
|
31
|
+
}
|
|
32
|
+
.counter button:hover {
|
|
33
|
+
background: #eee;
|
|
34
|
+
}
|
|
35
|
+
.footer {
|
|
36
|
+
margin-top: 16px;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
color: #555;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
41
|
+
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<div id="app"></div>
|
|
45
|
+
<script type="module" src="https://cdn.jsdelivr.net/gh/ikdao/hyp@main/hyp.js"></script>
|
|
46
|
+
|
|
47
|
+
<script type="module">
|
|
48
|
+
const { h, e, a, sA } = window.HYP;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
function Counter() {
|
|
52
|
+
const count = a(0);
|
|
53
|
+
|
|
54
|
+
sA(
|
|
55
|
+
() => {
|
|
56
|
+
console.log("Count changed:", count.get());
|
|
57
|
+
},
|
|
58
|
+
() => [count.get()]
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return h(
|
|
62
|
+
"div",
|
|
63
|
+
{ className: "counter" },
|
|
64
|
+
h("h1", {}, "Counter"),
|
|
65
|
+
h("p", { style: { fontSize: "24px" } }, "Count: ", count),
|
|
66
|
+
h(
|
|
67
|
+
"div",
|
|
68
|
+
{},
|
|
69
|
+
h("button", { onClick: () => count.set(count.get() + 1) }, "➕ Increment"),
|
|
70
|
+
h("button", { onClick: () => count.set(count.get() - 1) }, "➖ Decrement"),
|
|
71
|
+
h("button", { onClick: () => count.set(0) }, "🔄 Reset")
|
|
72
|
+
),
|
|
73
|
+
h("hr", {}),
|
|
74
|
+
h("div", { className: "footer" },
|
|
75
|
+
"Powered by HYP UI Framework 🌈 | Built with Ikdao 🩶 | Creator: Hemang Tewari 🛸👽🚀"
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
e.render(h(Counter), document.getElementById("app"));
|
|
81
|
+
|
|
82
|
+
</script>
|
|
83
|
+
</body>
|
|
84
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>Hello World - HYP UIIX Framework Example</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<link rel="preload stylesheet" as="style" id="style" href="https://cdn.jsdelivr.net/gh/ikdao/style@main/style.css">
|
|
8
|
+
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<!-- App Mount Point -->
|
|
12
|
+
<div id="app"></div>
|
|
13
|
+
|
|
14
|
+
<!-- HYP CDN -->
|
|
15
|
+
<script type="module" src="https://cdn.jsdelivr.net/gh/ikdao/hyp@main/hyp.js"></script>
|
|
16
|
+
|
|
17
|
+
<script type="module">
|
|
18
|
+
const { h, e } = window.HYP;
|
|
19
|
+
|
|
20
|
+
// Simple component
|
|
21
|
+
function HelloWorld() {
|
|
22
|
+
return h(
|
|
23
|
+
"div",
|
|
24
|
+
{ style: { fontFamily: "sans-serif", padding: "20px" } },
|
|
25
|
+
h("h1", {}, "Hello, World 👋"),
|
|
26
|
+
h("p", {}, "Powered by HYP UIIX Framework 🌈"),
|
|
27
|
+
h("p", {}, "Built with Ikdao 🩶"),
|
|
28
|
+
h("p", {}, "Creator Hemang Tewari 🛸👽🚀"),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Render into #app
|
|
33
|
+
const mount = document.getElementById("app");
|
|
34
|
+
e.render(h(HelloWorld), mount);
|
|
35
|
+
</script>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export async function loadRoutes(navigator, modules) {
|
|
2
|
+
for (const path in modules) {
|
|
3
|
+
const mod = modules[path];
|
|
4
|
+
|
|
5
|
+
// normalize path
|
|
6
|
+
let routePath = path
|
|
7
|
+
.replace(/^\.\/routes/, "")
|
|
8
|
+
.replace(/\.js$/, "")
|
|
9
|
+
.replace(/\/index$/, "/")
|
|
10
|
+
.replace(/\[([^\]]+)\]/g, ":$1");
|
|
11
|
+
|
|
12
|
+
if (routePath === "") routePath = "/";
|
|
13
|
+
|
|
14
|
+
navigator.route(routePath, async () => {
|
|
15
|
+
const m = await mod();
|
|
16
|
+
return m.default;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
package/index.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";
|
package/license.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ikdao/hyp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "HYP is an Indic UI/UX framework from ikdao. It uses living Architecture i.e. evolution to reactive UI/UX Frameworks.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hyp",
|
|
7
|
+
"hypui",
|
|
8
|
+
"hypjs",
|
|
9
|
+
"frontend",
|
|
10
|
+
"framework",
|
|
11
|
+
"ui",
|
|
12
|
+
"ux",
|
|
13
|
+
"web",
|
|
14
|
+
"design"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/ikdao/hyp#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/ikdao/hyp/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/ikdao/hyp.git"
|
|
23
|
+
},
|
|
24
|
+
"license": "01SL",
|
|
25
|
+
"author": "Hemang Tewari",
|
|
26
|
+
"type": "ESM",
|
|
27
|
+
"main": "index.js",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/a.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Actor a()
|
|
2
|
+
// Self License - 01SL
|
|
3
|
+
// HYP UI Framework
|
|
4
|
+
// Author: Hemang Tewari
|
|
5
|
+
|
|
6
|
+
let tr = null;
|
|
7
|
+
export class Actor {
|
|
8
|
+
constructor(initial) {
|
|
9
|
+
this.value = initial;
|
|
10
|
+
this.subs = new Set();
|
|
11
|
+
}
|
|
12
|
+
get() {
|
|
13
|
+
if (tr) this.subs.add(tr);
|
|
14
|
+
return this.value;
|
|
15
|
+
}
|
|
16
|
+
set(next) {
|
|
17
|
+
if (next === this.value) return;
|
|
18
|
+
this.value = next;
|
|
19
|
+
this.subs.forEach(fn => s.add(fn));
|
|
20
|
+
}
|
|
21
|
+
subscribe(fn) {
|
|
22
|
+
this.subs.add(fn);
|
|
23
|
+
return () => this.subs.delete(fn);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const a = (initial) => new Actor(initial);
|