diff --git a/theatre/core/src/propTypes/index.ts b/theatre/core/src/propTypes/index.ts index c7b4389..3f07be4 100644 --- a/theatre/core/src/propTypes/index.ts +++ b/theatre/core/src/propTypes/index.ts @@ -701,7 +701,7 @@ type DeepPartialCompound = { } type DeepPartial = - Conf extends PropTypeConfig_AllNonCompounds + Conf extends PropTypeConfig_AllSimples ? Conf['valueType'] : Conf extends PropTypeConfig_Compound ? DeepPartialCompound @@ -721,7 +721,7 @@ export interface PropTypeConfig_Enum extends IBasePropType<'enum', {}> { defaultCase: string } -export type PropTypeConfig_AllNonCompounds = +export type PropTypeConfig_AllSimples = | PropTypeConfig_Number | PropTypeConfig_Boolean | PropTypeConfig_String @@ -729,6 +729,6 @@ export type PropTypeConfig_AllNonCompounds = | PropTypeConfig_Rgba export type PropTypeConfig = - | PropTypeConfig_AllNonCompounds + | PropTypeConfig_AllSimples | PropTypeConfig_Compound<$IntentionalAny> | PropTypeConfig_Enum diff --git a/theatre/shared/src/propTypes/utils.ts b/theatre/shared/src/propTypes/utils.ts index 09e3382..7ccf8e4 100644 --- a/theatre/shared/src/propTypes/utils.ts +++ b/theatre/shared/src/propTypes/utils.ts @@ -1,7 +1,7 @@ import type { IBasePropType, PropTypeConfig, - PropTypeConfig_AllNonCompounds, + PropTypeConfig_AllSimples, PropTypeConfig_Compound, PropTypeConfig_Enum, } from '@theatre/core/propTypes' @@ -37,7 +37,7 @@ export function getPropConfigByPath( * @returns value if it matches the prop's type * otherwise returns the default value for the prop */ -export function valueInProp( +export function valueInProp( value: unknown, propConfig: PropConfig, ): PropConfig extends IBasePropType<$IntentionalAny, $IntentionalAny, infer T> diff --git a/theatre/studio/src/StudioStore/createTransactionPrivateApi.ts b/theatre/studio/src/StudioStore/createTransactionPrivateApi.ts index 6df778a..00816b8 100644 --- a/theatre/studio/src/StudioStore/createTransactionPrivateApi.ts +++ b/theatre/studio/src/StudioStore/createTransactionPrivateApi.ts @@ -9,7 +9,7 @@ import type {SequenceTrackId} from '@theatre/shared/utils/ids' import {getPointerParts} from '@theatre/dataverse' import type { PropTypeConfig, - PropTypeConfig_AllNonCompounds, + PropTypeConfig_AllSimples, PropTypeConfig_Compound, } from '@theatre/core/propTypes' import type {PathToProp} from '@theatre/shared/src/utils/addresses' @@ -54,7 +54,7 @@ function forEachDeepSimplePropOfCompoundProp( propType: PropTypeConfig_Compound<$IntentionalAny>, path: Array, callback: ( - propType: PropTypeConfig_AllNonCompounds, + propType: PropTypeConfig_AllSimples, path: Array, ) => void, ) { @@ -105,7 +105,7 @@ export default function createTransactionPrivateApi( const setStaticOrKeyframeProp = ( value: T, - propConfig: PropTypeConfig_AllNonCompounds, + propConfig: PropTypeConfig_AllSimples, path: PathToProp, ) => { if (value === undefined || value === null) { diff --git a/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx b/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx index 601e2a6..73c9aa3 100644 --- a/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx +++ b/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx @@ -16,7 +16,7 @@ import { isPropConfigComposite, valueInProp, } from '@theatre/shared/propTypes/utils' -import type {PropTypeConfig_AllNonCompounds} from '@theatre/core/propTypes' +import type {PropTypeConfig_AllSimples} from '@theatre/core/propTypes' export type ExtremumSpace = { fromValueSpace: (v: number) => number @@ -37,7 +37,7 @@ const BasicKeyframedTrack: React.FC<{ const propConfig = getPropConfigByPath( sheetObject.template.config, pathToProp, - )! as PropTypeConfig_AllNonCompounds + )! as PropTypeConfig_AllSimples if (isPropConfigComposite(propConfig)) { console.error(`Composite prop types cannot be keyframed`) @@ -127,7 +127,7 @@ type Extremums = [min: number, max: number] function calculateScalarExtremums( keyframes: Keyframe[], - propConfig: PropTypeConfig_AllNonCompounds, + propConfig: PropTypeConfig_AllSimples, ): Extremums { let min = Infinity, max = -Infinity diff --git a/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.tsx b/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.tsx index 1b3be1b..0374d98 100644 --- a/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.tsx +++ b/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.tsx @@ -15,7 +15,7 @@ import CurveHandle from './CurveHandle' import GraphEditorDotScalar from './GraphEditorDotScalar' import GraphEditorDotNonScalar from './GraphEditorDotNonScalar' import GraphEditorNonScalarDash from './GraphEditorNonScalarDash' -import type {PropTypeConfig_AllNonCompounds} from '@theatre/core/propTypes' +import type {PropTypeConfig_AllSimples} from '@theatre/core/propTypes' const Container = styled.g` /* position: absolute; */ @@ -33,7 +33,7 @@ const KeyframeEditor: React.FC<{ extremumSpace: ExtremumSpace isScalar: boolean color: keyof typeof graphEditorColors - propConfig: PropTypeConfig_AllNonCompounds + propConfig: PropTypeConfig_AllSimples }> = (props) => { const {index, trackData, isScalar} = props const cur = trackData.keyframes[index] diff --git a/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts b/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts index 92a3918..b1fc298 100644 --- a/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts +++ b/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts @@ -1,7 +1,7 @@ import type {} from '@theatre/core/projects/store/types/SheetState_Historic' import type { PropTypeConfig, - PropTypeConfig_AllNonCompounds, + PropTypeConfig_AllSimples, PropTypeConfig_Compound, } from '@theatre/core/propTypes' import type SheetObject from '@theatre/core/sheetObjects/SheetObject' @@ -53,7 +53,7 @@ export type SequenceEditorTree_PrimitiveProp = sheetObject: SheetObject pathToProp: PathToProp trackId: SequenceTrackId - propConf: PropTypeConfig_AllNonCompounds + propConf: PropTypeConfig_AllSimples } export type SequenceEditorTree_AllRowTypes = @@ -231,7 +231,7 @@ export const calculateSequenceEditorTree = ( sheetObject: SheetObject, trackId: SequenceTrackId, pathToProp: PathToProp, - propConf: PropTypeConfig_AllNonCompounds, + propConf: PropTypeConfig_AllSimples, arrayOfChildren: Array< SequenceEditorTree_PrimitiveProp | SequenceEditorTree_PropWithChildren >,