mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 17:38:20 +01:00
various changes:
All checks were successful
gitea-sync/antos-frontend/pipeline/head This commit looks good
All checks were successful
gitea-sync/antos-frontend/pipeline/head This commit looks good
- ESC (alone) key is now considered as function key for binding (global or application) - Improve app launcher event handling - Convention: Global announcement events are in upper case, local window events is in lower case
This commit is contained in:
parent
9fa3ab92bf
commit
147353327b
18346
d.ts/antos.d.ts
vendored
18346
d.ts/antos.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -127,7 +127,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.on("apptitlechange", () => this.sysdock.update(this));
|
this.on("apptitlechange", () => this.sysdock.update(this));
|
||||||
this.subscribe("appregistry", (m) => {
|
this.subscribe("APP-REGISTRY", (m) => {
|
||||||
if (m.name === this.name) {
|
if (m.name === this.name) {
|
||||||
this.applySetting(m.message as string);
|
this.applySetting(m.message as string);
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ namespace OS {
|
|||||||
f: (e: JQuery.KeyboardEventBase) => void
|
f: (e: JQuery.KeyboardEventBase) => void
|
||||||
): void {
|
): void {
|
||||||
const arr = k.toUpperCase().split("-");
|
const arr = k.toUpperCase().split("-");
|
||||||
const c = arr.pop();
|
let c = arr.pop();
|
||||||
let fnk = "";
|
let fnk = "";
|
||||||
if (arr.includes("META")) {
|
if (arr.includes("META")) {
|
||||||
fnk += "META";
|
fnk += "META";
|
||||||
@ -236,7 +236,10 @@ namespace OS {
|
|||||||
if (arr.includes("SHIFT")) {
|
if (arr.includes("SHIFT")) {
|
||||||
fnk += "SHIFT";
|
fnk += "SHIFT";
|
||||||
}
|
}
|
||||||
|
if (fnk == "" && arr.length == 0 && c == "ESC") {
|
||||||
|
fnk = "ESC";
|
||||||
|
c = String.fromCharCode(27).toUpperCase();
|
||||||
|
}
|
||||||
if ( fnk == "") {
|
if ( fnk == "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ namespace OS {
|
|||||||
this.host = this._gui.desktop();
|
this.host = this._gui.desktop();
|
||||||
this.dialog = undefined;
|
this.dialog = undefined;
|
||||||
// relay global events to local events
|
// relay global events to local events
|
||||||
this.subscribe("desktopresize", (e) => this.observable.trigger("desktopresize", e));
|
this.subscribe("DESKTOP-RESIZE", (e) => this.observable.trigger("desktopresize", e));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1711,7 +1711,7 @@ namespace OS {
|
|||||||
* Set the current system locale: This function will
|
* Set the current system locale: This function will
|
||||||
* find and load the locale dictionary definition file in the
|
* find and load the locale dictionary definition file in the
|
||||||
* system asset resource, then trigger the global event
|
* system asset resource, then trigger the global event
|
||||||
* `systemlocalechange` to translated all translatable text
|
* `SYSTEM-LOCALE-CHANGED` to translated all translatable text
|
||||||
* to the target language
|
* to the target language
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
@ -1725,7 +1725,7 @@ namespace OS {
|
|||||||
const d = await API.get(path, "json");
|
const d = await API.get(path, "json");
|
||||||
OS.setting.system.locale = name;
|
OS.setting.system.locale = name;
|
||||||
API.lang = d;
|
API.lang = d;
|
||||||
announcer.ostrigger("systemlocalechange", name);
|
announcer.ostrigger("SYSTEM-LOCALE-CHANGED", name);
|
||||||
return resolve(d);
|
return resolve(d);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return reject(__e(e));
|
return reject(__e(e));
|
||||||
|
@ -542,7 +542,7 @@ namespace OS {
|
|||||||
if(OS.setting.system.startup.apps)
|
if(OS.setting.system.startup.apps)
|
||||||
OS.setting.system.startup.apps = OS.setting.system.startup.apps.filter((e) => e != app);
|
OS.setting.system.startup.apps = OS.setting.system.startup.apps.filter((e) => e != app);
|
||||||
// refresh pinned list
|
// refresh pinned list
|
||||||
announcer.ostrigger("app-pinned", "app-pinned", undefined);
|
announcer.ostrigger("APP-PINNED", "APP-PINNED", undefined);
|
||||||
// remove application setting
|
// remove application setting
|
||||||
if(OS.setting.applications[app])
|
if(OS.setting.applications[app])
|
||||||
delete OS.setting.applications[app];
|
delete OS.setting.applications[app];
|
||||||
@ -581,6 +581,11 @@ namespace OS {
|
|||||||
* @returns {Promise<string>}
|
* @returns {Promise<string>}
|
||||||
*/
|
*/
|
||||||
function loadApp(app: string): Promise<string> {
|
function loadApp(app: string): Promise<string> {
|
||||||
|
const ann: API.AnnouncementDataType<Promise<any>> = {} as API.AnnouncementDataType<Promise<any>>;
|
||||||
|
ann.name = "OS";
|
||||||
|
ann.message = app;
|
||||||
|
ann.id = Math.floor(Math.random() * 1e6);
|
||||||
|
announcer.trigger("APP-LOADING",ann);
|
||||||
return new Promise(async function (resolve, reject) {
|
return new Promise(async function (resolve, reject) {
|
||||||
let path: string = undefined;
|
let path: string = undefined;
|
||||||
try {
|
try {
|
||||||
@ -630,8 +635,10 @@ namespace OS {
|
|||||||
application[app].style = el[0];
|
application[app].style = el[0];
|
||||||
}
|
}
|
||||||
} catch(e_1){}
|
} catch(e_1){}
|
||||||
|
announcer.trigger("APP-LOADED", ann);
|
||||||
return resolve(app);
|
return resolve(app);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
announcer.trigger("APP-LOAD-ERROR", ann);
|
||||||
return reject(__e(e));
|
return reject(__e(e));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -759,7 +766,7 @@ namespace OS {
|
|||||||
data.message = key;
|
data.message = key;
|
||||||
data.iconclass = mt?mt.iconclass:undefined;
|
data.iconclass = mt?mt.iconclass:undefined;
|
||||||
data.u_data = undefined;
|
data.u_data = undefined;
|
||||||
return announcer.trigger("appregistry", data);
|
return announcer.trigger("APP-REGISTRY", data);
|
||||||
});
|
});
|
||||||
const p = await PM.createProcess(
|
const p = await PM.createProcess(
|
||||||
app,
|
app,
|
||||||
@ -939,7 +946,7 @@ namespace OS {
|
|||||||
force: boolean = true
|
force: boolean = true
|
||||||
): void {
|
): void {
|
||||||
const arr = k.toUpperCase().split("-");
|
const arr = k.toUpperCase().split("-");
|
||||||
const c = arr.pop();
|
let c = arr.pop();
|
||||||
let fnk = "";
|
let fnk = "";
|
||||||
if (arr.includes("META")) {
|
if (arr.includes("META")) {
|
||||||
fnk += "META";
|
fnk += "META";
|
||||||
@ -953,7 +960,10 @@ namespace OS {
|
|||||||
if (arr.includes("SHIFT")) {
|
if (arr.includes("SHIFT")) {
|
||||||
fnk += "SHIFT";
|
fnk += "SHIFT";
|
||||||
}
|
}
|
||||||
|
if (fnk == "" && arr.length == 0 && c == "ESC") {
|
||||||
|
fnk = "ESC";
|
||||||
|
c = String.fromCharCode(27).toUpperCase();
|
||||||
|
}
|
||||||
if (fnk == "") {
|
if (fnk == "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1052,7 +1062,7 @@ namespace OS {
|
|||||||
const scheme = $.parseHTML(schemes.ws);
|
const scheme = $.parseHTML(schemes.ws);
|
||||||
$("#wrapper").append(scheme);
|
$("#wrapper").append(scheme);
|
||||||
|
|
||||||
announcer.one("sysdockloaded", () => {
|
announcer.one("SYS-DOCK-LOADED", () => {
|
||||||
$(window).on("keydown", function (event) {
|
$(window).on("keydown", function (event) {
|
||||||
const dock = systemDock();
|
const dock = systemDock();
|
||||||
if (!dock) {
|
if (!dock) {
|
||||||
@ -1074,6 +1084,9 @@ namespace OS {
|
|||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
fnk += "SHIFT";
|
fnk += "SHIFT";
|
||||||
}
|
}
|
||||||
|
if (fnk == "" && event.which == 27) {
|
||||||
|
fnk = "ESC";
|
||||||
|
}
|
||||||
//console.log(fnk, c);
|
//console.log(fnk, c);
|
||||||
if (fnk == "") {
|
if (fnk == "") {
|
||||||
return;
|
return;
|
||||||
@ -1195,8 +1208,8 @@ namespace OS {
|
|||||||
// load theme
|
// load theme
|
||||||
loadTheme(setting.appearance.theme, true);
|
loadTheme(setting.appearance.theme, true);
|
||||||
wallpaper(undefined);
|
wallpaper(undefined);
|
||||||
OS.announcer.one("syspanelloaded", async function () {
|
OS.announcer.one("SYS-PANEL-LOADED", async function () {
|
||||||
OS.announcer.on("systemlocalechange", (_) =>
|
OS.announcer.on("SYSTEM-LOCALE-CHANGED", (_) =>
|
||||||
$("#syspanel")[0].update()
|
$("#syspanel")[0].update()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ namespace OS {
|
|||||||
obj.birth = new Date().getTime();
|
obj.birth = new Date().getTime();
|
||||||
PM.pidalloc++;
|
PM.pidalloc++;
|
||||||
obj.pid = PM.pidalloc;
|
obj.pid = PM.pidalloc;
|
||||||
obj.subscribe("systemlocalechange", (d) => {
|
obj.subscribe("SYSTEM-LOCALE-CHANGED", (d) => {
|
||||||
obj.updateLocale(d.message as string);
|
obj.updateLocale(d.message as string);
|
||||||
return obj.update();
|
return obj.update();
|
||||||
});
|
});
|
||||||
|
@ -166,7 +166,7 @@ namespace OS {
|
|||||||
id: this.aid,
|
id: this.aid,
|
||||||
data: v
|
data: v
|
||||||
};
|
};
|
||||||
announcer.trigger("appselect", evt);
|
announcer.trigger("APP-SELECT", evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
get selectedApp(): application.BaseApplication {
|
get selectedApp(): application.BaseApplication {
|
||||||
@ -403,7 +403,7 @@ namespace OS {
|
|||||||
.css("bottom", $(this).height());
|
.css("bottom", $(this).height());
|
||||||
return m.show();
|
return m.show();
|
||||||
};
|
};
|
||||||
announcer.trigger("sysdockloaded", undefined);
|
announcer.trigger("SYS-DOCK-LOADED", undefined);
|
||||||
GUI.bindKey("CTRL-ALT-2", (e) =>{
|
GUI.bindKey("CTRL-ALT-2", (e) =>{
|
||||||
if(!this.items || this.items.length === 0)
|
if(!this.items || this.items.length === 0)
|
||||||
{
|
{
|
||||||
@ -455,7 +455,7 @@ namespace OS {
|
|||||||
this.addEventListener("wheel", (evt)=>{
|
this.addEventListener("wheel", (evt)=>{
|
||||||
(this as any).scrollLeft += (evt as WheelEvent).deltaY;
|
(this as any).scrollLeft += (evt as WheelEvent).deltaY;
|
||||||
},{ passive: true});
|
},{ passive: true});
|
||||||
announcer.on("app-pinned", (_) => {
|
announcer.on("APP-PINNED", (_) => {
|
||||||
this.refresh_pinned_app();
|
this.refresh_pinned_app();
|
||||||
});
|
});
|
||||||
this.refresh_pinned_app();
|
this.refresh_pinned_app();
|
||||||
|
@ -107,7 +107,7 @@ namespace OS {
|
|||||||
height: $(this).height()
|
height: $(this).height()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
announcer.trigger("desktopresize", evt);
|
announcer.trigger("DESKTOP-RESIZE", evt);
|
||||||
this.calibrate();
|
this.calibrate();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ namespace OS {
|
|||||||
return this.refresh();
|
return this.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return announcer.ostrigger("desktoploaded", undefined);
|
return announcer.ostrigger("DESKTOP-LOADED", undefined);
|
||||||
};
|
};
|
||||||
super.mount();
|
super.mount();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace OS {
|
|||||||
private _pending_task: Promise<any>[];
|
private _pending_task: Promise<any>[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag indicate where the selected application shall be openned
|
* Flag indicate where the selected application shall be opened
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@ -117,7 +117,7 @@ namespace OS {
|
|||||||
protected reload(d?: any): void { }
|
protected reload(d?: any): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach a service to the system tray on the pannel,
|
* Attach a service to the system tray on the panel,
|
||||||
* this operation is performed when a service is started
|
* this operation is performed when a service is started
|
||||||
*
|
*
|
||||||
* @param {BaseService} s
|
* @param {BaseService} s
|
||||||
@ -384,7 +384,7 @@ namespace OS {
|
|||||||
(this.refs.search as HTMLInputElement).value = "";
|
(this.refs.search as HTMLInputElement).value = "";
|
||||||
if(!OS.mobile)
|
if(!OS.mobile)
|
||||||
{
|
{
|
||||||
$(this.refs.search).focus();
|
$(this.refs.search).trigger("focus");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -498,6 +498,11 @@ namespace OS {
|
|||||||
return this.toggle(false);
|
return this.toggle(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Ant.OS.GUI.bindKey("ESC", (e) => {
|
||||||
|
if (this._view === true) {
|
||||||
|
return this.toggle(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
const catlist = (this.refs.catlist as tag.TabBarTag);
|
const catlist = (this.refs.catlist as tag.TabBarTag);
|
||||||
catlist.ontabselect = (e) => {
|
catlist.ontabselect = (e) => {
|
||||||
const applist = (this.refs.applist as ListViewTag);
|
const applist = (this.refs.applist as ListViewTag);
|
||||||
@ -554,14 +559,18 @@ namespace OS {
|
|||||||
remove_task(o.u_data);
|
remove_task(o.u_data);
|
||||||
});
|
});
|
||||||
|
|
||||||
announcer.on("desktopresize", (e) => {
|
announcer.on("DESKTOP-RESIZE", (e) => {
|
||||||
this.calibrate();
|
this.calibrate();
|
||||||
});
|
});
|
||||||
announcer.on("appselect", (e) => {
|
announcer.on("APP-SELECT", (e) => {
|
||||||
if(this._view)
|
if(this._view)
|
||||||
this.toggle(false);
|
this.toggle(false);
|
||||||
});
|
});
|
||||||
Ant.OS.announcer.trigger("syspanelloaded", undefined);
|
announcer.on("APP-LOADING", (e) => {
|
||||||
|
if(this._view)
|
||||||
|
this.toggle(false);
|
||||||
|
});
|
||||||
|
Ant.OS.announcer.trigger("SYS-PANEL-LOADED", undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
return result1;
|
return result1;
|
||||||
})();
|
})();
|
||||||
announcer.ostrigger("app-pinned", "app-pinned", this.applist.data);
|
announcer.ostrigger("APP-PINNED", "APP-PINNED", this.applist.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
App.AppAndServiceHandle = AppAndServiceHandle;
|
App.AppAndServiceHandle = AppAndServiceHandle;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
afx-tab-bar[dir="row"] afx-list-view > div.list-container > ul > afx-list-item > li.selected
|
afx-tab-bar[dir="row"] afx-list-view > div.list-container > ul > afx-list-item > li.selected
|
||||||
{
|
{
|
||||||
background-color: var(--background-tertiary);
|
background-color: var(--background-quaternary);
|
||||||
color:var(--text-primary);
|
color:var(--text-primary);
|
||||||
border-bottom:2px solid var(--border-tertiary); /* #262626;*/
|
border-bottom:2px solid var(--border-tertiary); /* #262626;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
afx-tab-bar[dir="column"] afx-list-view > div.list-container > ul > afx-list-item > li.selected
|
afx-tab-bar[dir="column"] afx-list-view > div.list-container > ul > afx-list-item > li.selected
|
||||||
{
|
{
|
||||||
background-color: var(--background-tertiary);
|
background-color: var(--background-quaternary);
|
||||||
color:var(--text-primary);
|
color:var(--text-primary);
|
||||||
border-right:2px solid var(--border-tertiary); /* #262626;*/
|
border-right:2px solid var(--border-tertiary); /* #262626;*/
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user