Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b5719efdf0 | |||
| 53af713533 | |||
| 368ddec10d | |||
| 06bde76424 | |||
| e75b1d50cf | |||
| f914b26e78 | |||
| 54e0690f0a | |||
| fa1d2d855c | |||
| f705b18bad | |||
| 8efd8b6597 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -3,7 +3,6 @@
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
@@ -17,4 +16,8 @@ node_modules/
|
||||
dist/
|
||||
dist_*/
|
||||
|
||||
# custom
|
||||
# AI
|
||||
.claude/
|
||||
.serena/
|
||||
|
||||
#------# custom
|
||||
56
changelog.md
56
changelog.md
@@ -1,16 +1,61 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-11-30 - 1.2.4 - fix(uptimelink-webwidget)
|
||||
Modernize element props (use accessor), bump deps, add CI/workflows, export pages and update package metadata/docs
|
||||
|
||||
- Converted Lit/DeesElement @property fields to use TypeScript 'accessor' for uptimelink-webwidget properties (isOnTop, projectSlug, isFocused, isElevated, showExpanded)
|
||||
- Bumped runtime and dev dependencies (@design.estate/* and @git.zone/*) and added @types/node
|
||||
- Added buildDocs script (tsdoc) and adjusted npm scripts
|
||||
- Added CI workflows (.gitea/workflows) for tagged and non-tagged runs
|
||||
- Exported pages (ts_web/pages) and added example page modules (page1, page2)
|
||||
- Updated package.json metadata (repository, bugs, homepage, pnpm.overrides)
|
||||
- Adjusted tsconfig (target/module settings, baseUrl/paths, exclude) to align with modern toolchain
|
||||
- Updated README and changelog entries and cleaned html/index.html comments
|
||||
- Added .gitignore entries for AI tooling directories (.claude, .serena)
|
||||
|
||||
## 2025-01-09 - 1.2.3 - fix(webwidget)
|
||||
|
||||
Fix style issues for UptimelinkWebwidget element.
|
||||
|
||||
- Resolved indentation and formatting issues in UptimelinkWebwidget component.
|
||||
- Ensured proper use of cssManager for theming.
|
||||
- Fixed event handling for expanded view toggle.
|
||||
|
||||
## 2025-01-09 - 1.2.2 - fix(component)
|
||||
|
||||
Fix sizing of status indicator in uptimelink-webwidget
|
||||
|
||||
- Corrected the status indicator dimensions for consistency.
|
||||
|
||||
## 2025-01-09 - 1.2.1 - fix(UptimelinkWebwidget)
|
||||
|
||||
Remove incorrect scale transformation in focused state.
|
||||
|
||||
- Fixed the CSS transform property for the .mainbox.focused class in the UptimelinkWebwidget component by removing an unintended scale transformation.
|
||||
|
||||
## 2025-01-09 - 1.2.0 - feat(webwidget)
|
||||
|
||||
Enhanced widget animations and styling
|
||||
|
||||
- Enabled reflect option for 'isOnTop' and 'showExpanded' properties.
|
||||
- Improved the animation and styling of the 'mainbox' when it gains focus.
|
||||
- Mainbox now has smoother opacity transitions and better background handling.
|
||||
- Enhanced functionality of widget positioning for better rendering.
|
||||
|
||||
## 2024-06-28 - 1.1.2 - fix(elements)
|
||||
|
||||
Fix blur effect in UptimelinkWebwidget component
|
||||
|
||||
- Changed blur effect from true to false in the DeesWindowLayer setup
|
||||
|
||||
## 2024-06-27 - 1.1.1 - fix(build)
|
||||
|
||||
Fix build script to use correct tsbuild command
|
||||
|
||||
- Corrected the build script in package.json to use 'tsbuild tsfolders --allowimplicitany && tsbundle element --production' instead of 'tsbuild element --allowimplicitany && tsbundle element --production'.
|
||||
|
||||
## 2024-06-27 - 1.1.0 - feat(elements)
|
||||
|
||||
Add performance improvements to uptimelink-webwidget
|
||||
|
||||
- Added 'will-change: transform' to improve performance of the transform property
|
||||
@@ -18,10 +63,11 @@ Add performance improvements to uptimelink-webwidget
|
||||
- Added scale transformation effect to the focused state of the widget
|
||||
|
||||
## 2024-06-27 - 1.0.82 - fix(core)
|
||||
|
||||
No code changes detected. Preparing for version increment based on package state.
|
||||
|
||||
|
||||
## 2024-06-26 - 1.0.81 - fix(core)
|
||||
|
||||
Updated dependencies and improved code documentation.
|
||||
|
||||
- Updated internal dependencies to newer versions.
|
||||
@@ -29,6 +75,7 @@ Updated dependencies and improved code documentation.
|
||||
- Adjusted scripts in package.json for better build performance.
|
||||
|
||||
## 2024-06-26 - 1.0.80 - fix(documentation)
|
||||
|
||||
Update package description and README for clarity
|
||||
|
||||
- Updated the README to provide better installation and usage instructions.
|
||||
@@ -36,6 +83,7 @@ Update package description and README for clarity
|
||||
- Added styling and advanced interaction examples to README.
|
||||
|
||||
## 2024-06-26 - 1.0.79 - fix(core)
|
||||
|
||||
Fixed various package metadata issues and improved component interactions
|
||||
|
||||
- Corrected package name and description in package.json
|
||||
@@ -44,27 +92,31 @@ Fixed various package metadata issues and improved component interactions
|
||||
- Replaced internal 'UptimelinkWindowLayer' with '@design.estate/dees-catalog' dependency
|
||||
|
||||
## 2023-10-06 - 1.0.78 - Core
|
||||
|
||||
Multiple core updates
|
||||
|
||||
- Applied fixes and updates to core functionality repeatedly from version 1.0.55 to 1.0.78.
|
||||
|
||||
## 2022-03-25 - 1.0.69 - Core
|
||||
|
||||
Core updates and fixes
|
||||
|
||||
- Incremental core fixes and updates from version 1.0.55 to 1.0.69.
|
||||
|
||||
## 2021-03-09 - 1.0.67 - Core
|
||||
|
||||
Series of core fixes
|
||||
|
||||
- Continued fixes and updates to core from version 1.0.55 to 1.0.67.
|
||||
|
||||
## 2020-11-29 - 1.0.61 - Core
|
||||
|
||||
Regular core fixes
|
||||
|
||||
- Ongoing core fixes and updates from version 1.0.55 to 1.0.61.
|
||||
|
||||
## 2020-09-19 - 1.0.58 - Core
|
||||
|
||||
Core updates
|
||||
|
||||
- Core has been updated and fixed multiple times from version 1.0.55 to 1.0.58.
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
<!--gitzone element-->
|
||||
<!-- made by Task Venture Capital GmbH -->
|
||||
<!-- checkout https://maintainedby.lossless.com for awesome OpenSource projects -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--Lets set some basic meta tags-->
|
||||
|
||||
@@ -27,4 +27,4 @@
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
37
package.json
37
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uptime.link/webwidget",
|
||||
"version": "1.1.2",
|
||||
"version": "1.2.4",
|
||||
"private": false,
|
||||
"description": "The web widget for public use of uptimelink, allowing users to monitor uptime status through a user-friendly interface.",
|
||||
"main": "dist_ts_web/index.js",
|
||||
@@ -9,22 +9,24 @@
|
||||
"scripts": {
|
||||
"test": "npm run build",
|
||||
"build": "tsbuild tsfolders --allowimplicitany && tsbundle element --production",
|
||||
"watch": "tswatch element"
|
||||
"watch": "tswatch element",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"author": "Lossless GmbH",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@design.estate/dees-catalog": "^1.0.289",
|
||||
"@design.estate/dees-domtools": "^2.0.57",
|
||||
"@design.estate/dees-element": "^2.0.34",
|
||||
"@design.estate/dees-wcctools": "^1.0.90"
|
||||
"@design.estate/dees-catalog": "^2.0.0",
|
||||
"@design.estate/dees-domtools": "^2.3.6",
|
||||
"@design.estate/dees-element": "^2.1.3",
|
||||
"@design.estate/dees-wcctools": "^1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.82",
|
||||
"@git.zone/tsbundle": "^2.0.15",
|
||||
"@git.zone/tsrun": "^1.2.49",
|
||||
"@git.zone/tswatch": "^2.0.23",
|
||||
"@push.rocks/projectinfo": "^5.0.2"
|
||||
"@git.zone/tsbuild": "^3.1.2",
|
||||
"@git.zone/tsbundle": "^2.6.1",
|
||||
"@git.zone/tsrun": "^2.0.0",
|
||||
"@git.zone/tswatch": "^2.2.1",
|
||||
"@push.rocks/projectinfo": "^5.0.2",
|
||||
"@types/node": "^24.10.1"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
@@ -52,5 +54,16 @@
|
||||
"UI",
|
||||
"frontend",
|
||||
"npm package"
|
||||
]
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://code.foss.global/uptime.link/webwidget.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://code.foss.global/uptime.link/webwidget/issues"
|
||||
},
|
||||
"homepage": "https://code.foss.global/uptime.link/webwidget#readme",
|
||||
"pnpm": {
|
||||
"overrides": {}
|
||||
}
|
||||
}
|
||||
|
||||
7070
pnpm-lock.yaml
generated
7070
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
79
readme.md
79
readme.md
@@ -1,4 +1,5 @@
|
||||
# @uptimelink/webwidget
|
||||
|
||||
the webwidget for public use of uptimelink
|
||||
|
||||
## Install
|
||||
@@ -18,9 +19,11 @@ yarn add @uptimelink/webwidget
|
||||
## Usage
|
||||
|
||||
### Introduction
|
||||
|
||||
The `@uptimelink/webwidget` package provides a web component that can be embedded into web pages to display uptime information for a given project on the UptimeLink platform. The component is implemented using TypeScript and leverages modern web standards including Web Components and LitElement.
|
||||
|
||||
### Basic Setup
|
||||
|
||||
First, you will need to import the `UptimelinkWebwidget` class and define it in your project. To do this, create an HTML file and include a script to register the web component.
|
||||
|
||||
```typescript
|
||||
@@ -32,30 +35,32 @@ document.body.appendChild(UptimelinkWebwidget.demo());
|
||||
```
|
||||
|
||||
### Setting Up in HTML
|
||||
|
||||
To use the widget in an HTML document, you will need to include the built JavaScript file. Here is an example:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Uptime Link Widget</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module">
|
||||
import { UptimelinkWebwidget } from './path_to_your_built_index.js';
|
||||
customElements.define('uptimelink-webwidget', UptimelinkWebwidget);
|
||||
|
||||
const widgetElement = document.createElement('uptimelink-webwidget');
|
||||
widgetElement.projectSlug = 'uptime.link';
|
||||
document.body.appendChild(widgetElement);
|
||||
</script>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Uptime Link Widget</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module">
|
||||
import { UptimelinkWebwidget } from './path_to_your_built_index.js';
|
||||
customElements.define('uptimelink-webwidget', UptimelinkWebwidget);
|
||||
|
||||
const widgetElement = document.createElement('uptimelink-webwidget');
|
||||
widgetElement.projectSlug = 'uptime.link';
|
||||
document.body.appendChild(widgetElement);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### Creating a Custom Page with the Widget
|
||||
|
||||
You can integrate the widget into a custom page to display uptime status. First, create a new TypeScript file for the page.
|
||||
|
||||
```typescript
|
||||
@@ -71,16 +76,19 @@ export const customPage = () => html`
|
||||
height: 120px;
|
||||
padding: 40px;
|
||||
width: 100%;
|
||||
background: rgba(0,0,0,0.2);
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<uptimelink-webwidget projectSlug="custom-project-slug"></uptimelink-webwidget>
|
||||
<uptimelink-webwidget
|
||||
projectSlug="custom-project-slug"
|
||||
></uptimelink-webwidget>
|
||||
</div>
|
||||
`;
|
||||
```
|
||||
|
||||
### Styling the Widget
|
||||
|
||||
The `UptimelinkWebwidget` component comes with default styles but you can override those styles to match your site's aesthetics. Below is an example of how this can be done:
|
||||
|
||||
```typescript
|
||||
@@ -99,18 +107,26 @@ UptimelinkWebwidget.styles = [
|
||||
.statusindicator {
|
||||
background: #28a745;
|
||||
}
|
||||
`
|
||||
`,
|
||||
];
|
||||
|
||||
document.body.appendChild(UptimelinkWebwidget.demo());
|
||||
```
|
||||
|
||||
### Advanced Interactions
|
||||
|
||||
The `UptimelinkWebwidget` allows for advanced interactions such as hovering effects to show detailed information. This is handled within the component's lifecycle and event handlers. Below is a detailed code snippet demonstrating lifecycle hooks and event listeners:
|
||||
|
||||
```typescript
|
||||
// uppimelink-webwidget.ts
|
||||
import { DeesElement, property, html, customElement, type TemplateResult, cssManager } from '@design.estate/dees-element';
|
||||
import {
|
||||
DeesElement,
|
||||
property,
|
||||
html,
|
||||
customElement,
|
||||
type TemplateResult,
|
||||
cssManager,
|
||||
} from '@design.estate/dees-element';
|
||||
import { DeesWindowLayer } from '@design.estate/dees-catalog';
|
||||
|
||||
@customElement('uptimelink-webwidget')
|
||||
@@ -126,9 +142,7 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
this.setupEventing();
|
||||
}
|
||||
|
||||
public static styles = [
|
||||
cssManager.defaultStyles,
|
||||
]
|
||||
public static styles = [cssManager.defaultStyles];
|
||||
|
||||
public render(): TemplateResult {
|
||||
return html`
|
||||
@@ -140,11 +154,9 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
<div class="statusindicator"></div>
|
||||
<div class="statustext">All systems are up!</div>
|
||||
</div>
|
||||
${this.showExpanded ? html`
|
||||
<div class="expanded">
|
||||
/* Expanded view content */
|
||||
</div>
|
||||
` : null}
|
||||
${this.showExpanded
|
||||
? html` <div class="expanded">/* Expanded view content */</div> `
|
||||
: null}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -173,7 +185,9 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
this.showExpanded = true;
|
||||
await this.performUpdate();
|
||||
await domtools.convenience.smartdelay.delayFor(50);
|
||||
const expandedDiv = this.shadowRoot.querySelector('.expanded') as HTMLElement;
|
||||
const expandedDiv = this.shadowRoot.querySelector(
|
||||
'.expanded',
|
||||
) as HTMLElement;
|
||||
expandedDiv.style.opacity = '1';
|
||||
};
|
||||
|
||||
@@ -193,12 +207,13 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
this.showExpanded = false;
|
||||
await domtools.convenience.smartdelay.delayFor(50);
|
||||
this.isFocused = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Utilizing Multiple Widgets
|
||||
|
||||
You can also utilize multiple instances of the web widget on a single page. Below is an example of how you could do this:
|
||||
|
||||
```typescript
|
||||
@@ -216,6 +231,7 @@ document.body.appendChild(widget2);
|
||||
```
|
||||
|
||||
### Building and Serving
|
||||
|
||||
To build the project, use the following npm scripts:
|
||||
|
||||
```bash
|
||||
@@ -229,6 +245,7 @@ npm run watch
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
Currently, the `test` script is identical to the `build` script. Running tests requires building the project:
|
||||
|
||||
```bash
|
||||
@@ -236,10 +253,12 @@ npm run test
|
||||
```
|
||||
|
||||
### Contributing
|
||||
|
||||
Contributions to the `@uptimelink/webwidget` project are welcome! Please follow the guidelines provided in the repository. Reach out on the project issues page for discussions, questions, or follow the established process for submitting pull requests.
|
||||
|
||||
### Conclusion
|
||||
|
||||
This guide covered the steps needed to install, set up, and use the `@uptimelink/webwidget` package in your TypeScript projects. We also explored various ways to customize and extend the widget, ensuring seamless integration into your existing web applications. For more detailed information, refer to the [documentation](https://uptimelink.gitlab.io/webwidget/).
|
||||
|
||||
Feel free to check the links provided in the initial sections for more context and updates about the project's status and availability.
|
||||
undefined
|
||||
undefined
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@uptime.link/webwidget',
|
||||
version: '1.1.2',
|
||||
version: '1.2.4',
|
||||
description: 'The web widget for public use of uptimelink, allowing users to monitor uptime status through a user-friendly interface.'
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import { DeesElement, property, html, customElement, type TemplateResult, cssManager } from '@design.estate/dees-element';
|
||||
import {
|
||||
DeesElement,
|
||||
property,
|
||||
html,
|
||||
customElement,
|
||||
type TemplateResult,
|
||||
cssManager,
|
||||
css,
|
||||
} from '@design.estate/dees-element';
|
||||
|
||||
import { DeesWindowLayer } from '@design.estate/dees-catalog';
|
||||
|
||||
@@ -15,21 +23,27 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
`;
|
||||
|
||||
@property({
|
||||
type: Boolean
|
||||
type: Boolean,
|
||||
reflect: true,
|
||||
})
|
||||
isOnTop = false;
|
||||
accessor isOnTop = false;
|
||||
|
||||
@property()
|
||||
public projectSlug: string;
|
||||
public accessor projectSlug: string;
|
||||
|
||||
@property()
|
||||
public isFocused = false;
|
||||
public accessor isFocused = false;
|
||||
|
||||
@property()
|
||||
public isElevated = false;
|
||||
public accessor isElevated = false;
|
||||
|
||||
@property()
|
||||
public showExpanded: boolean = false;
|
||||
@property({
|
||||
type: Boolean,
|
||||
reflect: true,
|
||||
})
|
||||
public accessor showExpanded: boolean = false;
|
||||
|
||||
public parentWebwidget: UptimelinkWebwidget;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -38,137 +52,149 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
|
||||
public static styles = [
|
||||
cssManager.defaultStyles,
|
||||
]
|
||||
css`
|
||||
:host {
|
||||
position: relative;
|
||||
display: block;
|
||||
height: 30px;
|
||||
}
|
||||
.mainbox {
|
||||
position: relative;
|
||||
line-height: 1em;
|
||||
margin: auto;
|
||||
font-family: Roboto;
|
||||
font-weight: 540;
|
||||
font-size: 12px;
|
||||
box-sizing: border-box;
|
||||
width: 150px;
|
||||
border-radius: 15px;
|
||||
height: 30px;
|
||||
background: ${cssManager.bdTheme('#ffffff', '#000000')};
|
||||
box-shadow: ${cssManager.bdTheme('0px 0px 5px rgba(0,0,0,0.1)', '')};
|
||||
border: 1px solid ${cssManager.bdTheme('#ffffff', '#333333')};
|
||||
padding: 4px;
|
||||
color: ${cssManager.bdTheme('#333', '#CCC')};
|
||||
cursor: pointer;
|
||||
transition: all 0.2s, background 0.1s;
|
||||
overflow: hidden;
|
||||
will-change: transform;
|
||||
opacity: 1;
|
||||
}
|
||||
.mainbox.hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.firstLine {
|
||||
display: grid;
|
||||
grid-template-columns: 26px auto;
|
||||
}
|
||||
|
||||
.mainbox.focused {
|
||||
width: 182px;
|
||||
height: 117px;
|
||||
transform: translateX(-16px);
|
||||
background: ${cssManager.bdTheme('#ffffff', '#222222')} !important;
|
||||
box-shadow: ${cssManager.bdTheme('0px 0px 5px rgba(0,0,0,0.1)', '')} !important;
|
||||
}
|
||||
|
||||
.statusindicator {
|
||||
transform: translate(4px, 4px);
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
background: #66bb6a;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.statustext {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.expanded {
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s;
|
||||
}
|
||||
|
||||
.miniHeading {
|
||||
position: absolute;
|
||||
width: 190px;
|
||||
top: 25px;
|
||||
left: 5px;
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.miniOverview24h {
|
||||
position: absolute;
|
||||
top: 55px;
|
||||
left: 5px;
|
||||
background: ${cssManager.bdTheme('rgba(0,0,0,0.07)', 'rgba(255,255,255,0.07)')};
|
||||
border-radius: 3px;
|
||||
width: 172px;
|
||||
height: 30px;
|
||||
display: grid;
|
||||
padding: 3px 3px;
|
||||
grid-template-columns: repeat(30, 4px);
|
||||
grid-column-gap: 3px;
|
||||
}
|
||||
|
||||
.miniOverview24h .statusBar {
|
||||
background: ${cssManager.bdTheme('rgba(0,0,0,0.15)', 'rgba(255,255,255,0.15)')};
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.miniOverview24h .statusBar.ok {
|
||||
background: #66bb6a;
|
||||
}
|
||||
|
||||
.viewStatuspage {
|
||||
position: absolute;
|
||||
width: 172px;
|
||||
top: 80px;
|
||||
left: 5px;
|
||||
text-align: center;
|
||||
background: ${cssManager.bdTheme('rgba(0,0,0,0.07)', 'rgba(255,255,255,0.07)')};
|
||||
border-radius: 3px 3px 10px 10px;
|
||||
padding: 5px;
|
||||
margin-top: 10px;
|
||||
transition: background 0.1s;
|
||||
}
|
||||
|
||||
.viewStatuspage:hover {
|
||||
background: ${cssManager.bdTheme('rgba(0,0,0,0.1)', 'rgba(255,255,255,0.1)')};
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
public render(): TemplateResult {
|
||||
return html`
|
||||
<style>
|
||||
:host {
|
||||
position: relative;
|
||||
display: block;
|
||||
height: 30px;
|
||||
z-index: ${this.isElevated || this.isOnTop ? '1000' : 'auto'} ;
|
||||
}
|
||||
.mainbox {
|
||||
position: relative;
|
||||
line-height: 1em;
|
||||
margin: auto;
|
||||
font-family: Roboto;
|
||||
font-weight: 540;
|
||||
font-size: 12px;
|
||||
box-sizing: border-box;
|
||||
width: 150px;
|
||||
border-radius: 15px;
|
||||
height: 30px;
|
||||
background: ${this.goBright ? '#fff' : '#222' };
|
||||
box-shadow: ${this.goBright ? '0px 0px 5px rgba(0,0,0,0.1)' : ''};
|
||||
padding: 5px;
|
||||
color: ${this.goBright ? '#333' : '#CCC' };
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
overflow: hidden;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.firstLine {
|
||||
display: grid;
|
||||
grid-template-columns: 26px auto;
|
||||
}
|
||||
|
||||
.mainbox.focused {
|
||||
width: 182px;
|
||||
height: 117px;
|
||||
transform: scale(1.1, 1.1);
|
||||
}
|
||||
|
||||
.statusindicator {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
background: #66BB6A;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.statustext {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.expanded {
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s;
|
||||
}
|
||||
|
||||
.miniHeading {
|
||||
position: absolute;
|
||||
width: 190px;
|
||||
top: 25px;
|
||||
left: 5px;
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.miniOverview24h {
|
||||
position: absolute;
|
||||
top: 55px;
|
||||
left: 5px;
|
||||
background: ${this.goBright ? 'rgba(0,0,0,0.07)' : 'rgba(255,255,255,0.07)'};
|
||||
border-radius: 3px;
|
||||
width: 172px;
|
||||
height: 30px;
|
||||
display: grid;
|
||||
padding: 3px 3px;
|
||||
grid-template-columns: repeat(30, 4px);
|
||||
grid-column-gap: 3px;
|
||||
}
|
||||
|
||||
.miniOverview24h .statusBar {
|
||||
background: ${this.goBright ? 'rgba(0,0,0,0.15)' : 'rgba(255,255,255,0.15)'};
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.miniOverview24h .statusBar.ok {
|
||||
background: #66BB6A;
|
||||
}
|
||||
|
||||
.viewStatuspage {
|
||||
position: absolute;
|
||||
width: 172px;
|
||||
top: 80px;
|
||||
left: 5px;
|
||||
text-align: center;
|
||||
background: ${this.goBright ? 'rgba(0,0,0,0.07)' : 'rgba(255,255,255,0.07)'};
|
||||
border-radius: 3px 3px 10px 10px;
|
||||
padding: 5px;
|
||||
margin-top: 10px;
|
||||
transition: background 0.1s;
|
||||
}
|
||||
|
||||
.viewStatuspage:hover {
|
||||
background: ${this.goBright ? 'rgba(0,0,0,0.1)' : 'rgba(255,255,255,0.1)'};
|
||||
}
|
||||
:host {
|
||||
z-index: ${this.isElevated || this.isOnTop ? '2000' : 'auto'};
|
||||
}
|
||||
</style>
|
||||
<div class="mainbox ${this.isFocused ? 'focused' : null}">
|
||||
<div class="firstLine">
|
||||
<div class="statusindicator"></div>
|
||||
<div class="statustext">All systems are up!</div>
|
||||
</div>
|
||||
${this.showExpanded ? html`
|
||||
<div class="expanded">
|
||||
<div class="miniHeading">
|
||||
last 24 hours:
|
||||
</div>
|
||||
<div class="miniOverview24h">
|
||||
${(() => {
|
||||
let counter = 0;
|
||||
const returnArray = [];
|
||||
while(counter < 24) {
|
||||
returnArray.push(html`<div class="statusBar ok"></div>`)
|
||||
counter++;
|
||||
};
|
||||
return returnArray;
|
||||
})()}
|
||||
</div>
|
||||
<div class="viewStatuspage">View full Statuspage ...</div>
|
||||
</div>
|
||||
` : null}
|
||||
${this.showExpanded
|
||||
? html`
|
||||
<div class="expanded">
|
||||
<div class="miniHeading">last 24 hours:</div>
|
||||
<div class="miniOverview24h">
|
||||
${(() => {
|
||||
let counter = 0;
|
||||
const returnArray = [];
|
||||
while (counter < 24) {
|
||||
returnArray.push(html`<div class="statusBar ok"></div>`);
|
||||
counter++;
|
||||
}
|
||||
return returnArray;
|
||||
})()}
|
||||
</div>
|
||||
<div class="viewStatuspage">View full Statuspage ...</div>
|
||||
</div>
|
||||
`
|
||||
: null}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -183,11 +209,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,7 +238,8 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
return;
|
||||
}
|
||||
this.windowLayer.destroy();
|
||||
domtools.convenience.smartdelay.delayFor(200).then(() => {
|
||||
this.parentWebwidget.shadowRoot.querySelector('.mainbox').classList.remove('hidden');
|
||||
domtools.convenience.smartdelay.delayFor(200).then(async () => {
|
||||
if (!this.isFocused) {
|
||||
this.isElevated = false;
|
||||
this.remove();
|
||||
@@ -223,6 +252,6 @@ export class UptimelinkWebwidget extends DeesElement {
|
||||
this.showExpanded = false;
|
||||
await domtools.convenience.smartdelay.delayFor(50);
|
||||
this.isFocused = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
2
ts_web/pages/index.ts
Normal file
2
ts_web/pages/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './page2.js';
|
||||
export * from './page1.js';
|
||||
18
ts_web/pages/page1.ts
Normal file
18
ts_web/pages/page1.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { html } from "@design.estate/dees-element";
|
||||
|
||||
export const page1 = () => html`
|
||||
<style>
|
||||
.container {
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
height: 120px;
|
||||
padding: 40px;
|
||||
width: 100%;
|
||||
background: rgba(0,0,0,0.2);
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<uptimelink-webwidget></uptimelink-webwidget>
|
||||
</div>
|
||||
`;
|
||||
5
ts_web/pages/page2.ts
Normal file
5
ts_web/pages/page2.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { html } from "@design.estate/dees-element";
|
||||
|
||||
export const page2 = () => html`
|
||||
<lele-statusbar></lele-statusbar>
|
||||
`;
|
||||
@@ -1,14 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {}
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
"exclude": ["dist_*/**/*.d.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user