refract-preact-xstream
Advanced tools
Comparing version 4.1.2 to 4.2.0
@@ -73,3 +73,5 @@ import $$observable from 'symbol-observable'; | ||
}; }; | ||
var isProps = function (data) { return data.type === DataType.PROPS; }; | ||
var isProps = function (data) { | ||
return data.type === DataType.PROPS; | ||
}; | ||
var isCallback = function (propName) { return function (data) { | ||
@@ -76,0 +78,0 @@ return data.type === DataType.CALLBACK && |
@@ -79,3 +79,5 @@ 'use strict'; | ||
}; }; | ||
var isProps = function (data) { return data.type === DataType.PROPS; }; | ||
var isProps = function (data) { | ||
return data.type === DataType.PROPS; | ||
}; | ||
var isCallback = function (propName) { return function (data) { | ||
@@ -82,0 +84,0 @@ return data.type === DataType.CALLBACK && |
{ | ||
"name": "refract-preact-xstream", | ||
"description": "Refract bindings for Preact with xstream: harness the power of reactive programming to supercharge your components!", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "jsnext:main": "index.es.js", |
@@ -1,12 +0,12 @@ | ||
export declare type Handler<P, E, C = any> = ( | ||
intialProps: P, | ||
initialContext?: C | ||
) => (val: E) => void | ||
export declare type ErrorHandler<P, C = any> = ( | ||
intialProps: P, | ||
initialContext?: C | ||
export declare type Handler<Props, Effect, Context = any> = ( | ||
intialProps: Props, | ||
initialContext?: Context | ||
) => (val: Effect) => void | ||
export declare type ErrorHandler<Props, Context = any> = ( | ||
intialProps: Props, | ||
initialContext?: Context | ||
) => (error: any) => void | ||
export interface PushEvent { | ||
(eventName: string): () => void | ||
<T = any>(eventName: string): (val: T) => void | ||
<Event = any>(eventName: string): (val: Event) => void | ||
} |
export declare const compose: Compose | ||
export interface Compose { | ||
<R>(...fns: Function[]): (arg: any) => R | ||
<A, R>(f: (arg: A) => R): (arg: A) => R | ||
<A, B, R>(f: (arg: B) => R, g: (arg: A) => B): (arg: A) => R | ||
<A, B, C, R>(f: (arg: C) => R, g: (arg: B) => C, h: (arg: A) => B): ( | ||
arg: A | ||
) => R | ||
<A, B, C, D, R>( | ||
f: (arg: D) => R, | ||
<Result>(...fns: Function[]): (arg: any) => Result | ||
<A, Result>(f: (arg: A) => Result): (arg: A) => Result | ||
<A, B, Result>(f: (arg: B) => Result, g: (arg: A) => B): (arg: A) => Result | ||
<A, B, C, Result>( | ||
f: (arg: C) => Result, | ||
g: (arg: B) => C, | ||
h: (arg: A) => B | ||
): (arg: A) => Result | ||
<A, B, C, D, Result>( | ||
f: (arg: D) => Result, | ||
g: (arg: C) => D, | ||
h: (arg: B) => C, | ||
i: (arg: A) => B | ||
): (arg: A) => R | ||
<A, B, C, D, E, R>( | ||
f: (arg: E) => R, | ||
): (arg: A) => Result | ||
<A, B, C, D, E, Result>( | ||
f: (arg: E) => Result, | ||
g: (arg: D) => E, | ||
@@ -21,5 +23,5 @@ h: (arg: C) => D, | ||
j: (arg: A) => B | ||
): (arg: A) => R | ||
<A, B, C, D, E, F, R>( | ||
f: (arg: F) => R, | ||
): (arg: A) => Result | ||
<A, B, C, D, E, F, Result>( | ||
f: (arg: F) => Result, | ||
g: (arg: E) => F, | ||
@@ -30,5 +32,5 @@ h: (arg: D) => E, | ||
k: (arg: A) => B | ||
): (arg: A) => R | ||
<A, B, C, D, E, F, G, R>( | ||
f: (arg: G) => R, | ||
): (arg: A) => Result | ||
<A, B, C, D, E, F, G, Result>( | ||
f: (arg: G) => Result, | ||
g: (arg: F) => G, | ||
@@ -40,5 +42,5 @@ h: (arg: E) => F, | ||
l: (arg: A) => B | ||
): (arg: A) => R | ||
<A, B, C, D, E, F, G, H, R>( | ||
f: (arg: H) => R, | ||
): (arg: A) => Result | ||
<A, B, C, D, E, F, G, H, Result>( | ||
f: (arg: H) => Result, | ||
g: (arg: G) => H, | ||
@@ -51,3 +53,3 @@ h: (arg: F) => G, | ||
m: (arg: A) => B | ||
): (arg: A) => R | ||
): (arg: A) => Result | ||
} |
import { Handler, ErrorHandler } from './baseTypes' | ||
import { Aperture } from './observable' | ||
declare const configureComponent: <P, E, Ctx>( | ||
aperture: Aperture<P, E, Ctx>, | ||
declare const configureComponent: <Props, Effect, Context>( | ||
aperture: Aperture<Props, Effect, Context>, | ||
instance: any, | ||
isValidElement?: (val: any) => boolean, | ||
isComponentClass?: (val: any) => boolean, | ||
handler?: Handler<P, E, Ctx>, | ||
errorHandler?: ErrorHandler<P, any>, | ||
handler?: Handler<Props, Effect, Context>, | ||
errorHandler?: ErrorHandler<Props, any>, | ||
mergeProps?: boolean, | ||
@@ -11,0 +11,0 @@ decorateProps?: boolean |
@@ -8,6 +8,6 @@ export declare const MOUNT_EVENT: string | ||
} | ||
export declare type Data<P> = PropsData<P> | CallbackData | EventData | ||
export interface PropsData<P> { | ||
export declare type Data<Props> = PropsData<Props> | CallbackData | EventData | ||
export interface PropsData<Props> { | ||
type: DataType | ||
payload: Partial<P> | ||
payload: Partial<Props> | ||
} | ||
@@ -28,11 +28,11 @@ export interface CallbackData { | ||
} | ||
export declare const isEvent: <P>( | ||
export declare const isEvent: <Props>( | ||
eventName: any | ||
) => (data: Data<P>, index?: any) => boolean | ||
export declare const isProps: <P>(data: Data<P>) => boolean | ||
export declare const isCallback: <P>( | ||
) => (data: Data<Props>, index?: any) => boolean | ||
export declare const isProps: <Props>(data: Data<Props>) => boolean | ||
export declare const isCallback: <Props>( | ||
propName: any | ||
) => (data: Data<P>) => boolean | ||
) => (data: Data<Props>) => boolean | ||
export declare const createEventData: (name: string, value?: any) => EventData | ||
export declare const createPropsData: <P>(props: P) => PropsData<P> | ||
export declare const createPropsData: <Props>(props: Props) => PropsData<Props> | ||
export declare const createCallbackData: ( | ||
@@ -39,0 +39,0 @@ name: string, |
export declare const PROPS_EFFECT: string | ||
export declare const COMPONENT_EFFECT: string | ||
export interface PropEffect<P = object> { | ||
export interface PropEffect<Props = object> { | ||
type: string | ||
payload: { | ||
replace: boolean | ||
props: P | ||
props: Props | ||
} | ||
} | ||
export interface ComponentEffect<D = object> { | ||
export interface ComponentEffect<Data = object> { | ||
type: string | ||
payload: D | ||
payload: Data | ||
} | ||
export declare const toProps: <P>(props: P) => PropEffect<P> | ||
export declare const asProps: <P>(props: P) => PropEffect<P> | ||
export declare const toRender: <D>(data: D) => ComponentEffect<D> | ||
export declare const toProps: <Props>(props: Props) => PropEffect<Props> | ||
export declare const asProps: <Props>(props: Props) => PropEffect<Props> | ||
export declare const toRender: <Data>(data: Data) => ComponentEffect<Data> |
@@ -6,7 +6,12 @@ import { Stream, Listener, Subscription } from 'xstream' | ||
(eventName: string): [Stream<void>, () => any] | ||
<T = any>(eventName: string, seedValue?: T): [Stream<T>, (val: T) => any] | ||
<Type = any>(eventName: string, seedValue?: Type): [ | ||
Stream<Type>, | ||
(val: Type) => any | ||
] | ||
} | ||
export interface FromEvent { | ||
(eventName: string): Stream<void> | ||
<T>(eventName: string, valueTransformer?: (val: any) => T): Stream<T> | ||
<Type>(eventName: string, valueTransformer?: (val: any) => Type): Stream< | ||
Type | ||
> | ||
} | ||
@@ -21,24 +26,24 @@ export interface ObservableComponentBase { | ||
export interface Observe { | ||
observe: <T>( | ||
observe: <Type>( | ||
propName?: string, | ||
valueTransformer?: (val: any) => T | ||
) => Stream<T> | ||
valueTransformer?: (val: any) => Type | ||
) => Stream<Type> | ||
} | ||
export declare type ObservableComponent = Observe & ObservableComponentBase | ||
export declare type Aperture<P, E, C = any> = ( | ||
export declare type Aperture<Props, Effect, Context = any> = ( | ||
component: ObservableComponent, | ||
initialProps: P, | ||
initialContext?: C | ||
) => Stream<E> | ||
export declare const subscribeToSink: <T>( | ||
sink: Stream<T>, | ||
next: (val: T) => void, | ||
initialProps: Props, | ||
initialContext?: Context | ||
) => Stream<Effect> | ||
export declare const subscribeToSink: <Type>( | ||
sink: Stream<Type>, | ||
next: (val: Type) => void, | ||
error?: (error: any) => void | ||
) => Subscription | ||
export declare const getObserve: <P>( | ||
export declare const getObserve: <Props>( | ||
getProp: any, | ||
data: any, | ||
decoratedProps: any | ||
) => <T>(propName?: any, valueTransformer?: any) => any | ||
export declare const createComponent: <P>( | ||
) => <Type>(propName?: any, valueTransformer?: any) => any | ||
export declare const createComponent: <Props>( | ||
getProp: any, | ||
@@ -45,0 +50,0 @@ dataObservable: any, |
@@ -10,17 +10,17 @@ import { ComponentFactory, VNode } from 'preact' | ||
} | ||
export interface Config<P, E> { | ||
handler?: Handler<P, E, any> | ||
errorHandler?: ErrorHandler<P, any> | ||
export interface Config<Props, Effect> { | ||
handler?: Handler<Props, Effect, any> | ||
errorHandler?: ErrorHandler<Props, any> | ||
mergeProps?: boolean | ||
decorateProps?: boolean | ||
} | ||
export declare const withEffects: <P, E, CP = P>( | ||
aperture: Aperture<P, E, any>, | ||
config?: Config<P, E> | ||
export declare const withEffects: <Props, Effect, ChildProps = Props>( | ||
aperture: Aperture<Props, Effect, any>, | ||
config?: Config<Props, Effect> | ||
) => ( | ||
BaseComponent?: ComponentFactory< | ||
CP & { | ||
ChildProps & { | ||
pushEvent: PushEvent | ||
} | ||
> | ||
) => ComponentFactory<P> | ||
) => ComponentFactory<Props> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45647
1018