improve Window GUI API

This commit is contained in:
Dany LE 2021-10-24 00:27:17 +02:00
parent aab242c1f7
commit 52709d5da4
5 changed files with 5417 additions and 5420 deletions

View File

@ -4,6 +4,9 @@ BUILDDIR?=/opt/www/htdocs/os
DOCDIR?=/opt/www/htdocs/doc/antos
BLUE=\033[1;34m
NC=\033[0m
TSC=./node_modules/typescript/bin/tsc
UGLIFYJS=./node_modules/terser/bin/terser
UGLIFYCSS=./node_modules/uglifycss/uglifycss
VERSION=1.2.1
@ -68,7 +71,7 @@ lite: build_javascripts build_themes build_packages
ts:
-rm -rf dist
tsc -p tsconfig.json
$(TSC) -p tsconfig.json
cat `find dist/core/ -name "*.d.ts"` > d.ts/antos.d.ts
rm `find dist/ -name "*.d.ts"`
cat d.ts/core.d.ts d.ts/jquery.d.ts d.ts/antos.d.ts > /tmp/corelib.d.ts
@ -85,7 +88,7 @@ standalone_tags: ts
rm "$${f}";\
done
echo "var Ant=this;" >> dist/afx.js
terser dist/afx.js --compress --mangle --output $(BUILDDIR)/afx.js
$(UGLIFYJS) dist/afx.js --compress --mangle --output $(BUILDDIR)/afx.js
# standalone theme
@for f in src/themes/system/afx-*.css; do \
@ -101,7 +104,7 @@ standalone_tags: ts
(cat "$${f}"; echo) >> $(BUILDDIR)/afx.css; \
fi;\
done
# uglifycss --output $(BUILDDIR)/afx.css $(BUILDDIR)/afx.css
# $(UGLIFYCSS) --output $(BUILDDIR)/afx.css $(BUILDDIR)/afx.css
rm -r dist/core
build_javascripts: ts
@ -173,27 +176,27 @@ package:
pkgar:
read -r -p "Enter package name: " PKG;\
echo $$PKG | make package &&\
test -f $(BUILDDIR)/packages/$$PKG/main.js && terser $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
test -f $(BUILDDIR)/packages/$$PKG/main.css && uglifycss --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
test -f $(BUILDDIR)/packages/$$PKG/main.js && $(UGLIFYJS) $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
test -f $(BUILDDIR)/packages/$$PKG/main.css && $(UGLIFYCSS) --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \
cd ../../ && (test -d repo/$$PKG || mkdir repo/$$PKG) && mv packages/$$PKG/"$$PKG.zip" repo/$$PKG && touch repo/$$PKG/$$PKG.md && rm -r packages/$$PKG
uglify:
# sudo npm install terser -g
# sudo npm install $(UGLIFYJS) -g
#
terser $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
$(UGLIFYJS) $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
# uglify tags
# npm install uglifycss -g
# npm install $(UGLIFYCSS) -g
# uglify the css
uglifycss --output $(BUILDDIR)/resources/themes/antos_light/antos_light.css $(BUILDDIR)/resources/themes/antos_light/antos_light.css
uglifycss --output $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css
uglifycss --output $(BUILDDIR)/resources/themes/system/system.css $(BUILDDIR)/resources/themes/system/system.css
$(UGLIFYCSS) --output $(BUILDDIR)/resources/themes/antos_light/antos_light.css $(BUILDDIR)/resources/themes/antos_light/antos_light.css
$(UGLIFYCSS) --output $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css
$(UGLIFYCSS) --output $(BUILDDIR)/resources/themes/system/system.css $(BUILDDIR)/resources/themes/system/system.css
#uglify each packages
for d in $(packages); do\
echo "Uglifying $$d";\
test -f $(BUILDDIR)/packages/$$d/main.js && terser $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
test -f $(BUILDDIR)/packages/$$d/main.css && uglifycss --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
test -f $(BUILDDIR)/packages/$$d/main.js && $(UGLIFYJS) $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
test -f $(BUILDDIR)/packages/$$d/main.css && $(UGLIFYCSS) --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
done
ar:

10766
d.ts/antos.d.ts vendored

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -992,15 +992,9 @@ namespace OS {
// desktop[0].set "selected", -1
$(desktop).on("click", function (e) {
let el = $(e.target).parent();
if (!(el.length > 0)) {
return;
}
el = el.parent();
if (!(el.length > 0)) {
return;
}
if (el[0] !== desktop) {
let el = $(e.target).closest("afx-app-window")[0];
if(el)
{
return;
}
desktop.unselect();

View File

@ -108,7 +108,7 @@ namespace OS {
* @protected
* @memberof WindowTag
*/
protected calibrate(): void {}
protected calibrate(): void { }
/**
* Do nothing
@ -117,7 +117,7 @@ namespace OS {
* @param {*} [d]
* @memberof WindowTag
*/
protected reload(d?: any): void {}
protected reload(d?: any): void { }
/**
* Setter: Set the window width
@ -245,18 +245,18 @@ namespace OS {
* @memberof WindowTag
*/
protected mount(): void {
this.contextmenuHandle = function (e) {};
$(this.refs["minbt"]).on("click",(e) => {
this.contextmenuHandle = function (e) { };
$(this.refs["minbt"]).on("click", (e) => {
return this.observable.trigger("hide", {
id: this.aid,
});
});
$(this.refs["maxbt"]).on("click",(e) => {
$(this.refs["maxbt"]).on("click", (e) => {
return this.toggle_window();
});
$(this.refs["closebt"]).on("click",(e) => {
$(this.refs["closebt"]).on("click", (e) => {
return this.observable.trigger("exit", {
id: this.aid,
});
@ -276,8 +276,8 @@ namespace OS {
id: this.aid,
});
});
$(this.refs["dragger"]).on("dblclick",(e) => {
//$(this.refs.win_overlay).css("background-color", "red");
$(this.refs["dragger"]).on("dblclick", (e) => {
return this.toggle_window();
});
@ -290,11 +290,13 @@ namespace OS {
.css("z-index", Ant.OS.GUI.zindex)
.removeClass("unactive");
this._shown = true;
$(this.refs.win_overlay).hide();
});
this.observable.on("blur", () => {
this._shown = false;
return $(this).addClass("unactive");
$(this).addClass("unactive");
$(this.refs.win_overlay).show();
});
this.observable.on("hide", () => {
$(this).hide();
@ -408,12 +410,10 @@ namespace OS {
let w = $(this).width();
let h = $(this).height();
$(this.refs.win_overlay).show();
if(target != this.refs.grip_bottom)
{
if (target != this.refs.grip_bottom) {
w += e.clientX - offset.left;
}
if(target != this.refs.grip_right)
{
if (target != this.refs.grip_right) {
h += e.clientY - offset.top;
}
w = w < 100 ? 100 : w;