{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shared-align",
  "type": "registry:lib",
  "title": "shared/align",
  "description": "Internal module shared by the ui-* components (align). Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [
    "lit@^3.3.0"
  ],
  "registryDependencies": [
    "@kanok-ui/tokens"
  ],
  "files": [
    {
      "path": "src/primitives/shared/align.ts",
      "type": "registry:lib",
      "target": "components/ui/primitives/shared/align.ts",
      "content": "import type { LitElement } from 'lit';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the TypeScript mixin pattern requires any[]\ntype Constructor<T> = new (...args: any[]) => T;\n\n/** The element's own `placement` property, declared by the class that applies the mixin. */\ninterface Placed {\n    placement: string;\n}\n\n/** Carbon's name for `placement`. */\nexport interface AlignAlias {\n    align: string;\n}\n\n/**\n * Adds Carbon's `align` (property and attribute) as another name for `placement`, which takes the same\n * values (`top`, `bottom-start`, …). `placement` stays the documented name; `align` eases porting from Carbon.\n */\nexport const WithAlign = <T extends Constructor<LitElement>>(Base: T) => {\n    class WithAlignElement extends Base {\n        /** Carbon's name for `placement` (same values). */\n        get align(): string {\n            return (this as unknown as Placed).placement;\n        }\n\n        set align(value: string) {\n            (this as unknown as Placed).placement = value;\n        }\n\n        static get observedAttributes(): string[] {\n            // read the base getter with this class as receiver, so Lit collects this class's own properties\n            return [...(Reflect.get(Base, 'observedAttributes', this) as string[]), 'align'];\n        }\n\n        override attributeChangedCallback(name: string, old: string | null, value: string | null) {\n            if (name !== 'align') super.attributeChangedCallback(name, old, value);\n            else if (value !== null) this.align = value;\n        }\n    }\n    return WithAlignElement as Constructor<AlignAlias> & T;\n};\n"
    }
  ]
}
