@abtasty/progress-bar 1.1.21 → 1.2.0-0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +75 -0
- package/dist/form.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +2 -2
package/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# AB-tasty progress-bar
|
2
|
+
|
3
|
+
The ABTasty Progress Bar Widget will display a progress bar.
|
4
|
+
|
5
|
+
## Code organisation
|
6
|
+
|
7
|
+
![Progress Bar Architecture](./progress_bar_architecture.png)
|
8
|
+
|
9
|
+
### Inserting the widget on the page
|
10
|
+
|
11
|
+
This is completely handled by the Widget-Utils. It takes care of deciding when and how to insert the widget on the page. It also handles recurrence management. Finally, it also handles the widget's form generation by importing the necessary components to be displayed in the editor.
|
12
|
+
|
13
|
+
### Widget internal updates
|
14
|
+
|
15
|
+
The widget has to react to changes coming either form updates to a specified DOM element (`DATA.variableElement`) or from a javascript callback from the client (`DATA.variableType` is `javascript`).
|
16
|
+
|
17
|
+
The widget internally uses an observer pattern, via an Event Hub. The observable events are:
|
18
|
+
|
19
|
+
- `valueElementUpdated`: the source DOM value has changed
|
20
|
+
- `externalUpdate`: the source value was updated from javascript callback (client code)
|
21
|
+
- `sourceElementPresence`: the source DOM element was either removed or added to the DOM
|
22
|
+
- `valueUpdated`: the value to display was updated either from the DOM or a javascript callback.
|
23
|
+
- `refreshContent`: triggered by the widget-utils, when the widget is removed and has to display again
|
24
|
+
|
25
|
+
## Tests
|
26
|
+
|
27
|
+
The test setup and spec files are located in `test` directory. To actually run the tests you need to clone and install the [Widgets Testrunner](https://gitlab.com/abtasty/widget/widgets-testrunner) repo in your Widgets directory. Please check the testrunner documentation for an up to date guide on running the Widget tests.
|
28
|
+
|
29
|
+
This widget was generated using AB Tasty Widget CLI. You can find more infomation and documentation about widgets at https://abtasty.gitbooks.io/widget/.
|
30
|
+
|
31
|
+
## Preview your widget
|
32
|
+
|
33
|
+
Launch your widget in a new window and watch for changes.
|
34
|
+
```bash
|
35
|
+
npm start
|
36
|
+
```
|
37
|
+
|
38
|
+
## Main files
|
39
|
+
|
40
|
+
* `main.js`
|
41
|
+
Main source code of your widget
|
42
|
+
* `form.js`
|
43
|
+
Configuration form for your widget
|
44
|
+
|
45
|
+
You can specify each file location in the `package.json` like this:
|
46
|
+
```json
|
47
|
+
"main": "dist/main.js",
|
48
|
+
"form": "dist/form.js",
|
49
|
+
```
|
50
|
+
|
51
|
+
## Included
|
52
|
+
|
53
|
+
* [Rollup.js](https://rollupjs.org/) module bundler (like Webpack but smaller and faster).
|
54
|
+
* ES6 support using [Babel](https://babeljs.io/).
|
55
|
+
* JavaScript Linting with [ESLint](http://eslint.org/) and [Airbnb style](https://github.com/airbnb/javascript).
|
56
|
+
* JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
|
57
|
+
* [Prettier](https://prettier.io/) to format code.
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
**We heard your widget have an UI, so we allowed ourselves to include some extra:**
|
62
|
+
* [Pug](https://github.com/aMarCruz/rollup-plugin-pug) (aka Jade) to transforms html files into JS template.
|
63
|
+
* [PostCSS](https://github.com/egoist/rollup-plugin-postcss) to automatically append your CSS to head just using `import 'yourstyle.css'` and also use CSS plugins including:
|
64
|
+
* [CSSnext](http://cssnext.io/) to use the latest CSS syntax today.
|
65
|
+
* [cssnano](http://cssnano.co/) to minify CSS.
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
## Add your widget to AB Tasty
|
70
|
+
|
71
|
+
1. First, you'll need to have your widget on NPM:
|
72
|
+
* Create a minified bundle with `npm run build`
|
73
|
+
* Bump the version of your widget ([using semver](http://semver.org/)) with `npm version [patch|minor|major]`
|
74
|
+
* Publish it to NPM: `npm publish`
|
75
|
+
2. Once your widget is on NPM, you can now add it on AB Tasty at https://marketplace.abtasty.com/publish.
|