Delay in milliseconds.
Children namespace for utilities that operate on props.children.
null and undefined items (common React-like behavior).Recursively flattens nested arrays into out, omitting null/undefined.
Returns the number of non-null/undefined children (after flattening).
Finds the first child for which predicate returns true.
Returns the first non-nil child (after flattening), or undefined.
Iterates over children (after flattening & omitting nil).
Returns the last non-nil child (after flattening), or undefined.
Maps over children (after flattening & omitting nil).
Returns the single child from a children collection (after flattening & omitting nil), or throws if the remaining count is not exactly 1.
Finds exactly one matching child. Throws if matched count is not exactly 1.
Converts an iterable children collection into a flat array,
omitting null/undefined.
Utility to find the underlying DOM node for a mounted Lilact component.
Wraps a render function so that a parent can pass a ref into it.
The forwarded ref is provided as the second argument to the render function: (props, ref).
Checks whether a value is a Lilact component.
Checks whether a value is a Lilact component. It is the same as isValidComponent.
An action is a plain object that represents an intention to change the state. Actions are the only way to get data into the store. Any data, whether from UI events, network callbacks, or other sources such as WebSockets needs to eventually be dispatched as actions.
Actions must have a type field that indicates the type of action being
performed. Types can be defined as constants and imported from another
module. These must be strings, as strings are serializable.
Other than type, the structure of an action object is really up to you.
If you're interested, check out Flux Standard Action for recommendations on
how actions should be constructed.
Determines whether two values are shallowly equal.
A split-pane container with a draggable splitter, supporting both horizontal and vertical layouts.
The pane can be either:
position prop (number between min and max), ordefaultPosition (used as the initial position).Layout behavior:
mode="horizontal": the position controls the width of the left pane.mode="vertical": the position controls the height of the top pane.Ref API:
ref.current:
getMode() to get the current modesetMode(mode) to switch between "horizontal" and "vertical"getPosition() to get the current splitter positionsetPosition(position) to update the splitter positionEvents:
onSizeChange(position) whenever the pane size/position changes (e.g., via dragging).Rendering:
children into two separate containers (no portals).Controlled splitter position. Normalized value within [min, max].
If provided, the component uses this value instead of internal state.
Minimum allowed position. Defaults to 0.1.
Can also be a function that will be called with (containerWidth|containerHeight,splitterSize) as arguments
Maximum allowed position. Defaults to 0.9.
Can also be a function that will be called with (containerWidth|containerHeight,splitterSize) as arguments
The behavior on container resize. Its value can be proportional, fixFirst or fixSecond.
Default is proportional.
Schedules a callback on the next animation frame and returns a Promise that resolves on that frame.
Promise that resolves when the animation frame runs.
CSSTransition component that extends Transition by applying CSS class names during enter/exit phases.
Lilact accepts multiple children for CSSTransition. This has the benefit of receiving single events on multiple animated components.
Component props.
Optionalappear?: booleanIf true, run the enter transition on initial mount.
Render prop receiving transition state/props.
OptionalclassNames?: stringBase CSS class name(s) used for the transition states.
Boolean/flag indicating whether the component should be entered/shown.
OptionalmountOnEnter?: booleanIf true, mount the child only when entering.
Called when entering begins.
Called when entering completes.
Called while the component is entering.
Called when exiting begins.
Called when exiting completes.
Called while the component is exiting.
Optionaltimeout?: numberDuration (or durations) for the transition.
OptionalunmountOnExit?: booleanIf true, unmount the child after exiting.
Switches between keyed children with CSSTransition.
Ensures each child key gets its own CSSTransition instance to avoid state loss.
The key of the currently active child.
Optionalappear?: booleanWhether to run the initial transition on first mount.
The set of children to switch between. Each child should have a stable key
(or your key will fall back to its index).
OptionalclassNames?: stringBase className(s) used by CSSTransition to apply enter/exit classes.
OptionalcsstProps?: objectAny additional props are forwarded to each CSSTransition instance.
Optionalmode?: "out-in" | "in-out"Controls sequencing when activeKey changes:
"out-in": outgoing transitions out first, incoming transitions in after exit completes."in-out": incoming transitions in first, outgoing transitions out after the incoming finishes entering
(relies on onEntered).OptionalmountOnEnter?: booleanWhether to mount the transitioning child only when it begins entering.
OptionalonEnter?: (isAppearing: boolean) => voidCalled when a child begins entering.
OptionalonEntered?: (isAppearing: boolean) => voidCalled when a child finishes entering. Used to implement "in-out" sequencing.
OptionalonExited?: (isAppearing: boolean) => voidCalled when the outgoing child finishes exiting.
OptionalonExiting?: (isAppearing: boolean) => voidCalled when a child begins exiting.
Optionaltimeout?: numberTransition timeout passed to each CSSTransition.
OptionalunmountOnExit?: booleanWhether to unmount the child after it finishes exiting.
Transition component that manages enter/exit lifecycle and calls callbacks based on state changes.
Component props.
Optionalappear?: booleanIf true, run the enter transition on initial mount.
Render prop receiving transition state/props.
Boolean/flag indicating whether the component should be entered/shown.
OptionalmountOnEnter?: booleanIf true, mount the child only when entering.
Called when entering begins.
Called when entering completes.
Called while the component is entering.
Called when exiting begins.
Called when exiting completes.
Called while the component is exiting.
Optionaltimeout?: numberDuration (or durations) for the transition.
OptionalunmountOnExit?: booleanIf true, unmount the child after exiting.
Lilact doesn't need TransitionGroup, so it is the same as a fragment. In Lilact all the transitions and timeouts are automatically grouped.
The only missing feature here is the childFactory. I may add it in the future, but there are simple workarounds for that.
Promise that resolves after the delay.
Returns a Promise that resolves after a timeout (framework-managed) using the same delay semantics as
setTimeout.