@zag-js/anatomy
Advanced tools
Comparing version 0.0.0-dev-20221215180455 to 0.0.0-dev-20221221173409
@@ -1,12 +0,14 @@ | ||
type Part = { | ||
interface AnatomyPart { | ||
selector: string; | ||
attrs: Record<"data-scope" | "data-part", string>; | ||
}; | ||
type Anatomy<T extends string> = { | ||
parts: <U extends string>(...parts: U[]) => Omit<Anatomy<U>, "parts">; | ||
extendWith: <V extends string>(...parts: V[]) => Omit<Anatomy<T | V>, "parts">; | ||
build: () => Record<T, Part>; | ||
}; | ||
} | ||
type AnatomyInstance<T extends string> = Omit<Anatomy<T>, "parts">; | ||
type AnatomyPartName<T> = T extends AnatomyInstance<infer U> ? U : never; | ||
interface Anatomy<T extends string> { | ||
parts: <U extends string>(...parts: U[]) => AnatomyInstance<U>; | ||
extendWith: <V extends string>(...parts: V[]) => AnatomyInstance<T | V>; | ||
build: () => Record<T, AnatomyPart>; | ||
} | ||
declare const createAnatomy: <T extends string>(name: string, parts?: T[]) => Anatomy<T>; | ||
export { createAnatomy }; | ||
export { Anatomy, AnatomyInstance, AnatomyPart, AnatomyPartName, createAnatomy }; |
@@ -33,3 +33,3 @@ "use strict"; | ||
} | ||
throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extend(...) ?"); | ||
throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?"); | ||
}, | ||
@@ -36,0 +36,0 @@ extendWith: (...values) => createAnatomy(name, [...parts, ...values]), |
{ | ||
"name": "@zag-js/anatomy", | ||
"version": "0.0.0-dev-20221215180455", | ||
"version": "0.0.0-dev-20221221173409", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5819
92