# web-components-content

> WebComponents base components

Latest version **1.0.10** (published 2021-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install web-components-content
pnpm add web-components-content
yarn add web-components-content
bun add web-components-content
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2021-01-18 |
| First published | 2020-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | zy445566 |
| Maintainers | zy445566 |
| Keywords | web, base, components, WebComponents |

## Links

- npm: https://www.npmjs.com/package/web-components-content
- Repository: https://github.com/zy445566/web-components-content
- Homepage: https://github.com/zy445566/web-components-content#readme
- Issues: https://github.com/zy445566/web-components-content/issues
- npm.io page: https://npm.io/package/web-components-content

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.10 (latest) — 2021-01-18
- 1.0.9 — 2020-08-28
- 1.0.8 — 2020-08-28
- 1.0.7 — 2020-08-28
- 1.0.6 — 2020-08-27
- 1.0.5 — 2020-08-27
- 1.0.4 — 2020-08-27
- 1.0.3 — 2020-08-27
- 1.0.2 — 2020-08-27
- 1.0.1 — 2020-08-27
- 1.0.0 — 2020-08-27

## README

# web-components-content
WebComponents base components 

# install
```sh
npm install web-components-content
```

# use
### HTMLContent
```js
import indexHtml from './index.html'
import {HTMLContent} from 'web-components-content'
export default class MyHome extends HTMLContent {
    constructor() {
        super();
        this.render(indexHtml,{name:'Tom'});
        this.addStyleSheets(document.styleSheets);
        this.init();
    }
}
```
OR
```js
const indexHtml ='<h1>${name}</h1>';
import {HTMLContent} from 'web-components-content'
export default class MyHome extends HTMLContent {
    constructor() {
        super();
        this.render(indexHtml,{name:'Tom'});
        this.addStyleSheets(document.styleSheets);
        this.init();
    }
}
```
### MyHashRoute
```html
<!-- app.html -->
<my-router>
    <my-hash-route path="" tag="my-home"></my-hash-route>
    <my-hash-route path="#my-monitor" tag="my-monitor"></my-hash-route>
</my-router>
```
```js
import appHtml from './app.html'
import {HTMLContent,MyHashRoute,MyRouter} from 'web-components-content'
import MyHome from '@/pages/MyHome/index.js'
import myMonitor from '@/pages/myMonitor/index.js'
class AppContainer extends HTMLContent {
    constructor() {
        super();
        this.render(appHtml)
        this.addStyleSheets(document.styleSheets)
    }
}
window.customElements.define('app-container', AppContainer);
window.customElements.define('my-home', MyHome);
window.customElements.define('my-monitor', myMonitor);
window.customElements.define('my-router', MyRouter);
window.customElements.define('my-hash-route', MyHashRoute);
```

### MyBrowseRoute
```html
<!-- app.html -->
<my-router>
    <my-browse-route path="/" tag="my-home"></my-browse-route>
    <my-browse-route path="/my-monitor" tag="my-monitor"></my-browse-route>
</my-router>
```
```js
import appHtml from './app.html'
import {HTMLContent,MyBrowseRoute,MyRouter} from 'web-components-content'
import MyHome from '@/pages/MyHome/index.js'
import myMonitor from '@/pages/myMonitor/index.js'
class AppContainer extends HTMLContent {
    constructor() {
        super();
        this.render(appHtml)
        this.addStyleSheets(document.styleSheets)
    }
}
window.customElements.define('app-container', AppContainer);
window.customElements.define('my-home', MyHome);
window.customElements.define('my-monitor', myMonitor);
window.customElements.define('my-router', MyRouter);
window.customElements.define('my-browse-route', MyBrowseRoute);
```

---
_Source: https://npm.io/package/web-components-content · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
