{"id":13660803,"url":"https://github.com/alesgenova/stenciljs-in-angular","last_synced_at":"2025-04-12T23:34:56.193Z","repository":{"id":57370763,"uuid":"137689894","full_name":"alesgenova/stenciljs-in-angular","owner":"alesgenova","description":"Stenciljs components in Angular: step by step guide ","archived":false,"fork":false,"pushed_at":"2018-11-08T03:05:43.000Z","size":17,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T23:06:00.386Z","etag":null,"topics":["angular","stenciljs","webcomponents"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alesgenova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-17T22:02:05.000Z","updated_at":"2024-11-18T08:23:48.000Z","dependencies_parsed_at":"2022-09-26T16:50:31.401Z","dependency_job_id":null,"html_url":"https://github.com/alesgenova/stenciljs-in-angular","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesgenova%2Fstenciljs-in-angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesgenova%2Fstenciljs-in-angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesgenova%2Fstenciljs-in-angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesgenova%2Fstenciljs-in-angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alesgenova","download_url":"https://codeload.github.com/alesgenova/stenciljs-in-angular/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239994002,"owners_count":19730780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","stenciljs","webcomponents"],"created_at":"2024-08-02T05:01:25.901Z","updated_at":"2025-02-22T12:30:30.026Z","avatar_url":"https://github.com/alesgenova.png","language":"TypeScript","readme":"# Stencil components in Angular\n\n[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.\n\nThis is a step by step guide to consume a non-trivial stencil component in an [Angular](https://angular.io/) app.\n\nThe starter Angular app was created with [Angular CLI](https://angular.io/guide/quickstart).\n\n## Similar guides\n- [Stencil components in React](https://github.com/alesgenova/stenciljs-in-react.git)\n- [Stencil components in Vue](https://github.com/alesgenova/stenciljs-in-vue.git)\n\n## Table of contents\n- [Add the component(s) to the dependencies](#1-add-the-components-to-the-dependencies)\n- [Import the component](#2-import-the-components)\n- [Consume the component](#3-consume-the-component)\n\n## 0: Build a stenciljs component and publish it to npm\nCreating your first stencil component is very easy and it is well documented [here](https://stenciljs.com/docs/my-first-component). \n\nThis example will consume two components:\n- [@openchemistry/molecule-vtkjs](https://github.com/OpenChemistry/oc-web-components/tree/master/packages/molecule-vtkjs) : To display molecular structures\n- [split-me](https://github.com/alesgenova/split-me) : To create resizable split layouts\n\n## 1: Add the component(s) to the dependencies\n\nAdd the component to the app dependencies in `package.json`\n\n```json\n// package.json\n\n\"dependencies\": {\n  ...\n  \"@openchemistry/molecule-vtkjs\": \"^0.3.2\",\n  \"split-me\": \"^1.1.4\"\n}\n```\n\n## 2: Import the component(s)\nImport the component in the `main.js` of the app:\n```js\nimport { defineCustomElements as defineMolecule } from '@openchemistry/molecule-vtkjs/dist/loader';\nimport { defineCustomElements as defineSplitMe } from 'split-me/dist/loader';\n\ndefineMolecule(window);\ndefineSplitMe(window);\n```\n\n## 3: Consume the component\nTo prevent Angular from complaining that there is an unrecognized component tag, add `CUSTOM_ELEMENTS_SCHEMA` to the `schemas` array in `app.module.ts`.\n\n```ts\nimport { BrowserModule } from '@angular/platform-browser';\nimport { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent],\n  schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class AppModule { }\n\n```\n\nIt is now possible to use the tag provided by the stencil component in any template of the app.\n\n```html\n\u003csplit-me n=\"2\"\u003e\n  \u003coc-molecule-vtkjs slot=\"0\" [cjson]=\"molecule0\"\u003e\u003c/oc-molecule-vtkjs\u003e\n  \u003coc-molecule-vtkjs slot=\"1\" [cjson]=\"molecule1\"\u003e\u003c/oc-molecule-vtkjs\u003e\n\u003c/split-me\u003e\n```\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falesgenova%2Fstenciljs-in-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falesgenova%2Fstenciljs-in-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falesgenova%2Fstenciljs-in-angular/lists"}