import { EntityPropOverride } from './data/core'; /** * Interface representing the base structure for a type definition. * * This interface is used as a foundation for more specific type definitions, providing common properties like comments and type hints. */ export interface BaseType { comments?: string[]; typeHint?: TypeHint; isObservable?: boolean; } /** * Enumeration of type names used in type definitions. * * This enum lists different kinds of type names that can be used to represent various data types in a type definition. */ export declare enum TypeName { String = "string", Number = "number", Boolean = "boolean", Literal = "literal", Array = "array", Tuple = "tuple", Union = "union", Unknown = "unknown", Enum = "enum", Function = "function", Event = "event", Entity = "entity" } /** * Type definition for a string primitive. * * This interface extends BaseType and is used specifically for defining a string type. */ export interface StringPrimitiveType extends BaseType { name: 'string'; } /** * Type definition for a number primitive. * * This interface extends BaseType and is used specifically for defining a number type. */ export interface NumberPrimitiveType extends BaseType { name: 'number'; } /** * Type definition for a boolean primitive. * * This interface extends BaseType and is used specifically for defining a boolean type. */ export interface BooleanPrimitiveType extends BaseType { name: 'boolean'; } /** * Type definition for a literal type. * * This interface extends BaseType and is used for defining literal types, which represent specific values. */ export interface LiteralType extends BaseType { name: 'literal'; value?: string | number | boolean | null; isUndefined?: boolean; } /** * Type definition for an array type. * * This interface extends BaseType and represents an array type, specifying the type of elements the array contains. */ export interface ArrayType extends BaseType { name: 'array'; child: Type; } /** * Type definition for a tuple type. * * This interface extends BaseType and represents a tuple type, specifying the types of elements and their order in the tuple. */ export interface TupleType extends BaseType { name: 'tuple'; children: Type[]; names?: string[]; } /** * Type definition for a union type. * * This interface extends BaseType and represents a union type, which can be one of several specified types. */ export interface UnionType extends BaseType { name: 'union'; children: Type[]; } /** * Type definition for an unknown type. * * This interface extends BaseType and represents a type that is unspecified or unknown. */ export interface UnknownType extends BaseType { name: 'unknown'; } /** * Type definition for an enum type. * * This interface extends BaseType and is used for defining enumeration types, specifying the possible values an enum can take. */ export interface EnumType extends BaseType { name: 'enum'; values: { [id: string]: string | number; }; valueComments?: { [id: string]: string[]; }; } /** * Type definition for a function type. * * This interface extends BaseType and represents a function type, detailing the function's arguments and return type. */ export interface FunctionType extends BaseType { name: 'function'; args: Prop[]; ret?: Type; } /** * Type definition for an event type. */ export interface EventType extends BaseType { name: 'event'; children: Type[]; names?: string[]; } /** Internal use comment is sufficient for EntityType * @internal * @notes for internal use */ export interface EntityType extends BaseType { name: 'entity'; } /** * Union type representing all possible type definitions. * * This type aggregates all specific type interfaces into a single type that can represent any of them. */ export type Type = StringPrimitiveType | NumberPrimitiveType | BooleanPrimitiveType | ArrayType | TupleType | UnknownType | EnumType | UnionType | LiteralType | FunctionType | EventType | EntityType; /** * Enumeration of type hints used to provide additional information about a type. * * This enum provides specific hints that can be used to give more context about how a type should be interpreted or displayed. */ export declare enum TypeHint { 'proportion' = "proportion", 'color-norm-rgb' = "color-norm-rgb", 'color-norm-rgb-srgb' = "color-norm-rgb-srgb", 'color-norm-rgb-linear' = "color-norm-rgb-linear", 'color-norm-rgba' = "color-norm-rgba", 'color-unnorm-rgb' = "color-unnorm-rgb", 'color-unnorm-rgba' = "color-unnorm-rgba", 'color-hex' = "color-hex", 'color-hexa' = "color-hexa", 'color-css' = "color-css", 'text-multiline' = "text-multiline", 'angle-degrees' = "angle-degrees", 'angle-radians' = "angle-radians", 'time-seconds' = "time-seconds", 'time-milliseconds' = "time-milliseconds", 'time-hertz' = "time-hertz", 'emailaddress' = "emailaddress", 'url' = "url", 'function-emit-component-prop-event' = "function-emit-component-prop-event", 'animationcurve' = "animationcurve" } /** * Enumeration of values types used in a values definition. * * This enum lists different kinds of values types that can be used in a values definition, representing various data sources or formats. */ export declare enum ValuesType { 'files' = "files", 'animations' = "animations", 'morphTargets' = "morphTargets", 'events' = "events", 'parentNodes' = "parentNodes", 'parentMaterials' = "parentMaterials", 'nodelabels' = "nodelabels", 'nodeids' = "nodeids", 'layerclipids' = "layerclipids", 'easings' = "easings", 'layerids' = "layerids", 'streamids' = "streamids", 'behaviorids' = "behaviorids" } /** * Interface representing a values definition. * * This interface defines the structure for a values definition, specifying the type of values and any associated parameters. */ export interface Values { type: ValuesType; param: string; } /** * Interface representing a property definition. * * This interface defines the structure for a property, including its name, type, default value, and other optional settings. */ export interface Prop { name: string; type: Type; comments?: string[]; default?: any; group?: string; groupPriority?: number; groupCollapsed?: boolean; values?: Values[]; order?: number; priority?: number; optional?: boolean; showInUI?: boolean; readonly?: boolean; isConstructorProp?: boolean; deprecated?: boolean; } /** * Interface representing a default child object in a component or behavior definition. * * This interface defines the structure for specifying default children of a component or behavior, including their type and initial properties. */ export interface DefaultChild { label: string; type: string; initialProps: { [id: string]: any; }; } /** * Type representing the category of a component, behavior, or context. * * This type categorizes elements as either a component, behavior, or context. */ export type ComponentInfoType = 'component' | 'behavior' | 'context'; /** * Interface representing information about a component. * * This interface defines the structure for specifying details about a component, including its name, file location, type, properties, and other attributes. */ export interface ComponentInfo { name: string; file: string; type: ComponentInfoType; isDefault?: boolean; constructorProps: { [id: string]: Prop; }; props: { [id: string]: Prop; }; comments?: string[]; icon?: string; group?: string; tags: string[]; allowedChildren: string[]; allowedParents?: string[]; defaultChildren?: DefaultChild[]; streams: StreamInfo[]; streamsObjects: { [id: string]: string; }; deprecated?: boolean; } /** * Interface representing information about a value. * * This interface defines the structure for specifying details about a value, including its name, file location, type, and comments. */ export interface ValueInfo { name: string; file: string; isDefault?: boolean; type: Type; comments?: string[]; } /** * Interface representing information about a previewer. * * This interface defines the structure for specifying details about a previewer, including its name, file location, and file pattern. */ export interface PreviewInfo { name: string; file: string; isDefault?: string; comments?: string[]; filePattern: string; } /** * Interface representing information about a stream. * * This interface defines the structure for specifying details about a stream, including the property path associated with the stream. */ export interface StreamInfo { property: (string | number)[]; } /** * Interface representing information about types defined in a source file. * * This interface defines the structure for organizing information about components, values, and previewers defined in a source file. */ export interface SourceFileTypeInfo { components: { [id: string]: ComponentInfo; }; values: { [id: string]: ValueInfo; }; previewers: { [id: string]: PreviewInfo; }; } /** * Type representing a mapping of file names to their respective type information. * * This type maps file names to SourceFileTypeInfo, providing an organized structure for storing type information associated with different files. */ export type TypeInfoByFileName = { [id: string]: SourceFileTypeInfo; }; /** * Checks if two types are compatible. * * This function compares two Type objects to determine if they are compatible, considering their names and specific type details. * @param a - The first type for comparison. * @param b - The second type for comparison. * @returns True if the types are compatible, otherwise false. */ export declare function areTypesCompatible(a: Type, b: Type): boolean; /** * Merges two sets of values definitions. * * This function combines two arrays of Values objects, merging them into a single array while avoiding duplicates. * @param a - The first array of values definitions. * @param b - The second array of values definitions. * @returns An array of merged values definitions, or undefined if both inputs are undefined. */ export declare function mergeValues(a: Values[] | undefined, b: Values[] | undefined): Values[] | undefined; /** * Merges two property definitions into one. * * This function combines two Prop objects into a single Prop object, merging their attributes where possible. * @param a - The first property definition. * @param b - The second property definition. * @returns A merged property definition, or undefined if they cannot be merged. */ export declare function mergeProps(a: Prop, b: Prop): Prop | undefined; /** * Merges two types into one, if they are compatible. * * @param a - The first type to merge. * @param b - The second type to merge. * @returns A merged type, or undefined if the types are not compatible. */ export declare function mergeTypes(a: Type, b: Type): Type | undefined; /** * Represents information about a template, including its name, content, and optional file extension. * * @interface * @property name - The name of the template. * @property content - The content of the template. * @property extn - Optional. The file extension associated with the template. */ export interface TemplateInfo { name: string; content: string; extn?: string; } /** * Describes a file generator with its name, URL, and an optional icon. * * @interface * @property name - The name of the file generator. * @property url - The URL where the file generator is located or can be accessed. * @property icon - Optional. A URL or a path to an icon representing the file generator. */ export interface FileGenerator { name: string; url: string; icon?: string; } /** * Converts a filename to a symbol path by removing certain file extension patterns. * * @param f - The filename to convert. * @returns A symbol path derived from the given filename. */ export declare function symbolPathFromFilename(f: string): string; /** * Checks if a given value is valid for a specified type. * * @param def - The value to validate. * @param t - The type against which the value is to be validated. * @param allowUndefined - A boolean indicating whether undefined values are allowed. * @returns A boolean indicating whether the value is valid for the given type. */ export declare function isValidValueForType(def: any, t: Type, allowUndefined?: boolean): boolean; /** * Generates a TypeScript output string for a given type. * * @param t - The type to generate output for. * @param alwaysBasic - A boolean indicating whether to always use the basic type representation. * @returns A string representing the type in TypeScript syntax. */ export declare function outputForType(t: Type, alwaysBasic?: boolean): string; /** * Checks if overrides in two objects are compatible with each other. * * @param a - The first object containing entity prop overrides. * @param b - The second object containing entity prop overrides. * @returns A boolean indicating whether the overrides in both objects are compatible. */ export declare function overridesAreCompatible(a: { [path: string]: EntityPropOverride; }, b: { [path: string]: EntityPropOverride; }): boolean; /** * Generates a default value for a given type. * * @param t - The type for which to generate a default value. * @returns A default value appropriate for the given type. */ export declare function defaultValueForType(t: Type): any;