feat(webwidget): Enhanced widget animations and styling

This commit is contained in:
2025-01-09 03:22:30 +01:00
parent 24ff8601e4
commit 8efd8b6597
5 changed files with 3412 additions and 1550 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@uptime.link/webwidget',
version: '1.1.2',
version: '1.2.0',
description: 'The web widget for public use of uptimelink, allowing users to monitor uptime status through a user-friendly interface.'
}

View File

@ -15,7 +15,8 @@ export class UptimelinkWebwidget extends DeesElement {
`;
@property({
type: Boolean
type: Boolean,
reflect: true
})
isOnTop = false;
@ -28,9 +29,14 @@ export class UptimelinkWebwidget extends DeesElement {
@property()
public isElevated = false;
@property()
@property({
type: Boolean,
reflect: true
})
public showExpanded: boolean = false;
public parentWebwidget: UptimelinkWebwidget;
constructor() {
super();
this.setupEventing();
@ -60,14 +66,19 @@ export class UptimelinkWebwidget extends DeesElement {
width: 150px;
border-radius: 15px;
height: 30px;
background: ${this.goBright ? '#fff' : '#222' };
background: ${this.goBright ? '#ffffff00' : '#22222200' };
box-shadow: ${this.goBright ? '0px 0px 5px rgba(0,0,0,0.1)' : ''};
padding: 5px;
border: 1px solid ${this.goBright ? '#22222220' : '#ffffff20' };
padding: 4px;
color: ${this.goBright ? '#333' : '#CCC' };
cursor: pointer;
transition: all 0.2s;
transition: all 0.2s, background 0.1s;
overflow: hidden;
will-change: transform;
opacity: 1;
}
.mainbox.hidden {
opacity: 0;
}
.firstLine {
@ -78,7 +89,9 @@ export class UptimelinkWebwidget extends DeesElement {
.mainbox.focused {
width: 182px;
height: 117px;
transform: scale(1.1, 1.1);
transform: translateX(-16px)scale(1.1, 1.1);
background: ${this.goBright ? '#ffffff' : '#222222' } !important;
box-shadow: ${this.goBright ? '0px 0px 5px rgba(0,0,0,0.1)' : ''} !important;
}
.statusindicator {
@ -183,11 +196,13 @@ export class UptimelinkWebwidget extends DeesElement {
const mainbox = this.shadowRoot.querySelector('.mainbox') as HTMLElement;
const rect = mainbox.getBoundingClientRect();
const uptimelinkWidget = new UptimelinkWebwidget();
uptimelinkWidget.parentWebwidget = this;
uptimelinkWidget.isOnTop = true;
uptimelinkWidget.style.position = 'fixed';
uptimelinkWidget.style.top = `${rect.top}px`;
uptimelinkWidget.style.left = `${rect.left}px`;
document.body.append(uptimelinkWidget);
mainbox.classList.add('hidden');
return;
}
this.isElevated = true;
@ -210,9 +225,11 @@ export class UptimelinkWebwidget extends DeesElement {
return;
}
this.windowLayer.destroy();
domtools.convenience.smartdelay.delayFor(200).then(() => {
domtools.convenience.smartdelay.delayFor(200).then(async() => {
if (!this.isFocused) {
this.isElevated = false;
this.parentWebwidget.shadowRoot.querySelector('.mainbox').classList.remove('hidden');
await domtools.convenience.smartdelay.delayFor(100);
this.remove();
}
});