@azrico/global 1.3.11 → 1.3.12

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.
@@ -1,7 +1,4 @@
1
1
  import { TUpdateFunction } from "pullstate";
2
- /**
3
- * You need this at the top of your view tree for states to work correctly
4
- */
5
2
  /**
6
3
  * Set state
7
4
  * @param state_name update function
@@ -1,12 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_state=add_state,exports.hold_add_state=hold_add_state,exports.hold_set_keystate=hold_set_keystate,exports.hold_set_state=hold_set_state,exports.remove_keystate=remove_keystate,exports.remove_state=remove_state,exports.set_keystate=set_keystate,exports.set_state=set_state,exports.use_state=use_state;var _pullstate=require("pullstate"),_react=_interopRequireDefault(require("react"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}var sd={},DataStore=new _pullstate.Store(sd),handler_name="gstate_handler",lname="gstate_list";function set_state(a,b){return DataStore.update(function(c){if(c&&"object"==_typeof(c)||(c={}),"string"==typeof a)c[a]=b;else if("function"==typeof a){var d=a(c);null!=d&&(c=d)}}),!0;//const updateFunc = GlobalStorage.Global_get(handler_name, "state_changed");
2
- //if (typeof updateFunc === "function") {
3
- // updateFunc(state_name, value);
4
- // return true;
5
- //} else {
6
- // console.error("StateHandler is invalid");
7
- //}
8
- //return false;
9
- }/**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_state=add_state,exports.hold_add_state=hold_add_state,exports.hold_set_keystate=hold_set_keystate,exports.hold_set_state=hold_set_state,exports.remove_keystate=remove_keystate,exports.remove_state=remove_state,exports.set_keystate=set_keystate,exports.set_state=set_state,exports.use_state=use_state;var _pullstate=require("pullstate"),_react=_interopRequireDefault(require("react"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}var sd={},DataStore=new _pullstate.Store(sd);function set_state(a,b){return DataStore.update(function(c){if(c&&"object"==_typeof(c)||(c={}),"function"==typeof a){var d=a(c);null!=d&&(c=d)}else c[a]=b}),!0}/**
10
2
  * Add value to state array
11
3
  * @param state_name
12
4
  * @param value
@@ -27,4 +19,4 @@
27
19
  * Returns a state by its name
28
20
  * @param state_name
29
21
  * @returns the state
30
- */function use_state(a){return DataStore.useState(function(b){return b[a]},[a])}/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */function hold_set_state(a,b){return _react["default"].useEffect(function(){return set_state(a,b),function(){set_state(a,void 0)}},[b]),b}function hold_set_keystate(a,b,c){return _react["default"].useEffect(function(){return set_keystate(a,b,c),function(){set_keystate(a,b,void 0)}},[c]),c}function hold_add_state(a,b){return _react["default"].useEffect(function(){return add_state(a,b),function(){remove_state(a,void 0)}},[b]),b}
22
+ */function use_state(a){return DataStore.useState(function(b){return b[a]})}/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */function hold_set_state(a,b){return _react["default"].useEffect(function(){return set_state(a,b),function(){set_state(a,void 0)}},[b]),b}function hold_set_keystate(a,b,c){return _react["default"].useEffect(function(){return set_keystate(a,b,c),function(){set_keystate(a,b,void 0)}},[c]),c}function hold_add_state(a,b){return _react["default"].useEffect(function(){return add_state(a,b),function(){remove_state(a,void 0)}},[b]),b}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/global",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "private": false,
5
5
  "description": "Simple global functions and helpers",
6
6
  "author": "Azrideus",
@@ -77,13 +77,13 @@
77
77
  "dependencies": {
78
78
  "@react-native-async-storage/async-storage": "^1.15.5",
79
79
  "crypto-js": "^4.1.1",
80
- "pullstate": "^1.22.1",
81
- "react": "^17.0.2"
80
+ "pullstate": "^1.24.0",
81
+ "react": "^18.0.0"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@react-native-async-storage/async-storage": "^1.15.5",
85
85
  "crypto-js": "^4.1.1",
86
- "pullstate": "^1.22.1",
87
- "react": "^17.0.2"
86
+ "pullstate": "^1.24.0",
87
+ "react": "^18.0.0"
88
88
  }
89
89
  }