| import { A as Atom, S as Signal } from './types-CxOJPpKX.js'; | ||
| import { B as BaseControllerContext, E as ExtensionFn, i as ExtensionParamsProvider, b as ControllerContext, C as Controller, c as ControllerDeclaration, m as BaseController } from './controller-BVEgCAYk.js'; | ||
| type AnyObject = Record<string, any>; | ||
| /** | ||
| * ViewProps are the properties that are provided to the view | ||
| */ | ||
| type ViewProps = Record<string, unknown>; | ||
| /** | ||
| * ViewPropAtoms are the atoms wit View's props that are provided | ||
| * to the controller by the ViewBinding | ||
| */ | ||
| type ViewPropAtoms<TProps extends ViewProps> = TProps extends Record<string, never> ? Record<string, never> : Readonly<{ | ||
| [K in keyof TProps]: Atom<TProps[K]>; | ||
| }>; | ||
| type ViewStatus = 'unmounted' | 'mounted' | 'destroyed'; | ||
| /** | ||
| * ViewBinding is the binding between the controller and the view | ||
| */ | ||
| type ViewBinding<TProps extends ViewProps> = { | ||
| /** | ||
| * View's props | ||
| */ | ||
| readonly props: ViewPropAtoms<TProps>; | ||
| readonly status: Atom<ViewStatus>; | ||
| /** | ||
| * Signals that the view has been mounted | ||
| */ | ||
| readonly onMount: Signal<void>; | ||
| /** | ||
| * Signals that the view has been updated. | ||
| * | ||
| * Partial<TProps> is the properties that were updated. | ||
| */ | ||
| readonly onUpdate: Signal<Partial<TProps>>; | ||
| /** | ||
| * Signals that the view has been unmounted. | ||
| */ | ||
| readonly onUnmount: Signal<void>; | ||
| }; | ||
| /** | ||
| * ViewControllerContext is the context with the view binding | ||
| * that is provided to the controller | ||
| */ | ||
| type ViewControllerContext<TProps extends ViewProps = ViewProps> = BaseControllerContext & { | ||
| view: ViewBinding<TProps>; | ||
| }; | ||
| /** | ||
| * Utility type to infer the view props from the controller context | ||
| */ | ||
| type InferViewPropsFromControllerContext<TContext extends BaseControllerContext, ElseType> = TContext extends ViewControllerContext<infer InferredProps> ? InferredProps : ElseType; | ||
| /** | ||
| * withView is an extension that provides the view to the controller | ||
| */ | ||
| declare function withView<TProps extends ViewProps = ViewProps>(): ExtensionFn<BaseControllerContext, ViewControllerContext<TProps>>; | ||
| /** | ||
| * Provides the view binding to the controller | ||
| */ | ||
| declare function provideView(view: ViewBinding<any>): ExtensionParamsProvider; | ||
| type BaseViewModel = Record<string, unknown> & { | ||
| props?: Record<string, Atom<unknown>>; | ||
| state?: Record<string, Atom<unknown>>; | ||
| }; | ||
| type ViewModel<T extends BaseViewModel> = T; | ||
| type InferViewModelProps<TViewModel extends BaseViewModel> = TViewModel['props'] extends ViewPropAtoms<infer InferredProps> ? InferredProps : AnyObject; | ||
| type ViewModelFactory<TContext extends BaseControllerContext, TViewModel extends BaseViewModel> = (context: ControllerContext<TContext>) => Omit<TViewModel, 'props'>; | ||
| declare abstract class BaseViewController<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> extends BaseController<TContext> { | ||
| readonly view: TContext['view']; | ||
| readonly props: TContext['view']['props']; | ||
| abstract readonly state: Exclude<TViewModel['state'], undefined>; | ||
| constructor(paramsOrProviders: TContext['params'] | ReadonlyArray<ExtensionParamsProvider>, extensions: ReadonlyArray<ExtensionFn<any, any>>); | ||
| } | ||
| type ViewModelDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| /** @internal Keep the type for inference */ | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): Controller<TViewModel>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): Controller<TViewModel>; | ||
| }; | ||
| type ViewModelClassDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): BaseViewController<TViewModel, TContext>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): BaseViewController<TViewModel, TContext>; | ||
| }; | ||
| declare class ViewModelDeclarationBuilder<TContext extends BaseControllerContext> { | ||
| readonly extensions: Array<ExtensionFn<any, any>>; | ||
| constructor(extensions?: Array<ExtensionFn<any, any>>); | ||
| extend<TResultContext extends TContext>(extension: ExtensionFn<TContext, TResultContext>): ViewModelDeclarationBuilder<TResultContext>; | ||
| apply<TViewModel extends BaseViewModel>(factory: ViewModelFactory<TContext & ViewControllerContext<InferViewModelProps<TViewModel>>, TViewModel>): ViewModelDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| getBaseClass<TViewModel extends BaseViewModel>(): ViewModelClassDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| } | ||
| declare function declareViewModel<TViewModel extends BaseViewModel, TViewModelProps extends ViewProps = InferViewModelProps<TViewModel>>(factory: ViewModelFactory<ViewControllerContext<TViewModelProps>, TViewModel>): ControllerDeclaration<ViewControllerContext<TViewModelProps>, TViewModel>; | ||
| declare function declareViewModel(): ViewModelDeclarationBuilder<BaseControllerContext>; | ||
| export { type BaseViewModel as B, type InferViewPropsFromControllerContext as I, type ViewProps as V, type ViewBinding as a, type ViewModel as b, type ViewModelFactory as c, type ViewModelDeclaration as d, type ViewModelClassDeclaration as e, declareViewModel as f, type ViewPropAtoms as g, type ViewStatus as h, type ViewControllerContext as i, type InferViewModelProps as j, provideView as p, withView as w }; |
| import { A as Atom, S as Signal } from './types-CxOJPpKX.cjs'; | ||
| import { B as BaseControllerContext, E as ExtensionFn, i as ExtensionParamsProvider, b as ControllerContext, C as Controller, c as ControllerDeclaration, m as BaseController } from './controller-BeiM0Zjy.cjs'; | ||
| type AnyObject = Record<string, any>; | ||
| /** | ||
| * ViewProps are the properties that are provided to the view | ||
| */ | ||
| type ViewProps = Record<string, unknown>; | ||
| /** | ||
| * ViewPropAtoms are the atoms wit View's props that are provided | ||
| * to the controller by the ViewBinding | ||
| */ | ||
| type ViewPropAtoms<TProps extends ViewProps> = TProps extends Record<string, never> ? Record<string, never> : Readonly<{ | ||
| [K in keyof TProps]: Atom<TProps[K]>; | ||
| }>; | ||
| type ViewStatus = 'unmounted' | 'mounted' | 'destroyed'; | ||
| /** | ||
| * ViewBinding is the binding between the controller and the view | ||
| */ | ||
| type ViewBinding<TProps extends ViewProps> = { | ||
| /** | ||
| * View's props | ||
| */ | ||
| readonly props: ViewPropAtoms<TProps>; | ||
| readonly status: Atom<ViewStatus>; | ||
| /** | ||
| * Signals that the view has been mounted | ||
| */ | ||
| readonly onMount: Signal<void>; | ||
| /** | ||
| * Signals that the view has been updated. | ||
| * | ||
| * Partial<TProps> is the properties that were updated. | ||
| */ | ||
| readonly onUpdate: Signal<Partial<TProps>>; | ||
| /** | ||
| * Signals that the view has been unmounted. | ||
| */ | ||
| readonly onUnmount: Signal<void>; | ||
| }; | ||
| /** | ||
| * ViewControllerContext is the context with the view binding | ||
| * that is provided to the controller | ||
| */ | ||
| type ViewControllerContext<TProps extends ViewProps = ViewProps> = BaseControllerContext & { | ||
| view: ViewBinding<TProps>; | ||
| }; | ||
| /** | ||
| * Utility type to infer the view props from the controller context | ||
| */ | ||
| type InferViewPropsFromControllerContext<TContext extends BaseControllerContext, ElseType> = TContext extends ViewControllerContext<infer InferredProps> ? InferredProps : ElseType; | ||
| /** | ||
| * withView is an extension that provides the view to the controller | ||
| */ | ||
| declare function withView<TProps extends ViewProps = ViewProps>(): ExtensionFn<BaseControllerContext, ViewControllerContext<TProps>>; | ||
| /** | ||
| * Provides the view binding to the controller | ||
| */ | ||
| declare function provideView(view: ViewBinding<any>): ExtensionParamsProvider; | ||
| type BaseViewModel = Record<string, unknown> & { | ||
| props?: Record<string, Atom<unknown>>; | ||
| state?: Record<string, Atom<unknown>>; | ||
| }; | ||
| type ViewModel<T extends BaseViewModel> = T; | ||
| type InferViewModelProps<TViewModel extends BaseViewModel> = TViewModel['props'] extends ViewPropAtoms<infer InferredProps> ? InferredProps : AnyObject; | ||
| type ViewModelFactory<TContext extends BaseControllerContext, TViewModel extends BaseViewModel> = (context: ControllerContext<TContext>) => Omit<TViewModel, 'props'>; | ||
| declare abstract class BaseViewController<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> extends BaseController<TContext> { | ||
| readonly view: TContext['view']; | ||
| readonly props: TContext['view']['props']; | ||
| abstract readonly state: Exclude<TViewModel['state'], undefined>; | ||
| constructor(paramsOrProviders: TContext['params'] | ReadonlyArray<ExtensionParamsProvider>, extensions: ReadonlyArray<ExtensionFn<any, any>>); | ||
| } | ||
| type ViewModelDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| /** @internal Keep the type for inference */ | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): Controller<TViewModel>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): Controller<TViewModel>; | ||
| }; | ||
| type ViewModelClassDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): BaseViewController<TViewModel, TContext>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): BaseViewController<TViewModel, TContext>; | ||
| }; | ||
| declare class ViewModelDeclarationBuilder<TContext extends BaseControllerContext> { | ||
| readonly extensions: Array<ExtensionFn<any, any>>; | ||
| constructor(extensions?: Array<ExtensionFn<any, any>>); | ||
| extend<TResultContext extends TContext>(extension: ExtensionFn<TContext, TResultContext>): ViewModelDeclarationBuilder<TResultContext>; | ||
| apply<TViewModel extends BaseViewModel>(factory: ViewModelFactory<TContext & ViewControllerContext<InferViewModelProps<TViewModel>>, TViewModel>): ViewModelDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| getBaseClass<TViewModel extends BaseViewModel>(): ViewModelClassDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| } | ||
| declare function declareViewModel<TViewModel extends BaseViewModel, TViewModelProps extends ViewProps = InferViewModelProps<TViewModel>>(factory: ViewModelFactory<ViewControllerContext<TViewModelProps>, TViewModel>): ControllerDeclaration<ViewControllerContext<TViewModelProps>, TViewModel>; | ||
| declare function declareViewModel(): ViewModelDeclarationBuilder<BaseControllerContext>; | ||
| export { type BaseViewModel as B, type InferViewPropsFromControllerContext as I, type ViewProps as V, type ViewBinding as a, type ViewModel as b, type ViewModelFactory as c, type ViewModelDeclaration as d, type ViewModelClassDeclaration as e, declareViewModel as f, type ViewPropAtoms as g, type ViewStatus as h, type ViewControllerContext as i, type InferViewModelProps as j, provideView as p, withView as w }; |
+1
-1
| import React, { FC, PropsWithChildren } from 'react'; | ||
| import { i as ExtensionParamsProvider, B as BaseControllerContext, a as BaseService, c as ControllerDeclaration } from './controller-BeiM0Zjy.cjs'; | ||
| import { I as InferViewPropsFromControllerContext, V as ViewProps, i as ViewControllerContext, B as BaseViewModel, d as ViewModelDeclaration, j as InferViewModelProps } from './viewModel-DQOL7Z53.cjs'; | ||
| import { I as InferViewPropsFromControllerContext, V as ViewProps, i as ViewControllerContext, B as BaseViewModel, d as ViewModelDeclaration, j as InferViewModelProps } from './viewModel-DcZgBSw9.cjs'; | ||
| import './types-CxOJPpKX.cjs'; | ||
@@ -5,0 +5,0 @@ import './types-Bej5aaZB.cjs'; |
+1
-1
| import React, { FC, PropsWithChildren } from 'react'; | ||
| import { i as ExtensionParamsProvider, B as BaseControllerContext, a as BaseService, c as ControllerDeclaration } from './controller-BVEgCAYk.js'; | ||
| import { I as InferViewPropsFromControllerContext, V as ViewProps, i as ViewControllerContext, B as BaseViewModel, d as ViewModelDeclaration, j as InferViewModelProps } from './viewModel-CkXYm91i.js'; | ||
| import { I as InferViewPropsFromControllerContext, V as ViewProps, i as ViewControllerContext, B as BaseViewModel, d as ViewModelDeclaration, j as InferViewModelProps } from './viewModel-CspUG5If.js'; | ||
| import './types-CxOJPpKX.js'; | ||
@@ -5,0 +5,0 @@ import './types-jkBBq3Lp.js'; |
+2
-2
| export { B as BaseControllerContext, a as BaseService, C as Controller, d as ControllerClassDeclaration, j as ControllerConstructorError, b as ControllerContext, c as ControllerDeclaration, e as ControllerFactory, f as ControllerParams, g as ControllerParamsContext, E as ExtensionFn, h as ExtensionParams, i as ExtensionParamsProvider, k as declareController, l as provideControllerParams, p as provideExtensionParams } from './controller-BeiM0Zjy.cjs'; | ||
| import { V as ViewProps, a as ViewBinding } from './viewModel-DQOL7Z53.cjs'; | ||
| export { B as BaseViewModel, I as InferViewPropsFromControllerContext, i as ViewControllerContext, b as ViewModel, e as ViewModelClassDeclaration, d as ViewModelDeclaration, c as ViewModelFactory, g as ViewPropAtoms, h as ViewStatus, f as declareViewModel, p as provideView, w as withView } from './viewModel-DQOL7Z53.cjs'; | ||
| import { V as ViewProps, a as ViewBinding } from './viewModel-DcZgBSw9.cjs'; | ||
| export { B as BaseViewModel, I as InferViewPropsFromControllerContext, i as ViewControllerContext, b as ViewModel, e as ViewModelClassDeclaration, d as ViewModelDeclaration, c as ViewModelFactory, g as ViewPropAtoms, h as ViewStatus, f as declareViewModel, p as provideView, w as withView } from './viewModel-DcZgBSw9.cjs'; | ||
| import './types-CxOJPpKX.cjs'; | ||
@@ -5,0 +5,0 @@ import './types-Bej5aaZB.cjs'; |
+2
-2
| export { B as BaseControllerContext, a as BaseService, C as Controller, d as ControllerClassDeclaration, j as ControllerConstructorError, b as ControllerContext, c as ControllerDeclaration, e as ControllerFactory, f as ControllerParams, g as ControllerParamsContext, E as ExtensionFn, h as ExtensionParams, i as ExtensionParamsProvider, k as declareController, l as provideControllerParams, p as provideExtensionParams } from './controller-BVEgCAYk.js'; | ||
| import { V as ViewProps, a as ViewBinding } from './viewModel-CkXYm91i.js'; | ||
| export { B as BaseViewModel, I as InferViewPropsFromControllerContext, i as ViewControllerContext, b as ViewModel, e as ViewModelClassDeclaration, d as ViewModelDeclaration, c as ViewModelFactory, g as ViewPropAtoms, h as ViewStatus, f as declareViewModel, p as provideView, w as withView } from './viewModel-CkXYm91i.js'; | ||
| import { V as ViewProps, a as ViewBinding } from './viewModel-CspUG5If.js'; | ||
| export { B as BaseViewModel, I as InferViewPropsFromControllerContext, i as ViewControllerContext, b as ViewModel, e as ViewModelClassDeclaration, d as ViewModelDeclaration, c as ViewModelFactory, g as ViewPropAtoms, h as ViewStatus, f as declareViewModel, p as provideView, w as withView } from './viewModel-CspUG5If.js'; | ||
| import './types-CxOJPpKX.js'; | ||
@@ -5,0 +5,0 @@ import './types-jkBBq3Lp.js'; |
+3
-3
| { | ||
| "private": false, | ||
| "name": "nrgy", | ||
| "version": "0.0.43", | ||
| "version": "0.0.44", | ||
| "description": "The library for reactive programming using efficient computing and MVC/MVVM patterns", | ||
@@ -84,4 +84,4 @@ "license": "MIT", | ||
| "types-jkBBq3Lp.d.ts", | ||
| "viewModel-CkXYm91i.d.ts", | ||
| "viewModel-DQOL7Z53.d.cts" | ||
| "viewModel-CspUG5If.d.ts", | ||
| "viewModel-DcZgBSw9.d.cts" | ||
| ], | ||
@@ -88,0 +88,0 @@ "exports": { |
| import { A as Atom, S as Signal } from './types-CxOJPpKX.js'; | ||
| import { B as BaseControllerContext, E as ExtensionFn, i as ExtensionParamsProvider, C as Controller, c as ControllerDeclaration, m as BaseController } from './controller-BVEgCAYk.js'; | ||
| type AnyObject = Record<string, any>; | ||
| /** | ||
| * ViewProps are the properties that are provided to the view | ||
| */ | ||
| type ViewProps = Record<string, unknown>; | ||
| /** | ||
| * ViewPropAtoms are the atoms wit View's props that are provided | ||
| * to the controller by the ViewBinding | ||
| */ | ||
| type ViewPropAtoms<TProps extends ViewProps> = TProps extends Record<string, never> ? Record<string, never> : Readonly<{ | ||
| [K in keyof TProps]: Atom<TProps[K]>; | ||
| }>; | ||
| type ViewStatus = 'unmounted' | 'mounted' | 'destroyed'; | ||
| /** | ||
| * ViewBinding is the binding between the controller and the view | ||
| */ | ||
| type ViewBinding<TProps extends ViewProps> = { | ||
| /** | ||
| * View's props | ||
| */ | ||
| readonly props: ViewPropAtoms<TProps>; | ||
| readonly status: Atom<ViewStatus>; | ||
| /** | ||
| * Signals that the view has been mounted | ||
| */ | ||
| readonly onMount: Signal<void>; | ||
| /** | ||
| * Signals that the view has been updated. | ||
| * | ||
| * Partial<TProps> is the properties that were updated. | ||
| */ | ||
| readonly onUpdate: Signal<Partial<TProps>>; | ||
| /** | ||
| * Signals that the view has been unmounted. | ||
| */ | ||
| readonly onUnmount: Signal<void>; | ||
| }; | ||
| /** | ||
| * ViewControllerContext is the context with the view binding | ||
| * that is provided to the controller | ||
| */ | ||
| type ViewControllerContext<TProps extends ViewProps = ViewProps> = BaseControllerContext & { | ||
| view: ViewBinding<TProps>; | ||
| }; | ||
| /** | ||
| * Utility type to infer the view props from the controller context | ||
| */ | ||
| type InferViewPropsFromControllerContext<TContext extends BaseControllerContext, ElseType> = TContext extends ViewControllerContext<infer InferredProps> ? InferredProps : ElseType; | ||
| /** | ||
| * withView is an extension that provides the view to the controller | ||
| */ | ||
| declare function withView<TProps extends ViewProps = ViewProps>(): ExtensionFn<BaseControllerContext, ViewControllerContext<TProps>>; | ||
| /** | ||
| * Provides the view binding to the controller | ||
| */ | ||
| declare function provideView(view: ViewBinding<any>): ExtensionParamsProvider; | ||
| type BaseViewModel = Record<string, unknown> & { | ||
| props?: Record<string, Atom<unknown>>; | ||
| state?: Record<string, Atom<unknown>>; | ||
| }; | ||
| type ViewModel<T extends BaseViewModel> = T; | ||
| type InferViewModelProps<TViewModel extends BaseViewModel> = TViewModel['props'] extends ViewPropAtoms<infer InferredProps> ? InferredProps : AnyObject; | ||
| type ViewModelFactory<TContext extends BaseControllerContext, TViewModel extends BaseViewModel> = (context: TContext) => Omit<TViewModel, 'props'>; | ||
| declare abstract class BaseViewController<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> extends BaseController<TContext> { | ||
| readonly view: TContext['view']; | ||
| readonly props: TContext['view']['props']; | ||
| abstract readonly state: Exclude<TViewModel['state'], undefined>; | ||
| constructor(paramsOrProviders: TContext['params'] | ReadonlyArray<ExtensionParamsProvider>, extensions: ReadonlyArray<ExtensionFn<any, any>>); | ||
| } | ||
| type ViewModelDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| /** @internal Keep the type for inference */ | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): Controller<TViewModel>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): Controller<TViewModel>; | ||
| }; | ||
| type ViewModelClassDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): BaseViewController<TViewModel, TContext>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): BaseViewController<TViewModel, TContext>; | ||
| }; | ||
| declare class ViewModelDeclarationBuilder<TContext extends BaseControllerContext> { | ||
| readonly extensions: Array<ExtensionFn<any, any>>; | ||
| constructor(extensions?: Array<ExtensionFn<any, any>>); | ||
| extend<TResultContext extends TContext>(extension: ExtensionFn<TContext, TResultContext>): ViewModelDeclarationBuilder<TResultContext>; | ||
| apply<TViewModel extends BaseViewModel>(factory: ViewModelFactory<TContext & ViewControllerContext<InferViewModelProps<TViewModel>>, TViewModel>): ViewModelDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| getBaseClass<TViewModel extends BaseViewModel>(): ViewModelClassDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| } | ||
| declare function declareViewModel<TViewModel extends BaseViewModel, TViewModelProps extends ViewProps = InferViewModelProps<TViewModel>>(factory: ViewModelFactory<ViewControllerContext<TViewModelProps>, TViewModel>): ControllerDeclaration<ViewControllerContext<TViewModelProps>, TViewModel>; | ||
| declare function declareViewModel(): ViewModelDeclarationBuilder<BaseControllerContext>; | ||
| export { type BaseViewModel as B, type InferViewPropsFromControllerContext as I, type ViewProps as V, type ViewBinding as a, type ViewModel as b, type ViewModelFactory as c, type ViewModelDeclaration as d, type ViewModelClassDeclaration as e, declareViewModel as f, type ViewPropAtoms as g, type ViewStatus as h, type ViewControllerContext as i, type InferViewModelProps as j, provideView as p, withView as w }; |
| import { A as Atom, S as Signal } from './types-CxOJPpKX.cjs'; | ||
| import { B as BaseControllerContext, E as ExtensionFn, i as ExtensionParamsProvider, C as Controller, c as ControllerDeclaration, m as BaseController } from './controller-BeiM0Zjy.cjs'; | ||
| type AnyObject = Record<string, any>; | ||
| /** | ||
| * ViewProps are the properties that are provided to the view | ||
| */ | ||
| type ViewProps = Record<string, unknown>; | ||
| /** | ||
| * ViewPropAtoms are the atoms wit View's props that are provided | ||
| * to the controller by the ViewBinding | ||
| */ | ||
| type ViewPropAtoms<TProps extends ViewProps> = TProps extends Record<string, never> ? Record<string, never> : Readonly<{ | ||
| [K in keyof TProps]: Atom<TProps[K]>; | ||
| }>; | ||
| type ViewStatus = 'unmounted' | 'mounted' | 'destroyed'; | ||
| /** | ||
| * ViewBinding is the binding between the controller and the view | ||
| */ | ||
| type ViewBinding<TProps extends ViewProps> = { | ||
| /** | ||
| * View's props | ||
| */ | ||
| readonly props: ViewPropAtoms<TProps>; | ||
| readonly status: Atom<ViewStatus>; | ||
| /** | ||
| * Signals that the view has been mounted | ||
| */ | ||
| readonly onMount: Signal<void>; | ||
| /** | ||
| * Signals that the view has been updated. | ||
| * | ||
| * Partial<TProps> is the properties that were updated. | ||
| */ | ||
| readonly onUpdate: Signal<Partial<TProps>>; | ||
| /** | ||
| * Signals that the view has been unmounted. | ||
| */ | ||
| readonly onUnmount: Signal<void>; | ||
| }; | ||
| /** | ||
| * ViewControllerContext is the context with the view binding | ||
| * that is provided to the controller | ||
| */ | ||
| type ViewControllerContext<TProps extends ViewProps = ViewProps> = BaseControllerContext & { | ||
| view: ViewBinding<TProps>; | ||
| }; | ||
| /** | ||
| * Utility type to infer the view props from the controller context | ||
| */ | ||
| type InferViewPropsFromControllerContext<TContext extends BaseControllerContext, ElseType> = TContext extends ViewControllerContext<infer InferredProps> ? InferredProps : ElseType; | ||
| /** | ||
| * withView is an extension that provides the view to the controller | ||
| */ | ||
| declare function withView<TProps extends ViewProps = ViewProps>(): ExtensionFn<BaseControllerContext, ViewControllerContext<TProps>>; | ||
| /** | ||
| * Provides the view binding to the controller | ||
| */ | ||
| declare function provideView(view: ViewBinding<any>): ExtensionParamsProvider; | ||
| type BaseViewModel = Record<string, unknown> & { | ||
| props?: Record<string, Atom<unknown>>; | ||
| state?: Record<string, Atom<unknown>>; | ||
| }; | ||
| type ViewModel<T extends BaseViewModel> = T; | ||
| type InferViewModelProps<TViewModel extends BaseViewModel> = TViewModel['props'] extends ViewPropAtoms<infer InferredProps> ? InferredProps : AnyObject; | ||
| type ViewModelFactory<TContext extends BaseControllerContext, TViewModel extends BaseViewModel> = (context: TContext) => Omit<TViewModel, 'props'>; | ||
| declare abstract class BaseViewController<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> extends BaseController<TContext> { | ||
| readonly view: TContext['view']; | ||
| readonly props: TContext['view']['props']; | ||
| abstract readonly state: Exclude<TViewModel['state'], undefined>; | ||
| constructor(paramsOrProviders: TContext['params'] | ReadonlyArray<ExtensionParamsProvider>, extensions: ReadonlyArray<ExtensionFn<any, any>>); | ||
| } | ||
| type ViewModelDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| /** @internal Keep the type for inference */ | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): Controller<TViewModel>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): Controller<TViewModel>; | ||
| }; | ||
| type ViewModelClassDeclaration<TViewModel extends BaseViewModel, TContext extends ViewControllerContext<InferViewModelProps<TViewModel>>> = { | ||
| /** @internal Keep the type for inference */ | ||
| readonly __contextType?: TContext; | ||
| readonly __viewModelType?: TViewModel; | ||
| new (): BaseViewController<TViewModel, TContext>; | ||
| new (providers: ReadonlyArray<ExtensionParamsProvider>): BaseViewController<TViewModel, TContext>; | ||
| }; | ||
| declare class ViewModelDeclarationBuilder<TContext extends BaseControllerContext> { | ||
| readonly extensions: Array<ExtensionFn<any, any>>; | ||
| constructor(extensions?: Array<ExtensionFn<any, any>>); | ||
| extend<TResultContext extends TContext>(extension: ExtensionFn<TContext, TResultContext>): ViewModelDeclarationBuilder<TResultContext>; | ||
| apply<TViewModel extends BaseViewModel>(factory: ViewModelFactory<TContext & ViewControllerContext<InferViewModelProps<TViewModel>>, TViewModel>): ViewModelDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| getBaseClass<TViewModel extends BaseViewModel>(): ViewModelClassDeclaration<TViewModel, TContext & ViewControllerContext<InferViewModelProps<TViewModel>>>; | ||
| } | ||
| declare function declareViewModel<TViewModel extends BaseViewModel, TViewModelProps extends ViewProps = InferViewModelProps<TViewModel>>(factory: ViewModelFactory<ViewControllerContext<TViewModelProps>, TViewModel>): ControllerDeclaration<ViewControllerContext<TViewModelProps>, TViewModel>; | ||
| declare function declareViewModel(): ViewModelDeclarationBuilder<BaseControllerContext>; | ||
| export { type BaseViewModel as B, type InferViewPropsFromControllerContext as I, type ViewProps as V, type ViewBinding as a, type ViewModel as b, type ViewModelFactory as c, type ViewModelDeclaration as d, type ViewModelClassDeclaration as e, declareViewModel as f, type ViewPropAtoms as g, type ViewStatus as h, type ViewControllerContext as i, type InferViewModelProps as j, provideView as p, withView as w }; |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
433113
0.02%0
-100%