@@ -8,34 +8,37 @@ Our consumable web components are prefixed with "**rb-**"
8
8
example [ rb-button] ( https://rapid-build-ui.io/components/rb-button ) .
9
9
10
10
11
+
11
12
## Installation
12
13
``` bash
13
- $ npm install @rapid-build-ui/rb-base
14
+ $ yarn add @rapid-build-ui/rb-base
14
15
```
15
16
16
17
18
+
17
19
## What's Included
18
20
* Web component library [ SkateJS] ( http://skatejs.netlify.com/ ) .
19
- * The view rendering engine [ lit-html] ( https://polymer.github.io/ lit-html/ ) .
20
- * Imports :
21
- * guid-service.js
22
- * type-service.js
23
- * view-directives.js
21
+ * The view rendering engine [ lit-html] ( https://lit-html.polymer-project.org / ) .
22
+ * API (creates this.rb object that contains a set of common helper objects) :
23
+ * [this.rb.elms](#thisrbelms)
24
+ * [this.rb.events](#thisrbevents)
25
+ * [this.rb.view](#thisrbevents)
24
26
* Callbacks:
25
- * viewReady()
26
- * Creates this.rb object that contains a set of common helper objects:
27
- * this.rb.elms
28
- * this.rb.events
29
- * this.rb.view
27
+ * [viewReady()](#viewready)
28
+ * Imports:
29
+ * [guid service](#guid-service)
30
+ * [type service](#type-service)
31
+ * [view directives](#view-directives)
32
+
30
33
31
34
32
35
## How To Use
33
36
``` js
34
37
/* Example
35
38
**********/
36
- import { props , html , RbBase } from ' ../../rb-base/scripts/rb-base.js' ;
37
- import view from ' ../../rb-base/scripts/view- directives.js' ;
38
- import template from ' ../views/rb-popover.html' ;
39
+ import { RbBase , props , html } from ' ../../rb-base/scripts/rb-base.js' ;
40
+ import view from ' ../../rb-base/scripts/public/ view/ directives.js' ;
41
+ import template from ' ../views/rb-popover.html' ;
39
42
40
43
export class RbPopover extends RbBase () {
41
44
// Lifecycle
@@ -49,36 +52,71 @@ export class RbPopover extends RbBase() {
49
52
this .showPopover = ! this .showPopover ;
50
53
}
51
54
// Template
52
- render ({ props }) { // :string
55
+ render ({ props, state }) { // :string
53
56
return html template;
54
57
}
55
58
}
56
59
```
57
60
58
61
62
+
63
+ ## API
64
+
65
+ ### this.rb.elms
66
+ * An object/hashmap to store component elements.
67
+ * * See [ how to use...] ( #how-to-use ) *
68
+
69
+
70
+ ### this.rb.events
71
+ * Properties
72
+ * events :object (readonly, hashmap of active events)
73
+ * Methods
74
+ * add(elm(s), 'space separated events', callback[, opts]) :void
75
+ * events are automatically removed in disconnectedCallback()
76
+ * meaning, you don't have to call remove() or removeAll()
77
+ * opts :{}
78
+ * [default options](https://goo.gl/f3kP5A)
79
+ * opts.bind (custom):
80
+ * undefined (binds to component, default)
81
+ * false | null (binds to target elm)
82
+ * elm (binds to supplied elm)
83
+ * emit(elm, 'event' [, { detail: any } ]) :boolean
84
+ * remove(elm(s), 'space separated events', callback) :void
85
+ * removeAll([opts]) :void
86
+ * opts :{}
87
+ * opts.force (internal option) :boolean
88
+ * forces events to be set to empty {}
89
+
90
+
91
+ ### this.rb.view
92
+ * Properties
93
+ * isReady :boolean (readonly, will be true when view is ready)
94
+
95
+
96
+
59
97
## Callbacks (optional)
60
98
61
99
### viewReady()
62
- * See "How To Use" *
100
+ * See [ how to use... ] ( #how-to-use ) *
63
101
Executed once when view is ready and all its rb sub components views are ready.
64
102
Use when you need to make sure elements are accessible in the shadow dom.
65
103
66
104
67
105
68
106
## Imports (optional)
69
107
70
- ### guid- service.js
108
+ ### guid service
71
109
* Methods
72
110
* create(maxLength = 12) :string (sometimes returns maxLength - 1 chars)
73
111
74
112
``` js
75
113
// Example
76
- import Guid from ' ../../rb-base/scripts/guid-service .js' ;
114
+ import Guid from ' ../../rb-base/scripts/public/services/ guid.js' ;
77
115
const guid = Guid .create ();
78
116
```
79
117
80
118
81
- ### type- service.js
119
+ ### type service
82
120
* Methods (** is.methods() : boolean ** )
83
121
* get(val) :string (returns val type)
84
122
* is.array(val)
@@ -95,17 +133,22 @@ const guid = Guid.create();
95
133
96
134
``` js
97
135
// Example
98
- import Type from ' ../../rb-base/scripts/type-service .js' ;
136
+ import Type from ' ../../rb-base/scripts/public/services/ type.js' ;
99
137
const isString = Type .is .string (' rapid' );
100
138
```
101
139
102
140
103
- ### view- directives.js
104
- Returns object of
105
- [ lit-html] ( https://polymer.github.io/ lit-html/guide/writing-templates.html# directives )
106
- [ directives] ( https://github.com/rapid-build-ui/rb-base/blob/master/src/client/scripts/view- directives.js )
141
+ ### view directives
142
+ Returns an object of
143
+ [ lit-html] ( https://lit-html.polymer-project.org /guide/template-reference#built-in- directives )
144
+ [ directives] ( https://github.com/rapid-build-ui/rb-base/blob/master/src/client/scripts/public/ view/ directives.js )
107
145
to be used in view.
108
146
147
+ ``` js
148
+ // Example
149
+ import view from ' ../../rb-base/scripts/public/view/directives.js' ;
150
+ ```
151
+
109
152
``` html
110
153
<!-- Example (import view object in js, see "How To Use"): -->
111
154
<ul >
@@ -114,26 +157,4 @@ to be used in view.
114
157
(hero, i) => html`<li >${i} ${hero}</li >`
115
158
)}
116
159
</ul >
117
- ```
118
-
119
-
120
- ## API
121
-
122
- ### this.rb.elms
123
- * See "How To Use"*
124
- This is object/hashmap to store component elements.
125
-
126
-
127
- ### this.rb.events
128
- * Properties
129
- * events :object (readonly, hashmap of active events)
130
- * Methods
131
- * add(elm, 'space separated events', callback[, opts]) :void
132
- * remove(elm, 'space separated events', callback) :void
133
- * removeAll([opts]) :void
134
- * emit(elm, 'event' [, { detail: any } ]) :boolean
135
-
136
-
137
- ### this.rb.view
138
- * Properties
139
- * isReady :boolean (readonly, will be true when view is ready)
160
+ ```
0 commit comments