Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
smalluban committed Nov 8, 2018
1 parent a10c912 commit 6c29abd
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 253 deletions.
3 changes: 3 additions & 0 deletions .gitbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
structure:
readme: README.md
summary: docs/README.md
43 changes: 22 additions & 21 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Table of contents

- [Basics](#)
- [Component structure](#)
- [Cache mechanism & change detection](#)
- [Factories](#factories)
- [Property](#property)
- [Parent & Children](#parent--children)
- [Render](#render)
- [Templates](#templates)
- [Properties & Attributes](#properties--attributes)
- [Event Listeners](#event-listeners)
- [Values](#values)
- [Conditions](#conditions)
- [Nested Templates](#nested-templates)
- [Arrays](#arrays)
- [Promises](#promises)
- [Resolving Dependencies](#resolving-dependencies)
- [Styling](#)
- [Limitations](#limitations)
- [API Reference](#)
# Table of Contents

- [Overview](../README.md)
- [Core Concepts](core-concepts/README.md)
- [Property Descriptors](core-concepts/property-decriptors.md)
- [Factories](core-concepts/factories.md)
- [Property Translation](core-concepts/property-translation.md)
- [Cache Mechanism & Change Detection](core-concepts/cache-mechanism-change-detection.md)
- [Component Definition](component-definition.md)
- [Property Factory](property-factory.md)
- [Parent & Children Factories](parent-children-factory.md)
- [Render Factory](render-factory.md)
- [Templates](templates.md)
- [Properties & Attributes](templates.md#properties--attributes)
- [Event Listeners](templates.md#event-listeners)
- [Values](templates.md#values)
- [Conditions](templates.md#conditions)
- [Nested Templates](templates.md#nested-templates)
- [Arrays](templates.md#arrays)
- [Promises](templates.md#promises)
- [Resolving Dependencies](templates.md#resolving-dependencies)
- [Limitations](templates.md#limitations)
- [API Reference](api-reference.md)
230 changes: 0 additions & 230 deletions docs/built-in-factories.md

This file was deleted.

10 changes: 8 additions & 2 deletions docs/component-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The library provides a function for defining custom elements. It works in two mo

To simplify using external custom elements with those created by the library, you can pass `constructor` instead of a plain object with property descriptors. Then `define` works exactly the same as the `customElements.define()` method.

### Single Mode
### Single element

```javascript
import { define } from 'hybrids';
Expand Down Expand Up @@ -57,7 +57,9 @@ const MyElement = {

One of the `get` or `set` method has to be defined, `connect` method can be omitted. If only `set` method is defined, for `get` method a default getter is used, which returns last cached value.

#### `get: (host: Element, lastValue: any) => { ... }` <!-- omit in toc -->
### get

**`get: (host: Element, lastValue: any) => { ... }`**

* **arguments**:
* `host` - an element instance
Expand All @@ -77,6 +79,8 @@ const MyElement = {
};
```

### set

**`set: (host: Element, value: any, lastValue: any) => {...}`**

* **arguments**:
Expand All @@ -88,6 +92,8 @@ const MyElement = {

`set` method is called within every assertion of the property. The cached value is invalidated if returned `nextValue` is not equal to `lastValue` (`nextValue !== lastValue`). However, `get` method is called in the next get call of the property (it is not recalculated after invalidation). Nonprimitive values should be treated as immutable - property is invalidated only if value reference has changed.

### connect

**`connect: (host: Element, key: string, invalidate: Function) => { ... }`**

* **arguments**:
Expand Down
1 change: 1 addition & 0 deletions docs/core-concepts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Core Concepts
1 change: 1 addition & 0 deletions docs/core-concepts/cache-mechanism-change-detection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Cache Mechanism & Change Detection
3 changes: 3 additions & 0 deletions docs/core-concepts/factories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Factories

The factory is a function, which produces property descriptor. Rather than explicitly describe a property, factories hide implementation details and minimize redundant code. `hybrids` includes four factories, which cover the most important features for creating custom elements.
1 change: 1 addition & 0 deletions docs/core-concepts/property-descriptors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Property Descriptors
1 change: 1 addition & 0 deletions docs/core-concepts/property-translation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Property Translation

0 comments on commit 6c29abd

Please sign in to comment.