jmx-runtime 0.0.26 → 0.0.30
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/base.ts +5 -3
- package/dist/base.d.ts +2 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.ts +27 -0
- package/dist/h.d.ts +57 -57
- package/dist/h.d.ts.map +1 -1
- package/dist/h.ts +89 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +182 -6
- package/dist/index.js.map +1 -1
- package/dist/index.ts +5 -0
- package/dist/jmx.d.ts +8 -8
- package/dist/jmx.d.ts.map +1 -1
- package/dist/jmx.ts +186 -0
- package/dist/jsx.d.ts +647 -647
- package/dist/jsx.ts +748 -0
- package/dist/lib.d.ts +20 -19
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.ts +29 -0
- package/h.ts +1 -0
- package/jmx.ts +5 -2
- package/package.json +2 -2
- package/dist/base.js +0 -22
- package/dist/base.js.map +0 -1
- package/dist/config.d.ts +0 -9
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -5
- package/dist/config.js.map +0 -1
- package/dist/h.js +0 -7
- package/dist/h.js.map +0 -1
- package/dist/jmx.js +0 -135
- package/dist/jmx.js.map +0 -1
- package/dist/jsx.js +0 -2
- package/dist/jsx.js.map +0 -1
- package/dist/lib.js +0 -16
- package/dist/lib.js.map +0 -1
package/base.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export function
|
|
2
|
-
|
|
1
|
+
export function hopsi() {}
|
|
2
|
+
|
|
3
|
+
export function rebind<T extends object>(o: T, proto = Object.getPrototypeOf(o)) : T {
|
|
4
|
+
Object.entries(Object.getOwnPropertyDescriptors(proto))
|
|
3
5
|
.filter(([name, p]) => name != 'constructor' && p.value instanceof Function)
|
|
4
|
-
.forEach(([name]) => o[name] = o[name].bind(o))
|
|
6
|
+
.forEach(([name]) => (o as any)[name] = (o as any)[name].bind(o))
|
|
5
7
|
return o
|
|
6
8
|
}
|
|
7
9
|
|
package/dist/base.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function hopsi(): void;
|
|
2
|
+
export declare function rebind<T extends object>(o: T, proto?: any): T;
|
|
2
3
|
export declare function mount(o: Record<string, any>): void;
|
|
3
4
|
export declare const loggedmethodsex: <T extends Record<string, any>>(o: T, logger: (name: string, args: any[], result: any) => void) => T;
|
|
4
5
|
export declare const loggedmethods: <T extends Record<string, any>>(o: T) => T;
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"./","sources":["base.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"./","sources":["base.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,SAAK;AAE1B,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,MAA2B,GAAI,CAAC,CAKnF;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAkC;AAE9E,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,MAY3H,CAAA;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,KAAI,CAA8I,CAAA;AACnN,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,CAAC,KAAI,CAAiJ,CAAA"}
|
package/dist/base.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function hopsi() {}
|
|
2
|
+
|
|
3
|
+
export function rebind<T extends object>(o: T, proto = Object.getPrototypeOf(o)) : T {
|
|
4
|
+
Object.entries(Object.getOwnPropertyDescriptors(proto))
|
|
5
|
+
.filter(([name, p]) => name != 'constructor' && p.value instanceof Function)
|
|
6
|
+
.forEach(([name]) => (o as any)[name] = (o as any)[name].bind(o))
|
|
7
|
+
return o
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function mount(o: Record<string, any>) { Object.assign(globalThis, o) }
|
|
11
|
+
|
|
12
|
+
export const loggedmethodsex = <T extends Record<string, any>>(o: T, logger: (name: string, args: any[], result: any) => void) => new Proxy(o, {
|
|
13
|
+
get(target, name: string, receiver) {
|
|
14
|
+
if (typeof target[name] === "function") {
|
|
15
|
+
return function (this: T, ...args: any[]) {
|
|
16
|
+
|
|
17
|
+
logger(name, args, undefined)
|
|
18
|
+
let r = target[name].apply(this, args)
|
|
19
|
+
return r
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return Reflect.get(target, name, receiver)
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const loggedmethods = <T extends Record<string, any>>(o: T ): T => loggedmethodsex(o, (name, args, result) => console.log("%c" + name, "background:#585059;color:white;padding:2px;font-weight:bold", args))
|
|
27
|
+
export 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))
|
package/dist/h.d.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
type Func<T> = () => T;
|
|
2
|
-
export type Expr<T> = T | Func<T>;
|
|
3
|
-
export type Props = Record<string, any>;
|
|
4
|
-
export type FComponent = (props: Props | undefined, children?: ChildrenH) => HElement;
|
|
5
|
-
export type FComponentT<P> = (pcn: P, cn?: Children) => H | void;
|
|
6
|
-
export interface IClassComponent {
|
|
7
|
-
element: Node;
|
|
8
|
-
props?: Record<string, any>;
|
|
9
|
-
view(): H;
|
|
10
|
-
update(uc: IUpdateContext): boolean | void;
|
|
11
|
-
mounted?(): void;
|
|
12
|
-
}
|
|
13
|
-
interface CComponent {
|
|
14
|
-
new (props: any): IClassComponent;
|
|
15
|
-
}
|
|
16
|
-
export type ChildrenH = (H | undefined)[];
|
|
17
|
-
export type Children = Expr<ChildrenH>;
|
|
18
|
-
type HText = string | number | boolean;
|
|
19
|
-
export type HFragment = {
|
|
20
|
-
cn: Children;
|
|
21
|
-
};
|
|
22
|
-
export type HElement = {
|
|
23
|
-
tag: string;
|
|
24
|
-
p?: Expr<Props>;
|
|
25
|
-
cn: Children;
|
|
26
|
-
i?: any;
|
|
27
|
-
};
|
|
28
|
-
type HCompFun = {
|
|
29
|
-
tag: FComponent;
|
|
30
|
-
p?: Expr<Props>;
|
|
31
|
-
cn?: Children;
|
|
32
|
-
};
|
|
33
|
-
export type HCompClass = {
|
|
34
|
-
tag: CComponent;
|
|
35
|
-
p?: Expr<Props>;
|
|
36
|
-
cn: Children;
|
|
37
|
-
i: IClassComponent;
|
|
38
|
-
};
|
|
39
|
-
export type HComp = HCompFun | HCompClass;
|
|
40
|
-
export type H = HText | HElement | HComp | HFragment;
|
|
41
|
-
declare global {
|
|
42
|
-
interface Node {
|
|
43
|
-
h?: HElement | HCompFun | HCompClass;
|
|
44
|
-
}
|
|
45
|
-
export interface IUpdateContext {
|
|
46
|
-
patchElementOnly?: boolean;
|
|
47
|
-
replace?: boolean;
|
|
48
|
-
}
|
|
49
|
-
export interface Window {
|
|
50
|
-
jmx?: {
|
|
51
|
-
getnamespace: (tag: string) => string | undefined;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export declare function jsx(): HElement;
|
|
56
|
-
export declare function jsxf(): HElement;
|
|
57
|
-
export {};
|
|
1
|
+
type Func<T> = () => T;
|
|
2
|
+
export type Expr<T> = T | Func<T>;
|
|
3
|
+
export type Props = Record<string, any>;
|
|
4
|
+
export type FComponent = (props: Props | undefined, children?: ChildrenH) => HElement;
|
|
5
|
+
export type FComponentT<P> = (pcn: P, cn?: Children) => H | void;
|
|
6
|
+
export interface IClassComponent {
|
|
7
|
+
element: Node;
|
|
8
|
+
props?: Record<string, any>;
|
|
9
|
+
view(): H;
|
|
10
|
+
update(uc: IUpdateContext): boolean | void;
|
|
11
|
+
mounted?(): void;
|
|
12
|
+
}
|
|
13
|
+
interface CComponent {
|
|
14
|
+
new (props: any): IClassComponent;
|
|
15
|
+
}
|
|
16
|
+
export type ChildrenH = (H | undefined)[];
|
|
17
|
+
export type Children = Expr<ChildrenH>;
|
|
18
|
+
type HText = string | number | boolean;
|
|
19
|
+
export type HFragment = {
|
|
20
|
+
cn: Children;
|
|
21
|
+
};
|
|
22
|
+
export type HElement = {
|
|
23
|
+
tag: string;
|
|
24
|
+
p?: Expr<Props>;
|
|
25
|
+
cn: Children;
|
|
26
|
+
i?: any;
|
|
27
|
+
};
|
|
28
|
+
type HCompFun = {
|
|
29
|
+
tag: FComponent;
|
|
30
|
+
p?: Expr<Props>;
|
|
31
|
+
cn?: Children;
|
|
32
|
+
};
|
|
33
|
+
export type HCompClass = {
|
|
34
|
+
tag: CComponent;
|
|
35
|
+
p?: Expr<Props>;
|
|
36
|
+
cn: Children;
|
|
37
|
+
i: IClassComponent;
|
|
38
|
+
};
|
|
39
|
+
export type HComp = HCompFun | HCompClass;
|
|
40
|
+
export type H = HText | HElement | HComp | HFragment;
|
|
41
|
+
declare global {
|
|
42
|
+
interface Node {
|
|
43
|
+
h?: HElement | HCompFun | HCompClass;
|
|
44
|
+
}
|
|
45
|
+
export interface IUpdateContext {
|
|
46
|
+
patchElementOnly?: boolean;
|
|
47
|
+
replace?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface Window {
|
|
50
|
+
jmx?: {
|
|
51
|
+
getnamespace: (tag: string) => string | undefined;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export declare function jsx(): HElement;
|
|
56
|
+
export declare function jsxf(): HElement;
|
|
57
|
+
export {};
|
|
58
58
|
//# sourceMappingURL=h.d.ts.map
|
package/dist/h.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h.d.ts","sourceRoot":"./","sources":["h.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAA;AACtB,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AAEjC,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,KAAK,QAAQ,CAAA;AAErF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,QAAQ,KAAK,CAAC,GAAG,IAAI,CAAA;AAEhE,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,IAAI,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,IAAI,IAAI,CAAC,CAAA;IACT,MAAM,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,GAAG,IAAI,CAAA;IAC1C,OAAO,CAAC,IAAI,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"h.d.ts","sourceRoot":"./","sources":["h.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAA;AACtB,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AAEjC,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EA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GAAG;IACrB,GAAG,EAAE,UAAU,CAAA;IACf,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACf,EAAE,EAAE,QAAQ,CAAA;IACZ,CAAC,EAAE,eAAe,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAA;AAEzC,MAAM,MAAM,CAAC,GAEH,KAAK,GACL,QAAQ,GACR,KAAK,GACL,SAAS,CAAA;AAEnB,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,IAAI;QACV,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;KACvC;IACD,MAAM,WAAW,cAAc;QAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;QAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;KACpB;IAED,MAAM,WAAW,MAAM;QACnB,GAAG,CAAC,EAAE;YACF,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;SACpD,CAAA;KACJ;CACJ;AAED,wBAAgB,GAAG,IAAI,QAAQ,CAE9B;AACD,wBAAgB,IAAI,IAAI,QAAQ,CAE/B"}
|
package/dist/h.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// jmx internal types - hopst
|
|
2
|
+
// the following types describe the js expression we get from tsx after conversion be our jmx plugin
|
|
3
|
+
// they can be useful for users as well, components might return them.
|
|
4
|
+
|
|
5
|
+
type Func<T> = () => T
|
|
6
|
+
export type Expr<T> = T | Func<T>
|
|
7
|
+
|
|
8
|
+
export type Props = Record<string, any>
|
|
9
|
+
|
|
10
|
+
export type FComponent = (props: Props | undefined, children?: ChildrenH) => HElement // show an example for usage of children
|
|
11
|
+
|
|
12
|
+
export type FComponentT<P> = (pcn: P, cn?: Children) => H | void
|
|
13
|
+
|
|
14
|
+
export interface IClassComponent {
|
|
15
|
+
element: Node
|
|
16
|
+
props?: Record<string, any>
|
|
17
|
+
view(): H
|
|
18
|
+
update(uc: IUpdateContext): boolean | void
|
|
19
|
+
mounted?(): void
|
|
20
|
+
//new(props: any): IClassComponent
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface CComponent {
|
|
24
|
+
new (props: any): IClassComponent // while a real component expresses its interface via props pass to the ctor, internally we assign props after construction with new()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ChildrenH = (H | undefined)[]
|
|
28
|
+
export type Children = Expr<ChildrenH>
|
|
29
|
+
|
|
30
|
+
type HText =
|
|
31
|
+
| string // text node
|
|
32
|
+
| number // text node
|
|
33
|
+
| boolean // do not allow boolean, that
|
|
34
|
+
|
|
35
|
+
export type HFragment = {
|
|
36
|
+
cn: Children
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type HElement = {
|
|
40
|
+
tag: string
|
|
41
|
+
p?: Expr<Props>
|
|
42
|
+
cn: Children
|
|
43
|
+
i?: any
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type HCompFun = {
|
|
47
|
+
tag: FComponent
|
|
48
|
+
p?: Expr<Props>
|
|
49
|
+
cn?: Children
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type HCompClass = {
|
|
53
|
+
tag: CComponent
|
|
54
|
+
p?: Expr<Props>
|
|
55
|
+
cn: Children
|
|
56
|
+
i: IClassComponent
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type HComp = HCompFun | HCompClass
|
|
60
|
+
|
|
61
|
+
export type H = // a hyperscript atom that describes a ...
|
|
62
|
+
|
|
63
|
+
| HText
|
|
64
|
+
| HElement // a tag, like p, div with attributes and children
|
|
65
|
+
| HComp // a dynamic component computing any other HNode
|
|
66
|
+
| HFragment
|
|
67
|
+
|
|
68
|
+
declare global {
|
|
69
|
+
interface Node {
|
|
70
|
+
h?: HElement | HCompFun | HCompClass
|
|
71
|
+
}
|
|
72
|
+
export interface IUpdateContext {
|
|
73
|
+
patchElementOnly?: boolean
|
|
74
|
+
replace?: boolean
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface Window {
|
|
78
|
+
jmx?: {
|
|
79
|
+
getnamespace: (tag: string) => string | undefined
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function jsx(): HElement {
|
|
85
|
+
throw 'jmx plugin not configured'
|
|
86
|
+
} // dumy function for app code - jmx-plugin removes calls to this function, minifyer then removes it
|
|
87
|
+
export function jsxf(): HElement {
|
|
88
|
+
throw 'jmx plugin not configured'
|
|
89
|
+
} // dumy function for app code - jmx-plugin removes calls to this function, minifyer then removes it
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './jmx';
|
|
2
|
-
export * from './lib';
|
|
3
|
-
export * from './base';
|
|
4
|
-
export * from './h';
|
|
5
|
-
export * from './jsx';
|
|
1
|
+
export * from './jmx';
|
|
2
|
+
export * from './lib';
|
|
3
|
+
export * from './base';
|
|
4
|
+
export * from './h';
|
|
5
|
+
export * from './jsx';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function hopsi() { }
|
|
2
|
+
function rebind(o, proto = Object.getPrototypeOf(o)) {
|
|
3
|
+
Object.entries(Object.getOwnPropertyDescriptors(proto))
|
|
4
|
+
.filter(([name, p]) => name != 'constructor' && p.value instanceof Function)
|
|
5
|
+
.forEach(([name]) => o[name] = o[name].bind(o));
|
|
6
|
+
return o;
|
|
7
|
+
}
|
|
8
|
+
function mount(o) { Object.assign(globalThis, o); }
|
|
9
|
+
const loggedmethodsex = (o, logger) => new Proxy(o, {
|
|
10
|
+
get(target, name, receiver) {
|
|
11
|
+
if (typeof target[name] === "function") {
|
|
12
|
+
return function (...args) {
|
|
13
|
+
logger(name, args, undefined);
|
|
14
|
+
let r = target[name].apply(this, args);
|
|
15
|
+
return r;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return Reflect.get(target, name, receiver);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const loggedmethods = (o) => loggedmethodsex(o, (name, args, result) => console.log("%c" + name, "background:#585059;color:white;padding:2px;font-weight:bold", args));
|
|
22
|
+
const loggedmethodscolored = (bgcolor, o) => loggedmethodsex(o, (name, args, result) => console.log("%c" + name, `background:${bgcolor};color:white;padding:2px;font-weight:bold`, args));
|
|
23
|
+
|
|
24
|
+
function createElement(tag) {
|
|
25
|
+
let ns = window.jmx?.getnamespace?.(tag);
|
|
26
|
+
return ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
27
|
+
}
|
|
28
|
+
let evaluate = (expr) => (expr instanceof Function ? expr() : expr);
|
|
29
|
+
let removeexcesschildren = (n, i) => {
|
|
30
|
+
let c;
|
|
31
|
+
while ((c = n.childNodes[i])) {
|
|
32
|
+
c.remove();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
let iswebcomponent = (h) => h.tag.includes('-');
|
|
36
|
+
let isclasscomponent = (h) => h.tag?.prototype?.view;
|
|
37
|
+
let iselement = (h) => typeof h.tag == 'string';
|
|
38
|
+
let isfragment = (h) => {
|
|
39
|
+
return h.tag == undefined && h.cn != undefined;
|
|
40
|
+
};
|
|
41
|
+
let isobject = (o) => typeof o === 'object';
|
|
42
|
+
let isproperty = (name, value) => ['value', 'checked', 'disabled', 'className', 'style', 'href', 'src', 'selected', 'readOnly', 'tabIndex'].includes(name) ||
|
|
43
|
+
value instanceof Object ||
|
|
44
|
+
value instanceof Function;
|
|
45
|
+
let setprops = (e, newprops = {}) => {
|
|
46
|
+
let oldprops = evaluate(e.h?.p) ?? {};
|
|
47
|
+
for (let p in oldprops)
|
|
48
|
+
!(p in newprops) && isproperty(p, oldprops[p]) ? (e[p] = null) : e.removeAttribute(p);
|
|
49
|
+
for (let p in newprops)
|
|
50
|
+
isproperty(p, newprops[p]) ? (e[p] = newprops[p]) : e.setAttribute(p, newprops[p]);
|
|
51
|
+
};
|
|
52
|
+
function sync(p, i, h) {
|
|
53
|
+
h = evaluate(h);
|
|
54
|
+
if (h === null || h === undefined)
|
|
55
|
+
return i;
|
|
56
|
+
let c = p.childNodes[i];
|
|
57
|
+
function synctextnode(text) {
|
|
58
|
+
if (c && c.nodeType == 3) {
|
|
59
|
+
if (c.textContent != text)
|
|
60
|
+
c.textContent = text;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
let tn = document.createTextNode(text);
|
|
64
|
+
c ? c.replaceWith(tn) : p.appendChild(tn);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (isobject(h)) {
|
|
68
|
+
function syncchildren(p, h, i) {
|
|
69
|
+
evaluate(h.cn)
|
|
70
|
+
?.flat()
|
|
71
|
+
.forEach(hc => (i = sync(p, i, hc)));
|
|
72
|
+
return i;
|
|
73
|
+
}
|
|
74
|
+
if (isfragment(h))
|
|
75
|
+
return syncchildren(p, h, i);
|
|
76
|
+
const props = evaluate(h.p);
|
|
77
|
+
if (iselement(h)) {
|
|
78
|
+
let n;
|
|
79
|
+
if (c?.tagName?.toLowerCase() != h.tag.toLowerCase()) {
|
|
80
|
+
n = createElement(h.tag);
|
|
81
|
+
c ? c.replaceWith(n) : p.appendChild(n);
|
|
82
|
+
setprops(n, props);
|
|
83
|
+
props?.mounted?.(n);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
n = c;
|
|
87
|
+
setprops(n, props);
|
|
88
|
+
if (props?.update?.(c, globaluc))
|
|
89
|
+
return i + 1;
|
|
90
|
+
}
|
|
91
|
+
n.h = h;
|
|
92
|
+
if (!globaluc.patchElementOnly && !iswebcomponent(h)) {
|
|
93
|
+
const j = syncchildren(n, h, 0);
|
|
94
|
+
removeexcesschildren(n, j);
|
|
95
|
+
}
|
|
96
|
+
return i + 1;
|
|
97
|
+
}
|
|
98
|
+
switch (typeof h.tag) {
|
|
99
|
+
case 'function':
|
|
100
|
+
let isupdate = c?.h?.tag == h.tag;
|
|
101
|
+
let ci;
|
|
102
|
+
if (isclasscomponent(h)) {
|
|
103
|
+
h.i = ci = isupdate ? c.h?.i : rebind(new h.tag(props));
|
|
104
|
+
ci.props = props;
|
|
105
|
+
if (isupdate && ci.update(globaluc))
|
|
106
|
+
return i + 1;
|
|
107
|
+
}
|
|
108
|
+
let hr = ci?.view ? ci?.view() : h.tag(props, evaluate(h.cn));
|
|
109
|
+
if (hr === undefined || hr == null)
|
|
110
|
+
return i;
|
|
111
|
+
let j = sync(p, i, hr);
|
|
112
|
+
let cn = p.childNodes[i];
|
|
113
|
+
cn.h = h;
|
|
114
|
+
if (ci)
|
|
115
|
+
ci.element = cn;
|
|
116
|
+
if (!isupdate)
|
|
117
|
+
ci?.mounted?.();
|
|
118
|
+
return j;
|
|
119
|
+
case 'object':
|
|
120
|
+
return sync(p, i, h.tag);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
synctextnode(h);
|
|
124
|
+
return i + 1;
|
|
125
|
+
}
|
|
126
|
+
let globaluc = {};
|
|
127
|
+
function patch(e, h) {
|
|
128
|
+
if (!e)
|
|
129
|
+
return;
|
|
130
|
+
if (globaluc.replace)
|
|
131
|
+
e.replaceChildren();
|
|
132
|
+
const p = e.parentElement;
|
|
133
|
+
const i = [].indexOf.call(p.childNodes, e);
|
|
134
|
+
sync(p, i, h);
|
|
135
|
+
}
|
|
136
|
+
function updateviewuc(uc, ...sels) {
|
|
137
|
+
{
|
|
138
|
+
globaluc = uc;
|
|
139
|
+
updateviewinternal(...sels);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function updateview(...sels) {
|
|
143
|
+
{
|
|
144
|
+
globaluc = {};
|
|
145
|
+
updateviewinternal(...sels);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function updateviewinternal(...sels) {
|
|
149
|
+
if (!sels.length)
|
|
150
|
+
sels.push('body');
|
|
151
|
+
sels.flatMap(s => (typeof s == 'string' ? [...document.querySelectorAll(s)] : s ? [s] : [])).forEach(e => {
|
|
152
|
+
if (!e?.h)
|
|
153
|
+
throw 'jmx: no h exists on the node';
|
|
154
|
+
patch(e, e.h);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const When = ({ cond }, cn) => cond ? { cn } : void 0;
|
|
159
|
+
class JMXComp {
|
|
160
|
+
props;
|
|
161
|
+
element;
|
|
162
|
+
constructor(props) {
|
|
163
|
+
this.props = props;
|
|
164
|
+
}
|
|
165
|
+
mounted() { }
|
|
166
|
+
update(uc) { }
|
|
167
|
+
updateview() { updateview(this.element); }
|
|
168
|
+
get ismounted() { return this.element; }
|
|
169
|
+
}
|
|
170
|
+
function cc(...namesOrObjects) {
|
|
171
|
+
return namesOrObjects.flatMap(n => (n.trim ? n : Object.keys(n).filter(k => n[k]))).join(' ');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function jsx() {
|
|
175
|
+
throw 'jmx plugin not configured';
|
|
176
|
+
}
|
|
177
|
+
function jsxf() {
|
|
178
|
+
throw 'jmx plugin not configured';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export { JMXComp, When, cc, createElement, hopsi, jsx, jsxf, loggedmethods, loggedmethodscolored, loggedmethodsex, mount, patch, rebind, updateview, updateviewuc };
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"./","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,KAAK,CAAC;AACpB,cAAc,OAAO,CAAC","sourcesContent":["export * from './jmx';\r\nexport * from './lib';\r\nexport * from './base';\r\nexport * from './h';\r\nexport * from './jsx';\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../base.ts","../jmx.ts","../lib.ts","../h.ts"],"sourcesContent":["export function hopsi() {}\n\nexport function rebind<T extends object>(o: T, proto = Object.getPrototypeOf(o)) : T {\n Object.entries(Object.getOwnPropertyDescriptors(proto))\n .filter(([name, p]) => name != 'constructor' && p.value instanceof Function)\n .forEach(([name]) => (o as any)[name] = (o as any)[name].bind(o))\n return o\n}\n\nexport function mount(o: Record<string, any>) { Object.assign(globalThis, o) }\n\nexport const loggedmethodsex = <T extends Record<string, any>>(o: T, logger: (name: string, args: any[], result: any) => void) => new Proxy(o, {\n get(target, name: string, receiver) {\n if (typeof target[name] === \"function\") {\n return function (this: T, ...args: any[]) {\n\n logger(name, args, undefined)\n let r = target[name].apply(this, args)\n return r\n }\n }\n return Reflect.get(target, name, receiver)\n },\n})\n\nexport const loggedmethods = <T extends Record<string, any>>(o: T ): T => loggedmethodsex(o, (name, args, result) => console.log(\"%c\" + name, \"background:#585059;color:white;padding:2px;font-weight:bold\", args))\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))\n","import { rebind } from './base'\nimport { Expr, FComponent, H, HComp, HCompClass, HElement, HFragment, IClassComponent, Props } from './h'\n\n// config\nexport function createElement(tag: string) {\n let ns = window.jmx?.getnamespace?.(tag)\n return ns ? document.createElementNS(ns, tag) : document.createElement(tag)\n}\n\nconst enum NodeType { // vaporizes (but for that must be in this file, otherwise not)\n TextNode = 3,\n}\n\nlet evaluate = <T>(expr: Expr<T>): T => (expr instanceof Function ? expr() : expr)\nlet removeexcesschildren = (n: Element, i: number) => {\n let c: ChildNode\n while ((c = n.childNodes[i])) {\n c.remove()\n }\n}\nlet iswebcomponent = (h: HElement) => (h.tag as string).includes('-')\nlet isclasscomponent = (h: HComp): h is HCompClass => (h.tag as any)?.prototype?.view\nlet iselement = (h: any): h is HElement => typeof h.tag == 'string'\nlet isfragment = (h: any): h is HFragment => {\n return h.tag == undefined && h.cn != undefined\n}\nlet isobject = (o: any): o is object => typeof o === 'object'\n\nlet isproperty = (name: string, value: any) =>\n ['value', 'checked', 'disabled', 'className', 'style', 'href', 'src', 'selected', 'readOnly', 'tabIndex'].includes(\n name\n ) ||\n value instanceof Object ||\n value instanceof Function\n\nlet setprops = (e: Element, newprops: Props = {}) => {\n let oldprops = evaluate(e.h?.p) ?? {}\n for (let p in oldprops)\n !(p in newprops) && isproperty(p, oldprops[p]) ? ((e as any)[p] = null) : e.removeAttribute(p)\n for (let p in newprops) isproperty(p, newprops[p]) ? ((e as any)[p] = newprops[p]) : e.setAttribute(p, newprops[p])\n}\n\n/** syncs at position i of p. returns the number of the element past the last added element.\n * if no element was added (eg when h=null) then it returns i\n * if a fragment with 5 nodes was added, it returns i + 5\n * when a single element or component is added, it is i+1 since they always create exactly 1 node\n */\nfunction sync(p: Element, i: number, h: Expr<H | undefined>): number {\n // console.log('%csync', \"background:orange\", p.tagName, i, h)\n\n h = evaluate(h)\n if (h === null || h === undefined) return i // skip this element. not that !!h would forbid to render the number 0 or the boolean value false\n\n let c = p.childNodes[i] // is often null, eg during fresh creation\n\n function synctextnode(text: string) {\n if (c && c.nodeType == NodeType.TextNode) {\n if (c.textContent != text) c.textContent = text // firefox updates even equal text, loosing an existing text selection\n } else {\n let tn = document.createTextNode(text)\n c ? c.replaceWith(tn) : p.appendChild(tn)\n }\n }\n\n if (isobject(h)) {\n // element nodes\n\n /** synchronizes children starting at the i-th element. returns the index of the last child synchronized */\n function syncchildren(p: Element, h: HElement | HComp | HFragment, i: number): number {\n evaluate(h.cn)\n ?.flat()\n .forEach(hc => (i = sync(p, i, hc)))\n return i\n }\n\n if (isfragment(h)) return syncchildren(p, h, i)\n\n const props = evaluate(h.p)\n\n if (iselement(h)) {\n let n: Element\n\n if ((<Element>c)?.tagName?.toLowerCase() != h.tag.toLowerCase()) {\n n = createElement(h.tag)\n c ? c.replaceWith(n) : p.appendChild(n)\n setprops(n, props)\n props?.mounted?.(n)\n } else {\n n = c as Element\n setprops(n, props)\n if (props?.update?.(c, globaluc)) return i + 1\n }\n\n // if only components shall be updateable (advantage: close variables inside component functions are always fresh materialized, avoids surprises), comment this out\n n.h = h\n\n if (!globaluc.patchElementOnly && !iswebcomponent(h as HElement)) {\n // tbd: make \"island\" attribute\n const j = syncchildren(n, h, 0)\n removeexcesschildren(n, j)\n }\n return i + 1\n }\n\n switch (typeof h.tag) {\n case 'function':\n let isupdate = c?.h?.tag == h.tag\n\n let ci: IClassComponent | undefined\n\n if (isclasscomponent(h)) {\n h.i = ci = isupdate ? (c.h as HCompClass)?.i : rebind(new h.tag(props))\n ci.props = props\n\n // if component instance returns truthy for update(), then this update substitutes syncing\n if (isupdate && ci.update(globaluc)) return i + 1\n }\n\n // materialize the component\n // we run compoents view() and fun code often, we do not compare properties to avoid their computation\n // this means that the inner hr (h resolved) is run often\n //\n // if ci has a view, return ci.view() even if it is falsy, this is perfectly valid\n let hr = ci?.view ? ci?.view() : (h.tag as FComponent)(props, evaluate(h.cn))\n\n // a component can return undefined or null if it has no elements to show\n if (hr === undefined || hr == null) return i\n\n let j = sync(p, i, hr)\n\n // now the dom element exists\n\n let cn = p.childNodes[i]!\n cn.h = h // attach h onto the materialized component node\n // ;(cn as HTMLElement).setAttribute?.('comp', '')\n\n // class component life cycle calls\n if (ci) ci.element = cn\n if (!isupdate) ci?.mounted?.()\n\n return j\n\n case 'object':\n return sync(p, i, h.tag) // tbd: type of h is not correct, h.tag == never\n }\n }\n // text nodes\n synctextnode(h as string)\n return i + 1\n}\n\nlet globaluc: IUpdateContext = {}\n\nexport function patch(e: Node | null, h: Expr<H>) {\n if (!e) return\n if (globaluc.replace) (e as HTMLElement).replaceChildren()\n const p = e.parentElement as HTMLElement\n const i = [].indexOf.call<any, any, any>(p.childNodes, e)\n // always called deferred, because removing elements can trigger events and their handlers (like blur)\n sync(p, i, h)\n}\n\n// Overload signatures\ntype Selector = string | Node | undefined | null\ntype Selectors = Selector[]\n\nexport function updateviewuc(uc: IUpdateContext, ...sels: Selectors): void {\n {\n globaluc = uc\n updateviewinternal(...sels)\n }\n}\nexport function updateview(...sels: Selectors): void {\n {\n globaluc = {}\n updateviewinternal(...sels)\n }\n}\n\nfunction updateviewinternal(...sels: Selector[]): void {\n if (!sels.length) sels.push('body')\n sels.flatMap(s => (typeof s == 'string' ? [...document.querySelectorAll(s)] : s ? [s] : [])).forEach(e => {\n if (!e?.h) throw 'jmx: no h exists on the node'\n patch(e, e.h)\n })\n}\n","import { Props, IClassComponent, H, FComponentT, Children } from 'h'\nimport { updateview } from './jmx'\n\nexport type DeepReadonly<T> = { readonly [K in keyof T]: T[K] extends Record<string, unknown> ? DeepReadonly<T[K]> : T[K]; }\n\nexport const When = ({ cond }: { cond: boolean }, cn: Children) => cond ? { cn } : void 0;\n\nexport abstract class JMXComp<P extends Props = {}> implements IClassComponent {\n\n // assigned by jmx framework\n element!: HTMLElement\n\n // we provide this ctor for jsx which uses ctor arguments as properties of class components.\n // at runtime, we pass the props directly\n constructor(public props: P) { }\n\n // overrides\n mounted() { }\n update(uc?: IUpdateContext): boolean | void { }\n abstract view(): H\n\n // utility: updates the component's view\n updateview() { updateview(this.element) }\n get ismounted():boolean { return this.element as any }\n}\n\nexport function cc(...namesOrObjects: (string | any)[]): string {\n return namesOrObjects.flatMap(n => (n.trim ? n : Object.keys(n).filter(k => n[k]))).join(' ') // n.trim distinguishes strings from objects\n}","// jmx internal types - hopst\n// the following types describe the js expression we get from tsx after conversion be our jmx plugin\n// they can be useful for users as well, components might return them.\n\ntype Func<T> = () => T\nexport type Expr<T> = T | Func<T>\n\nexport type Props = Record<string, any>\n\nexport type FComponent = (props: Props | undefined, children?: ChildrenH) => HElement // show an example for usage of children\n\nexport type FComponentT<P> = (pcn: P, cn?: Children) => H | void\n\nexport interface IClassComponent {\n element: Node\n props?: Record<string, any>\n view(): H\n update(uc: IUpdateContext): boolean | void\n mounted?(): void\n //new(props: any): IClassComponent\n}\n\ninterface CComponent {\n new (props: any): IClassComponent // while a real component expresses its interface via props pass to the ctor, internally we assign props after construction with new()\n}\n\nexport type ChildrenH = (H | undefined)[]\nexport type Children = Expr<ChildrenH>\n\ntype HText =\n | string // text node\n | number // text node\n | boolean // do not allow boolean, that\n\nexport type HFragment = {\n cn: Children\n}\n\nexport type HElement = {\n tag: string\n p?: Expr<Props>\n cn: Children\n i?: any\n}\n\ntype HCompFun = {\n tag: FComponent\n p?: Expr<Props>\n cn?: Children\n}\n\nexport type HCompClass = {\n tag: CComponent\n p?: Expr<Props>\n cn: Children\n i: IClassComponent\n}\n\nexport type HComp = HCompFun | HCompClass\n\nexport type H = // a hyperscript atom that describes a ...\n\n | HText\n | HElement // a tag, like p, div with attributes and children\n | HComp // a dynamic component computing any other HNode\n | HFragment\n\ndeclare global {\n interface Node {\n h?: HElement | HCompFun | HCompClass\n }\n export interface IUpdateContext {\n patchElementOnly?: boolean\n replace?: boolean\n }\n\n export interface Window {\n jmx?: {\n getnamespace: (tag: string) => string | undefined\n }\n }\n}\n\nexport function jsx(): HElement {\n throw 'jmx plugin not configured'\n} // dumy function for app code - jmx-plugin removes calls to this function, minifyer then removes it\nexport function jsxf(): HElement {\n throw 'jmx plugin not configured'\n} // dumy function for app code - jmx-plugin removes calls to this function, minifyer then removes it\n"],"names":[],"mappings":"AAAM,SAAU,KAAK,GAAA,EAAI;AAEnB,SAAU,MAAM,CAAmB,CAAI,EAAE,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAA;IAC3E,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC;AACjD,SAAA,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,aAAa,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ;SAC1E,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAS,CAAC,IAAI,CAAC,GAAI,CAAS,CAAC,I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AAC,IAAG;QACrG,IAAI,CAAC,CAAC,EAAE,CAAC;AAAE,YAAA,MAAM,8BAA8B;AAC/C,QAAA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjB,IAAA,CAAC,CAAC;AACN;;ACpLO,MAAM,IAAI,GAAG,CAAC,EAAE,IAAI,EAAqB,EAAE,EAAY,KAAK,IAAI,GAAG,EAAE,EAAE,EAAE,GAAG;MAE7D,OAAO,CAAA;AAON,IAAA,KAAA;AAJnB,IAAA,OAAO;AAIP,IAAA,WAAA,CAAmB,KAAQ,EAAA;QAAR,IAAA,CAAA,KAAK,GAAL,KAAK;IAAO;AAG/B,IAAA,OAAO,KAAK;IACZ,MAAM,CAAC,EAAmB,EAAA,EAAoB;IAI9C,UAAU,GAAA,EAAK,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA,CAAC;IACxC,IAAI,SAAS,KAAa,OAAO,IAAI,CAAC,OAAc,CAAA,CAAC;AACxD;AAEK,SAAU,EAAE,CAAC,GAAG,cAAgC,EAAA;IAClD,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACjG;;SCuDgB,GAAG,GAAA;AACf,IAAA,MAAM,2BAA2B;AACrC;SACgB,IAAI,GAAA;AAChB,IAAA,MAAM,2BAA2B;AACrC;;;;"}
|
package/dist/index.ts
ADDED
package/dist/jmx.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Expr, H } from './h';
|
|
2
|
-
export declare function createElement(tag: string): Element;
|
|
3
|
-
export declare function patch(e: Node | null, h: Expr<H>): void;
|
|
4
|
-
type Selector = string | Node | undefined | null;
|
|
5
|
-
type Selectors = Selector[];
|
|
6
|
-
export declare function updateviewuc(uc: IUpdateContext, ...sels: Selectors): void;
|
|
7
|
-
export declare function updateview(...sels: Selectors): void;
|
|
8
|
-
export {};
|
|
1
|
+
import { Expr, H } from './h';
|
|
2
|
+
export declare function createElement(tag: string): Element;
|
|
3
|
+
export declare function patch(e: Node | null, h: Expr<H>): void;
|
|
4
|
+
type Selector = string | Node | undefined | null;
|
|
5
|
+
type Selectors = Selector[];
|
|
6
|
+
export declare function updateviewuc(uc: IUpdateContext, ...sels: Selectors): void;
|
|
7
|
+
export declare function updateview(...sels: Selectors): void;
|
|
8
|
+
export {};
|
|
9
9
|
//# sourceMappingURL=jmx.d.ts.map
|
package/dist/jmx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jmx.d.ts","sourceRoot":"./","sources":["jmx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAc,CAAC,EAAkE,MAAM,KAAK,CAAA;AAGzG,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,WAGxC;
|
|
1
|
+
{"version":3,"file":"jmx.d.ts","sourceRoot":"./","sources":["jmx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAc,CAAC,EAAkE,MAAM,KAAK,CAAA;AAGzG,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,WAGxC;AAkJD,wBAAgB,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,QAO/C;AAGD,KAAK,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;AAChD,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAA;AAE3B,wBAAgB,YAAY,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,SAAS,GAAG,IAAI,CAKzE;AACD,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,IAAI,CAKnD"}
|