# @implicitcast/web-component-wrapper

> web component wrapper

Latest version **0.0.5** (published 2021-03-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install @implicitcast/web-component-wrapper
pnpm add @implicitcast/web-component-wrapper
yarn add @implicitcast/web-component-wrapper
bun add @implicitcast/web-component-wrapper
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2021-03-05 |
| First published | 2020-12-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Peng Yanbing |
| Maintainers | pengyanb |

## Links

- npm: https://www.npmjs.com/package/@implicitcast/web-component-wrapper
- Repository: https://github.com/pengyanb/react-drag-drop-resizable
- Homepage: https://github.com/pengyanb/react-drag-drop-resizable#readme
- Issues: https://github.com/pengyanb/react-drag-drop-resizable/issues
- npm.io page: https://npm.io/package/@implicitcast/web-component-wrapper

## Dependencies (1)

- [react-shadow-dom-retarget-events](https://npm.io/package/react-shadow-dom-retarget-events.md) ^1.0.11

## Recent versions

- 0.0.5 (latest) — 2021-03-05
- 0.0.3-feature-seperateBuildFolder.11 (beta) — 2021-01-27
- 0.0.4 — 2021-01-27
- 0.0.3-feature-seperateBuildFolder.10 — 2021-01-25
- 0.0.3-feature-seperateBuildFolder.9 — 2021-01-25
- 0.0.3-feature-htmlWebpackPluginHook.8 — 2021-01-17
- 0.0.3-feature-htmlWebpackPluginHook.7 — 2021-01-16
- 0.0.3-feature-htmlWebpackPluginHook.6 — 2021-01-16
- 0.0.3-feature-htmlWebpackPluginHook.5 — 2021-01-15
- 0.0.3 — 2021-01-13
- 0.0.2 — 2021-01-10
- 0.0.1-main.6 — 2021-01-09
- 0.0.1-main.5 — 2020-12-30
- 0.0.1 — 2020-12-30

## README

## Web Component Wrapper

Wrapper utility encapsulates react application in a web component.

### Installation

```npm
npm install --save @implicitcast/web-component-wrapper @webcomponents/webcomponentsjs @craco/craco

```

### Add Boilerplate files

1. Create file 'craco.config.js' at root path with content

```js
const {
  reactWrapperWebpackConfigure,
} = require("@implicitcast/web-component-wrapper");
module.exports = {
  webpack: {
    configure: reactWrapperWebpackConfigure,
  },
};
```

2. Create a file with path 'src/index.webcomponent.tsx'

```js
import "@webcomponents/webcomponentsjs/custom-elements-es5-adapter";
import "@webcomponents/webcomponentsjs/webcomponents-loader";
import { reactWebComponentWrapper } from "@implicitcast/web-component-wrapper";
import App from "./App";
reactWebComponentWrapper(App, "web-component-test"); // Second parameter names the webComponent
```

3. Edit 'public/index.html' file

```html
<html>
  .....
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <web-component-test></web-component-test>
    <!-- Add webComponent tag -->
  </body>
</html>
```

4. Update 'package.json' file

```js
{
  "scripts": {
    "start": "craco start",
    "build": "craco build",
    "start:webcomp": "craco start webComponentEntry:src/index.webcomponent.tsx useWebComponent:true",
    "build:webcomp": "craco start webComponentEntry:src/index.webcomponent.tsx useWebComponent:true"
  }
}
```

5. run npm command to start app with web-component wrapper

```npm
npm run start:webcomp
```

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