@webkrafters/react-observable-context 5.0.1 → 5.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.
|
@@ -6,5 +6,5 @@ interface CurrentStorage<T extends State> extends IStorage<T> {
|
|
|
6
6
|
isKeyRequired?: boolean;
|
|
7
7
|
}
|
|
8
8
|
/** @param storage - is Closed to modification post-initialization */
|
|
9
|
-
declare const useStore: <T extends
|
|
9
|
+
declare const useStore: <T extends State>(prehooks: Prehooks<T>, value: PartialState<T>, storage?: CurrentStorage<T>) => StoreInternal<T>;
|
|
10
10
|
export default useStore;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
function _createForOfIteratorHelper(
|
|
5
|
-
function _slicedToArray(
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _iterableToArrayLimit(
|
|
8
|
-
function _arrayWithHoles(
|
|
9
|
-
function ownKeys(
|
|
10
|
-
function _objectSpread(
|
|
11
|
-
function _defineProperty(
|
|
12
|
-
function _toPropertyKey(
|
|
13
|
-
function _toPrimitive(
|
|
14
|
-
function _toConsumableArray(
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
15
|
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."); }
|
|
16
|
-
function _unsupportedIterableToArray(
|
|
17
|
-
function _iterableToArray(
|
|
18
|
-
function _arrayWithoutHoles(
|
|
19
|
-
function _arrayLikeToArray(
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
20
|
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
21
21
|
return mod && mod.__esModule ? mod : {
|
|
22
22
|
"default": mod
|
package/dist/main/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
function _defineProperties(
|
|
5
|
-
function _createClass(
|
|
6
|
-
function _classCallCheck(
|
|
7
|
-
function
|
|
8
|
-
function
|
|
9
|
-
function
|
|
10
|
-
function
|
|
11
|
-
function _wrapNativeSuper(
|
|
12
|
-
function _construct(
|
|
13
|
-
function _isNativeReflectConstruct() {
|
|
14
|
-
function _isNativeFunction(
|
|
15
|
-
function _setPrototypeOf(
|
|
16
|
-
function _getPrototypeOf(
|
|
17
|
-
function ownKeys(
|
|
18
|
-
function _objectSpread(
|
|
19
|
-
function _defineProperty(
|
|
20
|
-
function _toPropertyKey(
|
|
21
|
-
function _toPrimitive(
|
|
22
|
-
function _createForOfIteratorHelper(
|
|
23
|
-
function _toConsumableArray(
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
10
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
12
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
23
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
24
24
|
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."); }
|
|
25
|
-
function _iterableToArray(
|
|
26
|
-
function _arrayWithoutHoles(
|
|
27
|
-
function _slicedToArray(
|
|
25
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
26
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
27
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
28
28
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
-
function _unsupportedIterableToArray(
|
|
30
|
-
function _arrayLikeToArray(
|
|
31
|
-
function _iterableToArrayLimit(
|
|
32
|
-
function _arrayWithHoles(
|
|
29
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
32
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
33
|
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
34
34
|
if (k2 === undefined) k2 = k;
|
|
35
35
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -54,13 +54,27 @@ var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create
|
|
|
54
54
|
} : function (o, v) {
|
|
55
55
|
o["default"] = v;
|
|
56
56
|
});
|
|
57
|
-
var __importStar = void 0 && (void 0).__importStar || function (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
57
|
+
var __importStar = void 0 && (void 0).__importStar || function () {
|
|
58
|
+
var _ownKeys = function ownKeys(o) {
|
|
59
|
+
_ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
60
|
+
var ar = [];
|
|
61
|
+
for (var k in o) {
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
63
|
+
}
|
|
64
|
+
return ar;
|
|
65
|
+
};
|
|
66
|
+
return _ownKeys(o);
|
|
67
|
+
};
|
|
68
|
+
return function (mod) {
|
|
69
|
+
if (mod && mod.__esModule) return mod;
|
|
70
|
+
var result = {};
|
|
71
|
+
if (mod != null) for (var k = _ownKeys(mod), i = 0; i < k.length; i++) {
|
|
72
|
+
if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
73
|
+
}
|
|
74
|
+
__setModuleDefault(result, mod);
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
}();
|
|
64
78
|
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
65
79
|
return mod && mod.__esModule ? mod : {
|
|
66
80
|
"default": mod
|
|
@@ -69,7 +83,10 @@ var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
|
69
83
|
Object.defineProperty(exports, "__esModule", {
|
|
70
84
|
value: true
|
|
71
85
|
});
|
|
72
|
-
exports.UsageError =
|
|
86
|
+
exports.UsageError = void 0;
|
|
87
|
+
exports.createContext = createContext;
|
|
88
|
+
exports.useContext = useContext;
|
|
89
|
+
exports.connect = connect;
|
|
73
90
|
var react_1 = __importStar(require("react"));
|
|
74
91
|
var lodash_isempty_1 = __importDefault(require("lodash.isempty"));
|
|
75
92
|
var lodash_isequal_1 = __importDefault(require("lodash.isequal"));
|
|
@@ -92,7 +109,6 @@ function createContext() {
|
|
|
92
109
|
Context.Provider = makeObservable(provider);
|
|
93
110
|
return Context;
|
|
94
111
|
}
|
|
95
|
-
exports.createContext = createContext;
|
|
96
112
|
;
|
|
97
113
|
var connRegister = {};
|
|
98
114
|
function getConnectionFrom(connKey, cache) {
|
|
@@ -267,7 +283,6 @@ function useContext(context, selectorMap) {
|
|
|
267
283
|
};
|
|
268
284
|
}, [data]);
|
|
269
285
|
}
|
|
270
|
-
exports.useContext = useContext;
|
|
271
286
|
;
|
|
272
287
|
/**
|
|
273
288
|
* Provides an HOC function for connecting its WrappedComponent argument to the context store.
|
|
@@ -292,13 +307,13 @@ function connect(context, selectorMap) {
|
|
|
292
307
|
}
|
|
293
308
|
return connector;
|
|
294
309
|
}
|
|
295
|
-
exports.connect = connect;
|
|
296
310
|
var UsageError = /*#__PURE__*/function (_Error) {
|
|
311
|
+
_inherits(UsageError, _Error);
|
|
312
|
+
var _super = _createSuper(UsageError);
|
|
297
313
|
function UsageError() {
|
|
298
314
|
_classCallCheck(this, UsageError);
|
|
299
|
-
return
|
|
315
|
+
return _super.apply(this, arguments);
|
|
300
316
|
}
|
|
301
|
-
_inherits(UsageError, _Error);
|
|
302
317
|
return _createClass(UsageError);
|
|
303
318
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
304
319
|
exports.UsageError = UsageError;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _globalThis$sessionSt;
|
|
4
|
-
function _typeof(
|
|
5
|
-
function _classCallCheck(
|
|
6
|
-
function _defineProperties(
|
|
7
|
-
function _createClass(
|
|
8
|
-
function _toPropertyKey(
|
|
9
|
-
function _toPrimitive(
|
|
4
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
10
|
var __classPrivateFieldSet = void 0 && (void 0).__classPrivateFieldSet || function (receiver, state, value, kind, f) {
|
|
11
11
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
12
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -34,7 +34,7 @@ var MemoryStorage = /*#__PURE__*/function () {
|
|
|
34
34
|
_MemoryStorage_data.set(this, void 0);
|
|
35
35
|
__classPrivateFieldSet(this, _MemoryStorage_data, null, "f");
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
_createClass(MemoryStorage, [{
|
|
38
38
|
key: "clone",
|
|
39
39
|
value: function clone(data) {
|
|
40
40
|
return (0, clone_total_1["default"])(data);
|
|
@@ -55,6 +55,7 @@ var MemoryStorage = /*#__PURE__*/function () {
|
|
|
55
55
|
__classPrivateFieldSet(this, _MemoryStorage_data, data, "f");
|
|
56
56
|
}
|
|
57
57
|
}]);
|
|
58
|
+
return MemoryStorage;
|
|
58
59
|
}();
|
|
59
60
|
_MemoryStorage_data = new WeakMap();
|
|
60
61
|
var SessionStorage = /*#__PURE__*/function () {
|
|
@@ -63,7 +64,7 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
63
64
|
_SessionStorage_storage.set(this, void 0);
|
|
64
65
|
__classPrivateFieldSet(this, _SessionStorage_storage, globalThis.sessionStorage, "f");
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
_createClass(SessionStorage, [{
|
|
67
68
|
key: "clone",
|
|
68
69
|
value: function clone(data) {
|
|
69
70
|
return data;
|
|
@@ -84,6 +85,7 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
84
85
|
return __classPrivateFieldGet(this, _SessionStorage_storage, "f").setItem(key, JSON.stringify(data));
|
|
85
86
|
}
|
|
86
87
|
}]);
|
|
88
|
+
return SessionStorage;
|
|
87
89
|
}();
|
|
88
90
|
_SessionStorage_storage = new WeakMap();
|
|
89
91
|
var Storage = /*#__PURE__*/function () {
|
|
@@ -92,7 +94,7 @@ var Storage = /*#__PURE__*/function () {
|
|
|
92
94
|
_Storage_storage.set(this, void 0);
|
|
93
95
|
__classPrivateFieldSet(this, _Storage_storage, Storage.supportsSession ? new SessionStorage() : new MemoryStorage(), "f");
|
|
94
96
|
}
|
|
95
|
-
|
|
97
|
+
_createClass(Storage, [{
|
|
96
98
|
key: "isKeyRequired",
|
|
97
99
|
get: function get() {
|
|
98
100
|
return __classPrivateFieldGet(this, _Storage_storage, "f") instanceof SessionStorage;
|
|
@@ -118,6 +120,7 @@ var Storage = /*#__PURE__*/function () {
|
|
|
118
120
|
__classPrivateFieldGet(this, _Storage_storage, "f").setItem(key, data);
|
|
119
121
|
}
|
|
120
122
|
}]);
|
|
123
|
+
return Storage;
|
|
121
124
|
}();
|
|
122
125
|
_Storage_storage = new WeakMap();
|
|
123
126
|
Storage.supportsSession = typeof ((_globalThis$sessionSt = globalThis.sessionStorage) === null || _globalThis$sessionSt === void 0 ? void 0 : _globalThis$sessionSt.setItem) === 'undefined';
|
package/package.json
CHANGED
|
@@ -7,12 +7,6 @@
|
|
|
7
7
|
"contributors": [
|
|
8
8
|
"steveswork <stephen.isienyi@gmail.com> (https://github.com/steveswork)"
|
|
9
9
|
],
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@webkrafters/auto-immutable": "^1.0.2",
|
|
12
|
-
"@webkrafters/data-distillery": "^0.0.3",
|
|
13
|
-
"@webkrafters/path-dotize": "^0.0.2",
|
|
14
|
-
"auto-immutable-docs": "github:webkrafters/auto-immutable"
|
|
15
|
-
},
|
|
16
10
|
"description": "Observable react context - Update-friendly context. Prevents automatic total component tree tear-down and re-rendering during context updates.",
|
|
17
11
|
"devDependencies": {
|
|
18
12
|
"@babel/cli": "^7.17.0",
|
|
@@ -28,7 +22,10 @@
|
|
|
28
22
|
"@types/jest": "^29.5.12",
|
|
29
23
|
"@types/jest-cli": "^24.3.0",
|
|
30
24
|
"@types/node": "^20.11.28",
|
|
25
|
+
"@webkrafters/auto-immutable": "^1.0.3",
|
|
31
26
|
"@webkrafters/clone-total": "^1.0.1",
|
|
27
|
+
"@webkrafters/data-distillery": "^0.1.1",
|
|
28
|
+
"@webkrafters/path-dotize": "0.0.2",
|
|
32
29
|
"babel-loader": "^9.1.3",
|
|
33
30
|
"eslint": "^8.57.0",
|
|
34
31
|
"eslint-config-standard": "^17.1.0",
|
|
@@ -41,6 +38,7 @@
|
|
|
41
38
|
"jest": "^29.7.0",
|
|
42
39
|
"jest-cli": "^29.7.0",
|
|
43
40
|
"jest-environment-jsdom": "^29.7.0",
|
|
41
|
+
"lodash.clonedeepwith": "^4.5.0",
|
|
44
42
|
"lodash.isboolean": "^3.0.3",
|
|
45
43
|
"lodash.isempty": "^4.4.0",
|
|
46
44
|
"lodash.isequal": "^4.5.0",
|
|
@@ -95,6 +93,10 @@
|
|
|
95
93
|
"name": "@webkrafters/react-observable-context",
|
|
96
94
|
"peerDependencies": {
|
|
97
95
|
"@types/react": ">= 16.8.0",
|
|
96
|
+
"@webkrafters/auto-immutable": "^1.0.2",
|
|
97
|
+
"@webkrafters/clone-total": "^1.0.1",
|
|
98
|
+
"@webkrafters/data-distillery": "^0.0.3",
|
|
99
|
+
"@webkrafters/path-dotize": "^0.0.2",
|
|
98
100
|
"lodash.isboolean": ">= 0.1.0",
|
|
99
101
|
"lodash.isempty": ">= 0.1.0",
|
|
100
102
|
"lodash.isequal": ">= 0.1.0",
|
|
@@ -118,5 +120,5 @@
|
|
|
118
120
|
"test:watch": "eslint --fix && jest --updateSnapshot --watchAll"
|
|
119
121
|
},
|
|
120
122
|
"types": "dist/index.d.ts",
|
|
121
|
-
"version": "5.0.
|
|
122
|
-
}
|
|
123
|
+
"version": "5.0.3"
|
|
124
|
+
}
|