From c53fd8bd88666fb67f4eaf43814b7a072f6b4217 Mon Sep 17 00:00:00 2001 From: lxsang Date: Mon, 11 May 2020 19:52:31 +0200 Subject: [PATCH] refactory code --- Makefile | 15 +- src/core/BaseDialog.coffee | 67 ++-- src/core/core.coffee | 3 +- src/core/gui.coffee | 349 ++++++++---------- src/core/schemes/about.html | 11 - src/core/schemes/dm.html | 2 - src/core/schemes/filedialog.html | 13 - src/core/settings.coffee | 4 +- src/core/tags/CalendarTag.coffee | 1 - src/core/tags/FileViewTag.coffee | 73 +--- src/core/tags/GridViewTag.coffee | 2 - src/core/tags/LabelTag.coffee | 6 + src/core/tags/ListViewTag.coffee | 23 ++ src/core/tags/OverlayTag.coffee | 29 +- src/core/tags/SystemPanelTag.coffee | 142 ++++++- src/core/tags/tag.coffee | 10 +- src/index.html | 2 - src/libs/riot.compiler.min.js | 2 - src/libs/riot.min.js | 2 - src/packages/ActivityMonitor/main.coffee | 66 ++-- src/packages/CoreServices/Makefile | 2 +- .../CoreServices/PushNotification.coffee | 24 +- src/packages/CoreServices/Spotlight.coffee | 134 ------- src/packages/CoreServices/UserService.coffee | 45 --- src/packages/CoreServices/main.css | 49 --- src/packages/CoreServices/package.json | 2 +- src/packages/ShowCase/assets/scheme.html | 9 +- src/packages/ShowCase/coffees/main.coffee | 17 +- src/packages/ShowCase/css/main.css | 14 - src/themes/antos/afx-label.css | 6 +- src/themes/antos/afx-sys-panel.css | 78 +++- src/themes/antos/antos.css | 7 +- 32 files changed, 554 insertions(+), 655 deletions(-) delete mode 100644 src/core/schemes/about.html delete mode 100644 src/core/schemes/filedialog.html delete mode 100644 src/libs/riot.compiler.min.js delete mode 100644 src/libs/riot.min.js delete mode 100644 src/packages/CoreServices/Spotlight.coffee delete mode 100644 src/packages/CoreServices/UserService.coffee diff --git a/Makefile b/Makefile index f2a4159..4b9455f 100644 --- a/Makefile +++ b/Makefile @@ -54,13 +54,13 @@ coffees= src/core/core.coffee \ packages = CoreServices ActivityMonitor Setting ShowCase DummyApp # Files MarkOn MarketPlace Preview NotePad wTerm -main: initd build_coffees build_tags build_themes schemes libs build_packages languages +main: initd build_coffees build_themes schemes libs build_packages languages - cp src/index.html $(BUILDDIR)/ initd: - mkdir -p $(BUILDDIR) -lite: build_coffees build_tags build_themes schemes build_packages +lite: build_coffees build_themes schemes build_packages #%.js: %.coffee # coffee --compile $< @@ -87,11 +87,6 @@ testdata: @echo "$(BLUE)Copy JSON test files$(NC)" - mkdir -p $(BUILDDIR)/resources/jsons cp src/core/handlers/jsons/* $(BUILDDIR)/resources/jsons -build_tags: - @echo "$(BLUE)Building tag files$(NC)" - -mkdir -p $(BUILDDIR)/resources - -rm $(BUILDDIR)/resources/antos_tags.js - for f in src/core/tags/*.tag; do (cat "$${f}"; echo) >> $(BUILDDIR)/resources/antos_tags.js; done languages: -mkdir -p $(BUILDDIR)/resources @@ -144,12 +139,6 @@ uglify: # npm install uglify-js -g uglifyjs $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js # uglify tags - # npm install riot-cli -g - riot --ext js $(BUILDDIR)/resources/antos_tags.js $(BUILDDIR)/resources/antos_tags.js - uglifyjs $(BUILDDIR)/resources/antos_tags.js --compress --mangle --output $(BUILDDIR)/resources/antos_tags.js - $(GSED) -i 's/resources\/antos_tags.js/scripts\/riot.min.js/g' $(BUILDDIR)/index.html - $(GSED) -i 's/scripts\/riot.compiler.min.js/resources\/antos_tags.js/g' $(BUILDDIR)/index.html - $(GSED) -i 's/type=\"riot\/tag\"/ /g' "$(BUILDDIR)/index.html" # npm install uglifycss -g # uglify the css uglifycss --output $(BUILDDIR)/resources/themes/antos/antos.css $(BUILDDIR)/resources/themes/antos/antos.css diff --git a/src/core/BaseDialog.coffee b/src/core/BaseDialog.coffee index 42d1709..9eca427 100644 --- a/src/core/BaseDialog.coffee +++ b/src/core/BaseDialog.coffee @@ -61,6 +61,8 @@ class BasicDialog extends BaseDialog init: () -> @scheme.set "apptitle", @data.title if @data and @data.title + @scheme.set "resizable", false + @scheme.set "minimizable", false this.OS.GUI.BasicDialog = BasicDialog @@ -343,42 +345,41 @@ AboutDialog.scheme = """ """ this.OS.register "AboutDialog", AboutDialog -class FileDiaLog extends BaseDialog +class FileDialog extends BasicDialog constructor: () -> - super "FileDiaLog" + super "FileDialog", FileDialog.scheme init: () -> - @render "os://resources/schemes/filedialog.html" - - main: () -> + super.init() fileview = @find "fileview" location = @find "location" filename = @find "filename" me = @ - @scheme.set "apptitle", @title - fileview.set "fetch", (e, f) -> - return unless e.child - e.child.path.asFileHandle().read (d) -> - return me.error __("Resource not found: {0}", e.child.path) if d.error - f d.result + fileview.set "fetch", (path) -> + new Promise (resolve, reject) -> + path.asFileHandle().read() + .then (d) -> + return reject d if d.error + resolve d.result + .catch (e) -> reject e setroot = (path) -> - path.asFileHandle().read (d) -> + path.asFileHandle().read().then (d) -> if(d.error) return me.error __("Resource not found: {0}", path) fileview.set "path", path - fileview.set "data", d.result + if not @data or not @data.root location.set "onlistselect", (e) -> - return unless e and e.data.path - setroot e.data.path - location.set "items", ( i for i in @systemsetting.VFS.mountpoints when i.type isnt "app" ) - location.set "selected", 0 unless location.get "selected" + return unless e and e.data.item + setroot e.data.item.get("data").path + location.set "data", ( i for i in @systemsetting.VFS.mountpoints when i.type isnt "app" ) + location.set "selected", 0 if location.get("selectedItem") is undefined else $(location).hide() - @trigger "calibrate" + @trigger "resize" setroot @data.root - fileview.set "onfileselect", (f) -> - ($ filename).val f.filename if f.type is "file" + fileview.set "onfileselect", (e) -> + ($ filename).val e.data.filename if e.data.type is "file" (@find "bt-ok").set "onbtclick", (e) -> f = fileview.get "selectedFile" return me.notify __("Please select a file/fofler") unless f @@ -392,11 +393,9 @@ class FileDiaLog extends BaseDialog m = true break return me.notify __("Only {0} could be selected", me.data.mimes.join(",")) unless m - d = f.path - d = f.path.asFileHandle().parent() if f.type is "file" - me.handle d, ($ filename).val(), f.path, f if me.handle - #sel = if me.data and me.data.selection then me.data.selection else "file" - #me.handle f, ($ filename).val() if me.handle and ((f.type is sel) or (sel is "*")) + + name = $(filename).val() + me.handle { file: f, name: name } if me.handle me.quit() (@find "bt-cancel").set "onbtclick", (e) -> @@ -406,4 +405,20 @@ class FileDiaLog extends BaseDialog @trigger "resize" fileview.set "showhidden", @data.hidden if @data and @data.hidden -this.OS.register "FileDiaLog", FileDiaLog \ No newline at end of file +FileDialog.scheme = """ + + + + + + +
+ + +
+
+
+
+""" + +this.OS.register "FileDialog", FileDialog \ No newline at end of file diff --git a/src/core/core.coffee b/src/core/core.coffee index d7b08c9..fd288f9 100644 --- a/src/core/core.coffee +++ b/src/core/core.coffee @@ -91,7 +91,7 @@ Ant.OS or= delete Ant.OS.announcer.observable ($ "#wrapper").empty() Ant.OS.GUI.clearTheme() - Ant.OS.announcer.observable = riot.observable() + Ant.OS.announcer.observable = new Ant.OS.API.Announcer() Ant.OS.announcer.quota = 0 Ant.OS.APP = {} Ant.OS.setting = @@ -128,6 +128,7 @@ Ant.OS or= .then (r) -> Ant.OS.cleanup() Ant.OS.API.handle.logout() + .then (d) -> Ant.OS.boot() .catch (e) -> console.error e diff --git a/src/core/gui.coffee b/src/core/gui.coffee index abb3263..447eae4 100644 --- a/src/core/gui.coffee +++ b/src/core/gui.coffee @@ -26,27 +26,6 @@ Ant.OS.GUI = CTRL: {} SHIFT: {} META: {} - SYS_MENU: [ - { - text: "", - iconclass: "fa fa-eercast", - dataid: "sys-menu-root", - children: [ - { - text: "__(Applications)", - children: [], - dataid: "sys-apps" - iconclass: "fa fa-adn", - onchildselect: (d) -> - Ant.OS.GUI.launch d.data.item.get("data").name - } - ], - onchildselect: (d) -> - id = d.data.item.get("data").dataid - return Ant.OS.exit() if id is "sys-logout" - return Ant.OS.GUI.toggleFullscreen() if id is "os-fullsize" - } - ] htmlToScheme: (html, app, parent) -> scheme = $.parseHTML html @@ -80,20 +59,21 @@ Ant.OS.GUI = Ant.OS.GUI.pushServices srvs Ant.OS.GUI.pushService srvs[0] - openDialog: (d, f, title, data) -> - if Ant.OS.GUI.dialog - Ant.OS.GUI.dialog.show() - return - if not Ant.OS.GUI.subwindows[d] - ex = Ant.OS.API.throwe "Dialog" - return Ant.OS.announcer.oserror __("Dialog {0} not found", d), ex, null - Ant.OS.GUI.dialog = new Ant.OS.GUI.subwindows[d]() - Ant.OS.GUI.dialog.parent = Ant.OS.GUI - Ant.OS.GUI.dialog.handle = f - Ant.OS.GUI.dialog.pid = -1 - Ant.OS.GUI.dialog.data = data - Ant.OS.GUI.dialog.title = title - Ant.OS.GUI.dialog.init() + openDialog: (d, data) -> + new Promise (resolve, reject) -> + if Ant.OS.GUI.dialog + Ant.OS.GUI.dialog.show() + return resolve() + if not Ant.OS.GUI.subwindows[d] + ex = Ant.OS.API.throwe "Dialog" + return reject(ex) + Ant.OS.GUI.dialog = new Ant.OS.GUI.subwindows[d]() + Ant.OS.GUI.dialog.parent = Ant.OS.GUI + Ant.OS.GUI.dialog.handle = resolve + Ant.OS.GUI.dialog.reject = reject + Ant.OS.GUI.dialog.pid = -1 + Ant.OS.GUI.dialog.data = data + Ant.OS.GUI.dialog.init() pushService: (ph) -> arr = ph.split "/" @@ -213,7 +193,7 @@ Ant.OS.GUI = app.applySetting m.data.m if (m.name is app.name) toggleFullscreen: () -> - el = ($ "body")[0] + el = document.documentElement if Ant.OS.GUI.fullscreen return document.exitFullscreen() if document.exitFullscreen return document.mozCancelFullScreen() if document.mozCancelFullScreen @@ -263,10 +243,11 @@ Ant.OS.GUI = showTooltip: (el, text, e) -> el = el[0] label = ($ "#systooltip")[0] - $("#workspace").on "mousemove", (ev) -> + cb = (ev) -> if $(ev.target).closest(el).length is 0 $(label).hide() - $("#workspace").off "mousemove" + $(document).off "mousemove", cb + $(document).on "mousemove", cb arr = text.split /:(.+)/ tip = text tip = arr[1] if arr.length > 1 @@ -279,167 +260,139 @@ Ant.OS.GUI = when "cr" # center right of the element left = offset.left + w + 5 top = offset.top + h / 2 - $(label).height() / 2 - $(label).css "top", top + "px" - .css "left", left + "px" + when "ct" #ceter top + left = offset.left + w / 2 - $(label).width() / 2 + top = offset.top - $(label).height() - 5 else return unless e - $(label).css "top", e.clientY + 5 + "px" - .css "left", e.clientX + 5 + "px" + top = e.clientY + 5 + left = e.clientX + 5 + $(label).css "top", top + "px" + .css "left", left + "px" initDM: -> - # check login first - Ant.OS.API.resource("schemes/dm.html") - .then (x) -> - return null unless x - scheme = $.parseHTML x - ($ "#wrapper").append scheme + scheme = $.parseHTML Ant.OS.GUI.schemes.ws + ($ "#wrapper").append scheme + + Ant.OS.announcer.observable.one "sysdockloaded", () -> + ($ window).bind 'keydown', (event) -> + dock = ($ "#sysdock")[0] + return unless dock + app = dock.get "selectedApp" + #return true unless app + c = String.fromCharCode(event.which).toUpperCase() + fnk = undefined + if event.ctrlKey + fnk = "CTRL" + else if event.metaKey + fnk = "META" + else if event.shiftKey + fnk = "SHIFT" + else if event.altKey + fnk = "ALT" - Ant.OS.announcer.observable.one "sysdockloaded", () -> - ($ window).bind 'keydown', (event) -> - dock = ($ "#sysdock")[0] - return unless dock - app = dock.get "selectedApp" - #return true unless app - c = String.fromCharCode(event.which).toUpperCase() - fnk = undefined - if event.ctrlKey - fnk = "CTRL" - else if event.metaKey - fnk = "META" - else if event.shiftKey - fnk = "SHIFT" - else if event.altKey - fnk = "ALT" - - return unless fnk - r = if app then app.shortcut fnk, c, event else true - return event.preventDefault() if not r - return unless Ant.OS.GUI.shortcut[fnk] - return unless Ant.OS.GUI.shortcut[fnk][c] - Ant.OS.GUI.shortcut[fnk][c](event) - event.preventDefault() - # system menu and dock - $("#syspanel")[0].uify() - $("#sysdock")[0].uify() - $("#systooltip")[0].uify() - $("#contextmenu")[0].uify() - #riot.mount ($ "#syspanel", $ "#wrapper") - #riot.mount ($ "#sysdock", $ "#workspace"), { items: [] } - #riot.mount ($ "#systooltip", $ "#wrapper") - # context menu - #riot.mount ($ "#contextmenu", $ "#wrapper") - ($ "#workspace").contextmenu (e) -> Ant.OS.GUI.bindContextMenu e - # tooltip - ($ "#workspace").mouseover (e) -> - el = $(e.target).closest "[tooltip]" - return unless el.length > 0 - Ant.OS.GUI.showTooltip el, ($(el).attr "tooltip"), e - - # desktop default file manager - desktop = $ Ant.OS.GUI.workspace - desktop[0].fetch = () -> - fp = Ant.OS.setting.desktop.path.asFileHandle() - fn = () -> - fp.read().then (d) -> - return Ant.OS.announcer.osfail d.error, (Ant.OS.API.throwe "OS.VFS"), d.error if d.error - items = [] - $.each d.result, (i, v) -> - return if v.filename[0] is '.' and not Ant.OS.setting.desktop.showhidden - v.text = v.filename - #v.text = v.text.substring(0,9) + "..." ifv.text.length > 10 - v.iconclass = v.type - items.push(v) - desktop[0].set "data", items - desktop[0].refresh() + return unless fnk + r = if app then app.shortcut fnk, c, event else true + return event.preventDefault() if not r + return unless Ant.OS.GUI.shortcut[fnk] + return unless Ant.OS.GUI.shortcut[fnk][c] + Ant.OS.GUI.shortcut[fnk][c](event) + event.preventDefault() + # system menu and dock + $("#syspanel")[0].uify() + $("#sysdock")[0].uify() + $("#systooltip")[0].uify() + $("#contextmenu")[0].uify() + + ($ "#workspace").contextmenu (e) -> Ant.OS.GUI.bindContextMenu e + # tooltip + ($ document).mouseover (e) -> + el = $(e.target).closest "[tooltip]" + return unless el.length > 0 + Ant.OS.GUI.showTooltip el, ($(el).attr "tooltip"), e + + # desktop default file manager + desktop = $ Ant.OS.GUI.workspace + desktop[0].fetch = () -> + fp = Ant.OS.setting.desktop.path.asFileHandle() + fn = () -> + fp.read().then (d) -> + return Ant.OS.announcer.osfail d.error, (Ant.OS.API.throwe "OS.VFS"), d.error if d.error + items = [] + $.each d.result, (i, v) -> + return if v.filename[0] is '.' and not Ant.OS.setting.desktop.showhidden + v.text = v.filename + #v.text = v.text.substring(0,9) + "..." ifv.text.length > 10 + v.iconclass = v.type + items.push(v) + desktop[0].set "data", items + desktop[0].refresh() - fp.onready() - .then () -> fn() - .catch ( e ) -> # try to create the path - console.log "#{fp.path} not found" - name = fp.basename - fp.parent().asFileHandle().mk(name).then (r) -> - ex = Ant.OS.API.throwe "OS.VFS" - if r.error then Ant.OS.announcer.osfail d.error, ex, d.error else fn() - - desktop[0].ready = (e) -> - e.observable = Ant.OS.announcer - window.onresize = () -> - Ant.OS.announcer.trigger "desktopresize" - e.refresh() + fp.onready() + .then () -> fn() + .catch ( e ) -> # try to create the path + console.log "#{fp.path} not found" + name = fp.basename + fp.parent().asFileHandle().mk(name).then (r) -> + ex = Ant.OS.API.throwe "OS.VFS" + if r.error then Ant.OS.announcer.osfail d.error, ex, d.error else fn() + + desktop[0].ready = (e) -> + e.observable = Ant.OS.announcer + window.onresize = () -> + Ant.OS.announcer.trigger "desktopresize" + e.refresh() - desktop[0].set "onlistselect", (d) -> - ($ "#sysdock").get(0).set "selectedApp", null - - desktop[0].set "onlistdbclick", ( d ) -> - ($ "#sysdock").get(0).set "selectedApp", null - it = desktop[0].get "selectedItem" - Ant.OS.GUI.openWith it.get("data") + desktop[0].set "onlistselect", (d) -> + ($ "#sysdock").get(0).set "selectedApp", null + + desktop[0].set "onlistdbclick", ( d ) -> + ($ "#sysdock").get(0).set "selectedApp", null + it = desktop[0].get "selectedItem" + Ant.OS.GUI.openWith it.get("data") - #($ "#workingenv").on "click", (e) -> - # desktop[0].set "selected", -1 + #($ "#workingenv").on "click", (e) -> + # desktop[0].set "selected", -1 - desktop.on "click", (e) -> - return unless e.target.tagName.toUpperCase() is "UL" - desktop[0].unselect() - ($ "#sysdock").get(0).set "selectedApp", null - - desktop[0].contextmenuHandle = (e, m) -> - desktop[0].unselect() if e.target.tagName.toUpperCase() is "UL" - ($ "#sysdock").get(0).set "selectedApp", null - menu = [ - { text: __("Open"), dataid: "desktop-open" }, - { text: __("Refresh"), dataid: "desktop-refresh" } - ] - menu = menu.concat ( v for k, v of Ant.OS.setting.desktop.menu) - m.set "items", menu - m.set "onmenuselect", (evt) -> - item = evt.data.item.get("data") - switch item.dataid - when "desktop-open" - it = desktop[0].get "selectedItem" - return Ant.OS.GUI.openWith it.get("data") if it - it = Ant.OS.setting.desktop.path.asFileHandle() - it.mime = "dir" - Ant.OS.GUI.openWith it - when "desktop-refresh" - desktop[0].fetch() - else - Ant.OS.GUI.launch item.app, item.args if item.app - m.show(e) - - desktop[0].fetch() - Ant.OS.announcer.observable.on "VFS", (d) -> - desktop[0].fetch() if d.data.file.hash() is fp.hash() or d.data.file.parent().hash() is fp.hash() - Ant.OS.announcer.ostrigger "desktoploaded" - # mount it - desktop[0].uify() - # riot.mount desktop - .catch (e) -> - console.log e - alert __("System fail: Cannot init desktop manager") + desktop.on "click", (e) -> + return unless e.target.tagName.toUpperCase() is "UL" + desktop[0].unselect() + ($ "#sysdock").get(0).set "selectedApp", null + + desktop[0].contextmenuHandle = (e, m) -> + desktop[0].unselect() if e.target.tagName.toUpperCase() is "UL" + ($ "#sysdock").get(0).set "selectedApp", null + menu = [ + { text: __("Open"), dataid: "desktop-open" }, + { text: __("Refresh"), dataid: "desktop-refresh" } + ] + menu = menu.concat ( v for k, v of Ant.OS.setting.desktop.menu) + m.set "items", menu + m.set "onmenuselect", (evt) -> + item = evt.data.item.get("data") + switch item.dataid + when "desktop-open" + it = desktop[0].get "selectedItem" + return Ant.OS.GUI.openWith it.get("data") if it + it = Ant.OS.setting.desktop.path.asFileHandle() + it.mime = "dir" + Ant.OS.GUI.openWith it + when "desktop-refresh" + desktop[0].fetch() + else + Ant.OS.GUI.launch item.app, item.args if item.app + m.show(e) + + desktop[0].fetch() + Ant.OS.announcer.observable.on "VFS", (d) -> + desktop[0].fetch() if d.data.file.hash() is fp.hash() or d.data.file.parent().hash() is fp.hash() + Ant.OS.announcer.ostrigger "desktoploaded" + # mount it + desktop[0].uify() refreshDesktop: () -> ($ Ant.OS.GUI.workspace)[0].fetch() - refreshSystemMenu: () -> - Ant.OS.GUI.SYS_MENU[0].children.length = 1 - Ant.OS.GUI.SYS_MENU[0].children[0].children.length = 0 - Ant.OS.GUI.SYS_MENU[0].children[0].children.push v for k, v of Ant.OS.setting.system.packages when (v and v.app) - Ant.OS.GUI.SYS_MENU[0].children.push v for k, v of Ant.OS.setting.system.menu - Ant.OS.GUI.SYS_MENU[0].children.push - text: "__(Toggle Full screen)", - dataid: "os-fullsize", - iconclass: "fa fa-tv" - Ant.OS.GUI.SYS_MENU[0].children.push - text: "__(Log out)", - dataid: "sys-logout", - iconclass: "fa fa-user-times" - # Ant.OS.GUI.buildSystemMenu() - buildSystemMenu: () -> - ($ "[data-id = 'osmenu']", "#syspanel")[0].set "items", Ant.OS.GUI.SYS_MENU - - #console.log menu - mkdialog: (conf) -> return new Ant.OS.GUI.BasicDialog conf.name, conf.layout @@ -455,7 +408,8 @@ Ant.OS.GUI = password: ($ "#txtpass").val() Ant.OS.API.handle.login data .then (d) -> - if d.error then ($ "#login_error").html d.error else Ant.OS.GUI.startAntOS d.result + return ($ "#login_error").html d.error if d.error + Ant.OS.GUI.startAntOS d.result .catch (e) -> ($ "#login_error").html "Login: server error" ($ "#txtpass").keyup (e) -> @@ -489,8 +443,8 @@ Ant.OS.GUI = v.icon = "#{v.path}/#{v.icon}" if v.icon v.iconclass = "fa fa-adn" unless v.iconclass or v.icon Ant.OS.setting.system.packages = if r.result then r.result else - Ant.OS.GUI.refreshSystemMenu() - Ant.OS.GUI.buildSystemMenu() + # Ant.OS.GUI.refreshSystemMenu() + # Ant.OS.GUI.buildSystemMenu() # push startup services # TODO: get services list from user setting Ant.OS.GUI.pushServices (v for v in Ant.OS.setting.system.startup.services) @@ -499,4 +453,19 @@ Ant.OS.GUI = # initDM Ant.OS.API.setLocale Ant.OS.setting.system.locale .then () -> - Ant.OS.GUI.initDM() \ No newline at end of file + Ant.OS.GUI.initDM() + + +Ant.OS.GUI.schemes = {} +Ant.OS.GUI.schemes.ws = """ + +
+ + +
+ + +""" + +Ant.OS.GUI.schemes.login = """ +""" \ No newline at end of file diff --git a/src/core/schemes/about.html b/src/core/schemes/about.html deleted file mode 100644 index aba8877..0000000 --- a/src/core/schemes/about.html +++ /dev/null @@ -1,11 +0,0 @@ - - -
-

- -

-

-
- -
-
\ No newline at end of file diff --git a/src/core/schemes/dm.html b/src/core/schemes/dm.html index ce46df3..150c828 100644 --- a/src/core/schemes/dm.html +++ b/src/core/schemes/dm.html @@ -1,10 +1,8 @@ -
-
\ No newline at end of file diff --git a/src/core/schemes/filedialog.html b/src/core/schemes/filedialog.html deleted file mode 100644 index 512c41d..0000000 --- a/src/core/schemes/filedialog.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - -
- - -
-
-
-
\ No newline at end of file diff --git a/src/core/settings.coffee b/src/core/settings.coffee index fe49c08..e339d1e 100644 --- a/src/core/settings.coffee +++ b/src/core/settings.coffee @@ -44,9 +44,7 @@ Ant.OS.setting.system.startup = { services: [ "CoreServices/PushNotification", - "CoreServices/UserService", - "CoreServices/Calendar", - "CoreServices/Spotlight" + "CoreServices/Calendar" ], apps: [] } if not Ant.OS.setting.system.startup diff --git a/src/core/tags/CalendarTag.coffee b/src/core/tags/CalendarTag.coffee index 4bbf768..22106c2 100644 --- a/src/core/tags/CalendarTag.coffee +++ b/src/core/tags/CalendarTag.coffee @@ -109,7 +109,6 @@ class CalendarTag extends Ant.OS.GUI.BaseTag for i in [ 0..7 - row.length ] row.push { text: "" } rows.push(row) - console.log rows @refs.grid.set "rows", rows @refs.mlbl.set "text", "#{months[@month]} #{@year}" diff --git a/src/core/tags/FileViewTag.coffee b/src/core/tags/FileViewTag.coffee index 84a3a5b..badb474 100644 --- a/src/core/tags/FileViewTag.coffee +++ b/src/core/tags/FileViewTag.coffee @@ -4,12 +4,12 @@ class FileViewTag extends Ant.OS.GUI.BaseTag @setopt "onfileselect", ()-> @setopt "onfileopen", () -> @setopt "selectedFile", undefined - @setopt "view", "list" @setopt "data", [] @setopt "status", true @setopt "showhidden", false @setopt "fetch", undefined @setopt "path", undefined + @setopt "view", "list" @preventUpdate = false @header = [ { text: "__(File name)" }, @@ -22,6 +22,10 @@ class FileViewTag extends Ant.OS.GUI.BaseTag __view__: (v) -> @switchView() + __status__: (v) -> + return $(@refs.status).show() if v + $(@refs.status).hide() + __path__: (v) -> return unless v me = @ @@ -147,6 +151,7 @@ class FileViewTag extends Ant.OS.GUI.BaseTag e.filename, if e.size then e.size else "0" ) evt = { id: @aid(), data: e } + @set "selectedFile", e @get("onfileselect") evt @observable.trigger "fileselect", evt @@ -183,78 +188,14 @@ class FileViewTag extends Ant.OS.GUI.BaseTag @refs.treeview.set "ontreedbclick", (e) -> me.filedbclick e.data.item.get("data") @switchView() - ### self.refs.listview.onlistselect = function(data) - { - data.id = self.rid - self.root.observable.trigger("fileselect",data) - } - self.refs.listview.onlistdbclick = function(data) - { - data.id = self.rid - self.root.observable.trigger("filedbclick",data) - } - self.refs.gridview.root.observable = self.root.observable - self.refs.gridview.ongridselect = function(d) - { - var data = {id:self.rid, data:self.data[d.data.child[3].idx], idx:d.data.child[3].idx} - self.root.observable.trigger("fileselect",data) - } - self.refs.gridview.ongriddbclick = function(d) - { - var data = {id:self.rid, data:self.data[d.data.child[3].idx], idx:d.data.child[3].idx} - self.root.observable.trigger("filedbclick",data) - } - self.refs.treeview.ontreeselect = function(d) - { - if(!d) return; - var data; - var el = d; - if(d.treepath == 0)// select the root - { - el = self.path.asFileHandler() - el.size = 0 - el.filename = el.path - } - var data = {id:self.rid, data:el} - self.root.observable.trigger("fileselect",data) - } - self.refs.treeview.ontreedbclick = function(d) - { - if(!d || d.treepath == 0) return; - var data = {id:self.rid, data:d} - self.root.observable.trigger("filedbclick",data) - } - self.root.observable.on("fileselect", function(e){ - if(e.id != self.rid) return - self.selectedFile = e.data - if(self.onfileselect) - self.onfileselect(e.data) - if(self.refs.stbar) - self.refs.stbar.root.set("text", __("Selected: {0} ({1} bytes)", e.data.filename, e.data.size?e.data.size:"0"))//.html() - }) - self.root.observable.on("filedbclick", function(e){ - if(e.id != self.rid ) return - if(e.data.type != "dir" && self.onfileopen) - self.onfileopen(e.data) - else if(self.chdir && e.data.type == "dir") - self.chdir(e.data.path) - }) - calibre_size() - self.root.observable.on("resize", function(e){ - calibre_size() - }) - self.root.observable.on("calibrate", function(e){ - calibre_size() - }) - }) ### layout: () -> [ { el: "afx-list-view", ref: "listview" }, - { el: "afx-grid-view", ref: "gridview" }, { el: "div", class: "treecontainer", ref: "treecontainer", children: [ { el: "afx-tree-view", ref: "treeview" } ] }, + { el: "afx-grid-view", ref: "gridview" }, { el: "afx-label", class: "status", ref: "status" } ] diff --git a/src/core/tags/GridViewTag.coffee b/src/core/tags/GridViewTag.coffee index 86a87c2..60502a4 100644 --- a/src/core/tags/GridViewTag.coffee +++ b/src/core/tags/GridViewTag.coffee @@ -172,8 +172,6 @@ class GridViewTag extends Ant.OS.GUI.BaseTag me = @ $(@root) .css "overflow", "hidden" - .css "display", "block" - .css "padding", "5px" $(@refs.grid).css "display", "grid" $(@refs.header).css "display", "grid" diff --git a/src/core/tags/LabelTag.coffee b/src/core/tags/LabelTag.coffee index 74b1179..b655f33 100644 --- a/src/core/tags/LabelTag.coffee +++ b/src/core/tags/LabelTag.coffee @@ -4,12 +4,17 @@ class LabelTag extends Ant.OS.GUI.BaseTag @setopt "color", undefined @setopt "icon", undefined @setopt "iconclass", undefined + @setopt "class", undefined @refs.text = document.createTextNode "" $(@refs.container).append @refs.text @setopt "text", "" mount: () -> + __class__: (v) -> + $(@root).removeClass() + $(@root).addClass v if v + __color__: (v) -> return unless v $(@refs.container).css "color", v @@ -29,6 +34,7 @@ class LabelTag extends Ant.OS.GUI.BaseTag $(@refs.iclass).removeClass() if v $(@refs.iclass).addClass v + $(@refs.iclass).css "margin-right", "5px" $(@refs.iclass).show() else $(@refs.iclass).hide() diff --git a/src/core/tags/ListViewTag.coffee b/src/core/tags/ListViewTag.coffee index fb22428..67222c3 100644 --- a/src/core/tags/ListViewTag.coffee +++ b/src/core/tags/ListViewTag.coffee @@ -76,6 +76,7 @@ class ListViewTag extends Ant.OS.GUI.BaseTag @setopt "multiselect", false @setopt "selectedItem", undefined @setopt "selectedItems", [] + @setopt "selected", -1 $(@root) .css "display", "flex" .css "flex-direction", "column" @@ -84,6 +85,8 @@ class ListViewTag extends Ant.OS.GUI.BaseTag @root.remove = (e) -> me.remove e @root.unshift = (e) -> me.unshift e @root.unselect = () -> me.unselect() + @root.selectNext = () -> me.selectNext() + @root.selectPrev = () -> me.selectPrev() multiselect: () -> return false if @get "dropdown" @@ -130,6 +133,26 @@ class ListViewTag extends Ant.OS.GUI.BaseTag data.splice data.indexOf(el), 1 $(item).remove() + selectNext: () -> + return if @multiselect() + el = @get "selectedItem" + idx = 0 + idx = $(el).index() + 1 if el + @set "selected", idx + + selectPrev: () -> + return if @multiselect() + el = @get "selectedItem" + idx = 0 + idx = $(el).index() - 1 if el + @set "selected", idx + + __selected__: (idx) -> + return @unselect() if idx < 0 + data = @get "data" + return if idx >= data.length + data[idx].domel.set "selected", true + __buttons__: (v) -> return if @get "dropdown" diff --git a/src/core/tags/OverlayTag.coffee b/src/core/tags/OverlayTag.coffee index 3e583cf..721e4ee 100644 --- a/src/core/tags/OverlayTag.coffee +++ b/src/core/tags/OverlayTag.coffee @@ -1,24 +1,34 @@ class OverlayTag extends Ant.OS.GUI.BaseTag constructor: (r, o) -> super r, o - @setopt "width", 200 - @setopt "height", 400 - + @setopt "width", undefined + @setopt "height", undefined + $(@refs.yield) + .css("position", "relative") + .css("width", "100%" ) + .css("height", "100%") + $(@root) + .css("position", "absolute") + .css "z-index", 1000000 + #.css "display", "flex" + #.css "flex-direction", "column" + #$(@refs.yield).css "flex", "1" + __width__: (v) -> + return unless v @calibrate() __height__: (v) -> + return unless v @calibrate() mount: () -> - $(@root) - .css("position", "absolute") @calibrate() calibrate: () -> $(@root) - .css("width", @get("width") + "px") - .css("height", @get("height") + "px") + .css("width", @get("width") ) + .css("height", @get("height")) @observable.trigger "resize", { id: @aid(), data: { @@ -28,6 +38,7 @@ class OverlayTag extends Ant.OS.GUI.BaseTag } layout: () -> - @refs.yield = @roots - [] + [{ + el: "afx-vbox", ref: "yield" + }] Ant.OS.GUI.define "afx-overlay", OverlayTag \ No newline at end of file diff --git a/src/core/tags/SystemPanelTag.coffee b/src/core/tags/SystemPanelTag.coffee index 32a3f93..e897da2 100644 --- a/src/core/tags/SystemPanelTag.coffee +++ b/src/core/tags/SystemPanelTag.coffee @@ -2,11 +2,15 @@ class SystemPanelTag extends Ant.OS.GUI.BaseTag constructor: (r, o) -> super r, o me = @ - @setopt "osmenu", { children: [] } + @setopt "osmenu", { + text: __("Start"), + iconclass: "fa fa-eercast" + } @setopt "appmenu", [] @setopt "systray", [] @root.attachservice = (s) -> me.attachservice s @root.detachservice = (s) -> me.detachservice s + @view = false __osmenu__: (v) -> @refs.osmenu.set "items", [v] @@ -15,28 +19,144 @@ class SystemPanelTag extends Ant.OS.GUI.BaseTag @refs.appmenu.set "items", v __systray__: (v) -> - @refs.systray.set "items", [v] + @refs.systray.set "items", v attachservice: (s) -> @refs.systray.unshift s s.attach @refs.systray + open: () -> + el = @refs.applist.get "selectedItem" + return unless el + data = el.get("data") + return if not data or data.dataid is "header" + @toggle false + # launch the app or open the file + Ant.OS.GUI.openWith data + + search: (e) -> + switch e.which + when 37 + e.preventDefault() + when 38 + @refs.applist.selectPrev() + e.preventDefault() + when 39 + e.preventDefault() + when 40 + @refs.applist.selectNext() + e.preventDefault() + when 13 + e.preventDefault() + @open() + else + text = @refs.search.value + return @refreshAppList() unless text.length >= 3 + result = Ant.OS.API.search text + return if result.length is 0 + @refs.applist.set "data", result + detachservice: (s) -> - @refs.systray.remove s + @refs.systray.remove s.domel layout: () -> - [{ - el: "div", children: [ - { el: "afx-menu", id: "osmenu", ref: "osmenu", class: "afx-panel-os-menu" }, - { el: "afx-menu", id: "appmenu", ref: "appmenu", class: "afx-panel-os-app" }, - { el: "afx-menu", id: "systray", ref: "systray", class: "afx-panel-os-stray" } - ] - }] + [ + { + el: "div", ref: "panel", children: [ + { el: "afx-menu", ref: "osmenu", class: "afx-panel-os-menu" }, + { el: "afx-menu", id: "appmenu", ref: "appmenu", class: "afx-panel-os-app" }, + { el: "afx-menu", id: "systray", ref: "systray", class: "afx-panel-os-stray" } + ] + }, + { + el: "afx-overlay", id: "start-panel", ref: "overlay", children: [ + { + el: "afx-hbox", height: 30, children: [ + { el: "div", width: 30, id: "searchicon" }, + { el: "input", ref: "search" } + ] + }, + { el: "afx-list-view", id: "applist", ref: "applist" }, + { + el: "afx-hbox", id: "btlist", height: 30, children: [ + { + el: "afx-button", + ref: "btscreen", + tooltip: __("ct:Toggle fullscreen") + }, + { + el: "afx-button", + ref: "btuser", + tooltip: __("ct:User: {0}", Ant.OS.setting.user.username) + }, + { el: "afx-button", ref: "btlogout", tooltip: __("ct:Logout") } + ] + } + ] + } + ] + refreshAppList: () -> + list = [] + list.push v for k, v of Ant.OS.setting.system.packages when (v and v.app) + list.push v for k, v of Ant.OS.setting.system.menu + @refs.applist.set "data", list + + toggle: (flag) -> + if flag + @refreshAppList() + $(@refs.overlay).show() + @calibrate() + $(document).on "click", @cb + @refs.search.value = "" + $(@refs.search).focus() + else + $(@refs.overlay).hide() + $(document).unbind "click", @cb + + calibrate: () -> + @refs.overlay.set "height", "#{$(window).height() - $(@refs.panel).height()}px" + mount: () -> - $(@refs.osmenu).css("z-index", 1000000) + me = @ + @cb = (e) -> + if not ($ e.target).closest($ me.refs.overlay).length and not ($ e.target).closest(me.refs.osmenu).length + me.toggle false + else + $(me.refs.search).focus() $(@refs.appmenu).css("z-index", 1000000) $(@refs.systray).css("z-index", 1000000) + @refs.btscreen.set "*", { + iconclass: "fa fa-tv", + onbtclick: (e) -> + me.toggle false + Ant.OS.GUI.toggleFullscreen() + } + @refs.btuser.set "*", { + iconclass: "fa fa-user-circle-o", + onbtclick: (e) -> + me.toggle false + Ant.OS.GUI.openDialog("InfoDialog", Ant.OS.setting.user) + } + @refs.btlogout.set "*", { + iconclass: "fa fa-power-off", + onbtclick: (e) -> + me.toggle false + Ant.OS.exit() + } + @refs.osmenu.set "onmenuselect", (e) -> + me.toggle true + + ($ @refs.overlay).css "left", 0 + .css "top", "#{$(@refs.panel).height()}px" + .css "bottom", "0" + .hide() + ($ @refs.search).keyup (e) -> + me.search e + + $(@refs.applist).click (e) -> + me.open() + Ant.OS.announcer.trigger("syspanelloaded") Ant.OS.GUI.define "afx-sys-panel", SystemPanelTag \ No newline at end of file diff --git a/src/core/tags/tag.coffee b/src/core/tags/tag.coffee index 64a19cd..471e76f 100644 --- a/src/core/tags/tag.coffee +++ b/src/core/tags/tag.coffee @@ -15,9 +15,10 @@ class Ant.OS.GUI.BaseTag @root.sync = () -> me.sync() @refs = {} @setopt "data-id", (Math.floor(Math.random() * 100000) + 1).toString() + @setopt "tooltip", undefined #$(@root).attr "data-id", @get("data-id") @children = $(@root).children() - + for obj in @layout() dom = @mkui obj if dom @@ -32,6 +33,10 @@ class Ant.OS.GUI.BaseTag @set k, v if v @get k + __tooltip__: (v) -> + return unless v + $(@root).attr "tooltip", v + setopt: (name, val) -> value = val if ($(@root).attr name) @@ -78,6 +83,9 @@ class Ant.OS.GUI.BaseTag dom = $("<#{tag.el}>") $(dom).addClass tag.class if tag.class $(dom).attr "data-id", tag.id if tag.id + $(dom).attr "data-height", tag.height if tag.height + $(dom).attr "data-width", tag.width if tag.width + $(dom).attr "tooltip", tag.tooltip if tag.tooltip if tag.children $(@mkui(v)).appendTo(dom) for v in tag.children if tag.ref diff --git a/src/index.html b/src/index.html index 91c9aaf..bf3e021 100644 --- a/src/index.html +++ b/src/index.html @@ -27,8 +27,6 @@ - - diff --git a/src/libs/riot.compiler.min.js b/src/libs/riot.compiler.min.js deleted file mode 100644 index 0837389..0000000 --- a/src/libs/riot.compiler.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* Riot v3.8.1, @license MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.riot=t()}(this,function(){"use strict";function e(e,t){return[].slice.call((t||document).querySelectorAll(e))}function t(e,t){return(t||document).querySelector(e)}function n(){return document.createDocumentFragment()}function r(){return document.createTextNode("")}function i(e){var t=e.ownerSVGElement;return!!t||null===t}function o(e){return"svg"===e?document.createElementNS(Ke,e):document.createElement(e)}function s(e,t,n){if(n){var r=e.ownerDocument.importNode((new DOMParser).parseFromString(''+t+"","application/xml").documentElement,!0);e.appendChild(r)}else e.innerHTML=t}function a(e,t){e.style.display=t?"":"none",e.hidden=!t}function u(e,t){e.removeAttribute(t)}function c(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function l(e,t){return e.getAttribute(t)}function f(e,t,n){var r=We.exec(t);r&&r[1]?e.setAttributeNS(Ge,r[1],n):e.setAttribute(t,n)}function p(e,t,n){e.insertBefore(t,n.parentNode&&n)}function d(e,t){if(e)for(var n;n=Xe.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function h(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,h(e,t,i),e=r}}function g(e){return et.test(e)}function m(e){return typeof e===Ze}function v(e){return e&&typeof e===qe}function x(e){return typeof e===De}function y(e){return typeof e===Be}function b(e){return _(e)||""===e}function _(e){return x(e)||null===e}function w(e){return Array.isArray(e)||e instanceof Array}function O(e,t){var n=gt(e,t);return x(e[t])||n&&n.writable}function j(e,t){for(var n=e?e.length:0,r=0;rr;)(function(e,t){e.splice(t,1),this.unmount(),re(this.parent,this,this.__.tagName,!0)}).apply(t[--n],[t,n])}function P(e,t,i){var o,s=typeof l(e,Fe)!==Be||u(e,Fe),a=l(e,Ue),c=!!a&&ft.hasExpr(a),f=te(e),d=Te[f],h=e.parentNode,g=r(),m=J(e),v=l(e,Pe),x=[],b=e.innerHTML,_=!Te[f],O="VIRTUAL"===e.tagName,N=[];return u(e,$e),u(e,Ue),i=ft.loopKeys(i),i.isLoop=!0,v&&u(e,Pe),h.insertBefore(g,e),h.removeChild(e),i.update=function(){i.value=ft(i.val,t);var r=i.value,u=n(),l=!w(r)&&!y(r),h=g.parentNode,C=[];h&&(l?r=(o=r||!1)?Object.keys(r).map(function(e){return R(i,r[e],e)}):[]:o=!1,v&&(r=r.filter(function(e,n){return i.key&&!l?!!ft(v,R(i,e,n,t)):!!ft(v,T(Object.create(t),e))})),j(r,function(n,l){var g=!o&&i.key?R(i,n,l):n,v=function(e,t,n,r){return e?r?ft(e,n):t[e]:t}(a,n,g,c),y=s&&typeof n===qe&&!o,w=N.indexOf(v),S=-1===w,A=!S&&y?w:l,T=x[A],k=l>=N.length,L=y&&S||!y&&!T;L?((T=W(d,{parent:t,isLoop:!0,isAnonymous:_,tagName:f,root:e.cloneNode(_),item:g,index:l},b)).mount(),k?function(e,t){t?se.call(this,e):e.appendChild(this.root)}.apply(T,[u||h,O]):function(e,t,n){n?se.apply(this,[e,t]):p(e,this.root,t.root)}.apply(T,[h,x[l],O]),k||N.splice(l,0,g),x.splice(l,0,T),m&&ne(t.tags,f,T,!0)):A!==l&&y&&((a||E(r,N[A]))&&(function(e,t,n){n?ue.apply(this,[e,t]):p(e,this.root,t.root)}.apply(T,[h,x[l],O]),x.splice(l,0,x.splice(A,1)[0]),N.splice(l,0,N.splice(A,1)[0])),i.pos&&(T[i.pos]=l),!m&&T.tags&&function(e){var t=this;j(Object.keys(this.tags),function(n){Q.apply(t.tags[n],[n,e])})}.call(T,l)),T.__.item=g,T.__.index=l,T.__.parent=t,C[l]=v,L||T.update(g)}),M(r,x),N=C.slice(),h.insertBefore(u,g))},i.unmount=function(){j(x,function(e){e.unmount()})},i}function $(e,t){var n=this,r=[];return h(e,function(i){var o,s,a=i.nodeType;if((t||i!==e)&&(3===a&&"STYLE"!==i.parentNode.tagName&&ft.hasExpr(i.nodeValue)&&r.push({dom:i,expr:i.nodeValue}),1===a)){var u="VIRTUAL"===i.tagName;if(o=l(i,$e))return u&&f(i,"loopVirtual",!0),r.push(P(i,n,o)),!1;if(o=l(i,Pe))return r.push(Object.create(xt).init(i,n,o)),!1;if((o=l(i,Me))&&ft.hasExpr(o))return r.push({isRtag:!0,expr:o,dom:i,attrs:[].slice.call(i.attributes)}),!1;if(s=J(i),u&&(l(i,"virtualized")&&i.parentElement.removeChild(i),s||l(i,"virtualized")||l(i,"loopVirtual")||(s={tmpl:i.outerHTML})),s&&(i!==e||t)){if(!u)return r.push(X(s,{root:i,parent:n},i.innerHTML,n)),!1;l(i,Me)&&A("Virtual tags shouldn't be used together with the \""+Me+'" attribute - https://github.com/riot/riot/issues/2511'),f(i,"virtualized",!0);var c=W({tmpl:i.outerHTML},{root:i,parent:n},i.innerHTML);r.push(c)}F.apply(n,[i,i.attributes,function(e,t){t&&r.push(t)}])}}),r}function F(e,t,n){var r=this;j(t,function(t){if(!t)return!1;var i,o=t.name,s=g(o);E(Re,o)&&e.tagName.toLowerCase()!==ke?i=Object.create(yt).init(e,r,o,t.value):ft.hasExpr(t.value)&&(i={dom:e,expr:t.value,attr:o,bool:s}),n(t,i)})}function z(e,n,r){var i=e&&e.match(/^\s*<([-\w]+)/),a=i&&i[1].toLowerCase(),u=o(r?Ct:Nt);return e=function(e,t){if(!bt.test(e))return e;var n={};return t=t&&t.replace(wt,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(Ot,function(e,t,r){return n[t]||r||""}).replace(_t,function(e,n){return t||n||""})}(e,n),Et.test(a)?u=function(e,n,r){var i="o"===r[0],o=i?"select>":"table>";if(e.innerHTML="<"+o+n.trim()+""}),!t.whitespace){var r=[];/]/.test(e)&&(e=e.replace(on,function(e){return r.push(e),""})),e=e.trim().replace(/\s+/g," "),r.length&&(e=e.replace(/\u0002/g,function(){return r.shift()}))}return t.compact&&(e=e.replace(tn,"><$1")),ge(e,n).replace(un,"")}function ve(e){var t,n,r,i,o,s,a=[],u=RegExp,c=function(e,t){for(var n,r,i,o,s,a,u=new RegExp(Gt,"g"),c=lt.skipRegex,l=0|t,f=[[]],p=[],d=u,h=d.lastIndex=l;a=d.exec(e);){if(o=a.index,s=d.lastIndex,r="",i=a[1]){if("{"===i)p.push("}");else if("}"===i){if(p.pop()!==i)throw new Error("Unexpected '}'");"`"===p[p.length-1]&&(i=p.pop())}else"/"===i&&(s=c(e,o))>o+1&&(r=e.slice(o,s));"`"===i&&(s=fe(e,s,p),r=e.slice(o,s),d=p.length?n||(n=new RegExp(Kt,"g")):u)}else"/"===(r=a[0])[0]?(r="*"===r[1]?" ":"",e=e.slice(l,o)+r+e.slice(s),s=o+r.length,r=""):2===r.length&&(r="");r&&(f[0].push(e.slice(h,o)),f.push(r),h=s),d.lastIndex=s}return f[0].push(e.slice(h)),f}(e);for(e=c.shift().join("<%>");t=e.match(gn);)a.push(u.leftContext),r=function(e){for(var t=/[{}]/g,n=1;n&&t.exec(e);)"{"===e[t.lastIndex-1]?++n:--n;return n?e.length:t.lastIndex}(e=u.rightContext),i=t[1],o=t[2]||"",s=t[3],s=(n=!/^(?:if|while|for|switch|catch|function)$/.test(s))?t[0].replace(i,"this."+s+" ="+o+" function"):t[0],a.push(s,e.slice(0,r)),e=e.slice(r),n&&!/^\s*.\s*bind\b/.test(e)&&a.push(".bind(this)");return a.length&&(e=a.join("")+e),c.length&&(e=e.replace(/<%>/g,function(){return c.shift()})),e}function xe(e,t,n,r,i){if(!/\S/.test(e))return"";n||(n=t.type);return(t.parser||n&&Dt._req("js."+n,!0)||ve)(e,r,i).replace(/\r\n?/g,"\n").replace(un,"")}function ye(e,t,n,r){if(r=r||{},n&&"css"!==n){e=Dt._req("css."+n,!0)(t,e,r.parserOpts||{},r.url)}return e=e.replace(lt.R_MLCOMMS,"").replace(/\s+/g," ").trim(),t&&(e=function(e,t){return t.replace(mn,function(t,n,r){return r?(r=r.replace(/[^,]+/g,function(t){var n=t.trim();return 0===n.indexOf(e)?t:n&&"from"!==n&&"to"!==n&&"%"!==n.slice(-1)?n=n.indexOf(":scope")<0?e+" "+n+',[data-is="'+e+'"] '+n:n.replace(":scope",e)+","+n.replace(":scope",'[data-is="'+e+'"]'):t}),n?n+" "+r:r):t})}(t,e)),e}function be(e,t){return e?(e=hn+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+hn,t&&-1!==e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function _e(e){if(e){var t=e.match(vn);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function we(e,t){if(e){var n=e.match(RegExp("\\s"+t+xn,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function Oe(e){var t=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}(we(e,"options"));return t?JSON.parse(t):null}function je(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length?t(r.responseText,n,e):Ne.error('"'+e+'" not found'))},r.onerror=function(e){return Ne.error(e)},r.open("GET",e,!0),r.send("")}function Ee(e,t){if(typeof e===Be){var n=o("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function Ne(t,n,r){if(typeof t===Be){if(v(n)&&(r=n,n=!1),/^\s*=0&&/\s/.test(e[t]););return t}var t="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(e,t){return e+t.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,o=/[$\w]/;return function(s,a){var u=/.*/g,c=u.lastIndex=a++,l=u.exec(s)[0].match(i);if(l){var f=c+l[0].length,p=s[c=e(s,c)];if(c<0||~t.indexOf(p))return f;if("."===p)"."===s[c-1]&&(a=f);else if("+"===p||"-"===p)(s[--c]!==p||(c=e(s,c))<0||!o.test(s[c]))&&(a=f);else if(~r.indexOf(p)){for(var d=c+1;--c>=0&&o.test(s[c]););~n.indexOf(s.slice(c+1,d))&&(a=f)}}return a}}(),lt=function(e){function t(e){return e}function n(e,t){return t||(t=x),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?u:"")}function r(e){if(e===g)return m;var t=e.split(" ");if(2!==t.length||f.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(p,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:m[4],t),t[5]=n(e.length>3?/\\({|})/g:m[5],t),t[6]=n(m[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+d,u),t[8]=e,t}function i(e){return e instanceof RegExp?s(e):x[e]}function o(e){(e||(e=g))!==x[8]&&(x=r(e),s=e===g?t:n,x[9]=s(m[9])),v=e}var s,a,u="g",c=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,l=c.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,f=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),p=/(?=[[\]()*+?.^$|])/g,d=c.source+"|"+/(\/)(?![*\/])/.source,h={"(":RegExp("([()])|"+d,u),"[":RegExp("([[\\]])|"+d,u),"{":RegExp("([{}])|"+d,u)},g="{ }",m=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+d,u),g,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],v=void 0,x=[];return i.split=function(e,t,n){function r(e){g&&(e=g+e,g=""),t||s?f.push(e&&e.replace(n[5],"$1")):f.push(e)}function i(n,r,i){return i&&(r=ct(e,n)),t&&r>n+2&&(c="⁗"+d.length+"~",d.push(e.slice(n,r)),g+=e.slice(a,n)+c,a=r),r}n||(n=x);var o,s,a,u,c,l,f=[],p=n[6],d=[],g="";for(s=a=p.lastIndex=0;o=p.exec(e);){if(l=p.lastIndex,u=o.index,s){if(o[2]){var m=o[2],v=h[m],y=1;for(v.lastIndex=l;o=v.exec(e);)if(o[1]){if(o[1]===m)++y;else if(!--y)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);p.lastIndex=y?e.length:v.lastIndex;continue}if(!o[3]){p.lastIndex=i(u,l,o[4]);continue}}o[1]||(r(e.slice(a,u)),a=p.lastIndex,(p=n[6+(s^=1)]).lastIndex=a)}return e&&a2||r[0]){var a,u,c=[];for(a=u=0;a %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:s,tmpl:n})):n}function t(e,t,r){if(e=e.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,o=[],u=0;e&&(i=e.match(s))&&!i.index;){var c,l,f=/,|([[{(])|$/g;for(e=RegExp.rightContext,c=i[2]?r[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];l=(i=f.exec(e))[1];)!function(t,n){var r,i=1,o=a[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}(l,f);l=e.slice(0,i.index),e=RegExp.rightContext,o[u++]=n(l,1,c)}e=u?u>1?"["+o.join(",")+'].join(" ").trim()':o[0]:n(e,t)}return e}function n(e,t,n){var r;return e=e.replace(c,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+u+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!l.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var r={};e.hasExpr=lt.hasExpr,e.loopKeys=lt.loopKeys,e.clearCache=function(){r={}},e.errorHandler=null;var i=/\u2057/g,o=/\u2057(\d+)~/g,s=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,a={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},u='"in this?this:'+("object"!=typeof window?"global":"window")+").",c=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,l=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=lt.version="v3.0.8",e}(),pt=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],s=0;i=o&&o[s];++s)i==r&&o.splice(s--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,s,a=arguments,u=arguments.length-1,c=new Array(u);for(s=0;s|>([\S\s]*?)<\/yield\s*>|>)/gi,wt=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,Ot=/|>([\S\s]*?)<\/yield\s*>)/gi,jt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},Et=tt&&tt<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,Nt="div",Ct="svg",St={},At=St[Le]={},Tt=0,kt=Object.freeze({Tag:H,tag:U,tag2:V,mount:B,mixin:q,update:D,unregister:Z,version:"v3.8.1"}),Lt=Object.freeze({getTag:J,moveChildTag:Q,initChildTag:X,getImmediateCustomParentTag:Y,unmountAll:ee,getTagName:te,arrayishAdd:ne,arrayishRemove:re,mountTo:ie,makeReplaceVirtual:oe,makeVirtual:se,inheritParentProps:ae,moveVirtual:ue,selectTags:ce}),It=vt,Rt={tmpl:ft,brackets:lt,styleManager:ut,vdom:Ae,styleNode:ut.styleNode,dom:nt,check:dt,misc:mt,tags:Lt},Mt=H,Pt=U,$t=V,Ft=B,zt=q,Ht=D,Ut=Z,Vt=pt,Bt=T({},kt,{observable:pt,settings:It,util:Rt}),qt=Object.freeze({settings:It,util:Rt,Tag:Mt,tag:Pt,tag2:$t,mount:Ft,mixin:zt,update:Ht,unregister:Ut,version:"v3.8.1",observable:Vt,default:Bt}),Dt=function(e){function t(t){var n=e[t];if(n)return n;throw new Error('Parser "'+t+'" not loaded.')}function n(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function r(e,r,i,o){return i=n({pretty:!0,filename:o,doctype:"html"},i),t(e).render(r,i)}var i={};return i.html={jade:function(e,t,n){return console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in riot@3.0.0!'),r("jade",e,t,n)},pug:function(e,t,n){return r("pug",e,t,n)}},i.css={less:function(e,r,i,o){var s;return i=n({sync:!0,syncImport:!0,filename:o},i),t("less").render(r,i,function(e,t){if(e)throw e;s=t.css}),s}},i.js={es6:function(e,r,i){return t("Babel").transform(e,n({plugins:[["transform-es2015-template-literals",{loose:!0}],"transform-es2015-literals","transform-es2015-function-name","transform-es2015-arrow-functions","transform-es2015-block-scoped-functions",["transform-es2015-classes",{loose:!0}],"transform-es2015-object-super","transform-es2015-shorthand-properties","transform-es2015-duplicate-keys",["transform-es2015-computed-properties",{loose:!0}],["transform-es2015-for-of",{loose:!0}],"transform-es2015-sticky-regex","transform-es2015-unicode-regex","check-es2015-constants",["transform-es2015-spread",{loose:!0}],"transform-es2015-parameters",["transform-es2015-destructuring",{loose:!0}],"transform-es2015-block-scoping","transform-es2015-typeof-symbol",["transform-es2015-modules-commonjs",{allowTopLevelThis:!0}],["transform-regenerator",{async:!1,asyncGenerators:!1}]]},r)).code},buble:function(e,r,i){return r=n({source:i,modules:!1},r),t("buble").transform(e,r).code},coffee:function(e,r){return t("CoffeeScript").compile(e,n({bare:!0},r))},livescript:function(e,r){return t("livescript").compile(e,n({bare:!0,header:!1},r))},typescript:function(e,n){return t("typescript")(e,n)},none:function(e){return e}},i.js.javascript=i.js.none,i.js.coffeescript=i.js.coffee,i._req=function(e){var t=e.split(".");if(2!==t.length)throw new Error("Bad format for parsers._req");var n=i[t[0]][t[1]];if(n)return n;throw new Error('Parser "'+e+'" not found.')},i.utils={extend:n},i}(window||global),Zt=/'[^'\n\r\\]*(?:\\(?:\r\n?|[\S\s])[^'\n\r\\]*)*'/.source,Gt=[/\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//.source,"//.*",Zt,Zt.replace(/'/g,'"'),"([/`])"].join("|"),Kt=Gt.slice(0,-2)+"{}])",Wt=Dt.utils.extend,Jt=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,Qt=lt.R_STRINGS.source,Xt=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,Yt=RegExp(//.source+"|"+Jt,"g"),en=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"/>]*)*)|\s*)(\/?)>/g,tn=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,nn=["style","src","d","value"],rn=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,on=/]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,sn=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,an=/^\s*import(?!\w)(?:(?:\s|[^\s'"])*)['|"].*\n?/gm,un=/[ \t]+$/gm,cn=le(/@#\d/,"x01"),ln=le(/@#(\d+)/g,"x01"),fn="#",pn="⁗",dn='"',hn="'",gn=/^[ \t]*(((?:async|\*)\s*)?([$_A-Za-z][$\w]*))\s*\([^()]*\)\s*{/m,mn=RegExp("([{}]|^)[; ]*((?:[^@ ;{}][^{}]*)?[^@ ;{}:] ?)(?={)|"+Jt,"g"),vn=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,xn="\\s*=\\s*("+Qt+"|{[^}]+}|\\S+)",yn=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,bn=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"/>]+(?:(?:@|\/[^>])[^'"/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",Qt),"gim"),_n=/]*)?>\n?([\S\s]*?)<\/script\s*>/gi,wn=/]*)?>\n?([\S\s]*?)<\/style\s*>/gi,On={compile:function(e,t,n){var r,i=[],o=e;t||(t={}),t.parserOptions=Wt({template:{},js:{},style:{}},t.parserOptions||{}),r=t.exclude?function(e){return t.exclude.indexOf(e)<0}:function(){return 1},n||(n="");var s=lt.array(t.brackets);return t.template&&(o=function(e,t,n,r){return Dt._req("html."+n,!0)(e,r,t)}(o,n,t.template,t.parserOptions.template)),o=pe(o).replace(bn,function(e,o,a,u,c,l){var f="",p="",d="",h="",g=[];if(g._bp=s,a=a.toLowerCase(),u=u&&r("attribs")?ge(de(he(u,t,g),g),g):"",(c||(c=l))&&/\S/.test(c))if(l)r("html")&&(d=me(l,t,g));else{var m=function(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;-1!==n;){if(t=e.slice(n,r).match(yn))return n+=t.index+t[0].length,"<-/>\n"===(t=e.slice(0,n)).slice(-5)&&(t=t.slice(0,-5)),[t,e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}((c=(c=(c=c.replace(RegExp("^"+o,"gm"),"")).replace(_n,function(e,i,o){if(r("js")){var s=function(e,t,n,r){var i=_e(n),o=we(n,"src"),s=Wt({},t.parserOptions.js);return!o&&xe(e,t,i,Wt(s,Oe(n)),r)}(o,t,i,n);s&&(f+=(f?"\n":"")+s)}return""})).replace(wn,function(e,i,o){return r("css")&&(p+=(p?" ":"")+function(e,t,n,r,i){var o=Wt({},t.parserOptions.style),s={parserOpts:Wt(o,Oe(n)),url:r};return ye(e,i,_e(n)||t.style,s)}(o,t,i,n,a)),""})).replace(un,""));r("html")&&(d=me(m[0],t,g)),r("js")&&((c=xe(m[1],t,null,null,n))&&(f+=(f?"\n":"")+c),f=f.replace(an,function(e){return h+=e.trim()+"\n",""}))}return f=/\S/.test(f)?f.replace(/\n{3,}/g,"\n\n"):"",t.entities?(i.push({tagName:a,html:d,css:p,attribs:u,js:f,imports:h}),""):function(e,t,n,r,i,o,s){var a=s.debug?",\n ":", ",u="});";return i&&"\n"!==i.slice(-1)&&(u="\n"+u),o+"riot.tag2('"+e+hn+a+be(t,1)+a+be(n)+a+be(r)+", function(opts) {\n"+i+u}(a,d,p,u,f,h,t)}),t.entities?i:o},compileHTML:function(e,t,n){return Array.isArray(t)?(n=t,t={}):(n||(n=[]),t||(t={})),n._bp=lt.array(t.brackets),me(pe(e),t,n)},compileCSS:function(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),ye(e,n.tagName,t,n)},compileJS:function(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),xe(e,t||{},n,r.parserOptions,r.url)},parsers:Dt,version:"v3.4.0"},jn=On.parsers;Ne.error=function(e){throw new Error(e)};return T({},qt,{mount:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n;return Ne(function(){n=Ft.apply(qt,e)}),n},compile:Ne,parsers:jn})}); diff --git a/src/libs/riot.min.js b/src/libs/riot.min.js deleted file mode 100644 index 3c865ed..0000000 --- a/src/libs/riot.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* Riot v3.8.1, @license MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.riot={})}(this,function(e){"use strict";function t(e,t){return[].slice.call((t||document).querySelectorAll(e))}function n(e,t){return(t||document).querySelector(e)}function r(){return document.createDocumentFragment()}function i(){return document.createTextNode("")}function o(e){var t=e.ownerSVGElement;return!!t||null===t}function a(e){return"svg"===e?document.createElementNS(Me,e):document.createElement(e)}function s(e,t,n){if(n){var r=e.ownerDocument.importNode((new DOMParser).parseFromString(''+t+"","application/xml").documentElement,!0);e.appendChild(r)}else e.innerHTML=t}function u(e,t){e.style.display=t?"":"none",e.hidden=!t}function l(e,t){e.removeAttribute(t)}function c(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function f(e,t){return e.getAttribute(t)}function p(e,t,n){var r=Se.exec(t);r&&r[1]?e.setAttributeNS(ke,r[1],n):e.setAttribute(t,n)}function d(e,t,n){e.insertBefore(t,n.parentNode&&n)}function h(e,t){if(e)for(var n;n=Re.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function g(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,g(e,t,i),e=r}}function m(e){return Ve.test(e)}function v(e){return typeof e===Le}function y(e){return e&&typeof e===Te}function _(e){return typeof e===Ae}function x(e){return typeof e===je}function b(e){return w(e)||""===e}function w(e){return _(e)||null===e}function N(e){return Array.isArray(e)||e instanceof Array}function O(e,t){var n=Je(e,t);return _(e[t])||n&&n.writable}function C(e,t){for(var n=e?e.length:0,r=0;rr;)(function(e,t){e.splice(t,1),this.unmount(),ie(this.parent,this,this.__.tagName,!0)}).apply(t[--n],[t,n])}function $(e,t,n){var o,a=typeof f(e,we)!==je||l(e,we),s=f(e,Ce),u=!!s&&We.hasExpr(s),c=ne(e),p=he[c],h=e.parentNode,g=i(),m=J(e),v=f(e,xe),y=[],_=e.innerHTML,b=!he[c],w="VIRTUAL"===e.tagName,O=[];return l(e,be),l(e,Ce),n=We.loopKeys(n),n.isLoop=!0,v&&l(e,xe),h.insertBefore(g,e),h.removeChild(e),n.update=function(){n.value=We(n.val,t);var i=n.value,l=r(),f=!N(i)&&!x(i),h=g.parentNode,j=[];h&&(f?i=(o=i||!1)?Object.keys(i).map(function(e){return P(n,i[e],e)}):[]:o=!1,v&&(i=i.filter(function(e,r){return n.key&&!f?!!We(v,P(n,e,r,t)):!!We(v,k(Object.create(t),e))})),C(i,function(r,f){var g=!o&&n.key?P(n,r,f):r,v=function(e,t,n,r){return e?r?We(e,n):t[e]:t}(s,r,g,u),x=a&&typeof r===Te&&!o,N=O.indexOf(v),T=-1===N,A=!T&&x?N:f,L=y[A],k=f>=O.length,M=x&&T||!x&&!L;M?((L=Q(p,{parent:t,isLoop:!0,isAnonymous:b,tagName:c,root:e.cloneNode(b),item:g,index:f},_)).mount(),k?function(e,t){t?se.call(this,e):e.appendChild(this.root)}.apply(L,[l||h,w]):function(e,t,n){n?se.apply(this,[e,t]):d(e,this.root,t.root)}.apply(L,[h,y[f],w]),k||O.splice(f,0,g),y.splice(f,0,L),m&&re(t.tags,c,L,!0)):A!==f&&x&&((s||E(i,O[A]))&&(function(e,t,n){n?le.apply(this,[e,t]):d(e,this.root,t.root)}.apply(L,[h,y[f],w]),y.splice(f,0,y.splice(A,1)[0]),O.splice(f,0,O.splice(A,1)[0])),n.pos&&(L[n.pos]=f),!m&&L.tags&&function(e){var t=this;C(Object.keys(this.tags),function(n){X.apply(t.tags[n],[n,e])})}.call(L,f)),L.__.item=g,L.__.index=f,L.__.parent=t,j[f]=v,M||L.update(g)}),R(i,y),O=j.slice(),h.insertBefore(l,g))},n.unmount=function(){C(y,function(e){e.unmount()})},n}function V(e,t){var n=this,r=[];return g(e,function(i){var o,a,s=i.nodeType;if((t||i!==e)&&(3===s&&"STYLE"!==i.parentNode.tagName&&We.hasExpr(i.nodeValue)&&r.push({dom:i,expr:i.nodeValue}),1===s)){var u="VIRTUAL"===i.tagName;if(o=f(i,be))return u&&p(i,"loopVirtual",!0),r.push($(i,n,o)),!1;if(o=f(i,xe))return r.push(Object.create(et).init(i,n,o)),!1;if((o=f(i,_e))&&We.hasExpr(o))return r.push({isRtag:!0,expr:o,dom:i,attrs:[].slice.call(i.attributes)}),!1;if(a=J(i),u&&(f(i,"virtualized")&&i.parentElement.removeChild(i),a||f(i,"virtualized")||f(i,"loopVirtual")||(a={tmpl:i.outerHTML})),a&&(i!==e||t)){if(!u)return r.push(Y(a,{root:i,parent:n},i.innerHTML,n)),!1;f(i,_e)&&L("Virtual tags shouldn't be used together with the \""+_e+'" attribute - https://github.com/riot/riot/issues/2511'),p(i,"virtualized",!0);var l=Q({tmpl:i.outerHTML},{root:i,parent:n},i.innerHTML);r.push(l)}H.apply(n,[i,i.attributes,function(e,t){t&&r.push(t)}])}}),r}function H(e,t,n){var r=this;C(t,function(t){if(!t)return!1;var i,o=t.name,a=m(o);E(ye,o)&&e.tagName.toLowerCase()!==ge?i=Object.create(tt).init(e,r,o,t.value):We.hasExpr(t.value)&&(i={dom:e,expr:t.value,attr:o,bool:a}),n(t,i)})}function U(e,t,r){var i=e&&e.match(/^\s*<([-\w]+)/),o=i&&i[1].toLowerCase(),u=a(r?lt:ut);return e=function(e,t){if(!nt.test(e))return e;var n={};return t=t&&t.replace(it,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(ot,function(e,t,r){return n[t]||r||""}).replace(rt,function(e,n){return t||n||""})}(e,t),st.test(o)?u=function(e,t,r){var i="o"===r[0],o=i?"select>":"table>";if(e.innerHTML="<"+o+t.trim()+"=0&&/\s/.test(e[t]););return t}var t="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(e,t){return e+t.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,o=/[$\w]/;return function(a,s){var u=/.*/g,l=u.lastIndex=s++,c=u.exec(a)[0].match(i);if(c){var f=l+c[0].length,p=a[l=e(a,l)];if(l<0||~t.indexOf(p))return f;if("."===p)"."===a[l-1]&&(s=f);else if("+"===p||"-"===p)(a[--l]!==p||(l=e(a,l))<0||!o.test(a[l]))&&(s=f);else if(~r.indexOf(p)){for(var d=l+1;--l>=0&&o.test(a[l]););~n.indexOf(a.slice(l+1,d))&&(s=f)}}return s}}(),qe=function(e){function t(e){return e}function n(e,t){return t||(t=y),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?u:"")}function r(e){if(e===g)return m;var t=e.split(" ");if(2!==t.length||f.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(p,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:m[4],t),t[5]=n(e.length>3?/\\({|})/g:m[5],t),t[6]=n(m[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+d,u),t[8]=e,t}function i(e){return e instanceof RegExp?a(e):y[e]}function o(e){(e||(e=g))!==y[8]&&(y=r(e),a=e===g?t:n,y[9]=a(m[9])),v=e}var a,s,u="g",l=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,c=l.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,f=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),p=/(?=[[\]()*+?.^$|])/g,d=l.source+"|"+/(\/)(?![*\/])/.source,h={"(":RegExp("([()])|"+d,u),"[":RegExp("([[\\]])|"+d,u),"{":RegExp("([{}])|"+d,u)},g="{ }",m=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+d,u),g,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],v=void 0,y=[];return i.split=function(e,t,n){function r(e){g&&(e=g+e,g=""),t||a?f.push(e&&e.replace(n[5],"$1")):f.push(e)}function i(n,r,i){return i&&(r=Ke(e,n)),t&&r>n+2&&(l="⁗"+d.length+"~",d.push(e.slice(n,r)),g+=e.slice(s,n)+l,s=r),r}n||(n=y);var o,a,s,u,l,c,f=[],p=n[6],d=[],g="";for(a=s=p.lastIndex=0;o=p.exec(e);){if(c=p.lastIndex,u=o.index,a){if(o[2]){var m=o[2],v=h[m],_=1;for(v.lastIndex=c;o=v.exec(e);)if(o[1]){if(o[1]===m)++_;else if(!--_)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);p.lastIndex=_?e.length:v.lastIndex;continue}if(!o[3]){p.lastIndex=i(u,c,o[4]);continue}}o[1]||(r(e.slice(s,u)),s=p.lastIndex,(p=n[6+(a^=1)]).lastIndex=s)}return e&&s2||r[0]){var s,u,l=[];for(s=u=0;s %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}.bind({data:a,tmpl:n})):n}function t(e,t,r){if(e=e.replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var i,o=[],u=0;e&&(i=e.match(a))&&!i.index;){var l,c,f=/,|([[{(])|$/g;for(e=RegExp.rightContext,l=i[2]?r[i[2]].slice(1,-1).trim().replace(/\s+/g," "):i[1];c=(i=f.exec(e))[1];)!function(t,n){var r,i=1,o=s[t];for(o.lastIndex=n.lastIndex;r=o.exec(e);)if(r[0]===t)++i;else if(!--i)break;n.lastIndex=i?e.length:o.lastIndex}(c,f);c=e.slice(0,i.index),e=RegExp.rightContext,o[u++]=n(c,1,l)}e=u?u>1?"["+o.join(",")+'].join(" ").trim()':o[0]:n(e,t)}return e}function n(e,t,n){var r;return e=e.replace(l,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+u+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!c.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var r={};e.hasExpr=qe.hasExpr,e.loopKeys=qe.loopKeys,e.clearCache=function(){r={}},e.errorHandler=null;var i=/\u2057/g,o=/\u2057(\d+)~/g,a=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,s={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},u='"in this?this:'+("object"!=typeof window?"global":"window")+").",l=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,c=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=qe.version="v3.0.8",e}(),Ze=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],a=0;i=o&&o[a];++a)i==r&&o.splice(a--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,a,s=arguments,u=arguments.length-1,l=new Array(u);for(a=0;a|>([\S\s]*?)<\/yield\s*>|>)/gi,it=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,ot=/|>([\S\s]*?)<\/yield\s*>)/gi,at={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},st=He&&He<10?/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/,ut="div",lt="svg",ct={},ft=ct[me]={},pt=0,dt=Object.freeze({Tag:B,tag:z,tag2:F,mount:D,mixin:K,update:q,unregister:W,version:"v3.8.1"}),ht=Object.freeze({getTag:J,moveChildTag:X,initChildTag:Y,getImmediateCustomParentTag:ee,unmountAll:te,getTagName:ne,arrayishAdd:re,arrayishRemove:ie,mountTo:oe,makeReplaceVirtual:ae,makeVirtual:se,inheritParentProps:ue,moveVirtual:le,selectTags:ce}),gt=Ye,mt={tmpl:We,brackets:qe,styleManager:De,vdom:de,styleNode:De.styleNode,dom:Ue,check:Ge,misc:Xe,tags:ht},vt=B,yt=z,_t=F,xt=D,bt=K,wt=q,Nt=W,Ot=Ze,Ct=k({},dt,{observable:Ze,settings:gt,util:mt});e.settings=gt,e.util=mt,e.Tag=vt,e.tag=yt,e.tag2=_t,e.mount=xt,e.mixin=bt,e.update=wt,e.unregister=Nt,e.version="v3.8.1",e.observable=Ot,e.default=Ct,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/src/packages/ActivityMonitor/main.coffee b/src/packages/ActivityMonitor/main.coffee index 8028b5a..c1ae8ea 100644 --- a/src/packages/ActivityMonitor/main.coffee +++ b/src/packages/ActivityMonitor/main.coffee @@ -24,18 +24,34 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication me = @ @scheme.set "apptitle", "Activity Monitor" @grid = @find "mygrid" - @on "btclick", (e)-> + @on "btclick", (e) -> return unless e.id == "btkill" item = me.grid.get "selected" return unless item app = _PM.appByPid item[0].value app.quit(true) if app - header = [{width:50,value: "__(Pid)"},{value:"__(Name)"}, {value:"__(Type)", width:80},{width:75,value: "__(Alive (ms))"}] - @gdata = - processes:{} - alive:[] - @grid.set "header",header + header = [ + { + width: 50, + text: "__(Pid)" + }, + { + text: "__(Name)" + }, + { + text: "__(Type)", + width: 80 + }, + { + width: 75, + text: "__(Alive (ms))" + } + ] + @gdata = + processes: {} + alive: [] + @grid.set "header", header @monitor() monitor: () -> @@ -43,34 +59,40 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication #get all current running process me.gdata.alive = [] now = (new Date).getTime() - $.each _PM.processes, (i,d)-> - $.each d , (j,a)-> + $.each _PM.processes, (i, d) -> + $.each d , (j, a) -> if me.gdata.processes[a.pid] #update it me.gdata.processes[a.pid][3].value = now - a.birth else #add it me.gdata.processes[a.pid] = [ - {value:a.pid}, - {icon:if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon, - iconclass:if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass, - value:a.name}, - {value: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"} - {value: now - a.birth} + { text: a.pid }, + { + icon: if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon, + iconclass: if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass, + text: a.name + }, + { + text: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)" + } + { + text: now - a.birth + } ] - me.gdata.alive.push a.pid + me.gdata.alive.push a.pid @refreshGrid() - @timer = setTimeout (()-> me.monitor()),500#one second + @timer = setTimeout (() -> me.monitor()), 500 - refreshGrid: ()-> + refreshGrid: () -> activeList = [] me = @ - $.each @gdata.processes, (i,e) -> - if ($.inArray (Number i),me.gdata.alive) >= 0 + $.each @gdata.processes, (i, e) -> + if ($.inArray (Number i), me.gdata.alive) >= 0 activeList.push e - else + else me.gdata.processes[i] = undefined - @grid.set "rows",activeList + @grid.set "rows", activeList cleanup: (e) -> clearTimeout @timer if @timer ActivityMonitor.singleton = true -this.OS.register "ActivityMonitor",ActivityMonitor \ No newline at end of file +this.OS.register "ActivityMonitor", ActivityMonitor \ No newline at end of file diff --git a/src/packages/CoreServices/Makefile b/src/packages/CoreServices/Makefile index 1d51ce4..22f2a64 100644 --- a/src/packages/CoreServices/Makefile +++ b/src/packages/CoreServices/Makefile @@ -1,4 +1,4 @@ -coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee UserService.coffee +coffee_files = Calendar.coffee PushNotification.coffee jsfiles = diff --git a/src/packages/CoreServices/PushNotification.coffee b/src/packages/CoreServices/PushNotification.coffee index 28da4b4..a74755a 100644 --- a/src/packages/CoreServices/PushNotification.coffee +++ b/src/packages/CoreServices/PushNotification.coffee @@ -25,8 +25,6 @@ class PushNotification extends this.OS.GUI.BaseService init: -> @view = false @_gui.htmlToScheme PushNotification.scheme, @, @host - #path = path = "#{@meta().path}/notifications.html" - #@render path spin: (b) -> if b and @iconclass is "fa fa-bars" @@ -60,24 +58,19 @@ class PushNotification extends this.OS.GUI.BaseService i = me.pending.indexOf o.id me.pending.splice i, 1 if i >= 0 me.spin false if me.pending.length is 0 - + + @nzone.set "height", "100%" + @fzone.set "height", "100%" + ($ @nzone).css "right", 0 .css "top", "-3px" - .css "height", "100%" .css "bottom", "0" - .css "z-index", 1000000 - .css "display", "flex" - .css "flex-direction", "column" .hide() - ($ @mlist).css "flex", "1" ($ @fzone) #.css("z-index", 99999) .css("bottom", "0") - .css("height", "100%") - .css "display", "flex" - .css "flex-direction", "column" + .css "bottom", "0" .hide() - ($ @mfeed).css "flex", "1" pushout: (s, o, mfeed) -> d = { @@ -96,6 +89,7 @@ class PushNotification extends this.OS.GUI.BaseService ($ @fzone).show() timer = setTimeout () -> me.mfeed.remove d.domel + ($ me.fzone).hide() if me.mfeed.get("data").length is 0 clearTimeout timer , 3000 @@ -117,9 +111,9 @@ class PushNotification extends this.OS.GUI.BaseService cleanup: (evt) -> # do nothing PushNotification.scheme = """ - - - +
+ + diff --git a/src/packages/CoreServices/Spotlight.coffee b/src/packages/CoreServices/Spotlight.coffee deleted file mode 100644 index e234952..0000000 --- a/src/packages/CoreServices/Spotlight.coffee +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright 2017-2018 Xuan Sang LE - -# AnTOS Web desktop is is licensed under the GNU General Public -# License v3.0, see the LICENCE file for more information - -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -#along with this program. If not, see https://www.gnu.org/licenses/. - -class SpotlightDialog extends this.OS.GUI.BaseDialog - constructor: () -> - super "SpotlightDialog" - - init: () -> - #@render "#{@path()}/spotlight.html" - @_gui.htmlToScheme SpotlightDialog.scheme, @, @host - main: () -> - me = @ - @height = ($ @scheme).css("height") - @container = @find "container" - ($ @scheme).css("height", "45px") - @fn = (e) -> - if e.which is 27 - ($ document).unbind "click", me.fn1 - ($ document).unbind "keyup", me.fn - me.handler(e) if me.handler - me.quit() - ($ document).keyup @fn - - @fn1 = (e) -> - return if $(e.target).closest(me.parent.holder).length - if not $(e.target).closest(me.scheme).length - ($ document).unbind "click", me.fn1 - ($ document).unbind "keyup", me.fn - me.handler(e) if me.handler - me.quit() - - ($ document).click @fn1 - @searchbox = @find "searchbox" - ($ @searchbox).focus() - ($ @searchbox).keyup (e) -> - me.search e - @container.set "onlistdbclick", (e) -> - return if e.data.dataid and e.data.dataid is "header" - me.handler(e) if me.handler - me._gui.openWith e.data - ($ document).unbind "click", me.fn1 - ($ document).unbind "keyup", me.fn - me.quit() - - - search: (e) -> - switch e.which - when 37 - e.preventDefault() - when 38 - @container.selectPrev() - e.preventDefault() - when 39 - e.preventDefault() - when 40 - @container.selectNext() - e.preventDefault() - when 13 - e.preventDefault() - sel = @container.get "selected" - return unless sel - return if sel.dataid and sel.dataid is "header" - @.handler(e) if @.handler - @._gui.openWith sel - ($ document).unbind "click", @fn1 - ($ document).unbind "keyup", @fn - @.quit() - else - text = @searchbox.value - ($ @scheme).css("height", "45px") - return unless text.length >= 3 - result = @_api.search text - return if result.length is 0 - @container.set "data", result - console.log result - ($ @scheme).css("height", @height) - -SpotlightDialog.scheme = """ - - - -
- -
- -
-
-""" -this.OS.register "SpotlightDialog", SpotlightDialog - -class Spotlight extends this.OS.GUI.BaseService - constructor: (args) -> - super "Spotlight", args - @iconclass = "fa fa-search" - @show = false - init: -> - me = @ - @_gui.bindKey "CTRL- ", (e) -> - me.awake(e) - - main: -> - - awake: (e) -> - me = @ - if not @show - me.show = true - @openDialog "SpotlightDialog", (d) -> - me.show = false - me.dialog = undefined - else - me.show = false - @dialog.quit() if @dialog - - cleanup: (evt) -> - # do nothing - -this.OS.register "Spotlight", Spotlight \ No newline at end of file diff --git a/src/packages/CoreServices/UserService.coffee b/src/packages/CoreServices/UserService.coffee deleted file mode 100644 index 573b30f..0000000 --- a/src/packages/CoreServices/UserService.coffee +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2017-2018 Xuan Sang LE - -# AnTOS Web desktop is is licensed under the GNU General Public -# License v3.0, see the LICENCE file for more information - -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -#along with this program. If not, see https://www.gnu.org/licenses/. - -class UserService extends this.OS.GUI.BaseService - constructor: (args) -> - super "UserService", args - @text = @systemsetting.user.username - @iconclass = undefined - me = @ - @children = [ - { - text: "__(About)", dataid: "user-about", - iconclass: "fa fa-user-circle-o" - }, - { - text: "__(Logout)", dataid: "sys-logout", - iconclass: "fa fa-user-times", - onmenuselect: (d) -> - me.notify __("This feature is not implemented yet") - } - ] - - init: -> - - awake: (e) -> - - cleanup: (evt) -> - - -this.OS.register "UserService", UserService \ No newline at end of file diff --git a/src/packages/CoreServices/main.css b/src/packages/CoreServices/main.css index 682998f..5cbc1f2 100644 --- a/src/packages/CoreServices/main.css +++ b/src/packages/CoreServices/main.css @@ -48,53 +48,4 @@ afx-list-view[data-id = "notifeed"] li{ -ms-word-break: break-all; word-break: break-all; word-break: break-word; -} - -afx-app-window[data-id = "spotlight-win"] .afx-window-wrapper{ - background-color: white; - border-radius: 0px; - border-top-left-radius: 10px; - border-top-right-radius: 10px; -} - -afx-app-window[data-id = "spotlight-win"] .afx-window-top{ - height: 0; - border:0; -} -afx-app-window[data-id = "spotlight-win"] input{ - border:0; - font-size: 25px; - color:#afafaf; - height: 45px; -} -afx-app-window[data-id = "spotlight-win"] div[data-id="searchicon"]:before{ - content: "\f002"; - padding-top:5px; - padding-left: 10px; - display: block; - background-color: #F6F6F6; - color:#afafaf; - width:40px; - height: 40px; - font-family: "FontAwesome"; - font-size: 30px; -} -afx-app-window[data-id = "spotlight-win"] .afx-window-content{ - border-radius: 10px; -} -afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"]{ - border-top:1px solid #cacaca; -} -afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"] afx-label.search-header{ - font-weight: bold; -} -afx-app-window[data-id = "spotlight-win"] afx-resizer{ - background-color: transparent; - border-left: 1px solid #cacaca; -} -afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"] ul.complex-content li{ - /*padding-left: 20px;*/ - font-style: italic; - color: #b1b1b1; - font-size: 11px; } \ No newline at end of file diff --git a/src/packages/CoreServices/package.json b/src/packages/CoreServices/package.json index eb7f9a7..dbcbc5e 100644 --- a/src/packages/CoreServices/package.json +++ b/src/packages/CoreServices/package.json @@ -1,6 +1,6 @@ { "app":null, - "services": [ "Calendar", "PushNotification", "Spotlight", "UserService" ], + "services": [ "Calendar", "PushNotification" ], "name":"CoreServices", "description":"This is the core services", "info":{ diff --git a/src/packages/ShowCase/assets/scheme.html b/src/packages/ShowCase/assets/scheme.html index ef6ff9b..3772b59 100644 --- a/src/packages/ShowCase/assets/scheme.html +++ b/src/packages/ShowCase/assets/scheme.html @@ -27,18 +27,13 @@ - - - - + - - - + diff --git a/src/packages/ShowCase/coffees/main.coffee b/src/packages/ShowCase/coffees/main.coffee index 5e964d3..9ff0e31 100644 --- a/src/packages/ShowCase/coffees/main.coffee +++ b/src/packages/ShowCase/coffees/main.coffee @@ -114,14 +114,6 @@ class ShowCase extends this.OS.GUI.BaseApplication slider.set "onchanging", (v) -> console.log v - - flist = @find 'flist' - flist.set "data", [ - { text: "File.txt" }, - { text: "FileB.doc" }, - { text: "Data.doc", iconclass: "fa fa-camera-retro fa-lg" } - ] - cal = @find 'cal' cal.set "ondateselect", (e) -> console.log e @@ -220,6 +212,15 @@ class ShowCase extends this.OS.GUI.BaseApplication when "about" me.openDialog("AboutDialog" ) .then (d) -> + when "file" + me.openDialog("FileDialog", { + title: "Select file ?", + #root: "home:///", + mimes: ["text/*", "dir"], + file: "Untitled".asFileHandle() + }) + .then (f, name) -> + console.log f, name else return diff --git a/src/packages/ShowCase/css/main.css b/src/packages/ShowCase/css/main.css index f06ae01..e69de29 100644 --- a/src/packages/ShowCase/css/main.css +++ b/src/packages/ShowCase/css/main.css @@ -1,14 +0,0 @@ -afx-app-window[data-id="example-show-case"] afx-grid-view div.afx-grid-row:nth-child(even) .afx-grid-cell -{ - background-color: #f5F5F5; -} - -afx-app-window[data-id="example-show-case"] afx-grid-view div.afx-grid-row-selected .afx-grid-cell -{ - background-color: #116cd6; - color:white; -} -afx-app-window[data-id="example-show-case"] afx-grid-view div.afx-grid-row-selected .afx-grid-cell-selected -{ - font-weight: bold; -} \ No newline at end of file diff --git a/src/themes/antos/afx-label.css b/src/themes/antos/afx-label.css index 13c9389..b0c7937 100644 --- a/src/themes/antos/afx-label.css +++ b/src/themes/antos/afx-label.css @@ -1,6 +1,10 @@ afx-label i.icon-style { width: 16px; height: 16px; - display: inline-block; float: left; +} + +afx-label i +{ + margin-right: 3px; } \ No newline at end of file diff --git a/src/themes/antos/afx-sys-panel.css b/src/themes/antos/afx-sys-panel.css index fb8e617..3869cb8 100644 --- a/src/themes/antos/afx-sys-panel.css +++ b/src/themes/antos/afx-sys-panel.css @@ -3,7 +3,7 @@ afx-sys-panel{ padding:0; margin: 0; } -afx-sys-panel div{ +afx-sys-panel > div{ width: 100%; height: 23px; margin:0; @@ -13,11 +13,21 @@ afx-sys-panel div{ box-shadow: 1px 1px 1px #9F9F9F; position:absolute; } -afx-sys-panel .afx-panel-os-menu{ +afx-sys-panel .afx-panel-os-menu { padding:0; margin: 0; float:left; } +afx-sys-panel .afx-panel-os-menu li +{ + font-weight: bold; + background-color: #e7414d; + border-top-right-radius: 9px; + border-bottom-right-radius: 9px; +} +afx-sys-panel .afx-panel-os-menu a { + color: white; +} afx-sys-panel .afx-panel-os-stray{ float:right; position: relative; @@ -56,4 +66,68 @@ afx-sys-panel afx-menu.afx-panel-os-stray afx-menu ul{ } afx-sys-panel afx-menu.afx-panel-os-stray afx-menu li{ min-width: 150px; +} + +afx-sys-panel afx-overlay +{ + background-color: #e7e7e7; + overflow-y: auto; + overflow-x: hidden; + border: 1px solid #9c9C9C; + width: 250px; + margin: 0; +} +afx-sys-panel afx-list-view[data-id="applist"] +{ + border-top: 1px solid #afafaf; + border-bottom: 1px solid #afafaf; +} + +afx-sys-panel afx-list-view[data-id="applist"] > div.list-container > ul li +{ + padding-top: 5px; + padding-bottom: 5px; + background-color: transparent; + color: #414339; +} + +afx-sys-panel afx-hbox[data-id="btlist"] afx-button button +{ + width: 100%; + height: 100%; + border-radius: 0; + border: 0px; + border-left: 1px solid #afafaf; +} + +afx-sys-panel afx-list-view[data-id="applist"] > div.list-container > ul li:hover, +afx-sys-panel afx-list-view[data-id="applist"] > div.list-container > ul li.selected +{ + background-color: #116cd6; + color:white; +} + +afx-sys-panel afx-list-view[data-id="applist"] afx-label.search-header { + font-weight: bold; + +} +afx-sys-panel afx-list-view[data-id="applist"] afx-label i, +afx-sys-panel afx-list-view[data-id="applist"] afx-label i::before { + margin-right: 10px; +} + +afx-sys-panel div[data-id="searchicon"]:before{ + content: "\f002"; + display: block; + background-color:transparent; + color:#afafaf; + font-family: "FontAwesome"; + padding-left:3px; + font-size: 25px; +} +afx-sys-panel input{ + border:0; + height: 25px; + color:#afafaf; + background-color: transparent; } \ No newline at end of file diff --git a/src/themes/antos/antos.css b/src/themes/antos/antos.css index 9883304..8202cc1 100644 --- a/src/themes/antos/antos.css +++ b/src/themes/antos/antos.css @@ -7,6 +7,11 @@ html,body{ height: 100%; overflow: hidden; } +/* +*:fullscreen, *:-webkit-full-screen, *:-moz-full-screen { + background-color: transparent; + background: transparent; +}*/ #wrapper{ margin: 0; padding: 0; @@ -90,7 +95,7 @@ html,body{ /*box-shadow: 2px 2px 2px #cbcbcb;*/ box-shadow: 1px 1px 1px #9f9F9F; background-color: #e7e7e7; - z-index: 99999; + z-index: 1000000; } input { outline: none;