@legendapp/state 0.15.0-next.9 → 0.15.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/babel.js +21 -599
  3. package/babel.js.map +1 -1
  4. package/index.d.ts +7 -2
  5. package/index.js +123 -113
  6. package/index.js.map +1 -1
  7. package/index.mjs +117 -113
  8. package/index.mjs.map +1 -1
  9. package/internal.d.ts +1 -1
  10. package/internal.js +4 -0
  11. package/internal.js.map +1 -1
  12. package/internal.mjs +1 -1
  13. package/package.json +15 -17
  14. package/react-components.d.ts +1 -0
  15. package/react-components.js +42 -0
  16. package/react-components.js.map +1 -0
  17. package/react-components.mjs +40 -0
  18. package/react-components.mjs.map +1 -0
  19. package/react-native-components.d.ts +1 -0
  20. package/react-native-components.js +38 -0
  21. package/react-native-components.js.map +1 -0
  22. package/react-native-components.mjs +36 -0
  23. package/react-native-components.mjs.map +1 -0
  24. package/react.d.ts +1 -0
  25. package/react.js +139 -137
  26. package/react.js.map +1 -1
  27. package/react.mjs +137 -140
  28. package/react.mjs.map +1 -1
  29. package/src/globals.d.ts +3 -1
  30. package/src/helpers.d.ts +3 -1
  31. package/src/observableInterfaces.d.ts +16 -14
  32. package/src/{effect.d.ts → observe.d.ts} +1 -1
  33. package/src/onChange.d.ts +1 -5
  34. package/src/react/flow.d.ts +31 -0
  35. package/src/react/useComputed.d.ts +6 -1
  36. package/src/react/useObserve.d.ts +1 -0
  37. package/src/{react/components.d.ts → react-components/react-components.d.ts} +4 -10
  38. package/src/{react-native/components.d.ts → react-native-components/rn-components.d.ts} +4 -8
  39. package/src/tracking.d.ts +1 -1
  40. package/src/when.d.ts +1 -5
  41. package/trace.js +4 -2
  42. package/trace.js.map +1 -1
  43. package/trace.mjs +5 -3
  44. package/trace.mjs.map +1 -1
  45. package/types.d.ts +15 -0
  46. package/react-native-types.d.ts +0 -39
  47. package/react-native.d.ts +0 -1
  48. package/react-native.js +0 -173
  49. package/react-native.js.map +0 -1
  50. package/react-native.mjs +0 -169
  51. package/react-native.mjs.map +0 -1
  52. package/react-types.d.ts +0 -8
  53. package/reactivity.d.ts +0 -2
  54. package/reactivity.js +0 -230
  55. package/reactivity.js.map +0 -1
  56. package/reactivity.mjs +0 -222
  57. package/reactivity.mjs.map +0 -1
  58. package/src/react/controlFlow.d.ts +0 -28
  59. package/state-types.d.ts +0 -24
package/index.d.ts CHANGED
@@ -4,10 +4,11 @@ export { observable } from './src/observable';
4
4
  export { batch, beginBatch, endBatch } from './src/batching';
5
5
  export { computed } from './src/computed';
6
6
  export { event } from './src/event';
7
- export { effect } from './src/effect';
7
+ export { observe } from './src/observe';
8
8
  export { when } from './src/when';
9
9
  export * from './src/observableInterfaces';
10
10
  export { isEmpty } from './src/is';
11
+ export { lockObservable } from './src/helpers';
11
12
  /** @internal */
12
13
  export { isArray, isFunction, isObject, isPrimitive } from './src/is';
13
14
  /** @internal */
@@ -15,4 +16,8 @@ export { onChange } from './src/onChange';
15
16
  /** @internal */
16
17
  export { tracking } from './src/tracking';
17
18
  /** @internal */
18
- export { symbolDateModified, symbolIsObservable } from './src/globals';
19
+ export { symbolDateModified, symbolIsObservable, extraPrimitiveProps, getNodeValue, symbolUndef } from './src/globals';
20
+ /** @internal */
21
+ export { getNode } from './src/helpers';
22
+ /** @internal */
23
+ export { setupTracking } from './src/observe';
package/index.js CHANGED
@@ -40,10 +40,7 @@ const tracking = {
40
40
  listeners: undefined,
41
41
  updates: undefined,
42
42
  };
43
- function updateTracking(node, parent, track, manual) {
44
- if (parent) {
45
- untrack(parent);
46
- }
43
+ function updateTracking(node, track, manual) {
47
44
  const existing = tracking.nodes.get(node.id);
48
45
  if (existing) {
49
46
  existing.track = existing.track || track;
@@ -68,6 +65,9 @@ function untrack(node) {
68
65
 
69
66
  const symbolDateModified = Symbol('dateModified');
70
67
  const symbolIsObservable = Symbol('isObservable');
68
+ const symbolGetNode = Symbol('getNode');
69
+ const symbolUndef = Symbol('undef');
70
+ const extraPrimitiveProps = new Map();
71
71
  exports.Tracking = void 0;
72
72
  (function (Tracking) {
73
73
  Tracking.normal = true;
@@ -78,7 +78,7 @@ const nextNodeID = { current: 0 };
78
78
  function checkTracking(node, track) {
79
79
  if (tracking.nodes) {
80
80
  if (track) {
81
- updateTracking(node, undefined, track, /*manual*/ true);
81
+ updateTracking(node, track, /*manual*/ true);
82
82
  }
83
83
  else {
84
84
  untrack(node);
@@ -90,10 +90,13 @@ function get(node, keyOrTrack, track) {
90
90
  track = keyOrTrack;
91
91
  keyOrTrack = undefined;
92
92
  }
93
+ if (keyOrTrack) {
94
+ node = getChildNode(node, keyOrTrack);
95
+ }
93
96
  // Track by default
94
97
  checkTracking(node, track === true || track === undefined ? exports.Tracking.normal : track === false ? undefined : track);
95
- const value = getOutputValue(node);
96
- return keyOrTrack ? value === null || value === void 0 ? void 0 : value[keyOrTrack] : value;
98
+ const value = getNodeValue(node);
99
+ return node.root.isPrimitive ? value.value : value;
97
100
  }
98
101
  function getNodeValue(node) {
99
102
  const arr = [];
@@ -110,13 +113,6 @@ function getNodeValue(node) {
110
113
  }
111
114
  return child;
112
115
  }
113
- function getOutputValue(node) {
114
- let value = getNodeValue(node);
115
- if (node.root.isPrimitive) {
116
- value = value.value;
117
- }
118
- return value;
119
- }
120
116
  function getChildNode(node, key) {
121
117
  var _a;
122
118
  if (isString(key)) {
@@ -147,6 +143,16 @@ function getChildNode(node, key) {
147
143
  function isObservable(obs) {
148
144
  return obs && !!obs[symbolIsObservable];
149
145
  }
146
+ function getNode(obs) {
147
+ return obs[symbolGetNode];
148
+ }
149
+ function lockObservable(obs, value) {
150
+ var _a;
151
+ const root = (_a = getNode(obs)) === null || _a === void 0 ? void 0 : _a.root;
152
+ if (root) {
153
+ root.locked = value;
154
+ }
155
+ }
150
156
  function mergeIntoObservable(target, ...sources) {
151
157
  var _a, _b;
152
158
  if (!sources.length)
@@ -234,33 +240,20 @@ function endBatch(force) {
234
240
  }
235
241
  }
236
242
 
237
- let listenerIndex = 0;
238
- function onChange(node, callback, options) {
239
- let id = listenerIndex++;
243
+ function onChange(node, callback, track) {
240
244
  let listeners = node.listeners;
241
245
  if (!listeners) {
242
- node.listeners = listeners = new Map();
243
- }
244
- if (options) {
245
- // A memory efficient way to save shallowness is to put it on the id itself
246
- if (options.shallow)
247
- id = 's' + id;
248
- else if (options.optimized)
249
- id = 'o' + id;
250
- if (options.runImmediately) {
251
- const value = getNodeValue(node);
252
- callback(value, () => value, [], value, value, node);
253
- }
246
+ node.listeners = listeners = new Set();
254
247
  }
255
- listeners.set(id, callback);
256
- return () => listeners.delete(id);
248
+ const listener = { listener: callback, track: track };
249
+ listeners.add(listener);
250
+ return () => listeners.delete(listener);
257
251
  }
258
252
 
259
253
  let lastAccessedNode;
260
254
  let lastAccessedPrimitive;
261
255
  let inSetFn = false;
262
256
  let inAssign = false;
263
- const undef = Symbol('undef');
264
257
  const ArrayModifiers = new Set([
265
258
  'copyWithin',
266
259
  'fill',
@@ -277,7 +270,7 @@ const ArrayLoopers = new Set(['every', 'some', 'filter', 'forEach', 'map']);
277
270
  const objectFns = new Map([
278
271
  ['get', get],
279
272
  ['set', set],
280
- ['ref', ref],
273
+ ['obs', obs],
281
274
  ['onChange', onChange],
282
275
  ['assign', assign],
283
276
  ['delete', deleteFn],
@@ -290,28 +283,27 @@ const wrapFn = (fn) => function (...args) {
290
283
  return fn(node, ...args);
291
284
  }
292
285
  else if (process.env.NODE_ENV === 'development') {
293
- console.error(`[legend-state] Error calling ${fn} on a primitive with value ${this}. Please ensure that if you are saving references to observable functions on primitive values that you use ref() first, like obs.primitive.ref().set.`);
286
+ console.error(`[legend-state] Error calling ${fn} on a primitive with value ${this}. Please ensure that if you are saving references to observable functions on primitive values that you use obs() first, like obs.primitive.obs().set.`);
294
287
  }
295
288
  }
296
289
  };
297
290
  const toOverride = [Number, Boolean, String];
298
- objectFns.forEach((fn, key) => {
291
+ for (let [key, fn] of objectFns) {
299
292
  for (let i = 0; i < toOverride.length; i++) {
300
293
  toOverride[i].prototype[key] = wrapFn(fn);
301
294
  }
302
- });
295
+ }
303
296
  function collectionSetter(node, target, prop, ...args) {
304
297
  const prevValue = (isArray(target) && target.slice()) || target;
305
298
  const ret = target[prop].apply(target, args);
306
299
  if (node) {
307
300
  const parent = node.parent;
308
- if (parent) {
309
- const parentValue = getNodeValue(parent);
310
- // Set the object to the previous value first
311
- parentValue[node.key] = prevValue;
312
- // Then set with the new value so it notifies with the correct prevValue
313
- setProp(parent, node.key, target);
314
- }
301
+ const key = parent ? node.key : '_';
302
+ const parentValue = parent ? getNodeValue(parent) : node.root;
303
+ // Set the object to the previous value first
304
+ parentValue[key] = prevValue;
305
+ // Then set with the new value so it notifies with the correct prevValue
306
+ setProp(parent || node, parent ? key : symbolUndef, target);
315
307
  }
316
308
  // Return the original value
317
309
  return ret;
@@ -326,14 +318,6 @@ function updateNodes(parent, obj, prevValue) {
326
318
  if (isArr && isArray(prevValue)) {
327
319
  // Construct a map of previous indices for computing move
328
320
  if ((prevValue === null || prevValue === void 0 ? void 0 : prevValue.length) > 0) {
329
- if (parent.listeners) {
330
- for (let listenerFn of parent.listeners) {
331
- // if listener is not optimized
332
- if (listenerFn[0][0] === 'o') {
333
- break;
334
- }
335
- }
336
- }
337
321
  const p = prevValue[0];
338
322
  if (p) {
339
323
  idField =
@@ -363,8 +347,7 @@ function updateNodes(parent, obj, prevValue) {
363
347
  if (!isPrimitive(prev)) {
364
348
  updateNodes(child, undefined, prev);
365
349
  }
366
- const doNotify = !!child.listeners;
367
- if (doNotify) {
350
+ if (child.listeners) {
368
351
  _notify(child, undefined, [], undefined, prev, 0);
369
352
  }
370
353
  }
@@ -418,8 +401,7 @@ function updateNodes(parent, obj, prevValue) {
418
401
  // Or if the position changed in an array whose length did not change
419
402
  // But do not notify child if the parent is an array with changing length -
420
403
  // the array's listener will cover it
421
- const doNotify = !!child.listeners;
422
- if (doNotify) {
404
+ if (child.listeners) {
423
405
  _notify(child, value, [], value, prev, 0, !isArrDiff);
424
406
  }
425
407
  }
@@ -431,7 +413,6 @@ function updateNodes(parent, obj, prevValue) {
431
413
  parent.children.set(key, child);
432
414
  }
433
415
  }
434
- // TODO: !isArrDiff should only be for optimized listeners
435
416
  // The full array does not need to re-render if the length is the same
436
417
  // So don't notify shallow listeners
437
418
  return hasADiff || didMove;
@@ -442,13 +423,9 @@ function getProxy(node, p) {
442
423
  if (p !== undefined)
443
424
  node = getChildNode(node, p);
444
425
  // Create a proxy if not already cached and return it
445
- let proxy = node.proxy;
446
- if (!proxy) {
447
- proxy = node.proxy = new Proxy(node, proxyHandler);
448
- }
449
- return proxy;
426
+ return node.proxy || (node.proxy = new Proxy(node, proxyHandler));
450
427
  }
451
- function ref(node, keyOrTrack, track) {
428
+ function obs(node, keyOrTrack, track) {
452
429
  if (isBoolean(keyOrTrack) || isSymbol(keyOrTrack)) {
453
430
  track = keyOrTrack;
454
431
  keyOrTrack = undefined;
@@ -456,25 +433,27 @@ function ref(node, keyOrTrack, track) {
456
433
  if (keyOrTrack !== undefined) {
457
434
  node = getChildNode(node, keyOrTrack);
458
435
  }
459
- // Untrack by default
460
- checkTracking(node, track === true ? exports.Tracking.normal : track === false ? undefined : track);
436
+ // Don't untrack if getting node by key
437
+ if (track !== undefined || !keyOrTrack) {
438
+ // Untrack by default
439
+ checkTracking(node, track === true ? exports.Tracking.normal : track === false ? undefined : track);
440
+ }
461
441
  return getProxy(node);
462
442
  }
463
443
  const proxyHandler = {
464
444
  get(target, p) {
445
+ var _a, _b;
465
446
  // Return true is called by isObservable()
466
447
  if (p === symbolIsObservable) {
467
448
  return true;
468
449
  }
450
+ if (p === symbolGetNode) {
451
+ return target;
452
+ }
469
453
  const node = target;
470
454
  const fn = objectFns.get(p);
471
455
  // If this is an observable function, call it
472
456
  if (fn) {
473
- if (p !== 'get' && p !== 'ref') {
474
- // Observable operations do not create listeners
475
- if (tracking.nodes)
476
- untrack(node);
477
- }
478
457
  return function (a, b, c) {
479
458
  const l = arguments.length;
480
459
  // Array call and apply are slow so micro-optimize this hot path.
@@ -500,7 +479,7 @@ const proxyHandler = {
500
479
  // Update that this node was accessed for observers
501
480
  // Listen to the array shallowly
502
481
  if (tracking.nodes) {
503
- updateTracking(node, undefined, exports.Tracking.shallow);
482
+ updateTracking(node, exports.Tracking.shallow);
504
483
  }
505
484
  return function (cbOrig, thisArg) {
506
485
  function cb(_, index, array) {
@@ -515,6 +494,12 @@ const proxyHandler = {
515
494
  }
516
495
  // Accessing primitive returns the raw value
517
496
  if (vProp === undefined || vProp === null || isPrimitive(vProp)) {
497
+ if (extraPrimitiveProps.size) {
498
+ const vPrim = extraPrimitiveProps.get(p);
499
+ if (vPrim !== undefined) {
500
+ return (_b = (_a = vPrim === null || vPrim === void 0 ? void 0 : vPrim.__fn) === null || _a === void 0 ? void 0 : _a.call(vPrim, target)) !== null && _b !== void 0 ? _b : vPrim;
501
+ }
502
+ }
518
503
  // Accessing a primitive saves the last accessed so that the observable functions
519
504
  // bound to primitives can know which node was accessed
520
505
  lastAccessedNode = node;
@@ -522,13 +507,13 @@ const proxyHandler = {
522
507
  // Update that this primitive node was accessed for observers
523
508
  if (tracking.nodes) {
524
509
  if (isArray(value) && p === 'length') {
525
- updateTracking(node, undefined, exports.Tracking.shallow);
510
+ updateTracking(node, exports.Tracking.shallow);
526
511
  }
527
512
  else if (node.root.isPrimitive) {
528
513
  updateTracking(node);
529
514
  }
530
- else {
531
- updateTracking(getChildNode(node, p), node);
515
+ else if (!isPrimitive(value)) {
516
+ updateTracking(getChildNode(node, p));
532
517
  }
533
518
  }
534
519
  return vProp;
@@ -546,7 +531,7 @@ const proxyHandler = {
546
531
  const keys = value ? Reflect.ownKeys(value) : [];
547
532
  // Update that this node was accessed for observers
548
533
  if (tracking.nodes) {
549
- updateTracking(target, undefined, exports.Tracking.shallow);
534
+ updateTracking(target, exports.Tracking.shallow);
550
535
  }
551
536
  // This is required to fix this error:
552
537
  // TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for
@@ -610,7 +595,7 @@ function set(node, keyOrNewValue, newValue) {
610
595
  return setProp(node, 'value', keyOrNewValue);
611
596
  }
612
597
  else if (!node.parent) {
613
- return setProp(node, undef, keyOrNewValue);
598
+ return setProp(node, symbolUndef, keyOrNewValue);
614
599
  }
615
600
  else {
616
601
  return setProp(node.parent, node.key, keyOrNewValue);
@@ -622,11 +607,16 @@ function setProp(node, key, newValue, level) {
622
607
  console.warn(`[legend-state] Set an HTMLElement into state. You probably don't want to do that.`);
623
608
  }
624
609
  }
625
- const isDelete = newValue === undef;
610
+ if (node.root.locked) {
611
+ throw new Error(process.env.NODE_ENV === 'development'
612
+ ? '[legend-state] Cannot modify an observable while it is locked. Please make sure that you unlock the observable before making changes.'
613
+ : '[legend-state] Modified locked observable');
614
+ }
615
+ const isDelete = newValue === symbolUndef;
626
616
  if (isDelete)
627
617
  newValue = undefined;
628
618
  inSetFn = true;
629
- const isRoot = key === undef;
619
+ const isRoot = key === symbolUndef;
630
620
  // Get the child node for updating and notifying
631
621
  let childNode = isRoot ? node : getChildNode(node, key);
632
622
  // Set operations do not create listeners
@@ -695,11 +685,12 @@ function _notify(node, value, path, valueAtPath, prevAtPath, level, whenOptimize
695
685
  if (listeners) {
696
686
  let getPrevious;
697
687
  for (let listenerFn of listeners) {
698
- const track = listenerFn[0][0];
699
- const shallow = track === 's';
700
- const optimized = track === 'o';
701
- const listener = listenerFn[1];
702
- const ok = shallow ? level <= 0 : optimized ? whenOptimizedOnlyIf && level <= 0 : true;
688
+ const { track } = listenerFn;
689
+ const ok = track === exports.Tracking.shallow
690
+ ? level <= 0
691
+ : track === exports.Tracking.optimized
692
+ ? whenOptimizedOnlyIf && level <= 0
693
+ : true;
703
694
  // Notify if listener is not shallow or if this is the first level
704
695
  if (ok) {
705
696
  // Create a function to get the previous data. Computing a clone of previous data can be expensive if doing
@@ -707,7 +698,15 @@ function _notify(node, value, path, valueAtPath, prevAtPath, level, whenOptimize
707
698
  if (!getPrevious) {
708
699
  getPrevious = createPreviousHandler(value, path, prevAtPath);
709
700
  }
710
- batchNotify({ cb: listener, value, getPrevious, path, valueAtPath, prevAtPath, node });
701
+ batchNotify({
702
+ cb: listenerFn.listener,
703
+ value,
704
+ getPrevious,
705
+ path,
706
+ valueAtPath,
707
+ prevAtPath,
708
+ node,
709
+ });
711
710
  }
712
711
  }
713
712
  }
@@ -729,9 +728,6 @@ function notify(node, value, prev, level, whenOptimizedOnlyIf) {
729
728
  _notifyParents(node, value, [], value, prev, level, whenOptimizedOnlyIf);
730
729
  }
731
730
  function assign(node, value) {
732
- // Set operations do not create listeners
733
- if (tracking.nodes)
734
- untrack(node);
735
731
  const proxy = getProxy(node);
736
732
  beginBatch();
737
733
  // Set inAssign to allow setting on safe observables
@@ -749,7 +745,7 @@ function deleteFn(node, key) {
749
745
  }
750
746
  if (!node.root.isPrimitive) {
751
747
  // delete sets to undefined first to notify
752
- setProp(node, key, undef, /*level*/ -1);
748
+ setProp(node, key, symbolUndef, /*level*/ -1);
753
749
  }
754
750
  }
755
751
  function observable(value, safe) {
@@ -794,14 +790,7 @@ function setupTracking(nodes, update) {
794
790
  // Listen to tracked nodes
795
791
  for (let tracked of nodes.values()) {
796
792
  const { node, track } = tracked;
797
- let options;
798
- if (track) {
799
- options = {
800
- shallow: track === exports.Tracking.shallow,
801
- optimized: track === exports.Tracking.optimized,
802
- };
803
- }
804
- listeners.push(onChange(node, update, options));
793
+ listeners.push(onChange(node, update, track));
805
794
  }
806
795
  return () => {
807
796
  if (listeners) {
@@ -812,19 +801,38 @@ function setupTracking(nodes, update) {
812
801
  }
813
802
  };
814
803
  }
815
- function effect(run) {
804
+ function observe(run) {
805
+ var _a;
816
806
  let cleanup;
817
807
  // Wrap it in a function so it doesn't pass all the arguments to run()
818
- const update = function () {
808
+ let update = function () {
809
+ var _a;
819
810
  if (cleanup) {
820
811
  cleanup();
821
812
  cleanup = undefined;
822
813
  }
823
814
  cleanup = run();
815
+ // Do tracing if it was requested
816
+ if (process.env.NODE_ENV === 'development') {
817
+ (_a = tracking.listeners) === null || _a === void 0 ? void 0 : _a.call(tracking, tracking.nodes);
818
+ if (tracking.updates) {
819
+ update = tracking.updates(update);
820
+ }
821
+ // Clear tracing
822
+ tracking.listeners = undefined;
823
+ tracking.updates = undefined;
824
+ }
824
825
  };
825
826
  const trackingPrev = tracking.nodes;
826
827
  tracking.nodes = new Map();
827
- cleanup = run();
828
+ update();
829
+ // Do tracing if it was requested
830
+ if (process.env.NODE_ENV === 'development') {
831
+ (_a = tracking.listeners) === null || _a === void 0 ? void 0 : _a.call(tracking, tracking.nodes);
832
+ if (tracking.updates) {
833
+ update = tracking.updates(update);
834
+ }
835
+ }
828
836
  const ret = setupTracking(tracking.nodes, update);
829
837
  tracking.nodes = trackingPrev;
830
838
  return ret;
@@ -844,7 +852,7 @@ function computed(compute) {
844
852
  obs = observable(val);
845
853
  }
846
854
  };
847
- effect(fn);
855
+ observe(fn);
848
856
  return obs;
849
857
  }
850
858
 
@@ -862,30 +870,26 @@ function event() {
862
870
  };
863
871
  }
864
872
 
865
- function when(predicate, effect$1, options) {
873
+ function when(predicate, effect) {
866
874
  let cleanup;
867
875
  let isDone = false;
868
876
  // Create a wrapping fn that calls the effect if predicate returns true
869
- const fn = function () {
877
+ function run() {
870
878
  const ret = predicate();
871
879
  if (ret) {
872
880
  // If value is truthy then run the effect and cleanup
873
- if (!(options === null || options === void 0 ? void 0 : options.repeat)) {
874
- isDone = true;
875
- }
876
- effect$1();
877
- if (isDone) {
878
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
879
- }
881
+ isDone = true;
882
+ effect();
883
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
880
884
  }
881
- };
885
+ }
882
886
  // If no effect parameter return a promise
883
- const promise = !effect$1 &&
887
+ const promise = !effect &&
884
888
  new Promise((resolve) => {
885
- effect$1 = resolve;
889
+ effect = resolve;
886
890
  });
887
891
  // Create an effect for the fn
888
- cleanup = effect(fn);
892
+ cleanup = observe(run);
889
893
  // If it's already cleanup
890
894
  if (isDone) {
891
895
  cleanup();
@@ -896,20 +900,26 @@ function when(predicate, effect$1, options) {
896
900
  exports.batch = batch;
897
901
  exports.beginBatch = beginBatch;
898
902
  exports.computed = computed;
899
- exports.effect = effect;
900
903
  exports.endBatch = endBatch;
901
904
  exports.event = event;
905
+ exports.extraPrimitiveProps = extraPrimitiveProps;
906
+ exports.getNode = getNode;
907
+ exports.getNodeValue = getNodeValue;
902
908
  exports.isArray = isArray;
903
909
  exports.isEmpty = isEmpty;
904
910
  exports.isFunction = isFunction;
905
911
  exports.isObject = isObject;
906
912
  exports.isObservable = isObservable;
907
913
  exports.isPrimitive = isPrimitive;
914
+ exports.lockObservable = lockObservable;
908
915
  exports.mergeIntoObservable = mergeIntoObservable;
909
916
  exports.observable = observable;
917
+ exports.observe = observe;
910
918
  exports.onChange = onChange;
919
+ exports.setupTracking = setupTracking;
911
920
  exports.symbolDateModified = symbolDateModified;
912
921
  exports.symbolIsObservable = symbolIsObservable;
922
+ exports.symbolUndef = symbolUndef;
913
923
  exports.tracking = tracking;
914
924
  exports.when = when;
915
925
  //# sourceMappingURL=index.js.map