@my-react/react-reconciler-compact 0.0.9 → 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.
@@ -183,6 +183,7 @@ function requireIndex_development_1 () {
183
183
  var ScopeSuspense = Symbol.for("react.scope_suspense");
184
184
  var Comment = Symbol.for("react.comment");
185
185
  var Offscreen = Symbol.for("react.offscreen");
186
+ var Activity = Symbol.for("react.activity");
186
187
  var Profiler = Symbol.for("react.profiler");
187
188
 
188
189
  function isObject(target) {
@@ -282,6 +283,7 @@ function requireIndex_development_1 () {
282
283
  HOOK_TYPE[HOOK_TYPE["useImperativeHandle"] = 14] = "useImperativeHandle";
283
284
  HOOK_TYPE[HOOK_TYPE["useSyncExternalStore"] = 15] = "useSyncExternalStore";
284
285
  HOOK_TYPE[HOOK_TYPE["useOptimistic"] = 16] = "useOptimistic";
286
+ HOOK_TYPE[HOOK_TYPE["useEffectEvent"] = 17] = "useEffectEvent";
285
287
  })(exports.HOOK_TYPE || (exports.HOOK_TYPE = {}));
286
288
 
287
289
  exports.UpdateQueueType = void 0;
@@ -704,6 +706,7 @@ function requireIndex_development_1 () {
704
706
  });
705
707
  }
706
708
 
709
+ exports.Activity = Activity;
707
710
  exports.Comment = Comment;
708
711
  exports.Consumer = Consumer;
709
712
  exports.Context = Context;
@@ -893,6 +896,7 @@ function requireIndex_development_1 () {
893
896
  NODE_TYPE[NODE_TYPE["__context__"] = 524288] = "__context__";
894
897
  NODE_TYPE[NODE_TYPE["__scopeLazy__"] = 1048576] = "__scopeLazy__";
895
898
  NODE_TYPE[NODE_TYPE["__scopeSuspense__"] = 2097152] = "__scopeSuspense__";
899
+ NODE_TYPE[NODE_TYPE["__activity__"] = 4194304] = "__activity__";
896
900
  })(exports.NODE_TYPE || (exports.NODE_TYPE = {}));
897
901
 
898
902
  var enableSyncFlush$1 = react.__my_react_shared__.enableSyncFlush;
@@ -1012,13 +1016,8 @@ function requireIndex_development_1 () {
1012
1016
  var renderDispatch = getCurrentDispatchFromFiber(fiber);
1013
1017
  safeCallWithCurrentFiber({
1014
1018
  fiber: fiber,
1015
- action: function safeCallFiberWarnListener() {
1016
- var _a, _b;
1017
- try {
1018
- (_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)); });
1019
- }
1020
- catch (_c) {
1021
- }
1019
+ action: function () {
1020
+ renderDispatch.callOnFiberWarn.apply(renderDispatch, __spreadArray([fiber], args, false));
1022
1021
  },
1023
1022
  });
1024
1023
  };
@@ -1030,13 +1029,8 @@ function requireIndex_development_1 () {
1030
1029
  var renderDispatch = getCurrentDispatchFromFiber(fiber);
1031
1030
  safeCallWithCurrentFiber({
1032
1031
  fiber: fiber,
1033
- action: function safeCallFiberErrorListener() {
1034
- var _a, _b;
1035
- try {
1036
- (_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)); });
1037
- }
1038
- catch (_c) {
1039
- }
1032
+ action: function () {
1033
+ renderDispatch.callOnFiberError.apply(renderDispatch, __spreadArray([fiber], args, false));
1040
1034
  },
1041
1035
  });
1042
1036
  };
@@ -1516,6 +1510,9 @@ function requireIndex_development_1 () {
1516
1510
  case myreactSharedExports.Profiler:
1517
1511
  nodeType = myreactSharedExports.merge(nodeType, exports.NODE_TYPE.__profiler__);
1518
1512
  break;
1513
+ case myreactSharedExports.Activity:
1514
+ nodeType = myreactSharedExports.merge(nodeType, exports.NODE_TYPE.__activity__);
1515
+ break;
1519
1516
  default:
1520
1517
  throw new Error("[@my-react/react] invalid symbol element type \"".concat(elementType === null || elementType === void 0 ? void 0 : elementType.toString(), "\""));
1521
1518
  }
@@ -2036,8 +2033,7 @@ function requireIndex_development_1 () {
2036
2033
  safeCallWithCurrentFiber({
2037
2034
  fiber: nextFiber,
2038
2035
  action: function safeCallAfterFiberDone() {
2039
- var _a, _b;
2040
- (_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);
2041
2037
  },
2042
2038
  });
2043
2039
  }
@@ -2090,8 +2086,7 @@ function requireIndex_development_1 () {
2090
2086
  safeCallWithCurrentFiber({
2091
2087
  fiber: nextFiber,
2092
2088
  action: function safeCallAfterFiberDone() {
2093
- var _a, _b;
2094
- (_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);
2095
2090
  },
2096
2091
  });
2097
2092
  }
@@ -2361,8 +2356,7 @@ function requireIndex_development_1 () {
2361
2356
  safeCallWithCurrentFiber({
2362
2357
  fiber: fiber,
2363
2358
  action: function safeCallFiberUpdateListener() {
2364
- var _a, _b;
2365
- (_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);
2366
2360
  },
2367
2361
  });
2368
2362
  };
@@ -2569,8 +2563,7 @@ function requireIndex_development_1 () {
2569
2563
  safeCallWithCurrentFiber({
2570
2564
  fiber: fiber,
2571
2565
  action: function safeCallInstanceInitialListener() {
2572
- var _a, _b;
2573
- (_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);
2574
2567
  },
2575
2568
  });
2576
2569
  Object.freeze(instance.state);
@@ -2588,8 +2581,7 @@ function requireIndex_development_1 () {
2588
2581
  safeCallWithCurrentFiber({
2589
2582
  fiber: fiber,
2590
2583
  action: function safeCallInstanceUpdateListener() {
2591
- var _a, _b;
2592
- (_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);
2593
2585
  },
2594
2586
  });
2595
2587
  setOwnerForInstance(typedInstance, fiber);
@@ -2872,8 +2864,7 @@ function requireIndex_development_1 () {
2872
2864
  safeCallWithCurrentFiber({
2873
2865
  fiber: fiber,
2874
2866
  action: function safeCallInstanceUnmountListener() {
2875
- var _a, _b;
2876
- (_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);
2877
2868
  },
2878
2869
  });
2879
2870
  safeCallWithCurrentFiber({
@@ -2974,7 +2965,7 @@ function requireIndex_development_1 () {
2974
2965
  _loop_1();
2975
2966
  }
2976
2967
  if (allQueue.length) {
2977
- renderScheduler.macroTask(function prepareUpdateOnFiberTask() {
2968
+ renderScheduler.microTask(function prepareUpdateOnFiberTask() {
2978
2969
  prepareUpdateOnFiber(renderDispatch, fiber, true);
2979
2970
  });
2980
2971
  }
@@ -3262,7 +3253,7 @@ function requireIndex_development_1 () {
3262
3253
  _loop_3();
3263
3254
  }
3264
3255
  if (allQueue.length) {
3265
- renderScheduler.macroTask(function prepareUpdateOnFiberTask() {
3256
+ renderScheduler.microTask(function prepareUpdateOnFiberTask() {
3266
3257
  prepareUpdateOnFiber(renderDispatch, fiber, true);
3267
3258
  });
3268
3259
  }
@@ -3632,8 +3623,7 @@ function requireIndex_development_1 () {
3632
3623
  safeCallWithCurrentFiber({
3633
3624
  fiber: ownerFiber,
3634
3625
  action: function safeCallFiberStateListener() {
3635
- var _a, _b;
3636
- (_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);
3637
3627
  },
3638
3628
  });
3639
3629
  var isImmediate = _params.isImmediate;
@@ -3674,8 +3664,7 @@ function requireIndex_development_1 () {
3674
3664
  safeCallWithCurrentFiber({
3675
3665
  fiber: ownerFiber,
3676
3666
  action: function safeCallInstanceStateListener() {
3677
- var _a, _b;
3678
- (_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);
3679
3668
  },
3680
3669
  });
3681
3670
  ownerFiber.updateQueue = ownerFiber.updateQueue || new myreactSharedExports.ListTree();
@@ -3718,8 +3707,7 @@ function requireIndex_development_1 () {
3718
3707
  safeCallWithCurrentFiber({
3719
3708
  fiber: ownerFiber,
3720
3709
  action: function safeCallHookStateListener() {
3721
- var _a, _b;
3722
- (_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);
3723
3711
  },
3724
3712
  });
3725
3713
  ownerFiber.updateQueue = ownerFiber.updateQueue || new myreactSharedExports.ListTree();
@@ -3955,7 +3943,6 @@ function requireIndex_development_1 () {
3955
3943
 
3956
3944
  var globalLoop$2 = react.__my_react_internal__.globalLoop, currentScheduler$a = react.__my_react_internal__.currentScheduler;
3957
3945
  var scheduleUpdateFromRoot = function (renderDispatch) {
3958
- var _a, _b, _c, _d;
3959
3946
  flushEffectCallback();
3960
3947
  var allLive = renderDispatch.pendingUpdateFiberArray.getAll().filter(function (f) { return myreactSharedExports.exclude(f.state, myreactSharedExports.STATE_TYPE.__unmount__); });
3961
3948
  renderDispatch.pendingUpdateFiberArray.clear();
@@ -3966,14 +3953,18 @@ function requireIndex_development_1 () {
3966
3953
  allLive.forEach(function (fiber) { return applyTriggerFiberCb(renderDispatch, fiber); });
3967
3954
  if (!renderDispatch.enableConcurrentMode || allLive.some(function (f) { return myreactSharedExports.include(f.state, myreactSharedExports.STATE_TYPE.__triggerSync__ | myreactSharedExports.STATE_TYPE.__triggerSyncForce__); })) {
3968
3955
  {
3969
- (_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
+ });
3970
3959
  }
3971
3960
  updateSyncFromRoot(renderDispatch);
3972
3961
  }
3973
3962
  else {
3974
3963
  renderDispatch.resetYield();
3975
3964
  {
3976
- (_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
+ });
3977
3968
  }
3978
3969
  updateConcurrentFromRoot(renderDispatch);
3979
3970
  }
@@ -4030,20 +4021,20 @@ function requireIndex_development_1 () {
4030
4021
  var globalLoop$1 = react.__my_react_internal__.globalLoop, currentScheduler$9 = react.__my_react_internal__.currentScheduler;
4031
4022
  var enableScopeTreeLog$3 = react.__my_react_shared__.enableScopeTreeLog;
4032
4023
  function finishUpdateSyncFromRoot(renderDispatch) {
4033
- var _a, _b;
4034
4024
  var commitList = renderDispatch.pendingCommitFiberList;
4035
4025
  var changedList = renderDispatch.pendingChangedFiberList;
4036
4026
  renderDispatch.resetUpdateFlowRuntimeFiber();
4037
4027
  renderDispatch.pendingCommitFiberList = null;
4038
4028
  renderDispatch.pendingChangedFiberList = null;
4039
4029
  enableScopeTreeLog$3.current && setLogScope();
4040
- (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);
4041
4031
  enableScopeTreeLog$3.current && resetLogScope();
4042
- ((_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
+ });
4043
4035
  (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
4044
4036
  safeCall(function safeCallFiberHasChangeListener() {
4045
- var _a, _b;
4046
- (_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);
4047
4038
  });
4048
4039
  }
4049
4040
  var updateSyncFromRoot = function (renderDispatch) {
@@ -4060,7 +4051,6 @@ function requireIndex_development_1 () {
4060
4051
  });
4061
4052
  };
4062
4053
  function finishUpdateConcurrentFromRoot(renderDispatch) {
4063
- var _a, _b;
4064
4054
  var commitList = renderDispatch.pendingCommitFiberList;
4065
4055
  var changedList = renderDispatch.pendingChangedFiberList;
4066
4056
  renderDispatch.resetUpdateFlowRuntimeFiber();
@@ -4069,11 +4059,12 @@ function requireIndex_development_1 () {
4069
4059
  enableScopeTreeLog$3.current && setLogScope();
4070
4060
  (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList);
4071
4061
  enableScopeTreeLog$3.current && setLogScope();
4072
- ((_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
+ });
4073
4065
  (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
4074
4066
  safeCall(function safeCallFiberHasChangeListener() {
4075
- var _a, _b;
4076
- (_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);
4077
4068
  });
4078
4069
  }
4079
4070
  function checkNextFiberIsSync(renderDispatch) {
@@ -4103,7 +4094,7 @@ function requireIndex_development_1 () {
4103
4094
  else {
4104
4095
  processAsyncLoadListOnUpdate(renderDispatch);
4105
4096
  finishUpdateConcurrentFromRoot(renderDispatch);
4106
- renderScheduler.macroTask(function callScheduleNext() {
4097
+ renderScheduler.microTask(function callScheduleNext() {
4107
4098
  globalLoop$1.current = false;
4108
4099
  scheduleNext(renderDispatch);
4109
4100
  });
@@ -4133,7 +4124,7 @@ function requireIndex_development_1 () {
4133
4124
  else {
4134
4125
  processAsyncLoadListOnUpdate(renderDispatch);
4135
4126
  finishUpdateConcurrentFromRoot(renderDispatch);
4136
- renderScheduler.macroTask(function callScheduleNext() {
4127
+ renderScheduler.microTask(function callScheduleNext() {
4137
4128
  globalLoop$1.current = false;
4138
4129
  scheduleNext(renderDispatch);
4139
4130
  });
@@ -4166,6 +4157,11 @@ function requireIndex_development_1 () {
4166
4157
  throw new Error("[@my-react/react] ".concat(myreactSharedExports.HOOK_TYPE[hookNode.type], " initial error"));
4167
4158
  }
4168
4159
  }
4160
+ if (hookNode.type === myreactSharedExports.HOOK_TYPE.useEffectEvent) {
4161
+ if (typeof hookNode.value !== "function") {
4162
+ throw new Error("[@my-react/react] ".concat(myreactSharedExports.HOOK_TYPE[hookNode.type], " initial error"));
4163
+ }
4164
+ }
4169
4165
  };
4170
4166
 
4171
4167
  var MyReactInternalInstance$4 = react.__my_react_internal__.MyReactInternalInstance, currentScheduler$8 = react.__my_react_internal__.currentScheduler;
@@ -4277,7 +4273,10 @@ function requireIndex_development_1 () {
4277
4273
  hookNode.result = hookNode.value;
4278
4274
  hookNode.hasEffect = true;
4279
4275
  }
4280
- if (hookNode.type === myreactSharedExports.HOOK_TYPE.useRef || hookNode.type === myreactSharedExports.HOOK_TYPE.useCallback || hookNode.type === myreactSharedExports.HOOK_TYPE.useDeferredValue) {
4276
+ if (hookNode.type === myreactSharedExports.HOOK_TYPE.useRef ||
4277
+ hookNode.type === myreactSharedExports.HOOK_TYPE.useCallback ||
4278
+ hookNode.type === myreactSharedExports.HOOK_TYPE.useDeferredValue ||
4279
+ hookNode.type === myreactSharedExports.HOOK_TYPE.useEffectEvent) {
4281
4280
  hookNode.result = hookNode.value;
4282
4281
  }
4283
4282
  // cache ref state from recreate
@@ -4656,6 +4655,13 @@ function requireIndex_development_1 () {
4656
4655
  // currentHook._update({ isForce: true, payLoad: (last) => ({ value: value.value, start: last.start }) });
4657
4656
  }
4658
4657
  }
4658
+ if (currentHook.type === myreactSharedExports.HOOK_TYPE.useEffectEvent) {
4659
+ if (typeof value !== "function") {
4660
+ throw new Error("[@my-react/react] useEffectEvent should be a function");
4661
+ }
4662
+ currentHook.value = value;
4663
+ currentHook.result = value;
4664
+ }
4659
4665
  if (currentHook.type === myreactSharedExports.HOOK_TYPE.useDebugValue) {
4660
4666
  if (!myreactSharedExports.isArrayEquals(currentHook.value, value)) {
4661
4667
  currentHook.value = value;
@@ -4674,8 +4680,7 @@ function requireIndex_development_1 () {
4674
4680
  safeCallWithCurrentFiber({
4675
4681
  fiber: fiber,
4676
4682
  action: function safeCallHookUnmountListener() {
4677
- var _a, _b;
4678
- (_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);
4679
4684
  },
4680
4685
  });
4681
4686
  safeCallWithCurrentFiber({
@@ -4732,8 +4737,7 @@ function requireIndex_development_1 () {
4732
4737
  safeCallWithCurrentFiber({
4733
4738
  fiber: fiber,
4734
4739
  action: function safeCallFiberHMRListener() {
4735
- var _a, _b;
4736
- (_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);
4737
4741
  },
4738
4742
  });
4739
4743
  return fiber;
@@ -4790,8 +4794,7 @@ function requireIndex_development_1 () {
4790
4794
  safeCallWithCurrentFiber({
4791
4795
  fiber: fiber,
4792
4796
  action: function safeCallFiberTriggerListener() {
4793
- var _a, _b;
4794
- (_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);
4795
4798
  },
4796
4799
  });
4797
4800
  // TODO get from updateState ?
@@ -4963,8 +4966,7 @@ function requireIndex_development_1 () {
4963
4966
  safeCallWithCurrentFiber({
4964
4967
  fiber: newFiberNode,
4965
4968
  action: function safeCallFiberInitialListener() {
4966
- var _a, _b;
4967
- (_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);
4968
4970
  },
4969
4971
  });
4970
4972
  if (myreactSharedExports.exclude(newFiberNode.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -5015,7 +5017,6 @@ function requireIndex_development_1 () {
5015
5017
  }
5016
5018
  }
5017
5019
  if (prevRef !== nextRef) {
5018
- fiber.refPrevious = prevRef;
5019
5020
  renderDispatch.pendingRef(fiber);
5020
5021
  }
5021
5022
  if (fiber !== prevFiber) {
@@ -5044,8 +5045,7 @@ function requireIndex_development_1 () {
5044
5045
  safeCallWithCurrentFiber({
5045
5046
  fiber: fiber,
5046
5047
  action: function safeCallFiberInitialListener() {
5047
- var _a, _b;
5048
- (_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);
5049
5049
  },
5050
5050
  });
5051
5051
  if (myreactSharedExports.exclude(fiber.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -5083,8 +5083,7 @@ function requireIndex_development_1 () {
5083
5083
  safeCallWithCurrentFiber({
5084
5084
  fiber: fiber,
5085
5085
  action: function safeCallFiberUnmountListener() {
5086
- var _a, _b;
5087
- (_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);
5088
5087
  },
5089
5088
  });
5090
5089
  renderDispatch.runtimeMap.insertionEffectMap.delete(fiber);
@@ -5275,6 +5274,14 @@ function requireIndex_development_1 () {
5275
5274
  }
5276
5275
  };
5277
5276
 
5277
+ // TODO
5278
+ var processActivity = function (fiber) {
5279
+ var props = fiber.pendingProps;
5280
+ if (props.mode === "visible")
5281
+ return props.children;
5282
+ return null;
5283
+ };
5284
+
5278
5285
  var currentComponentFiber$2 = react.__my_react_internal__.currentComponentFiber, MyReactInternalInstance$3 = react.__my_react_internal__.MyReactInternalInstance;
5279
5286
  var processProvider = function (renderDispatch, fiber) {
5280
5287
  if (renderDispatch.isAppMounted) {
@@ -5489,6 +5496,28 @@ function requireIndex_development_1 () {
5489
5496
  }
5490
5497
  };
5491
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
+
5492
5521
  var MyReactInternalInstanceClass$1 = react.__my_react_internal__.MyReactInternalInstance, instanceToInitialFieldMap = react.__my_react_internal__.instanceToInitialFieldMap;
5493
5522
  // support private instance field
5494
5523
  var instanceMap = instanceToInitialFieldMap;
@@ -5603,7 +5632,7 @@ function requireIndex_development_1 () {
5603
5632
  });
5604
5633
  }
5605
5634
 
5606
- 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;
5607
5636
  var enablePerformanceLog = react.__my_react_shared__.enablePerformanceLog, enableDebugFiled$2 = react.__my_react_shared__.enableDebugFiled;
5608
5637
  var nextWorkCommon = function (renderDispatch, fiber, children) {
5609
5638
  if (myreactSharedExports.isPromise(children)) {
@@ -5674,9 +5703,13 @@ function requireIndex_development_1 () {
5674
5703
  var children = processConsumer(renderDispatch, fiber);
5675
5704
  nextWorkCommon(renderDispatch, fiber, children);
5676
5705
  };
5706
+ var nextWorkActivity = function (renderDispatch, fiber) {
5707
+ var children = processActivity(fiber);
5708
+ nextWorkCommon(renderDispatch, fiber, children);
5709
+ };
5677
5710
  var nextWorkRoot = function (renderDispatch, fiber) {
5678
5711
  var isUpdate = !!fiber.instance;
5679
- fiber.instance = fiber.instance || new MyReactInternalInstance$2();
5712
+ fiber.instance = fiber.instance || new MyReactInternalInstance$1();
5680
5713
  !isUpdate && initInstance(fiber.instance);
5681
5714
  !isUpdate && initVisibleInstance(fiber.instance);
5682
5715
  !isUpdate && setOwnerForInstance(fiber.instance, fiber);
@@ -5695,8 +5728,7 @@ function requireIndex_development_1 () {
5695
5728
  safeCallWithCurrentFiber({
5696
5729
  fiber: fiber,
5697
5730
  action: function safeCallFiberRunListener() {
5698
- var _a, _b;
5699
- (_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);
5700
5732
  },
5701
5733
  });
5702
5734
  setRefreshTypeMap(fiber);
@@ -5713,8 +5745,7 @@ function requireIndex_development_1 () {
5713
5745
  safeCallWithCurrentFiber({
5714
5746
  fiber: fiber,
5715
5747
  action: function safeCallPerformanceWarnListener() {
5716
- var _a, _b;
5717
- (_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);
5718
5749
  },
5719
5750
  });
5720
5751
  }
@@ -5745,134 +5776,569 @@ function requireIndex_development_1 () {
5745
5776
  safeCallWithCurrentFiber({
5746
5777
  fiber: fiber,
5747
5778
  action: function safeCallFiberRunListener() {
5748
- var _a, _b;
5749
- (_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);
5750
5780
  },
5751
5781
  });
5752
5782
  };
5753
5783
 
5754
- var initSuspenseInstance = function (instance) {
5755
- var field = getInstanceFieldByInstance(instance);
5756
- if (!field)
5757
- throw new Error("[@my-react/react] can not get field for instance, this is a bug for @my-react");
5758
- var typedField = field;
5759
- typedField.isHidden = false;
5760
- 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
+ }
5761
5794
  };
5762
-
5763
- var MyReactInternalInstance$1 = react.__my_react_internal__.MyReactInternalInstance;
5764
- 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
+ }
5765
5828
  var isUpdate = !!fiber.instance;
5766
- fiber.instance = fiber.instance || new MyReactInternalInstance$1();
5829
+ fiber.instance = fiber.instance || new MyReactInternalInstance();
5767
5830
  !isUpdate && initInstance(fiber.instance);
5768
- !isUpdate && initVisibleInstance(fiber.instance);
5769
- !isUpdate && initSuspenseInstance(fiber.instance);
5770
5831
  !isUpdate && setOwnerForInstance(fiber.instance, fiber);
5771
- var instanceField = getInstanceFieldByInstance(fiber.instance);
5772
- var children = WrapperBySuspenseScope(instanceField.isHidden ? fiber.pendingProps.fallback : fiber.pendingProps.children);
5773
- return children;
5832
+ var contextFiber = defaultGetContextFiber(fiber, Context);
5833
+ setSubscribeForInstance(fiber.instance, contextFiber);
5834
+ return defaultGetContextValue(contextFiber, Context);
5774
5835
  };
5775
-
5776
- var Dispatcher = react.__my_react_internal__.Dispatcher, MyReactInternalInstanceClass = react.__my_react_internal__.MyReactInternalInstance, dispatchToListenerMap = react.__my_react_internal__.dispatchToListenerMap;
5777
- var getInitialListeners = function () {
5778
- return {
5779
- fiberInitial: new Set(),
5780
- fiberUpdate: new Set(),
5781
- fiberHasChange: new Set(),
5782
- fiberUnmount: new Set(),
5783
- fiberHMR: new Set(),
5784
- beforeFiberRun: new Set(),
5785
- afterFiberRun: new Set(),
5786
- afterFiberDone: new Set(),
5787
- beforeDispatchRender: new Set(),
5788
- afterDispatchRender: new Set(),
5789
- fiberWarn: new Set(),
5790
- fiberError: new Set(),
5791
- fiberState: new Set(),
5792
- fiberTrigger: new Set(),
5793
- performanceWarn: new Set(),
5794
- instanceInitial: new Set(),
5795
- instanceUpdate: new Set(),
5796
- instanceState: new Set(),
5797
- instanceUnmount: new Set(),
5798
- hookInitial: new Set(),
5799
- hookUpdate: new Set(),
5800
- hookState: new Set(),
5801
- hookUnmount: new Set(),
5802
- beforeCommitMount: new Set(),
5803
- afterCommitMount: new Set(),
5804
- beforeCommitUpdate: new Set(),
5805
- afterCommitUpdate: new Set(),
5806
- beforeCommitUnmount: new Set(),
5807
- 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__;
5808
5843
  }
5809
- ;
5810
- };
5811
- var getInitialMap = function () { return ({
5812
- effectMap: new MyWeakMap(),
5813
- layoutEffectMap: new MyWeakMap(),
5814
- insertionEffectMap: new MyWeakMap(),
5815
- unmountMap: new MyWeakMap(),
5816
- eventMap: new MyWeakMap(),
5817
- triggerCallbackMap: new MyWeakMap(),
5818
- }); };
5819
- var getInitialFiber = function () { return ({
5820
- scheduledFiber: null,
5821
- errorCatchFiber: null,
5822
- nextWorkingFiber: null,
5823
- retriggerFiber: null,
5824
- }); };
5825
- var initialRef = {
5826
- typeForRef: exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__class__,
5827
- typeForCreate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5828
- typeForUpdate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5829
- typeForAppend: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5830
- typeForNativeNode: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5831
- };
5832
- var listenerMap = dispatchToListenerMap;
5833
- var RenderDispatchEvent = /** @class */ (function (_super) {
5834
- __extends(RenderDispatchEvent, _super);
5835
- function RenderDispatchEvent() {
5836
- var _this = _super.call(this) || this;
5837
- _this.dispatcher = Dispatcher;
5838
- _this.runtimeRef = initialRef;
5839
- _this.runtimeMap = getInitialMap();
5840
- _this.runtimeFiber = getInitialFiber();
5841
- listenerMap.set(_this, getInitialListeners());
5842
- initInstance(_this);
5843
- initVisibleInstance(_this);
5844
- initSuspenseInstance(_this);
5845
- Object.defineProperty(_this, "dispatcher", {
5846
- value: Dispatcher,
5847
- writable: false,
5848
- enumerable: false,
5849
- configurable: false,
5850
- });
5851
- return _this;
5852
- }
5853
- RenderDispatchEvent.prototype.getFiberTree = function (_fiber) {
5854
- throw new Error("Method not implemented.");
5855
- };
5856
- RenderDispatchEvent.prototype.readPromise = function (_params) {
5857
- throw new Error("Method not implemented.");
5858
- };
5859
- RenderDispatchEvent.prototype.readContext = function (_params) {
5860
- throw new Error("Method not implemented.");
5861
- };
5862
- RenderDispatchEvent.prototype.dispatchHook = function (_params) {
5863
- throw new Error("Method not implemented.");
5864
- };
5865
- RenderDispatchEvent.prototype.dispatchState = function (_params) {
5866
- throw new Error("Method not implemented.");
5867
- };
5868
- RenderDispatchEvent.prototype.dispatchError = function (_params) {
5869
- throw new Error("Method not implemented.");
5870
- };
5871
- RenderDispatchEvent.prototype.dispatchPromise = function (_params) {
5872
- 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,
5873
5855
  };
5874
- RenderDispatchEvent.prototype.dispatchSuspensePromise = function (_params) {
5875
- throw new Error("Method not implemented.");
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,
5876
+ };
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.");
5876
6342
  };
5877
6343
  RenderDispatchEvent.prototype.trigger = function (_fiber, _state, cb) {
5878
6344
  return triggerUpdateOnFiber(_fiber, _state, cb);
@@ -5943,11 +6409,29 @@ function requireIndex_development_1 () {
5943
6409
  };
5944
6410
  set.add(onceCb);
5945
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
+ };
5946
6417
  RenderDispatchEvent.prototype.onFiberUpdate = function (cb) {
5947
6418
  var set = listenerMap.get(this).fiberUpdate;
5948
6419
  set.add(cb);
5949
6420
  return function () { return set.delete(cb); };
5950
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
+ };
5951
6435
  RenderDispatchEvent.prototype.onFiberChange = function (cb) {
5952
6436
  var set = listenerMap.get(this).fiberHasChange;
5953
6437
  set.add(cb);
@@ -5961,13 +6445,10 @@ function requireIndex_development_1 () {
5961
6445
  };
5962
6446
  set.add(onceCb);
5963
6447
  };
5964
- RenderDispatchEvent.prototype.onceFiberUpdate = function (cb) {
5965
- var set = listenerMap.get(this).fiberUpdate;
5966
- var onceCb = function (_fiber) {
5967
- cb(_fiber);
5968
- set.delete(onceCb);
5969
- };
5970
- 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); });
5971
6452
  };
5972
6453
  RenderDispatchEvent.prototype.onFiberUnmount = function (cb) {
5973
6454
  var set = listenerMap.get(this).fiberUnmount;
@@ -5982,6 +6463,11 @@ function requireIndex_development_1 () {
5982
6463
  };
5983
6464
  set.add(onceCb);
5984
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
+ };
5985
6471
  RenderDispatchEvent.prototype.onFiberState = function (cb) {
5986
6472
  var set = listenerMap.get(this).fiberState;
5987
6473
  set.add(cb);
@@ -5995,6 +6481,11 @@ function requireIndex_development_1 () {
5995
6481
  };
5996
6482
  set.add(onceCb);
5997
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
+ };
5998
6489
  RenderDispatchEvent.prototype.onFiberTrigger = function (cb) {
5999
6490
  var set = listenerMap.get(this).fiberTrigger;
6000
6491
  set.add(cb);
@@ -6008,6 +6499,11 @@ function requireIndex_development_1 () {
6008
6499
  };
6009
6500
  set.add(onceCb);
6010
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
+ };
6011
6507
  RenderDispatchEvent.prototype.onFiberHMR = function (cb) {
6012
6508
  var _a;
6013
6509
  var set = listenerMap.get(this).fiberHMR;
@@ -6024,6 +6520,11 @@ function requireIndex_development_1 () {
6024
6520
  };
6025
6521
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6026
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
+ };
6027
6528
  RenderDispatchEvent.prototype.onFiberWarn = function (cb) {
6028
6529
  var _a;
6029
6530
  var set = listenerMap.get(this).fiberWarn;
@@ -6040,6 +6541,15 @@ function requireIndex_development_1 () {
6040
6541
  };
6041
6542
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6042
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
+ };
6043
6553
  RenderDispatchEvent.prototype.onFiberError = function (cb) {
6044
6554
  var _a;
6045
6555
  var set = listenerMap.get(this).fiberError;
@@ -6056,6 +6566,15 @@ function requireIndex_development_1 () {
6056
6566
  };
6057
6567
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6058
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
+ };
6059
6578
  RenderDispatchEvent.prototype.onPerformanceWarn = function (cb) {
6060
6579
  var _a;
6061
6580
  var set = listenerMap.get(this).performanceWarn;
@@ -6065,13 +6584,18 @@ function requireIndex_development_1 () {
6065
6584
  RenderDispatchEvent.prototype.oncePerformanceWarn = function (cb) {
6066
6585
  var _a;
6067
6586
  var set = listenerMap.get(this).performanceWarn;
6068
- var onceCb = function (_fiber) {
6587
+ var onceCb = function (_fiber, _renderTime) {
6069
6588
  var _a;
6070
- cb(_fiber);
6589
+ cb(_fiber, _renderTime);
6071
6590
  (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6072
6591
  };
6073
6592
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6074
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
+ };
6075
6599
  RenderDispatchEvent.prototype.onBeforeFiberRun = function (cb) {
6076
6600
  var _a;
6077
6601
  var set = listenerMap.get(this).beforeFiberRun;
@@ -6088,6 +6612,11 @@ function requireIndex_development_1 () {
6088
6612
  };
6089
6613
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6090
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
+ };
6091
6620
  RenderDispatchEvent.prototype.onAfterFiberRun = function (cb) {
6092
6621
  var _a;
6093
6622
  var set = listenerMap.get(this).afterFiberRun;
@@ -6104,6 +6633,11 @@ function requireIndex_development_1 () {
6104
6633
  };
6105
6634
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6106
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
+ };
6107
6641
  RenderDispatchEvent.prototype.onAfterFiberDone = function (cb) {
6108
6642
  var _a;
6109
6643
  var set = listenerMap.get(this).afterFiberDone;
@@ -6120,6 +6654,11 @@ function requireIndex_development_1 () {
6120
6654
  };
6121
6655
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6122
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
+ };
6123
6662
  RenderDispatchEvent.prototype.onBeforeDispatchRender = function (cb) {
6124
6663
  var _a;
6125
6664
  var set = listenerMap.get(this).beforeDispatchRender;
@@ -6129,6 +6668,27 @@ function requireIndex_development_1 () {
6129
6668
  RenderDispatchEvent.prototype.onceBeforeDispatchRender = function (cb) {
6130
6669
  var _a;
6131
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;
6132
6692
  var onceCb = function (renderDispatch) {
6133
6693
  var _a;
6134
6694
  cb(renderDispatch);
@@ -6136,6 +6696,11 @@ function requireIndex_development_1 () {
6136
6696
  };
6137
6697
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6138
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
+ };
6139
6704
  RenderDispatchEvent.prototype.onBeforeDispatchUpdate = function (cb) {
6140
6705
  var _a;
6141
6706
  var set = listenerMap.get(this).beforeDispatchUpdate;
@@ -6152,6 +6717,32 @@ function requireIndex_development_1 () {
6152
6717
  };
6153
6718
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6154
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
+ };
6155
6746
  RenderDispatchEvent.prototype.onInstanceInitial = function (cb) {
6156
6747
  var set = listenerMap.get(this).instanceInitial;
6157
6748
  set.add(cb);
@@ -6165,6 +6756,11 @@ function requireIndex_development_1 () {
6165
6756
  };
6166
6757
  set.add(onceCb);
6167
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
+ };
6168
6764
  RenderDispatchEvent.prototype.onInstanceUpdate = function (cb) {
6169
6765
  var set = listenerMap.get(this).instanceUpdate;
6170
6766
  set.add(cb);
@@ -6178,6 +6774,11 @@ function requireIndex_development_1 () {
6178
6774
  };
6179
6775
  set.add(onceCb);
6180
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
+ };
6181
6782
  RenderDispatchEvent.prototype.onInstanceState = function (cb) {
6182
6783
  var set = listenerMap.get(this).instanceState;
6183
6784
  set.add(cb);
@@ -6191,6 +6792,11 @@ function requireIndex_development_1 () {
6191
6792
  };
6192
6793
  set.add(onceCb);
6193
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
+ };
6194
6800
  RenderDispatchEvent.prototype.onInstanceUnmount = function (cb) {
6195
6801
  var set = listenerMap.get(this).instanceUnmount;
6196
6802
  set.add(cb);
@@ -6204,6 +6810,11 @@ function requireIndex_development_1 () {
6204
6810
  };
6205
6811
  set.add(onceCb);
6206
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
+ };
6207
6818
  RenderDispatchEvent.prototype.onHookInitial = function (cb) {
6208
6819
  var set = listenerMap.get(this).hookInitial;
6209
6820
  set.add(cb);
@@ -6211,12 +6822,17 @@ function requireIndex_development_1 () {
6211
6822
  };
6212
6823
  RenderDispatchEvent.prototype.onceHookInitial = function (cb) {
6213
6824
  var set = listenerMap.get(this).hookInitial;
6214
- var onceCb = function (_hook) {
6215
- cb(_hook);
6825
+ var onceCb = function (_hook, _fiber) {
6826
+ cb(_hook, _fiber);
6216
6827
  set.delete(onceCb);
6217
6828
  };
6218
6829
  set.add(onceCb);
6219
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
+ };
6220
6836
  RenderDispatchEvent.prototype.onHookUpdate = function (cb) {
6221
6837
  var set = listenerMap.get(this).hookUpdate;
6222
6838
  set.add(cb);
@@ -6224,12 +6840,17 @@ function requireIndex_development_1 () {
6224
6840
  };
6225
6841
  RenderDispatchEvent.prototype.onceHookUpdate = function (cb) {
6226
6842
  var set = listenerMap.get(this).hookUpdate;
6227
- var onceCb = function (_hook) {
6228
- cb(_hook);
6843
+ var onceCb = function (_hook, _fiber) {
6844
+ cb(_hook, _fiber);
6229
6845
  set.delete(onceCb);
6230
6846
  };
6231
6847
  set.add(onceCb);
6232
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
+ };
6233
6854
  RenderDispatchEvent.prototype.onHookUnmount = function (cb) {
6234
6855
  var set = listenerMap.get(this).hookUnmount;
6235
6856
  set.add(cb);
@@ -6237,12 +6858,17 @@ function requireIndex_development_1 () {
6237
6858
  };
6238
6859
  RenderDispatchEvent.prototype.onceHookUnmount = function (cb) {
6239
6860
  var set = listenerMap.get(this).hookUnmount;
6240
- var onceCb = function (_hook) {
6241
- cb(_hook);
6861
+ var onceCb = function (_hook, _fiber) {
6862
+ cb(_hook, _fiber);
6242
6863
  set.delete(onceCb);
6243
6864
  };
6244
6865
  set.add(onceCb);
6245
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
+ };
6246
6872
  RenderDispatchEvent.prototype.onHookState = function (cb) {
6247
6873
  var set = listenerMap.get(this).hookState;
6248
6874
  set.add(cb);
@@ -6256,6 +6882,11 @@ function requireIndex_development_1 () {
6256
6882
  };
6257
6883
  set.add(onceCb);
6258
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
+ };
6259
6890
  RenderDispatchEvent.prototype.onBeforeCommitMount = function (cb) {
6260
6891
  var set = listenerMap.get(this).beforeCommitMount;
6261
6892
  set.add(cb);
@@ -6263,12 +6894,17 @@ function requireIndex_development_1 () {
6263
6894
  };
6264
6895
  RenderDispatchEvent.prototype.onceBeforeCommitMount = function (cb) {
6265
6896
  var set = listenerMap.get(this).beforeCommitMount;
6266
- var onceCb = function () {
6267
- cb();
6897
+ var onceCb = function (renderDispatch) {
6898
+ cb(renderDispatch);
6268
6899
  set.delete(onceCb);
6269
6900
  };
6270
6901
  set.add(onceCb);
6271
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
+ };
6272
6908
  RenderDispatchEvent.prototype.onAfterCommitMount = function (cb) {
6273
6909
  var set = listenerMap.get(this).afterCommitMount;
6274
6910
  set.add(cb);
@@ -6276,12 +6912,17 @@ function requireIndex_development_1 () {
6276
6912
  };
6277
6913
  RenderDispatchEvent.prototype.onceAfterCommitMount = function (cb) {
6278
6914
  var set = listenerMap.get(this).afterCommitMount;
6279
- var onceCb = function () {
6280
- cb();
6915
+ var onceCb = function (renderDispatch) {
6916
+ cb(renderDispatch);
6281
6917
  set.delete(onceCb);
6282
6918
  };
6283
6919
  set.add(onceCb);
6284
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
+ };
6285
6926
  RenderDispatchEvent.prototype.onBeforeCommitUpdate = function (cb) {
6286
6927
  var set = listenerMap.get(this).beforeCommitUpdate;
6287
6928
  set.add(cb);
@@ -6289,12 +6930,17 @@ function requireIndex_development_1 () {
6289
6930
  };
6290
6931
  RenderDispatchEvent.prototype.onceBeforeCommitUpdate = function (cb) {
6291
6932
  var set = listenerMap.get(this).beforeCommitUpdate;
6292
- var onceCb = function () {
6293
- cb();
6933
+ var onceCb = function (renderDispatch) {
6934
+ cb(renderDispatch);
6294
6935
  set.delete(onceCb);
6295
6936
  };
6296
6937
  set.add(onceCb);
6297
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
+ };
6298
6944
  RenderDispatchEvent.prototype.onAfterCommitUpdate = function (cb) {
6299
6945
  var set = listenerMap.get(this).afterCommitUpdate;
6300
6946
  set.add(cb);
@@ -6302,12 +6948,17 @@ function requireIndex_development_1 () {
6302
6948
  };
6303
6949
  RenderDispatchEvent.prototype.onceAfterCommitUpdate = function (cb) {
6304
6950
  var set = listenerMap.get(this).afterCommitUpdate;
6305
- var onceCb = function () {
6306
- cb();
6951
+ var onceCb = function (renderDispatch) {
6952
+ cb(renderDispatch);
6307
6953
  set.delete(onceCb);
6308
6954
  };
6309
6955
  set.add(onceCb);
6310
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
+ };
6311
6962
  RenderDispatchEvent.prototype.onBeforeCommitUnmount = function (cb) {
6312
6963
  var set = listenerMap.get(this).beforeCommitUnmount;
6313
6964
  set.add(cb);
@@ -6315,12 +6966,17 @@ function requireIndex_development_1 () {
6315
6966
  };
6316
6967
  RenderDispatchEvent.prototype.onceBeforeCommitUnmount = function (cb) {
6317
6968
  var set = listenerMap.get(this).beforeCommitUnmount;
6318
- var onceCb = function () {
6319
- cb();
6969
+ var onceCb = function (renderDispatch) {
6970
+ cb(renderDispatch);
6320
6971
  set.delete(onceCb);
6321
6972
  };
6322
6973
  set.add(onceCb);
6323
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
+ };
6324
6980
  RenderDispatchEvent.prototype.onAfterCommitUnmount = function (cb) {
6325
6981
  var set = listenerMap.get(this).afterCommitUnmount;
6326
6982
  set.add(cb);
@@ -6328,12 +6984,17 @@ function requireIndex_development_1 () {
6328
6984
  };
6329
6985
  RenderDispatchEvent.prototype.onceAfterCommitUnmount = function (cb) {
6330
6986
  var set = listenerMap.get(this).afterCommitUnmount;
6331
- var onceCb = function () {
6332
- cb();
6987
+ var onceCb = function (renderDispatch) {
6988
+ cb(renderDispatch);
6333
6989
  set.delete(onceCb);
6334
6990
  };
6335
6991
  set.add(onceCb);
6336
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
+ };
6337
6998
  return RenderDispatchEvent;
6338
6999
  }(MyReactInternalInstanceClass));
6339
7000
 
@@ -6345,325 +7006,24 @@ function requireIndex_development_1 () {
6345
7006
  else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__class__ | exports.NODE_TYPE.__function__)) {
6346
7007
  nextWorkComponent(renderDispatch, fiber);
6347
7008
  }
6348
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__lazy__)) {
6349
- nextWorkLazy(renderDispatch, fiber);
6350
- }
6351
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__suspense__)) {
6352
- nextWorkSuspense(renderDispatch, fiber);
6353
- }
6354
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__consumer__)) {
6355
- nextWorkConsumer(renderDispatch, fiber);
6356
- }
6357
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__provider__ | exports.NODE_TYPE.__context__)) {
6358
- nextWorkProvider(renderDispatch, fiber);
6359
- }
6360
- else {
6361
- nextWorkNormal(renderDispatch, fiber);
6362
- }
6363
- };
6364
-
6365
- var currentScheduler$2 = react.__my_react_internal__.currentScheduler;
6366
- var enableScopeTreeLog$2 = react.__my_react_shared__.enableScopeTreeLog;
6367
- // TODO improve
6368
- var defaultDispatchMountLatest = function (_dispatch, _fiber) {
6369
- beforeSyncUpdate();
6370
- var _list = generateFiberToListWithAction(_fiber, function invokeUnmountPendingList(_fiber) {
6371
- defaultInvokeUnmountList(_dispatch, _fiber);
6372
- });
6373
- _list.listToFoot(function invokeInsertionEffectList(_fiber) {
6374
- insertionEffect(_dispatch, _fiber);
6375
- });
6376
- afterSyncUpdate();
6377
- _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
6378
- safeCallWithCurrentFiber({
6379
- fiber: _fiber,
6380
- action: function safeCallCreateAndUpdate() {
6381
- _dispatch.commitCreate(_fiber);
6382
- _dispatch.commitUpdate(_fiber);
6383
- },
6384
- });
6385
- });
6386
- _list.listToFoot(function invokeAppendList(_fiber) {
6387
- safeCallWithCurrentFiber({
6388
- fiber: _fiber,
6389
- action: function safeCallAppendList() {
6390
- _dispatch.commitAppend(_fiber);
6391
- },
6392
- });
6393
- });
6394
- _list.listToFoot(function invokeSetRefList(_fiber) {
6395
- safeCallWithCurrentFiber({
6396
- fiber: _fiber,
6397
- action: function safeCallSetRefList() {
6398
- _dispatch.commitSetRef(_fiber);
6399
- },
6400
- });
6401
- });
6402
- beforeSyncUpdate();
6403
- _list.listToFoot(function invokeLayoutEffectList(_fiber) {
6404
- layoutEffect(_dispatch, _fiber);
6405
- });
6406
- afterSyncUpdate();
6407
- function invokeEffectListTask() {
6408
- enableScopeTreeLog$2.current && setLogScope();
6409
- _list.listToFoot(function invokeEffectList(_fiber) {
6410
- effect(_dispatch, _fiber);
6411
- });
6412
- enableScopeTreeLog$2.current && resetLogScope();
6413
- }
6414
- addEffectCallback(invokeEffectListTask);
6415
- var renderScheduler = currentScheduler$2.current;
6416
- if (_dispatch.enableConcurrentMode) {
6417
- renderScheduler.macroTask(function flushEffect() {
6418
- flushEffectCallback();
6419
- });
6420
- }
6421
- else {
6422
- renderScheduler.microTask(function flushEffect() {
6423
- flushEffectCallback();
6424
- });
6425
- }
6426
- };
6427
- var defaultDispatchMount = defaultDispatchMountLatest;
6428
-
6429
- var defaultResolveScope = function (fiber) {
6430
- var parent = fiber.parent;
6431
- while (parent) {
6432
- if (myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scope__) || myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scopeSuspense__)) {
6433
- return parent;
6434
- }
6435
- parent = parent.parent;
6436
- }
6437
- return null;
6438
- };
6439
-
6440
- var enableDebugFiled$1 = react.__my_react_shared__.enableDebugFiled;
6441
- var defaultGenerateStrict = function (fiber) {
6442
- {
6443
- var parent_1 = fiber.parent;
6444
- var isStrict = false;
6445
- var typedParent = parent_1;
6446
- if (parent_1) {
6447
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__strict__)) {
6448
- isStrict = true;
6449
- }
6450
- if (typedParent._debugStrict) {
6451
- isStrict = true;
6452
- }
6453
- }
6454
- if (enableDebugFiled$1.current) {
6455
- var typedFiber = fiber;
6456
- typedFiber._debugStrict = isStrict;
6457
- }
6458
- return isStrict;
6459
- }
6460
- };
6461
-
6462
- var currentScheduler$1 = react.__my_react_internal__.currentScheduler;
6463
- var enableScopeTreeLog$1 = react.__my_react_shared__.enableScopeTreeLog;
6464
- var defaultDispatchUpdate = function (_dispatch, _list) {
6465
- // TODO maybe need call `insertionEffect` in another function
6466
- beforeSyncUpdate();
6467
- _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
6468
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6469
- defaultInvokeUnmountList(_dispatch, _fiber);
6470
- }
6471
- });
6472
- _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
6473
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6474
- insertionEffect(_dispatch, _fiber);
6475
- }
6476
- });
6477
- afterSyncUpdate();
6478
- _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
6479
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6480
- safeCallWithCurrentFiber({
6481
- fiber: _fiber,
6482
- action: function safeCallCreateAndUpdate() {
6483
- _dispatch.commitCreate(_fiber);
6484
- _dispatch.commitUpdate(_fiber);
6485
- },
6486
- });
6487
- }
6488
- });
6489
- _list.listToHead(function invokePositionList(_fiber) {
6490
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6491
- safeCallWithCurrentFiber({
6492
- fiber: _fiber,
6493
- action: function safeCallPosition() {
6494
- _dispatch.commitPosition(_fiber);
6495
- },
6496
- });
6497
- }
6498
- });
6499
- _list.listToFoot(function invokeAppendList(_fiber) {
6500
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6501
- safeCallWithCurrentFiber({
6502
- fiber: _fiber,
6503
- action: function safeCallAppendList() {
6504
- _dispatch.commitAppend(_fiber);
6505
- },
6506
- });
6507
- }
6508
- });
6509
- _list.listToFoot(function invokeSetRefList(_fiber) {
6510
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6511
- safeCallWithCurrentFiber({
6512
- fiber: _fiber,
6513
- action: function safeCallSetRefList() {
6514
- _dispatch.commitSetRef(_fiber);
6515
- },
6516
- });
6517
- }
6518
- });
6519
- beforeSyncUpdate();
6520
- _list.listToFoot(function invokeLayoutEffectList(_fiber) {
6521
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6522
- layoutEffect(_dispatch, _fiber);
6523
- }
6524
- });
6525
- afterSyncUpdate();
6526
- function invokeEffectListTask() {
6527
- enableScopeTreeLog$1.current && setLogScope();
6528
- _list.listToFoot(function invokeEffectList(_fiber) {
6529
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
6530
- effect(_dispatch, _fiber);
6531
- }
6532
- });
6533
- enableScopeTreeLog$1.current && resetLogScope();
6534
- }
6535
- addEffectCallback(invokeEffectListTask);
6536
- var renderScheduler = currentScheduler$1.current;
6537
- if (_dispatch.enableConcurrentMode) {
6538
- renderScheduler.macroTask(function flushEffect() {
6539
- flushEffectCallback();
6540
- });
6541
- }
6542
- else {
6543
- renderScheduler.microTask(function flushEffect() {
6544
- flushEffectCallback();
6545
- });
6546
- }
6547
- };
6548
-
6549
- var enableSuspenseRoot = react.__my_react_shared__.enableSuspenseRoot;
6550
- var currentScheduler = react.__my_react_internal__.currentScheduler;
6551
- var loadPromise = function (renderDispatch, promise) { return __awaiter(void 0, void 0, void 0, function () {
6552
- var value, reason_1;
6553
- return __generator(this, function (_a) {
6554
- switch (_a.label) {
6555
- case 0:
6556
- if (promise.status === "fulfilled" || promise.status === "rejected")
6557
- return [2 /*return*/];
6558
- _a.label = 1;
6559
- case 1:
6560
- _a.trys.push([1, 3, , 4]);
6561
- promise.status = "pending";
6562
- return [4 /*yield*/, Promise.resolve(promise)];
6563
- case 2:
6564
- value = _a.sent();
6565
- promise.status = "fulfilled";
6566
- promise._value = value;
6567
- return [3 /*break*/, 4];
6568
- case 3:
6569
- reason_1 = _a.sent();
6570
- promise.status = "rejected";
6571
- promise._reason = reason_1;
6572
- return [3 /*break*/, 4];
6573
- case 4: return [2 /*return*/];
6574
- }
6575
- });
6576
- }); };
6577
- var processPromise = function (renderDispatch, fiber, promise) {
6578
- var _a, _b;
6579
- defaultDeleteCurrentEffect(renderDispatch, fiber);
6580
- if (promise.status === "rejected") {
6581
- (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6582
- return null;
6583
- }
6584
- if (promise.status === "fulfilled") {
6585
- {
6586
- console.warn("[@my-react/react] throw a promise what has already fulfilled, this is not a valid usage");
6587
- }
7009
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__lazy__)) {
7010
+ nextWorkLazy(renderDispatch, fiber);
6588
7011
  }
6589
- promise._list = promise._list || new Set();
6590
- promise._list.add(fiber);
6591
- var suspenseFiber = renderDispatch.resolveSuspenseFiber(fiber);
6592
- if (suspenseFiber) {
6593
- var suspenseField = getInstanceFieldByInstance(suspenseFiber.instance);
6594
- suspenseField.asyncLoadList.uniPush(promise);
6595
- renderDispatch.pendingSuspenseFiberArray.uniPush(suspenseFiber);
6596
- return null;
7012
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__suspense__)) {
7013
+ nextWorkSuspense(renderDispatch, fiber);
6597
7014
  }
6598
- else {
6599
- // TODO update flow
6600
- if (enableSuspenseRoot.current && !renderDispatch.isAppMounted) {
6601
- var suspenseField = getInstanceFieldByInstance(renderDispatch);
6602
- suspenseField.asyncLoadList.uniPush(promise);
6603
- return null;
6604
- }
6605
- devWarnWithFiber(fiber, "[@my-react/react] promise must be used inside a Suspense component, otherwise it will not work as expected");
6606
- if (promise._loading)
6607
- return null;
6608
- promise._loading = true;
6609
- promise.status = "pending";
6610
- var renderScheduler_1 = currentScheduler.current;
6611
- renderDispatch
6612
- .processPromise(promise)
6613
- .then(function () {
6614
- fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6615
- promise._list.delete(fiber);
6616
- promise._loading = false;
6617
- var updater = {
6618
- type: myreactSharedExports.UpdateQueueType.promise,
6619
- trigger: fiber,
6620
- isSync: true,
6621
- isForce: true,
6622
- payLoad: promise,
6623
- };
6624
- renderScheduler_1.dispatchState(updater);
6625
- })
6626
- .catch(function (e) { return renderScheduler_1.dispatchError({ fiber: fiber, error: e }); });
6627
- return null;
7015
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__consumer__)) {
7016
+ nextWorkConsumer(renderDispatch, fiber);
6628
7017
  }
6629
- };
6630
- var processSuspensePromise = function (renderDispatch, fiber, promise) {
6631
- var _a, _b;
6632
- defaultDeleteCurrentEffect(renderDispatch, fiber);
6633
- fiber.state = myreactSharedExports.STATE_TYPE.__suspense__;
6634
- if (promise.status === "rejected") {
6635
- (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6636
- return null;
7018
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__provider__ | exports.NODE_TYPE.__context__)) {
7019
+ nextWorkProvider(renderDispatch, fiber);
6637
7020
  }
6638
- if (promise.status === "fulfilled") {
6639
- {
6640
- console.warn("[@my-react/react] throw a promise what has already fulfilled, this is not a valid usage");
6641
- }
7021
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__activity__)) {
7022
+ nextWorkActivity(renderDispatch, fiber);
7023
+ }
7024
+ else {
7025
+ nextWorkNormal(renderDispatch, fiber);
6642
7026
  }
6643
- promise._list = promise._list || new Set();
6644
- promise._list.add(fiber);
6645
- if (promise._loading)
6646
- return null;
6647
- promise._loading = true;
6648
- promise.status = "pending";
6649
- var renderScheduler = currentScheduler.current;
6650
- renderDispatch
6651
- .processPromise(promise)
6652
- .then(function () {
6653
- fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6654
- promise._list.delete(fiber);
6655
- promise._loading = false;
6656
- var updater = {
6657
- type: myreactSharedExports.UpdateQueueType.promise,
6658
- trigger: fiber,
6659
- isSync: true,
6660
- isForce: true,
6661
- payLoad: promise,
6662
- };
6663
- renderScheduler.dispatchState(updater);
6664
- })
6665
- .catch(function (e) { return renderScheduler.dispatchError({ fiber: fiber, error: e }); });
6666
- return null;
6667
7027
  };
6668
7028
 
6669
7029
  var CustomRenderDispatch = /** @class */ (function (_super) {
@@ -6675,7 +7035,7 @@ function requireIndex_development_1 () {
6675
7035
  _this.isAppMounted = false;
6676
7036
  _this.isAppCrashed = false;
6677
7037
  _this.isAppUnmounted = false;
6678
- _this.version = "0.3.18";
7038
+ _this.version = "0.3.20";
6679
7039
  _this.mode = "development" ;
6680
7040
  _this.renderMode = "render";
6681
7041
  _this.pendingCommitFiberList = null;
@@ -6819,29 +7179,29 @@ function requireIndex_development_1 () {
6819
7179
  (_a = instance.beforeCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
6820
7180
  });
6821
7181
  safeCall(function safeCallBeforeCommitListener() {
6822
- listenerMap.get(instance).beforeCommitMount.forEach(function (cb) { return cb(); });
7182
+ instance.callOnBeforeCommitMount(instance);
6823
7183
  });
6824
7184
  defaultDispatchMount(this, _fiber);
6825
7185
  safeCall(function safeCallAfterCommitListener() {
6826
- listenerMap.get(instance).afterCommitMount.forEach(function (cb) { return cb(); });
7186
+ instance.callOnAfterCommitMount(instance);
6827
7187
  });
6828
7188
  safeCall(function safeCallAfterCommit() {
6829
7189
  var _a;
6830
7190
  (_a = instance.afterCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
6831
7191
  });
6832
7192
  };
6833
- CustomRenderDispatch.prototype.reconcileUpdate = function (_list) {
7193
+ CustomRenderDispatch.prototype.reconcileUpdate = function (_list, sync) {
6834
7194
  var instance = this;
6835
7195
  safeCall(function safeCallBeforeUpdate() {
6836
7196
  var _a;
6837
7197
  (_a = instance.beforeUpdate) === null || _a === void 0 ? void 0 : _a.call(instance);
6838
7198
  });
6839
7199
  safeCall(function safeCallBeforeUpdateListener() {
6840
- listenerMap.get(instance).beforeCommitUpdate.forEach(function (cb) { return cb(); });
7200
+ instance.callOnBeforeCommitUpdate(instance);
6841
7201
  });
6842
- defaultDispatchUpdate(this, _list);
7202
+ defaultDispatchUpdate(this, _list, sync);
6843
7203
  safeCall(function safeCallAfterUpdateListener() {
6844
- listenerMap.get(instance).afterCommitUpdate.forEach(function (cb) { return cb(); });
7204
+ instance.callOnAfterCommitUpdate(instance);
6845
7205
  });
6846
7206
  safeCall(function safeCallAfterUpdate() {
6847
7207
  var _a;
@@ -6855,11 +7215,11 @@ function requireIndex_development_1 () {
6855
7215
  (_a = instance.beforeUnmount) === null || _a === void 0 ? void 0 : _a.call(instance);
6856
7216
  });
6857
7217
  safeCall(function safeCallBeforeUnmountListener() {
6858
- listenerMap.get(instance).beforeCommitUnmount.forEach(function (cb) { return cb(); });
7218
+ instance.callOnBeforeCommitUnmount(instance);
6859
7219
  });
6860
7220
  defaultDispatchUnmount(this);
6861
7221
  safeCall(function safeCallAfterUnmountListener() {
6862
- listenerMap.get(instance).afterCommitUnmount.forEach(function (cb) { return cb(); });
7222
+ instance.callOnAfterCommitUnmount(instance);
6863
7223
  });
6864
7224
  safeCall(function safeCallAfterUnmount() {
6865
7225
  var _a;
@@ -6889,162 +7249,6 @@ function requireIndex_development_1 () {
6889
7249
  return CustomRenderDispatch;
6890
7250
  }(RenderDispatchEvent));
6891
7251
 
6892
- var enableDebugFiled = react.__my_react_shared__.enableDebugFiled;
6893
- var currentRunningFiber = react.__my_react_internal__.currentRunningFiber, MyReactInternalInstance = react.__my_react_internal__.MyReactInternalInstance;
6894
- var defaultGetContextValue = function (fiber, ContextObject) {
6895
- var _a;
6896
- if (fiber) {
6897
- return fiber.pendingProps["value"];
6898
- }
6899
- else {
6900
- return (_a = ContextObject === null || ContextObject === void 0 ? void 0 : ContextObject.Provider) === null || _a === void 0 ? void 0 : _a["value"];
6901
- }
6902
- };
6903
- var defaultGetContextFiber = function (fiber, ContextObject) {
6904
- if ((fiber === null || fiber === void 0 ? void 0 : fiber.parent) && ContextObject) {
6905
- var parent_1 = fiber.parent;
6906
- while (parent_1) {
6907
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__provider__)) {
6908
- var typedElementType = parent_1.elementType;
6909
- var contextObj = typedElementType["Context"];
6910
- if (contextObj === ContextObject) {
6911
- return parent_1;
6912
- }
6913
- }
6914
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__context__)) {
6915
- var typedElementType = parent_1.elementType;
6916
- var contextObj = typedElementType;
6917
- if (contextObj === ContextObject) {
6918
- return parent_1;
6919
- }
6920
- }
6921
- parent_1 = parent_1.parent;
6922
- }
6923
- }
6924
- else {
6925
- return null;
6926
- }
6927
- };
6928
- var defaultReadContext = function (Context) {
6929
- var fiber = currentRunningFiber.current;
6930
- if (!Context) {
6931
- throw new Error("the Context what you read is not exist");
6932
- }
6933
- if (!fiber) {
6934
- throw new Error('current environment is not support "readContext"');
6935
- }
6936
- var isUpdate = !!fiber.instance;
6937
- fiber.instance = fiber.instance || new MyReactInternalInstance();
6938
- !isUpdate && initInstance(fiber.instance);
6939
- !isUpdate && setOwnerForInstance(fiber.instance, fiber);
6940
- var contextFiber = defaultGetContextFiber(fiber, Context);
6941
- setSubscribeForInstance(fiber.instance, contextFiber);
6942
- return defaultGetContextValue(contextFiber, Context);
6943
- };
6944
- var prepareUpdateAllDependence = function (renderDispatch, fiber, beforeValue, afterValue) {
6945
- var consumerList = new Set((fiber === null || fiber === void 0 ? void 0 : fiber.dependence) || []);
6946
- consumerList.forEach(function prepareUpdateSingleConsumer(i) {
6947
- var owner = getInstanceOwnerFiber(i);
6948
- if (owner && myreactSharedExports.exclude(owner.state, myreactSharedExports.STATE_TYPE.__unmount__)) {
6949
- var typedFiber_1 = owner;
6950
- typedFiber_1.state = myreactSharedExports.STATE_TYPE.__triggerSyncForce__;
6951
- }
6952
- });
6953
- var typedFiber = fiber;
6954
- var processedNodes = [];
6955
- var updater = {
6956
- type: myreactSharedExports.UpdateQueueType.context,
6957
- trigger: fiber,
6958
- payLoad: afterValue,
6959
- isSync: true,
6960
- isForce: true,
6961
- isImmediate: true,
6962
- isRetrigger: true,
6963
- };
6964
- if (enableDebugFiled.current) {
6965
- var now = Date.now();
6966
- updater._debugBeforeValue = beforeValue;
6967
- updater._debugAfterValue = afterValue;
6968
- updater._debugCreateTime = now;
6969
- updater._debugRunTime = now;
6970
- updater._debugType = myreactSharedExports.UpdateQueueType[myreactSharedExports.UpdateQueueType.context];
6971
- if (enableDebugUpdateQueue.current) {
6972
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new myreactSharedExports.ListTree();
6973
- typedFiber._debugUpdateQueue.push(updater);
6974
- }
6975
- }
6976
- processedNodes.push(updater);
6977
- var updateState = {
6978
- needUpdate: true,
6979
- nodes: processedNodes,
6980
- isSync: true,
6981
- isForce: true,
6982
- isImmediate: true,
6983
- isRetrigger: true,
6984
- };
6985
- safeCallWithCurrentFiber({
6986
- fiber: fiber,
6987
- action: function safeCallFiberTriggerListener() {
6988
- var _a, _b;
6989
- (_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); });
6990
- },
6991
- });
6992
- };
6993
-
6994
- var currentComponentFiber = react.__my_react_internal__.currentComponentFiber, currentHookNodeIndex = react.__my_react_internal__.currentHookNodeIndex;
6995
- var resolveHookValue = function (hookNode, field) {
6996
- if (hookNode) {
6997
- switch (hookNode.type) {
6998
- case myreactSharedExports.HOOK_TYPE.useState:
6999
- case myreactSharedExports.HOOK_TYPE.useReducer:
7000
- return [hookNode.result, field.dispatch];
7001
- case myreactSharedExports.HOOK_TYPE.useId:
7002
- case myreactSharedExports.HOOK_TYPE.useRef:
7003
- case myreactSharedExports.HOOK_TYPE.useMemo:
7004
- case myreactSharedExports.HOOK_TYPE.useContext:
7005
- case myreactSharedExports.HOOK_TYPE.useCallback:
7006
- case myreactSharedExports.HOOK_TYPE.useDeferredValue:
7007
- case myreactSharedExports.HOOK_TYPE.useSyncExternalStore:
7008
- return hookNode.result;
7009
- case myreactSharedExports.HOOK_TYPE.useOptimistic:
7010
- case myreactSharedExports.HOOK_TYPE.useTransition:
7011
- return [hookNode.result.value, hookNode.result.start];
7012
- case myreactSharedExports.HOOK_TYPE.useSignal:
7013
- return [hookNode.result.getValue, hookNode.result.setValue];
7014
- }
7015
- }
7016
- };
7017
- var processHook = function (renderDispatch, _a) {
7018
- var type = _a.type, reducer = _a.reducer, value = _a.value, deps = _a.deps;
7019
- var fiber = currentComponentFiber.current;
7020
- if (!fiber)
7021
- throw new Error("[@my-react/react] can not use hook outside of component");
7022
- if (!renderDispatch)
7023
- throw new Error("[@my-react/react] internal error, can not get 'renderDispatch' for current render");
7024
- fiber.hookList = fiber.hookList || new myreactSharedExports.ListTree();
7025
- var currentHook = null;
7026
- // initial
7027
- if (myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__create__ | myreactSharedExports.STATE_TYPE.__recreate__)) {
7028
- currentHook = createHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber);
7029
- safeCall(function safeCallHookInitialListener() {
7030
- var _a, _b;
7031
- (_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); });
7032
- });
7033
- }
7034
- else {
7035
- // update
7036
- currentHook = updateHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber, Boolean(myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__hmr__)));
7037
- safeCall(function safeCallHookUpdateListener() {
7038
- var _a, _b;
7039
- (_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); });
7040
- });
7041
- }
7042
- currentHookNodeIndex.current++;
7043
- var field = getInstanceFieldByInstance(currentHook);
7044
- effectHookNode(renderDispatch, fiber, currentHook, field);
7045
- return resolveHookValue(currentHook, field);
7046
- };
7047
-
7048
7252
  var globalLoop = react.__my_react_internal__.globalLoop;
7049
7253
  var enableScopeTreeLog = react.__my_react_shared__.enableScopeTreeLog;
7050
7254
  function finishMountSync(renderDispatch, fiber) {
@@ -7059,21 +7263,23 @@ function requireIndex_development_1 () {
7059
7263
  safeCallWithCurrentFiber({
7060
7264
  fiber: fiber,
7061
7265
  action: function safeCallFiberHasChangeListener() {
7062
- var _a, _b;
7063
- (_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);
7064
7267
  },
7065
7268
  });
7066
7269
  }
7067
7270
  var mountSync = function (renderDispatch, fiber) {
7068
- var _a, _b, _c;
7069
- ((_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
+ });
7070
7274
  globalLoop.current = true;
7071
7275
  enableScopeTreeLog.current && setLogScope();
7072
7276
  mountLoopAll(renderDispatch, fiber);
7073
7277
  processAsyncLoadListOnSyncMount(renderDispatch);
7074
7278
  enableScopeTreeLog.current && resetLogScope();
7075
7279
  finishMountSync(renderDispatch, fiber);
7076
- ((_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
+ });
7077
7283
  globalLoop.current = false;
7078
7284
  };
7079
7285
  function finishMountAsync(renderDispatch, fiber) {
@@ -7088,33 +7294,35 @@ function requireIndex_development_1 () {
7088
7294
  safeCallWithCurrentFiber({
7089
7295
  fiber: fiber,
7090
7296
  action: function safeCallFiberHasChangeListener() {
7091
- var _a, _b;
7092
- (_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);
7093
7298
  },
7094
7299
  });
7095
7300
  }
7096
7301
  var mountAsync = function (renderDispatch, fiber) { return __awaiter(void 0, void 0, void 0, function () {
7097
- var _a, _b, _c;
7098
- return __generator(this, function (_d) {
7099
- switch (_d.label) {
7302
+ return __generator(this, function (_a) {
7303
+ switch (_a.label) {
7100
7304
  case 0:
7101
- ((_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
+ });
7102
7308
  globalLoop.current = true;
7103
7309
  enableScopeTreeLog.current && setLogScope();
7104
7310
  mountLoopAll(renderDispatch, fiber);
7105
7311
  return [4 /*yield*/, processAsyncLoadListOnAsyncMount(renderDispatch)];
7106
7312
  case 1:
7107
- _d.sent();
7313
+ _a.sent();
7108
7314
  enableScopeTreeLog.current && resetLogScope();
7109
7315
  finishMountAsync(renderDispatch, fiber);
7110
- ((_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
+ });
7111
7319
  globalLoop.current = false;
7112
7320
  return [2 /*return*/];
7113
7321
  }
7114
7322
  });
7115
7323
  }); };
7116
7324
 
7117
- var version = "0.3.18";
7325
+ var version = "0.3.20";
7118
7326
 
7119
7327
  exports.CustomRenderDispatch = CustomRenderDispatch;
7120
7328
  exports.MyReactFiberNode = MyReactFiberNode;
@@ -7216,7 +7424,6 @@ function requireIndex_development_1 () {
7216
7424
  exports.isErrorBoundariesComponent = isErrorBoundariesComponent;
7217
7425
  exports.isErrorBoundariesInstance = isErrorBoundariesInstance;
7218
7426
  exports.layoutEffect = layoutEffect;
7219
- exports.listenerMap = listenerMap;
7220
7427
  exports.loadLazy = loadLazy;
7221
7428
  exports.loadPromise = loadPromise;
7222
7429
  exports.mountAsync = mountAsync;
@@ -7225,6 +7432,7 @@ function requireIndex_development_1 () {
7225
7432
  exports.mountLoopAllFromScheduler = mountLoopAllFromScheduler;
7226
7433
  exports.mountSync = mountSync;
7227
7434
  exports.mountToNextFiberFromRoot = mountToNextFiberFromRoot;
7435
+ exports.nextWorkActivity = nextWorkActivity;
7228
7436
  exports.nextWorkClassComponent = nextWorkClassComponent;
7229
7437
  exports.nextWorkCommon = nextWorkCommon;
7230
7438
  exports.nextWorkComponent = nextWorkComponent;
@@ -7412,6 +7620,7 @@ function requireIndex_development () {
7412
7620
  var ScopeSuspense = Symbol.for("react.scope_suspense");
7413
7621
  var Comment = Symbol.for("react.comment");
7414
7622
  var Offscreen = Symbol.for("react.offscreen");
7623
+ var Activity = Symbol.for("react.activity");
7415
7624
  var Profiler = Symbol.for("react.profiler");
7416
7625
 
7417
7626
  function isObject(target) {
@@ -7511,6 +7720,7 @@ function requireIndex_development () {
7511
7720
  HOOK_TYPE[HOOK_TYPE["useImperativeHandle"] = 14] = "useImperativeHandle";
7512
7721
  HOOK_TYPE[HOOK_TYPE["useSyncExternalStore"] = 15] = "useSyncExternalStore";
7513
7722
  HOOK_TYPE[HOOK_TYPE["useOptimistic"] = 16] = "useOptimistic";
7723
+ HOOK_TYPE[HOOK_TYPE["useEffectEvent"] = 17] = "useEffectEvent";
7514
7724
  })(exports.HOOK_TYPE || (exports.HOOK_TYPE = {}));
7515
7725
 
7516
7726
  exports.UpdateQueueType = void 0;
@@ -7933,6 +8143,7 @@ function requireIndex_development () {
7933
8143
  });
7934
8144
  }
7935
8145
 
8146
+ exports.Activity = Activity;
7936
8147
  exports.Comment = Comment;
7937
8148
  exports.Consumer = Consumer;
7938
8149
  exports.Context = Context;
@@ -8028,19 +8239,18 @@ var delGlobalDispatch = function (dispatch) {
8028
8239
  var setRef = function (_fiber, config) {
8029
8240
  if (myreactSharedExports.include(_fiber.patch, myreactSharedExports.PATCH_TYPE.__ref__)) {
8030
8241
  var cleanUp = function () {
8031
- var refPrevious = _fiber.refPrevious;
8032
- myreactReconcilerExports.safeCallWithCurrentFiber({
8033
- fiber: _fiber,
8034
- action: function safeCallRefPrevious() {
8035
- if (typeof refPrevious === "object" && refPrevious !== null) {
8036
- refPrevious.current = null;
8037
- }
8038
- else if (typeof refPrevious === "function") {
8039
- refPrevious === null || refPrevious === void 0 ? void 0 : refPrevious(null);
8040
- }
8041
- },
8042
- });
8043
- _fiber.refPrevious = undefined;
8242
+ // const refPrevious = _fiber.refPrevious;
8243
+ // safeCallWithCurrentFiber({
8244
+ // fiber: _fiber,
8245
+ // action: function safeCallRefPrevious() {
8246
+ // if (typeof refPrevious === "object" && refPrevious !== null) {
8247
+ // refPrevious.current = null;
8248
+ // } else if (typeof refPrevious === "function") {
8249
+ // refPrevious?.(null);
8250
+ // }
8251
+ // },
8252
+ // });
8253
+ // _fiber.refPrevious = undefined;
8044
8254
  var refCleanup = _fiber.refCleanup;
8045
8255
  myreactReconcilerExports.safeCallWithCurrentFiber({
8046
8256
  fiber: _fiber,
@@ -8498,6 +8708,9 @@ var ReconcilerDispatchFiber = function (renderDispatch, fiber) {
8498
8708
  else if (myreactSharedExports.include(fiber.type, myreactReconcilerExports.NODE_TYPE.__provider__ | myreactReconcilerExports.NODE_TYPE.__context__)) {
8499
8709
  myreactReconcilerExports.nextWorkProvider(renderDispatch, fiber);
8500
8710
  }
8711
+ else if (myreactSharedExports.include(fiber.type, myreactReconcilerExports.NODE_TYPE.__activity__)) {
8712
+ myreactReconcilerExports.nextWorkActivity(renderDispatch, fiber);
8713
+ }
8501
8714
  else {
8502
8715
  myreactReconcilerExports.nextWorkNormal(renderDispatch, fiber);
8503
8716
  }
@@ -8580,7 +8793,7 @@ var ReconcilerDispatchMount = function (_dispatch, _fiber, config) {
8580
8793
 
8581
8794
  var currentScheduler$1 = require$$0.__my_react_internal__.currentScheduler;
8582
8795
  var enableScopeTreeLog$2 = require$$0.__my_react_shared__.enableScopeTreeLog;
8583
- var ReconcilerDispatchUpdate = function (_dispatch, _list, config) {
8796
+ var ReconcilerDispatchUpdate = function (_dispatch, _list, config, sync) {
8584
8797
  myreactReconcilerExports.beforeSyncUpdate();
8585
8798
  _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
8586
8799
  if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
@@ -8682,7 +8895,7 @@ var ReconcilerDispatchUpdate = function (_dispatch, _list, config) {
8682
8895
  }
8683
8896
  myreactReconcilerExports.addEffectCallback(invokeEffectListTask);
8684
8897
  var renderScheduler = currentScheduler$1.current;
8685
- if (_dispatch.enableConcurrentMode) {
8898
+ if (_dispatch.enableConcurrentMode && !sync) {
8686
8899
  renderScheduler.macroTask(function flushEffect() {
8687
8900
  myreactReconcilerExports.flushEffectCallback();
8688
8901
  });
@@ -8749,11 +8962,11 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8749
8962
  (_a = instance.beforeCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
8750
8963
  });
8751
8964
  myreactReconcilerExports.safeCall(function safeCallBeforeCommitListener() {
8752
- myreactReconcilerExports.listenerMap.get(instance).beforeCommitMount.forEach(function (cb) { return cb(); });
8965
+ instance.callOnBeforeCommitMount(instance);
8753
8966
  });
8754
8967
  ReconcilerDispatchMount(this, _fiber, config);
8755
8968
  myreactReconcilerExports.safeCall(function safeCallAfterCommitListener() {
8756
- myreactReconcilerExports.listenerMap.get(instance).afterCommitMount.forEach(function (cb) { return cb(); });
8969
+ instance.callOnAfterCommitMount(instance);
8757
8970
  });
8758
8971
  myreactReconcilerExports.safeCall(function safeCallAfterCommit() {
8759
8972
  var _a;
@@ -8761,7 +8974,7 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8761
8974
  });
8762
8975
  (_b = config.resetAfterCommit) === null || _b === void 0 ? void 0 : _b.call(config, rootNode);
8763
8976
  };
8764
- ReconcilerDispatch.prototype.reconcileUpdate = function (_list) {
8977
+ ReconcilerDispatch.prototype.reconcileUpdate = function (_list, sync) {
8765
8978
  var _a, _b;
8766
8979
  (_a = config.prepareForCommit) === null || _a === void 0 ? void 0 : _a.call(config, rootNode);
8767
8980
  var instance = this;
@@ -8770,11 +8983,11 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8770
8983
  (_a = instance.beforeUpdate) === null || _a === void 0 ? void 0 : _a.call(instance);
8771
8984
  });
8772
8985
  myreactReconcilerExports.safeCall(function safeCallBeforeUpdateListener() {
8773
- myreactReconcilerExports.listenerMap.get(instance).beforeCommitUpdate.forEach(function (cb) { return cb(); });
8986
+ instance.callOnBeforeCommitUpdate(instance);
8774
8987
  });
8775
- ReconcilerDispatchUpdate(this, _list, config);
8988
+ ReconcilerDispatchUpdate(this, _list, config, sync);
8776
8989
  myreactReconcilerExports.safeCall(function safeCallAfterUpdateListener() {
8777
- myreactReconcilerExports.listenerMap.get(instance).afterCommitUpdate.forEach(function (cb) { return cb(); });
8990
+ instance.callOnAfterCommitUpdate(instance);
8778
8991
  });
8779
8992
  myreactReconcilerExports.safeCall(function safeCallAfterUpdate() {
8780
8993
  var _a;
@@ -8921,7 +9134,7 @@ var prepareScheduler = function () {
8921
9134
 
8922
9135
  var enableDebugFiled = require$$0.__my_react_shared__.enableDebugFiled, enableScopeTreeLog = require$$0.__my_react_shared__.enableScopeTreeLog;
8923
9136
  var currentScheduler = require$$0.__my_react_internal__.currentScheduler;
8924
- // react-reconciler compact implementation
9137
+ // react-reconciler compat implementation
8925
9138
  var Reconciler = function (_config) {
8926
9139
  var rendererPackageName = "@my-react";
8927
9140
  var ReconcilerSet = new Set();
@@ -9031,7 +9244,7 @@ var Reconciler = function (_config) {
9031
9244
  };
9032
9245
  };
9033
9246
 
9034
- var version = "0.0.9";
9247
+ var version = "0.0.11";
9035
9248
  var createReconciler = Reconciler;
9036
9249
 
9037
9250
  exports.createReconciler = createReconciler;