Rename NonCompound to Simple

https://github.com/theatre-js/theatre/pull/118#discussion_r846633461
This commit is contained in:
Aria Minaei 2022-04-10 20:51:45 +02:00
parent a5cf72cd57
commit c1cd25b906
6 changed files with 16 additions and 16 deletions

View file

@ -701,7 +701,7 @@ type DeepPartialCompound<Props extends IValidCompoundProps> = {
} }
type DeepPartial<Conf extends PropTypeConfig> = type DeepPartial<Conf extends PropTypeConfig> =
Conf extends PropTypeConfig_AllNonCompounds Conf extends PropTypeConfig_AllSimples
? Conf['valueType'] ? Conf['valueType']
: Conf extends PropTypeConfig_Compound<infer T> : Conf extends PropTypeConfig_Compound<infer T>
? DeepPartialCompound<T> ? DeepPartialCompound<T>
@ -721,7 +721,7 @@ export interface PropTypeConfig_Enum extends IBasePropType<'enum', {}> {
defaultCase: string defaultCase: string
} }
export type PropTypeConfig_AllNonCompounds = export type PropTypeConfig_AllSimples =
| PropTypeConfig_Number | PropTypeConfig_Number
| PropTypeConfig_Boolean | PropTypeConfig_Boolean
| PropTypeConfig_String | PropTypeConfig_String
@ -729,6 +729,6 @@ export type PropTypeConfig_AllNonCompounds =
| PropTypeConfig_Rgba | PropTypeConfig_Rgba
export type PropTypeConfig = export type PropTypeConfig =
| PropTypeConfig_AllNonCompounds | PropTypeConfig_AllSimples
| PropTypeConfig_Compound<$IntentionalAny> | PropTypeConfig_Compound<$IntentionalAny>
| PropTypeConfig_Enum | PropTypeConfig_Enum

View file

@ -1,7 +1,7 @@
import type { import type {
IBasePropType, IBasePropType,
PropTypeConfig, PropTypeConfig,
PropTypeConfig_AllNonCompounds, PropTypeConfig_AllSimples,
PropTypeConfig_Compound, PropTypeConfig_Compound,
PropTypeConfig_Enum, PropTypeConfig_Enum,
} from '@theatre/core/propTypes' } from '@theatre/core/propTypes'
@ -37,7 +37,7 @@ export function getPropConfigByPath(
* @returns value if it matches the prop's type * @returns value if it matches the prop's type
* otherwise returns the default value for the prop * otherwise returns the default value for the prop
*/ */
export function valueInProp<PropConfig extends PropTypeConfig_AllNonCompounds>( export function valueInProp<PropConfig extends PropTypeConfig_AllSimples>(
value: unknown, value: unknown,
propConfig: PropConfig, propConfig: PropConfig,
): PropConfig extends IBasePropType<$IntentionalAny, $IntentionalAny, infer T> ): PropConfig extends IBasePropType<$IntentionalAny, $IntentionalAny, infer T>

View file

@ -9,7 +9,7 @@ import type {SequenceTrackId} from '@theatre/shared/utils/ids'
import {getPointerParts} from '@theatre/dataverse' import {getPointerParts} from '@theatre/dataverse'
import type { import type {
PropTypeConfig, PropTypeConfig,
PropTypeConfig_AllNonCompounds, PropTypeConfig_AllSimples,
PropTypeConfig_Compound, PropTypeConfig_Compound,
} from '@theatre/core/propTypes' } from '@theatre/core/propTypes'
import type {PathToProp} from '@theatre/shared/src/utils/addresses' import type {PathToProp} from '@theatre/shared/src/utils/addresses'
@ -54,7 +54,7 @@ function forEachDeepSimplePropOfCompoundProp(
propType: PropTypeConfig_Compound<$IntentionalAny>, propType: PropTypeConfig_Compound<$IntentionalAny>,
path: Array<string | number>, path: Array<string | number>,
callback: ( callback: (
propType: PropTypeConfig_AllNonCompounds, propType: PropTypeConfig_AllSimples,
path: Array<string | number>, path: Array<string | number>,
) => void, ) => void,
) { ) {
@ -105,7 +105,7 @@ export default function createTransactionPrivateApi(
const setStaticOrKeyframeProp = <T>( const setStaticOrKeyframeProp = <T>(
value: T, value: T,
propConfig: PropTypeConfig_AllNonCompounds, propConfig: PropTypeConfig_AllSimples,
path: PathToProp, path: PathToProp,
) => { ) => {
if (value === undefined || value === null) { if (value === undefined || value === null) {

View file

@ -16,7 +16,7 @@ import {
isPropConfigComposite, isPropConfigComposite,
valueInProp, valueInProp,
} from '@theatre/shared/propTypes/utils' } from '@theatre/shared/propTypes/utils'
import type {PropTypeConfig_AllNonCompounds} from '@theatre/core/propTypes' import type {PropTypeConfig_AllSimples} from '@theatre/core/propTypes'
export type ExtremumSpace = { export type ExtremumSpace = {
fromValueSpace: (v: number) => number fromValueSpace: (v: number) => number
@ -37,7 +37,7 @@ const BasicKeyframedTrack: React.FC<{
const propConfig = getPropConfigByPath( const propConfig = getPropConfigByPath(
sheetObject.template.config, sheetObject.template.config,
pathToProp, pathToProp,
)! as PropTypeConfig_AllNonCompounds )! as PropTypeConfig_AllSimples
if (isPropConfigComposite(propConfig)) { if (isPropConfigComposite(propConfig)) {
console.error(`Composite prop types cannot be keyframed`) console.error(`Composite prop types cannot be keyframed`)
@ -127,7 +127,7 @@ type Extremums = [min: number, max: number]
function calculateScalarExtremums( function calculateScalarExtremums(
keyframes: Keyframe[], keyframes: Keyframe[],
propConfig: PropTypeConfig_AllNonCompounds, propConfig: PropTypeConfig_AllSimples,
): Extremums { ): Extremums {
let min = Infinity, let min = Infinity,
max = -Infinity max = -Infinity

View file

@ -15,7 +15,7 @@ import CurveHandle from './CurveHandle'
import GraphEditorDotScalar from './GraphEditorDotScalar' import GraphEditorDotScalar from './GraphEditorDotScalar'
import GraphEditorDotNonScalar from './GraphEditorDotNonScalar' import GraphEditorDotNonScalar from './GraphEditorDotNonScalar'
import GraphEditorNonScalarDash from './GraphEditorNonScalarDash' import GraphEditorNonScalarDash from './GraphEditorNonScalarDash'
import type {PropTypeConfig_AllNonCompounds} from '@theatre/core/propTypes' import type {PropTypeConfig_AllSimples} from '@theatre/core/propTypes'
const Container = styled.g` const Container = styled.g`
/* position: absolute; */ /* position: absolute; */
@ -33,7 +33,7 @@ const KeyframeEditor: React.FC<{
extremumSpace: ExtremumSpace extremumSpace: ExtremumSpace
isScalar: boolean isScalar: boolean
color: keyof typeof graphEditorColors color: keyof typeof graphEditorColors
propConfig: PropTypeConfig_AllNonCompounds propConfig: PropTypeConfig_AllSimples
}> = (props) => { }> = (props) => {
const {index, trackData, isScalar} = props const {index, trackData, isScalar} = props
const cur = trackData.keyframes[index] const cur = trackData.keyframes[index]

View file

@ -1,7 +1,7 @@
import type {} from '@theatre/core/projects/store/types/SheetState_Historic' import type {} from '@theatre/core/projects/store/types/SheetState_Historic'
import type { import type {
PropTypeConfig, PropTypeConfig,
PropTypeConfig_AllNonCompounds, PropTypeConfig_AllSimples,
PropTypeConfig_Compound, PropTypeConfig_Compound,
} from '@theatre/core/propTypes' } from '@theatre/core/propTypes'
import type SheetObject from '@theatre/core/sheetObjects/SheetObject' import type SheetObject from '@theatre/core/sheetObjects/SheetObject'
@ -53,7 +53,7 @@ export type SequenceEditorTree_PrimitiveProp =
sheetObject: SheetObject sheetObject: SheetObject
pathToProp: PathToProp pathToProp: PathToProp
trackId: SequenceTrackId trackId: SequenceTrackId
propConf: PropTypeConfig_AllNonCompounds propConf: PropTypeConfig_AllSimples
} }
export type SequenceEditorTree_AllRowTypes = export type SequenceEditorTree_AllRowTypes =
@ -231,7 +231,7 @@ export const calculateSequenceEditorTree = (
sheetObject: SheetObject, sheetObject: SheetObject,
trackId: SequenceTrackId, trackId: SequenceTrackId,
pathToProp: PathToProp, pathToProp: PathToProp,
propConf: PropTypeConfig_AllNonCompounds, propConf: PropTypeConfig_AllSimples,
arrayOfChildren: Array< arrayOfChildren: Array<
SequenceEditorTree_PrimitiveProp | SequenceEditorTree_PropWithChildren SequenceEditorTree_PrimitiveProp | SequenceEditorTree_PropWithChildren
>, >,