-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use union string instead of enum for easier consumption * Update docs with TypeScript note * Improve readme * Add very important missing semicolon * Make docs site more like GitHub readme
- Loading branch information
Showing
22 changed files
with
187 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,95 @@ | ||
[![version (scoped)](https://img.shields.io/npm/v/@manifoldco/ui.svg)](https://www.npmjs.com/package/@manifoldco/ui) | ||
[![Stencil version](https://img.shields.io/badge/Stencil-v0.18.0-blueviolet.svg)](https://stenciljs.com) | ||
[![codecov](https://codecov.io/gh/manifoldco/ui/branch/master/graph/badge.svg?token=wDhQnzqKXR)](https://codecov.io/gh/manifoldco/ui) | ||
|
||
# @manifoldco/ui | ||
# 🍱 Manifold UI | ||
|
||
Manifold’s reusable web components, built with [Stencil][stencil] | ||
Manifold’s reusable web components, built with [Stencil][stencil]. | ||
|
||
## Installation | ||
|
||
Distribution is via npm. To use, run the following in any terminal: | ||
|
||
```bash | ||
npm install @manifoldco/ui --save | ||
npm i @manifoldco/ui | ||
``` | ||
|
||
### Usage in Frameworks | ||
### Usage | ||
|
||
| Framework | Supported? | | ||
| :------------------------ | :--------: | | ||
| Vanilla JS (no framework) | ✅ | | ||
| Angular | ✅ | | ||
| React | ✅ | | ||
| Vue | ✅ | | ||
| Ember | ✅ | | ||
|
||
#### HTML (ES Modules) | ||
|
||
Currently, Manifold UI supports the following frameworks: | ||
```html | ||
<manifold-marketplace /> | ||
|
||
| Name | Supported? | | ||
| :------------------------ | :--------- | | ||
| Angular | ✅ | | ||
| React | ✅ | | ||
| Vue | ✅ | | ||
| Ember | ✅ | | ||
| Vanilla JS (no framework) | ✅ | | ||
<script type="module"> | ||
import { defineCustomElements } from 'https://unpkg.com/@manifoldco/ui/dist/esm/es2017/manifold.define.js'; | ||
defineCustomElements(window); | ||
</script> | ||
``` | ||
|
||
#### HTML (No ESM Support) | ||
|
||
To integrate into your app, please refer to [Stencil’s documentation][stencil-framework]. | ||
```html | ||
<manifold-marketplace /> | ||
<script src="https://unpkg.com/@manifoldco/ui/dist/manifold.js"></script> | ||
``` | ||
|
||
The only change needed from their docs is replace `test-components` with | ||
`@manifoldco/ui`, like so: | ||
#### React | ||
|
||
```js | ||
// Replace this… 🚫 | ||
import { defineCustomElements } from 'test-components/dist/loader'; | ||
```ts | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
// …with this ✅ | ||
import { defineCustomElements } from '@manifoldco/ui/dist/loader'; | ||
|
||
const App = () => <manifold-marketplace />; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
defineCustomElements(window); | ||
``` | ||
|
||
#### Ember, Angular, Vue, and others | ||
|
||
Initializing Manifold UI works the exact same as any other Stencil project. For more | ||
advanced instructions on integrating with your specific stack, please refer | ||
to Stencil’s [docs on integration][stencil-framework]. | ||
|
||
### TypeScript + JSX setup | ||
|
||
When using inside TypeScript, you’ll likely see this error ( | ||
`manifold-connection` could be any custom element): | ||
|
||
``` | ||
Property 'manifold-connection' does not exist on type 'JSX.IntrinsicElements' | ||
``` | ||
|
||
To solve that, add the following to `tsconfig.json`: | ||
|
||
```json | ||
"compilerOptions": { | ||
"typeRoots": ["./node_modules/@types", "./node_modules/@manifoldco"], | ||
"types": ["ui"] | ||
} | ||
``` | ||
|
||
Next, create a `custom-elements.d.ts` file somewhere inside your project | ||
(must be inside the [include][ts-include] option in `tsconfig.json`): | ||
|
||
```ts | ||
declare module JSX { | ||
interface IntrinsicElements extends StencilIntrinsicElements {} | ||
} | ||
``` | ||
|
||
This will do more than fix the error—now you’ll be able to typecheck the web | ||
components as you write! 🎉 | ||
|
||
[stencil]: https://stenciljs.com/ | ||
[stencil-framework]: https://stenciljs.com/docs/overview | ||
[ts-include]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.