@actdim/dynstruct 1.1.6 → 1.1.7

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.
Files changed (42) hide show
  1. package/dist/appDomain/appContracts.d.ts +2 -1
  2. package/dist/appDomain/appContracts.d.ts.map +1 -1
  3. package/dist/appDomain/appContracts.es.js.map +1 -1
  4. package/dist/appDomain/security/securityProvider.d.ts.map +1 -1
  5. package/dist/appDomain/security/securityProvider.es.js +48 -50
  6. package/dist/appDomain/security/securityProvider.es.js.map +1 -1
  7. package/dist/componentModel/adapters.d.ts +2 -2
  8. package/dist/componentModel/adapters.d.ts.map +1 -1
  9. package/dist/componentModel/adapters.es.js +10 -12
  10. package/dist/componentModel/adapters.es.js.map +1 -1
  11. package/dist/componentModel/contracts.d.ts +18 -18
  12. package/dist/componentModel/contracts.d.ts.map +1 -1
  13. package/dist/componentModel/contracts.es.js.map +1 -1
  14. package/dist/componentModel/core.d.ts.map +1 -1
  15. package/dist/componentModel/core.es.js +86 -86
  16. package/dist/componentModel/core.es.js.map +1 -1
  17. package/dist/componentModel/react.d.ts.map +1 -1
  18. package/dist/componentModel/react.es.js +130 -136
  19. package/dist/componentModel/react.es.js.map +1 -1
  20. package/dist/services/ServiceProvider.d.ts +6 -4
  21. package/dist/services/ServiceProvider.d.ts.map +1 -1
  22. package/dist/services/ServiceProvider.es.js +8 -13
  23. package/dist/services/ServiceProvider.es.js.map +1 -1
  24. package/dist/services/StorageService.d.ts +5 -14
  25. package/dist/services/StorageService.d.ts.map +1 -1
  26. package/dist/services/StorageService.es.js +37 -48
  27. package/dist/services/StorageService.es.js.map +1 -1
  28. package/dist/services/{NavService.d.ts → react/NavService.d.ts} +3 -3
  29. package/dist/services/react/NavService.d.ts.map +1 -0
  30. package/dist/services/{NavService.es.js → react/NavService.es.js} +2 -2
  31. package/dist/services/react/NavService.es.js.map +1 -0
  32. package/dist/services/react/ServiceProvider.d.ts +7 -0
  33. package/dist/services/react/ServiceProvider.d.ts.map +1 -0
  34. package/dist/services/react/ServiceProvider.es.js +24 -0
  35. package/dist/services/react/ServiceProvider.es.js.map +1 -0
  36. package/dist/services/react/StorageService.d.ts +16 -0
  37. package/dist/services/react/StorageService.d.ts.map +1 -0
  38. package/dist/services/react/StorageService.es.js +55 -0
  39. package/dist/services/react/StorageService.es.js.map +1 -0
  40. package/package.json +1 -1
  41. package/dist/services/NavService.d.ts.map +0 -1
  42. package/dist/services/NavService.es.js.map +0 -1
@@ -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 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
+ {"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 readonly [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 readonly id: string;\r\n readonly key: string;\r\n readonly regType: string;\r\n readonly parentId: string;\r\n // getHierarchyPath?\r\n readonly getHierarchyId: () => string;\r\n readonly getParent: () => string | undefined;\r\n readonly getChildren: () => string[];\r\n readonly getChainUp: () => string[];\r\n readonly getChainDown: () => string[];\r\n readonly getNodeMap: () => Map<string, ComponentTreeNode>;\r\n readonly bindings: Map<PropertyKey, Binding>;\r\n readonly msgBus: MsgBus<ComponentMsgStruct<TStruct>, TMsgHeaders>;\r\n readonly msgBroker: ComponentMsgBroker<TStruct>;\r\n readonly effects: Record<string, EffectController>;\r\n readonly 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: ComponentChildren<TStruct['children']>;\r\n} & 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":"core.d.ts","sourceRoot":"","sources":["../../src/componentModel/core.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,KAAK,EACR,OAAO,EACP,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,gBAA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@ -1,162 +1,162 @@
1
- import { isObservable as k, runInAction as I, toJS as y, autorun as m } from "mobx";
2
- import { $isBinding as p, ComponentMsgFilter as b } from "./contracts.es.js";
3
- function x(e) {
4
- return e[p] === !0;
1
+ import { isObservable as p, runInAction as k, toJS as I, autorun as y } from "mobx";
2
+ import { $isBinding as C, ComponentMsgFilter as g } from "./contracts.es.js";
3
+ function v(e) {
4
+ return e[C] === !0;
5
5
  }
6
- function P(e, c, r, t) {
6
+ function x(e, c, n, t) {
7
7
  return {
8
8
  get: e,
9
9
  set: c,
10
- converter: r,
10
+ converter: n,
11
11
  validator: t,
12
12
  readOnly: !!c,
13
- [p]: !0
13
+ [C]: !0
14
14
  };
15
15
  }
16
- function w(e, c) {
16
+ function P(e, c) {
17
17
  return {
18
18
  get: () => e()[c],
19
- set: (r) => {
20
- e()[c] = r;
19
+ set: (n) => {
20
+ e()[c] = n;
21
21
  },
22
- [p]: !0
22
+ [C]: !0
23
23
  };
24
24
  }
25
- const C = /* @__PURE__ */ new WeakMap();
26
- function F(e, c, r) {
27
- if (typeof e != "object" || e === null || !k(e))
25
+ const h = /* @__PURE__ */ new WeakMap();
26
+ function O(e, c, n) {
27
+ if (typeof e != "object" || e === null || !p(e))
28
28
  return e;
29
- if (C.has(e))
30
- return C.get(e);
29
+ if (h.has(e))
30
+ return h.get(e);
31
31
  const t = new Proxy(e, {
32
- get(o, n, s) {
33
- const i = r[n]?.onGet;
32
+ get(o, r, s) {
33
+ const i = n[r]?.onGet;
34
34
  if (i) return i();
35
- const f = c.get(n);
36
- if (f?.get)
37
- return f.get();
38
- const u = Reflect.get(o, n, s);
39
- return typeof u == "object" && u !== null && k(u) ? F(u, c, r) : u;
35
+ const a = c.get(r);
36
+ if (a?.get)
37
+ return a.get();
38
+ const u = Reflect.get(o, r, s);
39
+ return typeof u == "object" && u !== null && p(u) ? O(u, c, n) : u;
40
40
  },
41
- set(o, n, s, i) {
42
- const f = o[n], u = r[n]?.onChanging;
43
- if (u && u(f, s) === !1 || r.onPropChanging && r.onPropChanging(n, f, s) === !1)
41
+ set(o, r, s, i) {
42
+ const a = o[r], u = n[r]?.onChanging;
43
+ if (u && u(a, s) === !1 || n.onPropChanging && n.onPropChanging(r, a, s) === !1)
44
44
  return !0;
45
- const d = I(() => Reflect.set(o, n, s, i));
46
- return c.get(n)?.set?.(s), r[n]?.onChange?.(s), r.onPropChange?.(n, s), d;
45
+ const d = k(() => Reflect.set(o, r, s, i));
46
+ return c.get(r)?.set?.(s), n[r]?.onChange?.(s), n.onPropChange?.(r, s), d;
47
47
  }
48
48
  });
49
- return C.set(e, t), t;
49
+ return h.set(e, t), t;
50
50
  }
51
- function B(e) {
51
+ function w(e) {
52
52
  return e.split("/").filter(Boolean).map((o) => decodeURIComponent(o)).join("-").normalize("NFKD").replace(/[^a-zA-Z0-9\-_:.+#]/g, "-").replace(/-+/g, "-").replace(/^[^a-zA-Z]+/, "-").replace(/[+#]$/, "-");
53
53
  }
54
- function E(e = 2) {
55
- const r = new Error().stack?.split(`
54
+ function B(e = 2) {
55
+ const n = new Error().stack?.split(`
56
56
  `);
57
- if (!r || r.length <= e)
57
+ if (!n || n.length <= e)
58
58
  return null;
59
- const o = r[e].match(/\(([^)]+)\)/)?.[1];
59
+ const o = n[e].match(/\(([^)]+)\)/)?.[1];
60
60
  return o && document.querySelector('script[type="module"][src*="/@vite/"]') && globalThis.CONFIG_TYPE === "DEVELOPMENT" ? o.replace(/\?[^:]+/, "") : o;
61
61
  }
62
- function N(e = 2) {
63
- const r = new Error().stack?.split(`
62
+ function E(e = 2) {
63
+ const n = new Error().stack?.split(`
64
64
  `);
65
- if (!r || r.length <= e)
65
+ if (!n || n.length <= e)
66
66
  return null;
67
- const o = r[e].trim().match(/^at\s+([^\s(]+)/);
67
+ const o = n[e].trim().match(/^at\s+([^\s(]+)/);
68
68
  if (!o)
69
69
  return null;
70
- const n = o[1], s = n.match(/^use(.+)/);
71
- return s ? s[1] : n;
70
+ const r = o[1], s = r.match(/^use(.+)/);
71
+ return s ? s[1] : r;
72
72
  }
73
- function j(e) {
73
+ function N(e) {
74
74
  const c = e?.msgBroker.provide;
75
75
  if (c)
76
76
  for (const [t, o] of Object.entries(c))
77
- for (const [n, s] of Object.entries(o)) {
78
- const i = s, f = i.callback;
79
- f && (i.callback = (a, l) => f(a, l, e));
80
- const u = i.filter, d = i.componentFilter || b.None, g = (a) => {
81
- let l = !0;
82
- return d & b.FromAncestors && (l = e.getChainUp().indexOf(a.headers?.sourceId) >= 0), l && d & b.FromDescendants && (l = e.getChainDown().indexOf(a.headers?.sourceId) >= 0), l && u && (l = u(a, e)), l;
83
- };
84
- i.filter = g, e.msgBus.provide({
77
+ for (const [r, s] of Object.entries(o)) {
78
+ const i = s, a = i.callback;
79
+ a && (i.callback = (l, f) => a(l, f, e));
80
+ const u = i.filter, d = i.componentFilter || g.None;
81
+ i.filter = (l) => {
82
+ let f = !0;
83
+ return d & g.FromAncestors && (f = e.getChainUp()?.indexOf(l.headers?.sourceId) >= 0), f && d & g.FromDescendants && (f = e.getChainDown()?.indexOf(l.headers?.sourceId) >= 0), f && u && (f = u(l, e)), f;
84
+ }, e.msgBus.provide({
85
85
  ...s,
86
86
  channel: t,
87
- group: n,
87
+ group: r,
88
88
  options: {
89
89
  abortSignal: e.msgBroker.abortController.signal
90
90
  }
91
91
  });
92
92
  }
93
- const r = e?.msgBroker?.subscribe;
94
- if (r)
95
- for (const [t, o] of Object.entries(r))
96
- for (const [n, s] of Object.entries(o)) {
97
- const i = s, f = i.callback;
98
- f && (i.callback = (a) => f(a, e));
99
- const u = i.filter, d = i.componentFilter || b.None, g = (a) => {
100
- let l = !0;
101
- return d & b.FromAncestors && (l = e.getChainUp().indexOf(a.headers?.sourceId) >= 0), l && d & b.FromDescendants && (l = e.getChainDown().indexOf(a.headers?.sourceId) >= 0), l && u && (l = u(a, e)), l;
102
- };
103
- i.filter = g, e.msgBus.on({
93
+ const n = e?.msgBroker?.subscribe;
94
+ if (n)
95
+ for (const [t, o] of Object.entries(n))
96
+ for (const [r, s] of Object.entries(o)) {
97
+ const i = s, a = i.callback;
98
+ a && (i.callback = (l) => a(l, e));
99
+ const u = i.filter, d = i.componentFilter || g.None;
100
+ i.filter = (l) => {
101
+ let f = !0;
102
+ return d & g.FromAncestors && (f = e.getChainUp()?.indexOf(l.headers?.sourceId) >= 0), f && d & g.FromDescendants && (f = e.getChainDown()?.indexOf(l.headers?.sourceId) >= 0), f && u && (f = u(l, e)), f;
103
+ }, e.msgBus.on({
104
104
  ...s,
105
105
  channel: t,
106
- group: n,
106
+ group: r,
107
107
  config: {
108
108
  abortSignal: e.msgBroker.abortController.signal
109
109
  }
110
110
  });
111
111
  }
112
112
  }
113
- function D(e, c) {
114
- const r = (t) => {
115
- t.payload != null && (t.payload = structuredClone(y(t.payload))), t.headers || (t.headers = {}), c?.(t.headers);
113
+ function j(e, c) {
114
+ const n = (t) => {
115
+ t.payload != null && (t.payload = structuredClone(I(t.payload))), t.headers || (t.headers = {}), c?.(t.headers);
116
116
  };
117
117
  return {
118
118
  config: e.config,
119
119
  on: (t) => e.on(t),
120
120
  once: (t) => e.once(t),
121
121
  stream: (t) => e.stream(t),
122
- provide: (t) => (r(t), e.provide(t)),
123
- send: (t) => (r(t), e.send(t)),
124
- request: (t) => (r(t), e.request(t))
122
+ provide: (t) => (n(t), e.provide(t)),
123
+ send: (t) => (n(t), e.send(t)),
124
+ request: (t) => (n(t), e.request(t))
125
125
  };
126
126
  }
127
- function M(e, c, r) {
128
- let t = null, o = !1, n;
127
+ function D(e, c, n) {
128
+ let t = null, o = !1, r;
129
129
  const s = () => {
130
- t || (t = m(
130
+ t || (t = y(
131
131
  () => {
132
132
  if (!o) {
133
- const g = r(e);
134
- typeof g == "function" && (g(), n = g);
133
+ const l = n(e);
134
+ typeof l == "function" && (l(), r = l);
135
135
  }
136
136
  },
137
137
  { name: `effect:${c}` }
138
138
  ));
139
139
  }, i = () => {
140
- t?.(), t = null, n && (n(), n = void 0);
141
- }, f = () => {
140
+ t?.(), t = null, r && (r(), r = void 0);
141
+ }, a = () => {
142
142
  o = !0;
143
143
  }, u = () => {
144
144
  o = !1;
145
145
  }, d = () => {
146
146
  i(), s();
147
147
  };
148
- return s(), { start: s, pause: f, resume: u, stop: i, restart: d };
148
+ return s(), { start: s, pause: a, resume: u, stop: i, restart: d };
149
149
  }
150
150
  export {
151
- P as bind,
152
- w as bindProp,
153
- M as createEffect,
154
- F as createRecursiveProxy,
155
- D as getComponentMsgBus,
156
- N as getComponentNameByCaller,
157
- E as getComponentSourceByCaller,
158
- x as isBinding,
159
- j as registerMsgBroker,
160
- B as toHtmlId
151
+ x as bind,
152
+ P as bindProp,
153
+ D as createEffect,
154
+ O as createRecursiveProxy,
155
+ j as getComponentMsgBus,
156
+ E as getComponentNameByCaller,
157
+ B as getComponentSourceByCaller,
158
+ v as isBinding,
159
+ N as registerMsgBroker,
160
+ w as toHtmlId
161
161
  };
162
162
  //# sourceMappingURL=core.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.es.js","sources":["../../src/componentModel/core.tsx"],"sourcesContent":["import React from 'react';\r\nimport { MsgBus } from '@actdim/msgmesh/contracts';\r\nimport { isObservable, runInAction, toJS, autorun, IReactionDisposer } from 'mobx';\r\nimport type {\r\n Binding,\r\n Component,\r\n ComponentMsgHeaders,\r\n ComponentStruct,\r\n EffectController,\r\n EffectFn,\r\n MsgChannelGroupProviderParams,\r\n MsgChannelGroupSubscriberParams,\r\n PropEventHandlers,\r\n PropValueChangeHandler,\r\n PropValueChangingHandler,\r\n Validator,\r\n ValueConverter,\r\n} from './contracts';\r\nimport { $isBinding, ComponentMsgFilter } from './contracts';\r\nimport { isPlainObject } from 'mobx/dist/internal';\r\n\r\nconst blankView = () => null;\r\n\r\nexport function isBinding(obj: any): obj is Binding {\r\n return obj[$isBinding] === true;\r\n}\r\n\r\nexport function bind<T, TFrom = any>(\r\n get: () => T,\r\n set?: (value: T) => void,\r\n converter?: ValueConverter<T, TFrom>,\r\n validator?: Validator<T>,\r\n): Binding {\r\n return {\r\n get: get,\r\n set: set,\r\n converter: converter,\r\n validator: validator,\r\n readOnly: !!set,\r\n [$isBinding]: true,\r\n };\r\n}\r\n\r\nexport function bindProp<T extends object, P extends keyof T>(target: () => T, prop: P): Binding {\r\n return {\r\n get: () => target()[prop],\r\n set: (value: T[P]) => {\r\n target()[prop] = value;\r\n },\r\n [$isBinding]: true,\r\n };\r\n}\r\n\r\nconst proxyCache = new WeakMap<object, any>();\r\n\r\nexport type ProxyEventHandlers = {\r\n onPropChanging?: PropValueChangingHandler<PropertyKey>;\r\n onPropChange?: PropValueChangeHandler<PropertyKey>;\r\n} & Record<PropertyKey, PropEventHandlers>;\r\n\r\nexport function createRecursiveProxy(\r\n target: any,\r\n bindings: Map<PropertyKey, Binding>,\r\n handlers: ProxyEventHandlers,\r\n) {\r\n if (typeof target !== 'object' || target === null) {\r\n return target;\r\n }\r\n\r\n // isPlainObject\r\n if (!isObservable(target)) {\r\n return target;\r\n }\r\n\r\n if (proxyCache.has(target)) {\r\n return proxyCache.get(target);\r\n }\r\n\r\n const proxy = new Proxy(target, {\r\n get(obj, prop, receiver) {\r\n // 1. custom handlers\r\n const onGet = handlers[prop]?.onGet;\r\n if (onGet) return onGet();\r\n\r\n // 2. bindings\r\n const binding = bindings.get(prop);\r\n if (binding?.get) {\r\n return binding.get();\r\n }\r\n\r\n const value = Reflect.get(obj, prop, receiver);\r\n\r\n if (typeof value === 'object' && value !== null && isObservable(value)) {\r\n return createRecursiveProxy(value, bindings, handlers);\r\n }\r\n\r\n return value;\r\n },\r\n\r\n set(obj, prop, value, receiver) {\r\n const oldValue = obj[prop];\r\n\r\n // before-change hooks\r\n const onChanging = handlers[prop]?.onChanging;\r\n if (onChanging && onChanging(oldValue, value) === false) {\r\n return true;\r\n }\r\n\r\n if (\r\n handlers.onPropChanging &&\r\n handlers.onPropChanging(prop, oldValue, value) === false\r\n ) {\r\n return true;\r\n }\r\n\r\n const result = runInAction(() => {\r\n return Reflect.set(obj, prop, value, receiver);\r\n });\r\n\r\n // bindings\r\n const binding = bindings.get(prop);\r\n binding?.set?.(value);\r\n\r\n // after-change hooks\r\n handlers[prop]?.onChange?.(value);\r\n handlers.onPropChange?.(prop, value);\r\n\r\n return result;\r\n },\r\n });\r\n\r\n proxyCache.set(target, proxy);\r\n return proxy;\r\n}\r\n\r\nexport function toHtmlId(url: string): string {\r\n let parts = url\r\n .split('/')\r\n .filter(Boolean)\r\n .map((segment) => decodeURIComponent(segment));\r\n\r\n const raw = parts.join('-');\r\n // sanitize\r\n let id = raw\r\n .normalize('NFKD')\r\n .replace(/[^a-zA-Z0-9\\-_:.+#]/g, '-')\r\n .replace(/-+/g, '-')\r\n .replace(/^[^a-zA-Z]+/, '-')\r\n // .replace(/:/g, '-')\r\n // .replace(/\\./g, '_')\r\n // .replace(/#/g, '-')\r\n .replace(/[+#]$/, '-');\r\n return id;\r\n}\r\n\r\nexport function getComponentSourceByCaller(depth = 2): string | null {\r\n const err = new Error();\r\n const stack = err.stack?.split('\\n');\r\n if (!stack || stack.length <= depth) {\r\n return null;\r\n }\r\n const match = stack[depth].match(/\\(([^)]+)\\)/);\r\n const result = match?.[1];\r\n if (result) {\r\n if (\r\n document.querySelector('script[type=\"module\"][src*=\"/@vite/\"]') &&\r\n globalThis['CONFIG_TYPE'] === 'DEVELOPMENT'\r\n ) {\r\n return result.replace(/\\?[^:]+/, '');\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nexport function getComponentNameByCaller(depth = 2): string | null {\r\n const err = new Error();\r\n const stack = err.stack?.split('\\n');\r\n if (!stack || stack.length <= depth) {\r\n return null;\r\n }\r\n const line = stack[depth].trim();\r\n const match = line.match(/^at\\s+([^\\s(]+)/);\r\n if (!match) {\r\n return null;\r\n }\r\n const fnName = match[1];\r\n const hookMatch = fnName.match(/^use(.+)/);\r\n if (hookMatch) {\r\n return hookMatch[1];\r\n }\r\n return fnName;\r\n}\r\n\r\nexport function registerMsgBroker<TStruct extends ComponentStruct = ComponentStruct>(\r\n component: Component<TStruct>,\r\n) {\r\n const providers = component?.msgBroker.provide;\r\n if (providers) {\r\n for (const [channel, providerGroups] of Object.entries(providers)) {\r\n for (const [g, p] of Object.entries(providerGroups)) {\r\n const provider = p as MsgChannelGroupProviderParams;\r\n const callback = provider.callback;\r\n if (callback) {\r\n provider.callback = (msg, headers) => {\r\n return callback(msg, headers, component);\r\n };\r\n }\r\n const filter = provider.filter;\r\n const componentFilter = provider.componentFilter || ComponentMsgFilter.None;\r\n const msgFilter = (msg) => {\r\n let result = true;\r\n if (componentFilter & ComponentMsgFilter.FromAncestors) {\r\n const ancestorIds = component.getChainUp();\r\n result = ancestorIds.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && componentFilter & ComponentMsgFilter.FromDescendants) {\r\n const ancestorIds = component.getChainDown();\r\n result = ancestorIds.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && filter) {\r\n result = filter(msg, component);\r\n }\r\n return result;\r\n };\r\n provider.filter = msgFilter;\r\n\r\n component.msgBus.provide({\r\n ...p,\r\n channel: channel,\r\n group: g,\r\n options: {\r\n abortSignal: component.msgBroker.abortController.signal,\r\n },\r\n });\r\n }\r\n }\r\n }\r\n const subscribers = component?.msgBroker?.subscribe;\r\n if (subscribers) {\r\n for (const [channel, subscriberGroups] of Object.entries(subscribers)) {\r\n for (const [g, s] of Object.entries(subscriberGroups)) {\r\n const subscriber = s as MsgChannelGroupSubscriberParams;\r\n const callback = subscriber.callback;\r\n if (callback) {\r\n subscriber.callback = (msg) => {\r\n return callback(msg, component);\r\n };\r\n }\r\n const filter = subscriber.filter;\r\n const componentFilter = subscriber.componentFilter || ComponentMsgFilter.None;\r\n const msgFilter = (msg) => {\r\n let result = true;\r\n if (componentFilter & ComponentMsgFilter.FromAncestors) {\r\n const ancestorIds = component.getChainUp();\r\n result = ancestorIds.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && componentFilter & ComponentMsgFilter.FromDescendants) {\r\n const ancestorIds = component.getChainDown();\r\n result = ancestorIds.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && filter) {\r\n result = filter(msg, component);\r\n }\r\n return result;\r\n };\r\n subscriber.filter = msgFilter;\r\n\r\n component.msgBus.on({\r\n ...s,\r\n channel: channel,\r\n group: g,\r\n config: {\r\n abortSignal: component.msgBroker.abortController.signal,\r\n },\r\n });\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function getComponentMsgBus<TStruct extends ComponentStruct = ComponentStruct>(\r\n msgBus: MsgBus<TStruct['msg']>,\r\n headerSetter: (headers?: ComponentMsgHeaders) => void,\r\n) {\r\n const updateParams = (params: { payload?: any; headers?: ComponentMsgHeaders }) => {\r\n if (params.payload != undefined) {\r\n params.payload = structuredClone(toJS(params.payload)); // always?\r\n }\r\n if (!params.headers) {\r\n params.headers = {};\r\n }\r\n headerSetter?.(params.headers);\r\n };\r\n return {\r\n config: msgBus.config,\r\n on: (params) => {\r\n return msgBus.on(params);\r\n },\r\n once: (params) => {\r\n return msgBus.once(params);\r\n },\r\n stream: (params) => {\r\n return msgBus.stream(params);\r\n },\r\n provide: (params) => {\r\n updateParams(params);\r\n return msgBus.provide(params);\r\n },\r\n send: (params) => {\r\n updateParams(params);\r\n return msgBus.send(params);\r\n },\r\n request: (params) => {\r\n updateParams(params);\r\n return msgBus.request(params);\r\n },\r\n } as MsgBus<TStruct['msg']>;\r\n}\r\n\r\nexport function createEffect<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n>(\r\n component: Component<TStruct, TMsgHeaders>,\r\n name: string,\r\n fn: EffectFn<TStruct, TMsgHeaders>,\r\n): EffectController {\r\n let disposer: IReactionDisposer | null = null;\r\n let paused = false;\r\n let effectCleanup: () => void = undefined;\r\n\r\n const start = () => {\r\n if (disposer) {\r\n return;\r\n }\r\n\r\n disposer = autorun(\r\n () => {\r\n if (!paused) {\r\n const cleanup = fn(component);\r\n if (typeof cleanup === 'function') {\r\n cleanup();\r\n effectCleanup = cleanup;\r\n }\r\n }\r\n },\r\n { name: `effect:${name}` },\r\n );\r\n };\r\n\r\n const stop = () => {\r\n disposer?.();\r\n disposer = null;\r\n if (effectCleanup) {\r\n effectCleanup();\r\n effectCleanup = undefined;\r\n }\r\n };\r\n\r\n const pause = () => {\r\n paused = true;\r\n };\r\n\r\n const resume = () => {\r\n paused = false;\r\n };\r\n\r\n const restart = () => {\r\n stop();\r\n start();\r\n };\r\n\r\n start();\r\n\r\n return { start, pause, resume, stop, restart };\r\n}\r\n\r\n// TODO: move to utico\r\n// function asyncToGeneratorFlow(asyncFn: (...args: any[]) => Promise<any>) {\r\n// return function* (...args: any[]) {\r\n// const result = yield asyncFn(...args);\r\n// return result;\r\n// };\r\n// }\r\n"],"names":["isBinding","obj","$isBinding","bind","get","set","converter","validator","bindProp","target","prop","value","proxyCache","createRecursiveProxy","bindings","handlers","isObservable","proxy","receiver","onGet","binding","oldValue","onChanging","result","runInAction","toHtmlId","url","segment","getComponentSourceByCaller","depth","stack","getComponentNameByCaller","match","fnName","hookMatch","registerMsgBroker","component","providers","channel","providerGroups","g","p","provider","callback","msg","headers","filter","componentFilter","ComponentMsgFilter","msgFilter","subscribers","subscriberGroups","subscriber","getComponentMsgBus","msgBus","headerSetter","updateParams","params","toJS","createEffect","name","fn","disposer","paused","effectCleanup","start","autorun","cleanup","stop","pause","resume","restart"],"mappings":";;AAuBO,SAASA,EAAUC,GAA0B;AAChD,SAAOA,EAAIC,CAAU,MAAM;AAC/B;AAEO,SAASC,EACZC,GACAC,GACAC,GACAC,GACO;AACP,SAAO;AAAA,IACH,KAAAH;AAAA,IACA,KAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAU,CAAC,CAACF;AAAA,IACZ,CAACH,CAAU,GAAG;AAAA,EAAA;AAEtB;AAEO,SAASM,EAA8CC,GAAiBC,GAAkB;AAC7F,SAAO;AAAA,IACH,KAAK,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AAAA,MACA,EAAE,MAAM,UAAUP,CAAI,GAAA;AAAA,IAAG;AAAA,EAEjC,GAEMQ,IAAO,MAAM;AACf,IAAAN,IAAA,GACAA,IAAW,MACPE,MACAA,EAAA,GACAA,IAAgB;AAAA,EAExB,GAEMK,IAAQ,MAAM;AAChB,IAAAN,IAAS;AAAA,EACb,GAEMO,IAAS,MAAM;AACjB,IAAAP,IAAS;AAAA,EACb,GAEMQ,IAAU,MAAM;AAClB,IAAAH,EAAA,GACAH,EAAA;AAAA,EACJ;AAEA,SAAAA,EAAA,GAEO,EAAE,OAAAA,GAAO,OAAAI,GAAO,QAAAC,GAAQ,MAAAF,GAAM,SAAAG,EAAA;AACzC;"}
1
+ {"version":3,"file":"core.es.js","sources":["../../src/componentModel/core.tsx"],"sourcesContent":["import React from 'react';\r\nimport { MsgBus } from '@actdim/msgmesh/contracts';\r\nimport { isObservable, runInAction, toJS, autorun, IReactionDisposer } from 'mobx';\r\nimport type {\r\n Binding,\r\n Component,\r\n ComponentMsgHeaders,\r\n ComponentStruct,\r\n EffectController,\r\n EffectFn,\r\n MsgChannelGroupProviderParams,\r\n MsgChannelGroupSubscriberParams,\r\n PropEventHandlers,\r\n PropValueChangeHandler,\r\n PropValueChangingHandler,\r\n Validator,\r\n ValueConverter,\r\n} from './contracts';\r\nimport { $isBinding, ComponentMsgFilter } from './contracts';\r\nimport { isPlainObject } from 'mobx/dist/internal';\r\n\r\nconst blankView = () => null;\r\n\r\nexport function isBinding(obj: any): obj is Binding {\r\n return obj[$isBinding] === true;\r\n}\r\n\r\nexport function bind<T, TFrom = any>(\r\n get: () => T,\r\n set?: (value: T) => void,\r\n converter?: ValueConverter<T, TFrom>,\r\n validator?: Validator<T>,\r\n): Binding {\r\n return {\r\n get: get,\r\n set: set,\r\n converter: converter,\r\n validator: validator,\r\n readOnly: !!set,\r\n [$isBinding]: true,\r\n };\r\n}\r\n\r\nexport function bindProp<T extends object, P extends keyof T>(target: () => T, prop: P): Binding {\r\n return {\r\n get: () => target()[prop],\r\n set: (value: T[P]) => {\r\n target()[prop] = value;\r\n },\r\n [$isBinding]: true,\r\n };\r\n}\r\n\r\nconst proxyCache = new WeakMap<object, any>();\r\n\r\nexport type ProxyEventHandlers = {\r\n onPropChanging?: PropValueChangingHandler<PropertyKey>;\r\n onPropChange?: PropValueChangeHandler<PropertyKey>;\r\n} & Record<PropertyKey, PropEventHandlers>;\r\n\r\nexport function createRecursiveProxy(\r\n target: any,\r\n bindings: Map<PropertyKey, Binding>,\r\n handlers: ProxyEventHandlers,\r\n) {\r\n if (typeof target !== 'object' || target === null) {\r\n return target;\r\n }\r\n\r\n // isPlainObject\r\n if (!isObservable(target)) {\r\n return target;\r\n }\r\n\r\n if (proxyCache.has(target)) {\r\n return proxyCache.get(target);\r\n }\r\n\r\n const proxy = new Proxy(target, {\r\n get(obj, prop, receiver) {\r\n // 1. custom handlers\r\n const onGet = handlers[prop]?.onGet;\r\n if (onGet) return onGet();\r\n\r\n // 2. bindings\r\n const binding = bindings.get(prop);\r\n if (binding?.get) {\r\n return binding.get();\r\n }\r\n\r\n const value = Reflect.get(obj, prop, receiver);\r\n\r\n if (typeof value === 'object' && value !== null && isObservable(value)) {\r\n return createRecursiveProxy(value, bindings, handlers);\r\n }\r\n\r\n return value;\r\n },\r\n\r\n set(obj, prop, value, receiver) {\r\n const oldValue = obj[prop];\r\n\r\n // before-change hooks\r\n const onChanging = handlers[prop]?.onChanging;\r\n if (onChanging && onChanging(oldValue, value) === false) {\r\n return true;\r\n }\r\n\r\n if (\r\n handlers.onPropChanging &&\r\n handlers.onPropChanging(prop, oldValue, value) === false\r\n ) {\r\n return true;\r\n }\r\n\r\n const result = runInAction(() => {\r\n return Reflect.set(obj, prop, value, receiver);\r\n });\r\n\r\n // bindings\r\n const binding = bindings.get(prop);\r\n binding?.set?.(value);\r\n\r\n // after-change hooks\r\n handlers[prop]?.onChange?.(value);\r\n handlers.onPropChange?.(prop, value);\r\n\r\n return result;\r\n },\r\n });\r\n\r\n proxyCache.set(target, proxy);\r\n return proxy;\r\n}\r\n\r\nexport function toHtmlId(url: string): string {\r\n let parts = url\r\n .split('/')\r\n .filter(Boolean)\r\n .map((segment) => decodeURIComponent(segment));\r\n\r\n const raw = parts.join('-');\r\n // sanitize\r\n let id = raw\r\n .normalize('NFKD')\r\n .replace(/[^a-zA-Z0-9\\-_:.+#]/g, '-')\r\n .replace(/-+/g, '-')\r\n .replace(/^[^a-zA-Z]+/, '-')\r\n // .replace(/:/g, '-')\r\n // .replace(/\\./g, '_')\r\n // .replace(/#/g, '-')\r\n .replace(/[+#]$/, '-');\r\n return id;\r\n}\r\n\r\nexport function getComponentSourceByCaller(depth = 2): string | null {\r\n const err = new Error();\r\n const stack = err.stack?.split('\\n');\r\n if (!stack || stack.length <= depth) {\r\n return null;\r\n }\r\n const match = stack[depth].match(/\\(([^)]+)\\)/);\r\n const result = match?.[1];\r\n if (result) {\r\n if (\r\n document.querySelector('script[type=\"module\"][src*=\"/@vite/\"]') &&\r\n globalThis['CONFIG_TYPE'] === 'DEVELOPMENT'\r\n ) {\r\n return result.replace(/\\?[^:]+/, '');\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nexport function getComponentNameByCaller(depth = 2): string | null {\r\n const err = new Error();\r\n const stack = err.stack?.split('\\n');\r\n if (!stack || stack.length <= depth) {\r\n return null;\r\n }\r\n const line = stack[depth].trim();\r\n const match = line.match(/^at\\s+([^\\s(]+)/);\r\n if (!match) {\r\n return null;\r\n }\r\n const fnName = match[1];\r\n const hookMatch = fnName.match(/^use(.+)/);\r\n if (hookMatch) {\r\n return hookMatch[1];\r\n }\r\n return fnName;\r\n}\r\n\r\nexport function registerMsgBroker<TStruct extends ComponentStruct = ComponentStruct>(\r\n component: Component<TStruct>,\r\n) {\r\n const providers = component?.msgBroker.provide;\r\n if (providers) {\r\n for (const [channel, providerGroups] of Object.entries(providers)) {\r\n for (const [g, p] of Object.entries(providerGroups)) {\r\n const provider = p as MsgChannelGroupProviderParams;\r\n const callback = provider.callback;\r\n if (callback) {\r\n provider.callback = (msg, headers) => {\r\n return callback(msg, headers, component);\r\n };\r\n }\r\n const filter = provider.filter;\r\n const componentFilter = provider.componentFilter || ComponentMsgFilter.None;\r\n provider.filter = (msg) => {\r\n let result = true;\r\n if (componentFilter & ComponentMsgFilter.FromAncestors) {\r\n const ancestorIds = component.getChainUp();\r\n result = ancestorIds?.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && componentFilter & ComponentMsgFilter.FromDescendants) {\r\n const descendantIds = component.getChainDown();\r\n result = descendantIds?.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && filter) {\r\n result = filter(msg, component);\r\n }\r\n return result;\r\n };\r\n\r\n component.msgBus.provide({\r\n ...p,\r\n channel: channel,\r\n group: g,\r\n options: {\r\n abortSignal: component.msgBroker.abortController.signal,\r\n },\r\n });\r\n }\r\n }\r\n }\r\n const subscribers = component?.msgBroker?.subscribe;\r\n if (subscribers) {\r\n for (const [channel, subscriberGroups] of Object.entries(subscribers)) {\r\n for (const [g, s] of Object.entries(subscriberGroups)) {\r\n const subscriber = s as MsgChannelGroupSubscriberParams;\r\n const callback = subscriber.callback;\r\n if (callback) {\r\n subscriber.callback = (msg) => {\r\n return callback(msg, component);\r\n };\r\n }\r\n const filter = subscriber.filter;\r\n const componentFilter = subscriber.componentFilter || ComponentMsgFilter.None;\r\n subscriber.filter = (msg) => {\r\n let result = true;\r\n if (componentFilter & ComponentMsgFilter.FromAncestors) {\r\n const ancestorIds = component.getChainUp();\r\n result = ancestorIds?.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && componentFilter & ComponentMsgFilter.FromDescendants) {\r\n const descendantIds = component.getChainDown();\r\n result = descendantIds?.indexOf(msg.headers?.sourceId) >= 0;\r\n }\r\n if (result && filter) {\r\n result = filter(msg, component);\r\n }\r\n return result;\r\n };\r\n\r\n component.msgBus.on({\r\n ...s,\r\n channel: channel,\r\n group: g,\r\n config: {\r\n abortSignal: component.msgBroker.abortController.signal,\r\n },\r\n });\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function getComponentMsgBus<TStruct extends ComponentStruct = ComponentStruct>(\r\n msgBus: MsgBus<TStruct['msg']>,\r\n headerSetter: (headers?: ComponentMsgHeaders) => void,\r\n) {\r\n const updateParams = (params: { payload?: any; headers?: ComponentMsgHeaders }) => {\r\n if (params.payload != undefined) {\r\n params.payload = structuredClone(toJS(params.payload)); // always?\r\n }\r\n if (!params.headers) {\r\n params.headers = {};\r\n }\r\n headerSetter?.(params.headers);\r\n };\r\n return {\r\n config: msgBus.config,\r\n on: (params) => {\r\n return msgBus.on(params);\r\n },\r\n once: (params) => {\r\n return msgBus.once(params);\r\n },\r\n stream: (params) => {\r\n return msgBus.stream(params);\r\n },\r\n provide: (params) => {\r\n updateParams(params);\r\n return msgBus.provide(params);\r\n },\r\n send: (params) => {\r\n updateParams(params);\r\n return msgBus.send(params);\r\n },\r\n request: (params) => {\r\n updateParams(params);\r\n return msgBus.request(params);\r\n },\r\n } as MsgBus<TStruct['msg']>;\r\n}\r\n\r\nexport function createEffect<\r\n TStruct extends ComponentStruct,\r\n TMsgHeaders extends ComponentMsgHeaders = ComponentMsgHeaders,\r\n>(\r\n component: Component<TStruct, TMsgHeaders>,\r\n name: string,\r\n fn: EffectFn<TStruct, TMsgHeaders>,\r\n): EffectController {\r\n let disposer: IReactionDisposer | null = null;\r\n let paused = false;\r\n let effectCleanup: () => void = undefined;\r\n\r\n const start = () => {\r\n if (disposer) {\r\n return;\r\n }\r\n\r\n disposer = autorun(\r\n () => {\r\n if (!paused) {\r\n const cleanup = fn(component);\r\n if (typeof cleanup === 'function') {\r\n cleanup();\r\n effectCleanup = cleanup;\r\n }\r\n }\r\n },\r\n { name: `effect:${name}` },\r\n );\r\n };\r\n\r\n const stop = () => {\r\n disposer?.();\r\n disposer = null;\r\n if (effectCleanup) {\r\n effectCleanup();\r\n effectCleanup = undefined;\r\n }\r\n };\r\n\r\n const pause = () => {\r\n paused = true;\r\n };\r\n\r\n const resume = () => {\r\n paused = false;\r\n };\r\n\r\n const restart = () => {\r\n stop();\r\n start();\r\n };\r\n\r\n start();\r\n\r\n return { start, pause, resume, stop, restart };\r\n}\r\n\r\n// TODO: move to utico\r\n// function asyncToGeneratorFlow(asyncFn: (...args: any[]) => Promise<any>) {\r\n// return function* (...args: any[]) {\r\n// const result = yield asyncFn(...args);\r\n// return result;\r\n// };\r\n// }\r\n"],"names":["isBinding","obj","$isBinding","bind","get","set","converter","validator","bindProp","target","prop","value","proxyCache","createRecursiveProxy","bindings","handlers","isObservable","proxy","receiver","onGet","binding","oldValue","onChanging","result","runInAction","toHtmlId","url","segment","getComponentSourceByCaller","depth","stack","getComponentNameByCaller","match","fnName","hookMatch","registerMsgBroker","component","providers","channel","providerGroups","g","p","provider","callback","msg","headers","filter","componentFilter","ComponentMsgFilter","subscribers","subscriberGroups","subscriber","getComponentMsgBus","msgBus","headerSetter","updateParams","params","toJS","createEffect","name","fn","disposer","paused","effectCleanup","start","autorun","cleanup","stop","pause","resume","restart"],"mappings":";;AAuBO,SAASA,EAAUC,GAA0B;AAChD,SAAOA,EAAIC,CAAU,MAAM;AAC/B;AAEO,SAASC,EACZC,GACAC,GACAC,GACAC,GACO;AACP,SAAO;AAAA,IACH,KAAAH;AAAA,IACA,KAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAU,CAAC,CAACF;AAAA,IACZ,CAACH,CAAU,GAAG;AAAA,EAAA;AAEtB;AAEO,SAASM,EAA8CC,GAAiBC,GAAkB;AAC7F,SAAO;AAAA,IACH,KAAK,MAAMD,EAAA,EAASC,CAAI;AAAA,IACxB,KAAK,CAACC,MAAgB;AAClB,MAAAF,EAAA,EAASC,CAAI,IAAIC;AAAA,IACrB;AAAA,IACA,CAACT,CAAU,GAAG;AAAA,EAAA;AAEtB;AAEA,MAAMU,wBAAiB,QAAA;AAOhB,SAASC,EACZJ,GACAK,GACAC,GACF;AAME,MALI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ACb,GAEMQ,IAAU,MAAM;AAClB,IAAAH,EAAA,GACAH,EAAA;AAAA,EACJ;AAEA,SAAAA,EAAA,GAEO,EAAE,OAAAA,GAAO,OAAAI,GAAO,QAAAC,GAAQ,MAAAF,GAAM,SAAAG,EAAA;AACzC;"}
@@ -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,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
+ {"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;AAmWrB,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,CAQ9B"}