phet-io-types¶
Overview¶
General TypeScript types that apply to PhET-iO features and architecture.
@author Michael Kauzmann (PhET Interactive Simulations) @author Sam Reid (PhET Interactive Simulations)
Type AbstractPhetioAPI¶
Abstraction for flattened or treelike PhetioAPI
- version: PhetioAPIVersion
- phetioFullAPI?: boolean
- sim: string
- phetioTypes: PhetioTypes
Type CompositeStateSchemaAPI¶
Record<string, IOTypeName>
Type FlattenedAPIPhetioElements¶
The PhET-iO API as it is easiest to use in code. This takes PhetioAPI type (nested elements) and "expands" (flattens) each out so that the keys are phetioIDs.
Record<PhetioID, PhetioElement>
Type FullPhetioState¶
Record<PhetioID, PhetioElementState | "DELETED">
Type IOTypeName¶
string
Type Method¶
- returnType: string
- parameterTypes: string[]
- documentation: string
- invocableForReadOnlyElements?: boolean
Type Methods¶
Record<string, Method>
Type PhetioAPI¶
The PhET-iO API json structure as it appears in the api files. This nests PhET-iO Elements like the Studio tree, in part to save space in the file.
AbstractPhetioAPI & { phetioElements: PhetioElements }
Type PhetioAPIVersion¶
- major: number
- minor: number
Type PhetioElement¶
- _metadata: PhetioElementMetadata
- _data?: PhetioElementData
Type PhetioElementData¶
- initialState: PhetioElementState
Type PhetioElementMetadata¶
- phetioState: boolean
Used in PhetioObjectOptions - phetioReadOnly: boolean
- phetioEventType: string
- phetioDocumentation: string
- phetioHighFrequency: boolean
- phetioPlayback: boolean
- phetioFeatured?: boolean
- phetioDynamicElement: boolean
- phetioDesigned: boolean
- phetioTypeName: IOTypeName
Specific to Metadata - phetioIsArchetype: boolean
- phetioArchetypePhetioID?: string | null
- phetioDynamicElementName?: string | null
For PhetioDynamicElementContainer.
Type PhetioElementMetadataValue¶
PhetioElementMetadata[keyof PhetioElementMetadata]
Type PhetioElements¶
In tree structure
Type PhetioElementState¶
The "top level" state associated with a phetioID in state. This is NOT and never should be a "substate" or nested. value within a top-level state.
Record<string, IntentionalAny>
Type PhetioID¶
string
Type PhetioOverrides¶
Record<string, Partial<PhetioElementMetadata>>
Type PhetioState¶
Record<PhetioID, PhetioElementState>
Type PhetioType¶
The API schema, for the actual class on the sim side see IOType.ts
- methods: Methods
- supertype?: string
- typeName: IOTypeName
- documentation?: string
- events: string[]
- metadataDefaults?: Partial<PhetioElementMetadata>
- dataDefaults?: Record<string, unknown>
- methodOrder?: string[]
- stateSchema?: StateSchemaAPI
- apiStateKeys?: ( keyof CompositeStateSchemaAPI )[]
- parameterTypes?: string[]
Type PhetioTypes¶
Record<IOTypeName, PhetioType>
Type StateSchemaAPI¶
string | CompositeStateSchemaAPI
Source Code¶
See the source for phet-io-types.ts in the tandem repository.