anu-verzum 1.13.0 → 1.15.0

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.
@@ -8,7 +8,7 @@ export declare abstract class Component<P extends Record<string, any> = Props, S
8
8
  static isAnuComponent?: boolean;
9
9
  constructor(props: P, context?: Record<string, any>);
10
10
  setState(partialState?: Partial<S> | ((prevState: S, prevProps: P) => S)): void;
11
- abstract render(): AnuElement | AnuElement[] | null | undefined;
11
+ abstract render(): AnuElement | AnuElement[] | string | number | null | undefined;
12
12
  componentDidMount(): void;
13
13
  componentDidUpdate(_prevProps: P, _prevState: S): void;
14
14
  componentWillUnmount(): void;
@@ -6,8 +6,8 @@ type StoreShape = {
6
6
  subscribe: (listener: () => void) => void;
7
7
  unsubscribe: (listener: () => void) => void;
8
8
  };
9
- type MapStateToProps<TState = any, TOwnProps extends Props = Props, TStateProps extends Props = Props> = (state: TState, ownProps: TOwnProps) => TStateProps;
10
- type MapDispatchToProps<TDispatch = any, TOwnProps extends Props = Props, TDispatchProps extends Props = Props> = (dispatch: TDispatch, ownProps: TOwnProps) => TDispatchProps;
9
+ type MapStateToProps<TState = any, TOwnProps extends Record<string, any> = Record<string, any>, TStateProps extends Record<string, any> = Record<string, any>> = (state: TState, ownProps: TOwnProps) => TStateProps;
10
+ type MapDispatchToProps<TDispatch = any, TOwnProps extends Record<string, any> = Record<string, any>, TDispatchProps extends Record<string, any> = Record<string, any>> = (dispatch: TDispatch, ownProps: TOwnProps) => TDispatchProps;
11
11
  export interface ConnectorProviderProps extends Props {
12
12
  store: StoreShape;
13
13
  }
@@ -17,7 +17,7 @@ declare class Provider extends Component<ConnectorProviderProps> {
17
17
  render(): AnuElement | AnuElement[] | null;
18
18
  }
19
19
  declare const Connector: {
20
- connect: <TState = any, TOwnProps extends Props = Props, TStateProps extends Props = Props, TDispatchProps extends Props = Props>(mapStateToProps?: MapStateToProps<TState, TOwnProps, TStateProps> | null, mapDispatchToProps?: MapDispatchToProps<any, TOwnProps, TDispatchProps> | null) => (WrappedComponent: ComponentConstructor<TStateProps & TDispatchProps & TOwnProps>) => ComponentConstructor;
20
+ connect: <TState = any, TOwnProps extends Record<string, any> = Record<string, any>, TStateProps extends Record<string, any> = Record<string, any>, TDispatchProps extends Record<string, any> = Record<string, any>>(mapStateToProps?: MapStateToProps<TState, TOwnProps, TStateProps> | null, mapDispatchToProps?: MapDispatchToProps<any, TOwnProps, TDispatchProps> | null) => (WrappedComponent: ComponentConstructor<TStateProps & TDispatchProps & TOwnProps>) => ComponentConstructor;
21
21
  Provider: typeof Provider;
22
22
  };
23
23
  export default Connector;
@@ -12,11 +12,11 @@ export type Props = {
12
12
  export type Ref<T> = {
13
13
  current: T | null;
14
14
  };
15
- export type FunctionComponent<P extends Props = Props> = (props: P) => AnuElement | AnuElement[] | null;
15
+ export type FunctionComponent<P extends Props = Props> = (props: P) => AnuElement<any, any> | AnuElement<any>[] | null;
16
16
  export type ComponentConstructor<P extends Props = Props> = new (props: P, context?: Record<string, any>) => any;
17
17
  export type ElementType = string | FunctionComponent | ComponentConstructor;
18
- export type AnuElement = {
19
- type: ElementType;
20
- props: Props;
18
+ export type AnuElement<P = Props, T extends ElementType = ElementType> = {
19
+ type: T;
20
+ props: P;
21
21
  };
22
22
  export declare const createElement: (type: ElementType, config: Props | null, ...args: any[]) => AnuElement;
package/dist/index.d.ts CHANGED
@@ -93,7 +93,7 @@ declare const Anu: {
93
93
  Provider: ({ locale, messages, defaultLocale, children }: import("./core/components/Intl").IntlProviderProps) => AnuElement | null;
94
94
  };
95
95
  Connector: {
96
- connect: <TState = any, TOwnProps extends Props = Props, TStateProps extends Props = Props, TDispatchProps extends Props = Props>(mapStateToProps?: ((state: TState, ownProps: TOwnProps) => TStateProps) | null, mapDispatchToProps?: ((dispatch: any, ownProps: TOwnProps) => TDispatchProps) | null) => (WrappedComponent: import("./core/elements").ComponentConstructor<TStateProps & TDispatchProps & TOwnProps>) => import("./core/elements").ComponentConstructor;
96
+ connect: <TState = any, TOwnProps extends Record<string, any> = Record<string, any>, TStateProps extends Record<string, any> = Record<string, any>, TDispatchProps extends Record<string, any> = Record<string, any>>(mapStateToProps?: ((state: TState, ownProps: TOwnProps) => TStateProps) | null, mapDispatchToProps?: ((dispatch: any, ownProps: TOwnProps) => TDispatchProps) | null) => (WrappedComponent: import("./core/elements").ComponentConstructor<TStateProps & TDispatchProps & TOwnProps>) => import("./core/elements").ComponentConstructor;
97
97
  Provider: {
98
98
  new (props: import("./core/components/Connector").ConnectorProviderProps, context?: Record<string, any>): {
99
99
  store: {
@@ -136,7 +136,7 @@ declare const Anu: {
136
136
  deepEqual: (object1: Record<string, any>, object2: Record<string, any>) => boolean;
137
137
  };
138
138
  };
139
- export type { AnuElement, AnuChild, Props, Ref, FunctionComponent, ElementType } from './core/elements';
139
+ export type { AnuElement, AnuChild, AnuNode, Props, Ref, FunctionComponent, ElementType } from './core/elements';
140
140
  export type { ContextValue, ConsumerProps } from './core/components/Context';
141
141
  export type { Action, ThunkAction, Dispatch, Reducer, MiddlewareAPI, Middleware, Store, SelectorFn, CreateSelectorFn } from './store/store';
142
142
  export type { ApiSuccessResponse, ApiErrorResponse } from './server-api/server-api';
@@ -146,10 +146,10 @@ export { store, ServerAPI, Utils, Connector, Feature, History, Intl };
146
146
  export type { AbbreviateNumberOptions } from './core/components/Intl';
147
147
  declare global {
148
148
  namespace JSX {
149
- interface Element extends AnuElement {
149
+ interface Element extends AnuElement<any, any> {
150
150
  }
151
151
  interface ElementClass {
152
- render(): AnuElement | AnuElement[] | null | undefined;
152
+ render(): AnuElement | AnuElement[] | string | number | null | undefined;
153
153
  }
154
154
  interface ElementAttributesProperty {
155
155
  props: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anu-verzum",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "A \"React-like\" UI library that supports JSX syntax, Redux-like state management, array-rendering, i18n, routing and many more.",
5
5
  "keywords": [
6
6
  "anu-verzum",