From 552a632dbfdfc129f9c81e8f8f034b83b207312c Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Fri, 10 Sep 2021 12:11:16 +0200 Subject: [PATCH] moved to runtime dom --- .r3_history | 4 +- dist/r3.js | 152 ++++++++++++++-- package.json | 2 +- src/r3/r3-r3.js | 4 +- src/r3/r3-runtime/index.js | 6 +- src/r3/r3-runtime/r3-runtime-d-o-m.js | 166 ++++++++++++++++++ src/r3/r3-runtime/r3-runtime-document.js | 8 +- src/r3/r3-runtime/r3-runtime.js | 23 +-- src/r3/r3-system/r3-system-runtime.js | 3 + src/templates/runtime_base.template | 57 ++++++ ...ends.template => runtime_extends.template} | 0 src/templates/token.db | 1 - version | 2 +- 13 files changed, 387 insertions(+), 41 deletions(-) create mode 100644 src/r3/r3-runtime/r3-runtime-d-o-m.js create mode 100644 src/templates/runtime_base.template rename src/templates/{system_extends.template => runtime_extends.template} (100%) diff --git a/.r3_history b/.r3_history index 53747f0..3d5f76e 100644 --- a/.r3_history +++ b/.r3_history @@ -19,8 +19,8 @@ r3 create RuntimeBullet extends RuntimePhysics ./r3-runtime/ r3 create RuntimeCodeMirror extends RuntimeCoder ./r3-runtime/ r3 create RuntimeCoder extends Runtime ./r3-runtime/ r3 create RuntimeControlKit extends RuntimeGUI ./r3-runtime/ -r3 create RuntimeDefault extends Runtime ./r3-runtime/ -r3 create RuntimeDocument extends RuntimeDefault ./r3-runtime/ +r3 create RuntimeDOM extends Runtime ./r3-runtime/ +r3 create RuntimeDocument extends RuntimeDOM ./r3-runtime/ r3 create RuntimeGUI extends Runtime ./r3-runtime/ r3 create RuntimeGraphics extends Runtime ./r3-runtime/ r3 create RuntimePhysics extends Runtime ./r3-runtime/ diff --git a/dist/r3.js b/dist/r3.js index 6cb5e3e..8c51cfe 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.520'; - static compileDate = '2021 Sep 10 - 10:57:46 am'; + static version = '2.0.522'; + static compileDate = '2021 Sep 10 - 11:12:39 am'; } class Entity { @@ -2393,6 +2393,10 @@ class SystemRuntime extends System { */ static OnGetRuntime(object) { + if (object instanceof R3.Component.DOM) { + + } + } } @@ -2590,18 +2594,19 @@ class Runtime extends Event { Runtime.RUNTIME_CODER = 0x0; Runtime.RUNTIME_CODE_MIRROR = 0x1; -Runtime.RUNTIME_DEFAULT = 0x2; +Runtime.RUNTIME_DOM = 0x2; Runtime.RUNTIME_DOCUMENT = 0x3; -Runtime.RUNTIME_GUI = 0x4; -Runtime.RUNTIME_CONTROL_KIT = 0x5; -Runtime.RUNTIME_GRAPHICS = 0x6; -Runtime.RUNTIME_THREE = 0x7; -Runtime.RUNTIME_PHYSICS = 0x8; -Runtime.RUNTIME_BULLET = 0x9; -Runtime.RUNTIME_SOCKET = 0xa; -Runtime.RUNTIME_STATISTICS = 0xb; -Runtime.RUNTIME_STATS = 0xc; -Runtime.MAX_RUNTIME = 0xd; +Runtime.RUNTIME_DEFAULT = 0x4; +Runtime.RUNTIME_GUI = 0x5; +Runtime.RUNTIME_CONTROL_KIT = 0x6; +Runtime.RUNTIME_GRAPHICS = 0x7; +Runtime.RUNTIME_THREE = 0x8; +Runtime.RUNTIME_PHYSICS = 0x9; +Runtime.RUNTIME_BULLET = 0xa; +Runtime.RUNTIME_SOCKET = 0xb; +Runtime.RUNTIME_STATISTICS = 0xc; +Runtime.RUNTIME_STATS = 0xd; +Runtime.MAX_RUNTIME = 0xe; /** @@ -2841,6 +2846,118 @@ class RuntimeCoder extends Runtime { } +/** + + Class R3.Event.Runtime.DOM + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raise an event(s) which indicates that this object initialized + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeDOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeDOM extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + Object.assign(this, options); + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + +} + /** Class R3.Event.Runtime.Default @@ -4013,7 +4130,7 @@ class RuntimeCodeMirror extends RuntimeCoder { /** - Class R3.Event.Runtime.Default.Document + Class R3.Event.Runtime.DOM.Document [Inherited from Event] Inherited Properties: @@ -4071,7 +4188,7 @@ class RuntimeCodeMirror extends RuntimeCoder { - [Inherited from RuntimeDefault] + [Inherited from RuntimeDOM] Inherited Properties: @@ -4109,7 +4226,7 @@ class RuntimeCodeMirror extends RuntimeCoder { **/ -class RuntimeDocument extends RuntimeDefault { +class RuntimeDocument extends RuntimeDOM { constructor(options) { @@ -6221,8 +6338,9 @@ Component.Input = ComponentInput; Component.Input.Touch = ComponentTouch; Runtime.Coder = RuntimeCoder; Runtime.Coder.CodeMirror = RuntimeCodeMirror; +Runtime.DOM = RuntimeDOM; +Runtime.DOM.Document = RuntimeDocument; Runtime.Default = RuntimeDefault; -Runtime.Default.Document = RuntimeDocument; Runtime.GUI = RuntimeGUI; Runtime.GUI.ControlKit = RuntimeControlKit; Runtime.Graphics = RuntimeGraphics; diff --git a/package.json b/package.json index eb1c653..b210237 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version" : "2.0.520", + "version" : "2.0.522", "description": "", "private": true, "dependencies": { diff --git a/src/r3/r3-r3.js b/src/r3/r3-r3.js index e3b245c..8d60b96 100644 --- a/src/r3/r3-r3.js +++ b/src/r3/r3-r3.js @@ -1,6 +1,6 @@ class R3 { - static version = '2.0.520'; - static compileDate = '2021 Sep 10 - 10:57:46 am'; + static version = '2.0.522'; + static compileDate = '2021 Sep 10 - 11:12:39 am'; } //GENERATED_IMPORTS_START diff --git a/src/r3/r3-runtime/index.js b/src/r3/r3-runtime/index.js index 7d2b51e..f37a9df 100644 --- a/src/r3/r3-runtime/index.js +++ b/src/r3/r3-runtime/index.js @@ -2,8 +2,9 @@ const Runtime = require('./r3-runtime.js'); const RuntimeCoder = require('./r3-runtime-coder.js'); const RuntimeCodeMirror = require('./r3-runtime-code-mirror.js'); -const RuntimeDefault = require('./r3-runtime-default.js'); +const RuntimeDOM = require('./r3-runtime-d-o-m.js'); const RuntimeDocument = require('./r3-runtime-document.js'); +const RuntimeDefault = require('./r3-runtime-default.js'); const RuntimeGUI = require('./r3-runtime-g-u-i.js'); const RuntimeControlKit = require('./r3-runtime-control-kit.js'); const RuntimeGraphics = require('./r3-runtime-graphics.js'); @@ -18,8 +19,9 @@ const RuntimeStats = require('./r3-runtime-stats.js'); //GENERATED_INDEX_BODY_START Runtime.Coder = RuntimeCoder; Runtime.Coder.CodeMirror = RuntimeCodeMirror; +Runtime.DOM = RuntimeDOM; +Runtime.DOM.Document = RuntimeDocument; Runtime.Default = RuntimeDefault; -Runtime.Default.Document = RuntimeDocument; Runtime.GUI = RuntimeGUI; Runtime.GUI.ControlKit = RuntimeControlKit; Runtime.Graphics = RuntimeGraphics; diff --git a/src/r3/r3-runtime/r3-runtime-d-o-m.js b/src/r3/r3-runtime/r3-runtime-d-o-m.js new file mode 100644 index 0000000..509b97e --- /dev/null +++ b/src/r3/r3-runtime/r3-runtime-d-o-m.js @@ -0,0 +1,166 @@ +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); +const Runtime = require('.././r3-runtime.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Event.Runtime.DOM + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - initialize() + Should raise an event(s) which indicates that this object initialized + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeDOM] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_LINKED_OBJECTS_START + CUSTOM_LINKED_OBJECTS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class RuntimeDOM extends Runtime { + + //GENERATED_CONSTRUCTOR_EXTENDS_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.initialized === 'undefined') { + options.initialized = false; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + super(options); + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_EXTENDS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = RuntimeDOM; diff --git a/src/r3/r3-runtime/r3-runtime-document.js b/src/r3/r3-runtime/r3-runtime-document.js index eb31481..1d1e009 100644 --- a/src/r3/r3-runtime/r3-runtime-document.js +++ b/src/r3/r3-runtime/r3-runtime-document.js @@ -1,12 +1,12 @@ const Event = require('.././r3-event'); const Utils = require('.././r3-utils'); -const RuntimeDefault = require('.././r3-runtime-default.js'); +const RuntimeDOM = require('.././r3-runtime-d-o-m.js'); /** GENERATED_INHERITED_START - Class R3.Event.Runtime.Default.Document + Class R3.Event.Runtime.DOM.Document [Inherited from Event] Inherited Properties: @@ -64,7 +64,7 @@ const RuntimeDefault = require('.././r3-runtime-default.js'); - [Inherited from RuntimeDefault] + [Inherited from RuntimeDOM] Inherited Properties: @@ -122,7 +122,7 @@ const RuntimeDefault = require('.././r3-runtime-default.js'); **/ -class RuntimeDocument extends RuntimeDefault { +class RuntimeDocument extends RuntimeDOM { //GENERATED_CONSTRUCTOR_EXTENDS_START constructor(options) { diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index 6a9e151..3d7f06d 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -141,18 +141,19 @@ class Runtime extends Event { //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START Runtime.RUNTIME_CODER = 0x0; Runtime.RUNTIME_CODE_MIRROR = 0x1; -Runtime.RUNTIME_DEFAULT = 0x2; +Runtime.RUNTIME_DOM = 0x2; Runtime.RUNTIME_DOCUMENT = 0x3; -Runtime.RUNTIME_GUI = 0x4; -Runtime.RUNTIME_CONTROL_KIT = 0x5; -Runtime.RUNTIME_GRAPHICS = 0x6; -Runtime.RUNTIME_THREE = 0x7; -Runtime.RUNTIME_PHYSICS = 0x8; -Runtime.RUNTIME_BULLET = 0x9; -Runtime.RUNTIME_SOCKET = 0xa; -Runtime.RUNTIME_STATISTICS = 0xb; -Runtime.RUNTIME_STATS = 0xc; -Runtime.MAX_RUNTIME = 0xd; +Runtime.RUNTIME_DEFAULT = 0x4; +Runtime.RUNTIME_GUI = 0x5; +Runtime.RUNTIME_CONTROL_KIT = 0x6; +Runtime.RUNTIME_GRAPHICS = 0x7; +Runtime.RUNTIME_THREE = 0x8; +Runtime.RUNTIME_PHYSICS = 0x9; +Runtime.RUNTIME_BULLET = 0xa; +Runtime.RUNTIME_SOCKET = 0xb; +Runtime.RUNTIME_STATISTICS = 0xc; +Runtime.RUNTIME_STATS = 0xd; +Runtime.MAX_RUNTIME = 0xe; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-system/r3-system-runtime.js b/src/r3/r3-system/r3-system-runtime.js index 85a1a00..94db23e 100644 --- a/src/r3/r3-system/r3-system-runtime.js +++ b/src/r3/r3-system/r3-system-runtime.js @@ -185,6 +185,9 @@ class SystemRuntime extends System { //GENERATED_STATIC_ON_GET_RUNTIME_METHOD_END //CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_START + if (object instanceof R3.Component.DOM) { + + } //CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_END } diff --git a/src/templates/runtime_base.template b/src/templates/runtime_base.template new file mode 100644 index 0000000..769f32d --- /dev/null +++ b/src/templates/runtime_base.template @@ -0,0 +1,57 @@ +const Event = require('INCLUDE_PATH/r3-event'); +const Utils = require('INCLUDE_PATH/r3-utils'); + +/** + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START + CUSTOM_STATIC_EVENT_LISTENERS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class CLASS_NAME { + + //GENERATED_CONSTRUCTOR_START + //GENERATED_CONSTRUCTOR_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START + //GENERATED_STATIC_EVENT_LISTENER_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END + +} + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = CLASS_NAME; diff --git a/src/templates/system_extends.template b/src/templates/runtime_extends.template similarity index 100% rename from src/templates/system_extends.template rename to src/templates/runtime_extends.template diff --git a/src/templates/token.db b/src/templates/token.db index 9632de9..fde7a9a 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -2,7 +2,6 @@ GENERATED_ASYNC_METHOD GENERATED_CONSTRUCTOR GENERATED_CONSTRUCTOR_EXTENDS GENERATED_CREATE_INSTANCE_METHOD -GENERATED_CREATE_INSTANCE_OPTIONS GENERATED_DEFINES GENERATED_DISPOSE_INSTANCE_METHOD GENERATED_DISPOSE_METHOD diff --git a/version b/version index 0318c75..337ef6d 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.520 \ No newline at end of file +2.0.522 \ No newline at end of file