diff --git a/README.md b/README.md index 234faa4..0019386 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,30 @@ When you extend the `WebComponent` class for your component, you only have to de The result is a reactive UI on property changes. -## Table of Contents -1. [Import via unpkg](#import-via-unpkg) -1. [Installation via npm](#installation-via-npm) -1. [Usage](#usage) -1. [`template` vs `render()`](#template-vs-render) -1. [Prop access](#prop-access) - 1. [Alternatives](#alternatives) -1. [Quick Start Example](#quick-start-example) -1. [Life-Cycle Hooks](#life-cycle-hooks) - 1. [`onInit`](#oninit) - the component is connected to the DOM, before view is initialized - 1. [`afterViewInit`](#afterviewinit) - after the view is first initialized - 1. [`onDestroy`](#ondestroy) - the component is disconnected from the DOM - 1. [`oChanges`](#onchanges) - every time an attribute value changes -1. [Library Size](#library-size) - +
+Table of Contents +
    +
  1. Import via unpkg
  2. +
  3. Installation via npm
  4. +
  5. Usage
  6. +
  7. `template` vs `render()`
  8. +
  9. Prop access +
      +
    1. Alternatives
    2. +
    +
  10. +
  11. Quick Start Example
  12. +
  13. Life-Cycle Hooks +
      +
    1. `onInit` - the component is connected to the DOM, before view is initialized
    2. +
    3. `afterViewInit` - after the view is first initialized
    4. +
    5. `onDestroy` - the component is disconnected from the DOM
    6. +
    7. `onChanges` - every time an attribute value changes
    8. +
    +
  14. +
  15. Library Size
  16. +
+
## Import via unpkg Import using [unpkg](https://unpkg.com/web-component-base) in your vanilla JS component. We will use this in the rest of our [usage examples](#usage). @@ -51,7 +60,6 @@ import WebComponent from "https://unpkg.com/web-component-base@latest/WebCompone class HelloWorld extends WebComponent { static properties = ["my-name", "emotion"]; - get template() { return `

Hello ${this.props.myName}${this.props.emotion === "sad" ? ". 😭" : "! 🙌"}

`; @@ -75,8 +83,6 @@ In your HTML page: setTimeout(() => { helloWorld.setAttribute('emotion', 'excited'); - // or: - helloWorld.props.emotion = 'excited'; }, 2500) @@ -244,10 +250,6 @@ class ClickableText extends WebComponent { } ``` - - - - ### onChanges() - Triggered when an attribute value changed @@ -269,4 +271,4 @@ class ClickableText extends WebComponent { ## Library Size -Running [size-limit](https://npmjs.com/package/@size-limit/preset-small-lib) reports the library size as around 760 Bytes, minified and brotlied. Read more about how to [minify and compress payload with brotli](https://web.dev/articles/codelab-text-compression-brotli) for your app. \ No newline at end of file +Running [size-limit](https://npmjs.com/package/@size-limit/preset-small-lib) reports the base class size as around 760 Bytes (minified & brotlied). Using the `WebComponent.min.js` version gets it down to 400 Bytes. Read more about how to [minify and compress payload with brotli](https://web.dev/articles/codelab-text-compression-brotli) for your app. \ No newline at end of file