{"version":3,"sources":["https://lively-kernel.org/lively4/swt21-debugging/src/components/tools/plugin-selector.js"],"names":["FileIndex","Morph","dataUrl","PluginSelector","initialize","windowTitle","registerButtons","lively","html","registerKeys","_pluginExplorer","listData","fetchListData","displayListItems","selectedItems","restoreSelection","workspace","pluginExplorer","value","pluginListElement","get","selectedPluginsElement","activateListElement","browseListElement","editListElement","fileNameToName","string","split","last","listElementTo","list","nodes","Array","from","childNodes","slice","indexOf","map","url","pluginSelection","button","className","updatedSelection","innerHTML","urls","x","i","length","info","upButton","downButton","input","appendChild","addEventListener","e","tmp","savePluginSelection","ctrlKey","key","data","appendEntriesFor","toggleButtonClass","toggleButton","browseButton","editButton","itemIndex","findIndex","obj","target","splice","push","openBrowser","lively4url","openEditable","dataList","entry","_","files","chooseFiles","replace","sort","saveListData","fullUrl","urlString","paths","normalizePath","loadFile","URL","response","fetch","text","error","saveFile","contents","method","body","JSON","stringify","undefined","parse","livelyPrepareSave","livelyPreMigrate","livelyMigrate","other"],"mappings":";;;;;;;;;;;;;;;;AAAOA,qB;;AACAC,iB;;;;;;;;;;;AADAD,8D;;;;;;;;;;;;;AACAC,0D;;;;;;;;;AAEP,kBAAMC,UAAU,iDAAhB;;;;;;;;AAAMA,4D;;;;;;;AAES,kBAAMC,cAAN,SAA6BF,KAA7B,CAAmC;AAC9C,sBAAMG,UAAN,GAAmB;AACf,yBAAKC,WAAL,GAAmB,gBAAnB;AACA,yBAAKC,eAAL;;AAEAC,2BAAOC,IAAP,CAAYC,YAAZ,CAAyB,IAAzB,EAJe,CAIiB;;AAEhC;AACA,yBAAKC,eAAL,GAAuB,KAAKA,eAAL,IAAwB,IAA/C;;AAEA,yBAAKC,QAAL,GAAgB,MAAM,KAAKC,aAAL,EAAtB;AACA,yBAAKC,gBAAL,CAAsB,KAAKF,QAA3B;;AAEA,yBAAKG,aAAL,GAAqB,EAArB;AACA,yBAAKC,gBAAL;AACH;;AAED,oBAAIC,SAAJ,GAAgB;AACZ,2BAAO,KAA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KG,KAAL,CAAWrE,IAAX,CAAP;AACH;;AAGD;AACA;;AAEA;AACAsE,oCAAoB,CAEnB;;AAEDC,mCAAmB;AACf;AACH;;AAEDC,8BAAcC,KAAd,EAAqB;AACjB;AACA;AACA,yBAAK7F,eAAL,GAAuB6F,MAAM7F,eAA7B;AAEH;;AAvQ6C;;+BAA7BP,c;;;;;;;;uCAAAA,+C","file":"plugin-selector.js","sourcesContent":["import FileIndex from \"src/client/fileindex.js\";\nimport Morph from 'src/components/widgets/lively-morph.js';\n\nconst dataUrl = '/src/components/tools/plugin-selector-list.json';\n\nexport default class PluginSelector extends Morph {\n    async initialize() {\n        this.windowTitle = \"PluginSelector\";\n        this.registerButtons()\n\n        lively.html.registerKeys(this); // automatically installs handler for some methods\n\n        // when created by the plugin explorer it will set this property or we already know it after migration\n        this._pluginExplorer = this._pluginExplorer || null;\n\n        this.listData = await this.fetchListData();\n        this.displayListItems(this.listData);\n\n        this.selectedItems = [];\n        this.restoreSelection();\n    }\n    \n    get workspace() {\n        return this.pluginExplorer ? this.pluginExplorer.workspace : null;\n    }\n\n    get pluginExplorer() {\n        return this._pluginExplorer;\n    }\n\n    /*MD ## UI access MD*/\n\n    set pluginExplorer(value) {\n        this._pluginExplorer = value;\n        this.restoreSelection();\n    }\n\n    get pluginListElement() {\n        return this.get('#pluginList');\n    }\n    \n    get selectedPluginsElement() {\n        return this.get('#selectedPlugins');\n    }\n    \n    get activateListElement() {\n        return this.get('#activate');\n    }\n    \n    get browseListElement() {\n        return this.get('#browse');\n    }\n    \n    get editListElement() {\n        return this.get('#edit');\n    }\n    \n    /*MD ## Utility MD*/\n\n    fileNameToName(string) {\n        return string.split('/').last;\n    }\n\n    listElementTo(string, list) {\n        // last element is the addElement button => ignore it\n        const nodes = Array.from(this.activateListElement.childNodes).slice(0, -1)\n        return nodes[list.indexOf(string)];\n    }\n    \n    \n    /*MD ## UI interaction MD*/\n\n    restoreSelection() {\n        if (!this.listData || !this.workspace) {\n            return;\n        }\n        const list = this.listData.map(url => this.fileNameToName(url));\n        this.selectedItems = this.workspace.pluginSelection;\n        for (const { url } of (this.selectedItems || [])) {\n            const button = this.listElementTo(this.fileNameToName(url), list);\n            button.className += ' on';\n        }\n        \n        this.updatedSelection();\n    }\n    \n    updatedSelection() {\n        this.selectedPluginsElement.innerHTML = `\n          <div id=\"activePlugins\" class=\"container\"></div>\n          <div id=\"ups\" class=\"container\"></div>\n          <div id=\"downs\" class=\"container\"></div>\n          <div id=\"inputs\" class=\"container\"></div>\n`;\n        \n        const urls = this.selectedItems.map(x => x.url)\n        \n        for(let i = 0; i < urls.length; i++) {\n            const info = <button style=\"background: #fff; border: 1px solid black; cursor: default; outline: none\">{this.fileNameToName(urls[i])}</button>;\n            const upButton = <button disabled={i === 0 ? true : false}><i class=\"fa fa-chevron-up\"></i></button>;\n            const downButton = <button disabled={i === urls.length-1 ? true : false}><i class=\"fa fa-chevron-down\"></i></button>;\n            const input = <input style=\"margin: 5px\" class=\"unmodified\"></input>\n            this.get('#activePlugins').appendChild(info);\n            this.get('#ups').appendChild(upButton);\n            this.get('#downs').appendChild(downButton);\n            this.get('#inputs').appendChild(input);\n            \n            upButton.addEventListener('click', e => {\n                if(i === 0) { return; }\n                \n                const tmp = this.selectedItems[i-1];\n                this.selectedItems[i-1] = this.selectedItems[i];\n                this.selectedItems[i] = tmp;\n                this.pluginExplorer.savePluginSelection(this.selectedItems);\n                this.updatedSelection();\n            });\n            \n            downButton.addEventListener('click', e => {\n                if(i === urls.length-1) { return; }\n                \n                const tmp = this.selectedItems[i+1];\n                this.selectedItems[i+1] = this.selectedItems[i];\n                this.selectedItems[i] = tmp;\n                this.pluginExplorer.savePluginSelection(this.selectedItems);\n                this.updatedSelection();\n            });\n            \n            input.addEventListener('keydown', e => {\n                input.className = 'modified';\n                \n                if(e.ctrlKey && e.key === 's') {\n                    input.className = 'unmodified';\n                    if(input.value !== '') {\n                        this.selectedItems[i].data = input.value;\n                    } else {\n                        delete this.selectedItems[i].data;\n                    }\n                    \n                    this.pluginExplorer.savePluginSelection(this.selectedItems);\n                }\n            })\n        }\n    }\n\n    appendEntriesFor(url) {\n        const toggleButtonClass = 'toggle';\n        const toggleButton = < button class = { toggleButtonClass } title={url}> { this.fileNameToName(url) } < /button>;\n        const browseButton = < button> browse < /button>\n        const editButton = < button> edit < /button>\n\n\n        toggleButton.addEventListener('click', e => {\n            // as objects get serialized and deserialized we cannot use includes\n            const itemIndex = this.selectedItems.findIndex(obj => obj.url === url);\n            if (itemIndex !== -1) {\n                e.target.className = toggleButtonClass;\n                this.selectedItems.splice(itemIndex, 1);\n            } else {\n                e.target.className += ' on';\n                this.selectedItems.push({ url: url });\n            }\n            this.updatedSelection();\n            this.pluginExplorer.savePluginSelection(this.selectedItems);\n\n        });\n\n        browseButton.addEventListener('click', e => {\n            lively.openBrowser(lively4url + '/' + url, true);\n        })\n\n        editButton.addEventListener('click', e => {\n            this.pluginExplorer.openEditable(url);\n        })\n\n        this.activateListElement.appendChild(toggleButton);\n        this.browseListElement.appendChild(browseButton);\n        this.editListElement.appendChild(editButton);\n        \n    }\n\n    displayListItems(dataList) {\n        this.pluginListElement.innerHTML = `\n          <div id=\"activate\" class=\"container\"></div>\n          <div id=\"browse\" class=\"container\"></div>\n          <div id=\"edit\" class=\"container\"></div>\n        `;             \n        \n        for (const url of dataList) {\n            this.appendEntriesFor(url);\n        }\n\n        const entry = <div></div>;\n              \n        entry.appendChild(<button > Add Element </button>);\n\n        entry.addEventListener('click', async (_) => {\n            let urls = await lively.files.chooseFiles(lively4url + \"/\");\n            urls = urls.map(url => url.replace(lively4url + '/', ''));\n            this.listData.push(...urls);\n            this.listData.sort();\n            this.saveListData();\n            this.displayListItems(this.listData);\n        })\n\n        this.activateListElement.appendChild(entry);\n    }\n\n    /*MD # Load and save list-data MD*/\n\n    fullUrl(urlString) {\n        try {\n            return lively.paths.normalizePath(urlString, \"\");\n        } catch (e) {\n            return null;\n        }\n    }\n\n    async loadFile(urlString) {\n        try {\n            const url = new URL(this.fullUrl(urlString));\n            const response = await fetch(url);\n            return response.text();\n        } catch (e) {\n            lively.error(`Failed to load file '${urlString}'`);\n            return null;\n        }\n    }\n                \n    async saveFile(urlString, contents) {\n        try {\n            const url = new URL(this.fullUrl(urlString));\n            await fetch(url, {\n                method: 'PUT',\n                body: contents,\n            });\n        } catch (e) {\n            lively.error(`Failed to save file '${urlString}'`);\n        }\n    }            \n\n    async saveListData() {\n        const contents = JSON.stringify(this.listData, undefined , 2);\n        this.saveFile(dataUrl, contents);\n    }\n\n    async fetchListData() {\n        const list = await this.loadFile(dataUrl);\n\n        return JSON.parse(list);\n    }\n\n\n    /*MD # Lively Support MD*/\n    /* Lively-specific API */\n\n    // store something that would be lost\n    livelyPrepareSave() {\n\n    }\n\n    livelyPreMigrate() {\n        // is called on the old object before the migration\n    }\n\n    livelyMigrate(other) {\n        // whenever a component is replaced with a newer version during development\n        // this method is called on the new object during migration, but before initialization\n        this._pluginExplorer = other._pluginExplorer;\n\n    }\n\n}\n"]}