@playcanvas/react
Version:
A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.
30 lines • 1.2 kB
JavaScript
/**
* Component schema registry for serialization
* Provides access to component schemas to know which properties to serialize
*/
import { lightComponentDefinition } from "../../components/Light.js";
import { renderComponentDefinition } from "../../components/Render.js";
import { cameraComponentDefinition } from "../../components/Camera.js";
/**
* Registry mapping component type names to their schema definitions
*/
export const componentSchemaRegistry = {
light: lightComponentDefinition,
render: renderComponentDefinition,
camera: cameraComponentDefinition,
// Add more as they're exported from component files
};
/**
* Get the list of serializable property names for a component type
* Uses the actual component schema as source of truth
*/
export function getSerializablePropertyNames(componentType) {
const definition = componentSchemaRegistry[componentType];
if (!definition || !definition.schema) {
// No schema found - return null to signal we should serialize all properties
return null;
}
// Return all property keys defined in the schema
return Object.keys(definition.schema);
}
//# sourceMappingURL=schema-registry.js.map