@webkrafters/react-observable-context 4.0.0-rc.8 → 4.0.0

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,9 +1,6 @@
1
- export class UsageError extends Error {
2
- }
3
-
4
1
  /**
5
2
  * @param {ObservableContext<T>} context Refers to the PublicObservableContext<T> type of the ObservableContext<T>
6
- * @param {{[selectorKey: string]: string|keyof T}} [selectorMap] Key:value pairs where `key` => arbitrary key given to Store.data property holding the state slices and `value` => property paths to state slices used by this component: see examples below. May use `{..., state: '@@STATE'}` to indicate a desire to obtain the entire state object and assign to a `state` property of Store.data. A change in any of the referenced properties results in this component render. When using `['@@STATE']`, any change in the state object results in this component render.
3
+ * @param {{[selectorKey: string]: string|keyof T}} [selectorMap] Key:value pairs where `key` => arbitrary key given to a Store.data property holding a state slice and `value` => property path to a state slice used by this component: see examples below. May add a mapping for a certain arbitrary key='state' and value='@@STATE' to indicate a desire to obtain the entire state object and assign to a `state` property of Store.data. A change in any of the referenced properties results in this component render. When using '@@STATE', note that any change within the state object will result in this component render.
7
4
  * @returns {(WrappedComponent: C) => MemoExoticComponent<P>}
8
5
  * @template {State} T
9
6
  * @template {PartialStore<T> & {[x:string]:*}} [P=PartialStore<T>]
@@ -23,20 +20,25 @@ export function connect<T extends import("../types").State, P extends PartialSto
23
20
  * @see {ObservableContext<T>}
24
21
  */
25
22
  export function createContext<T extends import("../types").State>(): ObservableContext<T>;
23
+ export class UsageError extends Error {
24
+ }
26
25
 
27
26
  /**
28
27
  * Actively monitors the store and triggers component re-render if any of the watched keys in the state objects changes
29
28
  *
30
29
  * @param {ObservableContext<T>} context Refers to the PublicObservableContext<T> type of the ObservableContext<T>
31
- * @param {{[selectorKey: string]: string|keyof T}} [selectorMap = {}] Key:value pairs where `key` => arbitrary key given to Store.data property holding the state slices and `value` => property paths to state slices used by this component: see examples below. May use `{..., state: '@@STATE'}` to indicate a desire to obtain the entire state object and assign to a `state` property of Store.data. A change in any of the referenced properties results in this component render. When using `['@@STATE']`, any change in the state object results in this component render.
30
+ * @param {{[selectorKey: string]: string|keyof T}} [selectorMap = {}] Key:value pairs where `key` => arbitrary key given to a Store.data property holding a state slice and `value` => property path to a state slice used by this component: see examples below. May add a mapping for a certain arbitrary key='state' and value='@@STATE' to indicate a desire to obtain the entire state object and assign to a `state` property of Store.data. A change in any of the referenced properties results in this component render. When using '@@STATE', note that any change within the state object will result in this component render.
32
31
  * @returns {Store<T>}
33
32
  * @template {State} T
34
33
  * @see {ObservableContext<T>}
35
34
  * @example
36
- * a valid propertyPath follows the `lodash` object property path convention.
35
+ * a valid property path follows the `lodash` object property path convention.
37
36
  * for a state = { a: 1, b: 2, c: 3, d: { e: 5, f: [6, { x: 7, y: 8, z: 9 } ] } }
38
37
  * Any of the following is an applicable selector map.
39
- * {count: 'a', myData: 'd'} => {count: 1, myData: { e: 5, f: [6, { x: 7, y: 8, z: 9 } ] }}
38
+ * {myData: 'd', count: 'a'} => {
39
+ * myData: { e: 5, f: [6, { x: 7, y: 8, z: 9 } ] },
40
+ * count: 1
41
+ * }
40
42
  * {count: 'a'} => {count: 1} // same applies to {count: 'b'} = {count: 2}; {count: 'c'} = {count: 3}
41
43
  * {myData: 'd'} => {mydata: { e: 5, f: [6, { x: 7, y: 8, z: 9 } ] }}
42
44
  * {xyz: 'd.e'} => {xyz: 5}
@@ -11,10 +11,10 @@ var _lodash4 = _interopRequireDefault(require("lodash.omit"));
11
11
  var _uuid = require("uuid");
12
12
  var _useRenderKeyProvider = _interopRequireDefault(require("./hooks/use-render-key-provider"));
13
13
  var _useStore = _interopRequireDefault(require("./hooks/use-store"));
14
- var _excluded = ["getState", "resetState", "subscribe", "unlinkCache"];
15
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
16
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ 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); }
18
18
  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; }
19
19
  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; }
20
20
  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; }
@@ -29,10 +29,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
29
29
  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; }
30
30
  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; } }
31
31
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
32
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
33
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
34
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
35
- 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); }
36
32
  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); } }
37
33
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
38
34
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
@@ -48,75 +44,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
48
44
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
49
45
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
50
46
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
- var UsageError = function (_Error) {
52
- _inherits(UsageError, _Error);
53
- var _super = _createSuper(UsageError);
54
- function UsageError() {
55
- _classCallCheck(this, UsageError);
56
- return _super.apply(this, arguments);
57
- }
58
- return _createClass(UsageError);
59
- }( _wrapNativeSuper(Error));
60
- exports.UsageError = UsageError;
61
- var defaultPrehooks = Object.freeze({});
62
- var reportNonReactUsage = function reportNonReactUsage() {
63
- throw new UsageError('Detected usage outside of this context\'s Provider component tree. Please apply the exported Provider component');
64
- };
65
- var ChildMemo = function () {
66
- var useNodeMemo = function useNodeMemo(node) {
67
- var nodeRef = (0, _react.useRef)(node);
68
- if (!(0, _lodash2["default"])((0, _lodash4["default"])(nodeRef.current, '_owner'), (0, _lodash4["default"])(node, '_owner'))) {
69
- nodeRef.current = node;
70
- }
71
- return nodeRef.current;
72
- };
73
- var ChildMemo = (0, _react.memo)(function (_ref) {
74
- var child = _ref.child;
75
- return child;
76
- });
77
- ChildMemo.displayName = 'ObservableContext.Provider.Internal.Guardian.ChildMemo';
78
- var Guardian = function Guardian(_ref2) {
79
- var child = _ref2.child;
80
- return _react["default"].createElement(ChildMemo, {
81
- child: useNodeMemo(child)
82
- });
83
- };
84
- Guardian.displayName = 'ObservableContext.Provider.Internal.Guardian';
85
- return Guardian;
86
- }();
87
- var memoizeImmediateChildTree = function memoizeImmediateChildTree(children) {
88
- return _react.Children.map(children, function (child) {
89
- var _child$props;
90
- if (_typeof(child.type) === 'object' && 'compare' in child.type) {
91
- return child;
92
- }
93
- if ((_child$props = child.props) !== null && _child$props !== void 0 && _child$props.children) {
94
- child = (0, _react.cloneElement)(child, (0, _lodash4["default"])(child.props, 'children'), memoizeImmediateChildTree(child.props.children));
95
- }
96
- return _react["default"].createElement(ChildMemo, {
97
- child: child
98
- });
99
- });
100
- };
101
- var makeObservable = function makeObservable(Provider) {
102
- var Observable = function Observable(_ref3) {
103
- var _ref3$children = _ref3.children,
104
- children = _ref3$children === void 0 ? null : _ref3$children,
105
- _ref3$prehooks = _ref3.prehooks,
106
- prehooks = _ref3$prehooks === void 0 ? defaultPrehooks : _ref3$prehooks,
107
- _ref3$storage = _ref3.storage,
108
- storage = _ref3$storage === void 0 ? null : _ref3$storage,
109
- value = _ref3.value;
110
- return _react["default"].createElement(Provider, {
111
- value: (0, _useStore["default"])(prehooks, value, storage)
112
- }, memoizeImmediateChildTree(children));
113
- };
114
- Observable.displayName = 'ObservableContext.Provider';
115
- return Observable;
116
- };
47
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
117
48
  var connect = function connect(context, selectorMap) {
118
49
  return function (WrappedComponent) {
119
- if (!(0, _lodash3["default"])(WrappedComponent) || !('compare' in WrappedComponent)) {
50
+ if (!((0, _lodash3["default"])(WrappedComponent) && 'compare' in WrappedComponent)) {
120
51
  WrappedComponent = (0, _react.memo)(WrappedComponent);
121
52
  }
122
53
  var ConnectedComponent = (0, _react.memo)(function (ownProps) {
@@ -140,6 +71,16 @@ var createContext = function createContext() {
140
71
  return Context;
141
72
  };
142
73
  exports.createContext = createContext;
74
+ var UsageError = function (_Error) {
75
+ _inherits(UsageError, _Error);
76
+ var _super = _createSuper(UsageError);
77
+ function UsageError() {
78
+ _classCallCheck(this, UsageError);
79
+ return _super.apply(this, arguments);
80
+ }
81
+ return _createClass(UsageError);
82
+ }( _wrapNativeSuper(Error));
83
+ exports.UsageError = UsageError;
143
84
  var useContext = function useContext(context) {
144
85
  var selectorMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
145
86
  var _React$useContext = _react["default"].useContext(context),
@@ -147,12 +88,12 @@ var useContext = function useContext(context) {
147
88
  _resetState = _React$useContext.resetState,
148
89
  subscribe = _React$useContext.subscribe,
149
90
  unlinkCache = _React$useContext.unlinkCache,
150
- store = _objectWithoutProperties(_React$useContext, _excluded);
91
+ setState = _React$useContext.setState;
151
92
  var _React$useState = _react["default"].useState(_uuid.v4),
152
93
  _React$useState2 = _slicedToArray(_React$useState, 1),
153
94
  clientId = _React$useState2[0];
154
95
  var _renderKeys = (0, _useRenderKeyProvider["default"])(selectorMap);
155
- var path2SelectorMap = (0, _react.useMemo)(function () {
96
+ var selectorMapInverse = (0, _react.useMemo)(function () {
156
97
  var map = {};
157
98
  if ((0, _lodash["default"])(_renderKeys)) {
158
99
  return map;
@@ -174,7 +115,7 @@ var useContext = function useContext(context) {
174
115
  try {
175
116
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
176
117
  var path = _step.value;
177
- data[path2SelectorMap[path]] = state[path];
118
+ data[selectorMapInverse[path]] = state[path];
178
119
  }
179
120
  } catch (err) {
180
121
  _iterator.e(err);
@@ -194,8 +135,8 @@ var useContext = function useContext(context) {
194
135
  try {
195
136
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
196
137
  var path = _step2.value;
197
- if (data[path2SelectorMap[path]] !== state[path]) {
198
- data[path2SelectorMap[path]] = state[path];
138
+ if (data[selectorMapInverse[path]] !== state[path]) {
139
+ data[selectorMapInverse[path]] = state[path];
199
140
  hasChanges = true;
200
141
  }
201
142
  }
@@ -209,14 +150,14 @@ var useContext = function useContext(context) {
209
150
  var resetState = (0, _react.useCallback)(function () {
210
151
  var propertyPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _renderKeys;
211
152
  return _resetState(propertyPath);
212
- }, [_renderKeys]);
153
+ }, []);
213
154
  _react["default"].useEffect(function () {
214
155
  if ((0, _lodash["default"])(_renderKeys)) {
215
156
  !(0, _lodash2["default"])({}, data) && setData({});
216
157
  return;
217
158
  }
218
159
  for (var selectorKey in data) {
219
- if (!(selectorMap[selectorKey] in path2SelectorMap)) {
160
+ if (!(selectorMap[selectorKey] in selectorMapInverse)) {
220
161
  delete data[selectorKey];
221
162
  }
222
163
  }
@@ -228,10 +169,67 @@ var useContext = function useContext(context) {
228
169
  };
229
170
  }, [_renderKeys]);
230
171
  return (0, _react.useMemo)(function () {
231
- return _objectSpread({
172
+ return {
232
173
  data: data,
233
- resetState: resetState
234
- }, store);
174
+ resetState: resetState,
175
+ setState: setState
176
+ };
235
177
  }, [data]);
236
178
  };
237
- exports.useContext = useContext;
179
+ exports.useContext = useContext;
180
+ var ChildMemo = function () {
181
+ var useNodeMemo = function useNodeMemo(node) {
182
+ var nodeRef = (0, _react.useRef)(node);
183
+ if (!(0, _lodash2["default"])((0, _lodash4["default"])(nodeRef.current, '_owner'), (0, _lodash4["default"])(node, '_owner'))) {
184
+ nodeRef.current = node;
185
+ }
186
+ return nodeRef.current;
187
+ };
188
+ var ChildMemo = (0, _react.memo)(function (_ref) {
189
+ var child = _ref.child;
190
+ return child;
191
+ });
192
+ ChildMemo.displayName = 'ObservableContext.Provider.Internal.Guardian.ChildMemo';
193
+ var Guardian = function Guardian(_ref2) {
194
+ var child = _ref2.child;
195
+ return _react["default"].createElement(ChildMemo, {
196
+ child: useNodeMemo(child)
197
+ });
198
+ };
199
+ Guardian.displayName = 'ObservableContext.Provider.Internal.Guardian';
200
+ return Guardian;
201
+ }();
202
+ var defaultPrehooks = Object.freeze({});
203
+ function makeObservable(Provider) {
204
+ var Observable = function Observable(_ref3) {
205
+ var _ref3$children = _ref3.children,
206
+ children = _ref3$children === void 0 ? null : _ref3$children,
207
+ _ref3$prehooks = _ref3.prehooks,
208
+ prehooks = _ref3$prehooks === void 0 ? defaultPrehooks : _ref3$prehooks,
209
+ _ref3$storage = _ref3.storage,
210
+ storage = _ref3$storage === void 0 ? null : _ref3$storage,
211
+ value = _ref3.value;
212
+ return _react["default"].createElement(Provider, {
213
+ value: (0, _useStore["default"])(prehooks, value, storage)
214
+ }, memoizeImmediateChildTree(children));
215
+ };
216
+ Observable.displayName = 'ObservableContext.Provider';
217
+ return Observable;
218
+ }
219
+ function memoizeImmediateChildTree(children) {
220
+ return _react.Children.map(children, function (child) {
221
+ var _child$props;
222
+ if (_typeof(child.type) === 'object' && 'compare' in child.type) {
223
+ return child;
224
+ }
225
+ if ((_child$props = child.props) !== null && _child$props !== void 0 && _child$props.children) {
226
+ child = (0, _react.cloneElement)(child, (0, _lodash4["default"])(child.props, 'children'), memoizeImmediateChildTree(child.props.children));
227
+ }
228
+ return _react["default"].createElement(ChildMemo, {
229
+ child: child
230
+ });
231
+ });
232
+ }
233
+ function reportNonReactUsage() {
234
+ throw new UsageError('Detected usage outside of this context\'s Provider component tree. Please apply the exported Provider component');
235
+ }
@@ -140,7 +140,7 @@ var Accessor = function () {
140
140
  }
141
141
  } else if (_classPrivateFieldGet(this, _paths).length > MODERATE_NUM_PATHS_THRESHOLD) {
142
142
  var pathsObj = {};
143
- var _iterator3 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _paths).length),
143
+ var _iterator3 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _paths)),
144
144
  _step3;
145
145
  try {
146
146
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -2,8 +2,4 @@ export function arrangePropertyPaths(propertyPaths: Array<string>): Array<string
2
2
  export function makeReadonly<T>(v: T): Readonly<T>;
3
3
  export function mapPathsToObject<T extends {
4
4
  [x: string]: any;
5
- }>(source: T, propertyPaths: Array<string>): { [K in keyof T]?: any; };
6
- export const none: None;
7
- declare class None {
8
- }
9
- export {};
5
+ }>(source: T, propertyPaths: Array<string>): { [K in keyof T]?: any; };
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
- 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); }
3
2
  Object.defineProperty(exports, "__esModule", {
4
3
  value: true
5
4
  });
6
5
  exports.arrangePropertyPaths = arrangePropertyPaths;
7
6
  exports.makeReadonly = makeReadonly;
8
7
  exports.mapPathsToObject = mapPathsToObject;
9
- exports.none = void 0;
10
8
  var _lodash = _interopRequireDefault(require("lodash.get"));
11
9
  var _lodash2 = _interopRequireDefault(require("lodash.has"));
12
10
  var _lodash3 = _interopRequireDefault(require("lodash.isplainobject"));
@@ -14,17 +12,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
14
12
  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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
15
13
  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); }
16
14
  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; }
17
- 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); } }
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- 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); }
21
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
- var None = _createClass(function None() {
23
- _classCallCheck(this, None);
24
- });
25
- ;
26
- var none = new None();
27
- exports.none = none;
28
15
  function arrangePropertyPaths(propertyPaths) {
29
16
  var superPathTokensMap = {};
30
17
  var _iterator = _createForOfIteratorHelper(propertyPaths),
package/package.json CHANGED
@@ -129,5 +129,5 @@
129
129
  "test:watch": "eslint --fix && jest --updateSnapshot --watchAll"
130
130
  },
131
131
  "types": "dist/main/index.d.ts",
132
- "version": "4.0.0-rc.8"
132
+ "version": "4.0.0"
133
133
  }