@xpell/core 2.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/LICENSE +21 -0
  3. package/README.md +96 -0
  4. package/dist/XCommand.d.ts +84 -0
  5. package/dist/XConst.d.ts +28 -0
  6. package/dist/XData.d.ts +51 -0
  7. package/dist/XError.d.ts +34 -0
  8. package/dist/XEventManager.d.ts +57 -0
  9. package/dist/XLogger.d.ts +32 -0
  10. package/dist/XModule.d.ts +161 -0
  11. package/dist/XNanoCommands.d.ts +42 -0
  12. package/dist/XObject.d.ts +287 -0
  13. package/dist/XObjectManager.d.ts +96 -0
  14. package/dist/XParams.d.ts +60 -0
  15. package/dist/XParser.d.ts +77 -0
  16. package/dist/XProtocol.d.ts +56 -0
  17. package/dist/XUtils.d.ts +100 -0
  18. package/dist/Xpell.d.ts +142 -0
  19. package/dist/index.d.ts +9 -0
  20. package/dist/xpell-core.cjs.js +3 -0
  21. package/dist/xpell-core.es.js +1428 -0
  22. package/docs/Codex.md +138 -0
  23. package/docs/XData 2.md +209 -0
  24. package/docs/api/.nojekyll +1 -0
  25. package/docs/api/assets/hierarchy.js +1 -0
  26. package/docs/api/assets/highlight.css +71 -0
  27. package/docs/api/assets/icons.js +18 -0
  28. package/docs/api/assets/icons.svg +1 -0
  29. package/docs/api/assets/main.js +60 -0
  30. package/docs/api/assets/navigation.js +1 -0
  31. package/docs/api/assets/search.js +1 -0
  32. package/docs/api/assets/style.css +1611 -0
  33. package/docs/api/classes/XCommand.html +23 -0
  34. package/docs/api/classes/XModule.html +57 -0
  35. package/docs/api/classes/XObject.html +133 -0
  36. package/docs/api/classes/XObjectManager.html +36 -0
  37. package/docs/api/classes/XObjectPack.html +6 -0
  38. package/docs/api/classes/XParams.html +8 -0
  39. package/docs/api/classes/XParser.html +21 -0
  40. package/docs/api/classes/XUtils.html +29 -0
  41. package/docs/api/classes/XpellEngine.html +36 -0
  42. package/docs/api/classes/_XData.html +23 -0
  43. package/docs/api/classes/_XEventManager.html +37 -0
  44. package/docs/api/classes/_XLogger.html +17 -0
  45. package/docs/api/hierarchy.html +1 -0
  46. package/docs/api/index.html +3 -0
  47. package/docs/api/interfaces/IXData.html +1 -0
  48. package/docs/api/interfaces/IXObjectData.html +17 -0
  49. package/docs/api/interfaces/XDataXporterHandler.html +1 -0
  50. package/docs/api/interfaces/XEventListener.html +6 -0
  51. package/docs/api/interfaces/XNanoCommand.html +2 -0
  52. package/docs/api/interfaces/XObjectOnEventIndex.html +1 -0
  53. package/docs/api/types/HTMLEventListenersIndex.html +1 -0
  54. package/docs/api/types/XCommandData.html +1 -0
  55. package/docs/api/types/XDataObject.html +1 -0
  56. package/docs/api/types/XDataVariable.html +1 -0
  57. package/docs/api/types/XDataXporter.html +1 -0
  58. package/docs/api/types/XEvent.html +1 -0
  59. package/docs/api/types/XEventListenerOptions.html +1 -0
  60. package/docs/api/types/XModuleData.html +1 -0
  61. package/docs/api/types/XNanoCommandPack.html +2 -0
  62. package/docs/api/types/XObjectData.html +1 -0
  63. package/docs/api/types/XObjectOnEventHandler.html +1 -0
  64. package/docs/api/variables/XData.html +1 -0
  65. package/docs/api/variables/XEventManager.html +1 -0
  66. package/docs/api/variables/XLogger.html +1 -0
  67. package/docs/api/variables/Xpell.html +3 -0
  68. package/docs/architecture/overview.md +190 -0
  69. package/package.json +66 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,83 @@
1
+ # Changelog
2
+
3
+ All notable changes to **xpell-core** are documented in this file.
4
+
5
+ This project follows **Semantic Versioning** with pre-release tags (`alpha`, `beta`).
6
+ Until `2.0.0` stable, breaking changes may occur between alpha versions.
7
+
8
+ ---
9
+
10
+ ## [2.0.0-alpha.1] — 2025-XX-XX
11
+
12
+ ### Summary
13
+ First public alpha of the **Xpell Core 2.x runtime**.
14
+
15
+ This release establishes the new internal architecture that powers XVM, XUI 2.x,
16
+ and future Xpell II modules. It introduces an event-driven runtime state model
17
+ (**XData2**) that replaces per-frame polling with explicit, observable state updates.
18
+
19
+ This version is intended for **early adopters, internal framework packages,
20
+ and contributors**.
21
+
22
+ ---
23
+
24
+ ### 🚀 Added
25
+ - **XData2**: observable runtime shared-state system.
26
+ - Explicit APIs: `set`, `get`, `delete`, `touch`, `patch`
27
+ - Key-based subscriptions (`on`, `onAny`)
28
+ - Backward-compatible legacy access via `XData._o` (deprecated)
29
+ - **Binding foundation** in `XObject` enabling event-driven data flow (no polling).
30
+ - `XParams`: unified parameter handling for CLI commands, JSON payloads, and runtime calls.
31
+ - `docs/XData2.md`: specification for the new runtime shared-state model.
32
+ - `ARCHITECTURE.md` documenting the core Xpell 2.x runtime design.
33
+ - `CHANGELOG.md` to formalize version history and release notes.
34
+
35
+ ---
36
+
37
+ ### 🔄 Changed
38
+ - Refactored **XData** into an observable, event-driven runtime state system.
39
+ - Deprecated frame-based polling patterns in favor of explicit subscriptions.
40
+ - Clearer separation of responsibilities:
41
+ - **XData** → runtime shared state
42
+ - **XObject** → behavior and binding
43
+ - **XUIObject** → visual/runtime UI representation
44
+ - Refactored `XModule` and `XObjectManager` for improved clarity and stronger TypeScript safety.
45
+ - Internal cleanup and alignment to support the Xpell 2.x runtime model.
46
+
47
+ ---
48
+
49
+ ### 🛠 Tooling
50
+ - Updated build scripts for the 2.x architecture.
51
+ - Added `publish-alpha` workflow for prerelease publishing.
52
+
53
+ ---
54
+
55
+ ### ⚠️ Notes
56
+ - This is an **alpha release**.
57
+ - APIs may change before `2.0.0` stable.
58
+ - Direct writes to `XData._o[...]` are deprecated but supported during migration.
59
+ - Deep mutations require explicit `touch(key)` to emit updates.
60
+ - Polling-based data access will be removed in a future major release.
61
+
62
+ ---
63
+
64
+ ## [1.0.0]
65
+
66
+ ### ⚠️ Breaking
67
+ - Removed legacy internal core folder usage.
68
+ - Unified runtime exports for use across Xpell modules.
69
+
70
+ ### 🛠 Improvements
71
+ - Internal cleanup and improved type safety.
72
+ - Event system stabilization.
73
+
74
+ ---
75
+
76
+ ## Pre-2.0 Releases
77
+
78
+ Earlier versions focused on:
79
+ - Initial runtime loop
80
+ - Core object model
81
+ - Experimental command execution
82
+
83
+ These versions are considered **legacy** relative to Xpell 2.x.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aime Technologies Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # Xpell Core
2
+
3
+ **Xpell Core** is the foundational runtime of the Xpell framework.
4
+ It provides the core engine, real-time update loop, event system, data layer, and utilities used by XUI (UI engine), X3D (3D engine), and higher-level Xpell modules.
5
+
6
+ Xpell Core is designed for **high-performance, real-time JavaScript/TypeScript applications**, including:
7
+
8
+ - real-time UI
9
+ - AI-driven interfaces
10
+ - dashboards
11
+ - data-driven visualizations
12
+ - WebGL/3D experiences
13
+ - vibe-coded apps (LLM-assisted development)
14
+
15
+ If you are building with Xpell, this package provides the low-level primitives the rest of the framework depends on.
16
+
17
+ ## Features
18
+
19
+ - Real-time engine update loop
20
+ - Event and signal system
21
+ - Core data structures
22
+ - Object lifecycle management
23
+ - Shared utilities for UI, 3D, and AI modules
24
+ - Zero-dependency, lightweight foundation
25
+ - Written in TypeScript
26
+
27
+ ## Installation
28
+
29
+ npm install xpell-core
30
+ pnpm add xpell-core
31
+ yarn add xpell-core
32
+
33
+ ## Usage
34
+
35
+ xpell-core provides low-level building blocks for the Xpell framework. Below is a simple example showing how to use Xpell Core's event system and update loop.
36
+
37
+ ## When to use Xpell Core
38
+
39
+ Use xpell-core directly if you are:
40
+
41
+ - Building low-level extensions for Xpell
42
+ - Creating custom UI components
43
+ - Developing new rendering pipelines
44
+ - Writing real-time, loop-driven modules
45
+ - Integrating AI-powered reactive systems
46
+ - Working inside internal Xpell packages
47
+
48
+ Most end-users should install:
49
+
50
+ npm install xpell
51
+
52
+ which includes xpell-core automatically.
53
+
54
+ ## Who Should Use xpell-core Directly?
55
+
56
+ Most developers should **not** depend on xpell-core directly.
57
+
58
+ Use xpell-core only if you are:
59
+ - Developing Xpell framework modules
60
+ - Building custom runtime systems
61
+ - Extending XModule or XObject internals
62
+ - Working on Xpell UI / 3D / server internals
63
+
64
+ For application development, use:
65
+ - xpell-ui
66
+ - xpell
67
+
68
+
69
+ ## Relationship to the Xpell Framework
70
+
71
+ Xpell Core powers all other Xpell packages:
72
+
73
+ - xpell-ui
74
+ - xpell-3d
75
+ - xpell
76
+ - future Xpell II modules
77
+
78
+ ## Documentation
79
+
80
+ For a detailed overview of the Xpell architecture, see
81
+ [`docs/architecture/overview.md`](docs/architecture/overview.md).
82
+
83
+ ## Links
84
+
85
+ https://xpell.ai
86
+
87
+ GitHub:
88
+ https://github.com/xpell-ai/xpell-core
89
+
90
+ ## Versioning
91
+
92
+ xpell-core follows **semantic versioning**, aligned with the main Xpell release stream.
93
+
94
+ ## License
95
+
96
+ MIT License — © Aime Technologies, 2022–Present
@@ -0,0 +1,84 @@
1
+ /**
2
+ * XCommand — Runtime Command Representation
3
+ *
4
+ * Canonical command structure used by the Xpell runtime.
5
+ *
6
+ * `XCommand` represents a parsed, normalized command produced by the
7
+ * Xpell parser and consumed by modules (`XModule`) and runtime objects
8
+ * (`XObject`) for execution.
9
+ *
10
+ * ---
11
+ *
12
+ * ## Responsibilities
13
+ *
14
+ * - Represent an executable command (`_op`, `_params`, metadata)
15
+ * - Serve as the output of the Xpell parser
16
+ * - Provide a uniform execution contract across runtime layers
17
+ *
18
+ * ---
19
+ *
20
+ * ## Execution Flow
21
+ *
22
+ * - Text / JSON / CLI-style input → Xpell Parser
23
+ * - Parser output → `XCommand`
24
+ * - Execution target → `XModule` or `XObject`
25
+ *
26
+ * ---
27
+ *
28
+ * XCommand is a transportable, serializable instruction
29
+ * independent of execution context.
30
+ *
31
+ * One-liner: XCommand is intent made executable.
32
+ *
33
+ * @packageDocumentation
34
+ * @since 2022-07-22
35
+ * @author Tamir Fridman
36
+ * @license MIT
37
+ * @copyright
38
+ * © 2022–present Aime Technologies. All rights reserved.
39
+ */
40
+ export type XCommandData = {
41
+ _module: string;
42
+ _object?: string;
43
+ _op: string;
44
+ _params?: {
45
+ [k: string]: string | number | Function;
46
+ };
47
+ };
48
+ export declare class XCommand {
49
+ /**
50
+ * The XModule to handle to command
51
+ */
52
+ _module: string;
53
+ /**
54
+ * The XObject that should handle the command (optional - uses only to send XCommand to specific object)
55
+ */
56
+ _object?: string;
57
+ /**
58
+ * The command operation (op/method) to execute
59
+ */
60
+ _op: string;
61
+ /**
62
+ * command parameters array
63
+ */
64
+ _params?: {
65
+ [k: string]: string | number | Function;
66
+ };
67
+ /**
68
+ * XCommand create date timestamp
69
+ */
70
+ d: number;
71
+ constructor(data?: XCommandData);
72
+ /**
73
+ * Gets th parameter value from the XCommand whether it has a name or just a position
74
+ * There are 2 ways to send XCommand with parameters:
75
+ * 1. <module> <op> <param-0> <param-1> <param-2> // position is for this case
76
+ * 2. <module> <op> param-name:param-value // name is for this case
77
+ * @param position the position of the parameter if no name is send
78
+ * @param name the name of the parameter
79
+ * @param defaultValue the default value if none above exists
80
+ * @returns {any} the actual parameter value
81
+ */
82
+ getParam(position: number, name: string, defaultValue: any): any;
83
+ }
84
+ export default XCommand;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Xpell Constants
3
+ *
4
+ * Canonical constants used across the Xpell runtime.
5
+ *
6
+ * This module defines well-known JSON node keys used by Xpell
7
+ * object schemas, parsers, and serializers. Centralizing these
8
+ * constants ensures consistency and prevents string duplication
9
+ * across modules.
10
+ *
11
+ * One-liner: Constants define the Xpell object language.
12
+ *
13
+ * @packageDocumentation
14
+ * @since 2022-07-22
15
+ * @author Tamir Fridman
16
+ * @license MIT
17
+ * @copyright
18
+ * © 2022–present Aime Technologies. All rights reserved.
19
+ */
20
+ /**
21
+ * XObject json nodes
22
+ */
23
+ export declare const NODES: {
24
+ readonly type: "_type";
25
+ readonly children: "_children";
26
+ readonly parent_element: "_parent_element";
27
+ };
28
+ export type XNodeKey = typeof NODES[keyof typeof NODES];
@@ -0,0 +1,51 @@
1
+ export type XDataStore = Record<string, any>;
2
+ export type XDataMeta = {
3
+ source?: string;
4
+ trace?: boolean;
5
+ };
6
+ export type XDataChange = {
7
+ key: string;
8
+ value: any;
9
+ prev: any;
10
+ ts: number;
11
+ op: "set" | "delete" | "touch" | "patch";
12
+ meta?: XDataMeta;
13
+ stack?: string;
14
+ };
15
+ export type XDataListener = (change: XDataChange) => void;
16
+ export declare class _XData {
17
+ private _objects;
18
+ private _listeners;
19
+ private _any_listeners;
20
+ _compat_writes: boolean;
21
+ _warn_legacy_writes: boolean;
22
+ _verbose: boolean;
23
+ _compat_legacy_keys: boolean;
24
+ private _o_proxy;
25
+ constructor();
26
+ /**
27
+ * Shared memory view.
28
+ * Reads are always supported.
29
+ * Writes are supported in compat mode (optional) and should be migrated to set()/delete()/touch().
30
+ */
31
+ get _o(): XDataStore;
32
+ /** Preferred read API */
33
+ get<T = any>(key: string): T | undefined;
34
+ /** Preferred write API */
35
+ set(key: string, value: any, meta?: XDataMeta): void;
36
+ /** Shallow merge helper (nice for state objects) */
37
+ patch(key: string, partial: Record<string, any>, meta?: XDataMeta): void;
38
+ /** In-place mutation notifier */
39
+ touch(key: string, meta?: XDataMeta): void;
40
+ has(key: string): boolean;
41
+ delete(key: string, meta?: XDataMeta): void;
42
+ pick<T = any>(key: string, meta?: XDataMeta): T | undefined;
43
+ clean(): void;
44
+ on(key: string, fn: XDataListener): () => void;
45
+ off(key: string, fn: XDataListener): void;
46
+ onAny(fn: XDataListener): () => void;
47
+ private _emit;
48
+ }
49
+ /** Singleton */
50
+ export declare const XData: _XData;
51
+ export default XData;
@@ -0,0 +1,34 @@
1
+ export type XErrorLevel = "info" | "warn" | "error" | "fatal";
2
+ export type XErrorMeta = {
3
+ [k: string]: any;
4
+ };
5
+ export type XErrorOptions = {
6
+ _level?: XErrorLevel;
7
+ _meta?: XErrorMeta;
8
+ _cause?: unknown;
9
+ };
10
+ export declare class XError extends Error {
11
+ _code: string;
12
+ _level: XErrorLevel;
13
+ _meta?: XErrorMeta;
14
+ _cause?: unknown;
15
+ constructor(_code: string, message: string, opts?: XErrorOptions);
16
+ toXData(): {
17
+ _code: string;
18
+ _level: XErrorLevel;
19
+ _meta: XErrorMeta | undefined;
20
+ _cause: unknown;
21
+ name: string;
22
+ message: string;
23
+ };
24
+ toJSON(): {
25
+ stack: string | undefined;
26
+ _code: string;
27
+ _level: XErrorLevel;
28
+ _meta: XErrorMeta | undefined;
29
+ _cause: unknown;
30
+ name: string;
31
+ message: string;
32
+ };
33
+ }
34
+ export default XError;
@@ -0,0 +1,57 @@
1
+ export type XEventListenerOptions = {
2
+ _once?: boolean;
3
+ _owner?: any;
4
+ _tag?: string;
5
+ };
6
+ export interface XEventListener {
7
+ _id: string;
8
+ _callback: Function;
9
+ _options?: XEventListenerOptions;
10
+ _owner?: any;
11
+ _tag?: string;
12
+ }
13
+ export type XEventListenerId = string;
14
+ export declare class _XEventManager {
15
+ _log_rules: {
16
+ register: boolean;
17
+ remove: boolean;
18
+ fire: boolean;
19
+ };
20
+ protected _events: Record<string, XEventListener[]>;
21
+ protected _listener_index: Record<string, string>;
22
+ constructor();
23
+ /**
24
+ * Register a listener on an event name (runtime bus only).
25
+ *
26
+ * Backward compatible:
27
+ * - Canonical: on(name, cb, { _once, _owner, _tag })
28
+ * - Legacy: on(name, cb, { _once }, owner)
29
+ */
30
+ on(event_name: string, listener: Function, options?: XEventListenerOptions, owner?: any): XEventListenerId;
31
+ /**
32
+ * Register a listener that will be removed after first fire.
33
+ */
34
+ once(event_name: string, listener: Function, owner?: any): XEventListenerId;
35
+ /**
36
+ * Fire an event with optional payload.
37
+ */
38
+ fire(event_name: string, data?: any): Promise<void>;
39
+ /**
40
+ * Remove a listener by id.
41
+ */
42
+ remove(listener_id: string): void;
43
+ /**
44
+ * Remove all listeners for a given owner reference.
45
+ */
46
+ removeOwner(owner: any): void;
47
+ /**
48
+ * Clear the entire event bus (mostly for tests / hard reset).
49
+ */
50
+ clear(): void;
51
+ }
52
+ /**
53
+ * Global Xpell event manager instance.
54
+ */
55
+ export declare const XEventManager: _XEventManager;
56
+ export declare const _xem: _XEventManager;
57
+ export default XEventManager;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * XLogger — Xpell Logging Engine (v2)
3
+ *
4
+ * Dev mode:
5
+ * - `_xlog` is mapped to `console` for correct callsites in DevTools.
6
+ * Production mode:
7
+ * - `_xlog` is mapped to `XLogger` for consistent formatting & controls.
8
+ */
9
+ export type XLogLevel = "log" | "debug" | "warn" | "error";
10
+ export type XLoggerOptions = {
11
+ _enabled?: boolean;
12
+ _show_date?: boolean;
13
+ _show_time?: boolean;
14
+ _debug?: boolean;
15
+ };
16
+ export declare class _XLogger {
17
+ _enabled: boolean;
18
+ _show_date: boolean;
19
+ _show_time: boolean;
20
+ _debug: boolean;
21
+ constructor(opts?: XLoggerOptions);
22
+ configure(opts: XLoggerOptions): void;
23
+ private _dt;
24
+ log(message?: any, ...optional_params: any[]): void;
25
+ warn(message?: any, ...optional_params: any[]): void;
26
+ error(message?: any, ...optional_params: any[]): void;
27
+ debug(message?: any, ...optional_params: any[]): void;
28
+ }
29
+ /** Singleton */
30
+ export declare const XLogger: _XLogger;
31
+ export default XLogger;
32
+ export declare const _xlog: Pick<Console, "log" | "warn" | "error" | "debug">;
@@ -0,0 +1,161 @@
1
+ /**
2
+ * XModule — Base Runtime Module
3
+ *
4
+ * Abstract base class for all Xpell runtime modules.
5
+ *
6
+ * XModule defines the contract for extending the Xpell interpreter
7
+ * with modular functionality, object ownership, and executable commands.
8
+ *
9
+ * ---
10
+ *
11
+ * ## Module Rules
12
+ *
13
+ * - Every module MUST have a unique name
14
+ * - Each module owns an Object Manager responsible for module-specific XObjects
15
+ * - Child XObjects are managed via their parent and not independently
16
+ * - Modules may execute commands via `XCommand`, JSON, or CLI-style text
17
+ *
18
+ * ---
19
+ *
20
+ * ## Command Exposure Rules
21
+ *
22
+ * - Methods prefixed with `_` are exposed to the Xpell interpreter
23
+ * - Public command names:
24
+ * - Strip the leading `_`
25
+ * - Convert spaces and dashes to underscores
26
+ *
27
+ * ---
28
+ *
29
+ * ## Example
30
+ *
31
+ * ```ts
32
+ * class MyModule extends XModule {
33
+ * _my_Command(xCommand) {
34
+ * // command implementation
35
+ * }
36
+ * }
37
+ *
38
+ * // Invocation:
39
+ * XModule.execute("my-Command")
40
+ * ```
41
+ *
42
+ * ---
43
+ *
44
+ * XModule is the extension point that turns the Xpell core
45
+ * into a programmable runtime.
46
+ *
47
+ * One-liner: XModule is how behavior enters the Xpell runtime.
48
+ *
49
+ * @packageDocumentation
50
+ * @since 2022-07-22
51
+ * @author Tamir Fridman
52
+ * @license MIT
53
+ * @copyright
54
+ * © 2022–present Aime Technologies. All rights reserved.
55
+ */
56
+ import XObjectManager from "./XObjectManager";
57
+ import { XObjectData, XObject, XObjectPack } from "./XObject";
58
+ import XCommand, { XCommandData } from "./XCommand";
59
+ export type XModuleData = {
60
+ _name: string;
61
+ };
62
+ export declare const XD_MODULE_NUM_OF_OBJECTS = "engine:module:num-of-objects:";
63
+ /**
64
+ * Xpell Base Module
65
+ * This class represents xpell base module to be extends
66
+ * @class XModule
67
+ *
68
+ */
69
+ export declare class XModule {
70
+ #private;
71
+ [k: string]: any;
72
+ _id: string;
73
+ _name: string;
74
+ _log_rules: {
75
+ createObject: boolean;
76
+ removeObject: boolean;
77
+ };
78
+ constructor(data: XModuleData);
79
+ load(): void;
80
+ /**
81
+ * Creates new XObject from data object
82
+ * @param data - The data of the new object (JSON)
83
+ * @return {XObject|*}
84
+ */
85
+ create(data: XObjectData): any;
86
+ /**
87
+ * removes and XObject from the object manager
88
+ * @param objectId op
89
+ */
90
+ remove(objectId: string): void;
91
+ _info(xCommand: XCommand): void;
92
+ /**
93
+ * Run xpell command -
94
+ * CLI mode, parse the command to XCommand JSON format and call execute method
95
+ * @param {string} XCommand input - text
96
+ * @returns command execution result
97
+ */
98
+ run(stringXCommand: string): Promise<any>;
99
+ /**
100
+ * execute xpell command - CLI mode
101
+ * @param {XCommand} XCommand input (JSON)
102
+ * @returns command execution result
103
+ */
104
+ execute(xCommand: XCommand | XCommandData): Promise<any>;
105
+ /**
106
+ * This method triggers every frame from the Xpell engine.
107
+ * The method can be override by the extending module to support extended onFrame functionality
108
+ * @param frameNumber Current frame number
109
+ */
110
+ onFrame(frameNumber: number): Promise<void>;
111
+ /**
112
+ * X Object Manager
113
+ */
114
+ /**
115
+ * getter for om (object manager) instance
116
+ * @returns {XObjectManager}
117
+ * @deprecated - use _object_manager instead
118
+ * If you wish to get an object from the object manager use
119
+ * getObject directly on the module instead of om.getObject
120
+ */
121
+ get om(): XObjectManager;
122
+ get _object_manager(): XObjectManager;
123
+ /**
124
+ * Returns the XObject instance from the module Object Manager
125
+ * @param objectId
126
+ * @returns XObject
127
+ */
128
+ getObject(objectId: string): XObject;
129
+ /**
130
+ * Returns the XObject instance from the module Object Manager
131
+ * Usage:
132
+ * xmodule._o["object-id"] is equivalent to xmodule.getObject("object-id")
133
+ */
134
+ get _o(): import("./XObjectManager").XObjectManagerIndex;
135
+ /**
136
+ * Imports external object pack to the engine
137
+ * The object class should be like XObjects with static implementation of getObjects() method
138
+ * @param {XObjects} xObjectPack
139
+ */
140
+ importObjectPack(xObjectPack: XObjectPack | any): void;
141
+ /**
142
+ * Imports external object pack to the engine
143
+ * @deprecated - use importObjectPack instead
144
+ * @param xObjectPack
145
+ */
146
+ importObjects(xObjectPack: XObjectPack | any): void;
147
+ /**
148
+ * Imports external objects to the engine
149
+ * The object class should be like XObjects with static implementation of getObjects() method
150
+ * @param xObjectName
151
+ * @param xObject
152
+ */
153
+ importObject(xObjectName: string, xObject: XObject): void;
154
+ _help(cmd: any): Promise<any>;
155
+ /**
156
+ * Override in modules to provide help text.
157
+ * @param op optional: specific command name (e.g. "navigate")
158
+ */
159
+ help(op?: string): any;
160
+ }
161
+ export default XModule;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * XNanoCommands — Core Nano Command Definitions
3
+ *
4
+ * Built-in nano commands available to all XObject instances.
5
+ *
6
+ * This module defines the foundational nano commands that form the
7
+ * minimal executable vocabulary of the Xpell runtime. These commands
8
+ * are registered on every XObject and can be invoked via command text,
9
+ * events, or programmatic execution.
10
+ *
11
+ * Nano commands act as the bridge between declarative intent
12
+ * (strings, schemas, AI output) and imperative runtime behavior.
13
+ *
14
+ * One-liner: Nano commands are the verbs of the Xpell runtime.
15
+ *
16
+ * @packageDocumentation
17
+ * @since 2022-07-22
18
+ * @author Tamir Fridman
19
+ * @license MIT
20
+ * @copyright
21
+ * © 2022–present Aime Technologies. All rights reserved.
22
+ */
23
+ import XCommand, { XCommandData } from "./XCommand";
24
+ import XObject from "./XObject";
25
+ /**
26
+ * Single x-nano-command interface
27
+ */
28
+ export interface XNanoCommand {
29
+ (xCommand: XCommand | XCommandData, xObject: XObject): any;
30
+ }
31
+ /**
32
+ * x-nano-command pack
33
+ */
34
+ export type XNanoCommandPack = {
35
+ [k: string]: XNanoCommand;
36
+ };
37
+ /**
38
+ * XNanoCommand Pack
39
+ */
40
+ export declare const _xobject_basic_nano_commands: XNanoCommandPack;
41
+ declare const _default: XNanoCommandPack;
42
+ export default _default;