@snupo/jmc 1.0.62 → 1.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/LICENSE +21 -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 +29 -3
- package/readme.md +303 -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/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,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;SAClD,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,aAAa,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC;SAC3E,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAE,CAAS,CAAC,IAAI,CAAC,GAAI,CAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IACrE,OAAO,CAAC,CAAA;AACZ,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAmB,CAAI,EAAE,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;SAClD,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,aAAa,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CA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IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA,CAAC,CAAC;AAExJ,MAAM,UAAU,IAAI,CAAI,CAAU,IAAK,CAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC;AAEtE,MAAM,UAAU,KAAK,CAAC,CAAsB,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA,CAAC,CAAC","sourcesContent":["export function rebind<T extends object>(o: T, proto = Object.getPrototypeOf(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 @@
|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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"}
|
package/dist/jmc.js
CHANGED
|
@@ -1,130 +1,102 @@
|
|
|
1
1
|
import { rebind } from './base.js';
|
|
2
|
-
import {
|
|
3
|
-
let iswebcomponent = (h) => h.tag.includes('-');
|
|
4
|
-
let attributeNames = new Set([
|
|
5
|
-
'selected',
|
|
6
|
-
'viewBox',
|
|
7
|
-
'list'
|
|
8
|
-
// other HTML attributes where your framework wants attribute semantics
|
|
9
|
-
]);
|
|
10
|
-
export let jmcconfig = {
|
|
11
|
-
attributeNames
|
|
12
|
-
};
|
|
13
|
-
const isproperty = (e, name, value) => !attributeNames.has(name) &&
|
|
14
|
-
(value instanceof Object ||
|
|
15
|
-
value instanceof Function || (e.namespaceURI !== 'http://www.w3.org/2000/svg' &&
|
|
16
|
-
name in e &&
|
|
17
|
-
name !== 'style'));
|
|
18
|
-
let setprops = (e, old, now) => {
|
|
19
|
-
old ??= {};
|
|
20
|
-
now ??= {};
|
|
21
|
-
// removals
|
|
22
|
-
for (let p in old) {
|
|
23
|
-
if (!(p in now)) {
|
|
24
|
-
if (p.startsWith('on'))
|
|
25
|
-
setevent(e, p.slice(2), null);
|
|
26
|
-
else if (isproperty(e, p, old[p]))
|
|
27
|
-
e[p] = typeof old[p] === 'boolean' ? false : '';
|
|
28
|
-
else
|
|
29
|
-
e.removeAttribute(p);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// updates
|
|
33
|
-
for (let p in now) {
|
|
34
|
-
let v = now[p];
|
|
35
|
-
v = v?.thunk ? v() : v;
|
|
36
|
-
if (p.startsWith('on'))
|
|
37
|
-
setevent(e, p.slice(2), v);
|
|
38
|
-
else if (v != old[p]) {
|
|
39
|
-
if (isproperty(e, p, v))
|
|
40
|
-
e[p] = v;
|
|
41
|
-
else if ((v === false || v == null) && !p.startsWith('aria-'))
|
|
42
|
-
e.removeAttribute(p);
|
|
43
|
-
else
|
|
44
|
-
e.setAttribute(p, v);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
2
|
+
import { jmcconfig, setprops } from './props.js';
|
|
48
3
|
let removeexcesschildren = (n, i) => {
|
|
49
4
|
let c;
|
|
50
5
|
while ((c = n.childNodes[i])) {
|
|
51
6
|
try {
|
|
52
7
|
c.remove();
|
|
53
8
|
}
|
|
54
|
-
catch
|
|
9
|
+
catch { } // due to blur-event-handlers, this can fail
|
|
55
10
|
}
|
|
56
11
|
};
|
|
57
|
-
/** synchronizes children starting at the i-th
|
|
12
|
+
/** synchronizes children starting at the i-th node. returns the index after the last child synchronized */
|
|
58
13
|
let syncchildren = (p, cn, i, depth, uc) => {
|
|
59
|
-
cn.flat(999)
|
|
60
|
-
.filter((hc) => hc !== null && hc !== undefined) // skip. keep 0 and false renderable, per comment below)
|
|
61
|
-
.forEach((hc) => (i = sync(p, i, hc, undefined, depth, uc)));
|
|
14
|
+
cn.flat(999).forEach((hc) => (i = sync(p, i, hc, undefined, depth, uc)));
|
|
62
15
|
return i;
|
|
63
16
|
};
|
|
17
|
+
/** class components must render exactly one root node, they are attached to it and update through it */
|
|
18
|
+
let assertnonfragment = (h, hv, i, j) => {
|
|
19
|
+
if (j - i != 1 || hv?.kind == 4)
|
|
20
|
+
throw new Error(`${h.tag.name}.view() must render exactly one root element`);
|
|
21
|
+
};
|
|
64
22
|
function sync(parent, i, h, hfun, depth, uc) {
|
|
65
|
-
// console.log('%csync', "background:orange", parent.tagName, i, h, hfun, depth)
|
|
66
|
-
if (h === null || h === undefined)
|
|
67
|
-
return i; // skip. keep 0 and false renderable, per comment below
|
|
68
23
|
let c = parent.childNodes[i];
|
|
24
|
+
// null, undefined and booleans render nothing, like in React, so {cond && <b />} works. 0 is still rendered.
|
|
25
|
+
// nothing still takes its slot, as a placeholder: so the siblings after it keep their position, and with it their state
|
|
26
|
+
if (h == null || typeof h == 'boolean') {
|
|
27
|
+
if (hfun?.kind != 3)
|
|
28
|
+
h = ''; // an empty text node, invisible
|
|
29
|
+
else {
|
|
30
|
+
// a class component rendering nothing is attached to a comment, so it keeps its state and can show itself again
|
|
31
|
+
if (c?.nodeType != 8 /* NodeType.Comment */) {
|
|
32
|
+
let n = new Comment();
|
|
33
|
+
c ? c.replaceWith(n) : parent.append(n);
|
|
34
|
+
c = n;
|
|
35
|
+
}
|
|
36
|
+
c.h = hfun;
|
|
37
|
+
return i + 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
69
40
|
switch (h.kind) {
|
|
70
41
|
case 1: {
|
|
42
|
+
// element
|
|
71
43
|
let n;
|
|
72
|
-
let { tag, cn, p } = h;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
n.h = hfun ?? h; // sets the new property values
|
|
77
|
-
if (--depth &&
|
|
78
|
-
!n.hasAttribute('const') &&
|
|
79
|
-
!iswebcomponent(h)) {
|
|
80
|
-
const j = syncchildren(n, cn, 0, depth, uc);
|
|
81
|
-
removeexcesschildren(n, j);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
if (c?.tagName?.toLowerCase() != tag.toLowerCase()) {
|
|
85
|
-
let ns = p?.xmlns ??
|
|
44
|
+
let { tag, cn = [], p } = h;
|
|
45
|
+
let fresh = c?.tagName?.toLowerCase() != tag.toLowerCase();
|
|
46
|
+
if (fresh) {
|
|
47
|
+
let ns = p.xmlns ??
|
|
86
48
|
(parent.tagName == 'foreignObject'
|
|
87
49
|
? 'http://www.w3.org/1999/xhtml'
|
|
88
50
|
: parent.namespaceURI);
|
|
89
51
|
n = document.createElementNS(ns, tag);
|
|
90
52
|
c ? c.replaceWith(n) : parent.appendChild(n);
|
|
91
|
-
process();
|
|
92
|
-
p?.mounted?.(n);
|
|
93
53
|
}
|
|
94
|
-
else
|
|
54
|
+
else
|
|
95
55
|
n = c;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
56
|
+
n.h = hfun ?? h; // attach before update(), which may handle the update itself
|
|
57
|
+
if (jmcconfig.debug && hfun)
|
|
58
|
+
n.setAttribute('comp', hfun.tag.name);
|
|
59
|
+
if (!fresh && p.update?.(n, uc))
|
|
60
|
+
return i + 1;
|
|
61
|
+
// a const element is an island: jmc renders it once, then foreign code owns it. update() still runs
|
|
62
|
+
if (fresh || !p.const) {
|
|
63
|
+
n.ep = setprops(n, n.ep, p);
|
|
64
|
+
if (--depth && !tag.includes('-')) { // web components render their own children
|
|
65
|
+
const j = syncchildren(n, cn, 0, depth, uc);
|
|
66
|
+
removeexcesschildren(n, j);
|
|
67
|
+
}
|
|
99
68
|
}
|
|
69
|
+
if (fresh)
|
|
70
|
+
p.mounted?.(n);
|
|
100
71
|
return i + 1;
|
|
101
72
|
}
|
|
102
|
-
case 4: {
|
|
103
|
-
return syncchildren(parent, h.cn ?? [], i, --depth, uc);
|
|
104
|
-
}
|
|
105
73
|
case 2: {
|
|
74
|
+
// function component
|
|
75
|
+
// TBD REMOVE the second argument once we know it is unused: the children are in h.p.children
|
|
106
76
|
let hr = h.tag(h.p, h.cn);
|
|
107
77
|
return sync(parent, i, hr, hfun ?? h, depth, uc);
|
|
108
78
|
}
|
|
109
79
|
case 3: {
|
|
110
|
-
if
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
: sync(parent, i, ci.view(), c.h, depth, uc); // hfun because outermost function shall be attached
|
|
80
|
+
// class component. reuses the instance attached to c, if c renders the same class
|
|
81
|
+
let old = c?.h?.tag == h.tag ? c.h : undefined;
|
|
82
|
+
let ci = old ? old.i : (h.i = rebind(new h.tag(h.p)));
|
|
83
|
+
if (old) {
|
|
84
|
+
ci.props = old.p = h.p; // set attached p too, for a repeatable update through c.h
|
|
85
|
+
if (ci.update?.(uc))
|
|
86
|
+
return i + 1; // update() substitutes view/sync when returning truthy
|
|
118
87
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
ci.element = n;
|
|
88
|
+
let hv = ci.view();
|
|
89
|
+
let j = sync(parent, i, hv, old ?? h, depth, uc); // the attached H, so updates find the instance
|
|
90
|
+
assertnonfragment(h, hv, i, j);
|
|
91
|
+
ci.element = parent.childNodes[i];
|
|
92
|
+
if (!old)
|
|
125
93
|
ci.mounted?.();
|
|
126
|
-
|
|
127
|
-
|
|
94
|
+
return j;
|
|
95
|
+
}
|
|
96
|
+
case 4: {
|
|
97
|
+
// fragment. hfun is deliberately not passed on: a component returning a fragment is not attached
|
|
98
|
+
// to any node, so it cannot update itself, only its parent can update it
|
|
99
|
+
return syncchildren(parent, h.cn ?? [], i, --depth, uc);
|
|
128
100
|
}
|
|
129
101
|
default:
|
|
130
102
|
// textnode
|
|
@@ -143,41 +115,30 @@ export function patch(e, h, depth = 999, uc = {}) {
|
|
|
143
115
|
if (!e)
|
|
144
116
|
return;
|
|
145
117
|
if (depth == 0) {
|
|
146
|
-
;
|
|
147
118
|
e.replaceChildren();
|
|
148
119
|
depth = 999;
|
|
149
120
|
}
|
|
150
121
|
let p = e.parentElement;
|
|
151
|
-
let i = [].indexOf
|
|
122
|
+
let i = [...p.childNodes].indexOf(e);
|
|
152
123
|
sync(p, i, h, undefined, depth, uc);
|
|
153
124
|
return p.childNodes[i];
|
|
154
125
|
}
|
|
155
126
|
export function updateview(...cmds) {
|
|
156
|
-
if (!cmds.
|
|
157
|
-
cmds.push('body');
|
|
127
|
+
if (!cmds.some(c => typeof c == 'string' || c instanceof Node))
|
|
128
|
+
cmds.push('body'); // no target given: body
|
|
158
129
|
let uc = {};
|
|
159
130
|
let depth = 999;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
else if (typeof c === 'number') {
|
|
173
|
-
depth = c;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
uc = c;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
f(cmds);
|
|
181
|
-
// if (!patchcount) console.warn("updateview did not update anything. cmds=", ...cmds)
|
|
131
|
+
// isConnected: a selector's matches are collected upfront, patching one can replace a later one
|
|
132
|
+
let up = (n) => { if (n.h && n.isConnected)
|
|
133
|
+
patch(n, n.h, depth, uc); };
|
|
134
|
+
for (const c of cmds)
|
|
135
|
+
if (typeof c == 'string')
|
|
136
|
+
document.querySelectorAll(c).forEach(up);
|
|
137
|
+
else if (c instanceof Node)
|
|
138
|
+
up(c);
|
|
139
|
+
else if (typeof c == 'number')
|
|
140
|
+
depth = c;
|
|
141
|
+
else
|
|
142
|
+
uc = c;
|
|
182
143
|
}
|
|
183
144
|
//# sourceMappingURL=jmc.js.map
|
package/dist/jmc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jmc.js","sourceRoot":"","sources":["../src/jmc.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAanC,IAAI,cAAc,GAAG,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAEzD,IAAI,cAAc,GAAG,IAAI,GAAG,CAAC;IACzB,UAAU;IACV,SAAS;IACT,MAAM;IACN,uEAAuE;CAC1E,CAAC,CAAA;AAEF,MAAM,CAAC,IAAI,SAAS,GAAG;IACnB,cAAc;CACjB,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,CAAU,EAAE,IAAY,EAAE,KAAU,EAAE,EAAE,CACxD,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;IACzB,CAAC,KAAK,YAAY,MAAM;QACpB,KAAK,YAAY,QAAQ,IAAI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AI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC/B,KAAK,GAAG,CAAC,CAAA;YACb,CAAC;iBAAM,CAAC;gBACJ,EAAE,GAAG,CAAC,CAAA;YACV,CAAC;QACL,CAAC;IACL,CAAC;IAED,CAAC,CAAC,IAAI,CAAC,CAAA;IAEP,sFAAsF;AAC1F,CAAC","sourcesContent":["import type {\r\n H,\r\n HElement,\r\n J,\r\n Selector,\r\n Children,\r\n HClassComponent,\r\n HU,\r\n} from './h'\r\nimport { rebind } from './base.js'\r\nimport { setevent } from './events'\r\n\r\nconst enum NodeType {\r\n // vaporizes (but for that must be in this file, otherwise not)\r\n TextNode = 3,\r\n}\r\n\r\ndeclare global {\r\n interface Node {\r\n h?: H & { p?: J }\r\n }\r\n}\r\n\r\nlet iswebcomponent = (h: HElement) => h.tag.includes('-')\r\n\r\nlet attributeNames = new Set([\r\n 'selected',\r\n 'viewBox', \r\n 'list'\r\n // other HTML attributes where your framework wants attribute semantics\r\n])\r\n\r\nexport let jmcconfig = {\r\n attributeNames\r\n}\r\n\r\nconst isproperty = (e: Element, name: string, value: any) =>\r\n !attributeNames.has(name) &&\r\n (value instanceof Object ||\r\n value instanceof Function || (\r\n e.namespaceURI !== 'http://www.w3.org/2000/svg' &&\r\n name in e &&\r\n name !== 'style'))\r\n\r\nlet setprops = (e: Element & J, old: J | undefined, now: J | undefined) => {\r\n old ??= {}\r\n now ??= {}\r\n\r\n // removals\r\n for (let p in old) {\r\n if (!(p in now)) {\r\n if (p.startsWith('on')) setevent(e, p.slice(2), null)\r\n else if (isproperty(e, p, old[p])) e[p] = typeof old[p] === 'boolean' ? false : ''\r\n else e.removeAttribute(p)\r\n }\r\n }\r\n\r\n // updates\r\n for (let p in now) {\r\n let v = now[p]\r\n v = v?.thunk ? v() : v\r\n\r\n if (p.startsWith('on')) setevent(e, p.slice(2), v)\r\n else if (v != old[p]) {\r\n if (isproperty(e, p, v)) e[p] = v\r\n else if ((v === false || v == null) && !p.startsWith('aria-')) e.removeAttribute(p)\r\n else e.setAttribute(p, v)\r\n }\r\n }\r\n}\r\n\r\nlet removeexcesschildren = (n: Element, i: number) => {\r\n let c: ChildNode\r\n while ((c = n.childNodes[i])) {\r\n try {\r\n c.remove()\r\n } catch (_) { } // due to blur-event-handlers, this can fail\r\n }\r\n}\r\n\r\n/** synchronizes children starting at the i-th element. returns the index of the last child synchronized */\r\nlet syncchildren = (\r\n p: Element,\r\n cn: Children,\r\n i: number,\r\n depth: number,\r\n uc: J,\r\n): number => {\r\n cn.flat(999)\r\n .filter((hc) => hc !== null && hc !== undefined) // skip. keep 0 and false renderable, per comment below)\r\n .forEach((hc) => (i = sync(p, i, hc, undefined, depth, uc)))\r\n return i\r\n}\r\n\r\nfunction sync(\r\n parent: Element,\r\n i: number,\r\n h: HU,\r\n hfun: H | undefined,\r\n depth: number,\r\n uc: J,\r\n): number {\r\n // console.log('%csync', \"background:orange\", parent.tagName, i, h, hfun, depth)\r\n\r\n if (h === null || h === undefined) return i // skip. keep 0 and false renderable, per comment below\r\n\r\n let c = parent.childNodes[i]\r\n\r\n switch (h.kind) {\r\n case 1: {\r\n let n: Element\r\n let { tag, cn, p } = h\r\n cn ??= []\r\n\r\n let process = () => {\r\n setprops(n, n.h?.p, p)\r\n n.h = hfun ?? h // sets the new property values\r\n if (\r\n --depth &&\r\n !n.hasAttribute('const') &&\r\n !iswebcomponent(h as HElement)\r\n ) {\r\n const j = syncchildren(n, cn, 0, depth, uc)\r\n removeexcesschildren(n, j)\r\n }\r\n }\r\n\r\n if ((<Element>c)?.tagName?.toLowerCase() != tag.toLowerCase()) {\r\n let ns =\r\n p?.xmlns ??\r\n (parent.tagName == 'foreignObject'\r\n ? 'http://www.w3.org/1999/xhtml'\r\n : parent.namespaceURI)\r\n n = document.createElementNS(ns, tag)\r\n c ? c.replaceWith(n) : parent.appendChild(n)\r\n process()\r\n p?.mounted?.(n)\r\n } else {\r\n n = c as Element\r\n if (p?.update?.(c, uc)) return i + 1\r\n process()\r\n }\r\n\r\n return i + 1\r\n }\r\n\r\n case 4: {\r\n return syncchildren(parent, h.cn ?? [], i, --depth, uc)\r\n }\r\n\r\n case 2: {\r\n let hr = h.tag(h.p, h.cn)\r\n return sync(parent, i, hr, hfun ?? h, depth, uc)\r\n }\r\n\r\n case 3: {\r\n if ((c?.h as any)?.tag == h.tag) {\r\n let ci = (c.h as HClassComponent).i!\r\n ci.props = c.h!.p = h.p\r\n c.h!.p = h.p // for repatable update, set attached h.p. alternatively, we could use ci.props in case where h.p is undefined\r\n // update() substitutes view/sync when returning truthy\r\n return ci.update?.(uc)\r\n ? i + 1\r\n : sync(parent, i, ci.view(), c.h, depth, uc) // hfun because outermost function shall be attached\r\n } else {\r\n let ci = (h.i = rebind(new h.tag(h.p)))\r\n let hv = ci.view()\r\n let j = sync(parent, i, hv, h, depth, uc)\r\n let n = parent.childNodes[i]!\r\n ci.element = n\r\n ci.mounted?.()\r\n return j\r\n }\r\n }\r\n\r\n default:\r\n // textnode\r\n let s = h.toString()\r\n if (c?.nodeType == NodeType.TextNode) {\r\n if (c.textContent != s) c.textContent = s // firefox updates equal text, loosing existing text selection\r\n } else {\r\n c ? c.replaceWith(s) : parent.append(s)\r\n }\r\n return i + 1\r\n }\r\n}\r\n\r\nexport function patch(\r\n e: Node | null,\r\n h: H,\r\n depth = 999,\r\n uc = {} as J,\r\n): HTMLElement | undefined {\r\n if (!e) return\r\n if (depth == 0) {\r\n ; (e as HTMLElement).replaceChildren()\r\n depth = 999\r\n }\r\n let p = e.parentElement as HTMLElement\r\n let i = [].indexOf.call<any, any, any>(p.childNodes, e)\r\n sync(p, i, h, undefined, depth, uc)\r\n return p.childNodes[i] as HTMLElement\r\n}\r\n\r\nexport type Command = Selector | J | number\r\n\r\nexport function updateview(...cmds: Command[]): void {\r\n if (!cmds.length) cmds.push('body')\r\n let uc = {}\r\n let depth = 999\r\n let patchcount = 0\r\n\r\n function f(cmds: Command[]) {\r\n for (const c of cmds) {\r\n if (typeof c === 'string') {\r\n f([...document.querySelectorAll(c)])\r\n } else if (c instanceof Node) {\r\n if (c.h) {\r\n patch(c, c.h, depth, uc)\r\n patchcount++\r\n }\r\n } else if (typeof c === 'number') {\r\n depth = c\r\n } else {\r\n uc = c\r\n }\r\n }\r\n }\r\n\r\n f(cmds)\r\n\r\n // if (!patchcount) console.warn(\"updateview did not update anything. cmds=\", ...cmds)\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"jmc.js","sourceRoot":"","sources":["../src/jmc.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAgBhD,IAAI,oBAAoB,GAAG,CAAC,CAAU,EAAE,CAAS,EAAE,EAAE;IACjD,IAAI,CAAY,CAAA;IAChB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC;YACD,CAAC,CAAC,MAAM,EAAE,CAAA;QACd,CAAC;QAAC,MAAM,CAAC,CAAC,CAAC,CAAC,4CAA4C;IAC5D,CAAC;AACL,CAAC,CAAA;AAED,2GAA2G;AAC3G,IAAI,YAAY,GAAG,CACf,CAAU,EACV,EAAY,EACZ,CAAS,EACT,KAAa,EACb,EAAK,EACC,EAAE;IACR,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IACxE,OAAO,CAAC,CAAA;AACZ,CAAC,CAAA;AAED,wGAAwG;AACxG,IAAI,iBAAiB,GAAG,CAAC,CAAkB,EAAE,EAAM,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE;IACzE,IAAI,CAAC,GAAG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AAA;IACjD,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;IACnC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAgB,CAAA;AACzC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAG,IAAe;IACzC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,QAAQ,IAAI,CAAC,YAAY,IAAI,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAC,wBAAwB;IAC1G,IAAI,EAAE,GAAM,EAAE,CAAA;IACd,IAAI,KAAK,GAAG,GAAG,CAAA;IAEf,gGAAgG;IAChG,IAAI,EAAE,GAAG,CAAC,CAAc,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW;QAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA;IAEnF,KAAK,MAAM,CAAC,IAAI,IAAI;QAChB,IAAI,OAAO,CAAC,IAAI,QAAQ;YAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;aAC7D,IAAI,CAAC,YAAY,IAAI;YAAE,EAAE,CAAC,CAAC,CAAC,CAAA;aAC5B,IAAI,OAAO,CAAC,IAAI,QAAQ;YAAE,KAAK,GAAG,CAAC,CAAA;;YACnC,EAAE,GAAG,CAAC,CAAA;AACnB,CAAC","sourcesContent":["import type {\r\n H,\r\n HElement,\r\n HComp,\r\n J,\r\n Command,\r\n Children,\r\n HClassComponent,\r\n HU,\r\n} from './h.js'\r\nimport { rebind } from './base.js'\r\nimport { jmcconfig, setprops } from './props.js'\r\n\r\nconst enum NodeType {\r\n // vaporizes (but for that must be in this file, otherwise not)\r\n TextNode = 3,\r\n Comment = 8,\r\n}\r\n\r\n/** a node as jmc sees it. kept module-local, so consumers' Node type stays untouched */\r\ntype JNode<N extends Node = ChildNode> = N & {\r\n /** the H this node updates from: the element's own H, or the outermost component rendering it */\r\n h?: HElement | HComp\r\n /** props last applied to this element. kept apart from h, which may be the owning component's H */\r\n ep?: J\r\n}\r\n\r\nlet removeexcesschildren = (n: Element, i: number) => {\r\n let c: ChildNode\r\n while ((c = n.childNodes[i])) {\r\n try {\r\n c.remove()\r\n } catch { } // due to blur-event-handlers, this can fail\r\n }\r\n}\r\n\r\n/** synchronizes children starting at the i-th node. returns the index after the last child synchronized */\r\nlet syncchildren = (\r\n p: Element,\r\n cn: Children,\r\n i: number,\r\n depth: number,\r\n uc: J,\r\n): number => {\r\n cn.flat(999).forEach((hc) => (i = sync(p, i, hc, undefined, depth, uc)))\r\n return i\r\n}\r\n\r\n/** class components must render exactly one root node, they are attached to it and update through it */\r\nlet assertnonfragment = (h: HClassComponent, hv: HU, i: number, j: number) => {\r\n if (j - i != 1 || hv?.kind == 4) throw new Error(`${h.tag.name}.view() must render exactly one root element`)\r\n}\r\n\r\nfunction sync(\r\n parent: Element,\r\n i: number,\r\n h: HU,\r\n hfun: HComp | undefined,\r\n depth: number,\r\n uc: J,\r\n): number {\r\n let c: JNode | undefined = parent.childNodes[i]\r\n\r\n // null, undefined and booleans render nothing, like in React, so {cond && <b />} works. 0 is still rendered.\r\n // nothing still takes its slot, as a placeholder: so the siblings after it keep their position, and with it their state\r\n if (h == null || typeof h == 'boolean') {\r\n if (hfun?.kind != 3) h = '' // an empty text node, invisible\r\n else {\r\n // a class component rendering nothing is attached to a comment, so it keeps its state and can show itself again\r\n if (c?.nodeType != NodeType.Comment) {\r\n let n = new Comment()\r\n c ? c.replaceWith(n) : parent.append(n)\r\n c = n\r\n }\r\n c.h = hfun\r\n return i + 1\r\n }\r\n }\r\n\r\n switch (h.kind) {\r\n case 1: {\r\n // element\r\n let n: Element & JNode\r\n let { tag, cn = [], p } = h\r\n\r\n let fresh = (<Element>c)?.tagName?.toLowerCase() != tag.toLowerCase()\r\n if (fresh) {\r\n let ns =\r\n p.xmlns ??\r\n (parent.tagName == 'foreignObject'\r\n ? 'http://www.w3.org/1999/xhtml'\r\n : parent.namespaceURI)\r\n n = document.createElementNS(ns, tag)\r\n c ? c.replaceWith(n) : parent.appendChild(n)\r\n } else n = c as Element & JNode\r\n\r\n n.h = hfun ?? h // attach before update(), which may handle the update itself\r\n if (jmcconfig.debug && hfun) n.setAttribute('comp', hfun.tag.name)\r\n if (!fresh && p.update?.(n, uc)) return i + 1\r\n\r\n // a const element is an island: jmc renders it once, then foreign code owns it. update() still runs\r\n if (fresh || !p.const) {\r\n n.ep = setprops(n, n.ep, p)\r\n if (--depth && !tag.includes('-')) { // web components render their own children\r\n const j = syncchildren(n, cn, 0, depth, uc)\r\n removeexcesschildren(n, j)\r\n }\r\n }\r\n if (fresh) p.mounted?.(n)\r\n\r\n return i + 1\r\n }\r\n\r\n case 2: {\r\n // function component\r\n // TBD REMOVE the second argument once we know it is unused: the children are in h.p.children\r\n let hr = h.tag(h.p, h.cn)\r\n return sync(parent, i, hr, hfun ?? h, depth, uc)\r\n }\r\n\r\n case 3: {\r\n // class component. reuses the instance attached to c, if c renders the same class\r\n let old = c?.h?.tag == h.tag ? c.h as HClassComponent : undefined\r\n let ci = old ? old.i! : (h.i = rebind(new h.tag(h.p)))\r\n if (old) {\r\n ci.props = old.p = h.p // set attached p too, for a repeatable update through c.h\r\n if (ci.update?.(uc)) return i + 1 // update() substitutes view/sync when returning truthy\r\n }\r\n let hv = ci.view()\r\n let j = sync(parent, i, hv, old ?? h, depth, uc) // the attached H, so updates find the instance\r\n assertnonfragment(h, hv, i, j)\r\n ci.element = parent.childNodes[i]\r\n if (!old) ci.mounted?.()\r\n return j\r\n }\r\n\r\n case 4: {\r\n // fragment. hfun is deliberately not passed on: a component returning a fragment is not attached\r\n // to any node, so it cannot update itself, only its parent can update it\r\n return syncchildren(parent, h.cn ?? [], i, --depth, uc)\r\n }\r\n\r\n default:\r\n // textnode\r\n let s = h.toString()\r\n if (c?.nodeType == NodeType.TextNode) {\r\n if (c.textContent != s) c.textContent = s // firefox updates equal text, loosing existing text selection\r\n } else {\r\n c ? c.replaceWith(s) : parent.append(s)\r\n }\r\n return i + 1\r\n }\r\n}\r\n\r\nexport function patch(\r\n e: Node | null,\r\n h: H,\r\n depth = 999,\r\n uc: J = {},\r\n): HTMLElement | undefined {\r\n if (!e) return\r\n if (depth == 0) {\r\n (e as Element).replaceChildren()\r\n depth = 999\r\n }\r\n let p = e.parentElement!\r\n let i = [...p.childNodes].indexOf(e as ChildNode)\r\n sync(p, i, h, undefined, depth, uc)\r\n return p.childNodes[i] as HTMLElement\r\n}\r\n\r\nexport function updateview(...cmds: Command[]): void {\r\n if (!cmds.some(c => typeof c == 'string' || c instanceof Node)) cmds.push('body') // no target given: body\r\n let uc: J = {}\r\n let depth = 999\r\n\r\n // isConnected: a selector's matches are collected upfront, patching one can replace a later one\r\n let up = (n: JNode<Node>) => { if (n.h && n.isConnected) patch(n, n.h, depth, uc) }\r\n\r\n for (const c of cmds)\r\n if (typeof c == 'string') document.querySelectorAll(c).forEach(up)\r\n else if (c instanceof Node) up(c)\r\n else if (typeof c == 'number') depth = c\r\n else uc = c\r\n}\r\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Fragment } from './jsx-runtime.js';
|
|
2
|
+
export type { JSX } from './jsx-runtime.js';
|
|
3
|
+
/** like jsx and jsxs. the extra arguments for debugging (key, source, self) are not used */
|
|
4
|
+
export declare let jsxDEV: (tag: any, props: any, _key: any, isstaticchildren: boolean) => import("./h.js").HElement | import("./h.js").HFragment | import("./h.js").HComp;
|
|
5
|
+
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,YAAY,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C,4FAA4F;AAC5F,eAAO,IAAI,MAAM,GAAI,KAAK,GAAG,EAAE,OAAO,GAAG,EAAE,MAAM,GAAG,EAAE,kBAAkB,OAAO,oFAAgD,CAAA"}
|