{"version":3,"file":"ChannelSlot.mjs","names":[],"sources":["../../../../src/plugins/SlotLayout/ChannelSlot.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useSlotChannel } from './hooks';\nimport { Channel as ChannelComponent, type ChannelProps } from '../../components/Channel';\nimport { WorkspacePanelProvider } from '../../context/WorkspaceNavigationContext';\n\nimport type { PropsWithChildren, ReactNode } from 'react';\nimport type { SlotName } from './layoutController/layoutControllerTypes';\n\nexport type ChannelSlotProps = PropsWithChildren<\n  Omit<ChannelProps, 'channel'> & {\n    /** Rendered when no channel is bound to `slot`. */\n    fallback?: ReactNode;\n    /**\n     * The layout slot to render. Pass it explicitly, since several channels can be open side by\n     * side. Without it the first slot holding a channel is used, which only suits a single-channel\n     * workspace.\n     */\n    slot?: SlotName;\n  }\n>;\n\n/**\n * Renders the channel bound to `slot`, or `fallback` when none is. It only displays: navigation\n * decides which channel goes into which slot. To resolve channels from layout bindings yourself\n * (e.g. in custom `slotRenderers`), render `<Channel channel={...} />` directly.\n */\nexport const ChannelSlot = ({\n  children,\n  fallback = null,\n  slot,\n  ...channelProps\n}: ChannelSlotProps) => {\n  const channel = useSlotChannel({ slot });\n\n  if (!channel) return <>{fallback}</>;\n\n  return (\n    <WorkspacePanelProvider panel={slot}>\n      <ChannelComponent {...channelProps} channel={channel}>\n        {children}\n      </ChannelComponent>\n    </WorkspacePanelProvider>\n  );\n};\n"],"mappings":";;;;;;;;;;;AA2BA,IAAa,eAAe,EAC1B,UACA,WAAW,MACX,MACA,GAAG,mBACmB;CACtB,MAAM,UAAU,eAAe,EAAE,KAAK,CAAC;CAEvC,IAAI,CAAC,SAAS,OAAO,oBAAA,YAAA,EAAA,UAAG,SAAW,CAAA;CAEnC,OACE,oBAAC,wBAAD;EAAwB,OAAO;YAC7B,oBAAC,SAAD;GAAkB,GAAI;GAAuB;GAC1C;EACe,CAAA;CACI,CAAA;AAE5B"}