Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
a61326a8e5 | |||
cefde68b14 | |||
0df13d057c | |||
cc39851560 | |||
6740b85595 | |||
b249a328d0 | |||
326fed9bb5 | |||
ae9f65e9f5 | |||
4d5e2f824a | |||
3aeb16f0a3 | |||
2a5792e3b4 | |||
10d59a6947 | |||
af23ed0ad2 | |||
fe6cd43047 | |||
d7830def2d | |||
7f14fc3790 | |||
35aea33703 | |||
0c4f2773cf | |||
2e24d99f56 | |||
d5a2d4b83e |
137
.gitlab-ci.yml
137
.gitlab-ci.yml
@ -1,137 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--gitzone element-->
|
<!--gitzone element-->
|
||||||
<!-- made by Lossless GmbH -->
|
<!-- made by Task Venture Capital GmbH -->
|
||||||
<!-- checkout https://maintainedby.lossless.com for awesome OpenSource projects -->
|
<!-- checkout https://maintainedby.lossless.com for awesome OpenSource projects -->
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -10,6 +10,10 @@
|
|||||||
/>
|
/>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
|
||||||
|
<!--Lets load standard fonts-->
|
||||||
|
<link rel="preconnect" href="https://assetbroker.lossless.one/" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://assetbroker.lossless.one/fonts/fonts.css">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
@ -17,7 +21,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script src="./index.ts"></script>
|
<script type="module" src="/bundle.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// dees tools
|
// dees tools
|
||||||
import * as deesWccTools from '@designestate/dees-wcctools';
|
import * as deesWccTools from '@design.estate/dees-wcctools';
|
||||||
import * as deesDomTools from '@designestate/dees-domtools';
|
import * as deesDomTools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
// elements and pages
|
// elements and pages
|
||||||
import * as elements from '../ts_web/elements';
|
import * as elements from '../ts_web/elements/index.js';
|
||||||
import * as pages from '../ts_web/pages';
|
import * as pages from '../ts_web/pages/index.js';
|
||||||
|
|
||||||
deesWccTools.setupWccTools(elements as any, pages);
|
deesWccTools.setupWccTools(elements as any, pages);
|
||||||
deesDomTools.elementBasic.setup();
|
deesDomTools.elementBasic.setup();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "uptimelink",
|
"gitscope": "uptimelink",
|
||||||
"gitrepo": "webwidget",
|
"gitrepo": "webwidget",
|
||||||
"shortDescription": "the webwidget for public use of uptimelink",
|
"description": "the webwidget for public use of uptimelink",
|
||||||
"npmPackagename": "@uptimelink/webwidget",
|
"npmPackagename": "@uptimelink/webwidget",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"projectDomain": "uptime.link"
|
"projectDomain": "uptime.link"
|
||||||
|
18657
package-lock.json
generated
18657
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@uptimelink/webwidget",
|
"name": "@uptime.link_private/webwidget",
|
||||||
"version": "1.0.68",
|
"version": "1.0.78",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "the webwidget for public use of uptimelink",
|
"description": "the webwidget for public use of uptimelink",
|
||||||
"main": "dist_ts_web/index.js",
|
"main": "dist_ts_web/index.js",
|
||||||
@ -8,25 +8,22 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run build",
|
"test": "npm run build",
|
||||||
"build": "tsbuild element --allowimplicitany --skiplibcheck && tsbundle element --production",
|
"build": "tsbuild element --allowimplicitany && tsbundle element --production",
|
||||||
"watch": "tswatch element"
|
"watch": "tswatch element"
|
||||||
},
|
},
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@designestate/dees-domtools": "^2.0.1",
|
"@design.estate/dees-domtools": "^2.0.1",
|
||||||
"@designestate/dees-element": "^2.0.4",
|
"@design.estate/dees-element": "^2.0.4",
|
||||||
"@designestate/dees-wcctools": "^1.0.73",
|
"@design.estate/dees-wcctools": "^1.0.73"
|
||||||
"@gitzone/tsrun": "^1.2.32",
|
|
||||||
"typescript": "^4.2.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.61",
|
"@git.zone/tsbuild": "^2.1.61",
|
||||||
"@gitzone/tsbundle": "^1.0.101",
|
"@git.zone/tsbundle": "^2.0.10",
|
||||||
"@gitzone/tswatch": "^1.0.73",
|
"@git.zone/tsrun": "^1.2.32",
|
||||||
"@pushrocks/projectinfo": "^4.0.5",
|
"@git.zone/tswatch": "^2.0.13",
|
||||||
"tslint": "^6.1.3",
|
"@push.rocks/projectinfo": "^5.0.2"
|
||||||
"tslint-config-prettier": "^1.17.0"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
3162
pnpm-lock.yaml
generated
Normal file
3162
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
ts_web/00_commitinfo_data.ts
Normal file
8
ts_web/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@uptime.link_private/webwidget',
|
||||||
|
version: '1.0.78',
|
||||||
|
description: 'the webwidget for public use of uptimelink'
|
||||||
|
}
|
0
ts_web/elements/uptimelink
Normal file
0
ts_web/elements/uptimelink
Normal file
@ -1,5 +1,6 @@
|
|||||||
import { DeesElement, property, html, customElement, TemplateResult } from '@designestate/dees-element';
|
import { DeesElement, property, html, customElement, type TemplateResult, cssManager } from '@design.estate/dees-element';
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
|
||||||
|
import { UptimelinkWindowLayer } from './uptimelink-windowlayer.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -13,6 +14,11 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
<uptimelink-webwidget projectSlug="uptime.link"></uptimelink-webwidget>
|
<uptimelink-webwidget projectSlug="uptime.link"></uptimelink-webwidget>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean
|
||||||
|
})
|
||||||
|
isOnTop = false;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public projectSlug: string;
|
public projectSlug: string;
|
||||||
|
|
||||||
@ -27,27 +33,29 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
domtools.DomTools.setupDomTools();
|
|
||||||
this.setupEventing();
|
this.setupEventing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
]
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
${domtools.elementBasic.styles}
|
|
||||||
<style>
|
<style>
|
||||||
:host {
|
:host {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
z-index: ${this.isElevated ? '10' : 'auto'} ;
|
z-index: ${this.isElevated || this.isOnTop ? '1000' : 'auto'} ;
|
||||||
}
|
}
|
||||||
.mainbox {
|
.mainbox {
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
font-family: Roboto;
|
font-family: Roboto;
|
||||||
font-weight: 400;
|
font-weight: 540;
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
@ -67,8 +75,8 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mainbox.focused {
|
.mainbox.focused {
|
||||||
width: 200px;
|
width: 182px;
|
||||||
height: 118px;
|
height: 117px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statusindicator {
|
.statusindicator {
|
||||||
@ -78,7 +86,7 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
.statustext {
|
.statustext {
|
||||||
padding-top: 3px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.expanded {
|
.expanded {
|
||||||
@ -90,8 +98,7 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 190px;
|
width: 190px;
|
||||||
top: 25px;
|
top: 25px;
|
||||||
left: calc(50% - 95px);
|
left: 5px;
|
||||||
|
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
@ -99,10 +106,10 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
.miniOverview24h {
|
.miniOverview24h {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 55px;
|
top: 55px;
|
||||||
left: calc(50% - 95px);
|
left: 5px;
|
||||||
background: ${this.goBright ? 'rgba(0,0,0,0.07)' : 'rgba(255,255,255,0.07)'};
|
background: ${this.goBright ? 'rgba(0,0,0,0.07)' : 'rgba(255,255,255,0.07)'};
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
width: 190px;
|
width: 172px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
display: grid;
|
display: grid;
|
||||||
padding: 3px 3px;
|
padding: 3px 3px;
|
||||||
@ -121,9 +128,9 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
|
|
||||||
.viewStatuspage {
|
.viewStatuspage {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 190px;
|
width: 172px;
|
||||||
top: 80px;
|
top: 80px;
|
||||||
left: calc(50% - 95px);
|
left: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: ${this.goBright ? 'rgba(0,0,0,0.07)' : 'rgba(255,255,255,0.07)'};
|
background: ${this.goBright ? 'rgba(0,0,0,0.07)' : 'rgba(255,255,255,0.07)'};
|
||||||
border-radius: 3px 3px 10px 10px;
|
border-radius: 3px 3px 10px 10px;
|
||||||
@ -144,13 +151,13 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
${this.showExpanded ? html`
|
${this.showExpanded ? html`
|
||||||
<div class="expanded">
|
<div class="expanded">
|
||||||
<div class="miniHeading">
|
<div class="miniHeading">
|
||||||
last 26 hours:
|
last 24 hours:
|
||||||
</div>
|
</div>
|
||||||
<div class="miniOverview24h">
|
<div class="miniOverview24h">
|
||||||
${(() => {
|
${(() => {
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
const returnArray = [];
|
const returnArray = [];
|
||||||
while(counter < 26) {
|
while(counter < 24) {
|
||||||
returnArray.push(html`<div class="statusBar ok"></div>`)
|
returnArray.push(html`<div class="statusBar ok"></div>`)
|
||||||
counter++;
|
counter++;
|
||||||
};
|
};
|
||||||
@ -164,13 +171,29 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public windowLayer: UptimelinkWindowLayer;
|
||||||
private async setupEventing() {
|
private async setupEventing() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
const mainbox: HTMLDivElement = this.shadowRoot.querySelector('.mainbox');
|
const mainbox: HTMLDivElement = this.shadowRoot.querySelector('.mainbox');
|
||||||
mainbox.onmouseenter = async () => {
|
mainbox.onmouseenter = async () => {
|
||||||
|
if (!this.isOnTop) {
|
||||||
|
const mainbox = this.shadowRoot.querySelector('.mainbox') as HTMLElement;
|
||||||
|
const rect = mainbox.getBoundingClientRect();
|
||||||
|
const uptimelinkWidget = new UptimelinkWebwidget();
|
||||||
|
uptimelinkWidget.isOnTop = true;
|
||||||
|
uptimelinkWidget.style.position = 'fixed';
|
||||||
|
uptimelinkWidget.style.top = `${rect.top}px`;
|
||||||
|
uptimelinkWidget.style.left = `${rect.left}px`;
|
||||||
|
document.body.append(uptimelinkWidget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.isElevated = true;
|
this.isElevated = true;
|
||||||
this.isFocused = true;
|
this.isFocused = true;
|
||||||
await domtools.DomTools.getGlobalDomToolsSync().convenience.smartdelay.delayFor(200);
|
this.windowLayer = await UptimelinkWindowLayer.createAndShow({
|
||||||
|
blur: true,
|
||||||
|
});
|
||||||
|
await domtools.convenience.smartdelay.delayFor(200);
|
||||||
if (!this.isFocused) {
|
if (!this.isFocused) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -181,9 +204,14 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
expandedDiv.style.opacity = '1';
|
expandedDiv.style.opacity = '1';
|
||||||
};
|
};
|
||||||
mainbox.onmouseleave = async () => {
|
mainbox.onmouseleave = async () => {
|
||||||
(await this.domtoolsPromise).convenience.smartdelay.delayFor(200).then(() => {
|
if (!this.isOnTop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.windowLayer.destroy();
|
||||||
|
domtools.convenience.smartdelay.delayFor(200).then(() => {
|
||||||
if (!this.isFocused) {
|
if (!this.isFocused) {
|
||||||
this.isElevated = false;
|
this.isElevated = false;
|
||||||
|
this.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!this.showExpanded) {
|
if (!this.showExpanded) {
|
||||||
@ -191,7 +219,7 @@ export class UptimelinkWebwidget extends DeesElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.showExpanded = false;
|
this.showExpanded = false;
|
||||||
await domtools.DomTools.getGlobalDomToolsSync().convenience.smartdelay.delayFor(50);
|
await domtools.convenience.smartdelay.delayFor(50);
|
||||||
this.isFocused = false;
|
this.isFocused = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
113
ts_web/elements/uptimelink-windowlayer.ts
Normal file
113
ts_web/elements/uptimelink-windowlayer.ts
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
import { customElement, DeesElement, type TemplateResult, html, property, type CSSResult, state, } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'uptimelink-windowlayer': UptimelinkWindowLayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IOptions_UptimeLinkWindowLayer {
|
||||||
|
blur: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('uptimelink-windowlayer')
|
||||||
|
export class UptimelinkWindowLayer extends DeesElement {
|
||||||
|
// STATIC
|
||||||
|
public static demo = () => html`<uptimelink-windowlayer></uptimelink-windowlayer>`;
|
||||||
|
|
||||||
|
public static async createAndShow(optionsArg?: IOptions_UptimeLinkWindowLayer) {
|
||||||
|
const domtoolsInstance = domtools.DomTools.getGlobalDomToolsSync();
|
||||||
|
const windowLayer = new UptimelinkWindowLayer();
|
||||||
|
windowLayer.options = {
|
||||||
|
...windowLayer.options,
|
||||||
|
...optionsArg,
|
||||||
|
}
|
||||||
|
document.body.append(windowLayer);
|
||||||
|
await domtoolsInstance.convenience.smartdelay.delayFor(0);
|
||||||
|
windowLayer.show();
|
||||||
|
return windowLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@state()
|
||||||
|
public options: IOptions_UptimeLinkWindowLayer = {
|
||||||
|
blur: false
|
||||||
|
};
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
@property({
|
||||||
|
type: Boolean
|
||||||
|
})
|
||||||
|
public visible = false;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
domtools.elementBasic.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
${domtools.elementBasic.styles}
|
||||||
|
<style>
|
||||||
|
.windowOverlay {
|
||||||
|
transition: all 0.2s;
|
||||||
|
will-change: transform;
|
||||||
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(0, 0, 0, 0.0);
|
||||||
|
backdrop-filter: brightness(1) ${this.options.blur ? 'blur(0px)' : ''};
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visible {
|
||||||
|
background: rgba(0, 0, 0, 0.2);
|
||||||
|
backdrop-filter: brightness(0.9) ${this.options.blur ? 'blur(2px)' : ''};
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div @click=${this.dispatchClicked} class="windowOverlay ${this.visible ? 'visible' : null}">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.visible = true;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatchClicked() {
|
||||||
|
this.dispatchEvent(new CustomEvent('clicked'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public toggleVisibility () {
|
||||||
|
this.visible = !this.visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async show() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
await domtools.convenience.smartdelay.delayFor(0);
|
||||||
|
this.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async hide() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
await domtools.convenience.smartdelay.delayFor(0);
|
||||||
|
this.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async destroy() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
await this.hide();
|
||||||
|
await domtools.convenience.smartdelay.delayFor(300);
|
||||||
|
this.remove();
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,12 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ES2022",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "nodenext"
|
"moduleResolution": "NodeNext",
|
||||||
}
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user