/**
 * SlotsContext - React state-based UI slot management
 *
 * Replaces the UIEnvironment observable store with plain React state.
 * No stacking logic, no priority system.
 *
 * A transition's effects produce the COMPLETE content for each slot
 * from the POV of the trait that fired. The runtime collects all render-ui
 * effects from a transition, groups by slot, and calls
 * `setSlotPatterns(slot, patterns, source)` once per slot.
 *
 * Multi-trait parity with the compiled path (2026-04-24):
 * State is keyed by (slot, sourceTraitName). When ProbeCreate renders to
 * "main" and ProbePersistor also renders to "main", both entries coexist —
 * each source owns its own sub-entry. Consumers see them as a list in
 * insertion order. Prior model was single-entry per slot (last-writer-wins),
 * which diverged from the compiled path's VStack-of-trait-views layout.
 *
 * @packageDocumentation
 */
import React from 'react';
import type { PatternConfig, EventSource, ResolvedTrait } from '@almadar/core';
/** A single pattern entry in a slot */
export interface SlotPatternEntry {
    pattern: PatternConfig;
    props: Record<string, unknown>;
}
/**
 * Source metadata for a rendered slot. Extends `@almadar/core`'s
 * `EventSource` (which owns the `{ trait, transition?, tick? }` shape
 * shared with the event bus) with UI-only debug fields used by the Slot
 * Inspector. Keeping the core subset aligned means the slot machinery
 * can round-trip with event bus metadata without re-coercion.
 */
export interface SlotSource extends EventSource {
    /** Source trait's current state at the moment of render. */
    state: string;
    /** Raw effects block that produced this render, for inspector display. */
    effects?: unknown[];
    /** Full trait definition for inspector */
    traitDefinition?: ResolvedTrait;
}
/**
 * One source's contribution to a slot. The same slot can receive
 * contributions from multiple source traits (e.g. a page-level layout
 * where ProbeCreate and ProbePersistor both render to "main").
 */
export interface SlotEntry {
    patterns: SlotPatternEntry[];
    source?: SlotSource;
}
/**
 * All source contributions to a single slot, keyed by the source trait's
 * name. The sentinel `'__default__'` key is used when `setSlotPatterns`
 * is called without a source (legacy / unscoped callers).
 *
 * Iteration order reflects insertion order — the first trait to write to
 * the slot renders first, which matches the compiled-path VStack order
 * set by the .lolo's `page ... -> Trait1, Trait2, ...` declaration.
 */
export type SlotState = Record<string, SlotEntry>;
/** All slots state */
export type SlotsState = Record<string, SlotState>;
/** Mutation functions for slots (stable references, won't trigger re-renders) */
export interface SlotsActions {
    /**
     * Set this source's contribution to a slot atomically. Replaces any
     * prior content FROM THE SAME SOURCE only; other sources' entries in
     * the slot are untouched.
     */
    setSlotPatterns: (slot: string, patterns: SlotPatternEntry[], source?: SlotSource) => void;
    /**
     * Clear a slot entirely. Wipes all source entries; consumers see an
     * empty slot (no patterns from any source).
     */
    clearSlot: (slot: string) => void;
    /** Remove a single source's contribution from a slot, keeping others. */
    clearSlotForSource: (slot: string, sourceTrait: string) => void;
    /** Clear all slots */
    clearAllSlots: () => void;
}
/** Entries in render order for a slot (insertion order, empty-filtered). */
export declare function slotEntriesInOrder(slot: SlotState | null | undefined): Array<{
    sourceKey: string;
    entry: SlotEntry;
}>;
export interface SlotsProviderProps {
    children: React.ReactNode;
}
/**
 * SlotsProvider - Manages UI slot state via React useState.
 *
 * Replaces UIEnvironmentProvider. No observable store, no stacking logic.
 * Slots are set atomically per (transition, source) — React diffs and re-renders.
 */
export declare function SlotsProvider({ children }: SlotsProviderProps): React.ReactElement;
/**
 * Get the full slots state. Triggers re-render on ANY slot change.
 * Prefer useSlotContent(name) for individual slot subscriptions.
 */
export declare function useSlots(): SlotsState;
/**
 * Get the per-source state map for a specific slot. Returns null if
 * nothing has written to this slot yet. To iterate sources in render
 * order, use `slotEntriesInOrder(useSlotContent(name))`.
 */
export declare function useSlotContent(slotName: string): SlotState | null;
/**
 * Get slot mutation actions. Stable reference — never triggers re-renders.
 */
export declare function useSlotsActions(): SlotsActions;
