Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export * from "./application/nanoforge-factory";

export type { NanoforgeClient } from "./application/nanoforge-client";
export type { NanoforgeServer } from "./application/nanoforge-server";
135 changes: 135 additions & 0 deletions packages/ecs/src/editor-manifest.type.ts
Original file line number Diff line number Diff line change
@@ -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, Default> = {
/**
* 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<string, ECElement>;
} & 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<string, ECElement>;
};

/**
* 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[];
};
1 change: 1 addition & 0 deletions packages/ecs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Loading