"use client"; // @yakcloud/client-shell — 서비스 클라이언트 셸 컨텍스트. // 서비스 메타(id/type/cluster/status) + 탭 상태(activeTab) + 패널 시트 컨트롤(usePanelSheets) 공유. // ⛔ DOM 가정 금지(main.main querySelector 폴백 없음) — scrollContainer 는 명시 주입만. // ds-sdk 는 type-only, ui(usePanelSheets)는 런타임 소비. import { createContext, useContext } from "react"; import type { ReactNode } from "react"; import { usePanelSheets } from "@yakcloud/ui"; import type { PanelSheetsCtl } from "@yakcloud/ui"; import type { ServiceStatusDTO, ServiceTypeDTO } from "@yakcloud/ds-sdk"; import type { LoadingGuardState } from "../hooks/useServiceClient"; export interface ServiceClientContextValue { // 서비스 메타 serviceId: string; name: string; sourceType: ServiceTypeDTO; clusterId: string; clusterName: string; status: ServiceStatusDTO | undefined; guardState: LoadingGuardState; // 탭 상태 activeTab: string; setActiveTab: (tab: string) => void; tabs: readonly string[]; // 패널 시트 컨트롤(헤더↔본문 슬라이드 시트) sheets: PanelSheetsCtl; // 스크롤 잠금 대상 컨테이너(선택) — 시트 열림 동안 잠금. 미지정 시 no-op. scrollContainer: HTMLElement | null; // 로고 URL 조합 베이스(getServiceMeta logoBase). logoBase: string; } const Ctx = createContext(null); export function ServiceClientProvider({ value, children, }: { value: Omit; children: ReactNode; }) { const sheets = usePanelSheets(); return {children}; } export function useServiceClientContext(): ServiceClientContextValue { const v = useContext(Ctx); if (!v) { throw new Error( "useServiceClientContext must be used within (ServiceClientShell).", ); } return v; }