# stenciljs-in-angular

> [Stencil](https://stenciljs.com/) is not a JS framework. It is a compiler that produces a reusable web component that can be embedded anywhere else.

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

## Install

```sh
npm install stenciljs-in-angular
pnpm add stenciljs-in-angular
yarn add stenciljs-in-angular
bun add stenciljs-in-angular
```

## 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 | 2018-08-08 |
| First published | 2018-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 14 |
| Unpacked size | 28.7 KB |
| Known vulnerabilities | 0 (+21 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Alessandro Genova |
| Maintainers | alesgenova |
| Keywords | stenciljs, webcomponents, angular, javascript, typescript |

## Links

- npm: https://www.npmjs.com/package/stenciljs-in-angular
- Repository: https://github.com/alesgenova/stenciljs-in-angular
- Homepage: https://github.com/alesgenova/stenciljs-in-angular#readme
- Issues: https://github.com/alesgenova/stenciljs-in-angular/issues
- npm.io page: https://npm.io/package/stenciljs-in-angular

## Dependencies (14)

- [rxjs](https://npm.io/package/rxjs.md) ^6.0.0
- [core-js](https://npm.io/package/core-js.md) ^2.5.4
- [split-me](https://npm.io/package/split-me.md) ^0.3.1
- [@angular/core](https://npm.io/package/@angular/core.md) ^6.0.3
- [@angular/http](https://npm.io/package/@angular/http.md) ^6.0.3
- [@angular/forms](https://npm.io/package/@angular/forms.md) ^6.0.3
- [@angular/common](https://npm.io/package/@angular/common.md) ^6.0.3
- [@angular/router](https://npm.io/package/@angular/router.md) ^6.0.3
- [@angular/compiler](https://npm.io/package/@angular/compiler.md) ^6.0.3
- [@angular/animations](https://npm.io/package/@angular/animations.md) ^6.0.3
- [@angular/platform-browser](https://npm.io/package/@angular/platform-browser.md) ^6.0.3
- [@openchemistry/sample-data](https://npm.io/package/@openchemistry/sample-data.md) ^0.3.3
- [@openchemistry/molecule-vtkjs](https://npm.io/package/@openchemistry/molecule-vtkjs.md) ^0.1.9
- [@angular/platform-browser-dynamic](https://npm.io/package/@angular/platform-browser-dynamic.md) ^6.0.3

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-08-08

## README

# Stencil components in Angular

[Stencil](https://stenciljs.com/) is not a JS framework. It is a compiler that produces a reusable web component that can be embedded anywhere else.

This is a step by step guide to consume a non-trivial stencil component in an [Angular](https://angular.io/) app.

The starter Angular app was created with [Angular CLI](https://angular.io/guide/quickstart).

## Similar guides
- [Stencil components in React](https://github.com/alesgenova/stenciljs-in-react.git)
- [Stencil components in Vue](https://github.com/alesgenova/stenciljs-in-vue.git)

## Table of contents
- [Add the component(s) to the dependencies](#1-add-the-components-to-the-dependencies)
- [Import the component](#2-import-the-components)
- [Consume the component](#3-consume-the-component)

## 0: Build a stenciljs component and publish it to npm
Creating your first stencil component is very easy and it is well documented [here](https://stenciljs.com/docs/my-first-component). 

This example will consume two components:
- [@openchemistry/molecule-vtkjs](https://github.com/OpenChemistry/oc-web-components/tree/master/packages/molecule-vtkjs) : To display molecular structures
- [split-me](https://github.com/alesgenova/split-me) : To create resizable split layouts

## 1: Add the component(s) to the dependencies

Add the component to the app dependencies in `package.json`

```json
// package.json

"dependencies": {
  ...
  "@openchemistry/molecule-vtkjs": "^0.1.9",
  "split-me": "^0.3.1"
}
```

## 2: Import the component(s)
Import the component in the `main.js` of the app:
```js
import { defineCustomElements as defineMolecule } from '@openchemistry/molecule-vtkjs';
import { defineCustomElements as defineSplitMe } from 'split-me';

defineMolecule(window);
defineSplitMe(window);
```

## 3: Consume the component
To prevent Angular from complaining that there is an unrecognized component tag, add `CUSTOM_ELEMENTS_SCHEMA` to the `schemas` array in `app.module.ts`.

```ts
import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule { }

```

It is now possible to use the tag provided by the stencil component in any template of the app.

```html
<split-me n="2">
  <oc-molecule-vtkjs slot="0" [cjson]="molecule0"></oc-molecule-vtkjs>
  <oc-molecule-vtkjs slot="1" [cjson]="molecule1"></oc-molecule-vtkjs>
</split-me>
```

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