vaderjs 1.0.2 → 1.0.3
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/package.json +1 -1
- package/vader.js +34 -7
package/package.json
CHANGED
package/vader.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Object window
|
|
3
|
+
* @property {Object} props
|
|
4
|
+
* @description Allows you to store props for component
|
|
5
|
+
*/
|
|
6
|
+
window.props = {}
|
|
1
7
|
/**
|
|
2
8
|
* @function vhtml
|
|
3
|
-
* @param {
|
|
9
|
+
* @param {String} strings
|
|
4
10
|
* @param {...any} args
|
|
5
11
|
* @returns modified string
|
|
6
12
|
*
|
|
7
13
|
*/
|
|
8
|
-
window.props = {}
|
|
9
14
|
export function vhtml(strings, ...args) {
|
|
10
15
|
let result = "";
|
|
11
16
|
|
|
@@ -97,6 +102,12 @@ export function component(name, options) {
|
|
|
97
102
|
window.props[key] = initialValue;
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
/**
|
|
106
|
+
* @Array state
|
|
107
|
+
* @param {*} states
|
|
108
|
+
* @description Allows you to get state of component
|
|
109
|
+
*/
|
|
110
|
+
|
|
100
111
|
return [states[key], (newValue) => setState(key, newValue)];
|
|
101
112
|
};
|
|
102
113
|
/**
|
|
@@ -118,11 +129,11 @@ export function component(name, options) {
|
|
|
118
129
|
};
|
|
119
130
|
|
|
120
131
|
/**
|
|
121
|
-
* @function
|
|
122
|
-
* @param {*}
|
|
123
|
-
* @param {*}
|
|
124
|
-
* @returns {Object} {
|
|
125
|
-
* @description Allows you to manage
|
|
132
|
+
* @function useSyncStore
|
|
133
|
+
* @param {*} storeName
|
|
134
|
+
* @param {*} initialState
|
|
135
|
+
* @returns {Object} {getField, setField, subscribe, clear}
|
|
136
|
+
* @description Allows you to manage state in local storage
|
|
126
137
|
*/
|
|
127
138
|
const useSyncStore = (storeName, initialState) => {
|
|
128
139
|
const storedState =
|
|
@@ -174,6 +185,14 @@ export function component(name, options) {
|
|
|
174
185
|
clear,
|
|
175
186
|
};
|
|
176
187
|
};
|
|
188
|
+
/**
|
|
189
|
+
* @function useAuth
|
|
190
|
+
* @param {*} rulesets
|
|
191
|
+
* @param {*} options
|
|
192
|
+
* @returns {Object} {canAccess, grantAccess, revokeAccess}
|
|
193
|
+
* @description Allows you to manage access to resources through rulesets
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
177
196
|
|
|
178
197
|
function useAuth(options) {
|
|
179
198
|
if (!options.rulesets) {
|
|
@@ -304,6 +323,14 @@ export function component(name, options) {
|
|
|
304
323
|
);
|
|
305
324
|
}
|
|
306
325
|
};
|
|
326
|
+
/**
|
|
327
|
+
* @function render
|
|
328
|
+
* @param {*} states
|
|
329
|
+
* @param {*} props
|
|
330
|
+
* @description Allows you to render component to DOM
|
|
331
|
+
* @returns {HTMLcContent}
|
|
332
|
+
* @returns
|
|
333
|
+
*/
|
|
307
334
|
|
|
308
335
|
const render = (props) => {
|
|
309
336
|
storedProps = props;
|