diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 2931fb7..4273d62 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1 +1,4 @@ export * from "./application/nanoforge-factory"; + +export type { NanoforgeClient } from "./application/nanoforge-client"; +export type { NanoforgeServer } from "./application/nanoforge-server"; diff --git a/packages/ecs/src/editor-manifest.type.ts b/packages/ecs/src/editor-manifest.type.ts new file mode 100644 index 0000000..73cf0e6 --- /dev/null +++ b/packages/ecs/src/editor-manifest.type.ts @@ -0,0 +1,135 @@ +/** + * * Editor Component Element Defaults + * Basic fields for Editor Component Element + * @param Type - Type of the element + * @param Default - Type of the element's default value + */ +type ECElementDefaults = { + /** + * Type of the element + */ + type: Type; + + /** + * Name of the element + */ + name: string; + + /** + * Description of the element + */ + description?: string; + + /** + * Example of the element + */ + example?: Default; + + /** + * Is the element optional + * @default false + */ + optional?: boolean; + + /** + * Default value of the element + * Force optional to true if set + */ + default?: Default; +}; + +/** + * * Editor Component String Element + * Type for string element + */ +type ECStringElement = { + /** + * Values allowed for the element + */ + enum?: string[]; +} & ECElementDefaults<"string", string>; + +/** + * * Editor Component Number Element + * Type for number element + */ +type ECNumberElement = ECElementDefaults<"number", number>; + +/** + * * Editor Component Boolean Element + * Type for boolean element + */ +type ECBooleanElement = ECElementDefaults<"boolean", boolean>; + +/** + * * Editor Component Array Element + * Type for array element + */ +type ECArrayElement = { + /** + * Items of the array + */ + items: ECElement; +} & ECElementDefaults<"array", any[]>; + +/** + * * Editor Component Object Element + * Type for object element + */ +type ECObjectElement = { + /** + * Properties of the object + */ + properties: Record; +} & ECElementDefaults<"object", object>; + +/** + * * Editor Component Element + * Type for component element + */ +type ECElement = + | ECStringElement + | ECNumberElement + | ECBooleanElement + | ECArrayElement + | ECObjectElement; + +/** + * Manifest for a component to be used in the NanoForge Editor + */ +export type EditorComponentManifest = { + /** + * Displayed name of the component + */ + name: string; + + /** + * Description of the component + */ + description?: string; + + /** + * Parameters of the component + */ + params: Record; +}; + +/** + * Manifest for a system to be used in the NanoForge Editor + */ +export type EditorSystemManifest = { + /** + * Displayed name of the system + */ + name: string; + + /** + * Description of the system + */ + description?: string; + + /** + * Component names needed by the system + */ + dependencies: string[]; +}; diff --git a/packages/ecs/src/index.ts b/packages/ecs/src/index.ts index dc434f7..8bc56f5 100644 --- a/packages/ecs/src/index.ts +++ b/packages/ecs/src/index.ts @@ -2,3 +2,4 @@ import "../lib/libecs.wasm"; export { ECSLibrary } from "./ecs-library"; export type { Component, System, Registry } from "../lib"; +export type * from "./editor-manifest.type";