react-waitables
Advanced tools
Comparing version 1.5.3 to 1.5.4
import type { LimiterOptions } from 'react-bindings'; | ||
import type { WaitableDependencies } from '../../../waitable/types/waitable-dependencies'; | ||
import type { WaitablesConsumerNamedTransformers } from './transformers'; | ||
export declare type WaitablesConsumerProps<DependenciesT extends WaitableDependencies = Record<string, never>> = LimiterOptions & WaitablesConsumerNamedTransformers<DependenciesT> & { | ||
export declare type WaitablesConsumerProps<DependenciesT extends WaitableDependencies> = LimiterOptions & WaitablesConsumerNamedTransformers<DependenciesT> & { | ||
id?: string; | ||
@@ -6,0 +6,0 @@ dependencies?: DependenciesT; |
@@ -5,5 +5,5 @@ import type { ReactNode } from 'react'; | ||
/** A transformer that requires all waitable values to be loaded. */ | ||
export declare type WaitablesConsumerRequiredValuesTransformer<DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT) => ReactNode; | ||
export declare type WaitablesConsumerRequiredValuesTransformer<DependenciesT extends WaitableDependencies> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT) => ReactNode; | ||
/** A transformer that doesn't require all waitable values to be loaded. */ | ||
export declare type WaitablesConsumerOptionalValuesTransformer<DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferOptionalWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT) => ReactNode; | ||
export declare type WaitablesConsumerOptionalValuesTransformer<DependenciesT extends WaitableDependencies> = (dependencyValues: InferOptionalWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT) => ReactNode; | ||
/** | ||
@@ -15,3 +15,3 @@ * Transformers that are used depending on the state of the waitables. | ||
*/ | ||
export interface WaitablesConsumerNamedTransformers<DependenciesT extends WaitableDependencies = Record<string, never>> { | ||
export interface WaitablesConsumerNamedTransformers<DependenciesT extends WaitableDependencies> { | ||
/** All waitables have defined values */ | ||
@@ -18,0 +18,0 @@ ifLoaded?: WaitablesConsumerRequiredValuesTransformer<DependenciesT>; |
@@ -34,3 +34,3 @@ /// <reference types="react" /> | ||
*/ | ||
export declare const WaitablesConsumer: <DependenciesT extends WaitableDependencies = Record<string, never>>({ children, id, dependencies, always, ifError, ifErrorOrLoading, ifLoaded, ifLoading, limitMSec, limitMode, limitType, priority, queue }: import("react-bindings").LimiterOptions & WaitablesConsumerNamedTransformers<DependenciesT> & { | ||
export declare const WaitablesConsumer: <DependenciesT extends WaitableDependencies>({ children, id, dependencies, always, ifError, ifErrorOrLoading, ifLoaded, ifLoading, limitMSec, limitMode, limitType, priority, queue }: import("react-bindings").LimiterOptions & WaitablesConsumerNamedTransformers<DependenciesT> & { | ||
id?: string | undefined; | ||
@@ -37,0 +37,0 @@ dependencies?: DependenciesT | undefined; |
@@ -13,3 +13,2 @@ "use strict"; | ||
const use_derived_waitable_1 = require("../../specialized-waitables/use-derived-waitable/use-derived-waitable"); | ||
const emptyDependencies = Object.freeze({}); | ||
/** | ||
@@ -56,3 +55,3 @@ * A component that is rerendered based on input waitable and binding changes. | ||
}; | ||
const ifErrorTransformer = (0, use_callback_ref_1.useCallbackRef)(() => { var _a, _b; return (_b = (_a = (0, waitable_consumer_if_error_transformer_1.getDefaultWaitablesConsumerIfErrorTransformer)()) === null || _a === void 0 ? void 0 : _a(dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, node)) !== null && _b !== void 0 ? _b : null; }); | ||
const ifErrorTransformer = (0, use_callback_ref_1.useCallbackRef)(() => { var _a, _b; return (_b = (_a = (0, waitable_consumer_if_error_transformer_1.getDefaultWaitablesConsumerIfErrorTransformer)()) === null || _a === void 0 ? void 0 : _a(dependencies, node)) !== null && _b !== void 0 ? _b : null; }); | ||
const combinedTransformers = [...(0, array_like_1.normalizeAsArray)(children), propsBasedTransformers, { ifError: ifErrorTransformer }]; | ||
@@ -59,0 +58,0 @@ const node = (0, use_derived_waitable_1.useDerivedWaitable)(dependencies, combinedTransformers, { |
@@ -5,5 +5,5 @@ import type { TypeOrPromisedType } from '../../../resolveable/types'; | ||
/** A transformer that requires all waitable values to be loaded. */ | ||
export declare type UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void, wasReset: () => boolean) => TypeOrPromisedType<SuccessT | undefined>; | ||
export declare type UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void, wasReset: () => boolean) => TypeOrPromisedType<SuccessT | undefined>; | ||
/** A transformer that doesn't require all waitable values to be loaded. */ | ||
export declare type UseDerivedWaitableOptionalValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferOptionalWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void, wasReset: () => boolean) => TypeOrPromisedType<SuccessT | undefined>; | ||
export declare type UseDerivedWaitableOptionalValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies> = (dependencyValues: InferOptionalWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void, wasReset: () => boolean) => TypeOrPromisedType<SuccessT | undefined>; | ||
/** | ||
@@ -15,3 +15,3 @@ * Transformers that are used depending on the state of the waitables. | ||
*/ | ||
export interface UseDerivedWaitableNamedTransformers<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> { | ||
export interface UseDerivedWaitableNamedTransformers<SuccessT, FailureT, DependenciesT extends WaitableDependencies> { | ||
ifLoaded?: UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT>; | ||
@@ -18,0 +18,0 @@ ifError?: UseDerivedWaitableOptionalValuesTransformer<SuccessT, FailureT, DependenciesT>; |
@@ -35,3 +35,3 @@ import { EmptyObject, SingleOrArray } from 'react-bindings'; | ||
*/ | ||
export declare const useDerivedWaitable: <SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>, ExtraFieldsT = EmptyObject>(dependencies: DependenciesT | undefined, transformers: SingleOrArray<UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT> | UseDerivedWaitableNamedTransformers<SuccessT, FailureT, DependenciesT>>, args: UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT>) => Waitable<SuccessT, FailureT> & ExtraFieldsT; | ||
export declare const useDerivedWaitable: <SuccessT, FailureT, DependenciesT extends WaitableDependencies, ExtraFieldsT = EmptyObject>(dependencies: DependenciesT | undefined, transformers: SingleOrArray<UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT> | UseDerivedWaitableNamedTransformers<SuccessT, FailureT, DependenciesT>>, args: UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT>) => Waitable<SuccessT, FailureT> & ExtraFieldsT; | ||
//# sourceMappingURL=use-derived-waitable.d.ts.map |
import type { TypeOrPromisedType } from '../../../resolveable/types'; | ||
import type { WaitableDependencies } from '../../../waitable/types/waitable-dependencies'; | ||
export declare type IfNotReadyCallback<ArgsT extends any[], DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencies: DependenciesT, ...args: ArgsT) => TypeOrPromisedType<void>; | ||
export declare type IfNotReadyCallback<ArgsT extends any[], DependenciesT extends WaitableDependencies> = (dependencies: DependenciesT, ...args: ArgsT) => TypeOrPromisedType<void>; | ||
//# sourceMappingURL=if-not-ready-callback.d.ts.map |
import type { TypeOrPromisedType } from '../../../resolveable/types'; | ||
import type { InferRequiredWaitableAndBindingValueTypes } from '../../../waitable/types/infer-waitable-and-binding-value-types'; | ||
import type { WaitableDependencies } from '../../../waitable/types/waitable-dependencies'; | ||
export declare type IfReadyCallback<ArgsT extends any[], DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, ...args: ArgsT) => TypeOrPromisedType<void>; | ||
export declare type IfReadyCallback<ArgsT extends any[], DependenciesT extends WaitableDependencies> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, ...args: ArgsT) => TypeOrPromisedType<void>; | ||
//# sourceMappingURL=if-ready-callback.d.ts.map |
@@ -5,3 +5,3 @@ import type { DependencyList } from 'react'; | ||
import type { IfNotReadyCallback } from './internal/if-not-ready-callback'; | ||
export interface UseWaitableCallbackOptions<ArgsT extends any[], DependenciesT extends WaitableDependencies = Record<string, never>> extends WaitOptions { | ||
export interface UseWaitableCallbackOptions<ArgsT extends any[], DependenciesT extends WaitableDependencies> extends WaitOptions { | ||
/** A technical, but human-readable ID, which isn't guaranteed to be unique */ | ||
@@ -8,0 +8,0 @@ id?: string; |
@@ -10,3 +10,3 @@ import type { WaitableDependencies } from '../waitable/types/waitable-dependencies'; | ||
*/ | ||
export declare const useWaitableCallback: <ArgsT extends any[], DependenciesT extends WaitableDependencies = Record<string, never>>(dependencies: DependenciesT | undefined, ifReady: IfReadyCallback<ArgsT, DependenciesT>, { id, deps, ifNotReady, ...waitOptions }?: UseWaitableCallbackOptions<ArgsT, DependenciesT>) => WaitableCallback<ArgsT>; | ||
export declare const useWaitableCallback: <ArgsT extends any[], DependenciesT extends WaitableDependencies>(dependencies: DependenciesT | undefined, ifReady: IfReadyCallback<ArgsT, DependenciesT>, { id, deps, ifNotReady, ...waitOptions }?: UseWaitableCallbackOptions<ArgsT, DependenciesT>) => WaitableCallback<ArgsT>; | ||
//# sourceMappingURL=use-waitable-callback.d.ts.map |
@@ -5,3 +5,3 @@ import type { ReadonlyBinding } from 'react-bindings'; | ||
export declare type NamedWaitableDependencies = Record<string, Waitable<any> | ReadonlyBinding | undefined>; | ||
export declare type WaitableDependencies = Waitable<any> | ReadonlyBinding | WaitableArrayDependencies | NamedWaitableDependencies; | ||
export declare type WaitableDependencies = Waitable<any> | ReadonlyBinding | WaitableArrayDependencies | NamedWaitableDependencies | undefined; | ||
//# sourceMappingURL=waitable-dependencies.d.ts.map |
{ | ||
"name": "react-waitables", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "Async data bindings for React", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"is-promise": "^4.0.0", | ||
"react-bindings": "^1.6.1" | ||
"react-bindings": "^1.6.2" | ||
}, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
207369
2393
Updatedreact-bindings@^1.6.2