To install the `@uptimelink/webwidget` package, you need to have Node.js and npm (or yarn) installed. Once you have these prerequisites, you can install the package via npm by running the following command in your terminal:
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
// index.ts
import { UptimelinkWebwidget } from '@uptimelink/webwidget';
// Append the webwidget component to the document body
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
// customStyles.ts
import { UptimelinkWebwidget } from '@uptimelink/webwidget';
import { cssManager } from '@design.estate/dees-element';
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 { DeesWindowLayer } from '@design.estate/dees-catalog';
@customElement('uptimelink-webwidget')
export class UptimelinkWebwidget extends DeesElement {
To build the project, use the following npm scripts:
```bash
npm run build
```
To watch for changes and rebuild automatically:
```bash
npm run watch
```
### Testing
Currently, the `test` script is identical to the `build` script. Running tests requires building the project:
```bash
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.
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/).