{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "internal-collapsible-svelte",
  "title": "Internal Collapsible (Svelte)",
  "description": "Internal primitive used by Agent UI components; add a component instead.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/svelte@0.1.0-beta.17"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "packages/agent-ui/src/svelte/internal/collapsible/index.ts",
      "content": "import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from \"@ui-sdk/svelte/collapsible\";\nimport { withKindClass } from \"../kind-class\";\n\nexport const KindCollapsible = withKindClass(Collapsible, \"flex flex-col gap-1\");\nexport const KindCollapsibleTrigger = withKindClass(\n  CollapsibleTrigger,\n  \"inline-flex items-center gap-1.5 self-start rounded-[var(--kind-radius-md)] px-2 py-1 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-disabled:opacity-[var(--kind-disabled-opacity)]\",\n);\nexport const KindCollapsiblePanel = withKindClass(\n  CollapsiblePanel,\n  \"overflow-hidden px-2 text-[length:var(--kind-text-md)]/5 text-[var(--kind-color-fg)]\",\n);\n",
      "type": "registry:ui",
      "target": "@ui/svelte/internal/collapsible/index.ts"
    },
    {
      "path": "packages/agent-ui/src/svelte/internal/kind-class.ts",
      "content": "import type { Component } from \"svelte\";\nimport type { ClassValue } from \"svelte/elements\";\n\n// Class values a Kind part already merged. A part hands its props to its `render` snippet, so a Kind part rendered\n// there (`{#snippet render({ props })}<KindMenuTrigger {...props} />{/snippet}`) keeps them rather than adding its\n// own base classes: the element gets the outer part's base classes once, as React's `withKindClass` does.\nconst merged = new WeakSet<object>();\n\n// A caller may wrap the handed-over value (`class={[props.class, \"extra\"]}`), so a mark at any depth counts.\nconst isMerged = (value: unknown): boolean =>\n  Array.isArray(value) && (merged.has(value) || value.some(isMerged));\n\nfunction kindClass(base: string, value: unknown): ClassValue {\n  const result = isMerged(value) ? [value as ClassValue] : value ? [base, value as ClassValue] : [base];\n  merged.add(result);\n  return result;\n}\n\n/**\n * A UI SDK part with Kind's base classes before the caller's `class`. Every other prop, bindings and snippets\n * included, passes through as the caller wrote it.\n */\nexport function withKindClass<C extends Component<never>>(component: C, base: string): C {\n  const inner = component as unknown as (internals: unknown, props: object) => unknown;\n  const Kind = (internals: unknown, props: Record<PropertyKey, unknown>) =>\n    inner(\n      internals,\n      new Proxy(props, {\n        get: (target, key) => (key === \"class\" ? kindClass(base, target.class) : Reflect.get(target, key)),\n        has: (target, key) => key === \"class\" || Reflect.has(target, key),\n        ownKeys: (target) => {\n          const keys = Reflect.ownKeys(target);\n          return keys.includes(\"class\") ? keys : [...keys, \"class\"];\n        },\n        getOwnPropertyDescriptor: (target, key) =>\n          key === \"class\"\n            ? { enumerable: true, configurable: true, value: kindClass(base, target.class) }\n            : Reflect.getOwnPropertyDescriptor(target, key),\n      }),\n    );\n  return Kind as unknown as C;\n}\n",
      "type": "registry:ui",
      "target": "@ui/svelte/internal/kind-class.ts"
    }
  ],
  "meta": {
    "layer": "svelte",
    "hidden": true
  },
  "categories": [
    "internal"
  ],
  "type": "registry:ui"
}
