domain-gfx 0.1.4 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- Domain graphics library
2
- =======================
1
+ [![Test and Publish](https://github.com/EBI-Metagenomics/domain-gfx/workflows/Test%20and%20Publish/badge.svg)](https://github.com/EBI-Metagenomics/domain-gfx/actions?query=workflow%3A%22Test+and+Publish%22)
2
+
3
+ # Domain graphics library
3
4
 
4
5
  _in development_
5
6
 
6
7
  A live example is available to play with at
7
- [https://proteinswebteam.github.io/domain_gfx/](https://proteinswebteam.github.io/domain_gfx/)
8
+ [https://ebi-metagenomics.github.io/domain-gfx/](https://ebi-metagenomics.github.io/domain-gfx/)
8
9
 
9
- Installation:
10
- -------------
10
+ ## Installation:
11
11
 
12
12
  This library is available on npm, to install it run:
13
13
 
@@ -16,28 +16,32 @@ This library is available on npm, to install it run:
16
16
  Otherwise, you can use it directly from the unpkg CDN at
17
17
  [https://unpkg.com/domain-gfx](https://unpkg.com/domain-gfx)
18
18
 
19
- Usage:
20
- ------
19
+ ## Usage:
21
20
 
22
21
  ### Using ES modules, or a module bundler
23
22
 
24
23
  **recommended way**
25
24
 
26
- This library is available as a plain ES module, you can use it directly
27
- by importing it into your code like this:
25
+ This library is available as a plain ES module, you can use it directly by
26
+ importing it into your code like this:
28
27
 
29
28
  ```js
30
29
  import DomainGfx from 'domain-gfx';
31
30
  ```
32
31
 
32
+ **legacy browsers support (including Internet Explorer)**
33
+
34
+ To support IE, or other legacy browsers, you can use the `legacy` bundle which
35
+ includes a set of needed polyfills. It has only been tested back to IE10, and it
36
+ will probably break on previous versions of IE.
37
+
33
38
  ### Using a global
34
39
 
35
- you can insert the script in your page, synchronously or not. It will
36
- add the global `DomainGfx`.
40
+ you can insert the script in your page, synchronously or not. It will add the
41
+ global `DomainGfx`.
37
42
 
38
- If you are loading it asynchronously, you can listen for the
39
- `'domainGfxReady'` event on the `document`, containing the DomainGfx
40
- class. e.g.:
43
+ If you are loading it asynchronously, you can listen for the `'domainGfxReady'`
44
+ event on the `document`, containing the DomainGfx class. e.g.:
41
45
 
42
46
  ```js
43
47
  document.addEventListener('domainGfxReady', event => {
@@ -45,14 +49,12 @@ document.addEventListener('domainGfxReady', event => {
45
49
  // Use the DomainGfx class...
46
50
  // ...
47
51
  });
48
-
49
52
  ```
50
53
 
51
- From the `dist` folder, use the `domain_gfx.es5.js` file, for ES5
52
- support, or `domain_gfx.es2015.js`, for ES2015 support.
54
+ From the `dist` folder, use the `domain_gfx.es5.js` file, for ES5 support, or
55
+ `domain_gfx.es2015.js`, for ES2015 support.
53
56
 
54
- API:
55
- ----
57
+ ## API:
56
58
 
57
59
  ### Syntax
58
60
 
@@ -62,16 +64,14 @@ new DomainGfx(userParameters);
62
64
 
63
65
  #### Parameters
64
66
 
65
- - **userParameters**, `object`: contains information to render the graphic
67
+ * **userParameters**, `object`: contains information to render the graphic
66
68
 
67
- - **parent**, `Element`: container element for the graphic
69
+ * **parent**, `Element`: container element for the graphic
68
70
 
69
- - **data**, optional `object`: data describing the content of the
70
- graphic
71
+ * **data**, optional `object`: data describing the content of the graphic
71
72
 
72
- - **params**, optional `object`: extra parameters, modifying the
73
- rendering (not used at the moment) like the scale of the image, or
74
- default sizes
73
+ * **params**, optional `object`: extra parameters, modifying the rendering
74
+ (not used at the moment) like the scale of the image, or default sizes
75
75
 
76
76
  #### Return value
77
77
 
@@ -79,19 +79,18 @@ A new instance of DomainGfx
79
79
 
80
80
  #### Properties
81
81
 
82
- - **DomainGfx.prototype.data** *getter data()*: returns the internal
83
- data stored in the instance
82
+ * **DomainGfx.prototype.data** _getter data()_: returns the internal data stored
83
+ in the instance
84
84
 
85
- - **DomainGfx.prototype.data** *setter data(value)*: sanitize value,
86
- and sets the result as internal data and returns it
85
+ * **DomainGfx.prototype.data** _setter data(value)_: sanitize value, and sets
86
+ the result as internal data and returns it
87
87
 
88
88
  #### Methods
89
89
 
90
- - **DomainGfx.prototype.delete()**: clean-up logic, removes event
91
- listeners and gets rid of pointers to DOM nodes to be able to GC them
90
+ * **DomainGfx.prototype.delete()**: clean-up logic, removes event listeners and
91
+ gets rid of pointers to DOM nodes to be able to GC them
92
92
 
93
- Examples:
94
- ---------
93
+ ## Examples:
95
94
 
96
95
  ```js
97
96
  // DOM container
@@ -147,42 +146,38 @@ const data = {
147
146
  };
148
147
 
149
148
  const dg = new DomainGfx({data, parent});
150
-
151
149
  ```
152
150
 
153
- Gotchas and changes from earlier versions:
154
- ------------------------------------------
151
+ ## Gotchas and changes from earlier versions:
155
152
 
156
153
  As compared to pre-existing older libraries such as PfamGraphics
157
154
 
158
155
  ### new way to create a graphic
159
156
 
160
- - instead of passing as different parameters, first a node or a string
161
- to select a node, then an object with all the data, this now expects
162
- an object with a `parent`, and optional `data` and `params` keys.
157
+ * instead of passing as different parameters, first a node or a string to select
158
+ a node, then an object with all the data, this now expects an object with a
159
+ `parent`, and optional `data` and `params` keys.
163
160
 
164
- - instead of calling the render method afterwards on the DomainGfx
165
- object, the render is done automatically when instantiating the object,
166
- and also everytime different data is assigned to the object.
161
+ * instead of calling the render method afterwards on the DomainGfx object, the
162
+ render is done automatically when instantiating the object, and also everytime
163
+ different data is assigned to the object.
167
164
 
168
165
  ### differences in the data object
169
166
 
170
- Old data objects **should still be able to be used**, as this library
171
- still accounts for the old formats. If it is not able to use the data
172
- please upgrade the data object to a newer version.
167
+ Old data objects **should still be able to be used**, as this library still
168
+ accounts for the old formats. If it is not able to use the data please upgrade
169
+ the data object to a newer version.
173
170
 
174
171
  Should be used:
175
- - American spelling. e.g. `colour` -> `color`
176
- - Keys in camelCase. e.g. `v_align` -> `vAlign`
177
- - Correct type where need be. e.g. `start`: integer, `display`: boolean
178
172
 
173
+ * American spelling. e.g. `colour` -> `color`
174
+ * Keys in camelCase. e.g. `v_align` -> `vAlign`
175
+ * Correct type where need be. e.g. `start`: integer, `display`: boolean
179
176
 
180
- Todo:
181
- -----
177
+ ## Todo:
182
178
 
183
- - [ ] Add more documentation
184
- - [ ] shape of `data`
185
- - [ ] details for developers
186
- - [ ] Add more unit tests
187
- - [ ] Add TravisCI integration
188
- - [ ] Handle parameters (entity/text sizes, x/y scale, etc)
179
+ * [ ] Add more documentation
180
+ * [ ] shape of `data`
181
+ * [ ] details for developers
182
+ * [ ] Add more unit tests
183
+ * [ ] Handle parameters (entity/text sizes, x/y scale, etc)