diff --git a/front/package-lock.json b/front/package-lock.json index 40c8a7d..19ea106 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -15,6 +15,7 @@ "css-loader": "^6.7.2", "less": "^4.1.3", "less-loader": "^11.1.0", + "mini-css-extract-plugin": "^2.7.6", "style-loader": "^3.3.1", "webpack": "^5.88.2", "webpack-cli": "^5.1.4", @@ -6351,6 +6352,78 @@ "node": ">=6" } }, + "node_modules/mini-css-extract-plugin": { + "version": "2.7.6", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.7.6.tgz", + "integrity": "sha512-Qk7HcgaPkGG6eD77mLvZS1nmxlao3j+9PkrT9Uc7HAE1id3F41+DdBRYRYkbyfNRGzm8/YWtzhw7nVPmwhqTQw==", + "dev": true, + "dependencies": { + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", diff --git a/front/package.json b/front/package.json index 92101fe..14f028a 100644 --- a/front/package.json +++ b/front/package.json @@ -7,6 +7,7 @@ "css-loader": "^6.7.2", "less": "^4.1.3", "less-loader": "^11.1.0", + "mini-css-extract-plugin": "^2.7.6", "style-loader": "^3.3.1", "webpack": "^5.88.2", "webpack-cli": "^5.1.4", diff --git a/front/src/apps/finder/finder-window.js b/front/src/apps/finder/finder-window.js new file mode 100644 index 0000000..603de97 --- /dev/null +++ b/front/src/apps/finder/finder-window.js @@ -0,0 +1,281 @@ + +export default class FinderWindow{ + curPath = "" + fileView = undefined + windowElem = undefined + + async Init(args, appContext){ + if (args[1] == "--desktop"){ + let desktopNode = document.body.querySelector(`#${args[2]}`) + if (desktopNode == null){ + WebDesktopEnvironment.Alert("Desktop node not found") + return + } + + const params = new URLSearchParams({ + path: args[0] + }) + const response = await fetch(`/app/${Finder.AppId}/renderDesktop?` + params, + { + method: "POST", + body: JSON.stringify(appContext) + }) + if (response.status != 200){ + console.log(response.status) + WebDesktopEnvironment.Alert("Error in render desktop") //TODO + return + } + const html = await response.text() + desktopNode.innerHTML = html + + this.fileView = new FileView( + desktopNode.querySelector(".FileTileView"), (event) =>{this.Click(event)}, + (event) => { this.RightClick(event) }, + (event, draggedElem) => { this.DropEvent(event, draggedElem)}, + () => { this.ReRenderDir() } + ) + this.RenderDir(args[0]) + return + } + const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile}) + const response = await fetch(`/app/${Finder.AppId}/render?` + params, + { + method: "POST", + body: JSON.stringify(appContext) + }) + if (response.status != 200){ + const error = await response.json() + WebDesktopEnvironment.Alert(error.message) + return + } + const html = await response.text() + + let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.AppId, 500, 350 ) + newWindow.innerHTML = html + + this.fileView = new FileView( + newWindow.querySelector(".FileTileView"), + (event) => { this.Click(event) }, + (event) => { this.RightClick(event) }, + (event, draggedElem) => { this.DropEvent(event, draggedElem)}, + () => { this.ReRenderDir() } + ) + + newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { + + WebDesktopEnvironment.CloseWindow(newWindow) + + }) + + newWindow.querySelector("#RootButton").addEventListener('click', () =>{ + this.RenderDir('/') + }) + + newWindow.querySelector("#HomeButton").addEventListener('click', () =>{ + this.RenderDir('/home/user') + }) + + let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".FileTileView")) + + this.windowElem = newWindow + this.RenderDir(args[0]) + } + + /** + * @param {string} path + */ + RenderDir(path){ + this.curPath = path + this.fileView.OpenFolder(path) + } + + ReRenderDir(){ + this.RenderDir(this.curPath) + } + + /** + * @param {DragEvent} event + * @param {HTMLElement} draggedElem + */ + async DropEvent(event){ + // console.log(event.dataTransfer.getData("dropType")) + if (event.dataTransfer.getData("dropType") == "move"){ + const sourcePath= event.dataTransfer.getData("filePath") + const targetPath = this.curPath + "/" + event.dataTransfer.getData("fileName") + const res = await WebFS.MoveFile(sourcePath, targetPath) + if (res){ + this.ReRenderDir() + } else { + WebDesktopEnvironment.Alert("UWAGA TODO MOVE FILE ERROR") //TODO + } + } else { + console.log(event, this.curPath) + let files = event.dataTransfer.files + for (let i = 0; i < files.length; i++) { + const file = files[i]; + console.log("file:" + file.name) + + const res = await WebFS.UploadFile(file, this.curPath) + if (res){ + this.ReRenderDir() + } + } + return + const params = new URLSearchParams({ + parentPath: this.curPath, + }) + const response = await fetch('/fs/upload/?' + params, + { + method: "POST", //TODO Change to PUT? + body: formData + }) + if (response.status != 200){ + WebDesktopEnvironment.Alert("ERROR IN UPLOADING FILE")//TODO + } else { + this.ReRenderDir() + } + + } + } + + /** + * @param {MouseEvent} event + */ + Click(event){ + this.OpenFile(this.curPath, event.target.getAttribute("name"), event.target.getAttribute("filetype")) + } + + /** + * @param {string} filePath + */ + async OpenFile(parentPath, fileName, fileType){ + // console.log(parentPath, fileName, fileType) + // const splittedPath = filePath.split("/") + // const fileName = splittedPath[splittedPath.length - 1] + const fileExtension = fileName.split(".")[fileName.split(".").length - 1] //FIXME + + switch (true) { + case fileType == "objectlink": + WebDesktopEnvironment.Alert("Links not supported yet") + break + case fileType == "pathlink": + let res = await WebFS.ReadPathLink(`${parentPath}/${fileName}`) + console.log(res) + this.OpenFile(res.parentPath, res.name, res.filetype) + break + case fileExtension == "app": + WebDesktopEnvironment.Open(`${parentPath}/${fileName}`, []) + break + case fileExtension == "blog": + WebDesktopEnvironment.Open(`/Applications/BlogViewer.app`, [`${parentPath}/${fileName}`]) + break + case fileType == "directory": + WebDesktopEnvironment.Open(`/Applications/Finder.app`, [`${parentPath}/${fileName}`]) + break + case fileExtension == "blog": + WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${parentPath}/${fileName}`]) + break + case fileExtension == "jpeg" | fileExtension == "png": + WebDesktopEnvironment.Open("img-viewer", [`${parentPath}/${fileName}`]) + break; + default: + WebDesktopEnvironment.Alert("Unsupported file type") + break; + } + } + + /** + * @param {MouseEvent} event + */ + RightClick(event){ + this.CreateContextMenu(event.target, [event.clientY, event.clientX]) + } + + /** + * @param {HTMLElement} target + * @param {string[]} pos + */ + async CreateContextMenu(target, pos){ + let context = "" + const fileName = target.getAttribute("name") //TODO check for null + const fileType = target.getAttribute("fileType") + if (target.classList.contains("FileTileView")) + { + context = "FileTileView" + } else { + context = fileType + } + let path = "" + if (fileName === null){ + path = this.curPath + } else { + path = `${this.curPath}/${fileName}` + } + const params = new URLSearchParams({context: context, path: path}) + const response = await fetch(`/app/${Finder.AppId}/contextMenu?` + params) + if (response.status != 200){ + WebDesktopEnvironment.Alert("ERROR in Context menu TODO"); //TODO + return + } + const html = await response.text() + let overlay = document.createElement("div") //TODO Move to WDE.CreateOverlay() + overlay.setAttribute('id', 'finder-context-menu-overlay') + overlay.style.position = 'absolute' + overlay.style.width = "100%" + overlay.style.height = "100%" + + let menu = document.createElement("div") + menu.setAttribute('class', 'ContextMenu WindowFrameShadow') + menu.style.position = 'absolute'; + menu.style.top = pos[0] + "px"; + menu.style.left = pos[1] + "px"; + + menu.innerHTML = html + // menu.children[0].firstElementChild.remove() + menu.children[0].lastElementChild.remove() //FIXME Can't ommit rendering of horLine in end of menu on backend + + overlay.appendChild(menu) + document.body.appendChild(overlay) + + overlay.addEventListener('click', async (event) => { + if (event.target.classList.contains("Row")){ //TODO add uuid id to rows to more accurate checks?? + let res = false + switch (event.target.children[0].getAttribute("action")) { + case "createPathLink": + res = await WebFS.CreatePathLink(`${this.curPath}/${fileName}`, `${this.curPath}/Link to ${fileName}` ) + if (res){ + this.ReRenderDir() + } + break + case "createDir": + res = await WebFS.CreateDirectory(`${this.curPath}`) + console.log(res) + if (res){ + this.ReRenderDir() + } + break + case "deleteFile": + res = await WebFS.DeleteFile(`${this.curPath}/${fileName}`) + console.log(res) + if (res){ + this.ReRenderDir() + } + break + case "getInfo": + Finder.RenderProperites(path) + break + case "openAsDir": + WebDesktopEnvironment.Open(`/Applications/${Finder.AppId}.app`,[`${this.curPath}/${fileName}`]) + break + default: + break; + } + } + overlay.remove() + }) + overlay.addEventListener('contextmenu', (event) => { + event.preventDefault(); + overlay.remove() + }) + } +} \ No newline at end of file diff --git a/front/src/apps/finder/finder.js b/front/src/apps/finder/finder.js new file mode 100644 index 0000000..7ebc9f2 --- /dev/null +++ b/front/src/apps/finder/finder.js @@ -0,0 +1,40 @@ +require("./finder.less") + +import FinderWindow from "./finder-window" + +class Finder{ + static AppId = "Finder" + + /** + * @param {string[]} args + */ + async NewWindow(args, runContext){ + let newFinder = new FinderWindow() + await newFinder.Init(args, runContext) + } + + /** + * @param {string} path + * @returns {boolean} + */ + static async RenderProperites(path){ + if (path == null || path ==""){ + return + } + const params = new URLSearchParams({ + path: path + }) + const response = await fetch(`/app/${Finder.AppId}/renderProps?` + params) + if (response.status != 200){ + WebDesktopEnvironment.Alert("Error in properties render") //TODO + return false + } + const html = await response.text() + let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.AppId, 350, 500 ) + newWindow.innerHTML = html + newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { + WebDesktopEnvironment.CloseWindow(newWindow) + }) + } +} + diff --git a/front/src/apps/finder/finder.less b/front/src/apps/finder/finder.less new file mode 100644 index 0000000..1ef1488 --- /dev/null +++ b/front/src/apps/finder/finder.less @@ -0,0 +1,39 @@ +.FinderContent { + width: 100%; + height: 100%; + + /* Auto layout */ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + padding: 0px; +} + +.FinderContent .ToolBar{ + width: 100%; + height: 20px; + border-bottom: 1px solid #555555; + background-color: #EEEEEE; +} + +.Focused .FinderContent .ToolBar{ + border-bottom: 1px solid #000000; + background-color: #DDDDDD; +} + + + +.FinderContent .FinderFileView{ + width: 100%; + height: 100%; + + background-color: #FFFFFF; + + /* Auto layout */ + display: flex; + flex-direction: row; + justify-content: center; + align-items: flex-start; + padding: 0px; +} \ No newline at end of file diff --git a/front/src/decorat/desktop-decorat.js b/front/src/decorat/desktop-decorat.js index 55e4c66..912d68c 100644 --- a/front/src/decorat/desktop-decorat.js +++ b/front/src/decorat/desktop-decorat.js @@ -1,45 +1,43 @@ export default class DesktopDecorat{ - // static windowsLayer /** @type {Element} */ - static windowLayer + #windowsLayer constructor(){ this.windowLayer = document.body.querySelector('#windows-layer') - DesktopDecorat.windowsLayer = document.body.querySelector('#windows-layer') - if (!WebDesktopEnvironment.isMobile) { - let startDrag = function(event) { - let window = event.target.closest('.WindowFrame') - DesktopDecorat.bringWindowToFront(window) - if (event.target.classList.contains("DragArea")){ - let xPosInit = event.offsetX - let yPosInit = event.offsetY - let dragWindow = function(event){ - window.style.left = `${event.clientX - xPosInit}px` - window.style.top = `${event.clientY - yPosInit}px` - } - let stopDrag = function(){ - removeEventListener('mousemove', dragWindow) - removeEventListener('mouseup', stopDrag) - } - - addEventListener('mousemove', dragWindow) - addEventListener('mouseup', stopDrag) + // this.#windowsLayer = document.body.querySelector('#windows-layer') + this.#windowsLayer = document.body.querySelector('#windows-layer') + let startDrag = function(event) { + let window = event.target.closest('.WindowFrame') + DesktopDecorat.bringWindowToFront(window) + if (event.target.classList.contains("DragArea")){ + let xPosInit = event.offsetX + let yPosInit = event.offsetY + let dragWindow = function(event){ + window.style.left = `${event.clientX - xPosInit}px` + window.style.top = `${event.clientY - yPosInit}px` } + let stopDrag = function(){ + removeEventListener('mousemove', dragWindow) + removeEventListener('mouseup', stopDrag) + } + + addEventListener('mousemove', dragWindow) + addEventListener('mouseup', stopDrag) } - DesktopDecorat.windowsLayer.addEventListener('mousedown', startDrag) } + this.#windowsLayer.addEventListener('mousedown', startDrag) } /** * @param {HTMLElement} window */ static bringWindowToFront(window){ //FIXME - let previousWindow = DesktopDecorat.windowsLayer.lastChild + let previousWindow = this.#windowsLayer.lastChild if (window == null || window == undefined){ return } if (window != previousWindow){ - DesktopDecorat.windowsLayer.insertBefore(window, previousWindow.nextSibling) + this.#windowsLayer.insertBefore(window, previousWindow.nextSibling) previousWindow.classList.remove("Focused") window.classList.add("Focused") } else { diff --git a/front/src/desktop.less b/front/src/desktop.less new file mode 100644 index 0000000..ba34f22 --- /dev/null +++ b/front/src/desktop.less @@ -0,0 +1 @@ +@import "./wde/sunboard/sunboard-desktop.less"; \ No newline at end of file diff --git a/front/src/mobile.less b/front/src/mobile.less index 0151b1e..a702f08 100644 --- a/front/src/mobile.less +++ b/front/src/mobile.less @@ -1,4 +1,19 @@ -// @import "./wde/desktop/mobile-desktop.less" -.body{ - background-color: aqua; -} \ No newline at end of file +@import "./wde/sunboard/sunboard-mobile.less"; + +body{ + zoom: var(--zoom); + position: absolute; + width: 100%; + height: 100%; + margin: 0px; + + /* font: normal 14px Summer Pixel 22, "res/SummerPixel22Regular.ttf"; */ + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Old versions of Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Non-prefixed version, currently + supported by Chrome, Edge, Opera and Firefox */ + touch-action: manipulation; +} diff --git a/front/src/theme.less b/front/src/theme.less new file mode 100644 index 0000000..f598188 --- /dev/null +++ b/front/src/theme.less @@ -0,0 +1,2 @@ +@col-ceil: #9999CC; +@col-argent: #C0C0C0; \ No newline at end of file diff --git a/front/src/wde/desktop/desktop.js b/front/src/wde/desktop/desktop.js deleted file mode 100644 index e69de29..0000000 diff --git a/front/src/wde/desktop/mobile-desktop.js b/front/src/wde/desktop/mobile-desktop.js deleted file mode 100644 index 9ab8338..0000000 --- a/front/src/wde/desktop/mobile-desktop.js +++ /dev/null @@ -1,3 +0,0 @@ -export default class MobileDesktop{ - -} \ No newline at end of file diff --git a/front/src/wde/desktop/mobile-desktop.less b/front/src/wde/desktop/mobile-desktop.less deleted file mode 100644 index e9fc8c2..0000000 --- a/front/src/wde/desktop/mobile-desktop.less +++ /dev/null @@ -1,3 +0,0 @@ -.test{ - background-color: aqua; -} \ No newline at end of file diff --git a/front/src/wde/primitives.less b/front/src/wde/primitives.less new file mode 100644 index 0000000..e4901ed --- /dev/null +++ b/front/src/wde/primitives.less @@ -0,0 +1,3 @@ +.WdePrimitives.AdjectiveElement { + border: 1px solid #555555; +} \ No newline at end of file diff --git a/front/src/wde/sunboard/sunboard-mobile.js b/front/src/wde/sunboard/sunboard-mobile.js new file mode 100644 index 0000000..18a34e0 --- /dev/null +++ b/front/src/wde/sunboard/sunboard-mobile.js @@ -0,0 +1,7 @@ +export default class MobileDesktop{ + /**@type {Element} */ + #icons + constructor(){ + this.#icons = document.body.querySelector("") + } +} \ No newline at end of file diff --git a/front/src/wde/sunboard/sunboard-mobile.less b/front/src/wde/sunboard/sunboard-mobile.less new file mode 100644 index 0000000..c6ca4ff --- /dev/null +++ b/front/src/wde/sunboard/sunboard-mobile.less @@ -0,0 +1,27 @@ +@import "../../theme.less"; +@import "../primitives.less"; + +#mobile-sunboard{ + width: 100%; + height: 100%; + + /* Auto layout */ + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; +} + +#icons{ + width: 100%; + height: 100%; + background-color: @col-ceil; +} + +#down-bar{ + &:extend(.WdePrimitives.AdjectiveElement); + width: 100%; + height: 150px; + background-color: @col-argent; +} + diff --git a/front/src/wde/wde-desktop.js b/front/src/wde/wde-desktop.js index 485e723..72c9344 100644 --- a/front/src/wde/wde-desktop.js +++ b/front/src/wde/wde-desktop.js @@ -1,7 +1,9 @@ import DesktopDecorat from "../decorat/desktop-decorat"; import WdeScrollBar from "./scrollbar/scrollbar"; import WebFS from "../web-fs/web-fs"; +// import DesktopSunBoard from "./sunboard/sunboard-desktop"; export default class WebDesktopEnvironment{ + /**@type {DesktopDecorat} */ #decorat static Applications = {}; static isMobile = false @@ -13,6 +15,11 @@ export default class WebDesktopEnvironment{ WebDesktopEnvironment.webFs = new WebFS() // this.loadWDE() + this.#devLoadSunboard() + } + + async #devLoadSunboard(){ + // let sunBoard = new DesktopSunBoard() } async loadWDE(){ @@ -39,17 +46,7 @@ export default class WebDesktopEnvironment{ // console.log(appPath, args) await WebDesktopEnvironment.Open(appPath, args) } - autoStart.remove() - - // await WebDesktopEnvironment.load2('/Applications/Finder.app', [ "desktop", document.querySelector('#desktop-layer')]) //FIXME - // await WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user/.desktop", "-desktop", document.querySelector('#desktop-layer')]) - // await WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user/Blogs",]) - // await WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home/user",]) - // await WebDesktopEnvironment.Open('/Applications/Finder.app', ["/home",]) - // WebDesktopEnvironment.Open('/Applications/AboutMe.app', []) - // WebDesktopEnvironment.Open('/Applications/FinderAdmin.app', ["/home/user",]) - // await WebDesktopEnvironment.Open('/Applications/BlogViewer.app', ["/home/user/Blogs/blog1.blog",]) } /** @@ -205,13 +202,6 @@ export default class WebDesktopEnvironment{ document.body.querySelector('#windows-layer').appendChild(newWindow) } - - static CheckMobile(){ - var check = false; - (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); - return check; - } - /** * @param {num} length diff --git a/front/webpack.config.js b/front/webpack.config.js index 8fec333..b5cfeea 100644 --- a/front/webpack.config.js +++ b/front/webpack.config.js @@ -7,7 +7,7 @@ const isProduction = process.env.NODE_ENV == 'production'; const stylesHandler = 'style-loader'; - +const MiniCssExtractPlugin = require("mini-css-extract-plugin") const config = { // entry: [ './src/wde-mobile.js'], @@ -15,6 +15,7 @@ const config = { init: './src/init.js', mobile: './src/mobile.js', desktop: './src/desktop.js', + finder: './src/apps/finder/finder.js' }, output: { // path: path.resolve(__dirname, 'dist'), @@ -25,10 +26,7 @@ const config = { open: true, host: 'localhost', }, - plugins: [ - // Add your plugins here - // Learn more about plugins from https://webpack.js.org/configuration/plugins/ - ], + plugins: [new MiniCssExtractPlugin()], module: { rules: [ { @@ -41,7 +39,8 @@ const config = { }, { test: /\.less$/i, - use: [stylesHandler, 'css-loader', 'less-loader'], + // use: [stylesHandler, 'css-loader', 'less-loader'], + use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'], }, { test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i, diff --git a/res/dev-fs/wde/dist/desktop.js b/res/dev-fs/wde/dist/desktop.js index ac853ac..1d7367d 100644 --- a/res/dev-fs/wde/dist/desktop.js +++ b/res/dev-fs/wde/dist/desktop.js @@ -16,7 +16,7 @@ \****************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar DesktopDecorat = /*#__PURE__*/function () {\n // static windowsLayer\n /** @type {Element} */\n\n function DesktopDecorat() {\n _classCallCheck(this, DesktopDecorat);\n this.windowLayer = document.body.querySelector('#windows-layer');\n DesktopDecorat.windowsLayer = document.body.querySelector('#windows-layer');\n if (!WebDesktopEnvironment.isMobile) {\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n DesktopDecorat.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n DesktopDecorat.windowsLayer.addEventListener('mousedown', startDrag);\n }\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, null, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = DesktopDecorat.windowsLayer.lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n DesktopDecorat.windowsLayer.insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n }, {\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n }]);\n return DesktopDecorat;\n}();\n_defineProperty(DesktopDecorat, \"windowLayer\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/decorat/desktop-decorat.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ DesktopDecorat)\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\nvar _windowsLayer = /*#__PURE__*/new WeakMap();\nvar DesktopDecorat = /*#__PURE__*/function () {\n /** @type {Element} */\n\n function DesktopDecorat() {\n _classCallCheck(this, DesktopDecorat);\n _classPrivateFieldInitSpec(this, _windowsLayer, {\n writable: true,\n value: void 0\n });\n this.windowLayer = document.body.querySelector('#windows-layer');\n // this.#windowsLayer = document.body.querySelector('#windows-layer')\n _classPrivateFieldSet(this, _windowsLayer, document.body.querySelector('#windows-layer'));\n var startDrag = function startDrag(event) {\n var window = event.target.closest('.WindowFrame');\n DesktopDecorat.bringWindowToFront(window);\n if (event.target.classList.contains(\"DragArea\")) {\n var xPosInit = event.offsetX;\n var yPosInit = event.offsetY;\n var dragWindow = function dragWindow(event) {\n window.style.left = \"\".concat(event.clientX - xPosInit, \"px\");\n window.style.top = \"\".concat(event.clientY - yPosInit, \"px\");\n };\n var stopDrag = function stopDrag() {\n removeEventListener('mousemove', dragWindow);\n removeEventListener('mouseup', stopDrag);\n };\n addEventListener('mousemove', dragWindow);\n addEventListener('mouseup', stopDrag);\n }\n };\n _classPrivateFieldGet(this, _windowsLayer).addEventListener('mousedown', startDrag);\n }\n\n /**\r\n * @param {HTMLElement} window\r\n */\n _createClass(DesktopDecorat, null, [{\n key: \"bringWindowToFront\",\n value: function bringWindowToFront(window) {\n //FIXME\n var previousWindow = _classPrivateFieldGet(this, _windowsLayer).lastChild;\n if (window == null || window == undefined) {\n return;\n }\n if (window != previousWindow) {\n _classPrivateFieldGet(this, _windowsLayer).insertBefore(window, previousWindow.nextSibling);\n previousWindow.classList.remove(\"Focused\");\n window.classList.add(\"Focused\");\n } else {\n window.classList.add(\"Focused\");\n }\n return;\n }\n }, {\n key: \"ChangeURL\",\n value: function ChangeURL(appWindow) {\n var appId = appWindow.getAttribute('appid');\n window.history.replaceState(null, \"\", \"/\".concat(appId, \"/\"));\n }\n }]);\n return DesktopDecorat;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/decorat/desktop-decorat.js?"); /***/ }), @@ -46,7 +46,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../decorat/desktop-decorat */ \"./src/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs */ \"./src/web-fs/web-fs.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\n\n\nvar _decorat = /*#__PURE__*/new WeakMap();\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _classPrivateFieldInitSpec(this, _decorat, {\n writable: true,\n value: void 0\n });\n document.body.style.setProperty('--zoom', 1);\n _classPrivateFieldSet(this, _decorat, new _decorat_desktop_decorat__WEBPACK_IMPORTED_MODULE_0__[\"default\"]());\n WebDesktopEnvironment.webFs = new _web_fs_web_fs__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n // this.loadWDE()\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return WebDesktopEnvironment.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n\n // await WebDesktopEnvironment.load2('/Applications/Finder.app', [ \"desktop\", document.querySelector('#desktop-layer')]) //FIXME\n // await WebDesktopEnvironment.Open('/Applications/Finder.app', [\"/home/user/.desktop\", \"-desktop\", document.querySelector('#desktop-layer')])\n // await WebDesktopEnvironment.Open('/Applications/Finder.app', [\"/home/user/Blogs\",])\n // await WebDesktopEnvironment.Open('/Applications/Finder.app', [\"/home/user\",])\n // await WebDesktopEnvironment.Open('/Applications/Finder.app', [\"/home\",])\n // WebDesktopEnvironment.Open('/Applications/AboutMe.app', [])\n // WebDesktopEnvironment.Open('/Applications/FinderAdmin.app', [\"/home/user\",])\n // await WebDesktopEnvironment.Open('/Applications/BlogViewer.app', [\"/home/user/Blogs/blog1.blog\",])\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }], [{\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n runContext = {\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath //TODO\n };\n\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }, {\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n var appElem, script;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n appElem = document.createElement(\"div\");\n appElem.setAttribute(\"appId\", appManifest.appId);\n //TODO Render scripts nodes on server\n //FIXME Not support more than one js now :)\n script = document.createElement(\"script\");\n script.setAttribute(\"src\", appManifest.js[0]); //FIXME path by fs read\n script.setAttribute(\"async\", \"false\"); //TODO Possible may creates a problems??\n appElem.appendChild(script);\n document.getElementById(\"applications\").appendChild(appElem);\n script.addEventListener('load', function (event) {\n var newApp = eval(\"new \".concat(appManifest.appId, \"()\"));\n //TODO Check if newApp undefined\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 9:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n if (WebDesktopEnvironment.isMobile) {\n newWindow.setAttribute(\"class\", \"MobileApplicationWindow\");\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n } else {\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", WebDesktopEnvironment.makeid(4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n }\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n }, {\n key: \"CheckMobile\",\n value: function CheckMobile() {\n var check = false;\n (function (a) {\n if (/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0, 4))) check = true;\n })(navigator.userAgent || navigator.vendor || window.opera);\n return check;\n }\n\n /**\r\n * @param {num} length\r\n */\n }, {\n key: \"makeid\",\n value: function makeid(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n }\n }]);\n return WebDesktopEnvironment;\n}();\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WebDesktopEnvironment)\n/* harmony export */ });\n/* harmony import */ var _decorat_desktop_decorat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../decorat/desktop-decorat */ \"./src/decorat/desktop-decorat.js\");\n/* harmony import */ var _scrollbar_scrollbar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrollbar/scrollbar */ \"./src/wde/scrollbar/scrollbar.js\");\n/* harmony import */ var _web_fs_web_fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../web-fs/web-fs */ \"./src/web-fs/web-fs.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\n\n\n// import DesktopSunBoard from \"./sunboard/sunboard-desktop\";\nvar _decorat = /*#__PURE__*/new WeakMap();\nvar _devLoadSunboard = /*#__PURE__*/new WeakSet();\nvar WebDesktopEnvironment = /*#__PURE__*/function () {\n /**@type {DesktopDecorat} */\n\n // static decorat\n\n function WebDesktopEnvironment() {\n _classCallCheck(this, WebDesktopEnvironment);\n _classPrivateMethodInitSpec(this, _devLoadSunboard);\n _classPrivateFieldInitSpec(this, _decorat, {\n writable: true,\n value: void 0\n });\n document.body.style.setProperty('--zoom', 1);\n _classPrivateFieldSet(this, _decorat, new _decorat_desktop_decorat__WEBPACK_IMPORTED_MODULE_0__[\"default\"]());\n WebDesktopEnvironment.webFs = new _web_fs_web_fs__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n // this.loadWDE()\n _classPrivateMethodGet(this, _devLoadSunboard, _devLoadSunboard2).call(this);\n }\n _createClass(WebDesktopEnvironment, [{\n key: \"loadWDE\",\n value: function () {\n var _loadWDE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var autoStart, _iterator, _step, child, appPath, args, argsRaw, _iterator2, _step2, argRaw, arg;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n autoStart = document.body.querySelector(\"wde-autostart\");\n if (!(autoStart == null)) {\n _context.next = 4;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in loading DE\");\n return _context.abrupt(\"return\");\n case 4:\n _iterator = _createForOfIteratorHelper(autoStart.children);\n _context.prev = 5;\n _iterator.s();\n case 7:\n if ((_step = _iterator.n()).done) {\n _context.next = 41;\n break;\n }\n child = _step.value;\n if (!(child.nodeName != \"APP\")) {\n _context.next = 11;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 11:\n appPath = child.getAttribute(\"app-path\");\n if (!(appPath == null)) {\n _context.next = 14;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 14:\n args = [];\n argsRaw = child.querySelector(\"args\");\n if (!(argsRaw == null)) {\n _context.next = 18;\n break;\n }\n return _context.abrupt(\"continue\", 39);\n case 18:\n _iterator2 = _createForOfIteratorHelper(argsRaw.children);\n _context.prev = 19;\n _iterator2.s();\n case 21:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 29;\n break;\n }\n argRaw = _step2.value;\n arg = argRaw.getAttribute(\"string\");\n if (!(arg == null)) {\n _context.next = 26;\n break;\n }\n return _context.abrupt(\"continue\", 27);\n case 26:\n args.push(arg);\n case 27:\n _context.next = 21;\n break;\n case 29:\n _context.next = 34;\n break;\n case 31:\n _context.prev = 31;\n _context.t0 = _context[\"catch\"](19);\n _iterator2.e(_context.t0);\n case 34:\n _context.prev = 34;\n _iterator2.f();\n return _context.finish(34);\n case 37:\n _context.next = 39;\n return WebDesktopEnvironment.Open(appPath, args);\n case 39:\n _context.next = 7;\n break;\n case 41:\n _context.next = 46;\n break;\n case 43:\n _context.prev = 43;\n _context.t1 = _context[\"catch\"](5);\n _iterator.e(_context.t1);\n case 46:\n _context.prev = 46;\n _iterator.f();\n return _context.finish(46);\n case 49:\n autoStart.remove();\n case 50:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[5, 43, 46, 49], [19, 31, 34, 37]]);\n }));\n function loadWDE() {\n return _loadWDE.apply(this, arguments);\n }\n return loadWDE;\n }()\n /**\r\n * @param {string} appPath\r\n * @param {string[]} args\r\n * @param {string} runPath\r\n */\n }], [{\n key: \"Open\",\n value: function () {\n var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appPath, args, runPath) {\n var appManifest, runContext;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return WebDesktopEnvironment.fetchApp(appPath);\n case 2:\n appManifest = _context2.sent;\n if (!(appManifest === undefined)) {\n _context2.next = 5;\n break;\n }\n return _context2.abrupt(\"return\");\n case 5:\n //TODO return err\n runContext = {\n isMobile: false,\n bundlePath: appPath,\n runPath: runPath //TODO\n };\n\n if (WebDesktopEnvironment.Applications[appManifest.appId] === undefined) {\n WebDesktopEnvironment.load2(appManifest, function () {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n });\n } else {\n WebDesktopEnvironment.Applications[appManifest.appId].NewWindow(args, runContext);\n }\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function Open(_x, _x2, _x3) {\n return _Open.apply(this, arguments);\n }\n return Open;\n }()\n /**\r\n * @param {string} appManifest\r\n * @param {function} onload callback after script loading\r\n */\n }, {\n key: \"load2\",\n value: function () {\n var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(appManifest, onload) {\n var appElem, script;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n appElem = document.createElement(\"div\");\n appElem.setAttribute(\"appId\", appManifest.appId);\n //TODO Render scripts nodes on server\n //FIXME Not support more than one js now :)\n script = document.createElement(\"script\");\n script.setAttribute(\"src\", appManifest.js[0]); //FIXME path by fs read\n script.setAttribute(\"async\", \"false\"); //TODO Possible may creates a problems??\n appElem.appendChild(script);\n document.getElementById(\"applications\").appendChild(appElem);\n script.addEventListener('load', function (event) {\n var newApp = eval(\"new \".concat(appManifest.appId, \"()\"));\n //TODO Check if newApp undefined\n WebDesktopEnvironment.Applications[appManifest.appId] = newApp;\n onload();\n });\n return _context3.abrupt(\"return\");\n case 9:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n function load2(_x4, _x5) {\n return _load.apply(this, arguments);\n }\n return load2;\n }()\n /**\r\n * @param {string} path\r\n * @returns {Object | undefined} //FIXME\r\n */\n }, {\n key: \"fetchApp\",\n value: function () {\n var _fetchApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path) {\n var params, response, error, appManifest;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n // console.log(\"path: \" + path )\n params = new URLSearchParams({\n path: path,\n mode: \"json\"\n });\n _context4.next = 3;\n return fetch(\"/system/loadApp?\" + params);\n case 3:\n response = _context4.sent;\n if (!(response.status != 200)) {\n _context4.next = 10;\n break;\n }\n _context4.next = 7;\n return response.json();\n case 7:\n error = _context4.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context4.abrupt(\"return\", undefined);\n case 10:\n //TODO Validate manifest\n appManifest = response.json();\n return _context4.abrupt(\"return\", appManifest);\n case 12:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n function fetchApp(_x6) {\n return _fetchApp.apply(this, arguments);\n }\n return fetchApp;\n }()\n /**\r\n * @param {string} appId\r\n * @param {number} width\r\n * @param {number} height\r\n * @returns {HTMLElement}\r\n */\n }, {\n key: \"CreateNewWindow\",\n value: function CreateNewWindow(appId, width, height) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute('appid', appId);\n if (WebDesktopEnvironment.isMobile) {\n newWindow.setAttribute(\"class\", \"MobileApplicationWindow\");\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n } else {\n newWindow.setAttribute(\"class\", \"WindowFrame ConvexElement\");\n newWindow.setAttribute(\"windowId\", WebDesktopEnvironment.makeid(4)); //TODO:\n\n newWindow.style.width = width.toString() + \"px\";\n newWindow.style.height = height.toString() + \"px\";\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n return newWindow;\n }\n }\n /**\r\n * @param {HTMLElement} window\r\n */\n }, {\n key: \"CloseWindow\",\n value: function CloseWindow(window) {\n window.remove();\n }\n }, {\n key: \"CloseFocusedWindow\",\n value: function CloseFocusedWindow() {\n if (document.body.querySelector('#windows-layer').childElementCount > 1) {\n document.body.querySelector('#windows-layer').lastElementChild.remove();\n }\n }\n\n /**\r\n * @param {string} html\r\n */\n }, {\n key: \"SetBasicWindow\",\n value: function SetBasicWindow(html) {\n this.basicWindow = html;\n }\n\n /**\r\n * @returns {string}\r\n */\n }, {\n key: \"GetBasicWindow\",\n value: function GetBasicWindow() {\n return this.basicWindow;\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"Alert\",\n value: function Alert(alertText) {\n WebDesktopEnvironment.CreateAlertWindow(alertText);\n console.log(alertText);\n }\n\n /**\r\n * @param {string} alertText\r\n */\n }, {\n key: \"CreateAlertWindow\",\n value: function CreateAlertWindow(alertText) {\n var newWindow = document.createElement(\"div\");\n newWindow.setAttribute(\"class\", \"WindowFrameless\");\n newWindow.setAttribute(\"windowId\", \"SuperUniqUUID\"); //TODO:\n newWindow.style.cssText = \"position:absolute;width:450px;height:116px; margin-left: -225px; margin-top:-58px;left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;\";\n var alertImage = document.createElement(\"img\");\n alertImage.setAttribute(\"src\", \"/res/sys/wde/icons/ohno.png\");\n alertImage.style.cssText = \"position:absolute; width:64px;height:64px;top:15px;left:25px\";\n newWindow.appendChild(alertImage);\n var errorText = document.createElement(\"div\");\n errorText.style.cssText = \"position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';\";\n errorText.innerHTML = alertText;\n newWindow.appendChild(errorText);\n var closeButton = document.createElement(\"button\");\n closeButton.style.cssText = \"position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;\";\n closeButton.innerHTML = \"Close\";\n closeButton.addEventListener('click', function () {\n newWindow.remove();\n });\n newWindow.appendChild(closeButton);\n document.body.querySelector('#windows-layer').appendChild(newWindow);\n }\n\n /**\r\n * @param {num} length\r\n */\n }, {\n key: \"makeid\",\n value: function makeid(length) {\n var result = '';\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var charactersLength = characters.length;\n var counter = 0;\n while (counter < length) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n counter += 1;\n }\n return result;\n }\n }]);\n return WebDesktopEnvironment;\n}();\nfunction _devLoadSunboard2() {\n return _devLoadSunboard3.apply(this, arguments);\n}\nfunction _devLoadSunboard3() {\n _devLoadSunboard3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n return _devLoadSunboard3.apply(this, arguments);\n}\n_defineProperty(WebDesktopEnvironment, \"Applications\", {});\n_defineProperty(WebDesktopEnvironment, \"isMobile\", false);\n_defineProperty(WebDesktopEnvironment, \"webFs\", void 0);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/wde/wde-desktop.js?"); /***/ }), diff --git a/res/dev-fs/wde/dist/finder.css b/res/dev-fs/wde/dist/finder.css new file mode 100644 index 0000000..f34475b --- /dev/null +++ b/res/dev-fs/wde/dist/finder.css @@ -0,0 +1,35 @@ +/*!**********************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/apps/finder/finder.less ***! + \**********************************************************************************************************************/ +.FinderContent { + width: 100%; + height: 100%; + /* Auto layout */ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + padding: 0px; +} +.FinderContent .ToolBar { + width: 100%; + height: 20px; + border-bottom: 1px solid #555555; + background-color: #EEEEEE; +} +.Focused .FinderContent .ToolBar { + border-bottom: 1px solid #000000; + background-color: #DDDDDD; +} +.FinderContent .FinderFileView { + width: 100%; + height: 100%; + background-color: #FFFFFF; + /* Auto layout */ + display: flex; + flex-direction: row; + justify-content: center; + align-items: flex-start; + padding: 0px; +} + diff --git a/res/dev-fs/wde/dist/finder.js b/res/dev-fs/wde/dist/finder.js new file mode 100644 index 0000000..06ede21 --- /dev/null +++ b/res/dev-fs/wde/dist/finder.js @@ -0,0 +1,106 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/apps/finder/finder-window.js": +/*!******************************************!*\ + !*** ./src/apps/finder/finder-window.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ FinderWindow)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar FinderWindow = /*#__PURE__*/function () {\n function FinderWindow() {\n _classCallCheck(this, FinderWindow);\n _defineProperty(this, \"curPath\", \"\");\n _defineProperty(this, \"fileView\", undefined);\n _defineProperty(this, \"windowElem\", undefined);\n }\n _createClass(FinderWindow, [{\n key: \"Init\",\n value: function () {\n var _Init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args, appContext) {\n var _this = this;\n var desktopNode, _params, _response, _html, params, response, error, html, newWindow, scrollBar;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(args[1] == \"--desktop\")) {\n _context.next = 20;\n break;\n }\n desktopNode = document.body.querySelector(\"#\".concat(args[2]));\n if (!(desktopNode == null)) {\n _context.next = 5;\n break;\n }\n WebDesktopEnvironment.Alert(\"Desktop node not found\");\n return _context.abrupt(\"return\");\n case 5:\n _params = new URLSearchParams({\n path: args[0]\n });\n _context.next = 8;\n return fetch(\"/app/\".concat(Finder.AppId, \"/renderDesktop?\") + _params, {\n method: \"POST\",\n body: JSON.stringify(appContext)\n });\n case 8:\n _response = _context.sent;\n if (!(_response.status != 200)) {\n _context.next = 13;\n break;\n }\n console.log(_response.status);\n WebDesktopEnvironment.Alert(\"Error in render desktop\"); //TODO\n return _context.abrupt(\"return\");\n case 13:\n _context.next = 15;\n return _response.text();\n case 15:\n _html = _context.sent;\n desktopNode.innerHTML = _html;\n this.fileView = new FileView(desktopNode.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n this.RenderDir(args[0]);\n return _context.abrupt(\"return\");\n case 20:\n params = new URLSearchParams({\n isMobile: WebDesktopEnvironment.isMobile\n });\n _context.next = 23;\n return fetch(\"/app/\".concat(Finder.AppId, \"/render?\") + params, {\n method: \"POST\",\n body: JSON.stringify(appContext)\n });\n case 23:\n response = _context.sent;\n if (!(response.status != 200)) {\n _context.next = 30;\n break;\n }\n _context.next = 27;\n return response.json();\n case 27:\n error = _context.sent;\n WebDesktopEnvironment.Alert(error.message);\n return _context.abrupt(\"return\");\n case 30:\n _context.next = 32;\n return response.text();\n case 32:\n html = _context.sent;\n newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.AppId, 500, 350);\n newWindow.innerHTML = html;\n this.fileView = new FileView(newWindow.querySelector(\".FileTileView\"), function (event) {\n _this.Click(event);\n }, function (event) {\n _this.RightClick(event);\n }, function (event, draggedElem) {\n _this.DropEvent(event, draggedElem);\n }, function () {\n _this.ReRenderDir();\n });\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function (params) {\n WebDesktopEnvironment.CloseWindow(newWindow);\n });\n newWindow.querySelector(\"#RootButton\").addEventListener('click', function () {\n _this.RenderDir('/');\n });\n newWindow.querySelector(\"#HomeButton\").addEventListener('click', function () {\n _this.RenderDir('/home/user');\n });\n scrollBar = new WdeScrollBar(newWindow.querySelector(\".ScrollbarPlace\"), newWindow.querySelector(\".FileTileView\"));\n this.windowElem = newWindow;\n this.RenderDir(args[0]);\n case 42:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function Init(_x, _x2) {\n return _Init.apply(this, arguments);\n }\n return Init;\n }()\n /**\r\n * @param {string} path\r\n */\n }, {\n key: \"RenderDir\",\n value: function RenderDir(path) {\n this.curPath = path;\n this.fileView.OpenFolder(path);\n }\n }, {\n key: \"ReRenderDir\",\n value: function ReRenderDir() {\n this.RenderDir(this.curPath);\n }\n\n /**\r\n * @param {DragEvent} event\r\n * @param {HTMLElement} draggedElem\r\n */\n }, {\n key: \"DropEvent\",\n value: function () {\n var _DropEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {\n var sourcePath, targetPath, res, files, i, file, _res, params, response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(event.dataTransfer.getData(\"dropType\") == \"move\")) {\n _context2.next = 9;\n break;\n }\n sourcePath = event.dataTransfer.getData(\"filePath\");\n targetPath = this.curPath + \"/\" + event.dataTransfer.getData(\"fileName\");\n _context2.next = 5;\n return WebFS.MoveFile(sourcePath, targetPath);\n case 5:\n res = _context2.sent;\n if (res) {\n this.ReRenderDir();\n } else {\n WebDesktopEnvironment.Alert(\"UWAGA TODO MOVE FILE ERROR\"); //TODO\n }\n _context2.next = 28;\n break;\n case 9:\n console.log(event, this.curPath);\n files = event.dataTransfer.files;\n i = 0;\n case 12:\n if (!(i < files.length)) {\n _context2.next = 22;\n break;\n }\n file = files[i];\n console.log(\"file:\" + file.name);\n _context2.next = 17;\n return WebFS.UploadFile(file, this.curPath);\n case 17:\n _res = _context2.sent;\n if (_res) {\n this.ReRenderDir();\n }\n case 19:\n i++;\n _context2.next = 12;\n break;\n case 22:\n return _context2.abrupt(\"return\");\n case 26:\n response = _context2.sent;\n if (response.status != 200) {\n WebDesktopEnvironment.Alert(\"ERROR IN UPLOADING FILE\"); //TODO\n } else {\n this.ReRenderDir();\n }\n case 28:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n function DropEvent(_x3) {\n return _DropEvent.apply(this, arguments);\n }\n return DropEvent;\n }()\n /**\r\n * @param {MouseEvent} event\r\n */\n }, {\n key: \"Click\",\n value: function Click(event) {\n this.OpenFile(this.curPath, event.target.getAttribute(\"name\"), event.target.getAttribute(\"filetype\"));\n }\n\n /**\r\n * @param {string} filePath\r\n */\n }, {\n key: \"OpenFile\",\n value: function () {\n var _OpenFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parentPath, fileName, fileType) {\n var fileExtension, res;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n // console.log(parentPath, fileName, fileType)\n // const splittedPath = filePath.split(\"/\")\n // const fileName = splittedPath[splittedPath.length - 1]\n fileExtension = fileName.split(\".\")[fileName.split(\".\").length - 1]; //FIXME\n _context3.t0 = true;\n _context3.next = _context3.t0 === (fileType == \"objectlink\") ? 4 : _context3.t0 === (fileType == \"pathlink\") ? 6 : _context3.t0 === (fileExtension == \"app\") ? 12 : _context3.t0 === (fileExtension == \"blog\") ? 14 : _context3.t0 === (fileType == \"directory\") ? 16 : _context3.t0 === (fileExtension == \"blog\") ? 18 : _context3.t0 === (fileExtension == \"jpeg\" | fileExtension == \"png\") ? 20 : 22;\n break;\n case 4:\n WebDesktopEnvironment.Alert(\"Links not supported yet\");\n return _context3.abrupt(\"break\", 24);\n case 6:\n _context3.next = 8;\n return WebFS.ReadPathLink(\"\".concat(parentPath, \"/\").concat(fileName));\n case 8:\n res = _context3.sent;\n console.log(res);\n this.OpenFile(res.parentPath, res.name, res.filetype);\n return _context3.abrupt(\"break\", 24);\n case 12:\n WebDesktopEnvironment.Open(\"\".concat(parentPath, \"/\").concat(fileName), []);\n return _context3.abrupt(\"break\", 24);\n case 14:\n WebDesktopEnvironment.Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 16:\n WebDesktopEnvironment.Open(\"/Applications/Finder.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 18:\n WebDesktopEnvironment.Open(\"/Applications/BlogViewer.app\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 20:\n WebDesktopEnvironment.Open(\"img-viewer\", [\"\".concat(parentPath, \"/\").concat(fileName)]);\n return _context3.abrupt(\"break\", 24);\n case 22:\n WebDesktopEnvironment.Alert(\"Unsupported file type\");\n return _context3.abrupt(\"break\", 24);\n case 24:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n function OpenFile(_x4, _x5, _x6) {\n return _OpenFile.apply(this, arguments);\n }\n return OpenFile;\n }()\n /**\r\n * @param {MouseEvent} event\r\n */\n }, {\n key: \"RightClick\",\n value: function RightClick(event) {\n this.CreateContextMenu(event.target, [event.clientY, event.clientX]);\n }\n\n /**\r\n * @param {HTMLElement} target\r\n * @param {string[]} pos\r\n */\n }, {\n key: \"CreateContextMenu\",\n value: function () {\n var _CreateContextMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(target, pos) {\n var _this2 = this;\n var context, fileName, fileType, path, params, response, html, overlay, menu;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n context = \"\";\n fileName = target.getAttribute(\"name\"); //TODO check for null\n fileType = target.getAttribute(\"fileType\");\n if (target.classList.contains(\"FileTileView\")) {\n context = \"FileTileView\";\n } else {\n context = fileType;\n }\n path = \"\";\n if (fileName === null) {\n path = this.curPath;\n } else {\n path = \"\".concat(this.curPath, \"/\").concat(fileName);\n }\n params = new URLSearchParams({\n context: context,\n path: path\n });\n _context5.next = 9;\n return fetch(\"/app/\".concat(Finder.AppId, \"/contextMenu?\") + params);\n case 9:\n response = _context5.sent;\n if (!(response.status != 200)) {\n _context5.next = 13;\n break;\n }\n WebDesktopEnvironment.Alert(\"ERROR in Context menu TODO\"); //TODO\n return _context5.abrupt(\"return\");\n case 13:\n _context5.next = 15;\n return response.text();\n case 15:\n html = _context5.sent;\n overlay = document.createElement(\"div\"); //TODO Move to WDE.CreateOverlay()\n overlay.setAttribute('id', 'finder-context-menu-overlay');\n overlay.style.position = 'absolute';\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n menu = document.createElement(\"div\");\n menu.setAttribute('class', 'ContextMenu WindowFrameShadow');\n menu.style.position = 'absolute';\n menu.style.top = pos[0] + \"px\";\n menu.style.left = pos[1] + \"px\";\n menu.innerHTML = html;\n // menu.children[0].firstElementChild.remove()\n menu.children[0].lastElementChild.remove(); //FIXME Can't ommit rendering of horLine in end of menu on backend\n\n overlay.appendChild(menu);\n document.body.appendChild(overlay);\n overlay.addEventListener('click', /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {\n var res;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!event.target.classList.contains(\"Row\")) {\n _context4.next = 27;\n break;\n }\n //TODO add uuid id to rows to more accurate checks??\n res = false;\n _context4.t0 = event.target.children[0].getAttribute(\"action\");\n _context4.next = _context4.t0 === \"createPathLink\" ? 5 : _context4.t0 === \"createDir\" ? 10 : _context4.t0 === \"deleteFile\" ? 16 : _context4.t0 === \"getInfo\" ? 22 : _context4.t0 === \"openAsDir\" ? 24 : 26;\n break;\n case 5:\n _context4.next = 7;\n return WebFS.CreatePathLink(\"\".concat(_this2.curPath, \"/\").concat(fileName), \"\".concat(_this2.curPath, \"/Link to \").concat(fileName));\n case 7:\n res = _context4.sent;\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 10:\n _context4.next = 12;\n return WebFS.CreateDirectory(\"\".concat(_this2.curPath));\n case 12:\n res = _context4.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 16:\n _context4.next = 18;\n return WebFS.DeleteFile(\"\".concat(_this2.curPath, \"/\").concat(fileName));\n case 18:\n res = _context4.sent;\n console.log(res);\n if (res) {\n _this2.ReRenderDir();\n }\n return _context4.abrupt(\"break\", 27);\n case 22:\n Finder.RenderProperites(path);\n return _context4.abrupt(\"break\", 27);\n case 24:\n WebDesktopEnvironment.Open(\"/Applications/\".concat(Finder.AppId, \".app\"), [\"\".concat(_this2.curPath, \"/\").concat(fileName)]);\n return _context4.abrupt(\"break\", 27);\n case 26:\n return _context4.abrupt(\"break\", 27);\n case 27:\n overlay.remove();\n case 28:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n return function (_x9) {\n return _ref.apply(this, arguments);\n };\n }());\n overlay.addEventListener('contextmenu', function (event) {\n event.preventDefault();\n overlay.remove();\n });\n case 32:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n function CreateContextMenu(_x7, _x8) {\n return _CreateContextMenu.apply(this, arguments);\n }\n return CreateContextMenu;\n }()\n }]);\n return FinderWindow;\n}();\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder-window.js?"); + +/***/ }), + +/***/ "./src/apps/finder/finder.js": +/*!***********************************!*\ + !*** ./src/apps/finder/finder.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _finder_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./finder-window */ \"./src/apps/finder/finder-window.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n__webpack_require__(/*! ./finder.less */ \"./src/apps/finder/finder.less\");\n\nvar Finder = /*#__PURE__*/function () {\n function Finder() {\n _classCallCheck(this, Finder);\n }\n _createClass(Finder, [{\n key: \"NewWindow\",\n value:\n /**\r\n * @param {string[]} args\r\n */\n function () {\n var _NewWindow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args, runContext) {\n var newFinder;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n newFinder = new _finder_window__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n _context.next = 3;\n return newFinder.Init(args, runContext);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function NewWindow(_x, _x2) {\n return _NewWindow.apply(this, arguments);\n }\n return NewWindow;\n }()\n /**\r\n * @param {string} path\r\n * @returns {boolean}\r\n */\n }], [{\n key: \"RenderProperites\",\n value: function () {\n var _RenderProperites = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path) {\n var params, response, html, newWindow;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(path == null || path == \"\")) {\n _context2.next = 2;\n break;\n }\n return _context2.abrupt(\"return\");\n case 2:\n params = new URLSearchParams({\n path: path\n });\n _context2.next = 5;\n return fetch(\"/app/\".concat(Finder.AppId, \"/renderProps?\") + params);\n case 5:\n response = _context2.sent;\n if (!(response.status != 200)) {\n _context2.next = 9;\n break;\n }\n WebDesktopEnvironment.Alert(\"Error in properties render\"); //TODO\n return _context2.abrupt(\"return\", false);\n case 9:\n _context2.next = 11;\n return response.text();\n case 11:\n html = _context2.sent;\n newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.AppId, 350, 500);\n newWindow.innerHTML = html;\n newWindow.querySelector(\"#closeWindowButton\").addEventListener('click', function (params) {\n WebDesktopEnvironment.CloseWindow(newWindow);\n });\n case 15:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n function RenderProperites(_x3) {\n return _RenderProperites.apply(this, arguments);\n }\n return RenderProperites;\n }()\n }]);\n return Finder;\n}();\n_defineProperty(Finder, \"AppId\", \"Finder\");\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder.js?"); + +/***/ }), + +/***/ "./src/apps/finder/finder.less": +/*!*************************************!*\ + !*** ./src/apps/finder/finder.less ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://my-webpack-project/./src/apps/finder/finder.less?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./src/apps/finder/finder.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/res/dev-fs/wde/dist/mobile.css b/res/dev-fs/wde/dist/mobile.css new file mode 100644 index 0000000..1bc992f --- /dev/null +++ b/res/dev-fs/wde/dist/mobile.css @@ -0,0 +1,49 @@ +/*!**********************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/mobile.less ***! + \**********************************************************************************************************/ +.WdePrimitives.AdjectiveElement, +#down-bar { + border: 1px solid #555555; +} +#mobile-sunboard { + width: 100%; + height: 100%; + /* Auto layout */ + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; +} +#icons { + width: 100%; + height: 100%; + background-color: #9999CC; +} +#down-bar { + width: 100%; + height: 150px; + background-color: #C0C0C0; +} +body { + zoom: var(--zoom); + position: absolute; + width: 100%; + height: 100%; + margin: 0px; + /* font: normal 14px Summer Pixel 22, "res/SummerPixel22Regular.ttf"; */ + -webkit-touch-callout: none; + /* iOS Safari */ + -webkit-user-select: none; + /* Safari */ + -khtml-user-select: none; + /* Konqueror HTML */ + -moz-user-select: none; + /* Old versions of Firefox */ + -ms-user-select: none; + /* Internet Explorer/Edge */ + user-select: none; + /* Non-prefixed version, currently + supported by Chrome, Edge, Opera and Firefox */ + touch-action: manipulation; +} + diff --git a/res/dev-fs/wde/dist/mobile.js b/res/dev-fs/wde/dist/mobile.js index a3a324a..b36939d 100644 --- a/res/dev-fs/wde/dist/mobile.js +++ b/res/dev-fs/wde/dist/mobile.js @@ -10,26 +10,6 @@ /******/ "use strict"; /******/ var __webpack_modules__ = ({ -/***/ "./node_modules/css-loader/dist/runtime/api.js": -/*!*****************************************************!*\ - !*** ./node_modules/css-loader/dist/runtime/api.js ***! - \*****************************************************/ -/***/ ((module) => { - -eval("\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += \"}\";\n }\n if (item[2]) {\n content += \"}\";\n }\n if (item[4]) {\n content += \"}\";\n }\n return content;\n }).join(\"\");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/css-loader/dist/runtime/api.js?"); - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js": -/*!**************************************************************!*\ - !*** ./node_modules/css-loader/dist/runtime/noSourceMaps.js ***! - \**************************************************************/ -/***/ ((module) => { - -eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/css-loader/dist/runtime/noSourceMaps.js?"); - -/***/ }), - /***/ "./src/Decorat/mobile-decorat.js": /*!***************************************!*\ !*** ./src/Decorat/mobile-decorat.js ***! @@ -60,83 +40,13 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), -/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/mobile.less": -/*!******************************************************************************************************!*\ - !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/mobile.less ***! - \******************************************************************************************************/ -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n// Imports\n\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".body {\\n background-color: aqua;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/mobile.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js"); - -/***/ }), - /***/ "./src/mobile.less": /*!*************************!*\ !*** ./src/mobile.less ***! \*************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleDomAPI.js */ \"./node_modules/style-loader/dist/runtime/styleDomAPI.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertBySelector.js */ \"./node_modules/style-loader/dist/runtime/insertBySelector.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js */ \"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertStyleElement.js */ \"./node_modules/style-loader/dist/runtime/insertStyleElement.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleTagTransform.js */ \"./node_modules/style-loader/dist/runtime/styleTagTransform.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_node_modules_less_loader_dist_cjs_js_mobile_less__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js!../node_modules/less-loader/dist/cjs.js!./mobile.less */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/mobile.less\");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {};\n\noptions.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());\n\n options.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, \"head\");\n \noptions.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_node_modules_less_loader_dist_cjs_js_mobile_less__WEBPACK_IMPORTED_MODULE_6__[\"default\"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_node_modules_less_loader_dist_cjs_js_mobile_less__WEBPACK_IMPORTED_MODULE_6__[\"default\"] && _node_modules_css_loader_dist_cjs_js_node_modules_less_loader_dist_cjs_js_mobile_less__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals ? _node_modules_css_loader_dist_cjs_js_node_modules_less_loader_dist_cjs_js_mobile_less__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals : undefined);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/mobile.less?"); - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": -/*!****************************************************************************!*\ - !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! - \****************************************************************************/ -/***/ ((module) => { - -eval("\n\nvar stylesInDOM = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n\n return updater;\n}\n\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n\n stylesInDOM.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?"); - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js": -/*!********************************************************************!*\ - !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***! - \********************************************************************/ -/***/ ((module) => { - -eval("\n\nvar memo = {};\n/* istanbul ignore next */\n\nfunction getTarget(target) {\n if (typeof memo[target] === \"undefined\") {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n}\n/* istanbul ignore next */\n\n\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n}\n\nmodule.exports = insertBySelector;\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/style-loader/dist/runtime/insertBySelector.js?"); - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js": -/*!**********************************************************************!*\ - !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***! - \**********************************************************************/ -/***/ ((module) => { - -eval("\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement(\"style\");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\n\nmodule.exports = insertStyleElement;\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/style-loader/dist/runtime/insertStyleElement.js?"); - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! - \**********************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = true ? __webpack_require__.nc : 0;\n\n if (nonce) {\n styleElement.setAttribute(\"nonce\", nonce);\n }\n}\n\nmodule.exports = setAttributesWithoutAttributes;\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js?"); - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js": -/*!***************************************************************!*\ - !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***! - \***************************************************************/ -/***/ ((module) => { - -eval("\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = \"\";\n\n if (obj.supports) {\n css += \"@supports (\".concat(obj.supports, \") {\");\n }\n\n if (obj.media) {\n css += \"@media \".concat(obj.media, \" {\");\n }\n\n var needLayer = typeof obj.layer !== \"undefined\";\n\n if (needLayer) {\n css += \"@layer\".concat(obj.layer.length > 0 ? \" \".concat(obj.layer) : \"\", \" {\");\n }\n\n css += obj.css;\n\n if (needLayer) {\n css += \"}\";\n }\n\n if (obj.media) {\n css += \"}\";\n }\n\n if (obj.supports) {\n css += \"}\";\n }\n\n var sourceMap = obj.sourceMap;\n\n if (sourceMap && typeof btoa !== \"undefined\") {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n options.styleTagTransform(css, styleElement, options.options);\n}\n\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n\n styleElement.parentNode.removeChild(styleElement);\n}\n/* istanbul ignore next */\n\n\nfunction domAPI(options) {\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\n\nmodule.exports = domAPI;\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/style-loader/dist/runtime/styleDomAPI.js?"); - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js": -/*!*********************************************************************!*\ - !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***! - \*********************************************************************/ -/***/ ((module) => { - -eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n\n styleElement.appendChild(document.createTextNode(css));\n }\n}\n\nmodule.exports = styleTagTransform;\n\n//# sourceURL=webpack://my-webpack-project/./node_modules/style-loader/dist/runtime/styleTagTransform.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://my-webpack-project/./src/mobile.less?"); /***/ }) @@ -154,7 +64,7 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, +/******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; @@ -167,18 +77,6 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem /******/ } /******/ /************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports @@ -207,11 +105,6 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem /******/ }; /******/ })(); /******/ -/******/ /* webpack/runtime/nonce */ -/******/ (() => { -/******/ __webpack_require__.nc = undefined; -/******/ })(); -/******/ /************************************************************************/ /******/ /******/ // startup diff --git a/routes/private.go b/routes/private.go index 907f5ac..2e077af 100644 --- a/routes/private.go +++ b/routes/private.go @@ -56,12 +56,12 @@ func PrivateRoutes(port string, webfs *webfilesystem.WebFileSystem, webde *wde.W autostart := []AppString{desktop, appString, aboutMe} d := mobile.GetDevice(ctx) - + _ = autostart switch { // Hey I'm a desktop!... or laptop but not a mobile or tablet! case d.Normal(): ctx.HTML(http.StatusOK, "index.html", gin.H{ - "autostart": autostart, + // "autostart": autostart, }) // Hey I'm a mobile device! case d.Mobile(): diff --git a/templates/base/mobile-desktop.html b/templates/base/mobile-desktop.html index 33f06df..fc1d9ed 100644 --- a/templates/base/mobile-desktop.html +++ b/templates/base/mobile-desktop.html @@ -2,28 +2,14 @@ Greg Brzezinski - - + +
+
+
+
-