{"version":3,"file":"PortalBridge.mjs","sources":["../../../../src/lib/layouts/context-aware/PortalBridge.tsx"],"sourcesContent":["/**\n * @fileoverview Portal Bridge Component\n *\n * A React component that renders children through a portal while\n * maintaining DOM context from the source location.\n *\n * Features:\n * - Preserves DOM context across portal boundaries\n * - Manages z-index automatically\n * - Supports event bridging back to source\n * - Handles nested portals correctly\n * - Resilient fallback rendering when portals fail\n * - React environment validation to prevent blank pages\n *\n * @module layouts/context-aware/PortalBridge\n * @author Agent 4 - PhD Context Systems Expert\n * @version 1.1.0\n */\n\nimport React, { useRef, useEffect, useState, useCallback, useContext } from 'react';\nimport { PortalBridgeContext } from '../../contexts/PortalBridgeContext';\nimport { createPortal } from 'react-dom';\nimport { isReactEnvironmentHealthy, checkReactEnvironment } from '../../core/react-env';\n\nimport type { PortalContext, PortalBridgeProps, DOMContextSnapshot } from './types';\nimport { Z_INDEX_LAYERS } from './types';\nimport {\n  getPortalContextManager,\n  createPortalContext,\n  destroyPortalContext,\n} from './portal-bridge';\nimport { getZIndexManager } from './z-index-manager';\nimport { useDOMContextValue } from './DOMContextProvider';\n\n// ============================================================================\n// Portal Context\n// ============================================================================\n\n/* @refresh reset */\n\n/**\n * React context for portal state.\n */\n/**\n * Hook to access portal context.\n */\n// eslint-disable-next-line react-refresh/only-export-components -- hook export is valid\nexport function usePortalBridgeContext(): PortalContext | null {\n  const context = useContext(PortalBridgeContext);\n  return (context as PortalContext | null) ?? null;\n}\n\n// ============================================================================\n// PortalBridge Component\n// ============================================================================\n\n/**\n * Renders children through a portal while preserving DOM context.\n *\n * @remarks\n * This component creates a React portal but ensures that the\n * DOM context from the source location is available to the\n * portal content. This is useful for modals, tooltips, and\n * other overlay components that need to know about their\n * logical position in the component tree.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <PortalBridge>\n *   <Modal>Content</Modal>\n * </PortalBridge>\n *\n * // With custom target and layer\n * <PortalBridge\n *   target=\"#modal-root\"\n *   layer=\"modal\"\n *   bridgeEvents\n * >\n *   <Modal>Content</Modal>\n * </PortalBridge>\n *\n * // With lifecycle callbacks\n * <PortalBridge\n *   onPortalMount={(portal) => console.log('Mounted:', portal)}\n *   onPortalUnmount={() => console.log('Unmounted')}\n * >\n *   <Tooltip>Content</Tooltip>\n * </PortalBridge>\n * ```\n */\nexport function PortalBridge({\n  children,\n  target,\n  layer = 'modal',\n  bridgeEvents = true,\n  preserveScrollPosition = false,\n  onPortalMount,\n  onPortalUnmount,\n  className,\n  style,\n  'data-testid': testId,\n  fallbackToInline = true,\n  fallback,\n  onPortalError,\n}: PortalBridgeProps): React.JSX.Element | null {\n  // Refs\n  const sourceRef = useRef<HTMLDivElement>(null);\n  const portalContainerRef = useRef<HTMLDivElement | null>(null);\n  const scrollPositionRef = useRef<{ x: number; y: number } | null>(null);\n\n  // State\n  const [portalContext, setPortalContext] = useState<PortalContext | null>(null);\n  const [isReady, setIsReady] = useState(false);\n  const [portalContainer, setPortalContainer] = useState<HTMLDivElement | null>(null);\n  const [portalError, setPortalError] = useState<Error | null>(null);\n  const [reactEnvHealthy, setReactEnvHealthy] = useState<boolean | null>(null);\n\n  // Get current DOM context\n  const domContext = useDOMContextValue();\n\n  // Get parent portal context (for nested portals)\n  const parentPortalContext = usePortalBridgeContext();\n\n  // Check if we're in SSR\n  const isSSR = typeof window === 'undefined';\n\n  // Check React environment health on mount\n  useEffect(() => {\n    if (isSSR) {\n      queueMicrotask(() => setReactEnvHealthy(true));\n      return;\n    }\n\n    try {\n      const healthy = isReactEnvironmentHealthy();\n      queueMicrotask(() => {\n        setReactEnvHealthy(healthy);\n\n        if (!healthy) {\n          const envStatus = checkReactEnvironment({ logWarnings: true });\n          const errorMsg = envStatus.issues\n            .filter((i) => i.severity === 'error')\n            .map((i) => i.message)\n            .join('; ');\n          const err = new Error(`React environment unhealthy: ${errorMsg}`);\n          setPortalError(err);\n          onPortalError?.(err);\n        }\n      });\n    } catch (err) {\n      queueMicrotask(() => {\n        setReactEnvHealthy(false);\n        const error = err instanceof Error ? err : new Error('React environment check failed');\n        setPortalError(error);\n        onPortalError?.(error);\n      });\n    }\n  }, [isSSR, onPortalError]);\n\n  /**\n   * Resolves the portal target element.\n   */\n  const resolveTarget = useCallback((): Element | null => {\n    if (isSSR) {\n      return null;\n    }\n\n    if (target instanceof Element) {\n      return target;\n    }\n\n    if (typeof target === 'string') {\n      return document.querySelector(target);\n    }\n\n    // Default: create or find portal root\n    let root = document.getElementById('portal-root');\n    if (!root) {\n      root = document.createElement('div');\n      root.id = 'portal-root';\n      document.body.appendChild(root);\n    }\n    return root;\n  }, [target, isSSR]);\n\n  /**\n   * Creates the portal container element.\n   */\n  const createPortalContainer = useCallback((): HTMLDivElement => {\n    const container = document.createElement('div');\n    container.setAttribute('data-portal-container', 'true');\n    container.setAttribute('data-portal-layer', layer);\n\n    // Apply z-index\n    const zIndex = Z_INDEX_LAYERS[layer];\n    container.style.cssText = `\n      position: relative;\n      z-index: ${zIndex};\n    `;\n\n    if (className != null && className !== '') {\n      container.className = className;\n    }\n\n    if (style != null) {\n      Object.assign(container.style, style);\n    }\n\n    if (testId != null && testId !== '') {\n      container.setAttribute('data-testid', testId);\n    }\n\n    return container;\n  }, [layer, className, style, testId]);\n\n  // Initialize portal\n  useEffect(() => {\n    if (isSSR) {\n      return;\n    }\n\n    const root = resolveTarget();\n    if (!root) {\n      console.warn('[PortalBridge] Could not resolve portal target');\n      return;\n    }\n\n    // Create portal container\n    const container = createPortalContainer();\n    portalContainerRef.current = container;\n    root.appendChild(container);\n\n    // Set state asynchronously to avoid synchronous setState in effect\n    queueMicrotask(() => {\n      setPortalContainer(container);\n    });\n\n    // Save scroll position if preserving\n    if (preserveScrollPosition) {\n      scrollPositionRef.current = {\n        x: window.scrollX,\n        y: window.scrollY,\n      };\n    }\n\n    // Create portal context\n    if (sourceRef.current) {\n      const ctx = createPortalContext(sourceRef.current, {\n        target: container,\n        layer,\n        bridgeEvents,\n        parentPortal: parentPortalContext ?? undefined,\n      });\n\n      // Create portal context that matches the interface\n      const fullContext: import('@/lib/contexts').PortalContext = {\n        registerPortal: (_id: string, _container: HTMLElement) => {\n          console.warn('Portal registration not implemented');\n        },\n        unregisterPortal: (_id: string) => {\n          console.warn('Portal unregistration not implemented');\n        },\n        getPortalContainer: (_id: string) => container,\n        renderInPortal: (_id: string, _content: React.ReactNode) => {\n          console.warn('Portal rendering not implemented');\n        },\n      };\n\n      // Set state asynchronously to avoid synchronous setState in effect\n      queueMicrotask(() => {\n        setPortalContext(fullContext as unknown as PortalContext | null);\n        setIsReady(true);\n      });\n\n      // Register with z-index manager\n      const zIndexManager = getZIndexManager();\n      zIndexManager.register(container, { layer });\n\n      // Call mount callback\n      onPortalMount?.(ctx);\n    }\n\n    // Cleanup\n    return () => {\n      if (portalContainerRef.current && root.contains(portalContainerRef.current)) {\n        root.removeChild(portalContainerRef.current);\n      }\n\n      if (portalContext) {\n        destroyPortalContext(portalContext.portalId);\n      }\n\n      // Restore scroll position if needed\n      if (preserveScrollPosition && scrollPositionRef.current) {\n        window.scrollTo(scrollPositionRef.current.x, scrollPositionRef.current.y);\n      }\n\n      onPortalUnmount?.();\n    };\n  }, [\n    isSSR,\n    resolveTarget,\n    createPortalContainer,\n    layer,\n    bridgeEvents,\n    preserveScrollPosition,\n    parentPortalContext,\n    onPortalMount,\n    onPortalUnmount,\n    portalContext,\n  ]);\n\n  // Update portal context when DOM context changes\n  useEffect(() => {\n    if (portalContext && sourceRef.current) {\n      const manager = getPortalContextManager();\n      manager.refreshSourceContext(portalContext.portalId);\n    }\n  }, [domContext, portalContext]);\n\n  // Determine if we should render fallback content\n  const shouldRenderFallback =\n    portalError !== null || reactEnvHealthy === false || (isSSR && fallbackToInline);\n\n  // Render fallback content inline if portal fails\n  const renderFallbackContent = async () => {\n    if (fallback !== undefined) {\n      return fallback;\n    }\n    if (fallbackToInline) {\n      return (\n        <div className={className} style={style} data-testid={testId} data-portal-fallback=\"true\">\n          {children}\n        </div>\n      );\n    }\n    return null;\n  };\n\n  // Render source marker and portal\n  return (\n    <>\n      {/* Source marker for context capture */}\n      <div ref={sourceRef} data-portal-source=\"true\" style={{ display: 'contents' }} />\n\n      {/* Fallback rendering when portal cannot be created */}\n      {shouldRenderFallback && renderFallbackContent()}\n\n      {/* Portal content - only render if environment is healthy and portal is ready */}\n      {!shouldRenderFallback && isReady && portalContainer != null && portalContext != null && (\n        <PortalBridgeContext.Provider\n          value={{\n            registerPortal: (_id: string, _container: HTMLElement) => {\n              // Implementation for registering portal\n              console.warn('Portal registration not implemented');\n            },\n            unregisterPortal: (_id: string) => {\n              // Implementation for unregistering portal\n              console.warn('Portal unregistration not implemented');\n            },\n            getPortalContainer: (_id: string) => {\n              // Implementation for getting portal container\n              console.warn('Portal container retrieval not implemented');\n              return null;\n            },\n            renderInPortal: (_id: string, _content: React.ReactNode) => {\n              // Implementation for rendering in portal\n              console.warn('Portal rendering not implemented');\n            },\n          }}\n        >\n          {createPortal(\n            <PortalContent sourceContext={portalContext.sourceContext}>{children}</PortalContent>,\n            portalContainer\n          )}\n        </PortalBridgeContext.Provider>\n      )}\n\n      {/* Inline fallback when portal is not ready but environment is healthy */}\n      {!shouldRenderFallback && !isReady && fallbackToInline && (\n        <div data-portal-pending=\"true\" style={{ display: 'contents' }}>\n          {children}\n        </div>\n      )}\n    </>\n  );\n}\n\n// ============================================================================\n// Portal Content Wrapper\n// ============================================================================\n\n/**\n * Props for PortalContent component.\n */\ninterface PortalContentProps {\n  children: React.ReactNode;\n  sourceContext: DOMContextSnapshot;\n}\n\n/**\n * Wraps portal content and provides source context information.\n */\nfunction PortalContent({ children, sourceContext }: PortalContentProps): React.JSX.Element {\n  return (\n    <div data-portal-content=\"true\" data-source-context-time={sourceContext.timestamp}>\n      {children}\n    </div>\n  );\n}\n\n// ============================================================================\n// Convenience Components\n// ============================================================================\n\n/**\n * Props for ModalPortal component.\n */\nexport interface ModalPortalProps extends Omit<PortalBridgeProps, 'layer'> {\n  /** Whether the modal is open */\n  isOpen: boolean;\n  /** Accessible label for the modal */\n  ariaLabel?: string;\n  /** ID of element that labels the modal */\n  ariaLabelledBy?: string;\n  /** ID of element that describes the modal */\n  ariaDescribedBy?: string;\n}\n\n/**\n * Portal specifically configured for modal dialogs.\n * Includes proper accessibility attributes: role=\"dialog\" and aria-modal=\"true\"\n *\n * @example\n * ```tsx\n * <ModalPortal isOpen={isModalOpen} ariaLabel=\"Confirmation dialog\">\n *   <ModalDialog>\n *     <ModalHeader>Title</ModalHeader>\n *     <ModalBody>Content</ModalBody>\n *   </ModalDialog>\n * </ModalPortal>\n * ```\n */\nexport function ModalPortal({\n  isOpen,\n  children,\n  ariaLabel,\n  ariaLabelledBy,\n  ariaDescribedBy,\n  ...props\n}: ModalPortalProps): React.JSX.Element | null {\n  if (!isOpen) {\n    return null;\n  }\n\n  return (\n    <PortalBridge layer=\"modal\" {...props}>\n      <div\n        role=\"dialog\"\n        aria-modal=\"true\"\n        aria-label={ariaLabel}\n        aria-labelledby={ariaLabelledBy}\n        aria-describedby={ariaDescribedBy}\n      >\n        {children}\n      </div>\n    </PortalBridge>\n  );\n}\n\n/**\n * Props for TooltipPortal component.\n */\nexport interface TooltipPortalProps extends Omit<PortalBridgeProps, 'layer'> {\n  /** Whether the tooltip is visible */\n  isVisible: boolean;\n}\n\n/**\n * Portal specifically configured for tooltips.\n *\n * @example\n * ```tsx\n * <TooltipPortal isVisible={showTooltip}>\n *   <Tooltip position={position}>\n *     Tooltip content\n *   </Tooltip>\n * </TooltipPortal>\n * ```\n */\nexport function TooltipPortal({\n  isVisible,\n  children,\n  ...props\n}: TooltipPortalProps): React.JSX.Element | null {\n  if (!isVisible) {\n    return null;\n  }\n\n  return (\n    <PortalBridge layer=\"tooltip\" bridgeEvents={false} {...props}>\n      {children}\n    </PortalBridge>\n  );\n}\n\n/**\n * Props for PopoverPortal component.\n */\nexport interface PopoverPortalProps extends Omit<PortalBridgeProps, 'layer'> {\n  /** Whether the popover is open */\n  isOpen: boolean;\n}\n\n/**\n * Portal specifically configured for popovers.\n *\n * @example\n * ```tsx\n * <PopoverPortal isOpen={isPopoverOpen}>\n *   <Popover>\n *     Popover content\n *   </Popover>\n * </PopoverPortal>\n * ```\n */\nexport function PopoverPortal({\n  isOpen,\n  children,\n  ...props\n}: PopoverPortalProps): React.JSX.Element | null {\n  if (!isOpen) {\n    return null;\n  }\n\n  return (\n    <PortalBridge layer=\"popover\" {...props}>\n      {children}\n    </PortalBridge>\n  );\n}\n"],"names":["usePortalBridgeContext","useContext","PortalBridgeContext","PortalBridge","children","target","layer","bridgeEvents","preserveScrollPosition","onPortalMount","onPortalUnmount","className","style","testId","fallbackToInline","fallback","onPortalError","sourceRef","useRef","portalContainerRef","scrollPositionRef","portalContext","setPortalContext","useState","isReady","setIsReady","portalContainer","setPortalContainer","portalError","setPortalError","reactEnvHealthy","setReactEnvHealthy","domContext","useDOMContextValue","parentPortalContext","isSSR","useEffect","healthy","isReactEnvironmentHealthy","errorMsg","checkReactEnvironment","i","err","error","resolveTarget","useCallback","root","createPortalContainer","container","zIndex","Z_INDEX_LAYERS","ctx","createPortalContext","fullContext","_id","_container","_content","getZIndexManager","destroyPortalContext","getPortalContextManager","shouldRenderFallback","jsxs","Fragment","jsx","createPortal","PortalContent","sourceContext","ModalPortal","isOpen","ariaLabel","ariaLabelledBy","ariaDescribedBy","props","TooltipPortal","isVisible","PopoverPortal"],"mappings":";;;;;;;;;AA+CO,SAASA,KAA+C;AAE7D,SADgBC,EAAWC,CAAmB,KACF;AAC9C;AAyCO,SAASC,EAAa;AAAA,EAC3B,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,cAAAC,IAAe;AAAA,EACf,wBAAAC,IAAyB;AAAA,EACzB,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAeC;AAAA,EACf,kBAAAC,IAAmB;AAAA,EACnB,UAAAC;AAAA,EACA,eAAAC;AACF,GAAgD;AAE9C,QAAMC,IAA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