Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remind folks to install deps #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions app/docs/md/conventions/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ customElements.define('my-card', MyCard)

</doc-code>

<doc-callout level="info" mark="ℹ️">

Before you can use the `CustomElement` you will need to add it to your project:

```bash
npm install @enhance/custom-element
```

</doc-callout>

You may be thinking that the `render` function looks familiar and you would be right. These `render` functions are Enhance Elements. This enables us to share rendering logic between the client side and server side so any Enhance Component will be server side renderable.

When an Enhance component is server-side rendered it is "enhanced" with an attribute to indicate that the slotting algorithm and style transform have already been run. The attribute look like this:
Expand Down Expand Up @@ -177,6 +187,16 @@ customElements.define('my-card', MyCard)

</doc-code>

<doc-callout level="info" mark="ℹ️">

Before you can use `MorphdomMixin` you will need to add it to your project:

```bash
npm install @enhance/morphdom-mixin
```

</doc-callout>

Once added the `MorphdomMixin` will handle updating the DOM whenever an `observedAttributes` is modified. The `<attribute name>Changed` methods are no longer necessary. Instead on an attribute change the `render` method will be re-run and the output will be compared against the current DOM. Only the modified DOM nodes will be updated.

<doc-callout level="info" mark="ℹ️">
Expand Down Expand Up @@ -260,3 +280,15 @@ export default MyCard
```

</doc-code>

</doc-code>

<doc-callout level="info" mark="ℹ️">

Before you can use `EnhanceElement` you will need to add it to your project:

```bash
npm install @enhance/element
```

</doc-callout>