Nikolay Suslov 4 лет назад
Родитель
Сommit
a65356d872
5 измененных файлов с 387 добавлено и 1572 удалено
  1. 118 674
      public/app.js
  2. 18 0
      public/defaults/proxy/aframe/aentity.vwf.json
  3. 153 210
      public/helpers.js
  4. 20 387
      public/web/index-app.js
  5. 78 301
      public/web/world-app.js

Разница между файлами не показана из-за своего большого размера
+ 118 - 674
public/app.js


+ 18 - 0
public/defaults/proxy/aframe/aentity.vwf.json

@@ -42,6 +42,24 @@
     "clickEvent": {}
   },
   "methods": {
+    "position_get":{},
+    "position_set": {
+      "parameters": [
+        "value"
+      ]
+    },
+      "rotation_get":{},
+      "rotation_set": {
+        "parameters": [
+          "value"
+        ]
+      },
+      "scale_get":{},
+      "scale_set": {
+        "parameters": [
+          "value"
+        ]
+      },
     "getRandomColor": {},
     "intersectEventMethod": {},
     "clearIntersectEventMethod": {},

+ 153 - 210
public/helpers.js

@@ -19,13 +19,13 @@ class Helpers {
     reduceSaveObject(path) {
         let obj = Object.assign({}, path);
 
-        if(path.saveObject){
-            if ( path.saveObject[ "queue" ] ) {
-                if ( path.saveObject[ "queue" ][ "time" ] ) {
+        if (path.saveObject) {
+            if (path.saveObject["queue"]) {
+                if (path.saveObject["queue"]["time"]) {
                     obj.saveObject = {
                         "init": true,
-                        "queue":{
-                            "time": path.saveObject[ "queue" ][ "time" ]
+                        "queue": {
+                            "time": path.saveObject["queue"]["time"]
                         }
                     }
                 }
@@ -81,9 +81,9 @@ class Helpers {
         return result;
     }
 
-    GetNamespace( processedURL ) {
-        if ( ( processedURL[ 'instance' ] ) && ( processedURL[ 'public_path' ] ) ) {
-            return this.JoinPath( processedURL[ 'public_path' ], processedURL[ 'application' ], processedURL[ 'instance' ] );
+    GetNamespace(processedURL) {
+        if ((processedURL['instance']) && (processedURL['public_path'])) {
+            return this.JoinPath(processedURL['public_path'], processedURL['application'], processedURL['instance']);
         }
         return undefined;
     }
@@ -108,40 +108,10 @@ class Helpers {
         return result;
     }
 
-    async GetExtension(path) {
-
-        if (path.match(/\.vwf$/)) {
-
-            // ["", ".yaml", ".json"]
-
-            let check1 = await this.IsFileExist(this.JoinPath(path + "").split(".").join("_"));
-            if(check1)
-                return ""
-
-            let check2 = await this.IsFileExist(this.JoinPath(path + ".yaml").split(".").join("_"));
-            if(check2)
-                return ".yaml"
-
-            let check3 = await this.IsFileExist(this.JoinPath(path + ".json").split(".").join("_"));
-            if(check3)
-                return ".json"
-
-
-
-
-            // for (const res of this.template_extensions) {
-            //     let check = await this.IsFileExist(this.JoinPath(path + res).split(".").join("_"));
-            //     if (check) return res
-            // }
-        }
-
-        return undefined;
-    }
-
     getInstanceID(obj) {
 
         // "/world/index.vwf/CcI3c1MnTsblg3H7"
-        return  obj.split('/')[3]
+        return obj.split('/')[3]
 
     }
 
@@ -165,7 +135,7 @@ class Helpers {
 
     }
 
-    getRoot(){
+    getRoot() {
 
         let data = JSON.parse(localStorage.getItem('lcs_app'));
 
@@ -176,54 +146,6 @@ class Helpers {
         }
     }
 
-    getRootOld(noUser) {
-        var app = window.location.pathname;
-        var pathSplit = app.split('/');
-        if (pathSplit[0] == "") {
-            pathSplit.shift();
-        }
-        if (pathSplit[pathSplit.length - 1] == "") {
-            pathSplit.pop();
-        }
-        var inst = undefined;
-        var instIndex = pathSplit.length - 1;
-        if (pathSplit.length > 2) {
-            if (pathSplit[pathSplit.length - 2] == "load") {
-                instIndex = pathSplit.length - 3;
-            }
-        }
-        if (pathSplit.length > 3) {
-            if (pathSplit[pathSplit.length - 3] == "load") {
-                instIndex = pathSplit.length - 4;
-            }
-        }
-
-        inst = pathSplit[instIndex];
-
-        var root = "";
-        for (var i = 0; i < instIndex; i++) {
-            if (root != "") {
-                root = root + "/";
-            }
-            root = root + pathSplit[i];
-        }
-
-        if (root.indexOf('.vwf') != -1) root = root.substring(0, root.lastIndexOf('/'));
-
-        if (noUser) {
-            return {
-                "root": root.replace(pathSplit[0] + '/', ""),
-                "inst": inst
-            }
-        } else {
-
-            return {
-                "root": root,
-                "inst": inst
-            }
-        }
-
-    }
 
     get worldUser() {
         return this.getRoot(false).root.split('/')[0];
@@ -278,6 +200,20 @@ class Helpers {
     };
 
 
+    convertFileSource(file, source) {
+        //var source = (typeof(sourceToEdit) =="object") ? JSON.stringify(sourceToEdit): sourceToEdit;
+        var convert;
+        if (file.includes('_json') && (typeof source !== 'object')) {
+            convert = (typeof JSON.parse(source) == 'object') ? JSON.stringify(JSON.parse(source), null, '\t') : source
+            //source = source;//JSON.stringify(source, null, '\t');
+        } else if (typeof source == 'object') {
+            convert = JSON.stringify(source, null, '\t')
+        }
+
+        return convert
+    }
+
+
     async getHtmlText(url) {
 
         let file = await fetch(url, { method: 'get' });
@@ -287,15 +223,15 @@ class Helpers {
 
     removeProps(obj) {
 
-         let rm = L.lazy(rec => 
-            L.ifElse(R.is(String), 
-            L.when(x => x == 'id'
-            || x == 'patches' 
-            || x == 'random'
-            || x == 'sequence'), [L.keysEverywhere, rec], L.optional)
-          );
+        let rm = L.lazy(rec =>
+            L.ifElse(R.is(String),
+                L.when(x => x == 'id'
+                    || x == 'patches'
+                    || x == 'random'
+                    || x == 'sequence'), [L.keysEverywhere, rec], L.optional)
+        );
 
-          return L.remove(rm, obj)
+        return L.remove(rm, obj)
 
         // Object.keys(obj).forEach(key =>
         //     (key === 'id' || key === 'patches' || key === 'random' || key === 'sequence') && delete obj[key] ||
@@ -306,13 +242,13 @@ class Helpers {
 
     removeGrammarObj(obj) {
 
-        let rm = L.lazy(rec => 
-            L.ifElse(R.is(String), 
-            L.when(x => x == 'grammar' 
-            || x == 'semantics'), [L.keysEverywhere, rec], L.optional)
-          );
+        let rm = L.lazy(rec =>
+            L.ifElse(R.is(String),
+                L.when(x => x == 'grammar'
+                    || x == 'semantics'), [L.keysEverywhere, rec], L.optional)
+        );
 
-          return L.remove(rm, obj)
+        return L.remove(rm, obj)
 
         // Object.keys(obj).forEach(key =>
         //     (key === 'grammar' || key === 'semantics') && delete obj[key] ||
@@ -322,26 +258,26 @@ class Helpers {
     };
 
 
-    collectMethods(obj){
+    collectMethods(obj) {
 
         let files = {};
 
-        Object.keys(obj.children).forEach(childName =>{
-           
-        let child = obj.children[childName];
-        if (child.scritps && child.methods)
-            files[childName] = "";
-               let methods = child.methods;
-               Object.keys(methods).forEach(el=>{
-                   let method = methods[el];
-                    if(method.body){
-                        let params = method.parameters ? method.parameters.toString() : '';
-                        let funDef = "this." + el +' = function(' + params + ') { \n' + method.body + '\n' + '}';
-                        files[childName] = files[childName].concat('\n').concat(funDef);
-                    }
-                })
-    })
-    return files
+        Object.keys(obj.children).forEach(childName => {
+
+            let child = obj.children[childName];
+            if (child.scritps && child.methods)
+                files[childName] = "";
+            let methods = child.methods;
+            Object.keys(methods).forEach(el => {
+                let method = methods[el];
+                if (method.body) {
+                    let params = method.parameters ? method.parameters.toString() : '';
+                    let funDef = "this." + el + ' = function(' + params + ') { \n' + method.body + '\n' + '}';
+                    files[childName] = files[childName].concat('\n').concat(funDef);
+                }
+            })
+        })
+        return files
     }
 
     getNodeJSProps(nodeID) {
@@ -350,13 +286,13 @@ class Helpers {
     }
 
     getWorldProto() {
-        let worldID = vwf.application(); 
+        let worldID = vwf.application();
         let nodeDef = this.getNodeDef(worldID);
 
         const rm = L.lazy(rec =>
             L.ifElse(R.is(String), L.when(x => x.includes('avatar-') || x.includes('xcontroller-') || x.includes('gearvr-')), [L.keys, rec], L.optional)
-          )
-        
+        )
+
         let fixedDef = L.remove(['children', L.props(rm)], nodeDef)
 
         return fixedDef
@@ -367,48 +303,48 @@ class Helpers {
         let nodeDefPure = this.removeProps(node);
         let nodeDef = this.removeGrammarObj(nodeDefPure);
 
-        let finalDef = this.replaceFloatArraysInNodeDef(nodeDef); 
+        let finalDef = this.replaceFloatArraysInNodeDef(nodeDef);
 
         return finalDef
     }
 
-    replaceFloatArraysInNodeDef(state){
+    replaceFloatArraysInNodeDef(state) {
 
         var objectIsTypedArray = function (candidate) {
             var typedArrayTypes = [
-              Int8Array,
-              Uint8Array,
-              // Uint8ClampedArray,
-              Int16Array,
-              Uint16Array,
-              Int32Array,
-              Uint32Array,
-              Float32Array,
-              Float64Array
+                Int8Array,
+                Uint8Array,
+                // Uint8ClampedArray,
+                Int16Array,
+                Uint16Array,
+                Int32Array,
+                Uint32Array,
+                Float32Array,
+                Float64Array
             ];
-      
+
             var isTypedArray = false;
-      
+
             if (typeof candidate == "object" && candidate != null) {
-              typedArrayTypes.forEach(function (typedArrayType) {
-                isTypedArray = isTypedArray || candidate instanceof typedArrayType;
-              });
+                typedArrayTypes.forEach(function (typedArrayType) {
+                    isTypedArray = isTypedArray || candidate instanceof typedArrayType;
+                });
             }
-      
+
             return isTypedArray;
-          };
-      
-          var transitTransformation = function (object) {
+        };
+
+        var transitTransformation = function (object) {
             return objectIsTypedArray(object) ?
-              Array.prototype.slice.call(object) : object;
-          };
-      
-      
-          let value = require("vwf/utility").transform(
+                Array.prototype.slice.call(object) : object;
+        };
+
+
+        let value = require("vwf/utility").transform(
             state, transitTransformation
-          );
-      
-          return value
+        );
+
+        return value
 
     }
 
@@ -446,35 +382,30 @@ class Helpers {
         }
     }
 
-    authUser(alias, pass){
-
+    authUser(alias, pass) {
+        let self = this;
+        
         _LCSDB.user().auth(alias, pass
-                , function(ack) {
-    
+            , function (ack) {
+
                 if (ack.err) {
-                    new Noty({
-                        text: ack.err,
-                        timeout: 2000,
-                        theme: 'mint',
-                        layout: 'bottomRight',
-                        type: 'error'
-                    }).show();
-    
+                    self.notyErr(ack.err)
+
                 }
-             }
-             );
+            }
+        );
 
     }
-    
-   testJSON (text) {
-        if (typeof text!=="string"){
+
+    testJSON(text) {
+        if (typeof text !== "string") {
             return false;
         }
-        try{
+        try {
             JSON.parse(text);
             return true;
         }
-        catch (error){
+        catch (error) {
             return false;
         }
     }
@@ -483,65 +414,77 @@ class Helpers {
 
         //TODO: Fix for using hashids instead users aliases with pubs sorted by time of registration
         let alias = '~@' + userName;
-        let user = await (new Promise(res=>_LCSDB.get(alias).once(res)));
-       
-        if(user) {
-
-        if(Object.keys(user).length > 1){
-            let pubs = await Promise.all(Object.keys(user).filter(el=>el !== '_').map(el => _LCSDB.user(el.slice(1)).then(res=>{
-                let ts = Gun.state.is(res, 'pub')
-                return {pub: res.pub, time: ts}
-            })))
-            //console.log(pubs);
-            pubs.sort(function(a,b){
-                return new Date(b.time) - new Date(a.time);
-              });
-            
-            return pubs[0].pub
+        let user = await (new Promise(res => _LCSDB.get(alias).once(res)));
 
-        } else {
-            return Object.keys(user)[1].slice(1)
-        }
+        if (user) {
 
-    }
+            if (Object.keys(user).length > 1) {
+                let pubs = await Promise.all(Object.keys(user).filter(el => el !== '_').map(el => _LCSDB.user(el.slice(1)).then(res => {
+                    let ts = Gun.state.is(res, 'pub')
+                    return { pub: res.pub, time: ts }
+                })))
+                //console.log(pubs);
+                pubs.sort(function (a, b) {
+                    return new Date(b.time) - new Date(a.time);
+                });
+
+                return pubs[0].pub
+
+            } else {
+                return Object.keys(user)[1].slice(1)
+            }
+
+        }
 
     }
 
-   checkUserCollision(){
+    checkUserCollision() {
 
-     //TODO: Fix for using hashids instead users aliases with pubs sorted by time of registration
+        //TODO: Fix for using hashids instead users aliases with pubs sorted by time of registration
 
-        _app.helpers.getUserPub(_LCSDB.user().is.alias).then(res=>{
-            if(_LCSDB.user().is.pub !== res){
-              if(window.confirm("ERROR: User name collision. Try to delete user collision?")) {
-                _LCSDB.user().delete();
-                window.reload();
-            }
+        _app.helpers.getUserPub(_LCSDB.user().is.alias).then(res => {
+            if (_LCSDB.user().is.pub !== res) {
+                if (window.confirm("ERROR: User name collision. Try to delete user collision?")) {
+                    _LCSDB.user().delete();
+                    window.reload();
+                }
             }
-          })
+        })
 
     }
 
     async getUserAlias(userPub) {
 
-        let user = await (new Promise(res=>_LCSDB.user(userPub).get('alias').once(res)));
-       
-        if(user)
+        let user = await (new Promise(res => _LCSDB.user(userPub).get('alias').once(res)));
+
+        if (user)
             return user
 
     }
 
-    notyOK(msg){
+    notyOK(msg) {
 
-    let noty = new Noty({
-        text: msg,
-        timeout: 2000,
-        theme: 'mint',
-        layout: 'bottomRight',
-        type: 'success'
-    });
-    noty.show();
-}
+        let noty = new Noty({
+            text: msg,
+            timeout: 2000,
+            theme: 'mint',
+            layout: 'bottomRight',
+            type: 'success'
+        });
+        noty.show();
+    }
+
+    notyErr(msg) {
+
+        let noty = new Noty({
+            text: msg,
+            timeout: 2000,
+            theme: 'mint',
+            layout: 'bottomRight',
+            type: 'error'
+        });
+        noty.show();
+    }
 
 }
 

+ 20 - 387
public/web/index-app.js

@@ -184,23 +184,12 @@ class IndexApp {
                                 "onclick": function (e) {
                                     e.preventDefault();
                                     let alias = _LCSDB.user().is.alias;
-                                    window.location.pathname = '/' + alias + '/worlds/protos'
+                                    window.location.pathname = '/' + alias + '/worlds'
                                     //page('/' + alias + '/worlds/protos');
                                     //_app.indexApp.getWorldsProtosFromUserDB(alias);
                                 }
-                            }),
-                        window._app.widgets.buttonStroked(
-                            {
-                                "label": _l.t("my world states"),
-                                "onclick": function (e) {
-                                    e.preventDefault();
-                                    let alias = _LCSDB.user().is.alias;
-                                    window.location.pathname = '/' + alias + '/worlds/states'
-                                    //page('/' + alias + '/worlds/states');
-                                    // page.redirect('/' + alias + '/worlds/states');
-                                    //_app.indexApp.getWorldsFromUserDB(alias);       
-                                }
                             })
+
                     ]
                 }
 
@@ -215,7 +204,7 @@ class IndexApp {
                     //     class: "mdc-typography--headline4",
                     //     $text: navigator.userAgent
                     // }
-                    
+
                 ].concat(gui)
             }
         }
@@ -238,7 +227,7 @@ class IndexApp {
         });
     }
 
-    async allWorldsProtosForUser(userAlias) {
+    async allWorldsForUser(userAlias) {
 
         let userPub = await _app.helpers.getUserPub(userAlias);
         //let db = _LCSDB.user(userPub);
@@ -293,72 +282,11 @@ class IndexApp {
 
     }
 
-    async allWorldsStatesForUser(userAlias, worldName, elID) {
-
-        let userPub = await _app.helpers.getUserPub(userAlias);
-        //let db = _LCSDB.user(userPub);
-
-        let doc = elID ? document.querySelector("#" + elID) : document.querySelector("#worldsGUI");
-
-        var worlds = {};
-
-        if (userPub) {
-            if (!worldName) {
-                worlds = this.createWorldsGUI('state', userAlias, userPub)
-            } else {
-                worlds = this.createWorldsGUI('state', userAlias, userPub, worldName)
-            }
-
-        } else {
-
-            worlds = {
-                $type: 'div',
-                $text: 'Could not find user with name: ' + userAlias,
-                class: "mdc-typography--headline4"
-            }
-        }
-
-        let components = [
-            {
-                $type: "div",
-                class: "mdc-layout-grid",
-                $components: [
-                    {
-                        $type: "div",
-                        class: "mdc-layout-grid__inner",
-                        $components: [
-                            {
-                                $type: "div",
-                                class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                $components: [
-                                    {
-                                        $type: "h1",
-                                        class: "mdc-typography--headline4",
-                                        $text: _l.t("states for") + userAlias
-                                    }
-                                ]
-                            },
-                            {
-                                $type: "div",
-                                class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                $components: [].concat(worlds)
-                            }
-                        ]
-                    }
-                ]
-            }
-        ]
-
-        doc._refresh(components);
-
-    }
-
-
     authGUI() {
 
         let alias = _LCSDB.user().is.alias;
         let userEl = document.querySelector('#userGUI');
-        userEl._status = _l.t("welcome") +', ' + alias + '!';
+        userEl._status = _l.t("welcome") + ', ' + alias + '!';
         //userEl.style.backgroundColor = '#e6e6e6';   
         userEl._refresh(); //$update();
 
@@ -381,7 +309,7 @@ class IndexApp {
         // });
 
         let actionsGUI = document.querySelector('#worldActionsGUI');
-        if (actionsGUI){
+        if (actionsGUI) {
             actionsGUI._refresh();
             actionsGUI._gen = _app.helpers.randId();
         }
@@ -397,13 +325,9 @@ class IndexApp {
         if (this.entry == 'index') {
             //change for LiveCoding.space to 'app'
             //this.initWorldsProtosListForUserNew(alias);
-            this.allWorldsProtosForUser(alias)
+            this.allWorldsForUser(alias)
         }
 
-
-
-
-
     }
 
 
@@ -461,78 +385,22 @@ class IndexApp {
                                     }
                                 }),
                                 _app.widgets.p,
-                                // {
-                                //     $type: "a",
-                                //     class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                //     $text: 'World Protos', //self.language.t('set proxy'),//"clone",
-                                //     onclick: function (e) {
-                                //         //console.log('clone');
-                                //         let searchName = this._userNameField.value;
-                                //         self.initWorldsProtosListForUser(searchName);
-                                //     }
-                                // },
-                                // {
-                                //     $type: "a",
-                                //     class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                //     $text: 'World States', //self.language.t('set proxy'),//"clone",
-                                //     onclick: function (e) {
-                                //         //console.log('clone');
-                                //         let searchName = this._userNameField.value;
-                                //         self.initWorldsStatesListForUser(searchName);
-                                //     }
-                                // }
                                 _app.widgets.buttonRaised(
                                     {
-                                        "label":  _l.t("world protos"),
+                                        "label": _l.t("world protos"),
                                         "onclick": function (e) {
                                             e.preventDefault();
                                             //page("/app/worlds/protos")
                                             let searchName = this._userNameField.value;
                                             if (searchName !== "")
-                                                window.location.pathname = "/" + searchName + "/worlds/protos"
+                                                window.location.pathname = "/" + searchName + "/worlds"
                                             //_app.indexApp.getAppDetailsFromDefaultDB('protos');
 
-                                        }
-                                    }),
-                                _app.widgets.space,
-                                _app.widgets.buttonRaised(
-                                    {
-                                        "label": _l.t("world states"),
-                                        "onclick": function (e) {
-                                            e.preventDefault();
-                                            //page("/app/worlds/states")
-                                            let searchName = this._userNameField.value;
-                                            if (searchName !== "")
-                                                window.location.pathname = "/" + searchName + "/worlds/states"
-                                            //_app.indexApp.getAppDetailsFromDefaultDB('states');
-
                                         }
                                     })
 
                             ]
-                    },
-                    // window._app.widgets.buttonStroked(
-                    //     {
-                    //         "label": 'Default World Protos',
-                    //         "onclick": function (e) {
-                    //             e.preventDefault();
-                    //             //page("/app/worlds/protos")
-                    //             window.location.pathname = "/app/worlds/protos"
-                    //             //_app.indexApp.getAppDetailsFromDefaultDB('protos');
-
-                    //         }
-                    //     }),
-                    // window._app.widgets.buttonStroked(
-                    //     {
-                    //         "label": 'Default World States',
-                    //         "onclick": function (e) {
-                    //             e.preventDefault();
-                    //             //page("/app/worlds/states")
-                    //             window.location.pathname = "/app/worlds/states"
-                    //             //_app.indexApp.getAppDetailsFromDefaultDB('states');
-
-                    //         }
-                    //     })
+                    }
                 ];
 
                 this.$components = [
@@ -582,7 +450,7 @@ class IndexApp {
 
                 let instanceID = _app.helpers.getInstanceID(m[0]);
                 var link = "#";
-                if(m[1].loadInfo.save_name){
+                if (m[1].loadInfo.save_name) {
                     link = "/" + m[1].user + "/" + worldName + "/" + instanceID + '/load/' + m[1].loadInfo.save_name;
                 } else {
                     link = "/" + m[1].user + "/" + worldName + "/" + instanceID; //m[0];
@@ -610,7 +478,7 @@ class IndexApp {
                                             onclick: function (e) {
                                                 self.checkForManualSettings();
                                                 window.location.pathname = link
-                                                
+
                                                 //self.refresh();
                                             }
                                         },
@@ -738,7 +606,7 @@ class IndexApp {
                                     return
                                 }
 
-                                console.log(res);
+                                //console.log(res);
 
                                 let worldDesc = JSON.parse(res);
 
@@ -765,59 +633,7 @@ class IndexApp {
                                     cb(doc);
                             }
                         })
-                    } 
-                    // else if (worldType == 'state') {
-                    //     let pathName = 'savestate_/' + this._worldName.protoName + '/' + this._worldName.stateName + '_info_vwf_json';
-                    //     db.get('documents').get(this._worldName.protoName).path(pathName).on((res) => {
-
-                    //         if (res) {
-
-                    //             if (res.file) {
-                    //                 let doc = {
-                    //                     'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
-                    //                     'created': undefined,
-                    //                     'modified': undefined,
-                    //                     'type': 'state',
-                    //                     'userAlias': userAlias,
-                    //                     'info': { title: 'Need to repair!' }
-                    //                 }
-                    //                 this._refresh(doc);
-                    //                 return
-                    //             }
-
-
-                    //             console.log(res);
-
-                    //             let worldDesc = JSON.parse(res);
-
-                    //             let root = Object.keys(worldDesc)[0];
-                    //             var appInfo = worldDesc[root]['en'];
-
-                    //             let langID = localStorage.getItem('krestianstvo_locale');
-                    //             if (langID) {
-                    //                 appInfo = worldDesc[root][langID]
-                    //             }
-
-                    //             let doc = {
-                    //                 'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
-                    //                 'created': undefined,
-                    //                 'modified': undefined,
-                    //                 'type': 'saveState',
-                    //                 'userAlias': userAlias,
-                    //                 'info': appInfo
-                    //             }
-                    //             this._refresh(doc);
-
-                    //             //callback
-                    //             if (cb)
-                    //                 cb(doc);
-                    //         }
-                    //     })
-
-                    // }
-
-
-
+                    }
                 } else if (type == 'full') {
 
                     if (worldType == 'proto') {
@@ -840,9 +656,7 @@ class IndexApp {
                                     return
                                 }
 
-
-
-                                console.log(res);
+                                //console.log(res);
 
                                 let worldDesc = JSON.parse(res['info_json']);
 
@@ -879,63 +693,7 @@ class IndexApp {
                             }
                         })
 
-                    } 
-                    // else if (worldType == 'state') {
-
-                    //     let pathNameInfo = 'savestate_/' + this._worldName.protoName + '/' + this._worldName.stateName + '_info_vwf_json';
-                    //     db.get('documents').get(this._worldName.protoName).path(pathNameInfo).on((res) => {
-                    //         if (res) {
-
-                    //             if (res.file) {
-                    //                 let doc = {
-                    //                     'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
-                    //                     'created': undefined,
-                    //                     'modified': undefined,
-                    //                     'type': 'state',
-                    //                     'userAlias': userAlias,
-                    //                     'info': { title: 'Need to repair!' }
-                    //                 }
-                    //                 this._refresh(doc);
-                    //                 return
-                    //             }
-
-
-                    //             console.log(res);
-                    //             let worldDesc = JSON.parse(res);
-
-                    //             let root = Object.keys(worldDesc)[0];
-                    //             var appInfo = worldDesc[root]['en'];
-
-                    //             let langID = localStorage.getItem('krestianstvo_locale');
-                    //             if (langID) {
-                    //                 appInfo = worldDesc[root][langID]
-                    //             }
-
-                    //             let settings = worldDesc[root]['settings'];
-
-                    //             let doc = {
-                    //                 'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
-                    //                 'created': undefined,
-                    //                 'modified': undefined,
-                    //                 'type': 'saveState',
-                    //                 'userAlias': userAlias,
-                    //                 'info': appInfo,
-                    //                 'settings': settings
-                    //             }
-                    //             this._refresh(doc);
-
-                    //             //callback
-                    //             if (cb)
-                    //                 cb(doc);
-                    //         } else {
-                    //             //no world
-                    //             this._refresh({})
-                    //         }
-                    //     })
-
-                    // }
-
-
+                    }
                 }
             },
             $update: function () {
@@ -1028,26 +786,6 @@ class IndexApp {
 
                 if (desc.type == 'proto') {
                     cardInfo.title = desc.worldName;
-
-                    // userGUI.push(
-
-                    //     {
-                    //         $type: "a",
-                    //         class: "mdc-button mdc-button--compact mdc-card__action",
-                    //         $text: "States",
-                    //         onclick: async function (e) {
-
-                    //             e.preventDefault();
-                    //             window.location.pathname = "/" + desc.userAlias + '/' + desc.worldName +'/about'
-                    //             //console.log('clone');
-
-                    //             // document.querySelector('#worldStatesGUI')._refresh({});
-                    //             // let data = await _app.getSaveStates(desc.userAlias, desc.worldName);
-                    //             // document.querySelector('#worldStatesGUI')._refresh(data);
-
-                    //         }
-                    //     }
-                    // )
                 }
 
 
@@ -1148,22 +886,13 @@ class IndexApp {
 
     }
 
-    createWorldsGUI(worldType, userAlias, userPub, worldName) {
+    createWorldsGUI(worldType, userAlias, userPub) {
 
         let self = this;
 
         let db = _LCSDB.user(userPub);
+        let id = "allWorlds_" + userAlias;
 
-        var headerText = 'Worlds';
-
-        if (worldType == 'state' && !worldName) {
-            headerText = 'All World States for ' + userAlias;
-        } else {
-            headerText = worldName ? 'States for ' + worldName : 'All Worlds Protos'
-        }
-
-        let id = worldName ? worldName + '_' + userAlias : "allWorlds_" + userAlias
-        //let headerText = worldName ? 'States for ' + worldName : 'All Worlds Protos'
 
         let worldCards = {
             $cell: true,
@@ -1171,10 +900,6 @@ class IndexApp {
             $type: "div",
             $components: [],
             _cards: [],
-            // _states: {},
-            // _refresh: function (data) {
-            //     this._states = data;
-            // },
             $init: function () {
 
                 console.log('init lab...');
@@ -1182,7 +907,7 @@ class IndexApp {
                     db.get('worlds')
                         .map()
                         .on((res, k) => {
-                            console.log('From world: ', k);
+                            //console.log('From world: ', k);
                             //let doc = document.querySelector('#'+ k);
                             if (res) {
 
@@ -1197,90 +922,7 @@ class IndexApp {
 
 
                         })
-                } 
-                // else if (worldType == 'state') {
-                //     //get states
-
-                //     if (!worldName) {
-                //         console.log('get states');
-                //         db.get('documents')
-                //             .map()
-                //             .on((res, k) => {
-                //                 if (k !== 'id') {
-                //                     console.log('From world: ', k);
-
-                //                     let worldStatesInfo = Object.entries(res).filter(el => el[0].includes('_info_vwf_json'));
-                //                     worldStatesInfo.map(el => {
-
-                //                         let saveName = el[0].split('/')[2].replace('_info_vwf_json', "");
-
-                //                         let stateEntry = 'savestate_/' + k + '/' + saveName + '_vwf_json';
-                //                         if (res[stateEntry]) {
-
-                //                             let cardID = userAlias + '_' + saveName + '_' + k;
-                //                             console.log(cardID, ' - ', el);
-
-                //                             let doc = this._cards.filter(el => el.$components[0].id == 'worldCard_' + cardID)[0];
-
-                //                             if (!doc) {
-                //                                 doc = this._makeWorldCard({ protoName: k, stateName: saveName }, cardID);
-                //                                 this._cards.push(doc);
-                //                             }
-                //                         }
-
-                //                     })
-                //                     //let saveName = el.stateName.split('/')[2].replace('_info_vwf_json', "");
-
-                //                 }
-
-                //             })
-
-                //     } else {
-
-                //         console.log('get states for ' + worldName);
-                //         db.get('documents')
-                //             .map((res, k) => { if (k == worldName) return res })
-                //             .on((res, k) => {
-                //                 if (k !== 'id') {
-
-                //                     console.log('From world: ', k);
-
-                //                     let worldStatesInfo = Object.entries(res).filter(el => el[0].includes('_info_vwf_json'));
-                //                     worldStatesInfo.map(el => {
-
-
-
-                //                         let saveName = el[0].split('/')[2].replace('_info_vwf_json', "");
-
-                //                         let stateEntry = 'savestate_/' + k + '/' + saveName + '_vwf_json';
-                //                         if (res[stateEntry]) {
-
-                //                             let cardID = userAlias + '_' + saveName + '_' + k;
-                //                             console.log(cardID, ' - ', el);
-
-                //                             let doc = this._cards.filter(el => el.$components[0].id == 'worldCard_' + cardID)[0];
-
-                //                             if (!doc) {
-                //                                 doc = this._makeWorldCard({ protoName: k, stateName: saveName }, cardID);
-                //                                 this._cards.push(doc);
-                //                             }
-
-                //                         }
-
-
-                //                     })
-                //                     //let saveName = el.stateName.split('/')[2].replace('_info_vwf_json', "");
-
-                //                 }
-                //             })
-
-
-                //     }
-
-                // }
-
-
-                //this._refresh();
+                }
             },
             _makeWorldCard: function (worldID, cardID) {
                 //let cardID = userAlias + '_' + worldID//data[1].userAlias + '_' + data[1].worldName + '_' + data[0];
@@ -1293,12 +935,6 @@ class IndexApp {
                 }
             },
             $update: function () {
-                // let cards = Object.entries(this._states)
-                //     .filter(el => Object.keys(el[1]).length !== 0)
-                //     .sort(function (el1, el2) {
-                //         return parseInt(el2[1].created) - parseInt(el1[1].created)
-                //     })
-                //     .map(this._makeWorldCard);
 
                 this.$components = [
                     {
@@ -1327,10 +963,7 @@ class IndexApp {
                                 $components: this._cards
                             }
                         ]
-
                     }
-
-
                 ]
             }
         }

+ 78 - 301
public/web/world-app.js

@@ -23,100 +23,6 @@ class WorldApp {
         el.setAttribute("id", "aboutWorld");
         rootDoc.appendChild(el);
 
-        let el2 = document.createElement("div");
-        el2.setAttribute("id", "worldStates");
-        rootDoc.appendChild(el2);
-
-        document.querySelector("#worldStates").$cell({
-            id: "worldStates",
-            $cell: true,
-            $type: "div",
-            _comps: [],
-            _wcards: {},
-            $components: [],
-            _refresh: function (comps) {
-                //do update;
-                //this._userAlias = user;
-                this._comps = comps;
-                this.$components = this._comps;
-            },
-            $init: function () {
-                console.log('init comp...');
-            },
-
-            $update: function () {
-                //do update;
-                console.log('update me');
-            }
-        });
-
-    }
-
-
-    createWorldStatesGUI() {
-
-        let worldStatesGUI = {
-            id: "worldStatesGUI",
-            $type: "div",
-            $components: [],
-            _states: {},
-            _refresh: function (data) {
-                this._states = data
-            },
-            _makeWorldCard: function (data) {
-                let cardID = data[1].userAlias + '_' + data[1].worldName + '_' + data[0];
-                let card = _app.indexApp.createWorldCard(cardID, 'min');
-                card._refresh(data[1]);
-                card._updateComps();
-                return {
-                    $cell: true,
-                    $type: "div",
-                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-4",
-                    $components: [card]
-                }
-                //console.log(data);
-            },
-            $update: function () { },
-            _updateComps: function () {
-                this.$components = [
-                    {
-                        $type: "div",
-                        class: "mdc-layout-grid",
-                        $components: [
-                            {
-                                $type: "div",
-                                class: "mdc-layout-grid__inner",
-                                $components: [
-                                    {
-                                        $type: "div",
-                                        class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                        $components: [
-                                            {
-                                                $type: "H3",
-                                                $text: 'States'
-                                            }
-                                        ]
-                                    }
-                                ]
-                            },
-                            {
-                                $type: "div",
-                                class: "mdc-layout-grid__inner",
-                                $components: Object.entries(this._states)
-                                    .filter(el => Object.keys(el[1]).length !== 0)
-                                    .sort(function (el1, el2) {
-                                        return parseInt(el2[1].created) - parseInt(el1[1].created)
-                                    })
-                                    .map(this._makeWorldCard)
-                            }
-                        ]
-
-                    }
-                ]
-            }
-        }
-
-        return worldStatesGUI
     }
 
 
@@ -125,24 +31,16 @@ class WorldApp {
         let self = this;
         let user = { 'user': this.userAlias, pub: userPub };
         let space = this.worldName;
-        let saveName = this.saveName;
-
+        let cardID = user.user + '_' + space + '_';
 
-
-        let cardID = user.user + '_' + space + '_' + (saveName ? saveName : "");
-        let cardWorldType = saveName ? 'state' : 'proto';
-
-        let worldNameInfo = saveName ? { protoName: space, stateName: saveName } : space
-
-        let worldCardGUI = _app.indexApp.createWorldCard(cardWorldType, this.userAlias, userPub, worldNameInfo, cardID, "full", setWorldParameters); //createWorldCard(userAlias, userPub, worldName, id, type)
-        let worldStatesGUI = [];
+        let worldCardGUI = _app.indexApp.createWorldCard('proto', this.userAlias, userPub, space, cardID, "full", setWorldParameters); //createWorldCard(userAlias, userPub, worldName, id, type)
 
         //var runWorldGUI = {};
 
 
         function setWorldParameters(data) {
 
-            console.log(data);
+            //console.log(data);
             let actionsGUI = {
                 $cell: true,
                 _gen: "",
@@ -165,9 +63,9 @@ class WorldApp {
                 },
                 $init: function () {
                     //if (_LCSDB.user().is) {
-                        this._refresh();
-                        //}
-                    
+                    this._refresh();
+                    //}
+
                 },
                 $update: function () {
 
@@ -186,129 +84,39 @@ class WorldApp {
                                 {
                                     $type: "div",
                                     id: "tree",
-                                    _tree:[],
+                                    _tree: [],
                                     _treeComp: {},
-                                    $init: function(){
+                                    $init: function () {
                                         let selfComp = this;
-                                        _LCSDB.user().get('worlds').get(desc.worldName).load(res=>{
-                                           // console.log(res);
-                                            if(res){
+                                        _LCSDB.user().get('worlds').get(desc.worldName).load(res => {
+                                            // console.log(res);
+                                            if (res) {
                                                 selfComp._tree = [{
                                                     name: 'File sources: ',
                                                     children: []
                                                 }];
-                                                Object.keys(res).filter(el=>el.includes('_js') || el.includes('_json')).forEach(el=>{
+                                                Object.keys(res).filter(el => el.includes('_js') || el.includes('_json')).forEach(el => {
                                                     selfComp._tree[0].children.push({
                                                         name: el
                                                     })
                                                 })
                                                 selfComp._treeComp = new TreeView(selfComp._tree, 'tree');
-                                                selfComp._treeComp.on('select', function (evt) { 
+                                                selfComp._treeComp.on('select', function (evt) {
                                                     console.log(evt);
                                                     window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/' + evt.data.name
-                                                 });
+                                                });
                                             }
                                         })
-                                        
+
                                     },
-                                    $components:[
+                                    $components: [
 
                                     ]
                                 }
                             );
 
-                            // userGUI.push(
-                            //     {
-                            //         $type: "a",
-                            //         class: "mdc-button ",
-                            //         $text: "Edit info",
-                            //         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                            //         onclick: function (e) {
-                            //             //'/:user/:type/:name/edit/:file'
-                            //             if (desc.type == 'proto') {
-                            //                 window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/info_json'
-                            //             } else if (desc.type == 'saveState') {
-                            //                 let names = desc.worldName.split('/');
-                            //                 let filename = ('savestate_/' + names[0] + '/' + names[2] + '_info_vwf_json').split('/').join("~");
-                            //                 window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
-                            //             }
-                            //             //self.refresh();
-                            //         }
-                            //     },
-                            //     {
-                            //         $type: "a",
-                            //         class: "mdc-button ",
-                            //         $text: "Edit source",
-                            //         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                            //         onclick: function (e) {
-                            //             //'/:user/:type/:name/edit/:file'
-                            //             if (desc.type == 'proto') {
-                            //                 window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
-                            //             } else if (desc.type == 'saveState') {
-                            //                 let names = desc.worldName.split('/');
-                            //                 let filename = ('savestate_/' + names[0] + '/' + names[2] + '_vwf_json').split('/').join("~");
-                            //                 window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
-                            //             }
-                            //             //self.refresh();
-                            //         }
-                            //     }
-
-                            // );
-
                             if (desc.type == 'proto') {
 
-                                // userGUI.push(
-                                //     // {
-                                //     //     $type: "a",
-                                //     //     class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                //     //     $text: "Edit proto",
-                                //     //     //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                //     //     onclick: function (e) {
-                                //     //         window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
-                                //     //     }
-                                //     // },
-
-                                //     {
-                                //         $type: "a",
-                                //         class: "mdc-button ",
-                                //         $text: "Edit config",
-                                //         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                //         onclick: function (e) {
-                                //             window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_config_yaml'
-                                //         }
-                                //     },
-                                //     { $type: "br" },
-                                //     {
-                                //         $type: "a",
-                                //         class: "mdc-button",
-                                //         $text: "Edit appui.js",
-                                //         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                //         onclick: function (e) {
-                                //             window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/appui_js'
-                                //         }
-                                //     },
-
-                                //     {
-                                //         $type: "a",
-                                //         class: "mdc-button",
-                                //         $text: "Edit assets.json",
-                                //         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                //         onclick: function (e) {
-                                //             window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/assets_json'
-                                //         }
-                                //     },
-                                //     {
-                                //         $type: "a",
-                                //         class: "mdc-button",
-                                //         $text: "Edit index.vwf.html",
-                                //         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                //         onclick: function (e) {
-                                //             window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_html'
-                                //         }
-                                //     }
-
-                                // );
-
                                 userGUI.push(
                                     { $type: "br" },
                                     {
@@ -317,10 +125,10 @@ class WorldApp {
                                         $text: "Delete",
                                         //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
                                         onclick: function (e) {
-                                            if (window.confirm("Do you really want to DELETE world?")) { 
+                                            if (window.confirm("Do you really want to DELETE world?")) {
                                                 _app.deleteWorld(desc.worldName, 'proto');
-                                              }
-                                            
+                                            }
+
                                         }
                                     }
                                 );
@@ -375,21 +183,20 @@ class WorldApp {
 
                             }
 
-
-                            if (desc.type == 'saveState') {
-                                userGUI.push(
-                                    { $type: "br" },
-                                    {
-                                        $type: "a",
-                                        class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                        $text: "Delete",
-                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                        onclick: function (e) {
-                                            _app.deleteWorld(desc.worldName, 'state');
-                                        }
-                                    }
-                                );
-                            }
+                            // if (desc.type == 'saveState') {
+                            //     userGUI.push(
+                            //         { $type: "br" },
+                            //         {
+                            //             $type: "a",
+                            //             class: "mdc-button mdc-button--raised mdc-card__action actionButton",
+                            //             $text: "Delete",
+                            //             //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                            //             onclick: function (e) {
+                            //                 _app.deleteWorld(desc.worldName, 'state');
+                            //             }
+                            //         }
+                            //     );
+                            // }
 
 
                         }
@@ -420,31 +227,31 @@ class WorldApp {
                                                 onclick: function (e) {
                                                     //console.log('clone');
                                                     let newProtoName = this._protoNameField.value;
-                                                    _app.cloneWorld (desc.worldName, desc.userAlias, newProtoName);
+                                                    _app.cloneWorld(desc.worldName, desc.userAlias, newProtoName);
 
                                                     let appEl = document.createElement("div");
-                                                        appEl.setAttribute("id", 'cloneLink');
-                                                        let entry = document.querySelector('#worldActionsGUI');
-                                                        if (entry) {
-                                                            entry.appendChild(appEl);
+                                                    appEl.setAttribute("id", 'cloneLink');
+                                                    let entry = document.querySelector('#worldActionsGUI');
+                                                    if (entry) {
+                                                        entry.appendChild(appEl);
 
-                                                            document.querySelector("#cloneLink").$cell({
+                                                        document.querySelector("#cloneLink").$cell({
                                                             id: 'cloneLink',
                                                             $cell: true,
                                                             $type: "div",
                                                             $components: [
                                                                 {
-                                                                $type: "a",
-                                                                class: "mdc-button mdc-button--raised mdc-card__action",
-                                                                $text: "Go to new cloned World!",
-                                                                onclick: function (e) {
-                                                                    let myName = _LCSDB.user().is.alias;
-                                                                    window.location.pathname = '/' + myName + '/' + newProtoName + '/about'
-                                                                }
+                                                                    $type: "a",
+                                                                    class: "mdc-button mdc-button--raised mdc-card__action",
+                                                                    $text: "Go to new cloned World!",
+                                                                    onclick: function (e) {
+                                                                        let myName = _LCSDB.user().is.alias;
+                                                                        window.location.pathname = '/' + myName + '/' + newProtoName + '/about'
+                                                                    }
                                                                 }
                                                             ]
-                                                            })
-                                                        }
+                                                        })
+                                                    }
                                                     // _app.cloneWorldPrototype(desc.worldName, desc.userAlias, newProtoName);
                                                     //self.refresh();
                                                 }
@@ -454,25 +261,9 @@ class WorldApp {
                                 }
                             );
 
-                           
-
-
-                        } else if (desc.type == 'saveState') {
 
 
-                            // userGUI.push(
-                            //     {
-                            //         $type: "a",
-                            //         class: "mdc-button mdc-button--compact mdc-card__action mdc-button--outlined",
-                            //         $text: "Clone",
-                            //         onclick: function (e) {
-                            //             //console.log('clone');
 
-                            //             //self.cloneWorldState(desc[0], desc[2]);
-
-                            //             //self.refresh();
-                            //         }
-                            //     })
                         }
 
                     }
@@ -482,45 +273,45 @@ class WorldApp {
                         {
                             $type: "div",
                             id: "tree_states",
-                            _tree:[],
+                            _tree: [],
                             _treeComp: {},
-                            $init: function(){
+                            $init: function () {
                                 let selfComp = this;
-                                let userPub = new Promise( res=> res(_app.helpers.getUserPub(desc.userAlias)));
-                                userPub.then(pub=>{
-                                    console.log(pub);
+                                let userPub = new Promise(res => res(_app.helpers.getUserPub(desc.userAlias)));
+                                userPub.then(pub => {
+                                    //console.log(pub);
 
-                                    _LCSDB.user(pub).get('documents').get(desc.worldName).load(res=>{
+                                    _LCSDB.user(pub).get('documents').get(desc.worldName).load(res => {
                                         // console.log(res);
-                                         if(res){
-                                             selfComp._tree = [{
-                                                 name: 'States',
-                                                 children: []
-                                             }];
-                                             Object.keys(res).filter(el=>el.includes('savestate_/' + desc.worldName + '/')).forEach(el=>{
-                                                 let genLink = _app.helpers.replaceSubStringALL(el.split('/')[2], '_vwf_json', '');
-                                                 selfComp._tree[0].children.push({
-                                                     name: genLink
-                                                 })
-                                             })
-                                             selfComp._treeComp = new TreeView(selfComp._tree, 'tree_states');
-                                             selfComp._treeComp.on('select', function (evt) { 
-                                                 console.log(evt);
-                                                 window.location.pathname = "/" + desc.userAlias + "/" + desc.worldName + "/load/" + evt.data.name;
-                                                 //window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/' + evt.data.name
-                                              });
-                                         }
-                                     })
+                                        if (res) {
+                                            selfComp._tree = [{
+                                                name: 'States',
+                                                children: []
+                                            }];
+                                            Object.keys(res).filter(el => el.includes('savestate_/' + desc.worldName + '/')).forEach(el => {
+                                                let genLink = _app.helpers.replaceSubStringALL(el.split('/')[2], '_vwf_json', '');
+                                                selfComp._tree[0].children.push({
+                                                    name: genLink
+                                                })
+                                            })
+                                            selfComp._treeComp = new TreeView(selfComp._tree, 'tree_states');
+                                            selfComp._treeComp.on('select', function (evt) {
+                                                console.log(evt);
+                                                window.location.pathname = "/" + desc.userAlias + "/" + desc.worldName + "/load/" + evt.data.name;
+
+                                            });
+                                        }
+                                    })
 
                                 })
-                              
-                                
+
+
                             },
-                            $components:[
+                            $components: [
 
                             ]
                         }
-                        
+
                     );
 
 
@@ -650,13 +441,7 @@ class WorldApp {
                                         $components: [
                                             this._actionsGUI
                                         ]
-                                    },
-                                    // {
-                                    //     $type: "div",
-                                    //     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                    //     $components: [
-                                    //     ].concat(worldStatesGUI)
-                                    // },
+                                    }
                                 ]
                             }
                         ]
@@ -667,14 +452,6 @@ class WorldApp {
 
         document.querySelector("#aboutWorld")._refresh(worldCardGUI);
 
-
-
-        var info = {};
-
-        // if (!saveName) {
-        //     _app.indexApp.allWorldsStatesForUser(user.user, space, 'worldStates')
-        // }
-
     }
 }
 

Некоторые файлы не были показаны из-за большого количества измененных файлов