{
  "name": "shell-owned",
  "type": "registry:ui",
  "description": "CAI MFE chrome contract: hide shell-owned brand, theme and profile controls when embedded in the workspace",
  "files": [
    {
      "path": "components/ui/shell-owned.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/**\n * CAI MFE chrome contract.\n *\n * Inside the CAI workspace shell the shell owns the Canadian AI brand, the theme\n * control and the profile avatar. Wrap those controls in <ShellOwned> and they\n * disappear when the app is embedded, and only then. The wrapper is\n * `display: contents`, so it never changes layout standalone.\n *\n * Pair it with <CaiEmbeddedScript /> in the root layout's <head> (sets\n * `html[data-embedded=\"true\"]` before first paint, so nothing flashes) and the\n * rule in `styles/mfe-chrome.css`. Lint: `tooling/mfe-chrome/eslint-plugin.mjs`.\n * E2E: `tooling/mfe-chrome/playwright.ts`.\n */\n\nexport type ShellControl = \"brand\" | \"theme\" | \"profile\"\n\nexport const CAI_EMBEDDED_ATTRIBUTE = \"data-embedded\"\nexport const CAI_SHELL_OWNED_ATTRIBUTE = \"data-cai-shell-owned\"\n\n/** Inline, pre-paint embed detection. Cross-origin access errors also mean \"embedded\". */\nexport const CAI_EMBEDDED_SCRIPT =\n  \"try{if(window.self!==window.top)document.documentElement.dataset.embedded='true'}catch(e){document.documentElement.dataset.embedded='true'}\"\n\n/** Render inside the root layout's <head>. Add `suppressHydrationWarning` to <html>. */\nexport function CaiEmbeddedScript() {\n  return <script dangerouslySetInnerHTML={{ __html: CAI_EMBEDDED_SCRIPT }} />\n}\n\nexport function ShellOwned({\n  control,\n  children,\n  className,\n}: {\n  control: ShellControl\n  children: React.ReactNode\n  className?: string\n}) {\n  return (\n    <span {...{ [CAI_SHELL_OWNED_ATTRIBUTE]: control }} className={cn(\"contents\", className)}>\n      {children}\n    </span>\n  )\n}\n\n/** For logic (not hiding): true once mounted inside the CAI shell. */\nexport function useCaiEmbedded() {\n  const [embedded, setEmbedded] = React.useState(false)\n  React.useEffect(() => {\n    setEmbedded(document.documentElement.dataset.embedded === \"true\")\n  }, [])\n  return embedded\n}\n",
      "type": "registry:ui"
    }
  ]
}