# msc-zoom

> is a web component. All we need to do is put the required script into your HTML document. Then follow 's html structure and everything will be all set.

Latest version **1.0.0** (published 2022-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install msc-zoom
pnpm add msc-zoom
yarn add msc-zoom
bun add msc-zoom
```

## 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.0 |
| Published | 2022-08-22 |
| First published | 2022-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 39.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Paul Li |
| Maintainers | meistudioli |
| Keywords | web, front-end, web component, image, zoom |

## Links

- npm: https://www.npmjs.com/package/msc-zoom
- Repository: https://github.com/meistudioli/msc-zoom
- Homepage: https://github.com/meistudioli/msc-zoom#readme
- Issues: https://github.com/meistudioli/msc-zoom/issues
- npm.io page: https://npm.io/package/msc-zoom

## 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.0 (latest) — 2022-08-22

## README

# msc-zoom

[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/msc-zoom) [![DeepScan grade](https://deepscan.io/api/teams/16372/projects/22012/branches/644916/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=16372&pid=22012&bid=644916)

&lt;msc-zoom /> is a web component which provide zoom-in / zoom-out effects for image closing watch. Users could just tap the part they like to have a closing watch.

![<msc-zoom />](https://blog.lalacube.com/mei/img/preview/msc-zoom.png)

## Basic Usage

&lt;msc-zoom /> is a web component. All we need to do is put the required script into your HTML document. Then follow &lt;msc-zoom />'s html structure and everything will be all set.

- Required Script

```html
<script
  type="module"
  src="https://your-domain/wc-msc-zoom.js">        
</script>
```

- Structure

Put img[slot="msc-zoom-vision"] inside &lt;msc-zoom /> as its child. It will use it as source.

```html
<msc-zoom>
  <script type="application/json">
    {
      "active": false,
      "duration": 300,
      "scale": 2
    }
  </script>
  <img src="https://picsum.photos/id/26/1000/670" alt="mas-zoom image" slot="msc-zoom-vision" />
</msc-zoom>
```

## JavaScript Instantiation

&lt;msc-zoom /> could also use JavaScript to create DOM element. Here comes some examples.

```html
<script type="module">
import { MscZoom } from 'https://your-domain/wc-msc-zoom.js';

const content = document.querySelector('img[slot="msc-zoom-vision"]');

// use DOM api
const nodeA = document.createElement('msc-zoom');
nodeA.appendChild(content.cloneNode(true));
document.body.appendChild(nodeA);
nodeA.scale = 2;

// new instance with Class
const nodeB = new MscZoom();
nodeB.appendChild(content.cloneNode(true));
document.body.appendChild(nodeB);
nodeB.scale = 3;

// new instance with Class & default config
const config = {
  scale: 3.5,
  duration: 500
};
const nodeC = new MscZoom(config);
nodeC.appendChild(content.cloneNode(true));
document.body.appendChild(nodeC);
</script>
```

## Style Customization

Developers could apply styles to decorate img[slot="msc-zoom-vision"].

```html
<style>
img[slot="msc-zoom-vision"] {
  object-fit: cover;
}
</style>
```

## Attributes

&lt;msc-zoom /> supports some attributes to let it become more convenience & useful.

- **active**

Set active for &lt;msc-zoom />. It will zoom-in once set true. Default is `false` (not set).

```html
<msc-zoom
  active
>
  <img src="https://picsum.photos/id/635/1000/670" slot="msc-zoom-vision" />
</msc-zoom>
```

- **duration**

Set duration for &lt;msc-zoom /> zoom-in / zoom-out animation. Default is `300` (ms).

```html
<msc-zoom
  duration="300"
>
  <img src="https://picsum.photos/id/635/1000/670" slot="msc-zoom-vision" />
</msc-zoom>
```

- **scale**

Set scale for &lt;msc-zoom />. Default is `2`.

```html
<msc-zoom
  scale="2"
>
  <img src="https://picsum.photos/id/635/1000/670" slot="msc-zoom-vision" />
</msc-zoom>
```


## Properties

| Property Name | Type | Description |
| ----------- | ----------- | ----------- |
| active | Boolean | 	Getter / Setter for active. It will turn on / off zoom effects. |
| duration | Number | Getter / Setter for duration. The zoom animation's duration will apply this value with unit ms. Default is `300`. |
| scale | Number | Getter / Setter for scale. The scale rate will apply this value. Default is `2`. |


## Event

| Event Signature | Description |
| ----------- | ----------- |
| msc-zoom-click | Fired when &lt;msc-zoom /> has been clicked. Developers could get `mode` through `event.detail`. |


## Reference
- [&lt;msc-zoom /&gt;](https://blog.lalacube.com/mei/webComponent_msc-zoom.html)

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