@actdim/dynstruct 1.1.4 → 1.1.5

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.
@@ -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 [$id]?: string;
170
- readonly [$key]?: string;
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
- [$id]?: string;
183
- [$key]?: string;
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;AAEzD,MAAM,MAAM,oBAAoB,CAAC,UAAU,SAAS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,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 o = /* @__PURE__ */ ((n) => (n[n.None = 0] = "None", n[n.FromAncestors = 1] = "FromAncestors", n[n.FromDescendants = 2] = "FromDescendants", n))(o || {});
2
- const s = Symbol("$isBinding"), c = "onGet", $ = "onChanging", N = "onChange", d = Symbol("$id"), a = Symbol("$key");
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
- N as $ON_CHANGE,
5
- $ as $ON_CHANGING,
6
- c as $ON_GET,
7
- d as $id,
8
- s as $isBinding,
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 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 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,EAIH,SAAS,EAET,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EAOlB,MAAM,aAAa,CAAC;AAwWrB,wBAAgB,YAAY,CACxB,OAAO,SAAS,eAAe,GAAG,eAAe,EACjD,WAAW,SAAS,mBAAmB,GAAG,mBAAmB,EAC/D,YAAY,EAAE,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,OAQnF;AAGD,wBAAgB,KAAK,CAAC,OAAO,SAAS,eAAe,EACjD,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC,GAClE,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAS9B"}
1
+ {"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 w, useEffect as x, useMemo as G } from "react";
2
- import { observer as S } from "mobx-react-lite";
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 F } from "../reactHooks.es.js";
4
+ import { useLazyRef as G } from "../reactHooks.es.js";
5
5
  import { getGlobalFlags as f } from "../globals.es.js";
6
- import { useComponentContext as L, ReactComponentContext as z } from "./componentContext.es.js";
7
- import { $id as H, $key as O, $ON_CHANGE as U, $ON_CHANGING as A, $ON_GET as T } from "./contracts.es.js";
8
- import { lazy as _ } from "@actdim/utico/utils";
9
- import { getComponentSourceByCaller as J, getComponentMsgBus as V, toHtmlId as q, registerMsgBroker as K, isBinding as Q, createRecursiveProxy as W, createEffect as X } from "./core.es.js";
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 Y(e) {
13
+ function W(e) {
14
14
  return e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^\/]+/, "");
15
15
  }
16
- function Z(e, o) {
17
- let t, l;
16
+ function X(e, o) {
17
+ let t, d;
18
18
  e || (e = {});
19
- let d = e.regType;
20
- d || (d = J(6), d = Y(d)), o || (o = {});
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(), B = _(() => V(C, (n) => {
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 N = S((n) => {
31
- const r = L(), g = r.currentId;
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[H];
33
+ let i = o.$id;
34
34
  if (!i) {
35
- const y = o[O];
36
- y ? i = `${q(d)}#${y}` : i = r.getNextId(d);
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
- w(() => {
40
+ H(() => {
41
41
  try {
42
- if (r.register(t.id, d, g), f().debug) {
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
- K(t), e.events?.onLayout?.(t), o.onLayout?.(t);
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]), x(() => {
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 = G(
86
+ const c = j(
87
87
  () => ({ ...r, currentId: t.id }),
88
88
  [e, o, r]
89
89
  );
90
- return /* @__PURE__ */ u.createElement(z.Provider, { value: c }, s);
90
+ return /* @__PURE__ */ u.createElement(F.Provider, { value: c }, s);
91
91
  }), b = {};
92
- if (l = {}, e.props && Object.assign(l, e.props), e.actions && Object.assign(l, e.actions), e.children)
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 l && (Q(r) ? v.set(n, r) : Reflect.set(l, n, r));
104
- const E = {
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 R(n) {
114
- const r = `${T}${a(n)}`;
113
+ function B(n) {
114
+ const r = `${U}${a(n)}`;
115
115
  return o[r] || e.events?.[r];
116
116
  }
117
- function M(n) {
118
- const r = `${A}${a(n)}`;
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 j(n) {
125
- const r = `${U}${a(n)}`;
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
- E[n] = {
134
- onGet: R(n),
135
- onChanging: M(n),
136
- onChange: j(n)
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
- $[n] = P.deep;
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
- l = P(l, $, {
144
+ d = P(d, E, {
145
145
  deep: !0
146
- }), l = W(l, v, E);
146
+ }), d = K(d, v, $);
147
147
  let k = {};
148
148
  if (t = {
149
- id: o[H],
150
- key: o[O],
151
- regType: d,
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 B();
167
+ return O();
168
168
  },
169
169
  msgBroker: h,
170
170
  effects: k,
171
171
  // view: componentDef.view,
172
- View: N,
172
+ View: w,
173
173
  children: b,
174
- model: l
174
+ model: d
175
175
  }, e.effects)
176
176
  for (const [n, r] of Object.entries(e.effects))
177
- k[n] = X(
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 se(e, o) {
185
- const t = F(() => Z(e, o));
186
- return w(() => () => {
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 ce(e) {
190
+ function oe(e) {
191
191
  return (t) => {
192
- const l = e(t);
193
- return /* @__PURE__ */ u.createElement(l.View, { ...t });
192
+ const d = e(t);
193
+ return /* @__PURE__ */ u.createElement(d.View, { ...t });
194
194
  };
195
195
  }
196
196
  export {
197
- ce as getFC,
198
- se as useComponent
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,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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AgBC,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,MAA8B;AACnD,UAAMC,IAAUC,EAAA,GACVC,IAAWF,EAAQ;AAQzB,QANAf,EAAU,WAAWiB,GAEhBZ,MACDA,IAASU,EAAQ,SAGjB,CAACf,EAAU,IAAI;AACf,UAAIkB,IAAKnB,EAAO;AAChB,UAAI,CAACmB,GAAI;AACL,cAAMC,IAAMpB,EAAO;AACnB,QAAIoB,IACAD,IAAK,GAAGE,EAASlB,CAAO,CAAC,IAAIiB,CAAG,KAEhCD,IAAKH,EAAQ,UAA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,EAAO;AAAA,IACX,KAAKA,EAAO;AAAA,IACZ,SAAAG;AAAA,IACA,UAAU;AAAA,IACV,gBAAgB,MAAA;AAAA;AAAA,IAChB,cAAc,MAAA;AAAA;AAAA,IACd,YAAY,MAAA;AAAA;AAAA,IACZ,aAAa,MAAA;AAAA;AAAA,IACb,WAAW,MAAA;AAAA;AAAA,IACX,YAAY,MAAA;AAAA;AAAA,IACZ,UAAAI;AAAA,IACA,IAAI,SAAS;AACT,aAAOC,EAAA;AAAA,IACX;AAAA,IACA,WAAAI;AAAA,IACA,SAAA0C;AAAA;AAAA,IAEA,MAAMzC;AAAA,IACN,UAAAqB;AAAA,IACA,OAAAhC;AAAA,EAAA,GAGAH,EAAa;AACb,eAAW,CAACJ,GAAM4D,CAAE,KAAK,OAAO,QAAQxD,EAAa,OAAO;AACxD,MAAAuD,EAAQ3D,CAAI,IAAI6D;AAAA,QACZvD;AAAA,QACAN;AAAA,QACA4D;AAAA,MAAA;AAKZ,SAAIxD,EAAa,QAAQ,UACrBA,EAAa,OAAO,OAAOE,CAAS,GAGpCD,EAAO,UACPA,EAAO,OAAOC,CAAS,GAGpBA;AACX;AAEO,SAASwD,GAGd1D,GAAkDC,GAAkC;AAClF,QAAM0D,IAAMC,EAAW,MAAM7D,EAAgBC,GAAcC,CAAM,CAAC;AAClE,SAAAsB,EAAgB,MACL,MAAM;AACT,IAAAoC,EAAI,UAAU;AAAA,EAClB,GACD,CAAA,CAAE,GACEA,EAAI;AACf;AAGO,SAASE,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;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actdim/dynstruct",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
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",