@actdim/dynstruct 1.1.3 → 1.1.4
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/dist/componentModel/componentContext.d.ts.map +1 -1
- package/dist/componentModel/componentContext.es.js +60 -55
- package/dist/componentModel/componentContext.es.js.map +1 -1
- package/dist/componentModel/contracts.d.ts +1 -0
- package/dist/componentModel/contracts.d.ts.map +1 -1
- package/dist/componentModel/contracts.es.js.map +1 -1
- package/dist/componentModel/react.d.ts.map +1 -1
- package/dist/componentModel/react.es.js +95 -96
- package/dist/componentModel/react.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentContext.d.ts","sourceRoot":"","sources":["../../src/componentModel/componentContext.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAiB,iBAAiB,EAAsB,MAAM,OAAO,CAAC;AACpF,OAAO,
|
|
1
|
+
{"version":3,"file":"componentContext.d.ts","sourceRoot":"","sources":["../../src/componentModel/componentContext.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAiB,iBAAiB,EAAsB,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAA+C,MAAM,aAAa,CAAC;AAGhG,eAAO,MAAM,qBAAqB,KAAqD,CAAC;AAGxF,wBAAgB,wBAAwB,CACpC,KAAK,EAAE,iBAAiB,CAAC;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAChC,CAAC,OA2LL;AAGD,wBAAgB,mBAAmB,QASlC"}
|
|
@@ -1,79 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import R, { createContext as k, useContext as E, useRef as i } from "react";
|
|
2
|
+
import { toHtmlId as I } from "./core.es.js";
|
|
3
|
+
const g = k(void 0);
|
|
4
|
+
function H(s) {
|
|
5
|
+
let f;
|
|
6
|
+
const o = i(/* @__PURE__ */ new Map()), u = i([]), l = i(/* @__PURE__ */ new Map()), C = (e) => {
|
|
7
|
+
let t = 1;
|
|
8
|
+
return l.current.has(e) && (t = l.current.get(e)), l.current.set(e, t + 1), `${I(e)}#${t}`;
|
|
9
|
+
}, x = () => u.current[u.current.length - 1], m = (e, t, n) => {
|
|
6
10
|
let r = o.current.get(e);
|
|
7
|
-
if (r ? (r.parentId =
|
|
11
|
+
if (r ? (r.parentId = n, r.regType = t) : (r = {
|
|
8
12
|
id: e,
|
|
9
|
-
parentId:
|
|
13
|
+
parentId: n,
|
|
10
14
|
children: /* @__PURE__ */ new Set(),
|
|
11
|
-
regType:
|
|
12
|
-
}, o.current.set(e, r)),
|
|
13
|
-
let c = o.current.get(
|
|
15
|
+
regType: t
|
|
16
|
+
}, o.current.set(e, r)), n) {
|
|
17
|
+
let c = o.current.get(n);
|
|
14
18
|
c || (c = {
|
|
15
|
-
id:
|
|
19
|
+
id: n,
|
|
16
20
|
children: /* @__PURE__ */ new Set(),
|
|
17
21
|
regType: void 0
|
|
18
|
-
}, o.current.set(
|
|
22
|
+
}, o.current.set(n, c)), c.children.has(e) || c.children.add(e);
|
|
19
23
|
}
|
|
20
|
-
|
|
24
|
+
u.current.push(e);
|
|
21
25
|
}, p = (e) => {
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
26
|
+
const t = o.current.get(e);
|
|
27
|
+
if (!t)
|
|
24
28
|
return;
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
const
|
|
30
|
-
let
|
|
29
|
+
t.parentId && o.current.get(t.parentId)?.children.delete(e), t.children.forEach((r) => p(r)), o.current.delete(e);
|
|
30
|
+
const n = u.current.lastIndexOf(e);
|
|
31
|
+
n >= 0 && u.current.splice(n, 1);
|
|
32
|
+
}, a = (e) => o.current.get(e)?.parentId, d = (e) => Array.from(o.current.get(e)?.children ?? []), w = (e) => {
|
|
33
|
+
const t = [];
|
|
34
|
+
let n = e;
|
|
31
35
|
for (; ; ) {
|
|
32
|
-
const r =
|
|
36
|
+
const r = a(n);
|
|
33
37
|
if (!r)
|
|
34
38
|
break;
|
|
35
|
-
|
|
39
|
+
t.push(r), n = r;
|
|
36
40
|
}
|
|
37
|
-
return
|
|
38
|
-
},
|
|
39
|
-
const
|
|
40
|
-
for (;
|
|
41
|
-
const r =
|
|
42
|
-
for (const
|
|
43
|
-
|
|
41
|
+
return t;
|
|
42
|
+
}, v = (e) => {
|
|
43
|
+
const t = [], n = [e];
|
|
44
|
+
for (; n.length > 0; ) {
|
|
45
|
+
const r = n.pop(), c = d(r);
|
|
46
|
+
for (const h of c)
|
|
47
|
+
t.includes(h) || (t.push(h), n.push(h));
|
|
44
48
|
}
|
|
45
|
-
return
|
|
46
|
-
},
|
|
47
|
-
e || (e =
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
for (;
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
return
|
|
55
|
-
...
|
|
56
|
-
register:
|
|
49
|
+
return t;
|
|
50
|
+
}, P = (e) => {
|
|
51
|
+
e || (e = x());
|
|
52
|
+
const t = [];
|
|
53
|
+
let n = e;
|
|
54
|
+
for (; n; )
|
|
55
|
+
t.push(n), n = a(n);
|
|
56
|
+
return t.reverse().join("/");
|
|
57
|
+
}, M = () => o.current;
|
|
58
|
+
return f = i({
|
|
59
|
+
...s.value,
|
|
60
|
+
register: m,
|
|
57
61
|
unregister: p,
|
|
58
|
-
getParent:
|
|
59
|
-
getChildren:
|
|
60
|
-
getChainUp:
|
|
61
|
-
getChainDown:
|
|
62
|
-
getHierarchyPath:
|
|
63
|
-
getNodeMap:
|
|
64
|
-
|
|
62
|
+
getParent: a,
|
|
63
|
+
getChildren: d,
|
|
64
|
+
getChainUp: w,
|
|
65
|
+
getChainDown: v,
|
|
66
|
+
getHierarchyPath: P,
|
|
67
|
+
getNodeMap: M,
|
|
68
|
+
getNextId: C
|
|
69
|
+
}), /* @__PURE__ */ R.createElement(g.Provider, { value: f.current }, s.children);
|
|
65
70
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
71
|
+
function $() {
|
|
72
|
+
const s = E(g);
|
|
73
|
+
if (!s)
|
|
69
74
|
throw new Error(
|
|
70
75
|
"Can't resolve ComponentContext. Please wrap your component tree with <ComponentContextProvider>."
|
|
71
76
|
);
|
|
72
|
-
return
|
|
77
|
+
return s;
|
|
73
78
|
}
|
|
74
79
|
export {
|
|
75
|
-
|
|
80
|
+
H as ComponentContextProvider,
|
|
76
81
|
g as ReactComponentContext,
|
|
77
|
-
|
|
82
|
+
$ as useComponentContext
|
|
78
83
|
};
|
|
79
84
|
//# sourceMappingURL=componentContext.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentContext.es.js","sources":["../../src/componentModel/componentContext.tsx"],"sourcesContent":["//##############################################################################\r\n//# Copyright (c) Pavel Borodaev #\r\n//##############################################################################\r\n\r\nimport React, { createContext, PropsWithChildren, useContext, useRef } from 'react';\r\nimport {
|
|
1
|
+
{"version":3,"file":"componentContext.es.js","sources":["../../src/componentModel/componentContext.tsx"],"sourcesContent":["//##############################################################################\r\n//# Copyright (c) Pavel Borodaev #\r\n//##############################################################################\r\n\r\nimport React, { createContext, PropsWithChildren, useContext, useRef } from 'react';\r\nimport { BaseComponentContext, ComponentRegistryContext, ComponentTreeNode } from './contracts';\r\nimport { toHtmlId } from './core';\r\n\r\nexport const ReactComponentContext = createContext<ComponentRegistryContext>(undefined);\r\n\r\n// ComponentRegistry(Context)Provider\r\nexport function ComponentContextProvider(\r\n props: PropsWithChildren<{\r\n value?: BaseComponentContext;\r\n }>,\r\n) {\r\n let context: React.RefObject<ComponentRegistryContext>;\r\n const treeRef = useRef(new Map<string, ComponentTreeNode>());\r\n // idStack\r\n const regStack = useRef([]);\r\n\r\n const seqMap = useRef(new Map<string, number>());\r\n\r\n const getNextId = (regType: string) => {\r\n let index = 1;\r\n if (seqMap.current.has(regType)) {\r\n index = seqMap.current.get(regType);\r\n }\r\n seqMap.current.set(regType, index + 1);\r\n return `${toHtmlId(regType)}#${index}`;\r\n };\r\n\r\n const getCurrentId = () => {\r\n return regStack.current[regStack.current.length - 1];\r\n };\r\n\r\n const register = (id: string, regType: string, parentId?: string) => {\r\n let node = treeRef.current.get(id);\r\n\r\n if (!node) {\r\n node = {\r\n id,\r\n parentId,\r\n children: new Set(),\r\n regType: regType,\r\n };\r\n treeRef.current.set(id, node);\r\n } else {\r\n node.parentId = parentId;\r\n node.regType = regType;\r\n }\r\n\r\n if (parentId) {\r\n let parentNode = treeRef.current.get(parentId);\r\n if (!parentNode) {\r\n parentNode = {\r\n id: parentId,\r\n children: new Set(),\r\n regType: undefined,\r\n };\r\n treeRef.current.set(parentId, parentNode);\r\n }\r\n if (!parentNode.children.has(id)) {\r\n parentNode.children.add(id);\r\n }\r\n }\r\n\r\n regStack.current.push(id);\r\n };\r\n\r\n const unregister = (id: string) => {\r\n const node = treeRef.current.get(id);\r\n if (!node) {\r\n return;\r\n }\r\n\r\n if (node.parentId) {\r\n const parent = treeRef.current.get(node.parentId);\r\n parent?.children.delete(id);\r\n }\r\n\r\n node.children.forEach((childId) => unregister(childId));\r\n treeRef.current.delete(id);\r\n\r\n const index = regStack.current.lastIndexOf(id);\r\n if (index >= 0) {\r\n regStack.current.splice(index, 1);\r\n }\r\n };\r\n\r\n const getParent = (id: string) => {\r\n return treeRef.current.get(id)?.parentId;\r\n };\r\n const getChildren = (id: string) => {\r\n return Array.from(treeRef.current.get(id)?.children ?? []) as string[];\r\n };\r\n\r\n const getChainUp = (id: string): string[] => {\r\n const result: string[] = [];\r\n let current = id;\r\n while (true) {\r\n const parent = getParent(current);\r\n if (!parent) {\r\n break;\r\n }\r\n result.push(parent);\r\n current = parent;\r\n }\r\n return result;\r\n };\r\n\r\n const getRootId = (id: string) => {\r\n let current = id;\r\n while (true) {\r\n const parent = getParent(current);\r\n if (!parent) {\r\n break;\r\n }\r\n current = parent;\r\n }\r\n return current;\r\n };\r\n\r\n const getChainDown = (id: string): string[] => {\r\n const result: string[] = [];\r\n const stack: string[] = [id];\r\n while (stack.length > 0) {\r\n const current = stack.pop();\r\n const children = getChildren(current)!;\r\n for (const child of children) {\r\n if (!result.includes(child)) {\r\n result.push(child);\r\n stack.push(child);\r\n }\r\n }\r\n // result.push(...children);\r\n // stack.push(...children);\r\n }\r\n return result;\r\n };\r\n\r\n const getHierarchy = (rootId: string) => {\r\n const buildNode = (id: string): ComponentTreeNode => {\r\n const childIds = getChildren(id) || [];\r\n return {\r\n id,\r\n parentId: getParent(id),\r\n children: childIds.map(buildNode),\r\n } as ComponentTreeNode & { children: ComponentTreeNode[] };\r\n };\r\n return buildNode(rootId);\r\n };\r\n\r\n const getSiblings = (id: string) => {\r\n const parent = getParent(id);\r\n if (!parent) {\r\n return [];\r\n }\r\n const children = getChildren(parent);\r\n if (!children) {\r\n return [];\r\n }\r\n return children.filter((child) => child !== id);\r\n };\r\n\r\n const getHierarchyPath = (id: string): string => {\r\n if (!id) {\r\n id = getCurrentId();\r\n }\r\n const path: string[] = [];\r\n let current = id;\r\n\r\n while (current) {\r\n path.push(current);\r\n current = getParent(current);\r\n }\r\n\r\n return path.reverse().join('/');\r\n };\r\n\r\n // getNodes\r\n const getNodeMap = () => treeRef.current;\r\n\r\n context = useRef({\r\n ...props.value,\r\n register,\r\n unregister,\r\n getParent,\r\n getChildren,\r\n getChainUp,\r\n getChainDown,\r\n getHierarchyPath,\r\n getNodeMap,\r\n getNextId,\r\n });\r\n\r\n return (\r\n <ReactComponentContext.Provider value={context.current}>\r\n {props.children}\r\n </ReactComponentContext.Provider>\r\n );\r\n}\r\n\r\n// useComponentRegistry(Context)\r\nexport function useComponentContext() {\r\n const context = useContext(ReactComponentContext);\r\n if (!context) {\r\n // useComponentContext must be used within a ComponentContextProvider\r\n throw new Error(\r\n \"Can't resolve ComponentContext. Please wrap your component tree with <ComponentContextProvider>.\",\r\n );\r\n }\r\n return context;\r\n}\r\n"],"names":["ReactComponentContext","createContext","ComponentContextProvider","props","context","treeRef","useRef","regStack","seqMap","getNextId","regType","index","toHtmlId","getCurrentId","register","id","parentId","node","parentNode","unregister","childId","getParent","getChildren","getChainUp","result","current","parent","getChainDown","stack","children","child","getHierarchyPath","path","getNodeMap","React","useComponentContext","useContext"],"mappings":";;AAQO,MAAMA,IAAwBC,EAAwC,MAAS;AAG/E,SAASC,EACZC,GAGF;AACE,MAAIC;AACJ,QAAMC,IAAUC,EAAO,oBAAI,KAAgC,GAErDC,IAAWD,EAAO,EAAE,GAEpBE,IAASF,EAAO,oBAAI,KAAqB,GAEzCG,IAAY,CAACC,MAAoB;AACnC,QAAIC,IAAQ;AACZ,WAAIH,EAAO,QAAQ,IAAIE,CAAO,MAC1BC,IAAQH,EAAO,QAAQ,IAAIE,CAAO,IAEtCF,EAAO,QAAQ,IAAIE,GAASC,IAAQ,CAAC,GAC9B,GAAGC,EAASF,CAAO,CAAC,IAAIC,CAAK;AAAA,EACxC,GAEME,IAAe,MACVN,EAAS,QAAQA,EAAS,QAAQ,SAAS,CAAC,GAGjDO,IAAW,CAACC,GAAYL,GAAiBM,MAAsB;AACjE,QAAIC,IAAOZ,EAAQ,QAAQ,IAAIU,CAAE;AAejC,QAbKE,KASDA,EAAK,WAAWD,GAChBC,EAAK,UAAUP,MATfO,IAAO;AAAA,MACH,IAAAF;AAAA,MACA,UAAAC;AAAA,MACA,8BAAc,IAAA;AAAA,MACd,SAAAN;AAAA,IAAA,GAEJL,EAAQ,QAAQ,IAAIU,GAAIE,CAAI,IAM5BD,GAAU;AACV,UAAIE,IAAab,EAAQ,QAAQ,IAAIW,CAAQ;AAC7C,MAAKE,MACDA,IAAa;AAAA,QACT,IAAIF;AAAA,QACJ,8BAAc,IAAA;AAAA,QACd,SAAS;AAAA,MAAA,GAEbX,EAAQ,QAAQ,IAAIW,GAAUE,CAAU,IAEvCA,EAAW,SAAS,IAAIH,CAAE,KAC3BG,EAAW,SAAS,IAAIH,CAAE;AAAA,IA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A;AACvB,QAAIP,IAAUV;AAEd,WAAOU;AACH,MAAAO,EAAK,KAAKP,CAAO,GACjBA,IAAUJ,EAAUI,CAAO;AAG/B,WAAOO,EAAK,UAAU,KAAK,GAAG;AAAA,EAClC,GAGMC,IAAa,MAAM5B,EAAQ;AAEjC,SAAAD,IAAUE,EAAO;AAAA,IACb,GAAGH,EAAM;AAAA,IACT,UAAAW;AAAA,IACA,YAAAK;AAAA,IACA,WAAAE;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAI;AAAA,IACA,kBAAAI;AAAA,IACA,YAAAE;AAAA,IACA,WAAAxB;AAAA,EAAA,CACH,GAGG,gBAAAyB,EAAA,cAAClC,EAAsB,UAAtB,EAA+B,OAAOI,EAAQ,QAAA,GAC1CD,EAAM,QACX;AAER;AAGO,SAASgC,IAAsB;AAClC,QAAM/B,IAAUgC,EAAWpC,CAAqB;AAChD,MAAI,CAACI;AAED,UAAM,IAAI;AAAA,MACN;AAAA,IAAA;AAGR,SAAOA;AACX;"}
|
|
@@ -19,6 +19,7 @@ export type ComponentRegistryContext<TMsgStruct extends MsgStruct = MsgStruct> =
|
|
|
19
19
|
getChainUp: (id: string) => string[];
|
|
20
20
|
getChainDown: (id: string) => string[];
|
|
21
21
|
getHierarchyPath: (id: string) => string;
|
|
22
|
+
getNextId: (regType: string) => string;
|
|
22
23
|
getNodeMap: () => Map<string, ComponentTreeNode>;
|
|
23
24
|
};
|
|
24
25
|
export type ComponentMsgHeaders = MsgHeaders & {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/componentModel/contracts.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,OAAO,EACP,GAAG,EACH,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,SAAS,EACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,Y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iBAAiB,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC;IACvD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,eAAe,GAAG,eAAe,IACzE,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACjC,eAAe,CAAC,OAAO,CAAC,GAAG;IACvB,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEV,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.es.js","sources":["../../src/componentModel/contracts.tsx"],"sourcesContent":["import {\r\n $CG_IN,\r\n $CG_OUT,\r\n Msg,\r\n MsgBus,\r\n MsgHeaders,\r\n MsgProviderParams,\r\n MsgStruct,\r\n MsgSubParams,\r\n OutStruct,\r\n} from '@actdim/msgmesh/contracts';\r\nimport { HasKeys, MaybeKeyOf, MaybePromise, Require, Skip } from '@actdim/utico/typeCore';\r\nimport { FC, PropsWithChildren, ReactNode } from 'react';\r\n\r\nexport type BaseComponentContext<TMsgStruct extends MsgStruct = MsgStruct> = {\r\n msgBus: MsgBus<TMsgStruct>;\r\n currentId?: string;\r\n};\r\n\r\nexport type ComponentTreeNode = {\r\n id: string;\r\n regType: string;\r\n parentId?: string;\r\n children: Set<string>;\r\n};\r\n\r\n// ComponentContext\r\nexport type ComponentRegistryContext<TMsgStruct extends MsgStruct = MsgStruct> =\r\n BaseComponentContext<TMsgStruct> & {\r\n register: (id: string, regType: string, parentId?: string) => void;\r\n unregister: (id: string) => void;\r\n getParent: (id: string) => string | undefined;\r\n getChildren: (id: string) => string[];\r\n getChainUp: (id: string) => string[];\r\n getChainDown: (id: string) => string[];\r\n getHierarchyPath: (id: string) => string;\r\n getNodeMap: () => Map<string, ComponentTreeNode>;\r\n };\r\n\r\nexport type ComponentMsgHeaders = MsgHeaders & {};\r\n\r\nexport enum ComponentMsgFilter {\r\n None = 0,\r\n // AcceptFrom...\r\n FromAncestors = 1 << 0,\r\n FromDescendants = 1 << 1,\r\n}\r\n\r\nexport type MsgChannelGroupProviderParams<\r\n TStruct extends MsgStruct = MsgStruct,\r\n TChannel extends keyof TStruct = keyof TStruct,\r\n TGroup extends keyof TStruct[TChannel] = typeof $CG_IN, // keyof TStruct[TChannel]\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n TScope = any,\r\n> = Skip<\r\n MsgProviderParams<TStruct, TChannel, TGroup>,\r\n 'channel' | 'group' | 'callback' | 'filter'\r\n> & {\r\n // resolve\r\n callback?: (\r\n msgIn: Msg<TStruct, TChannel, TGroup, TMsgHeaders>,\r\n headers: TMsgHeaders,\r\n scope: TScope,\r\n ) => MaybePromise<OutStruct<TStruct, TChannel>>;\r\n filter?: (msg: Msg<TStruct, TChannel, TGroup, TMsgHeaders>, scope: TScope) => boolean;\r\n componentFilter?: ComponentMsgFilter;\r\n};\r\n\r\nexport type MsgChannelGroupSubscriberParams<\r\n TStruct extends MsgStruct = MsgStruct,\r\n TChannel extends keyof TStruct = keyof TStruct,\r\n TGroup extends keyof TStruct[TChannel] = typeof $CG_IN, // keyof TStruct[TChannel]\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n TScope = any,\r\n> = Skip<MsgSubParams<TStruct, TChannel, TGroup>, 'channel' | 'group' | 'callback' | 'filter'> & {\r\n callback?: (msg: Msg<TStruct, TChannel, TGroup, TMsgHeaders>, scope: TScope) => void;\r\n filter?: (msg: Msg<TStruct, TChannel, TGroup, TMsgHeaders>, scope: TScope) => boolean;\r\n componentFilter?: ComponentMsgFilter;\r\n};\r\n\r\n// MsgScope\r\nexport type MsgBrokerScope<\r\n TStruct extends MsgStruct /*= MsgStruct*/,\r\n TKeysToProvide extends keyof TStruct = keyof TStruct,\r\n TKeysToSubscribe extends keyof TStruct = keyof TStruct,\r\n TKeysToPublish extends keyof TStruct = keyof TStruct,\r\n> = {\r\n provide?: TKeysToProvide;\r\n // consume\r\n subscribe?: TKeysToSubscribe;\r\n // produce\r\n publish?: TKeysToPublish;\r\n};\r\n\r\nexport type ComponentPropStruct = Record<string, any>;\r\n// export type ComponentPropStruct = {\r\n// [prop: string]: any;\r\n// };\r\n\r\nexport type ComponentMethodStruct = Record<string, Function>;\r\n// export type ComponentMethodStruct = {\r\n// [action: string]: Function;\r\n// };\r\n\r\n// export type ComponentRefStruct = Record<string, ComponentStruct<TMsgStruct, T>>;\r\nexport type ComponentRefStruct = {\r\n [name: string]: ComponentStruct | ((params: any) => ComponentStruct);\r\n};\r\n\r\nexport type ComponentStructBase<\r\n TMsgStruct extends MsgStruct = MsgStruct,\r\n TPropStruct extends ComponentPropStruct = ComponentPropStruct,\r\n TMsgScope extends MsgBrokerScope<TMsgStruct> = MsgBrokerScope<TMsgStruct>,\r\n> = {\r\n props?: TPropStruct;\r\n actions?: ComponentMethodStruct;\r\n effects?: string[] | string | undefined;\r\n children?: ComponentRefStruct;\r\n // msgs?\r\n msgScope?: TMsgScope;\r\n};\r\n\r\n// ComponentShape\r\nexport type ComponentStruct<\r\n TMsgStruct extends MsgStruct = MsgStruct,\r\n T extends ComponentStructBase<TMsgStruct> = ComponentStructBase<TMsgStruct>,\r\n> = T & {\r\n msg: TMsgStruct;\r\n};\r\n\r\nexport type MsgBroker<\r\n TStructToProvide extends MsgStruct = MsgStruct,\r\n TStructToSubscribe extends MsgStruct = MsgStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n TScope = any,\r\n> = Require<\r\n {\r\n // providers\r\n provide?: Require<\r\n {\r\n [TChannel in keyof TStructToProvide]: {\r\n [TGroup in keyof Skip<\r\n TStructToProvide[TChannel],\r\n typeof $CG_OUT\r\n >]?: MsgChannelGroupProviderParams<\r\n TStructToProvide,\r\n TChannel,\r\n TGroup,\r\n TMsgHeaders,\r\n TScope\r\n >;\r\n };\r\n },\r\n HasKeys<TStructToProvide>\r\n >;\r\n // subscribers\r\n subscribe?: Require<\r\n {\r\n [TChannel in keyof TStructToSubscribe]: {\r\n [TGroup in keyof TStructToSubscribe[TChannel]]?: MsgChannelGroupSubscriberParams<\r\n TStructToSubscribe,\r\n TChannel,\r\n TGroup,\r\n TMsgHeaders,\r\n TScope\r\n >;\r\n };\r\n },\r\n HasKeys<TStructToSubscribe>\r\n >;\r\n abortController?: AbortController;\r\n },\r\n HasKeys<TStructToProvide & TStructToSubscribe>\r\n>;\r\n\r\nexport type ValueConverter<TTo, TFrom> = {\r\n // ConvertFrom\r\n convert(value: TFrom): TTo;\r\n // ConvertTo\r\n convertBack(value: TTo): TFrom;\r\n};\r\n\r\nexport type ValidationResult = {\r\n valid: boolean;\r\n message: string;\r\n};\r\n\r\nexport type Validator<T> = {\r\n options: {\r\n blur: boolean;\r\n };\r\n validate: (value: T) => MaybePromise<ValidationResult>;\r\n};\r\n\r\nexport const $isBinding = Symbol('$isBinding'); // brand\r\n\r\nexport type Binding<T = any, TFrom = any> = {\r\n // getter\r\n readonly get: () => T;\r\n // setter\r\n readonly set?: (value: T) => void;\r\n readonly converter?: ValueConverter<T, TFrom>;\r\n readonly validator?: Validator<T>;\r\n readonly readOnly?: boolean;\r\n [$isBinding]: boolean;\r\n};\r\n\r\nexport type ComponentPropSource<T> = T | Binding<T>;\r\n\r\nexport type ComponentPropParams<TPropStruct extends ComponentPropStruct> = {\r\n [P in keyof TPropStruct]?: ComponentPropSource<TPropStruct[P]>;\r\n};\r\n\r\n// export const $ON_PROP_CHANGING = \"onPropChanging\" as const;\r\n// export const $ON_PROP_CHANGE = \"onPropChange\" as const;\r\n\r\nexport const $ON_GET = 'onGet' as const;\r\n// export const $ON_BEFORE_SET = \"onBeforeSet\" as const;\r\nexport const $ON_CHANGING = 'onChanging' as const;\r\nexport const $ON_CHANGE = 'onChange' as const;\r\n// export const $ON_SET = \"onSet\" as const;\r\n\r\nexport type PropValueChangingHandler<TProp = PropertyKey> = (\r\n prop: TProp,\r\n oldValue: any,\r\n newValue: any,\r\n) => boolean;\r\n\r\nexport type PropValueChangeHandler<TProp = PropertyKey> = (prop: TProp, value: any) => void;\r\n\r\n// BeforeValueSetHandler\r\nexport type ValueChangingHandler<T = any> = (oldValue: T, newValue: T) => boolean;\r\n// ValueSetHandler\r\nexport type ValueChangeHandler<T = any> = (value: T) => void;\r\n\r\nexport type ComponentEvents<TStruct extends ComponentStruct = ComponentStruct> = {\r\n onPropChanging?: PropValueChangingHandler<keyof TStruct['props']>;\r\n onPropChange?: PropValueChangeHandler<keyof TStruct['props']>;\r\n onInit?: (component: Component<TStruct>) => void;\r\n onLayout?: (component: Component<TStruct>) => void;\r\n onReady?: (component: Component<TStruct>) => void;\r\n onLayoutDestroy?: (component: Component<TStruct>) => void; // onLayoutCleanup\r\n onDestroy?: (component: Component<TStruct>) => void; // onDispose/onCleanup\r\n onError?: (component: Component<TStruct>, error: any) => void;\r\n} & {\r\n [P in keyof TStruct['props'] as `${typeof $ON_GET}${Capitalize<P & string>}`]?: () => TStruct['props'][P];\r\n} & {\r\n [P in keyof TStruct['props'] as `${typeof $ON_CHANGING}${Capitalize<P & string>}`]?: ValueChangingHandler<\r\n TStruct['props']\r\n >;\r\n} & {\r\n [P in keyof TStruct['props'] as `${typeof $ON_CHANGE}${Capitalize<P & string>}`]?: ValueChangeHandler<\r\n TStruct['props']\r\n >;\r\n};\r\n\r\n// AllHTMLAttributes<JSX.Element>\r\n\r\nexport type ComponentViewProps = {\r\n render?: boolean;\r\n} & PropsWithChildren;\r\n\r\n// ComponentRenderImplFn\r\nexport type ComponentViewImplFn<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = (props: ComponentViewProps, component?: Component<TStruct, TMsgHeaders>) => ReactNode; // JSX.Element\r\n\r\n// ComponentRenderFn\r\nexport type ComponentViewFn = (props: ComponentViewProps) => ReactNode; // JSX.Element\r\n\r\nexport type ComponentMsgBroker<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = MsgBroker<\r\n Pick<TStruct['msg'], MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['provide']>>,\r\n Pick<TStruct['msg'], MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['subscribe']>>,\r\n TMsgHeaders,\r\n Component<TStruct, TMsgHeaders>\r\n>;\r\n\r\nexport type EffectFn<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = (component: Component<TStruct, TMsgHeaders>) => void | (() => void);\r\n\r\nexport type ComponentDef<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = {\r\n // typeId\r\n regType?: string;\r\n props?: Require<TStruct['props'], HasKeys<TStruct['props']>>;\r\n actions?: Require<TStruct['actions'], HasKeys<TStruct['actions']>>;\r\n effects?: keyof TStruct['effects'] extends never\r\n ? never\r\n : Record<\r\n TStruct['effects'] extends string ? TStruct['effects'] : TStruct['effects'][number],\r\n EffectFn<TStruct, TMsgHeaders>\r\n >;\r\n children?: ComponentDefChildren<TStruct['children']>;\r\n events?: ComponentEvents<TStruct>;\r\n // msgs?\r\n msgBroker?: ComponentMsgBroker<TStruct, TMsgHeaders>;\r\n msgBus?: MsgBus<TStruct['msg'], TMsgHeaders>;\r\n view?: ComponentViewImplFn<TStruct, TMsgHeaders>;\r\n};\r\n\r\nexport type ComponentDefChildren<TRefStruct extends ComponentRefStruct> = Require<\r\n {\r\n [P in keyof TRefStruct]: TRefStruct[P] extends (params: infer TParams) => infer T\r\n ? T extends ComponentStruct\r\n ? (params: TParams) => Component<T>\r\n : never\r\n : TRefStruct[P] extends ComponentStruct\r\n ? Component<TRefStruct[P]>\r\n : never;\r\n },\r\n HasKeys<TRefStruct>\r\n>;\r\n\r\nexport type ComponentChildren<TRefStruct extends ComponentRefStruct> = {\r\n [P in keyof TRefStruct as TRefStruct[P] extends Function\r\n ? `${Capitalize<P & string>}`\r\n : P]: TRefStruct[P] extends (params: infer TParams) => infer T\r\n ? T extends ComponentStruct\r\n ? FC<ComponentParams<T> & TParams>\r\n : never\r\n : TRefStruct[P] extends ComponentStruct\r\n ? Component<TRefStruct[P]>\r\n : never;\r\n};\r\n\r\nexport type ComponentMsgStruct<TStruct extends ComponentStruct = ComponentStruct> = Pick<\r\n TStruct['msg'],\r\n | MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['provide']>\r\n | MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['subscribe']>\r\n | MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['publish']>\r\n>;\r\n\r\n// style?: CSSProperties;\r\n// classNames?: string[];\r\nexport type ComponentBase<\r\n TStruct extends ComponentStruct = ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = {\r\n id: string;\r\n key: string;\r\n regType: string;\r\n parentId: string;\r\n // getHierarchyPath?\r\n getHierarchyId(): string;\r\n getParent(): string | undefined;\r\n getChildren(): string[];\r\n getChainUp(): string[];\r\n getChainDown(): string[];\r\n getNodeMap(): Map<string, ComponentTreeNode>;\r\n bindings: Map<PropertyKey, Binding>;\r\n msgBus: MsgBus<ComponentMsgStruct<TStruct>, TMsgHeaders>;\r\n msgBroker: ComponentMsgBroker<TStruct>;\r\n effects: Record<string, EffectController>;\r\n View: ComponentViewFn;\r\n};\r\n\r\nexport const $id = Symbol('$id');\r\nexport const $key = Symbol('$key');\r\n\r\nexport type ComponentModel<TStruct extends ComponentStruct = ComponentStruct> = TStruct['props'] &\r\n Readonly<TStruct['actions']> & {\r\n readonly [$id]?: string;\r\n readonly [$key]?: string;\r\n };\r\n\r\nexport type Component<\r\n TStruct extends ComponentStruct = ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = {\r\n readonly model: ComponentModel<TStruct>;\r\n readonly children: Readonly<ComponentChildren<TStruct['children']>>;\r\n} & Readonly<ComponentBase<TStruct, TMsgHeaders>>;\r\n\r\nexport type PropEventHandlers = {\r\n onGet?: () => any;\r\n onChanging?: (oldValue: any, newValue: any) => boolean;\r\n onChange?: (value: any) => void;\r\n};\r\n\r\nexport type ComponentParams<TStruct extends ComponentStruct = ComponentStruct> =\r\n ComponentPropParams<TStruct['props']> &\r\n ComponentEvents<TStruct> & {\r\n [$id]?: string;\r\n [$key]?: string;\r\n }; // & PropsWithChildren?\r\n\r\nexport type EffectController = {\r\n start: () => void;\r\n pause: () => void;\r\n resume: () => void;\r\n stop: () => void;\r\n restart: () => void;\r\n};\r\n"],"names":["ComponentMsgFilter","$isBinding","$ON_GET","$ON_CHANGING","$ON_CHANGE","$id","$key"],"mappings":"AAyCO,IAAKA,sBAAAA,OACRA,EAAAA,EAAA,OAAO,CAAA,IAAP,QAEAA,EAAAA,EAAA,gBAAgB,CAAA,IAAhB,iBACAA,EAAAA,EAAA,kBAAkB,CAAA,IAAlB,mBAJQA,IAAAA,KAAA,CAAA,CAAA;AAyJL,MAAMC,IAAa,OAAO,YAAY,GAsBhCC,IAAU,SAEVC,IAAe,cACfC,IAAa,YAiJbC,IAAM,OAAO,KAAK,GAClBC,IAAO,OAAO,MAAM;"}
|
|
1
|
+
{"version":3,"file":"contracts.es.js","sources":["../../src/componentModel/contracts.tsx"],"sourcesContent":["import {\r\n $CG_IN,\r\n $CG_OUT,\r\n Msg,\r\n MsgBus,\r\n MsgHeaders,\r\n MsgProviderParams,\r\n MsgStruct,\r\n MsgSubParams,\r\n OutStruct,\r\n} from '@actdim/msgmesh/contracts';\r\nimport { HasKeys, MaybeKeyOf, MaybePromise, Require, Skip } from '@actdim/utico/typeCore';\r\nimport { FC, PropsWithChildren, ReactNode } from 'react';\r\n\r\nexport type BaseComponentContext<TMsgStruct extends MsgStruct = MsgStruct> = {\r\n msgBus: MsgBus<TMsgStruct>;\r\n currentId?: string;\r\n};\r\n\r\nexport type ComponentTreeNode = {\r\n id: string;\r\n regType: string;\r\n parentId?: string;\r\n children: Set<string>;\r\n};\r\n\r\n// ComponentContext\r\nexport type ComponentRegistryContext<TMsgStruct extends MsgStruct = MsgStruct> =\r\n BaseComponentContext<TMsgStruct> & {\r\n register: (id: string, regType: string, parentId?: string) => void;\r\n unregister: (id: string) => void;\r\n getParent: (id: string) => string | undefined;\r\n getChildren: (id: string) => string[];\r\n getChainUp: (id: string) => string[];\r\n getChainDown: (id: string) => string[];\r\n getHierarchyPath: (id: string) => string;\r\n getNextId: (regType: string) => string;\r\n getNodeMap: () => Map<string, ComponentTreeNode>;\r\n };\r\n\r\nexport type ComponentMsgHeaders = MsgHeaders & {};\r\n\r\nexport enum ComponentMsgFilter {\r\n None = 0,\r\n // AcceptFrom...\r\n FromAncestors = 1 << 0,\r\n FromDescendants = 1 << 1,\r\n}\r\n\r\nexport type MsgChannelGroupProviderParams<\r\n TStruct extends MsgStruct = MsgStruct,\r\n TChannel extends keyof TStruct = keyof TStruct,\r\n TGroup extends keyof TStruct[TChannel] = typeof $CG_IN, // keyof TStruct[TChannel]\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n TScope = any,\r\n> = Skip<\r\n MsgProviderParams<TStruct, TChannel, TGroup>,\r\n 'channel' | 'group' | 'callback' | 'filter'\r\n> & {\r\n // resolve\r\n callback?: (\r\n msgIn: Msg<TStruct, TChannel, TGroup, TMsgHeaders>,\r\n headers: TMsgHeaders,\r\n scope: TScope,\r\n ) => MaybePromise<OutStruct<TStruct, TChannel>>;\r\n filter?: (msg: Msg<TStruct, TChannel, TGroup, TMsgHeaders>, scope: TScope) => boolean;\r\n componentFilter?: ComponentMsgFilter;\r\n};\r\n\r\nexport type MsgChannelGroupSubscriberParams<\r\n TStruct extends MsgStruct = MsgStruct,\r\n TChannel extends keyof TStruct = keyof TStruct,\r\n TGroup extends keyof TStruct[TChannel] = typeof $CG_IN, // keyof TStruct[TChannel]\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n TScope = any,\r\n> = Skip<MsgSubParams<TStruct, TChannel, TGroup>, 'channel' | 'group' | 'callback' | 'filter'> & {\r\n callback?: (msg: Msg<TStruct, TChannel, TGroup, TMsgHeaders>, scope: TScope) => void;\r\n filter?: (msg: Msg<TStruct, TChannel, TGroup, TMsgHeaders>, scope: TScope) => boolean;\r\n componentFilter?: ComponentMsgFilter;\r\n};\r\n\r\n// MsgScope\r\nexport type MsgBrokerScope<\r\n TStruct extends MsgStruct /*= MsgStruct*/,\r\n TKeysToProvide extends keyof TStruct = keyof TStruct,\r\n TKeysToSubscribe extends keyof TStruct = keyof TStruct,\r\n TKeysToPublish extends keyof TStruct = keyof TStruct,\r\n> = {\r\n provide?: TKeysToProvide;\r\n // consume\r\n subscribe?: TKeysToSubscribe;\r\n // produce\r\n publish?: TKeysToPublish;\r\n};\r\n\r\nexport type ComponentPropStruct = Record<string, any>;\r\n// export type ComponentPropStruct = {\r\n// [prop: string]: any;\r\n// };\r\n\r\nexport type ComponentMethodStruct = Record<string, Function>;\r\n// export type ComponentMethodStruct = {\r\n// [action: string]: Function;\r\n// };\r\n\r\n// export type ComponentRefStruct = Record<string, ComponentStruct<TMsgStruct, T>>;\r\nexport type ComponentRefStruct = {\r\n [name: string]: ComponentStruct | ((params: any) => ComponentStruct);\r\n};\r\n\r\nexport type ComponentStructBase<\r\n TMsgStruct extends MsgStruct = MsgStruct,\r\n TPropStruct extends ComponentPropStruct = ComponentPropStruct,\r\n TMsgScope extends MsgBrokerScope<TMsgStruct> = MsgBrokerScope<TMsgStruct>,\r\n> = {\r\n props?: TPropStruct;\r\n actions?: ComponentMethodStruct;\r\n effects?: string[] | string | undefined;\r\n children?: ComponentRefStruct;\r\n // msgs?\r\n msgScope?: TMsgScope;\r\n};\r\n\r\n// ComponentShape\r\nexport type ComponentStruct<\r\n TMsgStruct extends MsgStruct = MsgStruct,\r\n T extends ComponentStructBase<TMsgStruct> = ComponentStructBase<TMsgStruct>,\r\n> = T & {\r\n msg: TMsgStruct;\r\n};\r\n\r\nexport type MsgBroker<\r\n TStructToProvide extends MsgStruct = MsgStruct,\r\n TStructToSubscribe extends MsgStruct = MsgStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n TScope = any,\r\n> = Require<\r\n {\r\n // providers\r\n provide?: Require<\r\n {\r\n [TChannel in keyof TStructToProvide]: {\r\n [TGroup in keyof Skip<\r\n TStructToProvide[TChannel],\r\n typeof $CG_OUT\r\n >]?: MsgChannelGroupProviderParams<\r\n TStructToProvide,\r\n TChannel,\r\n TGroup,\r\n TMsgHeaders,\r\n TScope\r\n >;\r\n };\r\n },\r\n HasKeys<TStructToProvide>\r\n >;\r\n // subscribers\r\n subscribe?: Require<\r\n {\r\n [TChannel in keyof TStructToSubscribe]: {\r\n [TGroup in keyof TStructToSubscribe[TChannel]]?: MsgChannelGroupSubscriberParams<\r\n TStructToSubscribe,\r\n TChannel,\r\n TGroup,\r\n TMsgHeaders,\r\n TScope\r\n >;\r\n };\r\n },\r\n HasKeys<TStructToSubscribe>\r\n >;\r\n abortController?: AbortController;\r\n },\r\n HasKeys<TStructToProvide & TStructToSubscribe>\r\n>;\r\n\r\nexport type ValueConverter<TTo, TFrom> = {\r\n // ConvertFrom\r\n convert(value: TFrom): TTo;\r\n // ConvertTo\r\n convertBack(value: TTo): TFrom;\r\n};\r\n\r\nexport type ValidationResult = {\r\n valid: boolean;\r\n message: string;\r\n};\r\n\r\nexport type Validator<T> = {\r\n options: {\r\n blur: boolean;\r\n };\r\n validate: (value: T) => MaybePromise<ValidationResult>;\r\n};\r\n\r\nexport const $isBinding = Symbol('$isBinding'); // brand\r\n\r\nexport type Binding<T = any, TFrom = any> = {\r\n // getter\r\n readonly get: () => T;\r\n // setter\r\n readonly set?: (value: T) => void;\r\n readonly converter?: ValueConverter<T, TFrom>;\r\n readonly validator?: Validator<T>;\r\n readonly readOnly?: boolean;\r\n [$isBinding]: boolean;\r\n};\r\n\r\nexport type ComponentPropSource<T> = T | Binding<T>;\r\n\r\nexport type ComponentPropParams<TPropStruct extends ComponentPropStruct> = {\r\n [P in keyof TPropStruct]?: ComponentPropSource<TPropStruct[P]>;\r\n};\r\n\r\n// export const $ON_PROP_CHANGING = \"onPropChanging\" as const;\r\n// export const $ON_PROP_CHANGE = \"onPropChange\" as const;\r\n\r\nexport const $ON_GET = 'onGet' as const;\r\n// export const $ON_BEFORE_SET = \"onBeforeSet\" as const;\r\nexport const $ON_CHANGING = 'onChanging' as const;\r\nexport const $ON_CHANGE = 'onChange' as const;\r\n// export const $ON_SET = \"onSet\" as const;\r\n\r\nexport type PropValueChangingHandler<TProp = PropertyKey> = (\r\n prop: TProp,\r\n oldValue: any,\r\n newValue: any,\r\n) => boolean;\r\n\r\nexport type PropValueChangeHandler<TProp = PropertyKey> = (prop: TProp, value: any) => void;\r\n\r\n// BeforeValueSetHandler\r\nexport type ValueChangingHandler<T = any> = (oldValue: T, newValue: T) => boolean;\r\n// ValueSetHandler\r\nexport type ValueChangeHandler<T = any> = (value: T) => void;\r\n\r\nexport type ComponentEvents<TStruct extends ComponentStruct = ComponentStruct> = {\r\n onPropChanging?: PropValueChangingHandler<keyof TStruct['props']>;\r\n onPropChange?: PropValueChangeHandler<keyof TStruct['props']>;\r\n onInit?: (component: Component<TStruct>) => void;\r\n onLayout?: (component: Component<TStruct>) => void;\r\n onReady?: (component: Component<TStruct>) => void;\r\n onLayoutDestroy?: (component: Component<TStruct>) => void; // onLayoutCleanup\r\n onDestroy?: (component: Component<TStruct>) => void; // onDispose/onCleanup\r\n onError?: (component: Component<TStruct>, error: any) => void;\r\n} & {\r\n [P in keyof TStruct['props'] as `${typeof $ON_GET}${Capitalize<P & string>}`]?: () => TStruct['props'][P];\r\n} & {\r\n [P in keyof TStruct['props'] as `${typeof $ON_CHANGING}${Capitalize<P & string>}`]?: ValueChangingHandler<\r\n TStruct['props']\r\n >;\r\n} & {\r\n [P in keyof TStruct['props'] as `${typeof $ON_CHANGE}${Capitalize<P & string>}`]?: ValueChangeHandler<\r\n TStruct['props']\r\n >;\r\n};\r\n\r\n// AllHTMLAttributes<JSX.Element>\r\n\r\nexport type ComponentViewProps = {\r\n render?: boolean;\r\n} & PropsWithChildren;\r\n\r\n// ComponentRenderImplFn\r\nexport type ComponentViewImplFn<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = (props: ComponentViewProps, component?: Component<TStruct, TMsgHeaders>) => ReactNode; // JSX.Element\r\n\r\n// ComponentRenderFn\r\nexport type ComponentViewFn = (props: ComponentViewProps) => ReactNode; // JSX.Element\r\n\r\nexport type ComponentMsgBroker<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = MsgBroker<\r\n Pick<TStruct['msg'], MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['provide']>>,\r\n Pick<TStruct['msg'], MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['subscribe']>>,\r\n TMsgHeaders,\r\n Component<TStruct, TMsgHeaders>\r\n>;\r\n\r\nexport type EffectFn<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = (component: Component<TStruct, TMsgHeaders>) => void | (() => void);\r\n\r\nexport type ComponentDef<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = {\r\n // typeId\r\n regType?: string;\r\n props?: Require<TStruct['props'], HasKeys<TStruct['props']>>;\r\n actions?: Require<TStruct['actions'], HasKeys<TStruct['actions']>>;\r\n effects?: keyof TStruct['effects'] extends never\r\n ? never\r\n : Record<\r\n TStruct['effects'] extends string ? TStruct['effects'] : TStruct['effects'][number],\r\n EffectFn<TStruct, TMsgHeaders>\r\n >;\r\n children?: ComponentDefChildren<TStruct['children']>;\r\n events?: ComponentEvents<TStruct>;\r\n // msgs?\r\n msgBroker?: ComponentMsgBroker<TStruct, TMsgHeaders>;\r\n msgBus?: MsgBus<TStruct['msg'], TMsgHeaders>;\r\n view?: ComponentViewImplFn<TStruct, TMsgHeaders>;\r\n};\r\n\r\nexport type ComponentDefChildren<TRefStruct extends ComponentRefStruct> = Require<\r\n {\r\n [P in keyof TRefStruct]: TRefStruct[P] extends (params: infer TParams) => infer T\r\n ? T extends ComponentStruct\r\n ? (params: TParams) => Component<T>\r\n : never\r\n : TRefStruct[P] extends ComponentStruct\r\n ? Component<TRefStruct[P]>\r\n : never;\r\n },\r\n HasKeys<TRefStruct>\r\n>;\r\n\r\nexport type ComponentChildren<TRefStruct extends ComponentRefStruct> = {\r\n [P in keyof TRefStruct as TRefStruct[P] extends Function\r\n ? `${Capitalize<P & string>}`\r\n : P]: TRefStruct[P] extends (params: infer TParams) => infer T\r\n ? T extends ComponentStruct\r\n ? FC<ComponentParams<T> & TParams>\r\n : never\r\n : TRefStruct[P] extends ComponentStruct\r\n ? Component<TRefStruct[P]>\r\n : never;\r\n};\r\n\r\nexport type ComponentMsgStruct<TStruct extends ComponentStruct = ComponentStruct> = Pick<\r\n TStruct['msg'],\r\n | MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['provide']>\r\n | MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['subscribe']>\r\n | MaybeKeyOf<TStruct['msg'], TStruct['msgScope']['publish']>\r\n>;\r\n\r\n// style?: CSSProperties;\r\n// classNames?: string[];\r\nexport type ComponentBase<\r\n TStruct extends ComponentStruct = ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = {\r\n id: string;\r\n key: string;\r\n regType: string;\r\n parentId: string;\r\n // getHierarchyPath?\r\n getHierarchyId(): string;\r\n getParent(): string | undefined;\r\n getChildren(): string[];\r\n getChainUp(): string[];\r\n getChainDown(): string[];\r\n getNodeMap(): Map<string, ComponentTreeNode>;\r\n bindings: Map<PropertyKey, Binding>;\r\n msgBus: MsgBus<ComponentMsgStruct<TStruct>, TMsgHeaders>;\r\n msgBroker: ComponentMsgBroker<TStruct>;\r\n effects: Record<string, EffectController>;\r\n View: ComponentViewFn;\r\n};\r\n\r\nexport const $id = Symbol('$id');\r\nexport const $key = Symbol('$key');\r\n\r\nexport type ComponentModel<TStruct extends ComponentStruct = ComponentStruct> = TStruct['props'] &\r\n Readonly<TStruct['actions']> & {\r\n readonly [$id]?: string;\r\n readonly [$key]?: string;\r\n };\r\n\r\nexport type Component<\r\n TStruct extends ComponentStruct = ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n> = {\r\n readonly model: ComponentModel<TStruct>;\r\n readonly children: Readonly<ComponentChildren<TStruct['children']>>;\r\n} & Readonly<ComponentBase<TStruct, TMsgHeaders>>;\r\n\r\nexport type PropEventHandlers = {\r\n onGet?: () => any;\r\n onChanging?: (oldValue: any, newValue: any) => boolean;\r\n onChange?: (value: any) => void;\r\n};\r\n\r\nexport type ComponentParams<TStruct extends ComponentStruct = ComponentStruct> =\r\n ComponentPropParams<TStruct['props']> &\r\n ComponentEvents<TStruct> & {\r\n [$id]?: string;\r\n [$key]?: string;\r\n }; // & PropsWithChildren?\r\n\r\nexport type EffectController = {\r\n start: () => void;\r\n pause: () => void;\r\n resume: () => void;\r\n stop: () => void;\r\n restart: () => void;\r\n};\r\n"],"names":["ComponentMsgFilter","$isBinding","$ON_GET","$ON_CHANGING","$ON_CHANGE","$id","$key"],"mappings":"AA0CO,IAAKA,sBAAAA,OACRA,EAAAA,EAAA,OAAO,CAAA,IAAP,QAEAA,EAAAA,EAAA,gBAAgB,CAAA,IAAhB,iBACAA,EAAAA,EAAA,kBAAkB,CAAA,IAAlB,mBAJQA,IAAAA,KAAA,CAAA,CAAA;AAyJL,MAAMC,IAAa,OAAO,YAAY,GAsBhCC,IAAU,SAEVC,IAAe,cACfC,IAAa,YAiJbC,IAAM,OAAO,KAAK,GAClBC,IAAO,OAAO,MAAM;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/componentModel/react.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAiD,EAAE,EAAW,MAAM,OAAO,CAAC;AAO1F,OAAO,EAIH,SAAS,EAET,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EAOlB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/componentModel/react.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAiD,EAAE,EAAW,MAAM,OAAO,CAAC;AAO1F,OAAO,EAIH,SAAS,EAET,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EAOlB,MAAM,aAAa,CAAC;AAwWrB,wBAAgB,YAAY,CACxB,OAAO,SAAS,eAAe,GAAG,eAAe,EACjD,WAAW,SAAS,mBAAmB,GAAG,mBAAmB,EAC/D,YAAY,EAAE,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,OAQnF;AAGD,wBAAgB,KAAK,CAAC,OAAO,SAAS,eAAe,EACjD,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC,GAClE,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAS9B"}
|
|
@@ -1,69 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { observer as
|
|
3
|
-
import { observable as
|
|
4
|
-
import { useLazyRef as
|
|
5
|
-
import { getGlobalFlags as
|
|
6
|
-
import { useComponentContext as
|
|
7
|
-
import { $id as
|
|
8
|
-
import { lazy as
|
|
9
|
-
import { getComponentSourceByCaller as
|
|
10
|
-
function
|
|
1
|
+
import u, { useLayoutEffect as w, useEffect as x, useMemo as G } from "react";
|
|
2
|
+
import { observer as S } from "mobx-react-lite";
|
|
3
|
+
import { observable as P } from "mobx";
|
|
4
|
+
import { useLazyRef as F } from "../reactHooks.es.js";
|
|
5
|
+
import { getGlobalFlags as f } from "../globals.es.js";
|
|
6
|
+
import { useComponentContext as L, ReactComponentContext as z } from "./componentContext.es.js";
|
|
7
|
+
import { $id as H, $key as O, $ON_CHANGE as U, $ON_CHANGING as A, $ON_GET as T } from "./contracts.es.js";
|
|
8
|
+
import { lazy as _ } from "@actdim/utico/utils";
|
|
9
|
+
import { getComponentSourceByCaller as J, getComponentMsgBus as V, toHtmlId as q, registerMsgBroker as K, isBinding as Q, createRecursiveProxy as W, createEffect as X } from "./core.es.js";
|
|
10
|
+
function a(e) {
|
|
11
11
|
return e.replace(/^./, e[0].toUpperCase());
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function Y(e) {
|
|
14
14
|
return e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^\/]+/, "");
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
let t,
|
|
16
|
+
function Z(e, o) {
|
|
17
|
+
let t, l;
|
|
18
18
|
e || (e = {});
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
let
|
|
23
|
-
const
|
|
19
|
+
let d = e.regType;
|
|
20
|
+
d || (d = J(6), d = Y(d)), o || (o = {});
|
|
21
|
+
const I = e.view;
|
|
22
|
+
let C = e.msgBus;
|
|
23
|
+
const v = /* @__PURE__ */ new Map(), B = _(() => V(C, (n) => {
|
|
24
24
|
n?.sourceId == null && (n.sourceId = t.id);
|
|
25
25
|
}));
|
|
26
|
-
let
|
|
26
|
+
let h = {
|
|
27
27
|
...e.msgBroker
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const r =
|
|
32
|
-
t.parentId =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
).length + 1).toString()), u = `${i}#${y}`;
|
|
29
|
+
h.abortController || (h.abortController = new AbortController());
|
|
30
|
+
const N = S((n) => {
|
|
31
|
+
const r = L(), g = r.currentId;
|
|
32
|
+
if (t.parentId = g, C || (C = r.msgBus), !t.id) {
|
|
33
|
+
let i = o[H];
|
|
34
|
+
if (!i) {
|
|
35
|
+
const y = o[O];
|
|
36
|
+
y ? i = `${q(d)}#${y}` : i = r.getNextId(d);
|
|
37
|
+
}
|
|
38
|
+
t.id = i, t.getHierarchyId = () => r.getHierarchyPath(i), t.getChainDown = () => r.getChainDown(i), t.getChainUp = () => r.getChainUp(i), t.getChildren = () => r.getChildren(i), t.getParent = () => r.getParent(i), t.getNodeMap = () => r.getNodeMap();
|
|
40
39
|
}
|
|
41
|
-
|
|
40
|
+
w(() => {
|
|
42
41
|
try {
|
|
43
|
-
if (r.register(
|
|
42
|
+
if (r.register(t.id, d, g), f().debug) {
|
|
44
43
|
const i = t.getHierarchyId();
|
|
45
44
|
console.debug(`${i}>layout`);
|
|
46
45
|
}
|
|
47
|
-
|
|
46
|
+
K(t), e.events?.onLayout?.(t), o.onLayout?.(t);
|
|
48
47
|
} catch (i) {
|
|
49
48
|
e.events?.onError?.(t, i), o.onError?.(t, i);
|
|
50
49
|
}
|
|
51
50
|
return () => {
|
|
52
|
-
if (
|
|
51
|
+
if (f().debug) {
|
|
53
52
|
const i = t.getHierarchyId();
|
|
54
53
|
console.debug(`${i}>layout-destroy`);
|
|
55
54
|
}
|
|
56
|
-
r.unregister(t.id),
|
|
55
|
+
r.unregister(t.id), h.abortController?.abort(), e.events?.onLayoutDestroy?.(t), o.onLayoutDestroy?.(t);
|
|
57
56
|
};
|
|
58
|
-
}, [e, o, r]),
|
|
57
|
+
}, [e, o, r]), x(() => {
|
|
59
58
|
try {
|
|
60
|
-
if (
|
|
59
|
+
if (f().debug) {
|
|
61
60
|
const i = t.getHierarchyId();
|
|
62
61
|
console.debug(`${i}>ready`);
|
|
63
62
|
}
|
|
64
63
|
e.events?.onReady?.(t), o.onReady?.(t);
|
|
65
64
|
} catch (i) {
|
|
66
|
-
if (
|
|
65
|
+
if (f().debug) {
|
|
67
66
|
const y = t.getHierarchyId();
|
|
68
67
|
console.debug(`${y}>destroy`);
|
|
69
68
|
}
|
|
@@ -73,83 +72,83 @@ function re(e, o) {
|
|
|
73
72
|
e.events?.onDestroy?.(t), o.onDestroy?.(t);
|
|
74
73
|
};
|
|
75
74
|
}, [e, o, r]);
|
|
76
|
-
let
|
|
75
|
+
let s;
|
|
77
76
|
try {
|
|
78
|
-
if (
|
|
77
|
+
if (f().debug) {
|
|
79
78
|
const i = t.getHierarchyId();
|
|
80
79
|
console.debug(`${i}>view`);
|
|
81
80
|
}
|
|
82
|
-
typeof
|
|
81
|
+
typeof I == "function" ? s = I(n, t) : s = /* @__PURE__ */ u.createElement(u.Fragment, null, n.children);
|
|
83
82
|
} catch (i) {
|
|
84
83
|
const y = JSON.stringify(i);
|
|
85
|
-
|
|
84
|
+
s = /* @__PURE__ */ u.createElement(u.Fragment, null, y);
|
|
86
85
|
}
|
|
87
|
-
const
|
|
86
|
+
const c = G(
|
|
88
87
|
() => ({ ...r, currentId: t.id }),
|
|
89
88
|
[e, o, r]
|
|
90
89
|
);
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
}),
|
|
93
|
-
if (
|
|
90
|
+
return /* @__PURE__ */ u.createElement(z.Provider, { value: c }, s);
|
|
91
|
+
}), b = {};
|
|
92
|
+
if (l = {}, e.props && Object.assign(l, e.props), e.actions && Object.assign(l, e.actions), e.children)
|
|
94
93
|
for (const [n, r] of Object.entries(e.children))
|
|
95
94
|
if (typeof r == "function") {
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
return /* @__PURE__ */
|
|
95
|
+
const g = r, s = (c) => {
|
|
96
|
+
const i = g(c);
|
|
97
|
+
return /* @__PURE__ */ u.createElement(i.View, null);
|
|
99
98
|
};
|
|
100
|
-
Reflect.set(
|
|
99
|
+
Reflect.set(b, a(n), s);
|
|
101
100
|
} else
|
|
102
|
-
Reflect.set(
|
|
101
|
+
Reflect.set(b, n, r);
|
|
103
102
|
for (const [n, r] of Object.entries(o))
|
|
104
|
-
n in
|
|
105
|
-
const
|
|
106
|
-
onPropChanging: o.onPropChanging || e.events?.onPropChanging ? (n, r,
|
|
107
|
-
let
|
|
108
|
-
return
|
|
103
|
+
n in l && (Q(r) ? v.set(n, r) : Reflect.set(l, n, r));
|
|
104
|
+
const E = {
|
|
105
|
+
onPropChanging: o.onPropChanging || e.events?.onPropChanging ? (n, r, g) => {
|
|
106
|
+
let s = !0, c = o.onPropChanging;
|
|
107
|
+
return c && (s = c(String(n), r, g)), s && (c = e.events?.onPropChanging, c && (s = c(String(n), r, g))), s;
|
|
109
108
|
} : void 0,
|
|
110
109
|
onPropChange: o.onPropChange || e.events?.onPropChange ? (n, r) => {
|
|
111
110
|
o.onPropChange?.(String(n), r), e.events?.onPropChange?.(String(n), r);
|
|
112
111
|
} : void 0
|
|
113
112
|
};
|
|
114
|
-
function
|
|
115
|
-
const r = `${
|
|
113
|
+
function R(n) {
|
|
114
|
+
const r = `${T}${a(n)}`;
|
|
116
115
|
return o[r] || e.events?.[r];
|
|
117
116
|
}
|
|
118
|
-
function
|
|
119
|
-
const r = `${
|
|
120
|
-
return ((
|
|
121
|
-
let
|
|
122
|
-
return
|
|
117
|
+
function M(n) {
|
|
118
|
+
const r = `${A}${a(n)}`;
|
|
119
|
+
return ((g, s) => {
|
|
120
|
+
let c = !0, i = o[r];
|
|
121
|
+
return i && (c = i(g, s)), c && (i = e.events?.[r], i && (c = i(g, s))), c;
|
|
123
122
|
});
|
|
124
123
|
}
|
|
125
|
-
function
|
|
126
|
-
const r = `${
|
|
127
|
-
return ((
|
|
128
|
-
o[r]?.(
|
|
124
|
+
function j(n) {
|
|
125
|
+
const r = `${U}${a(n)}`;
|
|
126
|
+
return ((g) => {
|
|
127
|
+
o[r]?.(g), e.events?.[r]?.(g);
|
|
129
128
|
});
|
|
130
129
|
}
|
|
131
|
-
let
|
|
130
|
+
let $ = {};
|
|
132
131
|
if (e.props) {
|
|
133
132
|
for (const n of Object.keys(e.props))
|
|
134
|
-
|
|
135
|
-
onGet:
|
|
136
|
-
onChanging:
|
|
137
|
-
onChange:
|
|
133
|
+
E[n] = {
|
|
134
|
+
onGet: R(n),
|
|
135
|
+
onChanging: M(n),
|
|
136
|
+
onChange: j(n)
|
|
138
137
|
};
|
|
139
138
|
for (const n of Object.keys(e.props))
|
|
140
|
-
|
|
139
|
+
$[n] = P.deep;
|
|
141
140
|
}
|
|
142
141
|
if (e.actions)
|
|
143
142
|
for (const n of Object.keys(e.actions))
|
|
144
143
|
;
|
|
145
|
-
|
|
144
|
+
l = P(l, $, {
|
|
146
145
|
deep: !0
|
|
147
|
-
}),
|
|
148
|
-
let
|
|
146
|
+
}), l = W(l, v, E);
|
|
147
|
+
let k = {};
|
|
149
148
|
if (t = {
|
|
150
|
-
id: o[
|
|
151
|
-
key: o[
|
|
152
|
-
regType:
|
|
149
|
+
id: o[H],
|
|
150
|
+
key: o[O],
|
|
151
|
+
regType: d,
|
|
153
152
|
parentId: void 0,
|
|
154
153
|
getHierarchyId: () => {
|
|
155
154
|
},
|
|
@@ -163,39 +162,39 @@ function re(e, o) {
|
|
|
163
162
|
},
|
|
164
163
|
getNodeMap: () => {
|
|
165
164
|
},
|
|
166
|
-
bindings:
|
|
165
|
+
bindings: v,
|
|
167
166
|
get msgBus() {
|
|
168
|
-
return
|
|
167
|
+
return B();
|
|
169
168
|
},
|
|
170
|
-
msgBroker:
|
|
171
|
-
effects:
|
|
169
|
+
msgBroker: h,
|
|
170
|
+
effects: k,
|
|
172
171
|
// view: componentDef.view,
|
|
173
|
-
View:
|
|
174
|
-
children:
|
|
175
|
-
model:
|
|
172
|
+
View: N,
|
|
173
|
+
children: b,
|
|
174
|
+
model: l
|
|
176
175
|
}, e.effects)
|
|
177
176
|
for (const [n, r] of Object.entries(e.effects))
|
|
178
|
-
|
|
177
|
+
k[n] = X(
|
|
179
178
|
t,
|
|
180
179
|
n,
|
|
181
180
|
r
|
|
182
181
|
);
|
|
183
182
|
return e.events?.onInit && e.events.onInit(t), o.onInit && o.onInit(t), t;
|
|
184
183
|
}
|
|
185
|
-
function
|
|
186
|
-
const t =
|
|
187
|
-
return
|
|
184
|
+
function se(e, o) {
|
|
185
|
+
const t = F(() => Z(e, o));
|
|
186
|
+
return w(() => () => {
|
|
188
187
|
t.current = null;
|
|
189
|
-
}, [
|
|
188
|
+
}, []), t.current;
|
|
190
189
|
}
|
|
191
|
-
function
|
|
190
|
+
function ce(e) {
|
|
192
191
|
return (t) => {
|
|
193
|
-
const
|
|
194
|
-
return /* @__PURE__ */
|
|
192
|
+
const l = e(t);
|
|
193
|
+
return /* @__PURE__ */ u.createElement(l.View, { ...t });
|
|
195
194
|
};
|
|
196
195
|
}
|
|
197
196
|
export {
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
ce as getFC,
|
|
198
|
+
se as useComponent
|
|
200
199
|
};
|
|
201
200
|
//# sourceMappingURL=react.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.es.js","sources":["../../src/componentModel/react.tsx"],"sourcesContent":["import React, { PropsWithChildren, useEffect, useLayoutEffect, FC, useMemo } from 'react';\r\nimport { Mutable } from '@actdim/utico/typeCore';\r\nimport { observer } from 'mobx-react-lite';\r\nimport { action, observable } from 'mobx';\r\nimport { useLazyRef } from '@/reactHooks';\r\nimport { getGlobalFlags } from '@/globals';\r\nimport { ReactComponentContext, useComponentContext } from './componentContext';\r\nimport {\r\n $id,\r\n $key,\r\n Binding,\r\n Component,\r\n ComponentChildren,\r\n ComponentDef,\r\n ComponentModel,\r\n ComponentMsgHeaders,\r\n ComponentParams,\r\n ComponentStruct,\r\n ComponentViewImplFn,\r\n ComponentViewProps,\r\n EffectController,\r\n EffectFn,\r\n ValueChangeHandler,\r\n ValueChangingHandler,\r\n} from './contracts';\r\nimport { $ON_CHANGE, $ON_CHANGING, $ON_GET, $isBinding, ComponentMsgFilter } from './contracts';\r\nimport { lazy } from '@actdim/utico/utils';\r\nimport {\r\n createEffect,\r\n createRecursiveProxy,\r\n getComponentSourceByCaller,\r\n getComponentMsgBus,\r\n isBinding,\r\n ProxyEventHandlers,\r\n registerMsgBroker,\r\n toHtmlId,\r\n} from './core';\r\n\r\nfunction capitalize(name: string) {\r\n return name.replace(/^./, name[0].toUpperCase());\r\n}\r\n\r\nfunction cleanSourceRef(sourceRef: string) {\r\n // remove origin\r\n return sourceRef.replace(/^[a-z][a-z0-9+.-]*:\\/\\/[^\\/]+/, '');\r\n}\r\n\r\nfunction createComponent<TStruct extends ComponentStruct = ComponentStruct>(\r\n componentDef: ComponentDef<TStruct>,\r\n params?: ComponentParams<TStruct>,\r\n): Component<TStruct> {\r\n // result\r\n let component: Mutable<Component<TStruct>>;\r\n let model: Mutable<ComponentModel<TStruct>>;\r\n\r\n if (!componentDef) {\r\n componentDef = {};\r\n }\r\n\r\n let type = componentDef.regType;\r\n if (!type) {\r\n type = getComponentSourceByCaller(6);\r\n // type = getComponentNameByCaller(6);\r\n type = cleanSourceRef(type);\r\n // throw new Error('Valid component definition is required');\r\n }\r\n\r\n if (!params) {\r\n params = {};\r\n }\r\n\r\n const view = componentDef.view;\r\n let msgBus = componentDef.msgBus;\r\n\r\n const bindings = new Map<PropertyKey, Binding>();\r\n\r\n const componentMsgBus = lazy(() => {\r\n return getComponentMsgBus(msgBus, (headers) => {\r\n if (headers?.sourceId == undefined) {\r\n headers.sourceId = component.id;\r\n }\r\n }); // as ComponentModel<TStruct>['msgBus']\r\n });\r\n\r\n let msgBroker = {\r\n ...componentDef.msgBroker,\r\n };\r\n\r\n if (!msgBroker.abortController) {\r\n msgBroker.abortController = new AbortController();\r\n }\r\n\r\n const ViewFC = observer((props: ComponentViewProps) => {\r\n const context = useComponentContext();\r\n const parentId = context.currentId;\r\n\r\n component.parentId = parentId;\r\n\r\n if (!msgBus) {\r\n msgBus = context.msgBus;\r\n }\r\n\r\n const nodeMap = context.getNodeMap();\r\n\r\n const getChildNodes = (id: string) => {\r\n const childIds = context.getChildren(id);\r\n return childIds.map((childId) => nodeMap.get(childId));\r\n };\r\n\r\n const childNodes = getChildNodes(parentId);\r\n let id = params[$id];\r\n if (!id) {\r\n let name = toHtmlId(type);\r\n let key = params[$key];\r\n if (!key) {\r\n const componentCount = childNodes.filter(\r\n (node) => node.regType === componentDef.regType,\r\n ).length;\r\n key = (componentCount + 1).toString();\r\n }\r\n id = `${name}#${key}`;\r\n }\r\n\r\n component.id = id;\r\n component.getHierarchyId = () => context.getHierarchyPath(id);\r\n component.getChainDown = () => context.getChainDown(id);\r\n component.getChainUp = () => context.getChainUp(id);\r\n component.getChildren = () => context.getChildren(id);\r\n component.getParent = () => context.getParent(id);\r\n component.getNodeMap = () => context.getNodeMap();\r\n\r\n useLayoutEffect(() => {\r\n try {\r\n context.register(id, componentDef.regType, parentId);\r\n\r\n if (getGlobalFlags().debug) {\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>layout`);\r\n }\r\n\r\n registerMsgBroker(component);\r\n\r\n componentDef.events?.onLayout?.(component);\r\n params.onLayout?.(component);\r\n } catch (err) {\r\n componentDef.events?.onError?.(component, err);\r\n params.onError?.(component, err);\r\n }\r\n\r\n return () => {\r\n if (getGlobalFlags().debug) {\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>layout-destroy`);\r\n }\r\n context.unregister(component.id);\r\n\r\n msgBroker.abortController?.abort();\r\n\r\n componentDef.events?.onLayoutDestroy?.(component);\r\n params.onLayoutDestroy?.(component);\r\n };\r\n }, [componentDef, params, context]);\r\n\r\n useEffect(() => {\r\n try {\r\n if (getGlobalFlags().debug) {\r\n // mount\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>ready`);\r\n }\r\n componentDef.events?.onReady?.(component);\r\n params.onReady?.(component);\r\n } catch (err) {\r\n if (getGlobalFlags().debug) {\r\n // unmount\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>destroy`);\r\n }\r\n componentDef.events?.onError?.(component, err);\r\n params.onError?.(component, err);\r\n }\r\n return () => {\r\n componentDef.events?.onDestroy?.(component);\r\n params.onDestroy?.(component);\r\n };\r\n }, [componentDef, params, context]);\r\n\r\n let content: React.ReactNode;\r\n // let content: any;\r\n try {\r\n if (getGlobalFlags().debug) {\r\n // render\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>view`);\r\n }\r\n if (typeof view === 'function') {\r\n content = view(props, component);\r\n } else {\r\n // content = props.children;\r\n content = <>{props.children}</>;\r\n }\r\n } catch (err) {\r\n // throw err;\r\n const errDetails = JSON.stringify(err);\r\n // msgBus.send\r\n content = <>{errDetails}</>;\r\n }\r\n const scopeContext = useMemo(\r\n () => ({ ...context, currentId: component.id }),\r\n [componentDef, params, context],\r\n );\r\n return (\r\n <ReactComponentContext.Provider value={scopeContext}>\r\n {content}\r\n </ReactComponentContext.Provider>\r\n );\r\n });\r\n\r\n const children = {} as ComponentChildren<TStruct['children']>;\r\n\r\n model = {} as Mutable<ComponentModel<TStruct>>;\r\n\r\n if (componentDef.props) {\r\n Object.assign(model, componentDef.props);\r\n }\r\n\r\n if (componentDef.actions) {\r\n Object.assign(model, componentDef.actions);\r\n }\r\n\r\n if (componentDef.children) {\r\n for (const [key, value] of Object.entries(componentDef.children)) {\r\n if (typeof value == 'function') {\r\n const view = value as (params: any) => Component;\r\n // observer\r\n const ChildViewFC: ComponentViewImplFn<TStruct> = (props) => {\r\n const c = view(props);\r\n return <c.View />;\r\n // if (typeof c.view === \"function\") {\r\n // return c.view(props);\r\n // }\r\n // return <>{props.children}</>;\r\n };\r\n Reflect.set(children, capitalize(key), ChildViewFC);\r\n } else {\r\n Reflect.set(children, key, value);\r\n }\r\n }\r\n }\r\n\r\n // Reflect.ownKeys/Object.keys\r\n for (const [key, value] of Object.entries(params)) {\r\n // model.hasOwnProperty(key)\r\n if (key in model) {\r\n if (isBinding(value)) {\r\n bindings.set(key, value);\r\n } else {\r\n Reflect.set(model, key, value);\r\n }\r\n }\r\n }\r\n\r\n const proxyEventHandlers: Pick<ProxyEventHandlers, 'onPropChanging' | 'onPropChange'> = {\r\n onPropChanging:\r\n params.onPropChanging || componentDef.events?.onPropChanging\r\n ? (prop, oldValue, newValue) => {\r\n let result = true;\r\n let handler = params.onPropChanging;\r\n if (handler) {\r\n result = handler(String(prop), oldValue, newValue);\r\n }\r\n if (result) {\r\n handler = componentDef.events?.onPropChanging;\r\n if (handler) {\r\n result = handler(String(prop), oldValue, newValue);\r\n }\r\n }\r\n return result;\r\n }\r\n : undefined,\r\n onPropChange:\r\n params.onPropChange || componentDef.events?.onPropChange\r\n ? (prop, value) => {\r\n params.onPropChange?.(String(prop), value);\r\n componentDef.events?.onPropChange?.(String(prop), value);\r\n }\r\n : undefined,\r\n };\r\n\r\n function resolveOnGetEventHandler(prop: string) {\r\n const key = `${$ON_GET}${capitalize(prop)}`;\r\n return params[key] || componentDef.events?.[key];\r\n }\r\n\r\n function resolveOnChangingEventHandler(prop: string) {\r\n const key = `${$ON_CHANGING}${capitalize(prop)}`;\r\n return ((oldValue: any, newValue: any) => {\r\n let result = true;\r\n let handler = params[key] as ValueChangingHandler<any>;\r\n if (handler) {\r\n result = handler(oldValue, newValue);\r\n }\r\n if (result) {\r\n handler = componentDef.events?.[key] as ValueChangingHandler<any>;\r\n if (handler) {\r\n result = handler(oldValue, newValue);\r\n }\r\n }\r\n return result;\r\n }) as ValueChangingHandler;\r\n }\r\n\r\n function resolveOnChangeEventHandler(prop: string) {\r\n const key = `${$ON_CHANGE}${capitalize(prop)}`;\r\n return ((value: any) => {\r\n (params[key] as ValueChangeHandler<any>)?.(value);\r\n (componentDef.events?.[key] as ValueChangeHandler<any>)?.(value);\r\n }) as ValueChangeHandler;\r\n }\r\n\r\n let annotationMap: Record<string, any> = {};\r\n\r\n if (componentDef.props) {\r\n for (const prop of Object.keys(componentDef.props)) {\r\n proxyEventHandlers[prop] = {\r\n onGet: resolveOnGetEventHandler(prop),\r\n onChanging: resolveOnChangingEventHandler(prop),\r\n onChange: resolveOnChangeEventHandler(prop),\r\n };\r\n }\r\n\r\n for (const key of Object.keys(componentDef.props)) {\r\n annotationMap[key] = observable.deep;\r\n }\r\n }\r\n\r\n if (componentDef.actions) {\r\n const annotationMap: Record<string, any> = {};\r\n for (const key of Object.keys(componentDef.actions)) {\r\n annotationMap[key] = action;\r\n }\r\n }\r\n\r\n model = observable(model, annotationMap, {\r\n deep: true,\r\n });\r\n\r\n model = createRecursiveProxy(model, bindings, proxyEventHandlers);\r\n\r\n let effects: Record<string, EffectController> = {};\r\n component = {\r\n id: params[$id],\r\n key: params[$key],\r\n regType: type,\r\n parentId: undefined,\r\n getHierarchyId: () => undefined,\r\n getChainDown: () => undefined,\r\n getChainUp: () => undefined,\r\n getChildren: () => undefined,\r\n getParent: () => undefined,\r\n getNodeMap: () => undefined,\r\n bindings: bindings,\r\n get msgBus() {\r\n return componentMsgBus();\r\n },\r\n msgBroker: msgBroker,\r\n effects: effects,\r\n // view: componentDef.view,\r\n View: ViewFC,\r\n children: children,\r\n model: model,\r\n };\r\n\r\n if (componentDef.effects) {\r\n for (const [name, fn] of Object.entries(componentDef.effects)) {\r\n effects[name] = createEffect(\r\n component,\r\n name,\r\n fn as EffectFn<TStruct, ComponentMsgHeaders>,\r\n );\r\n }\r\n }\r\n\r\n if (componentDef.events?.onInit) {\r\n componentDef.events.onInit(component);\r\n }\r\n\r\n if (params.onInit) {\r\n params.onInit(component);\r\n }\r\n\r\n return component;\r\n}\r\n\r\nexport function useComponent<\r\n TStruct extends ComponentStruct = ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n>(componentDef: ComponentDef<TStruct, TMsgHeaders>, params: ComponentParams<TStruct>) {\r\n const ref = useLazyRef(() => createComponent(componentDef, params));\r\n useLayoutEffect(() => {\r\n return () => {\r\n ref.current = null;\r\n };\r\n }, [componentDef, params]);\r\n return ref.current;\r\n}\r\n\r\n// asFC/toFC\r\nexport function getFC<TStruct extends ComponentStruct>(\r\n factory: (params: ComponentParams<TStruct>) => Component<TStruct>,\r\n): FC<ComponentParams<TStruct>> {\r\n // observer\r\n const fc = (params: ComponentParams<TStruct> & PropsWithChildren) => {\r\n // componentHook\r\n const c = factory(params); // without useRef!\r\n // return c.view();\r\n return <c.View {...params} />;\r\n };\r\n return fc;\r\n}\r\n"],"names":["capitalize","name","cleanSourceRef","sourceRef","createComponent","componentDef","params","component","model","type","getComponentSourceByCaller","view","msgBus","bindings","componentMsgBus","lazy","getComponentMsgBus","headers","msgBroker","ViewFC","observer","props","context","useComponentContext","parentId","nodeMap","childNodes","id","childId","$id","toHtmlId","key","$key","node","useLayoutEffect","getGlobalFlags","hierarchyId","registerMsgBroker","err","useEffect","content","React","errDetails","scopeContext","useMemo","ReactComponentContext","children","value","ChildViewFC","c","isBinding","proxyEventHandlers","prop","oldValue","newValue","result","handler","resolveOnGetEventHandler","$ON_GET","resolveOnChangingEventHandler","$ON_CHANGING","resolveOnChangeEventHandler","$ON_CHANGE","annotationMap","observable","createRecursiveProxy","effects","fn","createEffect","useComponent","ref","useLazyRef","getFC","factory"],"mappings":";;;;;;;;;AAsCA,SAASA,EAAWC,GAAc;AAC9B,SAAOA,EAAK,QAAQ,MAAMA,EAAK,CAAC,EAAE,aAAa;AACnD;AAEA,SAASC,GAAeC,GAAmB;AAEvC,SAAOA,EAAU,QAAQ,iCAAiC,EAAE;AAChE;A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A;AAAA,IAChB,cAAc,MAAA;AAAA;AAAA,IACd,YAAY,MAAA;AAAA;AAAA,IACZ,aAAa,MAAA;AAAA;AAAA,IACb,WAAW,MAAA;AAAA;AAAA,IACX,YAAY,MAAA;AAAA;AAAA,IACZ,UAAAI;AAAA,IACA,IAAI,SAAS;AACT,aAAOC,EAAA;AAAA,IACX;AAAA,IACA,WAAAI;AAAA,IACA,SAAAgD;AAAA;AAAA,IAEA,MAAM/C;AAAA,IACN,UAAA2B;AAAA,IACA,OAAAtC;AAAA,EAAA,GAGAH,EAAa;AACb,eAAW,CAACJ,GAAMkE,CAAE,KAAK,OAAO,QAAQ9D,EAAa,OAAO;AACxD,MAAA6D,EAAQjE,CAAI,IAAImE;AAAA,QACZ7D;AAAA,QACAN;AAAA,QACAkE;AAAA,MAAA;AAKZ,SAAI9D,EAAa,QAAQ,UACrBA,EAAa,OAAO,OAAOE,CAAS,GAGpCD,EAAO,UACPA,EAAO,OAAOC,CAAS,GAGpBA;AACX;AAEO,SAAS8D,GAGdhE,GAAkDC,GAAkC;AAClF,QAAMgE,IAAMC,EAAW,MAAMnE,GAAgBC,GAAcC,CAAM,CAAC;AAClE,SAAA4B,EAAgB,MACL,MAAM;AACT,IAAAoC,EAAI,UAAU;AAAA,EAClB,GACD,CAACjE,GAAcC,CAAM,CAAC,GAClBgE,EAAI;AACf;AAGO,SAASE,GACZC,GAC4B;AAQ5B,SANW,CAACnE,MAAyD;AAEjE,UAAM,IAAImE,EAAQnE,CAAM;AAExB,WAAO,gBAAAmC,EAAA,cAAC,EAAE,MAAF,EAAQ,GAAGnC,GAAQ;AAAA,EAC/B;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"react.es.js","sources":["../../src/componentModel/react.tsx"],"sourcesContent":["import React, { PropsWithChildren, useEffect, useLayoutEffect, FC, useMemo } from 'react';\r\nimport { Mutable } from '@actdim/utico/typeCore';\r\nimport { observer } from 'mobx-react-lite';\r\nimport { action, observable } from 'mobx';\r\nimport { useLazyRef } from '@/reactHooks';\r\nimport { getGlobalFlags } from '@/globals';\r\nimport { ReactComponentContext, useComponentContext } from './componentContext';\r\nimport {\r\n $id,\r\n $key,\r\n Binding,\r\n Component,\r\n ComponentChildren,\r\n ComponentDef,\r\n ComponentModel,\r\n ComponentMsgHeaders,\r\n ComponentParams,\r\n ComponentStruct,\r\n ComponentViewImplFn,\r\n ComponentViewProps,\r\n EffectController,\r\n EffectFn,\r\n ValueChangeHandler,\r\n ValueChangingHandler,\r\n} from './contracts';\r\nimport { $ON_CHANGE, $ON_CHANGING, $ON_GET, $isBinding, ComponentMsgFilter } from './contracts';\r\nimport { lazy } from '@actdim/utico/utils';\r\nimport {\r\n createEffect,\r\n createRecursiveProxy,\r\n getComponentSourceByCaller,\r\n getComponentMsgBus,\r\n isBinding,\r\n ProxyEventHandlers,\r\n registerMsgBroker,\r\n toHtmlId,\r\n} from './core';\r\n\r\nfunction capitalize(name: string) {\r\n return name.replace(/^./, name[0].toUpperCase());\r\n}\r\n\r\nfunction cleanSourceRef(sourceRef: string) {\r\n // remove origin\r\n return sourceRef.replace(/^[a-z][a-z0-9+.-]*:\\/\\/[^\\/]+/, '');\r\n}\r\n\r\nfunction createComponent<TStruct extends ComponentStruct = ComponentStruct>(\r\n componentDef: ComponentDef<TStruct>,\r\n params?: ComponentParams<TStruct>,\r\n): Component<TStruct> {\r\n // result\r\n let component: Mutable<Component<TStruct>>;\r\n let model: Mutable<ComponentModel<TStruct>>;\r\n\r\n if (!componentDef) {\r\n componentDef = {};\r\n }\r\n\r\n let regType = componentDef.regType;\r\n if (!regType) {\r\n regType = getComponentSourceByCaller(6);\r\n // type = getComponentNameByCaller(6);\r\n regType = cleanSourceRef(regType);\r\n // throw new Error('Valid component definition is required');\r\n }\r\n\r\n if (!params) {\r\n params = {};\r\n }\r\n\r\n const view = componentDef.view;\r\n let msgBus = componentDef.msgBus;\r\n\r\n const bindings = new Map<PropertyKey, Binding>();\r\n\r\n const componentMsgBus = lazy(() => {\r\n return getComponentMsgBus(msgBus, (headers) => {\r\n if (headers?.sourceId == undefined) {\r\n headers.sourceId = component.id;\r\n }\r\n }); // as ComponentModel<TStruct>['msgBus']\r\n });\r\n\r\n let msgBroker = {\r\n ...componentDef.msgBroker,\r\n };\r\n\r\n if (!msgBroker.abortController) {\r\n msgBroker.abortController = new AbortController();\r\n }\r\n\r\n const ViewFC = observer((props: ComponentViewProps) => {\r\n const context = useComponentContext();\r\n const parentId = context.currentId;\r\n\r\n component.parentId = parentId;\r\n\r\n if (!msgBus) {\r\n msgBus = context.msgBus;\r\n }\r\n\r\n if (!component.id) {\r\n let id = params[$id];\r\n if (!id) {\r\n const key = params[$key];\r\n if (key) {\r\n id = `${toHtmlId(regType)}#${key}`;\r\n } else {\r\n id = context.getNextId(regType);\r\n }\r\n }\r\n\r\n component.id = id;\r\n component.getHierarchyId = () => context.getHierarchyPath(id);\r\n component.getChainDown = () => context.getChainDown(id);\r\n component.getChainUp = () => context.getChainUp(id);\r\n component.getChildren = () => context.getChildren(id);\r\n component.getParent = () => context.getParent(id);\r\n component.getNodeMap = () => context.getNodeMap();\r\n }\r\n\r\n useLayoutEffect(() => {\r\n try {\r\n context.register(component.id, regType, parentId);\r\n\r\n if (getGlobalFlags().debug) {\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>layout`);\r\n }\r\n\r\n registerMsgBroker(component);\r\n\r\n componentDef.events?.onLayout?.(component);\r\n params.onLayout?.(component);\r\n } catch (err) {\r\n componentDef.events?.onError?.(component, err);\r\n params.onError?.(component, err);\r\n }\r\n\r\n return () => {\r\n if (getGlobalFlags().debug) {\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>layout-destroy`);\r\n }\r\n context.unregister(component.id);\r\n\r\n msgBroker.abortController?.abort();\r\n\r\n componentDef.events?.onLayoutDestroy?.(component);\r\n params.onLayoutDestroy?.(component);\r\n };\r\n }, [componentDef, params, context]);\r\n\r\n useEffect(() => {\r\n try {\r\n if (getGlobalFlags().debug) {\r\n // mount\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>ready`);\r\n }\r\n componentDef.events?.onReady?.(component);\r\n params.onReady?.(component);\r\n } catch (err) {\r\n if (getGlobalFlags().debug) {\r\n // unmount\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>destroy`);\r\n }\r\n componentDef.events?.onError?.(component, err);\r\n params.onError?.(component, err);\r\n }\r\n return () => {\r\n componentDef.events?.onDestroy?.(component);\r\n params.onDestroy?.(component);\r\n };\r\n }, [componentDef, params, context]);\r\n\r\n let content: React.ReactNode;\r\n // let content: any;\r\n try {\r\n if (getGlobalFlags().debug) {\r\n // render\r\n const hierarchyId = component.getHierarchyId();\r\n console.debug(`${hierarchyId}>view`);\r\n }\r\n if (typeof view === 'function') {\r\n content = view(props, component);\r\n } else {\r\n // content = props.children;\r\n content = <>{props.children}</>;\r\n }\r\n } catch (err) {\r\n // throw err;\r\n const errDetails = JSON.stringify(err);\r\n // msgBus.send\r\n content = <>{errDetails}</>;\r\n }\r\n const scopeContext = useMemo(\r\n () => ({ ...context, currentId: component.id }),\r\n [componentDef, params, context],\r\n );\r\n return (\r\n <ReactComponentContext.Provider value={scopeContext}>\r\n {content}\r\n </ReactComponentContext.Provider>\r\n );\r\n });\r\n\r\n const children = {} as ComponentChildren<TStruct['children']>;\r\n\r\n model = {} as Mutable<ComponentModel<TStruct>>;\r\n\r\n if (componentDef.props) {\r\n Object.assign(model, componentDef.props);\r\n }\r\n\r\n if (componentDef.actions) {\r\n Object.assign(model, componentDef.actions);\r\n }\r\n\r\n if (componentDef.children) {\r\n for (const [key, value] of Object.entries(componentDef.children)) {\r\n if (typeof value == 'function') {\r\n const view = value as (params: any) => Component;\r\n const ChildViewFC: ComponentViewImplFn<TStruct> = (props) => {\r\n const c = view(props);\r\n return <c.View />;\r\n // if (typeof c.view === \"function\") {\r\n // return c.view(props);\r\n // }\r\n // return <>{props.children}</>;\r\n };\r\n Reflect.set(children, capitalize(key), ChildViewFC);\r\n } else {\r\n Reflect.set(children, key, value);\r\n }\r\n }\r\n }\r\n\r\n // Reflect.ownKeys/Object.keys\r\n for (const [key, value] of Object.entries(params)) {\r\n // model.hasOwnProperty(key)\r\n if (key in model) {\r\n if (isBinding(value)) {\r\n bindings.set(key, value);\r\n } else {\r\n Reflect.set(model, key, value);\r\n }\r\n }\r\n }\r\n\r\n const proxyEventHandlers: Pick<ProxyEventHandlers, 'onPropChanging' | 'onPropChange'> = {\r\n onPropChanging:\r\n params.onPropChanging || componentDef.events?.onPropChanging\r\n ? (prop, oldValue, newValue) => {\r\n let result = true;\r\n let handler = params.onPropChanging;\r\n if (handler) {\r\n result = handler(String(prop), oldValue, newValue);\r\n }\r\n if (result) {\r\n handler = componentDef.events?.onPropChanging;\r\n if (handler) {\r\n result = handler(String(prop), oldValue, newValue);\r\n }\r\n }\r\n return result;\r\n }\r\n : undefined,\r\n onPropChange:\r\n params.onPropChange || componentDef.events?.onPropChange\r\n ? (prop, value) => {\r\n params.onPropChange?.(String(prop), value);\r\n componentDef.events?.onPropChange?.(String(prop), value);\r\n }\r\n : undefined,\r\n };\r\n\r\n function resolveOnGetEventHandler(prop: string) {\r\n const key = `${$ON_GET}${capitalize(prop)}`;\r\n return params[key] || componentDef.events?.[key];\r\n }\r\n\r\n function resolveOnChangingEventHandler(prop: string) {\r\n const key = `${$ON_CHANGING}${capitalize(prop)}`;\r\n return ((oldValue: any, newValue: any) => {\r\n let result = true;\r\n let handler = params[key] as ValueChangingHandler<any>;\r\n if (handler) {\r\n result = handler(oldValue, newValue);\r\n }\r\n if (result) {\r\n handler = componentDef.events?.[key] as ValueChangingHandler<any>;\r\n if (handler) {\r\n result = handler(oldValue, newValue);\r\n }\r\n }\r\n return result;\r\n }) as ValueChangingHandler;\r\n }\r\n\r\n function resolveOnChangeEventHandler(prop: string) {\r\n const key = `${$ON_CHANGE}${capitalize(prop)}`;\r\n return ((value: any) => {\r\n (params[key] as ValueChangeHandler<any>)?.(value);\r\n (componentDef.events?.[key] as ValueChangeHandler<any>)?.(value);\r\n }) as ValueChangeHandler;\r\n }\r\n\r\n let annotationMap: Record<string, any> = {};\r\n\r\n if (componentDef.props) {\r\n for (const prop of Object.keys(componentDef.props)) {\r\n proxyEventHandlers[prop] = {\r\n onGet: resolveOnGetEventHandler(prop),\r\n onChanging: resolveOnChangingEventHandler(prop),\r\n onChange: resolveOnChangeEventHandler(prop),\r\n };\r\n }\r\n\r\n for (const key of Object.keys(componentDef.props)) {\r\n annotationMap[key] = observable.deep;\r\n }\r\n }\r\n\r\n if (componentDef.actions) {\r\n const annotationMap: Record<string, any> = {};\r\n for (const key of Object.keys(componentDef.actions)) {\r\n annotationMap[key] = action;\r\n }\r\n }\r\n\r\n model = observable(model, annotationMap, {\r\n deep: true,\r\n });\r\n\r\n model = createRecursiveProxy(model, bindings, proxyEventHandlers);\r\n\r\n let effects: Record<string, EffectController> = {};\r\n component = {\r\n id: params[$id],\r\n key: params[$key],\r\n regType: regType,\r\n parentId: undefined,\r\n getHierarchyId: () => undefined,\r\n getChainDown: () => undefined,\r\n getChainUp: () => undefined,\r\n getChildren: () => undefined,\r\n getParent: () => undefined,\r\n getNodeMap: () => undefined,\r\n bindings: bindings,\r\n get msgBus() {\r\n return componentMsgBus();\r\n },\r\n msgBroker: msgBroker,\r\n effects: effects,\r\n // view: componentDef.view,\r\n View: ViewFC,\r\n children: children,\r\n model: model,\r\n };\r\n\r\n if (componentDef.effects) {\r\n for (const [name, fn] of Object.entries(componentDef.effects)) {\r\n effects[name] = createEffect(\r\n component,\r\n name,\r\n fn as EffectFn<TStruct, ComponentMsgHeaders>,\r\n );\r\n }\r\n }\r\n\r\n if (componentDef.events?.onInit) {\r\n componentDef.events.onInit(component);\r\n }\r\n\r\n if (params.onInit) {\r\n params.onInit(component);\r\n }\r\n\r\n return component;\r\n}\r\n\r\nexport function useComponent<\r\n TStruct extends ComponentStruct = ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n>(componentDef: ComponentDef<TStruct, TMsgHeaders>, params: ComponentParams<TStruct>) {\r\n const ref = useLazyRef(() => createComponent(componentDef, params));\r\n useLayoutEffect(() => {\r\n return () => {\r\n ref.current = null;\r\n };\r\n }, []); // [params]?\r\n return ref.current;\r\n}\r\n\r\n// asFC/toFC\r\nexport function getFC<TStruct extends ComponentStruct>(\r\n factory: (params: ComponentParams<TStruct>) => Component<TStruct>,\r\n): FC<ComponentParams<TStruct>> {\r\n // observer\r\n const fc = (params: ComponentParams<TStruct> & PropsWithChildren) => {\r\n // componentHook\r\n const c = factory(params); // without useRef!\r\n // return c.view();\r\n return <c.View {...params} />;\r\n };\r\n return fc;\r\n}\r\n"],"names":["capitalize","name","cleanSourceRef","sourceRef","createComponent","componentDef","params","component","model","regType","getComponentSourceByCaller","view","msgBus","bindings","componentMsgBus","lazy","getComponentMsgBus","headers","msgBroker","ViewFC","observer","props","context","useComponentContext","parentId","id","$id","key","$key","toHtmlId","useLayoutEffect","getGlobalFlags","hierarchyId","registerMsgBroker","err","useEffect","content","React","errDetails","scopeContext","useMemo","ReactComponentContext","children","value","ChildViewFC","c","isBinding","proxyEventHandlers","prop","oldValue","newValue","result","handler","resolveOnGetEventHandler","$ON_GET","resolveOnChangingEventHandler","$ON_CHANGING","resolveOnChangeEventHandler","$ON_CHANGE","annotationMap","observable","createRecursiveProxy","effects","fn","createEffect","useComponent","ref","useLazyRef","getFC","factory"],"mappings":";;;;;;;;;AAsCA,SAASA,EAAWC,GAAc;AAC9B,SAAOA,EAAK,QAAQ,MAAMA,EAAK,CAAC,EAAE,aAAa;AACnD;AAEA,SAASC,EAAeC,GAAmB;AAEvC,SAAOA,EAAU,QAAQ,iCAAiC,EAAE;AAChE;AAEA,SAASC,EACLC,GACAC,GACkB;AAElB,MAAIC,GACAC;AAEJ,EAAKH,MACDA,IAAe,CAAA;AAGnB,MAAII,IAAUJ,EAAa;AAC3B,EAAKI,MACDA,IAAUC,EAA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,GAAM8D,CAAE,KAAK,OAAO,QAAQ1D,EAAa,OAAO;AACxD,MAAAyD,EAAQ7D,CAAI,IAAI+D;AAAA,QACZzD;AAAA,QACAN;AAAA,QACA8D;AAAA,MAAA;AAKZ,SAAI1D,EAAa,QAAQ,UACrBA,EAAa,OAAO,OAAOE,CAAS,GAGpCD,EAAO,UACPA,EAAO,OAAOC,CAAS,GAGpBA;AACX;AAEO,SAAS0D,GAGd5D,GAAkDC,GAAkC;AAClF,QAAM4D,IAAMC,EAAW,MAAM/D,EAAgBC,GAAcC,CAAM,CAAC;AAClE,SAAAwB,EAAgB,MACL,MAAM;AACT,IAAAoC,EAAI,UAAU;AAAA,EAClB,GACD,CAAA,CAAE,GACEA,EAAI;AACf;AAGO,SAASE,GACZC,GAC4B;AAQ5B,SANW,CAAC/D,MAAyD;AAEjE,UAAMuC,IAAIwB,EAAQ/D,CAAM;AAExB,WAAO,gBAAA+B,EAAA,cAACQ,EAAE,MAAF,EAAQ,GAAGvC,GAAQ;AAAA,EAC/B;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actdim/dynstruct",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "A type-safe component system for large-scale apps: explicit dependencies, message bus communication, and structure-first, declarative design",
|
|
5
5
|
"author": "Pavel Borodaev",
|
|
6
6
|
"license": "Proprietary",
|