{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "internal-toggle-solid",
  "title": "Internal Toggle (Solid)",
  "description": "Internal primitive used by Agent UI components; add a component instead.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/solid@0.1.0-beta.17"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/internal/toggle.tsx",
      "content": "import { Toggle, ToggleIcon } from \"@ui-sdk/solid/toggle\";\nimport { withKindClass } from \"./kind-class\";\n\nexport const KindToggle = withKindClass(\n  Toggle,\n  \"inline-flex h-[var(--kind-control-height)] items-center justify-center gap-1.5 rounded-[var(--kind-radius-full)] px-3 text-[length:var(--kind-text-md)]/5 font-medium text-[var(--kind-color-fg)] hover:bg-[var(--kind-color-hover)] focus-visible:[outline:var(--kind-focus-ring)] focus-visible:[outline-offset:var(--kind-focus-offset)] data-pressed:bg-[var(--kind-color-selected)] data-disabled:opacity-[var(--kind-disabled-opacity)] active:bg-[var(--kind-color-pressed)] active:scale-[var(--kind-press-scale)] motion-reduce:active:scale-100 transition-[background-color,color,scale] duration-[var(--kind-duration-fast)]\",\n);\nexport const KindToggleIcon = withKindClass(ToggleIcon, \"inline-flex size-4 shrink-0\");\n",
      "type": "registry:ui",
      "target": "@ui/solid/internal/toggle.tsx"
    },
    {
      "path": "packages/agent-ui/src/solid/internal/kind-class.ts",
      "content": "import type { JSX } from \"@solidjs/web\";\nimport { type Component, createComponent, merge, untrack } from \"solid-js\";\n\ntype ClassValue = string | ((state: never) => string | undefined) | undefined;\ntype Render = (props: Record<string, unknown>, state: unknown) => JSX.Element;\ntype KindProps = { class?: ClassValue; render?: Render; \"data-slot\"?: unknown };\n\nfunction mergeClass(base: string, value: ClassValue): ClassValue {\n  if (typeof value === \"function\") {\n    return (state: never) => {\n      const extra = value(state);\n      return extra ? `${base} ${extra}` : base;\n    };\n  }\n  return value ? `${base} ${value}` : base;\n}\n\n// The `data-slot` of the part whose `render` is running. The first Kind part it creates with that part's props is\n// the render target and renders its bare UI SDK part, so the element gets the outer base classes once instead of\n// both lists, as React's `withKindClass` does for `render={<KindMenuTrigger />}`.\nlet rendering: unknown;\nconst bareRenders = new WeakMap<Render, Render>();\n\nfunction bareRender(render: Render | undefined): Render | undefined {\n  if (typeof render !== \"function\") return render;\n  let bare = bareRenders.get(render);\n  if (!bare) {\n    bare = (props, state) => {\n      rendering = untrack(() => props[\"data-slot\"]);\n      try {\n        return render(props, state);\n      } finally {\n        rendering = undefined;\n      }\n    };\n    bareRenders.set(render, bare);\n  }\n  return bare;\n}\n\nexport function withKindClass<C extends (props: never) => JSX.Element>(component: C, base: string): C {\n  // UI SDK parts are generic over their props; the wrapper keeps the caller's component type.\n  const Inner = component as unknown as Component<KindProps>;\n  const Kind: Component<KindProps> = (props) => {\n    const target = rendering != null && untrack(() => props[\"data-slot\"]) === rendering;\n    if (target) rendering = undefined;\n    return createComponent(\n      Inner,\n      merge(props, {\n        get class() {\n          return target ? props.class : mergeClass(base, props.class);\n        },\n        get render() {\n          return bareRender(props.render);\n        },\n      }),\n    );\n  };\n  return Kind as unknown as C;\n}\n\n/**\n * An icon that isn't an image URL, ready to insert: a function is called untracked, so it draws a new copy in each\n * place the icon shows, and an element is cloned, since one DOM node can sit in only one place.\n */\nexport function iconElement(icon: unknown): JSX.Element {\n  if (typeof icon === \"function\") return untrack(icon as () => JSX.Element);\n  if (typeof Node !== \"undefined\" && icon instanceof Node) return icon.cloneNode(true) as JSX.Element;\n  return icon as JSX.Element;\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/internal/kind-class.ts"
    }
  ],
  "meta": {
    "layer": "solid",
    "hidden": true
  },
  "categories": [
    "internal"
  ],
  "type": "registry:ui"
}
