@snupo/jmc 1.0.62 → 1.2.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/LICENSE +21 -0
- package/design-guide.md +193 -0
- package/dist/base.d.ts +3 -2
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +11 -13
- package/dist/base.js.map +1 -1
- package/dist/events.js +1 -0
- package/dist/events.js.map +1 -1
- package/dist/h.d.ts +14 -7
- package/dist/h.d.ts.map +1 -1
- package/dist/h.js +7 -4
- package/dist/h.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/jmc.d.ts +1 -12
- package/dist/jmc.d.ts.map +1 -1
- package/dist/jmc.js +80 -119
- package/dist/jmc.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +5 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +6 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +14 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +10 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/jsx.d.ts +39 -46
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js.map +1 -1
- package/dist/lib.d.ts +5 -3
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +4 -5
- package/dist/lib.js.map +1 -1
- package/dist/props.d.ts +11 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +43 -0
- package/dist/props.js.map +1 -0
- package/dist/update.d.ts +10 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +48 -0
- package/dist/update.js.map +1 -0
- package/package.json +31 -4
- package/readme.md +313 -34
- package/src/base.ts +11 -15
- package/src/events.ts +1 -1
- package/src/h.ts +29 -18
- package/src/index.ts +2 -1
- package/src/jmc.ts +90 -138
- package/src/jsx-dev-runtime.ts +8 -0
- package/src/jsx-runtime.ts +17 -0
- package/src/jsx.ts +18 -30
- package/src/lib.ts +10 -8
- package/src/props.ts +43 -0
- package/src/update.ts +54 -0
- package/dist/updateview.d.ts +0 -17
- package/dist/updateview.d.ts.map +0 -1
- package/dist/updateview.js +0 -43
- package/dist/updateview.js.map +0 -1
- package/src/updateview.ts +0 -48
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 snupo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/design-guide.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# jmc design guide
|
|
2
|
+
|
|
3
|
+
This guide is for Claude, and other coding agents, working in an app built with jmc. Read it before you change model, view or controller code. It describes how such an app is structured and the rules that keep that structure intact. People new to the codebase can read it too.
|
|
4
|
+
|
|
5
|
+
For the API itself (`patch`, `updateview`, components, props), see the [readme](readme.md).
|
|
6
|
+
|
|
7
|
+
## The core idea
|
|
8
|
+
|
|
9
|
+
Apps that use jmc follow a well-defined MVC architecture. The code lives in three folders:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
model/
|
|
13
|
+
view/
|
|
14
|
+
controller/
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Each part has one job, and the boundaries between them are strict.
|
|
18
|
+
|
|
19
|
+
### Model
|
|
20
|
+
|
|
21
|
+
The model is a plain JavaScript object (POJO): no proxies, no observables, no setters, no classes with behaviour. A value changes by plain assignment.
|
|
22
|
+
|
|
23
|
+
The model is held by a variable that is never reassigned. That variable is either `m`, or more often `vm`, a view model that holds the domain model in its field `m`. The view model adds the state that only the UI cares about, such as the current selection or an open dialog. Usually `vm` or `m` is global.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// model/model.ts
|
|
27
|
+
export const vm = {
|
|
28
|
+
m: { todos: [] as Todo[] }, // the domain model
|
|
29
|
+
filter: 'all' as Filter, // UI state
|
|
30
|
+
editing: undefined as Todo | undefined,
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Because `vm` and `m` never change identity, every part of the app can hold on to them. Content changes happen inside them: assign fields, push to arrays, replace sub-objects. Never write `vm = …` or `vm.m = …` to "reset" state. Clear or reassign the fields instead.
|
|
35
|
+
|
|
36
|
+
### View
|
|
37
|
+
|
|
38
|
+
The view is written in TSX. The TSX creates vdom objects, and jmc uses them to update the real DOM.
|
|
39
|
+
|
|
40
|
+
When the vdom comes from a function component, jmc attaches that function to the DOM element it created. Calling `updateview(element)` runs the function again with the current model and updates that element. Making view updates this easy is a central idea of jmc: you don't track what changed, you re-render the part of the page that might be affected.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
// view/todolist.tsx
|
|
44
|
+
export const TodoList = () =>
|
|
45
|
+
<ul id='todos'>
|
|
46
|
+
{vm.m.todos.map(t => <li class={cc({ done: t.done })}>{t.text}</li>)}
|
|
47
|
+
</ul>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The view turns model values into DOM elements, and nothing else. It operates on a **read-only** model. TypeScript can enforce this with jmc's `DeepReadonly` type: the view reads the model through a read-only alias of the same object.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// model/model.ts
|
|
54
|
+
export const rvm: DeepReadonly<typeof vm> = vm // the view imports rvm, controllers import vm
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This comes at a cost: `DeepReadonly` changes the model's types as the view sees them. With a complex model, the resulting types and error messages can get hard for people to read. A project may therefore decide to follow the rule without `tsc` enforcing it. Where it is not enforced, the programmer must keep to it.
|
|
58
|
+
|
|
59
|
+
Whether to enforce it is the project's decision. **Don't add or remove `DeepReadonly` enforcement without asking first.** Follow the project's existing choice, and don't loosen types or add casts to get around it.
|
|
60
|
+
|
|
61
|
+
User input in the view goes to a controller method. The view never handles it by changing the model itself.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<button onclick={() => todoctrl.add(vm.newtext)}>Add</button>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Controller
|
|
68
|
+
|
|
69
|
+
Controllers are typically stateless and usually global singletons.
|
|
70
|
+
|
|
71
|
+
- **Only controllers update the model.**
|
|
72
|
+
- **Only controllers call `updateview`**, after they changed the model.
|
|
73
|
+
|
|
74
|
+
A controller method has two parts:
|
|
75
|
+
|
|
76
|
+
1. modify the model
|
|
77
|
+
2. call `updateview()` for the parts of the view that might be affected
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
// controller/todocontroller.ts
|
|
81
|
+
class TodoController {
|
|
82
|
+
add(text: string) {
|
|
83
|
+
vm.m.todos.push({ text, done: false }) // 1. modify the model
|
|
84
|
+
updateview('#todos', '#count') // 2. update the affected view
|
|
85
|
+
}
|
|
86
|
+
toggle(t: Todo) {
|
|
87
|
+
t.done = !t.done
|
|
88
|
+
updateview('#todos', '#count')
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export const todoctrl = rebind(new TodoController())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`rebind` binds the methods to the instance, so they can also be passed directly as event handlers.
|
|
95
|
+
|
|
96
|
+
This isn't specific to controllers. In JavaScript, a method passed on by itself (as an event handler, a callback, `arr.map(o.f)`) loses its `this`. So apply `rebind` to every instance of a class whose methods use `this`: `rebind(new X())`, or `rebind(this)` in the constructor. jmc does this for class components already, so don't call it there.
|
|
97
|
+
|
|
98
|
+
`rebind` binds only the methods of the object's own class, not methods inherited from a base class. For those, call `rebind(o, Base.prototype)` as well.
|
|
99
|
+
|
|
100
|
+
An asynchronous controller method follows the same pattern after each `await`: change the model, then update the view.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
async load() {
|
|
104
|
+
vm.loading = true
|
|
105
|
+
updateview('#status')
|
|
106
|
+
vm.m.todos = await fetchtodos()
|
|
107
|
+
vm.loading = false
|
|
108
|
+
updateview()
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Rules
|
|
113
|
+
|
|
114
|
+
When you write or change code in a jmc app:
|
|
115
|
+
|
|
116
|
+
- **Don't change the model in the view.** That includes event handlers written inline in TSX: they call a controller method. It also includes mutating array methods: `vm.m.todos.sort(…)` in a view sorts the model. Use `toSorted`, `toReversed`, `filter`, `map` or a copy.
|
|
117
|
+
- **Don't call `updateview` from the view or the model.** Class components calling `this.updateview()` for their own local state are the exception, see below.
|
|
118
|
+
- **Don't reassign `m` or `vm`.** Change their contents.
|
|
119
|
+
- **Keep the model plain.** Don't add proxies, signals, observables, stores, getters with side effects, or state libraries. Derived values are computed in the view, or in plain functions the view calls.
|
|
120
|
+
- **Keep controllers stateless.** State belongs in the model or view model, where the view can see it.
|
|
121
|
+
- **After changing the model, update every part of the view it might affect.** If you are unsure which parts that are, update a larger part. `updateview()` with no arguments updates the whole page and is always correct. Updating too much only costs time; updating too little leaves the page showing stale data, which is a bug.
|
|
122
|
+
- **Give update targets a stable handle.** The root element of a function component that controllers update on its own gets an `id` or a class, so a controller can name it in `updateview('#todos')`.
|
|
123
|
+
|
|
124
|
+
### Class components
|
|
125
|
+
|
|
126
|
+
A class component is like a function component that can hold state. Its `view()` method plays the part of the function, and jmc creates the instance once and reuses it as long as the same class is rendered at the same place. Fields of the instance survive re-renders, and the component can update itself with `this.updateview()`.
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
class Dropdown extends Component<{ items: string[], onpick: (s: string) => void }> {
|
|
130
|
+
open = false
|
|
131
|
+
toggle() { this.open = !this.open; this.updateview() }
|
|
132
|
+
view(): H {
|
|
133
|
+
return <div class={cc('dropdown', { open: this.open })}>
|
|
134
|
+
<button onclick={this.toggle}>▾</button>
|
|
135
|
+
{this.open && <ul>{this.props.items.map(s => <li onclick={() => this.props.onpick(s)}>{s}</li>)}</ul>}
|
|
136
|
+
</div>
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Use a class component for a self-contained widget whose state no other part of the app needs, like `open` above. Such a component is its own small model and controller. State that the rest of the app reads or changes belongs in the model, and the code that changes it belongs in a controller. In the example, `onpick` would be a controller method.
|
|
142
|
+
|
|
143
|
+
`mounted()` runs once after the first render, and `update(uc)` runs before each re-render (return `true` to skip it). See the readme for all members.
|
|
144
|
+
|
|
145
|
+
### Islands
|
|
146
|
+
|
|
147
|
+
Content managed by another library, such as a map or an editor, lives in an element marked `const`. jmc renders it once and leaves it alone afterwards. Controllers still own the model. The island's `update` callback passes model changes on to the library. See the readme for details.
|
|
148
|
+
|
|
149
|
+
## Updating the view
|
|
150
|
+
|
|
151
|
+
`updateview(...)` updates right away: when it returns, the DOM shows the current model. Use it by default.
|
|
152
|
+
|
|
153
|
+
Three variants don't update right away. They queue the update and run all queued updates together later, and an element queued several times is updated once:
|
|
154
|
+
|
|
155
|
+
| function | runs the queued updates | use it when |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| `updateviewaf(...)` | at the next animation frame | events fire faster than the screen redraws: `mousemove`, `pointermove`, `scroll`, `resize`, dragging. The view updates at most once per frame. |
|
|
158
|
+
| `updateviewmicro(...)` | at the next microtask | one action calls several controller methods that each update the view. Their updates collapse into one, still before the browser paints. |
|
|
159
|
+
| `updateviewsync(...)` | immediately, together with everything queued | you need the DOM up to date now, for example to measure or focus an element, while other updates are queued. |
|
|
160
|
+
|
|
161
|
+
`flush()` runs everything queued, immediately.
|
|
162
|
+
|
|
163
|
+
After `updateviewaf` or `updateviewmicro`, the DOM is not updated yet. Code that reads the DOM right after the call, measures it or focuses an element sees the old state. Use `updateview` or `updateviewsync` there.
|
|
164
|
+
|
|
165
|
+
All of them take the same arguments as `updateview`: selectors, elements, a depth number, an update context object. Like `updateview`, they are called only by controllers.
|
|
166
|
+
|
|
167
|
+
## Utilities
|
|
168
|
+
|
|
169
|
+
jmc exports a few helpers. Use them instead of writing your own:
|
|
170
|
+
|
|
171
|
+
| helper | what it does | typical use |
|
|
172
|
+
|---|---|---|
|
|
173
|
+
| `cc(...)` | joins class names. Objects contribute their keys with truthy values | `class={cc('item', { active: t === vm.selected, done: t.done })}` in the view |
|
|
174
|
+
| `<When cond={…}>` | renders its children only if `cond` is true | conditional blocks with several children. For a single element, `{cond && <p>…</p>}` is enough |
|
|
175
|
+
| `lazy(f)` | a prop value that is evaluated at each render, not when the JSX is created | a prop that must read the model at update time |
|
|
176
|
+
| `DeepReadonly<T>` | a type that makes all nested fields read-only | the view's read-only access to the model, see [View](#view) |
|
|
177
|
+
| `rebind(o)` | binds the prototype methods of `o` to `o` | every class instance whose methods use `this`, such as controllers: `export const todoctrl = rebind(new TodoController())`, so `onclick={todoctrl.clear}` works. Class components are rebound by jmc already |
|
|
178
|
+
| `closestby(node, pred)` | the nearest ancestor of `node`, or `node` itself, matching `pred` | event delegation: find the item element from `event.target` |
|
|
179
|
+
| `focuselement(node)` | focuses the node | in `mounted`, or in a controller after `updateview` |
|
|
180
|
+
| `mount({ … })` | puts values on `globalThis` | debugging: `mount({ vm, todoctrl })` makes model and controllers reachable in the browser console |
|
|
181
|
+
| `loggedmethods(o)` | wraps `o` so that each method call is logged with its arguments and result | debugging controllers: `export const todoctrl = loggedmethods(rebind(new TodoController()))` shows every action in the console. `loggedmethodscolored(color, o)` picks the log color |
|
|
182
|
+
|
|
183
|
+
`jmcconfig.debug = true` marks each component root with its name (`comp="TodoList"`), so the dev tools show which component rendered what.
|
|
184
|
+
|
|
185
|
+
## Where things go
|
|
186
|
+
|
|
187
|
+
| you need to… | put it in |
|
|
188
|
+
|---|---|
|
|
189
|
+
| store data or UI state | a field of `m` or `vm`, in `model/` |
|
|
190
|
+
| show data | a component in `view/` |
|
|
191
|
+
| react to a click, input or other event | a controller method in `controller/`, called from the view |
|
|
192
|
+
| load or save data | a controller method, which updates the model and then the view |
|
|
193
|
+
| compute a value derived from the model | a plain function, called by the view |
|
package/dist/base.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare function rebind<T extends object>(o: T, proto?: any): T;
|
|
2
|
-
|
|
2
|
+
/** wraps o so that each method call is reported to logger, after the method returned */
|
|
3
3
|
export declare const loggedmethodsex: <T extends Record<string, any>>(o: T, logger: (name: string, args: any[], result: any) => void) => T;
|
|
4
|
-
export declare const loggedmethods: <T extends Record<string, any>>(o: T) => T;
|
|
5
4
|
export declare const loggedmethodscolored: <T extends Record<string, any>>(bgcolor: string, o: T) => T;
|
|
5
|
+
export declare const loggedmethods: <T extends Record<string, any>>(o: T) => T;
|
|
6
6
|
export declare function closestby(e: Node | null, pred: (e: Node) => boolean): Node | null;
|
|
7
7
|
export declare function lazy<T>(f: () => T): () => T;
|
|
8
|
+
export declare function mount(o: Record<string, any>): void;
|
|
8
9
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,MAA2B,GAAG,CAAC,CAKlF;AAED,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,MAA2B,GAAG,CAAC,CAKlF;AAED,wFAAwF;AACxF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,MAS3H,CAAA;AAEF,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,CAAC,KAAG,CAAyJ,CAAA;AAErP,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,KAAG,CAAuC,CAAA;AAE3G,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,IAAI,CAAsE;AAExJ,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,SAAD,CAAC,CAAoC;AAEtE,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAkC"}
|
package/dist/base.js
CHANGED
|
@@ -4,23 +4,21 @@ export function rebind(o, proto = Object.getPrototypeOf(o)) {
|
|
|
4
4
|
.forEach(([name]) => o[name] = o[name].bind(o));
|
|
5
5
|
return o;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/** wraps o so that each method call is reported to logger, after the method returned */
|
|
8
8
|
export const loggedmethodsex = (o, logger) => new Proxy(o, {
|
|
9
9
|
get(target, name, receiver) {
|
|
10
|
-
if (typeof target[name]
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
return Reflect.get(target, name, receiver);
|
|
10
|
+
if (typeof target[name] !== 'function')
|
|
11
|
+
return Reflect.get(target, name, receiver);
|
|
12
|
+
return function (...args) {
|
|
13
|
+
let result = target[name].apply(this, args);
|
|
14
|
+
logger(name, args, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
18
17
|
},
|
|
19
18
|
});
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
19
|
+
export const loggedmethodscolored = (bgcolor, o) => loggedmethodsex(o, (name, args, result) => console.log('%c' + name, `background:${bgcolor};color:white;padding:2px;font-weight:bold`, args, result));
|
|
20
|
+
export const loggedmethods = (o) => loggedmethodscolored('#585059', o);
|
|
22
21
|
export function closestby(e, pred) { return (e == null || pred(e)) ? e : closestby(e.parentNode, pred); }
|
|
23
|
-
// export type Expr<T> = T | (() => T)
|
|
24
|
-
// export let evaluate = <T>(expr: Expr<T>): T => (expr instanceof Function ? expr() : expr)
|
|
25
22
|
export function lazy(f) { f.thunk = 1; return f; }
|
|
23
|
+
export function mount(o) { Object.assign(globalThis, o); }
|
|
26
24
|
//# sourceMappingURL=base.js.map
|
package/dist/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAmB,CAAI,EAAE,KAAK,GAAG,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f(o)): T {\r\n Object.entries(Object.getOwnPropertyDescriptors(proto))\r\n .filter(([name, p]) => name != 'constructor' && p.value instanceof Function)\r\n .forEach(([name]) => (o as any)[name] = (o as any)[name].bind(o))\r\n return o\r\n}\r\n\r\n/** wraps o so that each method call is reported to logger, after the method returned */\r\nexport const loggedmethodsex = <T extends Record<string, any>>(o: T, logger: (name: string, args: any[], result: any) => void) => new Proxy(o, {\r\n get(target, name: string, receiver) {\r\n if (typeof target[name] !== 'function') return Reflect.get(target, name, receiver)\r\n return function (this: T, ...args: any[]) {\r\n let result = target[name].apply(this, args)\r\n logger(name, args, result)\r\n return result\r\n }\r\n },\r\n})\r\n\r\nexport const loggedmethodscolored = <T extends Record<string, any>>(bgcolor: string, o: T): T => loggedmethodsex(o, (name, args, result) => console.log('%c' + name, `background:${bgcolor};color:white;padding:2px;font-weight:bold`, args, result))\r\n\r\nexport const loggedmethods = <T extends Record<string, any>>(o: T): T => loggedmethodscolored('#585059', o)\r\n\r\nexport function closestby(e: Node | null, pred: (e: Node) => boolean): Node | null { return (e == null || pred(e)) ? e : closestby(e.parentNode, pred) }\r\n\r\nexport function lazy<T>(f: () => T) { (f as any).thunk = 1; return f }\r\n\r\nexport function mount(o: Record<string, any>) { Object.assign(globalThis, o) }"]}
|
package/dist/events.js
CHANGED
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAQ7G,MAAM,UAAU,QAAQ,CACpB,EAAW,EACX,IAAY,EACZ,OAA6B;IAE7B,IAAI,GAAG,GAAG,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAA;IAE5B,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAA;IACrB,IAAI,GAAG,KAAK,OAAO;QAAE,OAAM;IAC3B,IAAI,GAAG;QAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC1C,IAAI,OAAO,EAAE,CAAC;QACV,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAClC,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IACvB,CAAC;SAAM,CAAC;QACJ,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;AACL,CAAC","sourcesContent":["// future work: maybe lifecycle callbacks should occur in a phase 2 after a phase 1 that does all dom updates\r\n\r\ndeclare global {\r\n interface Element {\r\n eventmap?: { [type: string]: EventListener | null }\r\n }\r\n}\r\n\r\nexport function setevent(\r\n el: Element,\r\n type: string,\r\n handler: EventListener | null) {\r\n\r\n let map = el.eventmap ??= {}\r\n\r\n const old = map[type]\r\n if (old === handler) return\r\n if (old) el.removeEventListener(type, old)\r\n if (handler) {\r\n el.addEventListener(type, handler)\r\n map[type] = handler\r\n } else {\r\n delete map[type]\r\n }\r\n}"]}
|
package/dist/h.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { JmcIntrinsicElements } from './jsx.js';
|
|
1
2
|
export type J = Record<string, any>;
|
|
2
|
-
export type UC = J;
|
|
3
3
|
export type Selector = string | Node;
|
|
4
|
-
|
|
5
|
-
export type
|
|
4
|
+
/** an updateview command: a target (selector or node), a depth (number) or an update context (object) */
|
|
5
|
+
export type Command = Selector | J | number;
|
|
6
|
+
export type FComponent = (props: J, children?: Children) => HU;
|
|
6
7
|
type HKindElement = 1;
|
|
7
8
|
type HKindFunctionComponent = 2;
|
|
8
9
|
type HKindClassComponent = 3;
|
|
@@ -27,19 +28,19 @@ export type HFragment = {
|
|
|
27
28
|
export type HElement = {
|
|
28
29
|
kind: HKindElement;
|
|
29
30
|
tag: string;
|
|
30
|
-
p
|
|
31
|
+
p: J;
|
|
31
32
|
cn?: Children;
|
|
32
33
|
};
|
|
33
34
|
export type HFunctionComponent = {
|
|
34
35
|
kind: HKindFunctionComponent;
|
|
35
36
|
tag: FComponent;
|
|
36
|
-
p
|
|
37
|
+
p: J;
|
|
37
38
|
cn?: Children;
|
|
38
39
|
};
|
|
39
40
|
export type HClassComponent = {
|
|
40
41
|
kind: HKindClassComponent;
|
|
41
42
|
tag: CComponent;
|
|
42
|
-
p
|
|
43
|
+
p: J;
|
|
43
44
|
cn?: Children;
|
|
44
45
|
i?: IClassComponent;
|
|
45
46
|
};
|
|
@@ -48,7 +49,13 @@ export type H = HText & {
|
|
|
48
49
|
kind?: undefined;
|
|
49
50
|
} | HElement | HFunctionComponent | HClassComponent | HFragment;
|
|
50
51
|
export type HU = H | undefined | null;
|
|
51
|
-
export declare function jsx(tag: any, p: any, ...cn: any[]): HElement |
|
|
52
|
+
export declare function jsx(tag: any, p: any, ...cn: any[]): HElement | HComp | HFragment;
|
|
53
|
+
export declare namespace jsx {
|
|
54
|
+
namespace JSX {
|
|
55
|
+
interface IntrinsicElements extends JmcIntrinsicElements {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
52
59
|
export declare let jsxf: symbol;
|
|
53
60
|
export {};
|
|
54
61
|
//# sourceMappingURL=h.d.ts.map
|
package/dist/h.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,MAAM,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEnC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAA;AAEpC,yGAAyG;AACzG,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAA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A;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,mBAAmB,CAAA;IACzB,GAAG,EAAE,UAAU,CAAA;IACf,CAAC,EAAE,CAAC,CAAA;IACJ,EAAE,CAAC,EAAE,QAAQ,CAAA;IACb,CAAC,CAAC,EAAE,eAAe,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,kBAAkB,GAAG,eAAe,CAAA;AAExD,MAAM,MAAM,CAAC,GACP,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GAC5B,QAAQ,GACR,kBAAkB,GAClB,eAAe,GACf,SAAS,CAAA;AAEf,MAAM,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,CAAA;AAIrC,wBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAchF;AAID,yBAAiB,GAAG,CAAC;IACjB,UAAiB,GAAG,CAAC;QACjB,UAAiB,iBAAkB,SAAQ,oBAAoB;SAAI;KACtE;CACJ;AAGD,eAAO,IAAI,IAAI,QAAW,CAAA"}
|
package/dist/h.js
CHANGED
|
@@ -3,13 +3,16 @@ export function jsx(tag, p, ...cn) {
|
|
|
3
3
|
if (tag?.kind)
|
|
4
4
|
return tag; // already an H node, flatten tree
|
|
5
5
|
let kind = tag == jsxf ? 4 : tag instanceof Function ? (isclass(tag) ? 3 : 2) : 1;
|
|
6
|
-
let h = { kind };
|
|
6
|
+
let h = { kind, p: p ?? {} };
|
|
7
7
|
if (kind != 4)
|
|
8
8
|
h.tag = tag;
|
|
9
|
-
if (
|
|
10
|
-
h.p = p;
|
|
11
|
-
if (cn?.length)
|
|
9
|
+
if (cn?.length) {
|
|
12
10
|
h.cn = cn;
|
|
11
|
+
// components get their children in props.children, as with the automatic runtime (jsx-runtime.ts).
|
|
12
|
+
// elements do not: setprops would write them to the element's read-only children property
|
|
13
|
+
if (kind == 2 || kind == 3)
|
|
14
|
+
h.p = { ...h.p, children: cn };
|
|
15
|
+
}
|
|
13
16
|
return h;
|
|
14
17
|
}
|
|
15
18
|
// fragment is only used above as a sentinel
|
package/dist/h.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h.js","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"h.js","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"AA6EA,IAAI,OAAO,GAAG,CAAC,CAAW,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AAErE,MAAM,UAAU,GAAG,CAAC,GAAQ,EAAE,CAAM,EAAE,GAAG,EAAS;IAC9C,IAAI,GAAG,EAAE,IAAI;QAAE,OAAO,GAAG,CAAA,CAAC,kCAAkC;IAE5D,IAAI,IAAI,GAAU,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAExF,IAAI,CAAC,GAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAA;IACjC,IAAI,IAAI,IAAI,CAAC;QAAE,CAAC,CAAC,GAAG,GAAG,GAAG,CAAA;IAC1B,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC;QACb,CAAC,CAAC,EAAE,GAAG,EAAE,CAAA;QACT,mGAAmG;QACnG,0FAA0F;QAC1F,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;YAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;IAC9D,CAAC;IACD,OAAO,CAAC,CAAA;AACZ,CAAC;AAUD,4CAA4C;AAC5C,MAAM,CAAC,IAAI,IAAI,GAAG,MAAM,EAAE,CAAA","sourcesContent":["import type { JmcIntrinsicElements } from './jsx.js'\r\n\r\nexport type J = Record<string, any> // a json record\r\n\r\nexport type Selector = string | Node\r\n\r\n/** an updateview command: a target (selector or node), a depth (number) or an update context (object) */\r\nexport type Command = Selector | J | number\r\n\r\n// TBD REMOVE the children parameter once we know it is unused: components get their children in props.children.\r\n// the second parameter remains for function components written before props.children existed\r\nexport type FComponent = (props: J, children?: Children) => HU\r\n\r\ntype HKindElement = 1\r\ntype HKindFunctionComponent = 2\r\ntype HKindClassComponent = 3\r\ntype HKindFragment = 4\r\n\r\nexport type HKind = HKindElement | HKindFunctionComponent | HKindClassComponent | HKindFragment\r\n\r\nexport interface IClassComponent {\r\n element: Node\r\n props?: Record<string, any>\r\n view(): HU\r\n update(uc: any): boolean | void\r\n mounted?(): void\r\n}\r\n\r\nexport interface CComponent {\r\n new(props: any): IClassComponent\r\n}\r\n\r\nexport type Children = HU[]\r\n\r\nexport type HText =\r\n | string // text node\r\n | number // text node\r\n | boolean // renders nothing, like null and undefined\r\n\r\nexport type HFragment = {\r\n kind: HKindFragment\r\n cn?: Children\r\n}\r\n\r\nexport type HElement = {\r\n kind: HKindElement\r\n tag: string\r\n p: J\r\n cn?: Children\r\n}\r\n\r\nexport type HFunctionComponent = {\r\n kind: HKindFunctionComponent\r\n tag: FComponent\r\n p: J\r\n cn?: Children\r\n}\r\n\r\nexport type HClassComponent = {\r\n kind: HKindClassComponent\r\n tag: CComponent\r\n p: J\r\n cn?: Children\r\n i?: IClassComponent\r\n}\r\n\r\nexport type HComp = HFunctionComponent | HClassComponent\r\n\r\nexport type H =\r\n | HText & { kind?: undefined } // text nodes never have a kind. but this type addition makes H a full DU\r\n | HElement\r\n | HFunctionComponent\r\n | HClassComponent\r\n | HFragment\r\n\r\nexport type HU = H | undefined | null\r\n\r\nlet isclass = (f: Function) => /^class\\s|^class\\{/.test(f.toString())\r\n\r\nexport function jsx(tag: any, p: any, ...cn: any[]): HElement | HComp | HFragment {\r\n if (tag?.kind) return tag // already an H node, flatten tree\r\n\r\n let kind: HKind = tag == jsxf ? 4 : tag instanceof Function ? (isclass(tag) ? 3 : 2) : 1\r\n\r\n let h: any = { kind, p: p ?? {} }\r\n if (kind != 4) h.tag = tag\r\n if (cn?.length) {\r\n h.cn = cn\r\n // components get their children in props.children, as with the automatic runtime (jsx-runtime.ts).\r\n // elements do not: setprops would write them to the element's read-only children property\r\n if (kind == 2 || kind == 3) h.p = { ...h.p, children: cn }\r\n }\r\n return h\r\n}\r\n\r\n// typescript looks up the JSX types on the factory function first: jsx.JSX instead of a global JSX namespace.\r\n// so jmc's element types cannot clash with other libraries. add your own elements by augmenting jsx.JSX.IntrinsicElements\r\nexport namespace jsx {\r\n export namespace JSX {\r\n export interface IntrinsicElements extends JmcIntrinsicElements { }\r\n }\r\n}\r\n\r\n// fragment is only used above as a sentinel\r\nexport let jsxf = Symbol()"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './jmc.js';
|
|
2
|
+
export { jmcconfig } from './props.js';
|
|
2
3
|
export * from './lib.js';
|
|
3
4
|
export * from './base.js';
|
|
4
5
|
export * from './jsx.js';
|
|
5
6
|
export * from './h.js';
|
|
6
|
-
export * from './
|
|
7
|
+
export * from './update.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './jmc.js';
|
|
2
|
+
export { jmcconfig } from './props.js';
|
|
2
3
|
export * from './lib.js';
|
|
3
4
|
export * from './base.js';
|
|
4
5
|
export * from './jsx.js';
|
|
5
6
|
export * from './h.js';
|
|
6
|
-
export * from './
|
|
7
|
+
export * from './update.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA","sourcesContent":["export * from './jmc.js'\r\nexport { jmcconfig } from './props.js'\r\nexport * from './lib.js'\r\nexport * from './base.js'\r\nexport * from './jsx.js'\r\nexport * from './h.js'\r\nexport * from './update.js'"]}
|
package/dist/jmc.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import type { H, J,
|
|
2
|
-
declare global {
|
|
3
|
-
interface Node {
|
|
4
|
-
h?: H & {
|
|
5
|
-
p?: J;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export declare let jmcconfig: {
|
|
10
|
-
attributeNames: Set<string>;
|
|
11
|
-
};
|
|
1
|
+
import type { H, J, Command } from './h.js';
|
|
12
2
|
export declare function patch(e: Node | null, h: H, depth?: number, uc?: J): HTMLElement | undefined;
|
|
13
|
-
export type Command = Selector | J | number;
|
|
14
3
|
export declare function updateview(...cmds: Command[]): void;
|
|
15
4
|
//# sourceMappingURL=jmc.d.ts.map
|
package/dist/jmc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jmc.d.ts","sourceRoot":"","sources":["../src/jmc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,CAAC,
|
|
1
|
+
{"version":3,"file":"jmc.d.ts","sourceRoot":"","sources":["../src/jmc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,CAAC,EAGD,CAAC,EACD,OAAO,EAIV,MAAM,QAAQ,CAAA;AAiJf,wBAAgB,KAAK,CACjB,CAAC,EAAE,IAAI,GAAG,IAAI,EACd,CAAC,EAAE,CAAC,EACJ,KAAK,SAAM,EACX,EAAE,GAAE,CAAM,GACX,WAAW,GAAG,SAAS,CAUzB;AAED,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAanD"}
|