# lego-web-components

> importas el componente deseado ```js import createComp from '**@component-path**' ```

Latest version **1.0.6** (published 2021-11-27) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2021-11-27 |
| First published | 2021-11-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | admirableyetti |

## Links

- npm: https://www.npmjs.com/package/lego-web-components
- npm.io page: https://npm.io/package/lego-web-components

## Dependencies (1)

- [@polight/lego](https://npm.io/package/@polight/lego.md) ^1.6.6

## Recent versions

- 1.0.6 (latest) — 2021-11-27
- 1.0.5 — 2021-11-27
- 1.0.4 — 2021-11-27
- 1.0.3 — 2021-11-27
- 1.0.2 — 2021-11-26
- 1.0.1 — 2021-11-26
- 1.0.0 — 2021-11-26

## README

importas el componente deseado
```js
import createComp from '**@component-path**'
```

en tu index.js lo declaras dentro de un custom elements
```js
customElements.define('hello-world', createComp())
```

puede recibir la configuración del componente como parámetro ó ...
```js
customElements.define('hello-world', createComp(
  {
    width: "100px",
    scale: 1.1,
    time: ".4s",
    companim: "ease-out",
    maskOpacity: 0.5,
    maskColor: '#fff'
  }
))
```

... como atibuto **config** en la etiqueta html
```html
<hello-world config='{
    "width":"200px", 
    "scale":1.1, 
    "time":".4s", 
    "companim":"ease-out", 
    "maskOpacity":0.6,
    "maskColor":"blue"
  }'>
</hello-world>
```
para que herede las propiedades del componente agregas el css-->
```css
img {
  width: inherit;
}
```
en caso de que ocupes que redireccione el **css** es

```css
a{
  width: inherit;
}
img {
  width: inherit;
}
```

el componente basico debe contener la etiqueta img con el slot **img**  
```html
<hello-world>
  <img slot="img" src="url img" alt="">
</hello-world>
```

para acceder a la configuracion que agregaste en tu **js** agrega el attributo **file**
```html 
<hello-world file>
  <img slot="img" src="url img" alt="">
</hello-world>
```

si ocupas que redireccione agrega el attributo **link**
```html
<hello-world file link>
  <a slot="link" href="#">
    <img slot="img" src="url img" alt="">
  </a>
</hello-world>
```

un ejemplo seria 
```html
<script>
  import createComp from '**@component-path**'

  customElements.define('hello-world', createComp({
  width: "100px",
  scale: 1.1,
  time: ".4s",
  companim: "ease-out",
  maskOpacity: 0.5,
  maskColor: '#ff5'
}))
</script>


<hello-world file link>
  <a slot="link" href="#">
    <img slot="img" src="url img" alt="">
  </a>
</hello-world>


<style>
  a{
    width: inherit;
    }
  img {
    width: inherit;
  }
</style>
```

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