From e26319c4b616bc36d7610743a3a873d8be5d2097 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sat, 29 Nov 2025 05:49:27 +0100 Subject: [PATCH 1/5] feat(ecs): add types for NanoForge Editor --- packages/ecs/src/editor-manifest.type.ts | 94 ++++++++++++++++++++++++ packages/ecs/src/index.ts | 1 + 2 files changed, 95 insertions(+) create mode 100644 packages/ecs/src/editor-manifest.type.ts diff --git a/packages/ecs/src/editor-manifest.type.ts b/packages/ecs/src/editor-manifest.type.ts new file mode 100644 index 00000000..3dc5971e --- /dev/null +++ b/packages/ecs/src/editor-manifest.type.ts @@ -0,0 +1,94 @@ +/** + * * 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; + + /** + * 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 = { + params: ECElement[]; +}; + +/** + * Manifest for a system to be used in the NanoForge Editor + */ +export type EditorSystemManifest = { + dependencies: string[]; +}; diff --git a/packages/ecs/src/index.ts b/packages/ecs/src/index.ts index dc434f7f..8bc56f55 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"; From 889cae209df11891c359ef033304678131345248 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sat, 29 Nov 2025 05:50:13 +0100 Subject: [PATCH 2/5] feat(core): add types for init functions in schematics --- packages/core/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 2931fb74..4273d62e 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"; From 669c18002b1c6aa2b982ee59f22b2420baa70660 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sat, 29 Nov 2025 05:56:51 +0100 Subject: [PATCH 3/5] docs(ecs): add `params` and `dependencies` fields doc --- packages/ecs/src/editor-manifest.type.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/ecs/src/editor-manifest.type.ts b/packages/ecs/src/editor-manifest.type.ts index 3dc5971e..6da5df5d 100644 --- a/packages/ecs/src/editor-manifest.type.ts +++ b/packages/ecs/src/editor-manifest.type.ts @@ -83,6 +83,9 @@ type ECElement = * Manifest for a component to be used in the NanoForge Editor */ export type EditorComponentManifest = { + /** + * Parameters of the component + */ params: ECElement[]; }; @@ -90,5 +93,8 @@ export type EditorComponentManifest = { * Manifest for a system to be used in the NanoForge Editor */ export type EditorSystemManifest = { + /** + * Component names needed by the system + */ dependencies: string[]; }; From 232a291d15583ff6dbb3cb88618672156fa7a5f5 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sat, 29 Nov 2025 06:06:47 +0100 Subject: [PATCH 4/5] feat(ecs): extend ECElement type with `name`, `description`, `example`, and updated `params` def --- packages/ecs/src/editor-manifest.type.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/ecs/src/editor-manifest.type.ts b/packages/ecs/src/editor-manifest.type.ts index 6da5df5d..867bf769 100644 --- a/packages/ecs/src/editor-manifest.type.ts +++ b/packages/ecs/src/editor-manifest.type.ts @@ -10,6 +10,21 @@ type ECElementDefaults = { */ 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 @@ -86,7 +101,7 @@ export type EditorComponentManifest = { /** * Parameters of the component */ - params: ECElement[]; + params: Record; }; /** From e89f2023179542a52b9fa5e8c12acb8003730835 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sat, 29 Nov 2025 06:41:14 +0100 Subject: [PATCH 5/5] feat(ecs): add `name` and `description` fields to Editor manifests --- packages/ecs/src/editor-manifest.type.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/ecs/src/editor-manifest.type.ts b/packages/ecs/src/editor-manifest.type.ts index 867bf769..73cf0e60 100644 --- a/packages/ecs/src/editor-manifest.type.ts +++ b/packages/ecs/src/editor-manifest.type.ts @@ -98,6 +98,16 @@ type ECElement = * 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 */ @@ -108,6 +118,16 @@ export type EditorComponentManifest = { * 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 */