UNPKG

rimmel

Version:

A Streams-Oriented UI library for the Rx.Observable Universe

31 lines 2.07 kB
import type { EventListenerFunction } from "../types/dom"; import type { RMLTemplateExpression } from "../types/internal"; import type { Source } from '../types/source'; export type ObjectKey = string | number | symbol; export type TargetObject = object | Array<string | number | object | Function>; export type ObjectSourceExpression<T extends TargetObject> = [key: keyof T, target: T]; /** * @deprecated don't use **/ export declare const isObjectSource: <T extends TargetObject>(expression: RMLTemplateExpression) => expression is ObjectSourceExpression<T>; /** * A data source that updates an object's property from an &lt;input&gt; element when * a certain event occurs * @param key an ['property', object] or [index, array] pair to update * @returns A data source * @example <input oninput="${[obj, 'property']}"> * @example <input oninput="${ObjectSource('property', obj)}"> * @example <input oninput="${ObjectSource(4, arr)}"> */ export declare const ObjectSource: <E extends Event, T extends TargetObject>(key: ObjectKey, targetObject?: T) => EventListenerFunction<E> | ((t2: T) => EventListenerFunction<E>); /** * An Event Adapter that uses an event's underlying &lt;input&gt; element * to updates an object's property or an array item. * @param property A property to update in the given object or an index to update in the given array * @param object The object or array to update * @returns An event handler */ export declare const Update: <E extends Element, T extends TargetObject, I extends Event, O extends never>(property: ObjectKey, object?: T) => ((t2: T) => EventListenerFunction<I>) | EventListenerFunction<I> | Source<I, O>; export declare const asObjectSource: <E extends Event, T extends TargetObject>(key: ObjectKey, targetObject?: T) => EventListenerFunction<E> | ((t2: T) => EventListenerFunction<E>); export declare const AsObjectSource: <E extends Event, T extends TargetObject>(key: ObjectKey, targetObject?: T) => EventListenerFunction<E> | ((t2: T) => EventListenerFunction<E>); //# sourceMappingURL=object-source.d.ts.map