vast 1.0.15-dev-d315d9 → 1.0.15

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.
@@ -6,13 +6,13 @@ var vestUtils = require('vest-utils');
6
6
 
7
7
  // eslint-disable-next-line max-lines-per-function
8
8
  function createState(onStateChange) {
9
- const state = {
10
- references: [],
9
+ var state = {
10
+ references: []
11
11
  };
12
- const registrations = [];
12
+ var registrations = [];
13
13
  return {
14
- registerStateKey,
15
- reset,
14
+ registerStateKey: registerStateKey,
15
+ reset: reset
16
16
  };
17
17
  /**
18
18
  * Registers a new key in the state, takes the initial value (may be a function that returns the initial value), returns a function.
@@ -28,14 +28,17 @@ function createState(onStateChange) {
28
28
  * useColor()[0]; -> "green"
29
29
  */
30
30
  function registerStateKey(initialState, onUpdate) {
31
- const key = registrations.length;
31
+ var key = registrations.length;
32
32
  registrations.push([initialState, onUpdate]);
33
33
  return initKey(key, initialState);
34
34
  }
35
35
  function reset() {
36
- const prev = current();
36
+ var prev = current();
37
37
  state.references = [];
38
- registrations.forEach(([initialValue], index) => initKey(index, initialValue, prev[index]));
38
+ registrations.forEach(function (_a, index) {
39
+ var initialValue = _a[0];
40
+ return initKey(index, initialValue, prev[index]);
41
+ });
39
42
  }
40
43
  function initKey(key, initialState, prevState) {
41
44
  current().push();
@@ -43,7 +46,9 @@ function createState(onStateChange) {
43
46
  return function useStateKey() {
44
47
  return [
45
48
  current()[key],
46
- (nextState) => set(key, vestUtils.optionalFunctionValue(nextState, current()[key])),
49
+ function (nextState) {
50
+ return set(key, vestUtils.optionalFunctionValue(nextState, current()[key]));
51
+ },
47
52
  ];
48
53
  };
49
54
  }
@@ -51,9 +56,9 @@ function createState(onStateChange) {
51
56
  return state.references;
52
57
  }
53
58
  function set(index, value) {
54
- const prevValue = state.references[index];
59
+ var prevValue = state.references[index];
55
60
  state.references[index] = value;
56
- const [, onUpdate] = registrations[index];
61
+ var _a = registrations[index], onUpdate = _a[1];
57
62
  if (vestUtils.isFunction(onUpdate)) {
58
63
  onUpdate(value, prevValue);
59
64
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vest-utils");exports.createState=function(n){const t={references:[]},r=[];return{registerStateKey:function(e,n){const t=r.length;return r.push([e,n]),c(t,e)},reset:function(){const e=o();t.references=[],r.forEach((([n],t)=>c(t,n,e[t])))}};function c(n,t,r){return o().push(),u(n,e.optionalFunctionValue(t,r)),function(){return[o()[n],t=>u(n,e.optionalFunctionValue(t,o()[n]))]}}function o(){return t.references}function u(c,o){const u=t.references[c];t.references[c]=o;const[,s]=r[c];e.isFunction(s)&&s(o,u),e.isFunction(n)&&n()}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vest-utils");exports.createState=function(n){var r={references:[]},t=[];return{registerStateKey:function(e,n){var r=t.length;return t.push([e,n]),u(r,e)},reset:function(){var e=c();r.references=[],t.forEach((function(n,r){return u(r,n[0],e[r])}))}};function u(n,r,t){return c().push(),i(n,e.optionalFunctionValue(r,t)),function(){return[c()[n],function(r){return i(n,e.optionalFunctionValue(r,c()[n]))}]}}function c(){return r.references}function i(u,c){var i=r.references[u];r.references[u]=c;var o=t[u][1];e.isFunction(o)&&o(c,i),e.isFunction(n)&&n()}};
@@ -2,13 +2,13 @@ import { optionalFunctionValue, isFunction } from 'vest-utils';
2
2
 
3
3
  // eslint-disable-next-line max-lines-per-function
4
4
  function createState(onStateChange) {
5
- const state = {
6
- references: [],
5
+ var state = {
6
+ references: []
7
7
  };
8
- const registrations = [];
8
+ var registrations = [];
9
9
  return {
10
- registerStateKey,
11
- reset,
10
+ registerStateKey: registerStateKey,
11
+ reset: reset
12
12
  };
13
13
  /**
14
14
  * Registers a new key in the state, takes the initial value (may be a function that returns the initial value), returns a function.
@@ -24,14 +24,17 @@ function createState(onStateChange) {
24
24
  * useColor()[0]; -> "green"
25
25
  */
26
26
  function registerStateKey(initialState, onUpdate) {
27
- const key = registrations.length;
27
+ var key = registrations.length;
28
28
  registrations.push([initialState, onUpdate]);
29
29
  return initKey(key, initialState);
30
30
  }
31
31
  function reset() {
32
- const prev = current();
32
+ var prev = current();
33
33
  state.references = [];
34
- registrations.forEach(([initialValue], index) => initKey(index, initialValue, prev[index]));
34
+ registrations.forEach(function (_a, index) {
35
+ var initialValue = _a[0];
36
+ return initKey(index, initialValue, prev[index]);
37
+ });
35
38
  }
36
39
  function initKey(key, initialState, prevState) {
37
40
  current().push();
@@ -39,7 +42,9 @@ function createState(onStateChange) {
39
42
  return function useStateKey() {
40
43
  return [
41
44
  current()[key],
42
- (nextState) => set(key, optionalFunctionValue(nextState, current()[key])),
45
+ function (nextState) {
46
+ return set(key, optionalFunctionValue(nextState, current()[key]));
47
+ },
43
48
  ];
44
49
  };
45
50
  }
@@ -47,9 +52,9 @@ function createState(onStateChange) {
47
52
  return state.references;
48
53
  }
49
54
  function set(index, value) {
50
- const prevValue = state.references[index];
55
+ var prevValue = state.references[index];
51
56
  state.references[index] = value;
52
- const [, onUpdate] = registrations[index];
57
+ var _a = registrations[index], onUpdate = _a[1];
53
58
  if (isFunction(onUpdate)) {
54
59
  onUpdate(value, prevValue);
55
60
  }
@@ -1 +1 @@
1
- import{optionalFunctionValue as e,isFunction as n}from"vest-utils";function r(r){const t={references:[]},c=[];return{registerStateKey:function(e,n){const r=c.length;return c.push([e,n]),o(r,e)},reset:function(){const e=s();t.references=[],c.forEach((([n],r)=>o(r,n,e[r])))}};function o(n,r,t){return s().push(),u(n,e(r,t)),function(){return[s()[n],r=>u(n,e(r,s()[n]))]}}function s(){return t.references}function u(e,o){const s=t.references[e];t.references[e]=o;const[,u]=c[e];n(u)&&u(o,s),n(r)&&r()}}export{r as createState};
1
+ import{optionalFunctionValue as e,isFunction as r}from"vest-utils";function n(n){var t={references:[]},u=[];return{registerStateKey:function(e,r){var n=u.length;return u.push([e,r]),f(n,e)},reset:function(){var e=c();t.references=[],u.forEach((function(r,n){return f(n,r[0],e[n])}))}};function f(r,n,t){return c().push(),o(r,e(n,t)),function(){return[c()[r],function(n){return o(r,e(n,c()[r]))}]}}function c(){return t.references}function o(e,f){var c=t.references[e];t.references[e]=f;var o=u[e][1];r(o)&&o(f,c),r(n)&&n()}}export{n as createState};
@@ -6,13 +6,13 @@
6
6
 
7
7
  // eslint-disable-next-line max-lines-per-function
8
8
  function createState(onStateChange) {
9
- const state = {
10
- references: [],
9
+ var state = {
10
+ references: []
11
11
  };
12
- const registrations = [];
12
+ var registrations = [];
13
13
  return {
14
- registerStateKey,
15
- reset,
14
+ registerStateKey: registerStateKey,
15
+ reset: reset
16
16
  };
17
17
  /**
18
18
  * Registers a new key in the state, takes the initial value (may be a function that returns the initial value), returns a function.
@@ -28,14 +28,17 @@
28
28
  * useColor()[0]; -> "green"
29
29
  */
30
30
  function registerStateKey(initialState, onUpdate) {
31
- const key = registrations.length;
31
+ var key = registrations.length;
32
32
  registrations.push([initialState, onUpdate]);
33
33
  return initKey(key, initialState);
34
34
  }
35
35
  function reset() {
36
- const prev = current();
36
+ var prev = current();
37
37
  state.references = [];
38
- registrations.forEach(([initialValue], index) => initKey(index, initialValue, prev[index]));
38
+ registrations.forEach(function (_a, index) {
39
+ var initialValue = _a[0];
40
+ return initKey(index, initialValue, prev[index]);
41
+ });
39
42
  }
40
43
  function initKey(key, initialState, prevState) {
41
44
  current().push();
@@ -43,7 +46,9 @@
43
46
  return function useStateKey() {
44
47
  return [
45
48
  current()[key],
46
- (nextState) => set(key, vestUtils.optionalFunctionValue(nextState, current()[key])),
49
+ function (nextState) {
50
+ return set(key, vestUtils.optionalFunctionValue(nextState, current()[key]));
51
+ },
47
52
  ];
48
53
  };
49
54
  }
@@ -51,9 +56,9 @@
51
56
  return state.references;
52
57
  }
53
58
  function set(index, value) {
54
- const prevValue = state.references[index];
59
+ var prevValue = state.references[index];
55
60
  state.references[index] = value;
56
- const [, onUpdate] = registrations[index];
61
+ var _a = registrations[index], onUpdate = _a[1];
57
62
  if (vestUtils.isFunction(onUpdate)) {
58
63
  onUpdate(value, prevValue);
59
64
  }
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","vest-utils"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).vast={},e["vest-utils"])}(this,(function(e,n){"use strict";e.createState=function(e){const t={references:[]},o=[];return{registerStateKey:function(e,n){const t=o.length;return o.push([e,n]),i(t,e)},reset:function(){const e=r();t.references=[],o.forEach((([n],t)=>i(t,n,e[t])))}};function i(e,t,o){return r().push(),s(e,n.optionalFunctionValue(t,o)),function(){return[r()[e],t=>s(e,n.optionalFunctionValue(t,r()[e]))]}}function r(){return t.references}function s(i,r){const s=t.references[i];t.references[i]=r;const[,u]=o[i];n.isFunction(u)&&u(r,s),n.isFunction(e)&&e()}},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","vest-utils"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).vast={},e["vest-utils"])}(this,(function(e,n){"use strict";e.createState=function(e){var t={references:[]},r=[];return{registerStateKey:function(e,n){var t=r.length;return r.push([e,n]),u(t,e)},reset:function(){var e=i();t.references=[],r.forEach((function(n,t){return u(t,n[0],e[t])}))}};function u(e,t,r){return i().push(),o(e,n.optionalFunctionValue(t,r)),function(){return[i()[e],function(t){return o(e,n.optionalFunctionValue(t,i()[e]))}]}}function i(){return t.references}function o(u,i){var o=t.references[u];t.references[u]=i;var f=r[u][1];n.isFunction(f)&&f(i,o),n.isFunction(e)&&e()}},Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.15-dev-d315d9",
2
+ "version": "1.0.15",
3
3
  "license": "MIT",
4
4
  "main": "./dist/cjs/vast.js",
5
5
  "types": "./types/vast.d.ts",
@@ -19,7 +19,7 @@
19
19
  "url": "https://github.com/ealush/vest.git/issues"
20
20
  },
21
21
  "dependencies": {
22
- "vest-utils": "^0.1.0-dev-d315d9"
22
+ "vest-utils": "^0.1.0"
23
23
  },
24
24
  "exports": {
25
25
  ".": {