hermes-io 2.2.5 → 2.2.6
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 +7 -5
- package/package.json +1 -1
- package/examples/sneaker-store/. quokka +0 -25
- package/examples/sneaker-store/.editorconfig +0 -32
- package/examples/sneaker-store/.eslintrc.js +0 -24
- package/examples/sneaker-store/LICENSE +0 -21
- package/examples/sneaker-store/README.md +0 -1
- package/examples/sneaker-store/config-overrides.js +0 -35
- package/examples/sneaker-store/jsconfig.json +0 -20
- package/examples/sneaker-store/package-lock.json +0 -39849
- package/examples/sneaker-store/package.json +0 -48
- package/examples/sneaker-store/public/assets/images/addidas.webp +0 -0
- package/examples/sneaker-store/public/assets/images/jordan_3.webp +0 -0
- package/examples/sneaker-store/public/favicon.ico +0 -0
- package/examples/sneaker-store/public/index.html +0 -46
- package/examples/sneaker-store/public/logo192.png +0 -0
- package/examples/sneaker-store/public/logo512.png +0 -0
- package/examples/sneaker-store/public/manifest.json +0 -25
- package/examples/sneaker-store/public/reset.css +0 -48
- package/examples/sneaker-store/public/robots.txt +0 -3
- package/examples/sneaker-store/src/core/App.js +0 -72
- package/examples/sneaker-store/src/core/actions/Theme.js +0 -5
- package/examples/sneaker-store/src/core/actions/index.js +0 -3
- package/examples/sneaker-store/src/core/constants.js +0 -4
- package/examples/sneaker-store/src/core/contexts.js +0 -4
- package/examples/sneaker-store/src/core/factory/Actions.js +0 -8
- package/examples/sneaker-store/src/core/factory/Observer.js +0 -3
- package/examples/sneaker-store/src/core/observers/products.js +0 -6
- package/examples/sneaker-store/src/core/theme.js +0 -26
- package/examples/sneaker-store/src/core/views/components/Products/Products.js +0 -55
- package/examples/sneaker-store/src/core/views/components/Products/Styles.js +0 -112
- package/examples/sneaker-store/src/core/views/components/ShoppingCar/ShoppingCar.js +0 -56
- package/examples/sneaker-store/src/core/views/components/ShoppingCar/Styles.js +0 -59
- package/examples/sneaker-store/src/core/views/hooks/index.js +0 -0
- package/examples/sneaker-store/src/index.js +0 -10
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ A lightweight javascript library that allows communication between components by
|
|
|
4
4
|
# Summary
|
|
5
5
|
- [Installation](#installation)
|
|
6
6
|
- [Get started](#get-started)
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
7
|
+
- [Observer](#observer)
|
|
8
|
+
- [Context](#context)
|
|
9
9
|
- [useObserver](#useobserver-hook)
|
|
10
10
|
- [notify](#notify)
|
|
11
11
|
- Devtools (TODO)
|
|
@@ -19,7 +19,7 @@ npm i hermes-io --save
|
|
|
19
19
|
# Get started
|
|
20
20
|
`hermes-io` is a set of toolkits that combined allows communication between components let's explore every tool by following the `sneaker store example`:
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# Observer
|
|
23
23
|
`hermes-io` provide an `Observer` class to create instances that can be `subscribable` that means many subscribers can listen for notifications on the instance by using the method `subscribe`, check the following example:
|
|
24
24
|
|
|
25
25
|
We are exporting an `object` with two instances of the class `Observer` each key of the object has invidual propuses one for handle notifications about `add` a product and the other for `remove` a product.
|
|
@@ -34,7 +34,7 @@ export default {
|
|
|
34
34
|
};
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# Context
|
|
38
38
|
`NOTICE` this concept has nothing to do with the `react context api`.
|
|
39
39
|
|
|
40
40
|
`hermes-io` provide a `Context` class to create instances that can be used to create `notification context` that means that only notification
|
|
@@ -89,7 +89,8 @@ productsStore.set('collection', sneakerList);
|
|
|
89
89
|
|----------|-------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
90
90
|
| observer | Observer instance | true | An instance of the class Observer |
|
|
91
91
|
| listener | Function | true | A standar javascript function |
|
|
92
|
-
| contexts |
|
|
92
|
+
| contexts | Context[] | true | An array of instances of the class Context, when a notification comes and is not signed with any of the contexts in the array the listener never will be called |
|
|
93
|
+
|
|
93
94
|
|
|
94
95
|
```javascript
|
|
95
96
|
import { useObserver } from "hermes-io";
|
|
@@ -156,6 +157,7 @@ Is a method that allows sending notifications to the `subscribers` of a specific
|
|
|
156
157
|
| value | any | true | Payload with business information |
|
|
157
158
|
| context | context | true | A context instance |
|
|
158
159
|
|
|
160
|
+
|
|
159
161
|
```javascript
|
|
160
162
|
// ShoppingCar.js
|
|
161
163
|
import ProductsObservers from './observers/products';
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"babel": {
|
|
3
|
-
"presets": [
|
|
4
|
-
"react-app"
|
|
5
|
-
]
|
|
6
|
-
},
|
|
7
|
-
"plugins": [
|
|
8
|
-
"alias-quokka-plugin",
|
|
9
|
-
"jsdom-quokka-plugin"
|
|
10
|
-
],
|
|
11
|
-
"alias": {
|
|
12
|
-
"@core": "./src/core",
|
|
13
|
-
"@components": "./src/core/components",
|
|
14
|
-
"@contexts": "./src/core/contexts",
|
|
15
|
-
"@factory": "./src/core/factory",
|
|
16
|
-
"@hooks": "./src/core/hooks",
|
|
17
|
-
"@utils": "./src/core/utils",
|
|
18
|
-
"@libs": "./src/libs",
|
|
19
|
-
"@constants": "./src/core/constants",
|
|
20
|
-
"@translations": "./src/core/translations",
|
|
21
|
-
"@theme": "./src/core/theme",
|
|
22
|
-
"@routes": "./src/core/routes"
|
|
23
|
-
},
|
|
24
|
-
"node": "~/.nvm/versions/node/v16.18.1/bin/node"
|
|
25
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# EditorConfig is awesome: https://EditorConfig.org
|
|
2
|
-
|
|
3
|
-
# top-most EditorConfig file
|
|
4
|
-
root = true
|
|
5
|
-
|
|
6
|
-
# Unix-style newlines with a newline ending every file
|
|
7
|
-
[*]
|
|
8
|
-
end_of_line = lf
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
|
|
11
|
-
# Matches multiple files with brace expansion notation
|
|
12
|
-
# Set default charset
|
|
13
|
-
[*.{js,py}]
|
|
14
|
-
charset = utf-8
|
|
15
|
-
|
|
16
|
-
# 4 space indentation
|
|
17
|
-
[*.py]
|
|
18
|
-
indent_style = space
|
|
19
|
-
indent_size = 4
|
|
20
|
-
|
|
21
|
-
# Tab indentation (no size specified)
|
|
22
|
-
[Makefile]
|
|
23
|
-
indent_style = tab
|
|
24
|
-
|
|
25
|
-
# Indentation override for all JS under lib directory
|
|
26
|
-
[*.js]
|
|
27
|
-
indent_style = space
|
|
28
|
-
indent_size = 2
|
|
29
|
-
|
|
30
|
-
[{package.json,.travis.yml}]
|
|
31
|
-
indent_style = space
|
|
32
|
-
indent_size = 2
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:react/recommended"
|
|
9
|
-
],
|
|
10
|
-
"overrides": [
|
|
11
|
-
],
|
|
12
|
-
"parserOptions": {
|
|
13
|
-
"ecmaVersion": "latest",
|
|
14
|
-
"sourceType": "module"
|
|
15
|
-
},
|
|
16
|
-
"plugins": [
|
|
17
|
-
"react"
|
|
18
|
-
],
|
|
19
|
-
"rules": {
|
|
20
|
-
"react/prop-types": "off",
|
|
21
|
-
"no-unused-vars": 0,
|
|
22
|
-
"react/display-name": 0
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Esneyder Amin
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# atomic-client
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
webpack: function (config) {
|
|
5
|
-
config.devtool = "source-map";
|
|
6
|
-
config.resolve = {
|
|
7
|
-
extensions: [".js", ".html"],
|
|
8
|
-
alias: {
|
|
9
|
-
"@actions": path.resolve(__dirname, "src/core/actions"),
|
|
10
|
-
"@core": path.resolve(__dirname, "src/core"),
|
|
11
|
-
"@views": path.resolve(__dirname, "src/core/views"),
|
|
12
|
-
"@components": path.resolve(__dirname, "src/core/views/components"),
|
|
13
|
-
"@factory": path.resolve(__dirname, "src/core/factory"),
|
|
14
|
-
"@hooks": path.resolve(__dirname, "src/core/views/hooks"),
|
|
15
|
-
"@constants": path.resolve(__dirname, "src/core/constants"),
|
|
16
|
-
"@contexts": path.resolve(__dirname, "src/core/contexts"),
|
|
17
|
-
"@observers": path.resolve(__dirname, "src/core/observers"),
|
|
18
|
-
"@theme": path.resolve(__dirname, "src/core/theme"),
|
|
19
|
-
"@src": path.resolve(__dirname, "src"),
|
|
20
|
-
"hermes-io": path.resolve(__dirname, "../../"),
|
|
21
|
-
"react": path.resolve(__dirname, "../../node_modules/react"),
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
config.module.rules.push({
|
|
25
|
-
test: /\.js$/,
|
|
26
|
-
loader: "esbuild-loader",
|
|
27
|
-
options: {
|
|
28
|
-
loader: "jsx",
|
|
29
|
-
target: "es2020",
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
console.log(JSON.stringify(config));
|
|
33
|
-
return config;
|
|
34
|
-
},
|
|
35
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"paths": {
|
|
5
|
-
"actions/*": ["src/core/actions/*"],
|
|
6
|
-
"@core/*": ["src/core/*"],
|
|
7
|
-
"@views/*": ["src/core/views/*"],
|
|
8
|
-
"@components/*": ["src/core/views/components/*"],
|
|
9
|
-
"@factory/*": ["src/core/factory/*"],
|
|
10
|
-
"@hooks/*": ["src/core/views/hooks/*"],
|
|
11
|
-
"@constants": ["src/core/constants"],
|
|
12
|
-
"@observers/*": ["src/core/observers/*"],
|
|
13
|
-
"@contexts/*": ["src/core/contexts"],
|
|
14
|
-
"@src/*": ["src/*"],
|
|
15
|
-
"@hermes-io/*": ["../../*"],
|
|
16
|
-
"react": ["../../node_modules/react"]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"exclude": ["node_modules"]
|
|
20
|
-
}
|