import SmartComposedChart from '../../charts/SmartComposedChart';
import { usePreviewSurface } from '../../_dashboard_runtime/preview-surface-stub.js';

/**
 * Dashboard 柱形折线组合图 — 预览桥接：将平台 `spec` 交给 SmartComposedChart。
 */
export default function ComposedChartPreview({ spec }) {
  const previewSurface = usePreviewSurface();
  if (!spec) return null;
  const merged = {
    ...spec,
    config: { ...spec.config, resolveRoot: spec.config?.resolveRoot ?? previewSurface ?? undefined },
  };
  return <SmartComposedChart spec={merged} />;
}
