@actdim/dynstruct 1.1.4 → 1.1.6
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/appDomain/appContracts.d.ts +5 -5
- package/dist/appDomain/appContracts.d.ts.map +1 -1
- package/dist/appDomain/appContracts.es.js +8 -10
- package/dist/appDomain/appContracts.es.js.map +1 -1
- package/dist/componentModel/DynamicContent.es.js +5 -5
- package/dist/componentModel/DynamicContent.es.js.map +1 -1
- package/dist/componentModel/adapters.d.ts +2 -1
- package/dist/componentModel/adapters.d.ts.map +1 -1
- package/dist/componentModel/adapters.es.js.map +1 -1
- package/dist/componentModel/componentContext.d.ts +2 -2
- package/dist/componentModel/componentContext.d.ts.map +1 -1
- package/dist/componentModel/componentContext.es.js +1 -1
- package/dist/componentModel/componentContext.es.js.map +1 -1
- package/dist/componentModel/contracts.d.ts +7 -9
- package/dist/componentModel/contracts.d.ts.map +1 -1
- package/dist/componentModel/contracts.es.js +7 -9
- package/dist/componentModel/contracts.es.js.map +1 -1
- package/dist/componentModel/react.d.ts.map +1 -1
- package/dist/componentModel/react.es.js +56 -56
- package/dist/componentModel/react.es.js.map +1 -1
- package/dist/services/StorageService.d.ts.map +1 -1
- package/dist/services/StorageService.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { MsgStructBase, MsgStructFactory } from '@actdim/msgmesh/contracts';
|
|
|
2
2
|
import { BaseSecurityDomainConfig as BaseSecurityDomainConfig, BaseSecurityMsgStruct } from './security/securityContracts';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import { KeysOf } from '@actdim/utico/typeCore';
|
|
5
|
-
import {
|
|
5
|
+
import { BaseContext } from '../componentModel/contracts';
|
|
6
6
|
export declare const $NAV_GOTO = "APP-NAV-GOTO";
|
|
7
7
|
export declare const $NAV_GET_CONTEXT = "APP-NAV-GET-CONTEXT";
|
|
8
8
|
export declare const $NAV_CONTEXT_CHANGED = "APP-NAV-CONTEXT-CHANGED";
|
|
@@ -120,15 +120,15 @@ export type BaseApiConfig = {
|
|
|
120
120
|
url?: string;
|
|
121
121
|
versions?: string[];
|
|
122
122
|
};
|
|
123
|
-
export type BaseAppDomainConfig<TSecurityDomainConfig extends BaseSecurityDomainConfig = BaseSecurityDomainConfig, TApiConfig extends BaseApiConfig = BaseApiConfig
|
|
123
|
+
export type BaseAppDomainConfig<TSecurityDomainConfig extends BaseSecurityDomainConfig = BaseSecurityDomainConfig, TApiConfig extends BaseApiConfig = BaseApiConfig> = {
|
|
124
124
|
id: string;
|
|
125
125
|
name?: string;
|
|
126
126
|
baseUrl: string;
|
|
127
127
|
security: TSecurityDomainConfig;
|
|
128
|
-
|
|
128
|
+
defaultApi?: string;
|
|
129
|
+
apis: Record<string, TApiConfig>;
|
|
129
130
|
};
|
|
130
131
|
export type BaseAppMsgChannels<TChannel extends keyof BaseAppMsgStruct | Array<keyof BaseAppMsgStruct>> = KeysOf<BaseAppMsgStruct, TChannel>;
|
|
131
|
-
export type BaseAppContext<TMsgStruct extends BaseAppMsgStruct = BaseAppMsgStruct> =
|
|
132
|
-
export declare const useBaseAppContext: <TMsgStruct extends BaseAppMsgStruct = BaseAppMsgStruct>() => BaseAppContext<TMsgStruct>;
|
|
132
|
+
export type BaseAppContext<TMsgStruct extends BaseAppMsgStruct = BaseAppMsgStruct> = BaseContext<TMsgStruct> & {};
|
|
133
133
|
export {};
|
|
134
134
|
//# sourceMappingURL=appContracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appContracts.d.ts","sourceRoot":"","sources":["../../src/appDomain/appContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,IAAI,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACrI,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,O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-GOTO", O = "APP-NAV-GET-CONTEXT", P = "APP-NAV-CONTEXT-CHANGED", o = "APP-NAV-READ-HISTORY", t = "APP-NOTICE", N = "APP-CONFIG-GET", V = "APP-FETCH", n = "APP-KV-STORE-GET", C = "APP-KV-STORE-SET", s = "APP-KV-STORE-REMOVE", _ = () => E();
|
|
1
|
+
const E = "APP-NAV-GOTO", T = "APP-NAV-GET-CONTEXT", A = "APP-NAV-CONTEXT-CHANGED", O = "APP-NAV-READ-HISTORY", P = "APP-NOTICE", N = "APP-CONFIG-GET", V = "APP-FETCH", _ = "APP-KV-STORE-GET", C = "APP-KV-STORE-SET", G = "APP-KV-STORE-REMOVE";
|
|
3
2
|
export {
|
|
4
3
|
N as $CONFIG_GET,
|
|
5
4
|
V as $FETCH,
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
_ as $KV_STORE_GET,
|
|
6
|
+
G as $KV_STORE_REMOVE,
|
|
8
7
|
C as $KV_STORE_SET,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_ as useBaseAppContext
|
|
8
|
+
A as $NAV_CONTEXT_CHANGED,
|
|
9
|
+
T as $NAV_GET_CONTEXT,
|
|
10
|
+
E as $NAV_GOTO,
|
|
11
|
+
O as $NAV_READ_HISTORY,
|
|
12
|
+
P as $NOTICE
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=appContracts.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appContracts.es.js","sources":["../../src/appDomain/appContracts.ts"],"sourcesContent":["import { MsgStructBase, MsgStructFactory } from \"@actdim/msgmesh/contracts\";\r\nimport { BaseSecurityDomainConfig as BaseSecurityDomainConfig, BaseSecurityMsgStruct } from \"@/appDomain/security/securityContracts\";\r\nimport { ReactNode } from \"react\";\r\nimport { KeysOf } from \"@actdim/utico/typeCore\";\r\nimport { ComponentRegistryContext } from \"@/componentModel/contracts\";\r\nimport { useComponentContext } from \"@/componentModel/componentContext\"
|
|
1
|
+
{"version":3,"file":"appContracts.es.js","sources":["../../src/appDomain/appContracts.ts"],"sourcesContent":["import { MsgStructBase, MsgStructFactory } from \"@actdim/msgmesh/contracts\";\r\nimport { BaseSecurityDomainConfig as BaseSecurityDomainConfig, BaseSecurityMsgStruct } from \"@/appDomain/security/securityContracts\";\r\nimport { ReactNode } from \"react\";\r\nimport { KeysOf } from \"@actdim/utico/typeCore\";\r\nimport { BaseContext, ComponentRegistryContext } from \"@/componentModel/contracts\";\r\nimport { useComponentContext } from \"@/componentModel/componentContext\"\r\n\r\nexport const $NAV_GOTO = \"APP-NAV-GOTO\";\r\nexport const $NAV_GET_CONTEXT = \"APP-NAV-GET-CONTEXT\";\r\nexport const $NAV_CONTEXT_CHANGED = \"APP-NAV-CONTEXT-CHANGED\";\r\nexport const $NAV_READ_HISTORY = \"APP-NAV-READ-HISTORY\";\r\n// TOAST\r\nexport const $NOTICE = \"APP-NOTICE\";\r\nexport const $CONFIG_GET = \"APP-CONFIG-GET\";\r\n// ERROR?\r\nexport const $FETCH = \"APP-FETCH\";\r\n\r\nexport const $KV_STORE_GET = \"APP-KV-STORE-GET\";\r\nexport const $KV_STORE_SET = \"APP-KV-STORE-SET\";\r\nexport const $KV_STORE_REMOVE = \"APP-KV-STORE-REMOVE\";\r\n// TODO: has, clear, entries\r\n\r\nexport type Module = \"security\" | \"api-client\";\r\n\r\nexport type NavPath = {\r\n /**\r\n * A URL pathname, beginning with a /.\r\n */\r\n pathname: string;\r\n /**\r\n * A URL search string, beginning with a ?.\r\n */\r\n search: string;\r\n /**\r\n * A URL fragment identifier, beginning with a #.\r\n */\r\n hash: string;\r\n};\r\n\r\nexport type NavLocation<State = any> = NavPath & {\r\n /**\r\n * A value of arbitrary data associated with this location.\r\n */\r\n state: State;\r\n /**\r\n * A unique string associated with this location. May be used to safely store\r\n * and retrieve data in some other storage API, like `localStorage`.\r\n *\r\n * Note: This value is always \"default\" on the initial location.\r\n */\r\n key: string;\r\n};\r\n\r\nexport type NavAction =\r\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\r\n | \"POP\"\r\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\r\n | \"PUSH\"\r\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\r\n | \"REPLACE\";\r\n\r\n// AppRouteParams\r\nexport type NavRouteParams = Record<string, string | undefined>;\r\n\r\n// AppRoute\r\nexport type NavRoute<TParams extends NavRouteParams = NavRouteParams> = {\r\n path(params?: TParams): string;\r\n match(path: string): TParams;\r\n element: ReactNode;\r\n defaultParams?: TParams;\r\n};\r\n\r\nexport type NavRoutes = Record<string, NavRoute>;\r\n\r\ntype NavRouteStruct<TNavRoutes extends NavRoutes> = {\r\n [K in keyof TNavRoutes]: {\r\n route: K;\r\n params?: TNavRoutes[K][\"defaultParams\"];\r\n };\r\n}[keyof TNavRoutes];\r\n\r\nexport type NavContext = {\r\n // route?: NavRoute;\r\n location?: NavLocation;\r\n searchParams?: URLSearchParams;\r\n params?: NavRouteParams;\r\n navType?: NavAction;\r\n};\r\n\r\nexport type NavHistory = Array<NavContext>;\r\n\r\n// OperationContext?\r\nexport type AppError<TModule = Module> = {\r\n module: TModule;\r\n // code: string;\r\n type: string;\r\n title?: string;\r\n source?: any;\r\n details?: any;\r\n // instance?: string;\r\n timestamp?: string;\r\n // errors: AppError[];\r\n traceId?: string;\r\n field?: string;\r\n reason?: string;\r\n};\r\n\r\n// Base(App)ApiMsgStruct\r\nexport type BaseApiMsgStruct = BaseSecurityMsgStruct &\r\n MsgStructFactory<{\r\n // \"GET-VERSION\"?: {\r\n // in: any;\r\n // };\r\n }>;\r\n\r\n// BaseAppMsgStruct\r\nexport type BaseAppMsgStruct<TNavRoutes extends NavRoutes = NavRoutes> = BaseApiMsgStruct &\r\n MsgStructFactory<\r\n {\r\n [$NOTICE]: {\r\n in: {\r\n text: string;\r\n title?: string;\r\n type: any;\r\n };\r\n out: void;\r\n };\r\n [$CONFIG_GET]: {\r\n in: void;\r\n out: BaseAppDomainConfig;\r\n };\r\n [$NAV_GOTO]: {\r\n in: string | number;\r\n ex: NavRouteStruct<TNavRoutes>;\r\n out: void;\r\n };\r\n [$NAV_GET_CONTEXT]: {\r\n in: void;\r\n out: NavContext;\r\n };\r\n [$NAV_CONTEXT_CHANGED]: {\r\n in: NavContext;\r\n out: void;\r\n };\r\n [$NAV_READ_HISTORY]: {\r\n in: number;\r\n out: NavContext;\r\n };\r\n [$FETCH]: {\r\n in: {\r\n url: string;\r\n params: RequestInit;\r\n };\r\n out: Response;\r\n };\r\n [$KV_STORE_GET]: {\r\n in: {\r\n key: string;\r\n useEncryption?: boolean;\r\n };\r\n out: string;\r\n };\r\n [$KV_STORE_SET]: {\r\n in: {\r\n key: string;\r\n value: any;\r\n useEncryption?: boolean;\r\n };\r\n out: void;\r\n };\r\n [$KV_STORE_REMOVE]: {\r\n in: {\r\n key: string;\r\n };\r\n out: void;\r\n };\r\n } & MsgStructBase\r\n >;\r\n\r\nexport type BaseApiConfig = {\r\n url?: string;\r\n versions?: string[];\r\n};\r\n\r\n// BaseApp(Domain)Config\r\nexport type BaseAppDomainConfig<\r\n TSecurityDomainConfig extends BaseSecurityDomainConfig = BaseSecurityDomainConfig,\r\n TApiConfig extends BaseApiConfig = BaseApiConfig\r\n> = {\r\n id: string;\r\n name?: string;\r\n baseUrl: string;\r\n security: TSecurityDomainConfig;\r\n defaultApi?: string;\r\n apis: Record<string, TApiConfig>;\r\n // HATEOAS? (React Admin)\r\n};\r\n\r\nexport type BaseAppMsgChannels<TChannel extends keyof BaseAppMsgStruct | Array<keyof BaseAppMsgStruct>> = KeysOf<BaseAppMsgStruct, TChannel>;\r\n\r\nexport type BaseAppContext<TMsgStruct extends BaseAppMsgStruct = BaseAppMsgStruct> = BaseContext<TMsgStruct> & {\r\n // securityProvider: SecurityProvider;\r\n};"],"names":["$NAV_GOTO","$NAV_GET_CONTEXT","$NAV_CONTEXT_CHANGED","$NAV_READ_HISTORY","$NOTICE","$CONFIG_GET","$FETCH","$KV_STORE_GET","$KV_STORE_SET","$KV_STORE_REMOVE"],"mappings":"AAOO,MAAMA,IAAY,gBACZC,IAAmB,uBACnBC,IAAuB,2BACvBC,IAAoB,wBAEpBC,IAAU,cACVC,IAAc,kBAEdC,IAAS,aAETC,IAAgB,oBAChBC,IAAgB,oBAChBC,IAAmB;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useComponent as
|
|
2
|
-
function
|
|
1
|
+
import { useComponent as r } from "./react.es.js";
|
|
2
|
+
function c(o) {
|
|
3
3
|
let e, n;
|
|
4
|
-
return e =
|
|
4
|
+
return e = r({
|
|
5
5
|
props: {
|
|
6
6
|
render: void 0,
|
|
7
7
|
data: void 0
|
|
8
8
|
},
|
|
9
|
-
view: (
|
|
9
|
+
view: (d, i) => n.render()
|
|
10
10
|
}, o), n = e.model, e;
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
c as useDynamicContent
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=DynamicContent.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicContent.es.js","sources":["../../src/componentModel/DynamicContent.tsx"],"sourcesContent":["import type {\n Component,\n ComponentDef,\n ComponentModel,\n ComponentParams,\n ComponentStruct,\n} from '@/componentModel/contracts';\nimport React from 'react';\nimport { MsgStruct } from '@actdim/msgmesh/contracts';\nimport { useComponent } from './react';\n\nexport type DynamicContentStruct<\n TData = any,\n TMsgStruct extends MsgStruct = MsgStruct,\n> = ComponentStruct<\n TMsgStruct,\n {\n props: {\n data: TData;\n render: () => React.ReactNode;\n };\n }\n>;\n\nexport function useDynamicContent<TData = any>(\n params: ComponentParams<DynamicContentStruct<TData>>,\n) {\n let c: Component<DynamicContentStruct<TData>>;\n let m: ComponentModel<DynamicContentStruct<TData>>;\n const
|
|
1
|
+
{"version":3,"file":"DynamicContent.es.js","sources":["../../src/componentModel/DynamicContent.tsx"],"sourcesContent":["import type {\n Component,\n ComponentDef,\n ComponentModel,\n ComponentParams,\n ComponentStruct,\n} from '@/componentModel/contracts';\nimport React from 'react';\nimport { MsgStruct } from '@actdim/msgmesh/contracts';\nimport { useComponent } from './react';\n\nexport type DynamicContentStruct<\n TData = any,\n TMsgStruct extends MsgStruct = MsgStruct,\n> = ComponentStruct<\n TMsgStruct,\n {\n props: {\n data: TData;\n render: () => React.ReactNode;\n };\n }\n>;\n\nexport function useDynamicContent<TData = any>(\n params: ComponentParams<DynamicContentStruct<TData>>,\n) {\n let c: Component<DynamicContentStruct<TData>>;\n let m: ComponentModel<DynamicContentStruct<TData>>;\n const def: ComponentDef<DynamicContentStruct<TData>> = {\n props: {\n render: undefined,\n data: undefined,\n },\n view: (_, c) => {\n return m.render();\n },\n };\n\n c = useComponent(def, params);\n m = c.model;\n return c;\n}\n"],"names":["useDynamicContent","params","c","m","useComponent","_"],"mappings":";AAwBO,SAASA,EACZC,GACF;AACE,MAAIC,GACAC;AAWJ,SAAAD,IAAIE,EAVmD;AAAA,IACnD,OAAO;AAAA,MACH,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,IAEV,MAAM,CAACC,GAAGH,MACCC,EAAE,OAAA;AAAA,EACb,GAGkBF,CAAM,GAC5BE,IAAID,EAAE,OACCA;AACX;"}
|
|
@@ -6,7 +6,8 @@ export type MsgProviderAdapter = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare function registerAdapters<TMsgStruct extends MsgStruct = MsgStruct>(msgBus: MsgBus<TMsgStruct>, adapters: MsgProviderAdapter[], abortSignal?: AbortSignal): void;
|
|
8
8
|
export type BaseServiceSuffix = 'CLIENT' | 'API' | 'SERVICE' | 'FETCHER' | 'CONTROLLER' | 'LOADER' | 'REPOSITORY' | 'PROVIDER';
|
|
9
|
-
export type
|
|
9
|
+
export type BaseWordSeparator = "-";
|
|
10
|
+
export type ToMsgChannelPrefix<TServiceName extends string, Prefix extends string, Suffix extends string = BaseServiceSuffix, WordSeparator extends string = BaseWordSeparator> = `${Prefix}${WordSeparator}${RemoveSuffix<Uppercase<TServiceName>, Suffix>}${WordSeparator}`;
|
|
10
11
|
type ToMsgStructSource<TService, TPrefix extends string, TSkip extends keyof TService = never> = Filter<ToUpper<AddPrefix<Skip<TService, TSkip>, TPrefix>>, Func>;
|
|
11
12
|
export type ToMsgStruct<TService, TPrefix extends string, TSkip extends keyof TService = never, TMsgStructSource = ToMsgStructSource<TService, TPrefix, TSkip>> = MsgStructFactory<{
|
|
12
13
|
[K in keyof TMsgStructSource as TMsgStructSource[K] extends Func ? (Uppercase<K extends string ? K : never>) : never]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/componentModel/adapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAQ,MAAM,EAAE,IAAI,EAAU,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAY5G,MAAM,MAAM,kBAAkB,GAAG;IAC7B,OAAO,EAAE,GAAG,CAAC;IAEb,eAAe,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CACjE,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,WAAW,CAAC,EAAE,WAAW,QAwB/J;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,KA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KAAK,IAAI,MAAM,CACnG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,EAClD,IAAI,CACP,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,QAAQ,EAAE,OAAO,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,QAAQ,GAAG,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,gBAAgB,CAAC;KAC9K,CAAC,IAAI,MAAM,gBAAgB,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG;QACnH,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QAC/E,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;KACnF;CACJ,CAAC,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,EACzD,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAEvB,SAAS,GAAG,EAAE,YAAY,MAAM,YAO3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.es.js","sources":["../../src/componentModel/adapters.ts"],"sourcesContent":["import { ClientBase } from \"@/net/client\";\r\nimport { MsgBus, MsgStruct, MsgStructFactory } from \"@actdim/msgmesh/contracts\";\r\nimport { AddPrefix, Diff, Filter, Func, KeysOf, RemoveSuffix, Skip, ToUpper } from \"@actdim/utico/typeCore\";\r\n\r\nconst getMethodNames = (client: any) => {\r\n // return new Set(...)\r\n return Object.getOwnPropertyNames(client).filter(\r\n (name) => name !== 'constructor' && typeof client[name] === 'function',\r\n );\r\n};\r\n\r\nconst baseMethodNames = getMethodNames(ClientBase.prototype);\r\n\r\n// ServiceMsgDispatcher\r\nexport type MsgProviderAdapter = {\r\n service: any;\r\n // channelResolver/channelMapper\r\n channelSelector: (service: any, methodName: string) => string;\r\n};\r\n\r\nexport function registerAdapters<TMsgStruct extends MsgStruct = MsgStruct>(msgBus: MsgBus<TMsgStruct>, adapters: MsgProviderAdapter[], abortSignal?: AbortSignal) {\r\n if (adapters) {\r\n for (const adapter of adapters) {\r\n const { service, channelSelector } = adapter;\r\n if (!service || !channelSelector) {\r\n throw new Error(\"Service and channelSelector are required for an adapter\")\r\n }\r\n for (const methodName of getMethodNames(Object.getPrototypeOf(service))) {\r\n const channel = channelSelector?.(service, methodName);\r\n if (channel) {\r\n msgBus.provide({\r\n channel: channel as keyof TMsgStruct,\r\n topic: '/.*/',\r\n callback: (msg) => {\r\n return (service[methodName] as Func)(...((msg.payload || []) as any[]));\r\n },\r\n options: {\r\n abortSignal: abortSignal\r\n }\r\n });\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport type BaseServiceSuffix = 'CLIENT' | 'API' | 'SERVICE' | 'FETCHER' | 'CONTROLLER' | 'LOADER' | 'REPOSITORY' | 'PROVIDER';\r\n\r\n// const suffixes = ['CLIENT', 'API', 'SERVICE'] satisfies Uppercase<BaseServiceSuffix>[];\r\n// runtime version: `${prefix}${removeSuffix(serviceName.toUpperCase(), suffixes)}_`\r\nexport type ToMsgChannelPrefix<\r\n TServiceName extends string,\r\n Prefix extends string,\r\n Suffix extends string = BaseServiceSuffix,\r\n> = `${Prefix}${RemoveSuffix<Uppercase<TServiceName>, Suffix>}
|
|
1
|
+
{"version":3,"file":"adapters.es.js","sources":["../../src/componentModel/adapters.ts"],"sourcesContent":["import { ClientBase } from \"@/net/client\";\r\nimport { MsgBus, MsgStruct, MsgStructFactory } from \"@actdim/msgmesh/contracts\";\r\nimport { AddPrefix, Diff, Filter, Func, KeysOf, RemoveSuffix, Skip, ToUpper } from \"@actdim/utico/typeCore\";\r\n\r\nconst getMethodNames = (client: any) => {\r\n // return new Set(...)\r\n return Object.getOwnPropertyNames(client).filter(\r\n (name) => name !== 'constructor' && typeof client[name] === 'function',\r\n );\r\n};\r\n\r\nconst baseMethodNames = getMethodNames(ClientBase.prototype);\r\n\r\n// ServiceMsgDispatcher\r\nexport type MsgProviderAdapter = {\r\n service: any;\r\n // channelResolver/channelMapper\r\n channelSelector: (service: any, methodName: string) => string;\r\n};\r\n\r\nexport function registerAdapters<TMsgStruct extends MsgStruct = MsgStruct>(msgBus: MsgBus<TMsgStruct>, adapters: MsgProviderAdapter[], abortSignal?: AbortSignal) {\r\n if (adapters) {\r\n for (const adapter of adapters) {\r\n const { service, channelSelector } = adapter;\r\n if (!service || !channelSelector) {\r\n throw new Error(\"Service and channelSelector are required for an adapter\")\r\n }\r\n for (const methodName of getMethodNames(Object.getPrototypeOf(service))) {\r\n const channel = channelSelector?.(service, methodName);\r\n if (channel) {\r\n msgBus.provide({\r\n channel: channel as keyof TMsgStruct,\r\n topic: '/.*/',\r\n callback: (msg) => {\r\n return (service[methodName] as Func)(...((msg.payload || []) as any[]));\r\n },\r\n options: {\r\n abortSignal: abortSignal\r\n }\r\n });\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport type BaseServiceSuffix = 'CLIENT' | 'API' | 'SERVICE' | 'FETCHER' | 'CONTROLLER' | 'LOADER' | 'REPOSITORY' | 'PROVIDER';\r\nexport type BaseWordSeparator = \"-\"; // \".\"\r\n\r\n// const suffixes = ['CLIENT', 'API', 'SERVICE'] satisfies Uppercase<BaseServiceSuffix>[];\r\n// runtime version: `${prefix}${removeSuffix(serviceName.toUpperCase(), suffixes)}_`\r\nexport type ToMsgChannelPrefix<\r\n TServiceName extends string,\r\n Prefix extends string,\r\n Suffix extends string = BaseServiceSuffix,\r\n WordSeparator extends string = BaseWordSeparator\r\n> = `${Prefix}${WordSeparator}${RemoveSuffix<Uppercase<TServiceName>, Suffix>}${WordSeparator}`;\r\n\r\ntype ToMsgStructSource<TService, TPrefix extends string, TSkip extends keyof TService = never> = Filter<\r\n ToUpper<AddPrefix<Skip<TService, TSkip>, TPrefix>>,\r\n Func\r\n>;\r\n\r\nexport type ToMsgStruct<TService, TPrefix extends string, TSkip extends keyof TService = never, TMsgStructSource = ToMsgStructSource<TService, TPrefix, TSkip>> = MsgStructFactory<{\r\n [K in keyof TMsgStructSource as TMsgStructSource[K] extends Func ? (Uppercase<K extends string ? K : never>) : never]: {\r\n in: TMsgStructSource[K] extends Func ? Parameters<TMsgStructSource[K]> : never;\r\n out: TMsgStructSource[K] extends Func ? ReturnType<TMsgStructSource[K]> : never;\r\n };\r\n}>;\r\n\r\nexport function getMsgChannelSelector<TTPrefix extends string>(\r\n services: Record<TTPrefix, any>,\r\n) {\r\n return (service: any, methodName: string) => {\r\n const entry = Object.entries(services).find((entry) => entry[1] === service);\r\n if (!entry) {\r\n return null;\r\n }\r\n return `${entry[0]}${methodName.toUpperCase()}`;\r\n };\r\n}\r\n\r\n// TODO:\r\n// export type PublicKeys<T> = {\r\n// [K in keyof T]: K extends `_${string}` ? never : K;\r\n// }[keyof T];\r\n"],"names":["getMethodNames","client","name","ClientBase","registerAdapters","msgBus","adapters","abortSignal","adapter","service","channelSelector","methodName","channel","msg","getMsgChannelSelector","services","entry"],"mappings":";AAIA,MAAMA,IAAiB,CAACC,MAEb,OAAO,oBAAoBA,CAAM,EAAE;AAAA,EACtC,CAACC,MAASA,MAAS,iBAAiB,OAAOD,EAAOC,CAAI,KAAM;AAAA;AAI5CF,EAAeG,EAAW,SAAS;AASpD,SAASC,EAA2DC,GAA4BC,GAAgCC,GAA2B;AAC9J,MAAID;AACA,eAAWE,KAAWF,GAAU;AAC5B,YAAM,EAAE,SAAAG,GAAS,iBAAAC,EAAA,IAAoBF;AACrC,UAAI,CAACC,KAAW,CAACC;AACb,cAAM,IAAI,MAAM,yDAAyD;AAE7E,iBAAWC,KAAcX,EAAe,OAAO,eAAeS,CAAO,CAAC,GAAG;AACrE,cAAMG,IAAUF,IAAkBD,GAASE,CAAU;AACrD,QAAIC,KACAP,EAAO,QAAQ;AAAA,UACX,SAAAO;AAAA,UACA,OAAO;AAAA,UACP,UAAU,CAACC,MACCJ,EAAQE,CAAU,EAAW,GAAKE,EAAI,WAAW,CAAA,CAAa;AAAA,UAE1E,SAAS;AAAA,YACL,aAAAN;AAAA,UAAA;AAAA,QACJ,CACH;AAAA,MAET;AAAA,IACJ;AAER;AA0BO,SAASO,EACZC,GACF;AACE,SAAO,CAACN,GAAcE,MAAuB;AACzC,UAAMK,IAAQ,OAAO,QAAQD,CAAQ,EAAE,KAAK,CAACC,MAAUA,EAAM,CAAC,MAAMP,CAAO;AAC3E,WAAKO,IAGE,GAAGA,EAAM,CAAC,CAAC,GAAGL,EAAW,aAAa,KAFlC;AAAA,EAGf;AACJ;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseContext } from './contracts';
|
|
3
3
|
export declare const ReactComponentContext: any;
|
|
4
4
|
export declare function ComponentContextProvider(props: PropsWithChildren<{
|
|
5
|
-
value?:
|
|
5
|
+
value?: BaseContext;
|
|
6
6
|
}>): any;
|
|
7
7
|
export declare function useComponentContext(): any;
|
|
8
8
|
//# sourceMappingURL=componentContext.d.ts.map
|
|
@@ -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,EAAE,
|
|
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,WAAW,EAA+C,MAAM,aAAa,CAAC;AAGvF,eAAO,MAAM,qBAAqB,KAAqD,CAAC;AAGxF,wBAAgB,wBAAwB,CACpC,KAAK,EAAE,iBAAiB,CAAC;IACrB,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC,OA2LL;AAGD,wBAAgB,mBAAmB,QASlC"}
|
|
@@ -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 { BaseContext, 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?: BaseContext;\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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;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;"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { $CG_IN, $CG_OUT, Msg, MsgBus, MsgHeaders, MsgProviderParams, MsgStruct, MsgSubParams, OutStruct } from '@actdim/msgmesh/contracts';
|
|
2
2
|
import { HasKeys, MaybeKeyOf, MaybePromise, Require, Skip } from '@actdim/utico/typeCore';
|
|
3
3
|
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
4
|
-
export type
|
|
4
|
+
export type BaseContext<TMsgStruct extends MsgStruct = MsgStruct> = {
|
|
5
5
|
msgBus: MsgBus<TMsgStruct>;
|
|
6
|
-
currentId?: string;
|
|
7
6
|
};
|
|
8
7
|
export type ComponentTreeNode = {
|
|
9
8
|
id: string;
|
|
@@ -11,7 +10,8 @@ export type ComponentTreeNode = {
|
|
|
11
10
|
parentId?: string;
|
|
12
11
|
children: Set<string>;
|
|
13
12
|
};
|
|
14
|
-
export type ComponentRegistryContext<TMsgStruct extends MsgStruct = MsgStruct> =
|
|
13
|
+
export type ComponentRegistryContext<TMsgStruct extends MsgStruct = MsgStruct> = BaseContext<TMsgStruct> & {
|
|
14
|
+
currentId?: string;
|
|
15
15
|
register: (id: string, regType: string, parentId?: string) => void;
|
|
16
16
|
unregister: (id: string) => void;
|
|
17
17
|
getParent: (id: string) => string | undefined;
|
|
@@ -163,11 +163,9 @@ export type ComponentBase<TStruct extends ComponentStruct = ComponentStruct, TMs
|
|
|
163
163
|
effects: Record<string, EffectController>;
|
|
164
164
|
View: ComponentViewFn;
|
|
165
165
|
};
|
|
166
|
-
export declare const $id: unique symbol;
|
|
167
|
-
export declare const $key: unique symbol;
|
|
168
166
|
export type ComponentModel<TStruct extends ComponentStruct = ComponentStruct> = TStruct['props'] & Readonly<TStruct['actions']> & {
|
|
169
|
-
readonly
|
|
170
|
-
readonly
|
|
167
|
+
readonly $id?: string;
|
|
168
|
+
readonly $key?: string;
|
|
171
169
|
};
|
|
172
170
|
export type Component<TStruct extends ComponentStruct = ComponentStruct, TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders> = {
|
|
173
171
|
readonly model: ComponentModel<TStruct>;
|
|
@@ -179,8 +177,8 @@ export type PropEventHandlers = {
|
|
|
179
177
|
onChange?: (value: any) => void;
|
|
180
178
|
};
|
|
181
179
|
export type ComponentParams<TStruct extends ComponentStruct = ComponentStruct> = ComponentPropParams<TStruct['props']> & ComponentEvents<TStruct> & {
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
$id?: string;
|
|
181
|
+
$key?: string;
|
|
184
182
|
};
|
|
185
183
|
export type EffectController = {
|
|
186
184
|
start: () => void;
|
|
@@ -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,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE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,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,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,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,12 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
1
|
+
var s = /* @__PURE__ */ ((n) => (n[n.None = 0] = "None", n[n.FromAncestors = 1] = "FromAncestors", n[n.FromDescendants = 2] = "FromDescendants", n))(s || {});
|
|
2
|
+
const c = Symbol("$isBinding"), N = "onGet", o = "onChanging", a = "onChange";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
s as
|
|
9
|
-
a as $key,
|
|
10
|
-
o as ComponentMsgFilter
|
|
4
|
+
a as $ON_CHANGE,
|
|
5
|
+
o as $ON_CHANGING,
|
|
6
|
+
N as $ON_GET,
|
|
7
|
+
c as $isBinding,
|
|
8
|
+
s as ComponentMsgFilter
|
|
11
9
|
};
|
|
12
10
|
//# sourceMappingURL=contracts.es.js.map
|
|
@@ -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 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
|
+
{"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 BaseContext<TMsgStruct extends MsgStruct = MsgStruct> = {\r\n msgBus: MsgBus<TMsgStruct>;\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 BaseContext<TMsgStruct> & {\r\n currentId?: string;\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 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 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"],"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;"}
|
|
@@ -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,
|
|
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,EAEH,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,49 +1,49 @@
|
|
|
1
|
-
import u, { useLayoutEffect as
|
|
2
|
-
import { observer as
|
|
1
|
+
import u, { useLayoutEffect as H, useEffect as M, useMemo as j } from "react";
|
|
2
|
+
import { observer as x } from "mobx-react-lite";
|
|
3
3
|
import { observable as P } from "mobx";
|
|
4
|
-
import { useLazyRef as
|
|
4
|
+
import { useLazyRef as G } from "../reactHooks.es.js";
|
|
5
5
|
import { getGlobalFlags as f } from "../globals.es.js";
|
|
6
|
-
import { useComponentContext as
|
|
7
|
-
import { $
|
|
8
|
-
import { lazy as
|
|
9
|
-
import { getComponentSourceByCaller as
|
|
6
|
+
import { useComponentContext as S, ReactComponentContext as F } from "./componentContext.es.js";
|
|
7
|
+
import { $ON_CHANGE as L, $ON_CHANGING as z, $ON_GET as U } from "./contracts.es.js";
|
|
8
|
+
import { lazy as A } from "@actdim/utico/utils";
|
|
9
|
+
import { getComponentSourceByCaller as T, getComponentMsgBus as _, toHtmlId as J, registerMsgBroker as V, isBinding as q, createRecursiveProxy as K, createEffect as Q } from "./core.es.js";
|
|
10
10
|
function a(e) {
|
|
11
11
|
return e.replace(/^./, e[0].toUpperCase());
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function W(e) {
|
|
14
14
|
return e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^\/]+/, "");
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
let t,
|
|
16
|
+
function X(e, o) {
|
|
17
|
+
let t, d;
|
|
18
18
|
e || (e = {});
|
|
19
|
-
let
|
|
20
|
-
|
|
19
|
+
let l = e.regType;
|
|
20
|
+
l || (l = T(6), l = W(l)), o || (o = {});
|
|
21
21
|
const I = e.view;
|
|
22
22
|
let C = e.msgBus;
|
|
23
|
-
const v = /* @__PURE__ */ new Map(),
|
|
23
|
+
const v = /* @__PURE__ */ new Map(), O = A(() => _(C, (n) => {
|
|
24
24
|
n?.sourceId == null && (n.sourceId = t.id);
|
|
25
25
|
}));
|
|
26
26
|
let h = {
|
|
27
27
|
...e.msgBroker
|
|
28
28
|
};
|
|
29
29
|
h.abortController || (h.abortController = new AbortController());
|
|
30
|
-
const
|
|
31
|
-
const r =
|
|
30
|
+
const w = x((n) => {
|
|
31
|
+
const r = S(), g = r.currentId;
|
|
32
32
|
if (t.parentId = g, C || (C = r.msgBus), !t.id) {
|
|
33
|
-
let i = o
|
|
33
|
+
let i = o.$id;
|
|
34
34
|
if (!i) {
|
|
35
|
-
const y = o
|
|
36
|
-
y ? i = `${
|
|
35
|
+
const y = o.$key;
|
|
36
|
+
y ? i = `${J(l)}#${y}` : i = r.getNextId(l);
|
|
37
37
|
}
|
|
38
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();
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
H(() => {
|
|
41
41
|
try {
|
|
42
|
-
if (r.register(t.id,
|
|
42
|
+
if (r.register(t.id, l, g), f().debug) {
|
|
43
43
|
const i = t.getHierarchyId();
|
|
44
44
|
console.debug(`${i}>layout`);
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
V(t), e.events?.onLayout?.(t), o.onLayout?.(t);
|
|
47
47
|
} catch (i) {
|
|
48
48
|
e.events?.onError?.(t, i), o.onError?.(t, i);
|
|
49
49
|
}
|
|
@@ -54,7 +54,7 @@ function Z(e, o) {
|
|
|
54
54
|
}
|
|
55
55
|
r.unregister(t.id), h.abortController?.abort(), e.events?.onLayoutDestroy?.(t), o.onLayoutDestroy?.(t);
|
|
56
56
|
};
|
|
57
|
-
}, [e, o, r]),
|
|
57
|
+
}, [e, o, r]), M(() => {
|
|
58
58
|
try {
|
|
59
59
|
if (f().debug) {
|
|
60
60
|
const i = t.getHierarchyId();
|
|
@@ -83,13 +83,13 @@ function Z(e, o) {
|
|
|
83
83
|
const y = JSON.stringify(i);
|
|
84
84
|
s = /* @__PURE__ */ u.createElement(u.Fragment, null, y);
|
|
85
85
|
}
|
|
86
|
-
const c =
|
|
86
|
+
const c = j(
|
|
87
87
|
() => ({ ...r, currentId: t.id }),
|
|
88
88
|
[e, o, r]
|
|
89
89
|
);
|
|
90
|
-
return /* @__PURE__ */ u.createElement(
|
|
90
|
+
return /* @__PURE__ */ u.createElement(F.Provider, { value: c }, s);
|
|
91
91
|
}), b = {};
|
|
92
|
-
if (
|
|
92
|
+
if (d = {}, e.props && Object.assign(d, e.props), e.actions && Object.assign(d, e.actions), e.children)
|
|
93
93
|
for (const [n, r] of Object.entries(e.children))
|
|
94
94
|
if (typeof r == "function") {
|
|
95
95
|
const g = r, s = (c) => {
|
|
@@ -100,8 +100,8 @@ function Z(e, o) {
|
|
|
100
100
|
} else
|
|
101
101
|
Reflect.set(b, n, r);
|
|
102
102
|
for (const [n, r] of Object.entries(o))
|
|
103
|
-
n in
|
|
104
|
-
const
|
|
103
|
+
n in d && (q(r) ? v.set(n, r) : Reflect.set(d, n, r));
|
|
104
|
+
const $ = {
|
|
105
105
|
onPropChanging: o.onPropChanging || e.events?.onPropChanging ? (n, r, g) => {
|
|
106
106
|
let s = !0, c = o.onPropChanging;
|
|
107
107
|
return c && (s = c(String(n), r, g)), s && (c = e.events?.onPropChanging, c && (s = c(String(n), r, g))), s;
|
|
@@ -110,45 +110,45 @@ function Z(e, o) {
|
|
|
110
110
|
o.onPropChange?.(String(n), r), e.events?.onPropChange?.(String(n), r);
|
|
111
111
|
} : void 0
|
|
112
112
|
};
|
|
113
|
-
function
|
|
114
|
-
const r = `${
|
|
113
|
+
function B(n) {
|
|
114
|
+
const r = `${U}${a(n)}`;
|
|
115
115
|
return o[r] || e.events?.[r];
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const r = `${
|
|
117
|
+
function N(n) {
|
|
118
|
+
const r = `${z}${a(n)}`;
|
|
119
119
|
return ((g, s) => {
|
|
120
120
|
let c = !0, i = o[r];
|
|
121
121
|
return i && (c = i(g, s)), c && (i = e.events?.[r], i && (c = i(g, s))), c;
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const r = `${
|
|
124
|
+
function R(n) {
|
|
125
|
+
const r = `${L}${a(n)}`;
|
|
126
126
|
return ((g) => {
|
|
127
127
|
o[r]?.(g), e.events?.[r]?.(g);
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
let
|
|
130
|
+
let E = {};
|
|
131
131
|
if (e.props) {
|
|
132
132
|
for (const n of Object.keys(e.props))
|
|
133
|
-
|
|
134
|
-
onGet:
|
|
135
|
-
onChanging:
|
|
136
|
-
onChange:
|
|
133
|
+
$[n] = {
|
|
134
|
+
onGet: B(n),
|
|
135
|
+
onChanging: N(n),
|
|
136
|
+
onChange: R(n)
|
|
137
137
|
};
|
|
138
138
|
for (const n of Object.keys(e.props))
|
|
139
|
-
|
|
139
|
+
E[n] = P.deep;
|
|
140
140
|
}
|
|
141
141
|
if (e.actions)
|
|
142
142
|
for (const n of Object.keys(e.actions))
|
|
143
143
|
;
|
|
144
|
-
|
|
144
|
+
d = P(d, E, {
|
|
145
145
|
deep: !0
|
|
146
|
-
}),
|
|
146
|
+
}), d = K(d, v, $);
|
|
147
147
|
let k = {};
|
|
148
148
|
if (t = {
|
|
149
|
-
id: o
|
|
150
|
-
key: o
|
|
151
|
-
regType:
|
|
149
|
+
id: o.$id,
|
|
150
|
+
key: o.$key,
|
|
151
|
+
regType: l,
|
|
152
152
|
parentId: void 0,
|
|
153
153
|
getHierarchyId: () => {
|
|
154
154
|
},
|
|
@@ -164,37 +164,37 @@ function Z(e, o) {
|
|
|
164
164
|
},
|
|
165
165
|
bindings: v,
|
|
166
166
|
get msgBus() {
|
|
167
|
-
return
|
|
167
|
+
return O();
|
|
168
168
|
},
|
|
169
169
|
msgBroker: h,
|
|
170
170
|
effects: k,
|
|
171
171
|
// view: componentDef.view,
|
|
172
|
-
View:
|
|
172
|
+
View: w,
|
|
173
173
|
children: b,
|
|
174
|
-
model:
|
|
174
|
+
model: d
|
|
175
175
|
}, e.effects)
|
|
176
176
|
for (const [n, r] of Object.entries(e.effects))
|
|
177
|
-
k[n] =
|
|
177
|
+
k[n] = Q(
|
|
178
178
|
t,
|
|
179
179
|
n,
|
|
180
180
|
r
|
|
181
181
|
);
|
|
182
182
|
return e.events?.onInit && e.events.onInit(t), o.onInit && o.onInit(t), t;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
const t =
|
|
186
|
-
return
|
|
184
|
+
function ie(e, o) {
|
|
185
|
+
const t = G(() => X(e, o));
|
|
186
|
+
return H(() => () => {
|
|
187
187
|
t.current = null;
|
|
188
188
|
}, []), t.current;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function oe(e) {
|
|
191
191
|
return (t) => {
|
|
192
|
-
const
|
|
193
|
-
return /* @__PURE__ */ u.createElement(
|
|
192
|
+
const d = e(t);
|
|
193
|
+
return /* @__PURE__ */ u.createElement(d.View, { ...t });
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
oe as getFC,
|
|
198
|
+
ie as useComponent
|
|
199
199
|
};
|
|
200
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 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,EAA2B,CAAC,GAEtCD,IAAUP,EAAeO,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1D,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;"}
|
|
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 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","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":";;;;;;;;;AAoCA,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,EAA2B,CAAC,GAEtCD,IAAUP,EAAeO,CAAO,IAI/BH,MACDA,IAAS,CAAA;AAGb,QAAMK,IAAON,EAAa;AAC1B,MAAIO,IAASP,EAAa;AAE1B,QAAMQ,wBAAe,IAAA,GAEfC,IAAkBC,EAAK,MAClBC,EAAmBJ,GAAQ,CAACK,MAAY;AAC3C,IAAIA,GAAS,YAAY,SACrBA,EAAQ,WAAWV,EAAU;AAAA,EAErC,CAAC,CACJ;AAED,MAAIW,IAAY;AAAA,IACZ,GAAGb,EAAa;AAAA,EAAA;AAGpB,EAAKa,EAAU,oBACXA,EAAU,kBAAkB,IAAI,gBAAA;AAGpC,QAAMC,IAASC,EAAS,CAACC,MAA8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,GACZC,GAC4B;AAQ5B,SANW,CAAC7D,MAAyD;AAEjE,UAAMqC,IAAIwB,EAAQ7D,CAAM;AAExB,WAAO,gBAAA6B,EAAA,cAACQ,EAAE,MAAF,EAAQ,GAAGrC,GAAQ;AAAA,EAC/B;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageService.d.ts","sourceRoot":"","sources":["../../src/services/StorageService.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,eAAe,EACf,SAAS,EAGZ,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"StorageService.d.ts","sourceRoot":"","sources":["../../src/services/StorageService.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,eAAe,EACf,SAAS,EAGZ,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,KAAK,MAAM,GAAG,eAAe,CACzB,gBAAgB,EAChB;IACI,KAAK,EAAE,iBAAiB,GAAG;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,EAAE;QACN,OAAO,EAAE,kBAAkB,CACvB,kBAAkB,GAAG,kBAAkB,GAAG,qBAAqB,CAClE,CAAC;KACL,CAAC;CACL,CACJ,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,CAAC,MAAM,CAAC,sBA+DhE,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC1C,eAAO,MAAM,gBAAgB,8BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageService.es.js","sources":["../../src/services/StorageService.tsx"],"sourcesContent":["import {\r\n ComponentParams,\r\n ComponentStruct,\r\n Component,\r\n ComponentModel,\r\n ComponentDef,\r\n} from '@/componentModel/contracts';\r\nimport { getFC, useComponent } from '@/componentModel/react';\r\nimport { PersistentStore } from '@actdim/utico/store/persistentStore';\r\nimport { BaseAppMsgChannels, BaseAppMsgStruct
|
|
1
|
+
{"version":3,"file":"StorageService.es.js","sources":["../../src/services/StorageService.tsx"],"sourcesContent":["import {\r\n ComponentParams,\r\n ComponentStruct,\r\n Component,\r\n ComponentModel,\r\n ComponentDef,\r\n} from '@/componentModel/contracts';\r\nimport { getFC, useComponent } from '@/componentModel/react';\r\nimport { PersistentStore } from '@actdim/utico/store/persistentStore';\r\nimport { BaseAppMsgChannels, BaseAppMsgStruct } from '@/appDomain/appContracts';\r\nimport { PropsWithChildren } from 'react';\r\n\r\ntype Struct = ComponentStruct<\r\n BaseAppMsgStruct,\r\n {\r\n props: PropsWithChildren & {\r\n storeName?: string;\r\n };\r\n msgScope: {\r\n provide: BaseAppMsgChannels<\r\n 'APP-KV-STORE-GET' | 'APP-KV-STORE-SET' | 'APP-KV-STORE-REMOVE'\r\n >;\r\n };\r\n }\r\n>;\r\n\r\nexport const useStorageService = (params: ComponentParams<Struct>) => {\r\n let c: Component<Struct>;\r\n let m: ComponentModel<Struct>;\r\n\r\n async function _updateStoreAsync() {\r\n store = await PersistentStore.open(m.storeName);\r\n }\r\n\r\n let store: PersistentStore;\r\n let ready: () => void;\r\n const init = new Promise<void>((res) => {\r\n ready = res;\r\n });\r\n\r\n const def: ComponentDef<Struct> = {\r\n props: {\r\n storeName: '',\r\n },\r\n msgBroker: {\r\n provide: {\r\n 'APP-KV-STORE-GET': {\r\n in: {\r\n callback: async (msg) => {\r\n await init;\r\n const item = await store.get(msg.payload.key);\r\n return item?.data.value;\r\n },\r\n },\r\n },\r\n 'APP-KV-STORE-SET': {\r\n in: {\r\n callback: async (msg) => {\r\n await init;\r\n await store.set(\r\n {\r\n key: msg.payload.key,\r\n },\r\n msg.payload.value,\r\n );\r\n },\r\n },\r\n },\r\n 'APP-KV-STORE-REMOVE': {\r\n in: {\r\n callback: async (msg) => {\r\n await init;\r\n await store.delete(msg.payload.key);\r\n },\r\n },\r\n },\r\n },\r\n },\r\n events: {\r\n onChangeStoreName: () => {\r\n _updateStoreAsync();\r\n },\r\n },\r\n };\r\n\r\n c = useComponent(def, params);\r\n m = c.model;\r\n _updateStoreAsync().then(() => ready());\r\n return c;\r\n};\r\n\r\nexport type StorageServiceStruct = Struct;\r\nexport const StorageServiceFC = getFC(useStorageService);\r\n"],"names":["useStorageService","params","c","m","_updateStoreAsync","store","PersistentStore","ready","init","res","useComponent","msg","StorageServiceFC","getFC"],"mappings":";;AA0BO,MAAMA,IAAoB,CAACC,MAAoC;AAClE,MAAIC,GACAC;AAEJ,iBAAeC,IAAoB;AAC/B,IAAAC,IAAQ,MAAMC,EAAgB,KAAKH,EAAE,SAAS;AAAA,EAClD;AAEA,MAAIE,GACAE;AACJ,QAAMC,IAAO,IAAI,QAAc,CAACC,MAAQ;AACpC,IAAAF,IAAQE;AAAA,EACZ,CAAC;AA+CD,SAAAP,IAAIQ,EA7C8B;AAAA,IAC9B,OAAO;AAAA,MACH,WAAW;AAAA,IAAA;AAAA,IAEf,WAAW;AAAA,MACP,SAAS;AAAA,QACL,oBAAoB;AAAA,UAChB,IAAI;AAAA,YACA,UAAU,OAAOC,OACb,MAAMH,IACO,MAAMH,EAAM,IAAIM,EAAI,QAAQ,GAAG,IAC/B,KAAK;AAAA,UACtB;AAAA,QACJ;AAAA,QAEJ,oBAAoB;AAAA,UAChB,IAAI;AAAA,YACA,UAAU,OAAOA,MAAQ;AACrB,oBAAMH,GACN,MAAMH,EAAM;AAAA,gBACR;AAAA,kBACI,KAAKM,EAAI,QAAQ;AAAA,gBAAA;AAAA,gBAErBA,EAAI,QAAQ;AAAA,cAAA;AAAA,YAEpB;AAAA,UAAA;AAAA,QACJ;AAAA,QAEJ,uBAAuB;AAAA,UACnB,IAAI;AAAA,YACA,UAAU,OAAOA,MAAQ;AACrB,oBAAMH,GACN,MAAMH,EAAM,OAAOM,EAAI,QAAQ,GAAG;AAAA,YACtC;AAAA,UAAA;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,IAEJ,QAAQ;AAAA,MACJ,mBAAmB,MAAM;AACrB,QAAAP,EAAA;AAAA,MACJ;AAAA,IAAA;AAAA,EACJ,GAGkBH,CAAM,GAC5BE,IAAID,EAAE,OACNE,IAAoB,KAAK,MAAMG,GAAO,GAC/BL;AACX,GAGaU,IAAmBC,EAAMb,CAAiB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actdim/dynstruct",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
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",
|