/** * Ref composition helpers for Solid 2.0 setter-fn refs. * * Solid's `ref={...}` binding accepts a single setter callback or a (nested) * array of them; `applyRef` flattens arrays. Compound parts that combine an * internal ref (focus, measurement, floating-ui) with the consumer's ref * write the same shape over and over: * * ref={[localRef, (props as { ref?: (el: HTMLElement) => void }).ref]} * * The cast is there because Solid's component-prop types don't expose `ref` * (the compiler hoists it), so reading `props.ref` directly fails typecheck. * `composeRefs` + `userRef` centralize that cast and let multi-ref sites read * as a single call. */ /** * Ref callbacks are effectively bivariant in T — a trigger may render a button * that delivers HTMLButtonElement to one setter and HTMLElement to another. * The composer doesn't observe the element type; it just hands callbacks to * Solid's apply layer. The type parameter is preserved for documentation and * `RefLike` propagation, even though it's unused in the callback body. */ export type RefCallback<_T extends Element = HTMLElement> = (el: any) => void; /** A value Solid's `ref={...}` binding will accept (single, nested, or absent). */ export type RefLike = RefCallback | RefLike[] | null | undefined | false; /** * Bundle multiple ref slots into a single value suitable for `ref={...}`. * * Falsy entries (`undefined`, `null`, `false`) are dropped so callers can pass * conditional refs without manual guarding. The result collapses to: * - the lone callback when only one entry is live (avoids a 1-element array), * - an array otherwise (Solid flattens nested arrays at apply time). */ export declare function composeRefs(...refs: RefLike[]): RefLike; /** * Read the consumer-supplied `ref` off a component's `props` without the * `(props as { ref?: ... }).ref` cast at every call site. Solid hoists `ref` * during compile, so it isn't part of the typed prop interface — the cast * is the price of typed access from inside the component body. * * The read is `untrack`ed: refs are bound once at element creation (Solid * never re-applies a swapped `ref` prop), so the component-body read is * intentionally non-reactive and must not trip `[STRICT_READ_UNTRACKED]`. */ export declare function userRef(props: object): RefCallback | undefined; //# sourceMappingURL=compose-refs.d.ts.map