{"version":3,"names":["createContext","useContext","TooltipRootContext","useTooltipRootContext","context","Error"],"sources":["tooltip-root-context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\nimport type {\n\tBaseUIChangeEventDetails,\n\tREASONS,\n} from \"../internals/change-event-details\";\nimport type { FloatingRootStore } from \"../internals/floating-ui/components/floating-root-store\";\nimport type { UseInteractionsReturn } from \"../internals/floating-ui/hooks/use-interactions\";\nimport type { TransitionStatus } from \"../internals/use-transition-status/use-transition-status\";\nimport type { TooltipStore } from \"./store/tooltip-store\";\n\n/**\n * Reasons a tooltip's open state can change. Mirrors Base UI React's\n * `TooltipRoot.ChangeEventReason` union.\n */\nexport type TooltipRootChangeEventReason =\n\t| typeof REASONS.triggerHover\n\t| typeof REASONS.triggerFocus\n\t| typeof REASONS.triggerPress\n\t| typeof REASONS.outsidePress\n\t| typeof REASONS.escapeKey\n\t| typeof REASONS.disabled\n\t| typeof REASONS.imperativeAction\n\t| typeof REASONS.none\n\t| typeof REASONS.cancelOpen\n\t| typeof REASONS.focusOut;\n\nexport type TooltipRootChangeEventDetails =\n\tBaseUIChangeEventDetails<TooltipRootChangeEventReason>;\n\n/**\n * Public projected state — surfaces via `data-*` attrs on the root and\n * downstream parts.\n */\nexport interface TooltipRootState {\n\t/** Whether the tooltip is currently open. */\n\topen: boolean;\n}\n\n/**\n * `instant` is the string flag that Base UI emits as `data-instant` on the\n * popup / arrow / positioner to disable CSS transitions for specific\n * programmatic transitions (delay-group swap, focus, dismiss).\n */\nexport type TooltipInstantType = \"delay\" | \"focus\" | \"dismiss\" | undefined;\n\n/**\n * Context shape shared between `<Tooltip.Root>` and every tooltip sub-part.\n * Every reactive field is an `Accessor<T>` so consumers don't need to guard\n * against top-level reactive reads.\n */\nexport interface TooltipRootContextValue {\n\t/** Reactive accessor for the current open state (gated by `disabled`). */\n\topen: Accessor<boolean>;\n\t/** Whether interactions are disabled. */\n\tdisabled: Accessor<boolean>;\n\t/** Whether the popup is mounted (may still be true during exit). */\n\tmounted: Accessor<boolean>;\n\t/** Enter/exit transition phase. */\n\ttransitionStatus: Accessor<TransitionStatus>;\n\t/** Instant-type flag projected onto the popup / arrow as `data-instant`. */\n\tinstantType: Accessor<TooltipInstantType>;\n\t/** Whether the delay-group currently has this member in instant phase. */\n\tisInstantPhase: Accessor<boolean>;\n\t/** Public projected state (used by `renderElement`). */\n\tstate: Accessor<TooltipRootState>;\n\t/** Setter for `instantType` — called by trigger / popup when events fire. */\n\tsetInstantType: (value: TooltipInstantType) => void;\n\t/** Setter for `isInstantPhase` — called by the trigger's `useDelayGroup`. */\n\tsetIsInstantPhase: (value: boolean) => void;\n\t/** Imperative open setter. */\n\tsetOpen: (next: boolean, details: TooltipRootChangeEventDetails) => void;\n\t/** Reactive accessor for the root's floating-ui store. */\n\tfloatingRootContext: FloatingRootStore;\n\t/** Interaction prop bags produced by `useInteractions`. */\n\tinteractions: UseInteractionsReturn;\n\t/** Setter for the trigger DOM element. */\n\tsetTriggerElement: (node: HTMLElement | null) => void;\n\t/** Accessor for the trigger DOM element. */\n\ttriggerElement: Accessor<HTMLElement | null>;\n\t/** Setter for the popup DOM element. */\n\tsetPopupElement: (node: HTMLElement | null) => void;\n\t/** Accessor for the popup DOM element. */\n\tpopupElement: Accessor<HTMLElement | null>;\n\t/**\n\t * The `TooltipStore` owned by this root. Triggers register into its\n\t * `context.triggerElements` map; the handle (if any) is also backed\n\t * by this store.\n\t */\n\tstore: TooltipStore<unknown>;\n\t/**\n\t * Accessor for the currently-selected trigger id.\n\t */\n\tactiveTriggerId: Accessor<string | null>;\n\tsetActiveTriggerId: (id: string | null) => void;\n\t/** Current payload. */\n\tpayload: Accessor<unknown>;\n\tsetPayload: (payload: unknown) => void;\n\t/** Accessor for whether hover-safe-polygon is disabled. */\n\tdisableHoverablePopup: Accessor<boolean>;\n\t/** Accessor for the track-cursor-axis value. */\n\ttrackCursorAxis: Accessor<\"none\" | \"x\" | \"y\" | \"both\">;\n\t/** Accessor for whether clicking the trigger closes the tooltip. */\n\tcloseOnClick: Accessor<boolean>;\n\t/** Internal writer used by the active trigger's `closeOnClick` option. */\n\tsetCloseOnClick: (value: boolean) => void;\n\t/**\n\t * Prop bag returned by `useClientPoint` — merged onto the active\n\t * trigger when `trackCursorAxis !== \"none\"`. Empty otherwise.\n\t */\n\tclientPointReferenceProps: Accessor<Record<string, unknown>>;\n\t/**\n\t * Prop bag returned by `useClientPoint` — merged onto the popup when\n\t * `trackCursorAxis !== \"none\"`. Empty otherwise.\n\t */\n\tclientPointFloatingProps: Accessor<Record<string, unknown>>;\n}\n\n/**\n * Solid 2's `useContext` throws `ContextNotFoundError` when the resolved\n * value is `undefined`, so the \"no provider\" sentinel is `null` here — the\n * helper below turns that into the Base UI error.\n */\nexport const TooltipRootContext = createContext<TooltipRootContextValue | null>(\n\tnull,\n);\n\n/**\n * Read the current `<Tooltip.Root>` context. Throws if used outside a root —\n * matches Base UI React's behavior.\n */\nexport function useTooltipRootContext(): TooltipRootContextValue {\n\tconst context = useContext(TooltipRootContext);\n\tif (context === null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.\",\n\t\t);\n\t}\n\treturn context;\n}\n"],"mappings":"AAAA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAUnE;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAoEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGF,aAAa,CAC9C,IACD,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASG,qBAAqBA,CAAA,EAA4B;EAChE,MAAMC,OAAO,GAAGH,UAAU,CAACC,kBAAkB,CAAC;EAC9C,IAAIE,OAAO,KAAK,IAAI,EAAE;IACrB,MAAM,IAAIC,KAAK,CACd,6FACD,CAAC;EACF;EACA,OAAOD,OAAO;AACf","ignoreList":[]}