diff --git a/theatre/core/src/privateAPIs.ts b/theatre/core/src/privateAPIs.ts index 3ed0bcf..cadc326 100644 --- a/theatre/core/src/privateAPIs.ts +++ b/theatre/core/src/privateAPIs.ts @@ -11,6 +11,9 @@ import type {$IntentionalAny} from '@theatre/shared/utils/types' const publicAPIToPrivateAPIMap = new WeakMap() +/** + * Given a public API object, returns the corresponding private API object. + */ export function privateAPI
( pub: P, ): P extends IProject @@ -25,6 +28,10 @@ export function privateAPI
(
return publicAPIToPrivateAPIMap.get(pub)
}
+/**
+ * Notes the relationship between a public API object and its corresponding private API object,
+ * so that `privateAPI` can find it.
+ */
export function setPrivateAPI(pub: IProject, priv: Project): void
export function setPrivateAPI(pub: ISheet, priv: Sheet): void
export function setPrivateAPI(pub: ISequence, priv: Sequence): void
diff --git a/theatre/shared/src/propTypes/utils.ts b/theatre/shared/src/propTypes/utils.ts
index fbcf516..5b48601 100644
--- a/theatre/shared/src/propTypes/utils.ts
+++ b/theatre/shared/src/propTypes/utils.ts
@@ -8,13 +8,21 @@ import type {
import type {PathToProp} from '@theatre/shared/utils/addresses'
import type {$IntentionalAny} from '@theatre/shared/utils/types'
-/** Either compound or enum properties can be considered "composite" */
+/**
+ * Either compound or enum properties can be considered "composite"
+ * */
export function isPropConfigComposite(
c: PropTypeConfig,
): c is PropTypeConfig_Compound<{}> | PropTypeConfig_Enum {
return c.type === 'compound' || c.type === 'enum'
}
+/**
+ * Returns the prop config at the given path. Traverses composite props until
+ * it reaches the deepest prop config. Returns `undefined` if none is found.
+ *
+ * This is _NOT_ type-safe, so use with caution.
+ */
export function getPropConfigByPath(
parentConf: PropTypeConfig | undefined,
path: PathToProp,
@@ -52,6 +60,10 @@ export function valueInProp