@my-react/react-reconciler-compact 0.0.10 → 0.0.11

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.
@@ -1016,13 +1016,8 @@ function requireIndex_development_1 () {
1016
1016
  var renderDispatch = getCurrentDispatchFromFiber(fiber);
1017
1017
  safeCallWithCurrentFiber({
1018
1018
  fiber: fiber,
1019
- action: function safeCallFiberWarnListener() {
1020
- var _a, _b;
1021
- try {
1022
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberWarn) === null || _b === void 0 ? void 0 : _b.forEach(function (listener) { return listener.apply(void 0, __spreadArray([fiber], args, false)); });
1023
- }
1024
- catch (_c) {
1025
- }
1019
+ action: function () {
1020
+ renderDispatch.callOnFiberWarn.apply(renderDispatch, __spreadArray([fiber], args, false));
1026
1021
  },
1027
1022
  });
1028
1023
  };
@@ -1034,13 +1029,8 @@ function requireIndex_development_1 () {
1034
1029
  var renderDispatch = getCurrentDispatchFromFiber(fiber);
1035
1030
  safeCallWithCurrentFiber({
1036
1031
  fiber: fiber,
1037
- action: function safeCallFiberErrorListener() {
1038
- var _a, _b;
1039
- try {
1040
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberError) === null || _b === void 0 ? void 0 : _b.forEach(function (listener) { return listener.apply(void 0, __spreadArray([fiber], args, false)); });
1041
- }
1042
- catch (_c) {
1043
- }
1032
+ action: function () {
1033
+ renderDispatch.callOnFiberError.apply(renderDispatch, __spreadArray([fiber], args, false));
1044
1034
  },
1045
1035
  });
1046
1036
  };
@@ -2043,8 +2033,7 @@ function requireIndex_development_1 () {
2043
2033
  safeCallWithCurrentFiber({
2044
2034
  fiber: nextFiber,
2045
2035
  action: function safeCallAfterFiberDone() {
2046
- var _a, _b;
2047
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.afterFiberDone) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(nextFiber); });
2036
+ renderDispatch.callOnAfterFiberDone(nextFiber);
2048
2037
  },
2049
2038
  });
2050
2039
  }
@@ -2097,8 +2086,7 @@ function requireIndex_development_1 () {
2097
2086
  safeCallWithCurrentFiber({
2098
2087
  fiber: nextFiber,
2099
2088
  action: function safeCallAfterFiberDone() {
2100
- var _a, _b;
2101
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.afterFiberDone) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(nextFiber); });
2089
+ renderDispatch.callOnAfterFiberDone(nextFiber);
2102
2090
  },
2103
2091
  });
2104
2092
  }
@@ -2368,8 +2356,7 @@ function requireIndex_development_1 () {
2368
2356
  safeCallWithCurrentFiber({
2369
2357
  fiber: fiber,
2370
2358
  action: function safeCallFiberUpdateListener() {
2371
- var _a, _b;
2372
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberUpdate) === null || _b === void 0 ? void 0 : _b.forEach(function (listener) { return listener(fiber); });
2359
+ renderDispatch.callOnFiberUpdate(fiber);
2373
2360
  },
2374
2361
  });
2375
2362
  };
@@ -2576,8 +2563,7 @@ function requireIndex_development_1 () {
2576
2563
  safeCallWithCurrentFiber({
2577
2564
  fiber: fiber,
2578
2565
  action: function safeCallInstanceInitialListener() {
2579
- var _a, _b;
2580
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.instanceInitial) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(instance, fiber); });
2566
+ renderDispatch.callOnInstanceInitial(instance, fiber);
2581
2567
  },
2582
2568
  });
2583
2569
  Object.freeze(instance.state);
@@ -2595,8 +2581,7 @@ function requireIndex_development_1 () {
2595
2581
  safeCallWithCurrentFiber({
2596
2582
  fiber: fiber,
2597
2583
  action: function safeCallInstanceUpdateListener() {
2598
- var _a, _b;
2599
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.instanceUpdate) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(typedInstance, fiber); });
2584
+ renderDispatch.callOnInstanceUpdate(typedInstance, fiber);
2600
2585
  },
2601
2586
  });
2602
2587
  setOwnerForInstance(typedInstance, fiber);
@@ -2879,8 +2864,7 @@ function requireIndex_development_1 () {
2879
2864
  safeCallWithCurrentFiber({
2880
2865
  fiber: fiber,
2881
2866
  action: function safeCallInstanceUnmountListener() {
2882
- var _a, _b;
2883
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.instanceUnmount) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(typedInstance, fiber); });
2867
+ renderDispatch.callOnInstanceUnmount(typedInstance, fiber);
2884
2868
  },
2885
2869
  });
2886
2870
  safeCallWithCurrentFiber({
@@ -3639,8 +3623,7 @@ function requireIndex_development_1 () {
3639
3623
  safeCallWithCurrentFiber({
3640
3624
  fiber: ownerFiber,
3641
3625
  action: function safeCallFiberStateListener() {
3642
- var _a, _b;
3643
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberState) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(ownerFiber, _params); });
3626
+ renderDispatch.callOnFiberState(ownerFiber, _params);
3644
3627
  },
3645
3628
  });
3646
3629
  var isImmediate = _params.isImmediate;
@@ -3681,8 +3664,7 @@ function requireIndex_development_1 () {
3681
3664
  safeCallWithCurrentFiber({
3682
3665
  fiber: ownerFiber,
3683
3666
  action: function safeCallInstanceStateListener() {
3684
- var _a, _b;
3685
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.instanceState) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(trigger_1, ownerFiber, _params); });
3667
+ renderDispatch.callOnInstanceState(trigger_1, ownerFiber, _params);
3686
3668
  },
3687
3669
  });
3688
3670
  ownerFiber.updateQueue = ownerFiber.updateQueue || new myreactSharedExports.ListTree();
@@ -3725,8 +3707,7 @@ function requireIndex_development_1 () {
3725
3707
  safeCallWithCurrentFiber({
3726
3708
  fiber: ownerFiber,
3727
3709
  action: function safeCallHookStateListener() {
3728
- var _a, _b;
3729
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.hookState) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(trigger_2, ownerFiber, _params); });
3710
+ renderDispatch.callOnHookState(trigger_2, ownerFiber, _params);
3730
3711
  },
3731
3712
  });
3732
3713
  ownerFiber.updateQueue = ownerFiber.updateQueue || new myreactSharedExports.ListTree();
@@ -3962,7 +3943,6 @@ function requireIndex_development_1 () {
3962
3943
 
3963
3944
  var globalLoop$2 = react.__my_react_internal__.globalLoop, currentScheduler$a = react.__my_react_internal__.currentScheduler;
3964
3945
  var scheduleUpdateFromRoot = function (renderDispatch) {
3965
- var _a, _b, _c, _d;
3966
3946
  flushEffectCallback();
3967
3947
  var allLive = renderDispatch.pendingUpdateFiberArray.getAll().filter(function (f) { return myreactSharedExports.exclude(f.state, myreactSharedExports.STATE_TYPE.__unmount__); });
3968
3948
  renderDispatch.pendingUpdateFiberArray.clear();
@@ -3973,14 +3953,18 @@ function requireIndex_development_1 () {
3973
3953
  allLive.forEach(function (fiber) { return applyTriggerFiberCb(renderDispatch, fiber); });
3974
3954
  if (!renderDispatch.enableConcurrentMode || allLive.some(function (f) { return myreactSharedExports.include(f.state, myreactSharedExports.STATE_TYPE.__triggerSync__ | myreactSharedExports.STATE_TYPE.__triggerSyncForce__); })) {
3975
3955
  {
3976
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.beforeDispatchUpdate) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(renderDispatch, allLive); });
3956
+ safeCall(function safeCallBeforeDispatchUpdate() {
3957
+ renderDispatch.callOnBeforeDispatchUpdate(renderDispatch, allLive);
3958
+ });
3977
3959
  }
3978
3960
  updateSyncFromRoot(renderDispatch);
3979
3961
  }
3980
3962
  else {
3981
3963
  renderDispatch.resetYield();
3982
3964
  {
3983
- (_d = (_c = listenerMap.get(renderDispatch)) === null || _c === void 0 ? void 0 : _c.beforeDispatchUpdate) === null || _d === void 0 ? void 0 : _d.forEach(function (cb) { return cb(renderDispatch, allLive); });
3965
+ safeCall(function safeCallBeforeDispatchUpdate() {
3966
+ renderDispatch.callOnBeforeDispatchUpdate(renderDispatch, allLive);
3967
+ });
3984
3968
  }
3985
3969
  updateConcurrentFromRoot(renderDispatch);
3986
3970
  }
@@ -4037,20 +4021,20 @@ function requireIndex_development_1 () {
4037
4021
  var globalLoop$1 = react.__my_react_internal__.globalLoop, currentScheduler$9 = react.__my_react_internal__.currentScheduler;
4038
4022
  var enableScopeTreeLog$3 = react.__my_react_shared__.enableScopeTreeLog;
4039
4023
  function finishUpdateSyncFromRoot(renderDispatch) {
4040
- var _a, _b;
4041
4024
  var commitList = renderDispatch.pendingCommitFiberList;
4042
4025
  var changedList = renderDispatch.pendingChangedFiberList;
4043
4026
  renderDispatch.resetUpdateFlowRuntimeFiber();
4044
4027
  renderDispatch.pendingCommitFiberList = null;
4045
4028
  renderDispatch.pendingChangedFiberList = null;
4046
4029
  enableScopeTreeLog$3.current && setLogScope();
4047
- (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList);
4030
+ (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList, true);
4048
4031
  enableScopeTreeLog$3.current && resetLogScope();
4049
- ((_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.afterDispatchUpdate) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(renderDispatch); }));
4032
+ safeCall(function safeCallAfterDispatchUpdate() {
4033
+ renderDispatch.callOnAfterDispatchUpdate(renderDispatch);
4034
+ });
4050
4035
  (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
4051
4036
  safeCall(function safeCallFiberHasChangeListener() {
4052
- var _a, _b;
4053
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberHasChange) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(changedList); });
4037
+ renderDispatch.callOnFiberChange(changedList);
4054
4038
  });
4055
4039
  }
4056
4040
  var updateSyncFromRoot = function (renderDispatch) {
@@ -4067,7 +4051,6 @@ function requireIndex_development_1 () {
4067
4051
  });
4068
4052
  };
4069
4053
  function finishUpdateConcurrentFromRoot(renderDispatch) {
4070
- var _a, _b;
4071
4054
  var commitList = renderDispatch.pendingCommitFiberList;
4072
4055
  var changedList = renderDispatch.pendingChangedFiberList;
4073
4056
  renderDispatch.resetUpdateFlowRuntimeFiber();
@@ -4076,11 +4059,12 @@ function requireIndex_development_1 () {
4076
4059
  enableScopeTreeLog$3.current && setLogScope();
4077
4060
  (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList);
4078
4061
  enableScopeTreeLog$3.current && setLogScope();
4079
- ((_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.afterDispatchUpdate) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(renderDispatch); }));
4062
+ safeCall(function safeCallAfterDispatchUpdate() {
4063
+ renderDispatch.callOnAfterDispatchUpdate(renderDispatch);
4064
+ });
4080
4065
  (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
4081
4066
  safeCall(function safeCallFiberHasChangeListener() {
4082
- var _a, _b;
4083
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberHasChange) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(changedList); });
4067
+ renderDispatch.callOnFiberChange(changedList);
4084
4068
  });
4085
4069
  }
4086
4070
  function checkNextFiberIsSync(renderDispatch) {
@@ -4696,8 +4680,7 @@ function requireIndex_development_1 () {
4696
4680
  safeCallWithCurrentFiber({
4697
4681
  fiber: fiber,
4698
4682
  action: function safeCallHookUnmountListener() {
4699
- var _a, _b;
4700
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.hookUnmount) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(hookNode, fiber); });
4683
+ renderDispatch.callOnHookUnmount(hookNode, fiber);
4701
4684
  },
4702
4685
  });
4703
4686
  safeCallWithCurrentFiber({
@@ -4754,8 +4737,7 @@ function requireIndex_development_1 () {
4754
4737
  safeCallWithCurrentFiber({
4755
4738
  fiber: fiber,
4756
4739
  action: function safeCallFiberHMRListener() {
4757
- var _a, _b;
4758
- (_b = (_a = listenerMap.get(renderDispatch_1)) === null || _a === void 0 ? void 0 : _a.fiberHMR) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(fiber, forceRefresh); });
4740
+ renderDispatch_1.callOnFiberHMR(fiber, forceRefresh);
4759
4741
  },
4760
4742
  });
4761
4743
  return fiber;
@@ -4812,8 +4794,7 @@ function requireIndex_development_1 () {
4812
4794
  safeCallWithCurrentFiber({
4813
4795
  fiber: fiber,
4814
4796
  action: function safeCallFiberTriggerListener() {
4815
- var _a, _b;
4816
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberTrigger) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(fiber, updateState); });
4797
+ renderDispatch.callOnFiberTrigger(fiber, updateState);
4817
4798
  },
4818
4799
  });
4819
4800
  // TODO get from updateState ?
@@ -4985,8 +4966,7 @@ function requireIndex_development_1 () {
4985
4966
  safeCallWithCurrentFiber({
4986
4967
  fiber: newFiberNode,
4987
4968
  action: function safeCallFiberInitialListener() {
4988
- var _a, _b;
4989
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberInitial) === null || _b === void 0 ? void 0 : _b.forEach(function (listener) { return listener(newFiberNode); });
4969
+ renderDispatch.callOnFiberInitial(newFiberNode);
4990
4970
  },
4991
4971
  });
4992
4972
  if (myreactSharedExports.exclude(newFiberNode.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -5065,8 +5045,7 @@ function requireIndex_development_1 () {
5065
5045
  safeCallWithCurrentFiber({
5066
5046
  fiber: fiber,
5067
5047
  action: function safeCallFiberInitialListener() {
5068
- var _a, _b;
5069
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberInitial) === null || _b === void 0 ? void 0 : _b.forEach(function (listener) { return listener(fiber); });
5048
+ renderDispatch.callOnFiberInitial(fiber);
5070
5049
  },
5071
5050
  });
5072
5051
  if (myreactSharedExports.exclude(fiber.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -5104,8 +5083,7 @@ function requireIndex_development_1 () {
5104
5083
  safeCallWithCurrentFiber({
5105
5084
  fiber: fiber,
5106
5085
  action: function safeCallFiberUnmountListener() {
5107
- var _a, _b;
5108
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberUnmount) === null || _b === void 0 ? void 0 : _b.forEach(function (listener) { return listener(fiber); });
5086
+ renderDispatch.callOnFiberUnmount(fiber);
5109
5087
  },
5110
5088
  });
5111
5089
  renderDispatch.runtimeMap.insertionEffectMap.delete(fiber);
@@ -5518,6 +5496,28 @@ function requireIndex_development_1 () {
5518
5496
  }
5519
5497
  };
5520
5498
 
5499
+ var initSuspenseInstance = function (instance) {
5500
+ var field = getInstanceFieldByInstance(instance);
5501
+ if (!field)
5502
+ throw new Error("[@my-react/react] can not get field for instance, this is a bug for @my-react");
5503
+ var typedField = field;
5504
+ typedField.isHidden = false;
5505
+ typedField.asyncLoadList = new myreactSharedExports.UniqueArray();
5506
+ };
5507
+
5508
+ var MyReactInternalInstance$2 = react.__my_react_internal__.MyReactInternalInstance;
5509
+ var processSuspense = function (fiber) {
5510
+ var isUpdate = !!fiber.instance;
5511
+ fiber.instance = fiber.instance || new MyReactInternalInstance$2();
5512
+ !isUpdate && initInstance(fiber.instance);
5513
+ !isUpdate && initVisibleInstance(fiber.instance);
5514
+ !isUpdate && initSuspenseInstance(fiber.instance);
5515
+ !isUpdate && setOwnerForInstance(fiber.instance, fiber);
5516
+ var instanceField = getInstanceFieldByInstance(fiber.instance);
5517
+ var children = WrapperBySuspenseScope(instanceField.isHidden ? fiber.pendingProps.fallback : fiber.pendingProps.children);
5518
+ return children;
5519
+ };
5520
+
5521
5521
  var MyReactInternalInstanceClass$1 = react.__my_react_internal__.MyReactInternalInstance, instanceToInitialFieldMap = react.__my_react_internal__.instanceToInitialFieldMap;
5522
5522
  // support private instance field
5523
5523
  var instanceMap = instanceToInitialFieldMap;
@@ -5632,7 +5632,7 @@ function requireIndex_development_1 () {
5632
5632
  });
5633
5633
  }
5634
5634
 
5635
- var currentComponentFiber$1 = react.__my_react_internal__.currentComponentFiber, MyReactInternalInstance$2 = react.__my_react_internal__.MyReactInternalInstance;
5635
+ var currentComponentFiber$1 = react.__my_react_internal__.currentComponentFiber, MyReactInternalInstance$1 = react.__my_react_internal__.MyReactInternalInstance;
5636
5636
  var enablePerformanceLog = react.__my_react_shared__.enablePerformanceLog, enableDebugFiled$2 = react.__my_react_shared__.enableDebugFiled;
5637
5637
  var nextWorkCommon = function (renderDispatch, fiber, children) {
5638
5638
  if (myreactSharedExports.isPromise(children)) {
@@ -5709,7 +5709,7 @@ function requireIndex_development_1 () {
5709
5709
  };
5710
5710
  var nextWorkRoot = function (renderDispatch, fiber) {
5711
5711
  var isUpdate = !!fiber.instance;
5712
- fiber.instance = fiber.instance || new MyReactInternalInstance$2();
5712
+ fiber.instance = fiber.instance || new MyReactInternalInstance$1();
5713
5713
  !isUpdate && initInstance(fiber.instance);
5714
5714
  !isUpdate && initVisibleInstance(fiber.instance);
5715
5715
  !isUpdate && setOwnerForInstance(fiber.instance, fiber);
@@ -5728,8 +5728,7 @@ function requireIndex_development_1 () {
5728
5728
  safeCallWithCurrentFiber({
5729
5729
  fiber: fiber,
5730
5730
  action: function safeCallFiberRunListener() {
5731
- var _a, _b;
5732
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.beforeFiberRun) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(fiber); });
5731
+ renderDispatch.callOnBeforeFiberRun(fiber);
5733
5732
  },
5734
5733
  });
5735
5734
  setRefreshTypeMap(fiber);
@@ -5746,8 +5745,7 @@ function requireIndex_development_1 () {
5746
5745
  safeCallWithCurrentFiber({
5747
5746
  fiber: fiber,
5748
5747
  action: function safeCallPerformanceWarnListener() {
5749
- var _a, _b;
5750
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.performanceWarn) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(fiber); });
5748
+ renderDispatch.callOnPerformanceWarn(fiber, renderTime);
5751
5749
  },
5752
5750
  });
5753
5751
  }
@@ -5778,150 +5776,585 @@ function requireIndex_development_1 () {
5778
5776
  safeCallWithCurrentFiber({
5779
5777
  fiber: fiber,
5780
5778
  action: function safeCallFiberRunListener() {
5781
- var _a, _b;
5782
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.afterFiberRun) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(fiber); });
5779
+ renderDispatch.callOnAfterFiberRun(fiber);
5783
5780
  },
5784
5781
  });
5785
5782
  };
5786
5783
 
5787
- var initSuspenseInstance = function (instance) {
5788
- var field = getInstanceFieldByInstance(instance);
5789
- if (!field)
5790
- throw new Error("[@my-react/react] can not get field for instance, this is a bug for @my-react");
5791
- var typedField = field;
5792
- typedField.isHidden = false;
5793
- typedField.asyncLoadList = new myreactSharedExports.UniqueArray();
5784
+ var enableDebugFiled$1 = react.__my_react_shared__.enableDebugFiled;
5785
+ var currentRunningFiber = react.__my_react_internal__.currentRunningFiber, MyReactInternalInstance = react.__my_react_internal__.MyReactInternalInstance;
5786
+ var defaultGetContextValue = function (fiber, ContextObject) {
5787
+ var _a;
5788
+ if (fiber) {
5789
+ return fiber.pendingProps["value"];
5790
+ }
5791
+ else {
5792
+ return (_a = ContextObject === null || ContextObject === void 0 ? void 0 : ContextObject.Provider) === null || _a === void 0 ? void 0 : _a["value"];
5793
+ }
5794
5794
  };
5795
-
5796
- var MyReactInternalInstance$1 = react.__my_react_internal__.MyReactInternalInstance;
5797
- var processSuspense = function (fiber) {
5795
+ var defaultGetContextFiber = function (fiber, ContextObject) {
5796
+ if ((fiber === null || fiber === void 0 ? void 0 : fiber.parent) && ContextObject) {
5797
+ var parent_1 = fiber.parent;
5798
+ while (parent_1) {
5799
+ if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__provider__)) {
5800
+ var typedElementType = parent_1.elementType;
5801
+ var contextObj = typedElementType["Context"];
5802
+ if (contextObj === ContextObject) {
5803
+ return parent_1;
5804
+ }
5805
+ }
5806
+ if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__context__)) {
5807
+ var typedElementType = parent_1.elementType;
5808
+ var contextObj = typedElementType;
5809
+ if (contextObj === ContextObject) {
5810
+ return parent_1;
5811
+ }
5812
+ }
5813
+ parent_1 = parent_1.parent;
5814
+ }
5815
+ }
5816
+ else {
5817
+ return null;
5818
+ }
5819
+ };
5820
+ var defaultReadContext = function (Context) {
5821
+ var fiber = currentRunningFiber.current;
5822
+ if (!Context) {
5823
+ throw new Error("the Context what you read is not exist");
5824
+ }
5825
+ if (!fiber) {
5826
+ throw new Error('current environment is not support "readContext"');
5827
+ }
5798
5828
  var isUpdate = !!fiber.instance;
5799
- fiber.instance = fiber.instance || new MyReactInternalInstance$1();
5829
+ fiber.instance = fiber.instance || new MyReactInternalInstance();
5800
5830
  !isUpdate && initInstance(fiber.instance);
5801
- !isUpdate && initVisibleInstance(fiber.instance);
5802
- !isUpdate && initSuspenseInstance(fiber.instance);
5803
5831
  !isUpdate && setOwnerForInstance(fiber.instance, fiber);
5804
- var instanceField = getInstanceFieldByInstance(fiber.instance);
5805
- var children = WrapperBySuspenseScope(instanceField.isHidden ? fiber.pendingProps.fallback : fiber.pendingProps.children);
5806
- return children;
5832
+ var contextFiber = defaultGetContextFiber(fiber, Context);
5833
+ setSubscribeForInstance(fiber.instance, contextFiber);
5834
+ return defaultGetContextValue(contextFiber, Context);
5807
5835
  };
5808
-
5809
- var Dispatcher = react.__my_react_internal__.Dispatcher, MyReactInternalInstanceClass = react.__my_react_internal__.MyReactInternalInstance, dispatchToListenerMap = react.__my_react_internal__.dispatchToListenerMap;
5810
- var getInitialListeners = function () {
5811
- return {
5812
- fiberInitial: new Set(),
5813
- fiberUpdate: new Set(),
5814
- fiberHasChange: new Set(),
5815
- fiberUnmount: new Set(),
5816
- fiberHMR: new Set(),
5817
- beforeFiberRun: new Set(),
5818
- afterFiberRun: new Set(),
5819
- afterFiberDone: new Set(),
5820
- beforeDispatchRender: new Set(),
5821
- afterDispatchRender: new Set(),
5822
- fiberWarn: new Set(),
5823
- fiberError: new Set(),
5824
- fiberState: new Set(),
5825
- fiberTrigger: new Set(),
5826
- performanceWarn: new Set(),
5827
- instanceInitial: new Set(),
5828
- instanceUpdate: new Set(),
5829
- instanceState: new Set(),
5830
- instanceUnmount: new Set(),
5831
- hookInitial: new Set(),
5832
- hookUpdate: new Set(),
5833
- hookState: new Set(),
5834
- hookUnmount: new Set(),
5835
- beforeCommitMount: new Set(),
5836
- afterCommitMount: new Set(),
5837
- beforeCommitUpdate: new Set(),
5838
- afterCommitUpdate: new Set(),
5839
- beforeCommitUnmount: new Set(),
5840
- afterCommitUnmount: new Set(),
5836
+ var prepareUpdateAllDependence = function (renderDispatch, fiber, beforeValue, afterValue) {
5837
+ var consumerList = new Set((fiber === null || fiber === void 0 ? void 0 : fiber.dependence) || []);
5838
+ consumerList.forEach(function prepareUpdateSingleConsumer(i) {
5839
+ var owner = getInstanceOwnerFiber(i);
5840
+ if (owner && myreactSharedExports.exclude(owner.state, myreactSharedExports.STATE_TYPE.__unmount__)) {
5841
+ var typedFiber_1 = owner;
5842
+ typedFiber_1.state = myreactSharedExports.STATE_TYPE.__triggerSyncForce__;
5841
5843
  }
5842
- ;
5843
- };
5844
- var getInitialMap = function () { return ({
5845
- effectMap: new MyWeakMap(),
5846
- layoutEffectMap: new MyWeakMap(),
5847
- insertionEffectMap: new MyWeakMap(),
5848
- unmountMap: new MyWeakMap(),
5849
- eventMap: new MyWeakMap(),
5850
- triggerCallbackMap: new MyWeakMap(),
5851
- }); };
5852
- var getInitialFiber = function () { return ({
5853
- scheduledFiber: null,
5854
- errorCatchFiber: null,
5855
- nextWorkingFiber: null,
5856
- retriggerFiber: null,
5857
- }); };
5858
- var initialRef = {
5859
- typeForRef: exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__class__,
5860
- typeForCreate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5861
- typeForUpdate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5862
- typeForAppend: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5863
- typeForNativeNode: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5864
- };
5865
- var listenerMap = dispatchToListenerMap;
5866
- var RenderDispatchEvent = /** @class */ (function (_super) {
5867
- __extends(RenderDispatchEvent, _super);
5868
- function RenderDispatchEvent() {
5869
- var _this = _super.call(this) || this;
5870
- _this.dispatcher = Dispatcher;
5871
- _this.runtimeRef = initialRef;
5872
- _this.runtimeMap = getInitialMap();
5873
- _this.runtimeFiber = getInitialFiber();
5874
- listenerMap.set(_this, getInitialListeners());
5875
- initInstance(_this);
5876
- initVisibleInstance(_this);
5877
- initSuspenseInstance(_this);
5878
- Object.defineProperty(_this, "dispatcher", {
5879
- value: Dispatcher,
5880
- writable: false,
5881
- enumerable: false,
5882
- configurable: false,
5883
- });
5884
- return _this;
5885
- }
5886
- RenderDispatchEvent.prototype.getFiberTree = function (_fiber) {
5887
- throw new Error("Method not implemented.");
5888
- };
5889
- RenderDispatchEvent.prototype.readPromise = function (_params) {
5890
- throw new Error("Method not implemented.");
5891
- };
5892
- RenderDispatchEvent.prototype.readContext = function (_params) {
5893
- throw new Error("Method not implemented.");
5894
- };
5895
- RenderDispatchEvent.prototype.dispatchHook = function (_params) {
5896
- throw new Error("Method not implemented.");
5897
- };
5898
- RenderDispatchEvent.prototype.dispatchState = function (_params) {
5899
- throw new Error("Method not implemented.");
5900
- };
5901
- RenderDispatchEvent.prototype.dispatchError = function (_params) {
5902
- throw new Error("Method not implemented.");
5903
- };
5904
- RenderDispatchEvent.prototype.dispatchPromise = function (_params) {
5905
- throw new Error("Method not implemented.");
5906
- };
5907
- RenderDispatchEvent.prototype.dispatchSuspensePromise = function (_params) {
5908
- throw new Error("Method not implemented.");
5844
+ });
5845
+ var typedFiber = fiber;
5846
+ var processedNodes = [];
5847
+ var updater = {
5848
+ type: myreactSharedExports.UpdateQueueType.context,
5849
+ trigger: fiber,
5850
+ payLoad: afterValue,
5851
+ isSync: true,
5852
+ isForce: true,
5853
+ isImmediate: true,
5854
+ isRetrigger: true,
5909
5855
  };
5910
- RenderDispatchEvent.prototype.trigger = function (_fiber, _state, cb) {
5911
- return triggerUpdateOnFiber(_fiber, _state, cb);
5856
+ if (enableDebugFiled$1.current) {
5857
+ var now = Date.now();
5858
+ updater._debugBeforeValue = beforeValue;
5859
+ updater._debugAfterValue = afterValue;
5860
+ updater._debugCreateTime = now;
5861
+ updater._debugRunTime = now;
5862
+ updater._debugType = myreactSharedExports.UpdateQueueType[myreactSharedExports.UpdateQueueType.context];
5863
+ if (enableDebugUpdateQueue.current) {
5864
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new myreactSharedExports.ListTree();
5865
+ typedFiber._debugUpdateQueue.push(updater);
5866
+ }
5867
+ }
5868
+ processedNodes.push(updater);
5869
+ var updateState = {
5870
+ needUpdate: true,
5871
+ nodes: processedNodes,
5872
+ isSync: true,
5873
+ isForce: true,
5874
+ isImmediate: true,
5875
+ isRetrigger: true,
5912
5876
  };
5913
- RenderDispatchEvent.prototype.generateCommitList = function (_fiber) { };
5914
- RenderDispatchEvent.prototype.pendingCreate = function (_fiber) { };
5915
- RenderDispatchEvent.prototype.pendingUpdate = function (_fiber) { };
5916
- RenderDispatchEvent.prototype.pendingAppend = function (_fiber) { };
5917
- RenderDispatchEvent.prototype.pendingPosition = function (_fiber) { };
5918
- RenderDispatchEvent.prototype.pendingRef = function (_fiber) { };
5919
- RenderDispatchEvent.prototype.pendingUnmount = function (_fiber, _pendingUnmount) { };
5920
- RenderDispatchEvent.prototype.pendingEffect = function (_fiber, _effect, _option) { };
5921
- RenderDispatchEvent.prototype.pendingLayoutEffect = function (_fiber, _layoutEffect, _option) { };
5922
- RenderDispatchEvent.prototype.pendingInsertionEffect = function (_fiber, _insertionEffect, _option) { };
5923
- RenderDispatchEvent.prototype.dispatchFiber = function (_fiber) { };
5924
- RenderDispatchEvent.prototype.processLazy = function (_elementType) {
5877
+ safeCallWithCurrentFiber({
5878
+ fiber: fiber,
5879
+ action: function safeCallFiberTriggerListener() {
5880
+ renderDispatch.callOnFiberTrigger(fiber, updateState);
5881
+ },
5882
+ });
5883
+ };
5884
+
5885
+ var currentScheduler$2 = react.__my_react_internal__.currentScheduler;
5886
+ var enableScopeTreeLog$2 = react.__my_react_shared__.enableScopeTreeLog;
5887
+ // TODO improve
5888
+ var defaultDispatchMountLatest = function (_dispatch, _fiber) {
5889
+ beforeSyncUpdate();
5890
+ var _list = generateFiberToListWithAction(_fiber, function invokeUnmountPendingList(_fiber) {
5891
+ defaultInvokeUnmountList(_dispatch, _fiber);
5892
+ });
5893
+ _list.listToFoot(function invokeInsertionEffectList(_fiber) {
5894
+ insertionEffect(_dispatch, _fiber);
5895
+ });
5896
+ afterSyncUpdate();
5897
+ _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
5898
+ safeCallWithCurrentFiber({
5899
+ fiber: _fiber,
5900
+ action: function safeCallCreateAndUpdate() {
5901
+ _dispatch.commitCreate(_fiber);
5902
+ _dispatch.commitUpdate(_fiber);
5903
+ },
5904
+ });
5905
+ });
5906
+ _list.listToFoot(function invokeAppendList(_fiber) {
5907
+ safeCallWithCurrentFiber({
5908
+ fiber: _fiber,
5909
+ action: function safeCallAppendList() {
5910
+ _dispatch.commitAppend(_fiber);
5911
+ },
5912
+ });
5913
+ });
5914
+ _list.listToFoot(function invokeSetRefList(_fiber) {
5915
+ safeCallWithCurrentFiber({
5916
+ fiber: _fiber,
5917
+ action: function safeCallSetRefList() {
5918
+ _dispatch.commitSetRef(_fiber);
5919
+ },
5920
+ });
5921
+ });
5922
+ beforeSyncUpdate();
5923
+ _list.listToFoot(function invokeLayoutEffectList(_fiber) {
5924
+ layoutEffect(_dispatch, _fiber);
5925
+ });
5926
+ afterSyncUpdate();
5927
+ function invokeEffectListTask() {
5928
+ enableScopeTreeLog$2.current && setLogScope();
5929
+ _list.listToFoot(function invokeEffectList(_fiber) {
5930
+ effect(_dispatch, _fiber);
5931
+ });
5932
+ enableScopeTreeLog$2.current && resetLogScope();
5933
+ }
5934
+ addEffectCallback(invokeEffectListTask);
5935
+ var renderScheduler = currentScheduler$2.current;
5936
+ if (_dispatch.enableConcurrentMode) {
5937
+ renderScheduler.macroTask(function flushEffect() {
5938
+ flushEffectCallback();
5939
+ });
5940
+ }
5941
+ else {
5942
+ renderScheduler.microTask(function flushEffect() {
5943
+ flushEffectCallback();
5944
+ });
5945
+ }
5946
+ };
5947
+ var defaultDispatchMount = defaultDispatchMountLatest;
5948
+
5949
+ var defaultResolveScope = function (fiber) {
5950
+ var parent = fiber.parent;
5951
+ while (parent) {
5952
+ if (myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scope__) || myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scopeSuspense__)) {
5953
+ return parent;
5954
+ }
5955
+ parent = parent.parent;
5956
+ }
5957
+ return null;
5958
+ };
5959
+
5960
+ var enableDebugFiled = react.__my_react_shared__.enableDebugFiled;
5961
+ var defaultGenerateStrict = function (fiber) {
5962
+ {
5963
+ var parent_1 = fiber.parent;
5964
+ var isStrict = false;
5965
+ var typedParent = parent_1;
5966
+ if (parent_1) {
5967
+ if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__strict__)) {
5968
+ isStrict = true;
5969
+ }
5970
+ if (typedParent._debugStrict) {
5971
+ isStrict = true;
5972
+ }
5973
+ }
5974
+ if (enableDebugFiled.current) {
5975
+ var typedFiber = fiber;
5976
+ typedFiber._debugStrict = isStrict;
5977
+ }
5978
+ return isStrict;
5979
+ }
5980
+ };
5981
+
5982
+ var currentScheduler$1 = react.__my_react_internal__.currentScheduler;
5983
+ var enableScopeTreeLog$1 = react.__my_react_shared__.enableScopeTreeLog;
5984
+ var defaultDispatchUpdate = function (_dispatch, _list, sync) {
5985
+ // TODO maybe need call `insertionEffect` in another function
5986
+ beforeSyncUpdate();
5987
+ _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
5988
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5989
+ defaultInvokeUnmountList(_dispatch, _fiber);
5990
+ }
5991
+ });
5992
+ _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
5993
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5994
+ insertionEffect(_dispatch, _fiber);
5995
+ }
5996
+ });
5997
+ afterSyncUpdate();
5998
+ _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
5999
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6000
+ safeCallWithCurrentFiber({
6001
+ fiber: _fiber,
6002
+ action: function safeCallCreateAndUpdate() {
6003
+ _dispatch.commitCreate(_fiber);
6004
+ _dispatch.commitUpdate(_fiber);
6005
+ },
6006
+ });
6007
+ }
6008
+ });
6009
+ _list.listToHead(function invokePositionList(_fiber) {
6010
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6011
+ safeCallWithCurrentFiber({
6012
+ fiber: _fiber,
6013
+ action: function safeCallPosition() {
6014
+ _dispatch.commitPosition(_fiber);
6015
+ },
6016
+ });
6017
+ }
6018
+ });
6019
+ _list.listToFoot(function invokeAppendList(_fiber) {
6020
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6021
+ safeCallWithCurrentFiber({
6022
+ fiber: _fiber,
6023
+ action: function safeCallAppendList() {
6024
+ _dispatch.commitAppend(_fiber);
6025
+ },
6026
+ });
6027
+ }
6028
+ });
6029
+ _list.listToFoot(function invokeSetRefList(_fiber) {
6030
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6031
+ safeCallWithCurrentFiber({
6032
+ fiber: _fiber,
6033
+ action: function safeCallSetRefList() {
6034
+ _dispatch.commitSetRef(_fiber);
6035
+ },
6036
+ });
6037
+ }
6038
+ });
6039
+ beforeSyncUpdate();
6040
+ _list.listToFoot(function invokeLayoutEffectList(_fiber) {
6041
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6042
+ layoutEffect(_dispatch, _fiber);
6043
+ }
6044
+ });
6045
+ afterSyncUpdate();
6046
+ function invokeEffectListTask() {
6047
+ enableScopeTreeLog$1.current && setLogScope();
6048
+ _list.listToFoot(function invokeEffectList(_fiber) {
6049
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6050
+ effect(_dispatch, _fiber);
6051
+ }
6052
+ });
6053
+ enableScopeTreeLog$1.current && resetLogScope();
6054
+ }
6055
+ addEffectCallback(invokeEffectListTask);
6056
+ var renderScheduler = currentScheduler$1.current;
6057
+ if (_dispatch.enableConcurrentMode && !sync) {
6058
+ renderScheduler.macroTask(function flushEffect() {
6059
+ flushEffectCallback();
6060
+ });
6061
+ }
6062
+ else {
6063
+ renderScheduler.microTask(function flushEffect() {
6064
+ flushEffectCallback();
6065
+ });
6066
+ }
6067
+ };
6068
+
6069
+ var currentComponentFiber = react.__my_react_internal__.currentComponentFiber, currentHookNodeIndex = react.__my_react_internal__.currentHookNodeIndex;
6070
+ var resolveHookValue = function (hookNode, field) {
6071
+ if (hookNode) {
6072
+ switch (hookNode.type) {
6073
+ case myreactSharedExports.HOOK_TYPE.useState:
6074
+ case myreactSharedExports.HOOK_TYPE.useReducer:
6075
+ return [hookNode.result, field.dispatch];
6076
+ case myreactSharedExports.HOOK_TYPE.useId:
6077
+ case myreactSharedExports.HOOK_TYPE.useRef:
6078
+ case myreactSharedExports.HOOK_TYPE.useMemo:
6079
+ case myreactSharedExports.HOOK_TYPE.useContext:
6080
+ case myreactSharedExports.HOOK_TYPE.useCallback:
6081
+ case myreactSharedExports.HOOK_TYPE.useDeferredValue:
6082
+ case myreactSharedExports.HOOK_TYPE.useSyncExternalStore:
6083
+ case myreactSharedExports.HOOK_TYPE.useEffectEvent:
6084
+ return hookNode.result;
6085
+ case myreactSharedExports.HOOK_TYPE.useOptimistic:
6086
+ case myreactSharedExports.HOOK_TYPE.useTransition:
6087
+ return [hookNode.result.value, hookNode.result.start];
6088
+ case myreactSharedExports.HOOK_TYPE.useSignal:
6089
+ return [hookNode.result.getValue, hookNode.result.setValue];
6090
+ }
6091
+ }
6092
+ };
6093
+ var processHook = function (renderDispatch, _a) {
6094
+ var type = _a.type, reducer = _a.reducer, value = _a.value, deps = _a.deps;
6095
+ var fiber = currentComponentFiber.current;
6096
+ if (!fiber)
6097
+ throw new Error("[@my-react/react] can not use hook outside of component");
6098
+ if (!renderDispatch)
6099
+ throw new Error("[@my-react/react] internal error, can not get 'renderDispatch' for current render");
6100
+ fiber.hookList = fiber.hookList || new myreactSharedExports.ListTree();
6101
+ var currentHook = null;
6102
+ // initial
6103
+ if (myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__create__ | myreactSharedExports.STATE_TYPE.__recreate__)) {
6104
+ currentHook = createHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber);
6105
+ safeCall(function safeCallHookInitialListener() {
6106
+ renderDispatch.callOnHookInitial(currentHook, fiber);
6107
+ });
6108
+ }
6109
+ else {
6110
+ // update
6111
+ currentHook = updateHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber, Boolean(myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__hmr__)));
6112
+ safeCall(function safeCallHookUpdateListener() {
6113
+ renderDispatch.callOnHookUpdate(currentHook, fiber);
6114
+ });
6115
+ }
6116
+ currentHookNodeIndex.current++;
6117
+ var field = getInstanceFieldByInstance(currentHook);
6118
+ effectHookNode(renderDispatch, fiber, currentHook, field);
6119
+ return resolveHookValue(currentHook, field);
6120
+ };
6121
+
6122
+ var enableSuspenseRoot = react.__my_react_shared__.enableSuspenseRoot;
6123
+ var currentScheduler = react.__my_react_internal__.currentScheduler;
6124
+ var loadPromise = function (renderDispatch, promise) { return __awaiter(void 0, void 0, void 0, function () {
6125
+ var value, reason_1;
6126
+ return __generator(this, function (_a) {
6127
+ switch (_a.label) {
6128
+ case 0:
6129
+ if (promise.status === "fulfilled" || promise.status === "rejected")
6130
+ return [2 /*return*/];
6131
+ _a.label = 1;
6132
+ case 1:
6133
+ _a.trys.push([1, 3, , 4]);
6134
+ promise.status = "pending";
6135
+ return [4 /*yield*/, Promise.resolve(promise)];
6136
+ case 2:
6137
+ value = _a.sent();
6138
+ promise.status = "fulfilled";
6139
+ promise._value = value;
6140
+ return [3 /*break*/, 4];
6141
+ case 3:
6142
+ reason_1 = _a.sent();
6143
+ promise.status = "rejected";
6144
+ promise._reason = reason_1;
6145
+ return [3 /*break*/, 4];
6146
+ case 4: return [2 /*return*/];
6147
+ }
6148
+ });
6149
+ }); };
6150
+ var processPromise = function (renderDispatch, fiber, promise) {
6151
+ var _a, _b;
6152
+ defaultDeleteCurrentEffect(renderDispatch, fiber);
6153
+ if (promise.status === "rejected") {
6154
+ (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6155
+ return null;
6156
+ }
6157
+ if (promise.status === "fulfilled") {
6158
+ {
6159
+ console.warn("[@my-react/react] throw a promise what has already fulfilled, this is not a valid usage");
6160
+ }
6161
+ }
6162
+ promise._list = promise._list || new Set();
6163
+ promise._list.add(fiber);
6164
+ var suspenseFiber = renderDispatch.resolveSuspenseFiber(fiber);
6165
+ if (suspenseFiber) {
6166
+ var suspenseField = getInstanceFieldByInstance(suspenseFiber.instance);
6167
+ suspenseField.asyncLoadList.uniPush(promise);
6168
+ renderDispatch.pendingSuspenseFiberArray.uniPush(suspenseFiber);
6169
+ return null;
6170
+ }
6171
+ else {
6172
+ // TODO update flow
6173
+ if (enableSuspenseRoot.current && !renderDispatch.isAppMounted) {
6174
+ var suspenseField = getInstanceFieldByInstance(renderDispatch);
6175
+ suspenseField.asyncLoadList.uniPush(promise);
6176
+ return null;
6177
+ }
6178
+ devWarnWithFiber(fiber, "[@my-react/react] promise must be used inside a Suspense component, otherwise it will not work as expected");
6179
+ if (promise._loading)
6180
+ return null;
6181
+ promise._loading = true;
6182
+ promise.status = "pending";
6183
+ var renderScheduler_1 = currentScheduler.current;
6184
+ renderDispatch
6185
+ .processPromise(promise)
6186
+ .then(function () {
6187
+ fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6188
+ promise._list.delete(fiber);
6189
+ promise._loading = false;
6190
+ var updater = {
6191
+ type: myreactSharedExports.UpdateQueueType.promise,
6192
+ trigger: fiber,
6193
+ isSync: true,
6194
+ isForce: true,
6195
+ payLoad: promise,
6196
+ };
6197
+ renderScheduler_1.dispatchState(updater);
6198
+ })
6199
+ .catch(function (e) { return renderScheduler_1.dispatchError({ fiber: fiber, error: e }); });
6200
+ return null;
6201
+ }
6202
+ };
6203
+ var processSuspensePromise = function (renderDispatch, fiber, promise) {
6204
+ var _a, _b;
6205
+ defaultDeleteCurrentEffect(renderDispatch, fiber);
6206
+ fiber.state = myreactSharedExports.STATE_TYPE.__suspense__;
6207
+ if (promise.status === "rejected") {
6208
+ (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6209
+ return null;
6210
+ }
6211
+ if (promise.status === "fulfilled") {
6212
+ {
6213
+ console.warn("[@my-react/react] throw a promise what has already fulfilled, this is not a valid usage");
6214
+ }
6215
+ }
6216
+ promise._list = promise._list || new Set();
6217
+ promise._list.add(fiber);
6218
+ if (promise._loading)
6219
+ return null;
6220
+ promise._loading = true;
6221
+ promise.status = "pending";
6222
+ var renderScheduler = currentScheduler.current;
6223
+ renderDispatch
6224
+ .processPromise(promise)
6225
+ .then(function () {
6226
+ fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6227
+ promise._list.delete(fiber);
6228
+ promise._loading = false;
6229
+ var updater = {
6230
+ type: myreactSharedExports.UpdateQueueType.promise,
6231
+ trigger: fiber,
6232
+ isSync: true,
6233
+ isForce: true,
6234
+ payLoad: promise,
6235
+ };
6236
+ renderScheduler.dispatchState(updater);
6237
+ })
6238
+ .catch(function (e) { return renderScheduler.dispatchError({ fiber: fiber, error: e }); });
6239
+ return null;
6240
+ };
6241
+
6242
+ var Dispatcher = react.__my_react_internal__.Dispatcher, MyReactInternalInstanceClass = react.__my_react_internal__.MyReactInternalInstance, dispatchToListenerMap = react.__my_react_internal__.dispatchToListenerMap;
6243
+ var getInitialListeners = function () {
6244
+ return {
6245
+ fiberInitial: new Set(),
6246
+ fiberUpdate: new Set(),
6247
+ fiberHasChange: new Set(),
6248
+ fiberUnmount: new Set(),
6249
+ fiberHMR: new Set(),
6250
+ beforeFiberRun: new Set(),
6251
+ afterFiberRun: new Set(),
6252
+ afterFiberDone: new Set(),
6253
+ beforeDispatchRender: new Set(),
6254
+ afterDispatchRender: new Set(),
6255
+ fiberWarn: new Set(),
6256
+ fiberError: new Set(),
6257
+ fiberState: new Set(),
6258
+ fiberTrigger: new Set(),
6259
+ performanceWarn: new Set(),
6260
+ instanceInitial: new Set(),
6261
+ instanceUpdate: new Set(),
6262
+ instanceState: new Set(),
6263
+ instanceUnmount: new Set(),
6264
+ hookInitial: new Set(),
6265
+ hookUpdate: new Set(),
6266
+ hookState: new Set(),
6267
+ hookUnmount: new Set(),
6268
+ beforeCommitMount: new Set(),
6269
+ afterCommitMount: new Set(),
6270
+ beforeCommitUpdate: new Set(),
6271
+ afterCommitUpdate: new Set(),
6272
+ beforeCommitUnmount: new Set(),
6273
+ afterCommitUnmount: new Set(),
6274
+ }
6275
+ ;
6276
+ };
6277
+ var getInitialMap = function () { return ({
6278
+ effectMap: new MyWeakMap(),
6279
+ layoutEffectMap: new MyWeakMap(),
6280
+ insertionEffectMap: new MyWeakMap(),
6281
+ unmountMap: new MyWeakMap(),
6282
+ eventMap: new MyWeakMap(),
6283
+ triggerCallbackMap: new MyWeakMap(),
6284
+ }); };
6285
+ var getInitialFiber = function () { return ({
6286
+ scheduledFiber: null,
6287
+ errorCatchFiber: null,
6288
+ nextWorkingFiber: null,
6289
+ retriggerFiber: null,
6290
+ }); };
6291
+ var initialRef = {
6292
+ typeForRef: exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__class__,
6293
+ typeForCreate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
6294
+ typeForUpdate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
6295
+ typeForAppend: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
6296
+ typeForNativeNode: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
6297
+ };
6298
+ var listenerMap = dispatchToListenerMap;
6299
+ var RenderDispatchEvent = /** @class */ (function (_super) {
6300
+ __extends(RenderDispatchEvent, _super);
6301
+ function RenderDispatchEvent() {
6302
+ var _this = _super.call(this) || this;
6303
+ _this.dispatcher = Dispatcher;
6304
+ _this.runtimeRef = initialRef;
6305
+ _this.runtimeMap = getInitialMap();
6306
+ _this.runtimeFiber = getInitialFiber();
6307
+ listenerMap.set(_this, getInitialListeners());
6308
+ initInstance(_this);
6309
+ initVisibleInstance(_this);
6310
+ initSuspenseInstance(_this);
6311
+ Object.defineProperty(_this, "dispatcher", {
6312
+ value: Dispatcher,
6313
+ writable: false,
6314
+ enumerable: false,
6315
+ configurable: false,
6316
+ });
6317
+ return _this;
6318
+ }
6319
+ RenderDispatchEvent.prototype.getFiberTree = function (_fiber) {
6320
+ throw new Error("Method not implemented.");
6321
+ };
6322
+ RenderDispatchEvent.prototype.readPromise = function (_params) {
6323
+ throw new Error("Method not implemented.");
6324
+ };
6325
+ RenderDispatchEvent.prototype.readContext = function (_params) {
6326
+ throw new Error("Method not implemented.");
6327
+ };
6328
+ RenderDispatchEvent.prototype.dispatchHook = function (_params) {
6329
+ throw new Error("Method not implemented.");
6330
+ };
6331
+ RenderDispatchEvent.prototype.dispatchState = function (_params) {
6332
+ throw new Error("Method not implemented.");
6333
+ };
6334
+ RenderDispatchEvent.prototype.dispatchError = function (_params) {
6335
+ throw new Error("Method not implemented.");
6336
+ };
6337
+ RenderDispatchEvent.prototype.dispatchPromise = function (_params) {
6338
+ throw new Error("Method not implemented.");
6339
+ };
6340
+ RenderDispatchEvent.prototype.dispatchSuspensePromise = function (_params) {
6341
+ throw new Error("Method not implemented.");
6342
+ };
6343
+ RenderDispatchEvent.prototype.trigger = function (_fiber, _state, cb) {
6344
+ return triggerUpdateOnFiber(_fiber, _state, cb);
6345
+ };
6346
+ RenderDispatchEvent.prototype.generateCommitList = function (_fiber) { };
6347
+ RenderDispatchEvent.prototype.pendingCreate = function (_fiber) { };
6348
+ RenderDispatchEvent.prototype.pendingUpdate = function (_fiber) { };
6349
+ RenderDispatchEvent.prototype.pendingAppend = function (_fiber) { };
6350
+ RenderDispatchEvent.prototype.pendingPosition = function (_fiber) { };
6351
+ RenderDispatchEvent.prototype.pendingRef = function (_fiber) { };
6352
+ RenderDispatchEvent.prototype.pendingUnmount = function (_fiber, _pendingUnmount) { };
6353
+ RenderDispatchEvent.prototype.pendingEffect = function (_fiber, _effect, _option) { };
6354
+ RenderDispatchEvent.prototype.pendingLayoutEffect = function (_fiber, _layoutEffect, _option) { };
6355
+ RenderDispatchEvent.prototype.pendingInsertionEffect = function (_fiber, _insertionEffect, _option) { };
6356
+ RenderDispatchEvent.prototype.dispatchFiber = function (_fiber) { };
6357
+ RenderDispatchEvent.prototype.processLazy = function (_elementType) {
5925
6358
  return Promise.resolve();
5926
6359
  };
5927
6360
  RenderDispatchEvent.prototype.processPromise = function (_promise) {
@@ -5976,11 +6409,29 @@ function requireIndex_development_1 () {
5976
6409
  };
5977
6410
  set.add(onceCb);
5978
6411
  };
6412
+ RenderDispatchEvent.prototype.callOnFiberInitial = function (_fiber) {
6413
+ var _a;
6414
+ var set = listenerMap.get(this).fiberInitial;
6415
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6416
+ };
5979
6417
  RenderDispatchEvent.prototype.onFiberUpdate = function (cb) {
5980
6418
  var set = listenerMap.get(this).fiberUpdate;
5981
6419
  set.add(cb);
5982
6420
  return function () { return set.delete(cb); };
5983
6421
  };
6422
+ RenderDispatchEvent.prototype.onceFiberUpdate = function (cb) {
6423
+ var set = listenerMap.get(this).fiberUpdate;
6424
+ var onceCb = function (_fiber) {
6425
+ cb(_fiber);
6426
+ set.delete(onceCb);
6427
+ };
6428
+ set.add(onceCb);
6429
+ };
6430
+ RenderDispatchEvent.prototype.callOnFiberUpdate = function (_fiber) {
6431
+ var _a;
6432
+ var set = listenerMap.get(this).fiberUpdate;
6433
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6434
+ };
5984
6435
  RenderDispatchEvent.prototype.onFiberChange = function (cb) {
5985
6436
  var set = listenerMap.get(this).fiberHasChange;
5986
6437
  set.add(cb);
@@ -5994,13 +6445,10 @@ function requireIndex_development_1 () {
5994
6445
  };
5995
6446
  set.add(onceCb);
5996
6447
  };
5997
- RenderDispatchEvent.prototype.onceFiberUpdate = function (cb) {
5998
- var set = listenerMap.get(this).fiberUpdate;
5999
- var onceCb = function (_fiber) {
6000
- cb(_fiber);
6001
- set.delete(onceCb);
6002
- };
6003
- set.add(onceCb);
6448
+ RenderDispatchEvent.prototype.callOnFiberChange = function (_list) {
6449
+ var _a;
6450
+ var set = listenerMap.get(this).fiberHasChange;
6451
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_list); });
6004
6452
  };
6005
6453
  RenderDispatchEvent.prototype.onFiberUnmount = function (cb) {
6006
6454
  var set = listenerMap.get(this).fiberUnmount;
@@ -6015,6 +6463,11 @@ function requireIndex_development_1 () {
6015
6463
  };
6016
6464
  set.add(onceCb);
6017
6465
  };
6466
+ RenderDispatchEvent.prototype.callOnFiberUnmount = function (_fiber) {
6467
+ var _a;
6468
+ var set = listenerMap.get(this).fiberUnmount;
6469
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6470
+ };
6018
6471
  RenderDispatchEvent.prototype.onFiberState = function (cb) {
6019
6472
  var set = listenerMap.get(this).fiberState;
6020
6473
  set.add(cb);
@@ -6028,6 +6481,11 @@ function requireIndex_development_1 () {
6028
6481
  };
6029
6482
  set.add(onceCb);
6030
6483
  };
6484
+ RenderDispatchEvent.prototype.callOnFiberState = function (_fiber, _updater) {
6485
+ var _a;
6486
+ var set = listenerMap.get(this).fiberState;
6487
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber, _updater); });
6488
+ };
6031
6489
  RenderDispatchEvent.prototype.onFiberTrigger = function (cb) {
6032
6490
  var set = listenerMap.get(this).fiberTrigger;
6033
6491
  set.add(cb);
@@ -6041,6 +6499,11 @@ function requireIndex_development_1 () {
6041
6499
  };
6042
6500
  set.add(onceCb);
6043
6501
  };
6502
+ RenderDispatchEvent.prototype.callOnFiberTrigger = function (_fiber, _state) {
6503
+ var _a;
6504
+ var set = listenerMap.get(this).fiberTrigger;
6505
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber, _state); });
6506
+ };
6044
6507
  RenderDispatchEvent.prototype.onFiberHMR = function (cb) {
6045
6508
  var _a;
6046
6509
  var set = listenerMap.get(this).fiberHMR;
@@ -6057,6 +6520,11 @@ function requireIndex_development_1 () {
6057
6520
  };
6058
6521
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6059
6522
  };
6523
+ RenderDispatchEvent.prototype.callOnFiberHMR = function (_fiber, _forceRefresh) {
6524
+ var _a;
6525
+ var set = listenerMap.get(this).fiberHMR;
6526
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber, _forceRefresh); });
6527
+ };
6060
6528
  RenderDispatchEvent.prototype.onFiberWarn = function (cb) {
6061
6529
  var _a;
6062
6530
  var set = listenerMap.get(this).fiberWarn;
@@ -6073,6 +6541,15 @@ function requireIndex_development_1 () {
6073
6541
  };
6074
6542
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6075
6543
  };
6544
+ RenderDispatchEvent.prototype.callOnFiberWarn = function (_fiber) {
6545
+ var _a;
6546
+ var args = [];
6547
+ for (var _i = 1; _i < arguments.length; _i++) {
6548
+ args[_i - 1] = arguments[_i];
6549
+ }
6550
+ var set = listenerMap.get(this).fiberWarn;
6551
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb.apply(void 0, __spreadArray([_fiber], args, false)); });
6552
+ };
6076
6553
  RenderDispatchEvent.prototype.onFiberError = function (cb) {
6077
6554
  var _a;
6078
6555
  var set = listenerMap.get(this).fiberError;
@@ -6089,6 +6566,15 @@ function requireIndex_development_1 () {
6089
6566
  };
6090
6567
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6091
6568
  };
6569
+ RenderDispatchEvent.prototype.callOnFiberError = function (_fiber) {
6570
+ var _a;
6571
+ var args = [];
6572
+ for (var _i = 1; _i < arguments.length; _i++) {
6573
+ args[_i - 1] = arguments[_i];
6574
+ }
6575
+ var set = listenerMap.get(this).fiberError;
6576
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb.apply(void 0, __spreadArray([_fiber], args, false)); });
6577
+ };
6092
6578
  RenderDispatchEvent.prototype.onPerformanceWarn = function (cb) {
6093
6579
  var _a;
6094
6580
  var set = listenerMap.get(this).performanceWarn;
@@ -6098,13 +6584,18 @@ function requireIndex_development_1 () {
6098
6584
  RenderDispatchEvent.prototype.oncePerformanceWarn = function (cb) {
6099
6585
  var _a;
6100
6586
  var set = listenerMap.get(this).performanceWarn;
6101
- var onceCb = function (_fiber) {
6587
+ var onceCb = function (_fiber, _renderTime) {
6102
6588
  var _a;
6103
- cb(_fiber);
6589
+ cb(_fiber, _renderTime);
6104
6590
  (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6105
6591
  };
6106
6592
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6107
6593
  };
6594
+ RenderDispatchEvent.prototype.callOnPerformanceWarn = function (_fiber, _renderTime) {
6595
+ var _a;
6596
+ var set = listenerMap.get(this).performanceWarn;
6597
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber, _renderTime); });
6598
+ };
6108
6599
  RenderDispatchEvent.prototype.onBeforeFiberRun = function (cb) {
6109
6600
  var _a;
6110
6601
  var set = listenerMap.get(this).beforeFiberRun;
@@ -6121,6 +6612,11 @@ function requireIndex_development_1 () {
6121
6612
  };
6122
6613
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6123
6614
  };
6615
+ RenderDispatchEvent.prototype.callOnBeforeFiberRun = function (_fiber) {
6616
+ var _a;
6617
+ var set = listenerMap.get(this).beforeFiberRun;
6618
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6619
+ };
6124
6620
  RenderDispatchEvent.prototype.onAfterFiberRun = function (cb) {
6125
6621
  var _a;
6126
6622
  var set = listenerMap.get(this).afterFiberRun;
@@ -6137,6 +6633,11 @@ function requireIndex_development_1 () {
6137
6633
  };
6138
6634
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6139
6635
  };
6636
+ RenderDispatchEvent.prototype.callOnAfterFiberRun = function (_fiber) {
6637
+ var _a;
6638
+ var set = listenerMap.get(this).afterFiberRun;
6639
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6640
+ };
6140
6641
  RenderDispatchEvent.prototype.onAfterFiberDone = function (cb) {
6141
6642
  var _a;
6142
6643
  var set = listenerMap.get(this).afterFiberDone;
@@ -6153,6 +6654,11 @@ function requireIndex_development_1 () {
6153
6654
  };
6154
6655
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6155
6656
  };
6657
+ RenderDispatchEvent.prototype.callOnAfterFiberDone = function (_fiber) {
6658
+ var _a;
6659
+ var set = listenerMap.get(this).afterFiberDone;
6660
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6661
+ };
6156
6662
  RenderDispatchEvent.prototype.onBeforeDispatchRender = function (cb) {
6157
6663
  var _a;
6158
6664
  var set = listenerMap.get(this).beforeDispatchRender;
@@ -6162,6 +6668,27 @@ function requireIndex_development_1 () {
6162
6668
  RenderDispatchEvent.prototype.onceBeforeDispatchRender = function (cb) {
6163
6669
  var _a;
6164
6670
  var set = listenerMap.get(this).beforeDispatchRender;
6671
+ var onceCb = function (renderDispatch, fiber) {
6672
+ var _a;
6673
+ cb(renderDispatch, fiber);
6674
+ (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6675
+ };
6676
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6677
+ };
6678
+ RenderDispatchEvent.prototype.callOnBeforeDispatchRender = function (renderDispatch, fiber) {
6679
+ var _a;
6680
+ var set = listenerMap.get(this).beforeDispatchRender;
6681
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch, fiber); });
6682
+ };
6683
+ RenderDispatchEvent.prototype.onAfterDispatchRender = function (cb) {
6684
+ var _a;
6685
+ var set = listenerMap.get(this).afterDispatchRender;
6686
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, cb);
6687
+ return function () { var _a; return (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, cb); };
6688
+ };
6689
+ RenderDispatchEvent.prototype.onceAfterDispatchRender = function (cb) {
6690
+ var _a;
6691
+ var set = listenerMap.get(this).afterDispatchRender;
6165
6692
  var onceCb = function (renderDispatch) {
6166
6693
  var _a;
6167
6694
  cb(renderDispatch);
@@ -6169,6 +6696,11 @@ function requireIndex_development_1 () {
6169
6696
  };
6170
6697
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6171
6698
  };
6699
+ RenderDispatchEvent.prototype.callOnAfterDispatchRender = function (renderDispatch) {
6700
+ var _a;
6701
+ var set = listenerMap.get(this).afterDispatchRender;
6702
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6703
+ };
6172
6704
  RenderDispatchEvent.prototype.onBeforeDispatchUpdate = function (cb) {
6173
6705
  var _a;
6174
6706
  var set = listenerMap.get(this).beforeDispatchUpdate;
@@ -6185,6 +6717,32 @@ function requireIndex_development_1 () {
6185
6717
  };
6186
6718
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6187
6719
  };
6720
+ RenderDispatchEvent.prototype.callOnBeforeDispatchUpdate = function (renderDispatch, list) {
6721
+ var _a;
6722
+ var set = listenerMap.get(this).beforeDispatchUpdate;
6723
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch, list); });
6724
+ };
6725
+ RenderDispatchEvent.prototype.onAfterDispatchUpdate = function (cb) {
6726
+ var _a;
6727
+ var set = listenerMap.get(this).afterDispatchUpdate;
6728
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, cb);
6729
+ return function () { var _a; return (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, cb); };
6730
+ };
6731
+ RenderDispatchEvent.prototype.onceAfterDispatchUpdate = function (cb) {
6732
+ var _a;
6733
+ var set = listenerMap.get(this).afterDispatchUpdate;
6734
+ var onceCb = function (renderDispatch) {
6735
+ var _a;
6736
+ cb(renderDispatch);
6737
+ (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6738
+ };
6739
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6740
+ };
6741
+ RenderDispatchEvent.prototype.callOnAfterDispatchUpdate = function (renderDispatch) {
6742
+ var _a;
6743
+ var set = listenerMap.get(this).afterDispatchUpdate;
6744
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6745
+ };
6188
6746
  RenderDispatchEvent.prototype.onInstanceInitial = function (cb) {
6189
6747
  var set = listenerMap.get(this).instanceInitial;
6190
6748
  set.add(cb);
@@ -6198,6 +6756,11 @@ function requireIndex_development_1 () {
6198
6756
  };
6199
6757
  set.add(onceCb);
6200
6758
  };
6759
+ RenderDispatchEvent.prototype.callOnInstanceInitial = function (_instance, _fiber) {
6760
+ var _a;
6761
+ var set = listenerMap.get(this).instanceInitial;
6762
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_instance, _fiber); });
6763
+ };
6201
6764
  RenderDispatchEvent.prototype.onInstanceUpdate = function (cb) {
6202
6765
  var set = listenerMap.get(this).instanceUpdate;
6203
6766
  set.add(cb);
@@ -6211,6 +6774,11 @@ function requireIndex_development_1 () {
6211
6774
  };
6212
6775
  set.add(onceCb);
6213
6776
  };
6777
+ RenderDispatchEvent.prototype.callOnInstanceUpdate = function (_instance, _fiber) {
6778
+ var _a;
6779
+ var set = listenerMap.get(this).instanceUpdate;
6780
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_instance, _fiber); });
6781
+ };
6214
6782
  RenderDispatchEvent.prototype.onInstanceState = function (cb) {
6215
6783
  var set = listenerMap.get(this).instanceState;
6216
6784
  set.add(cb);
@@ -6224,6 +6792,11 @@ function requireIndex_development_1 () {
6224
6792
  };
6225
6793
  set.add(onceCb);
6226
6794
  };
6795
+ RenderDispatchEvent.prototype.callOnInstanceState = function (_instance, _fiber, _updater) {
6796
+ var _a;
6797
+ var set = listenerMap.get(this).instanceState;
6798
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_instance, _fiber, _updater); });
6799
+ };
6227
6800
  RenderDispatchEvent.prototype.onInstanceUnmount = function (cb) {
6228
6801
  var set = listenerMap.get(this).instanceUnmount;
6229
6802
  set.add(cb);
@@ -6237,6 +6810,11 @@ function requireIndex_development_1 () {
6237
6810
  };
6238
6811
  set.add(onceCb);
6239
6812
  };
6813
+ RenderDispatchEvent.prototype.callOnInstanceUnmount = function (_instance, _fiber) {
6814
+ var _a;
6815
+ var set = listenerMap.get(this).instanceUnmount;
6816
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_instance, _fiber); });
6817
+ };
6240
6818
  RenderDispatchEvent.prototype.onHookInitial = function (cb) {
6241
6819
  var set = listenerMap.get(this).hookInitial;
6242
6820
  set.add(cb);
@@ -6244,12 +6822,17 @@ function requireIndex_development_1 () {
6244
6822
  };
6245
6823
  RenderDispatchEvent.prototype.onceHookInitial = function (cb) {
6246
6824
  var set = listenerMap.get(this).hookInitial;
6247
- var onceCb = function (_hook) {
6248
- cb(_hook);
6825
+ var onceCb = function (_hook, _fiber) {
6826
+ cb(_hook, _fiber);
6249
6827
  set.delete(onceCb);
6250
6828
  };
6251
6829
  set.add(onceCb);
6252
6830
  };
6831
+ RenderDispatchEvent.prototype.callOnHookInitial = function (_hook, _fiber) {
6832
+ var _a;
6833
+ var set = listenerMap.get(this).hookInitial;
6834
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_hook, _fiber); });
6835
+ };
6253
6836
  RenderDispatchEvent.prototype.onHookUpdate = function (cb) {
6254
6837
  var set = listenerMap.get(this).hookUpdate;
6255
6838
  set.add(cb);
@@ -6257,12 +6840,17 @@ function requireIndex_development_1 () {
6257
6840
  };
6258
6841
  RenderDispatchEvent.prototype.onceHookUpdate = function (cb) {
6259
6842
  var set = listenerMap.get(this).hookUpdate;
6260
- var onceCb = function (_hook) {
6261
- cb(_hook);
6843
+ var onceCb = function (_hook, _fiber) {
6844
+ cb(_hook, _fiber);
6262
6845
  set.delete(onceCb);
6263
6846
  };
6264
6847
  set.add(onceCb);
6265
6848
  };
6849
+ RenderDispatchEvent.prototype.callOnHookUpdate = function (_hook, _fiber) {
6850
+ var _a;
6851
+ var set = listenerMap.get(this).hookUpdate;
6852
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_hook, _fiber); });
6853
+ };
6266
6854
  RenderDispatchEvent.prototype.onHookUnmount = function (cb) {
6267
6855
  var set = listenerMap.get(this).hookUnmount;
6268
6856
  set.add(cb);
@@ -6270,12 +6858,17 @@ function requireIndex_development_1 () {
6270
6858
  };
6271
6859
  RenderDispatchEvent.prototype.onceHookUnmount = function (cb) {
6272
6860
  var set = listenerMap.get(this).hookUnmount;
6273
- var onceCb = function (_hook) {
6274
- cb(_hook);
6861
+ var onceCb = function (_hook, _fiber) {
6862
+ cb(_hook, _fiber);
6275
6863
  set.delete(onceCb);
6276
6864
  };
6277
6865
  set.add(onceCb);
6278
6866
  };
6867
+ RenderDispatchEvent.prototype.callOnHookUnmount = function (_hook, _fiber) {
6868
+ var _a;
6869
+ var set = listenerMap.get(this).hookUnmount;
6870
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_hook, _fiber); });
6871
+ };
6279
6872
  RenderDispatchEvent.prototype.onHookState = function (cb) {
6280
6873
  var set = listenerMap.get(this).hookState;
6281
6874
  set.add(cb);
@@ -6289,6 +6882,11 @@ function requireIndex_development_1 () {
6289
6882
  };
6290
6883
  set.add(onceCb);
6291
6884
  };
6885
+ RenderDispatchEvent.prototype.callOnHookState = function (_hook, _fiber, _updater) {
6886
+ var _a;
6887
+ var set = listenerMap.get(this).hookState;
6888
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_hook, _fiber, _updater); });
6889
+ };
6292
6890
  RenderDispatchEvent.prototype.onBeforeCommitMount = function (cb) {
6293
6891
  var set = listenerMap.get(this).beforeCommitMount;
6294
6892
  set.add(cb);
@@ -6296,12 +6894,17 @@ function requireIndex_development_1 () {
6296
6894
  };
6297
6895
  RenderDispatchEvent.prototype.onceBeforeCommitMount = function (cb) {
6298
6896
  var set = listenerMap.get(this).beforeCommitMount;
6299
- var onceCb = function () {
6300
- cb();
6897
+ var onceCb = function (renderDispatch) {
6898
+ cb(renderDispatch);
6301
6899
  set.delete(onceCb);
6302
6900
  };
6303
6901
  set.add(onceCb);
6304
6902
  };
6903
+ RenderDispatchEvent.prototype.callOnBeforeCommitMount = function (renderDispatch) {
6904
+ var _a;
6905
+ var set = listenerMap.get(this).beforeCommitMount;
6906
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6907
+ };
6305
6908
  RenderDispatchEvent.prototype.onAfterCommitMount = function (cb) {
6306
6909
  var set = listenerMap.get(this).afterCommitMount;
6307
6910
  set.add(cb);
@@ -6309,12 +6912,17 @@ function requireIndex_development_1 () {
6309
6912
  };
6310
6913
  RenderDispatchEvent.prototype.onceAfterCommitMount = function (cb) {
6311
6914
  var set = listenerMap.get(this).afterCommitMount;
6312
- var onceCb = function () {
6313
- cb();
6915
+ var onceCb = function (renderDispatch) {
6916
+ cb(renderDispatch);
6314
6917
  set.delete(onceCb);
6315
6918
  };
6316
6919
  set.add(onceCb);
6317
6920
  };
6921
+ RenderDispatchEvent.prototype.callOnAfterCommitMount = function (renderDispatch) {
6922
+ var _a;
6923
+ var set = listenerMap.get(this).afterCommitMount;
6924
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6925
+ };
6318
6926
  RenderDispatchEvent.prototype.onBeforeCommitUpdate = function (cb) {
6319
6927
  var set = listenerMap.get(this).beforeCommitUpdate;
6320
6928
  set.add(cb);
@@ -6322,12 +6930,17 @@ function requireIndex_development_1 () {
6322
6930
  };
6323
6931
  RenderDispatchEvent.prototype.onceBeforeCommitUpdate = function (cb) {
6324
6932
  var set = listenerMap.get(this).beforeCommitUpdate;
6325
- var onceCb = function () {
6326
- cb();
6933
+ var onceCb = function (renderDispatch) {
6934
+ cb(renderDispatch);
6327
6935
  set.delete(onceCb);
6328
6936
  };
6329
6937
  set.add(onceCb);
6330
6938
  };
6939
+ RenderDispatchEvent.prototype.callOnBeforeCommitUpdate = function (renderDispatch) {
6940
+ var _a;
6941
+ var set = listenerMap.get(this).beforeCommitUpdate;
6942
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6943
+ };
6331
6944
  RenderDispatchEvent.prototype.onAfterCommitUpdate = function (cb) {
6332
6945
  var set = listenerMap.get(this).afterCommitUpdate;
6333
6946
  set.add(cb);
@@ -6335,12 +6948,17 @@ function requireIndex_development_1 () {
6335
6948
  };
6336
6949
  RenderDispatchEvent.prototype.onceAfterCommitUpdate = function (cb) {
6337
6950
  var set = listenerMap.get(this).afterCommitUpdate;
6338
- var onceCb = function () {
6339
- cb();
6951
+ var onceCb = function (renderDispatch) {
6952
+ cb(renderDispatch);
6340
6953
  set.delete(onceCb);
6341
6954
  };
6342
6955
  set.add(onceCb);
6343
6956
  };
6957
+ RenderDispatchEvent.prototype.callOnAfterCommitUpdate = function (renderDispatch) {
6958
+ var _a;
6959
+ var set = listenerMap.get(this).afterCommitUpdate;
6960
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6961
+ };
6344
6962
  RenderDispatchEvent.prototype.onBeforeCommitUnmount = function (cb) {
6345
6963
  var set = listenerMap.get(this).beforeCommitUnmount;
6346
6964
  set.add(cb);
@@ -6348,12 +6966,17 @@ function requireIndex_development_1 () {
6348
6966
  };
6349
6967
  RenderDispatchEvent.prototype.onceBeforeCommitUnmount = function (cb) {
6350
6968
  var set = listenerMap.get(this).beforeCommitUnmount;
6351
- var onceCb = function () {
6352
- cb();
6969
+ var onceCb = function (renderDispatch) {
6970
+ cb(renderDispatch);
6353
6971
  set.delete(onceCb);
6354
6972
  };
6355
6973
  set.add(onceCb);
6356
6974
  };
6975
+ RenderDispatchEvent.prototype.callOnBeforeCommitUnmount = function (renderDispatch) {
6976
+ var _a;
6977
+ var set = listenerMap.get(this).beforeCommitUnmount;
6978
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6979
+ };
6357
6980
  RenderDispatchEvent.prototype.onAfterCommitUnmount = function (cb) {
6358
6981
  var set = listenerMap.get(this).afterCommitUnmount;
6359
6982
  set.add(cb);
@@ -6361,345 +6984,46 @@ function requireIndex_development_1 () {
6361
6984
  };
6362
6985
  RenderDispatchEvent.prototype.onceAfterCommitUnmount = function (cb) {
6363
6986
  var set = listenerMap.get(this).afterCommitUnmount;
6364
- var onceCb = function () {
6365
- cb();
6987
+ var onceCb = function (renderDispatch) {
6988
+ cb(renderDispatch);
6366
6989
  set.delete(onceCb);
6367
6990
  };
6368
6991
  set.add(onceCb);
6369
6992
  };
6993
+ RenderDispatchEvent.prototype.callOnAfterCommitUnmount = function (renderDispatch) {
6994
+ var _a;
6995
+ var set = listenerMap.get(this).afterCommitUnmount;
6996
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6997
+ };
6370
6998
  return RenderDispatchEvent;
6371
6999
  }(MyReactInternalInstanceClass));
6372
7000
 
6373
7001
  var defaultDispatchFiber = function (renderDispatch, fiber) {
6374
7002
  if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__root__)) {
6375
7003
  // TODO
6376
- nextWorkRoot(renderDispatch, fiber);
6377
- }
6378
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__class__ | exports.NODE_TYPE.__function__)) {
6379
- nextWorkComponent(renderDispatch, fiber);
6380
- }
6381
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__lazy__)) {
6382
- nextWorkLazy(renderDispatch, fiber);
6383
- }
6384
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__suspense__)) {
6385
- nextWorkSuspense(renderDispatch, fiber);
6386
- }
6387
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__consumer__)) {
6388
- nextWorkConsumer(renderDispatch, fiber);
6389
- }
6390
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__provider__ | exports.NODE_TYPE.__context__)) {
6391
- nextWorkProvider(renderDispatch, fiber);
6392
- }
6393
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__activity__)) {
6394
- nextWorkActivity(renderDispatch, fiber);
6395
- }
6396
- else {
6397
- nextWorkNormal(renderDispatch, fiber);
6398
- }
6399
- };
6400
-
6401
- var currentScheduler$2 = react.__my_react_internal__.currentScheduler;
6402
- var enableScopeTreeLog$2 = react.__my_react_shared__.enableScopeTreeLog;
6403
- // TODO improve
6404
- var defaultDispatchMountLatest = function (_dispatch, _fiber) {
6405
- beforeSyncUpdate();
6406
- var _list = generateFiberToListWithAction(_fiber, function invokeUnmountPendingList(_fiber) {
6407
- defaultInvokeUnmountList(_dispatch, _fiber);
6408
- });
6409
- _list.listToFoot(function invokeInsertionEffectList(_fiber) {
6410
- insertionEffect(_dispatch, _fiber);
6411
- });
6412
- afterSyncUpdate();
6413
- _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
6414
- safeCallWithCurrentFiber({
6415
- fiber: _fiber,
6416
- action: function safeCallCreateAndUpdate() {
6417
- _dispatch.commitCreate(_fiber);
6418
- _dispatch.commitUpdate(_fiber);
6419
- },
6420
- });
6421
- });
6422
- _list.listToFoot(function invokeAppendList(_fiber) {
6423
- safeCallWithCurrentFiber({
6424
- fiber: _fiber,
6425
- action: function safeCallAppendList() {
6426
- _dispatch.commitAppend(_fiber);
6427
- },
6428
- });
6429
- });
6430
- _list.listToFoot(function invokeSetRefList(_fiber) {
6431
- safeCallWithCurrentFiber({
6432
- fiber: _fiber,
6433
- action: function safeCallSetRefList() {
6434
- _dispatch.commitSetRef(_fiber);
6435
- },
6436
- });
6437
- });
6438
- beforeSyncUpdate();
6439
- _list.listToFoot(function invokeLayoutEffectList(_fiber) {
6440
- layoutEffect(_dispatch, _fiber);
6441
- });
6442
- afterSyncUpdate();
6443
- function invokeEffectListTask() {
6444
- enableScopeTreeLog$2.current && setLogScope();
6445
- _list.listToFoot(function invokeEffectList(_fiber) {
6446
- effect(_dispatch, _fiber);
6447
- });
6448
- enableScopeTreeLog$2.current && resetLogScope();
6449
- }
6450
- addEffectCallback(invokeEffectListTask);
6451
- var renderScheduler = currentScheduler$2.current;
6452
- if (_dispatch.enableConcurrentMode) {
6453
- renderScheduler.macroTask(function flushEffect() {
6454
- flushEffectCallback();
6455
- });
6456
- }
6457
- else {
6458
- renderScheduler.microTask(function flushEffect() {
6459
- flushEffectCallback();
6460
- });
6461
- }
6462
- };
6463
- var defaultDispatchMount = defaultDispatchMountLatest;
6464
-
6465
- var defaultResolveScope = function (fiber) {
6466
- var parent = fiber.parent;
6467
- while (parent) {
6468
- if (myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scope__) || myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scopeSuspense__)) {
6469
- return parent;
6470
- }
6471
- parent = parent.parent;
6472
- }
6473
- return null;
6474
- };
6475
-
6476
- var enableDebugFiled$1 = react.__my_react_shared__.enableDebugFiled;
6477
- var defaultGenerateStrict = function (fiber) {
6478
- {
6479
- var parent_1 = fiber.parent;
6480
- var isStrict = false;
6481
- var typedParent = parent_1;
6482
- if (parent_1) {
6483
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__strict__)) {
6484
- isStrict = true;
6485
- }
6486
- if (typedParent._debugStrict) {
6487
- isStrict = true;
6488
- }
6489
- }
6490
- if (enableDebugFiled$1.current) {
6491
- var typedFiber = fiber;
6492
- typedFiber._debugStrict = isStrict;
6493
- }
6494
- return isStrict;
6495
- }
6496
- };
6497
-
6498
- var currentScheduler$1 = react.__my_react_internal__.currentScheduler;
6499
- var enableScopeTreeLog$1 = react.__my_react_shared__.enableScopeTreeLog;
6500
- var defaultDispatchUpdate = function (_dispatch, _list) {
6501
- // TODO maybe need call `insertionEffect` in another function
6502
- beforeSyncUpdate();
6503
- _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
6504
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6505
- defaultInvokeUnmountList(_dispatch, _fiber);
6506
- }
6507
- });
6508
- _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
6509
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6510
- insertionEffect(_dispatch, _fiber);
6511
- }
6512
- });
6513
- afterSyncUpdate();
6514
- _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
6515
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6516
- safeCallWithCurrentFiber({
6517
- fiber: _fiber,
6518
- action: function safeCallCreateAndUpdate() {
6519
- _dispatch.commitCreate(_fiber);
6520
- _dispatch.commitUpdate(_fiber);
6521
- },
6522
- });
6523
- }
6524
- });
6525
- _list.listToHead(function invokePositionList(_fiber) {
6526
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6527
- safeCallWithCurrentFiber({
6528
- fiber: _fiber,
6529
- action: function safeCallPosition() {
6530
- _dispatch.commitPosition(_fiber);
6531
- },
6532
- });
6533
- }
6534
- });
6535
- _list.listToFoot(function invokeAppendList(_fiber) {
6536
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6537
- safeCallWithCurrentFiber({
6538
- fiber: _fiber,
6539
- action: function safeCallAppendList() {
6540
- _dispatch.commitAppend(_fiber);
6541
- },
6542
- });
6543
- }
6544
- });
6545
- _list.listToFoot(function invokeSetRefList(_fiber) {
6546
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6547
- safeCallWithCurrentFiber({
6548
- fiber: _fiber,
6549
- action: function safeCallSetRefList() {
6550
- _dispatch.commitSetRef(_fiber);
6551
- },
6552
- });
6553
- }
6554
- });
6555
- beforeSyncUpdate();
6556
- _list.listToFoot(function invokeLayoutEffectList(_fiber) {
6557
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6558
- layoutEffect(_dispatch, _fiber);
6559
- }
6560
- });
6561
- afterSyncUpdate();
6562
- function invokeEffectListTask() {
6563
- enableScopeTreeLog$1.current && setLogScope();
6564
- _list.listToFoot(function invokeEffectList(_fiber) {
6565
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6566
- effect(_dispatch, _fiber);
6567
- }
6568
- });
6569
- enableScopeTreeLog$1.current && resetLogScope();
6570
- }
6571
- addEffectCallback(invokeEffectListTask);
6572
- var renderScheduler = currentScheduler$1.current;
6573
- if (_dispatch.enableConcurrentMode) {
6574
- renderScheduler.macroTask(function flushEffect() {
6575
- flushEffectCallback();
6576
- });
6577
- }
6578
- else {
6579
- renderScheduler.microTask(function flushEffect() {
6580
- flushEffectCallback();
6581
- });
6582
- }
6583
- };
6584
-
6585
- var enableSuspenseRoot = react.__my_react_shared__.enableSuspenseRoot;
6586
- var currentScheduler = react.__my_react_internal__.currentScheduler;
6587
- var loadPromise = function (renderDispatch, promise) { return __awaiter(void 0, void 0, void 0, function () {
6588
- var value, reason_1;
6589
- return __generator(this, function (_a) {
6590
- switch (_a.label) {
6591
- case 0:
6592
- if (promise.status === "fulfilled" || promise.status === "rejected")
6593
- return [2 /*return*/];
6594
- _a.label = 1;
6595
- case 1:
6596
- _a.trys.push([1, 3, , 4]);
6597
- promise.status = "pending";
6598
- return [4 /*yield*/, Promise.resolve(promise)];
6599
- case 2:
6600
- value = _a.sent();
6601
- promise.status = "fulfilled";
6602
- promise._value = value;
6603
- return [3 /*break*/, 4];
6604
- case 3:
6605
- reason_1 = _a.sent();
6606
- promise.status = "rejected";
6607
- promise._reason = reason_1;
6608
- return [3 /*break*/, 4];
6609
- case 4: return [2 /*return*/];
6610
- }
6611
- });
6612
- }); };
6613
- var processPromise = function (renderDispatch, fiber, promise) {
6614
- var _a, _b;
6615
- defaultDeleteCurrentEffect(renderDispatch, fiber);
6616
- if (promise.status === "rejected") {
6617
- (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6618
- return null;
7004
+ nextWorkRoot(renderDispatch, fiber);
6619
7005
  }
6620
- if (promise.status === "fulfilled") {
6621
- {
6622
- console.warn("[@my-react/react] throw a promise what has already fulfilled, this is not a valid usage");
6623
- }
7006
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__class__ | exports.NODE_TYPE.__function__)) {
7007
+ nextWorkComponent(renderDispatch, fiber);
6624
7008
  }
6625
- promise._list = promise._list || new Set();
6626
- promise._list.add(fiber);
6627
- var suspenseFiber = renderDispatch.resolveSuspenseFiber(fiber);
6628
- if (suspenseFiber) {
6629
- var suspenseField = getInstanceFieldByInstance(suspenseFiber.instance);
6630
- suspenseField.asyncLoadList.uniPush(promise);
6631
- renderDispatch.pendingSuspenseFiberArray.uniPush(suspenseFiber);
6632
- return null;
7009
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__lazy__)) {
7010
+ nextWorkLazy(renderDispatch, fiber);
6633
7011
  }
6634
- else {
6635
- // TODO update flow
6636
- if (enableSuspenseRoot.current && !renderDispatch.isAppMounted) {
6637
- var suspenseField = getInstanceFieldByInstance(renderDispatch);
6638
- suspenseField.asyncLoadList.uniPush(promise);
6639
- return null;
6640
- }
6641
- devWarnWithFiber(fiber, "[@my-react/react] promise must be used inside a Suspense component, otherwise it will not work as expected");
6642
- if (promise._loading)
6643
- return null;
6644
- promise._loading = true;
6645
- promise.status = "pending";
6646
- var renderScheduler_1 = currentScheduler.current;
6647
- renderDispatch
6648
- .processPromise(promise)
6649
- .then(function () {
6650
- fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6651
- promise._list.delete(fiber);
6652
- promise._loading = false;
6653
- var updater = {
6654
- type: myreactSharedExports.UpdateQueueType.promise,
6655
- trigger: fiber,
6656
- isSync: true,
6657
- isForce: true,
6658
- payLoad: promise,
6659
- };
6660
- renderScheduler_1.dispatchState(updater);
6661
- })
6662
- .catch(function (e) { return renderScheduler_1.dispatchError({ fiber: fiber, error: e }); });
6663
- return null;
7012
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__suspense__)) {
7013
+ nextWorkSuspense(renderDispatch, fiber);
6664
7014
  }
6665
- };
6666
- var processSuspensePromise = function (renderDispatch, fiber, promise) {
6667
- var _a, _b;
6668
- defaultDeleteCurrentEffect(renderDispatch, fiber);
6669
- fiber.state = myreactSharedExports.STATE_TYPE.__suspense__;
6670
- if (promise.status === "rejected") {
6671
- (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6672
- return null;
7015
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__consumer__)) {
7016
+ nextWorkConsumer(renderDispatch, fiber);
6673
7017
  }
6674
- if (promise.status === "fulfilled") {
6675
- {
6676
- console.warn("[@my-react/react] throw a promise what has already fulfilled, this is not a valid usage");
6677
- }
7018
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__provider__ | exports.NODE_TYPE.__context__)) {
7019
+ nextWorkProvider(renderDispatch, fiber);
7020
+ }
7021
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__activity__)) {
7022
+ nextWorkActivity(renderDispatch, fiber);
7023
+ }
7024
+ else {
7025
+ nextWorkNormal(renderDispatch, fiber);
6678
7026
  }
6679
- promise._list = promise._list || new Set();
6680
- promise._list.add(fiber);
6681
- if (promise._loading)
6682
- return null;
6683
- promise._loading = true;
6684
- promise.status = "pending";
6685
- var renderScheduler = currentScheduler.current;
6686
- renderDispatch
6687
- .processPromise(promise)
6688
- .then(function () {
6689
- fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6690
- promise._list.delete(fiber);
6691
- promise._loading = false;
6692
- var updater = {
6693
- type: myreactSharedExports.UpdateQueueType.promise,
6694
- trigger: fiber,
6695
- isSync: true,
6696
- isForce: true,
6697
- payLoad: promise,
6698
- };
6699
- renderScheduler.dispatchState(updater);
6700
- })
6701
- .catch(function (e) { return renderScheduler.dispatchError({ fiber: fiber, error: e }); });
6702
- return null;
6703
7027
  };
6704
7028
 
6705
7029
  var CustomRenderDispatch = /** @class */ (function (_super) {
@@ -6711,7 +7035,7 @@ function requireIndex_development_1 () {
6711
7035
  _this.isAppMounted = false;
6712
7036
  _this.isAppCrashed = false;
6713
7037
  _this.isAppUnmounted = false;
6714
- _this.version = "0.3.19";
7038
+ _this.version = "0.3.20";
6715
7039
  _this.mode = "development" ;
6716
7040
  _this.renderMode = "render";
6717
7041
  _this.pendingCommitFiberList = null;
@@ -6855,29 +7179,29 @@ function requireIndex_development_1 () {
6855
7179
  (_a = instance.beforeCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
6856
7180
  });
6857
7181
  safeCall(function safeCallBeforeCommitListener() {
6858
- listenerMap.get(instance).beforeCommitMount.forEach(function (cb) { return cb(); });
7182
+ instance.callOnBeforeCommitMount(instance);
6859
7183
  });
6860
7184
  defaultDispatchMount(this, _fiber);
6861
7185
  safeCall(function safeCallAfterCommitListener() {
6862
- listenerMap.get(instance).afterCommitMount.forEach(function (cb) { return cb(); });
7186
+ instance.callOnAfterCommitMount(instance);
6863
7187
  });
6864
7188
  safeCall(function safeCallAfterCommit() {
6865
7189
  var _a;
6866
7190
  (_a = instance.afterCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
6867
7191
  });
6868
7192
  };
6869
- CustomRenderDispatch.prototype.reconcileUpdate = function (_list) {
7193
+ CustomRenderDispatch.prototype.reconcileUpdate = function (_list, sync) {
6870
7194
  var instance = this;
6871
7195
  safeCall(function safeCallBeforeUpdate() {
6872
7196
  var _a;
6873
7197
  (_a = instance.beforeUpdate) === null || _a === void 0 ? void 0 : _a.call(instance);
6874
7198
  });
6875
7199
  safeCall(function safeCallBeforeUpdateListener() {
6876
- listenerMap.get(instance).beforeCommitUpdate.forEach(function (cb) { return cb(); });
7200
+ instance.callOnBeforeCommitUpdate(instance);
6877
7201
  });
6878
- defaultDispatchUpdate(this, _list);
7202
+ defaultDispatchUpdate(this, _list, sync);
6879
7203
  safeCall(function safeCallAfterUpdateListener() {
6880
- listenerMap.get(instance).afterCommitUpdate.forEach(function (cb) { return cb(); });
7204
+ instance.callOnAfterCommitUpdate(instance);
6881
7205
  });
6882
7206
  safeCall(function safeCallAfterUpdate() {
6883
7207
  var _a;
@@ -6891,11 +7215,11 @@ function requireIndex_development_1 () {
6891
7215
  (_a = instance.beforeUnmount) === null || _a === void 0 ? void 0 : _a.call(instance);
6892
7216
  });
6893
7217
  safeCall(function safeCallBeforeUnmountListener() {
6894
- listenerMap.get(instance).beforeCommitUnmount.forEach(function (cb) { return cb(); });
7218
+ instance.callOnBeforeCommitUnmount(instance);
6895
7219
  });
6896
7220
  defaultDispatchUnmount(this);
6897
7221
  safeCall(function safeCallAfterUnmountListener() {
6898
- listenerMap.get(instance).afterCommitUnmount.forEach(function (cb) { return cb(); });
7222
+ instance.callOnAfterCommitUnmount(instance);
6899
7223
  });
6900
7224
  safeCall(function safeCallAfterUnmount() {
6901
7225
  var _a;
@@ -6925,163 +7249,6 @@ function requireIndex_development_1 () {
6925
7249
  return CustomRenderDispatch;
6926
7250
  }(RenderDispatchEvent));
6927
7251
 
6928
- var enableDebugFiled = react.__my_react_shared__.enableDebugFiled;
6929
- var currentRunningFiber = react.__my_react_internal__.currentRunningFiber, MyReactInternalInstance = react.__my_react_internal__.MyReactInternalInstance;
6930
- var defaultGetContextValue = function (fiber, ContextObject) {
6931
- var _a;
6932
- if (fiber) {
6933
- return fiber.pendingProps["value"];
6934
- }
6935
- else {
6936
- return (_a = ContextObject === null || ContextObject === void 0 ? void 0 : ContextObject.Provider) === null || _a === void 0 ? void 0 : _a["value"];
6937
- }
6938
- };
6939
- var defaultGetContextFiber = function (fiber, ContextObject) {
6940
- if ((fiber === null || fiber === void 0 ? void 0 : fiber.parent) && ContextObject) {
6941
- var parent_1 = fiber.parent;
6942
- while (parent_1) {
6943
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__provider__)) {
6944
- var typedElementType = parent_1.elementType;
6945
- var contextObj = typedElementType["Context"];
6946
- if (contextObj === ContextObject) {
6947
- return parent_1;
6948
- }
6949
- }
6950
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__context__)) {
6951
- var typedElementType = parent_1.elementType;
6952
- var contextObj = typedElementType;
6953
- if (contextObj === ContextObject) {
6954
- return parent_1;
6955
- }
6956
- }
6957
- parent_1 = parent_1.parent;
6958
- }
6959
- }
6960
- else {
6961
- return null;
6962
- }
6963
- };
6964
- var defaultReadContext = function (Context) {
6965
- var fiber = currentRunningFiber.current;
6966
- if (!Context) {
6967
- throw new Error("the Context what you read is not exist");
6968
- }
6969
- if (!fiber) {
6970
- throw new Error('current environment is not support "readContext"');
6971
- }
6972
- var isUpdate = !!fiber.instance;
6973
- fiber.instance = fiber.instance || new MyReactInternalInstance();
6974
- !isUpdate && initInstance(fiber.instance);
6975
- !isUpdate && setOwnerForInstance(fiber.instance, fiber);
6976
- var contextFiber = defaultGetContextFiber(fiber, Context);
6977
- setSubscribeForInstance(fiber.instance, contextFiber);
6978
- return defaultGetContextValue(contextFiber, Context);
6979
- };
6980
- var prepareUpdateAllDependence = function (renderDispatch, fiber, beforeValue, afterValue) {
6981
- var consumerList = new Set((fiber === null || fiber === void 0 ? void 0 : fiber.dependence) || []);
6982
- consumerList.forEach(function prepareUpdateSingleConsumer(i) {
6983
- var owner = getInstanceOwnerFiber(i);
6984
- if (owner && myreactSharedExports.exclude(owner.state, myreactSharedExports.STATE_TYPE.__unmount__)) {
6985
- var typedFiber_1 = owner;
6986
- typedFiber_1.state = myreactSharedExports.STATE_TYPE.__triggerSyncForce__;
6987
- }
6988
- });
6989
- var typedFiber = fiber;
6990
- var processedNodes = [];
6991
- var updater = {
6992
- type: myreactSharedExports.UpdateQueueType.context,
6993
- trigger: fiber,
6994
- payLoad: afterValue,
6995
- isSync: true,
6996
- isForce: true,
6997
- isImmediate: true,
6998
- isRetrigger: true,
6999
- };
7000
- if (enableDebugFiled.current) {
7001
- var now = Date.now();
7002
- updater._debugBeforeValue = beforeValue;
7003
- updater._debugAfterValue = afterValue;
7004
- updater._debugCreateTime = now;
7005
- updater._debugRunTime = now;
7006
- updater._debugType = myreactSharedExports.UpdateQueueType[myreactSharedExports.UpdateQueueType.context];
7007
- if (enableDebugUpdateQueue.current) {
7008
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new myreactSharedExports.ListTree();
7009
- typedFiber._debugUpdateQueue.push(updater);
7010
- }
7011
- }
7012
- processedNodes.push(updater);
7013
- var updateState = {
7014
- needUpdate: true,
7015
- nodes: processedNodes,
7016
- isSync: true,
7017
- isForce: true,
7018
- isImmediate: true,
7019
- isRetrigger: true,
7020
- };
7021
- safeCallWithCurrentFiber({
7022
- fiber: fiber,
7023
- action: function safeCallFiberTriggerListener() {
7024
- var _a, _b;
7025
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberTrigger) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(fiber, updateState); });
7026
- },
7027
- });
7028
- };
7029
-
7030
- var currentComponentFiber = react.__my_react_internal__.currentComponentFiber, currentHookNodeIndex = react.__my_react_internal__.currentHookNodeIndex;
7031
- var resolveHookValue = function (hookNode, field) {
7032
- if (hookNode) {
7033
- switch (hookNode.type) {
7034
- case myreactSharedExports.HOOK_TYPE.useState:
7035
- case myreactSharedExports.HOOK_TYPE.useReducer:
7036
- return [hookNode.result, field.dispatch];
7037
- case myreactSharedExports.HOOK_TYPE.useId:
7038
- case myreactSharedExports.HOOK_TYPE.useRef:
7039
- case myreactSharedExports.HOOK_TYPE.useMemo:
7040
- case myreactSharedExports.HOOK_TYPE.useContext:
7041
- case myreactSharedExports.HOOK_TYPE.useCallback:
7042
- case myreactSharedExports.HOOK_TYPE.useDeferredValue:
7043
- case myreactSharedExports.HOOK_TYPE.useSyncExternalStore:
7044
- case myreactSharedExports.HOOK_TYPE.useEffectEvent:
7045
- return hookNode.result;
7046
- case myreactSharedExports.HOOK_TYPE.useOptimistic:
7047
- case myreactSharedExports.HOOK_TYPE.useTransition:
7048
- return [hookNode.result.value, hookNode.result.start];
7049
- case myreactSharedExports.HOOK_TYPE.useSignal:
7050
- return [hookNode.result.getValue, hookNode.result.setValue];
7051
- }
7052
- }
7053
- };
7054
- var processHook = function (renderDispatch, _a) {
7055
- var type = _a.type, reducer = _a.reducer, value = _a.value, deps = _a.deps;
7056
- var fiber = currentComponentFiber.current;
7057
- if (!fiber)
7058
- throw new Error("[@my-react/react] can not use hook outside of component");
7059
- if (!renderDispatch)
7060
- throw new Error("[@my-react/react] internal error, can not get 'renderDispatch' for current render");
7061
- fiber.hookList = fiber.hookList || new myreactSharedExports.ListTree();
7062
- var currentHook = null;
7063
- // initial
7064
- if (myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__create__ | myreactSharedExports.STATE_TYPE.__recreate__)) {
7065
- currentHook = createHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber);
7066
- safeCall(function safeCallHookInitialListener() {
7067
- var _a, _b;
7068
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.hookInitial) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(currentHook, fiber); });
7069
- });
7070
- }
7071
- else {
7072
- // update
7073
- currentHook = updateHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber, Boolean(myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__hmr__)));
7074
- safeCall(function safeCallHookUpdateListener() {
7075
- var _a, _b;
7076
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.hookUpdate) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(currentHook, fiber); });
7077
- });
7078
- }
7079
- currentHookNodeIndex.current++;
7080
- var field = getInstanceFieldByInstance(currentHook);
7081
- effectHookNode(renderDispatch, fiber, currentHook, field);
7082
- return resolveHookValue(currentHook, field);
7083
- };
7084
-
7085
7252
  var globalLoop = react.__my_react_internal__.globalLoop;
7086
7253
  var enableScopeTreeLog = react.__my_react_shared__.enableScopeTreeLog;
7087
7254
  function finishMountSync(renderDispatch, fiber) {
@@ -7096,21 +7263,23 @@ function requireIndex_development_1 () {
7096
7263
  safeCallWithCurrentFiber({
7097
7264
  fiber: fiber,
7098
7265
  action: function safeCallFiberHasChangeListener() {
7099
- var _a, _b;
7100
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberHasChange) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(changedList); });
7266
+ renderDispatch.callOnFiberChange(changedList);
7101
7267
  },
7102
7268
  });
7103
7269
  }
7104
7270
  var mountSync = function (renderDispatch, fiber) {
7105
- var _a, _b, _c;
7106
- ((_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.beforeDispatchRender) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(renderDispatch); }));
7271
+ safeCall(function safeCallBeforeDispatchRender() {
7272
+ renderDispatch.callOnBeforeDispatchRender(renderDispatch, fiber);
7273
+ });
7107
7274
  globalLoop.current = true;
7108
7275
  enableScopeTreeLog.current && setLogScope();
7109
7276
  mountLoopAll(renderDispatch, fiber);
7110
7277
  processAsyncLoadListOnSyncMount(renderDispatch);
7111
7278
  enableScopeTreeLog.current && resetLogScope();
7112
7279
  finishMountSync(renderDispatch, fiber);
7113
- ((_c = listenerMap.get(renderDispatch)) === null || _c === void 0 ? void 0 : _c.afterDispatchRender.forEach(function (cb) { return cb(renderDispatch); }));
7280
+ safeCall(function safeCallAfterDispatchRender() {
7281
+ renderDispatch.callOnAfterDispatchRender(renderDispatch);
7282
+ });
7114
7283
  globalLoop.current = false;
7115
7284
  };
7116
7285
  function finishMountAsync(renderDispatch, fiber) {
@@ -7125,33 +7294,35 @@ function requireIndex_development_1 () {
7125
7294
  safeCallWithCurrentFiber({
7126
7295
  fiber: fiber,
7127
7296
  action: function safeCallFiberHasChangeListener() {
7128
- var _a, _b;
7129
- (_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.fiberHasChange) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(changedList); });
7297
+ renderDispatch.callOnFiberChange(changedList);
7130
7298
  },
7131
7299
  });
7132
7300
  }
7133
7301
  var mountAsync = function (renderDispatch, fiber) { return __awaiter(void 0, void 0, void 0, function () {
7134
- var _a, _b, _c;
7135
- return __generator(this, function (_d) {
7136
- switch (_d.label) {
7302
+ return __generator(this, function (_a) {
7303
+ switch (_a.label) {
7137
7304
  case 0:
7138
- ((_b = (_a = listenerMap.get(renderDispatch)) === null || _a === void 0 ? void 0 : _a.beforeDispatchRender) === null || _b === void 0 ? void 0 : _b.forEach(function (cb) { return cb(renderDispatch); }));
7305
+ safeCall(function safeCallBeforeDispatchRender() {
7306
+ renderDispatch.callOnBeforeDispatchRender(renderDispatch, fiber);
7307
+ });
7139
7308
  globalLoop.current = true;
7140
7309
  enableScopeTreeLog.current && setLogScope();
7141
7310
  mountLoopAll(renderDispatch, fiber);
7142
7311
  return [4 /*yield*/, processAsyncLoadListOnAsyncMount(renderDispatch)];
7143
7312
  case 1:
7144
- _d.sent();
7313
+ _a.sent();
7145
7314
  enableScopeTreeLog.current && resetLogScope();
7146
7315
  finishMountAsync(renderDispatch, fiber);
7147
- ((_c = listenerMap.get(renderDispatch)) === null || _c === void 0 ? void 0 : _c.afterDispatchRender.forEach(function (cb) { return cb(renderDispatch); }));
7316
+ safeCall(function safeCallAfterDispatchRender() {
7317
+ renderDispatch.callOnAfterDispatchRender(renderDispatch);
7318
+ });
7148
7319
  globalLoop.current = false;
7149
7320
  return [2 /*return*/];
7150
7321
  }
7151
7322
  });
7152
7323
  }); };
7153
7324
 
7154
- var version = "0.3.19";
7325
+ var version = "0.3.20";
7155
7326
 
7156
7327
  exports.CustomRenderDispatch = CustomRenderDispatch;
7157
7328
  exports.MyReactFiberNode = MyReactFiberNode;
@@ -7253,7 +7424,6 @@ function requireIndex_development_1 () {
7253
7424
  exports.isErrorBoundariesComponent = isErrorBoundariesComponent;
7254
7425
  exports.isErrorBoundariesInstance = isErrorBoundariesInstance;
7255
7426
  exports.layoutEffect = layoutEffect;
7256
- exports.listenerMap = listenerMap;
7257
7427
  exports.loadLazy = loadLazy;
7258
7428
  exports.loadPromise = loadPromise;
7259
7429
  exports.mountAsync = mountAsync;
@@ -8623,7 +8793,7 @@ var ReconcilerDispatchMount = function (_dispatch, _fiber, config) {
8623
8793
 
8624
8794
  var currentScheduler$1 = require$$0.__my_react_internal__.currentScheduler;
8625
8795
  var enableScopeTreeLog$2 = require$$0.__my_react_shared__.enableScopeTreeLog;
8626
- var ReconcilerDispatchUpdate = function (_dispatch, _list, config) {
8796
+ var ReconcilerDispatchUpdate = function (_dispatch, _list, config, sync) {
8627
8797
  myreactReconcilerExports.beforeSyncUpdate();
8628
8798
  _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
8629
8799
  if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
@@ -8725,7 +8895,7 @@ var ReconcilerDispatchUpdate = function (_dispatch, _list, config) {
8725
8895
  }
8726
8896
  myreactReconcilerExports.addEffectCallback(invokeEffectListTask);
8727
8897
  var renderScheduler = currentScheduler$1.current;
8728
- if (_dispatch.enableConcurrentMode) {
8898
+ if (_dispatch.enableConcurrentMode && !sync) {
8729
8899
  renderScheduler.macroTask(function flushEffect() {
8730
8900
  myreactReconcilerExports.flushEffectCallback();
8731
8901
  });
@@ -8792,11 +8962,11 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8792
8962
  (_a = instance.beforeCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
8793
8963
  });
8794
8964
  myreactReconcilerExports.safeCall(function safeCallBeforeCommitListener() {
8795
- myreactReconcilerExports.listenerMap.get(instance).beforeCommitMount.forEach(function (cb) { return cb(); });
8965
+ instance.callOnBeforeCommitMount(instance);
8796
8966
  });
8797
8967
  ReconcilerDispatchMount(this, _fiber, config);
8798
8968
  myreactReconcilerExports.safeCall(function safeCallAfterCommitListener() {
8799
- myreactReconcilerExports.listenerMap.get(instance).afterCommitMount.forEach(function (cb) { return cb(); });
8969
+ instance.callOnAfterCommitMount(instance);
8800
8970
  });
8801
8971
  myreactReconcilerExports.safeCall(function safeCallAfterCommit() {
8802
8972
  var _a;
@@ -8804,7 +8974,7 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8804
8974
  });
8805
8975
  (_b = config.resetAfterCommit) === null || _b === void 0 ? void 0 : _b.call(config, rootNode);
8806
8976
  };
8807
- ReconcilerDispatch.prototype.reconcileUpdate = function (_list) {
8977
+ ReconcilerDispatch.prototype.reconcileUpdate = function (_list, sync) {
8808
8978
  var _a, _b;
8809
8979
  (_a = config.prepareForCommit) === null || _a === void 0 ? void 0 : _a.call(config, rootNode);
8810
8980
  var instance = this;
@@ -8813,11 +8983,11 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8813
8983
  (_a = instance.beforeUpdate) === null || _a === void 0 ? void 0 : _a.call(instance);
8814
8984
  });
8815
8985
  myreactReconcilerExports.safeCall(function safeCallBeforeUpdateListener() {
8816
- myreactReconcilerExports.listenerMap.get(instance).beforeCommitUpdate.forEach(function (cb) { return cb(); });
8986
+ instance.callOnBeforeCommitUpdate(instance);
8817
8987
  });
8818
- ReconcilerDispatchUpdate(this, _list, config);
8988
+ ReconcilerDispatchUpdate(this, _list, config, sync);
8819
8989
  myreactReconcilerExports.safeCall(function safeCallAfterUpdateListener() {
8820
- myreactReconcilerExports.listenerMap.get(instance).afterCommitUpdate.forEach(function (cb) { return cb(); });
8990
+ instance.callOnAfterCommitUpdate(instance);
8821
8991
  });
8822
8992
  myreactReconcilerExports.safeCall(function safeCallAfterUpdate() {
8823
8993
  var _a;
@@ -9074,7 +9244,7 @@ var Reconciler = function (_config) {
9074
9244
  };
9075
9245
  };
9076
9246
 
9077
- var version = "0.0.10";
9247
+ var version = "0.0.11";
9078
9248
  var createReconciler = Reconciler;
9079
9249
 
9080
9250
  exports.createReconciler = createReconciler;