Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: generate documations #37

Merged
merged 12 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 2 additions & 38 deletions packages/element/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,6 @@ npm install @nexim/element
yarn add @nexim/element
```

## API
## Documentation

### LoggerMixin

The LoggerMixin adds logging capabilities to your LitElement components. It logs lifecycle methods and measures update times.

```ts
import {LitElement, html} from 'lit';
import {LoggerMixin} from '@nexim/element';

class MyElement extends LoggerMixin(LitElement) {
protected override render() {
super.render(); // must call super method to logger work

return html`<p>Hello, world!</p>`;
}
}
```

### LightDomMixin

The LightDomMixin enables light DOM rendering and style encapsulation for LitElement components.

```ts
import {LitElement, html, css} from 'lit';
import {LightDomMixin} from '@nexim/element';

class MyLightDomElement extends LightDomMixin(LitElement) {
static styles = css`
p {
color: blue;
}
`;

protected override render() {
return html`<p>Hello, light DOM!</p>`;
}
}
```
Read full documentation [here](./docs/README.md).
14 changes: 14 additions & 0 deletions packages/element/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# @nexim/element

## Interfaces

| Interface | Description |
| ---------------------------------------------------------- | --------------------------------------------------- |
| [LoggerMixinInterface](interfaces/LoggerMixinInterface.md) | Interface for elements that have a logger instance. |

## Functions

| Function | Description |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| [LightDomMixin](functions/LightDomMixin.md) | A mixin to enable light DOM rendering and style encapsulation for LitElement components. |
| [LoggerMixin](functions/LoggerMixin.md) | Create a mixin class that extends the provided superclass and logs the lifecycle methods of the element. |
44 changes: 44 additions & 0 deletions packages/element/docs/functions/LightDomMixin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[@nexim/element](../README.md) / LightDomMixin

# Function: LightDomMixin()

> **LightDomMixin**\<`T`\>(`superClass`: `T`): `T`

A mixin to enable light DOM rendering and style encapsulation for LitElement components.

## Type Parameters

| Type Parameter | Default type | Description |
| ------------------------------------- | ----------------------- | ------------------------- |
| `T` _extends_ `Class`\<`LitElement`\> | `Class`\<`LitElement`\> | The base class to extend. |

## Parameters

| Parameter | Type |
| ------------ | ---- |
| `superClass` | `T` |

## Returns

`T`

A class that extends the base class with light DOM functionality.

## Example

```ts
import {LitElement, html, css} from 'lit';
import {LightDomMixin} from '@nexim/element';

class MyLightDomElement extends LightDomMixin(LitElement) {
static styles = css`
p {
color: blue;
}
`;

protected override render() {
return html`<p>Hello, light DOM!</p>`;
}
}
```
42 changes: 42 additions & 0 deletions packages/element/docs/functions/LoggerMixin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[@nexim/element](../README.md) / LoggerMixin

# Function: LoggerMixin()

> **LoggerMixin**\<`T`\>(`superClass`: `T`): `Class`\<[`LoggerMixinInterface`](../interfaces/LoggerMixinInterface.md)\> & `T`

Create a mixin class that extends the provided superclass and logs the lifecycle methods of the element.

Hint: function super() must be called in the methods to logger work.

## Type Parameters

| Type Parameter | Default type | Description |
| ------------------------------------- | ----------------------- | ------------------------- |
| `T` _extends_ `Class`\<`LitElement`\> | `Class`\<`LitElement`\> | The base class to extend. |

## Parameters

| Parameter | Type |
| ------------ | ---- |
| `superClass` | `T` |

## Returns

`Class`\<[`LoggerMixinInterface`](../interfaces/LoggerMixinInterface.md)\> & `T`

A mixin class that extends the superclass and logs the lifecycle methods of the element.

## Example

```ts
import {LitElement, html} from 'lit';
import {LoggerMixin} from '@nexim/element';

class MyElement extends LoggerMixin(LitElement) {
protected override render() {
super.render(); // must call super method to logger work

return html`<p>Hello, world!</p>`;
}
}
```
Loading
Loading